@milaboratories/pl-model-middle-layer 1.8.41 → 1.8.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/dist/block_meta/block_components.cjs +4 -4
  2. package/dist/block_meta/block_components.cjs.map +1 -1
  3. package/dist/block_meta/block_components.d.ts +0 -1
  4. package/dist/block_meta/block_components.d.ts.map +1 -1
  5. package/dist/block_meta/block_components.js +4 -4
  6. package/dist/block_meta/block_components.js.map +1 -1
  7. package/dist/block_meta/block_description.cjs +2 -2
  8. package/dist/block_meta/block_description.cjs.map +1 -1
  9. package/dist/block_meta/block_description.d.ts +116 -115
  10. package/dist/block_meta/block_description.d.ts.map +1 -1
  11. package/dist/block_meta/block_description.js +2 -2
  12. package/dist/block_meta/block_description.js.map +1 -1
  13. package/dist/block_meta/block_id.cjs +1 -1
  14. package/dist/block_meta/block_id.cjs.map +1 -1
  15. package/dist/block_meta/block_id.js +1 -1
  16. package/dist/block_meta/block_id.js.map +1 -1
  17. package/dist/block_meta/block_manifest.cjs +2 -2
  18. package/dist/block_meta/block_manifest.cjs.map +1 -1
  19. package/dist/block_meta/block_manifest.d.ts +1 -1
  20. package/dist/block_meta/block_manifest.d.ts.map +1 -1
  21. package/dist/block_meta/block_manifest.js +2 -2
  22. package/dist/block_meta/block_manifest.js.map +1 -1
  23. package/dist/block_meta/block_meta.cjs +3 -3
  24. package/dist/block_meta/block_meta.cjs.map +1 -1
  25. package/dist/block_meta/block_meta.js +3 -3
  26. package/dist/block_meta/block_meta.js.map +1 -1
  27. package/dist/block_meta/content_conversion.cjs.map +1 -1
  28. package/dist/block_meta/content_conversion.d.ts +1 -1
  29. package/dist/block_meta/content_conversion.d.ts.map +1 -1
  30. package/dist/block_meta/content_conversion.js.map +1 -1
  31. package/dist/block_meta/content_types.cjs +23 -23
  32. package/dist/block_meta/content_types.cjs.map +1 -1
  33. package/dist/block_meta/content_types.js +23 -23
  34. package/dist/block_meta/content_types.js.map +1 -1
  35. package/dist/block_meta/semver.cjs.map +1 -1
  36. package/dist/block_meta/semver.js.map +1 -1
  37. package/dist/block_registry/block_pack_spec.cjs +5 -5
  38. package/dist/block_registry/block_pack_spec.cjs.map +1 -1
  39. package/dist/block_registry/block_pack_spec.js +5 -5
  40. package/dist/block_registry/block_pack_spec.js.map +1 -1
  41. package/dist/block_registry/overview.cjs +6 -6
  42. package/dist/block_registry/overview.cjs.map +1 -1
  43. package/dist/block_registry/overview.d.ts.map +1 -1
  44. package/dist/block_registry/overview.js +6 -6
  45. package/dist/block_registry/overview.js.map +1 -1
  46. package/dist/block_registry/registry_spec.cjs +5 -5
  47. package/dist/block_registry/registry_spec.cjs.map +1 -1
  48. package/dist/block_registry/registry_spec.js +5 -5
  49. package/dist/block_registry/registry_spec.js.map +1 -1
  50. package/dist/block_state.d.ts +2 -2
  51. package/dist/block_state.d.ts.map +1 -1
  52. package/dist/pframe/internal_api/api_factory.cjs.map +1 -1
  53. package/dist/pframe/internal_api/api_factory.d.ts +2 -2
  54. package/dist/pframe/internal_api/api_factory.d.ts.map +1 -1
  55. package/dist/pframe/internal_api/api_factory.js.map +1 -1
  56. package/dist/pframe/internal_api/api_read.d.ts +34 -6
  57. package/dist/pframe/internal_api/api_read.d.ts.map +1 -1
  58. package/dist/pframe/internal_api/common.d.ts +3 -1
  59. package/dist/pframe/internal_api/common.d.ts.map +1 -1
  60. package/dist/pframe/internal_api/create_table.d.ts +2 -2
  61. package/dist/pframe/internal_api/create_table.d.ts.map +1 -1
  62. package/dist/pframe/internal_api/delete_column.d.ts +1 -1
  63. package/dist/pframe/internal_api/delete_column.d.ts.map +1 -1
  64. package/dist/pframe/internal_api/find_columns.d.ts +2 -2
  65. package/dist/pframe/internal_api/find_columns.d.ts.map +1 -1
  66. package/dist/pframe/internal_api/http_helpers.cjs.map +1 -1
  67. package/dist/pframe/internal_api/http_helpers.d.ts +27 -27
  68. package/dist/pframe/internal_api/http_helpers.d.ts.map +1 -1
  69. package/dist/pframe/internal_api/http_helpers.js.map +1 -1
  70. package/dist/pframe/internal_api/pframe.d.ts +28 -1
  71. package/dist/pframe/internal_api/pframe.d.ts.map +1 -1
  72. package/dist/pframe/internal_api/table.d.ts +55 -2
  73. package/dist/pframe/internal_api/table.d.ts.map +1 -1
  74. package/dist/project_list.d.ts +1 -1
  75. package/dist/project_list.d.ts.map +1 -1
  76. package/dist/project_overview.d.ts +5 -5
  77. package/dist/project_overview.d.ts.map +1 -1
  78. package/dist/update_info.d.ts +1 -1
  79. package/dist/update_info.d.ts.map +1 -1
  80. package/package.json +7 -4
  81. package/src/block_meta/block_components.ts +6 -8
  82. package/src/block_meta/block_description.ts +8 -7
  83. package/src/block_meta/block_id.ts +4 -4
  84. package/src/block_meta/block_manifest.ts +5 -5
  85. package/src/block_meta/block_meta.ts +8 -8
  86. package/src/block_meta/content_conversion.ts +4 -4
  87. package/src/block_meta/content_types.ts +24 -24
  88. package/src/block_meta/semver.ts +1 -1
  89. package/src/block_registry/block_pack_spec.ts +5 -5
  90. package/src/block_registry/overview.ts +10 -9
  91. package/src/block_registry/registry_spec.ts +5 -5
  92. package/src/block_state.ts +3 -3
  93. package/src/pframe/internal_api/api_factory.ts +3 -6
  94. package/src/pframe/internal_api/api_read.ts +49 -8
  95. package/src/pframe/internal_api/common.ts +11 -2
  96. package/src/pframe/internal_api/create_table.ts +3 -3
  97. package/src/pframe/internal_api/delete_column.ts +1 -1
  98. package/src/pframe/internal_api/find_columns.ts +2 -2
  99. package/src/pframe/internal_api/http_helpers.ts +44 -44
  100. package/src/pframe/internal_api/pframe.ts +36 -2
  101. package/src/pframe/internal_api/table.ts +75 -7
  102. package/src/project_list.ts +1 -1
  103. package/src/project_overview.ts +5 -5
  104. package/src/update_info.ts +1 -1
@@ -1,8 +1,8 @@
1
- import { ProjectMeta } from './project';
2
- import { BlockPackSpec } from './block_registry/block_pack_spec';
3
- import { BlockCodeFeatureFlags, BlockRenderingMode, BlockSection, NavigationState, AuthorMarker } from '@milaboratories/pl-model-common';
4
- import { UpdateSuggestions } from './update_info';
5
- import { BlockSettings } from './block_settings';
1
+ import type { ProjectMeta } from './project';
2
+ import type { BlockPackSpec } from './block_registry/block_pack_spec';
3
+ import type { BlockCodeFeatureFlags, BlockRenderingMode, BlockSection, NavigationState, AuthorMarker } from '@milaboratories/pl-model-common';
4
+ import type { UpdateSuggestions } from './update_info';
5
+ import type { BlockSettings } from './block_settings';
6
6
  /** Generalized block status, to be used in block item "styling". */
7
7
  export type BlockCalculationStatus = 'NotCalculated' | 'Running' | 'Done' | 'Limbo';
8
8
  /** Overview of the whole project state, required to render a left panel. */
@@ -1 +1 @@
1
- {"version":3,"file":"project_overview.d.ts","sourceRoot":"","sources":["../src/project_overview.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,YAAY,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AACzI,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,oEAAoE;AACpE,MAAM,MAAM,sBAAsB,GAAG,eAAe,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;AAEpF,4EAA4E;AAC5E,MAAM,MAAM,eAAe,GAAG;IAC5B,+DAA+D;IAC/D,IAAI,EAAE,WAAW,CAAC;IAElB,0BAA0B;IAC1B,OAAO,EAAE,IAAI,CAAC;IAEd,mCAAmC;IACnC,YAAY,EAAE,IAAI,CAAC;IAEnB;;;;;;SAMK;IACL,YAAY,CAAC,EAAE,YAAY,CAAC;IAE5B,0CAA0C;IAC1C,MAAM,EAAE,kBAAkB,EAAE,CAAC;CAC9B,CAAC;AAEF,gFAAgF;AAChF,MAAM,MAAM,kBAAkB,GAAG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AC;IAEf;;;SAGK;IACL,YAAY,EAAE,OAAO,CAAC;IAEtB;;;SAGK;IACL,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;SAGK;IACL,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,2CAA2C;IAC3C,iBAAiB,EAAE,sBAAsB,CAAC;IAE1C;;;SAGK;IACL,SAAS,EAAE,MAAM,EAAE,CAAC;IAEpB;;;SAGK;IACL,WAAW,EAAE,MAAM,EAAE,CAAC;IAEtB;;;SAGK;IACL,QAAQ,EAAE,YAAY,EAAE,GAAG,SAAS,CAAC;IAErC;;;SAGK;IACL,WAAW,EAAE,OAAO,GAAG,SAAS,CAAC;IAEjC;;;SAGK;IACL,MAAM,EAAE,OAAO,CAAC;IAEhB;;;SAGK;IACL,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAE/B;;;SAGK;IACL,YAAY,EAAE,qBAAqB,GAAG,SAAS,CAAC;IAEhD;;;;;SAKK;IACL,yBAAyB,EAAE,OAAO,GAAG,SAAS,CAAC;IAE/C,mEAAmE;IACnE,gBAAgB,EAAE,aAAa,GAAG,SAAS,CAAC;IAE5C;;;SAGK;IACL,gBAAgB,EAAE,aAAa,GAAG,SAAS,CAAC;IAE5C,6BAA6B;IAC7B,QAAQ,EAAE,aAAa,CAAC;IAExB,8BAA8B;IAC9B,iBAAiB,EAAE,iBAAiB,CAAC;IAErC,4CAA4C;IAC5C,eAAe,EAAE,eAAe,CAAC;CAClC,CAAC"}
@@ -1,4 +1,4 @@
1
- import { BlockPackSpec } from './block_registry';
1
+ import type { BlockPackSpec } from './block_registry';
2
2
  /** Communicates possible block update option */
3
3
  export type UpdateSuggestion<V = BlockPackSpec> = {
4
4
  type: 'major' | 'minor' | 'patch';
@@ -1 +1 @@
1
- {"version":3,"file":"update_info.d.ts","sourceRoot":"","sources":["../src/update_info.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,gDAAgD;AAChD,MAAM,MAAM,gBAAgB,CAAC,CAAC,GAAG,aAAa,IAAI;IAChD,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;IAClC,MAAM,EAAE,CAAC,CAAC;CACX,CAAC;AAEF,iDAAiD;AACjD,MAAM,MAAM,iBAAiB,CAAC,CAAC,GAAG,aAAa,IAAI,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC"}
1
+ {"version":3,"file":"update_info.d.ts","sourceRoot":"","sources":["../src/update_info.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,gDAAgD;AAChD,MAAM,MAAM,gBAAgB,CAAC,CAAC,GAAG,aAAa,IAAI;IAChD,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;IAClC,MAAM,EAAE,CAAC,CAAC;CACX,CAAC;AAEF,iDAAiD;AACjD,MAAM,MAAM,iBAAiB,CAAC,CAAC,GAAG,aAAa,IAAI,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milaboratories/pl-model-middle-layer",
3
- "version": "1.8.41",
3
+ "version": "1.8.42",
4
4
  "description": "Common model between middle layer and non-block UI code",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",
@@ -20,19 +20,22 @@
20
20
  "remeda": "^2.28.0",
21
21
  "zod": "~3.23.8",
22
22
  "utility-types": "^3.11.0",
23
- "@milaboratories/pl-model-common": "1.21.7"
23
+ "@milaboratories/pl-model-common": "1.21.8"
24
24
  },
25
25
  "devDependencies": {
26
+ "eslint": "^9.25.1",
26
27
  "typescript": "~5.6.3",
27
28
  "@types/node": "~24.5.2",
28
- "@milaboratories/ts-builder": "1.0.5",
29
29
  "@milaboratories/build-configs": "1.0.8",
30
- "@milaboratories/ts-configs": "1.0.6"
30
+ "@platforma-sdk/eslint-config": "1.1.0",
31
+ "@milaboratories/ts-configs": "1.0.6",
32
+ "@milaboratories/ts-builder": "1.0.5"
31
33
  },
32
34
  "scripts": {
33
35
  "type-check": "ts-builder types --target node",
34
36
  "build": "ts-builder build --target node",
35
37
  "watch": "ts-builder build --target node --watch",
38
+ "lint": "eslint .",
36
39
  "do-pack": "rm -f *.tgz && pnpm pack && mv *.tgz package.tgz"
37
40
  }
38
41
  }
@@ -2,12 +2,10 @@ import { z } from 'zod';
2
2
  import { ContentRelativeBinary } from './content_types';
3
3
  import { mapRemoteToAbsolute } from './content_conversion';
4
4
 
5
- export type BlockPackComponents = {};
6
-
7
5
  export function WorkflowV1<const Content extends z.ZodTypeAny>(contentType: Content) {
8
6
  return z.object({
9
7
  type: z.literal('workflow-v1'),
10
- main: contentType.describe('Main workflow')
8
+ main: contentType.describe('Main workflow'),
11
9
  });
12
10
  }
13
11
 
@@ -17,22 +15,22 @@ export function Workflow<const Content extends z.ZodTypeAny>(contentType: Conten
17
15
  contentType
18
16
  .transform((value: z.infer<typeof contentType>) => ({
19
17
  type: 'workflow-v1' as const,
20
- main: value
18
+ main: value,
21
19
  }))
22
20
  .pipe(WorkflowV1(contentType)),
23
21
  // structured objects are decoded as union with type descriptor
24
- z.discriminatedUnion('type', [WorkflowV1(contentType)])
22
+ z.discriminatedUnion('type', [WorkflowV1(contentType)]),
25
23
  ]);
26
24
  }
27
25
 
28
26
  export function BlockComponents<
29
27
  const WfAndModel extends z.ZodTypeAny,
30
- const UI extends z.ZodTypeAny
28
+ const UI extends z.ZodTypeAny,
31
29
  >(wfAndModel: WfAndModel, ui: UI) {
32
30
  return z.object({
33
31
  workflow: Workflow(wfAndModel),
34
32
  model: wfAndModel,
35
- ui
33
+ ui,
36
34
  });
37
35
  }
38
36
 
@@ -42,7 +40,7 @@ export type BlockComponentsDescriptionRaw = z.infer<typeof BlockComponentsDescri
42
40
  export function BlockComponentsAbsoluteUrl(prefix: string) {
43
41
  return BlockComponents(
44
42
  ContentRelativeBinary.transform(mapRemoteToAbsolute(prefix)),
45
- ContentRelativeBinary.transform(mapRemoteToAbsolute(prefix))
43
+ ContentRelativeBinary.transform(mapRemoteToAbsolute(prefix)),
46
44
  );
47
45
  }
48
46
  export type BlockComponentsAbsolute = z.infer<ReturnType<typeof BlockComponentsAbsoluteUrl>>;
@@ -1,16 +1,17 @@
1
- import { z, ZodTypeAny } from 'zod';
1
+ import type { ZodTypeAny } from 'zod';
2
+ import { z } from 'zod';
2
3
  import { BlockComponentsDescriptionRaw } from './block_components';
3
4
  import { BlockPackMetaDescriptionRaw } from './block_meta';
4
5
  import { BlockPackId } from './block_id';
5
6
  import * as R from 'remeda';
6
- import { BlockCodeKnownFeatureFlags } from '@milaboratories/pl-model-common';
7
+ import type { BlockCodeKnownFeatureFlags } from '@milaboratories/pl-model-common';
7
8
 
8
9
  /** Description, as appears in root block package.json file,
9
10
  * `file:` references are parsed into relative content of corresponding type, depending on the context,
10
11
  * strings are converted to explicit content type. */
11
12
  export const BlockPackDescriptionFromPackageJsonRaw = z.object({
12
13
  components: BlockComponentsDescriptionRaw,
13
- meta: BlockPackMetaDescriptionRaw
14
+ meta: BlockPackMetaDescriptionRaw,
14
15
  });
15
16
 
16
17
  export const FeatureFlags = z.record(z.string(), z.union([z.boolean(), z.number()]))
@@ -18,25 +19,25 @@ export const FeatureFlags = z.record(z.string(), z.union([z.boolean(), z.number(
18
19
 
19
20
  export function CreateBlockPackDescriptionSchema<
20
21
  Components extends ZodTypeAny,
21
- Meta extends ZodTypeAny
22
+ Meta extends ZodTypeAny,
22
23
  >(components: Components, meta: Meta) {
23
24
  return z.object({
24
25
  id: BlockPackId,
25
26
  components,
26
27
  meta,
27
- featureFlags: FeatureFlags.optional()
28
+ featureFlags: FeatureFlags.optional(),
28
29
  }).passthrough();
29
30
  }
30
31
 
31
32
  export const BlockPackDescriptionRaw = CreateBlockPackDescriptionSchema(
32
33
  BlockComponentsDescriptionRaw,
33
- BlockPackMetaDescriptionRaw
34
+ BlockPackMetaDescriptionRaw,
34
35
  );
35
36
  export type BlockPackDescriptionRaw = z.infer<typeof BlockPackDescriptionRaw>;
36
37
 
37
38
  export function overrideDescriptionVersion<T extends { id: BlockPackId }>(
38
39
  manifest: T,
39
- newVersion: string
40
+ newVersion: string,
40
41
  ): T {
41
42
  return R.mergeDeep(manifest, { id: { version: newVersion } }) as T;
42
43
  }
@@ -6,7 +6,7 @@ export const BlockPackId = z
6
6
  .object({
7
7
  organization: z.string(),
8
8
  name: z.string(),
9
- version: SemVer
9
+ version: SemVer,
10
10
  })
11
11
  .strict();
12
12
  export type BlockPackId = z.infer<typeof BlockPackId>;
@@ -26,7 +26,7 @@ export function blockPackIdNoVersionToString(
26
26
  bp: BlockPackIdNoVersion | undefined
27
27
  ): string | undefined;
28
28
  export function blockPackIdNoVersionToString(
29
- bp: BlockPackIdNoVersion | undefined
29
+ bp: BlockPackIdNoVersion | undefined,
30
30
  ): string | undefined {
31
31
  if (bp === undefined) return undefined;
32
32
  return `${bp.organization}:${bp.name}`;
@@ -34,7 +34,7 @@ export function blockPackIdNoVersionToString(
34
34
 
35
35
  export function blockPackIdEquals(
36
36
  bp1: BlockPackId | undefined,
37
- bp2: BlockPackId | undefined
37
+ bp2: BlockPackId | undefined,
38
38
  ): boolean {
39
39
  if (bp1 === undefined && bp2 === undefined) return true;
40
40
  if (bp1 === undefined || bp2 === undefined) return false;
@@ -45,7 +45,7 @@ export function blockPackIdEquals(
45
45
 
46
46
  export function blockPackIdNoVersionEquals(
47
47
  bp1: BlockPackIdNoVersion | undefined,
48
- bp2: BlockPackIdNoVersion | undefined
48
+ bp2: BlockPackIdNoVersion | undefined,
49
49
  ): boolean {
50
50
  if (bp1 === undefined && bp2 === undefined) return true;
51
51
  if (bp1 === undefined || bp2 === undefined) return false;
@@ -4,7 +4,7 @@ import { ContentRelative, ContentRelativeBinary, ContentRelativeText } from './c
4
4
  import { CreateBlockPackDescriptionSchema } from './block_description';
5
5
  import { BlockPackMeta } from './block_meta';
6
6
  import * as R from 'remeda';
7
- import { BlockPackId } from './block_id';
7
+ import type { BlockPackId } from './block_id';
8
8
 
9
9
  export const BlockComponentsManifest = BlockComponents(ContentRelative, ContentRelative);
10
10
  export type BlockComponentsManifest = z.infer<typeof BlockComponentsManifest>;
@@ -15,7 +15,7 @@ export type BlockPackMetaManifest = z.infer<typeof BlockPackMetaManifest>;
15
15
  /** Block description to be used in block manifest */
16
16
  export const BlockPackDescriptionManifest = CreateBlockPackDescriptionSchema(
17
17
  BlockComponentsManifest,
18
- BlockPackMetaManifest
18
+ BlockPackMetaManifest,
19
19
  );
20
20
  export type BlockPackDescriptionManifest = z.infer<typeof BlockPackDescriptionManifest>;
21
21
 
@@ -28,7 +28,7 @@ export const Sha256Schema = z
28
28
  export const ManifestFileInfo = z.object({
29
29
  name: z.string(),
30
30
  size: z.number().int(),
31
- sha256: Sha256Schema
31
+ sha256: Sha256Schema,
32
32
  });
33
33
  export type ManifestFileInfo = z.infer<typeof ManifestFileInfo>;
34
34
 
@@ -36,7 +36,7 @@ export const BlockPackManifest = z.object({
36
36
  schema: z.literal('v2'),
37
37
  description: BlockPackDescriptionManifest,
38
38
  timestamp: z.number().optional(),
39
- files: z.array(ManifestFileInfo)
39
+ files: z.array(ManifestFileInfo),
40
40
  }).passthrough();
41
41
  export type BlockPackManifest = z.infer<typeof BlockPackManifest>;
42
42
 
@@ -44,7 +44,7 @@ export const BlockPackManifestFile = 'manifest.json';
44
44
 
45
45
  export function overrideManifestVersion<T extends { description: { id: BlockPackId } }>(
46
46
  manifest: T,
47
- newVersion: string
47
+ newVersion: string,
48
48
  ): T {
49
49
  return R.mergeDeep(manifest, { description: { id: { version: newVersion } } }) as T;
50
50
  }
@@ -3,7 +3,7 @@ import {
3
3
  ContentExplicitBase64,
4
4
  ContentExplicitBytes,
5
5
  DescriptionContentBinary,
6
- DescriptionContentText
6
+ DescriptionContentText,
7
7
  } from './content_types';
8
8
 
9
9
  export const BlockPlatform = z.enum([
@@ -12,13 +12,13 @@ export const BlockPlatform = z.enum([
12
12
  'macosx-x64',
13
13
  'macosx-aarch64',
14
14
  'linux-x64',
15
- 'linux-aarch64'
15
+ 'linux-aarch64',
16
16
  ]);
17
17
  export type BlockPlatform = z.infer<typeof BlockPlatform>;
18
18
 
19
19
  export function BlockPackMeta<
20
20
  const LongStringType extends z.ZodTypeAny,
21
- const BinaryType extends z.ZodTypeAny
21
+ const BinaryType extends z.ZodTypeAny,
22
22
  >(longString: LongStringType, binary: BinaryType) {
23
23
  return z.object({
24
24
  title: z.string(),
@@ -33,7 +33,7 @@ export function BlockPackMeta<
33
33
  organization: z.object({
34
34
  name: z.string(),
35
35
  url: z.string().url(),
36
- logo: binary.optional()
36
+ logo: binary.optional(),
37
37
  }).passthrough(),
38
38
  /**
39
39
  * The order of blocks on the "marketplace" (higher values push block higher to the top of the list).
@@ -52,27 +52,27 @@ export function BlockPackMeta<
52
52
  * Supported operating systems.
53
53
  * If not provided, the block is supported on all operating systems.
54
54
  */
55
- supportedPlatforms: z.array(BlockPlatform).optional()
55
+ supportedPlatforms: z.array(BlockPlatform).optional(),
56
56
  });
57
57
  }
58
58
 
59
59
  // prettier-ignore
60
60
  export const BlockPackMetaDescriptionRaw = BlockPackMeta(
61
61
  DescriptionContentText,
62
- DescriptionContentBinary
62
+ DescriptionContentBinary,
63
63
  );
64
64
  export type BlockPackMetaDescriptionRaw = z.infer<typeof BlockPackMetaDescriptionRaw>;
65
65
 
66
66
  // prettier-ignore
67
67
  export const BlockPackMetaEmbeddedBase64 = BlockPackMeta(
68
68
  z.string(),
69
- ContentExplicitBase64
69
+ ContentExplicitBase64,
70
70
  );
71
71
  export type BlockPackMetaEmbeddedBase64 = z.infer<typeof BlockPackMetaEmbeddedBase64>;
72
72
 
73
73
  // prettier-ignore
74
74
  export const BlockPackMetaEmbeddedBytes = BlockPackMeta(
75
75
  z.string(),
76
- ContentExplicitBytes
76
+ ContentExplicitBytes,
77
77
  );
78
78
  export type BlockPackMetaEmbeddedBytes = z.infer<typeof BlockPackMetaEmbeddedBytes>;
@@ -1,12 +1,12 @@
1
- import {
1
+ import type {
2
2
  ContentAbsoluteUrl,
3
3
  ContentAnyLocal,
4
4
  ContentExplicitOrRelative,
5
- ContentRelative
5
+ ContentRelative,
6
6
  } from './content_types';
7
7
 
8
8
  export function mapRemoteToAbsolute(
9
- rootUrl: string
9
+ rootUrl: string,
10
10
  ): <T extends ContentAnyLocal>(value: T) => Exclude<T, ContentRelative> | ContentAbsoluteUrl {
11
11
  const rootWithSlash = rootUrl.endsWith('/') ? rootUrl : `${rootUrl}/`;
12
12
  return <T extends ContentAnyLocal>(value: T) =>
@@ -23,7 +23,7 @@ export function mapRemoteToAbsolute(
23
23
  * @param prefix prefix to add to the relaive path, slesh at the end will be added automatically if missed
24
24
  */
25
25
  export function addPrefixToRelative(
26
- prefix: string
26
+ prefix: string,
27
27
  ): <T extends ContentExplicitOrRelative>(value: T) => T {
28
28
  const prefixWithSlash = prefix.endsWith('/') ? prefix : `${prefix}/`;
29
29
  return <T extends ContentExplicitOrRelative>(value: T) =>
@@ -7,7 +7,7 @@ import { z } from 'zod';
7
7
  export const ContentExplicitString = z
8
8
  .object({
9
9
  type: z.literal('explicit-string'),
10
- content: z.string().describe('Actual string value')
10
+ content: z.string().describe('Actual string value'),
11
11
  })
12
12
  .strict();
13
13
  export type ContentExplicitString = z.infer<typeof ContentExplicitString>;
@@ -19,7 +19,7 @@ export const ContentExplicitBase64 = z
19
19
  .string()
20
20
  .regex(/\w+\/[-+.\w]+/)
21
21
  .describe('MIME type to interpret content'),
22
- content: z.string().base64().describe('Base64 encoded binary value')
22
+ content: z.string().base64().describe('Base64 encoded binary value'),
23
23
  })
24
24
  .strict();
25
25
  export type ContentExplicitBase64 = z.infer<typeof ContentExplicitBase64>;
@@ -30,8 +30,8 @@ export const ContentRelative = z
30
30
  path: z
31
31
  .string()
32
32
  .describe(
33
- 'Address of the file, in most cases relative to the file which this structure is a part of'
34
- )
33
+ 'Address of the file, in most cases relative to the file which this structure is a part of',
34
+ ),
35
35
  })
36
36
  .strict();
37
37
  export type ContentRelative = z.infer<typeof ContentRelative>;
@@ -44,7 +44,7 @@ export const ContentAbsoluteFile = z
44
44
  file: z
45
45
  .string()
46
46
  .regex(absPathRegex, 'path to file must be absolute')
47
- .describe('Absolute address of the file in local file system')
47
+ .describe('Absolute address of the file in local file system'),
48
48
  })
49
49
  .strict();
50
50
  export type ContentAbsoluteFile = z.infer<typeof ContentAbsoluteFile>;
@@ -52,7 +52,7 @@ export type ContentAbsoluteFile = z.infer<typeof ContentAbsoluteFile>;
52
52
  export const ContentAbsoluteUrl = z
53
53
  .object({
54
54
  type: z.literal('absolute-url'),
55
- url: z.string().url().describe('Global URL to reach the requested file')
55
+ url: z.string().url().describe('Global URL to reach the requested file'),
56
56
  })
57
57
  .strict();
58
58
  export type ContentAbsoluteUrl = z.infer<typeof ContentAbsoluteUrl>;
@@ -68,7 +68,7 @@ export const ContentExplicitBytes = z
68
68
  .string()
69
69
  .regex(/\w+\/[-+.\w]+/)
70
70
  .describe('MIME type to interpret content'),
71
- content: z.instanceof(Uint8Array).describe('Raw content')
71
+ content: z.instanceof(Uint8Array).describe('Raw content'),
72
72
  })
73
73
  .strict();
74
74
  export type ContentExplicitBytes = z.infer<typeof ContentExplicitBytes>;
@@ -79,7 +79,7 @@ export const ContentAbsoluteFolder = z
79
79
  folder: z
80
80
  .string()
81
81
  .regex(absPathRegex, 'path to folder must be absolute')
82
- .describe('Absolute address of the folder in local file system')
82
+ .describe('Absolute address of the folder in local file system'),
83
83
  })
84
84
  .strict();
85
85
  export type ContentAbsoluteFolder = z.infer<typeof ContentAbsoluteFolder>;
@@ -93,14 +93,14 @@ export const ContentAny = z.discriminatedUnion('type', [
93
93
  ContentExplicitBase64,
94
94
  ContentRelative,
95
95
  ContentAbsoluteFile,
96
- ContentAbsoluteUrl
96
+ ContentAbsoluteUrl,
97
97
  ]);
98
98
  export type ContentAny = z.infer<typeof ContentAny>;
99
99
 
100
100
  export const ContentExplicitOrRelative = z.discriminatedUnion('type', [
101
101
  ContentExplicitString,
102
102
  ContentExplicitBase64,
103
- ContentRelative
103
+ ContentRelative,
104
104
  ]);
105
105
  export type ContentExplicitOrRelative = z.infer<typeof ContentExplicitOrRelative>;
106
106
 
@@ -108,7 +108,7 @@ export const ContentAnyLocal = z.discriminatedUnion('type', [
108
108
  ContentExplicitString,
109
109
  ContentExplicitBase64,
110
110
  ContentRelative,
111
- ContentAbsoluteFile
111
+ ContentAbsoluteFile,
112
112
  ]);
113
113
  export type ContentAnyLocal = z.infer<typeof ContentAnyLocal>;
114
114
 
@@ -116,7 +116,7 @@ export const ContentAnyRemote = z.discriminatedUnion('type', [
116
116
  ContentExplicitString,
117
117
  ContentExplicitBase64,
118
118
  ContentRelative,
119
- ContentAbsoluteUrl
119
+ ContentAbsoluteUrl,
120
120
  ]);
121
121
  export type ContentAnyRemote = z.infer<typeof ContentAnyRemote>;
122
122
 
@@ -134,7 +134,7 @@ export type ContentAnyRemote = z.infer<typeof ContentAnyRemote>;
134
134
  export const ContentAnyBinaryLocal = z.discriminatedUnion('type', [
135
135
  ContentExplicitBase64,
136
136
  ContentRelative,
137
- ContentAbsoluteFile
137
+ ContentAbsoluteFile,
138
138
  ]);
139
139
  export type ContentAnyBinaryLocal = z.infer<typeof ContentAnyBinaryLocal>;
140
140
 
@@ -148,7 +148,7 @@ export type ContentAnyBinaryLocal = z.infer<typeof ContentAnyBinaryLocal>;
148
148
  export const ContentAnyTextLocal = z.discriminatedUnion('type', [
149
149
  ContentExplicitString,
150
150
  ContentRelative,
151
- ContentAbsoluteFile
151
+ ContentAbsoluteFile,
152
152
  ]);
153
153
  export type ContentAnyTextLocal = z.infer<typeof ContentAnyTextLocal>;
154
154
 
@@ -158,25 +158,25 @@ export type ContentAnyTextLocal = z.infer<typeof ContentAnyTextLocal>;
158
158
 
159
159
  export const ContentAbsoluteBinaryRemote = z.discriminatedUnion('type', [
160
160
  ContentExplicitBase64,
161
- ContentAbsoluteUrl
161
+ ContentAbsoluteUrl,
162
162
  ]);
163
163
  export type ContentAbsoluteBinaryRemote = z.infer<typeof ContentAbsoluteBinaryRemote>;
164
164
 
165
165
  export const ContentAbsoluteBinaryLocal = z.discriminatedUnion('type', [
166
166
  ContentExplicitBase64,
167
- ContentAbsoluteFile
167
+ ContentAbsoluteFile,
168
168
  ]);
169
169
  export type ContentAbsoluteBinaryLocal = z.infer<typeof ContentAbsoluteBinaryLocal>;
170
170
 
171
171
  export const ContentAbsoluteTextRemote = z.discriminatedUnion('type', [
172
172
  ContentExplicitString,
173
- ContentAbsoluteUrl
173
+ ContentAbsoluteUrl,
174
174
  ]);
175
175
  export type ContentAbsoluteTextRemote = z.infer<typeof ContentAbsoluteTextRemote>;
176
176
 
177
177
  export const ContentAbsoluteTextLocal = z.discriminatedUnion('type', [
178
178
  ContentExplicitString,
179
- ContentAbsoluteFile
179
+ ContentAbsoluteFile,
180
180
  ]);
181
181
  export type ContentAbsoluteTextLocal = z.infer<typeof ContentAbsoluteTextLocal>;
182
182
 
@@ -186,13 +186,13 @@ export type ContentAbsoluteTextLocal = z.infer<typeof ContentAbsoluteTextLocal>;
186
186
 
187
187
  export const ContentRelativeBinary = z.discriminatedUnion('type', [
188
188
  ContentExplicitBase64,
189
- ContentRelative
189
+ ContentRelative,
190
190
  ]);
191
191
  export type ContentRelativeBinary = z.infer<typeof ContentRelativeBinary>;
192
192
 
193
193
  export const ContentRelativeText = z.discriminatedUnion('type', [
194
194
  ContentExplicitString,
195
- ContentRelative
195
+ ContentRelative,
196
196
  ]);
197
197
  export type ContentRelativeText = z.infer<typeof ContentRelativeText>;
198
198
 
@@ -234,16 +234,16 @@ export const DescriptionContentBinary = z.union([
234
234
  z
235
235
  .string()
236
236
  .startsWith('file:')
237
- .transform<ContentRelativeBinary>((value, ctx) => ({ type: 'relative', path: value.slice(5) })),
238
- ContentAnyBinaryLocal
237
+ .transform<ContentRelativeBinary>((value) => ({ type: 'relative', path: value.slice(5) })),
238
+ ContentAnyBinaryLocal,
239
239
  ]);
240
240
  export type DescriptionContentBinary = z.infer<typeof DescriptionContentBinary>;
241
241
 
242
242
  export const DescriptionContentText = z.union([
243
- z.string().transform<ContentRelativeText>((value, ctx) => {
243
+ z.string().transform<ContentRelativeText>((value) => {
244
244
  if (value.startsWith('file:')) return { type: 'relative', path: value.slice(5) };
245
245
  else return { type: 'explicit-string', content: value };
246
246
  }),
247
- ContentAnyTextLocal
247
+ ContentAnyTextLocal,
248
248
  ]);
249
249
  export type DescriptionContentText = z.infer<typeof DescriptionContentText>;
@@ -6,5 +6,5 @@ export const SemVer = z
6
6
  .string()
7
7
  .regex(
8
8
  /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/,
9
- 'Wrong version format, please use valid semver'
9
+ 'Wrong version format, please use valid semver',
10
10
  );
@@ -6,7 +6,7 @@ import { BlockPackId } from '../block_meta';
6
6
  export const BlockPackDevV1 = z.object({
7
7
  type: z.literal('dev-v1'),
8
8
  folder: z.string(),
9
- mtime: z.string().optional()
9
+ mtime: z.string().optional(),
10
10
  });
11
11
  /** @deprecated don't use */
12
12
  export type BlockPackDevV1 = z.infer<typeof BlockPackDevV1>;
@@ -15,7 +15,7 @@ export type BlockPackDevV1 = z.infer<typeof BlockPackDevV1>;
15
15
  export const BlockPackDevV2 = z.object({
16
16
  type: z.literal('dev-v2'),
17
17
  folder: z.string(),
18
- mtime: z.string().optional()
18
+ mtime: z.string().optional(),
19
19
  });
20
20
  export type BlockPackDevV2 = z.infer<typeof BlockPackDevV2>;
21
21
 
@@ -27,7 +27,7 @@ export type BlockPackDevV2 = z.infer<typeof BlockPackDevV2>;
27
27
  export const BlockPackFromRegistryV1 = z.object({
28
28
  type: z.literal('from-registry-v1'),
29
29
  registryUrl: z.string(),
30
- id: BlockPackId
30
+ id: BlockPackId,
31
31
  });
32
32
  /** @deprecated don't use */
33
33
  export type BlockPackFromRegistryV1 = z.infer<typeof BlockPackFromRegistryV1>;
@@ -38,7 +38,7 @@ export const BlockPackFromRegistryV2 = z.object({
38
38
  type: z.literal('from-registry-v2'),
39
39
  registryUrl: z.string(),
40
40
  id: BlockPackId,
41
- channel: z.string().optional()
41
+ channel: z.string().optional(),
42
42
  });
43
43
  export type BlockPackFromRegistryV2 = z.infer<typeof BlockPackFromRegistryV2>;
44
44
 
@@ -47,6 +47,6 @@ export const BlockPackSpec = z.discriminatedUnion('type', [
47
47
  BlockPackDevV1,
48
48
  BlockPackDevV2,
49
49
  BlockPackFromRegistryV1,
50
- BlockPackFromRegistryV2
50
+ BlockPackFromRegistryV2,
51
51
  ]);
52
52
  export type BlockPackSpec = z.infer<typeof BlockPackSpec>;
@@ -4,9 +4,10 @@ import {
4
4
  BlockPackIdNoVersion,
5
5
  BlockPackMetaEmbeddedBytes,
6
6
  FeatureFlags,
7
- SemVer
7
+ SemVer,
8
8
  } from '../block_meta';
9
- import { BlockPackFromRegistryV2, BlockPackSpec } from './block_pack_spec';
9
+ import type { BlockPackFromRegistryV2 } from './block_pack_spec';
10
+ import { BlockPackSpec } from './block_pack_spec';
10
11
  import { RegistryEntry } from './registry_spec';
11
12
 
12
13
  /**
@@ -17,7 +18,7 @@ export const BlockPackOverviewLegacy = z.object({
17
18
  id: BlockPackId,
18
19
  meta: BlockPackMetaEmbeddedBytes,
19
20
  spec: BlockPackSpec,
20
- otherVersions: z.array(SemVer)
21
+ otherVersions: z.array(SemVer),
21
22
  }).passthrough();
22
23
  export type BlockPackOverviewLegacy = z.infer<typeof BlockPackOverviewLegacy>;
23
24
 
@@ -26,7 +27,7 @@ export const StableChannel = 'stable';
26
27
 
27
28
  export const VersionWithChannels = z.object({
28
29
  version: SemVer,
29
- channels: z.array(z.string())
30
+ channels: z.array(z.string()),
30
31
  }).passthrough();
31
32
 
32
33
  /**
@@ -47,8 +48,8 @@ export const BlockPackOverviewRaw = z.object({
47
48
  id: BlockPackIdNoVersion,
48
49
  latestByChannel: z.record(z.string(), SingleBlockPackOverview),
49
50
  allVersions: z.array(VersionWithChannels),
50
- registryId: z.string()
51
- })
51
+ registryId: z.string(),
52
+ });
52
53
  export const BlockPackOverview = BlockPackOverviewRaw.passthrough();
53
54
  export type BlockPackOverview = z.infer<typeof BlockPackOverview>;
54
55
 
@@ -56,13 +57,13 @@ export const BlockPackOverviewNoRegistryId = BlockPackOverviewRaw.omit({ registr
56
57
  export type BlockPackOverviewNoRegistryId = z.infer<typeof BlockPackOverviewNoRegistryId>;
57
58
 
58
59
  export const RegistryStatus = RegistryEntry.extend({
59
- status: z.union([z.literal('online'), z.literal('offline')])
60
+ status: z.union([z.literal('online'), z.literal('offline')]),
60
61
  });
61
62
  export type RegistryStatus = z.infer<typeof RegistryStatus>;
62
63
 
63
64
  export const BlockPackListing = z.object({
64
65
  registries: z.array(RegistryStatus),
65
- blockPacks: z.array(BlockPackOverview)
66
+ blockPacks: z.array(BlockPackOverview),
66
67
  });
67
68
  export type BlockPackListing = z.infer<typeof BlockPackListing>;
68
69
 
@@ -77,6 +78,6 @@ export function blockPackOverviewToLegacy(bpo: BlockPackOverview): BlockPackOver
77
78
  otherVersions: bpo.allVersions
78
79
  .filter((v) => v.channels.indexOf(mainChannel) >= 0)
79
80
  .map((v) => v.version),
80
- registryId: bpo.registryId
81
+ registryId: bpo.registryId,
81
82
  };
82
83
  }