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

    Variable bankInstructionAccountViewConst

    bankInstructionAccountView: PgViewWithSelection<
        "bank_instruction_account",
        false,
        {
            accountNumber: PgBuildColumn<
                "bank_instruction_account",
                PgTextBuilder<[string, ...string[]]>,
                {
                    data: string;
                    dataType: "string";
                    driverParam: string;
                    enumValues: undefined;
                    generated: undefined;
                    hasDefault: false;
                    hasRuntimeDefault: false;
                    identity: undefined;
                    isAutoincrement: false;
                    isPrimaryKey: false;
                    name: string;
                    notNull: false;
                    tableName: "bank_instruction_account";
                },
            >;
            bankId: PgBuildColumn<
                "bank_instruction_account",
                SetNotNull<PgTextBuilder<[string, ...string[]]>>,
                {
                    data: string;
                    dataType: "string";
                    driverParam: string;
                    enumValues: undefined;
                    generated: undefined;
                    hasDefault: false;
                    hasRuntimeDefault: false;
                    identity: undefined;
                    isAutoincrement: false;
                    isPrimaryKey: false;
                    name: string;
                    notNull: true;
                    tableName: "bank_instruction_account";
                },
            >;
            bankName: PgBuildColumn<
                "bank_instruction_account",
                SetNotNull<PgTextBuilder<[string, ...string[]]>>,
                {
                    data: string;
                    dataType: "string";
                    driverParam: string;
                    enumValues: undefined;
                    generated: undefined;
                    hasDefault: false;
                    hasRuntimeDefault: false;
                    identity: undefined;
                    isAutoincrement: false;
                    isPrimaryKey: false;
                    name: string;
                    notNull: true;
                    tableName: "bank_instruction_account";
                },
            >;
            createdAt: PgBuildColumn<
                "bank_instruction_account",
                SetNotNull<
                    PgCustomColumnBuilder<
                        { data: Instant; dataType: "custom"; driverParam: string },
                    >,
                >,
                {
                    data: Instant;
                    dataType: "custom";
                    driverParam: string;
                    enumValues: undefined;
                    generated: undefined;
                    hasDefault: false;
                    hasRuntimeDefault: false;
                    identity: undefined;
                    isAutoincrement: false;
                    isPrimaryKey: false;
                    name: string;
                    notNull: true;
                    tableName: "bank_instruction_account";
                },
            >;
            currency: PgBuildColumn<
                "bank_instruction_account",
                PgTextBuilder<[string, ...string[]]>,
                {
                    data: string;
                    dataType: "string";
                    driverParam: string;
                    enumValues: undefined;
                    generated: undefined;
                    hasDefault: false;
                    hasRuntimeDefault: false;
                    identity: undefined;
                    isAutoincrement: false;
                    isPrimaryKey: false;
                    name: string;
                    notNull: false;
                    tableName: "bank_instruction_account";
                },
            >;
            entryId: PgBuildColumn<
                "bank_instruction_account",
                PgTextBuilder<[string, ...string[]]>,
                {
                    data: string;
                    dataType: "string";
                    driverParam: string;
                    enumValues: undefined;
                    generated: undefined;
                    hasDefault: false;
                    hasRuntimeDefault: false;
                    identity: undefined;
                    isAutoincrement: false;
                    isPrimaryKey: false;
                    name: string;
                    notNull: false;
                    tableName: "bank_instruction_account";
                },
            >;
            name: PgBuildColumn<
                "bank_instruction_account",
                PgTextBuilder<[string, ...string[]]>,
                {
                    data: string;
                    dataType: "string";
                    driverParam: string;
                    enumValues: undefined;
                    generated: undefined;
                    hasDefault: false;
                    hasRuntimeDefault: false;
                    identity: undefined;
                    isAutoincrement: false;
                    isPrimaryKey: false;
                    name: string;
                    notNull: false;
                    tableName: "bank_instruction_account";
                },
            >;
            rail: PgBuildColumn<
                "bank_instruction_account",
                SetNotNull<PgTextBuilder<[string, ...string[]]>>,
                {
                    data: string;
                    dataType: "string";
                    driverParam: string;
                    enumValues: undefined;
                    generated: undefined;
                    hasDefault: false;
                    hasRuntimeDefault: false;
                    identity: undefined;
                    isAutoincrement: false;
                    isPrimaryKey: false;
                    name: string;
                    notNull: true;
                    tableName: "bank_instruction_account";
                },
            >;
            routingNumber: PgBuildColumn<
                "bank_instruction_account",
                PgTextBuilder<[string, ...string[]]>,
                {
                    data: string;
                    dataType: "string";
                    driverParam: string;
                    enumValues: undefined;
                    generated: undefined;
                    hasDefault: false;
                    hasRuntimeDefault: false;
                    identity: undefined;
                    isAutoincrement: false;
                    isPrimaryKey: false;
                    name: string;
                    notNull: false;
                    tableName: "bank_instruction_account";
                },
            >;
            updatedAt: PgBuildColumn<
                "bank_instruction_account",
                SetNotNull<
                    PgCustomColumnBuilder<
                        { data: Instant; dataType: "custom"; driverParam: string },
                    >,
                >,
                {
                    data: Instant;
                    dataType: "custom";
                    driverParam: string;
                    enumValues: undefined;
                    generated: undefined;
                    hasDefault: false;
                    hasRuntimeDefault: false;
                    identity: undefined;
                    isAutoincrement: false;
                    isPrimaryKey: false;
                    name: string;
                    notNull: true;
                    tableName: "bank_instruction_account";
                },
            >;
        },
    > = ...

    CFX's own accounts at each partner bank, unpacked from the four JSONB rail columns on bank into one row per (bank, rail, SWIFT entry).

    Not part of the bank_account_view contract, and deliberately named so it does not match the %_bank_account_view pattern the contract test enumerates. It exists because two consumers need exactly this set and must not disagree about it: bankInstructionBankAccountView projects it as the BANK_INSTRUCTION arm, and the OBSERVED arm anti-joins against it to decide which (routing_number, account_number) pairs in the feed belong to no registered account. Two copies of the unnest would drift, and a drifted copy shows up as phantom unregistered accounts.

    routing_number and account_number are both nullable here, and that is the point rather than an oversight — see bankAccountViewColumns's keyable. A named-deposit ACH bank has a routing number and no account number (AchInstructionData.accountNumber is optional, because the per-deposit or per-VA number is supplied at use time); a foreign SWIFT entry has an account number and no routing number (ForeignSwiftWireInstructionData carries the intermediary-bank trio instead).