@milaboratories/pl-middle-layer 1.71.15 → 1.72.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/dist/index.cjs +10 -5
  2. package/dist/index.d.ts +5 -4
  3. package/dist/index.js +3 -2
  4. package/dist/middle_layer/build_stamp.cjs +1 -1
  5. package/dist/middle_layer/build_stamp.js +1 -1
  6. package/dist/middle_layer/folders.cjs +631 -0
  7. package/dist/middle_layer/folders.cjs.map +1 -0
  8. package/dist/middle_layer/folders.d.ts +39 -0
  9. package/dist/middle_layer/folders.d.ts.map +1 -0
  10. package/dist/middle_layer/folders.js +613 -0
  11. package/dist/middle_layer/folders.js.map +1 -0
  12. package/dist/middle_layer/index.cjs +3 -0
  13. package/dist/middle_layer/index.d.ts +4 -3
  14. package/dist/middle_layer/index.js +2 -1
  15. package/dist/middle_layer/middle_layer.cjs +585 -370
  16. package/dist/middle_layer/middle_layer.cjs.map +1 -1
  17. package/dist/middle_layer/middle_layer.d.ts +215 -122
  18. package/dist/middle_layer/middle_layer.d.ts.map +1 -1
  19. package/dist/middle_layer/middle_layer.js +593 -378
  20. package/dist/middle_layer/middle_layer.js.map +1 -1
  21. package/dist/middle_layer/project_list.cjs +36 -19
  22. package/dist/middle_layer/project_list.cjs.map +1 -1
  23. package/dist/middle_layer/project_list.d.ts +1 -1
  24. package/dist/middle_layer/project_list.d.ts.map +1 -1
  25. package/dist/middle_layer/project_list.js +37 -21
  26. package/dist/middle_layer/project_list.js.map +1 -1
  27. package/dist/middle_layer/sharing_list.cjs +123 -93
  28. package/dist/middle_layer/sharing_list.cjs.map +1 -1
  29. package/dist/middle_layer/sharing_list.d.ts +43 -19
  30. package/dist/middle_layer/sharing_list.d.ts.map +1 -1
  31. package/dist/middle_layer/sharing_list.js +123 -93
  32. package/dist/middle_layer/sharing_list.js.map +1 -1
  33. package/dist/middle_layer/template_list.cjs +45 -20
  34. package/dist/middle_layer/template_list.cjs.map +1 -1
  35. package/dist/middle_layer/template_list.d.ts +7 -15
  36. package/dist/middle_layer/template_list.d.ts.map +1 -1
  37. package/dist/middle_layer/template_list.js +44 -21
  38. package/dist/middle_layer/template_list.js.map +1 -1
  39. package/dist/model/index.cjs +7 -5
  40. package/dist/model/index.d.ts +2 -2
  41. package/dist/model/index.js +2 -2
  42. package/dist/model/sharing_model.cjs +46 -20
  43. package/dist/model/sharing_model.cjs.map +1 -1
  44. package/dist/model/sharing_model.d.ts +125 -55
  45. package/dist/model/sharing_model.d.ts.map +1 -1
  46. package/dist/model/sharing_model.js +40 -16
  47. package/dist/model/sharing_model.js.map +1 -1
  48. package/dist/mutator/list.cjs +30 -0
  49. package/dist/mutator/list.cjs.map +1 -0
  50. package/dist/mutator/list.js +29 -0
  51. package/dist/mutator/list.js.map +1 -0
  52. package/dist/mutator/project.cjs +14 -1
  53. package/dist/mutator/project.cjs.map +1 -1
  54. package/dist/mutator/project.d.ts.map +1 -1
  55. package/dist/mutator/project.js +15 -2
  56. package/dist/mutator/project.js.map +1 -1
  57. package/dist/mutator/sharing.cjs +130 -76
  58. package/dist/mutator/sharing.cjs.map +1 -1
  59. package/dist/mutator/sharing.js +130 -76
  60. package/dist/mutator/sharing.js.map +1 -1
  61. package/dist/mutator/template.cjs +24 -17
  62. package/dist/mutator/template.cjs.map +1 -1
  63. package/dist/mutator/template.js +26 -20
  64. package/dist/mutator/template.js.map +1 -1
  65. package/package.json +18 -18
  66. package/src/middle_layer/folders.test.ts +1068 -0
  67. package/src/middle_layer/folders.ts +1059 -0
  68. package/src/middle_layer/folders_read.test.ts +359 -0
  69. package/src/middle_layer/index.ts +3 -2
  70. package/src/middle_layer/middle_layer.ts +813 -547
  71. package/src/middle_layer/project_list.test.ts +183 -0
  72. package/src/middle_layer/project_list.ts +58 -21
  73. package/src/middle_layer/sharing.test.ts +183 -0
  74. package/src/middle_layer/sharing_list.ts +208 -152
  75. package/src/middle_layer/template_list.test.ts +148 -0
  76. package/src/middle_layer/template_list.ts +72 -32
  77. package/src/middle_layer/templates.test.ts +76 -45
  78. package/src/model/sharing_model.test.ts +69 -2
  79. package/src/model/sharing_model.ts +161 -73
  80. package/src/mutator/list.ts +36 -0
  81. package/src/mutator/project-v3.test.ts +3 -1
  82. package/src/mutator/project.ts +13 -2
  83. package/src/mutator/sharing.ts +193 -120
  84. package/src/mutator/template.ts +37 -29
  85. package/src/test/with_ml.ts +73 -16
@@ -1 +1 @@
1
- {"version":3,"file":"sharing.js","names":[],"sources":["../../src/mutator/sharing.ts"],"sourcesContent":["import type { PlTransaction, ResourceRef, SignedResourceId } from \"@milaboratories/pl-client\";\nimport { field, isNotNullSignedResourceId, resourceIdToString } from \"@milaboratories/pl-client\";\nimport { randomUUID } from \"node:crypto\";\nimport type { ProjectMeta } from \"@milaboratories/pl-model-middle-layer\";\nimport type { ProjectId, ProjectTemplateV1 } from \"@milaboratories/pl-model-common\";\nimport { ProjectMetaKey } from \"../model/project_model\";\nimport { duplicateProject } from \"./project\";\nimport type {\n EnvelopeData,\n EnvelopeAcceptance,\n EnvelopeMode,\n EnvelopeProject,\n ProjectFieldUuid,\n ShareId,\n SharingDecision,\n} from \"../model/sharing_model\";\nimport {\n EnvelopeSchemaVersionCurrent,\n SharedEnvelopeResourceType,\n acceptanceField,\n decisionField,\n newShareId,\n} from \"../model/sharing_model\";\n\n/** Field name carrying a project snapshot inside a {@link SharedEnvelopeResourceType}. */\nexport const EnvelopeProjectFieldPrefix = \"project/\";\nexport const envelopeProjectField = (uuid: ProjectFieldUuid) =>\n `${EnvelopeProjectFieldPrefix}${uuid}`;\n\n/** True for an envelope field that carries a project snapshot. */\nexport function isEnvelopeProjectField(name: string): boolean {\n return name.startsWith(EnvelopeProjectFieldPrefix);\n}\n\n/** Extracts the project field uuid from a `project/{uuid}` field name. */\nexport function envelopeProjectFieldUuid(name: string): ProjectFieldUuid {\n return name.slice(EnvelopeProjectFieldPrefix.length) as ProjectFieldUuid;\n}\n\n//\n// Donor side\n//\n\n/**\n * One project going into an envelope: `fresh` snapshots a live source (normal path); `carry`\n * re-attaches an existing snapshot (change's \"keep\", or an \"update\" whose source is gone).\n */\nexport type EnvelopeProjectSource =\n | { kind: \"fresh\"; projectId: ProjectId; sourceRid: SignedResourceId }\n | {\n kind: \"carry\";\n projectId: ProjectId;\n label: string;\n snapshotRid: SignedResourceId;\n /** ms epoch the carried snapshot was last taken; preserved so \"keep\" keeps its timestamp. */\n updatedAt: number;\n };\n\n/**\n * Builds one {@link SharedEnvelopeResourceType} on the donor side inside the given write\n * transaction: snapshots each source project by reference, seals the envelope with its\n * immutable {@link EnvelopeData}, and attaches the envelope under `{shareId}` on the donor's\n * outbox. The caller is responsible for issuing the per-recipient grants and committing the\n * transaction — keeping create + grant atomic.\n *\n * @returns the new envelope resource and the generated `EnvelopeData`.\n */\nexport async function buildShareEnvelope(\n tx: PlTransaction,\n outboxRid: SignedResourceId,\n sources: EnvelopeProjectSource[],\n params: {\n mode: EnvelopeMode;\n sender: string;\n title: string;\n /** ms epoch; sharedAt + ttl for a targeted share, null for share-with-everybody. */\n expiresAt: number | null;\n /** Existing shareId for a change; a fresh one is minted when omitted. */\n shareId?: ShareId;\n sharedAt?: number;\n },\n): Promise<{ envelope: ResourceRef; data: EnvelopeData }> {\n const shareId = params.shareId ?? newShareId();\n const sharedAt = params.sharedAt ?? Date.now();\n\n // Snapshot (fresh) or re-attach (carry) each project, collecting its metadata for the pack.\n const projects: Record<ProjectFieldUuid, EnvelopeProject> = {};\n const snapshots: { uuid: ProjectFieldUuid; ref: ResourceRef | SignedResourceId }[] = [];\n for (const src of sources) {\n const uuid = randomUUID() as ProjectFieldUuid;\n if (src.kind === \"fresh\") {\n const meta = await tx.getKValueJson<ProjectMeta>(src.sourceRid, ProjectMetaKey);\n const ref = await duplicateProject(tx, src.sourceRid, { label: meta.label });\n projects[uuid] = { label: meta.label, source: src.projectId, updatedAt: sharedAt }; // (re)snapshotted now\n snapshots.push({ uuid, ref });\n } else {\n // Re-attach the prior snapshot; the new envelope references it before the old one is\n // detached in the same tx, so it stays alive. Label and timestamp carry unchanged.\n projects[uuid] = { label: src.label, source: src.projectId, updatedAt: src.updatedAt };\n snapshots.push({ uuid, ref: src.snapshotRid });\n }\n }\n\n const data: EnvelopeData = {\n schemaVersion: EnvelopeSchemaVersionCurrent,\n shareId,\n sharedAt,\n expiresAt: params.expiresAt,\n mode: params.mode,\n sender: params.sender,\n title: params.title,\n payload: { kind: \"projects\", projects },\n };\n\n // Immutable data set once at creation, never altered.\n const envelope = tx.createEphemeral(SharedEnvelopeResourceType, JSON.stringify(data));\n\n // Attach the project snapshots as Input fields, then seal the input set one-way.\n for (const { uuid, ref } of snapshots) {\n tx.createField(field(envelope, envelopeProjectField(uuid)), \"Input\", ref);\n }\n tx.lockInputs(envelope);\n\n // Attach to the outbox under {shareId} in the same transaction so the held-resource rule\n // keeps the ephemeral envelope alive.\n tx.createField(field(outboxRid, shareId), \"Dynamic\", envelope);\n\n return { envelope, data };\n}\n\n/**\n * Builds one {@link SharedEnvelopeResourceType} carrying a template document on the donor side,\n * and attaches it under `{shareId}` on the donor's outbox. The caller issues the grant — always\n * read-only — and commits, keeping create + grant atomic.\n *\n * There is nothing to snapshot and no input field to seal: the document is the whole payload and\n * rides in the envelope's immutable `data`, which is also why the recipient needs no write access\n * (it copies no resource out of the envelope).\n *\n * @returns the new envelope resource and the generated `EnvelopeData`.\n */\nexport function buildTemplateShareEnvelope(\n tx: PlTransaction,\n outboxRid: SignedResourceId,\n template: { document: ProjectTemplateV1; label: string },\n params: {\n sender: string;\n title: string;\n /** ms epoch; sharedAt + ttl for a targeted share, null for share-with-everybody. */\n expiresAt: number | null;\n /** Existing shareId for a change; a fresh one is minted when omitted. */\n shareId?: ShareId;\n sharedAt?: number;\n },\n): { envelope: ResourceRef; data: EnvelopeData } {\n const data: EnvelopeData = {\n schemaVersion: EnvelopeSchemaVersionCurrent,\n shareId: params.shareId ?? newShareId(),\n sharedAt: params.sharedAt ?? Date.now(),\n expiresAt: params.expiresAt,\n mode: \"read-only\",\n sender: params.sender,\n title: params.title,\n payload: {\n kind: \"template\",\n document: template.document,\n label: template.label,\n from: params.sender,\n },\n };\n\n // Immutable data set once at creation, never altered.\n const envelope = tx.createEphemeral(SharedEnvelopeResourceType, JSON.stringify(data));\n\n // Attach to the outbox under {shareId} in the same transaction so the held-resource rule\n // keeps the ephemeral envelope alive.\n tx.createField(field(outboxRid, data.shareId), \"Dynamic\", envelope);\n\n return { envelope, data };\n}\n\n/**\n * Records a response onto the envelope as a dynamic `acceptance/{login}` field: the acceptor\n * writing their own decision (their writable grant permits it), or the donor transferring an\n * existing record onto a changed envelope. Accepts the envelope by ref or id.\n */\nexport function writeEnvelopeAcceptance(\n tx: PlTransaction,\n envelopeRid: ResourceRef | SignedResourceId,\n login: string,\n action: EnvelopeAcceptance[\"action\"],\n timestamp: number,\n): void {\n const acceptance: EnvelopeAcceptance = { action, timestamp };\n const value = tx.createJsonValue(acceptance);\n tx.createField(field(envelopeRid, acceptanceField(login)), \"Dynamic\", value);\n}\n\n//\n// Acceptor side\n//\n\n/**\n * Records the acceptor's decision for a handled share on the acceptor's SharingState as a\n * dynamic `decision/{shareId}` field. Keyed on the logical shareId so discovery dedups on the\n * share, not on the envelope instance.\n */\nexport function writeSharingDecision(\n tx: PlTransaction,\n stateRid: SignedResourceId,\n shareId: ShareId,\n decision: SharingDecision,\n): void {\n const value = tx.createJsonValue(decision);\n tx.createField(field(stateRid, decisionField(shareId)), \"Dynamic\", value);\n}\n\n/**\n * Copies every project snapshot inside an envelope into the acceptor's own project list — a\n * cross-color attach the backend permits. Mirrors {@link duplicateProject}'s `rename` contract,\n * but resolves the source against the envelope tree (not the acceptor's own list), so the\n * wrapper cannot be reused.\n *\n * @returns ids of the projects created in the acceptor's list.\n */\nexport async function copyEnvelopeProjectsIntoList(\n tx: PlTransaction,\n envelopeRid: SignedResourceId,\n projectListRid: SignedResourceId,\n rename?: (previousLabel: string, existingLabels: string[]) => string,\n): Promise<SignedResourceId[]> {\n // Read the acceptor's existing project labels once (own color, no relaxation).\n const projectListData = await tx.getResourceData(projectListRid, true);\n const existingRids = projectListData.fields.map((f) => f.value).filter(isNotNullSignedResourceId);\n const existingLabels = (\n await Promise.all(existingRids.map((rid) => tx.getKValueJson<ProjectMeta>(rid, ProjectMetaKey)))\n ).map((m) => m.label);\n\n // Enumerate the envelope's project/{uuid} input field values (signed envelope-colored ids).\n const envelopeData = await tx.getResourceData(envelopeRid, true);\n const sourceRids = envelopeData.fields\n .filter((f) => isEnvelopeProjectField(f.name))\n .map((f) => f.value)\n .filter(isNotNullSignedResourceId);\n\n const created: SignedResourceId[] = [];\n for (const sourceRid of sourceRids) {\n const sourceMeta = await tx.getKValueJson<ProjectMeta>(sourceRid, ProjectMetaKey);\n const newLabel = rename ? rename(sourceMeta.label, existingLabels) : sourceMeta.label;\n existingLabels.push(newLabel);\n\n // Cross-color attach: a new UserProject in the acceptor's color whose fields point at\n // envelope-colored resources. Fails with PermissionDenied: color mismatch on a backend\n // that lacks crossTreeRefs:v1.\n const newPrj = await duplicateProject(tx, sourceRid, { label: newLabel });\n tx.createField(field(projectListRid, randomUUID()), \"Dynamic\", newPrj);\n\n const signedRid = await newPrj.globalId;\n created.push(signedRid);\n }\n\n return created;\n}\n\n/** String-form ids of the projects created by {@link copyEnvelopeProjectsIntoList}. */\nexport function resourceIdsToStrings(ids: SignedResourceId[]): string[] {\n return ids.map((id) => resourceIdToString(id));\n}\n"],"mappings":";;;;;;;AAyBA,MAAa,6BAA6B;AAC1C,MAAa,wBAAwB,SACnC,GAAG,6BAA6B;;AAGlC,SAAgB,uBAAuB,MAAuB;CAC5D,OAAO,KAAK,WAAW,0BAA0B;AACnD;;AAGA,SAAgB,yBAAyB,MAAgC;CACvE,OAAO,KAAK,MAAM,CAAiC;AACrD;;;;;;;;;;AA8BA,eAAsB,mBACpB,IACA,WACA,SACA,QAUwD;CACxD,MAAM,UAAU,OAAO,WAAW,WAAW;CAC7C,MA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,SAAS,OAAO,WAAW,OAAO,cAAc,IAAI,WAAW;EAChF,eAAe,KAAK,QAAQ;EAK5B,MAAM,SAAS,MAAM,iBAAiB,IAAI,WAAW,EAAE,OAAO,SAAS,CAAC;EACxE,GAAG,YAAY,MAAM,gBAAgB,WAAW,CAAC,GAAG,WAAW,MAAM;EAErE,MAAM,YAAY,MAAM,OAAO;EAC/B,QAAQ,KAAK,SAAS;CACxB;CAEA,OAAO;AACT;;AAGA,SAAgB,qBAAqB,KAAmC;CACtE,OAAO,IAAI,KAAK,OAAO,mBAAmB,EAAE,CAAC;AAC/C"}
1
+ {"version":3,"file":"sharing.js","names":[],"sources":["../../src/mutator/sharing.ts"],"sourcesContent":["import type { PlTransaction, ResourceRef, SignedResourceId } from \"@milaboratories/pl-client\";\nimport { field, isNotNullSignedResourceId } from \"@milaboratories/pl-client\";\nimport { randomUUID } from \"node:crypto\";\nimport type { FolderId, ProjectMeta } from \"@milaboratories/pl-model-middle-layer\";\nimport { normalizeDescription } from \"@milaboratories/pl-model-middle-layer\";\nimport type { ProjectId, ProjectTemplateV1, TemplateId } from \"@milaboratories/pl-model-common\";\nimport { ProjectMetaKey } from \"../model/project_model\";\nimport { duplicateProject } from \"./project\";\nimport type {\n EnvelopeData,\n EnvelopeFolder,\n EnvelopeFolderId,\n EnvelopeFolderProject,\n EnvelopeFolderTemplate,\n EnvelopeMode,\n EnvelopeProject,\n ProjectFieldUuid,\n ShareId,\n ShareHidden,\n} from \"../model/sharing_model\";\nimport {\n EnvelopeSchemaVersionCurrent,\n SharedEnvelopeResourceType,\n hiddenField,\n newProjectFieldUuid,\n newShareId,\n} from \"../model/sharing_model\";\n\n/** Field name carrying a project snapshot inside a {@link SharedEnvelopeResourceType}. */\nexport const EnvelopeProjectFieldPrefix = \"project/\";\nexport const envelopeProjectField = (uuid: ProjectFieldUuid) =>\n `${EnvelopeProjectFieldPrefix}${uuid}`;\n\n/** True for an envelope field that carries a project snapshot. */\nexport function isEnvelopeProjectField(name: string): boolean {\n return name.startsWith(EnvelopeProjectFieldPrefix);\n}\n\n/** Extracts the project field uuid from a `project/{uuid}` field name. */\nexport function envelopeProjectFieldUuid(name: string): ProjectFieldUuid {\n return name.slice(EnvelopeProjectFieldPrefix.length) as ProjectFieldUuid;\n}\n\n//\n// Donor side\n//\n\n/** One live project going into an envelope; it is snapshotted as the envelope is built. */\nexport type EnvelopeProjectSource = { projectId: ProjectId; sourceRid: SignedResourceId };\n\n/**\n * Builds one {@link SharedEnvelopeResourceType} on the donor side inside the given write\n * transaction: snapshots each source project by reference, seals the envelope with its\n * immutable {@link EnvelopeData}, and attaches the envelope under `{shareId}` on the donor's\n * outbox. The caller is responsible for issuing the per-recipient grants and committing the\n * transaction — keeping create + grant atomic.\n *\n * @returns the new envelope resource and the generated `EnvelopeData`.\n */\nexport async function buildShareEnvelope(\n tx: PlTransaction,\n outboxRid: SignedResourceId,\n sources: EnvelopeProjectSource[],\n params: {\n mode: EnvelopeMode;\n sender: string;\n title: string;\n /** ms epoch; sharedAt + ttl for a targeted share, null for share-with-everybody. */\n expiresAt: number | null;\n },\n): Promise<{ envelope: ResourceRef; data: EnvelopeData }> {\n const sharedAt = Date.now();\n const snapshots = await snapshotEnvelopeProjects(tx, sources, sharedAt);\n\n const projects: Record<ProjectFieldUuid, EnvelopeProject> = {};\n for (const { uuid, project } of snapshots) projects[uuid] = project;\n\n const data: EnvelopeData = {\n schemaVersion: EnvelopeSchemaVersionCurrent,\n shareId: newShareId(),\n sharedAt,\n expiresAt: params.expiresAt,\n mode: params.mode,\n sender: params.sender,\n title: params.title,\n payload: { kind: \"projects\", projects },\n };\n\n return { envelope: sealEnvelope(tx, outboxRid, data, snapshots), data };\n}\n\n/**\n * Builds one {@link SharedEnvelopeResourceType} carrying a template document on the donor side,\n * and attaches it under `{shareId}` on the donor's outbox. The caller issues the grant — always\n * read-only — and commits, keeping create + grant atomic.\n *\n * There is nothing to snapshot and no input field to seal: the document is the whole payload and\n * rides in the envelope's immutable `data`, which is also why the recipient needs no write access\n * (it copies no resource out of the envelope).\n *\n * @returns the new envelope resource and the generated `EnvelopeData`.\n */\nexport function buildTemplateShareEnvelope(\n tx: PlTransaction,\n outboxRid: SignedResourceId,\n template: {\n document: ProjectTemplateV1;\n label: string;\n description?: string;\n source: TemplateId;\n },\n params: {\n sender: string;\n title: string;\n /** ms epoch; sharedAt + ttl for a targeted share, null for share-with-everybody. */\n expiresAt: number | null;\n },\n): { envelope: ResourceRef; data: EnvelopeData } {\n const data: EnvelopeData = {\n schemaVersion: EnvelopeSchemaVersionCurrent,\n shareId: newShareId(),\n sharedAt: Date.now(),\n expiresAt: params.expiresAt,\n mode: \"read-only\",\n sender: params.sender,\n title: params.title,\n payload: {\n kind: \"template\",\n document: template.document,\n source: template.source,\n label: template.label,\n ...(template.description === undefined ? {} : { description: template.description }),\n from: params.sender,\n },\n };\n\n return { envelope: sealEnvelope(tx, outboxRid, data, []), data };\n}\n\n/**\n * Builds one {@link SharedEnvelopeResourceType} carrying a folder subtree: the folders, every\n * project in them snapshotted as a `project/{uuid}` field, and every template's document inline.\n * Attaches it under `{shareId}` on the donor's outbox. The caller issues the grant — writable,\n * because the recipient copies the project snapshots out — and commits.\n *\n * Folder ids are minted here and mean nothing outside this envelope: the recipient's own document\n * mints its own. What travels is the shape of the subtree.\n *\n * @returns the new envelope resource and the generated `EnvelopeData`.\n */\nexport async function buildFolderShareEnvelope(\n tx: PlTransaction,\n outboxRid: SignedResourceId,\n subtree: EnvelopeFolderSubtree,\n params: {\n sender: string;\n title: string;\n /** ms epoch; sharedAt + ttl for a targeted share, null for share-with-everybody. */\n expiresAt: number | null;\n },\n): Promise<{ envelope: ResourceRef; data: EnvelopeData }> {\n const sharedAt = Date.now();\n const snapshots = await snapshotEnvelopeProjects(tx, subtree.projects, sharedAt);\n\n const projects: Record<ProjectFieldUuid, EnvelopeFolderProject> = {};\n for (const { uuid, project, source } of snapshots)\n projects[uuid] = { ...project, folder: source.folder };\n\n const data: EnvelopeData = {\n schemaVersion: EnvelopeSchemaVersionCurrent,\n shareId: newShareId(),\n sharedAt,\n expiresAt: params.expiresAt,\n mode: \"copy\",\n sender: params.sender,\n title: params.title,\n payload: {\n kind: \"folder\",\n source: subtree.source,\n folders: subtree.folders,\n projects,\n templates: subtree.templates,\n from: params.sender,\n },\n };\n\n return { envelope: sealEnvelope(tx, outboxRid, data, snapshots), data };\n}\n\n/** A folder subtree ready to be sealed into an envelope: the folders under their envelope-local\n * ids, the live projects to snapshot, and the templates to carry whole. */\nexport interface EnvelopeFolderSubtree {\n /** Donor's own id of the shared folder, carried so a later share of it finds this one. */\n source: FolderId;\n folders: Record<EnvelopeFolderId, EnvelopeFolder>;\n projects: (EnvelopeProjectSource & { folder: EnvelopeFolderId })[];\n templates: EnvelopeFolderTemplate[];\n}\n\n//\n// Recipient side\n//\n\n/**\n * Puts a share out of this recipient's sight, as a dynamic field on their own SharingState.\n * Keyed on the shareId, so a share that replaces this one — a new shareId — is shown again.\n */\nexport function writeShareHidden(\n tx: PlTransaction,\n stateRid: SignedResourceId,\n shareId: ShareId,\n timestamp: number,\n): void {\n const value = tx.createJsonValue({ hidden: true, timestamp } satisfies ShareHidden);\n tx.createField(field(stateRid, hiddenField(shareId)), \"Dynamic\", value);\n}\n\n/** Brings a hidden share back into this recipient's list. */\nexport function clearShareHidden(\n tx: PlTransaction,\n stateRid: SignedResourceId,\n shareId: ShareId,\n): void {\n tx.removeField(field(stateRid, hiddenField(shareId)));\n}\n\n/**\n * Copies every project snapshot inside an envelope into the recipient's own project list — a\n * cross-color attach the backend permits. The source is resolved against the envelope tree, not\n * the recipient's own list.\n *\n * `label` names each copy from its snapshot's label. The caller picks the names against the\n * destination the copies land in, because that is where they have to be free; left out, each copy\n * keeps its snapshot's label.\n *\n * Each result carries the envelope field uuid it was copied from, because that uuid is what the\n * payload names a project by — a folder share reads the folder of each copy off it. Pairing by\n * position would happen to work today and quietly stop working the moment the order does.\n *\n * @returns one entry per copied project: the envelope uuid it came from and its new id.\n */\nexport async function copyEnvelopeProjectsIntoList(\n tx: PlTransaction,\n envelopeRid: SignedResourceId,\n projectListRid: SignedResourceId,\n label?: (sourceLabel: string) => string,\n): Promise<{ uuid: ProjectFieldUuid; rid: SignedResourceId }[]> {\n // Enumerate the envelope's project/{uuid} input fields (signed envelope-colored ids).\n const envelopeData = await tx.getResourceData(envelopeRid, true);\n const sources = envelopeData.fields\n .filter((f) => isEnvelopeProjectField(f.name))\n .flatMap((f) =>\n isNotNullSignedResourceId(f.value)\n ? [{ uuid: envelopeProjectFieldUuid(f.name), sourceRid: f.value }]\n : [],\n );\n\n const created: { uuid: ProjectFieldUuid; rid: SignedResourceId }[] = [];\n for (const { uuid, sourceRid } of sources) {\n const sourceMeta = await tx.getKValueJson<ProjectMeta>(sourceRid, ProjectMetaKey);\n const newLabel = label === undefined ? sourceMeta.label : label(sourceMeta.label);\n\n // Cross-color attach: a new UserProject in the recipient's color whose fields point at\n // envelope-colored resources. Fails with PermissionDenied: color mismatch on a backend\n // that lacks crossTreeRefs:v1.\n const newPrj = await duplicateProject(tx, sourceRid, { ...sourceMeta, label: newLabel });\n tx.createField(field(projectListRid, randomUUID()), \"Dynamic\", newPrj);\n\n created.push({ uuid, rid: await newPrj.globalId });\n }\n\n return created;\n}\n\n//\n// Internals\n//\n\n/** One source project snapshotted for an envelope: the field uuid it rides under, the snapshot\n * itself, and what the payload says about it. */\ntype EnvelopeSnapshot<Source extends EnvelopeProjectSource> = {\n uuid: ProjectFieldUuid;\n ref: ResourceRef;\n source: Source;\n project: EnvelopeProject;\n};\n\n/**\n * Snapshots each source project by reference, in the given order, under a freshly minted field\n * uuid. The payload entry carries the project's label and description as they were at `sharedAt`,\n * so a share list renders without traversing into the snapshot.\n */\nasync function snapshotEnvelopeProjects<Source extends EnvelopeProjectSource>(\n tx: PlTransaction,\n sources: readonly Source[],\n sharedAt: number,\n): Promise<EnvelopeSnapshot<Source>[]> {\n const snapshots: EnvelopeSnapshot<Source>[] = [];\n for (const source of sources) {\n const meta = await tx.getKValueJson<ProjectMeta>(source.sourceRid, ProjectMetaKey);\n const ref = await duplicateProject(tx, source.sourceRid, meta);\n const description = normalizeDescription(meta.description);\n snapshots.push({\n uuid: newProjectFieldUuid(),\n ref,\n source,\n project: {\n label: meta.label,\n source: source.projectId,\n updatedAt: sharedAt,\n ...(description === undefined ? {} : { description }),\n },\n });\n }\n return snapshots;\n}\n\n/**\n * Creates the envelope with its immutable `data`, attaches each snapshot as a `project/{uuid}`\n * input field, and hangs the envelope on the donor's outbox under its shareId.\n *\n * A payload that carries project snapshots has its input set sealed one-way, even when the\n * subtree it describes holds none, because such an envelope is granted writable. A template\n * payload has no input set to seal. The outbox attach happens in the same transaction, so the\n * held-resource rule keeps the ephemeral envelope alive.\n */\nfunction sealEnvelope(\n tx: PlTransaction,\n outboxRid: SignedResourceId,\n data: EnvelopeData,\n snapshots: readonly { uuid: ProjectFieldUuid; ref: ResourceRef }[],\n): ResourceRef {\n const envelope = tx.createEphemeral(SharedEnvelopeResourceType, JSON.stringify(data));\n\n for (const { uuid, ref } of snapshots)\n tx.createField(field(envelope, envelopeProjectField(uuid)), \"Input\", ref);\n if (data.payload.kind !== \"template\") tx.lockInputs(envelope);\n\n tx.createField(field(outboxRid, data.shareId), \"Dynamic\", envelope);\n return envelope;\n}\n"],"mappings":";;;;;;;;AA6BA,MAAa,6BAA6B;AAC1C,MAAa,wBAAwB,SACnC,GAAG,6BAA6B;;AAGlC,SAAgB,uBAAuB,MAAuB;CAC5D,OAAO,KAAK,WAAW,0BAA0B;AACnD;;AAGA,SAAgB,yBAAyB,MAAgC;CACvE,OAAO,KAAK,MAAM,CAAiC;AACrD;;;;;;;;;;AAkBA,eAAsB,mBACpB,IACA,WACA,SACA,QAOwD;CACxD,MAAM,WAAW,KAAK,IAAI;CAC1B,MAAM,YAAY,MAAM,yBAAyB,IAAI,SAAS,QAAQ;CAEtE,MAAM,WAAsD,CAAC;CAC7D,KAAK,MAAM,EAAE,MAAM,aAAa,WA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IAAI,OAAO,WAAW,IAAI;EAC7D,MAAM,cAAc,qBAAqB,KAAK,WAAW;EACzD,UAAU,KAAK;GACb,MAAM,oBAAoB;GAC1B;GACA;GACA,SAAS;IACP,OAAO,KAAK;IACZ,QAAQ,OAAO;IACf,WAAW;IACX,GAAI,gBAAgB,KAAA,IAAY,CAAC,IAAI,EAAE,YAAY;GACrD;EACF,CAAC;CACH;CACA,OAAO;AACT;;;;;;;;;;AAWA,SAAS,aACP,IACA,WACA,MACA,WACa;CACb,MAAM,WAAW,GAAG,gBAAgB,4BAA4B,KAAK,UAAU,IAAI,CAAC;CAEpF,KAAK,MAAM,EAAE,MAAM,SAAS,WAC1B,GAAG,YAAY,MAAM,UAAU,qBAAqB,IAAI,CAAC,GAAG,SAAS,GAAG;CAC1E,IAAI,KAAK,QAAQ,SAAS,YAAY,GAAG,WAAW,QAAQ;CAE5D,GAAG,YAAY,MAAM,WAAW,KAAK,OAAO,GAAG,WAAW,QAAQ;CAClE,OAAO;AACT"}
@@ -1,4 +1,6 @@
1
1
  const require_template_list = require("../middle_layer/template_list.cjs");
2
+ const require_list = require("./list.cjs");
3
+ let _milaboratories_pl_model_middle_layer = require("@milaboratories/pl-model-middle-layer");
2
4
  let _milaboratories_pl_client = require("@milaboratories/pl-client");
3
5
  let node_crypto = require("node:crypto");
4
6
  //#region src/mutator/template.ts
@@ -9,16 +11,20 @@ let node_crypto = require("node:crypto");
9
11
  * Create and attach are the same transaction on purpose: an ephemeral resource nothing
10
12
  * holds is collectable, so the list field is what keeps the template alive.
11
13
  *
12
- * The document rides in the immutable `data` blob, set once here and never altered; only
13
- * the label and the creation timestamp go to KV, and only the label is ever written again.
14
+ * The document rides in the immutable `data` blob, set once here and never altered. The label,
15
+ * the creation timestamp and the description live in KV beside it; the label and the description
16
+ * may be written again later, the timestamp never is. A blank description stores nothing, the
17
+ * same as {@link setTemplateDescription} does.
14
18
  *
15
19
  * @returns the new template resource; the caller reads its `globalId` after the commit.
16
20
  */
17
- function createTemplate(tx, listRid, label, data) {
21
+ function createTemplate(tx, listRid, meta, data) {
18
22
  const tpl = tx.createEphemeral(require_template_list.TemplateResourceType, JSON.stringify(data));
19
23
  tx.lock(tpl);
20
- tx.setKValue(tpl, require_template_list.TemplateLabelKey, JSON.stringify(label));
24
+ tx.setKValue(tpl, require_template_list.TemplateLabelKey, JSON.stringify(meta.label));
21
25
  tx.setKValue(tpl, require_template_list.TemplateCreatedTimestamp, String(Date.now()));
26
+ const description = (0, _milaboratories_pl_model_middle_layer.normalizeDescription)(meta.description);
27
+ if (description !== void 0) tx.setKValue(tpl, require_template_list.TemplateDescriptionKey, JSON.stringify(description));
22
28
  tx.createField((0, _milaboratories_pl_client.field)(listRid, (0, node_crypto.randomUUID)()), "Dynamic", tpl);
23
29
  return tpl;
24
30
  }
@@ -28,27 +34,28 @@ function renameTemplate(tx, rid, label) {
28
34
  tx.setKValue(rid, require_template_list.TemplateLabelKey, JSON.stringify(label));
29
35
  }
30
36
  /**
37
+ * Sets what a stored template says about itself. Blank removes the entry rather than storing an
38
+ * empty one, so a template that was never described and one whose description was cleared are
39
+ * stored the same way.
40
+ */
41
+ function setTemplateDescription(tx, rid, description) {
42
+ const wanted = (0, _milaboratories_pl_model_middle_layer.normalizeDescription)(description);
43
+ if (wanted === void 0) tx.deleteKValue(rid, require_template_list.TemplateDescriptionKey);
44
+ else tx.setKValue(rid, require_template_list.TemplateDescriptionKey, JSON.stringify(wanted));
45
+ }
46
+ /**
31
47
  * Detaches a template from the templates list, which is what destroys it — the list field is
32
48
  * the only thing holding the ephemeral resource.
33
- *
34
- * The field name is a uuid unrelated to the template id, so the field carrying the template
35
- * is found by value, the same way a project is removed from the project list.
36
49
  */
37
50
  async function deleteTemplate(tx, listRid, id) {
38
- const fieldName = await findTemplateField(tx, listRid, id);
39
- if (fieldName === void 0) throw new Error(`Template ${id} not found in template list.`);
40
- tx.removeField((0, _milaboratories_pl_client.field)(listRid, fieldName));
41
- }
42
- async function findTemplateField(tx, listRid, id) {
43
- const data = await tx.getResourceData(listRid, true);
44
- for (const f of data.fields) {
45
- if ((0, _milaboratories_pl_client.isNullSignedResourceId)(f.value)) continue;
46
- if ((0, _milaboratories_pl_client.resourceIdToString)(f.value) === id) return f.name;
47
- }
51
+ const entry = (await require_list.listedById(tx, listRid)).get(id);
52
+ if (entry === void 0) throw require_list.notListedError("Template", id);
53
+ tx.removeField((0, _milaboratories_pl_client.field)(listRid, entry.fieldName));
48
54
  }
49
55
  //#endregion
50
56
  exports.createTemplate = createTemplate;
51
57
  exports.deleteTemplate = deleteTemplate;
52
58
  exports.renameTemplate = renameTemplate;
59
+ exports.setTemplateDescription = setTemplateDescription;
53
60
 
54
61
  //# sourceMappingURL=template.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"template.cjs","names":["TemplateResourceType","TemplateLabelKey","TemplateCreatedTimestamp"],"sources":["../../src/mutator/template.ts"],"sourcesContent":["import type { PlTransaction, ResourceRef, SignedResourceId } from \"@milaboratories/pl-client\";\nimport { field, isNullSignedResourceId, resourceIdToString } from \"@milaboratories/pl-client\";\nimport { randomUUID } from \"node:crypto\";\nimport type { StoredTemplateData, TemplateId } from \"../middle_layer/template_list\";\nimport {\n TemplateCreatedTimestamp,\n TemplateLabelKey,\n TemplateResourceType,\n} from \"../middle_layer/template_list\";\n\n/**\n * Creates one `UserTemplate` inside the given write transaction and attaches it to the\n * templates list under a freshly minted uuid field.\n *\n * Create and attach are the same transaction on purpose: an ephemeral resource nothing\n * holds is collectable, so the list field is what keeps the template alive.\n *\n * The document rides in the immutable `data` blob, set once here and never altered; only\n * the label and the creation timestamp go to KV, and only the label is ever written again.\n *\n * @returns the new template resource; the caller reads its `globalId` after the commit.\n */\nexport function createTemplate(\n tx: PlTransaction,\n listRid: SignedResourceId,\n label: string,\n data: StoredTemplateData,\n): ResourceRef {\n const tpl = tx.createEphemeral(TemplateResourceType, JSON.stringify(data));\n tx.lock(tpl);\n tx.setKValue(tpl, TemplateLabelKey, JSON.stringify(label));\n tx.setKValue(tpl, TemplateCreatedTimestamp, String(Date.now()));\n tx.createField(field(listRid, randomUUID()), \"Dynamic\", tpl);\n return tpl;\n}\n\n/** Renames a stored template. Touches the label KV entry and nothing else, so the stored\n * document stays byte-identical. */\nexport function renameTemplate(tx: PlTransaction, rid: SignedResourceId, label: string): void {\n tx.setKValue(rid, TemplateLabelKey, JSON.stringify(label));\n}\n\n/**\n * Detaches a template from the templates list, which is what destroys it — the list field is\n * the only thing holding the ephemeral resource.\n *\n * The field name is a uuid unrelated to the template id, so the field carrying the template\n * is found by value, the same way a project is removed from the project list.\n */\nexport async function deleteTemplate(\n tx: PlTransaction,\n listRid: SignedResourceId,\n id: TemplateId,\n): Promise<void> {\n const fieldName = await findTemplateField(tx, listRid, id);\n if (fieldName === undefined) throw new Error(`Template ${id} not found in template list.`);\n tx.removeField(field(listRid, fieldName));\n}\n\n//\n// Internals\n//\n\nasync function findTemplateField(\n tx: PlTransaction,\n listRid: SignedResourceId,\n id: TemplateId,\n): Promise<string | undefined> {\n const data = await tx.getResourceData(listRid, true);\n for (const f of data.fields) {\n if (isNullSignedResourceId(f.value)) continue;\n if (resourceIdToString(f.value) === (id as string)) return f.name;\n }\n return undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAsBA,SAAgB,eACd,IACA,SACA,OACA,MACa;CACb,MAAM,MAAM,GAAG,gBAAgBA,sBAAAA,sBAAsB,KAAK,UAAU,IAAI,CAAC;CACzE,GAAG,KAAK,GAAG;CACX,GAAG,UAAU,KAAKC,sBAAAA,kBAAkB,KAAK,UAAU,KAAK,CAAC;CACzD,GAAG,UAAU,KAAKC,sBAAAA,0BAA0B,OAAO,KAAK,IAAI,CAAC,CAAC;CAC9D,GAAG,aAAA,GAAA,0BAAA,MAAA,CAAkB,UAAA,GAAA,YAAA,WAAA,CAAoB,CAAC,GAAG,WAAW,GAAG;CAC3D,OAAO;AACT;;;AAIA,SAAgB,eAAe,IAAmB,KAAuB,OAAqB;CAC5F,GAAG,UAAU,KAAKD,sBAAAA,kBAAkB,KAAK,UAAU,KAAK,CAAC;AAC3D;;;;;;;;AASA,eAAsB,eACpB,IACA,SACA,IACe;CACf,MAAM,YAAY,MAAM,kBAAkB,IAAI,SAAS,EAAE;CACzD,IAAI,cAAc,KAAA,GAAW,MAAM,IAAI,MAAM,YAAY,GAAG,6BAA6B;CACzF,GAAG,aAAA,GAAA,0BAAA,MAAA,CAAkB,SAAS,SAAS,CAAC;AAC1C;AAMA,eAAe,kBACb,IACA,SACA,IAC6B;CAC7B,MAAM,OAAO,MAAM,GAAG,gBAAgB,SAAS,IAAI;CACnD,KAAK,MAAM,KAAK,KAAK,QAAQ;EAC3B,KAAA,GAAA,0BAAA,uBAAA,CAA2B,EAAE,KAAK,GAAG;EACrC,KAAA,GAAA,0BAAA,mBAAA,CAAuB,EAAE,KAAK,MAAO,IAAe,OAAO,EAAE;CAC/D;AAEF"}
1
+ {"version":3,"file":"template.cjs","names":["TemplateResourceType","TemplateLabelKey","TemplateCreatedTimestamp","TemplateDescriptionKey","listedById","notListedError"],"sources":["../../src/mutator/template.ts"],"sourcesContent":["import type {\n AnyResourceRef,\n PlTransaction,\n ResourceRef,\n SignedResourceId,\n} from \"@milaboratories/pl-client\";\nimport { field } from \"@milaboratories/pl-client\";\nimport { normalizeDescription } from \"@milaboratories/pl-model-middle-layer\";\nimport { randomUUID } from \"node:crypto\";\nimport type { StoredTemplateData, TemplateId } from \"../middle_layer/template_list\";\nimport {\n TemplateCreatedTimestamp,\n TemplateDescriptionKey,\n TemplateLabelKey,\n TemplateResourceType,\n} from \"../middle_layer/template_list\";\nimport { listedById, notListedError } from \"./list\";\n\n/**\n * Creates one `UserTemplate` inside the given write transaction and attaches it to the\n * templates list under a freshly minted uuid field.\n *\n * Create and attach are the same transaction on purpose: an ephemeral resource nothing\n * holds is collectable, so the list field is what keeps the template alive.\n *\n * The document rides in the immutable `data` blob, set once here and never altered. The label,\n * the creation timestamp and the description live in KV beside it; the label and the description\n * may be written again later, the timestamp never is. A blank description stores nothing, the\n * same as {@link setTemplateDescription} does.\n *\n * @returns the new template resource; the caller reads its `globalId` after the commit.\n */\nexport function createTemplate(\n tx: PlTransaction,\n listRid: SignedResourceId,\n meta: { readonly label: string; readonly description?: string },\n data: StoredTemplateData,\n): ResourceRef {\n const tpl = tx.createEphemeral(TemplateResourceType, JSON.stringify(data));\n tx.lock(tpl);\n tx.setKValue(tpl, TemplateLabelKey, JSON.stringify(meta.label));\n tx.setKValue(tpl, TemplateCreatedTimestamp, String(Date.now()));\n const description = normalizeDescription(meta.description);\n if (description !== undefined)\n tx.setKValue(tpl, TemplateDescriptionKey, JSON.stringify(description));\n tx.createField(field(listRid, randomUUID()), \"Dynamic\", tpl);\n return tpl;\n}\n\n/** Renames a stored template. Touches the label KV entry and nothing else, so the stored\n * document stays byte-identical. */\nexport function renameTemplate(tx: PlTransaction, rid: SignedResourceId, label: string): void {\n tx.setKValue(rid, TemplateLabelKey, JSON.stringify(label));\n}\n\n/**\n * Sets what a stored template says about itself. Blank removes the entry rather than storing an\n * empty one, so a template that was never described and one whose description was cleared are\n * stored the same way.\n */\nexport function setTemplateDescription(\n tx: PlTransaction,\n rid: AnyResourceRef,\n description: string,\n): void {\n const wanted = normalizeDescription(description);\n if (wanted === undefined) tx.deleteKValue(rid, TemplateDescriptionKey);\n else tx.setKValue(rid, TemplateDescriptionKey, JSON.stringify(wanted));\n}\n\n/**\n * Detaches a template from the templates list, which is what destroys it — the list field is\n * the only thing holding the ephemeral resource.\n */\nexport async function deleteTemplate(\n tx: PlTransaction,\n listRid: SignedResourceId,\n id: TemplateId,\n): Promise<void> {\n const entry = (await listedById(tx, listRid)).get(id);\n if (entry === undefined) throw notListedError(\"Template\", id);\n tx.removeField(field(listRid, entry.fieldName));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAgCA,SAAgB,eACd,IACA,SACA,MACA,MACa;CACb,MAAM,MAAM,GAAG,gBAAgBA,sBAAAA,sBAAsB,KAAK,UAAU,IAAI,CAAC;CACzE,GAAG,KAAK,GAAG;CACX,GAAG,UAAU,KAAKC,sBAAAA,kBAAkB,KAAK,UAAU,KAAK,KAAK,CAAC;CAC9D,GAAG,UAAU,KAAKC,sBAAAA,0BAA0B,OAAO,KAAK,IAAI,CAAC,CAAC;CAC9D,MAAM,eAAA,GAAA,sCAAA,qBAAA,CAAmC,KAAK,WAAW;CACzD,IAAI,gBAAgB,KAAA,GAClB,GAAG,UAAU,KAAKC,sBAAAA,wBAAwB,KAAK,UAAU,WAAW,CAAC;CACvE,GAAG,aAAA,GAAA,0BAAA,MAAA,CAAkB,UAAA,GAAA,YAAA,WAAA,CAAoB,CAAC,GAAG,WAAW,GAAG;CAC3D,OAAO;AACT;;;AAIA,SAAgB,eAAe,IAAmB,KAAuB,OAAqB;CAC5F,GAAG,UAAU,KAAKF,sBAAAA,kBAAkB,KAAK,UAAU,KAAK,CAAC;AAC3D;;;;;;AAOA,SAAgB,uBACd,IACA,KACA,aACM;CACN,MAAM,UAAA,GAAA,sCAAA,qBAAA,CAA8B,WAAW;CAC/C,IAAI,WAAW,KAAA,GAAW,GAAG,aAAa,KAAKE,sBAAAA,sBAAsB;MAChE,GAAG,UAAU,KAAKA,sBAAAA,wBAAwB,KAAK,UAAU,MAAM,CAAC;AACvE;;;;;AAMA,eAAsB,eACpB,IACA,SACA,IACe;CACf,MAAM,SAAS,MAAMC,aAAAA,WAAW,IAAI,OAAO,EAAA,CAAG,IAAI,EAAE;CACpD,IAAI,UAAU,KAAA,GAAW,MAAMC,aAAAA,eAAe,YAAY,EAAE;CAC5D,GAAG,aAAA,GAAA,0BAAA,MAAA,CAAkB,SAAS,MAAM,SAAS,CAAC;AAChD"}
@@ -1,5 +1,7 @@
1
- import { TemplateCreatedTimestamp, TemplateLabelKey, TemplateResourceType } from "../middle_layer/template_list.js";
2
- import { field, isNullSignedResourceId, resourceIdToString } from "@milaboratories/pl-client";
1
+ import { TemplateCreatedTimestamp, TemplateDescriptionKey, TemplateLabelKey, TemplateResourceType } from "../middle_layer/template_list.js";
2
+ import { listedById, notListedError } from "./list.js";
3
+ import { normalizeDescription } from "@milaboratories/pl-model-middle-layer";
4
+ import { field } from "@milaboratories/pl-client";
3
5
  import { randomUUID } from "node:crypto";
4
6
  //#region src/mutator/template.ts
5
7
  /**
@@ -9,16 +11,20 @@ import { randomUUID } from "node:crypto";
9
11
  * Create and attach are the same transaction on purpose: an ephemeral resource nothing
10
12
  * holds is collectable, so the list field is what keeps the template alive.
11
13
  *
12
- * The document rides in the immutable `data` blob, set once here and never altered; only
13
- * the label and the creation timestamp go to KV, and only the label is ever written again.
14
+ * The document rides in the immutable `data` blob, set once here and never altered. The label,
15
+ * the creation timestamp and the description live in KV beside it; the label and the description
16
+ * may be written again later, the timestamp never is. A blank description stores nothing, the
17
+ * same as {@link setTemplateDescription} does.
14
18
  *
15
19
  * @returns the new template resource; the caller reads its `globalId` after the commit.
16
20
  */
17
- function createTemplate(tx, listRid, label, data) {
21
+ function createTemplate(tx, listRid, meta, data) {
18
22
  const tpl = tx.createEphemeral(TemplateResourceType, JSON.stringify(data));
19
23
  tx.lock(tpl);
20
- tx.setKValue(tpl, TemplateLabelKey, JSON.stringify(label));
24
+ tx.setKValue(tpl, TemplateLabelKey, JSON.stringify(meta.label));
21
25
  tx.setKValue(tpl, TemplateCreatedTimestamp, String(Date.now()));
26
+ const description = normalizeDescription(meta.description);
27
+ if (description !== void 0) tx.setKValue(tpl, TemplateDescriptionKey, JSON.stringify(description));
22
28
  tx.createField(field(listRid, randomUUID()), "Dynamic", tpl);
23
29
  return tpl;
24
30
  }
@@ -28,25 +34,25 @@ function renameTemplate(tx, rid, label) {
28
34
  tx.setKValue(rid, TemplateLabelKey, JSON.stringify(label));
29
35
  }
30
36
  /**
37
+ * Sets what a stored template says about itself. Blank removes the entry rather than storing an
38
+ * empty one, so a template that was never described and one whose description was cleared are
39
+ * stored the same way.
40
+ */
41
+ function setTemplateDescription(tx, rid, description) {
42
+ const wanted = normalizeDescription(description);
43
+ if (wanted === void 0) tx.deleteKValue(rid, TemplateDescriptionKey);
44
+ else tx.setKValue(rid, TemplateDescriptionKey, JSON.stringify(wanted));
45
+ }
46
+ /**
31
47
  * Detaches a template from the templates list, which is what destroys it — the list field is
32
48
  * the only thing holding the ephemeral resource.
33
- *
34
- * The field name is a uuid unrelated to the template id, so the field carrying the template
35
- * is found by value, the same way a project is removed from the project list.
36
49
  */
37
50
  async function deleteTemplate(tx, listRid, id) {
38
- const fieldName = await findTemplateField(tx, listRid, id);
39
- if (fieldName === void 0) throw new Error(`Template ${id} not found in template list.`);
40
- tx.removeField(field(listRid, fieldName));
41
- }
42
- async function findTemplateField(tx, listRid, id) {
43
- const data = await tx.getResourceData(listRid, true);
44
- for (const f of data.fields) {
45
- if (isNullSignedResourceId(f.value)) continue;
46
- if (resourceIdToString(f.value) === id) return f.name;
47
- }
51
+ const entry = (await listedById(tx, listRid)).get(id);
52
+ if (entry === void 0) throw notListedError("Template", id);
53
+ tx.removeField(field(listRid, entry.fieldName));
48
54
  }
49
55
  //#endregion
50
- export { createTemplate, deleteTemplate, renameTemplate };
56
+ export { createTemplate, deleteTemplate, renameTemplate, setTemplateDescription };
51
57
 
52
58
  //# sourceMappingURL=template.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"template.js","names":[],"sources":["../../src/mutator/template.ts"],"sourcesContent":["import type { PlTransaction, ResourceRef, SignedResourceId } from \"@milaboratories/pl-client\";\nimport { field, isNullSignedResourceId, resourceIdToString } from \"@milaboratories/pl-client\";\nimport { randomUUID } from \"node:crypto\";\nimport type { StoredTemplateData, TemplateId } from \"../middle_layer/template_list\";\nimport {\n TemplateCreatedTimestamp,\n TemplateLabelKey,\n TemplateResourceType,\n} from \"../middle_layer/template_list\";\n\n/**\n * Creates one `UserTemplate` inside the given write transaction and attaches it to the\n * templates list under a freshly minted uuid field.\n *\n * Create and attach are the same transaction on purpose: an ephemeral resource nothing\n * holds is collectable, so the list field is what keeps the template alive.\n *\n * The document rides in the immutable `data` blob, set once here and never altered; only\n * the label and the creation timestamp go to KV, and only the label is ever written again.\n *\n * @returns the new template resource; the caller reads its `globalId` after the commit.\n */\nexport function createTemplate(\n tx: PlTransaction,\n listRid: SignedResourceId,\n label: string,\n data: StoredTemplateData,\n): ResourceRef {\n const tpl = tx.createEphemeral(TemplateResourceType, JSON.stringify(data));\n tx.lock(tpl);\n tx.setKValue(tpl, TemplateLabelKey, JSON.stringify(label));\n tx.setKValue(tpl, TemplateCreatedTimestamp, String(Date.now()));\n tx.createField(field(listRid, randomUUID()), \"Dynamic\", tpl);\n return tpl;\n}\n\n/** Renames a stored template. Touches the label KV entry and nothing else, so the stored\n * document stays byte-identical. */\nexport function renameTemplate(tx: PlTransaction, rid: SignedResourceId, label: string): void {\n tx.setKValue(rid, TemplateLabelKey, JSON.stringify(label));\n}\n\n/**\n * Detaches a template from the templates list, which is what destroys it — the list field is\n * the only thing holding the ephemeral resource.\n *\n * The field name is a uuid unrelated to the template id, so the field carrying the template\n * is found by value, the same way a project is removed from the project list.\n */\nexport async function deleteTemplate(\n tx: PlTransaction,\n listRid: SignedResourceId,\n id: TemplateId,\n): Promise<void> {\n const fieldName = await findTemplateField(tx, listRid, id);\n if (fieldName === undefined) throw new Error(`Template ${id} not found in template list.`);\n tx.removeField(field(listRid, fieldName));\n}\n\n//\n// Internals\n//\n\nasync function findTemplateField(\n tx: PlTransaction,\n listRid: SignedResourceId,\n id: TemplateId,\n): Promise<string | undefined> {\n const data = await tx.getResourceData(listRid, true);\n for (const f of data.fields) {\n if (isNullSignedResourceId(f.value)) continue;\n if (resourceIdToString(f.value) === (id as string)) return f.name;\n }\n return undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAsBA,SAAgB,eACd,IACA,SACA,OACA,MACa;CACb,MAAM,MAAM,GAAG,gBAAgB,sBAAsB,KAAK,UAAU,IAAI,CAAC;CACzE,GAAG,KAAK,GAAG;CACX,GAAG,UAAU,KAAK,kBAAkB,KAAK,UAAU,KAAK,CAAC;CACzD,GAAG,UAAU,KAAK,0BAA0B,OAAO,KAAK,IAAI,CAAC,CAAC;CAC9D,GAAG,YAAY,MAAM,SAAS,WAAW,CAAC,GAAG,WAAW,GAAG;CAC3D,OAAO;AACT;;;AAIA,SAAgB,eAAe,IAAmB,KAAuB,OAAqB;CAC5F,GAAG,UAAU,KAAK,kBAAkB,KAAK,UAAU,KAAK,CAAC;AAC3D;;;;;;;;AASA,eAAsB,eACpB,IACA,SACA,IACe;CACf,MAAM,YAAY,MAAM,kBAAkB,IAAI,SAAS,EAAE;CACzD,IAAI,cAAc,KAAA,GAAW,MAAM,IAAI,MAAM,YAAY,GAAG,6BAA6B;CACzF,GAAG,YAAY,MAAM,SAAS,SAAS,CAAC;AAC1C;AAMA,eAAe,kBACb,IACA,SACA,IAC6B;CAC7B,MAAM,OAAO,MAAM,GAAG,gBAAgB,SAAS,IAAI;CACnD,KAAK,MAAM,KAAK,KAAK,QAAQ;EAC3B,IAAI,uBAAuB,EAAE,KAAK,GAAG;EACrC,IAAI,mBAAmB,EAAE,KAAK,MAAO,IAAe,OAAO,EAAE;CAC/D;AAEF"}
1
+ {"version":3,"file":"template.js","names":[],"sources":["../../src/mutator/template.ts"],"sourcesContent":["import type {\n AnyResourceRef,\n PlTransaction,\n ResourceRef,\n SignedResourceId,\n} from \"@milaboratories/pl-client\";\nimport { field } from \"@milaboratories/pl-client\";\nimport { normalizeDescription } from \"@milaboratories/pl-model-middle-layer\";\nimport { randomUUID } from \"node:crypto\";\nimport type { StoredTemplateData, TemplateId } from \"../middle_layer/template_list\";\nimport {\n TemplateCreatedTimestamp,\n TemplateDescriptionKey,\n TemplateLabelKey,\n TemplateResourceType,\n} from \"../middle_layer/template_list\";\nimport { listedById, notListedError } from \"./list\";\n\n/**\n * Creates one `UserTemplate` inside the given write transaction and attaches it to the\n * templates list under a freshly minted uuid field.\n *\n * Create and attach are the same transaction on purpose: an ephemeral resource nothing\n * holds is collectable, so the list field is what keeps the template alive.\n *\n * The document rides in the immutable `data` blob, set once here and never altered. The label,\n * the creation timestamp and the description live in KV beside it; the label and the description\n * may be written again later, the timestamp never is. A blank description stores nothing, the\n * same as {@link setTemplateDescription} does.\n *\n * @returns the new template resource; the caller reads its `globalId` after the commit.\n */\nexport function createTemplate(\n tx: PlTransaction,\n listRid: SignedResourceId,\n meta: { readonly label: string; readonly description?: string },\n data: StoredTemplateData,\n): ResourceRef {\n const tpl = tx.createEphemeral(TemplateResourceType, JSON.stringify(data));\n tx.lock(tpl);\n tx.setKValue(tpl, TemplateLabelKey, JSON.stringify(meta.label));\n tx.setKValue(tpl, TemplateCreatedTimestamp, String(Date.now()));\n const description = normalizeDescription(meta.description);\n if (description !== undefined)\n tx.setKValue(tpl, TemplateDescriptionKey, JSON.stringify(description));\n tx.createField(field(listRid, randomUUID()), \"Dynamic\", tpl);\n return tpl;\n}\n\n/** Renames a stored template. Touches the label KV entry and nothing else, so the stored\n * document stays byte-identical. */\nexport function renameTemplate(tx: PlTransaction, rid: SignedResourceId, label: string): void {\n tx.setKValue(rid, TemplateLabelKey, JSON.stringify(label));\n}\n\n/**\n * Sets what a stored template says about itself. Blank removes the entry rather than storing an\n * empty one, so a template that was never described and one whose description was cleared are\n * stored the same way.\n */\nexport function setTemplateDescription(\n tx: PlTransaction,\n rid: AnyResourceRef,\n description: string,\n): void {\n const wanted = normalizeDescription(description);\n if (wanted === undefined) tx.deleteKValue(rid, TemplateDescriptionKey);\n else tx.setKValue(rid, TemplateDescriptionKey, JSON.stringify(wanted));\n}\n\n/**\n * Detaches a template from the templates list, which is what destroys it — the list field is\n * the only thing holding the ephemeral resource.\n */\nexport async function deleteTemplate(\n tx: PlTransaction,\n listRid: SignedResourceId,\n id: TemplateId,\n): Promise<void> {\n const entry = (await listedById(tx, listRid)).get(id);\n if (entry === undefined) throw notListedError(\"Template\", id);\n tx.removeField(field(listRid, entry.fieldName));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAgCA,SAAgB,eACd,IACA,SACA,MACA,MACa;CACb,MAAM,MAAM,GAAG,gBAAgB,sBAAsB,KAAK,UAAU,IAAI,CAAC;CACzE,GAAG,KAAK,GAAG;CACX,GAAG,UAAU,KAAK,kBAAkB,KAAK,UAAU,KAAK,KAAK,CAAC;CAC9D,GAAG,UAAU,KAAK,0BAA0B,OAAO,KAAK,IAAI,CAAC,CAAC;CAC9D,MAAM,cAAc,qBAAqB,KAAK,WAAW;CACzD,IAAI,gBAAgB,KAAA,GAClB,GAAG,UAAU,KAAK,wBAAwB,KAAK,UAAU,WAAW,CAAC;CACvE,GAAG,YAAY,MAAM,SAAS,WAAW,CAAC,GAAG,WAAW,GAAG;CAC3D,OAAO;AACT;;;AAIA,SAAgB,eAAe,IAAmB,KAAuB,OAAqB;CAC5F,GAAG,UAAU,KAAK,kBAAkB,KAAK,UAAU,KAAK,CAAC;AAC3D;;;;;;AAOA,SAAgB,uBACd,IACA,KACA,aACM;CACN,MAAM,SAAS,qBAAqB,WAAW;CAC/C,IAAI,WAAW,KAAA,GAAW,GAAG,aAAa,KAAK,sBAAsB;MAChE,GAAG,UAAU,KAAK,wBAAwB,KAAK,UAAU,MAAM,CAAC;AACvE;;;;;AAMA,eAAsB,eACpB,IACA,SACA,IACe;CACf,MAAM,SAAS,MAAM,WAAW,IAAI,OAAO,EAAA,CAAG,IAAI,EAAE;CACpD,IAAI,UAAU,KAAA,GAAW,MAAM,eAAe,YAAY,EAAE;CAC5D,GAAG,YAAY,MAAM,SAAS,MAAM,SAAS,CAAC;AAChD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milaboratories/pl-middle-layer",
3
- "version": "1.71.15",
3
+ "version": "1.72.0",
4
4
  "description": "Pl Middle Layer",
5
5
  "keywords": [],
6
6
  "license": "UNLICENSED",
@@ -30,26 +30,26 @@
30
30
  "utility-types": "^3.11.0",
31
31
  "yaml": "^2.8.0",
32
32
  "zod": "~3.25.76",
33
+ "@milaboratories/pf-driver": "1.9.5",
34
+ "@milaboratories/columns-collection-driver": "0.2.7",
33
35
  "@milaboratories/computable": "2.9.8",
34
- "@milaboratories/columns-collection-driver": "0.2.5",
35
36
  "@milaboratories/helpers": "1.14.5",
36
- "@milaboratories/pf-spec-driver": "1.5.3",
37
- "@milaboratories/pl-client": "3.17.1",
38
- "@milaboratories/pl-deployments": "3.0.17",
39
- "@milaboratories/pl-crash-recorder": "0.3.1",
40
- "@milaboratories/pl-drivers": "1.16.24",
41
- "@milaboratories/pf-driver": "1.9.3",
37
+ "@milaboratories/pf-spec-driver": "1.5.5",
38
+ "@milaboratories/pl-crash-recorder": "0.3.3",
39
+ "@milaboratories/pl-client": "3.17.3",
40
+ "@milaboratories/pl-deployments": "3.0.19",
41
+ "@milaboratories/pl-drivers": "1.16.26",
42
+ "@milaboratories/pl-errors": "1.4.44",
42
43
  "@milaboratories/pl-http": "1.2.4",
43
- "@milaboratories/pl-errors": "1.4.42",
44
- "@milaboratories/pl-model-common": "1.49.0",
45
- "@milaboratories/pl-model-middle-layer": "1.32.1",
46
- "@milaboratories/pl-tree": "1.15.2",
44
+ "@milaboratories/pl-model-backend": "1.4.29",
45
+ "@milaboratories/pl-model-common": "1.51.0",
46
+ "@milaboratories/pl-model-middle-layer": "1.33.0",
47
+ "@milaboratories/pl-tree": "1.15.4",
47
48
  "@milaboratories/resolve-helper": "1.1.3",
48
- "@milaboratories/pl-model-backend": "1.4.27",
49
49
  "@milaboratories/ts-helpers": "1.8.6",
50
- "@platforma-sdk/block-tools": "2.16.1",
51
- "@platforma-sdk/model": "1.83.17",
52
- "@platforma-sdk/workflow-tengo": "6.12.1"
50
+ "@platforma-sdk/block-tools": "2.16.3",
51
+ "@platforma-sdk/workflow-tengo": "6.12.1",
52
+ "@platforma-sdk/model": "1.84.1"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@types/node": "~24.5.2",
@@ -57,9 +57,9 @@
57
57
  "@vitest/coverage-istanbul": "^4.1.3",
58
58
  "typescript": "7.0.2",
59
59
  "vitest": "^4.1.3",
60
+ "@milaboratories/build-configs": "2.0.2",
60
61
  "@milaboratories/ts-builder": "1.7.2",
61
- "@milaboratories/ts-configs": "1.4.0",
62
- "@milaboratories/build-configs": "2.0.2"
62
+ "@milaboratories/ts-configs": "1.4.0"
63
63
  },
64
64
  "engines": {
65
65
  "node": ">=22.19.0"