@dxos/cli 0.8.2-main.f11618f → 0.8.2-staging.7ac8446
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.
- package/dist/src/commands/debug/generate.js +2 -2
- package/dist/src/commands/debug/generate.js.map +1 -1
- package/dist/src/commands/function/upload.d.ts +2 -7
- package/dist/src/commands/function/upload.d.ts.map +1 -1
- package/dist/src/commands/function/upload.js +97 -104
- package/dist/src/commands/function/upload.js.map +1 -1
- package/dist/src/commands/halo/credential/list.d.ts +0 -1
- package/dist/src/commands/halo/credential/list.d.ts.map +1 -1
- package/dist/src/commands/halo/credential/list.js +16 -25
- package/dist/src/commands/halo/credential/list.js.map +1 -1
- package/dist/src/commands/space/list.d.ts +0 -1
- package/dist/src/commands/space/list.d.ts.map +1 -1
- package/dist/src/commands/space/list.js +3 -7
- package/dist/src/commands/space/list.js.map +1 -1
- package/dist/src/components/SpaceTable.d.ts.map +1 -1
- package/dist/src/components/SpaceTable.js +4 -7
- package/dist/src/components/SpaceTable.js.map +1 -1
- package/dist/src/help.d.ts.map +1 -1
- package/dist/src/help.js +1 -6
- package/dist/src/help.js.map +1 -1
- package/dist/src/util/index.d.ts +0 -1
- package/dist/src/util/index.d.ts.map +1 -1
- package/dist/src/util/index.js +0 -1
- package/dist/src/util/index.js.map +1 -1
- package/oclif.manifest.json +334 -472
- package/package.json +25 -25
- package/dist/src/commands/function/watch.d.ts +0 -29
- package/dist/src/commands/function/watch.d.ts.map +0 -1
- package/dist/src/commands/function/watch.js +0 -130
- package/dist/src/commands/function/watch.js.map +0 -1
- package/dist/src/util/function/bundle.d.ts +0 -5
- package/dist/src/util/function/bundle.d.ts.map +0 -1
- package/dist/src/util/function/bundle.js +0 -13
- package/dist/src/util/function/bundle.js.map +0 -1
- package/dist/src/util/function/index.d.ts +0 -3
- package/dist/src/util/function/index.d.ts.map +0 -1
- package/dist/src/util/function/index.js +0 -6
- package/dist/src/util/function/index.js.map +0 -1
- package/dist/src/util/function/lookup.d.ts +0 -19
- package/dist/src/util/function/lookup.d.ts.map +0 -1
- package/dist/src/util/function/lookup.js +0 -14
- package/dist/src/util/function/lookup.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/cli",
|
|
3
|
-
"version": "0.8.2-
|
|
3
|
+
"version": "0.8.2-staging.7ac8446",
|
|
4
4
|
"description": "DXOS CLI",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dxos",
|
|
@@ -53,30 +53,30 @@
|
|
|
53
53
|
"react": "~18.2.0",
|
|
54
54
|
"ws": "^8.14.2",
|
|
55
55
|
"wtfnode": "^0.9.1",
|
|
56
|
-
"@dxos/agent": "0.8.2-
|
|
57
|
-
"@dxos/async": "0.8.2-
|
|
58
|
-
"@dxos/cli-composer": "0.8.2-
|
|
59
|
-
"@dxos/cli-base": "0.8.2-
|
|
60
|
-
"@dxos/client": "0.8.2-
|
|
61
|
-
"@dxos/client-protocol": "0.8.2-
|
|
62
|
-
"@dxos/client-services": "0.8.2-
|
|
63
|
-
"@dxos/
|
|
64
|
-
"@dxos/
|
|
65
|
-
"@dxos/
|
|
66
|
-
"@dxos/
|
|
67
|
-
"@dxos/
|
|
68
|
-
"@dxos/
|
|
69
|
-
"@dxos/
|
|
70
|
-
"@dxos/
|
|
71
|
-
"@dxos/
|
|
72
|
-
"@dxos/
|
|
73
|
-
"@dxos/process": "0.8.2-
|
|
74
|
-
"@dxos/
|
|
75
|
-
"@dxos/
|
|
76
|
-
"@dxos/
|
|
77
|
-
"@dxos/
|
|
78
|
-
"@dxos/
|
|
79
|
-
"@dxos/
|
|
56
|
+
"@dxos/agent": "0.8.2-staging.7ac8446",
|
|
57
|
+
"@dxos/async": "0.8.2-staging.7ac8446",
|
|
58
|
+
"@dxos/cli-composer": "0.8.2-staging.7ac8446",
|
|
59
|
+
"@dxos/cli-base": "0.8.2-staging.7ac8446",
|
|
60
|
+
"@dxos/client": "0.8.2-staging.7ac8446",
|
|
61
|
+
"@dxos/client-protocol": "0.8.2-staging.7ac8446",
|
|
62
|
+
"@dxos/client-services": "0.8.2-staging.7ac8446",
|
|
63
|
+
"@dxos/context": "0.8.2-staging.7ac8446",
|
|
64
|
+
"@dxos/debug": "0.8.2-staging.7ac8446",
|
|
65
|
+
"@dxos/config": "0.8.2-staging.7ac8446",
|
|
66
|
+
"@dxos/compute": "0.8.2-staging.7ac8446",
|
|
67
|
+
"@dxos/echo-schema": "0.8.2-staging.7ac8446",
|
|
68
|
+
"@dxos/invariant": "0.8.2-staging.7ac8446",
|
|
69
|
+
"@dxos/log": "0.8.2-staging.7ac8446",
|
|
70
|
+
"@dxos/functions": "0.8.2-staging.7ac8446",
|
|
71
|
+
"@dxos/node-std": "0.8.2-staging.7ac8446",
|
|
72
|
+
"@dxos/network-manager": "0.8.2-staging.7ac8446",
|
|
73
|
+
"@dxos/process": "0.8.2-staging.7ac8446",
|
|
74
|
+
"@dxos/protocols": "0.8.2-staging.7ac8446",
|
|
75
|
+
"@dxos/random": "0.8.2-staging.7ac8446",
|
|
76
|
+
"@dxos/observability": "0.8.2-staging.7ac8446",
|
|
77
|
+
"@dxos/rpc": "0.8.2-staging.7ac8446",
|
|
78
|
+
"@dxos/util": "0.8.2-staging.7ac8446",
|
|
79
|
+
"@dxos/schema": "0.8.2-staging.7ac8446"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
82
|
"@oclif/test": "^4.1.0",
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { BaseCommand } from '../../base';
|
|
2
|
-
export default class Watch extends BaseCommand<typeof Watch> {
|
|
3
|
-
static enableJsonFlag: boolean;
|
|
4
|
-
static description: string;
|
|
5
|
-
static flags: {
|
|
6
|
-
functionId: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
-
spaceKey: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
-
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
|
-
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
|
-
'dry-run': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
|
-
profile: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
-
config: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
-
timeout: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
-
target: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
-
agent: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
16
|
-
'json-log': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
17
|
-
'json-logfile': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
-
};
|
|
19
|
-
static args: {
|
|
20
|
-
file: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
|
|
21
|
-
};
|
|
22
|
-
run(): Promise<any>;
|
|
23
|
-
private _loadFunctionObject;
|
|
24
|
-
private _isRuntimeReady;
|
|
25
|
-
private _uploadSource;
|
|
26
|
-
private _logWithTime;
|
|
27
|
-
private _printUploadInstruction;
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=watch.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../../../src/commands/function/watch.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAMzC,MAAM,CAAC,OAAO,OAAO,KAAM,SAAQ,WAAW,CAAC,OAAO,KAAK,CAAC;IAC1D,OAAgB,cAAc,UAAQ;IACtC,OAAgB,WAAW,SAAwC;IAEnE,OAAgB,KAAK;;;;;;;;;;;;;MAInB;IAEF,OAAgB,IAAI;;MAElB;IAEI,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC;YAgDX,mBAAmB;YAkBnB,eAAe;YA6Bf,aAAa;IAe3B,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,uBAAuB;CAIhC"}
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
import { Args, Flags } from '@oclif/core';
|
|
5
|
-
import fs from 'fs';
|
|
6
|
-
import { debounce, Trigger } from '@dxos/async';
|
|
7
|
-
import { FunctionType, ScriptType } from '@dxos/functions/types';
|
|
8
|
-
import { TextType } from '@dxos/schema';
|
|
9
|
-
import { BaseCommand } from '../../base';
|
|
10
|
-
import { bundleScript } from '../../util';
|
|
11
|
-
import { findFunctionByDeploymentId } from '../../util/function/lookup';
|
|
12
|
-
const LOCAL_FUNCTIONS_RUNTIME_URL = 'http://127.0.0.1:3123';
|
|
13
|
-
class Watch extends BaseCommand {
|
|
14
|
-
async run() {
|
|
15
|
-
return this.execWithSpace(async ({ client, space }) => {
|
|
16
|
-
client.addTypes([TextType, ScriptType, FunctionType]);
|
|
17
|
-
const { scriptContent } = await this._loadFunctionObject(space);
|
|
18
|
-
this._logWithTime(`Watching for changes in ${this.args.file}`);
|
|
19
|
-
const updateSource = debounce(async () => {
|
|
20
|
-
const readinessCheckResult = await this._isRuntimeReady();
|
|
21
|
-
if (!readinessCheckResult.ready) {
|
|
22
|
-
this._logWithTime(`Functions runtime readiness check failed: ${readinessCheckResult.reason}`);
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
const source = fs.readFileSync(this.args.file, 'utf-8');
|
|
26
|
-
const bundleResult = await bundleScript(source);
|
|
27
|
-
if (!bundleResult.bundle) {
|
|
28
|
-
this._logWithTime('Source bundling failed, waiting for new changes...');
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
const updateResult = await this._uploadSource(bundleResult.bundle);
|
|
32
|
-
if (updateResult.success) {
|
|
33
|
-
if (scriptContent) {
|
|
34
|
-
scriptContent.content = source;
|
|
35
|
-
}
|
|
36
|
-
this._logWithTime('Worker source updated');
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
this._logWithTime(`Failed to update worker source, reason: ${updateResult.reason}`);
|
|
40
|
-
}
|
|
41
|
-
}, 2000);
|
|
42
|
-
const trigger = new Trigger();
|
|
43
|
-
fs.watch(this.args.file, (event) => {
|
|
44
|
-
if (event === 'rename') {
|
|
45
|
-
trigger.wake();
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
updateSource();
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
await trigger.wait();
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
async _loadFunctionObject(space) {
|
|
55
|
-
const matchingFunction = await findFunctionByDeploymentId(space, this.flags.functionId);
|
|
56
|
-
if (!matchingFunction) {
|
|
57
|
-
this.log(`Function with id ${this.flags.functionId} not found in space ${space.id}.`);
|
|
58
|
-
this._printUploadInstruction();
|
|
59
|
-
this.exit();
|
|
60
|
-
}
|
|
61
|
-
if (!matchingFunction.source) {
|
|
62
|
-
return { functionObject: matchingFunction };
|
|
63
|
-
}
|
|
64
|
-
const script = await matchingFunction.source.load();
|
|
65
|
-
const content = await script.source.load();
|
|
66
|
-
return { functionObject: matchingFunction, scriptContent: content };
|
|
67
|
-
}
|
|
68
|
-
async _isRuntimeReady() {
|
|
69
|
-
var _a, _b;
|
|
70
|
-
try {
|
|
71
|
-
const result = await fetch(`${LOCAL_FUNCTIONS_RUNTIME_URL}/sanity`);
|
|
72
|
-
if (result.status !== 200) {
|
|
73
|
-
this.log(`Function runtime sanity check failed: ${result.statusText}`);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
catch (err) {
|
|
77
|
-
return { ready: false, reason: `Functions runtime not running, expected on ${LOCAL_FUNCTIONS_RUNTIME_URL}` };
|
|
78
|
-
}
|
|
79
|
-
try {
|
|
80
|
-
const functionId = this.flags.functionId;
|
|
81
|
-
const result = await fetch(`${LOCAL_FUNCTIONS_RUNTIME_URL}/workers/${functionId}/versions`);
|
|
82
|
-
if (result.status !== 200) {
|
|
83
|
-
return { ready: false, reason: `Deployment status check failed: ${result.statusText}` };
|
|
84
|
-
}
|
|
85
|
-
const bodyJson = await result.json();
|
|
86
|
-
if (!((_a = bodyJson.versions) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
87
|
-
return { ready: false, reason: `Function with id ${functionId} is not deployed.` };
|
|
88
|
-
}
|
|
89
|
-
return { ready: true };
|
|
90
|
-
}
|
|
91
|
-
catch (err) {
|
|
92
|
-
return { ready: false, reason: `Deployment status check failed, reason: ${(_b = err.message) !== null && _b !== void 0 ? _b : 'unknown'}` };
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
async _uploadSource(bundledScript) {
|
|
96
|
-
var _a;
|
|
97
|
-
try {
|
|
98
|
-
const result = await fetch(`${LOCAL_FUNCTIONS_RUNTIME_URL}/workers/${this.flags.functionId}/source`, {
|
|
99
|
-
method: 'PUT',
|
|
100
|
-
body: Buffer.from(bundledScript),
|
|
101
|
-
});
|
|
102
|
-
if (result.status !== 200) {
|
|
103
|
-
return { success: false, reason: result.statusText };
|
|
104
|
-
}
|
|
105
|
-
return { success: true };
|
|
106
|
-
}
|
|
107
|
-
catch (err) {
|
|
108
|
-
return { success: false, reason: (_a = err.message) !== null && _a !== void 0 ? _a : 'unknown' };
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
_logWithTime(message) {
|
|
112
|
-
this.log(`[${new Date().toTimeString().split(' ')[0]}] ${message}`);
|
|
113
|
-
}
|
|
114
|
-
_printUploadInstruction() {
|
|
115
|
-
const message = ['Try running:', '', 'dx function upload scriptFilePath'].join('\n');
|
|
116
|
-
this.log(message);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
Watch.enableJsonFlag = true;
|
|
120
|
-
Watch.description = 'Hot reload script on file changes.';
|
|
121
|
-
Watch.flags = {
|
|
122
|
-
...BaseCommand.flags,
|
|
123
|
-
functionId: Flags.string({ description: 'Existing UserFunction ID to update.', required: true }),
|
|
124
|
-
spaceKey: Flags.string({ description: 'Space key to create/update Script source in.' }),
|
|
125
|
-
};
|
|
126
|
-
Watch.args = {
|
|
127
|
-
file: Args.string({ required: true }),
|
|
128
|
-
};
|
|
129
|
-
export default Watch;
|
|
130
|
-
//# sourceMappingURL=watch.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"watch.js","sourceRoot":"","sources":["../../../../src/commands/function/watch.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;AAEF,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAExE,MAAM,2BAA2B,GAAG,uBAAuB,CAAC;AAE5D,MAAqB,KAAM,SAAQ,WAAyB;IAc1D,KAAK,CAAC,GAAG;QACP,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE;YACpD,MAAM,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC,CAAC;YAEtD,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,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../../src/util/function/bundle.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,YAAY,WAAkB,MAAM,KAAG,OAAO,CAAC;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,CAS7F,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
import { Bundler } from '@dxos/functions/bundler';
|
|
5
|
-
export const bundleScript = async (source) => {
|
|
6
|
-
const bundler = new Bundler({ platform: 'node', sandboxedModules: [], remoteModules: {} });
|
|
7
|
-
const buildResult = await bundler.bundle({ source });
|
|
8
|
-
if (buildResult.error || !buildResult.bundle) {
|
|
9
|
-
return { error: buildResult.error || new Error('Bundle creation failed') };
|
|
10
|
-
}
|
|
11
|
-
return { bundle: buildResult.bundle };
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=bundle.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.js","sourceRoot":"","sources":["../../../../src/util/function/bundle.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;AACF,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElD,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,EAAE,MAAc,EAA+C,EAAE;IAChG,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,gBAAgB,EAAE,EAAE,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC,CAAC;IAC3F,MAAM,WAAW,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAErD,IAAI,WAAW,CAAC,KAAK,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC;QAC7C,OAAO,EAAE,KAAK,EAAE,WAAW,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,wBAAwB,CAAC,EAAE,CAAC;IAC7E,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,CAAC;AACxC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/util/function/index.ts"],"names":[],"mappings":"AAIA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/util/function/index.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;AAEF,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { type Space } from '@dxos/client/echo';
|
|
2
|
-
export declare const findFunctionByDeploymentId: (space: Space, functionId?: string) => Promise<import("@dxos/echo-db").ReactiveEchoObject<import("@dxos/echo-schema").TypedObjectFields<{
|
|
3
|
-
name: typeof import("effect/Schema").NonEmptyString;
|
|
4
|
-
version: typeof import("effect/Schema").String;
|
|
5
|
-
description: import("effect/Schema").optional<typeof import("effect/Schema").String>;
|
|
6
|
-
source: import("effect/Schema").optional<import("@dxos/echo-schema").Ref$<{
|
|
7
|
-
readonly id: string;
|
|
8
|
-
source: import("@dxos/echo-schema").Ref<import("@dxos/echo-schema").TypedObjectFields<{
|
|
9
|
-
content: typeof import("effect/Schema").String;
|
|
10
|
-
}, import("@dxos/echo-schema").TypedObjectOptions>>;
|
|
11
|
-
name?: string | undefined;
|
|
12
|
-
description?: string | undefined;
|
|
13
|
-
changed?: boolean | undefined;
|
|
14
|
-
}>>;
|
|
15
|
-
inputSchema: import("effect/Schema").optional<import("effect/Schema").Schema<import("@dxos/echo-schema").JsonSchemaType, import("@dxos/echo-schema").JsonSchemaType, never>>;
|
|
16
|
-
outputSchema: import("effect/Schema").optional<import("effect/Schema").Schema<import("@dxos/echo-schema").JsonSchemaType, import("@dxos/echo-schema").JsonSchemaType, never>>;
|
|
17
|
-
binding: import("effect/Schema").optional<typeof import("effect/Schema").String>;
|
|
18
|
-
}, import("@dxos/echo-schema").TypedObjectOptions>> | undefined>;
|
|
19
|
-
//# sourceMappingURL=lookup.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lookup.d.ts","sourceRoot":"","sources":["../../../../src/util/function/lookup.ts"],"names":[],"mappings":"AAIA,OAAO,EAAmB,KAAK,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAGhE,eAAO,MAAM,0BAA0B,UAAiB,KAAK,eAAe,MAAM;;;;oDAQ0J,mBAAmB;;uDAAiE,mBAAmB;;kBAA8E,mBAAmB;YAAoC,CAAC;mBAAyC,CAAC;eAAqC,CAAC;;;;;gEADxiB,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
import { Filter, getMeta } from '@dxos/client/echo';
|
|
5
|
-
import { FunctionType, getUserFunctionUrlInMetadata, makeFunctionUrl } from '@dxos/functions/types';
|
|
6
|
-
export const findFunctionByDeploymentId = async (space, functionId) => {
|
|
7
|
-
if (!functionId) {
|
|
8
|
-
return undefined;
|
|
9
|
-
}
|
|
10
|
-
const invocationUrl = makeFunctionUrl(space.id, { functionId });
|
|
11
|
-
const functions = await space.db.query(Filter.schema(FunctionType)).run();
|
|
12
|
-
return functions.objects.find((fn) => getUserFunctionUrlInMetadata(getMeta(fn)) === invocationUrl);
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=lookup.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lookup.js","sourceRoot":"","sources":["../../../../src/util/function/lookup.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;AAEF,OAAO,EAAE,MAAM,EAAE,OAAO,EAAc,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,4BAA4B,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAEpG,MAAM,CAAC,MAAM,0BAA0B,GAAG,KAAK,EAAE,KAAY,EAAE,UAAmB,EAAE,EAAE;IACpF,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,aAAa,GAAG,eAAe,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC;IAChE,MAAM,SAAS,GAAG,MAAM,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;IAC1E,OAAO,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,4BAA4B,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,KAAK,aAAa,CAAC,CAAC;AACrG,CAAC,CAAC"}
|