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

    Type Alias DocumentIndexConfig<OwnerKey, Code>

    What the index is told about one kind of owner.

    type DocumentIndexConfig<OwnerKey extends string, Code extends string> = {
        cache: Pick<SearchCacheConfig, "namespace" | "kind" | "collectionTag"> & {
            ownerTag: (ownerId: string) => string;
        };
        code: Code;
        label: string;
        owner: {
            externalId: AnyPgColumn<{ data: string; notNull: true }>;
            keyName: AnyPgColumn<{ data: string; notNull: true }>;
            table: PgTable;
            workspaceExternalId: AnyPgColumn<{ data: string; notNull: true }>;
            workspaceId: AnyPgColumn<{ data: number; notNull: true }>;
        };
        ownerKey: OwnerKey;
        rootPrefix: string;
        table: DocumentTable;
        typePrefixes: Record<DocumentType, string>;
        user: {
            data: AnyPgColumn<{ notNull: true }>;
            externalId: AnyPgColumn<{ data: string; notNull: true }>;
            id: AnyPgColumn<{ data: number; notNull: true }>;
            membership: {
                deletedAt: AnyPgColumn<{ data: Date }>;
                status: AnyPgColumn<{ data: string; notNull: true }>;
                table: PgTable;
                userId: AnyPgColumn<{ data: number; notNull: true }>;
                workspaceId: AnyPgColumn<{ data: number; notNull: true }>;
            };
            table: PgTable;
        };
    }

    Type Parameters

    • OwnerKey extends string
    • Code extends string
    Index
    cache: Pick<SearchCacheConfig, "namespace" | "kind" | "collectionTag"> & {
        ownerTag: (ownerId: string) => string;
    }

    Type Declaration

    • ownerTag: (ownerId: string) => string

      The membership tag on every page of one owner's documents.

    code: Code

    Leads every error code: BANK gives BANK_DOCUMENT_NAME_INVALID.

    label: string

    Names the owner in thrown messages: bank gives bank "x" does not exist.

    owner: {
        externalId: AnyPgColumn<{ data: string; notNull: true }>;
        keyName: AnyPgColumn<{ data: string; notNull: true }>;
        table: PgTable;
        workspaceExternalId: AnyPgColumn<{ data: string; notNull: true }>;
        workspaceId: AnyPgColumn<{ data: number; notNull: true }>;
    }

    Type Declaration

    • externalId: AnyPgColumn<{ data: string; notNull: true }>
    • keyName: AnyPgColumn<{ data: string; notNull: true }>

      The column whose value names the owner in its S3 keys.

    • table: PgTable
    • workspaceExternalId: AnyPgColumn<{ data: string; notNull: true }>
    • workspaceId: AnyPgColumn<{ data: number; notNull: true }>
    ownerKey: OwnerKey

    The field a document and every call name the owner by: bankId.

    rootPrefix: string

    What every owner's root starts with; the root is this, keyName, /.

    typePrefixes: Record<DocumentType, string>

    Each type's segment of the key under the owner's root, in the order reconcile walks them. "" puts a type at the root itself, whose root then reserves the names the other types' segments start with.

    user: {
        data: AnyPgColumn<{ notNull: true }>;
        externalId: AnyPgColumn<{ data: string; notNull: true }>;
        id: AnyPgColumn<{ data: number; notNull: true }>;
        membership: {
            deletedAt: AnyPgColumn<{ data: Date }>;
            status: AnyPgColumn<{ data: string; notNull: true }>;
            table: PgTable;
            userId: AnyPgColumn<{ data: number; notNull: true }>;
            workspaceId: AnyPgColumn<{ data: number; notNull: true }>;
        };
        table: PgTable;
    }

    The dashboard user table updated_by_user_id references.

    Type Declaration

    • data: AnyPgColumn<{ notNull: true }>
    • externalId: AnyPgColumn<{ data: string; notNull: true }>
    • id: AnyPgColumn<{ data: number; notNull: true }>
    • membership: {
          deletedAt: AnyPgColumn<{ data: Date }>;
          status: AnyPgColumn<{ data: string; notNull: true }>;
          table: PgTable;
          userId: AnyPgColumn<{ data: number; notNull: true }>;
          workspaceId: AnyPgColumn<{ data: number; notNull: true }>;
      }

      Who belongs to which workspace: only a member is stamped on its rows.

      • deletedAt: AnyPgColumn<{ data: Date }>
      • status: AnyPgColumn<{ data: string; notNull: true }>

        A live write needs ACTIVE here and no deletedAt.

      • table: PgTable
      • userId: AnyPgColumn<{ data: number; notNull: true }>
      • workspaceId: AnyPgColumn<{ data: number; notNull: true }>
    • table: PgTable