@timeax/digital-service-engine 0.2.8 → 0.3.0

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.
@@ -1671,6 +1671,14 @@ declare class Editor {
1671
1671
  fallbackSettings?: FallbackSettings;
1672
1672
  /** Backward-compatible alias */
1673
1673
  fallback?: FallbackSettings;
1674
+ rateContext?: {
1675
+ mode: "context";
1676
+ } | {
1677
+ mode: "custom_primary_rate";
1678
+ source: "manual" | "service";
1679
+ primaryRate?: number;
1680
+ primaryServiceId?: number | string;
1681
+ };
1674
1682
  }): ServiceCheck[];
1675
1683
  private moduleCtx;
1676
1684
  }
@@ -1671,6 +1671,14 @@ declare class Editor {
1671
1671
  fallbackSettings?: FallbackSettings;
1672
1672
  /** Backward-compatible alias */
1673
1673
  fallback?: FallbackSettings;
1674
+ rateContext?: {
1675
+ mode: "context";
1676
+ } | {
1677
+ mode: "custom_primary_rate";
1678
+ source: "manual" | "service";
1679
+ primaryRate?: number;
1680
+ primaryServiceId?: number | string;
1681
+ };
1674
1682
  }): ServiceCheck[];
1675
1683
  private moduleCtx;
1676
1684
  }
@@ -4615,6 +4615,10 @@ function filterServicesForVisibleGroup(input, deps) {
4615
4615
  (_h = (_g = context.ratePolicy) != null ? _g : explicitFallbackSettings == null ? void 0 : explicitFallbackSettings.ratePolicy) != null ? _h : builderOptions == null ? void 0 : builderOptions.ratePolicy
4616
4616
  );
4617
4617
  const policySource = (_j = (_i = context.policies) != null ? _i : builderOptions == null ? void 0 : builderOptions.policies) != null ? _j : [];
4618
+ const resolvedCustomPrimaryRate = resolveCustomPrimaryRate(
4619
+ context.rateContext,
4620
+ svcMap
4621
+ );
4618
4622
  const visibleServiceIds = context.selectedButtons === void 0 ? void 0 : collectVisibleServiceIds(
4619
4623
  deps.builder,
4620
4624
  context.tagId,
@@ -4641,7 +4645,11 @@ function filterServicesForVisibleGroup(input, deps) {
4641
4645
  cap.id,
4642
4646
  (_k = context.effectiveConstraints) != null ? _k : {}
4643
4647
  );
4644
- const passesRate2 = candidatePassesRateCoherence(
4648
+ const passesRate2 = resolvedCustomPrimaryRate != null ? passesRatePolicy(
4649
+ resolvedRatePolicy,
4650
+ resolvedCustomPrimaryRate,
4651
+ toFiniteNumber(cap.rate)
4652
+ ) : candidatePassesRateCoherence(
4645
4653
  deps.builder,
4646
4654
  svcMap,
4647
4655
  context.tagId,
@@ -4681,6 +4689,17 @@ function filterServicesForVisibleGroup(input, deps) {
4681
4689
  diagnostics: lastDiagnostics && lastDiagnostics.length ? lastDiagnostics : void 0
4682
4690
  };
4683
4691
  }
4692
+ function resolveCustomPrimaryRate(rateContext, serviceMap) {
4693
+ if (!rateContext || rateContext.mode !== "custom_primary_rate") {
4694
+ return void 0;
4695
+ }
4696
+ if (rateContext.source === "manual") {
4697
+ return toFiniteNumber(rateContext.primaryRate);
4698
+ }
4699
+ if (rateContext.primaryServiceId == null) return void 0;
4700
+ const cap = getServiceCapability(serviceMap, rateContext.primaryServiceId);
4701
+ return toFiniteNumber(cap == null ? void 0 : cap.rate);
4702
+ }
4684
4703
  function evaluatePoliciesRaw(raw, serviceIds, svcMap, tagId, visibleServiceIds) {
4685
4704
  const compiled = compilePolicies(raw);
4686
4705
  const evaluated = evaluateServicePolicies(
@@ -7672,7 +7691,8 @@ function filterServicesForVisibleGroup2(ctx, candidates, input) {
7672
7691
  policies: input.policies,
7673
7692
  ratePolicy: input.ratePolicy,
7674
7693
  fallbackSettings: input.fallbackSettings,
7675
- fallback: input.fallback
7694
+ fallback: input.fallback,
7695
+ rateContext: input.rateContext
7676
7696
  }
7677
7697
  };
7678
7698
  const result = filterServicesForVisibleGroup(coreInput, {