@timeax/digital-service-engine 0.2.0 → 0.2.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.
@@ -222,6 +222,11 @@ type ValidatorOptions = {
222
222
  selectedOptionKeys?: string[];
223
223
  globalUtilityGuard?: boolean;
224
224
  policies?: DynamicRule[];
225
+ /**
226
+ * Global/base rate policy used by validation and service filtering.
227
+ * This is intentionally separate from fallbackSettings.ratePolicy.
228
+ */
229
+ ratePolicy?: RatePolicy;
225
230
  fallbackSettings?: FallbackSettings;
226
231
  };
227
232
  type RatePolicy = {
@@ -256,6 +261,7 @@ type ServiceFallback = {
256
261
  };
257
262
  type FallbackEditorServiceMap = DgpServiceMap;
258
263
  type FallbackRegistrationScope = "global" | "node";
264
+ type FallbackEligibleSource = "all_services" | "registered";
259
265
  type FallbackScopeRef = {
260
266
  scope: "global";
261
267
  primary: ServiceIdRef;
@@ -553,6 +559,7 @@ interface Builder {
553
559
  getProps(): ServiceProps;
554
560
  /** Service map for validation/rules */
555
561
  getServiceMap(): DgpServiceMap;
562
+ getOptions(): BuilderOptions;
556
563
  getConstraints(): {
557
564
  id: string;
558
565
  label: string;
@@ -585,16 +592,6 @@ declare function resolveServiceFallback(params: {
585
592
  props: ServiceProps;
586
593
  }): ServiceIdRef | null;
587
594
  declare function collectFailedFallbacks(props: ServiceProps, services: DgpServiceMap, settings?: FallbackSettings): FailedFallbackContext[];
588
- /**
589
- * Return all fallback candidates that are eligible for the given primary,
590
- * respecting:
591
- * - node-scoped list first (if nodeId provided), then global list for `primary`
592
- * - rate policy vs. primary
593
- * - (optional) tag constraint fit, only when tagId is provided and requireConstraintFit=true
594
- * - excludes (including primary automatically)
595
- * - selectionStrategy: 'priority' keeps list order, 'cheapest' sorts by rate asc
596
- * - unique (dedupe) and optional limit
597
- */
598
595
  declare function getEligibleFallbacks(params: {
599
596
  primary: ServiceIdRef;
600
597
  nodeId?: NodeIdRef;
@@ -606,6 +603,11 @@ declare function getEligibleFallbacks(params: {
606
603
  exclude?: Array<ServiceIdRef>;
607
604
  unique?: boolean;
608
605
  limit?: number;
606
+ source?: FallbackEligibleSource;
607
+ }): ServiceIdRef[];
608
+ declare function getAssignedServiceIds(params: {
609
+ props?: ServiceProps;
610
+ snapshot?: OrderSnapshot;
609
611
  }): ServiceIdRef[];
610
612
  declare function getFallbackRegistrationInfo(props: ServiceProps, nodeId: NodeIdRef): {
611
613
  primary?: ServiceIdRef;
@@ -763,6 +765,9 @@ type FilterServicesForVisibleGroupInput = {
763
765
  usedServiceIds: ServiceIdRef[];
764
766
  effectiveConstraints?: Partial<Record<"refill" | "cancel" | "dripfeed", boolean>>;
765
767
  policies?: unknown;
768
+ ratePolicy?: RatePolicy;
769
+ fallbackSettings?: FallbackSettings;
770
+ /** Backward-compatible alias for fallbackSettings */
766
771
  fallback?: FallbackSettings;
767
772
  strictSafety?: boolean;
768
773
  enforcePolicies?: boolean;
@@ -833,8 +838,9 @@ interface FallbackEditor {
833
838
  exclude?: ServiceIdRef[];
834
839
  unique?: boolean;
835
840
  limit?: number;
841
+ source?: FallbackEligibleSource;
836
842
  }): ServiceIdRef[];
837
843
  }
838
844
  declare function createFallbackEditor(options?: FallbackEditorOptions): FallbackEditor;
839
845
 
840
- export { type AncestryHit, type AnyNode, type Builder, type BuilderOptions, type FailedFallbackContext, type FallbackEditor, type FieldNode, type FilterServicesForVisibleGroupInput, type FilterServicesForVisibleGroupResult, type NodeIndex, type NodeKind, type NormaliseOptions, type OptionNode, type RateCoherenceDiagnostic, type RelKind, type ServiceCheck, type TagNode, type UnknownNode, type WithAncestry, buildOrderSnapshot, collectFailedFallbacks, createBuilder, createFallbackEditor, createNodeIndex, filterServicesForVisibleGroup, getEligibleFallbacks, getFallbackRegistrationInfo, normalise, normalizeFieldValidation, resolveServiceFallback, validate, validateAsync, validateRateCoherenceDeep };
846
+ export { type AncestryHit, type AnyNode, type Builder, type BuilderOptions, type FailedFallbackContext, type FallbackEditor, type FieldNode, type FilterServicesForVisibleGroupInput, type FilterServicesForVisibleGroupResult, type NodeIndex, type NodeKind, type NormaliseOptions, type OptionNode, type RateCoherenceDiagnostic, type RelKind, type ServiceCheck, type TagNode, type UnknownNode, type WithAncestry, buildOrderSnapshot, collectFailedFallbacks, createBuilder, createFallbackEditor, createNodeIndex, filterServicesForVisibleGroup, getAssignedServiceIds, getEligibleFallbacks, getFallbackRegistrationInfo, normalise, normalizeFieldValidation, resolveServiceFallback, validate, validateAsync, validateRateCoherenceDeep };
@@ -222,6 +222,11 @@ type ValidatorOptions = {
222
222
  selectedOptionKeys?: string[];
223
223
  globalUtilityGuard?: boolean;
224
224
  policies?: DynamicRule[];
225
+ /**
226
+ * Global/base rate policy used by validation and service filtering.
227
+ * This is intentionally separate from fallbackSettings.ratePolicy.
228
+ */
229
+ ratePolicy?: RatePolicy;
225
230
  fallbackSettings?: FallbackSettings;
226
231
  };
227
232
  type RatePolicy = {
@@ -256,6 +261,7 @@ type ServiceFallback = {
256
261
  };
257
262
  type FallbackEditorServiceMap = DgpServiceMap;
258
263
  type FallbackRegistrationScope = "global" | "node";
264
+ type FallbackEligibleSource = "all_services" | "registered";
259
265
  type FallbackScopeRef = {
260
266
  scope: "global";
261
267
  primary: ServiceIdRef;
@@ -553,6 +559,7 @@ interface Builder {
553
559
  getProps(): ServiceProps;
554
560
  /** Service map for validation/rules */
555
561
  getServiceMap(): DgpServiceMap;
562
+ getOptions(): BuilderOptions;
556
563
  getConstraints(): {
557
564
  id: string;
558
565
  label: string;
@@ -585,16 +592,6 @@ declare function resolveServiceFallback(params: {
585
592
  props: ServiceProps;
586
593
  }): ServiceIdRef | null;
587
594
  declare function collectFailedFallbacks(props: ServiceProps, services: DgpServiceMap, settings?: FallbackSettings): FailedFallbackContext[];
588
- /**
589
- * Return all fallback candidates that are eligible for the given primary,
590
- * respecting:
591
- * - node-scoped list first (if nodeId provided), then global list for `primary`
592
- * - rate policy vs. primary
593
- * - (optional) tag constraint fit, only when tagId is provided and requireConstraintFit=true
594
- * - excludes (including primary automatically)
595
- * - selectionStrategy: 'priority' keeps list order, 'cheapest' sorts by rate asc
596
- * - unique (dedupe) and optional limit
597
- */
598
595
  declare function getEligibleFallbacks(params: {
599
596
  primary: ServiceIdRef;
600
597
  nodeId?: NodeIdRef;
@@ -606,6 +603,11 @@ declare function getEligibleFallbacks(params: {
606
603
  exclude?: Array<ServiceIdRef>;
607
604
  unique?: boolean;
608
605
  limit?: number;
606
+ source?: FallbackEligibleSource;
607
+ }): ServiceIdRef[];
608
+ declare function getAssignedServiceIds(params: {
609
+ props?: ServiceProps;
610
+ snapshot?: OrderSnapshot;
609
611
  }): ServiceIdRef[];
610
612
  declare function getFallbackRegistrationInfo(props: ServiceProps, nodeId: NodeIdRef): {
611
613
  primary?: ServiceIdRef;
@@ -763,6 +765,9 @@ type FilterServicesForVisibleGroupInput = {
763
765
  usedServiceIds: ServiceIdRef[];
764
766
  effectiveConstraints?: Partial<Record<"refill" | "cancel" | "dripfeed", boolean>>;
765
767
  policies?: unknown;
768
+ ratePolicy?: RatePolicy;
769
+ fallbackSettings?: FallbackSettings;
770
+ /** Backward-compatible alias for fallbackSettings */
766
771
  fallback?: FallbackSettings;
767
772
  strictSafety?: boolean;
768
773
  enforcePolicies?: boolean;
@@ -833,8 +838,9 @@ interface FallbackEditor {
833
838
  exclude?: ServiceIdRef[];
834
839
  unique?: boolean;
835
840
  limit?: number;
841
+ source?: FallbackEligibleSource;
836
842
  }): ServiceIdRef[];
837
843
  }
838
844
  declare function createFallbackEditor(options?: FallbackEditorOptions): FallbackEditor;
839
845
 
840
- export { type AncestryHit, type AnyNode, type Builder, type BuilderOptions, type FailedFallbackContext, type FallbackEditor, type FieldNode, type FilterServicesForVisibleGroupInput, type FilterServicesForVisibleGroupResult, type NodeIndex, type NodeKind, type NormaliseOptions, type OptionNode, type RateCoherenceDiagnostic, type RelKind, type ServiceCheck, type TagNode, type UnknownNode, type WithAncestry, buildOrderSnapshot, collectFailedFallbacks, createBuilder, createFallbackEditor, createNodeIndex, filterServicesForVisibleGroup, getEligibleFallbacks, getFallbackRegistrationInfo, normalise, normalizeFieldValidation, resolveServiceFallback, validate, validateAsync, validateRateCoherenceDeep };
846
+ export { type AncestryHit, type AnyNode, type Builder, type BuilderOptions, type FailedFallbackContext, type FallbackEditor, type FieldNode, type FilterServicesForVisibleGroupInput, type FilterServicesForVisibleGroupResult, type NodeIndex, type NodeKind, type NormaliseOptions, type OptionNode, type RateCoherenceDiagnostic, type RelKind, type ServiceCheck, type TagNode, type UnknownNode, type WithAncestry, buildOrderSnapshot, collectFailedFallbacks, createBuilder, createFallbackEditor, createNodeIndex, filterServicesForVisibleGroup, getAssignedServiceIds, getEligibleFallbacks, getFallbackRegistrationInfo, normalise, normalizeFieldValidation, resolveServiceFallback, validate, validateAsync, validateRateCoherenceDeep };