@milaboratories/pl-model-middle-layer 1.34.3 → 1.34.5

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 (146) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +2 -3
  2. package/dist/_virtual/_rolldown/runtime.js +1 -2
  3. package/dist/block_meta/block_components.cjs +1 -2
  4. package/dist/block_meta/block_components.d.ts +0 -2
  5. package/dist/block_meta/block_components.d.ts.map +1 -1
  6. package/dist/block_meta/block_components.js +1 -2
  7. package/dist/block_meta/block_description.cjs +1 -2
  8. package/dist/block_meta/block_description.cjs.map +1 -1
  9. package/dist/block_meta/block_description.d.ts +0 -2
  10. package/dist/block_meta/block_description.d.ts.map +1 -1
  11. package/dist/block_meta/block_description.js +1 -2
  12. package/dist/block_meta/block_id.cjs +1 -2
  13. package/dist/block_meta/block_id.d.ts +0 -2
  14. package/dist/block_meta/block_id.d.ts.map +1 -1
  15. package/dist/block_meta/block_id.js +1 -2
  16. package/dist/block_meta/block_manifest.cjs +1 -2
  17. package/dist/block_meta/block_manifest.cjs.map +1 -1
  18. package/dist/block_meta/block_manifest.d.ts +0 -2
  19. package/dist/block_meta/block_manifest.d.ts.map +1 -1
  20. package/dist/block_meta/block_manifest.js +1 -2
  21. package/dist/block_meta/block_meta.cjs +1 -2
  22. package/dist/block_meta/block_meta.d.ts +0 -2
  23. package/dist/block_meta/block_meta.d.ts.map +1 -1
  24. package/dist/block_meta/block_meta.js +1 -2
  25. package/dist/block_meta/common.d.ts +0 -2
  26. package/dist/block_meta/common.d.ts.map +1 -1
  27. package/dist/block_meta/content_conversion.cjs +1 -2
  28. package/dist/block_meta/content_conversion.d.ts +0 -2
  29. package/dist/block_meta/content_conversion.d.ts.map +1 -1
  30. package/dist/block_meta/content_conversion.js +1 -2
  31. package/dist/block_meta/content_types.cjs +1 -2
  32. package/dist/block_meta/content_types.d.ts +0 -2
  33. package/dist/block_meta/content_types.d.ts.map +1 -1
  34. package/dist/block_meta/content_types.js +1 -2
  35. package/dist/block_meta/semver.cjs +1 -2
  36. package/dist/block_meta/semver.cjs.map +1 -1
  37. package/dist/block_meta/semver.d.ts +0 -2
  38. package/dist/block_meta/semver.d.ts.map +1 -1
  39. package/dist/block_meta/semver.js +1 -2
  40. package/dist/block_registry/block_pack_spec.cjs +1 -2
  41. package/dist/block_registry/block_pack_spec.d.ts +0 -2
  42. package/dist/block_registry/block_pack_spec.d.ts.map +1 -1
  43. package/dist/block_registry/block_pack_spec.js +1 -2
  44. package/dist/block_registry/overview.cjs +1 -2
  45. package/dist/block_registry/overview.d.ts +0 -2
  46. package/dist/block_registry/overview.d.ts.map +1 -1
  47. package/dist/block_registry/overview.js +1 -2
  48. package/dist/block_registry/registry_spec.cjs +1 -2
  49. package/dist/block_registry/registry_spec.d.ts +0 -2
  50. package/dist/block_registry/registry_spec.d.ts.map +1 -1
  51. package/dist/block_registry/registry_spec.js +1 -2
  52. package/dist/block_settings.cjs +1 -2
  53. package/dist/block_settings.d.ts +0 -2
  54. package/dist/block_settings.d.ts.map +1 -1
  55. package/dist/block_settings.js +1 -2
  56. package/dist/block_state.d.ts +0 -2
  57. package/dist/block_state.d.ts.map +1 -1
  58. package/dist/folders/commit.cjs +1 -2
  59. package/dist/folders/commit.cjs.map +1 -1
  60. package/dist/folders/commit.d.ts +0 -2
  61. package/dist/folders/commit.d.ts.map +1 -1
  62. package/dist/folders/commit.js +1 -2
  63. package/dist/folders/commit.js.map +1 -1
  64. package/dist/folders/decode.cjs +1 -2
  65. package/dist/folders/decode.d.ts +0 -2
  66. package/dist/folders/decode.d.ts.map +1 -1
  67. package/dist/folders/decode.js +1 -2
  68. package/dist/folders/document.cjs +1 -2
  69. package/dist/folders/document.d.ts +0 -2
  70. package/dist/folders/document.d.ts.map +1 -1
  71. package/dist/folders/document.js +1 -2
  72. package/dist/folders/inheritance.cjs +3 -3
  73. package/dist/folders/inheritance.cjs.map +1 -1
  74. package/dist/folders/inheritance.d.ts +0 -2
  75. package/dist/folders/inheritance.d.ts.map +1 -1
  76. package/dist/folders/inheritance.js +3 -3
  77. package/dist/folders/inheritance.js.map +1 -1
  78. package/dist/folders/invariants.cjs +1 -2
  79. package/dist/folders/invariants.cjs.map +1 -1
  80. package/dist/folders/invariants.d.ts +0 -2
  81. package/dist/folders/invariants.d.ts.map +1 -1
  82. package/dist/folders/invariants.js +1 -2
  83. package/dist/folders/naming.cjs +1 -2
  84. package/dist/folders/naming.d.ts +0 -2
  85. package/dist/folders/naming.d.ts.map +1 -1
  86. package/dist/folders/naming.js +1 -2
  87. package/dist/folders/planner.cjs +1 -3
  88. package/dist/folders/planner.cjs.map +1 -1
  89. package/dist/folders/planner.d.ts +0 -2
  90. package/dist/folders/planner.d.ts.map +1 -1
  91. package/dist/folders/planner.js +1 -3
  92. package/dist/folders/planner.js.map +1 -1
  93. package/dist/folders/removal.cjs +1 -2
  94. package/dist/folders/removal.d.ts +0 -2
  95. package/dist/folders/removal.d.ts.map +1 -1
  96. package/dist/folders/removal.js +1 -2
  97. package/dist/folders/view.cjs +1 -2
  98. package/dist/folders/view.d.ts +0 -2
  99. package/dist/folders/view.d.ts.map +1 -1
  100. package/dist/folders/view.js +1 -2
  101. package/dist/json.cjs +6 -5
  102. package/dist/json.cjs.map +1 -1
  103. package/dist/json.d.ts +0 -2
  104. package/dist/json.d.ts.map +1 -1
  105. package/dist/json.js +6 -5
  106. package/dist/json.js.map +1 -1
  107. package/dist/pframe/internal_api/api_factory.cjs +1 -2
  108. package/dist/pframe/internal_api/api_factory.d.ts +0 -2
  109. package/dist/pframe/internal_api/api_factory.d.ts.map +1 -1
  110. package/dist/pframe/internal_api/api_factory.js +1 -2
  111. package/dist/pframe/internal_api/api_read.d.ts +0 -2
  112. package/dist/pframe/internal_api/api_read.d.ts.map +1 -1
  113. package/dist/pframe/internal_api/common.d.ts +0 -2
  114. package/dist/pframe/internal_api/common.d.ts.map +1 -1
  115. package/dist/pframe/internal_api/create_table.d.ts +0 -2
  116. package/dist/pframe/internal_api/create_table.d.ts.map +1 -1
  117. package/dist/pframe/internal_api/delete_column.d.ts +0 -2
  118. package/dist/pframe/internal_api/delete_column.d.ts.map +1 -1
  119. package/dist/pframe/internal_api/discover_columns.d.ts +0 -2
  120. package/dist/pframe/internal_api/discover_columns.d.ts.map +1 -1
  121. package/dist/pframe/internal_api/find_columns.d.ts +0 -2
  122. package/dist/pframe/internal_api/find_columns.d.ts.map +1 -1
  123. package/dist/pframe/internal_api/http_helpers.cjs +1 -2
  124. package/dist/pframe/internal_api/http_helpers.d.ts +0 -2
  125. package/dist/pframe/internal_api/http_helpers.d.ts.map +1 -1
  126. package/dist/pframe/internal_api/http_helpers.js +1 -2
  127. package/dist/pframe/internal_api/index.cjs +1 -2
  128. package/dist/pframe/internal_api/index.d.ts +0 -1
  129. package/dist/pframe/internal_api/index.js +1 -2
  130. package/dist/pframe/internal_api/pframe.d.ts +0 -2
  131. package/dist/pframe/internal_api/pframe.d.ts.map +1 -1
  132. package/dist/pframe/internal_api/table.d.ts +0 -2
  133. package/dist/pframe/internal_api/table.d.ts.map +1 -1
  134. package/dist/project.cjs +1 -2
  135. package/dist/project.d.ts +0 -2
  136. package/dist/project.d.ts.map +1 -1
  137. package/dist/project.js +1 -2
  138. package/dist/project_list.d.ts +0 -2
  139. package/dist/project_list.d.ts.map +1 -1
  140. package/dist/project_overview.d.ts +0 -2
  141. package/dist/project_overview.d.ts.map +1 -1
  142. package/dist/storage_debug_view.d.ts +0 -2
  143. package/dist/storage_debug_view.d.ts.map +1 -1
  144. package/dist/update_info.d.ts +0 -2
  145. package/dist/update_info.d.ts.map +1 -1
  146. package/package.json +15 -10
@@ -2,7 +2,6 @@ import { FolderId, FoldersDocument } from "./document.js";
2
2
  import { FoldersItem } from "./planner.js";
3
3
  import { FoldersProjectInput, FoldersTemplateInput } from "./view.js";
4
4
  import { ProjectId, TemplateId } from "@milaboratories/pl-model-common";
5
- //#region src/folders/invariants.d.ts
6
5
  /** One way a document breaks the rules the write path enforces. */
7
6
  export type FoldersViolation = {
8
7
  readonly kind: "duplicate-folder-id";
@@ -46,5 +45,4 @@ export type FoldersViolation = {
46
45
  export declare function validateFoldersDocument(document: FoldersDocument, projects?: readonly FoldersProjectInput[], templates?: readonly FoldersTemplateInput[]): readonly FoldersViolation[];
47
46
  /** A one-line description of a violation, for an error a user or a log will read. */
48
47
  export declare function formatFoldersViolation(violation: FoldersViolation): string;
49
- //#endregion
50
48
  //# sourceMappingURL=invariants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"invariants.d.ts","names":[],"sources":["../../src/folders/invariants.ts"],"mappings":";;;;;;YAQY;WACG;WAAsC,QAAQ;;WAC9C;WAAoC,QAAQ;;WAE5C;WACA,QAAQ;WACR,QAAQ;;WAER;WAAwB,QAAQ;;WAEhC;;WAEA,MAAM;WACN,SAAS;WACT;;WAGA;WACA,SAAS;WACT,QAAQ;;WAGR;WACA,UAAU;WACV,QAAQ;;;;;;;;;;;;;wBAcP,wBACd,UAAU,iBACV,oBAAoB,uBACpB,qBAAqB,kCACX;;wBAsEI,uBAAuB,WAAW"}
1
+ {"version":3,"file":"invariants.d.ts","names":[],"sources":["../../src/folders/invariants.ts"],"mappings":";;;;;YAQY;WACG;WAAsC,QAAQ;;WAC9C;WAAoC,QAAQ;;WAE5C;WACA,QAAQ;WACR,QAAQ;;WAER;WAAwB,QAAQ;;WAEhC;;WAEA,MAAM;WACN,SAAS;WACT;;WAGA;WACA,SAAS;WACT,QAAQ;;WAGR;WACA,UAAU;WACV,QAAQ;;;;;;;;;;;;;wBAcP,wBACd,UAAU,iBACV,oBAAoB,uBACpB,qBAAqB,kCACX;;wBAsEI,uBAAuB,WAAW"}
@@ -1,6 +1,6 @@
1
1
  import { foldersNameBlank, foldersNameTaken } from "./naming.js";
2
2
  import { asProjectId, asTemplateId } from "@milaboratories/pl-model-common";
3
- //#region src/folders/invariants.ts
3
+ // src/folders/invariants.ts
4
4
  /**
5
5
  * Everything wrong with a document, in one pass.
6
6
  *
@@ -108,7 +108,6 @@ function onCycle(id, byId) {
108
108
  }
109
109
  return false;
110
110
  }
111
- //#endregion
112
111
  export { formatFoldersViolation, validateFoldersDocument };
113
112
 
114
113
  //# sourceMappingURL=invariants.js.map
@@ -1,4 +1,4 @@
1
- //#region src/folders/naming.ts
1
+ // src/folders/naming.ts
2
2
  /**
3
3
  * The one naming rule for folders, projects and templates.
4
4
  *
@@ -46,7 +46,6 @@ const COPY_SUFFIX = / \(Copy(?: \d+)?\)$/;
46
46
  function normalizeName(name) {
47
47
  return name.trim().toLowerCase();
48
48
  }
49
- //#endregion
50
49
  exports.foldersNameBlank = foldersNameBlank;
51
50
  exports.foldersNameTaken = foldersNameTaken;
52
51
  exports.foldersUniqueName = foldersUniqueName;
@@ -1,4 +1,3 @@
1
- //#region src/folders/naming.d.ts
2
1
  /**
3
2
  * The one naming rule for folders, projects and templates.
4
3
  *
@@ -28,5 +27,4 @@ export declare function foldersNameBlank(name: string): boolean;
28
27
  * an existing copy suffix is replaced rather than stacked, so repeated copies stay readable.
29
28
  */
30
29
  export declare function foldersUniqueName(desiredName: string, siblingNames: Iterable<string>): string;
31
- //#endregion
32
30
  //# sourceMappingURL=naming.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"naming.d.ts","names":[],"sources":["../../src/folders/naming.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;wBAoBgB,iBAAiB,cAAc,cAAc;;wBAO7C,iBAAiB;;;;;;;wBAUjB,kBAAkB,qBAAqB,cAAc"}
1
+ {"version":3,"file":"naming.d.ts","names":[],"sources":["../../src/folders/naming.ts"],"mappings":";;;;;;;;;;;;;;;;;;;wBAoBgB,iBAAiB,cAAc,cAAc;;wBAO7C,iBAAiB;;;;;;;wBAUjB,kBAAkB,qBAAqB,cAAc"}
@@ -1,4 +1,4 @@
1
- //#region src/folders/naming.ts
1
+ // src/folders/naming.ts
2
2
  /**
3
3
  * The one naming rule for folders, projects and templates.
4
4
  *
@@ -46,7 +46,6 @@ const COPY_SUFFIX = / \(Copy(?: \d+)?\)$/;
46
46
  function normalizeName(name) {
47
47
  return name.trim().toLowerCase();
48
48
  }
49
- //#endregion
50
49
  export { foldersNameBlank, foldersNameTaken, foldersUniqueName };
51
50
 
52
51
  //# sourceMappingURL=naming.js.map
@@ -1,6 +1,6 @@
1
1
  const require_view = require("./view.cjs");
2
2
  const require_naming = require("./naming.cjs");
3
- //#region src/folders/planner.ts
3
+ // src/folders/planner.ts
4
4
  /**
5
5
  * Plan a move of any mix of folders, projects and templates into one destination.
6
6
  *
@@ -117,7 +117,6 @@ function applyFoldersMove(view, movePlan) {
117
117
  item: entry.item,
118
118
  name: entry.name
119
119
  });
120
- break;
121
120
  }
122
121
  const folders = view.folders.map((folder) => ({
123
122
  ...folder,
@@ -184,7 +183,6 @@ const KIND_ORDER = {
184
183
  project: 1,
185
184
  template: 2
186
185
  };
187
- //#endregion
188
186
  exports.applyFoldersMove = applyFoldersMove;
189
187
  exports.foldersMovePlansEqual = foldersMovePlansEqual;
190
188
  exports.planFoldersMove = planFoldersMove;
@@ -1 +1 @@
1
- {"version":3,"file":"planner.cjs","names":["foldersSubtree","foldersSiblingNames","foldersUniqueName","foldersDocumentFromView"],"sources":["../../src/folders/planner.ts"],"sourcesContent":["import type { ProjectId, TemplateId } from \"@milaboratories/pl-model-common\";\nimport type { FoldersDocument, FolderId } from \"./document\";\nimport { foldersUniqueName } from \"./naming\";\nimport type { FoldersView } from \"./view\";\nimport { foldersDocumentFromView, foldersSiblingNames, foldersSubtree } from \"./view\";\n\n/** A folder, a project or a stored template, as something a move acts on. */\nexport type FoldersItem =\n | { readonly kind: \"folder\"; readonly id: FolderId }\n | { readonly kind: \"project\"; readonly id: ProjectId }\n | { readonly kind: \"template\"; readonly id: TemplateId };\n\n/** A tree item that is not a folder: a project or a stored template. */\nexport type FoldersLeafItem = Exclude<FoldersItem, { readonly kind: \"folder\" }>;\n\n/** What one item is called after the move, and what it was called before. */\nexport interface FoldersMoveEntry {\n readonly item: FoldersItem;\n readonly currentName: string;\n /** The name the item carries once the plan is applied. */\n readonly name: string;\n /** True when the destination already held that name and the item is being renamed. */\n readonly renamed: boolean;\n /** Folder the item is coming from; absent when it is at the top level. */\n readonly sourceFolder?: FolderId;\n}\n\n/**\n * Every item of a move and its resulting name.\n *\n * A plan is computed for the preview and recomputed inside the write, and the write commits only\n * when the two are identical, so a plan confirmed against state that has since changed is refused\n * rather than applied. Entries are in a canonical order for exactly that comparison.\n */\nexport interface FoldersMovePlan {\n /** Folder everything lands in; absent for the top level. */\n readonly destination?: FolderId;\n readonly entries: readonly FoldersMoveEntry[];\n}\n\n/** One reason a move cannot be planned. */\nexport type FoldersMoveIssue =\n | { readonly kind: \"unknown-destination\"; readonly folder: FolderId }\n | { readonly kind: \"unknown-item\"; readonly item: FoldersItem }\n | {\n readonly kind: \"into-own-descendant\";\n readonly folder: FolderId;\n readonly destination: FolderId;\n };\n\n/** A plan, or everything standing in the way of one. */\nexport type FoldersMovePlanResult =\n | { readonly ok: true; readonly plan: FoldersMovePlan }\n | { readonly ok: false; readonly issues: readonly FoldersMoveIssue[] };\n\n/**\n * Plan a move of any mix of folders, projects and templates into one destination.\n *\n * The only function that decides what a moved item ends up called. The preview and the write both\n * call it, over the same view, so the two cannot drift apart.\n *\n * A folder moves with everything inside it. When the selection holds a folder together with\n * something inside it, that item travels with the folder and is not planned on its own: moving it\n * separately as well would pull it out of the subtree it belongs to.\n */\nexport function planFoldersMove(\n view: FoldersView,\n items: readonly FoldersItem[],\n destination?: FolderId,\n): FoldersMovePlanResult {\n const issues: FoldersMoveIssue[] = [];\n\n const destinationKnown =\n destination === undefined || view.folders.some((folder) => folder.id === destination);\n if (destination !== undefined && !destinationKnown)\n issues.push({ kind: \"unknown-destination\", folder: destination });\n\n const located: Located[] = [];\n const seen = new Set<string>();\n for (const item of items) {\n const key = `${item.kind}:${item.id}`;\n if (seen.has(key)) continue;\n seen.add(key);\n\n const known = locate(view, item);\n if (known === undefined) {\n issues.push({ kind: \"unknown-item\", item });\n continue;\n }\n located.push({ item, ...known });\n }\n\n const carried = new Set<FolderId>(\n located.flatMap(({ item }) => (item.kind === \"folder\" ? foldersSubtree(view, item.id) : [])),\n );\n const moved = located.filter(\n ({ sourceFolder }) => sourceFolder === undefined || !carried.has(sourceFolder),\n );\n\n if (destination !== undefined && destinationKnown)\n for (const { item } of moved) {\n if (item.kind !== \"folder\") continue;\n if (foldersSubtree(view, item.id).includes(destination))\n issues.push({ kind: \"into-own-descendant\", folder: item.id, destination });\n }\n\n if (issues.length > 0) return { ok: false, issues };\n\n // Each kind is named against its own kind only: a moved folder never becomes \"X (Copy)\" for a\n // project called X in the destination.\n const movedIds = moved.map(({ item }) => item.id);\n const taken: Record<FoldersItem[\"kind\"], string[]> = {\n folder: foldersSiblingNames(view, destination, movedIds, { kind: \"folder\" }),\n project: foldersSiblingNames(view, destination, movedIds, { kind: \"project\" }),\n template: foldersSiblingNames(view, destination, movedIds, { kind: \"template\" }),\n };\n\n const entries: FoldersMoveEntry[] = [];\n for (const { item, name, sourceFolder } of moved.sort(byCanonicalOrder)) {\n const resulting = foldersUniqueName(name, taken[item.kind]);\n taken[item.kind].push(resulting);\n entries.push({\n item,\n currentName: name,\n name: resulting,\n renamed: resulting !== name,\n ...(sourceFolder === undefined ? {} : { sourceFolder }),\n });\n }\n\n return {\n ok: true,\n plan: { ...(destination === undefined ? {} : { destination }), entries },\n };\n}\n\n/** True when two plans say exactly the same thing. */\nexport function foldersMovePlansEqual(a: FoldersMovePlan, b: FoldersMovePlan): boolean {\n if (a.destination !== b.destination) return false;\n if (a.entries.length !== b.entries.length) return false;\n return a.entries.every((entry, index) => {\n const other = b.entries[index];\n if (other === undefined) return false;\n return (\n entry.item.kind === other.item.kind &&\n entry.item.id === other.item.id &&\n entry.currentName === other.currentName &&\n entry.name === other.name &&\n entry.renamed === other.renamed &&\n entry.sourceFolder === other.sourceFolder\n );\n });\n}\n\n/**\n * A project or a template the move gives a new name. Their names live in their own metadata, not\n * in the folder document, so the write path has to carry these out separately; a folder's name is\n * in the document and is renamed there.\n */\nexport interface FoldersLabelRename {\n readonly item: FoldersLeafItem;\n readonly name: string;\n}\n\n/** What applying a plan changes. */\nexport interface FoldersMoveApplication {\n /** The document to persist. */\n readonly document: FoldersDocument;\n /** Projects and templates whose label the move changes. */\n readonly labelRenames: readonly FoldersLabelRename[];\n}\n\n/**\n * The document a plan produces, plus the project and template label renames it implies.\n *\n * Applying a plan is arithmetic on an already validated plan; whether that plan may be committed\n * is the write path's decision.\n */\nexport function applyFoldersMove(\n view: FoldersView,\n movePlan: FoldersMovePlan,\n): FoldersMoveApplication {\n const folderParents = new Map<FolderId, FolderId | undefined>();\n const folderNames = new Map<FolderId, string>();\n const projectFolders = new Map<ProjectId, FolderId | undefined>();\n const templateFolders = new Map<TemplateId, FolderId | undefined>();\n const labelRenames: FoldersLabelRename[] = [];\n\n for (const entry of movePlan.entries) {\n switch (entry.item.kind) {\n case \"folder\":\n folderParents.set(entry.item.id, movePlan.destination);\n folderNames.set(entry.item.id, entry.name);\n break;\n case \"project\":\n projectFolders.set(entry.item.id, movePlan.destination);\n if (entry.renamed) labelRenames.push({ item: entry.item, name: entry.name });\n break;\n case \"template\":\n templateFolders.set(entry.item.id, movePlan.destination);\n if (entry.renamed) labelRenames.push({ item: entry.item, name: entry.name });\n break;\n }\n }\n\n const folders = view.folders.map((folder) => ({\n ...folder,\n parent: folderParents.has(folder.id) ? folderParents.get(folder.id) : folder.parent,\n name: folderNames.get(folder.id) ?? folder.name,\n }));\n\n const projects = view.projects.map((project) => ({\n ...project,\n folder: projectFolders.has(project.id) ? projectFolders.get(project.id) : project.folder,\n }));\n\n const templates = view.templates.map((template) => ({\n ...template,\n folder: templateFolders.has(template.id) ? templateFolders.get(template.id) : template.folder,\n }));\n\n const document = foldersDocumentFromView({ ...view, folders, projects, templates });\n return { document, labelRenames };\n}\n\n//\n// Internals\n//\n\n/** An item of the selection, with what the view says about it. */\ninterface Located {\n readonly item: FoldersItem;\n readonly name: string;\n /** Folder holding the item; absent when it is at the top level. */\n readonly sourceFolder?: FolderId;\n}\n\n/** The name and containing folder of an item the view holds, whichever kind it is. */\nfunction locate(\n view: FoldersView,\n item: FoldersItem,\n): { readonly name: string; readonly sourceFolder?: FolderId } | undefined {\n switch (item.kind) {\n case \"folder\": {\n const folder = view.folders.find((candidate) => candidate.id === item.id);\n return folder === undefined ? undefined : { name: folder.name, sourceFolder: folder.parent };\n }\n case \"project\": {\n const project = view.projects.find((candidate) => candidate.id === item.id);\n return project === undefined\n ? undefined\n : { name: project.name, sourceFolder: project.folder };\n }\n case \"template\": {\n const template = view.templates.find((candidate) => candidate.id === item.id);\n return template === undefined\n ? undefined\n : { name: template.name, sourceFolder: template.folder };\n }\n }\n}\n\n/**\n * Folders, then projects, then templates; within a kind by name, then by id. The order of the\n * items a caller hands in must not change the plan, or a preview and its write could differ over\n * nothing.\n */\nfunction byCanonicalOrder(a: Located, b: Located): number {\n if (a.item.kind !== b.item.kind) return KIND_ORDER[a.item.kind] - KIND_ORDER[b.item.kind];\n const byName = a.name.toLowerCase().localeCompare(b.name.toLowerCase());\n if (byName !== 0) return byName;\n return String(a.item.id).localeCompare(String(b.item.id));\n}\n\nconst KIND_ORDER: Readonly<Record<FoldersItem[\"kind\"], number>> = {\n folder: 0,\n project: 1,\n template: 2,\n};\n"],"mappings":";;;;;;;;;;;;;AAiEA,SAAgB,gBACd,MACA,OACA,aACuB;CACvB,MAAM,SAA6B,CAAC;CAEpC,MAAM,mBACJ,gBAAgB,KAAA,KAAa,KAAK,QAAQ,MAAM,WAAW,OAAO,OAAO,WAAW;CACtF,IAAI,gBAAgB,KAAA,KAAa,CAAC,kBAChC,OAAO,KAAK;EAAE,MAAM;EAAuB,QAAQ;CAAY,CAAC;CAElE,MAAM,UAAqB,CAAC;CAC5B,MAAM,uBAAO,IAAI,IAAY;CAC7B,KAAK,MAAM,QAAQ,OAAO;EACxB,MAAM,MAAM,GAAG,KAAK,KAAK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,MAAM,WAAW,KAAK,UAAU,MAAM,cAAc,UAAU,OAAO,KAAK,EAAE;GAC5E,OAAO,aAAa,KAAA,IAChB,KAAA,IACA;IAAE,MAAM,SAAS;IAAM,cAAc,SAAS;GAAO;EAC3D;CACF;AACF;;;;;;AAOA,SAAS,iBAAiB,GAAY,GAAoB;CACxD,IAAI,EAAE,KAAK,SAAS,EAAE,KAAK,MAAM,OAAO,WAAW,EAAE,KAAK,QAAQ,WAAW,EAAE,KAAK;CACpF,MAAM,SAAS,EAAE,KAAK,YAAY,CAAC,CAAC,cAAc,EAAE,KAAK,YAAY,CAAC;CACtE,IAAI,WAAW,GAAG,OAAO;CACzB,OAAO,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,cAAc,OAAO,EAAE,KAAK,EAAE,CAAC;AAC1D;AAEA,MAAM,aAA4D;CAChE,QAAQ;CACR,SAAS;CACT,UAAU;AACZ"}
1
+ {"version":3,"file":"planner.cjs","names":["foldersSubtree","foldersSiblingNames","foldersUniqueName","foldersDocumentFromView"],"sources":["../../src/folders/planner.ts"],"sourcesContent":["import type { ProjectId, TemplateId } from \"@milaboratories/pl-model-common\";\nimport type { FoldersDocument, FolderId } from \"./document\";\nimport { foldersUniqueName } from \"./naming\";\nimport type { FoldersView } from \"./view\";\nimport { foldersDocumentFromView, foldersSiblingNames, foldersSubtree } from \"./view\";\n\n/** A folder, a project or a stored template, as something a move acts on. */\nexport type FoldersItem =\n | { readonly kind: \"folder\"; readonly id: FolderId }\n | { readonly kind: \"project\"; readonly id: ProjectId }\n | { readonly kind: \"template\"; readonly id: TemplateId };\n\n/** A tree item that is not a folder: a project or a stored template. */\nexport type FoldersLeafItem = Exclude<FoldersItem, { readonly kind: \"folder\" }>;\n\n/** What one item is called after the move, and what it was called before. */\nexport interface FoldersMoveEntry {\n readonly item: FoldersItem;\n readonly currentName: string;\n /** The name the item carries once the plan is applied. */\n readonly name: string;\n /** True when the destination already held that name and the item is being renamed. */\n readonly renamed: boolean;\n /** Folder the item is coming from; absent when it is at the top level. */\n readonly sourceFolder?: FolderId;\n}\n\n/**\n * Every item of a move and its resulting name.\n *\n * A plan is computed for the preview and recomputed inside the write, and the write commits only\n * when the two are identical, so a plan confirmed against state that has since changed is refused\n * rather than applied. Entries are in a canonical order for exactly that comparison.\n */\nexport interface FoldersMovePlan {\n /** Folder everything lands in; absent for the top level. */\n readonly destination?: FolderId;\n readonly entries: readonly FoldersMoveEntry[];\n}\n\n/** One reason a move cannot be planned. */\nexport type FoldersMoveIssue =\n | { readonly kind: \"unknown-destination\"; readonly folder: FolderId }\n | { readonly kind: \"unknown-item\"; readonly item: FoldersItem }\n | {\n readonly kind: \"into-own-descendant\";\n readonly folder: FolderId;\n readonly destination: FolderId;\n };\n\n/** A plan, or everything standing in the way of one. */\nexport type FoldersMovePlanResult =\n | { readonly ok: true; readonly plan: FoldersMovePlan }\n | { readonly ok: false; readonly issues: readonly FoldersMoveIssue[] };\n\n/**\n * Plan a move of any mix of folders, projects and templates into one destination.\n *\n * The only function that decides what a moved item ends up called. The preview and the write both\n * call it, over the same view, so the two cannot drift apart.\n *\n * A folder moves with everything inside it. When the selection holds a folder together with\n * something inside it, that item travels with the folder and is not planned on its own: moving it\n * separately as well would pull it out of the subtree it belongs to.\n */\nexport function planFoldersMove(\n view: FoldersView,\n items: readonly FoldersItem[],\n destination?: FolderId,\n): FoldersMovePlanResult {\n const issues: FoldersMoveIssue[] = [];\n\n const destinationKnown =\n destination === undefined || view.folders.some((folder) => folder.id === destination);\n if (destination !== undefined && !destinationKnown)\n issues.push({ kind: \"unknown-destination\", folder: destination });\n\n const located: Located[] = [];\n const seen = new Set<string>();\n for (const item of items) {\n const key = `${item.kind}:${item.id}`;\n if (seen.has(key)) continue;\n seen.add(key);\n\n const known = locate(view, item);\n if (known === undefined) {\n issues.push({ kind: \"unknown-item\", item });\n continue;\n }\n located.push({ item, ...known });\n }\n\n const carried = new Set<FolderId>(\n located.flatMap(({ item }) => (item.kind === \"folder\" ? foldersSubtree(view, item.id) : [])),\n );\n const moved = located.filter(\n ({ sourceFolder }) => sourceFolder === undefined || !carried.has(sourceFolder),\n );\n\n if (destination !== undefined && destinationKnown)\n for (const { item } of moved) {\n if (item.kind !== \"folder\") continue;\n if (foldersSubtree(view, item.id).includes(destination))\n issues.push({ kind: \"into-own-descendant\", folder: item.id, destination });\n }\n\n if (issues.length > 0) return { ok: false, issues };\n\n // Each kind is named against its own kind only: a moved folder never becomes \"X (Copy)\" for a\n // project called X in the destination.\n const movedIds = moved.map(({ item }) => item.id);\n const taken: Record<FoldersItem[\"kind\"], string[]> = {\n folder: foldersSiblingNames(view, destination, movedIds, { kind: \"folder\" }),\n project: foldersSiblingNames(view, destination, movedIds, { kind: \"project\" }),\n template: foldersSiblingNames(view, destination, movedIds, { kind: \"template\" }),\n };\n\n const entries: FoldersMoveEntry[] = [];\n for (const { item, name, sourceFolder } of moved.sort(byCanonicalOrder)) {\n const resulting = foldersUniqueName(name, taken[item.kind]);\n taken[item.kind].push(resulting);\n entries.push({\n item,\n currentName: name,\n name: resulting,\n renamed: resulting !== name,\n ...(sourceFolder === undefined ? {} : { sourceFolder }),\n });\n }\n\n return {\n ok: true,\n plan: { ...(destination === undefined ? {} : { destination }), entries },\n };\n}\n\n/** True when two plans say exactly the same thing. */\nexport function foldersMovePlansEqual(a: FoldersMovePlan, b: FoldersMovePlan): boolean {\n if (a.destination !== b.destination) return false;\n if (a.entries.length !== b.entries.length) return false;\n return a.entries.every((entry, index) => {\n const other = b.entries[index];\n if (other === undefined) return false;\n return (\n entry.item.kind === other.item.kind &&\n entry.item.id === other.item.id &&\n entry.currentName === other.currentName &&\n entry.name === other.name &&\n entry.renamed === other.renamed &&\n entry.sourceFolder === other.sourceFolder\n );\n });\n}\n\n/**\n * A project or a template the move gives a new name. Their names live in their own metadata, not\n * in the folder document, so the write path has to carry these out separately; a folder's name is\n * in the document and is renamed there.\n */\nexport interface FoldersLabelRename {\n readonly item: FoldersLeafItem;\n readonly name: string;\n}\n\n/** What applying a plan changes. */\nexport interface FoldersMoveApplication {\n /** The document to persist. */\n readonly document: FoldersDocument;\n /** Projects and templates whose label the move changes. */\n readonly labelRenames: readonly FoldersLabelRename[];\n}\n\n/**\n * The document a plan produces, plus the project and template label renames it implies.\n *\n * Applying a plan is arithmetic on an already validated plan; whether that plan may be committed\n * is the write path's decision.\n */\nexport function applyFoldersMove(\n view: FoldersView,\n movePlan: FoldersMovePlan,\n): FoldersMoveApplication {\n const folderParents = new Map<FolderId, FolderId | undefined>();\n const folderNames = new Map<FolderId, string>();\n const projectFolders = new Map<ProjectId, FolderId | undefined>();\n const templateFolders = new Map<TemplateId, FolderId | undefined>();\n const labelRenames: FoldersLabelRename[] = [];\n\n for (const entry of movePlan.entries) {\n switch (entry.item.kind) {\n case \"folder\":\n folderParents.set(entry.item.id, movePlan.destination);\n folderNames.set(entry.item.id, entry.name);\n break;\n case \"project\":\n projectFolders.set(entry.item.id, movePlan.destination);\n if (entry.renamed) labelRenames.push({ item: entry.item, name: entry.name });\n break;\n case \"template\":\n templateFolders.set(entry.item.id, movePlan.destination);\n if (entry.renamed) labelRenames.push({ item: entry.item, name: entry.name });\n break;\n }\n }\n\n const folders = view.folders.map((folder) => ({\n ...folder,\n parent: folderParents.has(folder.id) ? folderParents.get(folder.id) : folder.parent,\n name: folderNames.get(folder.id) ?? folder.name,\n }));\n\n const projects = view.projects.map((project) => ({\n ...project,\n folder: projectFolders.has(project.id) ? projectFolders.get(project.id) : project.folder,\n }));\n\n const templates = view.templates.map((template) => ({\n ...template,\n folder: templateFolders.has(template.id) ? templateFolders.get(template.id) : template.folder,\n }));\n\n const document = foldersDocumentFromView({ ...view, folders, projects, templates });\n return { document, labelRenames };\n}\n\n//\n// Internals\n//\n\n/** An item of the selection, with what the view says about it. */\ninterface Located {\n readonly item: FoldersItem;\n readonly name: string;\n /** Folder holding the item; absent when it is at the top level. */\n readonly sourceFolder?: FolderId;\n}\n\n/** The name and containing folder of an item the view holds, whichever kind it is. */\nfunction locate(\n view: FoldersView,\n item: FoldersItem,\n): { readonly name: string; readonly sourceFolder?: FolderId } | undefined {\n switch (item.kind) {\n case \"folder\": {\n const folder = view.folders.find((candidate) => candidate.id === item.id);\n return folder === undefined ? undefined : { name: folder.name, sourceFolder: folder.parent };\n }\n case \"project\": {\n const project = view.projects.find((candidate) => candidate.id === item.id);\n return project === undefined\n ? undefined\n : { name: project.name, sourceFolder: project.folder };\n }\n case \"template\": {\n const template = view.templates.find((candidate) => candidate.id === item.id);\n return template === undefined\n ? undefined\n : { name: template.name, sourceFolder: template.folder };\n }\n }\n}\n\n/**\n * Folders, then projects, then templates; within a kind by name, then by id. The order of the\n * items a caller hands in must not change the plan, or a preview and its write could differ over\n * nothing.\n */\nfunction byCanonicalOrder(a: Located, b: Located): number {\n if (a.item.kind !== b.item.kind) return KIND_ORDER[a.item.kind] - KIND_ORDER[b.item.kind];\n const byName = a.name.toLowerCase().localeCompare(b.name.toLowerCase());\n if (byName !== 0) return byName;\n return String(a.item.id).localeCompare(String(b.item.id));\n}\n\nconst KIND_ORDER: Readonly<Record<FoldersItem[\"kind\"], number>> = {\n folder: 0,\n project: 1,\n template: 2,\n};\n"],"mappings":";;;;;;;;;;;;;AAiEA,SAAgB,gBACd,MACA,OACA,aACuB;CACvB,MAAM,SAA6B,CAAC;CAEpC,MAAM,mBACJ,gBAAgB,KAAA,KAAa,KAAK,QAAQ,MAAM,WAAW,OAAO,OAAO,WAAW;CACtF,IAAI,gBAAgB,KAAA,KAAa,CAAC,kBAChC,OAAO,KAAK;EAAE,MAAM;EAAuB,QAAQ;CAAY,CAAC;CAElE,MAAM,UAAqB,CAAC;CAC5B,MAAM,uBAAO,IAAI,IAAY;CAC7B,KAAK,MAAM,QAAQ,OAAO;EACxB,MAAM,MAAM,GAAG,KAAK,KAAK,GAAG,KAAK;EACjC,IAAI,KAAK,IAAI,GAAG,GAAG;EACnB,KAAK,IAAI,GAAG;EAEZ,MAAM,QAAQ,OAAO,MAAM,IAAI;EAC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IAAM,cAAc,SAAS;GAAO;EAC3D;CACF;AACF;;;;;;AAOA,SAAS,iBAAiB,GAAY,GAAoB;CACxD,IAAI,EAAE,KAAK,SAAS,EAAE,KAAK,MAAM,OAAO,WAAW,EAAE,KAAK,QAAQ,WAAW,EAAE,KAAK;CACpF,MAAM,SAAS,EAAE,KAAK,YAAY,CAAC,CAAC,cAAc,EAAE,KAAK,YAAY,CAAC;CACtE,IAAI,WAAW,GAAG,OAAO;CACzB,OAAO,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,cAAc,OAAO,EAAE,KAAK,EAAE,CAAC;AAC1D;AAEA,MAAM,aAA4D;CAChE,QAAQ;CACR,SAAS;CACT,UAAU;AACZ"}
@@ -1,7 +1,6 @@
1
1
  import { FolderId, FoldersDocument } from "./document.js";
2
2
  import { FoldersView } from "./view.js";
3
3
  import { ProjectId, TemplateId } from "@milaboratories/pl-model-common";
4
- //#region src/folders/planner.d.ts
5
4
  /** A folder, a project or a stored template, as something a move acts on. */
6
5
  export type FoldersItem = {
7
6
  readonly kind: "folder";
@@ -96,5 +95,4 @@ export interface FoldersMoveApplication {
96
95
  * is the write path's decision.
97
96
  */
98
97
  export declare function applyFoldersMove(view: FoldersView, movePlan: FoldersMovePlan): FoldersMoveApplication;
99
- //#endregion
100
98
  //# sourceMappingURL=planner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"planner.d.ts","names":[],"sources":["../../src/folders/planner.ts"],"mappings":";;;;;YAOY;WACG;WAAyB,IAAI;;WAC7B;WAA0B,IAAI;;WAC9B;WAA2B,IAAI;;;YAGlC,kBAAkB,QAAQ;WAAwB;;;iBAG7C;WACN,MAAM;WACN;;WAEA;;WAEA;;WAEA,eAAe;;;;;;;;;iBAUT;;WAEN,cAAc;WACd,kBAAkB;;;YAIjB;WACG;WAAsC,QAAQ;;WAC9C;WAA+B,MAAM;;WAErC;WACA,QAAQ;WACR,aAAa;;;YAIhB;WACG;WAAmB,MAAM;;WACzB;WAAoB,iBAAiB;;;;;;;;;;;;wBAYpC,gBACd,MAAM,aACN,gBAAgB,eAChB,cAAc,WACb;;wBAoEa,sBAAsB,GAAG,iBAAiB,GAAG;;;;;;iBAsB5C;WACN,MAAM;WACN;;;iBAIM;;WAEN,UAAU;;WAEV,uBAAuB;;;;;;;;wBASlB,iBACd,MAAM,aACN,UAAU,kBACT"}
1
+ {"version":3,"file":"planner.d.ts","names":[],"sources":["../../src/folders/planner.ts"],"mappings":";;;;YAOY;WACG;WAAyB,IAAI;;WAC7B;WAA0B,IAAI;;WAC9B;WAA2B,IAAI;;;YAGlC,kBAAkB,QAAQ;WAAwB;;;iBAG7C;WACN,MAAM;WACN;;WAEA;;WAEA;;WAEA,eAAe;;;;;;;;;iBAUT;;WAEN,cAAc;WACd,kBAAkB;;;YAIjB;WACG;WAAsC,QAAQ;;WAC9C;WAA+B,MAAM;;WAErC;WACA,QAAQ;WACR,aAAa;;;YAIhB;WACG;WAAmB,MAAM;;WACzB;WAAoB,iBAAiB;;;;;;;;;;;;wBAYpC,gBACd,MAAM,aACN,gBAAgB,eAChB,cAAc,WACb;;wBAoEa,sBAAsB,GAAG,iBAAiB,GAAG;;;;;;iBAsB5C;WACN,MAAM;WACN;;;iBAIM;;WAEN,UAAU;;WAEV,uBAAuB;;;;;;;;wBASlB,iBACd,MAAM,aACN,UAAU,kBACT"}
@@ -1,6 +1,6 @@
1
1
  import { foldersDocumentFromView, foldersSiblingNames, foldersSubtree } from "./view.js";
2
2
  import { foldersUniqueName } from "./naming.js";
3
- //#region src/folders/planner.ts
3
+ // src/folders/planner.ts
4
4
  /**
5
5
  * Plan a move of any mix of folders, projects and templates into one destination.
6
6
  *
@@ -117,7 +117,6 @@ function applyFoldersMove(view, movePlan) {
117
117
  item: entry.item,
118
118
  name: entry.name
119
119
  });
120
- break;
121
120
  }
122
121
  const folders = view.folders.map((folder) => ({
123
122
  ...folder,
@@ -184,7 +183,6 @@ const KIND_ORDER = {
184
183
  project: 1,
185
184
  template: 2
186
185
  };
187
- //#endregion
188
186
  export { applyFoldersMove, foldersMovePlansEqual, planFoldersMove };
189
187
 
190
188
  //# sourceMappingURL=planner.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"planner.js","names":[],"sources":["../../src/folders/planner.ts"],"sourcesContent":["import type { ProjectId, TemplateId } from \"@milaboratories/pl-model-common\";\nimport type { FoldersDocument, FolderId } from \"./document\";\nimport { foldersUniqueName } from \"./naming\";\nimport type { FoldersView } from \"./view\";\nimport { foldersDocumentFromView, foldersSiblingNames, foldersSubtree } from \"./view\";\n\n/** A folder, a project or a stored template, as something a move acts on. */\nexport type FoldersItem =\n | { readonly kind: \"folder\"; readonly id: FolderId }\n | { readonly kind: \"project\"; readonly id: ProjectId }\n | { readonly kind: \"template\"; readonly id: TemplateId };\n\n/** A tree item that is not a folder: a project or a stored template. */\nexport type FoldersLeafItem = Exclude<FoldersItem, { readonly kind: \"folder\" }>;\n\n/** What one item is called after the move, and what it was called before. */\nexport interface FoldersMoveEntry {\n readonly item: FoldersItem;\n readonly currentName: string;\n /** The name the item carries once the plan is applied. */\n readonly name: string;\n /** True when the destination already held that name and the item is being renamed. */\n readonly renamed: boolean;\n /** Folder the item is coming from; absent when it is at the top level. */\n readonly sourceFolder?: FolderId;\n}\n\n/**\n * Every item of a move and its resulting name.\n *\n * A plan is computed for the preview and recomputed inside the write, and the write commits only\n * when the two are identical, so a plan confirmed against state that has since changed is refused\n * rather than applied. Entries are in a canonical order for exactly that comparison.\n */\nexport interface FoldersMovePlan {\n /** Folder everything lands in; absent for the top level. */\n readonly destination?: FolderId;\n readonly entries: readonly FoldersMoveEntry[];\n}\n\n/** One reason a move cannot be planned. */\nexport type FoldersMoveIssue =\n | { readonly kind: \"unknown-destination\"; readonly folder: FolderId }\n | { readonly kind: \"unknown-item\"; readonly item: FoldersItem }\n | {\n readonly kind: \"into-own-descendant\";\n readonly folder: FolderId;\n readonly destination: FolderId;\n };\n\n/** A plan, or everything standing in the way of one. */\nexport type FoldersMovePlanResult =\n | { readonly ok: true; readonly plan: FoldersMovePlan }\n | { readonly ok: false; readonly issues: readonly FoldersMoveIssue[] };\n\n/**\n * Plan a move of any mix of folders, projects and templates into one destination.\n *\n * The only function that decides what a moved item ends up called. The preview and the write both\n * call it, over the same view, so the two cannot drift apart.\n *\n * A folder moves with everything inside it. When the selection holds a folder together with\n * something inside it, that item travels with the folder and is not planned on its own: moving it\n * separately as well would pull it out of the subtree it belongs to.\n */\nexport function planFoldersMove(\n view: FoldersView,\n items: readonly FoldersItem[],\n destination?: FolderId,\n): FoldersMovePlanResult {\n const issues: FoldersMoveIssue[] = [];\n\n const destinationKnown =\n destination === undefined || view.folders.some((folder) => folder.id === destination);\n if (destination !== undefined && !destinationKnown)\n issues.push({ kind: \"unknown-destination\", folder: destination });\n\n const located: Located[] = [];\n const seen = new Set<string>();\n for (const item of items) {\n const key = `${item.kind}:${item.id}`;\n if (seen.has(key)) continue;\n seen.add(key);\n\n const known = locate(view, item);\n if (known === undefined) {\n issues.push({ kind: \"unknown-item\", item });\n continue;\n }\n located.push({ item, ...known });\n }\n\n const carried = new Set<FolderId>(\n located.flatMap(({ item }) => (item.kind === \"folder\" ? foldersSubtree(view, item.id) : [])),\n );\n const moved = located.filter(\n ({ sourceFolder }) => sourceFolder === undefined || !carried.has(sourceFolder),\n );\n\n if (destination !== undefined && destinationKnown)\n for (const { item } of moved) {\n if (item.kind !== \"folder\") continue;\n if (foldersSubtree(view, item.id).includes(destination))\n issues.push({ kind: \"into-own-descendant\", folder: item.id, destination });\n }\n\n if (issues.length > 0) return { ok: false, issues };\n\n // Each kind is named against its own kind only: a moved folder never becomes \"X (Copy)\" for a\n // project called X in the destination.\n const movedIds = moved.map(({ item }) => item.id);\n const taken: Record<FoldersItem[\"kind\"], string[]> = {\n folder: foldersSiblingNames(view, destination, movedIds, { kind: \"folder\" }),\n project: foldersSiblingNames(view, destination, movedIds, { kind: \"project\" }),\n template: foldersSiblingNames(view, destination, movedIds, { kind: \"template\" }),\n };\n\n const entries: FoldersMoveEntry[] = [];\n for (const { item, name, sourceFolder } of moved.sort(byCanonicalOrder)) {\n const resulting = foldersUniqueName(name, taken[item.kind]);\n taken[item.kind].push(resulting);\n entries.push({\n item,\n currentName: name,\n name: resulting,\n renamed: resulting !== name,\n ...(sourceFolder === undefined ? {} : { sourceFolder }),\n });\n }\n\n return {\n ok: true,\n plan: { ...(destination === undefined ? {} : { destination }), entries },\n };\n}\n\n/** True when two plans say exactly the same thing. */\nexport function foldersMovePlansEqual(a: FoldersMovePlan, b: FoldersMovePlan): boolean {\n if (a.destination !== b.destination) return false;\n if (a.entries.length !== b.entries.length) return false;\n return a.entries.every((entry, index) => {\n const other = b.entries[index];\n if (other === undefined) return false;\n return (\n entry.item.kind === other.item.kind &&\n entry.item.id === other.item.id &&\n entry.currentName === other.currentName &&\n entry.name === other.name &&\n entry.renamed === other.renamed &&\n entry.sourceFolder === other.sourceFolder\n );\n });\n}\n\n/**\n * A project or a template the move gives a new name. Their names live in their own metadata, not\n * in the folder document, so the write path has to carry these out separately; a folder's name is\n * in the document and is renamed there.\n */\nexport interface FoldersLabelRename {\n readonly item: FoldersLeafItem;\n readonly name: string;\n}\n\n/** What applying a plan changes. */\nexport interface FoldersMoveApplication {\n /** The document to persist. */\n readonly document: FoldersDocument;\n /** Projects and templates whose label the move changes. */\n readonly labelRenames: readonly FoldersLabelRename[];\n}\n\n/**\n * The document a plan produces, plus the project and template label renames it implies.\n *\n * Applying a plan is arithmetic on an already validated plan; whether that plan may be committed\n * is the write path's decision.\n */\nexport function applyFoldersMove(\n view: FoldersView,\n movePlan: FoldersMovePlan,\n): FoldersMoveApplication {\n const folderParents = new Map<FolderId, FolderId | undefined>();\n const folderNames = new Map<FolderId, string>();\n const projectFolders = new Map<ProjectId, FolderId | undefined>();\n const templateFolders = new Map<TemplateId, FolderId | undefined>();\n const labelRenames: FoldersLabelRename[] = [];\n\n for (const entry of movePlan.entries) {\n switch (entry.item.kind) {\n case \"folder\":\n folderParents.set(entry.item.id, movePlan.destination);\n folderNames.set(entry.item.id, entry.name);\n break;\n case \"project\":\n projectFolders.set(entry.item.id, movePlan.destination);\n if (entry.renamed) labelRenames.push({ item: entry.item, name: entry.name });\n break;\n case \"template\":\n templateFolders.set(entry.item.id, movePlan.destination);\n if (entry.renamed) labelRenames.push({ item: entry.item, name: entry.name });\n break;\n }\n }\n\n const folders = view.folders.map((folder) => ({\n ...folder,\n parent: folderParents.has(folder.id) ? folderParents.get(folder.id) : folder.parent,\n name: folderNames.get(folder.id) ?? folder.name,\n }));\n\n const projects = view.projects.map((project) => ({\n ...project,\n folder: projectFolders.has(project.id) ? projectFolders.get(project.id) : project.folder,\n }));\n\n const templates = view.templates.map((template) => ({\n ...template,\n folder: templateFolders.has(template.id) ? templateFolders.get(template.id) : template.folder,\n }));\n\n const document = foldersDocumentFromView({ ...view, folders, projects, templates });\n return { document, labelRenames };\n}\n\n//\n// Internals\n//\n\n/** An item of the selection, with what the view says about it. */\ninterface Located {\n readonly item: FoldersItem;\n readonly name: string;\n /** Folder holding the item; absent when it is at the top level. */\n readonly sourceFolder?: FolderId;\n}\n\n/** The name and containing folder of an item the view holds, whichever kind it is. */\nfunction locate(\n view: FoldersView,\n item: FoldersItem,\n): { readonly name: string; readonly sourceFolder?: FolderId } | undefined {\n switch (item.kind) {\n case \"folder\": {\n const folder = view.folders.find((candidate) => candidate.id === item.id);\n return folder === undefined ? undefined : { name: folder.name, sourceFolder: folder.parent };\n }\n case \"project\": {\n const project = view.projects.find((candidate) => candidate.id === item.id);\n return project === undefined\n ? undefined\n : { name: project.name, sourceFolder: project.folder };\n }\n case \"template\": {\n const template = view.templates.find((candidate) => candidate.id === item.id);\n return template === undefined\n ? undefined\n : { name: template.name, sourceFolder: template.folder };\n }\n }\n}\n\n/**\n * Folders, then projects, then templates; within a kind by name, then by id. The order of the\n * items a caller hands in must not change the plan, or a preview and its write could differ over\n * nothing.\n */\nfunction byCanonicalOrder(a: Located, b: Located): number {\n if (a.item.kind !== b.item.kind) return KIND_ORDER[a.item.kind] - KIND_ORDER[b.item.kind];\n const byName = a.name.toLowerCase().localeCompare(b.name.toLowerCase());\n if (byName !== 0) return byName;\n return String(a.item.id).localeCompare(String(b.item.id));\n}\n\nconst KIND_ORDER: Readonly<Record<FoldersItem[\"kind\"], number>> = {\n folder: 0,\n project: 1,\n template: 2,\n};\n"],"mappings":";;;;;;;;;;;;;AAiEA,SAAgB,gBACd,MACA,OACA,aACuB;CACvB,MAAM,SAA6B,CAAC;CAEpC,MAAM,mBACJ,gBAAgB,KAAA,KAAa,KAAK,QAAQ,MAAM,WAAW,OAAO,OAAO,WAAW;CACtF,IAAI,gBAAgB,KAAA,KAAa,CAAC,kBAChC,OAAO,KAAK;EAAE,MAAM;EAAuB,QAAQ;CAAY,CAAC;CAElE,MAAM,UAAqB,CAAC;CAC5B,MAAM,uBAAO,IAAI,IAAY;CAC7B,KAAK,MAAM,QAAQ,OAAO;EACxB,MAAM,MAAM,GAAG,KAAK,KAAK,GAAG,KAAK;EACjC,IAAI,KAAK,IAAI,GAAG,GAAG;EACnB,KAAK,IAAI,GAAG;EAEZ,MAAM,QAAQ,OAAO,MAAM,IAAI;EAC/B,IAAI,UAAU,KAAA,GAAW;GACvB,OAAO,KAAK;IAAE,MAAM;IAAgB;GAAK,CAAC;GAC1C;EACF;EACA,QAAQ,KAAK;GAAE;GAAM,GAAG;EAAM,CAAC;CACjC;CAEA,MAAM,UAAU,IAAI,IAClB,QAAQ,SAAS,EAAE,WAAY,KAAK,SAAS,WAAW,eAAe,MAAM,KAAK,EAAE,IAAI,CAAC,CAAE,CAC7F;CACA,MAAM,QAAQ,QAAQ,QACnB,EAAE,mBAAmB,iBAAiB,KAAA,KAAa,CAAC,QAAQ,IAAI,YAAY,CAC/E;CAEA,IAAI,gBAAgB,KAAA,KAAa,kBAC/B,KAAK,MAAM,EAAE,UAAU,OAAO;EAC5B,IAAI,KAAK,SAAS,UAAU;EAC5B,IAAI,eAAe,MAAM,KAAK,EAAE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,IAAI,SAAS,EAAE,IAAI,SAAS;CACzF,EAAE;CAGF,OAAO;EAAE,UADQ,wBAAwB;GAAE,GAAG;GAAM;GAAS;GAAU;EAAU,CACjE;EAAG;CAAa;AAClC;;AAeA,SAAS,OACP,MACA,MACyE;CACzE,QAAQ,KAAK,MAAb;EACE,KAAK,UAAU;GACb,MAAM,SAAS,KAAK,QAAQ,MAAM,cAAc,UAAU,OAAO,KAAK,EAAE;GACxE,OAAO,WAAW,KAAA,IAAY,KAAA,IAAY;IAAE,MAAM,OAAO;IAAM,cAAc,OAAO;GAAO;EAC7F;EACA,KAAK,WAAW;GACd,MAAM,UAAU,KAAK,SAAS,MAAM,cAAc,UAAU,OAAO,KAAK,EAAE;GAC1E,OAAO,YAAY,KAAA,IACf,KAAA,IACA;IAAE,MAAM,QAAQ;IAAM,cAAc,QAAQ;GAAO;EACzD;EACA,KAAK,YAAY;GACf,MAAM,WAAW,KAAK,UAAU,MAAM,cAAc,UAAU,OAAO,KAAK,EAAE;GAC5E,OAAO,aAAa,KAAA,IAChB,KAAA,IACA;IAAE,MAAM,SAAS;IAAM,cAAc,SAAS;GAAO;EAC3D;CACF;AACF;;;;;;AAOA,SAAS,iBAAiB,GAAY,GAAoB;CACxD,IAAI,EAAE,KAAK,SAAS,EAAE,KAAK,MAAM,OAAO,WAAW,EAAE,KAAK,QAAQ,WAAW,EAAE,KAAK;CACpF,MAAM,SAAS,EAAE,KAAK,YAAY,CAAC,CAAC,cAAc,EAAE,KAAK,YAAY,CAAC;CACtE,IAAI,WAAW,GAAG,OAAO;CACzB,OAAO,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,cAAc,OAAO,EAAE,KAAK,EAAE,CAAC;AAC1D;AAEA,MAAM,aAA4D;CAChE,QAAQ;CACR,SAAS;CACT,UAAU;AACZ"}
1
+ {"version":3,"file":"planner.js","names":[],"sources":["../../src/folders/planner.ts"],"sourcesContent":["import type { ProjectId, TemplateId } from \"@milaboratories/pl-model-common\";\nimport type { FoldersDocument, FolderId } from \"./document\";\nimport { foldersUniqueName } from \"./naming\";\nimport type { FoldersView } from \"./view\";\nimport { foldersDocumentFromView, foldersSiblingNames, foldersSubtree } from \"./view\";\n\n/** A folder, a project or a stored template, as something a move acts on. */\nexport type FoldersItem =\n | { readonly kind: \"folder\"; readonly id: FolderId }\n | { readonly kind: \"project\"; readonly id: ProjectId }\n | { readonly kind: \"template\"; readonly id: TemplateId };\n\n/** A tree item that is not a folder: a project or a stored template. */\nexport type FoldersLeafItem = Exclude<FoldersItem, { readonly kind: \"folder\" }>;\n\n/** What one item is called after the move, and what it was called before. */\nexport interface FoldersMoveEntry {\n readonly item: FoldersItem;\n readonly currentName: string;\n /** The name the item carries once the plan is applied. */\n readonly name: string;\n /** True when the destination already held that name and the item is being renamed. */\n readonly renamed: boolean;\n /** Folder the item is coming from; absent when it is at the top level. */\n readonly sourceFolder?: FolderId;\n}\n\n/**\n * Every item of a move and its resulting name.\n *\n * A plan is computed for the preview and recomputed inside the write, and the write commits only\n * when the two are identical, so a plan confirmed against state that has since changed is refused\n * rather than applied. Entries are in a canonical order for exactly that comparison.\n */\nexport interface FoldersMovePlan {\n /** Folder everything lands in; absent for the top level. */\n readonly destination?: FolderId;\n readonly entries: readonly FoldersMoveEntry[];\n}\n\n/** One reason a move cannot be planned. */\nexport type FoldersMoveIssue =\n | { readonly kind: \"unknown-destination\"; readonly folder: FolderId }\n | { readonly kind: \"unknown-item\"; readonly item: FoldersItem }\n | {\n readonly kind: \"into-own-descendant\";\n readonly folder: FolderId;\n readonly destination: FolderId;\n };\n\n/** A plan, or everything standing in the way of one. */\nexport type FoldersMovePlanResult =\n | { readonly ok: true; readonly plan: FoldersMovePlan }\n | { readonly ok: false; readonly issues: readonly FoldersMoveIssue[] };\n\n/**\n * Plan a move of any mix of folders, projects and templates into one destination.\n *\n * The only function that decides what a moved item ends up called. The preview and the write both\n * call it, over the same view, so the two cannot drift apart.\n *\n * A folder moves with everything inside it. When the selection holds a folder together with\n * something inside it, that item travels with the folder and is not planned on its own: moving it\n * separately as well would pull it out of the subtree it belongs to.\n */\nexport function planFoldersMove(\n view: FoldersView,\n items: readonly FoldersItem[],\n destination?: FolderId,\n): FoldersMovePlanResult {\n const issues: FoldersMoveIssue[] = [];\n\n const destinationKnown =\n destination === undefined || view.folders.some((folder) => folder.id === destination);\n if (destination !== undefined && !destinationKnown)\n issues.push({ kind: \"unknown-destination\", folder: destination });\n\n const located: Located[] = [];\n const seen = new Set<string>();\n for (const item of items) {\n const key = `${item.kind}:${item.id}`;\n if (seen.has(key)) continue;\n seen.add(key);\n\n const known = locate(view, item);\n if (known === undefined) {\n issues.push({ kind: \"unknown-item\", item });\n continue;\n }\n located.push({ item, ...known });\n }\n\n const carried = new Set<FolderId>(\n located.flatMap(({ item }) => (item.kind === \"folder\" ? foldersSubtree(view, item.id) : [])),\n );\n const moved = located.filter(\n ({ sourceFolder }) => sourceFolder === undefined || !carried.has(sourceFolder),\n );\n\n if (destination !== undefined && destinationKnown)\n for (const { item } of moved) {\n if (item.kind !== \"folder\") continue;\n if (foldersSubtree(view, item.id).includes(destination))\n issues.push({ kind: \"into-own-descendant\", folder: item.id, destination });\n }\n\n if (issues.length > 0) return { ok: false, issues };\n\n // Each kind is named against its own kind only: a moved folder never becomes \"X (Copy)\" for a\n // project called X in the destination.\n const movedIds = moved.map(({ item }) => item.id);\n const taken: Record<FoldersItem[\"kind\"], string[]> = {\n folder: foldersSiblingNames(view, destination, movedIds, { kind: \"folder\" }),\n project: foldersSiblingNames(view, destination, movedIds, { kind: \"project\" }),\n template: foldersSiblingNames(view, destination, movedIds, { kind: \"template\" }),\n };\n\n const entries: FoldersMoveEntry[] = [];\n for (const { item, name, sourceFolder } of moved.sort(byCanonicalOrder)) {\n const resulting = foldersUniqueName(name, taken[item.kind]);\n taken[item.kind].push(resulting);\n entries.push({\n item,\n currentName: name,\n name: resulting,\n renamed: resulting !== name,\n ...(sourceFolder === undefined ? {} : { sourceFolder }),\n });\n }\n\n return {\n ok: true,\n plan: { ...(destination === undefined ? {} : { destination }), entries },\n };\n}\n\n/** True when two plans say exactly the same thing. */\nexport function foldersMovePlansEqual(a: FoldersMovePlan, b: FoldersMovePlan): boolean {\n if (a.destination !== b.destination) return false;\n if (a.entries.length !== b.entries.length) return false;\n return a.entries.every((entry, index) => {\n const other = b.entries[index];\n if (other === undefined) return false;\n return (\n entry.item.kind === other.item.kind &&\n entry.item.id === other.item.id &&\n entry.currentName === other.currentName &&\n entry.name === other.name &&\n entry.renamed === other.renamed &&\n entry.sourceFolder === other.sourceFolder\n );\n });\n}\n\n/**\n * A project or a template the move gives a new name. Their names live in their own metadata, not\n * in the folder document, so the write path has to carry these out separately; a folder's name is\n * in the document and is renamed there.\n */\nexport interface FoldersLabelRename {\n readonly item: FoldersLeafItem;\n readonly name: string;\n}\n\n/** What applying a plan changes. */\nexport interface FoldersMoveApplication {\n /** The document to persist. */\n readonly document: FoldersDocument;\n /** Projects and templates whose label the move changes. */\n readonly labelRenames: readonly FoldersLabelRename[];\n}\n\n/**\n * The document a plan produces, plus the project and template label renames it implies.\n *\n * Applying a plan is arithmetic on an already validated plan; whether that plan may be committed\n * is the write path's decision.\n */\nexport function applyFoldersMove(\n view: FoldersView,\n movePlan: FoldersMovePlan,\n): FoldersMoveApplication {\n const folderParents = new Map<FolderId, FolderId | undefined>();\n const folderNames = new Map<FolderId, string>();\n const projectFolders = new Map<ProjectId, FolderId | undefined>();\n const templateFolders = new Map<TemplateId, FolderId | undefined>();\n const labelRenames: FoldersLabelRename[] = [];\n\n for (const entry of movePlan.entries) {\n switch (entry.item.kind) {\n case \"folder\":\n folderParents.set(entry.item.id, movePlan.destination);\n folderNames.set(entry.item.id, entry.name);\n break;\n case \"project\":\n projectFolders.set(entry.item.id, movePlan.destination);\n if (entry.renamed) labelRenames.push({ item: entry.item, name: entry.name });\n break;\n case \"template\":\n templateFolders.set(entry.item.id, movePlan.destination);\n if (entry.renamed) labelRenames.push({ item: entry.item, name: entry.name });\n break;\n }\n }\n\n const folders = view.folders.map((folder) => ({\n ...folder,\n parent: folderParents.has(folder.id) ? folderParents.get(folder.id) : folder.parent,\n name: folderNames.get(folder.id) ?? folder.name,\n }));\n\n const projects = view.projects.map((project) => ({\n ...project,\n folder: projectFolders.has(project.id) ? projectFolders.get(project.id) : project.folder,\n }));\n\n const templates = view.templates.map((template) => ({\n ...template,\n folder: templateFolders.has(template.id) ? templateFolders.get(template.id) : template.folder,\n }));\n\n const document = foldersDocumentFromView({ ...view, folders, projects, templates });\n return { document, labelRenames };\n}\n\n//\n// Internals\n//\n\n/** An item of the selection, with what the view says about it. */\ninterface Located {\n readonly item: FoldersItem;\n readonly name: string;\n /** Folder holding the item; absent when it is at the top level. */\n readonly sourceFolder?: FolderId;\n}\n\n/** The name and containing folder of an item the view holds, whichever kind it is. */\nfunction locate(\n view: FoldersView,\n item: FoldersItem,\n): { readonly name: string; readonly sourceFolder?: FolderId } | undefined {\n switch (item.kind) {\n case \"folder\": {\n const folder = view.folders.find((candidate) => candidate.id === item.id);\n return folder === undefined ? undefined : { name: folder.name, sourceFolder: folder.parent };\n }\n case \"project\": {\n const project = view.projects.find((candidate) => candidate.id === item.id);\n return project === undefined\n ? undefined\n : { name: project.name, sourceFolder: project.folder };\n }\n case \"template\": {\n const template = view.templates.find((candidate) => candidate.id === item.id);\n return template === undefined\n ? undefined\n : { name: template.name, sourceFolder: template.folder };\n }\n }\n}\n\n/**\n * Folders, then projects, then templates; within a kind by name, then by id. The order of the\n * items a caller hands in must not change the plan, or a preview and its write could differ over\n * nothing.\n */\nfunction byCanonicalOrder(a: Located, b: Located): number {\n if (a.item.kind !== b.item.kind) return KIND_ORDER[a.item.kind] - KIND_ORDER[b.item.kind];\n const byName = a.name.toLowerCase().localeCompare(b.name.toLowerCase());\n if (byName !== 0) return byName;\n return String(a.item.id).localeCompare(String(b.item.id));\n}\n\nconst KIND_ORDER: Readonly<Record<FoldersItem[\"kind\"], number>> = {\n folder: 0,\n project: 1,\n template: 2,\n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AAK,QAAQ,MAAM,cAAc,UAAU,OAAO,KAAK,EAAE;GACxE,OAAO,WAAW,KAAA,IAAY,KAAA,IAAY;IAAE,MAAM,OAAO;IAAM,cAAc,OAAO;GAAO;EAC7F;EACA,KAAK,WAAW;GACd,MAAM,UAAU,KAAK,SAAS,MAAM,cAAc,UAAU,OAAO,KAAK,EAAE;GAC1E,OAAO,YAAY,KAAA,IACf,KAAA,IACA;IAAE,MAAM,QAAQ;IAAM,cAAc,QAAQ;GAAO;EACzD;EACA,KAAK,YAAY;GACf,MAAM,WAAW,KAAK,UAAU,MAAM,cAAc,UAAU,OAAO,KAAK,EAAE;GAC5E,OAAO,aAAa,KAAA,IAChB,KAAA,IACA;IAAE,MAAM,SAAS;IAAM,cAAc,SAAS;GAAO;EAC3D;CACF;AACF;;;;;;AAOA,SAAS,iBAAiB,GAAY,GAAoB;CACxD,IAAI,EAAE,KAAK,SAAS,EAAE,KAAK,MAAM,OAAO,WAAW,EAAE,KAAK,QAAQ,WAAW,EAAE,KAAK;CACpF,MAAM,SAAS,EAAE,KAAK,YAAY,CAAC,CAAC,cAAc,EAAE,KAAK,YAAY,CAAC;CACtE,IAAI,WAAW,GAAG,OAAO;CACzB,OAAO,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,cAAc,OAAO,EAAE,KAAK,EAAE,CAAC;AAC1D;AAEA,MAAM,aAA4D;CAChE,QAAQ;CACR,SAAS;CACT,UAAU;AACZ"}
@@ -1,5 +1,5 @@
1
1
  const require_view = require("./view.cjs");
2
- //#region src/folders/removal.ts
2
+ // src/folders/removal.ts
3
3
  /** What deleting this folder would destroy. */
4
4
  function planFoldersRemoval(view, folder) {
5
5
  if (!view.folders.some((candidate) => candidate.id === folder)) return {
@@ -39,7 +39,6 @@ function applyFoldersRemoval(view, removal) {
39
39
  templates: view.templates.filter((template) => !doomedTemplates.has(template.id))
40
40
  });
41
41
  }
42
- //#endregion
43
42
  exports.applyFoldersRemoval = applyFoldersRemoval;
44
43
  exports.foldersRemovalsEqual = foldersRemovalsEqual;
45
44
  exports.planFoldersRemoval = planFoldersRemoval;
@@ -1,7 +1,6 @@
1
1
  import { FolderId, FoldersDocument } from "./document.js";
2
2
  import { FoldersView } from "./view.js";
3
3
  import { ProjectId, TemplateId } from "@milaboratories/pl-model-common";
4
- //#region src/folders/removal.d.ts
5
4
  /**
6
5
  * Everything a folder deletion destroys: the folder, every folder beneath it, and every project
7
6
  * and template held anywhere inside.
@@ -38,5 +37,4 @@ export declare function foldersRemovalsEqual(a: FoldersRemoval, b: FoldersRemova
38
37
  * by the write path.
39
38
  */
40
39
  export declare function applyFoldersRemoval(view: FoldersView, removal: FoldersRemoval): FoldersDocument;
41
- //#endregion
42
40
  //# sourceMappingURL=removal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"removal.d.ts","names":[],"sources":["../../src/folders/removal.ts"],"mappings":";;;;;;;;;;;;;iBAciB;WACN,kBAAkB;WAClB,mBAAmB;WACnB,oBAAoB;;;YAInB;WACD;WACA,QAAQ;;;YAIP;WACG;WAAmB,SAAS;;WAC5B;WAAoB,iBAAiB;;;wBAGpC,mBAAmB,MAAM,aAAa,QAAQ,WAAW;;wBAmBzD,qBAAqB,GAAG,gBAAgB,GAAG;;;;;wBAe3C,oBAAoB,MAAM,aAAa,SAAS,iBAAiB"}
1
+ {"version":3,"file":"removal.d.ts","names":[],"sources":["../../src/folders/removal.ts"],"mappings":";;;;;;;;;;;;iBAciB;WACN,kBAAkB;WAClB,mBAAmB;WACnB,oBAAoB;;;YAInB;WACD;WACA,QAAQ;;;YAIP;WACG;WAAmB,SAAS;;WAC5B;WAAoB,iBAAiB;;;wBAGpC,mBAAmB,MAAM,aAAa,QAAQ,WAAW;;wBAmBzD,qBAAqB,GAAG,gBAAgB,GAAG;;;;;wBAe3C,oBAAoB,MAAM,aAAa,SAAS,iBAAiB"}
@@ -1,5 +1,5 @@
1
1
  import { foldersDocumentFromView, foldersSubtree } from "./view.js";
2
- //#region src/folders/removal.ts
2
+ // src/folders/removal.ts
3
3
  /** What deleting this folder would destroy. */
4
4
  function planFoldersRemoval(view, folder) {
5
5
  if (!view.folders.some((candidate) => candidate.id === folder)) return {
@@ -39,7 +39,6 @@ function applyFoldersRemoval(view, removal) {
39
39
  templates: view.templates.filter((template) => !doomedTemplates.has(template.id))
40
40
  });
41
41
  }
42
- //#endregion
43
42
  export { applyFoldersRemoval, foldersRemovalsEqual, planFoldersRemoval };
44
43
 
45
44
  //# sourceMappingURL=removal.js.map
@@ -1,6 +1,6 @@
1
1
  const require_project = require("../project.cjs");
2
2
  const require_document = require("./document.cjs");
3
- //#region src/folders/view.ts
3
+ // src/folders/view.ts
4
4
  /**
5
5
  * Resolve a decoded document against the project and template lists into the view the desktop
6
6
  * renders.
@@ -201,7 +201,6 @@ function topLevel(id, name, lifted, description) {
201
201
  lifted
202
202
  };
203
203
  }
204
- //#endregion
205
204
  exports.foldersChildren = foldersChildren;
206
205
  exports.foldersDocumentFromView = foldersDocumentFromView;
207
206
  exports.foldersSiblingNames = foldersSiblingNames;
@@ -2,7 +2,6 @@ import { FolderId, FoldersDocument } from "./document.js";
2
2
  import { FoldersDecoded, FoldersDocumentProblem } from "./decode.js";
3
3
  import { FoldersItem } from "./planner.js";
4
4
  import { ProjectId, TemplateId } from "@milaboratories/pl-model-common";
5
- //#region src/folders/view.d.ts
6
5
  /** An item as the folder machinery needs to see it: an identity and the label shown to a user. */
7
6
  export interface FoldersItemInput<Id extends string> {
8
7
  readonly id: Id;
@@ -94,5 +93,4 @@ export declare function foldersSubtree(view: FoldersView, folder: FolderId): rea
94
93
  * the tree it just rendered.
95
94
  */
96
95
  export declare function foldersDocumentFromView(view: FoldersView): FoldersDocument;
97
- //#endregion
98
96
  //# sourceMappingURL=view.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"view.d.ts","names":[],"sources":["../../src/folders/view.ts"],"mappings":";;;;;;iBAQiB,iBAAiB;WACvB,IAAI;WACJ;;;iBAIM;;WAEN,SAAS;;WA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B,yBACnB;;wBAmBa,gBACd,MAAM,aACN,SAAS;WAEA,kBAAkB;WAClB,mBAAmB;WACnB,oBAAoB;;;;;;;;;;;;;wBAoBf,oBACd,MAAM,aACN,SAAS,UACT,UAAS,kBACT;WAAoB,OAAO;;;wBAgBb,eAAe,MAAM,aAAa,QAAQ,oBAAoB;;;;;wBAiB9D,wBAAwB,MAAM,cAAc"}
@@ -1,6 +1,6 @@
1
1
  import { normalizeDescription } from "../project.js";
2
2
  import { emptyFoldersDocument } from "./document.js";
3
- //#region src/folders/view.ts
3
+ // src/folders/view.ts
4
4
  /**
5
5
  * Resolve a decoded document against the project and template lists into the view the desktop
6
6
  * renders.
@@ -201,7 +201,6 @@ function topLevel(id, name, lifted, description) {
201
201
  lifted
202
202
  };
203
203
  }
204
- //#endregion
205
204
  export { foldersChildren, foldersDocumentFromView, foldersSiblingNames, foldersSubtree, foldersViewFromDocument, healFolders };
206
205
 
207
206
  //# sourceMappingURL=view.js.map
package/dist/json.cjs CHANGED
@@ -3,22 +3,23 @@ let _milaboratories_pl_model_common = require("@milaboratories/pl-model-common")
3
3
  let node_crypto = require("node:crypto");
4
4
  let node_fs = require("node:fs");
5
5
  node_fs = require_runtime.__toESM(node_fs, 1);
6
- //#region src/json.ts
6
+ // src/json.ts
7
7
  function hashJson(value) {
8
8
  const hash = (0, node_crypto.createHash)("sha256");
9
9
  hash.update((0, _milaboratories_pl_model_common.canonicalizeJson)(value));
10
10
  return hash.digest().toString("hex");
11
11
  }
12
12
  async function readJson(filePath, signal) {
13
- return (0, _milaboratories_pl_model_common.parseJson)(await node_fs.default.promises.readFile(filePath, {
13
+ const content = await node_fs.default.promises.readFile(filePath, {
14
14
  encoding: "utf8",
15
15
  signal
16
- }));
16
+ });
17
+ return (0, _milaboratories_pl_model_common.parseJson)(content);
17
18
  }
18
19
  function readJsonSync(filePath) {
19
- return (0, _milaboratories_pl_model_common.parseJson)(node_fs.default.readFileSync(filePath, { encoding: "utf8" }));
20
+ const content = node_fs.default.readFileSync(filePath, { encoding: "utf8" });
21
+ return (0, _milaboratories_pl_model_common.parseJson)(content);
20
22
  }
21
- //#endregion
22
23
  exports.hashJson = hashJson;
23
24
  exports.readJson = readJson;
24
25
  exports.readJsonSync = readJsonSync;
package/dist/json.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"json.cjs","names":["fs"],"sources":["../src/json.ts"],"sourcesContent":["import {\n canonicalizeJson,\n parseJson,\n type JsonCompatible,\n type JsonSerializable,\n type StringifiedJson,\n} from \"@milaboratories/pl-model-common\";\nimport { createHash } from \"node:crypto\";\nimport fs from \"node:fs\";\n\nexport type HashedJson<T = unknown> =\n JsonCompatible<T> extends never\n ? never\n : string & {\n __json_hashed: T;\n };\n\nexport function hashJson<T>(value: JsonCompatible<T>): HashedJson<T>;\nexport function hashJson<T extends JsonSerializable>(value: T): string;\nexport function hashJson(value: unknown): string {\n const hash = createHash(\"sha256\");\n hash.update(canonicalizeJson(value));\n return hash.digest().toString(\"hex\");\n}\n\nexport async function readJson<T extends JsonSerializable>(\n filePath: string,\n signal?: AbortSignal,\n): Promise<T> {\n const content = await fs.promises.readFile(filePath, { encoding: \"utf8\", signal });\n return parseJson(content as StringifiedJson<T>);\n}\n\nexport function readJsonSync<T extends JsonSerializable>(filePath: string): T {\n const content = fs.readFileSync(filePath, { encoding: \"utf8\" });\n return parseJson(content as StringifiedJson<T>);\n}\n"],"mappings":";;;;;;AAmBA,SAAgB,SAAS,OAAwB;CAC/C,MAAM,QAAA,GAAA,YAAA,WAAA,CAAkB,QAAQ;CAChC,KAAK,QAAA,GAAA,gCAAA,iBAAA,CAAwB,KAAK,CAAC;CACnC,OAAO,KAAK,OAAO,CAAC,CAAC,SAAS,KAAK;AACrC;AAEA,eAAsB,SACpB,UACA,QACY;CAEZ,QAAA,GAAA,gCAAA,UAAA,CAAiB,MADKA,QAAAA,QAAG,SAAS,SAAS,UAAU;EAAE,UAAU;EAAQ;CAAO,CAAC,CACnC;AAChD;AAEA,SAAgB,aAAyC,UAAqB;CAE5E,QAAA,GAAA,gCAAA,UAAA,CADgBA,QAAAA,QAAG,aAAa,UAAU,EAAE,UAAU,OAAO,CACtC,CAAuB;AAChD"}
1
+ {"version":3,"file":"json.cjs","names":["createHash","canonicalizeJson","fs","parseJson"],"sources":["../src/json.ts"],"sourcesContent":["import {\n canonicalizeJson,\n parseJson,\n type JsonCompatible,\n type JsonSerializable,\n type StringifiedJson,\n} from \"@milaboratories/pl-model-common\";\nimport { createHash } from \"node:crypto\";\nimport fs from \"node:fs\";\n\nexport type HashedJson<T = unknown> =\n JsonCompatible<T> extends never\n ? never\n : string & {\n __json_hashed: T;\n };\n\nexport function hashJson<T>(value: JsonCompatible<T>): HashedJson<T>;\nexport function hashJson<T extends JsonSerializable>(value: T): string;\nexport function hashJson(value: unknown): string {\n const hash = createHash(\"sha256\");\n hash.update(canonicalizeJson(value));\n return hash.digest().toString(\"hex\");\n}\n\nexport async function readJson<T extends JsonSerializable>(\n filePath: string,\n signal?: AbortSignal,\n): Promise<T> {\n const content = await fs.promises.readFile(filePath, { encoding: \"utf8\", signal });\n return parseJson(content as StringifiedJson<T>);\n}\n\nexport function readJsonSync<T extends JsonSerializable>(filePath: string): T {\n const content = fs.readFileSync(filePath, { encoding: \"utf8\" });\n return parseJson(content as StringifiedJson<T>);\n}\n"],"mappings":";;;;;;AAmBA,SAAgB,SAAS,OAAwB;CAC/C,MAAM,QAAA,GAAOA,YAAAA,WAAAA,CAAW,QAAQ;CAChC,KAAK,QAAA,GAAOC,gCAAAA,iBAAAA,CAAiB,KAAK,CAAC;CACnC,OAAO,KAAK,OAAO,CAAC,CAAC,SAAS,KAAK;AACrC;AAEA,eAAsB,SACpB,UACA,QACY;CACZ,MAAM,UAAU,MAAMC,QAAAA,QAAG,SAAS,SAAS,UAAU;EAAE,UAAU;EAAQ;CAAO,CAAC;CACjF,QAAA,GAAOC,gCAAAA,UAAAA,CAAU,OAA6B;AAChD;AAEA,SAAgB,aAAyC,UAAqB;CAC5E,MAAM,UAAUD,QAAAA,QAAG,aAAa,UAAU,EAAE,UAAU,OAAO,CAAC;CAC9D,QAAA,GAAOC,gCAAAA,UAAAA,CAAU,OAA6B;AAChD"}
package/dist/json.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { JsonCompatible, JsonSerializable } from "@milaboratories/pl-model-common";
2
- //#region src/json.d.ts
3
2
  export type HashedJson<T = unknown> = JsonCompatible<T> extends never ? never : string & {
4
3
  __json_hashed: T;
5
4
  };
@@ -7,5 +6,4 @@ export declare function hashJson<T>(value: JsonCompatible<T>): HashedJson<T>;
7
6
  export declare function hashJson<T extends JsonSerializable>(value: T): string;
8
7
  export declare function readJson<T extends JsonSerializable>(filePath: string, signal?: AbortSignal): Promise<T>;
9
8
  export declare function readJsonSync<T extends JsonSerializable>(filePath: string): T;
10
- //#endregion
11
9
  //# sourceMappingURL=json.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"json.d.ts","names":[],"sources":["../src/json.ts"],"mappings":";;YAUY,WAAW,eACrB,eAAe;EAGT,eAAe;;wBAGP,SAAS,GAAG,OAAO,eAAe,KAAK,WAAW;wBAClD,SAAS,UAAU,kBAAkB,OAAO;wBAOtC,SAAS,UAAU,kBACvC,kBACA,SAAS,cACR,QAAQ;wBAKK,aAAa,UAAU,kBAAkB,mBAAmB"}
1
+ {"version":3,"file":"json.d.ts","names":[],"sources":["../src/json.ts"],"mappings":";YAUY,WAAW,eACrB,eAAe;EAGT,eAAe;;wBAGP,SAAS,GAAG,OAAO,eAAe,KAAK,WAAW;wBAClD,SAAS,UAAU,kBAAkB,OAAO;wBAOtC,SAAS,UAAU,kBACvC,kBACA,SAAS,cACR,QAAQ;wBAKK,aAAa,UAAU,kBAAkB,mBAAmB"}
package/dist/json.js CHANGED
@@ -1,22 +1,23 @@
1
1
  import { canonicalizeJson, parseJson } from "@milaboratories/pl-model-common";
2
2
  import { createHash } from "node:crypto";
3
3
  import fs from "node:fs";
4
- //#region src/json.ts
4
+ // src/json.ts
5
5
  function hashJson(value) {
6
6
  const hash = createHash("sha256");
7
7
  hash.update(canonicalizeJson(value));
8
8
  return hash.digest().toString("hex");
9
9
  }
10
10
  async function readJson(filePath, signal) {
11
- return parseJson(await fs.promises.readFile(filePath, {
11
+ const content = await fs.promises.readFile(filePath, {
12
12
  encoding: "utf8",
13
13
  signal
14
- }));
14
+ });
15
+ return parseJson(content);
15
16
  }
16
17
  function readJsonSync(filePath) {
17
- return parseJson(fs.readFileSync(filePath, { encoding: "utf8" }));
18
+ const content = fs.readFileSync(filePath, { encoding: "utf8" });
19
+ return parseJson(content);
18
20
  }
19
- //#endregion
20
21
  export { hashJson, readJson, readJsonSync };
21
22
 
22
23
  //# sourceMappingURL=json.js.map
package/dist/json.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"json.js","names":[],"sources":["../src/json.ts"],"sourcesContent":["import {\n canonicalizeJson,\n parseJson,\n type JsonCompatible,\n type JsonSerializable,\n type StringifiedJson,\n} from \"@milaboratories/pl-model-common\";\nimport { createHash } from \"node:crypto\";\nimport fs from \"node:fs\";\n\nexport type HashedJson<T = unknown> =\n JsonCompatible<T> extends never\n ? never\n : string & {\n __json_hashed: T;\n };\n\nexport function hashJson<T>(value: JsonCompatible<T>): HashedJson<T>;\nexport function hashJson<T extends JsonSerializable>(value: T): string;\nexport function hashJson(value: unknown): string {\n const hash = createHash(\"sha256\");\n hash.update(canonicalizeJson(value));\n return hash.digest().toString(\"hex\");\n}\n\nexport async function readJson<T extends JsonSerializable>(\n filePath: string,\n signal?: AbortSignal,\n): Promise<T> {\n const content = await fs.promises.readFile(filePath, { encoding: \"utf8\", signal });\n return parseJson(content as StringifiedJson<T>);\n}\n\nexport function readJsonSync<T extends JsonSerializable>(filePath: string): T {\n const content = fs.readFileSync(filePath, { encoding: \"utf8\" });\n return parseJson(content as StringifiedJson<T>);\n}\n"],"mappings":";;;;AAmBA,SAAgB,SAAS,OAAwB;CAC/C,MAAM,OAAO,WAAW,QAAQ;CAChC,KAAK,OAAO,iBAAiB,KAAK,CAAC;CACnC,OAAO,KAAK,OAAO,CAAC,CAAC,SAAS,KAAK;AACrC;AAEA,eAAsB,SACpB,UACA,QACY;CAEZ,OAAO,UAAU,MADK,GAAG,SAAS,SAAS,UAAU;EAAE,UAAU;EAAQ;CAAO,CAAC,CACnC;AAChD;AAEA,SAAgB,aAAyC,UAAqB;CAE5E,OAAO,UADS,GAAG,aAAa,UAAU,EAAE,UAAU,OAAO,CACtC,CAAuB;AAChD"}
1
+ {"version":3,"file":"json.js","names":[],"sources":["../src/json.ts"],"sourcesContent":["import {\n canonicalizeJson,\n parseJson,\n type JsonCompatible,\n type JsonSerializable,\n type StringifiedJson,\n} from \"@milaboratories/pl-model-common\";\nimport { createHash } from \"node:crypto\";\nimport fs from \"node:fs\";\n\nexport type HashedJson<T = unknown> =\n JsonCompatible<T> extends never\n ? never\n : string & {\n __json_hashed: T;\n };\n\nexport function hashJson<T>(value: JsonCompatible<T>): HashedJson<T>;\nexport function hashJson<T extends JsonSerializable>(value: T): string;\nexport function hashJson(value: unknown): string {\n const hash = createHash(\"sha256\");\n hash.update(canonicalizeJson(value));\n return hash.digest().toString(\"hex\");\n}\n\nexport async function readJson<T extends JsonSerializable>(\n filePath: string,\n signal?: AbortSignal,\n): Promise<T> {\n const content = await fs.promises.readFile(filePath, { encoding: \"utf8\", signal });\n return parseJson(content as StringifiedJson<T>);\n}\n\nexport function readJsonSync<T extends JsonSerializable>(filePath: string): T {\n const content = fs.readFileSync(filePath, { encoding: \"utf8\" });\n return parseJson(content as StringifiedJson<T>);\n}\n"],"mappings":";;;;AAmBA,SAAgB,SAAS,OAAwB;CAC/C,MAAM,OAAO,WAAW,QAAQ;CAChC,KAAK,OAAO,iBAAiB,KAAK,CAAC;CACnC,OAAO,KAAK,OAAO,CAAC,CAAC,SAAS,KAAK;AACrC;AAEA,eAAsB,SACpB,UACA,QACY;CACZ,MAAM,UAAU,MAAM,GAAG,SAAS,SAAS,UAAU;EAAE,UAAU;EAAQ;CAAO,CAAC;CACjF,OAAO,UAAU,OAA6B;AAChD;AAEA,SAAgB,aAAyC,UAAqB;CAC5E,MAAM,UAAU,GAAG,aAAa,UAAU,EAAE,UAAU,OAAO,CAAC;CAC9D,OAAO,UAAU,OAA6B;AAChD"}
@@ -1,9 +1,8 @@
1
- //#region src/pframe/internal_api/api_factory.ts
1
+ // src/pframe/internal_api/api_factory.ts
2
2
  /** PColumn spec file extension */
3
3
  const SpecExtension = ".spec";
4
4
  /** PColumn data info file extension */
5
5
  const DataInfoExtension = ".datainfo";
6
- //#endregion
7
6
  exports.DataInfoExtension = DataInfoExtension;
8
7
  exports.SpecExtension = SpecExtension;
9
8
 
@@ -1,6 +1,5 @@
1
1
  import { HttpServerInfo } from "./http_helpers.js";
2
2
  import { AxisValueType, BinaryPartitionedDataInfo, Branded, ColumnValueType, JsonDataInfo, JsonPartitionedDataInfo, PObjectId, ParquetChunk, ParquetPartitionedDataInfo } from "@milaboratories/pl-model-common";
3
- //#region src/pframe/internal_api/api_factory.d.ts
4
3
  /** PColumn spec file extension */
5
4
  export declare const SpecExtension: ".spec";
6
5
  /** PColumn data info file extension */
@@ -90,5 +89,4 @@ export interface PFrameFactoryAPIV6 extends Disposable {
90
89
  * any interactions with disposed PFrame will result in exception */
91
90
  dispose(): void;
92
91
  }
93
- //#endregion
94
92
  //# sourceMappingURL=api_factory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"api_factory.d.ts","names":[],"sources":["../../../src/pframe/internal_api/api_factory.ts"],"mappings":";;;;qBAca;;qBAGA;;YAGD,eAAe;;;YAIf;;iBAGK;;;;;;EAMf,YAAY,SAAS,iBAAiB;;EAGtC,mBAAmB,QAAQ,eAAe,QAAQ;;;;;EAMlD,gBAAgB;;;;;;;YAQN;WACD,MAAM;WACN,QAAQ;;;;;;;;YASP,SAAS,SACjB,eACA,wBAAwB,QACxB,0BAA0B,QAC1B,2BAA2B,aAAa;;;;;WAMjC,WAAW;;;;;;;;;;YAWV,WAAW,QAAQ,SAAS;WAC7B,UAAU;;;;;;;iBAQJ;;WAEN,IAAI;;WAEJ,MAAM,WAAW;;;;;;;iBAQX,2BAA2B;;EAE1C,cAAc,YAAY;;;;;;EAO1B,WACE,SAAS,oBACT;IACE,SAAS;MAEV;;;EAIH"}
1
+ {"version":3,"file":"api_factory.d.ts","names":[],"sources":["../../../src/pframe/internal_api/api_factory.ts"],"mappings":";;;qBAca;;qBAGA;;YAGD,eAAe;;;YAIf;;iBAGK;;;;;;EAMf,YAAY,SAAS,iBAAiB;;EAGtC,mBAAmB,QAAQ,eAAe,QAAQ;;;;;EAMlD,gBAAgB;;;;;;;YAQN;WACD,MAAM;WACN,QAAQ;;;;;;;;YASP,SAAS,SACjB,eACA,wBAAwB,QACxB,0BAA0B,QAC1B,2BAA2B,aAAa;;;;;WAMjC,WAAW;;;;;;;;;;YAWV,WAAW,QAAQ,SAAS;WAC7B,UAAU;;;;;;;iBAQJ;;WAEN,IAAI;;WAEJ,MAAM,WAAW;;;;;;;iBAQX,2BAA2B;;EAE1C,cAAc,YAAY;;;;;;EAO1B,WACE,SAAS,oBACT;IACE,SAAS;MAEV;;;EAIH"}
@@ -1,9 +1,8 @@
1
- //#region src/pframe/internal_api/api_factory.ts
1
+ // src/pframe/internal_api/api_factory.ts
2
2
  /** PColumn spec file extension */
3
3
  const SpecExtension = ".spec";
4
4
  /** PColumn data info file extension */
5
5
  const DataInfoExtension = ".datainfo";
6
- //#endregion
7
6
  export { DataInfoExtension, SpecExtension };
8
7
 
9
8
  //# sourceMappingURL=api_factory.js.map
@@ -1,7 +1,6 @@
1
1
  import { PTableV12 } from "./table.js";
2
2
  import { PTableId } from "./common.js";
3
3
  import { DataQuery, DataQueryBooleanExpression, PObjectId, UniqueValuesResponse } from "@milaboratories/pl-model-common";
4
- //#region src/pframe/internal_api/api_read.d.ts
5
4
  /**
6
5
  * V2 unique-values request. Axis and filter references are
7
6
  * pre-resolved to numeric indices; no selector ids cross the API
@@ -46,5 +45,4 @@ export interface PFrameReadAPIV15 {
46
45
  signal?: AbortSignal;
47
46
  }): Promise<UniqueValuesResponse>;
48
47
  }
49
- //#endregion
50
48
  //# sourceMappingURL=api_read.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"api_read.d.ts","names":[],"sources":["../../../src/pframe/internal_api/api_read.ts"],"mappings":";;;;;;;;;;iBAeiB;;WAEN,UAAU;;;;;WAMV;;WAGA,SAAS;;WAGT;;;;;;;;;;;;;;;;;;;iBAoBM;;EAEf,YAAY,SAAS,UAAU,WAAW,YAAY;;EAGtD,gBACE,SAAS,uBACT;IACE,SAAS;MAEV,QAAQ"}
1
+ {"version":3,"file":"api_read.d.ts","names":[],"sources":["../../../src/pframe/internal_api/api_read.ts"],"mappings":";;;;;;;;;iBAeiB;;WAEN,UAAU;;;;;WAMV;;WAGA,SAAS;;WAGT;;;;;;;;;;;;;;;;;;;iBAoBM;;EAEf,YAAY,SAAS,UAAU,WAAW,YAAY;;EAGtD,gBACE,SAAS,uBACT;IACE,SAAS;MAEV,QAAQ"}
@@ -1,5 +1,4 @@
1
1
  import { AxisSpec, PFrameHandle, PTableHandle, SingleAxisSelector } from "@milaboratories/pl-model-common";
2
- //#region src/pframe/internal_api/common.d.ts
3
2
  export type Logger = (level: "info" | "warn" | "error", message: string) => void;
4
3
  export type PFrameId = PFrameHandle;
5
4
  export type PTableId = PTableHandle;
@@ -16,5 +15,4 @@ export type ConstantAxisFilter = {
16
15
  axisIndex: number;
17
16
  constant: string | number;
18
17
  };
19
- //#endregion
20
18
  //# sourceMappingURL=common.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","names":[],"sources":["../../../src/pframe/internal_api/common.ts"],"mappings":";;YAOY,UAAU,kCAAkC;YAE5C,WAAW;YAEX,WAAW;iBAEN;EACf,MAAM;EACN,eAAe;;iBAGA;EACf,UAAU;EACV,gBAAgB;;YAGN;EACV;EACA;EACA"}
1
+ {"version":3,"file":"common.d.ts","names":[],"sources":["../../../src/pframe/internal_api/common.ts"],"mappings":";YAOY,UAAU,kCAAkC;YAE5C,WAAW;YAEX,WAAW;iBAEN;EACf,MAAM;EACN,eAAe;;iBAGA;EACf,UAAU;EACV,gBAAgB;;YAGN;EACV;EACA;EACA"}
@@ -1,6 +1,5 @@
1
1
  import { ConstantAxisFilter } from "./common.js";
2
2
  import { JsonDataInfo, PColumnSpec, PObjectId, PTableRecordFilter } from "@milaboratories/pl-model-common";
3
- //#region src/pframe/internal_api/create_table.d.ts
4
3
  export interface ColumnJoinEntry {
5
4
  type: "column";
6
5
  columnId: PObjectId;
@@ -41,5 +40,4 @@ export interface CreateTableRequestV4 {
41
40
  src: JoinEntryV4;
42
41
  filters: PTableRecordFilter[];
43
42
  }
44
- //#endregion
45
43
  //# sourceMappingURL=create_table.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"create_table.d.ts","names":[],"sources":["../../../src/pframe/internal_api/create_table.ts"],"mappings":";;;iBAQiB;EACf;EACA,UAAU;;iBAGK;WACN;WACA,UAAU;WACV,OAAO;WACP,aAAa;;iBAGP;WACN;WACA,UAAU;WACV,OAAO;WACP;;iBAGM;WACN;WACA,OAAO;WACP,MAAM;WACN,UAAU;;iBAGJ;EACf;EACA,SAAS;;iBAGM;EACf;EACA,SAAS;;iBAGM;EACf;EACA,SAAS;EACT,WAAW;;YAGD,cACR,kBACA,wBACA,4BACA,wBACA,cACA,aACA;iBAEa;EACf,KAAK;EACL,SAAS"}
1
+ {"version":3,"file":"create_table.d.ts","names":[],"sources":["../../../src/pframe/internal_api/create_table.ts"],"mappings":";;iBAQiB;EACf;EACA,UAAU;;iBAGK;WACN;WACA,UAAU;WACV,OAAO;WACP,aAAa;;iBAGP;WACN;WACA,UAAU;WACV,OAAO;WACP;;iBAGM;WACN;WACA,OAAO;WACP,MAAM;WACN,UAAU;;iBAGJ;EACf;EACA,SAAS;;iBAGM;EACf;EACA,SAAS;;iBAGM;EACf;EACA,SAAS;EACT,WAAW;;YAGD,cACR,kBACA,wBACA,4BACA,wBACA,cACA,aACA;iBAEa;EACf,KAAK;EACL,SAAS"}