@a_team/prisma 3.2.7-win → 3.2.8-linux

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.
@@ -56,6 +56,13 @@ export declare type Args<T, F extends Operation> = T extends {
56
56
 
57
57
  export declare type Args_3<T, F extends Operation> = Args<T, F>;
58
58
 
59
+ /**
60
+ * Original `quaint::ValueType` enum tag from Prisma's `quaint`.
61
+ * Query arguments marked with this type are sanitized before being sent to the database.
62
+ * Notice while a query argument may be `null`, `ArgType` is guaranteed to be defined.
63
+ */
64
+ declare type ArgType = 'Int32' | 'Int64' | 'Float' | 'Double' | 'Text' | 'Enum' | 'EnumArray' | 'Bytes' | 'Boolean' | 'Char' | 'Array' | 'Numeric' | 'Json' | 'Xml' | 'Uuid' | 'DateTime' | 'Date' | 'Time';
65
+
59
66
  /**
60
67
  * Attributes is a map from string to attribute values.
61
68
  *
@@ -140,6 +147,15 @@ export declare type ClientOptionDef = undefined | {
140
147
  [K in string]: any;
141
148
  };
142
149
 
150
+ export declare type ClientOtherOps = {
151
+ $queryRaw<T = unknown>(query: TemplateStringsArray | Sql, ...values: any[]): PrismaPromise<T>;
152
+ $queryRawTyped<T>(query: TypedSql<unknown[], T>): PrismaPromise<T[]>;
153
+ $queryRawUnsafe<T = unknown>(query: string, ...values: any[]): PrismaPromise<T>;
154
+ $executeRaw(query: TemplateStringsArray | Sql, ...values: any[]): PrismaPromise<number>;
155
+ $executeRawUnsafe(query: string, ...values: any[]): PrismaPromise<number>;
156
+ $runCommandRaw(command: InputJsonObject): PrismaPromise<JsonObject>;
157
+ };
158
+
143
159
  declare type ColumnType = (typeof ColumnTypeEnum)[keyof typeof ColumnTypeEnum];
144
160
 
145
161
  declare const ColumnTypeEnum: {
@@ -603,6 +619,8 @@ declare function defineExtension(ext: ExtensionArgs | ((client: Client) => Clien
603
619
 
604
620
  declare const denylist: readonly ["$connect", "$disconnect", "$on", "$transaction", "$use", "$extends"];
605
621
 
622
+ export declare function deserializeJsonResponse(result: unknown): unknown;
623
+
606
624
  export declare type DevTypeMapDef = {
607
625
  meta: {
608
626
  modelProps: string;
@@ -852,11 +870,13 @@ export declare namespace DMMF {
852
870
  }
853
871
  }
854
872
 
873
+ export declare function dmmfToRuntimeDataModel(dmmfDataModel: DMMF.Datamodel): RuntimeDataModel;
874
+
855
875
  export declare interface DriverAdapter extends Queryable {
856
876
  /**
857
877
  * Starts new transaction.
858
878
  */
859
- startTransaction(): Promise<Result_4<Transaction>>;
879
+ transactionContext(): Promise<Result_4<TransactionContext>>;
860
880
  /**
861
881
  * Optional method that returns extra connection info
862
882
  */
@@ -879,7 +899,7 @@ export declare type DynamicClientExtensionThis<TypeMap extends TypeMapDef, TypeM
879
899
  } & {
880
900
  [P in Exclude<TypeMap['meta']['modelProps'], keyof ExtArgs['client']>]: DynamicModelExtensionThis<TypeMap, ModelKey<TypeMap, P>, ExtArgs, ClientOptions>;
881
901
  } & {
882
- [P in Exclude<keyof TypeMap['other']['operations'], keyof ExtArgs['client']>]: <R = GetResult<TypeMap['other']['payload'], any, P & Operation, ClientOptions>>(...args: ToTuple<TypeMap['other']['operations'][P]['args']>) => PrismaPromise<R>;
902
+ [P in Exclude<keyof TypeMap['other']['operations'], keyof ExtArgs['client']>]: P extends keyof ClientOtherOps ? ClientOtherOps[P] : never;
883
903
  } & {
884
904
  [P in Exclude<ClientBuiltInProp, keyof ExtArgs['client']>]: DynamicClientExtensionThisBuiltin<TypeMap, TypeMapCb, ExtArgs, ClientOptions>[P];
885
905
  } & {
@@ -1121,6 +1141,7 @@ declare type EngineSpan = {
1121
1141
  trace_id: string;
1122
1142
  span_id: string;
1123
1143
  }[];
1144
+ kind: EngineSpanKind;
1124
1145
  };
1125
1146
 
1126
1147
  declare type EngineSpanEvent = {
@@ -1128,6 +1149,8 @@ declare type EngineSpanEvent = {
1128
1149
  spans: EngineSpan[];
1129
1150
  };
1130
1151
 
1152
+ declare type EngineSpanKind = 'client' | 'internal';
1153
+
1131
1154
  declare type EnvPaths = {
1132
1155
  rootEnvPath: string | null;
1133
1156
  schemaEnvPath: string | undefined;
@@ -1282,6 +1305,8 @@ declare namespace Extensions_2 {
1282
1305
  export {
1283
1306
  InternalArgs,
1284
1307
  DefaultArgs,
1308
+ GetPayloadResultExtensionKeys,
1309
+ GetPayloadResultExtensionObject,
1285
1310
  GetPayloadResult,
1286
1311
  GetSelect,
1287
1312
  GetOmit,
@@ -1310,6 +1335,7 @@ declare namespace Extensions_2 {
1310
1335
  DevTypeMapDef,
1311
1336
  DevTypeMapFnDef,
1312
1337
  ClientOptionDef,
1338
+ ClientOtherOps,
1313
1339
  TypeMapCbDef,
1314
1340
  ModelKey,
1315
1341
  RequiredExtensionArgs as UserArgs
@@ -1387,7 +1413,7 @@ export declare type GetFindResult<P extends OperationPayload, A, ClientOptions>
1387
1413
  } & Record<string, unknown> | {
1388
1414
  include: infer I extends object;
1389
1415
  } & Record<string, unknown> ? {
1390
- [K in keyof S | keyof I as (S & I)[K] extends false | undefined | null ? never : K]: (S & I)[K] extends object ? P extends SelectablePayloadFields<K, (infer O)[]> ? O extends OperationPayload ? GetFindResult<O, (S & I)[K], ClientOptions>[] : never : P extends SelectablePayloadFields<K, infer O | null> ? O extends OperationPayload ? GetFindResult<O, (S & I)[K], ClientOptions> | SelectField<P, K> & null : never : K extends '_count' ? Count<GetFindResult<P, (S & I)[K], ClientOptions>> : never : P extends SelectablePayloadFields<K, (infer O)[]> ? O extends OperationPayload ? DefaultSelection<O, {}, ClientOptions>[] : never : P extends SelectablePayloadFields<K, infer O | null> ? O extends OperationPayload ? DefaultSelection<O, {}, ClientOptions> | SelectField<P, K> & null : never : P extends {
1416
+ [K in keyof S | keyof I as (S & I)[K] extends false | undefined | Skip | null ? never : K]: (S & I)[K] extends object ? P extends SelectablePayloadFields<K, (infer O)[]> ? O extends OperationPayload ? GetFindResult<O, (S & I)[K], ClientOptions>[] : never : P extends SelectablePayloadFields<K, infer O | null> ? O extends OperationPayload ? GetFindResult<O, (S & I)[K], ClientOptions> | SelectField<P, K> & null : never : K extends '_count' ? Count<GetFindResult<P, (S & I)[K], ClientOptions>> : never : P extends SelectablePayloadFields<K, (infer O)[]> ? O extends OperationPayload ? DefaultSelection<O, {}, ClientOptions>[] : never : P extends SelectablePayloadFields<K, infer O | null> ? O extends OperationPayload ? DefaultSelection<O, {}, ClientOptions> | SelectField<P, K> & null : never : P extends {
1391
1417
  scalars: {
1392
1418
  [k in K]: infer O;
1393
1419
  };
@@ -1406,14 +1432,18 @@ export declare type GetGroupByResult<P extends OperationPayload, A> = A extends
1406
1432
  [K in A['by']]: P['scalars'][K];
1407
1433
  }> : {}[];
1408
1434
 
1409
- export declare type GetOmit<BaseKeys extends string, R extends InternalArgs['result'][string]> = {
1410
- [K in (string extends keyof R ? never : keyof R) | BaseKeys]?: boolean;
1435
+ export declare type GetOmit<BaseKeys extends string, R extends InternalArgs['result'][string], ExtraType = never> = {
1436
+ [K in (string extends keyof R ? never : keyof R) | BaseKeys]?: boolean | ExtraType;
1411
1437
  };
1412
1438
 
1413
- export declare type GetPayloadResult<Base extends Record<any, any>, R extends InternalArgs['result'][string], KR extends keyof R = string extends keyof R ? never : keyof R> = unknown extends R ? Base : {
1414
- [K in KR | keyof Base]: K extends KR ? R[K] extends () => {
1439
+ export declare type GetPayloadResult<Base extends Record<any, any>, R extends InternalArgs['result'][string]> = Omit<Base, GetPayloadResultExtensionKeys<R>> & GetPayloadResultExtensionObject<R>;
1440
+
1441
+ export declare type GetPayloadResultExtensionKeys<R extends InternalArgs['result'][string], KR extends keyof R = string extends keyof R ? never : keyof R> = KR;
1442
+
1443
+ export declare type GetPayloadResultExtensionObject<R extends InternalArgs['result'][string]> = {
1444
+ [K in GetPayloadResultExtensionKeys<R>]: R[K] extends () => {
1415
1445
  compute: (...args: any) => infer C;
1416
- } ? C : never : Base[K];
1446
+ } ? C : never;
1417
1447
  };
1418
1448
 
1419
1449
  export declare function getPrismaClient(config: GetPrismaClientConfig): {
@@ -1494,6 +1524,11 @@ export declare function getPrismaClient(config: GetPrismaClientConfig): {
1494
1524
  * @returns
1495
1525
  */
1496
1526
  $queryRaw(query: TemplateStringsArray | Sql, ...values: any[]): PrismaPromise_2<unknown>;
1527
+ /**
1528
+ * Counterpart to $queryRaw, that returns strongly typed results
1529
+ * @param typedSql
1530
+ */
1531
+ $queryRawTyped(typedSql: UnknownTypedSql): PrismaPromise_2<unknown>;
1497
1532
  /**
1498
1533
  * Unsafe counterpart of `$queryRaw` that is susceptible to SQL injections
1499
1534
  * @see https://github.com/prisma/prisma/issues/7142
@@ -1646,6 +1681,7 @@ export declare type GetResult<Payload extends OperationPayload, Args, OperationN
1646
1681
  count: GetCountResult<Args>;
1647
1682
  groupBy: GetGroupByResult<Payload, Args>;
1648
1683
  $queryRaw: unknown;
1684
+ $queryRawTyped: unknown;
1649
1685
  $executeRaw: number;
1650
1686
  $queryRawUnsafe: unknown;
1651
1687
  $executeRawUnsafe: number;
@@ -1696,6 +1732,38 @@ declare type HandleErrorParams = {
1696
1732
  */
1697
1733
  declare type HrTime = [number, number];
1698
1734
 
1735
+ /**
1736
+ * Matches a JSON array.
1737
+ * Unlike \`JsonArray\`, readonly arrays are assignable to this type.
1738
+ */
1739
+ export declare interface InputJsonArray extends ReadonlyArray<InputJsonValue | null> {
1740
+ }
1741
+
1742
+ /**
1743
+ * Matches a JSON object.
1744
+ * Unlike \`JsonObject\`, this type allows undefined and read-only properties.
1745
+ */
1746
+ export declare type InputJsonObject = {
1747
+ readonly [Key in string]?: InputJsonValue | null;
1748
+ };
1749
+
1750
+ /**
1751
+ * Matches any valid value that can be used as an input for operations like
1752
+ * create and update as the value of a JSON field. Unlike \`JsonValue\`, this
1753
+ * type allows read-only arrays and read-only object properties and disallows
1754
+ * \`null\` at the top level.
1755
+ *
1756
+ * \`null\` cannot be used as the value of a JSON field because its meaning
1757
+ * would be ambiguous. Use \`Prisma.JsonNull\` to store the JSON null value or
1758
+ * \`Prisma.DbNull\` to clear the JSON value and set the field to the database
1759
+ * NULL value instead.
1760
+ *
1761
+ * @see https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields#filtering-by-null-values
1762
+ */
1763
+ export declare type InputJsonValue = string | number | boolean | InputJsonObject | InputJsonArray | {
1764
+ toJSON(): unknown;
1765
+ };
1766
+
1699
1767
  declare type InteractiveTransactionInfo<Payload = unknown> = {
1700
1768
  /**
1701
1769
  * Transaction ID returned by the query engine.
@@ -1779,6 +1847,10 @@ declare enum IsolationLevel {
1779
1847
  Serializable = "Serializable"
1780
1848
  }
1781
1849
 
1850
+ declare function isSkip(value: unknown): value is Skip;
1851
+
1852
+ export declare function isTypedSql(value: unknown): value is UnknownTypedSql;
1853
+
1782
1854
  export declare type ITXClientDenyList = (typeof denylist)[number];
1783
1855
 
1784
1856
  export declare const itxClientDenyList: readonly (string | symbol)[];
@@ -1801,7 +1873,7 @@ export declare type JsArgs = {
1801
1873
  [argName: string]: JsInputValue;
1802
1874
  };
1803
1875
 
1804
- export declare type JsInputValue = null | undefined | string | number | boolean | bigint | Uint8Array | Date | DecimalJsLike | ObjectEnumValue | RawParameters | JsonConvertible | FieldRef<string, unknown> | JsInputValue[] | {
1876
+ export declare type JsInputValue = null | undefined | string | number | boolean | bigint | Uint8Array | Date | DecimalJsLike | ObjectEnumValue | RawParameters | JsonConvertible | FieldRef<string, unknown> | JsInputValue[] | Skip | {
1805
1877
  [key: string]: JsInputValue;
1806
1878
  };
1807
1879
 
@@ -1809,10 +1881,14 @@ declare type JsonArgumentValue = number | string | boolean | null | RawTaggedVal
1809
1881
  [key: string]: JsonArgumentValue;
1810
1882
  };
1811
1883
 
1884
+ /**
1885
+ * From https://github.com/sindresorhus/type-fest/
1886
+ * Matches a JSON array.
1887
+ */
1812
1888
  export declare interface JsonArray extends Array<JsonValue> {
1813
1889
  }
1814
1890
 
1815
- declare type JsonBatchQuery = {
1891
+ export declare type JsonBatchQuery = {
1816
1892
  batch: JsonQuery[];
1817
1893
  transaction?: {
1818
1894
  isolationLevel?: Transaction_2.IsolationLevel;
@@ -1831,11 +1907,16 @@ declare type JsonFieldSelection = {
1831
1907
  declare class JsonNull extends NullTypesEnumValue {
1832
1908
  }
1833
1909
 
1910
+ /**
1911
+ * From https://github.com/sindresorhus/type-fest/
1912
+ * Matches a JSON object.
1913
+ * This type can be useful to enforce some input to be JSON-compatible or as a super-type to be extended from.
1914
+ */
1834
1915
  export declare type JsonObject = {
1835
1916
  [Key in string]?: JsonValue;
1836
1917
  };
1837
1918
 
1838
- declare type JsonQuery = {
1919
+ export declare type JsonQuery = {
1839
1920
  modelName?: string;
1840
1921
  action: JsonQueryAction;
1841
1922
  query: JsonFieldSelection;
@@ -1850,6 +1931,10 @@ declare type JsonSelectionSet = {
1850
1931
  [fieldName: string]: boolean | JsonFieldSelection;
1851
1932
  };
1852
1933
 
1934
+ /**
1935
+ * From https://github.com/sindresorhus/type-fest/
1936
+ * Matches any valid JSON value.
1937
+ */
1853
1938
  export declare type JsonValue = string | number | boolean | JsonObject | JsonArray | null;
1854
1939
 
1855
1940
  export declare type JsOutputValue = null | string | number | boolean | bigint | Uint8Array | Date | Decimal | JsOutputValue[] | {
@@ -1947,6 +2032,8 @@ declare type LogLevel = 'info' | 'query' | 'warn' | 'error';
1947
2032
  */
1948
2033
  export declare function makeStrictEnum<T extends Record<PropertyKey, string | number>>(definition: T): T;
1949
2034
 
2035
+ export declare function makeTypedQueryFactory(sql: string): (...values: any[]) => TypedSql<any[], unknown>;
2036
+
1950
2037
  /**
1951
2038
  * Class that holds the list of all extensions, applied to particular instance,
1952
2039
  * as well as resolved versions of the components that need to apply on
@@ -2144,7 +2231,7 @@ export declare const objectEnumValues: {
2144
2231
 
2145
2232
  declare const officialPrismaAdapters: readonly ["@prisma/adapter-planetscale", "@prisma/adapter-neon", "@prisma/adapter-libsql", "@prisma/adapter-d1", "@prisma/adapter-pg", "@prisma/adapter-pg-worker"];
2146
2233
 
2147
- export declare type Omission = Record<string, boolean>;
2234
+ export declare type Omission = Record<string, boolean | Skip>;
2148
2235
 
2149
2236
  declare type Omit_2<T, K extends string | number | symbol> = {
2150
2237
  [P in keyof T as P extends K ? never : P]: T[P];
@@ -2385,6 +2472,8 @@ declare type PrismaPromiseInteractiveTransaction<PayloadType = unknown> = {
2385
2472
 
2386
2473
  declare type PrismaPromiseTransaction<PayloadType = unknown> = PrismaPromiseBatchTransaction | PrismaPromiseInteractiveTransaction<PayloadType>;
2387
2474
 
2475
+ export declare const PrivateResultType: unique symbol;
2476
+
2388
2477
  declare namespace Public {
2389
2478
  export {
2390
2479
  validator
@@ -2406,6 +2495,7 @@ declare namespace Public_2 {
2406
2495
  declare type Query = {
2407
2496
  sql: string;
2408
2497
  args: Array<unknown>;
2498
+ argTypes: Array<ArgType>;
2409
2499
  };
2410
2500
 
2411
2501
  declare interface Queryable {
@@ -2537,7 +2627,7 @@ export declare type RawParameters = {
2537
2627
  values: string;
2538
2628
  };
2539
2629
 
2540
- export declare type RawQueryArgs = Sql | [query: string, ...values: RawValue[]];
2630
+ export declare type RawQueryArgs = Sql | UnknownTypedSql | [query: string, ...values: RawValue[]];
2541
2631
 
2542
2632
  declare type RawTaggedValue = {
2543
2633
  $type: 'Raw';
@@ -2753,7 +2843,7 @@ export declare type Return<T> = T extends (...args: any[]) => infer R ? R : T;
2753
2843
 
2754
2844
  declare type Runtime = "edge-routine" | "workerd" | "deno" | "lagon" | "react-native" | "netlify" | "electron" | "node" | "bun" | "edge-light" | "fastly" | "unknown";
2755
2845
 
2756
- declare type RuntimeDataModel = {
2846
+ export declare type RuntimeDataModel = {
2757
2847
  readonly models: Record<string, RuntimeModel>;
2758
2848
  readonly enums: Record<string, RuntimeEnum>;
2759
2849
  readonly types: Record<string, RuntimeModel>;
@@ -2781,9 +2871,32 @@ export declare type SelectField<P extends SelectablePayloadFields<any, any>, K e
2781
2871
  composites: Record<K, any>;
2782
2872
  } ? P['composites'][K] : never;
2783
2873
 
2784
- declare type Selection_2 = Record<string, boolean | JsArgs>;
2874
+ declare type Selection_2 = Record<string, boolean | Skip | JsArgs>;
2785
2875
  export { Selection_2 as Selection }
2786
2876
 
2877
+ export declare function serializeJsonQuery({ modelName, action, args, runtimeDataModel, extensions, callsite, clientMethod, errorFormat, clientVersion, previewFeatures, globalOmit, }: SerializeParams): JsonQuery;
2878
+
2879
+ declare type SerializeParams = {
2880
+ runtimeDataModel: RuntimeDataModel;
2881
+ modelName?: string;
2882
+ action: Action;
2883
+ args?: JsArgs;
2884
+ extensions?: MergedExtensionsList;
2885
+ callsite?: CallSite;
2886
+ clientMethod: string;
2887
+ clientVersion: string;
2888
+ errorFormat: ErrorFormat;
2889
+ previewFeatures: string[];
2890
+ globalOmit?: GlobalOmitOptions;
2891
+ };
2892
+
2893
+ declare class Skip {
2894
+ constructor(param?: symbol);
2895
+ ifUndefined<T>(value: T | undefined): T | Skip;
2896
+ }
2897
+
2898
+ export declare const skip: Skip;
2899
+
2787
2900
  /**
2788
2901
  * An interface that represents a span. A span represents a single operation
2789
2902
  * within a trace. Examples of span might include remote procedure calls or a
@@ -3136,6 +3249,13 @@ declare namespace Transaction_2 {
3136
3249
  }
3137
3250
  }
3138
3251
 
3252
+ declare interface TransactionContext extends Queryable {
3253
+ /**
3254
+ * Starts new transaction.
3255
+ */
3256
+ startTransaction(): Promise<Result_4<Transaction>>;
3257
+ }
3258
+
3139
3259
  declare type TransactionHeaders = {
3140
3260
  traceparent?: string;
3141
3261
  };
@@ -3152,6 +3272,13 @@ declare type TransactionOptions_2<InteractiveTransactionPayload> = {
3152
3272
  options: BatchTransactionOptions;
3153
3273
  };
3154
3274
 
3275
+ export declare class TypedSql<Values extends readonly unknown[], Result> {
3276
+ [PrivateResultType]: Result;
3277
+ constructor(sql: string, values: Values);
3278
+ get sql(): string;
3279
+ get values(): Values;
3280
+ }
3281
+
3155
3282
  export declare type TypeMapCbDef = Fn<{
3156
3283
  extArgs: InternalArgs;
3157
3284
  clientOptions: ClientOptionDef;
@@ -3166,6 +3293,10 @@ declare namespace Types {
3166
3293
  Extensions_2 as Extensions,
3167
3294
  Utils,
3168
3295
  Public_2 as Public,
3296
+ isSkip,
3297
+ Skip,
3298
+ skip,
3299
+ UnknownTypedSql,
3169
3300
  OperationPayload as Payload
3170
3301
  }
3171
3302
  }
@@ -3176,6 +3307,8 @@ declare type UnknownErrorParams = {
3176
3307
  batchRequestIdx?: number;
3177
3308
  };
3178
3309
 
3310
+ export declare type UnknownTypedSql = TypedSql<unknown[], unknown>;
3311
+
3179
3312
  declare type Unpacker = (data: any) => any;
3180
3313
 
3181
3314
  export declare type UnwrapPayload<P> = {} extends P ? unknown : {
@@ -3214,9 +3347,6 @@ declare namespace Utils {
3214
3347
  Narrow,
3215
3348
  Exact,
3216
3349
  Cast,
3217
- JsonObject,
3218
- JsonArray,
3219
- JsonValue,
3220
3350
  Record_2 as Record,
3221
3351
  UnwrapPromise,
3222
3352
  UnwrapTuple,