@milaboratories/pl-middle-layer 2.8.9 → 2.9.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.
@@ -2,10 +2,10 @@ import "../model/project_model.js";
2
2
  import "../model/template_serializer.js";
3
3
  import "../model/index.js";
4
4
  import { ProjectHelper } from "../model/project_helper.js";
5
- import { BlockConfig } from "@platforma-sdk/model";
5
+ import { BlockConfig, BlockKindReference } from "@platforma-sdk/model";
6
6
  import { AuthorMarker, BlockPackSpec, BlockSettings, ProjectMeta } from "@milaboratories/pl-model-middle-layer";
7
7
  import { MiLogger } from "@milaboratories/ts-helpers";
8
- import { ArgsIssue } from "@milaboratories/pl-model-common";
8
+ import { ArgsIssue, BlockId } from "@milaboratories/pl-model-common";
9
9
  import { AnyRef, AnyResourceRef, PlClient, PlTransaction, ResourceRef, SignedResourceId } from "@milaboratories/pl-client";
10
10
  /**
11
11
  * Duplicates an existing project resource within a transaction.
@@ -1 +1 @@
1
- {"version":3,"file":"project.d.ts","names":[],"sources":["../../src/mutator/project.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;wBAqrEsB,iBACpB,IAAI,eACJ,WAAW,kBACX;EAAY;;;;;;;;AAOZ,gBAAgB,gBACf,QAAQ"}
1
+ {"version":3,"file":"project.d.ts","names":[],"sources":["../../src/mutator/project.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;wBA2sEsB,iBACpB,IAAI,eACJ,WAAW,kBACX;EAAY;;;;;;;;AAOZ,gBAAgB,gBACf,QAAQ"}
@@ -286,6 +286,24 @@ var ProjectMutator = class ProjectMutator {
286
286
  exportAsTemplateV1() {
287
287
  return exportProjectAsTemplateV1(this.struct, (blockId) => this.deriveTemplateParams(blockId), (blockId) => this.blockInfos.get(blockId)?.kind, (blockId) => this.blockInfos.get(blockId)?.source);
288
288
  }
289
+ /**
290
+ * The block's initialization params as its own model projects them from the current storage,
291
+ * with the kind the block declares: what a template export writes for this block.
292
+ *
293
+ * Read-only, like {@link exportAsTemplateV1}.
294
+ *
295
+ * @returns `params` is undefined when the block has no storage yet
296
+ * @throws when the project has no such block, or the block's model fails to project its params
297
+ */
298
+ getBlockInitializationParams(blockId) {
299
+ const info = this.getBlockInfo(blockId);
300
+ const derived = this.deriveTemplateParams(blockId);
301
+ if (derived?.error !== void 0) throw new Error(`Block ${blockId} failed to derive its initialization params: ${derived.error}`);
302
+ return {
303
+ kind: info.kind,
304
+ params: derived?.value
305
+ };
306
+ }
289
307
  deriveTemplateParams(blockId) {
290
308
  const info = this.blockInfos.get(blockId);
291
309
  if (info === void 0) return void 0;