@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
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** CLI output helpers + ANSI colours, shared by run.ts and publish.ts. */
|
|
2
|
+
export declare const GREEN = "\u001B[32m";
|
|
3
|
+
export declare const DIM = "\u001B[2m";
|
|
4
|
+
export declare const BOLD = "\u001B[1m";
|
|
5
|
+
export declare const YELLOW = "\u001B[33m";
|
|
6
|
+
export declare const RED = "\u001B[31m";
|
|
7
|
+
export declare const RESET = "\u001B[0m";
|
|
8
|
+
export declare function info(msg: string): void;
|
|
9
|
+
export declare function warn(msg: string): void;
|
|
10
|
+
export declare function error(msg: string): void;
|
|
11
|
+
//# sourceMappingURL=log.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../src/cli/log.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAE1E,eAAO,MAAM,KAAK,eAAa,CAAA;AAC/B,eAAO,MAAM,GAAG,cAAY,CAAA;AAC5B,eAAO,MAAM,IAAI,cAAY,CAAA;AAC7B,eAAO,MAAM,MAAM,eAAa,CAAA;AAChC,eAAO,MAAM,GAAG,eAAa,CAAA;AAC7B,eAAO,MAAM,KAAK,cAAY,CAAA;AAE9B,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEtC;AACD,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEtC;AACD,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEvC"}
|
package/dist/cli/log.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** CLI output helpers + ANSI colours, shared by run.ts and publish.ts. */
|
|
2
|
+
export const GREEN = '\x1b[32m';
|
|
3
|
+
export const DIM = '\x1b[2m';
|
|
4
|
+
export const BOLD = '\x1b[1m';
|
|
5
|
+
export const YELLOW = '\x1b[33m';
|
|
6
|
+
export const RED = '\x1b[31m';
|
|
7
|
+
export const RESET = '\x1b[0m';
|
|
8
|
+
export function info(msg) {
|
|
9
|
+
process.stdout.write(`${DIM}›${RESET} ${msg}\n`);
|
|
10
|
+
}
|
|
11
|
+
export function warn(msg) {
|
|
12
|
+
process.stderr.write(`${YELLOW}!${RESET} ${msg}\n`);
|
|
13
|
+
}
|
|
14
|
+
export function error(msg) {
|
|
15
|
+
process.stderr.write(`${RED}✗${RESET} ${msg}\n`);
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=log.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../src/cli/log.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAE1E,MAAM,CAAC,MAAM,KAAK,GAAG,UAAU,CAAA;AAC/B,MAAM,CAAC,MAAM,GAAG,GAAG,SAAS,CAAA;AAC5B,MAAM,CAAC,MAAM,IAAI,GAAG,SAAS,CAAA;AAC7B,MAAM,CAAC,MAAM,MAAM,GAAG,UAAU,CAAA;AAChC,MAAM,CAAC,MAAM,GAAG,GAAG,UAAU,CAAA;AAC7B,MAAM,CAAC,MAAM,KAAK,GAAG,SAAS,CAAA;AAE9B,MAAM,UAAU,IAAI,CAAC,GAAW;IAC9B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,GAAG,IAAI,KAAK,IAAI,GAAG,IAAI,CAAC,CAAA;AAClD,CAAC;AACD,MAAM,UAAU,IAAI,CAAC,GAAW;IAC9B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,IAAI,KAAK,IAAI,GAAG,IAAI,CAAC,CAAA;AACrD,CAAC;AACD,MAAM,UAAU,KAAK,CAAC,GAAW;IAC/B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,GAAG,IAAI,KAAK,IAAI,GAAG,IAAI,CAAC,CAAA;AAClD,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** `publish` (no deploy): publish the schema, then register the deployed URL. */
|
|
2
|
+
export declare function runRelease(opts: {
|
|
3
|
+
projectDir: string;
|
|
4
|
+
origin: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
publicUrl?: string;
|
|
7
|
+
skipSchema: boolean;
|
|
8
|
+
dryRun: boolean;
|
|
9
|
+
otp?: string;
|
|
10
|
+
installByDefault?: boolean;
|
|
11
|
+
}): Promise<number>;
|
|
12
|
+
/** The `deploy --publish` tail: publish the schema, then register the just-deployed URL. */
|
|
13
|
+
export declare function runReleaseAfterDeploy(opts: {
|
|
14
|
+
projectDir: string;
|
|
15
|
+
origin: string;
|
|
16
|
+
deployedUrl: string;
|
|
17
|
+
name?: string;
|
|
18
|
+
skipSchema: boolean;
|
|
19
|
+
otp?: string;
|
|
20
|
+
installByDefault?: boolean;
|
|
21
|
+
}): Promise<number>;
|
|
22
|
+
/**
|
|
23
|
+
* Build a domain's thin schema package and publish it to npm. Operates on the
|
|
24
|
+
* schema PACKAGE (its own package.json), not astrale.config.ts, so it needs no
|
|
25
|
+
* adapter — `publish --schema` runs it config-free.
|
|
26
|
+
*/
|
|
27
|
+
export declare function publishSchema(args: {
|
|
28
|
+
projectDir: string;
|
|
29
|
+
/** Schema-package dir. Default: `<projectDir>/schema`, else `<projectDir>`. */
|
|
30
|
+
schemaDir?: string;
|
|
31
|
+
dryRun: boolean;
|
|
32
|
+
/** 2FA one-time password forwarded to `npm publish`. */
|
|
33
|
+
otp?: string;
|
|
34
|
+
}): Promise<number>;
|
|
35
|
+
//# sourceMappingURL=publish.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../../src/cli/publish.ts"],"names":[],"mappings":"AAoCA,iFAAiF;AACjF,wBAAsB,UAAU,CAAC,IAAI,EAAE;IACrC,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,OAAO,CAAA;IACnB,MAAM,EAAE,OAAO,CAAA;IACf,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC3B,GAAG,OAAO,CAAC,MAAM,CAAC,CAWlB;AAED,4FAA4F;AAC5F,wBAAsB,qBAAqB,CAAC,IAAI,EAAE;IAChD,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,OAAO,CAAA;IACnB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC3B,GAAG,OAAO,CAAC,MAAM,CAAC,CAIlB;AAwFD;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE;IACxC,UAAU,EAAE,MAAM,CAAA;IAClB,+EAA+E;IAC/E,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,OAAO,CAAA;IACf,wDAAwD;IACxD,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,GAAG,OAAO,CAAC,MAAM,CAAC,CAwFlB"}
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* All `publish` logic — the schema-publish step, the admin-catalog register, and
|
|
3
|
+
* the release orchestration tying them together. `run.ts` only parses args and
|
|
4
|
+
* dispatches here.
|
|
5
|
+
*
|
|
6
|
+
* A release has two halves that must stay in sync: the CONTRACT (the `./schema`
|
|
7
|
+
* package on npm, so other domains can `imports`/`implements`/`extends` it) and
|
|
8
|
+
* the DEPLOYMENT (the worker URL in the admin catalog). They run npm-FIRST — npm
|
|
9
|
+
* publish is irreversible, so the catalog is registered only on schema-publish
|
|
10
|
+
* success, never pointing at an unpublished contract.
|
|
11
|
+
*
|
|
12
|
+
* Why `pnpm pack` then `npm publish <tarball>` (not a plain `npm publish`): a
|
|
13
|
+
* schema package ships only `dist` and uses `publishConfig` to repoint
|
|
14
|
+
* main/exports from source `.ts` to `dist` — a field override only PNPM applies,
|
|
15
|
+
* so npm would otherwise publish an entry pointing at unshipped source.
|
|
16
|
+
*/
|
|
17
|
+
import { spawn } from 'node:child_process';
|
|
18
|
+
import { existsSync, mkdtempSync, readdirSync, readFileSync, rmSync } from 'node:fs';
|
|
19
|
+
import { tmpdir } from 'node:os';
|
|
20
|
+
import { join } from 'node:path';
|
|
21
|
+
import { BOLD, DIM, error, GREEN, info, RESET, warn } from './log';
|
|
22
|
+
// ── release orchestration (schema THEN catalog) ──────────────────────────────
|
|
23
|
+
/** `publish` (no deploy): publish the schema, then register the deployed URL. */
|
|
24
|
+
export async function runRelease(opts) {
|
|
25
|
+
const schemaCode = await publishSchemaBeforeCatalog(opts.projectDir, opts);
|
|
26
|
+
if (schemaCode !== 0)
|
|
27
|
+
return schemaCode;
|
|
28
|
+
const url = opts.publicUrl ?? `https://${opts.origin}`;
|
|
29
|
+
if (opts.dryRun) {
|
|
30
|
+
info(`dry-run: would register ${opts.origin} → ${url} in the admin catalog (not registered).`);
|
|
31
|
+
return 0;
|
|
32
|
+
}
|
|
33
|
+
info(`registering ${opts.origin} → ${url} in the admin catalog (no deploy)`);
|
|
34
|
+
return await registerCatalog(opts.projectDir, opts, url);
|
|
35
|
+
}
|
|
36
|
+
/** The `deploy --publish` tail: publish the schema, then register the just-deployed URL. */
|
|
37
|
+
export async function runReleaseAfterDeploy(opts) {
|
|
38
|
+
const schemaCode = await publishSchemaBeforeCatalog(opts.projectDir, { ...opts, dryRun: false });
|
|
39
|
+
if (schemaCode !== 0)
|
|
40
|
+
return schemaCode;
|
|
41
|
+
return await registerCatalog(opts.projectDir, opts, opts.deployedUrl);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The schema half of a release. npm publish is irreversible, so it runs FIRST:
|
|
45
|
+
* returns 0 to proceed (published | skipped | no `./schema` package), non-zero to
|
|
46
|
+
* ABORT before the catalog touch — so the catalog never points at an unpublished
|
|
47
|
+
* contract.
|
|
48
|
+
*/
|
|
49
|
+
async function publishSchemaBeforeCatalog(projectDir, opts) {
|
|
50
|
+
if (opts.skipSchema)
|
|
51
|
+
return 0;
|
|
52
|
+
if (!existsSync(join(projectDir, 'schema', 'package.json'))) {
|
|
53
|
+
info('no ./schema package — registering the catalog only.');
|
|
54
|
+
return 0;
|
|
55
|
+
}
|
|
56
|
+
const code = await publishSchema({
|
|
57
|
+
projectDir,
|
|
58
|
+
schemaDir: 'schema',
|
|
59
|
+
dryRun: opts.dryRun,
|
|
60
|
+
...(opts.otp !== undefined ? { otp: opts.otp } : {}),
|
|
61
|
+
});
|
|
62
|
+
if (code !== 0)
|
|
63
|
+
error('schema publish failed — NOT registering the catalog (a catalog entry must never point ' +
|
|
64
|
+
'at an unpublished contract). Fix the schema package and re-run, or pass --skip-schema.');
|
|
65
|
+
return code;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Register a domain's public URL in the admin catalog by shelling out to the
|
|
69
|
+
* operator CLI (`astrale domain publish`). Deliberately a subprocess: all
|
|
70
|
+
* credential/admin-target resolution lives in `@astrale-os/cli`, kept out of
|
|
71
|
+
* this build tool. A missing `astrale` is reported with the exact line to run by
|
|
72
|
+
* hand. The catalog `name` is a short slug (the origin's first label by default),
|
|
73
|
+
* distinct from the FQDN origin and from any `@scope/…` npm package name.
|
|
74
|
+
*/
|
|
75
|
+
async function registerCatalog(projectDir, opts, url) {
|
|
76
|
+
const { description } = readPackageMeta(projectDir);
|
|
77
|
+
const name = opts.name ?? opts.origin.split('.')[0] ?? opts.origin;
|
|
78
|
+
// `--public-url`, not `--url`: the operator CLI reserves `--url` for kernel targeting.
|
|
79
|
+
const cliArgs = [
|
|
80
|
+
'domain',
|
|
81
|
+
'publish',
|
|
82
|
+
'--origin',
|
|
83
|
+
opts.origin,
|
|
84
|
+
'--name',
|
|
85
|
+
name,
|
|
86
|
+
'--public-url',
|
|
87
|
+
url,
|
|
88
|
+
];
|
|
89
|
+
if (description)
|
|
90
|
+
cliArgs.push('--description', description);
|
|
91
|
+
if (opts.installByDefault)
|
|
92
|
+
cliArgs.push('--install-by-default');
|
|
93
|
+
info(`publishing to the admin catalog → astrale ${cliArgs.join(' ')}`);
|
|
94
|
+
return await new Promise((resolve) => {
|
|
95
|
+
const child = spawn('astrale', cliArgs, { stdio: 'inherit' });
|
|
96
|
+
child.on('error', (err) => {
|
|
97
|
+
if (err.code === 'ENOENT')
|
|
98
|
+
error(`\`astrale\` CLI not found on PATH. Register it by hand:\n astrale ${cliArgs.join(' ')}`);
|
|
99
|
+
else
|
|
100
|
+
error(`failed to run \`astrale domain publish\`: ${err.message}`);
|
|
101
|
+
resolve(1);
|
|
102
|
+
});
|
|
103
|
+
child.on('exit', (code) => resolve(code ?? 1));
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
function readPackageMeta(projectDir) {
|
|
107
|
+
try {
|
|
108
|
+
return JSON.parse(readFileSync(join(projectDir, 'package.json'), 'utf8'));
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
return {};
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
// ── schema publish ───────────────────────────────────────────────────────────
|
|
115
|
+
/**
|
|
116
|
+
* Build a domain's thin schema package and publish it to npm. Operates on the
|
|
117
|
+
* schema PACKAGE (its own package.json), not astrale.config.ts, so it needs no
|
|
118
|
+
* adapter — `publish --schema` runs it config-free.
|
|
119
|
+
*/
|
|
120
|
+
export async function publishSchema(args) {
|
|
121
|
+
const dir = resolveSchemaDir(args.projectDir, args.schemaDir);
|
|
122
|
+
if (!dir) {
|
|
123
|
+
error(`No schema package found (no package.json at ./schema or the current dir). A schema\n` +
|
|
124
|
+
` package declares peerDependencies (@astrale-os/kernel-core + kernel-dsl + zod) and a\n` +
|
|
125
|
+
` publishConfig that repoints main/exports to ./dist — see domains/workspace/schema.`);
|
|
126
|
+
return 1;
|
|
127
|
+
}
|
|
128
|
+
const pkgPath = join(dir, 'package.json');
|
|
129
|
+
let pkg;
|
|
130
|
+
try {
|
|
131
|
+
pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
|
|
132
|
+
}
|
|
133
|
+
catch (err) {
|
|
134
|
+
error(`Could not read ${pkgPath}: ${err.message}`);
|
|
135
|
+
return 1;
|
|
136
|
+
}
|
|
137
|
+
const problems = preflight(pkg);
|
|
138
|
+
if (problems.length > 0) {
|
|
139
|
+
error(`Schema package is not ready to publish (${pkgPath}):`);
|
|
140
|
+
for (const p of problems)
|
|
141
|
+
process.stderr.write(` • ${p}\n`);
|
|
142
|
+
return 1;
|
|
143
|
+
}
|
|
144
|
+
const name = pkg.name;
|
|
145
|
+
const version = pkg.version;
|
|
146
|
+
// Idempotent in BOTH modes: a dry-run must skip too, since `npm publish
|
|
147
|
+
// --dry-run` still validates against the registry and errors on an existing version.
|
|
148
|
+
if (await isOnRegistry(name, version)) {
|
|
149
|
+
info(`${BOLD}${name}@${version}${RESET} is already published — ` +
|
|
150
|
+
(args.dryRun ? `a real run would skip it.` : `bump the version to ship again.`));
|
|
151
|
+
return 0;
|
|
152
|
+
}
|
|
153
|
+
const dest = mkdtempSync(join(tmpdir(), 'astrale-schema-pack-'));
|
|
154
|
+
try {
|
|
155
|
+
info(`packing ${BOLD}${name}@${version}${RESET} from ${rel(args.projectDir, dir)}`);
|
|
156
|
+
if ((await runInherit('pnpm', ['pack', '--pack-destination', dest], dir)) !== 0) {
|
|
157
|
+
error(`pnpm pack failed — see the build output above.`);
|
|
158
|
+
return 1;
|
|
159
|
+
}
|
|
160
|
+
const tarball = readdirSync(dest)
|
|
161
|
+
.filter((f) => f.endsWith('.tgz'))
|
|
162
|
+
.map((f) => join(dest, f))[0];
|
|
163
|
+
if (!tarball) {
|
|
164
|
+
error(`pnpm pack produced no .tgz in ${dest}.`);
|
|
165
|
+
return 1;
|
|
166
|
+
}
|
|
167
|
+
// `--access` mirrors the manifest's baked publishConfig.access; npm's 2FA
|
|
168
|
+
// prompt passes through `stdio: 'inherit'` (or `--otp` for non-interactive).
|
|
169
|
+
const access = pkg.publishConfig?.access ?? 'public';
|
|
170
|
+
const publishArgs = [
|
|
171
|
+
'publish',
|
|
172
|
+
tarball,
|
|
173
|
+
'--access',
|
|
174
|
+
access,
|
|
175
|
+
...(args.dryRun ? ['--dry-run'] : []),
|
|
176
|
+
...(args.otp ? ['--otp', args.otp] : []),
|
|
177
|
+
];
|
|
178
|
+
info(args.dryRun
|
|
179
|
+
? `dry-run: ${DIM}npm ${publishArgs.join(' ')}${RESET}`
|
|
180
|
+
: `publishing ${DIM}(a browser / OTP prompt may appear for 2FA)${RESET}`);
|
|
181
|
+
const code = await runInherit('npm', publishArgs);
|
|
182
|
+
if (code !== 0) {
|
|
183
|
+
error(`npm publish exited ${code}. An auth error (E401/E404) usually means the session ` +
|
|
184
|
+
`expired — \`npm login\` and retry.`);
|
|
185
|
+
return code;
|
|
186
|
+
}
|
|
187
|
+
if (args.dryRun)
|
|
188
|
+
info(`dry-run complete — nothing was published.`);
|
|
189
|
+
else
|
|
190
|
+
printPublished(name, version);
|
|
191
|
+
return 0;
|
|
192
|
+
}
|
|
193
|
+
finally {
|
|
194
|
+
try {
|
|
195
|
+
rmSync(dest, { recursive: true, force: true });
|
|
196
|
+
}
|
|
197
|
+
catch {
|
|
198
|
+
warn(`(non-fatal) could not clean the temp pack dir ${dest}`);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
/** Locate the schema package: an explicit path, else `<projectDir>/schema`, else `<projectDir>`. */
|
|
203
|
+
function resolveSchemaDir(projectDir, explicit) {
|
|
204
|
+
const candidates = explicit
|
|
205
|
+
? [join(projectDir, explicit)]
|
|
206
|
+
: [join(projectDir, 'schema'), projectDir];
|
|
207
|
+
return candidates.find((c) => existsSync(join(c, 'package.json')));
|
|
208
|
+
}
|
|
209
|
+
/** Static guards against the classic schema-publish footguns, before any network call. */
|
|
210
|
+
function preflight(pkg) {
|
|
211
|
+
const problems = [];
|
|
212
|
+
if (!pkg.name)
|
|
213
|
+
problems.push('package.json has no "name".');
|
|
214
|
+
if (!pkg.version)
|
|
215
|
+
problems.push('package.json has no "version".');
|
|
216
|
+
else if (!/^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/.test(pkg.version))
|
|
217
|
+
problems.push(`"version" ("${pkg.version}") must be an exact semver, not a range.`);
|
|
218
|
+
if (pkg.private)
|
|
219
|
+
problems.push('"private": true — remove it to publish.');
|
|
220
|
+
// Peers, not deps: bundling kernel-core/dsl/zod gives the consumer a 2nd copy
|
|
221
|
+
// and breaks the def `__brand` identity at compile time.
|
|
222
|
+
if (!pkg.peerDependencies || Object.keys(pkg.peerDependencies).length === 0)
|
|
223
|
+
problems.push('no "peerDependencies" — peer-depend on @astrale-os/kernel-core (+ kernel-dsl, zod).');
|
|
224
|
+
if (!pkg.files?.includes('dist'))
|
|
225
|
+
problems.push('"files" must include "dist" (ship only the built output).');
|
|
226
|
+
if (!pkg.publishConfig)
|
|
227
|
+
problems.push('no "publishConfig" — main/types/exports won\'t repoint to ./dist at pack time.');
|
|
228
|
+
for (const field of ['dependencies', 'peerDependencies', 'optionalDependencies']) {
|
|
229
|
+
for (const [dep, spec] of Object.entries(pkg[field] ?? {})) {
|
|
230
|
+
if (/^(link:|file:|workspace:)/.test(spec))
|
|
231
|
+
problems.push(`${field}["${dep}"] is "${spec}" — npm can't publish that; use a semver range.`);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
return problems;
|
|
235
|
+
}
|
|
236
|
+
/** True if `<name>@<version>` already exists on the registry. */
|
|
237
|
+
async function isOnRegistry(name, version) {
|
|
238
|
+
return await new Promise((resolve) => {
|
|
239
|
+
let out = '';
|
|
240
|
+
const child = spawn('npm', ['view', `${name}@${version}`, 'version'], {
|
|
241
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
242
|
+
});
|
|
243
|
+
child.stdout?.on('data', (d) => (out += String(d)));
|
|
244
|
+
child.on('error', () => resolve(false)); // npm missing / not-found / offline → let publish surface it
|
|
245
|
+
child.on('exit', () => resolve(out.trim().length > 0));
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
async function runInherit(cmd, cmdArgs, cwd) {
|
|
249
|
+
return await new Promise((resolve) => {
|
|
250
|
+
const child = spawn(cmd, cmdArgs, { stdio: 'inherit', ...(cwd ? { cwd } : {}) });
|
|
251
|
+
child.on('error', (err) => {
|
|
252
|
+
const c = err.code;
|
|
253
|
+
error(c === 'ENOENT'
|
|
254
|
+
? `\`${cmd}\` not found on PATH.`
|
|
255
|
+
: `failed to run \`${cmd}\`: ${err.message}`);
|
|
256
|
+
resolve(1);
|
|
257
|
+
});
|
|
258
|
+
child.on('exit', (code) => resolve(code ?? 1));
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
function printPublished(name, version) {
|
|
262
|
+
process.stdout.write(`\n${GREEN}✓${RESET} published ${BOLD}${name}@${version}${RESET}\n` +
|
|
263
|
+
` ${DIM}consume it:${RESET} ${BOLD}import { schema as S } from '${name}'${RESET}` +
|
|
264
|
+
`${DIM} → imports: [S], implements: [S.interfaces.X]${RESET}\n` +
|
|
265
|
+
` ${DIM}and add ${BOLD}requires: ['<this-origin>']${RESET}${DIM} on the consumer ` +
|
|
266
|
+
`(producer installs first).${RESET}\n\n`);
|
|
267
|
+
}
|
|
268
|
+
function rel(from, to) {
|
|
269
|
+
return to.startsWith(from) ? `.${to.slice(from.length) || '/'}` : to;
|
|
270
|
+
}
|
|
271
|
+
//# sourceMappingURL=publish.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publish.js","sourceRoot":"","sources":["../../src/cli/publish.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AACpF,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAalE,gFAAgF;AAEhF,iFAAiF;AACjF,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,IAShC;IACC,MAAM,UAAU,GAAG,MAAM,0BAA0B,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA;IAC1E,IAAI,UAAU,KAAK,CAAC;QAAE,OAAO,UAAU,CAAA;IAEvC,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,IAAI,WAAW,IAAI,CAAC,MAAM,EAAE,CAAA;IACtD,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;QAChB,IAAI,CAAC,2BAA2B,IAAI,CAAC,MAAM,MAAM,GAAG,yCAAyC,CAAC,CAAA;QAC9F,OAAO,CAAC,CAAA;IACV,CAAC;IACD,IAAI,CAAC,eAAe,IAAI,CAAC,MAA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AAE,EAAU;IACnC,OAAO,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;AACtE,CAAC"}
|
package/dist/cli/run.d.ts
CHANGED
|
@@ -18,7 +18,15 @@
|
|
|
18
18
|
* astrale-domain prod # = deploy prod
|
|
19
19
|
* astrale-domain deploy <env> # any env key
|
|
20
20
|
* astrale-domain build # rebuild spec only (placeholder URL)
|
|
21
|
-
* astrale-domain publish [env] #
|
|
21
|
+
* astrale-domain publish [env] # RELEASE: publish ./schema to npm (if any) + register the deployed URL
|
|
22
|
+
*
|
|
23
|
+
* A release has two halves that must stay in sync: the CONTRACT (`./schema` on
|
|
24
|
+
* npm) and the DEPLOYMENT (worker URL in the catalog). `publish` does both,
|
|
25
|
+
* npm-FIRST — `npm publish` is irreversible, so the catalog is registered only on
|
|
26
|
+
* schema-publish success, never pointing at an unpublished contract. The schema
|
|
27
|
+
* publish is idempotent (skips an unbumped version). Scope it with `--schema`
|
|
28
|
+
* (contract only — config-free) or `--skip-schema` (catalog only). All publish
|
|
29
|
+
* logic lives in `./publish.ts`; this file only parses args and dispatches.
|
|
22
30
|
*
|
|
23
31
|
* `publish` registers a domain's ALREADY-deployed URL in the admin catalog by
|
|
24
32
|
* SHELLING OUT to the operator CLI (`astrale domain publish --origin --name
|
|
@@ -35,6 +43,14 @@ type ParsedArgs = {
|
|
|
35
43
|
command: 'dev' | 'build' | 'deploy' | 'publish';
|
|
36
44
|
env: string;
|
|
37
45
|
watch: boolean;
|
|
46
|
+
/** `--dry-run` (publish) — pack + `npm publish --dry-run` and skip the catalog register. */
|
|
47
|
+
dryRun?: boolean;
|
|
48
|
+
/** `--schema` (publish) — publish ONLY the `./schema` package; no catalog, no config. */
|
|
49
|
+
schemaOnly?: boolean;
|
|
50
|
+
/** `--otp <code>` (publish / deploy --publish) — 2FA OTP forwarded to `npm publish`. */
|
|
51
|
+
otp?: string;
|
|
52
|
+
/** `--skip-schema` (publish / deploy --publish) — register the catalog only; don't publish `./schema`. */
|
|
53
|
+
skipSchema?: boolean;
|
|
38
54
|
/** `--port <n>` (dev only) — overrides the env's local dev port. */
|
|
39
55
|
port?: number;
|
|
40
56
|
/** `--host <url>` (dev only) — public URL of a tunnel/proxy front: binds 0.0.0.0 + pins WORKER_URL. */
|
package/dist/cli/run.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/cli/run.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/cli/run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AASH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AASpD,KAAK,UAAU,GAAG;IAChB,OAAO,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAA;IAC/C,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,OAAO,CAAA;IACd,4FAA4F;IAC5F,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,yFAAyF;IACzF,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,wFAAwF;IACxF,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,0GAA0G;IAC1G,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,oEAAoE;IACpE,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,uGAAuG;IACvG,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,wGAAwG;IACxG,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,+GAA+G;IAC/G,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,4FAA4F;IAC5F,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,6GAA6G;IAC7G,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