@milaboratories/pl-middle-layer 1.67.5 → 1.68.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 (106) hide show
  1. package/dist/block_registry/registry-v2-provider.d.ts +1 -3
  2. package/dist/block_registry/registry-v2-provider.d.ts.map +1 -1
  3. package/dist/block_registry/registry.d.ts +5 -9
  4. package/dist/block_registry/registry.d.ts.map +1 -1
  5. package/dist/block_registry/template_provider.d.ts +3 -5
  6. package/dist/block_registry/template_provider.d.ts.map +1 -1
  7. package/dist/block_registry/watcher.d.ts +4 -6
  8. package/dist/block_registry/watcher.d.ts.map +1 -1
  9. package/dist/block_registry/well_known_registries.d.ts +3 -5
  10. package/dist/block_registry/well_known_registries.d.ts.map +1 -1
  11. package/dist/index.d.ts +6 -2
  12. package/dist/middle_layer/build_stamp.cjs +34 -0
  13. package/dist/middle_layer/build_stamp.cjs.map +1 -0
  14. package/dist/middle_layer/build_stamp.js +34 -0
  15. package/dist/middle_layer/build_stamp.js.map +1 -0
  16. package/dist/middle_layer/driver_kit.d.ts +3 -4
  17. package/dist/middle_layer/driver_kit.d.ts.map +1 -1
  18. package/dist/middle_layer/index.d.ts +3 -2
  19. package/dist/middle_layer/middle_layer.cjs +48 -0
  20. package/dist/middle_layer/middle_layer.cjs.map +1 -1
  21. package/dist/middle_layer/middle_layer.d.ts +23 -4
  22. package/dist/middle_layer/middle_layer.d.ts.map +1 -1
  23. package/dist/middle_layer/middle_layer.js +48 -0
  24. package/dist/middle_layer/middle_layer.js.map +1 -1
  25. package/dist/middle_layer/ops.cjs +8 -2
  26. package/dist/middle_layer/ops.cjs.map +1 -1
  27. package/dist/middle_layer/ops.d.ts +70 -26
  28. package/dist/middle_layer/ops.d.ts.map +1 -1
  29. package/dist/middle_layer/ops.js +8 -2
  30. package/dist/middle_layer/ops.js.map +1 -1
  31. package/dist/middle_layer/project.cjs +163 -8
  32. package/dist/middle_layer/project.cjs.map +1 -1
  33. package/dist/middle_layer/project.d.ts +56 -7
  34. package/dist/middle_layer/project.d.ts.map +1 -1
  35. package/dist/middle_layer/project.js +165 -11
  36. package/dist/middle_layer/project.js.map +1 -1
  37. package/dist/middle_layer/project_list.d.ts +5 -3
  38. package/dist/middle_layer/project_list.d.ts.map +1 -1
  39. package/dist/middle_layer/sharing_list.d.ts +3 -4
  40. package/dist/middle_layer/sharing_list.d.ts.map +1 -1
  41. package/dist/middle_layer/tree_snapshot_store.cjs +283 -0
  42. package/dist/middle_layer/tree_snapshot_store.cjs.map +1 -0
  43. package/dist/middle_layer/tree_snapshot_store.d.ts +143 -0
  44. package/dist/middle_layer/tree_snapshot_store.d.ts.map +1 -0
  45. package/dist/middle_layer/tree_snapshot_store.js +280 -0
  46. package/dist/middle_layer/tree_snapshot_store.js.map +1 -0
  47. package/dist/middle_layer/types.d.ts +1 -3
  48. package/dist/middle_layer/types.d.ts.map +1 -1
  49. package/dist/model/block_pack_spec.d.ts +13 -15
  50. package/dist/model/block_pack_spec.d.ts.map +1 -1
  51. package/dist/model/frontend.d.ts +1 -2
  52. package/dist/model/frontend.d.ts.map +1 -1
  53. package/dist/model/project_helper.d.ts +2 -4
  54. package/dist/model/project_helper.d.ts.map +1 -1
  55. package/dist/model/project_model.d.ts +12 -12
  56. package/dist/model/project_model.d.ts.map +1 -1
  57. package/dist/model/sharing_model.d.ts +24 -26
  58. package/dist/model/sharing_model.d.ts.map +1 -1
  59. package/dist/model/template_apply.d.ts +9 -8
  60. package/dist/model/template_apply.d.ts.map +1 -1
  61. package/dist/model/template_export.d.ts +2 -2
  62. package/dist/model/template_export.d.ts.map +1 -1
  63. package/dist/model/template_parser.d.ts +2 -4
  64. package/dist/model/template_parser.d.ts.map +1 -1
  65. package/dist/model/template_resolve.d.ts +10 -11
  66. package/dist/model/template_resolve.d.ts.map +1 -1
  67. package/dist/model/template_serializer.d.ts +6 -5
  68. package/dist/model/template_serializer.d.ts.map +1 -1
  69. package/dist/model/template_spec.d.ts +7 -9
  70. package/dist/model/template_spec.d.ts.map +1 -1
  71. package/dist/mutator/block-pack/block_pack.d.ts +2 -3
  72. package/dist/mutator/block-pack/block_pack.d.ts.map +1 -1
  73. package/dist/mutator/project.cjs +20 -3
  74. package/dist/mutator/project.cjs.map +1 -1
  75. package/dist/mutator/project.d.ts +4 -3
  76. package/dist/mutator/project.d.ts.map +1 -1
  77. package/dist/mutator/project.js +20 -3
  78. package/dist/mutator/project.js.map +1 -1
  79. package/dist/mutator/template/render_template.d.ts +1 -3
  80. package/dist/mutator/template/render_template.d.ts.map +1 -1
  81. package/dist/mutator/template/template_cache.d.ts +15 -16
  82. package/dist/mutator/template/template_cache.d.ts.map +1 -1
  83. package/dist/mutator/template/template_loading.d.ts +10 -12
  84. package/dist/mutator/template/template_loading.d.ts.map +1 -1
  85. package/dist/network_check/network_check.d.ts +3 -5
  86. package/dist/network_check/network_check.d.ts.map +1 -1
  87. package/dist/pool/data.d.ts +2 -4
  88. package/dist/pool/data.d.ts.map +1 -1
  89. package/dist/pool/driver.d.ts +6 -6
  90. package/dist/pool/driver.d.ts.map +1 -1
  91. package/dist/pool/index.d.ts +1 -0
  92. package/dist/pool/p_object_collection.d.ts +1 -3
  93. package/dist/pool/p_object_collection.d.ts.map +1 -1
  94. package/dist/pool/result_pool.d.ts +3 -1
  95. package/dist/worker/worker.d.ts +1 -1
  96. package/package.json +14 -14
  97. package/src/middle_layer/build_stamp.ts +36 -0
  98. package/src/middle_layer/index.ts +1 -0
  99. package/src/middle_layer/middle_layer.ts +77 -0
  100. package/src/middle_layer/ops.ts +46 -1
  101. package/src/middle_layer/project.ts +234 -14
  102. package/src/middle_layer/project_failsafe.test.ts +47 -0
  103. package/src/middle_layer/tree_snapshot_scenarios.test.ts +337 -0
  104. package/src/middle_layer/tree_snapshot_store.test.ts +331 -0
  105. package/src/middle_layer/tree_snapshot_store.ts +419 -0
  106. package/src/mutator/project.ts +27 -5
@@ -1,6 +1,5 @@
1
1
  import { Branded, ProjectId } from "@milaboratories/pl-model-common";
2
2
  import { ResourceType, Role } from "@milaboratories/pl-client";
3
-
4
3
  //#region src/model/sharing_model.d.ts
5
4
  /**
6
5
  * Logical identity of a share, stable across replaces. A donor-generated UUID string,
@@ -9,33 +8,33 @@ import { ResourceType, Role } from "@milaboratories/pl-client";
9
8
  * {@link EnvelopeData} or by parsing a `decision/{shareId}` field name) and threads it
10
9
  * through unchanged.
11
10
  */
12
- type ShareId = Branded<string, "ShareId">;
11
+ export type ShareId = Branded<string, "ShareId">;
13
12
  /** Mints a fresh {@link ShareId}. The single place a share's logical identity is created. */
14
- declare function newShareId(): ShareId;
13
+ export declare function newShareId(): ShareId;
15
14
  /** Brands a string already known to be a share id (e.g. parsed from a `decision/{shareId}`
16
15
  * field name) as a {@link ShareId}, without minting a new one. */
17
- declare function asShareId(id: string): ShareId;
16
+ export declare function asShareId(id: string): ShareId;
18
17
  /** Field on the donor's clientRoot holding the {@link SharingOutboxResourceType} resource. */
19
- declare const SharingOutboxField = "sharingOutbox";
18
+ export declare const SharingOutboxField = "sharingOutbox";
20
19
  /** Field on the acceptor's clientRoot holding the {@link SharingStateResourceType} resource. */
21
- declare const SharingStateField = "sharingState";
22
- declare const SharingOutboxResourceType: ResourceType;
23
- declare const SharedEnvelopeResourceType: ResourceType;
24
- declare const SharingStateResourceType: ResourceType;
25
- type EnvelopeMode = "copy" | "read-only" | "collaboration";
20
+ export declare const SharingStateField = "sharingState";
21
+ export declare const SharingOutboxResourceType: ResourceType;
22
+ export declare const SharedEnvelopeResourceType: ResourceType;
23
+ export declare const SharingStateResourceType: ResourceType;
24
+ export type EnvelopeMode = "copy" | "read-only" | "collaboration";
26
25
  /** Per-project decision on change, matching the UI labels: re-snapshot the live source ("update"),
27
26
  * carry the existing snapshot ("keep"), or drop the project from the pack ("remove"). */
28
- type ProjectChangeAction = "keep" | "update" | "remove";
27
+ export type ProjectChangeAction = "keep" | "update" | "remove";
29
28
  /** Key of the per-project envelope maps: a uuid minted per snapshot to name the `project/{uuid}`
30
29
  * field. Distinct from {@link ProjectId} — re-snapshotting one source yields a new uuid each time. */
31
- type ProjectFieldUuid = Branded<string, "ProjectFieldUuid">;
30
+ export type ProjectFieldUuid = Branded<string, "ProjectFieldUuid">;
32
31
  /**
33
32
  * Whether a role may make a resource public (grant to everyone): true for controller,
34
33
  * admin; false for workflow and unspecified. The middle layer carries no policy
35
34
  * of its own here — a crafted call still hits the backend's role + permission-ceiling gate.
36
35
  * `null` (no-auth mode) returns false.
37
36
  */
38
- declare function canGrantToEveryone(role: Role | null): boolean;
37
+ export declare function canGrantToEveryone(role: Role | null): boolean;
39
38
  /**
40
39
  * Whether a role may impersonate another user: open/create another user's root and list
41
40
  * the resources that user can access. Mirrors the backend's authorization rule
@@ -45,15 +44,15 @@ declare function canGrantToEveryone(role: Role | null): boolean;
45
44
  * may share their own projects, but must never be offered impersonation). `null` (no-auth
46
45
  * mode) returns false.
47
46
  */
48
- declare function canImpersonate(role: Role | null): boolean;
47
+ export declare function canImpersonate(role: Role | null): boolean;
49
48
  /** One project's snapshot inside an envelope, keyed by {@link ProjectFieldUuid} in {@link EnvelopeData.projects}. */
50
- interface EnvelopeProject {
49
+ export interface EnvelopeProject {
51
50
  label: string;
52
51
  source: ProjectId;
53
52
  updatedAt: number;
54
53
  }
55
54
  /** Immutable `data` on a SharedEnvelope, set at createEphemeral, never mutated. */
56
- interface EnvelopeData {
55
+ export interface EnvelopeData {
57
56
  schemaVersion: 1;
58
57
  shareId: ShareId;
59
58
  sharedAt: number;
@@ -64,8 +63,8 @@ interface EnvelopeData {
64
63
  projects: Record<ProjectFieldUuid, EnvelopeProject>;
65
64
  }
66
65
  /** Dynamic field on SharingState, one per handled share, keyed by shareId. */
67
- declare const decisionField: (shareId: ShareId) => string;
68
- interface SharingDecision {
66
+ export declare const decisionField: (shareId: ShareId) => string;
67
+ export interface SharingDecision {
69
68
  decision: "accepted" | "rejected";
70
69
  timestamp: number;
71
70
  envelopeSharedAt: number;
@@ -78,11 +77,11 @@ interface SharingDecision {
78
77
  * who responded and when. Informational, not authoritative (a writable grant holder
79
78
  * could write under another login — same trust assumption as the sender field).
80
79
  * Copied forward when a share is changed. */
81
- declare const AcceptanceFieldPrefix = "acceptance/";
82
- declare const acceptanceField: (login: string) => string;
83
- declare const isAcceptanceField: (name: string) => boolean;
84
- declare const acceptanceFieldLogin: (name: string) => string;
85
- interface EnvelopeAcceptance {
80
+ export declare const AcceptanceFieldPrefix = "acceptance/";
81
+ export declare const acceptanceField: (login: string) => string;
82
+ export declare const isAcceptanceField: (name: string) => boolean;
83
+ export declare const acceptanceFieldLogin: (name: string) => string;
84
+ export interface EnvelopeAcceptance {
86
85
  action: "accepted" | "rejected";
87
86
  timestamp: number;
88
87
  }
@@ -92,7 +91,7 @@ interface EnvelopeAcceptance {
92
91
  * `data` byte buffer (the basic-resource read path) goes through here. The reactive tree-node
93
92
  * path uses `node.getDataAsJson<EnvelopeData>()`, which decodes the same JSON.
94
93
  */
95
- declare function decodeEnvelopeData(data: Uint8Array): EnvelopeData;
94
+ export declare function decodeEnvelopeData(data: Uint8Array): EnvelopeData;
96
95
  /**
97
96
  * Options for {@link MiddleLayer.shareProjects}.
98
97
  *
@@ -101,7 +100,7 @@ declare function decodeEnvelopeData(data: Uint8Array): EnvelopeData;
101
100
  * `expiresAt` is set to `null`, so it never expires); the recipients variant grants each
102
101
  * named recipient and the envelope expires after the default TTL.
103
102
  */
104
- type ShareProjectsOptions = {
103
+ export type ShareProjectsOptions = {
105
104
  recipients: string[];
106
105
  title: string;
107
106
  mode: EnvelopeMode;
@@ -118,5 +117,4 @@ type ShareProjectsOptions = {
118
117
  mode: EnvelopeMode;
119
118
  };
120
119
  //#endregion
121
- export { AcceptanceFieldPrefix, EnvelopeAcceptance, EnvelopeData, EnvelopeMode, EnvelopeProject, ProjectChangeAction, ProjectFieldUuid, ShareId, ShareProjectsOptions, SharedEnvelopeResourceType, SharingDecision, SharingOutboxField, SharingOutboxResourceType, SharingStateField, SharingStateResourceType, acceptanceField, acceptanceFieldLogin, asShareId, canGrantToEveryone, canImpersonate, decisionField, decodeEnvelopeData, isAcceptanceField, newShareId };
122
120
  //# sourceMappingURL=sharing_model.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sharing_model.d.ts","names":[],"sources":["../../src/model/sharing_model.ts"],"mappings":";;;;;;AAYA;;;;AAA6B;KAAjB,OAAA,GAAU,OAAO;;iBAGb,UAAA,IAAc,OAAO;;AAAA;iBAMrB,SAAA,CAAU,EAAA,WAAa,OAAO;;cAYjC,kBAAA;;cAEA,iBAAA;AAAA,cAEA,yBAAA,EAA2B,YAAsD;AAAA,cACjF,0BAAA,EAA4B,YAAuD;AAAA,cACnF,wBAAA,EAA0B,YAAqD;AAAA,KAEhF,YAAA;AARmB;AAE/B;AAF+B,KAYnB,mBAAA;;;KAIA,gBAAA,GAAmB,OAAO;AAZtC;;;;AAA8F;AAC9F;AADA,iBAoBgB,kBAAA,CAAmB,IAAiB,EAAX,IAAI;;;AAnBmD;AAChG;;;;AAA4F;AAE5F;iBAmCgB,cAAA,CAAe,IAAiB,EAAX,IAAI;;UAWxB,eAAA;EACf,KAAA;EACA,MAAA,EAAQ,SAAS;EACjB,SAAA;AAAA;;UAIe,YAAA;EACf,aAAA;EACA,OAAA,EAAS,OAAA;EACT,QAAA;EACA,SAAA;EACA,IAAA,EAAM,YAAA;EACN,MAAA;EACA,KAAA;EACA,QAAA,EAAU,MAAA,CAAO,gBAAA,EAAkB,eAAA;AAAA;AA7Ce;AAAA,cAiDvC,aAAA,GAAiB,OAAgB,EAAP,OAAO;AAAA,UAE7B,eAAA;EACf,QAAA;EACA,SAAA;EACA,gBAAA;EACA,gBAAA;AAAA;;;;;;;;cAUW,qBAAA;AAAA,cACA,eAAA,GAAmB,KAAa;AAAA,cAChC,iBAAA,GAAqB,IAAY;AAAA,cACjC,oBAAA,GAAwB,IAAY;AAAA,UAEhC,kBAAA;EACf,MAAA;EACA,SAAS;AAAA;;;;;;;iBASK,kBAAA,CAAmB,IAAA,EAAM,UAAA,GAAa,YAAY;;;;;;;;;KAYtD,oBAAA;EAEN,UAAA;EACA,KAAA;EACA,IAAA,EAAM,YAAA;AAAA;EAGN,QAAA;EAnDiC;AAAO;AAE9C;;;;EAwDM,OAAA;EACA,KAAA;EACA,IAAA,EAAM,YAAY;AAAA"}
1
+ {"version":3,"file":"sharing_model.d.ts","names":[],"sources":["../../src/model/sharing_model.ts"],"mappings":";;;;;;;;;;YAYY,UAAU;;wBAGN,cAAc;;;wBAMd,UAAU,aAAa;;qBAY1B;;qBAEA;qBAEA,2BAA2B;qBAC3B,4BAA4B;qBAC5B,0BAA0B;YAE3B;;;YAIA;;;YAIA,mBAAmB;;;;;;;wBAQf,mBAAmB,MAAM;;;;;;;;;;wBAmBzB,eAAe,MAAM;;iBAWpB;EACf;EACA,QAAQ;EACR;;;iBAIe;EACf;EACA,SAAS;EACT;EACA;EACA,MAAM;EACN;EACA;EACA,UAAU,OAAO,kBAAkB;;;qBAIxB,gBAAa,SAAa;iBAEtB;EACf;EACA;EACA;EACA;;;;;;;;;qBAUW;qBACA,kBAAe;qBACf,oBAAiB;qBACjB,uBAAoB;iBAEhB;EACf;EACA;;;;;;;;wBASc,mBAAmB,MAAM,aAAa;;;;;;;;;YAY1C;EAEN;EACA;EACA,MAAM;;EAGN;;;;;;;EAOA;EACA;EACA,MAAM"}
@@ -1,5 +1,4 @@
1
1
  import { BlockKindReference, BlockKindSelectorReference } from "@milaboratories/pl-model-common";
2
-
3
2
  //#region src/model/template_apply.d.ts
4
3
  /**
5
4
  * One entry the file describes in a way this project cannot honour.
@@ -10,7 +9,7 @@ import { BlockKindReference, BlockKindSelectorReference } from "@milaboratories/
10
9
  * it into a {@link TemplateApplyProblem}; anything else reaching that caller is an outage
11
10
  * rather than a statement about the file, and keeps propagating.
12
11
  */
13
- declare class TemplateEntryRejected extends Error {
12
+ export declare class TemplateEntryRejected extends Error {
14
13
  readonly entryId: string;
15
14
  constructor(entryId: string, message: string);
16
15
  }
@@ -22,13 +21,16 @@ declare class TemplateEntryRejected extends Error {
22
21
  * their file each problem belongs to. `error` is a finished sentence for the person
23
22
  * who applied the file, not a code.
24
23
  */
25
- type TemplateApplyProblem = {
26
- /** The template-local id of the entry the problem belongs to. */readonly entryId: string;
24
+ export type TemplateApplyProblem = {
25
+ /** The template-local id of the entry the problem belongs to. */
26
+ readonly entryId: string;
27
27
  readonly error: string;
28
28
  };
29
29
  /** One entry that made it into the project. */
30
- type AppliedEntry = {
31
- /** The entry's id in the file. */readonly templateLocalId: string; /** The project-local id the block was given. */
30
+ export type AppliedEntry = {
31
+ /** The entry's id in the file. */
32
+ readonly templateLocalId: string;
33
+ /** The project-local id the block was given. */
32
34
  readonly blockId: string;
33
35
  };
34
36
  /**
@@ -41,10 +43,9 @@ type AppliedEntry = {
41
43
  * A stage that checks reports every problem it found, so a file with three mistakes takes one
42
44
  * pass to fix. Placement stops at the first one — hence at most one problem from there.
43
45
  */
44
- type TemplateApplyReport = {
46
+ export type TemplateApplyReport = {
45
47
  readonly added: readonly AppliedEntry[];
46
48
  readonly problems: readonly TemplateApplyProblem[];
47
49
  };
48
50
  //#endregion
49
- export { AppliedEntry, TemplateApplyProblem, TemplateApplyReport, TemplateEntryRejected };
50
51
  //# sourceMappingURL=template_apply.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"template_apply.d.ts","names":[],"sources":["../../src/model/template_apply.ts"],"mappings":";;;;;AAkBA;;;;;;;cAAa,qBAAA,SAA8B,KAAK;EAAA,SAEnC,OAAA;cAAA,OAAA,UACT,OAAA;AAAA;AAeJ;;;;AAGgB;AAIhB;;;AAPA,KAAY,oBAAA;EAWM,0EATP,OAAA;EAAA,SACA,KAAK;AAAA;;KAIJ,YAAA;EAkBe,2CAhBhB,eAAA,UAiBmB;EAAA,SAfnB,OAAO;AAAA;;;;;;;;;;;KAaN,mBAAA;EAAA,SACD,KAAA,WAAgB,YAAA;EAAA,SAChB,QAAA,WAAmB,oBAAoB;AAAA"}
1
+ {"version":3,"file":"template_apply.d.ts","names":[],"sources":["../../src/model/template_apply.ts"],"mappings":";;;;;;;;;;;qBAkBa,8BAA8B;WAE9B;EADX,YACW,iBACT;;;;;;;;;;YAeQ;;WAED;WACA;;;YAIC;;WAED;;WAEA;;;;;;;;;;;;YAaC;WACD,gBAAgB;WAChB,mBAAmB"}
@@ -1,9 +1,9 @@
1
+ import "./project_model.js";
1
2
  //#region src/model/template_export.d.ts
2
3
  /** Why one block could not be exported. */
3
- type TemplateExportProblem = {
4
+ export type TemplateExportProblem = {
4
5
  readonly blockId: string;
5
6
  readonly error: string;
6
7
  };
7
8
  //#endregion
8
- export { TemplateExportProblem };
9
9
  //# sourceMappingURL=template_export.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"template_export.d.ts","names":[],"sources":["../../src/model/template_export.ts"],"mappings":";;KAiCY,qBAAA;EAAA,SACD,OAAA;EAAA,SACA,KAAK;AAAA"}
1
+ {"version":3,"file":"template_export.d.ts","names":[],"sources":["../../src/model/template_export.ts"],"mappings":";;;YAiCY;WACD;WACA"}
@@ -1,5 +1,4 @@
1
1
  import { ProjectTemplateV1 } from "@milaboratories/pl-model-common";
2
-
3
2
  //#region src/model/template_parser.d.ts
4
3
  /**
5
4
  * A template file read, or why it could not be.
@@ -10,7 +9,7 @@ import { ProjectTemplateV1 } from "@milaboratories/pl-model-common";
10
9
  * after this one. The message may span several lines when the file has several
11
10
  * fixable issues, so that fixing it takes one pass.
12
11
  */
13
- type TemplateParseOutcome = {
12
+ export type TemplateParseOutcome = {
14
13
  readonly ok: true;
15
14
  readonly document: ProjectTemplateV1;
16
15
  } | {
@@ -37,7 +36,6 @@ type TemplateParseOutcome = {
37
36
  * Nothing here checks that references point anywhere or that a kind can be resolved —
38
37
  * those are later stages, and both need more than the file to answer.
39
38
  */
40
- declare function parseProjectTemplateV1Yaml(text: string): TemplateParseOutcome;
39
+ export declare function parseProjectTemplateV1Yaml(text: string): TemplateParseOutcome;
41
40
  //#endregion
42
- export { TemplateParseOutcome, parseProjectTemplateV1Yaml };
43
41
  //# sourceMappingURL=template_parser.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"template_parser.d.ts","names":[],"sources":["../../src/model/template_parser.ts"],"mappings":";;;;;AAiBA;;;;;;;KAAY,oBAAA;EAAA,SACG,EAAA;EAAA,SAAmB,QAAA,EAAU,iBAAiB;AAAA;EAAA,SAC9C,EAAA;EAAA,SAAoB,KAAA;AAAA;;AAsB2C;;;;;;;;;;;;;;;;;;;iBAA9D,0BAAA,CAA2B,IAAA,WAAe,oBAAoB"}
1
+ {"version":3,"file":"template_parser.d.ts","names":[],"sources":["../../src/model/template_parser.ts"],"mappings":";;;;;;;;;;;YAiBY;WACG;WAAmB,UAAU;;WAC7B;WAAoB;;;;;;;;;;;;;;;;;;;;;;wBAsBnB,2BAA2B,eAAe"}
@@ -1,7 +1,6 @@
1
1
  import { TemplateApplyProblem } from "./template_apply.js";
2
2
  import { BlockPackId, BlockPackSpec } from "@milaboratories/pl-model-middle-layer";
3
3
  import { BlockKindSelectorReference, BlockPackLocationReference, ProjectTemplateV1 } from "@milaboratories/pl-model-common";
4
-
5
4
  //#region src/model/template_resolve.d.ts
6
5
  /**
7
6
  * Where a template entry's block comes from.
@@ -24,7 +23,7 @@ import { BlockKindSelectorReference, BlockPackLocationReference, ProjectTemplate
24
23
  * for it at all, and the fallbacks it could invent are all wrong. See
25
24
  * {@link ResolvedEntry}'s `title`.
26
25
  */
27
- type BlockPackProvider = {
26
+ export type BlockPackProvider = {
28
27
  /**
29
28
  * Find the block implementing a kind selector.
30
29
  *
@@ -72,7 +71,7 @@ type BlockPackProvider = {
72
71
  * apply did not allow unstable ones. This is the only reason the user can act on
73
72
  * without editing anything.
74
73
  */
75
- type KindResolution = {
74
+ export type KindResolution = {
76
75
  readonly ok: true;
77
76
  readonly spec: BlockPackSpec;
78
77
  readonly title: string;
@@ -81,7 +80,7 @@ type KindResolution = {
81
80
  readonly reason: "no-matching-kind-version" | "no-implementation" | "no-stable-implementation";
82
81
  };
83
82
  /** The outcome of locating one exact block version. */
84
- type ExactResolution = {
83
+ export type ExactResolution = {
85
84
  readonly ok: true;
86
85
  readonly spec: BlockPackSpec;
87
86
  readonly title: string;
@@ -102,7 +101,7 @@ type ExactResolution = {
102
101
  * - `not-a-block` — something is there, but it is not a block. Usually a path pointing
103
102
  * one directory off, which is why the message has to say what was looked for.
104
103
  */
105
- type LocationResolution = {
104
+ export type LocationResolution = {
106
105
  readonly ok: true;
107
106
  readonly spec: BlockPackSpec;
108
107
  readonly title: string;
@@ -111,8 +110,9 @@ type LocationResolution = {
111
110
  readonly reason: "unsupported-scheme" | "not-found" | "not-a-block";
112
111
  };
113
112
  /** Where one entry's block will come from. */
114
- type ResolvedEntry = {
115
- /** The entry's template-local id. */readonly entryId: string;
113
+ export type ResolvedEntry = {
114
+ /** The entry's template-local id. */
115
+ readonly entryId: string;
116
116
  readonly spec: BlockPackSpec;
117
117
  /**
118
118
  * The block package's own title, as its author published it — `meta.title` for a
@@ -147,7 +147,7 @@ type ResolvedEntry = {
147
147
  * resolution: the point of resolving before construction is that nothing is created
148
148
  * until every entry has an implementation.
149
149
  */
150
- type TemplateResolveOutcome = {
150
+ export type TemplateResolveOutcome = {
151
151
  readonly resolved: readonly ResolvedEntry[];
152
152
  readonly problems: readonly TemplateApplyProblem[];
153
153
  };
@@ -167,7 +167,7 @@ type TemplateResolveOutcome = {
167
167
  * @param provider Where blocks come from
168
168
  * @param options `allowUnstable` applies to the whole document, not per entry
169
169
  */
170
- declare function resolveTemplateEntries(document: ProjectTemplateV1, provider: BlockPackProvider, options: {
170
+ export declare function resolveTemplateEntries(document: ProjectTemplateV1, provider: BlockPackProvider, options: {
171
171
  allowUnstable: boolean;
172
172
  }): Promise<TemplateResolveOutcome>;
173
173
  /**
@@ -184,10 +184,9 @@ declare function resolveTemplateEntries(document: ProjectTemplateV1, provider: B
184
184
  *
185
185
  * @throws if the name has no npm scope or no organization segment
186
186
  */
187
- declare function parseBlockPackName(npmName: string): {
187
+ export declare function parseBlockPackName(npmName: string): {
188
188
  organization: string;
189
189
  name: string;
190
190
  };
191
191
  //#endregion
192
- export { BlockPackProvider, ExactResolution, KindResolution, LocationResolution, ResolvedEntry, TemplateResolveOutcome, parseBlockPackName, resolveTemplateEntries };
193
192
  //# sourceMappingURL=template_resolve.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"template_resolve.d.ts","names":[],"sources":["../../src/model/template_resolve.ts"],"mappings":";;;;;;;AAkCA;;;;;;;;;;;;;;;;;;;KAAY,iBAAA;EAWG;;;;;;;EAHb,MAAA,GACE,IAAA,EAAM,0BAAA,EACN,OAAA;IAAW,aAAA;EAAA,MACR,OAAA,CAAQ,cAAA;EAwBiD;;AAAkB;AAiBlF;;;;EAhCE,cAAA,GAAiB,EAAA,EAAI,WAAA,KAAgB,OAAA,CAAQ,eAAA;EAiCb;;;;;;AAGb;AAOrB;;;;;;EA5BE,UAAA,GAAa,QAAA,EAAU,0BAAA,KAA+B,OAAA,CAAQ,kBAAA;AAAA;;;;AA8BvB;AAezC;;;;;;;;;;KA5BY,cAAA;EAAA,SACG,EAAA;EAAA,SAAmB,IAAA,EAAM,aAAa;EAAA,SAAW,KAAA;AAAA;EAAA,SAEjD,EAAA;EAAA,SACA,MAAA;AAAA;;KAOH,eAAA;EAAA,SACG,EAAA;EAAA,SAAmB,IAAA,EAAM,aAAa;EAAA,SAAW,KAAA;AAAA;EAAA,SACjD,EAAA;EAAA,SAAoB,MAAA;AAAA;;;;;;AAmEe;AAmBlD;;;;;;;KAvEY,kBAAA;EAAA,SAEG,EAAA;EAAA,SACA,IAAA,EAAM,aAAa;EAAA,SACnB,KAAA;AAAA;EAAA,SAGA,EAAA;EAAA,SACA,MAAA;AAAA;;KAIH,aAAA;EA+DqB,8CA7DtB,OAAA;EAAA,SACA,IAAA,EAAM,aAAa;EAqMI;;;;;;;AAA+C;;;;;;;;EAA/C,SArLvB,KAAA;;;;;;;;WAQA,MAAA;AAAA;;;;;;;;;KAWC,sBAAA;EAAA,SACD,QAAA,WAAmB,aAAA;EAAA,SACnB,QAAA,WAAmB,oBAAoB;AAAA;;;;;;;;;;;;;;;;;iBAmB5B,sBAAA,CACpB,QAAA,EAAU,iBAAA,EACV,QAAA,EAAU,iBAAA,EACV,OAAA;EAAW,aAAA;AAAA,IACV,OAAA,CAAQ,sBAAA;;;;;;;;;;;;;;;iBAyIK,kBAAA,CAAmB,OAAA;EAAoB,YAAA;EAAsB,IAAA;AAAA"}
1
+ {"version":3,"file":"template_resolve.d.ts","names":[],"sources":["../../src/model/template_resolve.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;YAkCY;;;;;;;;EAQV,SACE,MAAM,4BACN;IAAW;QACR,QAAQ;;;;;;;;EASb,iBAAiB,IAAI,gBAAgB,QAAQ;;;;;;;;;;;;;;EAe7C,aAAa,UAAU,+BAA+B,QAAQ;;;;;;;;;;;;;;;;YAiBpD;WACG;WAAmB,MAAM;WAAwB;;WAEjD;WACA;;;YAOH;WACG;WAAmB,MAAM;WAAwB;;WACjD;WAAoB;;;;;;;;;;;;;;;YAevB;WAEG;WACA,MAAM;WACN;;WAGA;WACA;;;YAIH;;WAED;WACA,MAAM;;;;;;;;;;;;;;;;WAgBN;;;;;;;;WAQA;;;;;;;;;;YAWC;WACD,mBAAmB;WACnB,mBAAmB;;;;;;;;;;;;;;;;;;wBAmBR,uBACpB,UAAU,mBACV,UAAU,mBACV;EAAW;IACV,QAAQ;;;;;;;;;;;;;;;wBAyIK,mBAAmB;EAAoB;EAAsB"}
@@ -1,17 +1,18 @@
1
+ import "./project_model.js";
1
2
  import { TemplateExportProblem } from "./template_export.js";
2
3
  import { BlockPackSpec } from "@milaboratories/pl-model-middle-layer";
3
4
  import { BlockKindReference, BlockPackLocationReference, ProjectTemplateV1 } from "@milaboratories/pl-model-common";
4
-
5
5
  //#region src/model/template_serializer.d.ts
6
6
  /** What the caller gets back for a whole project. */
7
- type ProjectTemplateExportOutcome = {
7
+ export type ProjectTemplateExportOutcome = {
8
8
  readonly ok: true;
9
- readonly yaml: string; /** The document the YAML was rendered from, already validated. */
9
+ readonly yaml: string;
10
+ /** The document the YAML was rendered from, already validated. */
10
11
  readonly document: ProjectTemplateV1;
11
12
  } | {
12
- readonly ok: false; /** Every block that stands in the way, not just the first. */
13
+ readonly ok: false;
14
+ /** Every block that stands in the way, not just the first. */
13
15
  readonly problems: readonly TemplateExportProblem[];
14
16
  };
15
17
  //#endregion
16
- export { ProjectTemplateExportOutcome };
17
18
  //# sourceMappingURL=template_serializer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"template_serializer.d.ts","names":[],"sources":["../../src/model/template_serializer.ts"],"mappings":";;;;;;KAoCY,4BAAA;EAAA,SAEG,EAAA;EAAA,SACA,IAAA,UAOwC;EAAA,SALxC,QAAA,EAAU,iBAAA;AAAA;EAAA,SAGV,EAAA;WAEA,QAAA,WAAmB,qBAAqB;AAAA"}
1
+ {"version":3,"file":"template_serializer.d.ts","names":[],"sources":["../../src/model/template_serializer.ts"],"mappings":";;;;;;YAoCY;WAEG;WACA;;WAEA,UAAU;;WAGV;;WAEA,mBAAmB"}
@@ -1,30 +1,28 @@
1
1
  import { SignedResourceId } from "@milaboratories/pl-client";
2
2
  import { CompiledTemplateV3, TemplateData } from "@milaboratories/pl-model-backend";
3
-
4
3
  //#region src/model/template_spec.d.ts
5
- interface TemplateFromRegistry {
4
+ export interface TemplateFromRegistry {
6
5
  readonly type: "from-registry";
7
6
  registry: string;
8
7
  path: string;
9
8
  }
10
- interface ExplicitTemplate {
9
+ export interface ExplicitTemplate {
11
10
  readonly type: "explicit";
12
11
  content: Uint8Array;
13
12
  }
14
- interface PreparedTemplate {
13
+ export interface PreparedTemplate {
15
14
  readonly type: "prepared";
16
15
  data: TemplateData | CompiledTemplateV3;
17
16
  }
18
- interface CachedTemplate {
17
+ export interface CachedTemplate {
19
18
  readonly type: "cached";
20
19
  readonly resourceId: SignedResourceId;
21
20
  }
22
- interface TemplateFromFile {
21
+ export interface TemplateFromFile {
23
22
  readonly type: "from-file";
24
23
  path: string;
25
24
  }
26
- type TemplateSpecPrepared = TemplateFromRegistry | ExplicitTemplate | PreparedTemplate | CachedTemplate;
27
- type TemplateSpecAny = TemplateSpecPrepared | TemplateFromFile;
25
+ export type TemplateSpecPrepared = TemplateFromRegistry | ExplicitTemplate | PreparedTemplate | CachedTemplate;
26
+ export type TemplateSpecAny = TemplateSpecPrepared | TemplateFromFile;
28
27
  //#endregion
29
- export { CachedTemplate, ExplicitTemplate, PreparedTemplate, TemplateFromFile, TemplateFromRegistry, TemplateSpecAny, TemplateSpecPrepared };
30
28
  //# sourceMappingURL=template_spec.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"template_spec.d.ts","names":[],"sources":["../../src/model/template_spec.ts"],"mappings":";;;;UAGiB,oBAAA;EAAA,SACN,IAAA;EACT,QAAA;EACA,IAAA;AAAA;AAAA,UAGe,gBAAA;EAAA,SACN,IAAA;EACT,OAAA,EAAS,UAAU;AAAA;AAAA,UAGJ,gBAAA;EAAA,SACN,IAAA;EACT,IAAA,EAAM,YAAA,GAAe,kBAAkB;AAAA;AAAA,UAGxB,cAAA;EAAA,SACN,IAAA;EAAA,SACA,UAAA,EAAY,gBAAgB;AAAA;AAAA,UAGtB,gBAAA;EAAA,SACN,IAAA;EACT,IAAI;AAAA;AAAA,KAGM,oBAAA,GACR,oBAAA,GACA,gBAAA,GACA,gBAAA,GACA,cAAA;AAAA,KACQ,eAAA,GAAkB,oBAAA,GAAuB,gBAAgB"}
1
+ {"version":3,"file":"template_spec.d.ts","names":[],"sources":["../../src/model/template_spec.ts"],"mappings":";;;iBAGiB;WACN;EACT;EACA;;iBAGe;WACN;EACT,SAAS;;iBAGM;WACN;EACT,MAAM,eAAe;;iBAGN;WACN;WACA,YAAY;;iBAGN;WACN;EACT;;YAGU,uBACR,uBACA,mBACA,mBACA;YACQ,kBAAkB,uBAAuB"}
@@ -1,12 +1,12 @@
1
1
  import { V2RegistryProvider } from "../../block_registry/registry-v2-provider.js";
2
2
  import { BlockPackSpecAny, BlockPackSpecPrepared } from "../../model/block_pack_spec.js";
3
+ import "../../model/index.js";
3
4
  import { BlockConfigContainer } from "@platforma-sdk/model";
4
5
  import { Dispatcher } from "undici";
5
6
  import { Signer } from "@milaboratories/ts-helpers";
6
7
  import { AnyResourceRef, PlTransaction, ResourceType } from "@milaboratories/pl-client";
7
-
8
8
  //#region src/mutator/block-pack/block_pack.d.ts
9
- declare class BlockPackPreparer {
9
+ export declare class BlockPackPreparer {
10
10
  private readonly v2RegistryProvider;
11
11
  private readonly signer;
12
12
  private readonly http?;
@@ -21,5 +21,4 @@ declare class BlockPackPreparer {
21
21
  private prepareWithoutUnpacking;
22
22
  }
23
23
  //#endregion
24
- export { BlockPackPreparer };
25
24
  //# sourceMappingURL=block_pack.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"block_pack.d.ts","names":[],"sources":["../../../src/mutator/block-pack/block_pack.ts"],"mappings":";;;;;;;;cA4Da,iBAAA;EAAA,iBAEQ,kBAAA;EAAA,iBACA,MAAA;EAAA,iBACA,IAAA;cAFA,kBAAA,EAAoB,kBAAA,EACpB,MAAA,EAAQ,MAAA,EACR,IAAA,GAAO,UAAA;EAAA,iBAGT,kBAAA;EAe0B;EAAA,iBAJ1B,aAAA;EAIJ,uBAAA,CAAwB,IAAA,EAAM,gBAAA,GAAmB,OAAA,CAAQ,oBAAA;EAgE3C;EAAA,QAXnB,OAAA;EAWK,OAAA,CAAQ,IAAA,EAAM,gBAAA,GAAmB,OAAA,CAAQ,qBAAA;EAAA,QAmCxC,uBAAA;AAAA"}
1
+ {"version":3,"file":"block_pack.d.ts","names":[],"sources":["../../../src/mutator/block-pack/block_pack.ts"],"mappings":";;;;;;;;qBA4Da;mBAEQ;mBACA;mBACA;EAHnB,YACmB,oBAAoB,oBACpB,QAAQ,QACR,OAAO;mBAGT;;mBAWA;EAIJ,wBAAwB,MAAM,mBAAmB,QAAQ;;UAqD9D;EAWK,QAAQ,MAAM,mBAAmB,QAAQ;UAmCxC"}
@@ -25,6 +25,10 @@ denque = require_runtime.__toESM(denque, 1);
25
25
  function isProductionFieldSettled(status) {
26
26
  return status === "Ready" || status === "Error";
27
27
  }
28
+ /** Either failure shape a production field can be in: no value resource, or an errored one. */
29
+ function hasError(state) {
30
+ return state?.fieldError === true || state?.status === "Error";
31
+ }
28
32
  function cached(modIdCb, valueCb) {
29
33
  let initialized = false;
30
34
  let lastModId = void 0;
@@ -119,8 +123,16 @@ var BlockInfo = class {
119
123
  get productionRendered() {
120
124
  return this.fields.prodCtx !== void 0;
121
125
  }
126
+ /**
127
+ * True if the rendered production failed, in either shape {@link hasError} covers.
128
+ *
129
+ * Must stay in step with the `outputError` the desktop derives in
130
+ * `middle_layer/project_overview.ts`, because that flag is what enables the Run button.
131
+ * Any failure counted there but not here leaves Run enabled yet inert: `renderProduction`
132
+ * finds nothing to re-render and commits an empty transaction.
133
+ */
122
134
  get productionHasErrors() {
123
- return this.fields.prodUiCtx?.status === "Error" || this.fields.prodOutput?.status === "Error" || this.fields.prodCtx?.status === "Error";
135
+ return hasError(this.fields.prodUiCtx) || hasError(this.fields.prodOutput) || hasError(this.fields.prodCtx);
124
136
  }
125
137
  productionStaleC = cached(() => `${this.fields.currentArgs.modCount}_${this.fields.prodArgs?.modCount}`, () => this.fields.prodArgs === void 0 || Buffer.compare(this.fields.currentArgs.value, this.fields.prodArgs.value) !== 0);
126
138
  get requireProductionRendering() {
@@ -974,9 +986,14 @@ var ProjectMutator = class ProjectMutator {
974
986
  };
975
987
  blockInfoStates.set(projectField.blockId, info);
976
988
  }
977
- info.fields[projectField.fieldName] = (0, _milaboratories_pl_client.isNullSignedResourceId)(f.value) ? { modCount: 0 } : {
989
+ const fieldError = (0, _milaboratories_pl_client.isNotNullSignedResourceId)(f.error);
990
+ info.fields[projectField.fieldName] = (0, _milaboratories_pl_client.isNullSignedResourceId)(f.value) ? {
991
+ modCount: 0,
992
+ fieldError
993
+ } : {
978
994
  modCount: 0,
979
- ref: f.value
995
+ ref: f.value,
996
+ fieldError
980
997
  };
981
998
  }
982
999
  const blockFieldRequests = [];