@substrat-run/contracts 0.39.0 → 0.40.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.
@@ -13,11 +13,16 @@ export type ConnectionStatus = z.infer<typeof connectionStatus>;
13
13
  /**
14
14
  * A connection as the directory holds it.
15
15
  *
16
- * Keyed on **(tenant, vertical, provider)** rather than tenant alone
16
+ * Keyed on **(tenant, vertical, provider, account)** rather than tenant alone
17
17
  * (connections.md §3.1.1): a vertical is a blast-radius boundary (D-30) and
18
18
  * verticals are built by different companies (D-33), so one vendor's host code
19
19
  * must not reach a credential another vendor connected. It also matches how
20
20
  * OAuth issues clients — two vendors acting for one tenant hold two clients.
21
+ * The account leg is `externalAccountRef` (Vercel's "Git namespace" shape): one
22
+ * tenant may hold the SAME provider under several external accounts — two
23
+ * GitHub orgs, say — and each is its own connection. Providers that never set
24
+ * an account ref collapse back to one live connection per (tenant, vertical,
25
+ * provider), the pre-#101-widening behavior.
21
26
  */
22
27
  export declare const connection: z.ZodObject<{
23
28
  id: z.core.$ZodBranded<z.ZodString, "ConnectionId", "out">;
@@ -71,6 +76,7 @@ export declare const connectionFilter: z.ZodObject<{
71
76
  tenantId: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "TenantId", "out">>;
72
77
  vertical: z.ZodOptional<z.ZodString>;
73
78
  provider: z.ZodOptional<z.ZodString>;
79
+ externalAccountRef: z.ZodOptional<z.ZodString>;
74
80
  includeRevoked: z.ZodOptional<z.ZodBoolean>;
75
81
  }, z.core.$strip>;
76
82
  export type ConnectionFilter = z.infer<typeof connectionFilter>;
@@ -1 +1 @@
1
- {"version":3,"file":"connections.d.ts","sourceRoot":"","sources":["../src/connections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAcxB,eAAO,MAAM,YAAY,wDAAiD,CAAC;AAC3E,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAA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AO,YAAY,CAAC,CAAC;AAExD,gFAAgF;AAChF,eAAO,MAAM,kBAAkB,aAIiC,CAAC;AAEjE,eAAO,MAAM,gBAAgB;;;;;EAS3B,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEhE;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;iBA0BrB,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAEpD;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,uCAA0C,CAAC;AACxE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEhE,eAAO,MAAM,qBAAqB;;;;;;;;;;;iBAmBhC,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE1E,eAAO,MAAM,gBAAgB;;;;;;iBAQ3B,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEhE;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,YAAY,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,gBAAgB,CAAC;IACzB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B"}
@@ -29,11 +29,16 @@ export const connectionStatus = z.enum([
29
29
  /**
30
30
  * A connection as the directory holds it.
31
31
  *
32
- * Keyed on **(tenant, vertical, provider)** rather than tenant alone
32
+ * Keyed on **(tenant, vertical, provider, account)** rather than tenant alone
33
33
  * (connections.md §3.1.1): a vertical is a blast-radius boundary (D-30) and
34
34
  * verticals are built by different companies (D-33), so one vendor's host code
35
35
  * must not reach a credential another vendor connected. It also matches how
36
36
  * OAuth issues clients — two vendors acting for one tenant hold two clients.
37
+ * The account leg is `externalAccountRef` (Vercel's "Git namespace" shape): one
38
+ * tenant may hold the SAME provider under several external accounts — two
39
+ * GitHub orgs, say — and each is its own connection. Providers that never set
40
+ * an account ref collapse back to one live connection per (tenant, vertical,
41
+ * provider), the pre-#101-widening behavior.
37
42
  */
38
43
  export const connection = z.object({
39
44
  id: connectionId,
@@ -97,6 +102,8 @@ export const connectionFilter = z.object({
97
102
  tenantId: tenantId.optional(),
98
103
  vertical: z.string().min(1).optional(),
99
104
  provider: connectionProvider.optional(),
105
+ /** Narrow to one external account — the multi-namespace provider's selector. */
106
+ externalAccountRef: z.string().optional(),
100
107
  /** Revoked connections are evidence, not roster — excluded unless asked for. */
101
108
  includeRevoked: z.boolean().optional(),
102
109
  });
@@ -1 +1 @@
1
- {"version":3,"file":"connections.js","sourceRoot":"","sources":["../src/connections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAE7C;;;;;;;GAOG;AAEH,MAAM,IAAI,GAAG,0BAA0B,CAAC;AAExC,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,EAAkB,CAAC;AAG3E,gFAAgF;AAChF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC;KAChC,MAAM,EAAE;KACR,GAAG,CAAC,CAAC,CAAC;KACN,GAAG,CAAC,EAAE,CAAC;KACP,KAAK,CAAC,sBAAsB,EAAE,8BAA8B,CAAC,CAAC;AAEjE,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,IAAI,CAAC;IACrC,cAAc;IACd,QAAQ;IACR,yEAAyE;IACzE,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ChF,cAAc,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CACvC,CAAC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -22,6 +22,7 @@ export * from './registry.js';
22
22
  export * from './routing.js';
23
23
  export * from './tenancy.js';
24
24
  export * from './introspection.js';
25
+ export * from './pagination.js';
25
26
  export * from './connections.js';
26
27
  export * from './control-plane.js';
27
28
  export * from './permission.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC"}
package/dist/index.js CHANGED
@@ -22,6 +22,7 @@ export * from './registry.js';
22
22
  export * from './routing.js';
23
23
  export * from './tenancy.js';
24
24
  export * from './introspection.js';
25
+ export * from './pagination.js';
25
26
  export * from './connections.js';
26
27
  export * from './control-plane.js';
27
28
  export * from './permission.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,60 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * The ONE pagination convention for every list read on the platform (#458-shape
4
+ * work): keyset ("cursor") pages over the list's own sort key, `{ entries,
5
+ * nextCursor }` out. Grown from the admin-log read (`AuditLogFilter` /
6
+ * `GET /admin-log`), which shipped it first; everything else now follows.
7
+ *
8
+ * Two layers, deliberately different defaults (the admin-log precedent):
9
+ * - **Kernel/adapter reads** (`HostAdmin.list*`) take an optional `ListPage`;
10
+ * unset means UNBOUNDED, because internal callers (provisioning, catalogs,
11
+ * sweeps) mean "everything" and a silent cap would let them mistake a page
12
+ * for the whole set.
13
+ * - **HTTP list routes** DEFAULT a page (`LIST_PAGE_DEFAULT`) — the egress is
14
+ * where an ever-growing table must stop being a dump. UIs walk with `cursor`.
15
+ *
16
+ * The cursor is the last entry's sort key verbatim (ULID id, slug, hostname…)
17
+ * — chronological where the key is a ULID, lexicographic otherwise — so it
18
+ * needs no encoding and survives in a query string. A composite sort key joins
19
+ * its parts with `|` (first part always `|`-free: a ULID or enum).
20
+ */
21
+ /** Default page size on every HTTP list read. */
22
+ export declare const LIST_PAGE_DEFAULT = 20;
23
+ /** Hard ceiling on a requested page — same order as a table page (§ introspection). */
24
+ export declare const LIST_PAGE_MAX = 200;
25
+ /**
26
+ * Query-string shape of every paged HTTP list read. `order` flips the walk
27
+ * direction where the route supports it (each route documents its default —
28
+ * existing routes keep the order they shipped with).
29
+ */
30
+ export declare const listPageQuery: z.ZodObject<{
31
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
32
+ cursor: z.ZodOptional<z.ZodString>;
33
+ order: z.ZodOptional<z.ZodEnum<{
34
+ asc: "asc";
35
+ desc: "desc";
36
+ }>>;
37
+ }, z.core.$strip>;
38
+ export type ListPageQuery = z.infer<typeof listPageQuery>;
39
+ /**
40
+ * Kernel-side page params, foldable into any list filter. Unset `limit` means
41
+ * unbounded (see above). `cursor` is exclusive: entries strictly after it in
42
+ * `asc` order, strictly before it in `desc`.
43
+ */
44
+ export interface ListPage {
45
+ limit?: number;
46
+ cursor?: string;
47
+ order?: 'asc' | 'desc';
48
+ }
49
+ /** The envelope every paged HTTP list read returns. */
50
+ export interface Page<T> {
51
+ entries: T[];
52
+ nextCursor: string | null;
53
+ }
54
+ /**
55
+ * Wrap a just-read page. `nextCursor` is the last entry's sort key when the
56
+ * page came back full (there MAY be more), null when it came back short (the
57
+ * walk is done — no trailing empty fetch).
58
+ */
59
+ export declare function pageOf<T>(entries: T[], limit: number, key: (entry: T) => string): Page<T>;
60
+ //# sourceMappingURL=pagination.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../src/pagination.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;;;;;;GAkBG;AAEH,iDAAiD;AACjD,eAAO,MAAM,iBAAiB,KAAK,CAAC;AACpC,uFAAuF;AACvF,eAAO,MAAM,aAAa,MAAM,CAAC;AAEjC;;;;GAIG;AACH,eAAO,MAAM,aAAa;;;;;;;iBAIxB,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAE1D;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;CACxB;AAED,uDAAuD;AACvD,MAAM,WAAW,IAAI,CAAC,CAAC;IACrB,OAAO,EAAE,CAAC,EAAE,CAAC;IACb,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAGzF"}
@@ -0,0 +1,44 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * The ONE pagination convention for every list read on the platform (#458-shape
4
+ * work): keyset ("cursor") pages over the list's own sort key, `{ entries,
5
+ * nextCursor }` out. Grown from the admin-log read (`AuditLogFilter` /
6
+ * `GET /admin-log`), which shipped it first; everything else now follows.
7
+ *
8
+ * Two layers, deliberately different defaults (the admin-log precedent):
9
+ * - **Kernel/adapter reads** (`HostAdmin.list*`) take an optional `ListPage`;
10
+ * unset means UNBOUNDED, because internal callers (provisioning, catalogs,
11
+ * sweeps) mean "everything" and a silent cap would let them mistake a page
12
+ * for the whole set.
13
+ * - **HTTP list routes** DEFAULT a page (`LIST_PAGE_DEFAULT`) — the egress is
14
+ * where an ever-growing table must stop being a dump. UIs walk with `cursor`.
15
+ *
16
+ * The cursor is the last entry's sort key verbatim (ULID id, slug, hostname…)
17
+ * — chronological where the key is a ULID, lexicographic otherwise — so it
18
+ * needs no encoding and survives in a query string. A composite sort key joins
19
+ * its parts with `|` (first part always `|`-free: a ULID or enum).
20
+ */
21
+ /** Default page size on every HTTP list read. */
22
+ export const LIST_PAGE_DEFAULT = 20;
23
+ /** Hard ceiling on a requested page — same order as a table page (§ introspection). */
24
+ export const LIST_PAGE_MAX = 200;
25
+ /**
26
+ * Query-string shape of every paged HTTP list read. `order` flips the walk
27
+ * direction where the route supports it (each route documents its default —
28
+ * existing routes keep the order they shipped with).
29
+ */
30
+ export const listPageQuery = z.object({
31
+ limit: z.coerce.number().int().positive().max(LIST_PAGE_MAX).default(LIST_PAGE_DEFAULT),
32
+ cursor: z.string().min(1).optional(),
33
+ order: z.enum(['asc', 'desc']).optional(),
34
+ });
35
+ /**
36
+ * Wrap a just-read page. `nextCursor` is the last entry's sort key when the
37
+ * page came back full (there MAY be more), null when it came back short (the
38
+ * walk is done — no trailing empty fetch).
39
+ */
40
+ export function pageOf(entries, limit, key) {
41
+ const last = entries.length >= limit ? entries[entries.length - 1] : undefined;
42
+ return { entries, nextCursor: last === undefined ? null : key(last) };
43
+ }
44
+ //# sourceMappingURL=pagination.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pagination.js","sourceRoot":"","sources":["../src/pagination.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;;;;;;GAkBG;AAEH,iDAAiD;AACjD,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AACpC,uFAAuF;AACvF,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,CAAC;AAEjC;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC;IACvF,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACpC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ,EAAE;CAC1C,CAAC,CAAC;AAoBH;;;;GAIG;AACH,MAAM,UAAU,MAAM,CAAI,OAAY,EAAE,KAAa,EAAE,GAAyB;IAC9E,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC/E,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;AACxE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@substrat-run/contracts",
3
- "version": "0.39.0",
3
+ "version": "0.40.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": {