{"version":3,"file":"index.cjs","names":["DistroUtils","S_TO_NS","TypeValidationError","RangeValidationError","rclnodejs","ClockType","ClockType","TypeValidationError","RangeValidationError","rclnodejs","rclnodejs","OperationError","rclnodejs","ClockType","rclnodejs","TypeValidationError","path","TypeValidationError","rclnodejs","TypeValidationError","ParameterError","ParameterTypeError","RangeValidationError","valArr","isClose","QoS","NameValidationError","TypeValidationError","rclnodejs","Deferred","rclnodejs","ActionInterfaces","Entity","loader","QoS","rclnodejs","TypeValidationError","ActionInterfaces","ActionUuid","DistroUtils","rclnodejs","TypeValidationError","rclnodejs","debug","createDebug","TypeValidationError","normalizeNodeName","ParameterNotFoundError","OperationError","debug","createDebug","PARAMETER_EVENT_MSG_TYPE","PARAMETER_EVENT_TOPIC","TypeValidationError","normalizeNodeName","OperationError","debug","createDebug","EventEmitter","TypeValidationError","normalizeNodeName","OperationError","TimeoutError","TypeValidationError","loader","toPlainObject","Subject","debug","createDebug","Entity","TypeValidationError","assertValidMessage","rclnodejs","TimeoutError","AbortError","DistroUtils","Entity","rclnodejs","debug","createDebug","Entity","rclnodejs","assertValidMessage","OperationError","rclnodejs","debug","createDebug","rclnodejs","Entity","DistroUtils","debug","createDebug","Entity","applySerializationMode","rclnodejs","DistroUtils","rclnodejs","TypeValidationError","OperationError","rclnodejs","DistroUtils","rclnodejs","loader","Entity","rclnodejs","DistroUtils","OperationError","debug","createDebug","rclnodejs","TypeValidationError","Clock.ROSClock","DistroUtils","ActionInterfaces","Entity","QoS","isValidSerializationMode","ValidationError","Clock.Clock","RangeValidationError","Rates.RateTimerServer","Rates.Rate","loader","rclnodejs","rclnodejs","loader","ValidationError","debug","createDebug","path","generator","fs","spawn","ClockType","DistroUtils","logging","QoS","ActionClient","ActionUuid","ClientGoalHandle","rclnodejs","compareVersions","loader","tsdGenerator","toJSONSafe","toJSONString","ValidationProblem","getMessageSchema","getFieldNames","getFieldType","validateMessage","assertValidMessage","createMessageValidator"],"sources":["../lib/rmw.js","../lib/duration.js","../lib/clock_type.js","../lib/time.js","../lib/clock_change.js","../lib/context.js","../lib/clock_event.js","../lib/clock.js","../lib/logging.js","../lib/parameter.js","../lib/node_options.js","../lib/qos_overriding_options.js","../lib/validator.js","../lib/action/response.js","../lib/action/server_goal_handle.js","../lib/action/server.js","../lib/action/endpoint_info.js","../lib/action/graph.js","../lib/service_introspection.js","../lib/serialization.js","../lib/parameter_client.js","../lib/parameter_event_handler.js","../lib/parameter_watcher.js","../lib/wait_for_message.js","../lib/message_introspector.js","../lib/message_info.js","../lib/observable_subscription.js","../lib/client.js","../lib/guard_condition.js","../lib/logging_service.js","../lib/parameter_service.js","../lib/publisher.js","../lib/rate.js","../lib/service.js","../lib/subscription.js","../lib/time_source.js","../lib/timer.js","../lib/type_description_service.js","../lib/entity_registry.js","../lib/event_handler.js","../lib/node.js","../lib/lifecycle_publisher.js","../lib/lifecycle.js","../index.js"],"sourcesContent":["// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport DistroUtils from './distro.js';\n\nconst RMWNames = {\n  FASTRTPS: 'rmw_fastrtps_cpp',\n  CONNEXT: 'rmw_connext_cpp',\n  CYCLONEDDS: 'rmw_cyclonedds_cpp',\n  GURUMDDS: 'rmw_gurumdds_cpp',\n  ZENOH: 'rmw_zenoh_cpp',\n};\n\nconst DefaultRosRMWNameMap = new Map();\nDefaultRosRMWNameMap.set('eloquent', RMWNames.FASTRTPS);\nDefaultRosRMWNameMap.set('foxy', RMWNames.FASTRTPS);\nDefaultRosRMWNameMap.set('galactic', RMWNames.CYCLONEDDS);\nDefaultRosRMWNameMap.set('humble', RMWNames.FASTRTPS);\nDefaultRosRMWNameMap.set('iron', RMWNames.FASTRTPS);\nDefaultRosRMWNameMap.set('jazzy', RMWNames.FASTRTPS);\nDefaultRosRMWNameMap.set('kilted', RMWNames.FASTRTPS);\nDefaultRosRMWNameMap.set('rolling', RMWNames.FASTRTPS);\n\nconst RMWUtils = {\n  RMWNames: RMWNames,\n\n  getRMWName: function () {\n    return process.env.RMW_IMPLEMENTATION\n      ? process.env.RMW_IMPLEMENTATION\n      : DefaultRosRMWNameMap.get(DistroUtils.getDistroName()) ||\n          RMWNames.FASTRTPS;\n  },\n};\n\nexport default RMWUtils;\n","// Copyright (c) 2018 Intel Corporation. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport rclnodejs from './native_loader.js';\nimport { TypeValidationError, RangeValidationError } from './errors.js';\nconst S_TO_NS = 10n ** 9n;\n\n/**\n * @class - Class representing a Duration in ROS\n */\n\nclass Duration {\n  /**\n   * Create a Duration.\n   * @param {bigint} [seconds=0] - The second part of the duration.\n   * @param {bigint} [nanoseconds=0] - The nanosecond part of the duration.\n   */\n  constructor(seconds = 0n, nanoseconds = 0n) {\n    if (typeof seconds !== 'bigint') {\n      throw new TypeValidationError('seconds', seconds, 'bigint', {\n        entityType: 'duration',\n      });\n    }\n\n    if (typeof nanoseconds !== 'bigint') {\n      throw new TypeValidationError('nanoseconds', nanoseconds, 'bigint', {\n        entityType: 'duration',\n      });\n    }\n\n    const total = seconds * S_TO_NS + nanoseconds;\n    if (total >= 2n ** 63n) {\n      throw new RangeValidationError(\n        'total nanoseconds',\n        total,\n        '< 2^63 (max C duration)',\n        {\n          entityType: 'duration',\n          details: {\n            seconds: seconds,\n            nanoseconds: nanoseconds,\n            total: total,\n          },\n        }\n      );\n    }\n\n    this._nanoseconds = total;\n    this._handle = rclnodejs.createDuration(this._nanoseconds);\n  }\n\n  /**\n   * Get the nanosecond part of the Duration.\n   * @name Duration#get:nanoseconds\n   * @function\n   * @return {bigint} - value in nanosecond.\n   */\n\n  get nanoseconds() {\n    return rclnodejs.getDurationNanoseconds(this._handle);\n  }\n\n  /**\n   * Determine whether two Duration objects are equal.\n   * @param {Duration} other - The Duration object to be compared.\n   * @return {boolean} Return true if they are equal.\n   */\n  eq(other) {\n    if (other instanceof Duration) {\n      return this._nanoseconds === other.nanoseconds;\n    }\n    throw new TypeValidationError('other', other, 'Duration', {\n      entityType: 'duration',\n    });\n  }\n\n  /**\n   * Determine whether two Duration objects are not equal.\n   * @param {Duration} other - The Duration object to be compared.\n   * @return {boolean} Return true if they are not equal.\n   */\n  ne(other) {\n    if (other instanceof Duration) {\n      return this._nanoseconds !== other.nanoseconds;\n    }\n    throw new TypeValidationError('other', other, 'Duration', {\n      entityType: 'duration',\n    });\n  }\n\n  /**\n   * Determine whether the Duration object is less than another one.\n   * @param {Duration} other - The Duration object to be compared.\n   * @return {boolean} Return true if it's less than other.\n   */\n  lt(other) {\n    if (other instanceof Duration) {\n      return this._nanoseconds < other.nanoseconds;\n    }\n    throw new TypeValidationError('other', other, 'Duration', {\n      entityType: 'duration',\n    });\n  }\n\n  /**\n   * Determine whether the Duration object is less than or equal with another one.\n   * @param {Duration} other - The Duration object to be compared.\n   * @return {boolean} Return true if it's less than or equal with other.\n   */\n  lte(other) {\n    if (other instanceof Duration) {\n      return this._nanoseconds <= other.nanoseconds;\n    }\n    throw new TypeValidationError('other', other, 'Duration', {\n      entityType: 'duration',\n    });\n  }\n\n  /**\n   * Determine whether the Duration object is greater than another one.\n   * @param {Duration} other - The Duration object to be compared.\n   * @return {boolean} Return true if it's greater than other.\n   */\n  gt(other) {\n    if (other instanceof Duration) {\n      return this._nanoseconds > other.nanoseconds;\n    }\n    throw new TypeValidationError('other', other, 'Duration', {\n      entityType: 'duration',\n    });\n  }\n\n  /**\n   * Determine whether the Duration object is greater than or equal with another one.\n   * @param {Duration} other - The Duration object to be compared.\n   * @return {boolean} Return true if it's greater than or equal with other.\n   */\n  gte(other) {\n    if (other instanceof Duration) {\n      return this._nanoseconds >= other.nanoseconds;\n    }\n    throw new TypeValidationError('other', other, 'Duration', {\n      entityType: 'duration',\n    });\n  }\n}\n\nexport default Duration;\n","// Copyright (c) 2018 Intel Corporation. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/**\n * Enum for ClockType\n * @readonly\n * @enum {number}\n */\nconst ClockType = {\n  /** @member {number} */\n  ROS_TIME: 1,\n  /** @member {number} */\n  SYSTEM_TIME: 2,\n  /** @member {number} */\n  STEADY_TIME: 3,\n};\n\nexport default ClockType;\n","// Copyright (c) 2018 Intel Corporation. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport rclnodejs from './native_loader.js';\nimport Duration from './duration.js';\nimport ClockType from './clock_type.js';\nimport { TypeValidationError, RangeValidationError } from './errors.js';\nconst S_TO_NS = 10n ** 9n;\n\n/**\n * @class - Class representing a Time in ROS\n */\n\nclass Time {\n  /**\n   * Create a Time.\n   * @param {bigint} [seconds=0] - The second part of the time.\n   * @param {bigint} [nanoseconds=0] - The nanosecond part of the time.\n   * @param {ClockType} [clockType=Clock.ClockType.SYSTEM_TIME] - The clock type.\n   */\n  constructor(\n    seconds = 0n,\n    nanoseconds = 0n,\n    clockType = ClockType.SYSTEM_TIME\n  ) {\n    if (typeof seconds !== 'bigint') {\n      throw new TypeValidationError('seconds', seconds, 'bigint', {\n        entityType: 'time',\n      });\n    }\n\n    if (typeof nanoseconds !== 'bigint') {\n      throw new TypeValidationError('nanoseconds', nanoseconds, 'bigint', {\n        entityType: 'time',\n      });\n    }\n\n    if (typeof clockType !== 'number') {\n      throw new TypeValidationError('clockType', clockType, 'number', {\n        entityType: 'time',\n      });\n    }\n\n    if (seconds < 0n) {\n      throw new RangeValidationError('seconds', seconds, '>= 0', {\n        entityType: 'time',\n      });\n    }\n\n    if (nanoseconds < 0n) {\n      throw new RangeValidationError('nanoseconds', nanoseconds, '>= 0', {\n        entityType: 'time',\n      });\n    }\n\n    const total = seconds * S_TO_NS + nanoseconds;\n    if (total >= 2n ** 63n) {\n      throw new RangeValidationError(\n        'total nanoseconds',\n        total,\n        '< 2^63 (max C time point)',\n        {\n          entityType: 'time',\n          details: {\n            seconds: seconds,\n            nanoseconds: nanoseconds,\n            total: total,\n          },\n        }\n      );\n    }\n    this._nanoseconds = total;\n    this._handle = rclnodejs.createTimePoint(this._nanoseconds, clockType);\n    this._clockType = clockType;\n  }\n\n  /**\n   * Get the the clock type of the Time object.\n   * @name Time#get:clockType\n   * @function\n   * @return {ClockType} - The clock type.\n   */\n\n  get clockType() {\n    return this._clockType;\n  }\n\n  /**\n   * Get the nanosecond part of the time.\n   * @name Time#get:nanoseconds\n   * @function\n   * @return {bigint} - value in nanosecond.\n   */\n\n  get nanoseconds() {\n    return rclnodejs.getNanoseconds(this._handle);\n  }\n\n  /**\n   * Get the time as separate seconds and nanoseconds component.\n   * @name Time#get:secondsAndNanoseconds\n   * @function\n   * @return {object} - object with properties seconds and nanoseconds.\n   */\n\n  get secondsAndNanoseconds() {\n    const nanoseconds = this._nanoseconds;\n    return {\n      seconds: nanoseconds / S_TO_NS,\n      nanoseconds: nanoseconds % S_TO_NS,\n    };\n  }\n\n  /**\n   * Add a duration to this time object.\n   * @param {Duration} other - The Duration object to be added.\n   * @return {Time} Return the result of a new Time object.\n   */\n  add(other) {\n    if (other instanceof Duration) {\n      return new Time(\n        0n,\n        this._nanoseconds + other.nanoseconds,\n        this._clockType\n      );\n    }\n    throw new TypeValidationError('other', other, 'Duration', {\n      entityType: 'time',\n    });\n  }\n\n  /**\n   * Subtract a duration/time to this time object.\n   * @param {Duration|Time} other - The time to be subtracted.\n   * @return {Duration|Time} Return the result.\n   */\n  sub(other) {\n    if (other instanceof Time) {\n      if (other._clockType !== this._clockType) {\n        throw new TypeValidationError(\n          'other',\n          other,\n          `Time with clock type ${this._clockType}`,\n          {\n            entityType: 'time',\n            details: {\n              expectedClockType: this._clockType,\n              providedClockType: other._clockType,\n            },\n          }\n        );\n      }\n      return new Duration(0n, this._nanoseconds - other._nanoseconds);\n    } else if (other instanceof Duration) {\n      return new Time(\n        0n,\n        this._nanoseconds - other._nanoseconds,\n        this._clockType\n      );\n    }\n    throw new TypeValidationError('other', other, 'Time or Duration', {\n      entityType: 'time',\n    });\n  }\n\n  /**\n   * Determine whether two Time objects are equal.\n   * @param {Time} other - The time object to be compared.\n   * @return {boolean} Return true if they are equal.\n   */\n  eq(other) {\n    if (other instanceof Time) {\n      if (other._clockType !== this._clockType) {\n        throw new TypeValidationError(\n          'other',\n          other,\n          `Time with clock type ${this._clockType}`,\n          {\n            entityType: 'time',\n            details: {\n              expectedClockType: this._clockType,\n              providedClockType: other._clockType,\n            },\n          }\n        );\n      }\n      return this._nanoseconds === other.nanoseconds;\n    }\n    throw new TypeValidationError('other', other, 'Time', {\n      entityType: 'time',\n    });\n  }\n\n  /**\n   * Determine whether two Time objects are not equal.\n   * @param {Time} other - The time object to be compared.\n   * @return {boolean} Return true if they are not equal.\n   */\n  ne(other) {\n    if (other instanceof Time) {\n      if (other._clockType !== this._clockType) {\n        throw new TypeValidationError(\n          'other',\n          other,\n          `Time with clock type ${this._clockType}`,\n          {\n            entityType: 'time',\n            details: {\n              expectedClockType: this._clockType,\n              providedClockType: other._clockType,\n            },\n          }\n        );\n      }\n      return this._nanoseconds !== other.nanoseconds;\n    }\n    throw new TypeValidationError('other', other, 'Time', {\n      entityType: 'time',\n    });\n  }\n\n  /**\n   * Determine whether the time is less than another one.\n   * @param {Time} other - The time object to be compared.\n   * @return {boolean} Return true if it's less than other.\n   */\n  lt(other) {\n    if (other instanceof Time) {\n      if (other._clockType !== this._clockType) {\n        throw new TypeValidationError(\n          'other',\n          other,\n          `Time with clock type ${this._clockType}`,\n          {\n            entityType: 'time',\n            details: {\n              expectedClockType: this._clockType,\n              providedClockType: other._clockType,\n            },\n          }\n        );\n      }\n      return this._nanoseconds < other.nanoseconds;\n    }\n    throw new TypeValidationError('other', other, 'Time', {\n      entityType: 'time',\n    });\n  }\n\n  /**\n   * Determine whether the time is less than or equal with another one.\n   * @param {Time} other - The time object to be compared.\n   * @return {boolean} Return true if it's less than or equal with other.\n   */\n  lte(other) {\n    if (other instanceof Time) {\n      if (other._clockType !== this._clockType) {\n        throw new TypeValidationError(\n          'other',\n          other,\n          `Time with clock type ${this._clockType}`,\n          {\n            entityType: 'time',\n            details: {\n              expectedClockType: this._clockType,\n              providedClockType: other._clockType,\n            },\n          }\n        );\n      }\n      return this._nanoseconds <= other.nanoseconds;\n    }\n    throw new TypeValidationError('other', other, 'Time', {\n      entityType: 'time',\n    });\n  }\n\n  /**\n   * Determine whether the time is greater than another one.\n   * @param {Time} other - The time object to be compared.\n   * @return {boolean} Return true if it's greater than other.\n   */\n  gt(other) {\n    if (other instanceof Time) {\n      if (other._clockType !== this._clockType) {\n        throw new TypeValidationError(\n          'other',\n          other,\n          `Time with clock type ${this._clockType}`,\n          {\n            entityType: 'time',\n            details: {\n              expectedClockType: this._clockType,\n              providedClockType: other._clockType,\n            },\n          }\n        );\n      }\n      return this._nanoseconds > other.nanoseconds;\n    }\n    throw new TypeValidationError('other', other, 'Time', {\n      entityType: 'time',\n    });\n  }\n\n  /**\n   * Determine whether the time is greater than or equal with another one.\n   * @param {Time} other - The time object to be compared.\n   * @return {boolean} Return true if it's greater than or equal with other.\n   */\n  gte(other) {\n    if (other instanceof Time) {\n      if (other._clockType !== this._clockType) {\n        throw new TypeValidationError(\n          'other',\n          other,\n          `Time with clock type ${this._clockType}`,\n          {\n            entityType: 'time',\n            details: {\n              expectedClockType: this._clockType,\n              providedClockType: other._clockType,\n            },\n          }\n        );\n      }\n      return this._nanoseconds >= other.nanoseconds;\n    }\n    throw new TypeValidationError('other', other, 'Time', {\n      entityType: 'time',\n    });\n  }\n\n  /**\n   * Create a builtin_interfaces.msg.Time message\n   *\n   * @return {builtin_interfaces.msg.Time} - The new Time message.\n   */\n  toMsg() {\n    const secondsAndNanoseconds = this.secondsAndNanoseconds;\n    return {\n      sec: Number(secondsAndNanoseconds.seconds),\n      nanosec: Number(secondsAndNanoseconds.nanoseconds),\n    };\n  }\n\n  /**\n   * Create a Time object from a message of builtin_interfaces/msg/Time\n   * @param {object} msg - The builtin_interfaces.msg.Time message to be\n   *  created from.\n   * @param {ClockType} [clockType=Clock.ClockType.ROS_TIME] - The type of the time object.\n   * @return {Time} Return the created Time object.\n   */\n  static fromMsg(msg, clockType = ClockType.ROS_TIME) {\n    return new Time(BigInt(msg.sec), BigInt(msg.nanosec), clockType);\n  }\n}\n\nexport default Time;\n","// Copyright (c) 2025 The Robot Web Tools Contributors. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/**\n * Enum for ClockChange\n * Represents the type of clock change that occurred during a time jump.\n * @readonly\n * @enum {number}\n */\nconst ClockChange = {\n  /**\n   * The source before and after the jump is ROS_TIME.\n   * @member {number}\n   */\n  ROS_TIME_NO_CHANGE: 1,\n\n  /**\n   * The source switched to ROS_TIME from SYSTEM_TIME.\n   * @member {number}\n   */\n  ROS_TIME_ACTIVATED: 2,\n\n  /**\n   * The source switched to SYSTEM_TIME from ROS_TIME.\n   * @member {number}\n   */\n  ROS_TIME_DEACTIVATED: 3,\n\n  /**\n   * The source before and after the jump is SYSTEM_TIME.\n   * @member {number}\n   */\n  SYSTEM_TIME_NO_CHANGE: 4,\n};\n\nexport default ClockChange;\n","// Copyright (c) 2019 Intel Corporation. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport rclnodejs from './native_loader.js';\nimport { OperationError } from './errors.js';\n\nlet defaultContext = null;\n\n/**\n * Encapsulates the lifecycle of an rcl environment from init to shutdown.\n * A Context serves as a container for a ROS2 RCL environment that holds\n * nodes and the resources created by the nodes, e.g.,\n * publishers, subscriptions, actions, services...v\n *\n * A context has 3 states:\n * ```\n * new Context() --> uninitialized -->\n * *                                  |\n *         ---------------------------\n *        |\n *        v\n * rcl.init(context) --> initialized ->\n *                                     |\n *         ----------------------------\n *        |\n *        v\n * rcl.shutdown(context)\n *        or\n * context.shutdown() ---> shutdown\n * ```\n * Must call rclnodejs.init(context) to initialize the context\n * to the usable 'initialized' (valid) state be using.\n */\nclass Context {\n  /**\n   * Access the list of usable (initialized/valid) contexts.\n   * @returns {Context[]} Array of valid contexts\n   */\n  static get instances() {\n    let contexts = [];\n    for (const ctx of Context._instances) {\n      if (ctx.isValid()) {\n        contexts.push(ctx);\n      }\n    }\n    return contexts;\n  }\n\n  /**\n   * Create a new instance in uninitialized state.\n   * Call rcl.init(context) to initialize this context state for\n   * use in creating nodes, etc.\n   * @constructor\n   * @param {bigint} - Optional, The domain ID of this context.\n   */\n  constructor(domainId) {\n    this._handle = rclnodejs.createContext();\n    this._isShutdown = false;\n    this._nodes = [];\n    this._domainId = domainId;\n    Context._instances.push(this);\n  }\n\n  /**\n   * Access the nodes managed by this context.\n   * @returns {Node[]} The nodes.\n   */\n  get nodes() {\n    return Array.from(this._nodes);\n  }\n\n  /**\n   * Get the handle referencing the internal context object. Do not modify it yourself: only pass it to *rclnodejs* functions!\n   * @returns {undefined} a reference to the internal context object\n   */\n  get handle() {\n    return this._handle;\n  }\n\n  /**\n   * Test if this context has not been initialized by rcl.init(context).\n   * @returns {boolean} True if context has been initialized; otherwise false\n   */\n  isUninitialized() {\n    return !this.isShutdown() && !this.isValid();\n  }\n\n  /**\n   * Test if this context has been initialized, i.e., rcl.init(context),\n   * and not shutdown.\n   * @returns {boolean} True if context has been initialized; otherwise false\n   */\n  isInitialized() {\n    return !this.isShutdown() && this.isValid();\n  }\n\n  /**\n   * Test if this context has been shutdown, i.e., context.shutdown().\n   * @returns {boolean} True if context has been shutdown; otherwise false\n   */\n  isShutdown() {\n    return this._isShutdown;\n  }\n\n  /**\n   * Test if this context is the default one.\n   * @returns {boolean} whether this is the default context\n   */\n  isDefaultContext() {\n    return this === defaultContext;\n  }\n\n  /**\n   * Check that the context is in a usable state, i.e., it\n   * has been initialized and not yet shutdown.\n   * @returns {boolean} whether this context is (still) valid\n   */\n  isValid() {\n    return rclnodejs.isContextValid(this.handle);\n  }\n\n  /**\n   * Check that the context is valid.\n   * @returns {boolean} whether this context is (still) valid\n   *\n   * @deprecated since 0.18.0, Use Context.isValid()\n   */\n  get isOk() {\n    return this.isValid();\n  }\n\n  /**\n   * Shut down the context including destroying all nodes.\n   * @returns {undefined}\n   * @throws {Error} If there is a problem shutting down the context.\n   */\n  shutdown() {\n    if (this.isShutdown()) return;\n\n    // shutdown and remove all nodes\n    for (const node of this.nodes) {\n      node.destroy();\n    }\n\n    if (this.isInitialized()) {\n      rclnodejs.shutdown(this.handle);\n    }\n\n    this._isShutdown = true;\n\n    // remove context from _instances[]\n    const index = Context._instances.indexOf(this);\n    if (index > -1) {\n      Context._instances.splice(index, 1);\n    }\n\n    if (this.isDefaultContext()) {\n      defaultContext = null;\n    }\n  }\n\n  /**\n   * Try to shut down the context.\n   * @returns {undefined}\n   * @throws {Error} If there is a problem shutting down the context.\n   */\n  tryShutdown() {\n    if (this.isInitialized()) {\n      this.shutdown();\n    }\n  }\n\n  onNodeCreated(node) {\n    if (!node) {\n      throw new OperationError('Node must be defined to add to Context', {\n        code: 'NODE_UNDEFINED',\n        entityType: 'context',\n      });\n    }\n\n    if (this.isShutdown()) {\n      throw new OperationError(\n        'Can not add a Node to a Context that is shutdown',\n        {\n          code: 'CONTEXT_SHUTDOWN',\n          entityType: 'context',\n        }\n      );\n    }\n\n    if (this._nodes.includes(node)) {\n      // do nothing\n      return;\n    }\n\n    this._nodes.push(node);\n  }\n\n  onNodeDestroyed(node) {\n    if (!this._nodes) {\n      return;\n    }\n\n    // remove node from _nodes[]\n    const index = this._nodes.indexOf(node);\n    if (index > -1) {\n      this._nodes.splice(index, 1);\n    }\n  }\n\n  /**\n   * Get the global default Context object.\n   * @returns {Context} The default Context\n   */\n  static defaultContext() {\n    if (defaultContext === null) {\n      defaultContext = new Context();\n    }\n    return defaultContext;\n  }\n\n  /**\n   * Get the domain ID of this context.\n   * @returns {bigint} domain ID of this context\n   */\n  get domainId() {\n    return rclnodejs.getDomainId(this.handle);\n  }\n}\n\nContext._instances = [];\n\nexport default Context;\n","// Copyright (c) 2025, The Robot Web Tools Contributors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport rclnodejs from './native_loader.js';\n\n/**\n * @class - Class representing a ClockEvent in ROS\n */\nclass ClockEvent {\n  constructor() {\n    this._handle = rclnodejs.createClockEvent();\n  }\n\n  /**\n   * Wait until a time specified by a steady clock.\n   * @param {Clock} clock - The clock to use for time synchronization.\n   * @param {bigint} until - The time to wait until.\n   * @return {Promise<void>} - A promise that resolves when the time is reached.\n   */\n  async waitUntilSteady(clock, until) {\n    return rclnodejs.clockEventWaitUntilSteady(\n      this._handle,\n      clock.handle,\n      until\n    );\n  }\n\n  /**\n   * Wait until a time specified by a system clock.\n   * @param {Clock} clock - The clock to use for time synchronization.\n   * @param {bigint} until - The time to wait until.\n   * @return {Promise<void>} - A promise that resolves when the time is reached.\n   */\n  async waitUntilSystem(clock, until) {\n    return rclnodejs.clockEventWaitUntilSystem(\n      this._handle,\n      clock.handle,\n      until\n    );\n  }\n\n  /**\n   * Wait until a time specified by a ROS clock.\n   * @param {Clock} clock - The clock to use for time synchronization.\n   * @param {bigint} until - The time to wait until.\n   * @return {Promise<void>} - A promise that resolves when the time is reached.\n   */\n  async waitUntilRos(clock, until) {\n    return rclnodejs.clockEventWaitUntilRos(this._handle, clock.handle, until);\n  }\n\n  /**\n   * Indicate if the ClockEvent is set.\n   * @return {boolean} - True if the ClockEvent is set.\n   */\n  isSet() {\n    return rclnodejs.clockEventIsSet(this._handle);\n  }\n\n  /**\n   * Set the event.\n   */\n  set() {\n    rclnodejs.clockEventSet(this._handle);\n  }\n\n  /**\n   * Clear the event.\n   */\n  clear() {\n    rclnodejs.clockEventClear(this._handle);\n  }\n}\n\nexport default ClockEvent;\n","// Copyright (c) 2018 Intel Corporation. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport rclnodejs from './native_loader.js';\nimport Time from './time.js';\nimport ClockType from './clock_type.js';\nimport ClockChange from './clock_change.js';\nimport Context from './context.js';\nimport ClockEvent from './clock_event.js';\nimport { TypeValidationError } from './errors.js';\n\n/**\n * @class - Class representing a Clock in ROS\n */\n\nclass Clock {\n  /**\n   * Create a Clock.\n   * @param {ClockType} [clockType=Clock.ClockType.SYSTEM_TIME] - The type of the clock to be created.\n   */\n  constructor(clockType = ClockType.SYSTEM_TIME) {\n    this._clockType = clockType;\n    this._handle = rclnodejs.createClock(this._clockType);\n  }\n\n  /**\n   * @ignore\n   */\n  get handle() {\n    return this._handle;\n  }\n\n  /**\n   * Get ClockType of this Clock object.\n   * @return {ClockType} Return the type of the clock.\n   */\n  get clockType() {\n    return this._clockType;\n  }\n\n  /**\n   * Add a clock callback.\n   * @param {object} callbackObject - The object containing callback methods.\n   * @param {Function} [callbackObject._pre_callback] - Optional callback invoked before a time jump. Takes no arguments.\n   * @param {Function} [callbackObject._post_callback] - Optional callback invoked after a time jump.\n   *   Receives a jumpInfo object with properties:\n   *   - clock_change {number}: Type of clock change that occurred.\n   *   - delta {bigint}: Time delta in nanoseconds.\n   * @param {boolean} onClockChange - Whether to call the callback on clock change.\n   * @param {bigint} minForward - Minimum forward jump in nanoseconds to trigger the callback.\n   * @param {bigint} minBackward - Minimum backward jump in nanoseconds to trigger the callback.\n   */\n  addClockCallback(callbackObject, onClockChange, minForward, minBackward) {\n    if (typeof callbackObject !== 'object' || callbackObject === null) {\n      throw new TypeValidationError(\n        'callbackObject',\n        callbackObject,\n        'object',\n        {\n          entityType: 'clock',\n        }\n      );\n    }\n    if (typeof onClockChange !== 'boolean') {\n      throw new TypeValidationError('onClockChange', onClockChange, 'boolean', {\n        entityType: 'clock',\n      });\n    }\n    if (typeof minForward !== 'bigint') {\n      throw new TypeValidationError('minForward', minForward, 'bigint', {\n        entityType: 'clock',\n      });\n    }\n    if (typeof minBackward !== 'bigint') {\n      throw new TypeValidationError('minBackward', minBackward, 'bigint', {\n        entityType: 'clock',\n      });\n    }\n    rclnodejs.clockAddJumpCallback(\n      this._handle,\n      callbackObject,\n      onClockChange,\n      minForward,\n      minBackward\n    );\n  }\n\n  /**\n   * Remove a clock callback.\n   * @param {object} callbackObject - The callback object that was previously registered with addClockCallback().\n   */\n  removeClockCallback(callbackObject) {\n    if (typeof callbackObject !== 'object' || callbackObject === null) {\n      throw new TypeValidationError(\n        'callbackObject',\n        callbackObject,\n        'object',\n        {\n          entityType: 'clock',\n        }\n      );\n    }\n    rclnodejs.clockRemoveJumpCallback(this._handle, callbackObject);\n  }\n\n  /**\n   * Return the current time.\n   * @return {Time} Return the current time.\n   */\n  now() {\n    const nowInNanosec = rclnodejs.clockGetNow(this._handle);\n    return new Time(0n, nowInNanosec, this._clockType);\n  }\n\n  /**\n   * Sleep until a specific time is reached on this Clock.\n   *\n   * When using a ROSClock, this may sleep forever if the TimeSource is misconfigured\n   * and the context is never shut down. ROS time being activated or deactivated causes\n   * this function to cease sleeping and return false.\n   *\n   * @param {Time} until - Time at which this function should stop sleeping.\n   * @param {Context} [context=null] - Context whose validity will be checked while sleeping.\n   *   If context is null, then the default context is used. If the context is found to be\n   *   shut down before or by the time the wait completes, the returned promise resolves to false.\n   * @return {Promise<boolean>} Promise that resolves to true if 'until' was reached without\n   *   detecting a time jump or a shut down context, or false otherwise (for example, if a time\n   *   jump occurred or the context is no longer valid when the wait completes).\n   * @throws {TypeError} if until is specified for a different type of clock than this one.\n   * @throws {Error} if context has not been initialized or is shutdown.\n   */\n  async sleepUntil(until, context = null) {\n    if (!(until instanceof Time)) {\n      throw new TypeValidationError('until', until, 'Time', {\n        entityType: 'clock',\n      });\n    }\n\n    if (!context) {\n      context = Context.defaultContext();\n    }\n\n    if (!context.isValid()) {\n      throw new Error('Context is not initialized or has been shut down');\n    }\n\n    if (until.clockType !== this._clockType) {\n      throw new TypeError(\n        \"until's clock type does not match this clock's type\"\n      );\n    }\n\n    const event = new ClockEvent();\n    let timeSourceChanged = false;\n\n    // Callback to wake when time jumps and is past target time\n    const callbackObject = {\n      _pre_callback: () => {\n        // Optional pre-callback - no action needed\n      },\n      _post_callback: (jumpInfo) => {\n        // ROS time being activated or deactivated changes the epoch,\n        // so sleep time loses its meaning\n        timeSourceChanged =\n          timeSourceChanged ||\n          jumpInfo.clock_change === ClockChange.ROS_TIME_ACTIVATED ||\n          jumpInfo.clock_change === ClockChange.ROS_TIME_DEACTIVATED;\n\n        if (timeSourceChanged || this.now().nanoseconds >= until.nanoseconds) {\n          event.set();\n        }\n      },\n    };\n\n    // Setup jump callback with minimal forward threshold\n    this.addClockCallback(\n      callbackObject,\n      true, // onClockChange\n      1n, // minForward (1 nanosecond - any forward jump triggers)\n      0n // minBackward (0 disables backward threshold)\n    );\n\n    try {\n      // Wait based on clock type\n      if (this._clockType === ClockType.SYSTEM_TIME) {\n        await event.waitUntilSystem(this, until.nanoseconds);\n      } else if (this._clockType === ClockType.STEADY_TIME) {\n        await event.waitUntilSteady(this, until.nanoseconds);\n      } else if (this._clockType === ClockType.ROS_TIME) {\n        await event.waitUntilRos(this, until.nanoseconds);\n      }\n    } finally {\n      // Always clean up callback\n      this.removeClockCallback(callbackObject);\n    }\n\n    if (!context.isValid() || timeSourceChanged) {\n      return false;\n    }\n\n    return this.now().nanoseconds >= until.nanoseconds;\n  }\n\n  /**\n   * Sleep for a specified duration.\n   *\n   * Equivalent to: clock.sleepUntil(clock.now() + duration, context)\n   *\n   * When using a ROSClock, this may sleep forever if the TimeSource is misconfigured\n   * and the context is never shut down. ROS time being activated or deactivated causes\n   * this function to cease sleeping and return false.\n   *\n   * @param {Duration} duration - Duration of time to sleep for.\n   * @param {Context} [context=null] - Context which when shut down will cause this sleep to wake early.\n   *   If context is null, then the default context is used.\n   * @return {Promise<boolean>} Promise that resolves to true if the full duration was slept,\n   *   or false if it woke for another reason.\n   * @throws {Error} if context has not been initialized or is shutdown.\n   */\n  async sleepFor(duration, context = null) {\n    const until = this.now().add(duration);\n    return this.sleepUntil(until, context);\n  }\n}\n\n/**\n * @class - Class representing a ROSClock in ROS\n */\n\nclass ROSClock extends Clock {\n  /**\n   * Create a ROSClock.\n   */\n  constructor() {\n    super(ClockType.ROS_TIME);\n  }\n\n  /**\n   * Return status that whether the ROS time is active.\n   * @name ROSClock#get:isRosTimeActive\n   * @function\n   * @return {boolean} Return true if the time is active, otherwise return false.\n   */\n\n  get isRosTimeActive() {\n    return rclnodejs.getRosTimeOverrideIsEnabled(this._handle);\n  }\n\n  /**\n   * Set the status of ROS time.\n   * @param {boolean} enabled - Set the ROS time to be active.\n   * @name ROSClock#set:isRosTimeActive\n   * @function\n   * @return {undefined}\n   */\n\n  set isRosTimeActive(enabled) {\n    rclnodejs.setRosTimeOverrideIsEnabled(this._handle, enabled);\n  }\n\n  /**\n   * Set the status of ROS time.\n   * @param {Time} time - The time to be set override.\n   * @name ROSClock#set:rosTimeOverride\n   * @function\n   * @return {undefined}\n   */\n\n  set rosTimeOverride(time) {\n    if (!(time instanceof Time)) {\n      throw new TypeValidationError('time', time, 'Time', {\n        entityType: 'clock',\n      });\n    }\n    rclnodejs.setRosTimeOverride(this._handle, time._handle);\n  }\n}\n\nClock.ClockType = ClockType;\n\nexport { Clock, ROSClock };\n","// Copyright (c) 2018 Intel Corporation. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport path from 'path';\nimport rclnodejs from './native_loader.js';\nimport { TypeValidationError } from './errors.js';\nimport Context from './context.js';\n\n/**\n * Enum for LoggingSeverity\n * @readonly\n * @enum {number}\n */\nlet LoggingSeverity = {\n  /** @member {number} */\n  UNSET: 0,\n  /** @member {number} */\n  DEBUG: 10,\n  /** @member {number} */\n  INFO: 20,\n  /** @member {number} */\n  WARN: 30,\n  /** @member {number} */\n  ERROR: 40,\n  /** @member {number} */\n  FATAL: 50,\n};\n\nclass Caller {\n  constructor() {\n    this._info = {\n      functionName: 'unknown',\n      fileName: 'unknown',\n      lineNumber: 'unknown',\n    };\n\n    const stackLines = new Error().stack.split('\\n');\n\n    // Adjust the index (usually 3 or 4) to correctly point to the caller frame.\n    const callerFrame = stackLines[4] || stackLines[3];\n    // Match both named and anonymous function stack frames.\n    const frameRegex = /^\\s*at\\s+(?:(.+)\\s+\\()?(.+):(\\d+):(\\d+)\\)?$/;\n    const match = callerFrame.match(frameRegex);\n    if (match && match.length === 5) {\n      this._info.functionName = match[1] || '(anonymous)';\n      this._info.fileName = path.basename(match[2]);\n      this._info.lineNumber = match[3];\n    } else {\n      // Handle anonymous functions or different stack formats.\n      const altMatch = callerFrame.match(/at\\s+(.*):(\\d+):(\\d+)/i);\n      if (altMatch && altMatch.length >= 4) {\n        this._info.functionName = '(anonymous)';\n        this._info.fileName = path.basename(altMatch[1]);\n        this._info.lineNumber = altMatch[2];\n      }\n    }\n  }\n\n  get functionName() {\n    return this._info.functionName;\n  }\n\n  get lineNumber() {\n    return this._info.lineNumber;\n  }\n\n  get fileName() {\n    return this._info.fileName;\n  }\n}\n\n/**\n * @class - Class representing logger in ROS\n * @hideconstructor\n */\n\nclass Logging {\n  constructor(name) {\n    this._name = name;\n    this._parentName = null;\n    this._subName = null;\n  }\n\n  /**\n   * Set the logging severity level.\n   * @param {LoggingSeverity} level - The logging severity level.\n   * @function\n   * @return {undefined}\n   */\n  setLoggerLevel(level) {\n    if (typeof level !== 'number') {\n      throw new TypeValidationError('level', level, 'number', {\n        entityType: 'logger',\n        entityName: this._name,\n      });\n    }\n    rclnodejs.setLoggerLevel(this._name, level);\n  }\n\n  /**\n   * Get the logging severity level.\n   * @function\n   * @return {LoggingSeverity} - The severity level of the logger.\n   */\n  get loggerEffectiveLevel() {\n    return rclnodejs.getLoggerEffectiveLevel(this._name);\n  }\n\n  /**\n   * Log a message with the DEBUG severity.\n   * @param {string} message - message to be logged.\n   * @function\n   * @return {bool} Return true if the message has been logged.\n   */\n  debug(message) {\n    return this._log(message, LoggingSeverity.DEBUG);\n  }\n\n  /**\n   * Log a message with the INFO severity.\n   * @param {string} message - message to be logged.\n   * @function\n   * @return {bool} Return true if the message has been logged.\n   */\n  info(message) {\n    return this._log(message, LoggingSeverity.INFO);\n  }\n\n  /**\n   * Log a message with the WARN severity.\n   * @param {string} message - message to be logged.\n   * @function\n   * @return {bool} Return true if the message has been logged.\n   */\n  warn(message) {\n    return this._log(message, LoggingSeverity.WARN);\n  }\n\n  /**\n   * Log a message with the ERROR severity.\n   * @param {string} message - message to be logged.\n   * @function\n   * @return {bool} Return true if the message has been logged.\n   */\n  error(message) {\n    return this._log(message, LoggingSeverity.ERROR);\n  }\n\n  /**\n   * Log a message with the FATAL severity.\n   * @param {string} message - message to be logged.\n   * @function\n   * @return {bool} Return true if the message has been logged.\n   */\n  fatal(message) {\n    return this._log(message, LoggingSeverity.FATAL);\n  }\n\n  _log(message, severity) {\n    if (typeof message !== 'string') {\n      throw new TypeValidationError('message', message, 'string', {\n        entityType: 'logger',\n        entityName: this._name,\n      });\n    }\n\n    let caller = new Caller();\n    return rclnodejs.log(\n      this._name,\n      severity,\n      message,\n      caller.functionName,\n      parseInt(caller.lineNumber, 10),\n      caller.fileName\n    );\n  }\n\n  /**\n   * Get LoggingSeverity enum.\n   * @function\n   * @return {LoggingSeverity} Return LoggingSeverity enum.\n   */\n  get LoggingSeverity() {\n    return LoggingSeverity;\n  }\n\n  /**\n   * Get name of the logger.\n   * @function\n   * @return {string} logger's name.\n   */\n  get name() {\n    return this._name;\n  }\n\n  /**\n   * Create a child logger.\n   * @param {string} name - name of the child logger.\n   * @function\n   * @return {Logging} Return the child logger object.\n   */\n  getChild(name) {\n    if (typeof name !== 'string' || !name) {\n      throw new Error('Child logger name must be a non-empty string.');\n    }\n\n    let fullname = name;\n    if (this._name) {\n      fullname = this._name + '.' + name;\n    }\n\n    const logger = new Logging(fullname);\n    if (this._name) {\n      if (\n        rclnodejs.addRosoutSublogger &&\n        rclnodejs.addRosoutSublogger(this._name, name)\n      ) {\n        logger._parentName = this._name;\n        logger._subName = name;\n      }\n    }\n    return logger;\n  }\n\n  /**\n   * Destroy the logger and remove it from the parent logger if it is a child logger.\n   * @function\n   * @return {undefined}\n   */\n  destroy() {\n    if (this._parentName && this._subName) {\n      if (rclnodejs.removeRosoutSublogger) {\n        rclnodejs.removeRosoutSublogger(this._parentName, this._subName);\n      }\n      this._parentName = null;\n      this._subName = null;\n    }\n  }\n\n  /**\n   * Create a logger by name.\n   * @param {string} name - name of the logger.\n   * @function\n   * @return {Logging} Return the logger object.\n   */\n  static getLogger(name) {\n    if (typeof name !== 'string') {\n      throw new TypeValidationError('name', name, 'string', {\n        entityType: 'logger',\n      });\n    }\n    return new Logging(name);\n  }\n\n  /**\n   * Configure the logging system with the given context.\n   * @param {Context} context - The context to configure logging for.\n   * @function\n   * @return {undefined}\n   */\n  static configure(context) {\n    if (!(context instanceof Context)) {\n      throw new TypeValidationError('context', context, 'Context');\n    }\n    rclnodejs.loggingConfigure(context.handle);\n  }\n\n  /**\n   * Shutdown the logging system.\n   * @function\n   * @return {undefined}\n   */\n  static shutdown() {\n    rclnodejs.loggingFini();\n  }\n\n  /**\n   * Get the logging directory.\n   * @function\n   * @return {string} - The logging directory.\n   */\n  static getLoggingDirectory() {\n    return rclnodejs.getLoggingDirectory();\n  }\n}\n\nexport default Logging;\n","// Copyright (c) 2020 Wayne Parrott. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Note: parameter api and function based on\n// https://design.ros2.org/articles/ros_parameters.html\n// https://github.com/ros2/rcl and\n// https://github.com/ros2/rclpy\n\nimport { isClose } from './utils.js';\nimport {\n  TypeValidationError,\n  RangeValidationError,\n  ParameterError,\n  ParameterTypeError,\n} from './errors.js';\n\n/**\n * The plus/minus tolerance for determining number equivalence.\n * @constant {number}\n *\n *  @see [FloatingPointRange]{@link FloatingPointRange}\n *  @see [IntegerRange]{@link IntegerRange}\n */\nconst DEFAULT_NUMERIC_RANGE_TOLERANCE = 1e-6;\n\nconst PARAMETER_SEPARATOR = '.';\nconst PARAMETER_BYTE = 10;\n\n/**\n * Enum for ParameterType\n * @readonly\n * @enum {number}\n */\nconst ParameterType = {\n  /** @member {number} */\n  PARAMETER_NOT_SET: 0,\n  /** @member {number} */\n  PARAMETER_BOOL: 1,\n  /** @member {number} */\n  PARAMETER_INTEGER: 2,\n  /** @member {number} */\n  PARAMETER_DOUBLE: 3,\n  /** @member {number} */\n  PARAMETER_STRING: 4,\n  /** @member {number} */\n  PARAMETER_BYTE_ARRAY: 5,\n  /** @member {number} */\n  PARAMETER_BOOL_ARRAY: 6,\n  /** @member {number} */\n  PARAMETER_INTEGER_ARRAY: 7,\n  /** @member {number} */\n  PARAMETER_DOUBLE_ARRAY: 8,\n  /** @member {number} */\n  PARAMETER_STRING_ARRAY: 9,\n};\n\n/**\n * A node parameter.\n * @class\n */\nclass Parameter {\n  /**\n   * Create a Parameter instance from an rlc_interfaces/msg/Parameter message.\n   * @constructs\n   * @param {rcl_interfaces/msg/Parameter} parameterMsg - The message to convert to a parameter.\n   * @return {Parameter} - The new instance.\n   */\n  static fromParameterMessage(parameterMsg) {\n    const name = parameterMsg.name;\n    const type = parameterMsg.value.type;\n    let value;\n\n    switch (type) {\n      case ParameterType.PARAMETER_NOT_SET:\n        break;\n      case ParameterType.PARAMETER_BOOL:\n        value = parameterMsg.value.bool_value;\n        break;\n      case ParameterType.PARAMETER_BOOL_ARRAY:\n        value = parameterMsg.value.bool_array_value;\n        break;\n      case ParameterType.PARAMETER_BYTE_ARRAY:\n        value = Array.from(parameterMsg.value.byte_array_value);\n        break;\n      case ParameterType.PARAMETER_DOUBLE:\n        value = parameterMsg.value.double_value;\n        break;\n      case ParameterType.PARAMETER_DOUBLE_ARRAY:\n        value = Array.from(parameterMsg.value.double_array_value);\n        break;\n      case ParameterType.PARAMETER_INTEGER:\n        value = parameterMsg.value.integer_value;\n        break;\n      case ParameterType.PARAMETER_INTEGER_ARRAY:\n        value = Array.from(parameterMsg.value.integer_array_value);\n        break;\n      case ParameterType.PARAMETER_STRING:\n        value = parameterMsg.value.string_value;\n        break;\n      case ParameterType.PARAMETER_STRING_ARRAY:\n        value = Array.from(parameterMsg.value.string_array_value);\n        break;\n    }\n\n    return new Parameter(name, type, value);\n  }\n\n  /**\n   * Create new parameter instances.\n   * @constructor\n   *\n   * @param {string} name - The parameter name, must be a valid name.\n   * @param {ParameterType} type - The type identifier.\n   * @param {any} value - The parameter value.\n   */\n  constructor(name, type, value) {\n    this._name = name;\n    this._type = type;\n    // Convert to bigint if it's type of `PARAMETER_INTEGER`.\n    this._value =\n      this._type == ParameterType.PARAMETER_INTEGER ? BigInt(value) : value;\n    this._isDirty = true;\n\n    this.validate();\n  }\n\n  /**\n   * Get name\n   *\n   * @return {string} - The parameter name.\n   */\n  get name() {\n    return this._name;\n  }\n\n  /**\n   * Get type\n   *\n   * @return {ParameterType} - The parameter type.\n   */\n  get type() {\n    return this._type;\n  }\n\n  /**\n   * Get value.\n   *\n   * @return {any} - The parameter value.\n   */\n  get value() {\n    return this._value;\n  }\n\n  /**\n   * Set value.\n   * Value must be compatible with the type property.\n   * @param {any} newValue - The parameter name.\n   */\n  set value(newValue) {\n    // no empty array value allowed\n    this._value =\n      Array.isArray(newValue) && newValue.length === 0 ? null : newValue;\n\n    this._dirty = true;\n    this.validate();\n  }\n\n  /**\n   * Check the state of this property.\n   * Throw TypeError on first property with invalid type.\n   * @return {undefined}\n   */\n  validate() {\n    // validate name\n    if (\n      !this.name ||\n      typeof this.name !== 'string' ||\n      this.name.trim().length === 0\n    ) {\n      throw new TypeValidationError('name', this.name, 'non-empty string', {\n        entityType: 'parameter',\n      });\n    }\n\n    // validate type\n    if (!validType(this.type)) {\n      throw new ParameterError('Invalid parameter type', this.name, {\n        details: { providedType: this.type },\n      });\n    }\n\n    // validate value\n    if (!validValue(this.value, this.type)) {\n      throw new ParameterTypeError(this.name, this.type, typeof this.value, {\n        details: {\n          providedValue: this.value,\n        },\n      });\n    }\n\n    this._dirty = false;\n  }\n\n  /**\n   * Create a rcl_interfaces.msg.Parameter from this instance.\n   *\n   * @return {rcl_interfaces.msg.Parameter} - The new instance.\n   */\n  toParameterMessage() {\n    const msg = {\n      name: this.name,\n      value: this.toParameterValueMessage(),\n    };\n    return msg;\n  }\n\n  /**\n   * Create a rcl_interfaces.msg.ParameterValue from this instance.\n   *\n   * @return {rcl_interfaces.msg.ParameterValue} - The new instance.\n   */\n  toParameterValueMessage() {\n    const msg = {};\n    msg.type = this.type;\n    switch (this.type) {\n      case ParameterType.PARAMETER_NOT_SET:\n        break;\n      case ParameterType.PARAMETER_BOOL:\n        msg.bool_value = this.value;\n        break;\n      case ParameterType.PARAMETER_BOOL_ARRAY:\n        msg.bool_array_value = this.value;\n        break;\n      case ParameterType.PARAMETER_BYTE_ARRAY:\n        msg.byte_array_value = this.value.map((val) => Math.trunc(val));\n        break;\n      case ParameterType.PARAMETER_DOUBLE:\n        msg.double_value = this.value;\n        break;\n      case ParameterType.PARAMETER_DOUBLE_ARRAY:\n        msg.double_array_value = this.value;\n        break;\n      case ParameterType.PARAMETER_INTEGER:\n        msg.integer_value = this.value;\n        break;\n      case ParameterType.PARAMETER_INTEGER_ARRAY:\n        msg.integer_array_value = this.value;\n        break;\n      case ParameterType.PARAMETER_STRING:\n        msg.string_value = this.value;\n        break;\n      case ParameterType.PARAMETER_STRING_ARRAY:\n        msg.string_array_value = this.value;\n        break;\n    }\n\n    return msg;\n  }\n}\n\n/**\n * A node parameter descriptor.\n * @class\n */\nclass ParameterDescriptor {\n  /**\n   * Create a new instance from a parameter.\n   * @constructs\n   * @param {Parameter} parameter - The parameter from which new instance is constructed.\n   * @return {ParameterDescriptor} - The new instance.\n   */\n  static fromParameter(parameter) {\n    const name = parameter.name;\n    const type = parameter.type;\n    return new ParameterDescriptor(name, type, 'Created from parameter.');\n  }\n\n  /**\n   * Create new instances.\n   * @constructor\n   * @param {string} name - The descriptor name, must be a valid name.\n   * @param {ParameterType} type - The type identifier.\n   * @param {string} [description] - A descriptive string.\n   * @param {boolean} [readOnly] - True indicates a parameter of this type can not be modified. Default = false.\n   * @param {Range} [range] - An optional IntegerRange or FloatingPointRange.\n   */\n  constructor(\n    name,\n    type = ParameterType.PARAMETER_NOT_SET,\n    description = 'no description',\n    readOnly = false,\n    range = null\n  ) {\n    this._name = name; // string\n    this._type = type; // ParameterType\n    this._description = description;\n    this._readOnly = readOnly;\n    this._additionalConstraints = '';\n    this._range = range;\n\n    this.validate();\n  }\n\n  /**\n   * Get name.\n   *\n   * @return {string} - The name property.\n   */\n  get name() {\n    return this._name;\n  }\n\n  /**\n   * Get type.\n   *\n   * @return {ParameterType} - The type property.\n   */\n  get type() {\n    return this._type;\n  }\n\n  /**\n   * Get description.\n   *\n   * @return {string} - A descriptive string property.\n   */\n  get description() {\n    return this._description;\n  }\n\n  /**\n   * Get readOnly property.\n   *\n   * @return {boolean} - The readOnly property.\n   */\n  get readOnly() {\n    return this._readOnly;\n  }\n\n  /**\n   * Get additionalConstraints property.\n   *\n   * @return {string} - The additionalConstraints property.\n   */\n  get additionalConstraints() {\n    return this._additionalConstraints;\n  }\n\n  /**\n   * Set additionalConstraints property. .\n   *\n   * @param {string} constraintDescription - The new value.\n   */\n  set additionalConstraints(constraintDescription) {\n    this._additionalConstraints = constraintDescription;\n  }\n\n  /**\n   * Determine if rangeConstraint property has been set.\n   *\n   * @return {boolean} - The rangeConstraint property.\n   */\n  hasRange() {\n    return !!this._range;\n  }\n\n  /**\n   * Get range.\n   *\n   * @return {FloatingPointRange|IntegerRange} - The range property.\n   */\n  get range() {\n    return this._range;\n  }\n\n  /**\n   * Set range.\n   * The range must be compatible with the type property.\n   * @param {FloatingPointRange|IntegerRange} range - The new range.\n   */\n  set range(range) {\n    if (!range) {\n      this._range = null;\n      return;\n    }\n    if (!(range instanceof Range)) {\n      throw new TypeValidationError('range', range, 'Range', {\n        entityType: 'parameter descriptor',\n        parameterName: this.name,\n      });\n    }\n    if (!range.isValidType(this.type)) {\n      throw new ParameterError(\n        'Incompatible Range for parameter type',\n        this.name,\n        {\n          entityType: 'parameter descriptor',\n          details: {\n            rangeType: range.constructor.name,\n            parameterType: this.type,\n          },\n        }\n      );\n    }\n\n    this._range = range;\n  }\n\n  /**\n   * Check the state and ensure it is valid.\n   * Throw a TypeError if invalid state is detected.\n   *\n   * @return {undefined}\n   */\n  validate() {\n    // validate name\n    if (\n      !this.name ||\n      typeof this.name !== 'string' ||\n      this.name.trim().length === 0\n    ) {\n      throw new TypeValidationError('name', this.name, 'non-empty string', {\n        entityType: 'parameter descriptor',\n      });\n    }\n\n    // validate type\n    if (!validType(this.type)) {\n      throw new ParameterError('Invalid parameter type', this.name, {\n        entityType: 'parameter descriptor',\n        details: { providedType: this.type },\n      });\n    }\n\n    // validate description\n    if (this.description && typeof this.description !== 'string') {\n      throw new TypeValidationError('description', this.description, 'string', {\n        entityType: 'parameter descriptor',\n        parameterName: this.name,\n      });\n    }\n\n    // validate rangeConstraint\n    if (this.hasRange() && !this.range.isValidType(this.type)) {\n      throw new ParameterError(\n        'Incompatible Range for parameter type',\n        this.name,\n        {\n          entityType: 'parameter descriptor',\n          details: {\n            rangeType: this.range.constructor.name,\n            parameterType: this.type,\n          },\n        }\n      );\n    }\n  }\n\n  /**\n   * Check a parameter for consistency with this descriptor.\n   * Throw an Error if an inconsistent state is detected.\n   *\n   * @param {Parameter} parameter - The parameter to test for consistency.\n   * @return {undefined}\n   */\n  validateParameter(parameter) {\n    if (!parameter) {\n      throw new TypeValidationError('parameter', parameter, 'Parameter', {\n        entityType: 'parameter descriptor',\n        parameterName: this.name,\n      });\n    }\n\n    // ensure parameter is valid\n    try {\n      parameter.validate();\n    } catch (err) {\n      throw new ParameterError('Parameter is invalid', parameter.name, {\n        cause: err,\n        details: { validationError: err.message },\n      });\n    }\n\n    // ensure this descriptor is valid\n    try {\n      this.validate();\n    } catch (err) {\n      throw new ParameterError('Descriptor is invalid', this.name, {\n        entityType: 'parameter descriptor',\n        cause: err,\n        details: { validationError: err.message },\n      });\n    }\n\n    if (this.name !== parameter.name) {\n      throw new ParameterError('Name mismatch', this.name, {\n        details: {\n          descriptorName: this.name,\n          parameterName: parameter.name,\n        },\n      });\n    }\n    if (this.type !== parameter.type) {\n      throw new ParameterTypeError(this.name, this.type, parameter.type, {\n        details: {\n          expectedType: this.type,\n          actualType: parameter.type,\n        },\n      });\n    }\n    if (this.hasRange() && !this.range.inRange(parameter.value)) {\n      throw new RangeValidationError(\n        'value',\n        parameter.value,\n        `${this.range.fromValue} to ${this.range.toValue}`,\n        {\n          entityType: 'parameter',\n          parameterName: parameter.name,\n          details: {\n            range: {\n              from: this.range.fromValue,\n              to: this.range.toValue,\n              step: this.range.step,\n            },\n          },\n        }\n      );\n    }\n  }\n\n  /**\n   * Create a rcl_interfaces.msg.ParameterDescriptor from this descriptor.\n   *\n   * @return {rcl_interfaces.msg.ParameterDescriptor} - The new message.\n   */\n  toMessage() {\n    const msg = {\n      name: this.name,\n      type: this.type,\n      description: this.description,\n      additional_constraints: this.additionalConstraints,\n      read_only: this.readOnly,\n    };\n    if (\n      (this._type === ParameterType.PARAMETER_INTEGER ||\n        this._type === ParameterType.PARAMETER_INTEGER_ARRAY) &&\n      this._rangeConstraint instanceof IntegerRange\n    ) {\n      msg.integer_range = [this._rangeConstraint];\n    } else if (\n      (this._type === ParameterType.PARAMETER_DOUBLE ||\n        this._type === ParameterType.PARAMETER_DOUBLE_ARRAY) &&\n      this._rangeConstraint instanceof FloatingPointRange\n    ) {\n      msg.floating_point_range = [this._rangeConstraint];\n    }\n\n    return msg;\n  }\n}\n\n/**\n * An abstract class defining a range of numbers between 2 points inclusively\n * divided by a step value.\n * @class\n */\nclass Range {\n  /**\n   * Create a new instance.\n   * @constructor\n   * @param {number} fromValue - The lowest inclusive value in range\n   * @param {number} toValue - The highest inclusive value in range\n   * @param {number} step - The internal unit size.\n   */\n  constructor(fromValue, toValue, step = 1) {\n    this._fromValue = fromValue;\n    this._toValue = toValue;\n    this._step = step;\n  }\n\n  /**\n   * Get fromValue.\n   *\n   * @return {number} - The lowest inclusive value in range.\n   */\n  get fromValue() {\n    return this._fromValue;\n  }\n\n  /**\n   * Get toValue.\n   *\n   * @return {number} - The highest inclusive value in range.\n   */\n  get toValue() {\n    return this._toValue;\n  }\n\n  /**\n   * Get step unit.\n   *\n   * @return {number} - The internal unit size.\n   */\n  get step() {\n    return this._step;\n  }\n\n  /**\n   * Determine if a value is within this range.\n   * A TypeError is thrown when value is not a number or bigint.\n   * Subclasses should override and call this method for basic type checking.\n   *\n   * @param {number|bigint} value - The number or bigint to check.\n   * @return {boolean} - True if value satisfies the range; false otherwise.\n   */\n  inRange(value) {\n    if (Array.isArray(value)) {\n      const valArr = value;\n      return valArr.reduce(\n        (inRange, val) => inRange && this.inRange(val),\n        true\n      );\n    } else if (typeof value !== 'number' && typeof value !== 'bigint') {\n      throw new TypeValidationError('value', value, 'number or bigint', {\n        entityType: 'range',\n      });\n    }\n\n    return true;\n  }\n\n  /**\n   * Abstract method that determines if a ParameterType is compatible.\n   * Subclasses must implement this method.\n   *\n   * @param {ParameterType} parameterType - The parameter type to test.\n   * @return {boolean} - True if parameterType is compatible; otherwise return false.\n   */\n  // eslint-disable-next-line no-unused-vars\n  isValidType(parameterType) {\n    return false;\n  }\n}\n\n/**\n * Defines a range for floating point values.\n * @class\n */\nclass FloatingPointRange extends Range {\n  /**\n   * Create a new instance.\n   * @constructor\n   * @param {number} fromValue - The lowest inclusive value in range\n   * @param {number} toValue - The highest inclusive value in range\n   * @param {number} step - The internal unit size.\n   * @param {number} tolerance - The plus/minus tolerance for number equivalence.\n   */\n  constructor(\n    fromValue,\n    toValue,\n    step = 1,\n    tolerance = DEFAULT_NUMERIC_RANGE_TOLERANCE\n  ) {\n    super(fromValue, toValue, step);\n    this._tolerance = tolerance;\n  }\n\n  get tolerance() {\n    return this._tolerance;\n  }\n\n  /**\n   * Determine if a ParameterType is compatible.\n   *\n   * @param {ParameterType} parameterType - The parameter type to test.\n   * @return {boolean} - True if parameterType is compatible; otherwise return false.\n   */\n  isValidType(parameterType) {\n    const result =\n      parameterType === ParameterType.PARAMETER_DOUBLE ||\n      parameterType === ParameterType.PARAMETER_DOUBLE_ARRAY;\n    return result;\n  }\n\n  /**\n   * Determine if a value is within this range.\n   * A TypeError is thrown when value is not a number.\n   *\n   * @param {number} value - The number to check.\n   * @return {boolean} - True if value satisfies the range; false otherwise.\n   */\n  inRange(value) {\n    if (!super.inRange(value)) return false;\n\n    const min = Math.min(this.fromValue, this.toValue);\n    const max = Math.max(this.fromValue, this.toValue);\n\n    if (\n      isClose(value, min, this.tolerance) ||\n      isClose(value, max, this.tolerance)\n    ) {\n      return true;\n    }\n    if (value < min || value > max) {\n      return false;\n    }\n    if (this.step != 0.0) {\n      const distanceInSteps = Math.round((value - min) / this.step);\n      if (!isClose(min + distanceInSteps * this.step, value, this.tolerance)) {\n        return false;\n      }\n    }\n\n    return true;\n  }\n}\n\n/**\n * Defines a range for integer values.\n * @class\n */\nclass IntegerRange extends Range {\n  /**\n   * Create a new instance.\n   * @constructor\n   * @param {bigint} fromValue - The lowest inclusive value in range\n   * @param {bigint} toValue - The highest inclusive value in range\n   * @param {bigint} step - The internal unit size.\n   */\n  constructor(fromValue, toValue, step = 1n) {\n    super(fromValue, toValue, step);\n  }\n\n  /**\n   * Determine if a ParameterType is compatible.\n   *\n   * @param {ParameterType} parameterType - The parameter type to test.\n   * @return {boolean} - True if parameterType is compatible; otherwise return false.\n   */\n  isValidType(parameterType) {\n    const result =\n      parameterType === ParameterType.PARAMETER_INTEGER ||\n      parameterType === ParameterType.PARAMETER_INTEGER_ARRAY;\n    return result;\n  }\n\n  inRange(value) {\n    const min = this.fromValue;\n    const max = this.toValue;\n    if (value < min || value > max) {\n      return false;\n    }\n\n    if (this.step != 0n && (value - min) % this.step !== 0n) {\n      return false;\n    }\n    return true;\n  }\n}\n\n/**\n * Infer a ParameterType for JS primitive types:\n * string, boolean, number and arrays of these types.\n * A TypeError is thrown for a value who's type is not one of\n * the set listed.\n * @param {any} value - The value to infer it's ParameterType\n * @returns {ParameterType} - The ParameterType that best scribes the value.\n */\nfunction parameterTypeFromValue(value) {\n  if (value === null || value === undefined) {\n    return ParameterType.PARAMETER_NOT_SET;\n  }\n\n  if (typeof value === 'boolean') {\n    return ParameterType.PARAMETER_BOOL;\n  }\n\n  if (typeof value === 'string') {\n    return ParameterType.PARAMETER_STRING;\n  }\n\n  if (typeof value === 'bigint') {\n    return ParameterType.PARAMETER_INTEGER;\n  }\n\n  if (typeof value === 'number') {\n    // Distinguish between integer and double\n    return Number.isInteger(value)\n      ? ParameterType.PARAMETER_INTEGER\n      : ParameterType.PARAMETER_DOUBLE;\n  }\n\n  // Handle TypedArrays\n  if (ArrayBuffer.isView(value) && !(value instanceof DataView)) {\n    if (value instanceof Uint8Array) {\n      return ParameterType.PARAMETER_BYTE_ARRAY;\n    }\n    // For other typed arrays, infer from first element\n    if (value.length > 0) {\n      const firstType = parameterTypeFromValue(value[0]);\n      if (firstType === ParameterType.PARAMETER_INTEGER) {\n        return ParameterType.PARAMETER_INTEGER_ARRAY;\n      }\n      return ParameterType.PARAMETER_DOUBLE_ARRAY;\n    }\n    return ParameterType.PARAMETER_NOT_SET;\n  }\n\n  if (Array.isArray(value)) {\n    if (value.length === 0) {\n      return ParameterType.PARAMETER_NOT_SET;\n    }\n\n    const elementType = parameterTypeFromValue(value[0]);\n    switch (elementType) {\n      case ParameterType.PARAMETER_BOOL:\n        return ParameterType.PARAMETER_BOOL_ARRAY;\n      case ParameterType.PARAMETER_INTEGER:\n        return ParameterType.PARAMETER_INTEGER_ARRAY;\n      case ParameterType.PARAMETER_DOUBLE:\n        return ParameterType.PARAMETER_DOUBLE_ARRAY;\n      case ParameterType.PARAMETER_STRING:\n        return ParameterType.PARAMETER_STRING_ARRAY;\n      default:\n        return ParameterType.PARAMETER_NOT_SET;\n    }\n  }\n\n  // Unrecognized value type\n  throw new TypeValidationError('value', value, 'valid parameter type', {\n    entityType: 'parameter',\n    details: {\n      supportedTypes: [\n        'boolean',\n        'string',\n        'number',\n        'boolean[]',\n        'number[]',\n        'string[]',\n      ],\n    },\n  });\n}\n\n/**\n * Determine if a number maps to is a valid ParameterType.\n *\n * @param {ParameterType} parameterType - The value to test.\n * @return {boolean} - True if value is a valid ParameterType; false otherwise.\n */\nfunction validType(parameterType) {\n  let result =\n    typeof parameterType === 'number' &&\n    parameterType >= ParameterType.PARAMETER_NOT_SET &&\n    parameterType <= ParameterType.PARAMETER_STRING_ARRAY;\n\n  return result;\n}\n\n/**\n * Test if value can be represented by a ParameterType.\n *\n * @param {number} value - The value to test.\n * @param {ParameterType} type - The ParameterType to test value against.\n * @return {boolean} - True if value can be represented by type.\n */\nfunction validValue(value, type) {\n  if (value == null) {\n    return type === ParameterType.PARAMETER_NOT_SET;\n  }\n\n  let result;\n  switch (type) {\n    case ParameterType.PARAMETER_NOT_SET:\n      result = !value;\n      break;\n    case ParameterType.PARAMETER_BOOL:\n      result = typeof value === 'boolean';\n      break;\n    case ParameterType.PARAMETER_STRING:\n      result = typeof value === 'string';\n      break;\n    case ParameterType.PARAMETER_DOUBLE:\n    case PARAMETER_BYTE:\n      result = typeof value === 'number';\n      break;\n    case ParameterType.PARAMETER_INTEGER:\n      result = typeof value === 'bigint';\n      break;\n    case ParameterType.PARAMETER_BOOL_ARRAY:\n    case ParameterType.PARAMETER_BYTE_ARRAY:\n    case ParameterType.PARAMETER_INTEGER_ARRAY:\n    case ParameterType.PARAMETER_DOUBLE_ARRAY:\n    case ParameterType.PARAMETER_STRING_ARRAY:\n      result = _validArray(value, type);\n      break;\n    default:\n      result = false;\n  }\n\n  return result;\n}\n\nfunction _validArray(values, type) {\n  if (!Array.isArray(values)) return false;\n\n  let arrayElementType;\n  if (type === ParameterType.PARAMETER_BOOL_ARRAY) {\n    arrayElementType = ParameterType.PARAMETER_BOOL;\n  } else if (type === ParameterType.PARAMETER_BYTE_ARRAY) {\n    arrayElementType = PARAMETER_BYTE;\n  } else if (type === ParameterType.PARAMETER_INTEGER_ARRAY) {\n    arrayElementType = ParameterType.PARAMETER_INTEGER;\n  } else if (type === ParameterType.PARAMETER_DOUBLE_ARRAY) {\n    arrayElementType = ParameterType.PARAMETER_DOUBLE;\n  } else if (type === ParameterType.PARAMETER_STRING_ARRAY) {\n    arrayElementType = ParameterType.PARAMETER_STRING;\n  }\n\n  return values.reduce(\n    (compatible, val) =>\n      compatible &&\n      !_isArrayParameterType(arrayElementType) &&\n      validValue(val, arrayElementType),\n    true\n  );\n}\n\nfunction _isArrayParameterType(type) {\n  return (\n    type === ParameterType.PARAMETER_BOOL_ARRAY ||\n    type === ParameterType.PARAMETER_BYTE_ARRAY ||\n    type === ParameterType.PARAMETER_INTEGER_ARRAY ||\n    type === ParameterType.PARAMETER_DOUBLE_ARRAY ||\n    type === ParameterType.PARAMETER_STRING_ARRAY\n  );\n}\n\nexport {\n  ParameterType,\n  Parameter,\n  ParameterDescriptor,\n  PARAMETER_SEPARATOR,\n  Range,\n  FloatingPointRange,\n  IntegerRange,\n  DEFAULT_NUMERIC_RANGE_TOLERANCE,\n  parameterTypeFromValue,\n};\n","//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Parameter } from './parameter.js';\n/**\n * NodeOptions specify configuration choices during the\n * node instantiation process.\n * @class\n */\nclass NodeOptions {\n  /**\n   * Create a new instance with default property values.\n   * @constructor\n   * @param {boolean} [startParameterServices=true]\n   * @param {array} [parameterOverrides=[]]\n   * @param {boolean} [automaticallyDeclareParametersFromOverrides=false]\n   * @param {boolean} [startTypeDescriptionService=true]\n   * @param {boolean} [enableRosout=true]\n   * @param {QoS} [rosoutQos=QoS.profileDefault]\n   * @param {boolean} [enableLoggerService=false]\n   */\n  constructor(\n    startParameterServices = true,\n    parameterOverrides = [],\n    automaticallyDeclareParametersFromOverrides = false,\n    startTypeDescriptionService = true,\n    enableRosout = true,\n    rosoutQos = null,\n    enableLoggerService = false\n  ) {\n    this._startParameterServices = startParameterServices;\n    this._parameterOverrides = parameterOverrides;\n    this._automaticallyDeclareParametersFromOverrides =\n      automaticallyDeclareParametersFromOverrides;\n    this._startTypeDescriptionService = startTypeDescriptionService;\n    this._enableRosout = enableRosout;\n    this._rosoutQos = rosoutQos;\n    this._enableLoggerService = enableLoggerService;\n  }\n\n  /**\n   * Get the startParameterServices option.\n   * Default value = true;\n   * @returns {boolean} -\n   */\n  get startParameterServices() {\n    return this._startParameterServices;\n  }\n\n  /**\n   * Set startParameterServices.\n   * @param {boolean} startFlag - True indicates for a node to start it's parameter_service.\n   */\n  set startParameterServices(startFlag) {\n    this._startParameterServices = startFlag;\n  }\n\n  /**\n   * Get the parameterOverrides.\n   * @return {Parameter[]} - An array of Parameters that serve as overrides for a node's default\n   *   parameters. Default = empty array [].\n   */\n  get parameterOverrides() {\n    return this._parameterOverrides;\n  }\n\n  /**\n   * Set the Parameters that will serve to override a node's default parameter settings.\n   * Setting to null, reinitializes the parameterOverrides to an empty array.\n   * @param {Parameter|Parameter[]} parameters - A single parameter or parameter[].\n   *    Default is an empty array.\n   */\n  set parameterOverrides(parameters = []) {\n    let povalue = parameters;\n\n    if (!povalue) {\n      povalue = [];\n    } else if (povalue instanceof Parameter) {\n      // a single parameter\n      povalue = [povalue];\n    } else if (!Array.isArray(parameters)) {\n      throw TypeError('Expected Parameter[]');\n    }\n\n    this._parameterOverrides = povalue;\n  }\n\n  /**\n   * Get the automaticallyDeclareParametersFromOverrides.\n   *\n   * @returns {boolean} - True indicates that a node should declare parameters from\n   *    it's parameter-overrides\n   */\n  get automaticallyDeclareParametersFromOverrides() {\n    return this._automaticallyDeclareParametersFromOverrides;\n  }\n\n  /**\n   * Set automaticallyDeclareParametersFromOverrides.\n   *\n   * @param {boolean} declareParamsFlag - When true, a node will declare parameters from all\n   * parameter-overrides.\n   */\n  set automaticallyDeclareParametersFromOverrides(declareParamsFlag) {\n    this._automaticallyDeclareParametersFromOverrides = declareParamsFlag;\n  }\n\n  /**\n   * Get the startTypeDescriptionService option, only available for ROS2 > Humble.\n   * Default value = true;\n   * @returns {boolean} - true if the type description service is enabled.\n   */\n  get startTypeDescriptionService() {\n    return this._startTypeDescriptionService;\n  }\n\n  /**\n   * Set startTypeDescriptionService, only available for ROS2 > Humble\n   * @param {boolean} willStartTypeDescriptionService\n   */\n  set startTypeDescriptionService(willStartTypeDescriptionService) {\n    this._startTypeDescriptionService = willStartTypeDescriptionService;\n  }\n\n  /**\n   * Get the enableRosout option.\n   * Default value = true;\n   * @returns {boolean} - true if the rosout logging is enabled.\n   */\n  get enableRosout() {\n    return this._enableRosout;\n  }\n\n  /**\n   * Set enableRosout.\n   * @param {boolean} enableRosout\n   */\n  set enableRosout(enableRosout) {\n    this._enableRosout = enableRosout;\n  }\n\n  /**\n   * Get the rosoutQos option.\n   * @returns {QoS} - The QoS profile for rosout.\n   */\n  get rosoutQos() {\n    return this._rosoutQos;\n  }\n\n  /**\n   * Set rosoutQos.\n   * @param {QoS} rosoutQos\n   */\n  set rosoutQos(rosoutQos) {\n    this._rosoutQos = rosoutQos;\n  }\n\n  /**\n   * Get the enableLoggerService option.\n   * Default value = false;\n   * @returns {boolean} - true if logger services are enabled.\n   */\n  get enableLoggerService() {\n    return this._enableLoggerService;\n  }\n\n  /**\n   * Set enableLoggerService.\n   * @param {boolean} enableLoggerService\n   */\n  set enableLoggerService(enableLoggerService) {\n    this._enableLoggerService = enableLoggerService;\n  }\n\n  /**\n   * Return an instance configured with default options.\n   * @returns {NodeOptions} - An instance with default values.\n   */\n  static get defaultOptions() {\n    return new NodeOptions();\n  }\n}\n\nexport default NodeOptions;\n","// Copyright (c) 2026 The Robot Web Tools Contributors. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport QoS from './qos.js';\nimport { Parameter, ParameterType, ParameterDescriptor } from './parameter.js';\n\n/**\n * Enum of overridable QoS policy kinds.\n * Each value corresponds to a QoS property on the {@link QoS} class.\n * @enum {number}\n */\nconst QoSPolicyKind = Object.freeze({\n  HISTORY: 1,\n  DEPTH: 2,\n  RELIABILITY: 3,\n  DURABILITY: 4,\n  LIVELINESS: 5,\n  AVOID_ROS_NAMESPACE_CONVENTIONS: 6,\n});\n\n// Maps QoSPolicyKind -> { qosProp, paramKey, paramType, toParam, fromParam }\nconst POLICY_MAP = {\n  [QoSPolicyKind.HISTORY]: {\n    qosProp: 'history',\n    paramKey: 'history',\n    enumObj: QoS.HistoryPolicy,\n    paramType: ParameterType.PARAMETER_STRING,\n    toParam: (val, enumObj) => _enumToString(val, enumObj),\n    fromParam: (val, enumObj) => _stringToEnum(val, enumObj),\n  },\n  [QoSPolicyKind.DEPTH]: {\n    qosProp: 'depth',\n    paramKey: 'depth',\n    paramType: ParameterType.PARAMETER_INTEGER,\n    toParam: (val) => BigInt(val),\n    fromParam: (val) => Number(val),\n  },\n  [QoSPolicyKind.RELIABILITY]: {\n    qosProp: 'reliability',\n    paramKey: 'reliability',\n    enumObj: QoS.ReliabilityPolicy,\n    paramType: ParameterType.PARAMETER_STRING,\n    toParam: (val, enumObj) => _enumToString(val, enumObj),\n    fromParam: (val, enumObj) => _stringToEnum(val, enumObj),\n  },\n  [QoSPolicyKind.DURABILITY]: {\n    qosProp: 'durability',\n    paramKey: 'durability',\n    enumObj: QoS.DurabilityPolicy,\n    paramType: ParameterType.PARAMETER_STRING,\n    toParam: (val, enumObj) => _enumToString(val, enumObj),\n    fromParam: (val, enumObj) => _stringToEnum(val, enumObj),\n  },\n  [QoSPolicyKind.LIVELINESS]: {\n    qosProp: 'liveliness',\n    paramKey: 'liveliness',\n    enumObj: QoS.LivelinessPolicy,\n    paramType: ParameterType.PARAMETER_STRING,\n    toParam: (val, enumObj) => _enumToString(val, enumObj),\n    fromParam: (val, enumObj) => _stringToEnum(val, enumObj),\n  },\n  [QoSPolicyKind.AVOID_ROS_NAMESPACE_CONVENTIONS]: {\n    qosProp: 'avoidRosNameSpaceConventions',\n    paramKey: 'avoid_ros_namespace_conventions',\n    paramType: ParameterType.PARAMETER_BOOL,\n    toParam: (val) => val,\n    fromParam: (val) => Boolean(val),\n  },\n};\n\n/**\n * Convert a numeric enum value to a lowercase string name.\n * @param {number} val - enum numeric value\n * @param {Object} enumObj - the enum object (e.g. QoS.HistoryPolicy)\n * @returns {string}\n */\nfunction _enumToString(val, enumObj) {\n  for (const [key, v] of Object.entries(enumObj)) {\n    if (v === val) {\n      // Strip the RMW prefix: \"RMW_QOS_POLICY_HISTORY_KEEP_LAST\" -> \"keep_last\"\n      const parts = key.split('_');\n      // Find the index after the policy name (HISTORY, RELIABILITY, etc.)\n      // Pattern: RMW_QOS_POLICY_<POLICY>_<VALUE>\n      const policyNames = [\n        'HISTORY',\n        'RELIABILITY',\n        'DURABILITY',\n        'LIVELINESS',\n      ];\n      let valueStart = 4; // default: skip RMW_QOS_POLICY_<X>_\n      for (let i = 3; i < parts.length; i++) {\n        if (policyNames.includes(parts[i])) {\n          valueStart = i + 1;\n          break;\n        }\n      }\n      return parts.slice(valueStart).join('_').toLowerCase();\n    }\n  }\n  return String(val);\n}\n\n/**\n * Convert a lowercase string back to a numeric enum value.\n * @param {string} str - the string value (e.g. \"keep_last\")\n * @param {Object} enumObj - the enum object\n * @returns {number}\n */\nfunction _stringToEnum(str, enumObj) {\n  const upper = str.toUpperCase();\n  for (const [key, val] of Object.entries(enumObj)) {\n    if (key.endsWith('_' + upper)) {\n      return val;\n    }\n  }\n  throw new Error(`Unknown QoS policy value: \"${str}\"`);\n}\n\n/**\n * Options for overriding QoS policies via ROS parameters.\n *\n * When passed to `createPublisher()` or `createSubscription()`, the node\n * will declare read-only parameters for each specified policy kind. These\n * parameters can be set via command-line arguments, launch files, or\n * parameter files to override the QoS profile at startup.\n *\n * Parameter naming convention:\n *   `qos_overrides.<topic>.<publisher|subscription>[_<entityId>].<policy>`\n *\n * @example\n * // Override history, depth, and reliability via parameters\n * const sub = node.createSubscription(\n *   'std_msgs/msg/String', '/chatter',\n *   { qos: rclnodejs.QoS.profileDefault,\n *     qosOverridingOptions: QoSOverridingOptions.withDefaultPolicies() },\n *   (msg) => console.log(msg.data)\n * );\n * // Now you can override via CLI:\n * //   --ros-args -p \"qos_overrides./chatter.subscription.depth:=20\"\n */\nclass QoSOverridingOptions {\n  /**\n   * @param {Array<QoSPolicyKind>} policyKinds - Which QoS policies to expose as parameters.\n   * @param {Object} [opts]\n   * @param {function} [opts.callback] - Optional validation callback. Receives the\n   *   final QoS profile after overrides are applied. Should return\n   *   `{successful: true}` or `{successful: false, reason: '...'}`.\n   * @param {string} [opts.entityId] - Optional suffix to disambiguate multiple\n   *   publishers/subscriptions on the same topic.\n   */\n  constructor(policyKinds, opts = {}) {\n    this._policyKinds = Array.from(policyKinds);\n    this._callback = opts.callback || null;\n    this._entityId = opts.entityId || null;\n  }\n\n  get policyKinds() {\n    return this._policyKinds;\n  }\n\n  get callback() {\n    return this._callback;\n  }\n\n  get entityId() {\n    return this._entityId;\n  }\n\n  /**\n   * Create options that override history, depth, and reliability —\n   * the most commonly tuned policies.\n   * @param {Object} [opts]\n   * @param {function} [opts.callback] - Validation callback.\n   * @param {string} [opts.entityId] - Entity disambiguation suffix.\n   * @returns {QoSOverridingOptions}\n   */\n  static withDefaultPolicies(opts = {}) {\n    return new QoSOverridingOptions(\n      [QoSPolicyKind.HISTORY, QoSPolicyKind.DEPTH, QoSPolicyKind.RELIABILITY],\n      opts\n    );\n  }\n}\n\n/**\n * Resolve QoS profile string to a mutable QoS object.\n * If already a QoS instance, return as-is.\n * @param {QoS|string} qos\n * @returns {QoS}\n */\nfunction _resolveQoS(qos) {\n  if (qos instanceof QoS) {\n    return qos;\n  }\n  // Plain object with QoS fields — construct a QoS from its properties\n  if (typeof qos === 'object' && qos !== null && !Array.isArray(qos)) {\n    return new QoS(\n      qos.history,\n      qos.depth,\n      qos.reliability,\n      qos.durability,\n      qos.liveliness,\n      qos.avoidRosNameSpaceConventions\n    );\n  }\n  // Profile string: create a QoS with the corresponding defaults\n  // Values must match the rmw_qos_profile_* definitions in rmw/types.h\n  switch (qos) {\n    case QoS.profileDefault:\n      return new QoS(\n        QoS.HistoryPolicy.RMW_QOS_POLICY_HISTORY_KEEP_LAST,\n        10,\n        QoS.ReliabilityPolicy.RMW_QOS_POLICY_RELIABILITY_RELIABLE,\n        QoS.DurabilityPolicy.RMW_QOS_POLICY_DURABILITY_VOLATILE\n      );\n    case QoS.profileSystemDefault:\n      return new QoS(\n        QoS.HistoryPolicy.RMW_QOS_POLICY_HISTORY_SYSTEM_DEFAULT,\n        0,\n        QoS.ReliabilityPolicy.RMW_QOS_POLICY_RELIABILITY_SYSTEM_DEFAULT,\n        QoS.DurabilityPolicy.RMW_QOS_POLICY_DURABILITY_SYSTEM_DEFAULT,\n        QoS.LivelinessPolicy.RMW_QOS_POLICY_LIVELINESS_SYSTEM_DEFAULT\n      );\n    case QoS.profileSensorData:\n      return new QoS(\n        QoS.HistoryPolicy.RMW_QOS_POLICY_HISTORY_KEEP_LAST,\n        5,\n        QoS.ReliabilityPolicy.RMW_QOS_POLICY_RELIABILITY_BEST_EFFORT,\n        QoS.DurabilityPolicy.RMW_QOS_POLICY_DURABILITY_VOLATILE\n      );\n    case QoS.profileServicesDefault:\n      return new QoS(\n        QoS.HistoryPolicy.RMW_QOS_POLICY_HISTORY_KEEP_LAST,\n        10,\n        QoS.ReliabilityPolicy.RMW_QOS_POLICY_RELIABILITY_RELIABLE,\n        QoS.DurabilityPolicy.RMW_QOS_POLICY_DURABILITY_VOLATILE\n      );\n    case QoS.profileParameters:\n      return new QoS(\n        QoS.HistoryPolicy.RMW_QOS_POLICY_HISTORY_KEEP_LAST,\n        1000,\n        QoS.ReliabilityPolicy.RMW_QOS_POLICY_RELIABILITY_RELIABLE,\n        QoS.DurabilityPolicy.RMW_QOS_POLICY_DURABILITY_VOLATILE\n      );\n    case QoS.profileParameterEvents:\n      return new QoS(\n        QoS.HistoryPolicy.RMW_QOS_POLICY_HISTORY_KEEP_LAST,\n        1000,\n        QoS.ReliabilityPolicy.RMW_QOS_POLICY_RELIABILITY_RELIABLE,\n        QoS.DurabilityPolicy.RMW_QOS_POLICY_DURABILITY_VOLATILE\n      );\n    case QoS.profileActionStatusDefault:\n      return new QoS(\n        QoS.HistoryPolicy.RMW_QOS_POLICY_HISTORY_KEEP_LAST,\n        1,\n        QoS.ReliabilityPolicy.RMW_QOS_POLICY_RELIABILITY_RELIABLE,\n        QoS.DurabilityPolicy.RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL\n      );\n    default:\n      return new QoS(\n        QoS.HistoryPolicy.RMW_QOS_POLICY_HISTORY_KEEP_LAST,\n        10,\n        QoS.ReliabilityPolicy.RMW_QOS_POLICY_RELIABILITY_RELIABLE,\n        QoS.DurabilityPolicy.RMW_QOS_POLICY_DURABILITY_VOLATILE\n      );\n  }\n}\n\n/**\n * Declare QoS override parameters on the node and apply any overrides\n * to the QoS profile in-place.\n *\n * @param {'publisher'|'subscription'} entityType\n * @param {Node} node\n * @param {string} topic - Fully resolved topic name.\n * @param {QoS} qos - Mutable QoS object (will be modified in-place).\n * @param {QoSOverridingOptions} options\n */\nfunction declareQosParameters(entityType, node, topic, qos, options) {\n  if (!options || options.policyKinds.length === 0) {\n    return;\n  }\n\n  const idSuffix = options.entityId ? `_${options.entityId}` : '';\n  const namePrefix = `qos_overrides.${topic}.${entityType}${idSuffix}`;\n\n  for (const policyKind of options.policyKinds) {\n    const mapping = POLICY_MAP[policyKind];\n    if (!mapping) {\n      continue;\n    }\n\n    const paramName = `${namePrefix}.${mapping.paramKey}`;\n    const currentValue = qos[mapping.qosProp];\n    const paramValue = mapping.toParam(currentValue, mapping.enumObj);\n\n    const descriptor = new ParameterDescriptor(\n      paramName,\n      mapping.paramType,\n      `QoS override for ${mapping.qosProp}`,\n      true // readOnly\n    );\n\n    let param;\n    try {\n      param = node.declareParameter(\n        new Parameter(paramName, mapping.paramType, paramValue),\n        descriptor\n      );\n    } catch (e) {\n      // Already declared (e.g. multiple entities on same topic) — reuse\n      if (node.hasParameter(paramName)) {\n        param = node.getParameter(paramName);\n      } else {\n        throw e;\n      }\n    }\n\n    // Apply the (possibly overridden) parameter value back to QoS\n    if (param && param.value !== paramValue) {\n      qos[mapping.qosProp] = mapping.fromParam(param.value, mapping.enumObj);\n    }\n  }\n\n  // Run validation callback if provided\n  if (options.callback) {\n    const result = options.callback(qos);\n    if (result && !result.successful) {\n      throw new Error(\n        `QoS override validation failed: ${result.reason || 'unknown reason'}`\n      );\n    }\n  }\n}\n\nexport {\n  QoSPolicyKind,\n  QoSOverridingOptions,\n  declareQosParameters,\n  _resolveQoS,\n};\n","// Copyright (c) 2017 Intel Corporation. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport rclnodejs from './native_loader.js';\nimport { TypeValidationError, NameValidationError } from './errors.js';\n\n/**\n * An object - Representing a validator in ROS.\n * @exports validator\n */\nlet validator = {\n  _createErrorFromValidation: function (result, nameValue, nameType) {\n    return new NameValidationError(nameValue, nameType, result[0], result[1]);\n  },\n\n  /**\n   * Validate a given topic or service name, and throw an error if invalid.\n   * @param {string} topic - The name of topic/service. Must be fully-qualified and already expanded.\n   * @returns {true} Always returns true if valid.\n   * @throws {TypeValidationError} If topic is not a string.\n   * @throws {NameValidationError} If the topic name is invalid.\n   */\n  validateFullTopicName(topic) {\n    if (typeof topic !== 'string') {\n      throw new TypeValidationError('topic', topic, 'string');\n    }\n\n    let result = rclnodejs.validateFullTopicName(topic);\n    if (result === null) {\n      return true;\n    }\n    throw this._createErrorFromValidation(result, topic, 'topic');\n  },\n\n  /**\n   * Check if a fully-qualified topic name is valid without throwing.\n   * @param {string} topic - The name of topic/service. Must be fully-qualified and already expanded.\n   * @returns {boolean} True if valid, false otherwise.\n   */\n  isValidFullTopicName(topic) {\n    if (typeof topic !== 'string') {\n      return false;\n    }\n    return rclnodejs.validateFullTopicName(topic) === null;\n  },\n\n  /**\n   * Validate a given node name, and throw an error if invalid.\n   * @param {string} name - The name of node.\n   * @returns {true} Always returns true if valid.\n   * @throws {TypeValidationError} If name is not a string.\n   * @throws {NameValidationError} If the node name is invalid.\n   */\n  validateNodeName(name) {\n    if (typeof name !== 'string') {\n      throw new TypeValidationError('name', name, 'string');\n    }\n\n    let result = rclnodejs.validateNodeName(name);\n    if (result === null) {\n      return true;\n    }\n    throw this._createErrorFromValidation(result, name, 'node');\n  },\n\n  /**\n   * Check if a node name is valid without throwing.\n   * @param {string} name - The name of node.\n   * @returns {boolean} True if valid, false otherwise.\n   */\n  isValidNodeName(name) {\n    if (typeof name !== 'string') {\n      return false;\n    }\n    return rclnodejs.validateNodeName(name) === null;\n  },\n\n  /**\n   * Validate a given topic or service name, and throw an error if invalid.\n   * @param {string} topic - The name of topic/service. Does not have to be fully-qualified.\n   * @returns {true} Always returns true if valid.\n   * @throws {TypeValidationError} If topic is not a string.\n   * @throws {NameValidationError} If the topic name is invalid.\n   */\n  validateTopicName(topic) {\n    if (typeof topic !== 'string') {\n      throw new TypeValidationError('topic', topic, 'string');\n    }\n\n    let result = rclnodejs.validateTopicName(topic);\n    if (result === null) {\n      return true;\n    }\n    throw this._createErrorFromValidation(result, topic, 'topic');\n  },\n\n  /**\n   * Check if a topic name is valid without throwing.\n   * @param {string} topic - The name of topic/service. Does not have to be fully-qualified.\n   * @returns {boolean} True if valid, false otherwise.\n   */\n  isValidTopicName(topic) {\n    if (typeof topic !== 'string') {\n      return false;\n    }\n    return rclnodejs.validateTopicName(topic) === null;\n  },\n\n  /**\n   * Validate a given namespace, and throw an error if invalid.\n   * @param {string} namespace - The namespace to be validated.\n   * @returns {true} Always returns true if valid.\n   * @throws {TypeValidationError} If namespace is not a string.\n   * @throws {NameValidationError} If the namespace is invalid.\n   */\n  validateNamespace(namespace) {\n    if (typeof namespace !== 'string') {\n      throw new TypeValidationError('namespace', namespace, 'string');\n    }\n\n    let result = rclnodejs.validateNamespace(namespace);\n    if (result === null) {\n      return true;\n    }\n    throw this._createErrorFromValidation(result, namespace, 'namespace');\n  },\n\n  /**\n   * Check if a namespace is valid without throwing.\n   * @param {string} namespace - The namespace to be validated.\n   * @returns {boolean} True if valid, false otherwise.\n   */\n  isValidNamespace(namespace) {\n    if (typeof namespace !== 'string') {\n      return false;\n    }\n    return rclnodejs.validateNamespace(namespace) === null;\n  },\n};\n\nexport default validator;\n\n// Named export for the one method imported directly elsewhere (e.g. node.js).\n// Bound to the validator object so it works when called as a free function.\nexport const validateFullTopicName =\n  validator.validateFullTopicName.bind(validator);\n","// Copyright (c) 2020 Matt Richard. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/**\n * Goal events that cause state transitions.\n * @ignore\n * @readonly\n * @enum {number}\n */\nconst GoalEvent = {\n  /** @member {number} */\n  EXECUTE: 0,\n  /** @member {number} */\n  CANCEL_GOAL: 1,\n  /** @member {number} */\n  SUCCEED: 2,\n  /** @member {number} */\n  ABORT: 3,\n  /** @member {number} */\n  CANCELED: 4,\n};\n\n/**\n * Possible goal responses.\n * @readonly\n * @enum {number}\n */\nconst GoalResponse = {\n  /** @member {number} */\n  REJECT: 1,\n  /** @member {number} */\n  ACCEPT: 2,\n};\n\n/**\n * Possible cancel responses.\n * @readonly\n * @enum {number}\n */\nconst CancelResponse = {\n  /** @member {number} */\n  REJECT: 1,\n  /** @member {number} */\n  ACCEPT: 2,\n};\n\nexport { GoalEvent, GoalResponse, CancelResponse };\n","// Copyright (c) 2020 Matt Richard. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport rclnodejs from '../native_loader.js';\nimport ActionInterfaces from './interfaces.js';\nimport Deferred from './deferred.js';\nimport { GoalEvent } from './response.js';\n\n/**\n * @class - Goal handle for working with Action Servers.\n * @hideconstructor\n */\n\nclass ServerGoalHandle {\n  constructor(actionServer, goalInfo, goalRequest) {\n    this._actionServer = actionServer;\n    this._goalInfo = goalInfo;\n    this._goalRequest = goalRequest;\n    this._cancelRequested = false;\n    this._deferred = new Deferred();\n\n    this._handle = rclnodejs.actionAcceptNewGoal(\n      this._actionServer.handle,\n      this._goalInfo.serialize()\n    );\n  }\n\n  /**\n   * Gets the goal request.\n   */\n  get request() {\n    return this._goalRequest;\n  }\n\n  /**\n   * Gets the goal Id.\n   */\n  get goalId() {\n    return this._goalInfo.goal_id;\n  }\n\n  /**\n   * Gets if the goal handle is active.\n   */\n  get isActive() {\n    if (this._destroyed) {\n      return false;\n    }\n\n    return rclnodejs.actionGoalHandleIsActive(this._handle);\n  }\n\n  /**\n   * Gets if cancellation was requested.\n   */\n  get isCancelRequested() {\n    return this.status === ActionInterfaces.GoalStatus.STATUS_CANCELING;\n  }\n\n  /**\n   * Gets the status of the goal.\n   */\n  get status() {\n    if (this._destroyed) {\n      return ActionInterfaces.GoalStatus.STATUS_UNKNOWN;\n    }\n\n    return rclnodejs.actionGoalHandleGetStatus(this._handle);\n  }\n\n  /**\n   * Transitions the goal to the executing state and begins execution.\n   * Has no effect if the goal is already executing, no longer active, or destroyed.\n   * @param {function} callback - An optional callback to use instead of the one provided to the action server.\n   * @returns {undefined}\n   */\n  execute(callback) {\n    if (this._destroyed) {\n      return;\n    }\n\n    // Guard: already executing — no-op\n    if (this.status === ActionInterfaces.GoalStatus.STATUS_EXECUTING) {\n      return;\n    }\n\n    // Guard: only transition if goal is still active\n    if (!this.isActive) {\n      return;\n    }\n\n    if (!this.isCancelRequested) {\n      this._updateState(GoalEvent.EXECUTE);\n    }\n\n    this._actionServer.notifyExecute(this, callback);\n  }\n\n  /**\n   * Sends feedback back to the client.\n   * @param {object} feedback - The feedback to send back.\n   * @returns {undefined}\n   */\n  publishFeedback(feedback) {\n    // Ignore for already destroyed goal handles\n    if (this._destroyed) {\n      return;\n    }\n\n    if (this.status !== ActionInterfaces.GoalStatus.STATUS_EXECUTING) {\n      this._actionServer._node\n        .getLogger()\n        .warn(\n          `publishFeedback() called on goal ${this.goalId.uuid} ` +\n            `in status ${this.status}, not executing; ignoring`\n        );\n      return;\n    }\n\n    let feedbackMessage =\n      new this._actionServer.typeClass.impl.FeedbackMessage();\n    feedbackMessage['goal_id'] = this.goalId;\n    feedbackMessage.feedback = feedback;\n\n    rclnodejs.actionPublishFeedback(\n      this._actionServer.handle,\n      feedbackMessage.serialize()\n    );\n  }\n\n  /**\n   * Updates the goal handle with the succeed status.\n   * @returns {undefined}\n   */\n  succeed() {\n    this._updateState(GoalEvent.SUCCEED);\n  }\n\n  /**\n   * Updates the goal handle with the abort status.\n   * @returns {undefined}\n   */\n  abort() {\n    this._updateState(GoalEvent.ABORT);\n  }\n\n  /**\n   * Updates the goal handle with the canceled status.\n   * @returns {undefined}\n   */\n  canceled() {\n    this._updateState(GoalEvent.CANCELED);\n  }\n\n  /**\n   * Marks the goal handle as destroyed. Any further updates to the handle will be ignored.\n   * @ignore\n   * @returns {undefined}\n   */\n  destroy() {\n    if (this._destroyed) {\n      return;\n    }\n\n    this._destroyed = true;\n  }\n\n  _updateState(event) {\n    // Ignore updates for already destroyed goal handles\n    if (this._destroyed) {\n      return;\n    }\n\n    // Update state\n    rclnodejs.actionUpdateGoalState(this._handle, event);\n\n    // Publish state change\n    rclnodejs.actionPublishStatus(this._actionServer.handle);\n\n    // If it's a terminal state, then also notify the action server\n    if (!rclnodejs.actionGoalHandleIsActive(this._handle)) {\n      rclnodejs.actionNotifyGoalDone(this._actionServer.handle);\n    }\n  }\n}\n\nexport default ServerGoalHandle;\n","// Copyright (c) 2020 Matt Richard. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport rclnodejs from '../native_loader.js';\nimport ActionInterfaces from './interfaces.js';\nimport ActionUuid from './uuid.js';\nimport DistroUtils from '../distro.js';\nimport Entity from '../entity.js';\nimport { CancelResponse, GoalEvent, GoalResponse } from './response.js';\nimport loader from '../interface_loader.js';\nimport QoS from '../qos.js';\nimport ServerGoalHandle from './server_goal_handle.js';\nimport { TypeValidationError } from '../errors.js';\n\n/**\n * Execute the goal.\n * @param {ServerGoalHandle} goalHandle - The server goal handle.\n * @returns {undefined}\n */\nfunction defaultHandleAcceptedCallback(goalHandle) {\n  goalHandle.execute();\n}\n\n/**\n * Accept all goals.\n * @returns {number} - Always responds with acceptance.\n */\nfunction defaultGoalCallback() {\n  return GoalResponse.ACCEPT;\n}\n\n/**\n * No cancellations.\n * @returns {number} - Always responds with rejection\n */\nfunction defaultCancelCallback() {\n  return CancelResponse.REJECT;\n}\n\n/**\n * @class - ROS Action server.\n */\n\nclass ActionServer extends Entity {\n  /**\n   * Creates a new action server.\n   * @constructor\n   *\n   * @param {Node} node - The ROS node to add the action server to.\n   * @param {function|string|object} typeClass - Type of the action.\n   * @param {string} actionName - Name of the action. Used as part of the underlying topic and service names.\n   * @param {function} executeCallback - Callback function for processing accepted goals.\n   * @param {function} goalCallback - Callback function for handling new goal requests.\n   * @param {function} handleAcceptedCallback - Callback function for handling newly accepted goals.\n   * @param {function} cancelCallback - Callback function for handling cancel requests.\n   * @param {object} options - Action server options.\n   * @param {number} options.resultTimeout - How long in seconds a result is kept by the server after a goal reaches a terminal state in seconds, default: 900.\n   * @param {boolean} options.enableTypedArray - The topic will use TypedArray if necessary, default: true.\n   * @param {object} options.qos - ROS Middleware \"quality of service\" options.\n   * @param {QoS} options.qos.goalServiceQosProfile - Quality of service option for the goal service, default: QoS.profileServicesDefault.\n   * @param {QoS} options.qos.resultServiceQosProfile - Quality of service option for the result service, default: QoS.profileServicesDefault.\n   * @param {QoS} options.qos.cancelServiceQosProfile - Quality of service option for the cancel service, default: QoS.profileServicesDefault..\n   * @param {QoS} options.qos.feedbackSubQosProfile - Quality of service option for the feedback subscription,\n   *                                                  default: new QoS(QoS.HistoryPolicy.RMW_QOS_POLICY_HISTORY_SYSTEM_DEFAULT, 10).\n   * @param {QoS} options.qos.statusSubQosProfile - Quality of service option for the status subscription, default: QoS.profileActionStatusDefault.\n   */\n  constructor(\n    node,\n    typeClass,\n    actionName,\n    executeCallback,\n    goalCallback = defaultGoalCallback,\n    handleAcceptedCallback = defaultHandleAcceptedCallback,\n    cancelCallback = defaultCancelCallback,\n    options\n  ) {\n    super(null, null, options);\n\n    this._node = node;\n    this._typeClass = loader.loadInterface(typeClass);\n    this._actionName = actionName;\n    this._goalHandles = new Map();\n\n    // Setup options defaults\n    this._options = this._options || {};\n    this._options.resultTimeout =\n      this._options.resultTimeout != null ? this._options.resultTimeout : 900;\n    this._options.enableTypedArray = this._options.enableTypedArray !== false;\n    this._options.qos = this._options.qos || {};\n    this._options.qos.goalServiceQosProfile =\n      this._options.qos.goalServiceQosProfile || QoS.profileServicesDefault;\n    this._options.qos.resultServiceQosProfile =\n      this._options.qos.resultServiceQosProfile || QoS.profileServicesDefault;\n    this._options.qos.cancelServiceQosProfile =\n      this._options.qos.cancelServiceQosProfile || QoS.profileServicesDefault;\n    this._options.qos.feedbackSubQosProfile =\n      this._options.qos.feedbackSubQosProfile ||\n      new QoS(QoS.HistoryPolicy.RMW_QOS_POLICY_HISTORY_SYSTEM_DEFAULT, 10);\n    this._options.qos.statusSubQosProfile =\n      this._options.qos.statusSubQosProfile || QoS.profileActionStatusDefault;\n\n    this.registerExecuteCallback(executeCallback);\n    this.registerGoalCallback(goalCallback);\n    this.registerHandleAcceptedCallback(handleAcceptedCallback);\n    this.registerCancelCallback(cancelCallback);\n\n    let type = this.typeClass.type();\n\n    this._handle = rclnodejs.actionCreateServer(\n      node.handle,\n      node.getClock().handle,\n      actionName,\n      type.interfaceName,\n      type.pkgName,\n      this.qos.goalServiceQosProfile,\n      this.qos.resultServiceQosProfile,\n      this.qos.cancelServiceQosProfile,\n      this.qos.feedbackSubQosProfile,\n      this.qos.statusSubQosProfile,\n      this.options.resultTimeout\n    );\n\n    node._addActionServer(this);\n  }\n\n  processGoalRequest(header, request) {\n    this._executeGoalRequest(header, request);\n  }\n\n  processCancelRequest(header, request) {\n    this._executeCancelRequest(header, request);\n  }\n\n  processResultRequest(header, request) {\n    this._executeGetResultRequest(header, request);\n  }\n\n  processGoalExpired(result, count) {\n    this._executeExpiredGoals(result, count);\n  }\n\n  /**\n   * Register a callback for handling newly accepted goals.\n   *\n   * The provided function is called whenever a new goal has been accepted by this action server.\n   * The function should expect an instance of {@link ServerGoalHandle} as an argument,\n   * which represents a handle to the goal that was accepted.\n   * The goal handle can be used to interact with the goal, e.g. publish feedback,\n   * update the status, or execute a deferred goal.\n   *\n   * There can only be one handle accepted callback per {@link ActionServer},\n   * therefore calling this function will replace any previously registered callback.\n   *\n   * @param {function} handleAcceptedCallback - Callback function, if not provided,\n   * then unregisters any previously registered callback.\n   * @returns {undefined}\n   */\n  registerHandleAcceptedCallback(handleAcceptedCallback) {\n    this._handleAcceptedCallback =\n      handleAcceptedCallback || defaultHandleAcceptedCallback;\n  }\n\n  /**\n   * Register a callback for handling new goal requests.\n   *\n   * The purpose of the goal callback is to decide if a new goal should be accepted or rejected.\n   * The callback should take the goal request message as a parameter and must return a {@link GoalResponse} value.\n   *\n   * @param {function} goalCallback - Callback function, if not provided,\n   * then unregisters any previously registered callback.\n   * @returns {undefined}\n   */\n  registerGoalCallback(goalCallback) {\n    this._goalCallback = goalCallback || defaultGoalCallback;\n  }\n\n  /**\n   * Register a callback for handling cancel requests.\n   *\n   * The purpose of the cancel callback is to decide if a request to cancel an on-going\n   * (or queued) goal should be accepted or rejected.\n   * The callback should take one parameter containing the cancel request (a goal handle) and must return a\n   * {@link CancelResponse} value.\n   *\n   * There can only be one cancel callback per {@link ActionServer}, therefore calling this\n   * function will replace any previously registered callback.\n   * @param {function} cancelCallback - Callback function, if not provided,\n   * then unregisters any previously registered callback.\n   * @returns {undefined}\n   */\n  registerCancelCallback(cancelCallback) {\n    this._cancelCallback = cancelCallback || defaultCancelCallback;\n  }\n\n  /**\n   * Register a callback for executing action goals.\n   *\n   * The purpose of the execute callback is to execute the action goal and return a result when finished.\n   * The callback should take one parameter containing goal request and must return a\n   * result instance (i.e. `action_type.Result`).\n   *\n   * There can only be one execute callback per {@link ActionServer}, therefore calling this\n   * function will replace any previously registered callback.\n   *\n   * @param {function} executeCallback - Callback function.\n   * @returns {undefined}\n   */\n  registerExecuteCallback(executeCallback) {\n    if (typeof executeCallback !== 'function') {\n      throw new TypeValidationError(\n        'executeCallback',\n        executeCallback,\n        'function',\n        {\n          entityType: 'action server',\n          entityName: this._actionName,\n        }\n      );\n    }\n\n    this._callback = executeCallback;\n  }\n\n  notifyExecute(goalHandle, callback) {\n    if (!callback && !this._callback) {\n      return;\n    }\n\n    this._executeGoal(callback || this._callback, goalHandle);\n  }\n\n  _sendResultResponse(header, result) {\n    rclnodejs.actionSendResultResponse(this.handle, header, result.serialize());\n  }\n\n  _executeGoalRequest(header, request) {\n    let goalUuid = request.goal_id;\n    let goalInfo = new ActionInterfaces.GoalInfo();\n    goalInfo['goal_id'] = goalUuid;\n\n    // Initialize the stamp (otherwise we will get an error when we serialize the message)\n    goalInfo.stamp = {\n      sec: 0,\n      nanosec: 0,\n    };\n\n    this._node.getLogger().debug(`New goal request with ID: ${goalUuid.uuid}`);\n\n    let goalIdExists = rclnodejs.actionServerGoalExists(\n      this._handle,\n      goalInfo.serialize()\n    );\n\n    let accepted = false;\n    if (!goalIdExists) {\n      let result = this._goalCallback(\n        request.goal.toPlainObject(this.typedArrayEnabled)\n      );\n\n      accepted = result === GoalResponse.ACCEPT;\n    }\n\n    let goalHandle;\n    if (accepted) {\n      // Stamp time of acceptance\n      const { seconds, nanoseconds } = this._node\n        .getClock()\n        .now().secondsAndNanoseconds;\n      goalInfo.stamp = {\n        sec: Number(seconds),\n        nanosec: Number(nanoseconds),\n      };\n\n      try {\n        goalHandle = new ServerGoalHandle(this, goalInfo, request.goal);\n      } catch (error) {\n        this._node\n          .getLogger()\n          .error(\n            `Failed to accept new goal with ID ${goalUuid.uuid}: ${error}`\n          );\n        accepted = false;\n      }\n\n      if (accepted) {\n        let uuid = ActionUuid.fromBytes(goalUuid.uuid).toString();\n        this._goalHandles.set(uuid, goalHandle);\n      }\n    }\n\n    // Send response\n    let response = new this.typeClass.impl.SendGoalService.Response();\n    response.accepted = accepted;\n    response.stamp = goalInfo.stamp;\n\n    rclnodejs.actionSendGoalResponse(\n      this._handle,\n      header,\n      response.serialize()\n    );\n\n    if (!accepted) {\n      this._node.getLogger().debug(`New goal rejected: ${goalUuid.uuid}`);\n      return;\n    }\n\n    this._node.getLogger().debug(`New goal accepted: ${goalUuid.uuid}`);\n\n    this._handleAcceptedCallback(goalHandle);\n  }\n\n  async _executeCancelRequest(header, request) {\n    let Response = this.typeClass.impl.CancelGoal.Response;\n    let response = new Response();\n\n    this._node.getLogger().debug(`Cancel request received: ${request}`);\n\n    // Get list of goals that are requested to be canceled\n    const msgHandle = rclnodejs.actionProcessCancelRequest(\n      this.handle,\n      request.serialize(),\n      response.toRawROS()\n    );\n    let cancelResponse = new Response();\n    cancelResponse.deserialize(response.refObject);\n\n    let goalsCanceling = [];\n    for (let goalInfo of cancelResponse.goals_canceling.data) {\n      let uuid = ActionUuid.fromBytes(goalInfo.goal_id.uuid).toString();\n      // Possibly the user doesn't care to track the goal handle\n      if (this._goalHandles.has(uuid)) {\n        let goalHandle = this._goalHandles.get(uuid);\n        let result = await this._cancelCallback(goalHandle);\n\n        if (result === CancelResponse.ACCEPT) {\n          // Notify goal handle\n          goalHandle._updateState(GoalEvent.CANCEL_GOAL);\n          goalsCanceling.push(goalInfo);\n        }\n      }\n    }\n\n    cancelResponse['goals_canceling'] = goalsCanceling;\n    rclnodejs.actionSendCancelResponse(\n      this.handle,\n      header,\n      cancelResponse.serialize()\n    );\n\n    msgHandle.release();\n  }\n\n  async _executeGoal(callback, goalHandle) {\n    const goalUuid = goalHandle.goalId.uuid;\n    this._node.getLogger().debug(`Executing goal with ID ${goalUuid}`);\n\n    let result;\n    try {\n      result = await callback(goalHandle);\n    } catch (error) {\n      // Create an empty result so that we can still send a response to the client\n      result = new this.typeClass.Result();\n\n      this._node\n        .getLogger()\n        .error(`Error raised in execute callback: ${error}`);\n    }\n\n    // If user did not trigger a terminal state, assume aborted\n    if (goalHandle.isActive) {\n      this._node\n        .getLogger()\n        .warn(`Goal state not set, assuming aborted. Goal ID: ${goalUuid}`);\n      goalHandle.abort();\n    }\n\n    this._node\n      .getLogger()\n      .debug(\n        `Goal with ID ${goalUuid} finished with state ${goalHandle.status}`\n      );\n\n    // Set result\n    let response = new this.typeClass.impl.GetResultService.Response();\n    response.status = goalHandle.status;\n    response.result = result;\n\n    goalHandle._deferred.setResult(response);\n  }\n\n  _executeGetResultRequest(header, request) {\n    let uuid = ActionUuid.fromBytes(request.goal_id.uuid).toString();\n\n    this._node\n      .getLogger()\n      .debug(\n        `Result request received for goal with ID: ${request.goal_id.uuid}`\n      );\n\n    // If no goal with the requested ID exists, then return UNKNOWN status\n    if (!this._goalHandles.has(uuid)) {\n      this._node\n        .getLogger()\n        .debug(\n          `Sending result response for unknown goal ID: ${request.goal_id.uuid}`\n        );\n\n      let response = new this.typeClass.impl.GetResultService.Response();\n      response.status = ActionInterfaces.GoalStatus.STATUS_UNKNOWN;\n      rclnodejs.actionSendResultResponse(\n        this.handle,\n        header,\n        response.serialize()\n      );\n      return;\n    }\n\n    this._goalHandles\n      .get(uuid)\n      ._deferred.setDoneCallback((result) =>\n        this._sendResultResponse(header, result)\n      );\n  }\n\n  _executeExpiredGoals(result, count) {\n    for (let i = 0; i < count; i++) {\n      const goalInfo = new ActionInterfaces.GoalInfo();\n      goalInfo.deserialize(result._refArray[i]);\n\n      let uuid = ActionUuid.fromBytes(goalInfo.goal_id.uuid).toString();\n      this._goalHandles.delete(uuid);\n    }\n  }\n\n  /**\n   * Destroy the action server and all goals.\n   * @return {undefined}\n   */\n  destroy() {\n    this._node._destroyEntity('actionServers', this);\n  }\n\n  /**\n   * Finalize action destruction after registry removal.\n   * @ignore\n   */\n  finalizeDestruction() {\n    if (this.isDestroyed()) {\n      return;\n    }\n\n    for (let goalHandle of Array.from(this._goalHandles.values())) {\n      goalHandle.destroy();\n    }\n\n    this._goalHandles.clear();\n\n    super.finalizeDestruction();\n  }\n\n  configureIntrospection(clock, qos, introspectionState) {\n    if (DistroUtils.getDistroId() <= DistroUtils.getDistroId('jazzy')) {\n      console.warn(\n        'Configure action server introspection is not supported by this version of ROS 2'\n      );\n      return;\n    }\n\n    let type = this.typeClass.type();\n    rclnodejs.configureActionServerIntrospection(\n      this.handle,\n      this._node.handle,\n      clock.handle,\n      type.interfaceName,\n      type.pkgName,\n      qos,\n      introspectionState\n    );\n  }\n}\n\nexport default ActionServer;\n","// Copyright (c) 2026, The Robot Web Tools Contributors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/**\n * Aggregated endpoint information for one action client or server.\n */\nclass ActionEndpointInfo {\n  /**\n   * @param {object} info - Raw endpoint information from the native layer.\n   * @hideconstructor\n   */\n  constructor(info) {\n    this._goalServiceInfo = info.goal_service_info;\n    this._cancelServiceInfo = info.cancel_service_info;\n    this._resultServiceInfo = info.result_service_info;\n    this._feedbackTopicInfo = info.feedback_topic_info;\n    this._statusTopicInfo = info.status_topic_info;\n  }\n\n  /**\n   * @type {object}\n   */\n  get goalServiceInfo() {\n    return this._goalServiceInfo;\n  }\n\n  /**\n   * @type {object}\n   */\n  get cancelServiceInfo() {\n    return this._cancelServiceInfo;\n  }\n\n  /**\n   * @type {object}\n   */\n  get resultServiceInfo() {\n    return this._resultServiceInfo;\n  }\n\n  /**\n   * @type {object}\n   */\n  get feedbackTopicInfo() {\n    return this._feedbackTopicInfo;\n  }\n\n  /**\n   * @type {object}\n   */\n  get statusTopicInfo() {\n    return this._statusTopicInfo;\n  }\n\n  /**\n   * @type {string}\n   */\n  get nodeName() {\n    return this._goalServiceInfo.node_name;\n  }\n\n  /**\n   * @type {string}\n   */\n  get nodeNamespace() {\n    return this._goalServiceInfo.node_namespace;\n  }\n\n  /**\n   * @type {string}\n   */\n  get actionType() {\n    return this._goalServiceInfo.service_type.replace(/_SendGoal$/, '');\n  }\n\n  /**\n   * @type {number}\n   */\n  get endpointType() {\n    return this._goalServiceInfo.endpoint_type;\n  }\n}\n\nexport default ActionEndpointInfo;\n","// Copyright (c) 2020 Matt Richard. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport rclnodejs from '../native_loader.js';\n\n/**\n * Get a list of action names and types for action clients associated with a node.\n * @param {Node} node - The node used for discovery.\n * @param {string} nodeName - The name of a remote node to get action clients for.\n * @param {string} namespace - Namespace of the remote node.\n * @return {array} - An array of the names and types.\n */\nfunction getActionClientNamesAndTypesByNode(node, nodeName, namespace) {\n  return rclnodejs.actionGetClientNamesAndTypesByNode(\n    node.handle,\n    nodeName,\n    namespace\n  );\n}\n\n/**\n * Get a list of action names and types for action servers associated with a node.\n * @param {Node} node - The node used for discovery.\n * @param {string} nodeName - The name of a remote node to get action servers for.\n * @param {string} namespace - Namespace of the remote node.\n * @return {array} - An array of the names and types.\n */\nfunction getActionServerNamesAndTypesByNode(node, nodeName, namespace) {\n  return rclnodejs.actionGetServerNamesAndTypesByNode(\n    node.handle,\n    nodeName,\n    namespace\n  );\n}\n\n/**\n * Get a list of action names and types.\n * @param {Node} node - The node used for discovery.\n * @return {array} - An array of the names and types.\n */\nfunction getActionNamesAndTypes(node) {\n  return rclnodejs.actionGetNamesAndTypes(node.handle);\n}\n\nexport {\n  getActionClientNamesAndTypesByNode,\n  getActionServerNamesAndTypesByNode,\n  getActionNamesAndTypes,\n};\n","// Copyright (c) 2023 Wayne Parrott. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/**\n * @typedef {number} ServiceIntrospectionState\n **/\n\n/**\n * Enum for service introspection states.\n * @readonly\n * @enum {ServiceIntrospectionState}\n */\nconst ServiceIntrospectionStates = {\n  OFF: 0,\n  METADATA: 1,\n  CONTENTS: 2,\n};\n\nexport default ServiceIntrospectionStates;\n","// Copyright (c) 2025, The Robot Web Tools Contributors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport rclnodejs from './native_loader.js';\nimport { TypeValidationError } from './errors.js';\n\nclass Serialization {\n  /**\n   * Serialize a message to a buffer.\n   * @param {object} message - The message to serialize.\n   * @param {function} typeClass - The class of the message type to serialize.\n   * @return {Buffer} The serialized message as a Buffer.\n   */\n  static serializeMessage(message, typeClass) {\n    if (!(message instanceof typeClass)) {\n      throw new TypeValidationError('message', message, typeClass.name, {\n        entityType: 'serializer',\n      });\n    }\n    return rclnodejs.serialize(\n      typeClass.type().pkgName,\n      typeClass.type().subFolder,\n      typeClass.type().interfaceName,\n      message.serialize()\n    );\n  }\n\n  /**\n   * Deserialize a message from a buffer.\n   * @param {Buffer} buffer - The buffer containing the serialized message.\n   * @param {function} typeClass - The class of the message type to deserialize into.\n   * @return {object} The deserialized message object.\n   */\n  static deserializeMessage(buffer, typeClass) {\n    if (!(buffer instanceof Buffer)) {\n      throw new TypeValidationError('buffer', buffer, 'Buffer', {\n        entityType: 'serializer',\n      });\n    }\n    const rosMsg = new typeClass();\n    rclnodejs.deserialize(\n      typeClass.type().pkgName,\n      typeClass.type().subFolder,\n      typeClass.type().interfaceName,\n      buffer,\n      rosMsg.toRawROS()\n    );\n    return rosMsg;\n  }\n}\n\nexport default Serialization;\nexport const { serializeMessage, deserializeMessage } = Serialization;\n","// Copyright (c) 2025 Mahmoud Alghalayini. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {\n  Parameter,\n  ParameterType,\n  parameterTypeFromValue,\n} from './parameter.js';\nimport {\n  TypeValidationError,\n  ParameterNotFoundError,\n  OperationError,\n} from './errors.js';\nimport validator from './validator.js';\nimport { normalizeNodeName } from './utils.js';\nimport createDebug from 'debug';\nconst debug = createDebug('rclnodejs:parameter_client');\n\n/**\n * @class - Class representing a Parameter Client for accessing parameters on remote nodes\n * @hideconstructor\n */\nclass ParameterClient {\n  #node;\n  #remoteNodeName;\n  #timeout;\n  #clients;\n  #destroyed;\n\n  /**\n   * Create a ParameterClient instance.\n   * @param {Node} node - The node to use for creating service clients.\n   * @param {string} remoteNodeName - The name of the remote node whose parameters to access.\n   * @param {object} [options] - Options for parameter client.\n   * @param {number} [options.timeout=5000] - Default timeout in milliseconds for service calls.\n   */\n  constructor(node, remoteNodeName, options = {}) {\n    if (!node) {\n      throw new TypeValidationError('node', node, 'Node instance');\n    }\n    if (!remoteNodeName || typeof remoteNodeName !== 'string') {\n      throw new TypeValidationError(\n        'remoteNodeName',\n        remoteNodeName,\n        'non-empty string'\n      );\n    }\n\n    this.#node = node;\n    this.#remoteNodeName = normalizeNodeName(remoteNodeName);\n    validator.validateNodeName(this.#remoteNodeName);\n\n    this.#timeout = options.timeout || 5000;\n    this.#clients = new Map();\n    this.#destroyed = false;\n\n    debug(\n      `ParameterClient created for remote node: ${this.#remoteNodeName} with timeout: ${this.#timeout}ms`\n    );\n  }\n\n  /**\n   * Get the remote node name this client is connected to.\n   * @return {string} - The remote node name.\n   */\n  get remoteNodeName() {\n    return this.#remoteNodeName;\n  }\n\n  /**\n   * Get a single parameter from the remote node.\n   * @param {string} name - The name of the parameter to retrieve.\n   * @param {object} [options] - Options for the service call.\n   * @param {number} [options.timeout] - Timeout in milliseconds for this specific call.\n   * @param {AbortSignal} [options.signal] - AbortSignal to cancel the request.\n   * @return {Promise<Parameter>} - Promise that resolves with the Parameter object.\n   * @throws {Error} If the parameter is not found or service call fails.\n   */\n  async getParameter(name, options = {}) {\n    this.#throwErrorIfClientDestroyed();\n\n    const parameters = await this.getParameters([name], options);\n    if (parameters.length === 0) {\n      throw new ParameterNotFoundError(name, this.#remoteNodeName);\n    }\n\n    return parameters[0];\n  }\n\n  /**\n   * Get multiple parameters from the remote node.\n   * @param {string[]} names - Array of parameter names to retrieve.\n   * @param {object} [options] - Options for the service call.\n   * @param {number} [options.timeout] - Timeout in milliseconds for this specific call.\n   * @param {AbortSignal} [options.signal] - AbortSignal to cancel the request.\n   * @return {Promise<Parameter[]>} - Promise that resolves with an array of Parameter objects.\n   * @throws {Error} If the service call fails.\n   */\n  async getParameters(names, options = {}) {\n    this.#throwErrorIfClientDestroyed();\n\n    if (!Array.isArray(names) || names.length === 0) {\n      throw new TypeValidationError('names', names, 'non-empty array');\n    }\n\n    const client = this.#getOrCreateClient('GetParameters');\n    const request = { names };\n\n    debug(\n      `Getting ${names.length} parameter(s) from node ${this.#remoteNodeName}`\n    );\n\n    const response = await client.sendRequestAsync(request, {\n      timeout: options.timeout || this.#timeout,\n      signal: options.signal,\n    });\n\n    const parameters = [];\n    for (let i = 0; i < names.length; i++) {\n      const value = response.values[i];\n      if (value.type !== ParameterType.PARAMETER_NOT_SET) {\n        parameters.push(\n          new Parameter(\n            names[i],\n            value.type,\n            this.#deserializeParameterValue(value)\n          )\n        );\n      }\n    }\n\n    debug(`Retrieved ${parameters.length} parameter(s)`);\n    return parameters;\n  }\n\n  /**\n   * Set a single parameter on the remote node.\n   * @param {string} name - The name of the parameter to set.\n   * @param {*} value - The value to set. Type is automatically inferred.\n   * @param {object} [options] - Options for the service call.\n   * @param {number} [options.timeout] - Timeout in milliseconds for this specific call.\n   * @param {AbortSignal} [options.signal] - AbortSignal to cancel the request.\n   * @return {Promise<object>} - Promise that resolves with the result {successful: boolean, reason: string}.\n   * @throws {Error} If the service call fails.\n   */\n  async setParameter(name, value, options = {}) {\n    this.#throwErrorIfClientDestroyed();\n\n    const results = await this.setParameters([{ name, value }], options);\n    return results[0];\n  }\n\n  /**\n   * Set multiple parameters on the remote node.\n   * @param {Array<{name: string, value: *}>} parameters - Array of parameter objects with name and value.\n   * @param {object} [options] - Options for the service call.\n   * @param {number} [options.timeout] - Timeout in milliseconds for this specific call.\n   * @param {AbortSignal} [options.signal] - AbortSignal to cancel the request.\n   * @return {Promise<Array<{name: string, successful: boolean, reason: string}>>} - Promise that resolves with an array of results.\n   * @throws {Error} If the service call fails.\n   */\n  async setParameters(parameters, options = {}) {\n    this.#throwErrorIfClientDestroyed();\n\n    if (!Array.isArray(parameters) || parameters.length === 0) {\n      throw new TypeValidationError(\n        'parameters',\n        parameters,\n        'non-empty array'\n      );\n    }\n\n    const client = this.#getOrCreateClient('SetParameters');\n    const request = {\n      parameters: parameters.map((param) => ({\n        name: param.name,\n        value: this.#serializeParameterValue(param.value),\n      })),\n    };\n\n    debug(\n      `Setting ${parameters.length} parameter(s) on node ${this.#remoteNodeName}`\n    );\n\n    const response = await client.sendRequestAsync(request, {\n      timeout: options.timeout || this.#timeout,\n      signal: options.signal,\n    });\n\n    const results = response.results.map((result, index) => ({\n      name: parameters[index].name,\n      successful: result.successful,\n      reason: result.reason || '',\n    }));\n\n    debug(\n      `Set ${results.filter((r) => r.successful).length}/${results.length} parameter(s) successfully`\n    );\n    return results;\n  }\n\n  /**\n   * List all parameters available on the remote node.\n   * @param {object} [options] - Options for listing parameters.\n   * @param {string[]} [options.prefixes] - Optional array of parameter name prefixes to filter by.\n   * @param {number} [options.depth=0] - Depth of parameter namespace to list (0 = unlimited).\n   * @param {number} [options.timeout] - Timeout in milliseconds for this specific call.\n   * @param {AbortSignal} [options.signal] - AbortSignal to cancel the request.\n   * @return {Promise<{names: string[], prefixes: string[]}>} - Promise that resolves with parameter names and prefixes.\n   * @throws {Error} If the service call fails.\n   */\n  async listParameters(options = {}) {\n    this.#throwErrorIfClientDestroyed();\n\n    const client = this.#getOrCreateClient('ListParameters');\n    const request = {\n      prefixes: options.prefixes || [],\n      depth: options.depth !== undefined ? BigInt(options.depth) : BigInt(0),\n    };\n\n    debug(`Listing parameters on node ${this.#remoteNodeName}`);\n\n    const response = await client.sendRequestAsync(request, {\n      timeout: options.timeout || this.#timeout,\n      signal: options.signal,\n    });\n\n    debug(\n      `Listed ${response.result.names.length} parameter(s) and ${response.result.prefixes.length} prefix(es)`\n    );\n\n    return {\n      names: response.result.names || [],\n      prefixes: response.result.prefixes || [],\n    };\n  }\n\n  /**\n   * Describe parameters on the remote node.\n   * @param {string[]} names - Array of parameter names to describe.\n   * @param {object} [options] - Options for the service call.\n   * @param {number} [options.timeout] - Timeout in milliseconds for this specific call.\n   * @param {AbortSignal} [options.signal] - AbortSignal to cancel the request.\n   * @return {Promise<Array<object>>} - Promise that resolves with an array of parameter descriptors.\n   * @throws {Error} If the service call fails.\n   */\n  async describeParameters(names, options = {}) {\n    this.#throwErrorIfClientDestroyed();\n\n    if (!Array.isArray(names) || names.length === 0) {\n      throw new TypeValidationError('names', names, 'non-empty array');\n    }\n\n    const client = this.#getOrCreateClient('DescribeParameters');\n    const request = { names };\n\n    debug(\n      `Describing ${names.length} parameter(s) on node ${this.#remoteNodeName}`\n    );\n\n    const response = await client.sendRequestAsync(request, {\n      timeout: options.timeout || this.#timeout,\n      signal: options.signal,\n    });\n\n    debug(`Described ${response.descriptors.length} parameter(s)`);\n    return response.descriptors || [];\n  }\n\n  /**\n   * Get the types of parameters on the remote node.\n   * @param {string[]} names - Array of parameter names.\n   * @param {object} [options] - Options for the service call.\n   * @param {number} [options.timeout] - Timeout in milliseconds for this specific call.\n   * @param {AbortSignal} [options.signal] - AbortSignal to cancel the request.\n   * @return {Promise<Array<number>>} - Promise that resolves with an array of parameter types.\n   * @throws {Error} If the service call fails.\n   */\n  async getParameterTypes(names, options = {}) {\n    this.#throwErrorIfClientDestroyed();\n\n    if (!Array.isArray(names) || names.length === 0) {\n      throw new TypeValidationError('names', names, 'non-empty array');\n    }\n\n    const client = this.#getOrCreateClient('GetParameterTypes');\n    const request = { names };\n\n    debug(\n      `Getting types for ${names.length} parameter(s) on node ${this.#remoteNodeName}`\n    );\n\n    const response = await client.sendRequestAsync(request, {\n      timeout: options.timeout || this.#timeout,\n      signal: options.signal,\n    });\n\n    return response.types || [];\n  }\n\n  /**\n   * Wait for the parameter services to be available on the remote node.\n   * @param {number} [timeout] - Optional timeout in milliseconds.\n   * @return {Promise<boolean>} - Promise that resolves to true if services are available.\n   */\n  async waitForService(timeout) {\n    this.#throwErrorIfClientDestroyed();\n\n    const client = this.#getOrCreateClient('GetParameters');\n    return await client.waitForService(timeout);\n  }\n\n  /**\n   * Check if the parameter client has been destroyed.\n   * @return {boolean} - True if destroyed, false otherwise.\n   */\n  isDestroyed() {\n    return this.#destroyed;\n  }\n\n  /**\n   * Destroy the parameter client and clean up all service clients.\n   * @return {undefined}\n   */\n  destroy() {\n    if (this.#destroyed) {\n      return;\n    }\n\n    debug(`Destroying ParameterClient for node ${this.#remoteNodeName}`);\n\n    for (const [serviceType, client] of this.#clients.entries()) {\n      try {\n        this.#node.destroyClient(client);\n        debug(`Destroyed client for service type: ${serviceType}`);\n      } catch (error) {\n        debug(\n          `Error destroying client for service type ${serviceType}:`,\n          error\n        );\n      }\n    }\n\n    this.#clients.clear();\n    this.#destroyed = true;\n\n    debug('ParameterClient destroyed');\n  }\n\n  /**\n   * Get or create a service client for the specified service type.\n   * @private\n   * @param {string} serviceType - The service type (e.g., 'GetParameters', 'SetParameters').\n   * @return {Client} - The service client.\n   */\n  #getOrCreateClient(serviceType) {\n    if (this.#clients.has(serviceType)) {\n      return this.#clients.get(serviceType);\n    }\n\n    const serviceName = `/${this.#remoteNodeName}/${this.#toSnakeCase(serviceType)}`;\n    const serviceInterface = `rcl_interfaces/srv/${serviceType}`;\n\n    debug(`Creating client for service: ${serviceName}`);\n\n    const client = this.#node.createClient(serviceInterface, serviceName);\n    this.#clients.set(serviceType, client);\n\n    return client;\n  }\n\n  /**\n   * Serialize a JavaScript value to a ParameterValue message.\n   * @private\n   * @param {*} value - The value to serialize.\n   * @return {object} - The ParameterValue message.\n   */\n  #serializeParameterValue(value) {\n    const type = parameterTypeFromValue(value);\n\n    const paramValue = {\n      type,\n      bool_value: false,\n      integer_value: BigInt(0),\n      double_value: 0.0,\n      string_value: '',\n      byte_array_value: [],\n      bool_array_value: [],\n      integer_array_value: [],\n      double_array_value: [],\n      string_array_value: [],\n    };\n\n    switch (type) {\n      case ParameterType.PARAMETER_BOOL:\n        paramValue.bool_value = value;\n        break;\n      case ParameterType.PARAMETER_INTEGER:\n        paramValue.integer_value =\n          typeof value === 'bigint' ? value : BigInt(value);\n        break;\n      case ParameterType.PARAMETER_DOUBLE:\n        paramValue.double_value = value;\n        break;\n      case ParameterType.PARAMETER_STRING:\n        paramValue.string_value = value;\n        break;\n      case ParameterType.PARAMETER_BOOL_ARRAY:\n        paramValue.bool_array_value = Array.from(value);\n        break;\n      case ParameterType.PARAMETER_INTEGER_ARRAY:\n        paramValue.integer_array_value = Array.from(value).map((v) =>\n          typeof v === 'bigint' ? v : BigInt(v)\n        );\n        break;\n      case ParameterType.PARAMETER_DOUBLE_ARRAY:\n        paramValue.double_array_value = Array.from(value);\n        break;\n      case ParameterType.PARAMETER_STRING_ARRAY:\n        paramValue.string_array_value = Array.from(value);\n        break;\n      case ParameterType.PARAMETER_BYTE_ARRAY:\n        paramValue.byte_array_value = Array.from(value).map((v) =>\n          Math.trunc(v)\n        );\n        break;\n    }\n\n    return paramValue;\n  }\n\n  /**\n   * Deserialize a ParameterValue message to a JavaScript value.\n   * @private\n   * @param {object} paramValue - The ParameterValue message.\n   * @return {*} - The deserialized value.\n   */\n  #deserializeParameterValue(paramValue) {\n    switch (paramValue.type) {\n      case ParameterType.PARAMETER_BOOL:\n        return paramValue.bool_value;\n      case ParameterType.PARAMETER_INTEGER:\n        return paramValue.integer_value;\n      case ParameterType.PARAMETER_DOUBLE:\n        return paramValue.double_value;\n      case ParameterType.PARAMETER_STRING:\n        return paramValue.string_value;\n      case ParameterType.PARAMETER_BYTE_ARRAY:\n        return Array.from(paramValue.byte_array_value || []);\n      case ParameterType.PARAMETER_BOOL_ARRAY:\n        return Array.from(paramValue.bool_array_value || []);\n      case ParameterType.PARAMETER_INTEGER_ARRAY:\n        return Array.from(paramValue.integer_array_value || []).map((v) =>\n          typeof v === 'bigint' ? v : BigInt(v)\n        );\n      case ParameterType.PARAMETER_DOUBLE_ARRAY:\n        return Array.from(paramValue.double_array_value || []);\n      case ParameterType.PARAMETER_STRING_ARRAY:\n        return Array.from(paramValue.string_array_value || []);\n      case ParameterType.PARAMETER_NOT_SET:\n      default:\n        return null;\n    }\n  }\n\n  /**\n   * Convert a service type name from PascalCase to snake_case.\n   * @private\n   * @param {string} name - The name to convert.\n   * @return {string} - The snake_case name.\n   */\n  #toSnakeCase(name) {\n    return name.replace(/[A-Z]/g, (letter, index) => {\n      return index === 0 ? letter.toLowerCase() : '_' + letter.toLowerCase();\n    });\n  }\n\n  /**\n   * Throws an error if the client has been destroyed.\n   * @private\n   * @throws {Error} If the client has been destroyed.\n   */\n  #throwErrorIfClientDestroyed() {\n    if (this.#destroyed) {\n      throw new OperationError('ParameterClient has been destroyed', {\n        code: 'CLIENT_DESTROYED',\n        entityType: 'parameter_client',\n        entityName: this.#remoteNodeName,\n      });\n    }\n  }\n}\n\nexport default ParameterClient;\n","// Copyright (c) 2026, The Robot Web Tools Contributors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { TypeValidationError, OperationError } from './errors.js';\nimport { normalizeNodeName } from './utils.js';\nimport validator from './validator.js';\nimport createDebug from 'debug';\nconst debug = createDebug('rclnodejs:parameter_event_handler');\n\nconst PARAMETER_EVENT_MSG_TYPE = 'rcl_interfaces/msg/ParameterEvent';\nconst PARAMETER_EVENT_TOPIC = '/parameter_events';\n\n/**\n * @class ParameterCallbackHandle\n * Opaque handle returned when adding a parameter callback.\n * Used to remove the callback later.\n */\nclass ParameterCallbackHandle {\n  /**\n   * @param {string} parameterName - The parameter name\n   * @param {string} nodeName - The fully qualified node name\n   * @param {Function} callback - The callback function\n   * @hideconstructor\n   */\n  constructor(parameterName, nodeName, callback) {\n    this.parameterName = parameterName;\n    this.nodeName = nodeName;\n    this.callback = callback;\n  }\n}\n\n/**\n * @class ParameterEventCallbackHandle\n * Opaque handle returned when adding a parameter event callback.\n * Used to remove the callback later.\n */\nclass ParameterEventCallbackHandle {\n  /**\n   * @param {Function} callback - The callback function\n   * @hideconstructor\n   */\n  constructor(callback) {\n    this.callback = callback;\n  }\n}\n\n/**\n * @class ParameterEventHandler\n *\n * Monitors and responds to parameter changes on any node in the ROS 2 graph\n * by subscribing to the `/parameter_events` topic.\n *\n * Unlike {@link ParameterWatcher}, which is tied to a single remote node and\n * requires waiting for that node's parameter services, ParameterEventHandler\n * responds to parameter events from any node without needing service availability.\n *\n * Two types of callbacks are supported:\n * - **Parameter callbacks**: fired when a specific parameter on a specific node\n *   is added or changed (new_parameters + changed_parameters).\n *   Note: deleted parameters are not dispatched to parameter callbacks;\n *   use event callbacks to observe deletions.\n * - **Event callbacks**: fired for every ParameterEvent message received,\n *   including deletions.\n *\n * @example\n * const handler = node.createParameterEventHandler();\n *\n * // Watch a specific parameter on a specific node\n * const handle = handler.addParameterCallback(\n *   'my_param',\n *   '/my_node',\n *   (parameter) => {\n *     console.log(`Parameter changed: ${parameter.name} = ${parameter.value}`);\n *   }\n * );\n *\n * // Watch all parameter events\n * const eventHandle = handler.addParameterEventCallback((event) => {\n *   console.log(`Event from node: ${event.node}`);\n * });\n *\n * // Remove callbacks when done\n * handler.removeParameterCallback(handle);\n * handler.removeParameterEventCallback(eventHandle);\n *\n * // Destroy when no longer needed\n * handler.destroy();\n */\nclass ParameterEventHandler {\n  #node;\n  #subscription;\n  #parameterCallbacks; // Map<string, ParameterCallbackHandle[]> keyed by \"paramName\\0nodeName\"\n  #eventCallbacks; // ParameterEventCallbackHandle[]\n  #destroyed;\n\n  /**\n   * Create a ParameterEventHandler.\n   *\n   * @param {object} node - The rclnodejs Node used to create the subscription\n   * @param {object} [options] - Options\n   * @param {object} [options.qos] - QoS profile for the parameter_events subscription\n   */\n  constructor(node, options = {}) {\n    if (!node || typeof node.createSubscription !== 'function') {\n      throw new TypeValidationError('node', node, 'Node instance', {\n        entityType: 'parameter event handler',\n      });\n    }\n\n    if (\n      options !== undefined &&\n      options !== null &&\n      typeof options !== 'object'\n    ) {\n      throw new TypeValidationError('options', options, 'object or undefined', {\n        entityType: 'parameter event handler',\n      });\n    }\n\n    const opts = options || {};\n\n    this.#node = node;\n    this.#parameterCallbacks = new Map();\n    this.#eventCallbacks = [];\n    this.#destroyed = false;\n\n    const subscriptionOptions = opts.qos ? { qos: opts.qos } : undefined;\n\n    this.#subscription = node.createSubscription(\n      PARAMETER_EVENT_MSG_TYPE,\n      PARAMETER_EVENT_TOPIC,\n      subscriptionOptions,\n      (event) => this.#handleEvent(event)\n    );\n\n    debug('Created ParameterEventHandler on node=%s', node.name());\n  }\n\n  /**\n   * Add a callback for a specific parameter on a specific node.\n   *\n   * The callback is invoked whenever the named parameter is added or changed\n   * on the specified node. The callback receives the parameter message object\n   * (rcl_interfaces/msg/Parameter) with `name` and `value` fields.\n   *\n   * @param {string} parameterName - Name of the parameter to monitor\n   * @param {string} nodeName - Fully qualified name of the node (e.g., '/my_node')\n   * @param {Function} callback - Called with (parameter) when the parameter changes\n   * @returns {ParameterCallbackHandle} Handle for removing this callback later\n   * @throws {Error} If the handler has been destroyed\n   * @throws {TypeError} If arguments are invalid\n   */\n  addParameterCallback(parameterName, nodeName, callback) {\n    this.#checkNotDestroyed();\n\n    if (typeof parameterName !== 'string' || parameterName.trim() === '') {\n      throw new TypeValidationError(\n        'parameterName',\n        parameterName,\n        'non-empty string',\n        { entityType: 'parameter event handler' }\n      );\n    }\n\n    if (typeof nodeName !== 'string' || nodeName.trim() === '') {\n      throw new TypeValidationError('nodeName', nodeName, 'non-empty string', {\n        entityType: 'parameter event handler',\n      });\n    }\n\n    if (typeof callback !== 'function') {\n      throw new TypeValidationError('callback', callback, 'function', {\n        entityType: 'parameter event handler',\n      });\n    }\n\n    const resolvedNodeName = normalizeNodeName(nodeName);\n    const resolvedParamName = parameterName.trim();\n    const handle = new ParameterCallbackHandle(\n      resolvedParamName,\n      resolvedNodeName,\n      callback\n    );\n    const key = this.#makeKey(resolvedParamName, resolvedNodeName);\n\n    if (!this.#parameterCallbacks.has(key)) {\n      this.#parameterCallbacks.set(key, []);\n    }\n\n    // Insert at front (FILO order, matching rclpy behavior)\n    this.#parameterCallbacks.get(key).unshift(handle);\n\n    debug(\n      'Added parameter callback: param=%s node=%s',\n      resolvedParamName,\n      resolvedNodeName\n    );\n\n    return handle;\n  }\n\n  /**\n   * Configure which node parameter events will be received.\n   *\n   * If nodeNames is omitted or empty, the current node filter is cleared.\n   * When a filter is active, parameter and event callbacks only receive\n   * events from the specified nodes.\n   *\n   * @param {string[]} [nodeNames] - Node names to filter parameter events from.\n   *   Relative names are resolved against the handler node namespace.\n   * @returns {boolean} True if the filter is active or was successfully cleared.\n   */\n  configureNodesFilter(nodeNames) {\n    this.#checkNotDestroyed();\n\n    if (nodeNames === undefined || nodeNames === null) {\n      this.#subscription.clearContentFilter();\n      return !this.#subscription.hasContentFilter();\n    }\n\n    if (!Array.isArray(nodeNames)) {\n      throw new TypeValidationError('nodeNames', nodeNames, 'string[]', {\n        entityType: 'parameter event handler',\n      });\n    }\n\n    if (nodeNames.length === 0) {\n      this.#subscription.clearContentFilter();\n      return !this.#subscription.hasContentFilter();\n    }\n\n    const resolvedNodeNames = nodeNames.map((nodeName, index) => {\n      if (typeof nodeName !== 'string' || nodeName.trim() === '') {\n        throw new TypeValidationError(\n          `nodeNames[${index}]`,\n          nodeName,\n          'non-empty string',\n          {\n            entityType: 'parameter event handler',\n          }\n        );\n      }\n\n      const resolvedNodeName = this.#resolvePath(nodeName.trim());\n      this.#validateFullyQualifiedNodePath(resolvedNodeName);\n      return resolvedNodeName;\n    });\n\n    const contentFilter = {\n      expression: resolvedNodeNames\n        .map((_, index) => `node = %${index}`)\n        .join(' OR '),\n      parameters: resolvedNodeNames.map((nodeName) => `'${nodeName}'`),\n    };\n\n    this.#subscription.setContentFilter(contentFilter);\n    return this.#subscription.hasContentFilter();\n  }\n\n  /**\n   * Remove a previously added parameter callback.\n   *\n   * @param {ParameterCallbackHandle} handle - The handle returned by addParameterCallback\n   * @throws {Error} If the handle is not found or handler is destroyed\n   */\n  removeParameterCallback(handle) {\n    this.#checkNotDestroyed();\n\n    if (!(handle instanceof ParameterCallbackHandle)) {\n      throw new TypeValidationError(\n        'handle',\n        handle,\n        'ParameterCallbackHandle',\n        { entityType: 'parameter event handler' }\n      );\n    }\n\n    const key = this.#makeKey(handle.parameterName, handle.nodeName);\n    const callbacks = this.#parameterCallbacks.get(key);\n\n    if (!callbacks) {\n      throw new OperationError(\n        `No callbacks registered for parameter '${handle.parameterName}' on node '${handle.nodeName}'`,\n        { entityType: 'parameter event handler' }\n      );\n    }\n\n    const index = callbacks.indexOf(handle);\n    if (index === -1) {\n      throw new OperationError(\"Callback doesn't exist\", {\n        entityType: 'parameter event handler',\n      });\n    }\n\n    callbacks.splice(index, 1);\n\n    if (callbacks.length === 0) {\n      this.#parameterCallbacks.delete(key);\n    }\n\n    debug(\n      'Removed parameter callback: param=%s node=%s',\n      handle.parameterName,\n      handle.nodeName\n    );\n  }\n\n  /**\n   * Add a callback that is invoked for every parameter event.\n   *\n   * The callback receives the full ParameterEvent message\n   * (rcl_interfaces/msg/ParameterEvent) with `node`, `new_parameters`,\n   * `changed_parameters`, and `deleted_parameters` fields.\n   *\n   * @param {Function} callback - Called with (event) for every ParameterEvent\n   * @returns {ParameterEventCallbackHandle} Handle for removing this callback later\n   * @throws {Error} If the handler has been destroyed\n   * @throws {TypeError} If callback is not a function\n   */\n  addParameterEventCallback(callback) {\n    this.#checkNotDestroyed();\n\n    if (typeof callback !== 'function') {\n      throw new TypeValidationError('callback', callback, 'function', {\n        entityType: 'parameter event handler',\n      });\n    }\n\n    const handle = new ParameterEventCallbackHandle(callback);\n\n    // Insert at front (FILO order)\n    this.#eventCallbacks.unshift(handle);\n\n    debug('Added parameter event callback');\n\n    return handle;\n  }\n\n  /**\n   * Remove a previously added parameter event callback.\n   *\n   * @param {ParameterEventCallbackHandle} handle - The handle returned by addParameterEventCallback\n   * @throws {Error} If the handle is not found or handler is destroyed\n   */\n  removeParameterEventCallback(handle) {\n    this.#checkNotDestroyed();\n\n    if (!(handle instanceof ParameterEventCallbackHandle)) {\n      throw new TypeValidationError(\n        'handle',\n        handle,\n        'ParameterEventCallbackHandle',\n        { entityType: 'parameter event handler' }\n      );\n    }\n\n    const index = this.#eventCallbacks.indexOf(handle);\n    if (index === -1) {\n      throw new OperationError(\"Callback doesn't exist\", {\n        entityType: 'parameter event handler',\n      });\n    }\n\n    this.#eventCallbacks.splice(index, 1);\n\n    debug('Removed parameter event callback');\n  }\n\n  /**\n   * Check if the handler has been destroyed.\n   *\n   * @returns {boolean} True if destroyed\n   */\n  isDestroyed() {\n    return this.#destroyed;\n  }\n\n  /**\n   * Destroy the handler and clean up resources.\n   * Removes the subscription and clears all callbacks.\n   */\n  destroy() {\n    if (this.#destroyed) {\n      return;\n    }\n\n    debug('Destroying ParameterEventHandler');\n\n    if (this.#subscription) {\n      try {\n        this.#node.destroySubscription(this.#subscription);\n      } catch (error) {\n        debug('Error destroying subscription: %s', error.message);\n      }\n      this.#subscription = null;\n    }\n\n    this.#parameterCallbacks.clear();\n    this.#eventCallbacks.length = 0;\n    this.#destroyed = true;\n  }\n\n  /**\n   * Get a specific parameter from a ParameterEvent message.\n   *\n   * @param {object} event - A ParameterEvent message\n   * @param {string} parameterName - The parameter name to look for\n   * @param {string} nodeName - The node name to match\n   * @returns {object|null} The matching parameter message, or null\n   * @static\n   */\n  static getParameterFromEvent(event, parameterName, nodeName) {\n    const resolvedNodeName = normalizeNodeName(nodeName);\n    const resolvedParamName = (parameterName || '').trim();\n\n    if (normalizeNodeName(event.node) !== resolvedNodeName) {\n      return null;\n    }\n\n    const allParams = [\n      ...(event.new_parameters || []),\n      ...(event.changed_parameters || []),\n    ];\n\n    for (const param of allParams) {\n      if (param.name === resolvedParamName) {\n        return param;\n      }\n    }\n\n    return null;\n  }\n\n  /**\n   * Get all parameters from a ParameterEvent message (new + changed).\n   *\n   * @param {object} event - A ParameterEvent message\n   * @returns {object[]} Array of parameter messages\n   * @static\n   */\n  static getParametersFromEvent(event) {\n    return [\n      ...(event.new_parameters || []),\n      ...(event.changed_parameters || []),\n    ];\n  }\n\n  /**\n   * Handle incoming parameter event.\n   * @private\n   */\n  #handleEvent(event) {\n    const eventNodeName = normalizeNodeName(event.node);\n\n    // Dispatch parameter-specific callbacks by iterating event params\n    // and doing direct Map lookups (O(event_params) instead of O(registered_callbacks))\n    const allParams = [\n      ...(event.new_parameters || []),\n      ...(event.changed_parameters || []),\n    ];\n\n    for (const parameter of allParams) {\n      const key = this.#makeKey(parameter.name, eventNodeName);\n      const callbacks = this.#parameterCallbacks.get(key);\n\n      if (callbacks) {\n        for (const handle of callbacks.slice()) {\n          try {\n            handle.callback(parameter);\n          } catch (err) {\n            debug(\n              'Error in parameter callback for %s on %s: %s',\n              parameter.name,\n              eventNodeName,\n              err.message\n            );\n          }\n        }\n      }\n    }\n\n    // Dispatch event-level callbacks\n    for (const handle of this.#eventCallbacks.slice()) {\n      try {\n        handle.callback(event);\n      } catch (err) {\n        debug('Error in parameter event callback: %s', err.message);\n      }\n    }\n  }\n\n  /**\n   * Create a map key from parameter name and node name.\n   * @private\n   */\n  #makeKey(paramName, nodeName) {\n    return `${paramName}\\0${nodeName}`;\n  }\n\n  /**\n   * Resolve a node path to the fully qualified name used in ParameterEvent.node.\n   * @private\n   */\n  #resolvePath(nodePath) {\n    // Absolute node paths are already rooted. Relative names are resolved\n    // against the handler node namespace before building the content filter.\n    const unresolvedPath = nodePath.startsWith('/')\n      ? nodePath\n      : `${this.#node.namespace().replace(/\\/+$/, '')}/${nodePath}`;\n\n    // Collapse repeated separators for inputs like '/ns//node/' or 'nested//node'.\n    const resolvedPath = unresolvedPath.replace(/\\/+/g, '/');\n\n    // Preserve the root namespace as '/' and strip trailing slashes everywhere\n    // else so the filter matches the canonical ParameterEvent.node format.\n    if (resolvedPath === '/') {\n      return resolvedPath;\n    }\n\n    return resolvedPath.replace(/\\/+$/, '');\n  }\n\n  /**\n   * Validate a fully qualified node path before using it in a content filter.\n   * @private\n   */\n  #validateFullyQualifiedNodePath(nodePath) {\n    const normalizedPath =\n      nodePath.length > 1 ? nodePath.replace(/\\/+$/, '') : nodePath;\n    const separatorIndex = normalizedPath.lastIndexOf('/');\n    const nodeNamespace =\n      separatorIndex === 0 ? '/' : normalizedPath.slice(0, separatorIndex);\n    const nodeName = normalizedPath.slice(separatorIndex + 1);\n\n    validator.validateNamespace(nodeNamespace);\n    validator.validateNodeName(nodeName);\n  }\n\n  /**\n   * Check if the handler has been destroyed and throw if so.\n   * @private\n   */\n  #checkNotDestroyed() {\n    if (this.#destroyed) {\n      throw new OperationError('ParameterEventHandler has been destroyed', {\n        entityType: 'parameter event handler',\n      });\n    }\n  }\n}\n\nexport default ParameterEventHandler;\nexport { ParameterCallbackHandle, ParameterEventCallbackHandle };\n","// Copyright (c) 2025 Mahmoud Alghalayini. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport EventEmitter from 'events';\nimport { TypeValidationError, OperationError } from './errors.js';\nimport { normalizeNodeName } from './utils.js';\nimport ParameterEventHandler from './parameter_event_handler.js';\nimport createDebug from 'debug';\nconst debug = createDebug('rclnodejs:parameter_watcher');\n\n/**\n * @class ParameterWatcher - Watches parameter changes on a remote node\n *\n * Subscribes to /parameter_events and emits 'change' events when\n * watched parameters on the target node are modified.\n *\n * @extends EventEmitter\n */\nclass ParameterWatcher extends EventEmitter {\n  #node;\n  #paramClient;\n  #eventHandler;\n  #watchedParams;\n  #remoteNodeName;\n  #destroyed;\n\n  /**\n   * Create a ParameterWatcher instance.\n   * Note: Use node.createParameterWatcher() instead of calling this directly.\n   *\n   * @param {object} node - The local rclnodejs Node instance\n   * @param {string} remoteNodeName - Name of the remote node to watch\n   * @param {string[]} parameterNames - Array of parameter names to watch\n   * @param {object} [options] - Options for the parameter client\n   * @param {number} [options.timeout=5000] - Default timeout for parameter operations\n   * @hideconstructor\n   */\n  constructor(node, remoteNodeName, parameterNames, options = {}) {\n    super();\n\n    if (!node || typeof node.createParameterClient !== 'function') {\n      throw new TypeValidationError('node', node, 'Node instance', {\n        entityType: 'parameter watcher',\n      });\n    }\n\n    if (typeof remoteNodeName !== 'string' || remoteNodeName.trim() === '') {\n      throw new TypeValidationError(\n        'remoteNodeName',\n        remoteNodeName,\n        'non-empty string',\n        {\n          entityType: 'parameter watcher',\n        }\n      );\n    }\n\n    if (!Array.isArray(parameterNames) || parameterNames.length === 0) {\n      throw new TypeValidationError(\n        'parameterNames',\n        parameterNames,\n        'non-empty array',\n        {\n          entityType: 'parameter watcher',\n        }\n      );\n    }\n\n    this.#node = node;\n    this.#watchedParams = new Set(parameterNames);\n    this.#paramClient = node.createParameterClient(remoteNodeName, options);\n    // Cache the remote node name for error messages (in case paramClient is destroyed)\n    this.#remoteNodeName = this.#paramClient.remoteNodeName;\n    this.#eventHandler = null;\n    this.#destroyed = false;\n\n    debug(\n      'Created ParameterWatcher for node=%s, params=%o',\n      remoteNodeName,\n      parameterNames\n    );\n  }\n\n  /**\n   * Get the remote node name being watched.\n   * @type {string}\n   * @readonly\n   */\n  get remoteNodeName() {\n    return this.#remoteNodeName;\n  }\n\n  /**\n   * Get the list of watched parameter names.\n   * @type {string[]}\n   * @readonly\n   */\n  get watchedParameters() {\n    return Array.from(this.#watchedParams);\n  }\n\n  /**\n   * Start watching for parameter changes.\n   * Waits for the remote node's parameter services and subscribes to parameter events.\n   *\n   * @param {number} [timeout=5000] - Timeout in milliseconds to wait for services\n   * @returns {Promise<boolean>} Resolves to true when watching has started\n   * @throws {Error} If the watcher has been destroyed\n   */\n  async start(timeout = 5000) {\n    this.#checkNotDestroyed();\n\n    debug('Starting ParameterWatcher for node=%s', this.remoteNodeName);\n\n    const available = await this.#paramClient.waitForService(timeout);\n\n    if (!available) {\n      debug(\n        'Parameter services not available for node=%s',\n        this.remoteNodeName\n      );\n      return false;\n    }\n\n    if (!this.#eventHandler) {\n      this.#eventHandler = new ParameterEventHandler(this.#node);\n      this.#eventHandler.addParameterEventCallback((event) =>\n        this.#handleParameterEvent(event)\n      );\n\n      debug('Subscribed to /parameter_events via ParameterEventHandler');\n    }\n\n    return true;\n  }\n\n  /**\n   * Get current values of all watched parameters.\n   *\n   * @param {object} [options] - Options for the parameter client\n   * @param {number} [options.timeout] - Timeout in milliseconds\n   * @param {AbortSignal} [options.signal] - AbortSignal for cancellation\n   * @returns {Promise<Parameter[]>} Array of Parameter objects\n   * @throws {Error} If the watcher has been destroyed\n   */\n  async getCurrentValues(options) {\n    this.#checkNotDestroyed();\n    return await this.#paramClient.getParameters(\n      Array.from(this.#watchedParams),\n      options\n    );\n  }\n\n  /**\n   * Add a parameter name to the watch list.\n   *\n   * @param {string} name - Parameter name to watch\n   * @throws {TypeError} If name is not a string\n   * @throws {Error} If the watcher has been destroyed\n   */\n  addParameter(name) {\n    this.#checkNotDestroyed();\n\n    if (typeof name !== 'string' || name.trim() === '') {\n      throw new TypeValidationError('name', name, 'non-empty string', {\n        entityType: 'parameter watcher',\n        entityName: this.remoteNodeName,\n      });\n    }\n\n    const wasAdded = !this.#watchedParams.has(name);\n    this.#watchedParams.add(name);\n\n    if (wasAdded) {\n      debug('Added parameter to watch list: %s', name);\n    }\n  }\n\n  /**\n   * Remove a parameter name from the watch list.\n   *\n   * @param {string} name - Parameter name to stop watching\n   * @returns {boolean} True if the parameter was in the watch list\n   * @throws {Error} If the watcher has been destroyed\n   */\n  removeParameter(name) {\n    this.#checkNotDestroyed();\n\n    const wasRemoved = this.#watchedParams.delete(name);\n\n    if (wasRemoved) {\n      debug('Removed parameter from watch list: %s', name);\n    }\n\n    return wasRemoved;\n  }\n\n  /**\n   * Check if the watcher has been destroyed.\n   *\n   * @returns {boolean} True if destroyed\n   */\n  isDestroyed() {\n    return this.#destroyed;\n  }\n\n  /**\n   * Destroy the watcher and clean up resources.\n   * Unsubscribes from parameter events and destroys the parameter client.\n   */\n  destroy() {\n    if (this.#destroyed) {\n      return;\n    }\n\n    debug('Destroying ParameterWatcher for node=%s', this.remoteNodeName);\n\n    if (this.#eventHandler) {\n      try {\n        this.#eventHandler.destroy();\n      } catch (error) {\n        debug('Error destroying event handler: %s', error.message);\n      }\n      this.#eventHandler = null;\n    }\n\n    if (this.#paramClient) {\n      try {\n        this.#node.destroyParameterClient(this.#paramClient);\n      } catch (error) {\n        debug('Error destroying parameter client: %s', error.message);\n      }\n      this.#paramClient = null;\n    }\n\n    this.removeAllListeners();\n\n    this.#destroyed = true;\n  }\n\n  /**\n   * Handle parameter event from /parameter_events topic.\n   * @private\n   */\n  #handleParameterEvent(event) {\n    if (normalizeNodeName(event.node) !== this.remoteNodeName) {\n      return;\n    }\n\n    const relevantChanges = [];\n\n    if (event.new_parameters) {\n      const newParams = event.new_parameters.filter((p) =>\n        this.#watchedParams.has(p.name)\n      );\n      relevantChanges.push(...newParams);\n    }\n\n    if (event.changed_parameters) {\n      const changedParams = event.changed_parameters.filter((p) =>\n        this.#watchedParams.has(p.name)\n      );\n      relevantChanges.push(...changedParams);\n    }\n\n    if (event.deleted_parameters) {\n      const deletedParams = event.deleted_parameters.filter((p) =>\n        this.#watchedParams.has(p.name)\n      );\n      relevantChanges.push(...deletedParams);\n    }\n\n    if (relevantChanges.length > 0) {\n      debug(\n        'Parameter change detected: %o',\n        relevantChanges.map((p) => p.name)\n      );\n      this.emit('change', relevantChanges);\n    }\n  }\n\n  /**\n   * Check if the watcher has been destroyed and throw if so.\n   * @private\n   */\n  #checkNotDestroyed() {\n    if (this.#destroyed) {\n      throw new OperationError('ParameterWatcher has been destroyed', {\n        code: 'WATCHER_DESTROYED',\n        entityType: 'parameter watcher',\n        entityName: this.remoteNodeName,\n      });\n    }\n  }\n}\n\nexport default ParameterWatcher;\n","// Copyright (c) 2026, The Robot Web Tools Contributors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { TimeoutError } from './errors.js';\n\n/**\n * Wait for a single message on a topic.\n *\n * Creates a temporary subscription, waits for the first message to arrive,\n * and returns it. The temporary subscription is always cleaned up, even on\n * timeout or error. The node must be spinning before calling this function.\n *\n * This is the rclnodejs equivalent of rclpy's `wait_for_message`.\n *\n * @param {function|string|object} typeClass - The ROS message type class.\n * @param {Node} node - The node to create the temporary subscription on.\n * @param {string} topic - The topic name to listen on.\n * @param {object} [options] - Options.\n * @param {number} [options.timeout] - Timeout in milliseconds. If omitted, waits indefinitely.\n * @param {object} [options.qos] - QoS profile for the subscription.\n * @returns {Promise<object>} - Resolves with the received message.\n * @throws {Error} If timeout expires before a message arrives.\n *\n * @example\n * node.spin();\n * const msg = await waitForMessage(\n *   'std_msgs/msg/String',\n *   node,\n *   '/my_topic',\n *   { timeout: 5000 }\n * );\n * console.log('Received:', msg.data);\n */\nfunction waitForMessage(typeClass, node, topic, options = {}) {\n  return new Promise((resolve, reject) => {\n    let subscription = null;\n    let timer = null;\n    let settled = false;\n\n    const cleanup = () => {\n      if (timer) {\n        clearTimeout(timer);\n        timer = null;\n      }\n      if (subscription) {\n        try {\n          node.destroySubscription(subscription);\n        } catch {\n          // Subscription may already be destroyed if node is shutting down\n        }\n        subscription = null;\n      }\n    };\n\n    const settle = (err, msg) => {\n      if (settled) return;\n      settled = true;\n      cleanup();\n      if (err) {\n        reject(err);\n      } else {\n        resolve(msg);\n      }\n    };\n\n    try {\n      const subOptions = {};\n      if (options.qos) {\n        subOptions.qos = options.qos;\n      }\n\n      subscription = node.createSubscription(\n        typeClass,\n        topic,\n        subOptions,\n        (msg) => {\n          settle(null, msg);\n        }\n      );\n\n      if (options.timeout != null && options.timeout >= 0) {\n        timer = setTimeout(() => {\n          settle(\n            new TimeoutError(\n              `waitForMessage timed out after ${options.timeout}ms on topic '${topic}'`,\n              { entityType: 'topic', entityName: topic }\n            )\n          );\n        }, options.timeout);\n      }\n    } catch (err) {\n      cleanup();\n      reject(err);\n    }\n  });\n}\n\nexport default waitForMessage;\n","// Copyright (c) 2025 Mahmoud Alghalayini. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport loader from './interface_loader.js';\nimport { toPlainObject } from '../rosidl_gen/message_translator.cjs';\nimport { TypeValidationError } from './errors.js';\n\n/**\n * A utility class for inspecting ROS 2 message structure without using loader.loadInterface directly.\n * Provides access to message schema, field names, and default values.\n */\nclass MessageIntrospector {\n  #typeClass;\n  #typeName;\n  #defaultsCache;\n\n  /**\n   * Create a new MessageIntrospector for a ROS 2 message type.\n   * @param {string} typeName - The full message type name (e.g., 'geometry_msgs/msg/Twist')\n   * @throws {TypeValidationError} If typeName is not a non-empty string\n   * @throws {Error} If the message type cannot be loaded\n   */\n  constructor(typeName) {\n    if (!typeName || typeof typeName !== 'string') {\n      throw new TypeValidationError('typeName', typeName, 'non-empty string', {\n        entityType: 'MessageIntrospector',\n      });\n    }\n    this.#typeName = typeName;\n    this.#typeClass = loader.loadInterface(typeName);\n    this.#defaultsCache = null;\n  }\n\n  /**\n   * Get the full message type name.\n   * @returns {string} The message type name (e.g., 'geometry_msgs/msg/Twist')\n   */\n  get typeName() {\n    return this.#typeName;\n  }\n\n  /**\n   * Get the underlying ROS message class.\n   * @returns {Function} The message type class constructor\n   */\n  get typeClass() {\n    return this.#typeClass;\n  }\n\n  /**\n   * Get the field names of the message.\n   * @returns {string[]} Array of field names\n   */\n  get fields() {\n    const def = this.#typeClass.ROSMessageDef;\n    return def.fields.map((f) => f.name);\n  }\n\n  /**\n   * Get the ROSMessageDef schema for the message type.\n   * @returns {object} The message definition schema\n   */\n  get schema() {\n    return this.#typeClass.ROSMessageDef;\n  }\n\n  /**\n   * Get the default values for all fields.\n   * Creates a new instance of the message and converts it to a plain object.\n   * Result is cached for performance.\n   * @returns {object} A plain object with all default values\n   */\n  get defaults() {\n    if (this.#defaultsCache === null) {\n      const instance = new this.#typeClass();\n      this.#defaultsCache = toPlainObject(instance);\n    }\n    return structuredClone(this.#defaultsCache);\n  }\n}\n\nexport default MessageIntrospector;\n","// Copyright (c) 2026, The Robot Web Tools Contributors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n/**\n * @class MessageInfo\n *\n * Contains metadata about a received message, including timestamps,\n * sequence numbers, and the publisher's globally unique identifier (GID).\n *\n * This is the rclnodejs equivalent of rclpy's MessageInfo.\n * It is passed as the second argument to subscription callbacks when the\n * callback accepts two parameters. Both deserialized and raw subscriptions\n * provide the same metadata; raw callbacks receive a Buffer as the first argument.\n *\n * @example\n * node.createSubscription(\n *   'std_msgs/msg/String',\n *   'topic',\n *   (msg, messageInfo) => {\n *     console.log('Source timestamp:', messageInfo.sourceTimestamp);\n *     console.log('Received at:', messageInfo.receivedTimestamp);\n *     console.log('Publisher GID:', messageInfo.publisherGid);\n *   }\n * );\n */\nclass MessageInfo {\n  /**\n   * Create a MessageInfo from a raw info object returned by the native layer.\n   *\n   * @param {object} rawInfo - Raw message info from rclTakeWithInfo or rclTakeRawWithInfo\n   * @hideconstructor\n   */\n  constructor(rawInfo) {\n    /**\n     * The timestamp when the message was published (nanoseconds since epoch).\n     * @type {bigint}\n     */\n    this.sourceTimestamp = rawInfo.source_timestamp;\n\n    /**\n     * The timestamp when the message was received by the subscription (nanoseconds since epoch).\n     * @type {bigint}\n     */\n    this.receivedTimestamp = rawInfo.received_timestamp;\n\n    /**\n     * The publication sequence number assigned by the publisher.\n     * @type {bigint}\n     */\n    this.publicationSequenceNumber = rawInfo.publication_sequence_number;\n\n    /**\n     * The reception sequence number assigned by the subscriber.\n     * @type {bigint}\n     */\n    this.receptionSequenceNumber = rawInfo.reception_sequence_number;\n\n    /**\n     * The globally unique identifier (GID) of the publisher.\n     * A Buffer containing the raw GID bytes.\n     * @type {Buffer}\n     */\n    this.publisherGid = rawInfo.publisher_gid;\n  }\n\n  /**\n   * Convert to a plain object representation.\n   *\n   * @returns {object} Plain object with all metadata fields\n   */\n  toPlainObject() {\n    return {\n      sourceTimestamp: this.sourceTimestamp,\n      receivedTimestamp: this.receivedTimestamp,\n      publicationSequenceNumber: this.publicationSequenceNumber,\n      receptionSequenceNumber: this.receptionSequenceNumber,\n      publisherGid: this.publisherGid,\n    };\n  }\n}\n\nexport default MessageInfo;\n","// Copyright (c) 2025 Mahmoud Alghalayini. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Subject } from 'rxjs';\n\n/**\n * A wrapper that provides RxJS Observable support for ROS 2 subscriptions.\n * This class wraps a standard Subscription and emits messages through an Observable.\n *\n * @class ObservableSubscription\n * @hideconstructor\n */\nclass ObservableSubscription {\n  #subscription;\n  #subject;\n  #destroyed;\n\n  /**\n   * Create an ObservableSubscription wrapper.\n   * @param {Subscription} subscription - The underlying ROS 2 subscription\n   */\n  constructor(subscription) {\n    this.#subscription = subscription;\n    this.#subject = new Subject();\n    this.#destroyed = false;\n  }\n\n  /**\n   * Get the RxJS Observable for this subscription.\n   * Use this to pipe operators and subscribe to messages.\n   * @type {Observable}\n   */\n  get observable() {\n    return this.#subject.asObservable();\n  }\n\n  /**\n   * Get the underlying ROS 2 subscription.\n   * @type {Subscription}\n   */\n  get subscription() {\n    return this.#subscription;\n  }\n\n  /**\n   * Get the topic name.\n   * @type {string}\n   */\n  get topic() {\n    return this.#subscription.topic;\n  }\n\n  /**\n   * Check if this observable subscription has been destroyed.\n   * @type {boolean}\n   */\n  get isDestroyed() {\n    return this.#destroyed;\n  }\n\n  /**\n   * Internal method to emit a message to subscribers.\n   * Called by the subscription's processResponse.\n   * @private\n   * @param {any} message - The message to emit\n   */\n  _emit(message) {\n    if (!this.#destroyed) {\n      this.#subject.next(message);\n    }\n  }\n\n  /**\n   * Complete the observable and clean up resources.\n   * After calling this, no more messages will be emitted.\n   */\n  complete() {\n    if (!this.#destroyed) {\n      this.#destroyed = true;\n      this.#subject.complete();\n    }\n  }\n\n  /**\n   * Alias for complete() for consistency with RxJS naming.\n   */\n  destroy() {\n    this.complete();\n  }\n}\n\nexport default ObservableSubscription;\n","// Copyright (c) 2017 Intel Corporation. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport rclnodejs from './native_loader.js';\nimport DistroUtils from './distro.js';\nimport Entity from './entity.js';\nimport { TypeValidationError, TimeoutError, AbortError } from './errors.js';\nimport { assertValidMessage } from './message_validation.js';\nimport createDebug from 'debug';\nconst debug = createDebug('rclnodejs:client');\n\n/**\n * @class - Class representing a Client in ROS\n * @hideconstructor\n */\n\nclass Client extends Entity {\n  constructor(handle, nodeHandle, serviceName, typeClass, options) {\n    super(handle, typeClass, options);\n    this._nodeHandle = nodeHandle;\n    this._serviceName = serviceName;\n    this._sequenceNumberToCallbackMap = new Map();\n    this._validateRequests = options.validateRequests || false;\n    this._validationOptions = options.validationOptions || {\n      strict: true,\n      checkTypes: true,\n    };\n  }\n\n  /**\n   * Whether requests will be validated before sending.\n   * @type {boolean}\n   */\n  get willValidateRequest() {\n    return this._validateRequests;\n  }\n\n  /**\n   * Enable or disable request validation for this client.\n   * @param {boolean} value - Whether to validate requests\n   */\n  set willValidateRequest(value) {\n    this._validateRequests = value;\n  }\n\n  /**\n   * Set validation options for this client.\n   * @param {object} options - Validation options\n   * @param {boolean} [options.strict=true] - Throw on unknown fields\n   * @param {boolean} [options.checkTypes=true] - Validate field types\n   */\n  setValidation(options) {\n    if (options && Object.keys(options).length > 0) {\n      this._validationOptions = { ...this._validationOptions, ...options };\n    }\n  }\n\n  /**\n   * This callback is called when a response is sent back from service\n   * @callback ResponseCallback\n   * @param {Object} response - The response sent from the service\n   * @see [Client.sendRequest]{@link Client#sendRequest}\n   * @see [Node.createService]{@link Node#createService}\n   * @see {@link Client}\n   * @see {@link Service}\n   */\n\n  /**\n   * Send the request and will be notified asynchronously if receiving the response.\n   * @param {object} request - The request to be submitted.\n   * @param {ResponseCallback} callback - Thc callback function for receiving the server response.\n   * @param {object} [options] - Send options\n   * @param {boolean} [options.validate] - Override validateRequests setting for this call\n   * @return {undefined}\n   * @throws {MessageValidationError} If validation is enabled and request is invalid\n   * @see {@link ResponseCallback}\n   */\n  sendRequest(request, callback, options = {}) {\n    if (typeof callback !== 'function') {\n      throw new TypeValidationError('callback', callback, 'function', {\n        entityType: 'service',\n        entityName: this._serviceName,\n      });\n    }\n\n    const shouldValidate =\n      options.validate !== undefined\n        ? options.validate\n        : this._validateRequests;\n\n    if (shouldValidate && !(request instanceof this._typeClass.Request)) {\n      assertValidMessage(\n        request,\n        this._typeClass.Request,\n        this._validationOptions\n      );\n    }\n\n    let requestToSend =\n      request instanceof this._typeClass.Request\n        ? request\n        : new this._typeClass.Request(request);\n\n    let rawRequest = requestToSend.serialize();\n    let sequenceNumber = rclnodejs.sendRequest(this._handle, rawRequest);\n    debug(`Client has sent a ${this._serviceName} request.`);\n    this._sequenceNumberToCallbackMap.set(sequenceNumber, callback);\n  }\n\n  /**\n   * Send the request and return a Promise that resolves with the response.\n   * @param {object} request - The request to be submitted.\n   * @param {object} [options] - Optional parameters for the request.\n   * @param {number} [options.timeout] - Timeout in milliseconds for the request.\n   * @param {AbortSignal} [options.signal] - AbortSignal to cancel the request.\n   * @param {boolean} [options.validate] - Override validateRequests setting for this call\n   * @return {Promise<object>} Promise that resolves with the service response.\n   * @throws {module:rclnodejs.TimeoutError} If the request times out (when options.timeout is exceeded).\n   * @throws {module:rclnodejs.AbortError} If the request is manually aborted (via options.signal).\n   * @throws {module:rclnodejs.MessageValidationError} If validation is enabled and request is invalid.\n   * @throws {Error} If the request fails for other reasons.\n   */\n  sendRequestAsync(request, options = {}) {\n    return new Promise((resolve, reject) => {\n      let sequenceNumber = null;\n      let isResolved = false;\n      let isTimeout = false;\n      let effectiveSignal = options.signal;\n      let timeoutSignal;\n\n      const onTimeout = () => {\n        isTimeout = true;\n      };\n\n      const cleanup = () => {\n        if (sequenceNumber !== null) {\n          this._sequenceNumberToCallbackMap.delete(sequenceNumber);\n        }\n        if (effectiveSignal) {\n          effectiveSignal.removeEventListener('abort', onAbort);\n        }\n        if (timeoutSignal) {\n          timeoutSignal.removeEventListener('abort', onTimeout);\n        }\n        isResolved = true;\n      };\n\n      const onAbort = () => {\n        if (!isResolved) {\n          cleanup();\n          const error = isTimeout\n            ? new TimeoutError('Service request', options.timeout, {\n                entityType: 'service',\n                entityName: this._serviceName,\n              })\n            : new AbortError('Service request', undefined, {\n                entityType: 'service',\n                entityName: this._serviceName,\n              });\n          reject(error);\n        }\n      };\n\n      if (options.timeout !== undefined && options.timeout >= 0) {\n        timeoutSignal = AbortSignal.timeout(options.timeout);\n\n        if (options.signal) {\n          effectiveSignal = AbortSignal.any([options.signal, timeoutSignal]);\n        } else {\n          effectiveSignal = timeoutSignal;\n        }\n\n        timeoutSignal.addEventListener('abort', onTimeout, { once: true });\n      }\n\n      if (effectiveSignal) {\n        if (effectiveSignal.aborted) {\n          onAbort();\n          return;\n        }\n\n        effectiveSignal.addEventListener('abort', onAbort, { once: true });\n      }\n\n      try {\n        const shouldValidate =\n          options.validate !== undefined\n            ? options.validate\n            : this._validateRequests;\n\n        if (shouldValidate && !(request instanceof this._typeClass.Request)) {\n          assertValidMessage(\n            request,\n            this._typeClass.Request,\n            this._validationOptions\n          );\n        }\n\n        let requestToSend =\n          request instanceof this._typeClass.Request\n            ? request\n            : new this._typeClass.Request(request);\n\n        let rawRequest = requestToSend.serialize();\n        sequenceNumber = rclnodejs.sendRequest(this._handle, rawRequest);\n\n        debug(`Client has sent a ${this._serviceName} request (async).`);\n\n        this._sequenceNumberToCallbackMap.set(sequenceNumber, (response) => {\n          if (!isResolved) {\n            cleanup();\n            resolve(response);\n          }\n        });\n      } catch (error) {\n        cleanup();\n        reject(error);\n      }\n    });\n  }\n\n  processResponse(sequenceNumber, response) {\n    if (this._sequenceNumberToCallbackMap.has(sequenceNumber)) {\n      debug(`Client has received ${this._serviceName} response from service.`);\n      let callback = this._sequenceNumberToCallbackMap.get(sequenceNumber);\n      this._sequenceNumberToCallbackMap.delete(sequenceNumber);\n      callback(response.toPlainObject(this.typedArrayEnabled));\n    } else {\n      debug(\n        `Client has received an unexpected ${this._serviceName} with sequence number ${sequenceNumber}.`\n      );\n    }\n  }\n\n  /**\n   * Checks if the service is available.\n   * @return {boolean} true if the service is available.\n   */\n  isServiceServerAvailable() {\n    return rclnodejs.serviceServerIsAvailable(this._nodeHandle, this.handle);\n  }\n\n  /**\n   * Wait until the service server is available or a timeout is reached. This\n   * function polls for the service state so it may not return as soon as the\n   * service is available.\n   * @param {number} timeout The maximum amount of time to wait for, if timeout\n   * is `undefined` or `< 0`, this will wait indefinitely.\n   * @return {Promise<boolean>} true if the service is available.\n   */\n  async waitForService(timeout = undefined) {\n    let deadline = Infinity;\n    if (timeout !== undefined && timeout >= 0) {\n      deadline = Date.now() + timeout;\n    }\n    let waitMs = 5;\n    let serviceAvailable = this.isServiceServerAvailable();\n    while (!serviceAvailable && Date.now() < deadline) {\n      waitMs *= 2;\n      waitMs = Math.min(waitMs, 1000);\n      if (timeout !== undefined && timeout >= -1) {\n        waitMs = Math.min(waitMs, deadline - Date.now());\n      }\n      await new Promise((resolve) => setTimeout(resolve, waitMs));\n      serviceAvailable = this.isServiceServerAvailable();\n    }\n    return serviceAvailable;\n  }\n\n  static createClient(nodeHandle, serviceName, typeClass, options) {\n    let type = typeClass.type();\n    let handle = rclnodejs.createClient(\n      nodeHandle,\n      serviceName,\n      type.interfaceName,\n      type.pkgName,\n      options.qos\n    );\n    return new Client(handle, nodeHandle, serviceName, typeClass, options);\n  }\n\n  /**\n   * @type {string}\n   */\n  get serviceName() {\n    return rclnodejs.getClientServiceName(this._handle);\n  }\n\n  /**\n   * Configure introspection.\n   * @param {Clock} clock - Clock to use for service event timestamps\n   * @param {QoS} qos - QoSProfile for the service event publisher\n   * @param {ServiceIntrospectionState} introspectionState - State to set introspection to\n   */\n  configureIntrospection(clock, qos, introspectionState) {\n    if (DistroUtils.getDistroId() <= DistroUtils.getDistroId('humble')) {\n      console.warn(\n        'Service introspection is not supported by this version of ROS 2'\n      );\n      return;\n    }\n\n    let type = this.typeClass.type();\n    rclnodejs.configureClientIntrospection(\n      this.handle,\n      this._nodeHandle,\n      clock.handle,\n      type.interfaceName,\n      type.pkgName,\n      qos,\n      introspectionState\n    );\n  }\n\n  /**\n   * Get the logger name for this client.\n   * @returns {string} The logger name for this client.\n   */\n  get loggerName() {\n    return rclnodejs.getNodeLoggerName(this._nodeHandle);\n  }\n}\n\nexport default Client;\n","// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport rclnodejs from './native_loader.js';\nimport Entity from './entity.js';\nimport Context from './context.js';\n\n/**\n * @class - Class representing a guard condition in ROS\n * @hideconstructor\n */\n\nclass GuardCondition extends Entity {\n  constructor(handle, callback) {\n    super(handle, null, null);\n\n    this._callback = callback;\n  }\n\n  get callback() {\n    return this._callback;\n  }\n\n  static createGuardCondition(callback, context = Context.defaultContext()) {\n    let handle = rclnodejs.createGuardCondition(context.handle);\n    return new GuardCondition(handle, callback);\n  }\n\n  /**\n   * Triggers the guard condition.\n   * @returns {undefined}\n   */\n  trigger() {\n    rclnodejs.triggerGuardCondition(this.handle);\n  }\n}\n\nexport default GuardCondition;\n","// Copyright (c) 2026, The Robot Web Tools Contributors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport Logging from './logging.js';\n\nconst LOGGING_SEVERITY_UNSET = 0;\n\n/**\n * Implements the ROS 2 logging service interfaces for a node.\n *\n * The interfaces implemented are:\n *  rcl_interfaces/srv/GetLoggerLevels\n *  rcl_interfaces/srv/SetLoggerLevels\n *\n * @class\n */\nclass LoggingService {\n  /**\n   * Create a new instance.\n   * @param {Node} node - The node these services support.\n   */\n  constructor(node) {\n    this._node = node;\n    this._isRunning = false;\n  }\n\n  /**\n   * Get the node this service supports.\n   * @return {Node} - The supported node.\n   */\n  get node() {\n    return this._node;\n  }\n\n  /**\n   * Check if logging services are configured and accepting requests.\n   * @return {boolean} - True if services are active; false otherwise.\n   */\n  isStarted() {\n    return this._isRunning;\n  }\n\n  /**\n   * Configure logging services and begin processing client requests.\n   * @return {undefined}\n   */\n  start() {\n    if (this._isRunning) return;\n\n    this._isRunning = true;\n    const nodeName = this.node.name();\n\n    this.node.createService(\n      'rcl_interfaces/srv/GetLoggerLevels',\n      nodeName + '/get_logger_levels',\n      (request, response) => this._handleGetLoggerLevels(request, response)\n    );\n\n    this.node.createService(\n      'rcl_interfaces/srv/SetLoggerLevels',\n      nodeName + '/set_logger_levels',\n      (request, response) => this._handleSetLoggerLevels(request, response)\n    );\n  }\n\n  _handleGetLoggerLevels(request, response) {\n    const msg = response.template;\n\n    for (const name of request.names) {\n      try {\n        msg.levels.push({\n          name,\n          level: Logging.getLogger(name).loggerEffectiveLevel,\n        });\n      } catch {\n        msg.levels.push({\n          name,\n          level: LOGGING_SEVERITY_UNSET,\n        });\n      }\n    }\n\n    response.send(msg);\n  }\n\n  _handleSetLoggerLevels(request, response) {\n    const msg = response.template;\n\n    for (const loggerLevel of request.levels) {\n      const result = {\n        successful: false,\n        reason: '',\n      };\n\n      try {\n        Logging.getLogger(loggerLevel.name).setLoggerLevel(loggerLevel.level);\n        result.successful = true;\n      } catch (error) {\n        result.reason = error.message;\n      }\n\n      msg.results.push(result);\n    }\n\n    response.send(msg);\n  }\n}\n\nexport default LoggingService;\n","// Copyright (c) 2020 Wayne Parrott. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Parameter, PARAMETER_SEPARATOR } from './parameter.js';\n\n/**\n * Implements the ros2 service interfaces for interacting with a node's parameters.\n *\n * The interfaces implemented are:\n *  rcl_interfaces/srv/ListParameters\n *  rcl_interfaces/srv/DescribeParameters\n *  rcl_interfaces/srv/GetParameters\n *  rcl_interfaces/srv/SetParameters\n *  rcl_interfaces/srv/SetParametersAtomically\n *  rcl_interfaces/srv/GetParameterTypes\n *\n * Call start() to begin receiving client request.\n * All service requests are forwarded to the node this service works for.\n * @class\n */\nclass ParameterService {\n  /**\n   * Create a new instance.\n   * @constructor\n   * @param {Node} node - The node these services will support.\n   */\n  constructor(node) {\n    this._node = node;\n    this._isRunning = false;\n  }\n\n  /**\n   * Get the node this\n   * @return {Node} - The supported node.\n   */\n  get node() {\n    return this._node;\n  }\n\n  /**\n   * Check if interface services are configured and accepting requests.\n   * @return {boolean} - True if services are active; false otherwise.\n   */\n  isStarted() {\n    return this._isRunning;\n  }\n\n  /**\n   * Configure parameter services and begin processing client requests.\n   * If this service is already started the request is ignored, i.e., a nop.\n   *\n   * @return {undefined}\n   */\n  start() {\n    // do nothing if service is already running\n    if (this._isRunning) return;\n\n    this._isRunning = true;\n    const nodeName = this.node.name();\n\n    // create ListParameters service\n    const listParametersServiceName = nodeName + '/list_parameters';\n    this.node.createService(\n      'rcl_interfaces/srv/ListParameters',\n      listParametersServiceName,\n      (request, response) => this._handleListParameters(request, response)\n    );\n\n    // create DescribeParameters service\n    const describeParametersServiceName = nodeName + '/describe_parameters';\n    this._node.createService(\n      'rcl_interfaces/srv/DescribeParameters',\n      describeParametersServiceName,\n      (request, response) => {\n        this._handleDescribeParameters(request, response);\n      }\n    );\n\n    // create GetParameters service\n    const getParametersServiceName = nodeName + '/get_parameters';\n    this._node.createService(\n      'rcl_interfaces/srv/GetParameters',\n      getParametersServiceName,\n      (request, response) => {\n        this._handleGetParameters(request, response);\n      }\n    );\n\n    // create SetParameters service\n    const setParametersServiceName = nodeName + '/set_parameters';\n    this._node.createService(\n      'rcl_interfaces/srv/SetParameters',\n      setParametersServiceName,\n      (request, response) => {\n        this._handleSetParameters(request, response);\n      }\n    );\n\n    // Create GetParameterTypes service.\n    const getParameterTypesServiceName = nodeName + '/get_parameter_types';\n    this._node.createService(\n      'rcl_interfaces/srv/GetParameterTypes',\n      getParameterTypesServiceName,\n      (request, response) => {\n        this._handleGetParameterTypes(request, response);\n      }\n    );\n\n    // create SetParametersAtomically service\n    const setParametersAtomicallyServiceName =\n      nodeName + '/set_parameters_atomically';\n    this._node.createService(\n      'rcl_interfaces/srv/SetParametersAtomically',\n      setParametersAtomicallyServiceName,\n      (request, response) => {\n        this._handleSetParametersAtomically(request, response);\n      }\n    );\n  }\n\n  /**\n   * Get a list of parameter names.\n   *\n   * The body of the response is a rcl_interfaces.msg.ListParametersResult.\n   *\n   * @param {ListParameters_Request} request - The client request.\n   * @param {ListParameters_Response} response - The service response with\n   *    a list of parameter names.\n   * @return {undefined} -\n   */\n  _handleListParameters(request, response) {\n    const DEPTH_RECURSIVE = 0;\n\n    let prefixedNames = [];\n    const parameterNames = this._node.getParameterNames();\n    const msg = response.template;\n    const result = msg.result;\n\n    for (const paramName of parameterNames) {\n      if (paramName.includes(PARAMETER_SEPARATOR)) {\n        prefixedNames.push(paramName);\n        continue;\n      } else if (request.prefixes.length > 0) {\n        for (const prefix of request.prefixes) {\n          if (paramName.startsWith(prefix)) {\n            result.names.push(paramName);\n            break;\n          }\n        }\n      } else {\n        result.names.push(paramName);\n      }\n    }\n\n    if (request.depth == 1) {\n      response.send(msg);\n      return;\n    }\n\n    if (request.depth != DEPTH_RECURSIVE) {\n      prefixedNames = prefixedNames.filter(\n        (name) => name.split(PARAMETER_SEPARATOR).length - 1 < request.depth\n      );\n    }\n\n    for (const paramName of prefixedNames) {\n      if (request.prefixes.length > 0) {\n        for (const prefix of request.prefixes) {\n          if (paramName.startsWith(prefix + PARAMETER_SEPARATOR)) {\n            result.names.push(paramName);\n\n            // drop the last segment of paramName to reveal a prefix\n            let fullPrefix = paramName.split(PARAMETER_SEPARATOR);\n            fullPrefix.pop();\n            fullPrefix = fullPrefix.join(PARAMETER_SEPARATOR);\n            if (!result.prefixes.includes(fullPrefix)) {\n              result.prefixes.push(fullPrefix);\n            }\n            if (!request.prefixes.includes(prefix)) {\n              result.prefixes.push(prefix);\n            }\n          }\n        }\n      } else {\n        result.names.push(paramName);\n\n        // drop the last segment of paramName to reveal a prefix\n        let prefix = paramName.split(PARAMETER_SEPARATOR);\n        prefix.pop();\n        prefix = prefix.join(PARAMETER_SEPARATOR);\n        if (!request.prefixes.includes(prefix)) {\n          result.prefixes.push(prefix);\n        }\n      }\n    }\n\n    response.send(msg);\n  }\n\n  /**\n   * Get a list of ParameterDescriptors.\n   *\n   * Request.names identifies the descriptors to get.\n   * If request.names is empty, get all descriptors.\n   * The body of the response is a rcl_interfaces.msg.DescribeParametersResult.\n   *\n   * @param {DescribeParameters_Request} request - The client request\n   * @param {DescribeParameters_Response} response - The server response with\n   *    an array of ParameterDescriptors.\n   * @return {undefined} -\n   */\n  _handleDescribeParameters(request, response) {\n    const names = request.names;\n\n    const msg = response.template; // ParameterDescriptor\n    if (names.length > 0) {\n      const descriptors = this._node.getParameterDescriptors(names);\n      msg.descriptors = descriptors.map((descriptor) => descriptor.toMessage());\n    }\n    response.send(msg);\n  }\n\n  /**\n   * Get a list of ParameterValue.\n   *\n   * request.names identifies the parameter values to get.\n   * If request.names is empty return the value of all parameters.\n   * The body of the response is a rcl_interfaces.msg.ParameterValue[].\n   *\n   * @param {GetParameters_Request} request - The client request.\n   * @param {GetParameters_Response} response - The service response with\n   *    an array of ParameterValue.\n   * @return {undefined} -\n   */\n  _handleGetParameters(request, response) {\n    const parameters = this._node.getParameters(request.names);\n\n    const msg = response.template;\n    msg.values = parameters.map((param) => param.toParameterValueMessage());\n    response.send(msg);\n  }\n\n  /**\n   * Update a list of parameters.\n   *\n   * Process each setParameter operation in the order defined by the request.\n   * The result is an rcl_interfaces.msg.SetParametersResult[], one result\n   * for each parameter.\n   *\n   * @param {SetParameters_Request} request - The client request.\n   * @param {SetParameters_Response} response - The service response\n   *    with a SetParametersResult[]\n   * @return {undefined} -\n   */\n  _handleSetParameters(request, response) {\n    const parameters = request.parameters.map((paramMsg) =>\n      Parameter.fromParameterMessage(paramMsg)\n    );\n\n    const msg = response.template;\n    msg.results = this._node.setParameters(parameters);\n    response.send(msg);\n  }\n\n  /**\n   * Get a list of parameter types.\n   *\n   * request.names identifies the parameter types to get.\n   *\n   * @param {GetParameterTypes_Request} request - The client request.\n   * @param {GetParameterTypes_Response} response - The service response with\n   *    Uint8Array.\n   * @return {undefined} -\n   */\n  _handleGetParameterTypes(request, response) {\n    const types = this._node.getParameterTypes(request.names);\n    const msg = response.template;\n    msg.types = types;\n    response.send(msg);\n  }\n\n  /**\n   * Update a list of parameters atomically.\n   *\n   * The body of the response is a rcl_interfaces.msg.SetParametersResult\n   *\n   * @param {SetParameters_Request} request - The client request.\n   * @param {SetParameters_Response} response - The service response\n   *    with a single SetParametersResult for the entire process.\n   * @return {undefined} -\n   */\n  _handleSetParametersAtomically(request, response) {\n    const parameters = request.parameters.map((paramMsg) =>\n      Parameter.fromParameterMessage(paramMsg)\n    );\n\n    const msg = response.template;\n    msg.result = this._node.setParametersAtomically(parameters);\n    response.send(msg);\n  }\n}\n\nexport default ParameterService;\n","// Copyright (c) 2017 Intel Corporation. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport rclnodejs from './native_loader.js';\nimport createDebug from 'debug';\nconst debug = createDebug('rclnodejs:publisher');\nimport Entity from './entity.js';\nimport { assertValidMessage } from './message_validation.js';\n\n/**\n * @class - Class representing a Publisher in ROS\n * @hideconstructor\n */\n\nclass Publisher extends Entity {\n  constructor(handle, typeClass, topic, options, node, eventCallbacks) {\n    super(handle, typeClass, options);\n    this._node = node;\n    this._validateMessages = options.validateMessages || false;\n    this._validationOptions = options.validationOptions || {\n      strict: true,\n      checkTypes: true,\n    };\n    if (node && eventCallbacks) {\n      this._events = eventCallbacks.createEventHandlers(this.handle);\n    }\n  }\n\n  /**\n   * @type {string}\n   */\n  get topic() {\n    return rclnodejs.getPublisherTopic(this._handle);\n  }\n\n  /**\n   * Publish a message\n   * @param {object|Buffer} message - The message to be sent, could be kind of JavaScript message generated from .msg\n   *                                  or be a Buffer for a raw message.\n   * @param {object} [options] - Publish options\n   * @param {boolean} [options.validate] - Override validateMessages setting for this publish call\n   * @return {undefined}\n   * @throws {MessageValidationError} If validation is enabled and message is invalid\n   */\n  publish(message, options = {}) {\n    if (message instanceof Buffer) {\n      rclnodejs.publishRawMessage(this._handle, message);\n    } else {\n      const shouldValidate =\n        options.validate !== undefined\n          ? options.validate\n          : this._validateMessages;\n\n      if (shouldValidate && !(message instanceof this._typeClass)) {\n        assertValidMessage(message, this._typeClass, this._validationOptions);\n      }\n\n      // Enables call by plain object/number/string argument\n      //  e.g. publisher.publish(3.14);\n      //       publisher.publish('The quick brown fox...');\n      //       publisher.publish({linear: {x: 0, y: 1, z: 2}, ...});\n      let messageToSend =\n        message instanceof this._typeClass\n          ? message\n          : new this._typeClass(message);\n      let rawMessage = messageToSend.serialize();\n      rclnodejs.publish(this._handle, rawMessage);\n    }\n\n    debug(`Message of topic ${this.topic} has been published.`);\n  }\n\n  /**\n   * Whether messages will be validated before publishing.\n   * @type {boolean}\n   */\n  get willValidateMessage() {\n    return this._validateMessages;\n  }\n\n  /**\n   * Enable or disable message validation for this publisher.\n   * @param {boolean} value - Whether to validate messages before publishing\n   */\n  set willValidateMessage(value) {\n    this._validateMessages = value;\n  }\n\n  /**\n   * Set validation options for this publisher.\n   * @param {object} options - Validation options\n   * @param {boolean} [options.strict=true] - Throw on unknown fields\n   * @param {boolean} [options.checkTypes=true] - Validate field types\n   * @param {boolean} [options.checkRequired=false] - Check for missing fields\n   */\n  setValidation(options) {\n    if (options && Object.keys(options).length > 0) {\n      this._validationOptions = { ...this._validationOptions, ...options };\n    }\n  }\n\n  static createPublisher(node, typeClass, topic, options, eventCallbacks) {\n    let type = typeClass.type();\n    let handle = rclnodejs.createPublisher(\n      node.handle,\n      type.pkgName,\n      type.subFolder,\n      type.interfaceName,\n      topic,\n      options.qos\n    );\n    return new Publisher(\n      handle,\n      typeClass,\n      topic,\n      options,\n      node,\n      eventCallbacks\n    );\n  }\n\n  /**\n   * Get the number of subscriptions to this publisher.\n   * @returns {number} The number of subscriptions\n   */\n  get subscriptionCount() {\n    return rclnodejs.getSubscriptionCount(this._handle);\n  }\n\n  /**\n   * Wait until all published message data is acknowledged or until the specified timeout elapses\n   *\n   * If the timeout is negative then this function will block indefinitely until all published\n   * message data is acknowledged.\n   * If the timeout is 0 then it will check if all published message has been acknowledged without\n   * waiting.\n   * If the timeout is greater than 0 then it will return after that period of time has elapsed or\n   * all published message data is acknowledged.\n   *\n   * Raises an error if failed, such as the middleware not supporting this feature.\n   *\n   * @param {timeout} timeout - The duration to wait for all published message data to be acknowledged in nanoseconds.\n   * @return {boolean} `true` if all published message data is acknowledged before the timeout, otherwise `false`.\n   */\n  waitForAllAcked(timeout) {\n    return rclnodejs.waitForAllAcked(this._handle, timeout);\n  }\n\n  /**\n   * Manually assert that this Publisher is alive (for RMW_QOS_POLICY_LIVELINESS_MANUAL_BY_TOPIC).\n   * @return {undefined}\n   */\n  assertLiveliness() {\n    rclnodejs.assertLiveliness(this._handle);\n  }\n\n  /**\n   * Get the event handlers for this publisher.\n   * @returns {Array} The array of event handlers for this publisher.\n   */\n  get events() {\n    return this._events;\n  }\n\n  /**\n   * Set the event handlers for this publisher.\n   * @param {Array} events - The array of event handlers to be set for this publisher.\n   */\n  set events(events) {\n    this._events = events;\n  }\n\n  /**\n   * Get the logger name for this publisher.\n   * @returns {string} The logger name for this publisher.\n   */\n  get loggerName() {\n    return rclnodejs.getNodeLoggerName(this._node.handle);\n  }\n}\n\nexport default Publisher;\n","// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport rclnodejs from '../index.js';\nimport Context from './context.js';\nimport NodeOptions from './node_options.js';\nimport { OperationError } from './errors.js';\n\nconst NOP_FN = () => {};\n\n/**\n * A timer that runs at a regular frequency (hz).\n *\n * A client calls Rate#sleep() to block until the end of the current cycle.\n * This makes Rate useful for looping at a regular frequency (hz). Rate#sleep()\n * avoids blocking the JS event-loop by returning a Promise that the caller\n * should block on, e.g. use 'await rate.sleep()'.\n *\n * Note that Rate.sleep() does not prevent rclnodejs from invoking callbacks\n * such as a subscription or client if the entity's node is spinning. Thus\n * if your intent is to use rate to synchronize when callbacks are invoked\n * then use a spinOnce() just after rate.sleep() as in the example below.\n *\n * Rate runs within it's own private rcl context. This enables it to be\n * available immediately after construction. That is, unlike Timer, Rate\n * does not require a spin or spinOnce to be active.\n *\n * @example\n * async function run() {\n *   await rclnodejs.init();\n *   const node = rclnodejs.createNode('mynode');\n *   const rate = await node.createRate(1); // 1 hz\n *   while (true) {\n *     doSomeStuff();\n *     await rate.sleep();\n *     rclnodejs.spinOnce(node);\n *   }\n * }\n */\nclass Rate {\n  /**\n   * Create a new instance.\n   * @hideconstructor\n   * @param {number} hz - The frequency (hz) between (0.0,1000] hz,\n   * @param {Timer} timer - The internal timer used by this instance.\n   *   default = 1 hz\n   */\n  constructor(hz, timer) {\n    this._hz = hz;\n    this._timer = timer;\n  }\n\n  /**\n   * Get the frequency in hertz (hz) of this timer.\n   *\n   * @returns {number} - hertz\n   */\n  get frequency() {\n    return this._hz;\n  }\n\n  /**\n   * Returns a Promise that when waited on, will block the sender\n   * until the end of the current timer cycle.\n   *\n   * If the Rate has been cancelled, calling this method will\n   * result in an error.\n   *\n   * @example\n   * (async () => {\n   *   await rate.sleep();\n   * })();\n   *\n   * @returns {Promise} - Waiting on the promise will delay the sender\n   * (not the Node event-loop) until the end of the current timer cycle.\n   */\n  async sleep() {\n    if (this.isCanceled()) {\n      throw new OperationError('Rate has been cancelled', {\n        code: 'RATE_CANCELLED',\n        entityType: 'rate',\n        details: { frequency: this._hz },\n      });\n    }\n\n    return new Promise((resolve) => {\n      this._timer.callback = () => {\n        this._timer.callback = NOP_FN;\n        resolve();\n      };\n    });\n  }\n\n  /**\n   * Permanently stops the timing behavior.\n   *\n   * @returns {undefined}\n   */\n  cancel() {\n    this._timer.cancel();\n  }\n\n  /**\n   * Determine if this rate has been cancelled.\n   *\n   * @returns {boolean} - True when cancel() has been called; False otherwise.\n   */\n  isCanceled() {\n    return this._timer.isCanceled();\n  }\n}\n\n/**\n * Internal class that creates Timer instances in a common private rcl context\n * for use with Rate. The private rcl context ensures that Rate timers do not\n * deadlock waiting for spinOnce/spin on the main rcl context.\n */\nclass RateTimerServer {\n  /**\n   * Create a new instance.\n   *\n   * @constructor\n   * @param {Node} parentNode - The parent node for which this server\n   *  supplies timers to.\n   */\n  constructor(parentNode) {\n    this._parentNode = parentNode;\n    this._context = new Context();\n  }\n\n  /**\n   * Setup the server's rcl context and node in preparation for creating\n   * rate timer instances.\n   *\n   * @returns {undefined}\n   */\n  async init() {\n    await rclnodejs.init(this._context);\n\n    // create hidden node\n    const nodeName = `_${this._parentNode.name()}_rate_timer_server`;\n    const nodeNamespace = this._parentNode.namespace();\n    const options = new NodeOptions();\n    options.startParameterServices = false;\n    options.parameterOverrides = this._parentNode.getParameters();\n    options.automaticallyDeclareParametersFromOverrides = true;\n\n    this._node = rclnodejs.createNode(\n      nodeName,\n      nodeNamespace,\n      this._context,\n      options\n    );\n\n    // spin node\n    rclnodejs.spin(this._node, 10);\n  }\n\n  /**\n   * Create a new timer instance with callback set to NOP.\n   *\n   * @param {bigint} period - The period in nanoseconds.\n   * @returns {Timer} - The new timer instance.\n   */\n  createTimer(period) {\n    const timer = this._node.createTimer(period, () => {});\n    return timer;\n  }\n\n  /**\n   * Permanently cancel all timers produced by this server and discontinue\n   * the ability to create new Timers.\n   *\n   * The private rcl context is shutdown in the process and may not be\n   * restarted.\n   *\n   * @returns {undefined}\n   */\n  shutdown() {\n    rclnodejs.shutdown(this._context);\n  }\n}\nexport { Rate, RateTimerServer };\n","// Copyright (c) 2017 Intel Corporation. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport rclnodejs from './native_loader.js';\nimport DistroUtils from './distro.js';\nimport Entity from './entity.js';\nimport Logging from './logging.js';\nimport createDebug from 'debug';\n\nconst debug = createDebug('rclnodejs:service');\n\n/**\n * The response to client\n *\n * @property {Object} template - Get an empty response object that is being sent to client.\n * @property {Service} service - The service that this response object is attaching to.\n *\n * @hideconstructor\n */\nclass Response {\n  constructor(service, header) {\n    this._service = service;\n    this._header = header;\n    this.sent = false;\n  }\n\n  get template() {\n    let response = new this._service._typeClass.Response();\n    return response.toPlainObject();\n  }\n\n  get service() {\n    return this._service;\n  }\n\n  /**\n   * Send response to client (the service caller)\n   * @param {object} response - The plain JavaScript representing the response.\n        Note: you can use .template to get an empty result object.\n   * @return {undefined}\n   * @see {@link Response#template}\n   */\n  send(response) {\n    let responseToReturn = new this._service._typeClass.Response(response);\n    const rawResponse = responseToReturn.serialize();\n    rclnodejs.sendResponse(this._service._handle, rawResponse, this._header);\n    this.sent = true;\n  }\n}\n\n/**\n * @class - Class representing a Service in ROS\n * @hideconstructor\n */\n\nclass Service extends Entity {\n  constructor(nodeHandle, handle, serviceName, typeClass, options, callback) {\n    super(handle, typeClass, options);\n    this._nodeHandle = nodeHandle;\n    this._callback = callback;\n  }\n\n  processRequest(headerHandle, request) {\n    debug(`Service has received a ${this._serviceName} request from client.`);\n\n    const plainObj = request.toPlainObject(this.typedArrayEnabled);\n    const response = new Response(this, headerHandle);\n    Promise.resolve(this._callback(plainObj, response))\n      .then((responseToReturn) => {\n        if (!response.sent && responseToReturn) {\n          responseToReturn = new this._typeClass.Response(responseToReturn);\n          const rawResponse = responseToReturn.serialize();\n          rclnodejs.sendResponse(this._handle, rawResponse, headerHandle);\n        }\n\n        debug(\n          `Service has processed the ${this._serviceName} request and sent the response.`\n        );\n      })\n      .catch((error) => {\n        const logger = Logging.getLogger('rclnodejs');\n        logger.error(`Error processing ${this._serviceName} request: ${error}`);\n      });\n  }\n\n  static createService(nodeHandle, serviceName, typeClass, options, callback) {\n    let type = typeClass.type();\n    let handle = rclnodejs.createService(\n      nodeHandle,\n      serviceName,\n      type.interfaceName,\n      type.pkgName,\n      options.qos\n    );\n    return new Service(\n      nodeHandle,\n      handle,\n      serviceName,\n      typeClass,\n      options,\n      callback\n    );\n  }\n\n  /**\n   * @type {string}\n   */\n  get serviceName() {\n    return rclnodejs.getServiceServiceName(this._handle);\n  }\n\n  /**\n   * Configure introspection.\n   * @param {Clock} clock - Clock to use for service event timestamps\n   * @param {QoS} qos - QoSProfile for the service event publisher\n   * @param {ServiceIntrospectionState} introspectionState - State to set introspection to\n   */\n  configureIntrospection(clock, qos, introspectionState) {\n    if (DistroUtils.getDistroId() <= DistroUtils.getDistroId('humble')) {\n      console.warn(\n        'Service introspection is not supported by this version of ROS 2'\n      );\n      return;\n    }\n\n    let type = this.typeClass.type();\n    rclnodejs.configureServiceIntrospection(\n      this.handle,\n      this._nodeHandle,\n      clock.handle,\n      type.interfaceName,\n      type.pkgName,\n      qos,\n      introspectionState\n    );\n  }\n\n  /**\n   * Get the options of this service.\n   * @return {object} The options of this service.\n   */\n  getOptions() {\n    return rclnodejs.getOptions(this._handle);\n  }\n\n  /**\n   * Get the logger name for this service.\n   * @returns {string} The logger name for this service.\n   */\n  get loggerName() {\n    return rclnodejs.getNodeLoggerName(this._nodeHandle);\n  }\n}\n\nexport default Service;\n","// Copyright (c) 2017 Intel Corporation. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport rclnodejs from './native_loader.js';\nimport Entity from './entity.js';\nimport DistroUtils from './distro.js';\nimport { applySerializationMode } from './message_serialization.js';\nimport createDebug from 'debug';\nconst debug = createDebug('rclnodejs:subscription');\n\n/**\n * @class - Class representing a ROS 2 Subscription\n * Includes support for content-filtering topics beginning with the\n * ROS Humble release. To learn more about content-filtering topics,\n * see the references below.\n * @hideconstructor\n * @see {@link Node#options}\n * @see {@link Node#createSubscription}\n * @see {@link https://www.omg.org/spec/DDS/1.4/PDF|DDS 1.4 specification, Annex B}\n */\n\nclass Subscription extends Entity {\n  constructor(\n    handle,\n    typeClass,\n    topic,\n    options,\n    callback,\n    node,\n    eventCallbacks\n  ) {\n    super(handle, typeClass, options);\n    this._topic = topic;\n    this._callback = callback;\n    this._isRaw = options.isRaw || false;\n    this._serializationMode = options.serializationMode || 'default';\n    this._node = node;\n    this._wantsMessageInfo = callback.length >= 2;\n\n    if (node && eventCallbacks) {\n      this._events = eventCallbacks.createEventHandlers(this.handle);\n    }\n  }\n\n  /**\n   * Whether this subscription's callback wants MessageInfo as a second argument.\n   * Determined by callback.length >= 2.\n   * @type {boolean}\n   * @readonly\n   */\n  get wantsMessageInfo() {\n    return this._wantsMessageInfo;\n  }\n\n  processResponse(msg, messageInfo) {\n    debug(`Message of topic ${this._topic} received.`);\n    if (this._isRaw) {\n      if (this._wantsMessageInfo && messageInfo) {\n        this._callback(msg, messageInfo);\n      } else {\n        this._callback(msg);\n      }\n    } else {\n      let message = msg.toPlainObject(this.typedArrayEnabled);\n\n      if (this._serializationMode !== 'default') {\n        message = applySerializationMode(message, this._serializationMode);\n      }\n\n      if (this._wantsMessageInfo && messageInfo) {\n        this._callback(message, messageInfo);\n      } else {\n        this._callback(message);\n      }\n    }\n  }\n\n  static createSubscription(\n    node,\n    typeClass,\n    topic,\n    options,\n    callback,\n    eventCallbacks\n  ) {\n    let type = typeClass.type();\n\n    // convert contentFilter.parameters to a string[]\n    if (options.contentFilter && options.contentFilter.parameters) {\n      options.contentFilter.parameters = options.contentFilter.parameters.map(\n        (param) => param.toString()\n      );\n    }\n\n    let handle = rclnodejs.createSubscription(\n      node.handle,\n      type.pkgName,\n      type.subFolder,\n      type.interfaceName,\n      topic,\n      options\n    );\n    return new Subscription(\n      handle,\n      typeClass,\n      topic,\n      options,\n      callback,\n      node,\n      eventCallbacks\n    );\n  }\n\n  /**\n   * @type {string}\n   */\n  get topic() {\n    return rclnodejs.getSubscriptionTopic(this._handle);\n  }\n\n  /**\n   * @type {boolean}\n   */\n  get isRaw() {\n    return this._isRaw;\n  }\n\n  /**\n   * @type {string}\n   */\n  get serializationMode() {\n    return this._serializationMode;\n  }\n\n  /**\n   * Check if content filtering is supported for this subscription.\n   * Requires ROS 2 Lyrical or later.\n   * @returns {boolean} True if the subscription instance supports content filtering; otherwise false.\n   */\n  isContentFilterSupported() {\n    if (DistroUtils.getDistroId() < DistroUtils.DistroId.LYRICAL) {\n      return false;\n    }\n    return rclnodejs.isContentFilterSupported(this.handle);\n  }\n\n  /**\n   * Test if the RMW supports content-filtered topics and that this subscription\n   * has an active wellformed content-filter.\n   * @returns {boolean} True if content-filtering will be applied; otherwise false.\n   */\n  hasContentFilter() {\n    return rclnodejs.hasContentFilter(this.handle);\n  }\n\n  /**\n   * If the RMW supports content-filtered topics set this subscription's content-filter.\n   * @param {object} contentFilter - The content-filter description.\n   * @param {string} contentFilter.expression - Specifies the criteria to select messages of interest.\n   *  It is similar to the WHERE part of an SQL clause. Clear the current contentFilter if\n   *  the expression is undefined or an empty string.\n   * @param {object[]}  [contentFilter.parameters=undefined] - Array of objects that give values to\n   *  the ‘parameters’ (i.e., \"%n\" tokens) in the filter_expression. The number of supplied parameters must\n   *  fit with the requested values in the filter_expression (i.e., the number of %n tokens). default: undefined.\n   * @returns {boolean} - True if successful; false otherwise\n   * @see {@link https://www.omg.org/spec/DDS/1.4/PDF|DDS 1.4 specification, Annex B}\n   */\n  setContentFilter(contentFilter) {\n    return contentFilter?.expression\n      ? rclnodejs.setContentFilter(this.handle, contentFilter, this._node)\n      : this.clearContentFilter();\n  }\n\n  /**\n   * Get the current content-filter.\n   * @returns {object} - The content-filter description {expression: string, parameters: string[]} or undefined if not set/supported.\n   */\n  getContentFilter() {\n    return rclnodejs.getContentFilter(this.handle);\n  }\n\n  /**\n   * Clear the current content-filter. No filtering is to be applied.\n   * @returns {boolean} - True if successful; false otherwise\n   */\n  clearContentFilter() {\n    return this.hasContentFilter()\n      ? rclnodejs.clearContentFilter(this.handle, this._node)\n      : true;\n  }\n\n  /**\n   * Get the number of publishers to this subscription.\n   * @returns {number} The number of publishers\n   */\n  get publisherCount() {\n    return rclnodejs.getPublisherCount(this._handle);\n  }\n\n  /**\n   * Get the event handlers for this subscription.\n   * @returns {Array} The array of event handlers for this subscription.\n   */\n  get events() {\n    return this._events;\n  }\n\n  /**\n   * Set the event handlers for this subscription.\n   * @param {Array} events - The array of event handlers for this subscription.\n   */\n  set events(events) {\n    this._events = events;\n  }\n\n  /**\n   * Get the logger name for this subscription.\n   * @returns {string} The logger name for this subscription.\n   */\n  get loggerName() {\n    return rclnodejs.getNodeLoggerName(this._node.handle);\n  }\n}\n\nexport default Subscription;\n","// Copyright (c) 2018 Intel Corporation. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport rclnodejs from './native_loader.js';\nimport { Clock, ROSClock } from './clock.js';\nconst { ClockType } = Clock;\nimport { Parameter, ParameterType } from './parameter.js';\nimport Time from './time.js';\nimport { TypeValidationError, OperationError } from './errors.js';\n\nconst USE_SIM_TIME_PARAM = 'use_sim_time';\nconst CLOCK_TOPIC = '/clock';\n\n/**\n * @class - Class representing a TimeSource in ROS\n */\n\nclass TimeSource {\n  /**\n   * Create a TimeSource.\n   * @param {Node} node - The node to be attached.\n   */\n  constructor(node) {\n    this._node = node;\n    this._associatedClocks = [];\n    this._clockSubscription = undefined;\n    this._lastTimeSet = new Time(0n, 0n, ClockType.ROS_TIME);\n    this._isRosTimeActive = false;\n\n    if (this._node) {\n      this.attachNode(this._node);\n    }\n  }\n\n  /**\n   * Return status that whether the ROS time is active.\n   * @name TimeSource#get:isRosTimeActive\n   * @function\n   * @return {boolean} Return true if the time is active, otherwise return false.\n   */\n\n  get isRosTimeActive() {\n    return this._isRosTimeActive;\n  }\n\n  /**\n   * Set the status of time.\n   * @param {boolean} enabled - Set the ROS time to be active if enabled is true.\n   * @name TimeSource#set:isRosTimeActive\n   * @function\n   * @return {undefined}\n   */\n\n  set isRosTimeActive(enabled) {\n    if (this._isRosTimeActive === enabled) return;\n\n    this._isRosTimeActive = enabled;\n    this._associatedClocks.forEach((clock) => {\n      clock.isRosTimeActive = enabled;\n    });\n    if (enabled) {\n      this._subscribeToClockTopic();\n    } else if (this._node && this._clockSubscription) {\n      this._node.destroySubscription(this._clockSubscription);\n      this._clockSubscription = undefined;\n    }\n  }\n\n  /**\n   * Attach the clock to a Node object.\n   * @param {Node} node - The node to be attached.\n   * @return {undefined}\n   */\n  attachNode(node) {\n    if (!(node instanceof rclnodejs.ShadowNode)) {\n      throw new TypeValidationError('node', node, 'Node', {\n        entityType: 'time source',\n      });\n    }\n\n    if (this._node) {\n      this.detachNode();\n    }\n\n    this._node = node;\n\n    if (!node.hasParameter(USE_SIM_TIME_PARAM)) {\n      node.declareParameter(\n        new Parameter(USE_SIM_TIME_PARAM, ParameterType.PARAMETER_BOOL, false)\n      );\n    }\n\n    const useSimTimeParam = node.getParameter(USE_SIM_TIME_PARAM);\n    if (useSimTimeParam.type !== ParameterType.PARAMETER_NOT_SET) {\n      if (useSimTimeParam.type === ParameterType.PARAMETER_BOOL) {\n        this._isRosTimeActive = useSimTimeParam.value;\n      } else {\n        node\n          .getLogger()\n          .error(\n            `Invalid type for parameter ${USE_SIM_TIME_PARAM} ${useSimTimeParam.type} should be bool`\n          );\n      }\n    } else {\n      node\n        .getLogger()\n        .debug(\n          `${USE_SIM_TIME_PARAM}' parameter not set, using wall time by default`\n        );\n    }\n\n    if (this.isRosTimeActive) {\n      this._subscribeToClockTopic();\n    }\n\n    node.addOnSetParametersCallback(this.onParameterEvent.bind(this));\n  }\n\n  /**\n   * Detach the node which the clock have attached.\n   * @return {undefined}\n   */\n  detachNode() {\n    if (this._clockSubscription) {\n      if (!this._node) {\n        throw new OperationError(\n          'Unable to destroy previously created clock subscription',\n          {\n            code: 'NO_NODE_ATTACHED',\n            entityType: 'time source',\n          }\n        );\n      }\n      this._node.destroySubscription(this._clockSubscription);\n    }\n    this._clockSubscription = undefined;\n    this._node = undefined;\n  }\n\n  /**\n   * Attach the clock to a TimeSource object.\n   * @param {Clock} clock - The node to be attached.\n   * @return {undefined}\n   */\n  attachClock(clock) {\n    if (!(clock instanceof ROSClock)) {\n      throw new TypeValidationError('clock', clock, 'ROSClock', {\n        entityType: 'time source',\n      });\n    }\n    clock.rosTimeOverride = this._lastTimeSet;\n    clock.isRosTimeActive = this._isRosTimeActive;\n    this._associatedClocks.push(clock);\n  }\n\n  _clockCallback(msg) {\n    this._lastTimeSet = Time.fromMsg(msg.clock);\n    this._associatedClocks.forEach((clock) => {\n      clock.rosTimeOverride = this._lastTimeSet;\n    });\n  }\n\n  _subscribeToClockTopic() {\n    if (!this._clockSubscription && this._node) {\n      this._clockSubscription = this._node.createSubscription(\n        'rosgraph_msgs/msg/Clock',\n        CLOCK_TOPIC,\n        this._clockCallback.bind(this)\n      );\n    }\n  }\n\n  onParameterEvent(parameters = []) {\n    for (const parameter of parameters) {\n      if (parameter.name === USE_SIM_TIME_PARAM) {\n        if (parameter.type === ParameterType.PARAMETER_BOOL) {\n          this.isRosTimeActive = parameter.value;\n        } else if (this._node) {\n          this._node\n            .getLogger()\n            .error(\n              `${USE_SIM_TIME_PARAM} parameter set to something besides a bool`\n            );\n        }\n\n        break;\n      }\n    }\n\n    return {\n      successful: true,\n      reason: '',\n    };\n  }\n}\n\nexport default TimeSource;\n","// Copyright (c) 2017 Intel Corporation. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport rclnodejs from './native_loader.js';\nimport DistroUtils from './distro.js';\n\n/**\n * @class - Class representing a Timer in ROS\n * @hideconstructor\n */\n\nclass Timer {\n  constructor(handle, period, callback, clock) {\n    this._handle = handle;\n    this._period = period;\n    this._clock = clock;\n    this.callback = callback;\n  }\n\n  /**\n   * The period of the timer in nanoseconds.\n   * @type {bigint}\n   */\n  get period() {\n    return this._period;\n  }\n\n  /**\n   * The clock the timer measures time with: the clock passed to\n   * {@link Node#createTimer}, or the node's clock when none was passed.\n   * @type {Clock}\n   */\n  get clock() {\n    return this._clock;\n  }\n\n  get handle() {\n    return this._handle;\n  }\n\n  /**\n   * Check if the timer is ready.\n   * @return {boolean} Return true if timer is ready, otherwise return false.\n   */\n  isReady() {\n    return rclnodejs.isTimerReady(this._handle);\n  }\n\n  /**\n   * Check if the timer is canceled.\n   * @return {boolean} Return true if timer is canceled, otherwise return false.\n   */\n  isCanceled() {\n    return rclnodejs.isTimerCanceled(this._handle);\n  }\n\n  /**\n   * Cancel the timer.\n   * Safe to call repeatedly, including after the timer has been destroyed.\n   * @return {undefined}\n   */\n  cancel() {\n    rclnodejs.cancelTimer(this._handle);\n  }\n\n  /**\n   * Reset the timer.\n   * @return {undefined}\n   */\n  reset() {\n    rclnodejs.resetTimer(this._handle);\n  }\n\n  /**\n   * Get the interval since the last call of this timer.\n   * @return {bigint} - the interval value in nanoseconds.\n   */\n  timeSinceLastCall() {\n    return rclnodejs.timerGetTimeSinceLastCall(this._handle);\n  }\n\n  /**\n   * Get the interval until the next call will happen.\n   * @return {bigint} - the interval value in nanoseconds.\n   */\n  timeUntilNextCall() {\n    return rclnodejs.timerGetTimeUntilNextCall(this._handle);\n  }\n\n  /**\n   * Get the absolute time in nanoseconds when the next callback is due.\n   * Note: Only available on ROS2 distributions after Humble.\n   * @return {bigint | null} - The next call time in nanoseconds, or null if the timer is canceled.\n   *   Returns undefined if not supported on current ROS2 distribution.\n   */\n  getNextCallTime() {\n    if (typeof rclnodejs.getTimerNextCallTime !== 'function') {\n      return undefined;\n    }\n    return rclnodejs.getTimerNextCallTime(this._handle);\n  }\n\n  /**\n   * Change the timer period.\n   * @param {bigint} period - The new period in nanoseconds.\n   * @return {undefined}\n   */\n  changeTimerPeriod(period) {\n    rclnodejs.changeTimerPeriod(this._handle, period);\n  }\n\n  /**\n   * Get the timer period.\n   * @return {bigint} - The period in nanoseconds.\n   */\n  get timerPeriod() {\n    return rclnodejs.getTimerPeriod(this._handle);\n  }\n\n  /**\n   * Set the on reset callback.\n   * @param {function} callback - The callback to be called when the timer is reset.\n   * @return {undefined}\n   */\n  setOnResetCallback(callback) {\n    if (DistroUtils.getDistroId() <= DistroUtils.getDistroId('humble')) {\n      console.warn(\n        'setOnResetCallback is not supported by this version of ROS 2'\n      );\n      return;\n    }\n    rclnodejs.setTimerOnResetCallback(this._handle, callback);\n  }\n\n  /**\n   * Clear the on reset callback.\n   * @return {undefined}\n   */\n  clearOnResetCallback() {\n    if (DistroUtils.getDistroId() <= DistroUtils.getDistroId('humble')) {\n      console.warn(\n        'clearOnResetCallback is not supported by this version of ROS 2'\n      );\n      return;\n    }\n    rclnodejs.clearTimerOnResetCallback(this._handle);\n  }\n\n  /**\n   * Call a timer and starts counting again, retrieves actual and expected call time.\n   * @return {{expectedCallTime: bigint, actualCallTime: bigint}} - The timer information.\n   */\n  callTimerWithInfo() {\n    if (DistroUtils.getDistroId() <= DistroUtils.getDistroId('humble')) {\n      console.warn(\n        'callTimerWithInfo is not supported by this version of ROS 2'\n      );\n      return;\n    }\n    return rclnodejs.callTimerWithInfo(this._handle);\n  }\n}\n\nexport default Timer;\n","// Copyright (c) 2025, The Robot Web Tools Contributors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport loader from './interface_loader.js';\nimport rclnodejs from './native_loader.js';\nimport Service from './service.js';\n\nimport { ParameterType, Parameter, ParameterDescriptor } from './parameter.js';\n\n// This class is used to create a TypeDescriptionService which can be used to\n// retrieve information about types used by the node’s publishers, subscribers,\n// services or actions.\nclass TypeDescriptionService {\n  constructor(node) {\n    this._node = node;\n    this._serviceName = this._node.name() + '/get_type_description';\n    this._typeDescriptionServiceHandle = rclnodejs.initTypeDescriptionService(\n      this._node.handle\n    );\n    this._typeClass = loader.loadInterface(\n      'type_description_interfaces/srv/GetTypeDescription'\n    );\n    this._typeDescriptionService = null;\n\n    this._enabled = false;\n    const startTypeDescriptionServiceParam = 'start_type_description_service';\n    if (!node.hasParameter(startTypeDescriptionServiceParam)) {\n      node.declareParameter(\n        new Parameter(\n          startTypeDescriptionServiceParam,\n          ParameterType.PARAMETER_BOOL,\n          true\n        ),\n        new ParameterDescriptor(\n          startTypeDescriptionServiceParam,\n          ParameterType.PARAMETER_BOOL,\n          'If enabled, start the ~/get_type_description service.',\n          true\n        )\n      );\n    }\n    const param = node.getParameter(startTypeDescriptionServiceParam);\n    this._enabled = param.value;\n  }\n\n  start() {\n    if (!this._enabled || this._typeDescriptionService) {\n      return;\n    }\n\n    this._typeDescriptionService = new Service(\n      this._node.handle,\n      this._typeDescriptionServiceHandle,\n      this._serviceName,\n      this._typeClass,\n      this._node._validateOptions(undefined),\n      (request, response) => {\n        const responseToBeSent = new this._typeClass.Response();\n        const requestReceived = new this._typeClass.Request(request);\n        const rawResponse = responseToBeSent.serialize();\n        rclnodejs.handleRequest(\n          this._node.handle,\n          requestReceived.serialize(),\n          rawResponse\n        );\n        try {\n          rclnodejs.sendResponse(\n            this._typeDescriptionServiceHandle,\n            rawResponse,\n            response._header\n          );\n        } finally {\n          this._typeClass.Response.destroyRawROS(responseToBeSent);\n        }\n        return null;\n      }\n    );\n    this._node._registerEntity('services', this._typeDescriptionService);\n  }\n\n  /**\n   * Get the node this\n   * @return {Node} - The supported node.\n   */\n  get node() {\n    return this._node;\n  }\n\n  static toTypeHash(topicTypeHash) {\n    return `RIHS0${topicTypeHash.version}_${topicTypeHash.value.toString('hex')}`;\n  }\n}\n\nexport default TypeDescriptionService;\n","// Copyright (c) 2026, The Robot Web Tools Contributors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nconst WAITABLE_COLLECTIONS = new Set([\n  'subscriptions',\n  'clients',\n  'services',\n  'timers',\n  'guards',\n  'events',\n  'actionClients',\n  'actionServers',\n]);\n\nconst DESTRUCTION_ORDER = [\n  'actionClients',\n  'actionServers',\n  'parameterClients',\n  'parameterWatchers',\n  'parameterEventHandlers',\n  'timers',\n  'events',\n  'publishers',\n  'subscriptions',\n  'clients',\n  'services',\n  'guards',\n];\n\nclass EntityRegistry {\n  constructor(node) {\n    this._node = node;\n    this._destroyingAll = false;\n    this.collections = {\n      publishers: [],\n      subscriptions: [],\n      clients: [],\n      services: [],\n      timers: [],\n      guards: [],\n      events: [],\n      actionClients: [],\n      actionServers: [],\n      parameterClients: [],\n      parameterWatchers: [],\n      parameterEventHandlers: [],\n    };\n  }\n\n  register(kind, entity) {\n    this.collections[kind].push(entity);\n    const events = entity.events || [];\n    this.collections.events.push(...events);\n    if (WAITABLE_COLLECTIONS.has(kind) || events.length > 0) {\n      this._node.syncHandles();\n    }\n    return entity;\n  }\n\n  _remove(kind, entity) {\n    const entities = this.collections[kind];\n    const index = entities.indexOf(entity);\n    if (index > -1) {\n      entities.splice(index, 1);\n    }\n  }\n\n  destroy(kind, entity) {\n    this._remove(kind, entity);\n    if (entity.isDestroyed && entity.isDestroyed()) return;\n\n    const events = [...(entity.events || [])];\n    for (const event of events) {\n      this._remove('events', event);\n    }\n    if (\n      !this._destroyingAll &&\n      (WAITABLE_COLLECTIONS.has(kind) || events.length > 0)\n    ) {\n      this._node.syncHandles();\n    }\n\n    for (const event of events) {\n      this._release(event);\n    }\n    if (entity.events) {\n      entity.events = [];\n    }\n    this._release(entity);\n  }\n\n  destroyAll() {\n    this._destroyingAll = true;\n    try {\n      for (const kind of DESTRUCTION_ORDER) {\n        for (const entity of [...this.collections[kind]]) {\n          this.destroy(kind, entity);\n        }\n      }\n    } finally {\n      this._destroyingAll = false;\n    }\n  }\n\n  _release(entity) {\n    if (entity.finalizeDestruction) {\n      entity.finalizeDestruction();\n    } else if (entity.handle) {\n      entity.handle.release();\n    } else {\n      entity.destroy();\n    }\n  }\n}\n\nexport default EntityRegistry;\n","// Copyright (c) 2025, The Robot Web Tools Contributors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport rclnodejs from './native_loader.js';\nimport DistroUtils from './distro.js';\nimport {\n  OperationError,\n  RangeValidationError,\n  TypeValidationError,\n} from './errors.js';\nimport Entity from './entity.js';\n\n/**\n * Enumeration for PublisherEventCallbacks event types.\n * @enum {number}\n */\nconst PublisherEventType = {\n  /** @member {number} */\n  PUBLISHER_OFFERED_DEADLINE_MISSED: 0,\n  /** @member {number} */\n  PUBLISHER_LIVELINESS_LOST: 1,\n  /** @member {number} */\n  PUBLISHER_OFFERED_INCOMPATIBLE_QOS: 2,\n  /** @member {number} */\n  PUBLISHER_INCOMPATIBLE_TYPE: 3,\n  /** @member {number} */\n  PUBLISHER_MATCHED: 4,\n};\n\n/**\n * Enumeration for SubscriptionEventCallbacks event types.\n * @enum {number}\n */\nconst SubscriptionEventType = {\n  /** @member {number} */\n  SUBSCRIPTION_REQUESTED_DEADLINE_MISSED: 0,\n  /** @member {number} */\n  SUBSCRIPTION_LIVELINESS_CHANGED: 1,\n  /** @member {number} */\n  SUBSCRIPTION_REQUESTED_INCOMPATIBLE_QOS: 2,\n  /** @member {number} */\n  SUBSCRIPTION_MESSAGE_LOST: 3,\n  /** @member {number} */\n  SUBSCRIPTION_INCOMPATIBLE_TYPE: 4,\n  /** @member {number} */\n  SUBSCRIPTION_MATCHED: 5,\n};\n\n/**\n * Check if a publisher event type is supported by the active RMW implementation.\n *\n * Only available in ROS 2 Rolling and later, where the underlying rcl API\n * (`rcl_publisher_event_type_is_supported`) is provided.\n *\n * @param {number} eventType - A {@link PublisherEventType} value.\n * @return {boolean} True if the event type is supported by the active RMW\n *   implementation, false otherwise.\n * @throws {OperationError} if invoked on a ROS distro older than Rolling.\n * @throws {TypeValidationError} if eventType is not a number.\n * @throws {RangeValidationError} if eventType is not a valid\n *   {@link PublisherEventType} value.\n */\nfunction isPublisherEventTypeSupported(eventType) {\n  if (typeof rclnodejs.isPublisherEventTypeSupported !== 'function') {\n    throw new OperationError(\n      'isPublisherEventTypeSupported is only available in ROS 2 Rolling and later',\n      {\n        code: 'UNSUPPORTED_ROS_VERSION',\n        entityType: 'publisher event type',\n        details: {\n          requiredVersion: 'rolling',\n          currentVersion: DistroUtils.getDistroId(),\n        },\n      }\n    );\n  }\n  if (typeof eventType !== 'number') {\n    throw new TypeValidationError('eventType', eventType, 'number', {\n      entityType: 'publisher event type',\n    });\n  }\n  if (!Object.values(PublisherEventType).includes(eventType)) {\n    throw new RangeValidationError(\n      'eventType',\n      eventType,\n      'one of PublisherEventType values',\n      { entityType: 'publisher event type' }\n    );\n  }\n  return rclnodejs.isPublisherEventTypeSupported(eventType);\n}\n\n/**\n * Check if a subscription event type is supported by the active RMW implementation.\n *\n * Only available in ROS 2 Rolling and later, where the underlying rcl API\n * (`rcl_subscription_event_type_is_supported`) is provided.\n *\n * @param {number} eventType - A {@link SubscriptionEventType} value.\n * @return {boolean} True if the event type is supported by the active RMW\n *   implementation, false otherwise.\n * @throws {OperationError} if invoked on a ROS distro older than Rolling.\n * @throws {TypeValidationError} if eventType is not a number.\n * @throws {RangeValidationError} if eventType is not a valid\n *   {@link SubscriptionEventType} value.\n */\nfunction isSubscriptionEventTypeSupported(eventType) {\n  if (typeof rclnodejs.isSubscriptionEventTypeSupported !== 'function') {\n    throw new OperationError(\n      'isSubscriptionEventTypeSupported is only available in ROS 2 Rolling and later',\n      {\n        code: 'UNSUPPORTED_ROS_VERSION',\n        entityType: 'subscription event type',\n        details: {\n          requiredVersion: 'rolling',\n          currentVersion: DistroUtils.getDistroId(),\n        },\n      }\n    );\n  }\n  if (typeof eventType !== 'number') {\n    throw new TypeValidationError('eventType', eventType, 'number', {\n      entityType: 'subscription event type',\n    });\n  }\n  if (!Object.values(SubscriptionEventType).includes(eventType)) {\n    throw new RangeValidationError(\n      'eventType',\n      eventType,\n      'one of SubscriptionEventType values',\n      { entityType: 'subscription event type' }\n    );\n  }\n  return rclnodejs.isSubscriptionEventTypeSupported(eventType);\n}\n\nclass EventHandler extends Entity {\n  constructor(handle, callback, eventType, eventTypeName) {\n    super(handle, null, null);\n    this._callback = callback;\n    this._eventType = eventType;\n    this._eventTypeName = eventTypeName;\n  }\n\n  takeData() {\n    const data = rclnodejs.takeEvent(this._handle, {\n      [this._eventTypeName]: this._eventType,\n    });\n    if (this._callback) {\n      this._callback(data);\n    }\n  }\n}\n\n/**\n * @class - Class representing a ROS 2 PublisherEventCallbacks\n * @hideconstructor\n */\nclass PublisherEventCallbacks {\n  constructor() {\n    if (DistroUtils.getDistroId() < DistroUtils.getDistroId('jazzy')) {\n      throw new OperationError(\n        'PublisherEventCallbacks is only available in ROS 2 Jazzy and later',\n        {\n          code: 'UNSUPPORTED_ROS_VERSION',\n          entityType: 'publisher event callbacks',\n          details: {\n            requiredVersion: 'jazzy',\n            currentVersion: DistroUtils.getDistroId(),\n          },\n        }\n      );\n    }\n    this._deadline = null;\n    this._incompatible_qos = null;\n    this._liveliness = null;\n    this._incompatible_type = null;\n    this._matched = null;\n    this._eventHandlers = [];\n  }\n\n  /**\n   * Set deadline missed callback.\n   * @param {function} callback - The callback function to be called.\n   */\n  set deadline(callback) {\n    this._deadline = callback;\n  }\n\n  /**\n   * Get deadline missed callback.\n   * @return {function} - The callback function.\n   */\n  get deadline() {\n    return this._deadline;\n  }\n\n  /**\n   * Set incompatible QoS callback.\n   * @param {function} callback - The callback function to be called.\n   */\n  set incompatibleQos(callback) {\n    this._incompatible_qos = callback;\n  }\n\n  /**\n   * Get incompatible QoS callback.\n   * @return {function} - The callback function.\n   */\n  get incompatibleQos() {\n    return this._incompatible_qos;\n  }\n\n  /**\n   * Set liveliness lost callback.\n   * @param {function} callback - The callback function to be called.\n   */\n  set liveliness(callback) {\n    this._liveliness = callback;\n  }\n\n  /**\n   * Get liveliness lost callback.\n   * @return {function} - The callback function.\n   */\n  get liveliness() {\n    return this._liveliness;\n  }\n\n  /**\n   * Set incompatible type callback.\n   * @param {function} callback - The callback function to be called.\n   */\n  set incompatibleType(callback) {\n    this._incompatible_type = callback;\n  }\n\n  /**\n   * Get incompatible type callback.\n   * @return {function} - The callback function.\n   */\n  get incompatibleType() {\n    return this._incompatible_type;\n  }\n\n  /**\n   * Set matched callback.\n   * @param {function} callback - The callback function to be called.\n   */\n  set matched(callback) {\n    this._matched = callback;\n  }\n\n  /**\n   * Get matched callback.\n   * @return {function} - The callback function.\n   */\n  get matched() {\n    return this._matched;\n  }\n\n  createEventHandlers(publisherHandle) {\n    if (this._deadline) {\n      const deadlineHandle = rclnodejs.createPublisherEventHandle(\n        publisherHandle,\n        PublisherEventType.PUBLISHER_OFFERED_DEADLINE_MISSED\n      );\n      this._eventHandlers.push(\n        new EventHandler(\n          deadlineHandle,\n          this._deadline,\n          PublisherEventType.PUBLISHER_OFFERED_DEADLINE_MISSED,\n          'publisher_event_type'\n        )\n      );\n    }\n\n    if (this._incompatible_qos) {\n      const incompatibleQosHandle = rclnodejs.createPublisherEventHandle(\n        publisherHandle,\n        PublisherEventType.PUBLISHER_OFFERED_INCOMPATIBLE_QOS\n      );\n      this._eventHandlers.push(\n        new EventHandler(\n          incompatibleQosHandle,\n          this._incompatible_qos,\n          PublisherEventType.PUBLISHER_OFFERED_INCOMPATIBLE_QOS,\n          'publisher_event_type'\n        )\n      );\n    }\n\n    if (this._liveliness) {\n      const livelinessHandle = rclnodejs.createPublisherEventHandle(\n        publisherHandle,\n        PublisherEventType.PUBLISHER_LIVELINESS_LOST\n      );\n      this._eventHandlers.push(\n        new EventHandler(\n          livelinessHandle,\n          this._liveliness,\n          PublisherEventType.PUBLISHER_LIVELINESS_LOST,\n          'publisher_event_type'\n        )\n      );\n    }\n\n    if (this._incompatible_type) {\n      const incompatibleTypeHandle = rclnodejs.createPublisherEventHandle(\n        publisherHandle,\n        PublisherEventType.PUBLISHER_INCOMPATIBLE_TYPE\n      );\n      this._eventHandlers.push(\n        new EventHandler(\n          incompatibleTypeHandle,\n          this._incompatible_type,\n          PublisherEventType.PUBLISHER_INCOMPATIBLE_TYPE,\n          'publisher_event_type'\n        )\n      );\n    }\n\n    if (this._matched) {\n      const matchedHandle = rclnodejs.createPublisherEventHandle(\n        publisherHandle,\n        PublisherEventType.PUBLISHER_MATCHED\n      );\n      this._eventHandlers.push(\n        new EventHandler(\n          matchedHandle,\n          this._matched,\n          PublisherEventType.PUBLISHER_MATCHED,\n          'publisher_event_type'\n        )\n      );\n    }\n\n    return this._eventHandlers;\n  }\n\n  get eventHandlers() {\n    return this._eventHandlers;\n  }\n}\n\n/**\n * @class - Class representing a ROS 2 SubscriptionEventCallbacks\n * @hideconstructor\n */\nclass SubscriptionEventCallbacks {\n  constructor() {\n    if (DistroUtils.getDistroId() < DistroUtils.getDistroId('jazzy')) {\n      throw new OperationError(\n        'SubscriptionEventCallbacks is only available in ROS 2 Jazzy and later',\n        {\n          code: 'UNSUPPORTED_ROS_VERSION',\n          entityType: 'subscription event callbacks',\n          details: {\n            requiredVersion: 'jazzy',\n            currentVersion: DistroUtils.getDistroId(),\n          },\n        }\n      );\n    }\n    this._deadline = null;\n    this._incompatible_qos = null;\n    this._liveliness = null;\n    this._message_lost = null;\n    this._incompatible_type = null;\n    this._matched = null;\n    this._eventHandlers = [];\n  }\n\n  /**\n   * Set the callback for deadline missed event.\n   * @param {function} callback - The callback function to be called.\n   */\n  set deadline(callback) {\n    this._deadline = callback;\n  }\n\n  /**\n   * Get the callback for deadline missed event.\n   * @return {function} - The callback function.\n   */\n  get deadline() {\n    return this._deadline;\n  }\n\n  /**\n   * Set the callback for incompatible QoS event.\n   * @param {function} callback - The callback function to be called.\n   */\n  set incompatibleQos(callback) {\n    this._incompatible_qos = callback;\n  }\n\n  /**\n   * Get the callback for incompatible QoS event.\n   * @return {function} - The callback function.\n   */\n  get incompatibleQos() {\n    return this._incompatible_qos;\n  }\n\n  /**\n   * Set the callback for liveliness changed event.\n   * @param {function} callback - The callback function to be called.\n   */\n  set liveliness(callback) {\n    this._liveliness = callback;\n  }\n\n  /**\n   * Get the callback for liveliness changed event.\n   * @return {function} - The callback function.\n   */\n  get liveliness() {\n    return this._liveliness;\n  }\n\n  /**\n   * Set the callback for message lost event.\n   * @param {function} callback - The callback function to be called.\n   */\n  set messageLost(callback) {\n    this._message_lost = callback;\n  }\n\n  /**\n   * Get the callback for message lost event.\n   * @return {function} - The callback function.\n   */\n  get messageLost() {\n    return this._message_lost;\n  }\n\n  /**\n   * Set the callback for incompatible type event.\n   * @param {function} callback - The callback function to be called.\n   */\n  set incompatibleType(callback) {\n    this._incompatible_type = callback;\n  }\n\n  /**\n   * Get the callback for incompatible type event.\n   * @return {function} - The callback function.\n   */\n  get incompatibleType() {\n    return this._incompatible_type;\n  }\n\n  /**\n   * Set the callback for matched event.\n   * @param {function} callback - The callback function to be called.\n   */\n  set matched(callback) {\n    this._matched = callback;\n  }\n\n  /**\n   * Get the callback for matched event.\n   * @return {function} - The callback function.\n   */\n  get matched() {\n    return this._matched;\n  }\n\n  createEventHandlers(subscriptionHandle) {\n    if (this._deadline) {\n      const deadlineHandle = rclnodejs.createSubscriptionEventHandle(\n        subscriptionHandle,\n        SubscriptionEventType.SUBSCRIPTION_REQUESTED_DEADLINE_MISSED\n      );\n      this._eventHandlers.push(\n        new EventHandler(\n          deadlineHandle,\n          this._deadline,\n          SubscriptionEventType.SUBSCRIPTION_REQUESTED_DEADLINE_MISSED,\n          'subscription_event_type'\n        )\n      );\n    }\n\n    if (this._incompatible_qos) {\n      const incompatibleQosHandle = rclnodejs.createSubscriptionEventHandle(\n        subscriptionHandle,\n        SubscriptionEventType.SUBSCRIPTION_REQUESTED_INCOMPATIBLE_QOS\n      );\n      this._eventHandlers.push(\n        new EventHandler(\n          incompatibleQosHandle,\n          this._incompatible_qos,\n          SubscriptionEventType.SUBSCRIPTION_REQUESTED_INCOMPATIBLE_QOS,\n          'subscription_event_type'\n        )\n      );\n    }\n\n    if (this._liveliness) {\n      const livelinessHandle = rclnodejs.createSubscriptionEventHandle(\n        subscriptionHandle,\n        SubscriptionEventType.SUBSCRIPTION_LIVELINESS_CHANGED\n      );\n      this._eventHandlers.push(\n        new EventHandler(\n          livelinessHandle,\n          this._liveliness,\n          SubscriptionEventType.SUBSCRIPTION_LIVELINESS_CHANGED,\n          'subscription_event_type'\n        )\n      );\n    }\n\n    if (this._message_lost) {\n      const messageLostHandle = rclnodejs.createSubscriptionEventHandle(\n        subscriptionHandle,\n        SubscriptionEventType.SUBSCRIPTION_MESSAGE_LOST\n      );\n      this._eventHandlers.push(\n        new EventHandler(\n          messageLostHandle,\n          this._message_lost,\n          SubscriptionEventType.SUBSCRIPTION_MESSAGE_LOST,\n          'subscription_event_type'\n        )\n      );\n    }\n\n    if (this._incompatible_type) {\n      const incompatibleTypeHandle = rclnodejs.createSubscriptionEventHandle(\n        subscriptionHandle,\n        SubscriptionEventType.SUBSCRIPTION_INCOMPATIBLE_TYPE\n      );\n      this._eventHandlers.push(\n        new EventHandler(\n          incompatibleTypeHandle,\n          this._incompatible_type,\n          SubscriptionEventType.SUBSCRIPTION_INCOMPATIBLE_TYPE,\n          'subscription_event_type'\n        )\n      );\n    }\n\n    if (this._matched) {\n      const matchedHandle = rclnodejs.createSubscriptionEventHandle(\n        subscriptionHandle,\n        SubscriptionEventType.SUBSCRIPTION_MATCHED\n      );\n      this._eventHandlers.push(\n        new EventHandler(\n          matchedHandle,\n          this._matched,\n          SubscriptionEventType.SUBSCRIPTION_MATCHED,\n          'subscription_event_type'\n        )\n      );\n    }\n\n    return this._eventHandlers;\n  }\n}\n\nexport {\n  PublisherEventCallbacks,\n  PublisherEventType,\n  SubscriptionEventCallbacks,\n  SubscriptionEventType,\n  isPublisherEventTypeSupported,\n  isSubscriptionEventTypeSupported,\n};\n","// Copyright (c) 2017 Intel Corporation. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport rclnodejs from './native_loader.js';\n\nimport ActionInterfaces from './action/interfaces.js';\nimport Client from './client.js';\nimport * as Clock from './clock.js';\nimport Context from './context.js';\nimport createDebug from 'debug';\nconst debug = createDebug('rclnodejs:node');\nimport DistroUtils from './distro.js';\nimport GuardCondition from './guard_condition.js';\nimport loader from './interface_loader.js';\nimport Logging from './logging.js';\nimport LoggingService from './logging_service.js';\nimport NodeOptions from './node_options.js';\nimport { ParameterType, Parameter, ParameterDescriptor } from './parameter.js';\nimport { isValidSerializationMode } from './message_serialization.js';\nimport {\n  TypeValidationError,\n  RangeValidationError,\n  ValidationError,\n} from './errors.js';\nimport ParameterService from './parameter_service.js';\nimport ParameterClient from './parameter_client.js';\nimport ParameterWatcher from './parameter_watcher.js';\nimport ParameterEventHandler from './parameter_event_handler.js';\nimport Publisher from './publisher.js';\nimport QoS from './qos.js';\nimport * as Rates from './rate.js';\nimport Service from './service.js';\nimport Subscription from './subscription.js';\nimport ObservableSubscription from './observable_subscription.js';\nimport MessageInfo from './message_info.js';\nimport ActionEndpointInfo from './action/endpoint_info.js';\nimport { declareQosParameters, _resolveQoS } from './qos_overriding_options.js';\nimport TimeSource from './time_source.js';\nimport Timer from './timer.js';\nimport TypeDescriptionService from './type_description_service.js';\nimport Entity from './entity.js';\nimport EntityRegistry from './entity_registry.js';\nimport { SubscriptionEventCallbacks } from '../lib/event_handler.js';\nimport { PublisherEventCallbacks } from '../lib/event_handler.js';\nimport { validateFullTopicName } from './validator.js';\n\n// Parameter event publisher constants\nconst PARAMETER_EVENT_MSG_TYPE = 'rcl_interfaces/msg/ParameterEvent';\nconst PARAMETER_EVENT_TOPIC = 'parameter_events';\n\n/**\n * @class - Class representing a Node in ROS\n */\n\nclass Node extends rclnodejs.ShadowNode {\n  /**\n   * Create a ROS2Node.\n   * model using the {@link https://github.com/ros2/rcl/tree/master/rcl_lifecycle|ros2 client library (rcl) lifecyle api}.\n   * @param {string} nodeName - The name used to register in ROS.\n   * @param {string} [namespace=''] - The namespace used in ROS.\n   * @param {Context} [context=Context.defaultContext()] - The context to create the node in.\n   * @param {NodeOptions} [options=NodeOptions.defaultOptions] - The options to configure the new node behavior.\n   * @throws {Error} If the given context is not registered.\n   */\n  constructor(\n    nodeName,\n    namespace = '',\n    context = Context.defaultContext(),\n    options = NodeOptions.defaultOptions,\n    args = [],\n    useGlobalArguments = true\n  ) {\n    super();\n\n    if (typeof nodeName !== 'string') {\n      throw new TypeValidationError('nodeName', nodeName, 'string');\n    }\n    if (typeof namespace !== 'string') {\n      throw new TypeValidationError('namespace', namespace, 'string');\n    }\n\n    this._init(nodeName, namespace, options, context, args, useGlobalArguments);\n    debug(\n      'Finish initializing node, name = %s and namespace = %s.',\n      nodeName,\n      namespace\n    );\n  }\n\n  static _normalizeOptions(options) {\n    if (options instanceof NodeOptions) {\n      return options;\n    }\n    const defaults = NodeOptions.defaultOptions;\n    return {\n      startParameterServices:\n        options.startParameterServices ?? defaults.startParameterServices,\n      parameterOverrides:\n        options.parameterOverrides ?? defaults.parameterOverrides,\n      automaticallyDeclareParametersFromOverrides:\n        options.automaticallyDeclareParametersFromOverrides ??\n        defaults.automaticallyDeclareParametersFromOverrides,\n      startTypeDescriptionService:\n        options.startTypeDescriptionService ??\n        defaults.startTypeDescriptionService,\n      enableRosout: options.enableRosout ?? defaults.enableRosout,\n      rosoutQos: options.rosoutQos ?? defaults.rosoutQos,\n      enableLoggerService:\n        options.enableLoggerService ?? defaults.enableLoggerService,\n    };\n  }\n\n  _init(name, namespace, options, context, args, useGlobalArguments) {\n    options = Node._normalizeOptions(options);\n\n    this.handle = rclnodejs.createNode(\n      name,\n      namespace,\n      context.handle,\n      args,\n      useGlobalArguments,\n      options.rosoutQos\n    );\n    Object.defineProperty(this, 'handle', {\n      configurable: false,\n      writable: false,\n    }); // make read-only\n\n    this._context = context;\n    this.context.onNodeCreated(this);\n\n    this._entityRegistry = new EntityRegistry(this);\n    for (const [kind, entities] of Object.entries(\n      this._entityRegistry.collections\n    )) {\n      Object.defineProperty(this, `_${kind}`, {\n        value: entities,\n        enumerable: true,\n      });\n    }\n    this._rateTimerServer = null;\n    this._parameterDescriptors = new Map();\n    this._parameters = new Map();\n    this._parameterService = null;\n    this._loggerService = null;\n    this._typeDescriptionService = null;\n    this._parameterEventPublisher = null;\n    this._preSetParametersCallbacks = [];\n    this._setParametersCallbacks = [];\n    this._postSetParametersCallbacks = [];\n    this._logger = new Logging(rclnodejs.getNodeLoggerName(this.handle));\n    this._spinning = false;\n    // Detects stop/destroy during a ready batch, even if spinning restarts.\n    this._dispatchGeneration = 0;\n    this._enableRosout = options.enableRosout;\n\n    if (this._enableRosout) {\n      rclnodejs.initRosoutPublisherForNode(this.handle);\n    }\n\n    this._parameterEventPublisher = this.createPublisher(\n      PARAMETER_EVENT_MSG_TYPE,\n      PARAMETER_EVENT_TOPIC\n    );\n\n    // initialize _parameterOverrides from parameters defined on the commandline\n    this._parameterOverrides = this._getNativeParameterOverrides();\n\n    // override cli parameterOverrides with those specified in options\n    if (options.parameterOverrides.length > 0) {\n      for (const parameter of options.parameterOverrides) {\n        if (!(parameter instanceof Parameter)) {\n          throw new TypeValidationError(\n            'parameterOverride',\n            parameter,\n            'Parameter instance',\n            {\n              nodeName: name,\n            }\n          );\n        }\n        this._parameterOverrides.set(parameter.name, parameter);\n      }\n    }\n\n    // initialize _parameters from parameterOverrides\n    if (options.automaticallyDeclareParametersFromOverrides) {\n      for (const parameter of this._parameterOverrides.values()) {\n        parameter.validate();\n        const descriptor = ParameterDescriptor.fromParameter(parameter);\n        this._parameters.set(parameter.name, parameter);\n        this._parameterDescriptors.set(parameter.name, descriptor);\n      }\n    }\n\n    // Clock that has support for ROS time.\n    // Note: parameter overrides and parameter event publisher need to be ready at this point\n    // to be able to declare 'use_sim_time' if it was not declared yet.\n    this._clock = new Clock.ROSClock();\n    this._timeSource = new TimeSource(this);\n    this._timeSource.attachClock(this._clock);\n\n    if (options.startParameterServices) {\n      this._parameterService = new ParameterService(this);\n      this._parameterService.start();\n    }\n\n    if (options.enableLoggerService) {\n      this._loggerService = new LoggingService(this);\n      this._loggerService.start();\n    }\n\n    if (\n      DistroUtils.getDistroId() >= DistroUtils.getDistroId('jazzy') &&\n      options.startTypeDescriptionService\n    ) {\n      this._typeDescriptionService = new TypeDescriptionService(this);\n      this._typeDescriptionService.start();\n    }\n  }\n\n  execute(handles) {\n    const dispatchGeneration = this._dispatchGeneration;\n    try {\n      let timersReady = this._timers.filter((timer) =>\n        handles.includes(timer.handle)\n      );\n      let guardsReady = this._guards.filter((guard) =>\n        handles.includes(guard.handle)\n      );\n      let subscriptionsReady = this._subscriptions.filter((subscription) =>\n        handles.includes(subscription.handle)\n      );\n      let clientsReady = this._clients.filter((client) =>\n        handles.includes(client.handle)\n      );\n      let servicesReady = this._services.filter((service) =>\n        handles.includes(service.handle)\n      );\n      let actionClientsReady = this._actionClients.filter((actionClient) =>\n        handles.includes(actionClient.handle)\n      );\n      let actionServersReady = this._actionServers.filter((actionServer) =>\n        handles.includes(actionServer.handle)\n      );\n      let eventsReady = this._events.filter((event) =>\n        handles.includes(event.handle)\n      );\n\n      for (const timer of timersReady) {\n        if (this._dispatchGeneration !== dispatchGeneration) return;\n        // Earlier callbacks may destroy timers or the node after this snapshot.\n        if (this._timers.includes(timer) && timer.isReady()) {\n          let timerInfo;\n          if (typeof rclnodejs.callTimerWithInfo === 'function') {\n            timerInfo = rclnodejs.callTimerWithInfo(timer.handle);\n            timer.callback(timerInfo);\n          } else {\n            rclnodejs.callTimer(timer.handle);\n            timer.callback();\n          }\n        }\n      }\n\n      for (const event of eventsReady) {\n        if (this._dispatchGeneration !== dispatchGeneration) return;\n        if (!event.isDestroyed()) event.takeData();\n      }\n\n      for (const subscription of subscriptionsReady) {\n        if (this._dispatchGeneration !== dispatchGeneration) return;\n        if (subscription.isDestroyed()) continue;\n        if (subscription.isRaw) {\n          if (subscription.wantsMessageInfo) {\n            let taken = rclnodejs.rclTakeRawWithInfo(subscription.handle);\n            if (taken) {\n              subscription.processResponse(\n                taken.buffer,\n                new MessageInfo(taken.info)\n              );\n            }\n          } else {\n            let rawMessage = rclnodejs.rclTakeRaw(subscription.handle);\n            if (rawMessage) {\n              subscription.processResponse(rawMessage);\n            }\n          }\n          continue;\n        }\n\n        this._runWithMessageType(\n          subscription.typeClass,\n          (message, deserialize) => {\n            if (subscription.wantsMessageInfo) {\n              let rawInfo = rclnodejs.rclTakeWithInfo(\n                subscription.handle,\n                message\n              );\n              if (rawInfo) {\n                subscription.processResponse(\n                  deserialize(),\n                  new MessageInfo(rawInfo)\n                );\n              }\n            } else {\n              let success = rclnodejs.rclTake(subscription.handle, message);\n              if (success) {\n                subscription.processResponse(deserialize());\n              }\n            }\n          }\n        );\n      }\n\n      for (const guard of guardsReady) {\n        if (this._dispatchGeneration !== dispatchGeneration) return;\n        if (guard.isDestroyed()) continue;\n\n        guard.callback();\n      }\n\n      for (const client of clientsReady) {\n        if (this._dispatchGeneration !== dispatchGeneration) return;\n        if (client.isDestroyed()) continue;\n        this._runWithMessageType(\n          client.typeClass.Response,\n          (message, deserialize) => {\n            let sequenceNumber = rclnodejs.rclTakeResponse(\n              client.handle,\n              message\n            );\n            if (sequenceNumber !== undefined) {\n              client.processResponse(sequenceNumber, deserialize());\n            }\n          }\n        );\n      }\n\n      for (const service of servicesReady) {\n        if (this._dispatchGeneration !== dispatchGeneration) return;\n        if (service.isDestroyed()) continue;\n        this._runWithMessageType(\n          service.typeClass.Request,\n          (message, deserialize) => {\n            let header = rclnodejs.rclTakeRequest(\n              service.handle,\n              this.handle,\n              message\n            );\n            if (header) {\n              service.processRequest(header, deserialize());\n            }\n          }\n        );\n      }\n\n      for (const actionClient of actionClientsReady) {\n        if (this._dispatchGeneration !== dispatchGeneration) return;\n        if (actionClient.isDestroyed()) continue;\n\n        const properties = actionClient.handle.properties;\n\n        if (properties.isGoalResponseReady) {\n          this._runWithMessageType(\n            actionClient.typeClass.impl.SendGoalService.Response,\n            (message, deserialize) => {\n              let sequence = rclnodejs.actionTakeGoalResponse(\n                actionClient.handle,\n                message\n              );\n              if (sequence != undefined) {\n                actionClient.processGoalResponse(sequence, deserialize());\n              }\n            }\n          );\n        }\n\n        if (this._dispatchGeneration !== dispatchGeneration) return;\n        if (properties.isCancelResponseReady && !actionClient.isDestroyed()) {\n          this._runWithMessageType(\n            actionClient.typeClass.impl.CancelGoal.Response,\n            (message, deserialize) => {\n              let sequence = rclnodejs.actionTakeCancelResponse(\n                actionClient.handle,\n                message\n              );\n              if (sequence != undefined) {\n                actionClient.processCancelResponse(sequence, deserialize());\n              }\n            }\n          );\n        }\n\n        if (this._dispatchGeneration !== dispatchGeneration) return;\n        if (properties.isResultResponseReady && !actionClient.isDestroyed()) {\n          this._runWithMessageType(\n            actionClient.typeClass.impl.GetResultService.Response,\n            (message, deserialize) => {\n              let sequence = rclnodejs.actionTakeResultResponse(\n                actionClient.handle,\n                message\n              );\n              if (sequence != undefined) {\n                actionClient.processResultResponse(sequence, deserialize());\n              }\n            }\n          );\n        }\n\n        if (this._dispatchGeneration !== dispatchGeneration) return;\n        if (properties.isFeedbackReady && !actionClient.isDestroyed()) {\n          this._runWithMessageType(\n            actionClient.typeClass.impl.FeedbackMessage,\n            (message, deserialize) => {\n              let success = rclnodejs.actionTakeFeedback(\n                actionClient.handle,\n                message\n              );\n              if (success) {\n                actionClient.processFeedbackMessage(deserialize());\n              }\n            }\n          );\n        }\n\n        if (this._dispatchGeneration !== dispatchGeneration) return;\n        if (properties.isStatusReady && !actionClient.isDestroyed()) {\n          this._runWithMessageType(\n            actionClient.typeClass.impl.GoalStatusArray,\n            (message, deserialize) => {\n              let success = rclnodejs.actionTakeStatus(\n                actionClient.handle,\n                message\n              );\n              if (success) {\n                actionClient.processStatusMessage(deserialize());\n              }\n            }\n          );\n        }\n      }\n\n      for (const actionServer of actionServersReady) {\n        if (this._dispatchGeneration !== dispatchGeneration) return;\n        if (actionServer.isDestroyed()) continue;\n\n        const properties = actionServer.handle.properties;\n\n        if (properties.isGoalRequestReady) {\n          this._runWithMessageType(\n            actionServer.typeClass.impl.SendGoalService.Request,\n            (message, deserialize) => {\n              const result = rclnodejs.actionTakeGoalRequest(\n                actionServer.handle,\n                message\n              );\n              if (result) {\n                actionServer.processGoalRequest(result, deserialize());\n              }\n            }\n          );\n        }\n\n        if (this._dispatchGeneration !== dispatchGeneration) return;\n        if (properties.isCancelRequestReady && !actionServer.isDestroyed()) {\n          this._runWithMessageType(\n            actionServer.typeClass.impl.CancelGoal.Request,\n            (message, deserialize) => {\n              const result = rclnodejs.actionTakeCancelRequest(\n                actionServer.handle,\n                message\n              );\n              if (result) {\n                actionServer.processCancelRequest(result, deserialize());\n              }\n            }\n          );\n        }\n\n        if (this._dispatchGeneration !== dispatchGeneration) return;\n        if (properties.isResultRequestReady && !actionServer.isDestroyed()) {\n          this._runWithMessageType(\n            actionServer.typeClass.impl.GetResultService.Request,\n            (message, deserialize) => {\n              const result = rclnodejs.actionTakeResultRequest(\n                actionServer.handle,\n                message\n              );\n              if (result) {\n                actionServer.processResultRequest(result, deserialize());\n              }\n            }\n          );\n        }\n\n        if (this._dispatchGeneration !== dispatchGeneration) return;\n        if (properties.isGoalExpired && !actionServer.isDestroyed()) {\n          let numGoals = actionServer._goalHandles.size;\n          if (numGoals > 0) {\n            let GoalInfoArray = ActionInterfaces.GoalInfo.ArrayType;\n            let message = new GoalInfoArray(numGoals);\n            try {\n              let count = rclnodejs.actionExpireGoals(\n                actionServer.handle,\n                numGoals,\n                message._refArray.buffer\n              );\n              if (count > 0) {\n                actionServer.processGoalExpired(message, count);\n              }\n            } finally {\n              GoalInfoArray.freeArray(message);\n            }\n          }\n        }\n      }\n    } finally {\n      Entity._gcHandles();\n    }\n  }\n\n  /**\n   * Determine if this node is spinning.\n   * @returns {boolean} - true when spinning; otherwise returns false.\n   */\n  get spinning() {\n    return this._spinning;\n  }\n\n  /**\n   * Trigger the event loop to continuously check for and route.\n   * incoming events.\n   * A synchronous callback exception stops the current ready batch and is\n   * reported through Node.js uncaught exception handling.\n   * @param {Node} node - The node to be spun up.\n   * @param {number} [timeout=10] - Timeout to wait in milliseconds. Block forever if negative. Don't wait if 0.\n   * @throws {Error} If the node is already spinning or native executor cleanup is still in progress.\n   * @return {undefined}\n   */\n  spin(timeout = 10) {\n    if (this.spinning) {\n      throw new Error('The node is already spinning.');\n    }\n    this.start(this.context.handle, timeout);\n    this._spinning = true;\n  }\n\n  /**\n   * Use spin().\n   * @deprecated, since 0.18.0\n   */\n  startSpinning(timeout) {\n    this.spin(timeout);\n  }\n\n  /**\n   * Terminate spinning - no further events will be received.\n   * Interrupts the native background wait, including an infinite spin timeout.\n   * Does not interrupt a JavaScript callback that is already executing.\n   * Reentrant calls during cleanup do not repeat teardown; starting a new spin\n   * must wait until cleanup has finished.\n   * @throws {Error} If the worker or native cleanup fails.\n   * @returns {undefined}\n   */\n  stop() {\n    this._dispatchGeneration++;\n    try {\n      super.stop();\n    } finally {\n      this._spinning = !super._isExecutorStopped();\n    }\n  }\n\n  /**\n   * Terminate spinning - no further events will be received.\n   * @returns {undefined}\n   * @deprecated since 0.18.0, Use stop().\n   */\n  stopSpinning() {\n    this._dispatchGeneration++;\n    try {\n      super.stop();\n    } finally {\n      this._spinning = !super._isExecutorStopped();\n    }\n  }\n\n  /**\n   * Spin the node and trigger the event loop to check for one incoming event. Thereafter the node\n   * will not received additional events until running additional calls to spin() or spinOnce().\n   * A synchronous callback exception stops the current ready batch and is thrown to the caller.\n   * @param {Node} node - The node to be spun.\n   * @param {number} [timeout=10] - Timeout to wait in milliseconds. Block forever if negative. Don't wait if 0.\n   * @throws {Error} If the node is already spinning or native executor cleanup is still in progress.\n   * @return {undefined}\n   */\n  spinOnce(timeout = 10) {\n    if (this.spinning) {\n      throw new Error('The node is already spinning.');\n    }\n    super.spinOnce(this.context.handle, timeout);\n  }\n\n  _registerEntity(kind, entity) {\n    return this._entityRegistry.register(kind, entity);\n  }\n\n  _destroyEntity(kind, entity) {\n    this._entityRegistry.destroy(kind, entity);\n  }\n\n  _validateOptions(options) {\n    if (\n      options !== undefined &&\n      (options === null || typeof options !== 'object')\n    ) {\n      throw new TypeValidationError('options', options, 'object', {\n        nodeName: this.name(),\n      });\n    }\n\n    if (options === undefined) {\n      return Node.getDefaultOptions();\n    }\n\n    if (options.enableTypedArray === undefined) {\n      options = Object.assign(options, { enableTypedArray: true });\n    }\n\n    if (options.qos === undefined) {\n      options = Object.assign(options, { qos: QoS.profileDefault });\n    }\n\n    if (options.isRaw === undefined) {\n      options = Object.assign(options, { isRaw: false });\n    }\n\n    if (options.serializationMode === undefined) {\n      options = Object.assign(options, { serializationMode: 'default' });\n    } else if (!isValidSerializationMode(options.serializationMode)) {\n      throw new ValidationError(\n        `Invalid serializationMode: ${options.serializationMode}. Valid modes are: 'default', 'plain', 'json'`,\n        {\n          code: 'INVALID_SERIALIZATION_MODE',\n          argumentName: 'serializationMode',\n          providedValue: options.serializationMode,\n          expectedType: \"'default' | 'plain' | 'json'\",\n          nodeName: this.name(),\n        }\n      );\n    }\n\n    return options;\n  }\n\n  /**\n   * Create a Timer.\n   * @param {bigint} period - The number representing period in nanoseconds.\n   * @param {function} callback - The callback to be called when the timer fires.\n   *   On distros with native support, the callback receives a `TimerInfo` object\n   *   describing the expected and actual call time.\n   * @param {object|Clock} [optionsOrClock] - Timer options or the clock which the timer gets time from.\n   *   Supported options: `{ autostart?: boolean }`.\n   * @param {Clock} [clock] - The clock which the timer gets time from when options are provided.\n   * @return {Timer} - An instance of Timer.\n   */\n  createTimer(period, callback, optionsOrClock = null, clock = null) {\n    let options = {};\n\n    if (optionsOrClock instanceof Clock.Clock) {\n      clock = optionsOrClock;\n    } else if (optionsOrClock === null || optionsOrClock === undefined) {\n      // Keep the 4th argument as the clock when the 3rd argument is omitted or explicitly null.\n    } else {\n      if (typeof optionsOrClock !== 'object' || Array.isArray(optionsOrClock)) {\n        throw new TypeValidationError(\n          'options',\n          optionsOrClock,\n          'object or Clock',\n          {\n            nodeName: this.name(),\n          }\n        );\n      }\n      options = optionsOrClock;\n    }\n\n    if (\n      arguments.length === 4 &&\n      clock !== null &&\n      !(clock instanceof Clock.Clock)\n    ) {\n      throw new TypeValidationError('clock', clock, 'Clock', {\n        nodeName: this.name(),\n      });\n    }\n\n    if (typeof period !== 'bigint') {\n      throw new TypeValidationError('period', period, 'bigint', {\n        nodeName: this.name(),\n      });\n    }\n    if (typeof callback !== 'function') {\n      throw new TypeValidationError('callback', callback, 'function', {\n        nodeName: this.name(),\n      });\n    }\n    if (\n      options.autostart !== undefined &&\n      typeof options.autostart !== 'boolean'\n    ) {\n      throw new TypeValidationError(\n        'options.autostart',\n        options.autostart,\n        'boolean',\n        {\n          nodeName: this.name(),\n        }\n      );\n    }\n\n    const timerClock = clock || this._clock;\n    const autostart = options.autostart ?? true;\n    let timerHandle = rclnodejs.createTimer(\n      timerClock.handle,\n      this.context.handle,\n      period,\n      autostart\n    );\n    let timer = new Timer(timerHandle, period, callback, timerClock);\n    debug('Finish creating timer, period = %d.', period);\n    return this._registerEntity('timers', timer);\n  }\n\n  /**\n   * Create a Rate.\n   *\n   * @param {number} hz - The frequency of the rate timer; default is 1 hz.\n   * @returns {Promise<Rate>} - Promise resolving to new instance of Rate.\n   */\n  async createRate(hz = 1) {\n    if (typeof hz !== 'number') {\n      throw new TypeValidationError('hz', hz, 'number', {\n        nodeName: this.name(),\n      });\n    }\n\n    const MAX_RATE_HZ_IN_MILLISECOND = 1000.0;\n    if (hz <= 0.0 || hz > MAX_RATE_HZ_IN_MILLISECOND) {\n      throw new RangeValidationError(\n        'hz',\n        hz,\n        `0.0 < hz <= ${MAX_RATE_HZ_IN_MILLISECOND}`,\n        {\n          nodeName: this.name(),\n        }\n      );\n    }\n\n    // lazy initialize rateTimerServer\n    if (!this._rateTimerServer) {\n      this._rateTimerServer = new Rates.RateTimerServer(this);\n      await this._rateTimerServer.init();\n    }\n\n    const period = Math.round(1000 / hz);\n    const timer = this._rateTimerServer.createTimer(BigInt(period) * 1000000n);\n    const rate = new Rates.Rate(hz, timer);\n\n    return rate;\n  }\n\n  /**\n   * Create a Publisher.\n   * @param {function|string|object} typeClass - The ROS message class,\n        OR a string representing the message class, e.g. 'std_msgs/msg/String',\n        OR an object representing the message class, e.g. {package: 'std_msgs', type: 'msg', name: 'String'}\n   * @param {string} topic - The name of the topic.\n   * @param {object} options - The options argument used to parameterize the publisher.\n   * @param {boolean} options.enableTypedArray - The topic will use TypedArray if necessary, default: true.\n   * @param {QoS} options.qos - ROS Middleware \"quality of service\" settings for the publisher, default: QoS.profileDefault.\n   * @param {QoSOverridingOptions} [options.qosOverridingOptions] - If provided, declares read-only ROS parameters\n   *  for the specified QoS policies (e.g. `qos_overrides./topic.publisher.depth`). These can be overridden at\n   *  startup via `--ros-args -p` or `--params-file`. If qos is a profile string, it will be resolved to a\n   *  mutable QoS object before overrides are applied.\n   * @param {PublisherEventCallbacks} eventCallbacks - The event callbacks for the publisher.\n   * @return {Publisher} - An instance of Publisher.\n   */\n  createPublisher(typeClass, topic, options, eventCallbacks) {\n    return this._createPublisher(\n      typeClass,\n      topic,\n      options,\n      Publisher,\n      eventCallbacks\n    );\n  }\n\n  _createPublisher(typeClass, topic, options, publisherClass, eventCallbacks) {\n    if (typeof typeClass === 'string' || typeof typeClass === 'object') {\n      typeClass = loader.loadInterface(typeClass);\n    }\n    options = this._validateOptions(options);\n\n    if (typeof typeClass !== 'function') {\n      throw new TypeValidationError('typeClass', typeClass, 'function', {\n        nodeName: this.name(),\n        entityType: 'publisher',\n      });\n    }\n    if (typeof topic !== 'string') {\n      throw new TypeValidationError('topic', topic, 'string', {\n        nodeName: this.name(),\n        entityType: 'publisher',\n      });\n    }\n    if (\n      eventCallbacks &&\n      !(eventCallbacks instanceof PublisherEventCallbacks)\n    ) {\n      throw new TypeValidationError(\n        'eventCallbacks',\n        eventCallbacks,\n        'PublisherEventCallbacks',\n        {\n          nodeName: this.name(),\n          entityType: 'publisher',\n          entityName: topic,\n        }\n      );\n    }\n\n    // Apply QoS overriding options if provided\n    if (options.qosOverridingOptions) {\n      const resolvedTopic = this.resolveTopicName(topic);\n      if (typeof options.qos === 'string' || !(options.qos instanceof QoS)) {\n        options.qos = _resolveQoS(options.qos);\n      }\n      declareQosParameters(\n        'publisher',\n        this,\n        resolvedTopic,\n        options.qos,\n        options.qosOverridingOptions\n      );\n    }\n\n    let publisher = publisherClass.createPublisher(\n      this,\n      typeClass,\n      topic,\n      options,\n      eventCallbacks\n    );\n    debug('Finish creating publisher, topic = %s.', topic);\n    return this._registerEntity('publishers', publisher);\n  }\n\n  /**\n   * This callback is called when a message is published\n   * @callback SubscriptionCallback\n   * @param {Object} message - The message published\n   * @see [Node.createSubscription]{@link Node#createSubscription}\n   * @see [Node.createPublisher]{@link Node#createPublisher}\n   * @see {@link Publisher}\n   * @see {@link Subscription}\n   */\n\n  /**\n   * Create a Subscription with optional content-filtering.\n   * @param {function|string|object} typeClass - The ROS message class,\n        OR a string representing the message class, e.g. 'std_msgs/msg/String',\n        OR an object representing the message class, e.g. {package: 'std_msgs', type: 'msg', name: 'String'}\n   * @param {string} topic - The name of the topic.\n   * @param {object} options - The options argument used to parameterize the subscription.\n   * @param {boolean} options.enableTypedArray - The topic will use TypedArray if necessary, default: true.\n   * @param {QoS} options.qos - ROS Middleware \"quality of service\" settings for the subscription, default: QoS.profileDefault.\n   * @param {boolean} options.isRaw - The topic is serialized when true, default: false.\n   * @param {string} [options.serializationMode='default'] - Controls message serialization format:\n   *  'default': Use native rclnodejs behavior (respects enableTypedArray setting),\n   *  'plain': Convert TypedArrays to regular arrays,\n   *  'json': Fully JSON-safe (handles TypedArrays, BigInt, etc.).\n   * @param {object} [options.contentFilter=undefined] - The content-filter, default: undefined.\n   *  Confirm that your RMW supports content-filtered topics before use. \n   * @param {string} options.contentFilter.expression - Specifies the criteria to select the data samples of\n   *  interest. It is similar to the WHERE part of an SQL clause.\n   * @param {string[]} [options.contentFilter.parameters=undefined] - Array of strings that give values to\n   *  the ‘parameters’ (i.e., \"%n\" tokens) in the filter_expression. The number of supplied parameters must\n   *  fit with the requested values in the filter_expression (i.e., the number of %n tokens). default: undefined.\n   * @param {QoSOverridingOptions} [options.qosOverridingOptions] - If provided, declares read-only ROS parameters\n   *  for the specified QoS policies (e.g. `qos_overrides./topic.subscription.depth`). These can be overridden at\n   *  startup via `--ros-args -p` or `--params-file`. If qos is a profile string, it will be resolved to a\n   *  mutable QoS object before overrides are applied.\n   * @param {SubscriptionCallback} callback - The callback to be call when receiving the topic subscribed. The topic will be an instance of null-terminated Buffer when options.isRaw is true.\n   * @param {SubscriptionEventCallbacks} eventCallbacks - The event callbacks for the subscription.\n   * @return {Subscription} - An instance of Subscription.\n   * @throws {ERROR} - May throw an RMW error if content-filter is malformed. \n   * @see {@link SubscriptionCallback}\n   * @see {@link https://www.omg.org/spec/DDS/1.4/PDF|Content-filter details at DDS 1.4 specification, Annex B}\n   */\n  createSubscription(typeClass, topic, options, callback, eventCallbacks) {\n    if (typeof typeClass === 'string' || typeof typeClass === 'object') {\n      typeClass = loader.loadInterface(typeClass);\n    }\n\n    if (typeof options === 'function') {\n      callback = options;\n      options = undefined;\n    }\n    options = this._validateOptions(options);\n\n    if (typeof typeClass !== 'function') {\n      throw new TypeValidationError('typeClass', typeClass, 'function', {\n        nodeName: this.name(),\n        entityType: 'subscription',\n      });\n    }\n    if (typeof topic !== 'string') {\n      throw new TypeValidationError('topic', topic, 'string', {\n        nodeName: this.name(),\n        entityType: 'subscription',\n      });\n    }\n    if (typeof callback !== 'function') {\n      throw new TypeValidationError('callback', callback, 'function', {\n        nodeName: this.name(),\n        entityType: 'subscription',\n        entityName: topic,\n      });\n    }\n    if (\n      eventCallbacks &&\n      !(eventCallbacks instanceof SubscriptionEventCallbacks)\n    ) {\n      throw new TypeValidationError(\n        'eventCallbacks',\n        eventCallbacks,\n        'SubscriptionEventCallbacks',\n        {\n          nodeName: this.name(),\n          entityType: 'subscription',\n          entityName: topic,\n        }\n      );\n    }\n\n    // Apply QoS overriding options if provided\n    if (options.qosOverridingOptions) {\n      const resolvedTopic = this.resolveTopicName(topic);\n      if (typeof options.qos === 'string' || !(options.qos instanceof QoS)) {\n        options.qos = _resolveQoS(options.qos);\n      }\n      declareQosParameters(\n        'subscription',\n        this,\n        resolvedTopic,\n        options.qos,\n        options.qosOverridingOptions\n      );\n    }\n\n    let subscription = Subscription.createSubscription(\n      this,\n      typeClass,\n      topic,\n      options,\n      callback,\n      eventCallbacks\n    );\n    debug('Finish creating subscription, topic = %s.', topic);\n    return this._registerEntity('subscriptions', subscription);\n  }\n\n  /**\n   * Create a Subscription that returns an RxJS Observable.\n   * This allows using reactive programming patterns with ROS 2 messages.\n   *\n   * @param {function|string|object} typeClass - The ROS message class,\n   *      OR a string representing the message class, e.g. 'std_msgs/msg/String',\n   *      OR an object representing the message class, e.g. {package: 'std_msgs', type: 'msg', name: 'String'}\n   * @param {string} topic - The name of the topic.\n   * @param {object} [options] - The options argument used to parameterize the subscription.\n   * @param {boolean} [options.enableTypedArray=true] - The topic will use TypedArray if necessary.\n   * @param {QoS} [options.qos=QoS.profileDefault] - ROS Middleware \"quality of service\" settings.\n   * @param {boolean} [options.isRaw=false] - The topic is serialized when true.\n   * @param {string} [options.serializationMode='default'] - Controls message serialization format.\n   * @param {object} [options.contentFilter] - The content-filter (if supported by RMW).\n   * @param {SubscriptionEventCallbacks} [eventCallbacks] - The event callbacks for the subscription.\n   * @return {ObservableSubscription} - An ObservableSubscription with an RxJS Observable.\n   */\n  createObservableSubscription(typeClass, topic, options, eventCallbacks) {\n    let observableSubscription = null;\n\n    const subscription = this.createSubscription(\n      typeClass,\n      topic,\n      options,\n      (message) => {\n        if (observableSubscription) {\n          observableSubscription._emit(message);\n        }\n      },\n      eventCallbacks\n    );\n\n    observableSubscription = new ObservableSubscription(subscription);\n    return observableSubscription;\n  }\n\n  /**\n   * Create a Client.\n   * @param {function|string|object} typeClass - The ROS message class,\n        OR a string representing the message class, e.g. 'std_msgs/msg/String',\n        OR an object representing the message class, e.g. {package: 'std_msgs', type: 'msg', name: 'String'}\n   * @param {string} serviceName - The service name to request.\n   * @param {object} options - The options argument used to parameterize the client.\n   * @param {boolean} options.enableTypedArray - The response will use TypedArray if necessary, default: true.\n   * @param {QoS} options.qos - ROS Middleware \"quality of service\" settings for the client, default: QoS.profileDefault.\n   * @return {Client} - An instance of Client.\n   */\n  createClient(typeClass, serviceName, options) {\n    if (typeof typeClass === 'string' || typeof typeClass === 'object') {\n      typeClass = loader.loadInterface(typeClass);\n    }\n    options = this._validateOptions(options);\n\n    if (typeof typeClass !== 'function') {\n      throw new TypeValidationError('typeClass', typeClass, 'function', {\n        nodeName: this.name(),\n        entityType: 'client',\n      });\n    }\n    if (typeof serviceName !== 'string') {\n      throw new TypeValidationError('serviceName', serviceName, 'string', {\n        nodeName: this.name(),\n        entityType: 'client',\n      });\n    }\n\n    let client = Client.createClient(\n      this.handle,\n      serviceName,\n      typeClass,\n      options\n    );\n    debug('Finish creating client, service = %s.', serviceName);\n    return this._registerEntity('clients', client);\n  }\n\n  /**\n   * This callback is called when a request is sent to service\n   * @callback RequestCallback\n   * @param {Object} request - The request sent to the service\n   * @param {Response} response - The response to client.\n        Use [response.send()]{@link Response#send} to send response object to client\n   * @return {undefined}\n   * @see [Node.createService]{@link Node#createService}\n   * @see [Client.sendRequest]{@link Client#sendRequest}\n   * @see {@link Client}\n   * @see {@link Service}\n   * @see {@link Response#send}\n   */\n\n  /**\n   * Create a Service.\n   * @param {function|string|object} typeClass - The ROS message class,\n        OR a string representing the message class, e.g. 'std_msgs/msg/String',\n        OR an object representing the message class, e.g. {package: 'std_msgs', type: 'msg', name: 'String'}\n   * @param {string} serviceName - The service name to offer.\n   * @param {object} options - The options argument used to parameterize the service.\n   * @param {boolean} options.enableTypedArray - The request will use TypedArray if necessary, default: true.\n   * @param {QoS} options.qos - ROS Middleware \"quality of service\" settings for the service, default: QoS.profileDefault.\n   * @param {RequestCallback} callback - The callback to be called when receiving request.\n   * @return {Service} - An instance of Service.\n   * @see {@link RequestCallback}\n   */\n  createService(typeClass, serviceName, options, callback) {\n    if (typeof typeClass === 'string' || typeof typeClass === 'object') {\n      typeClass = loader.loadInterface(typeClass);\n    }\n\n    if (typeof options === 'function') {\n      callback = options;\n      options = undefined;\n    }\n    options = this._validateOptions(options);\n\n    if (typeof typeClass !== 'function') {\n      throw new TypeValidationError('typeClass', typeClass, 'function', {\n        nodeName: this.name(),\n        entityType: 'service',\n      });\n    }\n    if (typeof serviceName !== 'string') {\n      throw new TypeValidationError('serviceName', serviceName, 'string', {\n        nodeName: this.name(),\n        entityType: 'service',\n      });\n    }\n    if (typeof callback !== 'function') {\n      throw new TypeValidationError('callback', callback, 'function', {\n        nodeName: this.name(),\n        entityType: 'service',\n        entityName: serviceName,\n      });\n    }\n\n    let service = Service.createService(\n      this.handle,\n      serviceName,\n      typeClass,\n      options,\n      callback\n    );\n    debug('Finish creating service, service = %s.', serviceName);\n    return this._registerEntity('services', service);\n  }\n\n  /**\n   * Create a ParameterClient for accessing parameters on a remote node.\n   * @param {string} remoteNodeName - The name of the remote node whose parameters to access.\n   * @param {object} [options] - Options for parameter client.\n   * @param {number} [options.timeout=5000] - Default timeout in milliseconds for service calls.\n   * @return {ParameterClient} - An instance of ParameterClient.\n   */\n  createParameterClient(remoteNodeName, options = {}) {\n    if (typeof remoteNodeName !== 'string' || remoteNodeName.trim() === '') {\n      throw new TypeError('Remote node name must be a non-empty string');\n    }\n\n    const parameterClient = new ParameterClient(this, remoteNodeName, options);\n    debug(\n      'Finish creating parameter client for remote node = %s.',\n      remoteNodeName\n    );\n    return this._registerEntity('parameterClients', parameterClient);\n  }\n\n  /**\n   * Create a ParameterWatcher for watching parameter changes on a remote node.\n   * @param {string} remoteNodeName - The name of the remote node whose parameters to watch.\n   * @param {string[]} parameterNames - Array of parameter names to watch.\n   * @param {object} [options] - Options for parameter watcher.\n   * @param {number} [options.timeout=5000] - Default timeout in milliseconds for service calls.\n   * @return {ParameterWatcher} - An instance of ParameterWatcher.\n   */\n  createParameterWatcher(remoteNodeName, parameterNames, options = {}) {\n    const watcher = new ParameterWatcher(\n      this,\n      remoteNodeName,\n      parameterNames,\n      options\n    );\n    debug(\n      'Finish creating parameter watcher for remote node = %s.',\n      remoteNodeName\n    );\n    this._parameterWatchers.push(watcher);\n\n    return watcher;\n  }\n\n  /**\n   * Create a guard condition.\n   * @param {Function} callback - The callback to be called when the guard condition is triggered.\n   * @return {GuardCondition} - An instance of GuardCondition.\n   */\n  createGuardCondition(callback) {\n    if (typeof callback !== 'function') {\n      throw new TypeValidationError('callback', callback, 'function', {\n        nodeName: this.name(),\n        entityType: 'guard_condition',\n      });\n    }\n\n    let guard = GuardCondition.createGuardCondition(callback, this.context);\n    debug('Finish creating guard condition');\n    return this._registerEntity('guards', guard);\n  }\n\n  /**\n   * Destroy all resource allocated by this node, including\n   * <code>Timer</code>s/<code>Publisher</code>s/<code>Subscription</code>s\n   * /<code>Client</code>s/<code>Service</code>s\n   * @return {undefined}\n   */\n  destroy() {\n    this._dispatchGeneration++;\n    if (this.spinning) {\n      this.stop();\n    }\n\n    this._entityRegistry.destroyAll();\n\n    this.context.onNodeDestroyed(this);\n\n    if (this._enableRosout) {\n      rclnodejs.finiRosoutPublisherForNode(this.handle);\n      this._enableRosout = false;\n    }\n\n    this.handle.release();\n    this._clock = null;\n\n    if (this._rateTimerServer) {\n      this._rateTimerServer.shutdown();\n      this._rateTimerServer = null;\n    }\n  }\n\n  /**\n   * Destroy a Publisher.\n   * @param {Publisher} publisher - The Publisher to be destroyed.\n   * @return {undefined}\n   */\n  destroyPublisher(publisher) {\n    if (!(publisher instanceof Publisher)) {\n      throw new TypeValidationError(\n        'publisher',\n        publisher,\n        'Publisher instance',\n        {\n          nodeName: this.name(),\n        }\n      );\n    }\n    this._destroyEntity('publishers', publisher);\n  }\n\n  /**\n   * Destroy a Subscription.\n   * @param {Subscription} subscription - The Subscription to be destroyed.\n   * @return {undefined}\n   */\n  destroySubscription(subscription) {\n    if (!(subscription instanceof Subscription)) {\n      throw new TypeValidationError(\n        'subscription',\n        subscription,\n        'Subscription instance',\n        {\n          nodeName: this.name(),\n        }\n      );\n    }\n    this._destroyEntity('subscriptions', subscription);\n  }\n\n  /**\n   * Destroy a Client.\n   * @param {Client} client - The Client to be destroyed.\n   * @return {undefined}\n   */\n  destroyClient(client) {\n    if (!(client instanceof Client)) {\n      throw new TypeValidationError('client', client, 'Client instance', {\n        nodeName: this.name(),\n      });\n    }\n    this._destroyEntity('clients', client);\n  }\n\n  /**\n   * Destroy a Service.\n   * @param {Service} service - The Service to be destroyed.\n   * @return {undefined}\n   */\n  destroyService(service) {\n    if (!(service instanceof Service)) {\n      throw new TypeValidationError('service', service, 'Service instance', {\n        nodeName: this.name(),\n      });\n    }\n    this._destroyEntity('services', service);\n  }\n\n  /**\n   * Destroy a ParameterClient.\n   * @param {ParameterClient} parameterClient - The ParameterClient to be destroyed.\n   * @return {undefined}\n   */\n  destroyParameterClient(parameterClient) {\n    if (!(parameterClient instanceof ParameterClient)) {\n      throw new TypeError('Invalid argument');\n    }\n    this._destroyEntity('parameterClients', parameterClient);\n  }\n\n  /**\n   * Destroy a ParameterWatcher.\n   * @param {ParameterWatcher} watcher - The ParameterWatcher to be destroyed.\n   * @return {undefined}\n   */\n  destroyParameterWatcher(watcher) {\n    if (!(watcher instanceof ParameterWatcher)) {\n      throw new TypeError('Invalid argument');\n    }\n    this._destroyEntity('parameterWatchers', watcher);\n  }\n\n  /**\n   * Create a ParameterEventHandler that monitors parameter changes on any node.\n   *\n   * Unlike {@link ParameterWatcher} which watches specific parameters on a single\n   * remote node, ParameterEventHandler can register callbacks for parameters on\n   * any node in the ROS 2 graph by subscribing to /parameter_events.\n   *\n   * @param {object} [options] - Options for the handler\n   * @param {object} [options.qos] - QoS profile for the parameter_events subscription\n   * @return {ParameterEventHandler} - An instance of ParameterEventHandler\n   * @see {@link ParameterEventHandler}\n   */\n  createParameterEventHandler(options = {}) {\n    const handler = new ParameterEventHandler(this, options);\n    debug('Created ParameterEventHandler on node=%s', this.name());\n    return this._registerEntity('parameterEventHandlers', handler);\n  }\n\n  /**\n   * Destroy a ParameterEventHandler.\n   * @param {ParameterEventHandler} handler - The handler to be destroyed.\n   * @return {undefined}\n   */\n  destroyParameterEventHandler(handler) {\n    if (!(handler instanceof ParameterEventHandler)) {\n      throw new TypeError('Invalid argument');\n    }\n    this._destroyEntity('parameterEventHandlers', handler);\n  }\n\n  /**\n   * Destroy a Timer.\n   * A destroyed timer is skipped even if it was already ready for dispatch.\n   * @param {Timer} timer - The Timer to be destroyed.\n   * @return {undefined}\n   */\n  destroyTimer(timer) {\n    if (!(timer instanceof Timer)) {\n      throw new TypeValidationError('timer', timer, 'Timer instance', {\n        nodeName: this.name(),\n      });\n    }\n    this._destroyEntity('timers', timer);\n  }\n\n  /**\n   * Destroy a guard condition.\n   * @param {GuardCondition} guard - The guard condition to be destroyed.\n   * @return {undefined}\n   */\n  destroyGuardCondition(guard) {\n    if (!(guard instanceof GuardCondition)) {\n      throw new TypeValidationError('guard', guard, 'GuardCondition instance', {\n        nodeName: this.name(),\n      });\n    }\n    this._destroyEntity('guards', guard);\n  }\n\n  /**\n   * Get the name of the node.\n   * @return {string}\n   */\n  name() {\n    return rclnodejs.getNodeName(this.handle);\n  }\n\n  /**\n   * Get the namespace of the node.\n   * @return {string}\n   */\n  namespace() {\n    return rclnodejs.getNamespace(this.handle);\n  }\n\n  /**\n   * Get the context in which this node was created.\n   * @return {Context}\n   */\n  get context() {\n    return this._context;\n  }\n\n  /**\n   * Get the nodes logger.\n   * @returns {Logger} - The logger for the node.\n   */\n  getLogger() {\n    return this._logger;\n  }\n\n  /**\n   * Get the clock used by the node.\n   * @returns {Clock} - The nodes clock.\n   */\n  getClock() {\n    return this._clock;\n  }\n\n  /**\n   * Get the current time using the node's clock.\n   * @returns {Timer} - The current time.\n   */\n  now() {\n    return this.getClock().now();\n  }\n\n  /**\n   * Get the list of published topics discovered by the provided node for the remote node name.\n   * @param {string} nodeName - The name of the node.\n   * @param {string} namespace - The name of the namespace.\n   * @param {boolean} noDemangle - If true topic names and types returned will not be demangled, default: false.\n   * @return {Array<{name: string, types: Array<string>}>} - An array of the names and types.\n   */\n  getPublisherNamesAndTypesByNode(nodeName, namespace, noDemangle = false) {\n    return rclnodejs.getPublisherNamesAndTypesByNode(\n      this.handle,\n      nodeName,\n      namespace,\n      noDemangle\n    );\n  }\n\n  /**\n   * Get the list of published topics discovered by the provided node for the remote node name.\n   * @param {string} nodeName - The name of the node.\n   * @param {string} namespace - The name of the namespace.\n   * @param {boolean} noDemangle - If true topic names and types returned will not be demangled, default: false.\n   * @return {Array<{name: string, types: Array<string>}>} - An array of the names and types.\n   */\n  getSubscriptionNamesAndTypesByNode(nodeName, namespace, noDemangle = false) {\n    return rclnodejs.getSubscriptionNamesAndTypesByNode(\n      this.handle,\n      nodeName,\n      namespace,\n      noDemangle\n    );\n  }\n\n  /**\n   * Get service names and types for which a remote node has servers.\n   * @param {string} nodeName - The name of the node.\n   * @param {string} namespace - The name of the namespace.\n   * @return {Array<{name: string, types: Array<string>}>} - An array of the names and types.\n   */\n  getServiceNamesAndTypesByNode(nodeName, namespace) {\n    return rclnodejs.getServiceNamesAndTypesByNode(\n      this.handle,\n      nodeName,\n      namespace\n    );\n  }\n\n  /**\n   * Get service names and types for which a remote node has clients.\n   * @param {string} nodeName - The name of the node.\n   * @param {string} namespace - The name of the namespace.\n   * @return {Array<{name: string, types: Array<string>}>} - An array of the names and types.\n   */\n  getClientNamesAndTypesByNode(nodeName, namespace) {\n    return rclnodejs.getClientNamesAndTypesByNode(\n      this.handle,\n      nodeName,\n      namespace\n    );\n  }\n\n  /**\n   * Get the list of topics discovered by the provided node.\n   * @param {boolean} noDemangle - If true topic names and types returned will not be demangled, default: false.\n   * @return {Array<{name: string, types: Array<string>}>} - An array of the names and types.\n   */\n  getTopicNamesAndTypes(noDemangle = false) {\n    return rclnodejs.getTopicNamesAndTypes(this.handle, noDemangle);\n  }\n\n  /**\n   * Get the list of services discovered by the provided node.\n   * @return {Array<{name: string, types: Array<string>}>} - An array of the names and types.\n   */\n  getServiceNamesAndTypes() {\n    return rclnodejs.getServiceNamesAndTypes(this.handle);\n  }\n\n  /**\n   * Return the number of action clients on an action.\n   * @param {string} actionName - The action name to query.\n   * @returns {number|null} The number of action clients, or null when the ROS distro is older than Lyrical.\n   */\n  countActionClients(actionName) {\n    if (typeof rclnodejs.countActionClients !== 'function') {\n      console.warn(\n        'countActionClients is not supported by this version of ROS 2'\n      );\n      return null;\n    }\n    return rclnodejs.countActionClients(\n      this.handle,\n      this._getValidatedActionName(actionName)\n    );\n  }\n\n  /**\n   * Return the number of action servers on an action.\n   * @param {string} actionName - The action name to query.\n   * @returns {number|null} The number of action servers, or null when the ROS distro is older than Lyrical.\n   */\n  countActionServers(actionName) {\n    if (typeof rclnodejs.countActionServers !== 'function') {\n      console.warn(\n        'countActionServers is not supported by this version of ROS 2'\n      );\n      return null;\n    }\n    return rclnodejs.countActionServers(\n      this.handle,\n      this._getValidatedActionName(actionName)\n    );\n  }\n\n  /**\n   * Return endpoint information for action clients on an action.\n   * @param {string} actionName - The action name to query.\n   * @returns {Array<ActionEndpointInfo>|null} The action clients, or null when the ROS distro is older than Rolling.\n   */\n  getActionClientsInfoByAction(actionName) {\n    if (typeof rclnodejs.getActionClientsInfoByAction !== 'function') {\n      console.warn(\n        'getActionClientsInfoByAction is not supported by this version of ROS 2'\n      );\n      return null;\n    }\n    return rclnodejs\n      .getActionClientsInfoByAction(\n        this.handle,\n        this._getValidatedActionName(actionName)\n      )\n      .map((info) => new ActionEndpointInfo(info));\n  }\n\n  /**\n   * Return endpoint information for action servers on an action.\n   * @param {string} actionName - The action name to query.\n   * @returns {Array<ActionEndpointInfo>|null} The action servers, or null when the ROS distro is older than Rolling.\n   */\n  getActionServersInfoByAction(actionName) {\n    if (typeof rclnodejs.getActionServersInfoByAction !== 'function') {\n      console.warn(\n        'getActionServersInfoByAction is not supported by this version of ROS 2'\n      );\n      return null;\n    }\n    return rclnodejs\n      .getActionServersInfoByAction(\n        this.handle,\n        this._getValidatedActionName(actionName)\n      )\n      .map((info) => new ActionEndpointInfo(info));\n  }\n\n  /**\n   * Return a list of publishers on a given topic.\n   *\n   * The returned parameter is a list of TopicEndpointInfo objects, where each will contain\n   * the node name, node namespace, topic type, topic endpoint's GID, and its QoS profile.\n   *\n   * When the `no_mangle` parameter is `true`, the provided `topic` should be a valid\n   * topic name for the middleware (useful when combining ROS with native middleware (e.g. DDS)\n   * apps).  When the `no_mangle` parameter is `false`, the provided `topic` should\n   * follow ROS topic name conventions.\n   *\n   * `topic` may be a relative, private, or fully qualified topic name.\n   *  A relative or private topic will be expanded using this node's namespace and name.\n   *  The queried `topic` is not remapped.\n   *\n   * @param {string} topic - The topic on which to find the publishers.\n   * @param {boolean} [noDemangle=false] - If `true`, `topic` needs to be a valid middleware topic\n   *                               name, otherwise it should be a valid ROS topic name. Defaults to `false`.\n   * @returns {Array} - list of publishers\n   */\n  getPublishersInfoByTopic(topic, noDemangle = false) {\n    return rclnodejs.getPublishersInfoByTopic(\n      this.handle,\n      this._getValidatedTopic(topic, noDemangle),\n      noDemangle\n    );\n  }\n\n  /**\n   * Return a list of subscriptions on a given topic.\n   *\n   * The returned parameter is a list of TopicEndpointInfo objects, where each will contain\n   * the node name, node namespace, topic type, topic endpoint's GID, and its QoS profile.\n   *\n   * When the `no_mangle` parameter is `true`, the provided `topic` should be a valid\n   * topic name for the middleware (useful when combining ROS with native middleware (e.g. DDS)\n   * apps).  When the `no_mangle` parameter is `false`, the provided `topic` should\n   * follow ROS topic name conventions.\n   *\n   * `topic` may be a relative, private, or fully qualified topic name.\n   *  A relative or private topic will be expanded using this node's namespace and name.\n   *  The queried `topic` is not remapped.\n   *\n   * @param {string} topic - The topic on which to find the subscriptions.\n   * @param {boolean} [noDemangle=false] -  If `true`, `topic` needs to be a valid middleware topic\n                                    name, otherwise it should be a valid ROS topic name. Defaults to `false`.\n   * @returns {Array} - list of subscriptions\n   */\n  getSubscriptionsInfoByTopic(topic, noDemangle = false) {\n    return rclnodejs.getSubscriptionsInfoByTopic(\n      this.handle,\n      this._getValidatedTopic(topic, noDemangle),\n      noDemangle\n    );\n  }\n\n  /**\n   * Return a list of clients on a given service.\n   *\n   * The returned parameter is a list of ServiceEndpointInfo objects, where each will contain\n   * the node name, node namespace, service type, service endpoint's GID, and its QoS profile.\n   *\n   * When the `no_mangle` parameter is `true`, the provided `service` should be a valid\n   * service name for the middleware (useful when combining ROS with native middleware (e.g. DDS)\n   * apps).  When the `no_mangle` parameter is `false`, the provided `service` should\n   * follow ROS service name conventions.\n   *\n   * `service` may be a relative, private, or fully qualified service name.\n   *  A relative or private service will be expanded using this node's namespace and name.\n   *  The queried `service` is not remapped.\n   *\n   * @param {string} service - The service on which to find the clients.\n   * @param {boolean} [noDemangle=false] - If `true`, `service` needs to be a valid middleware service\n   *                               name, otherwise it should be a valid ROS service name. Defaults to `false`.\n   * @returns {Array} - list of clients\n   */\n  getClientsInfoByService(service, noDemangle = false) {\n    if (DistroUtils.getDistroId() < DistroUtils.DistroId.LYRICAL) {\n      console.warn(\n        'getClientsInfoByService is not supported by this version of ROS 2'\n      );\n      return null;\n    }\n    return rclnodejs.getClientsInfoByService(\n      this.handle,\n      this._getValidatedServiceName(service, noDemangle),\n      noDemangle\n    );\n  }\n\n  /**\n   * Return a list of servers on a given service.\n   *\n   * The returned parameter is a list of ServiceEndpointInfo objects, where each will contain\n   * the node name, node namespace, service type, service endpoint's GID, and its QoS profile.\n   *\n   * When the `no_mangle` parameter is `true`, the provided `service` should be a valid\n   * service name for the middleware (useful when combining ROS with native middleware (e.g. DDS)\n   * apps).  When the `no_mangle` parameter is `false`, the provided `service` should\n   * follow ROS service name conventions.\n   *\n   * `service` may be a relative, private, or fully qualified service name.\n   *  A relative or private service will be expanded using this node's namespace and name.\n   *  The queried `service` is not remapped.\n   *\n   * @param {string} service - The service on which to find the servers.\n   * @param {boolean} [noDemangle=false] - If `true`, `service` needs to be a valid middleware service\n   *                               name, otherwise it should be a valid ROS service name. Defaults to `false`.\n   * @returns {Array} - list of servers\n   */\n  getServersInfoByService(service, noDemangle = false) {\n    if (DistroUtils.getDistroId() < DistroUtils.DistroId.LYRICAL) {\n      console.warn(\n        'getServersInfoByService is not supported by this version of ROS 2'\n      );\n      return null;\n    }\n    return rclnodejs.getServersInfoByService(\n      this.handle,\n      this._getValidatedServiceName(service, noDemangle),\n      noDemangle\n    );\n  }\n\n  /**\n   * Get the list of nodes discovered by the provided node.\n   * @return {Array<string>} - An array of the names.\n   */\n  getNodeNames() {\n    return this.getNodeNamesAndNamespaces().map((item) => item.name);\n  }\n\n  /**\n   * Get the list of nodes and their namespaces discovered by the provided node.\n   * @return {Array<{name: string, namespace: string}>} An array of the names and namespaces.\n   */\n  getNodeNamesAndNamespaces() {\n    return rclnodejs.getNodeNames(this.handle, /*getEnclaves=*/ false);\n  }\n\n  /**\n   * Get the list of nodes and their namespaces with enclaves discovered by the provided node.\n   * @return {Array<{name: string, namespace: string, enclave: string}>} An array of the names, namespaces and enclaves.\n   */\n  getNodeNamesAndNamespacesWithEnclaves() {\n    return rclnodejs.getNodeNames(this.handle, /*getEnclaves=*/ true);\n  }\n\n  /**\n   * Return the number of publishers on a given topic.\n   * @param {string} topic - The name of the topic.\n   * @returns {number} - Number of publishers on the given topic.\n   */\n  countPublishers(topic) {\n    let expandedTopic = rclnodejs.expandTopicName(\n      topic,\n      this.name(),\n      this.namespace()\n    );\n    rclnodejs.validateTopicName(expandedTopic);\n\n    return rclnodejs.countPublishers(this.handle, expandedTopic);\n  }\n\n  /**\n   * Return the number of subscribers on a given topic.\n   * @param {string} topic - The name of the topic.\n   * @returns {number} - Number of subscribers on the given topic.\n   */\n  countSubscribers(topic) {\n    let expandedTopic = rclnodejs.expandTopicName(\n      topic,\n      this.name(),\n      this.namespace()\n    );\n    rclnodejs.validateTopicName(expandedTopic);\n\n    return rclnodejs.countSubscribers(this.handle, expandedTopic);\n  }\n\n  /**\n   * Get the number of clients on a given service name.\n   * @param {string} serviceName - the service name\n   * @returns {Number}\n   */\n  countClients(serviceName) {\n    if (DistroUtils.getDistroId() <= DistroUtils.getDistroId('humble')) {\n      console.warn('countClients is not supported by this version of ROS 2');\n      return null;\n    }\n    return rclnodejs.countClients(this.handle, serviceName);\n  }\n\n  /**\n   * Get the number of services on a given service name.\n   * @param {string} serviceName - the service name\n   * @returns {Number}\n   */\n  countServices(serviceName) {\n    if (DistroUtils.getDistroId() <= DistroUtils.getDistroId('humble')) {\n      console.warn('countServices is not supported by this version of ROS 2');\n      return null;\n    }\n    return rclnodejs.countServices(this.handle, serviceName);\n  }\n\n  /**\n   * Get the list of parameter-overrides found on the commandline and\n   * in the NodeOptions.parameter_overrides property.\n   *\n   * @return {Array<Parameter>} - An array of Parameters.\n   */\n  getParameterOverrides() {\n    return Array.from(this._parameterOverrides.values());\n  }\n\n  /**\n   * Declare a parameter.\n   *\n   * Internally, register a parameter and it's descriptor.\n   * If a parameter-override exists, it's value will replace that of the parameter\n   * unless ignoreOverride is true.\n   * If the descriptor is undefined, then a ParameterDescriptor will be inferred\n   * from the parameter's state.\n   *\n   * If a parameter by the same name has already been declared then an Error is thrown.\n   * A parameter must be undeclared before attempting to redeclare it.\n   *\n   * @param {Parameter} parameter - Parameter to declare.\n   * @param {ParameterDescriptor} [descriptor] - Optional descriptor for parameter.\n   * @param {boolean} [ignoreOverride] - When true disregard any parameter-override that may be present.\n   * @return {Parameter} - The newly declared parameter.\n   */\n  declareParameter(parameter, descriptor, ignoreOverride = false) {\n    const parameters = this.declareParameters(\n      [parameter],\n      descriptor ? [descriptor] : [],\n      ignoreOverride\n    );\n    return parameters.length == 1 ? parameters[0] : null;\n  }\n\n  /**\n   * Declare a list of parameters.\n   *\n   * Internally register parameters with their corresponding descriptor one by one\n   * in the order they are provided. This is an atomic operation. If an error\n   * occurs the process halts and no further parameters are declared.\n   * Parameters that have already been processed are undeclared.\n   *\n   * While descriptors is an optional parameter, when provided there must be\n   * a descriptor for each parameter; otherwise an Error is thrown.\n   * If descriptors is not provided then a descriptor will be inferred\n   * from each parameter's state.\n   *\n   * When a parameter-override is available, the parameter's value\n   * will be replaced with that of the parameter-override unless ignoreOverrides\n   * is true.\n   *\n   * If a parameter by the same name has already been declared then an Error is thrown.\n   * A parameter must be undeclared before attempting to redeclare it.\n   *\n   * Prior to declaring the parameters each SetParameterEventCallback registered\n   * using setOnParameterEventCallback() is called in succession with the parameters\n   * list. Any SetParameterEventCallback that retuns does not return a successful\n   * result will cause the entire operation to terminate with no changes to the\n   * parameters. When all SetParameterEventCallbacks return successful then the\n   * list of parameters is updated.\n   *\n   * @param {Parameter[]} parameters - The parameters to declare.\n   * @param {ParameterDescriptor[]} [descriptors] - Optional descriptors,\n   *    a 1-1 correspondence with parameters.\n   * @param {boolean} ignoreOverrides - When true, parameter-overrides are\n   *    not considered, i.e.,ignored.\n   * @return {Parameter[]} - The declared parameters.\n   */\n  declareParameters(parameters, descriptors = [], ignoreOverrides = false) {\n    if (!Array.isArray(parameters)) {\n      throw new TypeValidationError('parameters', parameters, 'Array', {\n        nodeName: this.name(),\n      });\n    }\n    if (!Array.isArray(descriptors)) {\n      throw new TypeValidationError('descriptors', descriptors, 'Array', {\n        nodeName: this.name(),\n      });\n    }\n    if (descriptors.length > 0 && parameters.length !== descriptors.length) {\n      throw new ValidationError(\n        'Each parameter must have a corresponding ParameterDescriptor',\n        {\n          code: 'PARAMETER_DESCRIPTOR_MISMATCH',\n          argumentName: 'descriptors',\n          providedValue: descriptors.length,\n          expectedType: `Array with length ${parameters.length}`,\n          nodeName: this.name(),\n        }\n      );\n    }\n\n    const declaredDescriptors = [];\n    const declaredParameters = [];\n    const declaredParameterCollisions = [];\n    for (let i = 0; i < parameters.length; i++) {\n      let parameter =\n        !ignoreOverrides && this._parameterOverrides.has(parameters[i].name)\n          ? this._parameterOverrides.get(parameters[i].name)\n          : parameters[i];\n\n      // stop processing parameters that have already been declared\n      if (this._parameters.has(parameter.name)) {\n        declaredParameterCollisions.push(parameter);\n        continue;\n      }\n\n      // create descriptor for parameter if not provided\n      let descriptor =\n        descriptors.length > 0\n          ? descriptors[i]\n          : ParameterDescriptor.fromParameter(parameter);\n\n      descriptor.validate();\n\n      declaredDescriptors.push(descriptor);\n      declaredParameters.push(parameter);\n    }\n\n    if (declaredParameterCollisions.length > 0) {\n      const errorMsg =\n        declaredParameterCollisions.length == 1\n          ? `Parameter(${declaredParameterCollisions[0]}) already declared.`\n          : `Multiple parameters already declared, e.g., Parameter(${declaredParameterCollisions[0]}).`;\n      throw new Error(errorMsg);\n    }\n\n    // register descriptor\n    for (const descriptor of declaredDescriptors) {\n      this._parameterDescriptors.set(descriptor.name, descriptor);\n    }\n\n    const result = this._setParametersAtomically(declaredParameters, true);\n    if (!result.successful) {\n      // unregister descriptors\n      for (const descriptor of declaredDescriptors) {\n        this._parameterDescriptors.delete(descriptor.name);\n      }\n\n      throw new Error(result.reason);\n    }\n\n    return this.getParameters(declaredParameters.map((param) => param.name));\n  }\n\n  /**\n   * Undeclare a parameter.\n   *\n   * Readonly parameters can not be undeclared or updated.\n   * @param {string} name - Name of parameter to undeclare.\n   * @return {undefined} -\n   */\n  undeclareParameter(name) {\n    if (!this.hasParameter(name)) return;\n\n    const descriptor = this.getParameterDescriptor(name);\n    if (descriptor.readOnly) {\n      throw new Error(\n        `${name} parameter is read-only and can not be undeclared`\n      );\n    }\n\n    this._parameters.delete(name);\n    this._parameterDescriptors.delete(name);\n  }\n\n  /**\n   * Determine if a parameter has been declared.\n   * @param {string} name - name of parameter\n   * @returns {boolean} - Return true if parameter is declared; false otherwise.\n   */\n  hasParameter(name) {\n    return this._parameters.has(name);\n  }\n\n  /**\n   * Get a declared parameter by name.\n   *\n   * If unable to locate a declared parameter then a\n   * parameter with type == PARAMETER_NOT_SET is returned.\n   *\n   * @param {string} name - The name of the parameter.\n   * @return {Parameter} - The parameter.\n   */\n  getParameter(name) {\n    return this.getParameters([name])[0];\n  }\n\n  /**\n   * Get a list of parameters.\n   *\n   * Find and return the declared parameters.\n   * If no names are provided return all declared parameters.\n   *\n   * If unable to locate a declared parameter then a\n   * parameter with type == PARAMETER_NOT_SET is returned in\n   * it's place.\n   *\n   * @param {string[]} [names] - The names of the declared parameters\n   *    to find or null indicating to return all declared parameters.\n   * @return {Parameter[]} - The parameters.\n   */\n  getParameters(names = []) {\n    let params = [];\n\n    if (names.length == 0) {\n      // get all parameters\n      params = [...this._parameters.values()];\n      return params;\n    }\n\n    for (const name of names) {\n      const param = this.hasParameter(name)\n        ? this._parameters.get(name)\n        : new Parameter(name, ParameterType.PARAMETER_NOT_SET);\n\n      params.push(param);\n    }\n\n    return params;\n  }\n\n  /**\n   * Get the types of given parameters.\n   *\n   * Return the types of given parameters.\n   *\n   * @param {string[]} [names] - The names of the declared parameters.\n   * @return {Uint8Array} - The types.\n   */\n  getParameterTypes(names = []) {\n    let types = [];\n\n    for (const name of names) {\n      const descriptor = this._parameterDescriptors.get(name);\n      if (descriptor) {\n        types.push(descriptor.type);\n      }\n    }\n    return types;\n  }\n\n  /**\n   * Get the names of all declared parameters.\n   *\n   * @return {Array<string>} - The declared parameter names or empty array if\n   *    no parameters have been declared.\n   */\n  getParameterNames() {\n    return this.getParameters().map((param) => param.name);\n  }\n\n  /**\n   * Determine if a parameter descriptor exists.\n   *\n   * @param {string} name - The name of a descriptor to for.\n   * @return {boolean} - true if a descriptor has been declared; otherwise false.\n   */\n  hasParameterDescriptor(name) {\n    return !!this.getParameterDescriptor(name);\n  }\n\n  /**\n   * Get a declared parameter descriptor by name.\n   *\n   * If unable to locate a declared parameter descriptor then a\n   * descriptor with type == PARAMETER_NOT_SET is returned.\n   *\n   * @param {string} name - The name of the parameter descriptor to find.\n   * @return {ParameterDescriptor} - The parameter descriptor.\n   */\n  getParameterDescriptor(name) {\n    return this.getParameterDescriptors([name])[0];\n  }\n\n  /**\n   * Find a list of declared ParameterDescriptors.\n   *\n   * If no names are provided return all declared descriptors.\n   *\n   * If unable to locate a declared descriptor then a\n   * descriptor with type == PARAMETER_NOT_SET is returned in\n   * it's place.\n   *\n   * @param {string[]} [names] - The names of the declared parameter\n   *    descriptors to find or null indicating to return all declared descriptors.\n   * @return {ParameterDescriptor[]} - The parameter descriptors.\n   */\n  getParameterDescriptors(names = []) {\n    let descriptors = [];\n\n    if (names.length == 0) {\n      // get all parameters\n      descriptors = [...this._parameterDescriptors.values()];\n      return descriptors;\n    }\n\n    for (const name of names) {\n      let descriptor = this._parameterDescriptors.get(name);\n      if (!descriptor) {\n        descriptor = new ParameterDescriptor(\n          name,\n          ParameterType.PARAMETER_NOT_SET\n        );\n      }\n      descriptors.push(descriptor);\n    }\n\n    return descriptors;\n  }\n\n  /**\n   * Replace a declared parameter.\n   *\n   * The parameter being replaced must be a declared parameter who's descriptor\n   * is not readOnly; otherwise an Error is thrown.\n   *\n   * @param {Parameter} parameter - The new parameter.\n   * @return {rclnodejs.rcl_interfaces.msg.SetParameterResult} - The result of the operation.\n   */\n  setParameter(parameter) {\n    const results = this.setParameters([parameter]);\n    return results[0];\n  }\n\n  /**\n   * Replace a list of declared parameters.\n   *\n   * Declared parameters are replaced in the order they are provided and\n   * a ParameterEvent is published for each individual parameter change.\n   *\n   * Prior to setting the parameters each SetParameterEventCallback registered\n   * using setOnParameterEventCallback() is called in succession with the parameters\n   * list. Any SetParameterEventCallback that retuns does not return a successful\n   * result will cause the entire operation to terminate with no changes to the\n   * parameters. When all SetParameterEventCallbacks return successful then the\n   * list of parameters is updated.\n   *\n   * If an error occurs, the process is stopped and returned. Parameters\n   * set before an error remain unchanged.\n   *\n   * @param {Parameter[]} parameters - The parameters to set.\n   * @return {rclnodejs.rcl_interfaces.msg.SetParameterResult[]} - A list of SetParameterResult, one for each parameter that was set.\n   */\n  setParameters(parameters = []) {\n    return parameters.map((parameter) =>\n      this.setParametersAtomically([parameter])\n    );\n  }\n\n  /**\n   * Repalce a list of declared parameters atomically.\n   *\n   * Declared parameters are replaced in the order they are provided.\n   * A single ParameterEvent is published collectively for all changed\n   * parameters.\n   *\n   * Prior to setting the parameters each SetParameterEventCallback registered\n   * using setOnParameterEventCallback() is called in succession with the parameters\n   * list. Any SetParameterEventCallback that retuns does not return a successful\n   * result will cause the entire operation to terminate with no changes to the\n   * parameters. When all SetParameterEventCallbacks return successful then the\n   * list of parameters is updated.d\n   *\n   * If an error occurs, the process stops immediately. All parameters updated to\n   * the point of the error are reverted to their previous state.\n   *\n   * @param {Parameter[]} parameters - The parameters to set.\n   * @return {rclnodejs.rcl_interfaces.msg.SetParameterResult} - describes the result of setting 1 or more parameters.\n   */\n  setParametersAtomically(parameters = []) {\n    return this._setParametersAtomically(parameters);\n  }\n\n  /**\n   * Internal method for updating parameters atomically.\n   *\n   * Prior to setting the parameters each SetParameterEventCallback registered\n   * using setOnParameterEventCallback() is called in succession with the parameters\n   * list. Any SetParameterEventCallback that retuns does not return a successful\n   * result will cause the entire operation to terminate with no changes to the\n   * parameters. When all SetParameterEventCallbacks return successful then the\n   * list of parameters is updated.\n   *\n   * @param {Paramerter[]} parameters - The parameters to update.\n   * @param {boolean} declareParameterMode - When true parameters are being declared;\n   *    otherwise they are being changed.\n   * @return {SetParameterResult} - A single collective result.\n   */\n  _setParametersAtomically(parameters = [], declareParameterMode = false) {\n    // 1) PRE callbacks — pipeline: each callback receives the output of the previous\n    if (this._preSetParametersCallbacks.length > 0) {\n      for (const callback of this._preSetParametersCallbacks) {\n        const result = callback(parameters);\n        if (!Array.isArray(result)) {\n          return {\n            successful: false,\n            reason:\n              'pre-set parameters callback must return an array of Parameters',\n          };\n        }\n        parameters = result;\n        if (parameters.length === 0) {\n          return {\n            successful: false,\n            reason:\n              'parameter list is empty after pre-set callback; set rejected',\n          };\n        }\n      }\n    }\n\n    // 2) Validate\n    let result = this._validateParameters(parameters, declareParameterMode);\n    if (!result.successful) {\n      return result;\n    }\n\n    // give all SetParametersCallbacks a chance to veto this change\n    for (const callback of this._setParametersCallbacks) {\n      result = callback(parameters);\n      if (!result.successful) {\n        // a callback has vetoed a parameter change\n        return result;\n      }\n    }\n\n    // collectively track updates to parameters for use\n    // when publishing a ParameterEvent\n    const newParameters = [];\n    const changedParameters = [];\n    const deletedParameters = [];\n\n    for (const parameter of parameters) {\n      if (parameter.type == ParameterType.PARAMETER_NOT_SET) {\n        this.undeclareParameter(parameter.name);\n        deletedParameters.push(parameter);\n      } else {\n        this._parameters.set(parameter.name, parameter);\n        if (declareParameterMode) {\n          newParameters.push(parameter);\n        } else {\n          changedParameters.push(parameter);\n        }\n      }\n    }\n\n    // create ParameterEvent\n    const parameterEvent = new (loader.loadInterface(\n      PARAMETER_EVENT_MSG_TYPE\n    ))();\n\n    const { seconds, nanoseconds } = this._clock.now().secondsAndNanoseconds;\n    parameterEvent.stamp = {\n      sec: Number(seconds),\n      nanosec: Number(nanoseconds),\n    };\n\n    parameterEvent.node =\n      this.namespace() === '/'\n        ? this.namespace() + this.name()\n        : this.namespace() + '/' + this.name();\n\n    if (newParameters.length > 0) {\n      parameterEvent['new_parameters'] = newParameters.map((parameter) =>\n        parameter.toParameterMessage()\n      );\n    }\n    if (changedParameters.length > 0) {\n      parameterEvent['changed_parameters'] = changedParameters.map(\n        (parameter) => parameter.toParameterMessage()\n      );\n    }\n    if (deletedParameters.length > 0) {\n      parameterEvent['deleted_parameters'] = deletedParameters.map(\n        (parameter) => parameter.toParameterMessage()\n      );\n    }\n\n    // Publish ParameterEvent.\n    this._parameterEventPublisher.publish(parameterEvent);\n\n    // POST callbacks — for side effects after successful set\n    for (const callback of this._postSetParametersCallbacks) {\n      callback(parameters);\n    }\n\n    return {\n      successful: true,\n      reason: '',\n    };\n  }\n\n  /**\n   * This callback is called when declaring a parameter or setting a parameter.\n   * The callback is provided a list of parameters and returns a SetParameterResult\n   * to indicate approval or veto of the operation.\n   *\n   * @callback SetParametersCallback\n   * @param {Parameter[]} parameters - The message published\n   * @returns {rcl_interfaces.msg.SetParameterResult} -\n   *\n   * @see [Node.addOnSetParametersCallback]{@link Node#addOnSetParametersCallback}\n   * @see [Node.removeOnSetParametersCallback]{@link Node#removeOnSetParametersCallback}\n   */\n\n  /**\n   * Add a callback to the front of the list of callbacks invoked for parameter declaration\n   * and setting. No checks are made for duplicate callbacks.\n   *\n   * @param {SetParametersCallback} callback - The callback to add.\n   * @returns {undefined}\n   */\n  addOnSetParametersCallback(callback) {\n    this._setParametersCallbacks.unshift(callback);\n  }\n\n  /**\n   * Remove a callback from the list of SetParametersCallbacks.\n   * If the callback is not found the process is a nop.\n   *\n   * @param {SetParametersCallback} callback - The callback to be removed\n   * @returns {undefined}\n   */\n  removeOnSetParametersCallback(callback) {\n    const idx = this._setParametersCallbacks.indexOf(callback);\n    if (idx > -1) {\n      this._setParametersCallbacks.splice(idx, 1);\n    }\n  }\n\n  /**\n   * A callback invoked before parameter validation and setting.\n   * It receives the parameter list and must return a (possibly modified) parameter list.\n   *\n   * @callback PreSetParametersCallback\n   * @param {Parameter[]} parameters - The parameters about to be set.\n   * @returns {Parameter[]} - The modified parameter list to proceed with.\n   *\n   * @see [Node.addPreSetParametersCallback]{@link Node#addPreSetParametersCallback}\n   * @see [Node.removePreSetParametersCallback]{@link Node#removePreSetParametersCallback}\n   */\n\n  /**\n   * Add a callback invoked before parameter validation.\n   * The callback receives the parameter list and must return a (possibly modified)\n   * parameter list. This can be used to coerce, add, or remove parameters before\n   * they are validated and applied. If any pre-set callback returns an empty list,\n   * the set is rejected.\n   *\n   * @param {PreSetParametersCallback} callback - The callback to add.\n   * @returns {undefined}\n   */\n  addPreSetParametersCallback(callback) {\n    this._preSetParametersCallbacks.unshift(callback);\n  }\n\n  /**\n   * Remove a pre-set parameters callback.\n   *\n   * @param {PreSetParametersCallback} callback - The callback to remove.\n   * @returns {undefined}\n   */\n  removePreSetParametersCallback(callback) {\n    const idx = this._preSetParametersCallbacks.indexOf(callback);\n    if (idx > -1) {\n      this._preSetParametersCallbacks.splice(idx, 1);\n    }\n  }\n\n  /**\n   * A callback invoked after parameters have been successfully set.\n   * It receives the final parameter list. For side effects only (return value is ignored).\n   *\n   * @callback PostSetParametersCallback\n   * @param {Parameter[]} parameters - The parameters that were set.\n   * @returns {undefined}\n   *\n   * @see [Node.addPostSetParametersCallback]{@link Node#addPostSetParametersCallback}\n   * @see [Node.removePostSetParametersCallback]{@link Node#removePostSetParametersCallback}\n   */\n\n  /**\n   * Add a callback invoked after parameters are successfully set.\n   * The callback receives the final parameter list. Useful for triggering\n   * side effects (e.g., reconfiguring a component when a parameter changes).\n   *\n   * @param {PostSetParametersCallback} callback - The callback to add.\n   * @returns {undefined}\n   */\n  addPostSetParametersCallback(callback) {\n    this._postSetParametersCallbacks.unshift(callback);\n  }\n\n  /**\n   * Remove a post-set parameters callback.\n   *\n   * @param {PostSetParametersCallback} callback - The callback to remove.\n   * @returns {undefined}\n   */\n  removePostSetParametersCallback(callback) {\n    const idx = this._postSetParametersCallbacks.indexOf(callback);\n    if (idx > -1) {\n      this._postSetParametersCallbacks.splice(idx, 1);\n    }\n  }\n\n  /**\n   * Get the fully qualified name of the node.\n   *\n   * @returns {string} - String containing the fully qualified name of the node.\n   */\n  getFullyQualifiedName() {\n    return rclnodejs.getFullyQualifiedName(this.handle);\n  }\n\n  /**\n   * Get the RMW implementation identifier\n   * @returns {string} - The RMW implementation identifier.\n   */\n  getRMWImplementationIdentifier() {\n    return rclnodejs.getRMWImplementationIdentifier();\n  }\n\n  /**\n   * Return a topic name expanded and remapped.\n   * @param {string} topicName - Topic name to be expanded and remapped.\n   * @param {boolean} [onlyExpand=false] - If `true`, remapping rules won't be applied.\n   * @returns {string} - A fully qualified topic name.\n   */\n  resolveTopicName(topicName, onlyExpand = false) {\n    if (typeof topicName !== 'string') {\n      throw new TypeValidationError('topicName', topicName, 'string', {\n        nodeName: this.name(),\n      });\n    }\n    return rclnodejs.resolveName(\n      this.handle,\n      topicName,\n      onlyExpand,\n      /*isService=*/ false\n    );\n  }\n\n  /**\n   * Return a service name expanded and remapped.\n   * @param {string} service - Service name to be expanded and remapped.\n   * @param {boolean} [onlyExpand=false] - If `true`, remapping rules won't be applied.\n   * @returns {string} - A fully qualified service name.\n   */\n  resolveServiceName(service, onlyExpand = false) {\n    if (typeof service !== 'string') {\n      throw new TypeValidationError('service', service, 'string', {\n        nodeName: this.name(),\n      });\n    }\n    return rclnodejs.resolveName(\n      this.handle,\n      service,\n      onlyExpand,\n      /*isService=*/ true\n    );\n  }\n\n  // returns on 1st error or result {successful, reason}\n  _validateParameters(parameters = [], declareParameterMode = false) {\n    for (const parameter of parameters) {\n      // detect invalid parameter\n      try {\n        parameter.validate();\n      } catch {\n        return {\n          successful: false,\n          reason: `Invalid ${parameter.name}`,\n        };\n      }\n\n      // detect undeclared parameter\n      if (!this.hasParameterDescriptor(parameter.name)) {\n        return {\n          successful: false,\n          reason: `Parameter ${parameter.name} has not been declared`,\n        };\n      }\n\n      // detect readonly parameter that can not be updated\n      const descriptor = this.getParameterDescriptor(parameter.name);\n      if (!declareParameterMode && descriptor.readOnly) {\n        return {\n          successful: false,\n          reason: `Parameter ${parameter.name} is readonly`,\n        };\n      }\n\n      // validate parameter against descriptor if not an undeclare action\n      if (parameter.type != ParameterType.PARAMETER_NOT_SET) {\n        try {\n          descriptor.validateParameter(parameter);\n        } catch {\n          return {\n            successful: false,\n            reason: `Parameter ${parameter.name} does not  readonly`,\n          };\n        }\n      }\n    }\n\n    return {\n      successful: true,\n      reason: null,\n    };\n  }\n\n  // Get a Map(nodeName->Parameter[]) of CLI parameter args that\n  // apply to 'this' node, .e.g., -p mynode:foo:=bar -p hello:=world\n  _getNativeParameterOverrides() {\n    const overrides = new Map();\n\n    // Get native parameters from rcl context->global_arguments.\n    // rclnodejs returns an array of objects, 1 for each node e.g., -p my_node:foo:=bar,\n    // and a node named '/**' for global parameter rules,\n    // i.e., does not include a node identifier, e.g., -p color:=red\n    // {\n    //   name: string // node name\n    //   parameters[] = {\n    //     name: string\n    //     type: uint\n    //     value: object\n    // }\n    const cliParamOverrideData = rclnodejs.getParameterOverrides(\n      this.context.handle\n    );\n\n    // convert native CLI parameterOverrides to Map<nodeName,Array<ParameterOverride>>\n    const cliParamOverrides = new Map();\n    if (cliParamOverrideData) {\n      for (let nodeParamData of cliParamOverrideData) {\n        const nodeName = nodeParamData.name;\n        const nodeParamOverrides = [];\n        for (let paramData of nodeParamData.parameters) {\n          const paramOverride = new Parameter(\n            paramData.name,\n            paramData.type,\n            paramData.value\n          );\n          nodeParamOverrides.push(paramOverride);\n        }\n        cliParamOverrides.set(nodeName, nodeParamOverrides);\n      }\n    }\n\n    // collect global CLI global parameters, name == /**\n    let paramOverrides = cliParamOverrides.get('/**'); // array of ParameterOverrides\n    if (paramOverrides) {\n      for (const parameter of paramOverrides) {\n        overrides.set(parameter.name, parameter);\n      }\n    }\n\n    // merge CLI node parameterOverrides with global parameterOverrides, replace existing\n    paramOverrides = cliParamOverrides.get(this.name()); // array of ParameterOverrides\n    if (paramOverrides) {\n      for (const parameter of paramOverrides) {\n        overrides.set(parameter.name, parameter);\n      }\n    }\n\n    return overrides;\n  }\n\n  /**\n   * Invokes the callback with a raw message of the given type. After the callback completes\n   * the message will be destroyed.\n   * @param {function} Type - Message type to create.\n   * @param {function} callback - Callback to invoke. First parameter will be the raw message,\n   * and the second is a function to retrieve the deserialized message.\n   * @returns {undefined}\n   */\n  _runWithMessageType(Type, callback) {\n    let message = new Type();\n    let rawMessage = message.toRawROS();\n\n    try {\n      callback(rawMessage, () => {\n        let result = new Type();\n        result.deserialize(message.refObject);\n\n        return result;\n      });\n    } finally {\n      Type.destroyRawROS(message);\n    }\n  }\n\n  _addActionClient(actionClient) {\n    this._registerEntity('actionClients', actionClient);\n  }\n\n  _addActionServer(actionServer) {\n    this._registerEntity('actionServers', actionServer);\n  }\n\n  // Unlike topic/service queries, the queried action name is not remapped.\n  _getValidatedActionName(actionName) {\n    const fullyQualifiedActionName = rclnodejs.expandTopicName(\n      actionName,\n      this.name(),\n      this.namespace()\n    );\n    validateFullTopicName(fullyQualifiedActionName);\n    return fullyQualifiedActionName;\n  }\n\n  _getValidatedTopic(topicName, noDemangle) {\n    if (noDemangle) {\n      return topicName;\n    }\n    const fqTopicName = rclnodejs.expandTopicName(\n      topicName,\n      this.name(),\n      this.namespace()\n    );\n    validateFullTopicName(fqTopicName);\n    return rclnodejs.remapTopicName(this.handle, fqTopicName);\n  }\n\n  _getValidatedServiceName(serviceName, noDemangle) {\n    if (typeof serviceName !== 'string') {\n      throw new TypeValidationError('serviceName', serviceName, 'string', {\n        nodeName: this.name(),\n      });\n    }\n\n    if (noDemangle) {\n      return serviceName;\n    }\n\n    const resolvedServiceName = this.resolveServiceName(serviceName);\n    rclnodejs.validateTopicName(resolvedServiceName);\n    return resolvedServiceName;\n  }\n}\n\n/**\n * Create an Options instance initialized with default values.\n * @returns {Options} - The new initialized instance.\n * @static\n * @example\n * {\n *   enableTypedArray: true,\n *   isRaw: false,\n *   qos: QoS.profileDefault,\n *   contentFilter: undefined,\n *   serializationMode: 'default',\n * }\n */\nNode.getDefaultOptions = function () {\n  return {\n    enableTypedArray: true,\n    isRaw: false,\n    qos: QoS.profileDefault,\n    contentFilter: undefined,\n    serializationMode: 'default',\n  };\n};\n\nexport default Node;\n","// Copyright (c) 2020 Wayne Parrott. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport rclnodejs from './native_loader.js';\nimport Logging from './logging.js';\nimport Publisher from './publisher.js';\n\n/**\n * A publisher that sends messages only when activated.\n * This implementation is based on the\n * {@link https://github.com/ros2/rclcpp/blob/master/rclcpp_lifecycle/include/rclcpp_lifecycle/lifecycle_publisher.hpp|rclcpp LifecyclePublisher class}.\n *\n * @hideconstructor\n */\nclass LifecyclePublisher extends Publisher {\n  constructor(handle, typeClass, topic, options) {\n    super(handle, typeClass, /*topic=*/ '', options);\n\n    this._enabled = false;\n    this._logger = Logging.getLogger('LifecyclePublisher');\n  }\n\n  /**\n   * Publish a message only when activated; otherwise do nothing (nop);\n   *\n   * @param {object|Buffer} message - The message to be sent, could be kind of JavaScript message generated from .msg\n   *                                  or be a Buffer for a raw message.\n   * @returns {undefined}\n   */\n  publish(message) {\n    if (!this._enabled) {\n      this._logger.warn(\n        `Trying to publish message on the topic ${this.topic}, but the publisher is not activated`\n      );\n\n      return;\n    }\n\n    return super.publish(message);\n  }\n\n  /**\n   * Enables communications; publish() will now send messages.\n   * @returns {unknown} Void return.\n   */\n  activate() {\n    this._enabled = true;\n  }\n\n  /**\n   * Disable communications; publish() will not send messages.\n   * @returns {unknown} Void return.\n   */\n  deactivate() {\n    this._enabled = false;\n  }\n\n  /**\n   * Determine if communications are enabled, i.e., activated, or\n   * disabled, i.e., deactivated.\n   * @returns {boolean} True if activated; otherwise false.\n   */\n  isActivated() {\n    return this._enabled;\n  }\n\n  /**\n   * A lifecycle-node activation notice.\n   * @returns {unknown} Void return.\n   */\n  onActivate() {\n    this.activate();\n  }\n\n  /**\n   * A lifecycle-node deactivation notice.\n   * @returns {unknown} Void return.\n   */\n  onDeactivate() {\n    this.deactivate();\n  }\n\n  static createPublisher(node, typeClass, topic, options) {\n    let type = typeClass.type();\n    let handle = rclnodejs.createPublisher(\n      node.handle,\n      type.pkgName,\n      type.subFolder,\n      type.interfaceName,\n      topic,\n      options.qos\n    );\n\n    return new LifecyclePublisher(handle, typeClass, topic, options);\n  }\n}\n\nexport default LifecyclePublisher;\n","// Copyright (c) 2020 Wayne Parrott. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport rclnodejs from './native_loader.js';\nimport LifecyclePublisher from './lifecycle_publisher.js';\nimport loader from './interface_loader.js';\nimport Context from './context.js';\nimport Node from './node.js';\nimport NodeOptions from './node_options.js';\nimport Service from './service.js';\nimport { ValidationError } from './errors.js';\n\nconst SHUTDOWN_TRANSITION_LABEL =\n  rclnodejs.getLifecycleShutdownTransitionLabel();\n\n// An instance of State message constructor used for accessing State\n// state machine constants. This interface is lazy initialized at runtime.\nlet StateInterface;\n\n// An instance of Transition message constructor used for accessing Transition\n// state machine constants. This interface is lazy initialized at runtime.\nlet TransitionInterface;\n\nfunction getStateInterface() {\n  if (!StateInterface) {\n    StateInterface = loader.loadInterface('lifecycle_msgs/msg/State');\n  }\n  return StateInterface;\n}\n\nfunction getTransitionInterface() {\n  if (!TransitionInterface) {\n    TransitionInterface = loader.loadInterface('lifecycle_msgs/msg/Transition');\n  }\n  return TransitionInterface;\n}\n\n/**\n * @typedef SerializedState\n * @type {object}\n * @property {number} id - code identifying the type of this state.\n * @property {string} label - readable name of this state.\n */\n\n/**\n * The state of the lifecycle state model.\n */\nclass State {\n  /**\n   * Create a state.\n   * @param {number} id - The id value.\n   * @param {string} label - The label value.\n   */\n  constructor(id, label) {\n    this.id = id;\n    this.label = label;\n  }\n\n  /**\n   * Create a State from a SerializedState\n   * @param {SerializedState} aSerializedState - The state object.\n   * @returns {State} The State converted from a SerializdState\n   * @private\n   */\n  static fromSerializedState(aSerializedState) {\n    return new State(aSerializedState.id, aSerializedState.label);\n  }\n}\n\n/**\n * The intermediate state of the lifecycle state model during a state\n * transition.\n */\nclass Transition extends State {}\n\n/**\n * Describes a state transition.\n */\nclass TransitionDescription {\n  /**\n   * Create a transition description.\n   *\n   * @param {Transition} transition - The transition\n   * @param {State} startState - The initial\n   * @param {State} goalState - The target state of a transition activity\n   */\n  constructor(transition, startState, goalState) {\n    this.transition = transition;\n    this.startState = startState;\n    this.goalState = goalState;\n  }\n}\n\n/**\n * The values returned by TransitionCallback.\n * @readonly\n * @enum {number}\n */\nconst CallbackReturnCode = {\n  get SUCCESS() {\n    return getTransitionInterface().TRANSITION_CALLBACK_SUCCESS;\n  },\n  get FAILURE() {\n    return getTransitionInterface().TRANSITION_CALLBACK_FAILURE;\n  },\n  get ERROR() {\n    return getTransitionInterface().TRANSITION_CALLBACK_ERROR;\n  },\n};\nObject.freeze(CallbackReturnCode);\n\n/**\n * A ValueHolder for a CallbackReturnCode.\n */\nclass CallbackReturnValue {\n  /**\n   * Creates a new instance.\n   *\n   * @param {number} [value=CallbackReturnCode.SUCCESS] - The value property.\n   */\n  constructor(value = CallbackReturnCode.SUCCESS) {\n    this._value = value;\n    this._errorMsg = null;\n  }\n\n  /**\n   * Access the callbackReturnCode.\n   * @returns {number} The CallbackReturnCode.\n   */\n  get value() {\n    return this._value;\n  }\n\n  set value(value) {\n    this._value = value;\n  }\n\n  /**\n   * Access an optional error message when value is not SUCCESS.\n   */\n  get errorMsg() {\n    return this._errorMsg;\n  }\n\n  /**\n   * Assign the error message.\n   * @param {string} msg - The error message.\n   * @returns {unknown} void.\n   */\n  set errorMsg(msg) {\n    this._errorMsg = msg;\n  }\n\n  /**\n   * Overrides Object.valueOf() to return the 'value' property.\n   * @returns {number} The property value.\n   */\n  valueOf() {\n    return this.value;\n  }\n\n  /**\n   * A predicate to test if the value is SUCCESS.\n   * @returns {boolean} Return true if the value is SUCCESS; otherwise return false.\n   */\n  isSuccess() {\n    return this.value === CallbackReturnCode.SUCCESS;\n  }\n\n  /**\n   * A predicate to test if the value is FAILURE.\n   * @returns {boolean} Return true if the value is FAILURE; otherwise return false.\n   */\n  isFailure() {\n    return this.value === CallbackReturnCode.FAILURE;\n  }\n\n  /**\n   * A predicate to test if the value is ERROR.\n   * @returns {boolean} Return true if the value is ERROR; otherwise return false.\n   */\n  isError() {\n    return this.value === CallbackReturnCode.ERROR;\n  }\n\n  /**\n   * A predicate to test if an error message has been assigned.\n   * @returns {boolean} Return true if an error message has been assigned; otherwise return false.\n   */\n  hasErrorMsg() {\n    return !this.isSuccess() && this._errorMsg;\n  }\n}\n\n/**\n * This callback is invoked when LifecycleNode is transitioning to a new state.\n * @callback TransitionCallback\n * @param {State} previousState - The previous node lifecycle state.\n * @return {CallbackReturnCode} - The result of the callback.\n *\n * @see [LifecycleNode.registerOnConfigure]{@link LifecycleNode#registerOnConfigure}\n * @see [LifecycleNode.registerOnCleanup]{@link LifecycleNode#registerOnCleanup}\n * @see [LifecycleNode.registerOnActivate]{@link LifecycleNode#registerOnActivate}\n * @see [LifecycleNode.registerOnDeactivate]{@link LifecycleNode#registerOnDeactivate}\n * @see [LifecycleNode.registerOnShutdown]{@link LifecycleNode#registerOnShutdown}\n * @see [LifecycleNode.registerOnError]{@link LifecycleNode#registerOnError}\n */\n\n/**\n * A ROS2 managed Node that implements a well-defined life-cycle state model using the\n * {@link https://github.com/ros2/rcl/tree/master/rcl_lifecycle|ros2 client library (rcl) lifecyle api}.\n * @extends Node\n *\n * This class implments the ROS2 life-cycle state-machine defined by the\n * {@link https://github.com/ros2/rclcpp/tree/master/rclcpp_lifecycle}|ROS2 Managed Nodes Design}\n * and parallels the {@link https://github.com/ros2/rclcpp/tree/master/rclcpp_lifecycle|rclcpp lifecycle node }\n * implementation.\n *\n * The design consists of four primary lifecycle states:\n *   UNCONFIGURED\n *   INACTIVE\n *   ACTIVE\n *   FINALIZED.\n *\n * Transitioning between states is accomplished using an action api:\n *   configure()\n *   activate()\n *   deactivate(),\n *   cleanup()\n *   shutdown()\n *\n * During a state transition, the state-machine is in one of the\n * intermediate transitioning states:\n *   CONFIGURING\n *   ACTIVATING\n *   DEACTIVATING\n *   CLEANINGUP\n *   SHUTTING_DOWN\n *   ERROR_PROCESSING\n *\n * Messaging:\n * State changes are published on the '<node_name>/transition_event' topic.\n * Lifecycle service interfaces are also implemented.\n *\n * You can introduce your own state specific behaviors in the form of a\n * {@link TransitionCallback} functions that you register using:\n *   registerOnConfigure(cb)\n *   registerOnActivate(cb)\n *   registerOnDeactivate(cb)\n *   registerOnCleanup(cb)\n *   registerOnShutdown(cb)\n *   registerOnError(cb)\n */\n\nclass LifecycleNode extends Node {\n  /**\n   * Create a managed Node that implements a well-defined life-cycle state\n   * model using the {@link https://github.com/ros2/rcl/tree/master/rcl_lifecycle|ros2 client library (rcl) lifecyle api}.\n   * @param {string} nodeName - The name used to register in ROS.\n   * @param {string} [namespace=''] - The namespace used in ROS.\n   * @param {Context} [context=Context.defaultContext()] - The context to create the node in.\n   * @param {NodeOptions} [options=NodeOptions.defaultOptions] - The options to configure the new node behavior.\n   * @param {boolean} [enableCommunicationsInterface=true] - Enable lifecycle service interfaces, e.g., GetState.\n   * @throws {Error} If the given context is not registered.\n   */\n  constructor(\n    nodeName,\n    namespace = '',\n    context = Context.defaultContext(),\n    options = NodeOptions.defaultOptions,\n    enableCommunicationInterface = true\n  ) {\n    super(nodeName, namespace, context, options);\n    this.init(enableCommunicationInterface);\n  }\n\n  init(enableCommunicationInterface) {\n    // initialize native handle to rcl_lifecycle_state_machine\n    this._stateMachineHandle = rclnodejs.createLifecycleStateMachine(\n      this.handle,\n      enableCommunicationInterface,\n      this._clock.handle\n    );\n\n    // initialize Map<transitionId,TransitionCallback>\n    this._callbackMap = new Map();\n\n    if (!enableCommunicationInterface) {\n      // do not create lifecycle services\n      return;\n    }\n\n    // Setup and register the 4 native rcl lifecycle services thar are\n    // part of _stateMachineHandle.\n    let srvHandleObj = rclnodejs.getLifecycleSrvNameAndHandle(\n      this._stateMachineHandle,\n      'srv_get_state'\n    );\n    let service = new Service(\n      this.handle,\n      srvHandleObj.handle,\n      srvHandleObj.name,\n      loader.loadInterface('lifecycle_msgs/srv/GetState'),\n      this._validateOptions(undefined),\n      (request, response) => this._onGetState(request, response)\n    );\n    this._registerEntity('services', service);\n\n    srvHandleObj = rclnodejs.getLifecycleSrvNameAndHandle(\n      this._stateMachineHandle,\n      'srv_get_available_states'\n    );\n    service = new Service(\n      this.handle,\n      srvHandleObj.handle,\n      srvHandleObj.name,\n      loader.loadInterface('lifecycle_msgs/srv/GetAvailableStates'),\n      this._validateOptions(undefined),\n      (request, response) => this._onGetAvailableStates(request, response)\n    );\n    this._registerEntity('services', service);\n\n    srvHandleObj = rclnodejs.getLifecycleSrvNameAndHandle(\n      this._stateMachineHandle,\n      'srv_get_available_transitions'\n    );\n    service = new Service(\n      this.handle,\n      srvHandleObj.handle,\n      srvHandleObj.name,\n      loader.loadInterface('lifecycle_msgs/srv/GetAvailableTransitions'),\n      this._validateOptions(undefined),\n      (request, response) => this._onGetAvailableTransitions(request, response)\n    );\n    this._registerEntity('services', service);\n\n    srvHandleObj = rclnodejs.getLifecycleSrvNameAndHandle(\n      this._stateMachineHandle,\n      'srv_change_state'\n    );\n    service = new Service(\n      this.handle,\n      srvHandleObj.handle,\n      srvHandleObj.name,\n      loader.loadInterface('lifecycle_msgs/srv/ChangeState'),\n      this._validateOptions(undefined),\n      (request, response) => this._onChangeState(request, response)\n    );\n    this._registerEntity('services', service);\n  }\n\n  /**\n   * Create a LifecyclePublisher.\n   * @param {function|string|object} typeClass - The ROS message class,\n        OR a string representing the message class, e.g. 'std_msgs/msg/String',\n        OR an object representing the message class, e.g. {package: 'std_msgs', type: 'msg', name: 'String'}\n   * @param {string} topic - The name of the topic.\n   * @param {object} options - The options argument used to parameterize the publisher.\n   * @param {boolean} options.enableTypedArray - The topic will use TypedArray if necessary, default: true.\n   * @param {QoS} options.qos - ROS Middleware \"quality of service\" settings for the publisher, default: QoS.profileDefault.\n   * @return {LifecyclePublisher} - An instance of LifecyclePublisher.\n   */\n  createLifecyclePublisher(typeClass, topic, options) {\n    return this._createPublisher(typeClass, topic, options, LifecyclePublisher);\n  }\n\n  /**\n   * Access the current lifecycle state.\n   * @returns {State} The current state.\n   */\n  get currentState() {\n    let currentStateObj = rclnodejs.getCurrentLifecycleState(\n      this._stateMachineHandle\n    );\n    return State.fromSerializedState(currentStateObj);\n  }\n\n  /**\n   * Retrieve all registered states of the state-machine.\n   * @returns {State[]} The states.\n   */\n  get availableStates() {\n    let stateObjs = rclnodejs.getLifecycleStates(this._stateMachineHandle);\n    let states = stateObjs.map(\n      (stateObj) => new State(stateObj.id, stateObj.label)\n    );\n    return states;\n  }\n\n  /**\n   * Retrieve all registered transitions of the state-machine.\n   *\n   * @returns {TransitionDescription[]} The registered TransitionDescriptions.\n   */\n  get transitions() {\n    let transitionObjs = rclnodejs.getLifecycleTransitions(\n      this._stateMachineHandle\n    );\n    let transitions = transitionObjs.map((transitionDescObj) => {\n      let transition = new Transition(\n        transitionDescObj.transition.id,\n        transitionDescObj.transition.label\n      );\n      let startState = new State(\n        transitionDescObj.start_state.id,\n        transitionDescObj.start_state.label\n      );\n      let goalState = new State(\n        transitionDescObj.goal_state.id,\n        transitionDescObj.goal_state.label\n      );\n      return new TransitionDescription(transition, startState, goalState);\n    });\n    return transitions;\n  }\n\n  /**\n   * Retrieve the valid transitions available from the current state of the\n   * state-machine.\n   *\n   * @returns {TransitionDescription[]} The available TransitionDescriptions.\n   */\n  get availableTransitions() {\n    let transitionObjs = rclnodejs.getAvailableLifecycleTransitions(\n      this._stateMachineHandle\n    );\n    let transitions = transitionObjs.map((transitionDescObj) => {\n      let transition = new Transition(\n        transitionDescObj.transition.id,\n        transitionDescObj.transition.label\n      );\n      let startState = new State(\n        transitionDescObj.start_state.id,\n        transitionDescObj.start_state.label\n      );\n      let goalState = new State(\n        transitionDescObj.goal_state.id,\n        transitionDescObj.goal_state.label\n      );\n      return new TransitionDescription(transition, startState, goalState);\n    });\n    return transitions;\n  }\n\n  /**\n   * Register a callback function to be invoked during the configure() action.\n   * @param {TransitionCallback} cb - The callback function to invoke.\n   * @returns {unknown} void.\n   */\n  registerOnConfigure(cb) {\n    this._callbackMap.set(getStateInterface().TRANSITION_STATE_CONFIGURING, cb);\n  }\n\n  /**\n   * Register a callback function to be invoked during the activate() action.\n   * @param {TransitionCallback} cb - The callback function to invoke.\n   * @returns {unknown} void.\n   */\n  registerOnActivate(cb) {\n    this._callbackMap.set(getStateInterface().TRANSITION_STATE_ACTIVATING, cb);\n  }\n\n  /**\n   * Register a callback function to be invoked during the deactivate() action.\n   * @param {TransitionCallback} cb - The callback function to invoke.\n   * @returns {unknown} void.\n   */\n  registerOnDeactivate(cb) {\n    this._callbackMap.set(\n      getStateInterface().TRANSITION_STATE_DEACTIVATING,\n      cb\n    );\n  }\n\n  /**\n   * Register a callback function to be invoked during the cleanup() action.\n   * @param {TransitionCallback} cb - The callback function to invoke.\n   * @returns {unknown} void.\n   */\n  registerOnCleanup(cb) {\n    this._callbackMap.set(getStateInterface().TRANSITION_STATE_CLEANINGUP, cb);\n  }\n\n  /**\n   * Register a callback function to be invoked during the shutdown() action.\n   * @param {TransitionCallback} cb - The callback function to invoke.\n   * @returns {unknown} void\n   */\n  registerOnShutdown(cb) {\n    this._callbackMap.set(\n      getStateInterface().TRANSITION_STATE_SHUTTINGDOWN,\n      cb\n    );\n  }\n\n  /**\n   * Register a callback function to be invoked when an error occurs during a\n   * state transition.\n   * @param {TransitionCallback} cb - The callback function to invoke.\n   * @returns {unknown} void.\n   */\n  registerOnError(cb) {\n    this._callbackMap.set(\n      getStateInterface().TRANSITION_STATE_ERRORPROCESSING,\n      cb\n    );\n  }\n\n  /**\n   * Initiate a transition from the UNCONFIGURED state to the INACTIVE state.\n   * If an onConfigure callback has been registered it will be invoked.\n   *\n   * @param {CallbackReturnValue?} callbackReturnValue - value holder for the CallbackReturnCode returned from the callback.\n   * @returns {State} The new state, should be INACTIVE.\n   * @throws {Error} If transition is invalid for the current state.\n   */\n  configure(callbackReturnValue) {\n    return this._changeState(\n      getTransitionInterface().TRANSITION_CONFIGURE,\n      callbackReturnValue\n    );\n  }\n\n  /**\n   * Initiate a transition from the INACTIVE state to the ACTIVE state.\n   * If an onActivate callback has been registered it will be invoked.\n   *\n   * @param {CallbackReturnValue?} callbackReturnValue - value holder for the CallbackReturnCode returned from the callback.\n   * @returns {State} The new state, should be ACTIVE.\n   * @throws {Error} If transition is invalid for the current state.\n   */\n  activate(callbackReturnValue) {\n    return this._changeState(\n      getTransitionInterface().TRANSITION_ACTIVATE,\n      callbackReturnValue\n    );\n  }\n\n  /**\n   * Initiate a transition from the ACTIVE state to the INACTIVE state.\n   * If an onDeactivate callback has been registered it will be invoked.\n   *\n   * @param {CallbackReturnValue?} callbackReturnValue - value holder for the CallbackReturnCode returned from the callback.\n   * @returns {State} The new state, should be INACTIVE.\n   * @throws {Error} If transition is invalid for the current state.\n   */\n  deactivate(callbackReturnValue) {\n    return this._changeState(\n      getTransitionInterface().TRANSITION_DEACTIVATE,\n      callbackReturnValue\n    );\n  }\n\n  /**\n   * Initiate a transition from the INACTIVE state to the UNCONFIGURED state.\n   * If an onCleanup callback has been registered it will be invoked.\n   *\n   * @param {CallbackReturnValue?} callbackReturnValue - value holder for the CallbackReturnCode returned from the callback.\n   * @returns {State} The new state, should be INACTIVE.\n   * @throws {Error} If transition is invalid for the current state.\n   */\n  cleanup(callbackReturnValue) {\n    return this._changeState(\n      getTransitionInterface().TRANSITION_CLEANUP,\n      callbackReturnValue\n    );\n  }\n\n  /**\n   * Initiate a transition to the FINALIZED state from any of the following\n   * states: UNCONFIGURED, INACTIVE or ACTIVE state. If an onConfigure\n   * callback has been registered it will be invoked.\n   *\n   * @param {CallbackReturnValue?} callbackReturnValue - value holder for the CallbackReturnCode returned from the callback.\n   * @returns {State} The new state, should be FINALIZED.\n   * @throws {Error} If transition is invalid for the current state.\n   */\n  shutdown(callbackReturnValue) {\n    return this._changeState(SHUTDOWN_TRANSITION_LABEL, callbackReturnValue);\n  }\n\n  /**\n   * Check if state machine is initialized.\n   *\n   * @returns {boolean} true if the state machine is initialized; otherwise false.\n   */\n  get isInitialized() {\n    return rclnodejs.isInitialized(this._stateMachineHandle);\n  }\n\n  /**\n   * Log the state machine data.\n   *\n   * @returns {undefined} void.\n   */\n  print() {\n    rclnodejs.print(this._stateMachineHandle);\n  }\n\n  /**\n   * The GetState service handler.\n   * @param {Object} request - The GetState service request.\n   * @param {Object} response - The GetState service response.\n   * @returns {unknown} void.\n   * @private\n   */\n  _onGetState(request, response) {\n    let result = response.template;\n\n    result.current_state = this.currentState;\n\n    response.send(result);\n  }\n\n  /**\n   * The GetAvailableStates service handler.\n   * @param {Object} request - The GetAvailableStates service request.\n   * @param {Object} response - The GetAvailableStates service response.\n   * @returns {unknown} void.\n   * @private\n   */\n  _onGetAvailableStates(request, response) {\n    let result = response.template;\n\n    result.available_states = this.availableStates;\n\n    response.send(result);\n  }\n\n  /**\n   * The GetAvailableTransitions service handler.\n   * @param {Object} request - The GetAvailableTransitions service request\n   * @param {Object} response - The GetAvailableTranactions service response.\n   * @returns {unknown} void.\n   */\n  _onGetAvailableTransitions(request, response) {\n    let result = response.template;\n\n    result.available_transitions = this.availableTransitions;\n\n    response.send(result);\n  }\n\n  /**\n   * The ChangeState service handler.\n   * @param {Object} request - The ChangeState service request.\n   * @param {Object} response - The ChangeState service response\n   * @returns {unknown} void.\n   * @private\n   */\n  _onChangeState(request, response) {\n    let result = response.template;\n\n    let transitionId = request.transition.id;\n    if (request.transition.label) {\n      let transitionObj = rclnodejs.getLifecycleTransitionByLabel(\n        this._stateMachineHandle,\n        request.transition.label\n      );\n      if (transitionObj.id) {\n        transitionId = transitionObj.id;\n      } else {\n        result.success = false;\n        response.send(result);\n        return;\n      }\n    }\n\n    let callbackReturnValue = new CallbackReturnValue();\n    this._changeState(transitionId, callbackReturnValue);\n\n    result.success = callbackReturnValue.isSuccess();\n    response.send(result);\n  }\n\n  /**\n   * Transition to a new lifecycle state.\n   * @param {number|string} transitionIdOrLabel - The id or label of the target transition.\n   * @param {CallbackReturnValue} callbackReturnValue - An out parameter that holds the CallbackReturnCode.\n   * @returns {State} The new state.\n   * @throws {Error} If transition is invalid for the current state.\n   * @private\n   */\n  _changeState(transitionIdOrLabel, callbackReturnValue) {\n    let initialState = this.currentState;\n    let newStateObj =\n      typeof transitionIdOrLabel === 'number'\n        ? rclnodejs.triggerLifecycleTransitionById(\n            this._stateMachineHandle,\n            transitionIdOrLabel\n          )\n        : rclnodejs.triggerLifecycleTransitionByLabel(\n            this._stateMachineHandle,\n            transitionIdOrLabel\n          );\n\n    if (!newStateObj) {\n      throw new ValidationError(\n        `No transition available from state ${transitionIdOrLabel}`,\n        {\n          code: 'INVALID_TRANSITION',\n          entityType: 'lifecycle node',\n          details: { transitionIdOrLabel: transitionIdOrLabel },\n        }\n      );\n    }\n\n    let newState = State.fromSerializedState(newStateObj);\n\n    let cbResult = this._executeCallback(newState, initialState);\n    if (callbackReturnValue) callbackReturnValue.value = cbResult;\n\n    let transitioningLabel = this._transitionId2Label(cbResult);\n    newState = State.fromSerializedState(\n      rclnodejs.triggerLifecycleTransitionByLabel(\n        this._stateMachineHandle,\n        transitioningLabel\n      )\n    );\n\n    if (cbResult == CallbackReturnCode.ERROR) {\n      cbResult = this._executeCallback(this.currentState, initialState);\n      if (callbackReturnValue) callbackReturnValue.value = cbResult;\n\n      transitioningLabel = this._transitionId2Label(cbResult);\n      newState = State.fromSerializedState(\n        rclnodejs.triggerLifecycleTransitionByLabel(\n          this._stateMachineHandle,\n          transitioningLabel\n        )\n      );\n    }\n\n    return newState;\n  }\n\n  /**\n   * Execute the callback function registered with a transition action,\n   * e.g. registerOnConfigure(cb).\n   * @param {State} state - The state to which the callback is\n   * @param {State} prevState - The start state of the transition.\n   * @returns {CallbackReturnCode} The callback return code.\n   * @private\n   */\n  _executeCallback(state, prevState) {\n    let result = CallbackReturnCode.SUCCESS;\n    let callback = this._callbackMap.get(state.id);\n\n    if (callback) {\n      try {\n        result = callback(prevState);\n      } catch (err) {\n        console.log('CB exception occured: ', err);\n        result = CallbackReturnCode.ERROR;\n      }\n    }\n\n    return result;\n  }\n\n  /**\n   * Find the label for the transition with id == transitionId.\n   * @param {number} transitionId - A transition id.\n   * @returns {string} The label of the transition with id.\n   * @private\n   */\n  _transitionId2Label(transitionId) {\n    return rclnodejs.getLifecycleTransitionIdToLabel(transitionId);\n  }\n}\n\nconst Lifecycle = {\n  CallbackReturnCode,\n  CallbackReturnValue,\n  LifecycleNode,\n  State,\n  Transition,\n  TransitionDescription,\n};\n\nexport default Lifecycle;\n","// Copyright (c) 2017 Intel Corporation. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport fs from 'fs';\nimport path from 'path';\nimport { spawn } from 'child_process';\nimport createDebug from 'debug';\nimport DistroUtils from './lib/distro.js';\nimport RMWUtils from './lib/rmw.js';\nimport { Clock, ROSClock } from './lib/clock.js';\nimport ClockEvent from './lib/clock_event.js';\nimport ClockType from './lib/clock_type.js';\nimport ClockChange from './lib/clock_change.js';\nimport { compareVersions } from './lib/utils.js';\nimport Context from './lib/context.js';\nimport Duration from './lib/duration.js';\nimport generator from './rosidl_gen/index.cjs';\nimport loader from './lib/interface_loader.js';\nimport logging from './lib/logging.js';\nimport NodeOptions from './lib/node_options.js';\nimport {\n  FloatingPointRange,\n  IntegerRange,\n  Parameter,\n  ParameterDescriptor,\n  ParameterType,\n  DEFAULT_NUMERIC_RANGE_TOLERANCE,\n} from './lib/parameter.js';\nimport QoS from './lib/qos.js';\nimport {\n  QoSPolicyKind,\n  QoSOverridingOptions,\n} from './lib/qos_overriding_options.js';\nimport rclnodejs from './lib/native_loader.js';\nimport tsdGenerator from './rostsd_gen/index.cjs';\nimport validator from './lib/validator.js';\nimport Time from './lib/time.js';\nimport ActionClient from './lib/action/client.js';\nimport ActionServer from './lib/action/server.js';\nimport ActionUuid from './lib/action/uuid.js';\nimport ClientGoalHandle from './lib/action/client_goal_handle.js';\nimport { CancelResponse, GoalResponse } from './lib/action/response.js';\nimport ServerGoalHandle from './lib/action/server_goal_handle.js';\nimport ActionEndpointInfo from './lib/action/endpoint_info.js';\nimport { toJSONSafe, toJSONString } from './lib/message_serialization.js';\nimport {\n  getActionClientNamesAndTypesByNode,\n  getActionServerNamesAndTypesByNode,\n  getActionNamesAndTypes,\n} from './lib/action/graph.js';\nimport ServiceIntrospectionStates from './lib/service_introspection.js';\nimport { serializeMessage, deserializeMessage } from './lib/serialization.js';\nimport ParameterClient from './lib/parameter_client.js';\nimport * as errors from './lib/errors.js';\nimport ParameterWatcher from './lib/parameter_watcher.js';\nimport ParameterEventHandler from './lib/parameter_event_handler.js';\nimport waitForMessage from './lib/wait_for_message.js';\nimport MessageIntrospector from './lib/message_introspector.js';\nimport MessageInfo from './lib/message_info.js';\nimport ObservableSubscription from './lib/observable_subscription.js';\nimport {\n  ValidationProblem,\n  getMessageSchema,\n  getFieldNames,\n  getFieldType,\n  validateMessage,\n  assertValidMessage,\n  createMessageValidator,\n} from './lib/message_validation.js';\n// The following three modules participate in a circular dependency with this\n// file (via rate.js). In ESM the circular references are resolved by live\n// bindings, so they are imported here at the top like everything else.\nimport Node from './lib/node.js';\nimport TimeSource from './lib/time_source.js';\nimport Lifecycle from './lib/lifecycle.js';\n\nconst debug = createDebug('rclnodejs');\n\n/**\n * Get the version of the generator that was used for the currently present interfaces.\n * @return {Promise<string | null>} The current version or null if the *generator.json* file was not found\n * @throws {Error} if there was an error reading the *generator.json* file (except for it being absent)\n */\nasync function getCurrentGeneratorVersion() {\n  const jsonFilePath = path.join(generator.generatedRoot, 'generator.json');\n\n  return new Promise((resolve, reject) => {\n    fs.readFile(jsonFilePath, 'utf8', (err, data) => {\n      if (err) {\n        if (err.code === 'ENOENT') {\n          resolve(null);\n        } else {\n          reject(err);\n        }\n      } else {\n        try {\n          resolve(JSON.parse(data).version);\n        } catch (parseErr) {\n          reject(parseErr);\n        }\n      }\n    });\n  });\n}\n\nlet _rosVersionChecked = false;\n\n/**\n * Run a ROS2 package executable using 'ros2 run' command.\n * @param {string} packageName - The name of the ROS2 package.\n * @param {string} executableName - The name of the executable to run.\n * @param {string[]} [args=[]] - Additional arguments to pass to the executable.\n * @return {Promise<{process: ChildProcess}>} A Promise that resolves with the process.\n */\nfunction ros2Run(packageName, executableName, args = []) {\n  return new Promise((resolve, reject) => {\n    if (typeof packageName !== 'string' || !packageName.trim()) {\n      reject(new Error('Package name must be a non-empty string'));\n      return;\n    }\n\n    if (typeof executableName !== 'string' || !executableName.trim()) {\n      reject(new Error('Executable name must be a non-empty string'));\n      return;\n    }\n\n    if (!Array.isArray(args)) {\n      reject(new Error('Arguments must be an array'));\n      return;\n    }\n\n    const command = 'ros2';\n    const cmdArgs = ['run', packageName, executableName, ...args];\n    const childProcess = spawn(command, cmdArgs);\n\n    childProcess.on('error', (error) => {\n      reject(new Error(`Failed to start ros2 run: ${error.message}`));\n    });\n    childProcess.on('spawn', () => {\n      resolve({\n        process: childProcess,\n      });\n    });\n  });\n}\n\n/**\n * Run a ROS2 launch file using 'ros2 launch' command.\n * @param {string} packageName - The name of the ROS2 package.\n * @param {string} launchFile - The name of the launch file to run.\n * @param {string[]} [args=[]] - Additional arguments to pass to the launch file.\n * @return {Promise<{process: ChildProcess}>} A Promise that resolves with the process.\n */\nfunction ros2Launch(packageName, launchFile, args = []) {\n  return new Promise((resolve, reject) => {\n    if (typeof packageName !== 'string' || !packageName.trim()) {\n      reject(new Error('Package name must be a non-empty string'));\n      return;\n    }\n    if (typeof launchFile !== 'string' || !launchFile.trim()) {\n      reject(new Error('Launch file name must be a non-empty string'));\n      return;\n    }\n    if (!Array.isArray(args)) {\n      reject(new Error('Arguments must be an array'));\n      return;\n    }\n    const command = 'ros2';\n    const cmdArgs = ['launch', packageName, launchFile, ...args];\n    const childProcess = spawn(command, cmdArgs);\n\n    childProcess.on('error', (error) => {\n      reject(new Error(`Failed to start ros2 launch: ${error.message}`));\n    });\n\n    childProcess.on('spawn', () => {\n      resolve({\n        process: childProcess,\n      });\n    });\n  });\n}\n\n/**\n * A module that exposes the rclnodejs interfaces.\n * @exports rclnodejs\n */\nlet rcl = {\n  /** {@link Clock} class */\n  Clock: Clock,\n\n  /** {@link ClockEvent} class */\n  ClockEvent: ClockEvent,\n\n  /** {@link ClockType} enum */\n  ClockType: ClockType,\n\n  /** {@link ClockChange} enum */\n  ClockChange: ClockChange,\n\n  /** {@link Context} class */\n  Context: Context,\n\n  /**\n   * @constant {number}\n   * The plus/minus tolerance for determining number equivalence.\n   *\n   *  @see [FloatingPointRange]{@link FloatingPointRange}\n   *  @see [IntegerRange]{@link IntegerRange}\n   */\n  DEFAULT_NUMERIC_RANGE_TOLERANCE: DEFAULT_NUMERIC_RANGE_TOLERANCE,\n\n  /** {@link DistroUtils} */\n  DistroUtils: DistroUtils,\n\n  /** {@link Duration} class */\n  Duration: Duration,\n\n  /** {@link FloatingPointRange} class */\n  FloatingPointRange: FloatingPointRange,\n\n  /** {@link IntegerRange} class */\n  IntegerRange: IntegerRange,\n\n  /** {@link Logging} class */\n  logging: logging,\n\n  /** {@link NodeOptions} class */\n  NodeOptions: NodeOptions,\n\n  /** {@link Parameter} */\n  Parameter: Parameter,\n\n  /** {@link ParameterDescriptor} */\n  ParameterDescriptor: ParameterDescriptor,\n\n  /** {@link ParameterType} */\n  ParameterType: ParameterType,\n\n  /** {@link ParameterClient} class */\n  ParameterClient: ParameterClient,\n\n  /** {@link ParameterWatcher} class */\n  ParameterWatcher: ParameterWatcher,\n\n  /** {@link ParameterEventHandler} class */\n  ParameterEventHandler: ParameterEventHandler,\n\n  /** {@link MessageInfo} class */\n  MessageInfo: MessageInfo,\n\n  /** {@link ObservableSubscription} class */\n  ObservableSubscription: ObservableSubscription,\n\n  /** {@link QoS} class */\n  QoS: QoS,\n\n  /** {@link QoSPolicyKind} enum */\n  QoSPolicyKind: QoSPolicyKind,\n\n  /** {@link QoSOverridingOptions} class */\n  QoSOverridingOptions: QoSOverridingOptions,\n\n  /** {@link RMWUtils} */\n  RMWUtils: RMWUtils,\n\n  /** {@link ROSClock} class */\n  ROSClock: ROSClock,\n\n  /** {@link ServiceIntrospectionStates} */\n  ServiceIntrospectionStates: ServiceIntrospectionStates,\n\n  /** {@link Time} class */\n  Time: Time,\n\n  /** {@link module:validator|validator} object */\n  validator: validator,\n\n  /** {@link ActionClient} class */\n  ActionClient: ActionClient,\n\n  /** {@link ActionServer} class */\n  ActionServer: ActionServer,\n\n  /** {@link ActionUuid} class */\n  ActionUuid: ActionUuid,\n\n  /** {@link ActionEndpointInfo} class */\n  ActionEndpointInfo: ActionEndpointInfo,\n\n  /** {@link ClientGoalHandle} class */\n  ClientGoalHandle: ClientGoalHandle,\n\n  /** {@link ServerGoalHandle} class */\n  ServerGoalHandle: ServerGoalHandle,\n\n  /** {@link ServerGoalHandle} enum */\n  CancelResponse: CancelResponse,\n\n  /** {@link GoalResponse} enum */\n  GoalResponse: GoalResponse,\n\n  /** {@link getActionClientNamesAndTypesByNode} function */\n  getActionClientNamesAndTypesByNode: getActionClientNamesAndTypesByNode,\n\n  /** {@link getActionServerNamesAndTypesByNode} function */\n  getActionServerNamesAndTypesByNode: getActionServerNamesAndTypesByNode,\n\n  /** {@link getActionNamesAndTypes} function */\n  getActionNamesAndTypes: getActionNamesAndTypes,\n\n  /** {@link serializeMessage} function */\n  serializeMessage: serializeMessage,\n\n  /** {@link deserializeMessage} function */\n  deserializeMessage: deserializeMessage,\n\n  /**\n   * Create and initialize a node.\n   * @param {string} nodeName - The name used to register in ROS.\n   * @param {string} [namespace=''] - The namespace used in ROS.\n   * @param {Context} [context=Context.defaultContext()] - The context to create the node in.\n   * @param {NodeOptions} [options=NodeOptions.defaultOptions] - The options to configure the new node behavior.\n   * @param {Array} [args=[]] - The arguments to pass to the node.\n   * @param {boolean} [useGlobalArguments=true] - If true, the node will use the global arguments\n   *                                             from the context, otherwise it will only use the arguments\n   *                                             passed in the args parameter.\n   * @return {Node} A new instance of the specified node.\n   * @throws {Error} If the given context is not registered.\n   * @deprecated since 0.18.0, Use new Node constructor.\n   */\n  createNode(\n    nodeName,\n    namespace = '',\n    context = Context.defaultContext(),\n    options = NodeOptions.defaultOptions,\n    args = [],\n    useGlobalArguments = true\n  ) {\n    return new this.Node(\n      nodeName,\n      namespace,\n      context,\n      options,\n      args,\n      useGlobalArguments\n    );\n  },\n\n  /**\n   * Create a LifecycleNode, a managed Node that implements a well-defined life-cycle state\n   * model using the {@link https://github.com/ros2/rcl/tree/master/rcl_lifecycle|ros2 client library (rcl) lifecyle api}.\n   * @param {string} nodeName - The name used to register in ROS.\n   * @param {string} [namespace=''] - The namespace used in ROS.\n   * @param {Context} [context=Context.defaultContext()] - The context to create the node in.\n   * @param {NodeOptions} [options=NodeOptions.defaultOptions] - The options to configure the new node behavior.\n   * @param {boolean} [enableCommunicationsInterface=true] - enable lifecycle service interfaces, e.g., GetState.\n   * @return {LifecycleNode} A new instance of the specified node.\n   * @throws {Error} If the given context is not registered.\n   * @deprecated since 0.18.0, Use new LifecycleNode constructor.\n   */\n  createLifecycleNode(\n    nodeName,\n    namespace = '',\n    context = Context.defaultContext(),\n    options = NodeOptions.defaultOptions,\n    enableCommunicationsInterface = true\n  ) {\n    return new this.lifecycle.LifecycleNode(\n      nodeName,\n      namespace,\n      context,\n      options,\n      enableCommunicationsInterface\n    );\n  },\n\n  /**\n   * Initialize an RCL environment, i.e., a Context, and regenerate the javascript\n   * message files if the output format of the message-generator tool has changed.\n   * The context serves as a container for nodes, publishers, subscribers, etc. and\n   * must be initialized before use.\n   * @param {Context} [context=Context.defaultContext()] - The context to initialize.\n   * @param {string[]} argv - Process command line arguments.\n   * @return {Promise<undefined>} A Promise.\n   * @throws {Error} If the given context has already been initialized or the command\n   *                 line arguments argv could not be parsed.\n   */\n  async init(context = Context.defaultContext(), argv = process.argv) {\n    // check if context has already been initialized\n    if (!context.isUninitialized()) {\n      throw new Error('The context has already been initialized.');\n    }\n\n    // check argv for correct value and state\n    if (!Array.isArray(argv)) {\n      throw new TypeError('argv must be an array.');\n    }\n    if (!argv.every((argument) => typeof argument === 'string')) {\n      throw new TypeError('argv elements must be strings (and not null).');\n    }\n\n    rclnodejs.init(context.handle, argv, context._domainId);\n\n    try {\n      if (_rosVersionChecked) {\n        // no further processing required\n        return;\n      }\n\n      const version = await getCurrentGeneratorVersion();\n      const forced =\n        version === null || compareVersions(version, generator.version(), '<');\n      if (forced) {\n        debug(\n          'The generator will begin to create JavaScript code from ROS IDL files...'\n        );\n      }\n\n      await generator.generateAll(forced);\n      // TODO determine if tsd generateAll() should be here\n      _rosVersionChecked = true;\n    } catch (error) {\n      try {\n        context.tryShutdown();\n      } catch (shutdownError) {\n        const initError =\n          error instanceof Error ? error : new Error(String(error));\n        initError.message += ` (rollback also failed: ${shutdownError.message})`;\n        throw initError;\n      }\n      throw error;\n    }\n  },\n\n  /**\n   * Remove ROS-specific arguments from the given argument list.\n   * @param {string[]} argv - The argument list to process.\n   * @return {string[]} The argument list with ROS arguments removed.\n   */\n  removeROSArgs(argv) {\n    if (!Array.isArray(argv)) {\n      throw new TypeError('argv must be an array.');\n    }\n    if (!argv.every((argument) => typeof argument === 'string')) {\n      throw new TypeError('argv elements must be strings (and not null).');\n    }\n    return rclnodejs.removeROSArgs(argv);\n  },\n\n  /**\n   * Start detection and processing of units of work.\n   * @param {Node} node - The node to be spun up.\n   * @param {number} [timeout=10] - Timeout to wait in milliseconds. Block forever if negative. Don't wait if 0.\n   * @throws {Error} If the node is already spinning.\n   * @return {undefined}\n   * @deprecated since 0.18.0, Use Node.spin(timeout)\n   */\n  spin(node, timeout = 10) {\n    node.spin(timeout);\n  },\n\n  /**\n   * Spin the node and trigger the event loop to check for one incoming event. Thereafter the node\n   * will not received additional events until running additional calls to spin() or spinOnce().\n   * @param {Node} node - The node to be spun.\n   * @param {number} [timeout=10] - Timeout to wait in milliseconds. Block forever if negative. Don't wait if 0.\n   * @throws {Error} If the node is already spinning.\n   * @return {undefined}\n   * @deprecated since 0.18.0, Use Node.spinOnce(timeout)\n   */\n  spinOnce(node, timeout = 10) {\n    node.spinOnce(timeout);\n  },\n\n  /**\n   * Wait for a single message on a topic.\n   *\n   * Creates a temporary subscription, waits for the first message to arrive,\n   * and returns it. The temporary subscription is always cleaned up, even on\n   * timeout or error. The node must be spinning before calling this function.\n   *\n   * This is the rclnodejs equivalent of rclpy's `wait_for_message`.\n   *\n   * @param {function|string|object} typeClass - The ROS message type class.\n   * @param {Node} node - The node to create the temporary subscription on.\n   * @param {string} topic - The topic name to listen on.\n   * @param {object} [options] - Options.\n   * @param {number} [options.timeout] - Timeout in milliseconds. If omitted, waits indefinitely.\n   * @param {object} [options.qos] - QoS profile for the subscription.\n   * @returns {Promise<object>} - Resolves with the received message.\n   * @throws {Error} If timeout expires before a message arrives.\n   */\n  waitForMessage: waitForMessage,\n\n  /**\n   * Shutdown an RCL environment identified by a context. The shutdown process will\n   * destroy all nodes and related resources in the context. If no context is\n   * explicitly given, the default context will be shut down.\n   * This follows the semantics of\n   * [rclpy.shutdown()]{@link http://docs.ros2.org/latest/api/rclpy/api/init_shutdown.html#rclpy.shutdown}.\n   *\n   * @param { Context } [context = Context.defaultContext()] - The context to be shutdown.\n   * @return { undefined }\n   * @throws { Error } If there is a problem shutting down the context or while destroying or shutting down a node within it.\n   */\n  shutdown(context = Context.defaultContext()) {\n    context.shutdown();\n  },\n\n  /**\n   * Shutdown all RCL environments via their contexts.\n   * @return { undefined }\n   * @throws { Error } If there is a problem shutting down the context or while destroying or shutting down a node within it.\n   */\n  shutdownAll() {\n    for (const context of Context.instances) {\n      this.shutdown(context);\n    }\n  },\n\n  /**\n   * Determine if an RCL environment identified by a context argument\n   * has been shutdown.\n   * @param {Context} [context=Context.defaultContext()] - The context to inspect.\n   * @return {boolean} Return true if the module is shut down, otherwise return false.\n   */\n  isShutdown(context = Context.defaultContext()) {\n    return !context.isInitialized();\n  },\n\n  /**\n   * Get the interface package, which is used by publisher/subscription or client/service.\n   * @param {string} name - The name of interface to be required.\n   * @return {object} - the object of the required package/interface.\n   */\n  require(name) {\n    return loader.loadInterface(name);\n  },\n\n  /**\n   * Search packages which locate under path $AMENT_PREFIX_PATH, regenerate all JavaScript structs files from the IDL of\n   * messages(.msg) and services(.srv) and put these files under folder 'generated'. Any existing files under\n   * this folder will be overwritten after the execution.\n   * @return {Promise<undefined>} A Promise.\n   */\n  async regenerateAll() {\n    // This will trigger to regenerate all the JS structs used for messages and services,\n    // to overwrite the existing ones although they have been created.\n    debug('Begin regeneration of JavaScript code from ROS IDL files...');\n\n    // generate the messages and type declarations, which must be done in sequence\n    await generator.generateAll(true);\n    await tsdGenerator.generateAll(); // create interfaces.d.ts\n\n    debug('Finished regeneration.');\n  },\n\n  /**\n   * Judge if the topic/service is hidden (see [the ROS2 design documentation]{@link http://design.ros2.org/articles/topic_and_service_names.html#hidden-topic-or-service-names}).\n   * @param {string} name - Name of topic/service.\n   * @return {boolean} - True if a given topic or service name is hidden, otherwise False.\n   */\n  isTopicOrServiceHidden(name) {\n    if (typeof name !== 'string') {\n      throw new TypeError('Invalid argument');\n    }\n\n    return name.split('/').some((slice) => slice.startsWith('_'));\n  },\n\n  /**\n   * Expand a given topic name using given node name and namespace as well.\n   * @param {string} topicName - Topic name to be expanded.\n   * @param {string} nodeName - Name of the node that this topic is associated with.\n   * @param {string} nodeNamespace - Namespace that the topic is within.\n   * @return {string} Expanded topic name which is fully qualified.\n   */\n  expandTopicName(topicName, nodeName, nodeNamespace) {\n    return rclnodejs.expandTopicName(topicName, nodeName, nodeNamespace);\n  },\n\n  createMessage(type) {\n    const typeClass = loader.loadInterface(type);\n\n    if (typeClass) {\n      return new typeClass();\n    }\n\n    return undefined;\n  },\n\n  /**\n   * Create a plain JavaScript from the specified type identifier.\n   * @param {string|Object} type -- the type identifier, acceptable formats could be 'std_msgs/std/String'\n   *                                or {package: 'std_msgs', type: 'msg', name: 'String'}\n   * @return {Object|undefined} A plain JavaScript of that type, or undefined if the object could not be created\n   */\n  createMessageObject(type) {\n    return this.createMessage(type).toPlainObject();\n  },\n\n  /**\n   * Removes the default signal handler installed by rclnodejs. After calling this, rclnodejs\n   * will no longer clean itself up when a SIGINT is received, it is the application's\n   * responsibility to properly shut down all nodes and contexts.\n   *\n   * Application which wishes to implement its own signal handler logic should call this.\n   * @returns {undefined}\n   */\n  removeSignalHandlers() {\n    // this will not throw even if the handler is already removed\n    process.removeListener('SIGINT', _sigHandler);\n  },\n\n  /**\n   * Run a ROS2 package executable using 'ros2 run' command.\n   * @param {string} packageName - The name of the ROS2 package.\n   * @param {string} executableName - The name of the executable to run.\n   * @param {string[]} [args=[]] - Additional arguments to pass to the executable.\n   * @return {Promise<{process: ChildProcess}>} A Promise that resolves with the process.\n   */\n  ros2Run: ros2Run,\n\n  /**\n   * Run a ROS2 launch file using 'ros2 launch' command.\n   * @param {string} packageName - The name of the ROS2 package.\n   * @param {string} launchFile - The name of the launch file to run.\n   * @param {string[]} [args=[]] - Additional arguments to pass to the launch file.\n   * @return {Promise<{process: ChildProcess}>} A Promise that resolves with the process.\n   */\n  ros2Launch: ros2Launch,\n\n  /**\n   * Convert a message object to be JSON-safe by converting TypedArrays to regular arrays\n   * and handling BigInt, Infinity, NaN, etc. for JSON serialization.\n   * @param {*} obj - The message object to convert\n   * @returns {*} A JSON-safe version of the object\n   */\n  toJSONSafe: toJSONSafe,\n\n  /**\n   * Convert a message object to a JSON string with proper handling of TypedArrays,\n   * BigInt, and other non-JSON-serializable values.\n   * @param {*} obj - The message object to convert\n   * @param {number} [space] - Space parameter for JSON.stringify formatting\n   * @returns {string} The JSON string representation\n   */\n  toJSONString: toJSONString,\n\n  /** {@link ValidationProblem} - Enum of validation problem types */\n  ValidationProblem: ValidationProblem,\n\n  /**\n   * Get the schema definition for a message type\n   * @param {function|string|object} typeClass - Message type class or identifier\n   * @returns {object|null} Schema definition with fields and constants\n   */\n  getMessageSchema: getMessageSchema,\n\n  /**\n   * Get field names for a message type\n   * @param {function|string|object} typeClass - Message type class or identifier\n   * @returns {string[]} Array of field names\n   */\n  getFieldNames: getFieldNames,\n\n  /**\n   * Get type information for a specific field\n   * @param {function|string|object} typeClass - Message type class or identifier\n   * @param {string} fieldName - Name of the field\n   * @returns {object|null} Field type information or null if not found\n   */\n  getFieldType: getFieldType,\n\n  /**\n   * Validate a message object against its schema\n   * @param {object} obj - Plain object to validate\n   * @param {function|string|object} typeClass - Message type class or identifier\n   * @param {object} [options] - Validation options\n   * @returns {{valid: boolean, issues: Array<object>}} Validation result\n   */\n  validateMessage: validateMessage,\n\n  /**\n   * Validate a message and throw if invalid\n   * @param {object} obj - Plain object to validate\n   * @param {function|string|object} typeClass - Message type class or identifier\n   * @param {object} [options] - Validation options\n   * @throws {MessageValidationError} If validation fails\n   */\n  assertValidMessage: assertValidMessage,\n\n  /**\n   * Create a validator function for a specific message type\n   * @param {function|string|object} typeClass - Message type class or identifier\n   * @param {object} [defaultOptions] - Default validation options\n   * @returns {function} Validator function\n   */\n  createMessageValidator: createMessageValidator,\n\n  // Error classes for structured error handling\n  /** {@link RclNodeError} - Base error class for all rclnodejs errors */\n  RclNodeError: errors.RclNodeError,\n\n  /** {@link ValidationError} - Error thrown when validation fails */\n  ValidationError: errors.ValidationError,\n  /** {@link TypeValidationError} - Type validation error */\n  TypeValidationError: errors.TypeValidationError,\n  /** {@link RangeValidationError} - Range/value validation error */\n  RangeValidationError: errors.RangeValidationError,\n  /** {@link MessageValidationError} - Message structure/type validation error */\n  MessageValidationError: errors.MessageValidationError,\n  /** {@link NameValidationError} - ROS name validation error */\n  NameValidationError: errors.NameValidationError,\n\n  /** {@link OperationError} - Base class for operation/runtime errors */\n  OperationError: errors.OperationError,\n  /** {@link TimeoutError} - Request timeout error */\n  TimeoutError: errors.TimeoutError,\n  /** {@link AbortError} - Request abortion error */\n  AbortError: errors.AbortError,\n  /** {@link ServiceNotFoundError} - Service not available error */\n  ServiceNotFoundError: errors.ServiceNotFoundError,\n  /** {@link NodeNotFoundError} - Remote node not found error */\n  NodeNotFoundError: errors.NodeNotFoundError,\n\n  /** {@link ParameterError} - Base error for parameter operations */\n  ParameterError: errors.ParameterError,\n  /** {@link ParameterNotFoundError} - Parameter not found error */\n  ParameterNotFoundError: errors.ParameterNotFoundError,\n  /** {@link ParameterTypeError} - Parameter type mismatch error */\n  ParameterTypeError: errors.ParameterTypeError,\n  /** {@link ReadOnlyParameterError} - Read-only parameter modification error */\n  ReadOnlyParameterError: errors.ReadOnlyParameterError,\n\n  /** {@link TopicError} - Base error for topic operations */\n  TopicError: errors.TopicError,\n  /** {@link PublisherError} - Publisher-specific error */\n  PublisherError: errors.PublisherError,\n  /** {@link SubscriptionError} - Subscription-specific error */\n  SubscriptionError: errors.SubscriptionError,\n\n  /** {@link ActionError} - Base error for action operations */\n  ActionError: errors.ActionError,\n  /** {@link GoalRejectedError} - Goal rejected by action server */\n  GoalRejectedError: errors.GoalRejectedError,\n  /** {@link ActionServerNotFoundError} - Action server not found */\n  ActionServerNotFoundError: errors.ActionServerNotFoundError,\n\n  /** {@link NativeError} - Wraps errors from native C++ layer */\n  NativeError: errors.NativeError,\n};\n\nconst _sigHandler = () => {\n  // shuts down all live contexts. Applications that wishes to use their own signal handlers\n  // should call `rclnodejs.removeSignalHandlers`.\n  debug('Catch ctrl+c event and will cleanup and terminate.');\n  rcl.shutdownAll();\n};\nprocess.on('SIGINT', _sigHandler);\nprocess.once('exit', () => rcl.shutdownAll());\n\n/** {@link Node} class */\nrcl.Node = Node;\n\n/** {@link TimeSource} class */\nrcl.TimeSource = TimeSource;\n\n/** Lifecycle namespace */\nrcl.lifecyc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