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.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
2
|
+
// src/model/schemas/localized-string.ts
|
|
3
3
|
/**
|
|
4
4
|
* Localized string: at least one locale required.
|
|
5
5
|
* BRD: {uk, en} — Ukrainian first, English second.
|
|
@@ -8,8 +8,7 @@ const localizedStringSchema = z.strictObject({
|
|
|
8
8
|
uk: z.string().optional().meta({ description: "Ukrainian text." }),
|
|
9
9
|
en: z.string().optional().meta({ description: "English text." })
|
|
10
10
|
}).refine((val) => val.uk !== void 0 || val.en !== void 0, { message: "At least one locale (uk or en) must be provided" }).meta({ description: "Text per locale; at least one of uk or en is required." });
|
|
11
|
-
|
|
12
|
-
//#region src/model/schemas/metadata-kind.ts
|
|
11
|
+
// src/model/schemas/metadata-kind.ts
|
|
13
12
|
/**
|
|
14
13
|
* Перелік видів метаданих — частина форми посилання `MetadataRef`. Поведінка
|
|
15
14
|
* видів живе поруч у T0, у реєстрі видів (`model/kinds`), а не тут: схема
|
|
@@ -29,8 +28,7 @@ const METADATA_KINDS = [
|
|
|
29
28
|
"Role"
|
|
30
29
|
];
|
|
31
30
|
const metadataKindSchema = z.enum(METADATA_KINDS).meta({ description: "Kind of the referenced metadata object." });
|
|
32
|
-
|
|
33
|
-
//#region src/model/schemas/identity.ts
|
|
31
|
+
// src/model/schemas/identity.ts
|
|
34
32
|
/**
|
|
35
33
|
* Стабільна ідентичність об'єкта чи реквізиту: ім'я можна змінювати, id — ні.
|
|
36
34
|
* Лише нижній регістр (так генерує crypto.randomUUID): id порівнюються як
|
|
@@ -83,8 +81,7 @@ function logicalElementName(physical, style) {
|
|
|
83
81
|
const [head = "", ...rest] = physical.split("_").filter(Boolean);
|
|
84
82
|
return head + rest.map(capitalize).join("");
|
|
85
83
|
}
|
|
86
|
-
|
|
87
|
-
//#region src/model/schemas/metadata-ref.ts
|
|
84
|
+
// src/model/schemas/metadata-ref.ts
|
|
88
85
|
/**
|
|
89
86
|
* Посилання на інший об'єкт метаданих. Чи можна на цей вид посилатися —
|
|
90
87
|
* факт реєстру видів і перевірка стадії 4, а не схеми.
|
|
@@ -93,8 +90,7 @@ const metadataRefSchema = z.strictObject({
|
|
|
93
90
|
kind: metadataKindSchema,
|
|
94
91
|
name: objectNameSchema.meta({ description: "Logical name of the referenced object." })
|
|
95
92
|
}).meta({ description: "Reference to a metadata object by kind and logical name; the compiler resolves it to an id." });
|
|
96
|
-
|
|
97
|
-
//#region src/model/schemas/value-type.ts
|
|
93
|
+
// src/model/schemas/value-type.ts
|
|
98
94
|
const LOGICAL_TYPES = [
|
|
99
95
|
"UUID",
|
|
100
96
|
"String",
|
|
@@ -173,7 +169,8 @@ const INTEGER_RANGES = {
|
|
|
173
169
|
/** Межі `int8`: за межею точного числа JSON `BigInt` береться рядком. */
|
|
174
170
|
const INT8_RANGE = [-(2n ** 63n), 2n ** 63n - 1n];
|
|
175
171
|
const DECIMAL = /^[+-]?(\d+(\.\d*)?|\.\d+)$/;
|
|
176
|
-
const INTEGER_TEXT = /^[+-]?\d+$/;
|
|
172
|
+
const INTEGER_TEXT$1 = /^[+-]?\d+$/;
|
|
173
|
+
/** Канонічна текстова форма uuid з дефісами (регістр байдужий). */
|
|
177
174
|
const UUID_TEXT = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
178
175
|
const DATE_TEXT = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
179
176
|
/**
|
|
@@ -208,7 +205,7 @@ function isWithinType(value, raw) {
|
|
|
208
205
|
}
|
|
209
206
|
const text = String(raw);
|
|
210
207
|
switch (value.type) {
|
|
211
|
-
case "BigInt": return INTEGER_TEXT.test(text) && BigInt(text) >= INT8_RANGE[0] && BigInt(text) <= INT8_RANGE[1];
|
|
208
|
+
case "BigInt": return INTEGER_TEXT$1.test(text) && BigInt(text) >= INT8_RANGE[0] && BigInt(text) <= INT8_RANGE[1];
|
|
212
209
|
case "Numeric": return (typeof raw === "number" || DECIMAL.test(text)) && fitsNumeric(text, value.precision, value.scale);
|
|
213
210
|
case "UUID": return UUID_TEXT.test(text);
|
|
214
211
|
case "String": return value.length === void 0 || [...text].length <= value.length;
|
|
@@ -470,8 +467,7 @@ function defaultViolatesValueChecks(value) {
|
|
|
470
467
|
}
|
|
471
468
|
return false;
|
|
472
469
|
}
|
|
473
|
-
|
|
474
|
-
//#region src/model/schemas/attribute.ts
|
|
470
|
+
// src/model/schemas/attribute.ts
|
|
475
471
|
/**
|
|
476
472
|
* Поле значення: реквізит, вимір чи ресурс регістра. Унікальність імен у
|
|
477
473
|
* масиві й стиль написання імені перевіряють пізніші стадії — схема лише
|
|
@@ -544,8 +540,7 @@ const registerFieldSchema = z.strictObject(fieldShape).superRefine((value, ctx)
|
|
|
544
540
|
refineUnique(value, ctx);
|
|
545
541
|
refineValueChecks(value, ctx);
|
|
546
542
|
});
|
|
547
|
-
|
|
548
|
-
//#region src/model/schemas/pg-schema.ts
|
|
543
|
+
// src/model/schemas/pg-schema.ts
|
|
549
544
|
/**
|
|
550
545
|
* Схема, яку платформа резервує за собою: у ній живе системний шар
|
|
551
546
|
* (ідентичності, поточний користувач, довідник міток). Застосунок не може
|
|
@@ -561,8 +556,7 @@ const appSchemaNameSchema = z.string().refine((schema) => schema !== PLATFORM_SC
|
|
|
561
556
|
message: `Schema ${PLATFORM_SCHEMA} belongs to the platform`,
|
|
562
557
|
params: { rule: "schema.reserved" }
|
|
563
558
|
});
|
|
564
|
-
|
|
565
|
-
//#region src/model/schemas/composite-index.ts
|
|
559
|
+
// src/model/schemas/composite-index.ts
|
|
566
560
|
/**
|
|
567
561
|
* Складені індекси об'єкта чи його табличної частини. Назви — логічні імена
|
|
568
562
|
* реквізитів і стандартних реквізитів тієї самої таблиці; носій скоупу
|
|
@@ -574,8 +568,7 @@ const compositeIndexesSchema = z.array(z.strictObject({ attributes: z.array(z.un
|
|
|
574
568
|
name: z.string().min(1).meta({ description: "Logical name of the attribute." }),
|
|
575
569
|
order: z.literal("desc").meta({ description: "Descending order of this key part." })
|
|
576
570
|
})])).min(1).meta({ description: "Attributes and standard attributes of the same table in key order; a name, or { name, order: desc } for a descending part." }) }).meta({ description: "Non-unique btree index over attributes of the same table; the scope carrier is added first automatically." })).default([]);
|
|
577
|
-
|
|
578
|
-
//#region src/model/schemas/object-header.ts
|
|
571
|
+
// src/model/schemas/object-header.ts
|
|
579
572
|
/**
|
|
580
573
|
* Спільна «шапка» файлу об'єкта метаданих. `kind` кожен вид додає сам як
|
|
581
574
|
* літерал. `id` і `physicalName` опційні у файлі: їх призначає інструментарій
|
|
@@ -601,8 +594,7 @@ const standardAttributeOverridesSchema = z.record(z.string(), z.strictObject({
|
|
|
601
594
|
title: localizedStringSchema.optional().meta({ description: "Overridden title of the standard attribute." }),
|
|
602
595
|
description: localizedStringSchema.optional().meta({ description: "Overridden description of the standard attribute." })
|
|
603
596
|
})).optional().default({}).meta({ description: "Custom titles and descriptions of derived standard attributes, keyed by standard attribute name." });
|
|
604
|
-
|
|
605
|
-
//#region src/model/schemas/tabular-section.ts
|
|
597
|
+
// src/model/schemas/tabular-section.ts
|
|
606
598
|
/** Таблична частина об'єкта. */
|
|
607
599
|
const tabularSectionSchema = z.strictObject({
|
|
608
600
|
id: metadataIdSchema.optional(),
|
|
@@ -613,8 +605,7 @@ const tabularSectionSchema = z.strictObject({
|
|
|
613
605
|
attributes: z.array(attributeSchema).default([]).meta({ description: "Attributes of the section rows." }),
|
|
614
606
|
indexes: compositeIndexesSchema.meta({ description: "Composite indexes over the section rows." })
|
|
615
607
|
}).meta({ description: "Tabular section: a list of rows owned by an object." });
|
|
616
|
-
|
|
617
|
-
//#region src/model/schemas/rules.ts
|
|
608
|
+
// src/model/schemas/rules.ts
|
|
618
609
|
/**
|
|
619
610
|
* Коди власних перевірок T0. Кожна перевірка, що не виражається самою схемою
|
|
620
611
|
* Zod, додає issue з `params: { rule }` — так споживачі (стадії валідації,
|
|
@@ -654,8 +645,7 @@ const SCHEMA_RULES = [
|
|
|
654
645
|
"posting.parse",
|
|
655
646
|
"debt.not-canonical"
|
|
656
647
|
];
|
|
657
|
-
|
|
658
|
-
//#region src/model/schemas/public-read.ts
|
|
648
|
+
// src/model/schemas/public-read.ts
|
|
659
649
|
/**
|
|
660
650
|
* Ролі API, яким об'єкт відкриває читання (спека промоції §9.3). Поле мають
|
|
661
651
|
* лише види з RLS (факт реєстру `rowLevelSecurity`): без RLS таблиця не має
|
|
@@ -675,11 +665,11 @@ const PUBLIC_READ_PURPOSES = {
|
|
|
675
665
|
anon: "anonymous"
|
|
676
666
|
};
|
|
677
667
|
const publicReadSchema = z.enum(PUBLIC_READ_ROLES).optional().meta({ description: "API role that may read every row of the object: authenticated users or anonymous visitors. Absent means no public read." });
|
|
678
|
-
|
|
679
|
-
//#region src/model/kinds/actions.ts
|
|
668
|
+
// src/model/kinds/actions.ts
|
|
680
669
|
/** The platform's standard action vocabulary. */
|
|
681
670
|
const STANDARD_ACTIONS = [
|
|
682
671
|
"read",
|
|
672
|
+
"administerRights",
|
|
683
673
|
"create",
|
|
684
674
|
"update",
|
|
685
675
|
"markDeletion",
|
|
@@ -697,6 +687,23 @@ const readAction = {
|
|
|
697
687
|
tabularSections: false
|
|
698
688
|
}
|
|
699
689
|
};
|
|
690
|
+
/**
|
|
691
|
+
* Запис у довідники прав — окрема дія, а не звичайні create/update: її видають
|
|
692
|
+
* явно, бо зміна прав сама є приростом прав.
|
|
693
|
+
*/
|
|
694
|
+
const administerRightsAction = {
|
|
695
|
+
name: "administerRights",
|
|
696
|
+
requires: ["read"],
|
|
697
|
+
effects: {
|
|
698
|
+
dml: [
|
|
699
|
+
"insert",
|
|
700
|
+
"update",
|
|
701
|
+
"delete"
|
|
702
|
+
],
|
|
703
|
+
header: "all",
|
|
704
|
+
tabularSections: true
|
|
705
|
+
}
|
|
706
|
+
};
|
|
700
707
|
const deleteAction = {
|
|
701
708
|
name: "delete",
|
|
702
709
|
requires: [],
|
|
@@ -704,7 +711,8 @@ const deleteAction = {
|
|
|
704
711
|
dml: ["delete"],
|
|
705
712
|
header: [],
|
|
706
713
|
tabularSections: false
|
|
707
|
-
}
|
|
714
|
+
},
|
|
715
|
+
natural: true
|
|
708
716
|
};
|
|
709
717
|
const markDeletionAction = {
|
|
710
718
|
name: "markDeletion",
|
|
@@ -713,7 +721,8 @@ const markDeletionAction = {
|
|
|
713
721
|
dml: ["update"],
|
|
714
722
|
header: ["deletionMark"],
|
|
715
723
|
tabularSections: false
|
|
716
|
-
}
|
|
724
|
+
},
|
|
725
|
+
transition: { column: "deletionMark" }
|
|
717
726
|
};
|
|
718
727
|
function createAction(tabularSections) {
|
|
719
728
|
return {
|
|
@@ -723,7 +732,8 @@ function createAction(tabularSections) {
|
|
|
723
732
|
dml: ["insert"],
|
|
724
733
|
header: "all",
|
|
725
734
|
tabularSections
|
|
726
|
-
}
|
|
735
|
+
},
|
|
736
|
+
natural: true
|
|
727
737
|
};
|
|
728
738
|
}
|
|
729
739
|
function updateAction(tabularSections, dml = ["update"]) {
|
|
@@ -734,7 +744,8 @@ function updateAction(tabularSections, dml = ["update"]) {
|
|
|
734
744
|
dml,
|
|
735
745
|
header: "all",
|
|
736
746
|
tabularSections
|
|
737
|
-
}
|
|
747
|
+
},
|
|
748
|
+
natural: true
|
|
738
749
|
};
|
|
739
750
|
}
|
|
740
751
|
const postAction = {
|
|
@@ -744,6 +755,11 @@ const postAction = {
|
|
|
744
755
|
dml: ["update"],
|
|
745
756
|
header: ["posted"],
|
|
746
757
|
tabularSections: false
|
|
758
|
+
},
|
|
759
|
+
transition: {
|
|
760
|
+
column: "posted",
|
|
761
|
+
from: false,
|
|
762
|
+
to: true
|
|
747
763
|
}
|
|
748
764
|
};
|
|
749
765
|
const unpostAction = {
|
|
@@ -753,6 +769,11 @@ const unpostAction = {
|
|
|
753
769
|
dml: ["update"],
|
|
754
770
|
header: ["posted"],
|
|
755
771
|
tabularSections: false
|
|
772
|
+
},
|
|
773
|
+
transition: {
|
|
774
|
+
column: "posted",
|
|
775
|
+
from: true,
|
|
776
|
+
to: false
|
|
756
777
|
}
|
|
757
778
|
};
|
|
758
779
|
const writeAction = {
|
|
@@ -766,7 +787,8 @@ const writeAction = {
|
|
|
766
787
|
],
|
|
767
788
|
header: "all",
|
|
768
789
|
tabularSections: false
|
|
769
|
-
}
|
|
790
|
+
},
|
|
791
|
+
natural: true
|
|
770
792
|
};
|
|
771
793
|
/** The reference vocabulary of a record kind: read plus the four writes. */
|
|
772
794
|
function recordActions(tabularSections) {
|
|
@@ -815,14 +837,13 @@ function closeRequires(actions) {
|
|
|
815
837
|
for (const a of actions) close(a.name);
|
|
816
838
|
return closed;
|
|
817
839
|
}
|
|
818
|
-
|
|
819
|
-
//#region src/model/schemas/rights.ts
|
|
840
|
+
// src/model/schemas/rights.ts
|
|
820
841
|
/**
|
|
821
842
|
* Кастомна дія об'єкта (спека прав §3): елемент з `id` і `name`, але без
|
|
822
843
|
* `physicalName` — у даних дію називає її UUID, а не ім'я. `dml` не
|
|
823
844
|
* оголошується: компілятор виводить його з того, чи є що писати, тож
|
|
824
845
|
* оголошення не може розійтися з ефектами. `title`/`description` відкладено
|
|
825
|
-
* до
|
|
846
|
+
* до споживача (П4).
|
|
826
847
|
*/
|
|
827
848
|
const customActionSchema = z.strictObject({
|
|
828
849
|
id: metadataIdSchema.optional(),
|
|
@@ -848,7 +869,7 @@ const ownershipSchema = z.array(rightsCarrierSchema).min(1);
|
|
|
848
869
|
* Вимір доступу проєкту (спека прав §4.4): скоуплений довідник значень і
|
|
849
870
|
* джерело значень користувача — таблиця зв'язку чи дослівна функція. Вимір —
|
|
850
871
|
* елемент проєкту з UUID, бо обсяг гранту називає його id, а ім'я може
|
|
851
|
-
* змінитися. `title`/`description` відкладено до
|
|
872
|
+
* змінитися. `title`/`description` відкладено до споживача (П4).
|
|
852
873
|
*/
|
|
853
874
|
const accessDimensionSchema = z.strictObject({
|
|
854
875
|
id: metadataIdSchema.optional(),
|
|
@@ -887,6 +908,26 @@ const assignedOnSchema = z.union([
|
|
|
887
908
|
z.strictObject({ container: metadataRefSchema.meta({ description: "Rights container object of the level." }) })
|
|
888
909
|
]).meta({ description: "Level of the assignment: global, a scope kind or a rights container." });
|
|
889
910
|
/**
|
|
911
|
+
* Кон'юнкт умови рядків прийнятого джерела (спека прав §4.7):
|
|
912
|
+
* рівність колонки літералу чи перевірка на `NULL`. Умова лише звужує рядки
|
|
913
|
+
* джерела — рядок, що їй не відповідає, не належить джерелу (наприклад, рядок
|
|
914
|
+
* іншого рівня поліморфної таблиці). Тип літерала звіряє з типом колонки
|
|
915
|
+
* стадія 4.
|
|
916
|
+
*/
|
|
917
|
+
const sourceConditionSchema = z.union([z.strictObject({
|
|
918
|
+
column: elementNameSchema.meta({ description: "Logical name of a column of the table." }),
|
|
919
|
+
equals: z.union([
|
|
920
|
+
z.string(),
|
|
921
|
+
z.boolean(),
|
|
922
|
+
z.number().int()
|
|
923
|
+
]).meta({ description: "Literal the column must equal: a string for a text or uuid column, a boolean, or an integer." })
|
|
924
|
+
}), z.strictObject({
|
|
925
|
+
column: elementNameSchema.meta({ description: "Logical name of a column of the table." }),
|
|
926
|
+
isNull: z.boolean().meta({ description: "true: the column must be NULL; false: must not be NULL." })
|
|
927
|
+
})]).meta({ description: "Condition on a row of the table: a column equals a literal or is (not) NULL." });
|
|
928
|
+
/** Умова рядків джерела: кон'юнкція; порожня — кожен рядок. */
|
|
929
|
+
const sourceWhereSchema = z.array(sourceConditionSchema).default([]).meta({ description: "Conditions every row of the source must meet (a conjunction); rows that fail them are not part of the source." });
|
|
930
|
+
/**
|
|
890
931
|
* Прийняте джерело членства (спека прав §4.7): `CustomTable`, чиї рядки
|
|
891
932
|
* пов'язують користувача зі значенням виду скоупу. Колонки — логічні імена
|
|
892
933
|
* колонок таблиці, тож перейменування колонки переписує мапінг.
|
|
@@ -900,11 +941,12 @@ const membershipSourceSchema = z.strictObject({
|
|
|
900
941
|
scope: elementNameSchema.meta({ description: "Column with the scope value." }),
|
|
901
942
|
user: elementNameSchema.meta({ description: "Column with the user id." }),
|
|
902
943
|
active: elementNameSchema.optional().meta({ description: "Boolean column; only active rows count as membership." })
|
|
903
|
-
}).meta({ description: "Logical names of the table columns." })
|
|
944
|
+
}).meta({ description: "Logical names of the table columns." }),
|
|
945
|
+
where: sourceWhereSchema
|
|
904
946
|
});
|
|
905
947
|
/**
|
|
906
948
|
* Прийняте джерело призначень (спека прав §4.7): `CustomTable`, чиї рядки
|
|
907
|
-
* дають учаснику роль на одному рівні. Рівень — стала джерела (
|
|
949
|
+
* дають учаснику роль на одному рівні. Рівень — стала джерела (спека прав §4.7).
|
|
908
950
|
*/
|
|
909
951
|
const assignmentSourceSchema = z.strictObject({
|
|
910
952
|
id: metadataIdSchema.optional(),
|
|
@@ -913,22 +955,29 @@ const assignmentSourceSchema = z.strictObject({
|
|
|
913
955
|
table: metadataRefSchema.meta({ description: "Adopted table (CustomTable) with the assignment rows." }),
|
|
914
956
|
columns: z.strictObject({
|
|
915
957
|
member: elementNameSchema.meta({ description: "Column with the member (a user for the global level)." }),
|
|
916
|
-
role: elementNameSchema.
|
|
958
|
+
role: z.union([elementNameSchema, z.strictObject({
|
|
959
|
+
column: elementNameSchema.meta({ description: "Column of the source table with the uuid reference to the role table." }),
|
|
960
|
+
references: metadataRefSchema.meta({ description: "Adopted role table (CustomTable) with a single-column uuid key." }),
|
|
961
|
+
key: elementNameSchema.meta({ description: "Column of the role table with the role key declared by a role in sourceKeys." }),
|
|
962
|
+
where: z.array(sourceConditionSchema).default([]).meta({ description: "Conditions every row of the role table must meet (a conjunction); required unless the key column is unique on its own." })
|
|
963
|
+
})]).meta({ description: "Column with the role key declared by a role in sourceKeys, or a reference to an adopted role table with the key column." }),
|
|
964
|
+
scope: elementNameSchema.nullable().optional().meta({ description: "Scope level only: column with the scope of the row, which must equal the scope of the member; null takes the scope from the member; omitted means the scopeColumn of the table." }),
|
|
917
965
|
container: elementNameSchema.optional().meta({ description: "Column with the container; required for the container level only." }),
|
|
918
966
|
active: elementNameSchema.optional().meta({ description: "Boolean column; only active rows count as assignments." })
|
|
919
|
-
}).meta({ description: "Logical names of the table columns." })
|
|
967
|
+
}).meta({ description: "Logical names of the table columns." }),
|
|
968
|
+
where: sourceWhereSchema
|
|
920
969
|
});
|
|
921
970
|
/**
|
|
922
971
|
* Рівень ролі (спека прав §4.1, Рх7): рівні джерела плюс «кожен дійсний
|
|
923
972
|
* користувач» — без рядків призначень, тож джерелам ця форма не потрібна
|
|
924
|
-
* (
|
|
973
|
+
* (спека прав Рх7).
|
|
925
974
|
*/
|
|
926
975
|
const roleAssignedOnSchema = z.union([assignedOnSchema, z.literal("everyUser").meta({ description: "Every authenticated user, with no assignment rows." })]).meta({ description: "Level of the role: global, every user, a scope kind or a rights container." });
|
|
927
976
|
/**
|
|
928
977
|
* Шапка декларацій прав: без PG-схеми, скоупу й фізичного імені — у базі
|
|
929
978
|
* набір і роль живуть лише в згенерованій проєкції, а в даних їх називає
|
|
930
|
-
* UUID
|
|
931
|
-
*
|
|
979
|
+
* UUID. `title`/`description` відкладено до матриці ролей (П4,
|
|
980
|
+
* спека прав §4.1).
|
|
932
981
|
*/
|
|
933
982
|
const rightsDeclarationHeader = z.object(objectHeaderShape).omit({
|
|
934
983
|
schema: true,
|
|
@@ -949,10 +998,10 @@ const extentSchema = z.union([
|
|
|
949
998
|
z.strictObject({ dimension: elementNameSchema.meta({ description: "Name of a project access dimension." }) })
|
|
950
999
|
]).meta({ description: "Rows the grant opens: any row, own rows, or rows with a value of an access dimension of the user." });
|
|
951
1000
|
/**
|
|
952
|
-
* Об'єкти гранту (
|
|
1001
|
+
* Об'єкти гранту (спека прав §4.1): явний перелік або «усі об'єкти рівня ролі, чиї
|
|
953
1002
|
* дії мають цю» — щоб роль не перелічувала кожен документ заради `post`.
|
|
954
1003
|
*/
|
|
955
|
-
const objectSelectorSchema = z.union([z.array(metadataRefSchema).min(1), z.strictObject({ withAction: z.enum(STANDARD_ACTIONS).meta({ description: "Standard action word; selects every object of the role level that has it." }) })]).meta({ description: "Objects of the grant: a list, or every object of the role level with an action." });
|
|
1004
|
+
const objectSelectorSchema = z.union([z.array(metadataRefSchema).min(1), z.strictObject({ withAction: z.enum(STANDARD_ACTIONS.filter((action) => action !== "administerRights")).meta({ description: "Standard action word; selects every object of the role level that has it." }) })]).meta({ description: "Objects of the grant: a list, or every object of the role level with an action." });
|
|
956
1005
|
const grantActionsSchema = z.array(elementNameSchema).min(1).meta({ description: "Standard action words, or names of custom actions of the single object of the grant." });
|
|
957
1006
|
const grantSchema = z.strictObject({
|
|
958
1007
|
objects: objectSelectorSchema,
|
|
@@ -965,9 +1014,9 @@ const denySchema = z.strictObject({
|
|
|
965
1014
|
actions: grantActionsSchema,
|
|
966
1015
|
extent: extentSchema.optional().meta({ description: "Extent to remove; every extent of the actions when omitted." })
|
|
967
1016
|
}).meta({ description: "Remove the actions from what the grants of the role and its sets give." });
|
|
968
|
-
/** Запис гранту набору: без `deny` — віднімання належить ролі (
|
|
1017
|
+
/** Запис гранту набору: без `deny` — віднімання належить ролі (спека прав §4.1). */
|
|
969
1018
|
const setGrantEntrySchema = z.union([z.strictObject({ grantAll: grantAllSchema }), z.strictObject({ grant: grantSchema })]);
|
|
970
|
-
/** Запис гранту ролі: `deny` віднімає з архетипу після розгортання (
|
|
1019
|
+
/** Запис гранту ролі: `deny` віднімає з архетипу після розгортання (спека прав §4.1). */
|
|
971
1020
|
const grantEntrySchema = z.union([
|
|
972
1021
|
z.strictObject({ grantAll: grantAllSchema }),
|
|
973
1022
|
z.strictObject({ grant: grantSchema }),
|
|
@@ -1019,14 +1068,17 @@ const roleSchema = z.strictObject({
|
|
|
1019
1068
|
include: includeSchema,
|
|
1020
1069
|
grants: z.array(grantEntrySchema).default([]).meta({ description: "Grants of the role; deny entries remove from what the grants and the included sets give." })
|
|
1021
1070
|
});
|
|
1022
|
-
|
|
1023
|
-
//#region src/model/schemas/catalog.ts
|
|
1071
|
+
// src/model/schemas/catalog.ts
|
|
1024
1072
|
/** Довідник. */
|
|
1025
1073
|
const catalogSchema = z.strictObject({
|
|
1026
1074
|
...objectHeaderShape,
|
|
1027
1075
|
kind: z.literal("Catalog").meta({ description: "Metadata kind; always Catalog." }),
|
|
1028
1076
|
kindLabel: physicalNameSchema.optional().meta({ description: "Physical kind label of the object. Assigned once at creation and never changed, so a rename keeps it." }),
|
|
1029
|
-
role: z.
|
|
1077
|
+
role: z.enum([
|
|
1078
|
+
"users",
|
|
1079
|
+
"rightsRoles",
|
|
1080
|
+
"roleAssignments"
|
|
1081
|
+
]).optional().meta({ description: "System role of the catalog: users marks the users catalog that the platform layer provisions and references (at most one per project, unscoped); rightsRoles and roleAssignments mark the custom roles and role assignments catalogs of a rights level, the level being the catalog's own scope (at most one per role and level)." }),
|
|
1030
1082
|
codeLength: z.number().int().nonnegative().default(9).meta({ description: "Length of the code attribute; 0 means the catalog has no code." }),
|
|
1031
1083
|
codeType: z.enum(["String", "Number"]).default("String").meta({ description: "Value type of the code attribute." }),
|
|
1032
1084
|
descriptionLength: z.number().int().nonnegative().default(150).meta({ description: "Length of the description attribute; 0 means the catalog has no description." }),
|
|
@@ -1058,8 +1110,7 @@ const catalogSchema = z.strictObject({
|
|
|
1058
1110
|
tabularSections: z.array(tabularSectionSchema).default([]).meta({ description: "Tabular sections of the catalog." }),
|
|
1059
1111
|
indexes: compositeIndexesSchema.meta({ description: "Composite indexes over the catalog attributes." })
|
|
1060
1112
|
});
|
|
1061
|
-
|
|
1062
|
-
//#region src/model/posting/parse.ts
|
|
1113
|
+
// src/model/posting/parse.ts
|
|
1063
1114
|
var ParseError = class extends Error {
|
|
1064
1115
|
offset;
|
|
1065
1116
|
constructor(message, offset) {
|
|
@@ -1401,8 +1452,7 @@ function parseExpression(text) {
|
|
|
1401
1452
|
throw error;
|
|
1402
1453
|
}
|
|
1403
1454
|
}
|
|
1404
|
-
|
|
1405
|
-
//#region src/model/posting/walk.ts
|
|
1455
|
+
// src/model/posting/walk.ts
|
|
1406
1456
|
/**
|
|
1407
1457
|
* Обходить усі вузли виразу в порядку появи (спершу вузол, потім операнди).
|
|
1408
1458
|
* Єдиний обхід AST: окремі рекурсії в стадіях компілятора розходилися б
|
|
@@ -1421,8 +1471,7 @@ function walkExpr(expr, visit) {
|
|
|
1421
1471
|
default: return;
|
|
1422
1472
|
}
|
|
1423
1473
|
}
|
|
1424
|
-
|
|
1425
|
-
//#region src/model/schemas/document.ts
|
|
1474
|
+
// src/model/schemas/document.ts
|
|
1426
1475
|
/**
|
|
1427
1476
|
* Один рух документа в регістр (конструктор рухів, спека П2 §7). `fields` —
|
|
1428
1477
|
* плаский словник «поле регістра → вираз»: роль поля (вимір, ресурс,
|
|
@@ -1483,8 +1532,7 @@ const documentSchema = z.strictObject({
|
|
|
1483
1532
|
tabularSections: z.array(tabularSectionSchema).default([]).meta({ description: "Tabular sections of the document." }),
|
|
1484
1533
|
indexes: compositeIndexesSchema.meta({ description: "Composite indexes over the document attributes." })
|
|
1485
1534
|
});
|
|
1486
|
-
|
|
1487
|
-
//#region src/model/schemas/scope.ts
|
|
1535
|
+
// src/model/schemas/scope.ts
|
|
1488
1536
|
/** Значення `setFunction` виду скоупу: функцію множини генерує компілятор з членства. */
|
|
1489
1537
|
const MEMBERSHIP_SET_FUNCTION = "membership";
|
|
1490
1538
|
/** Значення `scope` об'єкта, що явно виводить його зі скоупу. */
|
|
@@ -1510,8 +1558,7 @@ const scopeKindSchema = z.strictObject({
|
|
|
1510
1558
|
}).meta({ description: "SQL function defined in a .sql file." }), z.literal(MEMBERSHIP_SET_FUNCTION).meta({ description: "Generated from the membership catalog of this scope kind: the scope values where the current user is a member." })]).meta({ description: "SQL function that returns the set of scope values visible to the current user." }),
|
|
1511
1559
|
onRootDelete: z.enum(["restrict", "cascade"]).default("restrict").meta({ description: "What happens to scoped rows when the scope root is deleted." })
|
|
1512
1560
|
}).meta({ description: "Scope kind of the application (tenant dimension)." });
|
|
1513
|
-
|
|
1514
|
-
//#region src/model/schemas/enumeration.ts
|
|
1561
|
+
// src/model/schemas/enumeration.ts
|
|
1515
1562
|
const enumValueSchema = z.strictObject({
|
|
1516
1563
|
id: metadataIdSchema.optional(),
|
|
1517
1564
|
name: objectNameSchema.meta({ description: "Logical name of the enumeration value." }),
|
|
@@ -1532,8 +1579,7 @@ const enumerationSchema = z.strictObject({
|
|
|
1532
1579
|
params: { rule: "scope.not-allowed" }
|
|
1533
1580
|
});
|
|
1534
1581
|
});
|
|
1535
|
-
|
|
1536
|
-
//#region src/model/schemas/information-register.ts
|
|
1582
|
+
// src/model/schemas/information-register.ts
|
|
1537
1583
|
/** Регістр відомостей. */
|
|
1538
1584
|
const informationRegisterSchema = z.strictObject({
|
|
1539
1585
|
...objectHeaderShape,
|
|
@@ -1556,8 +1602,7 @@ const informationRegisterSchema = z.strictObject({
|
|
|
1556
1602
|
resources: z.array(registerFieldSchema).default([]).meta({ description: "Resources: the value fields of a record." }),
|
|
1557
1603
|
attributes: z.array(attributeSchema).default([]).meta({ description: "Attributes: extra information of a record." })
|
|
1558
1604
|
});
|
|
1559
|
-
|
|
1560
|
-
//#region src/model/schemas/accumulation-register.ts
|
|
1605
|
+
// src/model/schemas/accumulation-register.ts
|
|
1561
1606
|
/**
|
|
1562
1607
|
* Ресурс регістра накопичення. Ресурси сумуються в залишки й обороти, тож
|
|
1563
1608
|
* форма вужча за реквізит: лише число з precision/scale — без length,
|
|
@@ -1602,8 +1647,7 @@ const accumulationRegisterSchema = z.strictObject({
|
|
|
1602
1647
|
params: { rule: "register.balance-control-type" }
|
|
1603
1648
|
});
|
|
1604
1649
|
});
|
|
1605
|
-
|
|
1606
|
-
//#region src/model/schemas/constant.ts
|
|
1650
|
+
// src/model/schemas/constant.ts
|
|
1607
1651
|
/** Константа — окремий об'єкт зі значенням довільного логічного типу. */
|
|
1608
1652
|
const constantSchema = z.strictObject({
|
|
1609
1653
|
...objectHeaderShape,
|
|
@@ -1614,8 +1658,7 @@ const constantSchema = z.strictObject({
|
|
|
1614
1658
|
...valueTypeShape,
|
|
1615
1659
|
defaultValue: defaultValueSchema.optional().meta({ description: "Initial value of the constant." })
|
|
1616
1660
|
}).superRefine(refineValueType);
|
|
1617
|
-
|
|
1618
|
-
//#region src/model/schemas/custom-table.ts
|
|
1661
|
+
// src/model/schemas/custom-table.ts
|
|
1619
1662
|
const IDENTITY_TYPES = [
|
|
1620
1663
|
"SmallInt",
|
|
1621
1664
|
"Integer",
|
|
@@ -1727,14 +1770,21 @@ const rowLevelSecuritySchema = z.enum([
|
|
|
1727
1770
|
const foreignKeySchema = z.strictObject({
|
|
1728
1771
|
name: constraintName,
|
|
1729
1772
|
columns: columnList,
|
|
1730
|
-
references: z.union([
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1773
|
+
references: z.union([
|
|
1774
|
+
z.strictObject({
|
|
1775
|
+
object: metadataRefSchema.meta({ description: "Referenced metadata object." }),
|
|
1776
|
+
columns: columnList.meta({ description: "Logical names of columns of the referenced CustomTable." })
|
|
1777
|
+
}),
|
|
1778
|
+
z.strictObject({
|
|
1779
|
+
object: metadataRefSchema.meta({ description: "Referenced object of a kind (not a CustomTable)." }),
|
|
1780
|
+
key: z.enum(["ref", "scopedRef"]).meta({ description: "Referenced key of the kind table: \"ref\" is its key column (one local column); \"scopedRef\" is the pair (scope column, key) of a table with its own scope column (two local columns: scope, then key)." })
|
|
1781
|
+
}),
|
|
1782
|
+
z.strictObject({ external: z.strictObject({
|
|
1783
|
+
schema: appSchemaNameSchema.min(1).meta({ description: "PostgreSQL schema of the external table." }),
|
|
1784
|
+
table: z.string().min(1).meta({ description: "Physical name of the external table." }),
|
|
1785
|
+
columns: z.array(z.string().min(1)).min(1).meta({ description: "Physical column names of the external table." })
|
|
1786
|
+
}).meta({ description: "Referenced table outside the metadata." }) })
|
|
1787
|
+
]).meta({ description: "Referenced target: columns of a CustomTable, the key of a kind table, or an external table." }),
|
|
1738
1788
|
onDelete: fkActionSchema.default("noAction").meta({ description: "Action on delete of the referenced row." }),
|
|
1739
1789
|
onUpdate: fkActionSchema.default("noAction").meta({ description: "Action on update of the referenced key." }),
|
|
1740
1790
|
deferrable: deferrableSchema
|
|
@@ -1802,8 +1852,7 @@ const customTableSchema = z.strictObject({
|
|
|
1802
1852
|
*/
|
|
1803
1853
|
rowLevelSecurity: rowLevelSecuritySchema.default("off").meta({ description: "Row-level security of the table: off, enabled, or forced (applies to the table owner too)." })
|
|
1804
1854
|
});
|
|
1805
|
-
|
|
1806
|
-
//#region src/model/schemas/pg-enum.ts
|
|
1855
|
+
// src/model/schemas/pg-enum.ts
|
|
1807
1856
|
/**
|
|
1808
1857
|
* Прийнятий PG-енам. Значення — фізичні мітки типу без власної ідентичності,
|
|
1809
1858
|
* тому порядок значущий (порядок у PG-енамі), а дублікати заборонені.
|
|
@@ -1824,8 +1873,7 @@ const pgEnumSchema = z.strictObject({
|
|
|
1824
1873
|
seen.add(label);
|
|
1825
1874
|
});
|
|
1826
1875
|
});
|
|
1827
|
-
|
|
1828
|
-
//#region src/model/schemas/event-subscription.ts
|
|
1876
|
+
// src/model/schemas/event-subscription.ts
|
|
1829
1877
|
/**
|
|
1830
1878
|
* Події підписки (спека промоції §9.3): до чи після запису й видалення рядка
|
|
1831
1879
|
* джерела. Тригер за подією генерує компілятор
|
|
@@ -1864,12 +1912,11 @@ const eventSubscriptionSchema = z.strictObject({
|
|
|
1864
1912
|
name: z.string().min(1).meta({ description: "Name of a function without arguments that returns trigger, declared in the .sql files." })
|
|
1865
1913
|
}).meta({ description: "Trigger function called for the event." })
|
|
1866
1914
|
});
|
|
1867
|
-
|
|
1868
|
-
//#region src/model/schemas/sql-debt.ts
|
|
1915
|
+
// src/model/schemas/sql-debt.ts
|
|
1869
1916
|
/** Ім'я файлу переліку боргу в корені `metadata/`. */
|
|
1870
1917
|
const SQL_DEBT_FILE = "sql-debt.json";
|
|
1871
1918
|
/**
|
|
1872
|
-
* Перелік боргу дослівного SQL (
|
|
1919
|
+
* Перелік боргу дослівного SQL (спека П2 §8.6): ідентичності
|
|
1873
1920
|
* одиниць поза закритою оболонкою, які тека вже мала, коли її розклав
|
|
1874
1921
|
* `introspect`. Ратчет лише звужується: нова одиниця боргу, якої тут немає, —
|
|
1875
1922
|
* помилка компіляції, а `fix` лише прибирає записи. Відсортований і без
|
|
@@ -1889,8 +1936,7 @@ const sqlDebtSchema = z.strictObject({
|
|
|
1889
1936
|
});
|
|
1890
1937
|
});
|
|
1891
1938
|
});
|
|
1892
|
-
|
|
1893
|
-
//#region src/model/schemas/project.ts
|
|
1939
|
+
// src/model/schemas/project.ts
|
|
1894
1940
|
/**
|
|
1895
1941
|
* Пресети провайдера бази (платформна спека §6.9). Проєкт вибирає пресет
|
|
1896
1942
|
* ключем, а його вміст — факти образу провайдера — лишається кодом платформи.
|
|
@@ -1970,13 +2016,139 @@ const PROVIDER_API_ROLES = { supabase: {
|
|
|
1970
2016
|
service: "service_role"
|
|
1971
2017
|
} };
|
|
1972
2018
|
/**
|
|
2019
|
+
* Provider login roles that can run untrusted API requests. Rights maintenance
|
|
2020
|
+
* mode is never enabled for them, even when one owns the rights functions:
|
|
2021
|
+
* provider services work under these shared logins.
|
|
2022
|
+
*/
|
|
2023
|
+
const PROVIDER_LOGIN_ROLES = { supabase: [
|
|
2024
|
+
"authenticator",
|
|
2025
|
+
"supabase_auth_admin",
|
|
2026
|
+
"supabase_storage_admin",
|
|
2027
|
+
"supabase_realtime_admin",
|
|
2028
|
+
"supabase_admin"
|
|
2029
|
+
] };
|
|
2030
|
+
/**
|
|
2031
|
+
* Схеми, які створює й наповнює провайдер (платформна спека §6.9): застосунок
|
|
2032
|
+
* має в них лише поверхню пресету. Факт T0, бо його потребує і компілятор (T1:
|
|
2033
|
+
* доступність недосудного SQL, `SECURITY DEFINER` над RLS), і схема (T2) та
|
|
2034
|
+
* designer — один перелік замість копії по ярусах. Порядок зберігається:
|
|
2035
|
+
* його читає й `SUPABASE_SURFACES`.
|
|
2036
|
+
*/
|
|
2037
|
+
const PROVIDER_SCHEMAS = { supabase: [
|
|
2038
|
+
"_analytics",
|
|
2039
|
+
"_realtime",
|
|
2040
|
+
"_supavisor",
|
|
2041
|
+
"auth",
|
|
2042
|
+
"cron",
|
|
2043
|
+
"etl",
|
|
2044
|
+
"extensions",
|
|
2045
|
+
"graphql",
|
|
2046
|
+
"graphql_public",
|
|
2047
|
+
"information_schema",
|
|
2048
|
+
"net",
|
|
2049
|
+
"pgbouncer",
|
|
2050
|
+
"pgmq",
|
|
2051
|
+
"pgmq_public",
|
|
2052
|
+
"pgsodium",
|
|
2053
|
+
"pgsodium_masks",
|
|
2054
|
+
"pgtle",
|
|
2055
|
+
"realtime",
|
|
2056
|
+
"storage",
|
|
2057
|
+
"supabase_functions",
|
|
2058
|
+
"supabase_migrations",
|
|
2059
|
+
"vault"
|
|
2060
|
+
] };
|
|
2061
|
+
/**
|
|
2062
|
+
* Provider functions that application SQL running inside a command (kind
|
|
2063
|
+
* module functions, subscription handlers, set and dimension functions,
|
|
2064
|
+
* movement query blocks) may call, as `schema.name`.
|
|
2065
|
+
*/
|
|
2066
|
+
const PROVIDER_FUNCTIONS = { supabase: [
|
|
2067
|
+
"auth.uid",
|
|
2068
|
+
"auth.jwt",
|
|
2069
|
+
"auth.role"
|
|
2070
|
+
] };
|
|
2071
|
+
/**
|
|
2072
|
+
* Provider functions that expression units (metadata expressions of adopted
|
|
2073
|
+
* tables, views, verbatim policy expressions) may call in addition to
|
|
2074
|
+
* `PROVIDER_FUNCTIONS`, as `schema.name`.
|
|
2075
|
+
*/
|
|
2076
|
+
const PROVIDER_EXPRESSION_FUNCTIONS = { supabase: ["extensions.gen_random_bytes", "extensions.uuid_generate_v4"] };
|
|
2077
|
+
/**
|
|
2078
|
+
* Provider functions that execute the SQL text passed to them, as
|
|
2079
|
+
* `schema.name`.
|
|
2080
|
+
*/
|
|
2081
|
+
const PROVIDER_SQL_TEXT_FUNCTIONS = { supabase: [
|
|
2082
|
+
"extensions.dblink",
|
|
2083
|
+
"extensions.dblink_exec",
|
|
2084
|
+
"extensions.dblink_send_query",
|
|
2085
|
+
"extensions.dblink_open",
|
|
2086
|
+
"graphql.resolve",
|
|
2087
|
+
"graphql_public.graphql",
|
|
2088
|
+
"pgtle.install_extension",
|
|
2089
|
+
"cron.schedule",
|
|
2090
|
+
"cron.schedule_in_database",
|
|
2091
|
+
"cron.alter_job"
|
|
2092
|
+
] };
|
|
2093
|
+
/**
|
|
2094
|
+
* Ролі платформи за призначенням (платформна спека §6.7, спека прав §5.1):
|
|
2095
|
+
* на відміну від ролей API їх не дає провайдер — на базі споживача їх
|
|
2096
|
+
* створює designer (`simetra roles`), тож ім'я одне для всіх провайдерів.
|
|
2097
|
+
* Роль кластерна: її немає в бажаному SQL, і згенерований SQL нею не
|
|
2098
|
+
* керує — лише дає їй `EXECUTE` функцій і `USAGE` схеми.
|
|
2099
|
+
*/
|
|
2100
|
+
const PLATFORM_ROLES = { command: "simetra_command" };
|
|
2101
|
+
/**
|
|
2102
|
+
* Ролі входу платформи (спека П4 §6.2): на відміну від `PLATFORM_ROLES` у
|
|
2103
|
+
* них входять, а права вони беруть лише через `SET ROLE` — членства
|
|
2104
|
+
* `INHERIT FALSE, SET TRUE`. Гранту згенерованого SQL вони не отримують
|
|
2105
|
+
* (`GrantPurpose` їх не знає), а режим обслуговування прав для них не
|
|
2106
|
+
* вмикається: рантайм не власник функцій прав (спека прав §7).
|
|
2107
|
+
*/
|
|
2108
|
+
const PLATFORM_LOGIN_ROLES = { runtime: "simetra_runtime" };
|
|
2109
|
+
/**
|
|
2110
|
+
* Ролі запиту, членом яких стає роль входу рантайму, за провайдером: профіль
|
|
2111
|
+
* вирішує членство даними, а не гілкою за іменем провайдера. Новий провайдер
|
|
2112
|
+
* додає свій рядок разом зі своїми ролями запиту.
|
|
2113
|
+
*/
|
|
2114
|
+
const LOGIN_ROLE_REQUEST_PURPOSES = { supabase: ["user"] };
|
|
2115
|
+
/**
|
|
2116
|
+
* The session setting through which `runCommand` passes the command context;
|
|
2117
|
+
* its value is a JSON `CommandContext`.
|
|
2118
|
+
*/
|
|
2119
|
+
const COMMAND_SETTING = "simetra.command";
|
|
2120
|
+
/** The session setting for platform rights maintenance. */
|
|
2121
|
+
const RIGHTS_MAINTENANCE_SETTING = "simetra.rights_maintenance";
|
|
2122
|
+
/**
|
|
2123
|
+
* The session setting that carries the request claims: the platform layer
|
|
2124
|
+
* reads the current user's subject (`sub`) from it.
|
|
2125
|
+
*/
|
|
2126
|
+
const SESSION_CLAIMS_SETTING = "request.jwt.claims";
|
|
2127
|
+
/**
|
|
2128
|
+
* The namespace of the platform's own session settings: the command context
|
|
2129
|
+
* and every later platform setting.
|
|
2130
|
+
*/
|
|
2131
|
+
const PLATFORM_SETTING_PREFIX = "simetra.";
|
|
2132
|
+
/**
|
|
2133
|
+
* Session settings that application SQL must never change: name prefixes
|
|
2134
|
+
* (case-insensitive) and exact names.
|
|
2135
|
+
*/
|
|
2136
|
+
const PROTECTED_SESSION_SETTINGS = {
|
|
2137
|
+
prefixes: [PLATFORM_SETTING_PREFIX, "request.jwt."],
|
|
2138
|
+
names: [
|
|
2139
|
+
"role",
|
|
2140
|
+
"session_authorization",
|
|
2141
|
+
"session_replication_role"
|
|
2142
|
+
]
|
|
2143
|
+
};
|
|
2144
|
+
/**
|
|
1973
2145
|
* Факти провайдера ідентичності за пресетом бази. Колонки — факт образу
|
|
1974
2146
|
* провайдера: їх наявність на стеку перевіряє DB-тест, а лежання таблиці на
|
|
1975
2147
|
* поверхні тригерів пресету — тест T2 (T0 його не імпортує).
|
|
1976
2148
|
*
|
|
1977
2149
|
* Чого `IdentitySource` не виражає — межа, яку другий провайдер перевіряє
|
|
1978
2150
|
* першою, бо платформний шар вважає це спільним для всіх:
|
|
1979
|
-
* - контракт сесії: `current_setting(
|
|
2151
|
+
* - контракт сесії: `current_setting(SESSION_CLAIMS_SETTING)` і claim `sub`
|
|
1980
2152
|
* у ньому (функція поточного користувача);
|
|
1981
2153
|
* - правило С8: ключ облікового запису — uuid, він же `id` користувача, а
|
|
1982
2154
|
* `subject` — цей ключ як `::text`;
|
|
@@ -2004,7 +2176,9 @@ const PROVIDER_IDENTITY_SOURCES = { supabase: {
|
|
|
2004
2176
|
],
|
|
2005
2177
|
anonymousColumn: "is_anonymous",
|
|
2006
2178
|
deletedAtColumn: "deleted_at",
|
|
2007
|
-
providerKey: "supabase"
|
|
2179
|
+
providerKey: "supabase",
|
|
2180
|
+
subjectIsUserId: true,
|
|
2181
|
+
anonymousClaim: "is_anonymous"
|
|
2008
2182
|
} };
|
|
2009
2183
|
/** Файл проєкту: ідентичність, правила іменування й часовий пояс застосунку. */
|
|
2010
2184
|
const projectSchema = z.strictObject({
|
|
@@ -2043,8 +2217,496 @@ const projectSchema = z.strictObject({
|
|
|
2043
2217
|
});
|
|
2044
2218
|
});
|
|
2045
2219
|
});
|
|
2046
|
-
|
|
2047
|
-
|
|
2220
|
+
// src/model/runtime/core.ts
|
|
2221
|
+
/**
|
|
2222
|
+
* Відмови ядра (спека П4 §6.10): `MESSAGE` — код, `DETAIL` — причина чи
|
|
2223
|
+
* ключ; даних рядка відмова не несе (Рт4). Єдине джерело для генераторів
|
|
2224
|
+
* SQL (T1) і рантайму команд (T3): T3 не імпортує T1.
|
|
2225
|
+
*/
|
|
2226
|
+
const COMMAND_CORE_ERRORS = {
|
|
2227
|
+
invalid: {
|
|
2228
|
+
errcode: "22023",
|
|
2229
|
+
message: "command.invalid",
|
|
2230
|
+
create: "create",
|
|
2231
|
+
item: "p_item",
|
|
2232
|
+
tabular: "tabular",
|
|
2233
|
+
expectedVersion: "p_expected_version",
|
|
2234
|
+
mark: "p_mark",
|
|
2235
|
+
predefined: "predefined",
|
|
2236
|
+
creatorMember: "creatorMember"
|
|
2237
|
+
},
|
|
2238
|
+
context: {
|
|
2239
|
+
errcode: "42501",
|
|
2240
|
+
message: "command.context",
|
|
2241
|
+
detail: "phase",
|
|
2242
|
+
missing: "missing",
|
|
2243
|
+
malformed: "malformed",
|
|
2244
|
+
unknownAction: "unknown-action"
|
|
2245
|
+
},
|
|
2246
|
+
forbidden: {
|
|
2247
|
+
errcode: "42501",
|
|
2248
|
+
message: "command.forbidden",
|
|
2249
|
+
noRight: "no-right",
|
|
2250
|
+
newCarrier: "new-carrier",
|
|
2251
|
+
effect: "effect",
|
|
2252
|
+
rightsContext: "rights-context",
|
|
2253
|
+
escalation: "escalation",
|
|
2254
|
+
deltaDomain: "delta-domain",
|
|
2255
|
+
roleInUse: "role-in-use",
|
|
2256
|
+
lastFullAccess: "last-full-access"
|
|
2257
|
+
},
|
|
2258
|
+
conflict: {
|
|
2259
|
+
errcode: "P0001",
|
|
2260
|
+
message: "command.conflict",
|
|
2261
|
+
version: "version",
|
|
2262
|
+
exists: "exists"
|
|
2263
|
+
}
|
|
2264
|
+
};
|
|
2265
|
+
/** Тригер ієрархії відмовляє поза `READ COMMITTED` (спека П4 §6.6). */
|
|
2266
|
+
const HIERARCHY_ISOLATION_ERROR = {
|
|
2267
|
+
errcode: "0A000",
|
|
2268
|
+
message: "hierarchy.isolation"
|
|
2269
|
+
};
|
|
2270
|
+
/**
|
|
2271
|
+
* Типи, які ядро віддає текстом, щоб `jsonb` не округлив їх (Рт1): `numeric` і
|
|
2272
|
+
* `bigint`, у тому числі з модифікатором та масивом.
|
|
2273
|
+
*/
|
|
2274
|
+
const TEXT_ENCODED_TYPE = /^(bigint|numeric)(\(.*\))?(\[\])?$/;
|
|
2275
|
+
function isTextEncodedType(pgType) {
|
|
2276
|
+
return TEXT_ENCODED_TYPE.test(pgType);
|
|
2277
|
+
}
|
|
2278
|
+
/** Функція поточного користувача схеми платформи. */
|
|
2279
|
+
const CURRENT_USER_FUNCTION_NAME = "current_user_id";
|
|
2280
|
+
/** Функція хеша застосованого знімка (схема — `PLATFORM_SCHEMA`). */
|
|
2281
|
+
const APPLIED_SNAPSHOT_HASH_FUNCTION_NAME = "applied_snapshot_hash";
|
|
2282
|
+
// src/model/runtime/operation.ts
|
|
2283
|
+
/** Operations on an object that a command accepts (P4 spec §6.4). */
|
|
2284
|
+
const OBJECT_OPERATIONS = [
|
|
2285
|
+
"create",
|
|
2286
|
+
"update",
|
|
2287
|
+
"markDeletion",
|
|
2288
|
+
"delete"
|
|
2289
|
+
];
|
|
2290
|
+
/**
|
|
2291
|
+
* The object-module event an operation raises; `undefined` — none. Подію
|
|
2292
|
+
* визначає операція, а не дія контексту: на довідниках прав дія —
|
|
2293
|
+
* `administerRights` і для запису, і для видалення (Р-A3-2).
|
|
2294
|
+
*/
|
|
2295
|
+
const OPERATION_EVENTS = {
|
|
2296
|
+
create: "write",
|
|
2297
|
+
update: "write",
|
|
2298
|
+
markDeletion: "write",
|
|
2299
|
+
delete: void 0
|
|
2300
|
+
};
|
|
2301
|
+
const rowIdSchema = z.guid();
|
|
2302
|
+
const expectedVersionSchema = z.int().min(1);
|
|
2303
|
+
const valuesSchema = z.record(z.string(), z.unknown());
|
|
2304
|
+
const tabularSectionsSchema = z.record(z.string(), z.array(z.record(z.string(), z.unknown())));
|
|
2305
|
+
/** One operation of a command, by logical names. */
|
|
2306
|
+
const operationSchema = z.discriminatedUnion("action", [
|
|
2307
|
+
z.strictObject({
|
|
2308
|
+
action: z.literal("create"),
|
|
2309
|
+
object: metadataRefSchema,
|
|
2310
|
+
id: rowIdSchema.optional(),
|
|
2311
|
+
values: valuesSchema.optional(),
|
|
2312
|
+
tabularSections: tabularSectionsSchema.optional(),
|
|
2313
|
+
creatorMember: valuesSchema.optional()
|
|
2314
|
+
}),
|
|
2315
|
+
z.strictObject({
|
|
2316
|
+
action: z.literal("update"),
|
|
2317
|
+
object: metadataRefSchema,
|
|
2318
|
+
id: rowIdSchema,
|
|
2319
|
+
expectedVersion: expectedVersionSchema,
|
|
2320
|
+
values: valuesSchema.optional(),
|
|
2321
|
+
tabularSections: tabularSectionsSchema.optional()
|
|
2322
|
+
}),
|
|
2323
|
+
z.strictObject({
|
|
2324
|
+
action: z.literal("markDeletion"),
|
|
2325
|
+
object: metadataRefSchema,
|
|
2326
|
+
id: rowIdSchema,
|
|
2327
|
+
expectedVersion: expectedVersionSchema,
|
|
2328
|
+
mark: z.boolean()
|
|
2329
|
+
}),
|
|
2330
|
+
z.strictObject({
|
|
2331
|
+
action: z.literal("delete"),
|
|
2332
|
+
object: metadataRefSchema,
|
|
2333
|
+
id: rowIdSchema,
|
|
2334
|
+
expectedVersion: expectedVersionSchema
|
|
2335
|
+
})
|
|
2336
|
+
]);
|
|
2337
|
+
/** A batch: a non-empty ordered list of operations run in one transaction. */
|
|
2338
|
+
const batchSchema = z.array(operationSchema).min(1);
|
|
2339
|
+
// src/model/runtime/errors.ts
|
|
2340
|
+
/** Error codes a command or the runtime factory reports (P4 spec §6.10). */
|
|
2341
|
+
const COMMAND_ERROR_CODES = [
|
|
2342
|
+
"command.forbidden",
|
|
2343
|
+
"command.conflict",
|
|
2344
|
+
"command.invalid",
|
|
2345
|
+
"command.constraint",
|
|
2346
|
+
"command.context",
|
|
2347
|
+
"command.unauthenticated",
|
|
2348
|
+
"command.rejected",
|
|
2349
|
+
"command.nested",
|
|
2350
|
+
"command.depth",
|
|
2351
|
+
"command.retry-exhausted",
|
|
2352
|
+
"command.model-mismatch",
|
|
2353
|
+
"command.read-role-missing",
|
|
2354
|
+
"command.unavailable",
|
|
2355
|
+
"command.internal"
|
|
2356
|
+
];
|
|
2357
|
+
// src/model/runtime/session.ts
|
|
2358
|
+
/**
|
|
2359
|
+
* Claims of the verified session (P4 spec Рт19). Решта claims іде в базу як
|
|
2360
|
+
* є, тож схема їх не відкидає.
|
|
2361
|
+
*/
|
|
2362
|
+
const sessionClaimsSchema = z.looseObject({
|
|
2363
|
+
sub: z.string().min(1),
|
|
2364
|
+
act: z.looseObject({ sub: z.string().min(1) }).optional()
|
|
2365
|
+
});
|
|
2366
|
+
// src/model/runtime/read.ts
|
|
2367
|
+
/** Upper bound of one server read page (P4 spec §6.11). */
|
|
2368
|
+
const READ_LIMIT_MAX = 200;
|
|
2369
|
+
/** A server read: one row by id or a keyset page by equality filter. */
|
|
2370
|
+
const readQuerySchema = z.union([z.strictObject({
|
|
2371
|
+
object: metadataRefSchema,
|
|
2372
|
+
id: z.guid()
|
|
2373
|
+
}), z.strictObject({
|
|
2374
|
+
object: metadataRefSchema,
|
|
2375
|
+
where: z.record(z.string(), z.unknown()),
|
|
2376
|
+
after: z.guid().optional(),
|
|
2377
|
+
limit: z.int().min(1).max(200)
|
|
2378
|
+
})]);
|
|
2379
|
+
// src/model/runtime/module.ts
|
|
2380
|
+
/** Keys an object module may define. */
|
|
2381
|
+
const OBJECT_MODULE_KEYS = ["beforeWrite", "onWrite"];
|
|
2382
|
+
/** Types an object module by its generated entity type; returns it as is. */
|
|
2383
|
+
function defineObjectModule(module) {
|
|
2384
|
+
return module;
|
|
2385
|
+
}
|
|
2386
|
+
// src/model/runtime/catalog.ts
|
|
2387
|
+
/**
|
|
2388
|
+
* Base types a bound parameter is cast to. Без `character`: `$n::character`
|
|
2389
|
+
* — це `char(1)`, який мовчки обрізав би значення.
|
|
2390
|
+
*/
|
|
2391
|
+
const CAST_TYPES = [
|
|
2392
|
+
"text",
|
|
2393
|
+
"uuid",
|
|
2394
|
+
"boolean",
|
|
2395
|
+
"smallint",
|
|
2396
|
+
"integer",
|
|
2397
|
+
"bigint",
|
|
2398
|
+
"numeric",
|
|
2399
|
+
"real",
|
|
2400
|
+
"double precision",
|
|
2401
|
+
"date",
|
|
2402
|
+
"timestamp with time zone",
|
|
2403
|
+
"timestamp without time zone",
|
|
2404
|
+
"time without time zone",
|
|
2405
|
+
"interval",
|
|
2406
|
+
"character varying",
|
|
2407
|
+
"bytea",
|
|
2408
|
+
"json",
|
|
2409
|
+
"jsonb"
|
|
2410
|
+
];
|
|
2411
|
+
const CAST_TYPE = new RegExp(`^(?:${CAST_TYPES.join("|")})(?:\\[\\])?$`);
|
|
2412
|
+
const castTypeSchema = z.string().regex(CAST_TYPE);
|
|
2413
|
+
const qualifiedNameSchema = z.strictObject({
|
|
2414
|
+
schema: z.string(),
|
|
2415
|
+
name: z.string()
|
|
2416
|
+
});
|
|
2417
|
+
const runtimeAttributeSchema = z.strictObject({
|
|
2418
|
+
name: z.string(),
|
|
2419
|
+
column: z.string(),
|
|
2420
|
+
/** Лише для `type` і декодування; у SQL не йде. */
|
|
2421
|
+
pgType: z.string(),
|
|
2422
|
+
castType: castTypeSchema,
|
|
2423
|
+
type: z.enum([...LOGICAL_TYPES, "Raw"]),
|
|
2424
|
+
array: z.literal(true).optional(),
|
|
2425
|
+
required: z.boolean(),
|
|
2426
|
+
maxLength: z.int().min(1).optional(),
|
|
2427
|
+
precision: z.int().min(1).optional(),
|
|
2428
|
+
scale: z.int().min(0).optional(),
|
|
2429
|
+
insert: z.boolean(),
|
|
2430
|
+
update: z.boolean(),
|
|
2431
|
+
generated: z.literal(true).optional(),
|
|
2432
|
+
/** Значення `Ref` на перерахування: логічне ім'я й мітка бази. */
|
|
2433
|
+
enumValues: z.array(z.strictObject({
|
|
2434
|
+
name: z.string(),
|
|
2435
|
+
label: z.string()
|
|
2436
|
+
})).optional(),
|
|
2437
|
+
pair: z.strictObject({
|
|
2438
|
+
typeColumn: z.string(),
|
|
2439
|
+
targets: z.array(z.strictObject({
|
|
2440
|
+
object: metadataRefSchema,
|
|
2441
|
+
label: z.string()
|
|
2442
|
+
}))
|
|
2443
|
+
}).optional()
|
|
2444
|
+
});
|
|
2445
|
+
const runtimeConstraintSchema = z.strictObject({
|
|
2446
|
+
name: z.string(),
|
|
2447
|
+
kind: z.enum([
|
|
2448
|
+
"primaryKey",
|
|
2449
|
+
"unique",
|
|
2450
|
+
"check",
|
|
2451
|
+
"foreignKey"
|
|
2452
|
+
]),
|
|
2453
|
+
columns: z.array(z.string())
|
|
2454
|
+
});
|
|
2455
|
+
const runtimeSectionSchema = z.strictObject({
|
|
2456
|
+
name: z.string(),
|
|
2457
|
+
table: qualifiedNameSchema,
|
|
2458
|
+
key: z.string(),
|
|
2459
|
+
keyName: z.string(),
|
|
2460
|
+
parent: z.string(),
|
|
2461
|
+
parentName: z.string(),
|
|
2462
|
+
lineNumber: z.string(),
|
|
2463
|
+
lineNumberName: z.string(),
|
|
2464
|
+
attributes: z.array(runtimeAttributeSchema),
|
|
2465
|
+
constraints: z.array(runtimeConstraintSchema)
|
|
2466
|
+
});
|
|
2467
|
+
const runtimeOperationTargetSchema = z.strictObject({
|
|
2468
|
+
function: qualifiedNameSchema,
|
|
2469
|
+
context: z.string()
|
|
2470
|
+
});
|
|
2471
|
+
/**
|
|
2472
|
+
* `create` кореня виду скоупу (спека П4 §6.13): T3 генерує id і відхиляє `id` і
|
|
2473
|
+
* `tabularSections`; `membership` — id довідника членства каталогу, коли вид
|
|
2474
|
+
* має роль з `rootCreator`: тоді `creatorMember` дозволений.
|
|
2475
|
+
*/
|
|
2476
|
+
const runtimeRootCreateSchema = z.strictObject({ membership: z.string().optional() });
|
|
2477
|
+
const runtimeObjectSchema = z.strictObject({
|
|
2478
|
+
id: z.string(),
|
|
2479
|
+
name: z.string(),
|
|
2480
|
+
kind: metadataKindSchema,
|
|
2481
|
+
kindLabel: z.string(),
|
|
2482
|
+
table: qualifiedNameSchema,
|
|
2483
|
+
key: z.string(),
|
|
2484
|
+
keyName: z.string(),
|
|
2485
|
+
versionColumn: z.string(),
|
|
2486
|
+
versionName: z.string(),
|
|
2487
|
+
scopeKindId: z.string().optional(),
|
|
2488
|
+
scopeColumn: z.string().optional(),
|
|
2489
|
+
/**
|
|
2490
|
+
* Лише на довіднику членства: колонка користувача, яку разом із ключем і
|
|
2491
|
+
* скоупом примушує платформа (`creatorMember`, спека П4 §6.13).
|
|
2492
|
+
*/
|
|
2493
|
+
membership: z.strictObject({ userColumn: z.string() }).optional(),
|
|
2494
|
+
attributes: z.array(runtimeAttributeSchema),
|
|
2495
|
+
tabularSections: z.array(runtimeSectionSchema),
|
|
2496
|
+
operations: z.strictObject({
|
|
2497
|
+
create: runtimeOperationTargetSchema.extend({ root: runtimeRootCreateSchema.optional() }).optional(),
|
|
2498
|
+
update: runtimeOperationTargetSchema.optional(),
|
|
2499
|
+
markDeletion: runtimeOperationTargetSchema.optional(),
|
|
2500
|
+
delete: runtimeOperationTargetSchema.optional()
|
|
2501
|
+
}),
|
|
2502
|
+
constraints: z.array(runtimeConstraintSchema)
|
|
2503
|
+
});
|
|
2504
|
+
/** The runtime catalog: a projection of the compiled model (P4 spec §6.3). */
|
|
2505
|
+
const runtimeCatalogSchema = z.strictObject({
|
|
2506
|
+
format: z.literal(1),
|
|
2507
|
+
snapshotHash: z.string(),
|
|
2508
|
+
provider: z.enum(DATABASE_PROVIDERS),
|
|
2509
|
+
objects: z.array(runtimeObjectSchema)
|
|
2510
|
+
}).superRefine((catalog, ctx) => {
|
|
2511
|
+
catalog.objects.forEach((object, index) => {
|
|
2512
|
+
const membership = object.operations.create?.root?.membership;
|
|
2513
|
+
if (membership === void 0) return;
|
|
2514
|
+
const target = catalog.objects.find((o) => o.id === membership);
|
|
2515
|
+
if (target?.membership === void 0 || target.scopeColumn === void 0) ctx.addIssue({
|
|
2516
|
+
code: "custom",
|
|
2517
|
+
path: [
|
|
2518
|
+
"objects",
|
|
2519
|
+
index,
|
|
2520
|
+
"operations",
|
|
2521
|
+
"create",
|
|
2522
|
+
"root",
|
|
2523
|
+
"membership"
|
|
2524
|
+
],
|
|
2525
|
+
message: "membership is not a membership catalog of this catalog"
|
|
2526
|
+
});
|
|
2527
|
+
});
|
|
2528
|
+
});
|
|
2529
|
+
// src/model/runtime/values.ts
|
|
2530
|
+
const invalid = (path) => ({ error: {
|
|
2531
|
+
code: "command.invalid",
|
|
2532
|
+
path
|
|
2533
|
+
} });
|
|
2534
|
+
const BYTES_TEXT = /^\\x(?:[0-9a-fA-F]{2})*$/;
|
|
2535
|
+
const INTEGER_TEXT = /^[+-]?\d+$/;
|
|
2536
|
+
const LONE_SURROGATE = /[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/;
|
|
2537
|
+
const storable = (text) => !text.includes("\0") && !LONE_SURROGATE.test(text);
|
|
2538
|
+
function isPlainObject(value) {
|
|
2539
|
+
if (typeof value !== "object" || value === null) return false;
|
|
2540
|
+
const proto = Object.getPrototypeOf(value);
|
|
2541
|
+
return proto === Object.prototype || proto === null;
|
|
2542
|
+
}
|
|
2543
|
+
/**
|
|
2544
|
+
* Копія чистого JSON-значення; `undefined` — значення не JSON. Копія, а не
|
|
2545
|
+
* саме значення: `jsonb` не має `Map`, `Date`, `bigint`, `undefined`, і
|
|
2546
|
+
* `JSON.stringify` мовчки змінив би їх (`{}`, рядок, пропуск), а не відмовив.
|
|
2547
|
+
*/
|
|
2548
|
+
function pureJson(value, ancestors) {
|
|
2549
|
+
if (value === null || typeof value === "boolean") return value;
|
|
2550
|
+
if (typeof value === "string") return storable(value) ? value : void 0;
|
|
2551
|
+
if (typeof value === "number") return Number.isFinite(value) ? value : void 0;
|
|
2552
|
+
if (typeof value !== "object" || ancestors.has(value)) return void 0;
|
|
2553
|
+
ancestors.add(value);
|
|
2554
|
+
try {
|
|
2555
|
+
if (Array.isArray(value)) {
|
|
2556
|
+
const copy = [];
|
|
2557
|
+
for (let i = 0; i < value.length; i++) {
|
|
2558
|
+
if (!(i in value)) return void 0;
|
|
2559
|
+
const element = pureJson(value[i], ancestors);
|
|
2560
|
+
if (element === void 0) return void 0;
|
|
2561
|
+
copy.push(element);
|
|
2562
|
+
}
|
|
2563
|
+
return copy;
|
|
2564
|
+
}
|
|
2565
|
+
if (!isPlainObject(value) || Object.getOwnPropertySymbols(value).length) return;
|
|
2566
|
+
const copy = {};
|
|
2567
|
+
for (const [key, item] of Object.entries(value)) {
|
|
2568
|
+
if (!storable(key)) return void 0;
|
|
2569
|
+
const element = pureJson(item, ancestors);
|
|
2570
|
+
if (element === void 0) return void 0;
|
|
2571
|
+
Object.defineProperty(copy, key, {
|
|
2572
|
+
value: element,
|
|
2573
|
+
enumerable: true,
|
|
2574
|
+
writable: true,
|
|
2575
|
+
configurable: true
|
|
2576
|
+
});
|
|
2577
|
+
}
|
|
2578
|
+
return copy;
|
|
2579
|
+
} finally {
|
|
2580
|
+
ancestors.delete(value);
|
|
2581
|
+
}
|
|
2582
|
+
}
|
|
2583
|
+
/** Скаляр у форму `p_item`; `undefined` — значення не цього типу. */
|
|
2584
|
+
function scalar(attribute, value) {
|
|
2585
|
+
if (value === null) return null;
|
|
2586
|
+
if (typeof value === "string" && !storable(value)) return void 0;
|
|
2587
|
+
switch (attribute.type) {
|
|
2588
|
+
case "Integer":
|
|
2589
|
+
case "SmallInt": return typeof value === "number" && isWithinType({ type: attribute.type }, value) ? value : void 0;
|
|
2590
|
+
case "BigInt": {
|
|
2591
|
+
const text = typeof value === "bigint" ? String(value) : typeof value === "string" ? value : void 0;
|
|
2592
|
+
return text !== void 0 && INTEGER_TEXT.test(text) && isWithinType({ type: "BigInt" }, text) ? text : void 0;
|
|
2593
|
+
}
|
|
2594
|
+
case "Numeric": return typeof value === "string" && isWithinType({
|
|
2595
|
+
type: "Numeric",
|
|
2596
|
+
precision: attribute.precision,
|
|
2597
|
+
scale: attribute.scale
|
|
2598
|
+
}, value) ? value : void 0;
|
|
2599
|
+
case "Boolean": return typeof value === "boolean" ? value : void 0;
|
|
2600
|
+
case "String": return typeof value === "string" && isWithinType({
|
|
2601
|
+
type: "String",
|
|
2602
|
+
length: attribute.maxLength
|
|
2603
|
+
}, value) ? value : void 0;
|
|
2604
|
+
case "Text": return typeof value === "string" ? value : void 0;
|
|
2605
|
+
case "UUID": return typeof value === "string" && UUID_TEXT.test(value) ? value : void 0;
|
|
2606
|
+
case "Ref":
|
|
2607
|
+
if (attribute.enumValues !== void 0) return attribute.enumValues.find((v) => v.name === value)?.label;
|
|
2608
|
+
return typeof value === "string" && UUID_TEXT.test(value) ? value : void 0;
|
|
2609
|
+
case "Date": return typeof value === "string" && isDate(value) ? value : void 0;
|
|
2610
|
+
case "DateTime": return typeof value === "string" && isDateTime(value) ? value : void 0;
|
|
2611
|
+
case "Bytes": return typeof value === "string" && BYTES_TEXT.test(value) ? value : void 0;
|
|
2612
|
+
case "Json": return pureJson(value, /* @__PURE__ */ new Set());
|
|
2613
|
+
case "Raw": return;
|
|
2614
|
+
}
|
|
2615
|
+
}
|
|
2616
|
+
/**
|
|
2617
|
+
* A polymorphic pair `{ type: "<Kind>.<Name>", id }` as the label and the id
|
|
2618
|
+
* of its two columns.
|
|
2619
|
+
*/
|
|
2620
|
+
function encodePair(attribute, value, path) {
|
|
2621
|
+
if (value === null) return { value: {
|
|
2622
|
+
label: null,
|
|
2623
|
+
id: null
|
|
2624
|
+
} };
|
|
2625
|
+
const targets = attribute.pair?.targets ?? [];
|
|
2626
|
+
try {
|
|
2627
|
+
if (!isPlainObject(value) || Object.keys(value).length !== 2) return invalid(path);
|
|
2628
|
+
const { id, type } = value;
|
|
2629
|
+
if (typeof id !== "string" || !UUID_TEXT.test(id)) return invalid(path);
|
|
2630
|
+
const target = targets.find((t) => `${t.object.kind}.${t.object.name}` === type);
|
|
2631
|
+
return target === void 0 ? invalid(path) : { value: {
|
|
2632
|
+
label: target.label,
|
|
2633
|
+
id
|
|
2634
|
+
} };
|
|
2635
|
+
} catch {
|
|
2636
|
+
return invalid(path);
|
|
2637
|
+
}
|
|
2638
|
+
}
|
|
2639
|
+
/**
|
|
2640
|
+
* A logical value as JSON for `p_item` (`jsonb_populate_record`); a pair
|
|
2641
|
+
* yields both of its columns.
|
|
2642
|
+
*/
|
|
2643
|
+
function encodeItemValue(attribute, value, path) {
|
|
2644
|
+
try {
|
|
2645
|
+
if (value === void 0) return invalid(path);
|
|
2646
|
+
if (attribute.pair !== void 0) {
|
|
2647
|
+
const pair = encodePair(attribute, value, path);
|
|
2648
|
+
if ("error" in pair) return pair;
|
|
2649
|
+
return { value: {
|
|
2650
|
+
[attribute.pair.typeColumn]: pair.value.label,
|
|
2651
|
+
[attribute.column]: pair.value.id
|
|
2652
|
+
} };
|
|
2653
|
+
}
|
|
2654
|
+
if (attribute.array === true && value !== null) {
|
|
2655
|
+
if (!Array.isArray(value)) return invalid(path);
|
|
2656
|
+
const items = [];
|
|
2657
|
+
for (let i = 0; i < value.length; i++) {
|
|
2658
|
+
const item = i in value ? scalar(attribute, value[i]) : void 0;
|
|
2659
|
+
if (item === void 0) return invalid(`${path}.${i}`);
|
|
2660
|
+
items.push(item);
|
|
2661
|
+
}
|
|
2662
|
+
return { value: items };
|
|
2663
|
+
}
|
|
2664
|
+
const item = scalar(attribute, value);
|
|
2665
|
+
return item === void 0 ? invalid(path) : { value: item };
|
|
2666
|
+
} catch {
|
|
2667
|
+
return invalid(path);
|
|
2668
|
+
}
|
|
2669
|
+
}
|
|
2670
|
+
/**
|
|
2671
|
+
* Один обхід реквізитів значень (Р-A6-13): шапка операції, рядок ТЧ,
|
|
2672
|
+
* `creatorMember` і `member` інструмента обслуговування кодуються тут, тож
|
|
2673
|
+
* шляхи не розходяться. `values` — простий об'єкт, де кожен ключ — реквізит
|
|
2674
|
+
* каталогу, дозволений `allowed` і не примушений. Результат — фізичні
|
|
2675
|
+
* колонки → значення для `jsonb_populate_record`. Перша помилка (Р-A3-8):
|
|
2676
|
+
* реквізити — за порядком каталогу, невідомі ключі — після них, за порядком
|
|
2677
|
+
* входу.
|
|
2678
|
+
*/
|
|
2679
|
+
function encodeAttributes(attributes, values, options) {
|
|
2680
|
+
const { allowed, forced = [], path, prefix, rowKey } = options;
|
|
2681
|
+
let keys;
|
|
2682
|
+
try {
|
|
2683
|
+
if (!isPlainObject(values)) return invalid(path);
|
|
2684
|
+
keys = new Set(Object.keys(values));
|
|
2685
|
+
} catch {
|
|
2686
|
+
return invalid(path);
|
|
2687
|
+
}
|
|
2688
|
+
if (rowKey !== void 0) keys.delete(rowKey);
|
|
2689
|
+
const source = values;
|
|
2690
|
+
const columns = {};
|
|
2691
|
+
for (const attribute of attributes) {
|
|
2692
|
+
if (!keys.delete(attribute.name)) continue;
|
|
2693
|
+
const at = `${prefix}${attribute.name}`;
|
|
2694
|
+
if (!allowed(attribute) || forced.includes(attribute.name)) return invalid(at);
|
|
2695
|
+
let value;
|
|
2696
|
+
try {
|
|
2697
|
+
value = source[attribute.name];
|
|
2698
|
+
} catch {
|
|
2699
|
+
return invalid(at);
|
|
2700
|
+
}
|
|
2701
|
+
const encoded = encodeItemValue(attribute, value, at);
|
|
2702
|
+
if ("error" in encoded) return encoded;
|
|
2703
|
+
if (attribute.pair !== void 0) Object.assign(columns, encoded.value);
|
|
2704
|
+
else columns[attribute.column] = encoded.value;
|
|
2705
|
+
}
|
|
2706
|
+
const [unknown] = keys;
|
|
2707
|
+
return unknown === void 0 ? { columns } : invalid(`${prefix}${unknown}`);
|
|
2708
|
+
}
|
|
2709
|
+
// src/model/physical/pg-keywords.ts
|
|
2048
2710
|
/**
|
|
2049
2711
|
* Ключові слова Postgres, які `quote_ident` бере в лапки: усі, що не
|
|
2050
2712
|
* UNRESERVED_KEYWORD у `kwlist.h` (зарезервовані, col_name і
|
|
@@ -2078,8 +2740,7 @@ const PG_QUOTED_KEYWORDS = /* @__PURE__ */ new Set([
|
|
|
2078
2740
|
function isSqlReservedWord(name) {
|
|
2079
2741
|
return PG_QUOTED_KEYWORDS.has(name.toLowerCase());
|
|
2080
2742
|
}
|
|
2081
|
-
|
|
2082
|
-
//#region src/model/physical/pg-names.ts
|
|
2743
|
+
// src/model/physical/pg-names.ts
|
|
2083
2744
|
/** NAMEDATALEN у Postgres мінус завершальний нуль. */
|
|
2084
2745
|
const MAX_IDENT_BYTES = 63;
|
|
2085
2746
|
const encoder = new TextEncoder();
|
|
@@ -2129,8 +2790,7 @@ function chooseConstraintName(name1, name2, label, taken) {
|
|
|
2129
2790
|
for (let pass = 1; taken.has(candidate); pass++) candidate = makeObjectName(name1, name2, `${label}${pass}`);
|
|
2130
2791
|
return candidate;
|
|
2131
2792
|
}
|
|
2132
|
-
|
|
2133
|
-
//#region src/model/physical/pg-types.ts
|
|
2793
|
+
// src/model/physical/pg-types.ts
|
|
2134
2794
|
/**
|
|
2135
2795
|
* Логічний тип → рядок у формі `format_type()`: саме в такому вигляді
|
|
2136
2796
|
* Postgres віддає тип із каталогу, тож знімок метаданих і знімок extract
|
|
@@ -2290,10 +2950,10 @@ function enumPair(base, enumTypes) {
|
|
|
2290
2950
|
name
|
|
2291
2951
|
};
|
|
2292
2952
|
}
|
|
2293
|
-
|
|
2294
|
-
//#region src/model/physical/period.ts
|
|
2953
|
+
// src/model/physical/period.ts
|
|
2295
2954
|
/**
|
|
2296
|
-
* Єдине джерело усічення моменту до дати в поясі проєкту (спека
|
|
2955
|
+
* Єдине джерело усічення моменту до дати в поясі проєкту (спека «Платформа
|
|
2956
|
+
* в Postgres» §6):
|
|
2297
2957
|
* `timestamptz::date` без `AT TIME ZONE` усікає за поясом сесії, тож межа
|
|
2298
2958
|
* місяця «пливла» б залежно від клієнта. Вираз незмінний (`IMMUTABLE`) лише
|
|
2299
2959
|
* з явним поясом-літералом, тому його однаково використовують індекси, ключі
|
|
@@ -2303,8 +2963,7 @@ function truncatedPeriodExpression(column, unit, timezone) {
|
|
|
2303
2963
|
const zone = `'${timezone.replaceAll("'", "''")}'`;
|
|
2304
2964
|
return `date_trunc('${unit}', (${quoteIdent(column)} AT TIME ZONE ${zone}))::date`;
|
|
2305
2965
|
}
|
|
2306
|
-
|
|
2307
|
-
//#region src/model/physical/assign.ts
|
|
2966
|
+
// src/model/physical/assign.ts
|
|
2308
2967
|
function baseName(logicalName, role) {
|
|
2309
2968
|
const snake = toSnakeCase(logicalName);
|
|
2310
2969
|
switch (role.role) {
|
|
@@ -2328,8 +2987,7 @@ function assignPhysicalName(logicalName, role, taken) {
|
|
|
2328
2987
|
while (reserved(name) || taken.has(name)) name += "_";
|
|
2329
2988
|
return name;
|
|
2330
2989
|
}
|
|
2331
|
-
|
|
2332
|
-
//#region src/model/physical/catalog.ts
|
|
2990
|
+
// src/model/physical/catalog.ts
|
|
2333
2991
|
/**
|
|
2334
2992
|
* Класи SQL-одиниць (спека П2 §8.3); належать T0, бо їх читає й порт
|
|
2335
2993
|
* каталогу. Масив, а не лише тип: строгі схеми файлів (запис промоції)
|
|
@@ -2441,8 +3099,7 @@ function diffCatalogModels(a, b, { columnOrder }) {
|
|
|
2441
3099
|
diffKeyed("units", new Map(a.units.map((u) => [u.identity, u])), new Map(b.units.map((u) => [u.identity, u])), out, (p, x, y) => diffChanged(p, x, y, out));
|
|
2442
3100
|
return out.sort((x, y) => compare(x.path, y.path));
|
|
2443
3101
|
}
|
|
2444
|
-
|
|
2445
|
-
//#region src/model/kinds/standard.ts
|
|
3102
|
+
// src/model/kinds/standard.ts
|
|
2446
3103
|
/**
|
|
2447
3104
|
* Логічне ім'я стандартного реквізиту в стилі проєкту (спека §3, М16). Ключ
|
|
2448
3105
|
* `ref` однаковий в обох стилях, решта в snake_case — пряма зміна регістру.
|
|
@@ -2544,7 +3201,8 @@ function serviceDateColumns() {
|
|
|
2544
3201
|
/**
|
|
2545
3202
|
* Авторство (спека П2 §5): посилання на «Користувачі», а не на учасника —
|
|
2546
3203
|
* автор лишається автором і після виходу з тенанта. Nullable, бо рядок може
|
|
2547
|
-
* записати й не користувач (міграція, провізія);
|
|
3204
|
+
* записати й не користувач (міграція, провізія); під контекстом команди їх
|
|
3205
|
+
* примушує тригер авторства.
|
|
2548
3206
|
*/
|
|
2549
3207
|
function authorColumns() {
|
|
2550
3208
|
return [{
|
|
@@ -2684,22 +3342,26 @@ function lineNumberColumn() {
|
|
|
2684
3342
|
function tabularRowColumns(keyDefault) {
|
|
2685
3343
|
return [
|
|
2686
3344
|
keyColumn(keyDefault),
|
|
2687
|
-
|
|
2688
|
-
logicalName: "parent",
|
|
2689
|
-
physicalName: "parent_id",
|
|
2690
|
-
type: { type: "UUID" },
|
|
2691
|
-
notNull: true,
|
|
2692
|
-
ref: "owningObject",
|
|
2693
|
-
onDelete: "cascade",
|
|
2694
|
-
indexed: true,
|
|
2695
|
-
title: {
|
|
2696
|
-
uk: "Власник рядка",
|
|
2697
|
-
en: "Owning object"
|
|
2698
|
-
}
|
|
2699
|
-
},
|
|
3345
|
+
tabularParentColumn(),
|
|
2700
3346
|
lineNumberColumn()
|
|
2701
3347
|
];
|
|
2702
3348
|
}
|
|
3349
|
+
/** Власник рядка ТЧ: генератори знаходять його колонку за цим визначенням. */
|
|
3350
|
+
function tabularParentColumn() {
|
|
3351
|
+
return {
|
|
3352
|
+
logicalName: "parent",
|
|
3353
|
+
physicalName: "parent_id",
|
|
3354
|
+
type: { type: "UUID" },
|
|
3355
|
+
notNull: true,
|
|
3356
|
+
ref: "owningObject",
|
|
3357
|
+
onDelete: "cascade",
|
|
3358
|
+
indexed: true,
|
|
3359
|
+
title: {
|
|
3360
|
+
uk: "Власник рядка",
|
|
3361
|
+
en: "Owning object"
|
|
3362
|
+
}
|
|
3363
|
+
};
|
|
3364
|
+
}
|
|
2703
3365
|
/**
|
|
2704
3366
|
* Колонки шапки, які пишуть кастомні дії (`effects.header`): посилання на
|
|
2705
3367
|
* власні колонки об'єкта, тож перейменування реквізиту бачить індекс.
|
|
@@ -2854,12 +3516,14 @@ function refListReferences(refs, pointer, role, pair) {
|
|
|
2854
3516
|
function standardRefReferences(columns, ref, refs, pointer, role) {
|
|
2855
3517
|
return refListReferences(refs, pointer, role, columns.find((c) => c.ref === ref)?.polymorphic !== void 0);
|
|
2856
3518
|
}
|
|
2857
|
-
/**
|
|
3519
|
+
/**
|
|
3520
|
+
* Реквізити об'єкта й реквізити його табличних частин з файлу: стандартна ТЧ
|
|
3521
|
+
* посилань на об'єкти метаданих не має.
|
|
3522
|
+
*/
|
|
2858
3523
|
function objectFieldReferences(obj) {
|
|
2859
3524
|
return [...fieldListReferences(obj.attributes, "/attributes"), ...obj.tabularSections.flatMap((section, index) => fieldListReferences(section.attributes, `/tabularSections/${index}/attributes`))];
|
|
2860
3525
|
}
|
|
2861
|
-
|
|
2862
|
-
//#region src/model/kinds/accumulation-register.ts
|
|
3526
|
+
// src/model/kinds/accumulation-register.ts
|
|
2863
3527
|
function standardColumns$4(obj) {
|
|
2864
3528
|
const register = obj;
|
|
2865
3529
|
const columns = [periodColumn(), ...recorderColumns()];
|
|
@@ -2919,8 +3583,7 @@ const accumulationRegisterKind = {
|
|
|
2919
3583
|
];
|
|
2920
3584
|
}
|
|
2921
3585
|
};
|
|
2922
|
-
|
|
2923
|
-
//#region src/model/kinds/catalog.ts
|
|
3586
|
+
// src/model/kinds/catalog.ts
|
|
2924
3587
|
function standardColumns$3(obj) {
|
|
2925
3588
|
const catalog = obj;
|
|
2926
3589
|
const columns = [keyColumn(false)];
|
|
@@ -2949,7 +3612,7 @@ function standardColumns$3(obj) {
|
|
|
2949
3612
|
}
|
|
2950
3613
|
});
|
|
2951
3614
|
columns.push(deletionMarkColumn());
|
|
2952
|
-
if (catalog.role !== void 0) columns.push(...CATALOG_ROLES[catalog.role].columns?.() ?? []);
|
|
3615
|
+
if (catalog.role !== void 0) columns.push(...CATALOG_ROLES[catalog.role].columns?.(catalog) ?? []);
|
|
2953
3616
|
if (catalog.hierarchyType !== "None") columns.push({
|
|
2954
3617
|
logicalName: "parent",
|
|
2955
3618
|
physicalName: "parent_id",
|
|
@@ -2989,7 +3652,15 @@ function standardColumns$3(obj) {
|
|
|
2989
3652
|
}
|
|
2990
3653
|
});
|
|
2991
3654
|
}
|
|
2992
|
-
columns.push(
|
|
3655
|
+
columns.push(predefinedNameColumn(), versionColumn(), ...serviceDateColumns(), ...catalog.trackAuthor ? authorColumns() : []);
|
|
3656
|
+
return columns;
|
|
3657
|
+
}
|
|
3658
|
+
/**
|
|
3659
|
+
* Ім'я предвизначеного елемента: його пише платформа з `predefinedItems`, а
|
|
3660
|
+
* не команда, тож грант ролі команд його оминає (спека П4 §6.2).
|
|
3661
|
+
*/
|
|
3662
|
+
function predefinedNameColumn() {
|
|
3663
|
+
return {
|
|
2993
3664
|
logicalName: "predefinedName",
|
|
2994
3665
|
physicalName: "predefined_name",
|
|
2995
3666
|
type: { type: "Text" },
|
|
@@ -2999,15 +3670,14 @@ function standardColumns$3(obj) {
|
|
|
2999
3670
|
uk: "Ім'я наперед визначеного елемента",
|
|
3000
3671
|
en: "Predefined name"
|
|
3001
3672
|
}
|
|
3002
|
-
}
|
|
3003
|
-
return columns;
|
|
3673
|
+
};
|
|
3004
3674
|
}
|
|
3005
3675
|
/**
|
|
3006
3676
|
* Платформні реквізити «Користувачів» (спека користувачів §4): провізія
|
|
3007
3677
|
* вставляє рядок лише з ключем і найменуванням, тож обидва мають DEFAULT.
|
|
3008
3678
|
* Недійсність не видаляє рядок — на нього можуть посилатися дані застосунку.
|
|
3009
3679
|
*/
|
|
3010
|
-
function
|
|
3680
|
+
function userPlatformColumns() {
|
|
3011
3681
|
return [{
|
|
3012
3682
|
logicalName: "userKind",
|
|
3013
3683
|
physicalName: "user_kind",
|
|
@@ -3031,11 +3701,207 @@ function userColumns() {
|
|
|
3031
3701
|
}
|
|
3032
3702
|
}];
|
|
3033
3703
|
}
|
|
3704
|
+
/**
|
|
3705
|
+
* Платформні колонки «Користувачів» за логічним ім'ям: споживачі беруть
|
|
3706
|
+
* колонку за ім'ям, а не за позицією в масиві, щоб зміна порядку реквізитів
|
|
3707
|
+
* не підміняла їх мовчки.
|
|
3708
|
+
*/
|
|
3709
|
+
const USER_PLATFORM_COLUMNS = Object.fromEntries(userPlatformColumns().map((def) => [def.logicalName, def]));
|
|
3710
|
+
/**
|
|
3711
|
+
* «Ролі» рівня (спека прав §4.6): базовий архетип — UUID ролі
|
|
3712
|
+
* метаданих без FK (ролі метаданих таблиць не мають), назва — стандартне
|
|
3713
|
+
* найменування, порядок — для показу.
|
|
3714
|
+
*/
|
|
3715
|
+
function rightsRolesColumns() {
|
|
3716
|
+
return [{
|
|
3717
|
+
logicalName: "archetype",
|
|
3718
|
+
physicalName: "archetype",
|
|
3719
|
+
type: { type: "UUID" },
|
|
3720
|
+
notNull: true,
|
|
3721
|
+
title: {
|
|
3722
|
+
uk: "Архетип",
|
|
3723
|
+
en: "Archetype"
|
|
3724
|
+
}
|
|
3725
|
+
}, {
|
|
3726
|
+
logicalName: "order",
|
|
3727
|
+
physicalName: "order",
|
|
3728
|
+
type: { type: "Integer" },
|
|
3729
|
+
notNull: false,
|
|
3730
|
+
title: {
|
|
3731
|
+
uk: "Порядок",
|
|
3732
|
+
en: "Order"
|
|
3733
|
+
}
|
|
3734
|
+
}];
|
|
3735
|
+
}
|
|
3736
|
+
/**
|
|
3737
|
+
* Дельта кастомної ролі відносно архетипу: мітка виду об'єкта, ключ дії
|
|
3738
|
+
* (слово словника чи UUID кастомної дії, Рх18), обсяг і ефект. Значення —
|
|
3739
|
+
* дані цілі, тож невідоме значення функції прав ігнорують (fail-closed), а
|
|
3740
|
+
* CHECK тримає лише форму, яку видно без метаданих.
|
|
3741
|
+
*/
|
|
3742
|
+
function deltaColumns() {
|
|
3743
|
+
return [
|
|
3744
|
+
{
|
|
3745
|
+
logicalName: "object",
|
|
3746
|
+
physicalName: "object",
|
|
3747
|
+
type: { type: "Text" },
|
|
3748
|
+
notNull: true,
|
|
3749
|
+
title: {
|
|
3750
|
+
uk: "Об'єкт",
|
|
3751
|
+
en: "Object"
|
|
3752
|
+
}
|
|
3753
|
+
},
|
|
3754
|
+
{
|
|
3755
|
+
logicalName: "action",
|
|
3756
|
+
physicalName: "action",
|
|
3757
|
+
type: { type: "Text" },
|
|
3758
|
+
notNull: true,
|
|
3759
|
+
title: {
|
|
3760
|
+
uk: "Дія",
|
|
3761
|
+
en: "Action"
|
|
3762
|
+
}
|
|
3763
|
+
},
|
|
3764
|
+
{
|
|
3765
|
+
logicalName: "extent",
|
|
3766
|
+
physicalName: "extent",
|
|
3767
|
+
type: { type: "Text" },
|
|
3768
|
+
notNull: true,
|
|
3769
|
+
check: "extent IN ('any', 'own', 'dimension')",
|
|
3770
|
+
title: {
|
|
3771
|
+
uk: "Обсяг",
|
|
3772
|
+
en: "Extent"
|
|
3773
|
+
}
|
|
3774
|
+
},
|
|
3775
|
+
{
|
|
3776
|
+
logicalName: "dimension",
|
|
3777
|
+
physicalName: "dimension",
|
|
3778
|
+
type: { type: "UUID" },
|
|
3779
|
+
notNull: false,
|
|
3780
|
+
check: "(extent = 'dimension') = (dimension IS NOT NULL)",
|
|
3781
|
+
title: {
|
|
3782
|
+
uk: "Вимір доступу",
|
|
3783
|
+
en: "Access dimension"
|
|
3784
|
+
}
|
|
3785
|
+
},
|
|
3786
|
+
{
|
|
3787
|
+
logicalName: "effect",
|
|
3788
|
+
physicalName: "effect",
|
|
3789
|
+
type: { type: "Text" },
|
|
3790
|
+
notNull: true,
|
|
3791
|
+
check: "effect IN ('allow', 'deny')",
|
|
3792
|
+
title: {
|
|
3793
|
+
uk: "Ефект",
|
|
3794
|
+
en: "Effect"
|
|
3795
|
+
}
|
|
3796
|
+
}
|
|
3797
|
+
];
|
|
3798
|
+
}
|
|
3799
|
+
/**
|
|
3800
|
+
* Логічне ім'я стандартної ТЧ дельти «Ролей» (спека прав §4.6): за ним компілятор
|
|
3801
|
+
* знаходить її таблицю для контракту довідників прав.
|
|
3802
|
+
*/
|
|
3803
|
+
const RIGHTS_DELTA_SECTION = "delta";
|
|
3804
|
+
const DELTA_SECTION = {
|
|
3805
|
+
logicalName: RIGHTS_DELTA_SECTION,
|
|
3806
|
+
physicalSuffix: "delta",
|
|
3807
|
+
columns: deltaColumns,
|
|
3808
|
+
title: {
|
|
3809
|
+
uk: "Дельта",
|
|
3810
|
+
en: "Delta"
|
|
3811
|
+
}
|
|
3812
|
+
};
|
|
3813
|
+
/**
|
|
3814
|
+
* «Призначення ролей» рівня (спека прав §4.6): суб'єкт — учасник рівня скоупу (у
|
|
3815
|
+
* глобальному довіднику — користувач), роль — архетип або кастомна роль того
|
|
3816
|
+
* самого рівня, рівно одне з двох. Контейнер без FK: цілі — різні
|
|
3817
|
+
* довідники-контейнери, а належність тенанту перевіряють функції прав.
|
|
3818
|
+
*/
|
|
3819
|
+
function roleAssignmentsColumns(catalog) {
|
|
3820
|
+
return [
|
|
3821
|
+
{
|
|
3822
|
+
logicalName: "subject",
|
|
3823
|
+
physicalName: "subject",
|
|
3824
|
+
type: { type: "UUID" },
|
|
3825
|
+
notNull: true,
|
|
3826
|
+
ref: "member",
|
|
3827
|
+
indexed: true,
|
|
3828
|
+
title: catalog.scope !== void 0 && catalog.scope !== "none" ? {
|
|
3829
|
+
uk: "Учасник",
|
|
3830
|
+
en: "Member"
|
|
3831
|
+
} : {
|
|
3832
|
+
uk: "Користувач",
|
|
3833
|
+
en: "User"
|
|
3834
|
+
}
|
|
3835
|
+
},
|
|
3836
|
+
{
|
|
3837
|
+
logicalName: "archetype",
|
|
3838
|
+
physicalName: "archetype",
|
|
3839
|
+
type: { type: "UUID" },
|
|
3840
|
+
notNull: false,
|
|
3841
|
+
title: {
|
|
3842
|
+
uk: "Архетип",
|
|
3843
|
+
en: "Archetype"
|
|
3844
|
+
}
|
|
3845
|
+
},
|
|
3846
|
+
{
|
|
3847
|
+
logicalName: "customRole",
|
|
3848
|
+
physicalName: "custom_role",
|
|
3849
|
+
type: { type: "UUID" },
|
|
3850
|
+
notNull: false,
|
|
3851
|
+
ref: "rightsRoles",
|
|
3852
|
+
check: "num_nonnulls(archetype, custom_role) = 1",
|
|
3853
|
+
title: {
|
|
3854
|
+
uk: "Кастомна роль",
|
|
3855
|
+
en: "Custom role"
|
|
3856
|
+
}
|
|
3857
|
+
},
|
|
3858
|
+
{
|
|
3859
|
+
logicalName: "container",
|
|
3860
|
+
physicalName: "container",
|
|
3861
|
+
type: { type: "UUID" },
|
|
3862
|
+
notNull: false,
|
|
3863
|
+
indexed: true,
|
|
3864
|
+
title: {
|
|
3865
|
+
uk: "Контейнер",
|
|
3866
|
+
en: "Container"
|
|
3867
|
+
}
|
|
3868
|
+
}
|
|
3869
|
+
];
|
|
3870
|
+
}
|
|
3871
|
+
/**
|
|
3872
|
+
* Визначення стандартних колонок довідників прав за логічним ім'ям: функції
|
|
3873
|
+
* прав шукають за ними колонки в стилі проєкту, а не літералом
|
|
3874
|
+
* імені. Заголовок «Суб'єкта» залежить від скоупу, але пошук читає лише
|
|
3875
|
+
* логічне ім'я.
|
|
3876
|
+
*/
|
|
3877
|
+
const RIGHTS_COLUMNS = Object.fromEntries([
|
|
3878
|
+
...rightsRolesColumns(),
|
|
3879
|
+
...deltaColumns(),
|
|
3880
|
+
...roleAssignmentsColumns({ scope: "none" })
|
|
3881
|
+
].map((def) => [def.logicalName, def]));
|
|
3034
3882
|
/** Ролі довідника — одне місце, звідки компілятор бере їхні факти. */
|
|
3035
|
-
const CATALOG_ROLES = {
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3883
|
+
const CATALOG_ROLES = {
|
|
3884
|
+
users: {
|
|
3885
|
+
globalRoot: true,
|
|
3886
|
+
columns: userPlatformColumns
|
|
3887
|
+
},
|
|
3888
|
+
rightsRoles: {
|
|
3889
|
+
columns: rightsRolesColumns,
|
|
3890
|
+
tabularSection: DELTA_SECTION,
|
|
3891
|
+
actions: "rights",
|
|
3892
|
+
rightsSystem: "rightsRoles"
|
|
3893
|
+
},
|
|
3894
|
+
roleAssignments: {
|
|
3895
|
+
columns: roleAssignmentsColumns,
|
|
3896
|
+
actions: "rights",
|
|
3897
|
+
rightsSystem: "roleAssignments"
|
|
3898
|
+
}
|
|
3899
|
+
};
|
|
3900
|
+
/** Опис ролі довідника; без ролі — порожній. */
|
|
3901
|
+
function roleOf(obj) {
|
|
3902
|
+
const { role } = obj;
|
|
3903
|
+
return role === void 0 ? {} : CATALOG_ROLES[role];
|
|
3904
|
+
}
|
|
3039
3905
|
function numbering$1(obj) {
|
|
3040
3906
|
const catalog = obj;
|
|
3041
3907
|
if (catalog.codeLength === 0) return void 0;
|
|
@@ -3056,7 +3922,12 @@ const catalogKind = {
|
|
|
3056
3922
|
referenceable: true,
|
|
3057
3923
|
compositeIndexes: true,
|
|
3058
3924
|
writePattern: "optimistic",
|
|
3059
|
-
actions
|
|
3925
|
+
actions(obj) {
|
|
3926
|
+
const actions = roleOf(obj).actions;
|
|
3927
|
+
if (actions === "read") return [readAction];
|
|
3928
|
+
if (actions === "rights") return [readAction, administerRightsAction];
|
|
3929
|
+
return recordActions(catalogKind.tabularSectionColumns !== void 0);
|
|
3930
|
+
},
|
|
3060
3931
|
rightsExtents: [
|
|
3061
3932
|
"any",
|
|
3062
3933
|
"own",
|
|
@@ -3065,6 +3936,7 @@ const catalogKind = {
|
|
|
3065
3936
|
rightsContainer: true,
|
|
3066
3937
|
rightsBinding: true,
|
|
3067
3938
|
accessDimensionTarget: true,
|
|
3939
|
+
commandWrites: true,
|
|
3068
3940
|
sqlModule: "closed",
|
|
3069
3941
|
materializes: "table",
|
|
3070
3942
|
rowLevelSecurity: "enabled",
|
|
@@ -3078,10 +3950,12 @@ const catalogKind = {
|
|
|
3078
3950
|
namedElementFields: ["predefinedItems"],
|
|
3079
3951
|
ownerKinds: ["Catalog"],
|
|
3080
3952
|
standardColumns: standardColumns$3,
|
|
3081
|
-
globalRoot(obj)
|
|
3082
|
-
|
|
3083
|
-
|
|
3953
|
+
globalRoot: (obj) => roleOf(obj).globalRoot === true,
|
|
3954
|
+
standardTabularSections(obj) {
|
|
3955
|
+
const section = roleOf(obj).tabularSection;
|
|
3956
|
+
return section === void 0 ? [] : [section];
|
|
3084
3957
|
},
|
|
3958
|
+
rightsSystem: (obj) => roleOf(obj).rightsSystem,
|
|
3085
3959
|
numbering: numbering$1,
|
|
3086
3960
|
tabularSectionColumns: () => tabularRowColumns(false),
|
|
3087
3961
|
elementReferences: (obj) => [
|
|
@@ -3096,8 +3970,7 @@ const catalogKind = {
|
|
|
3096
3970
|
return [...objectFieldReferences(catalog), ...standardRefReferences(standardColumns$3(catalog), "owners", catalog.owners, "/owners", "catalog.owner")];
|
|
3097
3971
|
}
|
|
3098
3972
|
};
|
|
3099
|
-
|
|
3100
|
-
//#region src/model/kinds/constant.ts
|
|
3973
|
+
// src/model/kinds/constant.ts
|
|
3101
3974
|
/** Лише поля типу: решта полів константи до колонки `value` не належить. */
|
|
3102
3975
|
function valueTypeOf(constant) {
|
|
3103
3976
|
const { type, length, precision, scale, ref, allowedTypes, array } = constant;
|
|
@@ -3151,8 +4024,7 @@ const constantKind = {
|
|
|
3151
4024
|
allowedType: "constant.allowedType"
|
|
3152
4025
|
}, true)
|
|
3153
4026
|
};
|
|
3154
|
-
|
|
3155
|
-
//#region src/model/kinds/custom-table.ts
|
|
4027
|
+
// src/model/kinds/custom-table.ts
|
|
3156
4028
|
function references(obj) {
|
|
3157
4029
|
const table = obj;
|
|
3158
4030
|
const found = [];
|
|
@@ -3207,7 +4079,7 @@ function elementReferences(obj) {
|
|
|
3207
4079
|
const base = `/foreignKeys/${i}`;
|
|
3208
4080
|
own(foreignKey.columns, `${base}/columns`);
|
|
3209
4081
|
const { references } = foreignKey;
|
|
3210
|
-
if ("
|
|
4082
|
+
if ("columns" in references) references.columns.forEach((name, index) => {
|
|
3211
4083
|
found.push({
|
|
3212
4084
|
pointer: `${base}/references/columns/${index}`,
|
|
3213
4085
|
name,
|
|
@@ -3262,6 +4134,7 @@ const customTableKind = {
|
|
|
3262
4134
|
rightsExtents: [],
|
|
3263
4135
|
sqlModule: "debt",
|
|
3264
4136
|
materializes: "table",
|
|
4137
|
+
rowLevelSecurity: "declared",
|
|
3265
4138
|
scope: "required",
|
|
3266
4139
|
declared: true,
|
|
3267
4140
|
kindLabel: true,
|
|
@@ -3271,8 +4144,7 @@ const customTableKind = {
|
|
|
3271
4144
|
references,
|
|
3272
4145
|
elementReferences
|
|
3273
4146
|
};
|
|
3274
|
-
|
|
3275
|
-
//#region src/model/kinds/document.ts
|
|
4147
|
+
// src/model/kinds/document.ts
|
|
3276
4148
|
const periodUnits = {
|
|
3277
4149
|
Year: "year",
|
|
3278
4150
|
Quarter: "quarter",
|
|
@@ -3406,8 +4278,7 @@ const documentKind = {
|
|
|
3406
4278
|
];
|
|
3407
4279
|
}
|
|
3408
4280
|
};
|
|
3409
|
-
|
|
3410
|
-
//#region src/model/kinds/enumeration.ts
|
|
4281
|
+
// src/model/kinds/enumeration.ts
|
|
3411
4282
|
/**
|
|
3412
4283
|
* Значення перерахування — метадані, а не рядки: таблиці немає, посилання на
|
|
3413
4284
|
* нього фізично — text із CHECK за мітками (спека §5, М15).
|
|
@@ -3423,6 +4294,7 @@ const enumerationKind = {
|
|
|
3423
4294
|
rightsExtents: [],
|
|
3424
4295
|
sqlModule: "closed",
|
|
3425
4296
|
materializes: "none",
|
|
4297
|
+
rowLevelSecurity: "none",
|
|
3426
4298
|
scope: "noneOnly",
|
|
3427
4299
|
declared: false,
|
|
3428
4300
|
columnFields: [],
|
|
@@ -3430,8 +4302,7 @@ const enumerationKind = {
|
|
|
3430
4302
|
standardColumns: () => [],
|
|
3431
4303
|
references: () => []
|
|
3432
4304
|
};
|
|
3433
|
-
|
|
3434
|
-
//#region src/model/kinds/event-subscription.ts
|
|
4305
|
+
// src/model/kinds/event-subscription.ts
|
|
3435
4306
|
function subscriptionOf(obj) {
|
|
3436
4307
|
const data = obj;
|
|
3437
4308
|
return {
|
|
@@ -3476,6 +4347,7 @@ const eventSubscriptionKind = {
|
|
|
3476
4347
|
rightsExtents: [],
|
|
3477
4348
|
sqlModule: "closed",
|
|
3478
4349
|
materializes: "none",
|
|
4350
|
+
rowLevelSecurity: "none",
|
|
3479
4351
|
scope: "absent",
|
|
3480
4352
|
declared: false,
|
|
3481
4353
|
columnFields: [],
|
|
@@ -3490,8 +4362,7 @@ const eventSubscriptionKind = {
|
|
|
3490
4362
|
}] : []),
|
|
3491
4363
|
subscription: subscriptionOf
|
|
3492
4364
|
};
|
|
3493
|
-
|
|
3494
|
-
//#region src/model/kinds/information-register.ts
|
|
4365
|
+
// src/model/kinds/information-register.ts
|
|
3495
4366
|
function standardColumns(obj) {
|
|
3496
4367
|
const register = obj;
|
|
3497
4368
|
return [...register.periodicity !== "NonPeriodic" ? [periodColumn()] : [], ...register.writeMode === "RecorderSubordinate" ? recorderColumns() : []];
|
|
@@ -3541,8 +4412,7 @@ const informationRegisterKind = {
|
|
|
3541
4412
|
];
|
|
3542
4413
|
}
|
|
3543
4414
|
};
|
|
3544
|
-
|
|
3545
|
-
//#region src/model/kinds/pg-enum.ts
|
|
4415
|
+
// src/model/kinds/pg-enum.ts
|
|
3546
4416
|
/**
|
|
3547
4417
|
* Прийнятий енам-тип Postgres. На нього посилається лише колонка
|
|
3548
4418
|
* `CustomTable`, тож загальним посиланням `Ref` він недоступний.
|
|
@@ -3558,6 +4428,7 @@ const pgEnumKind = {
|
|
|
3558
4428
|
rightsExtents: [],
|
|
3559
4429
|
sqlModule: "debt",
|
|
3560
4430
|
materializes: "enumType",
|
|
4431
|
+
rowLevelSecurity: "none",
|
|
3561
4432
|
scope: "absent",
|
|
3562
4433
|
declared: true,
|
|
3563
4434
|
columnFields: [],
|
|
@@ -3565,8 +4436,7 @@ const pgEnumKind = {
|
|
|
3565
4436
|
standardColumns: () => [],
|
|
3566
4437
|
references: () => []
|
|
3567
4438
|
};
|
|
3568
|
-
|
|
3569
|
-
//#region src/model/kinds/rights-set.ts
|
|
4439
|
+
// src/model/kinds/rights-set.ts
|
|
3570
4440
|
/**
|
|
3571
4441
|
* Включені набори — посилання індексу: перейменування набору переписує
|
|
3572
4442
|
* `include`, а видалення включеного набору бачить індекс.
|
|
@@ -3614,7 +4484,7 @@ function grantProjectReferences(grants) {
|
|
|
3614
4484
|
}
|
|
3615
4485
|
/**
|
|
3616
4486
|
* Спільні факти декларацій прав (спека прав §4.1): вид без сховища, як
|
|
3617
|
-
* підписка на подію, але й без фізичного імені
|
|
4487
|
+
* підписка на подію, але й без фізичного імені — у базі їх видно лише
|
|
3618
4488
|
* в згенерованій проєкції, а в даних — за UUID.
|
|
3619
4489
|
*/
|
|
3620
4490
|
const rightsDeclarationFacts = {
|
|
@@ -3624,6 +4494,7 @@ const rightsDeclarationFacts = {
|
|
|
3624
4494
|
rightsExtents: [],
|
|
3625
4495
|
sqlModule: "closed",
|
|
3626
4496
|
materializes: "none",
|
|
4497
|
+
rowLevelSecurity: "none",
|
|
3627
4498
|
scope: "absent",
|
|
3628
4499
|
declared: false,
|
|
3629
4500
|
physicalName: false,
|
|
@@ -3631,8 +4502,7 @@ const rightsDeclarationFacts = {
|
|
|
3631
4502
|
valueElements: false,
|
|
3632
4503
|
standardColumns: () => []
|
|
3633
4504
|
};
|
|
3634
|
-
|
|
3635
|
-
//#region src/model/kinds/registry.ts
|
|
4505
|
+
// src/model/kinds/registry.ts
|
|
3636
4506
|
/**
|
|
3637
4507
|
* Єдине місце знань про вид (спека П2 §8.1): кожне розгалуження за видом
|
|
3638
4508
|
* читає цей запис, а новий вид — це новий запис плюс тести. Порядок ключів —
|
|
@@ -3731,8 +4601,7 @@ function expectsKindLabel(kind, data) {
|
|
|
3731
4601
|
const table = data;
|
|
3732
4602
|
return Array.isArray(table.columns) && singleUuidKeyColumn(table) !== void 0;
|
|
3733
4603
|
}
|
|
3734
|
-
|
|
3735
|
-
//#region src/model/format.ts
|
|
4604
|
+
// src/model/format.ts
|
|
3736
4605
|
/** Ключі project.meta.json — у порядку оголошення схеми проєкту. */
|
|
3737
4606
|
const PROJECT_KEY_ORDER = Object.keys(projectSchema.shape);
|
|
3738
4607
|
const defOf = (schema) => schema.def;
|
|
@@ -3747,7 +4616,7 @@ function unwrap(schema) {
|
|
|
3747
4616
|
else return current;
|
|
3748
4617
|
}
|
|
3749
4618
|
}
|
|
3750
|
-
const isPlainObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4619
|
+
const isPlainObject$1 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3751
4620
|
/**
|
|
3752
4621
|
* Варіант union, до якого належить об'єкт: за дискримінатором, інакше перший
|
|
3753
4622
|
* варіант, чия схема приймає об'єкт. Файл із помилкою не приймає жоден
|
|
@@ -3794,7 +4663,7 @@ function canonicalize(value, schema, topKeyOrder) {
|
|
|
3794
4663
|
const element = def.type === "array" ? def.element : void 0;
|
|
3795
4664
|
return value.map((item) => canonicalize(item, element));
|
|
3796
4665
|
}
|
|
3797
|
-
if (!isPlainObject(value)) return value;
|
|
4666
|
+
if (!isPlainObject$1(value)) return value;
|
|
3798
4667
|
if (def.type === "union") return canonicalize(value, pickVariant(def.options ?? [], def.discriminator, value), topKeyOrder);
|
|
3799
4668
|
if (def.type === "record") {
|
|
3800
4669
|
const result = {};
|
|
@@ -3862,7 +4731,7 @@ function isRecordKeyAt(schema, data, pointer) {
|
|
|
3862
4731
|
while (defOf(current).type === "union") {
|
|
3863
4732
|
const def = defOf(current);
|
|
3864
4733
|
const options = def.options ?? [];
|
|
3865
|
-
const variant = isPlainObject(value) ? pickVariant(options, def.discriminator, value) : options.find((option) => option.safeParse(value).success);
|
|
4734
|
+
const variant = isPlainObject$1(value) ? pickVariant(options, def.discriminator, value) : options.find((option) => option.safeParse(value).success);
|
|
3866
4735
|
if (variant === void 0) return false;
|
|
3867
4736
|
current = unwrap(variant);
|
|
3868
4737
|
}
|
|
@@ -3873,12 +4742,11 @@ function isRecordKeyAt(schema, data, pointer) {
|
|
|
3873
4742
|
} else if (def.type === "object") node = def.shape?.[segment];
|
|
3874
4743
|
else if (def.type === "array") node = def.element;
|
|
3875
4744
|
else return false;
|
|
3876
|
-
value = isPlainObject(value) || Array.isArray(value) ? value[segment] : void 0;
|
|
4745
|
+
value = isPlainObject$1(value) || Array.isArray(value) ? value[segment] : void 0;
|
|
3877
4746
|
}
|
|
3878
4747
|
return false;
|
|
3879
4748
|
}
|
|
3880
|
-
|
|
3881
|
-
//#region src/model/named-elements.ts
|
|
4749
|
+
// src/model/named-elements.ts
|
|
3882
4750
|
/**
|
|
3883
4751
|
* Масиви іменованих елементів схеми (спека П2 §3): елемент — об'єкт з `id` і
|
|
3884
4752
|
* `name`. Ключ масиву → схема елемента, у порядку оголошення схеми. Факт
|
|
@@ -3947,5 +4815,4 @@ const ASSIGNED_ONCE = [
|
|
|
3947
4815
|
effective: effectiveAssignedOn
|
|
3948
4816
|
}
|
|
3949
4817
|
];
|
|
3950
|
-
|
|
3951
|
-
export { ASSIGNED_ONCE, ATTRIBUTE_CASES, DATABASE_PROVIDERS, DELETE_EVENTS, KIND_REGISTRY, LOGICAL_TYPES, MAX_PHYSICAL_NAME_BYTES, MEMBERSHIP_SET_FUNCTION, METADATA_KINDS, NO_SCOPE, PLATFORM_SCHEMA, PROJECT_KEY_ORDER, PROVIDER_API_ROLES, PROVIDER_EVENT_SOURCES, PROVIDER_IDENTITY_SOURCES, PUBLIC_READ_PURPOSES, PUBLIC_READ_ROLES, SCHEMA_RULES, SQL_DEBT_FILE, SQL_UNIT_CLASSES, STANDARD_ACTIONS, SUBSCRIPTION_EVENTS, accessDimensionSchema, accessMappingSchema, accessSchema, accumulationRegisterSchema, actionRequires, appSchemaNameSchema, assignPhysicalName, assignedOnSchema, assignmentSourceSchema, attributeSchema, catalogAttributeSchema, catalogFromSnapshot, catalogSchema, chooseConstraintName, closeRequires, compositeIndexesSchema, constantSchema, customActionSchema, customActionsSchema, customTableColumnSchema, customTableSchema, defaultMayRepeat, defaultViolatesValueChecks, diffCatalogModels, documentSchema, elementNameSchema, enumValueSchema, enumerationSchema, eventSubscriptionSchema, expectsKindLabel, extentSchema, formatMetaFile, formatProjectFile, formatSqlDebtFile, grantEntryForm, grantEntrySchema, informationRegisterSchema, isRecordKeyAt, isScalarDefault, isSqlReservedWord, isUuidColumn, kindByDir, localizedStringSchema, logicalElementName, logicalObjectName, logicalTypeOf, makeObjectName, matchesAttributeCase, membershipSourceSchema, metadataIdSchema, metadataKindSchema, metadataRefSchema, monthColumn, namedCollections, objectHeaderShape, objectNameSchema, objectSelectorSchema, ownershipSchema, parseExpression, pgEnumSchema, pgEnumTypeName, pgTypeOf, physicalNameSchema, postsMovements, projectSchema, publicReadSchema, quoteIdent, refineValueType, resourceSchema, rightsCarrierSchema, rightsSetSchema, roleAssignedOnSchema, roleSchema, scopeKindSchema, serviceDateColumns, setGrantEntrySchema, singleUuidKeyColumn, singletonColumn, sqlDebtSchema, standardAttributeOverridesSchema, standardLogicalName, tabularSectionSchema, toSnakeCase, truncatedPeriodExpression, valueTypeShape, versionColumn, walkExpr };
|
|
4818
|
+
export { APPLIED_SNAPSHOT_HASH_FUNCTION_NAME, ASSIGNED_ONCE, ATTRIBUTE_CASES, CAST_TYPES, COMMAND_CORE_ERRORS, COMMAND_ERROR_CODES, COMMAND_SETTING, CURRENT_USER_FUNCTION_NAME, DATABASE_PROVIDERS, DELETE_EVENTS, HIERARCHY_ISOLATION_ERROR, INTEGER_TEXT, KIND_REGISTRY, LOGICAL_TYPES, LOGIN_ROLE_REQUEST_PURPOSES, MAX_PHYSICAL_NAME_BYTES, MEMBERSHIP_SET_FUNCTION, METADATA_KINDS, NO_SCOPE, OBJECT_MODULE_KEYS, OBJECT_OPERATIONS, OPERATION_EVENTS, PLATFORM_LOGIN_ROLES, PLATFORM_ROLES, PLATFORM_SCHEMA, PLATFORM_SETTING_PREFIX, PROJECT_KEY_ORDER, PROTECTED_SESSION_SETTINGS, PROVIDER_API_ROLES, PROVIDER_EVENT_SOURCES, PROVIDER_EXPRESSION_FUNCTIONS, PROVIDER_FUNCTIONS, PROVIDER_IDENTITY_SOURCES, PROVIDER_LOGIN_ROLES, PROVIDER_SCHEMAS, PROVIDER_SQL_TEXT_FUNCTIONS, PUBLIC_READ_PURPOSES, PUBLIC_READ_ROLES, READ_LIMIT_MAX, RIGHTS_COLUMNS, RIGHTS_DELTA_SECTION, RIGHTS_MAINTENANCE_SETTING, SCHEMA_RULES, SESSION_CLAIMS_SETTING, SQL_DEBT_FILE, SQL_UNIT_CLASSES, STANDARD_ACTIONS, SUBSCRIPTION_EVENTS, USER_PLATFORM_COLUMNS, UUID_TEXT, accessDimensionSchema, accessMappingSchema, accessSchema, accumulationRegisterSchema, actionRequires, appSchemaNameSchema, assignPhysicalName, assignedOnSchema, assignmentSourceSchema, attributeSchema, authorColumns, batchSchema, castTypeSchema, catalogAttributeSchema, catalogFromSnapshot, catalogSchema, chooseConstraintName, clipBytes, closeRequires, compositeIndexesSchema, constantSchema, customActionSchema, customActionsSchema, customTableColumnSchema, customTableSchema, defaultMayRepeat, defaultViolatesValueChecks, defineObjectModule, deletionMarkColumn, diffCatalogModels, documentSchema, elementNameSchema, encodeAttributes, encodeItemValue, encodePair, enumValueSchema, enumerationSchema, eventSubscriptionSchema, expectsKindLabel, extentSchema, formatMetaFile, formatProjectFile, formatSqlDebtFile, grantEntryForm, grantEntrySchema, informationRegisterSchema, isDate, isDateTime, isPlainObject, isRecordKeyAt, isScalarDefault, isSqlReservedWord, isTextEncodedType, isUuidColumn, isWithinType, keyColumn, kindByDir, lineNumberColumn, localizedStringSchema, logicalElementName, logicalObjectName, logicalTypeOf, makeObjectName, matchesAttributeCase, membershipSourceSchema, metadataIdSchema, metadataKindSchema, metadataRefSchema, monthColumn, namedCollections, objectHeaderShape, objectNameSchema, objectSelectorSchema, operationSchema, ownershipSchema, parseExpression, pgEnumSchema, pgEnumTypeName, pgTypeOf, physicalNameSchema, postsMovements, predefinedNameColumn, projectSchema, publicReadSchema, qualifiedNameSchema, quoteIdent, readQuerySchema, refineValueType, resourceSchema, rightsCarrierSchema, rightsSetSchema, roleAssignedOnSchema, roleSchema, runtimeAttributeSchema, runtimeCatalogSchema, runtimeConstraintSchema, runtimeObjectSchema, runtimeOperationTargetSchema, runtimeRootCreateSchema, runtimeSectionSchema, scopeKindSchema, serviceDateColumns, sessionClaimsSchema, setGrantEntrySchema, singleUuidKeyColumn, singletonColumn, sourceConditionSchema, sqlDebtSchema, standardAttributeOverridesSchema, standardLogicalName, tabularParentColumn, tabularSectionSchema, toSnakeCase, truncatedPeriodExpression, userPlatformColumns, valueTypeShape, versionColumn, walkExpr };
|