@kaskad/types 0.0.8 → 0.0.10

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.
@@ -14,6 +14,9 @@ function isTemplateComputation(schema) {
14
14
  function isSwitchComputation(schema) {
15
15
  return schema.computationType === 'switch';
16
16
  }
17
+ function isAwaitComputation(schema) {
18
+ return schema.computationType === 'await';
19
+ }
17
20
 
18
21
  function findChildValueType(valueType, path) {
19
22
  if (!path.length) {
@@ -43,5 +46,5 @@ function findChildValueType(valueType, path) {
43
46
  * Generated bundle index. Do not edit.
44
47
  */
45
48
 
46
- export { findChildValueType, isForComputation, isFormulaComputation, isIfComputation, isSwitchComputation, isTemplateComputation };
49
+ export { findChildValueType, isAwaitComputation, isForComputation, isFormulaComputation, isIfComputation, isSwitchComputation, isTemplateComputation };
47
50
  //# sourceMappingURL=kaskad-types.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"kaskad-types.mjs","sources":["../../../../libs/types/src/lib/computation-schema.ts","../../../../libs/types/src/lib/util/find-child-value-type.ts","../../../../libs/types/src/kaskad-types.ts"],"sourcesContent":["import { ComponentRef } from './branded';\nimport { ComponentSchemaNodeSchema, NodeSchema } from './node-schema';\nimport { ValueType } from './value-type';\n\nexport interface ComputationSchema {\n readonly computationType: string;\n}\n\nexport interface TemplateComputationSchema extends ComputationSchema {\n readonly computationType: 'template';\n readonly path: string;\n readonly ref?: ComponentRef;\n readonly defer: {\n placeholder: NodeSchema;\n error: NodeSchema;\n } | null;\n readonly contractVariables: Record<string, unknown>;\n}\n\nexport interface FormulaComputationSchema extends ComputationSchema {\n readonly computationType: 'formula';\n readonly formula: string;\n}\n\nexport interface IfComputationSchema extends ComputationSchema {\n readonly computationType: 'if';\n readonly if: NodeSchema;\n readonly then: NodeSchema;\n readonly else: NodeSchema;\n}\n\nexport interface DimensionSchema {\n items: NodeSchema;\n itemsType: ValueType;\n item: NodeSchema;\n index: NodeSchema;\n first: NodeSchema;\n last: NodeSchema;\n trackBy: NodeSchema;\n}\n\nexport interface ForComputationSchema extends ComputationSchema {\n readonly computationType: 'for';\n readonly dimensions: DimensionSchema[];\n readonly yield: NodeSchema;\n}\n\nexport interface SwitchComputationSchema extends ComputationSchema {\n readonly computationType: 'switch';\n readonly source: NodeSchema;\n readonly cases: { equals: unknown; then: ComponentSchemaNodeSchema }[];\n readonly default: ComponentSchemaNodeSchema;\n}\n\n// Type guards for built-in computation schemas\nexport function isFormulaComputation(schema: ComputationSchema): schema is FormulaComputationSchema {\n return schema.computationType === 'formula';\n}\n\nexport function isIfComputation(schema: ComputationSchema): schema is IfComputationSchema {\n return schema.computationType === 'if';\n}\n\nexport function isForComputation(schema: ComputationSchema): schema is ForComputationSchema {\n return schema.computationType === 'for';\n}\n\nexport function isTemplateComputation(schema: ComputationSchema): schema is TemplateComputationSchema {\n return schema.computationType === 'template';\n}\n\nexport function isSwitchComputation(schema: ComputationSchema): schema is SwitchComputationSchema {\n return schema.computationType === 'switch';\n}\n","import { ValueType } from '../value-type';\n\nexport function findChildValueType(valueType: ValueType, path: string[]): ValueType {\n if (!path.length) {\n return valueType;\n }\n\n const [head, ...tail] = path;\n\n switch (valueType.type) {\n case 'array': {\n return findChildValueType(valueType.item, tail);\n }\n case 'object': {\n const found = valueType.fields[head];\n if (!found) {\n throw new Error(`Field ${head} not found in object description.`);\n }\n return findChildValueType(found, tail);\n }\n case 'map': {\n return findChildValueType(valueType.item, tail);\n }\n default:\n return valueType;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"AAsDA;AACM,SAAU,oBAAoB,CAAC,MAAyB,EAAA;AAC5D,IAAA,OAAO,MAAM,CAAC,eAAe,KAAK,SAAS;AAC7C;AAEM,SAAU,eAAe,CAAC,MAAyB,EAAA;AACvD,IAAA,OAAO,MAAM,CAAC,eAAe,KAAK,IAAI;AACxC;AAEM,SAAU,gBAAgB,CAAC,MAAyB,EAAA;AACxD,IAAA,OAAO,MAAM,CAAC,eAAe,KAAK,KAAK;AACzC;AAEM,SAAU,qBAAqB,CAAC,MAAyB,EAAA;AAC7D,IAAA,OAAO,MAAM,CAAC,eAAe,KAAK,UAAU;AAC9C;AAEM,SAAU,mBAAmB,CAAC,MAAyB,EAAA;AAC3D,IAAA,OAAO,MAAM,CAAC,eAAe,KAAK,QAAQ;AAC5C;;ACvEM,SAAU,kBAAkB,CAAC,SAAoB,EAAE,IAAc,EAAA;AACrE,IAAA,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;AAChB,QAAA,OAAO,SAAS;;IAGlB,MAAM,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI;AAE5B,IAAA,QAAQ,SAAS,CAAC,IAAI;QACpB,KAAK,OAAO,EAAE;YACZ,OAAO,kBAAkB,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC;;QAEjD,KAAK,QAAQ,EAAE;YACb,MAAM,KAAK,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC;YACpC,IAAI,CAAC,KAAK,EAAE;AACV,gBAAA,MAAM,IAAI,KAAK,CAAC,SAAS,IAAI,CAAA,iCAAA,CAAmC,CAAC;;AAEnE,YAAA,OAAO,kBAAkB,CAAC,KAAK,EAAE,IAAI,CAAC;;QAExC,KAAK,KAAK,EAAE;YACV,OAAO,kBAAkB,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC;;AAEjD,QAAA;AACE,YAAA,OAAO,SAAS;;AAEtB;;AC1BA;;AAEG;;;;"}
1
+ {"version":3,"file":"kaskad-types.mjs","sources":["../../../../libs/types/src/lib/computation-schema.ts","../../../../libs/types/src/lib/util/find-child-value-type.ts","../../../../libs/types/src/kaskad-types.ts"],"sourcesContent":["import { ComponentRef } from './branded';\nimport { ComponentSchemaNodeSchema, NodeSchema } from './node-schema';\nimport { ValueType } from './value-type';\n\nexport interface ComputationSchema {\n readonly computationType: string;\n}\n\nexport interface TemplateComputationSchema extends ComputationSchema {\n readonly computationType: 'template';\n readonly path: string;\n readonly ref?: ComponentRef;\n readonly defer: {\n placeholder: NodeSchema;\n error: NodeSchema;\n } | null;\n readonly contractVariables: Record<string, unknown>;\n}\n\nexport interface FormulaComputationSchema extends ComputationSchema {\n readonly computationType: 'formula';\n readonly formula: string;\n}\n\nexport interface IfComputationSchema extends ComputationSchema {\n readonly computationType: 'if';\n readonly if: NodeSchema;\n readonly then: NodeSchema;\n readonly else: NodeSchema;\n}\n\nexport interface DimensionSchema {\n items: NodeSchema;\n itemsType: ValueType;\n item: NodeSchema;\n index: NodeSchema;\n first: NodeSchema;\n last: NodeSchema;\n trackBy: NodeSchema;\n}\n\nexport interface ForComputationSchema extends ComputationSchema {\n readonly computationType: 'for';\n readonly dimensions: DimensionSchema[];\n readonly yield: NodeSchema;\n}\n\nexport interface SwitchComputationSchema extends ComputationSchema {\n readonly computationType: 'switch';\n readonly source: NodeSchema;\n readonly cases: { equals: unknown; then: ComponentSchemaNodeSchema }[];\n readonly default: ComponentSchemaNodeSchema;\n}\n\nexport interface AwaitComputationSchema extends ComputationSchema {\n readonly computationType: 'await';\n readonly source: string;\n readonly pending: NodeSchema;\n readonly then: NodeSchema;\n readonly error: NodeSchema;\n}\n\n// Type guards for built-in computation schemas\nexport function isFormulaComputation(schema: ComputationSchema): schema is FormulaComputationSchema {\n return schema.computationType === 'formula';\n}\n\nexport function isIfComputation(schema: ComputationSchema): schema is IfComputationSchema {\n return schema.computationType === 'if';\n}\n\nexport function isForComputation(schema: ComputationSchema): schema is ForComputationSchema {\n return schema.computationType === 'for';\n}\n\nexport function isTemplateComputation(schema: ComputationSchema): schema is TemplateComputationSchema {\n return schema.computationType === 'template';\n}\n\nexport function isSwitchComputation(schema: ComputationSchema): schema is SwitchComputationSchema {\n return schema.computationType === 'switch';\n}\n\nexport function isAwaitComputation(schema: ComputationSchema): schema is AwaitComputationSchema {\n return schema.computationType === 'await';\n}\n","import { ValueType } from '../value-type';\n\nexport function findChildValueType(valueType: ValueType, path: string[]): ValueType {\n if (!path.length) {\n return valueType;\n }\n\n const [head, ...tail] = path;\n\n switch (valueType.type) {\n case 'array': {\n return findChildValueType(valueType.item, tail);\n }\n case 'object': {\n const found = valueType.fields[head];\n if (!found) {\n throw new Error(`Field ${head} not found in object description.`);\n }\n return findChildValueType(found, tail);\n }\n case 'map': {\n return findChildValueType(valueType.item, tail);\n }\n default:\n return valueType;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"AA8DA;AACM,SAAU,oBAAoB,CAAC,MAAyB,EAAA;AAC5D,IAAA,OAAO,MAAM,CAAC,eAAe,KAAK,SAAS;AAC7C;AAEM,SAAU,eAAe,CAAC,MAAyB,EAAA;AACvD,IAAA,OAAO,MAAM,CAAC,eAAe,KAAK,IAAI;AACxC;AAEM,SAAU,gBAAgB,CAAC,MAAyB,EAAA;AACxD,IAAA,OAAO,MAAM,CAAC,eAAe,KAAK,KAAK;AACzC;AAEM,SAAU,qBAAqB,CAAC,MAAyB,EAAA;AAC7D,IAAA,OAAO,MAAM,CAAC,eAAe,KAAK,UAAU;AAC9C;AAEM,SAAU,mBAAmB,CAAC,MAAyB,EAAA;AAC3D,IAAA,OAAO,MAAM,CAAC,eAAe,KAAK,QAAQ;AAC5C;AAEM,SAAU,kBAAkB,CAAC,MAAyB,EAAA;AAC1D,IAAA,OAAO,MAAM,CAAC,eAAe,KAAK,OAAO;AAC3C;;ACnFM,SAAU,kBAAkB,CAAC,SAAoB,EAAE,IAAc,EAAA;AACrE,IAAA,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;AAChB,QAAA,OAAO,SAAS;;IAGlB,MAAM,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI;AAE5B,IAAA,QAAQ,SAAS,CAAC,IAAI;QACpB,KAAK,OAAO,EAAE;YACZ,OAAO,kBAAkB,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC;;QAEjD,KAAK,QAAQ,EAAE;YACb,MAAM,KAAK,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC;YACpC,IAAI,CAAC,KAAK,EAAE;AACV,gBAAA,MAAM,IAAI,KAAK,CAAC,SAAS,IAAI,CAAA,iCAAA,CAAmC,CAAC;;AAEnE,YAAA,OAAO,kBAAkB,CAAC,KAAK,EAAE,IAAI,CAAC;;QAExC,KAAK,KAAK,EAAE;YACV,OAAO,kBAAkB,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC;;AAEjD,QAAA;AACE,YAAA,OAAO,SAAS;;AAEtB;;AC1BA;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaskad/types",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "peerDependencies": {
5
5
  "@angular/core": "^21.0.0"
6
6
  },
@@ -194,11 +194,19 @@ interface SwitchComputationSchema extends ComputationSchema {
194
194
  }[];
195
195
  readonly default: ComponentSchemaNodeSchema;
196
196
  }
197
+ interface AwaitComputationSchema extends ComputationSchema {
198
+ readonly computationType: 'await';
199
+ readonly source: string;
200
+ readonly pending: NodeSchema;
201
+ readonly then: NodeSchema;
202
+ readonly error: NodeSchema;
203
+ }
197
204
  declare function isFormulaComputation(schema: ComputationSchema): schema is FormulaComputationSchema;
198
205
  declare function isIfComputation(schema: ComputationSchema): schema is IfComputationSchema;
199
206
  declare function isForComputation(schema: ComputationSchema): schema is ForComputationSchema;
200
207
  declare function isTemplateComputation(schema: ComputationSchema): schema is TemplateComputationSchema;
201
208
  declare function isSwitchComputation(schema: ComputationSchema): schema is SwitchComputationSchema;
209
+ declare function isAwaitComputation(schema: ComputationSchema): schema is AwaitComputationSchema;
202
210
 
203
211
  type NodePathSegment = string | number;
204
212
  type NodePath = NodePathSegment[];
@@ -209,5 +217,5 @@ interface NodePosition {
209
217
 
210
218
  declare function findChildValueType(valueType: ValueType, path: string[]): ValueType;
211
219
 
212
- export { findChildValueType, isForComputation, isFormulaComputation, isIfComputation, isSwitchComputation, isTemplateComputation };
213
- export type { AnyFn, ArrayBindingSchema, ArrayNodeSchema, ArrayValueType, BindingSchema, BindingType, BooleanNodeSchema, BooleanValueType, CommandNodeSchema, CommandValue, CommandValueType, ComponentId, ComponentNodeInlineValue, ComponentNodeSchema, ComponentNodeValue, ComponentRef, ComponentSchemaNodeSchema, ComponentSchemaValueType, ComponentValueType, ComputationSchema, DimensionSchema, ForComputationSchema, FormulaComputationSchema, IfComputationSchema, LeafNodeSchema, MapNodeSchema, MapValueType, MirrorBindingSchema, NodeChangeHandlerSchema, NodePath, NodePathSegment, NodePosition, NodeSchema, NodeSchemaBase, NodeType, NumberNodeSchema, NumberValueType, ObjectBindingSchema, ObjectNodeSchema, ObjectValueType, RefSpaceId, SelectionBindingSchema, SetNodeSchema, SetValueType, ShapeNodeSchema, ShapeValue, ShapeValueType, StringNodeSchema, StringValueType, SwitchComputationSchema, TemplateComputationSchema, UnknownNodeSchema, UnknownValueType, ValueType, VariantShapeNodeSchema, VariantShapeValue, VariantShapeValueType };
220
+ export { findChildValueType, isAwaitComputation, isForComputation, isFormulaComputation, isIfComputation, isSwitchComputation, isTemplateComputation };
221
+ export type { AnyFn, ArrayBindingSchema, ArrayNodeSchema, ArrayValueType, AwaitComputationSchema, BindingSchema, BindingType, BooleanNodeSchema, BooleanValueType, CommandNodeSchema, CommandValue, CommandValueType, ComponentId, ComponentNodeInlineValue, ComponentNodeSchema, ComponentNodeValue, ComponentRef, ComponentSchemaNodeSchema, ComponentSchemaValueType, ComponentValueType, ComputationSchema, DimensionSchema, ForComputationSchema, FormulaComputationSchema, IfComputationSchema, LeafNodeSchema, MapNodeSchema, MapValueType, MirrorBindingSchema, NodeChangeHandlerSchema, NodePath, NodePathSegment, NodePosition, NodeSchema, NodeSchemaBase, NodeType, NumberNodeSchema, NumberValueType, ObjectBindingSchema, ObjectNodeSchema, ObjectValueType, RefSpaceId, SelectionBindingSchema, SetNodeSchema, SetValueType, ShapeNodeSchema, ShapeValue, ShapeValueType, StringNodeSchema, StringValueType, SwitchComputationSchema, TemplateComputationSchema, UnknownNodeSchema, UnknownValueType, ValueType, VariantShapeNodeSchema, VariantShapeValue, VariantShapeValueType };