@prisma/orm-postgres 0.16.0-dev.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +56 -0
- package/dist/adapter.d.mts +1 -0
- package/dist/adapter.mjs +2 -0
- package/dist/adapter__adapter.d.mts +1 -0
- package/dist/adapter__adapter.mjs +2 -0
- package/dist/adapter__column-types.d.mts +1 -0
- package/dist/adapter__column-types.mjs +2 -0
- package/dist/adapter__control.d.mts +3 -0
- package/dist/adapter__control.mjs +3 -0
- package/dist/adapter__operation-types.d.mts +1 -0
- package/dist/adapter__operation-types.mjs +2 -0
- package/dist/adapter__runtime.d.mts +3 -0
- package/dist/adapter__runtime.mjs +3 -0
- package/dist/adapter__types.d.mts +1 -0
- package/dist/adapter__types.mjs +2 -0
- package/dist/bin__prisma-next.mjs +3 -0
- package/dist/builder.d.mts +1 -0
- package/dist/builder.mjs +2 -0
- package/dist/builder__runtime.d.mts +1 -0
- package/dist/builder__runtime.mjs +2 -0
- package/dist/builder__types.d.mts +1 -0
- package/dist/builder__types.mjs +2 -0
- package/dist/components.d.mts +1 -0
- package/dist/components.mjs +2 -0
- package/dist/components__authoring.d.mts +1 -0
- package/dist/components__authoring.mjs +2 -0
- package/dist/components__codec.d.mts +1 -0
- package/dist/components__codec.mjs +2 -0
- package/dist/components__components.d.mts +1 -0
- package/dist/components__components.mjs +2 -0
- package/dist/components__control.d.mts +1 -0
- package/dist/components__control.mjs +2 -0
- package/dist/components__emission.d.mts +1 -0
- package/dist/components__emission.mjs +2 -0
- package/dist/components__execution.d.mts +1 -0
- package/dist/components__execution.mjs +2 -0
- package/dist/components__ir.d.mts +1 -0
- package/dist/components__ir.mjs +2 -0
- package/dist/components__psl-ast.d.mts +1 -0
- package/dist/components__psl-ast.mjs +2 -0
- package/dist/components__runtime.d.mts +1 -0
- package/dist/components__runtime.mjs +2 -0
- package/dist/components__utils.d.mts +1 -0
- package/dist/components__utils.mjs +2 -0
- package/dist/config.d.mts +19 -0
- package/dist/config.d.mts.map +1 -0
- package/dist/config.mjs +44 -0
- package/dist/config.mjs.map +1 -0
- package/dist/contract-builder.d.mts +521 -0
- package/dist/contract-builder.d.mts.map +1 -0
- package/dist/contract-builder.mjs +232 -0
- package/dist/contract-builder.mjs.map +1 -0
- package/dist/contract.d.mts +1 -0
- package/dist/contract.mjs +2 -0
- package/dist/contract__apply-specifier-default-control-policy.d.mts +1 -0
- package/dist/contract__apply-specifier-default-control-policy.mjs +2 -0
- package/dist/contract__contract-validation-error.d.mts +1 -0
- package/dist/contract__contract-validation-error.mjs +2 -0
- package/dist/contract__default-namespace.d.mts +1 -0
- package/dist/contract__default-namespace.mjs +2 -0
- package/dist/contract__enum-accessor.d.mts +1 -0
- package/dist/contract__enum-accessor.mjs +2 -0
- package/dist/contract__hashing-utils.d.mts +1 -0
- package/dist/contract__hashing-utils.mjs +2 -0
- package/dist/contract__hashing.d.mts +1 -0
- package/dist/contract__hashing.mjs +2 -0
- package/dist/contract__is-plain-record.d.mts +1 -0
- package/dist/contract__is-plain-record.mjs +2 -0
- package/dist/contract__resolve-domain-model.d.mts +1 -0
- package/dist/contract__resolve-domain-model.mjs +2 -0
- package/dist/contract__types.d.mts +1 -0
- package/dist/contract__types.mjs +2 -0
- package/dist/contract__validate-domain.d.mts +1 -0
- package/dist/contract__validate-domain.mjs +2 -0
- package/dist/control.d.mts +20 -0
- package/dist/control.d.mts.map +1 -0
- package/dist/control.mjs +29 -0
- package/dist/control.mjs.map +1 -0
- package/dist/driver.d.mts +1 -0
- package/dist/driver.mjs +2 -0
- package/dist/driver__control.d.mts +3 -0
- package/dist/driver__control.mjs +3 -0
- package/dist/driver__runtime.d.mts +3 -0
- package/dist/driver__runtime.mjs +3 -0
- package/dist/errors-DfWK9xep-CYOOg0sB.mjs +9 -0
- package/dist/errors-DfWK9xep-CYOOg0sB.mjs.map +1 -0
- package/dist/family-contract.d.mts +1 -0
- package/dist/family-contract.mjs +2 -0
- package/dist/family-contract__canonicalization-hooks.d.mts +1 -0
- package/dist/family-contract__canonicalization-hooks.mjs +2 -0
- package/dist/family-contract__contract-view.d.mts +1 -0
- package/dist/family-contract__contract-view.mjs +2 -0
- package/dist/family-contract__entity-handle-lowering-hook.d.mts +1 -0
- package/dist/family-contract__entity-handle-lowering-hook.mjs +2 -0
- package/dist/family-contract__entity-kinds.d.mts +1 -0
- package/dist/family-contract__entity-kinds.mjs +2 -0
- package/dist/family-contract__factories.d.mts +1 -0
- package/dist/family-contract__factories.mjs +2 -0
- package/dist/family-contract__foreign-key-materialization.d.mts +1 -0
- package/dist/family-contract__foreign-key-materialization.mjs +2 -0
- package/dist/family-contract__index-naming.d.mts +1 -0
- package/dist/family-contract__index-naming.mjs +2 -0
- package/dist/family-contract__index-type-validation.d.mts +1 -0
- package/dist/family-contract__index-type-validation.mjs +2 -0
- package/dist/family-contract__index-types.d.mts +1 -0
- package/dist/family-contract__index-types.mjs +2 -0
- package/dist/family-contract__pack-types.d.mts +1 -0
- package/dist/family-contract__pack-types.mjs +2 -0
- package/dist/family-contract__referential-action-sql.d.mts +1 -0
- package/dist/family-contract__referential-action-sql.mjs +2 -0
- package/dist/family-contract__resolve-storage-table.d.mts +1 -0
- package/dist/family-contract__resolve-storage-table.mjs +2 -0
- package/dist/family-contract__types.d.mts +1 -0
- package/dist/family-contract__types.mjs +2 -0
- package/dist/family-contract__validators.d.mts +1 -0
- package/dist/family-contract__validators.mjs +2 -0
- package/dist/family-contract__value-set-derivation-hook.d.mts +1 -0
- package/dist/family-contract__value-set-derivation-hook.mjs +2 -0
- package/dist/family-runtime.d.mts +1 -0
- package/dist/family-runtime.mjs +2 -0
- package/dist/family.d.mts +2 -0
- package/dist/family.mjs +2 -0
- package/dist/family__control-adapter.d.mts +1 -0
- package/dist/family__control-adapter.mjs +2 -0
- package/dist/family__control.d.mts +3 -0
- package/dist/family__control.mjs +3 -0
- package/dist/family__diff.d.mts +1 -0
- package/dist/family__diff.mjs +2 -0
- package/dist/family__ir.d.mts +1 -0
- package/dist/family__ir.mjs +2 -0
- package/dist/family__migration.d.mts +1 -0
- package/dist/family__migration.mjs +2 -0
- package/dist/family__pack.d.mts +3 -0
- package/dist/family__pack.mjs +3 -0
- package/dist/family__psl-infer.d.mts +1 -0
- package/dist/family__psl-infer.mjs +2 -0
- package/dist/family__runtime.d.mts +3 -0
- package/dist/family__runtime.mjs +3 -0
- package/dist/family__verify.d.mts +1 -0
- package/dist/family__verify.mjs +2 -0
- package/dist/migration-tools__aggregate.d.mts +1 -0
- package/dist/migration-tools__aggregate.mjs +2 -0
- package/dist/migration-tools__contract-snapshot-store.d.mts +1 -0
- package/dist/migration-tools__contract-snapshot-store.mjs +2 -0
- package/dist/migration-tools__hash.d.mts +1 -0
- package/dist/migration-tools__hash.mjs +2 -0
- package/dist/migration-tools__io.d.mts +1 -0
- package/dist/migration-tools__io.mjs +2 -0
- package/dist/migration-tools__spaces.d.mts +1 -0
- package/dist/migration-tools__spaces.mjs +2 -0
- package/dist/migration.d.mts +1 -0
- package/dist/migration.mjs +2 -0
- package/dist/orm-client.d.mts +1 -0
- package/dist/orm-client.mjs +2 -0
- package/dist/postgres-DfqgVPdF-DhNG3N-h.d.mts +133 -0
- package/dist/postgres-DfqgVPdF-DhNG3N-h.d.mts.map +1 -0
- package/dist/postgres-runtime-GybTEgP4-DpGY305_.mjs +7 -0
- package/dist/postgres-runtime-GybTEgP4-DpGY305_.mjs.map +1 -0
- package/dist/postgres-static-CRl91mRo-Dw1sFrog.mjs +74 -0
- package/dist/postgres-static-CRl91mRo-Dw1sFrog.mjs.map +1 -0
- package/dist/relational-core.d.mts +1 -0
- package/dist/relational-core.mjs +2 -0
- package/dist/relational-core__ast.d.mts +1 -0
- package/dist/relational-core__ast.mjs +2 -0
- package/dist/relational-core__codec-descriptor-registry.d.mts +1 -0
- package/dist/relational-core__codec-descriptor-registry.mjs +2 -0
- package/dist/relational-core__contract-free.d.mts +1 -0
- package/dist/relational-core__contract-free.mjs +2 -0
- package/dist/relational-core__expression.d.mts +1 -0
- package/dist/relational-core__expression.mjs +2 -0
- package/dist/relational-core__middleware.d.mts +1 -0
- package/dist/relational-core__middleware.mjs +2 -0
- package/dist/relational-core__plan.d.mts +1 -0
- package/dist/relational-core__plan.mjs +2 -0
- package/dist/relational-core__query-lane-context.d.mts +1 -0
- package/dist/relational-core__query-lane-context.mjs +2 -0
- package/dist/relational-core__types.d.mts +1 -0
- package/dist/relational-core__types.mjs +2 -0
- package/dist/runtime.d.mts +18 -0
- package/dist/runtime.d.mts.map +1 -0
- package/dist/runtime.mjs +239 -0
- package/dist/runtime.mjs.map +1 -0
- package/dist/schema-ir__types.d.mts +1 -0
- package/dist/schema-ir__types.mjs +2 -0
- package/dist/serverless.d.mts +62 -0
- package/dist/serverless.d.mts.map +1 -0
- package/dist/serverless.mjs +86 -0
- package/dist/serverless.mjs.map +1 -0
- package/dist/static.d.mts +24 -0
- package/dist/static.d.mts.map +1 -0
- package/dist/static.mjs +2 -0
- package/dist/target.d.mts +2 -0
- package/dist/target.mjs +2 -0
- package/dist/target__codec-descriptor.d.mts +1 -0
- package/dist/target__codec-descriptor.mjs +2 -0
- package/dist/target__codec-ids.d.mts +1 -0
- package/dist/target__codec-ids.mjs +2 -0
- package/dist/target__codec-types.d.mts +1 -0
- package/dist/target__codec-types.mjs +2 -0
- package/dist/target__codecs.d.mts +1 -0
- package/dist/target__codecs.mjs +2 -0
- package/dist/target__contract-free.d.mts +1 -0
- package/dist/target__contract-free.mjs +2 -0
- package/dist/target__control.d.mts +3 -0
- package/dist/target__control.mjs +3 -0
- package/dist/target__data-transform.d.mts +1 -0
- package/dist/target__data-transform.mjs +2 -0
- package/dist/target__ddl.d.mts +1 -0
- package/dist/target__ddl.mjs +2 -0
- package/dist/target__default-normalizer.d.mts +1 -0
- package/dist/target__default-normalizer.mjs +2 -0
- package/dist/target__diff-database-schema.d.mts +1 -0
- package/dist/target__diff-database-schema.mjs +2 -0
- package/dist/target__errors.d.mts +1 -0
- package/dist/target__errors.mjs +2 -0
- package/dist/target__issue-planner.d.mts +1 -0
- package/dist/target__issue-planner.mjs +2 -0
- package/dist/target__migration.d.mts +1 -0
- package/dist/target__migration.mjs +2 -0
- package/dist/target__native-type-normalizer.d.mts +1 -0
- package/dist/target__native-type-normalizer.mjs +2 -0
- package/dist/target__op-factory-call.d.mts +1 -0
- package/dist/target__op-factory-call.mjs +2 -0
- package/dist/target__pack.d.mts +3 -0
- package/dist/target__pack.mjs +3 -0
- package/dist/target__planner-ddl-builders.d.mts +1 -0
- package/dist/target__planner-ddl-builders.mjs +2 -0
- package/dist/target__planner-identity-values.d.mts +1 -0
- package/dist/target__planner-identity-values.mjs +2 -0
- package/dist/target__planner-produced-postgres-migration.d.mts +1 -0
- package/dist/target__planner-produced-postgres-migration.mjs +2 -0
- package/dist/target__planner-schema-lookup.d.mts +1 -0
- package/dist/target__planner-schema-lookup.mjs +2 -0
- package/dist/target__planner-sql-checks.d.mts +1 -0
- package/dist/target__planner-sql-checks.mjs +2 -0
- package/dist/target__planner-target-details.d.mts +1 -0
- package/dist/target__planner-target-details.mjs +2 -0
- package/dist/target__planner.d.mts +1 -0
- package/dist/target__planner.mjs +2 -0
- package/dist/target__render-ops.d.mts +1 -0
- package/dist/target__render-ops.mjs +2 -0
- package/dist/target__render-typescript.d.mts +1 -0
- package/dist/target__render-typescript.mjs +2 -0
- package/dist/target__rls-canonicalize.d.mts +1 -0
- package/dist/target__rls-canonicalize.mjs +2 -0
- package/dist/target__runtime.d.mts +3 -0
- package/dist/target__runtime.mjs +3 -0
- package/dist/target__schema-ir-annotations.d.mts +1 -0
- package/dist/target__schema-ir-annotations.mjs +2 -0
- package/dist/target__sql-utils.d.mts +1 -0
- package/dist/target__sql-utils.mjs +2 -0
- package/dist/target__types.d.mts +1 -0
- package/dist/target__types.mjs +2 -0
- package/dist/utils.d.mts +1 -0
- package/dist/utils.mjs +2 -0
- package/dist/utils__abortable.d.mts +1 -0
- package/dist/utils__abortable.mjs +2 -0
- package/dist/utils__array-equal.d.mts +1 -0
- package/dist/utils__array-equal.mjs +2 -0
- package/dist/utils__assertions.d.mts +1 -0
- package/dist/utils__assertions.mjs +2 -0
- package/dist/utils__canonical-stringify.d.mts +1 -0
- package/dist/utils__canonical-stringify.mjs +2 -0
- package/dist/utils__casts.d.mts +1 -0
- package/dist/utils__casts.mjs +2 -0
- package/dist/utils__defined.d.mts +1 -0
- package/dist/utils__defined.mjs +2 -0
- package/dist/utils__hash-content.d.mts +1 -0
- package/dist/utils__hash-content.mjs +2 -0
- package/dist/utils__internal-error.d.mts +1 -0
- package/dist/utils__internal-error.mjs +2 -0
- package/dist/utils__json.d.mts +1 -0
- package/dist/utils__json.mjs +2 -0
- package/dist/utils__promise.d.mts +1 -0
- package/dist/utils__promise.mjs +2 -0
- package/dist/utils__redact-db-url.d.mts +1 -0
- package/dist/utils__redact-db-url.mjs +2 -0
- package/dist/utils__result.d.mts +1 -0
- package/dist/utils__result.mjs +2 -0
- package/dist/utils__simplify-deep.d.mts +1 -0
- package/dist/utils__simplify-deep.mjs +2 -0
- package/dist/utils__structured-error.d.mts +1 -0
- package/dist/utils__structured-error.mjs +2 -0
- package/dist/utils__types.d.mts +1 -0
- package/dist/utils__types.mjs +2 -0
- package/dist/vite-plugin-contract-emit.d.mts +1 -0
- package/dist/vite-plugin-contract-emit.mjs +2 -0
- package/package.json +188 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@prisma/orm-family-sql/family/ir";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@prisma/orm-family-sql/family/migration";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@prisma/orm-family-sql/family/psl-infer";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@prisma/orm-family-sql/family/verify";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@prisma/orm-toolchain/migration-tools/aggregate";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@prisma/orm-toolchain/migration-tools/contract-snapshot-store";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@prisma/orm-toolchain/migration-tools/hash";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@prisma/orm-toolchain/migration-tools/io";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@prisma/orm-toolchain/migration-tools/spaces";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@prisma/orm-target-postgres/target/migration";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@prisma/orm-family-sql/orm-client";
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { EnumAccessor, EnumEntriesToAccessors, NamespacedEnums } from "@prisma/orm-framework/contract/enum-accessor";
|
|
2
|
+
import { BindSiteParams, Declaration, ExecutionContext, ParamsFromDeclaration, PreparedStatement, Runtime, SqlExecutionStackWithDriver, SqlMiddleware, SqlRuntimeExtensionDescriptor, TransactionContext, VerifyMarkerOption } from "@prisma/orm-family-sql/runtime";
|
|
3
|
+
import { CodecTypesBase, RawSqlTag } from "@prisma/orm-family-sql/relational-core/expression";
|
|
4
|
+
import { orm } from "@prisma/orm-family-sql/orm-client";
|
|
5
|
+
import { Client, Pool } from "pg";
|
|
6
|
+
import { Contract } from "@prisma/orm-framework/contract/types";
|
|
7
|
+
import { ExtractCodecTypes, SqlStorage } from "@prisma/orm-family-sql/contract/types";
|
|
8
|
+
import { Db } from "@prisma/orm-family-sql/builder/types";
|
|
9
|
+
import { SqlQueryPlan } from "@prisma/orm-family-sql/relational-core/plan";
|
|
10
|
+
//#region ../../../3-extensions/postgres/dist/postgres-DfqgVPdF.d.mts
|
|
11
|
+
//#region src/runtime/binding.d.ts
|
|
12
|
+
declare const isPgPool: (pg: Pool | Client) => pg is Pool;
|
|
13
|
+
declare const isPgClient: (pg: Pool | Client) => pg is Client;
|
|
14
|
+
type PostgresBinding = {
|
|
15
|
+
readonly kind: 'url';
|
|
16
|
+
readonly url: string;
|
|
17
|
+
} | {
|
|
18
|
+
readonly kind: 'pgPool';
|
|
19
|
+
readonly pool: Pool;
|
|
20
|
+
} | {
|
|
21
|
+
readonly kind: 'pgClient';
|
|
22
|
+
readonly client: Client;
|
|
23
|
+
};
|
|
24
|
+
type PostgresBindingInput = {
|
|
25
|
+
readonly binding: PostgresBinding;
|
|
26
|
+
readonly url?: never;
|
|
27
|
+
readonly pg?: never;
|
|
28
|
+
} | {
|
|
29
|
+
readonly url: string;
|
|
30
|
+
readonly binding?: never;
|
|
31
|
+
readonly pg?: never;
|
|
32
|
+
} | {
|
|
33
|
+
readonly pg: Pool | Client;
|
|
34
|
+
readonly binding?: never;
|
|
35
|
+
readonly url?: never;
|
|
36
|
+
};
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region src/runtime/native-enums.d.ts
|
|
39
|
+
declare function buildNamespacedNativeEnums(storage: SqlStorage): Record<string, Record<string, EnumAccessor>>;
|
|
40
|
+
type Present<T> = Exclude<T, undefined>;
|
|
41
|
+
type NamespaceValueSetEntries<TNs> = TNs extends {
|
|
42
|
+
readonly entries: {
|
|
43
|
+
readonly valueSet?: infer E;
|
|
44
|
+
};
|
|
45
|
+
} ? unknown extends E ? Record<never, never> : Present<E> : Record<never, never>;
|
|
46
|
+
type ValueSetEntry = {
|
|
47
|
+
readonly values: readonly unknown[];
|
|
48
|
+
};
|
|
49
|
+
type ValueSetMembers<Values extends readonly unknown[]> = { readonly [I in keyof Values]: {
|
|
50
|
+
readonly name: Extract<Values[I], string>;
|
|
51
|
+
readonly value: Values[I];
|
|
52
|
+
}; };
|
|
53
|
+
/**
|
|
54
|
+
* Projects a value-only `StorageValueSet`-shaped literal type onto the
|
|
55
|
+
* `{name, value}[]`-member shape `ContractEnumAccessor` expects, treating
|
|
56
|
+
* each value as its own name (Option B: a native-enum member is a value, not
|
|
57
|
+
* a name→value pair).
|
|
58
|
+
*/
|
|
59
|
+
type ValueSetToEnumEntry<Entry extends ValueSetEntry> = {
|
|
60
|
+
readonly members: ValueSetMembers<Entry['values']>;
|
|
61
|
+
};
|
|
62
|
+
type ValueSetEntriesToEnumEntries<Entries> = { readonly [K in keyof Entries]: Entries[K] extends ValueSetEntry ? ValueSetToEnumEntry<Entries[K]> : never; };
|
|
63
|
+
/**
|
|
64
|
+
* Accessor type for `db.nativeEnums`. Types off the namespace's `valueSet`
|
|
65
|
+
* entries — the same generic surface that types `db.enums` and column value
|
|
66
|
+
* unions — not a raw `native_enum` entity slot; `contract.d.ts` no longer
|
|
67
|
+
* emits one. For a no-emit (`typeof contract`) contract the storage type is
|
|
68
|
+
* non-literal and this degrades to the structural shape — the same
|
|
69
|
+
* emit/no-emit boundary column typing has (TML-2960).
|
|
70
|
+
*/
|
|
71
|
+
type NamespacedNativeEnums<TContract extends Contract> = { readonly [Ns in keyof TContract['storage']['namespaces']]: EnumEntriesToAccessors<ValueSetEntriesToEnumEntries<NamespaceValueSetEntries<TContract['storage']['namespaces'][Ns]>>>; };
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region src/runtime/postgres.d.ts
|
|
74
|
+
type PostgresTargetId = 'postgres';
|
|
75
|
+
type OrmClient<TContract extends Contract<SqlStorage>> = ReturnType<typeof orm<TContract>>;
|
|
76
|
+
interface PostgresTransactionContext<TContract extends Contract<SqlStorage>> extends TransactionContext {
|
|
77
|
+
readonly sql: Db<TContract>;
|
|
78
|
+
readonly orm: OrmClient<TContract>;
|
|
79
|
+
readonly enums: NamespacedEnums<TContract>;
|
|
80
|
+
readonly nativeEnums: NamespacedNativeEnums<TContract>;
|
|
81
|
+
}
|
|
82
|
+
interface PostgresClient<TContract extends Contract<SqlStorage>> {
|
|
83
|
+
readonly sql: Db<TContract>;
|
|
84
|
+
readonly orm: OrmClient<TContract>;
|
|
85
|
+
readonly enums: NamespacedEnums<TContract>;
|
|
86
|
+
readonly nativeEnums: NamespacedNativeEnums<TContract>;
|
|
87
|
+
readonly raw: RawSqlTag;
|
|
88
|
+
readonly context: ExecutionContext<TContract>;
|
|
89
|
+
readonly contract: TContract;
|
|
90
|
+
readonly stack: SqlExecutionStackWithDriver<PostgresTargetId>;
|
|
91
|
+
connect(bindingInput?: PostgresBindingInput): Promise<Runtime>;
|
|
92
|
+
runtime(): Runtime;
|
|
93
|
+
transaction<R>(fn: (tx: PostgresTransactionContext<TContract>) => PromiseLike<R>): Promise<R>;
|
|
94
|
+
prepare<D extends Declaration<CT>, Row, CT extends CodecTypesBase = ExtractCodecTypes<TContract> & CodecTypesBase>(declaration: D, callback: (sql: Db<TContract>, params: BindSiteParams<D>) => SqlQueryPlan<Row>): Promise<PreparedStatement<ParamsFromDeclaration<D, CT>, Row>>;
|
|
95
|
+
close(): Promise<void>;
|
|
96
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
97
|
+
}
|
|
98
|
+
interface PostgresOptionsBase {
|
|
99
|
+
readonly extensions?: readonly SqlRuntimeExtensionDescriptor<PostgresTargetId>[];
|
|
100
|
+
readonly middleware?: readonly SqlMiddleware[];
|
|
101
|
+
readonly verifyMarker?: VerifyMarkerOption;
|
|
102
|
+
readonly poolOptions?: {
|
|
103
|
+
readonly connectionTimeoutMillis?: number;
|
|
104
|
+
readonly idleTimeoutMillis?: number;
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
interface PostgresBindingOptions {
|
|
108
|
+
readonly binding?: PostgresBinding;
|
|
109
|
+
readonly url?: string;
|
|
110
|
+
readonly pg?: Pool | Client;
|
|
111
|
+
}
|
|
112
|
+
type PostgresOptionsWithContract<TContract extends Contract<SqlStorage>> = PostgresBindingOptions & PostgresOptionsBase & {
|
|
113
|
+
readonly contract: TContract;
|
|
114
|
+
readonly contractJson?: never;
|
|
115
|
+
};
|
|
116
|
+
type PostgresOptionsWithContractJson<TContract extends Contract<SqlStorage>> = PostgresBindingOptions & PostgresOptionsBase & {
|
|
117
|
+
readonly contractJson: unknown;
|
|
118
|
+
readonly contract?: never;
|
|
119
|
+
readonly _contract?: TContract;
|
|
120
|
+
};
|
|
121
|
+
type PostgresOptions<TContract extends Contract<SqlStorage>> = PostgresOptionsWithContract<TContract> | PostgresOptionsWithContractJson<TContract>;
|
|
122
|
+
/**
|
|
123
|
+
* Creates a lazy Postgres client from either `contractJson` or a TypeScript-authored `contract`.
|
|
124
|
+
* Static query surfaces are available immediately, while `runtime()` instantiates the driver/pool on first call.
|
|
125
|
+
*
|
|
126
|
+
* - No-emit: pass a TypeScript-authored contract. Example: postgres({ contract })
|
|
127
|
+
* - Emitted: pass Contract type explicitly. Example: postgres<Contract>({ contractJson, url })
|
|
128
|
+
*/
|
|
129
|
+
declare function postgres<TContract extends Contract<SqlStorage>>(options: PostgresOptionsWithContract<TContract>): PostgresClient<TContract>;
|
|
130
|
+
declare function postgres<TContract extends Contract<SqlStorage>>(options: PostgresOptionsWithContractJson<TContract>): PostgresClient<TContract>;
|
|
131
|
+
//#endregion
|
|
132
|
+
export { PostgresOptionsBase as a, PostgresTargetId as c, isPgPool as d, postgres as f, PostgresOptions as i, buildNamespacedNativeEnums as l, PostgresBinding as n, PostgresOptionsWithContract as o, PostgresClient as r, PostgresOptionsWithContractJson as s, NamespacedNativeEnums as t, isPgClient as u };
|
|
133
|
+
//# sourceMappingURL=postgres-DfqgVPdF-DhNG3N-h.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres-DfqgVPdF-DhNG3N-h.d.mts","names":[],"sources":["../../../../3-extensions/postgres/dist/postgres-DfqgVPdF.d.mts"],"mappings":";;;;;;;;;;;cAUc,WAAW,IAAI,OAAO,WAAW,MAAM;cACvC,aAAa,IAAI,OAAO,WAAW,MAAM;KAClD;WACM;WACA;;WAEA;WACA,MAAM;;WAEN;WACA,QAAQ;;KAEd;WACM,SAAS;WACT;WACA;;WAEA;WACA;WACA;;WAEA,IAAI,OAAO;WACX;WACA;;;;iBAIM,2BAA2B,SAAS,aAAa,eAAe,eAAe;KAC3F,QAAQ,KAAK,QAAQ;KACrB,yBAAyB,OAAO;WAC1B;aACE,iBAAiB;;oBAEV,IAAI,uBAAuB,QAAQ,KAAK;KACvD;WACM;;KAEN,gBAAgB,iDAAiD,WAAW;WACtE,MAAM,QAAQ,OAAO;WACrB,OAAO,OAAO;;;;;;;;KAQpB,oBAAoB,cAAc;WAC5B,SAAS,gBAAgB;;KAE/B,6BAA6B,uBAAuB,WAAW,UAAU,QAAQ,WAAW,gBAAgB,oBAAoB,QAAQ;;;;;;;;;KASxI,sBAAsB,kBAAkB,wBAAwB,YAAY,qCAAqC,uBAAuB,6BAA6B,yBAAyB,mCAAmC;;;KAGjO;KACA,UAAU,kBAAkB,SAAS,eAAe,kBAAkB,IAAI;UACrE,2BAA2B,kBAAkB,SAAS,qBAAqB;WAC1E,KAAK,GAAG;WACR,KAAK,UAAU;WACf,OAAO,gBAAgB;WACvB,aAAa,sBAAsB;;UAEpC,eAAe,kBAAkB,SAAS;WACzC,KAAK,GAAG;WACR,KAAK,UAAU;WACf,OAAO,gBAAgB;WACvB,aAAa,sBAAsB;WACnC,KAAK;WACL,SAAS,iBAAiB;WAC1B,UAAU;WACV,OAAO,4BAA4B;EAC5C,QAAQ,eAAe,uBAAuB,QAAQ;EACtD,WAAW;EACX,YAAY,GAAG,KAAK,IAAI,2BAA2B,eAAe,YAAY,KAAK,QAAQ;EAC3F,QAAQ,UAAU,YAAY,KAAK,KAAK,WAAW,iBAAiB,kBAAkB,aAAa,gBAAgB,aAAa,GAAG,WAAW,KAAK,GAAG,YAAY,QAAQ,eAAe,OAAO,aAAa,OAAO,QAAQ,kBAAkB,sBAAsB,GAAG,KAAK;EAC5Q,SAAS;GACR,OAAO,iBAAiB;;UAEjB;WACC,sBAAsB,8BAA8B;WACpD,sBAAsB;WACtB,eAAe;WACf;aACE;aACA;;;UAGH;WACC,UAAU;WACV;WACA,KAAK,OAAO;;KAElB,4BAA4B,kBAAkB,SAAS,eAAe,yBAAyB;WACzF,UAAU;WACV;;KAEN,gCAAgC,kBAAkB,SAAS,eAAe,yBAAyB;WAC7F;WACA;WACA,YAAY;;KAElB,gBAAgB,kBAAkB,SAAS,eAAe,4BAA4B,aAAa,gCAAgC;;;;;;;;iBAQvH,SAAS,kBAAkB,SAAS,aAAa,SAAS,4BAA4B,aAAa,eAAe;iBAClH,SAAS,kBAAkB,SAAS,aAAa,SAAS,gCAAgC,aAAa,eAAe"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SqlRuntimeBase } from "@prisma/orm-family-sql/runtime";
|
|
2
|
+
//#region ../../../3-extensions/postgres/dist/postgres-runtime-GybTEgP4.mjs
|
|
3
|
+
var PostgresRuntimeImpl = class extends SqlRuntimeBase {};
|
|
4
|
+
//#endregion
|
|
5
|
+
export { PostgresRuntimeImpl as t };
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=postgres-runtime-GybTEgP4-DpGY305_.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres-runtime-GybTEgP4-DpGY305_.mjs","names":[],"sources":["../../../../3-extensions/postgres/dist/postgres-runtime-GybTEgP4.mjs"],"sourcesContent":["import { SqlRuntimeBase } from \"@internal/sql-runtime\";\n//#region src/runtime/postgres-runtime.ts\nvar PostgresRuntimeImpl = class extends SqlRuntimeBase {};\n//#endregion\nexport { PostgresRuntimeImpl as t };\n\n//# sourceMappingURL=postgres-runtime-GybTEgP4.mjs.map"],"mappings":";;AAEA,IAAI,sBAAsB,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { PG_ENUM_CODEC_ID } from "@prisma/orm-target-postgres/target/codec-ids";
|
|
2
|
+
import { buildNamespacedEnums, createEnumAccessor } from "@prisma/orm-framework/contract/enum-accessor";
|
|
3
|
+
import postgresAdapter from "@prisma/orm-target-postgres/adapter/runtime";
|
|
4
|
+
import { sql } from "@prisma/orm-family-sql/builder/runtime";
|
|
5
|
+
import { createExecutionContext, createSqlExecutionStack } from "@prisma/orm-family-sql/runtime";
|
|
6
|
+
import postgresTarget, { PostgresContractSerializer } from "@prisma/orm-target-postgres/target/runtime";
|
|
7
|
+
import { createRawSql } from "@prisma/orm-family-sql/relational-core/expression";
|
|
8
|
+
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
9
|
+
//#region ../../../3-extensions/postgres/dist/postgres-static-CRl91mRo.mjs
|
|
10
|
+
/**
|
|
11
|
+
* Reads the namespace's `valueSet` entries directly off the plain contract
|
|
12
|
+
* shape (`storage.namespaces[id].entries.valueSet`), not through a hydrated
|
|
13
|
+
* `PostgresSchema` class instance — the same plain-data path `db.enums`
|
|
14
|
+
* reads `domain.namespaces[id].enum` through. Works on a `validateContract`'d
|
|
15
|
+
* JSON contract as well as one produced by `PostgresContractSerializer`.
|
|
16
|
+
*
|
|
17
|
+
* A native enum is never re-emitted as its own entity: once `native_enum` is
|
|
18
|
+
* lowered, its member values live on in the `valueSet` entry it derives (the
|
|
19
|
+
* SQL family's generic `deriveValueSet` mechanism) — the same slot
|
|
20
|
+
* `column.valueSet`-typed columns read. A member is a value, not a
|
|
21
|
+
* name→value pair (matching `CREATE TYPE … AS ENUM ('a', 'b')`), so each
|
|
22
|
+
* value doubles as its own accessor name.
|
|
23
|
+
*/
|
|
24
|
+
function buildNativeEnumsMapForNamespace(storage, namespaceId) {
|
|
25
|
+
const result = {};
|
|
26
|
+
const valueSets = storage.namespaces[namespaceId]?.entries.valueSet;
|
|
27
|
+
if (!valueSets) return result;
|
|
28
|
+
for (const [name, valueSet] of Object.entries(valueSets)) result[name] = createEnumAccessor({
|
|
29
|
+
codecId: PG_ENUM_CODEC_ID,
|
|
30
|
+
members: valueSet.values.map((value) => ({
|
|
31
|
+
name: String(value),
|
|
32
|
+
value
|
|
33
|
+
}))
|
|
34
|
+
});
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
function buildNamespacedNativeEnums(storage) {
|
|
38
|
+
const result = {};
|
|
39
|
+
for (const namespaceId of Object.keys(storage.namespaces)) result[namespaceId] = buildNativeEnumsMapForNamespace(storage, namespaceId);
|
|
40
|
+
return result;
|
|
41
|
+
}
|
|
42
|
+
function buildPostgresStaticContext(context, rawCodecInferer) {
|
|
43
|
+
const sqlDb = sql({
|
|
44
|
+
context,
|
|
45
|
+
rawCodecInferer
|
|
46
|
+
});
|
|
47
|
+
const raw = createRawSql(rawCodecInferer);
|
|
48
|
+
const enums = Object.freeze(buildNamespacedEnums(context.contract.domain));
|
|
49
|
+
const nativeEnums = blindCast(Object.freeze(buildNamespacedNativeEnums(context.contract.storage)));
|
|
50
|
+
return {
|
|
51
|
+
context,
|
|
52
|
+
contract: context.contract,
|
|
53
|
+
enums,
|
|
54
|
+
nativeEnums,
|
|
55
|
+
sql: sqlDb,
|
|
56
|
+
raw
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function postgresStatic(options) {
|
|
60
|
+
const contract = blindCast(new PostgresContractSerializer().deserializeContract(options.contractJson));
|
|
61
|
+
const stack = createSqlExecutionStack({
|
|
62
|
+
target: postgresTarget,
|
|
63
|
+
adapter: postgresAdapter,
|
|
64
|
+
extensions: options.extensions ?? []
|
|
65
|
+
});
|
|
66
|
+
return buildPostgresStaticContext(createExecutionContext({
|
|
67
|
+
contract,
|
|
68
|
+
stack
|
|
69
|
+
}), stack.adapter.rawCodecInferer);
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
export { buildPostgresStaticContext as n, postgresStatic as r, buildNamespacedNativeEnums as t };
|
|
73
|
+
|
|
74
|
+
//# sourceMappingURL=postgres-static-CRl91mRo-Dw1sFrog.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres-static-CRl91mRo-Dw1sFrog.mjs","names":[],"sources":["../../../../3-extensions/postgres/dist/postgres-static-CRl91mRo.mjs"],"sourcesContent":["import { PG_ENUM_CODEC_ID } from \"@internal/target-postgres/codec-ids\";\nimport { buildNamespacedEnums, createEnumAccessor } from \"@internal/contract/enum-accessor\";\nimport postgresAdapter from \"@internal/adapter-postgres/runtime\";\nimport { sql } from \"@internal/sql-builder/runtime\";\nimport { createExecutionContext, createSqlExecutionStack } from \"@internal/sql-runtime\";\nimport postgresTarget, { PostgresContractSerializer } from \"@internal/target-postgres/runtime\";\nimport { createRawSql } from \"@internal/sql-relational-core/expression\";\nimport { blindCast } from \"@internal/utils/casts\";\n//#region src/runtime/native-enums.ts\n/**\n* Reads the namespace's `valueSet` entries directly off the plain contract\n* shape (`storage.namespaces[id].entries.valueSet`), not through a hydrated\n* `PostgresSchema` class instance — the same plain-data path `db.enums`\n* reads `domain.namespaces[id].enum` through. Works on a `validateContract`'d\n* JSON contract as well as one produced by `PostgresContractSerializer`.\n*\n* A native enum is never re-emitted as its own entity: once `native_enum` is\n* lowered, its member values live on in the `valueSet` entry it derives (the\n* SQL family's generic `deriveValueSet` mechanism) — the same slot\n* `column.valueSet`-typed columns read. A member is a value, not a\n* name→value pair (matching `CREATE TYPE … AS ENUM ('a', 'b')`), so each\n* value doubles as its own accessor name.\n*/\nfunction buildNativeEnumsMapForNamespace(storage, namespaceId) {\n\tconst result = {};\n\tconst valueSets = storage.namespaces[namespaceId]?.entries.valueSet;\n\tif (!valueSets) return result;\n\tfor (const [name, valueSet] of Object.entries(valueSets)) result[name] = createEnumAccessor({\n\t\tcodecId: PG_ENUM_CODEC_ID,\n\t\tmembers: valueSet.values.map((value) => ({\n\t\t\tname: String(value),\n\t\t\tvalue\n\t\t}))\n\t});\n\treturn result;\n}\nfunction buildNamespacedNativeEnums(storage) {\n\tconst result = {};\n\tfor (const namespaceId of Object.keys(storage.namespaces)) result[namespaceId] = buildNativeEnumsMapForNamespace(storage, namespaceId);\n\treturn result;\n}\n//#endregion\n//#region src/static/postgres-static.ts\nfunction buildPostgresStaticContext(context, rawCodecInferer) {\n\tconst sqlDb = sql({\n\t\tcontext,\n\t\trawCodecInferer\n\t});\n\tconst raw = createRawSql(rawCodecInferer);\n\tconst enums = Object.freeze(buildNamespacedEnums(context.contract.domain));\n\tconst nativeEnums = blindCast(Object.freeze(buildNamespacedNativeEnums(context.contract.storage)));\n\treturn {\n\t\tcontext,\n\t\tcontract: context.contract,\n\t\tenums,\n\t\tnativeEnums,\n\t\tsql: sqlDb,\n\t\traw\n\t};\n}\nfunction postgresStatic(options) {\n\tconst contract = blindCast(new PostgresContractSerializer().deserializeContract(options.contractJson));\n\tconst stack = createSqlExecutionStack({\n\t\ttarget: postgresTarget,\n\t\tadapter: postgresAdapter,\n\t\textensions: options.extensions ?? []\n\t});\n\treturn buildPostgresStaticContext(createExecutionContext({\n\t\tcontract,\n\t\tstack\n\t}), stack.adapter.rawCodecInferer);\n}\n//#endregion\nexport { postgresStatic as n, buildNamespacedNativeEnums as r, buildPostgresStaticContext as t };\n\n//# sourceMappingURL=postgres-static-CRl91mRo.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAuBA,SAAS,gCAAgC,SAAS,aAAa;CAC9D,MAAM,SAAS,CAAC;CAChB,MAAM,YAAY,QAAQ,WAAW,YAAY,EAAE,QAAQ;CAC3D,IAAI,CAAC,WAAW,OAAO;CACvB,KAAK,MAAM,CAAC,MAAM,aAAa,OAAO,QAAQ,SAAS,GAAG,OAAO,QAAQ,mBAAmB;EAC3F,SAAS;EACT,SAAS,SAAS,OAAO,KAAK,WAAW;GACxC,MAAM,OAAO,KAAK;GAClB;EACD,EAAE;CACH,CAAC;CACD,OAAO;AACR;AACA,SAAS,2BAA2B,SAAS;CAC5C,MAAM,SAAS,CAAC;CAChB,KAAK,MAAM,eAAe,OAAO,KAAK,QAAQ,UAAU,GAAG,OAAO,eAAe,gCAAgC,SAAS,WAAW;CACrI,OAAO;AACR;AAGA,SAAS,2BAA2B,SAAS,iBAAiB;CAC7D,MAAM,QAAQ,IAAI;EACjB;EACA;CACD,CAAC;CACD,MAAM,MAAM,aAAa,eAAe;CACxC,MAAM,QAAQ,OAAO,OAAO,qBAAqB,QAAQ,SAAS,MAAM,CAAC;CACzE,MAAM,cAAc,UAAU,OAAO,OAAO,2BAA2B,QAAQ,SAAS,OAAO,CAAC,CAAC;CACjG,OAAO;EACN;EACA,UAAU,QAAQ;EAClB;EACA;EACA,KAAK;EACL;CACD;AACD;AACA,SAAS,eAAe,SAAS;CAChC,MAAM,WAAW,UAAU,IAAI,2BAA2B,CAAC,CAAC,oBAAoB,QAAQ,YAAY,CAAC;CACrG,MAAM,QAAQ,wBAAwB;EACrC,QAAQ;EACR,SAAS;EACT,YAAY,QAAQ,cAAc,CAAC;CACpC,CAAC;CACD,OAAO,2BAA2B,uBAAuB;EACxD;EACA;CACD,CAAC,GAAG,MAAM,QAAQ,eAAe;AAClC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@prisma/orm-family-sql/relational-core";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@prisma/orm-family-sql/relational-core/ast";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@prisma/orm-family-sql/relational-core/codec-descriptor-registry";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@prisma/orm-family-sql/relational-core/contract-free";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@prisma/orm-family-sql/relational-core/expression";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@prisma/orm-family-sql/relational-core/middleware";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@prisma/orm-family-sql/relational-core/plan";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@prisma/orm-family-sql/relational-core/query-lane-context";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@prisma/orm-family-sql/relational-core/types";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { a as PostgresOptionsBase, d as isPgPool, f as postgres, i as PostgresOptions, l as buildNamespacedNativeEnums, n as PostgresBinding, o as PostgresOptionsWithContract, r as PostgresClient, s as PostgresOptionsWithContractJson, t as NamespacedNativeEnums, u as isPgClient } from "./postgres-DfqgVPdF-DhNG3N-h.mjs";
|
|
2
|
+
import { Runtime, SqlRuntimeBase } from "@prisma/orm-family-sql/runtime";
|
|
3
|
+
import { Contract } from "@prisma/orm-framework/contract/types";
|
|
4
|
+
import { SqlStorage } from "@prisma/orm-family-sql/contract/types";
|
|
5
|
+
//#region ../../../3-extensions/postgres/dist/runtime.d.mts
|
|
6
|
+
//#region src/runtime/postgres-runtime.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* The Postgres runtime interface. App code depends on this — `postgres()` returns it
|
|
9
|
+
* and `Runtime` (the common interface) is the everyday parameter type.
|
|
10
|
+
*
|
|
11
|
+
* `PostgresRuntimeImpl` is the implementing class. It is exported so that other
|
|
12
|
+
* extensions (e.g. Supabase) can subclass it; app code never references it directly.
|
|
13
|
+
*/
|
|
14
|
+
interface PostgresRuntime extends Runtime {}
|
|
15
|
+
declare class PostgresRuntimeImpl<TContract extends Contract<SqlStorage> = Contract<SqlStorage>> extends SqlRuntimeBase<TContract> {}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { type NamespacedNativeEnums, type PostgresBinding, type PostgresClient, type PostgresOptions, type PostgresOptionsBase, type PostgresOptionsWithContract, type PostgresOptionsWithContractJson, type PostgresRuntime, PostgresRuntimeImpl, buildNamespacedNativeEnums, postgres as default, isPgClient, isPgPool };
|
|
18
|
+
//# sourceMappingURL=runtime.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.mts","names":[],"sources":["../../../../3-extensions/postgres/dist/runtime.d.mts"],"mappings":";;;;;;;;;;;;;UAYU,wBAAwB;cACpB,oBAAoB,kBAAkB,SAAS,cAAc,SAAS,qBAAqB,eAAe"}
|