initial commit

This commit is contained in:
Bhavnoor Singh Saroya 2025-01-07 04:45:03 -08:00
commit b25eb51ff0
280 changed files with 178550 additions and 0 deletions

View file

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View file

@ -0,0 +1,16 @@
# @prisma/get-platform
Platform detection.
⚠️ **Warning**: This package is intended for Prisma's internal use.
Its release cycle does not follow SemVer, which means we might release breaking changes (change APIs, remove functionality) without any prior warning.
If you are using this package, it would be helpful if you could help us gain an understanding where, how and why you are using it. Your feedback will be valuable to us to define a better API. Please share this information at https://github.com/prisma/prisma/discussions/13877 - Thanks!
## Usage
```ts
import { getBinaryTargetForCurrentPlatform } from '@prisma/get-platform'
const binaryTarget = await getBinaryTargetForCurrentPlatform()
```

View file

@ -0,0 +1,4 @@
/**
* Determines whether Node API is supported on the current platform and throws if not
*/
export declare function assertNodeAPISupported(): void;

View file

@ -0,0 +1,25 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var assertNodeAPISupported_exports = {};
__export(assertNodeAPISupported_exports, {
assertNodeAPISupported: () => import_chunk_O5EOXX3N.assertNodeAPISupported
});
module.exports = __toCommonJS(assertNodeAPISupported_exports);
var import_chunk_O5EOXX3N = require("./chunk-O5EOXX3N.js");
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");

View file

@ -0,0 +1,2 @@
export type BinaryTarget = 'native' | 'darwin' | 'darwin-arm64' | 'debian-openssl-1.0.x' | 'debian-openssl-1.1.x' | 'debian-openssl-3.0.x' | 'rhel-openssl-1.0.x' | 'rhel-openssl-1.1.x' | 'rhel-openssl-3.0.x' | 'linux-arm64-openssl-1.1.x' | 'linux-arm64-openssl-1.0.x' | 'linux-arm64-openssl-3.0.x' | 'linux-arm-openssl-1.1.x' | 'linux-arm-openssl-1.0.x' | 'linux-arm-openssl-3.0.x' | 'linux-musl' | 'linux-musl-openssl-3.0.x' | 'linux-musl-arm64-openssl-1.1.x' | 'linux-musl-arm64-openssl-3.0.x' | 'linux-nixos' | 'linux-static-x64' | 'linux-static-arm64' | 'windows' | 'freebsd11' | 'freebsd12' | 'freebsd13' | 'freebsd14' | 'freebsd15' | 'openbsd' | 'netbsd' | 'arm';
export declare const binaryTargets: BinaryTarget[];

View file

@ -0,0 +1,26 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var binaryTargets_exports = {};
__export(binaryTargets_exports, {
binaryTargets: () => import_chunk_7MLUNQIZ.binaryTargets
});
module.exports = __toCommonJS(binaryTargets_exports);
var import_chunk_7MLUNQIZ = require("./chunk-7MLUNQIZ.js");
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
(0, import_chunk_7MLUNQIZ.init_binaryTargets)();

View file

@ -0,0 +1,67 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var chunk_2ESYSVXG_exports = {};
__export(chunk_2ESYSVXG_exports, {
__commonJS: () => __commonJS,
__esm: () => __esm,
__export: () => __export2,
__require: () => __require,
__toCommonJS: () => __toCommonJS2,
__toESM: () => __toESM
});
module.exports = __toCommonJS(chunk_2ESYSVXG_exports);
var __create = Object.create;
var __defProp2 = Object.defineProperty;
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
var __getOwnPropNames2 = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
}) : x)(function(x) {
if (typeof require !== "undefined") return require.apply(this, arguments);
throw Error('Dynamic require of "' + x + '" is not supported');
});
var __esm = (fn, res) => function __init() {
return fn && (res = (0, fn[__getOwnPropNames2(fn)[0]])(fn = 0)), res;
};
var __commonJS = (cb, mod) => function __require2() {
return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export2 = (target, all) => {
for (var name in all)
__defProp2(target, name, { get: all[name], enumerable: true });
};
var __copyProps2 = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames2(from))
if (!__hasOwnProp2.call(to, key) && key !== except)
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps2(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,34 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var chunk_2U36ISZO_exports = {};
__export(chunk_2U36ISZO_exports, {
getNodeAPIName: () => getNodeAPIName
});
module.exports = __toCommonJS(chunk_2U36ISZO_exports);
var NODE_API_QUERY_ENGINE_URL_BASE = "libquery_engine";
function getNodeAPIName(binaryTarget, type) {
const isUrl = type === "url";
if (binaryTarget.includes("windows")) {
return isUrl ? `query_engine.dll.node` : `query_engine-${binaryTarget}.dll.node`;
} else if (binaryTarget.includes("darwin")) {
return isUrl ? `${NODE_API_QUERY_ENGINE_URL_BASE}.dylib.node` : `${NODE_API_QUERY_ENGINE_URL_BASE}-${binaryTarget}.dylib.node`;
} else {
return isUrl ? `${NODE_API_QUERY_ENGINE_URL_BASE}.so.node` : `${NODE_API_QUERY_ENGINE_URL_BASE}-${binaryTarget}.so.node`;
}
}

View file

@ -0,0 +1 @@
"use strict";

View file

@ -0,0 +1,62 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var chunk_7MLUNQIZ_exports = {};
__export(chunk_7MLUNQIZ_exports, {
binaryTargets: () => binaryTargets,
init_binaryTargets: () => init_binaryTargets
});
module.exports = __toCommonJS(chunk_7MLUNQIZ_exports);
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
var binaryTargets;
var init_binaryTargets = (0, import_chunk_2ESYSVXG.__esm)({
"src/binaryTargets.ts"() {
binaryTargets = [
"darwin",
"darwin-arm64",
"debian-openssl-1.0.x",
"debian-openssl-1.1.x",
"debian-openssl-3.0.x",
"rhel-openssl-1.0.x",
"rhel-openssl-1.1.x",
"rhel-openssl-3.0.x",
"linux-arm64-openssl-1.1.x",
"linux-arm64-openssl-1.0.x",
"linux-arm64-openssl-3.0.x",
"linux-arm-openssl-1.1.x",
"linux-arm-openssl-1.0.x",
"linux-arm-openssl-3.0.x",
"linux-musl",
"linux-musl-openssl-3.0.x",
"linux-musl-arm64-openssl-1.1.x",
"linux-musl-arm64-openssl-3.0.x",
"linux-nixos",
"linux-static-x64",
"linux-static-arm64",
"windows",
"freebsd11",
"freebsd12",
"freebsd13",
"freebsd14",
"freebsd15",
"openbsd",
"netbsd",
"arm"
];
}
});

View file

@ -0,0 +1,53 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var chunk_B23KD6U3_exports = {};
__export(chunk_B23KD6U3_exports, {
binaryTargetRegex: () => binaryTargetRegex,
binaryTargetRegex_exports: () => binaryTargetRegex_exports,
init_binaryTargetRegex: () => init_binaryTargetRegex
});
module.exports = __toCommonJS(chunk_B23KD6U3_exports);
var import_chunk_7MLUNQIZ = require("./chunk-7MLUNQIZ.js");
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
var require_escape_string_regexp = (0, import_chunk_2ESYSVXG.__commonJS)({
"../../node_modules/.pnpm/escape-string-regexp@4.0.0/node_modules/escape-string-regexp/index.js"(exports, module2) {
"use strict";
module2.exports = (string) => {
if (typeof string !== "string") {
throw new TypeError("Expected a string");
}
return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
};
}
});
var binaryTargetRegex_exports = {};
(0, import_chunk_2ESYSVXG.__export)(binaryTargetRegex_exports, {
binaryTargetRegex: () => binaryTargetRegex
});
var import_escape_string_regexp, binaryTargetRegex;
var init_binaryTargetRegex = (0, import_chunk_2ESYSVXG.__esm)({
"src/test-utils/binaryTargetRegex.ts"() {
import_escape_string_regexp = (0, import_chunk_2ESYSVXG.__toESM)(require_escape_string_regexp());
(0, import_chunk_7MLUNQIZ.init_binaryTargets)();
binaryTargetRegex = new RegExp(
"(" + [...import_chunk_7MLUNQIZ.binaryTargets].sort((a, b) => b.length - a.length).map((p) => (0, import_escape_string_regexp.default)(p)).join("|") + ")",
"g"
);
}
});

View file

@ -0,0 +1,367 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var chunk_D7S5FGQN_exports = {};
__export(chunk_D7S5FGQN_exports, {
link: () => link
});
module.exports = __toCommonJS(chunk_D7S5FGQN_exports);
var import_chunk_YVXCXD3A = require("./chunk-YVXCXD3A.js");
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
var require_ansi_escapes = (0, import_chunk_2ESYSVXG.__commonJS)({
"../../node_modules/.pnpm/ansi-escapes@4.3.2/node_modules/ansi-escapes/index.js"(exports, module2) {
"use strict";
var ansiEscapes = module2.exports;
module2.exports.default = ansiEscapes;
var ESC = "\x1B[";
var OSC = "\x1B]";
var BEL = "\x07";
var SEP = ";";
var isTerminalApp = process.env.TERM_PROGRAM === "Apple_Terminal";
ansiEscapes.cursorTo = (x, y) => {
if (typeof x !== "number") {
throw new TypeError("The `x` argument is required");
}
if (typeof y !== "number") {
return ESC + (x + 1) + "G";
}
return ESC + (y + 1) + ";" + (x + 1) + "H";
};
ansiEscapes.cursorMove = (x, y) => {
if (typeof x !== "number") {
throw new TypeError("The `x` argument is required");
}
let ret = "";
if (x < 0) {
ret += ESC + -x + "D";
} else if (x > 0) {
ret += ESC + x + "C";
}
if (y < 0) {
ret += ESC + -y + "A";
} else if (y > 0) {
ret += ESC + y + "B";
}
return ret;
};
ansiEscapes.cursorUp = (count = 1) => ESC + count + "A";
ansiEscapes.cursorDown = (count = 1) => ESC + count + "B";
ansiEscapes.cursorForward = (count = 1) => ESC + count + "C";
ansiEscapes.cursorBackward = (count = 1) => ESC + count + "D";
ansiEscapes.cursorLeft = ESC + "G";
ansiEscapes.cursorSavePosition = isTerminalApp ? "\x1B7" : ESC + "s";
ansiEscapes.cursorRestorePosition = isTerminalApp ? "\x1B8" : ESC + "u";
ansiEscapes.cursorGetPosition = ESC + "6n";
ansiEscapes.cursorNextLine = ESC + "E";
ansiEscapes.cursorPrevLine = ESC + "F";
ansiEscapes.cursorHide = ESC + "?25l";
ansiEscapes.cursorShow = ESC + "?25h";
ansiEscapes.eraseLines = (count) => {
let clear = "";
for (let i = 0; i < count; i++) {
clear += ansiEscapes.eraseLine + (i < count - 1 ? ansiEscapes.cursorUp() : "");
}
if (count) {
clear += ansiEscapes.cursorLeft;
}
return clear;
};
ansiEscapes.eraseEndLine = ESC + "K";
ansiEscapes.eraseStartLine = ESC + "1K";
ansiEscapes.eraseLine = ESC + "2K";
ansiEscapes.eraseDown = ESC + "J";
ansiEscapes.eraseUp = ESC + "1J";
ansiEscapes.eraseScreen = ESC + "2J";
ansiEscapes.scrollUp = ESC + "S";
ansiEscapes.scrollDown = ESC + "T";
ansiEscapes.clearScreen = "\x1Bc";
ansiEscapes.clearTerminal = process.platform === "win32" ? `${ansiEscapes.eraseScreen}${ESC}0f` : (
// 1. Erases the screen (Only done in case `2` is not supported)
// 2. Erases the whole screen including scrollback buffer
// 3. Moves cursor to the top-left position
// More info: https://www.real-world-systems.com/docs/ANSIcode.html
`${ansiEscapes.eraseScreen}${ESC}3J${ESC}H`
);
ansiEscapes.beep = BEL;
ansiEscapes.link = (text, url) => {
return [
OSC,
"8",
SEP,
SEP,
url,
BEL,
text,
OSC,
"8",
SEP,
SEP,
BEL
].join("");
};
ansiEscapes.image = (buffer, options = {}) => {
let ret = `${OSC}1337;File=inline=1`;
if (options.width) {
ret += `;width=${options.width}`;
}
if (options.height) {
ret += `;height=${options.height}`;
}
if (options.preserveAspectRatio === false) {
ret += ";preserveAspectRatio=0";
}
return ret + ":" + buffer.toString("base64") + BEL;
};
ansiEscapes.iTerm = {
setCwd: (cwd = process.cwd()) => `${OSC}50;CurrentDir=${cwd}${BEL}`,
annotation: (message, options = {}) => {
let ret = `${OSC}1337;`;
const hasX = typeof options.x !== "undefined";
const hasY = typeof options.y !== "undefined";
if ((hasX || hasY) && !(hasX && hasY && typeof options.length !== "undefined")) {
throw new Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");
}
message = message.replace(/\|/g, "");
ret += options.isHidden ? "AddHiddenAnnotation=" : "AddAnnotation=";
if (options.length > 0) {
ret += (hasX ? [message, options.length, options.x, options.y] : [options.length, message]).join("|");
} else {
ret += message;
}
return ret + BEL;
}
};
}
});
var require_has_flag = (0, import_chunk_2ESYSVXG.__commonJS)({
"../../node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js"(exports, module2) {
"use strict";
module2.exports = (flag, argv = process.argv) => {
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
const position = argv.indexOf(prefix + flag);
const terminatorPosition = argv.indexOf("--");
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
};
}
});
var require_supports_color = (0, import_chunk_2ESYSVXG.__commonJS)({
"../../node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js"(exports, module2) {
"use strict";
var os = (0, import_chunk_2ESYSVXG.__require)("os");
var tty = (0, import_chunk_2ESYSVXG.__require)("tty");
var hasFlag = require_has_flag();
var { env } = process;
var forceColor;
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
forceColor = 0;
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
forceColor = 1;
}
if ("FORCE_COLOR" in env) {
if (env.FORCE_COLOR === "true") {
forceColor = 1;
} else if (env.FORCE_COLOR === "false") {
forceColor = 0;
} else {
forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
}
}
function translateLevel(level) {
if (level === 0) {
return false;
}
return {
level,
hasBasic: true,
has256: level >= 2,
has16m: level >= 3
};
}
function supportsColor(haveStream, streamIsTTY) {
if (forceColor === 0) {
return 0;
}
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
return 3;
}
if (hasFlag("color=256")) {
return 2;
}
if (haveStream && !streamIsTTY && forceColor === void 0) {
return 0;
}
const min = forceColor || 0;
if (env.TERM === "dumb") {
return min;
}
if (process.platform === "win32") {
const osRelease = os.release().split(".");
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
return Number(osRelease[2]) >= 14931 ? 3 : 2;
}
return 1;
}
if ("CI" in env) {
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
return 1;
}
return min;
}
if ("TEAMCITY_VERSION" in env) {
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
}
if (env.COLORTERM === "truecolor") {
return 3;
}
if ("TERM_PROGRAM" in env) {
const version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
switch (env.TERM_PROGRAM) {
case "iTerm.app":
return version >= 3 ? 3 : 2;
case "Apple_Terminal":
return 2;
}
}
if (/-256(color)?$/i.test(env.TERM)) {
return 2;
}
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
return 1;
}
if ("COLORTERM" in env) {
return 1;
}
return min;
}
function getSupportLevel(stream) {
const level = supportsColor(stream, stream && stream.isTTY);
return translateLevel(level);
}
module2.exports = {
supportsColor: getSupportLevel,
stdout: translateLevel(supportsColor(true, tty.isatty(1))),
stderr: translateLevel(supportsColor(true, tty.isatty(2)))
};
}
});
var require_supports_hyperlinks = (0, import_chunk_2ESYSVXG.__commonJS)({
"../../node_modules/.pnpm/supports-hyperlinks@2.3.0/node_modules/supports-hyperlinks/index.js"(exports, module2) {
"use strict";
var supportsColor = require_supports_color();
var hasFlag = require_has_flag();
function parseVersion(versionString) {
if (/^\d{3,4}$/.test(versionString)) {
const m = /(\d{1,2})(\d{2})/.exec(versionString);
return {
major: 0,
minor: parseInt(m[1], 10),
patch: parseInt(m[2], 10)
};
}
const versions = (versionString || "").split(".").map((n) => parseInt(n, 10));
return {
major: versions[0],
minor: versions[1],
patch: versions[2]
};
}
function supportsHyperlink(stream) {
const { env } = process;
if ("FORCE_HYPERLINK" in env) {
return !(env.FORCE_HYPERLINK.length > 0 && parseInt(env.FORCE_HYPERLINK, 10) === 0);
}
if (hasFlag("no-hyperlink") || hasFlag("no-hyperlinks") || hasFlag("hyperlink=false") || hasFlag("hyperlink=never")) {
return false;
}
if (hasFlag("hyperlink=true") || hasFlag("hyperlink=always")) {
return true;
}
if ("NETLIFY" in env) {
return true;
}
if (!supportsColor.supportsColor(stream)) {
return false;
}
if (stream && !stream.isTTY) {
return false;
}
if (process.platform === "win32") {
return false;
}
if ("CI" in env) {
return false;
}
if ("TEAMCITY_VERSION" in env) {
return false;
}
if ("TERM_PROGRAM" in env) {
const version = parseVersion(env.TERM_PROGRAM_VERSION);
switch (env.TERM_PROGRAM) {
case "iTerm.app":
if (version.major === 3) {
return version.minor >= 1;
}
return version.major > 3;
case "WezTerm":
return version.major >= 20200620;
case "vscode":
return version.major > 1 || version.major === 1 && version.minor >= 72;
}
}
if ("VTE_VERSION" in env) {
if (env.VTE_VERSION === "0.50.0") {
return false;
}
const version = parseVersion(env.VTE_VERSION);
return version.major > 0 || version.minor >= 50;
}
return false;
}
module2.exports = {
supportsHyperlink,
stdout: supportsHyperlink(process.stdout),
stderr: supportsHyperlink(process.stderr)
};
}
});
var require_terminal_link = (0, import_chunk_2ESYSVXG.__commonJS)({
"../../node_modules/.pnpm/terminal-link@2.1.1/node_modules/terminal-link/index.js"(exports, module2) {
"use strict";
var ansiEscapes = require_ansi_escapes();
var supportsHyperlinks = require_supports_hyperlinks();
var terminalLink2 = (text, url, { target = "stdout", ...options } = {}) => {
if (!supportsHyperlinks[target]) {
if (options.fallback === false) {
return text;
}
return typeof options.fallback === "function" ? options.fallback(text, url) : `${text} (\u200B${url}\u200B)`;
}
return ansiEscapes.link(text, url);
};
module2.exports = (text, url, options = {}) => terminalLink2(text, url, options);
module2.exports.stderr = (text, url, options = {}) => terminalLink2(text, url, { target: "stderr", ...options });
module2.exports.isSupported = supportsHyperlinks.stdout;
module2.exports.stderr.isSupported = supportsHyperlinks.stderr;
}
});
var import_terminal_link = (0, import_chunk_2ESYSVXG.__toESM)(require_terminal_link());
function link(url) {
return (0, import_terminal_link.default)(url, url, {
fallback: import_chunk_YVXCXD3A.underline
});
}

View file

@ -0,0 +1,585 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var chunk_EY5MORMD_exports = {};
__export(chunk_EY5MORMD_exports, {
computeLibSSLSpecificPaths: () => computeLibSSLSpecificPaths,
getArchFromUname: () => getArchFromUname,
getBinaryTargetForCurrentPlatform: () => getBinaryTargetForCurrentPlatform,
getBinaryTargetForCurrentPlatformInternal: () => getBinaryTargetForCurrentPlatformInternal,
getPlatformInfo: () => getPlatformInfo,
getPlatformInfoMemoized: () => getPlatformInfoMemoized,
getSSLVersion: () => getSSLVersion,
getos: () => getos,
parseDistro: () => parseDistro,
parseLibSSLVersion: () => parseLibSSLVersion,
parseOpenSSLVersion: () => parseOpenSSLVersion,
resolveDistro: () => resolveDistro
});
module.exports = __toCommonJS(chunk_EY5MORMD_exports);
var import_chunk_FWMN4WME = require("./chunk-FWMN4WME.js");
var import_debug = __toESM(require("@prisma/debug"));
var import_child_process = __toESM(require("child_process"));
var import_promises = __toESM(require("fs/promises"));
var import_os = __toESM(require("os"));
var import_util = require("util");
var t = Symbol.for("@ts-pattern/matcher");
var e = Symbol.for("@ts-pattern/isVariadic");
var n = "@ts-pattern/anonymous-select-key";
var r = (t2) => Boolean(t2 && "object" == typeof t2);
var i = (e2) => e2 && !!e2[t];
var s = (n2, o2, c2) => {
if (i(n2)) {
const e2 = n2[t](), { matched: r2, selections: i2 } = e2.match(o2);
return r2 && i2 && Object.keys(i2).forEach((t2) => c2(t2, i2[t2])), r2;
}
if (r(n2)) {
if (!r(o2)) return false;
if (Array.isArray(n2)) {
if (!Array.isArray(o2)) return false;
let t2 = [], r2 = [], a = [];
for (const s2 of n2.keys()) {
const o3 = n2[s2];
i(o3) && o3[e] ? a.push(o3) : a.length ? r2.push(o3) : t2.push(o3);
}
if (a.length) {
if (a.length > 1) throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");
if (o2.length < t2.length + r2.length) return false;
const e2 = o2.slice(0, t2.length), n3 = 0 === r2.length ? [] : o2.slice(-r2.length), i2 = o2.slice(t2.length, 0 === r2.length ? Infinity : -r2.length);
return t2.every((t3, n4) => s(t3, e2[n4], c2)) && r2.every((t3, e3) => s(t3, n3[e3], c2)) && (0 === a.length || s(a[0], i2, c2));
}
return n2.length === o2.length && n2.every((t3, e2) => s(t3, o2[e2], c2));
}
return Reflect.ownKeys(n2).every((e2) => {
const r2 = n2[e2];
return (e2 in o2 || i(a = r2) && "optional" === a[t]().matcherType) && s(r2, o2[e2], c2);
var a;
});
}
return Object.is(o2, n2);
};
var o = (e2) => {
var n2, s2, a;
return r(e2) ? i(e2) ? null != (n2 = null == (s2 = (a = e2[t]()).getSelectionKeys) ? void 0 : s2.call(a)) ? n2 : [] : Array.isArray(e2) ? c(e2, o) : c(Object.values(e2), o) : [];
};
var c = (t2, e2) => t2.reduce((t3, n2) => t3.concat(e2(n2)), []);
function u(t2) {
return Object.assign(t2, { optional: () => h(t2), and: (e2) => m(t2, e2), or: (e2) => d(t2, e2), select: (e2) => void 0 === e2 ? y(t2) : y(e2, t2) });
}
function h(e2) {
return u({ [t]: () => ({ match: (t2) => {
let n2 = {};
const r2 = (t3, e3) => {
n2[t3] = e3;
};
return void 0 === t2 ? (o(e2).forEach((t3) => r2(t3, void 0)), { matched: true, selections: n2 }) : { matched: s(e2, t2, r2), selections: n2 };
}, getSelectionKeys: () => o(e2), matcherType: "optional" }) });
}
function m(...e2) {
return u({ [t]: () => ({ match: (t2) => {
let n2 = {};
const r2 = (t3, e3) => {
n2[t3] = e3;
};
return { matched: e2.every((e3) => s(e3, t2, r2)), selections: n2 };
}, getSelectionKeys: () => c(e2, o), matcherType: "and" }) });
}
function d(...e2) {
return u({ [t]: () => ({ match: (t2) => {
let n2 = {};
const r2 = (t3, e3) => {
n2[t3] = e3;
};
return c(e2, o).forEach((t3) => r2(t3, void 0)), { matched: e2.some((e3) => s(e3, t2, r2)), selections: n2 };
}, getSelectionKeys: () => c(e2, o), matcherType: "or" }) });
}
function p(e2) {
return { [t]: () => ({ match: (t2) => ({ matched: Boolean(e2(t2)) }) }) };
}
function y(...e2) {
const r2 = "string" == typeof e2[0] ? e2[0] : void 0, i2 = 2 === e2.length ? e2[1] : "string" == typeof e2[0] ? void 0 : e2[0];
return u({ [t]: () => ({ match: (t2) => {
let e3 = { [null != r2 ? r2 : n]: t2 };
return { matched: void 0 === i2 || s(i2, t2, (t3, n2) => {
e3[t3] = n2;
}), selections: e3 };
}, getSelectionKeys: () => [null != r2 ? r2 : n].concat(void 0 === i2 ? [] : o(i2)) }) });
}
function v(t2) {
return "number" == typeof t2;
}
function b(t2) {
return "string" == typeof t2;
}
function w(t2) {
return "bigint" == typeof t2;
}
var S = u(p(function(t2) {
return true;
}));
var j = (t2) => Object.assign(u(t2), { startsWith: (e2) => {
return j(m(t2, (n2 = e2, p((t3) => b(t3) && t3.startsWith(n2)))));
var n2;
}, endsWith: (e2) => {
return j(m(t2, (n2 = e2, p((t3) => b(t3) && t3.endsWith(n2)))));
var n2;
}, minLength: (e2) => j(m(t2, ((t3) => p((e3) => b(e3) && e3.length >= t3))(e2))), length: (e2) => j(m(t2, ((t3) => p((e3) => b(e3) && e3.length === t3))(e2))), maxLength: (e2) => j(m(t2, ((t3) => p((e3) => b(e3) && e3.length <= t3))(e2))), includes: (e2) => {
return j(m(t2, (n2 = e2, p((t3) => b(t3) && t3.includes(n2)))));
var n2;
}, regex: (e2) => {
return j(m(t2, (n2 = e2, p((t3) => b(t3) && Boolean(t3.match(n2))))));
var n2;
} });
var K = j(p(b));
var x = (t2) => Object.assign(u(t2), { between: (e2, n2) => x(m(t2, ((t3, e3) => p((n3) => v(n3) && t3 <= n3 && e3 >= n3))(e2, n2))), lt: (e2) => x(m(t2, ((t3) => p((e3) => v(e3) && e3 < t3))(e2))), gt: (e2) => x(m(t2, ((t3) => p((e3) => v(e3) && e3 > t3))(e2))), lte: (e2) => x(m(t2, ((t3) => p((e3) => v(e3) && e3 <= t3))(e2))), gte: (e2) => x(m(t2, ((t3) => p((e3) => v(e3) && e3 >= t3))(e2))), int: () => x(m(t2, p((t3) => v(t3) && Number.isInteger(t3)))), finite: () => x(m(t2, p((t3) => v(t3) && Number.isFinite(t3)))), positive: () => x(m(t2, p((t3) => v(t3) && t3 > 0))), negative: () => x(m(t2, p((t3) => v(t3) && t3 < 0))) });
var E = x(p(v));
var A = (t2) => Object.assign(u(t2), { between: (e2, n2) => A(m(t2, ((t3, e3) => p((n3) => w(n3) && t3 <= n3 && e3 >= n3))(e2, n2))), lt: (e2) => A(m(t2, ((t3) => p((e3) => w(e3) && e3 < t3))(e2))), gt: (e2) => A(m(t2, ((t3) => p((e3) => w(e3) && e3 > t3))(e2))), lte: (e2) => A(m(t2, ((t3) => p((e3) => w(e3) && e3 <= t3))(e2))), gte: (e2) => A(m(t2, ((t3) => p((e3) => w(e3) && e3 >= t3))(e2))), positive: () => A(m(t2, p((t3) => w(t3) && t3 > 0))), negative: () => A(m(t2, p((t3) => w(t3) && t3 < 0))) });
var P = A(p(w));
var T = u(p(function(t2) {
return "boolean" == typeof t2;
}));
var B = u(p(function(t2) {
return "symbol" == typeof t2;
}));
var _ = u(p(function(t2) {
return null == t2;
}));
var k = u(p(function(t2) {
return null != t2;
}));
var W = class extends Error {
constructor(t2) {
let e2;
try {
e2 = JSON.stringify(t2);
} catch (n2) {
e2 = t2;
}
super(`Pattern matching error: no pattern matches value ${e2}`), this.input = void 0, this.input = t2;
}
};
var $ = { matched: false, value: void 0 };
function z(t2) {
return new I(t2, $);
}
var I = class _I {
constructor(t2, e2) {
this.input = void 0, this.state = void 0, this.input = t2, this.state = e2;
}
with(...t2) {
if (this.state.matched) return this;
const e2 = t2[t2.length - 1], r2 = [t2[0]];
let i2;
3 === t2.length && "function" == typeof t2[1] ? i2 = t2[1] : t2.length > 2 && r2.push(...t2.slice(1, t2.length - 1));
let o2 = false, c2 = {};
const a = (t3, e3) => {
o2 = true, c2[t3] = e3;
}, u2 = !r2.some((t3) => s(t3, this.input, a)) || i2 && !Boolean(i2(this.input)) ? $ : { matched: true, value: e2(o2 ? n in c2 ? c2[n] : c2 : this.input, this.input) };
return new _I(this.input, u2);
}
when(t2, e2) {
if (this.state.matched) return this;
const n2 = Boolean(t2(this.input));
return new _I(this.input, n2 ? { matched: true, value: e2(this.input, this.input) } : $);
}
otherwise(t2) {
return this.state.matched ? this.state.value : t2(this.input);
}
exhaustive() {
if (this.state.matched) return this.state.value;
throw new W(this.input);
}
run() {
return this.exhaustive();
}
returnType() {
return this;
}
};
var exec = (0, import_util.promisify)(import_child_process.default.exec);
var debug = (0, import_debug.default)("prisma:get-platform");
var supportedLibSSLVersions = ["1.0.x", "1.1.x", "3.0.x"];
async function getos() {
const platform = import_os.default.platform();
const arch = process.arch;
if (platform === "freebsd") {
const version = await getCommandOutput(`freebsd-version`);
if (version && version.trim().length > 0) {
const regex = /^(\d+)\.?/;
const match = regex.exec(version);
if (match) {
return {
platform: "freebsd",
targetDistro: `freebsd${match[1]}`,
arch
};
}
}
}
if (platform !== "linux") {
return {
platform,
arch
};
}
const distroInfo = await resolveDistro();
const archFromUname = await getArchFromUname();
const libsslSpecificPaths = computeLibSSLSpecificPaths({ arch, archFromUname, familyDistro: distroInfo.familyDistro });
const { libssl } = await getSSLVersion(libsslSpecificPaths);
return {
platform: "linux",
libssl,
arch,
archFromUname,
...distroInfo
};
}
function parseDistro(osReleaseInput) {
const idRegex = /^ID="?([^"\n]*)"?$/im;
const idLikeRegex = /^ID_LIKE="?([^"\n]*)"?$/im;
const idMatch = idRegex.exec(osReleaseInput);
const id = idMatch && idMatch[1] && idMatch[1].toLowerCase() || "";
const idLikeMatch = idLikeRegex.exec(osReleaseInput);
const idLike = idLikeMatch && idLikeMatch[1] && idLikeMatch[1].toLowerCase() || "";
const distroInfo = z({ id, idLike }).with(
{ id: "alpine" },
({ id: originalDistro }) => ({
targetDistro: "musl",
familyDistro: originalDistro,
originalDistro
})
).with(
{ id: "raspbian" },
({ id: originalDistro }) => ({
targetDistro: "arm",
familyDistro: "debian",
originalDistro
})
).with(
{ id: "nixos" },
({ id: originalDistro }) => ({
targetDistro: "nixos",
originalDistro,
familyDistro: "nixos"
})
).with(
{ id: "debian" },
{ id: "ubuntu" },
({ id: originalDistro }) => ({
targetDistro: "debian",
familyDistro: "debian",
originalDistro
})
).with(
{ id: "rhel" },
{ id: "centos" },
{ id: "fedora" },
({ id: originalDistro }) => ({
targetDistro: "rhel",
familyDistro: "rhel",
originalDistro
})
).when(
({ idLike: idLike2 }) => idLike2.includes("debian") || idLike2.includes("ubuntu"),
({ id: originalDistro }) => ({
targetDistro: "debian",
familyDistro: "debian",
originalDistro
})
).when(
({ idLike: idLike2 }) => id === "arch" || idLike2.includes("arch"),
({ id: originalDistro }) => ({
targetDistro: "debian",
familyDistro: "arch",
originalDistro
})
).when(
({ idLike: idLike2 }) => idLike2.includes("centos") || idLike2.includes("fedora") || idLike2.includes("rhel") || idLike2.includes("suse"),
({ id: originalDistro }) => ({
targetDistro: "rhel",
familyDistro: "rhel",
originalDistro
})
).otherwise(({ id: originalDistro }) => {
return {
targetDistro: void 0,
familyDistro: void 0,
originalDistro
};
});
debug(`Found distro info:
${JSON.stringify(distroInfo, null, 2)}`);
return distroInfo;
}
async function resolveDistro() {
const osReleaseFile = "/etc/os-release";
try {
const osReleaseInput = await import_promises.default.readFile(osReleaseFile, { encoding: "utf-8" });
return parseDistro(osReleaseInput);
} catch (_2) {
return {
targetDistro: void 0,
familyDistro: void 0,
originalDistro: void 0
};
}
}
function parseOpenSSLVersion(input) {
const match = /^OpenSSL\s(\d+\.\d+)\.\d+/.exec(input);
if (match) {
const partialVersion = `${match[1]}.x`;
return sanitiseSSLVersion(partialVersion);
}
return void 0;
}
function parseLibSSLVersion(input) {
const match = /libssl\.so\.(\d)(\.\d)?/.exec(input);
if (match) {
const partialVersion = `${match[1]}${match[2] ?? ".0"}.x`;
return sanitiseSSLVersion(partialVersion);
}
return void 0;
}
function sanitiseSSLVersion(version) {
const sanitisedVersion = (() => {
if (isLibssl1x(version)) {
return version;
}
const versionSplit = version.split(".");
versionSplit[1] = "0";
return versionSplit.join(".");
})();
if (supportedLibSSLVersions.includes(sanitisedVersion)) {
return sanitisedVersion;
}
return void 0;
}
function computeLibSSLSpecificPaths(args) {
return z(args).with({ familyDistro: "musl" }, () => {
debug('Trying platform-specific paths for "alpine"');
return ["/lib", "/usr/lib"];
}).with({ familyDistro: "debian" }, ({ archFromUname }) => {
debug('Trying platform-specific paths for "debian" (and "ubuntu")');
return [`/usr/lib/${archFromUname}-linux-gnu`, `/lib/${archFromUname}-linux-gnu`];
}).with({ familyDistro: "rhel" }, () => {
debug('Trying platform-specific paths for "rhel"');
return ["/lib64", "/usr/lib64"];
}).otherwise(({ familyDistro, arch, archFromUname }) => {
debug(`Don't know any platform-specific paths for "${familyDistro}" on ${arch} (${archFromUname})`);
return [];
});
}
async function getSSLVersion(libsslSpecificPaths) {
const excludeLibssl0x = 'grep -v "libssl.so.0"';
const libsslFilenameFromSpecificPath = await findLibSSLInLocations(libsslSpecificPaths);
if (libsslFilenameFromSpecificPath) {
debug(`Found libssl.so file using platform-specific paths: ${libsslFilenameFromSpecificPath}`);
const libsslVersion = parseLibSSLVersion(libsslFilenameFromSpecificPath);
debug(`The parsed libssl version is: ${libsslVersion}`);
if (libsslVersion) {
return { libssl: libsslVersion, strategy: "libssl-specific-path" };
}
}
debug('Falling back to "ldconfig" and other generic paths');
let libsslFilename = await getCommandOutput(
/**
* The `ldconfig -p` returns the dynamic linker cache paths, where libssl.so files are likely to be included.
* Each line looks like this:
* libssl.so (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libssl.so.1.1
* But we're only interested in the filename, so we use sed to remove everything before the `=>` separator,
* and then we remove the path and keep only the filename.
* The second sed commands uses `|` as a separator because the paths may contain `/`, which would result in the
* `unknown option to 's'` error (see https://stackoverflow.com/a/9366940/6174476) - which would silently
* fail with error code 0.
*/
`ldconfig -p | sed "s/.*=>s*//" | sed "s|.*/||" | grep libssl | sort | ${excludeLibssl0x}`
);
if (!libsslFilename) {
libsslFilename = await findLibSSLInLocations(["/lib64", "/usr/lib64", "/lib", "/usr/lib"]);
}
if (libsslFilename) {
debug(`Found libssl.so file using "ldconfig" or other generic paths: ${libsslFilename}`);
const libsslVersion = parseLibSSLVersion(libsslFilename);
debug(`The parsed libssl version is: ${libsslVersion}`);
if (libsslVersion) {
return { libssl: libsslVersion, strategy: "ldconfig" };
}
}
const openSSLVersionLine = await getCommandOutput("openssl version -v");
if (openSSLVersionLine) {
debug(`Found openssl binary with version: ${openSSLVersionLine}`);
const openSSLVersion = parseOpenSSLVersion(openSSLVersionLine);
debug(`The parsed openssl version is: ${openSSLVersion}`);
if (openSSLVersion) {
return { libssl: openSSLVersion, strategy: "openssl-binary" };
}
}
debug(`Couldn't find any version of libssl or OpenSSL in the system`);
return {};
}
async function findLibSSLInLocations(directories) {
for (const dir of directories) {
const libssl = await findLibSSL(dir);
if (libssl) {
return libssl;
}
}
return void 0;
}
async function findLibSSL(directory) {
try {
const dirContents = await import_promises.default.readdir(directory);
return dirContents.find((value) => value.startsWith("libssl.so.") && !value.startsWith("libssl.so.0"));
} catch (e2) {
if (e2.code === "ENOENT") {
return void 0;
}
throw e2;
}
}
async function getBinaryTargetForCurrentPlatform() {
const { binaryTarget } = await getPlatformInfoMemoized();
return binaryTarget;
}
function isPlatformInfoDefined(args) {
return args.binaryTarget !== void 0;
}
async function getPlatformInfo() {
const { memoized: _2, ...rest } = await getPlatformInfoMemoized();
return rest;
}
var memoizedPlatformWithInfo = {};
async function getPlatformInfoMemoized() {
if (isPlatformInfoDefined(memoizedPlatformWithInfo)) {
return Promise.resolve({ ...memoizedPlatformWithInfo, memoized: true });
}
const args = await getos();
const binaryTarget = getBinaryTargetForCurrentPlatformInternal(args);
memoizedPlatformWithInfo = { ...args, binaryTarget };
return { ...memoizedPlatformWithInfo, memoized: false };
}
function getBinaryTargetForCurrentPlatformInternal(args) {
const { platform, arch, archFromUname, libssl, targetDistro, familyDistro, originalDistro } = args;
if (platform === "linux" && !["x64", "arm64"].includes(arch)) {
(0, import_chunk_FWMN4WME.warn)(
`Prisma only officially supports Linux on amd64 (x86_64) and arm64 (aarch64) system architectures (detected "${arch}" instead). If you are using your own custom Prisma engines, you can ignore this warning, as long as you've compiled the engines for your system architecture "${archFromUname}".`
);
}
const defaultLibssl = "1.1.x";
if (platform === "linux" && libssl === void 0) {
const additionalMessage = z({ familyDistro }).with({ familyDistro: "debian" }, () => {
return "Please manually install OpenSSL via `apt-get update -y && apt-get install -y openssl` and try installing Prisma again. If you're running Prisma on Docker, add this command to your Dockerfile, or switch to an image that already has OpenSSL installed.";
}).otherwise(() => {
return "Please manually install OpenSSL and try installing Prisma again.";
});
(0, import_chunk_FWMN4WME.warn)(
`Prisma failed to detect the libssl/openssl version to use, and may not work as expected. Defaulting to "openssl-${defaultLibssl}".
${additionalMessage}`
);
}
const defaultDistro = "debian";
if (platform === "linux" && targetDistro === void 0) {
debug(`Distro is "${originalDistro}". Falling back to Prisma engines built for "${defaultDistro}".`);
}
if (platform === "darwin" && arch === "arm64") {
return "darwin-arm64";
}
if (platform === "darwin") {
return "darwin";
}
if (platform === "win32") {
return "windows";
}
if (platform === "freebsd") {
return targetDistro;
}
if (platform === "openbsd") {
return "openbsd";
}
if (platform === "netbsd") {
return "netbsd";
}
if (platform === "linux" && targetDistro === "nixos") {
return "linux-nixos";
}
if (platform === "linux" && arch === "arm64") {
const baseName = targetDistro === "musl" ? "linux-musl-arm64" : "linux-arm64";
return `${baseName}-openssl-${libssl || defaultLibssl}`;
}
if (platform === "linux" && arch === "arm") {
return `linux-arm-openssl-${libssl || defaultLibssl}`;
}
if (platform === "linux" && targetDistro === "musl") {
const base = "linux-musl";
if (!libssl) {
return base;
}
if (isLibssl1x(libssl)) {
return base;
} else {
return `${base}-openssl-${libssl}`;
}
}
if (platform === "linux" && targetDistro && libssl) {
return `${targetDistro}-openssl-${libssl}`;
}
if (platform !== "linux") {
(0, import_chunk_FWMN4WME.warn)(`Prisma detected unknown OS "${platform}" and may not work as expected. Defaulting to "linux".`);
}
if (libssl) {
return `${defaultDistro}-openssl-${libssl}`;
}
if (targetDistro) {
return `${targetDistro}-openssl-${defaultLibssl}`;
}
return `${defaultDistro}-openssl-${defaultLibssl}`;
}
async function discardError(runPromise) {
try {
return await runPromise();
} catch (e2) {
return void 0;
}
}
function getCommandOutput(command) {
return discardError(async () => {
const result = await exec(command);
debug(`Command "${command}" successfully returned "${result.stdout}"`);
return result.stdout;
});
}
async function getArchFromUname() {
if (typeof import_os.default["machine"] === "function") {
return import_os.default["machine"]();
}
const arch = await getCommandOutput("uname -m");
return arch?.trim();
}
function isLibssl1x(libssl) {
return libssl.startsWith("1.");
}

View file

@ -0,0 +1,41 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var chunk_FWMN4WME_exports = {};
__export(chunk_FWMN4WME_exports, {
log: () => log,
should: () => should,
tags: () => tags,
warn: () => warn
});
module.exports = __toCommonJS(chunk_FWMN4WME_exports);
var import_chunk_YVXCXD3A = require("./chunk-YVXCXD3A.js");
var tags = {
warn: (0, import_chunk_YVXCXD3A.yellow)("prisma:warn")
};
var should = {
warn: () => !process.env.PRISMA_DISABLE_WARNINGS
};
function log(...data) {
console.log(...data);
}
function warn(message, ...optionalParams) {
if (should.warn()) {
console.warn(`${tags.warn} ${message}`, ...optionalParams);
}
}

View file

@ -0,0 +1,43 @@
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var chunk_O5EOXX3N_exports = {};
__export(chunk_O5EOXX3N_exports, {
assertNodeAPISupported: () => assertNodeAPISupported
});
module.exports = __toCommonJS(chunk_O5EOXX3N_exports);
var import_fs = __toESM(require("fs"));
function assertNodeAPISupported() {
const customLibraryPath = process.env.PRISMA_QUERY_ENGINE_LIBRARY;
const customLibraryExists = customLibraryPath && import_fs.default.existsSync(customLibraryPath);
if (!customLibraryExists && process.arch === "ia32") {
throw new Error(
`The default query engine type (Node-API, "library") is currently not supported for 32bit Node. Please set \`engineType = "binary"\` in the "generator" block of your "schema.prisma" file (or use the environment variables "PRISMA_CLIENT_ENGINE_TYPE=binary" and/or "PRISMA_CLI_QUERY_ENGINE_TYPE=binary".)`
);
}
}

View file

@ -0,0 +1,70 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var chunk_YVXCXD3A_exports = {};
__export(chunk_YVXCXD3A_exports, {
underline: () => underline,
yellow: () => yellow
});
module.exports = __toCommonJS(chunk_YVXCXD3A_exports);
var FORCE_COLOR;
var NODE_DISABLE_COLORS;
var NO_COLOR;
var TERM;
var isTTY = true;
if (typeof process !== "undefined") {
({ FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = process.env || {});
isTTY = process.stdout && process.stdout.isTTY;
}
var $ = {
enabled: !NODE_DISABLE_COLORS && NO_COLOR == null && TERM !== "dumb" && (FORCE_COLOR != null && FORCE_COLOR !== "0" || isTTY)
};
function init(x, y) {
let rgx = new RegExp(`\\x1b\\[${y}m`, "g");
let open = `\x1B[${x}m`, close = `\x1B[${y}m`;
return function(txt) {
if (!$.enabled || txt == null) return txt;
return open + (!!~("" + txt).indexOf(close) ? txt.replace(rgx, close + open) : txt) + close;
};
}
var reset = init(0, 0);
var bold = init(1, 22);
var dim = init(2, 22);
var italic = init(3, 23);
var underline = init(4, 24);
var inverse = init(7, 27);
var hidden = init(8, 28);
var strikethrough = init(9, 29);
var black = init(30, 39);
var red = init(31, 39);
var green = init(32, 39);
var yellow = init(33, 39);
var blue = init(34, 39);
var magenta = init(35, 39);
var cyan = init(36, 39);
var white = init(37, 39);
var gray = init(90, 39);
var grey = init(90, 39);
var bgBlack = init(40, 49);
var bgRed = init(41, 49);
var bgGreen = init(42, 49);
var bgYellow = init(43, 49);
var bgBlue = init(44, 49);
var bgMagenta = init(45, 49);
var bgCyan = init(46, 49);
var bgWhite = init(47, 49);

View file

@ -0,0 +1,8 @@
import { BinaryTarget } from './binaryTargets';
/**
* Gets Node-API Library name depending on the binary target
* @param binaryTarget
* @param type `fs` gets name used on the file system, `url` gets the name required to download the library from S3
* @returns
*/
export declare function getNodeAPIName(binaryTarget: BinaryTarget, type: 'url' | 'fs'): string;

View file

@ -0,0 +1,25 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var getNodeAPIName_exports = {};
__export(getNodeAPIName_exports, {
getNodeAPIName: () => import_chunk_2U36ISZO.getNodeAPIName
});
module.exports = __toCommonJS(getNodeAPIName_exports);
var import_chunk_2U36ISZO = require("./chunk-2U36ISZO.js");
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");

View file

@ -0,0 +1,105 @@
/// <reference types="node" />
import { BinaryTarget } from './binaryTargets';
declare const supportedLibSSLVersions: readonly ["1.0.x", "1.1.x", "3.0.x"];
export type Arch = 'x32' | 'x64' | 'arm' | 'arm64' | 's390' | 's390x' | 'mipsel' | 'ia32' | 'mips' | 'ppc' | 'ppc64';
export type DistroInfo = {
/**
* The original distro is the Linux distro name detected via its release file.
* E.g., on Arch Linux, the original distro is `arch`. On Linux Alpine, the original distro is `alpine`.
*/
originalDistro?: string;
/**
* The family distro is the Linux distro name that is used to determine Linux families based on the same base distro, and likely using the same package manager.
* E.g., both Ubuntu and Debian belong to the `debian` family of distros, and thus rely on the same package manager (`apt`).
*/
familyDistro?: string;
/**
* The target distro is the Linux distro associated with the Prisma Engines.
* E.g., on Arch Linux, Debian, and Ubuntu, the target distro is `debian`. On Linux Alpine, the target distro is `musl`.
*/
targetDistro?: 'rhel' | 'debian' | 'musl' | 'arm' | 'nixos' | 'freebsd11' | 'freebsd12' | 'freebsd13' | 'freebsd14' | 'freebsd15';
};
type GetOsResultLinux = {
platform: 'linux';
arch: Arch;
archFromUname: string | undefined;
/**
* Starting from version 3.0, OpenSSL is basically adopting semver, and will be API and ABI compatible within a major version.
*/
libssl?: (typeof supportedLibSSLVersions)[number];
} & DistroInfo;
export type GetOSResult = {
platform: Omit<NodeJS.Platform, 'linux'>;
arch: Arch;
targetDistro?: DistroInfo['targetDistro'];
familyDistro?: never;
originalDistro?: never;
archFromUname?: never;
libssl?: never;
} | GetOsResultLinux;
/**
* For internal use only. This public export will be eventually removed in favor of `getPlatformWithOSResult`.
*/
export declare function getos(): Promise<GetOSResult>;
export declare function parseDistro(osReleaseInput: string): DistroInfo;
export declare function resolveDistro(): Promise<DistroInfo>;
/**
* Parse the OpenSSL version from the output of the openssl binary, e.g.
* "OpenSSL 3.0.2 15 Mar 2022 (Library: OpenSSL 3.0.2 15 Mar 2022)" -> "3.0.x"
*/
export declare function parseOpenSSLVersion(input: string): GetOsResultLinux['libssl'] | undefined;
/**
* Parse the OpenSSL version from the output of the libssl.so file, e.g.
* "libssl.so.3" -> "3.0.x"
*/
export declare function parseLibSSLVersion(input: string): GetOsResultLinux['libssl'];
type ComputeLibSSLSpecificPathsParams = {
arch: Arch;
archFromUname: Awaited<ReturnType<typeof getArchFromUname>>;
familyDistro: DistroInfo['familyDistro'];
};
export declare function computeLibSSLSpecificPaths(args: ComputeLibSSLSpecificPathsParams): string[];
type GetOpenSSLVersionResult = {
libssl: GetOsResultLinux['libssl'];
strategy: 'libssl-specific-path' | 'ldconfig' | 'openssl-binary';
} | {
libssl?: never;
strategy?: never;
};
/**
* On Linux, returns the libssl version excluding the patch version, e.g. "1.1.x".
* Reading the version from the libssl.so file is more reliable than reading it from the openssl binary.
* Older versions of libssl are preferred, e.g. "1.0.x" over "1.1.x", because of Vercel serverless
* having different build and runtime environments, with the runtime environment having an old version
* of libssl, and the build environment having both that old version and a newer version of libssl installed.
* Because of https://github.com/prisma/prisma/issues/17499, we explicitly filter out libssl 0.x.
*
* This function never throws.
*/
export declare function getSSLVersion(libsslSpecificPaths: string[]): Promise<GetOpenSSLVersionResult>;
/**
* Get the binary target for the current platform, e.g. `linux-musl-arm64-openssl-3.0.x` for Linux Alpine on arm64.
*/
export declare function getBinaryTargetForCurrentPlatform(): Promise<BinaryTarget>;
export type PlatformInfo = GetOSResult & {
binaryTarget: BinaryTarget;
};
/**
* Get the binary target and other system information (e.g., the libssl version to look for) for the current platform.
*/
export declare function getPlatformInfo(): Promise<PlatformInfo>;
export declare function getPlatformInfoMemoized(): Promise<PlatformInfo & {
memoized: boolean;
}>;
/**
* This function is only exported for testing purposes.
*/
export declare function getBinaryTargetForCurrentPlatformInternal(args: GetOSResult): BinaryTarget;
/**
* Returns the architecture of a system from the output of `uname -m` (whose format is different than `process.arch`).
* This function never throws.
* TODO: deprecate this function in favor of `os.machine()` once either Node v16.18.0 or v18.9.0 becomes the minimum
* supported Node.js version for Prisma.
*/
export declare function getArchFromUname(): Promise<string | undefined>;
export {};

View file

@ -0,0 +1,38 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var getPlatform_exports = {};
__export(getPlatform_exports, {
computeLibSSLSpecificPaths: () => import_chunk_EY5MORMD.computeLibSSLSpecificPaths,
getArchFromUname: () => import_chunk_EY5MORMD.getArchFromUname,
getBinaryTargetForCurrentPlatform: () => import_chunk_EY5MORMD.getBinaryTargetForCurrentPlatform,
getBinaryTargetForCurrentPlatformInternal: () => import_chunk_EY5MORMD.getBinaryTargetForCurrentPlatformInternal,
getPlatformInfo: () => import_chunk_EY5MORMD.getPlatformInfo,
getPlatformInfoMemoized: () => import_chunk_EY5MORMD.getPlatformInfoMemoized,
getSSLVersion: () => import_chunk_EY5MORMD.getSSLVersion,
getos: () => import_chunk_EY5MORMD.getos,
parseDistro: () => import_chunk_EY5MORMD.parseDistro,
parseLibSSLVersion: () => import_chunk_EY5MORMD.parseLibSSLVersion,
parseOpenSSLVersion: () => import_chunk_EY5MORMD.parseOpenSSLVersion,
resolveDistro: () => import_chunk_EY5MORMD.resolveDistro
});
module.exports = __toCommonJS(getPlatform_exports);
var import_chunk_EY5MORMD = require("./chunk-EY5MORMD.js");
var import_chunk_FWMN4WME = require("./chunk-FWMN4WME.js");
var import_chunk_YVXCXD3A = require("./chunk-YVXCXD3A.js");
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");

View file

@ -0,0 +1,7 @@
export { assertNodeAPISupported } from './assertNodeAPISupported';
export { type BinaryTarget, binaryTargets } from './binaryTargets';
export { getNodeAPIName } from './getNodeAPIName';
export type { PlatformInfo } from './getPlatform';
export { getBinaryTargetForCurrentPlatform, getos, getPlatformInfo } from './getPlatform';
export { link } from './link';
export * from './test-utils';

View file

@ -0,0 +1,43 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var dist_exports = {};
__export(dist_exports, {
assertNodeAPISupported: () => import_chunk_O5EOXX3N.assertNodeAPISupported,
binaryTargets: () => import_chunk_7MLUNQIZ.binaryTargets,
getBinaryTargetForCurrentPlatform: () => import_chunk_EY5MORMD.getBinaryTargetForCurrentPlatform,
getNodeAPIName: () => import_chunk_2U36ISZO.getNodeAPIName,
getPlatformInfo: () => import_chunk_EY5MORMD.getPlatformInfo,
getos: () => import_chunk_EY5MORMD.getos,
jestConsoleContext: () => import_chunk_2GHEBYIY.jestConsoleContext,
jestContext: () => import_chunk_2GHEBYIY.jestContext,
jestProcessContext: () => import_chunk_2GHEBYIY.jestProcessContext,
link: () => import_chunk_D7S5FGQN.link
});
module.exports = __toCommonJS(dist_exports);
var import_chunk_6HZWON4S = require("./chunk-6HZWON4S.js");
var import_chunk_2GHEBYIY = require("./chunk-2GHEBYIY.js");
var import_chunk_O5EOXX3N = require("./chunk-O5EOXX3N.js");
var import_chunk_2U36ISZO = require("./chunk-2U36ISZO.js");
var import_chunk_EY5MORMD = require("./chunk-EY5MORMD.js");
var import_chunk_D7S5FGQN = require("./chunk-D7S5FGQN.js");
var import_chunk_FWMN4WME = require("./chunk-FWMN4WME.js");
var import_chunk_YVXCXD3A = require("./chunk-YVXCXD3A.js");
var import_chunk_7MLUNQIZ = require("./chunk-7MLUNQIZ.js");
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");
(0, import_chunk_7MLUNQIZ.init_binaryTargets)();

View file

@ -0,0 +1 @@
export declare function link(url: any): string;

View file

@ -0,0 +1,26 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var link_exports = {};
__export(link_exports, {
link: () => import_chunk_D7S5FGQN.link
});
module.exports = __toCommonJS(link_exports);
var import_chunk_D7S5FGQN = require("./chunk-D7S5FGQN.js");
var import_chunk_YVXCXD3A = require("./chunk-YVXCXD3A.js");
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");

View file

@ -0,0 +1,8 @@
export declare const tags: {
warn: string;
};
export declare const should: {
warn: () => boolean;
};
export declare function log(...data: any[]): void;
export declare function warn(message: any, ...optionalParams: any[]): void;

View file

@ -0,0 +1,29 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var logger_exports = {};
__export(logger_exports, {
log: () => import_chunk_FWMN4WME.log,
should: () => import_chunk_FWMN4WME.should,
tags: () => import_chunk_FWMN4WME.tags,
warn: () => import_chunk_FWMN4WME.warn
});
module.exports = __toCommonJS(logger_exports);
var import_chunk_FWMN4WME = require("./chunk-FWMN4WME.js");
var import_chunk_YVXCXD3A = require("./chunk-YVXCXD3A.js");
var import_chunk_2ESYSVXG = require("./chunk-2ESYSVXG.js");

View file

@ -0,0 +1,8 @@
/**
* This regex matches all supported binary target names in a given string.
*
* Platform names are sorted by their lengths in descending order to ensure that
* the longest substring is always matched (e.g., "darwin-arm64" is matched as a
* whole instead of "darwin" and "arm" separately)
*/
export declare const binaryTargetRegex: RegExp;

View file

@ -0,0 +1,27 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var binaryTargetRegex_exports = {};
__export(binaryTargetRegex_exports, {
binaryTargetRegex: () => import_chunk_B23KD6U3.binaryTargetRegex
});
module.exports = __toCommonJS(binaryTargetRegex_exports);
var import_chunk_B23KD6U3 = require("../chunk-B23KD6U3.js");
var import_chunk_7MLUNQIZ = require("../chunk-7MLUNQIZ.js");
var import_chunk_2ESYSVXG = require("../chunk-2ESYSVXG.js");
(0, import_chunk_B23KD6U3.init_binaryTargetRegex)();

View file

@ -0,0 +1 @@
export { type BaseContext, jestConsoleContext, jestContext, jestProcessContext } from './jestContext';

View file

@ -0,0 +1,28 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var test_utils_exports = {};
__export(test_utils_exports, {
jestConsoleContext: () => import_chunk_2GHEBYIY.jestConsoleContext,
jestContext: () => import_chunk_2GHEBYIY.jestContext,
jestProcessContext: () => import_chunk_2GHEBYIY.jestProcessContext
});
module.exports = __toCommonJS(test_utils_exports);
var import_chunk_6HZWON4S = require("../chunk-6HZWON4S.js");
var import_chunk_2GHEBYIY = require("../chunk-2GHEBYIY.js");
var import_chunk_2ESYSVXG = require("../chunk-2ESYSVXG.js");

View file

@ -0,0 +1,108 @@
/// <reference types="jest" />
import type { ExecaChildProcess } from 'execa';
import type { FSJetpack } from 'fs-jetpack/types';
/**
* Base test context.
*/
export type BaseContext = {
tmpDir: string;
fs: FSJetpack;
mocked: {
cwd: string;
};
/**
* Set up the temporary directory based on the contents of some fixture.
*/
fixture: (name: string) => void;
/**
* Spawn the Prisma cli using the temporary directory as the CWD.
*
* @remarks
*
* For this to work the source must be built
*/
cli: (...input: string[]) => ExecaChildProcess<string>;
printDir(dir: string, extensions: string[]): void;
/**
* JavaScript-friendly implementation of the `tree` command. It skips the `node_modules` directory.
* @param itemPath The path to start the tree from, defaults to the root of the temporary directory
* @param indent How much to indent each level of the tree, defaults to ''
* @returns String representation of the directory tree
*/
tree: (itemPath?: string, indent?: string) => void;
};
/**
* Create test context to use in tests. Provides the following:
*
* - A temporary directory
* - an fs-jetpack instance bound to the temporary directory
* - Mocked process.cwd via Node process.chdir
* - Fixture loader for bootstrapping the temporary directory with content
*/
export declare const jestContext: {
new: (ctx?: BaseContext) => {
add<NewContext>(contextContributor: ContextContributor<BaseContext, NewContext>): {
add<NewContext_1>(contextContributor: ContextContributor<BaseContext & NewContext, NewContext_1>): {
add<NewContext_2>(contextContributor: ContextContributor<BaseContext & NewContext & NewContext_1, NewContext_2>): {
add<NewContext_3>(contextContributor: ContextContributor<BaseContext & NewContext & NewContext_1 & NewContext_2, NewContext_3>): {
add<NewContext_4>(contextContributor: ContextContributor<BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3, NewContext_4>): {
add<NewContext_5>(contextContributor: ContextContributor<BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3 & NewContext_4, NewContext_5>): {
add<NewContext_6>(contextContributor: ContextContributor<BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3 & NewContext_4 & NewContext_5, NewContext_6>): {
add<NewContext_7>(contextContributor: ContextContributor<BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3 & NewContext_4 & NewContext_5 & NewContext_6, NewContext_7>): {
add<NewContext_8>(contextContributor: ContextContributor<BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3 & NewContext_4 & NewContext_5 & NewContext_6 & NewContext_7, NewContext_8>): {
add<NewContext_9>(contextContributor: ContextContributor<BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3 & NewContext_4 & NewContext_5 & NewContext_6 & NewContext_7 & NewContext_8, NewContext_9>): {
add<NewContext_10>(contextContributor: ContextContributor<BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3 & NewContext_4 & NewContext_5 & NewContext_6 & NewContext_7 & NewContext_8 & NewContext_9, NewContext_10>): any;
assemble(): BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3 & NewContext_4 & NewContext_5 & NewContext_6 & NewContext_7 & NewContext_8 & NewContext_9;
};
assemble(): BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3 & NewContext_4 & NewContext_5 & NewContext_6 & NewContext_7 & NewContext_8;
};
assemble(): BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3 & NewContext_4 & NewContext_5 & NewContext_6 & NewContext_7;
};
assemble(): BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3 & NewContext_4 & NewContext_5 & NewContext_6;
};
assemble(): BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3 & NewContext_4 & NewContext_5;
};
assemble(): BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3 & NewContext_4;
};
assemble(): BaseContext & NewContext & NewContext_1 & NewContext_2 & NewContext_3;
};
assemble(): BaseContext & NewContext & NewContext_1 & NewContext_2;
};
assemble(): BaseContext & NewContext & NewContext_1;
};
assemble(): BaseContext & NewContext;
};
assemble(): BaseContext;
};
};
/**
* Factory for creating a context contributor possibly configured in some special way.
*/
type ContextContributorFactory<Settings, Context, NewContext> = Settings extends {} ? () => ContextContributor<Context, NewContext> : (settings: Settings) => ContextContributor<Context, NewContext>;
/**
* A function that provides additional test context.
*/
type ContextContributor<Context, NewContext> = (ctx: Context) => Context & NewContext;
/**
* Test context contributor. Mocks console.error with a Jest spy before each test.
*/
type ConsoleContext = {
mocked: {
'console.error': jest.SpyInstance;
'console.log': jest.SpyInstance;
'console.info': jest.SpyInstance;
'console.warn': jest.SpyInstance;
};
};
export declare const jestConsoleContext: ContextContributorFactory<{}, BaseContext, ConsoleContext>;
/**
* Test context contributor. Mocks process.std(out|err).write with a Jest spy before each test.
*/
type ProcessContext = {
mocked: {
'process.stderr.write': jest.SpyInstance;
'process.stdout.write': jest.SpyInstance;
};
};
export declare const jestProcessContext: ContextContributorFactory<{}, BaseContext, ProcessContext>;
export {};

View file

@ -0,0 +1,27 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var jestContext_exports = {};
__export(jestContext_exports, {
jestConsoleContext: () => import_chunk_2GHEBYIY.jestConsoleContext,
jestContext: () => import_chunk_2GHEBYIY.jestContext,
jestProcessContext: () => import_chunk_2GHEBYIY.jestProcessContext
});
module.exports = __toCommonJS(jestContext_exports);
var import_chunk_2GHEBYIY = require("../chunk-2GHEBYIY.js");
var import_chunk_2ESYSVXG = require("../chunk-2ESYSVXG.js");

View file

@ -0,0 +1,205 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var jestSnapshotSerializer_exports = {};
__export(jestSnapshotSerializer_exports, {
default: () => jestSnapshotSerializer_default
});
module.exports = __toCommonJS(jestSnapshotSerializer_exports);
var import_chunk_B23KD6U3 = require("../chunk-B23KD6U3.js");
var import_chunk_7MLUNQIZ = require("../chunk-7MLUNQIZ.js");
var import_chunk_2ESYSVXG = require("../chunk-2ESYSVXG.js");
var require_replace_string = (0, import_chunk_2ESYSVXG.__commonJS)({
"../../node_modules/.pnpm/replace-string@3.1.0/node_modules/replace-string/index.js"(exports, module2) {
"use strict";
module2.exports = (string, needle, replacement, options = {}) => {
if (typeof string !== "string") {
throw new TypeError(`Expected input to be a string, got ${typeof string}`);
}
if (!(typeof needle === "string" && needle.length > 0) || !(typeof replacement === "string" || typeof replacement === "function")) {
return string;
}
let result = "";
let matchCount = 0;
let prevIndex = options.fromIndex > 0 ? options.fromIndex : 0;
if (prevIndex > string.length) {
return string;
}
while (true) {
const index = options.caseInsensitive ? string.toLowerCase().indexOf(needle.toLowerCase(), prevIndex) : string.indexOf(needle, prevIndex);
if (index === -1) {
break;
}
matchCount++;
const replaceStr = typeof replacement === "string" ? replacement : replacement(
// If `caseInsensitive`` is enabled, the matched substring may be different from the needle.
string.slice(index, index + needle.length),
matchCount,
string,
index
);
const beginSlice = matchCount === 1 ? 0 : prevIndex;
result += string.slice(beginSlice, index) + replaceStr;
prevIndex = index + needle.length;
}
if (matchCount === 0) {
return string;
}
return result + string.slice(prevIndex);
};
}
});
var require_ansi_regex = (0, import_chunk_2ESYSVXG.__commonJS)({
"../../node_modules/.pnpm/ansi-regex@5.0.1/node_modules/ansi-regex/index.js"(exports, module2) {
"use strict";
module2.exports = ({ onlyFirst = false } = {}) => {
const pattern = [
"[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
"(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"
].join("|");
return new RegExp(pattern, onlyFirst ? void 0 : "g");
};
}
});
var require_strip_ansi = (0, import_chunk_2ESYSVXG.__commonJS)({
"../../node_modules/.pnpm/strip-ansi@6.0.1/node_modules/strip-ansi/index.js"(exports, module2) {
"use strict";
var ansiRegex = require_ansi_regex();
module2.exports = (string) => typeof string === "string" ? string.replace(ansiRegex(), "") : string;
}
});
var require_jestSnapshotSerializer = (0, import_chunk_2ESYSVXG.__commonJS)({
"src/test-utils/jestSnapshotSerializer.js"(exports, module2) {
var path = (0, import_chunk_2ESYSVXG.__require)("path");
var replaceAll = require_replace_string();
var stripAnsi = require_strip_ansi();
var { binaryTargetRegex } = ((0, import_chunk_B23KD6U3.init_binaryTargetRegex)(), (0, import_chunk_2ESYSVXG.__toCommonJS)(import_chunk_B23KD6U3.binaryTargetRegex_exports));
var pipe = (...fns) => (x) => fns.reduce((v, f) => f(v), x);
function normalizePrismaPaths(str) {
return str.replace(/prisma\\([\w-]+)\.prisma/g, "prisma/$1.prisma").replace(/prisma\\seed\.ts/g, "prisma/seed.ts").replace(/custom-folder\\seed\.js/g, "custom-folder/seed.js");
}
function normalizeLogs(str) {
return str.replace(
/Started query engine http server on http:\/\/127\.0\.0\.1:\d{1,5}/g,
"Started query engine http server on http://127.0.0.1:00000"
).replace(/Starting a postgresql pool with \d+ connections./g, "Starting a postgresql pool with XX connections.");
}
function normalizeTmpDir(str) {
return str.replace(/\/tmp\/([a-z0-9]+)\//g, "/tmp/dir/");
}
function trimErrorPaths(str) {
const parentDir = path.dirname(path.dirname(path.dirname(__dirname)));
return replaceAll(str, parentDir, "");
}
function normalizeToUnixPaths(str) {
return replaceAll(str, path.sep, "/");
}
function normalizeGitHubLinks(str) {
return str.replace(/https:\/\/github.com\/prisma\/prisma(-client-js)?\/issues\/new\S+/, "TEST_GITHUB_LINK");
}
function normalizeTsClientStackTrace(str) {
return str.replace(/([/\\]client[/\\]src[/\\]__tests__[/\\].*test\.ts)(:\d*:\d*)/, "$1:0:0").replace(/([/\\]client[/\\]tests[/\\]functional[/\\].*\.ts)(:\d*:\d*)/, "$1:0:0");
}
function removePlatforms(str) {
return str.replace(binaryTargetRegex, "TEST_PLATFORM");
}
function normalizeNodeApiLibFilePath(str) {
return str.replace(
/((lib)?query_engine-TEST_PLATFORM\.)(.*)(\.node)/g,
"libquery_engine-TEST_PLATFORM.LIBRARY_TYPE.node"
);
}
function normalizeBinaryFilePath(str) {
return str.replace(/\.exe(\s+)?(\W.*)/g, "$1$2").replace(/\.exe$/g, "");
}
function normalizeMigrateTimestamps(str) {
return str.replace(/(?<!\d)\d{14}(?!\d)/g, "20201231000000");
}
function normalizeDbUrl(str) {
return str.replace(/(localhost|postgres|mysql|mssql|mongodb_migrate|cockroachdb):(\d+)/g, "localhost:$2");
}
function normalizeRustError(str) {
return str.replace(/\/rustc\/(.+)\//g, "/rustc/hash/").replace(/(\[.*)(:\d*:\d*)(\])/g, "[/some/rust/path:0:0$3");
}
function normalizeRustCodeLocation(str) {
return str.replace(/(\w+\.rs):(\d+):(\d+)/g, "$1:0:0");
}
function normalizeArtificialPanic(str) {
return str.replace(/(Command failed with exit code 101:) (.+) /g, "$1 prisma-engines-path ");
}
function normalizeTime(str) {
return str.replace(/ \d+ms/g, " XXXms").replace(/ \d+(\.\d+)?s/g, " XXXms");
}
function prepareSchemaForSnapshot(str) {
if (!str.includes("tmp/prisma-tests/integration-test")) return str;
const urlRegex = /url\s*=\s*.+/;
const outputRegex = /output\s*=\s*.+/;
return str.split("\n").map((line) => {
const urlMatch = urlRegex.exec(line);
if (urlMatch) {
return `${line.slice(0, urlMatch.index)}url = "***"`;
}
const outputMatch = outputRegex.exec(line);
if (outputMatch) {
return `${line.slice(0, outputMatch.index)}output = "***"`;
}
return line;
}).join("\n");
}
function wrapWithQuotes(str) {
return `"${str}"`;
}
module2.exports = {
// Expected by Jest
test(value) {
return typeof value === "string" || value instanceof Error;
},
serialize(value) {
const message = typeof value === "string" ? value : value instanceof Error ? value.message : "";
return pipe(
stripAnsi,
// integration-tests pkg
prepareSchemaForSnapshot,
// Generic
normalizeTmpDir,
normalizeTime,
// From Client package
normalizeGitHubLinks,
removePlatforms,
normalizeNodeApiLibFilePath,
normalizeBinaryFilePath,
normalizeTsClientStackTrace,
trimErrorPaths,
normalizePrismaPaths,
normalizeLogs,
// remove windows \\
normalizeToUnixPaths,
// From Migrate/CLI package
normalizeDbUrl,
normalizeRustError,
normalizeRustCodeLocation,
normalizeMigrateTimestamps,
// artificial panic
normalizeArtificialPanic,
wrapWithQuotes
)(message);
}
};
}
});
var jestSnapshotSerializer_default = require_jestSnapshotSerializer();

View file

@ -0,0 +1,49 @@
{
"name": "@prisma/get-platform",
"version": "6.1.0",
"description": "This package is intended for Prisma's internal use",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"license": "Apache-2.0",
"author": "Tim Suchanek <suchanek@prisma.io>",
"homepage": "https://www.prisma.io",
"repository": {
"type": "git",
"url": "https://github.com/prisma/prisma.git",
"directory": "packages/get-platform"
},
"bugs": "https://github.com/prisma/prisma/issues",
"devDependencies": {
"@codspeed/benchmark.js-plugin": "3.1.1",
"@swc/core": "1.10.1",
"@swc/jest": "0.2.37",
"@types/jest": "29.5.14",
"@types/node": "18.19.31",
"benchmark": "2.1.4",
"jest": "29.7.0",
"jest-junit": "16.0.0",
"typescript": "5.4.5",
"escape-string-regexp": "4.0.0",
"execa": "5.1.1",
"fs-jetpack": "5.1.0",
"kleur": "4.1.5",
"replace-string": "3.1.0",
"strip-ansi": "6.0.1",
"tempy": "1.0.1",
"terminal-link": "2.1.1",
"ts-pattern": "5.6.0"
},
"dependencies": {
"@prisma/debug": "6.1.0"
},
"files": [
"README.md",
"dist"
],
"sideEffects": false,
"scripts": {
"dev": "DEV=true tsx helpers/build.ts",
"build": "tsx helpers/build.ts",
"test": "jest"
}
}