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

    Customer-tier CRUD over product_limit_rule. Always operates on the type='CUSTOMER' slice. Customer rules can only TIGHTEN against the matching admin baseline (max columns ≤ admin baseline; min columns ≥ admin baseline). Violations return INVALID_LIMIT_RULE naming the offending column.

    Identity / version split: see ProductLimitRuleAdminService.

    Internal admins must use ProductLimitRuleAdminService instead.

    Index
    db: B2bDatabase
    instance: (...args: []) => ProductLimitRuleService = ...

    The process default: built from each dependency's own instance().

    • Parameters

      • input: {
            customerId: string;
            description?: string;
            effectiveFrom?: Instant;
            label?: string;
            matcher?: Matcher | undefined;
            priority: number;
        } & (LimitRuleScopeInput & LimitFields)
        • customerId: string
        • Optionaldescription?: string
        • OptionaleffectiveFrom?: Instant

          When this version becomes effective. Defaults to now() at the DB layer when omitted.

        • Optionallabel?: string
        • Optionalmatcher?: Matcher | undefined
        • priority: number

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

    • Returns limit 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 always operate on the CUSTOMER slice regardless of this filter.

      Parameters

      • input: {
            createdAt?: DbTimestampCriteria<Instant>;
            customerId: string;
            ids?: string[];
            orderBy?: RuleOrderByCriterion[];
            page?: number;
            pageSize?: number;
            productCategories?: ProductCategory[];
            routeIds?: string[];
            statuses?: ("ACTIVE" | "DISABLED")[];
            types?: ("CUSTOMER" | "ADMIN")[];
            updatedAt?: DbTimestampCriteria<Instant>;
        }
        • OptionalcreatedAt?: DbTimestampCriteria<Instant>
        • customerId: string
        • Optionalids?: string[]
        • OptionalorderBy?: RuleOrderByCriterion[]
        • Optionalpage?: number
        • OptionalpageSize?: number
        • OptionalproductCategories?: ProductCategory[]

          Matches category rules only.

        • OptionalrouteIds?: string[]

          Matches route rules only.

        • Optionalstatuses?: ("ACTIVE" | "DISABLED")[]
        • Optionaltypes?: ("CUSTOMER" | "ADMIN")[]
        • OptionalupdatedAt?: DbTimestampCriteria<Instant>

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

    • Parameters

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

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