@milaboratories/pl-model-common 1.24.3 → 1.24.5

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 (275) hide show
  1. package/dist/base32_encode.cjs +11 -11
  2. package/dist/base32_encode.cjs.map +1 -1
  3. package/dist/base32_encode.d.ts +1 -1
  4. package/dist/base32_encode.js +11 -11
  5. package/dist/base32_encode.js.map +1 -1
  6. package/dist/base64.cjs +2 -2
  7. package/dist/base64.cjs.map +1 -1
  8. package/dist/base64.d.ts +1 -1
  9. package/dist/base64.d.ts.map +1 -1
  10. package/dist/base64.js +2 -2
  11. package/dist/base64.js.map +1 -1
  12. package/dist/block_state.d.ts +3 -3
  13. package/dist/bmodel/block_config.cjs +1 -1
  14. package/dist/bmodel/block_config.cjs.map +1 -1
  15. package/dist/bmodel/block_config.d.ts +3 -3
  16. package/dist/bmodel/block_config.d.ts.map +1 -1
  17. package/dist/bmodel/block_config.js +1 -1
  18. package/dist/bmodel/block_config.js.map +1 -1
  19. package/dist/bmodel/code.cjs +1 -1
  20. package/dist/bmodel/code.cjs.map +1 -1
  21. package/dist/bmodel/code.d.ts +2 -2
  22. package/dist/bmodel/code.js +1 -1
  23. package/dist/bmodel/code.js.map +1 -1
  24. package/dist/bmodel/container.d.ts +5 -5
  25. package/dist/bmodel/index.d.ts +5 -5
  26. package/dist/bmodel/normalization.cjs +17 -17
  27. package/dist/bmodel/normalization.cjs.map +1 -1
  28. package/dist/bmodel/normalization.d.ts +2 -2
  29. package/dist/bmodel/normalization.d.ts.map +1 -1
  30. package/dist/bmodel/normalization.js +17 -17
  31. package/dist/bmodel/normalization.js.map +1 -1
  32. package/dist/bmodel/types.d.ts +1 -1
  33. package/dist/branding.d.ts +2 -2
  34. package/dist/common_types.d.ts +1 -1
  35. package/dist/driver_kit.d.ts +1 -1
  36. package/dist/drivers/ChunkedStreamReader.cjs +13 -12
  37. package/dist/drivers/ChunkedStreamReader.cjs.map +1 -1
  38. package/dist/drivers/ChunkedStreamReader.d.ts +2 -2
  39. package/dist/drivers/ChunkedStreamReader.d.ts.map +1 -1
  40. package/dist/drivers/ChunkedStreamReader.js +13 -12
  41. package/dist/drivers/ChunkedStreamReader.js.map +1 -1
  42. package/dist/drivers/blob.cjs +1 -1
  43. package/dist/drivers/blob.cjs.map +1 -1
  44. package/dist/drivers/blob.d.ts +4 -4
  45. package/dist/drivers/blob.d.ts.map +1 -1
  46. package/dist/drivers/blob.js +1 -1
  47. package/dist/drivers/blob.js.map +1 -1
  48. package/dist/drivers/index.d.ts +8 -8
  49. package/dist/drivers/log.cjs +1 -1
  50. package/dist/drivers/log.cjs.map +1 -1
  51. package/dist/drivers/log.js +1 -1
  52. package/dist/drivers/log.js.map +1 -1
  53. package/dist/drivers/ls.cjs +3 -3
  54. package/dist/drivers/ls.cjs.map +1 -1
  55. package/dist/drivers/ls.d.ts +6 -6
  56. package/dist/drivers/ls.d.ts.map +1 -1
  57. package/dist/drivers/ls.js +3 -3
  58. package/dist/drivers/ls.js.map +1 -1
  59. package/dist/drivers/pframe/column_filter.d.ts +1 -1
  60. package/dist/drivers/pframe/data_info.cjs +119 -110
  61. package/dist/drivers/pframe/data_info.cjs.map +1 -1
  62. package/dist/drivers/pframe/data_info.d.ts +10 -10
  63. package/dist/drivers/pframe/data_info.d.ts.map +1 -1
  64. package/dist/drivers/pframe/data_info.js +119 -110
  65. package/dist/drivers/pframe/data_info.js.map +1 -1
  66. package/dist/drivers/pframe/data_types.cjs +7 -4
  67. package/dist/drivers/pframe/data_types.cjs.map +1 -1
  68. package/dist/drivers/pframe/data_types.d.ts +2 -2
  69. package/dist/drivers/pframe/data_types.d.ts.map +1 -1
  70. package/dist/drivers/pframe/data_types.js +7 -4
  71. package/dist/drivers/pframe/data_types.js.map +1 -1
  72. package/dist/drivers/pframe/driver.d.ts +10 -10
  73. package/dist/drivers/pframe/driver.d.ts.map +1 -1
  74. package/dist/drivers/pframe/find_columns.d.ts +2 -2
  75. package/dist/drivers/pframe/index.d.ts +14 -14
  76. package/dist/drivers/pframe/linker_columns.cjs +13 -5
  77. package/dist/drivers/pframe/linker_columns.cjs.map +1 -1
  78. package/dist/drivers/pframe/linker_columns.d.ts +2 -2
  79. package/dist/drivers/pframe/linker_columns.d.ts.map +1 -1
  80. package/dist/drivers/pframe/linker_columns.js +13 -5
  81. package/dist/drivers/pframe/linker_columns.js.map +1 -1
  82. package/dist/drivers/pframe/pframe.d.ts +6 -6
  83. package/dist/drivers/pframe/pframe.d.ts.map +1 -1
  84. package/dist/drivers/pframe/query/index.d.ts +2 -2
  85. package/dist/drivers/pframe/query/query_common.d.ts +37 -37
  86. package/dist/drivers/pframe/query/query_data.d.ts +2 -2
  87. package/dist/drivers/pframe/query/query_data.d.ts.map +1 -1
  88. package/dist/drivers/pframe/query/query_spec.d.ts +3 -3
  89. package/dist/drivers/pframe/query/query_spec.d.ts.map +1 -1
  90. package/dist/drivers/pframe/spec/anchored.cjs +6 -6
  91. package/dist/drivers/pframe/spec/anchored.cjs.map +1 -1
  92. package/dist/drivers/pframe/spec/anchored.d.ts +4 -4
  93. package/dist/drivers/pframe/spec/anchored.d.ts.map +1 -1
  94. package/dist/drivers/pframe/spec/anchored.js +6 -6
  95. package/dist/drivers/pframe/spec/anchored.js.map +1 -1
  96. package/dist/drivers/pframe/spec/filtered_column.cjs +1 -1
  97. package/dist/drivers/pframe/spec/filtered_column.cjs.map +1 -1
  98. package/dist/drivers/pframe/spec/filtered_column.d.ts +1 -1
  99. package/dist/drivers/pframe/spec/filtered_column.js +1 -1
  100. package/dist/drivers/pframe/spec/filtered_column.js.map +1 -1
  101. package/dist/drivers/pframe/spec/ids.cjs.map +1 -1
  102. package/dist/drivers/pframe/spec/ids.d.ts +5 -5
  103. package/dist/drivers/pframe/spec/ids.js.map +1 -1
  104. package/dist/drivers/pframe/spec/index.d.ts +6 -6
  105. package/dist/drivers/pframe/spec/native_id.cjs.map +1 -1
  106. package/dist/drivers/pframe/spec/native_id.d.ts +3 -3
  107. package/dist/drivers/pframe/spec/native_id.d.ts.map +1 -1
  108. package/dist/drivers/pframe/spec/native_id.js.map +1 -1
  109. package/dist/drivers/pframe/spec/selectors.cjs +1 -1
  110. package/dist/drivers/pframe/spec/selectors.cjs.map +1 -1
  111. package/dist/drivers/pframe/spec/selectors.d.ts +4 -4
  112. package/dist/drivers/pframe/spec/selectors.d.ts.map +1 -1
  113. package/dist/drivers/pframe/spec/selectors.js +1 -1
  114. package/dist/drivers/pframe/spec/selectors.js.map +1 -1
  115. package/dist/drivers/pframe/spec/spec.cjs +64 -59
  116. package/dist/drivers/pframe/spec/spec.cjs.map +1 -1
  117. package/dist/drivers/pframe/spec/spec.d.ts +15 -15
  118. package/dist/drivers/pframe/spec/spec.d.ts.map +1 -1
  119. package/dist/drivers/pframe/spec/spec.js +64 -59
  120. package/dist/drivers/pframe/spec/spec.js.map +1 -1
  121. package/dist/drivers/pframe/table.d.ts +2 -2
  122. package/dist/drivers/pframe/table_calculate.cjs +11 -11
  123. package/dist/drivers/pframe/table_calculate.cjs.map +1 -1
  124. package/dist/drivers/pframe/table_calculate.d.ts +30 -30
  125. package/dist/drivers/pframe/table_calculate.d.ts.map +1 -1
  126. package/dist/drivers/pframe/table_calculate.js +11 -11
  127. package/dist/drivers/pframe/table_calculate.js.map +1 -1
  128. package/dist/drivers/pframe/table_common.cjs +4 -4
  129. package/dist/drivers/pframe/table_common.cjs.map +1 -1
  130. package/dist/drivers/pframe/table_common.d.ts +6 -6
  131. package/dist/drivers/pframe/table_common.js +4 -4
  132. package/dist/drivers/pframe/table_common.js.map +1 -1
  133. package/dist/drivers/pframe/type_util.d.ts.map +1 -1
  134. package/dist/drivers/pframe/unique_values.d.ts +4 -4
  135. package/dist/drivers/urls.cjs +2 -2
  136. package/dist/drivers/urls.cjs.map +1 -1
  137. package/dist/drivers/urls.d.ts +1 -1
  138. package/dist/drivers/urls.js +2 -2
  139. package/dist/drivers/urls.js.map +1 -1
  140. package/dist/errors.cjs +12 -12
  141. package/dist/errors.cjs.map +1 -1
  142. package/dist/errors.d.ts +1 -1
  143. package/dist/errors.d.ts.map +1 -1
  144. package/dist/errors.js +12 -12
  145. package/dist/errors.js.map +1 -1
  146. package/dist/flags/block_flags.cjs +2 -2
  147. package/dist/flags/block_flags.cjs.map +1 -1
  148. package/dist/flags/block_flags.d.ts.map +1 -1
  149. package/dist/flags/block_flags.js +2 -2
  150. package/dist/flags/block_flags.js.map +1 -1
  151. package/dist/flags/flag_utils.cjs +31 -29
  152. package/dist/flags/flag_utils.cjs.map +1 -1
  153. package/dist/flags/flag_utils.d.ts +33 -33
  154. package/dist/flags/flag_utils.d.ts.map +1 -1
  155. package/dist/flags/flag_utils.js +31 -29
  156. package/dist/flags/flag_utils.js.map +1 -1
  157. package/dist/flags/index.d.ts +3 -3
  158. package/dist/flags/type_utils.d.ts +1 -1
  159. package/dist/flags/type_utils.d.ts.map +1 -1
  160. package/dist/httpAuth.cjs +4 -5
  161. package/dist/httpAuth.cjs.map +1 -1
  162. package/dist/httpAuth.d.ts +1 -1
  163. package/dist/httpAuth.d.ts.map +1 -1
  164. package/dist/httpAuth.js +4 -5
  165. package/dist/httpAuth.js.map +1 -1
  166. package/dist/index.d.ts +19 -19
  167. package/dist/json.cjs +1 -1
  168. package/dist/json.cjs.map +1 -1
  169. package/dist/json.d.ts.map +1 -1
  170. package/dist/json.js +1 -1
  171. package/dist/json.js.map +1 -1
  172. package/dist/navigation.cjs +1 -1
  173. package/dist/navigation.cjs.map +1 -1
  174. package/dist/navigation.d.ts +3 -3
  175. package/dist/navigation.js +1 -1
  176. package/dist/navigation.js.map +1 -1
  177. package/dist/plid.cjs +4 -4
  178. package/dist/plid.cjs.map +1 -1
  179. package/dist/plid.d.ts +1 -1
  180. package/dist/plid.js +4 -4
  181. package/dist/plid.js.map +1 -1
  182. package/dist/pool/entry.d.ts +1 -1
  183. package/dist/pool/index.d.ts +3 -3
  184. package/dist/pool/query.cjs +23 -23
  185. package/dist/pool/query.cjs.map +1 -1
  186. package/dist/pool/query.d.ts +9 -9
  187. package/dist/pool/query.d.ts.map +1 -1
  188. package/dist/pool/query.js +23 -23
  189. package/dist/pool/query.js.map +1 -1
  190. package/dist/pool/spec.cjs +9 -9
  191. package/dist/pool/spec.cjs.map +1 -1
  192. package/dist/pool/spec.d.ts +4 -4
  193. package/dist/pool/spec.d.ts.map +1 -1
  194. package/dist/pool/spec.js +9 -9
  195. package/dist/pool/spec.js.map +1 -1
  196. package/dist/ref.cjs +20 -18
  197. package/dist/ref.cjs.map +1 -1
  198. package/dist/ref.d.ts +1 -1
  199. package/dist/ref.d.ts.map +1 -1
  200. package/dist/ref.js +20 -18
  201. package/dist/ref.js.map +1 -1
  202. package/dist/utag.d.ts +1 -1
  203. package/dist/util.cjs +1 -1
  204. package/dist/util.cjs.map +1 -1
  205. package/dist/util.js +1 -1
  206. package/dist/util.js.map +1 -1
  207. package/dist/value_or_error.cjs.map +1 -1
  208. package/dist/value_or_error.d.ts.map +1 -1
  209. package/dist/value_or_error.js.map +1 -1
  210. package/package.json +18 -17
  211. package/src/base32_encode.ts +12 -12
  212. package/src/base64.ts +12 -8
  213. package/src/block_state.ts +3 -3
  214. package/src/bmodel/block_config.ts +12 -6
  215. package/src/bmodel/code.ts +3 -3
  216. package/src/bmodel/container.ts +5 -5
  217. package/src/bmodel/index.ts +5 -5
  218. package/src/bmodel/normalization.ts +33 -25
  219. package/src/bmodel/types.ts +1 -1
  220. package/src/branding.ts +2 -2
  221. package/src/common_types.ts +1 -1
  222. package/src/driver_kit.ts +1 -1
  223. package/src/drivers/ChunkedStreamReader.ts +16 -14
  224. package/src/drivers/blob.ts +7 -11
  225. package/src/drivers/index.ts +8 -8
  226. package/src/drivers/log.ts +3 -3
  227. package/src/drivers/ls.ts +18 -18
  228. package/src/drivers/pframe/column_filter.ts +1 -1
  229. package/src/drivers/pframe/data_info.ts +146 -146
  230. package/src/drivers/pframe/data_types.ts +56 -36
  231. package/src/drivers/pframe/driver.ts +20 -36
  232. package/src/drivers/pframe/find_columns.ts +2 -2
  233. package/src/drivers/pframe/index.ts +14 -14
  234. package/src/drivers/pframe/linker_columns.test.ts +280 -273
  235. package/src/drivers/pframe/linker_columns.ts +65 -39
  236. package/src/drivers/pframe/pframe.ts +6 -9
  237. package/src/drivers/pframe/query/index.ts +2 -2
  238. package/src/drivers/pframe/query/query_common.ts +46 -46
  239. package/src/drivers/pframe/query/query_data.ts +17 -10
  240. package/src/drivers/pframe/query/query_spec.ts +18 -10
  241. package/src/drivers/pframe/spec/anchored.ts +44 -33
  242. package/src/drivers/pframe/spec/filtered_column.ts +2 -2
  243. package/src/drivers/pframe/spec/ids.ts +6 -6
  244. package/src/drivers/pframe/spec/index.ts +6 -6
  245. package/src/drivers/pframe/spec/native_id.ts +7 -9
  246. package/src/drivers/pframe/spec/selectors.test.ts +170 -146
  247. package/src/drivers/pframe/spec/selectors.ts +22 -31
  248. package/src/drivers/pframe/spec/spec.test.ts +163 -176
  249. package/src/drivers/pframe/spec/spec.ts +132 -117
  250. package/src/drivers/pframe/table.ts +2 -2
  251. package/src/drivers/pframe/table_calculate.ts +44 -50
  252. package/src/drivers/pframe/table_common.ts +10 -10
  253. package/src/drivers/pframe/type_util.ts +2 -7
  254. package/src/drivers/pframe/unique_values.ts +4 -4
  255. package/src/drivers/urls.ts +3 -3
  256. package/src/errors.test.ts +20 -20
  257. package/src/errors.ts +24 -20
  258. package/src/flags/block_flags.ts +8 -7
  259. package/src/flags/flag_utils.test.ts +94 -73
  260. package/src/flags/flag_utils.ts +73 -50
  261. package/src/flags/index.ts +3 -3
  262. package/src/flags/type_utils.ts +10 -7
  263. package/src/httpAuth.ts +5 -6
  264. package/src/index.ts +19 -19
  265. package/src/json.ts +28 -17
  266. package/src/navigation.ts +4 -4
  267. package/src/plid.ts +6 -6
  268. package/src/pool/entry.ts +1 -1
  269. package/src/pool/index.ts +3 -3
  270. package/src/pool/query.ts +52 -56
  271. package/src/pool/spec.ts +20 -17
  272. package/src/ref.ts +25 -19
  273. package/src/utag.ts +1 -1
  274. package/src/util.ts +1 -1
  275. package/src/value_or_error.ts +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"flag_utils.js","sources":["../../src/flags/flag_utils.ts"],"sourcesContent":["import type { BlockCodeFeatureFlags, BlockCodeKnownFeatureFlags } from './block_flags';\nimport type { FilterKeysByPrefix } from './type_utils';\n\nexport function checkBlockFlag(flags: BlockCodeFeatureFlags | undefined, flag: keyof BlockCodeKnownFeatureFlags, flagValue: boolean | number = true): boolean {\n if (flags === undefined) return false;\n return flags[flag] === flagValue;\n}\n\n/**\n * Extracts all requirements from the feature flags.\n * @param flags - The feature flags.\n * @returns A set of requirements.\n */\nexport function extractAllRequirements(flags: BlockCodeFeatureFlags | undefined): Set<`requires${string}`> {\n if (flags === undefined) return new Set();\n return new Set(Object.entries(flags)\n .filter(([key, value]) => key.startsWith('requires') && value === true)\n .map(([key]) => key as `requires${string}`));\n}\n\n/**\n * Extracts all supports from the feature flags.\n * @param flags - The feature flags.\n * @returns A set of supports.\n */\nexport function extractAllSupports(flags: BlockCodeFeatureFlags | undefined): Set<`supports${string}`> {\n if (flags === undefined) return new Set();\n return new Set(Object.entries(flags)\n .filter(([key, value]) => key.startsWith('supports') && value === true)\n .map(([key]) => key as `supports${string}`));\n}\n\nexport class IncompatibleFlagsError extends Error {\n name = 'IncompatibleFlagsError';\n constructor(public readonly incompatibleFlags: Map<`requires${string}`, number | boolean>) {\n super(`Some of the block requirements are not supported by the runtime: ${Array.from(incompatibleFlags.entries()).map(([key, value]) => `${key}: ${value}`).join(', ')}`);\n }\n}\n\n/**\n * A type that represents a supported requirement.\n * @remarks\n * This type is used to represent a supported requirement.\n * It is a subtype of `BlockCodeKnownFeatureFlags` and is used to represent a supported requirement.\n * It is used to represent a supported requirement.\n */\nexport type SupportedRequirement = FilterKeysByPrefix<BlockCodeKnownFeatureFlags, 'requires'>;\n\nexport class RuntimeCapabilities {\n private readonly supportedRequirements: Map<`requires${string}`, Set<number | boolean>> = new Map();\n\n /**\n * Adds a supported requirement to the runtime capabilities.\n * @param requirement - The requirement.\n * @param value - The value of the requirement. If not provided, defaults to true.\n */\n public addSupportedRequirement(requirement: SupportedRequirement, value: number | boolean = true): this {\n if (!this.supportedRequirements.has(requirement)) {\n this.supportedRequirements.set(requirement, new Set());\n }\n this.supportedRequirements.get(requirement)!.add(value);\n return this;\n }\n\n /**\n * Returns a map of incompatible flags. If the block flags are compatible, returns undefined.\n * @param blockFlags - The block flags.\n * @returns A map of incompatible flags, or undefined if the block flags are compatible.\n */\n public getIncompatibleFlags(blockFlags: BlockCodeFeatureFlags | undefined): Map<`requires${string}`, number | boolean> | undefined {\n if (blockFlags === undefined) return undefined;\n const incompatibleFlags = new Map<`requires${string}`, number | boolean>();\n for (const [key, value] of Object.entries(blockFlags)) {\n if (key.startsWith('requires')) {\n if (value === undefined) continue;\n const supportedValues = this.supportedRequirements.get(key as `requires${string}`);\n if (supportedValues === undefined || !supportedValues.has(value as number | boolean)) {\n incompatibleFlags.set(key as `requires${string}`, value as number | boolean);\n }\n }\n }\n return incompatibleFlags.size === 0 ? undefined : incompatibleFlags;\n }\n\n /**\n * Checks if the block flags are compatible with the runtime capabilities.\n * @param blockFlags - The block flags.\n * @returns True if the block flags are compatible, false otherwise.\n */\n public checkCompatibility(blockFlags: BlockCodeFeatureFlags | undefined): boolean {\n return this.getIncompatibleFlags(blockFlags) === undefined;\n }\n\n /**\n * Throws an error if the block flags are incompatible with the runtime capabilities.\n * @param blockFlags - The block flags.\n * @throws IncompatibleFlagsError if the block flags are incompatible with the runtime capabilities.\n */\n public throwIfIncompatible(blockFlags: BlockCodeFeatureFlags | undefined) {\n const incompatibleFlags = this.getIncompatibleFlags(blockFlags);\n if (incompatibleFlags !== undefined)\n throw new IncompatibleFlagsError(incompatibleFlags);\n }\n}\n"],"names":[],"mappings":"AAGM,SAAU,cAAc,CAAC,KAAwC,EAAE,IAAsC,EAAE,YAA8B,IAAI,EAAA;IACjJ,IAAI,K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ACrE,OAAO,IAAI,CAAC,oBAAoB,CAAC,UAAU,CAAC,KAAK,SAAS;IAC5D;AAEA;;;;AAIK;AACE,IAAA,mBAAmB,CAAC,UAA6C,EAAA;QACtE,MAAM,iBAAiB,GAAG,IAAI,CAAC,oBAAoB,CAAC,UAAU,CAAC;QAC/D,IAAI,iBAAiB,KAAK,SAAS;AACjC,YAAA,MAAM,IAAI,sBAAsB,CAAC,iBAAiB,CAAC;IACvD;AACD;;;;"}
1
+ {"version":3,"file":"flag_utils.js","sources":["../../src/flags/flag_utils.ts"],"sourcesContent":["import type { BlockCodeFeatureFlags, BlockCodeKnownFeatureFlags } from \"./block_flags\";\nimport type { FilterKeysByPrefix } from \"./type_utils\";\n\nexport function checkBlockFlag(\n flags: BlockCodeFeatureFlags | undefined,\n flag: keyof BlockCodeKnownFeatureFlags,\n flagValue: boolean | number = true,\n): boolean {\n if (flags === undefined) return false;\n return flags[flag] === flagValue;\n}\n\n/**\n * Extracts all requirements from the feature flags.\n * @param flags - The feature flags.\n * @returns A set of requirements.\n */\nexport function extractAllRequirements(\n flags: BlockCodeFeatureFlags | undefined,\n): Set<`requires${string}`> {\n if (flags === undefined) return new Set();\n return new Set(\n Object.entries(flags)\n .filter(([key, value]) => key.startsWith(\"requires\") && value === true)\n .map(([key]) => key as `requires${string}`),\n );\n}\n\n/**\n * Extracts all supports from the feature flags.\n * @param flags - The feature flags.\n * @returns A set of supports.\n */\nexport function extractAllSupports(\n flags: BlockCodeFeatureFlags | undefined,\n): Set<`supports${string}`> {\n if (flags === undefined) return new Set();\n return new Set(\n Object.entries(flags)\n .filter(([key, value]) => key.startsWith(\"supports\") && value === true)\n .map(([key]) => key as `supports${string}`),\n );\n}\n\nexport class IncompatibleFlagsError extends Error {\n name = \"IncompatibleFlagsError\";\n constructor(public readonly incompatibleFlags: Map<`requires${string}`, number | boolean>) {\n super(\n `Some of the block requirements are not supported by the runtime: ${Array.from(\n incompatibleFlags.entries(),\n )\n .map(([key, value]) => `${key}: ${value}`)\n .join(\", \")}`,\n );\n }\n}\n\n/**\n * A type that represents a supported requirement.\n * @remarks\n * This type is used to represent a supported requirement.\n * It is a subtype of `BlockCodeKnownFeatureFlags` and is used to represent a supported requirement.\n * It is used to represent a supported requirement.\n */\nexport type SupportedRequirement = FilterKeysByPrefix<BlockCodeKnownFeatureFlags, \"requires\">;\n\nexport class RuntimeCapabilities {\n private readonly supportedRequirements: Map<`requires${string}`, Set<number | boolean>> =\n new Map();\n\n /**\n * Adds a supported requirement to the runtime capabilities.\n * @param requirement - The requirement.\n * @param value - The value of the requirement. If not provided, defaults to true.\n */\n public addSupportedRequirement(\n requirement: SupportedRequirement,\n value: number | boolean = true,\n ): this {\n if (!this.supportedRequirements.has(requirement)) {\n this.supportedRequirements.set(requirement, new Set());\n }\n this.supportedRequirements.get(requirement)!.add(value);\n return this;\n }\n\n /**\n * Returns a map of incompatible flags. If the block flags are compatible, returns undefined.\n * @param blockFlags - The block flags.\n * @returns A map of incompatible flags, or undefined if the block flags are compatible.\n */\n public getIncompatibleFlags(\n blockFlags: BlockCodeFeatureFlags | undefined,\n ): Map<`requires${string}`, number | boolean> | undefined {\n if (blockFlags === undefined) return undefined;\n const incompatibleFlags = new Map<`requires${string}`, number | boolean>();\n for (const [key, value] of Object.entries(blockFlags)) {\n if (key.startsWith(\"requires\")) {\n if (value === undefined) continue;\n const supportedValues = this.supportedRequirements.get(key as `requires${string}`);\n if (supportedValues === undefined || !supportedValues.has(value as number | boolean)) {\n incompatibleFlags.set(key as `requires${string}`, value as number | boolean);\n }\n }\n }\n return incompatibleFlags.size === 0 ? undefined : incompatibleFlags;\n }\n\n /**\n * Checks if the block flags are compatible with the runtime capabilities.\n * @param blockFlags - The block flags.\n * @returns True if the block flags are compatible, false otherwise.\n */\n public checkCompatibility(blockFlags: BlockCodeFeatureFlags | undefined): boolean {\n return this.getIncompatibleFlags(blockFlags) === undefined;\n }\n\n /**\n * Throws an error if the block flags are incompatible with the runtime capabilities.\n * @param blockFlags - The block flags.\n * @throws IncompatibleFlagsError if the block flags are incompatible with the runtime capabilities.\n */\n public throwIfIncompatible(blockFlags: BlockCodeFeatureFlags | undefined) {\n const incompatibleFlags = this.getIncompatibleFlags(blockFlags);\n if (incompatibleFlags !== undefined) throw new IncompatibleFlagsError(incompatibleFlags);\n }\n}\n"],"names":[],"mappings":"AAGM,SAAU,cAAc,CAC5B,KAAwC,EACxC,IAAsC,EACtC,YAA8B,IAAI,EAAA;IAElC,IAAI,KAAK,KAAK,SAAS;AAAE,QAAA,OAAO,KAAK;AACrC,IAAA,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,SAAS;AAClC;AAEA;;;;AAIG;AACG,SAAU,sBAAsB,CACpC,KAAwC,EAAA;IAExC,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,IAAI,GAAG,EAAE;IACzC,OAAO,IAAI,GAAG,CACZ,MAAM,CAAC,OAAO,CAAC,KAAK;SACjB,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,KAAK,KAAK,IAAI;SACrE,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,GAA0B,CAAC,CAC9C;AACH;AAEA;;;;AAIG;AACG,SAAU,kBAAkB,CAChC,KAAwC,EAAA;IAExC,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,IAAI,GAAG,EAAE;IACzC,OAAO,IAAI,GAAG,CACZ,MAAM,CAAC,OAAO,CAAC,KAAK;SACjB,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,KAAK,KAAK,IAAI;SACrE,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,GAA0B,CAAC,CAC9C;AACH;AAEM,MAAO,sBAAuB,SAAQ,KAAK,CAAA;AAEnB,IAAA,iBAAA;IAD5B,IAAI,GAAG,wBAAwB;AAC/B,IA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AI,eAAe,KAAK,SAAS,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,KAAyB,CAAC,EAAE;AACpF,oBAAA,iBAAiB,CAAC,GAAG,CAAC,GAA0B,EAAE,KAAyB,CAAC;gBAC9E;YACF;QACF;AACA,QAAA,OAAO,iBAAiB,CAAC,IAAI,KAAK,CAAC,GAAG,SAAS,GAAG,iBAAiB;IACrE;AAEA;;;;AAIG;AACI,IAAA,kBAAkB,CAAC,UAA6C,EAAA;QACrE,OAAO,IAAI,CAAC,oBAAoB,CAAC,UAAU,CAAC,KAAK,SAAS;IAC5D;AAEA;;;;AAIG;AACI,IAAA,mBAAmB,CAAC,UAA6C,EAAA;QACtE,MAAM,iBAAiB,GAAG,IAAI,CAAC,oBAAoB,CAAC,UAAU,CAAC;QAC/D,IAAI,iBAAiB,KAAK,SAAS;AAAE,YAAA,MAAM,IAAI,sBAAsB,CAAC,iBAAiB,CAAC;IAC1F;AACD;;;;"}
@@ -1,4 +1,4 @@
1
- export * from './block_flags';
2
- export * from './flag_utils';
3
- export * from './type_utils';
1
+ export * from "./block_flags";
2
+ export * from "./flag_utils";
3
+ export * from "./type_utils";
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -9,7 +9,7 @@ export type FilterKeysByPrefix<T, P extends string> = keyof {
9
9
  * We use this to ensure all feature flags are accounted for in the arrays below.
10
10
  */
11
11
  export type AssertKeysEqual<T, U> = (<V>() => V extends T ? 1 : 2) extends <V>() => V extends U ? 1 : 2 ? unknown : {
12
- error: 'Feature flag definitions are out of sync';
12
+ error: "Feature flag definitions are out of sync";
13
13
  expected: T;
14
14
  actual: U;
15
15
  };
@@ -1 +1 @@
1
- {"version":3,"file":"type_utils.d.ts","sourceRoot":"","sources":["../../src/flags/type_utils.ts"],"names":[],"mappings":"AACA;;GAEG;AACH,MAAM,MAAM,kBAAkB,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,IAAI,MAAM;KACzD,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,S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,SAAS,KAAK,GACrB,CAAC,CAAC,MAAM,CAAC,GACT,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC"}
package/dist/httpAuth.cjs CHANGED
@@ -3,14 +3,13 @@
3
3
  /* TODO: replace atob/btoa with Uint8Array.toBase64/fromBase64 in the future */
4
4
  function parseHttpAuth(input) {
5
5
  const match = /(?<scheme>.*?) (?<parameters>.*)/.exec(input);
6
- if (match?.groups?.scheme === 'Basic') {
7
- const credentialsMatch = /(?<username>.*?):(?<password>.*)/
8
- .exec(atob(match.groups.parameters));
6
+ if (match?.groups?.scheme === "Basic") {
7
+ const credentialsMatch = /(?<username>.*?):(?<password>.*)/.exec(atob(match.groups.parameters));
9
8
  if (!credentialsMatch?.groups) {
10
9
  throw new Error(`Malformed credentials.`);
11
10
  }
12
11
  return {
13
- scheme: 'Basic',
12
+ scheme: "Basic",
14
13
  username: credentialsMatch.groups.username,
15
14
  password: credentialsMatch.groups.password,
16
15
  };
@@ -18,7 +17,7 @@ function parseHttpAuth(input) {
18
17
  throw new Error(`Unsupported auth scheme: ${match?.groups?.scheme}.`);
19
18
  }
20
19
  function serializeHttpAuth(input) {
21
- if (input.scheme === 'Basic') {
20
+ if (input.scheme === "Basic") {
22
21
  return `Basic ${btoa(`${input.username}:${input.password}`)}`;
23
22
  }
24
23
  throw new Error(`Unsupported auth scheme: ${input.scheme}.`);
@@ -1 +1 @@
1
- {"version":3,"file":"httpAuth.cjs","sources":["../src/httpAuth.ts"],"sourcesContent":["/* TODO: replace atob/btoa with Uint8Array.toBase64/fromBase64 in the future */\n\nexport function parseHttpAuth(input: string): HttpAuth {\n const match = /(?<scheme>.*?) (?<parameters>.*)/.exec(input);\n if (match?.groups?.scheme === 'Basic') {\n const credentialsMatch = /(?<username>.*?):(?<password>.*)/\n .exec(atob(match.groups.parameters));\n if (!credentialsMatch?.groups) {\n throw new Error(`Malformed credentials.`);\n }\n return {\n scheme: 'Basic',\n username: credentialsMatch.groups.username,\n password: credentialsMatch.groups.password,\n };\n }\n throw new Error(`Unsupported auth scheme: ${match?.groups?.scheme}.`);\n}\n\nexport function serializeHttpAuth(input: HttpAuth): string {\n if (input.scheme === 'Basic') {\n return `Basic ${btoa(`${input.username}:${input.password}`)}`;\n }\n throw new Error(`Unsupported auth scheme: ${input.scheme as string}.`);\n}\n\nexport type HttpAuth = BasicHttpAuth;\n\nexport interface BasicHttpAuth {\n scheme: 'Basic';\n username: string;\n password: string;\n}\n"],"names":[],"mappings":";;AAAA;AAEM,SAAU,aAAa,CAAC,KAAa,EAAA;IACzC,MAAM,KAAK,GAAG,kCAAkC,CAAC,IAAI,CAAC,KAAK,CAAC;IAC5D,IAAI,KAAK,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,EAAE;QACrC,MAAM,gBAAgB,GAAG;aACtB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;AACtC,QAAA,IAAI,CAAC,gBAAgB,EAAE,MAAM,EAAE;AAC7B,YAAA,MAAM,IAAI,KAAK,CAAC,CAAA,sBAAA,CAAwB,CAAC;QAC3C;QACA,OAAO;AACL,YAAA,MAAM,EAAE,OAAO;AACf,YAAA,QAAQ,EAAE,gBAAgB,CAAC,MAAM,CAAC,QAAQ;AAC1C,YAAA,QAAQ,EAAE,gBAAgB,CAAC,MAAM,CAAC,QAAQ;SAC3C;IACH;IACA,MAAM,IAAI,KAAK,CAAC,CAAA,yBAAA,EAA4B,KAAK,EAAE,MAAM,EAAE,MAAM,CAAA,CAAA,CAAG,CAAC;AACvE;AAEM,SAAU,iBAAiB,CAAC,KAAe,EAAA;AAC/C,IAAA,IAAI,KAAK,CAAC,MAAM,KAAK,OAAO,EAAE;AAC5B,QAAA,OAAO,CAAA,MAAA,EAAS,IAAI,CAAC,CAAA,EAAG,KAAK,CAAC,QAAQ,CAAA,CAAA,EAAI,KAAK,CAAC,QAAQ,CAAA,CAAE,CAAC,EAAE;IAC/D;IACA,MAAM,IAAI,KAAK,CAAC,CAAA,yBAAA,EAA4B,KAAK,CAAC,MAAgB,CAAA,CAAA,CAAG,CAAC;AACxE;;;;;"}
1
+ {"version":3,"file":"httpAuth.cjs","sources":["../src/httpAuth.ts"],"sourcesContent":["/* TODO: replace atob/btoa with Uint8Array.toBase64/fromBase64 in the future */\n\nexport function parseHttpAuth(input: string): HttpAuth {\n const match = /(?<scheme>.*?) (?<parameters>.*)/.exec(input);\n if (match?.groups?.scheme === \"Basic\") {\n const credentialsMatch = /(?<username>.*?):(?<password>.*)/.exec(atob(match.groups.parameters));\n if (!credentialsMatch?.groups) {\n throw new Error(`Malformed credentials.`);\n }\n return {\n scheme: \"Basic\",\n username: credentialsMatch.groups.username,\n password: credentialsMatch.groups.password,\n };\n }\n throw new Error(`Unsupported auth scheme: ${match?.groups?.scheme}.`);\n}\n\nexport function serializeHttpAuth(input: HttpAuth): string {\n if (input.scheme === \"Basic\") {\n return `Basic ${btoa(`${input.username}:${input.password}`)}`;\n }\n throw new Error(`Unsupported auth scheme: ${input.scheme as string}.`);\n}\n\nexport type HttpAuth = BasicHttpAuth;\n\nexport interface BasicHttpAuth {\n scheme: \"Basic\";\n username: string;\n password: string;\n}\n"],"names":[],"mappings":";;AAAA;AAEM,SAAU,aAAa,CAAC,KAAa,EAAA;IACzC,MAAM,KAAK,GAAG,kCAAkC,CAAC,IAAI,CAAC,KAAK,CAAC;IAC5D,IAAI,KAAK,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,EAAE;AACrC,QAAA,MAAM,gBAAgB,GAAG,kCAAkC,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;AAC/F,QAAA,IAAI,CAAC,gBAAgB,EAAE,MAAM,EAAE;AAC7B,YAAA,MAAM,IAAI,KAAK,CAAC,CAAA,sBAAA,CAAwB,CAAC;QAC3C;QACA,OAAO;AACL,YAAA,MAAM,EAAE,OAAO;AACf,YAAA,QAAQ,EAAE,gBAAgB,CAAC,MAAM,CAAC,QAAQ;AAC1C,YAAA,QAAQ,EAAE,gBAAgB,CAAC,MAAM,CAAC,QAAQ;SAC3C;IACH;IACA,MAAM,IAAI,KAAK,CAAC,CAAA,yBAAA,EAA4B,KAAK,EAAE,MAAM,EAAE,MAAM,CAAA,CAAA,CAAG,CAAC;AACvE;AAEM,SAAU,iBAAiB,CAAC,KAAe,EAAA;AAC/C,IAAA,IAAI,KAAK,CAAC,MAAM,KAAK,OAAO,EAAE;AAC5B,QAAA,OAAO,CAAA,MAAA,EAAS,IAAI,CAAC,CAAA,EAAG,KAAK,CAAC,QAAQ,CAAA,CAAA,EAAI,KAAK,CAAC,QAAQ,CAAA,CAAE,CAAC,EAAE;IAC/D;IACA,MAAM,IAAI,KAAK,CAAC,CAAA,yBAAA,EAA4B,KAAK,CAAC,MAAgB,CAAA,CAAA,CAAG,CAAC;AACxE;;;;;"}
@@ -2,7 +2,7 @@ export declare function parseHttpAuth(input: string): HttpAuth;
2
2
  export declare function serializeHttpAuth(input: HttpAuth): string;
3
3
  export type HttpAuth = BasicHttpAuth;
4
4
  export interface BasicHttpAuth {
5
- scheme: 'Basic';
5
+ scheme: "Basic";
6
6
  username: string;
7
7
  password: string;
8
8
  }
@@ -1 +1 @@
1
- {"version":3,"file":"httpAuth.d.ts","sourceRoot":"","sources":["../src/httpAuth.ts"],"names":[],"mappings":"AAEA,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,CAerD;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,CAKzD;AAED,MAAM,MAAM,QAAQ,GAAG,aAAa,CAAC;AAErC,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB"}
1
+ {"version":3,"file":"httpAuth.d.ts","sourceRoot":"","sources":["../src/httpAuth.ts"],"names":[],"mappings":"AAEA,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,CAcrD;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,CAKzD;AAED,MAAM,MAAM,QAAQ,GAAG,aAAa,CAAC;AAErC,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB"}
package/dist/httpAuth.js CHANGED
@@ -1,14 +1,13 @@
1
1
  /* TODO: replace atob/btoa with Uint8Array.toBase64/fromBase64 in the future */
2
2
  function parseHttpAuth(input) {
3
3
  const match = /(?<scheme>.*?) (?<parameters>.*)/.exec(input);
4
- if (match?.groups?.scheme === 'Basic') {
5
- const credentialsMatch = /(?<username>.*?):(?<password>.*)/
6
- .exec(atob(match.groups.parameters));
4
+ if (match?.groups?.scheme === "Basic") {
5
+ const credentialsMatch = /(?<username>.*?):(?<password>.*)/.exec(atob(match.groups.parameters));
7
6
  if (!credentialsMatch?.groups) {
8
7
  throw new Error(`Malformed credentials.`);
9
8
  }
10
9
  return {
11
- scheme: 'Basic',
10
+ scheme: "Basic",
12
11
  username: credentialsMatch.groups.username,
13
12
  password: credentialsMatch.groups.password,
14
13
  };
@@ -16,7 +15,7 @@ function parseHttpAuth(input) {
16
15
  throw new Error(`Unsupported auth scheme: ${match?.groups?.scheme}.`);
17
16
  }
18
17
  function serializeHttpAuth(input) {
19
- if (input.scheme === 'Basic') {
18
+ if (input.scheme === "Basic") {
20
19
  return `Basic ${btoa(`${input.username}:${input.password}`)}`;
21
20
  }
22
21
  throw new Error(`Unsupported auth scheme: ${input.scheme}.`);
@@ -1 +1 @@
1
- {"version":3,"file":"httpAuth.js","sources":["../src/httpAuth.ts"],"sourcesContent":["/* TODO: replace atob/btoa with Uint8Array.toBase64/fromBase64 in the future */\n\nexport function parseHttpAuth(input: string): HttpAuth {\n const match = /(?<scheme>.*?) (?<parameters>.*)/.exec(input);\n if (match?.groups?.scheme === 'Basic') {\n const credentialsMatch = /(?<username>.*?):(?<password>.*)/\n .exec(atob(match.groups.parameters));\n if (!credentialsMatch?.groups) {\n throw new Error(`Malformed credentials.`);\n }\n return {\n scheme: 'Basic',\n username: credentialsMatch.groups.username,\n password: credentialsMatch.groups.password,\n };\n }\n throw new Error(`Unsupported auth scheme: ${match?.groups?.scheme}.`);\n}\n\nexport function serializeHttpAuth(input: HttpAuth): string {\n if (input.scheme === 'Basic') {\n return `Basic ${btoa(`${input.username}:${input.password}`)}`;\n }\n throw new Error(`Unsupported auth scheme: ${input.scheme as string}.`);\n}\n\nexport type HttpAuth = BasicHttpAuth;\n\nexport interface BasicHttpAuth {\n scheme: 'Basic';\n username: string;\n password: string;\n}\n"],"names":[],"mappings":"AAAA;AAEM,SAAU,aAAa,CAAC,KAAa,EAAA;IACzC,MAAM,KAAK,GAAG,kCAAkC,CAAC,IAAI,CAAC,KAAK,CAAC;IAC5D,IAAI,KAAK,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,EAAE;QACrC,MAAM,gBAAgB,GAAG;aACtB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;AACtC,QAAA,IAAI,CAAC,gBAAgB,EAAE,MAAM,EAAE;AAC7B,YAAA,MAAM,IAAI,KAAK,CAAC,CAAA,sBAAA,CAAwB,CAAC;QAC3C;QACA,OAAO;AACL,YAAA,MAAM,EAAE,OAAO;AACf,YAAA,QAAQ,EAAE,gBAAgB,CAAC,MAAM,CAAC,QAAQ;AAC1C,YAAA,QAAQ,EAAE,gBAAgB,CAAC,MAAM,CAAC,QAAQ;SAC3C;IACH;IACA,MAAM,IAAI,KAAK,CAAC,CAAA,yBAAA,EAA4B,KAAK,EAAE,MAAM,EAAE,MAAM,CAAA,CAAA,CAAG,CAAC;AACvE;AAEM,SAAU,iBAAiB,CAAC,KAAe,EAAA;AAC/C,IAAA,IAAI,KAAK,CAAC,MAAM,KAAK,OAAO,EAAE;AAC5B,QAAA,OAAO,CAAA,MAAA,EAAS,IAAI,CAAC,CAAA,EAAG,KAAK,CAAC,QAAQ,CAAA,CAAA,EAAI,KAAK,CAAC,QAAQ,CAAA,CAAE,CAAC,EAAE;IAC/D;IACA,MAAM,IAAI,KAAK,CAAC,CAAA,yBAAA,EAA4B,KAAK,CAAC,MAAgB,CAAA,CAAA,CAAG,CAAC;AACxE;;;;"}
1
+ {"version":3,"file":"httpAuth.js","sources":["../src/httpAuth.ts"],"sourcesContent":["/* TODO: replace atob/btoa with Uint8Array.toBase64/fromBase64 in the future */\n\nexport function parseHttpAuth(input: string): HttpAuth {\n const match = /(?<scheme>.*?) (?<parameters>.*)/.exec(input);\n if (match?.groups?.scheme === \"Basic\") {\n const credentialsMatch = /(?<username>.*?):(?<password>.*)/.exec(atob(match.groups.parameters));\n if (!credentialsMatch?.groups) {\n throw new Error(`Malformed credentials.`);\n }\n return {\n scheme: \"Basic\",\n username: credentialsMatch.groups.username,\n password: credentialsMatch.groups.password,\n };\n }\n throw new Error(`Unsupported auth scheme: ${match?.groups?.scheme}.`);\n}\n\nexport function serializeHttpAuth(input: HttpAuth): string {\n if (input.scheme === \"Basic\") {\n return `Basic ${btoa(`${input.username}:${input.password}`)}`;\n }\n throw new Error(`Unsupported auth scheme: ${input.scheme as string}.`);\n}\n\nexport type HttpAuth = BasicHttpAuth;\n\nexport interface BasicHttpAuth {\n scheme: \"Basic\";\n username: string;\n password: string;\n}\n"],"names":[],"mappings":"AAAA;AAEM,SAAU,aAAa,CAAC,KAAa,EAAA;IACzC,MAAM,KAAK,GAAG,kCAAkC,CAAC,IAAI,CAAC,KAAK,CAAC;IAC5D,IAAI,KAAK,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,EAAE;AACrC,QAAA,MAAM,gBAAgB,GAAG,kCAAkC,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;AAC/F,QAAA,IAAI,CAAC,gBAAgB,EAAE,MAAM,EAAE;AAC7B,YAAA,MAAM,IAAI,KAAK,CAAC,CAAA,sBAAA,CAAwB,CAAC;QAC3C;QACA,OAAO;AACL,YAAA,MAAM,EAAE,OAAO;AACf,YAAA,QAAQ,EAAE,gBAAgB,CAAC,MAAM,CAAC,QAAQ;AAC1C,YAAA,QAAQ,EAAE,gBAAgB,CAAC,MAAM,CAAC,QAAQ;SAC3C;IACH;IACA,MAAM,IAAI,KAAK,CAAC,CAAA,yBAAA,EAA4B,KAAK,EAAE,MAAM,EAAE,MAAM,CAAA,CAAA,CAAG,CAAC;AACvE;AAEM,SAAU,iBAAiB,CAAC,KAAe,EAAA;AAC/C,IAAA,IAAI,KAAK,CAAC,MAAM,KAAK,OAAO,EAAE;AAC5B,QAAA,OAAO,CAAA,MAAA,EAAS,IAAI,CAAC,CAAA,EAAG,KAAK,CAAC,QAAQ,CAAA,CAAA,EAAI,KAAK,CAAC,QAAQ,CAAA,CAAE,CAAC,EAAE;IAC/D;IACA,MAAM,IAAI,KAAK,CAAC,CAAA,yBAAA,EAA4B,KAAK,CAAC,MAAgB,CAAA,CAAA,CAAG,CAAC;AACxE;;;;"}
package/dist/index.d.ts CHANGED
@@ -1,20 +1,20 @@
1
- export * from './author_marker';
2
- export * from './block_state';
3
- export * from './bmodel';
4
- export * from './branding';
5
- export * from './common_types';
6
- export * from './driver_kit';
7
- export * from './drivers';
8
- export * from './errors';
9
- export * from './flags';
10
- export * from './json';
11
- export * from './navigation';
12
- export * from './plid';
13
- export * from './pool';
14
- export * from './ref';
15
- export * from './utag';
16
- export * from './value_or_error';
17
- export * from './base64';
18
- export * from './util';
19
- export * from './httpAuth';
1
+ export * from "./author_marker";
2
+ export * from "./block_state";
3
+ export * from "./bmodel";
4
+ export * from "./branding";
5
+ export * from "./common_types";
6
+ export * from "./driver_kit";
7
+ export * from "./drivers";
8
+ export * from "./errors";
9
+ export * from "./flags";
10
+ export * from "./json";
11
+ export * from "./navigation";
12
+ export * from "./plid";
13
+ export * from "./pool";
14
+ export * from "./ref";
15
+ export * from "./utag";
16
+ export * from "./value_or_error";
17
+ export * from "./base64";
18
+ export * from "./util";
19
+ export * from "./httpAuth";
20
20
  //# sourceMappingURL=index.d.ts.map
package/dist/json.cjs CHANGED
@@ -12,7 +12,7 @@ function parseJson(value) {
12
12
  return JSON.parse(value);
13
13
  }
14
14
  function bigintReplacer(_key, value) {
15
- return typeof value === 'bigint' ? value.toString() : value;
15
+ return typeof value === "bigint" ? value.toString() : value;
16
16
  }
17
17
 
18
18
  exports.bigintReplacer = bigintReplacer;
package/dist/json.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"json.cjs","sources":["../src/json.ts"],"sourcesContent":["import canonicalize from 'canonicalize';\n\ntype JsonPrimitive = string | number | boolean | null;\n\ntype JsonValue = JsonPrimitive | JsonValue[] | { [key: string]: JsonValue };\n\nexport type JsonSerializable =\n | JsonPrimitive\n | JsonSerializable[]\n | { [key: string]: JsonSerializable }\n | { toJSON(): JsonValue };\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\ntype NotAssignableToJson = bigint | symbol | Function;\n\nexport type JsonCompatible<T> = unknown extends T ? unknown\n : [T] extends [JsonValue] ? T\n : [T] extends [NotAssignableToJson] ? never\n : {\n [P in keyof T]: [Exclude<T[P], undefined>] extends [JsonValue] ? T[P]\n : [Exclude<T[P], undefined>] extends [NotAssignableToJson] ? never\n : JsonCompatible<T[P]>;\n };\n\nexport type StringifiedJson<T = unknown> = JsonCompatible<T> extends never ? never : string & {\n __json_stringified: T;\n};\n\nexport function stringifyJson<T>(value: JsonCompatible<T>): StringifiedJson<T>;\nexport function stringifyJson<T extends JsonSerializable>(value: T): string;\nexport function stringifyJson(value: unknown): string {\n return JSON.stringify(value);\n}\n\nexport type CanonicalizedJson<T = unknown> = JsonCompatible<T> extends never ? never : string & {\n __json_canonicalized: T;\n};\n\nexport function canonicalizeJson<T>(value: JsonCompatible<T>): CanonicalizedJson<T>;\nexport function canonicalizeJson<T extends JsonSerializable>(value: T): string;\nexport function canonicalizeJson(value: unknown): string {\n return canonicalize(value)!;\n}\n\nexport function parseJson<T>(value: StringifiedJson<T> | CanonicalizedJson<T>): T {\n return JSON.parse(value) as T;\n}\n\nexport function bigintReplacer(_key: string, value: unknown): unknown {\n return typeof value === 'bigint' ? value.toString() : value;\n}\n"],"names":[],"mappings":";;;;AA8BM,SAAU,aAAa,CAAC,KAAc,EAAA;AAC1C,IAAA,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;AAC9B;AAQM,SAAU,gBAAgB,CAAC,KAAc,EAAA;AAC7C,IAAA,OAAO,YAAY,CAAC,KAAK,CAAE;AAC7B;AAEM,SAAU,SAAS,CAAI,KAAgD,EAAA;AAC3E,IAAA,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAM;AAC/B;AAEM,SAAU,cAAc,CAAC,IAAY,EAAE,KAAc,EAAA;AACzD,IAAA,OAAO,OAAO,KAAK,KAAK,QAAQ,GAAG,KAAK,CAAC,QAAQ,EAAE,GAAG,KAAK;AAC7D;;;;;;;"}
1
+ {"version":3,"file":"json.cjs","sources":["../src/json.ts"],"sourcesContent":["import canonicalize from \"canonicalize\";\n\ntype JsonPrimitive = string | number | boolean | null;\n\ntype JsonValue = JsonPrimitive | JsonValue[] | { [key: string]: JsonValue };\n\nexport type JsonSerializable =\n | JsonPrimitive\n | JsonSerializable[]\n | { [key: string]: JsonSerializable }\n | { toJSON(): JsonValue };\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\ntype NotAssignableToJson = bigint | symbol | Function;\n\nexport type JsonCompatible<T> = unknown extends T\n ? unknown\n : [T] extends [JsonValue]\n ? T\n : [T] extends [NotAssignableToJson]\n ? never\n : {\n [P in keyof T]: [Exclude<T[P], undefined>] extends [JsonValue]\n ? T[P]\n : [Exclude<T[P], undefined>] extends [NotAssignableToJson]\n ? never\n : JsonCompatible<T[P]>;\n };\n\nexport type StringifiedJson<T = unknown> =\n JsonCompatible<T> extends never\n ? never\n : string & {\n __json_stringified: T;\n };\n\nexport function stringifyJson<T>(value: JsonCompatible<T>): StringifiedJson<T>;\nexport function stringifyJson<T extends JsonSerializable>(value: T): string;\nexport function stringifyJson(value: unknown): string {\n return JSON.stringify(value);\n}\n\nexport type CanonicalizedJson<T = unknown> =\n JsonCompatible<T> extends never\n ? never\n : string & {\n __json_canonicalized: T;\n };\n\nexport function canonicalizeJson<T>(value: JsonCompatible<T>): CanonicalizedJson<T>;\nexport function canonicalizeJson<T extends JsonSerializable>(value: T): string;\nexport function canonicalizeJson(value: unknown): string {\n return canonicalize(value)!;\n}\n\nexport function parseJson<T>(value: StringifiedJson<T> | CanonicalizedJson<T>): T {\n return JSON.parse(value) as T;\n}\n\nexport function bigintReplacer(_key: string, value: unknown): unknown {\n return typeof value === \"bigint\" ? value.toString() : value;\n}\n"],"names":[],"mappings":";;;;AAsCM,SAAU,aAAa,CAAC,KAAc,EAAA;AAC1C,IAAA,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;AAC9B;AAWM,SAAU,gBAAgB,CAAC,KAAc,EAAA;AAC7C,IAAA,OAAO,YAAY,CAAC,KAAK,CAAE;AAC7B;AAEM,SAAU,SAAS,CAAI,KAAgD,EAAA;AAC3E,IAAA,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAM;AAC/B;AAEM,SAAU,cAAc,CAAC,IAAY,EAAE,KAAc,EAAA;AACzD,IAAA,OAAO,OAAO,KAAK,KAAK,QAAQ,GAAG,KAAK,CAAC,QAAQ,EAAE,GAAG,KAAK;AAC7D;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../src/json.ts"],"names":[],"mappings":"AAEA,KAAK,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAEtD,KAAK,SAAS,GAAG,aAAa,GAAG,SAAS,EAAE,GAAG;IAAE,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MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAEpE"}
package/dist/json.js CHANGED
@@ -10,7 +10,7 @@ function parseJson(value) {
10
10
  return JSON.parse(value);
11
11
  }
12
12
  function bigintReplacer(_key, value) {
13
- return typeof value === 'bigint' ? value.toString() : value;
13
+ return typeof value === "bigint" ? value.toString() : value;
14
14
  }
15
15
 
16
16
  export { bigintReplacer, canonicalizeJson, parseJson, stringifyJson };
package/dist/json.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"json.js","sources":["../src/json.ts"],"sourcesContent":["import canonicalize from 'canonicalize';\n\ntype JsonPrimitive = string | number | boolean | null;\n\ntype JsonValue = JsonPrimitive | JsonValue[] | { [key: string]: JsonValue };\n\nexport type JsonSerializable =\n | JsonPrimitive\n | JsonSerializable[]\n | { [key: string]: JsonSerializable }\n | { toJSON(): JsonValue };\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\ntype NotAssignableToJson = bigint | symbol | Function;\n\nexport type JsonCompatible<T> = unknown extends T ? unknown\n : [T] extends [JsonValue] ? T\n : [T] extends [NotAssignableToJson] ? never\n : {\n [P in keyof T]: [Exclude<T[P], undefined>] extends [JsonValue] ? T[P]\n : [Exclude<T[P], undefined>] extends [NotAssignableToJson] ? never\n : JsonCompatible<T[P]>;\n };\n\nexport type StringifiedJson<T = unknown> = JsonCompatible<T> extends never ? never : string & {\n __json_stringified: T;\n};\n\nexport function stringifyJson<T>(value: JsonCompatible<T>): StringifiedJson<T>;\nexport function stringifyJson<T extends JsonSerializable>(value: T): string;\nexport function stringifyJson(value: unknown): string {\n return JSON.stringify(value);\n}\n\nexport type CanonicalizedJson<T = unknown> = JsonCompatible<T> extends never ? never : string & {\n __json_canonicalized: T;\n};\n\nexport function canonicalizeJson<T>(value: JsonCompatible<T>): CanonicalizedJson<T>;\nexport function canonicalizeJson<T extends JsonSerializable>(value: T): string;\nexport function canonicalizeJson(value: unknown): string {\n return canonicalize(value)!;\n}\n\nexport function parseJson<T>(value: StringifiedJson<T> | CanonicalizedJson<T>): T {\n return JSON.parse(value) as T;\n}\n\nexport function bigintReplacer(_key: string, value: unknown): unknown {\n return typeof value === 'bigint' ? value.toString() : value;\n}\n"],"names":[],"mappings":";;AA8BM,SAAU,aAAa,CAAC,KAAc,EAAA;AAC1C,IAAA,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;AAC9B;AAQM,SAAU,gBAAgB,CAAC,KAAc,EAAA;AAC7C,IAAA,OAAO,YAAY,CAAC,KAAK,CAAE;AAC7B;AAEM,SAAU,SAAS,CAAI,KAAgD,EAAA;AAC3E,IAAA,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAM;AAC/B;AAEM,SAAU,cAAc,CAAC,IAAY,EAAE,KAAc,EAAA;AACzD,IAAA,OAAO,OAAO,KAAK,KAAK,QAAQ,GAAG,KAAK,CAAC,QAAQ,EAAE,GAAG,KAAK;AAC7D;;;;"}
1
+ {"version":3,"file":"json.js","sources":["../src/json.ts"],"sourcesContent":["import canonicalize from \"canonicalize\";\n\ntype JsonPrimitive = string | number | boolean | null;\n\ntype JsonValue = JsonPrimitive | JsonValue[] | { [key: string]: JsonValue };\n\nexport type JsonSerializable =\n | JsonPrimitive\n | JsonSerializable[]\n | { [key: string]: JsonSerializable }\n | { toJSON(): JsonValue };\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\ntype NotAssignableToJson = bigint | symbol | Function;\n\nexport type JsonCompatible<T> = unknown extends T\n ? unknown\n : [T] extends [JsonValue]\n ? T\n : [T] extends [NotAssignableToJson]\n ? never\n : {\n [P in keyof T]: [Exclude<T[P], undefined>] extends [JsonValue]\n ? T[P]\n : [Exclude<T[P], undefined>] extends [NotAssignableToJson]\n ? never\n : JsonCompatible<T[P]>;\n };\n\nexport type StringifiedJson<T = unknown> =\n JsonCompatible<T> extends never\n ? never\n : string & {\n __json_stringified: T;\n };\n\nexport function stringifyJson<T>(value: JsonCompatible<T>): StringifiedJson<T>;\nexport function stringifyJson<T extends JsonSerializable>(value: T): string;\nexport function stringifyJson(value: unknown): string {\n return JSON.stringify(value);\n}\n\nexport type CanonicalizedJson<T = unknown> =\n JsonCompatible<T> extends never\n ? never\n : string & {\n __json_canonicalized: T;\n };\n\nexport function canonicalizeJson<T>(value: JsonCompatible<T>): CanonicalizedJson<T>;\nexport function canonicalizeJson<T extends JsonSerializable>(value: T): string;\nexport function canonicalizeJson(value: unknown): string {\n return canonicalize(value)!;\n}\n\nexport function parseJson<T>(value: StringifiedJson<T> | CanonicalizedJson<T>): T {\n return JSON.parse(value) as T;\n}\n\nexport function bigintReplacer(_key: string, value: unknown): unknown {\n return typeof value === \"bigint\" ? value.toString() : value;\n}\n"],"names":[],"mappings":";;AAsCM,SAAU,aAAa,CAAC,KAAc,EAAA;AAC1C,IAAA,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;AAC9B;AAWM,SAAU,gBAAgB,CAAC,KAAc,EAAA;AAC7C,IAAA,OAAO,YAAY,CAAC,KAAK,CAAE;AAC7B;AAEM,SAAU,SAAS,CAAI,KAAgD,EAAA;AAC3E,IAAA,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAM;AAC/B;AAEM,SAAU,cAAc,CAAC,IAAY,EAAE,KAAc,EAAA;AACzD,IAAA,OAAO,OAAO,KAAK,KAAK,QAAQ,GAAG,KAAK,CAAC,QAAQ,EAAE,GAAG,KAAK;AAC7D;;;;"}
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const DefaultNavigationState = { href: '/' };
3
+ const DefaultNavigationState = { href: "/" };
4
4
 
5
5
  exports.DefaultNavigationState = DefaultNavigationState;
6
6
  //# sourceMappingURL=navigation.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"navigation.cjs","sources":["../src/navigation.ts"],"sourcesContent":["/** Block section visualized as items in left panel block overview */\nexport type BlockSection = BlockSectionLink | BlockSectionDelimiter;\n\n/** Tells the system that specific section from the main UI of this block should\n * be opened */\nexport type BlockSectionLink = {\n /** Potentially there may be multiple section types, i.e. for \"+\" rows and for\n * sections directly opening html from the outputs. */\n readonly type: 'link';\n\n /** Internal block section identifier */\n readonly href: `/${string}`;\n\n /** Link visual appearance */\n readonly appearance?: BlockSectionLinkAppearance;\n\n /** Visible section title, can also be used in the window header. */\n readonly label: string;\n\n /** Optional text shown as a small badge next to the section */\n readonly badge?: string;\n};\n\n/** Different variants for link section appearance */\nexport type BlockSectionLinkAppearance =\n /** Shows a section of type `link` with a `+` icon and a certain specific style */\n 'add-section';\n\n/** Create a horizontal line between sections */\nexport type BlockSectionDelimiter = {\n readonly type: 'delimiter';\n};\n\n/**\n * Part of the block state, representing current navigation information\n * (i.e. currently selected section)\n */\nexport type NavigationState<Href extends `/${string}` = `/${string}`> = {\n readonly href: Href;\n};\n\nexport const DefaultNavigationState: NavigationState = { href: '/' };\n"],"names":[],"mappings":";;MAyCa,sBAAsB,GAAoB,EAAE,IAAI,EAAE,GAAG;;;;"}
1
+ {"version":3,"file":"navigation.cjs","sources":["../src/navigation.ts"],"sourcesContent":["/** Block section visualized as items in left panel block overview */\nexport type BlockSection = BlockSectionLink | BlockSectionDelimiter;\n\n/** Tells the system that specific section from the main UI of this block should\n * be opened */\nexport type BlockSectionLink = {\n /** Potentially there may be multiple section types, i.e. for \"+\" rows and for\n * sections directly opening html from the outputs. */\n readonly type: \"link\";\n\n /** Internal block section identifier */\n readonly href: `/${string}`;\n\n /** Link visual appearance */\n readonly appearance?: BlockSectionLinkAppearance;\n\n /** Visible section title, can also be used in the window header. */\n readonly label: string;\n\n /** Optional text shown as a small badge next to the section */\n readonly badge?: string;\n};\n\n/** Different variants for link section appearance */\nexport type BlockSectionLinkAppearance =\n /** Shows a section of type `link` with a `+` icon and a certain specific style */\n \"add-section\";\n\n/** Create a horizontal line between sections */\nexport type BlockSectionDelimiter = {\n readonly type: \"delimiter\";\n};\n\n/**\n * Part of the block state, representing current navigation information\n * (i.e. currently selected section)\n */\nexport type NavigationState<Href extends `/${string}` = `/${string}`> = {\n readonly href: Href;\n};\n\nexport const DefaultNavigationState: NavigationState = { href: \"/\" };\n"],"names":[],"mappings":";;MAyCa,sBAAsB,GAAoB,EAAE,IAAI,EAAE,GAAG;;;;"}
@@ -5,7 +5,7 @@ export type BlockSection = BlockSectionLink | BlockSectionDelimiter;
5
5
  export type BlockSectionLink = {
6
6
  /** Potentially there may be multiple section types, i.e. for "+" rows and for
7
7
  * sections directly opening html from the outputs. */
8
- readonly type: 'link';
8
+ readonly type: "link";
9
9
  /** Internal block section identifier */
10
10
  readonly href: `/${string}`;
11
11
  /** Link visual appearance */
@@ -18,10 +18,10 @@ export type BlockSectionLink = {
18
18
  /** Different variants for link section appearance */
19
19
  export type BlockSectionLinkAppearance =
20
20
  /** Shows a section of type `link` with a `+` icon and a certain specific style */
21
- 'add-section';
21
+ "add-section";
22
22
  /** Create a horizontal line between sections */
23
23
  export type BlockSectionDelimiter = {
24
- readonly type: 'delimiter';
24
+ readonly type: "delimiter";
25
25
  };
26
26
  /**
27
27
  * Part of the block state, representing current navigation information
@@ -1,4 +1,4 @@
1
- const DefaultNavigationState = { href: '/' };
1
+ const DefaultNavigationState = { href: "/" };
2
2
 
3
3
  export { DefaultNavigationState };
4
4
  //# sourceMappingURL=navigation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"navigation.js","sources":["../src/navigation.ts"],"sourcesContent":["/** Block section visualized as items in left panel block overview */\nexport type BlockSection = BlockSectionLink | BlockSectionDelimiter;\n\n/** Tells the system that specific section from the main UI of this block should\n * be opened */\nexport type BlockSectionLink = {\n /** Potentially there may be multiple section types, i.e. for \"+\" rows and for\n * sections directly opening html from the outputs. */\n readonly type: 'link';\n\n /** Internal block section identifier */\n readonly href: `/${string}`;\n\n /** Link visual appearance */\n readonly appearance?: BlockSectionLinkAppearance;\n\n /** Visible section title, can also be used in the window header. */\n readonly label: string;\n\n /** Optional text shown as a small badge next to the section */\n readonly badge?: string;\n};\n\n/** Different variants for link section appearance */\nexport type BlockSectionLinkAppearance =\n /** Shows a section of type `link` with a `+` icon and a certain specific style */\n 'add-section';\n\n/** Create a horizontal line between sections */\nexport type BlockSectionDelimiter = {\n readonly type: 'delimiter';\n};\n\n/**\n * Part of the block state, representing current navigation information\n * (i.e. currently selected section)\n */\nexport type NavigationState<Href extends `/${string}` = `/${string}`> = {\n readonly href: Href;\n};\n\nexport const DefaultNavigationState: NavigationState = { href: '/' };\n"],"names":[],"mappings":"MAyCa,sBAAsB,GAAoB,EAAE,IAAI,EAAE,GAAG;;;;"}
1
+ {"version":3,"file":"navigation.js","sources":["../src/navigation.ts"],"sourcesContent":["/** Block section visualized as items in left panel block overview */\nexport type BlockSection = BlockSectionLink | BlockSectionDelimiter;\n\n/** Tells the system that specific section from the main UI of this block should\n * be opened */\nexport type BlockSectionLink = {\n /** Potentially there may be multiple section types, i.e. for \"+\" rows and for\n * sections directly opening html from the outputs. */\n readonly type: \"link\";\n\n /** Internal block section identifier */\n readonly href: `/${string}`;\n\n /** Link visual appearance */\n readonly appearance?: BlockSectionLinkAppearance;\n\n /** Visible section title, can also be used in the window header. */\n readonly label: string;\n\n /** Optional text shown as a small badge next to the section */\n readonly badge?: string;\n};\n\n/** Different variants for link section appearance */\nexport type BlockSectionLinkAppearance =\n /** Shows a section of type `link` with a `+` icon and a certain specific style */\n \"add-section\";\n\n/** Create a horizontal line between sections */\nexport type BlockSectionDelimiter = {\n readonly type: \"delimiter\";\n};\n\n/**\n * Part of the block state, representing current navigation information\n * (i.e. currently selected section)\n */\nexport type NavigationState<Href extends `/${string}` = `/${string}`> = {\n readonly href: Href;\n};\n\nexport const DefaultNavigationState: NavigationState = { href: \"/\" };\n"],"names":[],"mappings":"MAyCa,sBAAsB,GAAoB,EAAE,IAAI,EAAE,GAAG;;;;"}
package/dist/plid.cjs CHANGED
@@ -11,20 +11,20 @@ const PlId = zod.z
11
11
  .string()
12
12
  .length(PlIdLength)
13
13
  .regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/) // RFC4648
14
- .brand('PlId');
14
+ .brand("PlId");
15
15
  function uniquePlId() {
16
16
  const data = new Uint8Array(PlIdBytes);
17
17
  crypto.getRandomValues(data);
18
- return PlId.parse(base32_encode.base32Encode(data, 'RFC4648'));
18
+ return PlId.parse(base32_encode.base32Encode(data, "RFC4648"));
19
19
  }
20
20
  function plId(bytes) {
21
21
  if (bytes.length !== PlIdBytes)
22
22
  throw new Error(`Wrong number of bytes: ${bytes.length}`);
23
- return PlId.parse(base32_encode.base32Encode(bytes, 'RFC4648'));
23
+ return PlId.parse(base32_encode.base32Encode(bytes, "RFC4648"));
24
24
  }
25
25
  async function digestPlId(data) {
26
26
  const encoder = new TextEncoder();
27
- const bytes = await crypto.subtle.digest('SHA-256', encoder.encode(data));
27
+ const bytes = await crypto.subtle.digest("SHA-256", encoder.encode(data));
28
28
  return plId(new Uint8Array(bytes.slice(0, 15)));
29
29
  }
30
30
 
package/dist/plid.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"plid.cjs","sources":["../src/plid.ts"],"sourcesContent":["import { z } from 'zod';\nimport { base32Encode } from './base32_encode';\n\n/** Number of raw bytes in the PlId. */\nexport const PlIdBytes = 15;\n/** Characters in string representation */\nexport const PlIdLength = 24; // = 15 bytes * 8 bits / 5 bits per char in base32\n\nexport const PlId = z\n .string()\n .length(PlIdLength)\n .regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/) // RFC4648\n .brand('PlId');\nexport type PlId = z.infer<typeof PlId>;\n\nexport function uniquePlId(): PlId {\n const data = new Uint8Array(PlIdBytes);\n crypto.getRandomValues(data);\n return PlId.parse(base32Encode(data, 'RFC4648'));\n}\n\nexport function plId(bytes: Uint8Array): PlId {\n if (bytes.length !== PlIdBytes) throw new Error(`Wrong number of bytes: ${bytes.length}`);\n return PlId.parse(base32Encode(bytes, 'RFC4648'));\n}\n\nexport async function digestPlId(data: string): Promise<PlId> {\n const encoder = new TextEncoder();\n const bytes = await crypto.subtle.digest('SHA-256', encoder.encode(data));\n return plId(new Uint8Array(bytes.slice(0, 15)));\n}\n"],"names":["z","base32Encode"],"mappings":";;;;;AAGA;AACO,MAAM,SAAS,GAAG;AACzB;AACO,MAAM,UAAU,GAAG,GAAG;AAEtB,MAAM,IAAI,GAAGA;AACjB,KAAA,MAAM;KACN,MAAM,CAAC,UAAU;AACjB,KAAA,KAAK,CAAC,oCAAoC,CAAC;KAC3C,KAAK,CAAC,MAAM;SAGC,UAAU,GAAA;AACxB,IAAA,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,SAAS,CAAC;AACtC,IAAA,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC;IAC5B,OAAO,IAAI,CAAC,KAAK,CAACC,0BAAY,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;AAClD;AAEM,SAAU,IAAI,CAAC,KAAiB,EAAA;AACpC,IAAA,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,CAAA,uBAAA,EAA0B,KAAK,CAAC,MAAM,CAAA,CAAE,CAAC;IACzF,OAAO,IAAI,CAAC,KAAK,CAACA,0BAAY,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;AACnD;AAEO,eAAe,UAAU,CAAC,IAAY,EAAA;AAC3C,IAAA,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE;AACjC,IAAA,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACzE,IAAA,OAAO,IAAI,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AACjD;;;;;;;;;"}
1
+ {"version":3,"file":"plid.cjs","sources":["../src/plid.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { base32Encode } from \"./base32_encode\";\n\n/** Number of raw bytes in the PlId. */\nexport const PlIdBytes = 15;\n/** Characters in string representation */\nexport const PlIdLength = 24; // = 15 bytes * 8 bits / 5 bits per char in base32\n\nexport const PlId = z\n .string()\n .length(PlIdLength)\n .regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/) // RFC4648\n .brand(\"PlId\");\nexport type PlId = z.infer<typeof PlId>;\n\nexport function uniquePlId(): PlId {\n const data = new Uint8Array(PlIdBytes);\n crypto.getRandomValues(data);\n return PlId.parse(base32Encode(data, \"RFC4648\"));\n}\n\nexport function plId(bytes: Uint8Array): PlId {\n if (bytes.length !== PlIdBytes) throw new Error(`Wrong number of bytes: ${bytes.length}`);\n return PlId.parse(base32Encode(bytes, \"RFC4648\"));\n}\n\nexport async function digestPlId(data: string): Promise<PlId> {\n const encoder = new TextEncoder();\n const bytes = await crypto.subtle.digest(\"SHA-256\", encoder.encode(data));\n return plId(new Uint8Array(bytes.slice(0, 15)));\n}\n"],"names":["z","base32Encode"],"mappings":";;;;;AAGA;AACO,MAAM,SAAS,GAAG;AACzB;AACO,MAAM,UAAU,GAAG,GAAG;AAEtB,MAAM,IAAI,GAAGA;AACjB,KAAA,MAAM;KACN,MAAM,CAAC,UAAU;AACjB,KAAA,KAAK,CAAC,oCAAoC,CAAC;KAC3C,KAAK,CAAC,MAAM;SAGC,UAAU,GAAA;AACxB,IAAA,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,SAAS,CAAC;AACtC,IAAA,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC;IAC5B,OAAO,IAAI,CAAC,KAAK,CAACC,0BAAY,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;AAClD;AAEM,SAAU,IAAI,CAAC,KAAiB,EAAA;AACpC,IAAA,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,CAAA,uBAAA,EAA0B,KAAK,CAAC,MAAM,CAAA,CAAE,CAAC;IACzF,OAAO,IAAI,CAAC,KAAK,CAACA,0BAAY,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;AACnD;AAEO,eAAe,UAAU,CAAC,IAAY,EAAA;AAC3C,IAAA,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE;AACjC,IAAA,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACzE,IAAA,OAAO,IAAI,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AACjD;;;;;;;;;"}
package/dist/plid.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { z } from 'zod';
1
+ import { z } from "zod";
2
2
  /** Number of raw bytes in the PlId. */
3
3
  export declare const PlIdBytes = 15;
4
4
  /** Characters in string representation */
package/dist/plid.js CHANGED
@@ -9,20 +9,20 @@ const PlId = z
9
9
  .string()
10
10
  .length(PlIdLength)
11
11
  .regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/) // RFC4648
12
- .brand('PlId');
12
+ .brand("PlId");
13
13
  function uniquePlId() {
14
14
  const data = new Uint8Array(PlIdBytes);
15
15
  crypto.getRandomValues(data);
16
- return PlId.parse(base32Encode(data, 'RFC4648'));
16
+ return PlId.parse(base32Encode(data, "RFC4648"));
17
17
  }
18
18
  function plId(bytes) {
19
19
  if (bytes.length !== PlIdBytes)
20
20
  throw new Error(`Wrong number of bytes: ${bytes.length}`);
21
- return PlId.parse(base32Encode(bytes, 'RFC4648'));
21
+ return PlId.parse(base32Encode(bytes, "RFC4648"));
22
22
  }
23
23
  async function digestPlId(data) {
24
24
  const encoder = new TextEncoder();
25
- const bytes = await crypto.subtle.digest('SHA-256', encoder.encode(data));
25
+ const bytes = await crypto.subtle.digest("SHA-256", encoder.encode(data));
26
26
  return plId(new Uint8Array(bytes.slice(0, 15)));
27
27
  }
28
28
 
package/dist/plid.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"plid.js","sources":["../src/plid.ts"],"sourcesContent":["import { z } from 'zod';\nimport { base32Encode } from './base32_encode';\n\n/** Number of raw bytes in the PlId. */\nexport const PlIdBytes = 15;\n/** Characters in string representation */\nexport const PlIdLength = 24; // = 15 bytes * 8 bits / 5 bits per char in base32\n\nexport const PlId = z\n .string()\n .length(PlIdLength)\n .regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/) // RFC4648\n .brand('PlId');\nexport type PlId = z.infer<typeof PlId>;\n\nexport function uniquePlId(): PlId {\n const data = new Uint8Array(PlIdBytes);\n crypto.getRandomValues(data);\n return PlId.parse(base32Encode(data, 'RFC4648'));\n}\n\nexport function plId(bytes: Uint8Array): PlId {\n if (bytes.length !== PlIdBytes) throw new Error(`Wrong number of bytes: ${bytes.length}`);\n return PlId.parse(base32Encode(bytes, 'RFC4648'));\n}\n\nexport async function digestPlId(data: string): Promise<PlId> {\n const encoder = new TextEncoder();\n const bytes = await crypto.subtle.digest('SHA-256', encoder.encode(data));\n return plId(new Uint8Array(bytes.slice(0, 15)));\n}\n"],"names":[],"mappings":";;;AAGA;AACO,MAAM,SAAS,GAAG;AACzB;AACO,MAAM,UAAU,GAAG,GAAG;AAEtB,MAAM,IAAI,GAAG;AACjB,KAAA,MAAM;KACN,MAAM,CAAC,UAAU;AACjB,KAAA,KAAK,CAAC,oCAAoC,CAAC;KAC3C,KAAK,CAAC,MAAM;SAGC,UAAU,GAAA;AACxB,IAAA,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,SAAS,CAAC;AACtC,IAAA,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC;IAC5B,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;AAClD;AAEM,SAAU,IAAI,CAAC,KAAiB,EAAA;AACpC,IAAA,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,CAAA,uBAAA,EAA0B,KAAK,CAAC,MAAM,CAAA,CAAE,CAAC;IACzF,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;AACnD;AAEO,eAAe,UAAU,CAAC,IAAY,EAAA;AAC3C,IAAA,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE;AACjC,IAAA,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACzE,IAAA,OAAO,IAAI,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AACjD;;;;"}
1
+ {"version":3,"file":"plid.js","sources":["../src/plid.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { base32Encode } from \"./base32_encode\";\n\n/** Number of raw bytes in the PlId. */\nexport const PlIdBytes = 15;\n/** Characters in string representation */\nexport const PlIdLength = 24; // = 15 bytes * 8 bits / 5 bits per char in base32\n\nexport const PlId = z\n .string()\n .length(PlIdLength)\n .regex(/[ABCDEFGHIJKLMNOPQRSTUVWXYZ234567]/) // RFC4648\n .brand(\"PlId\");\nexport type PlId = z.infer<typeof PlId>;\n\nexport function uniquePlId(): PlId {\n const data = new Uint8Array(PlIdBytes);\n crypto.getRandomValues(data);\n return PlId.parse(base32Encode(data, \"RFC4648\"));\n}\n\nexport function plId(bytes: Uint8Array): PlId {\n if (bytes.length !== PlIdBytes) throw new Error(`Wrong number of bytes: ${bytes.length}`);\n return PlId.parse(base32Encode(bytes, \"RFC4648\"));\n}\n\nexport async function digestPlId(data: string): Promise<PlId> {\n const encoder = new TextEncoder();\n const bytes = await crypto.subtle.digest(\"SHA-256\", encoder.encode(data));\n return plId(new Uint8Array(bytes.slice(0, 15)));\n}\n"],"names":[],"mappings":";;;AAGA;AACO,MAAM,SAAS,GAAG;AACzB;AACO,MAAM,UAAU,GAAG,GAAG;AAEtB,MAAM,IAAI,GAAG;AACjB,KAAA,MAAM;KACN,MAAM,CAAC,UAAU;AACjB,KAAA,KAAK,CAAC,oCAAoC,CAAC;KAC3C,KAAK,CAAC,MAAM;SAGC,UAAU,GAAA;AACxB,IAAA,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,SAAS,CAAC;AACtC,IAAA,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC;IAC5B,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;AAClD;AAEM,SAAU,IAAI,CAAC,KAAiB,EAAA;AACpC,IAAA,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,CAAA,uBAAA,EAA0B,KAAK,CAAC,MAAM,CAAA,CAAE,CAAC;IACzF,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;AACnD;AAEO,eAAe,UAAU,CAAC,IAAY,EAAA;AAC3C,IAAA,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE;AACjC,IAAA,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACzE,IAAA,OAAO,IAAI,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AACjD;;;;"}
@@ -1,4 +1,4 @@
1
- import type { PlRef } from '../ref';
1
+ import type { PlRef } from "../ref";
2
2
  /** Result pool entry */
3
3
  export type ResultPoolEntry<O> = {
4
4
  /** Reference that can be passed to args to import the object in workflow */
@@ -1,4 +1,4 @@
1
- export * from './entry';
2
- export * from './spec';
3
- export * from './query';
1
+ export * from "./entry";
2
+ export * from "./spec";
3
+ export * from "./query";
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -3,43 +3,43 @@
3
3
  var spec = require('./spec.cjs');
4
4
 
5
5
  function assertNever(x) {
6
- throw new Error('Unexpected object: ' + x); // This is ok, because this is a possible runtime error
6
+ throw new Error("Unexpected object: " + x); // This is ok, because this is a possible runtime error
7
7
  }
8
8
  function executePSpecPredicate(predicate, spec$1) {
9
9
  switch (predicate.type) {
10
- case 'and':
10
+ case "and":
11
11
  for (const operator of predicate.operands)
12
12
  if (!executePSpecPredicate(operator, spec$1))
13
13
  return false;
14
14
  return true;
15
- case 'or':
15
+ case "or":
16
16
  for (const operator of predicate.operands)
17
17
  if (executePSpecPredicate(operator, spec$1))
18
18
  return true;
19
19
  return false;
20
- case 'not':
20
+ case "not":
21
21
  return !executePSpecPredicate(predicate.operand, spec$1);
22
- case 'name':
22
+ case "name":
23
23
  return spec.isPColumnSpec(spec$1) && spec$1.name === predicate.name;
24
- case 'name_pattern':
24
+ case "name_pattern":
25
25
  return spec.isPColumnSpec(spec$1) && Boolean(spec$1.name.match(predicate.pattern));
26
- case 'annotation':
27
- return (spec.isPColumnSpec(spec$1)
28
- && spec$1.annotations !== undefined
29
- && spec$1.annotations[predicate.annotation] === predicate.value);
30
- case 'annotation_pattern':
31
- return (spec.isPColumnSpec(spec$1)
32
- && spec$1.annotations !== undefined
33
- && spec$1.annotations[predicate.annotation] !== undefined
34
- && Boolean(spec$1.annotations[predicate.annotation].match(predicate.pattern)));
35
- case 'has_axes':
36
- return (spec.isPColumnSpec(spec$1)
37
- && predicate.axes.every((matcher) => spec$1.axesSpec.some((axisSpec) => (matcher.type === undefined || matcher.type === axisSpec.type)
38
- && (matcher.name === undefined || matcher.name === axisSpec.name)
39
- && (matcher.domain === undefined
40
- || Object.keys(matcher.domain).length === 0
41
- || (axisSpec.domain !== undefined
42
- && Object.entries(matcher.domain).every(([domain, domainValue]) => axisSpec.domain[domain] === domainValue))))));
26
+ case "annotation":
27
+ return (spec.isPColumnSpec(spec$1) &&
28
+ spec$1.annotations !== undefined &&
29
+ spec$1.annotations[predicate.annotation] === predicate.value);
30
+ case "annotation_pattern":
31
+ return (spec.isPColumnSpec(spec$1) &&
32
+ spec$1.annotations !== undefined &&
33
+ spec$1.annotations[predicate.annotation] !== undefined &&
34
+ Boolean(spec$1.annotations[predicate.annotation].match(predicate.pattern)));
35
+ case "has_axes":
36
+ return (spec.isPColumnSpec(spec$1) &&
37
+ predicate.axes.every((matcher) => spec$1.axesSpec.some((axisSpec) => (matcher.type === undefined || matcher.type === axisSpec.type) &&
38
+ (matcher.name === undefined || matcher.name === axisSpec.name) &&
39
+ (matcher.domain === undefined ||
40
+ Object.keys(matcher.domain).length === 0 ||
41
+ (axisSpec.domain !== undefined &&
42
+ Object.entries(matcher.domain).every(([domain, domainValue]) => axisSpec.domain[domain] === domainValue))))));
43
43
  default:
44
44
  assertNever(predicate);
45
45
  }
@@ -1 +1 @@
1
- {"version":3,"file":"query.cjs","sources":["../../src/pool/query.ts"],"sourcesContent":["import type { AxisId } from '../drivers';\nimport type { PObjectSpec } from './spec';\nimport { isPColumnSpec } from './spec';\n\nexport type PSpecPredicate =\n | {\n type: 'and' | 'or';\n operands: PSpecPredicate[];\n }\n | {\n type: 'not';\n operand: PSpecPredicate;\n }\n | {\n type: 'name';\n name: string;\n }\n | {\n type: 'name_pattern';\n pattern: string;\n }\n | {\n type: 'annotation';\n annotation: string;\n value: string;\n }\n | {\n type: 'annotation_pattern';\n annotation: string;\n pattern: string;\n }\n | {\n type: 'has_axes';\n axes: Partial<AxisId>[];\n };\n\nfunction assertNever(x: never): never {\n throw new Error('Unexpected object: ' + x); // This is ok, because this is a possible runtime error\n}\n\nexport function executePSpecPredicate(\n predicate: PSpecPredicate,\n spec: PObjectSpec,\n): boolean {\n switch (predicate.type) {\n case 'and':\n for (const operator of predicate.operands)\n if (!executePSpecPredicate(operator, spec)) return false;\n return true;\n case 'or':\n for (const operator of predicate.operands)\n if (executePSpecPredicate(operator, spec)) return true;\n return false;\n case 'not':\n return !executePSpecPredicate(predicate.operand, spec);\n case 'name':\n return isPColumnSpec(spec) && spec.name === predicate.name;\n case 'name_pattern':\n return isPColumnSpec(spec) && Boolean(spec.name.match(predicate.pattern));\n case 'annotation':\n return (\n isPColumnSpec(spec)\n && spec.annotations !== undefined\n && spec.annotations[predicate.annotation] === predicate.value\n );\n case 'annotation_pattern':\n return (\n isPColumnSpec(spec)\n && spec.annotations !== undefined\n && spec.annotations[predicate.annotation] !== undefined\n && Boolean(spec.annotations[predicate.annotation].match(predicate.pattern))\n );\n case 'has_axes':\n return (\n isPColumnSpec(spec)\n && predicate.axes.every((matcher) =>\n spec.axesSpec.some(\n (axisSpec) =>\n (matcher.type === undefined || matcher.type === axisSpec.type)\n && (matcher.name === undefined || matcher.name === axisSpec.name)\n && (matcher.domain === undefined\n || Object.keys(matcher.domain).length === 0\n || (axisSpec.domain !== undefined\n && Object.entries(matcher.domain).every(\n ([domain, domainValue]) =>\n axisSpec.domain![domain] === domainValue,\n ))),\n ),\n )\n );\n default:\n assertNever(predicate);\n }\n}\n"],"names":["spec","isPColumnSpec"],"mappings":";;;;AAoCA,SAAS,WAAW,CAAC,CAAQ,EAAA;IAC3B,MAAM,IAAI,KAAK,CAAC,qBAAqB,GAAG,CAAC,CAAC,CAAC;AAC7C;AAEM,SAAU,qBAAqB,CACnC,SAAyB,EACzBA,MAAiB,EAAA;AAEjB,IAAA,QAAQ,SAAS,CAAC,IAAI;AACpB,QAAA,KAAK,KAAK;AACR,YAAA,KAAK,MAAM,QAAQ,IAAI,SAAS,CAAC,QAAQ;AACvC,gBAAA,IAAI,CAAC,qBAAqB,CAAC,QAAQ,EAAEA,MAAI,CAAC;AAAE,oBAAA,OAAO,KAAK;AAC1D,YAAA,OAAO,IAAI;AACb,QAAA,KAAK,IAAI;AACP,YAAA,KAAK,MAAM,QAAQ,IAAI,SAAS,CAAC,QAAQ;AACvC,gBAAA,IAAI,qBAAqB,CAAC,QAAQ,EAAEA,MAAI,CAAC;AAAE,oBAAA,OAAO,IAAI;AACxD,YAAA,OAAO,KAAK;AACd,QAAA,KAAK,KAAK;YACR,OAAO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AAC,MAAM,CAAC,CAAC,MAAM,KAAK;AACvC,4BAAC,QAAQ,CAAC,MAAM,KAAK;AACnB,+BAAA,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,KAAK,CACrC,CAAC,CAAC,MAAM,EAAE,WAAW,CAAC,KACpB,QAAQ,CAAC,MAAO,CAAC,MAAM,CAAC,KAAK,WAAW,CAC3C,CAAC,CAAC,CACV,CACF;AAEL,QAAA;YACE,WAAW,CAAC,SAAS,CAAC;;AAE5B;;;;"}
1
+ {"version":3,"file":"query.cjs","sources":["../../src/pool/query.ts"],"sourcesContent":["import type { AxisId } from \"../drivers\";\nimport type { PObjectSpec } from \"./spec\";\nimport { isPColumnSpec } from \"./spec\";\n\nexport type PSpecPredicate =\n | {\n type: \"and\" | \"or\";\n operands: PSpecPredicate[];\n }\n | {\n type: \"not\";\n operand: PSpecPredicate;\n }\n | {\n type: \"name\";\n name: string;\n }\n | {\n type: \"name_pattern\";\n pattern: string;\n }\n | {\n type: \"annotation\";\n annotation: string;\n value: string;\n }\n | {\n type: \"annotation_pattern\";\n annotation: string;\n pattern: string;\n }\n | {\n type: \"has_axes\";\n axes: Partial<AxisId>[];\n };\n\nfunction assertNever(x: never): never {\n throw new Error(\"Unexpected object: \" + x); // This is ok, because this is a possible runtime error\n}\n\nexport function executePSpecPredicate(predicate: PSpecPredicate, spec: PObjectSpec): boolean {\n switch (predicate.type) {\n case \"and\":\n for (const operator of predicate.operands)\n if (!executePSpecPredicate(operator, spec)) return false;\n return true;\n case \"or\":\n for (const operator of predicate.operands)\n if (executePSpecPredicate(operator, spec)) return true;\n return false;\n case \"not\":\n return !executePSpecPredicate(predicate.operand, spec);\n case \"name\":\n return isPColumnSpec(spec) && spec.name === predicate.name;\n case \"name_pattern\":\n return isPColumnSpec(spec) && Boolean(spec.name.match(predicate.pattern));\n case \"annotation\":\n return (\n isPColumnSpec(spec) &&\n spec.annotations !== undefined &&\n spec.annotations[predicate.annotation] === predicate.value\n );\n case \"annotation_pattern\":\n return (\n isPColumnSpec(spec) &&\n spec.annotations !== undefined &&\n spec.annotations[predicate.annotation] !== undefined &&\n Boolean(spec.annotations[predicate.annotation].match(predicate.pattern))\n );\n case \"has_axes\":\n return (\n isPColumnSpec(spec) &&\n predicate.axes.every((matcher) =>\n spec.axesSpec.some(\n (axisSpec) =>\n (matcher.type === undefined || matcher.type === axisSpec.type) &&\n (matcher.name === undefined || matcher.name === axisSpec.name) &&\n (matcher.domain === undefined ||\n Object.keys(matcher.domain).length === 0 ||\n (axisSpec.domain !== undefined &&\n Object.entries(matcher.domain).every(\n ([domain, domainValue]) => axisSpec.domain![domain] === domainValue,\n ))),\n ),\n )\n );\n default:\n assertNever(predicate);\n }\n}\n"],"names":["spec","isPColumnSpec"],"mappings":";;;;AAoCA,SAAS,WAAW,CAAC,CAAQ,EAAA;IAC3B,MAAM,IAAI,KAAK,CAAC,qBAAqB,GAAG,CAAC,CAAC,CAAC;AAC7C;AAEM,SAAU,qBAAqB,CAAC,SAAyB,EAAEA,MAAiB,EAAA;AAChF,IAAA,QAAQ,SAAS,CAAC,IAAI;AACpB,QAAA,KAAK,KAAK;AACR,YAAA,KAAK,MAAM,QAAQ,IAAI,SAAS,CAAC,QAAQ;AACvC,gBAAA,IAAI,CAAC,qBAAqB,CAAC,QAAQ,EAAEA,MAAI,CAAC;AAAE,oBAAA,OAAO,KAAK;AAC1D,YAAA,OAAO,IAAI;AACb,QAAA,KAAK,IAAI;AACP,YAAA,KAAK,MAAM,QAAQ,IAAI,SAAS,CAAC,QAAQ;AACvC,gBAAA,IAAI,qBAAqB,CAAC,QAAQ,EAAEA,MAAI,CAAC;AAAE,oBAAA,OAAO,IAAI;AACxD,YAAA,OAAO,KAAK;AACd,QAAA,KAAK,KAAK;YACR,OAAO,CAAC,qBAAqB,CAAC,SAAS,CAAC,OAAO,EAAEA,MAAI,CAAC;AACxD,QAAA,KAAK,MAAM;AACT,YAAA,OAAOC,kBAAa,CAACD,MAAI,C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MAAM,KAAK,SAAS;AAC5B,4BAAA,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,KAAK,CAClC,CAAC,CAAC,MAAM,EAAE,WAAW,CAAC,KAAK,QAAQ,CAAC,MAAO,CAAC,MAAM,CAAC,KAAK,WAAW,CACpE,CAAC,CAAC,CACV,CACF;AAEL,QAAA;YACE,WAAW,CAAC,SAAS,CAAC;;AAE5B;;;;"}
@@ -1,27 +1,27 @@
1
- import type { AxisId } from '../drivers';
2
- import type { PObjectSpec } from './spec';
1
+ import type { AxisId } from "../drivers";
2
+ import type { PObjectSpec } from "./spec";
3
3
  export type PSpecPredicate = {
4
- type: 'and' | 'or';
4
+ type: "and" | "or";
5
5
  operands: PSpecPredicate[];
6
6
  } | {
7
- type: 'not';
7
+ type: "not";
8
8
  operand: PSpecPredicate;
9
9
  } | {
10
- type: 'name';
10
+ type: "name";
11
11
  name: string;
12
12
  } | {
13
- type: 'name_pattern';
13
+ type: "name_pattern";
14
14
  pattern: string;
15
15
  } | {
16
- type: 'annotation';
16
+ type: "annotation";
17
17
  annotation: string;
18
18
  value: string;
19
19
  } | {
20
- type: 'annotation_pattern';
20
+ type: "annotation_pattern";
21
21
  annotation: string;
22
22
  pattern: string;
23
23
  } | {
24
- type: 'has_axes';
24
+ type: "has_axes";
25
25
  axes: Partial<AxisId>[];
26
26
  };
27
27
  export declare function executePSpecPredicate(predicate: PSpecPredicate, spec: PObjectSpec): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/pool/query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAG1C,MAAM,MAAM,cAAc,GACtB;IACA,IAAI,EAAE,KAAK,GAAG,IAAI,CAAC;IACnB,QAAQ,EAAE,cAAc,EAAE,CAAC;CAC5B,GACC;IACA,IAA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