@impetik/xeer-mcp 0.2.16 → 0.2.18
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/package.json +2 -2
- package/vendor/spec/actions.d.ts +5 -5
- package/vendor/spec/actions.js +11 -6
- package/vendor/spec/admin.d.ts +7 -5
- package/vendor/spec/admin.js +7 -21
- package/vendor/spec/diagnostics.js +99 -10
- package/vendor/spec/import-policy.d.ts +172 -0
- package/vendor/spec/import-policy.js +216 -0
- package/vendor/spec/index.d.ts +2 -0
- package/vendor/spec/index.js +2 -0
- package/vendor/spec/local-identity.d.ts +83 -8
- package/vendor/spec/local-identity.js +135 -11
- package/vendor/spec/page-cursor.d.ts +26 -0
- package/vendor/spec/page-cursor.js +45 -0
- package/vendor/spec/public-assets.d.ts +9 -6
- package/vendor/spec/public-assets.js +4 -3
- package/vendor/spec/review.js +2 -0
- package/vendor/spec/route.d.ts +13 -0
- package/vendor/spec/route.js +33 -0
- package/vendor/spec/schema-lifecycle.d.ts +10 -4
- package/vendor/spec/schema-lifecycle.js +32 -4
- package/vendor/spec/schema-plan.d.ts +10 -1
- package/vendor/spec/schema-plan.js +22 -3
- package/vendor/spec/schema.d.ts +16 -0
- package/vendor/spec/schema.js +44 -0
- package/vendor/spec/state-export.d.ts +22 -0
- package/vendor/spec/state-export.js +42 -2
- package/vendor/spec/type-check-profile.d.ts +67 -0
- package/vendor/spec/type-check-profile.js +78 -0
- package/vendor/spec/types.d.ts +134 -1
- package/vendor/spec/types.js +10 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The platform TypeScript profile, in the spelling a `tsconfig.json` uses.
|
|
3
|
+
*
|
|
4
|
+
* `xeer check` type-checks an application with its own compiler options rather than the project's
|
|
5
|
+
* `tsconfig.json`, because the answer must not depend on a file the author can edit. The editor,
|
|
6
|
+
* however, reads only the `tsconfig.json` — so anything the platform enforces and the scaffold omits
|
|
7
|
+
* shows up as a green editor and a red CLI, which is what `exactOptionalPropertyTypes` did (#248).
|
|
8
|
+
*
|
|
9
|
+
* The repair is not to copy the flags into the scaffold: a copy is a thing that drifts. This module
|
|
10
|
+
* is the one declaration. The compiler converts it into `ts.CompilerOptions` for the check, and the
|
|
11
|
+
* scaffold writes it into `tsconfig.json` verbatim, so the two cannot disagree without this file
|
|
12
|
+
* changing. It lives in the spec package rather than the compiler so that writing a scaffold does
|
|
13
|
+
* not require loading TypeScript.
|
|
14
|
+
*
|
|
15
|
+
* Values are the JSON spellings TypeScript accepts in a `tsconfig.json` (`"esnext"`, `"bundler"`,
|
|
16
|
+
* `"react-jsx"`, `lib` without the `lib.`/`.d.ts` affixes), which is what
|
|
17
|
+
* `ts.convertCompilerOptionsFromJson` reads.
|
|
18
|
+
*/
|
|
19
|
+
export const PLATFORM_TYPE_CHECK_COMPILER_OPTIONS = Object.freeze({
|
|
20
|
+
allowJs: true,
|
|
21
|
+
allowArbitraryExtensions: true,
|
|
22
|
+
checkJs: true,
|
|
23
|
+
exactOptionalPropertyTypes: true,
|
|
24
|
+
jsx: 'react-jsx',
|
|
25
|
+
jsxImportSource: '@impetik/xeer',
|
|
26
|
+
lib: Object.freeze(['es2022', 'dom', 'dom.iterable']),
|
|
27
|
+
module: 'esnext',
|
|
28
|
+
moduleResolution: 'bundler',
|
|
29
|
+
noEmit: true,
|
|
30
|
+
noUncheckedIndexedAccess: true,
|
|
31
|
+
skipLibCheck: true,
|
|
32
|
+
strict: true,
|
|
33
|
+
target: 'es2022',
|
|
34
|
+
types: Object.freeze([]),
|
|
35
|
+
verbatimModuleSyntax: true,
|
|
36
|
+
});
|
|
37
|
+
/**
|
|
38
|
+
* The React-family editor mappings every scaffolded and template `tsconfig.json` carries. Each
|
|
39
|
+
* target is a shim inside the installed platform package that re-exports the platform's
|
|
40
|
+
* `preact/compat` surface, so the mapping resolves under npm hoisting and pnpm strictness alike.
|
|
41
|
+
*
|
|
42
|
+
* Not part of {@link PLATFORM_TYPE_CHECK_COMPILER_OPTIONS}: the platform check answers the same
|
|
43
|
+
* question through its module-resolution host instead, so this is the editor's half of one rule
|
|
44
|
+
* rather than a second rule.
|
|
45
|
+
*/
|
|
46
|
+
export const REACT_COMPAT_TSCONFIG_PATHS = Object.freeze({
|
|
47
|
+
'react': ['./node_modules/@impetik/xeer/dist/compat/react'],
|
|
48
|
+
'react-dom': ['./node_modules/@impetik/xeer/dist/compat/react-dom'],
|
|
49
|
+
'react-dom/client': ['./node_modules/@impetik/xeer/dist/compat/react-dom-client'],
|
|
50
|
+
'react/jsx-runtime': ['./node_modules/@impetik/xeer/dist/compat/react-jsx-runtime'],
|
|
51
|
+
'react/jsx-dev-runtime': ['./node_modules/@impetik/xeer/dist/compat/react-jsx-dev-runtime'],
|
|
52
|
+
});
|
|
53
|
+
/**
|
|
54
|
+
* The files an application's `tsconfig.json` type-checks: sources, TypeScript tests, and the
|
|
55
|
+
* generated contract.
|
|
56
|
+
*
|
|
57
|
+
* `tests/**\/*.ts` rather than `tests`, because the profile enables `checkJs` and the two sides build
|
|
58
|
+
* their file sets differently. The platform checks the entrypoint graph plus `tests/**\/*.test.ts`,
|
|
59
|
+
* so a `.js` file it reaches is a file it judges; a tsconfig's set is a directory glob, and `tests`
|
|
60
|
+
* would additionally drag in a `.mjs` harness written for Node — a file neither side is judging the
|
|
61
|
+
* same way. Restricting the glob to TypeScript keeps the two sets comparable without weakening any
|
|
62
|
+
* rule that decides how a checked file is judged.
|
|
63
|
+
*/
|
|
64
|
+
export const APPLICATION_TSCONFIG_INCLUDE = Object.freeze(['src', 'tests/**/*.ts', '.xeer/generated/**/*.d.ts']);
|
|
65
|
+
/**
|
|
66
|
+
* The `tsconfig.json` document an application carries, as a serialized file body.
|
|
67
|
+
*
|
|
68
|
+
* One function so the scaffold, the checked-in templates, and any conformance test all name the same
|
|
69
|
+
* bytes. Serialized here rather than returned as an object because "the file the editor reads" is
|
|
70
|
+
* what has to match, and two callers stringifying the same object with different options would
|
|
71
|
+
* produce two different files.
|
|
72
|
+
*/
|
|
73
|
+
export function applicationTsconfigDocument() {
|
|
74
|
+
return `${JSON.stringify({
|
|
75
|
+
compilerOptions: { ...PLATFORM_TYPE_CHECK_COMPILER_OPTIONS, paths: REACT_COMPAT_TSCONFIG_PATHS },
|
|
76
|
+
include: APPLICATION_TSCONFIG_INCLUDE,
|
|
77
|
+
}, null, 2)}\n`;
|
|
78
|
+
}
|
package/vendor/spec/types.d.ts
CHANGED
|
@@ -16,6 +16,20 @@ export interface Diagnostic {
|
|
|
16
16
|
file?: string;
|
|
17
17
|
span?: SourceSpan;
|
|
18
18
|
hint?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Set on a diagnostic that invalidated the generated contract: the compiler could not describe the
|
|
21
|
+
* application's operations, so every type derived from them is wrong downstream. Absent means
|
|
22
|
+
* "nothing is known", not "not primary" — a consumer that ignores the field reads the envelope
|
|
23
|
+
* exactly as it did before the field existed.
|
|
24
|
+
*/
|
|
25
|
+
primary?: true;
|
|
26
|
+
/**
|
|
27
|
+
* The `code` of the contract-invalidating diagnostic this one is a consequence of. Present only
|
|
28
|
+
* when the causal link is structural — the file consumes the contract the primary diagnostic
|
|
29
|
+
* broke — and never on a diagnostic in a file that carries a primary. Repair the primaries and
|
|
30
|
+
* re-run: a `causedBy` diagnostic that survives is a real error carrying its own location.
|
|
31
|
+
*/
|
|
32
|
+
causedBy?: string;
|
|
19
33
|
}
|
|
20
34
|
/**
|
|
21
35
|
* `ref` is a scalar in the only sense that matters here: it is one TEXT column holding one row id.
|
|
@@ -92,6 +106,22 @@ export interface TableDefinition {
|
|
|
92
106
|
unique?: string[][];
|
|
93
107
|
/** Table-level CHECK expressions by name. The name is what SQLite reports when one fails. */
|
|
94
108
|
checks?: Record<string, string>;
|
|
109
|
+
/**
|
|
110
|
+
* Who chooses a row's `id`. Defaults to `"runtime"`, which mints an unguessable uuid and refuses
|
|
111
|
+
* an `id` on insert.
|
|
112
|
+
*
|
|
113
|
+
* `"application"` makes `insert({ id, … })` required for this table and this table only, so a row
|
|
114
|
+
* can *be* the thing an outside system already names — the case this exists for is a `workspaces`
|
|
115
|
+
* row whose id is the identity provider's workspace id, which makes `ref` and
|
|
116
|
+
* `workspaceTable({ workspaceField: 'id' })` work against it without a second column to join
|
|
117
|
+
* through (decision 0006).
|
|
118
|
+
*
|
|
119
|
+
* Opt-in per table so the default stays the safe one: an application that does not ask for this
|
|
120
|
+
* cannot accidentally accept a client-chosen id. Nothing about the column changes — `id` is
|
|
121
|
+
* `TEXT PRIMARY KEY` either way — so a collision is the primary key's own constraint rather than
|
|
122
|
+
* new machinery, and turning this on or off is physically compatible with the rows already stored.
|
|
123
|
+
*/
|
|
124
|
+
idSource?: 'runtime' | 'application';
|
|
95
125
|
}
|
|
96
126
|
/**
|
|
97
127
|
* The capabilities an application may declare. A capability name in `capabilities[]` and its config
|
|
@@ -101,6 +131,16 @@ export interface TableDefinition {
|
|
|
101
131
|
*/
|
|
102
132
|
export declare const CAPABILITIES: readonly ["database", "storage"];
|
|
103
133
|
export type Capability = (typeof CAPABILITIES)[number];
|
|
134
|
+
/**
|
|
135
|
+
* Bytes one streamed endpoint response may pump when `budgets.streamedBytes` is not declared.
|
|
136
|
+
*
|
|
137
|
+
* Applied where the budget is *read* rather than where the manifest is normalized, because
|
|
138
|
+
* normalized budgets go into the artifact payload verbatim: materializing this default would move
|
|
139
|
+
* the `artifactId` of every application that never asked for a streamed response. It matches the
|
|
140
|
+
* `responseBytes` default so that turning an endpoint from buffered to streamed does not silently
|
|
141
|
+
* change how many bytes it may send.
|
|
142
|
+
*/
|
|
143
|
+
export declare const STREAMED_BYTES_DEFAULT = 1048576;
|
|
104
144
|
/**
|
|
105
145
|
* The `storage` capability's declared limits. Every field is optional and normalized to a default,
|
|
106
146
|
* and every one is a *logical* limit — a byte count the runtime enforces at call time. Nothing here
|
|
@@ -141,6 +181,18 @@ export interface ApplicationManifestV0 {
|
|
|
141
181
|
};
|
|
142
182
|
storage?: StorageConfigV0;
|
|
143
183
|
capabilities?: Capability[];
|
|
184
|
+
/**
|
|
185
|
+
* The client runtime selection (#212). Optional, and closed: only implemented provider/source
|
|
186
|
+
* combinations are accepted, and omission normalizes to `{ provider: "preact", source:
|
|
187
|
+
* "platform" }` with identical semantics and build output. Declaring it is a statement of the
|
|
188
|
+
* default, not a choice — a future app-owned source would be `"application"`, not `"user"`.
|
|
189
|
+
*/
|
|
190
|
+
client?: {
|
|
191
|
+
runtime?: {
|
|
192
|
+
provider: 'preact';
|
|
193
|
+
source?: 'platform';
|
|
194
|
+
};
|
|
195
|
+
};
|
|
144
196
|
budgets?: {
|
|
145
197
|
queryRows?: number;
|
|
146
198
|
mutationWrites?: number;
|
|
@@ -152,6 +204,21 @@ export interface ApplicationManifestV0 {
|
|
|
152
204
|
* runtime answers a terminal `live_disabled` without waking the state object.
|
|
153
205
|
*/
|
|
154
206
|
liveConnections?: number;
|
|
207
|
+
/**
|
|
208
|
+
* Bytes one streamed endpoint response may pump through the platform.
|
|
209
|
+
*
|
|
210
|
+
* A streamed body is bounded, not exempt: `responseBytes` bounds a body the platform buffered and
|
|
211
|
+
* can still refuse as a whole, and this bounds one the platform has already begun sending and can
|
|
212
|
+
* only terminate. They are different failures, so they are different ceilings. Exceeding this one
|
|
213
|
+
* aborts the stream mid-body, which the client observes as a failed read rather than a refusal.
|
|
214
|
+
*/
|
|
215
|
+
streamedBytes?: number;
|
|
216
|
+
/**
|
|
217
|
+
* Error-tier byte budget for the minified pre-gzip client JavaScript bundle. Defaults to the
|
|
218
|
+
* platform's 1 MiB when omitted; bounded above by the 10 MiB module ceiling. The advisory tier
|
|
219
|
+
* is fixed and not declarable.
|
|
220
|
+
*/
|
|
221
|
+
clientBundleBytes?: number;
|
|
155
222
|
};
|
|
156
223
|
}
|
|
157
224
|
export interface NormalizedApplicationManifestV0 {
|
|
@@ -176,13 +243,40 @@ export interface NormalizedApplicationManifestV0 {
|
|
|
176
243
|
*/
|
|
177
244
|
storage: NormalizedStorageConfigV0 | null;
|
|
178
245
|
capabilities: Capability[];
|
|
246
|
+
/** Always present once normalized: omission and the explicit default are the same statement. */
|
|
247
|
+
client: {
|
|
248
|
+
runtime: {
|
|
249
|
+
provider: 'preact';
|
|
250
|
+
source: 'platform';
|
|
251
|
+
};
|
|
252
|
+
};
|
|
179
253
|
budgets: {
|
|
180
254
|
queryRows: number;
|
|
181
255
|
mutationWrites: number;
|
|
182
256
|
requestBytes: number;
|
|
183
257
|
responseBytes: number;
|
|
184
|
-
/**
|
|
258
|
+
/**
|
|
259
|
+
* `0` means server push is off for this application; see {@link ApplicationManifestV0}.
|
|
260
|
+
*
|
|
261
|
+
* It is the ceiling on **every** server→client byte channel the state object holds open, not on
|
|
262
|
+
* live invalidation alone: an SSE subscription and a streamed endpoint response occupy the same
|
|
263
|
+
* pool. Two separately-bounded pools would add up to an unbounded total, which is the one answer
|
|
264
|
+
* decision 0007 refused.
|
|
265
|
+
*/
|
|
185
266
|
liveConnections: number;
|
|
267
|
+
/**
|
|
268
|
+
* Bytes one streamed endpoint response may pump; see {@link ApplicationManifestV0}.
|
|
269
|
+
*
|
|
270
|
+
* Present only when the manifest declares it, mirroring `clientBundleBytes` below: an
|
|
271
|
+
* application on the platform default hashes exactly as it did before the budget existed.
|
|
272
|
+
* Read it as `streamedBytes ?? STREAMED_BYTES_DEFAULT`.
|
|
273
|
+
*/
|
|
274
|
+
streamedBytes?: number;
|
|
275
|
+
/**
|
|
276
|
+
* Present only when the manifest declares it, mirroring `storage`: an application on the
|
|
277
|
+
* platform default hashes exactly as it did before the budget was declarable.
|
|
278
|
+
*/
|
|
279
|
+
clientBundleBytes?: number;
|
|
186
280
|
};
|
|
187
281
|
}
|
|
188
282
|
export interface SourceReceipt {
|
|
@@ -190,6 +284,36 @@ export interface SourceReceipt {
|
|
|
190
284
|
size: number;
|
|
191
285
|
hash: `sha256:${string}`;
|
|
192
286
|
}
|
|
287
|
+
/**
|
|
288
|
+
* Provenance for one npm package a zone bundle consumed (#212, #244). `files` receipts the exact
|
|
289
|
+
* bytes the bundler read — strictly stronger than lockfile integrity, which pins tarballs rather
|
|
290
|
+
* than the post-install state a patch or postinstall script left on disk.
|
|
291
|
+
*
|
|
292
|
+
* Deliberately not keyed by zone. A package both bundles consume is one dependency of one
|
|
293
|
+
* application at one version, and receipting it twice would say the artifact used two. The receipt
|
|
294
|
+
* is the union of the files either bundle read, so the same package contributing different modules
|
|
295
|
+
* to each zone is still one entry covering every byte that entered the artifact.
|
|
296
|
+
*/
|
|
297
|
+
export interface BundledDependencyReceiptV0 {
|
|
298
|
+
name: string;
|
|
299
|
+
version: string;
|
|
300
|
+
/** The metafile inputs consumed from this package, package-root-relative, content-hashed. */
|
|
301
|
+
files: SourceReceipt[];
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* The application-dependency provenance block, present in an artifact only when the bundle
|
|
305
|
+
* consumed open dependencies. The lockfile identity is opportunistic — recorded when a parseable
|
|
306
|
+
* npm or pnpm lockfile is found — and never an admission gate: workspace applications have no
|
|
307
|
+
* per-app lockfile at all.
|
|
308
|
+
*/
|
|
309
|
+
export interface BundledDependenciesV0 {
|
|
310
|
+
packages: BundledDependencyReceiptV0[];
|
|
311
|
+
lockfile?: {
|
|
312
|
+
manager: 'npm' | 'pnpm';
|
|
313
|
+
path: string;
|
|
314
|
+
hash: `sha256:${string}`;
|
|
315
|
+
};
|
|
316
|
+
}
|
|
193
317
|
export interface ApplicationSchemaIdentityV0 {
|
|
194
318
|
applicationSchemaVersion: number;
|
|
195
319
|
schemaHash: `sha256:${string}`;
|
|
@@ -222,6 +346,13 @@ export interface ApplicationArtifactV0 {
|
|
|
222
346
|
* artifact binds different buckets in preview and production, which is correct (#51 §7).
|
|
223
347
|
*/
|
|
224
348
|
storage?: NormalizedStorageConfigV0;
|
|
349
|
+
/**
|
|
350
|
+
* The normalized client runtime, recorded when the application declares `client` or the *client*
|
|
351
|
+
* bundle consumed open dependencies. Present-only-then for the same reason as `storage`: an
|
|
352
|
+
* untouched application keeps its `artifactId` (#212). A server-only dependency does not record
|
|
353
|
+
* it — nothing about the renderer was chosen by importing one (#244).
|
|
354
|
+
*/
|
|
355
|
+
clientRuntime?: NormalizedApplicationManifestV0['client']['runtime'];
|
|
225
356
|
budgets: NormalizedApplicationManifestV0['budgets'];
|
|
226
357
|
schema: NormalizedApplicationManifestV0['database'];
|
|
227
358
|
schemaIdentity: ApplicationSchemaIdentityV0;
|
|
@@ -264,6 +395,8 @@ export interface ApplicationArtifactV0 {
|
|
|
264
395
|
publicAssets: PublicAssetsV0;
|
|
265
396
|
source: {
|
|
266
397
|
files: SourceReceipt[];
|
|
398
|
+
/** Present only when the client bundle consumed open application dependencies (#212). */
|
|
399
|
+
dependencies?: BundledDependenciesV0;
|
|
267
400
|
};
|
|
268
401
|
}
|
|
269
402
|
export interface DevEvent<T = unknown> {
|
package/vendor/spec/types.js
CHANGED
|
@@ -9,3 +9,13 @@ export const INSPECT_PROTOCOL = 'xeer.inspect.v0';
|
|
|
9
9
|
* Cloudflare-primitive-backed capability to follow it (#29, design in #51).
|
|
10
10
|
*/
|
|
11
11
|
export const CAPABILITIES = Object.freeze(['database', 'storage']);
|
|
12
|
+
/**
|
|
13
|
+
* Bytes one streamed endpoint response may pump when `budgets.streamedBytes` is not declared.
|
|
14
|
+
*
|
|
15
|
+
* Applied where the budget is *read* rather than where the manifest is normalized, because
|
|
16
|
+
* normalized budgets go into the artifact payload verbatim: materializing this default would move
|
|
17
|
+
* the `artifactId` of every application that never asked for a streamed response. It matches the
|
|
18
|
+
* `responseBytes` default so that turning an endpoint from buffered to streamed does not silently
|
|
19
|
+
* change how many bytes it may send.
|
|
20
|
+
*/
|
|
21
|
+
export const STREAMED_BYTES_DEFAULT = 1_048_576;
|