@substrat-run/adapter-cloudflare 0.212.0 → 0.213.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/control-plane-do.d.ts +6 -2
- package/dist/control-plane-do.d.ts.map +1 -1
- package/dist/control-plane-do.js +10 -1
- package/dist/control-plane-do.js.map +1 -1
- package/dist/directory-objects.d.ts +74 -0
- package/dist/directory-objects.d.ts.map +1 -0
- package/dist/directory-objects.js +179 -0
- package/dist/directory-objects.js.map +1 -0
- package/dist/directory-placement.d.ts +27 -0
- package/dist/directory-placement.d.ts.map +1 -0
- package/dist/directory-placement.js +287 -0
- package/dist/directory-placement.js.map +1 -0
- package/dist/directory-split-inventory.d.ts +52 -0
- package/dist/directory-split-inventory.d.ts.map +1 -0
- package/dist/directory-split-inventory.js +103 -0
- package/dist/directory-split-inventory.js.map +1 -0
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +1 -0
- package/dist/host.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The two kinds of directory object the Cloudflare adapter's directory splits into (K-68, directory
|
|
3
|
+
* split; rfc/tenant-scale.md §7.1): one global REGISTRY, and one DIRECTORY OBJECT PER TENANT.
|
|
4
|
+
*
|
|
5
|
+
* Step 3a of the migration order (rfc §12): both classes exist, are bound and build their tables,
|
|
6
|
+
* and carry NO traffic. Nothing in the platform addresses them yet. `ControlPlaneDO` stays the one
|
|
7
|
+
* directory every read and write goes to, and its storage is untouched. What they serve today is the
|
|
8
|
+
* intent-first crossing (`@substrat-run/kernel`'s `directory-crossing`): the registry's claims and
|
|
9
|
+
* each object's crossing ledger, so steps 3b on have the mechanism to wire onto.
|
|
10
|
+
*
|
|
11
|
+
* Addressing:
|
|
12
|
+
* - the registry is `idFromName('registry')`, with no jurisdiction. It holds ids, slugs, hostname
|
|
13
|
+
* claims and the platform's own state (verticals, versions, store drivers), none of it a tenant's
|
|
14
|
+
* residency-bound data (K-36).
|
|
15
|
+
* - a tenant's object is `idFromName('tenant:' + tenantId)` in its jurisdiction's namespace (K-7):
|
|
16
|
+
* a `global` tenant in the plain namespace, an `eu` or `us` one in `namespace.jurisdiction(…)`. A
|
|
17
|
+
* jurisdiction is fixed when the object is created and never changes, and the same name in another
|
|
18
|
+
* jurisdiction is another object, so the jurisdiction is part of the address. It is recorded on the
|
|
19
|
+
* registry's `tenant-id` claim, which is where host code will read it from (steps 3b on).
|
|
20
|
+
*/
|
|
21
|
+
import { DurableObject } from 'cloudflare:workers';
|
|
22
|
+
import type { Jurisdiction } from '@substrat-run/contracts';
|
|
23
|
+
import { type ClaimInput, type ClaimNamespace, type ClaimOutcome, type ClaimRow, type ConfirmInput, type ConfirmOutcome, type CrossingInput, type CrossingRow, type DirectoryObjects, type ReleaseInput, type SettleInput, type SwitchSql } from '@substrat-run/kernel';
|
|
24
|
+
import { type DirectoryObjectKind } from './directory-placement.js';
|
|
25
|
+
/** The registry's object name. */
|
|
26
|
+
export declare const REGISTRY_OBJECT_NAME = "registry";
|
|
27
|
+
/** A tenant directory object's name (rfc §7.1). */
|
|
28
|
+
export declare const tenantDirectoryNameOf: (tenantId: string) => string;
|
|
29
|
+
declare abstract class DirectoryObjectBase extends DurableObject {
|
|
30
|
+
protected readonly sql: SqlStorage;
|
|
31
|
+
protected readonly kernelSql: SwitchSql;
|
|
32
|
+
constructor(ctx: DurableObjectState, env: unknown, kind: DirectoryObjectKind);
|
|
33
|
+
/** Refuse a call meant for another object; bind this one to its owner on the first write. */
|
|
34
|
+
protected assertOwner(owner: string, jurisdiction: Jurisdiction, bind: boolean): void;
|
|
35
|
+
recordCrossing(owner: string, jurisdiction: Jurisdiction, input: CrossingInput): CrossingRow;
|
|
36
|
+
crossing(owner: string, jurisdiction: Jurisdiction, crossingId: string): CrossingRow | null;
|
|
37
|
+
markCrossingClaimed(owner: string, jurisdiction: Jurisdiction, crossingId: string): boolean;
|
|
38
|
+
settleCrossing(owner: string, jurisdiction: Jurisdiction, crossingId: string, settle: SettleInput): boolean;
|
|
39
|
+
openCrossings(owner: string, jurisdiction: Jurisdiction, query: {
|
|
40
|
+
updatedBefore: string;
|
|
41
|
+
limit: number;
|
|
42
|
+
}): CrossingRow[];
|
|
43
|
+
}
|
|
44
|
+
/** The one global registry (rfc §7.1). */
|
|
45
|
+
export declare class DirectoryRegistryDO extends DirectoryObjectBase {
|
|
46
|
+
constructor(ctx: DurableObjectState, env: unknown);
|
|
47
|
+
claim(input: ClaimInput): ClaimOutcome;
|
|
48
|
+
confirmClaim(input: ConfirmInput): ConfirmOutcome;
|
|
49
|
+
releaseClaim(input: ReleaseInput): {
|
|
50
|
+
released: boolean;
|
|
51
|
+
};
|
|
52
|
+
readClaim(namespace: ClaimNamespace, key: string): ClaimRow | null;
|
|
53
|
+
}
|
|
54
|
+
/** One per tenant (rfc §7.1): everything that is the tenant's. */
|
|
55
|
+
export declare class TenantDirectoryDO extends DirectoryObjectBase {
|
|
56
|
+
constructor(ctx: DurableObjectState, env: unknown);
|
|
57
|
+
}
|
|
58
|
+
/** The registry's stub. */
|
|
59
|
+
export declare function registryStub(ns: DurableObjectNamespace<DirectoryRegistryDO>): DurableObjectStub<DirectoryRegistryDO>;
|
|
60
|
+
/** A tenant's directory object, in its jurisdiction's namespace (K-7). */
|
|
61
|
+
export declare function tenantDirectoryStub(ns: DurableObjectNamespace<TenantDirectoryDO>, tenantId: string, jurisdiction: Jurisdiction): DurableObjectStub<TenantDirectoryDO>;
|
|
62
|
+
/**
|
|
63
|
+
* The seam (`DirectoryObjects`) over the two namespaces: the registry's ports and each tenant's
|
|
64
|
+
* ledger as RPC stubs, and `complete` as `runCrossing` across them. `jurisdictionOf` answers a
|
|
65
|
+
* tenant's jurisdiction; until something records one, every tenant is `global` (the only value the
|
|
66
|
+
* provisioning boundary accepts, `provisionableJurisdiction`).
|
|
67
|
+
*/
|
|
68
|
+
export declare function durableDirectoryObjects(options: {
|
|
69
|
+
registry: DurableObjectNamespace<DirectoryRegistryDO>;
|
|
70
|
+
tenants: DurableObjectNamespace<TenantDirectoryDO>;
|
|
71
|
+
jurisdictionOf?: (tenantId: string) => Jurisdiction;
|
|
72
|
+
}): DirectoryObjects;
|
|
73
|
+
export {};
|
|
74
|
+
//# sourceMappingURL=directory-objects.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"directory-objects.d.ts","sourceRoot":"","sources":["../src/directory-objects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAaL,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,aAAa,EAElB,KAAK,WAAW,EAEhB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,SAAS,EACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAyB,KAAK,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAG3F,kCAAkC;AAClC,eAAO,MAAM,oBAAoB,aAAa,CAAC;AAC/C,mDAAmD;AACnD,eAAO,MAAM,qBAAqB,aAAc,MAAM,KAAG,MAA8B,CAAC;AAwBxF,uBAAe,mBAAoB,SAAQ,aAAa;IACtD,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC;IACnC,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAExC,YAAY,GAAG,EAAE,kBAAkB,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,mBAAmB,EAc3E;IAED,6FAA6F;I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GAAG,EAAE,OAAO,EAEhD;CACF;AAED,2BAA2B;AAC3B,wBAAgB,YAAY,CAAC,EAAE,EAAE,sBAAsB,CAAC,mBAAmB,CAAC,GAAG,iBAAiB,CAAC,mBAAmB,CAAC,CAEpH;AAED,0EAA0E;AAC1E,wBAAgB,mBAAmB,CACjC,EAAE,EAAE,sBAAsB,CAAC,iBAAiB,CAAC,EAC7C,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,YAAY,GACzB,iBAAiB,CAAC,iBAAiB,CAAC,CAGtC;AAeD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE;IAC/C,QAAQ,EAAE,sBAAsB,CAAC,mBAAmB,CAAC,CAAC;IACtD,OAAO,EAAE,sBAAsB,CAAC,iBAAiB,CAAC,CAAC;IACnD,cAAc,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,YAAY,CAAC;CACrD,GAAG,gBAAgB,CAkBnB"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The two kinds of directory object the Cloudflare adapter's directory splits into (K-68, directory
|
|
3
|
+
* split; rfc/tenant-scale.md §7.1): one global REGISTRY, and one DIRECTORY OBJECT PER TENANT.
|
|
4
|
+
*
|
|
5
|
+
* Step 3a of the migration order (rfc §12): both classes exist, are bound and build their tables,
|
|
6
|
+
* and carry NO traffic. Nothing in the platform addresses them yet. `ControlPlaneDO` stays the one
|
|
7
|
+
* directory every read and write goes to, and its storage is untouched. What they serve today is the
|
|
8
|
+
* intent-first crossing (`@substrat-run/kernel`'s `directory-crossing`): the registry's claims and
|
|
9
|
+
* each object's crossing ledger, so steps 3b on have the mechanism to wire onto.
|
|
10
|
+
*
|
|
11
|
+
* Addressing:
|
|
12
|
+
* - the registry is `idFromName('registry')`, with no jurisdiction. It holds ids, slugs, hostname
|
|
13
|
+
* claims and the platform's own state (verticals, versions, store drivers), none of it a tenant's
|
|
14
|
+
* residency-bound data (K-36).
|
|
15
|
+
* - a tenant's object is `idFromName('tenant:' + tenantId)` in its jurisdiction's namespace (K-7):
|
|
16
|
+
* a `global` tenant in the plain namespace, an `eu` or `us` one in `namespace.jurisdiction(…)`. A
|
|
17
|
+
* jurisdiction is fixed when the object is created and never changes, and the same name in another
|
|
18
|
+
* jurisdiction is another object, so the jurisdiction is part of the address. It is recorded on the
|
|
19
|
+
* registry's `tenant-id` claim, which is where host code will read it from (steps 3b on).
|
|
20
|
+
*/
|
|
21
|
+
import { DurableObject } from 'cloudflare:workers';
|
|
22
|
+
import { claimIn, confirmClaimIn, crossingIn, markCrossingClaimedIn, openCrossingsIn, readClaimIn, recordCrossingIn, REGISTRY_OWNER, releaseClaimIn, runCrossing, settleCrossingIn, tenantOwnerOf, } from '@substrat-run/kernel';
|
|
23
|
+
import { directoryObjectSchema } from './directory-placement.js';
|
|
24
|
+
import { switchSqlOver } from './scope-do.js';
|
|
25
|
+
/** The registry's object name. */
|
|
26
|
+
export const REGISTRY_OBJECT_NAME = 'registry';
|
|
27
|
+
/** A tenant directory object's name (rfc §7.1). */
|
|
28
|
+
export const tenantDirectoryNameOf = (tenantId) => `tenant:${tenantId}`;
|
|
29
|
+
/**
|
|
30
|
+
* Which owner an object belongs to, bound on its first ledger write and refused for any other after
|
|
31
|
+
* (a call that reached the wrong object writes nothing). One row; the registry's owner is fixed.
|
|
32
|
+
*/
|
|
33
|
+
const DIRECTORY_SELF_DDL = `
|
|
34
|
+
CREATE TABLE IF NOT EXISTS _substrat_directory_self (
|
|
35
|
+
id INTEGER PRIMARY KEY,
|
|
36
|
+
owner TEXT NOT NULL,
|
|
37
|
+
jurisdiction TEXT NOT NULL,
|
|
38
|
+
bound_at TEXT NOT NULL
|
|
39
|
+
);
|
|
40
|
+
`;
|
|
41
|
+
/** Attempt-and-tolerate ALTER, as `ControlPlaneDO.addColumn` does: DO SQLite restricts PRAGMA. */
|
|
42
|
+
function addColumn(sql, table, column) {
|
|
43
|
+
try {
|
|
44
|
+
sql.exec(`ALTER TABLE ${table} ADD COLUMN ${column}`);
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
if (!/duplicate column name/i.test(err.message))
|
|
48
|
+
throw err;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
class DirectoryObjectBase extends DurableObject {
|
|
52
|
+
sql;
|
|
53
|
+
kernelSql;
|
|
54
|
+
constructor(ctx, env, kind) {
|
|
55
|
+
super(ctx, env);
|
|
56
|
+
this.sql = ctx.storage.sql;
|
|
57
|
+
this.kernelSql = switchSqlOver(this.sql);
|
|
58
|
+
// Every statement is `IF NOT EXISTS` and every column tolerated, so a construction after the
|
|
59
|
+
// first runs the same list and changes nothing. One transaction: a construction that fails
|
|
60
|
+
// half-way leaves the object as it was, never a table without its later columns.
|
|
61
|
+
ctx.storage.transactionSync(() => {
|
|
62
|
+
for (const step of directoryObjectSchema(kind)) {
|
|
63
|
+
if ('exec' in step)
|
|
64
|
+
this.sql.exec(step.exec);
|
|
65
|
+
else
|
|
66
|
+
addColumn(this.sql, step.addColumn[0], step.addColumn[1]);
|
|
67
|
+
}
|
|
68
|
+
this.sql.exec(DIRECTORY_SELF_DDL);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
/** Refuse a call meant for another object; bind this one to its owner on the first write. */
|
|
72
|
+
assertOwner(owner, jurisdiction, bind) {
|
|
73
|
+
const [self] = this.sql.exec('SELECT owner, jurisdiction FROM _substrat_directory_self WHERE id = 1').toArray();
|
|
74
|
+
if (self) {
|
|
75
|
+
if (self.owner !== owner || self.jurisdiction !== jurisdiction) {
|
|
76
|
+
throw new Error(`this directory object is ${self.owner} (${self.jurisdiction}), not ${owner} (${jurisdiction})`);
|
|
77
|
+
}
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (bind) {
|
|
81
|
+
this.sql.exec('INSERT INTO _substrat_directory_self (id, owner, jurisdiction, bound_at) VALUES (1, ?, ?, ?)', owner, jurisdiction, new Date().toISOString());
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
recordCrossing(owner, jurisdiction, input) {
|
|
85
|
+
return this.ctx.storage.transactionSync(() => {
|
|
86
|
+
this.assertOwner(owner, jurisdiction, true);
|
|
87
|
+
return recordCrossingIn(this.kernelSql, owner, { ...input, nowMs: Date.now() });
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
crossing(owner, jurisdiction, crossingId) {
|
|
91
|
+
this.assertOwner(owner, jurisdiction, false);
|
|
92
|
+
return crossingIn(this.kernelSql, owner, crossingId);
|
|
93
|
+
}
|
|
94
|
+
markCrossingClaimed(owner, jurisdiction, crossingId) {
|
|
95
|
+
return this.ctx.storage.transactionSync(() => {
|
|
96
|
+
this.assertOwner(owner, jurisdiction, false);
|
|
97
|
+
return markCrossingClaimedIn(this.kernelSql, owner, crossingId, Date.now());
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
settleCrossing(owner, jurisdiction, crossingId, settle) {
|
|
101
|
+
return this.ctx.storage.transactionSync(() => {
|
|
102
|
+
this.assertOwner(owner, jurisdiction, false);
|
|
103
|
+
return settleCrossingIn(this.kernelSql, owner, crossingId, { ...settle, nowMs: Date.now() });
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
openCrossings(owner, jurisdiction, query) {
|
|
107
|
+
this.assertOwner(owner, jurisdiction, false);
|
|
108
|
+
return openCrossingsIn(this.kernelSql, owner, query);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/** The one global registry (rfc §7.1). */
|
|
112
|
+
export class DirectoryRegistryDO extends DirectoryObjectBase {
|
|
113
|
+
constructor(ctx, env) {
|
|
114
|
+
super(ctx, env, 'registry');
|
|
115
|
+
}
|
|
116
|
+
claim(input) {
|
|
117
|
+
return this.ctx.storage.transactionSync(() => claimIn(this.kernelSql, { ...input, nowMs: Date.now() }));
|
|
118
|
+
}
|
|
119
|
+
confirmClaim(input) {
|
|
120
|
+
return this.ctx.storage.transactionSync(() => confirmClaimIn(this.kernelSql, { ...input, nowMs: Date.now() }));
|
|
121
|
+
}
|
|
122
|
+
releaseClaim(input) {
|
|
123
|
+
return this.ctx.storage.transactionSync(() => releaseClaimIn(this.kernelSql, input));
|
|
124
|
+
}
|
|
125
|
+
readClaim(namespace, key) {
|
|
126
|
+
return readClaimIn(this.kernelSql, namespace, key);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/** One per tenant (rfc §7.1): everything that is the tenant's. */
|
|
130
|
+
export class TenantDirectoryDO extends DirectoryObjectBase {
|
|
131
|
+
constructor(ctx, env) {
|
|
132
|
+
super(ctx, env, 'tenant');
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
/** The registry's stub. */
|
|
136
|
+
export function registryStub(ns) {
|
|
137
|
+
return ns.get(ns.idFromName(REGISTRY_OBJECT_NAME));
|
|
138
|
+
}
|
|
139
|
+
/** A tenant's directory object, in its jurisdiction's namespace (K-7). */
|
|
140
|
+
export function tenantDirectoryStub(ns, tenantId, jurisdiction) {
|
|
141
|
+
const scoped = jurisdiction === 'global' ? ns : ns.jurisdiction(jurisdiction);
|
|
142
|
+
return scoped.get(scoped.idFromName(tenantDirectoryNameOf(tenantId)));
|
|
143
|
+
}
|
|
144
|
+
function ledgerPort(stub, owner, jurisdiction) {
|
|
145
|
+
return {
|
|
146
|
+
owner,
|
|
147
|
+
recordCrossing: async (input) => stub.recordCrossing(owner, jurisdiction, input),
|
|
148
|
+
crossing: async (id) => stub.crossing(owner, jurisdiction, id),
|
|
149
|
+
markCrossingClaimed: async (id) => stub.markCrossingClaimed(owner, jurisdiction, id),
|
|
150
|
+
settleCrossing: async (id, settle) => stub.settleCrossing(owner, jurisdiction, id, settle),
|
|
151
|
+
openCrossings: async (query) => stub.openCrossings(owner, jurisdiction, query),
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* The seam (`DirectoryObjects`) over the two namespaces: the registry's ports and each tenant's
|
|
156
|
+
* ledger as RPC stubs, and `complete` as `runCrossing` across them. `jurisdictionOf` answers a
|
|
157
|
+
* tenant's jurisdiction; until something records one, every tenant is `global` (the only value the
|
|
158
|
+
* provisioning boundary accepts, `provisionableJurisdiction`).
|
|
159
|
+
*/
|
|
160
|
+
export function durableDirectoryObjects(options) {
|
|
161
|
+
const registry = registryStub(options.registry);
|
|
162
|
+
const claims = {
|
|
163
|
+
claim: async (input) => registry.claim(input),
|
|
164
|
+
confirmClaim: async (input) => registry.confirmClaim(input),
|
|
165
|
+
releaseClaim: async (input) => registry.releaseClaim(input),
|
|
166
|
+
readClaim: async (namespace, key) => registry.readClaim(namespace, key),
|
|
167
|
+
};
|
|
168
|
+
const registryPorts = { ...ledgerPort(registry, REGISTRY_OWNER, 'global'), ...claims };
|
|
169
|
+
return {
|
|
170
|
+
registry: () => registryPorts,
|
|
171
|
+
tenant: (tenantId) => {
|
|
172
|
+
const jurisdiction = options.jurisdictionOf?.(tenantId) ?? 'global';
|
|
173
|
+
const stub = tenantDirectoryStub(options.tenants, tenantId, jurisdiction);
|
|
174
|
+
return ledgerPort(stub, tenantOwnerOf(tenantId), jurisdiction);
|
|
175
|
+
},
|
|
176
|
+
complete: (ledger, crossingId) => runCrossing(ledger, claims, crossingId),
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
//# sourceMappingURL=directory-objects.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"directory-objects.js","sourceRoot":"","sources":["../src/directory-objects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EACL,OAAO,EACP,cAAc,EACd,UAAU,EACV,qBAAqB,EACrB,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,aAAa,GAed,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,qBAAqB,EAA4B,MAAM,0BAA0B,CA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Y,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC;QAC3D,YAAY,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC;QAC3D,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,SAAS,EAAE,GAAG,CAAC;KACxE,CAAC;IACF,MAAM,aAAa,GAAG,EAAE,GAAG,UAAU,CAAC,QAAgC,EAAE,cAAc,EAAE,QAAQ,CAAC,EAAE,GAAG,MAAM,EAAE,CAAC;IAC/G,OAAO;QACL,QAAQ,EAAE,GAAG,EAAE,CAAC,aAAa;QAC7B,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE;YACnB,MAAM,YAAY,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC;YACpE,MAAM,IAAI,GAAG,mBAAmB,CAAC,OAAO,CAAC,OAAO,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;YAC1E,OAAO,UAAU,CAAC,IAA4B,EAAE,aAAa,CAAC,QAAQ,CAAC,EAAE,YAAY,CAAC,CAAC;QACzF,CAAC;QACD,QAAQ,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC;KAC1E,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type DirectoryObjectKind = 'registry' | 'tenant';
|
|
2
|
+
export type Placement = DirectoryObjectKind | 'both' | 'lake';
|
|
3
|
+
export interface TablePlacement {
|
|
4
|
+
to: Placement;
|
|
5
|
+
/** The RFC's "goes to" for the table, in its words. */
|
|
6
|
+
rfc: string;
|
|
7
|
+
ambiguous?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const DIRECTORY_PLACEMENT: Readonly<Record<string, TablePlacement>>;
|
|
10
|
+
/** The table a directory DDL statement builds: a `CREATE TABLE`'s name, or the table an index is on. */
|
|
11
|
+
export declare function tableOfStatement(stmt: string): string;
|
|
12
|
+
export declare const DIRECTORY_COLUMNS_ADDED: readonly (readonly [table: string, column: string])[];
|
|
13
|
+
/** One step of an object's schema: a statement, or a column it ALTERs in (tolerating one already there). */
|
|
14
|
+
export type SchemaStep = {
|
|
15
|
+
exec: string;
|
|
16
|
+
} | {
|
|
17
|
+
addColumn: readonly [table: string, column: string];
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* The schema of a new directory object, in the order the directory itself builds it: the placed
|
|
21
|
+
* statements of the DDL's first pass, the placed columns, #1764's held-back statements, the two
|
|
22
|
+
* later columns, the placed indexes, then the object's own crossing tables.
|
|
23
|
+
*/
|
|
24
|
+
export declare function directoryObjectSchema(object: DirectoryObjectKind): SchemaStep[];
|
|
25
|
+
/** Every table the directory's DDL builds, in the order it builds them. */
|
|
26
|
+
export declare function directoryTables(): string[];
|
|
27
|
+
//# sourceMappingURL=directory-placement.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"directory-placement.d.ts","sourceRoot":"","sources":["../src/directory-placement.ts"],"names":[],"mappings":"AA4BA,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG,QAAQ,CAAC;AACxD,MAAM,MAAM,SAAS,GAAG,mBAAmB,GAAG,MAAM,GAAG,MAAM,CAAC;AAE9D,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,SAAS,CAAC;IACd,uDAAuD;IACvD,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAqJxE,CAAC;AAQF,wGAAwG;AACxG,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMrD;AAiBD,eAAO,MAAM,uBAAuB,EAAE,SAAS,CAAC,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,EA+CxF,CAAC;AAcF,4GAA4G;AAC5G,MAAM,MAAM,UAAU,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,SAAS,EAAE,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAAC;AAEpG;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,mBAAmB,GAAG,UAAU,EAAE,CAa/E;AAED,2EAA2E;AAC3E,wBAAgB,eAAe,IAAI,MAAM,EAAE,CAK1C"}
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where each of the directory's tables goes when the directory splits (K-68, directory split;
|
|
3
|
+
* rfc/tenant-scale.md §3 and §7.1), and the DDL the two new objects run.
|
|
4
|
+
*
|
|
5
|
+
* Step 3a only: the registry and the tenant directory object are created EMPTY, with these tables,
|
|
6
|
+
* and nothing writes them yet. Dual-write (3b), backfill (3c), verify (3d) and the cut-overs (3e,
|
|
7
|
+
* 3f) come after step 2.
|
|
8
|
+
*
|
|
9
|
+
* The DDL is not a copy. Each object runs the directory's own statements (`DIRECTORY_DDL_PLAN`),
|
|
10
|
+
* filtered to the tables placed in it, then the columns and indexes `ensureDirectoryColumns` adds to
|
|
11
|
+
* a directory after its first shape. So a table in a new object has the column set the directory's
|
|
12
|
+
* table has, and 3b and 3c copy a row by column name with nothing to translate. The column and index
|
|
13
|
+
* half IS a copy (it lives in a method of `ControlPlaneDO`), and `test/directory-objects.test.ts`
|
|
14
|
+
* holds it to a freshly built directory, table by table: a column added to the directory and not
|
|
15
|
+
* here is red there.
|
|
16
|
+
*
|
|
17
|
+
* `to`:
|
|
18
|
+
* - `registry`: the one global object (rfc §7.1: what must be unique or the same for every tenant).
|
|
19
|
+
* - `tenant`: each tenant's directory object.
|
|
20
|
+
* - `both`: the table exists in each. Which rows go where is the RFC row quoted beside it.
|
|
21
|
+
* - `lake`: in neither object. Shipped to the lake by step 2 and read there (K-70).
|
|
22
|
+
*
|
|
23
|
+
* `ambiguous` names a placement the RFC leaves open or does not cover, and what this PR assumed.
|
|
24
|
+
* The PR lists every one of them for the owner.
|
|
25
|
+
*/
|
|
26
|
+
import { DIRECTORY_CLAIMS_DDL, DIRECTORY_CROSSINGS_DDL, executableSqlStatements } from '@substrat-run/kernel';
|
|
27
|
+
import { DIRECTORY_DDL_PLAN } from './control-plane-do.js';
|
|
28
|
+
export const DIRECTORY_PLACEMENT = {
|
|
29
|
+
// ── rfc §3.1, the tables written in DIRECTORY_DDL ──────────────────────────────────────────
|
|
30
|
+
tenants: {
|
|
31
|
+
to: 'both',
|
|
32
|
+
rfc: 'G for id and slug uniqueness; D authoritative for name and status; X projection',
|
|
33
|
+
ambiguous: 'The uniqueness of id and slug is a claim in the registry (`_substrat_directory_claims`), not this table. ' +
|
|
34
|
+
'The registry also keeps a `tenants` row as the projection §7.3 sends a status to ("projects to the registry ' +
|
|
35
|
+
'and the index for lists"); K-68 leaves open whether the registry keeps it. Assumed: it does, and decides nothing from it.',
|
|
36
|
+
},
|
|
37
|
+
scopes: { to: 'tenant', rfc: 'D; the routing columns to KV' },
|
|
38
|
+
scope_script_copies: { to: 'tenant', rfc: 'D, claimed by the tenant object’s alarm' },
|
|
39
|
+
hostnames: {
|
|
40
|
+
to: 'tenant',
|
|
41
|
+
rfc: 'G owns uniqueness; D owns the binding; KV serves it',
|
|
42
|
+
ambiguous: 'Uniqueness is the registry’s `hostname` claim (hostname → tenant, scope); the binding row (surface, region, ' +
|
|
43
|
+
'issuance state) is the tenant’s. §5.5 counts ≈150 K hostname rows in the registry: read as the claim rows.',
|
|
44
|
+
},
|
|
45
|
+
tenant_stores: { to: 'tenant', rfc: 'D' },
|
|
46
|
+
blob_stores: { to: 'tenant', rfc: 'D' },
|
|
47
|
+
verticals: { to: 'registry', rfc: 'G; per-version policy to KV keyed by version id' },
|
|
48
|
+
vertical_versions: { to: 'registry', rfc: 'G, manifests to R2 by digest; per-version policy to KV' },
|
|
49
|
+
vertical_channels: { to: 'registry', rfc: 'G' },
|
|
50
|
+
vertical_channel_history: { to: 'registry', rfc: 'G' },
|
|
51
|
+
orgs: { to: 'tenant', rfc: 'D' },
|
|
52
|
+
_substrat_tenant_tuples: { to: 'tenant', rfc: 'D' },
|
|
53
|
+
_substrat_roles: { to: 'tenant', rfc: 'D' },
|
|
54
|
+
_substrat_entitlements: { to: 'tenant', rfc: 'D, projected to scopes as today' },
|
|
55
|
+
_substrat_identity_pools: { to: 'registry', rfc: 'G' },
|
|
56
|
+
_substrat_connections: { to: 'tenant', rfc: 'D' },
|
|
57
|
+
_substrat_connection_secrets: { to: 'tenant', rfc: 'D, sealed as today' },
|
|
58
|
+
_substrat_connection_keys: { to: 'tenant', rfc: 'D' },
|
|
59
|
+
_substrat_connection_grants: { to: 'tenant', rfc: 'D' },
|
|
60
|
+
_substrat_connector_state: { to: 'tenant', rfc: 'D' },
|
|
61
|
+
_substrat_identities: { to: 'tenant', rfc: 'D; the cross-tenant "which tenants does this person belong to" read to X' },
|
|
62
|
+
_substrat_access_log: { to: 'both', rfc: 'written in the object read (D or G), shipped to L' },
|
|
63
|
+
_substrat_subject_keys: { to: 'tenant', rfc: 'D (never beside the scope’s own data)' },
|
|
64
|
+
_substrat_admin_log: { to: 'both', rfc: 'written in the object that changes (D or G), shipped to L; recent window kept in the object' },
|
|
65
|
+
_substrat_ops_failures: { to: 'both', rfc: 'L (+ recent window in D, platform-level rows in G)' },
|
|
66
|
+
_substrat_issues: { to: 'registry', rfc: 'G (platform operations), fed from L' },
|
|
67
|
+
_substrat_sweep_runs: {
|
|
68
|
+
to: 'tenant',
|
|
69
|
+
rfc: 'the cadence guard’s last row in D; history to L',
|
|
70
|
+
ambiguous: 'Units that are not a tenant’s (a store driver walk, the directory’s own backfill) record sweep outcomes today. ' +
|
|
71
|
+
'The RFC places the table in D only; such rows have no object until it says where.',
|
|
72
|
+
},
|
|
73
|
+
_substrat_model_usage: { to: 'tenant', rfc: 'D window + L' },
|
|
74
|
+
_substrat_build_usage: { to: 'tenant', rfc: 'D window + L' },
|
|
75
|
+
_substrat_markup_schedule: { to: 'both', rfc: 'G for defaults; per-tenant rows in D' },
|
|
76
|
+
scope_lifecycle_receipts: { to: 'tenant', rfc: 'D' },
|
|
77
|
+
scope_tenant_asks: { to: 'tenant', rfc: 'D' },
|
|
78
|
+
scope_lifecycle_failures: { to: 'tenant', rfc: 'D' },
|
|
79
|
+
lifecycle_revisions: {
|
|
80
|
+
to: 'tenant',
|
|
81
|
+
rfc: 'D (scope and tenant counters live with what they count)',
|
|
82
|
+
ambiguous: 'The table also holds `directory:epoch`, the history the whole directory is in (minted by every restore). ' +
|
|
83
|
+
'Assumed: each tenant object keeps its own epoch, minted when it is restored, and a deployment orders a ' +
|
|
84
|
+
'scope’s deliveries by its tenant object’s epoch. The RFC does not say.',
|
|
85
|
+
},
|
|
86
|
+
// ── rfc §3.2, the tables in kernel-owned fragments ─────────────────────────────────────────
|
|
87
|
+
peer_bindings: {
|
|
88
|
+
to: 'tenant',
|
|
89
|
+
rfc: 'D (a cross-tenant one is a dependency, K-64, and lives in both)',
|
|
90
|
+
ambiguous: '"Both" read as both tenants’ objects, never the registry.',
|
|
91
|
+
},
|
|
92
|
+
store_driver_releases: { to: 'registry', rfc: 'G' },
|
|
93
|
+
store_driver_approvals: { to: 'registry', rfc: 'G' },
|
|
94
|
+
store_driver_revoke_walks: { to: 'registry', rfc: 'G' },
|
|
95
|
+
store_driver_current: { to: 'registry', rfc: 'G' },
|
|
96
|
+
store_driver_holds: { to: 'registry', rfc: 'G' },
|
|
97
|
+
store_driver_rebuilds: { to: 'registry', rfc: 'G' },
|
|
98
|
+
store_driver_rollouts: { to: 'registry', rfc: 'G' },
|
|
99
|
+
store_driver_rollout_walks: { to: 'registry', rfc: 'G' },
|
|
100
|
+
vertical_version_migrations: { to: 'registry', rfc: 'G, or R2 by version id' },
|
|
101
|
+
vertical_scope_stores: { to: 'registry', rfc: 'G' },
|
|
102
|
+
vertical_scope_store_versions: { to: 'registry', rfc: 'G' },
|
|
103
|
+
vertical_scope_store_indexed: { to: 'registry', rfc: 'G' },
|
|
104
|
+
vertical_wire_auth: { to: 'registry', rfc: 'G' },
|
|
105
|
+
_substrat_connect_links: { to: 'tenant', rfc: 'D' },
|
|
106
|
+
_substrat_impersonations: { to: 'tenant', rfc: 'D' },
|
|
107
|
+
_substrat_system_switches: { to: 'tenant', rfc: 'D' },
|
|
108
|
+
_substrat_peer_switches: { to: 'tenant', rfc: 'D' },
|
|
109
|
+
_substrat_switch_owed: { to: 'tenant', rfc: 'D' },
|
|
110
|
+
_substrat_membership_fences: { to: 'tenant', rfc: 'D' },
|
|
111
|
+
_substrat_findings: { to: 'tenant', rfc: 'D' },
|
|
112
|
+
_substrat_finding_rules: { to: 'tenant', rfc: 'D' },
|
|
113
|
+
_substrat_scope_storage: { to: 'tenant', rfc: 'D window + L' },
|
|
114
|
+
_substrat_scope_storage_attempts: { to: 'tenant', rfc: 'D window + L' },
|
|
115
|
+
_substrat_scope_attachment_storage: { to: 'tenant', rfc: 'D window + L' },
|
|
116
|
+
_substrat_scope_store_storage: { to: 'tenant', rfc: 'D window + L' },
|
|
117
|
+
_substrat_request_days: {
|
|
118
|
+
to: 'lake',
|
|
119
|
+
rfc: 'L (+ the meter’s window in D)',
|
|
120
|
+
ambiguous: '"the meter’s window in D" read as `_substrat_meter_days`’s window; request days themselves go to the lake only (§7.4: "written to the lake").',
|
|
121
|
+
},
|
|
122
|
+
_substrat_request_day_reads: {
|
|
123
|
+
to: 'registry',
|
|
124
|
+
rfc: '(not named; the request rollup’s per-day read cursor)',
|
|
125
|
+
ambiguous: 'The central daily read stays central (§7.4), and its per-day cursor goes with it: assumed the registry.',
|
|
126
|
+
},
|
|
127
|
+
_substrat_cost_days: { to: 'lake', rfc: 'L' },
|
|
128
|
+
_substrat_cost_day_reads: {
|
|
129
|
+
to: 'registry',
|
|
130
|
+
rfc: '(not named; the cost rollup’s per-day read cursor)',
|
|
131
|
+
ambiguous: 'As `_substrat_request_day_reads`: the central read’s cursor, assumed the registry.',
|
|
132
|
+
},
|
|
133
|
+
_substrat_scope_objects: { to: 'tenant', rfc: 'the object-id map in D and X' },
|
|
134
|
+
_substrat_scope_object_reads: {
|
|
135
|
+
to: 'tenant',
|
|
136
|
+
rfc: '(not named; per-scope failures of the object-id map’s read)',
|
|
137
|
+
ambiguous: 'Keyed by scope, so assumed beside the map it fails to fill, in D.',
|
|
138
|
+
},
|
|
139
|
+
_substrat_meter_days: { to: 'tenant', rfc: 'D window + L' },
|
|
140
|
+
_substrat_meter_day_takes: {
|
|
141
|
+
to: 'registry',
|
|
142
|
+
rfc: '(not named; the central meter snapshot’s per-day progress)',
|
|
143
|
+
ambiguous: 'Today one central pass snapshots every tenant per day. Under K-69 the tenant object writes its own on its ' +
|
|
144
|
+
'first wake of a day and this table has nothing left to record. Assumed the registry until then.',
|
|
145
|
+
},
|
|
146
|
+
_substrat_stale_scopes: {
|
|
147
|
+
to: 'registry',
|
|
148
|
+
rfc: '§7.2 "Platform reports": G (platform operations)',
|
|
149
|
+
ambiguous: 'Added by #3393 after §3 was written, so it has no §3 row; placed by §7.2.',
|
|
150
|
+
},
|
|
151
|
+
_substrat_stale_scope_takes: {
|
|
152
|
+
to: 'registry',
|
|
153
|
+
rfc: '§7.2 "Platform reports": G (platform operations)',
|
|
154
|
+
ambiguous: 'Added by #3393 after §3 was written; placed by §7.2.',
|
|
155
|
+
},
|
|
156
|
+
_substrat_vertical_owners: { to: 'registry', rfc: 'G' },
|
|
157
|
+
// ── #3403 (K-70 step 2), added after §3 was written ────────────────────────────────────────
|
|
158
|
+
_substrat_directory_outbox: {
|
|
159
|
+
to: 'both',
|
|
160
|
+
rfc: '§12 step 2: "ship to the lake through an outbox in the directory"',
|
|
161
|
+
ambiguous: 'Added by #3403 after §3 was written. The data sets it ships (admin log, access log, ops failures) are written ' +
|
|
162
|
+
'in both objects, and K-70 has each object ship its own; assumed every object keeps its own outbox.',
|
|
163
|
+
},
|
|
164
|
+
_substrat_directory_capture: {
|
|
165
|
+
to: 'both',
|
|
166
|
+
rfc: '(not named; #3403’s per-data-set capture switch)',
|
|
167
|
+
ambiguous: 'Added by #3403. Goes with the outbox it switches: assumed one switch per object, set per object.',
|
|
168
|
+
},
|
|
169
|
+
};
|
|
170
|
+
const placedIn = (object) => (table) => {
|
|
171
|
+
const placement = DIRECTORY_PLACEMENT[table];
|
|
172
|
+
if (!placement)
|
|
173
|
+
throw new Error(`directory table ${table} has no placement: add it to DIRECTORY_PLACEMENT (K-68)`);
|
|
174
|
+
return placement.to === object || placement.to === 'both';
|
|
175
|
+
};
|
|
176
|
+
/** The table a directory DDL statement builds: a `CREATE TABLE`'s name, or the table an index is on. */
|
|
177
|
+
export function tableOfStatement(stmt) {
|
|
178
|
+
const table = /^\s*CREATE\s+TABLE\s+IF\s+NOT\s+EXISTS\s+"?([A-Za-z_][A-Za-z0-9_]*)"?/i.exec(stmt);
|
|
179
|
+
if (table)
|
|
180
|
+
return table[1];
|
|
181
|
+
const index = /^\s*CREATE\s+(?:UNIQUE\s+)?INDEX\s+IF\s+NOT\s+EXISTS\s+\S+\s+ON\s+"?([A-Za-z_][A-Za-z0-9_]*)"?/i.exec(stmt);
|
|
182
|
+
if (index)
|
|
183
|
+
return index[1];
|
|
184
|
+
throw new Error(`a directory DDL statement this placement cannot read: ${stmt.slice(0, 120)}`);
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* The columns `ensureDirectoryColumns` (`control-plane-do.ts`) ALTERs into a directory after its
|
|
188
|
+
* first shape, in its order, plus the two `buildDirectorySchema` adds after #1764's statements.
|
|
189
|
+
* A copy, held to a built directory by `test/directory-objects.test.ts`, which compares each table's
|
|
190
|
+
* stored `CREATE` text (so column order too) and its indexes. Some entries are already in their
|
|
191
|
+
* table's `CREATE` and are a tolerated duplicate on a fresh object, as they are on a fresh directory;
|
|
192
|
+
* they are kept so the list reads line for line against `ensureDirectoryColumns`.
|
|
193
|
+
*/
|
|
194
|
+
const SCOPE_COLUMNS = [
|
|
195
|
+
'parent_scope_id TEXT', 'slug TEXT', 'kind TEXT', 'name TEXT', 'vertical TEXT', 'vertical_version_id TEXT',
|
|
196
|
+
'erasure_epoch INTEGER', 'reap_claimed_at TEXT', 'stores_fenced_at TEXT', 'provisioned_version_id TEXT',
|
|
197
|
+
'retirements_finished_version_id TEXT', 'bound_shapes TEXT', 'migration_failed_version TEXT', 'migration_error TEXT',
|
|
198
|
+
'migration_attempts INTEGER NOT NULL DEFAULT 0', 'migration_last_attempt_at TEXT', 'forked_from TEXT', 'forked_at TEXT',
|
|
199
|
+
'expires_at TEXT', 'serving_ref TEXT', 'archived_at TEXT', 'archived_from_status TEXT',
|
|
200
|
+
];
|
|
201
|
+
export const DIRECTORY_COLUMNS_ADDED = [
|
|
202
|
+
...SCOPE_COLUMNS.map((c) => ['scopes', c]),
|
|
203
|
+
['tenants', 'deleting_at TEXT'],
|
|
204
|
+
['scope_lifecycle_receipts', 'tenant_recorded INTEGER'],
|
|
205
|
+
['tenants', 'provisioned_by_tenant TEXT REFERENCES tenants(tenant_id)'],
|
|
206
|
+
['hostnames', 'custom_hostname_id TEXT'],
|
|
207
|
+
['hostnames', 'validation_records TEXT'],
|
|
208
|
+
['_substrat_tenant_tuples', 'revoked_at TEXT'],
|
|
209
|
+
['_substrat_admin_log', 'caused_by TEXT'],
|
|
210
|
+
['_substrat_admin_log', 'on_behalf_of TEXT'],
|
|
211
|
+
['_substrat_access_log', 'on_behalf_of TEXT'],
|
|
212
|
+
['_substrat_ops_failures', 'version TEXT'],
|
|
213
|
+
['_substrat_ops_failures', 'origin TEXT'],
|
|
214
|
+
['_substrat_ops_failures', 'code TEXT'],
|
|
215
|
+
['_substrat_ops_failures', 'fingerprint TEXT'],
|
|
216
|
+
['_substrat_issues', 'last_version TEXT'],
|
|
217
|
+
['_substrat_issues', 'resolved_version TEXT'],
|
|
218
|
+
['_substrat_issues', 'last_tenant_id TEXT'],
|
|
219
|
+
['_substrat_issues', 'last_owner_kind TEXT'],
|
|
220
|
+
['_substrat_sweep_runs', 'request_id TEXT'],
|
|
221
|
+
['_substrat_sweep_runs', 'event_type TEXT'],
|
|
222
|
+
['_substrat_sweep_runs', 'observed_at TEXT'],
|
|
223
|
+
['_substrat_sweep_runs', 'platform_requests TEXT'],
|
|
224
|
+
['_substrat_connections', 'owner_scope_id TEXT'],
|
|
225
|
+
['verticals', 'owner_tenant TEXT'],
|
|
226
|
+
['verticals', 'env_spec TEXT'],
|
|
227
|
+
['verticals', 'install_spec TEXT'],
|
|
228
|
+
['verticals', 'listed INTEGER NOT NULL DEFAULT 0'],
|
|
229
|
+
['verticals', 'publish_requested_at TEXT'],
|
|
230
|
+
['verticals', 'installs_blocked INTEGER NOT NULL DEFAULT 0'],
|
|
231
|
+
['verticals', 'tenant_provisioner INTEGER NOT NULL DEFAULT 0'],
|
|
232
|
+
['verticals', 'email_sender INTEGER NOT NULL DEFAULT 0'],
|
|
233
|
+
['verticals', 'serving_ref TEXT'],
|
|
234
|
+
['verticals', 'serving_version_id TEXT'],
|
|
235
|
+
['verticals', 'serving_do_classes TEXT'],
|
|
236
|
+
['verticals', 'serving_migration_tag TEXT'],
|
|
237
|
+
['vertical_versions', 'manifest_json TEXT'],
|
|
238
|
+
['vertical_versions', 'origin_json TEXT'],
|
|
239
|
+
['vertical_versions', 'migration_count INTEGER'],
|
|
240
|
+
['vertical_versions', 'migrations_split INTEGER'],
|
|
241
|
+
['vertical_versions', 'migration_digest_derived INTEGER'],
|
|
242
|
+
['vertical_versions', 'migrations_extracted TEXT'],
|
|
243
|
+
['_substrat_entitlements', 'expires_at TEXT'],
|
|
244
|
+
['_substrat_entitlements', 'quota INTEGER'],
|
|
245
|
+
['_substrat_entitlements', 'plan TEXT'],
|
|
246
|
+
['_substrat_entitlements', 'granted_at TEXT'],
|
|
247
|
+
['_substrat_entitlements', 'granted_by TEXT'],
|
|
248
|
+
];
|
|
249
|
+
/** Added by `buildDirectorySchema` after #1764's held-back statements, which create the first table. */
|
|
250
|
+
const COLUMNS_ADDED_AFTER_HELD = [
|
|
251
|
+
['vertical_version_migrations', 'declarations TEXT'],
|
|
252
|
+
['_substrat_roles', 'holder TEXT'],
|
|
253
|
+
];
|
|
254
|
+
/** The indexes `ensureDirectoryColumns` creates after its columns (a copy, held as the columns are). */
|
|
255
|
+
const INDEXES_ADDED = [
|
|
256
|
+
'CREATE INDEX IF NOT EXISTS _substrat_ops_failures_fingerprint ON _substrat_ops_failures (fingerprint, id)',
|
|
257
|
+
"CREATE UNIQUE INDEX IF NOT EXISTS scopes_tenant_slug ON scopes (tenant_id, slug) WHERE status NOT IN ('archived', 'reaped')",
|
|
258
|
+
'CREATE UNIQUE INDEX IF NOT EXISTS tenants_slug ON tenants (slug)',
|
|
259
|
+
'CREATE UNIQUE INDEX IF NOT EXISTS orgs_tenant_slug ON orgs (tenant_id, slug)',
|
|
260
|
+
];
|
|
261
|
+
/**
|
|
262
|
+
* The schema of a new directory object, in the order the directory itself builds it: the placed
|
|
263
|
+
* statements of the DDL's first pass, the placed columns, #1764's held-back statements, the two
|
|
264
|
+
* later columns, the placed indexes, then the object's own crossing tables.
|
|
265
|
+
*/
|
|
266
|
+
export function directoryObjectSchema(object) {
|
|
267
|
+
const placed = placedIn(object);
|
|
268
|
+
const statements = (stmts) => stmts.filter((s) => placed(tableOfStatement(s))).map((exec) => ({ exec }));
|
|
269
|
+
const columns = (list) => list.filter(([t]) => placed(t)).map((addColumn) => ({ addColumn }));
|
|
270
|
+
return [
|
|
271
|
+
...statements(DIRECTORY_DDL_PLAN.loop),
|
|
272
|
+
...columns(DIRECTORY_COLUMNS_ADDED),
|
|
273
|
+
...statements(DIRECTORY_DDL_PLAN.afterColumns),
|
|
274
|
+
...columns(COLUMNS_ADDED_AFTER_HELD),
|
|
275
|
+
...statements(INDEXES_ADDED),
|
|
276
|
+
...executableSqlStatements(DIRECTORY_CROSSINGS_DDL).map((exec) => ({ exec })),
|
|
277
|
+
...(object === 'registry' ? executableSqlStatements(DIRECTORY_CLAIMS_DDL).map((exec) => ({ exec })) : []),
|
|
278
|
+
];
|
|
279
|
+
}
|
|
280
|
+
/** Every table the directory's DDL builds, in the order it builds them. */
|
|
281
|
+
export function directoryTables() {
|
|
282
|
+
const tables = [...DIRECTORY_DDL_PLAN.loop, ...DIRECTORY_DDL_PLAN.afterColumns]
|
|
283
|
+
.filter((s) => /^\s*CREATE\s+TABLE/i.test(s))
|
|
284
|
+
.map(tableOfStatement);
|
|
285
|
+
return [...new Set(tables)];
|
|
286
|
+
}
|
|
287
|
+
//# sourceMappingURL=directory-placement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"directory-placement.js","sourceRoot":"","sources":["../src/directory-placement.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC9G,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAY3D,MAAM,CAAC,MAAM,mBAAmB,GAA6C;IAC3E,8FAA8F;IAC9F,OAAO,EAAE;QACP,EAAE,EAAE,MAAM;QACV,GAAG,EAAE,iFAAiF;QACtF,SAAS,EACP,2GAA2G;YAC3G,8GAA8G;YAC9G,2HAA2H;KAC9H;IACD,MAAM,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,8BAA8B,EAAE;IAC7D,mBAAmB,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,yCAAyC,EAAE;IACrF,SAAS,EAAE;QACT,EAAE,EAAE,QAAQ;QACZ,GAAG,EAAE,qDAAqD;QAC1D,SAAS,EACP,8GAA8G;YAC9G,4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