@milaboratories/pl-middle-layer 1.43.98 → 1.43.99

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,10 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var _commonjsHelpers = require('./_commonjsHelpers.cjs');
4
3
  var index = require('../__external/.pnpm/semver@7.7.2/__external/semver/index.cjs');
5
4
 
6
5
  var semverExports = index.__require();
7
- var semver = /*@__PURE__*/_commonjsHelpers.getDefaultExportFromCjs(semverExports);
8
6
 
9
- module.exports = semver;
7
+ exports.semverExports = semverExports;
10
8
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
@@ -1,8 +1,6 @@
1
- import { getDefaultExportFromCjs } from './_commonjsHelpers.js';
2
1
  import { __require as requireSemver } from '../__external/.pnpm/semver@7.7.2/__external/semver/index.js';
3
2
 
4
3
  var semverExports = requireSemver();
5
- var semver = /*@__PURE__*/getDefaultExportFromCjs(semverExports);
6
4
 
7
- export { semver as default };
5
+ export { semverExports as s };
8
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
@@ -114,7 +114,7 @@ class BlockUpdateWatcher extends computable.PollComputablePool {
114
114
  }));
115
115
  if (vMainSuggestion === undefined)
116
116
  return { suggestions };
117
- if (skipVersion !== undefined && index.lte(vMainSuggestion, skipVersion))
117
+ if (skipVersion !== undefined && index.semverExports.lte(vMainSuggestion, skipVersion))
118
118
  return { suggestions };
119
119
  const mainSuggestion = {
120
120
  ...cSpec,
@@ -1 +1 @@
1
- {"version":3,"file":"watcher.cjs","sources":["../../src/block_registry/watcher.ts"],"sourcesContent":["import type { PollPoolOps } from '@milaboratories/computable';\nimport { PollComputablePool } from '@milaboratories/computable';\nimport type {\n BlockPackFromRegistryV2,\n BlockPackSpec,\n BlockSettings,\n UpdateSuggestions } from '@milaboratories/pl-model-middle-layer';\nimport {\n AnyChannel,\n blockPackIdToString,\n StableChannel,\n} from '@milaboratories/pl-model-middle-layer';\nimport type { Dispatcher } from 'undici';\nimport { getDevV1PacketMtime, getDevV2PacketMtime } from './registry';\nimport { tryLoadPackDescription } from '@platforma-sdk/block-tools';\nimport type { MiLogger } from '@milaboratories/ts-helpers';\nimport type { V2RegistryProvider } from './registry-v2-provider';\nimport semver from 'semver';\nimport canonicalize from 'canonicalize';\n\nexport const DefaultBlockUpdateWatcherOps: PollPoolOps = {\n minDelay: 1500,\n};\n\nexport type BlockUpdateWatcherOps = Partial<PollPoolOps> & {\n readonly http?: Dispatcher;\n readonly preferredUpdateChannel?: string;\n};\n\nconst NoUpdatesKey = '__no_updates__';\n\nexport type CheckForUpdateRequest = {\n currentSpec: BlockPackSpec;\n settings: BlockSettings;\n};\n\nexport type CheckForUpdateResponse = {\n suggestions: UpdateSuggestions;\n mainSuggestion?: BlockPackSpec;\n};\n\nexport class BlockUpdateWatcher extends PollComputablePool<\n CheckForUpdateRequest,\n CheckForUpdateResponse\n> {\n private readonly http?: Dispatcher;\n private readonly preferredUpdateChannel?: string;\n\n constructor(\n private readonly registryProvider: V2RegistryProvider,\n logger: MiLogger,\n ops: BlockUpdateWatcherOps = {},\n ) {\n super({ ...ops, ...DefaultBlockUpdateWatcherOps }, logger);\n this.http = ops.http;\n this.preferredUpdateChannel = ops.preferredUpdateChannel;\n }\n\n protected getKey(req: CheckForUpdateRequest): string {\n switch (req.currentSpec.type) {\n case 'dev-v1':\n return `dev_1_${req.currentSpec.folder}_${req.currentSpec.mtime}`;\n case 'dev-v2':\n return `dev_2_${req.currentSpec.folder}_${req.currentSpec.mtime}`;\n case 'from-registry-v2':\n return `from_registry_v2_${canonicalize(req)!}`;\n default:\n return NoUpdatesKey;\n }\n }\n\n protected async readValue(req: CheckForUpdateRequest): Promise<CheckForUpdateResponse> {\n try {\n const cSpec = req.currentSpec;\n switch (cSpec.type) {\n case 'dev-v1': {\n try {\n const mtime = await getDevV1PacketMtime(cSpec.folder);\n if (mtime === cSpec.mtime) return { suggestions: [] };\n else return { mainSuggestion: { ...cSpec, mtime }, suggestions: [] };\n } catch (err: unknown) {\n this.logger.warn(err);\n return { suggestions: [] };\n }\n }\n\n case 'dev-v2': {\n try {\n const description = await tryLoadPackDescription(cSpec.folder, this.logger);\n if (description === undefined) return { suggestions: [] };\n const mtime = await getDevV2PacketMtime(description);\n if (mtime === cSpec.mtime) return { suggestions: [] };\n else return { mainSuggestion: { ...cSpec, mtime: mtime }, suggestions: [] };\n } catch (err: unknown) {\n this.logger.warn(err);\n return { suggestions: [] };\n }\n }\n\n case 'from-registry-v2': {\n try {\n const { versionLock, skipVersion } = req.settings;\n if (versionLock === 'patch') return { suggestions: [] };\n const registry = this.registryProvider.getRegistry(cSpec.registryUrl);\n let channel: string | undefined = this.preferredUpdateChannel;\n\n if (channel === undefined) {\n if (cSpec.channel === undefined) {\n const a1 = await registry.getLatestOverview(cSpec.id, StableChannel);\n if (a1) channel = StableChannel;\n else {\n // forcing update from non-existent channel to stable\n const a2 = await registry.getLatestOverview(cSpec.id, AnyChannel);\n if (a2 === undefined) {\n this.logger.error(\n `No \"any\" channel record for ${blockPackIdToString(cSpec.id)}`,\n );\n return { suggestions: [] };\n }\n channel = AnyChannel;\n }\n } else channel = cSpec.channel;\n }\n\n const vSuggestions = await registry.getUpdateSuggestions(cSpec.id, channel);\n if (vSuggestions === undefined || vSuggestions.length === 0) return { suggestions: [] };\n\n // from major to patch\n vSuggestions.reverse();\n\n let vMainSuggestion: string | undefined = undefined;\n switch (versionLock) {\n case undefined:\n vMainSuggestion = vSuggestions[0].update;\n break;\n case 'major':\n vMainSuggestion = vSuggestions.find((v) => v.type !== 'major')?.update;\n break;\n case 'minor':\n vMainSuggestion = vSuggestions.find((v) => v.type === 'patch')?.update;\n break;\n }\n\n const suggestions: UpdateSuggestions = vSuggestions.map(({ type, update }) => ({\n type,\n update: { ...cSpec, id: { ...cSpec.id, version: update } },\n }));\n\n if (vMainSuggestion === undefined) return { suggestions };\n if (skipVersion !== undefined && semver.lte(vMainSuggestion, skipVersion))\n return { suggestions };\n\n const mainSuggestion: BlockPackFromRegistryV2 = {\n ...cSpec,\n id: { ...cSpec.id, version: vMainSuggestion },\n };\n\n // warming cache\n void (async () => {\n try {\n await registry.getComponents(mainSuggestion.id);\n } catch (e: unknown) {\n this.logger.warn(e);\n }\n })();\n\n return { suggestions, mainSuggestion };\n } catch (err: unknown) {\n this.logger.warn(err);\n return { suggestions: [] };\n }\n }\n\n default:\n return { suggestions: [] };\n }\n } catch (e: unknown) {\n this.logger.warn(e);\n return { suggestions: [] };\n }\n }\n\n protected resultsEqual(res1: CheckForUpdateResponse, res2: CheckForUpdateResponse): boolean {\n return canonicalize(res1) === canonicalize(res2);\n // if (res1 === undefined && res2 === undefined) return true;\n // if (res1 === undefined || res2 === undefined) return false;\n // if (res1.type !== res2.type) return false;\n // switch (res1.type) {\n // case 'from-registry-v1':\n // if (res2.type !== 'from-registry-v1') return false;\n // return res1.registryUrl === res2.registryUrl && blockPackIdEquals(res1.id, res2.id);\n // case 'from-registry-v2':\n // if (res2.type !== 'from-registry-v2') return false;\n // return res1.registryUrl === res2.registryUrl && blockPackIdEquals(res1.id, res2.id);\n // case 'dev-v1':\n // if (res2.type !== 'dev-v1') return false;\n // return res1.folder === res2.folder && res1.mtime === res2.mtime;\n // case 'dev-v2':\n // if (res2.type !== 'dev-v2') return false;\n // return res1.folder === res2.folder && res1.mtime === res2.mtime;\n // default:\n // assertNever(res1);\n // }\n }\n}\n"],"names":["PollComputablePool","getDevV1PacketMtime","tryLoadPackDescription","getDevV2PacketMtime","StableChannel","AnyChannel","blockPackIdToString","semver"],"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E,OAAO,GAAY,EAAE;AACrB,wBAAA,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;AACrB,wBAAA,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE;oBAC5B;gBACF;AAEA,gBAAA;AACE,oBAAA,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE;;QAEhC;QAAE,OAAO,CAAU,EAAE;AACnB,YAAA,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;AACnB,YAAA,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE;QAC5B;IACF;IAEU,YAAY,CAAC,IAA4B,EAAE,IAA4B,EAAA;QAC/E,OAAO,YAAY,CAAC,IAAI,CAAC,KAAK,YAAY,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;IAoBlD;AACD;;;;;"}
1
+ {"version":3,"file":"watcher.cjs","sources":["../../src/block_registry/watcher.ts"],"sourcesContent":["import type { PollPoolOps } from '@milaboratories/computable';\nimport { PollComputablePool } from '@milaboratories/computable';\nimport type {\n BlockPackFromRegistryV2,\n BlockPackSpec,\n BlockSettings,\n UpdateSuggestions } from '@milaboratories/pl-model-middle-layer';\nimport {\n AnyChannel,\n blockPackIdToString,\n StableChannel,\n} from '@milaboratories/pl-model-middle-layer';\nimport type { Dispatcher } from 'undici';\nimport { getDevV1PacketMtime, getDevV2PacketMtime } from './registry';\nimport { tryLoadPackDescription } from '@platforma-sdk/block-tools';\nimport type { MiLogger } from '@milaboratories/ts-helpers';\nimport type { V2RegistryProvider } from './registry-v2-provider';\nimport * as semver from 'semver';\nimport canonicalize from 'canonicalize';\n\nexport const DefaultBlockUpdateWatcherOps: PollPoolOps = {\n minDelay: 1500,\n};\n\nexport type BlockUpdateWatcherOps = Partial<PollPoolOps> & {\n readonly http?: Dispatcher;\n readonly preferredUpdateChannel?: string;\n};\n\nconst NoUpdatesKey = '__no_updates__';\n\nexport type CheckForUpdateRequest = {\n currentSpec: BlockPackSpec;\n settings: BlockSettings;\n};\n\nexport type CheckForUpdateResponse = {\n suggestions: UpdateSuggestions;\n mainSuggestion?: BlockPackSpec;\n};\n\nexport class BlockUpdateWatcher extends PollComputablePool<\n CheckForUpdateRequest,\n CheckForUpdateResponse\n> {\n private readonly http?: Dispatcher;\n private readonly preferredUpdateChannel?: string;\n\n constructor(\n private readonly registryProvider: V2RegistryProvider,\n logger: MiLogger,\n ops: BlockUpdateWatcherOps = {},\n ) {\n super({ ...ops, ...DefaultBlockUpdateWatcherOps }, logger);\n this.http = ops.http;\n this.preferredUpdateChannel = ops.preferredUpdateChannel;\n }\n\n protected getKey(req: CheckForUpdateRequest): string {\n switch (req.currentSpec.type) {\n case 'dev-v1':\n return `dev_1_${req.currentSpec.folder}_${req.currentSpec.mtime}`;\n case 'dev-v2':\n return `dev_2_${req.currentSpec.folder}_${req.currentSpec.mtime}`;\n case 'from-registry-v2':\n return `from_registry_v2_${canonicalize(req)!}`;\n default:\n return NoUpdatesKey;\n }\n }\n\n protected async readValue(req: CheckForUpdateRequest): Promise<CheckForUpdateResponse> {\n try {\n const cSpec = req.currentSpec;\n switch (cSpec.type) {\n case 'dev-v1': {\n try {\n const mtime = await getDevV1PacketMtime(cSpec.folder);\n if (mtime === cSpec.mtime) return { suggestions: [] };\n else return { mainSuggestion: { ...cSpec, mtime }, suggestions: [] };\n } catch (err: unknown) {\n this.logger.warn(err);\n return { suggestions: [] };\n }\n }\n\n case 'dev-v2': {\n try {\n const description = await tryLoadPackDescription(cSpec.folder, this.logger);\n if (description === undefined) return { suggestions: [] };\n const mtime = await getDevV2PacketMtime(description);\n if (mtime === cSpec.mtime) return { suggestions: [] };\n else return { mainSuggestion: { ...cSpec, mtime: mtime }, suggestions: [] };\n } catch (err: unknown) {\n this.logger.warn(err);\n return { suggestions: [] };\n }\n }\n\n case 'from-registry-v2': {\n try {\n const { versionLock, skipVersion } = req.settings;\n if (versionLock === 'patch') return { suggestions: [] };\n const registry = this.registryProvider.getRegistry(cSpec.registryUrl);\n let channel: string | undefined = this.preferredUpdateChannel;\n\n if (channel === undefined) {\n if (cSpec.channel === undefined) {\n const a1 = await registry.getLatestOverview(cSpec.id, StableChannel);\n if (a1) channel = StableChannel;\n else {\n // forcing update from non-existent channel to stable\n const a2 = await registry.getLatestOverview(cSpec.id, AnyChannel);\n if (a2 === undefined) {\n this.logger.error(\n `No \"any\" channel record for ${blockPackIdToString(cSpec.id)}`,\n );\n return { suggestions: [] };\n }\n channel = AnyChannel;\n }\n } else channel = cSpec.channel;\n }\n\n const vSuggestions = await registry.getUpdateSuggestions(cSpec.id, channel);\n if (vSuggestions === undefined || vSuggestions.length === 0) return { suggestions: [] };\n\n // from major to patch\n vSuggestions.reverse();\n\n let vMainSuggestion: string | undefined = undefined;\n switch (versionLock) {\n case undefined:\n vMainSuggestion = vSuggestions[0].update;\n break;\n case 'major':\n vMainSuggestion = vSuggestions.find((v) => v.type !== 'major')?.update;\n break;\n case 'minor':\n vMainSuggestion = vSuggestions.find((v) => v.type === 'patch')?.update;\n break;\n }\n\n const suggestions: UpdateSuggestions = vSuggestions.map(({ type, update }) => ({\n type,\n update: { ...cSpec, id: { ...cSpec.id, version: update } },\n }));\n\n if (vMainSuggestion === undefined) return { suggestions };\n if (skipVersion !== undefined && semver.lte(vMainSuggestion, skipVersion))\n return { suggestions };\n\n const mainSuggestion: BlockPackFromRegistryV2 = {\n ...cSpec,\n id: { ...cSpec.id, version: vMainSuggestion },\n };\n\n // warming cache\n void (async () => {\n try {\n await registry.getComponents(mainSuggestion.id);\n } catch (e: unknown) {\n this.logger.warn(e);\n }\n })();\n\n return { suggestions, mainSuggestion };\n } catch (err: unknown) {\n this.logger.warn(err);\n return { suggestions: [] };\n }\n }\n\n default:\n return { suggestions: [] };\n }\n } catch (e: unknown) {\n this.logger.warn(e);\n return { suggestions: [] };\n }\n }\n\n protected resultsEqual(res1: CheckForUpdateResponse, res2: CheckForUpdateResponse): boolean {\n return canonicalize(res1) === canonicalize(res2);\n // if (res1 === undefined && res2 === undefined) return true;\n // if (res1 === undefined || res2 === undefined) return false;\n // if (res1.type !== res2.type) return false;\n // switch (res1.type) {\n // case 'from-registry-v1':\n // if (res2.type !== 'from-registry-v1') return false;\n // return res1.registryUrl === res2.registryUrl && blockPackIdEquals(res1.id, res2.id);\n // case 'from-registry-v2':\n // if (res2.type !== 'from-registry-v2') return false;\n // return res1.registryUrl === res2.registryUrl && blockPackIdEquals(res1.id, res2.id);\n // case 'dev-v1':\n // if (res2.type !== 'dev-v1') return false;\n // return res1.folder === res2.folder && res1.mtime === res2.mtime;\n // case 'dev-v2':\n // if (res2.type !== 'dev-v2') return false;\n // return res1.folder === res2.folder && res1.mtime === res2.mtime;\n // default:\n // assertNever(res1);\n // }\n }\n}\n"],"names":["PollComputablePool","getDevV1PacketMtime","tryLoadPackDescription","getDevV2PacketMtime","StableChannel","AnyChannel","blockPackIdToString","semver.lte"],"mappings":";;;;;;;;;AAoBO,MAAM,4BAA4B,GAAgB;AACvD,IAAA,QAAQ,EAAE,IAAI;;AAQhB,MAAM,YAAY,GAAG,gBAAgB;AAY/B,MAAO,kBAAmB,SAAQA,6BAGvC,CAAA;AAKoB,IAAA,gBAAA;AAJF,IAAA,IAAI;AACJ,IAAA,sBAAsB;AAEvC,IAAA,WAAA,CACmB,gBAAoC,EACrD,MAAgB,EAChB,MAA6B,EAAE,EAAA;QAE/B,KAAK,CAAC,EAAE,GAAG,GAAG,EAAE,GAAG,4BAA4B,EAAE,EAAE,MAAM,CAAC;QAJzC,IAAA,CAAA,gBAAgB,GAAhB,gBAAgB;AAKjC,QAAA,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI;AACpB,QAAA,IAAI,CAAC,sBAAsB,GAAG,GAAG,CAAC,sBAAsB;IAC1D;AAEU,IAAA,MAAM,CAAC,GAA0B,EAAA;AACzC,QAAA,QAAQ,GAAG,CAAC,WAAW,CAAC,IAAI;AAC1B,YAAA,KAAK,QAAQ;AACX,gBAAA,OAAO,CAAA,MAAA,EAAS,GAAG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D,IAAI,WAAW,KAAK,SAAS,IAAIE,uBAAU,CAAC,eAAe,EAAE,WAAW,CAAC;4BACvE,OAAO,EAAE,WAAW,EAAE;AAExB,wBAAA,MAAM,cAAc,GAA4B;AAC9C,4BAAA,GAAG,KAAK;4BACR,EAAE,EAAE,EAAE,GAAG,KAAK,CAAC,EAAE,EAAE,OAAO,EAAE,eAAe,EAAE;yBAC9C;;wBAGD,KAAK,CAAC,YAAW;AACf,4BAAA,IAAI;gCACF,MAAM,QAAQ,CAAC,aAAa,CAAC,cAAc,CAAC,EAAE,CAAC;4BACjD;4BAAE,OAAO,CAAU,EAAE;AACnB,gCAAA,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;4BACrB;wBACF,CAAC,GAAG;AAEJ,wBAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE;oBACxC;oBAAE,OAAO,GAAY,EAAE;AACrB,wBAAA,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;AACrB,wBAAA,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE;oBAC5B;gBACF;AAEA,gBAAA;AACE,oBAAA,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE;;QAEhC;QAAE,OAAO,CAAU,EAAE;AACnB,YAAA,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;AACnB,YAAA,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE;QAC5B;IACF;IAEU,YAAY,CAAC,IAA4B,EAAE,IAA4B,EAAA;QAC/E,OAAO,YAAY,CAAC,IAAI,CAAC,KAAK,YAAY,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;IAoBlD;AACD;;;;;"}
@@ -2,7 +2,7 @@ import { PollComputablePool } from '@milaboratories/computable';
2
2
  import { StableChannel, AnyChannel, blockPackIdToString } from '@milaboratories/pl-model-middle-layer';
3
3
  import { getDevV2PacketMtime, getDevV1PacketMtime } from './registry.js';
4
4
  import { tryLoadPackDescription } from '@platforma-sdk/block-tools';
5
- import semver from '../_virtual/index.js';
5
+ import { s as semverExports } from '../_virtual/index.js';
6
6
  import canonicalize from 'canonicalize';
7
7
 
8
8
  const DefaultBlockUpdateWatcherOps = {
@@ -112,7 +112,7 @@ class BlockUpdateWatcher extends PollComputablePool {
112
112
  }));
113
113
  if (vMainSuggestion === undefined)
114
114
  return { suggestions };
115
- if (skipVersion !== undefined && semver.lte(vMainSuggestion, skipVersion))
115
+ if (skipVersion !== undefined && semverExports.lte(vMainSuggestion, skipVersion))
116
116
  return { suggestions };
117
117
  const mainSuggestion = {
118
118
  ...cSpec,
@@ -1 +1 @@
1
- {"version":3,"file":"watcher.js","sources":["../../src/block_registry/watcher.ts"],"sourcesContent":["import type { PollPoolOps } from '@milaboratories/computable';\nimport { PollComputablePool } from '@milaboratories/computable';\nimport type {\n BlockPackFromRegistryV2,\n BlockPackSpec,\n BlockSettings,\n UpdateSuggestions } from '@milaboratories/pl-model-middle-layer';\nimport {\n AnyChannel,\n blockPackIdToString,\n StableChannel,\n} from '@milaboratories/pl-model-middle-layer';\nimport type { Dispatcher } from 'undici';\nimport { getDevV1PacketMtime, getDevV2PacketMtime } from './registry';\nimport { tryLoadPackDescription } from '@platforma-sdk/block-tools';\nimport type { MiLogger } from '@milaboratories/ts-helpers';\nimport type { V2RegistryProvider } from './registry-v2-provider';\nimport semver from 'semver';\nimport canonicalize from 'canonicalize';\n\nexport const DefaultBlockUpdateWatcherOps: PollPoolOps = {\n minDelay: 1500,\n};\n\nexport type BlockUpdateWatcherOps = Partial<PollPoolOps> & {\n readonly http?: Dispatcher;\n readonly preferredUpdateChannel?: string;\n};\n\nconst NoUpdatesKey = '__no_updates__';\n\nexport type CheckForUpdateRequest = {\n currentSpec: BlockPackSpec;\n settings: BlockSettings;\n};\n\nexport type CheckForUpdateResponse = {\n suggestions: UpdateSuggestions;\n mainSuggestion?: BlockPackSpec;\n};\n\nexport class BlockUpdateWatcher extends PollComputablePool<\n CheckForUpdateRequest,\n CheckForUpdateResponse\n> {\n private readonly http?: Dispatcher;\n private readonly preferredUpdateChannel?: string;\n\n constructor(\n private readonly registryProvider: V2RegistryProvider,\n logger: MiLogger,\n ops: BlockUpdateWatcherOps = {},\n ) {\n super({ ...ops, ...DefaultBlockUpdateWatcherOps }, logger);\n this.http = ops.http;\n this.preferredUpdateChannel = ops.preferredUpdateChannel;\n }\n\n protected getKey(req: CheckForUpdateRequest): string {\n switch (req.currentSpec.type) {\n case 'dev-v1':\n return `dev_1_${req.currentSpec.folder}_${req.currentSpec.mtime}`;\n case 'dev-v2':\n return `dev_2_${req.currentSpec.folder}_${req.currentSpec.mtime}`;\n case 'from-registry-v2':\n return `from_registry_v2_${canonicalize(req)!}`;\n default:\n return NoUpdatesKey;\n }\n }\n\n protected async readValue(req: CheckForUpdateRequest): Promise<CheckForUpdateResponse> {\n try {\n const cSpec = req.currentSpec;\n switch (cSpec.type) {\n case 'dev-v1': {\n try {\n const mtime = await getDevV1PacketMtime(cSpec.folder);\n if (mtime === cSpec.mtime) return { suggestions: [] };\n else return { mainSuggestion: { ...cSpec, mtime }, suggestions: [] };\n } catch (err: unknown) {\n this.logger.warn(err);\n return { suggestions: [] };\n }\n }\n\n case 'dev-v2': {\n try {\n const description = await tryLoadPackDescription(cSpec.folder, this.logger);\n if (description === undefined) return { suggestions: [] };\n const mtime = await getDevV2PacketMtime(description);\n if (mtime === cSpec.mtime) return { suggestions: [] };\n else return { mainSuggestion: { ...cSpec, mtime: mtime }, suggestions: [] };\n } catch (err: unknown) {\n this.logger.warn(err);\n return { suggestions: [] };\n }\n }\n\n case 'from-registry-v2': {\n try {\n const { versionLock, skipVersion } = req.settings;\n if (versionLock === 'patch') return { suggestions: [] };\n const registry = this.registryProvider.getRegistry(cSpec.registryUrl);\n let channel: string | undefined = this.preferredUpdateChannel;\n\n if (channel === undefined) {\n if (cSpec.channel === undefined) {\n const a1 = await registry.getLatestOverview(cSpec.id, StableChannel);\n if (a1) channel = StableChannel;\n else {\n // forcing update from non-existent channel to stable\n const a2 = await registry.getLatestOverview(cSpec.id, AnyChannel);\n if (a2 === undefined) {\n this.logger.error(\n `No \"any\" channel record for ${blockPackIdToString(cSpec.id)}`,\n );\n return { suggestions: [] };\n }\n channel = AnyChannel;\n }\n } else channel = cSpec.channel;\n }\n\n const vSuggestions = await registry.getUpdateSuggestions(cSpec.id, channel);\n if (vSuggestions === undefined || vSuggestions.length === 0) return { suggestions: [] };\n\n // from major to patch\n vSuggestions.reverse();\n\n let vMainSuggestion: string | undefined = undefined;\n switch (versionLock) {\n case undefined:\n vMainSuggestion = vSuggestions[0].update;\n break;\n case 'major':\n vMainSuggestion = vSuggestions.find((v) => v.type !== 'major')?.update;\n break;\n case 'minor':\n vMainSuggestion = vSuggestions.find((v) => v.type === 'patch')?.update;\n break;\n }\n\n const suggestions: UpdateSuggestions = vSuggestions.map(({ type, update }) => ({\n type,\n update: { ...cSpec, id: { ...cSpec.id, version: update } },\n }));\n\n if (vMainSuggestion === undefined) return { suggestions };\n if (skipVersion !== undefined && semver.lte(vMainSuggestion, skipVersion))\n return { suggestions };\n\n const mainSuggestion: BlockPackFromRegistryV2 = {\n ...cSpec,\n id: { ...cSpec.id, version: vMainSuggestion },\n };\n\n // warming cache\n void (async () => {\n try {\n await registry.getComponents(mainSuggestion.id);\n } catch (e: unknown) {\n this.logger.warn(e);\n }\n })();\n\n return { suggestions, mainSuggestion };\n } catch (err: unknown) {\n this.logger.warn(err);\n return { suggestions: [] };\n }\n }\n\n default:\n return { suggestions: [] };\n }\n } catch (e: unknown) {\n this.logger.warn(e);\n return { suggestions: [] };\n }\n }\n\n protected resultsEqual(res1: CheckForUpdateResponse, res2: CheckForUpdateResponse): boolean {\n return canonicalize(res1) === canonicalize(res2);\n // if (res1 === undefined && res2 === undefined) return true;\n // if (res1 === undefined || res2 === undefined) return false;\n // if (res1.type !== res2.type) return false;\n // switch (res1.type) {\n // case 'from-registry-v1':\n // if (res2.type !== 'from-registry-v1') return false;\n // return res1.registryUrl === res2.registryUrl && blockPackIdEquals(res1.id, res2.id);\n // case 'from-registry-v2':\n // if (res2.type !== 'from-registry-v2') return false;\n // return res1.registryUrl === res2.registryUrl && blockPackIdEquals(res1.id, res2.id);\n // case 'dev-v1':\n // if (res2.type !== 'dev-v1') return false;\n // return res1.folder === res2.folder && res1.mtime === res2.mtime;\n // case 'dev-v2':\n // if (res2.type !== 'dev-v2') return false;\n // return res1.folder === res2.folder && res1.mtime === res2.mtime;\n // default:\n // assertNever(res1);\n // }\n }\n}\n"],"names":[],"mappings":";;;;;;;AAoBO,MAAM,4BAA4B,GAAgB;AACvD,IAAA,QAAQ,EAAE,IAAI;;AAQhB,MAAM,YAAY,GAAG,gBAAgB;AAY/B,MAAO,kBAAmB,SAAQ,kBAGvC,CAAA;AAKoB,IAAA,gBAAA;AAJF,IAAA,IAAI;AACJ,IAAA,sBAAsB;AAEvC,IAAA,WAAA,CACmB,gBAAoC,EACrD,MAAgB,EAChB,MAA6B,EAAE,EAAA;QAE/B,KAAK,CAAC,EAAE,GAAG,GAAG,EAAE,GAAG,4BAA4B,EAAE,EAAE,MAAM,CAAC;QAJzC,IAAA,CAAA,gBAAgB,GAAhB,gBAAgB;AAKjC,QAAA,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI;AACpB,QAAA,IAAI,CAAC,sBAAsB,GAAG,GAAG,CAAC,sBAAsB;IAC1D;AAEU,IAAA,MAAM,CAAC,GAA0B,EAAA;AACzC,QAAA,QAAQ,GAAG,CAAC,WAAW,CAAC,IAAI;AAC1B,YAAA,KAAK,QAAQ;AACX,gBAAA,OAAO,CAAA,MAAA,EAAS,GAAG,CAAC,WAAW,CAAC,MAAM,CAAA,CAAA,EAAI,GAAG,CAAC,WAAW,CAAC,KAAK,EAAE;AACnE,YAAA,KAAK,QAAQ;AACX,gBAAA,OAAO,CAAA,MAAA,EAAS,GAAG,CAAC,WAAW,CAAC,MAAM,CAAA,CAAA,EAAI,GAAG,CAAC,WAAW,CAAC,KAAK,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AE,eAAe,EAAE;yBAC9C;;wBAGD,KAAK,CAAC,YAAW;AACf,4BAAA,IAAI;gCACF,MAAM,QAAQ,CAAC,aAAa,CAAC,cAAc,CAAC,EAAE,CAAC;4BACjD;4BAAE,OAAO,CAAU,EAAE;AACnB,gCAAA,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;4BACrB;wBACF,CAAC,GAAG;AAEJ,wBAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE;oBACxC;oBAAE,OAAO,GAAY,EAAE;AACrB,wBAAA,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;AACrB,wBAAA,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE;oBAC5B;gBACF;AAEA,gBAAA;AACE,oBAAA,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE;;QAEhC;QAAE,OAAO,CAAU,EAAE;AACnB,YAAA,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;AACnB,YAAA,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE;QAC5B;IACF;IAEU,YAAY,CAAC,IAA4B,EAAE,IAA4B,EAAA;QAC/E,OAAO,YAAY,CAAC,IAAI,CAAC,KAAK,YAAY,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;IAoBlD;AACD;;;;"}
1
+ {"version":3,"file":"watcher.js","sources":["../../src/block_registry/watcher.ts"],"sourcesContent":["import type { PollPoolOps } from '@milaboratories/computable';\nimport { PollComputablePool } from '@milaboratories/computable';\nimport type {\n BlockPackFromRegistryV2,\n BlockPackSpec,\n BlockSettings,\n UpdateSuggestions } from '@milaboratories/pl-model-middle-layer';\nimport {\n AnyChannel,\n blockPackIdToString,\n StableChannel,\n} from '@milaboratories/pl-model-middle-layer';\nimport type { Dispatcher } from 'undici';\nimport { getDevV1PacketMtime, getDevV2PacketMtime } from './registry';\nimport { tryLoadPackDescription } from '@platforma-sdk/block-tools';\nimport type { MiLogger } from '@milaboratories/ts-helpers';\nimport type { V2RegistryProvider } from './registry-v2-provider';\nimport * as semver from 'semver';\nimport canonicalize from 'canonicalize';\n\nexport const DefaultBlockUpdateWatcherOps: PollPoolOps = {\n minDelay: 1500,\n};\n\nexport type BlockUpdateWatcherOps = Partial<PollPoolOps> & {\n readonly http?: Dispatcher;\n readonly preferredUpdateChannel?: string;\n};\n\nconst NoUpdatesKey = '__no_updates__';\n\nexport type CheckForUpdateRequest = {\n currentSpec: BlockPackSpec;\n settings: BlockSettings;\n};\n\nexport type CheckForUpdateResponse = {\n suggestions: UpdateSuggestions;\n mainSuggestion?: BlockPackSpec;\n};\n\nexport class BlockUpdateWatcher extends PollComputablePool<\n CheckForUpdateRequest,\n CheckForUpdateResponse\n> {\n private readonly http?: Dispatcher;\n private readonly preferredUpdateChannel?: string;\n\n constructor(\n private readonly registryProvider: V2RegistryProvider,\n logger: MiLogger,\n ops: BlockUpdateWatcherOps = {},\n ) {\n super({ ...ops, ...DefaultBlockUpdateWatcherOps }, logger);\n this.http = ops.http;\n this.preferredUpdateChannel = ops.preferredUpdateChannel;\n }\n\n protected getKey(req: CheckForUpdateRequest): string {\n switch (req.currentSpec.type) {\n case 'dev-v1':\n return `dev_1_${req.currentSpec.folder}_${req.currentSpec.mtime}`;\n case 'dev-v2':\n return `dev_2_${req.currentSpec.folder}_${req.currentSpec.mtime}`;\n case 'from-registry-v2':\n return `from_registry_v2_${canonicalize(req)!}`;\n default:\n return NoUpdatesKey;\n }\n }\n\n protected async readValue(req: CheckForUpdateRequest): Promise<CheckForUpdateResponse> {\n try {\n const cSpec = req.currentSpec;\n switch (cSpec.type) {\n case 'dev-v1': {\n try {\n const mtime = await getDevV1PacketMtime(cSpec.folder);\n if (mtime === cSpec.mtime) return { suggestions: [] };\n else return { mainSuggestion: { ...cSpec, mtime }, suggestions: [] };\n } catch (err: unknown) {\n this.logger.warn(err);\n return { suggestions: [] };\n }\n }\n\n case 'dev-v2': {\n try {\n const description = await tryLoadPackDescription(cSpec.folder, this.logger);\n if (description === undefined) return { suggestions: [] };\n const mtime = await getDevV2PacketMtime(description);\n if (mtime === cSpec.mtime) return { suggestions: [] };\n else return { mainSuggestion: { ...cSpec, mtime: mtime }, suggestions: [] };\n } catch (err: unknown) {\n this.logger.warn(err);\n return { suggestions: [] };\n }\n }\n\n case 'from-registry-v2': {\n try {\n const { versionLock, skipVersion } = req.settings;\n if (versionLock === 'patch') return { suggestions: [] };\n const registry = this.registryProvider.getRegistry(cSpec.registryUrl);\n let channel: string | undefined = this.preferredUpdateChannel;\n\n if (channel === undefined) {\n if (cSpec.channel === undefined) {\n const a1 = await registry.getLatestOverview(cSpec.id, StableChannel);\n if (a1) channel = StableChannel;\n else {\n // forcing update from non-existent channel to stable\n const a2 = await registry.getLatestOverview(cSpec.id, AnyChannel);\n if (a2 === undefined) {\n this.logger.error(\n `No \"any\" channel record for ${blockPackIdToString(cSpec.id)}`,\n );\n return { suggestions: [] };\n }\n channel = AnyChannel;\n }\n } else channel = cSpec.channel;\n }\n\n const vSuggestions = await registry.getUpdateSuggestions(cSpec.id, channel);\n if (vSuggestions === undefined || vSuggestions.length === 0) return { suggestions: [] };\n\n // from major to patch\n vSuggestions.reverse();\n\n let vMainSuggestion: string | undefined = undefined;\n switch (versionLock) {\n case undefined:\n vMainSuggestion = vSuggestions[0].update;\n break;\n case 'major':\n vMainSuggestion = vSuggestions.find((v) => v.type !== 'major')?.update;\n break;\n case 'minor':\n vMainSuggestion = vSuggestions.find((v) => v.type === 'patch')?.update;\n break;\n }\n\n const suggestions: UpdateSuggestions = vSuggestions.map(({ type, update }) => ({\n type,\n update: { ...cSpec, id: { ...cSpec.id, version: update } },\n }));\n\n if (vMainSuggestion === undefined) return { suggestions };\n if (skipVersion !== undefined && semver.lte(vMainSuggestion, skipVersion))\n return { suggestions };\n\n const mainSuggestion: BlockPackFromRegistryV2 = {\n ...cSpec,\n id: { ...cSpec.id, version: vMainSuggestion },\n };\n\n // warming cache\n void (async () => {\n try {\n await registry.getComponents(mainSuggestion.id);\n } catch (e: unknown) {\n this.logger.warn(e);\n }\n })();\n\n return { suggestions, mainSuggestion };\n } catch (err: unknown) {\n this.logger.warn(err);\n return { suggestions: [] };\n }\n }\n\n default:\n return { suggestions: [] };\n }\n } catch (e: unknown) {\n this.logger.warn(e);\n return { suggestions: [] };\n }\n }\n\n protected resultsEqual(res1: CheckForUpdateResponse, res2: CheckForUpdateResponse): boolean {\n return canonicalize(res1) === canonicalize(res2);\n // if (res1 === undefined && res2 === undefined) return true;\n // if (res1 === undefined || res2 === undefined) return false;\n // if (res1.type !== res2.type) return false;\n // switch (res1.type) {\n // case 'from-registry-v1':\n // if (res2.type !== 'from-registry-v1') return false;\n // return res1.registryUrl === res2.registryUrl && blockPackIdEquals(res1.id, res2.id);\n // case 'from-registry-v2':\n // if (res2.type !== 'from-registry-v2') return false;\n // return res1.registryUrl === res2.registryUrl && blockPackIdEquals(res1.id, res2.id);\n // case 'dev-v1':\n // if (res2.type !== 'dev-v1') return false;\n // return res1.folder === res2.folder && res1.mtime === res2.mtime;\n // case 'dev-v2':\n // if (res2.type !== 'dev-v2') return false;\n // return res1.folder === res2.folder && res1.mtime === res2.mtime;\n // default:\n // assertNever(res1);\n // }\n }\n}\n"],"names":["semver.lte"],"mappings":";;;;;;;AAoBO,MAAM,4BAA4B,GAAgB;AACvD,IAAA,QAAQ,EAAE,IAAI;;AAQhB,MAAM,YAAY,GAAG,gBAAgB;AAY/B,MAAO,kBAAmB,SAAQ,kBAGvC,CAAA;AAKoB,IAAA,gBAAA;AAJF,IAAA,IAAI;AACJ,IAAA,sBAAsB;AAEvC,IAAA,WAAA,CACmB,gBAAoC,EACrD,MAAgB,EAChB,MAA6B,EAAE,EAAA;QAE/B,KAAK,CAAC,EAAE,GAAG,GAAG,EAAE,GAAG,4BAA4B,EAAE,EAAE,MAAM,CAAC;QAJzC,IAAA,CAAA,gBAAgB,GAAhB,gBAAgB;AAKjC,QAAA,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC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;;;;;;;;;IAoBlD;AACD;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ops.cjs","sources":["../../src/middle_layer/ops.ts"],"sourcesContent":["import type { TemporalSynchronizedTreeOps } from './types';\nimport type {\n DownloadBlobToURLDriverOps,\n DownloadDriverOps,\n DownloadUrlDriverOps,\n OpenFileDialogCallback,\n VirtualLocalStorageSpec,\n} from '@milaboratories/pl-drivers';\nimport type { UploadDriverOps } from '@milaboratories/pl-drivers';\nimport type { LogsStreamDriverOps } from '@milaboratories/pl-drivers';\nimport type { MiLogger } from '@milaboratories/ts-helpers';\nimport { ConsoleLoggerAdapter } from '@milaboratories/ts-helpers';\nimport type { LocalStorageProjection } from '@milaboratories/pl-drivers';\nimport path from 'node:path';\nimport { PFrameDriverOpsDefaults, type PFrameDriverOps } from '../pool';\n\n/** Paths part of {@link DriverKitOps}. */\nexport type DriverKitOpsPaths = {\n /** Common root where to put downloaded blobs / downloaded blob cache */\n readonly blobDownloadPath: string;\n\n /** Common root for a cache for range queries. */\n readonly blobDownloadRangesCachePath: string;\n\n /** Common root where to put downloaded blobs with */\n readonly downloadBlobToURLPath: string;\n\n /**\n * List of pl storages that have projections in local file system.\n *\n * This option affect two drivers:\n *\n * (1) LS driver generates \"index\" handles instead of \"upload\" for paths inside those locations\n *\n * (2) Download driver directly serves content retrieval requests for blobs from listed storages,\n * and don't apply any caching for such blobs (i.e. preventing duplication of files for Downloaded\n * type handles, making OnDemand and Downloaded handles equivalent)\n *\n * */\n readonly localProjections: LocalStorageProjection[];\n\n /**\n * List of virtual storages that will allow homogeneous access to local FSs through LS API.\n * If undefined, default list will be created.\n * */\n readonly virtualLocalStoragesOverride?: VirtualLocalStorageSpec[];\n\n /** Path to the directory where pframes will spill temporary files and store materialized views */\n readonly pframesSpillPath: string;\n};\n\n/** Options required to initialize full set of middle layer driver kit */\nexport type DriverKitOpsSettings = {\n //\n // Common\n //\n\n readonly logger: MiLogger;\n\n //\n // Signer\n //\n\n /**\n * Local secret, that is used to sign and verify different pieces of information\n * that can be used to access local data, like local paths for ongoing uploads.\n *\n * Use {@link MiddleLayer.generateLocalSecret} to generate sufficiently random string.\n * */\n readonly localSecret: string;\n\n //\n // Blob Driver\n //\n\n /**\n * Settings related to the download driver making operations with blobs. This driver is also used\n * to download logs when source process terminates and log terns into a blob\n */\n readonly blobDriverOps: DownloadDriverOps;\n\n //\n // Frontend Driver\n //\n\n /** Settings related to the frontend driver that downloads frontends. */\n readonly frontendDownloadDriverOps: DownloadUrlDriverOps;\n\n //\n // Blob To URL Driver\n //\n\n readonly downloadBlobToURLDriverOps: DownloadBlobToURLDriverOps;\n\n //\n // Upload Driver\n //\n\n /**\n * Settings related to the upload driver that actually performs upload and helps render upload\n * and indexing progresses from related pl resources.\n * */\n readonly uploadDriverOps: UploadDriverOps;\n\n //\n // Log streaming ops\n // (static logs are served via the blob driver)\n //\n\n /** Settings related to the streaming log driver */\n readonly logStreamDriverOps: LogsStreamDriverOps;\n\n //\n // LS Driver\n //\n\n /**\n * Callback to access system file open dialog, must be provided by the environment,\n * to allow for {@link showOpenSingleFileDialog} / {@link showOpenMultipleFilesDialog}\n * calls from the UI.\n */\n readonly openFileDialogCallback: OpenFileDialogCallback;\n\n //\n // PFrame Driver\n //\n\n /** Settings related to the PFrame driver */\n readonly pFrameDriverOps: PFrameDriverOps;\n};\n\nexport type DriverKitOps = DriverKitOpsPaths & DriverKitOpsSettings;\n\n/** Some defaults fot MiddleLayerOps. */\nexport const DefaultDriverKitOpsSettings: Pick<\n DriverKitOpsSettings,\n | 'logger'\n | 'blobDriverOps'\n | 'frontendDownloadDriverOps'\n | 'downloadBlobToURLDriverOps'\n | 'uploadDriverOps'\n | 'logStreamDriverOps'\n | 'pFrameDriverOps'\n> = {\n logger: new ConsoleLoggerAdapter(),\n blobDriverOps: {\n cacheSoftSizeBytes: 8 * 1024 * 1024 * 1024, // 8 GB\n rangesCacheMaxSizeBytes: 8 * 1024 * 1024 * 1024, // 8 GB\n nConcurrentDownloads: 10,\n },\n frontendDownloadDriverOps: {\n cacheSoftSizeBytes: 1 * 1024 * 1024 * 1024, // 1 GB\n withGunzip: true,\n nConcurrentDownloads: 50,\n },\n downloadBlobToURLDriverOps: {\n cacheSoftSizeBytes: 1 * 1024 * 1024 * 1024, // 1 GB\n nConcurrentDownloads: 10,\n },\n uploadDriverOps: {\n nConcurrentPartUploads: 10,\n nConcurrentGetProgresses: 10,\n pollingInterval: 1000,\n stopPollingDelay: 1000,\n },\n logStreamDriverOps: {\n nConcurrentGetLogs: 10,\n pollingInterval: 1000,\n stopPollingDelay: 1000,\n },\n pFrameDriverOps: PFrameDriverOpsDefaults,\n};\n\nexport function DefaultDriverKitOpsPaths(\n workDir: string,\n): Pick<DriverKitOpsPaths,\n| 'blobDownloadPath'\n| 'blobDownloadRangesCachePath'\n| 'downloadBlobToURLPath'\n| 'pframesSpillPath'> {\n return {\n blobDownloadPath: path.join(workDir, 'download'),\n blobDownloadRangesCachePath: path.join(workDir, 'downloadRangesCache'),\n downloadBlobToURLPath: path.join(workDir, 'downloadToURL'),\n pframesSpillPath: path.join(workDir, 'pframes'),\n };\n}\n\n/** Fields with default values are marked as optional here. */\n// prettier-ignore\nexport type DriverKitOpsConstructor =\n Omit<DriverKitOpsSettings, keyof typeof DefaultDriverKitOpsSettings>\n & Partial<typeof DefaultDriverKitOpsSettings>\n & Omit<DriverKitOpsPaths, keyof ReturnType<typeof DefaultDriverKitOpsPaths>>\n & Partial<ReturnType<typeof DefaultDriverKitOpsPaths>>;\n\nexport type MiddleLayerOpsPaths = DriverKitOpsPaths & {\n /** Common root where to put frontend code. */\n readonly frontendDownloadPath: string;\n};\n\n/** Debug options for middle layer. */\nexport type MiddleLayerDebugOptions = {\n /** If true, will dump initial tree state to the file with root resource id as name. */\n dumpInitialTreeState: boolean;\n};\n\n/** Configuration controlling different aspects of middle layer behaviour. */\nexport type MiddleLayerOpsSettings = DriverKitOpsSettings & {\n /** Debug options. */\n readonly debugOps: MiddleLayerDebugOptions;\n\n /** Contain temporal options controlling how often should pl trees be\n * synchronized with the pl server. */\n readonly defaultTreeOptions: TemporalSynchronizedTreeOps;\n\n /** Defines interval in milliseconds for running periodic project maintenance job.\n * Project maintenance includes gradual staging rendering and cached outputs cleanup. */\n readonly projectRefreshInterval: number;\n\n /** This controls average number of block staging states that are rendered per\n * second during project maintenance job execution. */\n readonly stagingRenderingRate: number;\n\n /** How often to check for dev block updates */\n readonly devBlockUpdateRecheckInterval: number;\n\n /** Prioritize this channel if update is available in this block */\n readonly preferredUpdateChannel?: string;\n};\n\nexport type MiddleLayerOps = MiddleLayerOpsSettings & MiddleLayerOpsPaths;\n\n/** Some defaults fot MiddleLayerOps. */\nexport const DefaultMiddleLayerOpsSettings: Pick<\n MiddleLayerOps,\n | keyof typeof DefaultDriverKitOpsSettings\n | 'defaultTreeOptions'\n | 'projectRefreshInterval'\n | 'stagingRenderingRate'\n | 'devBlockUpdateRecheckInterval'\n | 'debugOps'\n> = {\n ...DefaultDriverKitOpsSettings,\n defaultTreeOptions: {\n pollingInterval: 350,\n stopPollingDelay: 2500,\n initialTreeLoadingTimeout: 100 * 60 * 60 * 1000, // disable timeout for loading project tree (100 hours)\n },\n debugOps: {\n dumpInitialTreeState: false,\n },\n devBlockUpdateRecheckInterval: 1000,\n projectRefreshInterval: 700,\n stagingRenderingRate: 5,\n};\n\nexport function DefaultMiddleLayerOpsPaths(\n workDir: string,\n): Pick<\n MiddleLayerOpsPaths,\n keyof ReturnType<typeof DefaultDriverKitOpsPaths> | 'frontendDownloadPath'\n > {\n return {\n ...DefaultDriverKitOpsPaths(workDir),\n frontendDownloadPath: path.join(workDir, 'frontend'),\n };\n}\n\nexport type MiddleLayerOpsConstructor = Omit<\n MiddleLayerOpsSettings,\n keyof typeof DefaultMiddleLayerOpsSettings\n> &\nPartial<typeof DefaultMiddleLayerOpsSettings> &\nOmit<MiddleLayerOpsPaths, keyof Awaited<ReturnType<typeof DefaultMiddleLayerOpsPaths>>> &\nPartial<Awaited<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AAE,eAAe,CAAC;QAC1D,gBAAgB,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC;KAChD;AACH;AA+CA;AACO,MAAM,6BAA6B,GAQtC;AACF,IAAA,GAAG,2BAA2B;AAC9B,IAAA,kBAAkB,EAAE;AAClB,QAAA,eAAe,EAAE,GAAG;AACpB,QAAA,gBAAgB,EAAE,IAAI;QACtB,yBAAyB,EAAE,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;AAChD,KAAA;AACD,IAAA,QAAQ,EAAE;AACR,QAAA,oBAAoB,EAAE,KAAK;AAC5B,KAAA;AACD,IAAA,6BAA6B,EAAE,IAAI;AACnC,IAAA,sBAAsB,EAAE,GAAG;AAC3B,IAAA,oBAAoB,EAAE,CAAC;;AAGnB,SAAU,0BAA0B,CACxC,OAAe,EAAA;IAKf,OAAO;QACL,GAAG,wBAAwB,CAAC,OAAO,CAAC;QACpC,oBAAoB,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC;KACrD;AACH;;;;;;;"}
1
+ {"version":3,"file":"ops.cjs","sources":["../../src/middle_layer/ops.ts"],"sourcesContent":["import type { TemporalSynchronizedTreeOps } from './types';\nimport type {\n DownloadBlobToURLDriverOps,\n DownloadDriverOps,\n DownloadUrlDriverOps,\n OpenFileDialogCallback,\n VirtualLocalStorageSpec,\n} from '@milaboratories/pl-drivers';\nimport type { UploadDriverOps } from '@milaboratories/pl-drivers';\nimport type { LogsStreamDriverOps } from '@milaboratories/pl-drivers';\nimport type { MiLogger } from '@milaboratories/ts-helpers';\nimport { ConsoleLoggerAdapter } from '@milaboratories/ts-helpers';\nimport type { LocalStorageProjection } from '@milaboratories/pl-drivers';\nimport path from 'node:path';\nimport { PFrameDriverOpsDefaults, type PFrameDriverOps } from '../pool';\n\n/** Paths part of {@link DriverKitOps}. */\nexport type DriverKitOpsPaths = {\n /** Common root where to put downloaded blobs / downloaded blob cache */\n readonly blobDownloadPath: string;\n\n /** Common root for a cache for range queries. */\n readonly blobDownloadRangesCachePath: string;\n\n /** Common root where to put downloaded blobs with */\n readonly downloadBlobToURLPath: string;\n\n /**\n * List of pl storages that have projections in local file system.\n *\n * This option affect two drivers:\n *\n * (1) LS driver generates \"index\" handles instead of \"upload\" for paths inside those locations\n *\n * (2) Download driver directly serves content retrieval requests for blobs from listed storages,\n * and don't apply any caching for such blobs (i.e. preventing duplication of files for Downloaded\n * type handles, making OnDemand and Downloaded handles equivalent)\n *\n * */\n readonly localProjections: LocalStorageProjection[];\n\n /**\n * List of virtual storages that will allow homogeneous access to local FSs through LS API.\n * If undefined, default list will be created.\n * */\n readonly virtualLocalStoragesOverride?: VirtualLocalStorageSpec[];\n\n /** Path to the directory where pframes will spill temporary files and store materialized views */\n readonly pframesSpillPath: string;\n};\n\n/** Options required to initialize full set of middle layer driver kit */\nexport type DriverKitOpsSettings = {\n //\n // Common\n //\n\n readonly logger: MiLogger;\n\n //\n // Signer\n //\n\n /**\n * Local secret, that is used to sign and verify different pieces of information\n * that can be used to access local data, like local paths for ongoing uploads.\n *\n * Use {@link MiddleLayer.generateLocalSecret} to generate sufficiently random string.\n * */\n readonly localSecret: string;\n\n //\n // Blob Driver\n //\n\n /**\n * Settings related to the download driver making operations with blobs. This driver is also used\n * to download logs when source process terminates and log terns into a blob\n */\n readonly blobDriverOps: DownloadDriverOps;\n\n //\n // Frontend Driver\n //\n\n /** Settings related to the frontend driver that downloads frontends. */\n readonly frontendDownloadDriverOps: DownloadUrlDriverOps;\n\n //\n // Blob To URL Driver\n //\n\n readonly downloadBlobToURLDriverOps: DownloadBlobToURLDriverOps;\n\n //\n // Upload Driver\n //\n\n /**\n * Settings related to the upload driver that actually performs upload and helps render upload\n * and indexing progresses from related pl resources.\n * */\n readonly uploadDriverOps: UploadDriverOps;\n\n //\n // Log streaming ops\n // (static logs are served via the blob driver)\n //\n\n /** Settings related to the streaming log driver */\n readonly logStreamDriverOps: LogsStreamDriverOps;\n\n //\n // LS Driver\n //\n\n /**\n * Callback to access system file open dialog, must be provided by the environment,\n * to allow for {@link showOpenSingleFileDialog} / {@link showOpenMultipleFilesDialog}\n * calls from the UI.\n */\n readonly openFileDialogCallback: OpenFileDialogCallback;\n\n //\n // PFrame Driver\n //\n\n /** Settings related to the PFrame driver */\n readonly pFrameDriverOps: PFrameDriverOps;\n};\n\nexport type DriverKitOps = DriverKitOpsPaths & DriverKitOpsSettings;\n\n/** Some defaults fot MiddleLayerOps. */\nexport const DefaultDriverKitOpsSettings: Pick<\n DriverKitOpsSettings,\n | 'logger'\n | 'blobDriverOps'\n | 'frontendDownloadDriverOps'\n | 'downloadBlobToURLDriverOps'\n | 'uploadDriverOps'\n | 'logStreamDriverOps'\n | 'pFrameDriverOps'\n> = {\n logger: new ConsoleLoggerAdapter(),\n blobDriverOps: {\n cacheSoftSizeBytes: 8 * 1024 * 1024 * 1024, // 8 GB\n rangesCacheMaxSizeBytes: 8 * 1024 * 1024 * 1024, // 8 GB\n nConcurrentDownloads: 10,\n },\n frontendDownloadDriverOps: {\n cacheSoftSizeBytes: 1 * 1024 * 1024 * 1024, // 1 GB\n withGunzip: true,\n nConcurrentDownloads: 50,\n },\n downloadBlobToURLDriverOps: {\n cacheSoftSizeBytes: 1 * 1024 * 1024 * 1024, // 1 GB\n nConcurrentDownloads: 10,\n },\n uploadDriverOps: {\n nConcurrentPartUploads: 10,\n nConcurrentGetProgresses: 10,\n pollingInterval: 1000,\n stopPollingDelay: 1000,\n },\n logStreamDriverOps: {\n nConcurrentGetLogs: 10,\n pollingInterval: 1000,\n stopPollingDelay: 1000,\n },\n pFrameDriverOps: PFrameDriverOpsDefaults,\n};\n\nexport function DefaultDriverKitOpsPaths(\n workDir: string,\n): Pick<DriverKitOpsPaths,\n| 'blobDownloadPath'\n| 'blobDownloadRangesCachePath'\n| 'downloadBlobToURLPath'\n| 'pframesSpillPath'> {\n return {\n blobDownloadPath: path.join(workDir, 'download'),\n blobDownloadRangesCachePath: path.join(workDir, 'downloadRangesCache'),\n downloadBlobToURLPath: path.join(workDir, 'downloadToURL'),\n pframesSpillPath: path.join(workDir, 'pframes'),\n };\n}\n\n/** Fields with default values are marked as optional here. */\nexport type DriverKitOpsConstructor =\n Omit<DriverKitOpsSettings, keyof typeof DefaultDriverKitOpsSettings>\n & Partial<typeof DefaultDriverKitOpsSettings>\n & Omit<DriverKitOpsPaths, keyof ReturnType<typeof DefaultDriverKitOpsPaths>>\n & Partial<ReturnType<typeof DefaultDriverKitOpsPaths>>;\n\nexport type MiddleLayerOpsPaths = DriverKitOpsPaths & {\n /** Common root where to put frontend code. */\n readonly frontendDownloadPath: string;\n};\n\n/** Debug options for middle layer. */\nexport type MiddleLayerDebugOptions = {\n /** If true, will dump initial tree state to the file with root resource id as name. */\n dumpInitialTreeState: boolean;\n};\n\n/** Configuration controlling different aspects of middle layer behaviour. */\nexport type MiddleLayerOpsSettings = DriverKitOpsSettings & {\n /** Debug options. */\n readonly debugOps: MiddleLayerDebugOptions;\n\n /** Contain temporal options controlling how often should pl trees be\n * synchronized with the pl server. */\n readonly defaultTreeOptions: TemporalSynchronizedTreeOps;\n\n /** Defines interval in milliseconds for running periodic project maintenance job.\n * Project maintenance includes gradual staging rendering and cached outputs cleanup. */\n readonly projectRefreshInterval: number;\n\n /** This controls average number of block staging states that are rendered per\n * second during project maintenance job execution. */\n readonly stagingRenderingRate: number;\n\n /** How often to check for dev block updates */\n readonly devBlockUpdateRecheckInterval: number;\n\n /** Prioritize this channel if update is available in this block */\n readonly preferredUpdateChannel?: string;\n};\n\nexport type MiddleLayerOps = MiddleLayerOpsSettings & MiddleLayerOpsPaths;\n\n/** Some defaults fot MiddleLayerOps. */\nexport const DefaultMiddleLayerOpsSettings: Pick<\n MiddleLayerOps,\n | keyof typeof DefaultDriverKitOpsSettings\n | 'defaultTreeOptions'\n | 'projectRefreshInterval'\n | 'stagingRenderingRate'\n | 'devBlockUpdateRecheckInterval'\n | 'debugOps'\n> = {\n ...DefaultDriverKitOpsSettings,\n defaultTreeOptions: {\n pollingInterval: 350,\n stopPollingDelay: 2500,\n initialTreeLoadingTimeout: 100 * 60 * 60 * 1000, // disable timeout for loading project tree (100 hours)\n },\n debugOps: {\n dumpInitialTreeState: false,\n },\n devBlockUpdateRecheckInterval: 1000,\n projectRefreshInterval: 700,\n stagingRenderingRate: 5,\n};\n\nexport function DefaultMiddleLayerOpsPaths(\n workDir: string,\n): Pick<\n MiddleLayerOpsPaths,\n keyof ReturnType<typeof DefaultDriverKitOpsPaths> | 'frontendDownloadPath'\n > {\n return {\n ...DefaultDriverKitOpsPaths(workDir),\n frontendDownloadPath: path.join(workDir, 'frontend'),\n };\n}\n\nexport type MiddleLayerOpsConstructor = Omit<\n MiddleLayerOpsSettings,\n keyof typeof DefaultMiddleLayerOpsSettings\n> &\nPartial<typeof DefaultMiddleLayerOpsSettings> &\nOmit<MiddleLayerOpsPaths, keyof Awaited<ReturnType<typeof DefaultMiddleLayerOpsPaths>>> &\nPartial<Awaited<ReturnType<typeof DefaultMiddleLayerOpsPaths>>>;\n"],"names":["ConsoleLoggerAdapter","PFrameDriverOpsDefaults"],"mappings":";;;;;;;;AAqIA;AACO,MAAM,2BAA2B,GASpC;IACF,MAAM,EAAE,IAAIA,8BAAoB,EAAE;AAClC,IAAA,aAAa,EAAE;QACb,kBAAkB,EAAE,CAAC,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI;QAC1C,uBAAuB,EAAE,CAAC,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI;AAC/C,QAAA,oBAAoB,EAAE,EAAE;AACzB,KAAA;AACD,IAAA,yBAAyB,EAAE;QACzB,kBAAkB,EAAE,CAAC,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI;AAC1C,QAAA,UAAU,EAAE,IAAI;AAChB,QAAA,oBAAoB,EAAE,EAAE;AACzB,KAAA;AACD,IAAA,0BAA0B,EAAE;QAC1B,kBAAkB,EAAE,CAAC,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI;AAC1C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E,MAAM,MAAM,sBAAsB,GAAG,oBAAoB,GAAG;IAC1D,qBAAqB;IACrB,QAAQ,CAAC,QAAQ,EAAE,uBAAuB,CAAC;IAE3C;0CACsC;IACtC,QAAQ,CAAC,kBAAkB,EAAE,2BAA2B,CAAC;IAEzD;4FACwF;IACxF,QAAQ,CAAC,sBAAsB,EAAE,MAAM,CAAC;IAExC;0DACsD;IACtD,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;IAEtC,+CAA+C;IAC/C,QAAQ,CAAC,6BAA6B,EAAE,MAAM,CAAC;IAE/C,mEAAmE;IACnE,QAAQ,CAAC,sBAAsB,CAAC,EAAE,MAAM,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,sBAAsB,GAAG,mBAAmB,CAAC;AAE1E,wCAAwC;AACxC,eAAO,MAAM,6BAA6B,EAAE,IAAI,CAC9C,cAAc,EACZ,MAAM,OAAO,2BAA2B,GACxC,oBAAoB,GACpB,wBAAwB,GACxB,sBAAsB,GACtB,+BAA+B,GAC/B,UAAU,CAcb,CAAC;AAEF,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,MAAM,GACd,IAAI,CACH,mBAAmB,EACrB,MAAM,UAAU,CAAC,OAAO,wBAAwB,CAAC,GAAG,sBAAsB,CACzE,CAKF;AAED,MAAM,MAAM,yBAAyB,GAAG,IAAI,CAC1C,sBAAsB,EACtB,MAAM,OAAO,6BAA6B,CAC3C,GACD,OAAO,CAAC,OAAO,6BAA6B,CAAC,GAC7C,IAAI,CAAC,mBAAmB,EAAE,MAAM,OAAO,CAAC,UAAU,CAAC,OAAO,0BAA0B,CAAC,CAAC,CAAC,GACvF,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,0BAA0B,CAAC,CAAC,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ops.js","sources":["../../src/middle_layer/ops.ts"],"sourcesContent":["import type { TemporalSynchronizedTreeOps } from './types';\nimport type {\n DownloadBlobToURLDriverOps,\n DownloadDriverOps,\n DownloadUrlDriverOps,\n OpenFileDialogCallback,\n VirtualLocalStorageSpec,\n} from '@milaboratories/pl-drivers';\nimport type { UploadDriverOps } from '@milaboratories/pl-drivers';\nimport type { LogsStreamDriverOps } from '@milaboratories/pl-drivers';\nimport type { MiLogger } from '@milaboratories/ts-helpers';\nimport { ConsoleLoggerAdapter } from '@milaboratories/ts-helpers';\nimport type { LocalStorageProjection } from '@milaboratories/pl-drivers';\nimport path from 'node:path';\nimport { PFrameDriverOpsDefaults, type PFrameDriverOps } from '../pool';\n\n/** Paths part of {@link DriverKitOps}. */\nexport type DriverKitOpsPaths = {\n /** Common root where to put downloaded blobs / downloaded blob cache */\n readonly blobDownloadPath: string;\n\n /** Common root for a cache for range queries. */\n readonly blobDownloadRangesCachePath: string;\n\n /** Common root where to put downloaded blobs with */\n readonly downloadBlobToURLPath: string;\n\n /**\n * List of pl storages that have projections in local file system.\n *\n * This option affect two drivers:\n *\n * (1) LS driver generates \"index\" handles instead of \"upload\" for paths inside those locations\n *\n * (2) Download driver directly serves content retrieval requests for blobs from listed storages,\n * and don't apply any caching for such blobs (i.e. preventing duplication of files for Downloaded\n * type handles, making OnDemand and Downloaded handles equivalent)\n *\n * */\n readonly localProjections: LocalStorageProjection[];\n\n /**\n * List of virtual storages that will allow homogeneous access to local FSs through LS API.\n * If undefined, default list will be created.\n * */\n readonly virtualLocalStoragesOverride?: VirtualLocalStorageSpec[];\n\n /** Path to the directory where pframes will spill temporary files and store materialized views */\n readonly pframesSpillPath: string;\n};\n\n/** Options required to initialize full set of middle layer driver kit */\nexport type DriverKitOpsSettings = {\n //\n // Common\n //\n\n readonly logger: MiLogger;\n\n //\n // Signer\n //\n\n /**\n * Local secret, that is used to sign and verify different pieces of information\n * that can be used to access local data, like local paths for ongoing uploads.\n *\n * Use {@link MiddleLayer.generateLocalSecret} to generate sufficiently random string.\n * */\n readonly localSecret: string;\n\n //\n // Blob Driver\n //\n\n /**\n * Settings related to the download driver making operations with blobs. This driver is also used\n * to download logs when source process terminates and log terns into a blob\n */\n readonly blobDriverOps: DownloadDriverOps;\n\n //\n // Frontend Driver\n //\n\n /** Settings related to the frontend driver that downloads frontends. */\n readonly frontendDownloadDriverOps: DownloadUrlDriverOps;\n\n //\n // Blob To URL Driver\n //\n\n readonly downloadBlobToURLDriverOps: DownloadBlobToURLDriverOps;\n\n //\n // Upload Driver\n //\n\n /**\n * Settings related to the upload driver that actually performs upload and helps render upload\n * and indexing progresses from related pl resources.\n * */\n readonly uploadDriverOps: UploadDriverOps;\n\n //\n // Log streaming ops\n // (static logs are served via the blob driver)\n //\n\n /** Settings related to the streaming log driver */\n readonly logStreamDriverOps: LogsStreamDriverOps;\n\n //\n // LS Driver\n //\n\n /**\n * Callback to access system file open dialog, must be provided by the environment,\n * to allow for {@link showOpenSingleFileDialog} / {@link showOpenMultipleFilesDialog}\n * calls from the UI.\n */\n readonly openFileDialogCallback: OpenFileDialogCallback;\n\n //\n // PFrame Driver\n //\n\n /** Settings related to the PFrame driver */\n readonly pFrameDriverOps: PFrameDriverOps;\n};\n\nexport type DriverKitOps = DriverKitOpsPaths & DriverKitOpsSettings;\n\n/** Some defaults fot MiddleLayerOps. */\nexport const DefaultDriverKitOpsSettings: Pick<\n DriverKitOpsSettings,\n | 'logger'\n | 'blobDriverOps'\n | 'frontendDownloadDriverOps'\n | 'downloadBlobToURLDriverOps'\n | 'uploadDriverOps'\n | 'logStreamDriverOps'\n | 'pFrameDriverOps'\n> = {\n logger: new ConsoleLoggerAdapter(),\n blobDriverOps: {\n cacheSoftSizeBytes: 8 * 1024 * 1024 * 1024, // 8 GB\n rangesCacheMaxSizeBytes: 8 * 1024 * 1024 * 1024, // 8 GB\n nConcurrentDownloads: 10,\n },\n frontendDownloadDriverOps: {\n cacheSoftSizeBytes: 1 * 1024 * 1024 * 1024, // 1 GB\n withGunzip: true,\n nConcurrentDownloads: 50,\n },\n downloadBlobToURLDriverOps: {\n cacheSoftSizeBytes: 1 * 1024 * 1024 * 1024, // 1 GB\n nConcurrentDownloads: 10,\n },\n uploadDriverOps: {\n nConcurrentPartUploads: 10,\n nConcurrentGetProgresses: 10,\n pollingInterval: 1000,\n stopPollingDelay: 1000,\n },\n logStreamDriverOps: {\n nConcurrentGetLogs: 10,\n pollingInterval: 1000,\n stopPollingDelay: 1000,\n },\n pFrameDriverOps: PFrameDriverOpsDefaults,\n};\n\nexport function DefaultDriverKitOpsPaths(\n workDir: string,\n): Pick<DriverKitOpsPaths,\n| 'blobDownloadPath'\n| 'blobDownloadRangesCachePath'\n| 'downloadBlobToURLPath'\n| 'pframesSpillPath'> {\n return {\n blobDownloadPath: path.join(workDir, 'download'),\n blobDownloadRangesCachePath: path.join(workDir, 'downloadRangesCache'),\n downloadBlobToURLPath: path.join(workDir, 'downloadToURL'),\n pframesSpillPath: path.join(workDir, 'pframes'),\n };\n}\n\n/** Fields with default values are marked as optional here. */\n// prettier-ignore\nexport type DriverKitOpsConstructor =\n Omit<DriverKitOpsSettings, keyof typeof DefaultDriverKitOpsSettings>\n & Partial<typeof DefaultDriverKitOpsSettings>\n & Omit<DriverKitOpsPaths, keyof ReturnType<typeof DefaultDriverKitOpsPaths>>\n & Partial<ReturnType<typeof DefaultDriverKitOpsPaths>>;\n\nexport type MiddleLayerOpsPaths = DriverKitOpsPaths & {\n /** Common root where to put frontend code. */\n readonly frontendDownloadPath: string;\n};\n\n/** Debug options for middle layer. */\nexport type MiddleLayerDebugOptions = {\n /** If true, will dump initial tree state to the file with root resource id as name. */\n dumpInitialTreeState: boolean;\n};\n\n/** Configuration controlling different aspects of middle layer behaviour. */\nexport type MiddleLayerOpsSettings = DriverKitOpsSettings & {\n /** Debug options. */\n readonly debugOps: MiddleLayerDebugOptions;\n\n /** Contain temporal options controlling how often should pl trees be\n * synchronized with the pl server. */\n readonly defaultTreeOptions: TemporalSynchronizedTreeOps;\n\n /** Defines interval in milliseconds for running periodic project maintenance job.\n * Project maintenance includes gradual staging rendering and cached outputs cleanup. */\n readonly projectRefreshInterval: number;\n\n /** This controls average number of block staging states that are rendered per\n * second during project maintenance job execution. */\n readonly stagingRenderingRate: number;\n\n /** How often to check for dev block updates */\n readonly devBlockUpdateRecheckInterval: number;\n\n /** Prioritize this channel if update is available in this block */\n readonly preferredUpdateChannel?: string;\n};\n\nexport type MiddleLayerOps = MiddleLayerOpsSettings & MiddleLayerOpsPaths;\n\n/** Some defaults fot MiddleLayerOps. */\nexport const DefaultMiddleLayerOpsSettings: Pick<\n MiddleLayerOps,\n | keyof typeof DefaultDriverKitOpsSettings\n | 'defaultTreeOptions'\n | 'projectRefreshInterval'\n | 'stagingRenderingRate'\n | 'devBlockUpdateRecheckInterval'\n | 'debugOps'\n> = {\n ...DefaultDriverKitOpsSettings,\n defaultTreeOptions: {\n pollingInterval: 350,\n stopPollingDelay: 2500,\n initialTreeLoadingTimeout: 100 * 60 * 60 * 1000, // disable timeout for loading project tree (100 hours)\n },\n debugOps: {\n dumpInitialTreeState: false,\n },\n devBlockUpdateRecheckInterval: 1000,\n projectRefreshInterval: 700,\n stagingRenderingRate: 5,\n};\n\nexport function DefaultMiddleLayerOpsPaths(\n workDir: string,\n): Pick<\n MiddleLayerOpsPaths,\n keyof ReturnType<typeof DefaultDriverKitOpsPaths> | 'frontendDownloadPath'\n > {\n return {\n ...DefaultDriverKitOpsPaths(workDir),\n frontendDownloadPath: path.join(workDir, 'frontend'),\n };\n}\n\nexport type MiddleLayerOpsConstructor = Omit<\n MiddleLayerOpsSettings,\n keyof typeof DefaultMiddleLayerOpsSettings\n> &\nPartial<typeof DefaultMiddleLayerOpsSettings> &\nOmit<MiddleLayerOpsPaths, keyof Awaited<ReturnType<typeof DefaultMiddleLayerOpsPaths>>> &\nPartial<Awaited<ReturnType<typeof DefaultMiddleLayerOpsPaths>>>;\n"],"names":[],"mappings":";;;;;;AAqIA;AACO,MAAM,2BAA2B,GASpC;IACF,MAAM,EAAE,IAAI,oBAAoB,EAAE;AAClC,IAAA,aAAa,EAAE;Q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A,eAAe,EAAE,GAAG;AACpB,QAAA,gBAAgB,EAAE,IAAI;QACtB,yBAAyB,EAAE,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;AAChD,KAAA;AACD,IAAA,QAAQ,EAAE;AACR,QAAA,oBAAoB,EAAE,KAAK;AAC5B,KAAA;AACD,IAAA,6BAA6B,EAAE,IAAI;AACnC,IAAA,sBAAsB,EAAE,GAAG;AAC3B,IAAA,oBAAoB,EAAE,CAAC;;AAGnB,SAAU,0BAA0B,CACxC,OAAe,EAAA;IAKf,OAAO;QACL,GAAG,wBAAwB,CAAC,OAAO,CAAC;QACpC,oBAAoB,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC;KACrD;AACH;;;;"}
1
+ {"version":3,"file":"ops.js","sources":["../../src/middle_layer/ops.ts"],"sourcesContent":["import type { TemporalSynchronizedTreeOps } from './types';\nimport type {\n DownloadBlobToURLDriverOps,\n DownloadDriverOps,\n DownloadUrlDriverOps,\n OpenFileDialogCallback,\n VirtualLocalStorageSpec,\n} from '@milaboratories/pl-drivers';\nimport type { UploadDriverOps } from '@milaboratories/pl-drivers';\nimport type { LogsStreamDriverOps } from '@milaboratories/pl-drivers';\nimport type { MiLogger } from '@milaboratories/ts-helpers';\nimport { ConsoleLoggerAdapter } from '@milaboratories/ts-helpers';\nimport type { LocalStorageProjection } from '@milaboratories/pl-drivers';\nimport path from 'node:path';\nimport { PFrameDriverOpsDefaults, type PFrameDriverOps } from '../pool';\n\n/** Paths part of {@link DriverKitOps}. */\nexport type DriverKitOpsPaths = {\n /** Common root where to put downloaded blobs / downloaded blob cache */\n readonly blobDownloadPath: string;\n\n /** Common root for a cache for range queries. */\n readonly blobDownloadRangesCachePath: string;\n\n /** Common root where to put downloaded blobs with */\n readonly downloadBlobToURLPath: string;\n\n /**\n * List of pl storages that have projections in local file system.\n *\n * This option affect two drivers:\n *\n * (1) LS driver generates \"index\" handles instead of \"upload\" for paths inside those locations\n *\n * (2) Download driver directly serves content retrieval requests for blobs from listed storages,\n * and don't apply any caching for such blobs (i.e. preventing duplication of files for Downloaded\n * type handles, making OnDemand and Downloaded handles equivalent)\n *\n * */\n readonly localProjections: LocalStorageProjection[];\n\n /**\n * List of virtual storages that will allow homogeneous access to local FSs through LS API.\n * If undefined, default list will be created.\n * */\n readonly virtualLocalStoragesOverride?: VirtualLocalStorageSpec[];\n\n /** Path to the directory where pframes will spill temporary files and store materialized views */\n readonly pframesSpillPath: string;\n};\n\n/** Options required to initialize full set of middle layer driver kit */\nexport type DriverKitOpsSettings = {\n //\n // Common\n //\n\n readonly logger: MiLogger;\n\n //\n // Signer\n //\n\n /**\n * Local secret, that is used to sign and verify different pieces of information\n * that can be used to access local data, like local paths for ongoing uploads.\n *\n * Use {@link MiddleLayer.generateLocalSecret} to generate sufficiently random string.\n * */\n readonly localSecret: string;\n\n //\n // Blob Driver\n //\n\n /**\n * Settings related to the download driver making operations with blobs. This driver is also used\n * to download logs when source process terminates and log terns into a blob\n */\n readonly blobDriverOps: DownloadDriverOps;\n\n //\n // Frontend Driver\n //\n\n /** Settings related to the frontend driver that downloads frontends. */\n readonly frontendDownloadDriverOps: DownloadUrlDriverOps;\n\n //\n // Blob To URL Driver\n //\n\n readonly downloadBlobToURLDriverOps: DownloadBlobToURLDriverOps;\n\n //\n // Upload Driver\n //\n\n /**\n * Settings related to the upload driver that actually performs upload and helps render upload\n * and indexing progresses from related pl resources.\n * */\n readonly uploadDriverOps: UploadDriverOps;\n\n //\n // Log streaming ops\n // (static logs are served via the blob driver)\n //\n\n /** Settings related to the streaming log driver */\n readonly logStreamDriverOps: LogsStreamDriverOps;\n\n //\n // LS Driver\n //\n\n /**\n * Callback to access system file open dialog, must be provided by the environment,\n * to allow for {@link showOpenSingleFileDialog} / {@link showOpenMultipleFilesDialog}\n * calls from the UI.\n */\n readonly openFileDialogCallback: OpenFileDialogCallback;\n\n //\n // PFrame Driver\n //\n\n /** Settings related to the PFrame driver */\n readonly pFrameDriverOps: PFrameDriverOps;\n};\n\nexport type DriverKitOps = DriverKitOpsPaths & DriverKitOpsSettings;\n\n/** Some defaults fot MiddleLayerOps. */\nexport const DefaultDriverKitOpsSettings: Pick<\n DriverKitOpsSettings,\n | 'logger'\n | 'blobDriverOps'\n | 'frontendDownloadDriverOps'\n | 'downloadBlobToURLDriverOps'\n | 'uploadDriverOps'\n | 'logStreamDriverOps'\n | 'pFrameDriverOps'\n> = {\n logger: new ConsoleLoggerAdapter(),\n blobDriverOps: {\n cacheSoftSizeBytes: 8 * 1024 * 1024 * 1024, // 8 GB\n rangesCacheMaxSizeBytes: 8 * 1024 * 1024 * 1024, // 8 GB\n nConcurrentDownloads: 10,\n },\n frontendDownloadDriverOps: {\n cacheSoftSizeBytes: 1 * 1024 * 1024 * 1024, // 1 GB\n withGunzip: true,\n nConcurrentDownloads: 50,\n },\n downloadBlobToURLDriverOps: {\n cacheSoftSizeBytes: 1 * 1024 * 1024 * 1024, // 1 GB\n nConcurrentDownloads: 10,\n },\n uploadDriverOps: {\n nConcurrentPartUploads: 10,\n nConcurrentGetProgresses: 10,\n pollingInterval: 1000,\n stopPollingDelay: 1000,\n },\n logStreamDriverOps: {\n nConcurrentGetLogs: 10,\n pollingInterval: 1000,\n stopPollingDelay: 1000,\n },\n pFrameDriverOps: PFrameDriverOpsDefaults,\n};\n\nexport function DefaultDriverKitOpsPaths(\n workDir: string,\n): Pick<DriverKitOpsPaths,\n| 'blobDownloadPath'\n| 'blobDownloadRangesCachePath'\n| 'downloadBlobToURLPath'\n| 'pframesSpillPath'> {\n return {\n blobDownloadPath: path.join(workDir, 'download'),\n blobDownloadRangesCachePath: path.join(workDir, 'downloadRangesCache'),\n downloadBlobToURLPath: path.join(workDir, 'downloadToURL'),\n pframesSpillPath: path.join(workDir, 'pframes'),\n };\n}\n\n/** Fields with default values are marked as optional here. */\nexport type DriverKitOpsConstructor =\n Omit<DriverKitOpsSettings, keyof typeof DefaultDriverKitOpsSettings>\n & Partial<typeof DefaultDriverKitOpsSettings>\n & Omit<DriverKitOpsPaths, keyof ReturnType<typeof DefaultDriverKitOpsPaths>>\n & Partial<ReturnType<typeof DefaultDriverKitOpsPaths>>;\n\nexport type MiddleLayerOpsPaths = DriverKitOpsPaths & {\n /** Common root where to put frontend code. */\n readonly frontendDownloadPath: string;\n};\n\n/** Debug options for middle layer. */\nexport type MiddleLayerDebugOptions = {\n /** If true, will dump initial tree state to the file with root resource id as name. */\n dumpInitialTreeState: boolean;\n};\n\n/** Configuration controlling different aspects of middle layer behaviour. */\nexport type MiddleLayerOpsSettings = DriverKitOpsSettings & {\n /** Debug options. */\n readonly debugOps: MiddleLayerDebugOptions;\n\n /** Contain temporal options controlling how often should pl trees be\n * synchronized with the pl server. */\n readonly defaultTreeOptions: TemporalSynchronizedTreeOps;\n\n /** Defines interval in milliseconds for running periodic project maintenance job.\n * Project maintenance includes gradual staging rendering and cached outputs cleanup. */\n readonly projectRefreshInterval: number;\n\n /** This controls average number of block staging states that are rendered per\n * second during project maintenance job execution. */\n readonly stagingRenderingRate: number;\n\n /** How often to check for dev block updates */\n readonly devBlockUpdateRecheckInterval: number;\n\n /** Prioritize this channel if update is available in this block */\n readonly preferredUpdateChannel?: string;\n};\n\nexport type MiddleLayerOps = MiddleLayerOpsSettings & MiddleLayerOpsPaths;\n\n/** Some defaults fot MiddleLayerOps. */\nexport const DefaultMiddleLayerOpsSettings: Pick<\n MiddleLayerOps,\n | keyof typeof DefaultDriverKitOpsSettings\n | 'defaultTreeOptions'\n | 'projectRefreshInterval'\n | 'stagingRenderingRate'\n | 'devBlockUpdateRecheckInterval'\n | 'debugOps'\n> = {\n ...DefaultDriverKitOpsSettings,\n defaultTreeOptions: {\n pollingInterval: 350,\n stopPollingDelay: 2500,\n initialTreeLoadingTimeout: 100 * 60 * 60 * 1000, // disable timeout for loading project tree (100 hours)\n },\n debugOps: {\n dumpInitialTreeState: false,\n },\n devBlockUpdateRecheckInterval: 1000,\n projectRefreshInterval: 700,\n stagingRenderingRate: 5,\n};\n\nexport function DefaultMiddleLayerOpsPaths(\n workDir: string,\n): Pick<\n MiddleLayerOpsPaths,\n keyof ReturnType<typeof DefaultDriverKitOpsPaths> | 'frontendDownloadPath'\n > {\n return {\n ...DefaultDriverKitOpsPaths(workDir),\n frontendDownloadPath: path.join(workDir, 'frontend'),\n };\n}\n\nexport type MiddleLayerOpsConstructor = Omit<\n MiddleLayerOpsSettings,\n keyof typeof DefaultMiddleLayerOpsSettings\n> &\nPartial<typeof DefaultMiddleLayerOpsSettings> &\nOmit<MiddleLayerOpsPaths, keyof Awaited<ReturnType<typeof DefaultMiddleLayerOpsPaths>>> &\nPartial<Awaited<ReturnType<typeof DefaultMiddleLayerOpsPaths>>>;\n"],"names":[],"mappings":";;;;;;AAqIA;AACO,MAAM,2BAA2B,GASpC;IACF,MAAM,EAAE,IAAI,oBAAoB,EAAE;AAClC,IAAA,aAAa,EAAE;QACb,kBAAkB,EAAE,CAAC,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI;QAC1C,uBAAuB,EAAE,CAAC,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI;AAC/C,QAAA,oBAAoB,EAAE,EAAE;AACzB,KAAA;AACD,IAAA,yBAAyB,EAAE;QACzB,kBAAkB,EAAE,CAAC,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI;AAC1C,QAAA,UAAU,EAAE,IAAI;AAChB,QAAA,oBAAoB,EAAE,EAAE;AACzB,KAAA;AACD,IAAA,0BAA0B,EAAE;QAC1B,kBAAkB,EAAE,CAAC,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI;AAC1C,QAAA,oBAAoB,EAAE,EAAE;AACzB,KAAA;AACD,IAAA,eAAe,EAAE;AACf,QAAA,sBAAsB,EAAE,EAAE;AAC1B,QAAA,wBAAwB,EAAE,EAAE;AAC5B,QAAA,eAAe,EAAE,IAAI;AACrB,QAAA,gBAAgB,EAAE,IAAI;AACvB,KAAA;AACD,IAAA,kBAAkB,EAAE;AAClB,QAAA,kBAAkB,EAAE,EAAE;AACtB,QAAA,eAAe,EAAE,IAAI;AACrB,QAAA,gBAAgB,EAAE,IAAI;AACvB,KAAA;AACD,IAAA,eAAe,EAAE,uBAAuB;;AAGpC,SAAU,wBAAwB,CACtC,OAAe,EAAA;IAMf,OAAO;QACL,gBAAgB,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC;QAChD,2BAA2B,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,qBAAqB,CAAC;QACtE,qBAAqB,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,eAAe,CAAC;QAC1D,gBAAgB,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC;KAChD;AACH;AA8CA;AACO,MAAM,6BAA6B,GAQtC;AACF,IAAA,GAAG,2BAA2B;AAC9B,IAAA,kBAAkB,EAAE;AAClB,QAAA,eAAe,EAAE,GAAG;AACpB,QAAA,gBAAgB,EAAE,IAAI;QACtB,yBAAyB,EAAE,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;AAChD,KAAA;AACD,IAAA,QAAQ,EAAE;AACR,QAAA,oBAAoB,EAAE,KAAK;AAC5B,KAAA;AACD,IAAA,6BAA6B,EAAE,IAAI;AACnC,IAAA,sBAAsB,EAAE,GAAG;AAC3B,IAAA,oBAAoB,EAAE,CAAC;;AAGnB,SAAU,0BAA0B,CACxC,OAAe,EAAA;IAKf,OAAO;QACL,GAAG,wBAAwB,CAAC,OAAO,CAAC;QACpC,oBAAoB,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC;KACrD;AACH;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milaboratories/pl-middle-layer",
3
- "version": "1.43.98",
3
+ "version": "1.43.99",
4
4
  "description": "Pl Middle Layer",
5
5
  "engines": {
6
6
  "node": ">=22.19.0"
@@ -27,33 +27,35 @@
27
27
  "zod": "~3.23.8",
28
28
  "remeda": "^2.28.0",
29
29
  "@milaboratories/pl-http": "1.2.0",
30
- "@platforma-sdk/block-tools": "2.6.27",
31
- "@milaboratories/pl-drivers": "1.11.30",
32
30
  "@milaboratories/computable": "2.7.5",
33
31
  "@milaboratories/resolve-helper": "1.1.1",
34
- "@milaboratories/pl-model-middle-layer": "1.8.45",
35
- "@milaboratories/pl-client": "2.16.14",
32
+ "@platforma-sdk/block-tools": "2.6.27",
36
33
  "@milaboratories/pl-model-common": "1.21.10",
37
- "@milaboratories/pl-model-backend": "1.1.31",
34
+ "@milaboratories/pl-client": "2.16.14",
35
+ "@milaboratories/pl-drivers": "1.11.30",
36
+ "@milaboratories/pl-model-middle-layer": "1.8.45",
38
37
  "@milaboratories/pl-tree": "1.8.22",
39
- "@platforma-sdk/workflow-tengo": "5.7.3",
40
38
  "@milaboratories/ts-helpers": "1.5.4",
41
- "@platforma-sdk/model": "1.48.12",
39
+ "@milaboratories/pl-model-backend": "1.1.31",
40
+ "@platforma-sdk/model": "1.48.13",
42
41
  "@milaboratories/pl-config": "1.7.9",
42
+ "@platforma-sdk/workflow-tengo": "5.7.3",
43
43
  "@milaboratories/pl-errors": "1.1.46",
44
44
  "@milaboratories/pl-deployments": "2.14.0",
45
- "@milaboratories/pf-driver": "1.0.15"
45
+ "@milaboratories/pf-driver": "1.0.16"
46
46
  },
47
47
  "devDependencies": {
48
48
  "semver": "^7.7.2",
49
49
  "@types/semver": "^7.7.0",
50
50
  "typescript": "~5.6.3",
51
- "vitest": "^4.0.7",
51
+ "vitest": "^4.0.16",
52
+ "@vitest/coverage-istanbul": "^4.0.16",
53
+ "eslint": "^9.25.1",
52
54
  "@types/node": "~24.5.2",
53
55
  "tslib": "~2.7.0",
54
56
  "@milaboratories/build-configs": "1.2.1",
55
- "@milaboratories/eslint-config": "1.0.5",
56
57
  "@milaboratories/ts-builder": "1.2.1",
58
+ "@milaboratories/eslint-config": "1.0.5",
57
59
  "@milaboratories/ts-configs": "1.2.0"
58
60
  },
59
61
  "scripts": {
@@ -61,7 +63,7 @@
61
63
  "build": "ts-builder build --target node --build-config ./build.node.config.mjs",
62
64
  "watch": "ts-builder build --target node --build-config ./build.node.config.mjs --watch",
63
65
  "lint": "eslint .",
64
- "test": "vitest run",
66
+ "test": "vitest run --coverage",
65
67
  "do-pack": "rm -f *.tgz && pnpm pack && mv *.tgz package.tgz"
66
68
  }
67
69
  }
@@ -15,7 +15,7 @@ import { getDevV1PacketMtime, getDevV2PacketMtime } from './registry';
15
15
  import { tryLoadPackDescription } from '@platforma-sdk/block-tools';
16
16
  import type { MiLogger } from '@milaboratories/ts-helpers';
17
17
  import type { V2RegistryProvider } from './registry-v2-provider';
18
- import semver from 'semver';
18
+ import * as semver from 'semver';
19
19
  import canonicalize from 'canonicalize';
20
20
 
21
21
  export const DefaultBlockUpdateWatcherOps: PollPoolOps = {
@@ -187,7 +187,6 @@ export function DefaultDriverKitOpsPaths(
187
187
  }
188
188
 
189
189
  /** Fields with default values are marked as optional here. */
190
- // prettier-ignore
191
190
  export type DriverKitOpsConstructor =
192
191
  Omit<DriverKitOpsSettings, keyof typeof DefaultDriverKitOpsSettings>
193
192
  & Partial<typeof DefaultDriverKitOpsSettings>
@@ -1,8 +0,0 @@
1
- 'use strict';
2
-
3
- function getDefaultExportFromCjs (x) {
4
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
5
- }
6
-
7
- exports.getDefaultExportFromCjs = getDefaultExportFromCjs;
8
- //# sourceMappingURL=_commonjsHelpers.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"_commonjsHelpers.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
@@ -1,6 +0,0 @@
1
- function getDefaultExportFromCjs (x) {
2
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
3
- }
4
-
5
- export { getDefaultExportFromCjs };
6
- //# sourceMappingURL=_commonjsHelpers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"_commonjsHelpers.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}