@yahoo/uds-create-config 5.77.2 → 5.79.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/configs/CanvasConfig.d.ts +1 -1
- package/dist/configs/react-native-system.d.ts +1 -1
- package/dist/configs/react-native-system.js +1 -1
- package/dist/configs/system.d.ts +1 -1
- package/dist/configs/system.js +3 -1
- package/dist/entities/system/{LinkedSystem.d.ts → Source.d.ts} +19 -11
- package/dist/entities/system/{LinkedSystem.js → Source.js} +127 -130
- package/dist/entities/system/component-module.js +2 -2
- package/dist/entities/system/copy-plan.js +5 -2
- package/dist/entities/system/css-motion-reach.js +6 -6
- package/dist/entities/system/link-declaration.d.ts +6 -68
- package/dist/entities/system/link-declaration.js +30 -4
- package/dist/entities/system/link-plan.d.ts +2 -2
- package/dist/entities/system/link-plan.js +44 -15
- package/dist/entities/system/motion-variants.js +2 -2
- package/dist/framework/Config.d.ts +59 -24
- package/dist/framework/Config.js +170 -41
- package/dist/framework/affected.d.ts +38 -0
- package/dist/framework/affected.js +191 -0
- package/dist/framework/changes.d.ts +1 -1
- package/dist/framework/changes.js +2 -2
- package/dist/framework/defineConfig.d.ts +3 -3
- package/dist/framework/defineEntity.d.ts +4 -3
- package/dist/framework/defineEntity.js +2 -1
- package/dist/framework/derived-mutations.d.ts +1 -1
- package/dist/framework/derived-mutations.js +1 -1
- package/dist/framework/inline-sources.js +2 -2
- package/dist/framework/projections.d.ts +14 -1
- package/dist/framework/projections.js +24 -1
- package/dist/framework/registry.d.ts +13 -7
- package/dist/framework/registry.js +3 -2
- package/dist/framework/retired-fields.d.ts +33 -0
- package/dist/framework/retired-fields.js +148 -0
- package/dist/framework/schema-version.d.ts +1 -1
- package/dist/framework/schema-version.js +5 -5
- package/dist/framework/schemas.js +1 -1
- package/dist/framework/signature.js +4 -1
- package/dist/framework/source-integrity.d.ts +2 -2
- package/dist/framework/source-integrity.js +2 -2
- package/dist/framework/sources.d.ts +3 -3
- package/dist/framework/sources.js +1 -1
- package/dist/framework/utils/content-key.js +1 -1
- package/dist/framework/utils/field-schema.js +7 -2
- package/dist/framework/utils/refs.d.ts +1 -1
- package/dist/framework/utils/refs.js +1 -1
- package/dist/index.d.ts +7 -5
- package/dist/index.js +6 -4
- package/dist/migrations/2.0.0/v1-artifact.d.ts +1 -1
- package/dist/migrations/20261105185042_sources_stored.d.ts +19 -0
- package/dist/migrations/20261105185042_sources_stored.js +125 -0
- package/dist/spec/links.d.ts +1 -1
- package/dist/spec/links.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/dist/framework/authored-at.d.ts +0 -31
- package/dist/framework/authored-at.js +0 -73
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { collectRefs, entityRefOf, isRef, kindOf, pathOf, refOfKey, replaceRefMarkers, sourceOf } from "./utils/refs.js";
|
|
2
|
+
import { fnv1a64, stableStringify } from "./utils/content-key.js";
|
|
3
|
+
//#region src/framework/affected.ts
|
|
4
|
+
const key = (kind, path) => `${kind}:${path}`;
|
|
5
|
+
/** The items under a group path on one side, as paths. */
|
|
6
|
+
function memberPaths(config, kind, group) {
|
|
7
|
+
return config.members(kind, group).map((member) => member.path);
|
|
8
|
+
}
|
|
9
|
+
/** The entities a change writes, each with where it sits on both sides. */
|
|
10
|
+
function seedsOf({ change, base, draft }) {
|
|
11
|
+
const { kind, path } = change;
|
|
12
|
+
if (change.target === "order" || path === void 0) return [];
|
|
13
|
+
if (change.target === "group") {
|
|
14
|
+
if (change.operation === "group-rename" && change.to !== void 0) {
|
|
15
|
+
const to = change.to;
|
|
16
|
+
return memberPaths(base, kind, path).map((basePath) => ({
|
|
17
|
+
kind,
|
|
18
|
+
path: `${to}${basePath.slice(path.length)}`,
|
|
19
|
+
basePath
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
22
|
+
return [...new Set([...memberPaths(base, kind, path), ...memberPaths(draft, kind, path)])].map((member) => ({
|
|
23
|
+
kind,
|
|
24
|
+
path: member,
|
|
25
|
+
basePath: member
|
|
26
|
+
}));
|
|
27
|
+
}
|
|
28
|
+
if (change.operation === "rename" && change.to !== void 0) return [{
|
|
29
|
+
kind,
|
|
30
|
+
path: change.to,
|
|
31
|
+
basePath: path
|
|
32
|
+
}];
|
|
33
|
+
return [{
|
|
34
|
+
kind,
|
|
35
|
+
path,
|
|
36
|
+
basePath: path
|
|
37
|
+
}];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Content fingerprints, memoized per config.
|
|
41
|
+
*
|
|
42
|
+
* A source is a config of its own, so a borrowed value is fingerprinted in the source it lives in and
|
|
43
|
+
* the memo is shared by everything that reaches it.
|
|
44
|
+
*/
|
|
45
|
+
var Fingerprints = class {
|
|
46
|
+
#memo = /* @__PURE__ */ new WeakMap();
|
|
47
|
+
/** The fingerprint of what `target` reaches from `config`, member suffix and all. */
|
|
48
|
+
of(config, target) {
|
|
49
|
+
const entity = entityRefOf(target);
|
|
50
|
+
const member = target.slice(entity.length);
|
|
51
|
+
const kind = kindOf(entity);
|
|
52
|
+
const slug = sourceOf(entity);
|
|
53
|
+
if (slug !== void 0) {
|
|
54
|
+
const source = config.sourceFor(slug);
|
|
55
|
+
if (!source) return `missing:${target}`;
|
|
56
|
+
return this.of(source, `${key(kind, pathOf(entity))}${member}`);
|
|
57
|
+
}
|
|
58
|
+
let memo = this.#memo.get(config);
|
|
59
|
+
if (!memo) {
|
|
60
|
+
memo = /* @__PURE__ */ new Map();
|
|
61
|
+
this.#memo.set(config, memo);
|
|
62
|
+
}
|
|
63
|
+
const hit = memo.get(entity);
|
|
64
|
+
if (hit !== void 0) return `${hit}${member}`;
|
|
65
|
+
memo.set(entity, `cycle:${entity}`);
|
|
66
|
+
const computed = this.#compute(config, kind, pathOf(entity));
|
|
67
|
+
memo.set(entity, computed);
|
|
68
|
+
return `${computed}${member}`;
|
|
69
|
+
}
|
|
70
|
+
#compute(config, kind, path) {
|
|
71
|
+
const body = config.resolve(kind, path)?.body;
|
|
72
|
+
if (body === void 0) return config.members(kind, path).length > 0 ? `group:${kind}` : `missing:${key(kind, path)}`;
|
|
73
|
+
const refs = new Set(collectRefs(body).map(entityRefOf));
|
|
74
|
+
const named = config.dependenciesOf(kind, path).filter((dep) => !refs.has(dep) && config.entityOf(kindOf(dep))?.sourceIdentity === void 0).sort();
|
|
75
|
+
return fnv1a64(stableStringify([this.#normalize(config, body), named.map((dep) => this.of(config, dep))]));
|
|
76
|
+
}
|
|
77
|
+
/** A body with every ref replaced by the fingerprint of what it reaches. */
|
|
78
|
+
#normalize(config, value) {
|
|
79
|
+
if (isRef(value)) {
|
|
80
|
+
const { __ref, ...rest } = value;
|
|
81
|
+
const out = { __fp: this.of(config, __ref) };
|
|
82
|
+
for (const [field, nested] of Object.entries(rest)) out[field] = this.#normalize(config, nested);
|
|
83
|
+
return out;
|
|
84
|
+
}
|
|
85
|
+
if (typeof value === "string") return replaceRefMarkers(value, (target) => `{${this.of(config, target.__ref)}}`);
|
|
86
|
+
if (Array.isArray(value)) return value.map((item) => this.#normalize(config, item));
|
|
87
|
+
if (typeof value === "object" && value !== null) {
|
|
88
|
+
const out = {};
|
|
89
|
+
for (const [field, nested] of Object.entries(value)) {
|
|
90
|
+
const keyed = refOfKey(field);
|
|
91
|
+
const name = keyed ? `{${this.of(config, keyed)}}` : field;
|
|
92
|
+
out[name] = this.#normalize(config, nested);
|
|
93
|
+
}
|
|
94
|
+
return out;
|
|
95
|
+
}
|
|
96
|
+
return value;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Every entity the draft changes as it resolves, in the order the changes reach them: each written
|
|
101
|
+
* entity, then what depends on it.
|
|
102
|
+
*
|
|
103
|
+
* `changes` is the draft read as what it changed (`changesOf`), already narrowed to the ones that
|
|
104
|
+
* stand. An entity both written and reached lists every cause.
|
|
105
|
+
*/
|
|
106
|
+
function affectedOf({ base, draft, changes }) {
|
|
107
|
+
const seeds = changes.flatMap((change) => seedsOf({
|
|
108
|
+
change,
|
|
109
|
+
base,
|
|
110
|
+
draft
|
|
111
|
+
}));
|
|
112
|
+
const toDraft = /* @__PURE__ */ new Map();
|
|
113
|
+
const toBase = /* @__PURE__ */ new Map();
|
|
114
|
+
for (const seed of seeds) if (seed.basePath !== seed.path) {
|
|
115
|
+
toDraft.set(key(seed.kind, seed.basePath), seed.path);
|
|
116
|
+
toBase.set(key(seed.kind, seed.path), seed.basePath);
|
|
117
|
+
}
|
|
118
|
+
const candidates = /* @__PURE__ */ new Map();
|
|
119
|
+
const add = ({ kind, path, basePath, cause, direct }) => {
|
|
120
|
+
const id = key(kind, path);
|
|
121
|
+
const found = candidates.get(id);
|
|
122
|
+
if (found) {
|
|
123
|
+
found.causes.add(cause);
|
|
124
|
+
found.direct ||= direct;
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
candidates.set(id, {
|
|
128
|
+
kind,
|
|
129
|
+
path,
|
|
130
|
+
basePath,
|
|
131
|
+
direct,
|
|
132
|
+
causes: new Set([cause])
|
|
133
|
+
});
|
|
134
|
+
};
|
|
135
|
+
for (const seed of seeds) {
|
|
136
|
+
const inDraft = draft.resolve(seed.kind, seed.path) !== void 0;
|
|
137
|
+
const cause = inDraft ? key(seed.kind, seed.path) : key(seed.kind, seed.basePath);
|
|
138
|
+
add({
|
|
139
|
+
...seed,
|
|
140
|
+
cause,
|
|
141
|
+
direct: true
|
|
142
|
+
});
|
|
143
|
+
if (inDraft) for (const dependent of draft.dependentsOf(seed.kind, seed.path, { transitive: true })) {
|
|
144
|
+
const kind = kindOf(dependent);
|
|
145
|
+
const path = pathOf(dependent);
|
|
146
|
+
add({
|
|
147
|
+
kind,
|
|
148
|
+
path,
|
|
149
|
+
basePath: toBase.get(dependent) ?? path,
|
|
150
|
+
cause,
|
|
151
|
+
direct: false
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
if (base.resolve(seed.kind, seed.basePath) !== void 0) for (const dependent of base.dependentsOf(seed.kind, seed.basePath, { transitive: true })) {
|
|
155
|
+
const kind = kindOf(dependent);
|
|
156
|
+
const basePath = pathOf(dependent);
|
|
157
|
+
add({
|
|
158
|
+
kind,
|
|
159
|
+
path: toDraft.get(dependent) ?? basePath,
|
|
160
|
+
basePath,
|
|
161
|
+
cause,
|
|
162
|
+
direct: false
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
const fingerprints = new Fingerprints();
|
|
167
|
+
const affected = [];
|
|
168
|
+
for (const candidate of candidates.values()) {
|
|
169
|
+
const { kind, path, basePath } = candidate;
|
|
170
|
+
const inDraft = draft.resolve(kind, path) !== void 0;
|
|
171
|
+
const inBase = base.resolve(kind, basePath) !== void 0;
|
|
172
|
+
let status;
|
|
173
|
+
if (inDraft && inBase) {
|
|
174
|
+
if (fingerprints.of(base, key(kind, basePath)) === fingerprints.of(draft, key(kind, path))) continue;
|
|
175
|
+
status = "changed";
|
|
176
|
+
} else if (inDraft) status = "added";
|
|
177
|
+
else if (inBase) status = "removed";
|
|
178
|
+
else continue;
|
|
179
|
+
affected.push({
|
|
180
|
+
kind,
|
|
181
|
+
path: inDraft ? path : basePath,
|
|
182
|
+
...basePath !== path && inDraft && inBase ? { basePath } : {},
|
|
183
|
+
status,
|
|
184
|
+
direct: candidate.direct,
|
|
185
|
+
causes: [...candidate.causes]
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
return affected;
|
|
189
|
+
}
|
|
190
|
+
//#endregion
|
|
191
|
+
export { affectedOf };
|
|
@@ -27,7 +27,7 @@ interface Change {
|
|
|
27
27
|
/** The value on the draft. `undefined` when the path no longer exists. */
|
|
28
28
|
readonly after: unknown;
|
|
29
29
|
}
|
|
30
|
-
/** The base as a config of its own — the branch with no draft applied. */
|
|
30
|
+
/** The base as a config of its own — the branch with no draft applied. See `Config.withoutDraft`. */
|
|
31
31
|
declare function baseOf(config: Config): Config;
|
|
32
32
|
/** The value a change addresses in one config — the body, or the field within it. */
|
|
33
33
|
declare function changeValueAt({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
//#region src/framework/changes.ts
|
|
2
|
-
/** The base as a config of its own — the branch with no draft applied. */
|
|
2
|
+
/** The base as a config of its own — the branch with no draft applied. See `Config.withoutDraft`. */
|
|
3
3
|
function baseOf(config) {
|
|
4
|
-
return config.
|
|
4
|
+
return config.withoutDraft();
|
|
5
5
|
}
|
|
6
6
|
const str = (value) => typeof value === "string" ? value : void 0;
|
|
7
7
|
const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -77,7 +77,7 @@ type RecordFor<E> = E extends {
|
|
|
77
77
|
* by a thunk yielding the config type each one resolves to.
|
|
78
78
|
*
|
|
79
79
|
* ```ts
|
|
80
|
-
* sources: {
|
|
80
|
+
* sources: { sources: () => System }
|
|
81
81
|
* ```
|
|
82
82
|
*
|
|
83
83
|
* One word for one thing: the declaration here, `Config.registerSources`, `Config.load`'s resolvers,
|
|
@@ -85,11 +85,11 @@ type RecordFor<E> = E extends {
|
|
|
85
85
|
* key it by the same accessor name `register` uses.
|
|
86
86
|
*
|
|
87
87
|
* Keyed by the KIND rather than by a slug, because the slugs are that kind's item paths:
|
|
88
|
-
* `
|
|
88
|
+
* `sources: { yos: …, ds: … }` declares the slugs `yos` and `ds` that a ref qualifies with. So
|
|
89
89
|
* the declaration says which collection those names come from, and cardinality follows from the data —
|
|
90
90
|
* a system editor has n items, a design file has 1, same kind and same reader.
|
|
91
91
|
*
|
|
92
|
-
* A THUNK because of self-reference: `sources: {
|
|
92
|
+
* A THUNK because of self-reference: `sources: { sources: System }` sits inside the call that
|
|
93
93
|
* produces `System`, where the binding is not initialised yet.
|
|
94
94
|
*
|
|
95
95
|
* **TYPING ONLY, and deliberately so.** What it buys is that a resolver is handed that kind's own
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Entity } from "./Entity.js";
|
|
2
2
|
import { ExtendableRef, Ref } from "./utils/refs.js";
|
|
3
3
|
import { TraverseOptions } from "./ref-graph.js";
|
|
4
|
-
import { AuthoredAt } from "./authored-at.js";
|
|
5
4
|
import { CreateInput, FieldsSchema } from "./utils/field-schema.js";
|
|
6
5
|
import { FieldsCtx, UserSchemas } from "./schemas.js";
|
|
7
6
|
import { SubEntityClass } from "./defineSubEntity.js";
|
|
7
|
+
import { RetiredFields } from "./retired-fields.js";
|
|
8
8
|
import { BulkOverlayWrite, BulkQuery, SourceOverlay, SourceResolutionSchemas } from "./sources.js";
|
|
9
9
|
import { AuthoredValueForm, ComputedFields, EntityKind, Linkable, SourceType } from "./registry.js";
|
|
10
10
|
import { PathOf } from "./registered.js";
|
|
@@ -335,8 +335,9 @@ declare function defineEntity<F extends FieldsSchema, G extends FieldsSchema = z
|
|
|
335
335
|
mentionFields?: readonly string[]; /** Cross-item rules the kind holds — see {@link EntityKind.invariants}. */
|
|
336
336
|
invariants?: (config: Config) => string[]; /** See {@link EntityKind.structuralBody}. */
|
|
337
337
|
structuralBody?: (data: unknown) => Record<string, unknown>; /** See {@link EntityKind.authoredBody}. */
|
|
338
|
-
authoredBody?: (data: Record<string, unknown>) => Record<string, unknown>; /** See {@link EntityKind.
|
|
339
|
-
|
|
338
|
+
authoredBody?: (data: Record<string, unknown>) => Record<string, unknown>; /** See {@link EntityKind.retiredFields}. */
|
|
339
|
+
retiredFields?: RetiredFields; /** See {@link EntityKind.retiredKinds}. */
|
|
340
|
+
retiredKinds?: readonly string[];
|
|
340
341
|
/**
|
|
341
342
|
* For a source kind that can be resolved: the two schemas its resolutions are validated against —
|
|
342
343
|
* `{ resolved, unavailable }`. Declare it alongside `sourceIdentity` for a kind a config lists in its
|
|
@@ -137,7 +137,8 @@ function defineEntity(spec) {
|
|
|
137
137
|
invariants: spec.invariants,
|
|
138
138
|
structuralBody: spec.structuralBody,
|
|
139
139
|
authoredBody: spec.authoredBody,
|
|
140
|
-
|
|
140
|
+
retiredFields: spec.retiredFields,
|
|
141
|
+
retiredKinds: spec.retiredKinds,
|
|
141
142
|
sourceType: spec.sourceType,
|
|
142
143
|
answeredHere: spec.answeredHere
|
|
143
144
|
});
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* ship writable-in-name-only — the config takes the patch, the file it came from never learns of it.
|
|
10
10
|
*
|
|
11
11
|
* Derived from a PROBE kind, not from a real config, because this vocabulary is a property of the
|
|
12
|
-
* FRAMEWORK. An entity's own custom ops (`
|
|
12
|
+
* FRAMEWORK. An entity's own custom ops (`source`'s `link`, a canvas `element-insert`) mean
|
|
13
13
|
* whatever that entity says and carry a handler to match, so they are absent by construction rather
|
|
14
14
|
* than filtered out — nothing else is obliged to implement them.
|
|
15
15
|
*
|
|
@@ -12,7 +12,7 @@ import { z } from "zod";
|
|
|
12
12
|
* ship writable-in-name-only — the config takes the patch, the file it came from never learns of it.
|
|
13
13
|
*
|
|
14
14
|
* Derived from a PROBE kind, not from a real config, because this vocabulary is a property of the
|
|
15
|
-
* FRAMEWORK. An entity's own custom ops (`
|
|
15
|
+
* FRAMEWORK. An entity's own custom ops (`source`'s `link`, a canvas `element-insert`) mean
|
|
16
16
|
* whatever that entity says and carry a handler to match, so they are absent by construction rather
|
|
17
17
|
* than filtered out — nothing else is obliged to implement them.
|
|
18
18
|
*
|
|
@@ -10,7 +10,7 @@ import { kindBorrowable } from "./registry.js";
|
|
|
10
10
|
* its readers somewhere `link` refuses to go.
|
|
11
11
|
*
|
|
12
12
|
* **A borrowable kind** — a `style-property`, a component. The ref can become ours, but only by being
|
|
13
|
-
* copied first, so `
|
|
13
|
+
* copied first, so `source/copy` is the fix. What this must not say is that we have no entity
|
|
14
14
|
* at the path: we may well have one, and it is simply not the entity this ref names. A local `bg`
|
|
15
15
|
* that happens to share a name with theirs is a different declaration, and quietly repointing at it
|
|
16
16
|
* would change what every callsite means.
|
|
@@ -243,7 +243,7 @@ function rewrittenBody({ body, kind, config, slug, options }) {
|
|
|
243
243
|
/**
|
|
244
244
|
* Every item and group body of `config`, rewritten by {@link inlineSourcedRefs}.
|
|
245
245
|
*
|
|
246
|
-
* `
|
|
246
|
+
* `source` is skipped: the pins are not values that inline, and they stay — provenance is
|
|
247
247
|
* information a consumer's tooling still wants for attribution and upgrade detection. Deleting one is
|
|
248
248
|
* the pin's own `delete`, once nothing refers through it.
|
|
249
249
|
*
|
|
@@ -412,6 +412,19 @@ declare function literalValueOf(config: Config, value: unknown): string | number
|
|
|
412
412
|
* for a dark cell paints what dark will show. `null` is the base, the same as {@link resolveTokenValue}.
|
|
413
413
|
*/
|
|
414
414
|
declare function resolveTokenValueUnder(config: Config, path: string, condition: string | null, seen?: Set<string>): string | number | undefined;
|
|
415
|
+
/**
|
|
416
|
+
* Every override condition a token's value can change under: its own overrides, and those of every
|
|
417
|
+
* token its value points through, across a link too. An alias with no overrides of its own still
|
|
418
|
+
* changes under a condition when the token it points at does, which is how
|
|
419
|
+
* {@link resolveTokenValueUnder} reads it.
|
|
420
|
+
*/
|
|
421
|
+
declare function tokenConditions({
|
|
422
|
+
config,
|
|
423
|
+
path
|
|
424
|
+
}: {
|
|
425
|
+
config: Config;
|
|
426
|
+
path: string;
|
|
427
|
+
}): string[];
|
|
415
428
|
/**
|
|
416
429
|
* A string's interpolated refs written as their tokens: `blur({token:blur/sm})` is
|
|
417
430
|
* `blur(var(--blur-sm))`. A ref opening a `var(` is the variable's name, so a fallback can follow it:
|
|
@@ -871,4 +884,4 @@ declare function propValueFromAxis(config: Config, path: string, prop: string, v
|
|
|
871
884
|
/** The `value` a string, number or boolean prop declares as its default, per prop. */
|
|
872
885
|
declare function declaredPropDefaults(props: Record<string, unknown> | undefined): Record<string, unknown>;
|
|
873
886
|
//#endregion
|
|
874
|
-
export { IconTool, IndexedPreviewCondition, LinkedDraw, PreviewMatrix, PropDeclaration, StyleDeclarationGroup, StylePropEntry, StylePropertyItem, VarNaming, authoredBag, authoredValue, bodyNumberLeaves, bodyNumberUnit, className, cssPropValue, cssVar, cssVarRef, declarationKeyName, declaredPropDefaults, declaredPropRouting, declaresCssVariable, glyphComponentOf, glyphLibrariesOf, glyphPropsOf, heldLinked, holdingPreviewConditions, iconToolAxisOptions, iconToolFor, iconToolOf, iconToolsOf, isCustomPropertyKey, keyedPreviewConditions, linkedDraw, linkedLocalRow, linkedVarNaming, literalValueOf, memberFromLeaf, memberLeaves, nameStyleNumbers, negatedCssValue, opacityPercentage, pinStyleNumbers, previewConditionalProps, previewConditions, previewDefaults, previewMatrix, propOwner, propValueDomain, propValueFromAxis, refListOf, renderInterpolated, renderStyleValue, resolveComponentProps, resolveFieldValue, resolveTokenValue, resolveTokenValueUnder, rewriteStyleNumbers, routedBag, sourceVarPrefix, styleAliasesOf, styleDeclarationGroups, styleDeclarations, styleNumberAsPainted, styleNumberReadingChanges, stylePropEntries, stylePropLeafForToken, stylePropNegates, stylePropNumberCss, stylePropNumberLeaf, stylePropNumberLeaves, stylePropNumberName, stylePropNumberNamedLeaves, stylePropNumberUnit, stylePropNumberUnitRefusal, stylePropTokenGroup, stylePropTokenPath, stylePropTokenValues, stylePropValueFromLeaf, stylePropValueLeaves, stylePropValues, stylePropertiesWriting, stylePropertyAccepts, stylePropertyFor, stylePropertyPathFor, tokenReference, validateComponentProps };
|
|
887
|
+
export { IconTool, IndexedPreviewCondition, LinkedDraw, PreviewMatrix, PropDeclaration, StyleDeclarationGroup, StylePropEntry, StylePropertyItem, VarNaming, authoredBag, authoredValue, bodyNumberLeaves, bodyNumberUnit, className, cssPropValue, cssVar, cssVarRef, declarationKeyName, declaredPropDefaults, declaredPropRouting, declaresCssVariable, glyphComponentOf, glyphLibrariesOf, glyphPropsOf, heldLinked, holdingPreviewConditions, iconToolAxisOptions, iconToolFor, iconToolOf, iconToolsOf, isCustomPropertyKey, keyedPreviewConditions, linkedDraw, linkedLocalRow, linkedVarNaming, literalValueOf, memberFromLeaf, memberLeaves, nameStyleNumbers, negatedCssValue, opacityPercentage, pinStyleNumbers, previewConditionalProps, previewConditions, previewDefaults, previewMatrix, propOwner, propValueDomain, propValueFromAxis, refListOf, renderInterpolated, renderStyleValue, resolveComponentProps, resolveFieldValue, resolveTokenValue, resolveTokenValueUnder, rewriteStyleNumbers, routedBag, sourceVarPrefix, styleAliasesOf, styleDeclarationGroups, styleDeclarations, styleNumberAsPainted, styleNumberReadingChanges, stylePropEntries, stylePropLeafForToken, stylePropNegates, stylePropNumberCss, stylePropNumberLeaf, stylePropNumberLeaves, stylePropNumberName, stylePropNumberNamedLeaves, stylePropNumberUnit, stylePropNumberUnitRefusal, stylePropTokenGroup, stylePropTokenPath, stylePropTokenValues, stylePropValueFromLeaf, stylePropValueLeaves, stylePropValues, stylePropertiesWriting, stylePropertyAccepts, stylePropertyFor, stylePropertyPathFor, tokenConditions, tokenReference, validateComponentProps };
|
|
@@ -1111,6 +1111,29 @@ function resolveTokenValueUnder(config, path, condition, seen = /* @__PURE__ */
|
|
|
1111
1111
|
condition
|
|
1112
1112
|
});
|
|
1113
1113
|
}
|
|
1114
|
+
/** How far {@link tokenConditions} follows an alias chain, so a cycle stops. */
|
|
1115
|
+
const MAX_CONDITION_DEPTH = 16;
|
|
1116
|
+
/**
|
|
1117
|
+
* Every override condition a token's value can change under: its own overrides, and those of every
|
|
1118
|
+
* token its value points through, across a link too. An alias with no overrides of its own still
|
|
1119
|
+
* changes under a condition when the token it points at does, which is how
|
|
1120
|
+
* {@link resolveTokenValueUnder} reads it.
|
|
1121
|
+
*/
|
|
1122
|
+
function tokenConditions({ config, path }) {
|
|
1123
|
+
const found = /* @__PURE__ */ new Set();
|
|
1124
|
+
let at = config;
|
|
1125
|
+
let current = path;
|
|
1126
|
+
for (let depth = 0; at && depth < MAX_CONDITION_DEPTH; depth++) {
|
|
1127
|
+
const body = at.resolve("token", current)?.toJSON();
|
|
1128
|
+
if (!body) break;
|
|
1129
|
+
for (const condition of Object.keys(body.overrides ?? {})) found.add(condition);
|
|
1130
|
+
const { value } = body;
|
|
1131
|
+
if (!isRef(value) || kindOf(value) !== "token") break;
|
|
1132
|
+
at = at.configFor(value);
|
|
1133
|
+
current = pathOf(value);
|
|
1134
|
+
}
|
|
1135
|
+
return [...found];
|
|
1136
|
+
}
|
|
1114
1137
|
/**
|
|
1115
1138
|
* A string's interpolated refs written as their tokens: `blur({token:blur/sm})` is
|
|
1116
1139
|
* `blur(var(--blur-sm))`. A ref opening a `var(` is the variable's name, so a fallback can follow it:
|
|
@@ -2150,4 +2173,4 @@ function declaredPropDefaults(props) {
|
|
|
2150
2173
|
return out;
|
|
2151
2174
|
}
|
|
2152
2175
|
//#endregion
|
|
2153
|
-
export { LAYER_PROPS, authoredBag, authoredValue, bodyNumberLeaves, bodyNumberUnit, className, cssPropValue, cssVar, cssVarRef, declarationKeyName, declaredPropDefaults, declaredPropRouting, declaresCssVariable, fontStackOf, glyphComponentOf, glyphLibrariesOf, glyphPropsOf, glyphPropsOfBody, heldLinked, holdingPreviewConditions, iconToolAxisOptions, iconToolFor, iconToolOf, iconToolsOf, isCustomPropertyKey, keyedPreviewConditions, layerPropsErrors, linkedDraw, linkedLocalRow, linkedVarNaming, literalValueOf, memberFromLeaf, memberLeaves, nameStyleNumbers, negatedCssValue, opacityPercentage, pinBodyStyleNumbers, pinStyleNumbers, previewConditionalProps, previewConditions, previewDefaults, previewMatrix, propOwner, propValueDomain, propValueFromAxis, refListOf, renderInterpolated, renderStyleValue, resolveComponentProps, resolveFieldValue, resolveTokenValue, resolveTokenValueUnder, rewriteStyleNumbers, routedBag, sourceVarPrefix, styleAliasesOf, styleDeclarationGroups, styleDeclarations, styleNumberAsPainted, styleNumberReadingChanges, stylePropEntries, stylePropLeafForToken, stylePropNegates, stylePropNumberCss, stylePropNumberLeaf, stylePropNumberLeaves, stylePropNumberName, stylePropNumberNamedLeaves, stylePropNumberUnit, stylePropNumberUnitRefusal, stylePropTokenGroup, stylePropTokenPath, stylePropTokenValues, stylePropValueFromLeaf, stylePropValueLeaves, stylePropValues, stylePropertiesWriting, stylePropertyAccepts, stylePropertyFor, stylePropertyPathFor, takenByForward, tokenReference, validateComponentProps };
|
|
2176
|
+
export { LAYER_PROPS, authoredBag, authoredValue, bodyNumberLeaves, bodyNumberUnit, className, cssPropValue, cssVar, cssVarRef, declarationKeyName, declaredPropDefaults, declaredPropRouting, declaresCssVariable, fontStackOf, glyphComponentOf, glyphLibrariesOf, glyphPropsOf, glyphPropsOfBody, heldLinked, holdingPreviewConditions, iconToolAxisOptions, iconToolFor, iconToolOf, iconToolsOf, isCustomPropertyKey, keyedPreviewConditions, layerPropsErrors, linkedDraw, linkedLocalRow, linkedVarNaming, literalValueOf, memberFromLeaf, memberLeaves, nameStyleNumbers, negatedCssValue, opacityPercentage, pinBodyStyleNumbers, pinStyleNumbers, previewConditionalProps, previewConditions, previewDefaults, previewMatrix, propOwner, propValueDomain, propValueFromAxis, refListOf, renderInterpolated, renderStyleValue, resolveComponentProps, resolveFieldValue, resolveTokenValue, resolveTokenValueUnder, rewriteStyleNumbers, routedBag, sourceVarPrefix, styleAliasesOf, styleDeclarationGroups, styleDeclarations, styleNumberAsPainted, styleNumberReadingChanges, stylePropEntries, stylePropLeafForToken, stylePropNegates, stylePropNumberCss, stylePropNumberLeaf, stylePropNumberLeaves, stylePropNumberName, stylePropNumberNamedLeaves, stylePropNumberUnit, stylePropNumberUnitRefusal, stylePropTokenGroup, stylePropTokenPath, stylePropTokenValues, stylePropValueFromLeaf, stylePropValueLeaves, stylePropValues, stylePropertiesWriting, stylePropertyAccepts, stylePropertyFor, stylePropertyPathFor, takenByForward, tokenConditions, tokenReference, validateComponentProps };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AuthoredAt } from "./authored-at.js";
|
|
2
1
|
import { DerivedOp, SchemaEntry } from "./schemas.js";
|
|
3
2
|
import { SubEntityClass } from "./defineSubEntity.js";
|
|
3
|
+
import { RetiredFields } from "./retired-fields.js";
|
|
4
4
|
import { BulkOverlayWrite, BulkQuery, SourceOverlay, SourceResolutionSchemas } from "./sources.js";
|
|
5
5
|
import { Config } from "./Config.js";
|
|
6
6
|
import { z } from "zod";
|
|
@@ -13,7 +13,7 @@ import { z } from "zod";
|
|
|
13
13
|
interface ComputedInput {
|
|
14
14
|
readonly member: Record<string, unknown>;
|
|
15
15
|
readonly config: Config;
|
|
16
|
-
/** Identity, so a field that defaults to it can say so (`
|
|
16
|
+
/** Identity, so a field that defaults to it can say so (`Source.displayName`). */
|
|
17
17
|
readonly path: string;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
@@ -380,12 +380,18 @@ interface EntityKind {
|
|
|
380
380
|
*/
|
|
381
381
|
readonly authoredBody?: (data: Record<string, unknown>) => Record<string, unknown>;
|
|
382
382
|
/**
|
|
383
|
-
*
|
|
384
|
-
*
|
|
385
|
-
*
|
|
386
|
-
*
|
|
383
|
+
* Names this kind was stored and addressed under before a rename (`['source']` for
|
|
384
|
+
* `source`). An op, a patch or a read that names one is taken as naming this kind, so a caller
|
|
385
|
+
* written against the old name keeps working. Stored data is renamed by the migration that renamed
|
|
386
|
+
* the kind.
|
|
387
387
|
*/
|
|
388
|
-
readonly
|
|
388
|
+
readonly retiredKinds?: readonly string[];
|
|
389
|
+
/**
|
|
390
|
+
* Fields this kind stores under a new path, each retired dotted path mapped to the current one
|
|
391
|
+
* (`{ link: 'options.include' }`). A body `register` takes, an op's data and a checkout's file may
|
|
392
|
+
* still spell the retired path. See `framework/retired-fields.ts`.
|
|
393
|
+
*/
|
|
394
|
+
readonly retiredFields?: RetiredFields;
|
|
389
395
|
/**
|
|
390
396
|
* Rewrite one name wherever this kind's data holds it as a key — the cascade half of
|
|
391
397
|
* {@link nameEdges}, applied by `Config.apply`'s rename alongside `rewriteRefs`.
|
|
@@ -30,7 +30,7 @@ function titleCase(kind) {
|
|
|
30
30
|
return kind.split(/[-_]/).filter(Boolean).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
31
31
|
}
|
|
32
32
|
function buildKind(spec) {
|
|
33
|
-
const { name, prepareLinkedBody, rebaseLinkedBody, layerKeys, fields, groupFields, subEntities = {}, computed, label, labelPlural, schemas: userSchemas, derived, sourceIdentity, sourceOrigin, authoredRefs, linkable, localGroupFields, emergentGroups, singleton = false, bareMember, sourceResolution, bulkAdopts, bulkExcludes, bulkOverlay, bulkDirectives, bulkOverlayWrite, nameEdges, rewriteName, styleBags, uniqueLeaves, parts, authoredValue, mentionFields, invariants, structuralBody, authoredBody,
|
|
33
|
+
const { name, prepareLinkedBody, rebaseLinkedBody, layerKeys, fields, groupFields, subEntities = {}, computed, label, labelPlural, schemas: userSchemas, derived, sourceIdentity, sourceOrigin, authoredRefs, linkable, localGroupFields, emergentGroups, singleton = false, bareMember, sourceResolution, bulkAdopts, bulkExcludes, bulkOverlay, bulkDirectives, bulkOverlayWrite, nameEdges, rewriteName, styleBags, uniqueLeaves, parts, authoredValue, mentionFields, invariants, structuralBody, authoredBody, retiredFields, retiredKinds, sourceType, answeredHere } = spec;
|
|
34
34
|
const allComputed = {
|
|
35
35
|
sources: ({ member, config }) => sourceSlugs(member, config),
|
|
36
36
|
borrowedFrom: ({ config, path }) => config.borrowedFrom(name, path),
|
|
@@ -85,7 +85,8 @@ function buildKind(spec) {
|
|
|
85
85
|
...invariants ? { invariants } : {},
|
|
86
86
|
...structuralBody ? { structuralBody } : {},
|
|
87
87
|
...authoredBody ? { authoredBody } : {},
|
|
88
|
-
...
|
|
88
|
+
...retiredFields ? { retiredFields } : {},
|
|
89
|
+
...retiredKinds?.length ? { retiredKinds } : {},
|
|
89
90
|
...sourceType ? { sourceType } : {},
|
|
90
91
|
...answeredHere ? { answeredHere: true } : {}
|
|
91
92
|
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//#region src/framework/retired-fields.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* A field a kind stores under a new path, still taken under the one it had: a source stores what it
|
|
4
|
+
* includes as `options.include`, and `link` is its retired spelling. Declared by the kind
|
|
5
|
+
* (`EntityKind.retiredFields`, retired path → current path), and read where a body or a delta is
|
|
6
|
+
* written: `register` folds an authored body, an op's data is renamed before it is parsed, and a
|
|
7
|
+
* checkout's writer lands a write at whichever path the file spells.
|
|
8
|
+
*
|
|
9
|
+
* A body or a delta that spells both is refused, since the two are one value.
|
|
10
|
+
*/
|
|
11
|
+
/** Retired dotted path → the dotted path the field is stored at now. */
|
|
12
|
+
type RetiredFields = Readonly<Record<string, string>>;
|
|
13
|
+
/** A whole body with each retired field moved to the path it's stored at now. */
|
|
14
|
+
declare function foldRetiredFields({
|
|
15
|
+
body,
|
|
16
|
+
retired
|
|
17
|
+
}: {
|
|
18
|
+
readonly body: Record<string, unknown>;
|
|
19
|
+
readonly retired: RetiredFields;
|
|
20
|
+
}): Record<string, unknown>;
|
|
21
|
+
/**
|
|
22
|
+
* A field-path delta with each key that names a retired field, or a path inside one, renamed to
|
|
23
|
+
* the path the field is stored at now: `{ link: '*' }` → `{ 'options.include': '*' }`.
|
|
24
|
+
*/
|
|
25
|
+
declare function deltaUnderCurrentFields({
|
|
26
|
+
delta,
|
|
27
|
+
retired
|
|
28
|
+
}: {
|
|
29
|
+
readonly delta: Record<string, unknown>;
|
|
30
|
+
readonly retired: RetiredFields;
|
|
31
|
+
}): Record<string, unknown>;
|
|
32
|
+
//#endregion
|
|
33
|
+
export { RetiredFields, deltaUnderCurrentFields, foldRetiredFields };
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { isPlainObject, setAtPath } from "./utils/field-path.js";
|
|
2
|
+
import { rejectData } from "./rejection.js";
|
|
3
|
+
//#region src/framework/retired-fields.ts
|
|
4
|
+
/**
|
|
5
|
+
* A field a kind stores under a new path, still taken under the one it had: a source stores what it
|
|
6
|
+
* includes as `options.include`, and `link` is its retired spelling. Declared by the kind
|
|
7
|
+
* (`EntityKind.retiredFields`, retired path → current path), and read where a body or a delta is
|
|
8
|
+
* written: `register` folds an authored body, an op's data is renamed before it is parsed, and a
|
|
9
|
+
* checkout's writer lands a write at whichever path the file spells.
|
|
10
|
+
*
|
|
11
|
+
* A body or a delta that spells both is refused, since the two are one value.
|
|
12
|
+
*/
|
|
13
|
+
/** The value at a dotted path, or `undefined` when nothing is there. */
|
|
14
|
+
function valueAt(body, segments) {
|
|
15
|
+
let at = body;
|
|
16
|
+
for (const segment of segments) {
|
|
17
|
+
if (!isPlainObject(at) || !Object.hasOwn(at, segment)) return void 0;
|
|
18
|
+
at = at[segment];
|
|
19
|
+
}
|
|
20
|
+
return at;
|
|
21
|
+
}
|
|
22
|
+
/** `body` without the value at `segments`, pruning a parent the removal empties. */
|
|
23
|
+
function without(body, segments) {
|
|
24
|
+
const [head, ...rest] = segments;
|
|
25
|
+
if (head === void 0 || !Object.hasOwn(body, head)) return body;
|
|
26
|
+
const { [head]: child, ...others } = body;
|
|
27
|
+
if (rest.length === 0) return others;
|
|
28
|
+
if (!isPlainObject(child)) return body;
|
|
29
|
+
const remaining = without(child, rest);
|
|
30
|
+
return Object.keys(remaining).length === 0 ? others : {
|
|
31
|
+
...others,
|
|
32
|
+
[head]: remaining
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function refuseBoth({ retired, current }) {
|
|
36
|
+
rejectData(`\`${current}\` and \`${retired}\` are one value, so they can't both be set. \`${retired}\` is the deprecated spelling.`, current.split("."));
|
|
37
|
+
}
|
|
38
|
+
/** A whole body with each retired field moved to the path it's stored at now. */
|
|
39
|
+
function foldRetiredFields({ body, retired }) {
|
|
40
|
+
let folded = body;
|
|
41
|
+
for (const [old, current] of Object.entries(retired)) {
|
|
42
|
+
const from = old.split(".");
|
|
43
|
+
const value = valueAt(folded, from);
|
|
44
|
+
if (value === void 0 || value === null) continue;
|
|
45
|
+
const to = current.split(".");
|
|
46
|
+
if (valueAt(folded, to) !== void 0) refuseBoth({
|
|
47
|
+
retired: old,
|
|
48
|
+
current
|
|
49
|
+
});
|
|
50
|
+
folded = setAtPath(without(folded, from), to, value);
|
|
51
|
+
}
|
|
52
|
+
return folded;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* A field-path delta with each key that names a retired field, or a path inside one, renamed to
|
|
56
|
+
* the path the field is stored at now: `{ link: '*' }` → `{ 'options.include': '*' }`.
|
|
57
|
+
*/
|
|
58
|
+
function deltaUnderCurrentFields({ delta, retired }) {
|
|
59
|
+
const renamed = (key) => {
|
|
60
|
+
for (const [old, current] of Object.entries(retired)) {
|
|
61
|
+
if (key === old) return current;
|
|
62
|
+
if (key.startsWith(`${old}.`)) return `${current}${key.slice(old.length)}`;
|
|
63
|
+
}
|
|
64
|
+
return key;
|
|
65
|
+
};
|
|
66
|
+
if (!Object.keys(delta).some((key) => renamed(key) !== key)) return delta;
|
|
67
|
+
const out = {};
|
|
68
|
+
for (const [key, value] of Object.entries(delta)) {
|
|
69
|
+
const to = renamed(key);
|
|
70
|
+
if (to !== key && Object.hasOwn(delta, to)) refuseBoth({
|
|
71
|
+
retired: key,
|
|
72
|
+
current: to
|
|
73
|
+
});
|
|
74
|
+
out[to] = value;
|
|
75
|
+
}
|
|
76
|
+
return out;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* An update's delta that writes the container a retired field moved into (`options`, for `link` at
|
|
80
|
+
* `options.include`) as a whole, with the moved value it holds now carried into the write.
|
|
81
|
+
*
|
|
82
|
+
* Before the move that container never held the field, so a whole write of it from a caller written
|
|
83
|
+
* against the old shape (an old draft patch, an agent) means its other members. The value is kept
|
|
84
|
+
* unless the delta names the field itself, at either path.
|
|
85
|
+
*/
|
|
86
|
+
function keptThroughContainerWrite({ delta, retired, stored }) {
|
|
87
|
+
if (!stored) return delta;
|
|
88
|
+
let kept = delta;
|
|
89
|
+
for (const [old, current] of Object.entries(retired)) {
|
|
90
|
+
const [container, ...inside] = current.split(".");
|
|
91
|
+
if (container === void 0 || inside.length === 0) continue;
|
|
92
|
+
if (!Object.hasOwn(kept, container)) continue;
|
|
93
|
+
const names = (path) => Object.keys(kept).some((key) => key === path || key.startsWith(`${path}.`));
|
|
94
|
+
if (names(old) || names(current)) continue;
|
|
95
|
+
const value = valueAt(stored, current.split("."));
|
|
96
|
+
if (value === void 0) continue;
|
|
97
|
+
const written = kept[container];
|
|
98
|
+
if (written !== null && !isPlainObject(written)) continue;
|
|
99
|
+
if (isPlainObject(written) && valueAt(written, inside) !== void 0) continue;
|
|
100
|
+
kept = {
|
|
101
|
+
...kept,
|
|
102
|
+
[container]: setAtPath(isPlainObject(written) ? written : {}, inside, value)
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
return kept;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* An update's delta that clears a moved field (`'options.include': null`), with its container
|
|
109
|
+
* cleared too when the field is all the stored container holds and the delta writes nothing else
|
|
110
|
+
* into it. Before the move, clearing the field removed it outright; this keeps that from leaving
|
|
111
|
+
* an empty container behind.
|
|
112
|
+
*/
|
|
113
|
+
function withEmptiedContainersCleared({ delta, retired, stored }) {
|
|
114
|
+
if (!stored) return delta;
|
|
115
|
+
let cleared = delta;
|
|
116
|
+
for (const current of Object.values(retired)) {
|
|
117
|
+
const [container, ...inside] = current.split(".");
|
|
118
|
+
if (container === void 0 || inside.length === 0) continue;
|
|
119
|
+
if (cleared[current] !== null || Object.hasOwn(cleared, container)) continue;
|
|
120
|
+
if (Object.keys(cleared).some((key) => key !== current && key.startsWith(`${container}.`))) continue;
|
|
121
|
+
const held = stored[container];
|
|
122
|
+
if (!isPlainObject(held) || Object.keys(without(held, inside)).length > 0) continue;
|
|
123
|
+
cleared = {
|
|
124
|
+
...cleared,
|
|
125
|
+
[container]: null
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
return cleared;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* A delta to apply, without a clear of a moved field whose container the same delta clears
|
|
132
|
+
* (`{ options: null, 'options.include': null }`). The patch keeps both keys, so it says what it
|
|
133
|
+
* clears; applied, the container's clear alone does it, since an update applies declared fields
|
|
134
|
+
* before paths and a removal inside a container that's gone would make the container again.
|
|
135
|
+
*/
|
|
136
|
+
function withoutClearsInsideClears({ delta, retired }) {
|
|
137
|
+
let applied = delta;
|
|
138
|
+
for (const current of Object.values(retired)) {
|
|
139
|
+
const [container] = current.split(".");
|
|
140
|
+
if (container === void 0 || container === current) continue;
|
|
141
|
+
if (applied[container] !== null || applied[current] !== null) continue;
|
|
142
|
+
const { [current]: _inside, ...rest } = applied;
|
|
143
|
+
applied = rest;
|
|
144
|
+
}
|
|
145
|
+
return applied;
|
|
146
|
+
}
|
|
147
|
+
//#endregion
|
|
148
|
+
export { deltaUnderCurrentFields, foldRetiredFields, keptThroughContainerWrite, withEmptiedContainersCleared, withoutClearsInsideClears };
|
|
@@ -15,7 +15,7 @@ import { Patch, SerializedConfig } from "./Config.js";
|
|
|
15
15
|
* sets this constant to its own older timestamp; the merge ref then carries a registered migration
|
|
16
16
|
* newer than the constant, and the assertion fails until the author re-mints.
|
|
17
17
|
*/
|
|
18
|
-
declare const CURRENT_SCHEMA_VERSION =
|
|
18
|
+
declare const CURRENT_SCHEMA_VERSION = 20261105185042;
|
|
19
19
|
/** What the walkers need to see of an envelope — loose on purpose, so a typed `SerializedConfig`
|
|
20
20
|
* and a raw old-shape record both flow in without casts. */
|
|
21
21
|
interface VersionStamped {
|