@milaboratories/milaboratories.pool-explorer.model 1.0.119 → 1.0.121

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.
@@ -1,6 +1,6 @@
1
1
   WARN  Issue while reading "/home/runner/_work/platforma/platforma/.npmrc". Failed to replace env in config: ${NPMJS_TOKEN}
2
2
 
3
- > @milaboratories/milaboratories.pool-explorer.model@1.0.119 build /home/runner/_work/platforma/platforma/etc/blocks/pool-explorer/model
3
+ > @milaboratories/milaboratories.pool-explorer.model@1.0.121 build /home/runner/_work/platforma/platforma/etc/blocks/pool-explorer/model
4
4
  > ts-builder build --target block-model && block-tools build-model
5
5
 
6
6
  Building block-model project...
@@ -12,5 +12,5 @@ Building block-model project...
12
12
  ./src/index.ts → dist...
13
13
  (!) Circular dependency
14
14
  ../../../../sdk/model/dist/components/PFrameForGraphs.js -> ../../../../sdk/model/dist/pframe_utils/columns.js -> ../../../../sdk/model/dist/components/PFrameForGraphs.js
15
- created dist in 2.4s
15
+ created dist in 4s
16
16
  Build completed successfully
@@ -1,5 +1,5 @@
1
1
   WARN  Issue while reading "/home/runner/_work/platforma/platforma/.npmrc". Failed to replace env in config: ${NPMJS_TOKEN}
2
2
 
3
- > @milaboratories/milaboratories.pool-explorer.model@1.0.119 lint /home/runner/_work/platforma/platforma/etc/blocks/pool-explorer/model
3
+ > @milaboratories/milaboratories.pool-explorer.model@1.0.121 lint /home/runner/_work/platforma/platforma/etc/blocks/pool-explorer/model
4
4
  > eslint .
5
5
 
@@ -1,6 +1,6 @@
1
1
   WARN  Issue while reading "/home/runner/_work/platforma/platforma/.npmrc". Failed to replace env in config: ${NPMJS_TOKEN}
2
2
 
3
- > @milaboratories/milaboratories.pool-explorer.model@1.0.119 type-check /home/runner/_work/platforma/platforma/etc/blocks/pool-explorer/model
3
+ > @milaboratories/milaboratories.pool-explorer.model@1.0.121 type-check /home/runner/_work/platforma/platforma/etc/blocks/pool-explorer/model
4
4
  > ts-builder types --target block-model
5
5
 
6
6
  ↳ tsc --noEmit --project ./tsconfig.json --customConditions ,
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @milaboratories/milaboratories.pool-explorer.model
2
2
 
3
+ ## 1.0.121
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [88f33fa]
8
+ - @platforma-sdk/model@1.49.0
9
+
10
+ ## 1.0.120
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [d6856e2]
15
+ - @platforma-sdk/model@1.48.14
16
+
3
17
  ## 1.0.119
4
18
 
5
19
  ### Patch Changes
package/dist/bundle.js CHANGED
@@ -7358,7 +7358,7 @@
7358
7358
  }
7359
7359
  }
7360
7360
 
7361
- var version = "1.48.13";
7361
+ var version = "1.49.0";
7362
7362
 
7363
7363
  const PlatformaSDKVersion = version;
7364
7364
 
@@ -7378,52 +7378,52 @@
7378
7378
  * to call {@link done()} at the end of configuration. Value returned by this builder must be
7379
7379
  * exported as constant with name "platforma" from the "config" module. */
7380
7380
  class BlockModel {
7381
- _renderingMode;
7382
- _initialArgs;
7383
- _initialUiState;
7384
- _outputs;
7385
- _inputsValid;
7386
- _sections;
7387
- _title;
7388
- _enrichmentTargets;
7389
- _featureFlags;
7390
- constructor(_renderingMode, _initialArgs, _initialUiState, _outputs, _inputsValid, _sections, _title, _enrichmentTargets, _featureFlags) {
7391
- this._renderingMode = _renderingMode;
7392
- this._initialArgs = _initialArgs;
7393
- this._initialUiState = _initialUiState;
7394
- this._outputs = _outputs;
7395
- this._inputsValid = _inputsValid;
7396
- this._sections = _sections;
7397
- this._title = _title;
7398
- this._enrichmentTargets = _enrichmentTargets;
7399
- this._featureFlags = _featureFlags;
7400
- }
7401
- static INITIAL_BLOCK_FEATURE_FLAGS = {
7402
- supportsLazyState: true,
7403
- requiresUIAPIVersion: 1,
7404
- requiresModelAPIVersion: 1,
7405
- };
7381
+ config;
7382
+ constructor(config) {
7383
+ this.config = config;
7384
+ }
7385
+ static get INITIAL_BLOCK_FEATURE_FLAGS() {
7386
+ return {
7387
+ supportsLazyState: true,
7388
+ requiresUIAPIVersion: 1,
7389
+ requiresModelAPIVersion: 1,
7390
+ };
7391
+ }
7406
7392
  static create(renderingMode = 'Heavy') {
7407
- return new BlockModel(renderingMode, undefined, {}, {}, getImmediate(true), getImmediate([]), undefined, undefined, { ...BlockModel.INITIAL_BLOCK_FEATURE_FLAGS });
7393
+ return new BlockModel({
7394
+ renderingMode,
7395
+ initialUiState: {},
7396
+ outputs: {},
7397
+ inputsValid: getImmediate(true),
7398
+ sections: getImmediate([]),
7399
+ featureFlags: BlockModel.INITIAL_BLOCK_FEATURE_FLAGS,
7400
+ });
7408
7401
  }
7409
7402
  output(key, cfgOrRf, flags = {}) {
7410
7403
  if (typeof cfgOrRf === 'function') {
7411
7404
  const handle = `output#${key}`;
7412
7405
  tryRegisterCallback(handle, () => cfgOrRf(new RenderCtx()));
7413
- return new BlockModel(this._renderingMode, this._initialArgs, this._initialUiState, {
7414
- ...this._outputs,
7415
- [key]: {
7416
- __renderLambda: true,
7417
- handle,
7418
- ...flags,
7406
+ return new BlockModel({
7407
+ ...this.config,
7408
+ outputs: {
7409
+ ...this.config.outputs,
7410
+ [key]: {
7411
+ __renderLambda: true,
7412
+ handle,
7413
+ ...flags,
7414
+ },
7419
7415
  },
7420
- }, this._inputsValid, this._sections, this._title, this._enrichmentTargets, this._featureFlags);
7416
+ });
7417
+ }
7418
+ else {
7419
+ return new BlockModel({
7420
+ ...this.config,
7421
+ outputs: {
7422
+ ...this.config.outputs,
7423
+ [key]: cfgOrRf,
7424
+ },
7425
+ });
7421
7426
  }
7422
- else
7423
- return new BlockModel(this._renderingMode, this._initialArgs, this._initialUiState, {
7424
- ...this._outputs,
7425
- [key]: cfgOrRf,
7426
- }, this._inputsValid, this._sections, this._title, this._enrichmentTargets, this._featureFlags);
7427
7427
  }
7428
7428
  /** Shortcut for {@link output} with retentive flag set to true. */
7429
7429
  retentiveOutput(key, rf) {
@@ -7432,13 +7432,20 @@
7432
7432
  argsValid(cfgOrRf) {
7433
7433
  if (typeof cfgOrRf === 'function') {
7434
7434
  tryRegisterCallback('inputsValid', () => cfgOrRf(new RenderCtx()));
7435
- return new BlockModel(this._renderingMode, this._initialArgs, this._initialUiState, this._outputs, {
7436
- __renderLambda: true,
7437
- handle: 'inputsValid',
7438
- }, this._sections, this._title, this._enrichmentTargets, this._featureFlags);
7435
+ return new BlockModel({
7436
+ ...this.config,
7437
+ inputsValid: {
7438
+ __renderLambda: true,
7439
+ handle: 'inputsValid',
7440
+ },
7441
+ });
7442
+ }
7443
+ else {
7444
+ return new BlockModel({
7445
+ ...this.config,
7446
+ inputsValid: cfgOrRf,
7447
+ });
7439
7448
  }
7440
- else
7441
- return new BlockModel(this._renderingMode, this._initialArgs, this._initialUiState, this._outputs, cfgOrRf, this._sections, this._title, this._enrichmentTargets, this._featureFlags);
7442
7449
  }
7443
7450
  sections(arrOrCfgOrRf) {
7444
7451
  if (Array.isArray(arrOrCfgOrRf)) {
@@ -7446,34 +7453,82 @@
7446
7453
  }
7447
7454
  else if (typeof arrOrCfgOrRf === 'function') {
7448
7455
  tryRegisterCallback('sections', () => arrOrCfgOrRf(new RenderCtx()));
7449
- return new BlockModel(this._renderingMode, this._initialArgs, this._initialUiState, this._outputs, this._inputsValid, { __renderLambda: true, handle: 'sections' }, this._title, this._enrichmentTargets, this._featureFlags);
7456
+ return new BlockModel({
7457
+ ...this.config,
7458
+ sections: {
7459
+ __renderLambda: true,
7460
+ handle: 'sections',
7461
+ },
7462
+ });
7463
+ }
7464
+ else {
7465
+ return new BlockModel({
7466
+ ...this.config,
7467
+ sections: arrOrCfgOrRf,
7468
+ });
7450
7469
  }
7451
- else
7452
- return new BlockModel(this._renderingMode, this._initialArgs, this._initialUiState, this._outputs, this._inputsValid, arrOrCfgOrRf, this._title, this._enrichmentTargets, this._featureFlags);
7453
7470
  }
7454
7471
  /** Sets a rendering function to derive block title, shown for the block in the left blocks-overview panel. */
7455
7472
  title(rf) {
7456
7473
  tryRegisterCallback('title', () => rf(new RenderCtx()));
7457
- return new BlockModel(this._renderingMode, this._initialArgs, this._initialUiState, this._outputs, this._inputsValid, this._sections, { __renderLambda: true, handle: 'title' }, this._enrichmentTargets, this._featureFlags);
7474
+ return new BlockModel({
7475
+ ...this.config,
7476
+ title: {
7477
+ __renderLambda: true,
7478
+ handle: 'title',
7479
+ },
7480
+ });
7481
+ }
7482
+ subtitle(rf) {
7483
+ tryRegisterCallback('subtitle', () => rf(new RenderCtx()));
7484
+ return new BlockModel({
7485
+ ...this.config,
7486
+ subtitle: {
7487
+ __renderLambda: true,
7488
+ handle: 'subtitle',
7489
+ },
7490
+ });
7491
+ }
7492
+ tags(rf) {
7493
+ tryRegisterCallback('tags', () => rf(new RenderCtx()));
7494
+ return new BlockModel({
7495
+ ...this.config,
7496
+ tags: {
7497
+ __renderLambda: true,
7498
+ handle: 'tags',
7499
+ },
7500
+ });
7458
7501
  }
7459
7502
  /**
7460
7503
  * Sets initial args for the block, this value must be specified.
7461
7504
  * @deprecated use {@link withArgs}
7462
7505
  * */
7463
7506
  initialArgs(value) {
7464
- return new BlockModel(this._renderingMode, value, this._initialUiState, this._outputs, this._inputsValid, this._sections, this._title, this._enrichmentTargets, this._featureFlags);
7507
+ return this.withArgs(value);
7465
7508
  }
7466
7509
  /** Sets initial args for the block, this value must be specified. */
7467
- withArgs(initialValue) {
7468
- return new BlockModel(this._renderingMode, initialValue, this._initialUiState, this._outputs, this._inputsValid, this._sections, this._title, this._enrichmentTargets, this._featureFlags);
7510
+ withArgs(initialArgs) {
7511
+ return new BlockModel({
7512
+ ...this.config,
7513
+ initialArgs,
7514
+ });
7469
7515
  }
7470
7516
  /** Defines type and sets initial value for block UiState. */
7471
- withUiState(initialValue) {
7472
- return new BlockModel(this._renderingMode, this._initialArgs, initialValue, this._outputs, this._inputsValid, this._sections, this._title, this._enrichmentTargets, this._featureFlags);
7517
+ withUiState(initialUiState) {
7518
+ return new BlockModel({
7519
+ ...this.config,
7520
+ initialUiState,
7521
+ });
7473
7522
  }
7474
7523
  /** Sets or overrides feature flags for the block. */
7475
7524
  withFeatureFlags(flags) {
7476
- return new BlockModel(this._renderingMode, this._initialArgs, this._initialUiState, this._outputs, this._inputsValid, this._sections, this._title, this._enrichmentTargets, { ...this._featureFlags, ...flags });
7525
+ return new BlockModel({
7526
+ ...this.config,
7527
+ featureFlags: {
7528
+ ...this.config.featureFlags,
7529
+ ...flags,
7530
+ },
7531
+ });
7477
7532
  }
7478
7533
  /**
7479
7534
  * Defines how to derive list of upstream references this block is meant to enrich with its exports from block args.
@@ -7481,43 +7536,50 @@
7481
7536
  */
7482
7537
  enriches(lambda) {
7483
7538
  tryRegisterCallback('enrichmentTargets', lambda);
7484
- return new BlockModel(this._renderingMode, this._initialArgs, this._initialUiState, this._outputs, this._inputsValid, this._sections, this._title, { __renderLambda: true, handle: 'enrichmentTargets' }, this._featureFlags);
7539
+ return new BlockModel({
7540
+ ...this.config,
7541
+ enrichmentTargets: {
7542
+ __renderLambda: true,
7543
+ handle: 'enrichmentTargets',
7544
+ },
7545
+ });
7485
7546
  }
7486
7547
  /** Renders all provided block settings into a pre-configured platforma API
7487
7548
  * instance, that can be used in frontend to interact with block state, and
7488
7549
  * other features provided by the platforma to the block. */
7489
- done(apiVersion) {
7490
- const requiresUIAPIVersion = apiVersion ?? 1;
7550
+ done(apiVersion = 1) {
7491
7551
  return this.withFeatureFlags({
7492
- ...this._featureFlags,
7493
- requiresUIAPIVersion,
7494
- })._done(requiresUIAPIVersion);
7552
+ ...this.config.featureFlags,
7553
+ requiresUIAPIVersion: apiVersion,
7554
+ }).#done();
7495
7555
  }
7496
- _done(apiVersion) {
7497
- if (this._initialArgs === undefined)
7556
+ #done() {
7557
+ if (this.config.initialArgs === undefined)
7498
7558
  throw new Error('Initial arguments not set.');
7499
7559
  const config = {
7500
7560
  v3: {
7501
7561
  sdkVersion: PlatformaSDKVersion,
7502
- renderingMode: this._renderingMode,
7503
- initialArgs: this._initialArgs,
7504
- initialUiState: this._initialUiState,
7505
- inputsValid: this._inputsValid,
7506
- sections: this._sections,
7507
- title: this._title,
7508
- outputs: this._outputs,
7509
- enrichmentTargets: this._enrichmentTargets,
7510
- featureFlags: this._featureFlags,
7562
+ renderingMode: this.config.renderingMode,
7563
+ initialArgs: this.config.initialArgs,
7564
+ initialUiState: this.config.initialUiState,
7565
+ inputsValid: this.config.inputsValid,
7566
+ sections: this.config.sections,
7567
+ title: this.config.title,
7568
+ subtitle: this.config.subtitle,
7569
+ tags: this.config.tags,
7570
+ outputs: this.config.outputs,
7571
+ enrichmentTargets: this.config.enrichmentTargets,
7572
+ featureFlags: this.config.featureFlags,
7511
7573
  },
7512
7574
  // fields below are added to allow previous desktop versions read generated configs
7513
7575
  sdkVersion: PlatformaSDKVersion,
7514
- renderingMode: this._renderingMode,
7515
- initialArgs: this._initialArgs,
7516
- inputsValid: downgradeCfgOrLambda(this._inputsValid),
7517
- sections: downgradeCfgOrLambda(this._sections),
7518
- outputs: Object.fromEntries(Object.entries(this._outputs).map(([key, value]) => [key, downgradeCfgOrLambda(value)])),
7576
+ renderingMode: this.config.renderingMode,
7577
+ initialArgs: this.config.initialArgs,
7578
+ inputsValid: downgradeCfgOrLambda(this.config.inputsValid),
7579
+ sections: downgradeCfgOrLambda(this.config.sections),
7580
+ outputs: Object.fromEntries(Object.entries(this.config.outputs).map(([key, value]) => [key, downgradeCfgOrLambda(value)])),
7519
7581
  };
7520
- globalThis.platformaApiVersion = apiVersion;
7582
+ globalThis.platformaApiVersion = this.config.featureFlags.requiresUIAPIVersion;
7521
7583
  if (!isInUI())
7522
7584
  // we are in the configuration rendering routine, not in actual UI
7523
7585
  return { config };