@timeax/digital-service-engine 0.2.8 → 0.2.9

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.
@@ -1846,6 +1846,14 @@ declare class Editor {
1846
1846
  fallbackSettings?: FallbackSettings;
1847
1847
  /** Backward-compatible alias */
1848
1848
  fallback?: FallbackSettings;
1849
+ rateContext?: {
1850
+ mode: "context";
1851
+ } | {
1852
+ mode: "custom_primary_rate";
1853
+ source: "manual" | "service";
1854
+ primaryRate?: number;
1855
+ primaryServiceId?: number | string;
1856
+ };
1849
1857
  }): ServiceCheck[];
1850
1858
  private moduleCtx;
1851
1859
  }
@@ -1846,6 +1846,14 @@ declare class Editor {
1846
1846
  fallbackSettings?: FallbackSettings;
1847
1847
  /** Backward-compatible alias */
1848
1848
  fallback?: FallbackSettings;
1849
+ rateContext?: {
1850
+ mode: "context";
1851
+ } | {
1852
+ mode: "custom_primary_rate";
1853
+ source: "manual" | "service";
1854
+ primaryRate?: number;
1855
+ primaryServiceId?: number | string;
1856
+ };
1849
1857
  }): ServiceCheck[];
1850
1858
  private moduleCtx;
1851
1859
  }
@@ -7009,6 +7009,10 @@ function filterServicesForVisibleGroup(input, deps) {
7009
7009
  (_h = (_g = context.ratePolicy) != null ? _g : explicitFallbackSettings == null ? void 0 : explicitFallbackSettings.ratePolicy) != null ? _h : builderOptions == null ? void 0 : builderOptions.ratePolicy
7010
7010
  );
7011
7011
  const policySource = (_j = (_i = context.policies) != null ? _i : builderOptions == null ? void 0 : builderOptions.policies) != null ? _j : [];
7012
+ const resolvedCustomPrimaryRate = resolveCustomPrimaryRate(
7013
+ context.rateContext,
7014
+ svcMap
7015
+ );
7012
7016
  const visibleServiceIds = context.selectedButtons === void 0 ? void 0 : collectVisibleServiceIds(
7013
7017
  deps.builder,
7014
7018
  context.tagId,
@@ -7035,7 +7039,11 @@ function filterServicesForVisibleGroup(input, deps) {
7035
7039
  cap.id,
7036
7040
  (_k = context.effectiveConstraints) != null ? _k : {}
7037
7041
  );
7038
- const passesRate2 = candidatePassesRateCoherence(
7042
+ const passesRate2 = resolvedCustomPrimaryRate != null ? passesRatePolicy(
7043
+ resolvedRatePolicy,
7044
+ resolvedCustomPrimaryRate,
7045
+ toFiniteNumber(cap.rate)
7046
+ ) : candidatePassesRateCoherence(
7039
7047
  deps.builder,
7040
7048
  svcMap,
7041
7049
  context.tagId,
@@ -7075,6 +7083,17 @@ function filterServicesForVisibleGroup(input, deps) {
7075
7083
  diagnostics: lastDiagnostics && lastDiagnostics.length ? lastDiagnostics : void 0
7076
7084
  };
7077
7085
  }
7086
+ function resolveCustomPrimaryRate(rateContext, serviceMap) {
7087
+ if (!rateContext || rateContext.mode !== "custom_primary_rate") {
7088
+ return void 0;
7089
+ }
7090
+ if (rateContext.source === "manual") {
7091
+ return toFiniteNumber(rateContext.primaryRate);
7092
+ }
7093
+ if (rateContext.primaryServiceId == null) return void 0;
7094
+ const cap = getServiceCapability(serviceMap, rateContext.primaryServiceId);
7095
+ return toFiniteNumber(cap == null ? void 0 : cap.rate);
7096
+ }
7078
7097
  function evaluatePoliciesRaw(raw, serviceIds, svcMap, tagId, visibleServiceIds) {
7079
7098
  const compiled = compilePolicies(raw);
7080
7099
  const evaluated = evaluateServicePolicies(
@@ -8965,7 +8984,8 @@ function filterServicesForVisibleGroup2(ctx, candidates, input) {
8965
8984
  policies: input.policies,
8966
8985
  ratePolicy: input.ratePolicy,
8967
8986
  fallbackSettings: input.fallbackSettings,
8968
- fallback: input.fallback
8987
+ fallback: input.fallback,
8988
+ rateContext: input.rateContext
8969
8989
  }
8970
8990
  };
8971
8991
  const result = filterServicesForVisibleGroup(coreInput, {