@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,125 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/migrations/20261105185042_sources_stored.ts
|
|
3
|
+
/**
|
|
4
|
+
* The `linked-system` kind is `source`, and what a source includes is stored as `options.include`
|
|
5
|
+
* rather than `link`.
|
|
6
|
+
*
|
|
7
|
+
* `up` moves the kind's items, groups and overrides to the `source` key, renames it in `ownedKinds`,
|
|
8
|
+
* moves each body's `link` to `options.include`, and renames every ref to one of them: a
|
|
9
|
+
* `{ __ref: 'linked-system:ds' }`, and a `{linked-system:ds}` marker in text or in a key (a guidance
|
|
10
|
+
* body can name a source). `upPatch` does the same to a stored patch: its kind, the refs in its data,
|
|
11
|
+
* and a `link` in its data, whether a whole body or an update's delta (`link`, or a path inside it
|
|
12
|
+
* such as `link.tokens`).
|
|
13
|
+
*
|
|
14
|
+
* The old spellings keep working where they're written: the kind declares `linked-system` as a
|
|
15
|
+
* retired name (`EntityKind.retiredKinds`) and `link` as a retired field (`EntityKind.retiredFields`),
|
|
16
|
+
* so an op, a patch or an authored body that uses either reaches the current one.
|
|
17
|
+
*/
|
|
18
|
+
const SOURCES_STORED_VERSION = 20261105185042;
|
|
19
|
+
const OLD_KIND = "linked-system";
|
|
20
|
+
const NEW_KIND = "source";
|
|
21
|
+
const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
22
|
+
const OLD_PREFIX = `${OLD_KIND}:`;
|
|
23
|
+
const NEW_PREFIX = `${NEW_KIND}:`;
|
|
24
|
+
/** Text with each `{linked-system:…}` marker naming `source`. A ref is split at its first colon, and a
|
|
25
|
+
* marker opens with `{` followed by the kind. */
|
|
26
|
+
const renamedMarkers = (text) => text.includes(`{${OLD_PREFIX}`) ? text.split(`{${OLD_PREFIX}`).join(`{${NEW_PREFIX}`) : text;
|
|
27
|
+
/** `value` with every ref to the old kind renamed, at any depth, keys included. What holds no such
|
|
28
|
+
* ref comes back by reference, so an artifact that never named a source isn't copied. */
|
|
29
|
+
function renamedRefs(value) {
|
|
30
|
+
if (typeof value === "string") return renamedMarkers(value);
|
|
31
|
+
if (Array.isArray(value)) {
|
|
32
|
+
const mapped = value.map(renamedRefs);
|
|
33
|
+
return mapped.some((member, index) => member !== value[index]) ? mapped : value;
|
|
34
|
+
}
|
|
35
|
+
if (!isRecord(value)) return value;
|
|
36
|
+
let changed = false;
|
|
37
|
+
const entries = Object.entries(value).map(([key, member]) => {
|
|
38
|
+
if (key === "__ref" && typeof member === "string") {
|
|
39
|
+
const renamedRef = member.startsWith(OLD_PREFIX) ? `${NEW_PREFIX}${member.slice(OLD_PREFIX.length)}` : member;
|
|
40
|
+
if (renamedRef !== member) changed = true;
|
|
41
|
+
return [key, renamedRef];
|
|
42
|
+
}
|
|
43
|
+
const renamedKey = renamedMarkers(key);
|
|
44
|
+
const renamedMember = renamedRefs(member);
|
|
45
|
+
if (renamedKey !== key || renamedMember !== member) changed = true;
|
|
46
|
+
return [renamedKey, renamedMember];
|
|
47
|
+
});
|
|
48
|
+
return changed ? Object.fromEntries(entries) : value;
|
|
49
|
+
}
|
|
50
|
+
/** A source body with `link` at `options.include`, first among `options`' keys. */
|
|
51
|
+
function withInclude(body) {
|
|
52
|
+
if (!isRecord(body) || !("link" in body)) return body;
|
|
53
|
+
const { link, ...rest } = body;
|
|
54
|
+
if (link === void 0 || link === null) return rest;
|
|
55
|
+
const options = isRecord(rest.options) ? rest.options : {};
|
|
56
|
+
if ("include" in options) return rest;
|
|
57
|
+
return {
|
|
58
|
+
...rest,
|
|
59
|
+
options: {
|
|
60
|
+
include: link,
|
|
61
|
+
...options
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/** `record` with the old kind's entry under the new kind, `transform` applied to each member. */
|
|
66
|
+
function renamedKey(record, transform = (member) => member) {
|
|
67
|
+
if (!isRecord(record) || !(OLD_KIND in record)) return record;
|
|
68
|
+
const { [OLD_KIND]: moved, ...rest } = record;
|
|
69
|
+
const members = isRecord(moved) ? Object.fromEntries(Object.entries(moved).map(([path, member]) => [path, transform(member)])) : moved;
|
|
70
|
+
return {
|
|
71
|
+
...rest,
|
|
72
|
+
[NEW_KIND]: members
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function sourcesStored(json) {
|
|
76
|
+
const ownedKinds = Array.isArray(json.ownedKinds) ? json.ownedKinds.map((kind) => kind === OLD_KIND ? NEW_KIND : kind) : json.ownedKinds;
|
|
77
|
+
return {
|
|
78
|
+
...json,
|
|
79
|
+
...json.ownedKinds === void 0 ? {} : { ownedKinds },
|
|
80
|
+
...json.items === void 0 ? {} : { items: renamedRefs(renamedKey(json.items, withInclude)) },
|
|
81
|
+
...json.groups === void 0 ? {} : { groups: renamedRefs(renamedKey(json.groups)) },
|
|
82
|
+
...json.overrides === void 0 ? {} : { overrides: renamedRefs(renamedKey(json.overrides)) }
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
/** An update's delta with each key naming `link`, or a path inside it, at `options.include`. */
|
|
86
|
+
function renamedDelta(data) {
|
|
87
|
+
if (!isRecord(data)) return data;
|
|
88
|
+
const out = {};
|
|
89
|
+
for (const [key, value] of Object.entries(data)) if (key === "link") out["options.include"] = value;
|
|
90
|
+
else if (key.startsWith("link.")) out[`options.include${key.slice(4)}`] = value;
|
|
91
|
+
else out[key] = value;
|
|
92
|
+
return out;
|
|
93
|
+
}
|
|
94
|
+
const sourcesStoredMigration = {
|
|
95
|
+
version: SOURCES_STORED_VERSION,
|
|
96
|
+
up: sourcesStored,
|
|
97
|
+
fromSchema: z.looseObject({}),
|
|
98
|
+
toSchema: z.looseObject({}).refine((json) => {
|
|
99
|
+
const items = json.items;
|
|
100
|
+
if (!isRecord(items)) return true;
|
|
101
|
+
if (OLD_KIND in items) return false;
|
|
102
|
+
const sources = items[NEW_KIND];
|
|
103
|
+
return !isRecord(sources) || Object.values(sources).every((body) => !isRecord(body) || !("link" in body));
|
|
104
|
+
}, { message: "a source is stored under `source`, with what it includes at `options.include`" }),
|
|
105
|
+
upPatch(written) {
|
|
106
|
+
const refsRenamed = "data" in written ? renamedRefs(written.data) : void 0;
|
|
107
|
+
const patch = "data" in written && refsRenamed !== written.data ? {
|
|
108
|
+
...written,
|
|
109
|
+
data: refsRenamed
|
|
110
|
+
} : written;
|
|
111
|
+
if (patch.kind !== OLD_KIND) return patch;
|
|
112
|
+
const renamed = {
|
|
113
|
+
...patch,
|
|
114
|
+
kind: NEW_KIND
|
|
115
|
+
};
|
|
116
|
+
if (!("data" in renamed) || "field" in renamed) return renamed;
|
|
117
|
+
const data = renamed.operation === "update" ? renamedDelta(renamed.data) : withInclude(renamed.data);
|
|
118
|
+
return {
|
|
119
|
+
...renamed,
|
|
120
|
+
data
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
//#endregion
|
|
125
|
+
export { SOURCES_STORED_VERSION, sourcesStoredMigration };
|
package/dist/spec/links.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { LinkRedirect, linkRedirects, redirectSentence } from "../entities/system/
|
|
1
|
+
import { LinkRedirect, linkRedirects, redirectSentence } from "../entities/system/Source.js";
|
|
2
2
|
export { type LinkRedirect, linkRedirects, redirectSentence };
|
package/dist/spec/links.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { linkRedirects, redirectSentence } from "../entities/system/
|
|
1
|
+
import { linkRedirects, redirectSentence } from "../entities/system/Source.js";
|
|
2
2
|
export { linkRedirects, redirectSentence };
|