@dxos/cli 0.8.4-main.ead640a → 0.8.4-main.effb148878
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/LICENSE +102 -5
- package/bin/dx.js +29 -12
- package/package.json +15 -130
- package/README.md +0 -145
- package/bin/agent_entrypoint +0 -22
- package/bin/dev.cmd +0 -3
- package/bin/dev.js +0 -26
- package/bin/handle_invitation +0 -18
- package/bin/run.cmd +0 -3
- package/dist/src/base.d.ts +0 -18
- package/dist/src/base.d.ts.map +0 -1
- package/dist/src/base.js +0 -76
- package/dist/src/base.js.map +0 -1
- package/dist/src/commands/agent/agent.node.test.d.ts +0 -2
- package/dist/src/commands/agent/agent.node.test.d.ts.map +0 -1
- package/dist/src/commands/agent/agent.node.test.js +0 -178
- package/dist/src/commands/agent/agent.node.test.js.map +0 -1
- package/dist/src/commands/agent/invitations.d.ts +0 -20
- package/dist/src/commands/agent/invitations.d.ts.map +0 -1
- package/dist/src/commands/agent/invitations.js +0 -88
- package/dist/src/commands/agent/invitations.js.map +0 -1
- package/dist/src/commands/agent/list.d.ts +0 -22
- package/dist/src/commands/agent/list.d.ts.map +0 -1
- package/dist/src/commands/agent/list.js +0 -45
- package/dist/src/commands/agent/list.js.map +0 -1
- package/dist/src/commands/agent/restart.d.ts +0 -21
- package/dist/src/commands/agent/restart.d.ts.map +0 -1
- package/dist/src/commands/agent/restart.js +0 -26
- package/dist/src/commands/agent/restart.js.map +0 -1
- package/dist/src/commands/agent/start.d.ts +0 -33
- package/dist/src/commands/agent/start.d.ts.map +0 -1
- package/dist/src/commands/agent/start.js +0 -204
- package/dist/src/commands/agent/start.js.map +0 -1
- package/dist/src/commands/agent/status.d.ts +0 -19
- package/dist/src/commands/agent/status.d.ts.map +0 -1
- package/dist/src/commands/agent/status.js +0 -30
- package/dist/src/commands/agent/status.js.map +0 -1
- package/dist/src/commands/agent/stop.d.ts +0 -22
- package/dist/src/commands/agent/stop.d.ts.map +0 -1
- package/dist/src/commands/agent/stop.js +0 -49
- package/dist/src/commands/agent/stop.js.map +0 -1
- package/dist/src/commands/config/index.d.ts +0 -7
- package/dist/src/commands/config/index.d.ts.map +0 -1
- package/dist/src/commands/config/index.js +0 -16
- package/dist/src/commands/config/index.js.map +0 -1
- package/dist/src/commands/config/index.node.test.d.ts +0 -2
- package/dist/src/commands/config/index.node.test.d.ts.map +0 -1
- package/dist/src/commands/config/index.node.test.js +0 -25
- package/dist/src/commands/config/index.node.test.js.map +0 -1
- package/dist/src/commands/debug/diagnostics.d.ts +0 -25
- package/dist/src/commands/debug/diagnostics.d.ts.map +0 -1
- package/dist/src/commands/debug/diagnostics.js +0 -53
- package/dist/src/commands/debug/diagnostics.js.map +0 -1
- package/dist/src/commands/debug/error.d.ts +0 -6
- package/dist/src/commands/debug/error.d.ts.map +0 -1
- package/dist/src/commands/debug/error.js +0 -23
- package/dist/src/commands/debug/error.js.map +0 -1
- package/dist/src/commands/debug/generate.d.ts +0 -27
- package/dist/src/commands/debug/generate.d.ts.map +0 -1
- package/dist/src/commands/debug/generate.js +0 -71
- package/dist/src/commands/debug/generate.js.map +0 -1
- package/dist/src/commands/debug/metrics.d.ts +0 -10
- package/dist/src/commands/debug/metrics.d.ts.map +0 -1
- package/dist/src/commands/debug/metrics.js +0 -39
- package/dist/src/commands/debug/metrics.js.map +0 -1
- package/dist/src/commands/debug/status.d.ts +0 -20
- package/dist/src/commands/debug/status.d.ts.map +0 -1
- package/dist/src/commands/debug/status.js +0 -30
- package/dist/src/commands/debug/status.js.map +0 -1
- package/dist/src/commands/device/info.d.ts +0 -7
- package/dist/src/commands/device/info.d.ts.map +0 -1
- package/dist/src/commands/device/info.js +0 -30
- package/dist/src/commands/device/info.js.map +0 -1
- package/dist/src/commands/device/list.d.ts +0 -20
- package/dist/src/commands/device/list.d.ts.map +0 -1
- package/dist/src/commands/device/list.js +0 -23
- package/dist/src/commands/device/list.js.map +0 -1
- package/dist/src/commands/device/update.d.ts +0 -19
- package/dist/src/commands/device/update.d.ts.map +0 -1
- package/dist/src/commands/device/update.js +0 -32
- package/dist/src/commands/device/update.js.map +0 -1
- package/dist/src/commands/edge/status.d.ts +0 -19
- package/dist/src/commands/edge/status.d.ts.map +0 -1
- package/dist/src/commands/edge/status.js +0 -24
- package/dist/src/commands/edge/status.js.map +0 -1
- package/dist/src/commands/function/list.d.ts +0 -7
- package/dist/src/commands/function/list.d.ts.map +0 -1
- package/dist/src/commands/function/list.js +0 -19
- package/dist/src/commands/function/list.js.map +0 -1
- package/dist/src/commands/function/logs.d.ts +0 -14
- package/dist/src/commands/function/logs.d.ts.map +0 -1
- package/dist/src/commands/function/logs.js +0 -38
- package/dist/src/commands/function/logs.js.map +0 -1
- package/dist/src/commands/function/trigger/list.d.ts +0 -26
- package/dist/src/commands/function/trigger/list.d.ts.map +0 -1
- package/dist/src/commands/function/trigger/list.js +0 -51
- package/dist/src/commands/function/trigger/list.js.map +0 -1
- 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 -128
- package/dist/src/commands/function/watch.js.map +0 -1
- package/dist/src/commands/halo/create.d.ts +0 -24
- package/dist/src/commands/halo/create.d.ts.map +0 -1
- package/dist/src/commands/halo/create.js +0 -36
- package/dist/src/commands/halo/create.js.map +0 -1
- package/dist/src/commands/halo/credential/add.d.ts +0 -9
- package/dist/src/commands/halo/credential/add.d.ts.map +0 -1
- package/dist/src/commands/halo/credential/add.js +0 -42
- package/dist/src/commands/halo/credential/add.js.map +0 -1
- package/dist/src/commands/halo/credential/list.d.ts +0 -23
- package/dist/src/commands/halo/credential/list.d.ts.map +0 -1
- package/dist/src/commands/halo/credential/list.js +0 -62
- package/dist/src/commands/halo/credential/list.js.map +0 -1
- package/dist/src/commands/halo/identity.d.ts +0 -8
- package/dist/src/commands/halo/identity.d.ts.map +0 -1
- package/dist/src/commands/halo/identity.js +0 -31
- package/dist/src/commands/halo/identity.js.map +0 -1
- package/dist/src/commands/halo/join.d.ts +0 -23
- package/dist/src/commands/halo/join.d.ts.map +0 -1
- package/dist/src/commands/halo/join.js +0 -94
- package/dist/src/commands/halo/join.js.map +0 -1
- package/dist/src/commands/halo/keys.d.ts +0 -7
- package/dist/src/commands/halo/keys.d.ts.map +0 -1
- package/dist/src/commands/halo/keys.js +0 -14
- package/dist/src/commands/halo/keys.js.map +0 -1
- package/dist/src/commands/halo/recovery/generate.d.ts +0 -7
- package/dist/src/commands/halo/recovery/generate.d.ts.map +0 -1
- package/dist/src/commands/halo/recovery/generate.js +0 -16
- package/dist/src/commands/halo/recovery/generate.js.map +0 -1
- package/dist/src/commands/halo/recovery/use.d.ts +0 -20
- package/dist/src/commands/halo/recovery/use.d.ts.map +0 -1
- package/dist/src/commands/halo/recovery/use.js +0 -21
- package/dist/src/commands/halo/recovery/use.js.map +0 -1
- package/dist/src/commands/halo/share.d.ts +0 -24
- package/dist/src/commands/halo/share.d.ts.map +0 -1
- package/dist/src/commands/halo/share.js +0 -73
- package/dist/src/commands/halo/share.js.map +0 -1
- package/dist/src/commands/halo/update.d.ts +0 -19
- package/dist/src/commands/halo/update.d.ts.map +0 -1
- package/dist/src/commands/halo/update.js +0 -34
- package/dist/src/commands/halo/update.js.map +0 -1
- package/dist/src/commands/info.d.ts +0 -19
- package/dist/src/commands/info.d.ts.map +0 -1
- package/dist/src/commands/info.js +0 -23
- package/dist/src/commands/info.js.map +0 -1
- package/dist/src/commands/profile/import.d.ts +0 -20
- package/dist/src/commands/profile/import.d.ts.map +0 -1
- package/dist/src/commands/profile/import.js +0 -66
- package/dist/src/commands/profile/import.js.map +0 -1
- package/dist/src/commands/profile/inspect.d.ts +0 -20
- package/dist/src/commands/profile/inspect.d.ts.map +0 -1
- package/dist/src/commands/profile/inspect.js +0 -37
- package/dist/src/commands/profile/inspect.js.map +0 -1
- package/dist/src/commands/reset/index.d.ts +0 -20
- package/dist/src/commands/reset/index.d.ts.map +0 -1
- package/dist/src/commands/reset/index.js +0 -74
- package/dist/src/commands/reset/index.js.map +0 -1
- package/dist/src/commands/shell/index.d.ts +0 -6
- package/dist/src/commands/shell/index.d.ts.map +0 -1
- package/dist/src/commands/shell/index.js +0 -25
- package/dist/src/commands/shell/index.js.map +0 -1
- package/dist/src/commands/space/close.d.ts +0 -9
- package/dist/src/commands/space/close.d.ts.map +0 -1
- package/dist/src/commands/space/close.js +0 -17
- package/dist/src/commands/space/close.js.map +0 -1
- package/dist/src/commands/space/create.d.ts +0 -10
- package/dist/src/commands/space/create.d.ts.map +0 -1
- package/dist/src/commands/space/create.js +0 -25
- package/dist/src/commands/space/create.js.map +0 -1
- package/dist/src/commands/space/epoch.d.ts +0 -10
- package/dist/src/commands/space/epoch.d.ts.map +0 -1
- package/dist/src/commands/space/epoch.js +0 -18
- package/dist/src/commands/space/epoch.js.map +0 -1
- package/dist/src/commands/space/info.d.ts +0 -10
- package/dist/src/commands/space/info.d.ts.map +0 -1
- package/dist/src/commands/space/info.js +0 -26
- package/dist/src/commands/space/info.js.map +0 -1
- package/dist/src/commands/space/join.d.ts +0 -21
- package/dist/src/commands/space/join.d.ts.map +0 -1
- package/dist/src/commands/space/join.js +0 -71
- package/dist/src/commands/space/join.js.map +0 -1
- package/dist/src/commands/space/list.d.ts +0 -24
- package/dist/src/commands/space/list.d.ts.map +0 -1
- package/dist/src/commands/space/list.js +0 -90
- package/dist/src/commands/space/list.js.map +0 -1
- package/dist/src/commands/space/members.d.ts +0 -23
- package/dist/src/commands/space/members.d.ts.map +0 -1
- package/dist/src/commands/space/members.js +0 -27
- package/dist/src/commands/space/members.js.map +0 -1
- package/dist/src/commands/space/open.d.ts +0 -9
- package/dist/src/commands/space/open.d.ts.map +0 -1
- package/dist/src/commands/space/open.js +0 -17
- package/dist/src/commands/space/open.js.map +0 -1
- package/dist/src/commands/space/query.d.ts +0 -25
- package/dist/src/commands/space/query.d.ts.map +0 -1
- package/dist/src/commands/space/query.js +0 -44
- package/dist/src/commands/space/query.js.map +0 -1
- package/dist/src/commands/space/schema/list.d.ts +0 -21
- package/dist/src/commands/space/schema/list.d.ts.map +0 -1
- package/dist/src/commands/space/schema/list.js +0 -57
- package/dist/src/commands/space/schema/list.js.map +0 -1
- package/dist/src/commands/space/share.d.ts +0 -27
- package/dist/src/commands/space/share.d.ts.map +0 -1
- package/dist/src/commands/space/share.js +0 -80
- package/dist/src/commands/space/share.js.map +0 -1
- package/dist/src/commands/tunnel/index.d.ts +0 -22
- package/dist/src/commands/tunnel/index.d.ts.map +0 -1
- package/dist/src/commands/tunnel/index.js +0 -43
- package/dist/src/commands/tunnel/index.js.map +0 -1
- package/dist/src/commands/tunnel/list.d.ts +0 -21
- package/dist/src/commands/tunnel/list.d.ts.map +0 -1
- package/dist/src/commands/tunnel/list.js +0 -29
- package/dist/src/commands/tunnel/list.js.map +0 -1
- package/dist/src/components/App.d.ts +0 -10
- package/dist/src/components/App.d.ts.map +0 -1
- package/dist/src/components/App.js +0 -31
- package/dist/src/components/App.js.map +0 -1
- package/dist/src/components/SpaceTable.d.ts +0 -10
- package/dist/src/components/SpaceTable.d.ts.map +0 -1
- package/dist/src/components/SpaceTable.js +0 -33
- package/dist/src/components/SpaceTable.js.map +0 -1
- package/dist/src/components/SystemTable.d.ts +0 -8
- package/dist/src/components/SystemTable.d.ts.map +0 -1
- package/dist/src/components/SystemTable.js +0 -51
- package/dist/src/components/SystemTable.js.map +0 -1
- package/dist/src/components/index.d.ts +0 -4
- package/dist/src/components/index.d.ts.map +0 -1
- package/dist/src/components/index.js +0 -7
- package/dist/src/components/index.js.map +0 -1
- package/dist/src/help.d.ts +0 -6
- package/dist/src/help.d.ts.map +0 -1
- package/dist/src/help.js +0 -37
- package/dist/src/help.js.map +0 -1
- package/dist/src/hooks/command-not-found.d.ts +0 -4
- package/dist/src/hooks/command-not-found.d.ts.map +0 -1
- package/dist/src/hooks/command-not-found.js +0 -16
- package/dist/src/hooks/command-not-found.js.map +0 -1
- package/dist/src/index.d.ts +0 -3
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -6
- package/dist/src/index.js.map +0 -1
- package/dist/src/util/function/index.d.ts +0 -2
- package/dist/src/util/function/index.d.ts.map +0 -1
- package/dist/src/util/function/index.js +0 -5
- 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 -13
- package/dist/src/util/function/lookup.js.map +0 -1
- package/dist/src/util/index.d.ts +0 -6
- package/dist/src/util/index.d.ts.map +0 -1
- package/dist/src/util/index.js +0 -9
- package/dist/src/util/index.js.map +0 -1
- package/dist/src/util/provider/digital-ocean.d.ts +0 -14
- package/dist/src/util/provider/digital-ocean.d.ts.map +0 -1
- package/dist/src/util/provider/digital-ocean.js +0 -123
- package/dist/src/util/provider/digital-ocean.js.map +0 -1
- package/dist/src/util/provider/index.d.ts +0 -3
- package/dist/src/util/provider/index.d.ts.map +0 -1
- package/dist/src/util/provider/index.js +0 -6
- package/dist/src/util/provider/index.js.map +0 -1
- package/dist/src/util/provider/provider.d.ts +0 -27
- package/dist/src/util/provider/provider.d.ts.map +0 -1
- package/dist/src/util/provider/provider.js +0 -24
- package/dist/src/util/provider/provider.js.map +0 -1
- package/dist/src/util/publish/build.d.ts +0 -11
- package/dist/src/util/publish/build.d.ts.map +0 -1
- package/dist/src/util/publish/build.js +0 -24
- package/dist/src/util/publish/build.js.map +0 -1
- package/dist/src/util/publish/common.d.ts +0 -11
- package/dist/src/util/publish/common.d.ts.map +0 -1
- package/dist/src/util/publish/common.js +0 -23
- package/dist/src/util/publish/common.js.map +0 -1
- package/dist/src/util/publish/config.d.ts +0 -3
- package/dist/src/util/publish/config.d.ts.map +0 -1
- package/dist/src/util/publish/config.js +0 -27
- package/dist/src/util/publish/config.js.map +0 -1
- package/dist/src/util/publish/index.d.ts +0 -7
- package/dist/src/util/publish/index.d.ts.map +0 -1
- package/dist/src/util/publish/index.js +0 -10
- package/dist/src/util/publish/index.js.map +0 -1
- package/dist/src/util/publish/ipfs-upload.d.ts +0 -8
- package/dist/src/util/publish/ipfs-upload.d.ts.map +0 -1
- package/dist/src/util/publish/ipfs-upload.js +0 -50
- package/dist/src/util/publish/ipfs-upload.js.map +0 -1
- package/dist/src/util/publish/publish.d.ts +0 -14
- package/dist/src/util/publish/publish.d.ts.map +0 -1
- package/dist/src/util/publish/publish.js +0 -51
- package/dist/src/util/publish/publish.js.map +0 -1
- package/dist/src/util/publish/publisher-rpc-peer.d.ts +0 -15
- package/dist/src/util/publish/publisher-rpc-peer.d.ts.map +0 -1
- package/dist/src/util/publish/publisher-rpc-peer.js +0 -82
- package/dist/src/util/publish/publisher-rpc-peer.js.map +0 -1
- package/dist/src/util/supervisor/index.d.ts +0 -2
- package/dist/src/util/supervisor/index.d.ts.map +0 -1
- package/dist/src/util/supervisor/index.js +0 -5
- package/dist/src/util/supervisor/index.js.map +0 -1
- package/dist/src/util/supervisor/supervisor-rpc-peer.d.ts +0 -15
- package/dist/src/util/supervisor/supervisor-rpc-peer.d.ts.map +0 -1
- package/dist/src/util/supervisor/supervisor-rpc-peer.js +0 -83
- package/dist/src/util/supervisor/supervisor-rpc-peer.js.map +0 -1
- package/dist/src/util/tunnel/common.d.ts +0 -9
- package/dist/src/util/tunnel/common.d.ts.map +0 -1
- package/dist/src/util/tunnel/common.js +0 -26
- package/dist/src/util/tunnel/common.js.map +0 -1
- package/dist/src/util/tunnel/index.d.ts +0 -3
- package/dist/src/util/tunnel/index.d.ts.map +0 -1
- package/dist/src/util/tunnel/index.js +0 -6
- package/dist/src/util/tunnel/index.js.map +0 -1
- package/dist/src/util/tunnel/tunnel-rpc-peer.d.ts +0 -15
- package/dist/src/util/tunnel/tunnel-rpc-peer.d.ts.map +0 -1
- package/dist/src/util/tunnel/tunnel-rpc-peer.js +0 -83
- package/dist/src/util/tunnel/tunnel-rpc-peer.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/oclif.manifest.json +0 -5673
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/util/function/index.ts"],"names":[],"mappings":"AAIA,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"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { type Space } from '@dxos/client/echo';
|
|
2
|
-
export declare const findFunctionByDeploymentId: (space: Space, functionId?: string) => Promise<import("@dxos/live-object").Live<import("@dxos/echo/Type").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
|
|
3
|
-
key?: string | undefined;
|
|
4
|
-
version: string;
|
|
5
|
-
name: string;
|
|
6
|
-
description?: string | undefined;
|
|
7
|
-
source?: import("@dxos/echo/internal").Ref<import("@dxos/echo/Type").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
|
|
8
|
-
name?: string | undefined;
|
|
9
|
-
description?: string | undefined;
|
|
10
|
-
changed?: boolean | undefined;
|
|
11
|
-
source: import("@dxos/echo/internal").Ref<import("@dxos/echo/Type").OfKind<import("@dxos/echo/internal").EntityKind.Object> & {
|
|
12
|
-
content: string;
|
|
13
|
-
}>;
|
|
14
|
-
}> | undefined;
|
|
15
|
-
inputSchema?: import("@dxos/echo/internal").JsonSchemaType | undefined;
|
|
16
|
-
outputSchema?: import("@dxos/echo/internal").JsonSchemaType | undefined;
|
|
17
|
-
binding?: string | undefined;
|
|
18
|
-
}> | 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,EAAU,KAAK,KAAK,EAAW,MAAM,mBAAmB,CAAC;AAGhE,eAAO,MAAM,0BAA0B,GAAU,OAAO,KAAK,EAAE,aAAa,MAAM;;;;;;;;;;;;;;;;eAMjF,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
import { Filter, getMeta } from '@dxos/client/echo';
|
|
5
|
-
import { FunctionType, getUserFunctionIdInMetadata } from '@dxos/functions';
|
|
6
|
-
export const findFunctionByDeploymentId = async (space, functionId) => {
|
|
7
|
-
if (!functionId) {
|
|
8
|
-
return undefined;
|
|
9
|
-
}
|
|
10
|
-
const functions = await space.db.query(Filter.type(FunctionType)).run();
|
|
11
|
-
return functions.objects.find((fn) => getUserFunctionIdInMetadata(getMeta(fn)) === functionId);
|
|
12
|
-
};
|
|
13
|
-
//# 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,EAAc,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAE5E,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,SAAS,GAAG,MAAM,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;IACxE,OAAO,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,2BAA2B,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC;AACjG,CAAC,CAAC"}
|
package/dist/src/util/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/util/index.ts"],"names":[],"mappings":"AAIA,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC"}
|
package/dist/src/util/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/util/index.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;AAEF,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { Config } from '@dxos/client';
|
|
2
|
-
import { type KubeDeployOptions, type MachineryProvider } from './provider';
|
|
3
|
-
export declare class DigitalOceanProvider implements MachineryProvider {
|
|
4
|
-
private _session;
|
|
5
|
-
constructor(config: Config);
|
|
6
|
-
getDropletIdFromName(name: string): Promise<any>;
|
|
7
|
-
getSshKeys(): Promise<any>;
|
|
8
|
-
deploy(options: KubeDeployOptions): Promise<{
|
|
9
|
-
hostname: any;
|
|
10
|
-
createdAt: any;
|
|
11
|
-
ipAddress: any;
|
|
12
|
-
}>;
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=digital-ocean.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"digital-ocean.d.ts","sourceRoot":"","sources":["../../../../src/util/provider/digital-ocean.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAG3C,OAAO,EAAY,KAAK,iBAAiB,EAAE,KAAK,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAKtF,qBAAa,oBAAqB,YAAW,iBAAiB;IAC5D,OAAO,CAAC,QAAQ,CAAM;gBAEV,MAAM,EAAE,MAAM;IAOpB,oBAAoB,CAAC,IAAI,EAAE,MAAM;IAQjC,UAAU;IAKV,MAAM,CAAC,OAAO,EAAE,iBAAiB;;;;;CA0GxC"}
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2022 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
import DigitalOcean from 'do-wrapper';
|
|
5
|
-
import { waitForCondition } from '@dxos/async';
|
|
6
|
-
import { invariant } from '@dxos/invariant';
|
|
7
|
-
import { KUBE_TAG } from './provider';
|
|
8
|
-
const DEFAULT_REGION = 'nyc3';
|
|
9
|
-
const DEFAULT_MEMORY = 4;
|
|
10
|
-
export class DigitalOceanProvider {
|
|
11
|
-
_session;
|
|
12
|
-
constructor(config) {
|
|
13
|
-
const doAccessToken = config.get('runtime.services.machine.doAccessToken');
|
|
14
|
-
invariant(doAccessToken, 'Invalid DigitalOcean Access Token.');
|
|
15
|
-
this._session = new DigitalOcean(doAccessToken, 100);
|
|
16
|
-
}
|
|
17
|
-
async getDropletIdFromName(name) {
|
|
18
|
-
invariant(name);
|
|
19
|
-
const result = await this._session.droplets.getAll();
|
|
20
|
-
const [targetDroplet] = result.droplets.filter((droplet) => droplet.name === name) || [];
|
|
21
|
-
return targetDroplet ? targetDroplet.id : undefined;
|
|
22
|
-
}
|
|
23
|
-
async getSshKeys() {
|
|
24
|
-
const result = await this._session.keys.getAll();
|
|
25
|
-
return result.ssh_keys?.map((key) => key.fingerprint);
|
|
26
|
-
}
|
|
27
|
-
async deploy(options) {
|
|
28
|
-
const { hostname: name, region = DEFAULT_REGION, memory = DEFAULT_MEMORY, dev, accessToken } = options;
|
|
29
|
-
const dropletId = await this.getDropletIdFromName(name);
|
|
30
|
-
if (dropletId) {
|
|
31
|
-
throw new Error(`${name} already exists.`);
|
|
32
|
-
}
|
|
33
|
-
const channel = dev ? 'dev' : 'latest';
|
|
34
|
-
const cloudConfigScript = `
|
|
35
|
-
#cloud-config
|
|
36
|
-
|
|
37
|
-
package_update: true
|
|
38
|
-
|
|
39
|
-
package_upgrade: true
|
|
40
|
-
|
|
41
|
-
packages:
|
|
42
|
-
- python
|
|
43
|
-
- build-essential
|
|
44
|
-
- docker-ce
|
|
45
|
-
- docker-ce-cli
|
|
46
|
-
|
|
47
|
-
apt:
|
|
48
|
-
sources:
|
|
49
|
-
docker.list:
|
|
50
|
-
source: deb [arch=amd64] https://download.docker.com/linux/ubuntu $RELEASE stable
|
|
51
|
-
keyid: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88
|
|
52
|
-
` +
|
|
53
|
-
(accessToken
|
|
54
|
-
? `
|
|
55
|
-
write_files:
|
|
56
|
-
- path: /root/.kube/acl/seed.yaml
|
|
57
|
-
content: |
|
|
58
|
-
- entity: "${accessToken}"
|
|
59
|
-
capabilities:
|
|
60
|
-
- 100
|
|
61
|
-
subject: "*"
|
|
62
|
-
`
|
|
63
|
-
: '') +
|
|
64
|
-
`
|
|
65
|
-
runcmd:
|
|
66
|
-
- curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
|
|
67
|
-
- chmod +x /usr/local/bin/docker-compose
|
|
68
|
-
- ch=${channel} bash -c "$(curl -fsSL https://dxos.nyc3.digitaloceanspaces.com/install.sh)"
|
|
69
|
-
- kube start
|
|
70
|
-
`;
|
|
71
|
-
let sizeSlug = 's-2vcpu-4gb';
|
|
72
|
-
switch (memory) {
|
|
73
|
-
case 1:
|
|
74
|
-
sizeSlug = 's-1vcpu-1gb';
|
|
75
|
-
break;
|
|
76
|
-
case 2:
|
|
77
|
-
sizeSlug = 's-2vcpu-2gb';
|
|
78
|
-
break;
|
|
79
|
-
case 4:
|
|
80
|
-
sizeSlug = 's-2vcpu-4gb';
|
|
81
|
-
break;
|
|
82
|
-
case 8:
|
|
83
|
-
sizeSlug = 's-4vcpu-8gb';
|
|
84
|
-
break;
|
|
85
|
-
case 16:
|
|
86
|
-
sizeSlug = 's-8vcpu-16gb';
|
|
87
|
-
break;
|
|
88
|
-
case 32:
|
|
89
|
-
sizeSlug = 's-8vcpu-32gb';
|
|
90
|
-
break;
|
|
91
|
-
}
|
|
92
|
-
const sshKeys = await this.getSshKeys();
|
|
93
|
-
invariant(sshKeys.length, 'No SSH keys found.');
|
|
94
|
-
const createParameters = {
|
|
95
|
-
name,
|
|
96
|
-
region,
|
|
97
|
-
size: sizeSlug,
|
|
98
|
-
image: 'ubuntu-22-10-x64',
|
|
99
|
-
ssh_keys: sshKeys,
|
|
100
|
-
user_data: cloudConfigScript,
|
|
101
|
-
tags: [KUBE_TAG],
|
|
102
|
-
};
|
|
103
|
-
const result = await this._session.droplets.create(createParameters);
|
|
104
|
-
const droplet = await waitForCondition({
|
|
105
|
-
condition: async () => {
|
|
106
|
-
const { droplet } = await this._session.droplets.getById(result.droplet.id);
|
|
107
|
-
if (droplet?.networks.v4.find((net) => net.type === 'public').ip_address) {
|
|
108
|
-
return droplet;
|
|
109
|
-
}
|
|
110
|
-
return undefined;
|
|
111
|
-
},
|
|
112
|
-
timeout: 0,
|
|
113
|
-
interval: 1000,
|
|
114
|
-
});
|
|
115
|
-
const ipAddress = droplet.networks.v4.find((net) => net.type === 'public').ip_address;
|
|
116
|
-
return {
|
|
117
|
-
hostname: droplet.name,
|
|
118
|
-
createdAt: droplet.created_at,
|
|
119
|
-
ipAddress,
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
//# sourceMappingURL=digital-ocean.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"digital-ocean.js","sourceRoot":"","sources":["../../../../src/util/provider/digital-ocean.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;AAEF,OAAO,YAAY,MAAM,YAAY,C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,QAAQ,EAAE,OAAO;YACjB,SAAS,EAAE,iBAAiB;YAC5B,IAAI,EAAE,CAAC,QAAQ,CAAC;SACjB,CAAC;QAEF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;QACrE,MAAM,OAAO,GAAG,MAAM,gBAAgB,CAAC;YACrC,SAAS,EAAE,KAAK,IAAI,EAAE;gBACpB,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;gBAC5E,IAAI,OAAO,EAAE,QAAQ,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,UAAU,EAAE,CAAC;oBAC9E,OAAO,OAAO,CAAC;gBACjB,CAAC;gBACD,OAAO,SAAS,CAAC;YACnB,CAAC;YACD,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,IAAI;SACf,CAAC,CAAC;QAEH,MAAM,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,UAAU,CAAC;QAE3F,OAAO;YACL,QAAQ,EAAE,OAAO,CAAC,IAAI;YACtB,SAAS,EAAE,OAAO,CAAC,UAAU;YAC7B,SAAS;SACV,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/util/provider/index.ts"],"names":[],"mappings":"AAIA,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/util/provider/index.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;AAEF,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { type TableFlags } from '@dxos/cli-base';
|
|
2
|
-
export declare const KUBE_TAG = "kube";
|
|
3
|
-
export declare const DEFAULT_PROVIDER = "digitalocean";
|
|
4
|
-
export interface KubeDeployOptions {
|
|
5
|
-
hostname: string;
|
|
6
|
-
region?: string;
|
|
7
|
-
memory?: number;
|
|
8
|
-
dev: boolean;
|
|
9
|
-
accessToken?: string;
|
|
10
|
-
}
|
|
11
|
-
export type KUBE = {
|
|
12
|
-
hostname: string;
|
|
13
|
-
createdAt: string;
|
|
14
|
-
ipAddress: string;
|
|
15
|
-
};
|
|
16
|
-
export interface MachineryProvider {
|
|
17
|
-
/**
|
|
18
|
-
* Deploy KUBE to a Provider.
|
|
19
|
-
*/
|
|
20
|
-
deploy(options: KubeDeployOptions): Promise<KUBE>;
|
|
21
|
-
}
|
|
22
|
-
export declare const mapKubes: (kubes: KUBE[]) => {
|
|
23
|
-
key: string;
|
|
24
|
-
ipAddress: string;
|
|
25
|
-
}[];
|
|
26
|
-
export declare const printKubes: (kubes: KUBE[], flags?: TableFlags) => void;
|
|
27
|
-
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../../src/util/provider/provider.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,UAAU,EAAS,MAAM,gBAAgB,CAAC;AAExD,eAAO,MAAM,QAAQ,SAAS,CAAC;AAE/B,eAAO,MAAM,gBAAgB,iBAAiB,CAAC;AAE/C,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,OAAO,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,IAAI,GAAG;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,MAAM,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACnD;AAED,eAAO,MAAM,QAAQ,GAAI,OAAO,IAAI,EAAE;;;GAKrC,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,OAAO,IAAI,EAAE,EAAE,QAAO,UAAe,SAe/D,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2022 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
import { ux } from '@oclif/core';
|
|
5
|
-
import { table } from '@dxos/cli-base';
|
|
6
|
-
export const KUBE_TAG = 'kube';
|
|
7
|
-
export const DEFAULT_PROVIDER = 'digitalocean';
|
|
8
|
-
export const mapKubes = (kubes) => {
|
|
9
|
-
return kubes.map((kube) => ({
|
|
10
|
-
key: kube.hostname,
|
|
11
|
-
ipAddress: kube.ipAddress,
|
|
12
|
-
}));
|
|
13
|
-
};
|
|
14
|
-
export const printKubes = (kubes, flags = {}) => {
|
|
15
|
-
ux.stdout(table(mapKubes(kubes), {
|
|
16
|
-
key: {
|
|
17
|
-
header: 'hostname',
|
|
18
|
-
},
|
|
19
|
-
ipAddress: {
|
|
20
|
-
header: 'ip address',
|
|
21
|
-
},
|
|
22
|
-
}, flags));
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=provider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../../../src/util/provider/provider.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;AAEF,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAEjC,OAAO,EAAmB,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAExD,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE/B,MAAM,CAAC,MAAM,gBAAgB,GAAG,cAAc,CAAC;AAuB/C,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,KAAa,EAAE,EAAE;IACxC,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAC1B,GAAG,EAAE,IAAI,CAAC,QAAQ;QAClB,SAAS,EAAE,IAAI,CAAC,SAAS;KAC1B,CAAC,CAAC,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAa,EAAE,QAAoB,EAAE,EAAE,EAAE;IAClE,EAAE,CAAC,MAAM,CACP,KAAK,CACH,QAAQ,CAAC,KAAK,CAAC,EACf;QACE,GAAG,EAAE;YACH,MAAM,EAAE,UAAU;SACnB;QACD,SAAS,EAAE;YACT,MAAM,EAAE,YAAY;SACrB;KACF,EACD,KAAK,CACN,CACF,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Logger, PackageModule } from './common';
|
|
2
|
-
export interface BuildParams {
|
|
3
|
-
log: Logger;
|
|
4
|
-
module: PackageModule;
|
|
5
|
-
}
|
|
6
|
-
interface BuildArgs {
|
|
7
|
-
verbose?: boolean;
|
|
8
|
-
}
|
|
9
|
-
export declare const build: ({ verbose }: BuildArgs, { log, module }: BuildParams) => void;
|
|
10
|
-
export {};
|
|
11
|
-
//# sourceMappingURL=build.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../../src/util/publish/build.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEtD,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,aAAa,CAAC;CACvB;AAED,UAAU,SAAS;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,KAAK,GAAI,aAAa,SAAS,EAAE,iBAAiB,WAAW,SAyBzE,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2022 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
import { spawnSync } from 'child_process';
|
|
5
|
-
import chalk from 'chalk';
|
|
6
|
-
export const build = ({ verbose }, { log, module }) => {
|
|
7
|
-
log(`Building module ${chalk.bold(module.name)} ...`);
|
|
8
|
-
const [command, ...args] = module.build.command.split(' ');
|
|
9
|
-
// Build with configuration.
|
|
10
|
-
const { status, error } = spawnSync(command, args, {
|
|
11
|
-
env: {
|
|
12
|
-
...process.env,
|
|
13
|
-
...(module.build.env ?? {}),
|
|
14
|
-
CONFIG_DYNAMIC: 'true',
|
|
15
|
-
},
|
|
16
|
-
stdio: verbose ? 'inherit' : undefined,
|
|
17
|
-
});
|
|
18
|
-
if (error || status !== 0) {
|
|
19
|
-
log(`Module ${chalk.bold(module.name)} build failed${verbose ? ` with status: ${status}.${error ? '\n' + error : ''}` : '. Re-run with --verbose for more details.'}`);
|
|
20
|
-
process.exit(status === null ? 1 : status);
|
|
21
|
-
}
|
|
22
|
-
log(`Module build ${chalk.bold(module.name)} succeeded.`);
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=build.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../../../src/util/publish/build.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;AAEF,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B,MAAM,CAAC,MAAM,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
|
-
import type { ConfigProto } from '@dxos/config';
|
|
3
|
-
export type PackageModule = NonNullable<NonNullable<ConfigProto['package']>['modules']>[0];
|
|
4
|
-
export type PackageRepo = NonNullable<NonNullable<ConfigProto['package']>['repos']>[0];
|
|
5
|
-
export type Logger = (message: string, ...args: any[]) => void;
|
|
6
|
-
export declare const mapModules: (modules: PackageModule[]) => Promise<{
|
|
7
|
-
key: string | undefined;
|
|
8
|
-
bundle: string;
|
|
9
|
-
}[]>;
|
|
10
|
-
export declare const printModules: (modules: PackageModule[], flags?: TableOptions) => Promise<void>;
|
|
11
|
-
//# sourceMappingURL=common.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/util/publish/common.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,YAAY,EAAS,MAAM,gBAAgB,CAAC;AAC1D,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;AAEvF,MAAM,MAAM,MAAM,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;AAE/D,eAAO,MAAM,UAAU,GAAU,SAAS,aAAa,EAAE;;;IAMxD,CAAC;AAEF,eAAO,MAAM,YAAY,GAAU,SAAS,aAAa,EAAE,EAAE,QAAO,YAAiB,kBAepF,CAAC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
import { ux } from '@oclif/core';
|
|
5
|
-
import { table } from '@dxos/cli-base';
|
|
6
|
-
export const mapModules = async (modules) => {
|
|
7
|
-
const { CID } = await import('kubo-rpc-client');
|
|
8
|
-
return modules.map((mod) => ({
|
|
9
|
-
key: mod.name,
|
|
10
|
-
bundle: CID.decode(mod.bundle).toString(),
|
|
11
|
-
}));
|
|
12
|
-
};
|
|
13
|
-
export const printModules = async (modules, flags = {}) => {
|
|
14
|
-
ux.stdout(table(await mapModules(modules), {
|
|
15
|
-
key: {
|
|
16
|
-
header: 'name',
|
|
17
|
-
},
|
|
18
|
-
bundle: {
|
|
19
|
-
header: 'bundle',
|
|
20
|
-
},
|
|
21
|
-
}, flags));
|
|
22
|
-
};
|
|
23
|
-
//# sourceMappingURL=common.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../src/util/publish/common.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;AAEF,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAEjC,OAAO,EAAqB,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAQ1D,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,EAAE,OAAwB,EAAE,EAAE;IAC3D,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,MAAM,CAAC,iBAAiB,CAAC,CAAC;IAChD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QAC3B,GAAG,EAAE,GAAG,CAAC,IAAI;QACb,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,MAAO,CAAC,CAAC,QAAQ,EAAE;KAC3C,CAAC,CAAC,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,EAAE,OAAwB,EAAE,QAAsB,EAAE,EAAE,EAAE;IACvF,EAAE,CAAC,MAAM,CACP,KAAK,CACH,MAAM,UAAU,CAAC,OAAO,CAAC,EACzB;QACE,GAAG,EAAE;YACH,MAAM,EAAE,MAAM;SACf;QACD,MAAM,EAAE;YACN,MAAM,EAAE,QAAQ;SACjB;KACF,EACD,KAAK,CACN,CACF,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../src/util/publish/config.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAStC,eAAO,MAAM,UAAU,GAAU,aAAY,MAAkC,KAAG,OAAO,CAAC,MAAM,CAoB/F,CAAC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2022 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
import fs from 'fs';
|
|
5
|
-
import path from 'path';
|
|
6
|
-
import yaml from 'js-yaml';
|
|
7
|
-
import defaultsDeep from 'lodash.defaultsdeep';
|
|
8
|
-
import { Config } from '@dxos/config';
|
|
9
|
-
import { invariant } from '@dxos/invariant';
|
|
10
|
-
const DEFAULT_BUILD_COMMAND = 'npm run build';
|
|
11
|
-
const EXTENSION_CONFIG_FILENAME = 'dx.yml';
|
|
12
|
-
export const loadConfig = async (configPath = EXTENSION_CONFIG_FILENAME) => {
|
|
13
|
-
const absolute = path.isAbsolute(configPath);
|
|
14
|
-
configPath = absolute ? configPath : path.join(process.cwd(), configPath);
|
|
15
|
-
invariant(fs.existsSync(configPath), `"${configPath}" not found.`);
|
|
16
|
-
const dxConfig = yaml.load(String(fs.readFileSync(configPath)));
|
|
17
|
-
invariant(dxConfig.package?.modules?.length, `No modules found in ${configPath}`);
|
|
18
|
-
return new Config({
|
|
19
|
-
version: 1,
|
|
20
|
-
package: {
|
|
21
|
-
modules: dxConfig.package.modules.map((module) => defaultsDeep(module, {
|
|
22
|
-
build: { command: DEFAULT_BUILD_COMMAND },
|
|
23
|
-
})),
|
|
24
|
-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,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAqB,EAAE,EAAE,CAC9D,YAAY,CAAC,MAAM,EAAE;gBACnB,KAAK,EAAE,EAAE,OAAO,EAAE,qBAAqB,EAAE;aAC1C,CAAC,CACH;SACF;KACF,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/util/publish/index.ts"],"names":[],"mappings":"AAIA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/util/publish/index.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;AAEF,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { type CID, type KuboRPCClient } from 'kubo-rpc-client';
|
|
2
|
-
interface UploadOptions {
|
|
3
|
-
progress?: (bytes: number, path?: string) => void;
|
|
4
|
-
pin?: boolean;
|
|
5
|
-
}
|
|
6
|
-
export declare const uploadToIPFS: (ipfsClient: KuboRPCClient, path: string, options?: UploadOptions) => Promise<CID>;
|
|
7
|
-
export {};
|
|
8
|
-
//# sourceMappingURL=ipfs-upload.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ipfs-upload.d.ts","sourceRoot":"","sources":["../../../../src/util/publish/ipfs-upload.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAI/D,UAAU,aAAa;IACrB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAClD,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAGD,eAAO,MAAM,YAAY,GAAU,YAAY,aAAa,EAAE,MAAM,MAAM,EAAE,UAAU,aAAa,KAAG,OAAO,CAAC,GAAG,CA2ChH,CAAC"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2022 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
import fs from 'fs';
|
|
5
|
-
import { join } from 'path';
|
|
6
|
-
import { importESM } from '@dxos/cli-base';
|
|
7
|
-
// TODO(burdon): Generalize.
|
|
8
|
-
export const uploadToIPFS = async (ipfsClient, path, options) => {
|
|
9
|
-
const { globSource } = await importESM('kubo-rpc-client');
|
|
10
|
-
if (!fs.existsSync(path)) {
|
|
11
|
-
throw new Error(`File or directory does not exist: ${path}}`);
|
|
12
|
-
}
|
|
13
|
-
const { pin = true, progress } = options || {};
|
|
14
|
-
if (fs.lstatSync(path).isDirectory()) {
|
|
15
|
-
const files = [];
|
|
16
|
-
for await (const file of ipfsClient.addAll(globSource(path, '**/*'), {
|
|
17
|
-
progress,
|
|
18
|
-
pin,
|
|
19
|
-
wrapWithDirectory: true,
|
|
20
|
-
})) {
|
|
21
|
-
const fullPath = join(path, file.path);
|
|
22
|
-
if (!fs.lstatSync(fullPath).isDirectory()) {
|
|
23
|
-
const remoteChunks = [];
|
|
24
|
-
for await (const chunk of ipfsClient.cat(file.cid)) {
|
|
25
|
-
remoteChunks.push(chunk);
|
|
26
|
-
}
|
|
27
|
-
const remoteContent = Buffer.concat(remoteChunks);
|
|
28
|
-
const localContent = fs.readFileSync(fullPath);
|
|
29
|
-
if (!localContent.equals(remoteContent)) {
|
|
30
|
-
throw new Error('file content mismatch', {
|
|
31
|
-
cause: {
|
|
32
|
-
path: fullPath,
|
|
33
|
-
cid: file.cid.toString(),
|
|
34
|
-
localSize: localContent.length,
|
|
35
|
-
remoteSize: remoteContent.length,
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
files.push(file);
|
|
41
|
-
}
|
|
42
|
-
return files[files.length - 1].cid; // last file is the root directory
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
const content = fs.readFileSync(path);
|
|
46
|
-
const addResult = await ipfsClient.add(content, { pin });
|
|
47
|
-
return addResult.cid;
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
//# sourceMappingURL=ipfs-upload.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ipfs-upload.js","sourceRoot":"","sources":["../../../../src/util/publish/ipfs-upload.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;AAEF,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAI5B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAO3C,4BAA4B;AAC5B,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,EAAE,UAAyB,EAAE,IAAY,EAAE,OAAuB,EAAgB,EAAE;IACnH,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,SAAS,CAAC,iBAAiB,CAAC,CAAC;IAC1D,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,qCAAqC,IAAI,GAAG,CAAC,CAAC;IAChE,CAAC;IAED,MAAM,EAAE,GAAG,GAAG,IAAI,EAAE,QAAQ,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;IAC/C,IAAI,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC;QACrC,MAAM,KAAK,GAA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AG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QACtC,MAAM,SAAS,GAAG,MAAM,UAAU,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;QACzD,OAAO,SAAS,CAAC,GAAG,CAAC;IACvB,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { Config } from '@dxos/client';
|
|
2
|
-
import { type Logger, type PackageModule } from './common';
|
|
3
|
-
interface PublishOptions {
|
|
4
|
-
config: Config;
|
|
5
|
-
log: Logger;
|
|
6
|
-
module: PackageModule;
|
|
7
|
-
verbose?: boolean;
|
|
8
|
-
timeout?: string | number;
|
|
9
|
-
path?: string;
|
|
10
|
-
pin?: boolean;
|
|
11
|
-
}
|
|
12
|
-
export declare const publish: ({ verbose, timeout, path, pin, log, config, module }: PublishOptions) => Promise<any>;
|
|
13
|
-
export {};
|
|
14
|
-
//# sourceMappingURL=publish.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../../../../src/util/publish/publish.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAG3C,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC;AAa3D,UAAU,cAAc;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,aAAa,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,eAAO,MAAM,OAAO,GAAU,sDAAsD,cAAc,KAAG,OAAO,CAAC,GAAG,CAiC/G,CAAC"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2022 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
import fs from 'fs';
|
|
5
|
-
import { join } from 'path';
|
|
6
|
-
import { promisify } from 'util';
|
|
7
|
-
import chalk from 'chalk';
|
|
8
|
-
import cliProgress from 'cli-progress';
|
|
9
|
-
import folderSize from 'get-folder-size';
|
|
10
|
-
import { createIpfsClient } from '@dxos/cli-base';
|
|
11
|
-
import { invariant } from '@dxos/invariant';
|
|
12
|
-
import { uploadToIPFS } from './ipfs-upload';
|
|
13
|
-
const DEFAULT_OUTDIR = 'out';
|
|
14
|
-
const getFolderSize = promisify(folderSize);
|
|
15
|
-
/**
|
|
16
|
-
* Encodes DXN string to fs path.
|
|
17
|
-
* Example: `example:app/braneframe` => `example/app/braneframe`
|
|
18
|
-
*/
|
|
19
|
-
const encodeName = (name) => name.replaceAll(':', '/');
|
|
20
|
-
export const publish = async ({ verbose, timeout, path, pin, log, config, module }) => {
|
|
21
|
-
invariant(module.name, 'Module name is required to publish.');
|
|
22
|
-
log(`Publishing module ${chalk.bold(module.name)} ...`);
|
|
23
|
-
const moduleOut = `out/${encodeName(module.name)}`;
|
|
24
|
-
const outdir = path ?? module.build?.outdir ?? (fs.existsSync(moduleOut) ? moduleOut : DEFAULT_OUTDIR);
|
|
25
|
-
const publishFolder = join(process.cwd(), outdir);
|
|
26
|
-
if (!fs.existsSync(publishFolder)) {
|
|
27
|
-
throw new Error(`Publish failed. Build output folder does not exist: ${publishFolder}.`);
|
|
28
|
-
}
|
|
29
|
-
const total = await getFolderSize(publishFolder);
|
|
30
|
-
const progress = new cliProgress.SingleBar({}, cliProgress.Presets.shades_classic);
|
|
31
|
-
verbose && progress.start(total, 0);
|
|
32
|
-
let cid;
|
|
33
|
-
try {
|
|
34
|
-
const ipfsClient = await createIpfsClient(config, timeout);
|
|
35
|
-
log('Uploading...', { folder: publishFolder, server: ipfsClient.getEndpointConfig().host });
|
|
36
|
-
cid = await uploadToIPFS(ipfsClient, publishFolder, {
|
|
37
|
-
progress: verbose ? (bytes) => progress.update(bytes) : undefined,
|
|
38
|
-
pin,
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
catch (err) {
|
|
42
|
-
// Avoid leaving user's terminal in a bad state.
|
|
43
|
-
progress.stop();
|
|
44
|
-
throw new Error(`Publish failed. ${err.message}` + (err.cause ? ` (${err.cause})` : ''));
|
|
45
|
-
}
|
|
46
|
-
verbose && progress.update(total);
|
|
47
|
-
verbose && progress.stop();
|
|
48
|
-
log(`Published module ${chalk.bold(module.name)}. IPFS cid: ${cid.toString()}`);
|
|
49
|
-
return cid;
|
|
50
|
-
};
|
|
51
|
-
//# sourceMappingURL=publish.js.map
|