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

    Variable bankTransactionReconcileQueueViewConst

    bankTransactionReconcileQueueView: PgViewWithSelection<
        {
            existing: true;
            isAlias: false;
            name: "bank_transaction_reconcile_queue_view";
            schema: "b2b";
            selectedFields: {
                accountName: PgBuildColumn<
                    "bank_transaction_reconcile_queue_view",
                    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_transaction_reconcile_queue_view";
                    },
                >;
                accountNumber: PgBuildColumn<
                    "bank_transaction_reconcile_queue_view",
                    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_transaction_reconcile_queue_view";
                    },
                >;
                accountType: PgBuildColumn<
                    "bank_transaction_reconcile_queue_view",
                    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_transaction_reconcile_queue_view";
                    },
                >;
                ageDays: PgBuildColumn<
                    "bank_transaction_reconcile_queue_view",
                    SetNotNull<PgIntegerBuilder>,
                    {
                        data: number;
                        dataType: "number int32";
                        driverParam: string | number;
                        enumValues: undefined;
                        generated: undefined;
                        hasDefault: false;
                        hasRuntimeDefault: false;
                        identity: undefined;
                        isAutoincrement: false;
                        isPrimaryKey: false;
                        name: string;
                        notNull: true;
                        tableName: "bank_transaction_reconcile_queue_view";
                    },
                >;
                amount: PgBuildColumn<
                    "bank_transaction_reconcile_queue_view",
                    SetNotNull<PgNumericBuilder>,
                    {
                        data: string;
                        dataType: "string numeric";
                        driverParam: string;
                        enumValues: undefined;
                        generated: undefined;
                        hasDefault: false;
                        hasRuntimeDefault: false;
                        identity: undefined;
                        isAutoincrement: false;
                        isPrimaryKey: false;
                        name: string;
                        notNull: true;
                        tableName: "bank_transaction_reconcile_queue_view";
                    },
                >;
                bankId: PgBuildColumn<
                    "bank_transaction_reconcile_queue_view",
                    Set$Type<SetNotNull<PgTextBuilder<[string, ...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_transaction_reconcile_queue_view";
                    },
                >;
                createdAt: PgBuildColumn<
                    "bank_transaction_reconcile_queue_view",
                    SetNotNull<PgTimestampBuilder>,
                    {
                        data: Date;
                        dataType: "object date";
                        driverParam: string;
                        enumValues: undefined;
                        generated: undefined;
                        hasDefault: false;
                        hasRuntimeDefault: false;
                        identity: undefined;
                        isAutoincrement: false;
                        isPrimaryKey: false;
                        name: string;
                        notNull: true;
                        tableName: "bank_transaction_reconcile_queue_view";
                    },
                >;
                customerId: PgBuildColumn<
                    "bank_transaction_reconcile_queue_view",
                    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_transaction_reconcile_queue_view";
                    },
                >;
                customerName: PgBuildColumn<
                    "bank_transaction_reconcile_queue_view",
                    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_transaction_reconcile_queue_view";
                    },
                >;
                description: PgBuildColumn<
                    "bank_transaction_reconcile_queue_view",
                    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_transaction_reconcile_queue_view";
                    },
                >;
                entityId: PgBuildColumn<
                    "bank_transaction_reconcile_queue_view",
                    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_transaction_reconcile_queue_view";
                    },
                >;
                entityName: PgBuildColumn<
                    "bank_transaction_reconcile_queue_view",
                    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_transaction_reconcile_queue_view";
                    },
                >;
                feedSource: PgBuildColumn<
                    "bank_transaction_reconcile_queue_view",
                    Set$Type<PgTextBuilder<[string, ...string[]]>, BankTransactionRawSource>,
                    {
                        data: BankTransactionRawSource;
                        dataType: "string";
                        driverParam: string;
                        enumValues: undefined;
                        generated: undefined;
                        hasDefault: false;
                        hasRuntimeDefault: false;
                        identity: undefined;
                        isAutoincrement: false;
                        isPrimaryKey: false;
                        name: string;
                        notNull: false;
                        tableName: "bank_transaction_reconcile_queue_view";
                    },
                >;
                id: PgBuildColumn<
                    "bank_transaction_reconcile_queue_view",
                    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_transaction_reconcile_queue_view";
                    },
                >;
                ledgerAccountId: PgBuildColumn<
                    "bank_transaction_reconcile_queue_view",
                    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_transaction_reconcile_queue_view";
                    },
                >;
                postedAt: PgBuildColumn<
                    "bank_transaction_reconcile_queue_view",
                    SetNotNull<PgTimestampBuilder>,
                    {
                        data: Date;
                        dataType: "object date";
                        driverParam: string;
                        enumValues: undefined;
                        generated: undefined;
                        hasDefault: false;
                        hasRuntimeDefault: false;
                        identity: undefined;
                        isAutoincrement: false;
                        isPrimaryKey: false;
                        name: string;
                        notNull: true;
                        tableName: "bank_transaction_reconcile_queue_view";
                    },
                >;
                routingNumber: PgBuildColumn<
                    "bank_transaction_reconcile_queue_view",
                    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_transaction_reconcile_queue_view";
                    },
                >;
                statementDescription: PgBuildColumn<
                    "bank_transaction_reconcile_queue_view",
                    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_transaction_reconcile_queue_view";
                    },
                >;
                type: PgBuildColumn<
                    "bank_transaction_reconcile_queue_view",
                    Set$Type<
                        SetNotNull<PgTextBuilder<[string, ...string[]]>>,
                        "CREDIT" | "DEBIT",
                    >,
                    {
                        data: "CREDIT" | "DEBIT";
                        dataType: "string";
                        driverParam: string;
                        enumValues: undefined;
                        generated: undefined;
                        hasDefault: false;
                        hasRuntimeDefault: false;
                        identity: undefined;
                        isAutoincrement: false;
                        isPrimaryKey: false;
                        name: string;
                        notNull: true;
                        tableName: "bank_transaction_reconcile_queue_view";
                    },
                >;
            };
        },
    > = ...

    b2b.bank_transaction_reconcile_queue_view — every unhidden bank_transaction row whose data -> 'reconciliation' is still '{}', with ownership resolved through bank_account_view.

    The name is load-bearing at both ends and neither is compiler-checked. Two contract tests discover their arms by suffix against information_schema.views: test/transactionViewContract.integration.test.ts matches LIKE '%transaction_view' and test/bankAccountViewContract.integration.test.ts matches LIKE '%bank_account_view', and each asserts the discovered set equals its own declared arm list exactly. A new view in b2b ending in either suffix fails those tests as a bogus extra arm — which is what the original name here (unreconciled_bank_transaction_view) did. Any view added to this schema must end in neither.

    Declared .existing(): the body is hand-written SQL in packages/db/migrations/20261106165600_bank_transaction_hidden.sql and drizzle-kit must not try to own it. What this declaration buys is typed columns — bankTransactionReconcileQueueView.feedSource stops compiling if the name moves, where a sqlfeed_source`` fragment would keep typechecking green against a view that no longer projects it.

    The two filters callers actually need are the two the base table cannot express: customer_id (which lives behind the view's LATERAL join to bank_account_view) and feed_source (raw ->> 'source'). BankTransactionService.search has neither, which is why the backfill reads here rather than there.

    customerId is null on the large majority of rows. Of 841 unreconciled rows in prod, 811 are metcap FBO omnibus activity with no customer attribution; customer_id IS NOT NULL is what reproduces the wire desk's working list. A caller that fans out over this view unfiltered is almost certainly doing the wrong thing.

    Names come from the ambient casing: "snake_case" mapping, so feedSource serializes to "feed_source".