UNPKG

@zingage/postgres-multi-tenant-ids

Version:

PostgreSQL IDs for secure multi-tenant applications

16 lines 1.34 kB
import type { UnscopedId } from "../helpers/config-agnostic-types.js"; import { type UUIDV8 } from "../helpers/utils.js"; import { type NamedEntityTypeConfigs } from "../index.js"; export declare function makeMakeUnscopedIdBound<T extends NamedEntityTypeConfigs>(crossTenantEntityTypeConfigs: T): <K extends keyof T & string>(entityType: K, date?: Date) => UnscopedId<T, K>; export declare function makeUnscopedId<T extends NamedEntityTypeConfigs, K extends keyof T & string>(crossTenantEntityTypeConfigs: T, entityType: K, date?: Date): UnscopedId<T, K>; /** * NB: filling in T is just a convenient way to do a cast if you (think you) * know what type of id you're getting from the outside world. */ export declare function isUnscopedId<CrossTenantEntityTypeConfigs extends NamedEntityTypeConfigs, K extends keyof CrossTenantEntityTypeConfigs & string>(id: UUIDV8): id is UnscopedId<CrossTenantEntityTypeConfigs, K>; /** * NB: filling in T is just a convenient way to do a cast if you (think you) * know what type of id you're getting from the outside world. */ export declare function stringIsUnscopedId<CrossTenantEntityTypeConfigs extends NamedEntityTypeConfigs, K extends keyof CrossTenantEntityTypeConfigs & string>(id: string): id is UnscopedId<CrossTenantEntityTypeConfigs, K>; //# sourceMappingURL=cross-tenant-entity-ids.d.ts.map