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

    Admin-tier CRUD over product_activation_rule. Accepts any rule type (admin-global, admin-for-customer, or customer).

    Identity / version split: product_activation_rule holds scope columns (routeId, customerId, type) plus a currentVersionId pointer; every mutable field (matcher, status, priority, value, label, description) lives on product_activation_rule_version and is append-only. Editing means inserting a new version row and re-pointing currentVersionId in one transaction.

    Duplicate-matcher detection (no two non-deleted rules in the same scope with the same JCS-canonical matcher) is enforced by the partial unique index product_activation_rule_unique_tuple on (route_id, customer_id, type, matcher_hash) NULLS NOT DISTINCT WHERE deleted_at IS NULL. matcherHash is denormalized onto the identity row so the index can live there; service code maintains identity.matcherHash = currentVersion.matcherHash on every version bump and translates the resulting unique-violation back into DUPLICATE_MATCHER.

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    Methods

    • Parameters

      • input: {
            customerId?: string;
            description?: string;
            effectiveFrom?: Instant;
            label?: string;
            matcher?: Matcher;
            priority: number;
            routeId: string;
            type?: "ADMIN" | "CUSTOMER";
            value: "APPROVE" | "DENY";
        }
        • OptionalcustomerId?: string

          External id; required when type='CUSTOMER'.

        • 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 (e.g. Reg E 30-day notice).

        • Optionallabel?: string
        • Optionalmatcher?: Matcher
        • priority: number
        • routeId: string
        • Optionaltype?: "ADMIN" | "CUSTOMER"
        • value: "APPROVE" | "DENY"

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

    • Parameters

      • input: {
            createdAt?: DbTimestampCriteria<Instant>;
            customerIds?: 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: AdminProductActivationRule[] };
          },
      >

    • Parameters

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

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