simetra 0.3.0-next.1 → 0.3.0-next.3

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.
@@ -2751,6 +2751,10 @@ export declare const rightsSetSchema: z.ZodObject<{
2751
2751
  }, z.core.$strict>]>;
2752
2752
  }, z.core.$strict>;
2753
2753
  }, z.core.$strict>]>>>;
2754
+ title: z.ZodOptional<z.ZodObject<{
2755
+ uk: z.ZodOptional<z.ZodString>;
2756
+ en: z.ZodOptional<z.ZodString>;
2757
+ }, z.core.$strict>>;
2754
2758
  id: z.ZodOptional<z.ZodUUID>;
2755
2759
  name: z.ZodString;
2756
2760
  $schema: z.ZodOptional<z.ZodString>;
@@ -2887,6 +2891,10 @@ export declare const roleSchema: z.ZodObject<{
2887
2891
  }, z.core.$strict>]>>;
2888
2892
  }, z.core.$strict>;
2889
2893
  }, z.core.$strict>]>>>;
2894
+ title: z.ZodOptional<z.ZodObject<{
2895
+ uk: z.ZodOptional<z.ZodString>;
2896
+ en: z.ZodOptional<z.ZodString>;
2897
+ }, z.core.$strict>>;
2890
2898
  id: z.ZodOptional<z.ZodUUID>;
2891
2899
  name: z.ZodString;
2892
2900
  $schema: z.ZodOptional<z.ZodString>;
@@ -3608,8 +3616,8 @@ export declare const projectSchema: z.ZodObject<{
3608
3616
  en: z.ZodOptional<z.ZodString>;
3609
3617
  }, z.core.$strict>>;
3610
3618
  defaultLocale: z.ZodDefault<z.ZodEnum<{
3611
- en: "en";
3612
3619
  uk: "uk";
3620
+ en: "en";
3613
3621
  }>>;
3614
3622
  primaryDataLanguage: z.ZodOptional<z.ZodString>;
3615
3623
  defaultSchema: z.ZodDefault<z.ZodString>;
@@ -3627,6 +3635,65 @@ export declare const projectSchema: z.ZodObject<{
3627
3635
  }, z.core.$strict>>;
3628
3636
  timezone: z.ZodDefault<z.ZodString>;
3629
3637
  selfSignUp: z.ZodOptional<z.ZodBoolean>;
3638
+ selfSignUpAccepted: z.ZodOptional<z.ZodObject<{
3639
+ objects: z.ZodDefault<z.ZodArray<z.ZodObject<{
3640
+ object: z.ZodObject<{
3641
+ kind: z.ZodEnum<{
3642
+ Catalog: "Catalog";
3643
+ Document: "Document";
3644
+ Enumeration: "Enumeration";
3645
+ InformationRegister: "InformationRegister";
3646
+ AccumulationRegister: "AccumulationRegister";
3647
+ Constant: "Constant";
3648
+ CustomTable: "CustomTable";
3649
+ PgEnum: "PgEnum";
3650
+ EventSubscription: "EventSubscription";
3651
+ RightsSet: "RightsSet";
3652
+ Role: "Role";
3653
+ }>;
3654
+ name: z.ZodString;
3655
+ }, z.core.$strict>;
3656
+ published: z.ZodOptional<z.ZodLiteral<true>>;
3657
+ }, z.core.$strict>>>;
3658
+ grants: z.ZodDefault<z.ZodArray<z.ZodObject<{
3659
+ role: z.ZodObject<{
3660
+ kind: z.ZodEnum<{
3661
+ Catalog: "Catalog";
3662
+ Document: "Document";
3663
+ Enumeration: "Enumeration";
3664
+ InformationRegister: "InformationRegister";
3665
+ AccumulationRegister: "AccumulationRegister";
3666
+ Constant: "Constant";
3667
+ CustomTable: "CustomTable";
3668
+ PgEnum: "PgEnum";
3669
+ EventSubscription: "EventSubscription";
3670
+ RightsSet: "RightsSet";
3671
+ Role: "Role";
3672
+ }>;
3673
+ name: z.ZodString;
3674
+ }, z.core.$strict>;
3675
+ object: z.ZodObject<{
3676
+ kind: z.ZodEnum<{
3677
+ Catalog: "Catalog";
3678
+ Document: "Document";
3679
+ Enumeration: "Enumeration";
3680
+ InformationRegister: "InformationRegister";
3681
+ AccumulationRegister: "AccumulationRegister";
3682
+ Constant: "Constant";
3683
+ CustomTable: "CustomTable";
3684
+ PgEnum: "PgEnum";
3685
+ EventSubscription: "EventSubscription";
3686
+ RightsSet: "RightsSet";
3687
+ Role: "Role";
3688
+ }>;
3689
+ name: z.ZodString;
3690
+ }, z.core.$strict>;
3691
+ actions: z.ZodArray<z.ZodString>;
3692
+ extent: z.ZodUnion<readonly [z.ZodLiteral<"any">, z.ZodLiteral<"own">, z.ZodObject<{
3693
+ dimension: z.ZodString;
3694
+ }, z.core.$strict>]>;
3695
+ }, z.core.$strict>>>;
3696
+ }, z.core.$strict>>;
3630
3697
  scopeKinds: z.ZodDefault<z.ZodArray<z.ZodObject<{
3631
3698
  id: z.ZodOptional<z.ZodUUID>;
3632
3699
  name: z.ZodString;
@@ -3892,11 +3959,11 @@ export declare const pgEnumSchema: z.ZodObject<{
3892
3959
  en: z.ZodOptional<z.ZodString>;
3893
3960
  }, z.core.$strict>>;
3894
3961
  id: z.ZodOptional<z.ZodUUID>;
3895
- name: z.ZodString;
3896
3962
  description: z.ZodOptional<z.ZodObject<{
3897
3963
  uk: z.ZodOptional<z.ZodString>;
3898
3964
  en: z.ZodOptional<z.ZodString>;
3899
3965
  }, z.core.$strict>>;
3966
+ name: z.ZodString;
3900
3967
  schema: z.ZodOptional<z.ZodString>;
3901
3968
  $schema: z.ZodOptional<z.ZodString>;
3902
3969
  physicalName: z.ZodOptional<z.ZodString>;
@@ -3952,11 +4019,11 @@ export declare const eventSubscriptionSchema: z.ZodObject<{
3952
4019
  en: z.ZodOptional<z.ZodString>;
3953
4020
  }, z.core.$strict>>;
3954
4021
  id: z.ZodOptional<z.ZodUUID>;
3955
- name: z.ZodString;
3956
4022
  description: z.ZodOptional<z.ZodObject<{
3957
4023
  uk: z.ZodOptional<z.ZodString>;
3958
4024
  en: z.ZodOptional<z.ZodString>;
3959
4025
  }, z.core.$strict>>;
4026
+ name: z.ZodString;
3960
4027
  $schema: z.ZodOptional<z.ZodString>;
3961
4028
  physicalName: z.ZodOptional<z.ZodString>;
3962
4029
  }, z.core.$strict>;
@@ -6272,6 +6339,41 @@ export declare const catalogAdoptedFactsSchema: z.ZodObject<{
6272
6339
  membershipKinds: z.ZodArray<z.ZodGUID>;
6273
6340
  assignments: z.ZodOptional<z.ZodLiteral<true>>;
6274
6341
  }, z.core.$strict>;
6342
+ /**
6343
+ * Рівень ролі в каталозі: `global`, `everyUser`, вид скоупу чи контейнер
6344
+ * (спека «Споживач поза монорепо» §5.4); вид і контейнер — за id.
6345
+ */
6346
+ export declare const catalogRoleLevelSchema: z.ZodUnion<readonly [z.ZodLiteral<"global">, z.ZodLiteral<"everyUser">, z.ZodObject<{
6347
+ scopeKind: z.ZodString;
6348
+ }, z.core.$strict>, z.ZodObject<{
6349
+ container: z.ZodString;
6350
+ }, z.core.$strict>]>;
6351
+ /** Роль у спільній частині каталогу: клієнт показує `title` чи `name`. */
6352
+ export declare const catalogRoleSchema: z.ZodObject<{
6353
+ id: z.ZodString;
6354
+ name: z.ZodString;
6355
+ title: z.ZodOptional<z.ZodObject<{
6356
+ uk: z.ZodOptional<z.ZodString>;
6357
+ en: z.ZodOptional<z.ZodString>;
6358
+ }, z.core.$strict>>;
6359
+ level: z.ZodUnion<readonly [z.ZodLiteral<"global">, z.ZodLiteral<"everyUser">, z.ZodObject<{
6360
+ scopeKind: z.ZodString;
6361
+ }, z.core.$strict>, z.ZodObject<{
6362
+ container: z.ZodString;
6363
+ }, z.core.$strict>]>;
6364
+ order: z.ZodOptional<z.ZodNumber>;
6365
+ assignable: z.ZodBoolean;
6366
+ fullAccess: z.ZodBoolean;
6367
+ }, z.core.$strict>;
6368
+ /** Набір прав у спільній частині каталогу. */
6369
+ export declare const catalogRightsSetSchema: z.ZodObject<{
6370
+ id: z.ZodString;
6371
+ name: z.ZodString;
6372
+ title: z.ZodOptional<z.ZodObject<{
6373
+ uk: z.ZodOptional<z.ZodString>;
6374
+ en: z.ZodOptional<z.ZodString>;
6375
+ }, z.core.$strict>>;
6376
+ }, z.core.$strict>;
6275
6377
  /** The runtime catalog: a projection of the compiled model (P4 spec §6.3). */
6276
6378
  export declare const runtimeCatalogSchema: z.ZodObject<{
6277
6379
  format: z.ZodLiteral<1>;
@@ -6286,6 +6388,30 @@ export declare const runtimeCatalogSchema: z.ZodObject<{
6286
6388
  membershipKinds: z.ZodArray<z.ZodGUID>;
6287
6389
  assignments: z.ZodOptional<z.ZodLiteral<true>>;
6288
6390
  }, z.core.$strict>>;
6391
+ roles: z.ZodOptional<z.ZodArray<z.ZodObject<{
6392
+ id: z.ZodString;
6393
+ name: z.ZodString;
6394
+ title: z.ZodOptional<z.ZodObject<{
6395
+ uk: z.ZodOptional<z.ZodString>;
6396
+ en: z.ZodOptional<z.ZodString>;
6397
+ }, z.core.$strict>>;
6398
+ level: z.ZodUnion<readonly [z.ZodLiteral<"global">, z.ZodLiteral<"everyUser">, z.ZodObject<{
6399
+ scopeKind: z.ZodString;
6400
+ }, z.core.$strict>, z.ZodObject<{
6401
+ container: z.ZodString;
6402
+ }, z.core.$strict>]>;
6403
+ order: z.ZodOptional<z.ZodNumber>;
6404
+ assignable: z.ZodBoolean;
6405
+ fullAccess: z.ZodBoolean;
6406
+ }, z.core.$strict>>>;
6407
+ rightsSets: z.ZodOptional<z.ZodArray<z.ZodObject<{
6408
+ id: z.ZodString;
6409
+ name: z.ZodString;
6410
+ title: z.ZodOptional<z.ZodObject<{
6411
+ uk: z.ZodOptional<z.ZodString>;
6412
+ en: z.ZodOptional<z.ZodString>;
6413
+ }, z.core.$strict>>;
6414
+ }, z.core.$strict>>>;
6289
6415
  objects: z.ZodArray<z.ZodObject<{
6290
6416
  id: z.ZodGUID;
6291
6417
  name: z.ZodString;
@@ -6654,6 +6780,8 @@ export type RuntimeSection = z.infer<typeof runtimeSectionSchema>;
6654
6780
  export type RuntimeOperationTarget = z.infer<typeof runtimeOperationTargetSchema>;
6655
6781
  export type RuntimeRootCreate = z.infer<typeof runtimeRootCreateSchema>;
6656
6782
  export type RuntimeObject = z.infer<typeof runtimeObjectSchema>;
6783
+ export type CatalogRole = z.infer<typeof catalogRoleSchema>;
6784
+ export type CatalogRightsSet = z.infer<typeof catalogRightsSetSchema>;
6657
6785
  export type RuntimeCatalog = z.infer<typeof runtimeCatalogSchema>;
6658
6786
  export type CatalogRightsCarrier = z.infer<typeof catalogRightsCarrierSchema>;
6659
6787
  export type CatalogRightsSubject = z.infer<typeof catalogRightsSubjectSchema>;
@@ -6676,6 +6804,30 @@ export declare const clientCatalogSchema: z.ZodObject<{
6676
6804
  membershipKinds: z.ZodArray<z.ZodGUID>;
6677
6805
  assignments: z.ZodOptional<z.ZodLiteral<true>>;
6678
6806
  }, z.core.$strict>>;
6807
+ roles: z.ZodOptional<z.ZodArray<z.ZodObject<{
6808
+ id: z.ZodString;
6809
+ name: z.ZodString;
6810
+ title: z.ZodOptional<z.ZodObject<{
6811
+ uk: z.ZodOptional<z.ZodString>;
6812
+ en: z.ZodOptional<z.ZodString>;
6813
+ }, z.core.$strict>>;
6814
+ level: z.ZodUnion<readonly [z.ZodLiteral<"global">, z.ZodLiteral<"everyUser">, z.ZodObject<{
6815
+ scopeKind: z.ZodString;
6816
+ }, z.core.$strict>, z.ZodObject<{
6817
+ container: z.ZodString;
6818
+ }, z.core.$strict>]>;
6819
+ order: z.ZodOptional<z.ZodNumber>;
6820
+ assignable: z.ZodBoolean;
6821
+ fullAccess: z.ZodBoolean;
6822
+ }, z.core.$strict>>>;
6823
+ rightsSets: z.ZodOptional<z.ZodArray<z.ZodObject<{
6824
+ id: z.ZodString;
6825
+ name: z.ZodString;
6826
+ title: z.ZodOptional<z.ZodObject<{
6827
+ uk: z.ZodOptional<z.ZodString>;
6828
+ en: z.ZodOptional<z.ZodString>;
6829
+ }, z.core.$strict>>;
6830
+ }, z.core.$strict>>>;
6679
6831
  objects: z.ZodArray<z.ZodObject<{
6680
6832
  id: z.ZodGUID;
6681
6833
  name: z.ZodString;
@@ -8782,6 +8934,8 @@ type ReferenceRole = "attribute.ref" | "attribute.allowedType" |
8782
8934
  "search.field" | "posting.movementsBlock" | "customTable.foreignKey" | "customTable.foreignKeyTarget" | "customTable.column" | "customTable.pgEnum" | "customTable.scopeColumn" | "object.scope" | "scopeKind.root" |
8783
8935
  /** Вид скоупу в `project.storageBuckets[].scopeKind`. */
8784
8936
  "storage.scopeKind" |
8937
+ /** Об'єкт чи роль у `project.selfSignUpAccepted` (прийняття самореєстрації). */
8938
+ "selfSignUp.accepted" |
8785
8939
  /** Об'єкт-джерело підписки на подію. */
8786
8940
  "eventSubscription.source" |
8787
8941
  /** Реквізит джерела в `whenChanged` підписки. */
@@ -1297,14 +1297,14 @@ const roleAssignedOnSchema = z.union([assignedOnSchema, z.literal("everyUser").m
1297
1297
  /**
1298
1298
  * Шапка декларацій прав: без PG-схеми, скоупу й фізичного імені — у базі
1299
1299
  * набір і роль живуть лише в згенерованій проєкції, а в даних їх називає
1300
- * UUID. `title`/`description` відкладено до матриці ролей (П4,
1301
- * спека прав §4.1).
1300
+ * UUID. `title` — необов'язкова назва для екрана призначення (без
1301
+ * значення за замовчуванням: хеш проєкту без неї не змінюється);
1302
+ * `description` відкладено (спека «Споживач поза монорепо» §5.4).
1302
1303
  */
1303
1304
  const rightsDeclarationHeader = z.object(objectHeaderShape).omit({
1304
1305
  schema: true,
1305
1306
  scope: true,
1306
1307
  physicalName: true,
1307
- title: true,
1308
1308
  description: true
1309
1309
  }).shape;
1310
1310
  const includeSchema$1 = z.array(metadataRefSchema).default([]).meta({ description: "Rights sets whose grants this declaration includes." });
@@ -2833,6 +2833,18 @@ const projectSchema = z.strictObject({
2833
2833
  */
2834
2834
  timezone: z.string().min(1).default("UTC").meta({ description: "IANA time zone in which the platform determines day, month, quarter and year." }),
2835
2835
  selfSignUp: z.boolean().optional().meta({ description: "Whether users may register themselves; enables the self sign-up warning and host start check." }),
2836
+ selfSignUpAccepted: z.strictObject({
2837
+ objects: z.array(z.strictObject({
2838
+ object: metadataRefSchema.meta({ description: "Object with publicRead authenticated accepted as open to anyone." }),
2839
+ published: z.literal(true).optional().meta({ description: "Accept only the published rows (the conditional publicRead); without it every row is accepted." })
2840
+ })).default([]).meta({ description: "Objects accepted as open to every signed-in user (publicRead authenticated)." }),
2841
+ grants: z.array(z.strictObject({
2842
+ role: metadataRefSchema.meta({ description: "Role of the everyUser level." }),
2843
+ object: metadataRefSchema.meta({ description: "Object of the grant." }),
2844
+ actions: z.array(elementNameSchema).min(1).meta({ description: "Accepted actions: standard words or custom action names." }),
2845
+ extent: extentSchema
2846
+ })).default([]).meta({ description: "Grants of everyUser roles accepted as open to anyone." })
2847
+ }).optional().meta({ description: "What the self sign-up warning no longer reports: it names only objects and grants open to anyone that are not listed here." }),
2836
2848
  scopeKinds: z.array(scopeKindSchema).default([]).meta({ description: "Scope kinds of the application; leave empty for a single-tenant application." }),
2837
2849
  accessDimensions: z.array(accessDimensionSchema).default([]).meta({ description: "Access dimensions of the application: value catalogs that grants may restrict rows by." }),
2838
2850
  membershipSources: z.array(membershipSourceSchema).default([]).meta({ description: "Adopted tables that hold the membership of a scope kind instead of a membership catalog." }),
@@ -4010,6 +4022,32 @@ const catalogAdoptedFactsSchema = z.strictObject({
4010
4022
  membershipKinds: z.array(z.guid()),
4011
4023
  assignments: z.literal(true).optional()
4012
4024
  });
4025
+ /**
4026
+ * Рівень ролі в каталозі: `global`, `everyUser`, вид скоупу чи контейнер
4027
+ * (спека «Споживач поза монорепо» §5.4); вид і контейнер — за id.
4028
+ */
4029
+ const catalogRoleLevelSchema = z.union([
4030
+ z.literal("global"),
4031
+ z.literal("everyUser"),
4032
+ z.strictObject({ scopeKind: z.string() }),
4033
+ z.strictObject({ container: z.string() })
4034
+ ]);
4035
+ /** Роль у спільній частині каталогу: клієнт показує `title` чи `name`. */
4036
+ const catalogRoleSchema = z.strictObject({
4037
+ id: z.string(),
4038
+ name: z.string(),
4039
+ title: localizedStringSchema.optional(),
4040
+ level: catalogRoleLevelSchema,
4041
+ order: z.number().int().nonnegative().optional(),
4042
+ assignable: z.boolean(),
4043
+ fullAccess: z.boolean()
4044
+ });
4045
+ /** Набір прав у спільній частині каталогу. */
4046
+ const catalogRightsSetSchema = z.strictObject({
4047
+ id: z.string(),
4048
+ name: z.string(),
4049
+ title: localizedStringSchema.optional()
4050
+ });
4013
4051
  /** The runtime catalog: a projection of the compiled model (P4 spec §6.3). */
4014
4052
  const runtimeCatalogSchema = z.strictObject({
4015
4053
  format: z.literal(1),
@@ -4020,6 +4058,9 @@ const runtimeCatalogSchema = z.strictObject({
4020
4058
  /** Проєкт дозволяє самореєстрацію: host відмовляє старту `open` без нього. */
4021
4059
  selfSignUp: z.literal(true).optional(),
4022
4060
  adoptedFacts: catalogAdoptedFactsSchema.optional(),
4061
+ /** Немає в проєкті без ролей; порядок — за `order`, далі за `name`. */
4062
+ roles: z.array(catalogRoleSchema).optional(),
4063
+ rightsSets: z.array(catalogRightsSetSchema).optional(),
4023
4064
  objects: z.array(runtimeObjectSchema)
4024
4065
  }).superRefine((catalog, ctx) => {
4025
4066
  catalog.objects.forEach((object, index) => {
@@ -4053,6 +4094,8 @@ const clientCatalogSchema = z.strictObject({
4053
4094
  rightsSnapshot: z.literal(true).optional(),
4054
4095
  /** Факти прийнятих джерел свіжіють за інтервалом (П4-B §8.2). */
4055
4096
  adoptedFacts: catalogAdoptedFactsSchema.optional(),
4097
+ roles: z.array(catalogRoleSchema).optional(),
4098
+ rightsSets: z.array(catalogRightsSetSchema).optional(),
4056
4099
  objects: z.array(catalogEntrySchema)
4057
4100
  }).superRefine((catalog, ctx) => {
4058
4101
  const ids = new Set(catalog.objects.map((o) => o.id));
@@ -8702,4 +8745,4 @@ const ASSIGNED_ONCE = [
8702
8745
  field: "primaryDataLanguage"
8703
8746
  }
8704
8747
  ];
8705
- export { APPLIED_SNAPSHOT_HASH_FUNCTION_NAME, ASSIGNED_ONCE, ATTRIBUTE_CASES, BATCH_MAX, CAST_TYPES, CENTRIFUGO_CHANNEL_MAX, COMMAND_CORE_ERRORS, COMMAND_ERROR_CODES, COMMAND_SETTING, CURRENT_USER_FUNCTION_NAME, CommandFailure, DATABASE_PROVIDERS, DEFAULT_MAIN_PRESENTATION, DEFAULT_SEARCH_MODE, DELETE_EVENTS, ELEMENT_ID_SEPARATOR, FILTER_DEPTH_MAX, FILTER_IN_MAX, FILTER_NODES_MAX, FILTER_OPERATORS, FUNCTIONS_FILE_SUFFIX, HEAD_READABLE_SETTINGS, HIERARCHY_ISOLATION_ERROR, INCLUDE_MAX, INTEGER_TEXT, JSONB_PAIRS_PER_CALL, KIND_REGISTRY, KNOWN_MARKER, LIMIT_REASONS, LOGICAL_TYPES, LOGIN_ROLE_PARENTS, LOGIN_ROLE_REQUEST_PURPOSES, LOGIN_ROLE_SETTINGS, MAX_PHYSICAL_NAME_BYTES, MEMBERSHIP_SET_FUNCTION, METADATA_KINDS, NO_SCOPE, OBJECT_MODULE_KEYS, OBJECT_OPERATIONS, OPERATION_EVENTS, ORDER_BY_MAX, PAYLOAD_MAX_BYTES, PINNED_SESSION_SETTINGS, PLATFORM_LOGIN_ROLES, PLATFORM_ROLES, PLATFORM_ROLES_NOT_PURPOSES, PLATFORM_SCHEMA, PLATFORM_SETTING_PREFIX, PLATFORM_STATE_TABLES, PRIVILEGED_LOGIN_REASONS, PROJECT_KEY_ORDER, PROTECTED_SESSION_SETTINGS, PROVIDER_API_ROLES, PROVIDER_EVENT_SOURCES, PROVIDER_EXPRESSION_FUNCTIONS, PROVIDER_FUNCTIONS, PROVIDER_IDENTITY_SOURCES, PROVIDER_LOGIN_ROLES, PROVIDER_OWNER_ROLES, PROVIDER_SCHEMAS, PUBLIC_READ_PURPOSES, PUBLIC_READ_ROLES, READ_BATCH_MAX, READ_BATCH_STATEMENTS_MAX, READ_COUNT_CAP, READ_LIMIT_MAX, READ_OFFSET_MAX, RESPONSE_BUDGET_BYTES, RICH_TEXT_MAX_DEPTH, RICH_TEXT_PROFILE, RICH_TEXT_WHITESPACE, RIGHTS_CLIENT_SNAPSHOT_FUNCTION_NAME, RIGHTS_COLUMNS, RIGHTS_DELTA_SECTION, RIGHTS_DIMENSION_VALUES_MAX, RIGHTS_MAINTENANCE_SETTING, RIGHTS_REQUIRE_ERROR, ROW_VERSION_EPOCH_FUNCTION_NAME, SCHEMA_RULES, SEARCH_MODES, SEARCH_PREFIX_CHARS, SESSION_CLAIMS_SETTING, SIGNAL_INVALIDATE_FUNCTION_NAME, SIGNAL_MERGE_MODE, SIGNAL_MERGE_THRESHOLD, SIGNAL_MODE_SETTING, SIGNAL_NOTIFY_CHANNEL, SIGNAL_OUTBOX, SIGNAL_PAYLOAD_MAX_BYTES, SIGNAL_TOPIC_ALLOWED_FUNCTION_NAME, SQL_DEBT_FILE, SQL_FUNCTION_CALLERS, SQL_UNIT_CLASSES, STANDARD_ACTIONS, STORAGE_ERRORS, STORAGE_FUNCTIONS, STORAGE_MAX_BYTES, STORAGE_REASONS, STORAGE_TABLES, STRUCTURAL_PATH_WORDS, SUBSCRIPTION_EVENTS, TABULAR_LINES_MAX, TOPIC_UUID_PATTERN, USER_PLATFORM_COLUMNS, UUID_TEXT, VALUE_REASONS, WireDecodeError, WireEncodeError, ZERO_UUID, accessDimensionSchema, accessMappingSchema, accessSchema, accumulationRegisterSchema, actionRequires, appSchemaNameSchema, assignPhysicalName, assignedOnSchema, assignmentSourceSchema, attributeSchema, authorColumns, batchSchema, castTypeSchema, catalogAdoptedFactsSchema, catalogAttributeSchema, catalogEntryAttributeSchema, catalogEntrySchema, catalogEntrySectionSchema, catalogFromSnapshot, catalogIndex, catalogRightsCarrierSchema, catalogRightsExtentSchema, catalogRightsSchema, catalogRightsSubjectSchema, catalogSchema, changeSignalSchema, changesFromWire, changesToWire, channelTopic, checkRichText, chooseConstraintName, clientCatalogSchema, clipBytes, closeRequires, compositeIndexesSchema, constantSchema, customActionSchema, customActionsSchema, customTableColumnSchema, customTableSchema, dataRequestSchema, dataResponseSchema, decodeRow, decodeValues, defaultMayRepeat, defaultViolatesValueChecks, defineObjectModule, deletionMarkColumn, diffCatalogModels, documentSchema, effectiveMaxBytes, effectiveSearch, elementIdSchema, elementNameSchema, encodeAttributeValue, encodeAttributes, encodeItemValue, encodePair, encodeRow, enumValueSchema, enumerationSchema, errorFromWire, errorToWire, eventSubscriptionSchema, expectsKindLabel, extentSchema, fileObjectKey, filePlatformColumns, filterSchema, filterWithinLimits, formatMetaFile, formatProjectFile, formatSqlDebtFile, formatSqlFunctionsFile, grantEntryForm, grantEntrySchema, includeSchema, informationRegisterSchema, invalidateSignalSchema, isDate, isDateTime, isFileObjectKey, isFileObjectPrefix, isObjectOrigin, isObjectTable, isPlainObject, isRecordKeyAt, isRichTextEmpty, isScalarDefault, isSqlReservedWord, isTextEncodedType, isUuidColumn, isWithinType, jsonBytes, jsonbBuildObject, kernelHashSchema, keyColumn, keysetFilter, keysetNodesMax, kindByDir, knownFormAllowed, knownSchema, lengthLimited, lineNumberColumn, localizedStringSchema, logicalElementName, logicalObjectName, logicalTypeOf, loginRoleParentNames, makeObjectName, matchesAttributeCase, membershipSourceSchema, metadataIdSchema, metadataKindSchema, metadataRefSchema, monthColumn, namedCollections, normalDateTime, objectColumns, objectHeaderShape, objectNameSchema, objectSelectorSchema, objectTable, operationFromWire, operationSchema, operationToWire, orderBySchema, ownershipSchema, parseExpression, parsePublicRead, parseStandardElementId, parseTopic, pathFromWire, pathToWire, pgEnumSchema, pgEnumTypeName, pgTypeOf, physicalNameSchema, postsMovements, predefinedNameColumn, projectSchema, publicReadConditionalSchema, publicReadSchema, publicationCarriers, publishedColumn, qualifiedNameSchema, queryFormSchema, quoteIdent, readPartFromWire, readPartToWire, readQueryFromWire, readQuerySchema, readQueryToWire, readResultFromWire, readResultToWire, receivedChangeSchema, receivedInvalidateSchema, receivedRightsSchema, refineValueType, resourceSchema, richTextDepthOk, rightsCarrierSchema, rightsDimensionValuesSchema, rightsMemberSchema, rightsRowSchema, rightsSetSchema, rightsSignalSchema, rightsSnapshotSchema, rightsValueSchema, rightsVersionSchema, roleAssignedOnSchema, roleSchema, rowWithoutSearch, runtimeAttributeSchema, runtimeCatalogSchema, runtimeConstraintSchema, runtimeObjectSchema, runtimeOperationTargetSchema, runtimeRootCreateSchema, runtimeSectionSchema, scopeKindSchema, searchColumnName, searchNormalization, searchPrefixNormalization, searchSchema, serviceDateColumns, sessionClaimsSchema, setGrantEntrySchema, singleUuidKeyColumn, singletonColumn, sourceConditionSchema, splitKnownMarker, sqlDebtSchema, sqlFunctionDeclarationSchema, sqlFunctionsFileSchema, standardAttributeOverridesSchema, standardElementId, standardLogicalName, storageSchema, tabularParentColumn, tabularSectionSchema, toSnakeCase, truncatedPeriodExpression, updateOperationObjectSchema, userPlatformColumns, valueTypeShape, versionColumn, versionEpochSchema, versionValueSchema, walkExpr, wireChangeSchema, wireCommandErrorSchema, wireOperationSchema, wireReadPartSchema, wireReadPartsResultSchema, wireReadQuerySchema, wireReadResultSchema, wireRunResultSchema };
8748
+ export { APPLIED_SNAPSHOT_HASH_FUNCTION_NAME, ASSIGNED_ONCE, ATTRIBUTE_CASES, BATCH_MAX, CAST_TYPES, CENTRIFUGO_CHANNEL_MAX, COMMAND_CORE_ERRORS, COMMAND_ERROR_CODES, COMMAND_SETTING, CURRENT_USER_FUNCTION_NAME, CommandFailure, DATABASE_PROVIDERS, DEFAULT_MAIN_PRESENTATION, DEFAULT_SEARCH_MODE, DELETE_EVENTS, ELEMENT_ID_SEPARATOR, FILTER_DEPTH_MAX, FILTER_IN_MAX, FILTER_NODES_MAX, FILTER_OPERATORS, FUNCTIONS_FILE_SUFFIX, HEAD_READABLE_SETTINGS, HIERARCHY_ISOLATION_ERROR, INCLUDE_MAX, INTEGER_TEXT, JSONB_PAIRS_PER_CALL, KIND_REGISTRY, KNOWN_MARKER, LIMIT_REASONS, LOGICAL_TYPES, LOGIN_ROLE_PARENTS, LOGIN_ROLE_REQUEST_PURPOSES, LOGIN_ROLE_SETTINGS, MAX_PHYSICAL_NAME_BYTES, MEMBERSHIP_SET_FUNCTION, METADATA_KINDS, NO_SCOPE, OBJECT_MODULE_KEYS, OBJECT_OPERATIONS, OPERATION_EVENTS, ORDER_BY_MAX, PAYLOAD_MAX_BYTES, PINNED_SESSION_SETTINGS, PLATFORM_LOGIN_ROLES, PLATFORM_ROLES, PLATFORM_ROLES_NOT_PURPOSES, PLATFORM_SCHEMA, PLATFORM_SETTING_PREFIX, PLATFORM_STATE_TABLES, PRIVILEGED_LOGIN_REASONS, PROJECT_KEY_ORDER, PROTECTED_SESSION_SETTINGS, PROVIDER_API_ROLES, PROVIDER_EVENT_SOURCES, PROVIDER_EXPRESSION_FUNCTIONS, PROVIDER_FUNCTIONS, PROVIDER_IDENTITY_SOURCES, PROVIDER_LOGIN_ROLES, PROVIDER_OWNER_ROLES, PROVIDER_SCHEMAS, PUBLIC_READ_PURPOSES, PUBLIC_READ_ROLES, READ_BATCH_MAX, READ_BATCH_STATEMENTS_MAX, READ_COUNT_CAP, READ_LIMIT_MAX, READ_OFFSET_MAX, RESPONSE_BUDGET_BYTES, RICH_TEXT_MAX_DEPTH, RICH_TEXT_PROFILE, RICH_TEXT_WHITESPACE, RIGHTS_CLIENT_SNAPSHOT_FUNCTION_NAME, RIGHTS_COLUMNS, RIGHTS_DELTA_SECTION, RIGHTS_DIMENSION_VALUES_MAX, RIGHTS_MAINTENANCE_SETTING, RIGHTS_REQUIRE_ERROR, ROW_VERSION_EPOCH_FUNCTION_NAME, SCHEMA_RULES, SEARCH_MODES, SEARCH_PREFIX_CHARS, SESSION_CLAIMS_SETTING, SIGNAL_INVALIDATE_FUNCTION_NAME, SIGNAL_MERGE_MODE, SIGNAL_MERGE_THRESHOLD, SIGNAL_MODE_SETTING, SIGNAL_NOTIFY_CHANNEL, SIGNAL_OUTBOX, SIGNAL_PAYLOAD_MAX_BYTES, SIGNAL_TOPIC_ALLOWED_FUNCTION_NAME, SQL_DEBT_FILE, SQL_FUNCTION_CALLERS, SQL_UNIT_CLASSES, STANDARD_ACTIONS, STORAGE_ERRORS, STORAGE_FUNCTIONS, STORAGE_MAX_BYTES, STORAGE_REASONS, STORAGE_TABLES, STRUCTURAL_PATH_WORDS, SUBSCRIPTION_EVENTS, TABULAR_LINES_MAX, TOPIC_UUID_PATTERN, USER_PLATFORM_COLUMNS, UUID_TEXT, VALUE_REASONS, WireDecodeError, WireEncodeError, ZERO_UUID, accessDimensionSchema, accessMappingSchema, accessSchema, accumulationRegisterSchema, actionRequires, appSchemaNameSchema, assignPhysicalName, assignedOnSchema, assignmentSourceSchema, attributeSchema, authorColumns, batchSchema, castTypeSchema, catalogAdoptedFactsSchema, catalogAttributeSchema, catalogEntryAttributeSchema, catalogEntrySchema, catalogEntrySectionSchema, catalogFromSnapshot, catalogIndex, catalogRightsCarrierSchema, catalogRightsExtentSchema, catalogRightsSchema, catalogRightsSetSchema, catalogRightsSubjectSchema, catalogRoleLevelSchema, catalogRoleSchema, catalogSchema, changeSignalSchema, changesFromWire, changesToWire, channelTopic, checkRichText, chooseConstraintName, clientCatalogSchema, clipBytes, closeRequires, compositeIndexesSchema, constantSchema, customActionSchema, customActionsSchema, customTableColumnSchema, customTableSchema, dataRequestSchema, dataResponseSchema, decodeRow, decodeValues, defaultMayRepeat, defaultViolatesValueChecks, defineObjectModule, deletionMarkColumn, diffCatalogModels, documentSchema, effectiveMaxBytes, effectiveSearch, elementIdSchema, elementNameSchema, encodeAttributeValue, encodeAttributes, encodeItemValue, encodePair, encodeRow, enumValueSchema, enumerationSchema, errorFromWire, errorToWire, eventSubscriptionSchema, expectsKindLabel, extentSchema, fileObjectKey, filePlatformColumns, filterSchema, filterWithinLimits, formatMetaFile, formatProjectFile, formatSqlDebtFile, formatSqlFunctionsFile, grantEntryForm, grantEntrySchema, includeSchema, informationRegisterSchema, invalidateSignalSchema, isDate, isDateTime, isFileObjectKey, isFileObjectPrefix, isObjectOrigin, isObjectTable, isPlainObject, isRecordKeyAt, isRichTextEmpty, isScalarDefault, isSqlReservedWord, isTextEncodedType, isUuidColumn, isWithinType, jsonBytes, jsonbBuildObject, kernelHashSchema, keyColumn, keysetFilter, keysetNodesMax, kindByDir, knownFormAllowed, knownSchema, lengthLimited, lineNumberColumn, localizedStringSchema, logicalElementName, logicalObjectName, logicalTypeOf, loginRoleParentNames, makeObjectName, matchesAttributeCase, membershipSourceSchema, metadataIdSchema, metadataKindSchema, metadataRefSchema, monthColumn, namedCollections, normalDateTime, objectColumns, objectHeaderShape, objectNameSchema, objectSelectorSchema, objectTable, operationFromWire, operationSchema, operationToWire, orderBySchema, ownershipSchema, parseExpression, parsePublicRead, parseStandardElementId, parseTopic, pathFromWire, pathToWire, pgEnumSchema, pgEnumTypeName, pgTypeOf, physicalNameSchema, postsMovements, predefinedNameColumn, projectSchema, publicReadConditionalSchema, publicReadSchema, publicationCarriers, publishedColumn, qualifiedNameSchema, queryFormSchema, quoteIdent, readPartFromWire, readPartToWire, readQueryFromWire, readQuerySchema, readQueryToWire, readResultFromWire, readResultToWire, receivedChangeSchema, receivedInvalidateSchema, receivedRightsSchema, refineValueType, resourceSchema, richTextDepthOk, rightsCarrierSchema, rightsDimensionValuesSchema, rightsMemberSchema, rightsRowSchema, rightsSetSchema, rightsSignalSchema, rightsSnapshotSchema, rightsValueSchema, rightsVersionSchema, roleAssignedOnSchema, roleSchema, rowWithoutSearch, runtimeAttributeSchema, runtimeCatalogSchema, runtimeConstraintSchema, runtimeObjectSchema, runtimeOperationTargetSchema, runtimeRootCreateSchema, runtimeSectionSchema, scopeKindSchema, searchColumnName, searchNormalization, searchPrefixNormalization, searchSchema, serviceDateColumns, sessionClaimsSchema, setGrantEntrySchema, singleUuidKeyColumn, singletonColumn, sourceConditionSchema, splitKnownMarker, sqlDebtSchema, sqlFunctionDeclarationSchema, sqlFunctionsFileSchema, standardAttributeOverridesSchema, standardElementId, standardLogicalName, storageSchema, tabularParentColumn, tabularSectionSchema, toSnakeCase, truncatedPeriodExpression, updateOperationObjectSchema, userPlatformColumns, valueTypeShape, versionColumn, versionEpochSchema, versionValueSchema, walkExpr, wireChangeSchema, wireCommandErrorSchema, wireOperationSchema, wireReadPartSchema, wireReadPartsResultSchema, wireReadQuerySchema, wireReadResultSchema, wireRunResultSchema };
@@ -1021,7 +1021,7 @@ export declare function checkOwnerAttributes(tx: ApplyTransaction, provider: Dat
1021
1021
  * тримає тест, а не читання маніфесту під час виконання: ярус не звертається
1022
1022
  * до файлової системи.
1023
1023
  */
1024
- export declare const PLATFORM_VERSION = "0.3.0-next.1";
1024
+ export declare const PLATFORM_VERSION = "0.3.0-next.3";
1025
1025
  /**
1026
1026
  * Структурний ключ таблиці для множин і мап: ім'я з крапкою не злипається зі
1027
1027
  * схемою, як злиплося б у `schema.name`. Складені ключі підоб'єктів — так
@@ -2080,10 +2080,19 @@ export declare function readBlindFunctions(tx: ApplyTransaction, plpgsqlCheck: "
2080
2080
  export declare const PLPGSQL_CHECK_MODES: readonly ["installed", "transient", "unavailable"];
2081
2081
  type PlpgsqlCheckMode = (typeof PLPGSQL_CHECK_MODES)[number];
2082
2082
  /**
2083
- * Розширення є в `pg_extension` цієї бази — незалежно від прав ролі на нього:
2084
- * звірка цілі з планом `installed` питає лише про наявність.
2083
+ * Whether `plpgsql_check` is in `pg_extension` of this database (whatever
2084
+ * rights the role has on it) and whether the server offers it in
2085
+ * `pg_available_extensions`.
2085
2086
  */
2086
- export declare function plpgsqlCheckInstalled(tx: ApplyTransaction): Promise<boolean>;
2087
+ interface PlpgsqlCheckPresence {
2088
+ installed: boolean;
2089
+ available: boolean;
2090
+ }
2091
+ /**
2092
+ * Наявність розширення незалежно від прав ролі на нього: звірка цілі з планом
2093
+ * питає лише, чи воно є в базі й чи сервер його пропонує.
2094
+ */
2095
+ export declare function readPlpgsqlCheckPresence(tx: ApplyTransaction): Promise<PlpgsqlCheckPresence>;
2087
2096
  /** Режим `plpgsql_check` цієї бази; `installable` — перелік пресету провайдера. */
2088
2097
  export declare function readPlpgsqlCheckMode(tx: ApplyTransaction, installable: readonly string[]): Promise<PlpgsqlCheckMode>;
2089
2098
  /**
@@ -3292,6 +3301,16 @@ interface PostgresClusterSet {
3292
3301
  name: string;
3293
3302
  };
3294
3303
  }
3304
+ /**
3305
+ * Options of `ensurePostgresCluster`. `passwords` maps a login role of the set
3306
+ * (the owner, `auth` or a login role of `roles`) to the password that the
3307
+ * call sets on it, in the same transaction, only when the call creates that
3308
+ * role: an existing role keeps its password. The values never reach the
3309
+ * outcome or a diagnostic.
3310
+ */
3311
+ interface PostgresClusterOptions {
3312
+ passwords?: ReadonlyMap<string, string>;
3313
+ }
3295
3314
  /**
3296
3315
  * What a call created, what it only found, and what it could not do yet.
3297
3316
  * Roles and databases by name; the identity grants as `<schema>:USAGE` and
@@ -3309,6 +3328,8 @@ interface PostgresClusterOutcome {
3309
3328
  role: string;
3310
3329
  parents: string[];
3311
3330
  }[];
3331
+ /** Created login roles that got a password from `passwords`; absent when none. */
3332
+ passwords?: string[];
3312
3333
  }
3313
3334
  /** Result of `ensurePostgresCluster`: nothing was written when it is a refusal. */
3314
3335
  type PostgresClusterResult = {
@@ -3349,9 +3370,10 @@ interface ClusterConnections {
3349
3370
  * Фаза читання нічого не пише й збирає всі відмови; фаза запису не відмовляє
3350
3371
  * вибірково (окрім повторної перевірки `extensions` перед
3351
3372
  * `CREATE EXTENSION`) і діє за знімком читання. Повторний виклик нічого не
3352
- * створює.
3373
+ * створює. Розширення, якого сервер не пропонує, — відмова фази читання
3374
+ * `roles.extension-unavailable`, а не сира помилка `CREATE EXTENSION`.
3353
3375
  */
3354
- export declare function ensurePostgresCluster(dbs: ApplyDatabase, conns: ClusterConnections, set: PostgresClusterSet): Promise<PostgresClusterResult>;
3376
+ export declare function ensurePostgresCluster(dbs: ApplyDatabase, conns: ClusterConnections, set: PostgresClusterSet, options?: PostgresClusterOptions): Promise<PostgresClusterResult>;
3355
3377
  /** One maintenance action of the `rights-maintenance` tool (P4 spec §6.12). */
3356
3378
  type RightsMaintenanceRequest = {
3357
3379
  action: "firstGlobalAssignment";
@@ -4021,4 +4043,4 @@ interface StepChange {
4021
4043
  * більше за `unproven`.
4022
4044
  */
4023
4045
  export declare function planChange(steps: readonly Pick<PlanStep, "id" | "sql" | "verb" | "produced" | "destroyed" | "consumed">[], used: UsedObject, parse: SqlParser): StepChange | undefined;
4024
- export type { AccessChange, AppliedCatalog, ApplyDatabase, ApplyDesired, ApplyRecord, ApplyState, ApplyStateObjects, ApplyTimeouts, ApplyTransaction, BackfillAction, BackfillCounts, BackfillFacts, BackfillInput, BackfillResult, BackfillTarget, BlindFunctions, CanonicalRename, CatalogFingerprint, CensusClass, CensusCount, CheckResult, ClassCoverage, ColumnName, CreatedByPlan, DataFacts, DataOrigin, DataStepKind, DataTable, DataWriter, DbConnection, DesiredComparison, DesiredState, DriftReport, DriftVerdict, EngineAction, EngineCatalog, EngineCoverage, EngineDiagnostic, EngineIdentity, EngineObjectRef, EnginePlan, EngineScope, EngineSetting, EquivalenceObject, ExecutablePlan, ExecuteAclEntry, ExecuteCrossCheckFailure, ExecuteFacts, ExecuteOptions, ExecuteOutcome, Extracted, FingerprintComparison, FingerprintSection, FolderReference, FootprintModels, FunctionError, FunctionExecuteFact, GlobalDefaultPrivilege, GuardForm, GuardProblem, GuardResult, IdentityTableFacts, ImplicitLock, LiveForeignKey, LiveTrigger, LockedTable, MarkerRecord, ModelScope, NotNullColumn, OwnerRefusalCode, ParsedPlan, PendingCarrierCopies, PermissionItem, PermissionSubject, PlanAction, PlanArtifact, PlanDatabases, PlanOutcome, PlanStep, PlannedDataTable, PlatformLoginRole, PlatformRoleOutcome, PlatformRoleRow, PlatformRoleSet, PlpgsqlCheckMode, PostgresClusterOutcome, PostgresClusterResult, PostgresClusterSet, PreservedTable, PromotionInput, PromotionSection, PropertyCount, ProviderLockSet, ProviderLockSource, ProviderLockStatement, ProviderLocks, ProviderSurface, ProviderTableName, RehearsalEvidence, RehearsalPhase, RehearsalProof, RehearsalReport, RehearsalTimings, Removal, RemovalCover, RenameIntent, RenderedStatement, ReverseOptions, ReverseResult, RightsMaintenanceDone, RightsMaintenanceRequest, RightsOrphans, RoleServer, SchemaEngine, SectionTable, SeedTargetRows, SeedVerdict, ServerFacts, ShadowEnvironment, ShadowOptions, ShadowOutcome, StatementSubject, StepChange, StepClass, StepFootprint, TableLock, TableLockMode, TransitionVerdict, TypeChange, TypeChangeDependent, TypePresence, UsedObject, WriteFacts, WritePath, WriteTable };
4046
+ export type { AccessChange, AppliedCatalog, ApplyDatabase, ApplyDesired, ApplyRecord, ApplyState, ApplyStateObjects, ApplyTimeouts, ApplyTransaction, BackfillAction, BackfillCounts, BackfillFacts, BackfillInput, BackfillResult, BackfillTarget, BlindFunctions, CanonicalRename, CatalogFingerprint, CensusClass, CensusCount, CheckResult, ClassCoverage, ColumnName, CreatedByPlan, DataFacts, DataOrigin, DataStepKind, DataTable, DataWriter, DbConnection, DesiredComparison, DesiredState, DriftReport, DriftVerdict, EngineAction, EngineCatalog, EngineCoverage, EngineDiagnostic, EngineIdentity, EngineObjectRef, EnginePlan, EngineScope, EngineSetting, EquivalenceObject, ExecutablePlan, ExecuteAclEntry, ExecuteCrossCheckFailure, ExecuteFacts, ExecuteOptions, ExecuteOutcome, Extracted, FingerprintComparison, FingerprintSection, FolderReference, FootprintModels, FunctionError, FunctionExecuteFact, GlobalDefaultPrivilege, GuardForm, GuardProblem, GuardResult, IdentityTableFacts, ImplicitLock, LiveForeignKey, LiveTrigger, LockedTable, MarkerRecord, ModelScope, NotNullColumn, OwnerRefusalCode, ParsedPlan, PendingCarrierCopies, PermissionItem, PermissionSubject, PlanAction, PlanArtifact, PlanDatabases, PlanOutcome, PlanStep, PlannedDataTable, PlatformLoginRole, PlatformRoleOutcome, PlatformRoleRow, PlatformRoleSet, PlpgsqlCheckMode, PlpgsqlCheckPresence, PostgresClusterOptions, PostgresClusterOutcome, PostgresClusterResult, PostgresClusterSet, PreservedTable, PromotionInput, PromotionSection, PropertyCount, ProviderLockSet, ProviderLockSource, ProviderLockStatement, ProviderLocks, ProviderSurface, ProviderTableName, RehearsalEvidence, RehearsalPhase, RehearsalProof, RehearsalReport, RehearsalTimings, Removal, RemovalCover, RenameIntent, RenderedStatement, ReverseOptions, ReverseResult, RightsMaintenanceDone, RightsMaintenanceRequest, RightsOrphans, RoleServer, SchemaEngine, SectionTable, SeedTargetRows, SeedVerdict, ServerFacts, ShadowEnvironment, ShadowOptions, ShadowOutcome, StatementSubject, StepChange, StepClass, StepFootprint, TableLock, TableLockMode, TransitionVerdict, TypeChange, TypeChangeDependent, TypePresence, UsedObject, WriteFacts, WritePath, WriteTable };
@@ -3893,7 +3893,7 @@ async function readSessionSearchPath(tx) {
3893
3893
  * тримає тест, а не читання маніфесту під час виконання: ярус не звертається
3894
3894
  * до файлової системи.
3895
3895
  */
3896
- const PLATFORM_VERSION = "0.3.0-next.1";
3896
+ const PLATFORM_VERSION = "0.3.0-next.3";
3897
3897
  // src/schema/apply/state.ts
3898
3898
  /**
3899
3899
  * Форма стану застосування (платформна спека §6.1). Читач приймає лише її:
@@ -9225,7 +9225,10 @@ const PLPGSQL_CHECK_MODES = [
9225
9225
  "transient",
9226
9226
  "unavailable"
9227
9227
  ];
9228
- /** Розширення, яким перевірка тіл користується, коли воно є. */
9228
+ /**
9229
+ * The extension that checks function bodies when it is there; `roles` of the
9230
+ * postgres profile installs it (spec of the profile §3.5).
9231
+ */
9229
9232
  const PLPGSQL_CHECK = "plpgsql_check";
9230
9233
  /** Схема тимчасового розширення й точка збереження, у якій воно живе. */
9231
9234
  const CHECK_SCHEMA = "simetra_plpgsql_check";
@@ -9258,14 +9261,18 @@ async function readPlpgsqlCheckFacts(tx) {
9258
9261
  */
9259
9262
  function modeOf(f, installable) {
9260
9263
  if (f.installed) return f.schemaUsage && f.functionExecute ? "installed" : "unavailable";
9261
- return f.available && f.createOnDatabase && (f.trusted || f.superuser || installable.includes(PLPGSQL_CHECK)) ? "transient" : "unavailable";
9264
+ return f.available && f.createOnDatabase && (f.trusted || f.superuser || installable.includes("plpgsql_check")) ? "transient" : "unavailable";
9262
9265
  }
9263
9266
  /**
9264
- * Розширення є в `pg_extension` цієї бази — незалежно від прав ролі на нього:
9265
- * звірка цілі з планом `installed` питає лише про наявність.
9267
+ * Наявність розширення незалежно від прав ролі на нього: звірка цілі з планом
9268
+ * питає лише, чи воно є в базі й чи сервер його пропонує.
9266
9269
  */
9267
- async function plpgsqlCheckInstalled(tx) {
9268
- return (await readPlpgsqlCheckFacts(tx)).installed;
9270
+ async function readPlpgsqlCheckPresence(tx) {
9271
+ const { installed, available } = await readPlpgsqlCheckFacts(tx);
9272
+ return {
9273
+ installed,
9274
+ available
9275
+ };
9269
9276
  }
9270
9277
  /** Режим `plpgsql_check` цієї бази; `installable` — перелік пресету провайдера. */
9271
9278
  async function readPlpgsqlCheckMode(tx, installable) {
@@ -11471,7 +11478,11 @@ async function runAttempt(raw, plan, o, timeouts, applyId, parse, report) {
11471
11478
  const live = await readLiveForeignKeys(tx, plan.foreignKeys.subjects);
11472
11479
  if (canonicalize(live) !== canonicalize(plan.foreignKeys.live)) throw stop("refused", "apply.target-changed", { sections: "foreignKeys" });
11473
11480
  }
11474
- if (o.mode !== "proof" && plan.plpgsqlCheck === "installed" && !await plpgsqlCheckInstalled(tx)) throw stop("refused", "apply.target-changed", { sections: "plpgsqlCheck" });
11481
+ if (o.mode !== "proof" && plan.plpgsqlCheck !== "unavailable") {
11482
+ const presence = await readPlpgsqlCheckPresence(tx);
11483
+ if (!presence.installed && !presence.available) throw stop("refused", "apply.extension-unavailable", { extension: PLPGSQL_CHECK });
11484
+ if (plan.plpgsqlCheck === "installed" && !presence.installed) throw stop("refused", "apply.target-changed", { sections: "plpgsqlCheck" });
11485
+ }
11475
11486
  let identity;
11476
11487
  if (o.mode !== "proof") {
11477
11488
  const copy = o.mode === "rehearse";
@@ -13155,7 +13166,7 @@ function templateState(found) {
13155
13166
  }
13156
13167
  const EXTENSIONS_SCHEMA = "extensions";
13157
13168
  const AUTH_SCHEMA = PROVIDER_IDENTITY_SOURCES.postgres.table.schema;
13158
- const CHECK_EXTENSION = "plpgsql_check";
13169
+ const CHECK_EXTENSION = PLPGSQL_CHECK;
13159
13170
  /**
13160
13171
  * The session timeouts that every transaction or session of the schema engine
13161
13172
  * resets to 0 (off) before its own work: the target database or role may set
@@ -13211,6 +13222,26 @@ async function enterSession(tx) {
13211
13222
  }
13212
13223
  const q$1 = quoteIdent;
13213
13224
  const literal$1 = (value) => `'${value.replaceAll("'", "''")}'`;
13225
+ /**
13226
+ * `ALTER ROLE … PASSWORD` з рядком `E'…'`, де кожен зворотний слеш і лапку
13227
+ * подвоєно: текст той самий за будь-якого `standard_conforming_strings`
13228
+ * (прелюдія його не закріплює, а звичайний рядок зі слешем він тлумачив би
13229
+ * по-різному).
13230
+ * Параметр запиту тут неможливий: `ALTER ROLE` — утиліта без параметрів.
13231
+ */
13232
+ function rolePasswordSql(role, password) {
13233
+ const escaped = password.replaceAll("\\", "\\\\").replaceAll("'", "''");
13234
+ return `ALTER ROLE ${q$1(role)} PASSWORD E'${escaped}'`;
13235
+ }
13236
+ /**
13237
+ * Whether the server offers the extension `name` in `pg_available_extensions`
13238
+ * (its control file is on the server). The view is the same in every database
13239
+ * of the cluster, so the maintenance session reads it.
13240
+ */
13241
+ async function readExtensionAvailable(tx, name) {
13242
+ const [row] = await tx.query(["SELECT EXISTS (SELECT 1 FROM pg_catalog.pg_available_extensions a", " WHERE a.name = $1::text) AS available"].join("\n"), [name]);
13243
+ return row?.available === true;
13244
+ }
13214
13245
  const CREATE_DATABASE_OPTIONS = [
13215
13246
  `TEMPLATE ${q$1("template0")}`,
13216
13247
  `LOCALE_PROVIDER ${DATABASE_LOCALE.provider}`,
@@ -13512,6 +13543,7 @@ async function readPhase(dbs, conns, set, maintenance) {
13512
13543
  };
13513
13544
  }
13514
13545
  }
13546
+ if ((target?.checkInstalled !== true || template.state !== "sealed" && templateFacts?.checkInstalled !== true) && !await readExtensionAvailable(maintenance, CHECK_EXTENSION)) refusal.push(applyDiagnostic("roles.extension-unavailable", "error", { extension: CHECK_EXTENSION }));
13515
13547
  if (refusal.length > 0) return {
13516
13548
  ok: false,
13517
13549
  error: refusal
@@ -13560,11 +13592,12 @@ async function write(dbs, conn, fn) {
13560
13592
  * наступного кроку, що від нього залежить, бо інше з'єднання незакомічених
13561
13593
  * ролей і баз не бачить.
13562
13594
  */
13563
- async function writePhase(dbs, conns, set, snapshot) {
13595
+ async function writePhase(dbs, conns, set, snapshot, passwords) {
13564
13596
  const created = [];
13565
13597
  const present = [];
13566
13598
  const skipped = [];
13567
13599
  const added = [];
13600
+ const passworded = [];
13568
13601
  const planned = plannedRoles(set);
13569
13602
  const missing = planned.filter((r) => !snapshot.roles.has(r.name));
13570
13603
  for (const r of planned) if (snapshot.roles.has(r.name)) present.push(r.name);
@@ -13572,6 +13605,11 @@ async function writePhase(dbs, conns, set, snapshot) {
13572
13605
  await tx.query("SET LOCAL createrole_self_grant = ''");
13573
13606
  for (const r of missing) {
13574
13607
  for (const sql of r.create) await tx.query(sql);
13608
+ const password = passwords.get(r.name);
13609
+ if (password !== void 0) {
13610
+ await tx.query(rolePasswordSql(r.name, password));
13611
+ passworded.push(r.name);
13612
+ }
13575
13613
  created.push(r.name);
13576
13614
  }
13577
13615
  for (const l of set.roles.login) {
@@ -13635,7 +13673,8 @@ async function writePhase(dbs, conns, set, snapshot) {
13635
13673
  created,
13636
13674
  present,
13637
13675
  skipped,
13638
- ...added.length > 0 ? { added } : {}
13676
+ ...added.length > 0 ? { added } : {},
13677
+ ...passworded.length > 0 ? { passwords: passworded } : {}
13639
13678
  };
13640
13679
  }
13641
13680
  /**
@@ -13645,9 +13684,13 @@ async function writePhase(dbs, conns, set, snapshot) {
13645
13684
  * Фаза читання нічого не пише й збирає всі відмови; фаза запису не відмовляє
13646
13685
  * вибірково (окрім повторної перевірки `extensions` перед
13647
13686
  * `CREATE EXTENSION`) і діє за знімком читання. Повторний виклик нічого не
13648
- * створює.
13687
+ * створює. Розширення, якого сервер не пропонує, — відмова фази читання
13688
+ * `roles.extension-unavailable`, а не сира помилка `CREATE EXTENSION`.
13649
13689
  */
13650
- async function ensurePostgresCluster(dbs, conns, set) {
13690
+ async function ensurePostgresCluster(dbs, conns, set, options = {}) {
13691
+ const passwords = options.passwords ?? /* @__PURE__ */ new Map();
13692
+ const logins = new Set(simetraLogins(set).concat(set.owner));
13693
+ for (const role of passwords.keys()) if (!logins.has(role)) throw new Error(`a password is given for ${role}, not a login role of the set`);
13651
13694
  try {
13652
13695
  return await dbs.transaction(conns.maintenance, "rollback", async (maintenance) => {
13653
13696
  const denied = await enterSession(maintenance);
@@ -13665,7 +13708,7 @@ async function ensurePostgresCluster(dbs, conns, set) {
13665
13708
  if (!read.ok) return read;
13666
13709
  return {
13667
13710
  ok: true,
13668
- value: await writePhase(dbs, conns, set, read.snapshot)
13711
+ value: await writePhase(dbs, conns, set, read.snapshot, passwords)
13669
13712
  };
13670
13713
  });
13671
13714
  } catch (error) {
@@ -16503,4 +16546,4 @@ function cloneMismatch(engine, scope, live, copy) {
16503
16546
  if (sections.length > 0) out.push(mismatch("fingerprint", sections.join(", ")));
16504
16547
  return out;
16505
16548
  }
16506
- export { ALL_PRIVILEGES, APPLY_ADVISORY_LOCK, APPLY_STATE_FORMAT, ApplyConnectionLost, ApplyDbError, BACKFILL_SETTINGS, CANONICAL_NAME_KINDS, CLUSTER_ADVISORY_LOCK, CheckNameTaken, DATA_SETTINGS, DATA_TRIGGER_MODES, DEFAULT_APPLY_TIMEOUTS, DEFAULT_PRIVILEGE_OBJTYPES, DRIFT_PERMISSION, DRIFT_REASONS, ENGINE_ACTION_VERBS, ENGINE_PREAMBLE_ALLOWED, ENGINE_SESSION_TIMEOUTS, ENGINE_TRANSACTIONALITIES, FINGERPRINT_SECTIONS, FINGERPRINT_VERSION, FUNCTION_ERROR_LIMIT, FUNCTION_SCOPE_SQL, GUARD_PAIR_SQLSTATES, LOCK_MODE_SQL, PLAN_FORMAT, PLATFORM_VERSION, PLPGSQL_CHECK_MODES, PROVIDER_ASSUMED_SCHEMAS, PROVIDER_BASE_EXTENSIONS, PROVIDER_EVENT_TRIGGERS, PROVIDER_EXPECTED_BLIND_FUNCTIONS, PROVIDER_IDENTITY_TRIGGER_LOCKED, PROVIDER_INSTALLABLE_EXTENSIONS, PROVIDER_LOCKS, PROVIDER_LOCK_STATEMENTS, PROVIDER_PUBLIC_SCHEMA_GRANTS, PROVIDER_SHADOW_TEMPLATES, PROVIDER_SURFACES, PROVIDER_SYSTEM_ROLES, PROVIDER_UNMANAGED_EXTENSIONS, PlpgsqlCheckUnavailable, REHEARSAL_FORMAT, REHEARSAL_PHASES, RETRYABLE_SQLSTATES, STEP_CLASSES, TABLE_LOCK_MODES, UNAPPLIED_FUNCTION_SETTINGS, accessChanges, adoptedReplacements, appliedCatalog, applyStateOf, applyStateOwnership, backfillAction, backfillStepRefusals, backfillTargetKey, backfillTargets, backfillTriggers, backfillWriteTables, buildPlan, canonicalRenames, carrierBackfillSteps, castGuardForms, castProbeQuery, censusDiagnostics, checkGuardCasts, checkOwnerAttributes, checkOwnerMembership, checkPermissions, checkPlatformRoles, classifyRemovals, classifySteps, columnKey, compareFingerprints, comparePermissionItems, compareWithDesired, conditionalToPlain, copiesShadowFromTemplate, countOf, coversMode, createdByPlan, dataComputeSql, dataCountSql, dataFactRefusals, dataGuardSql, dataPlan, dataStepRefusals, dataTableStep, dataWriteSql, defaultsBeforeNotNull, desiredForApply, driftGate, engineScope, ensurePlatformRoles, ensurePostgresCluster, environmentMismatch, environmentSteps, executePlan, findApply, folderReference, footprintSubjects, footprintTables, foreignChanges, foreignSequenceRefusals, functionChangeRefusals, hasIdentityTriggers, identityTableRefusal, identityTriggerLocks, intentStep, isPlatformTrigger, isRetryable, joinModes, lintSteps, lockPrivileges, lockRightsSql, newFunctionErrors, notNullColumns, numberingNotGenerated, ownerRefusal, parsePlan, parseRehearsal, pendingCarrierCopies, planArtifactSchema, planBackfills, planChange, planFileName, planFootprint, planFunctionChecks, planLocks, planPlatformFunctions, platformReplacements, platformRoleGate, platformRoleRefusals, platformRoleSet, plpgsqlCheckInstalled, postgresClusterSet, predefinedSeedSql, predefinedSeedSteps, preservationPlan, preservationQuery, preservationTypeRefusals, preservationTypeStepRefusals, promotionPermissionItems, promotionTransition, propertyReproductions, providerStatement, providerStatements, providerTableNames, providerTriggerConflicts, providerTriggerInBoundarySql, providerTriggerKey, readAccessDependents, readAppliedPromotions, readApplyState, readBackfillCounts, readBlindFunctions, readDataFacts, readEquivalenceObjects, readFingerprint, readGlobalDefaultPrivileges, readLedgerHead, readLiveForeignKeys, readLiveTriggers, readLockRights, readPlatformRoles, readPlpgsqlCheckMode, readPlpgsqlErrors, readProviderLocks, readSeedTargetRows, readServerFacts, readServiceAccess, readSessionSearchPath, readShadowEnvironment, readTypeChangeDependents, readTypePresence, readUserTriggers, readValidatorErrors, readWriteFacts, readWritePath, reconcileCensus, rehearsalFileName, rehearsalHash, rehearsalRefusals, rehearsalReport, rehearsalReportSchema, renameIntent, renderApplyState, renderComments, renderDesiredState, renderEnumType, renderForeignKeys, renderGlobalDefaultPrivileges, renderIndexes, renderProviderSeed, renderRowLevelSecurity, renderTable, requiredPermissions, requiredPlatformRoles, revalidationSettings, reverseGenerate, runRightsMaintenance, sameDefault, seedVerdict, serializePlan, serializeRehearsal, stampPlan, statementSubjects, statementTimeoutFromReport, stepConversions, stepFootprint, tableKey, triggerReplacements, triggerSql, typeChangeRefusals, typeGuards, typeIdentity, unclassifiedRemovals, unmodeledClasses, unrealizedRenames, updateOfNarrowings, valueElementColumns, verifyPlanHash, withLocalSettings, withNotNullChecks, withShownTriggers, withTempNames, withTriggers, writeApplyStateStatements, writeFactRefusals };
16549
+ export { ALL_PRIVILEGES, APPLY_ADVISORY_LOCK, APPLY_STATE_FORMAT, ApplyConnectionLost, ApplyDbError, BACKFILL_SETTINGS, CANONICAL_NAME_KINDS, CLUSTER_ADVISORY_LOCK, CheckNameTaken, DATA_SETTINGS, DATA_TRIGGER_MODES, DEFAULT_APPLY_TIMEOUTS, DEFAULT_PRIVILEGE_OBJTYPES, DRIFT_PERMISSION, DRIFT_REASONS, ENGINE_ACTION_VERBS, ENGINE_PREAMBLE_ALLOWED, ENGINE_SESSION_TIMEOUTS, ENGINE_TRANSACTIONALITIES, FINGERPRINT_SECTIONS, FINGERPRINT_VERSION, FUNCTION_ERROR_LIMIT, FUNCTION_SCOPE_SQL, GUARD_PAIR_SQLSTATES, LOCK_MODE_SQL, PLAN_FORMAT, PLATFORM_VERSION, PLPGSQL_CHECK_MODES, PROVIDER_ASSUMED_SCHEMAS, PROVIDER_BASE_EXTENSIONS, PROVIDER_EVENT_TRIGGERS, PROVIDER_EXPECTED_BLIND_FUNCTIONS, PROVIDER_IDENTITY_TRIGGER_LOCKED, PROVIDER_INSTALLABLE_EXTENSIONS, PROVIDER_LOCKS, PROVIDER_LOCK_STATEMENTS, PROVIDER_PUBLIC_SCHEMA_GRANTS, PROVIDER_SHADOW_TEMPLATES, PROVIDER_SURFACES, PROVIDER_SYSTEM_ROLES, PROVIDER_UNMANAGED_EXTENSIONS, PlpgsqlCheckUnavailable, REHEARSAL_FORMAT, REHEARSAL_PHASES, RETRYABLE_SQLSTATES, STEP_CLASSES, TABLE_LOCK_MODES, UNAPPLIED_FUNCTION_SETTINGS, accessChanges, adoptedReplacements, appliedCatalog, applyStateOf, applyStateOwnership, backfillAction, backfillStepRefusals, backfillTargetKey, backfillTargets, backfillTriggers, backfillWriteTables, buildPlan, canonicalRenames, carrierBackfillSteps, castGuardForms, castProbeQuery, censusDiagnostics, checkGuardCasts, checkOwnerAttributes, checkOwnerMembership, checkPermissions, checkPlatformRoles, classifyRemovals, classifySteps, columnKey, compareFingerprints, comparePermissionItems, compareWithDesired, conditionalToPlain, copiesShadowFromTemplate, countOf, coversMode, createdByPlan, dataComputeSql, dataCountSql, dataFactRefusals, dataGuardSql, dataPlan, dataStepRefusals, dataTableStep, dataWriteSql, defaultsBeforeNotNull, desiredForApply, driftGate, engineScope, ensurePlatformRoles, ensurePostgresCluster, environmentMismatch, environmentSteps, executePlan, findApply, folderReference, footprintSubjects, footprintTables, foreignChanges, foreignSequenceRefusals, functionChangeRefusals, hasIdentityTriggers, identityTableRefusal, identityTriggerLocks, intentStep, isPlatformTrigger, isRetryable, joinModes, lintSteps, lockPrivileges, lockRightsSql, newFunctionErrors, notNullColumns, numberingNotGenerated, ownerRefusal, parsePlan, parseRehearsal, pendingCarrierCopies, planArtifactSchema, planBackfills, planChange, planFileName, planFootprint, planFunctionChecks, planLocks, planPlatformFunctions, platformReplacements, platformRoleGate, platformRoleRefusals, platformRoleSet, postgresClusterSet, predefinedSeedSql, predefinedSeedSteps, preservationPlan, preservationQuery, preservationTypeRefusals, preservationTypeStepRefusals, promotionPermissionItems, promotionTransition, propertyReproductions, providerStatement, providerStatements, providerTableNames, providerTriggerConflicts, providerTriggerInBoundarySql, providerTriggerKey, readAccessDependents, readAppliedPromotions, readApplyState, readBackfillCounts, readBlindFunctions, readDataFacts, readEquivalenceObjects, readFingerprint, readGlobalDefaultPrivileges, readLedgerHead, readLiveForeignKeys, readLiveTriggers, readLockRights, readPlatformRoles, readPlpgsqlCheckMode, readPlpgsqlCheckPresence, readPlpgsqlErrors, readProviderLocks, readSeedTargetRows, readServerFacts, readServiceAccess, readSessionSearchPath, readShadowEnvironment, readTypeChangeDependents, readTypePresence, readUserTriggers, readValidatorErrors, readWriteFacts, readWritePath, reconcileCensus, rehearsalFileName, rehearsalHash, rehearsalRefusals, rehearsalReport, rehearsalReportSchema, renameIntent, renderApplyState, renderComments, renderDesiredState, renderEnumType, renderForeignKeys, renderGlobalDefaultPrivileges, renderIndexes, renderProviderSeed, renderRowLevelSecurity, renderTable, requiredPermissions, requiredPlatformRoles, revalidationSettings, reverseGenerate, runRightsMaintenance, sameDefault, seedVerdict, serializePlan, serializeRehearsal, stampPlan, statementSubjects, statementTimeoutFromReport, stepConversions, stepFootprint, tableKey, triggerReplacements, triggerSql, typeChangeRefusals, typeGuards, typeIdentity, unclassifiedRemovals, unmodeledClasses, unrealizedRenames, updateOfNarrowings, valueElementColumns, verifyPlanHash, withLocalSettings, withNotNullChecks, withShownTriggers, withTempNames, withTriggers, writeApplyStateStatements, writeFactRefusals };
@@ -97,4 +97,16 @@ export declare function entityCardRoute(entity: EntityDescriptor): {
97
97
  * route the one with `simetraList`; the path comes from the app's route tree.
98
98
  */
99
99
  export declare function routerNavigation(router: AnyRouter): NavigationAdapter;
100
+ /**
101
+ * Маркер кінця гідратації (спека «Споживач поза монорепо» §5.5, T6):
102
+ * `<html data-hydrated="true">` ставиться раз, після того як клієнт узяв
103
+ * серверну розмітку під себе. Тест застосунку чекає `html[data-hydrated]`
104
+ * замість таймера; атрибут є й у production-збірці. Корінь застосунку кличе
105
+ * цю функцію в ефекті гідратації.
106
+ */
107
+ export declare function markHydrated(doc: {
108
+ readonly documentElement: {
109
+ setAttribute(name: string, value: string): void;
110
+ };
111
+ }): void;
100
112
  export type { EntityDescriptor, EntityListRouteOptions, SimetraApp, SimetraRouterContext };