@prisma/orm-family-sql 8.0.0-rc.19-dev.7 → 8.0.0-rc.19-dev.8
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/{authoring-entity-types-DUQLeBf_-DSWWvkLJ.d.mts → authoring-entity-types-CgKIgWq5-Dxf_T0Ih.d.mts} +3 -3
- package/dist/authoring-entity-types-CgKIgWq5-Dxf_T0Ih.d.mts.map +1 -0
- package/dist/{config-types-BLDwd9wS.mjs → config-types-BbBY5_GQ.mjs} +2 -2
- package/dist/{config-types-BLDwd9wS.mjs.map → config-types-BbBY5_GQ.mjs.map} +1 -1
- package/dist/{contract-builder-CNeGxqP_.mjs → contract-builder-D7cTmhfs.mjs} +4 -5
- package/dist/contract-builder-D7cTmhfs.mjs.map +1 -0
- package/dist/contract-prisma7__provider.mjs +10 -4
- package/dist/contract-prisma7__provider.mjs.map +1 -1
- package/dist/contract-psl.mjs +1 -1
- package/dist/contract-psl__attribute-specs.mjs +1 -1
- package/dist/contract-psl__provider.mjs +2 -2
- package/dist/contract-psl__provider.mjs.map +1 -1
- package/dist/contract-ts.mjs +3 -3
- package/dist/contract-ts__config-types.mjs +1 -1
- package/dist/contract-ts__contract-builder.mjs +2 -2
- package/dist/contract.d.mts +3 -3
- package/dist/contract.mjs +3 -3
- package/dist/contract__data-type-support.d.mts +2 -2
- package/dist/contract__data-type-support.mjs +2 -2
- package/dist/contract__data-type.d.mts +2 -2
- package/dist/contract__data-type.mjs +2 -2
- package/dist/{control-Dv1ea79q.d.mts → control-BW6gbqvb.d.mts} +2 -2
- package/dist/{control-Dv1ea79q.d.mts.map → control-BW6gbqvb.d.mts.map} +1 -1
- package/dist/{control-Cih61sJa.mjs → control-DnFJf5_F.mjs} +3 -3
- package/dist/{control-Cih61sJa.mjs.map → control-DnFJf5_F.mjs.map} +1 -1
- package/dist/{data-type-CUJMZOHo.mjs → data-type-BMnEHaW3.mjs} +2 -17
- package/dist/data-type-BMnEHaW3.mjs.map +1 -0
- package/dist/{data-type-CWFhlpaq.d.mts → data-type-iatMyRs6.d.mts} +2 -9
- package/dist/data-type-iatMyRs6.d.mts.map +1 -0
- package/dist/data-type-support-a9BR-PbH.d.mts +7 -0
- package/dist/data-type-support-a9BR-PbH.d.mts.map +1 -0
- package/dist/data-type-support-juGV2d9c.mjs +9 -0
- package/dist/data-type-support-juGV2d9c.mjs.map +1 -0
- package/dist/{derived-checks-iXF3y0Ki-28vqz_8w.mjs → derived-checks-D5HVRvqN-B37oe30Z.mjs} +2 -2
- package/dist/{derived-checks-iXF3y0Ki-28vqz_8w.mjs.map → derived-checks-D5HVRvqN-B37oe30Z.mjs.map} +1 -1
- package/dist/family.d.mts +3 -3
- package/dist/family.mjs +4 -4
- package/dist/family__control.d.mts +1 -1
- package/dist/family__control.mjs +1 -1
- package/dist/family__pack.d.mts +1 -1
- package/dist/family__pack.mjs +2 -2
- package/dist/family__psl-build.d.mts +1 -1
- package/dist/family__psl-build.mjs +1 -1
- package/dist/{generator-functions-DuDZSQHE-Dl5EP61A.mjs → generator-functions-D_qdqBV--BoeJwWsz.mjs} +4 -4
- package/dist/generator-functions-D_qdqBV--BoeJwWsz.mjs.map +1 -0
- package/dist/{interpreter-BGgim2OE-D9BG-4aU.mjs → interpreter-BDpym-rc-BZVFp5GU.mjs} +112 -77
- package/dist/interpreter-BDpym-rc-BZVFp5GU.mjs.map +1 -0
- package/dist/{pack-B5_CfdgT.mjs → pack-BifOs83a.mjs} +3 -3
- package/dist/{pack-B5_CfdgT.mjs.map → pack-BifOs83a.mjs.map} +1 -1
- package/dist/{pack-BJ53Inwa.d.mts → pack-CdaZMfI_.d.mts} +2 -2
- package/dist/{pack-BJ53Inwa.d.mts.map → pack-CdaZMfI_.d.mts.map} +1 -1
- package/dist/{psl-build-prdUw3sC.d.mts → psl-build-BYXXz2XD.d.mts} +2 -2
- package/dist/{psl-build-prdUw3sC.d.mts.map → psl-build-BYXXz2XD.d.mts.map} +1 -1
- package/dist/{psl-build-D5VG40ej.mjs → psl-build-fwoI6rBO.mjs} +3 -4
- package/dist/{psl-build-D5VG40ej.mjs.map → psl-build-fwoI6rBO.mjs.map} +1 -1
- package/dist/{psl-field-resolution-C9zwpsAu-DCc7Eifv.mjs → psl-field-resolution-C5KQ7kzP-DH8oSBIL.mjs} +4 -22
- package/dist/psl-field-resolution-C5KQ7kzP-DH8oSBIL.mjs.map +1 -0
- package/package.json +18 -18
- package/dist/authoring-entity-types-DUQLeBf_-DSWWvkLJ.d.mts.map +0 -1
- package/dist/contract-builder-CNeGxqP_.mjs.map +0 -1
- package/dist/data-type-CUJMZOHo.mjs.map +0 -1
- package/dist/data-type-CWFhlpaq.d.mts.map +0 -1
- package/dist/data-type-support-C5-XxxeB.mjs +0 -364
- package/dist/data-type-support-C5-XxxeB.mjs.map +0 -1
- package/dist/data-type-support-CBcYhSkD.d.mts +0 -88
- package/dist/data-type-support-CBcYhSkD.d.mts.map +0 -1
- package/dist/generator-functions-DuDZSQHE-Dl5EP61A.mjs.map +0 -1
- package/dist/interpreter-BGgim2OE-D9BG-4aU.mjs.map +0 -1
- package/dist/psl-field-resolution-C9zwpsAu-DCc7Eifv.mjs.map +0 -1
|
@@ -1,364 +0,0 @@
|
|
|
1
|
-
import { structuredError } from "@prisma/orm-framework/utils/structured-error";
|
|
2
|
-
import { isNonFiniteText } from "@prisma/orm-framework/components/codec";
|
|
3
|
-
import { InternalError } from "@prisma/orm-framework/utils/internal-error";
|
|
4
|
-
//#region ../../../2-sql/1-core/contract/dist/data-type-support.mjs
|
|
5
|
-
const WRITTEN_INTEGER_TEXT = /^[+-]?\d+$/;
|
|
6
|
-
const WRITTEN_DECIMAL_TEXT = /^[+-]?\d+\.\d+$/;
|
|
7
|
-
const DECIMAL_NUMERAL = /^([+-]?)0*(\d+)(\.\d+)?$/;
|
|
8
|
-
/** Whether `text` is a whole number or a decimal as a contract source writes one. */
|
|
9
|
-
function isNumeralText(text) {
|
|
10
|
-
return WRITTEN_INTEGER_TEXT.test(text) || WRITTEN_DECIMAL_TEXT.test(text);
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* A written numeral as the contract stores it. Leading zeros and the sign of zero never change a
|
|
14
|
-
* number, so they go; trailing zeros stay, because a type without a scale keeps them.
|
|
15
|
-
*/
|
|
16
|
-
function storedNumeralText(text) {
|
|
17
|
-
const numeral = DECIMAL_NUMERAL.exec(text);
|
|
18
|
-
if (numeral === null) return text;
|
|
19
|
-
const [, sign = "", whole = "", fraction = ""] = numeral;
|
|
20
|
-
const digits = `${whole}${fraction}`;
|
|
21
|
-
return sign !== "-" || /^[0.]+$/.test(digits) ? digits : `-${digits}`;
|
|
22
|
-
}
|
|
23
|
-
/** A string as a contract source writes it, with the escapes its string reader resolves. */
|
|
24
|
-
function escapePslString(value) {
|
|
25
|
-
return value.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/\n/g, "\\n").replace(/\r/g, "\\r");
|
|
26
|
-
}
|
|
27
|
-
/** The range of a signed integer of `bits` bits. */
|
|
28
|
-
function signedRange(bits) {
|
|
29
|
-
const half = 2n ** (BigInt(bits) - 1n);
|
|
30
|
-
return {
|
|
31
|
-
min: -half,
|
|
32
|
-
max: half - 1n
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* The classifier one target's plain-number authoring entry carries: it reads the digits and says
|
|
37
|
-
* which of the target's types the value is, in that type's stored form. `undefined` means no
|
|
38
|
-
* type of this target holds the number.
|
|
39
|
-
*/
|
|
40
|
-
function createNumberClassifier(spec) {
|
|
41
|
-
const as = (classification, value) => classification === void 0 ? void 0 : {
|
|
42
|
-
type: classification.type,
|
|
43
|
-
value
|
|
44
|
-
};
|
|
45
|
-
return (text) => {
|
|
46
|
-
if (isNonFiniteText(text)) return as(spec.words, spec.words?.form === "number" ? Number(text) : text);
|
|
47
|
-
if (WRITTEN_DECIMAL_TEXT.test(text)) {
|
|
48
|
-
const canonical = storedNumeralText(text);
|
|
49
|
-
return as(spec.fraction, spec.fraction?.form === "number" ? Number(canonical) : canonical);
|
|
50
|
-
}
|
|
51
|
-
if (!WRITTEN_INTEGER_TEXT.test(text)) return void 0;
|
|
52
|
-
const digits = BigInt(text);
|
|
53
|
-
const classification = spec.integers.find(({ min, max }) => digits >= min && digits <= max) ?? spec.largerWhole;
|
|
54
|
-
return as(classification, classification?.form === "number" ? Number(digits) : digits.toString());
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Read JSON text into the document it holds.
|
|
59
|
-
*
|
|
60
|
-
* `JSON.parse` reads a numeral too large for a double as `Infinity`, and `JSON.stringify` writes
|
|
61
|
-
* that back as `null`, so a document holding one would not be the document stored; it is refused
|
|
62
|
-
* here instead, naming where the number is.
|
|
63
|
-
*/
|
|
64
|
-
function parseJsonText(text) {
|
|
65
|
-
let value;
|
|
66
|
-
try {
|
|
67
|
-
value = JSON.parse(text);
|
|
68
|
-
} catch (error) {
|
|
69
|
-
throw structuredError("CONTRACT.INVALID_JSON_LITERAL", error instanceof Error ? error.message : String(error), {
|
|
70
|
-
why: "The text is not a JSON document.",
|
|
71
|
-
fix: "Write a JSON document."
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
const overflowed = nonFiniteNumberIn(value, "");
|
|
75
|
-
if (overflowed !== void 0) throw structuredError("CONTRACT.INVALID_JSON_LITERAL", `${overflowed.path} is ${overflowed.value}, which JSON cannot write back: the number in the text is outside the range a JSON number holds.`, {
|
|
76
|
-
why: "JSON.parse reads a numeral too large for a double as Infinity, which JSON.stringify writes back as null.",
|
|
77
|
-
fix: "Write a number JSON can hold, or write it as text."
|
|
78
|
-
});
|
|
79
|
-
return value;
|
|
80
|
-
}
|
|
81
|
-
/** Write a document as the text of a JSON literal. */
|
|
82
|
-
function printJsonText(value) {
|
|
83
|
-
return JSON.stringify(value);
|
|
84
|
-
}
|
|
85
|
-
function nonFiniteNumberIn(value, path) {
|
|
86
|
-
if (typeof value === "number") return Number.isFinite(value) ? void 0 : {
|
|
87
|
-
path: path === "" ? "The value" : path,
|
|
88
|
-
value
|
|
89
|
-
};
|
|
90
|
-
if (Array.isArray(value)) {
|
|
91
|
-
for (const [index, element] of value.entries()) {
|
|
92
|
-
const found = nonFiniteNumberIn(element, `${path}[${index}]`);
|
|
93
|
-
if (found !== void 0) return found;
|
|
94
|
-
}
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
if (typeof value === "object" && value !== null) for (const [key, member] of Object.entries(value)) {
|
|
98
|
-
const found = nonFiniteNumberIn(member, path === "" ? key : `${path}.${key}`);
|
|
99
|
-
if (found !== void 0) return found;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* The reader the SQL targets build the stored form of each date and time type with; ADR 254
|
|
104
|
-
* states the forms and the text it reads.
|
|
105
|
-
*/
|
|
106
|
-
const SHAPES = {
|
|
107
|
-
date: {
|
|
108
|
-
description: "a date",
|
|
109
|
-
plural: "dates",
|
|
110
|
-
example: "2024-01-01",
|
|
111
|
-
date: true,
|
|
112
|
-
time: false,
|
|
113
|
-
offset: false
|
|
114
|
-
},
|
|
115
|
-
time: {
|
|
116
|
-
description: "a time of day",
|
|
117
|
-
plural: "times of day",
|
|
118
|
-
example: "12:34:56",
|
|
119
|
-
date: false,
|
|
120
|
-
time: true,
|
|
121
|
-
offset: false
|
|
122
|
-
},
|
|
123
|
-
timeWithOffset: {
|
|
124
|
-
description: "a time of day with a UTC offset",
|
|
125
|
-
plural: "times of day with a UTC offset",
|
|
126
|
-
example: "12:34:56+02:00",
|
|
127
|
-
date: false,
|
|
128
|
-
time: true,
|
|
129
|
-
offset: true
|
|
130
|
-
},
|
|
131
|
-
dateTime: {
|
|
132
|
-
description: "a date and time",
|
|
133
|
-
plural: "dates and times",
|
|
134
|
-
example: "2024-01-01T12:34:56",
|
|
135
|
-
date: true,
|
|
136
|
-
time: true,
|
|
137
|
-
offset: false
|
|
138
|
-
},
|
|
139
|
-
instant: {
|
|
140
|
-
description: "a date and time with a UTC offset",
|
|
141
|
-
plural: "instants",
|
|
142
|
-
example: "2024-01-01T12:34:56Z",
|
|
143
|
-
date: true,
|
|
144
|
-
time: true,
|
|
145
|
-
offset: true
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
const DATE_PREFIX = /^([+-]\d{6}|\d{4})-(\d{2})-(\d{2})/;
|
|
149
|
-
const TIME_PREFIX = /^(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?/;
|
|
150
|
-
const OFFSET = /^([+-])(\d{2})(?::(\d{2})(?::(\d{2}))?)?$/;
|
|
151
|
-
const MAX_FRACTION_DIGITS = 6;
|
|
152
|
-
const FRACTION_UNITS = {
|
|
153
|
-
3: "milliseconds",
|
|
154
|
-
6: "microseconds"
|
|
155
|
-
};
|
|
156
|
-
const SECONDS_PER_DAY = 86400;
|
|
157
|
-
const MIDNIGHT = {
|
|
158
|
-
hour: 0,
|
|
159
|
-
minute: 0,
|
|
160
|
-
second: 0,
|
|
161
|
-
fraction: ""
|
|
162
|
-
};
|
|
163
|
-
function refused(message) {
|
|
164
|
-
throw structuredError("CONTRACT.CAST_REFUSED", message, {
|
|
165
|
-
why: "A date or time type stores one form for each value (ADR 254).",
|
|
166
|
-
fix: "Write text the type holds, as the message shows."
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
function isLeapYear(year) {
|
|
170
|
-
return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
|
|
171
|
-
}
|
|
172
|
-
function daysInMonth(year, month) {
|
|
173
|
-
if (month === 2) return isLeapYear(year) ? 29 : 28;
|
|
174
|
-
return [
|
|
175
|
-
4,
|
|
176
|
-
6,
|
|
177
|
-
9,
|
|
178
|
-
11
|
|
179
|
-
].includes(month) ? 30 : 31;
|
|
180
|
-
}
|
|
181
|
-
/** Days from 1970-01-01 to a date of the proleptic Gregorian calendar, with year 0 as 1 BC. */
|
|
182
|
-
function daysFromCivil({ year, month, day }) {
|
|
183
|
-
const shifted = month <= 2 ? year - 1 : year;
|
|
184
|
-
const era = Math.floor(shifted / 400);
|
|
185
|
-
const yearOfEra = shifted - era * 400;
|
|
186
|
-
const dayOfYear = Math.floor((153 * (month + (month > 2 ? -3 : 9)) + 2) / 5) + day - 1;
|
|
187
|
-
const dayOfEra = yearOfEra * 365 + Math.floor(yearOfEra / 4) - Math.floor(yearOfEra / 100) + dayOfYear;
|
|
188
|
-
return era * 146097 + dayOfEra - 719468;
|
|
189
|
-
}
|
|
190
|
-
function civilFromDays(days) {
|
|
191
|
-
const shifted = days + 719468;
|
|
192
|
-
const era = Math.floor(shifted / 146097);
|
|
193
|
-
const dayOfEra = shifted - era * 146097;
|
|
194
|
-
const yearOfEra = Math.floor((dayOfEra - Math.floor(dayOfEra / 1460) + Math.floor(dayOfEra / 36524) - Math.floor(dayOfEra / 146096)) / 365);
|
|
195
|
-
const dayOfYear = dayOfEra - (365 * yearOfEra + Math.floor(yearOfEra / 4) - Math.floor(yearOfEra / 100));
|
|
196
|
-
const monthIndex = Math.floor((5 * dayOfYear + 2) / 153);
|
|
197
|
-
const day = dayOfYear - Math.floor((153 * monthIndex + 2) / 5) + 1;
|
|
198
|
-
const month = monthIndex < 10 ? monthIndex + 3 : monthIndex - 9;
|
|
199
|
-
return {
|
|
200
|
-
year: yearOfEra + era * 400 + (month <= 2 ? 1 : 0),
|
|
201
|
-
month,
|
|
202
|
-
day
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
|
-
function pad(value, width = 2) {
|
|
206
|
-
return String(value).padStart(width, "0");
|
|
207
|
-
}
|
|
208
|
-
function yearText(year) {
|
|
209
|
-
if (year >= 0 && year <= 9999) return pad(year, 4);
|
|
210
|
-
return `${year < 0 ? "-" : "+"}${pad(Math.abs(year), 6)}`;
|
|
211
|
-
}
|
|
212
|
-
function dateText(date) {
|
|
213
|
-
return `${yearText(date.year)}-${pad(date.month)}-${pad(date.day)}`;
|
|
214
|
-
}
|
|
215
|
-
function timeText(time) {
|
|
216
|
-
const fraction = time.fraction.replace(/0+$/, "");
|
|
217
|
-
return `${pad(time.hour)}:${pad(time.minute)}:${pad(time.second)}${fraction === "" ? "" : `.${fraction}`}`;
|
|
218
|
-
}
|
|
219
|
-
function offsetText(seconds) {
|
|
220
|
-
if (seconds === 0) return "Z";
|
|
221
|
-
const magnitude = Math.abs(seconds);
|
|
222
|
-
const rest = magnitude % 60;
|
|
223
|
-
return `${seconds < 0 ? "-" : "+"}${pad(Math.floor(magnitude / 3600))}:${pad(Math.floor(magnitude / 60) % 60)}${rest === 0 ? "" : `:${pad(rest)}`}`;
|
|
224
|
-
}
|
|
225
|
-
/**
|
|
226
|
-
* The fields of an ISO 8601 date, time, or date and time, or `undefined` when the text is not one.
|
|
227
|
-
* Ranges are checked by the caller, which words the refusal.
|
|
228
|
-
*/
|
|
229
|
-
function readWritten(text) {
|
|
230
|
-
let rest = text;
|
|
231
|
-
let date;
|
|
232
|
-
let timeFollows = true;
|
|
233
|
-
const dateMatch = DATE_PREFIX.exec(rest);
|
|
234
|
-
if (dateMatch !== null) {
|
|
235
|
-
const [whole, yearDigits = "", month = "", day = ""] = dateMatch;
|
|
236
|
-
if (yearDigits === "-000000") return void 0;
|
|
237
|
-
date = {
|
|
238
|
-
year: Number(yearDigits),
|
|
239
|
-
month: Number(month),
|
|
240
|
-
day: Number(day)
|
|
241
|
-
};
|
|
242
|
-
rest = rest.slice(whole.length);
|
|
243
|
-
timeFollows = /^[Tt ]/.test(rest);
|
|
244
|
-
if (timeFollows) rest = rest.slice(1);
|
|
245
|
-
}
|
|
246
|
-
let time;
|
|
247
|
-
let fractionDigits = 0;
|
|
248
|
-
if (timeFollows) {
|
|
249
|
-
const timeMatch = TIME_PREFIX.exec(rest);
|
|
250
|
-
if (timeMatch === null) return void 0;
|
|
251
|
-
const [whole, hour = "", minute = "", second = "00", fraction = ""] = timeMatch;
|
|
252
|
-
time = {
|
|
253
|
-
hour: Number(hour),
|
|
254
|
-
minute: Number(minute),
|
|
255
|
-
second: Number(second),
|
|
256
|
-
fraction
|
|
257
|
-
};
|
|
258
|
-
fractionDigits = fraction.length;
|
|
259
|
-
rest = rest.slice(whole.length);
|
|
260
|
-
}
|
|
261
|
-
let offsetSeconds;
|
|
262
|
-
if (rest === "Z" || rest === "z") offsetSeconds = 0;
|
|
263
|
-
else if (rest !== "") {
|
|
264
|
-
const offset = OFFSET.exec(rest);
|
|
265
|
-
if (offset === null) return void 0;
|
|
266
|
-
const [, sign, hours = "", minutes = "00", seconds = "00"] = offset;
|
|
267
|
-
if (Number(minutes) > 59 || Number(seconds) > 59) return void 0;
|
|
268
|
-
const magnitude = Number(hours) * 3600 + Number(minutes) * 60 + Number(seconds);
|
|
269
|
-
offsetSeconds = sign === "-" ? -magnitude : magnitude;
|
|
270
|
-
}
|
|
271
|
-
return {
|
|
272
|
-
date,
|
|
273
|
-
time,
|
|
274
|
-
offsetSeconds,
|
|
275
|
-
fractionDigits
|
|
276
|
-
};
|
|
277
|
-
}
|
|
278
|
-
function withFraction(example, digits) {
|
|
279
|
-
return example.replace(/(\d{2}:\d{2}:\d{2})/, `$1.${"123456".slice(0, digits)}`);
|
|
280
|
-
}
|
|
281
|
-
/** The value with an instant moved to UTC. */
|
|
282
|
-
function normalized(written, shape) {
|
|
283
|
-
const clock = written.time ?? MIDNIGHT;
|
|
284
|
-
const offsetSeconds = written.offsetSeconds ?? 0;
|
|
285
|
-
if (written.date === void 0 || shape !== "instant") return {
|
|
286
|
-
date: written.date,
|
|
287
|
-
time: clock,
|
|
288
|
-
offsetSeconds
|
|
289
|
-
};
|
|
290
|
-
const utc = daysFromCivil(written.date) * SECONDS_PER_DAY + clock.hour * 3600 + clock.minute * 60 + clock.second - offsetSeconds;
|
|
291
|
-
const days = Math.floor(utc / SECONDS_PER_DAY);
|
|
292
|
-
const secondOfDay = utc - days * SECONDS_PER_DAY;
|
|
293
|
-
return {
|
|
294
|
-
date: civilFromDays(days),
|
|
295
|
-
time: {
|
|
296
|
-
hour: Math.floor(secondOfDay / 3600),
|
|
297
|
-
minute: Math.floor(secondOfDay / 60) % 60,
|
|
298
|
-
second: secondOfDay % 60,
|
|
299
|
-
fraction: clock.fraction
|
|
300
|
-
},
|
|
301
|
-
offsetSeconds: 0
|
|
302
|
-
};
|
|
303
|
-
}
|
|
304
|
-
function position(value) {
|
|
305
|
-
const { time } = value;
|
|
306
|
-
return [
|
|
307
|
-
value.date === void 0 ? 0 : daysFromCivil(value.date),
|
|
308
|
-
time.hour * 3600 + time.minute * 60 + time.second,
|
|
309
|
-
time.fraction.padEnd(MAX_FRACTION_DIGITS, "0")
|
|
310
|
-
];
|
|
311
|
-
}
|
|
312
|
-
function isBefore(left, right) {
|
|
313
|
-
if (left[0] !== right[0]) return left[0] < right[0];
|
|
314
|
-
if (left[1] !== right[1]) return left[1] < right[1];
|
|
315
|
-
return left[2] < right[2];
|
|
316
|
-
}
|
|
317
|
-
function printed(value, shape) {
|
|
318
|
-
const { date, time, offsetSeconds } = value;
|
|
319
|
-
if (date === void 0) return shape === "timeWithOffset" ? `${timeText(time)}${offsetText(offsetSeconds)}` : timeText(time);
|
|
320
|
-
if (shape === "date") return dateText(date);
|
|
321
|
-
if (shape === "dateTime") return `${dateText(date)}T${timeText(time)}`;
|
|
322
|
-
return `${dateText(date)}T${timeText(time)}Z`;
|
|
323
|
-
}
|
|
324
|
-
/** The position of a range bound, which the data type declares in stored form. */
|
|
325
|
-
function boundPosition(text, shape) {
|
|
326
|
-
const written = readWritten(text);
|
|
327
|
-
if (written === void 0) throw new InternalError(`The range bound "${text}" is not in its stored form.`);
|
|
328
|
-
return position(normalized(written, shape));
|
|
329
|
-
}
|
|
330
|
-
/**
|
|
331
|
-
* The stored form of written date or time text, or a refusal with a message that says what is
|
|
332
|
-
* wrong and shows text the type holds. `written` is the text as its author wrote it, which the
|
|
333
|
-
* message shows, when a target rewrote it into ISO 8601 before calling this.
|
|
334
|
-
*/
|
|
335
|
-
function dateTimeStoredText(text, options, written = text) {
|
|
336
|
-
const shape = SHAPES[options.shape];
|
|
337
|
-
const { ownerId: id } = options;
|
|
338
|
-
const parts = readWritten(text);
|
|
339
|
-
if (parts === void 0) refused(`${id} cannot read "${written}". Write ${shape.description}, as in "${shape.example}".`);
|
|
340
|
-
if (parts.date !== void 0 && !shape.date) refused(`${id} holds a time of day without a date, but "${written}" has a date. Write the time alone, as in "${shape.example}".`);
|
|
341
|
-
if (parts.date === void 0 && shape.date) refused(shape.time ? `${id} holds ${shape.description}, but "${written}" has no date. Write the date too, as in "${shape.example}".` : `${id} holds a date, and "${written}" is a time of day. Write a date, as in "${shape.example}".`);
|
|
342
|
-
if (parts.time !== void 0 && !shape.time) refused(`${id} holds a date without a time of day, but "${written}" has a time. Write the date alone, as in "${shape.example}".`);
|
|
343
|
-
if (parts.time === void 0 && shape.offset) refused(`${id} holds ${shape.description}, but "${written}" has no time of day. Write the time too, as in "${shape.example}".`);
|
|
344
|
-
if (parts.offsetSeconds !== void 0 && !shape.offset) refused(`${id} holds no UTC offset, but "${written}" has one. Leave it out, as in "${shape.example}".`);
|
|
345
|
-
if (parts.offsetSeconds === void 0 && shape.offset) refused(`${id} needs a UTC offset, but "${written}" has none. Add Z for UTC or an offset such as +02:00, as in "${shape.example}".`);
|
|
346
|
-
const maxFractionDigits = options.maxFractionDigits ?? MAX_FRACTION_DIGITS;
|
|
347
|
-
if (parts.fractionDigits > maxFractionDigits) refused(`"${written}" has ${parts.fractionDigits} digits after the decimal point, but ${id} holds ${FRACTION_UNITS[maxFractionDigits]}, so at most ${maxFractionDigits}. Round it, as in "${withFraction(shape.example, maxFractionDigits)}".`);
|
|
348
|
-
const { date, time } = parts;
|
|
349
|
-
if (date !== void 0 && (date.month < 1 || date.month > 12 || date.day < 1 || date.day > daysInMonth(date.year, date.month))) refused(`"${written}" is not a date that exists. Write a real date, as in "${shape.example}".`);
|
|
350
|
-
if (time !== void 0 && (time.hour > 23 || time.minute > 59 || time.second > 59)) refused(`"${written}" is not a time of day that exists: hours run from 00 to 23, and minutes and seconds from 00 to 59. Write one, as in "${shape.example}".`);
|
|
351
|
-
const offsetLimit = options.maxOffsetHours ?? 23;
|
|
352
|
-
if (parts.offsetSeconds !== void 0 && Math.abs(parts.offsetSeconds) >= (offsetLimit + 1) * 3600) refused(`"${written}" has a UTC offset outside -${pad(offsetLimit)}:59 to +${pad(offsetLimit)}:59, which ${id} does not hold. Write a smaller offset, as in "${shape.example}".`);
|
|
353
|
-
const value = normalized(parts, options.shape);
|
|
354
|
-
const { range } = options;
|
|
355
|
-
if (range !== void 0) {
|
|
356
|
-
const at = position(value);
|
|
357
|
-
if (isBefore(at, boundPosition(range.earliest, options.shape)) || isBefore(boundPosition(range.latest, options.shape), at)) refused(`${id} holds ${shape.plural} from ${range.earliest} to ${range.latest}, and "${written}" is outside them.`);
|
|
358
|
-
}
|
|
359
|
-
return printed(value, options.shape);
|
|
360
|
-
}
|
|
361
|
-
//#endregion
|
|
362
|
-
export { parseJsonText as a, storedNumeralText as c, isNumeralText as i, dateTimeStoredText as n, printJsonText as o, escapePslString as r, signedRange as s, createNumberClassifier as t };
|
|
363
|
-
|
|
364
|
-
//# sourceMappingURL=data-type-support-C5-XxxeB.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"data-type-support-C5-XxxeB.mjs","names":[],"sources":["../../../../2-sql/1-core/contract/dist/data-type-support.mjs"],"sourcesContent":["import { structuredError } from \"@internal/utils/structured-error\";\nimport { isNonFiniteText } from \"@internal/framework-components/codec\";\nimport { InternalError } from \"@internal/utils/internal-error\";\n//#region src/data-type-support.ts\nconst WRITTEN_INTEGER_TEXT = /^[+-]?\\d+$/;\nconst WRITTEN_DECIMAL_TEXT = /^[+-]?\\d+\\.\\d+$/;\nconst DECIMAL_NUMERAL = /^([+-]?)0*(\\d+)(\\.\\d+)?$/;\n/** Whether `text` is a whole number or a decimal as a contract source writes one. */\nfunction isNumeralText(text) {\n\treturn WRITTEN_INTEGER_TEXT.test(text) || WRITTEN_DECIMAL_TEXT.test(text);\n}\n/**\n* A written numeral as the contract stores it. Leading zeros and the sign of zero never change a\n* number, so they go; trailing zeros stay, because a type without a scale keeps them.\n*/\nfunction storedNumeralText(text) {\n\tconst numeral = DECIMAL_NUMERAL.exec(text);\n\tif (numeral === null) return text;\n\tconst [, sign = \"\", whole = \"\", fraction = \"\"] = numeral;\n\tconst digits = `${whole}${fraction}`;\n\treturn sign !== \"-\" || /^[0.]+$/.test(digits) ? digits : `-${digits}`;\n}\n/** A string as a contract source writes it, with the escapes its string reader resolves. */\nfunction escapePslString(value) {\n\treturn value.replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, \"\\\\\\\"\").replace(/\\n/g, \"\\\\n\").replace(/\\r/g, \"\\\\r\");\n}\n/** The range of a signed integer of `bits` bits. */\nfunction signedRange(bits) {\n\tconst half = 2n ** (BigInt(bits) - 1n);\n\treturn {\n\t\tmin: -half,\n\t\tmax: half - 1n\n\t};\n}\n/**\n* The classifier one target's plain-number authoring entry carries: it reads the digits and says\n* which of the target's types the value is, in that type's stored form. `undefined` means no\n* type of this target holds the number.\n*/\nfunction createNumberClassifier(spec) {\n\tconst as = (classification, value) => classification === void 0 ? void 0 : {\n\t\ttype: classification.type,\n\t\tvalue\n\t};\n\treturn (text) => {\n\t\tif (isNonFiniteText(text)) return as(spec.words, spec.words?.form === \"number\" ? Number(text) : text);\n\t\tif (WRITTEN_DECIMAL_TEXT.test(text)) {\n\t\t\tconst canonical = storedNumeralText(text);\n\t\t\treturn as(spec.fraction, spec.fraction?.form === \"number\" ? Number(canonical) : canonical);\n\t\t}\n\t\tif (!WRITTEN_INTEGER_TEXT.test(text)) return void 0;\n\t\tconst digits = BigInt(text);\n\t\tconst classification = spec.integers.find(({ min, max }) => digits >= min && digits <= max) ?? spec.largerWhole;\n\t\treturn as(classification, classification?.form === \"number\" ? Number(digits) : digits.toString());\n\t};\n}\n/**\n* Read JSON text into the document it holds.\n*\n* `JSON.parse` reads a numeral too large for a double as `Infinity`, and `JSON.stringify` writes\n* that back as `null`, so a document holding one would not be the document stored; it is refused\n* here instead, naming where the number is.\n*/\nfunction parseJsonText(text) {\n\tlet value;\n\ttry {\n\t\tvalue = JSON.parse(text);\n\t} catch (error) {\n\t\tthrow structuredError(\"CONTRACT.INVALID_JSON_LITERAL\", error instanceof Error ? error.message : String(error), {\n\t\t\twhy: \"The text is not a JSON document.\",\n\t\t\tfix: \"Write a JSON document.\"\n\t\t});\n\t}\n\tconst overflowed = nonFiniteNumberIn(value, \"\");\n\tif (overflowed !== void 0) throw structuredError(\"CONTRACT.INVALID_JSON_LITERAL\", `${overflowed.path} is ${overflowed.value}, which JSON cannot write back: the number in the text is outside the range a JSON number holds.`, {\n\t\twhy: \"JSON.parse reads a numeral too large for a double as Infinity, which JSON.stringify writes back as null.\",\n\t\tfix: \"Write a number JSON can hold, or write it as text.\"\n\t});\n\treturn value;\n}\n/** Write a document as the text of a JSON literal. */\nfunction printJsonText(value) {\n\treturn JSON.stringify(value);\n}\nfunction nonFiniteNumberIn(value, path) {\n\tif (typeof value === \"number\") return Number.isFinite(value) ? void 0 : {\n\t\tpath: path === \"\" ? \"The value\" : path,\n\t\tvalue\n\t};\n\tif (Array.isArray(value)) {\n\t\tfor (const [index, element] of value.entries()) {\n\t\t\tconst found = nonFiniteNumberIn(element, `${path}[${index}]`);\n\t\t\tif (found !== void 0) return found;\n\t\t}\n\t\treturn;\n\t}\n\tif (typeof value === \"object\" && value !== null) for (const [key, member] of Object.entries(value)) {\n\t\tconst found = nonFiniteNumberIn(member, path === \"\" ? key : `${path}.${key}`);\n\t\tif (found !== void 0) return found;\n\t}\n}\n//#endregion\n//#region src/date-time-stored-form.ts\n/**\n* The reader the SQL targets build the stored form of each date and time type with; ADR 254\n* states the forms and the text it reads.\n*/\nconst SHAPES = {\n\tdate: {\n\t\tdescription: \"a date\",\n\t\tplural: \"dates\",\n\t\texample: \"2024-01-01\",\n\t\tdate: true,\n\t\ttime: false,\n\t\toffset: false\n\t},\n\ttime: {\n\t\tdescription: \"a time of day\",\n\t\tplural: \"times of day\",\n\t\texample: \"12:34:56\",\n\t\tdate: false,\n\t\ttime: true,\n\t\toffset: false\n\t},\n\ttimeWithOffset: {\n\t\tdescription: \"a time of day with a UTC offset\",\n\t\tplural: \"times of day with a UTC offset\",\n\t\texample: \"12:34:56+02:00\",\n\t\tdate: false,\n\t\ttime: true,\n\t\toffset: true\n\t},\n\tdateTime: {\n\t\tdescription: \"a date and time\",\n\t\tplural: \"dates and times\",\n\t\texample: \"2024-01-01T12:34:56\",\n\t\tdate: true,\n\t\ttime: true,\n\t\toffset: false\n\t},\n\tinstant: {\n\t\tdescription: \"a date and time with a UTC offset\",\n\t\tplural: \"instants\",\n\t\texample: \"2024-01-01T12:34:56Z\",\n\t\tdate: true,\n\t\ttime: true,\n\t\toffset: true\n\t}\n};\nconst DATE_PREFIX = /^([+-]\\d{6}|\\d{4})-(\\d{2})-(\\d{2})/;\nconst TIME_PREFIX = /^(\\d{2}):(\\d{2})(?::(\\d{2})(?:\\.(\\d+))?)?/;\nconst OFFSET = /^([+-])(\\d{2})(?::(\\d{2})(?::(\\d{2}))?)?$/;\nconst MAX_FRACTION_DIGITS = 6;\nconst FRACTION_UNITS = {\n\t3: \"milliseconds\",\n\t6: \"microseconds\"\n};\nconst SECONDS_PER_DAY = 86400;\nconst MIDNIGHT = {\n\thour: 0,\n\tminute: 0,\n\tsecond: 0,\n\tfraction: \"\"\n};\nfunction refused(message) {\n\tthrow structuredError(\"CONTRACT.CAST_REFUSED\", message, {\n\t\twhy: \"A date or time type stores one form for each value (ADR 254).\",\n\t\tfix: \"Write text the type holds, as the message shows.\"\n\t});\n}\nfunction isLeapYear(year) {\n\treturn year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;\n}\nfunction daysInMonth(year, month) {\n\tif (month === 2) return isLeapYear(year) ? 29 : 28;\n\treturn [\n\t\t4,\n\t\t6,\n\t\t9,\n\t\t11\n\t].includes(month) ? 30 : 31;\n}\n/** Days from 1970-01-01 to a date of the proleptic Gregorian calendar, with year 0 as 1 BC. */\nfunction daysFromCivil({ year, month, day }) {\n\tconst shifted = month <= 2 ? year - 1 : year;\n\tconst era = Math.floor(shifted / 400);\n\tconst yearOfEra = shifted - era * 400;\n\tconst dayOfYear = Math.floor((153 * (month + (month > 2 ? -3 : 9)) + 2) / 5) + day - 1;\n\tconst dayOfEra = yearOfEra * 365 + Math.floor(yearOfEra / 4) - Math.floor(yearOfEra / 100) + dayOfYear;\n\treturn era * 146097 + dayOfEra - 719468;\n}\nfunction civilFromDays(days) {\n\tconst shifted = days + 719468;\n\tconst era = Math.floor(shifted / 146097);\n\tconst dayOfEra = shifted - era * 146097;\n\tconst yearOfEra = Math.floor((dayOfEra - Math.floor(dayOfEra / 1460) + Math.floor(dayOfEra / 36524) - Math.floor(dayOfEra / 146096)) / 365);\n\tconst dayOfYear = dayOfEra - (365 * yearOfEra + Math.floor(yearOfEra / 4) - Math.floor(yearOfEra / 100));\n\tconst monthIndex = Math.floor((5 * dayOfYear + 2) / 153);\n\tconst day = dayOfYear - Math.floor((153 * monthIndex + 2) / 5) + 1;\n\tconst month = monthIndex < 10 ? monthIndex + 3 : monthIndex - 9;\n\treturn {\n\t\tyear: yearOfEra + era * 400 + (month <= 2 ? 1 : 0),\n\t\tmonth,\n\t\tday\n\t};\n}\nfunction pad(value, width = 2) {\n\treturn String(value).padStart(width, \"0\");\n}\nfunction yearText(year) {\n\tif (year >= 0 && year <= 9999) return pad(year, 4);\n\treturn `${year < 0 ? \"-\" : \"+\"}${pad(Math.abs(year), 6)}`;\n}\nfunction dateText(date) {\n\treturn `${yearText(date.year)}-${pad(date.month)}-${pad(date.day)}`;\n}\nfunction timeText(time) {\n\tconst fraction = time.fraction.replace(/0+$/, \"\");\n\treturn `${pad(time.hour)}:${pad(time.minute)}:${pad(time.second)}${fraction === \"\" ? \"\" : `.${fraction}`}`;\n}\nfunction offsetText(seconds) {\n\tif (seconds === 0) return \"Z\";\n\tconst magnitude = Math.abs(seconds);\n\tconst rest = magnitude % 60;\n\treturn `${seconds < 0 ? \"-\" : \"+\"}${pad(Math.floor(magnitude / 3600))}:${pad(Math.floor(magnitude / 60) % 60)}${rest === 0 ? \"\" : `:${pad(rest)}`}`;\n}\n/**\n* The fields of an ISO 8601 date, time, or date and time, or `undefined` when the text is not one.\n* Ranges are checked by the caller, which words the refusal.\n*/\nfunction readWritten(text) {\n\tlet rest = text;\n\tlet date;\n\tlet timeFollows = true;\n\tconst dateMatch = DATE_PREFIX.exec(rest);\n\tif (dateMatch !== null) {\n\t\tconst [whole, yearDigits = \"\", month = \"\", day = \"\"] = dateMatch;\n\t\tif (yearDigits === \"-000000\") return void 0;\n\t\tdate = {\n\t\t\tyear: Number(yearDigits),\n\t\t\tmonth: Number(month),\n\t\t\tday: Number(day)\n\t\t};\n\t\trest = rest.slice(whole.length);\n\t\ttimeFollows = /^[Tt ]/.test(rest);\n\t\tif (timeFollows) rest = rest.slice(1);\n\t}\n\tlet time;\n\tlet fractionDigits = 0;\n\tif (timeFollows) {\n\t\tconst timeMatch = TIME_PREFIX.exec(rest);\n\t\tif (timeMatch === null) return void 0;\n\t\tconst [whole, hour = \"\", minute = \"\", second = \"00\", fraction = \"\"] = timeMatch;\n\t\ttime = {\n\t\t\thour: Number(hour),\n\t\t\tminute: Number(minute),\n\t\t\tsecond: Number(second),\n\t\t\tfraction\n\t\t};\n\t\tfractionDigits = fraction.length;\n\t\trest = rest.slice(whole.length);\n\t}\n\tlet offsetSeconds;\n\tif (rest === \"Z\" || rest === \"z\") offsetSeconds = 0;\n\telse if (rest !== \"\") {\n\t\tconst offset = OFFSET.exec(rest);\n\t\tif (offset === null) return void 0;\n\t\tconst [, sign, hours = \"\", minutes = \"00\", seconds = \"00\"] = offset;\n\t\tif (Number(minutes) > 59 || Number(seconds) > 59) return void 0;\n\t\tconst magnitude = Number(hours) * 3600 + Number(minutes) * 60 + Number(seconds);\n\t\toffsetSeconds = sign === \"-\" ? -magnitude : magnitude;\n\t}\n\treturn {\n\t\tdate,\n\t\ttime,\n\t\toffsetSeconds,\n\t\tfractionDigits\n\t};\n}\nfunction withFraction(example, digits) {\n\treturn example.replace(/(\\d{2}:\\d{2}:\\d{2})/, `$1.${\"123456\".slice(0, digits)}`);\n}\n/** The value with an instant moved to UTC. */\nfunction normalized(written, shape) {\n\tconst clock = written.time ?? MIDNIGHT;\n\tconst offsetSeconds = written.offsetSeconds ?? 0;\n\tif (written.date === void 0 || shape !== \"instant\") return {\n\t\tdate: written.date,\n\t\ttime: clock,\n\t\toffsetSeconds\n\t};\n\tconst utc = daysFromCivil(written.date) * SECONDS_PER_DAY + clock.hour * 3600 + clock.minute * 60 + clock.second - offsetSeconds;\n\tconst days = Math.floor(utc / SECONDS_PER_DAY);\n\tconst secondOfDay = utc - days * SECONDS_PER_DAY;\n\treturn {\n\t\tdate: civilFromDays(days),\n\t\ttime: {\n\t\t\thour: Math.floor(secondOfDay / 3600),\n\t\t\tminute: Math.floor(secondOfDay / 60) % 60,\n\t\t\tsecond: secondOfDay % 60,\n\t\t\tfraction: clock.fraction\n\t\t},\n\t\toffsetSeconds: 0\n\t};\n}\nfunction position(value) {\n\tconst { time } = value;\n\treturn [\n\t\tvalue.date === void 0 ? 0 : daysFromCivil(value.date),\n\t\ttime.hour * 3600 + time.minute * 60 + time.second,\n\t\ttime.fraction.padEnd(MAX_FRACTION_DIGITS, \"0\")\n\t];\n}\nfunction isBefore(left, right) {\n\tif (left[0] !== right[0]) return left[0] < right[0];\n\tif (left[1] !== right[1]) return left[1] < right[1];\n\treturn left[2] < right[2];\n}\nfunction printed(value, shape) {\n\tconst { date, time, offsetSeconds } = value;\n\tif (date === void 0) return shape === \"timeWithOffset\" ? `${timeText(time)}${offsetText(offsetSeconds)}` : timeText(time);\n\tif (shape === \"date\") return dateText(date);\n\tif (shape === \"dateTime\") return `${dateText(date)}T${timeText(time)}`;\n\treturn `${dateText(date)}T${timeText(time)}Z`;\n}\n/** The position of a range bound, which the data type declares in stored form. */\nfunction boundPosition(text, shape) {\n\tconst written = readWritten(text);\n\tif (written === void 0) throw new InternalError(`The range bound \"${text}\" is not in its stored form.`);\n\treturn position(normalized(written, shape));\n}\n/**\n* The stored form of written date or time text, or a refusal with a message that says what is\n* wrong and shows text the type holds. `written` is the text as its author wrote it, which the\n* message shows, when a target rewrote it into ISO 8601 before calling this.\n*/\nfunction dateTimeStoredText(text, options, written = text) {\n\tconst shape = SHAPES[options.shape];\n\tconst { ownerId: id } = options;\n\tconst parts = readWritten(text);\n\tif (parts === void 0) refused(`${id} cannot read \"${written}\". Write ${shape.description}, as in \"${shape.example}\".`);\n\tif (parts.date !== void 0 && !shape.date) refused(`${id} holds a time of day without a date, but \"${written}\" has a date. Write the time alone, as in \"${shape.example}\".`);\n\tif (parts.date === void 0 && shape.date) refused(shape.time ? `${id} holds ${shape.description}, but \"${written}\" has no date. Write the date too, as in \"${shape.example}\".` : `${id} holds a date, and \"${written}\" is a time of day. Write a date, as in \"${shape.example}\".`);\n\tif (parts.time !== void 0 && !shape.time) refused(`${id} holds a date without a time of day, but \"${written}\" has a time. Write the date alone, as in \"${shape.example}\".`);\n\tif (parts.time === void 0 && shape.offset) refused(`${id} holds ${shape.description}, but \"${written}\" has no time of day. Write the time too, as in \"${shape.example}\".`);\n\tif (parts.offsetSeconds !== void 0 && !shape.offset) refused(`${id} holds no UTC offset, but \"${written}\" has one. Leave it out, as in \"${shape.example}\".`);\n\tif (parts.offsetSeconds === void 0 && shape.offset) refused(`${id} needs a UTC offset, but \"${written}\" has none. Add Z for UTC or an offset such as +02:00, as in \"${shape.example}\".`);\n\tconst maxFractionDigits = options.maxFractionDigits ?? MAX_FRACTION_DIGITS;\n\tif (parts.fractionDigits > maxFractionDigits) refused(`\"${written}\" has ${parts.fractionDigits} digits after the decimal point, but ${id} holds ${FRACTION_UNITS[maxFractionDigits]}, so at most ${maxFractionDigits}. Round it, as in \"${withFraction(shape.example, maxFractionDigits)}\".`);\n\tconst { date, time } = parts;\n\tif (date !== void 0 && (date.month < 1 || date.month > 12 || date.day < 1 || date.day > daysInMonth(date.year, date.month))) refused(`\"${written}\" is not a date that exists. Write a real date, as in \"${shape.example}\".`);\n\tif (time !== void 0 && (time.hour > 23 || time.minute > 59 || time.second > 59)) refused(`\"${written}\" is not a time of day that exists: hours run from 00 to 23, and minutes and seconds from 00 to 59. Write one, as in \"${shape.example}\".`);\n\tconst offsetLimit = options.maxOffsetHours ?? 23;\n\tif (parts.offsetSeconds !== void 0 && Math.abs(parts.offsetSeconds) >= (offsetLimit + 1) * 3600) refused(`\"${written}\" has a UTC offset outside -${pad(offsetLimit)}:59 to +${pad(offsetLimit)}:59, which ${id} does not hold. Write a smaller offset, as in \"${shape.example}\".`);\n\tconst value = normalized(parts, options.shape);\n\tconst { range } = options;\n\tif (range !== void 0) {\n\t\tconst at = position(value);\n\t\tif (isBefore(at, boundPosition(range.earliest, options.shape)) || isBefore(boundPosition(range.latest, options.shape), at)) refused(`${id} holds ${shape.plural} from ${range.earliest} to ${range.latest}, and \"${written}\" is outside them.`);\n\t}\n\treturn printed(value, options.shape);\n}\n//#endregion\nexport { createNumberClassifier, dateTimeStoredText, escapePslString, isNumeralText, parseJsonText, printJsonText, signedRange, storedNumeralText };\n\n//# sourceMappingURL=data-type-support.mjs.map"],"mappings":";;;;AAIA,MAAM,uBAAuB;AAC7B,MAAM,uBAAuB;AAC7B,MAAM,kBAAkB;;AAExB,SAAS,cAAc,MAAM;CAC5B,OAAO,qBAAqB,KAAK,IAAI,KAAK,qBAAqB,KAAK,IAAI;AACzE;;;;;AAKA,SAAS,kBAAkB,MAAM;CAChC,MAAM,UAAU,gBAAgB,KAAK,IAAI;CACzC,IAAI,YAAY,MAAM,OAAO;CAC7B,MAAM,GAAG,OAAO,IAAI,QAAQ,IAAI,WAAW,MAAM;CACjD,MAAM,SAAS,GAAG,QAAQ;CAC1B,OAAO,SAAS,OAAO,UAAU,KAAK,MAAM,IAAI,SAAS,IAAI;AAC9D;;AAEA,SAAS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AM,OAAO,QAAQ,MAAM,SAAS,MAAM,MAAM,OAAO,SAAS,QAAQ,mBAAmB;CAC/O;CACA,OAAO,QAAQ,OAAO,QAAQ,KAAK;AACpC"}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { DataTypeId } from "@prisma/orm-framework/components/codec";
|
|
2
|
-
import { JsonValue } from "@prisma/orm-framework/contract/types";
|
|
3
|
-
//#region ../../../2-sql/1-core/contract/dist/data-type-support.d.mts
|
|
4
|
-
//#region src/data-type-support.d.ts
|
|
5
|
-
/** Whether `text` is a whole number or a decimal as a contract source writes one. */
|
|
6
|
-
declare function isNumeralText(text: string): boolean;
|
|
7
|
-
/**
|
|
8
|
-
* A written numeral as the contract stores it. Leading zeros and the sign of zero never change a
|
|
9
|
-
* number, so they go; trailing zeros stay, because a type without a scale keeps them.
|
|
10
|
-
*/
|
|
11
|
-
declare function storedNumeralText(text: string): string;
|
|
12
|
-
/** A string as a contract source writes it, with the escapes its string reader resolves. */
|
|
13
|
-
declare function escapePslString(value: string): string;
|
|
14
|
-
/** Which data type a written number is, and whether that type stores it as a number or as text. */
|
|
15
|
-
interface NumberClassification {
|
|
16
|
-
readonly type: DataTypeId;
|
|
17
|
-
readonly form: 'number' | 'text';
|
|
18
|
-
}
|
|
19
|
-
/** One integer type and the range of whole numbers it holds. */
|
|
20
|
-
interface IntegerStep extends NumberClassification {
|
|
21
|
-
readonly min: bigint;
|
|
22
|
-
readonly max: bigint;
|
|
23
|
-
}
|
|
24
|
-
/** The range of a signed integer of `bits` bits. */
|
|
25
|
-
declare function signedRange(bits: number): {
|
|
26
|
-
readonly min: bigint;
|
|
27
|
-
readonly max: bigint;
|
|
28
|
-
};
|
|
29
|
-
interface NumberClassifierSpec {
|
|
30
|
-
/** Tried in order; the first whose range holds the digits wins. */
|
|
31
|
-
readonly integers: readonly IntegerStep[];
|
|
32
|
-
/** A whole number no step holds. Absent means the target has no type for it. */
|
|
33
|
-
readonly largerWhole?: NumberClassification | undefined;
|
|
34
|
-
/** A number with a fraction. Absent means the target has no type for it. */
|
|
35
|
-
readonly fraction?: NumberClassification | undefined;
|
|
36
|
-
/** `NaN`, `Infinity` and `-Infinity`. Absent means the target has no type for them. */
|
|
37
|
-
readonly words?: NumberClassification | undefined;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* The classifier one target's plain-number authoring entry carries: it reads the digits and says
|
|
41
|
-
* which of the target's types the value is, in that type's stored form. `undefined` means no
|
|
42
|
-
* type of this target holds the number.
|
|
43
|
-
*/
|
|
44
|
-
declare function createNumberClassifier(spec: NumberClassifierSpec): (text: string) => {
|
|
45
|
-
readonly type: DataTypeId;
|
|
46
|
-
readonly value: JsonValue;
|
|
47
|
-
} | undefined;
|
|
48
|
-
/**
|
|
49
|
-
* Read JSON text into the document it holds.
|
|
50
|
-
*
|
|
51
|
-
* `JSON.parse` reads a numeral too large for a double as `Infinity`, and `JSON.stringify` writes
|
|
52
|
-
* that back as `null`, so a document holding one would not be the document stored; it is refused
|
|
53
|
-
* here instead, naming where the number is.
|
|
54
|
-
*/
|
|
55
|
-
declare function parseJsonText(text: string): JsonValue;
|
|
56
|
-
/** Write a document as the text of a JSON literal. */
|
|
57
|
-
declare function printJsonText(value: JsonValue): string;
|
|
58
|
-
//#endregion
|
|
59
|
-
//#region src/date-time-stored-form.d.ts
|
|
60
|
-
/**
|
|
61
|
-
* The reader the SQL targets build the stored form of each date and time type with; ADR 254
|
|
62
|
-
* states the forms and the text it reads.
|
|
63
|
-
*/
|
|
64
|
-
/** What a date or time type holds, which decides the text it reads and writes. */
|
|
65
|
-
type DateTimeShape = 'date' | 'time' | 'timeWithOffset' | 'dateTime' | 'instant';
|
|
66
|
-
interface DateTimeStoredTextOptions {
|
|
67
|
-
readonly shape: DateTimeShape;
|
|
68
|
-
/** The id of the data type or codec that declares this stored form, which messages name. */
|
|
69
|
-
readonly ownerId: string;
|
|
70
|
-
/** The largest UTC offset the type holds, in hours. Defaults to 23. */
|
|
71
|
-
readonly maxOffsetHours?: number;
|
|
72
|
-
/** The most digits after the decimal point the type holds. Defaults to 6, microseconds. */
|
|
73
|
-
readonly maxFractionDigits?: 3 | 6;
|
|
74
|
-
/** The earliest and latest values the type holds, each in stored form. */
|
|
75
|
-
readonly range?: {
|
|
76
|
-
readonly earliest: string;
|
|
77
|
-
readonly latest: string;
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* The stored form of written date or time text, or a refusal with a message that says what is
|
|
82
|
-
* wrong and shows text the type holds. `written` is the text as its author wrote it, which the
|
|
83
|
-
* message shows, when a target rewrote it into ISO 8601 before calling this.
|
|
84
|
-
*/
|
|
85
|
-
declare function dateTimeStoredText(text: string, options: DateTimeStoredTextOptions, written?: string): string;
|
|
86
|
-
//#endregion
|
|
87
|
-
export { NumberClassifierSpec as a, escapePslString as c, printJsonText as d, signedRange as f, NumberClassification as i, isNumeralText as l, DateTimeStoredTextOptions as n, createNumberClassifier as o, storedNumeralText as p, IntegerStep as r, dateTimeStoredText as s, DateTimeShape as t, parseJsonText as u };
|
|
88
|
-
//# sourceMappingURL=data-type-support-CBcYhSkD.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"data-type-support-CBcYhSkD.d.mts","names":[],"sources":["../../../../2-sql/1-core/contract/dist/data-type-support.d.mts"],"mappings":";;;;;iBAIiB,cAAc;;;;;iBAKd,kBAAkB;;iBAElB,gBAAgB;;UAEvB;WACC,MAAM;WACN;;;UAGD,oBAAoB;WACnB;WACA;;;iBAGM,YAAY;WAClB;WACA;;UAED;;WAEC,mBAAmB;;WAEnB,cAAc;;WAEd,WAAW;;WAEX,QAAQ;;;;;;;iBAOF,uBAAuB,MAAM,wBAAwB;WAC3D,MAAM;WACN,OAAO;;;;;;;;;iBASD,cAAc,eAAe;;iBAE7B,cAAc,OAAO;;;;;;;;KAQjC;UACK;WACC,OAAO;;WAEP;;WAEA;;WAEA;;WAEA;aACE;aACA;;;;;;;;iBAQI,mBAAmB,cAAc,SAAS,2BAA2B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generator-functions-DuDZSQHE-Dl5EP61A.mjs","names":[],"sources":["../../../../2-sql/9-family/dist/generator-functions-DuDZSQHE.mjs"],"sourcesContent":["import { readEnumBlockMembers, resolveEnumCodecId } from \"@internal/framework-components/authoring\";\nimport { enumRefusalOf, requiredParamKeys } from \"@internal/framework-components/codec\";\nimport { blockAttribute, dataTypeValue, enumMemberValue, leafDiagnostic, mapBlock, optional, refineArg, str } from \"@internal/psl-parser\";\nimport { enumType } from \"@internal/sql-contract-ts/contract-builder\";\nimport { CUID_VERSION, NANOID_SIZE, UUID_VERSIONS, generatedLength } from \"@internal/ids\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { InternalError } from \"@internal/utils/internal-error\";\nimport { singleGeneratorBinding } from \"@internal/framework-components/components\";\nimport { SQL_CHAR_CODEC_ID, SQL_TEXT_CODEC_ID, SQL_VARCHAR_CODEC_ID } from \"@internal/sql-relational-core/ast\";\nimport { notOk, ok } from \"@internal/utils/result\";\n//#region src/core/authoring-entity-types.ts\nfunction sqlFamilyEnumSpec() {\n\treturn mapBlock({\n\t\tvalue: {\n\t\t\ttype: enumMemberValue(),\n\t\t\tdocumentation: \"The member's value, written as a value of the enum's data type; a bare member stores its own name.\"\n\t\t},\n\t\tallowBare: true\n\t});\n}\nconst sqlFamilyEntityTypes = { enum: {\n\tkind: \"entity\",\n\tdiscriminator: \"enum\",\n\toutput: { factory: (block, ctx) => {\n\t\tconst sourceId = ctx.sourceId ?? \"unknown\";\n\t\tconst diagnostics = ctx.diagnostics;\n\t\tconst resolved = resolveEnumCodecId(block, ctx);\n\t\tif (resolved === void 0) return;\n\t\tconst { codecId, codecSpan } = resolved;\n\t\tconst descriptor = ctx.codecLookup.descriptorFor(codecId);\n\t\tconst codec = ctx.codecLookup.get(codecId);\n\t\tif (descriptor === void 0 || codec === void 0) {\n\t\t\tdiagnostics?.push({\n\t\t\t\tcode: \"PSL_EXTENSION_INVALID_VALUE\",\n\t\t\t\tmessage: `enum \"${block.name}\" @@type references unknown codec \"${codecId}\"`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: codecSpan\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst enumRefusal = enumRefusalOf(descriptor);\n\t\tif (enumRefusal !== void 0) {\n\t\t\tdiagnostics?.push({\n\t\t\t\tcode: \"PSL_EXTENSION_INVALID_VALUE\",\n\t\t\t\tmessage: `enum \"${block.name}\" cannot use the codec \"${codecId}\". ${enumRefusal}`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: codecSpan\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst dataType = ctx.dataTypeLookup.get(descriptor.dataType);\n\t\tif (dataType === void 0) {\n\t\t\tdiagnostics?.push({\n\t\t\t\tcode: \"PSL_EXTENSION_INVALID_VALUE\",\n\t\t\t\tmessage: `enum \"${block.name}\" @@type codec \"${codecId}\" represents data type \"${descriptor.dataType}\", which no component registers`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: codecSpan\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst [requiredParam] = requiredParamKeys(dataType);\n\t\tif (requiredParam !== void 0) {\n\t\t\tdiagnostics?.push({\n\t\t\t\tcode: \"PSL_ENUM_TYPE_NEEDS_PARAMETERS\",\n\t\t\t\tmessage: `enum \"${block.name}\" @@type codec \"${codecId}\" represents data type \"${dataType.id}\", which requires the parameter \"${requiredParam}\"; an enum block gives it none`,\n\t\t\t\tsourceId,\n\t\t\t\tspan: codecSpan\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tconst members = readEnumBlockMembers(block, codecId, codec, ctx);\n\t\tif (members === void 0) return void 0;\n\t\treturn enumType(block.name, { codecId }, ...members);\n\t} }\n} };\nconst enumTypeBlockAttribute = blockAttribute(\"type\", {\n\tdocumentation: \"Selects the storage codec for this enum.\",\n\tpositional: [{\n\t\tkey: \"codecId\",\n\t\ttype: str(),\n\t\tdocumentation: \"The fully qualified codec identifier used to store enum values.\"\n\t}]\n});\nconst sqlFamilyPslBlockDescriptors = { enum: {\n\tkind: \"pslBlock\",\n\tkeyword: \"enum\",\n\tdocumentation: \"Defines an enum with named values and an inferred or explicitly selected storage codec.\",\n\tdiscriminator: \"enum\",\n\tname: { required: true },\n\tspec: sqlFamilyEnumSpec,\n\tattributes: { type: () => enumTypeBlockAttribute }\n} };\n//#endregion\n//#region src/core/authoring-field-presets.ts\n/**\n* Family-level SQL authoring field presets.\n*\n* Only presets whose codec IDs align with the ID generator metadata live here\n* (see `@internal/ids`). These presets are target-agnostic because the\n* generator metadata fixes their codec/native-type to `sql/char@1`\n* (`character`) regardless of target, and the PSL interpreter lets the\n* generator override the scalar descriptor.\n*\n* The `uuidString` / `id.uuidv4String` / `id.uuidv7String` presets store UUID\n* values as `character(36)` — portable across all SQL targets. For a native\n* Postgres `uuid` column use `uuidNative` / `id.uuidv4Native` /\n* `id.uuidv7Native` from `@internal/target-postgres`.\n*\n* Scalar presets that map to target-specific codecs (e.g. `text`, `int`,\n* `boolean`, `dateTime`) are contributed by the target pack (see\n* `postgresAuthoringFieldPresets` in `@internal/target-postgres`) so the\n* TS callback surface and the PSL scalar surface lower to byte-identical\n* contracts for the active target.\n*/\nconst CHARACTER_CODEC_ID = \"sql/char@1\";\nconst nanoidOptionsArgument = {\n\tkind: \"object\",\n\toptional: true,\n\tproperties: { size: {\n\t\tkind: \"number\",\n\t\toptional: true,\n\t\tinteger: true,\n\t\tminimum: NANOID_SIZE.min,\n\t\tmaximum: NANOID_SIZE.max\n\t} }\n};\nconst sqlFamilyAuthoringFieldPresets = {\n\tuuidString: {\n\t\tkind: \"fieldPreset\",\n\t\toutput: {\n\t\t\tcodecId: CHARACTER_CODEC_ID,\n\t\t\ttypeParams: { length: 36 }\n\t\t}\n\t},\n\tulid: {\n\t\tkind: \"fieldPreset\",\n\t\toutput: {\n\t\t\tcodecId: CHARACTER_CODEC_ID,\n\t\t\ttypeParams: { length: 26 }\n\t\t}\n\t},\n\tnanoid: {\n\t\tkind: \"fieldPreset\",\n\t\targs: [nanoidOptionsArgument],\n\t\toutput: {\n\t\t\tcodecId: CHARACTER_CODEC_ID,\n\t\t\ttypeParams: { length: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0,\n\t\t\t\tpath: [\"size\"],\n\t\t\t\tdefault: 21\n\t\t\t} }\n\t\t}\n\t},\n\tcuid2: {\n\t\tkind: \"fieldPreset\",\n\t\toutput: {\n\t\t\tcodecId: CHARACTER_CODEC_ID,\n\t\t\ttypeParams: { length: 24 }\n\t\t}\n\t},\n\tksuid: {\n\t\tkind: \"fieldPreset\",\n\t\toutput: {\n\t\t\tcodecId: CHARACTER_CODEC_ID,\n\t\t\ttypeParams: { length: 27 }\n\t\t}\n\t},\n\tid: {\n\t\tuuidv4String: {\n\t\t\tkind: \"fieldPreset\",\n\t\t\toutput: {\n\t\t\t\tcodecId: CHARACTER_CODEC_ID,\n\t\t\t\ttypeParams: { length: 36 },\n\t\t\t\texecutionDefaults: { onCreate: {\n\t\t\t\t\tkind: \"generator\",\n\t\t\t\t\tid: \"uuidv4\"\n\t\t\t\t} },\n\t\t\t\tid: true\n\t\t\t}\n\t\t},\n\t\tuuidv7String: {\n\t\t\tkind: \"fieldPreset\",\n\t\t\toutput: {\n\t\t\t\tcodecId: CHARACTER_CODEC_ID,\n\t\t\t\ttypeParams: { length: 36 },\n\t\t\t\texecutionDefaults: { onCreate: {\n\t\t\t\t\tkind: \"generator\",\n\t\t\t\t\tid: \"uuidv7\"\n\t\t\t\t} },\n\t\t\t\tid: true\n\t\t\t}\n\t\t},\n\t\tulid: {\n\t\t\tkind: \"fieldPreset\",\n\t\t\toutput: {\n\t\t\t\tcodecId: CHARACTER_CODEC_ID,\n\t\t\t\ttypeParams: { length: 26 },\n\t\t\t\texecutionDefaults: { onCreate: {\n\t\t\t\t\tkind: \"generator\",\n\t\t\t\t\tid: \"ulid\"\n\t\t\t\t} },\n\t\t\t\tid: true\n\t\t\t}\n\t\t},\n\t\tnanoid: {\n\t\t\tkind: \"fieldPreset\",\n\t\t\targs: [nanoidOptionsArgument],\n\t\t\toutput: {\n\t\t\t\tcodecId: CHARACTER_CODEC_ID,\n\t\t\t\ttypeParams: { length: {\n\t\t\t\t\tkind: \"arg\",\n\t\t\t\t\tindex: 0,\n\t\t\t\t\tpath: [\"size\"],\n\t\t\t\t\tdefault: 21\n\t\t\t\t} },\n\t\t\t\texecutionDefaults: { onCreate: {\n\t\t\t\t\tkind: \"generator\",\n\t\t\t\t\tid: \"nanoid\",\n\t\t\t\t\tparams: { size: {\n\t\t\t\t\t\tkind: \"arg\",\n\t\t\t\t\t\tindex: 0,\n\t\t\t\t\t\tpath: [\"size\"]\n\t\t\t\t\t} }\n\t\t\t\t} },\n\t\t\t\tid: true\n\t\t\t}\n\t\t},\n\t\tcuid2: {\n\t\t\tkind: \"fieldPreset\",\n\t\t\toutput: {\n\t\t\t\tcodecId: CHARACTER_CODEC_ID,\n\t\t\t\ttypeParams: { length: 24 },\n\t\t\t\texecutionDefaults: { onCreate: {\n\t\t\t\t\tkind: \"generator\",\n\t\t\t\t\tid: \"cuid2\"\n\t\t\t\t} },\n\t\t\t\tid: true\n\t\t\t}\n\t\t},\n\t\tksuid: {\n\t\t\tkind: \"fieldPreset\",\n\t\t\toutput: {\n\t\t\t\tcodecId: CHARACTER_CODEC_ID,\n\t\t\t\ttypeParams: { length: 27 },\n\t\t\t\texecutionDefaults: { onCreate: {\n\t\t\t\t\tkind: \"generator\",\n\t\t\t\t\tid: \"ksuid\"\n\t\t\t\t} },\n\t\t\t\tid: true\n\t\t\t}\n\t\t}\n\t}\n};\n//#endregion\n//#region src/core/authoring-type-constructors.ts\nconst sqlFamilyAuthoringTypes = { Raw: {\n\tkind: \"typeConstructor\",\n\tdocumentation: \"A column of a type no other column type covers, written exactly as the database catalog prints it, such as Raw(sql`tsvector`). Its values are typed unknown, and its default is a sql expression.\",\n\targs: [{\n\t\tkind: \"value\",\n\t\tdataType: \"sql/expression\",\n\t\tname: \"sql\"\n\t}],\n\toutput: {\n\t\tcodecId: \"sql/raw@1\",\n\t\ttypeParams: { sql: {\n\t\t\tkind: \"arg\",\n\t\t\tindex: 0\n\t\t} }\n\t}\n} };\n/**\n* The type constructors every SQL target contributes itself, because their arguments are sizes, such as a length, and only the target names the data type a size is a value of: `sizeType`, such as `pg/int4`.\n*/\nfunction sqlTargetTypeConstructors(input) {\n\treturn { sql: { String: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"Variable-length text with a required maximum character length.\",\n\t\targs: [{\n\t\t\tkind: \"value\",\n\t\t\tdataType: input.sizeType,\n\t\t\tname: \"length\"\n\t\t}],\n\t\toutput: {\n\t\t\tcodecId: \"sql/varchar@1\",\n\t\t\ttypeParams: { length: {\n\t\t\t\tkind: \"arg\",\n\t\t\t\tindex: 0\n\t\t\t} }\n\t\t}\n\t} } };\n}\n//#endregion\n//#region src/core/generator-functions.ts\nconst NANOID_DEFAULT_SIZE = 21;\nconst nowSignature = { documentation: \"Writes the current time, as the column's codec represents it.\" };\nconst ulidSignature = { documentation: \"Generates a ULID when a value is not supplied.\" };\nconst ksuidSignature = { documentation: \"Generates a KSUID when a value is not supplied.\" };\nfunction refused(message) {\n\treturn {\n\t\tok: false,\n\t\tmessage\n\t};\n}\nfunction generated(id, params) {\n\treturn {\n\t\tok: true,\n\t\tgenerator: params === void 0 ? {\n\t\t\tkind: \"generator\",\n\t\t\tid\n\t\t} : {\n\t\t\tkind: \"generator\",\n\t\t\tid,\n\t\t\tparams\n\t\t}\n\t};\n}\nfunction uuidBinding(codecIds) {\n\treturn {\n\t\tcodecIds,\n\t\tgeneratorIds: [\"uuidv4\", \"uuidv7\"],\n\t\tresolve: ({ args }) => {\n\t\t\tconst version = args[\"version\"];\n\t\t\tif (version === void 0 || version === UUID_VERSIONS.v4) return generated(\"uuidv4\");\n\t\t\tif (version === UUID_VERSIONS.v7) return generated(\"uuidv7\");\n\t\t\treturn refused(`uuid: version must be ${UUID_VERSIONS.v4} or ${UUID_VERSIONS.v7}, got ${String(version)}`);\n\t\t},\n\t\tprintArguments: (generator) => {\n\t\t\tif (generator.id === \"uuidv4\") return {\n\t\t\t\targs: {},\n\t\t\t\ttext: \"\"\n\t\t\t};\n\t\t\tif (generator.id === \"uuidv7\") return {\n\t\t\t\targs: { version: UUID_VERSIONS.v7 },\n\t\t\t\ttext: String(UUID_VERSIONS.v7)\n\t\t\t};\n\t\t}\n\t};\n}\nfunction cuidBinding(codecIds) {\n\treturn {\n\t\tcodecIds,\n\t\tgeneratorIds: [\"cuid2\"],\n\t\tresolve: ({ args }) => {\n\t\t\tconst version = args[\"version\"];\n\t\t\treturn version === CUID_VERSION ? generated(\"cuid2\") : refused(`cuid: version must be ${CUID_VERSION}, got ${String(version)}`);\n\t\t},\n\t\tprintArguments: (generator) => generator.id === \"cuid2\" ? {\n\t\t\targs: { version: CUID_VERSION },\n\t\t\ttext: String(CUID_VERSION)\n\t\t} : void 0\n\t};\n}\nfunction isNanoidSize(size) {\n\treturn typeof size === \"number\" && Number.isInteger(size) && size >= NANOID_SIZE.min && size <= NANOID_SIZE.max;\n}\n/**\n* A Nano ID has the size the call gives, or 21; the column's length never sets it. A shorter identifier in a fixed-length column is padded by the database, as Prisma 7 does.\n*/\nfunction nanoidBinding(codecIds) {\n\treturn {\n\t\tcodecIds,\n\t\tgeneratorIds: [\"nanoid\"],\n\t\tresolve: ({ args }) => {\n\t\t\tconst explicit = args[\"size\"];\n\t\t\tif (explicit !== void 0 && !isNanoidSize(explicit)) return refused(`nanoid: size must be between ${NANOID_SIZE.min} and ${NANOID_SIZE.max}, got ${String(explicit)}`);\n\t\t\treturn explicit === void 0 ? generated(\"nanoid\") : generated(\"nanoid\", { size: explicit });\n\t\t},\n\t\tprintArguments: (generator) => {\n\t\t\tif (generator.id !== \"nanoid\") return void 0;\n\t\t\tconst size = generator.params?.[\"size\"];\n\t\t\treturn typeof size === \"number\" ? {\n\t\t\t\targs: { size },\n\t\t\t\ttext: String(size)\n\t\t\t} : {\n\t\t\t\targs: {},\n\t\t\t\ttext: \"\"\n\t\t\t};\n\t\t}\n\t};\n}\n/**\n* `binding`, refusing a column whose length, in its data type's normal form, is shorter than the identifier the generator writes. The database would refuse every insert of a longer value.\n*/\nfunction fittingColumn(name, binding) {\n\treturn {\n\t\t...binding,\n\t\tresolve: (input) => {\n\t\t\tconst resolution = binding.resolve(input);\n\t\t\tconst length = input.field.length;\n\t\t\tif (!resolution.ok || length === void 0) return resolution;\n\t\t\tconst { generator } = resolution;\n\t\t\tconst written = generatedLength(blindCast(generator.id), generator.params);\n\t\t\tif (written <= length) return resolution;\n\t\t\treturn refused(`${`${name}(${binding.printArguments(generator, input.field)?.text ?? \"\"})`} writes ${written} characters, which does not fit a column of ${length} ${length === 1 ? \"character\" : \"characters\"}.`);\n\t\t}\n\t};\n}\n/** The identifier generator functions bound to a target's text codecs, and `uuid` to its uuid codecs. Each refuses a column too short for what it writes. */\nfunction idGeneratorFunctionBindings(codecs) {\n\tconst { text } = codecs;\n\treturn [\n\t\t{\n\t\t\tname: \"uuid\",\n\t\t\tbindings: [fittingColumn(\"uuid\", uuidBinding([...text, ...codecs.uuid ?? []]))]\n\t\t},\n\t\t{\n\t\t\tname: \"cuid\",\n\t\t\tbindings: [fittingColumn(\"cuid\", cuidBinding(text))]\n\t\t},\n\t\t{\n\t\t\tname: \"ulid\",\n\t\t\tbindings: [fittingColumn(\"ulid\", singleGeneratorBinding({\n\t\t\t\tcodecIds: text,\n\t\t\t\tgeneratorId: \"ulid\"\n\t\t\t}))]\n\t\t},\n\t\t{\n\t\t\tname: \"ksuid\",\n\t\t\tbindings: [fittingColumn(\"ksuid\", singleGeneratorBinding({\n\t\t\t\tcodecIds: text,\n\t\t\t\tgeneratorId: \"ksuid\"\n\t\t\t}))]\n\t\t},\n\t\t{\n\t\t\tname: \"nanoid\",\n\t\t\tbindings: [fittingColumn(\"nanoid\", nanoidBinding(text))]\n\t\t}\n\t];\n}\nconst familyIdBindings = idGeneratorFunctionBindings({ text: [\n\tSQL_CHAR_CODEC_ID,\n\tSQL_VARCHAR_CODEC_ID,\n\tSQL_TEXT_CODEC_ID\n] });\nfunction familyBindingsOf(name) {\n\treturn familyIdBindings.find((contribution) => contribution.name === name)?.bindings ?? [];\n}\n/** The generator functions the SQL family declares, with their bindings to the family's codecs. Targets bind `now` and their own codecs. */\nconst sqlFamilyGeneratorFunctions = [\n\t{\n\t\tname: \"now\",\n\t\tsignature: nowSignature,\n\t\tbindings: []\n\t},\n\t{\n\t\tname: \"uuid\",\n\t\tbindings: familyBindingsOf(\"uuid\")\n\t},\n\t{\n\t\tname: \"cuid\",\n\t\tbindings: familyBindingsOf(\"cuid\")\n\t},\n\t{\n\t\tname: \"ulid\",\n\t\tsignature: ulidSignature,\n\t\tbindings: familyBindingsOf(\"ulid\")\n\t},\n\t{\n\t\tname: \"nanoid\",\n\t\tbindings: familyBindingsOf(\"nanoid\")\n\t},\n\t{\n\t\tname: \"ksuid\",\n\t\tsignature: ksuidSignature,\n\t\tbindings: familyBindingsOf(\"ksuid\")\n\t}\n];\n/** The identifier generators the family's bindings produce, which the family registers so that a target binding them through `idGeneratorFunctionBindings` registers none. */\nconst sqlFamilyGeneratorDescriptors = [...new Set(sqlFamilyGeneratorFunctions.flatMap(({ bindings }) => bindings.flatMap(({ generatorIds }) => generatorIds)))].map((id) => ({ id }));\n/**\n* The generator functions whose arguments are integers, declared with their signatures: `uuid(version?)`, `cuid(version)` and `nanoid(size?)`. Each argument is a value of `integer`, the target's integer data type, read and cast like a default, then checked by its function. A target declares them, because only it knows its integer type; the family and the target bind them.\n*/\nfunction sqlIntegerArgumentGeneratorFunctions({ integer }) {\n\treturn [\n\t\t{\n\t\t\tname: \"uuid\",\n\t\t\tsignature: (dataTypes) => uuidSignature(integer, dataTypes),\n\t\t\tbindings: []\n\t\t},\n\t\t{\n\t\t\tname: \"cuid\",\n\t\t\tsignature: (dataTypes) => cuidSignature(integer, dataTypes),\n\t\t\tbindings: []\n\t\t},\n\t\t{\n\t\t\tname: \"nanoid\",\n\t\t\tsignature: (dataTypes) => nanoidSignature(integer, dataTypes),\n\t\t\tbindings: []\n\t\t}\n\t];\n}\nfunction uuidSignature(integer, dataTypes) {\n\tconst versions = [UUID_VERSIONS.v4, UUID_VERSIONS.v7];\n\treturn {\n\t\tdocumentation: \"Generates a UUID when a value is not supplied.\",\n\t\tpositional: [{\n\t\t\tkey: \"version\",\n\t\t\ttype: optional(checkedInteger(integer, dataTypes, listed(versions), (version, written) => versions.some((allowed) => allowed === version) ? void 0 : `uuid: version must be ${UUID_VERSIONS.v4} or ${UUID_VERSIONS.v7}, got ${written}`)),\n\t\t\tdocumentation: `The UUID version: \\`${UUID_VERSIONS.v4}\\` or \\`${UUID_VERSIONS.v7}\\`. Defaults to \\`${UUID_VERSIONS.v4}\\`.`\n\t\t}]\n\t};\n}\nfunction cuidSignature(integer, dataTypes) {\n\treturn {\n\t\tdocumentation: \"Generates a CUID2 identifier when a value is not supplied.\",\n\t\tpositional: [{\n\t\t\tkey: \"version\",\n\t\t\ttype: checkedInteger(integer, dataTypes, listed([CUID_VERSION]), (version, written) => version === CUID_VERSION ? void 0 : `cuid: version must be ${CUID_VERSION}, got ${written}`),\n\t\t\tdocumentation: `The CUID version. Only \\`${CUID_VERSION}\\` is supported.`\n\t\t}]\n\t};\n}\nfunction nanoidSignature(integer, dataTypes) {\n\treturn {\n\t\tdocumentation: \"Generates a Nano ID when a value is not supplied.\",\n\t\tpositional: [{\n\t\t\tkey: \"size\",\n\t\t\ttype: optional(checkedInteger(integer, dataTypes, {\n\t\t\t\tlabel: `integer from ${NANOID_SIZE.min} to ${NANOID_SIZE.max}`,\n\t\t\t\tsuggestions: []\n\t\t\t}, (size, written) => isNanoidSize(size) ? void 0 : `nanoid: size must be between ${NANOID_SIZE.min} and ${NANOID_SIZE.max}, got ${written}`)),\n\t\t\tdocumentation: `The identifier length, from \\`${NANOID_SIZE.min}\\` through \\`${NANOID_SIZE.max}\\`. Defaults to ${NANOID_DEFAULT_SIZE}.`\n\t\t}]\n\t};\n}\n/** The label and completion suggestions of an argument that takes one of `values`. */\nfunction listed(values) {\n\tconst suggestions = values.map(String);\n\treturn {\n\t\tlabel: suggestions.join(\" | \"),\n\t\tsuggestions\n\t};\n}\n/**\n* One value of the integer data type, as a number, refused at the argument with the function's message when `refusal` returns one.\n*/\nfunction checkedInteger(integer, dataTypes, allowed, refusal) {\n\treturn refineArg(dataTypeValue(integer, dataTypes, allowed), ({ value }, arg, ctx) => {\n\t\tconst stored = value.value;\n\t\tif (typeof stored !== \"number\" && typeof stored !== \"string\") throw new InternalError(`Data type \"${integer}\" stores an integer as ${typeof stored}, not a number or digit text.`);\n\t\tconst message = refusal(Number(stored), String(stored));\n\t\treturn message === void 0 ? ok(blindCast(Number(stored))) : notOk([leafDiagnostic(ctx, arg, message, \"PSL_INVALID_GENERATOR_ARGUMENT\")]);\n\t});\n}\n//#endregion\nexport { sqlFamilyAuthoringTypes as a, sqlFamilyEntityTypes as c, sqlIntegerArgumentGeneratorFunctions as i, sqlFamilyPslBlockDescriptors as l, sqlFamilyGeneratorDescriptors as n, sqlTargetTypeConstructors as o, sqlFamilyGeneratorFunctions as r, sqlFamilyAuthoringFieldPresets as s, idGeneratorFunctionBindings as t };\n\n//# sourceMappingURL=generator-functions-DuDZSQHE.mjs.map"],"mappings":";;;;;;;;;;;AAWA,SAAS,oBAAoB;CAC5B,OAAO,SAAS;EACf,OAAO;GACN,MAAM,gBAAgB;GACtB,eAAe;EAChB;EACA,WAAW;CACZ,CAAC;AACF;AACA,MAAM,uBAAuB,EAAE,MAAM;CACpC,MAAM;CACN,eAAe;CACf,QAAQ,EAAE,UAAU,OAAO,QAAQ;EAClC,MAAM,WAAW,IAAI,YAAY;EACjC,MAAM,cAAc,IAAI;EACxB,MAAM,WAAW,mBAAmB,OAAO,GAAG;EAC9C,IAAI,aAAa,KAAK,GAAG;E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