@astrale-os/sdk 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/dist/auth/check.d.ts +1 -2
- package/dist/auth/check.d.ts.map +1 -1
- package/dist/auth/check.js +2 -6
- package/dist/auth/check.js.map +1 -1
- package/dist/auth/index.d.ts +2 -0
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +1 -0
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/issuer-mint.d.ts +53 -0
- package/dist/auth/issuer-mint.d.ts.map +1 -0
- package/dist/auth/issuer-mint.js +35 -0
- package/dist/auth/issuer-mint.js.map +1 -0
- package/dist/auth/kernel-client.d.ts +8 -2
- package/dist/auth/kernel-client.d.ts.map +1 -1
- package/dist/auth/kernel-client.js +22 -46
- package/dist/auth/kernel-client.js.map +1 -1
- package/dist/cli/dotenv.d.ts +8 -0
- package/dist/cli/dotenv.d.ts.map +1 -1
- package/dist/cli/dotenv.js +18 -0
- package/dist/cli/dotenv.js.map +1 -1
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/log.d.ts +11 -0
- package/dist/cli/log.d.ts.map +1 -0
- package/dist/cli/log.js +17 -0
- package/dist/cli/log.js.map +1 -0
- package/dist/cli/publish.d.ts +35 -0
- package/dist/cli/publish.d.ts.map +1 -0
- package/dist/cli/publish.js +271 -0
- package/dist/cli/publish.js.map +1 -0
- package/dist/cli/run.d.ts +17 -1
- package/dist/cli/run.d.ts.map +1 -1
- package/dist/cli/run.js +85 -101
- package/dist/cli/run.js.map +1 -1
- package/dist/cli/spec.d.ts.map +1 -1
- package/dist/cli/spec.js +1 -0
- package/dist/cli/spec.js.map +1 -1
- package/dist/config/define-domain.d.ts +79 -2
- package/dist/config/define-domain.d.ts.map +1 -1
- package/dist/config/define-domain.js +58 -1
- package/dist/config/define-domain.js.map +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/define/remote-function.d.ts +23 -3
- package/dist/define/remote-function.d.ts.map +1 -1
- package/dist/define/remote-function.js +1 -1
- package/dist/define/remote-function.js.map +1 -1
- package/dist/deploy/check.d.ts +6 -6
- package/dist/deploy/check.d.ts.map +1 -1
- package/dist/deploy/check.js +1 -1
- package/dist/deploy/check.js.map +1 -1
- package/dist/deploy/index.d.ts +0 -1
- package/dist/deploy/index.d.ts.map +1 -1
- package/dist/deploy/index.js +0 -1
- package/dist/deploy/index.js.map +1 -1
- package/dist/deploy/meta.d.ts +11 -0
- package/dist/deploy/meta.d.ts.map +1 -1
- package/dist/deploy/meta.js +23 -0
- package/dist/deploy/meta.js.map +1 -1
- package/dist/dispatch/dispatcher.d.ts +17 -4
- package/dist/dispatch/dispatcher.d.ts.map +1 -1
- package/dist/dispatch/dispatcher.js +15 -3
- package/dist/dispatch/dispatcher.js.map +1 -1
- package/dist/dispatch/execute.d.ts +6 -2
- package/dist/dispatch/execute.d.ts.map +1 -1
- package/dist/dispatch/execute.js +1 -0
- package/dist/dispatch/execute.js.map +1 -1
- package/dist/dispatch/identity.d.ts +11 -10
- package/dist/dispatch/identity.d.ts.map +1 -1
- package/dist/dispatch/identity.js +4 -3
- package/dist/dispatch/identity.js.map +1 -1
- package/dist/dispatch/index.d.ts +1 -1
- package/dist/dispatch/index.d.ts.map +1 -1
- package/dist/dispatch/index.js +1 -1
- package/dist/dispatch/index.js.map +1 -1
- package/dist/dispatch/self.d.ts +25 -37
- package/dist/dispatch/self.d.ts.map +1 -1
- package/dist/dispatch/self.js +60 -30
- package/dist/dispatch/self.js.map +1 -1
- package/dist/domain/build-spec.d.ts.map +1 -1
- package/dist/domain/build-spec.js +15 -3
- package/dist/domain/build-spec.js.map +1 -1
- package/dist/domain/define.d.ts +17 -32
- package/dist/domain/define.d.ts.map +1 -1
- package/dist/domain/define.js +12 -31
- package/dist/domain/define.js.map +1 -1
- package/dist/domain/extend-functions.d.ts +13 -9
- package/dist/domain/extend-functions.d.ts.map +1 -1
- package/dist/domain/extend-functions.js +28 -13
- package/dist/domain/extend-functions.js.map +1 -1
- package/dist/index.d.ts +7 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -4
- package/dist/index.js.map +1 -1
- package/dist/method/class.d.ts +2 -2
- package/dist/method/class.d.ts.map +1 -1
- package/dist/method/class.js.map +1 -1
- package/dist/method/context.d.ts +18 -3
- package/dist/method/context.d.ts.map +1 -1
- package/dist/method/index.d.ts +2 -2
- package/dist/method/index.d.ts.map +1 -1
- package/dist/method/index.js.map +1 -1
- package/dist/method/single.d.ts +25 -38
- package/dist/method/single.d.ts.map +1 -1
- package/dist/method/single.js +1 -11
- package/dist/method/single.js.map +1 -1
- package/dist/server/auxiliary-routes.d.ts.map +1 -1
- package/dist/server/auxiliary-routes.js +13 -2
- package/dist/server/auxiliary-routes.js.map +1 -1
- package/dist/server/create.d.ts +2 -15
- package/dist/server/create.d.ts.map +1 -1
- package/dist/server/create.js +15 -51
- package/dist/server/create.js.map +1 -1
- package/dist/server/domain-entry.d.ts +10 -0
- package/dist/server/domain-entry.d.ts.map +1 -1
- package/dist/server/domain-entry.js +2 -0
- package/dist/server/domain-entry.js.map +1 -1
- package/dist/server/index.d.ts +0 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +0 -1
- package/dist/server/index.js.map +1 -1
- package/package.json +10 -8
- package/src/auth/check.ts +2 -6
- package/src/auth/index.ts +2 -0
- package/src/auth/issuer-mint.ts +75 -0
- package/src/auth/kernel-client.ts +31 -63
- package/src/cli/dotenv.ts +20 -0
- package/src/cli/index.ts +1 -1
- package/src/cli/log.ts +18 -0
- package/src/cli/publish.ts +341 -0
- package/src/cli/run.ts +92 -113
- package/src/cli/spec.ts +1 -0
- package/src/config/define-domain.ts +158 -5
- package/src/config/index.ts +1 -1
- package/src/define/remote-function.ts +47 -7
- package/src/deploy/check.ts +7 -7
- package/src/deploy/index.ts +0 -1
- package/src/deploy/meta.ts +25 -0
- package/src/dispatch/dispatcher.ts +32 -9
- package/src/dispatch/execute.ts +7 -2
- package/src/dispatch/identity.ts +11 -10
- package/src/dispatch/index.ts +1 -1
- package/src/dispatch/self.ts +117 -41
- package/src/domain/build-spec.ts +15 -1
- package/src/domain/define.ts +26 -38
- package/src/domain/extend-functions.ts +35 -15
- package/src/index.ts +29 -5
- package/src/method/class.ts +11 -7
- package/src/method/context.ts +19 -3
- package/src/method/index.ts +8 -2
- package/src/method/single.ts +35 -42
- package/src/server/auxiliary-routes.ts +13 -2
- package/src/server/create.ts +15 -51
- package/src/server/domain-entry.ts +12 -0
- package/src/server/index.ts +0 -1
- package/src/deploy/hash-spec.ts +0 -31
- package/src/server/worker-meta.ts +0 -25
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/server/create.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/server/create.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAA;AACjE,OAAO,EACL,mBAAmB,EACnB,0BAA0B,EAC1B,gBAAgB,GACjB,MAAM,gCAAgC,CAAA;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAMzC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EAAE,iB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C/D,MAAM,GAAG,GAAG,MAAM,SAAS,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,CAAC,CAAA;IAEjD,oEAAoE;IACpE,OAAO,IAAI,OAAO,CAAC;QACjB,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,UAAU,EAAE,IAAI,CAAC,SAAS;QAC1B,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9D,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACtD,CAAC;SACC,kBAAkB,CAAC,MAAM,CAAC;SAC1B,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC;SACtB,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC;SACvB,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC;SAC1B,WAAW,EAAE;SACb,iBAAiB,CAAC,KAAK,CAAC;SACxB,IAAI,CAAC,GAAG,CAAC,CAAA;AACd,CAAC"}
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import type { Core, Schema } from '@astrale-os/kernel-dsl';
|
|
18
18
|
import type { Hono } from 'hono';
|
|
19
|
+
import type { DomainManifest } from '../config/define-domain';
|
|
19
20
|
import type { AnyRemoteFunctionDef, ViewDef } from '../define';
|
|
20
21
|
import type { SchemaMethodsImpl } from '../method';
|
|
21
22
|
import type { RemoteServerConfig } from './config';
|
|
@@ -40,8 +41,17 @@ export interface DomainWorkerEntryConfig<S extends Schema, TEnv, TDeps> {
|
|
|
40
41
|
requires?: readonly string[];
|
|
41
42
|
/** Typed colon-path the kernel calls once as __SYSTEM__ after install. */
|
|
42
43
|
postInstall?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Physical tree path for the Domain node (absolute, e.g. `/domains/acme`);
|
|
46
|
+
* default `/domains/<origin>`. Rides in on the `...domain` spread from
|
|
47
|
+
* `defineDomain`; declared here so it is captured (not silently dropped like a
|
|
48
|
+
* spread prop absent from this type) and forwarded to `defineRemoteDomain`.
|
|
49
|
+
*/
|
|
50
|
+
path?: string;
|
|
43
51
|
/** Provenance stamped on `/meta`. */
|
|
44
52
|
meta?: RemoteServerConfig<TDeps>['meta'];
|
|
53
|
+
/** Presentation metadata (logo / initial view) stamped on `/meta`. */
|
|
54
|
+
manifest?: DomainManifest;
|
|
45
55
|
/**
|
|
46
56
|
* Map the worker `env` to the handler dependency container. Defaults to
|
|
47
57
|
* passing `env` straight through (the common case where handlers read
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domain-entry.d.ts","sourceRoot":"","sources":["../../src/server/domain-entry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAEhC,OAAO,KAAK,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAClD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAKpE,MAAM,WAAW,uBAAuB,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,KAAK;IACpE,yBAAyB;IACzB,MAAM,EAAE,CAAC,CAAA;IACT,oEAAoE;IACpE,OAAO,EAAE,iBAAiB,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;IACpC,6DAA6D;IAC7D,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CA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;CAC3D;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,KAAK,GAAG,IAAI,MACjC,CAAC,SAAS,MAAM,UACvB,uBAAuB,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,KAC9C,WAAW,CAAC,IAAI,CAAC,CAmCrB"}
|
|
@@ -31,6 +31,8 @@ export function domainWorkerEntry() {
|
|
|
31
31
|
...(config.core ? { core: config.core } : {}),
|
|
32
32
|
...(config.views ? { views: config.views } : {}),
|
|
33
33
|
...(config.functions ? { remoteFunctions: config.functions } : {}),
|
|
34
|
+
...(config.manifest ? { manifest: config.manifest } : {}),
|
|
35
|
+
...(config.path ? { path: config.path } : {}),
|
|
34
36
|
});
|
|
35
37
|
return createWorkerEntry({
|
|
36
38
|
...(config.resolveUrl ? { resolveUrl: config.resolveUrl } : {}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domain-entry.js","sourceRoot":"","sources":["../../src/server/domain-entry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;
|
|
1
|
+
{"version":3,"file":"domain-entry.js","sourceRoot":"","sources":["../../src/server/domain-entry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAWH,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAoDlD;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB;IAC/B,OAAO,UACL,MAA+C;QAE/C,MAAM,MAAM,GAAG,kBAAkB,EAAS,CAAC;YACzC,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC7C,GAAG,CAAC,MAAM,CAAC,KAA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EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAClB,CAAC;gBACC,MAAM;gBACN,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAE,GAAwB;gBACrE,GAAG;gBACH,UAAU,EACR,OAAO,MAAM,CAAC,UAAU,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU;gBACtF,GAAG,CAAC,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACvF,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAClE,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC7C,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAChD,CAAwC;SAC5C,CAAC,CAAA;IACJ,CAAC,CAAA;AACH,CAAC"}
|
package/dist/server/index.d.ts
CHANGED
|
@@ -8,6 +8,5 @@ export { assets, createWorkerEntry } from './worker-entry';
|
|
|
8
8
|
export type { WorkerEntry, WorkerEntryConfig } from './worker-entry';
|
|
9
9
|
export { domainWorkerEntry } from './domain-entry';
|
|
10
10
|
export type { DomainWorkerEntryConfig } from './domain-entry';
|
|
11
|
-
export { workerMeta } from './worker-meta';
|
|
12
11
|
export { startNodeServer } from './start';
|
|
13
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAC7C,YAAY,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAClD,YAAY,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AACtD,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAC1D,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAClD,YAAY,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAA;AAC7D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAC7C,YAAY,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAClD,YAAY,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AACtD,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAC1D,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAClD,YAAY,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAA;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA"}
|
package/dist/server/index.js
CHANGED
|
@@ -4,6 +4,5 @@ export { requireEnv } from './require-env';
|
|
|
4
4
|
export { canonicalizeServingUrl } from './serving-url';
|
|
5
5
|
export { assets, createWorkerEntry } from './worker-entry';
|
|
6
6
|
export { domainWorkerEntry } from './domain-entry';
|
|
7
|
-
export { workerMeta } from './worker-meta';
|
|
8
7
|
export { startNodeServer } from './start';
|
|
9
8
|
//# sourceMappingURL=index.js.map
|
package/dist/server/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAG7C,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AACtD,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAE1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAElD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAG7C,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AACtD,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAE1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAElD,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrale-os/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Astrale Remote Domain SDK - Define and deploy domains as standalone Hono servers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"astrale",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"remote",
|
|
10
10
|
"sdk"
|
|
11
11
|
],
|
|
12
|
-
"license": "
|
|
12
|
+
"license": "Apache-2.0",
|
|
13
13
|
"author": "Astrale",
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|
|
@@ -48,9 +48,9 @@
|
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@astrale-os/kernel-api": ">=0.4.
|
|
52
|
-
"@astrale-os/kernel-client": ">=0.
|
|
53
|
-
"@astrale-os/kernel-core": ">=0.
|
|
51
|
+
"@astrale-os/kernel-api": ">=0.4.7 <1.0.0",
|
|
52
|
+
"@astrale-os/kernel-client": ">=0.3.0 <1.0.0",
|
|
53
|
+
"@astrale-os/kernel-core": ">=0.6.2 <1.0.0",
|
|
54
54
|
"@astrale-os/kernel-dsl": ">=0.1.2 <1.0.0",
|
|
55
55
|
"@astrale-os/kernel-server": ">=0.4.0 <1.0.0",
|
|
56
56
|
"hono": "^4.6.20",
|
|
@@ -58,8 +58,9 @@
|
|
|
58
58
|
"zod": "^4.3.6"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
+
"@astrale-os/kernel-test": ">=0.1.0 <1.0.0",
|
|
61
62
|
"@astrale-os/ox": ">=0.1.0 <1.0.0",
|
|
62
|
-
"@astrale/commitlint-config": "npm:@jsr/astrale__commitlint-config@~2.0.
|
|
63
|
+
"@astrale/commitlint-config": "npm:@jsr/astrale__commitlint-config@~2.0.1",
|
|
63
64
|
"@astrale/typescript-config": "npm:@jsr/astrale__typescript-config@~1.1.0",
|
|
64
65
|
"@commitlint/cli": "~20.3.1",
|
|
65
66
|
"@commitlint/config-conventional": "~20.3.1",
|
|
@@ -68,7 +69,7 @@
|
|
|
68
69
|
"@typescript/native-preview": "latest",
|
|
69
70
|
"husky": "~9.1.7",
|
|
70
71
|
"lint-staged": "~16.2.7",
|
|
71
|
-
"oxfmt": "
|
|
72
|
+
"oxfmt": "0.52.0",
|
|
72
73
|
"oxlint": "latest",
|
|
73
74
|
"typescript": "~6.0.1-rc",
|
|
74
75
|
"vitest": "^3.0.0"
|
|
@@ -96,7 +97,8 @@
|
|
|
96
97
|
"scripts": {
|
|
97
98
|
"preinstall": "node -e \"try{require('./.check-workspace.cjs')}catch{}\"",
|
|
98
99
|
"build": "tsgo",
|
|
99
|
-
"typecheck": "tsgo --noEmit",
|
|
100
|
+
"typecheck": "tsgo --noEmit && pnpm run typecheck:types",
|
|
101
|
+
"typecheck:types": "tsgo --noEmit -p __tests__/tsconfig.types.json",
|
|
100
102
|
"test": "vitest run --config __tests__/vitest.config.ts",
|
|
101
103
|
"test:watch": "vitest --config __tests__/vitest.config.ts",
|
|
102
104
|
"lint": "oxlint .",
|
package/src/auth/check.ts
CHANGED
|
@@ -36,8 +36,7 @@ export { ALL, EDIT, READ, SHARE, USE } from '@astrale-os/kernel-core'
|
|
|
36
36
|
* Throws `AuthorizationDeniedError` if `principal` lacks `requiredBits` on
|
|
37
37
|
* `target`. `requiredBits` is a bitmask — pass `READ | EDIT` to require both.
|
|
38
38
|
*
|
|
39
|
-
* Implementation:
|
|
40
|
-
* `checkPerm` syscall lives on the Identity, not the target). Cheap; adds
|
|
39
|
+
* Implementation: delegates to the bound session's AuthApi. Cheap; adds
|
|
41
40
|
* one round-trip to the dispatch path.
|
|
42
41
|
*/
|
|
43
42
|
export async function assertPerm(
|
|
@@ -52,10 +51,7 @@ export async function assertPerm(
|
|
|
52
51
|
if (!principal) {
|
|
53
52
|
throw new AuthorizationDeniedError('No authenticated principal')
|
|
54
53
|
}
|
|
55
|
-
const ok =
|
|
56
|
-
node: target,
|
|
57
|
-
perms: requiredBits,
|
|
58
|
-
})) as boolean
|
|
54
|
+
const ok = await kernel.auth.check({ who: principal, on: target, perms: requiredBits })
|
|
59
55
|
if (!ok) {
|
|
60
56
|
throw new AuthorizationDeniedError(
|
|
61
57
|
`Permission denied on "${target}" — required bits=${requiredBits} for principal "${principal}"`,
|
package/src/auth/index.ts
CHANGED
|
@@ -6,6 +6,8 @@ export { resolveInboundAuth, buildAuthContext, type ResolvedAuth } from './resol
|
|
|
6
6
|
export { verifyInboundCredential } from './verify'
|
|
7
7
|
export { buildComposedGrant } from './compose'
|
|
8
8
|
export { signCredential } from './sign'
|
|
9
|
+
export { makeIssuerMint } from './issuer-mint'
|
|
10
|
+
export type { DomainIssuer, MintIssuedParams } from './issuer-mint'
|
|
9
11
|
export { bindKernel, bindSelfKernel, makeSelfKernel } from './kernel-client'
|
|
10
12
|
export { AuthMissingError, AuthInvalidError } from './errors'
|
|
11
13
|
export { assertPerm, requireOwnership, READ, EDIT, USE, SHARE, ALL } from './check'
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `DomainIssuer` — the worker-side mint seam for identities THIS DOMAIN issues.
|
|
3
|
+
*
|
|
4
|
+
* A domain worker is a trusted issuer: the kernel resolves any `(iss, sub)`
|
|
5
|
+
* credential signed with the worker's key back to the graph node carrying that
|
|
6
|
+
* identity. That makes the worker the natural authority for the principals it
|
|
7
|
+
* materializes — an App identity a workspace installs, a per-domain role
|
|
8
|
+
* umbrella, a managed user. `mint` signs such a credential (optionally carrying
|
|
9
|
+
* a `grant` claim with an unresolved identity expression); `sessionFor` opens a
|
|
10
|
+
* kernel session presenting it, so the worker can ACT AS an identity it issues
|
|
11
|
+
* (e.g. call `@<role>::mintDelegationCredential` as the role to obtain a
|
|
12
|
+
* kernel-issued delegation inner).
|
|
13
|
+
*
|
|
14
|
+
* Scope guard: this signs under the WORKER'S OWN issuer only — it cannot forge
|
|
15
|
+
* another issuer's identities. The kernel still enforces everything downstream
|
|
16
|
+
* (trust of the issuer, `frozen`, grant resolution, nested-credential rules).
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import type { FnMap } from '@astrale-os/kernel-client'
|
|
20
|
+
import type { BoundClientSessionView } from '@astrale-os/kernel-client/session'
|
|
21
|
+
import type { UnresolvedIdentityExpr } from '@astrale-os/kernel-core'
|
|
22
|
+
|
|
23
|
+
import { createUnresolvedGrant } from '@astrale-os/kernel-core'
|
|
24
|
+
|
|
25
|
+
import type { RemoteIdentityConfig } from './identity'
|
|
26
|
+
|
|
27
|
+
import { bindCredentialSession } from './kernel-client'
|
|
28
|
+
import { signCredential } from './sign'
|
|
29
|
+
|
|
30
|
+
export type MintIssuedParams = {
|
|
31
|
+
/** The issued identity's `sub` — must match the graph node's stored subject. */
|
|
32
|
+
subject: string
|
|
33
|
+
/** The credential's audience — the kernel (or worker) it will be presented to. */
|
|
34
|
+
audience: string
|
|
35
|
+
/**
|
|
36
|
+
* Optional `grant` claim: the identity expression the credential's holder may
|
|
37
|
+
* act as (wrapped `{v:1, expr}`). Omit for a plain self-authenticating
|
|
38
|
+
* credential — the kernel falls back to a self-grant for externally-issued
|
|
39
|
+
* credentials. Nested `credential` leaves MUST be kernel-issued delegation
|
|
40
|
+
* inners (the kernel refuses non-kernel nested credentials).
|
|
41
|
+
*/
|
|
42
|
+
grant?: UnresolvedIdentityExpr
|
|
43
|
+
/** JWT lifetime, jose-style (`'60s'`, `'5m'`, `'1h'`). Default `'1h'`. */
|
|
44
|
+
ttl?: string
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export type DomainIssuer = {
|
|
48
|
+
/** The issuer (`iss`) this worker signs under — what issued identities store. */
|
|
49
|
+
readonly iss: string
|
|
50
|
+
/** Sign a credential AS an identity this domain issues. */
|
|
51
|
+
mint(params: MintIssuedParams): Promise<string>
|
|
52
|
+
/**
|
|
53
|
+
* A kernel session presenting a pre-signed credential (typically from
|
|
54
|
+
* {@link DomainIssuer.mint} with `audience = kernelUrl`). Direct calls only —
|
|
55
|
+
* no delegation mint is wired, so redirect-following to other workers is not
|
|
56
|
+
* available on this session.
|
|
57
|
+
*/
|
|
58
|
+
sessionFor(kernelUrl: string, credential: string): BoundClientSessionView<FnMap>
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Build the `DomainIssuer` for one worker identity config. */
|
|
62
|
+
export function makeIssuerMint(identity: RemoteIdentityConfig): DomainIssuer {
|
|
63
|
+
return {
|
|
64
|
+
iss: identity.issuer,
|
|
65
|
+
mint: ({ subject, audience, grant, ttl }) =>
|
|
66
|
+
signCredential(grant !== undefined ? { grant: createUnresolvedGrant(grant) } : {}, {
|
|
67
|
+
issuer: identity.issuer,
|
|
68
|
+
subject,
|
|
69
|
+
audience,
|
|
70
|
+
privateKey: identity.privateKey,
|
|
71
|
+
ttl: ttl ?? '1h',
|
|
72
|
+
}),
|
|
73
|
+
sessionFor: (kernelUrl, credential) => bindCredentialSession(kernelUrl, credential),
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -20,7 +20,12 @@ import type { UnresolvedIdentityExpr } from '@astrale-os/kernel-core'
|
|
|
20
20
|
|
|
21
21
|
import { KernelClient, SchemaRegistry, type FnMap } from '@astrale-os/kernel-client'
|
|
22
22
|
import { ClientPool } from '@astrale-os/kernel-client/pool'
|
|
23
|
-
import {
|
|
23
|
+
import {
|
|
24
|
+
ClientSession,
|
|
25
|
+
allowAllDelegations,
|
|
26
|
+
delegationMintVia,
|
|
27
|
+
type BoundClientSessionView,
|
|
28
|
+
} from '@astrale-os/kernel-client/session'
|
|
24
29
|
|
|
25
30
|
import type { RemoteIdentityConfig } from './identity'
|
|
26
31
|
|
|
@@ -29,11 +34,6 @@ import { signCredential } from './sign'
|
|
|
29
34
|
|
|
30
35
|
const DELEGATION_TTL_SECONDS = 3600
|
|
31
36
|
|
|
32
|
-
// The kernel's whoami — returns the AUTHENTICATED principal's graph node, so
|
|
33
|
-
// the resolved id satisfies the mint syscall's `self.id === auth.principal`
|
|
34
|
-
// invariant by construction (same seam the shell uses to resolve self).
|
|
35
|
-
const WHOAMI_PATH = '/:kernel.astrale.ai:interface.Identity:whoami'
|
|
36
|
-
|
|
37
37
|
// Shared per kernel URL — the expensive, identity-agnostic state. Sessions are
|
|
38
38
|
// NOT shared (each binds a subject-specific delegation mint), but the pool
|
|
39
39
|
// (connections) and registry (learned schemas) are reused across them.
|
|
@@ -63,8 +63,7 @@ function getPool(url: string): ClientPool<FnMap> {
|
|
|
63
63
|
/**
|
|
64
64
|
* Build a `BoundClientSessionView` that signs outbound calls as the composed
|
|
65
65
|
* identity (the caller's delegation unioned with this function's own
|
|
66
|
-
* identity). Remote-bound
|
|
67
|
-
* worker-scoped delegation via `@<subject>::mintDelegationCredential`.
|
|
66
|
+
* identity). Remote-bound redirects mint worker-scoped delegations via AuthApi.
|
|
68
67
|
*/
|
|
69
68
|
export async function bindKernel(
|
|
70
69
|
delegation: Delegation,
|
|
@@ -117,38 +116,37 @@ async function bindSession(
|
|
|
117
116
|
},
|
|
118
117
|
)
|
|
119
118
|
|
|
120
|
-
//
|
|
121
|
-
// cache miss while following a redirect, long after construction.
|
|
119
|
+
// The standard mint resolves the function identity through `auth.whoami()`.
|
|
122
120
|
const session: ClientSession<FnMap> = new ClientSession<FnMap>({
|
|
123
121
|
default: kernelUrl,
|
|
124
122
|
schema: getRegistry(kernelUrl),
|
|
125
123
|
pool: getPool(kernelUrl),
|
|
126
124
|
delegation: {
|
|
127
|
-
|
|
128
|
-
// identity NODE id (resolved via whoami — `@` only accepts node ids, not
|
|
129
|
-
// paths), so `self.id === auth.principal` holds by construction. The
|
|
130
|
-
// minted delegation carries the session's authority expression (composed
|
|
131
|
-
// for delegated sessions, self-only for selfKernel): the next worker
|
|
132
|
-
// sees WHO called it while inheriting exactly that authority.
|
|
133
|
-
// `skipDelegation` keeps the whoami + mint from re-entering this
|
|
134
|
-
// closure — both target the kernel (same origin), so no delegation is
|
|
135
|
-
// needed.
|
|
136
|
-
mint: async (audience) => {
|
|
137
|
-
const selfId = await resolveSelfId(session, credential, kernelUrl, config)
|
|
138
|
-
const envelope = await session.call(
|
|
139
|
-
`@${selfId}::mintDelegationCredential`,
|
|
140
|
-
{ audience, delegation: nextHopDelegation(), ttl: DELEGATION_TTL_SECONDS },
|
|
141
|
-
{ credential, skipDelegation: true },
|
|
142
|
-
)
|
|
143
|
-
if (typeof envelope !== 'string') {
|
|
144
|
-
throw new Error(
|
|
145
|
-
`mintDelegationCredential returned ${typeof envelope}, expected a credential string`,
|
|
146
|
-
)
|
|
147
|
-
}
|
|
148
|
-
return { credential: envelope, ttl: DELEGATION_TTL_SECONDS }
|
|
149
|
-
},
|
|
125
|
+
mint: delegationMintVia(() => session, credential),
|
|
150
126
|
ttl: DELEGATION_TTL_SECONDS,
|
|
151
127
|
},
|
|
128
|
+
delegationPolicy: {
|
|
129
|
+
...allowAllDelegations({ default: kernelUrl }),
|
|
130
|
+
delegationFor: () => nextHopDelegation(),
|
|
131
|
+
},
|
|
132
|
+
})
|
|
133
|
+
return session.as(credential)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Bind a session to a PRE-SIGNED credential — no delegation mint, no composed
|
|
138
|
+
* grant; the credential IS the authority. The seam behind
|
|
139
|
+
* `DomainIssuer.sessionFor` (a worker acting as an identity it issues). Pool +
|
|
140
|
+
* schema registry are the same per-URL caches the composed sessions use.
|
|
141
|
+
*/
|
|
142
|
+
export function bindCredentialSession(
|
|
143
|
+
kernelUrl: string,
|
|
144
|
+
credential: string,
|
|
145
|
+
): BoundClientSessionView<FnMap> {
|
|
146
|
+
const session = new ClientSession<FnMap>({
|
|
147
|
+
default: kernelUrl,
|
|
148
|
+
schema: getRegistry(kernelUrl),
|
|
149
|
+
pool: getPool(kernelUrl),
|
|
152
150
|
})
|
|
153
151
|
return session.as(credential)
|
|
154
152
|
}
|
|
@@ -178,33 +176,3 @@ export function makeSelfKernel(
|
|
|
178
176
|
return bindSelfKernel(url, identity)
|
|
179
177
|
}
|
|
180
178
|
}
|
|
181
|
-
|
|
182
|
-
// Function-identity node ids, cached per (kernel, issuer, subject). Sessions
|
|
183
|
-
// are per-request, but a function's identity node is stable for the worker's
|
|
184
|
-
// lifetime — one whoami per function, not one per redirect.
|
|
185
|
-
const selfIds = new Map<string, string>()
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* Resolve THIS function's identity node id on the parent kernel via whoami,
|
|
189
|
-
* authenticated with the composed credential (whose principal IS the function).
|
|
190
|
-
*/
|
|
191
|
-
async function resolveSelfId(
|
|
192
|
-
session: ClientSession<FnMap>,
|
|
193
|
-
credential: string,
|
|
194
|
-
kernelUrl: string,
|
|
195
|
-
config: RemoteIdentityConfig,
|
|
196
|
-
): Promise<string> {
|
|
197
|
-
const key = `${kernelUrl}|${config.issuer}|${config.subject}`
|
|
198
|
-
const cached = selfIds.get(key)
|
|
199
|
-
if (cached) return cached
|
|
200
|
-
const me = (await session.call(WHOAMI_PATH, {}, { credential, skipDelegation: true })) as {
|
|
201
|
-
id?: string
|
|
202
|
-
} | null
|
|
203
|
-
if (!me?.id) {
|
|
204
|
-
throw new Error(
|
|
205
|
-
`whoami returned no identity node for ${config.subject} — cannot anchor the next-hop delegation mint`,
|
|
206
|
-
)
|
|
207
|
-
}
|
|
208
|
-
selfIds.set(key, me.id)
|
|
209
|
-
return me.id
|
|
210
|
-
}
|
package/src/cli/dotenv.ts
CHANGED
|
@@ -43,3 +43,23 @@ export function loadDotenvFile(path: string): Record<string, string> {
|
|
|
43
43
|
}
|
|
44
44
|
return parseDotenv(contents)
|
|
45
45
|
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Read + parse a dotenv file the preset explicitly DECLARED (`secrets:`).
|
|
49
|
+
* Declared-but-absent is a wiring error (the gitignored file was never created
|
|
50
|
+
* on this machine), so it throws instead of loading `{}` — silently forwarding
|
|
51
|
+
* nothing surfaces much later as an empty credential at the provider. A file
|
|
52
|
+
* that exists but holds no keys is legitimate (a domain with no secrets yet).
|
|
53
|
+
*/
|
|
54
|
+
export function loadDeclaredSecrets(path: string, declaration: string): Record<string, string> {
|
|
55
|
+
let contents: string
|
|
56
|
+
try {
|
|
57
|
+
contents = readFileSync(path, 'utf-8')
|
|
58
|
+
} catch {
|
|
59
|
+
throw new Error(
|
|
60
|
+
`Secrets file '${declaration}' is declared in the preset but missing at ${path}. ` +
|
|
61
|
+
`Create it (it may be empty) or remove 'secrets:' from the preset.`,
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
return parseDotenv(contents)
|
|
65
|
+
}
|
package/src/cli/index.ts
CHANGED
package/src/cli/log.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** CLI output helpers + ANSI colours, shared by run.ts and publish.ts. */
|
|
2
|
+
|
|
3
|
+
export const GREEN = '\x1b[32m'
|
|
4
|
+
export const DIM = '\x1b[2m'
|
|
5
|
+
export const BOLD = '\x1b[1m'
|
|
6
|
+
export const YELLOW = '\x1b[33m'
|
|
7
|
+
export const RED = '\x1b[31m'
|
|
8
|
+
export const RESET = '\x1b[0m'
|
|
9
|
+
|
|
10
|
+
export function info(msg: string): void {
|
|
11
|
+
process.stdout.write(`${DIM}›${RESET} ${msg}\n`)
|
|
12
|
+
}
|
|
13
|
+
export function warn(msg: string): void {
|
|
14
|
+
process.stderr.write(`${YELLOW}!${RESET} ${msg}\n`)
|
|
15
|
+
}
|
|
16
|
+
export function error(msg: string): void {
|
|
17
|
+
process.stderr.write(`${RED}✗${RESET} ${msg}\n`)
|
|
18
|
+
}
|