@kubun/protocol 0.1.0 → 0.2.1

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.
@@ -1,17 +1,1318 @@
1
+ import { type FromSchema } from '@enkaku/schema';
2
+ import { DocumentModelID } from '@kubun/id';
1
3
  import type { JSONSchema } from 'json-schema-typed';
2
- import type { DocumentModel, DocumentModelsCluster } from './document.js';
3
- type SetDocumentModel = Omit<DocumentModel, 'schema'> & {
4
+ import { type DocumentFieldsMeta, type DocumentModel, type DocumentModelsCluster, type DocumentModelsRecord } from './document.js';
5
+ export type DocumentModelBehavior = 'default' | 'interface' | 'unique';
6
+ export type SetDocumentModel = Omit<DocumentModel, 'version' | 'behavior' | 'interfaces' | 'schema' | 'fieldsMeta'> & {
7
+ version?: string;
8
+ behavior?: DocumentModelBehavior;
9
+ uniqueFields?: Array<string>;
10
+ interfaces?: Array<string>;
4
11
  schema: JSONSchema.Object;
12
+ fieldsMeta?: DocumentFieldsMeta;
5
13
  };
6
14
  type JSONSchemaScalar = JSONSchema.Boolean | JSONSchema.Integer | JSONSchema.Number | JSONSchema.String;
7
15
  type JSONSchemaShape = JSONSchema.Array | JSONSchema.Object;
8
16
  type JSONSchemaType = JSONSchemaScalar | JSONSchemaShape;
9
17
  export type JSONSchemaReferencesRecord = Record<string, JSONSchemaType>;
10
18
  export declare const REFERENCE_PREFIX = "#/$defs/";
19
+ export declare const validateDocumentModel: import("@enkaku/schema").Validator<{
20
+ name: string;
21
+ version: "1.0";
22
+ schema: {
23
+ type: "object";
24
+ required: string[];
25
+ properties: {
26
+ [x: string]: {
27
+ $ref: string;
28
+ };
29
+ };
30
+ additionalProperties: boolean;
31
+ $defs: {
32
+ [x: string]: {
33
+ default?: boolean | undefined;
34
+ type: "boolean";
35
+ } | {
36
+ maximum?: number | undefined;
37
+ minimum?: number | undefined;
38
+ default?: number | undefined;
39
+ type: "integer";
40
+ } | {
41
+ default?: number | undefined;
42
+ min?: number | undefined;
43
+ max?: number | undefined;
44
+ type: "number";
45
+ } | {
46
+ maxLength?: number | undefined;
47
+ minLength?: number | undefined;
48
+ pattern?: string | undefined;
49
+ title?: string | undefined;
50
+ default?: string | undefined;
51
+ type: "string";
52
+ } | {
53
+ default?: string | undefined;
54
+ type: "string";
55
+ enum: string[];
56
+ title: string;
57
+ } | {
58
+ type: "string";
59
+ format: "date" | "date-time" | "duration" | "time" | "uri";
60
+ } | {
61
+ maxItems?: number | undefined;
62
+ minItems?: number | undefined;
63
+ uniqueItems?: boolean | undefined;
64
+ type: "array";
65
+ items: {
66
+ $ref: string;
67
+ };
68
+ title: string;
69
+ } | {
70
+ type: "object";
71
+ required: string[];
72
+ properties: {
73
+ [x: string]: {
74
+ $ref: string;
75
+ };
76
+ };
77
+ additionalProperties: boolean;
78
+ title: string;
79
+ };
80
+ };
81
+ };
82
+ fieldsMeta: {
83
+ [x: string]: {
84
+ relationModel?: string | null | undefined;
85
+ };
86
+ };
87
+ interfaces: string[];
88
+ behavior: "default";
89
+ } | {
90
+ name: string;
91
+ version: "1.0";
92
+ schema: {
93
+ type: "object";
94
+ required: string[];
95
+ properties: {
96
+ [x: string]: {
97
+ $ref: string;
98
+ };
99
+ };
100
+ additionalProperties: boolean;
101
+ $defs: {
102
+ [x: string]: {
103
+ default?: boolean | undefined;
104
+ type: "boolean";
105
+ } | {
106
+ maximum?: number | undefined;
107
+ minimum?: number | undefined;
108
+ default?: number | undefined;
109
+ type: "integer";
110
+ } | {
111
+ default?: number | undefined;
112
+ min?: number | undefined;
113
+ max?: number | undefined;
114
+ type: "number";
115
+ } | {
116
+ maxLength?: number | undefined;
117
+ minLength?: number | undefined;
118
+ pattern?: string | undefined;
119
+ title?: string | undefined;
120
+ default?: string | undefined;
121
+ type: "string";
122
+ } | {
123
+ default?: string | undefined;
124
+ type: "string";
125
+ enum: string[];
126
+ title: string;
127
+ } | {
128
+ type: "string";
129
+ format: "date" | "date-time" | "duration" | "time" | "uri";
130
+ } | {
131
+ maxItems?: number | undefined;
132
+ minItems?: number | undefined;
133
+ uniqueItems?: boolean | undefined;
134
+ type: "array";
135
+ items: {
136
+ $ref: string;
137
+ };
138
+ title: string;
139
+ } | {
140
+ type: "object";
141
+ required: string[];
142
+ properties: {
143
+ [x: string]: {
144
+ $ref: string;
145
+ };
146
+ };
147
+ additionalProperties: boolean;
148
+ title: string;
149
+ };
150
+ };
151
+ };
152
+ fieldsMeta: {
153
+ [x: string]: {
154
+ relationModel?: string | null | undefined;
155
+ };
156
+ };
157
+ interfaces: string[];
158
+ behavior: "interface";
159
+ } | {
160
+ name: string;
161
+ version: "1.0";
162
+ schema: {
163
+ type: "object";
164
+ required: string[];
165
+ properties: {
166
+ [x: string]: {
167
+ $ref: string;
168
+ };
169
+ };
170
+ additionalProperties: boolean;
171
+ $defs: {
172
+ [x: string]: {
173
+ default?: boolean | undefined;
174
+ type: "boolean";
175
+ } | {
176
+ maximum?: number | undefined;
177
+ minimum?: number | undefined;
178
+ default?: number | undefined;
179
+ type: "integer";
180
+ } | {
181
+ default?: number | undefined;
182
+ min?: number | undefined;
183
+ max?: number | undefined;
184
+ type: "number";
185
+ } | {
186
+ maxLength?: number | undefined;
187
+ minLength?: number | undefined;
188
+ pattern?: string | undefined;
189
+ title?: string | undefined;
190
+ default?: string | undefined;
191
+ type: "string";
192
+ } | {
193
+ default?: string | undefined;
194
+ type: "string";
195
+ enum: string[];
196
+ title: string;
197
+ } | {
198
+ type: "string";
199
+ format: "date" | "date-time" | "duration" | "time" | "uri";
200
+ } | {
201
+ maxItems?: number | undefined;
202
+ minItems?: number | undefined;
203
+ uniqueItems?: boolean | undefined;
204
+ type: "array";
205
+ items: {
206
+ $ref: string;
207
+ };
208
+ title: string;
209
+ } | {
210
+ type: "object";
211
+ required: string[];
212
+ properties: {
213
+ [x: string]: {
214
+ $ref: string;
215
+ };
216
+ };
217
+ additionalProperties: boolean;
218
+ title: string;
219
+ };
220
+ };
221
+ };
222
+ fieldsMeta: {
223
+ [x: string]: {
224
+ relationModel?: string | null | undefined;
225
+ };
226
+ };
227
+ interfaces: string[];
228
+ behavior: "unique";
229
+ uniqueFields: string[];
230
+ }>;
231
+ export declare const clusterModel: {
232
+ readonly $id: "urn:kubun:protocol:model:cluster";
233
+ readonly type: "object";
234
+ readonly properties: {
235
+ readonly digest: {
236
+ readonly title: "KubunBinaryValue";
237
+ readonly type: "string";
238
+ readonly pattern: "^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$";
239
+ };
240
+ readonly models: {
241
+ readonly type: "array";
242
+ readonly items: {
243
+ readonly $id: "urn:kubun:protocol:model:document";
244
+ readonly anyOf: readonly [{
245
+ readonly type: "object";
246
+ readonly properties: {
247
+ readonly behavior: {
248
+ readonly type: "string";
249
+ readonly const: "default";
250
+ };
251
+ readonly name: {
252
+ readonly type: "string";
253
+ readonly pattern: "^[A-Z]+[A-Za-z0-9]+$";
254
+ };
255
+ readonly version: {
256
+ readonly type: "string";
257
+ readonly const: "1.0";
258
+ };
259
+ readonly interfaces: {
260
+ readonly type: "array";
261
+ readonly items: {
262
+ readonly type: "string";
263
+ };
264
+ };
265
+ readonly schema: {
266
+ readonly type: "object";
267
+ readonly properties: {
268
+ readonly $defs: {
269
+ readonly type: "object";
270
+ readonly additionalProperties: {
271
+ readonly anyOf: readonly [{
272
+ readonly anyOf: readonly [{
273
+ readonly type: "object";
274
+ readonly properties: {
275
+ readonly type: {
276
+ readonly type: "string";
277
+ readonly const: "boolean";
278
+ };
279
+ readonly default: {
280
+ readonly type: "boolean";
281
+ };
282
+ };
283
+ readonly required: readonly ["type"];
284
+ readonly additionalProperties: false;
285
+ }, {
286
+ readonly type: "object";
287
+ readonly properties: {
288
+ readonly type: {
289
+ readonly type: "string";
290
+ readonly const: "integer";
291
+ };
292
+ readonly default: {
293
+ readonly type: "integer";
294
+ };
295
+ readonly minimum: {
296
+ readonly type: "integer";
297
+ };
298
+ readonly maximum: {
299
+ readonly type: "integer";
300
+ };
301
+ };
302
+ readonly required: readonly ["type"];
303
+ readonly additionalProperties: false;
304
+ }, {
305
+ readonly type: "object";
306
+ readonly properties: {
307
+ readonly type: {
308
+ readonly type: "string";
309
+ readonly const: "number";
310
+ };
311
+ readonly default: {
312
+ readonly type: "number";
313
+ };
314
+ readonly min: {
315
+ readonly type: "number";
316
+ };
317
+ readonly max: {
318
+ readonly type: "number";
319
+ };
320
+ };
321
+ readonly required: readonly ["type"];
322
+ readonly additionalProperties: false;
323
+ }, {
324
+ readonly anyOf: readonly [{
325
+ readonly type: "object";
326
+ readonly properties: {
327
+ readonly type: {
328
+ readonly type: "string";
329
+ readonly const: "string";
330
+ };
331
+ readonly title: {
332
+ readonly type: "string";
333
+ };
334
+ readonly pattern: {
335
+ readonly type: "string";
336
+ };
337
+ readonly default: {
338
+ readonly type: "string";
339
+ };
340
+ readonly minLength: {
341
+ readonly type: "integer";
342
+ };
343
+ readonly maxLength: {
344
+ readonly type: "integer";
345
+ };
346
+ };
347
+ readonly required: readonly ["type"];
348
+ readonly additionalProperties: false;
349
+ }, {
350
+ readonly type: "object";
351
+ readonly properties: {
352
+ readonly type: {
353
+ readonly type: "string";
354
+ readonly const: "string";
355
+ };
356
+ readonly title: {
357
+ readonly type: "string";
358
+ };
359
+ readonly enum: {
360
+ readonly type: "array";
361
+ readonly items: {
362
+ readonly type: "string";
363
+ readonly pattern: "^[A-Z]+[A-Z_]+[A-Z]$";
364
+ };
365
+ };
366
+ readonly default: {
367
+ readonly type: "string";
368
+ readonly pattern: "^[A-Z]+[A-Z_]+[A-Z]$";
369
+ };
370
+ };
371
+ readonly required: readonly ["type", "title", "enum"];
372
+ readonly additionalProperties: false;
373
+ }, {
374
+ readonly type: "object";
375
+ readonly properties: {
376
+ readonly type: {
377
+ readonly type: "string";
378
+ readonly const: "string";
379
+ };
380
+ readonly format: {
381
+ readonly type: "string";
382
+ readonly enum: readonly ["date", "date-time", "duration", "time", "uri"];
383
+ };
384
+ };
385
+ readonly required: readonly ["type", "format"];
386
+ readonly additionalProperties: false;
387
+ }];
388
+ }];
389
+ }, {
390
+ readonly anyOf: readonly [{
391
+ readonly type: "object";
392
+ readonly properties: {
393
+ readonly type: {
394
+ readonly type: "string";
395
+ readonly const: "array";
396
+ };
397
+ readonly title: {
398
+ readonly type: "string";
399
+ readonly pattern: "^[A-Z]+[A-Za-z0-9]+$";
400
+ };
401
+ readonly items: {
402
+ readonly type: "object";
403
+ readonly properties: {
404
+ readonly $ref: {
405
+ readonly type: "string";
406
+ };
407
+ };
408
+ readonly required: readonly ["$ref"];
409
+ readonly additionalProperties: false;
410
+ };
411
+ readonly uniqueItems: {
412
+ readonly type: "boolean";
413
+ };
414
+ readonly minItems: {
415
+ readonly type: "integer";
416
+ };
417
+ readonly maxItems: {
418
+ readonly type: "integer";
419
+ };
420
+ };
421
+ readonly required: readonly ["type", "title", "items"];
422
+ readonly additionalProperties: false;
423
+ }, {
424
+ readonly type: "object";
425
+ readonly properties: {
426
+ readonly title: {
427
+ readonly type: "string";
428
+ readonly pattern: "^[A-Z]+[A-Za-z0-9]+$";
429
+ };
430
+ readonly type: {
431
+ readonly type: "string";
432
+ readonly const: "object";
433
+ };
434
+ readonly properties: {
435
+ readonly type: "object";
436
+ readonly patternProperties: {
437
+ readonly '^[a-z]+[A-Za-z0-9]+$': {
438
+ readonly type: "object";
439
+ readonly properties: {
440
+ readonly $ref: {
441
+ readonly type: "string";
442
+ };
443
+ };
444
+ readonly required: readonly ["$ref"];
445
+ readonly additionalProperties: false;
446
+ };
447
+ };
448
+ readonly additionalProperties: false;
449
+ };
450
+ readonly required: {
451
+ readonly type: "array";
452
+ readonly items: {
453
+ readonly type: "string";
454
+ };
455
+ };
456
+ readonly additionalProperties: {
457
+ readonly type: "boolean";
458
+ };
459
+ };
460
+ readonly required: readonly ["type", "properties", "required", "additionalProperties", "title"];
461
+ readonly additionalProperties: false;
462
+ }];
463
+ }];
464
+ };
465
+ };
466
+ readonly type: {
467
+ readonly type: "string";
468
+ readonly const: "object";
469
+ };
470
+ readonly properties: {
471
+ readonly type: "object";
472
+ readonly patternProperties: {
473
+ readonly '^[a-z]+[A-Za-z0-9]+$': {
474
+ readonly type: "object";
475
+ readonly properties: {
476
+ readonly $ref: {
477
+ readonly type: "string";
478
+ };
479
+ };
480
+ readonly required: readonly ["$ref"];
481
+ readonly additionalProperties: false;
482
+ };
483
+ };
484
+ readonly additionalProperties: false;
485
+ };
486
+ readonly required: {
487
+ readonly type: "array";
488
+ readonly items: {
489
+ readonly type: "string";
490
+ };
491
+ };
492
+ readonly additionalProperties: {
493
+ readonly type: "boolean";
494
+ };
495
+ };
496
+ readonly required: readonly ["type", "properties", "required", "additionalProperties", "$defs"];
497
+ readonly additionalProperties: false;
498
+ };
499
+ readonly fieldsMeta: {
500
+ readonly type: "object";
501
+ readonly additionalProperties: {
502
+ readonly type: "object";
503
+ readonly properties: {
504
+ readonly relationModel: {
505
+ readonly anyOf: readonly [{
506
+ readonly type: "string";
507
+ }, {
508
+ readonly type: "null";
509
+ }];
510
+ };
511
+ };
512
+ readonly additionalProperties: false;
513
+ };
514
+ };
515
+ };
516
+ readonly required: readonly ["name", "version", "interfaces", "schema", "fieldsMeta", "behavior"];
517
+ readonly additionalProperties: false;
518
+ }, {
519
+ readonly type: "object";
520
+ readonly properties: {
521
+ readonly behavior: {
522
+ readonly type: "string";
523
+ readonly const: "interface";
524
+ };
525
+ readonly name: {
526
+ readonly type: "string";
527
+ readonly pattern: "^[A-Z]+[A-Za-z0-9]+$";
528
+ };
529
+ readonly version: {
530
+ readonly type: "string";
531
+ readonly const: "1.0";
532
+ };
533
+ readonly interfaces: {
534
+ readonly type: "array";
535
+ readonly items: {
536
+ readonly type: "string";
537
+ };
538
+ };
539
+ readonly schema: {
540
+ readonly type: "object";
541
+ readonly properties: {
542
+ readonly $defs: {
543
+ readonly type: "object";
544
+ readonly additionalProperties: {
545
+ readonly anyOf: readonly [{
546
+ readonly anyOf: readonly [{
547
+ readonly type: "object";
548
+ readonly properties: {
549
+ readonly type: {
550
+ readonly type: "string";
551
+ readonly const: "boolean";
552
+ };
553
+ readonly default: {
554
+ readonly type: "boolean";
555
+ };
556
+ };
557
+ readonly required: readonly ["type"];
558
+ readonly additionalProperties: false;
559
+ }, {
560
+ readonly type: "object";
561
+ readonly properties: {
562
+ readonly type: {
563
+ readonly type: "string";
564
+ readonly const: "integer";
565
+ };
566
+ readonly default: {
567
+ readonly type: "integer";
568
+ };
569
+ readonly minimum: {
570
+ readonly type: "integer";
571
+ };
572
+ readonly maximum: {
573
+ readonly type: "integer";
574
+ };
575
+ };
576
+ readonly required: readonly ["type"];
577
+ readonly additionalProperties: false;
578
+ }, {
579
+ readonly type: "object";
580
+ readonly properties: {
581
+ readonly type: {
582
+ readonly type: "string";
583
+ readonly const: "number";
584
+ };
585
+ readonly default: {
586
+ readonly type: "number";
587
+ };
588
+ readonly min: {
589
+ readonly type: "number";
590
+ };
591
+ readonly max: {
592
+ readonly type: "number";
593
+ };
594
+ };
595
+ readonly required: readonly ["type"];
596
+ readonly additionalProperties: false;
597
+ }, {
598
+ readonly anyOf: readonly [{
599
+ readonly type: "object";
600
+ readonly properties: {
601
+ readonly type: {
602
+ readonly type: "string";
603
+ readonly const: "string";
604
+ };
605
+ readonly title: {
606
+ readonly type: "string";
607
+ };
608
+ readonly pattern: {
609
+ readonly type: "string";
610
+ };
611
+ readonly default: {
612
+ readonly type: "string";
613
+ };
614
+ readonly minLength: {
615
+ readonly type: "integer";
616
+ };
617
+ readonly maxLength: {
618
+ readonly type: "integer";
619
+ };
620
+ };
621
+ readonly required: readonly ["type"];
622
+ readonly additionalProperties: false;
623
+ }, {
624
+ readonly type: "object";
625
+ readonly properties: {
626
+ readonly type: {
627
+ readonly type: "string";
628
+ readonly const: "string";
629
+ };
630
+ readonly title: {
631
+ readonly type: "string";
632
+ };
633
+ readonly enum: {
634
+ readonly type: "array";
635
+ readonly items: {
636
+ readonly type: "string";
637
+ readonly pattern: "^[A-Z]+[A-Z_]+[A-Z]$";
638
+ };
639
+ };
640
+ readonly default: {
641
+ readonly type: "string";
642
+ readonly pattern: "^[A-Z]+[A-Z_]+[A-Z]$";
643
+ };
644
+ };
645
+ readonly required: readonly ["type", "title", "enum"];
646
+ readonly additionalProperties: false;
647
+ }, {
648
+ readonly type: "object";
649
+ readonly properties: {
650
+ readonly type: {
651
+ readonly type: "string";
652
+ readonly const: "string";
653
+ };
654
+ readonly format: {
655
+ readonly type: "string";
656
+ readonly enum: readonly ["date", "date-time", "duration", "time", "uri"];
657
+ };
658
+ };
659
+ readonly required: readonly ["type", "format"];
660
+ readonly additionalProperties: false;
661
+ }];
662
+ }];
663
+ }, {
664
+ readonly anyOf: readonly [{
665
+ readonly type: "object";
666
+ readonly properties: {
667
+ readonly type: {
668
+ readonly type: "string";
669
+ readonly const: "array";
670
+ };
671
+ readonly title: {
672
+ readonly type: "string";
673
+ readonly pattern: "^[A-Z]+[A-Za-z0-9]+$";
674
+ };
675
+ readonly items: {
676
+ readonly type: "object";
677
+ readonly properties: {
678
+ readonly $ref: {
679
+ readonly type: "string";
680
+ };
681
+ };
682
+ readonly required: readonly ["$ref"];
683
+ readonly additionalProperties: false;
684
+ };
685
+ readonly uniqueItems: {
686
+ readonly type: "boolean";
687
+ };
688
+ readonly minItems: {
689
+ readonly type: "integer";
690
+ };
691
+ readonly maxItems: {
692
+ readonly type: "integer";
693
+ };
694
+ };
695
+ readonly required: readonly ["type", "title", "items"];
696
+ readonly additionalProperties: false;
697
+ }, {
698
+ readonly type: "object";
699
+ readonly properties: {
700
+ readonly title: {
701
+ readonly type: "string";
702
+ readonly pattern: "^[A-Z]+[A-Za-z0-9]+$";
703
+ };
704
+ readonly type: {
705
+ readonly type: "string";
706
+ readonly const: "object";
707
+ };
708
+ readonly properties: {
709
+ readonly type: "object";
710
+ readonly patternProperties: {
711
+ readonly '^[a-z]+[A-Za-z0-9]+$': {
712
+ readonly type: "object";
713
+ readonly properties: {
714
+ readonly $ref: {
715
+ readonly type: "string";
716
+ };
717
+ };
718
+ readonly required: readonly ["$ref"];
719
+ readonly additionalProperties: false;
720
+ };
721
+ };
722
+ readonly additionalProperties: false;
723
+ };
724
+ readonly required: {
725
+ readonly type: "array";
726
+ readonly items: {
727
+ readonly type: "string";
728
+ };
729
+ };
730
+ readonly additionalProperties: {
731
+ readonly type: "boolean";
732
+ };
733
+ };
734
+ readonly required: readonly ["type", "properties", "required", "additionalProperties", "title"];
735
+ readonly additionalProperties: false;
736
+ }];
737
+ }];
738
+ };
739
+ };
740
+ readonly type: {
741
+ readonly type: "string";
742
+ readonly const: "object";
743
+ };
744
+ readonly properties: {
745
+ readonly type: "object";
746
+ readonly patternProperties: {
747
+ readonly '^[a-z]+[A-Za-z0-9]+$': {
748
+ readonly type: "object";
749
+ readonly properties: {
750
+ readonly $ref: {
751
+ readonly type: "string";
752
+ };
753
+ };
754
+ readonly required: readonly ["$ref"];
755
+ readonly additionalProperties: false;
756
+ };
757
+ };
758
+ readonly additionalProperties: false;
759
+ };
760
+ readonly required: {
761
+ readonly type: "array";
762
+ readonly items: {
763
+ readonly type: "string";
764
+ };
765
+ };
766
+ readonly additionalProperties: {
767
+ readonly type: "boolean";
768
+ };
769
+ };
770
+ readonly required: readonly ["type", "properties", "required", "additionalProperties", "$defs"];
771
+ readonly additionalProperties: false;
772
+ };
773
+ readonly fieldsMeta: {
774
+ readonly type: "object";
775
+ readonly additionalProperties: {
776
+ readonly type: "object";
777
+ readonly properties: {
778
+ readonly relationModel: {
779
+ readonly anyOf: readonly [{
780
+ readonly type: "string";
781
+ }, {
782
+ readonly type: "null";
783
+ }];
784
+ };
785
+ };
786
+ readonly additionalProperties: false;
787
+ };
788
+ };
789
+ };
790
+ readonly required: readonly ["name", "version", "interfaces", "schema", "fieldsMeta", "behavior"];
791
+ readonly additionalProperties: false;
792
+ }, {
793
+ readonly type: "object";
794
+ readonly properties: {
795
+ readonly behavior: {
796
+ readonly type: "string";
797
+ readonly const: "unique";
798
+ };
799
+ readonly uniqueFields: {
800
+ readonly type: "array";
801
+ readonly items: {
802
+ readonly type: "string";
803
+ };
804
+ };
805
+ readonly name: {
806
+ readonly type: "string";
807
+ readonly pattern: "^[A-Z]+[A-Za-z0-9]+$";
808
+ };
809
+ readonly version: {
810
+ readonly type: "string";
811
+ readonly const: "1.0";
812
+ };
813
+ readonly interfaces: {
814
+ readonly type: "array";
815
+ readonly items: {
816
+ readonly type: "string";
817
+ };
818
+ };
819
+ readonly schema: {
820
+ readonly type: "object";
821
+ readonly properties: {
822
+ readonly $defs: {
823
+ readonly type: "object";
824
+ readonly additionalProperties: {
825
+ readonly anyOf: readonly [{
826
+ readonly anyOf: readonly [{
827
+ readonly type: "object";
828
+ readonly properties: {
829
+ readonly type: {
830
+ readonly type: "string";
831
+ readonly const: "boolean";
832
+ };
833
+ readonly default: {
834
+ readonly type: "boolean";
835
+ };
836
+ };
837
+ readonly required: readonly ["type"];
838
+ readonly additionalProperties: false;
839
+ }, {
840
+ readonly type: "object";
841
+ readonly properties: {
842
+ readonly type: {
843
+ readonly type: "string";
844
+ readonly const: "integer";
845
+ };
846
+ readonly default: {
847
+ readonly type: "integer";
848
+ };
849
+ readonly minimum: {
850
+ readonly type: "integer";
851
+ };
852
+ readonly maximum: {
853
+ readonly type: "integer";
854
+ };
855
+ };
856
+ readonly required: readonly ["type"];
857
+ readonly additionalProperties: false;
858
+ }, {
859
+ readonly type: "object";
860
+ readonly properties: {
861
+ readonly type: {
862
+ readonly type: "string";
863
+ readonly const: "number";
864
+ };
865
+ readonly default: {
866
+ readonly type: "number";
867
+ };
868
+ readonly min: {
869
+ readonly type: "number";
870
+ };
871
+ readonly max: {
872
+ readonly type: "number";
873
+ };
874
+ };
875
+ readonly required: readonly ["type"];
876
+ readonly additionalProperties: false;
877
+ }, {
878
+ readonly anyOf: readonly [{
879
+ readonly type: "object";
880
+ readonly properties: {
881
+ readonly type: {
882
+ readonly type: "string";
883
+ readonly const: "string";
884
+ };
885
+ readonly title: {
886
+ readonly type: "string";
887
+ };
888
+ readonly pattern: {
889
+ readonly type: "string";
890
+ };
891
+ readonly default: {
892
+ readonly type: "string";
893
+ };
894
+ readonly minLength: {
895
+ readonly type: "integer";
896
+ };
897
+ readonly maxLength: {
898
+ readonly type: "integer";
899
+ };
900
+ };
901
+ readonly required: readonly ["type"];
902
+ readonly additionalProperties: false;
903
+ }, {
904
+ readonly type: "object";
905
+ readonly properties: {
906
+ readonly type: {
907
+ readonly type: "string";
908
+ readonly const: "string";
909
+ };
910
+ readonly title: {
911
+ readonly type: "string";
912
+ };
913
+ readonly enum: {
914
+ readonly type: "array";
915
+ readonly items: {
916
+ readonly type: "string";
917
+ readonly pattern: "^[A-Z]+[A-Z_]+[A-Z]$";
918
+ };
919
+ };
920
+ readonly default: {
921
+ readonly type: "string";
922
+ readonly pattern: "^[A-Z]+[A-Z_]+[A-Z]$";
923
+ };
924
+ };
925
+ readonly required: readonly ["type", "title", "enum"];
926
+ readonly additionalProperties: false;
927
+ }, {
928
+ readonly type: "object";
929
+ readonly properties: {
930
+ readonly type: {
931
+ readonly type: "string";
932
+ readonly const: "string";
933
+ };
934
+ readonly format: {
935
+ readonly type: "string";
936
+ readonly enum: readonly ["date", "date-time", "duration", "time", "uri"];
937
+ };
938
+ };
939
+ readonly required: readonly ["type", "format"];
940
+ readonly additionalProperties: false;
941
+ }];
942
+ }];
943
+ }, {
944
+ readonly anyOf: readonly [{
945
+ readonly type: "object";
946
+ readonly properties: {
947
+ readonly type: {
948
+ readonly type: "string";
949
+ readonly const: "array";
950
+ };
951
+ readonly title: {
952
+ readonly type: "string";
953
+ readonly pattern: "^[A-Z]+[A-Za-z0-9]+$";
954
+ };
955
+ readonly items: {
956
+ readonly type: "object";
957
+ readonly properties: {
958
+ readonly $ref: {
959
+ readonly type: "string";
960
+ };
961
+ };
962
+ readonly required: readonly ["$ref"];
963
+ readonly additionalProperties: false;
964
+ };
965
+ readonly uniqueItems: {
966
+ readonly type: "boolean";
967
+ };
968
+ readonly minItems: {
969
+ readonly type: "integer";
970
+ };
971
+ readonly maxItems: {
972
+ readonly type: "integer";
973
+ };
974
+ };
975
+ readonly required: readonly ["type", "title", "items"];
976
+ readonly additionalProperties: false;
977
+ }, {
978
+ readonly type: "object";
979
+ readonly properties: {
980
+ readonly title: {
981
+ readonly type: "string";
982
+ readonly pattern: "^[A-Z]+[A-Za-z0-9]+$";
983
+ };
984
+ readonly type: {
985
+ readonly type: "string";
986
+ readonly const: "object";
987
+ };
988
+ readonly properties: {
989
+ readonly type: "object";
990
+ readonly patternProperties: {
991
+ readonly '^[a-z]+[A-Za-z0-9]+$': {
992
+ readonly type: "object";
993
+ readonly properties: {
994
+ readonly $ref: {
995
+ readonly type: "string";
996
+ };
997
+ };
998
+ readonly required: readonly ["$ref"];
999
+ readonly additionalProperties: false;
1000
+ };
1001
+ };
1002
+ readonly additionalProperties: false;
1003
+ };
1004
+ readonly required: {
1005
+ readonly type: "array";
1006
+ readonly items: {
1007
+ readonly type: "string";
1008
+ };
1009
+ };
1010
+ readonly additionalProperties: {
1011
+ readonly type: "boolean";
1012
+ };
1013
+ };
1014
+ readonly required: readonly ["type", "properties", "required", "additionalProperties", "title"];
1015
+ readonly additionalProperties: false;
1016
+ }];
1017
+ }];
1018
+ };
1019
+ };
1020
+ readonly type: {
1021
+ readonly type: "string";
1022
+ readonly const: "object";
1023
+ };
1024
+ readonly properties: {
1025
+ readonly type: "object";
1026
+ readonly patternProperties: {
1027
+ readonly '^[a-z]+[A-Za-z0-9]+$': {
1028
+ readonly type: "object";
1029
+ readonly properties: {
1030
+ readonly $ref: {
1031
+ readonly type: "string";
1032
+ };
1033
+ };
1034
+ readonly required: readonly ["$ref"];
1035
+ readonly additionalProperties: false;
1036
+ };
1037
+ };
1038
+ readonly additionalProperties: false;
1039
+ };
1040
+ readonly required: {
1041
+ readonly type: "array";
1042
+ readonly items: {
1043
+ readonly type: "string";
1044
+ };
1045
+ };
1046
+ readonly additionalProperties: {
1047
+ readonly type: "boolean";
1048
+ };
1049
+ };
1050
+ readonly required: readonly ["type", "properties", "required", "additionalProperties", "$defs"];
1051
+ readonly additionalProperties: false;
1052
+ };
1053
+ readonly fieldsMeta: {
1054
+ readonly type: "object";
1055
+ readonly additionalProperties: {
1056
+ readonly type: "object";
1057
+ readonly properties: {
1058
+ readonly relationModel: {
1059
+ readonly anyOf: readonly [{
1060
+ readonly type: "string";
1061
+ }, {
1062
+ readonly type: "null";
1063
+ }];
1064
+ };
1065
+ };
1066
+ readonly additionalProperties: false;
1067
+ };
1068
+ };
1069
+ };
1070
+ readonly required: readonly ["name", "version", "interfaces", "schema", "fieldsMeta", "behavior", "uniqueFields"];
1071
+ readonly additionalProperties: false;
1072
+ }];
1073
+ };
1074
+ };
1075
+ readonly record: {
1076
+ readonly type: "object";
1077
+ readonly patternProperties: {
1078
+ readonly '^k[0-9a-z]{56}$': {
1079
+ readonly type: "integer";
1080
+ readonly minimum: 0;
1081
+ };
1082
+ };
1083
+ readonly additionalProperties: false;
1084
+ };
1085
+ };
1086
+ readonly required: readonly ["digest", "models", "record"];
1087
+ readonly additionalProperties: false;
1088
+ };
1089
+ export type ClusterModel = FromSchema<typeof clusterModel>;
1090
+ export declare const validateClusterModel: import("@enkaku/schema").Validator<{
1091
+ digest: string;
1092
+ models: ({
1093
+ name: string;
1094
+ version: "1.0";
1095
+ schema: {
1096
+ type: "object";
1097
+ required: string[];
1098
+ properties: {
1099
+ [x: string]: {
1100
+ $ref: string;
1101
+ };
1102
+ };
1103
+ additionalProperties: boolean;
1104
+ $defs: {
1105
+ [x: string]: {
1106
+ default?: boolean | undefined;
1107
+ type: "boolean";
1108
+ } | {
1109
+ maximum?: number | undefined;
1110
+ minimum?: number | undefined;
1111
+ default?: number | undefined;
1112
+ type: "integer";
1113
+ } | {
1114
+ default?: number | undefined;
1115
+ min?: number | undefined;
1116
+ max?: number | undefined;
1117
+ type: "number";
1118
+ } | {
1119
+ maxLength?: number | undefined;
1120
+ minLength?: number | undefined;
1121
+ pattern?: string | undefined;
1122
+ title?: string | undefined;
1123
+ default?: string | undefined;
1124
+ type: "string";
1125
+ } | {
1126
+ default?: string | undefined;
1127
+ type: "string";
1128
+ enum: string[];
1129
+ title: string;
1130
+ } | {
1131
+ type: "string";
1132
+ format: "date" | "date-time" | "duration" | "time" | "uri";
1133
+ } | {
1134
+ maxItems?: number | undefined;
1135
+ minItems?: number | undefined;
1136
+ uniqueItems?: boolean | undefined;
1137
+ type: "array";
1138
+ items: {
1139
+ $ref: string;
1140
+ };
1141
+ title: string;
1142
+ } | {
1143
+ type: "object";
1144
+ required: string[];
1145
+ properties: {
1146
+ [x: string]: {
1147
+ $ref: string;
1148
+ };
1149
+ };
1150
+ additionalProperties: boolean;
1151
+ title: string;
1152
+ };
1153
+ };
1154
+ };
1155
+ fieldsMeta: {
1156
+ [x: string]: {
1157
+ relationModel?: string | null | undefined;
1158
+ };
1159
+ };
1160
+ interfaces: string[];
1161
+ behavior: "default";
1162
+ } | {
1163
+ name: string;
1164
+ version: "1.0";
1165
+ schema: {
1166
+ type: "object";
1167
+ required: string[];
1168
+ properties: {
1169
+ [x: string]: {
1170
+ $ref: string;
1171
+ };
1172
+ };
1173
+ additionalProperties: boolean;
1174
+ $defs: {
1175
+ [x: string]: {
1176
+ default?: boolean | undefined;
1177
+ type: "boolean";
1178
+ } | {
1179
+ maximum?: number | undefined;
1180
+ minimum?: number | undefined;
1181
+ default?: number | undefined;
1182
+ type: "integer";
1183
+ } | {
1184
+ default?: number | undefined;
1185
+ min?: number | undefined;
1186
+ max?: number | undefined;
1187
+ type: "number";
1188
+ } | {
1189
+ maxLength?: number | undefined;
1190
+ minLength?: number | undefined;
1191
+ pattern?: string | undefined;
1192
+ title?: string | undefined;
1193
+ default?: string | undefined;
1194
+ type: "string";
1195
+ } | {
1196
+ default?: string | undefined;
1197
+ type: "string";
1198
+ enum: string[];
1199
+ title: string;
1200
+ } | {
1201
+ type: "string";
1202
+ format: "date" | "date-time" | "duration" | "time" | "uri";
1203
+ } | {
1204
+ maxItems?: number | undefined;
1205
+ minItems?: number | undefined;
1206
+ uniqueItems?: boolean | undefined;
1207
+ type: "array";
1208
+ items: {
1209
+ $ref: string;
1210
+ };
1211
+ title: string;
1212
+ } | {
1213
+ type: "object";
1214
+ required: string[];
1215
+ properties: {
1216
+ [x: string]: {
1217
+ $ref: string;
1218
+ };
1219
+ };
1220
+ additionalProperties: boolean;
1221
+ title: string;
1222
+ };
1223
+ };
1224
+ };
1225
+ fieldsMeta: {
1226
+ [x: string]: {
1227
+ relationModel?: string | null | undefined;
1228
+ };
1229
+ };
1230
+ interfaces: string[];
1231
+ behavior: "interface";
1232
+ } | {
1233
+ name: string;
1234
+ version: "1.0";
1235
+ schema: {
1236
+ type: "object";
1237
+ required: string[];
1238
+ properties: {
1239
+ [x: string]: {
1240
+ $ref: string;
1241
+ };
1242
+ };
1243
+ additionalProperties: boolean;
1244
+ $defs: {
1245
+ [x: string]: {
1246
+ default?: boolean | undefined;
1247
+ type: "boolean";
1248
+ } | {
1249
+ maximum?: number | undefined;
1250
+ minimum?: number | undefined;
1251
+ default?: number | undefined;
1252
+ type: "integer";
1253
+ } | {
1254
+ default?: number | undefined;
1255
+ min?: number | undefined;
1256
+ max?: number | undefined;
1257
+ type: "number";
1258
+ } | {
1259
+ maxLength?: number | undefined;
1260
+ minLength?: number | undefined;
1261
+ pattern?: string | undefined;
1262
+ title?: string | undefined;
1263
+ default?: string | undefined;
1264
+ type: "string";
1265
+ } | {
1266
+ default?: string | undefined;
1267
+ type: "string";
1268
+ enum: string[];
1269
+ title: string;
1270
+ } | {
1271
+ type: "string";
1272
+ format: "date" | "date-time" | "duration" | "time" | "uri";
1273
+ } | {
1274
+ maxItems?: number | undefined;
1275
+ minItems?: number | undefined;
1276
+ uniqueItems?: boolean | undefined;
1277
+ type: "array";
1278
+ items: {
1279
+ $ref: string;
1280
+ };
1281
+ title: string;
1282
+ } | {
1283
+ type: "object";
1284
+ required: string[];
1285
+ properties: {
1286
+ [x: string]: {
1287
+ $ref: string;
1288
+ };
1289
+ };
1290
+ additionalProperties: boolean;
1291
+ title: string;
1292
+ };
1293
+ };
1294
+ };
1295
+ fieldsMeta: {
1296
+ [x: string]: {
1297
+ relationModel?: string | null | undefined;
1298
+ };
1299
+ };
1300
+ interfaces: string[];
1301
+ behavior: "unique";
1302
+ uniqueFields: string[];
1303
+ })[];
1304
+ record: {
1305
+ [x: string]: number;
1306
+ };
1307
+ }>;
1308
+ export declare function verifyCluster(cluster: ClusterModel): DocumentModelsRecord;
11
1309
  export declare class ClusterBuilder {
12
1310
  #private;
13
1311
  get cluster(): DocumentModelsCluster;
14
- set(index: number, model: SetDocumentModel): void;
1312
+ get length(): number;
1313
+ build(): ClusterModel;
1314
+ add(inputModel: SetDocumentModel): DocumentModelID;
1315
+ addAll(models: Array<SetDocumentModel>): Array<DocumentModelID>;
15
1316
  }
16
1317
  export {};
17
1318
  //# sourceMappingURL=cluster.d.ts.map