@wandelbots/nova-js 3.13.0-pr.307.dd54f61 → 3.13.0-pr.307.ea0533d

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 (45) hide show
  1. package/dist/{context-ffr5Q2dc.mjs → context-CmXqEEwW.mjs} +86 -3
  2. package/dist/context-CmXqEEwW.mjs.map +1 -0
  3. package/dist/{context-BZELA2eh.cjs → context-Cu5mXcFZ.cjs} +146 -3
  4. package/dist/context-Cu5mXcFZ.cjs.map +1 -0
  5. package/dist/experimental/nats/index.cjs +15 -84
  6. package/dist/experimental/nats/index.cjs.map +1 -1
  7. package/dist/experimental/nats/index.d.cts +10 -95
  8. package/dist/experimental/nats/index.d.cts.map +1 -1
  9. package/dist/experimental/nats/index.d.mts +10 -95
  10. package/dist/experimental/nats/index.d.mts.map +1 -1
  11. package/dist/experimental/nats/index.mjs +16 -84
  12. package/dist/experimental/nats/index.mjs.map +1 -1
  13. package/dist/index.cjs +12 -13
  14. package/dist/index.mjs +2 -3
  15. package/dist/v1/index.cjs +3 -3
  16. package/dist/v1/index.cjs.map +1 -1
  17. package/dist/v1/index.mjs +2 -2
  18. package/dist/v2/index.cjs +3 -4
  19. package/dist/v2/index.cjs.map +1 -1
  20. package/dist/v2/index.d.cts +83 -5
  21. package/dist/v2/index.d.cts.map +1 -1
  22. package/dist/v2/index.d.mts +82 -4
  23. package/dist/v2/index.d.mts.map +1 -1
  24. package/dist/v2/index.mjs +1 -2
  25. package/dist/v2/index.mjs.map +1 -1
  26. package/dist/{wandelscriptUtils-DcY1aLWu.cjs → wandelscriptUtils-BdqeVDCY.cjs} +12 -13
  27. package/dist/{wandelscriptUtils-DcY1aLWu.cjs.map → wandelscriptUtils-BdqeVDCY.cjs.map} +1 -1
  28. package/dist/{wandelscriptUtils-CpUXdLVc.mjs → wandelscriptUtils-CKhiZJsB.mjs} +2 -3
  29. package/dist/{wandelscriptUtils-CpUXdLVc.mjs.map → wandelscriptUtils-CKhiZJsB.mjs.map} +1 -1
  30. package/package.json +1 -1
  31. package/src/experimental/nats/index.ts +0 -3
  32. package/src/lib/experimental/nats/NovaNatsClient.ts +13 -67
  33. package/src/lib/experimental/nats/buildSubject.ts +5 -50
  34. package/src/lib/experimental/nats/generated/operations.ts +4 -64
  35. package/dist/Nova--8gozkLR.d.mts +0 -85
  36. package/dist/Nova--8gozkLR.d.mts.map +0 -1
  37. package/dist/Nova-B1o5iTQ6.d.cts +0 -85
  38. package/dist/Nova-B1o5iTQ6.d.cts.map +0 -1
  39. package/dist/context-BZELA2eh.cjs.map +0 -1
  40. package/dist/context-ffr5Q2dc.mjs.map +0 -1
  41. package/dist/converters-DnG1fX23.mjs +0 -87
  42. package/dist/converters-DnG1fX23.mjs.map +0 -1
  43. package/dist/converters-EYS27XJE.cjs +0 -146
  44. package/dist/converters-EYS27XJE.cjs.map +0 -1
  45. package/src/lib/experimental/nats/buildNatsServerUrl.ts +0 -15
@@ -1,87 +0,0 @@
1
- //#region src/lib/converters.ts
2
- /**
3
- * Parse a string as a URL, with options to enforce or default the scheme.
4
- */
5
- function parseUrl(url, options = {}) {
6
- const { scheme, defaultScheme } = options;
7
- const schemeRegex = /^[a-zA-Z]+:\/\//;
8
- if (scheme) {
9
- url = url.replace(schemeRegex, "");
10
- url = `${scheme}://${url}`;
11
- } else if (defaultScheme && !schemeRegex.test(url)) url = `${defaultScheme}://${url}`;
12
- return new URL(url);
13
- }
14
- /**
15
- * Attempt to parse a string as a URL; return undefined if we can't
16
- */
17
- function tryParseUrl(url, options = {}) {
18
- try {
19
- return parseUrl(url, options);
20
- } catch {
21
- return;
22
- }
23
- }
24
- /**
25
- * Permissively parse a NOVA instance URL from a config variable.
26
- * If scheme is not specified, defaults to https for *.wandelbots.io hosts,
27
- * and http otherwise.
28
- * Throws an error if a valid URL could not be determined.
29
- */
30
- function parseNovaInstanceUrl(url) {
31
- if (tryParseUrl(url, { defaultScheme: "http" })?.host.endsWith(".wandelbots.io")) return parseUrl(url, { defaultScheme: "https" });
32
- else return parseUrl(url, { defaultScheme: "http" });
33
- }
34
- /** Try to parse something as JSON; return undefined if we can't */
35
- function tryParseJson(json) {
36
- try {
37
- return JSON.parse(json);
38
- } catch {
39
- return;
40
- }
41
- }
42
- /** Try to turn something into JSON; return undefined if we can't */
43
- function tryStringifyJson(json) {
44
- try {
45
- return JSON.stringify(json);
46
- } catch {
47
- return;
48
- }
49
- }
50
- /**
51
- * Converts object parameters to query string.
52
- * e.g. { a: "1", b: "2" } => "?a=1&b=2"
53
- * {} => ""
54
- */
55
- function makeUrlQueryString(obj) {
56
- const str = new URLSearchParams(obj).toString();
57
- return str ? `?${str}` : "";
58
- }
59
- /** Convert radians to degrees */
60
- function radiansToDegrees(radians) {
61
- return radians * (180 / Math.PI);
62
- }
63
- /** Convert degrees to radians */
64
- function degreesToRadians(degrees) {
65
- return degrees * (Math.PI / 180);
66
- }
67
- /**
68
- * Check for coordinate system id equivalence, accounting for the "world" default
69
- * on empty/undefined values.
70
- */
71
- function isSameCoordinateSystem(firstCoordSystem, secondCoordSystem) {
72
- if (!firstCoordSystem) firstCoordSystem = "world";
73
- if (!secondCoordSystem) secondCoordSystem = "world";
74
- return firstCoordSystem === secondCoordSystem;
75
- }
76
- /**
77
- * Helpful const for converting {x, y, z} to [x, y, z] and vice versa
78
- */
79
- const XYZ_TO_VECTOR = {
80
- x: 0,
81
- y: 1,
82
- z: 2
83
- };
84
- //#endregion
85
- export { parseNovaInstanceUrl as a, tryParseJson as c, makeUrlQueryString as i, tryParseUrl as l, degreesToRadians as n, parseUrl as o, isSameCoordinateSystem as r, radiansToDegrees as s, XYZ_TO_VECTOR as t, tryStringifyJson as u };
86
-
87
- //# sourceMappingURL=converters-DnG1fX23.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"converters-DnG1fX23.mjs","names":[],"sources":["../src/lib/converters.ts"],"sourcesContent":["export type URLParseOptions = {\n /**\n * Ignore any scheme in the input string and force this scheme instead.\n */\n scheme?: \"http\" | \"https\"\n /**\n * If the input string does not include a scheme, use this as the default\n * scheme.\n */\n defaultScheme?: \"http\" | \"https\"\n}\n\n/**\n * Parse a string as a URL, with options to enforce or default the scheme.\n */\nexport function parseUrl(url: string, options: URLParseOptions = {}): URL {\n const { scheme, defaultScheme } = options\n\n const schemeRegex = /^[a-zA-Z]+:\\/\\//\n\n if (scheme) {\n // Force the scheme by removing any existing scheme and prepending the desired one\n url = url.replace(schemeRegex, \"\")\n url = `${scheme}://${url}`\n } else if (defaultScheme && !schemeRegex.test(url)) {\n // No scheme is present, add the default one\n url = `${defaultScheme}://${url}`\n }\n\n return new URL(url)\n}\n\n/**\n * Attempt to parse a string as a URL; return undefined if we can't\n */\nexport function tryParseUrl(\n url: string,\n options: URLParseOptions = {},\n): URL | undefined {\n try {\n return parseUrl(url, options)\n } catch {\n return undefined\n }\n}\n\n/**\n * Permissively parse a NOVA instance URL from a config variable.\n * If scheme is not specified, defaults to https for *.wandelbots.io hosts,\n * and http otherwise.\n * Throws an error if a valid URL could not be determined.\n */\nexport function parseNovaInstanceUrl(url: string): URL {\n const testUrl = tryParseUrl(url, { defaultScheme: \"http\" })\n if (testUrl?.host.endsWith(\".wandelbots.io\")) {\n return parseUrl(url, { defaultScheme: \"https\" })\n } else {\n return parseUrl(url, { defaultScheme: \"http\" })\n }\n}\n\n/** Try to parse something as JSON; return undefined if we can't */\n// biome-ignore lint/suspicious/noExplicitAny: it's json\nexport function tryParseJson(json: unknown): any {\n try {\n return JSON.parse(json as string)\n } catch {\n return undefined\n }\n}\n\n/** Try to turn something into JSON; return undefined if we can't */\nexport function tryStringifyJson(json: unknown): string | undefined {\n try {\n return JSON.stringify(json)\n } catch {\n return undefined\n }\n}\n\n/**\n * Converts object parameters to query string.\n * e.g. { a: \"1\", b: \"2\" } => \"?a=1&b=2\"\n * {} => \"\"\n */\nexport function makeUrlQueryString(obj: Record<string, string>): string {\n const str = new URLSearchParams(obj).toString()\n return str ? `?${str}` : \"\"\n}\n\n/** Convert radians to degrees */\nexport function radiansToDegrees(radians: number): number {\n return radians * (180 / Math.PI)\n}\n\n/** Convert degrees to radians */\nexport function degreesToRadians(degrees: number): number {\n return degrees * (Math.PI / 180)\n}\n\n/**\n * Check for coordinate system id equivalence, accounting for the \"world\" default\n * on empty/undefined values.\n */\nexport function isSameCoordinateSystem(\n firstCoordSystem: string | undefined,\n secondCoordSystem: string | undefined,\n) {\n if (!firstCoordSystem) firstCoordSystem = \"world\"\n if (!secondCoordSystem) secondCoordSystem = \"world\"\n\n return firstCoordSystem === secondCoordSystem\n}\n\n/**\n * Helpful const for converting {x, y, z} to [x, y, z] and vice versa\n */\nexport const XYZ_TO_VECTOR = { x: 0, y: 1, z: 2 }\n"],"mappings":";;;;AAeA,SAAgB,SAAS,KAAa,UAA2B,CAAC,GAAQ;CACxE,MAAM,EAAE,QAAQ,kBAAkB;CAElC,MAAM,cAAc;CAEpB,IAAI,QAAQ;EAEV,MAAM,IAAI,QAAQ,aAAa,EAAE;EACjC,MAAM,GAAG,OAAO,KAAK;CACvB,OAAO,IAAI,iBAAiB,CAAC,YAAY,KAAK,GAAG,GAE/C,MAAM,GAAG,cAAc,KAAK;CAG9B,OAAO,IAAI,IAAI,GAAG;AACpB;;;;AAKA,SAAgB,YACd,KACA,UAA2B,CAAC,GACX;CACjB,IAAI;EACF,OAAO,SAAS,KAAK,OAAO;CAC9B,QAAQ;EACN;CACF;AACF;;;;;;;AAQA,SAAgB,qBAAqB,KAAkB;CAErD,IADgB,YAAY,KAAK,EAAE,eAAe,OAAO,CAC/C,GAAG,KAAK,SAAS,gBAAgB,GACzC,OAAO,SAAS,KAAK,EAAE,eAAe,QAAQ,CAAC;MAE/C,OAAO,SAAS,KAAK,EAAE,eAAe,OAAO,CAAC;AAElD;;AAIA,SAAgB,aAAa,MAAoB;CAC/C,IAAI;EACF,OAAO,KAAK,MAAM,IAAc;CAClC,QAAQ;EACN;CACF;AACF;;AAGA,SAAgB,iBAAiB,MAAmC;CAClE,IAAI;EACF,OAAO,KAAK,UAAU,IAAI;CAC5B,QAAQ;EACN;CACF;AACF;;;;;;AAOA,SAAgB,mBAAmB,KAAqC;CACtE,MAAM,MAAM,IAAI,gBAAgB,GAAG,EAAE,SAAS;CAC9C,OAAO,MAAM,IAAI,QAAQ;AAC3B;;AAGA,SAAgB,iBAAiB,SAAyB;CACxD,OAAO,WAAW,MAAM,KAAK;AAC/B;;AAGA,SAAgB,iBAAiB,SAAyB;CACxD,OAAO,WAAW,KAAK,KAAK;AAC9B;;;;;AAMA,SAAgB,uBACd,kBACA,mBACA;CACA,IAAI,CAAC,kBAAkB,mBAAmB;CAC1C,IAAI,CAAC,mBAAmB,oBAAoB;CAE5C,OAAO,qBAAqB;AAC9B;;;;AAKA,MAAa,gBAAgB;CAAE,GAAG;CAAG,GAAG;CAAG,GAAG;AAAE"}
@@ -1,146 +0,0 @@
1
- //#region src/lib/converters.ts
2
- /**
3
- * Parse a string as a URL, with options to enforce or default the scheme.
4
- */
5
- function parseUrl(url, options = {}) {
6
- const { scheme, defaultScheme } = options;
7
- const schemeRegex = /^[a-zA-Z]+:\/\//;
8
- if (scheme) {
9
- url = url.replace(schemeRegex, "");
10
- url = `${scheme}://${url}`;
11
- } else if (defaultScheme && !schemeRegex.test(url)) url = `${defaultScheme}://${url}`;
12
- return new URL(url);
13
- }
14
- /**
15
- * Attempt to parse a string as a URL; return undefined if we can't
16
- */
17
- function tryParseUrl(url, options = {}) {
18
- try {
19
- return parseUrl(url, options);
20
- } catch {
21
- return;
22
- }
23
- }
24
- /**
25
- * Permissively parse a NOVA instance URL from a config variable.
26
- * If scheme is not specified, defaults to https for *.wandelbots.io hosts,
27
- * and http otherwise.
28
- * Throws an error if a valid URL could not be determined.
29
- */
30
- function parseNovaInstanceUrl(url) {
31
- if (tryParseUrl(url, { defaultScheme: "http" })?.host.endsWith(".wandelbots.io")) return parseUrl(url, { defaultScheme: "https" });
32
- else return parseUrl(url, { defaultScheme: "http" });
33
- }
34
- /** Try to parse something as JSON; return undefined if we can't */
35
- function tryParseJson(json) {
36
- try {
37
- return JSON.parse(json);
38
- } catch {
39
- return;
40
- }
41
- }
42
- /** Try to turn something into JSON; return undefined if we can't */
43
- function tryStringifyJson(json) {
44
- try {
45
- return JSON.stringify(json);
46
- } catch {
47
- return;
48
- }
49
- }
50
- /**
51
- * Converts object parameters to query string.
52
- * e.g. { a: "1", b: "2" } => "?a=1&b=2"
53
- * {} => ""
54
- */
55
- function makeUrlQueryString(obj) {
56
- const str = new URLSearchParams(obj).toString();
57
- return str ? `?${str}` : "";
58
- }
59
- /** Convert radians to degrees */
60
- function radiansToDegrees(radians) {
61
- return radians * (180 / Math.PI);
62
- }
63
- /** Convert degrees to radians */
64
- function degreesToRadians(degrees) {
65
- return degrees * (Math.PI / 180);
66
- }
67
- /**
68
- * Check for coordinate system id equivalence, accounting for the "world" default
69
- * on empty/undefined values.
70
- */
71
- function isSameCoordinateSystem(firstCoordSystem, secondCoordSystem) {
72
- if (!firstCoordSystem) firstCoordSystem = "world";
73
- if (!secondCoordSystem) secondCoordSystem = "world";
74
- return firstCoordSystem === secondCoordSystem;
75
- }
76
- /**
77
- * Helpful const for converting {x, y, z} to [x, y, z] and vice versa
78
- */
79
- const XYZ_TO_VECTOR = {
80
- x: 0,
81
- y: 1,
82
- z: 2
83
- };
84
- //#endregion
85
- Object.defineProperty(exports, "XYZ_TO_VECTOR", {
86
- enumerable: true,
87
- get: function() {
88
- return XYZ_TO_VECTOR;
89
- }
90
- });
91
- Object.defineProperty(exports, "degreesToRadians", {
92
- enumerable: true,
93
- get: function() {
94
- return degreesToRadians;
95
- }
96
- });
97
- Object.defineProperty(exports, "isSameCoordinateSystem", {
98
- enumerable: true,
99
- get: function() {
100
- return isSameCoordinateSystem;
101
- }
102
- });
103
- Object.defineProperty(exports, "makeUrlQueryString", {
104
- enumerable: true,
105
- get: function() {
106
- return makeUrlQueryString;
107
- }
108
- });
109
- Object.defineProperty(exports, "parseNovaInstanceUrl", {
110
- enumerable: true,
111
- get: function() {
112
- return parseNovaInstanceUrl;
113
- }
114
- });
115
- Object.defineProperty(exports, "parseUrl", {
116
- enumerable: true,
117
- get: function() {
118
- return parseUrl;
119
- }
120
- });
121
- Object.defineProperty(exports, "radiansToDegrees", {
122
- enumerable: true,
123
- get: function() {
124
- return radiansToDegrees;
125
- }
126
- });
127
- Object.defineProperty(exports, "tryParseJson", {
128
- enumerable: true,
129
- get: function() {
130
- return tryParseJson;
131
- }
132
- });
133
- Object.defineProperty(exports, "tryParseUrl", {
134
- enumerable: true,
135
- get: function() {
136
- return tryParseUrl;
137
- }
138
- });
139
- Object.defineProperty(exports, "tryStringifyJson", {
140
- enumerable: true,
141
- get: function() {
142
- return tryStringifyJson;
143
- }
144
- });
145
-
146
- //# sourceMappingURL=converters-EYS27XJE.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"converters-EYS27XJE.cjs","names":[],"sources":["../src/lib/converters.ts"],"sourcesContent":["export type URLParseOptions = {\n /**\n * Ignore any scheme in the input string and force this scheme instead.\n */\n scheme?: \"http\" | \"https\"\n /**\n * If the input string does not include a scheme, use this as the default\n * scheme.\n */\n defaultScheme?: \"http\" | \"https\"\n}\n\n/**\n * Parse a string as a URL, with options to enforce or default the scheme.\n */\nexport function parseUrl(url: string, options: URLParseOptions = {}): URL {\n const { scheme, defaultScheme } = options\n\n const schemeRegex = /^[a-zA-Z]+:\\/\\//\n\n if (scheme) {\n // Force the scheme by removing any existing scheme and prepending the desired one\n url = url.replace(schemeRegex, \"\")\n url = `${scheme}://${url}`\n } else if (defaultScheme && !schemeRegex.test(url)) {\n // No scheme is present, add the default one\n url = `${defaultScheme}://${url}`\n }\n\n return new URL(url)\n}\n\n/**\n * Attempt to parse a string as a URL; return undefined if we can't\n */\nexport function tryParseUrl(\n url: string,\n options: URLParseOptions = {},\n): URL | undefined {\n try {\n return parseUrl(url, options)\n } catch {\n return undefined\n }\n}\n\n/**\n * Permissively parse a NOVA instance URL from a config variable.\n * If scheme is not specified, defaults to https for *.wandelbots.io hosts,\n * and http otherwise.\n * Throws an error if a valid URL could not be determined.\n */\nexport function parseNovaInstanceUrl(url: string): URL {\n const testUrl = tryParseUrl(url, { defaultScheme: \"http\" })\n if (testUrl?.host.endsWith(\".wandelbots.io\")) {\n return parseUrl(url, { defaultScheme: \"https\" })\n } else {\n return parseUrl(url, { defaultScheme: \"http\" })\n }\n}\n\n/** Try to parse something as JSON; return undefined if we can't */\n// biome-ignore lint/suspicious/noExplicitAny: it's json\nexport function tryParseJson(json: unknown): any {\n try {\n return JSON.parse(json as string)\n } catch {\n return undefined\n }\n}\n\n/** Try to turn something into JSON; return undefined if we can't */\nexport function tryStringifyJson(json: unknown): string | undefined {\n try {\n return JSON.stringify(json)\n } catch {\n return undefined\n }\n}\n\n/**\n * Converts object parameters to query string.\n * e.g. { a: \"1\", b: \"2\" } => \"?a=1&b=2\"\n * {} => \"\"\n */\nexport function makeUrlQueryString(obj: Record<string, string>): string {\n const str = new URLSearchParams(obj).toString()\n return str ? `?${str}` : \"\"\n}\n\n/** Convert radians to degrees */\nexport function radiansToDegrees(radians: number): number {\n return radians * (180 / Math.PI)\n}\n\n/** Convert degrees to radians */\nexport function degreesToRadians(degrees: number): number {\n return degrees * (Math.PI / 180)\n}\n\n/**\n * Check for coordinate system id equivalence, accounting for the \"world\" default\n * on empty/undefined values.\n */\nexport function isSameCoordinateSystem(\n firstCoordSystem: string | undefined,\n secondCoordSystem: string | undefined,\n) {\n if (!firstCoordSystem) firstCoordSystem = \"world\"\n if (!secondCoordSystem) secondCoordSystem = \"world\"\n\n return firstCoordSystem === secondCoordSystem\n}\n\n/**\n * Helpful const for converting {x, y, z} to [x, y, z] and vice versa\n */\nexport const XYZ_TO_VECTOR = { x: 0, y: 1, z: 2 }\n"],"mappings":";;;;AAeA,SAAgB,SAAS,KAAa,UAA2B,CAAC,GAAQ;CACxE,MAAM,EAAE,QAAQ,kBAAkB;CAElC,MAAM,cAAc;CAEpB,IAAI,QAAQ;EAEV,MAAM,IAAI,QAAQ,aAAa,EAAE;EACjC,MAAM,GAAG,OAAO,KAAK;CACvB,OAAO,IAAI,iBAAiB,CAAC,YAAY,KAAK,GAAG,GAE/C,MAAM,GAAG,cAAc,KAAK;CAG9B,OAAO,IAAI,IAAI,GAAG;AACpB;;;;AAKA,SAAgB,YACd,KACA,UAA2B,CAAC,GACX;CACjB,IAAI;EACF,OAAO,SAAS,KAAK,OAAO;CAC9B,QAAQ;EACN;CACF;AACF;;;;;;;AAQA,SAAgB,qBAAqB,KAAkB;CAErD,IADgB,YAAY,KAAK,EAAE,eAAe,OAAO,CAC/C,GAAG,KAAK,SAAS,gBAAgB,GACzC,OAAO,SAAS,KAAK,EAAE,eAAe,QAAQ,CAAC;MAE/C,OAAO,SAAS,KAAK,EAAE,eAAe,OAAO,CAAC;AAElD;;AAIA,SAAgB,aAAa,MAAoB;CAC/C,IAAI;EACF,OAAO,KAAK,MAAM,IAAc;CAClC,QAAQ;EACN;CACF;AACF;;AAGA,SAAgB,iBAAiB,MAAmC;CAClE,IAAI;EACF,OAAO,KAAK,UAAU,IAAI;CAC5B,QAAQ;EACN;CACF;AACF;;;;;;AAOA,SAAgB,mBAAmB,KAAqC;CACtE,MAAM,MAAM,IAAI,gBAAgB,GAAG,EAAE,SAAS;CAC9C,OAAO,MAAM,IAAI,QAAQ;AAC3B;;AAGA,SAAgB,iBAAiB,SAAyB;CACxD,OAAO,WAAW,MAAM,KAAK;AAC/B;;AAGA,SAAgB,iBAAiB,SAAyB;CACxD,OAAO,WAAW,KAAK,KAAK;AAC9B;;;;;AAMA,SAAgB,uBACd,kBACA,mBACA;CACA,IAAI,CAAC,kBAAkB,mBAAmB;CAC1C,IAAI,CAAC,mBAAmB,oBAAoB;CAE5C,OAAO,qBAAqB;AAC9B;;;;AAKA,MAAa,gBAAgB;CAAE,GAAG;CAAG,GAAG;CAAG,GAAG;AAAE"}
@@ -1,15 +0,0 @@
1
- import { parseNovaInstanceUrl } from "../../converters.ts"
2
-
3
- /**
4
- * Builds the WebSocket URL for a NOVA instance's NATS gateway from its
5
- * instance URL, e.g. `https://foo.instance.wandelbots.io` becomes
6
- * `wss://foo.instance.wandelbots.io/api/nats`.
7
- *
8
- * Pass the result as `servers` in the `NovaNatsClientConfig` passed to
9
- * `NovaNatsClient`.
10
- */
11
- export function buildNatsServerUrl(instanceUrl: string): string {
12
- const url = parseNovaInstanceUrl(instanceUrl)
13
- const protocol = url.protocol === "https:" ? "wss:" : "ws:"
14
- return `${protocol}//${url.host}/api/nats`
15
- }