@milaboratories/pl-model-common 1.25.0 → 1.25.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_rolldown/runtime.cjs +29 -0
- package/dist/author_marker.d.ts +9 -6
- package/dist/base32_encode.cjs +40 -46
- package/dist/base32_encode.cjs.map +1 -1
- package/dist/base32_encode.js +40 -45
- package/dist/base32_encode.js.map +1 -1
- package/dist/base64.cjs +5 -4
- package/dist/base64.cjs.map +1 -1
- package/dist/base64.d.ts +10 -6
- package/dist/base64.js +5 -3
- package/dist/base64.js.map +1 -1
- package/dist/block_state.d.ts +21 -23
- package/dist/bmodel/block_config.cjs +9 -10
- package/dist/bmodel/block_config.cjs.map +1 -1
- package/dist/bmodel/block_config.d.ts +53 -72
- package/dist/bmodel/block_config.js +9 -9
- package/dist/bmodel/block_config.js.map +1 -1
- package/dist/bmodel/code.cjs +7 -6
- package/dist/bmodel/code.cjs.map +1 -1
- package/dist/bmodel/code.d.ts +17 -13
- package/dist/bmodel/code.js +6 -4
- package/dist/bmodel/code.js.map +1 -1
- package/dist/bmodel/container.d.ts +46 -44
- package/dist/bmodel/index.cjs +3 -0
- package/dist/bmodel/index.d.ts +5 -6
- package/dist/bmodel/index.js +3 -0
- package/dist/bmodel/normalization.cjs +90 -106
- package/dist/bmodel/normalization.cjs.map +1 -1
- package/dist/bmodel/normalization.d.ts +7 -3
- package/dist/bmodel/normalization.js +90 -105
- package/dist/bmodel/normalization.js.map +1 -1
- package/dist/bmodel/types.d.ts +4 -1
- package/dist/branding.d.ts +5 -5
- package/dist/common_types.d.ts +19 -15
- package/dist/driver_kit.d.ts +25 -17
- package/dist/drivers/ChunkedStreamReader.cjs +168 -203
- package/dist/drivers/ChunkedStreamReader.cjs.map +1 -1
- package/dist/drivers/ChunkedStreamReader.d.ts +104 -100
- package/dist/drivers/ChunkedStreamReader.js +168 -202
- package/dist/drivers/ChunkedStreamReader.js.map +1 -1
- package/dist/drivers/blob.cjs +15 -17
- package/dist/drivers/blob.cjs.map +1 -1
- package/dist/drivers/blob.d.ts +35 -35
- package/dist/drivers/blob.js +14 -15
- package/dist/drivers/blob.js.map +1 -1
- package/dist/drivers/index.cjs +18 -0
- package/dist/drivers/index.d.ts +29 -9
- package/dist/drivers/index.js +18 -0
- package/dist/drivers/interfaces.d.ts +17 -14
- package/dist/drivers/log.cjs +4 -3
- package/dist/drivers/log.cjs.map +1 -1
- package/dist/drivers/log.d.ts +52 -49
- package/dist/drivers/log.js +4 -2
- package/dist/drivers/log.js.map +1 -1
- package/dist/drivers/ls.cjs +16 -19
- package/dist/drivers/ls.cjs.map +1 -1
- package/dist/drivers/ls.d.ts +73 -76
- package/dist/drivers/ls.js +16 -17
- package/dist/drivers/ls.js.map +1 -1
- package/dist/drivers/pframe/column_filter.d.ts +19 -15
- package/dist/drivers/pframe/data_info.cjs +201 -252
- package/dist/drivers/pframe/data_info.cjs.map +1 -1
- package/dist/drivers/pframe/data_info.d.ts +84 -109
- package/dist/drivers/pframe/data_info.js +201 -250
- package/dist/drivers/pframe/data_info.js.map +1 -1
- package/dist/drivers/pframe/data_types.cjs +38 -63
- package/dist/drivers/pframe/data_types.cjs.map +1 -1
- package/dist/drivers/pframe/data_types.d.ts +91 -93
- package/dist/drivers/pframe/data_types.js +38 -61
- package/dist/drivers/pframe/data_types.js.map +1 -1
- package/dist/drivers/pframe/driver.cjs +7 -0
- package/dist/drivers/pframe/driver.cjs.map +1 -0
- package/dist/drivers/pframe/driver.d.ts +50 -45
- package/dist/drivers/pframe/driver.js +6 -0
- package/dist/drivers/pframe/driver.js.map +1 -0
- package/dist/drivers/pframe/filter_spec.d.ts +127 -123
- package/dist/drivers/pframe/find_columns.d.ts +21 -17
- package/dist/drivers/pframe/index.cjs +15 -0
- package/dist/drivers/pframe/index.d.ts +23 -16
- package/dist/drivers/pframe/index.js +15 -0
- package/dist/drivers/pframe/linker_columns.cjs +184 -238
- package/dist/drivers/pframe/linker_columns.cjs.map +1 -1
- package/dist/drivers/pframe/linker_columns.d.ts +45 -38
- package/dist/drivers/pframe/linker_columns.js +184 -236
- package/dist/drivers/pframe/linker_columns.js.map +1 -1
- package/dist/drivers/pframe/pframe.d.ts +26 -21
- package/dist/drivers/pframe/query/index.cjs +1 -0
- package/dist/drivers/pframe/query/index.d.ts +3 -4
- package/dist/drivers/pframe/query/index.js +1 -0
- package/dist/drivers/pframe/query/query_common.d.ts +205 -247
- package/dist/drivers/pframe/query/query_data.d.ts +25 -23
- package/dist/drivers/pframe/query/query_spec.d.ts +30 -29
- package/dist/drivers/pframe/query/utils.cjs +164 -183
- package/dist/drivers/pframe/query/utils.cjs.map +1 -1
- package/dist/drivers/pframe/query/utils.d.ts +13 -12
- package/dist/drivers/pframe/query/utils.js +164 -181
- package/dist/drivers/pframe/query/utils.js.map +1 -1
- package/dist/drivers/pframe/spec/anchored.cjs +178 -216
- package/dist/drivers/pframe/spec/anchored.cjs.map +1 -1
- package/dist/drivers/pframe/spec/anchored.d.ts +53 -49
- package/dist/drivers/pframe/spec/anchored.js +176 -214
- package/dist/drivers/pframe/spec/anchored.js.map +1 -1
- package/dist/drivers/pframe/spec/filtered_column.cjs +8 -7
- package/dist/drivers/pframe/spec/filtered_column.cjs.map +1 -1
- package/dist/drivers/pframe/spec/filtered_column.d.ts +20 -17
- package/dist/drivers/pframe/spec/filtered_column.js +8 -6
- package/dist/drivers/pframe/spec/filtered_column.js.map +1 -1
- package/dist/drivers/pframe/spec/ids.cjs +16 -14
- package/dist/drivers/pframe/spec/ids.cjs.map +1 -1
- package/dist/drivers/pframe/spec/ids.d.ts +13 -8
- package/dist/drivers/pframe/spec/ids.js +14 -12
- package/dist/drivers/pframe/spec/ids.js.map +1 -1
- package/dist/drivers/pframe/spec/index.cjs +6 -0
- package/dist/drivers/pframe/spec/index.d.ts +6 -7
- package/dist/drivers/pframe/spec/index.js +6 -0
- package/dist/drivers/pframe/spec/native_id.cjs +16 -16
- package/dist/drivers/pframe/spec/native_id.cjs.map +1 -1
- package/dist/drivers/pframe/spec/native_id.d.ts +9 -4
- package/dist/drivers/pframe/spec/native_id.js +13 -13
- package/dist/drivers/pframe/spec/native_id.js.map +1 -1
- package/dist/drivers/pframe/spec/selectors.cjs +72 -112
- package/dist/drivers/pframe/spec/selectors.cjs.map +1 -1
- package/dist/drivers/pframe/spec/selectors.d.ts +99 -94
- package/dist/drivers/pframe/spec/selectors.js +72 -110
- package/dist/drivers/pframe/spec/selectors.js.map +1 -1
- package/dist/drivers/pframe/spec/spec.cjs +282 -324
- package/dist/drivers/pframe/spec/spec.cjs.map +1 -1
- package/dist/drivers/pframe/spec/spec.d.ts +263 -272
- package/dist/drivers/pframe/spec/spec.js +281 -322
- package/dist/drivers/pframe/spec/spec.js.map +1 -1
- package/dist/drivers/pframe/table.d.ts +28 -24
- package/dist/drivers/pframe/table_calculate.cjs +117 -147
- package/dist/drivers/pframe/table_calculate.cjs.map +1 -1
- package/dist/drivers/pframe/table_calculate.d.ts +219 -220
- package/dist/drivers/pframe/table_calculate.js +117 -145
- package/dist/drivers/pframe/table_calculate.js.map +1 -1
- package/dist/drivers/pframe/table_common.cjs +13 -14
- package/dist/drivers/pframe/table_common.cjs.map +1 -1
- package/dist/drivers/pframe/table_common.d.ts +24 -19
- package/dist/drivers/pframe/table_common.js +13 -13
- package/dist/drivers/pframe/table_common.js.map +1 -1
- package/dist/drivers/pframe/unique_values.d.ts +23 -18
- package/dist/drivers/upload.d.ts +21 -18
- package/dist/drivers/urls.cjs +5 -6
- package/dist/drivers/urls.cjs.map +1 -1
- package/dist/drivers/urls.d.ts +12 -9
- package/dist/drivers/urls.js +5 -5
- package/dist/drivers/urls.js.map +1 -1
- package/dist/errors.cjs +65 -86
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.ts +36 -33
- package/dist/errors.js +65 -85
- package/dist/errors.js.map +1 -1
- package/dist/flags/block_flags.cjs +6 -5
- package/dist/flags/block_flags.cjs.map +1 -1
- package/dist/flags/block_flags.d.ts +11 -8
- package/dist/flags/block_flags.js +6 -4
- package/dist/flags/block_flags.js.map +1 -1
- package/dist/flags/flag_utils.cjs +69 -87
- package/dist/flags/flag_utils.cjs.map +1 -1
- package/dist/flags/flag_utils.d.ts +40 -36
- package/dist/flags/flag_utils.js +69 -86
- package/dist/flags/flag_utils.js.map +1 -1
- package/dist/flags/type_utils.d.ts +12 -11
- package/dist/httpAuth.cjs +16 -20
- package/dist/httpAuth.cjs.map +1 -1
- package/dist/httpAuth.d.ts +10 -7
- package/dist/httpAuth.js +16 -19
- package/dist/httpAuth.js.map +1 -1
- package/dist/index.cjs +176 -178
- package/dist/index.d.ts +58 -20
- package/dist/index.js +37 -34
- package/dist/json.cjs +10 -8
- package/dist/json.cjs.map +1 -1
- package/dist/json.d.ts +18 -18
- package/dist/json.js +8 -6
- package/dist/json.js.map +1 -1
- package/dist/navigation.cjs +3 -2
- package/dist/navigation.cjs.map +1 -1
- package/dist/navigation.d.ts +18 -21
- package/dist/navigation.js +3 -1
- package/dist/navigation.js.map +1 -1
- package/dist/plid.cjs +16 -20
- package/dist/plid.cjs.map +1 -1
- package/dist/plid.d.ts +11 -7
- package/dist/plid.js +15 -18
- package/dist/plid.js.map +1 -1
- package/dist/pool/entry.d.ts +11 -11
- package/dist/pool/index.d.ts +3 -4
- package/dist/pool/query.cjs +21 -43
- package/dist/pool/query.cjs.map +1 -1
- package/dist/pool/query.d.ts +25 -20
- package/dist/pool/query.js +20 -40
- package/dist/pool/query.js.map +1 -1
- package/dist/pool/spec.cjs +40 -47
- package/dist/pool/spec.cjs.map +1 -1
- package/dist/pool/spec.d.ts +33 -31
- package/dist/pool/spec.js +40 -45
- package/dist/pool/spec.js.map +1 -1
- package/dist/ref.cjs +51 -71
- package/dist/ref.cjs.map +1 -1
- package/dist/ref.d.ts +36 -33
- package/dist/ref.js +50 -69
- package/dist/ref.js.map +1 -1
- package/dist/utag.d.ts +18 -14
- package/dist/util.cjs +8 -7
- package/dist/util.cjs.map +1 -1
- package/dist/util.d.ts +5 -2
- package/dist/util.js +8 -6
- package/dist/util.js.map +1 -1
- package/dist/value_or_error.cjs +7 -3
- package/dist/value_or_error.cjs.map +1 -1
- package/dist/value_or_error.d.ts +9 -6
- package/dist/value_or_error.js +7 -2
- package/dist/value_or_error.js.map +1 -1
- package/package.json +8 -8
- package/dist/author_marker.d.ts.map +0 -1
- package/dist/base32_encode.d.ts +0 -8
- package/dist/base32_encode.d.ts.map +0 -1
- package/dist/base64.d.ts.map +0 -1
- package/dist/block_state.d.ts.map +0 -1
- package/dist/bmodel/block_config.d.ts.map +0 -1
- package/dist/bmodel/code.d.ts.map +0 -1
- package/dist/bmodel/container.d.ts.map +0 -1
- package/dist/bmodel/index.d.ts.map +0 -1
- package/dist/bmodel/normalization.d.ts.map +0 -1
- package/dist/bmodel/types.d.ts.map +0 -1
- package/dist/branding.d.ts.map +0 -1
- package/dist/common_types.d.ts.map +0 -1
- package/dist/driver_kit.d.ts.map +0 -1
- package/dist/drivers/ChunkedStreamReader.d.ts.map +0 -1
- package/dist/drivers/blob.d.ts.map +0 -1
- package/dist/drivers/index.d.ts.map +0 -1
- package/dist/drivers/interfaces.d.ts.map +0 -1
- package/dist/drivers/log.d.ts.map +0 -1
- package/dist/drivers/ls.d.ts.map +0 -1
- package/dist/drivers/pframe/column_filter.d.ts.map +0 -1
- package/dist/drivers/pframe/data_info.d.ts.map +0 -1
- package/dist/drivers/pframe/data_types.d.ts.map +0 -1
- package/dist/drivers/pframe/driver.d.ts.map +0 -1
- package/dist/drivers/pframe/filter_spec.d.ts.map +0 -1
- package/dist/drivers/pframe/find_columns.d.ts.map +0 -1
- package/dist/drivers/pframe/index.d.ts.map +0 -1
- package/dist/drivers/pframe/linker_columns.d.ts.map +0 -1
- package/dist/drivers/pframe/pframe.d.ts.map +0 -1
- package/dist/drivers/pframe/query/index.d.ts.map +0 -1
- package/dist/drivers/pframe/query/query_common.d.ts.map +0 -1
- package/dist/drivers/pframe/query/query_data.d.ts.map +0 -1
- package/dist/drivers/pframe/query/query_spec.d.ts.map +0 -1
- package/dist/drivers/pframe/query/utils.d.ts.map +0 -1
- package/dist/drivers/pframe/spec/anchored.d.ts.map +0 -1
- package/dist/drivers/pframe/spec/filtered_column.d.ts.map +0 -1
- package/dist/drivers/pframe/spec/ids.d.ts.map +0 -1
- package/dist/drivers/pframe/spec/index.d.ts.map +0 -1
- package/dist/drivers/pframe/spec/native_id.d.ts.map +0 -1
- package/dist/drivers/pframe/spec/selectors.d.ts.map +0 -1
- package/dist/drivers/pframe/spec/spec.d.ts.map +0 -1
- package/dist/drivers/pframe/table.d.ts.map +0 -1
- package/dist/drivers/pframe/table_calculate.d.ts.map +0 -1
- package/dist/drivers/pframe/table_common.d.ts.map +0 -1
- package/dist/drivers/pframe/type_util.d.ts +0 -5
- package/dist/drivers/pframe/type_util.d.ts.map +0 -1
- package/dist/drivers/pframe/unique_values.d.ts.map +0 -1
- package/dist/drivers/upload.d.ts.map +0 -1
- package/dist/drivers/urls.d.ts.map +0 -1
- package/dist/errors.d.ts.map +0 -1
- package/dist/flags/block_flags.d.ts.map +0 -1
- package/dist/flags/flag_utils.d.ts.map +0 -1
- package/dist/flags/index.d.ts +0 -4
- package/dist/flags/index.d.ts.map +0 -1
- package/dist/flags/type_utils.d.ts.map +0 -1
- package/dist/httpAuth.d.ts.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/json.d.ts.map +0 -1
- package/dist/navigation.d.ts.map +0 -1
- package/dist/plid.d.ts.map +0 -1
- package/dist/pool/entry.d.ts.map +0 -1
- package/dist/pool/index.d.ts.map +0 -1
- package/dist/pool/query.d.ts.map +0 -1
- package/dist/pool/spec.d.ts.map +0 -1
- package/dist/ref.d.ts.map +0 -1
- package/dist/utag.d.ts.map +0 -1
- package/dist/util.d.ts.map +0 -1
- package/dist/value_or_error.d.ts.map +0 -1
package/dist/pool/spec.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spec.js","sources":["../../src/pool/spec.ts"],"sourcesContent":["import type { Branded } from \"../branding\";\nimport type { JoinEntry, PColumn, PColumnLazy, PColumnSpec } from \"../drivers\";\nimport { assertNever } from \"../util\";\nimport type { ResultPoolEntry } from \"./entry\";\n\n/** Any object exported into the result pool by the block always have spec attached to it */\nexport type PObjectSpec = {\n /** PObject kind discriminator */\n readonly kind: string;\n\n /** Name is common part of PObject identity */\n readonly name: string;\n\n /** Domain is a set of key-value pairs that can be used to identify the object */\n readonly domain?: Record<string, string>;\n\n /** Additional information attached to the object */\n readonly annotations?: Record<string, string>;\n};\n\n/** Stable PObject id */\nexport type PObjectId = Branded<string, \"PColumnId\">;\n\n/**\n * Full PObject representation.\n *\n * @template Data type of the object referencing or describing the \"data\" part of the PObject\n * */\nexport interface PObject<Data> {\n /** Fully rendered PObjects are assigned a stable identifier. */\n readonly id: PObjectId;\n\n /** PObject spec, allowing it to be found among other PObjects */\n readonly spec: PObjectSpec;\n\n /** A handle to data object */\n readonly data: Data;\n}\n\nexport function isPColumnSpec(spec: PObjectSpec): spec is PColumnSpec {\n return spec.kind === \"PColumn\";\n}\n\nexport function isPColumn<T>(obj: PObject<T>): obj is PColumn<T> {\n return isPColumnSpec(obj.spec);\n}\n\nexport function isPColumnSpecResult(\n r: ResultPoolEntry<PObjectSpec>,\n): r is ResultPoolEntry<PColumnSpec> {\n return isPColumnSpec(r.obj);\n}\n\nexport function isPColumnResult<T>(\n r: ResultPoolEntry<PObject<T>>,\n): r is ResultPoolEntry<PColumn<T>> {\n return isPColumnSpec(r.obj.spec);\n}\n\nexport function ensurePColumn<T>(obj: PObject<T>): PColumn<T> {\n if (!isPColumn(obj)) throw new Error(`not a PColumn (kind = ${obj.spec.kind})`);\n return obj;\n}\n\nexport function mapPObjectData<D1, D2>(\n pObj: PColumn<D1> | PColumnLazy<D1>,\n cb: (d: D1) => D2,\n): PColumn<D2>;\nexport function mapPObjectData<D1, D2>(pObj: PColumn<D1>, cb: (d: D1) => D2): PColumn<D2>;\nexport function mapPObjectData<D1, D2>(\n pObj: PColumn<D1> | undefined,\n cb: (d: D1) => D2,\n): PColumn<D2> | undefined;\nexport function mapPObjectData<D1, D2>(pObj: PObject<D1>, cb: (d: D1) => D2): PObject<D2>;\nexport function mapPObjectData<D1, D2>(\n pObj: PObject<D1> | undefined,\n cb: (d: D1) => D2,\n): PObject<D2> | undefined;\nexport function mapPObjectData<D1, D2>(\n pObj: PObject<D1> | undefined,\n cb: (d: D1) => D2,\n): PObject<D2> | undefined {\n return pObj === undefined\n ? undefined\n : {\n ...pObj,\n data: cb(typeof pObj.data === \"function\" ? pObj.data() : pObj.data),\n };\n}\n\nexport function extractAllColumns<D>(entry: JoinEntry<PColumn<D>>): PColumn<D>[] {\n const columns = new Map<PObjectId, PColumn<D>>();\n const addAllColumns = (entry: JoinEntry<PColumn<D>>) => {\n switch (entry.type) {\n case \"column\":\n columns.set(entry.column.id, entry.column);\n return;\n case \"slicedColumn\":\n columns.set(entry.column.id, entry.column);\n return;\n case \"artificialColumn\":\n columns.set(entry.column.id, entry.column);\n return;\n case \"inlineColumn\":\n return;\n case \"full\":\n case \"inner\":\n for (const e of entry.entries) addAllColumns(e);\n return;\n case \"outer\":\n addAllColumns(entry.primary);\n for (const e of entry.secondary) addAllColumns(e);\n return;\n default:\n assertNever(entry);\n }\n };\n addAllColumns(entry);\n return [...columns.values()];\n}\n"],"
|
|
1
|
+
{"version":3,"file":"spec.js","names":[],"sources":["../../src/pool/spec.ts"],"sourcesContent":["import type { Branded } from \"../branding\";\nimport type { JoinEntry, PColumn, PColumnLazy, PColumnSpec } from \"../drivers\";\nimport { assertNever } from \"../util\";\nimport type { ResultPoolEntry } from \"./entry\";\n\n/** Any object exported into the result pool by the block always have spec attached to it */\nexport type PObjectSpec = {\n /** PObject kind discriminator */\n readonly kind: string;\n\n /** Name is common part of PObject identity */\n readonly name: string;\n\n /** Domain is a set of key-value pairs that can be used to identify the object */\n readonly domain?: Record<string, string>;\n\n /** Additional information attached to the object */\n readonly annotations?: Record<string, string>;\n};\n\n/** Stable PObject id */\nexport type PObjectId = Branded<string, \"PColumnId\">;\n\n/**\n * Full PObject representation.\n *\n * @template Data type of the object referencing or describing the \"data\" part of the PObject\n * */\nexport interface PObject<Data> {\n /** Fully rendered PObjects are assigned a stable identifier. */\n readonly id: PObjectId;\n\n /** PObject spec, allowing it to be found among other PObjects */\n readonly spec: PObjectSpec;\n\n /** A handle to data object */\n readonly data: Data;\n}\n\nexport function isPColumnSpec(spec: PObjectSpec): spec is PColumnSpec {\n return spec.kind === \"PColumn\";\n}\n\nexport function isPColumn<T>(obj: PObject<T>): obj is PColumn<T> {\n return isPColumnSpec(obj.spec);\n}\n\nexport function isPColumnSpecResult(\n r: ResultPoolEntry<PObjectSpec>,\n): r is ResultPoolEntry<PColumnSpec> {\n return isPColumnSpec(r.obj);\n}\n\nexport function isPColumnResult<T>(\n r: ResultPoolEntry<PObject<T>>,\n): r is ResultPoolEntry<PColumn<T>> {\n return isPColumnSpec(r.obj.spec);\n}\n\nexport function ensurePColumn<T>(obj: PObject<T>): PColumn<T> {\n if (!isPColumn(obj)) throw new Error(`not a PColumn (kind = ${obj.spec.kind})`);\n return obj;\n}\n\nexport function mapPObjectData<D1, D2>(\n pObj: PColumn<D1> | PColumnLazy<D1>,\n cb: (d: D1) => D2,\n): PColumn<D2>;\nexport function mapPObjectData<D1, D2>(pObj: PColumn<D1>, cb: (d: D1) => D2): PColumn<D2>;\nexport function mapPObjectData<D1, D2>(\n pObj: PColumn<D1> | undefined,\n cb: (d: D1) => D2,\n): PColumn<D2> | undefined;\nexport function mapPObjectData<D1, D2>(pObj: PObject<D1>, cb: (d: D1) => D2): PObject<D2>;\nexport function mapPObjectData<D1, D2>(\n pObj: PObject<D1> | undefined,\n cb: (d: D1) => D2,\n): PObject<D2> | undefined;\nexport function mapPObjectData<D1, D2>(\n pObj: PObject<D1> | undefined,\n cb: (d: D1) => D2,\n): PObject<D2> | undefined {\n return pObj === undefined\n ? undefined\n : {\n ...pObj,\n data: cb(typeof pObj.data === \"function\" ? pObj.data() : pObj.data),\n };\n}\n\nexport function extractAllColumns<D>(entry: JoinEntry<PColumn<D>>): PColumn<D>[] {\n const columns = new Map<PObjectId, PColumn<D>>();\n const addAllColumns = (entry: JoinEntry<PColumn<D>>) => {\n switch (entry.type) {\n case \"column\":\n columns.set(entry.column.id, entry.column);\n return;\n case \"slicedColumn\":\n columns.set(entry.column.id, entry.column);\n return;\n case \"artificialColumn\":\n columns.set(entry.column.id, entry.column);\n return;\n case \"inlineColumn\":\n return;\n case \"full\":\n case \"inner\":\n for (const e of entry.entries) addAllColumns(e);\n return;\n case \"outer\":\n addAllColumns(entry.primary);\n for (const e of entry.secondary) addAllColumns(e);\n return;\n default:\n assertNever(entry);\n }\n };\n addAllColumns(entry);\n return [...columns.values()];\n}\n"],"mappings":";;;AAuCA,SAAgB,cAAc,MAAwC;AACpE,QAAO,KAAK,SAAS;;AAGvB,SAAgB,UAAa,KAAoC;AAC/D,QAAO,cAAc,IAAI,KAAK;;AAGhC,SAAgB,oBACd,GACmC;AACnC,QAAO,cAAc,EAAE,IAAI;;AAG7B,SAAgB,gBACd,GACkC;AAClC,QAAO,cAAc,EAAE,IAAI,KAAK;;AAGlC,SAAgB,cAAiB,KAA6B;AAC5D,KAAI,CAAC,UAAU,IAAI,CAAE,OAAM,IAAI,MAAM,yBAAyB,IAAI,KAAK,KAAK,GAAG;AAC/E,QAAO;;AAiBT,SAAgB,eACd,MACA,IACyB;AACzB,QAAO,SAAS,SACZ,SACA;EACE,GAAG;EACH,MAAM,GAAG,OAAO,KAAK,SAAS,aAAa,KAAK,MAAM,GAAG,KAAK,KAAK;EACpE;;AAGP,SAAgB,kBAAqB,OAA4C;CAC/E,MAAM,0BAAU,IAAI,KAA4B;CAChD,MAAM,iBAAiB,UAAiC;AACtD,UAAQ,MAAM,MAAd;GACE,KAAK;AACH,YAAQ,IAAI,MAAM,OAAO,IAAI,MAAM,OAAO;AAC1C;GACF,KAAK;AACH,YAAQ,IAAI,MAAM,OAAO,IAAI,MAAM,OAAO;AAC1C;GACF,KAAK;AACH,YAAQ,IAAI,MAAM,OAAO,IAAI,MAAM,OAAO;AAC1C;GACF,KAAK,eACH;GACF,KAAK;GACL,KAAK;AACH,SAAK,MAAM,KAAK,MAAM,QAAS,eAAc,EAAE;AAC/C;GACF,KAAK;AACH,kBAAc,MAAM,QAAQ;AAC5B,SAAK,MAAM,KAAK,MAAM,UAAW,eAAc,EAAE;AACjD;GACF,QACE,aAAY,MAAM;;;AAGxB,eAAc,MAAM;AACpB,QAAO,CAAC,GAAG,QAAQ,QAAQ,CAAC"}
|
package/dist/ref.cjs
CHANGED
|
@@ -1,90 +1,70 @@
|
|
|
1
|
-
|
|
1
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
let zod = require("zod");
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
blockId: zod.z.string().describe("Upstream block id"),
|
|
11
|
-
name: zod.z.string().describe("Name of the output provided to the upstream block's output context"),
|
|
12
|
-
requireEnrichments: zod.z
|
|
13
|
-
.literal(true)
|
|
14
|
-
.optional()
|
|
15
|
-
.describe("True if current block that stores this reference in its args, may need enrichments " +
|
|
16
|
-
"for the references value originating from the blocks in between current and referenced block"),
|
|
17
|
-
})
|
|
18
|
-
.describe("Universal reference type, allowing to set block connections. It is crucial that " +
|
|
19
|
-
"{@link __isRef} is present and equal to true, internal logic relies on this marker " +
|
|
20
|
-
"to build block dependency trees.")
|
|
21
|
-
.readonly();
|
|
4
|
+
//#region src/ref.ts
|
|
5
|
+
const PlRef = zod.z.object({
|
|
6
|
+
__isRef: zod.z.literal(true).describe("Crucial marker for the block dependency tree reconstruction"),
|
|
7
|
+
blockId: zod.z.string().describe("Upstream block id"),
|
|
8
|
+
name: zod.z.string().describe("Name of the output provided to the upstream block's output context"),
|
|
9
|
+
requireEnrichments: zod.z.literal(true).optional().describe("True if current block that stores this reference in its args, may need enrichments for the references value originating from the blocks in between current and referenced block")
|
|
10
|
+
}).describe("Universal reference type, allowing to set block connections. It is crucial that {@link __isRef} is present and equal to true, internal logic relies on this marker to build block dependency trees.").readonly();
|
|
22
11
|
/**
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
12
|
+
* Type guard to check if a value is a PlRef.
|
|
13
|
+
*
|
|
14
|
+
* @param value - The value to check.
|
|
15
|
+
* @returns True if the value is a PlRef, false otherwise.
|
|
16
|
+
*/
|
|
28
17
|
function isPlRef(value) {
|
|
29
|
-
|
|
30
|
-
value !== null &&
|
|
31
|
-
"__isRef" in value &&
|
|
32
|
-
value.__isRef === true &&
|
|
33
|
-
"blockId" in value &&
|
|
34
|
-
"name" in value);
|
|
18
|
+
return typeof value === "object" && value !== null && "__isRef" in value && value.__isRef === true && "blockId" in value && "name" in value;
|
|
35
19
|
}
|
|
36
20
|
/**
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
21
|
+
* Creates a PlRef with the given blockId and name.
|
|
22
|
+
*
|
|
23
|
+
* @param blockId - The blockId of the reference.
|
|
24
|
+
* @param name - The name of the reference.
|
|
25
|
+
* @param requireEnrichments - Whether the reference requires enrichments.
|
|
26
|
+
*/
|
|
43
27
|
function createPlRef(blockId, name, requireEnrichments = false) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
name,
|
|
56
|
-
};
|
|
28
|
+
if (requireEnrichments) return {
|
|
29
|
+
__isRef: true,
|
|
30
|
+
blockId,
|
|
31
|
+
name,
|
|
32
|
+
requireEnrichments: true
|
|
33
|
+
};
|
|
34
|
+
else return {
|
|
35
|
+
__isRef: true,
|
|
36
|
+
blockId,
|
|
37
|
+
name
|
|
38
|
+
};
|
|
57
39
|
}
|
|
58
40
|
/**
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
41
|
+
* Creates a new PlRef based on an existing one, explicitly setting (default) or removing the
|
|
42
|
+
* requireEnrichments property.
|
|
43
|
+
*
|
|
44
|
+
* @param ref - The original PlRef object.
|
|
45
|
+
* @param requireEnrichments - If true, the `requireEnrichments: true` property is added
|
|
46
|
+
* to the returned PlRef. If false, the `requireEnrichments` property is removed. Defaults to true.
|
|
47
|
+
* @returns A new PlRef object with the `requireEnrichments` property set or removed accordingly.
|
|
48
|
+
*/
|
|
67
49
|
function withEnrichments(ref, requireEnrichments = true) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
50
|
+
if (requireEnrichments) return {
|
|
51
|
+
...ref,
|
|
52
|
+
requireEnrichments: true
|
|
53
|
+
};
|
|
54
|
+
else {
|
|
55
|
+
const { requireEnrichments: _, ...rest } = ref;
|
|
56
|
+
return rest;
|
|
57
|
+
}
|
|
77
58
|
}
|
|
78
59
|
/** Compare two PlRefs and returns true if they are qual */
|
|
79
60
|
function plRefsEqual(ref1, ref2, ignoreEnrichments = false) {
|
|
80
|
-
|
|
81
|
-
ref1.name === ref2.name &&
|
|
82
|
-
(ignoreEnrichments || ref1.requireEnrichments === ref2.requireEnrichments));
|
|
61
|
+
return ref1.blockId === ref2.blockId && ref1.name === ref2.name && (ignoreEnrichments || ref1.requireEnrichments === ref2.requireEnrichments);
|
|
83
62
|
}
|
|
84
63
|
|
|
64
|
+
//#endregion
|
|
85
65
|
exports.PlRef = PlRef;
|
|
86
66
|
exports.createPlRef = createPlRef;
|
|
87
67
|
exports.isPlRef = isPlRef;
|
|
88
68
|
exports.plRefsEqual = plRefsEqual;
|
|
89
69
|
exports.withEnrichments = withEnrichments;
|
|
90
|
-
//# sourceMappingURL=ref.cjs.map
|
|
70
|
+
//# sourceMappingURL=ref.cjs.map
|
package/dist/ref.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ref.cjs","sources":["../src/ref.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const PlRef = z\n .object({\n __isRef: z\n .literal(true)\n .describe(\"Crucial marker for the block dependency tree reconstruction\"),\n blockId: z.string().describe(\"Upstream block id\"),\n name: z.string().describe(\"Name of the output provided to the upstream block's output context\"),\n requireEnrichments: z\n .literal(true)\n .optional()\n .describe(\n \"True if current block that stores this reference in its args, may need enrichments \" +\n \"for the references value originating from the blocks in between current and referenced block\",\n ),\n })\n .describe(\n \"Universal reference type, allowing to set block connections. It is crucial that \" +\n \"{@link __isRef} is present and equal to true, internal logic relies on this marker \" +\n \"to build block dependency trees.\",\n )\n .readonly();\nexport type PlRef = z.infer<typeof PlRef>;\n/** @deprecated use {@link PlRef} */\nexport type Ref = PlRef;\n\n/**\n * Type guard to check if a value is a PlRef.\n *\n * @param value - The value to check.\n * @returns True if the value is a PlRef, false otherwise.\n */\nexport function isPlRef(value: unknown): value is PlRef {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"__isRef\" in value &&\n (value as { __isRef: unknown }).__isRef === true &&\n \"blockId\" in value &&\n \"name\" in value\n );\n}\n\n/** Standard way how to communicate possible connections given specific\n * requirements for incoming data. */\nexport type Option = {\n /** Fully rendered reference to be assigned for the intended field in block's\n * args */\n readonly ref: PlRef;\n\n /** Label to be present for the user in i.e. drop-down list */\n readonly label: string;\n};\n\n/**\n * Creates a PlRef with the given blockId and name.\n *\n * @param blockId - The blockId of the reference.\n * @param name - The name of the reference.\n * @param requireEnrichments - Whether the reference requires enrichments.\n */\nexport function createPlRef(blockId: string, name: string, requireEnrichments: boolean = false) {\n if (requireEnrichments)\n return {\n __isRef: true,\n blockId,\n name,\n requireEnrichments: true,\n };\n else\n return {\n __isRef: true,\n blockId,\n name,\n };\n}\n\n/**\n * Creates a new PlRef based on an existing one, explicitly setting (default) or removing the\n * requireEnrichments property.\n *\n * @param ref - The original PlRef object.\n * @param requireEnrichments - If true, the `requireEnrichments: true` property is added\n * to the returned PlRef. If false, the `requireEnrichments` property is removed. Defaults to true.\n * @returns A new PlRef object with the `requireEnrichments` property set or removed accordingly.\n */\nexport function withEnrichments(ref: PlRef, requireEnrichments: boolean = true): PlRef {\n if (requireEnrichments)\n return {\n ...ref,\n requireEnrichments: true,\n };\n else {\n const { requireEnrichments: _, ...rest } = ref;\n return rest;\n }\n}\n\n/** Compare two PlRefs and returns true if they are qual */\nexport function plRefsEqual(ref1: PlRef, ref2: PlRef, ignoreEnrichments: boolean = false) {\n return (\n ref1.blockId === ref2.blockId &&\n ref1.name === ref2.name &&\n (ignoreEnrichments || ref1.requireEnrichments === ref2.requireEnrichments)\n );\n}\n"],"
|
|
1
|
+
{"version":3,"file":"ref.cjs","names":["z"],"sources":["../src/ref.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const PlRef = z\n .object({\n __isRef: z\n .literal(true)\n .describe(\"Crucial marker for the block dependency tree reconstruction\"),\n blockId: z.string().describe(\"Upstream block id\"),\n name: z.string().describe(\"Name of the output provided to the upstream block's output context\"),\n requireEnrichments: z\n .literal(true)\n .optional()\n .describe(\n \"True if current block that stores this reference in its args, may need enrichments \" +\n \"for the references value originating from the blocks in between current and referenced block\",\n ),\n })\n .describe(\n \"Universal reference type, allowing to set block connections. It is crucial that \" +\n \"{@link __isRef} is present and equal to true, internal logic relies on this marker \" +\n \"to build block dependency trees.\",\n )\n .readonly();\nexport type PlRef = z.infer<typeof PlRef>;\n/** @deprecated use {@link PlRef} */\nexport type Ref = PlRef;\n\n/**\n * Type guard to check if a value is a PlRef.\n *\n * @param value - The value to check.\n * @returns True if the value is a PlRef, false otherwise.\n */\nexport function isPlRef(value: unknown): value is PlRef {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"__isRef\" in value &&\n (value as { __isRef: unknown }).__isRef === true &&\n \"blockId\" in value &&\n \"name\" in value\n );\n}\n\n/** Standard way how to communicate possible connections given specific\n * requirements for incoming data. */\nexport type Option = {\n /** Fully rendered reference to be assigned for the intended field in block's\n * args */\n readonly ref: PlRef;\n\n /** Label to be present for the user in i.e. drop-down list */\n readonly label: string;\n};\n\n/**\n * Creates a PlRef with the given blockId and name.\n *\n * @param blockId - The blockId of the reference.\n * @param name - The name of the reference.\n * @param requireEnrichments - Whether the reference requires enrichments.\n */\nexport function createPlRef(blockId: string, name: string, requireEnrichments: boolean = false) {\n if (requireEnrichments)\n return {\n __isRef: true,\n blockId,\n name,\n requireEnrichments: true,\n };\n else\n return {\n __isRef: true,\n blockId,\n name,\n };\n}\n\n/**\n * Creates a new PlRef based on an existing one, explicitly setting (default) or removing the\n * requireEnrichments property.\n *\n * @param ref - The original PlRef object.\n * @param requireEnrichments - If true, the `requireEnrichments: true` property is added\n * to the returned PlRef. If false, the `requireEnrichments` property is removed. Defaults to true.\n * @returns A new PlRef object with the `requireEnrichments` property set or removed accordingly.\n */\nexport function withEnrichments(ref: PlRef, requireEnrichments: boolean = true): PlRef {\n if (requireEnrichments)\n return {\n ...ref,\n requireEnrichments: true,\n };\n else {\n const { requireEnrichments: _, ...rest } = ref;\n return rest;\n }\n}\n\n/** Compare two PlRefs and returns true if they are qual */\nexport function plRefsEqual(ref1: PlRef, ref2: PlRef, ignoreEnrichments: boolean = false) {\n return (\n ref1.blockId === ref2.blockId &&\n ref1.name === ref2.name &&\n (ignoreEnrichments || ref1.requireEnrichments === ref2.requireEnrichments)\n );\n}\n"],"mappings":";;;;AAEA,MAAa,QAAQA,MAClB,OAAO;CACN,SAASA,MACN,QAAQ,KAAK,CACb,SAAS,8DAA8D;CAC1E,SAASA,MAAE,QAAQ,CAAC,SAAS,oBAAoB;CACjD,MAAMA,MAAE,QAAQ,CAAC,SAAS,qEAAqE;CAC/F,oBAAoBA,MACjB,QAAQ,KAAK,CACb,UAAU,CACV,SACC,kLAED;CACJ,CAAC,CACD,SACC,sMAGD,CACA,UAAU;;;;;;;AAWb,SAAgB,QAAQ,OAAgC;AACtD,QACE,OAAO,UAAU,YACjB,UAAU,QACV,aAAa,SACZ,MAA+B,YAAY,QAC5C,aAAa,SACb,UAAU;;;;;;;;;AAsBd,SAAgB,YAAY,SAAiB,MAAc,qBAA8B,OAAO;AAC9F,KAAI,mBACF,QAAO;EACL,SAAS;EACT;EACA;EACA,oBAAoB;EACrB;KAED,QAAO;EACL,SAAS;EACT;EACA;EACD;;;;;;;;;;;AAYL,SAAgB,gBAAgB,KAAY,qBAA8B,MAAa;AACrF,KAAI,mBACF,QAAO;EACL,GAAG;EACH,oBAAoB;EACrB;MACE;EACH,MAAM,EAAE,oBAAoB,GAAG,GAAG,SAAS;AAC3C,SAAO;;;;AAKX,SAAgB,YAAY,MAAa,MAAa,oBAA6B,OAAO;AACxF,QACE,KAAK,YAAY,KAAK,WACtB,KAAK,SAAS,KAAK,SAClB,qBAAqB,KAAK,uBAAuB,KAAK"}
|
package/dist/ref.d.ts
CHANGED
|
@@ -1,38 +1,39 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
|
|
3
|
+
//#region src/ref.d.ts
|
|
4
|
+
declare const PlRef: z.ZodReadonly<z.ZodObject<{
|
|
5
|
+
__isRef: z.ZodLiteral<true>;
|
|
6
|
+
blockId: z.ZodString;
|
|
7
|
+
name: z.ZodString;
|
|
8
|
+
requireEnrichments: z.ZodOptional<z.ZodLiteral<true>>;
|
|
7
9
|
}, "strip", z.ZodTypeAny, {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
__isRef: true;
|
|
11
|
+
blockId: string;
|
|
12
|
+
name: string;
|
|
13
|
+
requireEnrichments?: true | undefined;
|
|
12
14
|
}, {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
__isRef: true;
|
|
16
|
+
blockId: string;
|
|
17
|
+
name: string;
|
|
18
|
+
requireEnrichments?: true | undefined;
|
|
17
19
|
}>>;
|
|
18
|
-
|
|
20
|
+
type PlRef = z.infer<typeof PlRef>;
|
|
19
21
|
/** @deprecated use {@link PlRef} */
|
|
20
|
-
|
|
22
|
+
type Ref = PlRef;
|
|
21
23
|
/**
|
|
22
24
|
* Type guard to check if a value is a PlRef.
|
|
23
25
|
*
|
|
24
26
|
* @param value - The value to check.
|
|
25
27
|
* @returns True if the value is a PlRef, false otherwise.
|
|
26
28
|
*/
|
|
27
|
-
|
|
29
|
+
declare function isPlRef(value: unknown): value is PlRef;
|
|
28
30
|
/** Standard way how to communicate possible connections given specific
|
|
29
31
|
* requirements for incoming data. */
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
readonly label: string;
|
|
32
|
+
type Option = {
|
|
33
|
+
/** Fully rendered reference to be assigned for the intended field in block's
|
|
34
|
+
* args */
|
|
35
|
+
readonly ref: PlRef; /** Label to be present for the user in i.e. drop-down list */
|
|
36
|
+
readonly label: string;
|
|
36
37
|
};
|
|
37
38
|
/**
|
|
38
39
|
* Creates a PlRef with the given blockId and name.
|
|
@@ -41,16 +42,16 @@ export type Option = {
|
|
|
41
42
|
* @param name - The name of the reference.
|
|
42
43
|
* @param requireEnrichments - Whether the reference requires enrichments.
|
|
43
44
|
*/
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
declare function createPlRef(blockId: string, name: string, requireEnrichments?: boolean): {
|
|
46
|
+
__isRef: boolean;
|
|
47
|
+
blockId: string;
|
|
48
|
+
name: string;
|
|
49
|
+
requireEnrichments: boolean;
|
|
49
50
|
} | {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
__isRef: boolean;
|
|
52
|
+
blockId: string;
|
|
53
|
+
name: string;
|
|
54
|
+
requireEnrichments?: undefined;
|
|
54
55
|
};
|
|
55
56
|
/**
|
|
56
57
|
* Creates a new PlRef based on an existing one, explicitly setting (default) or removing the
|
|
@@ -61,7 +62,9 @@ export declare function createPlRef(blockId: string, name: string, requireEnrich
|
|
|
61
62
|
* to the returned PlRef. If false, the `requireEnrichments` property is removed. Defaults to true.
|
|
62
63
|
* @returns A new PlRef object with the `requireEnrichments` property set or removed accordingly.
|
|
63
64
|
*/
|
|
64
|
-
|
|
65
|
+
declare function withEnrichments(ref: PlRef, requireEnrichments?: boolean): PlRef;
|
|
65
66
|
/** Compare two PlRefs and returns true if they are qual */
|
|
66
|
-
|
|
67
|
+
declare function plRefsEqual(ref1: PlRef, ref2: PlRef, ignoreEnrichments?: boolean): boolean;
|
|
68
|
+
//#endregion
|
|
69
|
+
export { Option, PlRef, Ref, createPlRef, isPlRef, plRefsEqual, withEnrichments };
|
|
67
70
|
//# sourceMappingURL=ref.d.ts.map
|
package/dist/ref.js
CHANGED
|
@@ -1,84 +1,65 @@
|
|
|
1
|
-
import { z } from
|
|
1
|
+
import { z } from "zod";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
requireEnrichments: z
|
|
11
|
-
.literal(true)
|
|
12
|
-
.optional()
|
|
13
|
-
.describe("True if current block that stores this reference in its args, may need enrichments " +
|
|
14
|
-
"for the references value originating from the blocks in between current and referenced block"),
|
|
15
|
-
})
|
|
16
|
-
.describe("Universal reference type, allowing to set block connections. It is crucial that " +
|
|
17
|
-
"{@link __isRef} is present and equal to true, internal logic relies on this marker " +
|
|
18
|
-
"to build block dependency trees.")
|
|
19
|
-
.readonly();
|
|
3
|
+
//#region src/ref.ts
|
|
4
|
+
const PlRef = z.object({
|
|
5
|
+
__isRef: z.literal(true).describe("Crucial marker for the block dependency tree reconstruction"),
|
|
6
|
+
blockId: z.string().describe("Upstream block id"),
|
|
7
|
+
name: z.string().describe("Name of the output provided to the upstream block's output context"),
|
|
8
|
+
requireEnrichments: z.literal(true).optional().describe("True if current block that stores this reference in its args, may need enrichments for the references value originating from the blocks in between current and referenced block")
|
|
9
|
+
}).describe("Universal reference type, allowing to set block connections. It is crucial that {@link __isRef} is present and equal to true, internal logic relies on this marker to build block dependency trees.").readonly();
|
|
20
10
|
/**
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
11
|
+
* Type guard to check if a value is a PlRef.
|
|
12
|
+
*
|
|
13
|
+
* @param value - The value to check.
|
|
14
|
+
* @returns True if the value is a PlRef, false otherwise.
|
|
15
|
+
*/
|
|
26
16
|
function isPlRef(value) {
|
|
27
|
-
|
|
28
|
-
value !== null &&
|
|
29
|
-
"__isRef" in value &&
|
|
30
|
-
value.__isRef === true &&
|
|
31
|
-
"blockId" in value &&
|
|
32
|
-
"name" in value);
|
|
17
|
+
return typeof value === "object" && value !== null && "__isRef" in value && value.__isRef === true && "blockId" in value && "name" in value;
|
|
33
18
|
}
|
|
34
19
|
/**
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
20
|
+
* Creates a PlRef with the given blockId and name.
|
|
21
|
+
*
|
|
22
|
+
* @param blockId - The blockId of the reference.
|
|
23
|
+
* @param name - The name of the reference.
|
|
24
|
+
* @param requireEnrichments - Whether the reference requires enrichments.
|
|
25
|
+
*/
|
|
41
26
|
function createPlRef(blockId, name, requireEnrichments = false) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
name,
|
|
54
|
-
};
|
|
27
|
+
if (requireEnrichments) return {
|
|
28
|
+
__isRef: true,
|
|
29
|
+
blockId,
|
|
30
|
+
name,
|
|
31
|
+
requireEnrichments: true
|
|
32
|
+
};
|
|
33
|
+
else return {
|
|
34
|
+
__isRef: true,
|
|
35
|
+
blockId,
|
|
36
|
+
name
|
|
37
|
+
};
|
|
55
38
|
}
|
|
56
39
|
/**
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
40
|
+
* Creates a new PlRef based on an existing one, explicitly setting (default) or removing the
|
|
41
|
+
* requireEnrichments property.
|
|
42
|
+
*
|
|
43
|
+
* @param ref - The original PlRef object.
|
|
44
|
+
* @param requireEnrichments - If true, the `requireEnrichments: true` property is added
|
|
45
|
+
* to the returned PlRef. If false, the `requireEnrichments` property is removed. Defaults to true.
|
|
46
|
+
* @returns A new PlRef object with the `requireEnrichments` property set or removed accordingly.
|
|
47
|
+
*/
|
|
65
48
|
function withEnrichments(ref, requireEnrichments = true) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
49
|
+
if (requireEnrichments) return {
|
|
50
|
+
...ref,
|
|
51
|
+
requireEnrichments: true
|
|
52
|
+
};
|
|
53
|
+
else {
|
|
54
|
+
const { requireEnrichments: _, ...rest } = ref;
|
|
55
|
+
return rest;
|
|
56
|
+
}
|
|
75
57
|
}
|
|
76
58
|
/** Compare two PlRefs and returns true if they are qual */
|
|
77
59
|
function plRefsEqual(ref1, ref2, ignoreEnrichments = false) {
|
|
78
|
-
|
|
79
|
-
ref1.name === ref2.name &&
|
|
80
|
-
(ignoreEnrichments || ref1.requireEnrichments === ref2.requireEnrichments));
|
|
60
|
+
return ref1.blockId === ref2.blockId && ref1.name === ref2.name && (ignoreEnrichments || ref1.requireEnrichments === ref2.requireEnrichments);
|
|
81
61
|
}
|
|
82
62
|
|
|
63
|
+
//#endregion
|
|
83
64
|
export { PlRef, createPlRef, isPlRef, plRefsEqual, withEnrichments };
|
|
84
|
-
//# sourceMappingURL=ref.js.map
|
|
65
|
+
//# sourceMappingURL=ref.js.map
|
package/dist/ref.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ref.js","sources":["../src/ref.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const PlRef = z\n .object({\n __isRef: z\n .literal(true)\n .describe(\"Crucial marker for the block dependency tree reconstruction\"),\n blockId: z.string().describe(\"Upstream block id\"),\n name: z.string().describe(\"Name of the output provided to the upstream block's output context\"),\n requireEnrichments: z\n .literal(true)\n .optional()\n .describe(\n \"True if current block that stores this reference in its args, may need enrichments \" +\n \"for the references value originating from the blocks in between current and referenced block\",\n ),\n })\n .describe(\n \"Universal reference type, allowing to set block connections. It is crucial that \" +\n \"{@link __isRef} is present and equal to true, internal logic relies on this marker \" +\n \"to build block dependency trees.\",\n )\n .readonly();\nexport type PlRef = z.infer<typeof PlRef>;\n/** @deprecated use {@link PlRef} */\nexport type Ref = PlRef;\n\n/**\n * Type guard to check if a value is a PlRef.\n *\n * @param value - The value to check.\n * @returns True if the value is a PlRef, false otherwise.\n */\nexport function isPlRef(value: unknown): value is PlRef {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"__isRef\" in value &&\n (value as { __isRef: unknown }).__isRef === true &&\n \"blockId\" in value &&\n \"name\" in value\n );\n}\n\n/** Standard way how to communicate possible connections given specific\n * requirements for incoming data. */\nexport type Option = {\n /** Fully rendered reference to be assigned for the intended field in block's\n * args */\n readonly ref: PlRef;\n\n /** Label to be present for the user in i.e. drop-down list */\n readonly label: string;\n};\n\n/**\n * Creates a PlRef with the given blockId and name.\n *\n * @param blockId - The blockId of the reference.\n * @param name - The name of the reference.\n * @param requireEnrichments - Whether the reference requires enrichments.\n */\nexport function createPlRef(blockId: string, name: string, requireEnrichments: boolean = false) {\n if (requireEnrichments)\n return {\n __isRef: true,\n blockId,\n name,\n requireEnrichments: true,\n };\n else\n return {\n __isRef: true,\n blockId,\n name,\n };\n}\n\n/**\n * Creates a new PlRef based on an existing one, explicitly setting (default) or removing the\n * requireEnrichments property.\n *\n * @param ref - The original PlRef object.\n * @param requireEnrichments - If true, the `requireEnrichments: true` property is added\n * to the returned PlRef. If false, the `requireEnrichments` property is removed. Defaults to true.\n * @returns A new PlRef object with the `requireEnrichments` property set or removed accordingly.\n */\nexport function withEnrichments(ref: PlRef, requireEnrichments: boolean = true): PlRef {\n if (requireEnrichments)\n return {\n ...ref,\n requireEnrichments: true,\n };\n else {\n const { requireEnrichments: _, ...rest } = ref;\n return rest;\n }\n}\n\n/** Compare two PlRefs and returns true if they are qual */\nexport function plRefsEqual(ref1: PlRef, ref2: PlRef, ignoreEnrichments: boolean = false) {\n return (\n ref1.blockId === ref2.blockId &&\n ref1.name === ref2.name &&\n (ignoreEnrichments || ref1.requireEnrichments === ref2.requireEnrichments)\n );\n}\n"],"
|
|
1
|
+
{"version":3,"file":"ref.js","names":[],"sources":["../src/ref.ts"],"sourcesContent":["import { z } from \"zod\";\n\nexport const PlRef = z\n .object({\n __isRef: z\n .literal(true)\n .describe(\"Crucial marker for the block dependency tree reconstruction\"),\n blockId: z.string().describe(\"Upstream block id\"),\n name: z.string().describe(\"Name of the output provided to the upstream block's output context\"),\n requireEnrichments: z\n .literal(true)\n .optional()\n .describe(\n \"True if current block that stores this reference in its args, may need enrichments \" +\n \"for the references value originating from the blocks in between current and referenced block\",\n ),\n })\n .describe(\n \"Universal reference type, allowing to set block connections. It is crucial that \" +\n \"{@link __isRef} is present and equal to true, internal logic relies on this marker \" +\n \"to build block dependency trees.\",\n )\n .readonly();\nexport type PlRef = z.infer<typeof PlRef>;\n/** @deprecated use {@link PlRef} */\nexport type Ref = PlRef;\n\n/**\n * Type guard to check if a value is a PlRef.\n *\n * @param value - The value to check.\n * @returns True if the value is a PlRef, false otherwise.\n */\nexport function isPlRef(value: unknown): value is PlRef {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"__isRef\" in value &&\n (value as { __isRef: unknown }).__isRef === true &&\n \"blockId\" in value &&\n \"name\" in value\n );\n}\n\n/** Standard way how to communicate possible connections given specific\n * requirements for incoming data. */\nexport type Option = {\n /** Fully rendered reference to be assigned for the intended field in block's\n * args */\n readonly ref: PlRef;\n\n /** Label to be present for the user in i.e. drop-down list */\n readonly label: string;\n};\n\n/**\n * Creates a PlRef with the given blockId and name.\n *\n * @param blockId - The blockId of the reference.\n * @param name - The name of the reference.\n * @param requireEnrichments - Whether the reference requires enrichments.\n */\nexport function createPlRef(blockId: string, name: string, requireEnrichments: boolean = false) {\n if (requireEnrichments)\n return {\n __isRef: true,\n blockId,\n name,\n requireEnrichments: true,\n };\n else\n return {\n __isRef: true,\n blockId,\n name,\n };\n}\n\n/**\n * Creates a new PlRef based on an existing one, explicitly setting (default) or removing the\n * requireEnrichments property.\n *\n * @param ref - The original PlRef object.\n * @param requireEnrichments - If true, the `requireEnrichments: true` property is added\n * to the returned PlRef. If false, the `requireEnrichments` property is removed. Defaults to true.\n * @returns A new PlRef object with the `requireEnrichments` property set or removed accordingly.\n */\nexport function withEnrichments(ref: PlRef, requireEnrichments: boolean = true): PlRef {\n if (requireEnrichments)\n return {\n ...ref,\n requireEnrichments: true,\n };\n else {\n const { requireEnrichments: _, ...rest } = ref;\n return rest;\n }\n}\n\n/** Compare two PlRefs and returns true if they are qual */\nexport function plRefsEqual(ref1: PlRef, ref2: PlRef, ignoreEnrichments: boolean = false) {\n return (\n ref1.blockId === ref2.blockId &&\n ref1.name === ref2.name &&\n (ignoreEnrichments || ref1.requireEnrichments === ref2.requireEnrichments)\n );\n}\n"],"mappings":";;;AAEA,MAAa,QAAQ,EAClB,OAAO;CACN,SAAS,EACN,QAAQ,KAAK,CACb,SAAS,8DAA8D;CAC1E,SAAS,EAAE,QAAQ,CAAC,SAAS,oBAAoB;CACjD,MAAM,EAAE,QAAQ,CAAC,SAAS,qEAAqE;CAC/F,oBAAoB,EACjB,QAAQ,KAAK,CACb,UAAU,CACV,SACC,kLAED;CACJ,CAAC,CACD,SACC,sMAGD,CACA,UAAU;;;;;;;AAWb,SAAgB,QAAQ,OAAgC;AACtD,QACE,OAAO,UAAU,YACjB,UAAU,QACV,aAAa,SACZ,MAA+B,YAAY,QAC5C,aAAa,SACb,UAAU;;;;;;;;;AAsBd,SAAgB,YAAY,SAAiB,MAAc,qBAA8B,OAAO;AAC9F,KAAI,mBACF,QAAO;EACL,SAAS;EACT;EACA;EACA,oBAAoB;EACrB;KAED,QAAO;EACL,SAAS;EACT;EACA;EACD;;;;;;;;;;;AAYL,SAAgB,gBAAgB,KAAY,qBAA8B,MAAa;AACrF,KAAI,mBACF,QAAO;EACL,GAAG;EACH,oBAAoB;EACrB;MACE;EACH,MAAM,EAAE,oBAAoB,GAAG,GAAG,SAAS;AAC3C,SAAO;;;;AAKX,SAAgB,YAAY,MAAa,MAAa,oBAA6B,OAAO;AACxF,QACE,KAAK,YAAY,KAAK,WACtB,KAAK,SAAS,KAAK,SAClB,qBAAqB,KAAK,uBAAuB,KAAK"}
|
package/dist/utag.d.ts
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { AuthorMarker } from "./author_marker.js";
|
|
2
|
+
|
|
3
|
+
//#region src/utag.d.ts
|
|
2
4
|
/** Value returned for changing states supporting reactive listening for changes */
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
interface ValueWithUTag<V> {
|
|
6
|
+
/** Value snapshot. */
|
|
7
|
+
readonly value: V;
|
|
8
|
+
/**
|
|
9
|
+
* Unique tag for the value snapshot.
|
|
10
|
+
*
|
|
11
|
+
* It can be used to synchronously detect if changes happened after current
|
|
12
|
+
* snapshot was retrieved, or asynchronously await next value snapshot,
|
|
13
|
+
* generated on underlying data changes.
|
|
14
|
+
* */
|
|
15
|
+
readonly uTag: string;
|
|
14
16
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
interface ValueWithUTagAndAuthor<V> extends ValueWithUTag<V> {
|
|
18
|
+
readonly author?: AuthorMarker;
|
|
17
19
|
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { ValueWithUTag, ValueWithUTagAndAuthor };
|
|
18
22
|
//# sourceMappingURL=utag.d.ts.map
|
package/dist/util.cjs
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
'use strict';
|
|
2
1
|
|
|
2
|
+
//#region src/util.ts
|
|
3
3
|
function assertNever(x) {
|
|
4
|
-
|
|
4
|
+
throw new Error("Unexpected object: " + x);
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
* Return unique entries of the array by the provided id
|
|
8
|
+
* For each id, the last entry is kept
|
|
9
|
+
*/
|
|
10
10
|
function uniqueBy(array, makeId) {
|
|
11
|
-
|
|
11
|
+
return [...new Map(array.map((e) => [makeId(e), e])).values()];
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
//#endregion
|
|
14
15
|
exports.assertNever = assertNever;
|
|
15
16
|
exports.uniqueBy = uniqueBy;
|
|
16
|
-
//# sourceMappingURL=util.cjs.map
|
|
17
|
+
//# sourceMappingURL=util.cjs.map
|
package/dist/util.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.cjs","sources":["../src/util.ts"],"sourcesContent":["export function assertNever(x: never): never {\n throw new Error(\"Unexpected object: \" + x); // This is ok, because this is a possible runtime error\n}\n\n/**\n * Return unique entries of the array by the provided id\n * For each id, the last entry is kept\n */\nexport function uniqueBy<T>(array: T[], makeId: (entry: T) => string): T[] {\n return [...new Map(array.map((e) => [makeId(e), e])).values()];\n}\n"],"
|
|
1
|
+
{"version":3,"file":"util.cjs","names":[],"sources":["../src/util.ts"],"sourcesContent":["export function assertNever(x: never): never {\n throw new Error(\"Unexpected object: \" + x); // This is ok, because this is a possible runtime error\n}\n\n/**\n * Return unique entries of the array by the provided id\n * For each id, the last entry is kept\n */\nexport function uniqueBy<T>(array: T[], makeId: (entry: T) => string): T[] {\n return [...new Map(array.map((e) => [makeId(e), e])).values()];\n}\n"],"mappings":";;AAAA,SAAgB,YAAY,GAAiB;AAC3C,OAAM,IAAI,MAAM,wBAAwB,EAAE;;;;;;AAO5C,SAAgB,SAAY,OAAY,QAAmC;AACzE,QAAO,CAAC,GAAG,IAAI,IAAI,MAAM,KAAK,MAAM,CAAC,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC"}
|
package/dist/util.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/util.d.ts
|
|
2
|
+
declare function assertNever(x: never): never;
|
|
2
3
|
/**
|
|
3
4
|
* Return unique entries of the array by the provided id
|
|
4
5
|
* For each id, the last entry is kept
|
|
5
6
|
*/
|
|
6
|
-
|
|
7
|
+
declare function uniqueBy<T>(array: T[], makeId: (entry: T) => string): T[];
|
|
8
|
+
//#endregion
|
|
9
|
+
export { assertNever, uniqueBy };
|
|
7
10
|
//# sourceMappingURL=util.d.ts.map
|
package/dist/util.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
//#region src/util.ts
|
|
1
2
|
function assertNever(x) {
|
|
2
|
-
|
|
3
|
+
throw new Error("Unexpected object: " + x);
|
|
3
4
|
}
|
|
4
5
|
/**
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
* Return unique entries of the array by the provided id
|
|
7
|
+
* For each id, the last entry is kept
|
|
8
|
+
*/
|
|
8
9
|
function uniqueBy(array, makeId) {
|
|
9
|
-
|
|
10
|
+
return [...new Map(array.map((e) => [makeId(e), e])).values()];
|
|
10
11
|
}
|
|
11
12
|
|
|
13
|
+
//#endregion
|
|
12
14
|
export { assertNever, uniqueBy };
|
|
13
|
-
//# sourceMappingURL=util.js.map
|
|
15
|
+
//# sourceMappingURL=util.js.map
|
package/dist/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sources":["../src/util.ts"],"sourcesContent":["export function assertNever(x: never): never {\n throw new Error(\"Unexpected object: \" + x); // This is ok, because this is a possible runtime error\n}\n\n/**\n * Return unique entries of the array by the provided id\n * For each id, the last entry is kept\n */\nexport function uniqueBy<T>(array: T[], makeId: (entry: T) => string): T[] {\n return [...new Map(array.map((e) => [makeId(e), e])).values()];\n}\n"],"
|
|
1
|
+
{"version":3,"file":"util.js","names":[],"sources":["../src/util.ts"],"sourcesContent":["export function assertNever(x: never): never {\n throw new Error(\"Unexpected object: \" + x); // This is ok, because this is a possible runtime error\n}\n\n/**\n * Return unique entries of the array by the provided id\n * For each id, the last entry is kept\n */\nexport function uniqueBy<T>(array: T[], makeId: (entry: T) => string): T[] {\n return [...new Map(array.map((e) => [makeId(e), e])).values()];\n}\n"],"mappings":";AAAA,SAAgB,YAAY,GAAiB;AAC3C,OAAM,IAAI,MAAM,wBAAwB,EAAE;;;;;;AAO5C,SAAgB,SAAY,OAAY,QAAmC;AACzE,QAAO,CAAC,GAAG,IAAI,IAAI,MAAM,KAAK,MAAM,CAAC,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC"}
|
package/dist/value_or_error.cjs
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
'use strict';
|
|
2
1
|
|
|
2
|
+
//#region src/value_or_error.ts
|
|
3
3
|
function mapValueInVOE(voe, cb) {
|
|
4
|
-
|
|
4
|
+
return voe.ok ? {
|
|
5
|
+
ok: true,
|
|
6
|
+
value: cb(voe.value)
|
|
7
|
+
} : voe;
|
|
5
8
|
}
|
|
6
9
|
|
|
10
|
+
//#endregion
|
|
7
11
|
exports.mapValueInVOE = mapValueInVOE;
|
|
8
|
-
//# sourceMappingURL=value_or_error.cjs.map
|
|
12
|
+
//# sourceMappingURL=value_or_error.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"value_or_error.cjs","sources":["../src/value_or_error.ts"],"sourcesContent":["export type ValueOrError<V, E> =\n | {\n ok: true;\n value: V;\n }\n | {\n ok: false;\n error: E;\n };\n\nexport function mapValueInVOE<V1, V2, E>(\n voe: ValueOrError<V1, E>,\n cb: (value: V1) => V2,\n): ValueOrError<V2, E> {\n return voe.ok ? { ok: true, value: cb(voe.value) } : voe;\n}\n"],"
|
|
1
|
+
{"version":3,"file":"value_or_error.cjs","names":[],"sources":["../src/value_or_error.ts"],"sourcesContent":["export type ValueOrError<V, E> =\n | {\n ok: true;\n value: V;\n }\n | {\n ok: false;\n error: E;\n };\n\nexport function mapValueInVOE<V1, V2, E>(\n voe: ValueOrError<V1, E>,\n cb: (value: V1) => V2,\n): ValueOrError<V2, E> {\n return voe.ok ? { ok: true, value: cb(voe.value) } : voe;\n}\n"],"mappings":";;AAUA,SAAgB,cACd,KACA,IACqB;AACrB,QAAO,IAAI,KAAK;EAAE,IAAI;EAAM,OAAO,GAAG,IAAI,MAAM;EAAE,GAAG"}
|