run402 1.48.0 → 1.50.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/core-dist/config.js +10 -0
- package/core-dist/wallet-auth.js +62 -0
- package/core-dist/wallet.js +25 -0
- package/lib/deploy-v2.mjs +359 -0
- package/lib/deploy.mjs +14 -0
- package/lib/functions.mjs +16 -1
- package/package.json +1 -1
- package/sdk/core-dist/config.js +10 -0
- package/sdk/core-dist/wallet-auth.js +62 -0
- package/sdk/core-dist/wallet.js +25 -0
- package/sdk/dist/errors.d.ts +41 -0
- package/sdk/dist/errors.d.ts.map +1 -1
- package/sdk/dist/errors.js +23 -0
- package/sdk/dist/errors.js.map +1 -1
- package/sdk/dist/index.d.ts +24 -1
- package/sdk/dist/index.d.ts.map +1 -1
- package/sdk/dist/index.js +24 -1
- package/sdk/dist/index.js.map +1 -1
- package/sdk/dist/namespaces/apps.d.ts +14 -0
- package/sdk/dist/namespaces/apps.d.ts.map +1 -1
- package/sdk/dist/namespaces/apps.js +162 -19
- package/sdk/dist/namespaces/apps.js.map +1 -1
- package/sdk/dist/namespaces/deploy.d.ts +116 -0
- package/sdk/dist/namespaces/deploy.d.ts.map +1 -0
- package/sdk/dist/namespaces/deploy.js +1127 -0
- package/sdk/dist/namespaces/deploy.js.map +1 -0
- package/sdk/dist/namespaces/deploy.types.d.ts +430 -0
- package/sdk/dist/namespaces/deploy.types.d.ts.map +1 -0
- package/sdk/dist/namespaces/deploy.types.js +11 -0
- package/sdk/dist/namespaces/deploy.types.js.map +1 -0
- package/sdk/dist/namespaces/functions.d.ts +11 -3
- package/sdk/dist/namespaces/functions.d.ts.map +1 -1
- package/sdk/dist/namespaces/functions.js +11 -3
- package/sdk/dist/namespaces/functions.js.map +1 -1
- package/sdk/dist/namespaces/functions.types.d.ts +21 -4
- package/sdk/dist/namespaces/functions.types.d.ts.map +1 -1
- package/sdk/dist/node/canonicalize.d.ts +12 -5
- package/sdk/dist/node/canonicalize.d.ts.map +1 -1
- package/sdk/dist/node/canonicalize.js +12 -5
- package/sdk/dist/node/canonicalize.js.map +1 -1
- package/sdk/dist/node/files.d.ts +38 -0
- package/sdk/dist/node/files.d.ts.map +1 -0
- package/sdk/dist/node/files.js +88 -0
- package/sdk/dist/node/files.js.map +1 -0
- package/sdk/dist/node/index.d.ts +5 -3
- package/sdk/dist/node/index.d.ts.map +1 -1
- package/sdk/dist/node/index.js +2 -1
- package/sdk/dist/node/index.js.map +1 -1
- package/sdk/dist/node/sites-node.d.ts +34 -107
- package/sdk/dist/node/sites-node.d.ts.map +1 -1
- package/sdk/dist/node/sites-node.js +84 -353
- package/sdk/dist/node/sites-node.js.map +1 -1
|
@@ -15,10 +15,18 @@ export interface FunctionDeployOptions {
|
|
|
15
15
|
code: string;
|
|
16
16
|
config?: FunctionConfig;
|
|
17
17
|
/**
|
|
18
|
-
* Additional npm packages to bundle with the function.
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
18
|
+
* Additional npm packages to bundle with the function. Each entry is an
|
|
19
|
+
* npm spec: a bare name (`"lodash"`) resolves to latest at deploy time;
|
|
20
|
+
* a pinned spec (`"lodash@4.17.21"`) uses that exact version; a range
|
|
21
|
+
* (`"date-fns@^3.0.0"`) is resolved by npm at deploy time.
|
|
22
|
+
*
|
|
23
|
+
* `@run402/functions` is auto-bundled and `run402-functions` is the
|
|
24
|
+
* deprecated package name — both are rejected with HTTP 400. Native
|
|
25
|
+
* binary modules (e.g. `sharp`, `canvas`) are rejected at install time.
|
|
26
|
+
* Limits: max 30 entries, max 200 chars per spec.
|
|
27
|
+
*
|
|
28
|
+
* The actually-installed concrete versions land in
|
|
29
|
+
* {@link FunctionDeployResult.deps_resolved}.
|
|
22
30
|
*/
|
|
23
31
|
deps?: string[];
|
|
24
32
|
/** Cron schedule (5-field). Omit to deploy without a schedule. */
|
|
@@ -51,6 +59,15 @@ export interface FunctionDeployResult {
|
|
|
51
59
|
* dependency versions," not a lockfile.
|
|
52
60
|
*/
|
|
53
61
|
deps_resolved?: Record<string, string> | null;
|
|
62
|
+
/**
|
|
63
|
+
* Non-fatal warnings surfaced during the deploy (e.g. bundle size
|
|
64
|
+
* exceeded the 10 MB recommended threshold but stayed under the 25 MB
|
|
65
|
+
* hard limit; esbuild emitted a warning about a non-literal dynamic
|
|
66
|
+
* import). Sibling to the function record at the top level of the
|
|
67
|
+
* response, NOT inside it. Omitted (or `[]`) when there are no
|
|
68
|
+
* warnings.
|
|
69
|
+
*/
|
|
70
|
+
warnings?: string[];
|
|
54
71
|
}
|
|
55
72
|
export interface FunctionInvokeOptions {
|
|
56
73
|
/** HTTP method. Default `POST`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.types.d.ts","sourceRoot":"","sources":["../../src/namespaces/functions.types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,cAAc;IAC7B,6CAA6C;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uCAAuC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,qBAAqB;IACpC,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAC;IACb,qGAAqG;IACrG,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB
|
|
1
|
+
{"version":3,"file":"functions.types.d.ts","sourceRoot":"","sources":["../../src/namespaces/functions.types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,cAAc;IAC7B,6CAA6C;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uCAAuC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,qBAAqB;IACpC,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAC;IACb,qGAAqG;IACrG,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB;;;;;;;;;;;;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,IAAI,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC9C,UAAU,EAAE,MAAM,CAAC;IACnB,6CAA6C;IAC7C,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,2CAA2C;IAC3C,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;CAC/C"}
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* RFC 8785 (JCS) canonical JSON
|
|
2
|
+
* RFC 8785 (JCS) canonical JSON utility — kept as a UX / diagnostic helper.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* `
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* **As of v1.34, the gateway is authoritative for the deploy manifest
|
|
5
|
+
* digest.** `POST /deploy/v2/plans` returns the gateway-computed digest in
|
|
6
|
+
* the response, and operation idempotency keys on it (combined with
|
|
7
|
+
* `project_id`, `base_release_id`, and an optional client idempotency key).
|
|
8
|
+
* A drift between this implementation and the gateway's canonicalize
|
|
9
|
+
* therefore SHALL NOT silently break idempotency — retries still find the
|
|
10
|
+
* existing plan because the lookup uses the gateway-computed value.
|
|
11
|
+
*
|
|
12
|
+
* This module remains exported so callers can still produce a stable local
|
|
13
|
+
* digest for caching or debugging output. New code should treat the local
|
|
14
|
+
* digest as advisory.
|
|
8
15
|
*
|
|
9
16
|
* Spec for our value domain:
|
|
10
17
|
* - object keys sorted ASCII-ascending
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canonicalize.d.ts","sourceRoot":"","sources":["../../src/node/canonicalize.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"canonicalize.d.ts","sourceRoot":"","sources":["../../src/node/canonicalize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,aAAa,EAAE,CAAC;CACxB;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAavD;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,GACpF,QAAQ,CAUV;AAED;;;GAGG;AACH,wBAAsB,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAO/E"}
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* RFC 8785 (JCS) canonical JSON
|
|
2
|
+
* RFC 8785 (JCS) canonical JSON utility — kept as a UX / diagnostic helper.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* `
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* **As of v1.34, the gateway is authoritative for the deploy manifest
|
|
5
|
+
* digest.** `POST /deploy/v2/plans` returns the gateway-computed digest in
|
|
6
|
+
* the response, and operation idempotency keys on it (combined with
|
|
7
|
+
* `project_id`, `base_release_id`, and an optional client idempotency key).
|
|
8
|
+
* A drift between this implementation and the gateway's canonicalize
|
|
9
|
+
* therefore SHALL NOT silently break idempotency — retries still find the
|
|
10
|
+
* existing plan because the lookup uses the gateway-computed value.
|
|
11
|
+
*
|
|
12
|
+
* This module remains exported so callers can still produce a stable local
|
|
13
|
+
* digest for caching or debugging output. New code should treat the local
|
|
14
|
+
* digest as advisory.
|
|
8
15
|
*
|
|
9
16
|
* Spec for our value domain:
|
|
10
17
|
* - object keys sorted ASCII-ascending
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canonicalize.js","sourceRoot":"","sources":["../../src/node/canonicalize.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"canonicalize.js","sourceRoot":"","sources":["../../src/node/canonicalize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAaH,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,MAAM,CAAC;IAClC,IAAI,OAAO,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IAChE,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC5D,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC5D,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;IACnF,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,GAAG,GAAG,KAAgC,CAAC;QAC7C,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;QACrC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAClF,OAAO,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,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,EAAE,CAAC,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node-only filesystem byte-source helpers for `deploy.apply`.
|
|
3
|
+
*
|
|
4
|
+
* `fileSetFromDir(path)` walks a directory and emits a path-keyed `FileSet`
|
|
5
|
+
* of `FsFileSource` markers. The SDK normalizer reads each file's bytes
|
|
6
|
+
* lazily during the plan/upload phases — never loaded into memory at
|
|
7
|
+
* collection time. Suitable for multi-GB build outputs.
|
|
8
|
+
*/
|
|
9
|
+
import type { FileSet } from "../namespaces/deploy.types.js";
|
|
10
|
+
export interface FileSetFromDirOptions {
|
|
11
|
+
/** Additional names to skip at any depth. Merged with the default ignore
|
|
12
|
+
* list (`.git`, `node_modules`, `.DS_Store`). */
|
|
13
|
+
ignore?: Iterable<string>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Walk a directory and return a `FileSet` whose values are `FsFileSource`
|
|
17
|
+
* markers. Each marker holds an absolute path and an extension-derived
|
|
18
|
+
* content-type; the deploy normalizer hashes and uploads each file from
|
|
19
|
+
* disk on demand.
|
|
20
|
+
*
|
|
21
|
+
* Skips `.git`, `node_modules`, `.DS_Store` (plus any names in
|
|
22
|
+
* `opts.ignore`) at every depth. Rejects symlinks. Throws `LocalError` if
|
|
23
|
+
* the directory does not exist, is not a directory, or contains no
|
|
24
|
+
* deployable files after the ignore list is applied.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* import { run402 } from "@run402/sdk/node";
|
|
28
|
+
* import { fileSetFromDir } from "@run402/sdk/node";
|
|
29
|
+
* const r = run402();
|
|
30
|
+
* await r.deploy.apply({
|
|
31
|
+
* project,
|
|
32
|
+
* site: { replace: fileSetFromDir("./dist") },
|
|
33
|
+
* });
|
|
34
|
+
*/
|
|
35
|
+
export declare function fileSetFromDir(root: string, opts?: FileSetFromDirOptions): Promise<FileSet>;
|
|
36
|
+
/** Normalize a relative path to POSIX forward slashes. Exposed for tests. */
|
|
37
|
+
export declare function normalizeRelPath(rel: string): string;
|
|
38
|
+
//# sourceMappingURL=files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../src/node/files.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,KAAK,EAAE,OAAO,EAAgB,MAAM,+BAA+B,CAAC;AAK3E,MAAM,WAAW,qBAAqB;IACpC;sDACkD;IAClD,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE,qBAA0B,GAC/B,OAAO,CAAC,OAAO,CAAC,CAkClB;AAsCD,6EAA6E;AAC7E,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEpD"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node-only filesystem byte-source helpers for `deploy.apply`.
|
|
3
|
+
*
|
|
4
|
+
* `fileSetFromDir(path)` walks a directory and emits a path-keyed `FileSet`
|
|
5
|
+
* of `FsFileSource` markers. The SDK normalizer reads each file's bytes
|
|
6
|
+
* lazily during the plan/upload phases — never loaded into memory at
|
|
7
|
+
* collection time. Suitable for multi-GB build outputs.
|
|
8
|
+
*/
|
|
9
|
+
import { readdir, lstat } from "node:fs/promises";
|
|
10
|
+
import { join, relative, sep } from "node:path";
|
|
11
|
+
import { LocalError } from "../errors.js";
|
|
12
|
+
const DEFAULT_IGNORE = new Set([".git", "node_modules", ".DS_Store"]);
|
|
13
|
+
const CONTEXT = "collecting files for deploy";
|
|
14
|
+
/**
|
|
15
|
+
* Walk a directory and return a `FileSet` whose values are `FsFileSource`
|
|
16
|
+
* markers. Each marker holds an absolute path and an extension-derived
|
|
17
|
+
* content-type; the deploy normalizer hashes and uploads each file from
|
|
18
|
+
* disk on demand.
|
|
19
|
+
*
|
|
20
|
+
* Skips `.git`, `node_modules`, `.DS_Store` (plus any names in
|
|
21
|
+
* `opts.ignore`) at every depth. Rejects symlinks. Throws `LocalError` if
|
|
22
|
+
* the directory does not exist, is not a directory, or contains no
|
|
23
|
+
* deployable files after the ignore list is applied.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* import { run402 } from "@run402/sdk/node";
|
|
27
|
+
* import { fileSetFromDir } from "@run402/sdk/node";
|
|
28
|
+
* const r = run402();
|
|
29
|
+
* await r.deploy.apply({
|
|
30
|
+
* project,
|
|
31
|
+
* site: { replace: fileSetFromDir("./dist") },
|
|
32
|
+
* });
|
|
33
|
+
*/
|
|
34
|
+
export async function fileSetFromDir(root, opts = {}) {
|
|
35
|
+
const ignore = new Set(DEFAULT_IGNORE);
|
|
36
|
+
if (opts.ignore)
|
|
37
|
+
for (const name of opts.ignore)
|
|
38
|
+
ignore.add(name);
|
|
39
|
+
let rootStat;
|
|
40
|
+
try {
|
|
41
|
+
rootStat = await lstat(root);
|
|
42
|
+
}
|
|
43
|
+
catch (err) {
|
|
44
|
+
throw new LocalError(`cannot read directory ${root}: ${err.message}`, CONTEXT, err);
|
|
45
|
+
}
|
|
46
|
+
if (rootStat.isSymbolicLink()) {
|
|
47
|
+
throw new LocalError(`symlink found at ${root} (following symlinks is not supported)`, CONTEXT);
|
|
48
|
+
}
|
|
49
|
+
if (!rootStat.isDirectory()) {
|
|
50
|
+
throw new LocalError(`path ${root} is not a directory`, CONTEXT);
|
|
51
|
+
}
|
|
52
|
+
const out = {};
|
|
53
|
+
await walkInto(root, root, ignore, out);
|
|
54
|
+
if (Object.keys(out).length === 0) {
|
|
55
|
+
throw new LocalError(`directory ${root} contains no deployable files`, CONTEXT);
|
|
56
|
+
}
|
|
57
|
+
return out;
|
|
58
|
+
}
|
|
59
|
+
async function walkInto(root, current, ignore, out) {
|
|
60
|
+
let entries;
|
|
61
|
+
try {
|
|
62
|
+
entries = await readdir(current, { withFileTypes: true });
|
|
63
|
+
}
|
|
64
|
+
catch (err) {
|
|
65
|
+
throw new LocalError(`cannot read directory ${current}: ${err.message}`, CONTEXT, err);
|
|
66
|
+
}
|
|
67
|
+
for (const entry of entries) {
|
|
68
|
+
if (ignore.has(entry.name))
|
|
69
|
+
continue;
|
|
70
|
+
const fullPath = join(current, entry.name);
|
|
71
|
+
if (entry.isSymbolicLink()) {
|
|
72
|
+
throw new LocalError(`symlink found at ${fullPath} (following symlinks is not supported)`, CONTEXT);
|
|
73
|
+
}
|
|
74
|
+
if (entry.isDirectory()) {
|
|
75
|
+
await walkInto(root, fullPath, ignore, out);
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
if (entry.isFile()) {
|
|
79
|
+
const rel = normalizeRelPath(relative(root, fullPath));
|
|
80
|
+
out[rel] = { __source: "fs-file", path: fullPath };
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/** Normalize a relative path to POSIX forward slashes. Exposed for tests. */
|
|
85
|
+
export function normalizeRelPath(rel) {
|
|
86
|
+
return sep === "/" ? rel : rel.split(sep).join("/");
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.js","sourceRoot":"","sources":["../../src/node/files.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,cAAc,EAAE,WAAW,CAAC,CAAC,CAAC;AACtE,MAAM,OAAO,GAAG,6BAA6B,CAAC;AAQ9C;;;;;;;;;;;;;;;;;;;GAmBG;AACH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/dist/node/index.d.ts
CHANGED
|
@@ -53,9 +53,11 @@ export type NodeRun402 = Omit<Run402, "sites"> & {
|
|
|
53
53
|
*/
|
|
54
54
|
export declare function run402(opts?: NodeRun402Options): NodeRun402;
|
|
55
55
|
export { NodeSites } from "./sites-node.js";
|
|
56
|
-
export type { DeployDirOptions
|
|
56
|
+
export type { DeployDirOptions } from "./sites-node.js";
|
|
57
|
+
export { fileSetFromDir, normalizeRelPath } from "./files.js";
|
|
58
|
+
export type { FileSetFromDirOptions } from "./files.js";
|
|
57
59
|
export { NodeCredentialsProvider } from "./credentials.js";
|
|
58
60
|
export { setupPaidFetch, createLazyPaidFetch } from "./paid-fetch.js";
|
|
59
|
-
export { Run402, Run402Error, PaymentRequired, ProjectNotFound, Unauthorized, ApiError, NetworkError, LocalError, } from "../index.js";
|
|
60
|
-
export type { Run402Options, CredentialsProvider, ProjectKeys, RequestOptions, Client, } from "../index.js";
|
|
61
|
+
export { Run402, Run402Error, PaymentRequired, ProjectNotFound, Unauthorized, ApiError, NetworkError, LocalError, Run402DeployError, Deploy, files, } from "../index.js";
|
|
62
|
+
export type { Run402Options, CredentialsProvider, ProjectKeys, RequestOptions, Client, Run402DeployErrorCode, Run402DeployErrorFix, ApplyOptions, CommitResponse, CommitStatus, ContentRef, ContentSource, DatabaseSpec, DeployDiff, DeployEvent, DeployOperation, DeployResult, ExposeManifest, FileSet, FsFileSource, FunctionSpec, FunctionsSpec, MigrationSpec, MissingContent, OperationSnapshot, OperationStatus, PaymentRequiredHint, PlanRequest, PlanResponse, ReleaseSpec, RouteSpec, SecretsSpec, SiteSpec, SmokeCheck, StartOptions, SubdomainsSpec, } from "../index.js";
|
|
61
63
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,EAAE,MAAM,EAAsB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|
|
56
56
|
}
|
|
57
57
|
export { NodeSites } from "./sites-node.js";
|
|
58
|
+
export { fileSetFromDir, normalizeRelPath } from "./files.js";
|
|
58
59
|
export { NodeCredentialsProvider } from "./credentials.js";
|
|
59
60
|
export { setupPaidFetch, createLazyPaidFetch } from "./paid-fetch.js";
|
|
60
61
|
// Re-export the isomorphic surface so Node consumers don't need two imports.
|
|
61
|
-
export { Run402, Run402Error, PaymentRequired, ProjectNotFound, Unauthorized, ApiError, NetworkError, LocalError, } from "../index.js";
|
|
62
|
+
export { Run402, Run402Error, PaymentRequired, ProjectNotFound, Unauthorized, ApiError, NetworkError, LocalError, Run402DeployError, Deploy, files, } from "../index.js";
|
|
62
63
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,MAAM,EAAsB,MAAM,aAAa,CAAC;AAEzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAqB5C;;;;;;;;;;GAUG;AACH,MAAM,UAAU,MAAM,CAAC,OAA0B,EAAE;IACjD,MAAM,OAAO,GAAkB;QAC7B,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,UAAU,EAAE;QACrC,WAAW,EAAE,IAAI,uBAAuB,CAAC;YACvC,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,YAAY,EAAE,IAAI,CAAC,YAAY;SAChC,CAAC;QACF,KAAK,EACH,IAAI,CAAC,KAAK;YACV,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAA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ACjC,YAAY,EAAE,IAAI,CAAC,YAAY;SAChC,CAAC;QACF,KAAK,EACH,IAAI,CAAC,KAAK;YACV,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,mBAAmB,EAAE,CAAC;KACtF,CAAC;IACF,MAAM,IAAI,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC;IAEjC,yEAAyE;IACzE,0EAA0E;IAC1E,4EAA4E;IAC5E,2EAA2E;IAC3E,MAAM,MAAM,GAAI,IAAI,CAAC,KAAuC,CAAC,MAAM,CAAC;IACnE,IAAwC,CAAC,KAAK,GAAG,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC;IAExE,OAAO,IAA6B,CAAC;AACvC,CAAC;AAED,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtE,6EAA6E;AAC7E,OAAO,EACL,MAAM,EACN,WAAW,EACX,eAAe,EACf,eAAe,EACf,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,MAAM,EACN,KAAK,GACN,MAAM,aAAa,CAAC"}
|
|
@@ -1,29 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Node-only
|
|
2
|
+
* Node-only `sites.deployDir` convenience.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* **As of v1.34, this is a thin wrapper over `r.deploy.apply`** — bytes ride
|
|
5
|
+
* through the unified CAS substrate, the deploy flows through the v2 plan/
|
|
6
|
+
* commit endpoints, and the agent-observable result remains a
|
|
7
|
+
* {@link SiteDeployResult}. Existing callers keep their input shape
|
|
8
|
+
* (`{ project, dir, target?, onEvent? }`) and their legacy event consumers
|
|
9
|
+
* keep working: the wrapper synthesizes both the unified `DeployEvent`
|
|
10
|
+
* shapes (from the SDK's `deploy` namespace) and the legacy phase events
|
|
11
|
+
* (`{ phase: "plan"|"upload"|"commit"|"poll", ... }`) for the deprecation
|
|
12
|
+
* window.
|
|
7
13
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* 2. PUT each `missing` file's bytes to its presigned S3 URL(s),
|
|
11
|
-
* sending `x-amz-checksum-sha256` to satisfy the signed checksum
|
|
12
|
-
* algorithm. Single-PUT covers small files; multipart covers large
|
|
13
|
-
* files (the gateway picks per-part sizing).
|
|
14
|
-
* 3. POST /deploy/v1/commit { plan_id } — Stage 1 (DB) returns
|
|
15
|
-
* synchronously with `applied`, `noop`, `copying`, or `failed`.
|
|
16
|
-
* `copying` triggers a poll loop on `GET /deployments/v1/:id` until
|
|
17
|
-
* `ready` (or `failed`).
|
|
18
|
-
*
|
|
19
|
-
* The canonicalize used to compute `manifest_digest` MUST match the
|
|
20
|
-
* gateway's byte-for-byte (see `./canonicalize.ts`).
|
|
21
|
-
*
|
|
22
|
-
* Imports `node:fs/promises` and so cannot run in a V8 isolate. Wired into
|
|
23
|
-
* the SDK via the `@run402/sdk/node` entry point only.
|
|
14
|
+
* Imports `node:fs/promises` via `fileSetFromDir`, so this module remains
|
|
15
|
+
* Node-only — V8 isolates use `r.deploy.apply` with in-memory byte sources.
|
|
24
16
|
*/
|
|
25
17
|
import { Sites, type SiteDeployResult } from "../namespaces/sites.js";
|
|
26
|
-
import {
|
|
18
|
+
import type { ContentRef, DeployEvent as UnifiedDeployEvent } from "../namespaces/deploy.types.js";
|
|
27
19
|
export interface DeployDirOptions {
|
|
28
20
|
/** Project ID the deployment is linked to. */
|
|
29
21
|
project: string;
|
|
@@ -32,116 +24,51 @@ export interface DeployDirOptions {
|
|
|
32
24
|
/** Deployment target label, e.g. `"production"`. */
|
|
33
25
|
target?: string;
|
|
34
26
|
/**
|
|
35
|
-
* Optional progress callback.
|
|
36
|
-
*
|
|
37
|
-
*
|
|
27
|
+
* Optional progress callback. The wrapper invokes it with **both** the
|
|
28
|
+
* legacy phase event shapes (for back-compat with v1.32-era consumers)
|
|
29
|
+
* and the new unified `DeployEvent` shapes from the v2 deploy namespace.
|
|
30
|
+
* Errors thrown synchronously are caught and dropped — a buggy consumer
|
|
31
|
+
* cannot abort the deploy.
|
|
38
32
|
*/
|
|
39
33
|
onEvent?: (event: DeployEvent) => void;
|
|
40
34
|
}
|
|
41
35
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
36
|
+
* Discriminated union of progress events. The legacy variants (`phase:`)
|
|
37
|
+
* are kept for the v1.32-era event consumers; new code should switch on
|
|
38
|
+
* `type:` and consume the {@link UnifiedDeployEvent} shapes from
|
|
39
|
+
* `@run402/sdk`. The wrapper emits both for the deprecation window.
|
|
44
40
|
*/
|
|
45
|
-
export type DeployEvent =
|
|
46
|
-
/**
|
|
47
|
-
{
|
|
41
|
+
export type DeployEvent = LegacyDeployEvent | UnifiedDeployEvent;
|
|
42
|
+
/** Legacy event shapes preserved for v1.32-era consumers. */
|
|
43
|
+
export type LegacyDeployEvent = {
|
|
48
44
|
phase: "plan";
|
|
49
45
|
manifest_size: number;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* One file's bytes were successfully PUT to S3. Fires once per `missing`
|
|
53
|
-
* entry in the plan response — files reported as `present` or
|
|
54
|
-
* `satisfied_by_plan` do not trigger an upload event.
|
|
55
|
-
*/
|
|
56
|
-
| {
|
|
46
|
+
} | {
|
|
57
47
|
phase: "upload";
|
|
58
48
|
file: string;
|
|
59
49
|
sha256: string;
|
|
60
50
|
done: number;
|
|
61
51
|
total: number;
|
|
62
|
-
}
|
|
63
|
-
/** About to call `POST /deploy/v1/commit`. Fires once per deploy. */
|
|
64
|
-
| {
|
|
52
|
+
} | {
|
|
65
53
|
phase: "commit";
|
|
66
|
-
}
|
|
67
|
-
/** Stage-2 copy poll tick (`GET /deployments/v1/:id`). Fires per iteration when commit returned `copying`. */
|
|
68
|
-
| {
|
|
54
|
+
} | {
|
|
69
55
|
phase: "poll";
|
|
70
56
|
status: string;
|
|
71
57
|
elapsed_ms: number;
|
|
72
58
|
};
|
|
73
|
-
/** One walked file plus everything we need to hash, plan, and upload it. */
|
|
74
|
-
interface WalkedFile {
|
|
75
|
-
path: string;
|
|
76
|
-
size: number;
|
|
77
|
-
sha256: string;
|
|
78
|
-
content_type: string;
|
|
79
|
-
bytes: Buffer;
|
|
80
|
-
}
|
|
81
|
-
interface PlanFilePresent {
|
|
82
|
-
sha256: string;
|
|
83
|
-
present: true;
|
|
84
|
-
size: number;
|
|
85
|
-
content_type: string;
|
|
86
|
-
}
|
|
87
|
-
interface PlanFileSatisfied {
|
|
88
|
-
sha256: string;
|
|
89
|
-
satisfied_by_plan: true;
|
|
90
|
-
size: number;
|
|
91
|
-
content_type: string;
|
|
92
|
-
}
|
|
93
|
-
interface PlanFileMissing {
|
|
94
|
-
sha256: string;
|
|
95
|
-
missing: true;
|
|
96
|
-
upload_id: string;
|
|
97
|
-
mode: "single" | "multipart";
|
|
98
|
-
key: string;
|
|
99
|
-
staging_key: string;
|
|
100
|
-
part_size_bytes: number;
|
|
101
|
-
part_count: number;
|
|
102
|
-
parts: Array<{
|
|
103
|
-
part_number: number;
|
|
104
|
-
url: string;
|
|
105
|
-
byte_start: number;
|
|
106
|
-
byte_end: number;
|
|
107
|
-
}>;
|
|
108
|
-
expires_at: string;
|
|
109
|
-
}
|
|
110
|
-
type PlanFileResponse = PlanFilePresent | PlanFileSatisfied | PlanFileMissing;
|
|
111
|
-
interface PlanResponse {
|
|
112
|
-
plan_id: string;
|
|
113
|
-
files: PlanFileResponse[];
|
|
114
|
-
}
|
|
115
|
-
interface CommitResponse {
|
|
116
|
-
deployment_id: string;
|
|
117
|
-
url: string;
|
|
118
|
-
status: "applied" | "noop" | "copying" | "failed";
|
|
119
|
-
bytes_total?: number;
|
|
120
|
-
bytes_uploaded?: number;
|
|
121
|
-
}
|
|
122
59
|
/**
|
|
123
60
|
* Sites namespace enriched with the Node-only `deployDir` convenience.
|
|
124
61
|
* All existing `Sites` methods are inherited unchanged.
|
|
125
62
|
*/
|
|
126
63
|
export declare class NodeSites extends Sites {
|
|
127
64
|
/**
|
|
128
|
-
* Deploy every file under `dir` as a static site. Walks the tree
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
* Files named `.git`, `node_modules`, or `.DS_Store` are skipped at every
|
|
134
|
-
* depth. Symlinks cause a {@link LocalError} — they are not followed.
|
|
65
|
+
* Deploy every file under `dir` as a static site. Walks the tree (skipping
|
|
66
|
+
* `.git`/`node_modules`/`.DS_Store`, rejecting symlinks), produces an
|
|
67
|
+
* `FsFileSource`-backed `FileSet`, and delegates to `r.deploy.apply` —
|
|
68
|
+
* which uploads only the bytes the gateway doesn't already have, applies
|
|
69
|
+
* the new release atomically, and polls the operation until terminal.
|
|
135
70
|
*/
|
|
136
71
|
deployDir(opts: DeployDirOptions): Promise<SiteDeployResult>;
|
|
137
72
|
}
|
|
138
|
-
|
|
139
|
-
* Normalize a relative path to POSIX forward slashes. Exposed for tests;
|
|
140
|
-
* not part of the public SDK API.
|
|
141
|
-
*/
|
|
142
|
-
export declare function normalizeRelPath(rel: string): string;
|
|
143
|
-
/** @internal — exposed for tests, not part of the public SDK API. */
|
|
144
|
-
export declare function _collectFilesForTest(root: string): Promise<WalkedFile[]>;
|
|
145
|
-
/** @internal — exposed for tests, not part of the public SDK API. */
|
|
146
|
-
export type { WalkedFile, PlanResponse, CommitResponse, ManifestEntry };
|
|
73
|
+
export type { ContentRef };
|
|
147
74
|
//# sourceMappingURL=sites-node.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sites-node.d.ts","sourceRoot":"","sources":["../../src/node/sites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