@timeax/digital-service-engine 0.3.5 → 0.3.6
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/core/index.cjs +659 -162
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +48 -6
- package/dist/core/index.d.ts +48 -6
- package/dist/core/index.js +650 -161
- package/dist/core/index.js.map +1 -1
- package/dist/react/index.cjs +1424 -448
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +48 -5
- package/dist/react/index.d.ts +48 -5
- package/dist/react/index.js +1424 -448
- package/dist/react/index.js.map +1 -1
- package/dist/schema/index.d.cts +19 -2
- package/dist/schema/index.d.ts +19 -2
- package/dist/workspace/index.cjs +1235 -374
- package/dist/workspace/index.cjs.map +1 -1
- package/dist/workspace/index.d.cts +45 -4
- package/dist/workspace/index.d.ts +45 -4
- package/dist/workspace/index.js +1235 -374
- package/dist/workspace/index.js.map +1 -1
- package/package.json +1 -1
- package/schema/editor-snapshot.schema.json +38 -0
- package/schema/service-props.schema.json +38 -0
|
@@ -59,7 +59,7 @@ type NodeRef$1 = {
|
|
|
59
59
|
};
|
|
60
60
|
type NodeMap = Map<string, NodeRef$1>;
|
|
61
61
|
|
|
62
|
-
type ValidationCode = "root_missing" | "cycle_in_tags" | "bad_bind_reference" | "duplicate_id" | "duplicate_tag_label" | "duplicate_field_name" | "label_missing" | "duplicate_visible_label" | "bad_option_key" | "option_include_exclude_conflict" | "service_field_missing_service_id" | "user_input_field_has_service_option" | "rate_mismatch_across_base" | "rate_coherence_violation" | "utility_without_base" | "unsupported_constraint" | "constraint_contradiction" | "custom_component_missing" | "policy_violation" | "field_unbound" | "constraint_overridden" | "unsupported_constraint_option" | "custom_component_unresolvable" | "quantity_multiple_markers" | "utility_with_service_id" | "utility_missing_rate" | "utility_invalid_mode" | "fallback_bad_node" | "fallback_unknown_service" | "fallback_cycle" | "fallback_no_primary" | "fallback_rate_violation" | "fallback_constraint_mismatch" | "fallback_no_tag_context" | "field_validation_invalid_rule" | "field_validation_invalid_op" | "field_validation_eval_missing_code" | "field_validation_between_missing_bounds" | "field_validation_match_missing_pattern" | "multiple_order_kinds_selected";
|
|
62
|
+
type ValidationCode = "root_missing" | "cycle_in_tags" | "bad_bind_reference" | "duplicate_id" | "duplicate_tag_label" | "duplicate_field_name" | "label_missing" | "duplicate_visible_label" | "bad_option_key" | "bad_option_effect_key" | "bad_option_effect_target" | "bad_option_effect_option" | "option_include_exclude_conflict" | "visibility_dependency_cycle" | "service_field_missing_service_id" | "user_input_field_has_service_option" | "rate_mismatch_across_base" | "rate_coherence_violation" | "utility_without_base" | "unsupported_constraint" | "constraint_contradiction" | "custom_component_missing" | "policy_violation" | "field_unbound" | "constraint_overridden" | "unsupported_constraint_option" | "custom_component_unresolvable" | "quantity_multiple_markers" | "utility_with_service_id" | "utility_missing_rate" | "utility_invalid_mode" | "fallback_bad_node" | "fallback_unknown_service" | "fallback_cycle" | "fallback_no_primary" | "fallback_rate_violation" | "fallback_constraint_mismatch" | "fallback_no_tag_context" | "field_validation_invalid_rule" | "field_validation_invalid_op" | "field_validation_eval_missing_code" | "field_validation_between_missing_bounds" | "field_validation_match_missing_pattern" | "multiple_order_kinds_selected";
|
|
63
63
|
type ValidationError = {
|
|
64
64
|
code: ValidationCode;
|
|
65
65
|
message: string;
|
|
@@ -276,6 +276,22 @@ type FieldOption = {
|
|
|
276
276
|
service_id?: ServiceIdRef;
|
|
277
277
|
pricing_role?: PricingRole;
|
|
278
278
|
meta?: Record<string, unknown> & UtilityMark & WithQuantityDefault;
|
|
279
|
+
children?: FieldOption[];
|
|
280
|
+
};
|
|
281
|
+
type OptionEffectForButton = {
|
|
282
|
+
/**
|
|
283
|
+
* If true, selecting this button/option may force the target field visible.
|
|
284
|
+
* If false/missing, the option filter only applies when the target field is already visible.
|
|
285
|
+
*/
|
|
286
|
+
forceVisible?: boolean;
|
|
287
|
+
/**
|
|
288
|
+
* If present, only these option ids remain visible.
|
|
289
|
+
*/
|
|
290
|
+
include?: string[];
|
|
291
|
+
/**
|
|
292
|
+
* Removed after include is applied.
|
|
293
|
+
*/
|
|
294
|
+
exclude?: string[];
|
|
279
295
|
};
|
|
280
296
|
type Field = BaseFieldUI & {
|
|
281
297
|
id: string;
|
|
@@ -329,6 +345,7 @@ type ServiceProps = {
|
|
|
329
345
|
fields: Field[];
|
|
330
346
|
includes_for_buttons?: Record<string, string[]>;
|
|
331
347
|
excludes_for_buttons?: Record<string, string[]>;
|
|
348
|
+
option_effects_for_buttons?: Record<string, Record<string, OptionEffectForButton>>;
|
|
332
349
|
schema_version?: string;
|
|
333
350
|
fallbacks?: ServiceFallback;
|
|
334
351
|
name?: string;
|
|
@@ -424,6 +441,12 @@ type CommentThread = {
|
|
|
424
441
|
_sync?: "pending" | "synced" | "error";
|
|
425
442
|
};
|
|
426
443
|
|
|
444
|
+
type ResolvedVisibility = {
|
|
445
|
+
fieldIds: string[];
|
|
446
|
+
optionsByFieldId: Record<string, string[]>;
|
|
447
|
+
forcedFieldIds: string[];
|
|
448
|
+
};
|
|
449
|
+
|
|
427
450
|
/** Options you can set on the builder (used for validation/visibility) */
|
|
428
451
|
type BuilderOptions = Omit<ValidatorOptions, "serviceMap"> & {
|
|
429
452
|
serviceMap?: DgpServiceMap;
|
|
@@ -449,6 +472,8 @@ interface Builder {
|
|
|
449
472
|
* NOTE: keys are “button ids”: either option.id or field.id for option-less buttons.
|
|
450
473
|
*/
|
|
451
474
|
visibleFields(tagId: string, selectedOptionKeys?: string[]): string[];
|
|
475
|
+
/** Compute field ids plus option visibility under a tag. */
|
|
476
|
+
resolveVisibility(tagId: string, selectedOptionKeys?: string[]): ResolvedVisibility;
|
|
452
477
|
/** Update builder options (validator context etc.) */
|
|
453
478
|
setOptions(patch: Partial<BuilderOptions>): void;
|
|
454
479
|
/** Access the current props (already normalised) */
|
|
@@ -570,6 +595,8 @@ type VisibleGroup = {
|
|
|
570
595
|
tag?: Tag;
|
|
571
596
|
fields: Field[];
|
|
572
597
|
fieldIds: string[];
|
|
598
|
+
optionsByFieldId?: Record<string, string[]>;
|
|
599
|
+
forcedFieldIds?: string[];
|
|
573
600
|
parentTags?: Tag[];
|
|
574
601
|
childrenTags?: Tag[];
|
|
575
602
|
/** In order of selection: tag base (unless overridden) then selected options */
|
|
@@ -619,11 +646,10 @@ declare class Selection {
|
|
|
619
646
|
* What counts as a "button selection" (trigger key):
|
|
620
647
|
* - field key where the field has button === true (e.g. "f:dripfeed")
|
|
621
648
|
* - option key (e.g. "o:fast")
|
|
622
|
-
* - composite key "fieldId::optionId" (e.g. "f:speed::o:fast")
|
|
623
649
|
*
|
|
624
650
|
* Grouping:
|
|
625
651
|
* - button-field trigger groups under its own fieldId
|
|
626
|
-
* - option
|
|
652
|
+
* - option trigger groups under the option's owning fieldId (from nodeMap)
|
|
627
653
|
*
|
|
628
654
|
* Deterministic:
|
|
629
655
|
* - preserves selection insertion order
|
|
@@ -634,7 +660,6 @@ declare class Selection {
|
|
|
634
660
|
* Returns only selection keys that are valid "trigger buttons":
|
|
635
661
|
* - field keys where field.button === true
|
|
636
662
|
* - option keys
|
|
637
|
-
* - composite keys "fieldId::optionId" (validated by optionId)
|
|
638
663
|
* Excludes tags and non-button fields.
|
|
639
664
|
*/
|
|
640
665
|
selectedButtons(): string[];
|
|
@@ -644,6 +669,7 @@ declare class Selection {
|
|
|
644
669
|
private computeGroupForTag;
|
|
645
670
|
private addServiceByRole;
|
|
646
671
|
private findOptionById;
|
|
672
|
+
private isSelectedOptionVisible;
|
|
647
673
|
}
|
|
648
674
|
|
|
649
675
|
type CatalogId = string;
|
|
@@ -1781,11 +1807,18 @@ type Adapter = {
|
|
|
1781
1807
|
getInputPropsFromField?: (props: AdapterCtx) => any;
|
|
1782
1808
|
toValue?: (value: any) => any;
|
|
1783
1809
|
};
|
|
1810
|
+
type InputChildOptionCapability = {
|
|
1811
|
+
supported?: boolean;
|
|
1812
|
+
autoCreate?: boolean;
|
|
1813
|
+
defaultLabel?: string;
|
|
1814
|
+
defaultValue?: string | number;
|
|
1815
|
+
};
|
|
1784
1816
|
type InputOptionCapability = {
|
|
1785
1817
|
supported?: boolean;
|
|
1786
1818
|
autoCreate?: boolean;
|
|
1787
1819
|
defaultLabel?: string;
|
|
1788
1820
|
defaultValue?: string | number;
|
|
1821
|
+
children?: InputChildOptionCapability;
|
|
1789
1822
|
};
|
|
1790
1823
|
type InputMultiCapability = {
|
|
1791
1824
|
supported?: boolean;
|
|
@@ -1926,6 +1959,14 @@ declare class Editor {
|
|
|
1926
1959
|
clearFieldQuantityRule(id: string): void;
|
|
1927
1960
|
include(receiverId: string, idOrIds: string | string[]): void;
|
|
1928
1961
|
exclude(receiverId: string, idOrIds: string | string[]): void;
|
|
1962
|
+
setOptionEffect(triggerId: string, targetFieldId: string, effect: OptionEffectForButton | undefined | null): void;
|
|
1963
|
+
patchOptionEffect(triggerId: string, targetFieldId: string, patch: OptionEffectForButton): void;
|
|
1964
|
+
clearOptionEffect(triggerId: string, targetFieldId: string): void;
|
|
1965
|
+
clearOptionEffectsForTrigger(triggerId: string): void;
|
|
1966
|
+
clearOptionEffectsForTarget(targetFieldId: string): void;
|
|
1967
|
+
addOptionEffectOptions(triggerId: string, targetFieldId: string, kind: "include" | "exclude", optionIds: readonly string[]): void;
|
|
1968
|
+
removeOptionEffectOptions(triggerId: string, targetFieldId: string, kind: "include" | "exclude", optionIds: readonly string[]): void;
|
|
1969
|
+
setOptionEffectForceVisible(triggerId: string, targetFieldId: string, forceVisible: boolean | undefined): void;
|
|
1929
1970
|
connect(kind: WireKind, fromId: string, toId: string): void;
|
|
1930
1971
|
disconnect(kind: WireKind, fromId: string, toId: string): void;
|
|
1931
1972
|
setConstraint(tagId: string, flag: string, value: boolean | undefined): void;
|
|
@@ -59,7 +59,7 @@ type NodeRef$1 = {
|
|
|
59
59
|
};
|
|
60
60
|
type NodeMap = Map<string, NodeRef$1>;
|
|
61
61
|
|
|
62
|
-
type ValidationCode = "root_missing" | "cycle_in_tags" | "bad_bind_reference" | "duplicate_id" | "duplicate_tag_label" | "duplicate_field_name" | "label_missing" | "duplicate_visible_label" | "bad_option_key" | "option_include_exclude_conflict" | "service_field_missing_service_id" | "user_input_field_has_service_option" | "rate_mismatch_across_base" | "rate_coherence_violation" | "utility_without_base" | "unsupported_constraint" | "constraint_contradiction" | "custom_component_missing" | "policy_violation" | "field_unbound" | "constraint_overridden" | "unsupported_constraint_option" | "custom_component_unresolvable" | "quantity_multiple_markers" | "utility_with_service_id" | "utility_missing_rate" | "utility_invalid_mode" | "fallback_bad_node" | "fallback_unknown_service" | "fallback_cycle" | "fallback_no_primary" | "fallback_rate_violation" | "fallback_constraint_mismatch" | "fallback_no_tag_context" | "field_validation_invalid_rule" | "field_validation_invalid_op" | "field_validation_eval_missing_code" | "field_validation_between_missing_bounds" | "field_validation_match_missing_pattern" | "multiple_order_kinds_selected";
|
|
62
|
+
type ValidationCode = "root_missing" | "cycle_in_tags" | "bad_bind_reference" | "duplicate_id" | "duplicate_tag_label" | "duplicate_field_name" | "label_missing" | "duplicate_visible_label" | "bad_option_key" | "bad_option_effect_key" | "bad_option_effect_target" | "bad_option_effect_option" | "option_include_exclude_conflict" | "visibility_dependency_cycle" | "service_field_missing_service_id" | "user_input_field_has_service_option" | "rate_mismatch_across_base" | "rate_coherence_violation" | "utility_without_base" | "unsupported_constraint" | "constraint_contradiction" | "custom_component_missing" | "policy_violation" | "field_unbound" | "constraint_overridden" | "unsupported_constraint_option" | "custom_component_unresolvable" | "quantity_multiple_markers" | "utility_with_service_id" | "utility_missing_rate" | "utility_invalid_mode" | "fallback_bad_node" | "fallback_unknown_service" | "fallback_cycle" | "fallback_no_primary" | "fallback_rate_violation" | "fallback_constraint_mismatch" | "fallback_no_tag_context" | "field_validation_invalid_rule" | "field_validation_invalid_op" | "field_validation_eval_missing_code" | "field_validation_between_missing_bounds" | "field_validation_match_missing_pattern" | "multiple_order_kinds_selected";
|
|
63
63
|
type ValidationError = {
|
|
64
64
|
code: ValidationCode;
|
|
65
65
|
message: string;
|
|
@@ -276,6 +276,22 @@ type FieldOption = {
|
|
|
276
276
|
service_id?: ServiceIdRef;
|
|
277
277
|
pricing_role?: PricingRole;
|
|
278
278
|
meta?: Record<string, unknown> & UtilityMark & WithQuantityDefault;
|
|
279
|
+
children?: FieldOption[];
|
|
280
|
+
};
|
|
281
|
+
type OptionEffectForButton = {
|
|
282
|
+
/**
|
|
283
|
+
* If true, selecting this button/option may force the target field visible.
|
|
284
|
+
* If false/missing, the option filter only applies when the target field is already visible.
|
|
285
|
+
*/
|
|
286
|
+
forceVisible?: boolean;
|
|
287
|
+
/**
|
|
288
|
+
* If present, only these option ids remain visible.
|
|
289
|
+
*/
|
|
290
|
+
include?: string[];
|
|
291
|
+
/**
|
|
292
|
+
* Removed after include is applied.
|
|
293
|
+
*/
|
|
294
|
+
exclude?: string[];
|
|
279
295
|
};
|
|
280
296
|
type Field = BaseFieldUI & {
|
|
281
297
|
id: string;
|
|
@@ -329,6 +345,7 @@ type ServiceProps = {
|
|
|
329
345
|
fields: Field[];
|
|
330
346
|
includes_for_buttons?: Record<string, string[]>;
|
|
331
347
|
excludes_for_buttons?: Record<string, string[]>;
|
|
348
|
+
option_effects_for_buttons?: Record<string, Record<string, OptionEffectForButton>>;
|
|
332
349
|
schema_version?: string;
|
|
333
350
|
fallbacks?: ServiceFallback;
|
|
334
351
|
name?: string;
|
|
@@ -424,6 +441,12 @@ type CommentThread = {
|
|
|
424
441
|
_sync?: "pending" | "synced" | "error";
|
|
425
442
|
};
|
|
426
443
|
|
|
444
|
+
type ResolvedVisibility = {
|
|
445
|
+
fieldIds: string[];
|
|
446
|
+
optionsByFieldId: Record<string, string[]>;
|
|
447
|
+
forcedFieldIds: string[];
|
|
448
|
+
};
|
|
449
|
+
|
|
427
450
|
/** Options you can set on the builder (used for validation/visibility) */
|
|
428
451
|
type BuilderOptions = Omit<ValidatorOptions, "serviceMap"> & {
|
|
429
452
|
serviceMap?: DgpServiceMap;
|
|
@@ -449,6 +472,8 @@ interface Builder {
|
|
|
449
472
|
* NOTE: keys are “button ids”: either option.id or field.id for option-less buttons.
|
|
450
473
|
*/
|
|
451
474
|
visibleFields(tagId: string, selectedOptionKeys?: string[]): string[];
|
|
475
|
+
/** Compute field ids plus option visibility under a tag. */
|
|
476
|
+
resolveVisibility(tagId: string, selectedOptionKeys?: string[]): ResolvedVisibility;
|
|
452
477
|
/** Update builder options (validator context etc.) */
|
|
453
478
|
setOptions(patch: Partial<BuilderOptions>): void;
|
|
454
479
|
/** Access the current props (already normalised) */
|
|
@@ -570,6 +595,8 @@ type VisibleGroup = {
|
|
|
570
595
|
tag?: Tag;
|
|
571
596
|
fields: Field[];
|
|
572
597
|
fieldIds: string[];
|
|
598
|
+
optionsByFieldId?: Record<string, string[]>;
|
|
599
|
+
forcedFieldIds?: string[];
|
|
573
600
|
parentTags?: Tag[];
|
|
574
601
|
childrenTags?: Tag[];
|
|
575
602
|
/** In order of selection: tag base (unless overridden) then selected options */
|
|
@@ -619,11 +646,10 @@ declare class Selection {
|
|
|
619
646
|
* What counts as a "button selection" (trigger key):
|
|
620
647
|
* - field key where the field has button === true (e.g. "f:dripfeed")
|
|
621
648
|
* - option key (e.g. "o:fast")
|
|
622
|
-
* - composite key "fieldId::optionId" (e.g. "f:speed::o:fast")
|
|
623
649
|
*
|
|
624
650
|
* Grouping:
|
|
625
651
|
* - button-field trigger groups under its own fieldId
|
|
626
|
-
* - option
|
|
652
|
+
* - option trigger groups under the option's owning fieldId (from nodeMap)
|
|
627
653
|
*
|
|
628
654
|
* Deterministic:
|
|
629
655
|
* - preserves selection insertion order
|
|
@@ -634,7 +660,6 @@ declare class Selection {
|
|
|
634
660
|
* Returns only selection keys that are valid "trigger buttons":
|
|
635
661
|
* - field keys where field.button === true
|
|
636
662
|
* - option keys
|
|
637
|
-
* - composite keys "fieldId::optionId" (validated by optionId)
|
|
638
663
|
* Excludes tags and non-button fields.
|
|
639
664
|
*/
|
|
640
665
|
selectedButtons(): string[];
|
|
@@ -644,6 +669,7 @@ declare class Selection {
|
|
|
644
669
|
private computeGroupForTag;
|
|
645
670
|
private addServiceByRole;
|
|
646
671
|
private findOptionById;
|
|
672
|
+
private isSelectedOptionVisible;
|
|
647
673
|
}
|
|
648
674
|
|
|
649
675
|
type CatalogId = string;
|
|
@@ -1781,11 +1807,18 @@ type Adapter = {
|
|
|
1781
1807
|
getInputPropsFromField?: (props: AdapterCtx) => any;
|
|
1782
1808
|
toValue?: (value: any) => any;
|
|
1783
1809
|
};
|
|
1810
|
+
type InputChildOptionCapability = {
|
|
1811
|
+
supported?: boolean;
|
|
1812
|
+
autoCreate?: boolean;
|
|
1813
|
+
defaultLabel?: string;
|
|
1814
|
+
defaultValue?: string | number;
|
|
1815
|
+
};
|
|
1784
1816
|
type InputOptionCapability = {
|
|
1785
1817
|
supported?: boolean;
|
|
1786
1818
|
autoCreate?: boolean;
|
|
1787
1819
|
defaultLabel?: string;
|
|
1788
1820
|
defaultValue?: string | number;
|
|
1821
|
+
children?: InputChildOptionCapability;
|
|
1789
1822
|
};
|
|
1790
1823
|
type InputMultiCapability = {
|
|
1791
1824
|
supported?: boolean;
|
|
@@ -1926,6 +1959,14 @@ declare class Editor {
|
|
|
1926
1959
|
clearFieldQuantityRule(id: string): void;
|
|
1927
1960
|
include(receiverId: string, idOrIds: string | string[]): void;
|
|
1928
1961
|
exclude(receiverId: string, idOrIds: string | string[]): void;
|
|
1962
|
+
setOptionEffect(triggerId: string, targetFieldId: string, effect: OptionEffectForButton | undefined | null): void;
|
|
1963
|
+
patchOptionEffect(triggerId: string, targetFieldId: string, patch: OptionEffectForButton): void;
|
|
1964
|
+
clearOptionEffect(triggerId: string, targetFieldId: string): void;
|
|
1965
|
+
clearOptionEffectsForTrigger(triggerId: string): void;
|
|
1966
|
+
clearOptionEffectsForTarget(targetFieldId: string): void;
|
|
1967
|
+
addOptionEffectOptions(triggerId: string, targetFieldId: string, kind: "include" | "exclude", optionIds: readonly string[]): void;
|
|
1968
|
+
removeOptionEffectOptions(triggerId: string, targetFieldId: string, kind: "include" | "exclude", optionIds: readonly string[]): void;
|
|
1969
|
+
setOptionEffectForceVisible(triggerId: string, targetFieldId: string, forceVisible: boolean | undefined): void;
|
|
1929
1970
|
connect(kind: WireKind, fromId: string, toId: string): void;
|
|
1930
1971
|
disconnect(kind: WireKind, fromId: string, toId: string): void;
|
|
1931
1972
|
setConstraint(tagId: string, flag: string, value: boolean | undefined): void;
|