simetra 0.1.0 → 0.2.0
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/README.md +1 -0
- package/dist/compiler/index.d.ts +843 -207
- package/dist/compiler/index.js +27880 -13611
- package/dist/model/index.d.ts +1580 -258
- package/dist/model/index.js +1031 -164
- package/dist/schema/index.d.ts +473 -272
- package/dist/schema/index.js +2002 -498
- package/dist/server/index.d.ts +103 -0
- package/dist/server/index.js +1503 -0
- package/package.json +15 -9
- package/schemas/catalogs.schema.json +6 -2
- package/schemas/custom-tables.schema.json +53 -2
- package/schemas/project.schema.json +255 -3
package/dist/model/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
//#region src/model/schemas/localized-string.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* Localized string: at least one locale required.
|
|
5
4
|
* BRD: {uk, en} — Ukrainian first, English second.
|
|
@@ -9,8 +8,6 @@ export declare const localizedStringSchema: z.ZodObject<{
|
|
|
9
8
|
en: z.ZodOptional<z.ZodString>;
|
|
10
9
|
}, z.core.$strict>;
|
|
11
10
|
type LocalizedString = z.infer<typeof localizedStringSchema>;
|
|
12
|
-
//#endregion
|
|
13
|
-
//#region src/model/schemas/metadata-kind.d.ts
|
|
14
11
|
/**
|
|
15
12
|
* Перелік видів метаданих — частина форми посилання `MetadataRef`. Поведінка
|
|
16
13
|
* видів живе поруч у T0, у реєстрі видів (`model/kinds`), а не тут: схема
|
|
@@ -31,8 +28,6 @@ export declare const metadataKindSchema: z.ZodEnum<{
|
|
|
31
28
|
Role: "Role";
|
|
32
29
|
}>;
|
|
33
30
|
type MetadataKind = z.infer<typeof metadataKindSchema>;
|
|
34
|
-
//#endregion
|
|
35
|
-
//#region src/model/schemas/metadata-ref.d.ts
|
|
36
31
|
/**
|
|
37
32
|
* Посилання на інший об'єкт метаданих. Чи можна на цей вид посилатися —
|
|
38
33
|
* факт реєстру видів і перевірка стадії 4, а не схеми.
|
|
@@ -54,8 +49,6 @@ export declare const metadataRefSchema: z.ZodObject<{
|
|
|
54
49
|
name: z.ZodString;
|
|
55
50
|
}, z.core.$strict>;
|
|
56
51
|
type MetadataRef = z.infer<typeof metadataRefSchema>;
|
|
57
|
-
//#endregion
|
|
58
|
-
//#region src/model/schemas/attribute.d.ts
|
|
59
52
|
export declare const attributeSchema: z.ZodObject<{
|
|
60
53
|
personalData: z.ZodOptional<z.ZodLiteral<true>>;
|
|
61
54
|
required: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -241,8 +234,6 @@ export declare const catalogAttributeSchema: z.ZodObject<{
|
|
|
241
234
|
}, z.core.$strict>;
|
|
242
235
|
type Attribute = z.infer<typeof attributeSchema>;
|
|
243
236
|
type CatalogAttribute = z.infer<typeof catalogAttributeSchema>;
|
|
244
|
-
//#endregion
|
|
245
|
-
//#region src/model/schemas/pg-schema.d.ts
|
|
246
237
|
/**
|
|
247
238
|
* Схема, яку платформа резервує за собою: у ній живе системний шар
|
|
248
239
|
* (ідентичності, поточний користувач, довідник міток). Застосунок не може
|
|
@@ -255,8 +246,6 @@ export declare const PLATFORM_SCHEMA = "simetra";
|
|
|
255
246
|
* а не повторюють порівняння.
|
|
256
247
|
*/
|
|
257
248
|
export declare const appSchemaNameSchema: z.ZodString;
|
|
258
|
-
//#endregion
|
|
259
|
-
//#region src/model/schemas/tabular-section.d.ts
|
|
260
249
|
/** Таблична частина об'єкта. */
|
|
261
250
|
export declare const tabularSectionSchema: z.ZodObject<{
|
|
262
251
|
id: z.ZodOptional<z.ZodUUID>;
|
|
@@ -371,8 +360,6 @@ export declare const tabularSectionSchema: z.ZodObject<{
|
|
|
371
360
|
}, z.core.$strict>>>;
|
|
372
361
|
}, z.core.$strict>;
|
|
373
362
|
type TabularSection = z.infer<typeof tabularSectionSchema>;
|
|
374
|
-
//#endregion
|
|
375
|
-
//#region src/model/schemas/composite-index.d.ts
|
|
376
363
|
/**
|
|
377
364
|
* Складені індекси об'єкта чи його табличної частини. Назви — логічні імена
|
|
378
365
|
* реквізитів і стандартних реквізитів тієї самої таблиці; носій скоупу
|
|
@@ -387,8 +374,6 @@ export declare const compositeIndexesSchema: z.ZodDefault<z.ZodArray<z.ZodObject
|
|
|
387
374
|
}, z.core.$strict>]>>;
|
|
388
375
|
}, z.core.$strict>>>;
|
|
389
376
|
type CompositeIndexes = z.infer<typeof compositeIndexesSchema>;
|
|
390
|
-
//#endregion
|
|
391
|
-
//#region src/model/schemas/object-header.d.ts
|
|
392
377
|
/**
|
|
393
378
|
* Спільна «шапка» файлу об'єкта метаданих. `kind` кожен вид додає сам як
|
|
394
379
|
* літерал. `id` і `physicalName` опційні у файлі: їх призначає інструментарій
|
|
@@ -426,8 +411,6 @@ export declare const standardAttributeOverridesSchema: z.ZodDefault<z.ZodOptiona
|
|
|
426
411
|
en: z.ZodOptional<z.ZodString>;
|
|
427
412
|
}, z.core.$strict>>;
|
|
428
413
|
}, z.core.$strict>>>>;
|
|
429
|
-
//#endregion
|
|
430
|
-
//#region src/model/schemas/identity.d.ts
|
|
431
414
|
/**
|
|
432
415
|
* Стабільна ідентичність об'єкта чи реквізиту: ім'я можна змінювати, id — ні.
|
|
433
416
|
* Лише нижній регістр (так генерує crypto.randomUUID): id порівнюються як
|
|
@@ -465,8 +448,6 @@ export declare function logicalObjectName(physical: string): string;
|
|
|
465
448
|
* name, in the project's `naming.attributeCase` style.
|
|
466
449
|
*/
|
|
467
450
|
export declare function logicalElementName(physical: string, style: AttributeCase): string;
|
|
468
|
-
//#endregion
|
|
469
|
-
//#region src/model/schemas/value-type.d.ts
|
|
470
451
|
export declare const LOGICAL_TYPES: readonly ["UUID", "String", "Text", "Integer", "SmallInt", "BigInt", "Numeric", "Boolean", "Date", "DateTime", "Bytes", "Json", "Ref"];
|
|
471
452
|
type LogicalType = (typeof LOGICAL_TYPES)[number];
|
|
472
453
|
/** Поля типу, спільні для реквізиту, константи й колонки. */
|
|
@@ -546,6 +527,18 @@ export declare function isScalarDefault(value: DefaultValue): value is string |
|
|
|
546
527
|
* скаляр, порожнє значення й заповнення, однакове для різних рядків.
|
|
547
528
|
*/
|
|
548
529
|
export declare function defaultMayRepeat(value: DefaultValue): boolean;
|
|
530
|
+
/** Канонічна текстова форма uuid з дефісами (регістр байдужий). */
|
|
531
|
+
export declare const UUID_TEXT: RegExp;
|
|
532
|
+
/**
|
|
533
|
+
* Чи значення правильної форми лежить у множині значень типу: інакше знімок
|
|
534
|
+
* містив би `DEFAULT`, який Postgres відхилить або мовчки округлить.
|
|
535
|
+
* Одиночний `Ref` бере логічне ім'я значення перерахування — його існування
|
|
536
|
+
* перевіряє стадія 4.
|
|
537
|
+
*/
|
|
538
|
+
export declare function isWithinType(value: ValueType, raw: DefaultValue): boolean;
|
|
539
|
+
/** Календарний день `YYYY-MM-DD`: `2026-02-30` Postgres відхилить. */
|
|
540
|
+
export declare function isDate(text: string): boolean;
|
|
541
|
+
export declare function isDateTime(text: string): boolean;
|
|
549
542
|
/**
|
|
550
543
|
* Перевірки сумісності параметрів типу; кожне порушення несе код правила.
|
|
551
544
|
* Типове значення перевіряється тут же — для реквізиту й константи одним
|
|
@@ -573,8 +566,6 @@ export declare function defaultViolatesValueChecks(value: ValueType & ValueCheck
|
|
|
573
566
|
required?: boolean;
|
|
574
567
|
defaultValue?: DefaultValue;
|
|
575
568
|
}): boolean;
|
|
576
|
-
//#endregion
|
|
577
|
-
//#region src/model/schemas/rules.d.ts
|
|
578
569
|
/**
|
|
579
570
|
* Коди власних перевірок T0. Кожна перевірка, що не виражається самою схемою
|
|
580
571
|
* Zod, додає issue з `params: { rule }` — так споживачі (стадії валідації,
|
|
@@ -583,13 +574,15 @@ export declare function defaultViolatesValueChecks(value: ValueType & ValueCheck
|
|
|
583
574
|
*/
|
|
584
575
|
export declare const SCHEMA_RULES: readonly ["type.length-required", "type.length-not-allowed", "type.precision-not-allowed", "type.scale-requires-precision", "type.ref-target-required", "type.ref-exclusive", "type.ref-not-allowed", "register.balance-control-type", "customTable.column-type", "customTable.identity-type", "pgEnum.value-duplicate", "scope.name-reserved", "schema.reserved", "scope.not-allowed", "type.cross-scope-not-allowed", "type.default-not-allowed", "type.default-mismatch", "type.default-invalid", "type.default-fill-mismatch", "type.default-empty-mismatch", "type.unique-ignore-case-type", "attribute.unique-within-requires-unique", "attribute.personal-data-required", "type.bound-type", "type.bound-conflict", "type.bound-order", "type.bound-invalid", "type.format-type", "type.pattern-invalid", "posting.parse", "debt.not-canonical"];
|
|
585
576
|
type SchemaRule = (typeof SCHEMA_RULES)[number];
|
|
586
|
-
//#endregion
|
|
587
|
-
//#region src/model/schemas/catalog.d.ts
|
|
588
577
|
/** Довідник. */
|
|
589
578
|
export declare const catalogSchema: z.ZodObject<{
|
|
590
579
|
kind: z.ZodLiteral<"Catalog">;
|
|
591
580
|
kindLabel: z.ZodOptional<z.ZodString>;
|
|
592
|
-
role: z.ZodOptional<z.
|
|
581
|
+
role: z.ZodOptional<z.ZodEnum<{
|
|
582
|
+
users: "users";
|
|
583
|
+
rightsRoles: "rightsRoles";
|
|
584
|
+
roleAssignments: "roleAssignments";
|
|
585
|
+
}>>;
|
|
593
586
|
codeLength: z.ZodDefault<z.ZodNumber>;
|
|
594
587
|
codeType: z.ZodDefault<z.ZodEnum<{
|
|
595
588
|
String: "String";
|
|
@@ -894,8 +887,6 @@ export declare const catalogSchema: z.ZodObject<{
|
|
|
894
887
|
}, z.core.$strict>>;
|
|
895
888
|
}, z.core.$strict>;
|
|
896
889
|
type Catalog = z.infer<typeof catalogSchema>;
|
|
897
|
-
//#endregion
|
|
898
|
-
//#region src/model/schemas/document.d.ts
|
|
899
890
|
/**
|
|
900
891
|
* Один рух документа в регістр (конструктор рухів, спека П2 §7). `fields` —
|
|
901
892
|
* плаский словник «поле регістра → вираз»: роль поля (вимір, ресурс,
|
|
@@ -1241,8 +1232,6 @@ export declare const documentSchema: z.ZodObject<{
|
|
|
1241
1232
|
}, z.core.$strict>>;
|
|
1242
1233
|
}, z.core.$strict>;
|
|
1243
1234
|
type Document = z.infer<typeof documentSchema>;
|
|
1244
|
-
//#endregion
|
|
1245
|
-
//#region src/model/schemas/enumeration.d.ts
|
|
1246
1235
|
export declare const enumValueSchema: z.ZodObject<{
|
|
1247
1236
|
id: z.ZodOptional<z.ZodUUID>;
|
|
1248
1237
|
name: z.ZodString;
|
|
@@ -1281,8 +1270,6 @@ export declare const enumerationSchema: z.ZodObject<{
|
|
|
1281
1270
|
}, z.core.$strict>>;
|
|
1282
1271
|
}, z.core.$strict>;
|
|
1283
1272
|
type Enumeration = z.infer<typeof enumerationSchema>;
|
|
1284
|
-
//#endregion
|
|
1285
|
-
//#region src/model/schemas/information-register.d.ts
|
|
1286
1273
|
/** Регістр відомостей. */
|
|
1287
1274
|
export declare const informationRegisterSchema: z.ZodObject<{
|
|
1288
1275
|
kind: z.ZodLiteral<"InformationRegister">;
|
|
@@ -1619,8 +1606,6 @@ export declare const informationRegisterSchema: z.ZodObject<{
|
|
|
1619
1606
|
}, z.core.$strict>>;
|
|
1620
1607
|
}, z.core.$strict>;
|
|
1621
1608
|
type InformationRegister = z.infer<typeof informationRegisterSchema>;
|
|
1622
|
-
//#endregion
|
|
1623
|
-
//#region src/model/schemas/accumulation-register.d.ts
|
|
1624
1609
|
/**
|
|
1625
1610
|
* Ресурс регістра накопичення. Ресурси сумуються в залишки й обороти, тож
|
|
1626
1611
|
* форма вужча за реквізит: лише число з precision/scale — без length,
|
|
@@ -1913,8 +1898,6 @@ export declare const accumulationRegisterSchema: z.ZodObject<{
|
|
|
1913
1898
|
}, z.core.$strict>>;
|
|
1914
1899
|
}, z.core.$strict>;
|
|
1915
1900
|
type AccumulationRegister = z.infer<typeof accumulationRegisterSchema>;
|
|
1916
|
-
//#endregion
|
|
1917
|
-
//#region src/model/schemas/constant.d.ts
|
|
1918
1901
|
/** Константа — окремий об'єкт зі значенням довільного логічного типу. */
|
|
1919
1902
|
export declare const constantSchema: z.ZodObject<{
|
|
1920
1903
|
defaultValue: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodObject<{
|
|
@@ -2012,14 +1995,12 @@ export declare const constantSchema: z.ZodObject<{
|
|
|
2012
1995
|
}, z.core.$strict>>;
|
|
2013
1996
|
}, z.core.$strict>;
|
|
2014
1997
|
type Constant = z.infer<typeof constantSchema>;
|
|
2015
|
-
//#endregion
|
|
2016
|
-
//#region src/model/schemas/rights.d.ts
|
|
2017
1998
|
/**
|
|
2018
1999
|
* Кастомна дія об'єкта (спека прав §3): елемент з `id` і `name`, але без
|
|
2019
2000
|
* `physicalName` — у даних дію називає її UUID, а не ім'я. `dml` не
|
|
2020
2001
|
* оголошується: компілятор виводить його з того, чи є що писати, тож
|
|
2021
2002
|
* оголошення не може розійтися з ефектами. `title`/`description` відкладено
|
|
2022
|
-
* до
|
|
2003
|
+
* до споживача (П4).
|
|
2023
2004
|
*/
|
|
2024
2005
|
export declare const customActionSchema: z.ZodObject<{
|
|
2025
2006
|
id: z.ZodOptional<z.ZodUUID>;
|
|
@@ -2055,7 +2036,7 @@ export declare const ownershipSchema: z.ZodArray<z.ZodUnion<readonly [z.ZodStrin
|
|
|
2055
2036
|
* Вимір доступу проєкту (спека прав §4.4): скоуплений довідник значень і
|
|
2056
2037
|
* джерело значень користувача — таблиця зв'язку чи дослівна функція. Вимір —
|
|
2057
2038
|
* елемент проєкту з UUID, бо обсяг гранту називає його id, а ім'я може
|
|
2058
|
-
* змінитися. `title`/`description` відкладено до
|
|
2039
|
+
* змінитися. `title`/`description` відкладено до споживача (П4).
|
|
2059
2040
|
*/
|
|
2060
2041
|
export declare const accessDimensionSchema: z.ZodObject<{
|
|
2061
2042
|
id: z.ZodOptional<z.ZodUUID>;
|
|
@@ -2151,6 +2132,21 @@ export declare const assignedOnSchema: z.ZodUnion<readonly [z.ZodLiteral<"global
|
|
|
2151
2132
|
}, z.core.$strict>;
|
|
2152
2133
|
}, z.core.$strict>]>;
|
|
2153
2134
|
type AssignedOn = z.infer<typeof assignedOnSchema>;
|
|
2135
|
+
/**
|
|
2136
|
+
* Кон'юнкт умови рядків прийнятого джерела (спека прав §4.7):
|
|
2137
|
+
* рівність колонки літералу чи перевірка на `NULL`. Умова лише звужує рядки
|
|
2138
|
+
* джерела — рядок, що їй не відповідає, не належить джерелу (наприклад, рядок
|
|
2139
|
+
* іншого рівня поліморфної таблиці). Тип літерала звіряє з типом колонки
|
|
2140
|
+
* стадія 4.
|
|
2141
|
+
*/
|
|
2142
|
+
export declare const sourceConditionSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
2143
|
+
column: z.ZodString;
|
|
2144
|
+
equals: z.ZodUnion<readonly [z.ZodString, z.ZodBoolean, z.ZodNumber]>;
|
|
2145
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2146
|
+
column: z.ZodString;
|
|
2147
|
+
isNull: z.ZodBoolean;
|
|
2148
|
+
}, z.core.$strict>]>;
|
|
2149
|
+
type SourceCondition = z.infer<typeof sourceConditionSchema>;
|
|
2154
2150
|
/**
|
|
2155
2151
|
* Прийняте джерело членства (спека прав §4.7): `CustomTable`, чиї рядки
|
|
2156
2152
|
* пов'язують користувача зі значенням виду скоупу. Колонки — логічні імена
|
|
@@ -2181,11 +2177,18 @@ export declare const membershipSourceSchema: z.ZodObject<{
|
|
|
2181
2177
|
user: z.ZodString;
|
|
2182
2178
|
active: z.ZodOptional<z.ZodString>;
|
|
2183
2179
|
}, z.core.$strict>;
|
|
2180
|
+
where: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
2181
|
+
column: z.ZodString;
|
|
2182
|
+
equals: z.ZodUnion<readonly [z.ZodString, z.ZodBoolean, z.ZodNumber]>;
|
|
2183
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2184
|
+
column: z.ZodString;
|
|
2185
|
+
isNull: z.ZodBoolean;
|
|
2186
|
+
}, z.core.$strict>]>>>;
|
|
2184
2187
|
}, z.core.$strict>;
|
|
2185
2188
|
type MembershipSource = z.infer<typeof membershipSourceSchema>;
|
|
2186
2189
|
/**
|
|
2187
2190
|
* Прийняте джерело призначень (спека прав §4.7): `CustomTable`, чиї рядки
|
|
2188
|
-
* дають учаснику роль на одному рівні. Рівень — стала джерела (
|
|
2191
|
+
* дають учаснику роль на одному рівні. Рівень — стала джерела (спека прав §4.7).
|
|
2189
2192
|
*/
|
|
2190
2193
|
export declare const assignmentSourceSchema: z.ZodObject<{
|
|
2191
2194
|
id: z.ZodOptional<z.ZodUUID>;
|
|
@@ -2228,16 +2231,50 @@ export declare const assignmentSourceSchema: z.ZodObject<{
|
|
|
2228
2231
|
}, z.core.$strict>;
|
|
2229
2232
|
columns: z.ZodObject<{
|
|
2230
2233
|
member: z.ZodString;
|
|
2231
|
-
role: z.ZodString
|
|
2234
|
+
role: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
2235
|
+
column: z.ZodString;
|
|
2236
|
+
references: z.ZodObject<{
|
|
2237
|
+
kind: z.ZodEnum<{
|
|
2238
|
+
Catalog: "Catalog";
|
|
2239
|
+
Document: "Document";
|
|
2240
|
+
Enumeration: "Enumeration";
|
|
2241
|
+
InformationRegister: "InformationRegister";
|
|
2242
|
+
AccumulationRegister: "AccumulationRegister";
|
|
2243
|
+
Constant: "Constant";
|
|
2244
|
+
CustomTable: "CustomTable";
|
|
2245
|
+
PgEnum: "PgEnum";
|
|
2246
|
+
EventSubscription: "EventSubscription";
|
|
2247
|
+
RightsSet: "RightsSet";
|
|
2248
|
+
Role: "Role";
|
|
2249
|
+
}>;
|
|
2250
|
+
name: z.ZodString;
|
|
2251
|
+
}, z.core.$strict>;
|
|
2252
|
+
key: z.ZodString;
|
|
2253
|
+
where: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
2254
|
+
column: z.ZodString;
|
|
2255
|
+
equals: z.ZodUnion<readonly [z.ZodString, z.ZodBoolean, z.ZodNumber]>;
|
|
2256
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2257
|
+
column: z.ZodString;
|
|
2258
|
+
isNull: z.ZodBoolean;
|
|
2259
|
+
}, z.core.$strict>]>>>;
|
|
2260
|
+
}, z.core.$strict>]>;
|
|
2261
|
+
scope: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2232
2262
|
container: z.ZodOptional<z.ZodString>;
|
|
2233
2263
|
active: z.ZodOptional<z.ZodString>;
|
|
2234
2264
|
}, z.core.$strict>;
|
|
2265
|
+
where: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
2266
|
+
column: z.ZodString;
|
|
2267
|
+
equals: z.ZodUnion<readonly [z.ZodString, z.ZodBoolean, z.ZodNumber]>;
|
|
2268
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2269
|
+
column: z.ZodString;
|
|
2270
|
+
isNull: z.ZodBoolean;
|
|
2271
|
+
}, z.core.$strict>]>>>;
|
|
2235
2272
|
}, z.core.$strict>;
|
|
2236
2273
|
type AssignmentSource = z.infer<typeof assignmentSourceSchema>;
|
|
2237
2274
|
/**
|
|
2238
2275
|
* Рівень ролі (спека прав §4.1, Рх7): рівні джерела плюс «кожен дійсний
|
|
2239
2276
|
* користувач» — без рядків призначень, тож джерелам ця форма не потрібна
|
|
2240
|
-
* (
|
|
2277
|
+
* (спека прав Рх7).
|
|
2241
2278
|
*/
|
|
2242
2279
|
export declare const roleAssignedOnSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodLiteral<"global">, z.ZodObject<{
|
|
2243
2280
|
scopeKind: z.ZodString;
|
|
@@ -2270,7 +2307,7 @@ export declare const extentSchema: z.ZodUnion<readonly [z.ZodLiteral<"any">, z.Z
|
|
|
2270
2307
|
}, z.core.$strict>]>;
|
|
2271
2308
|
type Extent = z.infer<typeof extentSchema>;
|
|
2272
2309
|
/**
|
|
2273
|
-
* Об'єкти гранту (
|
|
2310
|
+
* Об'єкти гранту (спека прав §4.1): явний перелік або «усі об'єкти рівня ролі, чиї
|
|
2274
2311
|
* дії мають цю» — щоб роль не перелічувала кожен документ заради `post`.
|
|
2275
2312
|
*/
|
|
2276
2313
|
export declare const objectSelectorSchema: z.ZodUnion<readonly [z.ZodArray<z.ZodObject<{
|
|
@@ -2301,7 +2338,7 @@ export declare const objectSelectorSchema: z.ZodUnion<readonly [z.ZodArray<z.Zod
|
|
|
2301
2338
|
}>;
|
|
2302
2339
|
}, z.core.$strict>]>;
|
|
2303
2340
|
type ObjectSelector = z.infer<typeof objectSelectorSchema>;
|
|
2304
|
-
/** Запис гранту набору: без `deny` — віднімання належить ролі (
|
|
2341
|
+
/** Запис гранту набору: без `deny` — віднімання належить ролі (спека прав §4.1). */
|
|
2305
2342
|
export declare const setGrantEntrySchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
2306
2343
|
grantAll: z.ZodObject<{
|
|
2307
2344
|
extent: z.ZodUnion<readonly [z.ZodLiteral<"any">, z.ZodLiteral<"own">, z.ZodObject<{
|
|
@@ -2344,7 +2381,7 @@ export declare const setGrantEntrySchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
2344
2381
|
}, z.core.$strict>;
|
|
2345
2382
|
}, z.core.$strict>]>;
|
|
2346
2383
|
type SetGrantEntry = z.infer<typeof setGrantEntrySchema>;
|
|
2347
|
-
/** Запис гранту ролі: `deny` віднімає з архетипу після розгортання (
|
|
2384
|
+
/** Запис гранту ролі: `deny` віднімає з архетипу після розгортання (спека прав §4.1). */
|
|
2348
2385
|
export declare const grantEntrySchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
2349
2386
|
grantAll: z.ZodObject<{
|
|
2350
2387
|
extent: z.ZodUnion<readonly [z.ZodLiteral<"any">, z.ZodLiteral<"own">, z.ZodObject<{
|
|
@@ -2658,8 +2695,6 @@ export declare const roleSchema: z.ZodObject<{
|
|
|
2658
2695
|
name: z.ZodString;
|
|
2659
2696
|
}, z.core.$strict>;
|
|
2660
2697
|
type Role = z.infer<typeof roleSchema>;
|
|
2661
|
-
//#endregion
|
|
2662
|
-
//#region src/model/schemas/custom-table.d.ts
|
|
2663
2698
|
/**
|
|
2664
2699
|
* Ім'я об'єкта каталогу Postgres (колляції, класу операторів) частинами, а
|
|
2665
2700
|
* не рядком `schema.name`: крапка буває в самому імені (`en_US.utf8`), тож
|
|
@@ -2918,6 +2953,27 @@ export declare const customTableSchema: z.ZodObject<{
|
|
|
2918
2953
|
name: z.ZodString;
|
|
2919
2954
|
}, z.core.$strict>;
|
|
2920
2955
|
columns: z.ZodArray<z.ZodString>;
|
|
2956
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
2957
|
+
object: z.ZodObject<{
|
|
2958
|
+
kind: z.ZodEnum<{
|
|
2959
|
+
Catalog: "Catalog";
|
|
2960
|
+
Document: "Document";
|
|
2961
|
+
Enumeration: "Enumeration";
|
|
2962
|
+
InformationRegister: "InformationRegister";
|
|
2963
|
+
AccumulationRegister: "AccumulationRegister";
|
|
2964
|
+
Constant: "Constant";
|
|
2965
|
+
CustomTable: "CustomTable";
|
|
2966
|
+
PgEnum: "PgEnum";
|
|
2967
|
+
EventSubscription: "EventSubscription";
|
|
2968
|
+
RightsSet: "RightsSet";
|
|
2969
|
+
Role: "Role";
|
|
2970
|
+
}>;
|
|
2971
|
+
name: z.ZodString;
|
|
2972
|
+
}, z.core.$strict>;
|
|
2973
|
+
key: z.ZodEnum<{
|
|
2974
|
+
ref: "ref";
|
|
2975
|
+
scopedRef: "scopedRef";
|
|
2976
|
+
}>;
|
|
2921
2977
|
}, z.core.$strict>, z.ZodObject<{
|
|
2922
2978
|
external: z.ZodObject<{
|
|
2923
2979
|
schema: z.ZodString;
|
|
@@ -3012,8 +3068,6 @@ export declare const customTableSchema: z.ZodObject<{
|
|
|
3012
3068
|
}, z.core.$strict>>;
|
|
3013
3069
|
}, z.core.$strict>;
|
|
3014
3070
|
type CustomTable = z.infer<typeof customTableSchema>;
|
|
3015
|
-
//#endregion
|
|
3016
|
-
//#region src/model/schemas/scope.d.ts
|
|
3017
3071
|
/** Значення `setFunction` виду скоупу: функцію множини генерує компілятор з членства. */
|
|
3018
3072
|
export declare const MEMBERSHIP_SET_FUNCTION = "membership";
|
|
3019
3073
|
/** Значення `scope` об'єкта, що явно виводить його зі скоупу. */
|
|
@@ -3065,8 +3119,6 @@ export declare const scopeKindSchema: z.ZodObject<{
|
|
|
3065
3119
|
}>>;
|
|
3066
3120
|
}, z.core.$strict>;
|
|
3067
3121
|
type ScopeKind = z.infer<typeof scopeKindSchema>;
|
|
3068
|
-
//#endregion
|
|
3069
|
-
//#region src/model/schemas/project.d.ts
|
|
3070
3122
|
/**
|
|
3071
3123
|
* Пресети провайдера бази (платформна спека §6.9). Проєкт вибирає пресет
|
|
3072
3124
|
* ключем, а його вміст — факти образу провайдера — лишається кодом платформи.
|
|
@@ -3117,6 +3169,99 @@ type ApiRolePurpose = keyof ProviderApiRoles;
|
|
|
3117
3169
|
*/
|
|
3118
3170
|
type RequestRolePurpose = Exclude<ApiRolePurpose, "service">;
|
|
3119
3171
|
export declare const PROVIDER_API_ROLES: Readonly<Record<DatabaseProvider, ProviderApiRoles>>;
|
|
3172
|
+
/**
|
|
3173
|
+
* Provider login roles that can run untrusted API requests. Rights maintenance
|
|
3174
|
+
* mode is never enabled for them, even when one owns the rights functions:
|
|
3175
|
+
* provider services work under these shared logins.
|
|
3176
|
+
*/
|
|
3177
|
+
export declare const PROVIDER_LOGIN_ROLES: Readonly<Record<DatabaseProvider, readonly string[]>>;
|
|
3178
|
+
/**
|
|
3179
|
+
* Схеми, які створює й наповнює провайдер (платформна спека §6.9): застосунок
|
|
3180
|
+
* має в них лише поверхню пресету. Факт T0, бо його потребує і компілятор (T1:
|
|
3181
|
+
* доступність недосудного SQL, `SECURITY DEFINER` над RLS), і схема (T2) та
|
|
3182
|
+
* designer — один перелік замість копії по ярусах. Порядок зберігається:
|
|
3183
|
+
* його читає й `SUPABASE_SURFACES`.
|
|
3184
|
+
*/
|
|
3185
|
+
export declare const PROVIDER_SCHEMAS: Readonly<Record<DatabaseProvider, readonly string[]>>;
|
|
3186
|
+
/**
|
|
3187
|
+
* Provider functions that application SQL running inside a command (kind
|
|
3188
|
+
* module functions, subscription handlers, set and dimension functions,
|
|
3189
|
+
* movement query blocks) may call, as `schema.name`.
|
|
3190
|
+
*/
|
|
3191
|
+
export declare const PROVIDER_FUNCTIONS: Readonly<Record<DatabaseProvider, readonly string[]>>;
|
|
3192
|
+
/**
|
|
3193
|
+
* Provider functions that expression units (metadata expressions of adopted
|
|
3194
|
+
* tables, views, verbatim policy expressions) may call in addition to
|
|
3195
|
+
* `PROVIDER_FUNCTIONS`, as `schema.name`.
|
|
3196
|
+
*/
|
|
3197
|
+
export declare const PROVIDER_EXPRESSION_FUNCTIONS: Readonly<Record<DatabaseProvider, readonly string[]>>;
|
|
3198
|
+
/**
|
|
3199
|
+
* Provider functions that execute the SQL text passed to them, as
|
|
3200
|
+
* `schema.name`.
|
|
3201
|
+
*/
|
|
3202
|
+
export declare const PROVIDER_SQL_TEXT_FUNCTIONS: Readonly<Record<DatabaseProvider, readonly string[]>>;
|
|
3203
|
+
/**
|
|
3204
|
+
* Ролі платформи за призначенням (платформна спека §6.7, спека прав §5.1):
|
|
3205
|
+
* на відміну від ролей API їх не дає провайдер — на базі споживача їх
|
|
3206
|
+
* створює designer (`simetra roles`), тож ім'я одне для всіх провайдерів.
|
|
3207
|
+
* Роль кластерна: її немає в бажаному SQL, і згенерований SQL нею не
|
|
3208
|
+
* керує — лише дає їй `EXECUTE` функцій і `USAGE` схеми.
|
|
3209
|
+
*/
|
|
3210
|
+
export declare const PLATFORM_ROLES: {
|
|
3211
|
+
readonly command: "simetra_command";
|
|
3212
|
+
};
|
|
3213
|
+
/**
|
|
3214
|
+
* Ролі входу платформи (спека П4 §6.2): на відміну від `PLATFORM_ROLES` у
|
|
3215
|
+
* них входять, а права вони беруть лише через `SET ROLE` — членства
|
|
3216
|
+
* `INHERIT FALSE, SET TRUE`. Гранту згенерованого SQL вони не отримують
|
|
3217
|
+
* (`GrantPurpose` їх не знає), а режим обслуговування прав для них не
|
|
3218
|
+
* вмикається: рантайм не власник функцій прав (спека прав §7).
|
|
3219
|
+
*/
|
|
3220
|
+
export declare const PLATFORM_LOGIN_ROLES: {
|
|
3221
|
+
readonly runtime: "simetra_runtime";
|
|
3222
|
+
};
|
|
3223
|
+
/**
|
|
3224
|
+
* Ролі запиту, членом яких стає роль входу рантайму, за провайдером: профіль
|
|
3225
|
+
* вирішує членство даними, а не гілкою за іменем провайдера. Новий провайдер
|
|
3226
|
+
* додає свій рядок разом зі своїми ролями запиту.
|
|
3227
|
+
*/
|
|
3228
|
+
export declare const LOGIN_ROLE_REQUEST_PURPOSES: Readonly<Record<DatabaseProvider, readonly RequestRolePurpose[]>>;
|
|
3229
|
+
/**
|
|
3230
|
+
* The session setting through which `runCommand` passes the command context;
|
|
3231
|
+
* its value is a JSON `CommandContext`.
|
|
3232
|
+
*/
|
|
3233
|
+
export declare const COMMAND_SETTING = "simetra.command";
|
|
3234
|
+
/** The session setting for platform rights maintenance. */
|
|
3235
|
+
export declare const RIGHTS_MAINTENANCE_SETTING = "simetra.rights_maintenance";
|
|
3236
|
+
/**
|
|
3237
|
+
* The session setting that carries the request claims: the platform layer
|
|
3238
|
+
* reads the current user's subject (`sub`) from it.
|
|
3239
|
+
*/
|
|
3240
|
+
export declare const SESSION_CLAIMS_SETTING = "request.jwt.claims";
|
|
3241
|
+
/**
|
|
3242
|
+
* The namespace of the platform's own session settings: the command context
|
|
3243
|
+
* and every later platform setting.
|
|
3244
|
+
*/
|
|
3245
|
+
export declare const PLATFORM_SETTING_PREFIX = "simetra.";
|
|
3246
|
+
/**
|
|
3247
|
+
* Session settings that application SQL must never change: name prefixes
|
|
3248
|
+
* (case-insensitive) and exact names.
|
|
3249
|
+
*/
|
|
3250
|
+
export declare const PROTECTED_SESSION_SETTINGS: {
|
|
3251
|
+
readonly prefixes: readonly ["simetra.", "request.jwt."];
|
|
3252
|
+
readonly names: readonly ["role", "session_authorization", "session_replication_role"];
|
|
3253
|
+
};
|
|
3254
|
+
/** The command context: the action, the root object's label and the root row's UUID. */
|
|
3255
|
+
interface CommandContext {
|
|
3256
|
+
/** A word of the action vocabulary or the UUID of a custom action. */
|
|
3257
|
+
action: string;
|
|
3258
|
+
object: string;
|
|
3259
|
+
root: string;
|
|
3260
|
+
}
|
|
3261
|
+
/** Роль команд: виконує функції прав і команди, DML таблиць виду не має. */
|
|
3262
|
+
type PlatformRolePurpose = keyof typeof PLATFORM_ROLES;
|
|
3263
|
+
/** Отримувач гранту згенерованого SQL: роль API провайдера чи платформи. */
|
|
3264
|
+
type GrantPurpose = ApiRolePurpose | PlatformRolePurpose;
|
|
3120
3265
|
/**
|
|
3121
3266
|
* Звідки береться відображуване ім'я нового користувача: колонка таблиці
|
|
3122
3267
|
* облікових записів або ключ JSON-колонки метаданих.
|
|
@@ -3148,6 +3293,21 @@ interface IdentitySource {
|
|
|
3148
3293
|
deletedAtColumn?: string;
|
|
3149
3294
|
/** Значення `simetra.identities.provider` для цього провайдера. */
|
|
3150
3295
|
providerKey: string;
|
|
3296
|
+
/**
|
|
3297
|
+
* Чи `sub` сесії — і є id користувача (С8): лише тоді права без
|
|
3298
|
+
* «Користувачів» можливі з прийнятим джерелом членства (спека прав §4.6),
|
|
3299
|
+
* бо колонка користувача джерела зіставляється з `sub` напряму.
|
|
3300
|
+
*/
|
|
3301
|
+
subjectIsUserId: boolean;
|
|
3302
|
+
/**
|
|
3303
|
+
* Claim анонімної сесії провайдера (значення `true`); `null` — анонімних
|
|
3304
|
+
* сесій у провайдера немає. Без «Користувачів» провізії, що відкидає
|
|
3305
|
+
* анонімний вхід за `anonymousColumn`, немає, тож такий вхід відкидає сама
|
|
3306
|
+
* функція поточного користувача за цим claim. Факт обов'язковий: пропущений
|
|
3307
|
+
* claim тихо дав би анонімній сесії права `everyUser` (fail-open), тож новий
|
|
3308
|
+
* провайдер мусить відповісти на це явно.
|
|
3309
|
+
*/
|
|
3310
|
+
anonymousClaim: string | null;
|
|
3151
3311
|
}
|
|
3152
3312
|
/**
|
|
3153
3313
|
* Факти провайдера ідентичності за пресетом бази. Колонки — факт образу
|
|
@@ -3156,7 +3316,7 @@ interface IdentitySource {
|
|
|
3156
3316
|
*
|
|
3157
3317
|
* Чого `IdentitySource` не виражає — межа, яку другий провайдер перевіряє
|
|
3158
3318
|
* першою, бо платформний шар вважає це спільним для всіх:
|
|
3159
|
-
* - контракт сесії: `current_setting(
|
|
3319
|
+
* - контракт сесії: `current_setting(SESSION_CLAIMS_SETTING)` і claim `sub`
|
|
3160
3320
|
* у ньому (функція поточного користувача);
|
|
3161
3321
|
* - правило С8: ключ облікового запису — uuid, він же `id` користувача, а
|
|
3162
3322
|
* `subject` — цей ключ як `::text`;
|
|
@@ -3304,6 +3464,13 @@ export declare const projectSchema: z.ZodObject<{
|
|
|
3304
3464
|
user: z.ZodString;
|
|
3305
3465
|
active: z.ZodOptional<z.ZodString>;
|
|
3306
3466
|
}, z.core.$strict>;
|
|
3467
|
+
where: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
3468
|
+
column: z.ZodString;
|
|
3469
|
+
equals: z.ZodUnion<readonly [z.ZodString, z.ZodBoolean, z.ZodNumber]>;
|
|
3470
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
3471
|
+
column: z.ZodString;
|
|
3472
|
+
isNull: z.ZodBoolean;
|
|
3473
|
+
}, z.core.$strict>]>>>;
|
|
3307
3474
|
}, z.core.$strict>>>;
|
|
3308
3475
|
assignmentSources: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
3309
3476
|
id: z.ZodOptional<z.ZodUUID>;
|
|
@@ -3346,10 +3513,44 @@ export declare const projectSchema: z.ZodObject<{
|
|
|
3346
3513
|
}, z.core.$strict>;
|
|
3347
3514
|
columns: z.ZodObject<{
|
|
3348
3515
|
member: z.ZodString;
|
|
3349
|
-
role: z.ZodString
|
|
3516
|
+
role: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
3517
|
+
column: z.ZodString;
|
|
3518
|
+
references: z.ZodObject<{
|
|
3519
|
+
kind: z.ZodEnum<{
|
|
3520
|
+
Catalog: "Catalog";
|
|
3521
|
+
Document: "Document";
|
|
3522
|
+
Enumeration: "Enumeration";
|
|
3523
|
+
InformationRegister: "InformationRegister";
|
|
3524
|
+
AccumulationRegister: "AccumulationRegister";
|
|
3525
|
+
Constant: "Constant";
|
|
3526
|
+
CustomTable: "CustomTable";
|
|
3527
|
+
PgEnum: "PgEnum";
|
|
3528
|
+
EventSubscription: "EventSubscription";
|
|
3529
|
+
RightsSet: "RightsSet";
|
|
3530
|
+
Role: "Role";
|
|
3531
|
+
}>;
|
|
3532
|
+
name: z.ZodString;
|
|
3533
|
+
}, z.core.$strict>;
|
|
3534
|
+
key: z.ZodString;
|
|
3535
|
+
where: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
3536
|
+
column: z.ZodString;
|
|
3537
|
+
equals: z.ZodUnion<readonly [z.ZodString, z.ZodBoolean, z.ZodNumber]>;
|
|
3538
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
3539
|
+
column: z.ZodString;
|
|
3540
|
+
isNull: z.ZodBoolean;
|
|
3541
|
+
}, z.core.$strict>]>>>;
|
|
3542
|
+
}, z.core.$strict>]>;
|
|
3543
|
+
scope: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
3350
3544
|
container: z.ZodOptional<z.ZodString>;
|
|
3351
3545
|
active: z.ZodOptional<z.ZodString>;
|
|
3352
3546
|
}, z.core.$strict>;
|
|
3547
|
+
where: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
3548
|
+
column: z.ZodString;
|
|
3549
|
+
equals: z.ZodUnion<readonly [z.ZodString, z.ZodBoolean, z.ZodNumber]>;
|
|
3550
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
3551
|
+
column: z.ZodString;
|
|
3552
|
+
isNull: z.ZodBoolean;
|
|
3553
|
+
}, z.core.$strict>]>>>;
|
|
3353
3554
|
}, z.core.$strict>>>;
|
|
3354
3555
|
storageBuckets: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
3355
3556
|
bucket: z.ZodString;
|
|
@@ -3357,8 +3558,6 @@ export declare const projectSchema: z.ZodObject<{
|
|
|
3357
3558
|
}, z.core.$strict>>>;
|
|
3358
3559
|
}, z.core.$strict>;
|
|
3359
3560
|
type Project = z.infer<typeof projectSchema>;
|
|
3360
|
-
//#endregion
|
|
3361
|
-
//#region src/model/schemas/public-read.d.ts
|
|
3362
3561
|
/**
|
|
3363
3562
|
* Ролі API, яким об'єкт відкриває читання (спека промоції §9.3). Поле мають
|
|
3364
3563
|
* лише види з RLS (факт реєстру `rowLevelSecurity`): без RLS таблиця не має
|
|
@@ -3379,8 +3578,6 @@ export declare const publicReadSchema: z.ZodOptional<z.ZodEnum<{
|
|
|
3379
3578
|
authenticated: "authenticated";
|
|
3380
3579
|
anon: "anon";
|
|
3381
3580
|
}>>;
|
|
3382
|
-
//#endregion
|
|
3383
|
-
//#region src/model/schemas/pg-enum.d.ts
|
|
3384
3581
|
/**
|
|
3385
3582
|
* Прийнятий PG-енам. Значення — фізичні мітки типу без власної ідентичності,
|
|
3386
3583
|
* тому порядок значущий (порядок у PG-енамі), а дублікати заборонені.
|
|
@@ -3403,8 +3600,6 @@ export declare const pgEnumSchema: z.ZodObject<{
|
|
|
3403
3600
|
physicalName: z.ZodOptional<z.ZodString>;
|
|
3404
3601
|
}, z.core.$strict>;
|
|
3405
3602
|
type PgEnum = z.infer<typeof pgEnumSchema>;
|
|
3406
|
-
//#endregion
|
|
3407
|
-
//#region src/model/schemas/event-subscription.d.ts
|
|
3408
3603
|
/**
|
|
3409
3604
|
* Події підписки (спека промоції §9.3): до чи після запису й видалення рядка
|
|
3410
3605
|
* джерела. Тригер за подією генерує компілятор
|
|
@@ -3464,12 +3659,10 @@ export declare const eventSubscriptionSchema: z.ZodObject<{
|
|
|
3464
3659
|
physicalName: z.ZodOptional<z.ZodString>;
|
|
3465
3660
|
}, z.core.$strict>;
|
|
3466
3661
|
type EventSubscription = z.infer<typeof eventSubscriptionSchema>;
|
|
3467
|
-
//#endregion
|
|
3468
|
-
//#region src/model/schemas/sql-debt.d.ts
|
|
3469
3662
|
/** Ім'я файлу переліку боргу в корені `metadata/`. */
|
|
3470
3663
|
export declare const SQL_DEBT_FILE = "sql-debt.json";
|
|
3471
3664
|
/**
|
|
3472
|
-
* Перелік боргу дослівного SQL (
|
|
3665
|
+
* Перелік боргу дослівного SQL (спека П2 §8.6): ідентичності
|
|
3473
3666
|
* одиниць поза закритою оболонкою, які тека вже мала, коли її розклав
|
|
3474
3667
|
* `introspect`. Ратчет лише звужується: нова одиниця боргу, якої тут немає, —
|
|
3475
3668
|
* помилка компіляції, а `fix` лише прибирає записи. Відсортований і без
|
|
@@ -3480,8 +3673,6 @@ export declare const sqlDebtSchema: z.ZodObject<{
|
|
|
3480
3673
|
units: z.ZodArray<z.ZodString>;
|
|
3481
3674
|
}, z.core.$strict>;
|
|
3482
3675
|
type SqlDebt = z.infer<typeof sqlDebtSchema>;
|
|
3483
|
-
//#endregion
|
|
3484
|
-
//#region src/model/posting/ast.d.ts
|
|
3485
3676
|
/**
|
|
3486
3677
|
* AST виразу конструктора рухів. Кожен вузол несе півінтервал [start, end) —
|
|
3487
3678
|
* зміщення в рядку виразу, щоб діагностики вказували на точне місце.
|
|
@@ -3558,181 +3749,1236 @@ type ParseResult = {
|
|
|
3558
3749
|
message: string;
|
|
3559
3750
|
offset: number;
|
|
3560
3751
|
};
|
|
3561
|
-
//#endregion
|
|
3562
|
-
//#region src/model/posting/parse.d.ts
|
|
3563
3752
|
/** Розбирає вираз конструктора рухів; помилка несе зміщення в `text`. */
|
|
3564
3753
|
export declare function parseExpression(text: string): ParseResult;
|
|
3565
|
-
//#endregion
|
|
3566
|
-
//#region src/model/posting/walk.d.ts
|
|
3567
3754
|
/**
|
|
3568
3755
|
* Обходить усі вузли виразу в порядку появи (спершу вузол, потім операнди).
|
|
3569
3756
|
* Єдиний обхід AST: окремі рекурсії в стадіях компілятора розходилися б
|
|
3570
3757
|
* при появі нового виду вузла.
|
|
3571
3758
|
*/
|
|
3572
3759
|
export declare function walkExpr(expr: Expr, visit: (node: Expr) => void): void;
|
|
3573
|
-
//#endregion
|
|
3574
|
-
//#region src/model/physical/snapshot.d.ts
|
|
3575
|
-
/**
|
|
3576
|
-
* Контракт фізичного знімка (спека §8.3). Живе в T0, бо з нього будують
|
|
3577
|
-
* рендер, хеш і `explain`, а extract адаптера мапиться в ті самі типи.
|
|
3578
|
-
* Масиви `uniques`/`checks`/`foreignKeys`/`indexes` відсортовані за `name`,
|
|
3579
|
-
* `tables` і `enumTypes` — за `(schema, name)`: знімок детермінований, тож
|
|
3580
|
-
* порівняння й хеш не залежать від порядку обходу.
|
|
3581
|
-
*/
|
|
3582
|
-
export interface PhysicalSnapshot {
|
|
3583
|
-
tables: PhysicalTable[];
|
|
3584
|
-
enumTypes: PhysicalEnumType[];
|
|
3585
|
-
}
|
|
3586
|
-
/** Звідки в метаданих походить фізичний об'єкт (для `explain`). */
|
|
3587
|
-
export interface PhysicalOrigin {
|
|
3588
|
-
objectId: string;
|
|
3589
|
-
tabularSectionId?: string;
|
|
3590
|
-
/**
|
|
3591
|
-
* Похідна таблиця об'єкта поруч з основною: поточні підсумки регістра, його
|
|
3592
|
-
* місячні обороти або зв'язок ідентичностей довідника «Користувачі» в схемі
|
|
3593
|
-
* платформи.
|
|
3594
|
-
*/
|
|
3595
|
-
part?: "totals" | "turnoversMonth" | "identities";
|
|
3596
|
-
}
|
|
3597
|
-
export interface PhysicalEnumType {
|
|
3598
|
-
schema: string;
|
|
3599
|
-
name: string;
|
|
3600
|
-
values: string[];
|
|
3601
|
-
origin: PhysicalOrigin;
|
|
3602
|
-
}
|
|
3603
|
-
export interface PhysicalTable {
|
|
3604
|
-
schema: string;
|
|
3605
|
-
name: string;
|
|
3606
|
-
comment?: string;
|
|
3607
|
-
origin: PhysicalOrigin;
|
|
3608
|
-
/**
|
|
3609
|
-
* Похідні таблиці регістра й рядки ТЧ мають RLS власника: інакше вони
|
|
3610
|
-
* відкривали б дані, закриті в основній таблиці.
|
|
3611
|
-
*/
|
|
3612
|
-
rowLevelSecurity: RowLevelSecurity;
|
|
3613
|
-
/** У порядку оголошення. */
|
|
3614
|
-
columns: PhysicalColumn[];
|
|
3615
|
-
primaryKey?: {
|
|
3616
|
-
name: string;
|
|
3617
|
-
columns: string[];
|
|
3618
|
-
deferrable?: DeferredConstraint;
|
|
3619
|
-
};
|
|
3620
|
-
uniques: {
|
|
3621
|
-
name: string;
|
|
3622
|
-
columns: string[];
|
|
3623
|
-
nullsNotDistinct: boolean;
|
|
3624
|
-
deferrable?: DeferredConstraint;
|
|
3625
|
-
}[];
|
|
3626
|
-
checks: PhysicalCheck[];
|
|
3627
|
-
foreignKeys: {
|
|
3628
|
-
name: string;
|
|
3629
|
-
columns: string[];
|
|
3630
|
-
references: {
|
|
3631
|
-
schema: string;
|
|
3632
|
-
table: string;
|
|
3633
|
-
columns: string[];
|
|
3634
|
-
};
|
|
3635
|
-
onDelete: FkAction;
|
|
3636
|
-
onUpdate: FkAction;
|
|
3637
|
-
deferrable: "no" | "deferrable" | "initiallyDeferred";
|
|
3638
|
-
}[];
|
|
3639
|
-
indexes: {
|
|
3640
|
-
name: string;
|
|
3641
|
-
unique: boolean;
|
|
3642
|
-
method: string;
|
|
3643
|
-
keys: PhysicalIndexKey[];
|
|
3644
|
-
include: string[];
|
|
3645
|
-
where?: string;
|
|
3646
|
-
nullsNotDistinct: boolean;
|
|
3647
|
-
}[];
|
|
3648
|
-
}
|
|
3649
3760
|
/**
|
|
3650
|
-
*
|
|
3651
|
-
*
|
|
3652
|
-
*
|
|
3653
|
-
* шляхів). Каталог походження не бачить: для бази це той самий CHECK.
|
|
3761
|
+
* Відмови ядра (спека П4 §6.10): `MESSAGE` — код, `DETAIL` — причина чи
|
|
3762
|
+
* ключ; даних рядка відмова не несе (Рт4). Єдине джерело для генераторів
|
|
3763
|
+
* SQL (T1) і рантайму команд (T3): T3 не імпортує T1.
|
|
3654
3764
|
*/
|
|
3655
|
-
export
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3765
|
+
export declare const COMMAND_CORE_ERRORS: {
|
|
3766
|
+
readonly invalid: {
|
|
3767
|
+
readonly errcode: "22023";
|
|
3768
|
+
readonly message: "command.invalid";
|
|
3769
|
+
readonly create: "create";
|
|
3770
|
+
readonly item: "p_item";
|
|
3771
|
+
readonly tabular: "tabular";
|
|
3772
|
+
readonly expectedVersion: "p_expected_version";
|
|
3773
|
+
readonly mark: "p_mark";
|
|
3774
|
+
readonly predefined: "predefined";
|
|
3775
|
+
readonly creatorMember: "creatorMember";
|
|
3662
3776
|
};
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
/**
|
|
3671
|
-
* Елемент ключа індексу. Значення Postgres за замовчуванням (`ASC`, типове
|
|
3672
|
-
* розташування `NULL` для порядку) не пишуться, як у `pg_get_indexdef`: один
|
|
3673
|
-
* фізичний індекс — одна форма знімка.
|
|
3674
|
-
*/
|
|
3675
|
-
export type PhysicalIndexKey = ({
|
|
3676
|
-
column: string;
|
|
3677
|
-
} | {
|
|
3678
|
-
expression: string;
|
|
3679
|
-
}) & {
|
|
3680
|
-
order?: "asc" | "desc";
|
|
3681
|
-
nulls?: "first" | "last";
|
|
3682
|
-
opclass?: PgQualifiedName;
|
|
3683
|
-
collation?: PgQualifiedName;
|
|
3684
|
-
};
|
|
3685
|
-
export interface PhysicalColumn {
|
|
3686
|
-
name: string;
|
|
3687
|
-
/** Рядок у формі `format_type()`. */
|
|
3688
|
-
type: string;
|
|
3689
|
-
notNull: boolean;
|
|
3690
|
-
default?: string;
|
|
3691
|
-
/**
|
|
3692
|
-
* Identity-колонка: режим і ім'я її послідовності. Ім'я обирає компілятор
|
|
3693
|
-
* тим самим алгоритмом, що й Postgres (`<таблиця>_<колонка>_seq` з обходом
|
|
3694
|
-
* зайнятих), і воно займає `pg_class` схеми поряд з таблицями й індексами.
|
|
3695
|
-
*/
|
|
3696
|
-
identity?: {
|
|
3697
|
-
generation: "always" | "byDefault";
|
|
3698
|
-
sequence: string;
|
|
3777
|
+
readonly context: {
|
|
3778
|
+
readonly errcode: "42501";
|
|
3779
|
+
readonly message: "command.context";
|
|
3780
|
+
readonly detail: "phase";
|
|
3781
|
+
readonly missing: "missing";
|
|
3782
|
+
readonly malformed: "malformed";
|
|
3783
|
+
readonly unknownAction: "unknown-action";
|
|
3699
3784
|
};
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3785
|
+
readonly forbidden: {
|
|
3786
|
+
readonly errcode: "42501";
|
|
3787
|
+
readonly message: "command.forbidden";
|
|
3788
|
+
readonly noRight: "no-right";
|
|
3789
|
+
readonly newCarrier: "new-carrier";
|
|
3790
|
+
readonly effect: "effect";
|
|
3791
|
+
readonly rightsContext: "rights-context";
|
|
3792
|
+
readonly escalation: "escalation";
|
|
3793
|
+
readonly deltaDomain: "delta-domain";
|
|
3794
|
+
readonly roleInUse: "role-in-use";
|
|
3795
|
+
readonly lastFullAccess: "last-full-access";
|
|
3706
3796
|
};
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
* у кожної колонки, що несе значення скоупу: доданої скоуп-колонки, ключа
|
|
3713
|
-
* кореня, `parent_id` рядка ТЧ кореня й названої в описі скоуп-колонки
|
|
3714
|
-
* `CustomTable` (`scopeColumn`). Остання лишається елементом опису, тож
|
|
3715
|
-
* несе `elementId` разом зі `scopeKindId`.
|
|
3716
|
-
*/
|
|
3717
|
-
origin: {
|
|
3718
|
-
elementId?: string;
|
|
3719
|
-
standard?: string;
|
|
3720
|
-
scopeKindId?: string;
|
|
3797
|
+
readonly conflict: {
|
|
3798
|
+
readonly errcode: "P0001";
|
|
3799
|
+
readonly message: "command.conflict";
|
|
3800
|
+
readonly version: "version";
|
|
3801
|
+
readonly exists: "exists";
|
|
3721
3802
|
};
|
|
3722
|
-
}
|
|
3723
|
-
|
|
3724
|
-
|
|
3803
|
+
};
|
|
3804
|
+
/** Тригер ієрархії відмовляє поза `READ COMMITTED` (спека П4 §6.6). */
|
|
3805
|
+
export declare const HIERARCHY_ISOLATION_ERROR: {
|
|
3806
|
+
readonly errcode: "0A000";
|
|
3807
|
+
readonly message: "hierarchy.isolation";
|
|
3808
|
+
};
|
|
3809
|
+
export declare function isTextEncodedType(pgType: string): boolean;
|
|
3810
|
+
/** Функція поточного користувача схеми платформи. */
|
|
3811
|
+
export declare const CURRENT_USER_FUNCTION_NAME = "current_user_id";
|
|
3812
|
+
/** Функція хеша застосованого знімка (схема — `PLATFORM_SCHEMA`). */
|
|
3813
|
+
export declare const APPLIED_SNAPSHOT_HASH_FUNCTION_NAME = "applied_snapshot_hash";
|
|
3814
|
+
/** Operations on an object that a command accepts (P4 spec §6.4). */
|
|
3815
|
+
export declare const OBJECT_OPERATIONS: readonly ["create", "update", "markDeletion", "delete"];
|
|
3816
|
+
export type ObjectOperation = (typeof OBJECT_OPERATIONS)[number];
|
|
3725
3817
|
/**
|
|
3726
|
-
*
|
|
3727
|
-
*
|
|
3728
|
-
*
|
|
3818
|
+
* The object-module event an operation raises; `undefined` — none. Подію
|
|
3819
|
+
* визначає операція, а не дія контексту: на довідниках прав дія —
|
|
3820
|
+
* `administerRights` і для запису, і для видалення (Р-A3-2).
|
|
3729
3821
|
*/
|
|
3730
|
-
export declare
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3822
|
+
export declare const OPERATION_EVENTS: Readonly<Record<ObjectOperation, "write" | undefined>>;
|
|
3823
|
+
/** One operation of a command, by logical names. */
|
|
3824
|
+
export declare const operationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
3825
|
+
action: z.ZodLiteral<"create">;
|
|
3826
|
+
object: z.ZodObject<{
|
|
3827
|
+
kind: z.ZodEnum<{
|
|
3828
|
+
Catalog: "Catalog";
|
|
3829
|
+
Document: "Document";
|
|
3830
|
+
Enumeration: "Enumeration";
|
|
3831
|
+
InformationRegister: "InformationRegister";
|
|
3832
|
+
AccumulationRegister: "AccumulationRegister";
|
|
3833
|
+
Constant: "Constant";
|
|
3834
|
+
CustomTable: "CustomTable";
|
|
3835
|
+
PgEnum: "PgEnum";
|
|
3836
|
+
EventSubscription: "EventSubscription";
|
|
3837
|
+
RightsSet: "RightsSet";
|
|
3838
|
+
Role: "Role";
|
|
3839
|
+
}>;
|
|
3840
|
+
name: z.ZodString;
|
|
3841
|
+
}, z.core.$strict>;
|
|
3842
|
+
id: z.ZodOptional<z.ZodGUID>;
|
|
3843
|
+
values: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
3844
|
+
tabularSections: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
|
|
3845
|
+
creatorMember: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
3846
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
3847
|
+
action: z.ZodLiteral<"update">;
|
|
3848
|
+
object: z.ZodObject<{
|
|
3849
|
+
kind: z.ZodEnum<{
|
|
3850
|
+
Catalog: "Catalog";
|
|
3851
|
+
Document: "Document";
|
|
3852
|
+
Enumeration: "Enumeration";
|
|
3853
|
+
InformationRegister: "InformationRegister";
|
|
3854
|
+
AccumulationRegister: "AccumulationRegister";
|
|
3855
|
+
Constant: "Constant";
|
|
3856
|
+
CustomTable: "CustomTable";
|
|
3857
|
+
PgEnum: "PgEnum";
|
|
3858
|
+
EventSubscription: "EventSubscription";
|
|
3859
|
+
RightsSet: "RightsSet";
|
|
3860
|
+
Role: "Role";
|
|
3861
|
+
}>;
|
|
3862
|
+
name: z.ZodString;
|
|
3863
|
+
}, z.core.$strict>;
|
|
3864
|
+
id: z.ZodGUID;
|
|
3865
|
+
expectedVersion: z.ZodInt;
|
|
3866
|
+
values: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
3867
|
+
tabularSections: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
|
|
3868
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
3869
|
+
action: z.ZodLiteral<"markDeletion">;
|
|
3870
|
+
object: z.ZodObject<{
|
|
3871
|
+
kind: z.ZodEnum<{
|
|
3872
|
+
Catalog: "Catalog";
|
|
3873
|
+
Document: "Document";
|
|
3874
|
+
Enumeration: "Enumeration";
|
|
3875
|
+
InformationRegister: "InformationRegister";
|
|
3876
|
+
AccumulationRegister: "AccumulationRegister";
|
|
3877
|
+
Constant: "Constant";
|
|
3878
|
+
CustomTable: "CustomTable";
|
|
3879
|
+
PgEnum: "PgEnum";
|
|
3880
|
+
EventSubscription: "EventSubscription";
|
|
3881
|
+
RightsSet: "RightsSet";
|
|
3882
|
+
Role: "Role";
|
|
3883
|
+
}>;
|
|
3884
|
+
name: z.ZodString;
|
|
3885
|
+
}, z.core.$strict>;
|
|
3886
|
+
id: z.ZodGUID;
|
|
3887
|
+
expectedVersion: z.ZodInt;
|
|
3888
|
+
mark: z.ZodBoolean;
|
|
3889
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
3890
|
+
action: z.ZodLiteral<"delete">;
|
|
3891
|
+
object: z.ZodObject<{
|
|
3892
|
+
kind: z.ZodEnum<{
|
|
3893
|
+
Catalog: "Catalog";
|
|
3894
|
+
Document: "Document";
|
|
3895
|
+
Enumeration: "Enumeration";
|
|
3896
|
+
InformationRegister: "InformationRegister";
|
|
3897
|
+
AccumulationRegister: "AccumulationRegister";
|
|
3898
|
+
Constant: "Constant";
|
|
3899
|
+
CustomTable: "CustomTable";
|
|
3900
|
+
PgEnum: "PgEnum";
|
|
3901
|
+
EventSubscription: "EventSubscription";
|
|
3902
|
+
RightsSet: "RightsSet";
|
|
3903
|
+
Role: "Role";
|
|
3904
|
+
}>;
|
|
3905
|
+
name: z.ZodString;
|
|
3906
|
+
}, z.core.$strict>;
|
|
3907
|
+
id: z.ZodGUID;
|
|
3908
|
+
expectedVersion: z.ZodInt;
|
|
3909
|
+
}, z.core.$strict>], "action">;
|
|
3910
|
+
export type Operation = z.infer<typeof operationSchema>;
|
|
3911
|
+
/** A batch: a non-empty ordered list of operations run in one transaction. */
|
|
3912
|
+
export declare const batchSchema: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
3913
|
+
action: z.ZodLiteral<"create">;
|
|
3914
|
+
object: z.ZodObject<{
|
|
3915
|
+
kind: z.ZodEnum<{
|
|
3916
|
+
Catalog: "Catalog";
|
|
3917
|
+
Document: "Document";
|
|
3918
|
+
Enumeration: "Enumeration";
|
|
3919
|
+
InformationRegister: "InformationRegister";
|
|
3920
|
+
AccumulationRegister: "AccumulationRegister";
|
|
3921
|
+
Constant: "Constant";
|
|
3922
|
+
CustomTable: "CustomTable";
|
|
3923
|
+
PgEnum: "PgEnum";
|
|
3924
|
+
EventSubscription: "EventSubscription";
|
|
3925
|
+
RightsSet: "RightsSet";
|
|
3926
|
+
Role: "Role";
|
|
3927
|
+
}>;
|
|
3928
|
+
name: z.ZodString;
|
|
3929
|
+
}, z.core.$strict>;
|
|
3930
|
+
id: z.ZodOptional<z.ZodGUID>;
|
|
3931
|
+
values: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
3932
|
+
tabularSections: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
|
|
3933
|
+
creatorMember: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
3934
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
3935
|
+
action: z.ZodLiteral<"update">;
|
|
3936
|
+
object: z.ZodObject<{
|
|
3937
|
+
kind: z.ZodEnum<{
|
|
3938
|
+
Catalog: "Catalog";
|
|
3939
|
+
Document: "Document";
|
|
3940
|
+
Enumeration: "Enumeration";
|
|
3941
|
+
InformationRegister: "InformationRegister";
|
|
3942
|
+
AccumulationRegister: "AccumulationRegister";
|
|
3943
|
+
Constant: "Constant";
|
|
3944
|
+
CustomTable: "CustomTable";
|
|
3945
|
+
PgEnum: "PgEnum";
|
|
3946
|
+
EventSubscription: "EventSubscription";
|
|
3947
|
+
RightsSet: "RightsSet";
|
|
3948
|
+
Role: "Role";
|
|
3949
|
+
}>;
|
|
3950
|
+
name: z.ZodString;
|
|
3951
|
+
}, z.core.$strict>;
|
|
3952
|
+
id: z.ZodGUID;
|
|
3953
|
+
expectedVersion: z.ZodInt;
|
|
3954
|
+
values: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
3955
|
+
tabularSections: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
|
|
3956
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
3957
|
+
action: z.ZodLiteral<"markDeletion">;
|
|
3958
|
+
object: z.ZodObject<{
|
|
3959
|
+
kind: z.ZodEnum<{
|
|
3960
|
+
Catalog: "Catalog";
|
|
3961
|
+
Document: "Document";
|
|
3962
|
+
Enumeration: "Enumeration";
|
|
3963
|
+
InformationRegister: "InformationRegister";
|
|
3964
|
+
AccumulationRegister: "AccumulationRegister";
|
|
3965
|
+
Constant: "Constant";
|
|
3966
|
+
CustomTable: "CustomTable";
|
|
3967
|
+
PgEnum: "PgEnum";
|
|
3968
|
+
EventSubscription: "EventSubscription";
|
|
3969
|
+
RightsSet: "RightsSet";
|
|
3970
|
+
Role: "Role";
|
|
3971
|
+
}>;
|
|
3972
|
+
name: z.ZodString;
|
|
3973
|
+
}, z.core.$strict>;
|
|
3974
|
+
id: z.ZodGUID;
|
|
3975
|
+
expectedVersion: z.ZodInt;
|
|
3976
|
+
mark: z.ZodBoolean;
|
|
3977
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
3978
|
+
action: z.ZodLiteral<"delete">;
|
|
3979
|
+
object: z.ZodObject<{
|
|
3980
|
+
kind: z.ZodEnum<{
|
|
3981
|
+
Catalog: "Catalog";
|
|
3982
|
+
Document: "Document";
|
|
3983
|
+
Enumeration: "Enumeration";
|
|
3984
|
+
InformationRegister: "InformationRegister";
|
|
3985
|
+
AccumulationRegister: "AccumulationRegister";
|
|
3986
|
+
Constant: "Constant";
|
|
3987
|
+
CustomTable: "CustomTable";
|
|
3988
|
+
PgEnum: "PgEnum";
|
|
3989
|
+
EventSubscription: "EventSubscription";
|
|
3990
|
+
RightsSet: "RightsSet";
|
|
3991
|
+
Role: "Role";
|
|
3992
|
+
}>;
|
|
3993
|
+
name: z.ZodString;
|
|
3994
|
+
}, z.core.$strict>;
|
|
3995
|
+
id: z.ZodGUID;
|
|
3996
|
+
expectedVersion: z.ZodInt;
|
|
3997
|
+
}, z.core.$strict>], "action">>;
|
|
3998
|
+
export type Batch = z.infer<typeof batchSchema>;
|
|
3999
|
+
/** One row changed by a command. */
|
|
4000
|
+
export interface Change {
|
|
4001
|
+
object: MetadataRef;
|
|
4002
|
+
/** Id of the scope kind label from the runtime catalog. */
|
|
4003
|
+
scopeKind?: string;
|
|
4004
|
+
/** Present only for a scoped object. */
|
|
4005
|
+
scope?: string;
|
|
4006
|
+
id: string;
|
|
4007
|
+
version: number;
|
|
4008
|
+
operation: ObjectOperation;
|
|
4009
|
+
}
|
|
4010
|
+
/** The outcome of a command. */
|
|
4011
|
+
export interface CommandResult {
|
|
4012
|
+
/** One row per input operation, in input order. */
|
|
4013
|
+
rows: Record<string, unknown>[];
|
|
4014
|
+
/** Every phase, `ctx.run` included, in the order the core was called. */
|
|
4015
|
+
changes: Change[];
|
|
4016
|
+
}
|
|
4017
|
+
/** Error codes a command or the runtime factory reports (P4 spec §6.10). */
|
|
4018
|
+
export declare const COMMAND_ERROR_CODES: readonly ["command.forbidden", "command.conflict", "command.invalid", "command.constraint", "command.context", "command.unauthenticated", "command.rejected", "command.nested", "command.depth", "command.retry-exhausted", "command.model-mismatch", "command.read-role-missing", "command.unavailable", "command.internal"];
|
|
4019
|
+
export type CommandErrorCode = (typeof COMMAND_ERROR_CODES)[number];
|
|
4020
|
+
/**
|
|
4021
|
+
* An error as the outside sees it: a code and fields, never Postgres text.
|
|
4022
|
+
*/
|
|
4023
|
+
export interface CommandError {
|
|
4024
|
+
code: CommandErrorCode;
|
|
4025
|
+
reason?: string;
|
|
4026
|
+
object?: MetadataRef;
|
|
4027
|
+
operation?: ObjectOperation;
|
|
4028
|
+
/** Logical path of the offending input. */
|
|
4029
|
+
path?: string;
|
|
4030
|
+
detail?: string;
|
|
4031
|
+
currentVersion?: number;
|
|
4032
|
+
kind?: "notNull" | "unique" | "check";
|
|
4033
|
+
/** Logical attributes of the violated constraint. */
|
|
4034
|
+
attributes?: string[];
|
|
4035
|
+
hashes?: {
|
|
4036
|
+
catalog: string;
|
|
4037
|
+
applied: string | null;
|
|
4038
|
+
};
|
|
4039
|
+
role?: string;
|
|
4040
|
+
}
|
|
4041
|
+
/**
|
|
4042
|
+
* Claims of the verified session (P4 spec Рт19). Решта claims іде в базу як
|
|
4043
|
+
* є, тож схема їх не відкидає.
|
|
4044
|
+
*/
|
|
4045
|
+
export declare const sessionClaimsSchema: z.ZodObject<{
|
|
4046
|
+
sub: z.ZodString;
|
|
4047
|
+
act: z.ZodOptional<z.ZodObject<{
|
|
4048
|
+
sub: z.ZodString;
|
|
4049
|
+
}, z.core.$loose>>;
|
|
4050
|
+
}, z.core.$loose>;
|
|
4051
|
+
export type SessionClaims = z.infer<typeof sessionClaimsSchema>;
|
|
4052
|
+
/** Read access to request headers, whatever the host framework. */
|
|
4053
|
+
export interface HeaderSource {
|
|
4054
|
+
get(name: string): string | null;
|
|
4055
|
+
}
|
|
4056
|
+
/** The identity port the host supplies: `null` means no valid session. */
|
|
4057
|
+
export type VerifySession = (headers: HeaderSource) => Promise<SessionClaims | null>;
|
|
4058
|
+
/** Upper bound of one server read page (P4 spec §6.11). */
|
|
4059
|
+
export declare const READ_LIMIT_MAX = 200;
|
|
4060
|
+
/** A server read: one row by id or a keyset page by equality filter. */
|
|
4061
|
+
export declare const readQuerySchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
4062
|
+
object: z.ZodObject<{
|
|
4063
|
+
kind: z.ZodEnum<{
|
|
4064
|
+
Catalog: "Catalog";
|
|
4065
|
+
Document: "Document";
|
|
4066
|
+
Enumeration: "Enumeration";
|
|
4067
|
+
InformationRegister: "InformationRegister";
|
|
4068
|
+
AccumulationRegister: "AccumulationRegister";
|
|
4069
|
+
Constant: "Constant";
|
|
4070
|
+
CustomTable: "CustomTable";
|
|
4071
|
+
PgEnum: "PgEnum";
|
|
4072
|
+
EventSubscription: "EventSubscription";
|
|
4073
|
+
RightsSet: "RightsSet";
|
|
4074
|
+
Role: "Role";
|
|
4075
|
+
}>;
|
|
4076
|
+
name: z.ZodString;
|
|
4077
|
+
}, z.core.$strict>;
|
|
4078
|
+
id: z.ZodGUID;
|
|
4079
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
4080
|
+
object: z.ZodObject<{
|
|
4081
|
+
kind: z.ZodEnum<{
|
|
4082
|
+
Catalog: "Catalog";
|
|
4083
|
+
Document: "Document";
|
|
4084
|
+
Enumeration: "Enumeration";
|
|
4085
|
+
InformationRegister: "InformationRegister";
|
|
4086
|
+
AccumulationRegister: "AccumulationRegister";
|
|
4087
|
+
Constant: "Constant";
|
|
4088
|
+
CustomTable: "CustomTable";
|
|
4089
|
+
PgEnum: "PgEnum";
|
|
4090
|
+
EventSubscription: "EventSubscription";
|
|
4091
|
+
RightsSet: "RightsSet";
|
|
4092
|
+
Role: "Role";
|
|
4093
|
+
}>;
|
|
4094
|
+
name: z.ZodString;
|
|
4095
|
+
}, z.core.$strict>;
|
|
4096
|
+
where: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
4097
|
+
after: z.ZodOptional<z.ZodGUID>;
|
|
4098
|
+
limit: z.ZodInt;
|
|
4099
|
+
}, z.core.$strict>]>;
|
|
4100
|
+
export type ReadQuery = z.infer<typeof readQuerySchema>;
|
|
4101
|
+
/**
|
|
4102
|
+
* The input of a phase a `beforeWrite` hook may change. Без `id` і `mark`:
|
|
4103
|
+
* хук не перенаправляє операцію на інший рядок, а позначку бачить у
|
|
4104
|
+
* `ctx.mark` (Р-A3-18).
|
|
4105
|
+
*/
|
|
4106
|
+
export interface Draft<E> {
|
|
4107
|
+
values?: Partial<E>;
|
|
4108
|
+
tabularSections?: Record<string, Record<string, unknown>[]>;
|
|
4109
|
+
}
|
|
4110
|
+
/** What a hook sees and may do within its phase (P4 spec §6.9). */
|
|
4111
|
+
export interface HookContext {
|
|
4112
|
+
readonly object: MetadataRef;
|
|
4113
|
+
readonly id: string;
|
|
4114
|
+
/** The operation of the phase, not the action of the command context. */
|
|
4115
|
+
readonly action: ObjectOperation;
|
|
4116
|
+
readonly isNew: boolean;
|
|
4117
|
+
readonly mark?: boolean;
|
|
4118
|
+
/** Data shared by the hooks of one phase. */
|
|
4119
|
+
readonly additionalProperties: Map<string, unknown>;
|
|
4120
|
+
readonly user: string;
|
|
4121
|
+
readonly act?: {
|
|
4122
|
+
sub: string;
|
|
4123
|
+
};
|
|
4124
|
+
run(operation: Operation): Promise<Record<string, unknown>>;
|
|
4125
|
+
read(query: ReadQuery): Promise<Record<string, unknown>[]>;
|
|
4126
|
+
reject(code: string, path?: string): never;
|
|
4127
|
+
afterCommit(fn: () => unknown): void;
|
|
4128
|
+
}
|
|
4129
|
+
/**
|
|
4130
|
+
* Hooks of one object, keyed by 1C write events (P4 spec Рт20). Методи, а
|
|
4131
|
+
* не властивості-функції: так модуль типу сутності вкладається в мапу
|
|
4132
|
+
* `ObjectModule<object>` host-а.
|
|
4133
|
+
*/
|
|
4134
|
+
export interface ObjectModule<E extends object = Record<string, unknown>> {
|
|
4135
|
+
beforeWrite?(args: {
|
|
4136
|
+
ctx: HookContext;
|
|
4137
|
+
draft: Draft<E>;
|
|
4138
|
+
}): Draft<E> | Promise<Draft<E>>;
|
|
4139
|
+
onWrite?(args: {
|
|
4140
|
+
ctx: HookContext;
|
|
4141
|
+
row: E;
|
|
4142
|
+
}): void | Promise<void>;
|
|
4143
|
+
}
|
|
4144
|
+
/** Keys an object module may define. */
|
|
4145
|
+
export declare const OBJECT_MODULE_KEYS: readonly ["beforeWrite", "onWrite"];
|
|
4146
|
+
/** Types an object module by its generated entity type; returns it as is. */
|
|
4147
|
+
export declare function defineObjectModule<E extends object>(module: ObjectModule<E>): ObjectModule<E>;
|
|
4148
|
+
/**
|
|
4149
|
+
* Base types a bound parameter is cast to. Без `character`: `$n::character`
|
|
4150
|
+
* — це `char(1)`, який мовчки обрізав би значення.
|
|
4151
|
+
*/
|
|
4152
|
+
export declare const CAST_TYPES: readonly ["text", "uuid", "boolean", "smallint", "integer", "bigint", "numeric", "real", "double precision", "date", "timestamp with time zone", "timestamp without time zone", "time without time zone", "interval", "character varying", "bytea", "json", "jsonb"];
|
|
4153
|
+
export declare const castTypeSchema: z.ZodString;
|
|
4154
|
+
export declare const qualifiedNameSchema: z.ZodObject<{
|
|
4155
|
+
schema: z.ZodString;
|
|
4156
|
+
name: z.ZodString;
|
|
4157
|
+
}, z.core.$strict>;
|
|
4158
|
+
export declare const runtimeAttributeSchema: z.ZodObject<{
|
|
4159
|
+
name: z.ZodString;
|
|
4160
|
+
column: z.ZodString;
|
|
4161
|
+
pgType: z.ZodString;
|
|
4162
|
+
castType: z.ZodString;
|
|
4163
|
+
type: z.ZodEnum<{
|
|
4164
|
+
UUID: "UUID";
|
|
4165
|
+
String: "String";
|
|
4166
|
+
Text: "Text";
|
|
4167
|
+
Integer: "Integer";
|
|
4168
|
+
SmallInt: "SmallInt";
|
|
4169
|
+
BigInt: "BigInt";
|
|
4170
|
+
Numeric: "Numeric";
|
|
4171
|
+
Boolean: "Boolean";
|
|
4172
|
+
Date: "Date";
|
|
4173
|
+
DateTime: "DateTime";
|
|
4174
|
+
Bytes: "Bytes";
|
|
4175
|
+
Json: "Json";
|
|
4176
|
+
Ref: "Ref";
|
|
4177
|
+
Raw: "Raw";
|
|
4178
|
+
}>;
|
|
4179
|
+
array: z.ZodOptional<z.ZodLiteral<true>>;
|
|
4180
|
+
required: z.ZodBoolean;
|
|
4181
|
+
maxLength: z.ZodOptional<z.ZodInt>;
|
|
4182
|
+
precision: z.ZodOptional<z.ZodInt>;
|
|
4183
|
+
scale: z.ZodOptional<z.ZodInt>;
|
|
4184
|
+
insert: z.ZodBoolean;
|
|
4185
|
+
update: z.ZodBoolean;
|
|
4186
|
+
generated: z.ZodOptional<z.ZodLiteral<true>>;
|
|
4187
|
+
enumValues: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
4188
|
+
name: z.ZodString;
|
|
4189
|
+
label: z.ZodString;
|
|
4190
|
+
}, z.core.$strict>>>;
|
|
4191
|
+
pair: z.ZodOptional<z.ZodObject<{
|
|
4192
|
+
typeColumn: z.ZodString;
|
|
4193
|
+
targets: z.ZodArray<z.ZodObject<{
|
|
4194
|
+
object: z.ZodObject<{
|
|
4195
|
+
kind: z.ZodEnum<{
|
|
4196
|
+
Catalog: "Catalog";
|
|
4197
|
+
Document: "Document";
|
|
4198
|
+
Enumeration: "Enumeration";
|
|
4199
|
+
InformationRegister: "InformationRegister";
|
|
4200
|
+
AccumulationRegister: "AccumulationRegister";
|
|
4201
|
+
Constant: "Constant";
|
|
4202
|
+
CustomTable: "CustomTable";
|
|
4203
|
+
PgEnum: "PgEnum";
|
|
4204
|
+
EventSubscription: "EventSubscription";
|
|
4205
|
+
RightsSet: "RightsSet";
|
|
4206
|
+
Role: "Role";
|
|
4207
|
+
}>;
|
|
4208
|
+
name: z.ZodString;
|
|
4209
|
+
}, z.core.$strict>;
|
|
4210
|
+
label: z.ZodString;
|
|
4211
|
+
}, z.core.$strict>>;
|
|
4212
|
+
}, z.core.$strict>>;
|
|
4213
|
+
}, z.core.$strict>;
|
|
4214
|
+
export declare const runtimeConstraintSchema: z.ZodObject<{
|
|
4215
|
+
name: z.ZodString;
|
|
4216
|
+
kind: z.ZodEnum<{
|
|
4217
|
+
check: "check";
|
|
4218
|
+
primaryKey: "primaryKey";
|
|
4219
|
+
unique: "unique";
|
|
4220
|
+
foreignKey: "foreignKey";
|
|
4221
|
+
}>;
|
|
4222
|
+
columns: z.ZodArray<z.ZodString>;
|
|
4223
|
+
}, z.core.$strict>;
|
|
4224
|
+
export declare const runtimeSectionSchema: z.ZodObject<{
|
|
4225
|
+
name: z.ZodString;
|
|
4226
|
+
table: z.ZodObject<{
|
|
4227
|
+
schema: z.ZodString;
|
|
4228
|
+
name: z.ZodString;
|
|
4229
|
+
}, z.core.$strict>;
|
|
4230
|
+
key: z.ZodString;
|
|
4231
|
+
keyName: z.ZodString;
|
|
4232
|
+
parent: z.ZodString;
|
|
4233
|
+
parentName: z.ZodString;
|
|
4234
|
+
lineNumber: z.ZodString;
|
|
4235
|
+
lineNumberName: z.ZodString;
|
|
4236
|
+
attributes: z.ZodArray<z.ZodObject<{
|
|
4237
|
+
name: z.ZodString;
|
|
4238
|
+
column: z.ZodString;
|
|
4239
|
+
pgType: z.ZodString;
|
|
4240
|
+
castType: z.ZodString;
|
|
4241
|
+
type: z.ZodEnum<{
|
|
4242
|
+
UUID: "UUID";
|
|
4243
|
+
String: "String";
|
|
4244
|
+
Text: "Text";
|
|
4245
|
+
Integer: "Integer";
|
|
4246
|
+
SmallInt: "SmallInt";
|
|
4247
|
+
BigInt: "BigInt";
|
|
4248
|
+
Numeric: "Numeric";
|
|
4249
|
+
Boolean: "Boolean";
|
|
4250
|
+
Date: "Date";
|
|
4251
|
+
DateTime: "DateTime";
|
|
4252
|
+
Bytes: "Bytes";
|
|
4253
|
+
Json: "Json";
|
|
4254
|
+
Ref: "Ref";
|
|
4255
|
+
Raw: "Raw";
|
|
4256
|
+
}>;
|
|
4257
|
+
array: z.ZodOptional<z.ZodLiteral<true>>;
|
|
4258
|
+
required: z.ZodBoolean;
|
|
4259
|
+
maxLength: z.ZodOptional<z.ZodInt>;
|
|
4260
|
+
precision: z.ZodOptional<z.ZodInt>;
|
|
4261
|
+
scale: z.ZodOptional<z.ZodInt>;
|
|
4262
|
+
insert: z.ZodBoolean;
|
|
4263
|
+
update: z.ZodBoolean;
|
|
4264
|
+
generated: z.ZodOptional<z.ZodLiteral<true>>;
|
|
4265
|
+
enumValues: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
4266
|
+
name: z.ZodString;
|
|
4267
|
+
label: z.ZodString;
|
|
4268
|
+
}, z.core.$strict>>>;
|
|
4269
|
+
pair: z.ZodOptional<z.ZodObject<{
|
|
4270
|
+
typeColumn: z.ZodString;
|
|
4271
|
+
targets: z.ZodArray<z.ZodObject<{
|
|
4272
|
+
object: z.ZodObject<{
|
|
4273
|
+
kind: z.ZodEnum<{
|
|
4274
|
+
Catalog: "Catalog";
|
|
4275
|
+
Document: "Document";
|
|
4276
|
+
Enumeration: "Enumeration";
|
|
4277
|
+
InformationRegister: "InformationRegister";
|
|
4278
|
+
AccumulationRegister: "AccumulationRegister";
|
|
4279
|
+
Constant: "Constant";
|
|
4280
|
+
CustomTable: "CustomTable";
|
|
4281
|
+
PgEnum: "PgEnum";
|
|
4282
|
+
EventSubscription: "EventSubscription";
|
|
4283
|
+
RightsSet: "RightsSet";
|
|
4284
|
+
Role: "Role";
|
|
4285
|
+
}>;
|
|
4286
|
+
name: z.ZodString;
|
|
4287
|
+
}, z.core.$strict>;
|
|
4288
|
+
label: z.ZodString;
|
|
4289
|
+
}, z.core.$strict>>;
|
|
4290
|
+
}, z.core.$strict>>;
|
|
4291
|
+
}, z.core.$strict>>;
|
|
4292
|
+
constraints: z.ZodArray<z.ZodObject<{
|
|
4293
|
+
name: z.ZodString;
|
|
4294
|
+
kind: z.ZodEnum<{
|
|
4295
|
+
check: "check";
|
|
4296
|
+
primaryKey: "primaryKey";
|
|
4297
|
+
unique: "unique";
|
|
4298
|
+
foreignKey: "foreignKey";
|
|
4299
|
+
}>;
|
|
4300
|
+
columns: z.ZodArray<z.ZodString>;
|
|
4301
|
+
}, z.core.$strict>>;
|
|
4302
|
+
}, z.core.$strict>;
|
|
4303
|
+
export declare const runtimeOperationTargetSchema: z.ZodObject<{
|
|
4304
|
+
function: z.ZodObject<{
|
|
4305
|
+
schema: z.ZodString;
|
|
4306
|
+
name: z.ZodString;
|
|
4307
|
+
}, z.core.$strict>;
|
|
4308
|
+
context: z.ZodString;
|
|
4309
|
+
}, z.core.$strict>;
|
|
4310
|
+
/**
|
|
4311
|
+
* `create` кореня виду скоупу (спека П4 §6.13): T3 генерує id і відхиляє `id` і
|
|
4312
|
+
* `tabularSections`; `membership` — id довідника членства каталогу, коли вид
|
|
4313
|
+
* має роль з `rootCreator`: тоді `creatorMember` дозволений.
|
|
4314
|
+
*/
|
|
4315
|
+
export declare const runtimeRootCreateSchema: z.ZodObject<{
|
|
4316
|
+
membership: z.ZodOptional<z.ZodString>;
|
|
4317
|
+
}, z.core.$strict>;
|
|
4318
|
+
export declare const runtimeObjectSchema: z.ZodObject<{
|
|
4319
|
+
id: z.ZodString;
|
|
4320
|
+
name: z.ZodString;
|
|
4321
|
+
kind: z.ZodEnum<{
|
|
4322
|
+
Catalog: "Catalog";
|
|
4323
|
+
Document: "Document";
|
|
4324
|
+
Enumeration: "Enumeration";
|
|
4325
|
+
InformationRegister: "InformationRegister";
|
|
4326
|
+
AccumulationRegister: "AccumulationRegister";
|
|
4327
|
+
Constant: "Constant";
|
|
4328
|
+
CustomTable: "CustomTable";
|
|
4329
|
+
PgEnum: "PgEnum";
|
|
4330
|
+
EventSubscription: "EventSubscription";
|
|
4331
|
+
RightsSet: "RightsSet";
|
|
4332
|
+
Role: "Role";
|
|
4333
|
+
}>;
|
|
4334
|
+
kindLabel: z.ZodString;
|
|
4335
|
+
table: z.ZodObject<{
|
|
4336
|
+
schema: z.ZodString;
|
|
4337
|
+
name: z.ZodString;
|
|
4338
|
+
}, z.core.$strict>;
|
|
4339
|
+
key: z.ZodString;
|
|
4340
|
+
keyName: z.ZodString;
|
|
4341
|
+
versionColumn: z.ZodString;
|
|
4342
|
+
versionName: z.ZodString;
|
|
4343
|
+
scopeKindId: z.ZodOptional<z.ZodString>;
|
|
4344
|
+
scopeColumn: z.ZodOptional<z.ZodString>;
|
|
4345
|
+
membership: z.ZodOptional<z.ZodObject<{
|
|
4346
|
+
userColumn: z.ZodString;
|
|
4347
|
+
}, z.core.$strict>>;
|
|
4348
|
+
attributes: z.ZodArray<z.ZodObject<{
|
|
4349
|
+
name: z.ZodString;
|
|
4350
|
+
column: z.ZodString;
|
|
4351
|
+
pgType: z.ZodString;
|
|
4352
|
+
castType: z.ZodString;
|
|
4353
|
+
type: z.ZodEnum<{
|
|
4354
|
+
UUID: "UUID";
|
|
4355
|
+
String: "String";
|
|
4356
|
+
Text: "Text";
|
|
4357
|
+
Integer: "Integer";
|
|
4358
|
+
SmallInt: "SmallInt";
|
|
4359
|
+
BigInt: "BigInt";
|
|
4360
|
+
Numeric: "Numeric";
|
|
4361
|
+
Boolean: "Boolean";
|
|
4362
|
+
Date: "Date";
|
|
4363
|
+
DateTime: "DateTime";
|
|
4364
|
+
Bytes: "Bytes";
|
|
4365
|
+
Json: "Json";
|
|
4366
|
+
Ref: "Ref";
|
|
4367
|
+
Raw: "Raw";
|
|
4368
|
+
}>;
|
|
4369
|
+
array: z.ZodOptional<z.ZodLiteral<true>>;
|
|
4370
|
+
required: z.ZodBoolean;
|
|
4371
|
+
maxLength: z.ZodOptional<z.ZodInt>;
|
|
4372
|
+
precision: z.ZodOptional<z.ZodInt>;
|
|
4373
|
+
scale: z.ZodOptional<z.ZodInt>;
|
|
4374
|
+
insert: z.ZodBoolean;
|
|
4375
|
+
update: z.ZodBoolean;
|
|
4376
|
+
generated: z.ZodOptional<z.ZodLiteral<true>>;
|
|
4377
|
+
enumValues: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
4378
|
+
name: z.ZodString;
|
|
4379
|
+
label: z.ZodString;
|
|
4380
|
+
}, z.core.$strict>>>;
|
|
4381
|
+
pair: z.ZodOptional<z.ZodObject<{
|
|
4382
|
+
typeColumn: z.ZodString;
|
|
4383
|
+
targets: z.ZodArray<z.ZodObject<{
|
|
4384
|
+
object: z.ZodObject<{
|
|
4385
|
+
kind: z.ZodEnum<{
|
|
4386
|
+
Catalog: "Catalog";
|
|
4387
|
+
Document: "Document";
|
|
4388
|
+
Enumeration: "Enumeration";
|
|
4389
|
+
InformationRegister: "InformationRegister";
|
|
4390
|
+
AccumulationRegister: "AccumulationRegister";
|
|
4391
|
+
Constant: "Constant";
|
|
4392
|
+
CustomTable: "CustomTable";
|
|
4393
|
+
PgEnum: "PgEnum";
|
|
4394
|
+
EventSubscription: "EventSubscription";
|
|
4395
|
+
RightsSet: "RightsSet";
|
|
4396
|
+
Role: "Role";
|
|
4397
|
+
}>;
|
|
4398
|
+
name: z.ZodString;
|
|
4399
|
+
}, z.core.$strict>;
|
|
4400
|
+
label: z.ZodString;
|
|
4401
|
+
}, z.core.$strict>>;
|
|
4402
|
+
}, z.core.$strict>>;
|
|
4403
|
+
}, z.core.$strict>>;
|
|
4404
|
+
tabularSections: z.ZodArray<z.ZodObject<{
|
|
4405
|
+
name: z.ZodString;
|
|
4406
|
+
table: z.ZodObject<{
|
|
4407
|
+
schema: z.ZodString;
|
|
4408
|
+
name: z.ZodString;
|
|
4409
|
+
}, z.core.$strict>;
|
|
4410
|
+
key: z.ZodString;
|
|
4411
|
+
keyName: z.ZodString;
|
|
4412
|
+
parent: z.ZodString;
|
|
4413
|
+
parentName: z.ZodString;
|
|
4414
|
+
lineNumber: z.ZodString;
|
|
4415
|
+
lineNumberName: z.ZodString;
|
|
4416
|
+
attributes: z.ZodArray<z.ZodObject<{
|
|
4417
|
+
name: z.ZodString;
|
|
4418
|
+
column: z.ZodString;
|
|
4419
|
+
pgType: z.ZodString;
|
|
4420
|
+
castType: z.ZodString;
|
|
4421
|
+
type: z.ZodEnum<{
|
|
4422
|
+
UUID: "UUID";
|
|
4423
|
+
String: "String";
|
|
4424
|
+
Text: "Text";
|
|
4425
|
+
Integer: "Integer";
|
|
4426
|
+
SmallInt: "SmallInt";
|
|
4427
|
+
BigInt: "BigInt";
|
|
4428
|
+
Numeric: "Numeric";
|
|
4429
|
+
Boolean: "Boolean";
|
|
4430
|
+
Date: "Date";
|
|
4431
|
+
DateTime: "DateTime";
|
|
4432
|
+
Bytes: "Bytes";
|
|
4433
|
+
Json: "Json";
|
|
4434
|
+
Ref: "Ref";
|
|
4435
|
+
Raw: "Raw";
|
|
4436
|
+
}>;
|
|
4437
|
+
array: z.ZodOptional<z.ZodLiteral<true>>;
|
|
4438
|
+
required: z.ZodBoolean;
|
|
4439
|
+
maxLength: z.ZodOptional<z.ZodInt>;
|
|
4440
|
+
precision: z.ZodOptional<z.ZodInt>;
|
|
4441
|
+
scale: z.ZodOptional<z.ZodInt>;
|
|
4442
|
+
insert: z.ZodBoolean;
|
|
4443
|
+
update: z.ZodBoolean;
|
|
4444
|
+
generated: z.ZodOptional<z.ZodLiteral<true>>;
|
|
4445
|
+
enumValues: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
4446
|
+
name: z.ZodString;
|
|
4447
|
+
label: z.ZodString;
|
|
4448
|
+
}, z.core.$strict>>>;
|
|
4449
|
+
pair: z.ZodOptional<z.ZodObject<{
|
|
4450
|
+
typeColumn: z.ZodString;
|
|
4451
|
+
targets: z.ZodArray<z.ZodObject<{
|
|
4452
|
+
object: z.ZodObject<{
|
|
4453
|
+
kind: z.ZodEnum<{
|
|
4454
|
+
Catalog: "Catalog";
|
|
4455
|
+
Document: "Document";
|
|
4456
|
+
Enumeration: "Enumeration";
|
|
4457
|
+
InformationRegister: "InformationRegister";
|
|
4458
|
+
AccumulationRegister: "AccumulationRegister";
|
|
4459
|
+
Constant: "Constant";
|
|
4460
|
+
CustomTable: "CustomTable";
|
|
4461
|
+
PgEnum: "PgEnum";
|
|
4462
|
+
EventSubscription: "EventSubscription";
|
|
4463
|
+
RightsSet: "RightsSet";
|
|
4464
|
+
Role: "Role";
|
|
4465
|
+
}>;
|
|
4466
|
+
name: z.ZodString;
|
|
4467
|
+
}, z.core.$strict>;
|
|
4468
|
+
label: z.ZodString;
|
|
4469
|
+
}, z.core.$strict>>;
|
|
4470
|
+
}, z.core.$strict>>;
|
|
4471
|
+
}, z.core.$strict>>;
|
|
4472
|
+
constraints: z.ZodArray<z.ZodObject<{
|
|
4473
|
+
name: z.ZodString;
|
|
4474
|
+
kind: z.ZodEnum<{
|
|
4475
|
+
check: "check";
|
|
4476
|
+
primaryKey: "primaryKey";
|
|
4477
|
+
unique: "unique";
|
|
4478
|
+
foreignKey: "foreignKey";
|
|
4479
|
+
}>;
|
|
4480
|
+
columns: z.ZodArray<z.ZodString>;
|
|
4481
|
+
}, z.core.$strict>>;
|
|
4482
|
+
}, z.core.$strict>>;
|
|
4483
|
+
operations: z.ZodObject<{
|
|
4484
|
+
create: z.ZodOptional<z.ZodObject<{
|
|
4485
|
+
function: z.ZodObject<{
|
|
4486
|
+
schema: z.ZodString;
|
|
4487
|
+
name: z.ZodString;
|
|
4488
|
+
}, z.core.$strict>;
|
|
4489
|
+
context: z.ZodString;
|
|
4490
|
+
root: z.ZodOptional<z.ZodObject<{
|
|
4491
|
+
membership: z.ZodOptional<z.ZodString>;
|
|
4492
|
+
}, z.core.$strict>>;
|
|
4493
|
+
}, z.core.$strict>>;
|
|
4494
|
+
update: z.ZodOptional<z.ZodObject<{
|
|
4495
|
+
function: z.ZodObject<{
|
|
4496
|
+
schema: z.ZodString;
|
|
4497
|
+
name: z.ZodString;
|
|
4498
|
+
}, z.core.$strict>;
|
|
4499
|
+
context: z.ZodString;
|
|
4500
|
+
}, z.core.$strict>>;
|
|
4501
|
+
markDeletion: z.ZodOptional<z.ZodObject<{
|
|
4502
|
+
function: z.ZodObject<{
|
|
4503
|
+
schema: z.ZodString;
|
|
4504
|
+
name: z.ZodString;
|
|
4505
|
+
}, z.core.$strict>;
|
|
4506
|
+
context: z.ZodString;
|
|
4507
|
+
}, z.core.$strict>>;
|
|
4508
|
+
delete: z.ZodOptional<z.ZodObject<{
|
|
4509
|
+
function: z.ZodObject<{
|
|
4510
|
+
schema: z.ZodString;
|
|
4511
|
+
name: z.ZodString;
|
|
4512
|
+
}, z.core.$strict>;
|
|
4513
|
+
context: z.ZodString;
|
|
4514
|
+
}, z.core.$strict>>;
|
|
4515
|
+
}, z.core.$strict>;
|
|
4516
|
+
constraints: z.ZodArray<z.ZodObject<{
|
|
4517
|
+
name: z.ZodString;
|
|
4518
|
+
kind: z.ZodEnum<{
|
|
4519
|
+
check: "check";
|
|
4520
|
+
primaryKey: "primaryKey";
|
|
4521
|
+
unique: "unique";
|
|
4522
|
+
foreignKey: "foreignKey";
|
|
4523
|
+
}>;
|
|
4524
|
+
columns: z.ZodArray<z.ZodString>;
|
|
4525
|
+
}, z.core.$strict>>;
|
|
4526
|
+
}, z.core.$strict>;
|
|
4527
|
+
/** The runtime catalog: a projection of the compiled model (P4 spec §6.3). */
|
|
4528
|
+
export declare const runtimeCatalogSchema: z.ZodObject<{
|
|
4529
|
+
format: z.ZodLiteral<1>;
|
|
4530
|
+
snapshotHash: z.ZodString;
|
|
4531
|
+
provider: z.ZodEnum<{
|
|
4532
|
+
supabase: "supabase";
|
|
4533
|
+
}>;
|
|
4534
|
+
objects: z.ZodArray<z.ZodObject<{
|
|
4535
|
+
id: z.ZodString;
|
|
4536
|
+
name: z.ZodString;
|
|
4537
|
+
kind: z.ZodEnum<{
|
|
4538
|
+
Catalog: "Catalog";
|
|
4539
|
+
Document: "Document";
|
|
4540
|
+
Enumeration: "Enumeration";
|
|
4541
|
+
InformationRegister: "InformationRegister";
|
|
4542
|
+
AccumulationRegister: "AccumulationRegister";
|
|
4543
|
+
Constant: "Constant";
|
|
4544
|
+
CustomTable: "CustomTable";
|
|
4545
|
+
PgEnum: "PgEnum";
|
|
4546
|
+
EventSubscription: "EventSubscription";
|
|
4547
|
+
RightsSet: "RightsSet";
|
|
4548
|
+
Role: "Role";
|
|
4549
|
+
}>;
|
|
4550
|
+
kindLabel: z.ZodString;
|
|
4551
|
+
table: z.ZodObject<{
|
|
4552
|
+
schema: z.ZodString;
|
|
4553
|
+
name: z.ZodString;
|
|
4554
|
+
}, z.core.$strict>;
|
|
4555
|
+
key: z.ZodString;
|
|
4556
|
+
keyName: z.ZodString;
|
|
4557
|
+
versionColumn: z.ZodString;
|
|
4558
|
+
versionName: z.ZodString;
|
|
4559
|
+
scopeKindId: z.ZodOptional<z.ZodString>;
|
|
4560
|
+
scopeColumn: z.ZodOptional<z.ZodString>;
|
|
4561
|
+
membership: z.ZodOptional<z.ZodObject<{
|
|
4562
|
+
userColumn: z.ZodString;
|
|
4563
|
+
}, z.core.$strict>>;
|
|
4564
|
+
attributes: z.ZodArray<z.ZodObject<{
|
|
4565
|
+
name: z.ZodString;
|
|
4566
|
+
column: z.ZodString;
|
|
4567
|
+
pgType: z.ZodString;
|
|
4568
|
+
castType: z.ZodString;
|
|
4569
|
+
type: z.ZodEnum<{
|
|
4570
|
+
UUID: "UUID";
|
|
4571
|
+
String: "String";
|
|
4572
|
+
Text: "Text";
|
|
4573
|
+
Integer: "Integer";
|
|
4574
|
+
SmallInt: "SmallInt";
|
|
4575
|
+
BigInt: "BigInt";
|
|
4576
|
+
Numeric: "Numeric";
|
|
4577
|
+
Boolean: "Boolean";
|
|
4578
|
+
Date: "Date";
|
|
4579
|
+
DateTime: "DateTime";
|
|
4580
|
+
Bytes: "Bytes";
|
|
4581
|
+
Json: "Json";
|
|
4582
|
+
Ref: "Ref";
|
|
4583
|
+
Raw: "Raw";
|
|
4584
|
+
}>;
|
|
4585
|
+
array: z.ZodOptional<z.ZodLiteral<true>>;
|
|
4586
|
+
required: z.ZodBoolean;
|
|
4587
|
+
maxLength: z.ZodOptional<z.ZodInt>;
|
|
4588
|
+
precision: z.ZodOptional<z.ZodInt>;
|
|
4589
|
+
scale: z.ZodOptional<z.ZodInt>;
|
|
4590
|
+
insert: z.ZodBoolean;
|
|
4591
|
+
update: z.ZodBoolean;
|
|
4592
|
+
generated: z.ZodOptional<z.ZodLiteral<true>>;
|
|
4593
|
+
enumValues: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
4594
|
+
name: z.ZodString;
|
|
4595
|
+
label: z.ZodString;
|
|
4596
|
+
}, z.core.$strict>>>;
|
|
4597
|
+
pair: z.ZodOptional<z.ZodObject<{
|
|
4598
|
+
typeColumn: z.ZodString;
|
|
4599
|
+
targets: z.ZodArray<z.ZodObject<{
|
|
4600
|
+
object: z.ZodObject<{
|
|
4601
|
+
kind: z.ZodEnum<{
|
|
4602
|
+
Catalog: "Catalog";
|
|
4603
|
+
Document: "Document";
|
|
4604
|
+
Enumeration: "Enumeration";
|
|
4605
|
+
InformationRegister: "InformationRegister";
|
|
4606
|
+
AccumulationRegister: "AccumulationRegister";
|
|
4607
|
+
Constant: "Constant";
|
|
4608
|
+
CustomTable: "CustomTable";
|
|
4609
|
+
PgEnum: "PgEnum";
|
|
4610
|
+
EventSubscription: "EventSubscription";
|
|
4611
|
+
RightsSet: "RightsSet";
|
|
4612
|
+
Role: "Role";
|
|
4613
|
+
}>;
|
|
4614
|
+
name: z.ZodString;
|
|
4615
|
+
}, z.core.$strict>;
|
|
4616
|
+
label: z.ZodString;
|
|
4617
|
+
}, z.core.$strict>>;
|
|
4618
|
+
}, z.core.$strict>>;
|
|
4619
|
+
}, z.core.$strict>>;
|
|
4620
|
+
tabularSections: z.ZodArray<z.ZodObject<{
|
|
4621
|
+
name: z.ZodString;
|
|
4622
|
+
table: z.ZodObject<{
|
|
4623
|
+
schema: z.ZodString;
|
|
4624
|
+
name: z.ZodString;
|
|
4625
|
+
}, z.core.$strict>;
|
|
4626
|
+
key: z.ZodString;
|
|
4627
|
+
keyName: z.ZodString;
|
|
4628
|
+
parent: z.ZodString;
|
|
4629
|
+
parentName: z.ZodString;
|
|
4630
|
+
lineNumber: z.ZodString;
|
|
4631
|
+
lineNumberName: z.ZodString;
|
|
4632
|
+
attributes: z.ZodArray<z.ZodObject<{
|
|
4633
|
+
name: z.ZodString;
|
|
4634
|
+
column: z.ZodString;
|
|
4635
|
+
pgType: z.ZodString;
|
|
4636
|
+
castType: z.ZodString;
|
|
4637
|
+
type: z.ZodEnum<{
|
|
4638
|
+
UUID: "UUID";
|
|
4639
|
+
String: "String";
|
|
4640
|
+
Text: "Text";
|
|
4641
|
+
Integer: "Integer";
|
|
4642
|
+
SmallInt: "SmallInt";
|
|
4643
|
+
BigInt: "BigInt";
|
|
4644
|
+
Numeric: "Numeric";
|
|
4645
|
+
Boolean: "Boolean";
|
|
4646
|
+
Date: "Date";
|
|
4647
|
+
DateTime: "DateTime";
|
|
4648
|
+
Bytes: "Bytes";
|
|
4649
|
+
Json: "Json";
|
|
4650
|
+
Ref: "Ref";
|
|
4651
|
+
Raw: "Raw";
|
|
4652
|
+
}>;
|
|
4653
|
+
array: z.ZodOptional<z.ZodLiteral<true>>;
|
|
4654
|
+
required: z.ZodBoolean;
|
|
4655
|
+
maxLength: z.ZodOptional<z.ZodInt>;
|
|
4656
|
+
precision: z.ZodOptional<z.ZodInt>;
|
|
4657
|
+
scale: z.ZodOptional<z.ZodInt>;
|
|
4658
|
+
insert: z.ZodBoolean;
|
|
4659
|
+
update: z.ZodBoolean;
|
|
4660
|
+
generated: z.ZodOptional<z.ZodLiteral<true>>;
|
|
4661
|
+
enumValues: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
4662
|
+
name: z.ZodString;
|
|
4663
|
+
label: z.ZodString;
|
|
4664
|
+
}, z.core.$strict>>>;
|
|
4665
|
+
pair: z.ZodOptional<z.ZodObject<{
|
|
4666
|
+
typeColumn: z.ZodString;
|
|
4667
|
+
targets: z.ZodArray<z.ZodObject<{
|
|
4668
|
+
object: z.ZodObject<{
|
|
4669
|
+
kind: z.ZodEnum<{
|
|
4670
|
+
Catalog: "Catalog";
|
|
4671
|
+
Document: "Document";
|
|
4672
|
+
Enumeration: "Enumeration";
|
|
4673
|
+
InformationRegister: "InformationRegister";
|
|
4674
|
+
AccumulationRegister: "AccumulationRegister";
|
|
4675
|
+
Constant: "Constant";
|
|
4676
|
+
CustomTable: "CustomTable";
|
|
4677
|
+
PgEnum: "PgEnum";
|
|
4678
|
+
EventSubscription: "EventSubscription";
|
|
4679
|
+
RightsSet: "RightsSet";
|
|
4680
|
+
Role: "Role";
|
|
4681
|
+
}>;
|
|
4682
|
+
name: z.ZodString;
|
|
4683
|
+
}, z.core.$strict>;
|
|
4684
|
+
label: z.ZodString;
|
|
4685
|
+
}, z.core.$strict>>;
|
|
4686
|
+
}, z.core.$strict>>;
|
|
4687
|
+
}, z.core.$strict>>;
|
|
4688
|
+
constraints: z.ZodArray<z.ZodObject<{
|
|
4689
|
+
name: z.ZodString;
|
|
4690
|
+
kind: z.ZodEnum<{
|
|
4691
|
+
check: "check";
|
|
4692
|
+
primaryKey: "primaryKey";
|
|
4693
|
+
unique: "unique";
|
|
4694
|
+
foreignKey: "foreignKey";
|
|
4695
|
+
}>;
|
|
4696
|
+
columns: z.ZodArray<z.ZodString>;
|
|
4697
|
+
}, z.core.$strict>>;
|
|
4698
|
+
}, z.core.$strict>>;
|
|
4699
|
+
operations: z.ZodObject<{
|
|
4700
|
+
create: z.ZodOptional<z.ZodObject<{
|
|
4701
|
+
function: z.ZodObject<{
|
|
4702
|
+
schema: z.ZodString;
|
|
4703
|
+
name: z.ZodString;
|
|
4704
|
+
}, z.core.$strict>;
|
|
4705
|
+
context: z.ZodString;
|
|
4706
|
+
root: z.ZodOptional<z.ZodObject<{
|
|
4707
|
+
membership: z.ZodOptional<z.ZodString>;
|
|
4708
|
+
}, z.core.$strict>>;
|
|
4709
|
+
}, z.core.$strict>>;
|
|
4710
|
+
update: z.ZodOptional<z.ZodObject<{
|
|
4711
|
+
function: z.ZodObject<{
|
|
4712
|
+
schema: z.ZodString;
|
|
4713
|
+
name: z.ZodString;
|
|
4714
|
+
}, z.core.$strict>;
|
|
4715
|
+
context: z.ZodString;
|
|
4716
|
+
}, z.core.$strict>>;
|
|
4717
|
+
markDeletion: z.ZodOptional<z.ZodObject<{
|
|
4718
|
+
function: z.ZodObject<{
|
|
4719
|
+
schema: z.ZodString;
|
|
4720
|
+
name: z.ZodString;
|
|
4721
|
+
}, z.core.$strict>;
|
|
4722
|
+
context: z.ZodString;
|
|
4723
|
+
}, z.core.$strict>>;
|
|
4724
|
+
delete: z.ZodOptional<z.ZodObject<{
|
|
4725
|
+
function: z.ZodObject<{
|
|
4726
|
+
schema: z.ZodString;
|
|
4727
|
+
name: z.ZodString;
|
|
4728
|
+
}, z.core.$strict>;
|
|
4729
|
+
context: z.ZodString;
|
|
4730
|
+
}, z.core.$strict>>;
|
|
4731
|
+
}, z.core.$strict>;
|
|
4732
|
+
constraints: z.ZodArray<z.ZodObject<{
|
|
4733
|
+
name: z.ZodString;
|
|
4734
|
+
kind: z.ZodEnum<{
|
|
4735
|
+
check: "check";
|
|
4736
|
+
primaryKey: "primaryKey";
|
|
4737
|
+
unique: "unique";
|
|
4738
|
+
foreignKey: "foreignKey";
|
|
4739
|
+
}>;
|
|
4740
|
+
columns: z.ZodArray<z.ZodString>;
|
|
4741
|
+
}, z.core.$strict>>;
|
|
4742
|
+
}, z.core.$strict>>;
|
|
4743
|
+
}, z.core.$strict>;
|
|
4744
|
+
/** A base cast type; `castTypeSchema` also accepts its array form. */
|
|
4745
|
+
export type BaseCastType = (typeof CAST_TYPES)[number];
|
|
4746
|
+
export type QualifiedName = z.infer<typeof qualifiedNameSchema>;
|
|
4747
|
+
export type RuntimeAttribute = z.infer<typeof runtimeAttributeSchema>;
|
|
4748
|
+
export type RuntimeConstraint = z.infer<typeof runtimeConstraintSchema>;
|
|
4749
|
+
export type RuntimeSection = z.infer<typeof runtimeSectionSchema>;
|
|
4750
|
+
export type RuntimeOperationTarget = z.infer<typeof runtimeOperationTargetSchema>;
|
|
4751
|
+
export type RuntimeRootCreate = z.infer<typeof runtimeRootCreateSchema>;
|
|
4752
|
+
export type RuntimeObject = z.infer<typeof runtimeObjectSchema>;
|
|
4753
|
+
export type RuntimeCatalog = z.infer<typeof runtimeCatalogSchema>;
|
|
4754
|
+
/**
|
|
4755
|
+
* Кодування значень за каталогом рантайму (Р-A3-7, Р-A4-12): вхід за
|
|
4756
|
+
* логічними іменами перевіряється до бази — тип, межі, довжина, точність, —
|
|
4757
|
+
* щоб база не округлила й не обрізала його мовчки. Живе в T0, бо його
|
|
4758
|
+
* споживають і T3 (команди), і T2 (інструмент обслуговування прав): T2 не
|
|
4759
|
+
* може імпортувати T3.
|
|
4760
|
+
*/
|
|
4761
|
+
export type Encoded<T> = {
|
|
4762
|
+
value: T;
|
|
4763
|
+
} | {
|
|
4764
|
+
error: CommandError;
|
|
4765
|
+
};
|
|
4766
|
+
export declare const INTEGER_TEXT: RegExp;
|
|
4767
|
+
export declare function isPlainObject(value: unknown): value is Record<string, unknown>;
|
|
4768
|
+
/**
|
|
4769
|
+
* A polymorphic pair `{ type: "<Kind>.<Name>", id }` as the label and the id
|
|
4770
|
+
* of its two columns.
|
|
4771
|
+
*/
|
|
4772
|
+
export declare function encodePair(attribute: RuntimeAttribute, value: unknown, path: string): Encoded<{
|
|
4773
|
+
label: string | null;
|
|
4774
|
+
id: string | null;
|
|
4775
|
+
}>;
|
|
4776
|
+
/**
|
|
4777
|
+
* A logical value as JSON for `p_item` (`jsonb_populate_record`); a pair
|
|
4778
|
+
* yields both of its columns.
|
|
4779
|
+
*/
|
|
4780
|
+
export declare function encodeItemValue(attribute: RuntimeAttribute, value: unknown, path: string): Encoded<unknown>;
|
|
4781
|
+
/** Options of {@link encodeAttributes}: who may write and how errors are named. */
|
|
4782
|
+
export interface EncodeAttributesOptions {
|
|
4783
|
+
/** Чи пише вхід реквізит: грант вставки чи оновлення. */
|
|
4784
|
+
allowed: (attribute: RuntimeAttribute) => boolean;
|
|
4785
|
+
/** Логічні імена, які примушує платформа (ключ, скоуп, користувач учасника). */
|
|
4786
|
+
forced?: readonly string[];
|
|
4787
|
+
/** Шлях самого контейнера: відмова, коли він не простий об'єкт. */
|
|
4788
|
+
path: string;
|
|
4789
|
+
/** Префікс шляху реквізиту й невідомого ключа. */
|
|
4790
|
+
prefix: string;
|
|
4791
|
+
/** Ключ рядка ТЧ: його пише викликач, а не обхід. */
|
|
4792
|
+
rowKey?: string;
|
|
4793
|
+
}
|
|
4794
|
+
/**
|
|
4795
|
+
* Один обхід реквізитів значень (Р-A6-13): шапка операції, рядок ТЧ,
|
|
4796
|
+
* `creatorMember` і `member` інструмента обслуговування кодуються тут, тож
|
|
4797
|
+
* шляхи не розходяться. `values` — простий об'єкт, де кожен ключ — реквізит
|
|
4798
|
+
* каталогу, дозволений `allowed` і не примушений. Результат — фізичні
|
|
4799
|
+
* колонки → значення для `jsonb_populate_record`. Перша помилка (Р-A3-8):
|
|
4800
|
+
* реквізити — за порядком каталогу, невідомі ключі — після них, за порядком
|
|
4801
|
+
* входу.
|
|
4802
|
+
*/
|
|
4803
|
+
export declare function encodeAttributes(attributes: readonly RuntimeAttribute[], values: unknown, options: EncodeAttributesOptions): {
|
|
4804
|
+
columns: Record<string, unknown>;
|
|
4805
|
+
} | {
|
|
4806
|
+
error: CommandError;
|
|
4807
|
+
};
|
|
4808
|
+
/**
|
|
4809
|
+
* Контракт фізичного знімка (спека §8.3). Живе в T0, бо з нього будують
|
|
4810
|
+
* рендер, хеш і `explain`, а extract адаптера мапиться в ті самі типи.
|
|
4811
|
+
* Масиви `uniques`/`checks`/`foreignKeys`/`indexes` відсортовані за `name`,
|
|
4812
|
+
* `tables` і `enumTypes` — за `(schema, name)`: знімок детермінований, тож
|
|
4813
|
+
* порівняння й хеш не залежать від порядку обходу.
|
|
4814
|
+
*/
|
|
4815
|
+
export interface PhysicalSnapshot {
|
|
4816
|
+
tables: PhysicalTable[];
|
|
4817
|
+
enumTypes: PhysicalEnumType[];
|
|
4818
|
+
}
|
|
4819
|
+
/** Звідки в метаданих походить фізичний об'єкт (для `explain`). */
|
|
4820
|
+
export interface PhysicalOrigin {
|
|
4821
|
+
objectId: string;
|
|
4822
|
+
tabularSectionId?: string;
|
|
4823
|
+
/**
|
|
4824
|
+
* Похідна таблиця об'єкта поруч з основною: поточні підсумки регістра, його
|
|
4825
|
+
* місячні обороти або зв'язок ідентичностей довідника «Користувачі» в схемі
|
|
4826
|
+
* платформи.
|
|
4827
|
+
*/
|
|
4828
|
+
part?: "totals" | "turnoversMonth" | "identities" | "rightsVersions" | "rightsJournal" | "rightsTxHeader" | "rightsTxTyped" | "rightsTxContainers" | "rightsTxDeltas" | "rightsTxHolders" | "rightsTxStart" | "rightsTxScopes" | "rightsTxValues" | "rightsTxScopeSets" | "rightsTxPending" | "rightsTxRootMarker";
|
|
4829
|
+
}
|
|
4830
|
+
export interface PhysicalEnumType {
|
|
4831
|
+
schema: string;
|
|
4832
|
+
name: string;
|
|
4833
|
+
values: string[];
|
|
4834
|
+
origin: PhysicalOrigin;
|
|
4835
|
+
}
|
|
4836
|
+
export interface PhysicalTable {
|
|
4837
|
+
schema: string;
|
|
4838
|
+
name: string;
|
|
4839
|
+
comment?: string;
|
|
4840
|
+
origin: PhysicalOrigin;
|
|
4841
|
+
/**
|
|
4842
|
+
* Похідні таблиці регістра й рядки ТЧ мають RLS власника: інакше вони
|
|
4843
|
+
* відкривали б дані, закриті в основній таблиці.
|
|
4844
|
+
*/
|
|
4845
|
+
rowLevelSecurity: RowLevelSecurity;
|
|
4846
|
+
/** У порядку оголошення. */
|
|
4847
|
+
columns: PhysicalColumn[];
|
|
4848
|
+
primaryKey?: {
|
|
4849
|
+
name: string;
|
|
4850
|
+
columns: string[];
|
|
4851
|
+
deferrable?: DeferredConstraint;
|
|
4852
|
+
};
|
|
4853
|
+
uniques: {
|
|
4854
|
+
name: string;
|
|
4855
|
+
columns: string[];
|
|
4856
|
+
nullsNotDistinct: boolean;
|
|
4857
|
+
deferrable?: DeferredConstraint;
|
|
4858
|
+
}[];
|
|
4859
|
+
checks: PhysicalCheck[];
|
|
4860
|
+
foreignKeys: {
|
|
4861
|
+
name: string;
|
|
4862
|
+
columns: string[];
|
|
4863
|
+
references: {
|
|
4864
|
+
schema: string;
|
|
4865
|
+
table: string;
|
|
4866
|
+
columns: string[];
|
|
4867
|
+
};
|
|
4868
|
+
onDelete: FkAction;
|
|
4869
|
+
onUpdate: FkAction;
|
|
4870
|
+
deferrable: "no" | "deferrable" | "initiallyDeferred";
|
|
4871
|
+
}[];
|
|
4872
|
+
indexes: {
|
|
4873
|
+
name: string;
|
|
4874
|
+
unique: boolean;
|
|
4875
|
+
method: string;
|
|
4876
|
+
keys: PhysicalIndexKey[];
|
|
4877
|
+
include: string[];
|
|
4878
|
+
where?: string;
|
|
4879
|
+
nullsNotDistinct: boolean;
|
|
4880
|
+
}[];
|
|
4881
|
+
}
|
|
4882
|
+
/**
|
|
4883
|
+
* CHECK таблиці. `origin` є лише в правила рядка модуля виду (спека промоції
|
|
4884
|
+
* §9.4): похідний CHECK походить від самого виду, а правило — від файлу модуля;
|
|
4885
|
+
* `explain` показує лише вид походження, а хеш файлу не бачить (у хеші немає
|
|
4886
|
+
* шляхів). Каталог походження не бачить: для бази це той самий CHECK.
|
|
4887
|
+
*/
|
|
4888
|
+
export interface PhysicalCheck {
|
|
4889
|
+
name: string;
|
|
4890
|
+
expression: string;
|
|
4891
|
+
origin?: {
|
|
4892
|
+
rowRule: {
|
|
4893
|
+
file: string;
|
|
4894
|
+
};
|
|
4895
|
+
};
|
|
4896
|
+
}
|
|
4897
|
+
/**
|
|
4898
|
+
* `DEFERRABLE` первинного ключа чи UNIQUE. Відсутнє поле — `NOT DEFERRABLE`:
|
|
4899
|
+
* значення «no» у знімку не пишеться, тож стан має одну форму, а таблиці
|
|
4900
|
+
* видів 1С (їхні ключі не відкладаються) поля не мають зовсім.
|
|
4901
|
+
*/
|
|
4902
|
+
export type DeferredConstraint = Exclude<Deferrable, "no">;
|
|
4903
|
+
/**
|
|
4904
|
+
* Елемент ключа індексу. Значення Postgres за замовчуванням (`ASC`, типове
|
|
4905
|
+
* розташування `NULL` для порядку) не пишуться, як у `pg_get_indexdef`: один
|
|
4906
|
+
* фізичний індекс — одна форма знімка.
|
|
4907
|
+
*/
|
|
4908
|
+
export type PhysicalIndexKey = ({
|
|
4909
|
+
column: string;
|
|
4910
|
+
} | {
|
|
4911
|
+
expression: string;
|
|
4912
|
+
}) & {
|
|
4913
|
+
order?: "asc" | "desc";
|
|
4914
|
+
nulls?: "first" | "last";
|
|
4915
|
+
opclass?: PgQualifiedName;
|
|
4916
|
+
collation?: PgQualifiedName;
|
|
4917
|
+
};
|
|
4918
|
+
export interface PhysicalColumn {
|
|
4919
|
+
name: string;
|
|
4920
|
+
/** Рядок у формі `format_type()`. */
|
|
4921
|
+
type: string;
|
|
4922
|
+
notNull: boolean;
|
|
4923
|
+
default?: string;
|
|
4924
|
+
/**
|
|
4925
|
+
* Identity-колонка: режим і ім'я її послідовності. Ім'я обирає компілятор
|
|
4926
|
+
* тим самим алгоритмом, що й Postgres (`<таблиця>_<колонка>_seq` з обходом
|
|
4927
|
+
* зайнятих), і воно займає `pg_class` схеми поряд з таблицями й індексами.
|
|
4928
|
+
*/
|
|
4929
|
+
identity?: {
|
|
4930
|
+
generation: "always" | "byDefault";
|
|
4931
|
+
sequence: string;
|
|
4932
|
+
};
|
|
4933
|
+
/**
|
|
4934
|
+
* Генерована колонка (`GENERATED ALWAYS AS (...) STORED`): значення дає
|
|
4935
|
+
* база, тож `default` у такої колонки немає.
|
|
4936
|
+
*/
|
|
4937
|
+
generated?: {
|
|
4938
|
+
expression: string;
|
|
4939
|
+
};
|
|
4940
|
+
/** Колляція колонки; відсутня — колляція типу. */
|
|
4941
|
+
collation?: PgQualifiedName;
|
|
4942
|
+
comment?: string;
|
|
4943
|
+
/**
|
|
4944
|
+
* UUID реквізиту або логічне ім'я стандартного реквізиту; `scopeKindId` —
|
|
4945
|
+
* у кожної колонки, що несе значення скоупу: доданої скоуп-колонки, ключа
|
|
4946
|
+
* кореня, `parent_id` рядка ТЧ кореня й названої в описі скоуп-колонки
|
|
4947
|
+
* `CustomTable` (`scopeColumn`). Остання лишається елементом опису, тож
|
|
4948
|
+
* несе `elementId` разом зі `scopeKindId`.
|
|
4949
|
+
*
|
|
4950
|
+
* `copyOf` — денормалізована копія носія прав (спека прав §5.2, Рх21):
|
|
4951
|
+
* значення колонки `column` таблиці `table` з рядка, на який указує
|
|
4952
|
+
* локальна колонка `through`. Копію пише лише платформа, тож вона не
|
|
4953
|
+
* елемент опису й не має ні `elementId`, ні `standard`.
|
|
4954
|
+
*/
|
|
4955
|
+
origin: {
|
|
4956
|
+
elementId?: string;
|
|
4957
|
+
standard?: string;
|
|
4958
|
+
scopeKindId?: string;
|
|
4959
|
+
copyOf?: CarrierCopyOf;
|
|
4960
|
+
};
|
|
4961
|
+
}
|
|
4962
|
+
/** Джерело копії носія: колонка таблиці й локальна колонка зв'язку з нею. */
|
|
4963
|
+
export interface CarrierCopyOf {
|
|
4964
|
+
table: {
|
|
4965
|
+
schema: string;
|
|
4966
|
+
name: string;
|
|
4967
|
+
};
|
|
4968
|
+
column: string;
|
|
4969
|
+
through: string;
|
|
4970
|
+
}
|
|
4971
|
+
/**
|
|
4972
|
+
* Логічний тип → рядок у формі `format_type()`: саме в такому вигляді
|
|
4973
|
+
* Postgres віддає тип із каталогу, тож знімок метаданих і знімок extract
|
|
4974
|
+
* порівнюються без нормалізації.
|
|
4975
|
+
*/
|
|
4976
|
+
export declare function pgTypeOf(value: ValueType, refTargetKind?: MetadataKind): string;
|
|
4977
|
+
export declare function pgEnumTypeName(schema: string, physicalName: string): string;
|
|
4978
|
+
/** Result of reading a catalog column type back into the metadata model. */
|
|
4979
|
+
type ColumnTypeForm = {
|
|
4980
|
+
form: "logical";
|
|
4981
|
+
value: ValueType;
|
|
3736
4982
|
} | {
|
|
3737
4983
|
form: "enum";
|
|
3738
4984
|
schema: string;
|
|
@@ -3749,22 +4995,25 @@ type ColumnTypeForm = {
|
|
|
3749
4995
|
* else is `raw`. A bare `uuid` is always `UUID` — an FK is described separately.
|
|
3750
4996
|
*/
|
|
3751
4997
|
export declare function logicalTypeOf(formatType: string, enumTypes: ReadonlySet<string>): ColumnTypeForm;
|
|
3752
|
-
//#endregion
|
|
3753
|
-
//#region src/model/physical/period.d.ts
|
|
3754
4998
|
/** Одиниця усічення періоду; єдине оголошення, решта імпортує тип звідси. */
|
|
3755
4999
|
type PeriodUnit = "year" | "quarter" | "month" | "day";
|
|
3756
5000
|
/**
|
|
3757
|
-
* Єдине джерело усічення моменту до дати в поясі проєкту (спека
|
|
5001
|
+
* Єдине джерело усічення моменту до дати в поясі проєкту (спека «Платформа
|
|
5002
|
+
* в Postgres» §6):
|
|
3758
5003
|
* `timestamptz::date` без `AT TIME ZONE` усікає за поясом сесії, тож межа
|
|
3759
5004
|
* місяця «пливла» б залежно від клієнта. Вираз незмінний (`IMMUTABLE`) лише
|
|
3760
5005
|
* з явним поясом-літералом, тому його однаково використовують індекси, ключі
|
|
3761
5006
|
* похідних таблиць і SQL П3 — ніхто не збирає його вдруге.
|
|
3762
5007
|
*/
|
|
3763
5008
|
export declare function truncatedPeriodExpression(column: string, unit: PeriodUnit, timezone: string): string;
|
|
3764
|
-
//#endregion
|
|
3765
|
-
//#region src/model/physical/pg-names.d.ts
|
|
3766
5009
|
/** Як `quote_ident` Postgres: лапки лише коли без них ім'я змінилося б. */
|
|
3767
5010
|
export declare function quoteIdent(name: string): string;
|
|
5011
|
+
/**
|
|
5012
|
+
* Обрізає до `maxBytes` байтів UTF-8, не розриваючи символ (аналог
|
|
5013
|
+
* `pg_mbcliplen`): Postgres міряє ліміт у байтах, а розрізаний символ дав би
|
|
5014
|
+
* інше ім'я, ніж те, що збереже БД.
|
|
5015
|
+
*/
|
|
5016
|
+
export declare function clipBytes(bytes: Uint8Array, maxBytes: number): Uint8Array;
|
|
3768
5017
|
/**
|
|
3769
5018
|
* Ім'я об'єкта за алгоритмом `makeObjectName` Postgres: `name1[_name2]_label`,
|
|
3770
5019
|
* а коли не влізає в 63 байти — скорочуються частини (довша першою, за
|
|
@@ -3777,12 +5026,8 @@ export declare function makeObjectName(name1: string, name2: string | undefined,
|
|
|
3777
5026
|
* обрізання враховує довшу мітку.
|
|
3778
5027
|
*/
|
|
3779
5028
|
export declare function chooseConstraintName(name1: string, name2: string | undefined, label: string, taken: ReadonlySet<string>): string;
|
|
3780
|
-
//#endregion
|
|
3781
|
-
//#region src/model/physical/pg-keywords.d.ts
|
|
3782
5029
|
/** Слово, яке `quote_ident` бере в лапки; регістр не важливий. */
|
|
3783
5030
|
export declare function isSqlReservedWord(name: string): boolean;
|
|
3784
|
-
//#endregion
|
|
3785
|
-
//#region src/model/physical/assign.d.ts
|
|
3786
5031
|
/**
|
|
3787
5032
|
* Роль елемента, що її знає правило фізичного імені (спека П2 §3, Р5).
|
|
3788
5033
|
* `reference` поля — вид цілі `Ref`: одиночне посилання на таблицю отримує
|
|
@@ -3811,8 +5056,6 @@ type PhysicalNameRole = {
|
|
|
3811
5056
|
* не читача. Мітці суфікс дає лише зайнятість. `taken` — імена тієї ж області унікальності; їх збирає виклик.
|
|
3812
5057
|
*/
|
|
3813
5058
|
export declare function assignPhysicalName(logicalName: string, role: PhysicalNameRole, taken: ReadonlySet<string>): string;
|
|
3814
|
-
//#endregion
|
|
3815
|
-
//#region src/model/physical/catalog.d.ts
|
|
3816
5059
|
/**
|
|
3817
5060
|
* Класи SQL-одиниць (спека П2 §8.3); належать T0, бо їх читає й порт
|
|
3818
5061
|
* каталогу. Масив, а не лише тип: строгі схеми файлів (запис промоції)
|
|
@@ -3879,10 +5122,8 @@ export interface DiffCatalogOptions {
|
|
|
3879
5122
|
}
|
|
3880
5123
|
/** Структурне порівняння двох моделей каталогу; результат упорядкований за `path`. */
|
|
3881
5124
|
export declare function diffCatalogModels(a: CatalogModel, b: CatalogModel, { columnOrder }: DiffCatalogOptions): CatalogDifference[];
|
|
3882
|
-
//#endregion
|
|
3883
|
-
//#region src/model/kinds/actions.d.ts
|
|
3884
5125
|
/** The platform's standard action vocabulary. */
|
|
3885
|
-
export declare const STANDARD_ACTIONS: readonly ["read", "create", "update", "markDeletion", "delete", "post", "unpost", "write"];
|
|
5126
|
+
export declare const STANDARD_ACTIONS: readonly ["read", "administerRights", "create", "update", "markDeletion", "delete", "post", "unpost", "write"];
|
|
3886
5127
|
/** A word of the platform's standard action vocabulary. */
|
|
3887
5128
|
type StandardAction = (typeof STANDARD_ACTIONS)[number];
|
|
3888
5129
|
/** A DML statement kind an action performs on the object's own table. */
|
|
@@ -3903,6 +5144,21 @@ interface KindAction {
|
|
|
3903
5144
|
/** Direct edges of the kind only, without the general `read` edge. */
|
|
3904
5145
|
requires: readonly StandardAction[];
|
|
3905
5146
|
effects: ActionEffects;
|
|
5147
|
+
/**
|
|
5148
|
+
* The natural action of its DML: it covers `effects.dml` for the rows that
|
|
5149
|
+
* are not the command's root row. At most one such action per DML.
|
|
5150
|
+
*/
|
|
5151
|
+
natural?: true;
|
|
5152
|
+
/**
|
|
5153
|
+
* A transition action: the one header column it changes and the direction.
|
|
5154
|
+
* Without `from`/`to` there is no direction (`markDeletion` goes both
|
|
5155
|
+
* ways). Neither `"all"` nor a custom action touches a transition column.
|
|
5156
|
+
*/
|
|
5157
|
+
transition?: {
|
|
5158
|
+
column: string;
|
|
5159
|
+
from?: boolean;
|
|
5160
|
+
to?: boolean;
|
|
5161
|
+
};
|
|
3906
5162
|
}
|
|
3907
5163
|
/** The extent forms a kind can restrict an action to (rights contract). */
|
|
3908
5164
|
type RightsExtentForm = "any" | "own" | "dimension";
|
|
@@ -3923,8 +5179,6 @@ export declare function closeRequires(actions: readonly {
|
|
|
3923
5179
|
name: string;
|
|
3924
5180
|
requires: readonly string[];
|
|
3925
5181
|
}[]): ReadonlyMap<string, readonly string[]>;
|
|
3926
|
-
//#endregion
|
|
3927
|
-
//#region src/model/kinds/standard.d.ts
|
|
3928
5182
|
/**
|
|
3929
5183
|
* Хто призначає ключ і як пишуться рядки (спека П2 §5): довідник —
|
|
3930
5184
|
* оптимістично з клієнта, документ і регістри — лише через сервер; у видів
|
|
@@ -3992,9 +5246,12 @@ interface StandardColumnDef {
|
|
|
3992
5246
|
partialUnique?: string;
|
|
3993
5247
|
/**
|
|
3994
5248
|
* Ціль посилання; сама колонка має тип UUID. `users` — системний довідник
|
|
3995
|
-
* «Користувачі»: ціль — роль, а не ім'я, її резолвить компілятор.
|
|
5249
|
+
* «Користувачі»: ціль — роль, а не ім'я, її резолвить компілятор. Цілі за
|
|
5250
|
+
* рівнем таблиці (її скоупом) теж резолвить компілятор: `member` —
|
|
5251
|
+
* довідник членства виду скоупу таблиці, у нескоупленій — «Користувачі»;
|
|
5252
|
+
* `rightsRoles` — довідник «Ролі» того самого рівня.
|
|
3996
5253
|
*/
|
|
3997
|
-
ref?: "self" | "owningObject" | "owners" | "recorders" | "users";
|
|
5254
|
+
ref?: "self" | "owningObject" | "owners" | "recorders" | "users" | "member" | "rightsRoles";
|
|
3998
5255
|
/** Дія FK при видаленні цілі — лише там, де вона не типова. */
|
|
3999
5256
|
onDelete?: FkAction;
|
|
4000
5257
|
/**
|
|
@@ -4047,6 +5304,8 @@ type ReferenceRole = "attribute.ref" | "attribute.allowedType" |
|
|
|
4047
5304
|
"source.scopeKind" |
|
|
4048
5305
|
/** Контейнер рівня джерела призначень (`assignedOn.container`). */
|
|
4049
5306
|
"source.container" |
|
|
5307
|
+
/** Прийнята таблиця ролей джерела призначень (`columns.role.references`). */
|
|
5308
|
+
"source.roleTable" |
|
|
4050
5309
|
/** Набір прав у `include` набору чи ролі. */
|
|
4051
5310
|
"rights.include" |
|
|
4052
5311
|
/** Вид скоупу рівня ролі (`assignedOn.scopeKind`). */
|
|
@@ -4059,7 +5318,7 @@ type ReferenceRole = "attribute.ref" | "attribute.allowedType" |
|
|
|
4059
5318
|
"grant.object" |
|
|
4060
5319
|
/** Вимір доступу проєкту в обсязі гранту (`extent.dimension`). */
|
|
4061
5320
|
"grant.dimension" |
|
|
4062
|
-
/** Кастомна дія єдиного об'єкта гранту в `actions` (
|
|
5321
|
+
/** Кастомна дія єдиного об'єкта гранту в `actions` (спека прав §4.1). */
|
|
4063
5322
|
"grant.customAction";
|
|
4064
5323
|
interface FoundReference {
|
|
4065
5324
|
/** JSON Pointer (RFC 6901) на місце посилання у файлі. */
|
|
@@ -4101,7 +5360,7 @@ interface FoundElementReference {
|
|
|
4101
5360
|
role: ReferenceRole;
|
|
4102
5361
|
}
|
|
4103
5362
|
/**
|
|
4104
|
-
* Посилання з файлу об'єкта на іменований елемент
|
|
5363
|
+
* Посилання з файлу об'єкта на іменований елемент проєкту: вид
|
|
4105
5364
|
* скоупу, вимір доступу, джерело. Ціль — за іменем у колекції проєкту; імена
|
|
4106
5365
|
* елементів проєкту унікальні в усіх колекціях, тож колекція лише звужує
|
|
4107
5366
|
* пошук, а не робить ім'я однозначним.
|
|
@@ -4196,6 +5455,19 @@ interface SubscriptionSpec {
|
|
|
4196
5455
|
name: string;
|
|
4197
5456
|
};
|
|
4198
5457
|
}
|
|
5458
|
+
/** Роль системного довідника прав (спека прав §4.6). */
|
|
5459
|
+
type RightsSystemCatalog = "rightsRoles" | "roleAssignments";
|
|
5460
|
+
/**
|
|
5461
|
+
* Стандартна таблична частина, яку дає вид (дельта «Ролей»): її колонки йдуть
|
|
5462
|
+
* після стандартних колонок рядка ТЧ, а таблиця — `<таблиця об'єкта>_<суфікс>`,
|
|
5463
|
+
* id — `<objectId>#<logicalName>`, бо у файлі її немає.
|
|
5464
|
+
*/
|
|
5465
|
+
interface StandardTabularSectionDef {
|
|
5466
|
+
logicalName: string;
|
|
5467
|
+
physicalSuffix: string;
|
|
5468
|
+
columns: () => StandardColumnDef[];
|
|
5469
|
+
title: LocalizedString;
|
|
5470
|
+
}
|
|
4199
5471
|
interface KindDefinition {
|
|
4200
5472
|
kind: MetadataKind;
|
|
4201
5473
|
/** Тека виду в `metadata/` (спека §3). */
|
|
@@ -4223,6 +5495,12 @@ interface KindDefinition {
|
|
|
4223
5495
|
* Only a set can be included; every declaration needs the users catalog.
|
|
4224
5496
|
*/
|
|
4225
5497
|
rightsDeclaration?: "set" | "role";
|
|
5498
|
+
/**
|
|
5499
|
+
* Об'єкти виду пише роль команд (спека П4 §6.2, Рт10): таблиці отримують
|
|
5500
|
+
* поколонкові `INSERT`/`UPDATE` і `DELETE` рядків ТЧ. Немає — роль команд
|
|
5501
|
+
* лише читає: документи й регістри пише ядро команд через функції (A2+).
|
|
5502
|
+
*/
|
|
5503
|
+
commandWrites?: true;
|
|
4226
5504
|
materializes: "table" | "enumType" | "none";
|
|
4227
5505
|
/**
|
|
4228
5506
|
* Що приймає `<Ім'я>.sql` об'єкта (спека П2 §3, «Дослівний SQL»):
|
|
@@ -4244,7 +5522,7 @@ interface KindDefinition {
|
|
|
4244
5522
|
*/
|
|
4245
5523
|
declared: boolean;
|
|
4246
5524
|
/**
|
|
4247
|
-
* `false` — фізичного імені у виду
|
|
5525
|
+
* `false` — фізичного імені у виду немає: ні таблиці, ні тригера,
|
|
4248
5526
|
* ні мітки в даних, бо в даних об'єкт називає його UUID. Тоді поля немає
|
|
4249
5527
|
* і в схемі, стадія 2 його не вимагає, а `fix` не призначає.
|
|
4250
5528
|
*/
|
|
@@ -4275,7 +5553,7 @@ interface KindDefinition {
|
|
|
4275
5553
|
namedElementFields?: readonly string[];
|
|
4276
5554
|
/**
|
|
4277
5555
|
* Поля з елементами, що мають лише `id` і `name`, без `physicalName`
|
|
4278
|
-
* (кастомні дії,
|
|
5556
|
+
* (кастомні дії, спека прав §3): у даних елемент називає його UUID, тож фізичної
|
|
4279
5557
|
* мітки немає. `id` перевіряється глобально, ім'я ділить простір імен
|
|
4280
5558
|
* об'єкта з реквізитами й ТЧ і пишеться в camelCase незалежно від стилю
|
|
4281
5559
|
* проєкту — як слова словника дій.
|
|
@@ -4305,11 +5583,13 @@ interface KindDefinition {
|
|
|
4305
5583
|
*/
|
|
4306
5584
|
authorTracking?: true;
|
|
4307
5585
|
/**
|
|
4308
|
-
* RLS таблиць виду
|
|
4309
|
-
* закриті, доступ відкривають
|
|
4310
|
-
* задає його полем файлу, бо описана фізично
|
|
5586
|
+
* RLS таблиць виду (спека П2 §8.3): `enabled` — дані застосунку за
|
|
5587
|
+
* замовчуванням закриті, доступ відкривають політики; `declared` — прийнята
|
|
5588
|
+
* таблиця задає його полем файлу, бо описана фізично повністю; `none` — у
|
|
5589
|
+
* виду немає таблиці. Поле обов'язкове: новий вид із таблицею, що забув
|
|
5590
|
+
* факт, інакше тихо лишився б без RLS.
|
|
4311
5591
|
*/
|
|
4312
|
-
rowLevelSecurity
|
|
5592
|
+
rowLevelSecurity: "enabled" | "declared" | "none";
|
|
4313
5593
|
/** Стандартні колонки основної таблиці для розібраного файлу виду. */
|
|
4314
5594
|
standardColumns(obj: unknown): StandardColumnDef[];
|
|
4315
5595
|
/**
|
|
@@ -4317,6 +5597,16 @@ interface KindDefinition {
|
|
|
4317
5597
|
* дозволені ТЧ, тож його наявність і є цим дозволом.
|
|
4318
5598
|
*/
|
|
4319
5599
|
tabularSectionColumns?(obj: unknown): StandardColumnDef[];
|
|
5600
|
+
/**
|
|
5601
|
+
* Стандартні табличні частини об'єкта — не з файлу, а з його налаштувань.
|
|
5602
|
+
* Немає — таких у виду не буває.
|
|
5603
|
+
*/
|
|
5604
|
+
standardTabularSections?(obj: unknown): StandardTabularSectionDef[];
|
|
5605
|
+
/**
|
|
5606
|
+
* Об'єкт — системний довідник прав (спека прав §4.6); `undefined` — ні.
|
|
5607
|
+
* Єдине джерело цього факту для контракту прав, селекторів і правила рівня.
|
|
5608
|
+
*/
|
|
5609
|
+
rightsSystem?(obj: unknown): RightsSystemCatalog | undefined;
|
|
4320
5610
|
references(obj: unknown): FoundReference[];
|
|
4321
5611
|
/**
|
|
4322
5612
|
* Посилання на колонки за логічним іменем: ключі, індекси й FK прийнятої
|
|
@@ -4349,6 +5639,8 @@ interface KindDefinition {
|
|
|
4349
5639
|
* `ref` однаковий в обох стилях, решта в snake_case — пряма зміна регістру.
|
|
4350
5640
|
*/
|
|
4351
5641
|
export declare function standardLogicalName(def: Pick<StandardColumnDef, "logicalName">, style: AttributeCase): string;
|
|
5642
|
+
export declare function keyColumn(withDefault: boolean): StandardColumnDef;
|
|
5643
|
+
export declare function deletionMarkColumn(): StandardColumnDef;
|
|
4352
5644
|
/**
|
|
4353
5645
|
* Версія рядка для оптимістичної конкурентності. Збільшує її разом зі
|
|
4354
5646
|
* службовою датою оновлення тригер механіки (`compiler/mechanics-units.ts`).
|
|
@@ -4356,6 +5648,13 @@ export declare function standardLogicalName(def: Pick<StandardColumnDef, "logica
|
|
|
4356
5648
|
*/
|
|
4357
5649
|
export declare function versionColumn(): StandardColumnDef;
|
|
4358
5650
|
export declare function serviceDateColumns(): StandardColumnDef[];
|
|
5651
|
+
/**
|
|
5652
|
+
* Авторство (спека П2 §5): посилання на «Користувачі», а не на учасника —
|
|
5653
|
+
* автор лишається автором і після виходу з тенанта. Nullable, бо рядок може
|
|
5654
|
+
* записати й не користувач (міграція, провізія); під контекстом команди їх
|
|
5655
|
+
* примушує тригер авторства.
|
|
5656
|
+
*/
|
|
5657
|
+
export declare function authorColumns(): StandardColumnDef[];
|
|
4359
5658
|
/**
|
|
4360
5659
|
* Місяць обороту в похідній таблиці регістра: перший день місяця за поясом
|
|
4361
5660
|
* проєкту (`truncatedPeriodExpression`), тож тип — `date`, а не момент.
|
|
@@ -4366,8 +5665,9 @@ export declare function monthColumn(): StandardColumnDef;
|
|
|
4366
5665
|
* одинак як ключ запису поруч з іншим PK (підлеглий регістр відомостей).
|
|
4367
5666
|
*/
|
|
4368
5667
|
export declare function singletonColumn(role?: "primaryKey" | "unique"): StandardColumnDef;
|
|
4369
|
-
|
|
4370
|
-
|
|
5668
|
+
export declare function lineNumberColumn(): StandardColumnDef;
|
|
5669
|
+
/** Власник рядка ТЧ: генератори знаходять його колонку за цим визначенням. */
|
|
5670
|
+
export declare function tabularParentColumn(): StandardColumnDef;
|
|
4371
5671
|
/** Скалярна колонка типу uuid: логічного `UUID` або `Raw` з `pgType` uuid. */
|
|
4372
5672
|
export declare function isUuidColumn(column: CustomTable["columns"][number]): boolean;
|
|
4373
5673
|
/**
|
|
@@ -4375,8 +5675,35 @@ export declare function isUuidColumn(column: CustomTable["columns"][number]): bo
|
|
|
4375
5675
|
* від `physicalName`, тож придатна й до призначення фізичних імен.
|
|
4376
5676
|
*/
|
|
4377
5677
|
export declare function singleUuidKeyColumn(table: CustomTable): CustomTable["columns"][number] | undefined;
|
|
4378
|
-
|
|
4379
|
-
|
|
5678
|
+
/**
|
|
5679
|
+
* Ім'я предвизначеного елемента: його пише платформа з `predefinedItems`, а
|
|
5680
|
+
* не команда, тож грант ролі команд його оминає (спека П4 §6.2).
|
|
5681
|
+
*/
|
|
5682
|
+
export declare function predefinedNameColumn(): StandardColumnDef;
|
|
5683
|
+
/**
|
|
5684
|
+
* Платформні реквізити «Користувачів» (спека користувачів §4): провізія
|
|
5685
|
+
* вставляє рядок лише з ключем і найменуванням, тож обидва мають DEFAULT.
|
|
5686
|
+
* Недійсність не видаляє рядок — на нього можуть посилатися дані застосунку.
|
|
5687
|
+
*/
|
|
5688
|
+
export declare function userPlatformColumns(): StandardColumnDef[];
|
|
5689
|
+
/**
|
|
5690
|
+
* Платформні колонки «Користувачів» за логічним ім'ям: споживачі беруть
|
|
5691
|
+
* колонку за ім'ям, а не за позицією в масиві, щоб зміна порядку реквізитів
|
|
5692
|
+
* не підміняла їх мовчки.
|
|
5693
|
+
*/
|
|
5694
|
+
export declare const USER_PLATFORM_COLUMNS: Readonly<Record<"userKind" | "invalid", StandardColumnDef>>;
|
|
5695
|
+
/**
|
|
5696
|
+
* Логічне ім'я стандартної ТЧ дельти «Ролей» (спека прав §4.6): за ним компілятор
|
|
5697
|
+
* знаходить її таблицю для контракту довідників прав.
|
|
5698
|
+
*/
|
|
5699
|
+
export declare const RIGHTS_DELTA_SECTION = "delta";
|
|
5700
|
+
/**
|
|
5701
|
+
* Визначення стандартних колонок довідників прав за логічним ім'ям: функції
|
|
5702
|
+
* прав шукають за ними колонки в стилі проєкту, а не літералом
|
|
5703
|
+
* імені. Заголовок «Суб'єкта» залежить від скоупу, але пошук читає лише
|
|
5704
|
+
* логічне ім'я.
|
|
5705
|
+
*/
|
|
5706
|
+
export declare const RIGHTS_COLUMNS: Readonly<Record<"archetype" | "order" | "object" | "action" | "extent" | "dimension" | "effect" | "subject" | "customRole" | "container", StandardColumnDef>>;
|
|
4380
5707
|
/**
|
|
4381
5708
|
* Єдине місце знань про вид (спека П2 §8.1): кожне розгалуження за видом
|
|
4382
5709
|
* читає цей запис, а новий вид — це новий запис плюс тести. Порядок ключів —
|
|
@@ -4396,8 +5723,6 @@ export declare function postsMovements(kind: MetadataKind, obj: unknown): boolea
|
|
|
4396
5723
|
* жодна `Ref`-пара й мітці нема що розрізняти.
|
|
4397
5724
|
*/
|
|
4398
5725
|
export declare function expectsKindLabel(kind: MetadataKind, data: unknown): boolean;
|
|
4399
|
-
//#endregion
|
|
4400
|
-
//#region src/model/format.d.ts
|
|
4401
5726
|
/** Ключі project.meta.json — у порядку оголошення схеми проєкту. */
|
|
4402
5727
|
export declare const PROJECT_KEY_ORDER: readonly string[];
|
|
4403
5728
|
/**
|
|
@@ -4422,8 +5747,6 @@ export declare function formatSqlDebtFile(debt: SqlDebt): string;
|
|
|
4422
5747
|
* Варіант union обирається за даними, як і в канонічній формі.
|
|
4423
5748
|
*/
|
|
4424
5749
|
export declare function isRecordKeyAt(schema: z.ZodType, data: unknown, pointer: string): boolean;
|
|
4425
|
-
//#endregion
|
|
4426
|
-
//#region src/model/named-elements.d.ts
|
|
4427
5750
|
/**
|
|
4428
5751
|
* Масиви іменованих елементів схеми (спека П2 §3): елемент — об'єкт з `id` і
|
|
4429
5752
|
* `name`. Ключ масиву → схема елемента, у порядку оголошення схеми. Факт
|
|
@@ -4458,5 +5781,4 @@ interface AssignedOnceContext {
|
|
|
4458
5781
|
}) => string | undefined;
|
|
4459
5782
|
}
|
|
4460
5783
|
export declare const ASSIGNED_ONCE: readonly AssignedOnceField[];
|
|
4461
|
-
|
|
4462
|
-
export type { AccessDimension, AccessMapping, AccumulationRegister, AccumulationResource, ActionEffects, ApiRolePurpose, AssignedOn, AssignedOnceContext, AssignedOnceField, AssignmentSource, Attribute, AttributeCase, BinaryOp, Catalog, CatalogAttribute, ColumnTypeForm, CompositeIndexes, Constant, CustomAction, CustomTable, CustomTableColumn, DatabaseProvider, DefaultValue, Deferrable, Dml, Document, EnumValue, Enumeration, EventSubscription, Expr, Extent, FoundElementReference, FoundProjectReference, FoundReference, GrantEntry, IdentityNameSource, IdentitySource, InformationRegister, KindAction, KindDefinition, LocalizedString, LogicalType, MembershipSource, MetadataId, MetadataKind, MetadataRef, MovementDecl, NumberingSpec, ObjectSelector, ParseResult, PeriodUnit, PgEnum, PgQualifiedName, PhysicalNameRole, Project, ProviderApiRoles, ProviderEventSource, PublicReadRole, ReferenceRole, RegisterKeySpec, RequestRolePurpose, RightsCarrier, RightsExtentForm, RightsSet, Role, RoleAssignedOn, RowLevelSecurity, SchemaRule, ScopeKind, SetGrantEntry, Span, SqlDebt, StandardAction, StandardColumnDef, SubscriptionEvent, SubscriptionSpec, TabularSection, ValueType, VirtualTableKind, WritePattern };
|
|
5784
|
+
export type { AccessDimension, AccessMapping, AccumulationRegister, AccumulationResource, ActionEffects, ApiRolePurpose, AssignedOn, AssignedOnceContext, AssignedOnceField, AssignmentSource, Attribute, AttributeCase, BinaryOp, Catalog, CatalogAttribute, ColumnTypeForm, CommandContext, CompositeIndexes, Constant, CustomAction, CustomTable, CustomTableColumn, DatabaseProvider, DefaultValue, Deferrable, Dml, Document, EnumValue, Enumeration, EventSubscription, Expr, Extent, FoundElementReference, FoundProjectReference, FoundReference, GrantEntry, GrantPurpose, IdentityNameSource, IdentitySource, InformationRegister, KindAction, KindDefinition, LocalizedString, LogicalType, MembershipSource, MetadataId, MetadataKind, MetadataRef, MovementDecl, NumberingSpec, ObjectSelector, ParseResult, PeriodUnit, PgEnum, PgQualifiedName, PhysicalNameRole, PlatformRolePurpose, Project, ProviderApiRoles, ProviderEventSource, PublicReadRole, ReferenceRole, RegisterKeySpec, RequestRolePurpose, RightsCarrier, RightsExtentForm, RightsSet, RightsSystemCatalog, Role, RoleAssignedOn, RowLevelSecurity, SchemaRule, ScopeKind, SetGrantEntry, SourceCondition, Span, SqlDebt, StandardAction, StandardColumnDef, StandardTabularSectionDef, SubscriptionEvent, SubscriptionSpec, TabularSection, ValueType, VirtualTableKind, WritePattern };
|