@selvajs/selva 4.21.0-beta.16 → 4.21.0-beta.18
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 +2 -2
- package/build/client/_app/immutable/assets/21.VfhYpgTQ.css +1 -0
- package/build/client/_app/immutable/assets/21.VfhYpgTQ.css.br +0 -0
- package/build/client/_app/immutable/assets/21.VfhYpgTQ.css.gz +0 -0
- package/build/client/_app/immutable/assets/baseHDR.Dkr46J8-.hdr +0 -0
- package/build/client/_app/immutable/chunks/{BWnVNIyV.js → D2C9ht__.js} +1 -1
- package/build/client/_app/immutable/chunks/D2C9ht__.js.br +0 -0
- package/build/client/_app/immutable/chunks/{BWnVNIyV.js.gz → D2C9ht__.js.gz} +0 -0
- package/build/client/_app/immutable/chunks/DIMAEw3m.js +1 -0
- package/build/client/_app/immutable/chunks/DIMAEw3m.js.br +1 -0
- package/build/client/_app/immutable/chunks/DIMAEw3m.js.gz +0 -0
- 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.Dw0M74ME.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/21.BA-9DMG6.js +1 -0
- package/build/client/_app/immutable/nodes/21.BA-9DMG6.js.br +0 -0
- package/build/client/_app/immutable/nodes/21.BA-9DMG6.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 +89 -7
- package/build/server/_app/immutable/assets/_page.DowU5FoO.css +1 -0
- package/build/server/_app/immutable/assets/baseHDR.Dkr46J8-.hdr +0 -0
- 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/functions.js +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 +5 -5
- package/build/server/chunks/instanceAdmins.server.js +1 -1
- package/build/server/chunks/internal.js +3 -3
- 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/remote.js +1559 -0
- package/build/server/chunks/remote.js.map +1 -0
- package/build/server/chunks/rhino3dm.js.map +1 -1
- package/build/server/chunks/server-errors.js +19 -1
- package/build/server/chunks/server-errors.js.map +1 -1
- package/build/server/chunks/server5.js +52 -0
- package/build/server/chunks/server5.js.map +1 -0
- 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 +1085 -91
- 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/library/_guid_/_page.svelte.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/index.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/21.js +2 -2
- package/build/server/nodes/25.js +1 -1
- package/build/server/remote-entry.js +1 -1559
- package/build/server/server.js +8 -1
- package/package.json +10 -9
- package/templates/.env.example +6 -0
- package/build/client/_app/immutable/assets/21.DDgTnace.css +0 -1
- package/build/client/_app/immutable/assets/21.DDgTnace.css.br +0 -0
- package/build/client/_app/immutable/assets/21.DDgTnace.css.gz +0 -0
- package/build/client/_app/immutable/chunks/BWnVNIyV.js.br +0 -0
- package/build/client/_app/immutable/chunks/Cj8nqfNF.js +0 -1
- package/build/client/_app/immutable/chunks/Cj8nqfNF.js.br +0 -1
- package/build/client/_app/immutable/chunks/Cj8nqfNF.js.gz +0 -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.Dw0M74ME.js.br +0 -0
- package/build/client/_app/immutable/entry/app.Dw0M74ME.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/21.-ms9uSQh.js +0 -1
- package/build/client/_app/immutable/nodes/21.-ms9uSQh.js.br +0 -0
- package/build/client/_app/immutable/nodes/21.-ms9uSQh.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
- package/build/server/_app/immutable/assets/_page.l97MEw0G.css +0 -1
- package/build/server/remote-entry.js.map +0 -1
|
@@ -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,SAAg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AoC;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
|
+
{"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,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,MAAM,SAAS;EAAE,UAAU;EAAG,SAAS;EAAG,UAAU;CAAE;CACtD,KAAK,MAAM,KAAK,SAAS,OAAO,EAAE,WAAW;CAC7C,OAAO;EAAE;EAAS;EAAQ,WAAW,QAAQ,WAAW;CAAE;AAC3D;;AAYA,SAAS,WAAW,QAAkB,MAA+C;CACpF,MAAM,sBAAM,IAAI,IAAoB;CACpC,KAAK,MAAM,SAAS,UAAU,MAAM,GACnC,KAAK,MAAM,QAAQ,MAAM,SAAS,CAAC,GAAG;EACrC,IAAI,KAAK,SAAS,QAAQ,EAAE,aAAa,SAAS,IAAI,IAAI,KAAK,OAAO,GAAG;EACzE,IAAI,IAAI,KAAK,SAAS;GAAE;GAAM,OAAO,MAAM;EAAM,CAAC;CACnD;CAED,OAAO;AACR;AAEA,SAAS,QAAQ,UAAkB,QAAoC;CACtE,MAAM,UACL,QAAQ,QAAQ,iBAAiB,OAAO,OAAO,OAAO,KAAK,cAAc,KAAA;CAC1E,OAAQ,OAAO,YAAY,YAAY,QAAQ,KAAK,KAAM,YAAY;AACv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AI,CAAC,OAAQ,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,CAAE,CAAC,IACrF,CACJ;AACD;AAEA,SAAS,KAAK,OAAwB;CACrC,IAAI,UAAU,KAAA,KAAa,UAAU,QAAQ,UAAU,IAAI,OAAO;CAClE,MAAM,OAAO,OAAO,UAAU,WAAW,QAAQ,WAAW,KAAK;CACjE,OAAO,KAAK,SAAS,KAAK,GAAG,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
|
-
import {
|
|
1
|
+
import { K as server_api_unavailable } from "./server-errors.js";
|
|
2
2
|
// ../../node_modules/.pnpm/@sveltejs+kit@3.1.1_@opentelemetry+api@1.10.0_@sveltejs+vite-plugin-svelte@7.3.1_svelte_f967bc3fd8a221ab5730ab7d29103078/node_modules/@sveltejs/kit/src/utils/functions.js
|
|
3
3
|
function noop() {}
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { q as actorOf } from "./providers.server.js";
|
|
1
|
+
import { J as definitionPaths, q as actorOf } from "./providers.server.js";
|
|
2
2
|
import { $ as canView, G as scopeAllows, K as canChangeOrgRole, O as ApiErrorCode, Q as canSolve, S as requireManageOrgMembers, T as requireTargetIsOrgMember, W as outsideTokenOrg, Y as canEdit, _ as requireEditableDefinition, a as canCreateProjectIn, et as checkOwnerRemoval, f as requireCanEditProjectSettings, g as requireCanViewProject, i as canActorChangeOrgRole, j as isApiError, k as apiError, l as requireCanCreateDefinition, m as requireCanReclaim, o as projectAccessInputFromRowsWith, p as requireCanManage, q as canCreateDefinition, r as assertCanGrantPlatformPermissions, s as requireActingOrg, t as splitFlatPermissions, u as requireCanCreateProject, w as requireProjectVisibilityAllowed, x as requireManageOrgCompute } from "./access.js";
|
|
3
3
|
import { a as formatApiScope, i as describeApiScope, o as parseApiScope } from "./types.js";
|
|
4
4
|
import { r as hasPermission, t as SYSTEM_CONTEXT } from "./context.js";
|
|
@@ -7,9 +7,10 @@ import { n as GH_EXTENSIONS, r as toDefinitionListItem, t as COVER_IMAGE_CONTENT
|
|
|
7
7
|
import { a as toSourceDocumentId, r as GuidSchema } from "./schemas.js";
|
|
8
8
|
import { n as MAX_CHANGE_NOTE_LENGTH, t as CreateDefinitionInputSchema } from "./bodies.js";
|
|
9
9
|
import { a as MEMBER_ASSIGNABLE_PERMISSIONS, f as slugify, i as DEFAULT_ORG_PERMISSIONS, n as ALL_ORG_PERMISSIONS, s as OrgAssetKindSchema } from "./schemas2.js";
|
|
10
|
-
import { B as parseParam, G as requireUpload, H as requireCaller, K as throwZodError, L as scopeRefusalsToday, N as assertScope, R as formText, U as requireParams, V as readForm, W as requireSession, _ as UpdateDefinitionBodySchema, a as InviteResponseSchema, b as UpdateProjectMemberBodySchema, c as AddProjectMemberBodySchema, d as CreateProjectBodySchema, f as CreateShareLinkBodySchema, i as CreatedShareLinkResponseSchema, k as defaultProjectCreateLimiter, l as CreateApiTokenBodySchema, m as PublishVersionBodySchema, n as CreatedApiTokenResponseSchema, o as OrgComputeResponseSchema, p as OrgComputePatchBodySchema,
|
|
11
|
-
import {
|
|
10
|
+
import { B as parseParam, G as requireUpload, H as requireCaller, J as validateProjectFlags, K as throwZodError, L as scopeRefusalsToday, N as assertScope, R as formText, U as requireParams, V as readForm, W as requireSession, _ as UpdateDefinitionBodySchema, a as InviteResponseSchema, b as UpdateProjectMemberBodySchema, c as AddProjectMemberBodySchema, d as CreateProjectBodySchema, f as CreateShareLinkBodySchema, i as CreatedShareLinkResponseSchema, k as defaultProjectCreateLimiter, l as CreateApiTokenBodySchema, m as PublishVersionBodySchema, n as CreatedApiTokenResponseSchema, o as OrgComputeResponseSchema, p as OrgComputePatchBodySchema, r as CreatedInviteResponseSchema, s as ShareLinkResponseSchema, t as ApiTokenResponseSchema, u as CreateInviteBodySchema, v as UpdateOrgMemberBodySchema, y as UpdateProjectBodySchema, z as parseBody } from "./api.js";
|
|
11
|
+
import { t as DEFAULT_SHARE_LINK_MAX_SOLVES } from "./types4.js";
|
|
12
12
|
import { c as listEditableDefinitionsByDocument, d as loadVisibleVersion, f as mayUploadToDefinition, l as listVisibleDefinitions, m as clampPageLimit, p as resolveAccessibleProjects, s as getVisibleDefinition, u as loadVisibleDefinition, v as walkPages } from "./logging.js";
|
|
13
|
+
import { t as diffSchemas } from "./diff.js";
|
|
13
14
|
import { a as extractSchemaForUpload, c as fetchScriptSources, o as fetchExtraction } from "./errors.js";
|
|
14
15
|
import { n as resolveServerForOrg } from "./resolve-server.js";
|
|
15
16
|
import { n as validateIncomingServers, r as evictChangedServers, t as mergeApiKeys } from "./server-config-write.js";
|
|
@@ -54,7 +55,7 @@ function escapeHtml(s) {
|
|
|
54
55
|
}
|
|
55
56
|
// ../notifications/src/layout.ts
|
|
56
57
|
/**
|
|
57
|
-
* The frame every
|
|
58
|
+
* The frame every mail shares: card chrome, type stack, colours.
|
|
58
59
|
* Templates supply a body; this supplies the look, so mail written by
|
|
59
60
|
* different people at different times still reads as coming from one product.
|
|
60
61
|
*
|
|
@@ -86,9 +87,9 @@ function renderButton(href, label) {
|
|
|
86
87
|
* point is a link needs this: a button that does not render leaves the reader
|
|
87
88
|
* with no way to continue.
|
|
88
89
|
*/
|
|
89
|
-
function renderUrlFallback(href) {
|
|
90
|
+
function renderUrlFallback(href, label = "Or paste this into your browser:") {
|
|
90
91
|
return `<p style="margin:24px 0 0;font-size:13px;line-height:1.5;color:#6b6b6b;">
|
|
91
|
-
|
|
92
|
+
${escapeHtml(label)}<br />
|
|
92
93
|
<span style="word-break:break-all;color:#4a4a4a;">${escapeHtml(href)}</span>
|
|
93
94
|
</p>`;
|
|
94
95
|
}
|
|
@@ -108,15 +109,15 @@ function formatExpiry(iso) {
|
|
|
108
109
|
* is still the only way the invitee can accept.
|
|
109
110
|
*/
|
|
110
111
|
function renderInviteEmail(input) {
|
|
111
|
-
const { to, acceptUrl, orgName, invitedBy } = input;
|
|
112
|
+
const { to, acceptUrl, orgName, invitedBy, productName = "Selva" } = input;
|
|
112
113
|
const expiry = formatExpiry(input.expiresAt);
|
|
113
114
|
const inviter = invitedBy ? `${invitedBy} invited you` : "You have been invited";
|
|
114
115
|
return {
|
|
115
116
|
kind: "org.invite",
|
|
116
117
|
to,
|
|
117
|
-
subject: `${inviter} to join ${orgName} on
|
|
118
|
+
subject: `${inviter} to join ${orgName} on ${productName}`,
|
|
118
119
|
text: [
|
|
119
|
-
`${inviter} to join ${orgName} on
|
|
120
|
+
`${inviter} to join ${orgName} on ${productName}.`,
|
|
120
121
|
"",
|
|
121
122
|
"Open this link to accept and set up your account:",
|
|
122
123
|
acceptUrl,
|
|
@@ -126,7 +127,7 @@ function renderInviteEmail(input) {
|
|
|
126
127
|
"If you weren't expecting this invitation, you can ignore this email."
|
|
127
128
|
].join("\n"),
|
|
128
129
|
html: renderLayout({
|
|
129
|
-
heading: `Join ${orgName} on
|
|
130
|
+
heading: `Join ${orgName} on ${productName}`,
|
|
130
131
|
body: ` <p style="margin:0 0 24px;font-size:15px;line-height:1.5;color:#4a4a4a;">
|
|
131
132
|
${escapeHtml(inviter)} to join <strong>${escapeHtml(orgName)}</strong>. Open the link below to accept and set up your account.
|
|
132
133
|
</p>
|
|
@@ -151,14 +152,14 @@ function formatDate(iso) {
|
|
|
151
152
|
* the owner didn't create it, so the revoke link leads.
|
|
152
153
|
*/
|
|
153
154
|
function renderApiTokenCreatedEmail(input) {
|
|
154
|
-
const { to, tokenName, orgName, scopes, manageUrl } = input;
|
|
155
|
+
const { to, tokenName, orgName, scopes, manageUrl, productName = "Selva" } = input;
|
|
155
156
|
const expiry = formatDate(input.expiresAt);
|
|
156
157
|
return {
|
|
157
158
|
kind: "api_token.created",
|
|
158
159
|
to,
|
|
159
160
|
subject: `New API token "${tokenName}" in ${orgName}`,
|
|
160
161
|
text: [
|
|
161
|
-
`A new API token named "${tokenName}" was created on your
|
|
162
|
+
`A new API token named "${tokenName}" was created on your ${productName} account in ${orgName}.`,
|
|
162
163
|
"",
|
|
163
164
|
"It can:",
|
|
164
165
|
...scopes.map((s) => `- ${s}`),
|
|
@@ -193,14 +194,16 @@ function renderApiTokenCreatedEmail(input) {
|
|
|
193
194
|
*/
|
|
194
195
|
async function deliverInvite(input) {
|
|
195
196
|
const { ctx, log, invite, acceptUrl, actor, orgs, notifications, fallbackOrgName } = input;
|
|
197
|
+
const render = input.render ?? renderInviteEmail;
|
|
196
198
|
try {
|
|
197
199
|
const org = await orgs.getOrg(ctx, invite.orgId);
|
|
198
|
-
const { status } = await notifications.send(
|
|
200
|
+
const { status } = await notifications.send(await render({
|
|
199
201
|
to: invite.email,
|
|
200
202
|
acceptUrl,
|
|
201
203
|
orgName: org?.name ?? fallbackOrgName,
|
|
202
204
|
invitedBy: actor.profile?.displayName || actor.user?.email,
|
|
203
|
-
expiresAt: invite.expiresAt
|
|
205
|
+
expiresAt: invite.expiresAt,
|
|
206
|
+
productName: input.productName
|
|
204
207
|
}), log);
|
|
205
208
|
return status;
|
|
206
209
|
} catch (err) {
|
|
@@ -468,13 +471,15 @@ async function mailTokenCreated(req, token) {
|
|
|
468
471
|
if (!notifications || !to) return;
|
|
469
472
|
try {
|
|
470
473
|
const org = await req.deps.orgs.getOrg(req.ctx, token.orgId);
|
|
471
|
-
|
|
474
|
+
const render = req.deps.mailTemplates?.apiTokenCreated ?? renderApiTokenCreatedEmail;
|
|
475
|
+
await notifications.send(await render({
|
|
472
476
|
to,
|
|
473
477
|
tokenName: token.name,
|
|
474
478
|
orgName: org?.name ?? req.deps.instanceName,
|
|
475
479
|
scopes: token.scopes.map(describeApiScope),
|
|
476
480
|
expiresAt: token.expiresAt,
|
|
477
|
-
manageUrl: `${req.url.origin}${req.deps.apiTokenSettingsPath}
|
|
481
|
+
manageUrl: `${req.url.origin}${req.deps.apiTokenSettingsPath}`,
|
|
482
|
+
productName: req.deps.instanceName
|
|
478
483
|
}), req.log);
|
|
479
484
|
} catch (err) {
|
|
480
485
|
req.log.warn("API token mail could not be sent", {
|
|
@@ -976,25 +981,40 @@ function withDefaultsOf(schema, base) {
|
|
|
976
981
|
} : input)
|
|
977
982
|
};
|
|
978
983
|
}
|
|
984
|
+
function pluginRequirements(inventory) {
|
|
985
|
+
return inventory.libraries.filter((l) => !l.core).map((l) => ({
|
|
986
|
+
name: l.name,
|
|
987
|
+
version: l.version,
|
|
988
|
+
serverVersion: l.serverVersion ?? null
|
|
989
|
+
}));
|
|
990
|
+
}
|
|
979
991
|
function inventoryReport(inventory, schema, base) {
|
|
980
992
|
if (!inventory) return null;
|
|
981
993
|
const formIds = [...schema?.inputs ?? [], ...base?.schema?.inputs ?? []].map((i) => i.id);
|
|
982
994
|
return {
|
|
983
995
|
summary: summarizeInventory(inventory),
|
|
984
996
|
warnings: inventoryWarnings(inventory),
|
|
997
|
+
plugins: pluginRequirements(inventory),
|
|
998
|
+
extractedWith: inventory.extractedWith,
|
|
985
999
|
diff: base?.inventory ? diffInventories(base.inventory, inventory, { formIds }) : null,
|
|
986
1000
|
missing: base && !base.inventory ? "base" : null
|
|
987
1001
|
};
|
|
988
1002
|
}
|
|
989
1003
|
/**
|
|
990
|
-
* A plugin the server lacks
|
|
991
|
-
* missing, so it blocks the upload unless the caller
|
|
992
|
-
* being installed. The version's summary keeps
|
|
1004
|
+
* A plugin the server lacks, or a component its installed release lacks, makes every solve drop
|
|
1005
|
+
* those components and succeed with outputs missing, so it blocks the upload unless the caller
|
|
1006
|
+
* accepts that, e.g. while the plugin is still being installed. The version's summary keeps
|
|
1007
|
+
* saying so until a check finds them.
|
|
993
1008
|
*/
|
|
994
1009
|
function guardPlugins(inventory, accepted) {
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
1010
|
+
if (!inventory || accepted) return;
|
|
1011
|
+
const { missingPlugins, unloadedComponents = [] } = summarizeInventory(inventory);
|
|
1012
|
+
if (!missingPlugins.length && !unloadedComponents.length) return;
|
|
1013
|
+
const lacks = [missingPlugins.length && `${missingPlugins.join(", ")} installed`, unloadedComponents.length && `the components ${unloadedComponents.join(", ")} (its plugin release is older than the file's)`].filter(Boolean);
|
|
1014
|
+
apiError(422, ApiErrorCode.UNPROCESSABLE, `The Compute server does not have ${lacks.join(", nor ")}, so solves would drop those components and miss their outputs. Install or update the plugin first, or upload anyway with acceptMissingPlugins=true.`, void 0, {
|
|
1015
|
+
missingPlugins: missingPlugins.join(", "),
|
|
1016
|
+
unloadedComponents: unloadedComponents.join(", ")
|
|
1017
|
+
});
|
|
998
1018
|
}
|
|
999
1019
|
/** The version an upload follows: the draft it replaces, else the live one. */
|
|
1000
1020
|
async function loadBase(req, ctx, record) {
|
|
@@ -1126,7 +1146,9 @@ var refreshVersionInventory = async (req) => {
|
|
|
1126
1146
|
await req.deps.definitionMeta.setVersionInventory(ctx, version.id, inventory, summary);
|
|
1127
1147
|
return { body: {
|
|
1128
1148
|
summary,
|
|
1129
|
-
warnings: inventoryWarnings(inventory)
|
|
1149
|
+
warnings: inventoryWarnings(inventory),
|
|
1150
|
+
plugins: pluginRequirements(inventory),
|
|
1151
|
+
extractedWith: inventory.extractedWith
|
|
1130
1152
|
} };
|
|
1131
1153
|
};
|
|
1132
1154
|
/**
|
|
@@ -1389,6 +1411,19 @@ var uploadDefinitionImage = async (req) => {
|
|
|
1389
1411
|
const data = new Uint8Array(await file.arrayBuffer());
|
|
1390
1412
|
return { body: { coverImage: await definitionService(req.deps).saveCoverImage(ctx, guid, data) } };
|
|
1391
1413
|
};
|
|
1414
|
+
/** The cover image's bytes, by the same visibility rule as the definition. */
|
|
1415
|
+
var getDefinitionImage = async (req) => {
|
|
1416
|
+
const guid = parseParam(req.params.guid, GuidSchema, "GUID");
|
|
1417
|
+
const { ctx } = requireCaller(req);
|
|
1418
|
+
const record = await getVisibleDefinition(ctx, guid, req.deps);
|
|
1419
|
+
if (!record) apiError(404, ApiErrorCode.NOT_FOUND, "Definition not found");
|
|
1420
|
+
const bytes = record.coverImage ? await req.deps.storage.get(definitionPaths.image(guid)) : null;
|
|
1421
|
+
if (!bytes) apiError(404, ApiErrorCode.NOT_FOUND, "This definition has no cover image");
|
|
1422
|
+
return new Response(Buffer.from(bytes), { headers: {
|
|
1423
|
+
"Content-Type": "image/webp",
|
|
1424
|
+
"Cache-Control": "private, max-age=60"
|
|
1425
|
+
} });
|
|
1426
|
+
};
|
|
1392
1427
|
// ../server/src/handlers/projects.ts
|
|
1393
1428
|
/**
|
|
1394
1429
|
* Project handlers: the collection, and a single project's detail and settings.
|
|
@@ -1534,7 +1569,16 @@ var listProjectMembers = async (req) => {
|
|
|
1534
1569
|
const { id } = requireParams(req.params, "id");
|
|
1535
1570
|
const { ctx } = requireCaller(req);
|
|
1536
1571
|
await requireCanManage(req, id, "members");
|
|
1537
|
-
|
|
1572
|
+
const page = await req.deps.projects.listProjectMembers(ctx, id, parseListOptions(req.url));
|
|
1573
|
+
const profiles = await req.deps.userProfile.getProfiles(SYSTEM_CONTEXT, page.items.map((m) => m.userId));
|
|
1574
|
+
const names = new Map(profiles.map((p) => [p.userId, p.displayName]));
|
|
1575
|
+
return collection({
|
|
1576
|
+
...page,
|
|
1577
|
+
items: page.items.map((m) => ({
|
|
1578
|
+
...m,
|
|
1579
|
+
displayName: names.get(m.userId) ?? null
|
|
1580
|
+
}))
|
|
1581
|
+
});
|
|
1538
1582
|
};
|
|
1539
1583
|
var addProjectMember = async (req) => {
|
|
1540
1584
|
const { id } = requireParams(req.params, "id");
|
|
@@ -1722,6 +1766,8 @@ async function mailInvite(req, invite, acceptUrl) {
|
|
|
1722
1766
|
},
|
|
1723
1767
|
orgs: req.deps.orgs,
|
|
1724
1768
|
notifications,
|
|
1769
|
+
productName: req.deps.instanceName,
|
|
1770
|
+
render: req.deps.mailTemplates?.invite,
|
|
1725
1771
|
fallbackOrgName: req.deps.instanceName
|
|
1726
1772
|
});
|
|
1727
1773
|
}
|
|
@@ -1920,6 +1966,6 @@ async function revokeUnredeemedConsentToken(req, tokenId) {
|
|
|
1920
1966
|
await store.revoke(ctx, tokenId, "owner");
|
|
1921
1967
|
req.deps.tokens.resolutionCache?.forget(tokenId);
|
|
1922
1968
|
}
|
|
1923
|
-
export {
|
|
1969
|
+
export { revokeApiToken as $, deleteVersion as A, revokeShareLink as B, getDefinitionImage as C, updateDefinition as D, publishDefinition as E, listVersions as F, updateOrgMember as G, uploadOrgAsset as H, refreshVersionInventory as I, canManageApiTokenRoster as J, orgHasAnotherOwner as K, uploadVersion as L, getVersionChanges as M, getVersionSchema as N, uploadDefinitionImage as O, getVersionScriptDiff as P, mayHoldApiTokens as Q, createShareLink as R, getDefinition as S, listDefinitions as T, reclaimProject as U, removeOrgAsset as V, removeOrgMember as W, listApiTokens as X, createApiToken as Y, listOrgApiTokens as Z, getProject as _, inviterStillVouches as a, unstarDefinition as at, createDefinition as b, revokeInvite as c, addProjectMember as d, revokeOwnApiToken as et, listProjectMembers as f, deleteProject as g, createProject as h, createInvite as i, starDefinition as it, getVersion as j, checkVersion as k, getOrgCompute as l, updateProjectMemberRole as m, mintConsentToken as n, getOrg as nt, listInvites as o, getMe as ot, removeProjectMember as p, serializeOwnerChanges as q, revokeUnredeemedConsentToken as r, listOrgMembers as rt, resendInvite as s, consentOffer as t, revokeUserApiTokens as tt, updateOrgCompute as u, listProjects as v, getDefinitionSchema as w, deleteDefinition as x, updateProject as y, listShareLinks as z };
|
|
1924
1970
|
|
|
1925
1971
|
//# sourceMappingURL=handlers.js.map
|