@dxos/cli 0.1.46 → 0.1.48-next.83f55fd

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 (48) hide show
  1. package/README.md +1 -1
  2. package/config/config-default.yml +2 -0
  3. package/config/config-dev.yml +2 -0
  4. package/config/config-local.yml +2 -0
  5. package/config/config-staging.yml +2 -0
  6. package/config/config.yml +2 -0
  7. package/dist/src/base-command.d.ts +2 -1
  8. package/dist/src/base-command.d.ts.map +1 -1
  9. package/dist/src/base-command.js +28 -7
  10. package/dist/src/base-command.js.map +1 -1
  11. package/dist/src/commands/tunnel/list.js +2 -2
  12. package/dist/src/commands/tunnel/list.js.map +1 -1
  13. package/dist/src/commands/tunnel/set.js +2 -2
  14. package/dist/src/commands/tunnel/set.js.map +1 -1
  15. package/dist/src/daemon/faas/api.d.ts +346 -0
  16. package/dist/src/daemon/faas/api.d.ts.map +1 -0
  17. package/dist/src/daemon/faas/api.js +11 -0
  18. package/dist/src/daemon/faas/api.js.map +1 -0
  19. package/dist/src/daemon/faas/connector.d.ts +46 -0
  20. package/dist/src/daemon/faas/connector.d.ts.map +1 -0
  21. package/dist/src/daemon/faas/connector.js +185 -0
  22. package/dist/src/daemon/faas/connector.js.map +1 -0
  23. package/dist/src/daemon/run-services.d.ts.map +1 -1
  24. package/dist/src/daemon/run-services.js +21 -11
  25. package/dist/src/daemon/run-services.js.map +1 -1
  26. package/dist/src/util/index.d.ts +2 -1
  27. package/dist/src/util/index.d.ts.map +1 -1
  28. package/dist/src/util/index.js +2 -1
  29. package/dist/src/util/index.js.map +1 -1
  30. package/dist/src/util/publish/common.d.ts +0 -7
  31. package/dist/src/util/publish/common.d.ts.map +1 -1
  32. package/dist/src/util/publish/common.js +2 -26
  33. package/dist/src/util/publish/common.js.map +1 -1
  34. package/dist/src/util/telemetryrc.json +2 -2
  35. package/dist/src/util/tunnel/common.d.ts +8 -0
  36. package/dist/src/util/tunnel/common.d.ts.map +1 -0
  37. package/dist/src/util/tunnel/common.js +32 -0
  38. package/dist/src/util/tunnel/common.js.map +1 -0
  39. package/dist/src/util/tunnel/index.d.ts +3 -0
  40. package/dist/src/util/tunnel/index.d.ts.map +1 -0
  41. package/dist/src/util/tunnel/index.js +22 -0
  42. package/dist/src/util/tunnel/index.js.map +1 -0
  43. package/dist/src/util/tunnel/tunnel-rpc-peer.d.ts +15 -0
  44. package/dist/src/util/tunnel/tunnel-rpc-peer.d.ts.map +1 -0
  45. package/dist/src/util/tunnel/tunnel-rpc-peer.js +89 -0
  46. package/dist/src/util/tunnel/tunnel-rpc-peer.js.map +1 -0
  47. package/oclif.manifest.json +1 -1
  48. package/package.json +22 -19
@@ -0,0 +1,185 @@
1
+ "use strict";
2
+ //
3
+ // Copyright 2023 DXOS.org
4
+ //
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.FaasConnector = void 0;
7
+ const async_1 = require("@dxos/async");
8
+ const client_1 = require("@dxos/client");
9
+ const context_1 = require("@dxos/context");
10
+ const debug_1 = require("@dxos/debug");
11
+ const log_1 = require("@dxos/log");
12
+ const observable_object_1 = require("@dxos/observable-object");
13
+ class FaasConnector {
14
+ constructor(_faasConfig, _clientServices) {
15
+ this._faasConfig = _faasConfig;
16
+ this._clientServices = _clientServices;
17
+ this._ctx = new context_1.Context();
18
+ this._remountTask = new async_1.DeferredTask(this._ctx, async () => {
19
+ await this._remountTriggers();
20
+ });
21
+ this._mountedTriggers = [];
22
+ this._client = new client_1.Client({ services: _clientServices });
23
+ }
24
+ async open() {
25
+ await this._client.initialize();
26
+ await this._watchTriggers();
27
+ await this._remountTask.schedule();
28
+ }
29
+ async close() {
30
+ await this._ctx.dispose();
31
+ await this._client.destroy();
32
+ await this._unmountTriggers();
33
+ }
34
+ async _watchTriggers() {
35
+ const observedSpaces = new Map();
36
+ const update = () => {
37
+ const spaces = this._client.spaces.get();
38
+ for (const space of spaces) {
39
+ if (observedSpaces.has(space)) {
40
+ continue;
41
+ }
42
+ if (space.state.get() !== client_1.SpaceState.READY) {
43
+ continue;
44
+ }
45
+ const ctx = this._ctx.derive();
46
+ observedSpaces.set(space, ctx);
47
+ const subscription = (0, observable_object_1.createSubscription)(() => {
48
+ this._remountTask.schedule();
49
+ });
50
+ const query = space.db.query({ __type: 'dxos.function.Trigger' });
51
+ const unsubscribe = query.subscribe(() => {
52
+ subscription.update(query.objects);
53
+ });
54
+ subscription.update(query.objects);
55
+ ctx.onDispose(unsubscribe);
56
+ }
57
+ for (const [space, ctx] of observedSpaces) {
58
+ if (spaces.includes(space)) {
59
+ continue;
60
+ }
61
+ observedSpaces.delete(space);
62
+ void ctx.dispose();
63
+ }
64
+ };
65
+ const sub = this._client.spaces.subscribe(() => {
66
+ update();
67
+ });
68
+ this._ctx.onDispose(() => sub.unsubscribe());
69
+ }
70
+ async _getTriggers() {
71
+ const triggers = [];
72
+ for (const space of this._client.spaces.get()) {
73
+ if (space.state.get() !== client_1.SpaceState.READY) {
74
+ continue;
75
+ }
76
+ // TODO(dmaretskyi): fix type.
77
+ const objects = space.db.query({ __type: 'dxos.function.Trigger' }).objects;
78
+ triggers.push(...objects.map((object) => object.toJSON()));
79
+ }
80
+ return triggers;
81
+ }
82
+ async _unmountTriggers() {
83
+ const oldTriggers = this._mountedTriggers.splice(0, this._mountedTriggers.length);
84
+ for (const { clear, trigger } of oldTriggers) {
85
+ await clear();
86
+ log_1.log.info('unmounted trigger', { trigger: trigger.id }, { file: "packages/devtools/cli/src/daemon/faas/connector.ts", line: 156, scope: this, bugcheck: "If you see this message then it means that the source code preprocessor for @dxos/log is broken. It probably has misinterpreted an unrelated call for a logger invocation.", callSite: (fn, args) => fn(...args) });
87
+ }
88
+ }
89
+ async _remountTriggers() {
90
+ await this._unmountTriggers();
91
+ const triggers = await this._getTriggers();
92
+ log_1.log.info('discovered triggers', { triggers: triggers.length }, { file: "packages/devtools/cli/src/daemon/faas/connector.ts", line: 165, scope: this, bugcheck: "If you see this message then it means that the source code preprocessor for @dxos/log is broken. It probably has misinterpreted an unrelated call for a logger invocation.", callSite: (fn, args) => fn(...args) });
93
+ await Promise.all(triggers.map(async (trigger) => {
94
+ await this._mountTrigger(trigger);
95
+ }));
96
+ }
97
+ async _mountTrigger(trigger) {
98
+ const ctx = this._ctx.derive();
99
+ this._mountedTriggers.push({
100
+ trigger,
101
+ clear: async () => {
102
+ await ctx.dispose();
103
+ },
104
+ });
105
+ const space = this._client.spaces.get().find((space) => space.key.equals(trigger.spaceKey));
106
+ if (!space) {
107
+ log_1.log.warn('space not found', { space: trigger.spaceKey }, { file: "packages/devtools/cli/src/daemon/faas/connector.ts", line: 186, scope: this, bugcheck: "If you see this message then it means that the source code preprocessor for @dxos/log is broken. It probably has misinterpreted an unrelated call for a logger invocation.", callSite: (fn, args) => fn(...args) });
108
+ return;
109
+ }
110
+ await space.waitUntilReady();
111
+ if (this._ctx.disposed) {
112
+ return;
113
+ }
114
+ const updatedIds = new Set();
115
+ const invoker = new async_1.DeferredTask(ctx, async () => {
116
+ const updatedObjects = Array.from(updatedIds);
117
+ updatedIds.clear();
118
+ const event = {
119
+ trigger,
120
+ objects: updatedObjects,
121
+ };
122
+ await this._dispatch(event);
123
+ });
124
+ const selection = (0, observable_object_1.createSubscription)(({ added, updated }) => {
125
+ for (const object of added) {
126
+ updatedIds.add(object.id);
127
+ }
128
+ for (const object of updated) {
129
+ updatedIds.add(object.id);
130
+ }
131
+ invoker.schedule();
132
+ });
133
+ ctx.onDispose(() => selection.unsubscribe());
134
+ const query = space.db.query({
135
+ ...trigger.subscription.props,
136
+ '@type': trigger.subscription.type,
137
+ });
138
+ const unsubscribe = query.subscribe(({ objects }) => {
139
+ selection.update(objects);
140
+ });
141
+ ctx.onDispose(unsubscribe);
142
+ log_1.log.info('mounted trigger', { trigger: trigger.id }, { file: "packages/devtools/cli/src/daemon/faas/connector.ts", line: 229, scope: this, bugcheck: "If you see this message then it means that the source code preprocessor for @dxos/log is broken. It probably has misinterpreted an unrelated call for a logger invocation.", callSite: (fn, args) => fn(...args) });
143
+ }
144
+ async _dispatch(event) {
145
+ var _a;
146
+ const installedFunctions = await this._getFunctions();
147
+ const installedFunction = installedFunctions.find((func) => func.name === event.trigger.function.name);
148
+ if (!installedFunction) {
149
+ log_1.log.warn('function not found', { function: event.trigger.function.name }, { file: "packages/devtools/cli/src/daemon/faas/connector.ts", line: 238, scope: this, bugcheck: "If you see this message then it means that the source code preprocessor for @dxos/log is broken. It probably has misinterpreted an unrelated call for a logger invocation.", callSite: (fn, args) => fn(...args) });
150
+ return;
151
+ }
152
+ const data = {
153
+ event,
154
+ context: {
155
+ clientUrl: (_a = this._faasConfig.daemonUrl) !== null && _a !== void 0 ? _a : (0, debug_1.raise)(new Error('daemonUrl is not set')),
156
+ },
157
+ };
158
+ log_1.log.info('invoking function', { function: installedFunction.name }, { file: "packages/devtools/cli/src/daemon/faas/connector.ts", line: 249, scope: this, bugcheck: "If you see this message then it means that the source code preprocessor for @dxos/log is broken. It probably has misinterpreted an unrelated call for a logger invocation.", callSite: (fn, args) => fn(...args) });
159
+ const result = await this._invokeFunction(installedFunction.name, data);
160
+ log_1.log.info('function result', { result }, { file: "packages/devtools/cli/src/daemon/faas/connector.ts", line: 251, scope: this, bugcheck: "If you see this message then it means that the source code preprocessor for @dxos/log is broken. It probably has misinterpreted an unrelated call for a logger invocation.", callSite: (fn, args) => fn(...args) });
161
+ }
162
+ async _invokeFunction(functionName, data) {
163
+ const res = await fetch(`${this._faasConfig.gateway}/function/${functionName}`, {
164
+ method: 'POST',
165
+ headers: {
166
+ Authorization: `Basic ${Buffer.from(`${this._faasConfig.username}:${this._faasConfig.password}`).toString('base64')}`,
167
+ 'Content-Type': 'application/json',
168
+ },
169
+ body: JSON.stringify(data),
170
+ });
171
+ const body = await res.text();
172
+ return { body, status: res.status };
173
+ }
174
+ async _getFunctions() {
175
+ const res = await fetch(`${this._faasConfig.gateway}/system/functions`, {
176
+ headers: {
177
+ Authorization: `Basic ${Buffer.from(`${this._faasConfig.username}:${this._faasConfig.password}`).toString('base64')}`,
178
+ },
179
+ });
180
+ const functions = await res.json();
181
+ return functions;
182
+ }
183
+ }
184
+ exports.FaasConnector = FaasConnector;
185
+ //# sourceMappingURL=connector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connector.js","sourceRoot":"","sources":["../../../../src/daemon/faas/connector.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;AAEF,uCAA2C;AAC3C,yCAAiF;AACjF,2CAAwC;AACxC,uCAAoC;AACpC,mCAAgC;AAChC,+DAA6D;AAkD7D,MAAa,aAAa;IAWxB,YACmB,WAAmC,EACnC,eAAuC;QADvC,gBAAW,GAAX,WAAW,CAAwB;QACnC,oBAAe,GAAf,eAAe,CAAwB;QAZzC,SAAI,GAAG,IAAI,iBAAO,EAAE,CAAC;QAErB,iBAAY,GAAG,IAAI,oBAAY,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,IAAI,EAAE;YACrE,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAChC,CAAC,CAAC,CAAC;QAEc,qBAAgB,GAAqB,EAAE,CAAC;QAQvD,IAAI,CAAC,OAAO,GAAG,IAAI,eAAM,CAAC,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC,CAAC;IAC3D,CAAC;IAED,KAAK,CAAC,IAAI;QACR,MAAM,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;QAEhC,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;QAC5B,MAAM,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC;IACrC,CAAC;IAED,KAAK,CAAC,KAAK;QACT,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QAC1B,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QAC7B,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAChC,CAAC;IAEO,KAAK,CAAC,cAAc;QAC1B,MAAM,cAAc,G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,QAAQ,CACT,EAAE;gBACH,cAAc,EAAE,kBAAkB;aACnC;YACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;SAC3B,CAAC,CAAC;QAEH,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;QAE9B,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC;IACtC,CAAC;IAEO,KAAK,CAAC,aAAa;QACzB,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,mBAAmB,EAAE;YACtE,OAAO,EAAE;gBACP,aAAa,EAAE,SAAS,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,IAAI,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CACvG,QAAQ,CACT,EAAE;aACJ;SACF,CAAC,CAAC;QAEH,MAAM,SAAS,GAAwB,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;QAExD,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AAhOD,sCAgOC"}
@@ -1 +1 @@
1
- {"version":3,"file":"run-services.d.ts","sourceRoot":"","sources":["../../../src/daemon/run-services.ts"],"names":[],"mappings":"AAQA,OAAO,EAAkB,MAAM,EAAuB,MAAM,cAAc,CAAC;AAM3E,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,WAAW,WAAkB,iBAAiB,kBAmE1D,CAAC"}
1
+ {"version":3,"file":"run-services.d.ts","sourceRoot":"","sources":["../../../src/daemon/run-services.ts"],"names":[],"mappings":"AAQA,OAAO,EAAkB,MAAM,EAAuB,MAAM,cAAc,CAAC;AAM3E,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,WAAW,WAAkB,iBAAiB,kBA+E1D,CAAC"}
@@ -35,13 +35,16 @@ const log_1 = require("@dxos/log");
35
35
  const websocket_rpc_1 = require("@dxos/websocket-rpc");
36
36
  const util_1 = require("./util");
37
37
  const runServices = async (params) => {
38
- var _a;
39
- var _b;
38
+ var _a, _b, _c, _d, _e, _f;
39
+ var _g;
40
+ log_1.log.info('faasd', {
41
+ gateway: (_c = (_b = (_a = params.config.values.runtime) === null || _a === void 0 ? void 0 : _a.services) === null || _b === void 0 ? void 0 : _b.faasd) === null || _c === void 0 ? void 0 : _c.gateway,
42
+ }, { file: "packages/devtools/cli/src/daemon/run-services.ts", line: 21, scope: this, bugcheck: "If you see this message then it means that the source code preprocessor for @dxos/log is broken. It probably has misinterpreted an unrelated call for a logger invocation.", callSite: (fn, args) => fn(...args) });
40
43
  const services = (0, client_1.fromHost)(params.config);
41
44
  // Global hook for debuggers;
42
- ((_a = (_b = globalThis).__DXOS__) !== null && _a !== void 0 ? _a : (_b.__DXOS__ = {})).host = services._host;
45
+ ((_d = (_g = globalThis).__DXOS__) !== null && _d !== void 0 ? _d : (_g.__DXOS__ = {})).host = services._host;
43
46
  await services.open();
44
- log_1.log.info('open', {}, { file: "packages/devtools/cli/src/daemon/run-services.ts", line: 27, scope: this, bugcheck: "If you see this message then it means that the source code preprocessor for @dxos/log is broken. It probably has misinterpreted an unrelated call for a logger invocation.", callSite: (fn, args) => fn(...args) });
47
+ log_1.log.info('open', {}, { file: "packages/devtools/cli/src/daemon/run-services.ts", line: 31, scope: this, bugcheck: "If you see this message then it means that the source code preprocessor for @dxos/log is broken. It probably has misinterpreted an unrelated call for a logger invocation.", callSite: (fn, args) => fn(...args) });
45
48
  const httpServer = http.createServer();
46
49
  for (const listenAddr of params.listen) {
47
50
  if (listenAddr.startsWith('unix://')) {
@@ -53,15 +56,15 @@ const runServices = async (params) => {
53
56
  server: httpServer,
54
57
  onConnection: async () => {
55
58
  const id = client_1.PublicKey.random().toHex();
56
- log_1.log.info('connection', { id }, { file: "packages/devtools/cli/src/daemon/run-services.ts", line: 42, scope: this, bugcheck: "If you see this message then it means that the source code preprocessor for @dxos/log is broken. It probably has misinterpreted an unrelated call for a logger invocation.", callSite: (fn, args) => fn(...args) });
59
+ log_1.log.info('connection', { id }, { file: "packages/devtools/cli/src/daemon/run-services.ts", line: 46, scope: this, bugcheck: "If you see this message then it means that the source code preprocessor for @dxos/log is broken. It probably has misinterpreted an unrelated call for a logger invocation.", callSite: (fn, args) => fn(...args) });
57
60
  return {
58
61
  exposed: services.descriptors,
59
62
  handlers: services.services,
60
63
  onOpen: async () => {
61
- log_1.log.info('open', { id }, { file: "packages/devtools/cli/src/daemon/run-services.ts", line: 48, scope: this, bugcheck: "If you see this message then it means that the source code preprocessor for @dxos/log is broken. It probably has misinterpreted an unrelated call for a logger invocation.", callSite: (fn, args) => fn(...args) });
64
+ log_1.log.info('open', { id }, { file: "packages/devtools/cli/src/daemon/run-services.ts", line: 52, scope: this, bugcheck: "If you see this message then it means that the source code preprocessor for @dxos/log is broken. It probably has misinterpreted an unrelated call for a logger invocation.", callSite: (fn, args) => fn(...args) });
62
65
  },
63
66
  onClose: async () => {
64
- log_1.log.info('close', { id }, { file: "packages/devtools/cli/src/daemon/run-services.ts", line: 51, scope: this, bugcheck: "If you see this message then it means that the source code preprocessor for @dxos/log is broken. It probably has misinterpreted an unrelated call for a logger invocation.", callSite: (fn, args) => fn(...args) });
67
+ log_1.log.info('close', { id }, { file: "packages/devtools/cli/src/daemon/run-services.ts", line: 55, scope: this, bugcheck: "If you see this message then it means that the source code preprocessor for @dxos/log is broken. It probably has misinterpreted an unrelated call for a logger invocation.", callSite: (fn, args) => fn(...args) });
65
68
  },
66
69
  };
67
70
  },
@@ -74,15 +77,15 @@ const runServices = async (params) => {
74
77
  port: parseInt(port),
75
78
  onConnection: async () => {
76
79
  const id = client_1.PublicKey.random().toHex();
77
- log_1.log.info('connection', { id }, { file: "packages/devtools/cli/src/daemon/run-services.ts", line: 65, scope: this, bugcheck: "If you see this message then it means that the source code preprocessor for @dxos/log is broken. It probably has misinterpreted an unrelated call for a logger invocation.", callSite: (fn, args) => fn(...args) });
80
+ log_1.log.info('connection', { id }, { file: "packages/devtools/cli/src/daemon/run-services.ts", line: 69, scope: this, bugcheck: "If you see this message then it means that the source code preprocessor for @dxos/log is broken. It probably has misinterpreted an unrelated call for a logger invocation.", callSite: (fn, args) => fn(...args) });
78
81
  return {
79
82
  exposed: services.descriptors,
80
83
  handlers: services.services,
81
84
  onOpen: async () => {
82
- log_1.log.info('open', { id }, { file: "packages/devtools/cli/src/daemon/run-services.ts", line: 71, scope: this, bugcheck: "If you see this message then it means that the source code preprocessor for @dxos/log is broken. It probably has misinterpreted an unrelated call for a logger invocation.", callSite: (fn, args) => fn(...args) });
85
+ log_1.log.info('open', { id }, { file: "packages/devtools/cli/src/daemon/run-services.ts", line: 75, scope: this, bugcheck: "If you see this message then it means that the source code preprocessor for @dxos/log is broken. It probably has misinterpreted an unrelated call for a logger invocation.", callSite: (fn, args) => fn(...args) });
83
86
  },
84
87
  onClose: async () => {
85
- log_1.log.info('close', { id }, { file: "packages/devtools/cli/src/daemon/run-services.ts", line: 74, scope: this, bugcheck: "If you see this message then it means that the source code preprocessor for @dxos/log is broken. It probably has misinterpreted an unrelated call for a logger invocation.", callSite: (fn, args) => fn(...args) });
88
+ log_1.log.info('close', { id }, { file: "packages/devtools/cli/src/daemon/run-services.ts", line: 78, scope: this, bugcheck: "If you see this message then it means that the source code preprocessor for @dxos/log is broken. It probably has misinterpreted an unrelated call for a logger invocation.", callSite: (fn, args) => fn(...args) });
86
89
  },
87
90
  };
88
91
  },
@@ -93,7 +96,14 @@ const runServices = async (params) => {
93
96
  throw new Error(`Unsupported listen address: ${listenAddr}`);
94
97
  }
95
98
  }
96
- log_1.log.info('listening', { socket: params.listen }, { file: "packages/devtools/cli/src/daemon/run-services.ts", line: 86, scope: this, bugcheck: "If you see this message then it means that the source code preprocessor for @dxos/log is broken. It probably has misinterpreted an unrelated call for a logger invocation.", callSite: (fn, args) => fn(...args) });
99
+ log_1.log.info('listening', { socket: params.listen }, { file: "packages/devtools/cli/src/daemon/run-services.ts", line: 90, scope: this, bugcheck: "If you see this message then it means that the source code preprocessor for @dxos/log is broken. It probably has misinterpreted an unrelated call for a logger invocation.", callSite: (fn, args) => fn(...args) });
100
+ const faasConfig = (_f = (_e = params.config.values.runtime) === null || _e === void 0 ? void 0 : _e.services) === null || _f === void 0 ? void 0 : _f.faasd;
101
+ if (faasConfig) {
102
+ const { FaasConnector } = await Promise.resolve().then(() => __importStar(require('./faas/connector')));
103
+ const connector = new FaasConnector(faasConfig, services);
104
+ await connector.open();
105
+ log_1.log.info('connected to OpenFASS', { gateway: faasConfig.gateway }, { file: "packages/devtools/cli/src/daemon/run-services.ts", line: 97, scope: this, bugcheck: "If you see this message then it means that the source code preprocessor for @dxos/log is broken. It probably has misinterpreted an unrelated call for a logger invocation.", callSite: (fn, args) => fn(...args) });
106
+ }
97
107
  };
98
108
  exports.runServices = runServices;
99
109
  //# sourceMappingURL=run-services.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"run-services.js","sourceRoot":"","sources":["../../../src/daemon/run-services.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;AAEF,qCAA4C;AAC5C,gDAAkC;AAClC,yCAAoC;AAEpC,yCAA2E;AAC3E,mCAAgC;AAChC,uDAAyD;AAEzD,iCAAwC;AAOjC,MAAM,WAAW,GAAG,KAAK,EAAE,MAAyB,EAAE,EAAE;;;IAC7D,MAAM,QAAQ,GAAG,IAAA,iBAAQ,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAEzC,6BAA6B;IAC7B,aAAE,UAAkB,EAAC,QAAQ,uCAAR,QAAQ,GAAK,EAAE,EAAC,CAAC,IAAI,GAAI,QAAgB,CAA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B,SAAG,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,EAAE,EAAE,mTAAC,CAAC;wBAC5B,CAAC;qBACF,CAAC;gBACJ,CAAC;aACF,CAAC,CAAC;YAEH,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;SACrB;aAAM;YACL,MAAM,IAAI,KAAK,CAAC,+BAA+B,UAAU,EAAE,CAAC,CAAC;SAC9D;KACF;IAED,SAAG,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,mTAAC,CAAC;IAEjD,MAAM,UAAU,GAAG,MAAA,MAAA,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,0CAAE,QAAQ,0CAAE,KAAK,CAAC;IACjE,IAAI,UAAU,EAAE;QACd,MAAM,EAAE,aAAa,EAAE,GAAG,wDAAa,kBAAkB,GAAC,CAAC;QAC3D,MAAM,SAAS,GAAG,IAAI,aAAa,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QAC1D,MAAM,SAAS,CAAC,IAAI,EAAE,CAAC;QACvB,SAAG,CAAC,IAAI,CAAC,uBAAuB,EAAE,EAAE,OAAO,EAAE,UAAU,CAAC,OAAO,EAAE,mTAAC,CAAC;KACpE;AACH,CAAC,CAAC;AA/EW,QAAA,WAAW,eA+EtB"}
@@ -4,6 +4,7 @@ export * from './print';
4
4
  export * from './publish';
5
5
  export * from './supervisor';
6
6
  export * from './telemetry';
7
- export * from './util';
8
7
  export * from './test-util';
8
+ export * from './tunnel';
9
+ export * from './util';
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/util/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/util/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC"}
@@ -23,6 +23,7 @@ __exportStar(require("./print"), exports);
23
23
  __exportStar(require("./publish"), exports);
24
24
  __exportStar(require("./supervisor"), exports);
25
25
  __exportStar(require("./telemetry"), exports);
26
- __exportStar(require("./util"), exports);
27
26
  __exportStar(require("./test-util"), exports);
27
+ __exportStar(require("./tunnel"), exports);
28
+ __exportStar(require("./util"), exports);
28
29
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/util/index.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;;;;;;;;;;;AAEF,+CAA6B;AAC7B,+CAA6B;AAC7B,0CAAwB;AACxB,4CAA0B;AAC1B,+CAA6B;AAC7B,8CAA4B;AAC5B,yCAAuB;AACvB,8CAA4B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/util/index.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;;;;;;;;;;;AAEF,+CAA6B;AAC7B,+CAA6B;AAC7B,0CAAwB;AACxB,4CAA0B;AAC1B,+CAA6B;AAC7B,8CAA4B;AAC5B,8CAA4B;AAC5B,2CAAyB;AACzB,yCAAuB"}
@@ -1,5 +1,4 @@
1
1
  import type { ConfigProto } from '@dxos/config';
2
- import { TunnelResponse } from '@dxos/protocols/proto/dxos/service/publisher';
3
2
  export type PackageModule = NonNullable<NonNullable<ConfigProto['package']>['modules']>[0];
4
3
  export type PackageRepo = NonNullable<NonNullable<ConfigProto['package']>['repos']>[0];
5
4
  export type Logger = (message?: string, ...args: any[]) => void;
@@ -7,11 +6,5 @@ export declare const mapModules: (modules: PackageModule[]) => {
7
6
  key: string | undefined;
8
7
  bundle: string;
9
8
  }[];
10
- export declare const mapTunnels: (tunnels: TunnelResponse[]) => {
11
- key: string;
12
- enabled: boolean;
13
- url: string;
14
- }[];
15
9
  export declare const printModules: (modules: PackageModule[], flags?: {}) => void;
16
- export declare const printTunnels: (tunnels: TunnelResponse[], flags?: {}) => void;
17
10
  //# sourceMappingURL=common.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/util/publish/common.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,8CAA8C,CAAC;AAE9E,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC,WAAW,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3F,MAAM,MAAM,WAAW,GAAG,WAAW,CAAC,WAAW,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvF,MAAM,MAAM,MAAM,GAAG,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;AAEhE,eAAO,MAAM,UAAU,YAAa,aAAa,EAAE;;;GAKlD,CAAC;AAEF,eAAO,MAAM,UAAU,YAAa,cAAc,EAAE;;;;GAMnD,CAAC;AAEF,eAAO,MAAM,YAAY,YAAa,aAAa,EAAE,qBAepD,CAAC;AAEF,eAAO,MAAM,YAAY,YAAa,cAAc,EAAE,qBAkBrD,CAAC"}
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/util/publish/common.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC,WAAW,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3F,MAAM,MAAM,WAAW,GAAG,WAAW,CAAC,WAAW,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvF,MAAM,MAAM,MAAM,GAAG,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;AAEhE,eAAO,MAAM,UAAU,YAAa,aAAa,EAAE;;;GAKlD,CAAC;AAEF,eAAO,MAAM,YAAY,YAAa,aAAa,EAAE,qBAepD,CAAC"}
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  //
3
- // Copyright 2022 DXOS.org
3
+ // Copyright 2023 DXOS.org
4
4
  //
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.printTunnels = exports.printModules = exports.mapTunnels = exports.mapModules = void 0;
6
+ exports.printModules = exports.mapModules = void 0;
7
7
  const core_1 = require("@oclif/core");
8
8
  const ipfs_http_client_1 = require("ipfs-http-client");
9
9
  const mapModules = (modules) => {
@@ -13,14 +13,6 @@ const mapModules = (modules) => {
13
13
  }));
14
14
  };
15
15
  exports.mapModules = mapModules;
16
- const mapTunnels = (tunnels) => {
17
- return tunnels.map((tunnel) => ({
18
- key: tunnel.name,
19
- enabled: tunnel.enabled,
20
- url: tunnel.url,
21
- }));
22
- };
23
- exports.mapTunnels = mapTunnels;
24
16
  const printModules = (modules, flags = {}) => {
25
17
  core_1.ux.table((0, exports.mapModules)(modules), {
26
18
  key: {
@@ -34,20 +26,4 @@ const printModules = (modules, flags = {}) => {
34
26
  });
35
27
  };
36
28
  exports.printModules = printModules;
37
- const printTunnels = (tunnels, flags = {}) => {
38
- core_1.ux.table((0, exports.mapTunnels)(tunnels), {
39
- key: {
40
- header: 'App',
41
- },
42
- enabled: {
43
- header: 'Enabled',
44
- },
45
- url: {
46
- header: 'URL',
47
- },
48
- }, {
49
- ...flags,
50
- });
51
- };
52
- exports.printTunnels = printTunnels;
53
29
  //# sourceMappingURL=common.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../src/util/publish/common.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;AAEF,sCAAiC;AACjC,uDAAuC;AAShC,MAAM,UAAU,GAAG,CAAC,OAAwB,EAAE,EAAE;IACrD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QAC3B,GAAG,EAAE,GAAG,CAAC,IAAI;QACb,MAAM,EAAE,sBAAG,CAAC,MAAM,CAAC,GAAG,CAAC,MAAO,CAAC,CAAC,QAAQ,EAAE;KAC3C,CAAC,CAAC,CAAC;AACN,CAAC,CAAC;AALW,QAAA,UAAU,cAKrB;AAEK,MAAM,UAAU,GAAG,CAAC,OAAyB,EAAE,EAAE;IACtD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAC9B,GAAG,EAAE,MAAM,CAAC,IAAI;QAChB,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,GAAG,EAAE,MAAM,CAAC,GAAG;KAChB,CAAC,CAAC,CAAC;AACN,CAAC,CAAC;AANW,QAAA,UAAU,cAMrB;AAEK,MAAM,YAAY,GAAG,CAAC,OAAwB,EAAE,KAAK,GAAG,EAAE,EAAE,EAAE;IACnE,SAAE,CAAC,KAAK,CACN,IAAA,kBAAU,EAAC,OAAO,CAAC,EACnB;QACE,GAAG,EAAE;YACH,MAAM,EAAE,MAAM;SACf;QACD,MAAM,EAAE;YACN,MAAM,EAAE,QAAQ;SACjB;KACF,EACD;QACE,GAAG,KAAK;KACT,CACF,CAAC;AACJ,CAAC,CAAC;AAfW,QAAA,YAAY,gBAevB;AAEK,MAAM,YAAY,GAAG,CAAC,OAAyB,EAAE,KAAK,GAAG,EAAE,EAAE,EAAE;IACpE,SAAE,CAAC,KAAK,CACN,IAAA,kBAAU,EAAC,OAAO,CAAC,EACnB;QACE,GAAG,EAAE;YACH,MAAM,EAAE,KAAK;SACd;QACD,OAAO,EAAE;YACP,MAAM,EAAE,SAAS;SAClB;QACD,GAAG,EAAE;YACH,MAAM,EAAE,KAAK;SACd;KACF,EACD;QACE,GAAG,KAAK;KACT,CACF,CAAC;AACJ,CAAC,CAAC;AAlBW,QAAA,YAAY,gBAkBvB"}
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../src/util/publish/common.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;AAEF,sCAAiC;AACjC,uDAAuC;AAQhC,MAAM,UAAU,GAAG,CAAC,OAAwB,EAAE,EAAE;IACrD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QAC3B,GAAG,EAAE,GAAG,CAAC,IAAI;QACb,MAAM,EAAE,sBAAG,CAAC,MAAM,CAAC,GAAG,CAAC,MAAO,CAAC,CAAC,QAAQ,EAAE;KAC3C,CAAC,CAAC,CAAC;AACN,CAAC,CAAC;AALW,QAAA,UAAU,cAKrB;AAEK,MAAM,YAAY,GAAG,CAAC,OAAwB,EAAE,KAAK,GAAG,EAAE,EAAE,EAAE;IACnE,SAAE,CAAC,KAAK,CACN,IAAA,kBAAU,EAAC,OAAO,CAAC,EACnB;QACE,GAAG,EAAE;YACH,MAAM,EAAE,MAAM;SACf;QACD,MAAM,EAAE;YACN,MAAM,EAAE,QAAQ;SACjB;KACF,EACD;QACE,GAAG,KAAK;KACT,CACF,CAAC;AACJ,CAAC,CAAC;AAfW,QAAA,YAAY,gBAevB"}
@@ -1,6 +1,6 @@
1
1
  {
2
- "DX_ENVIRONMENT": "production",
3
- "DX_RELEASE": "@dxos/cli@0.1.46",
2
+ "DX_ENVIRONMENT": "staging",
3
+ "DX_RELEASE": "@dxos/cli@0.1.48-next.83f55fd",
4
4
  "SENTRY_DESTINATION": "https://2647916221e643869965e78469479aa4@o4504012000067584.ingest.sentry.io/4504012027265029",
5
5
  "TELEMETRY_API_KEY": "B00QG6PtJJrJ0VVFe0H5a6bcUUShKyZM",
6
6
  "IPDATA_API_KEY": "ccc5f0cd66dd34a7c31c2ddc61c2bbca2db73892a993982bb3a5f0e2"
@@ -0,0 +1,8 @@
1
+ import { TunnelResponse } from '@dxos/protocols/proto/dxos/service/tunnel';
2
+ export declare const mapTunnels: (tunnels: TunnelResponse[]) => {
3
+ key: string;
4
+ enabled: boolean;
5
+ url: string;
6
+ }[];
7
+ export declare const printTunnels: (tunnels: TunnelResponse[], flags?: {}) => void;
8
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/util/tunnel/common.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAE3E,eAAO,MAAM,UAAU,YAAa,cAAc,EAAE;;;;GAMnD,CAAC;AAEF,eAAO,MAAM,YAAY,YAAa,cAAc,EAAE,qBAkBrD,CAAC"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ //
3
+ // Copyright 2023 DXOS.org
4
+ //
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.printTunnels = exports.mapTunnels = void 0;
7
+ const core_1 = require("@oclif/core");
8
+ const mapTunnels = (tunnels) => {
9
+ return tunnels.map((tunnel) => ({
10
+ key: tunnel.name,
11
+ enabled: tunnel.enabled,
12
+ url: tunnel.url,
13
+ }));
14
+ };
15
+ exports.mapTunnels = mapTunnels;
16
+ const printTunnels = (tunnels, flags = {}) => {
17
+ core_1.ux.table((0, exports.mapTunnels)(tunnels), {
18
+ key: {
19
+ header: 'App',
20
+ },
21
+ enabled: {
22
+ header: 'Enabled',
23
+ },
24
+ url: {
25
+ header: 'URL',
26
+ },
27
+ }, {
28
+ ...flags,
29
+ });
30
+ };
31
+ exports.printTunnels = printTunnels;
32
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../src/util/tunnel/common.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;AAEF,sCAAiC;AAI1B,MAAM,UAAU,GAAG,CAAC,OAAyB,EAAE,EAAE;IACtD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAC9B,GAAG,EAAE,MAAM,CAAC,IAAI;QAChB,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,GAAG,EAAE,MAAM,CAAC,GAAG;KAChB,CAAC,CAAC,CAAC;AACN,CAAC,CAAC;AANW,QAAA,UAAU,cAMrB;AAEK,MAAM,YAAY,GAAG,CAAC,OAAyB,EAAE,KAAK,GAAG,EAAE,EAAE,EAAE;IACpE,SAAE,CAAC,KAAK,CACN,IAAA,kBAAU,EAAC,OAAO,CAAC,EACnB;QACE,GAAG,EAAE;YACH,MAAM,EAAE,KAAK;SACd;QACD,OAAO,EAAE;YACP,MAAM,EAAE,SAAS;SAClB;QACD,GAAG,EAAE;YACH,MAAM,EAAE,KAAK;SACd;KACF,EACD;QACE,GAAG,KAAK;KACT,CACF,CAAC;AACJ,CAAC,CAAC;AAlBW,QAAA,YAAY,gBAkBvB"}
@@ -0,0 +1,3 @@
1
+ export * from './common';
2
+ export * from './tunnel-rpc-peer';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/util/tunnel/index.ts"],"names":[],"mappings":"AAIA,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ //
3
+ // Copyright 2023 DXOS.org
4
+ //
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
17
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ __exportStar(require("./common"), exports);
21
+ __exportStar(require("./tunnel-rpc-peer"), exports);
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/util/tunnel/index.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;;;;;;;;;;;AAEF,2CAAyB;AACzB,oDAAkC"}
@@ -0,0 +1,15 @@
1
+ import { Event } from '@dxos/async';
2
+ import { Tunnel } from '@dxos/protocols/proto/dxos/service/tunnel';
3
+ export declare class TunnelRpcPeer {
4
+ private readonly _url;
5
+ private readonly _socket;
6
+ private readonly _rpc;
7
+ private readonly _connectTrigger;
8
+ readonly connected: Event<void>;
9
+ readonly disconnected: Event<void>;
10
+ readonly error: Event<Error>;
11
+ constructor(_url: string);
12
+ get rpc(): Tunnel;
13
+ close(): Promise<void>;
14
+ }
15
+ //# sourceMappingURL=tunnel-rpc-peer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tunnel-rpc-peer.d.ts","sourceRoot":"","sources":["../../../../src/util/tunnel/tunnel-rpc-peer.ts"],"names":[],"mappings":"AAQA,OAAO,EAAW,KAAK,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAKnE,qBAAa,aAAa;IASZ,OAAO,CAAC,QAAQ,CAAC,IAAI;IARjC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAY;IACpC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAmC;IACxD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAiB;IAEjD,QAAQ,CAAC,SAAS,cAAe;IACjC,QAAQ,CAAC,YAAY,cAAe;IACpC,QAAQ,CAAC,KAAK,eAAsB;gBAEP,IAAI,EAAE,MAAM;IAqDzC,IAAI,GAAG,IAAI,MAAM,CAEhB;IAEK,KAAK;CAOZ"}
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ //
3
+ // Copyright 2023 DXOS.org
4
+ //
5
+ var __importDefault = (this && this.__importDefault) || function (mod) {
6
+ return (mod && mod.__esModule) ? mod : { "default": mod };
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.TunnelRpcPeer = void 0;
10
+ // TODO(egorgripasov): Factor out.
11
+ const debug_1 = __importDefault(require("debug"));
12
+ const isomorphic_ws_1 = __importDefault(require("isomorphic-ws"));
13
+ const async_1 = require("@dxos/async");
14
+ const protocols_1 = require("@dxos/protocols");
15
+ const rpc_1 = require("@dxos/rpc");
16
+ const log = (0, debug_1.default)('dxos:cli:tunnel-rpc-peer');
17
+ class TunnelRpcPeer {
18
+ constructor(_url) {
19
+ this._url = _url;
20
+ this._connectTrigger = new async_1.Trigger();
21
+ this.connected = new async_1.Event();
22
+ this.disconnected = new async_1.Event();
23
+ this.error = new async_1.Event();
24
+ this._socket = new isomorphic_ws_1.default(this._url);
25
+ this._socket.onopen = async () => {
26
+ try {
27
+ await this._rpc.open();
28
+ log(`RPC open ${this._url}`);
29
+ this.connected.emit();
30
+ this._connectTrigger.wake();
31
+ }
32
+ catch (err) {
33
+ this.error.emit(err);
34
+ }
35
+ };
36
+ this._socket.onclose = async () => {
37
+ log(`Disconnected ${this._url}`);
38
+ this.disconnected.emit();
39
+ try {
40
+ await this._rpc.close();
41
+ }
42
+ catch (err) {
43
+ this.error.emit(err);
44
+ }
45
+ };
46
+ this._socket.onerror = (event) => {
47
+ var _a;
48
+ log(`Publisher socket error ${this._url} ${event.message}`);
49
+ this.error.emit((_a = event.error) !== null && _a !== void 0 ? _a : new Error(event.message));
50
+ };
51
+ this._rpc = (0, rpc_1.createProtoRpcPeer)({
52
+ requested: {
53
+ Tunnel: protocols_1.schema.getService('dxos.service.tunnel.Tunnel'),
54
+ },
55
+ exposed: {},
56
+ handlers: {},
57
+ noHandshake: true,
58
+ timeout: 1000000,
59
+ port: {
60
+ send: (msg) => {
61
+ this._socket.send(msg);
62
+ },
63
+ subscribe: (cb) => {
64
+ this._socket.onmessage = async (msg) => {
65
+ if (typeof Blob !== 'undefined' && msg.data instanceof Blob) {
66
+ cb(Buffer.from(await msg.data.arrayBuffer()));
67
+ }
68
+ else {
69
+ cb(msg.data);
70
+ }
71
+ };
72
+ },
73
+ },
74
+ });
75
+ }
76
+ get rpc() {
77
+ return this._rpc.rpc.Tunnel;
78
+ }
79
+ async close() {
80
+ try {
81
+ await this._rpc.close();
82
+ }
83
+ finally {
84
+ this._socket.close();
85
+ }
86
+ }
87
+ }
88
+ exports.TunnelRpcPeer = TunnelRpcPeer;
89
+ //# sourceMappingURL=tunnel-rpc-peer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tunnel-rpc-peer.js","sourceRoot":"","sources":["../../../../src/util/tunnel/tunnel-rpc-peer.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;;;;AAEF,kCAAkC;AAClC,kDAA0B;AAC1B,kEAAsC;AAEtC,uCAA6C;AAC7C,+CAAyC;AAEzC,mCAA6D;A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