@selvajs/selva 4.21.0-beta.17 → 4.21.0-beta.19
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/build/adapter-node.js +1 -1
- package/build/client/_app/immutable/chunks/a5NclWb-.js +2 -0
- package/build/client/_app/immutable/chunks/a5NclWb-.js.br +0 -0
- package/build/client/_app/immutable/chunks/a5NclWb-.js.gz +0 -0
- package/build/client/_app/immutable/entry/{app.CqykPefk.js → app.D3YN7-nC.js} +2 -2
- package/build/client/_app/immutable/entry/app.D3YN7-nC.js.br +0 -0
- package/build/client/_app/immutable/entry/app.D3YN7-nC.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{20.B2EnikH5.js → 20.B8bN-AYw.js} +1 -1
- package/build/client/_app/immutable/nodes/20.B8bN-AYw.js.br +0 -0
- package/build/client/_app/immutable/nodes/20.B8bN-AYw.js.gz +0 -0
- package/build/client/_app/immutable/nodes/{25.C7VDbaM3.js → 25.DbMk0htM.js} +20 -20
- package/build/client/_app/immutable/nodes/25.DbMk0htM.js.br +0 -0
- package/build/client/_app/immutable/nodes/25.DbMk0htM.js.gz +0 -0
- package/build/client/_app/version.json +1 -1
- package/build/client/_app/version.json.br +0 -0
- package/build/client/_app/version.json.gz +0 -0
- package/build/server/.vite/manifest.json +58 -2
- package/build/server/chunks/DefinitionCard.js +1 -1
- package/build/server/chunks/DefinitionCard.js.map +1 -1
- package/build/server/chunks/api.js +1 -1
- package/build/server/chunks/baseHDR.js +5 -0
- package/build/server/chunks/baseHDR.js.map +1 -0
- package/build/server/chunks/capture.js +5 -0
- package/build/server/chunks/capture.js.map +1 -0
- package/build/server/chunks/diff.js +1 -8
- package/build/server/chunks/diff.js.map +1 -1
- package/build/server/chunks/grasshopper.js +23 -1
- package/build/server/chunks/grasshopper.js.map +1 -1
- package/build/server/chunks/handlers.js +71 -25
- package/build/server/chunks/handlers.js.map +1 -1
- package/build/server/chunks/instance.js +3 -3
- package/build/server/chunks/instanceAdmins.server.js +1 -1
- package/build/server/chunks/internal.js +1 -1
- package/build/server/chunks/inventory.js +59 -16
- package/build/server/chunks/inventory.js.map +1 -1
- package/build/server/chunks/package.js +2 -1
- package/build/server/chunks/package.js.map +1 -1
- package/build/server/chunks/path.js +7 -0
- package/build/server/chunks/path.js.map +1 -0
- package/build/server/chunks/presets.server.js +1 -1
- package/build/server/chunks/providers.server.js +21 -12
- package/build/server/chunks/providers.server.js.map +1 -1
- package/build/server/chunks/registry.js +18 -3
- package/build/server/chunks/registry.js.map +1 -1
- package/build/server/chunks/solve.js +5 -0
- package/build/server/chunks/solve.js.map +1 -0
- package/build/server/chunks/stash-instance.js +94 -0
- package/build/server/chunks/stash-instance.js.map +1 -0
- package/build/server/chunks/sveltekit.js +2 -1
- package/build/server/chunks/sveltekit.js.map +1 -1
- package/build/server/chunks/types4.js +10 -0
- package/build/server/chunks/types4.js.map +1 -0
- package/build/server/entries/endpoints/api/admin/users/_id_/disable/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/definitions/_guid_/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/definitions/_guid_/image/_server.ts.js +3 -2
- package/build/server/entries/endpoints/api/v1/definitions/_guid_/image/_server.ts.js.map +1 -1
- package/build/server/entries/endpoints/api/v1/definitions/_guid_/publish/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/definitions/_guid_/schema/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/definitions/_guid_/share-links/_linkId_/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/definitions/_guid_/share-links/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/definitions/_guid_/versions/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/definitions/_guid_/versions/_versionId_/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/definitions/_guid_/versions/_versionId_/changes/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/definitions/_guid_/versions/_versionId_/inventory/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/definitions/_guid_/versions/_versionId_/schema/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/definitions/_guid_/versions/_versionId_/scripts/_scriptId_/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/definitions/_guid_/versions/check/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/definitions/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/me/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/me/starred/_guid_/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/me/token/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/orgs/_orgId_/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/orgs/_orgId_/assets/_kind_/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/orgs/_orgId_/members/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/orgs/_orgId_/members/_userId_/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/orgs/_orgId_/tokens/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/orgs/_orgId_/tokens/_tokenId_/_server.ts.js +1 -1
- package/build/server/entries/endpoints/api/v1/projects/_id_/reclaim/_server.ts.js +1 -1
- package/build/server/entries/endpoints/docs/api/openapi.yaml/_server.ts.js +1 -1
- package/build/server/entries/endpoints/mcp/_server.ts.js +1232 -92
- package/build/server/entries/endpoints/mcp/_server.ts.js.map +1 -1
- package/build/server/entries/endpoints/mcp/files/_token_/_name_/_server.ts.js +18 -0
- package/build/server/entries/endpoints/mcp/files/_token_/_name_/_server.ts.js.map +1 -0
- package/build/server/entries/hooks.server.js +8 -3
- package/build/server/entries/hooks.server.js.map +1 -1
- package/build/server/entries/pages/projects/_page.svelte.js +12 -6
- package/build/server/entries/pages/projects/_page.svelte.js.map +1 -1
- package/build/server/entries/pages/team/tokens/_page.server.ts.js +1 -1
- package/build/server/manifest-full.js +8 -1
- package/build/server/manifest.js +8 -1
- package/build/server/nodes/20.js +1 -1
- package/build/server/nodes/25.js +1 -1
- package/build/server/server.js +8 -1
- package/package.json +7 -6
- package/templates/.env.example +6 -0
- package/build/client/_app/immutable/chunks/Cv7GBWJh.js +0 -2
- package/build/client/_app/immutable/chunks/Cv7GBWJh.js.br +0 -0
- package/build/client/_app/immutable/chunks/Cv7GBWJh.js.gz +0 -0
- package/build/client/_app/immutable/entry/app.CqykPefk.js.br +0 -0
- package/build/client/_app/immutable/entry/app.CqykPefk.js.gz +0 -0
- package/build/client/_app/immutable/nodes/20.B2EnikH5.js.br +0 -0
- package/build/client/_app/immutable/nodes/20.B2EnikH5.js.gz +0 -0
- package/build/client/_app/immutable/nodes/25.C7VDbaM3.js.br +0 -0
- package/build/client/_app/immutable/nodes/25.C7VDbaM3.js.gz +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capture.js","names":[],"sources":[],"mappings":""}
|
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
import { t as getGroups } from "./traversal.js";
|
|
2
|
-
// ../platform/src/shareLinks/types.ts
|
|
3
|
-
/**
|
|
4
|
-
* Default cap applied when the minter doesn't specify one. Tokens are
|
|
5
|
-
* leak-prone by design (visible in iframes), so a default bounds the
|
|
6
|
-
* worst-case denial-of-wallet damage.
|
|
7
|
-
*/
|
|
8
|
-
var DEFAULT_SHARE_LINK_MAX_SOLVES = 1e3;
|
|
9
2
|
// ../schemas/src/diff.ts
|
|
10
3
|
var IMPACT_RANK = {
|
|
11
4
|
breaking: 0,
|
|
@@ -270,6 +263,6 @@ function list(items) {
|
|
|
270
263
|
function capitalize(s) {
|
|
271
264
|
return s.charAt(0).toUpperCase() + s.slice(1);
|
|
272
265
|
}
|
|
273
|
-
export { schemaDiffToMarkdown as n,
|
|
266
|
+
export { schemaDiffToMarkdown as n, diffSchemas as t };
|
|
274
267
|
|
|
275
268
|
//# sourceMappingURL=diff.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff.js","names":[],"sources":["../../../../platform/src/shareLinks/types.ts","../../../../schemas/src/diff.ts"],"sourcesContent":["import type { DefinitionChannel } from '../definitions/types.js';\n\n/**\n * Per-definition token granting access to one (definitionId, channel)\n * without an account. The plaintext token is shown to the minter exactly\n * once; `tokenHash` is the HMAC stored at rest.\n */\nexport interface ShareLink {\n\tid: string;\n\tdefinitionId: string;\n\tchannel: DefinitionChannel;\n\ttokenHash: string;\n\t/** e.g. \"Demo for Acme\". */\n\tname?: string;\n\tcreatedBy: string;\n\tcreatedAt: string;\n\t/** Null = never expires. */\n\texpiresAt?: string | null;\n\t/** Non-null = revoked. */\n\trevokedAt?: string | null;\n\t/** false = view/schema only; true = solve allowed. */\n\tallowSolve: boolean;\n\t/** Null = unlimited. */\n\tmaxSolves?: number | null;\n\tsolveCount: number;\n}\n\n/**\n * A share link plus the definition and project it hangs off.\n *\n * The org-wide roster is the one read where the parent matters: `definitionId`\n * alone identifies nothing a person can recognize, and revoking the wrong link\n * is unrecoverable — the raw token is gone.\n *\n * `tokenHash` is omitted, not merely unused. This is the only share-link shape\n * built for a page, and the roster spans every definition in the org — so a\n * careless `JSON.stringify` here would ship every credential digest in the\n * tenant to the browser at once.\n */\nexport interface OrgShareLink extends Omit<ShareLink, 'tokenHash'> {\n\tdefinitionName: string;\n\tprojectId: string;\n\tprojectName: string;\n}\n\n/**\n * Default cap applied when the minter doesn't specify one. Tokens are\n * leak-prone by design (visible in iframes), so a default bounds the\n * worst-case denial-of-wallet damage.\n */\nexport const DEFAULT_SHARE_LINK_MAX_SOLVES = 1000;\n\n/**\n * Days until a link minted without an expiry stops working. A link that never\n * expires outlives the key it was hashed under and anyone's memory of handing\n * it out; the minter can still pass `expiresAt: null` deliberately.\n */\nexport const DEFAULT_SHARE_LINK_TTL_DAYS = 90;\n","// What changed between two versions of a definition, as its users feel it.\n//\n// Inputs and outputs are matched by parameter id (the Grasshopper InstanceGuid), not by name:\n// a renamed slider is the same input, and a deleted-then-recreated one is a different input even\n// with the same name, because saved values, presets, share links and API callers key on the id.\n//\n// Impact is judged from the caller's side:\n// breaking: something that worked before can now fail or mean something else (an input or\n// output gone, a type or structure changed, an option or range that a saved value\n// may still use removed)\n// notable: behaviour changes but old values still apply (new inputs, new defaults, wider range)\n// cosmetic: wording, order and layout only\n\nimport type {\n\tGroupConfig,\n\tInputLayoutItem,\n\tLayoutItem,\n\tSchemaInput,\n\tSchemaOutput,\n\tUISchema\n} from './generated/index.js';\nimport { getGroups } from './traversal.js';\n\nexport type SchemaChangeImpact = 'breaking' | 'notable' | 'cosmetic';\n\nexport interface SchemaChange {\n\tkind: 'input' | 'output' | 'settings';\n\tchange: 'added' | 'removed' | 'changed';\n\t/** Parameter id for inputs and outputs; the setting's name for settings. */\n\tid: string;\n\t/** What the form shows: the layout item's display name, else the Grasshopper nickname. */\n\tlabel: string;\n\timpact: SchemaChangeImpact;\n\t/** One line per difference, e.g. `default 10 → 12`. Empty for added and removed. */\n\tdetails: string[];\n}\n\nexport interface SchemaDiff {\n\t/** Breaking first, then notable, then cosmetic; inputs before outputs before settings. */\n\tchanges: SchemaChange[];\n\tcounts: Record<SchemaChangeImpact, number>;\n\t/** No difference a user can see. The Grasshopper logic behind the form may still differ. */\n\tidentical: boolean;\n}\n\nconst IMPACT_RANK: Record<SchemaChangeImpact, number> = { breaking: 0, notable: 1, cosmetic: 2 };\nconst KIND_RANK: Record<SchemaChange['kind'], number> = { input: 0, output: 1, settings: 2 };\n\nexport function diffSchemas(before: UISchema, after: UISchema): SchemaDiff {\n\tconst changes = [\n\t\t...diffInputs(before, after),\n\t\t...diffOutputs(before, after),\n\t\t...diffSettings(before, after)\n\t].sort(\n\t\t(a, b) => IMPACT_RANK[a.impact] - IMPACT_RANK[b.impact] || KIND_RANK[a.kind] - KIND_RANK[b.kind]\n\t);\n\tconst counts = { breaking: 0, notable: 0, cosmetic: 0 };\n\tfor (const c of changes) counts[c.impact] += 1;\n\treturn { changes, counts, identical: changes.length === 0 };\n}\n\n// ============================================================================\n// Inputs\n// ============================================================================\n\ninterface Placed {\n\titem: LayoutItem;\n\tgroup: string;\n}\n\n/** The first layout item per parameter, with the label of the group it sits in. */\nfunction placements(schema: UISchema, type: 'input' | 'output'): Map<string, Placed> {\n\tconst out = new Map<string, Placed>();\n\tfor (const group of getGroups(schema) as GroupConfig[]) {\n\t\tfor (const item of group.items ?? []) {\n\t\t\tif (item.type !== type || !('paramId' in item) || out.has(item.paramId)) continue;\n\t\t\tout.set(item.paramId, { item, group: group.label });\n\t\t}\n\t}\n\treturn out;\n}\n\nfunction labelOf(nickname: string, placed: Placed | undefined): string {\n\tconst display =\n\t\tplaced?.item && 'displayName' in placed.item ? placed.item.displayName : undefined;\n\treturn (typeof display === 'string' && display.trim()) || nickname || 'Unnamed';\n}\n\nfunction diffInputs(before: UISchema, after: UISchema): SchemaChange[] {\n\tconst oldInputs = byId(before.inputs);\n\tconst newInputs = byId(after.inputs);\n\tconst oldPlaced = placements(before, 'input');\n\tconst newPlaced = placements(after, 'input');\n\tconst changes: SchemaChange[] = [];\n\n\tfor (const [id, input] of oldInputs) {\n\t\tif (newInputs.has(id)) continue;\n\t\tchanges.push(\n\t\t\twhole('input', 'removed', id, labelOf(input.nickname, oldPlaced.get(id)), 'breaking')\n\t\t);\n\t}\n\tfor (const [id, input] of newInputs) {\n\t\tconst label = labelOf(input.nickname, newPlaced.get(id));\n\t\tconst old = oldInputs.get(id);\n\t\tif (!old) {\n\t\t\tchanges.push(whole('input', 'added', id, label, 'notable'));\n\t\t\tcontinue;\n\t\t}\n\t\tconst found = compareInput(old, input, oldPlaced.get(id), newPlaced.get(id));\n\t\tif (found.length > 0) changes.push(changed('input', id, label, found));\n\t}\n\treturn changes;\n}\n\ntype Finding = [SchemaChangeImpact, string];\n\nfunction compareInput(\n\ta: SchemaInput,\n\tb: SchemaInput,\n\tpa: Placed | undefined,\n\tpb: Placed | undefined\n): Finding[] {\n\tconst found: Finding[] = [];\n\tif (a.paramType !== b.paramType) found.push(['breaking', `type ${a.paramType} → ${b.paramType}`]);\n\tconst sa = a.inputStructure ?? 'item';\n\tconst sb = b.inputStructure ?? 'item';\n\tif (sa !== sb) found.push(['breaking', `takes ${sa} → ${sb}`]);\n\tif (!same(a.default, b.default)) {\n\t\tfound.push(['notable', `default ${show(a.default)} → ${show(b.default)}`]);\n\t}\n\n\tconst ia = pa?.item as InputLayoutItem | undefined;\n\tconst ib = pb?.item as InputLayoutItem | undefined;\n\tif (ia && ib) {\n\t\tconst kindA = ia.source?.kind ?? 'user';\n\t\tconst kindB = ib.source?.kind ?? 'user';\n\t\tif (kindA !== kindB) found.push(['breaking', `filled by ${kindA} → ${kindB}`]);\n\t\tif (ia.widgetType !== ib.widgetType) {\n\t\t\tfound.push(['notable', `shown as ${ia.widgetType} → ${ib.widgetType}`]);\n\t\t}\n\t\tfound.push(...compareInputConfig(ia, ib));\n\t\tfound.push(...compareShared(ia, ib, pa!.group, pb!.group));\n\t} else if (!ia !== !ib) {\n\t\tfound.push(['notable', ib ? 'now on the form' : 'no longer on the form']);\n\t}\n\tif (a.nickname !== b.nickname && !(ia?.displayName || ib?.displayName)) {\n\t\tfound.push(['cosmetic', `renamed ${a.nickname} → ${b.nickname}`]);\n\t}\n\treturn found;\n}\n\nfunction compareInputConfig(a: InputLayoutItem, b: InputLayoutItem): Finding[] {\n\tconst ca = (a.config ?? {}) as Record<string, unknown>;\n\tconst cb = (b.config ?? {}) as Record<string, unknown>;\n\tconst found: Finding[] = [];\n\n\tif (a.widgetType === 'number' && b.widgetType === 'number') {\n\t\tconst [minA, maxA] = [num(ca.minimum), num(ca.maximum)];\n\t\tconst [minB, maxB] = [num(cb.minimum), num(cb.maximum)];\n\t\tif (minA !== minB || maxA !== maxB) {\n\t\t\t// A saved value inside the old range may sit outside a narrower one.\n\t\t\tconst narrower =\n\t\t\t\t(minB !== undefined && (minA === undefined || minB > minA)) ||\n\t\t\t\t(maxB !== undefined && (maxA === undefined || maxB < maxA));\n\t\t\tfound.push([\n\t\t\t\tnarrower ? 'breaking' : 'notable',\n\t\t\t\t`range ${range(minA, maxA)} → ${range(minB, maxB)}${narrower ? ' (narrower)' : ''}`\n\t\t\t]);\n\t\t}\n\t\tif (num(ca.stepSize) !== num(cb.stepSize)) {\n\t\t\tfound.push(['notable', `step ${show(ca.stepSize)} → ${show(cb.stepSize)}`]);\n\t\t}\n\t}\n\n\tconst optsA = options(a);\n\tconst optsB = options(b);\n\tif (optsA && optsB) {\n\t\tconst removed = [...optsA.keys()].filter((k) => !optsB.has(k));\n\t\tconst added = [...optsB.keys()].filter((k) => !optsA.has(k));\n\t\tconst revalued = [...optsB.keys()].filter((k) => optsA.has(k) && optsA.get(k) !== optsB.get(k));\n\t\t// A saved pick of a removed option no longer matches anything.\n\t\tif (removed.length) found.push(['breaking', `options removed: ${list(removed)}`]);\n\t\tif (added.length) found.push(['notable', `options added: ${list(added)}`]);\n\t\tif (revalued.length) found.push(['notable', `option values changed: ${list(revalued)}`]);\n\t}\n\n\tfor (const key of ['displayAs', 'required', 'maxLength', 'pattern', 'acceptedFormats'] as const) {\n\t\tif (!same(ca[key], cb[key]))\n\t\t\tfound.push(['notable', `${key} ${show(ca[key])} → ${show(cb[key])}`]);\n\t}\n\treturn found;\n}\n\n/** Dropdown options, or a dynamic list's seed options: name → value. */\nfunction options(item: InputLayoutItem): Map<string, string> | null {\n\tconst config = (item.config ?? {}) as Record<string, unknown>;\n\tconst raw =\n\t\titem.widgetType === 'dropdown'\n\t\t\t? config.options\n\t\t\t: item.widgetType === 'dynamicValueList'\n\t\t\t\t? config.defaultOptions\n\t\t\t\t: undefined;\n\tif (!raw || typeof raw !== 'object') return null;\n\treturn new Map(Object.entries(raw as Record<string, string>).map(([k, v]) => [k, String(v)]));\n}\n\n// ============================================================================\n// Outputs\n// ============================================================================\n\nfunction diffOutputs(before: UISchema, after: UISchema): SchemaChange[] {\n\tconst oldOutputs = byId(before.outputs);\n\tconst newOutputs = byId(after.outputs);\n\tconst oldPlaced = placements(before, 'output');\n\tconst newPlaced = placements(after, 'output');\n\tconst changes: SchemaChange[] = [];\n\n\tfor (const [id, output] of oldOutputs) {\n\t\tif (newOutputs.has(id)) continue;\n\t\tchanges.push(\n\t\t\twhole('output', 'removed', id, labelOf(output.nickname, oldPlaced.get(id)), 'breaking')\n\t\t);\n\t}\n\tfor (const [id, output] of newOutputs) {\n\t\tconst label = labelOf(output.nickname, newPlaced.get(id));\n\t\tconst old = oldOutputs.get(id);\n\t\tif (!old) {\n\t\t\tchanges.push(whole('output', 'added', id, label, 'notable'));\n\t\t\tcontinue;\n\t\t}\n\t\tconst found = compareOutput(old, output, oldPlaced.get(id), newPlaced.get(id));\n\t\tif (found.length > 0) changes.push(changed('output', id, label, found));\n\t}\n\treturn changes;\n}\n\nfunction compareOutput(\n\ta: SchemaOutput,\n\tb: SchemaOutput,\n\tpa: Placed | undefined,\n\tpb: Placed | undefined\n): Finding[] {\n\tconst found: Finding[] = [];\n\tif (a.type !== b.type) found.push(['breaking', `type ${a.type} → ${b.type}`]);\n\tif (pa && pb) {\n\t\tconst wa = (pa.item as { widgetType?: string }).widgetType;\n\t\tconst wb = (pb.item as { widgetType?: string }).widgetType;\n\t\tif (wa !== wb) found.push(['notable', `shown as ${wa} → ${wb}`]);\n\t\tfound.push(...compareShared(pa.item, pb.item, pa.group, pb.group));\n\t} else if (!pa !== !pb) {\n\t\tfound.push(['notable', pb ? 'now on the page' : 'no longer on the page']);\n\t}\n\tif (a.nickname !== b.nickname) found.push(['cosmetic', `renamed ${a.nickname} → ${b.nickname}`]);\n\treturn found;\n}\n\n/** What inputs and outputs share: visibility, label, help text, group. */\nfunction compareShared(a: LayoutItem, b: LayoutItem, groupA: string, groupB: string): Finding[] {\n\tconst ia = a as Record<string, unknown>;\n\tconst ib = b as Record<string, unknown>;\n\tconst found: Finding[] = [];\n\tif ((ia.visible ?? true) !== (ib.visible ?? true)) {\n\t\tfound.push(['notable', ib.visible === false ? 'now hidden' : 'now shown']);\n\t}\n\tif (!same(ia.visibilityCondition, ib.visibilityCondition)) {\n\t\tfound.push(['notable', 'show/hide rule changed']);\n\t}\n\tif ((ia.displayName ?? '') !== (ib.displayName ?? '')) {\n\t\tfound.push(['cosmetic', `label ${show(ia.displayName)} → ${show(ib.displayName)}`]);\n\t}\n\tif ((ia.description ?? '') !== (ib.description ?? ''))\n\t\tfound.push(['cosmetic', 'help text changed']);\n\tif (groupA !== groupB) found.push(['cosmetic', `moved ${groupA} → ${groupB}`]);\n\treturn found;\n}\n\n// ============================================================================\n// Settings\n// ============================================================================\n\nfunction diffSettings(before: UISchema, after: UISchema): SchemaChange[] {\n\tconst changes: SchemaChange[] = [];\n\tconst setting = (\n\t\tid: string,\n\t\tlabel: string,\n\t\timpact: SchemaChangeImpact,\n\t\ta: unknown,\n\t\tb: unknown\n\t) => {\n\t\tif (!same(a, b))\n\t\t\tchanges.push(changed('settings', id, label, [[impact, `${show(a)} → ${show(b)}`]]));\n\t};\n\tsetting(\n\t\t'instanceSolve',\n\t\t'Solve on every change',\n\t\t'notable',\n\t\tbefore.instanceSolve ?? true,\n\t\tafter.instanceSolve ?? true\n\t);\n\tsetting(\n\t\t'previewSolves',\n\t\t'Preview solves',\n\t\t'notable',\n\t\tbefore.previewSolves ?? false,\n\t\tafter.previewSolves ?? false\n\t);\n\tsetting(\n\t\t'viewer',\n\t\t'3D viewer',\n\t\t'notable',\n\t\tbefore.viewerOptions?.enableRemote ?? false,\n\t\tafter.viewerOptions?.enableRemote ?? false\n\t);\n\tsetting('name', 'Name', 'cosmetic', before.name, after.name);\n\tsetting(\n\t\t'description',\n\t\t'Description',\n\t\t'cosmetic',\n\t\tbefore.description ?? '',\n\t\tafter.description ?? ''\n\t);\n\n\tconst tabsA = layoutLabels(before);\n\tconst tabsB = layoutLabels(after);\n\tif (!same(tabsA, tabsB)) {\n\t\tchanges.push(\n\t\t\tchanged('settings', 'layout', 'Layout', [['cosmetic', `${list(tabsA)} → ${list(tabsB)}`]])\n\t\t);\n\t}\n\treturn changes;\n}\n\n/** Tab labels for a tabbed layout, group labels for a flat one. */\nfunction layoutLabels(schema: UISchema): string[] {\n\tconst layout = schema.layout;\n\tif (layout?.type === 'tabbed') return (layout.tabs ?? []).map((t) => t.label);\n\treturn getGroups(schema).map((g) => g.label);\n}\n\n// ============================================================================\n// Markdown\n// ============================================================================\n\nconst HEADINGS: Record<SchemaChangeImpact, string> = {\n\tbreaking: 'Breaking',\n\tnotable: 'Changes',\n\tcosmetic: 'Cosmetic'\n};\n\n/** The diff as Markdown, to start a version's notes from. Empty for an identical diff. */\nexport function schemaDiffToMarkdown(diff: SchemaDiff): string {\n\tconst sections: string[] = [];\n\tfor (const impact of ['breaking', 'notable', 'cosmetic'] as const) {\n\t\tconst lines = diff.changes.filter((c) => c.impact === impact).map(changeLine);\n\t\tif (lines.length) sections.push(`### ${HEADINGS[impact]}\\n\\n${lines.join('\\n')}`);\n\t}\n\treturn sections.join('\\n\\n');\n}\n\n/** `Removed input **Width**`, `Input **Width**: default 10 → 12`, `Preview solves: false → true`. */\nfunction changeLine(c: SchemaChange): string {\n\tif (c.change !== 'changed') return `- ${capitalize(c.change)} ${c.kind} **${c.label}**`;\n\tconst subject = c.kind === 'settings' ? c.label : `${capitalize(c.kind)} **${c.label}**`;\n\treturn `- ${subject}: ${c.details.join('; ')}`;\n}\n\n// ============================================================================\n// Helpers\n// ============================================================================\n\nfunction byId<T extends { id: string }>(items: T[] | undefined): Map<string, T> {\n\treturn new Map((items ?? []).map((i) => [i.id, i]));\n}\n\nfunction whole(\n\tkind: SchemaChange['kind'],\n\tchange: 'added' | 'removed',\n\tid: string,\n\tlabel: string,\n\timpact: SchemaChangeImpact\n): SchemaChange {\n\treturn { kind, change, id, label, impact, details: [] };\n}\n\nfunction changed(\n\tkind: SchemaChange['kind'],\n\tid: string,\n\tlabel: string,\n\tfound: Finding[]\n): SchemaChange {\n\tconst impact = found.reduce<SchemaChangeImpact>(\n\t\t(worst, [i]) => (IMPACT_RANK[i] < IMPACT_RANK[worst] ? i : worst),\n\t\t'cosmetic'\n\t);\n\treturn { kind, change: 'changed', id, label, impact, details: found.map(([, d]) => d) };\n}\n\nfunction same(a: unknown, b: unknown): boolean {\n\treturn stableJson(a) === stableJson(b);\n}\n\nfunction stableJson(value: unknown): string {\n\tif (value === undefined) return 'undefined';\n\treturn JSON.stringify(value, (_k, v) =>\n\t\tv && typeof v === 'object' && !Array.isArray(v)\n\t\t\t? Object.fromEntries(Object.entries(v).sort(([x], [y]) => (x < y ? -1 : x > y ? 1 : 0)))\n\t\t\t: v\n\t);\n}\n\nfunction show(value: unknown): string {\n\tif (value === undefined || value === null || value === '') return 'none';\n\tconst text = typeof value === 'string' ? value : stableJson(value);\n\treturn text.length > 40 ? `${text.slice(0, 39)}…` : text;\n}\n\nfunction num(value: unknown): number | undefined {\n\treturn typeof value === 'number' && Number.isFinite(value) ? value : undefined;\n}\n\nfunction range(min: number | undefined, max: number | undefined): string {\n\treturn `${min ?? '−∞'}–${max ?? '∞'}`;\n}\n\nfunction list(items: string[]): string {\n\tconst shown = items.slice(0, 5).join(', ');\n\treturn items.length > 5 ? `${shown} and ${items.length - 5} more` : shown || 'none';\n}\n\nfunction capitalize(s: string): string {\n\treturn s.charAt(0).toUpperCase() + s.slice(1);\n}\n"],"mappings":";;;;;;;AAkDA,IAAa,gCAAgC;;ACL7C,IAAM,cAAkD;CAAE,UAAU;CAAG,SAAS;CAAG,UAAU;AAAE;AAC/F,IAAM,YAAkD;CAAE,OAAO;CAAG,QAAQ;CAAG,UAAU;AAAE;AAE3F,SAAgB,YAAY,QAAkB,OAA6B;CAC1E,MAAM,UAAU;EACf,GAAG,WAAW,QAAQ,KAAK;EAC3B,GAAG,YAAY,QAAQ,KAAK;EAC5B,GAAG,aAAa,QAAQ,KAAK;CAC9B,CAAC,CAAC,MACA,GAAG,MAAM,YAAY,EAAE,UAAU,YAAY,EAAE,WAAW,UAAU,EAAE,QAAQ,UAAU,EAAE,KAC5F;CACA,MAA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,OAAO,MAAM,SAAS,IAAI,GAAG,MAAM,OAAO,MAAM,SAAS,EAAE,SAAS,SAAS;AAC9E;AAEA,SAAS,WAAW,GAAmB;CACtC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,EAAE,MAAM,CAAC;AAC7C"}
|
|
1
|
+
{"version":3,"file":"diff.js","names":[],"sources":["../../../../schemas/src/diff.ts"],"sourcesContent":["// What changed between two versions of a definition, as its users feel it.\n//\n// Inputs and outputs are matched by parameter id (the Grasshopper InstanceGuid), not by name:\n// a renamed slider is the same input, and a deleted-then-recreated one is a different input even\n// with the same name, because saved values, presets, share links and API callers key on the id.\n//\n// Impact is judged from the caller's side:\n// breaking: something that worked before can now fail or mean something else (an input or\n// output gone, a type or structure changed, an option or range that a saved value\n// may still use removed)\n// notable: behaviour changes but old values still apply (new inputs, new defaults, wider range)\n// cosmetic: wording, order and layout only\n\nimport type {\n\tGroupConfig,\n\tInputLayoutItem,\n\tLayoutItem,\n\tSchemaInput,\n\tSchemaOutput,\n\tUISchema\n} from './generated/index.js';\nimport { getGroups } from './traversal.js';\n\nexport type SchemaChangeImpact = 'breaking' | 'notable' | 'cosmetic';\n\nexport interface SchemaChange {\n\tkind: 'input' | 'output' | 'settings';\n\tchange: 'added' | 'removed' | 'changed';\n\t/** Parameter id for inputs and outputs; the setting's name for settings. */\n\tid: string;\n\t/** What the form shows: the layout item's display name, else the Grasshopper nickname. */\n\tlabel: string;\n\timpact: SchemaChangeImpact;\n\t/** One line per difference, e.g. `default 10 → 12`. Empty for added and removed. */\n\tdetails: string[];\n}\n\nexport interface SchemaDiff {\n\t/** Breaking first, then notable, then cosmetic; inputs before outputs before settings. */\n\tchanges: SchemaChange[];\n\tcounts: Record<SchemaChangeImpact, number>;\n\t/** No difference a user can see. The Grasshopper logic behind the form may still differ. */\n\tidentical: boolean;\n}\n\nconst IMPACT_RANK: Record<SchemaChangeImpact, number> = { breaking: 0, notable: 1, cosmetic: 2 };\nconst KIND_RANK: Record<SchemaChange['kind'], number> = { input: 0, output: 1, settings: 2 };\n\nexport function diffSchemas(before: UISchema, after: UISchema): SchemaDiff {\n\tconst changes = [\n\t\t...diffInputs(before, after),\n\t\t...diffOutputs(before, after),\n\t\t...diffSettings(before, after)\n\t].sort(\n\t\t(a, b) => IMPACT_RANK[a.impact] - IMPACT_RANK[b.impact] || KIND_RANK[a.kind] - KIND_RANK[b.kind]\n\t);\n\tconst counts = { breaking: 0, notable: 0, cosmetic: 0 };\n\tfor (const c of changes) counts[c.impact] += 1;\n\treturn { changes, counts, identical: changes.length === 0 };\n}\n\n// ============================================================================\n// Inputs\n// ============================================================================\n\ninterface Placed {\n\titem: LayoutItem;\n\tgroup: string;\n}\n\n/** The first layout item per parameter, with the label of the group it sits in. */\nfunction placements(schema: UISchema, type: 'input' | 'output'): Map<string, Placed> {\n\tconst out = new Map<string, Placed>();\n\tfor (const group of getGroups(schema) as GroupConfig[]) {\n\t\tfor (const item of group.items ?? []) {\n\t\t\tif (item.type !== type || !('paramId' in item) || out.has(item.paramId)) continue;\n\t\t\tout.set(item.paramId, { item, group: group.label });\n\t\t}\n\t}\n\treturn out;\n}\n\nfunction labelOf(nickname: string, placed: Placed | undefined): string {\n\tconst display =\n\t\tplaced?.item && 'displayName' in placed.item ? placed.item.displayName : undefined;\n\treturn (typeof display === 'string' && display.trim()) || nickname || 'Unnamed';\n}\n\nfunction diffInputs(before: UISchema, after: UISchema): SchemaChange[] {\n\tconst oldInputs = byId(before.inputs);\n\tconst newInputs = byId(after.inputs);\n\tconst oldPlaced = placements(before, 'input');\n\tconst newPlaced = placements(after, 'input');\n\tconst changes: SchemaChange[] = [];\n\n\tfor (const [id, input] of oldInputs) {\n\t\tif (newInputs.has(id)) continue;\n\t\tchanges.push(\n\t\t\twhole('input', 'removed', id, labelOf(input.nickname, oldPlaced.get(id)), 'breaking')\n\t\t);\n\t}\n\tfor (const [id, input] of newInputs) {\n\t\tconst label = labelOf(input.nickname, newPlaced.get(id));\n\t\tconst old = oldInputs.get(id);\n\t\tif (!old) {\n\t\t\tchanges.push(whole('input', 'added', id, label, 'notable'));\n\t\t\tcontinue;\n\t\t}\n\t\tconst found = compareInput(old, input, oldPlaced.get(id), newPlaced.get(id));\n\t\tif (found.length > 0) changes.push(changed('input', id, label, found));\n\t}\n\treturn changes;\n}\n\ntype Finding = [SchemaChangeImpact, string];\n\nfunction compareInput(\n\ta: SchemaInput,\n\tb: SchemaInput,\n\tpa: Placed | undefined,\n\tpb: Placed | undefined\n): Finding[] {\n\tconst found: Finding[] = [];\n\tif (a.paramType !== b.paramType) found.push(['breaking', `type ${a.paramType} → ${b.paramType}`]);\n\tconst sa = a.inputStructure ?? 'item';\n\tconst sb = b.inputStructure ?? 'item';\n\tif (sa !== sb) found.push(['breaking', `takes ${sa} → ${sb}`]);\n\tif (!same(a.default, b.default)) {\n\t\tfound.push(['notable', `default ${show(a.default)} → ${show(b.default)}`]);\n\t}\n\n\tconst ia = pa?.item as InputLayoutItem | undefined;\n\tconst ib = pb?.item as InputLayoutItem | undefined;\n\tif (ia && ib) {\n\t\tconst kindA = ia.source?.kind ?? 'user';\n\t\tconst kindB = ib.source?.kind ?? 'user';\n\t\tif (kindA !== kindB) found.push(['breaking', `filled by ${kindA} → ${kindB}`]);\n\t\tif (ia.widgetType !== ib.widgetType) {\n\t\t\tfound.push(['notable', `shown as ${ia.widgetType} → ${ib.widgetType}`]);\n\t\t}\n\t\tfound.push(...compareInputConfig(ia, ib));\n\t\tfound.push(...compareShared(ia, ib, pa!.group, pb!.group));\n\t} else if (!ia !== !ib) {\n\t\tfound.push(['notable', ib ? 'now on the form' : 'no longer on the form']);\n\t}\n\tif (a.nickname !== b.nickname && !(ia?.displayName || ib?.displayName)) {\n\t\tfound.push(['cosmetic', `renamed ${a.nickname} → ${b.nickname}`]);\n\t}\n\treturn found;\n}\n\nfunction compareInputConfig(a: InputLayoutItem, b: InputLayoutItem): Finding[] {\n\tconst ca = (a.config ?? {}) as Record<string, unknown>;\n\tconst cb = (b.config ?? {}) as Record<string, unknown>;\n\tconst found: Finding[] = [];\n\n\tif (a.widgetType === 'number' && b.widgetType === 'number') {\n\t\tconst [minA, maxA] = [num(ca.minimum), num(ca.maximum)];\n\t\tconst [minB, maxB] = [num(cb.minimum), num(cb.maximum)];\n\t\tif (minA !== minB || maxA !== maxB) {\n\t\t\t// A saved value inside the old range may sit outside a narrower one.\n\t\t\tconst narrower =\n\t\t\t\t(minB !== undefined && (minA === undefined || minB > minA)) ||\n\t\t\t\t(maxB !== undefined && (maxA === undefined || maxB < maxA));\n\t\t\tfound.push([\n\t\t\t\tnarrower ? 'breaking' : 'notable',\n\t\t\t\t`range ${range(minA, maxA)} → ${range(minB, maxB)}${narrower ? ' (narrower)' : ''}`\n\t\t\t]);\n\t\t}\n\t\tif (num(ca.stepSize) !== num(cb.stepSize)) {\n\t\t\tfound.push(['notable', `step ${show(ca.stepSize)} → ${show(cb.stepSize)}`]);\n\t\t}\n\t}\n\n\tconst optsA = options(a);\n\tconst optsB = options(b);\n\tif (optsA && optsB) {\n\t\tconst removed = [...optsA.keys()].filter((k) => !optsB.has(k));\n\t\tconst added = [...optsB.keys()].filter((k) => !optsA.has(k));\n\t\tconst revalued = [...optsB.keys()].filter((k) => optsA.has(k) && optsA.get(k) !== optsB.get(k));\n\t\t// A saved pick of a removed option no longer matches anything.\n\t\tif (removed.length) found.push(['breaking', `options removed: ${list(removed)}`]);\n\t\tif (added.length) found.push(['notable', `options added: ${list(added)}`]);\n\t\tif (revalued.length) found.push(['notable', `option values changed: ${list(revalued)}`]);\n\t}\n\n\tfor (const key of ['displayAs', 'required', 'maxLength', 'pattern', 'acceptedFormats'] as const) {\n\t\tif (!same(ca[key], cb[key]))\n\t\t\tfound.push(['notable', `${key} ${show(ca[key])} → ${show(cb[key])}`]);\n\t}\n\treturn found;\n}\n\n/** Dropdown options, or a dynamic list's seed options: name → value. */\nfunction options(item: InputLayoutItem): Map<string, string> | null {\n\tconst config = (item.config ?? {}) as Record<string, unknown>;\n\tconst raw =\n\t\titem.widgetType === 'dropdown'\n\t\t\t? config.options\n\t\t\t: item.widgetType === 'dynamicValueList'\n\t\t\t\t? config.defaultOptions\n\t\t\t\t: undefined;\n\tif (!raw || typeof raw !== 'object') return null;\n\treturn new Map(Object.entries(raw as Record<string, string>).map(([k, v]) => [k, String(v)]));\n}\n\n// ============================================================================\n// Outputs\n// ============================================================================\n\nfunction diffOutputs(before: UISchema, after: UISchema): SchemaChange[] {\n\tconst oldOutputs = byId(before.outputs);\n\tconst newOutputs = byId(after.outputs);\n\tconst oldPlaced = placements(before, 'output');\n\tconst newPlaced = placements(after, 'output');\n\tconst changes: SchemaChange[] = [];\n\n\tfor (const [id, output] of oldOutputs) {\n\t\tif (newOutputs.has(id)) continue;\n\t\tchanges.push(\n\t\t\twhole('output', 'removed', id, labelOf(output.nickname, oldPlaced.get(id)), 'breaking')\n\t\t);\n\t}\n\tfor (const [id, output] of newOutputs) {\n\t\tconst label = labelOf(output.nickname, newPlaced.get(id));\n\t\tconst old = oldOutputs.get(id);\n\t\tif (!old) {\n\t\t\tchanges.push(whole('output', 'added', id, label, 'notable'));\n\t\t\tcontinue;\n\t\t}\n\t\tconst found = compareOutput(old, output, oldPlaced.get(id), newPlaced.get(id));\n\t\tif (found.length > 0) changes.push(changed('output', id, label, found));\n\t}\n\treturn changes;\n}\n\nfunction compareOutput(\n\ta: SchemaOutput,\n\tb: SchemaOutput,\n\tpa: Placed | undefined,\n\tpb: Placed | undefined\n): Finding[] {\n\tconst found: Finding[] = [];\n\tif (a.type !== b.type) found.push(['breaking', `type ${a.type} → ${b.type}`]);\n\tif (pa && pb) {\n\t\tconst wa = (pa.item as { widgetType?: string }).widgetType;\n\t\tconst wb = (pb.item as { widgetType?: string }).widgetType;\n\t\tif (wa !== wb) found.push(['notable', `shown as ${wa} → ${wb}`]);\n\t\tfound.push(...compareShared(pa.item, pb.item, pa.group, pb.group));\n\t} else if (!pa !== !pb) {\n\t\tfound.push(['notable', pb ? 'now on the page' : 'no longer on the page']);\n\t}\n\tif (a.nickname !== b.nickname) found.push(['cosmetic', `renamed ${a.nickname} → ${b.nickname}`]);\n\treturn found;\n}\n\n/** What inputs and outputs share: visibility, label, help text, group. */\nfunction compareShared(a: LayoutItem, b: LayoutItem, groupA: string, groupB: string): Finding[] {\n\tconst ia = a as Record<string, unknown>;\n\tconst ib = b as Record<string, unknown>;\n\tconst found: Finding[] = [];\n\tif ((ia.visible ?? true) !== (ib.visible ?? true)) {\n\t\tfound.push(['notable', ib.visible === false ? 'now hidden' : 'now shown']);\n\t}\n\tif (!same(ia.visibilityCondition, ib.visibilityCondition)) {\n\t\tfound.push(['notable', 'show/hide rule changed']);\n\t}\n\tif ((ia.displayName ?? '') !== (ib.displayName ?? '')) {\n\t\tfound.push(['cosmetic', `label ${show(ia.displayName)} → ${show(ib.displayName)}`]);\n\t}\n\tif ((ia.description ?? '') !== (ib.description ?? ''))\n\t\tfound.push(['cosmetic', 'help text changed']);\n\tif (groupA !== groupB) found.push(['cosmetic', `moved ${groupA} → ${groupB}`]);\n\treturn found;\n}\n\n// ============================================================================\n// Settings\n// ============================================================================\n\nfunction diffSettings(before: UISchema, after: UISchema): SchemaChange[] {\n\tconst changes: SchemaChange[] = [];\n\tconst setting = (\n\t\tid: string,\n\t\tlabel: string,\n\t\timpact: SchemaChangeImpact,\n\t\ta: unknown,\n\t\tb: unknown\n\t) => {\n\t\tif (!same(a, b))\n\t\t\tchanges.push(changed('settings', id, label, [[impact, `${show(a)} → ${show(b)}`]]));\n\t};\n\tsetting(\n\t\t'instanceSolve',\n\t\t'Solve on every change',\n\t\t'notable',\n\t\tbefore.instanceSolve ?? true,\n\t\tafter.instanceSolve ?? true\n\t);\n\tsetting(\n\t\t'previewSolves',\n\t\t'Preview solves',\n\t\t'notable',\n\t\tbefore.previewSolves ?? false,\n\t\tafter.previewSolves ?? false\n\t);\n\tsetting(\n\t\t'viewer',\n\t\t'3D viewer',\n\t\t'notable',\n\t\tbefore.viewerOptions?.enableRemote ?? false,\n\t\tafter.viewerOptions?.enableRemote ?? false\n\t);\n\tsetting('name', 'Name', 'cosmetic', before.name, after.name);\n\tsetting(\n\t\t'description',\n\t\t'Description',\n\t\t'cosmetic',\n\t\tbefore.description ?? '',\n\t\tafter.description ?? ''\n\t);\n\n\tconst tabsA = layoutLabels(before);\n\tconst tabsB = layoutLabels(after);\n\tif (!same(tabsA, tabsB)) {\n\t\tchanges.push(\n\t\t\tchanged('settings', 'layout', 'Layout', [['cosmetic', `${list(tabsA)} → ${list(tabsB)}`]])\n\t\t);\n\t}\n\treturn changes;\n}\n\n/** Tab labels for a tabbed layout, group labels for a flat one. */\nfunction layoutLabels(schema: UISchema): string[] {\n\tconst layout = schema.layout;\n\tif (layout?.type === 'tabbed') return (layout.tabs ?? []).map((t) => t.label);\n\treturn getGroups(schema).map((g) => g.label);\n}\n\n// ============================================================================\n// Markdown\n// ============================================================================\n\nconst HEADINGS: Record<SchemaChangeImpact, string> = {\n\tbreaking: 'Breaking',\n\tnotable: 'Changes',\n\tcosmetic: 'Cosmetic'\n};\n\n/** The diff as Markdown, to start a version's notes from. Empty for an identical diff. */\nexport function schemaDiffToMarkdown(diff: SchemaDiff): string {\n\tconst sections: string[] = [];\n\tfor (const impact of ['breaking', 'notable', 'cosmetic'] as const) {\n\t\tconst lines = diff.changes.filter((c) => c.impact === impact).map(changeLine);\n\t\tif (lines.length) sections.push(`### ${HEADINGS[impact]}\\n\\n${lines.join('\\n')}`);\n\t}\n\treturn sections.join('\\n\\n');\n}\n\n/** `Removed input **Width**`, `Input **Width**: default 10 → 12`, `Preview solves: false → true`. */\nfunction changeLine(c: SchemaChange): string {\n\tif (c.change !== 'changed') return `- ${capitalize(c.change)} ${c.kind} **${c.label}**`;\n\tconst subject = c.kind === 'settings' ? c.label : `${capitalize(c.kind)} **${c.label}**`;\n\treturn `- ${subject}: ${c.details.join('; ')}`;\n}\n\n// ============================================================================\n// Helpers\n// ============================================================================\n\nfunction byId<T extends { id: string }>(items: T[] | undefined): Map<string, T> {\n\treturn new Map((items ?? []).map((i) => [i.id, i]));\n}\n\nfunction whole(\n\tkind: SchemaChange['kind'],\n\tchange: 'added' | 'removed',\n\tid: string,\n\tlabel: string,\n\timpact: SchemaChangeImpact\n): SchemaChange {\n\treturn { kind, change, id, label, impact, details: [] };\n}\n\nfunction changed(\n\tkind: SchemaChange['kind'],\n\tid: string,\n\tlabel: string,\n\tfound: Finding[]\n): SchemaChange {\n\tconst impact = found.reduce<SchemaChangeImpact>(\n\t\t(worst, [i]) => (IMPACT_RANK[i] < IMPACT_RANK[worst] ? i : worst),\n\t\t'cosmetic'\n\t);\n\treturn { kind, change: 'changed', id, label, impact, details: found.map(([, d]) => d) };\n}\n\nfunction same(a: unknown, b: unknown): boolean {\n\treturn stableJson(a) === stableJson(b);\n}\n\nfunction stableJson(value: unknown): string {\n\tif (value === undefined) return 'undefined';\n\treturn JSON.stringify(value, (_k, v) =>\n\t\tv && typeof v === 'object' && !Array.isArray(v)\n\t\t\t? Object.fromEntries(Object.entries(v).sort(([x], [y]) => (x < y ? -1 : x > y ? 1 : 0)))\n\t\t\t: v\n\t);\n}\n\nfunction show(value: unknown): string {\n\tif (value === undefined || value === null || value === '') return 'none';\n\tconst text = typeof value === 'string' ? value : stableJson(value);\n\treturn text.length > 40 ? `${text.slice(0, 39)}…` : text;\n}\n\nfunction num(value: unknown): number | undefined {\n\treturn typeof value === 'number' && Number.isFinite(value) ? value : undefined;\n}\n\nfunction range(min: number | undefined, max: number | undefined): string {\n\treturn `${min ?? '−∞'}–${max ?? '∞'}`;\n}\n\nfunction list(items: string[]): string {\n\tconst shown = items.slice(0, 5).join(', ');\n\treturn items.length > 5 ? `${shown} and ${items.length - 5} more` : shown || 'none';\n}\n\nfunction capitalize(s: string): string {\n\treturn s.charAt(0).toUpperCase() + s.slice(1);\n}\n"],"mappings":";;AA6CA,IAAM,cAAkD;CAAE,UAAU;CAAG,SAAS;CAAG,UAAU;AAAE;AAC/F,IA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AG,KAAK,MAAM,GAAG,EAAE,EAAE,KAAK;AACrD;AAEA,SAAS,IAAI,OAAoC;CAChD,OAAO,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,IAAI,QAAQ,KAAA;AACtE;AAEA,SAAS,MAAM,KAAyB,KAAiC;CACxE,OAAO,GAAG,OAAO,KAAK,GAAG,OAAO;AACjC;AAEA,SAAS,KAAK,OAAyB;CACtC,MAAM,QAAQ,MAAM,MAAM,GAAG,CAAC,CAAC,CAAC,KAAK,IAAI;CACzC,OAAO,MAAM,SAAS,IAAI,GAAG,MAAM,OAAO,MAAM,SAAS,EAAE,SAAS,SAAS;AAC9E;AAEA,SAAS,WAAW,GAAmB;CACtC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,EAAE,MAAM,CAAC;AAC7C"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// ../compute/dist/handle-files-
|
|
1
|
+
// ../compute/dist/handle-files-T0TI_QtQ.js
|
|
2
2
|
var ErrorCodes = {
|
|
3
3
|
/** Connection failure, a gateway status (502/503/504), or a 2xx body cut off mid-stream. */
|
|
4
4
|
NETWORK_ERROR: "NETWORK_ERROR",
|
|
@@ -583,6 +583,26 @@ function parseServerTiming(headerValue) {
|
|
|
583
583
|
}
|
|
584
584
|
return sawMetric ? timing : null;
|
|
585
585
|
}
|
|
586
|
+
/**
|
|
587
|
+
* Parse `X-Compute-Profile`, a JSON array of `{ name, nick, ms }`. Entries of another shape are
|
|
588
|
+
* dropped; null when none is left or the header is not JSON.
|
|
589
|
+
*/
|
|
590
|
+
function parseComputeProfile(headerValue) {
|
|
591
|
+
if (!headerValue) return null;
|
|
592
|
+
let parsed;
|
|
593
|
+
try {
|
|
594
|
+
parsed = JSON.parse(headerValue);
|
|
595
|
+
} catch {
|
|
596
|
+
return null;
|
|
597
|
+
}
|
|
598
|
+
if (!Array.isArray(parsed)) return null;
|
|
599
|
+
const entries = parsed.filter((e) => typeof e === "object" && e !== null && typeof e.name === "string" && typeof e.nick === "string" && typeof e.ms === "number" && Number.isFinite(e.ms));
|
|
600
|
+
return entries.length > 0 ? entries.map(({ name, nick, ms }) => ({
|
|
601
|
+
name,
|
|
602
|
+
nick,
|
|
603
|
+
ms
|
|
604
|
+
})) : null;
|
|
605
|
+
}
|
|
586
606
|
function isAffinity(value) {
|
|
587
607
|
return AFFINITY_OUTCOMES.includes(value);
|
|
588
608
|
}
|
|
@@ -597,6 +617,8 @@ function fireServerTiming(response, requestId, onServerTiming) {
|
|
|
597
617
|
if (!onServerTiming) return;
|
|
598
618
|
const timing = parseServerTiming(response.headers.get("Server-Timing"));
|
|
599
619
|
if (!timing) return;
|
|
620
|
+
const profile = parseComputeProfile(response.headers.get("X-Compute-Profile"));
|
|
621
|
+
if (profile) timing.profile = profile;
|
|
600
622
|
try {
|
|
601
623
|
onServerTiming(timing, requestId);
|
|
602
624
|
} catch (err) {
|