ignotum 0.0.13 → 0.0.15
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/README.md +6 -6
- package/dist/cli/bin.mjs +6111 -4448
- package/dist/cli/bin.mjs.map +1 -1
- package/dist/cli/emscripten-module-D5GzfUNv.mjs +533 -0
- package/dist/cli/emscripten-module-D5GzfUNv.mjs.map +1 -0
- package/dist/cli/ffi-7IElU4Co.mjs +148 -0
- package/dist/cli/ffi-7IElU4Co.mjs.map +1 -0
- package/dist/cli/managed-release-WHYLZwaS.mjs +10902 -0
- package/dist/cli/managed-release-WHYLZwaS.mjs.map +1 -0
- package/dist/cli/managed-release.d.mts +1 -0
- package/dist/cli/managed-release.mjs +14 -0
- package/dist/cli/managed-release.mjs.map +1 -0
- package/dist/cli/module-ES6BEMUI-D36I4NVn.mjs +1289 -0
- package/dist/cli/module-ES6BEMUI-D36I4NVn.mjs.map +1 -0
- package/dist/runtime/{api-Cv3hMbzo.d.ts → api-B4fwp5a2.d.ts} +4 -4
- package/dist/runtime/bootstrap-BISQSn_O.js +916 -0
- package/dist/runtime/bootstrap-BISQSn_O.js.map +1 -0
- package/dist/runtime/bootstrap-BTFScKAc.d.ts +545 -0
- package/dist/runtime/client.d.ts +50 -15
- package/dist/runtime/client.js +7 -1138
- package/dist/runtime/client.js.map +1 -1
- package/dist/runtime/descriptor-CTY4mtwS-cS43EbwS.js +269 -0
- package/dist/runtime/descriptor-CTY4mtwS-cS43EbwS.js.map +1 -0
- package/dist/runtime/{id-Bt9XWRGL.js → id--1m0NuUL.js} +4 -4
- package/dist/runtime/id--1m0NuUL.js.map +1 -0
- package/dist/runtime/{id-BzFHf3Wo-DGPCjgrf.d.ts → id-7an3nxTu-DZJSM5xh.d.ts} +2 -2
- package/dist/runtime/id-CBOt2kDo.d.ts +1 -0
- package/dist/runtime/identity-QjtJRxBD.d.ts +2 -0
- package/dist/runtime/image-Djtjy4Z8.js +19 -0
- package/dist/runtime/image-Djtjy4Z8.js.map +1 -0
- package/dist/runtime/index-D4seNHlX.d.ts +184 -0
- package/dist/runtime/internal/api.d.ts +1 -1
- package/dist/runtime/internal/api.js +30 -1
- package/dist/runtime/internal/api.js.map +1 -0
- package/dist/runtime/internal/bootstrap.d.ts +2 -0
- package/dist/runtime/internal/bootstrap.js +2 -0
- package/dist/runtime/internal/client.d.ts +2 -0
- package/dist/runtime/internal/client.js +75 -0
- package/dist/runtime/internal/client.js.map +1 -0
- package/dist/runtime/internal/host.d.ts +25 -8
- package/dist/runtime/internal/host.js +27 -6
- package/dist/runtime/internal/host.js.map +1 -1
- package/dist/runtime/internal/routes.d.ts +2 -0
- package/dist/runtime/internal/routes.js +2 -0
- package/dist/runtime/internal/server.d.ts +1 -1
- package/dist/runtime/internal/server.js +1 -1
- package/dist/runtime/internal/types.d.ts +2 -1
- package/dist/runtime/internal/types.js +1 -1
- package/dist/runtime/pagination-CBOt2kDo.d.ts +1 -0
- package/dist/runtime/pagination-D3qd6s9N.js +33 -0
- package/dist/runtime/pagination-D3qd6s9N.js.map +1 -0
- package/dist/runtime/result-BkziOG1L.d.ts +1 -0
- package/dist/runtime/router-BSBI1oN1.js +2377 -0
- package/dist/runtime/router-BSBI1oN1.js.map +1 -0
- package/dist/runtime/routes-Ce8TVP-T.js +690 -0
- package/dist/runtime/routes-Ce8TVP-T.js.map +1 -0
- package/dist/runtime/{schema-1Zs03-iS.js → schema-D1wOqiNH.js} +40 -12
- package/dist/runtime/schema-D1wOqiNH.js.map +1 -0
- package/dist/runtime/server.d.ts +5 -5
- package/dist/runtime/server.js +2 -2
- package/dist/runtime/{sync-Bs8J3fIr.d.ts → sync-D-GK2sv9.d.ts} +3 -2
- package/dist/runtime/{api-CAgKDij7.js → sync-DzUwA8W9.js} +22 -41
- package/dist/runtime/sync-DzUwA8W9.js.map +1 -0
- package/dist/runtime/types-DeCCyqLU-BIm7rU-0.d.ts +341 -0
- package/package.json +29 -4
- package/src/cli/agent-files.ts +14 -8
- package/src/cli/build/managed-client.ts +411 -0
- package/src/cli/build/managed-server.ts +294 -0
- package/src/cli/build/managed.ts +67 -0
- package/src/cli/build/output.ts +47 -0
- package/src/cli/build/server.ts +51 -220
- package/src/cli/client-config.ts +1 -140
- package/src/cli/client-styles.ts +1 -0
- package/src/cli/codegen.ts +9 -4
- package/src/cli/command.ts +28 -5
- package/src/cli/control-client.ts +84 -101
- package/src/cli/deploy.ts +133 -177
- package/src/cli/dev.ts +506 -107
- package/src/cli/image-assets.ts +499 -0
- package/src/cli/managed-client-boundaries.ts +103 -0
- package/src/cli/managed-dev-platform.ts +118 -0
- package/src/cli/managed-exports.ts +219 -0
- package/src/cli/managed-release-bin.ts +13 -0
- package/src/cli/managed-release.ts +260 -0
- package/src/cli/module-boundaries.ts +11 -1
- package/src/cli/new-app.ts +111 -87
- package/src/cli/route-codegen.ts +311 -0
- package/src/cli/route-static.ts +710 -0
- package/src/client/bootstrap.ts +110 -0
- package/src/client/errors.ts +13 -7
- package/src/client/files.ts +64 -0
- package/src/client/id.ts +9 -5
- package/src/client/image.ts +28 -0
- package/src/client/index.ts +25 -2
- package/src/client/managed-client.ts +729 -0
- package/src/client/managed-upgrade.ts +283 -0
- package/src/client/recovery-journal.ts +195 -0
- package/src/client/route-boundaries.ts +184 -0
- package/src/client/router-history.ts +152 -0
- package/src/client/router-store.ts +644 -0
- package/src/client/router.ts +324 -0
- package/src/client/routes.ts +28 -0
- package/src/client/sync.ts +66 -592
- package/src/dev-runtime/database.ts +77 -2
- package/src/dev-runtime/functions.ts +3 -3
- package/src/dev-runtime/id.ts +19 -4
- package/src/dev-runtime/managed-functions.ts +255 -0
- package/src/dev-runtime/managed-sync.ts +263 -0
- package/src/dev-runtime/managed-websocket.ts +71 -0
- package/src/dev-runtime/migrations.ts +20 -0
- package/src/dev-runtime/sync.ts +236 -236
- package/src/image-assets.d.ts +36 -0
- package/src/internal/client.ts +186 -0
- package/src/internal/host.ts +1 -1
- package/src/internal/http-paths.ts +0 -3
- package/src/internal/routes.ts +45 -0
- package/dist/runtime/api-CAgKDij7.js.map +0 -1
- package/dist/runtime/descriptor-Cyo9FP9n-C0SRVXNW.js +0 -154
- package/dist/runtime/descriptor-Cyo9FP9n-C0SRVXNW.js.map +0 -1
- package/dist/runtime/id-Bt9XWRGL.js.map +0 -1
- package/dist/runtime/id-Dz0apuB3.d.ts +0 -1
- package/dist/runtime/index-D54flWtH.d.ts +0 -402
- package/dist/runtime/pagination-DnKg3dkI-r5ZUxBBx.d.ts +0 -112
- package/dist/runtime/pagination-Dz0apuB3.d.ts +0 -1
- package/dist/runtime/result-DKAA4gpS.d.ts +0 -1
- package/dist/runtime/schema-1Zs03-iS.js.map +0 -1
- package/src/cli/build/client.ts +0 -119
- package/src/cli/build/public.ts +0 -186
- package/src/cli/client-entry.ts +0 -152
- package/src/cli/client-plugin.ts +0 -136
- package/src/client/app.ts +0 -15
|
@@ -0,0 +1,690 @@
|
|
|
1
|
+
import { G as InvocationId, H as AppId, U as GeneratedId, X as defineId, Y as VersionId, m as upgrade, p as initial } from "./id--1m0NuUL.js";
|
|
2
|
+
import { a as ActivationGeneration, c as ClientApiVersion, d as PlatformGeneration, f as PlatformReleaseId, h as VersionNumber, l as DataHistoryId, m as ServerApiVersion, p as ProtocolVersion, s as CapabilityId, t as FunctionAddress } from "./sync-DzUwA8W9.js";
|
|
3
|
+
import { t as ValueDescriptor } from "./descriptor-CTY4mtwS-cS43EbwS.js";
|
|
4
|
+
import { Schema } from "effect";
|
|
5
|
+
//#region ../contracts/dist/runtime/functions.js
|
|
6
|
+
const FunctionKind = Schema.Literals(["Mutation", "Query"]);
|
|
7
|
+
Schema.TaggedError()("UnknownFunction", {
|
|
8
|
+
function: FunctionAddress,
|
|
9
|
+
message: Schema.String
|
|
10
|
+
});
|
|
11
|
+
Schema.TaggedError()("WrongFunctionKind", {
|
|
12
|
+
actual: FunctionKind,
|
|
13
|
+
expected: FunctionKind,
|
|
14
|
+
function: FunctionAddress,
|
|
15
|
+
message: Schema.String
|
|
16
|
+
});
|
|
17
|
+
Schema.TaggedError()("InvalidArguments", {
|
|
18
|
+
function: FunctionAddress,
|
|
19
|
+
message: Schema.String
|
|
20
|
+
});
|
|
21
|
+
Schema.TaggedError()("FunctionUnavailable", {
|
|
22
|
+
cause: Schema.Defect(),
|
|
23
|
+
function: FunctionAddress,
|
|
24
|
+
message: Schema.String
|
|
25
|
+
});
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region ../contracts/dist/version.js
|
|
28
|
+
const ArtifactPath = Schema.String.check(Schema.isPattern(/^(?!\/)(?![A-Za-z]:\/)(?!.*(?:^|\/)\.\.(?:\/|$))(?!.*(?:^|\/)\.(?:\/|$))(?!.*\/\/)[^\\\0]+$/)).pipe(Schema.brand("ignotum/version/ArtifactPath"));
|
|
29
|
+
const ClientPath = Schema.String.check(Schema.isPattern(/^\/(?!_ignotum(?:\/|$))(?:(?:[A-Za-z0-9._~-]+\/)*[A-Za-z0-9._~-]+\/?)?$/)).pipe(Schema.brand("ignotum/version/ClientPath"));
|
|
30
|
+
const Sha256 = Schema.String.check(Schema.isPattern(/^[0-9a-f]{64}$/)).pipe(Schema.brand("ignotum/version/Sha256"));
|
|
31
|
+
const ArtifactKind = Schema.Literals([
|
|
32
|
+
"ClientAsset",
|
|
33
|
+
"ClientDocument",
|
|
34
|
+
"ClientManifest",
|
|
35
|
+
"ClientPublicFile",
|
|
36
|
+
"ClientShell",
|
|
37
|
+
"FunctionBundle",
|
|
38
|
+
"ServerManifest",
|
|
39
|
+
"ServerEnvironment",
|
|
40
|
+
"SourceMap",
|
|
41
|
+
"SchemaSnapshot"
|
|
42
|
+
]);
|
|
43
|
+
const ArtifactReference = Schema.Struct({
|
|
44
|
+
path: ArtifactPath,
|
|
45
|
+
size: Schema.Natural,
|
|
46
|
+
sha256: Sha256
|
|
47
|
+
});
|
|
48
|
+
const ArtifactFile = Schema.Struct({
|
|
49
|
+
path: ArtifactPath,
|
|
50
|
+
size: Schema.Natural,
|
|
51
|
+
sha256: Sha256,
|
|
52
|
+
kind: ArtifactKind,
|
|
53
|
+
contentType: Schema.String,
|
|
54
|
+
contentEncoding: Schema.optional(Schema.String)
|
|
55
|
+
});
|
|
56
|
+
const ClientRoute = Schema.Struct({
|
|
57
|
+
pathname: ClientPath,
|
|
58
|
+
artifact: ArtifactReference
|
|
59
|
+
});
|
|
60
|
+
const VersionInventoryV1 = Schema.Struct({
|
|
61
|
+
formatVersion: Schema.Literal(1),
|
|
62
|
+
files: Schema.Array(ArtifactFile)
|
|
63
|
+
});
|
|
64
|
+
const VersionInventoryV2 = Schema.Struct({
|
|
65
|
+
formatVersion: Schema.Literal(2),
|
|
66
|
+
files: Schema.Array(ArtifactFile)
|
|
67
|
+
});
|
|
68
|
+
upgrade(initial(VersionInventoryV1), VersionInventoryV2, (inventory) => ({
|
|
69
|
+
formatVersion: 2,
|
|
70
|
+
files: inventory.files
|
|
71
|
+
}));
|
|
72
|
+
const ClientManifestV1 = Schema.Struct({
|
|
73
|
+
formatVersion: Schema.Literal(1),
|
|
74
|
+
shell: ArtifactReference,
|
|
75
|
+
routes: Schema.Array(ClientRoute)
|
|
76
|
+
});
|
|
77
|
+
initial(ClientManifestV1);
|
|
78
|
+
const ClientRoutingRoute = Schema.Struct({
|
|
79
|
+
pathname: ClientPath,
|
|
80
|
+
artifact: ArtifactPath
|
|
81
|
+
});
|
|
82
|
+
const ClientRoutingV1 = Schema.Struct({
|
|
83
|
+
formatVersion: Schema.Literal(1),
|
|
84
|
+
shell: ArtifactPath,
|
|
85
|
+
routes: Schema.Array(ClientRoutingRoute)
|
|
86
|
+
});
|
|
87
|
+
initial(ClientRoutingV1);
|
|
88
|
+
const SchemaSnapshotField = Schema.Struct({
|
|
89
|
+
name: Schema.String,
|
|
90
|
+
value: ValueDescriptor
|
|
91
|
+
});
|
|
92
|
+
const EnvironmentArtifactV1 = Schema.Struct({
|
|
93
|
+
formatVersion: Schema.Literal(1),
|
|
94
|
+
nonce: Schema.String.check(Schema.isPattern(/^[A-Za-z0-9_-]{43}$/)),
|
|
95
|
+
values: Schema.Record(Schema.String, Schema.String)
|
|
96
|
+
});
|
|
97
|
+
initial(EnvironmentArtifactV1);
|
|
98
|
+
const ServerEnvironmentArtifact = Schema.Struct({
|
|
99
|
+
artifact: ArtifactReference,
|
|
100
|
+
fields: Schema.Array(SchemaSnapshotField)
|
|
101
|
+
});
|
|
102
|
+
const SchemaSnapshotIndex = Schema.Struct({
|
|
103
|
+
name: Schema.String,
|
|
104
|
+
fields: Schema.Array(Schema.String)
|
|
105
|
+
});
|
|
106
|
+
const SchemaSnapshotTableV1 = Schema.Struct({
|
|
107
|
+
name: Schema.String,
|
|
108
|
+
fields: Schema.Array(SchemaSnapshotField)
|
|
109
|
+
});
|
|
110
|
+
const SchemaSnapshotV1 = Schema.Struct({
|
|
111
|
+
formatVersion: Schema.Literal(1),
|
|
112
|
+
tables: Schema.Array(SchemaSnapshotTableV1)
|
|
113
|
+
});
|
|
114
|
+
const SchemaSnapshotTable = Schema.Struct({
|
|
115
|
+
name: Schema.String,
|
|
116
|
+
fields: Schema.Array(SchemaSnapshotField),
|
|
117
|
+
indexes: Schema.Array(SchemaSnapshotIndex)
|
|
118
|
+
});
|
|
119
|
+
const SchemaSnapshotV2 = Schema.Struct({
|
|
120
|
+
formatVersion: Schema.Literal(2),
|
|
121
|
+
tables: Schema.Array(SchemaSnapshotTable)
|
|
122
|
+
});
|
|
123
|
+
const SchemaSnapshot = upgrade(initial(SchemaSnapshotV1), SchemaSnapshotV2, (snapshot) => ({
|
|
124
|
+
formatVersion: 2,
|
|
125
|
+
tables: snapshot.tables.map((table) => ({
|
|
126
|
+
...table,
|
|
127
|
+
indexes: []
|
|
128
|
+
}))
|
|
129
|
+
}));
|
|
130
|
+
const ServerFunctionArtifactV1 = Schema.Struct({
|
|
131
|
+
address: FunctionAddress,
|
|
132
|
+
kind: FunctionKind,
|
|
133
|
+
bundle: ArtifactReference,
|
|
134
|
+
sourceMap: ArtifactReference
|
|
135
|
+
});
|
|
136
|
+
const ServerFunctionArtifact = Schema.Struct({
|
|
137
|
+
address: FunctionAddress,
|
|
138
|
+
kind: FunctionKind,
|
|
139
|
+
args: Schema.optional(ValueDescriptor),
|
|
140
|
+
returns: Schema.optional(ValueDescriptor),
|
|
141
|
+
errors: Schema.optional(ValueDescriptor),
|
|
142
|
+
bundle: ArtifactReference,
|
|
143
|
+
sourceMap: ArtifactReference
|
|
144
|
+
});
|
|
145
|
+
const ServerBuildManifestV1 = Schema.Struct({
|
|
146
|
+
formatVersion: Schema.Literal(1),
|
|
147
|
+
schema: ArtifactReference,
|
|
148
|
+
functions: Schema.Array(ServerFunctionArtifactV1)
|
|
149
|
+
});
|
|
150
|
+
const ServerBuildManifestV2 = Schema.Struct({
|
|
151
|
+
formatVersion: Schema.Literal(2),
|
|
152
|
+
schema: ArtifactReference,
|
|
153
|
+
functions: Schema.Array(ServerFunctionArtifact)
|
|
154
|
+
});
|
|
155
|
+
const ServerBuildManifestThroughV2 = upgrade(initial(ServerBuildManifestV1), ServerBuildManifestV2, (manifest) => ({
|
|
156
|
+
formatVersion: 2,
|
|
157
|
+
schema: manifest.schema,
|
|
158
|
+
functions: manifest.functions
|
|
159
|
+
}));
|
|
160
|
+
const ServerBuildManifestV3 = Schema.Struct({
|
|
161
|
+
formatVersion: Schema.Literal(3),
|
|
162
|
+
schema: ArtifactReference,
|
|
163
|
+
environment: Schema.optional(ServerEnvironmentArtifact),
|
|
164
|
+
functions: Schema.Array(ServerFunctionArtifact)
|
|
165
|
+
});
|
|
166
|
+
const ServerBuildManifestThroughV3 = upgrade(ServerBuildManifestThroughV2, ServerBuildManifestV3, (manifest) => ({
|
|
167
|
+
formatVersion: 3,
|
|
168
|
+
schema: manifest.schema,
|
|
169
|
+
functions: manifest.functions
|
|
170
|
+
}));
|
|
171
|
+
const ServerBuildManifestV4 = Schema.Struct({
|
|
172
|
+
formatVersion: Schema.Literal(4),
|
|
173
|
+
schema: ArtifactReference,
|
|
174
|
+
environment: Schema.optional(ServerEnvironmentArtifact),
|
|
175
|
+
functions: Schema.Array(ServerFunctionArtifact),
|
|
176
|
+
schemaEvolution: Schema.optional(Schema.Struct({
|
|
177
|
+
bundle: ArtifactReference,
|
|
178
|
+
sourceMap: ArtifactReference
|
|
179
|
+
}))
|
|
180
|
+
});
|
|
181
|
+
upgrade(ServerBuildManifestThroughV3, ServerBuildManifestV4, (manifest) => ({
|
|
182
|
+
...manifest,
|
|
183
|
+
formatVersion: 4
|
|
184
|
+
}));
|
|
185
|
+
ArtifactPath.make("inventory.json");
|
|
186
|
+
ArtifactPath.make("client/manifest.json");
|
|
187
|
+
ArtifactPath.make("client/shell.html");
|
|
188
|
+
`${ArtifactPath.make("client/assets")}`;
|
|
189
|
+
`${ArtifactPath.make("client/routes")}`;
|
|
190
|
+
ArtifactPath.make("server/manifest.json");
|
|
191
|
+
ArtifactPath.make("server/schema.json");
|
|
192
|
+
ArtifactPath.make("server/environment.json");
|
|
193
|
+
//#endregion
|
|
194
|
+
//#region ../contracts/dist/platform.js
|
|
195
|
+
const strict$1 = (fields) => Schema.Struct(fields).annotate({ parseOptions: { onExcessProperty: "error" } });
|
|
196
|
+
const Capabilities = Schema.UniqueArray(CapabilityId).check(Schema.isMaxLength(256));
|
|
197
|
+
const RuntimeRequirements = strict$1({
|
|
198
|
+
clientApiVersion: ClientApiVersion,
|
|
199
|
+
serverApiVersion: ServerApiVersion,
|
|
200
|
+
capabilities: Capabilities
|
|
201
|
+
});
|
|
202
|
+
const BrowserGraphReference = strict$1({
|
|
203
|
+
sha256: Sha256,
|
|
204
|
+
entry: Schema.String.check(Schema.isTrimmed(), Schema.isPattern(/^ignotum\/platform\/browser\/[a-zA-Z0-9_-]+(?:\/[a-zA-Z0-9_-]+)*\.js$/), Schema.isMaxLength(512))
|
|
205
|
+
});
|
|
206
|
+
const GuestGraphReference = strict$1({
|
|
207
|
+
sha256: Sha256,
|
|
208
|
+
entry: Schema.String.check(Schema.isTrimmed(), Schema.isPattern(/^ignotum\/platform\/guest\/[a-zA-Z0-9_-]+(?:\/[a-zA-Z0-9_-]+)*\.js$/), Schema.isMaxLength(512))
|
|
209
|
+
});
|
|
210
|
+
const PersistentStateFormatId = Schema.String.check(Schema.isTrimmed(), Schema.isPattern(/^[a-z][a-z0-9]*(?:[./-][a-z0-9]+)*$/), Schema.isMaxLength(128)).pipe(Schema.brand("ignotum/platform/PersistentStateFormatId"));
|
|
211
|
+
const PersistentStateFormatVersion = Schema.Int.check(Schema.isGreaterThan(0)).pipe(Schema.brand("ignotum/platform/PersistentStateFormatVersion"));
|
|
212
|
+
const PersistentStateCompatibility = strict$1({
|
|
213
|
+
format: PersistentStateFormatId,
|
|
214
|
+
readableVersions: Schema.UniqueArray(PersistentStateFormatVersion).check(Schema.isMinLength(1), Schema.isMaxLength(256)),
|
|
215
|
+
writeVersion: PersistentStateFormatVersion
|
|
216
|
+
}).check(Schema.makeFilter((value) => value.readableVersions.includes(value.writeVersion) ? void 0 : "A release must read the persistent state version it writes")).annotate({ parseOptions: { onExcessProperty: "error" } });
|
|
217
|
+
Schema.Array(strict$1({
|
|
218
|
+
format: PersistentStateFormatId,
|
|
219
|
+
version: PersistentStateFormatVersion
|
|
220
|
+
})).check(Schema.isMaxLength(256), Schema.makeFilter((states) => new Set(states.map((state) => state.format)).size === states.length ? void 0 : "Persistent state format identifiers must be unique"));
|
|
221
|
+
const ReleasePublication = Schema.Union([
|
|
222
|
+
strict$1({
|
|
223
|
+
state: Schema.Literal("Staging"),
|
|
224
|
+
eligible: Schema.Literal(false)
|
|
225
|
+
}),
|
|
226
|
+
strict$1({
|
|
227
|
+
state: Schema.Literal("Ready"),
|
|
228
|
+
eligible: Schema.Literal(true)
|
|
229
|
+
}),
|
|
230
|
+
strict$1({
|
|
231
|
+
state: Schema.Literal("Failed"),
|
|
232
|
+
eligible: Schema.Literal(false),
|
|
233
|
+
reason: Schema.String.check(Schema.isMinLength(1), Schema.isMaxLength(4096))
|
|
234
|
+
}),
|
|
235
|
+
strict$1({
|
|
236
|
+
state: Schema.Literal("Retired"),
|
|
237
|
+
eligible: Schema.Literal(false)
|
|
238
|
+
})
|
|
239
|
+
]);
|
|
240
|
+
const SupportedProtocols = Schema.UniqueArray(ProtocolVersion).check(Schema.isMinLength(1), Schema.isMaxLength(32));
|
|
241
|
+
const PlatformReleaseV1 = strict$1({
|
|
242
|
+
formatVersion: Schema.Literal(1),
|
|
243
|
+
id: PlatformReleaseId,
|
|
244
|
+
browser: strict$1({
|
|
245
|
+
graph: BrowserGraphReference,
|
|
246
|
+
clientApiVersion: ClientApiVersion,
|
|
247
|
+
protocolVersion: ProtocolVersion
|
|
248
|
+
}),
|
|
249
|
+
guest: strict$1({
|
|
250
|
+
graph: GuestGraphReference,
|
|
251
|
+
serverApiVersion: ServerApiVersion,
|
|
252
|
+
protocolVersion: ProtocolVersion
|
|
253
|
+
}),
|
|
254
|
+
gateway: strict$1({
|
|
255
|
+
implementation: Sha256,
|
|
256
|
+
browserProtocols: SupportedProtocols
|
|
257
|
+
}),
|
|
258
|
+
host: strict$1({
|
|
259
|
+
implementation: Sha256,
|
|
260
|
+
guestProtocols: SupportedProtocols
|
|
261
|
+
}),
|
|
262
|
+
capabilities: Capabilities,
|
|
263
|
+
persistentState: Schema.Array(PersistentStateCompatibility).check(Schema.isMaxLength(256)),
|
|
264
|
+
publication: ReleasePublication
|
|
265
|
+
}).check(Schema.makeFilter((release) => {
|
|
266
|
+
const issues = [];
|
|
267
|
+
if (!release.gateway.browserProtocols.includes(release.browser.protocolVersion)) issues.push({
|
|
268
|
+
path: ["gateway"],
|
|
269
|
+
issue: "Gateway must support the selected browser protocol"
|
|
270
|
+
});
|
|
271
|
+
if (!release.host.guestProtocols.includes(release.guest.protocolVersion)) issues.push({
|
|
272
|
+
path: ["host"],
|
|
273
|
+
issue: "Host must support the selected guest protocol"
|
|
274
|
+
});
|
|
275
|
+
if (new Set(release.persistentState.map((state) => state.format)).size !== release.persistentState.length) issues.push({
|
|
276
|
+
path: ["persistentState"],
|
|
277
|
+
issue: "Persistent state format identifiers must be unique"
|
|
278
|
+
});
|
|
279
|
+
return issues;
|
|
280
|
+
})).annotate({ parseOptions: { onExcessProperty: "error" } });
|
|
281
|
+
initial(PlatformReleaseV1);
|
|
282
|
+
const ExecutionSelectionV1 = strict$1({
|
|
283
|
+
formatVersion: Schema.Literal(1),
|
|
284
|
+
appId: AppId,
|
|
285
|
+
versionId: VersionId,
|
|
286
|
+
activationGeneration: ActivationGeneration,
|
|
287
|
+
platformReleaseId: PlatformReleaseId,
|
|
288
|
+
platformGeneration: PlatformGeneration,
|
|
289
|
+
dataHistoryId: DataHistoryId
|
|
290
|
+
});
|
|
291
|
+
const ExecutionSelection = initial(ExecutionSelectionV1);
|
|
292
|
+
/** Compare trusted admission and commit selections, including the database history fence. */
|
|
293
|
+
const sameExecutionSelection = (left, right) => left.appId === right.appId && left.versionId === right.versionId && left.activationGeneration === right.activationGeneration && left.platformReleaseId === right.platformReleaseId && left.platformGeneration === right.platformGeneration && left.dataHistoryId === right.dataHistoryId;
|
|
294
|
+
/** Browser recovery scope only; reconciliation must verify the owning session separately. */
|
|
295
|
+
const RecoverySessionId = defineId("rec", "ignotum/platform/RecoverySessionId");
|
|
296
|
+
const RecoveryIdentity = strict$1({
|
|
297
|
+
invocationId: InvocationId,
|
|
298
|
+
originalSelection: ExecutionSelection
|
|
299
|
+
});
|
|
300
|
+
const RecoveryLimits = {
|
|
301
|
+
maxOperations: 1024,
|
|
302
|
+
maxRetentionMs: 6048e5
|
|
303
|
+
};
|
|
304
|
+
const RecoveryRecordV1 = strict$1({
|
|
305
|
+
formatVersion: Schema.Literal(1),
|
|
306
|
+
appId: AppId,
|
|
307
|
+
clientSessionId: RecoverySessionId,
|
|
308
|
+
recordedAt: Schema.Natural,
|
|
309
|
+
expiresAt: Schema.Natural,
|
|
310
|
+
operations: Schema.Array(RecoveryIdentity).check(Schema.isMaxLength(RecoveryLimits.maxOperations))
|
|
311
|
+
}).check(Schema.makeFilter((record) => {
|
|
312
|
+
const issues = [];
|
|
313
|
+
if (record.expiresAt <= record.recordedAt || record.expiresAt - record.recordedAt > RecoveryLimits.maxRetentionMs) issues.push({
|
|
314
|
+
path: ["expiresAt"],
|
|
315
|
+
issue: "Recovery retention must be positive and bounded"
|
|
316
|
+
});
|
|
317
|
+
if (record.operations.some((operation) => operation.originalSelection.appId !== record.appId)) issues.push({
|
|
318
|
+
path: ["operations"],
|
|
319
|
+
issue: "Recovery operations must belong to the record's app"
|
|
320
|
+
});
|
|
321
|
+
const identities = record.operations.map((operation) => `${operation.originalSelection.dataHistoryId}/${operation.invocationId}`);
|
|
322
|
+
if (new Set(identities).size !== identities.length) issues.push({
|
|
323
|
+
path: ["operations"],
|
|
324
|
+
issue: "Recovery operation identities must be unique within a data history"
|
|
325
|
+
});
|
|
326
|
+
return issues;
|
|
327
|
+
})).annotate({ parseOptions: { onExcessProperty: "error" } });
|
|
328
|
+
initial(RecoveryRecordV1);
|
|
329
|
+
const RetentionTarget = Schema.Union([
|
|
330
|
+
strict$1({
|
|
331
|
+
kind: Schema.Literal("Version"),
|
|
332
|
+
appId: AppId,
|
|
333
|
+
versionId: VersionId
|
|
334
|
+
}),
|
|
335
|
+
strict$1({
|
|
336
|
+
kind: Schema.Literal("PlatformRelease"),
|
|
337
|
+
platformReleaseId: PlatformReleaseId
|
|
338
|
+
}),
|
|
339
|
+
strict$1({
|
|
340
|
+
kind: Schema.Literal("AppArtifact"),
|
|
341
|
+
appId: AppId,
|
|
342
|
+
versionId: VersionId,
|
|
343
|
+
sha256: Sha256
|
|
344
|
+
}),
|
|
345
|
+
strict$1({
|
|
346
|
+
kind: Schema.Literal("PlatformArtifact"),
|
|
347
|
+
platformReleaseId: PlatformReleaseId,
|
|
348
|
+
sha256: Sha256
|
|
349
|
+
})
|
|
350
|
+
]);
|
|
351
|
+
const RetentionOwnerV1 = Schema.Union([
|
|
352
|
+
strict$1({
|
|
353
|
+
reason: Schema.Literal("Rollback"),
|
|
354
|
+
appId: AppId
|
|
355
|
+
}),
|
|
356
|
+
strict$1({
|
|
357
|
+
reason: Schema.Literal("Recovery"),
|
|
358
|
+
appId: AppId,
|
|
359
|
+
clientSessionId: RecoverySessionId
|
|
360
|
+
}),
|
|
361
|
+
strict$1({
|
|
362
|
+
reason: Schema.Literal("DataHistory"),
|
|
363
|
+
appId: AppId,
|
|
364
|
+
dataHistoryId: DataHistoryId
|
|
365
|
+
})
|
|
366
|
+
]);
|
|
367
|
+
const RetentionOwner = Schema.Union([RetentionOwnerV1, strict$1({
|
|
368
|
+
reason: Schema.Literal("Lifecycle"),
|
|
369
|
+
appId: AppId,
|
|
370
|
+
key: Schema.String.check(Schema.isPattern(/^[a-zA-Z0-9][a-zA-Z0-9._:/-]{0,127}$/))
|
|
371
|
+
})]);
|
|
372
|
+
const RetentionReferenceV1 = strict$1({
|
|
373
|
+
formatVersion: Schema.Literal(1),
|
|
374
|
+
owner: RetentionOwnerV1,
|
|
375
|
+
target: RetentionTarget
|
|
376
|
+
}).check(Schema.makeFilter((reference) => (reference.target.kind === "Version" || reference.target.kind === "AppArtifact") && reference.target.appId !== reference.owner.appId ? "Retention references must belong to the owner's app" : void 0)).annotate({ parseOptions: { onExcessProperty: "error" } });
|
|
377
|
+
const RetentionReferenceV2 = strict$1({
|
|
378
|
+
formatVersion: Schema.Literal(2),
|
|
379
|
+
owner: RetentionOwner,
|
|
380
|
+
target: RetentionTarget
|
|
381
|
+
}).check(Schema.makeFilter((reference) => (reference.target.kind === "Version" || reference.target.kind === "AppArtifact") && reference.target.appId !== reference.owner.appId ? "Retention references must belong to the owner's app" : void 0));
|
|
382
|
+
upgrade(initial(RetentionReferenceV1), RetentionReferenceV2, (previous) => ({
|
|
383
|
+
...previous,
|
|
384
|
+
formatVersion: 2
|
|
385
|
+
}));
|
|
386
|
+
//#endregion
|
|
387
|
+
//#region ../contracts/dist/app-definition.js
|
|
388
|
+
const appDefinitionLimits = {
|
|
389
|
+
declarationBytes: 1048576,
|
|
390
|
+
artifactBytes: 16777216,
|
|
391
|
+
totalArtifactBytes: 134217728,
|
|
392
|
+
serverArtifactBytes: 67108864,
|
|
393
|
+
artifacts: 512,
|
|
394
|
+
modules: 512,
|
|
395
|
+
importsPerModule: 256,
|
|
396
|
+
routes: 512,
|
|
397
|
+
layouts: 128,
|
|
398
|
+
functions: 512,
|
|
399
|
+
conversions: 512,
|
|
400
|
+
urlFields: 64,
|
|
401
|
+
literalValues: 64,
|
|
402
|
+
textLength: 4096,
|
|
403
|
+
configurationDepth: 96,
|
|
404
|
+
configurationNodes: 65536,
|
|
405
|
+
descriptorDepth: 32,
|
|
406
|
+
descriptorNodes: 8192,
|
|
407
|
+
graphDepth: 64,
|
|
408
|
+
moduleTokens: 1e5
|
|
409
|
+
};
|
|
410
|
+
const strict = (fields) => Schema.Struct(fields).annotate({ parseOptions: { onExcessProperty: "error" } });
|
|
411
|
+
const Name = Schema.String.check(Schema.isMinLength(1), Schema.isMaxLength(256));
|
|
412
|
+
const Text = Schema.String.check(Schema.isMaxLength(appDefinitionLimits.textLength));
|
|
413
|
+
const ExportName = Schema.String.check(Schema.isPattern(/^[A-Za-z_$][A-Za-z0-9_$]*$/), Schema.isTrimmed());
|
|
414
|
+
const AppArtifactPath = ArtifactPath.check(Schema.isTrimmed(), Schema.isMaxLength(512), Schema.isPattern(/^(?:[A-Za-z0-9_-][A-Za-z0-9_.-]*\/)*[A-Za-z0-9_-][A-Za-z0-9_.-]*$/));
|
|
415
|
+
const AppModuleId = Schema.String.check(Schema.isTrimmed(), Schema.isMaxLength(512), Schema.isPattern(/^app\/(?:client|server)\/(?:[A-Za-z0-9_-][A-Za-z0-9_.-]*\/)*[A-Za-z0-9_-][A-Za-z0-9_.-]*$/)).pipe(Schema.brand("ignotum/app-definition/AppModuleId"));
|
|
416
|
+
const RouteId = Name.pipe(Schema.brand("ignotum/app-definition/RouteId"));
|
|
417
|
+
const LayoutId = Name.pipe(Schema.brand("ignotum/app-definition/LayoutId"));
|
|
418
|
+
const ModuleExportReference = strict({
|
|
419
|
+
module: AppModuleId,
|
|
420
|
+
exportName: ExportName
|
|
421
|
+
});
|
|
422
|
+
const ModuleImport = Schema.Union([
|
|
423
|
+
strict({
|
|
424
|
+
kind: Schema.Literal("App"),
|
|
425
|
+
specifier: Name,
|
|
426
|
+
module: AppModuleId
|
|
427
|
+
}),
|
|
428
|
+
strict({
|
|
429
|
+
kind: Schema.Literal("Runtime"),
|
|
430
|
+
specifier: Schema.Literals([
|
|
431
|
+
"ignotum/client",
|
|
432
|
+
"ignotum/client/jsx-runtime",
|
|
433
|
+
"ignotum/client/jsx-dev-runtime",
|
|
434
|
+
"ignotum/server"
|
|
435
|
+
])
|
|
436
|
+
}),
|
|
437
|
+
strict({
|
|
438
|
+
kind: Schema.Literal("Compiler"),
|
|
439
|
+
specifier: Schema.Literals([
|
|
440
|
+
"ignotum/internal/api",
|
|
441
|
+
"ignotum/internal/client",
|
|
442
|
+
"ignotum/internal/routes",
|
|
443
|
+
"ignotum/internal/bootstrap",
|
|
444
|
+
"ignotum/internal/server"
|
|
445
|
+
])
|
|
446
|
+
}),
|
|
447
|
+
strict({
|
|
448
|
+
kind: Schema.Literal("RenderingPeer"),
|
|
449
|
+
specifier: Schema.Literals([
|
|
450
|
+
"preact",
|
|
451
|
+
"preact/hooks",
|
|
452
|
+
"preact/jsx-runtime",
|
|
453
|
+
"preact/jsx-dev-runtime"
|
|
454
|
+
])
|
|
455
|
+
}),
|
|
456
|
+
strict({
|
|
457
|
+
kind: Schema.Literal("HostBridge"),
|
|
458
|
+
specifier: Schema.Literal("ignotum:host")
|
|
459
|
+
})
|
|
460
|
+
]);
|
|
461
|
+
const AppModule = strict({
|
|
462
|
+
id: AppModuleId,
|
|
463
|
+
artifact: AppArtifactPath,
|
|
464
|
+
imports: Schema.Array(ModuleImport).check(Schema.isMaxLength(appDefinitionLimits.importsPerModule)),
|
|
465
|
+
sourceMap: Schema.optional(AppArtifactPath),
|
|
466
|
+
assets: Schema.optional(Schema.Array(AppArtifactPath).check(Schema.isMaxLength(appDefinitionLimits.artifacts))),
|
|
467
|
+
styles: Schema.optional(Schema.Array(AppArtifactPath).check(Schema.isMaxLength(appDefinitionLimits.artifacts)))
|
|
468
|
+
});
|
|
469
|
+
const AppModuleGraph = strict({
|
|
470
|
+
entries: Schema.Array(AppModuleId).check(Schema.isMaxLength(appDefinitionLimits.modules)),
|
|
471
|
+
modules: Schema.Array(AppModule).check(Schema.isMaxLength(appDefinitionLimits.modules))
|
|
472
|
+
});
|
|
473
|
+
const ArtifactFields = {
|
|
474
|
+
path: AppArtifactPath,
|
|
475
|
+
size: Schema.Natural.check(Schema.isLessThanOrEqualTo(appDefinitionLimits.artifactBytes)),
|
|
476
|
+
sha256: Sha256,
|
|
477
|
+
contentType: Name,
|
|
478
|
+
contentEncoding: Schema.optional(Schema.Literal("gzip"))
|
|
479
|
+
};
|
|
480
|
+
const AppArtifact = Schema.Union([
|
|
481
|
+
strict({
|
|
482
|
+
...ArtifactFields,
|
|
483
|
+
kind: Schema.Literals([
|
|
484
|
+
"ClientModule",
|
|
485
|
+
"Style",
|
|
486
|
+
"Image",
|
|
487
|
+
"Icon"
|
|
488
|
+
]),
|
|
489
|
+
visibility: Schema.Literal("public")
|
|
490
|
+
}),
|
|
491
|
+
strict({
|
|
492
|
+
...ArtifactFields,
|
|
493
|
+
kind: Schema.Literal("ServerModule"),
|
|
494
|
+
visibility: Schema.Literal("private")
|
|
495
|
+
}),
|
|
496
|
+
strict({
|
|
497
|
+
...ArtifactFields,
|
|
498
|
+
kind: Schema.Literal("SourceMap"),
|
|
499
|
+
visibility: Schema.Literal("private"),
|
|
500
|
+
owner: AppModuleId
|
|
501
|
+
})
|
|
502
|
+
]);
|
|
503
|
+
const UrlLiteral = Schema.Union([
|
|
504
|
+
Text,
|
|
505
|
+
Schema.Finite,
|
|
506
|
+
Schema.Boolean
|
|
507
|
+
]);
|
|
508
|
+
const UrlScalarDescriptor = Schema.Union([
|
|
509
|
+
strict({ type: Schema.Literal("string") }),
|
|
510
|
+
strict({
|
|
511
|
+
type: Schema.Literal("id"),
|
|
512
|
+
table: Name
|
|
513
|
+
}),
|
|
514
|
+
strict({ type: Schema.Literal("number") }),
|
|
515
|
+
strict({ type: Schema.Literal("integer") }),
|
|
516
|
+
strict({ type: Schema.Literal("boolean") }),
|
|
517
|
+
strict({
|
|
518
|
+
type: Schema.Literal("literal"),
|
|
519
|
+
value: UrlLiteral
|
|
520
|
+
}),
|
|
521
|
+
strict({
|
|
522
|
+
type: Schema.Literal("literals"),
|
|
523
|
+
values: Schema.Array(UrlLiteral).check(Schema.isMinLength(1), Schema.isMaxLength(appDefinitionLimits.literalValues), Schema.makeFilter((values) => new Set(values.map(String)).size === values.length || "URL literal encodings must be unique"))
|
|
524
|
+
})
|
|
525
|
+
]);
|
|
526
|
+
const urlScalarSchema = (descriptor) => {
|
|
527
|
+
switch (descriptor.type) {
|
|
528
|
+
case "string": return Text;
|
|
529
|
+
case "id": return GeneratedId;
|
|
530
|
+
case "number": return Schema.Finite;
|
|
531
|
+
case "integer": return Schema.Int;
|
|
532
|
+
case "boolean": return Schema.Boolean;
|
|
533
|
+
case "literal": return Schema.Literal(descriptor.value);
|
|
534
|
+
case "literals": return Schema.Literals(descriptor.values);
|
|
535
|
+
}
|
|
536
|
+
};
|
|
537
|
+
const UrlRequiredDescriptor = Schema.Union([UrlScalarDescriptor, strict({
|
|
538
|
+
type: Schema.Literal("array"),
|
|
539
|
+
value: UrlScalarDescriptor
|
|
540
|
+
})]);
|
|
541
|
+
const UrlDefault = Schema.Union([UrlLiteral, Schema.Array(UrlLiteral).check(Schema.isMaxLength(256))]);
|
|
542
|
+
const UrlValueDescriptor = Schema.Union([
|
|
543
|
+
UrlRequiredDescriptor,
|
|
544
|
+
strict({
|
|
545
|
+
type: Schema.Literal("optional"),
|
|
546
|
+
value: UrlRequiredDescriptor
|
|
547
|
+
}),
|
|
548
|
+
strict({
|
|
549
|
+
type: Schema.Literal("default"),
|
|
550
|
+
value: UrlRequiredDescriptor,
|
|
551
|
+
default: UrlDefault
|
|
552
|
+
}).check(Schema.makeFilter((descriptor) => {
|
|
553
|
+
const valueSchema = descriptor.value.type === "array" ? Schema.Array(urlScalarSchema(descriptor.value.value)) : urlScalarSchema(descriptor.value);
|
|
554
|
+
return Schema.is(valueSchema)(descriptor.default) || "The URL default must satisfy its value descriptor";
|
|
555
|
+
})).annotate({ parseOptions: { onExcessProperty: "error" } })
|
|
556
|
+
]);
|
|
557
|
+
const UrlField = strict({
|
|
558
|
+
name: Name,
|
|
559
|
+
value: UrlValueDescriptor
|
|
560
|
+
});
|
|
561
|
+
const PathUrlField = strict({
|
|
562
|
+
name: Name,
|
|
563
|
+
value: Schema.Union([UrlScalarDescriptor, strict({
|
|
564
|
+
type: Schema.Literal("array"),
|
|
565
|
+
value: strict({ type: Schema.Literal("string") })
|
|
566
|
+
})])
|
|
567
|
+
});
|
|
568
|
+
const Meta = strict({
|
|
569
|
+
description: Schema.optional(Text),
|
|
570
|
+
robots: Schema.optional(Text)
|
|
571
|
+
});
|
|
572
|
+
const StaticMetadata = strict({
|
|
573
|
+
title: Schema.optional(Text),
|
|
574
|
+
meta: Schema.optional(Meta)
|
|
575
|
+
});
|
|
576
|
+
const LayoutMetadata = strict({
|
|
577
|
+
title: Schema.optional(Text),
|
|
578
|
+
titleTemplate: Schema.optional(Text.check(Schema.makeFilter((template) => template.split("%s").length === 2 || "A title template must contain exactly one %s placeholder"))),
|
|
579
|
+
meta: Schema.optional(Meta)
|
|
580
|
+
});
|
|
581
|
+
const RoutePattern = Schema.String.check(Schema.isMaxLength(2048), Schema.isPattern(/^\/(?!_ignotum(?:\/|$))[^?#\\\0]*$/));
|
|
582
|
+
const RouteDefinition = strict({
|
|
583
|
+
id: RouteId,
|
|
584
|
+
pattern: RoutePattern,
|
|
585
|
+
directoryScope: Schema.optional(RoutePattern),
|
|
586
|
+
precedence: Schema.Array(Schema.Natural).check(Schema.isMaxLength(128)),
|
|
587
|
+
params: Schema.Array(PathUrlField).check(Schema.isMaxLength(appDefinitionLimits.urlFields)),
|
|
588
|
+
searchParams: Schema.Array(UrlField).check(Schema.isMaxLength(appDefinitionLimits.urlFields)),
|
|
589
|
+
page: ModuleExportReference,
|
|
590
|
+
layouts: Schema.Array(LayoutId).check(Schema.isMaxLength(appDefinitionLimits.layouts)),
|
|
591
|
+
metadata: StaticMetadata,
|
|
592
|
+
boundaries: strict({
|
|
593
|
+
error: Schema.Boolean,
|
|
594
|
+
invalid: Schema.Boolean
|
|
595
|
+
})
|
|
596
|
+
});
|
|
597
|
+
const LayoutDefinition = strict({
|
|
598
|
+
id: LayoutId,
|
|
599
|
+
scope: RoutePattern,
|
|
600
|
+
parent: Schema.optional(LayoutId),
|
|
601
|
+
module: ModuleExportReference,
|
|
602
|
+
metadata: LayoutMetadata,
|
|
603
|
+
boundaries: strict({
|
|
604
|
+
error: Schema.Boolean,
|
|
605
|
+
invalid: Schema.Boolean,
|
|
606
|
+
notFound: Schema.Boolean
|
|
607
|
+
})
|
|
608
|
+
});
|
|
609
|
+
const FunctionDefinition = strict({
|
|
610
|
+
address: FunctionAddress,
|
|
611
|
+
kind: FunctionKind,
|
|
612
|
+
entry: ModuleExportReference,
|
|
613
|
+
args: ValueDescriptor,
|
|
614
|
+
returns: Schema.optional(ValueDescriptor),
|
|
615
|
+
errors: ValueDescriptor
|
|
616
|
+
});
|
|
617
|
+
const SchemaConversion = strict({
|
|
618
|
+
table: Name,
|
|
619
|
+
field: Name,
|
|
620
|
+
from: ValueDescriptor,
|
|
621
|
+
to: ValueDescriptor,
|
|
622
|
+
entry: ModuleExportReference
|
|
623
|
+
});
|
|
624
|
+
const AppDefinitionV1 = strict({
|
|
625
|
+
formatVersion: Schema.Literal(1),
|
|
626
|
+
appName: Name,
|
|
627
|
+
requirements: RuntimeRequirements,
|
|
628
|
+
client: strict({
|
|
629
|
+
registration: ModuleExportReference,
|
|
630
|
+
graph: AppModuleGraph,
|
|
631
|
+
routes: Schema.Array(RouteDefinition).check(Schema.isMaxLength(appDefinitionLimits.routes)),
|
|
632
|
+
layouts: Schema.Array(LayoutDefinition).check(Schema.isMaxLength(appDefinitionLimits.layouts)),
|
|
633
|
+
styles: Schema.Array(AppArtifactPath).check(Schema.isMaxLength(appDefinitionLimits.artifacts)),
|
|
634
|
+
icon: Schema.optional(AppArtifactPath)
|
|
635
|
+
}),
|
|
636
|
+
server: strict({
|
|
637
|
+
graph: AppModuleGraph,
|
|
638
|
+
functions: Schema.Array(FunctionDefinition).check(Schema.isMaxLength(appDefinitionLimits.functions)),
|
|
639
|
+
schema: strict({
|
|
640
|
+
entry: ModuleExportReference,
|
|
641
|
+
identity: Sha256,
|
|
642
|
+
descriptor: SchemaSnapshot,
|
|
643
|
+
conversions: Schema.Array(SchemaConversion).check(Schema.isMaxLength(appDefinitionLimits.conversions))
|
|
644
|
+
})
|
|
645
|
+
}),
|
|
646
|
+
artifacts: Schema.Array(AppArtifact).check(Schema.isMaxLength(appDefinitionLimits.artifacts))
|
|
647
|
+
}).check(Schema.makeFilter((definition) => definition.artifacts.reduce((sum, artifact) => sum + artifact.size, 0) <= appDefinitionLimits.totalArtifactBytes || "App artifacts exceed the total byte limit"), Schema.makeFilter((definition) => definition.artifacts.filter((artifact) => artifact.visibility === "private").reduce((sum, artifact) => sum + artifact.size, 0) <= appDefinitionLimits.serverArtifactBytes || "Private artifacts exceed the server byte limit"), Schema.makeFilter((definition) => new TextEncoder().encode(JSON.stringify(definition)).byteLength <= appDefinitionLimits.declarationBytes || "App definition exceeds the declaration byte limit"));
|
|
648
|
+
const AppDefinitionThroughV1 = initial(AppDefinitionV1.annotate({ parseOptions: { onExcessProperty: "error" } }));
|
|
649
|
+
AppDefinitionV1.fields.server;
|
|
650
|
+
const AppDefinition = AppDefinitionThroughV1;
|
|
651
|
+
const ProtectedEnvironmentReference = strict({
|
|
652
|
+
artifact: strict({
|
|
653
|
+
path: AppArtifactPath,
|
|
654
|
+
size: ArtifactFields.size,
|
|
655
|
+
sha256: Sha256
|
|
656
|
+
}),
|
|
657
|
+
fields: Schema.Array(SchemaSnapshotField).check(Schema.isMaxLength(256))
|
|
658
|
+
});
|
|
659
|
+
const UploadDeclarationV1 = strict({
|
|
660
|
+
formatVersion: Schema.Literal(1),
|
|
661
|
+
definition: AppDefinition,
|
|
662
|
+
environment: Schema.optional(ProtectedEnvironmentReference)
|
|
663
|
+
}).check(Schema.makeFilter((declaration) => new TextEncoder().encode(JSON.stringify(declaration)).byteLength <= appDefinitionLimits.declarationBytes || "Upload declaration exceeds the declaration byte limit"), Schema.makeFilter((declaration) => declaration.definition.artifacts.reduce((sum, artifact) => sum + artifact.size, declaration.environment?.artifact.size ?? 0) <= appDefinitionLimits.totalArtifactBytes || "Upload artifacts exceed the total byte limit"), Schema.makeFilter((declaration) => declaration.definition.artifacts.filter((artifact) => artifact.visibility === "private").reduce((sum, artifact) => sum + artifact.size, declaration.environment?.artifact.size ?? 0) <= appDefinitionLimits.serverArtifactBytes || "Protected upload artifacts exceed the server byte limit"));
|
|
664
|
+
initial(UploadDeclarationV1.annotate({ parseOptions: { onExcessProperty: "error" } }));
|
|
665
|
+
const VersionAdmissionRecordV1 = Schema.Union([strict({
|
|
666
|
+
formatVersion: Schema.Literal(1),
|
|
667
|
+
versionId: VersionId,
|
|
668
|
+
state: Schema.Literals([
|
|
669
|
+
"Uploading",
|
|
670
|
+
"Validating",
|
|
671
|
+
"Rejected"
|
|
672
|
+
]),
|
|
673
|
+
eligible: Schema.Literal(false)
|
|
674
|
+
}), strict({
|
|
675
|
+
formatVersion: Schema.Literal(1),
|
|
676
|
+
versionId: VersionId,
|
|
677
|
+
state: Schema.Literal("Finalized"),
|
|
678
|
+
number: VersionNumber,
|
|
679
|
+
eligible: Schema.Boolean
|
|
680
|
+
})]);
|
|
681
|
+
initial(VersionAdmissionRecordV1);
|
|
682
|
+
//#endregion
|
|
683
|
+
//#region src/internal/routes.ts
|
|
684
|
+
const RouteReferenceTypeId = Symbol.for("ignotum/internal/routes/RouteReference");
|
|
685
|
+
const createRouteReference = (definition) => ({ [RouteReferenceTypeId]: Schema.decodeUnknownSync(RouteDefinition)(definition) });
|
|
686
|
+
const getRouteDefinition = (reference) => reference[RouteReferenceTypeId];
|
|
687
|
+
//#endregion
|
|
688
|
+
export { RouteDefinition as a, UrlValueDescriptor as c, RecoveryIdentity as d, RecoverySessionId as f, LayoutMetadata as i, appDefinitionLimits as l, getRouteDefinition as n, StaticMetadata as o, sameExecutionSelection as p, LayoutDefinition as r, UrlScalarDescriptor as s, createRouteReference as t, ExecutionSelection as u };
|
|
689
|
+
|
|
690
|
+
//# sourceMappingURL=routes-Ce8TVP-T.js.map
|