@milaboratories/pl-middle-layer 1.21.5 → 1.22.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milaboratories/pl-middle-layer",
3
- "version": "1.21.5",
3
+ "version": "1.22.0",
4
4
  "description": "Pl Middle Layer",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",
@@ -31,17 +31,17 @@
31
31
  "@milaboratories/pl-http": "^1.0.2",
32
32
  "@milaboratories/computable": "^2.3.4",
33
33
  "@milaboratories/resolve-helper": "^1.0.2",
34
- "@platforma-sdk/block-tools": "^2.4.12",
35
34
  "@milaboratories/pl-client": "^2.7.1",
36
- "@milaboratories/pl-drivers": "^1.5.4",
35
+ "@platforma-sdk/block-tools": "^2.5.0",
37
36
  "@milaboratories/pl-model-common": "^1.10.1",
38
- "@milaboratories/pl-model-middle-layer": "^1.6.8",
39
- "@platforma-sdk/model": "^1.20.6",
40
37
  "@milaboratories/pl-tree": "^1.4.20",
38
+ "@milaboratories/pl-drivers": "^1.5.4",
39
+ "@platforma-sdk/model": "^1.20.6",
41
40
  "@milaboratories/ts-helpers": "^1.1.3",
42
41
  "@platforma-sdk/workflow-tengo": "2.8.2",
43
42
  "@milaboratories/pl-config": "^1.3.3",
44
- "@milaboratories/pl-local": "^1.9.1"
43
+ "@milaboratories/pl-local": "^1.9.1",
44
+ "@milaboratories/pl-model-middle-layer": "^1.6.8"
45
45
  },
46
46
  "devDependencies": {
47
47
  "semver": "^7.6.3",
@@ -94,30 +94,24 @@ export class BlockUpdateWatcher extends PollComputablePool<
94
94
  // forcing update from non-existent channel to stable
95
95
  const a2 = await registry.getLatestOverview(req.id, AnyChannel);
96
96
  if (a2 === undefined) {
97
- this.logger.error(`No any channel record for ${blockPackIdToString(req.id)}`);
97
+ this.logger.error(`No "any" channel record for ${blockPackIdToString(req.id)}`);
98
98
  return undefined;
99
99
  }
100
100
  spec = { ...(a2.spec as BlockPackFromRegistryV2), channel: StableChannel };
101
101
  }
102
102
  } else {
103
- const a1 = await registry.getLatestOverview(
104
- req.id,
105
- this.preferredUpdateChannel ?? req.channel
106
- );
103
+ const targetChannel = this.preferredUpdateChannel ?? req.channel;
104
+ const a1 = await registry.getLatestOverview(req.id, targetChannel);
107
105
  if (a1) spec = a1.spec;
108
- else if (req.channel === StableChannel) {
109
- // we were not able to find a stable package because there are none for the block pack yet
110
- const a2 = await registry.getLatestOverview(req.id, AnyChannel);
111
- if (a2 === undefined) {
112
- this.logger.error(`No any channel record for ${blockPackIdToString(req.id)}`);
113
- return undefined;
114
- }
115
- // providing "any" channel package as a substitute and marking it as stable
116
- spec = { ...(a2.spec as BlockPackFromRegistryV2), channel: StableChannel };
106
+ else {
107
+ this.logger.error(
108
+ `Can't find update for ${blockPackIdToString(req.id)} in channel "${targetChannel}"`
109
+ );
110
+ return undefined;
117
111
  }
118
112
  }
119
113
 
120
- if (spec?.type !== 'from-registry-v2') throw new Error('Unexpected');
114
+ if (spec.type !== 'from-registry-v2') throw new Error(`Unexpected spec type ${spec}.`);
121
115
 
122
116
  // check that version is in fact later compared to what we already have
123
117
  if (semver.compare(spec.id.version, req.id.version) <= 0) return undefined;