@askdb/core 0.5.0-beta.12 → 0.5.0-beta.14

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.
Files changed (63) hide show
  1. package/dist/ask.d.ts +19 -0
  2. package/dist/ask.d.ts.map +1 -1
  3. package/dist/ask.js +32 -2
  4. package/dist/ask.js.map +1 -1
  5. package/dist/errors.d.ts +15 -0
  6. package/dist/errors.d.ts.map +1 -1
  7. package/dist/errors.js +16 -0
  8. package/dist/errors.js.map +1 -1
  9. package/dist/index.d.ts +6 -2
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +5 -1
  12. package/dist/index.js.map +1 -1
  13. package/dist/logging/log-events.d.ts +8 -0
  14. package/dist/logging/log-events.d.ts.map +1 -1
  15. package/dist/logging/log-events.js +8 -0
  16. package/dist/logging/log-events.js.map +1 -1
  17. package/dist/retrieval/synthesize-ddl.d.ts.map +1 -1
  18. package/dist/retrieval/synthesize-ddl.js +12 -0
  19. package/dist/retrieval/synthesize-ddl.js.map +1 -1
  20. package/dist/retrieval/types.d.ts +1 -1
  21. package/dist/retrieval/types.d.ts.map +1 -1
  22. package/dist/schema/v2/index.d.ts +3 -0
  23. package/dist/schema/v2/index.d.ts.map +1 -1
  24. package/dist/schema/v2/index.js +2 -0
  25. package/dist/schema/v2/index.js.map +1 -1
  26. package/dist/schema/v2/loader.d.ts.map +1 -1
  27. package/dist/schema/v2/loader.js +29 -5
  28. package/dist/schema/v2/loader.js.map +1 -1
  29. package/dist/schema/v2/normalized.d.ts +2 -0
  30. package/dist/schema/v2/normalized.d.ts.map +1 -1
  31. package/dist/schema/v2/tenant-policy-loader.d.ts +13 -0
  32. package/dist/schema/v2/tenant-policy-loader.d.ts.map +1 -0
  33. package/dist/schema/v2/tenant-policy-loader.js +282 -0
  34. package/dist/schema/v2/tenant-policy-loader.js.map +1 -0
  35. package/dist/schema/v2/tenant-policy.d.ts +715 -0
  36. package/dist/schema/v2/tenant-policy.d.ts.map +1 -0
  37. package/dist/schema/v2/tenant-policy.js +135 -0
  38. package/dist/schema/v2/tenant-policy.js.map +1 -0
  39. package/dist/sql/generate.d.ts +7 -0
  40. package/dist/sql/generate.d.ts.map +1 -1
  41. package/dist/sql/generate.js +23 -2
  42. package/dist/sql/generate.js.map +1 -1
  43. package/dist/sql/prompt.d.ts +2 -1
  44. package/dist/sql/prompt.d.ts.map +1 -1
  45. package/dist/sql/prompt.js +8 -1
  46. package/dist/sql/prompt.js.map +1 -1
  47. package/dist/sql/tenant-guardrail.d.ts +18 -0
  48. package/dist/sql/tenant-guardrail.d.ts.map +1 -0
  49. package/dist/sql/tenant-guardrail.js +132 -0
  50. package/dist/sql/tenant-guardrail.js.map +1 -0
  51. package/dist/sql/tenant-placeholders.d.ts +37 -0
  52. package/dist/sql/tenant-placeholders.d.ts.map +1 -0
  53. package/dist/sql/tenant-placeholders.js +156 -0
  54. package/dist/sql/tenant-placeholders.js.map +1 -0
  55. package/dist/sql/tenant-prompt.d.ts +8 -0
  56. package/dist/sql/tenant-prompt.d.ts.map +1 -0
  57. package/dist/sql/tenant-prompt.js +127 -0
  58. package/dist/sql/tenant-prompt.js.map +1 -0
  59. package/dist/sql/tenant-scope-validate.d.ts +8 -0
  60. package/dist/sql/tenant-scope-validate.d.ts.map +1 -0
  61. package/dist/sql/tenant-scope-validate.js +46 -0
  62. package/dist/sql/tenant-scope-validate.js.map +1 -0
  63. package/package.json +1 -1
@@ -0,0 +1,715 @@
1
+ import { z } from "zod";
2
+ export declare const tenantRootSchema: z.ZodObject<{
3
+ id: z.ZodString;
4
+ tenantIdColumn: z.ZodString;
5
+ label: z.ZodString;
6
+ parent: z.ZodOptional<z.ZodObject<{
7
+ root: z.ZodString;
8
+ foreignKey: z.ZodString;
9
+ }, "strict", z.ZodTypeAny, {
10
+ root: string;
11
+ foreignKey: string;
12
+ }, {
13
+ root: string;
14
+ foreignKey: string;
15
+ }>>;
16
+ }, "strict", z.ZodTypeAny, {
17
+ id: string;
18
+ label: string;
19
+ tenantIdColumn: string;
20
+ parent?: {
21
+ root: string;
22
+ foreignKey: string;
23
+ } | undefined;
24
+ }, {
25
+ id: string;
26
+ label: string;
27
+ tenantIdColumn: string;
28
+ parent?: {
29
+ root: string;
30
+ foreignKey: string;
31
+ } | undefined;
32
+ }>;
33
+ export declare const hierarchyEdgeSchema: z.ZodObject<{
34
+ parent: z.ZodString;
35
+ child: z.ZodString;
36
+ foreignKey: z.ZodString;
37
+ }, "strict", z.ZodTypeAny, {
38
+ foreignKey: string;
39
+ parent: string;
40
+ child: string;
41
+ }, {
42
+ foreignKey: string;
43
+ parent: string;
44
+ child: string;
45
+ }>;
46
+ declare const scopeThroughSchema: z.ZodUnion<[z.ZodObject<{
47
+ root: z.ZodString;
48
+ column: z.ZodString;
49
+ }, "strict", z.ZodTypeAny, {
50
+ root: string;
51
+ column: string;
52
+ }, {
53
+ root: string;
54
+ column: string;
55
+ }>, z.ZodObject<{
56
+ root: z.ZodString;
57
+ join: z.ZodArray<z.ZodObject<{
58
+ from: z.ZodString;
59
+ to: z.ZodString;
60
+ }, "strict", z.ZodTypeAny, {
61
+ from: string;
62
+ to: string;
63
+ }, {
64
+ from: string;
65
+ to: string;
66
+ }>, "many">;
67
+ }, "strict", z.ZodTypeAny, {
68
+ join: {
69
+ from: string;
70
+ to: string;
71
+ }[];
72
+ root: string;
73
+ }, {
74
+ join: {
75
+ from: string;
76
+ to: string;
77
+ }[];
78
+ root: string;
79
+ }>]>;
80
+ export declare const scopedTableSchema: z.ZodObject<{
81
+ id: z.ZodString;
82
+ scopeThrough: z.ZodArray<z.ZodUnion<[z.ZodObject<{
83
+ root: z.ZodString;
84
+ column: z.ZodString;
85
+ }, "strict", z.ZodTypeAny, {
86
+ root: string;
87
+ column: string;
88
+ }, {
89
+ root: string;
90
+ column: string;
91
+ }>, z.ZodObject<{
92
+ root: z.ZodString;
93
+ join: z.ZodArray<z.ZodObject<{
94
+ from: z.ZodString;
95
+ to: z.ZodString;
96
+ }, "strict", z.ZodTypeAny, {
97
+ from: string;
98
+ to: string;
99
+ }, {
100
+ from: string;
101
+ to: string;
102
+ }>, "many">;
103
+ }, "strict", z.ZodTypeAny, {
104
+ join: {
105
+ from: string;
106
+ to: string;
107
+ }[];
108
+ root: string;
109
+ }, {
110
+ join: {
111
+ from: string;
112
+ to: string;
113
+ }[];
114
+ root: string;
115
+ }>]>, "many">;
116
+ }, "strict", z.ZodTypeAny, {
117
+ id: string;
118
+ scopeThrough: ({
119
+ root: string;
120
+ column: string;
121
+ } | {
122
+ join: {
123
+ from: string;
124
+ to: string;
125
+ }[];
126
+ root: string;
127
+ })[];
128
+ }, {
129
+ id: string;
130
+ scopeThrough: ({
131
+ root: string;
132
+ column: string;
133
+ } | {
134
+ join: {
135
+ from: string;
136
+ to: string;
137
+ }[];
138
+ root: string;
139
+ })[];
140
+ }>;
141
+ export declare const polymorphicTableSchema: z.ZodObject<{
142
+ id: z.ZodString;
143
+ typeColumn: z.ZodString;
144
+ idColumn: z.ZodString;
145
+ mapping: z.ZodRecord<z.ZodString, z.ZodString>;
146
+ }, "strict", z.ZodTypeAny, {
147
+ id: string;
148
+ typeColumn: string;
149
+ idColumn: string;
150
+ mapping: Record<string, string>;
151
+ }, {
152
+ id: string;
153
+ typeColumn: string;
154
+ idColumn: string;
155
+ mapping: Record<string, string>;
156
+ }>;
157
+ export declare const enforcementModeSchema: z.ZodEnum<["strict", "warn"]>;
158
+ export declare const tenantPolicyFrontmatterSchema: z.ZodObject<{
159
+ schemaId: z.ZodString;
160
+ enforcement: z.ZodEnum<["strict", "warn"]>;
161
+ roots: z.ZodArray<z.ZodObject<{
162
+ id: z.ZodString;
163
+ tenantIdColumn: z.ZodString;
164
+ label: z.ZodString;
165
+ parent: z.ZodOptional<z.ZodObject<{
166
+ root: z.ZodString;
167
+ foreignKey: z.ZodString;
168
+ }, "strict", z.ZodTypeAny, {
169
+ root: string;
170
+ foreignKey: string;
171
+ }, {
172
+ root: string;
173
+ foreignKey: string;
174
+ }>>;
175
+ }, "strict", z.ZodTypeAny, {
176
+ id: string;
177
+ label: string;
178
+ tenantIdColumn: string;
179
+ parent?: {
180
+ root: string;
181
+ foreignKey: string;
182
+ } | undefined;
183
+ }, {
184
+ id: string;
185
+ label: string;
186
+ tenantIdColumn: string;
187
+ parent?: {
188
+ root: string;
189
+ foreignKey: string;
190
+ } | undefined;
191
+ }>, "many">;
192
+ hierarchy: z.ZodOptional<z.ZodArray<z.ZodObject<{
193
+ parent: z.ZodString;
194
+ child: z.ZodString;
195
+ foreignKey: z.ZodString;
196
+ }, "strict", z.ZodTypeAny, {
197
+ foreignKey: string;
198
+ parent: string;
199
+ child: string;
200
+ }, {
201
+ foreignKey: string;
202
+ parent: string;
203
+ child: string;
204
+ }>, "many">>;
205
+ scopedTables: z.ZodOptional<z.ZodArray<z.ZodObject<{
206
+ id: z.ZodString;
207
+ scopeThrough: z.ZodArray<z.ZodUnion<[z.ZodObject<{
208
+ root: z.ZodString;
209
+ column: z.ZodString;
210
+ }, "strict", z.ZodTypeAny, {
211
+ root: string;
212
+ column: string;
213
+ }, {
214
+ root: string;
215
+ column: string;
216
+ }>, z.ZodObject<{
217
+ root: z.ZodString;
218
+ join: z.ZodArray<z.ZodObject<{
219
+ from: z.ZodString;
220
+ to: z.ZodString;
221
+ }, "strict", z.ZodTypeAny, {
222
+ from: string;
223
+ to: string;
224
+ }, {
225
+ from: string;
226
+ to: string;
227
+ }>, "many">;
228
+ }, "strict", z.ZodTypeAny, {
229
+ join: {
230
+ from: string;
231
+ to: string;
232
+ }[];
233
+ root: string;
234
+ }, {
235
+ join: {
236
+ from: string;
237
+ to: string;
238
+ }[];
239
+ root: string;
240
+ }>]>, "many">;
241
+ }, "strict", z.ZodTypeAny, {
242
+ id: string;
243
+ scopeThrough: ({
244
+ root: string;
245
+ column: string;
246
+ } | {
247
+ join: {
248
+ from: string;
249
+ to: string;
250
+ }[];
251
+ root: string;
252
+ })[];
253
+ }, {
254
+ id: string;
255
+ scopeThrough: ({
256
+ root: string;
257
+ column: string;
258
+ } | {
259
+ join: {
260
+ from: string;
261
+ to: string;
262
+ }[];
263
+ root: string;
264
+ })[];
265
+ }>, "many">>;
266
+ polymorphicTables: z.ZodOptional<z.ZodArray<z.ZodObject<{
267
+ id: z.ZodString;
268
+ typeColumn: z.ZodString;
269
+ idColumn: z.ZodString;
270
+ mapping: z.ZodRecord<z.ZodString, z.ZodString>;
271
+ }, "strict", z.ZodTypeAny, {
272
+ id: string;
273
+ typeColumn: string;
274
+ idColumn: string;
275
+ mapping: Record<string, string>;
276
+ }, {
277
+ id: string;
278
+ typeColumn: string;
279
+ idColumn: string;
280
+ mapping: Record<string, string>;
281
+ }>, "many">>;
282
+ globalTables: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
283
+ }, "strict", z.ZodTypeAny, {
284
+ schemaId: string;
285
+ enforcement: "strict" | "warn";
286
+ roots: {
287
+ id: string;
288
+ label: string;
289
+ tenantIdColumn: string;
290
+ parent?: {
291
+ root: string;
292
+ foreignKey: string;
293
+ } | undefined;
294
+ }[];
295
+ hierarchy?: {
296
+ foreignKey: string;
297
+ parent: string;
298
+ child: string;
299
+ }[] | undefined;
300
+ scopedTables?: {
301
+ id: string;
302
+ scopeThrough: ({
303
+ root: string;
304
+ column: string;
305
+ } | {
306
+ join: {
307
+ from: string;
308
+ to: string;
309
+ }[];
310
+ root: string;
311
+ })[];
312
+ }[] | undefined;
313
+ polymorphicTables?: {
314
+ id: string;
315
+ typeColumn: string;
316
+ idColumn: string;
317
+ mapping: Record<string, string>;
318
+ }[] | undefined;
319
+ globalTables?: string[] | undefined;
320
+ }, {
321
+ schemaId: string;
322
+ enforcement: "strict" | "warn";
323
+ roots: {
324
+ id: string;
325
+ label: string;
326
+ tenantIdColumn: string;
327
+ parent?: {
328
+ root: string;
329
+ foreignKey: string;
330
+ } | undefined;
331
+ }[];
332
+ hierarchy?: {
333
+ foreignKey: string;
334
+ parent: string;
335
+ child: string;
336
+ }[] | undefined;
337
+ scopedTables?: {
338
+ id: string;
339
+ scopeThrough: ({
340
+ root: string;
341
+ column: string;
342
+ } | {
343
+ join: {
344
+ from: string;
345
+ to: string;
346
+ }[];
347
+ root: string;
348
+ })[];
349
+ }[] | undefined;
350
+ polymorphicTables?: {
351
+ id: string;
352
+ typeColumn: string;
353
+ idColumn: string;
354
+ mapping: Record<string, string>;
355
+ }[] | undefined;
356
+ globalTables?: string[] | undefined;
357
+ }>;
358
+ export type TenantRoot = z.infer<typeof tenantRootSchema>;
359
+ export type HierarchyEdge = z.infer<typeof hierarchyEdgeSchema>;
360
+ export type ScopeThrough = z.infer<typeof scopeThroughSchema>;
361
+ export type ScopedTable = z.infer<typeof scopedTableSchema>;
362
+ export type PolymorphicTable = z.infer<typeof polymorphicTableSchema>;
363
+ export type EnforcementMode = z.infer<typeof enforcementModeSchema>;
364
+ export type TenantPolicyFrontmatter = z.infer<typeof tenantPolicyFrontmatterSchema>;
365
+ export declare const TENANT_POLICY_H2_SECTIONS: readonly ["Hierarchy", "Scope rules", "Sensitive interactions"];
366
+ export type TenantPolicyH2Section = (typeof TENANT_POLICY_H2_SECTIONS)[number];
367
+ export type ParsedTenantPolicyMarkdown = {
368
+ frontmatter: TenantPolicyFrontmatter;
369
+ body: string;
370
+ sections: Partial<Record<TenantPolicyH2Section, string>>;
371
+ };
372
+ export type TenantAccessIds = {
373
+ kind: "ids";
374
+ tenantRoot: string;
375
+ ids: string[];
376
+ };
377
+ export type TenantAccessSubtree = {
378
+ kind: "subtree";
379
+ tenantRoot: string;
380
+ rootIds: string[];
381
+ includeDescendants: true;
382
+ };
383
+ export type TenantAccessMultiRoot = {
384
+ kind: "multi_root";
385
+ scopes: Array<{
386
+ tenantRoot: string;
387
+ ids: string[];
388
+ }>;
389
+ };
390
+ export type TenantAccessGlobal = {
391
+ kind: "global";
392
+ reason: string;
393
+ };
394
+ export type TenantAccess = TenantAccessIds | TenantAccessSubtree | TenantAccessMultiRoot | TenantAccessGlobal;
395
+ export type TenantFilterCondition = {
396
+ column: string;
397
+ operator: "=" | "IN" | "!=" | "NOT IN";
398
+ value: string | string[];
399
+ };
400
+ export type TenantFilter = {
401
+ conditions: TenantFilterCondition[];
402
+ };
403
+ export type TenantScopeContext = {
404
+ role?: string;
405
+ label?: string;
406
+ department?: string;
407
+ region?: string;
408
+ attributes?: Record<string, string>;
409
+ description?: string;
410
+ };
411
+ export type TenantScope = {
412
+ access: TenantAccess;
413
+ tenantFilters?: Record<string, TenantFilter>;
414
+ context?: TenantScopeContext;
415
+ };
416
+ export declare const tenantAccessSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
417
+ kind: z.ZodLiteral<"ids">;
418
+ tenantRoot: z.ZodString;
419
+ ids: z.ZodArray<z.ZodString, "many">;
420
+ }, "strip", z.ZodTypeAny, {
421
+ ids: string[];
422
+ kind: "ids";
423
+ tenantRoot: string;
424
+ }, {
425
+ ids: string[];
426
+ kind: "ids";
427
+ tenantRoot: string;
428
+ }>, z.ZodObject<{
429
+ kind: z.ZodLiteral<"subtree">;
430
+ tenantRoot: z.ZodString;
431
+ rootIds: z.ZodArray<z.ZodString, "many">;
432
+ includeDescendants: z.ZodLiteral<true>;
433
+ }, "strip", z.ZodTypeAny, {
434
+ kind: "subtree";
435
+ tenantRoot: string;
436
+ rootIds: string[];
437
+ includeDescendants: true;
438
+ }, {
439
+ kind: "subtree";
440
+ tenantRoot: string;
441
+ rootIds: string[];
442
+ includeDescendants: true;
443
+ }>, z.ZodObject<{
444
+ kind: z.ZodLiteral<"multi_root">;
445
+ scopes: z.ZodArray<z.ZodObject<{
446
+ tenantRoot: z.ZodString;
447
+ ids: z.ZodArray<z.ZodString, "many">;
448
+ }, "strip", z.ZodTypeAny, {
449
+ ids: string[];
450
+ tenantRoot: string;
451
+ }, {
452
+ ids: string[];
453
+ tenantRoot: string;
454
+ }>, "many">;
455
+ }, "strip", z.ZodTypeAny, {
456
+ kind: "multi_root";
457
+ scopes: {
458
+ ids: string[];
459
+ tenantRoot: string;
460
+ }[];
461
+ }, {
462
+ kind: "multi_root";
463
+ scopes: {
464
+ ids: string[];
465
+ tenantRoot: string;
466
+ }[];
467
+ }>, z.ZodObject<{
468
+ kind: z.ZodLiteral<"global">;
469
+ reason: z.ZodString;
470
+ }, "strip", z.ZodTypeAny, {
471
+ kind: "global";
472
+ reason: string;
473
+ }, {
474
+ kind: "global";
475
+ reason: string;
476
+ }>]>;
477
+ export declare const tenantScopeSchema: z.ZodObject<{
478
+ access: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
479
+ kind: z.ZodLiteral<"ids">;
480
+ tenantRoot: z.ZodString;
481
+ ids: z.ZodArray<z.ZodString, "many">;
482
+ }, "strip", z.ZodTypeAny, {
483
+ ids: string[];
484
+ kind: "ids";
485
+ tenantRoot: string;
486
+ }, {
487
+ ids: string[];
488
+ kind: "ids";
489
+ tenantRoot: string;
490
+ }>, z.ZodObject<{
491
+ kind: z.ZodLiteral<"subtree">;
492
+ tenantRoot: z.ZodString;
493
+ rootIds: z.ZodArray<z.ZodString, "many">;
494
+ includeDescendants: z.ZodLiteral<true>;
495
+ }, "strip", z.ZodTypeAny, {
496
+ kind: "subtree";
497
+ tenantRoot: string;
498
+ rootIds: string[];
499
+ includeDescendants: true;
500
+ }, {
501
+ kind: "subtree";
502
+ tenantRoot: string;
503
+ rootIds: string[];
504
+ includeDescendants: true;
505
+ }>, z.ZodObject<{
506
+ kind: z.ZodLiteral<"multi_root">;
507
+ scopes: z.ZodArray<z.ZodObject<{
508
+ tenantRoot: z.ZodString;
509
+ ids: z.ZodArray<z.ZodString, "many">;
510
+ }, "strip", z.ZodTypeAny, {
511
+ ids: string[];
512
+ tenantRoot: string;
513
+ }, {
514
+ ids: string[];
515
+ tenantRoot: string;
516
+ }>, "many">;
517
+ }, "strip", z.ZodTypeAny, {
518
+ kind: "multi_root";
519
+ scopes: {
520
+ ids: string[];
521
+ tenantRoot: string;
522
+ }[];
523
+ }, {
524
+ kind: "multi_root";
525
+ scopes: {
526
+ ids: string[];
527
+ tenantRoot: string;
528
+ }[];
529
+ }>, z.ZodObject<{
530
+ kind: z.ZodLiteral<"global">;
531
+ reason: z.ZodString;
532
+ }, "strip", z.ZodTypeAny, {
533
+ kind: "global";
534
+ reason: string;
535
+ }, {
536
+ kind: "global";
537
+ reason: string;
538
+ }>]>;
539
+ tenantFilters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
540
+ conditions: z.ZodArray<z.ZodObject<{
541
+ column: z.ZodString;
542
+ operator: z.ZodEnum<["=", "IN", "!=", "NOT IN"]>;
543
+ value: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
544
+ }, "strip", z.ZodTypeAny, {
545
+ value: string | string[];
546
+ column: string;
547
+ operator: "=" | "IN" | "!=" | "NOT IN";
548
+ }, {
549
+ value: string | string[];
550
+ column: string;
551
+ operator: "=" | "IN" | "!=" | "NOT IN";
552
+ }>, "many">;
553
+ }, "strip", z.ZodTypeAny, {
554
+ conditions: {
555
+ value: string | string[];
556
+ column: string;
557
+ operator: "=" | "IN" | "!=" | "NOT IN";
558
+ }[];
559
+ }, {
560
+ conditions: {
561
+ value: string | string[];
562
+ column: string;
563
+ operator: "=" | "IN" | "!=" | "NOT IN";
564
+ }[];
565
+ }>>>;
566
+ context: z.ZodOptional<z.ZodObject<{
567
+ role: z.ZodOptional<z.ZodString>;
568
+ label: z.ZodOptional<z.ZodString>;
569
+ department: z.ZodOptional<z.ZodString>;
570
+ region: z.ZodOptional<z.ZodString>;
571
+ attributes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
572
+ description: z.ZodOptional<z.ZodString>;
573
+ }, "strict", z.ZodTypeAny, {
574
+ description?: string | undefined;
575
+ label?: string | undefined;
576
+ role?: string | undefined;
577
+ department?: string | undefined;
578
+ region?: string | undefined;
579
+ attributes?: Record<string, string> | undefined;
580
+ }, {
581
+ description?: string | undefined;
582
+ label?: string | undefined;
583
+ role?: string | undefined;
584
+ department?: string | undefined;
585
+ region?: string | undefined;
586
+ attributes?: Record<string, string> | undefined;
587
+ }>>;
588
+ }, "strip", z.ZodTypeAny, {
589
+ access: {
590
+ ids: string[];
591
+ kind: "ids";
592
+ tenantRoot: string;
593
+ } | {
594
+ kind: "subtree";
595
+ tenantRoot: string;
596
+ rootIds: string[];
597
+ includeDescendants: true;
598
+ } | {
599
+ kind: "multi_root";
600
+ scopes: {
601
+ ids: string[];
602
+ tenantRoot: string;
603
+ }[];
604
+ } | {
605
+ kind: "global";
606
+ reason: string;
607
+ };
608
+ tenantFilters?: Record<string, {
609
+ conditions: {
610
+ value: string | string[];
611
+ column: string;
612
+ operator: "=" | "IN" | "!=" | "NOT IN";
613
+ }[];
614
+ }> | undefined;
615
+ context?: {
616
+ description?: string | undefined;
617
+ label?: string | undefined;
618
+ role?: string | undefined;
619
+ department?: string | undefined;
620
+ region?: string | undefined;
621
+ attributes?: Record<string, string> | undefined;
622
+ } | undefined;
623
+ }, {
624
+ access: {
625
+ ids: string[];
626
+ kind: "ids";
627
+ tenantRoot: string;
628
+ } | {
629
+ kind: "subtree";
630
+ tenantRoot: string;
631
+ rootIds: string[];
632
+ includeDescendants: true;
633
+ } | {
634
+ kind: "multi_root";
635
+ scopes: {
636
+ ids: string[];
637
+ tenantRoot: string;
638
+ }[];
639
+ } | {
640
+ kind: "global";
641
+ reason: string;
642
+ };
643
+ tenantFilters?: Record<string, {
644
+ conditions: {
645
+ value: string | string[];
646
+ column: string;
647
+ operator: "=" | "IN" | "!=" | "NOT IN";
648
+ }[];
649
+ }> | undefined;
650
+ context?: {
651
+ description?: string | undefined;
652
+ label?: string | undefined;
653
+ role?: string | undefined;
654
+ department?: string | undefined;
655
+ region?: string | undefined;
656
+ attributes?: Record<string, string> | undefined;
657
+ } | undefined;
658
+ }>;
659
+ export type TableTenantClassification = "scoped" | "inherited" | "polymorphic" | "global" | "root" | "unknown";
660
+ export type TableCoverageEntry = {
661
+ tableId: string;
662
+ classification: TableTenantClassification;
663
+ scopeRoots?: string[];
664
+ };
665
+ export type TenantPolicyWarning = {
666
+ kind: "orphaned_root_id";
667
+ id: string;
668
+ } | {
669
+ kind: "orphaned_column_id";
670
+ id: string;
671
+ context: string;
672
+ } | {
673
+ kind: "orphaned_scoped_table_id";
674
+ id: string;
675
+ } | {
676
+ kind: "orphaned_polymorphic_table_id";
677
+ id: string;
678
+ } | {
679
+ kind: "orphaned_global_table_id";
680
+ id: string;
681
+ } | {
682
+ kind: "orphaned_fk_id";
683
+ id: string;
684
+ context: string;
685
+ } | {
686
+ kind: "hierarchy_cycle";
687
+ ids: string[];
688
+ } | {
689
+ kind: "unknown_root_in_scope";
690
+ id: string;
691
+ context: string;
692
+ } | {
693
+ kind: "unknown_root_in_hierarchy";
694
+ id: string;
695
+ context: string;
696
+ } | {
697
+ kind: "unknown_root_in_mapping";
698
+ id: string;
699
+ context: string;
700
+ };
701
+ export type NormalizedTenantPolicy = {
702
+ schemaId: string;
703
+ enforcement: EnforcementMode;
704
+ roots: TenantRoot[];
705
+ hierarchy: HierarchyEdge[];
706
+ scopedTables: ScopedTable[];
707
+ polymorphicTables: PolymorphicTable[];
708
+ globalTables: string[];
709
+ coverage: TableCoverageEntry[];
710
+ warnings: TenantPolicyWarning[];
711
+ body: string;
712
+ sections: Partial<Record<TenantPolicyH2Section, string>>;
713
+ };
714
+ export {};
715
+ //# sourceMappingURL=tenant-policy.d.ts.map