run402 1.49.0 → 1.50.1

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.
Files changed (46) hide show
  1. package/core-dist/config.js +10 -0
  2. package/lib/deploy-v2.mjs +359 -0
  3. package/lib/deploy.mjs +14 -0
  4. package/package.json +1 -1
  5. package/sdk/core-dist/config.js +10 -0
  6. package/sdk/dist/errors.d.ts +41 -0
  7. package/sdk/dist/errors.d.ts.map +1 -1
  8. package/sdk/dist/errors.js +23 -0
  9. package/sdk/dist/errors.js.map +1 -1
  10. package/sdk/dist/index.d.ts +24 -1
  11. package/sdk/dist/index.d.ts.map +1 -1
  12. package/sdk/dist/index.js +24 -1
  13. package/sdk/dist/index.js.map +1 -1
  14. package/sdk/dist/namespaces/apps.d.ts +14 -0
  15. package/sdk/dist/namespaces/apps.d.ts.map +1 -1
  16. package/sdk/dist/namespaces/apps.js +175 -20
  17. package/sdk/dist/namespaces/apps.js.map +1 -1
  18. package/sdk/dist/namespaces/blobs.d.ts.map +1 -1
  19. package/sdk/dist/namespaces/blobs.js +20 -6
  20. package/sdk/dist/namespaces/blobs.js.map +1 -1
  21. package/sdk/dist/namespaces/blobs.types.d.ts +20 -5
  22. package/sdk/dist/namespaces/blobs.types.d.ts.map +1 -1
  23. package/sdk/dist/namespaces/deploy.d.ts +116 -0
  24. package/sdk/dist/namespaces/deploy.d.ts.map +1 -0
  25. package/sdk/dist/namespaces/deploy.js +1251 -0
  26. package/sdk/dist/namespaces/deploy.js.map +1 -0
  27. package/sdk/dist/namespaces/deploy.types.d.ts +438 -0
  28. package/sdk/dist/namespaces/deploy.types.d.ts.map +1 -0
  29. package/sdk/dist/namespaces/deploy.types.js +11 -0
  30. package/sdk/dist/namespaces/deploy.types.js.map +1 -0
  31. package/sdk/dist/node/canonicalize.d.ts +12 -5
  32. package/sdk/dist/node/canonicalize.d.ts.map +1 -1
  33. package/sdk/dist/node/canonicalize.js +12 -5
  34. package/sdk/dist/node/canonicalize.js.map +1 -1
  35. package/sdk/dist/node/files.d.ts +38 -0
  36. package/sdk/dist/node/files.d.ts.map +1 -0
  37. package/sdk/dist/node/files.js +88 -0
  38. package/sdk/dist/node/files.js.map +1 -0
  39. package/sdk/dist/node/index.d.ts +5 -3
  40. package/sdk/dist/node/index.d.ts.map +1 -1
  41. package/sdk/dist/node/index.js +2 -1
  42. package/sdk/dist/node/index.js.map +1 -1
  43. package/sdk/dist/node/sites-node.d.ts +34 -107
  44. package/sdk/dist/node/sites-node.d.ts.map +1 -1
  45. package/sdk/dist/node/sites-node.js +91 -353
  46. package/sdk/dist/node/sites-node.js.map +1 -1
@@ -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,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,IAAY,EACZ,OAA8B,EAAE;IAEhC,MAAM,MAAM,GAAG,IAAI,GAAG,CAAS,cAAc,CAAC,CAAC;IAC/C,IAAI,IAAI,CAAC,MAAM;QAAE,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,MAAM;YAAE,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAElE,IAAI,QAAQ,CAAC;IACb,IAAI,CAAC;QACH,QAAQ,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,UAAU,CAClB,yBAAyB,IAAI,KAAM,GAAa,CAAC,OAAO,EAAE,EAC1D,OAAO,EACP,GAAG,CACJ,CAAC;IACJ,CAAC;IACD,IAAI,QAAQ,CAAC,cAAc,EAAE,EAAE,CAAC;QAC9B,MAAM,IAAI,UAAU,CAClB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QACD,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;YACxB,MAAM,QAAQ,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;YAC5C,SAAS;QACX,CAAC;QACD,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;YACnB,MAAM,GAAG,GAAG,gBAAgB,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;YACvD,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;QACrD,CAAC;IACH,CAAC;AACH,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,gBAAgB,CAAC,GAAW;IAC1C,OAAO,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACtD,CAAC"}
@@ -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, DeployEvent } from "./sites-node.js";
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,MAAM,aAAa,CAAC;AAIzD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,WAAW,iBAAiB;IAChC,yFAAyF;IACzF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0EAA0E;IAC1E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,2EAA2E;IAC3E,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,mFAAmF;IACnF,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CACjC;AAED,4EAA4E;AAC5E,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IAAE,KAAK,EAAE,SAAS,CAAA;CAAE,CAAC;AAEtE;;;;;;;;;;GAUG;AACH,wBAAgB,MAAM,CAAC,IAAI,GAAE,iBAAsB,GAAG,UAAU,CAqB/D;AAED,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACrE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AC;AAC9D,YAAY,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtE,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;AACrB,YAAY,EACV,aAAa,EACb,mBAAmB,EACnB,WAAW,EACX,cAAc,EACd,MAAM,EACN,qBAAqB,EACrB,oBAAoB,EACpB,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,UAAU,EACV,aAAa,EACb,YAAY,EACZ,UAAU,EACV,WAAW,EACX,eAAe,EACf,YAAY,EACZ,cAAc,EACd,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,WAAW,EACX,YAAY,EACZ,WAAW,EACX,SAAS,EACT,WAAW,EACX,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,cAAc,GACf,MAAM,aAAa,CAAC"}
@@ -55,8 +55,9 @@ export function run402(opts = {}) {
55
55
  return base;
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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AS,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 augmentation of the `sites` namespace.
2
+ * Node-only `sites.deployDir` convenience.
3
3
  *
4
- * `deployDir(dir)` walks a directory, computes per-file SHA-256 + size,
5
- * builds a canonical manifest, and ships it via the v1.32 plan/commit
6
- * transport:
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
- * 1. POST /deploy/v1/plan { manifest_digest, manifest } returns per-file
9
- * state (`present`, `satisfied_by_plan`, or `missing` + presigned URLs).
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 { type ManifestEntry } from "./canonicalize.js";
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. Invoked synchronously at four phases of the
36
- * deploy. Errors thrown from the callback are caught and dropped — a buggy
37
- * consumer can't abort the deploy.
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
- * Progress event emitted by {@link NodeSites.deployDir} when the caller
43
- * supplies an `onEvent` callback. A discriminated union keyed by `phase`.
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
- /** `POST /deploy/v1/plan` returned. Fires once per deploy. */
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, hashes
129
- * each file, plans the deploy with the gateway (which dedupes against
130
- * already-uploaded content), uploads only the missing bytes, then
131
- * commits.
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-node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAKH,OAAO,EAAE,KAAK,EAAE,KAAK,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAEtE,OAAO,EAIL,KAAK,aAAa,EACnB,MAAM,mBAAmB,CAAC;AAa3B,MAAM,WAAW,gBAAgB;IAC/B,8C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