@cfxlabsinc/b2b-services
    Preparing search index...

    Customer-tier CRUD over product_activation_rule. Always operates on the type='CUSTOMER' slice. Customer rules can only opt the customer OUT of routes (value: "DENY") — opting back in is reserved for admin tier (CUSTOMER_CANNOT_ACTIVATE on both create() and update()).

    Identity / version split: see ProductActivationRuleAdminService for the full description.

    Internal admins must use ProductActivationRuleAdminService instead.

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    Methods

    • Parameters

      • input: {
            customerId: string;
            description?: string;
            effectiveFrom?: Instant;
            label?: string;
            matcher?: Matcher;
            priority: number;
            routeId: string;
            value: "DENY";
        }
        • customerId: string
        • Optionaldescription?: string
        • OptionaleffectiveFrom?: Instant

          When this version becomes effective. Defaults to now() at the DB layer when omitted. Pass a future Temporal.Instant to schedule a change.

        • Optionallabel?: string
        • Optionalmatcher?: Matcher
        • priority: number
        • routeId: string
        • value: "DENY"

      Returns Promise<
          | { ok: true; value: ProductActivationRule }
          | { error: ServiceError; ok: false },
      >

    • TS-side symmetric evaluation of activation rules for a single route. Thin wrapper: search() fetches every rule visible to this customer (admin-global, admin-for-this-customer, customer-tier), then the shared pickWinningRule picker applies the same precedence as the SQL CTE in ProductRouteService.search().

      Returns null when no rule matches; the caller treats that as "NO_MATCHING_RULES" and inherits whatever default the route surface uses (typically: APPROVE if the route itself matches, else INACTIVE).

      The pure picker is also exported as pickWinningRule for callers who want to simulate against a hypothetical rule set without writing.

      Parameters

      • input: {
            criteria: MatcherCriteria;
            customerId: string;
            now?: Instant;
            routeId: string;
        }

      Returns Promise<ProductActivationRule | null>

    • Returns activation rules visible to this customer:

      • admin-global (customerId IS NULL)
      • admin-for-this-customer (type='ADMIN', customerId=input.customerId)
      • customer-tier (type='CUSTOMER', customerId=input.customerId)

      Pass types: ["CUSTOMER"] from a controller to restrict to the customer's own writable slice. Write paths (create/update/delete) always operate on the CUSTOMER slice regardless of this filter.

      Parameters

      • input: {
            createdAt?: DbTimestampCriteria<Instant>;
            customerId: string;
            ids?: string[];
            orderBy?: "createdAt" | "updatedAt" | "priority";
            page?: number;
            pageSize?: number;
            routeIds?: string[];
            statuses?: ("ACTIVE" | "DISABLED")[];
            types?: ("ADMIN" | "CUSTOMER")[];
            updatedAt?: DbTimestampCriteria<Instant>;
        }

      Returns Promise<
          {
              ok: true;
              value: { hasNext: boolean; items: ProductActivationRule[] };
          },
      >

    • Parameters

      • input: {
            customerId: string;
            data: {
                description?: string | null;
                effectiveFrom?: Instant;
                label?: string | null;
                matcher?: Matcher;
                priority?: number;
                status?: "ACTIVE" | "DISABLED";
                value?: "DENY";
            };
            id: string;
        }

      Returns Promise<
          | { ok: true; value: ProductActivationRule }
          | { error: ServiceError; ok: false },
      >