@prisma/client
Version:
Prisma Client is an auto-generated, type-safe and modern JavaScript/TypeScript ORM for Node.js that's tailored to your data. Supports PostgreSQL, CockroachDB, MySQL, MariaDB, SQL Server, SQLite & MongoDB databases.
8 lines (7 loc) • 7.84 kB
Source Map (JSON)
{
"version": 3,
"sources": ["../src/runtime/core/public/index.ts", "../src/runtime/core/public/validator.ts", "../src/runtime/strictEnum.ts", "../src/runtime/utils/getRuntime.ts", "../src/runtime/index-browser.ts"],
"sourcesContent": ["import { validator } from './validator'\n\n/*\n * /!\\ These exports are exposed to the user. Proceed with caution.\n *\n * TODO: Move more hardcoded utils from generation into here\n */\n\nexport { validator }\n", "import { Args, Operation } from '../types/exported/Public'\nimport { Exact } from '../types/exported/Utils'\n\nexport function validator<V>(): <S>(select: Exact<S, V>) => S\nexport function validator<C, M extends Exclude<keyof C, `$${string}`>, O extends keyof C[M] & Operation>(\n client: C,\n model: M,\n operation: O,\n): <S>(select: Exact<S, Args<C[M], O>>) => S\nexport function validator<\n C,\n M extends Exclude<keyof C, `$${string}`>,\n O extends keyof C[M] & Operation,\n P extends keyof Args<C[M], O>,\n>(client: C, model: M, operation: O, prop: P): <S>(select: Exact<S, Args<C[M], O>[P]>) => S\nexport function validator(..._args: any[]) {\n return (args: any) => args\n}\n", "/**\n * List of properties that won't throw exception on access and return undefined instead\n */\nconst allowList = new Set([\n 'toJSON', // used by JSON.stringify\n '$$typeof', // used by old React tooling\n 'asymmetricMatch', // used by Jest\n Symbol.iterator, // used by various JS constructs/methods\n Symbol.toStringTag, // Used by .toString()\n Symbol.isConcatSpreadable, // Used by Array#concat,\n Symbol.toPrimitive, // Used when getting converted to primitive values\n])\n/**\n * Generates more strict variant of an enum which, unlike regular enum,\n * throws on non-existing property access. This can be useful in following situations:\n * - we have an API, that accepts both `undefined` and `SomeEnumType` as an input\n * - enum values are generated dynamically from DMMF.\n *\n * In that case, if using normal enums and no compile-time typechecking, using non-existing property\n * will result in `undefined` value being used, which will be accepted. Using strict enum\n * in this case will help to have a runtime exception, telling you that you are probably doing something wrong.\n *\n * Note: if you need to check for existence of a value in the enum you can still use either\n * `in` operator or `hasOwnProperty` function.\n *\n * @param definition\n * @returns\n */\nexport function makeStrictEnum<T extends Record<PropertyKey, string | number>>(definition: T): T {\n return new Proxy(definition, {\n get(target, property) {\n if (property in target) {\n return target[property]\n }\n if (allowList.has(property)) {\n return undefined\n }\n throw new TypeError(`Invalid enum value: ${String(property)}`)\n },\n })\n}\n", "// https://runtime-keys.proposal.wintercg.org/\nexport type RuntimeName = 'workerd' | 'deno' | 'netlify' | 'node' | 'bun' | 'edge-light' | '' /* unknown */\n\n/**\n * Indicates if running in Node.js or a Node.js compatible runtime.\n *\n * **Note:** When running code in Bun and Deno with Node.js compatibility mode, `isNode` flag will be also `true`, indicating running in a Node.js compatible runtime.\n */\nconst isNode = () => globalThis.process?.release?.name === 'node'\n\n/**\n * Indicates if running in Bun runtime.\n */\nconst isBun = () => !!globalThis.Bun || !!globalThis.process?.versions?.bun\n\n/**\n * Indicates if running in Deno runtime.\n */\nconst isDeno = () => !!globalThis.Deno\n\n/**\n * Indicates if running in Netlify runtime.\n */\nconst isNetlify = () => typeof globalThis.Netlify === 'object'\n\n/**\n * Indicates if running in EdgeLight (Vercel Edge) runtime.\n */\nconst isEdgeLight = () => typeof globalThis.EdgeRuntime === 'object'\n\n/**\n * Indicates if running in Cloudflare Workers runtime.\n * See: https://developers.cloudflare.com/workers/runtime-apis/web-standards/#navigatoruseragent\n */\nconst isWorkerd = () => globalThis.navigator?.userAgent === 'Cloudflare-Workers'\n\nfunction detectRuntime(): RuntimeName {\n // Note: we're currently not taking 'fastly' into account. Why?\n const runtimeChecks = [\n [isNetlify, 'netlify'],\n [isEdgeLight, 'edge-light'],\n [isWorkerd, 'workerd'],\n [isDeno, 'deno'],\n [isBun, 'bun'],\n [isNode, 'node'],\n ] as const\n\n const detectedRuntime =\n runtimeChecks\n // TODO: Transforming destructuring to the configured target environment ('chrome58', 'edge16', 'firefox57', 'safari11') is not supported yet,\n // so we can't write the following code yet:\n // ```\n // .flatMap(([isCurrentRuntime, runtime]) => isCurrentRuntime() ? [runtime] : [])\n // ```\n .flatMap((check) => (check[0]() ? [check[1]] : []))\n .at(0) ?? ''\n\n return detectedRuntime\n}\n\nconst runtimesPrettyNames = {\n node: 'Node.js',\n workerd: 'Cloudflare Workers',\n deno: 'Deno and Deno Deploy',\n netlify: 'Netlify Edge Functions',\n 'edge-light':\n 'Edge Runtime (Vercel Edge Functions, Vercel Edge Middleware, Next.js (Pages Router) Edge API Routes, Next.js (App Router) Edge Route Handlers or Next.js Middleware)',\n} as const\n\ntype GetRuntimeOutput = {\n id: RuntimeName\n prettyName: string\n isEdge: boolean\n}\n\nexport function getRuntime(): GetRuntimeOutput {\n const runtimeId = detectRuntime()\n\n return {\n id: runtimeId,\n // Fallback to the runtimeId if the runtime is not in the list\n prettyName: runtimesPrettyNames[runtimeId] || runtimeId,\n isEdge: ['workerd', 'deno', 'netlify', 'edge-light'].includes(runtimeId),\n }\n}\n", "import * as Public from './core/public'\n\nexport { makeStrictEnum } from './strictEnum'\nexport { getRuntime } from './utils/getRuntime'\nexport { AnyNull, DbNull, isAnyNull, isDbNull, isJsonNull, JsonNull, NullTypes } from '@prisma/client-runtime-utils'\nexport { Decimal } from '@prisma/client-runtime-utils'\n\nexport { Public }\n"],
"mappings": "0FAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,eAAAE,ICeO,SAASC,KAAaC,EAAc,CACzC,OAAQC,GAAcA,CACxB,CCdA,IAAMC,EAAY,IAAI,IAAI,CACxB,SACA,WACA,kBACA,OAAO,SACP,OAAO,YACP,OAAO,mBACP,OAAO,WACT,CAAC,EAiBM,SAASC,EAA+DC,EAAkB,CAC/F,OAAO,IAAI,MAAMA,EAAY,CAC3B,IAAIC,EAAQC,EAAU,CACpB,GAAIA,KAAYD,EACd,OAAOA,EAAOC,CAAQ,EAExB,GAAI,CAAAJ,EAAU,IAAII,CAAQ,EAG1B,MAAM,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AAC,EAAU,aAAAC,MAAiB,+BACtF,OAAS,WAAAC,MAAe",
"names": ["public_exports", "__export", "validator", "validator", "_args", "args", "allowList", "makeStrictEnum", "definition", "target", "property", "isNode", "_a", "_b", "isBun", "isDeno", "isNetlify", "isEdgeLight", "isWorkerd", "detectRuntime", "check", "runtimesPrettyNames", "getRuntime", "runtimeId", "AnyNull", "DbNull", "isAnyNull", "isDbNull", "isJsonNull", "JsonNull", "NullTypes", "Decimal"]
}