@prisma/orm-target-postgres 8.0.0-rc.11-dev.52 → 8.0.0-rc.11-dev.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{adapter-Br3wVafV-ctviJ-8-.mjs → adapter-Br3wVafV-BbiJ-yw_.mjs} +3 -3
- package/dist/{adapter-Br3wVafV-ctviJ-8-.mjs.map → adapter-Br3wVafV-BbiJ-yw_.mjs.map} +1 -1
- package/dist/adapter.mjs +4 -4
- package/dist/adapter__adapter.mjs +1 -1
- package/dist/adapter__column-types.mjs +1 -1
- package/dist/adapter__control.mjs +5 -5
- package/dist/adapter__runtime.mjs +5 -5
- package/dist/adapter__sql-renderer.mjs +1 -1
- package/dist/{aggregates-jKrxvOpL.mjs → aggregates-LNpPRP4R.mjs} +2 -2
- package/dist/{aggregates-jKrxvOpL.mjs.map → aggregates-LNpPRP4R.mjs.map} +1 -1
- package/dist/{authoring-CJ-fJQw8-biM4ZMGz.mjs → authoring-DXr_jmbg-8c3oyV1a.mjs} +6 -5
- package/dist/authoring-DXr_jmbg-8c3oyV1a.mjs.map +1 -0
- package/dist/codec-ids-BQRXOwQR.d.mts +1 -0
- package/dist/{codec-ids-BYhNGq22-B6yIezG2.mjs → codec-ids-Cb0yO-IS--e0P2rfI.mjs} +4 -3
- package/dist/codec-ids-Cb0yO-IS--e0P2rfI.mjs.map +1 -0
- package/dist/{codec-ids-CiBCuaJN-BMYRDoSy.d.mts → codec-ids-jWpRZjZo-BKIzyx-J.d.mts} +4 -3
- package/dist/{codec-ids-CiBCuaJN-BMYRDoSy.d.mts.map → codec-ids-jWpRZjZo-BKIzyx-J.d.mts.map} +1 -1
- package/dist/codec-type-map-Pf9Paa9V-D9bPPtAc.d.mts +52 -0
- package/dist/codec-type-map-Pf9Paa9V-D9bPPtAc.d.mts.map +1 -0
- package/dist/codec-types-BkqInYj6-BeU7t9zj.d.mts +51 -0
- package/dist/codec-types-BkqInYj6-BeU7t9zj.d.mts.map +1 -0
- package/dist/codec-types-BpaVS3xR.d.mts +2 -0
- package/dist/{codecs-C7OoUG-w-BvO1qMT0.mjs → codecs-C3sqz9RX-kXJEGjHW.mjs} +44 -5
- package/dist/codecs-C3sqz9RX-kXJEGjHW.mjs.map +1 -0
- package/dist/{codecs-CAHnXMUO.d.mts → codecs-CzCI39hP.d.mts} +2 -2
- package/dist/codecs-CzCI39hP.d.mts.map +1 -0
- package/dist/{codecs-BIXQf74u-EYQbSdG3.d.mts → codecs-w9SEV2Sk-Dz_lUUGY.d.mts} +35 -4
- package/dist/{codecs-BIXQf74u-EYQbSdG3.d.mts.map → codecs-w9SEV2Sk-Dz_lUUGY.d.mts.map} +1 -1
- package/dist/{column-types-B67GtMxQ.mjs → column-types-CB_qVLNC.mjs} +2 -2
- package/dist/{column-types-B67GtMxQ.mjs.map → column-types-CB_qVLNC.mjs.map} +1 -1
- package/dist/{contract-free-CmBUYWYN.mjs → contract-free--ds6HUdk.mjs} +4 -4
- package/dist/{contract-free-CmBUYWYN.mjs.map → contract-free--ds6HUdk.mjs.map} +1 -1
- package/dist/{control-K-aLu-ea.mjs → control-Bwf4bY_N.mjs} +7 -7
- package/dist/{control-K-aLu-ea.mjs.map → control-Bwf4bY_N.mjs.map} +1 -1
- package/dist/{control-adapter-C2Xw0sJP-BDC8a1uQ.mjs → control-adapter-C2Xw0sJP-DV_vzll4.mjs} +6 -6
- package/dist/{control-adapter-C2Xw0sJP-BDC8a1uQ.mjs.map → control-adapter-C2Xw0sJP-DV_vzll4.mjs.map} +1 -1
- package/dist/{control-policy-BnSDkwiY-BXJR7SYi.mjs → control-policy-CdCIROxR-BpU34F3y.mjs} +6 -6
- package/dist/{control-policy-BnSDkwiY-BXJR7SYi.mjs.map → control-policy-CdCIROxR-BpU34F3y.mjs.map} +1 -1
- package/dist/{data-type-entries-CWBaprqO-BpEnoawD.mjs → data-type-entries-Fxm2HDZk-D4AAd63w.mjs} +3 -3
- package/dist/{data-type-entries-CWBaprqO-BpEnoawD.mjs.map → data-type-entries-Fxm2HDZk-D4AAd63w.mjs.map} +1 -1
- package/dist/{data-types-CflDs2nq-BaeDf3B9.mjs → data-types-BOMKl3ue-BZ8EARvV.mjs} +5 -3
- package/dist/data-types-BOMKl3ue-BZ8EARvV.mjs.map +1 -0
- package/dist/{data-types-DcvGOsFZ.d.mts → data-types-DgHu2vHj.d.mts} +3 -2
- package/dist/data-types-DgHu2vHj.d.mts.map +1 -0
- package/dist/{ddl-DxYRJ8hY-mFzFol6l.mjs → ddl-BSSJloez-hJfFqHj7.mjs} +4 -4
- package/dist/{ddl-DxYRJ8hY-mFzFol6l.mjs.map → ddl-BSSJloez-hJfFqHj7.mjs.map} +1 -1
- package/dist/{descriptor-meta-Cl9Kh9e8-B4YvnuYb.mjs → descriptor-meta-BOFaShn_-DUEQjIIg.mjs} +5 -5
- package/dist/{descriptor-meta-Cl9Kh9e8-B4YvnuYb.mjs.map → descriptor-meta-BOFaShn_-DUEQjIIg.mjs.map} +1 -1
- package/dist/{descriptor-meta-ClQ1wGLk-D7moct5f.mjs → descriptor-meta-ClQ1wGLk-BHv8w1ZW.mjs} +6 -6
- package/dist/{descriptor-meta-ClQ1wGLk-D7moct5f.mjs.map → descriptor-meta-ClQ1wGLk-BHv8w1ZW.mjs.map} +1 -1
- package/dist/{diff-database-schema-CgCqtOjU-Car8e7z5.mjs → diff-database-schema-D-S0r5iu-ClSXJLW1.mjs} +5 -5
- package/dist/{diff-database-schema-CgCqtOjU-Car8e7z5.mjs.map → diff-database-schema-D-S0r5iu-ClSXJLW1.mjs.map} +1 -1
- package/dist/full-text-RAVq4j8W.mjs +39 -0
- package/dist/full-text-RAVq4j8W.mjs.map +1 -0
- package/dist/{text-search-languages-Bi8KwBsX-lEgZQZrL.mjs → full-text-index-expression-q86L_360-CwJBEVDq.mjs} +4 -44
- package/dist/full-text-index-expression-q86L_360-CwJBEVDq.mjs.map +1 -0
- package/dist/full-text-keFkNeC5.d.mts +25 -0
- package/dist/full-text-keFkNeC5.d.mts.map +1 -0
- package/dist/full-text-parsers-96VfzkHS-C8YGYKhj.mjs +104 -0
- package/dist/full-text-parsers-96VfzkHS-C8YGYKhj.mjs.map +1 -0
- package/dist/full-text-parsers-iYkcnm7r-Bu9LR0Gz.d.mts +34 -0
- package/dist/full-text-parsers-iYkcnm7r-Bu9LR0Gz.d.mts.map +1 -0
- package/dist/{infer-psl-contract-dXB4CRTA-DGPgReR9.mjs → infer-psl-contract-CfoEqxkp-Cqf2Ra8i.mjs} +6 -6
- package/dist/{infer-psl-contract-dXB4CRTA-DGPgReR9.mjs.map → infer-psl-contract-CfoEqxkp-Cqf2Ra8i.mjs.map} +1 -1
- package/dist/migration-PTHAY9Cv.mjs.map +1 -1
- package/dist/{op-factory-call-CNSyujs6-D8M7NkKv.mjs → op-factory-call-DnLS5z3b-CKuJvi8g.mjs} +5 -5
- package/dist/{op-factory-call-CNSyujs6-D8M7NkKv.mjs.map → op-factory-call-DnLS5z3b-CKuJvi8g.mjs.map} +1 -1
- package/dist/{operation-types-BNp5Daje.d.mts → operation-types-ZuWld42E.d.mts} +26 -8
- package/dist/operation-types-ZuWld42E.d.mts.map +1 -0
- package/dist/{pack-CHgkp1ir.d.mts → pack-CHX72nBt.d.mts} +3 -3
- package/dist/{pack-CHgkp1ir.d.mts.map → pack-CHX72nBt.d.mts.map} +1 -1
- package/dist/{planner-g1_L952D-GR_ijJDw.mjs → planner-EaazKhoM-BXjZ5-qs.mjs} +8 -8
- package/dist/{planner-g1_L952D-GR_ijJDw.mjs.map → planner-EaazKhoM-BXjZ5-qs.mjs.map} +1 -1
- package/dist/{planner-ddl-builders-Bl8O1tkU-DjGfDUnx.mjs → planner-ddl-builders-C7-rKOTm-DpFTfAGm.mjs} +3 -3
- package/dist/{planner-ddl-builders-Bl8O1tkU-DjGfDUnx.mjs.map → planner-ddl-builders-C7-rKOTm-DpFTfAGm.mjs.map} +1 -1
- package/dist/{planner-produced-postgres-migration-D9qMCo_6-DZE1bx0Q.mjs → planner-produced-postgres-migration-BQTO2W3D-sUjfUxLa.mjs} +3 -3
- package/dist/{planner-produced-postgres-migration-D9qMCo_6-DZE1bx0Q.mjs.map → planner-produced-postgres-migration-BQTO2W3D-sUjfUxLa.mjs.map} +1 -1
- package/dist/{planner-sql-checks-BZqyX9R1-D47zR6P-.mjs → planner-sql-checks-C8vZmDRu-BimrKoG7.mjs} +3 -3
- package/dist/{planner-sql-checks-BZqyX9R1-D47zR6P-.mjs.map → planner-sql-checks-C8vZmDRu-BimrKoG7.mjs.map} +1 -1
- package/dist/{postgres-contract-view-CLAVto6M-mMf300wS.mjs → postgres-contract-view-DhA_ugef-PgiuzyaD.mjs} +5 -5
- package/dist/{postgres-contract-view-CLAVto6M-mMf300wS.mjs.map → postgres-contract-view-DhA_ugef-PgiuzyaD.mjs.map} +1 -1
- package/dist/{postgres-migration-B9kxdt1I-DP0Sml3U.mjs → postgres-migration-DiTRA0gq-8WfHPuVX.mjs} +5 -5
- package/dist/{postgres-migration-B9kxdt1I-DP0Sml3U.mjs.map → postgres-migration-DiTRA0gq-8WfHPuVX.mjs.map} +1 -1
- package/dist/{postgres-schema-VPEJqIX9-BBIMq9xs.mjs → postgres-schema-BfUzo1Yn-BLZvsxs9.mjs} +3 -3
- package/dist/{postgres-schema-VPEJqIX9-BBIMq9xs.mjs.map → postgres-schema-BfUzo1Yn-BLZvsxs9.mjs.map} +1 -1
- package/dist/{prisma7-binding-DwzP7EKf.d.mts → prisma7-binding-BDIi6ZM8.d.mts} +3 -3
- package/dist/{prisma7-binding-DwzP7EKf.d.mts.map → prisma7-binding-BDIi6ZM8.d.mts.map} +1 -1
- package/dist/{prisma7-binding-BPnDBONm.mjs → prisma7-binding-BycULCJ9.mjs} +5 -5
- package/dist/{prisma7-binding-BPnDBONm.mjs.map → prisma7-binding-BycULCJ9.mjs.map} +1 -1
- package/dist/{registry-zad9XdwA-D-QiVeM2.mjs → registry-BIxkN3ud-Bp_Ux-c4.mjs} +3 -3
- package/dist/{registry-zad9XdwA-D-QiVeM2.mjs.map → registry-BIxkN3ud-Bp_Ux-c4.mjs.map} +1 -1
- package/dist/{resolve-ddl-schema-DFOTYsNN-AVDEd24I.mjs → resolve-ddl-schema-CIvDW3tr-CKGZYLPh.mjs} +3 -3
- package/dist/{resolve-ddl-schema-DFOTYsNN-AVDEd24I.mjs.map → resolve-ddl-schema-CIvDW3tr-CKGZYLPh.mjs.map} +1 -1
- package/dist/{sql-renderer-BnTqIzZw-CaTxVqe_.mjs → sql-renderer-BnTqIzZw-0jnGfO-y.mjs} +2 -2
- package/dist/{sql-renderer-BnTqIzZw-CaTxVqe_.mjs.map → sql-renderer-BnTqIzZw-0jnGfO-y.mjs.map} +1 -1
- package/dist/target.d.mts +13 -11
- package/dist/target.mjs +27 -24
- package/dist/target__aggregates.mjs +1 -1
- package/dist/target__codec-ids.d.mts +3 -3
- package/dist/target__codec-ids.mjs +2 -2
- package/dist/target__codec-types.d.mts +3 -3
- package/dist/target__codecs.d.mts +2 -2
- package/dist/target__codecs.mjs +2 -2
- package/dist/target__contract-free.mjs +3 -3
- package/dist/target__control.mjs +2 -2
- package/dist/target__data-types.d.mts +2 -2
- package/dist/target__data-types.mjs +3 -3
- package/dist/target__diff-database-schema.mjs +1 -1
- package/dist/target__full-text.d.mts +3 -0
- package/dist/target__full-text.mjs +3 -0
- package/dist/target__issue-planner.mjs +1 -1
- package/dist/target__migration.mjs +2 -2
- package/dist/target__op-factory-call.mjs +1 -1
- package/dist/target__operation-types.d.mts +2 -2
- package/dist/target__pack.d.mts +1 -1
- package/dist/target__pack.mjs +1 -1
- package/dist/target__planner-ddl-builders.mjs +1 -1
- package/dist/target__planner-produced-postgres-migration.mjs +1 -1
- package/dist/target__planner-sql-checks.mjs +1 -1
- package/dist/target__planner.mjs +2 -2
- package/dist/target__prisma7-binding.d.mts +1 -1
- package/dist/target__prisma7-binding.mjs +1 -1
- package/dist/target__runtime.mjs +16 -80
- package/dist/target__runtime.mjs.map +1 -1
- package/dist/target__schema-ir-annotations.mjs +1 -1
- package/dist/target__sql-utils.mjs +2 -1
- package/dist/target__types.mjs +1 -1
- package/dist/text-search-languages-RO0HiUDm-CeJ7P8gS.mjs +45 -0
- package/dist/text-search-languages-RO0HiUDm-CeJ7P8gS.mjs.map +1 -0
- package/package.json +10 -9
- package/dist/authoring-CJ-fJQw8-biM4ZMGz.mjs.map +0 -1
- package/dist/codec-ids-BYhNGq22-B6yIezG2.mjs.map +0 -1
- package/dist/codec-ids-CglZIuVF.d.mts +0 -1
- package/dist/codec-types-Bx6YI-KI-sSDAuYPQ.d.mts +0 -97
- package/dist/codec-types-Bx6YI-KI-sSDAuYPQ.d.mts.map +0 -1
- package/dist/codec-types-GORaWCVQ.d.mts +0 -2
- package/dist/codecs-C7OoUG-w-BvO1qMT0.mjs.map +0 -1
- package/dist/codecs-CAHnXMUO.d.mts.map +0 -1
- package/dist/data-types-CflDs2nq-BaeDf3B9.mjs.map +0 -1
- package/dist/data-types-DcvGOsFZ.d.mts.map +0 -1
- package/dist/operation-types-BNp5Daje.d.mts.map +0 -1
- package/dist/text-search-languages-Bi8KwBsX-lEgZQZrL.mjs.map +0 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { n as TsqueryExpression, r as TsqueryParserOptions } from "./full-text-parsers-iYkcnm7r-Bu9LR0Gz.mjs";
|
|
2
|
+
//#region ../../../3-targets/3-targets/postgres/dist/full-text.d.mts
|
|
3
|
+
//#region src/core/tsquery-tag.d.ts
|
|
4
|
+
type TsqueryTag = (strings: TemplateStringsArray, ...values: string[]) => TsqueryExpression;
|
|
5
|
+
/**
|
|
6
|
+
* Builds a `tsquery` from `to_tsquery` syntax the application writes, with values such as user input
|
|
7
|
+
* interpolated safely: `` tsquery`${term}:*` `` for a typeahead prefix match.
|
|
8
|
+
*
|
|
9
|
+
* The literal parts are trusted `tsquery` syntax and are used as written. Each interpolated value
|
|
10
|
+
* becomes exactly one quoted term, so it cannot add operators or break the syntax, whatever it
|
|
11
|
+
* contains; an empty value adds no words, like a stop word. The whole text is one bound parameter,
|
|
12
|
+
* parsed by Postgres `to_tsquery`, which lowercases and stems every word.
|
|
13
|
+
*
|
|
14
|
+
* A value with several words becomes a phrase: `` tsquery`${'new y'}:*` `` gives
|
|
15
|
+
* `'new':* <-> 'y':*`, so the words must be adjacent and in order, and `:*` applies to each word.
|
|
16
|
+
* Do not put quotes around the interpolation yourself: `` tsquery`'${term}':*` `` is a syntax error
|
|
17
|
+
* for every input.
|
|
18
|
+
*
|
|
19
|
+
* `` tsquery`...` `` uses `english`; `` tsquery({ language })`...` `` picks the configuration.
|
|
20
|
+
*/
|
|
21
|
+
declare function tsquery(options: TsqueryParserOptions): TsqueryTag;
|
|
22
|
+
declare function tsquery(strings: TemplateStringsArray, ...values: string[]): TsqueryExpression;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { tsquery as n, TsqueryTag as t };
|
|
25
|
+
//# sourceMappingURL=full-text-keFkNeC5.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"full-text-keFkNeC5.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/full-text.d.mts"],"mappings":";;;KAEK,cAAc,SAAS,yBAAyB,qBAAqB;;;;;;;;;;;;;;;;;iBAiBzD,QAAQ,SAAS,uBAAuB;iBACxC,QAAQ,SAAS,yBAAyB,mBAAmB"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { S as PG_TEXT_CODEC_ID, j as PG_TSQUERY_CODEC_ID } from "./codec-ids-Cb0yO-IS--e0P2rfI.mjs";
|
|
2
|
+
import { s as postgresError } from "./errors-DYyzTYzE-39CV_aMo.mjs";
|
|
3
|
+
import { n as POSTGRES_TEXT_SEARCH_LANGUAGES, r as isFullTextSearchLanguage } from "./text-search-languages-RO0HiUDm-CeJ7P8gS.mjs";
|
|
4
|
+
import { LiteralExpr } from "@prisma/orm-family-sql/relational-core/ast";
|
|
5
|
+
import { buildOperation, toExpr } from "@prisma/orm-family-sql/relational-core/expression";
|
|
6
|
+
//#region ../../../3-targets/3-targets/postgres/dist/full-text-parsers-96VfzkHS.mjs
|
|
7
|
+
/**
|
|
8
|
+
* Options for the Postgres full-text operations, and the checks each one goes through.
|
|
9
|
+
*
|
|
10
|
+
* Every option here reaches the SQL as an inline literal rather than a bound parameter, because
|
|
11
|
+
* Postgres accepts no parameter in these positions. Each is therefore validated before a statement
|
|
12
|
+
* exists; anything unrecognized throws `RUNTIME.ARGUMENT_INVALID`.
|
|
13
|
+
*
|
|
14
|
+
* The headline markers are the only free text among them, and `checkMarker` restricts their
|
|
15
|
+
* characters precisely so that the literal path never carries a quote or a backslash for
|
|
16
|
+
* `escapeLiteral` to have to reason about.
|
|
17
|
+
*/
|
|
18
|
+
function invalid(method, argument, received, why, fix) {
|
|
19
|
+
return postgresError("RUNTIME.ARGUMENT_INVALID", `${method}: ${why}`, {
|
|
20
|
+
why: "The option is written into the SQL as an inline literal, not a bound parameter, so it is checked before the statement is built.",
|
|
21
|
+
fix,
|
|
22
|
+
meta: {
|
|
23
|
+
helper: method,
|
|
24
|
+
argument,
|
|
25
|
+
received
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function languageLiteral(method, language) {
|
|
30
|
+
if (!isFullTextSearchLanguage(language)) throw invalid(method, "language", language, `'${language}' is not a PostgreSQL text-search configuration Prisma recognizes.`, `Pass one of: ${POSTGRES_TEXT_SEARCH_LANGUAGES.join(", ")}.`);
|
|
31
|
+
return LiteralExpr.of(language);
|
|
32
|
+
}
|
|
33
|
+
function normalizationLiteral(method, normalization) {
|
|
34
|
+
if (!Number.isInteger(normalization) || normalization < 0 || normalization > 63) throw invalid(method, "normalization", normalization, `normalization must be an integer between 0 and 63, received ${normalization}.`, "Combine the flags documented for ts_rank, e.g. 32 to divide the rank by itself plus one.");
|
|
35
|
+
return LiteralExpr.of(normalization);
|
|
36
|
+
}
|
|
37
|
+
function checkWordCount(method, argument, value) {
|
|
38
|
+
if (!Number.isInteger(value) || value < 1) throw invalid(method, argument, value, `${argument} must be a positive integer, received ${value}.`, "Pass a whole number of words, one or more.");
|
|
39
|
+
}
|
|
40
|
+
/** Non-empty, and none of `"` `,` `=` `\` or whitespace. */
|
|
41
|
+
const MARKER = /^[^"=,\\\s]+$/;
|
|
42
|
+
function checkMarker(method, argument, value) {
|
|
43
|
+
if (!MARKER.test(value)) throw invalid(method, argument, value, `${argument} must be non-empty and free of " , = \\ and whitespace, received ${JSON.stringify(value)}.`, "ts_headline parses its options as a quoted, comma-separated list of Key=Value pairs, and the whole list reaches SQL as one literal, so a marker carrying those characters cannot survive either step. Use markup such as <mark> or <b>.");
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The fourth `ts_headline` argument: one text literal of `Key=Value` pairs. Returns `undefined` when
|
|
47
|
+
* nothing but the language was given, so the common call keeps rendering the three-argument form.
|
|
48
|
+
*/
|
|
49
|
+
function headlineOptionsLiteral(method, options) {
|
|
50
|
+
const pairs = [];
|
|
51
|
+
if (options.startSel !== void 0) {
|
|
52
|
+
checkMarker(method, "startSel", options.startSel);
|
|
53
|
+
pairs.push(`StartSel=${options.startSel}`);
|
|
54
|
+
}
|
|
55
|
+
if (options.stopSel !== void 0) {
|
|
56
|
+
checkMarker(method, "stopSel", options.stopSel);
|
|
57
|
+
pairs.push(`StopSel=${options.stopSel}`);
|
|
58
|
+
}
|
|
59
|
+
if (options.maxWords !== void 0) {
|
|
60
|
+
checkWordCount(method, "maxWords", options.maxWords);
|
|
61
|
+
pairs.push(`MaxWords=${options.maxWords}`);
|
|
62
|
+
}
|
|
63
|
+
if (options.minWords !== void 0) {
|
|
64
|
+
checkWordCount(method, "minWords", options.minWords);
|
|
65
|
+
if (options.maxWords !== void 0 && options.minWords >= options.maxWords) throw invalid(method, "minWords", options.minWords, `minWords (${options.minWords}) must be below maxWords (${options.maxWords}).`, "Postgres requires MinWords strictly below MaxWords. Lower minWords, or raise maxWords.");
|
|
66
|
+
pairs.push(`MinWords=${options.minWords}`);
|
|
67
|
+
}
|
|
68
|
+
if (options.highlightAll !== void 0) {
|
|
69
|
+
if (typeof options.highlightAll !== "boolean") throw invalid(method, "highlightAll", options.highlightAll, `highlightAll must be a boolean, received ${JSON.stringify(options.highlightAll)}.`, "Pass true to mark up the whole document, or false to extract fragments.");
|
|
70
|
+
pairs.push(`HighlightAll=${options.highlightAll}`);
|
|
71
|
+
}
|
|
72
|
+
return pairs.length === 0 ? void 0 : LiteralExpr.of(pairs.join(", "));
|
|
73
|
+
}
|
|
74
|
+
const TEXT_REF = { codecId: PG_TEXT_CODEC_ID };
|
|
75
|
+
function parser(method, fn) {
|
|
76
|
+
return (text, options = {}) => buildOperation({
|
|
77
|
+
method,
|
|
78
|
+
args: [toExpr(text, TEXT_REF), languageLiteral(method, options.language ?? "english")],
|
|
79
|
+
returns: {
|
|
80
|
+
codecId: PG_TSQUERY_CODEC_ID,
|
|
81
|
+
nullable: false
|
|
82
|
+
},
|
|
83
|
+
lowering: {
|
|
84
|
+
targetFamily: "sql",
|
|
85
|
+
template: `${fn}({{arg0}}, {{self}})`
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
/** Postgres `websearch_to_tsquery`: search-box syntax with quotes, `or` and `-`. Never errors. */
|
|
90
|
+
const websearchToTsquery = parser("websearchToTsquery", "websearch_to_tsquery");
|
|
91
|
+
/**
|
|
92
|
+
* Postgres `to_tsquery`: operator syntax (`'zebra' & !'graze'`, `zeb:*`), each word normalized.
|
|
93
|
+
* Malformed input fails at execution, so pass only text the application wrote, never user input;
|
|
94
|
+
* `tsquery` interpolates user input safely.
|
|
95
|
+
*/
|
|
96
|
+
const toTsquery = parser("toTsquery", "to_tsquery");
|
|
97
|
+
/** Postgres `plainto_tsquery`: every word must match. */
|
|
98
|
+
const plaintoTsquery = parser("plaintoTsquery", "plainto_tsquery");
|
|
99
|
+
/** Postgres `phraseto_tsquery`: the words must match in order. */
|
|
100
|
+
const phrasetoTsquery = parser("phrasetoTsquery", "phraseto_tsquery");
|
|
101
|
+
//#endregion
|
|
102
|
+
export { plaintoTsquery as a, phrasetoTsquery as i, languageLiteral as n, toTsquery as o, normalizationLiteral as r, websearchToTsquery as s, headlineOptionsLiteral as t };
|
|
103
|
+
|
|
104
|
+
//# sourceMappingURL=full-text-parsers-96VfzkHS-C8YGYKhj.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"full-text-parsers-96VfzkHS-C8YGYKhj.mjs","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/full-text-parsers-96VfzkHS.mjs"],"sourcesContent":["import { S as PG_TEXT_CODEC_ID, j as PG_TSQUERY_CODEC_ID } from \"./codec-ids-Cb0yO-IS.mjs\";\nimport { s as postgresError } from \"./errors-DYyzTYzE.mjs\";\nimport { n as POSTGRES_TEXT_SEARCH_LANGUAGES, r as isFullTextSearchLanguage } from \"./text-search-languages-RO0HiUDm.mjs\";\nimport { LiteralExpr } from \"@internal/sql-relational-core/ast\";\nimport { buildOperation, toExpr } from \"@internal/sql-relational-core/expression\";\n//#region src/core/full-text-options.ts\n/**\n* Options for the Postgres full-text operations, and the checks each one goes through.\n*\n* Every option here reaches the SQL as an inline literal rather than a bound parameter, because\n* Postgres accepts no parameter in these positions. Each is therefore validated before a statement\n* exists; anything unrecognized throws `RUNTIME.ARGUMENT_INVALID`.\n*\n* The headline markers are the only free text among them, and `checkMarker` restricts their\n* characters precisely so that the literal path never carries a quote or a backslash for\n* `escapeLiteral` to have to reason about.\n*/\nfunction invalid(method, argument, received, why, fix) {\n\treturn postgresError(\"RUNTIME.ARGUMENT_INVALID\", `${method}: ${why}`, {\n\t\twhy: \"The option is written into the SQL as an inline literal, not a bound parameter, so it is checked before the statement is built.\",\n\t\tfix,\n\t\tmeta: {\n\t\t\thelper: method,\n\t\t\targument,\n\t\t\treceived\n\t\t}\n\t});\n}\nfunction languageLiteral(method, language) {\n\tif (!isFullTextSearchLanguage(language)) throw invalid(method, \"language\", language, `'${language}' is not a PostgreSQL text-search configuration Prisma recognizes.`, `Pass one of: ${POSTGRES_TEXT_SEARCH_LANGUAGES.join(\", \")}.`);\n\treturn LiteralExpr.of(language);\n}\nfunction normalizationLiteral(method, normalization) {\n\tif (!Number.isInteger(normalization) || normalization < 0 || normalization > 63) throw invalid(method, \"normalization\", normalization, `normalization must be an integer between 0 and 63, received ${normalization}.`, \"Combine the flags documented for ts_rank, e.g. 32 to divide the rank by itself plus one.\");\n\treturn LiteralExpr.of(normalization);\n}\nfunction checkWordCount(method, argument, value) {\n\tif (!Number.isInteger(value) || value < 1) throw invalid(method, argument, value, `${argument} must be a positive integer, received ${value}.`, \"Pass a whole number of words, one or more.\");\n}\n/** Non-empty, and none of `\"` `,` `=` `\\` or whitespace. */\nconst MARKER = /^[^\"=,\\\\\\s]+$/;\nfunction checkMarker(method, argument, value) {\n\tif (!MARKER.test(value)) throw invalid(method, argument, value, `${argument} must be non-empty and free of \" , = \\\\ and whitespace, received ${JSON.stringify(value)}.`, \"ts_headline parses its options as a quoted, comma-separated list of Key=Value pairs, and the whole list reaches SQL as one literal, so a marker carrying those characters cannot survive either step. Use markup such as <mark> or <b>.\");\n}\n/**\n* The fourth `ts_headline` argument: one text literal of `Key=Value` pairs. Returns `undefined` when\n* nothing but the language was given, so the common call keeps rendering the three-argument form.\n*/\nfunction headlineOptionsLiteral(method, options) {\n\tconst pairs = [];\n\tif (options.startSel !== void 0) {\n\t\tcheckMarker(method, \"startSel\", options.startSel);\n\t\tpairs.push(`StartSel=${options.startSel}`);\n\t}\n\tif (options.stopSel !== void 0) {\n\t\tcheckMarker(method, \"stopSel\", options.stopSel);\n\t\tpairs.push(`StopSel=${options.stopSel}`);\n\t}\n\tif (options.maxWords !== void 0) {\n\t\tcheckWordCount(method, \"maxWords\", options.maxWords);\n\t\tpairs.push(`MaxWords=${options.maxWords}`);\n\t}\n\tif (options.minWords !== void 0) {\n\t\tcheckWordCount(method, \"minWords\", options.minWords);\n\t\tif (options.maxWords !== void 0 && options.minWords >= options.maxWords) throw invalid(method, \"minWords\", options.minWords, `minWords (${options.minWords}) must be below maxWords (${options.maxWords}).`, \"Postgres requires MinWords strictly below MaxWords. Lower minWords, or raise maxWords.\");\n\t\tpairs.push(`MinWords=${options.minWords}`);\n\t}\n\tif (options.highlightAll !== void 0) {\n\t\tif (typeof options.highlightAll !== \"boolean\") throw invalid(method, \"highlightAll\", options.highlightAll, `highlightAll must be a boolean, received ${JSON.stringify(options.highlightAll)}.`, \"Pass true to mark up the whole document, or false to extract fragments.\");\n\t\tpairs.push(`HighlightAll=${options.highlightAll}`);\n\t}\n\treturn pairs.length === 0 ? void 0 : LiteralExpr.of(pairs.join(\", \"));\n}\n//#endregion\n//#region src/core/full-text-parsers.ts\nconst TEXT_REF = { codecId: PG_TEXT_CODEC_ID };\nfunction parser(method, fn) {\n\treturn (text, options = {}) => buildOperation({\n\t\tmethod,\n\t\targs: [toExpr(text, TEXT_REF), languageLiteral(method, options.language ?? \"english\")],\n\t\treturns: {\n\t\t\tcodecId: PG_TSQUERY_CODEC_ID,\n\t\t\tnullable: false\n\t\t},\n\t\tlowering: {\n\t\t\ttargetFamily: \"sql\",\n\t\t\ttemplate: `${fn}({{arg0}}, {{self}})`\n\t\t}\n\t});\n}\n/** Postgres `websearch_to_tsquery`: search-box syntax with quotes, `or` and `-`. Never errors. */\nconst websearchToTsquery = parser(\"websearchToTsquery\", \"websearch_to_tsquery\");\n/**\n* Postgres `to_tsquery`: operator syntax (`'zebra' & !'graze'`, `zeb:*`), each word normalized.\n* Malformed input fails at execution, so pass only text the application wrote, never user input;\n* `tsquery` interpolates user input safely.\n*/\nconst toTsquery = parser(\"toTsquery\", \"to_tsquery\");\n/** Postgres `plainto_tsquery`: every word must match. */\nconst plaintoTsquery = parser(\"plaintoTsquery\", \"plainto_tsquery\");\n/** Postgres `phraseto_tsquery`: the words must match in order. */\nconst phrasetoTsquery = parser(\"phrasetoTsquery\", \"phraseto_tsquery\");\n//#endregion\nexport { headlineOptionsLiteral as a, websearchToTsquery as i, plaintoTsquery as n, languageLiteral as o, toTsquery as r, normalizationLiteral as s, phrasetoTsquery as t };\n\n//# sourceMappingURL=full-text-parsers-96VfzkHS.mjs.map"],"mappings":"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"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { n as FullTextSearchLanguage } from "./text-search-languages-BzhBMCtK-D26JB2w3.mjs";
|
|
2
|
+
import { j as PG_TSQUERY_CODEC_ID } from "./codec-ids-jWpRZjZo-BKIzyx-J.mjs";
|
|
3
|
+
import { t as ExtractedCodecTypes } from "./codec-type-map-Pf9Paa9V-D9bPPtAc.mjs";
|
|
4
|
+
import { Expression, TraitExpression } from "@prisma/orm-family-sql/relational-core/expression";
|
|
5
|
+
//#region ../../../3-targets/3-targets/postgres/dist/full-text-parsers-iYkcnm7r.d.mts
|
|
6
|
+
//#region src/core/full-text-parsers.d.ts
|
|
7
|
+
interface TsqueryParserOptions {
|
|
8
|
+
/** Text-search configuration the parser normalizes the words with. Defaults to `english`. */
|
|
9
|
+
readonly language?: FullTextSearchLanguage;
|
|
10
|
+
}
|
|
11
|
+
type TsqueryExpression = Expression<{
|
|
12
|
+
codecId: typeof PG_TSQUERY_CODEC_ID;
|
|
13
|
+
nullable: false;
|
|
14
|
+
}>;
|
|
15
|
+
/**
|
|
16
|
+
* What a parser parses: a string, bound as `text`, or a non-null expression whose codec is one of
|
|
17
|
+
* this target's `textual` codecs, such as a `text` or `varchar` column.
|
|
18
|
+
*/
|
|
19
|
+
type TextArgument = TraitExpression<readonly ['textual'], false, ExtractedCodecTypes>;
|
|
20
|
+
/** Postgres `websearch_to_tsquery`: search-box syntax with quotes, `or` and `-`. Never errors. */
|
|
21
|
+
declare const websearchToTsquery: (text: TextArgument, options?: TsqueryParserOptions) => TsqueryExpression;
|
|
22
|
+
/**
|
|
23
|
+
* Postgres `to_tsquery`: operator syntax (`'zebra' & !'graze'`, `zeb:*`), each word normalized.
|
|
24
|
+
* Malformed input fails at execution, so pass only text the application wrote, never user input;
|
|
25
|
+
* `tsquery` interpolates user input safely.
|
|
26
|
+
*/
|
|
27
|
+
declare const toTsquery: (text: TextArgument, options?: TsqueryParserOptions) => TsqueryExpression;
|
|
28
|
+
/** Postgres `plainto_tsquery`: every word must match. */
|
|
29
|
+
declare const plaintoTsquery: (text: TextArgument, options?: TsqueryParserOptions) => TsqueryExpression;
|
|
30
|
+
/** Postgres `phraseto_tsquery`: the words must match in order. */
|
|
31
|
+
declare const phrasetoTsquery: (text: TextArgument, options?: TsqueryParserOptions) => TsqueryExpression;
|
|
32
|
+
//#endregion
|
|
33
|
+
export { plaintoTsquery as a, phrasetoTsquery as i, TsqueryExpression as n, toTsquery as o, TsqueryParserOptions as r, websearchToTsquery as s, TextArgument as t };
|
|
34
|
+
//# sourceMappingURL=full-text-parsers-iYkcnm7r-Bu9LR0Gz.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"full-text-parsers-iYkcnm7r-Bu9LR0Gz.d.mts","names":[],"sources":["../../../../3-targets/3-targets/postgres/dist/full-text-parsers-iYkcnm7r.d.mts"],"mappings":";;;;;;UAKU;;WAEC,WAAW;;KAEjB,oBAAoB;EACvB,gBAAgB;EAChB;;;;;;KAMG,eAAe,6CAA6C;;cAEnD,qBAAqB,MAAM,cAAc,UAAU,yBAAyB;;;;;;cAM5E,YAAY,MAAM,cAAc,UAAU,yBAAyB;;cAEnE,iBAAiB,MAAM,cAAc,UAAU,yBAAyB;;cAExE,kBAAkB,MAAM,cAAc,UAAU,yBAAyB"}
|
package/dist/{infer-psl-contract-dXB4CRTA-DGPgReR9.mjs → infer-psl-contract-CfoEqxkp-Cqf2Ra8i.mjs}
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { S as PG_TEXT_CODEC_ID } from "./codec-ids-
|
|
2
|
-
import {
|
|
1
|
+
import { S as PG_TEXT_CODEC_ID } from "./codec-ids-Cb0yO-IS--e0P2rfI.mjs";
|
|
2
|
+
import { D as postgresDataTypes } from "./data-types-BOMKl3ue-BZ8EARvV.mjs";
|
|
3
3
|
import { s as postgresError } from "./errors-DYyzTYzE-39CV_aMo.mjs";
|
|
4
|
-
import { t as postgresCodecDescriptorRegistry } from "./registry-
|
|
4
|
+
import { t as postgresCodecDescriptorRegistry } from "./registry-BIxkN3ud-Bp_Ux-c4.mjs";
|
|
5
5
|
import { t as parsePostgresDefault } from "./default-normalizer-Coo-llj4-6YPzp_F9.mjs";
|
|
6
6
|
import { t as postgresRenderCheckExpressions } from "./check-expressions-DFTeR0rd-CSxSpyMV.mjs";
|
|
7
|
-
import { t as postgresDataTypeEntries } from "./data-type-entries-
|
|
7
|
+
import { t as postgresDataTypeEntries } from "./data-type-entries-Fxm2HDZk-D4AAd63w.mjs";
|
|
8
8
|
import { escapePslString } from "@prisma/orm-family-sql/relational-core/ast";
|
|
9
9
|
import { createDataTypeLookup, materializeCodec } from "@prisma/orm-framework/components/codec";
|
|
10
10
|
import { blindCast } from "@prisma/orm-framework/utils/casts";
|
|
@@ -16,7 +16,7 @@ import { SqlSchemaIR, SqlTableIR } from "@prisma/orm-family-sql/schema-ir/types"
|
|
|
16
16
|
import { buildChildRelationField, deriveRelationFieldName, inferRelations, mapDefault, toEnumMemberName, toEnumName, toFieldName, toModelName } from "@prisma/orm-family-sql/family/psl-infer";
|
|
17
17
|
import { UNSPECIFIED_PSL_NAMESPACE_ID, makePslNamespace, makePslNamespaceEntries } from "@prisma/orm-framework/components/psl-ast";
|
|
18
18
|
import { isColumnDefault } from "@prisma/orm-framework/contract/types";
|
|
19
|
-
//#region ../../../3-targets/3-targets/postgres/dist/infer-psl-contract-
|
|
19
|
+
//#region ../../../3-targets/3-targets/postgres/dist/infer-psl-contract-CfoEqxkp.mjs
|
|
20
20
|
function buildFieldNamesByTable(tables) {
|
|
21
21
|
const fieldNamesByTable = /* @__PURE__ */ new Map();
|
|
22
22
|
for (const table of Object.values(tables)) {
|
|
@@ -1085,4 +1085,4 @@ function buildPslDocumentAst(schemaIR, options, foreignKeyExtras, namespaceName,
|
|
|
1085
1085
|
//#endregion
|
|
1086
1086
|
export { inferPostgresPslContract as i, createPostgresDefaultMapping as n, createPostgresTypeMap as r, buildPslDocumentAst as t };
|
|
1087
1087
|
|
|
1088
|
-
//# sourceMappingURL=infer-psl-contract-
|
|
1088
|
+
//# sourceMappingURL=infer-psl-contract-CfoEqxkp-Cqf2Ra8i.mjs.map
|