@neocompose/cli 0.37.0 → 0.38.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/CHANGELOG.md +59 -0
- package/README.md +7 -2
- package/dist/neo.mjs +1368 -734
- package/package.json +1 -1
- package/skills/neocompose-cli/SKILL.md +1 -1
- package/skills/neocompose-cli/references/cli-development.md +1 -1
- package/skills/neocompose-cli/references/commands-and-sync.md +10 -2
- package/skills/neocompose-cli/references/values-identities-and-references.md +3 -1
package/dist/neo.mjs
CHANGED
|
@@ -41,6 +41,329 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
41
41
|
mod
|
|
42
42
|
));
|
|
43
43
|
|
|
44
|
+
// src/workspace.ts
|
|
45
|
+
import { createHash } from "node:crypto";
|
|
46
|
+
import { mkdirSync, readFileSync, writeFileSync, existsSync } from "node:fs";
|
|
47
|
+
import { dirname, join, resolve } from "node:path";
|
|
48
|
+
function recordStateKey(recordKind, recordId) {
|
|
49
|
+
return `${recordKind}:${recordId}`;
|
|
50
|
+
}
|
|
51
|
+
function findWorkspaceRoot(startDir) {
|
|
52
|
+
let dir = resolve(startDir);
|
|
53
|
+
for (; ; ) {
|
|
54
|
+
if (existsSync(join(dir, NEO_CONFIG_FILE))) return dir;
|
|
55
|
+
const parent = dirname(dir);
|
|
56
|
+
if (parent === dir) return null;
|
|
57
|
+
dir = parent;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function readWorkspaceConfig(root) {
|
|
61
|
+
const raw = readFileSync(join(root, NEO_CONFIG_FILE), "utf8");
|
|
62
|
+
const parsed = JSON.parse(raw);
|
|
63
|
+
if (typeof parsed !== "object" || parsed === null) {
|
|
64
|
+
throw new Error(`"${NEO_CONFIG_FILE}" must contain a JSON object.`);
|
|
65
|
+
}
|
|
66
|
+
const config = parsed;
|
|
67
|
+
if (config.formatVersion === void 0) {
|
|
68
|
+
throw new Error(
|
|
69
|
+
`"${NEO_CONFIG_FILE}" is missing required field "formatVersion"; expected ${CURRENT_FORMAT_VERSION}. Recreate this working copy with \`neo init\`.`
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
if (config.formatVersion !== CURRENT_FORMAT_VERSION) {
|
|
73
|
+
throw new Error(
|
|
74
|
+
`"${NEO_CONFIG_FILE}" field "formatVersion" must be ${CURRENT_FORMAT_VERSION}; received ${JSON.stringify(config.formatVersion)}. Native Neo project source is a clean break; preserve local edits and create a fresh working copy with \`neo init\`.`
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
const formatVersion = CURRENT_FORMAT_VERSION;
|
|
78
|
+
if (typeof config.apiBaseUrl !== "string") {
|
|
79
|
+
throw new Error(
|
|
80
|
+
`"${NEO_CONFIG_FILE}" is missing string field "apiBaseUrl".`
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
const profile = config.profile === "release" ? "release" : "editor";
|
|
84
|
+
const convexUrl = typeof config.convexUrl === "string" ? config.convexUrl : void 0;
|
|
85
|
+
const prePushHook = optionalHook(config, "prePushHook");
|
|
86
|
+
const prePushDryRunHook = optionalHook(config, "prePushDryRunHook");
|
|
87
|
+
const test = optionalTestConfig(config.test);
|
|
88
|
+
if (typeof config.unityConfigPath === "string") {
|
|
89
|
+
if (config.projectId !== void 0) {
|
|
90
|
+
throw new Error(
|
|
91
|
+
`"${NEO_CONFIG_FILE}" sets "unityConfigPath", so "projectId" must be removed \u2014 the Unity config asset is the single source of truth.`
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
if (config.versionId !== void 0) {
|
|
95
|
+
throw new Error(
|
|
96
|
+
`"${NEO_CONFIG_FILE}" sets "unityConfigPath", so "versionId" must be removed \u2014 the Unity config asset is the single source of truth.`
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
const ids = readUnityConfigIds(root, config.unityConfigPath);
|
|
100
|
+
return {
|
|
101
|
+
formatVersion,
|
|
102
|
+
apiBaseUrl: config.apiBaseUrl,
|
|
103
|
+
projectId: ids.projectId,
|
|
104
|
+
versionId: ids.versionId,
|
|
105
|
+
profile,
|
|
106
|
+
convexUrl,
|
|
107
|
+
unityConfigPath: config.unityConfigPath,
|
|
108
|
+
...prePushHook === void 0 ? {} : { prePushHook },
|
|
109
|
+
...prePushDryRunHook === void 0 ? {} : { prePushDryRunHook },
|
|
110
|
+
...test === void 0 ? {} : { test }
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
if (typeof config.projectId !== "string") {
|
|
114
|
+
throw new Error(
|
|
115
|
+
`"${NEO_CONFIG_FILE}" is missing string field "projectId".`
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
if (typeof config.versionId !== "string") {
|
|
119
|
+
throw new Error(
|
|
120
|
+
`"${NEO_CONFIG_FILE}" is missing string field "versionId".`
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
return {
|
|
124
|
+
formatVersion,
|
|
125
|
+
apiBaseUrl: config.apiBaseUrl,
|
|
126
|
+
projectId: config.projectId,
|
|
127
|
+
versionId: config.versionId,
|
|
128
|
+
profile,
|
|
129
|
+
convexUrl,
|
|
130
|
+
...prePushHook === void 0 ? {} : { prePushHook },
|
|
131
|
+
...prePushDryRunHook === void 0 ? {} : { prePushDryRunHook },
|
|
132
|
+
...test === void 0 ? {} : { test }
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
function optionalHook(config, field) {
|
|
136
|
+
const value = config[field];
|
|
137
|
+
if (value === void 0) return void 0;
|
|
138
|
+
if (typeof value !== "string" || value.trim().length === 0) {
|
|
139
|
+
throw new Error(
|
|
140
|
+
`"${NEO_CONFIG_FILE}" field "${field}" must be a non-empty CLI command.`
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
return value;
|
|
144
|
+
}
|
|
145
|
+
function optionalTestConfig(value) {
|
|
146
|
+
if (value === void 0) return void 0;
|
|
147
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
148
|
+
throw new Error(`"${NEO_CONFIG_FILE}" field "test" must be an object.`);
|
|
149
|
+
}
|
|
150
|
+
const config = value;
|
|
151
|
+
const allowed = /* @__PURE__ */ new Set([
|
|
152
|
+
"include",
|
|
153
|
+
"exclude",
|
|
154
|
+
"timeoutMs",
|
|
155
|
+
"maxWorkers",
|
|
156
|
+
"forbidOnly"
|
|
157
|
+
]);
|
|
158
|
+
const unknown = Object.keys(config).find((key) => !allowed.has(key));
|
|
159
|
+
if (unknown !== void 0) {
|
|
160
|
+
throw new Error(
|
|
161
|
+
`"${NEO_CONFIG_FILE}" field "test.${unknown}" is not recognized.`
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
const stringArray2 = (field) => {
|
|
165
|
+
const entry = config[field];
|
|
166
|
+
if (entry === void 0) return void 0;
|
|
167
|
+
if (!Array.isArray(entry) || entry.some((item) => typeof item !== "string" || item.length === 0)) {
|
|
168
|
+
throw new Error(
|
|
169
|
+
`"${NEO_CONFIG_FILE}" field "test.${field}" must be an array of non-empty strings.`
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
return entry;
|
|
173
|
+
};
|
|
174
|
+
const positiveInteger = (field) => {
|
|
175
|
+
const entry = config[field];
|
|
176
|
+
if (entry === void 0) return void 0;
|
|
177
|
+
if (typeof entry !== "number" || !Number.isInteger(entry) || entry <= 0) {
|
|
178
|
+
throw new Error(
|
|
179
|
+
`"${NEO_CONFIG_FILE}" field "test.${field}" must be a positive integer.`
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
return entry;
|
|
183
|
+
};
|
|
184
|
+
const include = stringArray2("include");
|
|
185
|
+
const exclude = stringArray2("exclude");
|
|
186
|
+
const invalidInclude = include?.find(
|
|
187
|
+
(pattern) => !pattern.endsWith(".spec.neo")
|
|
188
|
+
);
|
|
189
|
+
if (invalidInclude !== void 0) {
|
|
190
|
+
throw new Error(
|
|
191
|
+
`"${NEO_CONFIG_FILE}" field "test.include" may select only .spec.neo files; received ${JSON.stringify(invalidInclude)}.`
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
const timeoutMs = positiveInteger("timeoutMs");
|
|
195
|
+
const maxWorkers = positiveInteger("maxWorkers");
|
|
196
|
+
const forbidOnly = config.forbidOnly;
|
|
197
|
+
if (forbidOnly !== void 0 && typeof forbidOnly !== "boolean") {
|
|
198
|
+
throw new Error(
|
|
199
|
+
`"${NEO_CONFIG_FILE}" field "test.forbidOnly" must be a boolean.`
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
return {
|
|
203
|
+
...include === void 0 ? {} : { include },
|
|
204
|
+
...exclude === void 0 ? {} : { exclude },
|
|
205
|
+
...timeoutMs === void 0 ? {} : { timeoutMs },
|
|
206
|
+
...maxWorkers === void 0 ? {} : { maxWorkers },
|
|
207
|
+
...forbidOnly === void 0 ? {} : { forbidOnly }
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
function writeWorkspaceConfig(root, config) {
|
|
211
|
+
let persisted = { ...config };
|
|
212
|
+
if (config.unityConfigPath !== void 0) {
|
|
213
|
+
const { projectId, versionId, ...rest } = persisted;
|
|
214
|
+
void projectId;
|
|
215
|
+
void versionId;
|
|
216
|
+
persisted = rest;
|
|
217
|
+
writeUnityConfigVersionId(root, config.unityConfigPath, config.versionId);
|
|
218
|
+
}
|
|
219
|
+
writeFileSync(
|
|
220
|
+
join(root, NEO_CONFIG_FILE),
|
|
221
|
+
`${JSON.stringify(persisted, null, 2)}
|
|
222
|
+
`,
|
|
223
|
+
"utf8"
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
function readUnityConfigIds(root, unityConfigPath) {
|
|
227
|
+
const assetPath = resolve(root, unityConfigPath);
|
|
228
|
+
if (!existsSync(assetPath)) {
|
|
229
|
+
throw new Error(
|
|
230
|
+
`"unityConfigPath" in "${NEO_CONFIG_FILE}" points to "${assetPath}", which does not exist.`
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
const content = readFileSync(assetPath, "utf8");
|
|
234
|
+
const projectId = matchUnityScalarField(content, "projectId");
|
|
235
|
+
if (projectId === null) {
|
|
236
|
+
throw new Error(
|
|
237
|
+
`Unity config asset "${assetPath}" has no "projectId" field.`
|
|
238
|
+
);
|
|
239
|
+
}
|
|
240
|
+
const versionId = matchUnityScalarField(content, "versionId");
|
|
241
|
+
if (versionId === null) {
|
|
242
|
+
throw new Error(
|
|
243
|
+
`Unity config asset "${assetPath}" has no "versionId" field.`
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
return { projectId, versionId };
|
|
247
|
+
}
|
|
248
|
+
function writeUnityConfigVersionId(root, unityConfigPath, versionId) {
|
|
249
|
+
const assetPath = resolve(root, unityConfigPath);
|
|
250
|
+
if (!existsSync(assetPath)) {
|
|
251
|
+
throw new Error(
|
|
252
|
+
`"unityConfigPath" in "${NEO_CONFIG_FILE}" points to "${assetPath}", which does not exist.`
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
const content = readFileSync(assetPath, "utf8");
|
|
256
|
+
const current = matchUnityScalarField(content, "versionId");
|
|
257
|
+
if (current === null) {
|
|
258
|
+
throw new Error(
|
|
259
|
+
`Unity config asset "${assetPath}" has no "versionId" field to update.`
|
|
260
|
+
);
|
|
261
|
+
}
|
|
262
|
+
if (current === versionId) return;
|
|
263
|
+
const updated = content.replace(
|
|
264
|
+
/^(\s*versionId:[ \t]*).*$/m,
|
|
265
|
+
`$1${versionId}`
|
|
266
|
+
);
|
|
267
|
+
writeFileSync(assetPath, updated, "utf8");
|
|
268
|
+
}
|
|
269
|
+
function matchUnityScalarField(content, field) {
|
|
270
|
+
const match = new RegExp(`^\\s*${field}:[ \\t]*(\\S+)[ \\t]*$`, "m").exec(
|
|
271
|
+
content
|
|
272
|
+
);
|
|
273
|
+
return match === null ? null : match[1];
|
|
274
|
+
}
|
|
275
|
+
function readWorkspaceState(root, options = {}) {
|
|
276
|
+
const statePath = join(root, NEO_STATE_DIR, NEO_STATE_FILE);
|
|
277
|
+
if (!existsSync(statePath)) {
|
|
278
|
+
options.onSourceRead?.(null);
|
|
279
|
+
return { records: {} };
|
|
280
|
+
}
|
|
281
|
+
const source = readFileSync(statePath, "utf8");
|
|
282
|
+
options.onSourceRead?.(source);
|
|
283
|
+
const parsed = JSON.parse(source);
|
|
284
|
+
if (typeof parsed !== "object" || parsed === null) {
|
|
285
|
+
throw new Error(`"${statePath}" must contain a JSON object.`);
|
|
286
|
+
}
|
|
287
|
+
const state = parsed;
|
|
288
|
+
if (typeof state.records !== "object" || state.records === null) {
|
|
289
|
+
throw new Error(`"${statePath}" is missing the "records" object.`);
|
|
290
|
+
}
|
|
291
|
+
for (const [key, value] of Object.entries(state.records)) {
|
|
292
|
+
if (typeof value !== "object" || value === null) {
|
|
293
|
+
throw new Error(
|
|
294
|
+
`"${statePath}" record ${JSON.stringify(key)} must be an object.`
|
|
295
|
+
);
|
|
296
|
+
}
|
|
297
|
+
const recordKind = value.recordKind;
|
|
298
|
+
if (recordKind === "type" || recordKind === "attribute" || key.startsWith("type:") || key.startsWith("attribute:")) {
|
|
299
|
+
if (options.discardLegacyFormat2State === true) {
|
|
300
|
+
return { records: {} };
|
|
301
|
+
}
|
|
302
|
+
throw new Error(
|
|
303
|
+
`"${statePath}" contains legacy Class/Member state at ${JSON.stringify(key)}. Cached legacy state cannot be upgraded; preserve any local source you need, then run \`neo pull --reset\` to reconstruct this format-4 working copy from the authoritative server.`
|
|
304
|
+
);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
return state;
|
|
308
|
+
}
|
|
309
|
+
function writeWorkspaceState(root, state) {
|
|
310
|
+
const stateDir = join(root, NEO_STATE_DIR);
|
|
311
|
+
mkdirSync(stateDir, { recursive: true });
|
|
312
|
+
writeFileSync(
|
|
313
|
+
join(stateDir, NEO_STATE_FILE),
|
|
314
|
+
`${JSON.stringify(state, null, 2)}
|
|
315
|
+
`,
|
|
316
|
+
"utf8"
|
|
317
|
+
);
|
|
318
|
+
}
|
|
319
|
+
function loadWorkspace(startDir, options = {}) {
|
|
320
|
+
const root = findWorkspaceRoot(startDir);
|
|
321
|
+
if (root === null) {
|
|
322
|
+
throw new Error(
|
|
323
|
+
`No "${NEO_CONFIG_FILE}" found in "${startDir}" or any parent directory. Run "neo init" first.`
|
|
324
|
+
);
|
|
325
|
+
}
|
|
326
|
+
let stateSourceSha256;
|
|
327
|
+
const state = readWorkspaceState(root, {
|
|
328
|
+
discardLegacyFormat2State: options.discardLegacyFormat2State,
|
|
329
|
+
...options.fingerprintStateSource === true ? {
|
|
330
|
+
onSourceRead: (source) => {
|
|
331
|
+
stateSourceSha256 = createHash("sha256").update(source ?? "<missing>").digest("hex");
|
|
332
|
+
}
|
|
333
|
+
} : {}
|
|
334
|
+
});
|
|
335
|
+
return {
|
|
336
|
+
root,
|
|
337
|
+
config: readWorkspaceConfig(root),
|
|
338
|
+
state,
|
|
339
|
+
...stateSourceSha256 === void 0 ? {} : { stateSourceSha256 }
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
var NEO_CONFIG_FILE, NEO_STATE_DIR, NEO_STATE_FILE, CURRENT_FORMAT_VERSION;
|
|
343
|
+
var init_workspace = __esm({
|
|
344
|
+
"src/workspace.ts"() {
|
|
345
|
+
"use strict";
|
|
346
|
+
NEO_CONFIG_FILE = "neo.json";
|
|
347
|
+
NEO_STATE_DIR = ".neo";
|
|
348
|
+
NEO_STATE_FILE = "state.json";
|
|
349
|
+
CURRENT_FORMAT_VERSION = 4;
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
// src/auth-api-base-url.ts
|
|
354
|
+
function resolveAuthApiBaseUrl(options) {
|
|
355
|
+
if (options.apiOverride !== null) return options.apiOverride;
|
|
356
|
+
const workspaceRoot = findWorkspaceRoot(options.cwd);
|
|
357
|
+
if (workspaceRoot === null) return options.defaultApiBaseUrl;
|
|
358
|
+
return readWorkspaceConfig(workspaceRoot).apiBaseUrl;
|
|
359
|
+
}
|
|
360
|
+
var init_auth_api_base_url = __esm({
|
|
361
|
+
"src/auth-api-base-url.ts"() {
|
|
362
|
+
"use strict";
|
|
363
|
+
init_workspace();
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
|
|
44
367
|
// src/token-store.ts
|
|
45
368
|
var token_store_exports = {};
|
|
46
369
|
__export(token_store_exports, {
|
|
@@ -56,15 +379,15 @@ __export(token_store_exports, {
|
|
|
56
379
|
});
|
|
57
380
|
import {
|
|
58
381
|
chmodSync,
|
|
59
|
-
existsSync,
|
|
60
|
-
mkdirSync,
|
|
61
|
-
readFileSync,
|
|
382
|
+
existsSync as existsSync2,
|
|
383
|
+
mkdirSync as mkdirSync2,
|
|
384
|
+
readFileSync as readFileSync2,
|
|
62
385
|
rmSync,
|
|
63
|
-
writeFileSync
|
|
386
|
+
writeFileSync as writeFileSync2
|
|
64
387
|
} from "node:fs";
|
|
65
388
|
import { execFileSync } from "node:child_process";
|
|
66
389
|
import { homedir } from "node:os";
|
|
67
|
-
import { isAbsolute, join } from "node:path";
|
|
390
|
+
import { isAbsolute, join as join2 } from "node:path";
|
|
68
391
|
function credentialsDir() {
|
|
69
392
|
const configHome = process.env[NEO_CONFIG_HOME_ENV_VAR];
|
|
70
393
|
if (configHome !== void 0 && configHome !== "") {
|
|
@@ -76,16 +399,16 @@ function credentialsDir() {
|
|
|
76
399
|
return configHome;
|
|
77
400
|
}
|
|
78
401
|
const xdg = process.env.XDG_CONFIG_HOME;
|
|
79
|
-
const base = xdg !== void 0 && xdg !== "" ? xdg :
|
|
80
|
-
return
|
|
402
|
+
const base = xdg !== void 0 && xdg !== "" ? xdg : join2(homedir(), ".config");
|
|
403
|
+
return join2(base, "neo-compose");
|
|
81
404
|
}
|
|
82
405
|
function credentialsPath() {
|
|
83
|
-
return
|
|
406
|
+
return join2(credentialsDir(), "credentials.json");
|
|
84
407
|
}
|
|
85
408
|
function readCredentialsFile() {
|
|
86
409
|
const path = credentialsPath();
|
|
87
|
-
if (!
|
|
88
|
-
const parsed = JSON.parse(
|
|
410
|
+
if (!existsSync2(path)) return { credentials: {} };
|
|
411
|
+
const parsed = JSON.parse(readFileSync2(path, "utf8"));
|
|
89
412
|
if (typeof parsed !== "object" || parsed === null) {
|
|
90
413
|
throw new Error(`Credentials file "${path}" must contain a JSON object.`);
|
|
91
414
|
}
|
|
@@ -154,11 +477,11 @@ function saveCredential(credential) {
|
|
|
154
477
|
keychainAccount(credential.apiBaseUrl),
|
|
155
478
|
credential.token
|
|
156
479
|
);
|
|
157
|
-
|
|
480
|
+
mkdirSync2(credentialsDir(), { recursive: true, mode: 448 });
|
|
158
481
|
const file = readCredentialsFile();
|
|
159
482
|
file.credentials[credential.apiBaseUrl] = inKeychain ? { ...credential, token: "" } : credential;
|
|
160
483
|
const path = credentialsPath();
|
|
161
|
-
|
|
484
|
+
writeFileSync2(path, `${JSON.stringify(file, null, 2)}
|
|
162
485
|
`, {
|
|
163
486
|
encoding: "utf8",
|
|
164
487
|
mode: 384
|
|
@@ -194,7 +517,7 @@ function deleteCredential(apiBaseUrl) {
|
|
|
194
517
|
if (Object.keys(file.credentials).length === 0) {
|
|
195
518
|
rmSync(path, { force: true });
|
|
196
519
|
} else {
|
|
197
|
-
|
|
520
|
+
writeFileSync2(path, `${JSON.stringify(file, null, 2)}
|
|
198
521
|
`, {
|
|
199
522
|
encoding: "utf8",
|
|
200
523
|
mode: 384
|
|
@@ -361,6 +684,7 @@ async function readStdin() {
|
|
|
361
684
|
return Buffer.concat(chunks).toString("utf8").trim();
|
|
362
685
|
}
|
|
363
686
|
async function runLogin(options) {
|
|
687
|
+
console.log(`Authenticating with ${options.apiBaseUrl}.`);
|
|
364
688
|
let profile = options.profile;
|
|
365
689
|
if (profile === null) {
|
|
366
690
|
profile = isInteractive() && !options.tokenStdin ? await promptSelect({
|
|
@@ -39355,7 +39679,7 @@ function assertInternalRecordRelationInvariants(manifest) {
|
|
|
39355
39679
|
const classes = requireArray(manifest.classes, "$.classes").map(
|
|
39356
39680
|
(value, index) => requireRecord(value, `$.classes[${index}]`)
|
|
39357
39681
|
);
|
|
39358
|
-
const
|
|
39682
|
+
const classesById2 = new Map(
|
|
39359
39683
|
classes.map((schemaClass2) => [String(schemaClass2.id), schemaClass2])
|
|
39360
39684
|
);
|
|
39361
39685
|
const endpoints = manifestEndpointKeys(manifest, relations);
|
|
@@ -39414,10 +39738,10 @@ function assertInternalRecordRelationInvariants(manifest) {
|
|
|
39414
39738
|
`${String(relation.relationKind)} requires ${contract.sourceRecordKind}-to-${contract.targetRecordKind} endpoints.`
|
|
39415
39739
|
);
|
|
39416
39740
|
}
|
|
39417
|
-
const sourceClass = contract.sourceRecordKind === "class" ?
|
|
39418
|
-
const targetClass = contract.targetRecordKind === "class" ?
|
|
39741
|
+
const sourceClass = contract.sourceRecordKind === "class" ? classesById2.get(String(relation.sourceRecordId)) : void 0;
|
|
39742
|
+
const targetClass = contract.targetRecordKind === "class" ? classesById2.get(String(relation.targetRecordId)) : void 0;
|
|
39419
39743
|
if (sourceClass !== void 0) {
|
|
39420
|
-
const actual = effectiveWorldKind2(sourceClass,
|
|
39744
|
+
const actual = effectiveWorldKind2(sourceClass, classesById2);
|
|
39421
39745
|
if (actual !== contract.sourceWorldKind) {
|
|
39422
39746
|
invalid(
|
|
39423
39747
|
`${path}.sourceRecordId`,
|
|
@@ -39426,7 +39750,7 @@ function assertInternalRecordRelationInvariants(manifest) {
|
|
|
39426
39750
|
}
|
|
39427
39751
|
}
|
|
39428
39752
|
if (targetClass !== void 0) {
|
|
39429
|
-
const actual = effectiveWorldKind2(targetClass,
|
|
39753
|
+
const actual = effectiveWorldKind2(targetClass, classesById2);
|
|
39430
39754
|
if (actual !== contract.targetWorldKind) {
|
|
39431
39755
|
invalid(
|
|
39432
39756
|
`${path}.targetRecordId`,
|
|
@@ -39479,9 +39803,9 @@ function assertInternalRecordRelationInvariants(manifest) {
|
|
|
39479
39803
|
}
|
|
39480
39804
|
}
|
|
39481
39805
|
assertAcyclicRelationGraph(graph);
|
|
39482
|
-
assertDefaultLayerCompatibility(relations,
|
|
39806
|
+
assertDefaultLayerCompatibility(relations, classesById2);
|
|
39483
39807
|
}
|
|
39484
|
-
function effectiveWorldKind2(schemaClass2,
|
|
39808
|
+
function effectiveWorldKind2(schemaClass2, classesById2) {
|
|
39485
39809
|
const visited = /* @__PURE__ */ new Set();
|
|
39486
39810
|
let current = schemaClass2;
|
|
39487
39811
|
while (current !== void 0) {
|
|
@@ -39493,7 +39817,7 @@ function effectiveWorldKind2(schemaClass2, classesById) {
|
|
|
39493
39817
|
const worldKind = system.worldKind;
|
|
39494
39818
|
if (typeof worldKind === "string") return worldKind;
|
|
39495
39819
|
}
|
|
39496
|
-
current = typeof current.extendsClassId === "string" ?
|
|
39820
|
+
current = typeof current.extendsClassId === "string" ? classesById2.get(current.extendsClassId) : void 0;
|
|
39497
39821
|
}
|
|
39498
39822
|
return null;
|
|
39499
39823
|
}
|
|
@@ -39546,7 +39870,7 @@ function assertAcyclicRelationGraph(graph) {
|
|
|
39546
39870
|
};
|
|
39547
39871
|
for (const node of graph.keys()) visit(node);
|
|
39548
39872
|
}
|
|
39549
|
-
function assertDefaultLayerCompatibility(relations,
|
|
39873
|
+
function assertDefaultLayerCompatibility(relations, classesById2) {
|
|
39550
39874
|
const pairs = [
|
|
39551
39875
|
["world.tile.default-layer", "world.tile.compatible-layer"],
|
|
39552
39876
|
["world.object.default-layer", "world.object.compatible-layer"]
|
|
@@ -39557,11 +39881,11 @@ function assertDefaultLayerCompatibility(relations, classesById) {
|
|
|
39557
39881
|
)) {
|
|
39558
39882
|
const sourceAncestors = classAncestorIds(
|
|
39559
39883
|
String(relation.sourceRecordId),
|
|
39560
|
-
|
|
39884
|
+
classesById2
|
|
39561
39885
|
);
|
|
39562
39886
|
const targetAncestors = classAncestorIds(
|
|
39563
39887
|
String(relation.targetRecordId),
|
|
39564
|
-
|
|
39888
|
+
classesById2
|
|
39565
39889
|
);
|
|
39566
39890
|
const covered = relations.some(
|
|
39567
39891
|
(candidate) => candidate.relationKind === compatibleKind && sourceAncestors.includes(String(candidate.sourceRecordId)) && targetAncestors.includes(String(candidate.targetRecordId))
|
|
@@ -39575,16 +39899,16 @@ function assertDefaultLayerCompatibility(relations, classesById) {
|
|
|
39575
39899
|
}
|
|
39576
39900
|
}
|
|
39577
39901
|
}
|
|
39578
|
-
function classAncestorIds(classId,
|
|
39902
|
+
function classAncestorIds(classId, classesById2) {
|
|
39579
39903
|
const result = [];
|
|
39580
39904
|
const visited = /* @__PURE__ */ new Set();
|
|
39581
|
-
let current =
|
|
39905
|
+
let current = classesById2.get(classId);
|
|
39582
39906
|
while (current !== void 0) {
|
|
39583
39907
|
const id2 = String(current.id);
|
|
39584
39908
|
if (visited.has(id2)) break;
|
|
39585
39909
|
visited.add(id2);
|
|
39586
39910
|
result.push(id2);
|
|
39587
|
-
current = typeof current.extendsClassId === "string" ?
|
|
39911
|
+
current = typeof current.extendsClassId === "string" ? classesById2.get(current.extendsClassId) : void 0;
|
|
39588
39912
|
}
|
|
39589
39913
|
return result;
|
|
39590
39914
|
}
|
|
@@ -39604,13 +39928,13 @@ function assertStaticMemberInvariants(manifest) {
|
|
|
39604
39928
|
const interfaces = requireArray(manifest.interfaces, "$.interfaces").map(
|
|
39605
39929
|
(value, index) => requireRecord(value, `$.interfaces[${index}]`)
|
|
39606
39930
|
);
|
|
39607
|
-
const
|
|
39931
|
+
const membersById2 = new Map(
|
|
39608
39932
|
members.map((member) => [String(member.id), member])
|
|
39609
39933
|
);
|
|
39610
39934
|
const memberIndexById = new Map(
|
|
39611
39935
|
members.map((member, index) => [String(member.id), index])
|
|
39612
39936
|
);
|
|
39613
|
-
const
|
|
39937
|
+
const classesById2 = new Map(
|
|
39614
39938
|
classes.map((schemaClass2) => [String(schemaClass2.id), schemaClass2])
|
|
39615
39939
|
);
|
|
39616
39940
|
const classIndexById = new Map(
|
|
@@ -39674,7 +39998,7 @@ function assertStaticMemberInvariants(manifest) {
|
|
|
39674
39998
|
if (member.kind === "generic") {
|
|
39675
39999
|
invalid(`${path}.kind`, "a Generic placeholder cannot be static.");
|
|
39676
40000
|
}
|
|
39677
|
-
const ownerClass =
|
|
40001
|
+
const ownerClass = classesById2.get(ownerClassId);
|
|
39678
40002
|
if (ownerClass === void 0) {
|
|
39679
40003
|
invalid(
|
|
39680
40004
|
`${path}.owner.classId`,
|
|
@@ -39725,7 +40049,7 @@ function assertStaticMemberInvariants(manifest) {
|
|
|
39725
40049
|
if (seen.has(id2)) break;
|
|
39726
40050
|
seen.add(id2);
|
|
39727
40051
|
chain.push(current);
|
|
39728
|
-
current = typeof current.extendsClassId === "string" ?
|
|
40052
|
+
current = typeof current.extendsClassId === "string" ? classesById2.get(current.extendsClassId) : void 0;
|
|
39729
40053
|
}
|
|
39730
40054
|
return chain;
|
|
39731
40055
|
};
|
|
@@ -39759,8 +40083,8 @@ function assertStaticMemberInvariants(manifest) {
|
|
|
39759
40083
|
(candidate) => typeof candidate === "string"
|
|
39760
40084
|
);
|
|
39761
40085
|
if (inheritedMemberId2 === void 0) continue;
|
|
39762
|
-
const local =
|
|
39763
|
-
const inherited =
|
|
40086
|
+
const local = membersById2.get(rawMemberId);
|
|
40087
|
+
const inherited = membersById2.get(inheritedMemberId2);
|
|
39764
40088
|
if (local?.isStatic !== true && inherited?.isStatic !== true) continue;
|
|
39765
40089
|
invalid(
|
|
39766
40090
|
`$.classes[${typeIndex}].schema.${schemaKey}`,
|
|
@@ -39810,7 +40134,7 @@ function assertStaticMemberInvariants(manifest) {
|
|
|
39810
40134
|
for (const key of interfaceMemberKeys(schemaClass2)) {
|
|
39811
40135
|
const memberId = schema.get(key);
|
|
39812
40136
|
if (memberId === void 0) continue;
|
|
39813
|
-
if (
|
|
40137
|
+
if (membersById2.get(memberId)?.isStatic !== true) continue;
|
|
39814
40138
|
invalid(
|
|
39815
40139
|
`$.classes[${typeIndex}].implementsInterfaceIds`,
|
|
39816
40140
|
`static member ${JSON.stringify(key)} cannot implement an instance interface member.`
|
|
@@ -39819,11 +40143,11 @@ function assertStaticMemberInvariants(manifest) {
|
|
|
39819
40143
|
}
|
|
39820
40144
|
for (const member of members) {
|
|
39821
40145
|
if (member.kind !== "list") continue;
|
|
39822
|
-
const entry =
|
|
40146
|
+
const entry = membersById2.get(String(member.entryMemberId));
|
|
39823
40147
|
if (entry?.kind !== "class" || typeof entry.classId !== "string") {
|
|
39824
40148
|
continue;
|
|
39825
40149
|
}
|
|
39826
|
-
const entryType =
|
|
40150
|
+
const entryType = classesById2.get(entry.classId);
|
|
39827
40151
|
if (entryType === void 0) continue;
|
|
39828
40152
|
const entrySchema = mergedSchema(entryType);
|
|
39829
40153
|
for (const index of requireArray(
|
|
@@ -39836,7 +40160,7 @@ function assertStaticMemberInvariants(manifest) {
|
|
|
39836
40160
|
);
|
|
39837
40161
|
if (typeof definition2.schemaKey !== "string") continue;
|
|
39838
40162
|
const indexedMemberId = entrySchema.get(definition2.schemaKey);
|
|
39839
|
-
if (indexedMemberId === void 0 ||
|
|
40163
|
+
if (indexedMemberId === void 0 || membersById2.get(indexedMemberId)?.isStatic !== true) {
|
|
39840
40164
|
continue;
|
|
39841
40165
|
}
|
|
39842
40166
|
const memberIndex = memberIndexById.get(String(member.id)) ?? 0;
|
|
@@ -41958,14 +42282,14 @@ var init_v4 = __esm({
|
|
|
41958
42282
|
});
|
|
41959
42283
|
|
|
41960
42284
|
// node_modules/uuid/dist-node/sha1.js
|
|
41961
|
-
import { createHash } from "node:crypto";
|
|
42285
|
+
import { createHash as createHash2 } from "node:crypto";
|
|
41962
42286
|
function sha1(bytes) {
|
|
41963
42287
|
if (Array.isArray(bytes)) {
|
|
41964
42288
|
bytes = Buffer.from(bytes);
|
|
41965
42289
|
} else if (typeof bytes === "string") {
|
|
41966
42290
|
bytes = Buffer.from(bytes, "utf8");
|
|
41967
42291
|
}
|
|
41968
|
-
return
|
|
42292
|
+
return createHash2("sha1").update(bytes).digest();
|
|
41969
42293
|
}
|
|
41970
42294
|
var sha1_default;
|
|
41971
42295
|
var init_sha1 = __esm({
|
|
@@ -44168,7 +44492,7 @@ var init_structured_leaf_fields = __esm({
|
|
|
44168
44492
|
{ name: "a", key: "a", type: "unitFloat" }
|
|
44169
44493
|
]
|
|
44170
44494
|
};
|
|
44171
|
-
STRUCTURED_LEAF_PARTIAL_KEY = "
|
|
44495
|
+
STRUCTURED_LEAF_PARTIAL_KEY = "~partial";
|
|
44172
44496
|
}
|
|
44173
44497
|
});
|
|
44174
44498
|
|
|
@@ -44690,7 +45014,7 @@ function isNSDelegateClosureValue(value) {
|
|
|
44690
45014
|
function isNSDelegateValue(value) {
|
|
44691
45015
|
return isMemberDelegateTarget(value) || isNSDelegateClosureValueDraft(value) || isNSDelegateClosureValue(value);
|
|
44692
45016
|
}
|
|
44693
|
-
function
|
|
45017
|
+
function nsDelegateDirectReference(value) {
|
|
44694
45018
|
if (!isNSDelegateClosureValue(value)) return null;
|
|
44695
45019
|
const instructions = value.action.instructions;
|
|
44696
45020
|
if (instructions.length !== 1) return null;
|
|
@@ -44698,7 +45022,10 @@ function nsDelegateDirectReferenceValueId(value) {
|
|
|
44698
45022
|
if (instruction?.type !== "return" /* return */ || instruction.pointer?.type !== "reference" /* reference */) {
|
|
44699
45023
|
return null;
|
|
44700
45024
|
}
|
|
44701
|
-
return
|
|
45025
|
+
return {
|
|
45026
|
+
valueId: instruction.pointer.valueId,
|
|
45027
|
+
withProvenance: instruction.pointer.withProvenance === true
|
|
45028
|
+
};
|
|
44702
45029
|
}
|
|
44703
45030
|
function isMemberDelegateBase(value) {
|
|
44704
45031
|
const v = asMemberBaseForKind(value, 25 /* NSDelegate */);
|
|
@@ -45178,10 +45505,67 @@ var init_member_kinds = __esm({
|
|
|
45178
45505
|
});
|
|
45179
45506
|
|
|
45180
45507
|
// ../src/models/classes/inheritance.ts
|
|
45508
|
+
function isIndexCurrent(cached, entries) {
|
|
45509
|
+
if (cached === void 0) return false;
|
|
45510
|
+
if (cached.epoch !== mergedSchemaEpoch) return false;
|
|
45511
|
+
const { snapshot } = cached;
|
|
45512
|
+
if (snapshot.length !== entries.length) return false;
|
|
45513
|
+
for (let i = 0; i < entries.length; i++) {
|
|
45514
|
+
if (snapshot[i] !== entries[i]) return false;
|
|
45515
|
+
}
|
|
45516
|
+
return true;
|
|
45517
|
+
}
|
|
45518
|
+
function classesById(classes) {
|
|
45519
|
+
const cached = classIndexes.get(classes);
|
|
45520
|
+
if (isIndexCurrent(cached, classes)) return cached.byId;
|
|
45521
|
+
const byId = /* @__PURE__ */ new Map();
|
|
45522
|
+
for (const entry of classes) byId.set(entry.id, entry);
|
|
45523
|
+
classIndexes.set(classes, {
|
|
45524
|
+
snapshot: [...classes],
|
|
45525
|
+
epoch: mergedSchemaEpoch,
|
|
45526
|
+
byId
|
|
45527
|
+
});
|
|
45528
|
+
return byId;
|
|
45529
|
+
}
|
|
45530
|
+
function membersById(members) {
|
|
45531
|
+
const cached = memberIndexes.get(members);
|
|
45532
|
+
if (isIndexCurrent(cached, members)) return cached.byId;
|
|
45533
|
+
const byId = /* @__PURE__ */ new Map();
|
|
45534
|
+
for (const entry of members) byId.set(entry.id, entry);
|
|
45535
|
+
memberIndexes.set(members, {
|
|
45536
|
+
snapshot: [...members],
|
|
45537
|
+
epoch: mergedSchemaEpoch,
|
|
45538
|
+
byId
|
|
45539
|
+
});
|
|
45540
|
+
return byId;
|
|
45541
|
+
}
|
|
45542
|
+
function createMergeMemo() {
|
|
45543
|
+
const byClasses = /* @__PURE__ */ new WeakMap();
|
|
45544
|
+
return (classId, classIndex, memberIndex, compute) => {
|
|
45545
|
+
let byMembers = byClasses.get(classIndex);
|
|
45546
|
+
if (byMembers === void 0) {
|
|
45547
|
+
byMembers = /* @__PURE__ */ new WeakMap();
|
|
45548
|
+
byClasses.set(classIndex, byMembers);
|
|
45549
|
+
}
|
|
45550
|
+
let byClassId = byMembers.get(memberIndex);
|
|
45551
|
+
if (byClassId === void 0) {
|
|
45552
|
+
byClassId = /* @__PURE__ */ new Map();
|
|
45553
|
+
byMembers.set(memberIndex, byClassId);
|
|
45554
|
+
}
|
|
45555
|
+
const cached = byClassId.get(classId);
|
|
45556
|
+
if (cached !== void 0) return [...cached];
|
|
45557
|
+
const computed = compute();
|
|
45558
|
+
byClassId.set(classId, computed);
|
|
45559
|
+
return [...computed];
|
|
45560
|
+
};
|
|
45561
|
+
}
|
|
45181
45562
|
function resolveInheritanceChain(classId, classes, draft) {
|
|
45563
|
+
return resolveChainFromIndex(classId, classesById(classes), draft);
|
|
45564
|
+
}
|
|
45565
|
+
function resolveChainFromIndex(classId, index, draft) {
|
|
45182
45566
|
const chain = [];
|
|
45183
45567
|
const visited = /* @__PURE__ */ new Set();
|
|
45184
|
-
const lookup = (id2) => draft && draft.id === id2 ? draft :
|
|
45568
|
+
const lookup = (id2) => draft && draft.id === id2 ? draft : index.get(id2);
|
|
45185
45569
|
let current = lookup(classId);
|
|
45186
45570
|
while (current) {
|
|
45187
45571
|
if (visited.has(current.id)) {
|
|
@@ -45201,18 +45585,19 @@ function mergeSchemas(chain) {
|
|
|
45201
45585
|
const baseFirst = [...chain].reverse();
|
|
45202
45586
|
const map = /* @__PURE__ */ new Map();
|
|
45203
45587
|
const order = [];
|
|
45588
|
+
const ordered = /* @__PURE__ */ new Set();
|
|
45204
45589
|
for (const schemaClass2 of baseFirst) {
|
|
45205
45590
|
const localKeys = getClassSchemaKeyOrder(schemaClass2);
|
|
45206
45591
|
if (schemaClass2.schemaKeyOrder !== void 0) {
|
|
45207
|
-
|
|
45208
|
-
|
|
45209
|
-
|
|
45210
|
-
|
|
45211
|
-
...order.filter((key) => !localKeys.includes(key))
|
|
45212
|
-
);
|
|
45592
|
+
const localKeySet = new Set(localKeys);
|
|
45593
|
+
const trailing = order.filter((key) => !localKeySet.has(key));
|
|
45594
|
+
order.splice(0, order.length, ...localKeys, ...trailing);
|
|
45595
|
+
for (const key of localKeys) ordered.add(key);
|
|
45213
45596
|
}
|
|
45214
45597
|
for (const key of localKeys) {
|
|
45215
|
-
if (
|
|
45598
|
+
if (ordered.has(key)) continue;
|
|
45599
|
+
order.push(key);
|
|
45600
|
+
ordered.add(key);
|
|
45216
45601
|
}
|
|
45217
45602
|
for (const [key, memberId] of Object.entries(schemaClass2.schema)) {
|
|
45218
45603
|
map.set(key, {
|
|
@@ -45228,21 +45613,44 @@ function mergeSchemas(chain) {
|
|
|
45228
45613
|
});
|
|
45229
45614
|
}
|
|
45230
45615
|
function mergeInstanceSurfaceSchema(classId, classes, members) {
|
|
45231
|
-
|
|
45232
|
-
|
|
45233
|
-
(
|
|
45616
|
+
return instanceSurfaceFromIndexes(
|
|
45617
|
+
classId,
|
|
45618
|
+
classesById(classes),
|
|
45619
|
+
membersById(members)
|
|
45620
|
+
);
|
|
45621
|
+
}
|
|
45622
|
+
function instanceSurfaceFromIndexes(classId, classIndex, memberIndex) {
|
|
45623
|
+
return instanceSurfaceMemo(
|
|
45624
|
+
classId,
|
|
45625
|
+
classIndex,
|
|
45626
|
+
memberIndex,
|
|
45627
|
+
() => mergeSchemas(resolveChainFromIndex(classId, classIndex)).filter(
|
|
45628
|
+
(entry) => memberIndex.get(entry.memberId)?.isStatic !== true
|
|
45629
|
+
)
|
|
45234
45630
|
);
|
|
45235
45631
|
}
|
|
45236
45632
|
function mergeStoredInstanceSchema(classId, classes, members) {
|
|
45237
|
-
const
|
|
45238
|
-
|
|
45239
|
-
|
|
45633
|
+
const classIndex = classesById(classes);
|
|
45634
|
+
const memberIndex = membersById(members);
|
|
45635
|
+
return storedInstanceMemo(
|
|
45636
|
+
classId,
|
|
45637
|
+
classIndex,
|
|
45638
|
+
memberIndex,
|
|
45639
|
+
() => instanceSurfaceFromIndexes(classId, classIndex, memberIndex).filter(
|
|
45640
|
+
(entry) => memberIndex.get(entry.memberId)?.isReadOnly !== true
|
|
45641
|
+
)
|
|
45240
45642
|
);
|
|
45241
45643
|
}
|
|
45242
45644
|
function mergeReadOnlyMembers(classId, classes, members) {
|
|
45243
|
-
const
|
|
45244
|
-
|
|
45245
|
-
|
|
45645
|
+
const classIndex = classesById(classes);
|
|
45646
|
+
const memberIndex = membersById(members);
|
|
45647
|
+
return readOnlyMemberMemo(
|
|
45648
|
+
classId,
|
|
45649
|
+
classIndex,
|
|
45650
|
+
memberIndex,
|
|
45651
|
+
() => instanceSurfaceFromIndexes(classId, classIndex, memberIndex).filter(
|
|
45652
|
+
(entry) => memberIndex.get(entry.memberId)?.isReadOnly === true
|
|
45653
|
+
)
|
|
45246
45654
|
);
|
|
45247
45655
|
}
|
|
45248
45656
|
function findSchemaPlacement(memberId, classes) {
|
|
@@ -45255,13 +45663,13 @@ function findSchemaPlacement(memberId, classes) {
|
|
|
45255
45663
|
}
|
|
45256
45664
|
return null;
|
|
45257
45665
|
}
|
|
45258
|
-
function findNearestAncestorSchemaPlacement(ownerClass, schemaKey,
|
|
45666
|
+
function findNearestAncestorSchemaPlacement(ownerClass, schemaKey, classesById2) {
|
|
45259
45667
|
const visited = /* @__PURE__ */ new Set([ownerClass.id]);
|
|
45260
45668
|
let ancestorId = ownerClass.extendsClassId;
|
|
45261
45669
|
while (typeof ancestorId === "string") {
|
|
45262
45670
|
if (visited.has(ancestorId)) return null;
|
|
45263
45671
|
visited.add(ancestorId);
|
|
45264
|
-
const ancestor =
|
|
45672
|
+
const ancestor = classesById2.get(ancestorId);
|
|
45265
45673
|
if (ancestor === void 0) return null;
|
|
45266
45674
|
if (typeof ancestor.schema[schemaKey] === "string") {
|
|
45267
45675
|
return { ownerClass: ancestor, schemaKey };
|
|
@@ -45273,7 +45681,8 @@ function findNearestAncestorSchemaPlacement(ownerClass, schemaKey, classesById)
|
|
|
45273
45681
|
function walkExtendsMemberChain(startId, members, pick, options) {
|
|
45274
45682
|
const requireKind = options?.requireKind;
|
|
45275
45683
|
const maxHops = options?.maxHops ?? 16;
|
|
45276
|
-
|
|
45684
|
+
const byId = membersById(members);
|
|
45685
|
+
let cursor = byId.get(startId);
|
|
45277
45686
|
for (let i = 0; cursor && i < maxHops; i++) {
|
|
45278
45687
|
if (requireKind !== void 0 && cursor.kind !== requireKind) {
|
|
45279
45688
|
return void 0;
|
|
@@ -45282,13 +45691,14 @@ function walkExtendsMemberChain(startId, members, pick, options) {
|
|
|
45282
45691
|
if (v !== void 0) return v;
|
|
45283
45692
|
const nextId = getOptionalString(cursor, "extendsMemberId");
|
|
45284
45693
|
if (nextId === void 0) return void 0;
|
|
45285
|
-
cursor =
|
|
45694
|
+
cursor = byId.get(nextId);
|
|
45286
45695
|
}
|
|
45287
45696
|
return void 0;
|
|
45288
45697
|
}
|
|
45289
45698
|
function resolveMember2(member, members) {
|
|
45290
45699
|
const chain = [];
|
|
45291
45700
|
const visited = /* @__PURE__ */ new Set();
|
|
45701
|
+
let byId;
|
|
45292
45702
|
let current = member;
|
|
45293
45703
|
while (current) {
|
|
45294
45704
|
const id2 = getOptionalString(current, "id");
|
|
@@ -45301,16 +45711,16 @@ function resolveMember2(member, members) {
|
|
|
45301
45711
|
chain.push(current);
|
|
45302
45712
|
if (!isMemberOverrideMarker(current)) break;
|
|
45303
45713
|
const parentId = current.extendsMemberId;
|
|
45304
|
-
current =
|
|
45714
|
+
current = (byId ??= membersById(members)).get(parentId);
|
|
45305
45715
|
}
|
|
45306
45716
|
const tail = chain[chain.length - 1];
|
|
45307
45717
|
if (!tail || isMemberOverrideMarker(tail)) {
|
|
45308
45718
|
const startId = getOptionalString(member, "id") ?? "(unknown)";
|
|
45309
45719
|
throw new UnresolvedMemberInheritanceError(startId);
|
|
45310
45720
|
}
|
|
45311
|
-
|
|
45721
|
+
chain.reverse();
|
|
45312
45722
|
const merged = {};
|
|
45313
|
-
for (const link of
|
|
45723
|
+
for (const link of chain) {
|
|
45314
45724
|
for (const [key, value] of Object.entries(link)) {
|
|
45315
45725
|
if (value === void 0) continue;
|
|
45316
45726
|
merged[key] = value;
|
|
@@ -45345,7 +45755,7 @@ function descendantClassIds(classId, allClasses) {
|
|
|
45345
45755
|
}
|
|
45346
45756
|
return result;
|
|
45347
45757
|
}
|
|
45348
|
-
var CircularInheritanceError, UnresolvedMemberInheritanceError, mergeInstanceSchema;
|
|
45758
|
+
var CircularInheritanceError, UnresolvedMemberInheritanceError, mergedSchemaEpoch, classIndexes, memberIndexes, instanceSurfaceMemo, storedInstanceMemo, readOnlyMemberMemo, staticMemberMemo, mergeInstanceSchema;
|
|
45349
45759
|
var init_inheritance = __esm({
|
|
45350
45760
|
"../src/models/classes/inheritance.ts"() {
|
|
45351
45761
|
"use strict";
|
|
@@ -45375,6 +45785,13 @@ var init_inheritance = __esm({
|
|
|
45375
45785
|
}
|
|
45376
45786
|
memberId;
|
|
45377
45787
|
};
|
|
45788
|
+
mergedSchemaEpoch = 0;
|
|
45789
|
+
classIndexes = /* @__PURE__ */ new WeakMap();
|
|
45790
|
+
memberIndexes = /* @__PURE__ */ new WeakMap();
|
|
45791
|
+
instanceSurfaceMemo = createMergeMemo();
|
|
45792
|
+
storedInstanceMemo = createMergeMemo();
|
|
45793
|
+
readOnlyMemberMemo = createMergeMemo();
|
|
45794
|
+
staticMemberMemo = createMergeMemo();
|
|
45378
45795
|
mergeInstanceSchema = mergeInstanceSurfaceSchema;
|
|
45379
45796
|
}
|
|
45380
45797
|
});
|
|
@@ -45414,11 +45831,14 @@ function inSystemRecordNamespaceOf(ownerId, derivedId) {
|
|
|
45414
45831
|
}
|
|
45415
45832
|
return systemRecordId(derivedId);
|
|
45416
45833
|
}
|
|
45417
|
-
var SYSTEM_RECORD_ID_PREFIX2;
|
|
45834
|
+
var SYSTEM_RECORD_ID_PREFIX2, RECORD_ID_PATTERN;
|
|
45418
45835
|
var init_system_record_id = __esm({
|
|
45419
45836
|
"../src/models/system-record-id.ts"() {
|
|
45420
45837
|
"use strict";
|
|
45421
45838
|
SYSTEM_RECORD_ID_PREFIX2 = "system_";
|
|
45839
|
+
RECORD_ID_PATTERN = new RegExp(
|
|
45840
|
+
`^(?:${SYSTEM_RECORD_ID_PREFIX2})?[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$`
|
|
45841
|
+
);
|
|
45422
45842
|
}
|
|
45423
45843
|
});
|
|
45424
45844
|
|
|
@@ -47811,7 +48231,7 @@ function constructedSlotArgumentAccepts(args) {
|
|
|
47811
48231
|
);
|
|
47812
48232
|
}
|
|
47813
48233
|
function isAnimationChildOverrideEntrySlot(slotMember, members) {
|
|
47814
|
-
const
|
|
48234
|
+
const membersById2 = new Map(members.map((member) => [member.id, member]));
|
|
47815
48235
|
const visited = /* @__PURE__ */ new Set();
|
|
47816
48236
|
let current = slotMember;
|
|
47817
48237
|
while (current !== void 0) {
|
|
@@ -47821,7 +48241,7 @@ function isAnimationChildOverrideEntrySlot(slotMember, members) {
|
|
|
47821
48241
|
if (id2 === WORLD_ANIMATION_FRAME_CHILD_OVERRIDES_MEMBER_ID || id2 === WORLD_ANIMATION_FRAME_CHILD_OVERRIDES_ENTRY_MEMBER_ID) {
|
|
47822
48242
|
return true;
|
|
47823
48243
|
}
|
|
47824
|
-
current = typeof current.extendsMemberId === "string" ?
|
|
48244
|
+
current = typeof current.extendsMemberId === "string" ? membersById2.get(current.extendsMemberId) : void 0;
|
|
47825
48245
|
}
|
|
47826
48246
|
return false;
|
|
47827
48247
|
}
|
|
@@ -47878,12 +48298,13 @@ function carriesCompleteConstructionRecipe(value) {
|
|
|
47878
48298
|
var init_instance_provenance = __esm({
|
|
47879
48299
|
"../src/models/members/instance-provenance.ts"() {
|
|
47880
48300
|
"use strict";
|
|
48301
|
+
init_member_kinds();
|
|
47881
48302
|
}
|
|
47882
48303
|
});
|
|
47883
48304
|
|
|
47884
48305
|
// ../src/models/members/read-only-members.ts
|
|
47885
48306
|
function assertReadOnlyMembersValid(document) {
|
|
47886
|
-
const
|
|
48307
|
+
const membersById2 = new Map(
|
|
47887
48308
|
document.members.map((member) => [member.id, member])
|
|
47888
48309
|
);
|
|
47889
48310
|
const valuesById = new Map(document.values.map((value) => [value.id, value]));
|
|
@@ -48017,7 +48438,7 @@ function assertReadOnlyMembersValid(document) {
|
|
|
48017
48438
|
assertOwnedSchemaIsImmutable({
|
|
48018
48439
|
member,
|
|
48019
48440
|
memberId: member.id,
|
|
48020
|
-
membersById,
|
|
48441
|
+
membersById: membersById2,
|
|
48021
48442
|
document,
|
|
48022
48443
|
visitedBindings: /* @__PURE__ */ new Set(),
|
|
48023
48444
|
label: member.name,
|
|
@@ -48028,7 +48449,7 @@ function assertReadOnlyMembersValid(document) {
|
|
|
48028
48449
|
}
|
|
48029
48450
|
const visitedValueIds = /* @__PURE__ */ new Set();
|
|
48030
48451
|
const inspect = (memberId, body, classId) => {
|
|
48031
|
-
const member =
|
|
48452
|
+
const member = membersById2.get(memberId);
|
|
48032
48453
|
if (member === void 0) return;
|
|
48033
48454
|
const resolved = resolveMember2(member, document.members);
|
|
48034
48455
|
if (isMemberLookupBase(resolved)) {
|
|
@@ -48062,7 +48483,7 @@ function assertReadOnlyMembersValid(document) {
|
|
|
48062
48483
|
document.classes,
|
|
48063
48484
|
document.members
|
|
48064
48485
|
)) {
|
|
48065
|
-
const childMember =
|
|
48486
|
+
const childMember = membersById2.get(entry.memberId);
|
|
48066
48487
|
if (childMember?.isReadOnly === true) {
|
|
48067
48488
|
if (record3[entry.schemaKey] !== void 0) {
|
|
48068
48489
|
throw new Error(
|
|
@@ -48104,7 +48525,7 @@ function assertReadOnlyMembersValid(document) {
|
|
|
48104
48525
|
document.classes,
|
|
48105
48526
|
document.members
|
|
48106
48527
|
)) {
|
|
48107
|
-
if (
|
|
48528
|
+
if (membersById2.get(entry.memberId)?.isReadOnly !== true) continue;
|
|
48108
48529
|
if (record3[entry.schemaKey] === void 0) continue;
|
|
48109
48530
|
throw new Error(
|
|
48110
48531
|
`Class value "${value.id}" contains read-only declaration member "${entry.schemaKey}"; a read-only declaration member cannot have an instance value.`
|
|
@@ -61613,7 +62034,7 @@ function variantProjection(context) {
|
|
|
61613
62034
|
(folder) => [folder.id, folder]
|
|
61614
62035
|
)
|
|
61615
62036
|
);
|
|
61616
|
-
const
|
|
62037
|
+
const membersById2 = new Map(
|
|
61617
62038
|
context.vm.members.map((member) => [member.id, member])
|
|
61618
62039
|
);
|
|
61619
62040
|
return variants.map((variant) => ({
|
|
@@ -61623,8 +62044,8 @@ function variantProjection(context) {
|
|
|
61623
62044
|
folder: variant.folderId === null ? null : pathByFolderId.get(variant.folderId) ?? null,
|
|
61624
62045
|
...(() => {
|
|
61625
62046
|
const folder = variant.folderId === null ? void 0 : foldersById.get(variant.folderId);
|
|
61626
|
-
const collection = folder?.binding == null ? void 0 :
|
|
61627
|
-
const entry = isMemberListBase(collection) ?
|
|
62047
|
+
const collection = folder?.binding == null ? void 0 : membersById2.get(folder.binding.collectionMemberId);
|
|
62048
|
+
const entry = isMemberListBase(collection) ? membersById2.get(collection.entryMemberId) : void 0;
|
|
61628
62049
|
return isMemberClassBase(entry) ? { valueTypeId: entry.classId } : {};
|
|
61629
62050
|
})()
|
|
61630
62051
|
}));
|
|
@@ -61805,7 +62226,7 @@ function constructorSignature(schemaClass2, members, context, genericEnvironment
|
|
|
61805
62226
|
};
|
|
61806
62227
|
}
|
|
61807
62228
|
function inheritedConstructorProjections(schemaClass2, context) {
|
|
61808
|
-
const
|
|
62229
|
+
const classesById2 = new Map(
|
|
61809
62230
|
context.vm.classes.map((candidate) => [candidate.id, candidate])
|
|
61810
62231
|
);
|
|
61811
62232
|
const projections = [];
|
|
@@ -61819,7 +62240,7 @@ function inheritedConstructorProjections(schemaClass2, context) {
|
|
|
61819
62240
|
claimed.add(projection.parameterName);
|
|
61820
62241
|
projections.push(projection);
|
|
61821
62242
|
}
|
|
61822
|
-
current = current.extendsClassId ?
|
|
62243
|
+
current = current.extendsClassId ? classesById2.get(current.extendsClassId) : void 0;
|
|
61823
62244
|
}
|
|
61824
62245
|
return projections;
|
|
61825
62246
|
}
|
|
@@ -62958,7 +63379,7 @@ function clearNeoScriptBodyCompileCache() {
|
|
|
62958
63379
|
}
|
|
62959
63380
|
function createNeoScriptCompilationProject(ctx) {
|
|
62960
63381
|
const members = [...ctx.members];
|
|
62961
|
-
const
|
|
63382
|
+
const membersById2 = new Map(members.map((member) => [member.id, member]));
|
|
62962
63383
|
return createNeoScriptProject({
|
|
62963
63384
|
vm: {
|
|
62964
63385
|
project: ctx.project,
|
|
@@ -62968,7 +63389,7 @@ function createNeoScriptCompilationProject(ctx) {
|
|
|
62968
63389
|
enums: [...ctx.enums],
|
|
62969
63390
|
interfaces: [...ctx.interfaces ?? []],
|
|
62970
63391
|
databaseVM: {
|
|
62971
|
-
memberById: (id2) =>
|
|
63392
|
+
memberById: (id2) => membersById2.get(id2) ?? null
|
|
62972
63393
|
}
|
|
62973
63394
|
},
|
|
62974
63395
|
thisClass: null,
|
|
@@ -63128,7 +63549,7 @@ function compilationProjectIdentity(project) {
|
|
|
63128
63549
|
}
|
|
63129
63550
|
function createContext(ctx, options) {
|
|
63130
63551
|
const members = [...ctx.members];
|
|
63131
|
-
const
|
|
63552
|
+
const membersById2 = new Map(members.map((member) => [member.id, member]));
|
|
63132
63553
|
const analyzer = {
|
|
63133
63554
|
vm: {
|
|
63134
63555
|
project: ctx.project,
|
|
@@ -63138,7 +63559,7 @@ function createContext(ctx, options) {
|
|
|
63138
63559
|
enums: [...ctx.enums],
|
|
63139
63560
|
interfaces: [...ctx.interfaces ?? []],
|
|
63140
63561
|
databaseVM: {
|
|
63141
|
-
memberById: (id2) =>
|
|
63562
|
+
memberById: (id2) => membersById2.get(id2) ?? null
|
|
63142
63563
|
}
|
|
63143
63564
|
},
|
|
63144
63565
|
thisClass: ctx.thisClass,
|
|
@@ -64168,10 +64589,10 @@ function resolveOwnerMembersForValues(document, targetValueIds, additionalRoots,
|
|
|
64168
64589
|
const resolved = /* @__PURE__ */ new Map();
|
|
64169
64590
|
if (targetValueIds.size === 0) return resolved;
|
|
64170
64591
|
const valuesById = new Map(document.values.map((value) => [value.id, value]));
|
|
64171
|
-
const
|
|
64592
|
+
const membersById2 = new Map(
|
|
64172
64593
|
document.members.map((member) => [member.id, member])
|
|
64173
64594
|
);
|
|
64174
|
-
const
|
|
64595
|
+
const classesById2 = new Map(
|
|
64175
64596
|
document.classes.map((schemaClass2) => [schemaClass2.id, schemaClass2])
|
|
64176
64597
|
);
|
|
64177
64598
|
const storedSchemaByClassId = /* @__PURE__ */ new Map();
|
|
@@ -64256,7 +64677,7 @@ function resolveOwnerMembersForValues(document, targetValueIds, additionalRoots,
|
|
|
64256
64677
|
if (isMemberClassBase(member)) {
|
|
64257
64678
|
if (!isRecordValue(body.value)) return;
|
|
64258
64679
|
const effectiveClassId = body.classId ?? member.classId;
|
|
64259
|
-
const schemaClass2 =
|
|
64680
|
+
const schemaClass2 = classesById2.get(effectiveClassId);
|
|
64260
64681
|
if (schemaClass2 === void 0) return;
|
|
64261
64682
|
const merged = storedSchema(effectiveClassId);
|
|
64262
64683
|
const env = member.classArguments === void 0 || member.classArguments === null ? defaultInstanceEnv(effectiveClassId) : resolveInstanceEnv(
|
|
@@ -64268,7 +64689,7 @@ function resolveOwnerMembersForValues(document, targetValueIds, additionalRoots,
|
|
|
64268
64689
|
if (entry.memberId === null) continue;
|
|
64269
64690
|
const childValueId = body.value[entry.schemaKey];
|
|
64270
64691
|
if (childValueId === void 0) continue;
|
|
64271
|
-
const childMember =
|
|
64692
|
+
const childMember = membersById2.get(entry.memberId);
|
|
64272
64693
|
if (childMember === void 0) continue;
|
|
64273
64694
|
const substituted = trySubstituteMember(childMember, env);
|
|
64274
64695
|
if (substituted === null) continue;
|
|
@@ -64278,7 +64699,7 @@ function resolveOwnerMembersForValues(document, targetValueIds, additionalRoots,
|
|
|
64278
64699
|
}
|
|
64279
64700
|
if (isMemberDictionaryBase(member)) {
|
|
64280
64701
|
if (!isRecordValue(body.value)) return;
|
|
64281
|
-
const entryMemberRecord =
|
|
64702
|
+
const entryMemberRecord = membersById2.get(member.entryMemberId);
|
|
64282
64703
|
if (entryMemberRecord === void 0) return;
|
|
64283
64704
|
const entryEnv = overlayStamp(ambientEnv, body.genericBindings);
|
|
64284
64705
|
const entryMember = trySubstituteMember(entryMemberRecord, entryEnv);
|
|
@@ -64289,7 +64710,7 @@ function resolveOwnerMembersForValues(document, targetValueIds, additionalRoots,
|
|
|
64289
64710
|
return;
|
|
64290
64711
|
}
|
|
64291
64712
|
if (isMemberListBase(member)) {
|
|
64292
|
-
const entryMemberRecord =
|
|
64713
|
+
const entryMemberRecord = membersById2.get(member.entryMemberId);
|
|
64293
64714
|
if (entryMemberRecord === void 0) return;
|
|
64294
64715
|
const entryEnv = overlayStamp(ambientEnv, body.genericBindings);
|
|
64295
64716
|
const entryMember = trySubstituteMember(entryMemberRecord, entryEnv);
|
|
@@ -65466,7 +65887,7 @@ function validateInternalRecordRelations(args) {
|
|
|
65466
65887
|
}
|
|
65467
65888
|
endpoints.set(key, candidate);
|
|
65468
65889
|
}
|
|
65469
|
-
const
|
|
65890
|
+
const classesById2 = new Map(
|
|
65470
65891
|
args.classes.map((schemaClass2) => [schemaClass2.id, schemaClass2])
|
|
65471
65892
|
);
|
|
65472
65893
|
const relationIds = /* @__PURE__ */ new Set();
|
|
@@ -65532,7 +65953,7 @@ function validateInternalRecordRelations(args) {
|
|
|
65532
65953
|
contract,
|
|
65533
65954
|
endpoint: "source",
|
|
65534
65955
|
recordEndpoint: source,
|
|
65535
|
-
classesById,
|
|
65956
|
+
classesById: classesById2,
|
|
65536
65957
|
classes: args.classes
|
|
65537
65958
|
});
|
|
65538
65959
|
validateWorldEndpoint({
|
|
@@ -65540,7 +65961,7 @@ function validateInternalRecordRelations(args) {
|
|
|
65540
65961
|
contract,
|
|
65541
65962
|
endpoint: "target",
|
|
65542
65963
|
recordEndpoint: target,
|
|
65543
|
-
classesById,
|
|
65964
|
+
classesById: classesById2,
|
|
65544
65965
|
classes: args.classes
|
|
65545
65966
|
});
|
|
65546
65967
|
const edgeKey = [
|
|
@@ -65613,10 +66034,10 @@ function resolveEffectiveClassRelations(args) {
|
|
|
65613
66034
|
`Internal relation kind "${args.relationKind}" is not class-to-class.`
|
|
65614
66035
|
);
|
|
65615
66036
|
}
|
|
65616
|
-
const
|
|
66037
|
+
const classesById2 = new Map(
|
|
65617
66038
|
args.classes.map((schemaClass2) => [schemaClass2.id, schemaClass2])
|
|
65618
66039
|
);
|
|
65619
|
-
const sourceIds = contract.sourceClassPolicy === "include-descendants" ? classAncestry(args.sourceClassId,
|
|
66040
|
+
const sourceIds = contract.sourceClassPolicy === "include-descendants" ? classAncestry(args.sourceClassId, classesById2) : [args.sourceClassId];
|
|
65620
66041
|
const sourceDepth = new Map(
|
|
65621
66042
|
sourceIds.map((sourceId3, index) => [sourceId3, index])
|
|
65622
66043
|
);
|
|
@@ -65646,7 +66067,7 @@ function resolveEffectiveClassRelations(args) {
|
|
|
65646
66067
|
const targetIds = contract.targetClassPolicy === "include-descendants" ? concreteClassDescendants(
|
|
65647
66068
|
declaration.targetRecordId,
|
|
65648
66069
|
args.classes,
|
|
65649
|
-
|
|
66070
|
+
classesById2
|
|
65650
66071
|
) : [declaration.targetRecordId];
|
|
65651
66072
|
for (const targetId of targetIds) {
|
|
65652
66073
|
const current = byTarget.get(targetId);
|
|
@@ -65830,7 +66251,7 @@ function validateDefaultLayerCompatibility(args) {
|
|
|
65830
66251
|
}
|
|
65831
66252
|
}
|
|
65832
66253
|
}
|
|
65833
|
-
function classAncestry(classId,
|
|
66254
|
+
function classAncestry(classId, classesById2) {
|
|
65834
66255
|
const result = [];
|
|
65835
66256
|
const visited = /* @__PURE__ */ new Set();
|
|
65836
66257
|
let currentId = classId;
|
|
@@ -65840,14 +66261,14 @@ function classAncestry(classId, classesById) {
|
|
|
65840
66261
|
}
|
|
65841
66262
|
visited.add(currentId);
|
|
65842
66263
|
result.push(currentId);
|
|
65843
|
-
currentId =
|
|
66264
|
+
currentId = classesById2.get(currentId)?.extendsClassId;
|
|
65844
66265
|
}
|
|
65845
66266
|
return result;
|
|
65846
66267
|
}
|
|
65847
|
-
function concreteClassDescendants(classId, classes,
|
|
65848
|
-
if (!
|
|
66268
|
+
function concreteClassDescendants(classId, classes, classesById2) {
|
|
66269
|
+
if (!classesById2.has(classId)) return [];
|
|
65849
66270
|
return classes.filter(
|
|
65850
|
-
(candidate) => !candidate.isAbstract && classAncestry(candidate.id,
|
|
66271
|
+
(candidate) => !candidate.isAbstract && classAncestry(candidate.id, classesById2).includes(classId)
|
|
65851
66272
|
).map((candidate) => candidate.id).sort((left, right) => left.localeCompare(right));
|
|
65852
66273
|
}
|
|
65853
66274
|
function effectiveRelation(relation, targetRecordId, sourceAncestryDepth) {
|
|
@@ -66131,6 +66552,7 @@ function buildEvaluatorBaseIndexes(members, values, valueById = new Map(
|
|
|
66131
66552
|
rowsBySourceValueId: /* @__PURE__ */ new Map(),
|
|
66132
66553
|
ownershipRootIdsByRowId: /* @__PURE__ */ new Map(),
|
|
66133
66554
|
ownershipDistancesByRowId: /* @__PURE__ */ new Map(),
|
|
66555
|
+
reconciledOwnershipRows: /* @__PURE__ */ new WeakSet(),
|
|
66134
66556
|
ownedValueAttachmentsByValueId: /* @__PURE__ */ new Map(),
|
|
66135
66557
|
constructorOwnershipDirtyValueIds: /* @__PURE__ */ new Set(),
|
|
66136
66558
|
memberByRowId: /* @__PURE__ */ new Map()
|
|
@@ -66187,6 +66609,9 @@ function evaluatorIndexes(ctx) {
|
|
|
66187
66609
|
// runtime/overlay context gets private caches because it shadows edges.
|
|
66188
66610
|
ownershipRootIdsByRowId: sharedOwnershipCaches?.ownershipRootIdsByRowId ?? /* @__PURE__ */ new Map(),
|
|
66189
66611
|
ownershipDistancesByRowId: sharedOwnershipCaches?.ownershipDistancesByRowId ?? /* @__PURE__ */ new Map(),
|
|
66612
|
+
// Never shared with a base: reconciliation is decided against THIS
|
|
66613
|
+
// index's shadows and overlay, which a sibling context does not have.
|
|
66614
|
+
reconciledOwnershipRows: /* @__PURE__ */ new WeakSet(),
|
|
66190
66615
|
ownedValueAttachmentsByValueId: /* @__PURE__ */ new Map(),
|
|
66191
66616
|
constructorOwnershipDirtyValueIds: /* @__PURE__ */ new Set(),
|
|
66192
66617
|
memberByRowId: /* @__PURE__ */ new Map()
|
|
@@ -66232,6 +66657,10 @@ function indexEvaluatorRow(indexes, row, allowBaseShadow = false, sharedCachesAl
|
|
|
66232
66657
|
if (indexes.indexedRowIds.has(row.id) || !allowBaseShadow && indexes.baseIndexedRowIds?.has(row.id) === true) {
|
|
66233
66658
|
return;
|
|
66234
66659
|
}
|
|
66660
|
+
if (allowBaseShadow && indexes.baseIndexedRowIds?.has(row.id) === true) {
|
|
66661
|
+
indexes.shadowedBaseRowIds.add(row.id);
|
|
66662
|
+
dropReconciledOwnershipRows(indexes);
|
|
66663
|
+
}
|
|
66235
66664
|
if (!sharedCachesAlreadyInvalidated) {
|
|
66236
66665
|
indexes.ownershipRootIdsByRowId.clear();
|
|
66237
66666
|
indexes.ownershipDistancesByRowId.clear();
|
|
@@ -66281,20 +66710,85 @@ function indexEvaluatorRow(indexes, row, allowBaseShadow = false, sharedCachesAl
|
|
|
66281
66710
|
}
|
|
66282
66711
|
}
|
|
66283
66712
|
}
|
|
66284
|
-
function indexEvaluatorRows(indexes, rows, allowBaseShadow = false) {
|
|
66713
|
+
function indexEvaluatorRows(indexes, rows, allowBaseShadow = false, liveOverlayRowById) {
|
|
66285
66714
|
let sharedCachesInvalidated = false;
|
|
66715
|
+
const invalidateSharedCaches = () => {
|
|
66716
|
+
if (sharedCachesInvalidated) return;
|
|
66717
|
+
indexes.ownershipRootIdsByRowId.clear();
|
|
66718
|
+
indexes.ownershipDistancesByRowId.clear();
|
|
66719
|
+
indexes.memberByRowId.clear();
|
|
66720
|
+
sharedCachesInvalidated = true;
|
|
66721
|
+
};
|
|
66286
66722
|
for (const row of rows) {
|
|
66287
66723
|
const alreadyIndexed = indexes.indexedRowIds.has(row.id) || !allowBaseShadow && indexes.baseIndexedRowIds?.has(row.id) === true;
|
|
66288
|
-
if (alreadyIndexed)
|
|
66289
|
-
|
|
66290
|
-
indexes.
|
|
66291
|
-
indexes
|
|
66292
|
-
|
|
66293
|
-
|
|
66724
|
+
if (alreadyIndexed) {
|
|
66725
|
+
if (liveOverlayRowById === void 0) continue;
|
|
66726
|
+
if (indexes.reconciledOwnershipRows.has(row)) continue;
|
|
66727
|
+
if (!evaluatorOwnershipEdgesAreComplete(indexes, row)) {
|
|
66728
|
+
invalidateSharedCaches();
|
|
66729
|
+
augmentEvaluatorOwnershipEdges(
|
|
66730
|
+
indexes,
|
|
66731
|
+
row,
|
|
66732
|
+
liveOverlayRowById(row.id)
|
|
66733
|
+
);
|
|
66734
|
+
}
|
|
66735
|
+
indexes.reconciledOwnershipRows.add(row);
|
|
66736
|
+
continue;
|
|
66294
66737
|
}
|
|
66738
|
+
invalidateSharedCaches();
|
|
66295
66739
|
indexEvaluatorRow(indexes, row, allowBaseShadow, true);
|
|
66296
66740
|
}
|
|
66297
66741
|
}
|
|
66742
|
+
function evaluatorOwnershipEdgesAreComplete(indexes, row) {
|
|
66743
|
+
for (const [childId, key] of evaluatorRecordOwnershipEdges(row)) {
|
|
66744
|
+
const links = evaluatorParentLinks(indexes, childId);
|
|
66745
|
+
if (!links.some((link) => link.parentId === row.id && link.key === key)) {
|
|
66746
|
+
return false;
|
|
66747
|
+
}
|
|
66748
|
+
}
|
|
66749
|
+
return true;
|
|
66750
|
+
}
|
|
66751
|
+
function augmentEvaluatorOwnershipEdges(indexes, row, liveRow) {
|
|
66752
|
+
const liveChildIdsByKey = liveRow === null || liveRow === row ? null : liveEdgeChildIdsByKey(liveRow);
|
|
66753
|
+
for (const [childId, key] of evaluatorRecordOwnershipEdges(row)) {
|
|
66754
|
+
const liveChildIds = liveChildIdsByKey?.get(key);
|
|
66755
|
+
if (liveChildIds !== void 0 && !liveChildIds.has(childId)) continue;
|
|
66756
|
+
const links = evaluatorParentLinks(indexes, childId);
|
|
66757
|
+
if (links.some((link) => link.parentId === row.id && link.key === key)) {
|
|
66758
|
+
continue;
|
|
66759
|
+
}
|
|
66760
|
+
addEvaluatorParentLink(indexes, childId, row.id, key);
|
|
66761
|
+
indexes.ownedValueAttachmentsByValueId.delete(childId);
|
|
66762
|
+
indexes.constructorOwnershipDirtyValueIds.add(childId);
|
|
66763
|
+
}
|
|
66764
|
+
}
|
|
66765
|
+
function liveEdgeChildIdsByKey(liveRow) {
|
|
66766
|
+
const childIdsByKey = /* @__PURE__ */ new Map();
|
|
66767
|
+
for (const [liveChildId, liveKey] of evaluatorRecordOwnershipEdges(liveRow)) {
|
|
66768
|
+
const bucket = childIdsByKey.get(liveKey);
|
|
66769
|
+
if (bucket === void 0) {
|
|
66770
|
+
childIdsByKey.set(liveKey, /* @__PURE__ */ new Set([liveChildId]));
|
|
66771
|
+
continue;
|
|
66772
|
+
}
|
|
66773
|
+
bucket.add(liveChildId);
|
|
66774
|
+
}
|
|
66775
|
+
return childIdsByKey;
|
|
66776
|
+
}
|
|
66777
|
+
function evaluatorRecordOwnershipEdges(row) {
|
|
66778
|
+
if (Array.isArray(row.value)) {
|
|
66779
|
+
const edges2 = [];
|
|
66780
|
+
for (const childId of row.value) {
|
|
66781
|
+
if (typeof childId === "string") edges2.push([childId, ""]);
|
|
66782
|
+
}
|
|
66783
|
+
return edges2;
|
|
66784
|
+
}
|
|
66785
|
+
if (typeof row.value !== "object" || row.value === null) return [];
|
|
66786
|
+
const edges = [];
|
|
66787
|
+
for (const [key, childId] of Object.entries(row.value)) {
|
|
66788
|
+
if (typeof childId === "string") edges.push([childId, key]);
|
|
66789
|
+
}
|
|
66790
|
+
return edges;
|
|
66791
|
+
}
|
|
66298
66792
|
function unindexEvaluatorRow(indexes, row) {
|
|
66299
66793
|
indexes.indexedRowIds.delete(row.id);
|
|
66300
66794
|
indexes.ownedValueAttachmentsByValueId.delete(row.id);
|
|
@@ -66329,6 +66823,10 @@ function unindexEvaluatorRow(indexes, row) {
|
|
|
66329
66823
|
indexes.ownershipRootIdsByRowId.clear();
|
|
66330
66824
|
indexes.ownershipDistancesByRowId.clear();
|
|
66331
66825
|
indexes.memberByRowId.clear();
|
|
66826
|
+
dropReconciledOwnershipRows(indexes);
|
|
66827
|
+
}
|
|
66828
|
+
function dropReconciledOwnershipRows(indexes) {
|
|
66829
|
+
indexes.reconciledOwnershipRows = /* @__PURE__ */ new WeakSet();
|
|
66332
66830
|
}
|
|
66333
66831
|
function addEvaluatorParentLink(indexes, childId, parentId, key) {
|
|
66334
66832
|
const links = indexes.parentLinksByChildId.get(childId) ?? [];
|
|
@@ -66406,7 +66904,12 @@ function resolveRuntimeReferenceRow(sourceValueId, ctx, withProvenance) {
|
|
|
66406
66904
|
const indexes = evaluatorIndexes(ctx);
|
|
66407
66905
|
const virtualRows = ctx.vm.databaseVM?.virtualInstanceRowsForValue(receiver.id) ?? [];
|
|
66408
66906
|
if (virtualRows.length > 0) {
|
|
66409
|
-
indexEvaluatorRows(
|
|
66907
|
+
indexEvaluatorRows(
|
|
66908
|
+
indexes,
|
|
66909
|
+
virtualRows,
|
|
66910
|
+
true,
|
|
66911
|
+
(valueId) => ctx.__runtimeSessionValues?.get(valueId) ?? ctx.__valueOverlay?.get(valueId) ?? null
|
|
66912
|
+
);
|
|
66410
66913
|
}
|
|
66411
66914
|
const receiverRoots = evaluatorOwnershipRootIds(receiver.id, indexes);
|
|
66412
66915
|
const matches = evaluatorRowsForSourceValueId(indexes, sourceValueId).filter(
|
|
@@ -74701,8 +75204,8 @@ var init_evaluateNSGetter = __esm({
|
|
|
74701
75204
|
|
|
74702
75205
|
// ../src/models/members/stored-value-placement-index.ts
|
|
74703
75206
|
function buildStoredValuePlacementIndex(args) {
|
|
74704
|
-
const
|
|
74705
|
-
for (const member of args.members)
|
|
75207
|
+
const membersById2 = /* @__PURE__ */ new Map();
|
|
75208
|
+
for (const member of args.members) membersById2.set(member.id, member);
|
|
74706
75209
|
const valuesById = /* @__PURE__ */ new Map();
|
|
74707
75210
|
const unorderedEntriesByContainerId = /* @__PURE__ */ new Map();
|
|
74708
75211
|
for (const value of args.values) {
|
|
@@ -74740,7 +75243,7 @@ function buildStoredValuePlacementIndex(args) {
|
|
|
74740
75243
|
};
|
|
74741
75244
|
const queue = [];
|
|
74742
75245
|
for (const root of projectRootMembersInDisplayOrder(args.project)) {
|
|
74743
|
-
const member =
|
|
75246
|
+
const member = membersById2.get(root.memberId);
|
|
74744
75247
|
if (member === void 0 || typeof member.valueId !== "string") continue;
|
|
74745
75248
|
queue.push({
|
|
74746
75249
|
memberId: member.id,
|
|
@@ -74779,7 +75282,7 @@ function buildStoredValuePlacementIndex(args) {
|
|
|
74779
75282
|
const item = queue[cursor];
|
|
74780
75283
|
if (item === void 0 || placementByValueId.has(item.valueId)) continue;
|
|
74781
75284
|
const authoredValue = valuesById.get(item.valueId);
|
|
74782
|
-
const storedMember =
|
|
75285
|
+
const storedMember = membersById2.get(item.memberId);
|
|
74783
75286
|
if (authoredValue === void 0 || storedMember === void 0) continue;
|
|
74784
75287
|
const value = args.resolveValue === void 0 ? authoredValue : args.resolveValue(authoredValue);
|
|
74785
75288
|
if (value === null) continue;
|
|
@@ -74793,7 +75296,7 @@ function buildStoredValuePlacementIndex(args) {
|
|
|
74793
75296
|
appendPlacement(mutablePlacementsByClassId, classId, placement);
|
|
74794
75297
|
if (!isStringRecord3(value.value)) continue;
|
|
74795
75298
|
for (const entry of storedSchema(classId)) {
|
|
74796
|
-
const childMember =
|
|
75299
|
+
const childMember = membersById2.get(entry.memberId);
|
|
74797
75300
|
const childValueId = value.value[entry.schemaKey];
|
|
74798
75301
|
if (childMember === void 0 || typeof childValueId !== "string") {
|
|
74799
75302
|
continue;
|
|
@@ -74811,7 +75314,7 @@ function buildStoredValuePlacementIndex(args) {
|
|
|
74811
75314
|
if (!isMemberListBase(member) && !isMemberDictionaryBase(member)) {
|
|
74812
75315
|
continue;
|
|
74813
75316
|
}
|
|
74814
|
-
const entryMember =
|
|
75317
|
+
const entryMember = membersById2.get(member.entryMemberId);
|
|
74815
75318
|
if (entryMember === void 0) continue;
|
|
74816
75319
|
if (isMemberDictionaryBase(member)) {
|
|
74817
75320
|
if (!isStringRecord3(value.value)) continue;
|
|
@@ -74878,6 +75381,27 @@ var init_stored_value_placement_index = __esm({
|
|
|
74878
75381
|
});
|
|
74879
75382
|
|
|
74880
75383
|
// ../src/database/virtual-instance-values.ts
|
|
75384
|
+
function firstListInParameterType(typeInfo, depth = 0) {
|
|
75385
|
+
if (typeof typeInfo !== "object" || typeInfo === null) return null;
|
|
75386
|
+
if (depth > CONSTRUCTOR_TYPE_WALK_DEPTH_LIMIT) return "depth-limit";
|
|
75387
|
+
const shape = typeInfo;
|
|
75388
|
+
if (shape.type === 6 /* List */) return "list";
|
|
75389
|
+
const entry = firstListInParameterType(shape.entryTypeInfo, depth + 1);
|
|
75390
|
+
if (entry !== null) return entry;
|
|
75391
|
+
if (Array.isArray(shape.argumentTypes)) {
|
|
75392
|
+
for (const argument2 of shape.argumentTypes) {
|
|
75393
|
+
const nested = firstListInParameterType(argument2, depth + 1);
|
|
75394
|
+
if (nested !== null) return nested;
|
|
75395
|
+
}
|
|
75396
|
+
}
|
|
75397
|
+
return null;
|
|
75398
|
+
}
|
|
75399
|
+
function constructorBodyIsCorpusFree(constructor2) {
|
|
75400
|
+
if (constructor2.code !== null && constructor2.code.trim() !== "") return false;
|
|
75401
|
+
if ((constructor2.baseArguments ?? []).length > 0) return false;
|
|
75402
|
+
if ((constructor2.baseInitializerFields ?? []).length > 0) return false;
|
|
75403
|
+
return true;
|
|
75404
|
+
}
|
|
74881
75405
|
function withoutInitializerConstructionFields(init) {
|
|
74882
75406
|
if (init.compiled === void 0) return init;
|
|
74883
75407
|
const baseline = structuredClone(init);
|
|
@@ -74892,6 +75416,28 @@ function withoutInitializerConstructionFields(init) {
|
|
|
74892
75416
|
}
|
|
74893
75417
|
return baseline;
|
|
74894
75418
|
}
|
|
75419
|
+
function derivesContentFromMemberDefault(args) {
|
|
75420
|
+
const member = args.member;
|
|
75421
|
+
if (!isMemberClassBase(member)) return false;
|
|
75422
|
+
if (member.partial === true) return false;
|
|
75423
|
+
const declared = member.defaultValue;
|
|
75424
|
+
if (!isLiteralValueContent(declared)) return false;
|
|
75425
|
+
const record3 = declared.value;
|
|
75426
|
+
if (typeof record3 !== "object" || record3 === null) return false;
|
|
75427
|
+
if (Array.isArray(record3)) return false;
|
|
75428
|
+
if (Object.keys(record3).length === 0) return false;
|
|
75429
|
+
if ((declared.classId ?? member.classId) !== args.effectiveClassId) {
|
|
75430
|
+
return false;
|
|
75431
|
+
}
|
|
75432
|
+
const root = args.instanceRoot;
|
|
75433
|
+
if (typeof root.instanceConstructorId === "string") return false;
|
|
75434
|
+
if (typeof root.instanceVariantId === "string") return false;
|
|
75435
|
+
const storedArgs = root.constructorArgs;
|
|
75436
|
+
if (typeof storedArgs === "object" && storedArgs !== null && Object.keys(storedArgs).length > 0) {
|
|
75437
|
+
return false;
|
|
75438
|
+
}
|
|
75439
|
+
return true;
|
|
75440
|
+
}
|
|
74895
75441
|
function claimVirtualIdentity(args) {
|
|
74896
75442
|
if (args.fixedVirtualId !== void 0) {
|
|
74897
75443
|
args.claimedVirtualIds.set(args.fixedVirtualId, args.pathKey);
|
|
@@ -74912,6 +75458,8 @@ function claimVirtualIdentity(args) {
|
|
|
74912
75458
|
return { sourceIdentity: sourceIdentity3, virtualId };
|
|
74913
75459
|
}
|
|
74914
75460
|
function expandStoredInstance(args) {
|
|
75461
|
+
const recorder = args.readRecorder ?? null;
|
|
75462
|
+
recorder?.recordValueRead(args.instanceRoot.id);
|
|
74915
75463
|
const rootMember = resolveMember2(args.rootMember, args.document.members);
|
|
74916
75464
|
if (!isMemberClassBase(rootMember)) {
|
|
74917
75465
|
throw new Error(
|
|
@@ -74944,6 +75492,25 @@ function expandStoredInstance(args) {
|
|
|
74944
75492
|
`Virtual expansion root "${args.instanceRoot.id}" has no durable overload identity for class "${classId}"; keep this historical graph materialized.`
|
|
74945
75493
|
);
|
|
74946
75494
|
}
|
|
75495
|
+
if (recorder !== null && requiredConstructor !== null) {
|
|
75496
|
+
if (!constructorBodyIsCorpusFree(requiredConstructor)) {
|
|
75497
|
+
recorder.recordGlobalRead(
|
|
75498
|
+
`authored-constructor-body:${requiredConstructor.id}`
|
|
75499
|
+
);
|
|
75500
|
+
}
|
|
75501
|
+
for (const typeInfo of requiredConstructor.argumentTypes) {
|
|
75502
|
+
if (firstListInParameterType(typeInfo) === null) continue;
|
|
75503
|
+
recorder.recordGlobalRead(
|
|
75504
|
+
`constructor-argument-list:${requiredConstructor.id}`
|
|
75505
|
+
);
|
|
75506
|
+
break;
|
|
75507
|
+
}
|
|
75508
|
+
}
|
|
75509
|
+
if (recorder !== null && typeof instanceRoot.instanceVariantId === "string") {
|
|
75510
|
+
recorder.recordGlobalRead(
|
|
75511
|
+
`variant-initialize:${instanceRoot.instanceVariantId}`
|
|
75512
|
+
);
|
|
75513
|
+
}
|
|
74947
75514
|
const storedArgs = instanceRoot.constructorArgs ?? {};
|
|
74948
75515
|
if (requiredConstructor !== null && instanceRoot.constructorArgs == null) {
|
|
74949
75516
|
throw new VirtualExpansionUnsupportedError(
|
|
@@ -75049,7 +75616,29 @@ function expandStoredInstance(args) {
|
|
|
75049
75616
|
constructionBaselineReplay: fields.length === 0
|
|
75050
75617
|
});
|
|
75051
75618
|
};
|
|
75052
|
-
const
|
|
75619
|
+
const replayDeclaredDefault = () => {
|
|
75620
|
+
const stampEnv = instanceRoot.genericBindings == null || Object.keys(instanceRoot.genericBindings).length === 0 ? null : envFromStamp(instanceRoot.genericBindings);
|
|
75621
|
+
const built = materializeMemberDefaultValue({
|
|
75622
|
+
document: args.document,
|
|
75623
|
+
member: replayMember,
|
|
75624
|
+
envelope,
|
|
75625
|
+
...stampEnv === null ? {} : { genericEnv: stampEnv }
|
|
75626
|
+
});
|
|
75627
|
+
return {
|
|
75628
|
+
...built,
|
|
75629
|
+
root: {
|
|
75630
|
+
...built.root,
|
|
75631
|
+
classId,
|
|
75632
|
+
instanceConstructorId: recordedConstructorId,
|
|
75633
|
+
constructorArgs: storedArgs
|
|
75634
|
+
}
|
|
75635
|
+
};
|
|
75636
|
+
};
|
|
75637
|
+
const materialized = derivesContentFromMemberDefault({
|
|
75638
|
+
member: replayMember,
|
|
75639
|
+
instanceRoot,
|
|
75640
|
+
effectiveClassId: classId
|
|
75641
|
+
}) ? replayDeclaredDefault() : replay([]);
|
|
75053
75642
|
const rows = [materialized.root, ...materialized.createdValues];
|
|
75054
75643
|
assertVirtualExpansionIsLiteral(rows);
|
|
75055
75644
|
return {
|
|
@@ -75060,11 +75649,21 @@ function expandStoredInstance(args) {
|
|
|
75060
75649
|
}
|
|
75061
75650
|
function resolveVirtualInstanceGraph(args) {
|
|
75062
75651
|
const expansion = indexExpansion(args);
|
|
75652
|
+
const recorder = args.readRecorder ?? null;
|
|
75653
|
+
if (recorder !== null) {
|
|
75654
|
+
recorder.recordValueRead(args.instanceRoot.id);
|
|
75655
|
+
const unattributable = firstUnattributableExpansionMember(expansion);
|
|
75656
|
+
if (unattributable !== null) recorder.recordGlobalRead(unattributable);
|
|
75657
|
+
}
|
|
75063
75658
|
const materializedById = new Map(
|
|
75064
75659
|
(args.materializedRows ?? args.document.values).map((row) => [row.id, row])
|
|
75065
75660
|
);
|
|
75066
75661
|
const materializedRows = [...materializedById.values()];
|
|
75067
75662
|
const materializedUnorderedEntryIdsByContainerId = buildUnorderedListMembershipIndex(materializedRows);
|
|
75663
|
+
const readMaterializedRow = (valueId) => {
|
|
75664
|
+
recorder?.recordValueRead(valueId);
|
|
75665
|
+
return materializedById.get(valueId) ?? null;
|
|
75666
|
+
};
|
|
75068
75667
|
const rowsById = /* @__PURE__ */ new Map();
|
|
75069
75668
|
const locationsById = /* @__PURE__ */ new Map();
|
|
75070
75669
|
const locationsByPath = /* @__PURE__ */ new Map();
|
|
@@ -75087,7 +75686,7 @@ function resolveVirtualInstanceGraph(args) {
|
|
|
75087
75686
|
}
|
|
75088
75687
|
visiting.add(pathKey);
|
|
75089
75688
|
const effectiveMaterializedId = materializedId2 ?? (pathKey === ROOT_PATH ? null : indexed.virtualId);
|
|
75090
|
-
const materialized = effectiveMaterializedId === null ? null :
|
|
75689
|
+
const materialized = effectiveMaterializedId === null ? null : readMaterializedRow(effectiveMaterializedId);
|
|
75091
75690
|
const effectiveId = materialized?.id ?? indexed.virtualId;
|
|
75092
75691
|
const effective = {
|
|
75093
75692
|
...cloneRow(indexed.expandedRow),
|
|
@@ -75137,26 +75736,21 @@ function resolveVirtualInstanceGraph(args) {
|
|
|
75137
75736
|
const listMember = indexed.member;
|
|
75138
75737
|
effective.value = [];
|
|
75139
75738
|
const childPaths = expansion.childPathsByParentPath.get(pathKey) ?? [];
|
|
75140
|
-
|
|
75141
|
-
|
|
75142
|
-
)
|
|
75739
|
+
recorder?.recordGlobalRead(`unordered-list-membership:${effectiveId}`);
|
|
75740
|
+
const storedEntryIds = materializedUnorderedEntryIdsByContainerId.get(effectiveId) ?? [];
|
|
75741
|
+
const storedEntries = storedEntryIds.flatMap((storedEntryId) => {
|
|
75742
|
+
const entry = readMaterializedRow(storedEntryId);
|
|
75743
|
+
return entry === null ? [] : [entry];
|
|
75744
|
+
});
|
|
75745
|
+
const resolvedEntryPaths = [];
|
|
75746
|
+
const matchedStoredIds = /* @__PURE__ */ new Set();
|
|
75143
75747
|
if (materialized === null) {
|
|
75144
75748
|
for (const childPath of childPaths) {
|
|
75145
|
-
resolvePath(childPath, null, effectiveId);
|
|
75749
|
+
const entry = resolvePath(childPath, null, effectiveId);
|
|
75750
|
+
resolvedEntryPaths.push(childPath);
|
|
75751
|
+
matchedStoredIds.add(entry.id);
|
|
75146
75752
|
}
|
|
75147
75753
|
} else {
|
|
75148
|
-
const entryMember = args.document.members.find(
|
|
75149
|
-
(candidate) => candidate.id === listMember.entryMemberId
|
|
75150
|
-
);
|
|
75151
|
-
if (entryMember === void 0) {
|
|
75152
|
-
throw new Error(
|
|
75153
|
-
`Unordered list member "${listMember.name}" references missing entry member "${listMember.entryMemberId}".`
|
|
75154
|
-
);
|
|
75155
|
-
}
|
|
75156
|
-
const storedEntries = storedEntryIds.flatMap((storedEntryId) => {
|
|
75157
|
-
const entry = materializedById.get(storedEntryId);
|
|
75158
|
-
return entry === void 0 ? [] : [entry];
|
|
75159
|
-
});
|
|
75160
75754
|
const unmatchedChildPaths = [...childPaths];
|
|
75161
75755
|
const matchedEntries = [];
|
|
75162
75756
|
const unmatchedStoredEntries = [];
|
|
@@ -75179,54 +75773,58 @@ function resolveVirtualInstanceGraph(args) {
|
|
|
75179
75773
|
if (childPath === void 0) break;
|
|
75180
75774
|
matchedEntries.push({ storedEntry, childPath });
|
|
75181
75775
|
}
|
|
75182
|
-
const resolvedEntryPaths = [];
|
|
75183
|
-
const matchedStoredIds = /* @__PURE__ */ new Set();
|
|
75184
75776
|
for (const { storedEntry, childPath } of matchedEntries) {
|
|
75185
75777
|
resolvePath(childPath, storedEntry.id, effectiveId);
|
|
75186
75778
|
resolvedEntryPaths.push(childPath);
|
|
75187
75779
|
matchedStoredIds.add(storedEntry.id);
|
|
75188
75780
|
}
|
|
75189
|
-
|
|
75190
|
-
|
|
75191
|
-
|
|
75192
|
-
|
|
75193
|
-
|
|
75194
|
-
|
|
75195
|
-
|
|
75196
|
-
|
|
75197
|
-
|
|
75198
|
-
claimedVirtualIds: expansion.claimedVirtualIds,
|
|
75199
|
-
instanceRootId: args.instanceRoot.id,
|
|
75200
|
-
pathKey: childPath,
|
|
75201
|
-
rawSourceIdentity: storedEntry.sourceValueId ?? storedEntry.id
|
|
75202
|
-
});
|
|
75203
|
-
const effectiveEntry = {
|
|
75204
|
-
...storedEntry,
|
|
75205
|
-
containerId: effectiveId
|
|
75206
|
-
};
|
|
75207
|
-
const entryLocation = {
|
|
75208
|
-
id: storedEntry.id,
|
|
75209
|
-
instanceRootId: args.instanceRoot.id,
|
|
75210
|
-
pathKey: childPath,
|
|
75211
|
-
sourceIdentity: claimed.sourceIdentity,
|
|
75212
|
-
member: entryMember,
|
|
75213
|
-
memberId: listMember.entryMemberId,
|
|
75214
|
-
parentId: effectiveId,
|
|
75215
|
-
parentSegment: { kind: "list", index: extraIndex - 1 },
|
|
75216
|
-
virtualRow: {
|
|
75217
|
-
...effectiveEntry,
|
|
75218
|
-
id: claimed.virtualId,
|
|
75219
|
-
sourceValueId: `missing-expansion:${storedEntry.id}`
|
|
75220
|
-
},
|
|
75221
|
-
materializedRow: storedEntry
|
|
75222
|
-
};
|
|
75223
|
-
rowsById.set(effectiveEntry.id, effectiveEntry);
|
|
75224
|
-
locationsById.set(effectiveEntry.id, entryLocation);
|
|
75225
|
-
locationsByPath.set(childPath, entryLocation);
|
|
75226
|
-
resolvedEntryPaths.push(childPath);
|
|
75781
|
+
}
|
|
75782
|
+
let extraIndex = childPaths.length;
|
|
75783
|
+
const entryMember = expansion.membersById.get(listMember.entryMemberId);
|
|
75784
|
+
for (const storedEntry of storedEntries) {
|
|
75785
|
+
if (matchedStoredIds.has(storedEntry.id)) continue;
|
|
75786
|
+
if (entryMember === void 0) {
|
|
75787
|
+
throw new Error(
|
|
75788
|
+
`Unordered list member "${listMember.name}" references missing entry member "${listMember.entryMemberId}".`
|
|
75789
|
+
);
|
|
75227
75790
|
}
|
|
75228
|
-
|
|
75791
|
+
const childPath = appendPath(pathKey, {
|
|
75792
|
+
kind: "list",
|
|
75793
|
+
index: extraIndex
|
|
75794
|
+
});
|
|
75795
|
+
extraIndex += 1;
|
|
75796
|
+
const claimed = claimVirtualIdentity({
|
|
75797
|
+
claimedVirtualIds: expansion.claimedVirtualIds,
|
|
75798
|
+
instanceRootId: args.instanceRoot.id,
|
|
75799
|
+
pathKey: childPath,
|
|
75800
|
+
rawSourceIdentity: storedEntry.sourceValueId ?? storedEntry.id
|
|
75801
|
+
});
|
|
75802
|
+
const effectiveEntry = {
|
|
75803
|
+
...storedEntry,
|
|
75804
|
+
containerId: effectiveId
|
|
75805
|
+
};
|
|
75806
|
+
const entryLocation = {
|
|
75807
|
+
id: storedEntry.id,
|
|
75808
|
+
instanceRootId: args.instanceRoot.id,
|
|
75809
|
+
pathKey: childPath,
|
|
75810
|
+
sourceIdentity: claimed.sourceIdentity,
|
|
75811
|
+
member: entryMember,
|
|
75812
|
+
memberId: listMember.entryMemberId,
|
|
75813
|
+
parentId: effectiveId,
|
|
75814
|
+
parentSegment: { kind: "list", index: extraIndex - 1 },
|
|
75815
|
+
virtualRow: {
|
|
75816
|
+
...effectiveEntry,
|
|
75817
|
+
id: claimed.virtualId,
|
|
75818
|
+
sourceValueId: `missing-expansion:${storedEntry.id}`
|
|
75819
|
+
},
|
|
75820
|
+
materializedRow: storedEntry
|
|
75821
|
+
};
|
|
75822
|
+
rowsById.set(effectiveEntry.id, effectiveEntry);
|
|
75823
|
+
locationsById.set(effectiveEntry.id, entryLocation);
|
|
75824
|
+
locationsByPath.set(childPath, entryLocation);
|
|
75825
|
+
resolvedEntryPaths.push(childPath);
|
|
75229
75826
|
}
|
|
75827
|
+
childPathsByParentPath.set(pathKey, resolvedEntryPaths);
|
|
75230
75828
|
} else {
|
|
75231
75829
|
const expandedEntries = Array.isArray(indexed.expandedRow.value) ? indexed.expandedRow.value : [];
|
|
75232
75830
|
const materializedEntries = materialized !== null && Array.isArray(materialized.value) ? materialized.value : null;
|
|
@@ -75311,29 +75909,88 @@ function resolveVirtualInstanceGraph(args) {
|
|
|
75311
75909
|
root: rootLocation
|
|
75312
75910
|
};
|
|
75313
75911
|
}
|
|
75912
|
+
function firstUnattributableExpansionMember(expansion) {
|
|
75913
|
+
for (const node of expansion.nodesByPath.values()) {
|
|
75914
|
+
const member = node.member;
|
|
75915
|
+
if (isMemberListBase(member) && listKindOf(member) === "unordered") {
|
|
75916
|
+
return `unordered-list-member:${node.memberId}`;
|
|
75917
|
+
}
|
|
75918
|
+
if (CORPUS_SCANNING_MEMBER_KINDS.has(member.kind)) {
|
|
75919
|
+
return `corpus-scanning-member-kind:${node.memberId}`;
|
|
75920
|
+
}
|
|
75921
|
+
const declaredDefault = member.defaultValue;
|
|
75922
|
+
if (declaredDefault !== void 0 && declaredDefault !== null && "init" in declaredDefault && declaredDefault.init !== void 0 && declaredDefault.init !== null) {
|
|
75923
|
+
return `authored-initializer-member:${node.memberId}`;
|
|
75924
|
+
}
|
|
75925
|
+
}
|
|
75926
|
+
return null;
|
|
75927
|
+
}
|
|
75928
|
+
function recordKeysLost(kept, candidate) {
|
|
75929
|
+
if (!isLiteralValueContent(kept)) return [];
|
|
75930
|
+
if (!isLiteralValueContent(candidate)) return [];
|
|
75931
|
+
const keptValue = kept.value;
|
|
75932
|
+
const candidateValue = candidate.value;
|
|
75933
|
+
if (typeof keptValue !== "object" || keptValue === null) return [];
|
|
75934
|
+
if (Array.isArray(keptValue)) return [];
|
|
75935
|
+
if (typeof candidateValue !== "object" || candidateValue === null) return [];
|
|
75936
|
+
if (Array.isArray(candidateValue)) return [];
|
|
75937
|
+
const lost = [];
|
|
75938
|
+
for (const key of Object.keys(keptValue)) {
|
|
75939
|
+
if (Object.hasOwn(candidateValue, key)) continue;
|
|
75940
|
+
lost.push(key);
|
|
75941
|
+
}
|
|
75942
|
+
return lost;
|
|
75943
|
+
}
|
|
75944
|
+
function reportFrameResolutionDisagreement(args) {
|
|
75945
|
+
console.warn(
|
|
75946
|
+
`Virtual instance frames disagree on value "${args.valueId}": the expansion of root "${args.droppedFrameRootId}" omits ${args.droppedKeys.join(", ")}, which the expansion of root "${args.keptFrameRootId}" resolves. Keeping the wider resolution.`
|
|
75947
|
+
);
|
|
75948
|
+
}
|
|
75314
75949
|
function resolvedStoredInstanceRows(args) {
|
|
75315
75950
|
const rows = new Map(args.document.values.map((row) => [row.id, row]));
|
|
75316
75951
|
const queue = [{ root: args.instanceRoot, member: args.rootMember }];
|
|
75317
75952
|
const resolvedRootIds = /* @__PURE__ */ new Set();
|
|
75953
|
+
const resolvedFrameByValueId = /* @__PURE__ */ new Map();
|
|
75318
75954
|
while (queue.length > 0) {
|
|
75319
75955
|
const next = queue.shift();
|
|
75320
75956
|
if (next === void 0 || resolvedRootIds.has(next.root.id)) continue;
|
|
75321
75957
|
resolvedRootIds.add(next.root.id);
|
|
75322
|
-
const document = { ...args.document, values: [...rows.values()] };
|
|
75323
75958
|
const expanded = expandStoredInstance({
|
|
75324
|
-
document,
|
|
75959
|
+
document: args.document,
|
|
75325
75960
|
instanceRoot: next.root,
|
|
75326
75961
|
rootMember: next.member
|
|
75327
75962
|
});
|
|
75328
75963
|
const graph = resolveVirtualInstanceGraph({
|
|
75329
|
-
document,
|
|
75964
|
+
document: args.document,
|
|
75330
75965
|
instanceRoot: next.root,
|
|
75331
75966
|
rootMember: next.member,
|
|
75332
75967
|
expandedRoot: expanded.root,
|
|
75333
75968
|
expandedRows: expanded.rows,
|
|
75334
|
-
materializedRows: document.values
|
|
75969
|
+
materializedRows: args.document.values
|
|
75335
75970
|
});
|
|
75336
|
-
for (const [id2, row] of graph.rowsById)
|
|
75971
|
+
for (const [id2, row] of graph.rowsById) {
|
|
75972
|
+
const priorFrame = resolvedFrameByValueId.get(id2);
|
|
75973
|
+
if (priorFrame !== void 0 && priorFrame !== next.root.id) {
|
|
75974
|
+
const prior = rows.get(id2);
|
|
75975
|
+
if (prior === void 0) {
|
|
75976
|
+
throw new Error(
|
|
75977
|
+
`Virtual instance frame "${priorFrame}" is recorded as resolving value "${id2}", but no resolved row for it exists.`
|
|
75978
|
+
);
|
|
75979
|
+
}
|
|
75980
|
+
const dropped = recordKeysLost(prior, row);
|
|
75981
|
+
if (dropped.length > 0) {
|
|
75982
|
+
reportFrameResolutionDisagreement({
|
|
75983
|
+
valueId: id2,
|
|
75984
|
+
keptFrameRootId: priorFrame,
|
|
75985
|
+
droppedFrameRootId: next.root.id,
|
|
75986
|
+
droppedKeys: dropped
|
|
75987
|
+
});
|
|
75988
|
+
continue;
|
|
75989
|
+
}
|
|
75990
|
+
}
|
|
75991
|
+
rows.set(id2, row);
|
|
75992
|
+
resolvedFrameByValueId.set(id2, next.root.id);
|
|
75993
|
+
}
|
|
75337
75994
|
for (const location3 of graph.locationsByPath.values()) {
|
|
75338
75995
|
const materialized = location3.materializedRow;
|
|
75339
75996
|
if (materialized === null || materialized.id === next.root.id || resolvedRootIds.has(materialized.id) || !isLiteralValueContent(materialized) || !isMemberClassBase(location3.member) || !isVirtualInstanceRootShape(materialized)) {
|
|
@@ -75512,6 +76169,18 @@ function planCollapseVirtualInstance(args) {
|
|
|
75512
76169
|
return reproducible;
|
|
75513
76170
|
};
|
|
75514
76171
|
const nestedRootIds = args.nestedRootValueIds ?? /* @__PURE__ */ new Set();
|
|
76172
|
+
const ownsChildInterior = (child) => {
|
|
76173
|
+
const stored = child.materializedRow;
|
|
76174
|
+
if (stored === null) return true;
|
|
76175
|
+
if (nestedRootIds.has(stored.id)) return false;
|
|
76176
|
+
if (!isLiteralValueContent(stored)) return true;
|
|
76177
|
+
if (creationProvenanceEqual(stored, child.virtualRow)) return true;
|
|
76178
|
+
if (typeof stored.instanceConstructorId === "string") return false;
|
|
76179
|
+
if (typeof stored.instanceVariantId === "string") return false;
|
|
76180
|
+
const storedArgs = stored.constructorArgs;
|
|
76181
|
+
if (storedArgs != null && Object.keys(storedArgs).length > 0) return false;
|
|
76182
|
+
return !isInitValueContent(child.member.defaultValue);
|
|
76183
|
+
};
|
|
75515
76184
|
const valuesById = args.valuesById ?? /* @__PURE__ */ new Map();
|
|
75516
76185
|
const frameDerivedLineages = /* @__PURE__ */ new Set();
|
|
75517
76186
|
for (const location3 of args.graph.locationsByPath.values()) {
|
|
@@ -75634,6 +76303,7 @@ function planCollapseVirtualInstance(args) {
|
|
|
75634
76303
|
}
|
|
75635
76304
|
} else if (isMemberListBase(location3.member)) {
|
|
75636
76305
|
if (listKindOf(location3.member) === "unordered") {
|
|
76306
|
+
protectedSubtree = true;
|
|
75637
76307
|
const storedEntries = args.graph.materializedUnorderedEntryIdsByContainerId.get(real.id) ?? [];
|
|
75638
76308
|
const virtualEntries = args.graph.expandedChildPathsByParentPath.get(location3.pathKey) ?? [];
|
|
75639
76309
|
const resolvedEntries = args.graph.childPathsByParentPath.get(location3.pathKey) ?? [];
|
|
@@ -75658,7 +76328,6 @@ function planCollapseVirtualInstance(args) {
|
|
|
75658
76328
|
const facts = compareSubtree(child);
|
|
75659
76329
|
defaultEqual &&= facts.defaultEqual;
|
|
75660
76330
|
contentEqual &&= facts.contentEqual;
|
|
75661
|
-
protectedSubtree ||= facts.protected;
|
|
75662
76331
|
}
|
|
75663
76332
|
const membershipEqual = semanticEqual(
|
|
75664
76333
|
resolvedStoredIds.sort(),
|
|
@@ -75768,7 +76437,9 @@ function planCollapseVirtualInstance(args) {
|
|
|
75768
76437
|
continue;
|
|
75769
76438
|
}
|
|
75770
76439
|
next[schemaKey] = child.materializedRow?.id ?? childId;
|
|
75771
|
-
if (isMemberClassBase(child.member))
|
|
76440
|
+
if (!isMemberClassBase(child.member)) continue;
|
|
76441
|
+
if (!ownsChildInterior(child)) continue;
|
|
76442
|
+
sparsifyClass(child);
|
|
75772
76443
|
}
|
|
75773
76444
|
if (!semanticEqual(stored, next)) {
|
|
75774
76445
|
updates.push({ valueId: real.id, value: next });
|
|
@@ -75963,7 +76634,7 @@ function indexExpansion(args) {
|
|
|
75963
76634
|
const nodesByExpandedId = /* @__PURE__ */ new Map();
|
|
75964
76635
|
const nodesByPath = /* @__PURE__ */ new Map();
|
|
75965
76636
|
const claimedVirtualIds = /* @__PURE__ */ new Map();
|
|
75966
|
-
const
|
|
76637
|
+
const membersById2 = new Map(
|
|
75967
76638
|
args.document.members.map((member) => [member.id, member])
|
|
75968
76639
|
);
|
|
75969
76640
|
const unorderedEntriesByContainerId = buildUnorderedListMembershipIndex(
|
|
@@ -76038,7 +76709,7 @@ function indexExpansion(args) {
|
|
|
76038
76709
|
);
|
|
76039
76710
|
for (const entry of schema) {
|
|
76040
76711
|
const childId = record3[entry.schemaKey];
|
|
76041
|
-
const childMember =
|
|
76712
|
+
const childMember = membersById2.get(entry.memberId);
|
|
76042
76713
|
if (typeof childId !== "string" || childMember === void 0) continue;
|
|
76043
76714
|
const segment = {
|
|
76044
76715
|
kind: "class",
|
|
@@ -76057,7 +76728,7 @@ function indexExpansion(args) {
|
|
|
76057
76728
|
}
|
|
76058
76729
|
if (isMemberListBase(member)) {
|
|
76059
76730
|
if (listKindOf(member) === "unordered") {
|
|
76060
|
-
const entryMember3 =
|
|
76731
|
+
const entryMember3 = membersById2.get(member.entryMemberId);
|
|
76061
76732
|
if (entryMember3 === void 0) return;
|
|
76062
76733
|
(unorderedEntriesByContainerId.get(row.id) ?? []).forEach(
|
|
76063
76734
|
(childId, index) => {
|
|
@@ -76079,7 +76750,7 @@ function indexExpansion(args) {
|
|
|
76079
76750
|
if (!Array.isArray(row.value)) {
|
|
76080
76751
|
return;
|
|
76081
76752
|
}
|
|
76082
|
-
const entryMember2 =
|
|
76753
|
+
const entryMember2 = membersById2.get(member.entryMemberId);
|
|
76083
76754
|
if (entryMember2 === void 0) return;
|
|
76084
76755
|
row.value.forEach((childId, index) => {
|
|
76085
76756
|
if (typeof childId !== "string") return;
|
|
@@ -76096,7 +76767,7 @@ function indexExpansion(args) {
|
|
|
76096
76767
|
return;
|
|
76097
76768
|
}
|
|
76098
76769
|
if (!isMemberDictionaryBase(member)) return;
|
|
76099
|
-
const entryMember =
|
|
76770
|
+
const entryMember = membersById2.get(member.entryMemberId);
|
|
76100
76771
|
if (entryMember === void 0) return;
|
|
76101
76772
|
for (const [key, childId] of Object.entries(stringRecord2(row.value))) {
|
|
76102
76773
|
const segment = { kind: "dictionary", key };
|
|
@@ -76123,7 +76794,8 @@ function indexExpansion(args) {
|
|
|
76123
76794
|
nodesByPath,
|
|
76124
76795
|
rowsByExpandedId,
|
|
76125
76796
|
childPathsByParentPath,
|
|
76126
|
-
claimedVirtualIds
|
|
76797
|
+
claimedVirtualIds,
|
|
76798
|
+
membersById: membersById2
|
|
76127
76799
|
};
|
|
76128
76800
|
}
|
|
76129
76801
|
function outermostVirtualCollectionBoundary(graph, target) {
|
|
@@ -76494,18 +77166,34 @@ function assertVirtualExpansionIsLiteral(rows) {
|
|
|
76494
77166
|
}
|
|
76495
77167
|
}
|
|
76496
77168
|
}
|
|
77169
|
+
function composeResolverDocument(document, resolverLookups) {
|
|
77170
|
+
let byLookups = resolverDocumentsByDocument.get(document);
|
|
77171
|
+
if (byLookups === void 0) {
|
|
77172
|
+
byLookups = /* @__PURE__ */ new WeakMap();
|
|
77173
|
+
resolverDocumentsByDocument.set(document, byLookups);
|
|
77174
|
+
}
|
|
77175
|
+
const memoized = byLookups.get(resolverLookups);
|
|
77176
|
+
if (memoized !== void 0) return memoized;
|
|
77177
|
+
const composed = {
|
|
77178
|
+
...document,
|
|
77179
|
+
databaseVM: resolverLookups
|
|
77180
|
+
};
|
|
77181
|
+
byLookups.set(resolverLookups, composed);
|
|
77182
|
+
return composed;
|
|
77183
|
+
}
|
|
76497
77184
|
function resolveVariantInstanceGraphForDocument(args) {
|
|
76498
77185
|
if (!isLiteralValueContent(args.priorInstanceRoot) || !isLiteralValueContent(args.nextInstanceRoot)) {
|
|
76499
77186
|
throw new Error("ToVariant requires literal instance roots.");
|
|
76500
77187
|
}
|
|
77188
|
+
const document = composeResolverDocument(args.document, args.resolverLookups);
|
|
76501
77189
|
const classId = args.nextInstanceRoot.classId ?? args.priorInstanceRoot.classId;
|
|
76502
77190
|
if (typeof classId !== "string" || classId.length === 0) {
|
|
76503
77191
|
throw new Error("ToVariant instance root has no concrete class id.");
|
|
76504
77192
|
}
|
|
76505
|
-
const declaredMember = args.declaredRootMember !== void 0 ? args.declaredRootMember ?? void 0 : variantSwapDeclaredMember(
|
|
77193
|
+
const declaredMember = args.declaredRootMember !== void 0 ? args.declaredRootMember ?? void 0 : variantSwapDeclaredMember(document, args.priorInstanceRoot.id);
|
|
76506
77194
|
const syntheticRootMember = {
|
|
76507
77195
|
id: `virtual-instance-root:${args.priorInstanceRoot.id}`,
|
|
76508
|
-
projectId:
|
|
77196
|
+
projectId: document.project.id,
|
|
76509
77197
|
createdAt: args.priorInstanceRoot.createdAt,
|
|
76510
77198
|
updatedAt: args.priorInstanceRoot.updatedAt,
|
|
76511
77199
|
name: "Virtual instance root",
|
|
@@ -76519,17 +77207,17 @@ function resolveVariantInstanceGraphForDocument(args) {
|
|
|
76519
77207
|
isAbstract: false,
|
|
76520
77208
|
accessModifierKind: "public"
|
|
76521
77209
|
};
|
|
76522
|
-
const rootMember = declaredMember !== void 0 && isMemberClassBase(resolveMember2(declaredMember,
|
|
76523
|
-
const materializedById = args.materializedRowsById ?? new Map(
|
|
77210
|
+
const rootMember = declaredMember !== void 0 && isMemberClassBase(resolveMember2(declaredMember, document.members)) ? declaredMember : syntheticRootMember;
|
|
77211
|
+
const materializedById = args.materializedRowsById ?? new Map(document.values.map((row) => [row.id, row]));
|
|
76524
77212
|
for (const row of args.localRows) materializedById.set(row.id, row);
|
|
76525
77213
|
materializedById.set(args.priorInstanceRoot.id, args.priorInstanceRoot);
|
|
76526
77214
|
const priorExpanded = expandStoredInstance({
|
|
76527
|
-
document
|
|
77215
|
+
document,
|
|
76528
77216
|
instanceRoot: args.priorInstanceRoot,
|
|
76529
77217
|
rootMember
|
|
76530
77218
|
});
|
|
76531
77219
|
const priorGraph = resolveVirtualInstanceGraph({
|
|
76532
|
-
document
|
|
77220
|
+
document,
|
|
76533
77221
|
instanceRoot: args.priorInstanceRoot,
|
|
76534
77222
|
rootMember,
|
|
76535
77223
|
expandedRoot: priorExpanded.root,
|
|
@@ -76560,12 +77248,12 @@ function resolveVariantInstanceGraphForDocument(args) {
|
|
|
76560
77248
|
}
|
|
76561
77249
|
materializedById.set(args.nextInstanceRoot.id, args.nextInstanceRoot);
|
|
76562
77250
|
const nextExpanded = expandStoredInstance({
|
|
76563
|
-
document
|
|
77251
|
+
document,
|
|
76564
77252
|
instanceRoot: args.nextInstanceRoot,
|
|
76565
77253
|
rootMember
|
|
76566
77254
|
});
|
|
76567
77255
|
const nextGraph = resolveVirtualInstanceGraph({
|
|
76568
|
-
document
|
|
77256
|
+
document,
|
|
76569
77257
|
instanceRoot: args.nextInstanceRoot,
|
|
76570
77258
|
rootMember,
|
|
76571
77259
|
expandedRoot: nextExpanded.root,
|
|
@@ -76606,6 +77294,7 @@ function createHeadlessVirtualInstanceResolver(args) {
|
|
|
76606
77294
|
values: document.values
|
|
76607
77295
|
}).placementByValueId;
|
|
76608
77296
|
const rawById = new Map(document.values.map((row) => [row.id, row]));
|
|
77297
|
+
const resolverDocumentOnce = () => composeResolverDocument(document, args.resolverLookups());
|
|
76609
77298
|
const graphRowsByRootId = /* @__PURE__ */ new Map();
|
|
76610
77299
|
const graphByValueId = /* @__PURE__ */ new Map();
|
|
76611
77300
|
const failedRootIds = /* @__PURE__ */ new Set();
|
|
@@ -76629,10 +77318,7 @@ function createHeadlessVirtualInstanceResolver(args) {
|
|
|
76629
77318
|
return /* @__PURE__ */ new Map();
|
|
76630
77319
|
}
|
|
76631
77320
|
try {
|
|
76632
|
-
const resolverDocument =
|
|
76633
|
-
...document,
|
|
76634
|
-
databaseVM: args.resolverLookups()
|
|
76635
|
-
};
|
|
77321
|
+
const resolverDocument = resolverDocumentOnce();
|
|
76636
77322
|
const expanded = expandStoredInstance({
|
|
76637
77323
|
document: resolverDocument,
|
|
76638
77324
|
instanceRoot,
|
|
@@ -76687,7 +77373,7 @@ function createHeadlessVirtualInstanceResolver(args) {
|
|
|
76687
77373
|
}
|
|
76688
77374
|
};
|
|
76689
77375
|
}
|
|
76690
|
-
var KEPT_ROW_SAMPLE_LIMIT, VirtualExpansionUnsupportedError, ROOT_PATH, SYNTHETIC_LINEAGE_PREFIXES;
|
|
77376
|
+
var KEPT_ROW_SAMPLE_LIMIT, CORPUS_SCANNING_MEMBER_KINDS, CONSTRUCTOR_TYPE_WALK_DEPTH_LIMIT, VirtualExpansionUnsupportedError, ROOT_PATH, SYNTHETIC_LINEAGE_PREFIXES, resolverDocumentsByDocument;
|
|
76691
77377
|
var init_virtual_instance_values = __esm({
|
|
76692
77378
|
"../src/database/virtual-instance-values.ts"() {
|
|
76693
77379
|
"use strict";
|
|
@@ -76703,6 +77389,17 @@ var init_virtual_instance_values = __esm({
|
|
|
76703
77389
|
init_constructor_argument_ownership();
|
|
76704
77390
|
init_src();
|
|
76705
77391
|
KEPT_ROW_SAMPLE_LIMIT = 12;
|
|
77392
|
+
CORPUS_SCANNING_MEMBER_KINDS = /* @__PURE__ */ new Set([
|
|
77393
|
+
9 /* Lookup */,
|
|
77394
|
+
18 /* DialogueLookup */,
|
|
77395
|
+
10 /* NSProperty */,
|
|
77396
|
+
23 /* NSFunction */,
|
|
77397
|
+
13 /* Function */,
|
|
77398
|
+
24 /* FunctionRef */,
|
|
77399
|
+
25 /* NSDelegate */,
|
|
77400
|
+
26 /* NSAction */
|
|
77401
|
+
]);
|
|
77402
|
+
CONSTRUCTOR_TYPE_WALK_DEPTH_LIMIT = 8;
|
|
76706
77403
|
VirtualExpansionUnsupportedError = class extends Error {
|
|
76707
77404
|
constructor(message) {
|
|
76708
77405
|
super(message);
|
|
@@ -76711,6 +77408,7 @@ var init_virtual_instance_values = __esm({
|
|
|
76711
77408
|
};
|
|
76712
77409
|
ROOT_PATH = "$";
|
|
76713
77410
|
SYNTHETIC_LINEAGE_PREFIXES = ["missing-expansion:", "path:"];
|
|
77411
|
+
resolverDocumentsByDocument = /* @__PURE__ */ new WeakMap();
|
|
76714
77412
|
}
|
|
76715
77413
|
});
|
|
76716
77414
|
|
|
@@ -76748,7 +77446,8 @@ function initializerEvaluatorLookups(document) {
|
|
|
76748
77446
|
// resolves against the plain document, with these lookups as the
|
|
76749
77447
|
// nested resolver.
|
|
76750
77448
|
resolveVariantInstanceGraph: (args) => resolveVariantInstanceGraphForDocument({
|
|
76751
|
-
document
|
|
77449
|
+
document,
|
|
77450
|
+
resolverLookups: lookups,
|
|
76752
77451
|
...args
|
|
76753
77452
|
})
|
|
76754
77453
|
} : {
|
|
@@ -76938,6 +77637,30 @@ function evaluateInitializerMaterialization(args) {
|
|
|
76938
77637
|
});
|
|
76939
77638
|
return { evaluated, createdValues, storageKeyDeclarations };
|
|
76940
77639
|
}
|
|
77640
|
+
function finalizeMaterializedRoot(args) {
|
|
77641
|
+
for (const created of args.allCreated) {
|
|
77642
|
+
if (created === args.root) continue;
|
|
77643
|
+
if (created.classId === void 0) delete created.classId;
|
|
77644
|
+
}
|
|
77645
|
+
stampCreatedValuesMapKey(args.allCreated, args.mapKey);
|
|
77646
|
+
if (args.supersededRootId !== void 0) {
|
|
77647
|
+
args.storageKeyDeclarations.delete(args.supersededRootId);
|
|
77648
|
+
}
|
|
77649
|
+
args.storageKeyDeclarations.delete(args.root.id);
|
|
77650
|
+
applyDeclaredStorageKeyOverrides({
|
|
77651
|
+
createdValues: args.allCreated,
|
|
77652
|
+
declarationByValueId: args.storageKeyDeclarations,
|
|
77653
|
+
existingParentContextById: /* @__PURE__ */ new Map([
|
|
77654
|
+
[
|
|
77655
|
+
args.root.id,
|
|
77656
|
+
{
|
|
77657
|
+
mapKey: args.mapKey ?? null,
|
|
77658
|
+
classId: args.root.classId ?? void 0
|
|
77659
|
+
}
|
|
77660
|
+
]
|
|
77661
|
+
])
|
|
77662
|
+
});
|
|
77663
|
+
}
|
|
76941
77664
|
function materializeInitializerValue(args) {
|
|
76942
77665
|
const { evaluated, createdValues, storageKeyDeclarations } = evaluateInitializerMaterialization({
|
|
76943
77666
|
init: args.row.init,
|
|
@@ -76965,31 +77688,19 @@ function materializeInitializerValue(args) {
|
|
|
76965
77688
|
instanceVariantRowValueId: evaluated.instanceVariantRowValueId
|
|
76966
77689
|
}
|
|
76967
77690
|
};
|
|
77691
|
+
const allCreated = [root, ...createdValues];
|
|
76968
77692
|
if (evaluated.provisionalRootId !== void 0) {
|
|
76969
77693
|
retargetDelegateReceiverValueIds(
|
|
76970
|
-
|
|
77694
|
+
allCreated,
|
|
76971
77695
|
evaluated.provisionalRootId,
|
|
76972
77696
|
root.id
|
|
76973
77697
|
);
|
|
76974
77698
|
}
|
|
76975
|
-
|
|
76976
|
-
|
|
76977
|
-
|
|
76978
|
-
|
|
76979
|
-
|
|
76980
|
-
storageKeyDeclarations.delete(root.id);
|
|
76981
|
-
applyDeclaredStorageKeyOverrides({
|
|
76982
|
-
createdValues: allCreated,
|
|
76983
|
-
declarationByValueId: storageKeyDeclarations,
|
|
76984
|
-
existingParentContextById: /* @__PURE__ */ new Map([
|
|
76985
|
-
[
|
|
76986
|
-
root.id,
|
|
76987
|
-
{
|
|
76988
|
-
mapKey: args.row.mapKey ?? null,
|
|
76989
|
-
classId: root.classId ?? void 0
|
|
76990
|
-
}
|
|
76991
|
-
]
|
|
76992
|
-
])
|
|
77699
|
+
finalizeMaterializedRoot({
|
|
77700
|
+
root,
|
|
77701
|
+
allCreated,
|
|
77702
|
+
mapKey: args.row.mapKey,
|
|
77703
|
+
storageKeyDeclarations
|
|
76993
77704
|
});
|
|
76994
77705
|
return {
|
|
76995
77706
|
root,
|
|
@@ -76997,6 +77708,43 @@ function materializeInitializerValue(args) {
|
|
|
76997
77708
|
pinnedRootSchemaKeys: evaluated.pinnedRootSchemaKeys ?? /* @__PURE__ */ new Set()
|
|
76998
77709
|
};
|
|
76999
77710
|
}
|
|
77711
|
+
function materializeMemberDefaultValue(args) {
|
|
77712
|
+
const createdValues = [];
|
|
77713
|
+
const storageKeyDeclarations = /* @__PURE__ */ new Map();
|
|
77714
|
+
const built = buildDefaultMemberValue({
|
|
77715
|
+
document: args.document,
|
|
77716
|
+
projectId: args.envelope.projectId,
|
|
77717
|
+
member: args.member,
|
|
77718
|
+
createdValues,
|
|
77719
|
+
storageKeyDeclarations,
|
|
77720
|
+
...args.genericEnv === void 0 ? {} : { genericEnv: args.genericEnv },
|
|
77721
|
+
// A declaration default may itself be init-backed one level down (P43 §2),
|
|
77722
|
+
// and those nested initializers must evaluate against the same document.
|
|
77723
|
+
initEvaluator: (member, init) => evaluateMemberInitializer({
|
|
77724
|
+
init,
|
|
77725
|
+
member,
|
|
77726
|
+
document: args.document,
|
|
77727
|
+
createdValues
|
|
77728
|
+
})
|
|
77729
|
+
});
|
|
77730
|
+
const interior = createdValues.filter((created) => created.id !== built.id);
|
|
77731
|
+
const root = {
|
|
77732
|
+
...args.envelope,
|
|
77733
|
+
value: built.value,
|
|
77734
|
+
...built.classId === void 0 ? {} : { classId: built.classId },
|
|
77735
|
+
...built.genericBindings == null ? {} : { genericBindings: { ...built.genericBindings } }
|
|
77736
|
+
};
|
|
77737
|
+
const allCreated = [root, ...interior];
|
|
77738
|
+
retargetDelegateReceiverValueIds(allCreated, built.id, root.id);
|
|
77739
|
+
finalizeMaterializedRoot({
|
|
77740
|
+
root,
|
|
77741
|
+
allCreated,
|
|
77742
|
+
mapKey: args.envelope.mapKey,
|
|
77743
|
+
storageKeyDeclarations,
|
|
77744
|
+
supersededRootId: built.id
|
|
77745
|
+
});
|
|
77746
|
+
return { root, createdValues: interior, pinnedRootSchemaKeys: /* @__PURE__ */ new Set() };
|
|
77747
|
+
}
|
|
77000
77748
|
var init_init_backed_value_materialization = __esm({
|
|
77001
77749
|
"../src/database/init-backed-value-materialization.ts"() {
|
|
77002
77750
|
"use strict";
|
|
@@ -78632,315 +79380,6 @@ var init_project_document_read = __esm({
|
|
|
78632
79380
|
}
|
|
78633
79381
|
});
|
|
78634
79382
|
|
|
78635
|
-
// src/workspace.ts
|
|
78636
|
-
import { createHash as createHash2 } from "node:crypto";
|
|
78637
|
-
import { mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2, existsSync as existsSync2 } from "node:fs";
|
|
78638
|
-
import { dirname, join as join2, resolve } from "node:path";
|
|
78639
|
-
function recordStateKey(recordKind, recordId) {
|
|
78640
|
-
return `${recordKind}:${recordId}`;
|
|
78641
|
-
}
|
|
78642
|
-
function findWorkspaceRoot(startDir) {
|
|
78643
|
-
let dir = resolve(startDir);
|
|
78644
|
-
for (; ; ) {
|
|
78645
|
-
if (existsSync2(join2(dir, NEO_CONFIG_FILE))) return dir;
|
|
78646
|
-
const parent = dirname(dir);
|
|
78647
|
-
if (parent === dir) return null;
|
|
78648
|
-
dir = parent;
|
|
78649
|
-
}
|
|
78650
|
-
}
|
|
78651
|
-
function readWorkspaceConfig(root) {
|
|
78652
|
-
const raw = readFileSync2(join2(root, NEO_CONFIG_FILE), "utf8");
|
|
78653
|
-
const parsed = JSON.parse(raw);
|
|
78654
|
-
if (typeof parsed !== "object" || parsed === null) {
|
|
78655
|
-
throw new Error(`"${NEO_CONFIG_FILE}" must contain a JSON object.`);
|
|
78656
|
-
}
|
|
78657
|
-
const config = parsed;
|
|
78658
|
-
if (config.formatVersion === void 0) {
|
|
78659
|
-
throw new Error(
|
|
78660
|
-
`"${NEO_CONFIG_FILE}" is missing required field "formatVersion"; expected ${CURRENT_FORMAT_VERSION}. Recreate this working copy with \`neo init\`.`
|
|
78661
|
-
);
|
|
78662
|
-
}
|
|
78663
|
-
if (config.formatVersion !== CURRENT_FORMAT_VERSION) {
|
|
78664
|
-
throw new Error(
|
|
78665
|
-
`"${NEO_CONFIG_FILE}" field "formatVersion" must be ${CURRENT_FORMAT_VERSION}; received ${JSON.stringify(config.formatVersion)}. Native Neo project source is a clean break; preserve local edits and create a fresh working copy with \`neo init\`.`
|
|
78666
|
-
);
|
|
78667
|
-
}
|
|
78668
|
-
const formatVersion = CURRENT_FORMAT_VERSION;
|
|
78669
|
-
if (typeof config.apiBaseUrl !== "string") {
|
|
78670
|
-
throw new Error(
|
|
78671
|
-
`"${NEO_CONFIG_FILE}" is missing string field "apiBaseUrl".`
|
|
78672
|
-
);
|
|
78673
|
-
}
|
|
78674
|
-
const profile = config.profile === "release" ? "release" : "editor";
|
|
78675
|
-
const convexUrl = typeof config.convexUrl === "string" ? config.convexUrl : void 0;
|
|
78676
|
-
const prePushHook = optionalHook(config, "prePushHook");
|
|
78677
|
-
const prePushDryRunHook = optionalHook(config, "prePushDryRunHook");
|
|
78678
|
-
const test = optionalTestConfig(config.test);
|
|
78679
|
-
if (typeof config.unityConfigPath === "string") {
|
|
78680
|
-
if (config.projectId !== void 0) {
|
|
78681
|
-
throw new Error(
|
|
78682
|
-
`"${NEO_CONFIG_FILE}" sets "unityConfigPath", so "projectId" must be removed \u2014 the Unity config asset is the single source of truth.`
|
|
78683
|
-
);
|
|
78684
|
-
}
|
|
78685
|
-
if (config.versionId !== void 0) {
|
|
78686
|
-
throw new Error(
|
|
78687
|
-
`"${NEO_CONFIG_FILE}" sets "unityConfigPath", so "versionId" must be removed \u2014 the Unity config asset is the single source of truth.`
|
|
78688
|
-
);
|
|
78689
|
-
}
|
|
78690
|
-
const ids = readUnityConfigIds(root, config.unityConfigPath);
|
|
78691
|
-
return {
|
|
78692
|
-
formatVersion,
|
|
78693
|
-
apiBaseUrl: config.apiBaseUrl,
|
|
78694
|
-
projectId: ids.projectId,
|
|
78695
|
-
versionId: ids.versionId,
|
|
78696
|
-
profile,
|
|
78697
|
-
convexUrl,
|
|
78698
|
-
unityConfigPath: config.unityConfigPath,
|
|
78699
|
-
...prePushHook === void 0 ? {} : { prePushHook },
|
|
78700
|
-
...prePushDryRunHook === void 0 ? {} : { prePushDryRunHook },
|
|
78701
|
-
...test === void 0 ? {} : { test }
|
|
78702
|
-
};
|
|
78703
|
-
}
|
|
78704
|
-
if (typeof config.projectId !== "string") {
|
|
78705
|
-
throw new Error(
|
|
78706
|
-
`"${NEO_CONFIG_FILE}" is missing string field "projectId".`
|
|
78707
|
-
);
|
|
78708
|
-
}
|
|
78709
|
-
if (typeof config.versionId !== "string") {
|
|
78710
|
-
throw new Error(
|
|
78711
|
-
`"${NEO_CONFIG_FILE}" is missing string field "versionId".`
|
|
78712
|
-
);
|
|
78713
|
-
}
|
|
78714
|
-
return {
|
|
78715
|
-
formatVersion,
|
|
78716
|
-
apiBaseUrl: config.apiBaseUrl,
|
|
78717
|
-
projectId: config.projectId,
|
|
78718
|
-
versionId: config.versionId,
|
|
78719
|
-
profile,
|
|
78720
|
-
convexUrl,
|
|
78721
|
-
...prePushHook === void 0 ? {} : { prePushHook },
|
|
78722
|
-
...prePushDryRunHook === void 0 ? {} : { prePushDryRunHook },
|
|
78723
|
-
...test === void 0 ? {} : { test }
|
|
78724
|
-
};
|
|
78725
|
-
}
|
|
78726
|
-
function optionalHook(config, field) {
|
|
78727
|
-
const value = config[field];
|
|
78728
|
-
if (value === void 0) return void 0;
|
|
78729
|
-
if (typeof value !== "string" || value.trim().length === 0) {
|
|
78730
|
-
throw new Error(
|
|
78731
|
-
`"${NEO_CONFIG_FILE}" field "${field}" must be a non-empty CLI command.`
|
|
78732
|
-
);
|
|
78733
|
-
}
|
|
78734
|
-
return value;
|
|
78735
|
-
}
|
|
78736
|
-
function optionalTestConfig(value) {
|
|
78737
|
-
if (value === void 0) return void 0;
|
|
78738
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
78739
|
-
throw new Error(`"${NEO_CONFIG_FILE}" field "test" must be an object.`);
|
|
78740
|
-
}
|
|
78741
|
-
const config = value;
|
|
78742
|
-
const allowed = /* @__PURE__ */ new Set([
|
|
78743
|
-
"include",
|
|
78744
|
-
"exclude",
|
|
78745
|
-
"timeoutMs",
|
|
78746
|
-
"maxWorkers",
|
|
78747
|
-
"forbidOnly"
|
|
78748
|
-
]);
|
|
78749
|
-
const unknown = Object.keys(config).find((key) => !allowed.has(key));
|
|
78750
|
-
if (unknown !== void 0) {
|
|
78751
|
-
throw new Error(
|
|
78752
|
-
`"${NEO_CONFIG_FILE}" field "test.${unknown}" is not recognized.`
|
|
78753
|
-
);
|
|
78754
|
-
}
|
|
78755
|
-
const stringArray2 = (field) => {
|
|
78756
|
-
const entry = config[field];
|
|
78757
|
-
if (entry === void 0) return void 0;
|
|
78758
|
-
if (!Array.isArray(entry) || entry.some((item) => typeof item !== "string" || item.length === 0)) {
|
|
78759
|
-
throw new Error(
|
|
78760
|
-
`"${NEO_CONFIG_FILE}" field "test.${field}" must be an array of non-empty strings.`
|
|
78761
|
-
);
|
|
78762
|
-
}
|
|
78763
|
-
return entry;
|
|
78764
|
-
};
|
|
78765
|
-
const positiveInteger = (field) => {
|
|
78766
|
-
const entry = config[field];
|
|
78767
|
-
if (entry === void 0) return void 0;
|
|
78768
|
-
if (typeof entry !== "number" || !Number.isInteger(entry) || entry <= 0) {
|
|
78769
|
-
throw new Error(
|
|
78770
|
-
`"${NEO_CONFIG_FILE}" field "test.${field}" must be a positive integer.`
|
|
78771
|
-
);
|
|
78772
|
-
}
|
|
78773
|
-
return entry;
|
|
78774
|
-
};
|
|
78775
|
-
const include = stringArray2("include");
|
|
78776
|
-
const exclude = stringArray2("exclude");
|
|
78777
|
-
const invalidInclude = include?.find(
|
|
78778
|
-
(pattern) => !pattern.endsWith(".spec.neo")
|
|
78779
|
-
);
|
|
78780
|
-
if (invalidInclude !== void 0) {
|
|
78781
|
-
throw new Error(
|
|
78782
|
-
`"${NEO_CONFIG_FILE}" field "test.include" may select only .spec.neo files; received ${JSON.stringify(invalidInclude)}.`
|
|
78783
|
-
);
|
|
78784
|
-
}
|
|
78785
|
-
const timeoutMs = positiveInteger("timeoutMs");
|
|
78786
|
-
const maxWorkers = positiveInteger("maxWorkers");
|
|
78787
|
-
const forbidOnly = config.forbidOnly;
|
|
78788
|
-
if (forbidOnly !== void 0 && typeof forbidOnly !== "boolean") {
|
|
78789
|
-
throw new Error(
|
|
78790
|
-
`"${NEO_CONFIG_FILE}" field "test.forbidOnly" must be a boolean.`
|
|
78791
|
-
);
|
|
78792
|
-
}
|
|
78793
|
-
return {
|
|
78794
|
-
...include === void 0 ? {} : { include },
|
|
78795
|
-
...exclude === void 0 ? {} : { exclude },
|
|
78796
|
-
...timeoutMs === void 0 ? {} : { timeoutMs },
|
|
78797
|
-
...maxWorkers === void 0 ? {} : { maxWorkers },
|
|
78798
|
-
...forbidOnly === void 0 ? {} : { forbidOnly }
|
|
78799
|
-
};
|
|
78800
|
-
}
|
|
78801
|
-
function writeWorkspaceConfig(root, config) {
|
|
78802
|
-
let persisted = { ...config };
|
|
78803
|
-
if (config.unityConfigPath !== void 0) {
|
|
78804
|
-
const { projectId, versionId, ...rest } = persisted;
|
|
78805
|
-
void projectId;
|
|
78806
|
-
void versionId;
|
|
78807
|
-
persisted = rest;
|
|
78808
|
-
writeUnityConfigVersionId(root, config.unityConfigPath, config.versionId);
|
|
78809
|
-
}
|
|
78810
|
-
writeFileSync2(
|
|
78811
|
-
join2(root, NEO_CONFIG_FILE),
|
|
78812
|
-
`${JSON.stringify(persisted, null, 2)}
|
|
78813
|
-
`,
|
|
78814
|
-
"utf8"
|
|
78815
|
-
);
|
|
78816
|
-
}
|
|
78817
|
-
function readUnityConfigIds(root, unityConfigPath) {
|
|
78818
|
-
const assetPath = resolve(root, unityConfigPath);
|
|
78819
|
-
if (!existsSync2(assetPath)) {
|
|
78820
|
-
throw new Error(
|
|
78821
|
-
`"unityConfigPath" in "${NEO_CONFIG_FILE}" points to "${assetPath}", which does not exist.`
|
|
78822
|
-
);
|
|
78823
|
-
}
|
|
78824
|
-
const content = readFileSync2(assetPath, "utf8");
|
|
78825
|
-
const projectId = matchUnityScalarField(content, "projectId");
|
|
78826
|
-
if (projectId === null) {
|
|
78827
|
-
throw new Error(
|
|
78828
|
-
`Unity config asset "${assetPath}" has no "projectId" field.`
|
|
78829
|
-
);
|
|
78830
|
-
}
|
|
78831
|
-
const versionId = matchUnityScalarField(content, "versionId");
|
|
78832
|
-
if (versionId === null) {
|
|
78833
|
-
throw new Error(
|
|
78834
|
-
`Unity config asset "${assetPath}" has no "versionId" field.`
|
|
78835
|
-
);
|
|
78836
|
-
}
|
|
78837
|
-
return { projectId, versionId };
|
|
78838
|
-
}
|
|
78839
|
-
function writeUnityConfigVersionId(root, unityConfigPath, versionId) {
|
|
78840
|
-
const assetPath = resolve(root, unityConfigPath);
|
|
78841
|
-
if (!existsSync2(assetPath)) {
|
|
78842
|
-
throw new Error(
|
|
78843
|
-
`"unityConfigPath" in "${NEO_CONFIG_FILE}" points to "${assetPath}", which does not exist.`
|
|
78844
|
-
);
|
|
78845
|
-
}
|
|
78846
|
-
const content = readFileSync2(assetPath, "utf8");
|
|
78847
|
-
const current = matchUnityScalarField(content, "versionId");
|
|
78848
|
-
if (current === null) {
|
|
78849
|
-
throw new Error(
|
|
78850
|
-
`Unity config asset "${assetPath}" has no "versionId" field to update.`
|
|
78851
|
-
);
|
|
78852
|
-
}
|
|
78853
|
-
if (current === versionId) return;
|
|
78854
|
-
const updated = content.replace(
|
|
78855
|
-
/^(\s*versionId:[ \t]*).*$/m,
|
|
78856
|
-
`$1${versionId}`
|
|
78857
|
-
);
|
|
78858
|
-
writeFileSync2(assetPath, updated, "utf8");
|
|
78859
|
-
}
|
|
78860
|
-
function matchUnityScalarField(content, field) {
|
|
78861
|
-
const match = new RegExp(`^\\s*${field}:[ \\t]*(\\S+)[ \\t]*$`, "m").exec(
|
|
78862
|
-
content
|
|
78863
|
-
);
|
|
78864
|
-
return match === null ? null : match[1];
|
|
78865
|
-
}
|
|
78866
|
-
function readWorkspaceState(root, options = {}) {
|
|
78867
|
-
const statePath = join2(root, NEO_STATE_DIR, NEO_STATE_FILE);
|
|
78868
|
-
if (!existsSync2(statePath)) {
|
|
78869
|
-
options.onSourceRead?.(null);
|
|
78870
|
-
return { records: {} };
|
|
78871
|
-
}
|
|
78872
|
-
const source = readFileSync2(statePath, "utf8");
|
|
78873
|
-
options.onSourceRead?.(source);
|
|
78874
|
-
const parsed = JSON.parse(source);
|
|
78875
|
-
if (typeof parsed !== "object" || parsed === null) {
|
|
78876
|
-
throw new Error(`"${statePath}" must contain a JSON object.`);
|
|
78877
|
-
}
|
|
78878
|
-
const state = parsed;
|
|
78879
|
-
if (typeof state.records !== "object" || state.records === null) {
|
|
78880
|
-
throw new Error(`"${statePath}" is missing the "records" object.`);
|
|
78881
|
-
}
|
|
78882
|
-
for (const [key, value] of Object.entries(state.records)) {
|
|
78883
|
-
if (typeof value !== "object" || value === null) {
|
|
78884
|
-
throw new Error(
|
|
78885
|
-
`"${statePath}" record ${JSON.stringify(key)} must be an object.`
|
|
78886
|
-
);
|
|
78887
|
-
}
|
|
78888
|
-
const recordKind = value.recordKind;
|
|
78889
|
-
if (recordKind === "type" || recordKind === "attribute" || key.startsWith("type:") || key.startsWith("attribute:")) {
|
|
78890
|
-
if (options.discardLegacyFormat2State === true) {
|
|
78891
|
-
return { records: {} };
|
|
78892
|
-
}
|
|
78893
|
-
throw new Error(
|
|
78894
|
-
`"${statePath}" contains legacy Class/Member state at ${JSON.stringify(key)}. Cached legacy state cannot be upgraded; preserve any local source you need, then run \`neo pull --reset\` to reconstruct this format-4 working copy from the authoritative server.`
|
|
78895
|
-
);
|
|
78896
|
-
}
|
|
78897
|
-
}
|
|
78898
|
-
return state;
|
|
78899
|
-
}
|
|
78900
|
-
function writeWorkspaceState(root, state) {
|
|
78901
|
-
const stateDir = join2(root, NEO_STATE_DIR);
|
|
78902
|
-
mkdirSync2(stateDir, { recursive: true });
|
|
78903
|
-
writeFileSync2(
|
|
78904
|
-
join2(stateDir, NEO_STATE_FILE),
|
|
78905
|
-
`${JSON.stringify(state, null, 2)}
|
|
78906
|
-
`,
|
|
78907
|
-
"utf8"
|
|
78908
|
-
);
|
|
78909
|
-
}
|
|
78910
|
-
function loadWorkspace(startDir, options = {}) {
|
|
78911
|
-
const root = findWorkspaceRoot(startDir);
|
|
78912
|
-
if (root === null) {
|
|
78913
|
-
throw new Error(
|
|
78914
|
-
`No "${NEO_CONFIG_FILE}" found in "${startDir}" or any parent directory. Run "neo init" first.`
|
|
78915
|
-
);
|
|
78916
|
-
}
|
|
78917
|
-
let stateSourceSha256;
|
|
78918
|
-
const state = readWorkspaceState(root, {
|
|
78919
|
-
discardLegacyFormat2State: options.discardLegacyFormat2State,
|
|
78920
|
-
...options.fingerprintStateSource === true ? {
|
|
78921
|
-
onSourceRead: (source) => {
|
|
78922
|
-
stateSourceSha256 = createHash2("sha256").update(source ?? "<missing>").digest("hex");
|
|
78923
|
-
}
|
|
78924
|
-
} : {}
|
|
78925
|
-
});
|
|
78926
|
-
return {
|
|
78927
|
-
root,
|
|
78928
|
-
config: readWorkspaceConfig(root),
|
|
78929
|
-
state,
|
|
78930
|
-
...stateSourceSha256 === void 0 ? {} : { stateSourceSha256 }
|
|
78931
|
-
};
|
|
78932
|
-
}
|
|
78933
|
-
var NEO_CONFIG_FILE, NEO_STATE_DIR, NEO_STATE_FILE, CURRENT_FORMAT_VERSION;
|
|
78934
|
-
var init_workspace = __esm({
|
|
78935
|
-
"src/workspace.ts"() {
|
|
78936
|
-
"use strict";
|
|
78937
|
-
NEO_CONFIG_FILE = "neo.json";
|
|
78938
|
-
NEO_STATE_DIR = ".neo";
|
|
78939
|
-
NEO_STATE_FILE = "state.json";
|
|
78940
|
-
CURRENT_FORMAT_VERSION = 4;
|
|
78941
|
-
}
|
|
78942
|
-
});
|
|
78943
|
-
|
|
78944
79383
|
// src/project-sync/value-record-comparison.ts
|
|
78945
79384
|
function valueRecordComparisonBody(value) {
|
|
78946
79385
|
if (!isObjectRecord2(value)) return value;
|
|
@@ -83049,13 +83488,13 @@ var init_static_member_ownership_recovery = __esm({
|
|
|
83049
83488
|
|
|
83050
83489
|
// ../src/models/animation/animation-clips.ts
|
|
83051
83490
|
function isWorldAnimationStructuralMember(memberId, members) {
|
|
83052
|
-
const
|
|
83491
|
+
const membersById2 = new Map(members.map((member) => [member.id, member]));
|
|
83053
83492
|
const visited = /* @__PURE__ */ new Set();
|
|
83054
83493
|
let currentId = memberId;
|
|
83055
83494
|
while (currentId !== void 0 && !visited.has(currentId)) {
|
|
83056
83495
|
if (WORLD_ANIMATION_STRUCTURAL_MEMBER_ROOT_IDS.has(currentId)) return true;
|
|
83057
83496
|
visited.add(currentId);
|
|
83058
|
-
currentId =
|
|
83497
|
+
currentId = membersById2.get(currentId)?.extendsMemberId;
|
|
83059
83498
|
}
|
|
83060
83499
|
return false;
|
|
83061
83500
|
}
|
|
@@ -83508,9 +83947,9 @@ var init_animation_clips = __esm({
|
|
|
83508
83947
|
if (!isNSDelegateValue(selector)) {
|
|
83509
83948
|
throw new Error(`${label} must carry a valid NeoDelegate selector.`);
|
|
83510
83949
|
}
|
|
83511
|
-
const
|
|
83512
|
-
if (
|
|
83513
|
-
const childNode = this.valueById.get(
|
|
83950
|
+
const directReference = nsDelegateDirectReference(selector);
|
|
83951
|
+
if (directReference === null) return null;
|
|
83952
|
+
const childNode = this.valueById.get(directReference.valueId);
|
|
83514
83953
|
if (childNode === void 0) {
|
|
83515
83954
|
throw new Error(`${label} selector did not resolve a stored child row.`);
|
|
83516
83955
|
}
|
|
@@ -83911,7 +84350,7 @@ var init_animation_clips = __esm({
|
|
|
83911
84350
|
}
|
|
83912
84351
|
}
|
|
83913
84352
|
/**
|
|
83914
|
-
* P42 §1.2/§1.3/§4.4. A
|
|
84353
|
+
* P42 §1.2/§1.3/§4.4. A `~partial` override row descends one level into a
|
|
83915
84354
|
* structured leaf's declared fields. The leaf stays the storage unit, so
|
|
83916
84355
|
* eligibility is evaluated on the enclosing member exactly as a whole-leaf
|
|
83917
84356
|
* override would be — fields carry no storage of their own and never appear
|
|
@@ -84314,8 +84753,8 @@ var init_animation_clips = __esm({
|
|
|
84314
84753
|
}
|
|
84315
84754
|
});
|
|
84316
84755
|
|
|
84317
|
-
// src/
|
|
84318
|
-
function
|
|
84756
|
+
// ../src/database/headless-virtual-instance-lookups.ts
|
|
84757
|
+
function headlessVirtualInstanceLookups(document, options = {}) {
|
|
84319
84758
|
const members = document.members;
|
|
84320
84759
|
const values = document.values;
|
|
84321
84760
|
const indexed = makeEvaluatorLookups(
|
|
@@ -84346,7 +84785,8 @@ function cliEvaluatorLookups(document, options = {}) {
|
|
|
84346
84785
|
// Stored-construction replay evaluates `ToVariant`, and production's
|
|
84347
84786
|
// variant-constructed placements collapse through exactly this path.
|
|
84348
84787
|
resolveVariantInstanceGraph: (args) => resolveVariantInstanceGraphForDocument({
|
|
84349
|
-
document
|
|
84788
|
+
document,
|
|
84789
|
+
resolverLookups: lookups,
|
|
84350
84790
|
...args
|
|
84351
84791
|
}),
|
|
84352
84792
|
// A write to a virtual key must MATERIALIZE it (a pin row at the
|
|
@@ -84356,6 +84796,18 @@ function cliEvaluatorLookups(document, options = {}) {
|
|
|
84356
84796
|
};
|
|
84357
84797
|
return lookups;
|
|
84358
84798
|
}
|
|
84799
|
+
var init_headless_virtual_instance_lookups = __esm({
|
|
84800
|
+
"../src/database/headless-virtual-instance-lookups.ts"() {
|
|
84801
|
+
"use strict";
|
|
84802
|
+
init_virtual_instance_values();
|
|
84803
|
+
init_neoscript_evaluator();
|
|
84804
|
+
}
|
|
84805
|
+
});
|
|
84806
|
+
|
|
84807
|
+
// src/evaluator-lookups.ts
|
|
84808
|
+
function cliEvaluatorLookups(document, options = {}) {
|
|
84809
|
+
return headlessVirtualInstanceLookups(document, options);
|
|
84810
|
+
}
|
|
84359
84811
|
function cliEvaluatorReceiverValue(lookups, valueId) {
|
|
84360
84812
|
if (typeof valueId !== "string") return null;
|
|
84361
84813
|
return lookups.valueById(valueId)?.value ?? null;
|
|
@@ -84363,8 +84815,7 @@ function cliEvaluatorReceiverValue(lookups, valueId) {
|
|
|
84363
84815
|
var init_evaluator_lookups = __esm({
|
|
84364
84816
|
"src/evaluator-lookups.ts"() {
|
|
84365
84817
|
"use strict";
|
|
84366
|
-
|
|
84367
|
-
init_neoscript_evaluator();
|
|
84818
|
+
init_headless_virtual_instance_lookups();
|
|
84368
84819
|
}
|
|
84369
84820
|
});
|
|
84370
84821
|
|
|
@@ -84433,6 +84884,14 @@ function storedConstructionEmitters(state, manifest) {
|
|
|
84433
84884
|
valueId
|
|
84434
84885
|
};
|
|
84435
84886
|
};
|
|
84887
|
+
const probedRootIds = /* @__PURE__ */ new Set();
|
|
84888
|
+
const probeRootOnce = (rootValueId, ownedRoot) => {
|
|
84889
|
+
if (probedRootIds.has(rootValueId)) {
|
|
84890
|
+
return /* @__PURE__ */ new Set();
|
|
84891
|
+
}
|
|
84892
|
+
probedRootIds.add(rootValueId);
|
|
84893
|
+
return probe.overrideKeys(ownedRoot);
|
|
84894
|
+
};
|
|
84436
84895
|
return {
|
|
84437
84896
|
construction(valueId) {
|
|
84438
84897
|
const ownedRoot = root(valueId);
|
|
@@ -84443,12 +84902,13 @@ function storedConstructionEmitters(state, manifest) {
|
|
|
84443
84902
|
const recorded = probe.overrideKeysOf(valueId);
|
|
84444
84903
|
if (recorded !== void 0) return recorded;
|
|
84445
84904
|
const ownedRoot = root(valueId);
|
|
84446
|
-
if (ownedRoot !== void 0) return
|
|
84905
|
+
if (ownedRoot !== void 0) return probeRootOnce(valueId, ownedRoot);
|
|
84447
84906
|
const ancestor = nearestOwnedAncestor(valueId, parentByChildId(), owners);
|
|
84448
84907
|
if (ancestor === null) return void 0;
|
|
84449
84908
|
const ancestorRoot = root(ancestor);
|
|
84450
84909
|
if (ancestorRoot === void 0) return void 0;
|
|
84451
|
-
|
|
84910
|
+
if (probedRootIds.has(ancestor)) return void 0;
|
|
84911
|
+
probeRootOnce(ancestor, ancestorRoot);
|
|
84452
84912
|
return probe.overrideKeysOf(valueId);
|
|
84453
84913
|
}
|
|
84454
84914
|
};
|
|
@@ -86547,7 +87007,7 @@ function worldPlacementVariantBindings(args) {
|
|
|
86547
87007
|
const foldersById = new Map(
|
|
86548
87008
|
args.variantFolders.map((folder) => [folder.id, folder])
|
|
86549
87009
|
);
|
|
86550
|
-
const
|
|
87010
|
+
const membersById2 = new Map(
|
|
86551
87011
|
args.members.map((member) => [member.id, member])
|
|
86552
87012
|
);
|
|
86553
87013
|
const valuesById = new Map(args.values.map((value) => [value.id, value]));
|
|
@@ -86562,7 +87022,7 @@ function worldPlacementVariantBindings(args) {
|
|
|
86562
87022
|
const folder = variant.folderId === null ? null : foldersById.get(variant.folderId) ?? null;
|
|
86563
87023
|
const binding = folder?.binding ?? null;
|
|
86564
87024
|
if (binding === null) return { id: variant.id, classId: variant.classId };
|
|
86565
|
-
const collection =
|
|
87025
|
+
const collection = membersById2.get(binding.collectionMemberId);
|
|
86566
87026
|
if (!isMemberListBase(collection)) {
|
|
86567
87027
|
return {
|
|
86568
87028
|
id: variant.id,
|
|
@@ -86610,7 +87070,7 @@ function lookupCollectionEntryIds(args) {
|
|
|
86610
87070
|
function validateWorldContentSidecars(args) {
|
|
86611
87071
|
const variants = args.variants ?? [];
|
|
86612
87072
|
const valuesById = new Map(args.values.map((value) => [value.id, value]));
|
|
86613
|
-
const
|
|
87073
|
+
const classesById2 = new Map(
|
|
86614
87074
|
args.classes.map((schemaClass2) => [schemaClass2.id, schemaClass2])
|
|
86615
87075
|
);
|
|
86616
87076
|
const containedIds = containedValueIdsByContainer(args.values);
|
|
@@ -86699,7 +87159,7 @@ function validateWorldContentSidecars(args) {
|
|
|
86699
87159
|
assertConcreteWorldClass({
|
|
86700
87160
|
classId: layerClassId,
|
|
86701
87161
|
classes: args.classes,
|
|
86702
|
-
classesById,
|
|
87162
|
+
classesById: classesById2,
|
|
86703
87163
|
expectedKind: expectedLayerKind,
|
|
86704
87164
|
label: `Layer link value "${linkValue.id}" target`
|
|
86705
87165
|
});
|
|
@@ -86723,7 +87183,7 @@ function validateWorldContentSidecars(args) {
|
|
|
86723
87183
|
overrideOwnerByLayerKey.set(layerKey, linkValue.id);
|
|
86724
87184
|
}
|
|
86725
87185
|
validateOwnedSparseValue({
|
|
86726
|
-
classesById,
|
|
87186
|
+
classesById: classesById2,
|
|
86727
87187
|
expectedClassId: layerClassId,
|
|
86728
87188
|
ownerId: linkValue.id,
|
|
86729
87189
|
referenceId: layerOverrideValueId,
|
|
@@ -86739,7 +87199,7 @@ function validateWorldContentSidecars(args) {
|
|
|
86739
87199
|
}
|
|
86740
87200
|
validateWorldPlacementSidecars({
|
|
86741
87201
|
classes: args.classes,
|
|
86742
|
-
classesById,
|
|
87202
|
+
classesById: classesById2,
|
|
86743
87203
|
importedClassIds: isTile ? importedTiles : importedObjects,
|
|
86744
87204
|
isTile,
|
|
86745
87205
|
layerClassId,
|
|
@@ -86772,12 +87232,12 @@ function validateWorldContentSidecars(args) {
|
|
|
86772
87232
|
assertConcreteWorldClass({
|
|
86773
87233
|
classId: layerClassId,
|
|
86774
87234
|
classes: args.classes,
|
|
86775
|
-
classesById,
|
|
87235
|
+
classesById: classesById2,
|
|
86776
87236
|
expectedKind: isTile ? NeoWorldSystemClassKind.TileLayer : NeoWorldSystemClassKind.ObjectLayer,
|
|
86777
87237
|
label: `Object-composition layer link value "${linkValue.id}" target`
|
|
86778
87238
|
});
|
|
86779
87239
|
validateOwnedSparseValue({
|
|
86780
|
-
classesById,
|
|
87240
|
+
classesById: classesById2,
|
|
86781
87241
|
expectedClassId: layerClassId,
|
|
86782
87242
|
ownerId: linkValue.id,
|
|
86783
87243
|
referenceId: optionalNonEmptyString(linkRecord.layerOverrideValueId),
|
|
@@ -86803,7 +87263,7 @@ function validateWorldContentSidecars(args) {
|
|
|
86803
87263
|
}
|
|
86804
87264
|
validateWorldPlacementSidecars({
|
|
86805
87265
|
classes: args.classes,
|
|
86806
|
-
classesById,
|
|
87266
|
+
classesById: classesById2,
|
|
86807
87267
|
importedClassIds: null,
|
|
86808
87268
|
isTile,
|
|
86809
87269
|
layerClassId,
|
|
@@ -87017,7 +87477,7 @@ function consumeWorldPlacementSidecarKeys(args) {
|
|
|
87017
87477
|
if (worldKind === null) return /* @__PURE__ */ new Set();
|
|
87018
87478
|
const assetKind = WORLD_PLACEMENT_ASSET_KIND.get(worldKind);
|
|
87019
87479
|
if (assetKind === void 0) return /* @__PURE__ */ new Set();
|
|
87020
|
-
const
|
|
87480
|
+
const classesById2 = new Map(
|
|
87021
87481
|
args.classes.map((schemaClass2) => [schemaClass2.id, schemaClass2])
|
|
87022
87482
|
);
|
|
87023
87483
|
const present = /* @__PURE__ */ new Set();
|
|
@@ -87035,7 +87495,7 @@ function consumeWorldPlacementSidecarKeys(args) {
|
|
|
87035
87495
|
assertConcreteWorldClass({
|
|
87036
87496
|
classId: assetClassId,
|
|
87037
87497
|
classes: args.classes,
|
|
87038
|
-
classesById,
|
|
87498
|
+
classesById: classesById2,
|
|
87039
87499
|
expectedKind: assetKind,
|
|
87040
87500
|
label: `${args.label} assetClassId`
|
|
87041
87501
|
});
|
|
@@ -87138,12 +87598,12 @@ function readVariantFolderRecord(value) {
|
|
|
87138
87598
|
}
|
|
87139
87599
|
return { id: value.id, classId: value.classId, path: value.path, binding };
|
|
87140
87600
|
}
|
|
87141
|
-
function resolveVariantWorldKind(classId,
|
|
87601
|
+
function resolveVariantWorldKind(classId, classesById2) {
|
|
87142
87602
|
const visited = /* @__PURE__ */ new Set();
|
|
87143
87603
|
let currentId = classId;
|
|
87144
87604
|
while (currentId !== null && !visited.has(currentId)) {
|
|
87145
87605
|
visited.add(currentId);
|
|
87146
|
-
const schemaClass2 =
|
|
87606
|
+
const schemaClass2 = classesById2.get(currentId);
|
|
87147
87607
|
if (schemaClass2 === void 0) return null;
|
|
87148
87608
|
const worldKind = schemaClass2.system?.worldKind;
|
|
87149
87609
|
if (typeof worldKind === "string") return worldKind;
|
|
@@ -87151,15 +87611,15 @@ function resolveVariantWorldKind(classId, classesById) {
|
|
|
87151
87611
|
}
|
|
87152
87612
|
return null;
|
|
87153
87613
|
}
|
|
87154
|
-
function isVariantFamilyClassId(classId,
|
|
87155
|
-
const worldKind = resolveVariantWorldKind(classId,
|
|
87614
|
+
function isVariantFamilyClassId(classId, classesById2) {
|
|
87615
|
+
const worldKind = resolveVariantWorldKind(classId, classesById2);
|
|
87156
87616
|
if (worldKind === VARIANT_WORLD_KIND) return true;
|
|
87157
87617
|
if (worldKind === VARIANT_FOLDER_WORLD_KIND) return true;
|
|
87158
87618
|
if (worldKind === LOOKUP_VARIANT_WORLD_KIND) return true;
|
|
87159
87619
|
return worldKind === LOOKUP_VARIANT_FOLDER_WORLD_KIND;
|
|
87160
87620
|
}
|
|
87161
|
-
function variantFamilyLabel(classId,
|
|
87162
|
-
const schemaClass2 =
|
|
87621
|
+
function variantFamilyLabel(classId, classesById2) {
|
|
87622
|
+
const schemaClass2 = classesById2.get(classId);
|
|
87163
87623
|
const name = schemaClass2?.name ?? "NeoVariant";
|
|
87164
87624
|
return `"${name}" (${classId})`;
|
|
87165
87625
|
}
|
|
@@ -87492,12 +87952,12 @@ function assertNoPersistedReadOnlySyntheticLookupId2(value, label) {
|
|
|
87492
87952
|
function isRecord7(value) {
|
|
87493
87953
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
87494
87954
|
}
|
|
87495
|
-
function abstractReadOnlyContractAncestor(member,
|
|
87955
|
+
function abstractReadOnlyContractAncestor(member, membersById2) {
|
|
87496
87956
|
const visited = /* @__PURE__ */ new Set([member.id]);
|
|
87497
87957
|
let ancestorId = member.extendsMemberId;
|
|
87498
87958
|
while (ancestorId !== void 0 && !visited.has(ancestorId)) {
|
|
87499
87959
|
visited.add(ancestorId);
|
|
87500
|
-
const ancestor =
|
|
87960
|
+
const ancestor = membersById2.get(ancestorId);
|
|
87501
87961
|
if (ancestor === void 0) return null;
|
|
87502
87962
|
if (ancestor.isAbstract === true && ancestor.isReadOnly === true) {
|
|
87503
87963
|
return ancestor;
|
|
@@ -87837,13 +88297,13 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
|
|
|
87837
88297
|
const members = view.members.map(readMember);
|
|
87838
88298
|
const classes = view.classes.map(readClass);
|
|
87839
88299
|
const interfaces = view.interfaces.map(readInterface);
|
|
87840
|
-
const
|
|
87841
|
-
const
|
|
88300
|
+
const membersById2 = new Map(members.map((member) => [member.id, member]));
|
|
88301
|
+
const classesById2 = new Map(
|
|
87842
88302
|
classes.map((schemaClass2) => [schemaClass2.id, schemaClass2])
|
|
87843
88303
|
);
|
|
87844
88304
|
for (const schemaClass2 of classes) {
|
|
87845
88305
|
if (schemaClass2.extendsClassId === void 0) continue;
|
|
87846
|
-
const baseClass =
|
|
88306
|
+
const baseClass = classesById2.get(schemaClass2.extendsClassId);
|
|
87847
88307
|
if (baseClass?.isSealed !== true) continue;
|
|
87848
88308
|
throw new Error(
|
|
87849
88309
|
`Class "${schemaClass2.name}" (${schemaClass2.id}) cannot extend sealed class "${baseClass.name}" (${baseClass.id}).`
|
|
@@ -87865,31 +88325,31 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
|
|
|
87865
88325
|
if (view.constructors !== void 0) {
|
|
87866
88326
|
assertOpaqueConstructorsValid(
|
|
87867
88327
|
view.constructors.map(readConstructor),
|
|
87868
|
-
|
|
88328
|
+
classesById2
|
|
87869
88329
|
);
|
|
87870
88330
|
}
|
|
87871
88331
|
assertNoVariantTypePositions({
|
|
87872
88332
|
members,
|
|
87873
|
-
classesById,
|
|
88333
|
+
classesById: classesById2,
|
|
87874
88334
|
constructors: view.constructors?.map(readConstructor),
|
|
87875
88335
|
interfaces
|
|
87876
88336
|
});
|
|
87877
|
-
assertNoAuthoredVariantMembers({ membersById, classesById });
|
|
88337
|
+
assertNoAuthoredVariantMembers({ membersById: membersById2, classesById: classesById2 });
|
|
87878
88338
|
if (view.variants !== void 0 || view.variantFolders !== void 0) {
|
|
87879
88339
|
assertOpaqueVariantsValid({
|
|
87880
88340
|
variants: (view.variants ?? []).map(readVariantRecord),
|
|
87881
88341
|
folders: (view.variantFolders ?? []).map(readVariantFolderRecord),
|
|
87882
|
-
classesById,
|
|
88342
|
+
classesById: classesById2,
|
|
87883
88343
|
objectWorldKind: NEO_OBJECT_WORLD_KIND,
|
|
87884
|
-
membersById,
|
|
88344
|
+
membersById: membersById2,
|
|
87885
88345
|
values: view.values
|
|
87886
88346
|
});
|
|
87887
88347
|
}
|
|
87888
88348
|
for (const member of members) {
|
|
87889
88349
|
assertOpaqueMemberDefaultValueValid(member);
|
|
87890
88350
|
assertOpaqueParameterDefaultsValid(member);
|
|
87891
|
-
assertOpaqueCallableOverrideValid(member,
|
|
87892
|
-
assertOpaqueNSFunctionValid(member,
|
|
88351
|
+
assertOpaqueCallableOverrideValid(member, membersById2);
|
|
88352
|
+
assertOpaqueNSFunctionValid(member, membersById2);
|
|
87893
88353
|
if (member.isAbstract === true && member.defaultValue != null) {
|
|
87894
88354
|
throw new Error(
|
|
87895
88355
|
`Abstract member "${member.name}" (${member.id}) cannot declare a default value. Concrete implementations own their values and defaults.`
|
|
@@ -87916,7 +88376,7 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
|
|
|
87916
88376
|
}
|
|
87917
88377
|
for (const member of members) {
|
|
87918
88378
|
if (member.entryMemberId === void 0) continue;
|
|
87919
|
-
const entry =
|
|
88379
|
+
const entry = membersById2.get(member.entryMemberId);
|
|
87920
88380
|
if (entry?.kind === 23) {
|
|
87921
88381
|
throw new Error(
|
|
87922
88382
|
`NSFunction "${entry.id}" cannot be a List or Dictionary entry member.`
|
|
@@ -87934,7 +88394,7 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
|
|
|
87934
88394
|
`Member "${memberId}" is placed under conflicting keys "${existing.key}" and "${key}".`
|
|
87935
88395
|
);
|
|
87936
88396
|
}
|
|
87937
|
-
const member =
|
|
88397
|
+
const member = membersById2.get(memberId);
|
|
87938
88398
|
if (member && member.name !== key) {
|
|
87939
88399
|
throw new Error(
|
|
87940
88400
|
`Member "${memberId}" name "${member.name}" must match schema key "${key}" on class "${schemaClass2.id}".`
|
|
@@ -87978,7 +88438,7 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
|
|
|
87978
88438
|
`Static member "${member.name}" (${member.id}) stores live content through valueId and cannot retain a schema defaultValue seed.`
|
|
87979
88439
|
);
|
|
87980
88440
|
}
|
|
87981
|
-
const owner =
|
|
88441
|
+
const owner = classesById2.get(placements[0].classId);
|
|
87982
88442
|
if ((owner?.genericParams?.length ?? 0) > 0) {
|
|
87983
88443
|
throw new Error(
|
|
87984
88444
|
`Static member "${member.name}" (${member.id}) cannot be declared on open generic class "${owner?.name}" (${owner?.id}).`
|
|
@@ -87997,7 +88457,7 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
|
|
|
87997
88457
|
}
|
|
87998
88458
|
for (const owner of members) {
|
|
87999
88459
|
if (owner.entryMemberId !== void 0) {
|
|
88000
|
-
const entry =
|
|
88460
|
+
const entry = membersById2.get(owner.entryMemberId);
|
|
88001
88461
|
if (entry?.isStatic === true) {
|
|
88002
88462
|
throw new Error(
|
|
88003
88463
|
`Static member "${entry.name}" (${entry.id}) cannot be a List or Dictionary entry template.`
|
|
@@ -88006,7 +88466,7 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
|
|
|
88006
88466
|
}
|
|
88007
88467
|
for (const binding of Object.values(owner.classArguments ?? {})) {
|
|
88008
88468
|
if (binding.kind !== "member") continue;
|
|
88009
|
-
const argument2 =
|
|
88469
|
+
const argument2 = membersById2.get(binding.memberId);
|
|
88010
88470
|
if (argument2?.isStatic !== true) continue;
|
|
88011
88471
|
throw new Error(
|
|
88012
88472
|
`Static member "${argument2.name}" (${argument2.id}) cannot be a constructed-type binding artifact.`
|
|
@@ -88018,7 +88478,7 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
|
|
|
88018
88478
|
schemaClass2.extendsGenericBindings ?? {}
|
|
88019
88479
|
)) {
|
|
88020
88480
|
if (binding.kind !== "member") continue;
|
|
88021
|
-
const argument2 =
|
|
88481
|
+
const argument2 = membersById2.get(binding.memberId);
|
|
88022
88482
|
if (argument2?.isStatic !== true) continue;
|
|
88023
88483
|
throw new Error(
|
|
88024
88484
|
`Static member "${argument2.name}" (${argument2.id}) cannot be a generic binding artifact.`
|
|
@@ -88060,7 +88520,7 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
|
|
|
88060
88520
|
result.push(neoInterface);
|
|
88061
88521
|
}
|
|
88062
88522
|
}
|
|
88063
|
-
current = current.extendsClassId ?
|
|
88523
|
+
current = current.extendsClassId ? classesById2.get(current.extendsClassId) : void 0;
|
|
88064
88524
|
}
|
|
88065
88525
|
return result;
|
|
88066
88526
|
};
|
|
@@ -88080,11 +88540,11 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
|
|
|
88080
88540
|
return invariantTypeInfo({ ...from, required: to.required }, to);
|
|
88081
88541
|
}
|
|
88082
88542
|
const seen = /* @__PURE__ */ new Set();
|
|
88083
|
-
let current =
|
|
88543
|
+
let current = classesById2.get(from.classId);
|
|
88084
88544
|
while (current && !seen.has(current.id)) {
|
|
88085
88545
|
if (current.id === to.classId) return true;
|
|
88086
88546
|
seen.add(current.id);
|
|
88087
|
-
current = current.extendsClassId ?
|
|
88547
|
+
current = current.extendsClassId ? classesById2.get(current.extendsClassId) : void 0;
|
|
88088
88548
|
}
|
|
88089
88549
|
return false;
|
|
88090
88550
|
}
|
|
@@ -88092,7 +88552,7 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
|
|
|
88092
88552
|
if (typeof from.classId !== "string" || typeof to.interfaceId !== "string") {
|
|
88093
88553
|
return false;
|
|
88094
88554
|
}
|
|
88095
|
-
const schemaClass2 =
|
|
88555
|
+
const schemaClass2 = classesById2.get(from.classId);
|
|
88096
88556
|
return schemaClass2 ? implementedClosure(schemaClass2).some(
|
|
88097
88557
|
(neoInterface) => neoInterface.id === to.interfaceId
|
|
88098
88558
|
) : false;
|
|
@@ -88194,7 +88654,7 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
|
|
|
88194
88654
|
while (current && !seen.has(current.id)) {
|
|
88195
88655
|
seen.add(current.id);
|
|
88196
88656
|
chain.push(current);
|
|
88197
|
-
current = current.extendsClassId ?
|
|
88657
|
+
current = current.extendsClassId ? classesById2.get(current.extendsClassId) : void 0;
|
|
88198
88658
|
}
|
|
88199
88659
|
return Object.assign({}, ...chain.reverse().map((entry) => entry.schema));
|
|
88200
88660
|
};
|
|
@@ -88203,31 +88663,31 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
|
|
|
88203
88663
|
schemaClass2.schema
|
|
88204
88664
|
)) {
|
|
88205
88665
|
const seen = /* @__PURE__ */ new Set();
|
|
88206
|
-
let ancestor = schemaClass2.extendsClassId ?
|
|
88666
|
+
let ancestor = schemaClass2.extendsClassId ? classesById2.get(schemaClass2.extendsClassId) : void 0;
|
|
88207
88667
|
while (ancestor && !seen.has(ancestor.id)) {
|
|
88208
88668
|
seen.add(ancestor.id);
|
|
88209
88669
|
const inheritedMemberId2 = ancestor.schema[schemaKey];
|
|
88210
88670
|
if (inheritedMemberId2 !== void 0) {
|
|
88211
|
-
if (
|
|
88671
|
+
if (membersById2.get(localMemberId)?.isStatic === true || membersById2.get(inheritedMemberId2)?.isStatic === true) {
|
|
88212
88672
|
throw new Error(
|
|
88213
88673
|
`Class "${schemaClass2.name}" cannot redeclare inherited member "${schemaKey}" because static and instance members cannot hide one another.`
|
|
88214
88674
|
);
|
|
88215
88675
|
}
|
|
88216
88676
|
break;
|
|
88217
88677
|
}
|
|
88218
|
-
ancestor = ancestor.extendsClassId ?
|
|
88678
|
+
ancestor = ancestor.extendsClassId ? classesById2.get(ancestor.extendsClassId) : void 0;
|
|
88219
88679
|
}
|
|
88220
88680
|
}
|
|
88221
88681
|
}
|
|
88222
88682
|
for (const list of members) {
|
|
88223
88683
|
if (list.kind !== 6 || !Array.isArray(list.indexes)) continue;
|
|
88224
|
-
const entry = typeof list.entryMemberId === "string" ?
|
|
88225
|
-
const entryType = entry?.kind === 7 && typeof entry.classId === "string" ?
|
|
88684
|
+
const entry = typeof list.entryMemberId === "string" ? membersById2.get(list.entryMemberId) : void 0;
|
|
88685
|
+
const entryType = entry?.kind === 7 && typeof entry.classId === "string" ? classesById2.get(entry.classId) : void 0;
|
|
88226
88686
|
if (entryType === void 0) continue;
|
|
88227
88687
|
const schema = mergedSchema(entryType);
|
|
88228
88688
|
for (const index of list.indexes) {
|
|
88229
88689
|
const indexedMemberId = schema[index.schemaKey];
|
|
88230
|
-
if (indexedMemberId === void 0 ||
|
|
88690
|
+
if (indexedMemberId === void 0 || membersById2.get(indexedMemberId)?.isStatic !== true) {
|
|
88231
88691
|
continue;
|
|
88232
88692
|
}
|
|
88233
88693
|
throw new Error(
|
|
@@ -88248,7 +88708,7 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
|
|
|
88248
88708
|
seen.add(current.id);
|
|
88249
88709
|
chain.push(current);
|
|
88250
88710
|
if (!current.extendsMemberId) break;
|
|
88251
|
-
current =
|
|
88711
|
+
current = membersById2.get(current.extendsMemberId);
|
|
88252
88712
|
if (!current) {
|
|
88253
88713
|
const leaf = chain[chain.length - 1];
|
|
88254
88714
|
if (leaf === void 0) {
|
|
@@ -88299,7 +88759,7 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
|
|
|
88299
88759
|
);
|
|
88300
88760
|
}
|
|
88301
88761
|
const ownerContext = placements.map((placement) => {
|
|
88302
|
-
const owner =
|
|
88762
|
+
const owner = classesById2.get(placement.classId);
|
|
88303
88763
|
return owner === void 0 ? `missing class "${placement.classId}"` : `"${owner.name}" (${owner.id})`;
|
|
88304
88764
|
}).join(", ");
|
|
88305
88765
|
const ownerLabel = placements.length === 1 ? `owning class ${ownerContext}` : `owning classes ${ownerContext}`;
|
|
@@ -88370,7 +88830,7 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
|
|
|
88370
88830
|
`Read-only member "${member.name}" has an owned Generic member "${inherited.name}" whose parameter "${owned.genericParamId}" is not closed by its default placement; ${ownerLabel}.`
|
|
88371
88831
|
);
|
|
88372
88832
|
}
|
|
88373
|
-
const binding =
|
|
88833
|
+
const binding = membersById2.get(bindingId);
|
|
88374
88834
|
if (binding === void 0) {
|
|
88375
88835
|
throw new Error(
|
|
88376
88836
|
`Read-only member "${member.name}" has an owned Generic member "${inherited.name}" bound to missing member "${bindingId}"; ${ownerLabel}.`
|
|
@@ -88418,7 +88878,7 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
|
|
|
88418
88878
|
`Read-only member "${member.name}" has an owned collection "${owned.name}" without an entry member; ${ownerLabel}.`
|
|
88419
88879
|
);
|
|
88420
88880
|
}
|
|
88421
|
-
const entry =
|
|
88881
|
+
const entry = membersById2.get(owned.entryMemberId);
|
|
88422
88882
|
if (entry === void 0) {
|
|
88423
88883
|
throw new Error(
|
|
88424
88884
|
`Read-only member "${member.name}" has an owned collection entry "${owned.entryMemberId}" that does not exist; ${ownerLabel}.`
|
|
@@ -88430,7 +88890,7 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
|
|
|
88430
88890
|
if (owned.kind !== 7 || typeof owned.classId !== "string") return;
|
|
88431
88891
|
const defaultValue = isRecord7(owned.defaultValue) ? owned.defaultValue : null;
|
|
88432
88892
|
const effectiveClassId = typeof defaultValue?.classId === "string" ? defaultValue.classId : owned.classId;
|
|
88433
|
-
const ownedClass =
|
|
88893
|
+
const ownedClass = classesById2.get(effectiveClassId);
|
|
88434
88894
|
if (ownedClass === void 0) {
|
|
88435
88895
|
throw new Error(
|
|
88436
88896
|
`Read-only member "${member.name}" has an owned Class member "${owned.name}" targeting missing class "${effectiveClassId}"; ${ownerLabel}.`
|
|
@@ -88463,7 +88923,7 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
|
|
|
88463
88923
|
);
|
|
88464
88924
|
}
|
|
88465
88925
|
for (const nestedMemberId of Object.values(mergedSchema(ownedClass))) {
|
|
88466
|
-
const nested =
|
|
88926
|
+
const nested = membersById2.get(nestedMemberId);
|
|
88467
88927
|
if (nested === void 0) {
|
|
88468
88928
|
throw new Error(
|
|
88469
88929
|
`Read-only member "${member.name}" has an owned class schema member "${nestedMemberId}" that does not exist; ${ownerLabel}.`
|
|
@@ -88473,7 +88933,7 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
|
|
|
88473
88933
|
}
|
|
88474
88934
|
};
|
|
88475
88935
|
for (const placement of placements) {
|
|
88476
|
-
const placementClass =
|
|
88936
|
+
const placementClass = classesById2.get(placement.classId);
|
|
88477
88937
|
if (placementClass === void 0) {
|
|
88478
88938
|
throw new Error(
|
|
88479
88939
|
`Read-only member "${member.name}" has a placement in missing class "${placement.classId}".`
|
|
@@ -88488,7 +88948,7 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
|
|
|
88488
88948
|
}
|
|
88489
88949
|
for (const member of members) {
|
|
88490
88950
|
if (member.extendsMemberId === void 0) continue;
|
|
88491
|
-
const contract = abstractReadOnlyContractAncestor(member,
|
|
88951
|
+
const contract = abstractReadOnlyContractAncestor(member, membersById2);
|
|
88492
88952
|
if (contract === null || member.isReadOnly === true) continue;
|
|
88493
88953
|
throw new Error(
|
|
88494
88954
|
`Member "${member.name}" (${member.id}) must remain read-only because it implements abstract read-only member "${contract.name}" (${contract.id}).`
|
|
@@ -88504,7 +88964,7 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
|
|
|
88504
88964
|
for (const [schemaKey, memberId] of Object.entries(current.schema)) {
|
|
88505
88965
|
if (effectiveKeys.has(schemaKey)) continue;
|
|
88506
88966
|
effectiveKeys.add(schemaKey);
|
|
88507
|
-
const effectiveMember =
|
|
88967
|
+
const effectiveMember = membersById2.get(memberId);
|
|
88508
88968
|
if (effectiveMember?.isAbstract !== true || effectiveMember.isReadOnly !== true) {
|
|
88509
88969
|
continue;
|
|
88510
88970
|
}
|
|
@@ -88512,7 +88972,7 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
|
|
|
88512
88972
|
`Concrete class "${schemaClass2.name}" (${schemaClass2.id}) must implement abstract read-only member "${schemaKey}" with a read-only override.`
|
|
88513
88973
|
);
|
|
88514
88974
|
}
|
|
88515
|
-
current = current.extendsClassId === void 0 ? void 0 :
|
|
88975
|
+
current = current.extendsClassId === void 0 ? void 0 : classesById2.get(current.extendsClassId);
|
|
88516
88976
|
}
|
|
88517
88977
|
}
|
|
88518
88978
|
const values = (view.values ?? []).filter(isRecord7);
|
|
@@ -88534,7 +88994,7 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
|
|
|
88534
88994
|
const inspectChild = (memberId, valueId) => {
|
|
88535
88995
|
if (typeof valueId !== "string" || visitedValueIds.has(valueId)) return;
|
|
88536
88996
|
const childValue = valuesById.get(valueId);
|
|
88537
|
-
const childMember =
|
|
88997
|
+
const childMember = membersById2.get(memberId);
|
|
88538
88998
|
if (childValue === void 0 || childMember === void 0) return;
|
|
88539
88999
|
visitedValueIds.add(valueId);
|
|
88540
89000
|
inspectValueBody(
|
|
@@ -88569,12 +89029,12 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
|
|
|
88569
89029
|
if (inspectedMember.kind !== 7 || !isRecord7(body)) return;
|
|
88570
89030
|
const effectiveClassId = classId ?? inspectedMember.classId;
|
|
88571
89031
|
if (typeof effectiveClassId !== "string") return;
|
|
88572
|
-
const schemaClass2 =
|
|
89032
|
+
const schemaClass2 = classesById2.get(effectiveClassId);
|
|
88573
89033
|
if (schemaClass2 === void 0) return;
|
|
88574
89034
|
for (const [schemaKey, childMemberId] of Object.entries(
|
|
88575
89035
|
mergedSchema(schemaClass2)
|
|
88576
89036
|
)) {
|
|
88577
|
-
if (options.validateReadOnlyValueShapes !== false &&
|
|
89037
|
+
if (options.validateReadOnlyValueShapes !== false && membersById2.get(childMemberId)?.isReadOnly === true) {
|
|
88578
89038
|
if (body[schemaKey] !== void 0) {
|
|
88579
89039
|
throw new Error(
|
|
88580
89040
|
`Class value for "${effectiveClassId}" contains read-only declaration member "${schemaKey}"; a read-only declaration member cannot have an instance value.`
|
|
@@ -88607,7 +89067,7 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
|
|
|
88607
89067
|
}
|
|
88608
89068
|
}
|
|
88609
89069
|
for (const placed of view.placedValues ?? []) {
|
|
88610
|
-
const member =
|
|
89070
|
+
const member = membersById2.get(placed.memberId);
|
|
88611
89071
|
if (member === void 0) {
|
|
88612
89072
|
throw new Error(
|
|
88613
89073
|
`Placed value "${placed.valueId}" references missing member "${placed.memberId}".`
|
|
@@ -88636,7 +89096,7 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
|
|
|
88636
89096
|
while (current && !seen.has(current.id)) {
|
|
88637
89097
|
seen.add(current.id);
|
|
88638
89098
|
chain.push(current);
|
|
88639
|
-
current = current.extendsClassId ?
|
|
89099
|
+
current = current.extendsClassId ? classesById2.get(current.extendsClassId) : void 0;
|
|
88640
89100
|
}
|
|
88641
89101
|
const env = /* @__PURE__ */ new Map();
|
|
88642
89102
|
for (let declarerIndex = 0; declarerIndex < chain.length; declarerIndex += 1) {
|
|
@@ -88663,7 +89123,7 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
|
|
|
88663
89123
|
const env = genericEnvForClass(schemaClass2);
|
|
88664
89124
|
if (resolved.kind === 21 && typeof resolved.genericParamId === "string") {
|
|
88665
89125
|
const bindingId = env.get(resolved.genericParamId);
|
|
88666
|
-
const binding = bindingId ?
|
|
89126
|
+
const binding = bindingId ? membersById2.get(bindingId) : void 0;
|
|
88667
89127
|
if (!binding) return resolved;
|
|
88668
89128
|
const substituted = {
|
|
88669
89129
|
...resolveMember3(binding),
|
|
@@ -88703,7 +89163,7 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
|
|
|
88703
89163
|
resolved.classArguments ?? {}
|
|
88704
89164
|
)) {
|
|
88705
89165
|
if (binding.kind !== "member") return null;
|
|
88706
|
-
const bindingMember =
|
|
89166
|
+
const bindingMember = membersById2.get(binding.memberId);
|
|
88707
89167
|
if (!bindingMember) return null;
|
|
88708
89168
|
const bindingTypeInfo = memberTypeInfo(
|
|
88709
89169
|
bindingMember,
|
|
@@ -88725,7 +89185,7 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
|
|
|
88725
89185
|
}
|
|
88726
89186
|
if (resolved.kind === 5 || resolved.kind === 6) {
|
|
88727
89187
|
if (typeof resolved.entryMemberId !== "string") return null;
|
|
88728
|
-
const entry =
|
|
89188
|
+
const entry = membersById2.get(resolved.entryMemberId);
|
|
88729
89189
|
if (!entry) return null;
|
|
88730
89190
|
const entryTypeInfo = memberTypeInfo(entry, schemaClass2, nextVisiting);
|
|
88731
89191
|
if (!entryTypeInfo) return null;
|
|
@@ -88738,7 +89198,7 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
|
|
|
88738
89198
|
}
|
|
88739
89199
|
if (resolved.kind === 9) {
|
|
88740
89200
|
if (typeof resolved.collectionMemberId !== "string") return null;
|
|
88741
|
-
const collection =
|
|
89201
|
+
const collection = membersById2.get(resolved.collectionMemberId);
|
|
88742
89202
|
if (!collection) return null;
|
|
88743
89203
|
const collectionTypeInfo = memberTypeInfo(
|
|
88744
89204
|
collection,
|
|
@@ -88826,7 +89286,7 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
|
|
|
88826
89286
|
const bindingId = genericEnvForClass(schemaClass2).get(
|
|
88827
89287
|
typeInfo.genericParamId
|
|
88828
89288
|
);
|
|
88829
|
-
const binding = bindingId ?
|
|
89289
|
+
const binding = bindingId ? membersById2.get(bindingId) : void 0;
|
|
88830
89290
|
return binding ? memberTypeInfo(binding, schemaClass2) ?? typeInfo : typeInfo;
|
|
88831
89291
|
}
|
|
88832
89292
|
if ((typeInfo.type === 5 || typeInfo.type === 6 || typeInfo.type === 9) && typeInfo.entryTypeInfo !== void 0) {
|
|
@@ -88857,7 +89317,7 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
|
|
|
88857
89317
|
while (current && !seen.has(current.id)) {
|
|
88858
89318
|
seen.add(current.id);
|
|
88859
89319
|
if (current.allowedStorage != null) return current.allowedStorage;
|
|
88860
|
-
current = current.extendsClassId ?
|
|
89320
|
+
current = current.extendsClassId ? classesById2.get(current.extendsClassId) : void 0;
|
|
88861
89321
|
}
|
|
88862
89322
|
return null;
|
|
88863
89323
|
};
|
|
@@ -88922,7 +89382,7 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
|
|
|
88922
89382
|
);
|
|
88923
89383
|
}
|
|
88924
89384
|
if (!canonical || memberId === void 0) continue;
|
|
88925
|
-
const member =
|
|
89385
|
+
const member = membersById2.get(memberId);
|
|
88926
89386
|
if (!member) continue;
|
|
88927
89387
|
if (member.isStatic) {
|
|
88928
89388
|
throw new Error(
|
|
@@ -88956,7 +89416,7 @@ function assertProjectInterfaceDocumentValid(view, options = {}) {
|
|
|
88956
89416
|
}
|
|
88957
89417
|
}
|
|
88958
89418
|
}
|
|
88959
|
-
function assertOpaqueCallableOverrideValid(member,
|
|
89419
|
+
function assertOpaqueCallableOverrideValid(member, membersById2) {
|
|
88960
89420
|
const parentId = member.extendsMemberId;
|
|
88961
89421
|
if (typeof parentId !== "string") return;
|
|
88962
89422
|
const childIsCallable = member.kind === 13 || member.kind === 23;
|
|
@@ -88987,7 +89447,7 @@ function assertOpaqueCallableOverrideValid(member, membersById) {
|
|
|
88987
89447
|
);
|
|
88988
89448
|
}
|
|
88989
89449
|
}
|
|
88990
|
-
const parent =
|
|
89450
|
+
const parent = membersById2.get(parentId);
|
|
88991
89451
|
if (parent === void 0) {
|
|
88992
89452
|
if (childIsCallable) {
|
|
88993
89453
|
throw new Error(
|
|
@@ -89003,7 +89463,7 @@ function assertOpaqueCallableOverrideValid(member, membersById) {
|
|
|
89003
89463
|
);
|
|
89004
89464
|
}
|
|
89005
89465
|
}
|
|
89006
|
-
function resolveOpaqueNSFunctionSignature(member,
|
|
89466
|
+
function resolveOpaqueNSFunctionSignature(member, membersById2) {
|
|
89007
89467
|
const seen = /* @__PURE__ */ new Set();
|
|
89008
89468
|
let cursor = member;
|
|
89009
89469
|
while (cursor !== void 0) {
|
|
@@ -89023,7 +89483,7 @@ function resolveOpaqueNSFunctionSignature(member, membersById) {
|
|
|
89023
89483
|
}
|
|
89024
89484
|
const parentId = cursor.extendsMemberId;
|
|
89025
89485
|
if (typeof parentId !== "string") return null;
|
|
89026
|
-
cursor =
|
|
89486
|
+
cursor = membersById2.get(parentId);
|
|
89027
89487
|
}
|
|
89028
89488
|
return null;
|
|
89029
89489
|
}
|
|
@@ -89360,7 +89820,7 @@ function assertOpaqueRequiredConstructorValid(schemaClass2, constructorsById) {
|
|
|
89360
89820
|
);
|
|
89361
89821
|
}
|
|
89362
89822
|
}
|
|
89363
|
-
function assertOpaqueConstructorsValid(constructors,
|
|
89823
|
+
function assertOpaqueConstructorsValid(constructors, classesById2) {
|
|
89364
89824
|
const constructorsByClassId = /* @__PURE__ */ new Map();
|
|
89365
89825
|
const constructorsById = /* @__PURE__ */ new Map();
|
|
89366
89826
|
for (const declaredConstructor of constructors) {
|
|
@@ -89372,7 +89832,7 @@ function assertOpaqueConstructorsValid(constructors, classesById) {
|
|
|
89372
89832
|
constructorsById.set(declaredConstructor.id, declaredConstructor);
|
|
89373
89833
|
const argumentTypes = assertOpaqueConstructorValid(declaredConstructor);
|
|
89374
89834
|
void argumentTypes;
|
|
89375
|
-
const owner =
|
|
89835
|
+
const owner = classesById2.get(declaredConstructor.classId);
|
|
89376
89836
|
if (owner === void 0) {
|
|
89377
89837
|
throw new Error(
|
|
89378
89838
|
`Constructor "${declaredConstructor.id}" references missing class "${declaredConstructor.classId}".`
|
|
@@ -89395,7 +89855,7 @@ function assertOpaqueConstructorsValid(constructors, classesById) {
|
|
|
89395
89855
|
siblings.push(declaredConstructor);
|
|
89396
89856
|
constructorsByClassId.set(declaredConstructor.classId, siblings);
|
|
89397
89857
|
}
|
|
89398
|
-
for (const schemaClass2 of
|
|
89858
|
+
for (const schemaClass2 of classesById2.values()) {
|
|
89399
89859
|
assertOpaqueRequiredConstructorValid(schemaClass2, constructorsById);
|
|
89400
89860
|
const declared = schemaClass2.constructorIds;
|
|
89401
89861
|
if (declared === void 0 || declared === null) continue;
|
|
@@ -89508,7 +89968,7 @@ function assertOpaqueMemberDefaultValueValid(member) {
|
|
|
89508
89968
|
);
|
|
89509
89969
|
}
|
|
89510
89970
|
}
|
|
89511
|
-
function assertOpaqueNSFunctionValid(member,
|
|
89971
|
+
function assertOpaqueNSFunctionValid(member, membersById2) {
|
|
89512
89972
|
if (member.kind !== 23) return;
|
|
89513
89973
|
if (!isOpaqueCallableMemberIdentifier(member.name)) {
|
|
89514
89974
|
throw new Error(`NSFunction "${member.id}" name is invalid.`);
|
|
@@ -89581,7 +90041,7 @@ function assertOpaqueNSFunctionValid(member, membersById) {
|
|
|
89581
90041
|
);
|
|
89582
90042
|
}
|
|
89583
90043
|
if (member.action !== void 0) {
|
|
89584
|
-
const signature = resolveOpaqueNSFunctionSignature(member,
|
|
90044
|
+
const signature = resolveOpaqueNSFunctionSignature(member, membersById2);
|
|
89585
90045
|
if (signature === null) {
|
|
89586
90046
|
throw new Error(
|
|
89587
90047
|
`NSFunction override "${member.id}" has no valid inherited signature.`
|
|
@@ -89879,8 +90339,8 @@ var init_project_document_value_overlay = __esm({
|
|
|
89879
90339
|
// ../src/database/member-access-modifier-validation.ts
|
|
89880
90340
|
function validateDocumentAccessModifiers(ctx) {
|
|
89881
90341
|
const errors = [];
|
|
89882
|
-
const
|
|
89883
|
-
const
|
|
90342
|
+
const membersById2 = new Map(ctx.members.map((member) => [member.id, member]));
|
|
90343
|
+
const classesById2 = new Map(
|
|
89884
90344
|
ctx.classes.map((schemaClass2) => [schemaClass2.id, schemaClass2])
|
|
89885
90345
|
);
|
|
89886
90346
|
const placementsByMemberId = indexSchemaPlacements(ctx.classes);
|
|
@@ -89918,13 +90378,13 @@ function validateDocumentAccessModifiers(ctx) {
|
|
|
89918
90378
|
}
|
|
89919
90379
|
const parentId = member.extendsMemberId;
|
|
89920
90380
|
if (parentId !== void 0) {
|
|
89921
|
-
const root = resolveChainRoot(member,
|
|
90381
|
+
const root = resolveChainRoot(member, membersById2);
|
|
89922
90382
|
if (root !== null && isMemberAccessModifierKind(root.accessModifierKind) && member.accessModifierKind !== root.accessModifierKind) {
|
|
89923
90383
|
errors.push({
|
|
89924
90384
|
message: `Override member "${member.name}" (${member.id}) is ${member.accessModifierKind} but its root declaration "${root.name}" (${root.id}) is ${root.accessModifierKind}. Access modifiers change only on the root declaration and cascade to every override.`
|
|
89925
90385
|
});
|
|
89926
90386
|
}
|
|
89927
|
-
const parent =
|
|
90387
|
+
const parent = membersById2.get(parentId);
|
|
89928
90388
|
if (parent !== void 0 && parent.accessModifierKind === "private") {
|
|
89929
90389
|
errors.push({
|
|
89930
90390
|
message: `Member "${member.name}" (${member.id}) cannot override private member "${parent.name}" (${parent.id}).`
|
|
@@ -89934,8 +90394,8 @@ function validateDocumentAccessModifiers(ctx) {
|
|
|
89934
90394
|
if (isMemberLookupBase(member)) {
|
|
89935
90395
|
validateLookupTargetAccess({
|
|
89936
90396
|
lookup: member,
|
|
89937
|
-
membersById,
|
|
89938
|
-
classesById,
|
|
90397
|
+
membersById: membersById2,
|
|
90398
|
+
classesById: classesById2,
|
|
89939
90399
|
placementsByMemberId,
|
|
89940
90400
|
errors
|
|
89941
90401
|
});
|
|
@@ -89947,12 +90407,12 @@ function validateDocumentAccessModifiers(ctx) {
|
|
|
89947
90407
|
const ancestor = nearestAncestorDeclaration(
|
|
89948
90408
|
schemaClass2,
|
|
89949
90409
|
schemaKey,
|
|
89950
|
-
|
|
90410
|
+
classesById2
|
|
89951
90411
|
);
|
|
89952
90412
|
if (ancestor === null) continue;
|
|
89953
90413
|
const ancestorMemberId = ancestor.schema[schemaKey];
|
|
89954
90414
|
if (typeof ancestorMemberId !== "string") continue;
|
|
89955
|
-
const ancestorMember =
|
|
90415
|
+
const ancestorMember = membersById2.get(ancestorMemberId);
|
|
89956
90416
|
if (ancestorMember === void 0) continue;
|
|
89957
90417
|
if (!isMemberAccessModifierKind(ancestorMember.accessModifierKind)) {
|
|
89958
90418
|
continue;
|
|
@@ -89962,7 +90422,7 @@ function validateDocumentAccessModifiers(ctx) {
|
|
|
89962
90422
|
message: `Class "${schemaClass2.name}" (${schemaClass2.id}) cannot redeclare inherited schema key "${schemaKey}" because member "${ancestorMember.name}" (${ancestorMember.id}) on class "${ancestor.name}" (${ancestor.id}) is private.`
|
|
89963
90423
|
});
|
|
89964
90424
|
}
|
|
89965
|
-
const localMember =
|
|
90425
|
+
const localMember = membersById2.get(memberId);
|
|
89966
90426
|
if (localMember === void 0) continue;
|
|
89967
90427
|
if (localMember.extendsMemberId !== void 0) continue;
|
|
89968
90428
|
if (!isMemberAccessModifierKind(localMember.accessModifierKind)) continue;
|
|
@@ -89976,7 +90436,7 @@ function validateDocumentAccessModifiers(ctx) {
|
|
|
89976
90436
|
for (const schemaClass2 of ctx.classes) {
|
|
89977
90437
|
validateClassTargetMemberAccess({
|
|
89978
90438
|
schemaClass: schemaClass2,
|
|
89979
|
-
membersById,
|
|
90439
|
+
membersById: membersById2,
|
|
89980
90440
|
errors
|
|
89981
90441
|
});
|
|
89982
90442
|
}
|
|
@@ -89984,7 +90444,7 @@ function validateDocumentAccessModifiers(ctx) {
|
|
|
89984
90444
|
validateDialogueRecordMemberReferences({
|
|
89985
90445
|
record: dialogue,
|
|
89986
90446
|
recordLabel: describeDialogueRecord(dialogue, "Dialogue"),
|
|
89987
|
-
membersById,
|
|
90447
|
+
membersById: membersById2,
|
|
89988
90448
|
errors
|
|
89989
90449
|
});
|
|
89990
90450
|
}
|
|
@@ -89992,7 +90452,7 @@ function validateDocumentAccessModifiers(ctx) {
|
|
|
89992
90452
|
validateDialogueRecordMemberReferences({
|
|
89993
90453
|
record: dialogueGroup,
|
|
89994
90454
|
recordLabel: describeDialogueRecord(dialogueGroup, "Dialogue group"),
|
|
89995
|
-
membersById,
|
|
90455
|
+
membersById: membersById2,
|
|
89996
90456
|
errors
|
|
89997
90457
|
});
|
|
89998
90458
|
}
|
|
@@ -90078,24 +90538,24 @@ function validateLookupTargetAccess(args) {
|
|
|
90078
90538
|
});
|
|
90079
90539
|
}
|
|
90080
90540
|
}
|
|
90081
|
-
function isClassOrDescendant(classId, ancestorClassId,
|
|
90541
|
+
function isClassOrDescendant(classId, ancestorClassId, classesById2) {
|
|
90082
90542
|
const seen = /* @__PURE__ */ new Set();
|
|
90083
90543
|
let cursor = classId;
|
|
90084
90544
|
while (cursor !== void 0 && !seen.has(cursor)) {
|
|
90085
90545
|
if (cursor === ancestorClassId) return true;
|
|
90086
90546
|
seen.add(cursor);
|
|
90087
|
-
cursor =
|
|
90547
|
+
cursor = classesById2.get(cursor)?.extendsClassId;
|
|
90088
90548
|
}
|
|
90089
90549
|
return false;
|
|
90090
90550
|
}
|
|
90091
|
-
function resolveChainRoot(member,
|
|
90551
|
+
function resolveChainRoot(member, membersById2) {
|
|
90092
90552
|
const seen = /* @__PURE__ */ new Set();
|
|
90093
90553
|
let cursor = member;
|
|
90094
90554
|
while (cursor !== void 0) {
|
|
90095
90555
|
if (seen.has(cursor.id)) return null;
|
|
90096
90556
|
seen.add(cursor.id);
|
|
90097
90557
|
if (cursor.extendsMemberId === void 0) return cursor;
|
|
90098
|
-
cursor =
|
|
90558
|
+
cursor = membersById2.get(cursor.extendsMemberId);
|
|
90099
90559
|
}
|
|
90100
90560
|
return null;
|
|
90101
90561
|
}
|
|
@@ -90156,13 +90616,13 @@ function indexNonSchemaPlacements(ctx) {
|
|
|
90156
90616
|
}
|
|
90157
90617
|
return placements;
|
|
90158
90618
|
}
|
|
90159
|
-
function nearestAncestorDeclaration(schemaClass2, schemaKey,
|
|
90619
|
+
function nearestAncestorDeclaration(schemaClass2, schemaKey, classesById2) {
|
|
90160
90620
|
const visited = /* @__PURE__ */ new Set([schemaClass2.id]);
|
|
90161
90621
|
let ancestorId = schemaClass2.extendsClassId;
|
|
90162
90622
|
while (ancestorId !== void 0) {
|
|
90163
90623
|
if (visited.has(ancestorId)) return null;
|
|
90164
90624
|
visited.add(ancestorId);
|
|
90165
|
-
const ancestor =
|
|
90625
|
+
const ancestor = classesById2.get(ancestorId);
|
|
90166
90626
|
if (ancestor === void 0) return null;
|
|
90167
90627
|
if (typeof ancestor.schema[schemaKey] === "string") return ancestor;
|
|
90168
90628
|
ancestorId = ancestor.extendsClassId;
|
|
@@ -91389,7 +91849,7 @@ var init_project_version_transaction_types = __esm({
|
|
|
91389
91849
|
|
|
91390
91850
|
// ../src/database/project-version-relation-sweep-trigger.ts
|
|
91391
91851
|
function stagedChangesAffectClassRelations(current, changes) {
|
|
91392
|
-
const
|
|
91852
|
+
const classesById2 = new Map(
|
|
91393
91853
|
(current.classes ?? []).map((schemaClass2) => [schemaClass2.id, schemaClass2])
|
|
91394
91854
|
);
|
|
91395
91855
|
const valuesById = new Map(
|
|
@@ -91400,7 +91860,7 @@ function stagedChangesAffectClassRelations(current, changes) {
|
|
|
91400
91860
|
if (change.recordKind === "class") {
|
|
91401
91861
|
if (change.operation !== "update") return true;
|
|
91402
91862
|
if (change.deleted === true) return true;
|
|
91403
|
-
const before2 =
|
|
91863
|
+
const before2 = classesById2.get(change.recordId);
|
|
91404
91864
|
if (before2 === void 0) return true;
|
|
91405
91865
|
const after = change.nextData;
|
|
91406
91866
|
if (!isPlainRecord(after)) return true;
|
|
@@ -92581,7 +93041,7 @@ function materializeLocalizableStringWriteChanges(args) {
|
|
|
92581
93041
|
owners
|
|
92582
93042
|
});
|
|
92583
93043
|
if (unresolvedRootIds.length > 0) {
|
|
92584
|
-
const
|
|
93044
|
+
const membersById2 = new Map(
|
|
92585
93045
|
args.postDocument.members.map((member) => [member.id, member])
|
|
92586
93046
|
);
|
|
92587
93047
|
const additionalRoots = [];
|
|
@@ -92591,7 +93051,7 @@ function materializeLocalizableStringWriteChanges(args) {
|
|
|
92591
93051
|
);
|
|
92592
93052
|
const memberId = changeMemberId(change);
|
|
92593
93053
|
if (memberId === null) continue;
|
|
92594
|
-
const member =
|
|
93054
|
+
const member = membersById2.get(memberId);
|
|
92595
93055
|
if (member === void 0) continue;
|
|
92596
93056
|
additionalRoots.push({ member, valueId: rootId });
|
|
92597
93057
|
}
|
|
@@ -93858,7 +94318,7 @@ function remapReadOnlyConversionValueIds(values, memberId, ownerValueId) {
|
|
|
93858
94318
|
}
|
|
93859
94319
|
}
|
|
93860
94320
|
function collectReadOnlyClassValueSites(document, selectedMemberId) {
|
|
93861
|
-
const
|
|
94321
|
+
const membersById2 = new Map(
|
|
93862
94322
|
document.members.map((member) => [member.id, member])
|
|
93863
94323
|
);
|
|
93864
94324
|
const valuesById = new Map(document.values.map((value) => [value.id, value]));
|
|
@@ -93873,7 +94333,7 @@ function collectReadOnlyClassValueSites(document, selectedMemberId) {
|
|
|
93873
94333
|
if (value === void 0) return;
|
|
93874
94334
|
const member = resolveMember2(rawMember, document.members);
|
|
93875
94335
|
if (isMemberListBase(member) || isMemberDictionaryBase(member)) {
|
|
93876
|
-
const entry =
|
|
94336
|
+
const entry = membersById2.get(member.entryMemberId);
|
|
93877
94337
|
if (entry === void 0) return;
|
|
93878
94338
|
const childIds = isMemberListBase(member) && listKindOf(member) === "unordered" ? document.values.filter((child) => child.containerId === value.id).map((child) => child.id) : Array.isArray(value.value) ? value.value : isStringValueRecord(value.value) ? Object.values(value.value) : [];
|
|
93879
94339
|
for (const childId of childIds) visit(entry, childId);
|
|
@@ -93906,7 +94366,7 @@ function collectReadOnlyClassValueSites(document, selectedMemberId) {
|
|
|
93906
94366
|
}
|
|
93907
94367
|
}
|
|
93908
94368
|
const childId = value.value[entry.schemaKey];
|
|
93909
|
-
const childMember =
|
|
94369
|
+
const childMember = membersById2.get(entry.memberId);
|
|
93910
94370
|
if (childMember === void 0 || typeof childId !== "string") continue;
|
|
93911
94371
|
visit(
|
|
93912
94372
|
substituteMember(childMember, env, document.members),
|
|
@@ -93934,7 +94394,7 @@ function collectReadOnlyClassValueSites(document, selectedMemberId) {
|
|
|
93934
94394
|
return sites.filter((site) => !site.value.id.startsWith("__default:"));
|
|
93935
94395
|
}
|
|
93936
94396
|
function collectValuesReachableWithoutReadOnlyBinding(document, excludedMemberId) {
|
|
93937
|
-
const
|
|
94397
|
+
const membersById2 = new Map(
|
|
93938
94398
|
document.members.map((member) => [member.id, member])
|
|
93939
94399
|
);
|
|
93940
94400
|
const valuesById = new Map(document.values.map((value) => [value.id, value]));
|
|
@@ -93950,7 +94410,7 @@ function collectValuesReachableWithoutReadOnlyBinding(document, excludedMemberId
|
|
|
93950
94410
|
visitBody(childMember, child.value, child.classId ?? void 0, child.id);
|
|
93951
94411
|
};
|
|
93952
94412
|
if (isMemberListBase(member)) {
|
|
93953
|
-
const entry =
|
|
94413
|
+
const entry = membersById2.get(member.entryMemberId);
|
|
93954
94414
|
if (listKindOf(member) === "unordered" && ownerValueId !== void 0) {
|
|
93955
94415
|
for (const child of document.values) {
|
|
93956
94416
|
if (child.containerId === ownerValueId) visitChild(entry, child.id);
|
|
@@ -93961,7 +94421,7 @@ function collectValuesReachableWithoutReadOnlyBinding(document, excludedMemberId
|
|
|
93961
94421
|
return;
|
|
93962
94422
|
}
|
|
93963
94423
|
if (isMemberDictionaryBase(member) && isStringValueRecord(body)) {
|
|
93964
|
-
const entry =
|
|
94424
|
+
const entry = membersById2.get(member.entryMemberId);
|
|
93965
94425
|
for (const childId of Object.values(body)) visitChild(entry, childId);
|
|
93966
94426
|
return;
|
|
93967
94427
|
}
|
|
@@ -93978,7 +94438,7 @@ function collectValuesReachableWithoutReadOnlyBinding(document, excludedMemberId
|
|
|
93978
94438
|
document.members
|
|
93979
94439
|
)) {
|
|
93980
94440
|
if (entry.memberId === excludedMemberId) continue;
|
|
93981
|
-
const childMember =
|
|
94441
|
+
const childMember = membersById2.get(entry.memberId);
|
|
93982
94442
|
visitChild(
|
|
93983
94443
|
childMember === void 0 ? void 0 : substituteMember(
|
|
93984
94444
|
childMember,
|
|
@@ -97139,17 +97599,17 @@ var init_reserved_record_id_validation = __esm({
|
|
|
97139
97599
|
|
|
97140
97600
|
// ../src/database/project-world-reference-graph.ts
|
|
97141
97601
|
function createWorldReferenceGraph(args) {
|
|
97142
|
-
const
|
|
97602
|
+
const classesById2 = /* @__PURE__ */ new Map();
|
|
97143
97603
|
for (const value of args.classes) {
|
|
97144
97604
|
const schemaClass2 = toWorldReferenceClassRecord(value);
|
|
97145
|
-
if (schemaClass2 !== null)
|
|
97605
|
+
if (schemaClass2 !== null) classesById2.set(schemaClass2.id, schemaClass2);
|
|
97146
97606
|
}
|
|
97147
97607
|
const valuesById = /* @__PURE__ */ new Map();
|
|
97148
97608
|
for (const value of args.values) {
|
|
97149
97609
|
const worldValue = toWorldReferenceValueRecord(value);
|
|
97150
97610
|
if (worldValue !== null) valuesById.set(worldValue.id, worldValue);
|
|
97151
97611
|
}
|
|
97152
|
-
return { classesById, valuesById };
|
|
97612
|
+
return { classesById: classesById2, valuesById };
|
|
97153
97613
|
}
|
|
97154
97614
|
function collectProjectDocumentTileGridReferenceBlockers(args) {
|
|
97155
97615
|
const blockers = [];
|
|
@@ -97263,16 +97723,16 @@ function worldReferenceMergedSchema(graph, classId) {
|
|
|
97263
97723
|
function resolveWorldReferenceKind(graph, classId) {
|
|
97264
97724
|
return resolveWorldKindFromClassMap(classId, graph.classesById);
|
|
97265
97725
|
}
|
|
97266
|
-
function resolveWorldKindFromClassMap(classId,
|
|
97726
|
+
function resolveWorldKindFromClassMap(classId, classesById2) {
|
|
97267
97727
|
const visited = /* @__PURE__ */ new Set();
|
|
97268
|
-
let current =
|
|
97728
|
+
let current = classesById2.get(classId);
|
|
97269
97729
|
while (current !== void 0) {
|
|
97270
97730
|
if (visited.has(current.id)) return null;
|
|
97271
97731
|
visited.add(current.id);
|
|
97272
97732
|
const worldKind = current.system?.worldKind;
|
|
97273
97733
|
if (typeof worldKind === "string") return worldKind;
|
|
97274
97734
|
const extendsClassId = current.extendsClassId;
|
|
97275
|
-
current = typeof extendsClassId === "string" ?
|
|
97735
|
+
current = typeof extendsClassId === "string" ? classesById2.get(extendsClassId) : void 0;
|
|
97276
97736
|
}
|
|
97277
97737
|
return null;
|
|
97278
97738
|
}
|
|
@@ -97657,7 +98117,7 @@ function assertStagedWorldContentLayerBindingsValid(current, projected, changes)
|
|
|
97657
98117
|
});
|
|
97658
98118
|
}
|
|
97659
98119
|
function stagedChangesRequireWorldLayerBindingValidation(current, changes) {
|
|
97660
|
-
const
|
|
98120
|
+
const classesById2 = new Map(
|
|
97661
98121
|
current.classes.map((schemaClass2) => [schemaClass2.id, schemaClass2])
|
|
97662
98122
|
);
|
|
97663
98123
|
const valuesById = new Map(current.values.map((value) => [value.id, value]));
|
|
@@ -97671,7 +98131,7 @@ function stagedChangesRequireWorldLayerBindingValidation(current, changes) {
|
|
|
97671
98131
|
if (change.recordKind !== "class") continue;
|
|
97672
98132
|
if (change.operation !== "update") return true;
|
|
97673
98133
|
if (change.deleted === true) return true;
|
|
97674
|
-
const before =
|
|
98134
|
+
const before = classesById2.get(change.recordId);
|
|
97675
98135
|
if (before === void 0) return true;
|
|
97676
98136
|
const after = change.nextData;
|
|
97677
98137
|
if (!isPlainRecord(after)) return true;
|
|
@@ -97842,7 +98302,7 @@ function assertStagedActionListenersValid(projected, changes) {
|
|
|
97842
98302
|
(member) => member.kind === 26 /* NSAction */
|
|
97843
98303
|
);
|
|
97844
98304
|
if (actions.length === 0) return;
|
|
97845
|
-
const
|
|
98305
|
+
const membersById2 = new Map(
|
|
97846
98306
|
projected.members.map((member) => [member.id, member])
|
|
97847
98307
|
);
|
|
97848
98308
|
const valueIds = new Set(projected.values.map((value) => value.id));
|
|
@@ -97870,7 +98330,7 @@ function assertStagedActionListenersValid(projected, changes) {
|
|
|
97870
98330
|
if (listeners.length === 0) continue;
|
|
97871
98331
|
const ownerId = getMemberId(owner);
|
|
97872
98332
|
if (ownerId === null) continue;
|
|
97873
|
-
const action =
|
|
98333
|
+
const action = membersById2.get(ownerId);
|
|
97874
98334
|
if (action === void 0) continue;
|
|
97875
98335
|
graded.push({
|
|
97876
98336
|
listeners,
|
|
@@ -97887,7 +98347,7 @@ function assertStagedActionListenersValid(projected, changes) {
|
|
|
97887
98347
|
expected,
|
|
97888
98348
|
owner: entry.label,
|
|
97889
98349
|
projected,
|
|
97890
|
-
membersById,
|
|
98350
|
+
membersById: membersById2,
|
|
97891
98351
|
valueIds
|
|
97892
98352
|
});
|
|
97893
98353
|
}
|
|
@@ -97925,7 +98385,7 @@ function getMemberId(member) {
|
|
|
97925
98385
|
return typeof id2 === "string" ? id2 : null;
|
|
97926
98386
|
}
|
|
97927
98387
|
function assertActionListenerSetValid(args) {
|
|
97928
|
-
const { expected, owner, projected, membersById, valueIds } = args;
|
|
98388
|
+
const { expected, owner, projected, membersById: membersById2, valueIds } = args;
|
|
97929
98389
|
const identities = /* @__PURE__ */ new Map();
|
|
97930
98390
|
args.listeners.forEach((listener, index) => {
|
|
97931
98391
|
if (!isMemberDelegateTarget(listener)) {
|
|
@@ -97946,7 +98406,7 @@ function assertActionListenerSetValid(args) {
|
|
|
97946
98406
|
`${owner} listener ${index} names receiver value "${listener.valueId}", which this project version does not contain.`
|
|
97947
98407
|
);
|
|
97948
98408
|
}
|
|
97949
|
-
const target =
|
|
98409
|
+
const target = membersById2.get(listener.memberId);
|
|
97950
98410
|
if (target === void 0) {
|
|
97951
98411
|
throw new Error(
|
|
97952
98412
|
`${owner} listener ${index} names member "${listener.memberId}", which this project version does not contain.`
|
|
@@ -98100,7 +98560,7 @@ function assertStagedVariantMemberValuesValid(projected, changes) {
|
|
|
98100
98560
|
(member) => member.kind === 27 /* Variant */
|
|
98101
98561
|
);
|
|
98102
98562
|
if (variantMembers.length === 0) return;
|
|
98103
|
-
const
|
|
98563
|
+
const classesById2 = new Map(
|
|
98104
98564
|
projected.classes.map((schemaClass2) => [schemaClass2.id, schemaClass2])
|
|
98105
98565
|
);
|
|
98106
98566
|
const variantsById = new Map(
|
|
@@ -98109,7 +98569,7 @@ function assertStagedVariantMemberValuesValid(projected, changes) {
|
|
|
98109
98569
|
const foldersById = new Map(
|
|
98110
98570
|
(projected.variantFolders ?? []).map((folder) => [folder.id, folder])
|
|
98111
98571
|
);
|
|
98112
|
-
const
|
|
98572
|
+
const membersById2 = new Map(
|
|
98113
98573
|
projected.members.map((member) => [member.id, member])
|
|
98114
98574
|
);
|
|
98115
98575
|
const valuesById = new Map(
|
|
@@ -98119,7 +98579,7 @@ function assertStagedVariantMemberValuesValid(projected, changes) {
|
|
|
98119
98579
|
for (const member of variantMembers) {
|
|
98120
98580
|
const declaration = substituteMemberForListenerGrading(member, projected);
|
|
98121
98581
|
const label = describeVariantMember(member, projected.classes);
|
|
98122
|
-
assertVariantMemberTargetValid({ declaration, label, classesById });
|
|
98582
|
+
assertVariantMemberTargetValid({ declaration, label, classesById: classesById2 });
|
|
98123
98583
|
const authored = authoredVariantValue(member);
|
|
98124
98584
|
if (authored !== void 0) {
|
|
98125
98585
|
graded.push({ value: authored, declaration, label });
|
|
@@ -98153,17 +98613,17 @@ function assertStagedVariantMemberValuesValid(projected, changes) {
|
|
|
98153
98613
|
value: entry.value,
|
|
98154
98614
|
declaration: entry.declaration,
|
|
98155
98615
|
owner: entry.label,
|
|
98156
|
-
classesById,
|
|
98616
|
+
classesById: classesById2,
|
|
98157
98617
|
variantsById,
|
|
98158
98618
|
foldersById,
|
|
98159
|
-
membersById,
|
|
98619
|
+
membersById: membersById2,
|
|
98160
98620
|
valuesById,
|
|
98161
98621
|
values: projected.values
|
|
98162
98622
|
});
|
|
98163
98623
|
}
|
|
98164
98624
|
}
|
|
98165
98625
|
function assertVariantMemberTargetValid(args) {
|
|
98166
|
-
const { declaration, label, classesById } = args;
|
|
98626
|
+
const { declaration, label, classesById: classesById2 } = args;
|
|
98167
98627
|
const target = variantMemberTargetTypeInfo(declaration);
|
|
98168
98628
|
if (target === null) {
|
|
98169
98629
|
throw new Error(
|
|
@@ -98176,13 +98636,13 @@ function assertVariantMemberTargetValid(args) {
|
|
|
98176
98636
|
`${label} declares a target that is neither a class nor a generic parameter. NeoVariant<TTarget> takes a NeoObject-derived class or a NeoObject-constrained parameter.`
|
|
98177
98637
|
);
|
|
98178
98638
|
}
|
|
98179
|
-
const targetClass =
|
|
98639
|
+
const targetClass = classesById2.get(target.classId);
|
|
98180
98640
|
if (targetClass === void 0) {
|
|
98181
98641
|
throw new Error(
|
|
98182
98642
|
`${label} targets class "${target.classId}", which is not in this project.`
|
|
98183
98643
|
);
|
|
98184
98644
|
}
|
|
98185
|
-
if (resolveWorldKindFromClassMap(target.classId,
|
|
98645
|
+
if (resolveWorldKindFromClassMap(target.classId, classesById2) !== NeoWorldSystemClassKind.Object) {
|
|
98186
98646
|
throw new Error(
|
|
98187
98647
|
`${label} targets class "${targetClass.name}", which does not derive from NeoObject. Only NeoObject-derived classes declare variants (P67 \xA71).`
|
|
98188
98648
|
);
|
|
@@ -98193,10 +98653,10 @@ function assertVariantReferenceValid(args) {
|
|
|
98193
98653
|
value,
|
|
98194
98654
|
declaration,
|
|
98195
98655
|
owner,
|
|
98196
|
-
classesById,
|
|
98656
|
+
classesById: classesById2,
|
|
98197
98657
|
variantsById,
|
|
98198
98658
|
foldersById,
|
|
98199
|
-
membersById,
|
|
98659
|
+
membersById: membersById2,
|
|
98200
98660
|
valuesById
|
|
98201
98661
|
} = args;
|
|
98202
98662
|
const target = variantMemberTargetTypeInfo(declaration);
|
|
@@ -98214,7 +98674,7 @@ function assertVariantReferenceValid(args) {
|
|
|
98214
98674
|
`${owner} must store a variant reference: { classId, variantId } where variantId is a variant id or null for the base selection.`
|
|
98215
98675
|
);
|
|
98216
98676
|
}
|
|
98217
|
-
const selectedClass =
|
|
98677
|
+
const selectedClass = classesById2.get(value.classId);
|
|
98218
98678
|
if (selectedClass === void 0) {
|
|
98219
98679
|
throw new Error(
|
|
98220
98680
|
`${owner} selects class "${value.classId}", which is not in this project.`
|
|
@@ -98223,10 +98683,10 @@ function assertVariantReferenceValid(args) {
|
|
|
98223
98683
|
if (target.type === 7 /* Class */ && value.classId !== target.classId) {
|
|
98224
98684
|
const admitted = descendantClassIds(
|
|
98225
98685
|
target.classId,
|
|
98226
|
-
Array.from(
|
|
98686
|
+
Array.from(classesById2.values())
|
|
98227
98687
|
);
|
|
98228
98688
|
if (!admitted.has(value.classId)) {
|
|
98229
|
-
const targetName =
|
|
98689
|
+
const targetName = classesById2.get(target.classId)?.name ?? target.classId;
|
|
98230
98690
|
throw new Error(
|
|
98231
98691
|
`${owner} selects class "${selectedClass.name}", which does not derive from the declared target "${targetName}". A NeoVariant member accepts its target or a subclass of it (P67 \xA76).`
|
|
98232
98692
|
);
|
|
@@ -98251,7 +98711,7 @@ function assertVariantReferenceValid(args) {
|
|
|
98251
98711
|
);
|
|
98252
98712
|
}
|
|
98253
98713
|
if (variant.classId !== value.classId) {
|
|
98254
|
-
const ownerClassName =
|
|
98714
|
+
const ownerClassName = classesById2.get(variant.classId)?.name ?? variant.classId;
|
|
98255
98715
|
throw new Error(
|
|
98256
98716
|
`${owner} selects class "${selectedClass.name}" but names variant "${variant.name}" of "${ownerClassName}". Variant lookup is not virtual, so a variant belongs to exactly one class (P67 \xA74.3).`
|
|
98257
98717
|
);
|
|
@@ -98269,7 +98729,7 @@ function assertVariantReferenceValid(args) {
|
|
|
98269
98729
|
`${owner} keeps its lookup row unbound, so rowValueId must be null.`
|
|
98270
98730
|
);
|
|
98271
98731
|
}
|
|
98272
|
-
if (declaredValueType.type === 7 /* Class */ && lookupBindingEntryClassId(binding,
|
|
98732
|
+
if (declaredValueType.type === 7 /* Class */ && lookupBindingEntryClassId(binding, membersById2) !== declaredValueType.classId) {
|
|
98273
98733
|
throw new Error(
|
|
98274
98734
|
`${owner} lookup value type does not match variant folder "${folder?.path ?? ""}".`
|
|
98275
98735
|
);
|
|
@@ -98289,7 +98749,7 @@ function assertVariantReferenceValid(args) {
|
|
|
98289
98749
|
`${owner} selects lookup variant "${variant.name}" and must bind one collection row.`
|
|
98290
98750
|
);
|
|
98291
98751
|
}
|
|
98292
|
-
const collection =
|
|
98752
|
+
const collection = membersById2.get(binding.collectionMemberId);
|
|
98293
98753
|
const collectionValue = valuesById.get(binding.collectionValueId);
|
|
98294
98754
|
if (!isMemberListBase(collection) || collectionValue === void 0 || !valuesById.has(value.rowValueId) || !listEntryIdsForValue(collection, collectionValue, args.values).includes(
|
|
98295
98755
|
value.rowValueId
|
|
@@ -98303,10 +98763,10 @@ function variantMemberValueTypeInfo(declaration) {
|
|
|
98303
98763
|
const valueType = Reflect.get(declaration, "valueTypeInfo");
|
|
98304
98764
|
return isNSTypeInfo(valueType) ? valueType : null;
|
|
98305
98765
|
}
|
|
98306
|
-
function lookupBindingEntryClassId(binding,
|
|
98307
|
-
const collection =
|
|
98766
|
+
function lookupBindingEntryClassId(binding, membersById2) {
|
|
98767
|
+
const collection = membersById2.get(binding.collectionMemberId);
|
|
98308
98768
|
if (!isMemberListBase(collection)) return null;
|
|
98309
|
-
const entry =
|
|
98769
|
+
const entry = membersById2.get(collection.entryMemberId);
|
|
98310
98770
|
return isMemberClassBase(entry) ? entry.classId : null;
|
|
98311
98771
|
}
|
|
98312
98772
|
function variantMemberTargetTypeInfo(declaration) {
|
|
@@ -99161,27 +99621,30 @@ function computeWorkspaceStatus(workspace, options) {
|
|
|
99161
99621
|
)) {
|
|
99162
99622
|
parseErrors.push(new SchemaSourceError(message, "<project-files>", 1, 1));
|
|
99163
99623
|
}
|
|
99164
|
-
|
|
99165
|
-
|
|
99166
|
-
|
|
99167
|
-
|
|
99168
|
-
|
|
99169
|
-
|
|
99170
|
-
|
|
99171
|
-
|
|
99172
|
-
|
|
99173
|
-
|
|
99174
|
-
|
|
99175
|
-
|
|
99176
|
-
|
|
99177
|
-
|
|
99178
|
-
|
|
99179
|
-
|
|
99180
|
-
|
|
99181
|
-
|
|
99182
|
-
|
|
99183
|
-
|
|
99624
|
+
if (animationValidationInputsChanged(changes, authoredValueSeeds)) {
|
|
99625
|
+
try {
|
|
99626
|
+
const animationRecords = prospectiveAnimationRecords(
|
|
99627
|
+
workspace.state.records,
|
|
99628
|
+
reconstructed3,
|
|
99629
|
+
changes,
|
|
99630
|
+
authoredValueSeeds
|
|
99631
|
+
);
|
|
99632
|
+
validateProspectiveAnimationRecordsV4(
|
|
99633
|
+
animationRecords,
|
|
99634
|
+
animationRecordsFromState(workspace.state.records)
|
|
99635
|
+
);
|
|
99636
|
+
} catch (error) {
|
|
99637
|
+
parseErrors.push(
|
|
99638
|
+
new SchemaSourceError(
|
|
99639
|
+
error instanceof Error ? error.message : String(error),
|
|
99640
|
+
"<animation-clips>",
|
|
99641
|
+
1,
|
|
99642
|
+
1
|
|
99643
|
+
)
|
|
99644
|
+
);
|
|
99645
|
+
}
|
|
99184
99646
|
}
|
|
99647
|
+
reportPhase("animation-clip-validation");
|
|
99185
99648
|
for (const binary of binaryChanges) {
|
|
99186
99649
|
if (binary.action !== "missing-local") continue;
|
|
99187
99650
|
parseErrors.push(
|
|
@@ -99224,6 +99687,7 @@ function computeWorkspaceStatus(workspace, options) {
|
|
|
99224
99687
|
)
|
|
99225
99688
|
);
|
|
99226
99689
|
}
|
|
99690
|
+
reportPhase("initializer-materialization");
|
|
99227
99691
|
return {
|
|
99228
99692
|
changes,
|
|
99229
99693
|
conflictedFiles,
|
|
@@ -99381,6 +99845,15 @@ function replayAnimationDeclarationInitializersV4(records2, document, fallbackDo
|
|
|
99381
99845
|
}
|
|
99382
99846
|
return { ...document, values: [...values.values()] };
|
|
99383
99847
|
}
|
|
99848
|
+
function animationValidationInputsChanged(changes, seeds) {
|
|
99849
|
+
for (const seed of seeds.values()) {
|
|
99850
|
+
if ((seed.values?.length ?? 0) > 0) return true;
|
|
99851
|
+
if ((seed.bindingMembers?.length ?? 0) > 0) return true;
|
|
99852
|
+
}
|
|
99853
|
+
return changes.some(
|
|
99854
|
+
(change) => PROSPECTIVE_ANIMATION_RECORD_KINDS.has(change.recordKind)
|
|
99855
|
+
);
|
|
99856
|
+
}
|
|
99384
99857
|
function animationRecordsFromState(records2) {
|
|
99385
99858
|
return Object.values(records2).flatMap((record3) => {
|
|
99386
99859
|
const data = effectiveRecordData(record3);
|
|
@@ -99388,14 +99861,14 @@ function animationRecordsFromState(records2) {
|
|
|
99388
99861
|
});
|
|
99389
99862
|
}
|
|
99390
99863
|
function classBelongsToAnimationFamily(classes, classId) {
|
|
99391
|
-
const
|
|
99864
|
+
const classesById2 = new Map(
|
|
99392
99865
|
classes.map((schemaClass2) => [schemaClass2.id, schemaClass2])
|
|
99393
99866
|
);
|
|
99394
99867
|
const visited = /* @__PURE__ */ new Set();
|
|
99395
99868
|
let currentId = classId;
|
|
99396
99869
|
while (currentId !== null && !visited.has(currentId)) {
|
|
99397
99870
|
visited.add(currentId);
|
|
99398
|
-
const schemaClass2 =
|
|
99871
|
+
const schemaClass2 = classesById2.get(currentId);
|
|
99399
99872
|
if (schemaClass2 === void 0) return false;
|
|
99400
99873
|
if (declaresAnimationWorldKind(schemaClass2.system)) return true;
|
|
99401
99874
|
currentId = schemaClass2.extendsClassId ?? null;
|
|
@@ -99627,7 +100100,20 @@ function prospectiveAnimationRecords(base, reconstructed3, changes, seeds) {
|
|
|
99627
100100
|
...seedEnvelope,
|
|
99628
100101
|
id: seed.valueId,
|
|
99629
100102
|
memberId,
|
|
99630
|
-
|
|
100103
|
+
// A seed root's P75 provenance is what makes it a root. Without it
|
|
100104
|
+
// `expandProspectiveAnimationInstances` cannot recognize the row, so
|
|
100105
|
+
// a collapse-stamped seed reached the clip validators as the sparse
|
|
100106
|
+
// graph storage holds rather than the graph the runtime resolves --
|
|
100107
|
+
// every rule stated over a settled track, segment, or child override
|
|
100108
|
+
// passing on a row that does not exist. The descendant rows below
|
|
100109
|
+
// already carry it by spreading the whole seed row; the root is the
|
|
100110
|
+
// one projection that dropped it. Same shape as the push wire record
|
|
100111
|
+
// and the pull emit overlay, both of which use this helper.
|
|
100112
|
+
...seed.init === void 0 ? {
|
|
100113
|
+
value: seed.value,
|
|
100114
|
+
classId: seed.classId,
|
|
100115
|
+
...pickInstanceProvenance(seed)
|
|
100116
|
+
} : { init: seed.init }
|
|
99631
100117
|
}
|
|
99632
100118
|
});
|
|
99633
100119
|
}
|
|
@@ -99812,6 +100298,7 @@ function summarizeFieldDiff(baseData3, nextData) {
|
|
|
99812
100298
|
}
|
|
99813
100299
|
return lines;
|
|
99814
100300
|
}
|
|
100301
|
+
var ANIMATION_DOCUMENT_RECORD_KINDS, ANIMATION_REPLAY_RECORD_KINDS, PROSPECTIVE_ANIMATION_RECORD_KINDS;
|
|
99815
100302
|
var init_workspace_status_core = __esm({
|
|
99816
100303
|
"src/project-source/workspace-status-core.ts"() {
|
|
99817
100304
|
"use strict";
|
|
@@ -99840,6 +100327,7 @@ var init_workspace_status_core = __esm({
|
|
|
99840
100327
|
init_members();
|
|
99841
100328
|
init_value_row_owner_members();
|
|
99842
100329
|
init_project2();
|
|
100330
|
+
init_project_version_types();
|
|
99843
100331
|
init_instance_provenance();
|
|
99844
100332
|
init_evaluator_lookups();
|
|
99845
100333
|
init_local_initializer_materialization();
|
|
@@ -99850,6 +100338,24 @@ var init_workspace_status_core = __esm({
|
|
|
99850
100338
|
init_materialized_construction_cache();
|
|
99851
100339
|
init_project_version_whole_graph_validation();
|
|
99852
100340
|
init_value_base_desync();
|
|
100341
|
+
ANIMATION_DOCUMENT_RECORD_KINDS = [
|
|
100342
|
+
ProjectRecordKind.Project,
|
|
100343
|
+
ProjectRecordKind.Class,
|
|
100344
|
+
ProjectRecordKind.Constructor,
|
|
100345
|
+
ProjectRecordKind.Member,
|
|
100346
|
+
ProjectRecordKind.Value
|
|
100347
|
+
];
|
|
100348
|
+
ANIMATION_REPLAY_RECORD_KINDS = [
|
|
100349
|
+
ProjectRecordKind.Enum,
|
|
100350
|
+
ProjectRecordKind.Interface,
|
|
100351
|
+
ProjectRecordKind.ProjectFile,
|
|
100352
|
+
ProjectRecordKind.Variant,
|
|
100353
|
+
ProjectRecordKind.VariantFolder
|
|
100354
|
+
];
|
|
100355
|
+
PROSPECTIVE_ANIMATION_RECORD_KINDS = /* @__PURE__ */ new Set([
|
|
100356
|
+
...ANIMATION_DOCUMENT_RECORD_KINDS,
|
|
100357
|
+
...ANIMATION_REPLAY_RECORD_KINDS
|
|
100358
|
+
]);
|
|
99853
100359
|
}
|
|
99854
100360
|
});
|
|
99855
100361
|
|
|
@@ -101542,17 +102048,18 @@ function rowBackedDefaultBody(member, isPulledValueRow) {
|
|
|
101542
102048
|
const defaultValue = member.defaultValue;
|
|
101543
102049
|
if (!isObjectRecord2(defaultValue)) return null;
|
|
101544
102050
|
const body = defaultValue.value;
|
|
101545
|
-
const referencesRows = (children) => children.
|
|
102051
|
+
const referencesRows = (children) => children.every(
|
|
101546
102052
|
(child) => typeof child === "string" && isPulledValueRow(child)
|
|
101547
102053
|
);
|
|
101548
102054
|
if (member.kind === MEMBER_KIND_CLASS2 && isObjectRecord2(body)) {
|
|
101549
|
-
|
|
102055
|
+
const children = Object.values(body);
|
|
102056
|
+
return children.length > 0 && referencesRows(children) ? { kind: "class", body } : null;
|
|
101550
102057
|
}
|
|
101551
102058
|
if (member.kind === MEMBER_KIND_LIST2 && member.listKind !== "unordered" && Array.isArray(body)) {
|
|
101552
102059
|
const rows = body.filter(
|
|
101553
102060
|
(child) => typeof child === "string" && isPulledValueRow(child)
|
|
101554
102061
|
);
|
|
101555
|
-
return rows.length
|
|
102062
|
+
return rows.length === body.length ? { kind: "list", body: rows } : null;
|
|
101556
102063
|
}
|
|
101557
102064
|
if (member.kind === MEMBER_KIND_DICTIONARY2 && isObjectRecord2(body)) {
|
|
101558
102065
|
return referencesRows(Object.values(body)) ? { kind: "dictionary", body } : null;
|
|
@@ -102062,15 +102569,16 @@ function indexStructuralStoredIds(context, rootValueId, rootPath) {
|
|
|
102062
102569
|
});
|
|
102063
102570
|
return;
|
|
102064
102571
|
}
|
|
102065
|
-
if (!isObjectRecord2(body)) return;
|
|
102066
102572
|
const indexedSchemaKeys = /* @__PURE__ */ new Set();
|
|
102067
|
-
|
|
102068
|
-
|
|
102069
|
-
|
|
102070
|
-
|
|
102071
|
-
|
|
102072
|
-
|
|
102073
|
-
|
|
102573
|
+
if (isObjectRecord2(body)) {
|
|
102574
|
+
for (const [key, child] of Object.entries(body)) {
|
|
102575
|
+
if (typeof child !== "string") continue;
|
|
102576
|
+
if (context.state[`value:${child}`] === void 0) continue;
|
|
102577
|
+
const childPath = `${path}.${key}`;
|
|
102578
|
+
indexedSchemaKeys.add(key);
|
|
102579
|
+
context.structuralStoredIds.set(childPath, child);
|
|
102580
|
+
visit(child, childPath, depth + 1);
|
|
102581
|
+
}
|
|
102074
102582
|
}
|
|
102075
102583
|
const constructorArgs = data.constructorArgs;
|
|
102076
102584
|
const classId = data.classId;
|
|
@@ -106548,6 +107056,9 @@ function classValue(context, member, value, visited, targetTyped, outerEnvironme
|
|
|
106548
107056
|
const childMember = context.members.get(childMemberId);
|
|
106549
107057
|
if (childMember === void 0)
|
|
106550
107058
|
throw new Error(`Class ${name}.${key} has no member record.`);
|
|
107059
|
+
if (emitsAsMemberDefaultDerivedAbsence(context, childMember, childId)) {
|
|
107060
|
+
continue;
|
|
107061
|
+
}
|
|
106551
107062
|
const replayChildId = replayBody[key];
|
|
106552
107063
|
if (replayGraph !== null && typeof replayChildId === "string" && materializedValueSubgraphsEqual(
|
|
106553
107064
|
context,
|
|
@@ -106590,6 +107101,20 @@ ${fields.map((field) => indentNeoSourceNonEmptyLines(field, 2)).join(",\n")}
|
|
|
106590
107101
|
${fields.map((field) => indentNeoSourceNonEmptyLines(field, 2)).join(",\n")}
|
|
106591
107102
|
}`;
|
|
106592
107103
|
}
|
|
107104
|
+
function emitsAsMemberDefaultDerivedAbsence(context, member, valueId) {
|
|
107105
|
+
const value = context.values.get(valueId);
|
|
107106
|
+
if (value === void 0) return false;
|
|
107107
|
+
const body = value.value;
|
|
107108
|
+
if (!isObjectRecord2(body)) return false;
|
|
107109
|
+
if (Object.keys(body).length > 0) return false;
|
|
107110
|
+
const effectiveClassId = stringOrNull(value.classId) ?? stringOrNull(member.classId);
|
|
107111
|
+
if (effectiveClassId === null) return false;
|
|
107112
|
+
return derivesContentFromMemberDefault({
|
|
107113
|
+
member,
|
|
107114
|
+
instanceRoot: value,
|
|
107115
|
+
effectiveClassId
|
|
107116
|
+
});
|
|
107117
|
+
}
|
|
106593
107118
|
function memberProjectsConstructorParameter(context, memberId, projectedMemberIds) {
|
|
106594
107119
|
const visited = /* @__PURE__ */ new Set();
|
|
106595
107120
|
let current = memberId;
|
|
@@ -106745,8 +107270,7 @@ function storedConstructorCallSource(context, schemaClass2, value, className, en
|
|
|
106745
107270
|
// re-declared that external graph under the construction, and the
|
|
106746
107271
|
// emitter then refused the whole pull with a containment cycle on the
|
|
106747
107272
|
// re-declared row's own children.
|
|
106748
|
-
constructorArgumentBodySchemaKey(value, constructorArgs[key]) !== void 0
|
|
106749
|
-
settledMember !== void 0
|
|
107273
|
+
constructorArgumentBodySchemaKey(value, constructorArgs[key]) !== void 0
|
|
106750
107274
|
)}`
|
|
106751
107275
|
];
|
|
106752
107276
|
});
|
|
@@ -106847,7 +107371,7 @@ function storedValueConstructor(context, schemaClass2, constructorArgs, recorded
|
|
|
106847
107371
|
}
|
|
106848
107372
|
return selected;
|
|
106849
107373
|
}
|
|
106850
|
-
function storedConstructorArgumentSource(context, type, value, environment, visited, cloneAggregateArguments = false, partial = false, constructorOwnsGraph = false
|
|
107374
|
+
function storedConstructorArgumentSource(context, type, value, environment, visited, cloneAggregateArguments = false, partial = false, constructorOwnsGraph = false) {
|
|
106851
107375
|
if (value === null) {
|
|
106852
107376
|
if (!type.nullable) {
|
|
106853
107377
|
throw new Error("Required constructor argument stores null.");
|
|
@@ -106929,7 +107453,7 @@ function storedConstructorArgumentSource(context, type, value, environment, visi
|
|
|
106929
107453
|
value,
|
|
106930
107454
|
environment,
|
|
106931
107455
|
visited,
|
|
106932
|
-
|
|
107456
|
+
false,
|
|
106933
107457
|
partial,
|
|
106934
107458
|
constructorOwnsGraph
|
|
106935
107459
|
);
|
|
@@ -106956,8 +107480,7 @@ function storedConstructorArgumentSource(context, type, value, environment, visi
|
|
|
106956
107480
|
visited,
|
|
106957
107481
|
cloneAggregateArguments,
|
|
106958
107482
|
partial,
|
|
106959
|
-
constructorOwnsGraph
|
|
106960
|
-
settlesMember
|
|
107483
|
+
constructorOwnsGraph
|
|
106961
107484
|
);
|
|
106962
107485
|
}
|
|
106963
107486
|
case "interface":
|
|
@@ -106977,7 +107500,7 @@ function storedConstructorArgumentSource(context, type, value, environment, visi
|
|
|
106977
107500
|
value,
|
|
106978
107501
|
environment,
|
|
106979
107502
|
visited,
|
|
106980
|
-
|
|
107503
|
+
false,
|
|
106981
107504
|
false,
|
|
106982
107505
|
constructorOwnsGraph
|
|
106983
107506
|
);
|
|
@@ -108132,6 +108655,7 @@ var init_value_sources = __esm({
|
|
|
108132
108655
|
init_member_kind_type_names();
|
|
108133
108656
|
init_initializer_replay();
|
|
108134
108657
|
init_variant_value_graph();
|
|
108658
|
+
init_virtual_instance_values();
|
|
108135
108659
|
init_variant_selection_source();
|
|
108136
108660
|
INFERRED_GENERIC_CLASS_PREFIX = "__inferred_class__:";
|
|
108137
108661
|
MEMBER_KIND_DICTIONARY2 = 5;
|
|
@@ -112120,7 +112644,8 @@ function auditProjectIntegrity(workspace) {
|
|
|
112120
112644
|
values,
|
|
112121
112645
|
placements,
|
|
112122
112646
|
memberIdBySchemaKey
|
|
112123
|
-
})
|
|
112647
|
+
}),
|
|
112648
|
+
...auditUnprojectedValueRows({ records: records2, values, placements })
|
|
112124
112649
|
);
|
|
112125
112650
|
return findings.sort(
|
|
112126
112651
|
(left, right) => left.recordId.localeCompare(right.recordId)
|
|
@@ -112170,10 +112695,108 @@ function auditDanglingLocalizedTexts(args) {
|
|
|
112170
112695
|
}
|
|
112171
112696
|
return findings;
|
|
112172
112697
|
}
|
|
112698
|
+
function auditUnprojectedValueRows(args) {
|
|
112699
|
+
const recordsById2 = /* @__PURE__ */ new Map();
|
|
112700
|
+
const seeds = [];
|
|
112701
|
+
let projectsAnyFile = false;
|
|
112702
|
+
for (const record3 of Object.values(args.records)) {
|
|
112703
|
+
const existing = recordsById2.get(record3.recordId);
|
|
112704
|
+
if (existing === void 0) {
|
|
112705
|
+
recordsById2.set(record3.recordId, [record3]);
|
|
112706
|
+
} else {
|
|
112707
|
+
existing.push(record3);
|
|
112708
|
+
}
|
|
112709
|
+
if (record3.file !== void 0) projectsAnyFile = true;
|
|
112710
|
+
if (record3.recordKind !== "value" || record3.file !== void 0) {
|
|
112711
|
+
seeds.push(record3.recordId);
|
|
112712
|
+
}
|
|
112713
|
+
}
|
|
112714
|
+
if (!projectsAnyFile) return [];
|
|
112715
|
+
const containedByContainer = /* @__PURE__ */ new Map();
|
|
112716
|
+
for (const value of args.values.values()) {
|
|
112717
|
+
if (value.containerId === null) continue;
|
|
112718
|
+
const siblings = containedByContainer.get(value.containerId);
|
|
112719
|
+
if (siblings === void 0) {
|
|
112720
|
+
containedByContainer.set(value.containerId, [value.id]);
|
|
112721
|
+
} else {
|
|
112722
|
+
siblings.push(value.id);
|
|
112723
|
+
}
|
|
112724
|
+
}
|
|
112725
|
+
const reachable = walkRecordGraph({
|
|
112726
|
+
recordsById: recordsById2,
|
|
112727
|
+
containedByContainer,
|
|
112728
|
+
seeds
|
|
112729
|
+
});
|
|
112730
|
+
const findings = [];
|
|
112731
|
+
for (const value of args.values.values()) {
|
|
112732
|
+
if (reachable.has(value.id)) continue;
|
|
112733
|
+
if (args.placements.has(value.id)) continue;
|
|
112734
|
+
const orphaned = walkRecordGraph({
|
|
112735
|
+
recordsById: recordsById2,
|
|
112736
|
+
containedByContainer,
|
|
112737
|
+
seeds: [value.id],
|
|
112738
|
+
excluded: reachable
|
|
112739
|
+
});
|
|
112740
|
+
const orphanedValueIds = [];
|
|
112741
|
+
for (const id2 of orphaned) {
|
|
112742
|
+
if (args.values.has(id2)) orphanedValueIds.push(id2);
|
|
112743
|
+
}
|
|
112744
|
+
findings.push({
|
|
112745
|
+
kind: "unprojected-value-row",
|
|
112746
|
+
recordKind: "value",
|
|
112747
|
+
recordId: value.id,
|
|
112748
|
+
message: `Value "${value.id}" is a pulled row that no emitted file projects and no other record names, so \`neo status\` reads it as CLI-managed loose state and never reports it${orphanedValueIds.length === 1 ? "" : `, along with the ${String(orphanedValueIds.length - 1)} row(s) it owns`}. Restore the declaration that should name it, or delete the rows.`,
|
|
112749
|
+
repair: { valueId: value.id, orphanedValueIds }
|
|
112750
|
+
});
|
|
112751
|
+
}
|
|
112752
|
+
return findings;
|
|
112753
|
+
}
|
|
112754
|
+
function walkRecordGraph(args) {
|
|
112755
|
+
const reached = /* @__PURE__ */ new Set();
|
|
112756
|
+
const pending = [];
|
|
112757
|
+
const claim = (id2) => {
|
|
112758
|
+
if (args.excluded?.has(id2) === true) return;
|
|
112759
|
+
if (!args.recordsById.has(id2) || reached.has(id2)) return;
|
|
112760
|
+
reached.add(id2);
|
|
112761
|
+
pending.push(id2);
|
|
112762
|
+
};
|
|
112763
|
+
for (const seed of args.seeds) claim(seed);
|
|
112764
|
+
for (let id2 = pending.pop(); id2 !== void 0; id2 = pending.pop()) {
|
|
112765
|
+
for (const record3 of args.recordsById.get(id2) ?? []) {
|
|
112766
|
+
collectRecordIdStrings(record3.data, args.recordsById, claim);
|
|
112767
|
+
}
|
|
112768
|
+
for (const contained of args.containedByContainer.get(id2) ?? []) {
|
|
112769
|
+
claim(contained);
|
|
112770
|
+
}
|
|
112771
|
+
}
|
|
112772
|
+
return reached;
|
|
112773
|
+
}
|
|
112774
|
+
function collectRecordIdStrings(data, recordsById2, claim) {
|
|
112775
|
+
if (typeof data === "string") {
|
|
112776
|
+
if (recordsById2.has(data)) {
|
|
112777
|
+
claim(data);
|
|
112778
|
+
return;
|
|
112779
|
+
}
|
|
112780
|
+
for (const [embedded] of data.matchAll(EMBEDDED_RECORD_ID)) {
|
|
112781
|
+
if (recordsById2.has(embedded)) claim(embedded);
|
|
112782
|
+
const systemId = `${SYSTEM_RECORD_ID_PREFIX2}${embedded}`;
|
|
112783
|
+
if (recordsById2.has(systemId)) claim(systemId);
|
|
112784
|
+
}
|
|
112785
|
+
return;
|
|
112786
|
+
}
|
|
112787
|
+
if (Array.isArray(data)) {
|
|
112788
|
+
for (const entry of data) {
|
|
112789
|
+
collectRecordIdStrings(entry, recordsById2, claim);
|
|
112790
|
+
}
|
|
112791
|
+
return;
|
|
112792
|
+
}
|
|
112793
|
+
if (!isObjectRecord2(data)) return;
|
|
112794
|
+
for (const entry of Object.values(data)) {
|
|
112795
|
+
collectRecordIdStrings(entry, recordsById2, claim);
|
|
112796
|
+
}
|
|
112797
|
+
}
|
|
112173
112798
|
function isLocalizedTextIdShape(body) {
|
|
112174
|
-
return
|
|
112175
|
-
body
|
|
112176
|
-
);
|
|
112799
|
+
return WHOLE_RECORD_ID.test(body);
|
|
112177
112800
|
}
|
|
112178
112801
|
function childStorageKeyDeclaration(args) {
|
|
112179
112802
|
const { placement } = args;
|
|
@@ -112297,14 +112920,18 @@ function normalizePartition(mapKey) {
|
|
|
112297
112920
|
function describePartition(mapKey) {
|
|
112298
112921
|
return mapKey === null ? `"${MAIN_STORAGE_PARTITION}"` : `"${mapKey}"`;
|
|
112299
112922
|
}
|
|
112300
|
-
var UNORDERED_MEMBERSHIP_KEY, MEMBER_KIND_STRING;
|
|
112923
|
+
var UNORDERED_MEMBERSHIP_KEY, MEMBER_KIND_STRING, RECORD_ID_PATTERN2, EMBEDDED_RECORD_ID, WHOLE_RECORD_ID;
|
|
112301
112924
|
var init_project_integrity = __esm({
|
|
112302
112925
|
"src/project-source/project-integrity.ts"() {
|
|
112303
112926
|
"use strict";
|
|
112304
112927
|
init_member_storage_key();
|
|
112928
|
+
init_system_record_id();
|
|
112305
112929
|
init_projection();
|
|
112306
112930
|
UNORDERED_MEMBERSHIP_KEY = "(container)";
|
|
112307
112931
|
MEMBER_KIND_STRING = 3;
|
|
112932
|
+
RECORD_ID_PATTERN2 = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}";
|
|
112933
|
+
EMBEDDED_RECORD_ID = new RegExp(RECORD_ID_PATTERN2, "gu");
|
|
112934
|
+
WHOLE_RECORD_ID = new RegExp(`^${RECORD_ID_PATTERN2}$`, "u");
|
|
112308
112935
|
}
|
|
112309
112936
|
});
|
|
112310
112937
|
|
|
@@ -114380,12 +115007,12 @@ async function runLocalTargetCommand(manifest, target, command, options) {
|
|
|
114380
115007
|
);
|
|
114381
115008
|
}
|
|
114382
115009
|
function collectLocalCheckAll(manifest, options) {
|
|
114383
|
-
const
|
|
115010
|
+
const membersById2 = new Map(
|
|
114384
115011
|
manifest.members.filter(isLocalScriptMember).map((member) => [member.id, member])
|
|
114385
115012
|
);
|
|
114386
115013
|
const analyses = analyzeManifestScripts(manifest);
|
|
114387
115014
|
const results = analyses.map((analysis) => {
|
|
114388
|
-
const member =
|
|
115015
|
+
const member = membersById2.get(analysis.memberId);
|
|
114389
115016
|
if (member === void 0) {
|
|
114390
115017
|
throw new Error(
|
|
114391
115018
|
`Local NeoScript analysis returned an unknown body "${analysis.path}".`
|
|
@@ -118300,7 +118927,7 @@ var init_registry2 = __esm({
|
|
|
118300
118927
|
PROJECT_SCHEMA_CONTRACT = Object.freeze({
|
|
118301
118928
|
formatVersion: 3,
|
|
118302
118929
|
contractVersion: "3.14",
|
|
118303
|
-
cliVersion: "0.
|
|
118930
|
+
cliVersion: "0.38.0",
|
|
118304
118931
|
projectFileUploadBatchSize: 32,
|
|
118305
118932
|
documentRecords: {
|
|
118306
118933
|
member: {
|
|
@@ -125023,7 +125650,7 @@ There is no --keep-current: preserving current semantic state defines flatten.
|
|
|
125023
125650
|
async function main() {
|
|
125024
125651
|
const args = parseArgs(process.argv.slice(2));
|
|
125025
125652
|
if (args.command === "--version") {
|
|
125026
|
-
console.log("0.
|
|
125653
|
+
console.log("0.38.0");
|
|
125027
125654
|
return;
|
|
125028
125655
|
}
|
|
125029
125656
|
if (args.command === null || args.command === "help" || args.command === "--help" || args.command === "-h") {
|
|
@@ -125035,21 +125662,27 @@ async function main() {
|
|
|
125035
125662
|
return;
|
|
125036
125663
|
}
|
|
125037
125664
|
assertKnownFlags(args);
|
|
125038
|
-
const
|
|
125665
|
+
const apiOverride = stringFlag(args, "api");
|
|
125666
|
+
const apiBaseUrl = apiOverride ?? DEFAULT_API_BASE_URL;
|
|
125667
|
+
const authApiBaseUrl = () => resolveAuthApiBaseUrl({
|
|
125668
|
+
apiOverride,
|
|
125669
|
+
cwd: process.cwd(),
|
|
125670
|
+
defaultApiBaseUrl: DEFAULT_API_BASE_URL
|
|
125671
|
+
});
|
|
125039
125672
|
switch (args.command) {
|
|
125040
125673
|
case "login":
|
|
125041
125674
|
await runLogin({
|
|
125042
|
-
apiBaseUrl,
|
|
125675
|
+
apiBaseUrl: authApiBaseUrl(),
|
|
125043
125676
|
profile: profileFlag(args),
|
|
125044
125677
|
tokenStdin: boolFlag(args, "token-stdin"),
|
|
125045
125678
|
saveProjectId: stringFlag(args, "save-project")
|
|
125046
125679
|
});
|
|
125047
125680
|
return;
|
|
125048
125681
|
case "whoami":
|
|
125049
|
-
await runWhoami(
|
|
125682
|
+
await runWhoami(authApiBaseUrl());
|
|
125050
125683
|
return;
|
|
125051
125684
|
case "logout":
|
|
125052
|
-
await runLogout(
|
|
125685
|
+
await runLogout(authApiBaseUrl());
|
|
125053
125686
|
return;
|
|
125054
125687
|
case "init":
|
|
125055
125688
|
{
|
|
@@ -125510,6 +126143,7 @@ var DEFAULT_API_BASE_URL;
|
|
|
125510
126143
|
var init_main = __esm({
|
|
125511
126144
|
"src/main.ts"() {
|
|
125512
126145
|
"use strict";
|
|
126146
|
+
init_auth_api_base_url();
|
|
125513
126147
|
init_login();
|
|
125514
126148
|
init_args();
|
|
125515
126149
|
init_workspace_status();
|