@prisma-next/utils 0.4.0-dev.8 → 0.4.1

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.
@@ -27,4 +27,4 @@ function ifDefined(key, value) {
27
27
 
28
28
  //#endregion
29
29
  export { ifDefined as t };
30
- //# sourceMappingURL=defined-BSROFTyI.mjs.map
30
+ //# sourceMappingURL=defined-CV9lG7rM.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"defined-BSROFTyI.mjs","names":[],"sources":["../src/defined.ts"],"sourcesContent":["/**\n * Returns an object with the key/value if value is defined, otherwise an empty object.\n *\n * Use with spread to conditionally include optional properties while satisfying\n * exactOptionalPropertyTypes. This is explicit about which properties are optional\n * and won't inadvertently strip other undefined values.\n *\n * @example\n * ```typescript\n * // Instead of:\n * const obj = {\n * required: 'value',\n * ...(optional ? { optional } : {}),\n * };\n *\n * // Use:\n * const obj = {\n * required: 'value',\n * ...ifDefined('optional', optional),\n * };\n * ```\n */\nexport function ifDefined<K extends string, V>(\n key: K,\n value: V | undefined,\n): Record<never, never> | { [P in K]: V } {\n return value !== undefined ? ({ [key]: value } as { [P in K]: V }) : {};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAsBA,SAAgB,UACd,KACA,OACwC;AACxC,QAAO,UAAU,SAAa,GAAG,MAAM,OAAO,GAAuB,EAAE"}
1
+ {"version":3,"file":"defined-CV9lG7rM.mjs","names":[],"sources":["../src/defined.ts"],"sourcesContent":["/**\n * Returns an object with the key/value if value is defined, otherwise an empty object.\n *\n * Use with spread to conditionally include optional properties while satisfying\n * exactOptionalPropertyTypes. This is explicit about which properties are optional\n * and won't inadvertently strip other undefined values.\n *\n * @example\n * ```typescript\n * // Instead of:\n * const obj = {\n * required: 'value',\n * ...(optional ? { optional } : {}),\n * };\n *\n * // Use:\n * const obj = {\n * required: 'value',\n * ...ifDefined('optional', optional),\n * };\n * ```\n */\nexport function ifDefined<K extends string, V>(\n key: K,\n value: V | undefined,\n): Record<never, never> | { [P in K]: V } {\n return value !== undefined ? ({ [key]: value } as { [P in K]: V }) : {};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAsBA,SAAgB,UACd,KACA,OACwC;AACxC,QAAO,UAAU,SAAa,GAAG,MAAM,OAAO,GAAuB,EAAE"}
package/dist/defined.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { t as ifDefined } from "./defined-BSROFTyI.mjs";
1
+ import { t as ifDefined } from "./defined-CV9lG7rM.mjs";
2
2
 
3
3
  export { ifDefined };
@@ -1,4 +1,4 @@
1
- import { t as ifDefined } from "./defined-BSROFTyI.mjs";
1
+ import { t as ifDefined } from "./defined-CV9lG7rM.mjs";
2
2
 
3
3
  //#region src/redact-db-url.ts
4
4
  /**
@@ -0,0 +1,5 @@
1
+ //#region src/simplify-deep.d.ts
2
+ type SimplifyDeep<T> = T extends readonly (infer Element)[] ? T extends unknown[] ? SimplifyDeep<Element>[] : readonly SimplifyDeep<Element>[] : T extends string | number | boolean | bigint | symbol | Date | RegExp | Uint8Array | ((...args: never[]) => unknown) ? T : T extends object ? { [K in keyof T]: SimplifyDeep<T[K]> } : T;
3
+ //#endregion
4
+ export { type SimplifyDeep };
5
+ //# sourceMappingURL=simplify-deep.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simplify-deep.d.mts","names":[],"sources":["../src/simplify-deep.ts"],"sourcesContent":[],"mappings":";KAAY,kBAAkB,uCAC1B,sBACE,aAAa,sBACJ,aAAa,aACxB,wDAMM,OACA,SACA,+CAEJ,IACA,2BAfM,MAgBU,CAhBV,GAgBc,YAhBF,CAgBe,CAhBf,CAgBiB,CAhBjB,CAAA,CAAA,EAAM,GAiBtB,CAjBsB"}
@@ -0,0 +1 @@
1
+ export { };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prisma-next/utils",
3
- "version": "0.4.0-dev.8",
3
+ "version": "0.4.1",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "description": "Shared utility functions for Prisma Next",
@@ -25,6 +25,7 @@
25
25
  "./defined": "./dist/defined.mjs",
26
26
  "./redact-db-url": "./dist/redact-db-url.mjs",
27
27
  "./result": "./dist/result.mjs",
28
+ "./simplify-deep": "./dist/simplify-deep.mjs",
28
29
  "./package.json": "./package.json"
29
30
  },
30
31
  "repository": {
@@ -0,0 +1 @@
1
+ export type { SimplifyDeep } from '../simplify-deep';
@@ -0,0 +1,18 @@
1
+ export type SimplifyDeep<T> = T extends readonly (infer Element)[]
2
+ ? T extends unknown[]
3
+ ? SimplifyDeep<Element>[]
4
+ : readonly SimplifyDeep<Element>[]
5
+ : T extends
6
+ | string
7
+ | number
8
+ | boolean
9
+ | bigint
10
+ | symbol
11
+ | Date
12
+ | RegExp
13
+ | Uint8Array
14
+ | ((...args: never[]) => unknown)
15
+ ? T
16
+ : T extends object
17
+ ? { [K in keyof T]: SimplifyDeep<T[K]> }
18
+ : T;