Some checks are pending
Bidi Control Character Guard / bidi-control-guard (push) Waiting to run
Circular Dependency Check / Check for new circular dependencies (push) Waiting to run
Citus Migration Smoke / Combined migrations on single-node Citus (push) Waiting to run
E2E Fresh Install Tests / fresh-install-e2e (push) Waiting to run
ext-v2 guardrails / Run ext-v2 guard and ESLint (push) Waiting to run
Integration Tests / Check for relevant changes (push) Waiting to run
Integration Tests / ${{ (github.event_name == 'schedule' || github.event.inputs.suite == 'full') && 'Full integration suite' || 'Tier-1 integration subset' }} (push) Blocked by required conditions
Mobile checks / Mobile lint + typecheck (push) Waiting to run
Mobile checks / Mobile unit tests (push) Waiting to run
Mobile checks / Mobile dependency audit (report) (push) Waiting to run
Mobile checks / Mobile reproducibility checks (push) Waiting to run
Secrets guard (env backups) / Ensure no tracked env backup files (push) Waiting to run
Temporal Readiness / fast-readiness (push) Waiting to run
Temporal Readiness / docker-parity (push) Waiting to run
TypeScript Type Check / Nx affected typecheck (push) Waiting to run
Unit Tests / Skipped-test budget (push) Waiting to run
Unit Tests / Nx affected unit tests (push) Waiting to run
Unit Tests / Server unit coverage (informational) (push) Waiting to run
Validate Tenant Management Schema / Check for relevant changes (push) Waiting to run
Validate Tenant Management Schema / Validate Tenant Management Schema (push) Blocked by required conditions
EE Workflows Build Guard / ee-workflows-build-guard (push) Waiting to run
Excluded: .git, node_modules, secrets/, compose.env, assemblyscript tgz Source: /opt/alga-psa on psa.joliet.tech
68 lines
2.0 KiB
TypeScript
68 lines
2.0 KiB
TypeScript
import type {
|
|
IPersistedRecurringObligationRef,
|
|
IRecurringObligationRef,
|
|
RecurringChargeFamily,
|
|
} from '@alga-psa/types';
|
|
|
|
/**
|
|
* Post-drop client cadence still persists `client_contract_line` as a logical
|
|
* compatibility label, but the canonical surviving obligation id is always the
|
|
* live `contract_line_id`.
|
|
*/
|
|
export const CLIENT_CADENCE_POST_DROP_OBLIGATION_TYPE = 'client_contract_line' as const;
|
|
|
|
export const POST_DROP_RECURRING_OBLIGATION_TYPES = [
|
|
'contract_line',
|
|
CLIENT_CADENCE_POST_DROP_OBLIGATION_TYPE,
|
|
] as const;
|
|
|
|
export function isClientCadencePostDropObligationType(
|
|
value: unknown,
|
|
): value is typeof CLIENT_CADENCE_POST_DROP_OBLIGATION_TYPE {
|
|
return value === CLIENT_CADENCE_POST_DROP_OBLIGATION_TYPE;
|
|
}
|
|
|
|
export function buildClientCadencePostDropObligationRef(input: {
|
|
contractLineId: string;
|
|
chargeFamily: RecurringChargeFamily;
|
|
tenant?: string;
|
|
}): IRecurringObligationRef {
|
|
return {
|
|
obligationId: input.contractLineId,
|
|
obligationType: CLIENT_CADENCE_POST_DROP_OBLIGATION_TYPE,
|
|
chargeFamily: input.chargeFamily,
|
|
...(input.tenant ? { tenant: input.tenant } : {}),
|
|
};
|
|
}
|
|
|
|
export function buildPersistedClientCadencePostDropObligationRef(input: {
|
|
tenant: string;
|
|
contractLineId: string;
|
|
chargeFamily: RecurringChargeFamily;
|
|
}): IPersistedRecurringObligationRef {
|
|
return {
|
|
tenant: input.tenant,
|
|
obligationId: input.contractLineId,
|
|
obligationType: CLIENT_CADENCE_POST_DROP_OBLIGATION_TYPE,
|
|
chargeFamily: input.chargeFamily,
|
|
};
|
|
}
|
|
|
|
export function buildPostDropRecurringObligationCandidates(input: {
|
|
contractLineId: string;
|
|
chargeFamily: RecurringChargeFamily;
|
|
tenant?: string;
|
|
}): readonly [IRecurringObligationRef, IRecurringObligationRef] {
|
|
const contractLineCandidate: IRecurringObligationRef = {
|
|
obligationId: input.contractLineId,
|
|
obligationType: 'contract_line',
|
|
chargeFamily: input.chargeFamily,
|
|
...(input.tenant ? { tenant: input.tenant } : {}),
|
|
};
|
|
|
|
return [
|
|
contractLineCandidate,
|
|
buildClientCadencePostDropObligationRef(input),
|
|
] as const;
|
|
}
|