node-opcua-alias-name-server 2.176.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +361 -0
  3. package/dist/add_alias.d.ts +73 -0
  4. package/dist/add_alias.js +262 -0
  5. package/dist/add_alias.js.map +1 -0
  6. package/dist/address_space_alias_store.d.ts +130 -0
  7. package/dist/address_space_alias_store.js +360 -0
  8. package/dist/address_space_alias_store.js.map +1 -0
  9. package/dist/alias_hierarchy.d.ts +45 -0
  10. package/dist/alias_hierarchy.js +135 -0
  11. package/dist/alias_hierarchy.js.map +1 -0
  12. package/dist/alias_index.d.ts +60 -0
  13. package/dist/alias_index.js +119 -0
  14. package/dist/alias_index.js.map +1 -0
  15. package/dist/alias_name_archive.d.ts +45 -0
  16. package/dist/alias_name_archive.js +75 -0
  17. package/dist/alias_name_archive.js.map +1 -0
  18. package/dist/bind_alias_category.d.ts +173 -0
  19. package/dist/bind_alias_category.js +417 -0
  20. package/dist/bind_alias_category.js.map +1 -0
  21. package/dist/bind_configuration_methods.d.ts +44 -0
  22. package/dist/bind_configuration_methods.js +175 -0
  23. package/dist/bind_configuration_methods.js.map +1 -0
  24. package/dist/bind_find_alias.d.ts +61 -0
  25. package/dist/bind_find_alias.js +227 -0
  26. package/dist/bind_find_alias.js.map +1 -0
  27. package/dist/index.d.ts +18 -0
  28. package/dist/index.js +64 -0
  29. package/dist/index.js.map +1 -0
  30. package/dist/install_alias_names.d.ts +229 -0
  31. package/dist/install_alias_names.js +146 -0
  32. package/dist/install_alias_names.js.map +1 -0
  33. package/dist/last_change.d.ts +87 -0
  34. package/dist/last_change.js +174 -0
  35. package/dist/last_change.js.map +1 -0
  36. package/dist/well_known.d.ts +88 -0
  37. package/dist/well_known.js +93 -0
  38. package/dist/well_known.js.map +1 -0
  39. package/package.json +54 -0
  40. package/source/add_alias.ts +318 -0
  41. package/source/address_space_alias_store.ts +417 -0
  42. package/source/alias_hierarchy.ts +141 -0
  43. package/source/alias_index.ts +127 -0
  44. package/source/alias_name_archive.ts +84 -0
  45. package/source/bind_alias_category.ts +546 -0
  46. package/source/bind_configuration_methods.ts +219 -0
  47. package/source/bind_find_alias.ts +290 -0
  48. package/source/index.ts +74 -0
  49. package/source/install_alias_names.ts +342 -0
  50. package/source/last_change.ts +201 -0
  51. package/source/well_known.ts +101 -0
@@ -0,0 +1,146 @@
1
+ "use strict";
2
+ /**
3
+ * @module node-opcua-alias-name-server
4
+ *
5
+ * Install OPC 10000-17 AliasName support on a Server.
6
+ *
7
+ * Every node-opcua Server that loads the standard nodeset already exposes
8
+ * `Aliases`, `TagVariables` and `Topics`, each carrying a MANDATORY `FindAlias`
9
+ * Method that is bound to nothing. A conformance tester therefore sees the SDK
10
+ * advertise the AliasName feature and then fail its only required Method. This
11
+ * binds them.
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.ALIAS_SERVER_CAPABILITY_ID = exports.DEFAULT_MAX_RESULTS = void 0;
15
+ exports.defaultCategoryProvider = defaultCategoryProvider;
16
+ exports.advertiseAliasCapability = advertiseAliasCapability;
17
+ exports.installAliasNames = installAliasNames;
18
+ exports.installAliasNamesOnAddressSpace = installAliasNamesOnAddressSpace;
19
+ const address_space_alias_store_js_1 = require("./address_space_alias_store.js");
20
+ const alias_hierarchy_js_1 = require("./alias_hierarchy.js");
21
+ const bind_alias_category_js_1 = require("./bind_alias_category.js");
22
+ const last_change_js_1 = require("./last_change.js");
23
+ const well_known_js_1 = require("./well_known.js");
24
+ Object.defineProperty(exports, "DEFAULT_MAX_RESULTS", { enumerable: true, get: function () { return well_known_js_1.DEFAULT_MAX_RESULTS; } });
25
+ /**
26
+ * The default provider: every `AliasNameCategoryType` instance at or below
27
+ * `Aliases`, plus any roots named in `additionalCategoryRoots`.
28
+ *
29
+ * `additionalCategoryRoots` is expressed through this rather than as a parallel
30
+ * mechanism, so a custom provider can reuse it — `defaultCategoryProvider(roots)`
31
+ * composes with whatever else the Server knows about.
32
+ */
33
+ function defaultCategoryProvider(additionalRoots) {
34
+ return (addressSpace) => (0, alias_hierarchy_js_1.collectAllCategories)(addressSpace, additionalRoots);
35
+ }
36
+ /**
37
+ * The `ALIAS` ServerCapability identifier (OPC 10000-12 Annex D Table D.1).
38
+ *
39
+ * Part 17's prose writes it `Alias`; Part 12 Annex D is the normative source and
40
+ * writes `ALIAS`, matched case-insensitively.
41
+ */
42
+ exports.ALIAS_SERVER_CAPABILITY_ID = "ALIAS";
43
+ /** The placeholder node-opcua uses for "no capabilities declared". */
44
+ const NO_CAPABILITY_PLACEHOLDER = "NA";
45
+ /**
46
+ * Add `ALIAS` to a Server's Annex D capability list, in place.
47
+ *
48
+ * Idempotent, case-insensitive, and replaces the `NA` placeholder rather than
49
+ * producing the meaningless `["NA", "ALIAS"]`.
50
+ *
51
+ * @returns true when the list was changed.
52
+ */
53
+ function advertiseAliasCapability(capabilities) {
54
+ if (capabilities.some((c) => c.toUpperCase() === exports.ALIAS_SERVER_CAPABILITY_ID)) {
55
+ return false;
56
+ }
57
+ // "NA" means "none"; it cannot coexist with a real capability
58
+ const placeholderIndex = capabilities.findIndex((c) => c.toUpperCase() === NO_CAPABILITY_PLACEHOLDER);
59
+ if (placeholderIndex >= 0) {
60
+ capabilities.splice(placeholderIndex, 1);
61
+ }
62
+ capabilities.push(exports.ALIAS_SERVER_CAPABILITY_ID);
63
+ return true;
64
+ }
65
+ /**
66
+ * Install AliasName support on a Server.
67
+ *
68
+ * Call it **between `initialize()` and `start()`**: the address space exists
69
+ * from `initialize()`, and the `ALIAS` capability has to be in place before
70
+ * `start()` performs the mDNS/LDS registration that reads it.
71
+ *
72
+ * ```ts
73
+ * await server.initialize();
74
+ * await installAliasNames(server);
75
+ * await server.start();
76
+ * ```
77
+ */
78
+ async function installAliasNames(server, options) {
79
+ const addressSpace = server.engine.addressSpace;
80
+ if (!addressSpace) {
81
+ throw new Error("installAliasNames: address space is not available. Call this after server.initialize().");
82
+ }
83
+ const result = await installAliasNamesOnAddressSpace(addressSpace, options);
84
+ // Declaring the capability is part of installing the feature, not a separate
85
+ // thing to remember: a Server that omits it is never discovered, silently.
86
+ if ((options?.advertiseCapability ?? true) && server.capabilitiesForMDNS) {
87
+ advertiseAliasCapability(server.capabilitiesForMDNS);
88
+ }
89
+ return result;
90
+ }
91
+ /**
92
+ * Install AliasName support directly on an address space.
93
+ *
94
+ * The two-tier form used elsewhere in the SDK: this one needs no Server, so it
95
+ * can be driven from a test or from a tool that only has an address space.
96
+ */
97
+ async function installAliasNamesOnAddressSpace(addressSpace, options) {
98
+ const already = (0, bind_alias_category_js_1.getInstalledAliasNames)(addressSpace);
99
+ if (already) {
100
+ return { ...already, installed: false };
101
+ }
102
+ const aliasesRoot = addressSpace.findNode(well_known_js_1.WellKnownCategories.Aliases);
103
+ if (!aliasesRoot) {
104
+ throw new Error("installAliasNames: the Aliases Object (i=23470) is not in the address space. " +
105
+ "Load the standard nodeset (Opc.Ua.NodeSet2.xml) first.");
106
+ }
107
+ const store = options?.store ?? new address_space_alias_store_js_1.AddressSpaceAliasStore(addressSpace, { likeOptions: options?.likeOptions });
108
+ const lastChange = new last_change_js_1.LastChangeTracker(addressSpace, {
109
+ persistencePath: options?.persistencePath,
110
+ now: options?.nowVersionTime
111
+ });
112
+ const bindingOptions = {
113
+ store,
114
+ maxResults: options?.maxResults ?? well_known_js_1.DEFAULT_MAX_RESULTS,
115
+ verbose: options?.verbose ?? true,
116
+ comparator: options?.comparator,
117
+ isReadAllowed: options?.isReadAllowed,
118
+ isWriteAllowed: options?.isWriteAllowed,
119
+ lastChangeProperty: options?.lastChangeOnAllCategories ?? true,
120
+ configurationMethods: options?.configurationMethods ?? false,
121
+ onChanged: (categoryNodeId) => lastChange.touch(categoryNodeId).then(() => undefined)
122
+ };
123
+ const provider = options?.categoryProvider ?? defaultCategoryProvider(options?.additionalCategoryRoots);
124
+ const categories = await provider(addressSpace);
125
+ // one binding path, shared with bindAliasCategory, so a category created
126
+ // after installation cannot end up bound differently
127
+ for (const category of categories) {
128
+ (0, bind_alias_category_js_1.bindAliasCategory)(addressSpace, category, bindingOptions);
129
+ }
130
+ const installed = {
131
+ store,
132
+ categories: categories.map((c) => c.nodeId),
133
+ bindingOptions,
134
+ lastChange
135
+ };
136
+ // Recorded before restore, so anything the restore triggers can already find
137
+ // the tracker on the address space.
138
+ (0, bind_alias_category_js_1.setInstalledAliasNames)(addressSpace, installed);
139
+ // Bring persisted values back and publish them, including the zeros for
140
+ // categories that have never changed - a Property with no value at all reads
141
+ // as Bad_WaitingForInitialData rather than "nothing has happened yet".
142
+ await lastChange.restore();
143
+ lastChange.publishAll(installed.categories);
144
+ return { ...installed, installed: true };
145
+ }
146
+ //# sourceMappingURL=install_alias_names.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install_alias_names.js","sourceRoot":"","sources":["../source/install_alias_names.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAyCH,0DAEC;AA+KD,4DAWC;AAeD,8CAiBC;AAQD,0EA8DC;AAtUD,iFAAwE;AACxE,6DAA4D;AAC5D,qEAKkC;AAElC,qDAAqD;AACrD,mDAA2E;AAElE,oGAFA,mCAAmB,OAEA;AAgB5B;;;;;;;GAOG;AACH,SAAgB,uBAAuB,CAAC,eAA0C;IAC9E,OAAO,CAAC,YAA2B,EAAE,EAAE,CAAC,IAAA,yCAAoB,EAAC,YAAY,EAAE,eAAe,CAAC,CAAC;AAChG,CAAC;AA4JD;;;;;GAKG;AACU,QAAA,0BAA0B,GAAG,OAAO,CAAC;AAElD,sEAAsE;AACtE,MAAM,yBAAyB,GAAG,IAAI,CAAC;AAEvC;;;;;;;GAOG;AACH,SAAgB,wBAAwB,CAAC,YAAsB;IAC3D,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,KAAK,kCAA0B,CAAC,EAAE,CAAC;QAC3E,OAAO,KA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,GAAG;QACd,KAAK;QACL,UAAU,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;QAC3C,cAAc;QACd,UAAU;KACb,CAAC;IACF,6EAA6E;IAC7E,oCAAoC;IACpC,IAAA,+CAAsB,EAAC,YAAY,EAAE,SAAS,CAAC,CAAC;IAEhD,wEAAwE;IACxE,6EAA6E;IAC7E,uEAAuE;IACvE,MAAM,UAAU,CAAC,OAAO,EAAE,CAAC;IAC3B,UAAU,CAAC,UAAU,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IAE5C,OAAO,EAAE,GAAG,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;AAC7C,CAAC"}
@@ -0,0 +1,87 @@
1
+ /**
2
+ * @module node-opcua-alias-name-server
3
+ *
4
+ * `LastChange` (OPC 10000-17 clause 6.3.1).
5
+ *
6
+ * A `VersionTime` — **a UInt32 count of seconds since 2000-01-01T00:00:00Z, not
7
+ * a DateTime**. Every other "last changed" Property in the SDK is a DateTime and
8
+ * the name gives no hint, which is what makes this the easiest thing here to get
9
+ * wrong.
10
+ *
11
+ * Clause 6.3.1 lists three things that move it:
12
+ *
13
+ * - an AliasName was added to or deleted from the category,
14
+ * - an AliasNameCategory was added or deleted,
15
+ * - the referenced Nodes of an AliasName in the category changed.
16
+ *
17
+ * and one rule that makes it a tree rather than a set of independent counters:
18
+ * *"For AliasNameCategoryType instances that are nested, the value of LastChange
19
+ * shall always be the latest VersionTime of all Organized AliasNames and
20
+ * AliasNameCategories."* So a change deep in the hierarchy moves every ancestor
21
+ * up to the root.
22
+ *
23
+ * ## One second of resolution
24
+ *
25
+ * Two changes inside the same second are indistinguishable — the value simply
26
+ * does not move. A Client must therefore treat an **equal** `LastChange` as
27
+ * "re-browse to be sure" rather than "nothing changed"; only a value *older*
28
+ * than the cached one carries the strong meaning clause 6.3.1 gives it, namely
29
+ * clear the cache. This is a property of `VersionTime`, not of this
30
+ * implementation, and there is nothing a Server can do about it.
31
+ */
32
+ import type { IAddressSpace } from "node-opcua-address-space-base";
33
+ import type { NodeId } from "node-opcua-nodeid";
34
+ /** BrowseName of the Property, per clause 6.3.1 Table 2. */
35
+ export declare const LAST_CHANGE_BROWSE_NAME = "LastChange";
36
+ export interface LastChangeTrackerOptions {
37
+ /** File backing the persisted values. Omit to keep them in memory only. */
38
+ persistencePath?: string;
39
+ /**
40
+ * Supplies "now" as a VersionTime. Injectable so a test can pin it; a
41
+ * one-second resolution is otherwise painful to assert against.
42
+ */
43
+ now?: () => number;
44
+ }
45
+ /**
46
+ * Keeps every category's `LastChange` Property correct, including the rollup to
47
+ * ancestors, and persists the values across restart.
48
+ */
49
+ export declare class LastChangeTracker {
50
+ private readonly addressSpace;
51
+ private readonly persistencePath?;
52
+ private readonly now;
53
+ /** Category NodeId string to VersionTime. */
54
+ private readonly values;
55
+ /** Serialises saves so two rapid changes cannot interleave their writes. */
56
+ private savingChain;
57
+ constructor(addressSpace: IAddressSpace, options?: LastChangeTrackerOptions);
58
+ /** The `VersionTime` currently recorded for a category. */
59
+ get(categoryNodeId: NodeId): number;
60
+ /**
61
+ * Record that a category changed, and roll the change up to every ancestor.
62
+ *
63
+ * Ancestors are walked at write time rather than computed at read time, so
64
+ * the Property a Client subscribes to actually carries the value — a
65
+ * rollup that existed only inside the Server would be invisible on the
66
+ * wire, which is the whole point of the Property.
67
+ */
68
+ touch(categoryNodeId: NodeId, versionTime?: number): Promise<number>;
69
+ /** Restore persisted values and publish them to the address space. */
70
+ restore(): Promise<void>;
71
+ /** Publish the current value of every known category, including zeros. */
72
+ publishAll(categoryNodeIds: NodeId[]): void;
73
+ /** Snapshot for persistence or inspection. */
74
+ snapshot(): Record<string, number>;
75
+ /** Persist, if a path was given. Saves are serialised, never concurrent. */
76
+ save(): Promise<void>;
77
+ /** Write the value onto the category's `LastChange` Property, if it has one. */
78
+ private writeProperty;
79
+ /**
80
+ * The category itself, then every `AliasNameCategoryType` ancestor up to and
81
+ * including the `Aliases` root.
82
+ *
83
+ * Cycle-safe: an address space that nests categories in a loop would
84
+ * otherwise hang the Method call that triggered the change.
85
+ */
86
+ private selfAndAncestors;
87
+ }
@@ -0,0 +1,174 @@
1
+ "use strict";
2
+ /**
3
+ * @module node-opcua-alias-name-server
4
+ *
5
+ * `LastChange` (OPC 10000-17 clause 6.3.1).
6
+ *
7
+ * A `VersionTime` — **a UInt32 count of seconds since 2000-01-01T00:00:00Z, not
8
+ * a DateTime**. Every other "last changed" Property in the SDK is a DateTime and
9
+ * the name gives no hint, which is what makes this the easiest thing here to get
10
+ * wrong.
11
+ *
12
+ * Clause 6.3.1 lists three things that move it:
13
+ *
14
+ * - an AliasName was added to or deleted from the category,
15
+ * - an AliasNameCategory was added or deleted,
16
+ * - the referenced Nodes of an AliasName in the category changed.
17
+ *
18
+ * and one rule that makes it a tree rather than a set of independent counters:
19
+ * *"For AliasNameCategoryType instances that are nested, the value of LastChange
20
+ * shall always be the latest VersionTime of all Organized AliasNames and
21
+ * AliasNameCategories."* So a change deep in the hierarchy moves every ancestor
22
+ * up to the root.
23
+ *
24
+ * ## One second of resolution
25
+ *
26
+ * Two changes inside the same second are indistinguishable — the value simply
27
+ * does not move. A Client must therefore treat an **equal** `LastChange` as
28
+ * "re-browse to be sure" rather than "nothing changed"; only a value *older*
29
+ * than the cached one carries the strong meaning clause 6.3.1 gives it, namely
30
+ * clear the cache. This is a property of `VersionTime`, not of this
31
+ * implementation, and there is nothing a Server can do about it.
32
+ */
33
+ Object.defineProperty(exports, "__esModule", { value: true });
34
+ exports.LastChangeTracker = exports.LAST_CHANGE_BROWSE_NAME = void 0;
35
+ const node_opcua_alias_name_common_1 = require("node-opcua-alias-name-common");
36
+ const node_opcua_data_model_1 = require("node-opcua-data-model");
37
+ const node_opcua_variant_1 = require("node-opcua-variant");
38
+ const alias_name_archive_js_1 = require("./alias_name_archive.js");
39
+ const well_known_js_1 = require("./well_known.js");
40
+ /** BrowseName of the Property, per clause 6.3.1 Table 2. */
41
+ exports.LAST_CHANGE_BROWSE_NAME = "LastChange";
42
+ /**
43
+ * Keeps every category's `LastChange` Property correct, including the rollup to
44
+ * ancestors, and persists the values across restart.
45
+ */
46
+ class LastChangeTracker {
47
+ addressSpace;
48
+ persistencePath;
49
+ now;
50
+ /** Category NodeId string to VersionTime. */
51
+ values = new Map();
52
+ /** Serialises saves so two rapid changes cannot interleave their writes. */
53
+ savingChain = Promise.resolve();
54
+ constructor(addressSpace, options) {
55
+ this.addressSpace = addressSpace;
56
+ this.persistencePath = options?.persistencePath;
57
+ this.now = options?.now ?? node_opcua_alias_name_common_1.nowVersionTime;
58
+ }
59
+ /** The `VersionTime` currently recorded for a category. */
60
+ get(categoryNodeId) {
61
+ return this.values.get(categoryNodeId.toString()) ?? 0;
62
+ }
63
+ /**
64
+ * Record that a category changed, and roll the change up to every ancestor.
65
+ *
66
+ * Ancestors are walked at write time rather than computed at read time, so
67
+ * the Property a Client subscribes to actually carries the value — a
68
+ * rollup that existed only inside the Server would be invisible on the
69
+ * wire, which is the whole point of the Property.
70
+ */
71
+ async touch(categoryNodeId, versionTime) {
72
+ const value = versionTime ?? this.now();
73
+ for (const nodeId of this.selfAndAncestors(categoryNodeId)) {
74
+ const key = nodeId.toString();
75
+ this.values.set(key, (0, node_opcua_alias_name_common_1.maxVersionTime)(this.values.get(key) ?? 0, value));
76
+ this.writeProperty(nodeId);
77
+ }
78
+ await this.save();
79
+ return value;
80
+ }
81
+ /** Restore persisted values and publish them to the address space. */
82
+ async restore() {
83
+ if (this.persistencePath) {
84
+ const archive = await (0, alias_name_archive_js_1.readAliasNameArchive)(this.persistencePath);
85
+ if (archive) {
86
+ for (const [key, value] of Object.entries(archive.lastChange)) {
87
+ this.values.set(key, value);
88
+ }
89
+ }
90
+ }
91
+ for (const key of this.values.keys()) {
92
+ const node = this.addressSpace.findNode(key);
93
+ if (node) {
94
+ this.writeProperty(node.nodeId);
95
+ }
96
+ }
97
+ }
98
+ /** Publish the current value of every known category, including zeros. */
99
+ publishAll(categoryNodeIds) {
100
+ for (const nodeId of categoryNodeIds) {
101
+ this.writeProperty(nodeId);
102
+ }
103
+ }
104
+ /** Snapshot for persistence or inspection. */
105
+ snapshot() {
106
+ return Object.fromEntries(this.values.entries());
107
+ }
108
+ /** Persist, if a path was given. Saves are serialised, never concurrent. */
109
+ async save() {
110
+ if (!this.persistencePath) {
111
+ return;
112
+ }
113
+ const path = this.persistencePath;
114
+ const archive = { version: alias_name_archive_js_1.ALIAS_NAME_ARCHIVE_VERSION, lastChange: this.snapshot() };
115
+ this.savingChain = this.savingChain.then(() => (0, alias_name_archive_js_1.writeAliasNameArchive)(path, archive));
116
+ await this.savingChain;
117
+ }
118
+ /** Write the value onto the category's `LastChange` Property, if it has one. */
119
+ writeProperty(categoryNodeId) {
120
+ const node = this.addressSpace.findNode(categoryNodeId);
121
+ if (!node || node.nodeClass !== node_opcua_data_model_1.NodeClass.Object) {
122
+ return;
123
+ }
124
+ const property = node.getPropertyByName(exports.LAST_CHANGE_BROWSE_NAME);
125
+ if (!property) {
126
+ // LastChange is Optional on AliasNameCategoryType; a category
127
+ // without one simply does not publish its version
128
+ return;
129
+ }
130
+ // VersionTime (i=20998) is a UInt32 subtype - not a DateTime
131
+ property.setValueFromSource({
132
+ dataType: node_opcua_variant_1.DataType.UInt32,
133
+ value: this.values.get(categoryNodeId.toString()) ?? 0
134
+ });
135
+ }
136
+ /**
137
+ * The category itself, then every `AliasNameCategoryType` ancestor up to and
138
+ * including the `Aliases` root.
139
+ *
140
+ * Cycle-safe: an address space that nests categories in a loop would
141
+ * otherwise hang the Method call that triggered the change.
142
+ */
143
+ selfAndAncestors(categoryNodeId) {
144
+ const result = [];
145
+ const seen = new Set();
146
+ const visit = (nodeId) => {
147
+ const key = nodeId.toString();
148
+ if (seen.has(key)) {
149
+ return;
150
+ }
151
+ seen.add(key);
152
+ result.push(nodeId);
153
+ const node = this.addressSpace.findNode(nodeId);
154
+ if (!node) {
155
+ return;
156
+ }
157
+ for (const parent of node.findReferencesExAsObject("HierarchicalReferences", node_opcua_data_model_1.BrowseDirection.Inverse)) {
158
+ if (parent.nodeClass === node_opcua_data_model_1.NodeClass.Object) {
159
+ visit(parent.nodeId);
160
+ }
161
+ }
162
+ };
163
+ visit(categoryNodeId);
164
+ // the root is always included even when the category was reached by a
165
+ // path that does not pass through it
166
+ const rootKey = well_known_js_1.WellKnownCategories.Aliases.toString();
167
+ if (!seen.has(rootKey) && this.addressSpace.findNode(well_known_js_1.WellKnownCategories.Aliases)) {
168
+ result.push(well_known_js_1.WellKnownCategories.Aliases);
169
+ }
170
+ return result;
171
+ }
172
+ }
173
+ exports.LastChangeTracker = LastChangeTracker;
174
+ //# sourceMappingURL=last_change.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"last_change.js","sourceRoot":"","sources":["../source/last_change.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;;;AAGH,+EAA8E;AAC9E,iEAAmE;AAEnE,2DAA8C;AAC9C,mEAKiC;AACjC,mDAAsD;AAEtD,4DAA4D;AAC/C,QAAA,uBAAuB,GAAG,YAAY,CAAC;AAYpD;;;GAGG;AACH,MAAa,iBAAiB;IACT,YAAY,CAAgB;IAC5B,eAAe,CAAU;IACzB,GAAG,CAAe;IACnC,6CAA6C;IAC5B,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAC;IACpD,4EAA4E;IACpE,WAAW,GAAkB,OAAO,CAAC,OAAO,EAAE,CAAC;IAEvD,YAAY,YAA2B,EAAE,OAAkC;QACvE,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,eAAe,GAAG,OAAO,EAAE,eAAe,CAAC;QAChD,IAAI,CAAC,GAAG,GAAG,OAAO,EAAE,GAAG,IAAI,6CAAc,CAAC;IAC9C,CAAC;IAED,2DAA2D;IACpD,GAAG,CAAC,cAAsB;QAC7B,OAAO,IAAI,CAAC,MAAM,CAAC,GA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IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,mCAAmB,CAAC,OAAO,CAAC,EAAE,CAAC;YAChF,MAAM,CAAC,IAAI,CAAC,mCAAmB,CAAC,OAAO,CAAC,CAAC;QAC7C,CAAC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AA1ID,8CA0IC"}
@@ -0,0 +1,88 @@
1
+ /**
2
+ * @module node-opcua-alias-name-server
3
+ *
4
+ * The fixed NodeIds of OPC 10000-17.
5
+ *
6
+ * Every well-known instance is resolved **by NodeId**, never by walking
7
+ * BrowseNames. Clause 9.1 gives these Objects static NodeIds precisely so they
8
+ * can be found without browsing, and a BrowseName walk would break on a Server
9
+ * that publishes the hierarchy under a localised DisplayName or that has a
10
+ * vendor Object of the same BrowseName elsewhere.
11
+ */
12
+ import { type NodeId } from "node-opcua-nodeid";
13
+ /**
14
+ * Default result cap; beyond it a call answers `Bad_ResponseTooLarge`
15
+ * (clause 6.3.2 Table 4).
16
+ *
17
+ * Lives here rather than in `install_alias_names` so that `bind_alias_category`
18
+ * can use it without the two importing each other.
19
+ */
20
+ export declare const DEFAULT_MAX_RESULTS = 1000;
21
+ /** `AliasNameType` ObjectType (clause 6.2). */
22
+ export declare const ALIAS_NAME_TYPE: NodeId;
23
+ /** `AliasNameCategoryType` ObjectType (clause 6.3). */
24
+ export declare const ALIAS_NAME_CATEGORY_TYPE: NodeId;
25
+ /** `VersionTime` DataType (OPC 10000-4 clause 7.43) - a UInt32 subtype. */
26
+ export declare const VERSION_TIME_DATA_TYPE: NodeId;
27
+ /** `AliasFor` ReferenceType (clause 8.2); the default link to a target Node. */
28
+ export declare const ALIAS_FOR: NodeId;
29
+ /** `PublishedDataSetType` (OPC 10000-14), the target type `Topics` restricts to. */
30
+ export declare const PUBLISHED_DATA_SET_TYPE: NodeId;
31
+ /** The three well-known category instances of clauses 9.2, 9.3 and 9.4. */
32
+ export declare const WellKnownCategories: {
33
+ /** `Aliases`, the root of the hierarchy (clause 9.2). */
34
+ readonly Aliases: NodeId;
35
+ /** `TagVariables`; targets restricted to Variables (clause 9.3). */
36
+ readonly TagVariables: NodeId;
37
+ /** `Topics`; targets restricted to PublishedDataSetType (clause 9.4). */
38
+ readonly Topics: NodeId;
39
+ };
40
+ /** `LastChange` on each well-known category (clause 6.3.1). */
41
+ export declare const WellKnownLastChange: {
42
+ readonly Aliases: NodeId;
43
+ readonly TagVariables: NodeId;
44
+ readonly Topics: NodeId;
45
+ };
46
+ /** The Method declarations on `AliasNameCategoryType`. */
47
+ export declare const MethodDeclarations: {
48
+ readonly FindAlias: NodeId;
49
+ readonly FindAliasVerbose: NodeId;
50
+ readonly AddAliasesToCategory: NodeId;
51
+ readonly DeleteAliasesFromCategory: NodeId;
52
+ };
53
+ /**
54
+ * The NodeIds OPC 10000-17 reserves for the *optional* Methods on the three
55
+ * well-known categories.
56
+ *
57
+ * The shipped `Opc.Ua.NodeSet2.xml` declares these Methods on
58
+ * `AliasNameCategoryType` but does not instantiate them on `Aliases`,
59
+ * `TagVariables` or `Topics` — yet upstream still assigns them fixed NodeIds.
60
+ * When installation adds them it uses these rather than server-assigned ones,
61
+ * so an aggregating Server sees the standard NodeId it expects.
62
+ */
63
+ export declare const WellKnownOptionalMethods: {
64
+ readonly Aliases: {
65
+ readonly FindAliasVerbose: NodeId;
66
+ readonly AddAliasesToCategory: NodeId;
67
+ readonly DeleteAliasesFromCategory: NodeId;
68
+ };
69
+ readonly TagVariables: {
70
+ readonly FindAliasVerbose: NodeId;
71
+ readonly AddAliasesToCategory: NodeId;
72
+ readonly DeleteAliasesFromCategory: NodeId;
73
+ };
74
+ readonly Topics: {
75
+ readonly FindAliasVerbose: NodeId;
76
+ readonly AddAliasesToCategory: NodeId;
77
+ readonly DeleteAliasesFromCategory: NodeId;
78
+ };
79
+ };
80
+ /**
81
+ * The `ALIAS` ServerCapability identifier (OPC 10000-12 Annex D Table D.1).
82
+ *
83
+ * A Server that does not advertise this will never be found by anything looking
84
+ * for alias-capable Servers, and nothing reports that failure. Part 17's prose
85
+ * writes it `Alias`; Part 12 Annex D is the normative source and writes `ALIAS`,
86
+ * matched case-insensitively.
87
+ */
88
+ export declare const ALIAS_SERVER_CAPABILITY = "ALIAS";
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ /**
3
+ * @module node-opcua-alias-name-server
4
+ *
5
+ * The fixed NodeIds of OPC 10000-17.
6
+ *
7
+ * Every well-known instance is resolved **by NodeId**, never by walking
8
+ * BrowseNames. Clause 9.1 gives these Objects static NodeIds precisely so they
9
+ * can be found without browsing, and a BrowseName walk would break on a Server
10
+ * that publishes the hierarchy under a localised DisplayName or that has a
11
+ * vendor Object of the same BrowseName elsewhere.
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.ALIAS_SERVER_CAPABILITY = exports.WellKnownOptionalMethods = exports.MethodDeclarations = exports.WellKnownLastChange = exports.WellKnownCategories = exports.PUBLISHED_DATA_SET_TYPE = exports.ALIAS_FOR = exports.VERSION_TIME_DATA_TYPE = exports.ALIAS_NAME_CATEGORY_TYPE = exports.ALIAS_NAME_TYPE = exports.DEFAULT_MAX_RESULTS = void 0;
15
+ const node_opcua_constants_1 = require("node-opcua-constants");
16
+ const node_opcua_nodeid_1 = require("node-opcua-nodeid");
17
+ /**
18
+ * Default result cap; beyond it a call answers `Bad_ResponseTooLarge`
19
+ * (clause 6.3.2 Table 4).
20
+ *
21
+ * Lives here rather than in `install_alias_names` so that `bind_alias_category`
22
+ * can use it without the two importing each other.
23
+ */
24
+ exports.DEFAULT_MAX_RESULTS = 1000;
25
+ /** `AliasNameType` ObjectType (clause 6.2). */
26
+ exports.ALIAS_NAME_TYPE = (0, node_opcua_nodeid_1.resolveNodeId)(node_opcua_constants_1.ObjectTypeIds.AliasNameType);
27
+ /** `AliasNameCategoryType` ObjectType (clause 6.3). */
28
+ exports.ALIAS_NAME_CATEGORY_TYPE = (0, node_opcua_nodeid_1.resolveNodeId)(node_opcua_constants_1.ObjectTypeIds.AliasNameCategoryType);
29
+ /** `VersionTime` DataType (OPC 10000-4 clause 7.43) - a UInt32 subtype. */
30
+ exports.VERSION_TIME_DATA_TYPE = (0, node_opcua_nodeid_1.resolveNodeId)(node_opcua_constants_1.DataTypeIds.VersionTime);
31
+ /** `AliasFor` ReferenceType (clause 8.2); the default link to a target Node. */
32
+ exports.ALIAS_FOR = (0, node_opcua_nodeid_1.resolveNodeId)(node_opcua_constants_1.ReferenceTypeIds.AliasFor);
33
+ /** `PublishedDataSetType` (OPC 10000-14), the target type `Topics` restricts to. */
34
+ exports.PUBLISHED_DATA_SET_TYPE = (0, node_opcua_nodeid_1.resolveNodeId)(node_opcua_constants_1.ObjectTypeIds.PublishedDataSetType);
35
+ /** The three well-known category instances of clauses 9.2, 9.3 and 9.4. */
36
+ exports.WellKnownCategories = {
37
+ /** `Aliases`, the root of the hierarchy (clause 9.2). */
38
+ Aliases: (0, node_opcua_nodeid_1.resolveNodeId)(node_opcua_constants_1.ObjectIds.Aliases),
39
+ /** `TagVariables`; targets restricted to Variables (clause 9.3). */
40
+ TagVariables: (0, node_opcua_nodeid_1.resolveNodeId)(node_opcua_constants_1.ObjectIds.TagVariables),
41
+ /** `Topics`; targets restricted to PublishedDataSetType (clause 9.4). */
42
+ Topics: (0, node_opcua_nodeid_1.resolveNodeId)(node_opcua_constants_1.ObjectIds.Topics)
43
+ };
44
+ /** `LastChange` on each well-known category (clause 6.3.1). */
45
+ exports.WellKnownLastChange = {
46
+ Aliases: (0, node_opcua_nodeid_1.resolveNodeId)(node_opcua_constants_1.VariableIds.Aliases_LastChange),
47
+ TagVariables: (0, node_opcua_nodeid_1.resolveNodeId)(node_opcua_constants_1.VariableIds.TagVariables_LastChange),
48
+ Topics: (0, node_opcua_nodeid_1.resolveNodeId)(node_opcua_constants_1.VariableIds.Topics_LastChange)
49
+ };
50
+ /** The Method declarations on `AliasNameCategoryType`. */
51
+ exports.MethodDeclarations = {
52
+ FindAlias: (0, node_opcua_nodeid_1.resolveNodeId)(node_opcua_constants_1.MethodIds.AliasNameCategoryType_FindAlias),
53
+ FindAliasVerbose: (0, node_opcua_nodeid_1.resolveNodeId)(node_opcua_constants_1.MethodIds.AliasNameCategoryType_FindAliasVerbose),
54
+ AddAliasesToCategory: (0, node_opcua_nodeid_1.resolveNodeId)(node_opcua_constants_1.MethodIds.AliasNameCategoryType_AddAliasesToCategory),
55
+ DeleteAliasesFromCategory: (0, node_opcua_nodeid_1.resolveNodeId)(node_opcua_constants_1.MethodIds.AliasNameCategoryType_DeleteAliasesFromCategory)
56
+ };
57
+ /**
58
+ * The NodeIds OPC 10000-17 reserves for the *optional* Methods on the three
59
+ * well-known categories.
60
+ *
61
+ * The shipped `Opc.Ua.NodeSet2.xml` declares these Methods on
62
+ * `AliasNameCategoryType` but does not instantiate them on `Aliases`,
63
+ * `TagVariables` or `Topics` — yet upstream still assigns them fixed NodeIds.
64
+ * When installation adds them it uses these rather than server-assigned ones,
65
+ * so an aggregating Server sees the standard NodeId it expects.
66
+ */
67
+ exports.WellKnownOptionalMethods = {
68
+ Aliases: {
69
+ FindAliasVerbose: (0, node_opcua_nodeid_1.resolveNodeId)(node_opcua_constants_1.MethodIds.Aliases_FindAliasVerbose),
70
+ AddAliasesToCategory: (0, node_opcua_nodeid_1.resolveNodeId)(node_opcua_constants_1.MethodIds.Aliases_AddAliasesToCategory),
71
+ DeleteAliasesFromCategory: (0, node_opcua_nodeid_1.resolveNodeId)(node_opcua_constants_1.MethodIds.Aliases_DeleteAliasesFromCategory)
72
+ },
73
+ TagVariables: {
74
+ FindAliasVerbose: (0, node_opcua_nodeid_1.resolveNodeId)(node_opcua_constants_1.MethodIds.TagVariables_FindAliasVerbose),
75
+ AddAliasesToCategory: (0, node_opcua_nodeid_1.resolveNodeId)(node_opcua_constants_1.MethodIds.TagVariables_AddAliasesToCategory),
76
+ DeleteAliasesFromCategory: (0, node_opcua_nodeid_1.resolveNodeId)(node_opcua_constants_1.MethodIds.TagVariables_DeleteAliasesFromCategory)
77
+ },
78
+ Topics: {
79
+ FindAliasVerbose: (0, node_opcua_nodeid_1.resolveNodeId)(node_opcua_constants_1.MethodIds.Topics_FindAliasVerbose),
80
+ AddAliasesToCategory: (0, node_opcua_nodeid_1.resolveNodeId)(node_opcua_constants_1.MethodIds.Topics_AddAliasesToCategory),
81
+ DeleteAliasesFromCategory: (0, node_opcua_nodeid_1.resolveNodeId)(node_opcua_constants_1.MethodIds.Topics_DeleteAliasesFromCategory)
82
+ }
83
+ };
84
+ /**
85
+ * The `ALIAS` ServerCapability identifier (OPC 10000-12 Annex D Table D.1).
86
+ *
87
+ * A Server that does not advertise this will never be found by anything looking
88
+ * for alias-capable Servers, and nothing reports that failure. Part 17's prose
89
+ * writes it `Alias`; Part 12 Annex D is the normative source and writes `ALIAS`,
90
+ * matched case-insensitively.
91
+ */
92
+ exports.ALIAS_SERVER_CAPABILITY = "ALIAS";
93
+ //# sourceMappingURL=well_known.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"well_known.js","sourceRoot":"","sources":["../source/well_known.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAEH,+DAAuH;AACvH,yDAA+D;AAE/D;;;;;;GAMG;AACU,QAAA,mBAAmB,GAAG,IAAI,CAAC;AAExC,+CAA+C;AAClC,QAAA,eAAe,GAAW,IAAA,iCAAa,EAAC,oCAAa,CAAC,aAAa,CAAC,CAAC;AAElF,uDAAuD;AAC1C,QAAA,wBAAwB,GAAW,IAAA,iCAAa,EAAC,oCAAa,CAAC,qBAAqB,CAAC,CAAC;AAEnG,2EAA2E;AAC9D,QAAA,sBAAsB,GAAW,IAAA,iCAAa,EAAC,kCAAW,CAAC,WAAW,CAAC,CAAC;AAErF,gFAAgF;AACnE,QAAA,SAAS,GAAW,IAAA,iCAAa,EAAC,uCAAgB,CAAC,QAAQ,CAAC,CAAC;AAE1E,oFAAoF;AACvE,QAAA,uBAAuB,GAAW,IAAA,iCAAa,EAAC,oCAAa,CAAC,oBAAoB,CAAC,CAAC;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