@substrat-run/contracts 0.22.0 → 0.23.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/dist/deploy.d.ts CHANGED
@@ -1,4 +1,40 @@
1
1
  import { z } from 'zod';
2
+ /**
3
+ * The runtime baseline a `runtimeNeeds` vertical builds against — the platform picks the
4
+ * compatibility date, the builder never does. Advancing it is a platform release concern
5
+ * (re-push under the new baseline), exactly like a kernel upgrade.
6
+ */
7
+ export declare const RUNTIME_BASELINE = "2025-01-01";
8
+ /**
9
+ * One of the vertical's OWN stores: a durable state class the code exports, reached in the
10
+ * worker through `binding`. This is the substrate-vocabulary side of what the wire manifest
11
+ * calls `doClasses` + a `durable_object_namespace` binding — the §4 sandbox contract already
12
+ * guarantees a vertical binds nothing BUT its own stores, so own-stores is the entire
13
+ * vocabulary; there is nothing else a builder could legitimately say.
14
+ */
15
+ export declare const storeNeed: z.ZodObject<{
16
+ binding: z.ZodString;
17
+ class: z.ZodString;
18
+ }, z.core.$strip>;
19
+ export type StoreNeed = z.infer<typeof storeNeed>;
20
+ /**
21
+ * What a vertical needs from the runtime, in substrate vocabulary (package.json
22
+ * `substrat.runtimeNeeds`). A vertical authored with this section never writes deploy
23
+ * config for a specific substrate — the CLI derives that at push time (D-38: builders
24
+ * keep the substrate vocabulary; the Cloudflare mapping lives behind the platform).
25
+ * Datastores beyond own stores (e.g. a relational database) are deliberately absent:
26
+ * those are platform-PROVISIONED, never bundle-declared (self-serve-deploy.md §4).
27
+ */
28
+ export declare const runtimeNeeds: z.ZodObject<{
29
+ entry: z.ZodString;
30
+ needsNodeCompat: z.ZodDefault<z.ZodBoolean>;
31
+ build: z.ZodOptional<z.ZodString>;
32
+ stores: z.ZodDefault<z.ZodArray<z.ZodObject<{
33
+ binding: z.ZodString;
34
+ class: z.ZodString;
35
+ }, z.core.$strip>>>;
36
+ }, z.core.$strip>;
37
+ export type RuntimeNeeds = z.infer<typeof runtimeNeeds>;
2
38
  /** A binding the uploaded worker declares, as far as the sandbox contract check needs it. */
3
39
  export declare const declaredBinding: z.ZodObject<{
4
40
  type: z.ZodString;
@@ -1 +1 @@
1
- {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../src/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB,6FAA6F;AAC7F,eAAO,MAAM,eAAe;;;;;;iBAO1B,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D,wEAAwE;AACxE,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAyBzB,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC"}
1
+ {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../src/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,eAAe,CAAC;AAE7C;;;;;;GAMG;AACH,eAAO,MAAM,SAAS;;;iBAKpB,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAElD;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY;;;;;;;;iBAQvB,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAExD,6FAA6F;AAC7F,eAAO,MAAM,eAAe;;;;;;iBAO1B,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D,wEAAwE;AACxE,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAyBzB,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC"}
package/dist/deploy.js CHANGED
@@ -7,6 +7,42 @@ import { envVarSpec, capability } from './manifest.js';
7
7
  // validates it before upload, the control plane re-parses it at the trust
8
8
  // boundary and runs the §4 sandbox contract against the result. One schema,
9
9
  // two parses, no drift.
10
+ /**
11
+ * The runtime baseline a `runtimeNeeds` vertical builds against — the platform picks the
12
+ * compatibility date, the builder never does. Advancing it is a platform release concern
13
+ * (re-push under the new baseline), exactly like a kernel upgrade.
14
+ */
15
+ export const RUNTIME_BASELINE = '2025-01-01';
16
+ /**
17
+ * One of the vertical's OWN stores: a durable state class the code exports, reached in the
18
+ * worker through `binding`. This is the substrate-vocabulary side of what the wire manifest
19
+ * calls `doClasses` + a `durable_object_namespace` binding — the §4 sandbox contract already
20
+ * guarantees a vertical binds nothing BUT its own stores, so own-stores is the entire
21
+ * vocabulary; there is nothing else a builder could legitimately say.
22
+ */
23
+ export const storeNeed = z.object({
24
+ /** How the worker reaches it: `env.<binding>`. SCREAMING_SNAKE, like an env key. */
25
+ binding: z.string().regex(/^[A-Z][A-Z0-9_]*$/),
26
+ /** The exported class implementing the store. */
27
+ class: z.string().min(1),
28
+ });
29
+ /**
30
+ * What a vertical needs from the runtime, in substrate vocabulary (package.json
31
+ * `substrat.runtimeNeeds`). A vertical authored with this section never writes deploy
32
+ * config for a specific substrate — the CLI derives that at push time (D-38: builders
33
+ * keep the substrate vocabulary; the Cloudflare mapping lives behind the platform).
34
+ * Datastores beyond own stores (e.g. a relational database) are deliberately absent:
35
+ * those are platform-PROVISIONED, never bundle-declared (self-serve-deploy.md §4).
36
+ */
37
+ export const runtimeNeeds = z.object({
38
+ /** The worker entry module, relative to the vertical root (e.g. `src/worker.ts`). */
39
+ entry: z.string().min(1),
40
+ /** Needs Node built-ins at runtime (crypto/streams shims — e.g. Better Auth). */
41
+ needsNodeCompat: z.boolean().default(false),
42
+ /** Command to run before bundling (SPA build, asset generation). Runs in the vertical root. */
43
+ build: z.string().min(1).optional(),
44
+ stores: z.array(storeNeed).default([]),
45
+ });
10
46
  /** A binding the uploaded worker declares, as far as the sandbox contract check needs it. */
11
47
  export const declaredBinding = z.object({
12
48
  type: z.string().min(1),
@@ -1 +1 @@
1
- {"version":3,"file":"deploy.js","sourceRoot":"","sources":["../src/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEvD,6EAA6E;AAC7E,4EAA4E;AAC5E,4EAA4E;AAC5E,0EAA0E;AAC1E,4EAA4E;AAC5E,wBAAwB;AAExB,6FAA6F;AAC7F,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,8FAA8F;IAC9F,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC1B,CAAC,CAAC;AAGH,wEAAwE;AACxE,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1B,oEAAoE;IACpE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAClC,4DAA4D;IAC5D,KAAK,EAAE,CAAC,CAAC,MAAM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EAAE;IAC9C,YAAY,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC5C,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE;IACxC,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE;IACxC,mFAAmF;IACnF,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC;QAChB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QAC3B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;QAC7B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;KAC7B,CAAC;CACH,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@substrat-run/contracts",
3
- "version": "0.22.0",
3
+ "version": "0.23.0",
4
4
  "description": "Substrat kernel contract schemas — Zod is the source of truth (master plan D-22); OAS/JSON Schema are emitted artifacts",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {