@meantjs/profile 0.0.0-bootstrap → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,966 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "urn:candid-profile:v0:schema",
4
+ "title": "Candid Profile v0",
5
+ "description": "Meaning for positions in a Candid interface (units, formats, intent, risk, idempotency, outcome classes). Normative prose: docs/profile-v0.md. Structural checks only; address resolution and tag applicability are checked by scripts/validate.mjs.",
6
+ "type": "object",
7
+ "required": [
8
+ "format",
9
+ "format_version",
10
+ "kind",
11
+ "name",
12
+ "origin",
13
+ "binds",
14
+ "annotations"
15
+ ],
16
+ "additionalProperties": false,
17
+ "properties": {
18
+ "format": {
19
+ "const": "candid-profile"
20
+ },
21
+ "format_version": {
22
+ "const": 0
23
+ },
24
+ "kind": {
25
+ "enum": [
26
+ "canister",
27
+ "pack"
28
+ ]
29
+ },
30
+ "name": {
31
+ "type": "string",
32
+ "pattern": "^[a-z0-9][a-z0-9_.-]{0,63}$"
33
+ },
34
+ "origin": {
35
+ "enum": [
36
+ "author",
37
+ "third_party",
38
+ "pack",
39
+ "inferred"
40
+ ]
41
+ },
42
+ "language": {
43
+ "type": "string",
44
+ "pattern": "^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$",
45
+ "default": "en"
46
+ },
47
+ "description": {
48
+ "type": "string"
49
+ },
50
+ "binds": {
51
+ "type": "object"
52
+ },
53
+ "annotations": {
54
+ "type": "array",
55
+ "minItems": 1,
56
+ "items": {
57
+ "$ref": "#/$defs/annotation"
58
+ }
59
+ }
60
+ },
61
+ "allOf": [
62
+ {
63
+ "if": {
64
+ "properties": {
65
+ "kind": {
66
+ "const": "pack"
67
+ }
68
+ }
69
+ },
70
+ "then": {
71
+ "properties": {
72
+ "origin": {
73
+ "const": "pack"
74
+ },
75
+ "binds": {
76
+ "$ref": "#/$defs/pack_binds"
77
+ }
78
+ }
79
+ }
80
+ },
81
+ {
82
+ "if": {
83
+ "properties": {
84
+ "kind": {
85
+ "const": "canister"
86
+ }
87
+ }
88
+ },
89
+ "then": {
90
+ "properties": {
91
+ "origin": {
92
+ "enum": [
93
+ "author",
94
+ "third_party",
95
+ "inferred"
96
+ ]
97
+ },
98
+ "binds": {
99
+ "$ref": "#/$defs/canister_binds"
100
+ }
101
+ }
102
+ }
103
+ }
104
+ ],
105
+ "$defs": {
106
+ "pack_binds": {
107
+ "type": "object",
108
+ "required": [
109
+ "standard",
110
+ "requires"
111
+ ],
112
+ "additionalProperties": false,
113
+ "properties": {
114
+ "standard": {
115
+ "type": "string",
116
+ "pattern": "^[A-Z]+-[0-9]+$"
117
+ },
118
+ "spec_url": {
119
+ "type": "string",
120
+ "pattern": "^https://"
121
+ },
122
+ "requires": {
123
+ "type": "string",
124
+ "minLength": 10,
125
+ "description": "A Candid service fragment. The pack applies to a canister whose service type is a subtype of this fragment."
126
+ }
127
+ }
128
+ },
129
+ "canister_binds": {
130
+ "type": "object",
131
+ "required": [
132
+ "interface_id"
133
+ ],
134
+ "additionalProperties": false,
135
+ "properties": {
136
+ "interface_id": {
137
+ "type": "string",
138
+ "pattern": "^candid-core:interface:v1:sha256:[0-9a-f]{64}$"
139
+ },
140
+ "contract_id": {
141
+ "type": "string",
142
+ "pattern": "^candid-core:contract:v1:sha256:[0-9a-f]{64}$"
143
+ },
144
+ "canister_id": {
145
+ "type": "string",
146
+ "pattern": "^[a-z0-9]{5}(-[a-z0-9]{5})*(-[a-z0-9]{1,5})?$"
147
+ }
148
+ }
149
+ },
150
+ "value_address": {
151
+ "type": "string",
152
+ "description": "METHOD(i)path | METHOD->(i)path | type:DECL path. Paths: .label, .#id, [] (vec element). opt is transparent.",
153
+ "pattern": "^(([A-Za-z_][A-Za-z0-9_]*)(\\((0|[1-9][0-9]*)\\)|->\\((0|[1-9][0-9]*)\\))|type:[A-Za-z_][A-Za-z0-9_]*)((\\.([A-Za-z_][A-Za-z0-9_]*|#(0|[1-9][0-9]{0,9})))|\\[\\])*$"
154
+ },
155
+ "method_address": {
156
+ "type": "string",
157
+ "pattern": "^[A-Za-z_][A-Za-z0-9_]*$"
158
+ },
159
+ "relpath": {
160
+ "type": "string",
161
+ "description": "Path relative to a method's argument tuple (or result tuple, for outcome/list.next/list.items). Starts with (i) when the tuple has more than one element; otherwise relative to element 0.",
162
+ "pattern": "^(\\((0|[1-9][0-9]*)\\))?(\\.?([A-Za-z_][A-Za-z0-9_]*|#(0|[1-9][0-9]{0,9}))|\\[\\])?((\\.([A-Za-z_][A-Za-z0-9_]*|#(0|[1-9][0-9]{0,9})))|\\[\\])*$",
163
+ "minLength": 1
164
+ },
165
+ "int_string": {
166
+ "type": "string",
167
+ "pattern": "^(0|-?[1-9][0-9]*)$"
168
+ },
169
+ "dynamic": {
170
+ "type": "object",
171
+ "required": [
172
+ "from"
173
+ ],
174
+ "additionalProperties": false,
175
+ "properties": {
176
+ "from": {
177
+ "type": "string",
178
+ "pattern": "^(query:[A-Za-z_][A-Za-z0-9_]*|now|caller)$"
179
+ }
180
+ }
181
+ },
182
+ "time_unit": {
183
+ "enum": [
184
+ "ns",
185
+ "us",
186
+ "ms",
187
+ "s"
188
+ ]
189
+ },
190
+ "outcome_class": {
191
+ "enum": [
192
+ "success",
193
+ "already_done",
194
+ "retry_same",
195
+ "retry_new",
196
+ "fix_input",
197
+ "fail"
198
+ ]
199
+ },
200
+ "annotation": {
201
+ "type": "object",
202
+ "required": [
203
+ "at",
204
+ "tag",
205
+ "args"
206
+ ],
207
+ "additionalProperties": false,
208
+ "properties": {
209
+ "at": {
210
+ "type": "string"
211
+ },
212
+ "tag": {
213
+ "enum": [
214
+ "amount",
215
+ "timestamp",
216
+ "duration",
217
+ "account",
218
+ "subaccount",
219
+ "bytes",
220
+ "text",
221
+ "range",
222
+ "default",
223
+ "describe",
224
+ "ui",
225
+ "intent",
226
+ "effect",
227
+ "idempotency",
228
+ "outcome",
229
+ "list",
230
+ "names",
231
+ "named"
232
+ ]
233
+ },
234
+ "args": {
235
+ "type": "object"
236
+ },
237
+ "note": {
238
+ "type": "string"
239
+ }
240
+ },
241
+ "allOf": [
242
+ {
243
+ "if": {
244
+ "properties": {
245
+ "tag": {
246
+ "enum": [
247
+ "intent",
248
+ "effect",
249
+ "idempotency",
250
+ "outcome",
251
+ "list",
252
+ "names"
253
+ ]
254
+ }
255
+ }
256
+ },
257
+ "then": {
258
+ "properties": {
259
+ "at": {
260
+ "$ref": "#/$defs/method_address"
261
+ }
262
+ }
263
+ }
264
+ },
265
+ {
266
+ "if": {
267
+ "properties": {
268
+ "tag": {
269
+ "enum": [
270
+ "amount",
271
+ "timestamp",
272
+ "duration",
273
+ "account",
274
+ "subaccount",
275
+ "bytes",
276
+ "text",
277
+ "range",
278
+ "default",
279
+ "ui",
280
+ "named"
281
+ ]
282
+ }
283
+ }
284
+ },
285
+ "then": {
286
+ "properties": {
287
+ "at": {
288
+ "$ref": "#/$defs/value_address"
289
+ }
290
+ }
291
+ }
292
+ },
293
+ {
294
+ "if": {
295
+ "properties": {
296
+ "tag": {
297
+ "const": "describe"
298
+ }
299
+ }
300
+ },
301
+ "then": {
302
+ "properties": {
303
+ "at": {
304
+ "anyOf": [
305
+ {
306
+ "$ref": "#/$defs/value_address"
307
+ },
308
+ {
309
+ "$ref": "#/$defs/method_address"
310
+ }
311
+ ]
312
+ }
313
+ }
314
+ }
315
+ },
316
+ {
317
+ "if": {
318
+ "properties": {
319
+ "tag": {
320
+ "const": "amount"
321
+ }
322
+ }
323
+ },
324
+ "then": {
325
+ "properties": {
326
+ "args": {
327
+ "$ref": "#/$defs/args_amount"
328
+ }
329
+ }
330
+ }
331
+ },
332
+ {
333
+ "if": {
334
+ "properties": {
335
+ "tag": {
336
+ "const": "timestamp"
337
+ }
338
+ }
339
+ },
340
+ "then": {
341
+ "properties": {
342
+ "args": {
343
+ "$ref": "#/$defs/args_timestamp"
344
+ }
345
+ }
346
+ }
347
+ },
348
+ {
349
+ "if": {
350
+ "properties": {
351
+ "tag": {
352
+ "const": "duration"
353
+ }
354
+ }
355
+ },
356
+ "then": {
357
+ "properties": {
358
+ "args": {
359
+ "$ref": "#/$defs/args_duration"
360
+ }
361
+ }
362
+ }
363
+ },
364
+ {
365
+ "if": {
366
+ "properties": {
367
+ "tag": {
368
+ "const": "account"
369
+ }
370
+ }
371
+ },
372
+ "then": {
373
+ "properties": {
374
+ "args": {
375
+ "$ref": "#/$defs/args_account"
376
+ }
377
+ }
378
+ }
379
+ },
380
+ {
381
+ "if": {
382
+ "properties": {
383
+ "tag": {
384
+ "const": "subaccount"
385
+ }
386
+ }
387
+ },
388
+ "then": {
389
+ "properties": {
390
+ "args": {
391
+ "$ref": "#/$defs/args_empty"
392
+ }
393
+ }
394
+ }
395
+ },
396
+ {
397
+ "if": {
398
+ "properties": {
399
+ "tag": {
400
+ "const": "bytes"
401
+ }
402
+ }
403
+ },
404
+ "then": {
405
+ "properties": {
406
+ "args": {
407
+ "$ref": "#/$defs/args_bytes"
408
+ }
409
+ }
410
+ }
411
+ },
412
+ {
413
+ "if": {
414
+ "properties": {
415
+ "tag": {
416
+ "const": "text"
417
+ }
418
+ }
419
+ },
420
+ "then": {
421
+ "properties": {
422
+ "args": {
423
+ "$ref": "#/$defs/args_text"
424
+ }
425
+ }
426
+ }
427
+ },
428
+ {
429
+ "if": {
430
+ "properties": {
431
+ "tag": {
432
+ "const": "range"
433
+ }
434
+ }
435
+ },
436
+ "then": {
437
+ "properties": {
438
+ "args": {
439
+ "$ref": "#/$defs/args_range"
440
+ }
441
+ }
442
+ }
443
+ },
444
+ {
445
+ "if": {
446
+ "properties": {
447
+ "tag": {
448
+ "const": "default"
449
+ }
450
+ }
451
+ },
452
+ "then": {
453
+ "properties": {
454
+ "args": {
455
+ "$ref": "#/$defs/args_default"
456
+ }
457
+ }
458
+ }
459
+ },
460
+ {
461
+ "if": {
462
+ "properties": {
463
+ "tag": {
464
+ "const": "describe"
465
+ }
466
+ }
467
+ },
468
+ "then": {
469
+ "properties": {
470
+ "args": {
471
+ "$ref": "#/$defs/args_describe"
472
+ }
473
+ }
474
+ }
475
+ },
476
+ {
477
+ "if": {
478
+ "properties": {
479
+ "tag": {
480
+ "const": "ui"
481
+ }
482
+ }
483
+ },
484
+ "then": {
485
+ "properties": {
486
+ "args": {
487
+ "$ref": "#/$defs/args_ui"
488
+ }
489
+ }
490
+ }
491
+ },
492
+ {
493
+ "if": {
494
+ "properties": {
495
+ "tag": {
496
+ "const": "intent"
497
+ }
498
+ }
499
+ },
500
+ "then": {
501
+ "properties": {
502
+ "args": {
503
+ "$ref": "#/$defs/args_intent"
504
+ }
505
+ }
506
+ }
507
+ },
508
+ {
509
+ "if": {
510
+ "properties": {
511
+ "tag": {
512
+ "const": "effect"
513
+ }
514
+ }
515
+ },
516
+ "then": {
517
+ "properties": {
518
+ "args": {
519
+ "$ref": "#/$defs/args_effect"
520
+ }
521
+ }
522
+ }
523
+ },
524
+ {
525
+ "if": {
526
+ "properties": {
527
+ "tag": {
528
+ "const": "idempotency"
529
+ }
530
+ }
531
+ },
532
+ "then": {
533
+ "properties": {
534
+ "args": {
535
+ "$ref": "#/$defs/args_idempotency"
536
+ }
537
+ }
538
+ }
539
+ },
540
+ {
541
+ "if": {
542
+ "properties": {
543
+ "tag": {
544
+ "const": "outcome"
545
+ }
546
+ }
547
+ },
548
+ "then": {
549
+ "properties": {
550
+ "args": {
551
+ "$ref": "#/$defs/args_outcome"
552
+ }
553
+ }
554
+ }
555
+ },
556
+ {
557
+ "if": {
558
+ "properties": {
559
+ "tag": {
560
+ "const": "list"
561
+ }
562
+ }
563
+ },
564
+ "then": {
565
+ "properties": {
566
+ "args": {
567
+ "$ref": "#/$defs/args_list"
568
+ }
569
+ }
570
+ }
571
+ },
572
+ {
573
+ "if": {
574
+ "properties": {
575
+ "tag": {
576
+ "const": "names"
577
+ }
578
+ }
579
+ },
580
+ "then": {
581
+ "properties": {
582
+ "args": {
583
+ "$ref": "#/$defs/args_names"
584
+ }
585
+ }
586
+ }
587
+ },
588
+ {
589
+ "if": {
590
+ "properties": {
591
+ "tag": {
592
+ "const": "named"
593
+ }
594
+ }
595
+ },
596
+ "then": {
597
+ "properties": {
598
+ "args": {
599
+ "$ref": "#/$defs/args_named"
600
+ }
601
+ }
602
+ }
603
+ }
604
+ ]
605
+ },
606
+ "args_empty": {
607
+ "type": "object",
608
+ "additionalProperties": false,
609
+ "maxProperties": 0
610
+ },
611
+ "args_amount": {
612
+ "type": "object",
613
+ "required": [
614
+ "decimals"
615
+ ],
616
+ "additionalProperties": false,
617
+ "properties": {
618
+ "decimals": {
619
+ "oneOf": [
620
+ {
621
+ "type": "integer",
622
+ "minimum": 0,
623
+ "maximum": 255
624
+ },
625
+ {
626
+ "$ref": "#/$defs/dynamic"
627
+ }
628
+ ]
629
+ },
630
+ "symbol": {
631
+ "oneOf": [
632
+ {
633
+ "type": "string",
634
+ "minLength": 1,
635
+ "maxLength": 32
636
+ },
637
+ {
638
+ "$ref": "#/$defs/dynamic"
639
+ }
640
+ ]
641
+ }
642
+ }
643
+ },
644
+ "args_timestamp": {
645
+ "type": "object",
646
+ "required": [
647
+ "unit"
648
+ ],
649
+ "additionalProperties": false,
650
+ "properties": {
651
+ "unit": {
652
+ "$ref": "#/$defs/time_unit"
653
+ },
654
+ "epoch": {
655
+ "const": "unix"
656
+ }
657
+ }
658
+ },
659
+ "args_duration": {
660
+ "type": "object",
661
+ "required": [
662
+ "unit"
663
+ ],
664
+ "additionalProperties": false,
665
+ "properties": {
666
+ "unit": {
667
+ "$ref": "#/$defs/time_unit"
668
+ }
669
+ }
670
+ },
671
+ "args_account": {
672
+ "type": "object",
673
+ "additionalProperties": false,
674
+ "properties": {
675
+ "encoding": {
676
+ "const": "icrc1"
677
+ }
678
+ }
679
+ },
680
+ "args_bytes": {
681
+ "type": "object",
682
+ "required": [
683
+ "encoding"
684
+ ],
685
+ "additionalProperties": false,
686
+ "properties": {
687
+ "encoding": {
688
+ "enum": [
689
+ "utf8",
690
+ "hex",
691
+ "base64"
692
+ ]
693
+ },
694
+ "max_len": {
695
+ "type": "integer",
696
+ "minimum": 0
697
+ }
698
+ }
699
+ },
700
+ "args_text": {
701
+ "type": "object",
702
+ "additionalProperties": false,
703
+ "minProperties": 1,
704
+ "properties": {
705
+ "format": {
706
+ "enum": [
707
+ "plain",
708
+ "markdown",
709
+ "email",
710
+ "url"
711
+ ]
712
+ },
713
+ "max_len": {
714
+ "type": "integer",
715
+ "minimum": 0
716
+ },
717
+ "pattern": {
718
+ "type": "string"
719
+ }
720
+ }
721
+ },
722
+ "args_range": {
723
+ "type": "object",
724
+ "additionalProperties": false,
725
+ "minProperties": 1,
726
+ "properties": {
727
+ "min": {
728
+ "$ref": "#/$defs/int_string"
729
+ },
730
+ "max": {
731
+ "$ref": "#/$defs/int_string"
732
+ },
733
+ "min_len": {
734
+ "type": "integer",
735
+ "minimum": 0
736
+ },
737
+ "max_len": {
738
+ "type": "integer",
739
+ "minimum": 0
740
+ }
741
+ }
742
+ },
743
+ "args_default": {
744
+ "type": "object",
745
+ "required": [
746
+ "value",
747
+ "mode"
748
+ ],
749
+ "additionalProperties": false,
750
+ "properties": {
751
+ "value": {
752
+ "oneOf": [
753
+ {
754
+ "type": "string",
755
+ "description": "Candid textual literal, e.g. \"null\" or \"opt 0\""
756
+ },
757
+ {
758
+ "$ref": "#/$defs/dynamic"
759
+ }
760
+ ]
761
+ },
762
+ "mode": {
763
+ "enum": [
764
+ "auto",
765
+ "suggest"
766
+ ]
767
+ }
768
+ }
769
+ },
770
+ "args_describe": {
771
+ "type": "object",
772
+ "additionalProperties": false,
773
+ "minProperties": 1,
774
+ "properties": {
775
+ "label": {
776
+ "type": "string",
777
+ "minLength": 1,
778
+ "maxLength": 80
779
+ },
780
+ "help": {
781
+ "type": "string",
782
+ "minLength": 1,
783
+ "maxLength": 2000
784
+ }
785
+ }
786
+ },
787
+ "args_ui": {
788
+ "type": "object",
789
+ "additionalProperties": false,
790
+ "minProperties": 1,
791
+ "properties": {
792
+ "order": {
793
+ "type": "integer"
794
+ },
795
+ "group": {
796
+ "type": "string"
797
+ },
798
+ "hidden": {
799
+ "type": "boolean"
800
+ },
801
+ "widget": {
802
+ "type": "string"
803
+ }
804
+ }
805
+ },
806
+ "args_intent": {
807
+ "type": "object",
808
+ "required": [
809
+ "title",
810
+ "template"
811
+ ],
812
+ "additionalProperties": false,
813
+ "properties": {
814
+ "title": {
815
+ "type": "string",
816
+ "minLength": 1,
817
+ "maxLength": 60
818
+ },
819
+ "template": {
820
+ "type": "string",
821
+ "minLength": 1,
822
+ "maxLength": 500
823
+ }
824
+ }
825
+ },
826
+ "args_effect": {
827
+ "type": "object",
828
+ "required": [
829
+ "kind",
830
+ "irreversible"
831
+ ],
832
+ "additionalProperties": false,
833
+ "properties": {
834
+ "kind": {
835
+ "enum": [
836
+ "read",
837
+ "write",
838
+ "transfer",
839
+ "approve",
840
+ "admin",
841
+ "destroy"
842
+ ]
843
+ },
844
+ "irreversible": {
845
+ "type": "boolean"
846
+ },
847
+ "replicated": {
848
+ "type": "boolean"
849
+ }
850
+ }
851
+ },
852
+ "args_idempotency": {
853
+ "type": "object",
854
+ "required": [
855
+ "mode",
856
+ "stamp"
857
+ ],
858
+ "additionalProperties": false,
859
+ "properties": {
860
+ "mode": {
861
+ "const": "replay_same_payload"
862
+ },
863
+ "stamp": {
864
+ "$ref": "#/$defs/relpath"
865
+ }
866
+ }
867
+ },
868
+ "args_outcome": {
869
+ "type": "object",
870
+ "description": "classes, default or both: a result with no variant to select has default alone (spec 5.3, D-049)",
871
+ "minProperties": 1,
872
+ "additionalProperties": false,
873
+ "properties": {
874
+ "classes": {
875
+ "type": "object",
876
+ "minProperties": 1,
877
+ "propertyNames": {
878
+ "$ref": "#/$defs/relpath"
879
+ },
880
+ "additionalProperties": {
881
+ "$ref": "#/$defs/outcome_class"
882
+ }
883
+ },
884
+ "default": {
885
+ "$ref": "#/$defs/outcome_class"
886
+ }
887
+ }
888
+ },
889
+ "args_list": {
890
+ "type": "object",
891
+ "required": [
892
+ "cursor",
893
+ "next",
894
+ "items"
895
+ ],
896
+ "additionalProperties": false,
897
+ "properties": {
898
+ "cursor": {
899
+ "$ref": "#/$defs/relpath"
900
+ },
901
+ "next": {
902
+ "$ref": "#/$defs/relpath"
903
+ },
904
+ "items": {
905
+ "$ref": "#/$defs/relpath"
906
+ }
907
+ }
908
+ },
909
+ "set_name": {
910
+ "type": "string",
911
+ "pattern": "^[a-z][a-z0-9_]*$",
912
+ "maxLength": 64,
913
+ "description": "A names set's name, which named tags refer to."
914
+ },
915
+ "args_names": {
916
+ "type": "object",
917
+ "required": [
918
+ "set",
919
+ "items",
920
+ "name",
921
+ "value"
922
+ ],
923
+ "additionalProperties": false,
924
+ "description": "A method that lists named things (spec 5.3, D-045). items is a results relpath to a vec of records; name, value, show and kind are paths inside one item.",
925
+ "properties": {
926
+ "set": {
927
+ "$ref": "#/$defs/set_name"
928
+ },
929
+ "items": {
930
+ "$ref": "#/$defs/relpath"
931
+ },
932
+ "name": {
933
+ "$ref": "#/$defs/relpath"
934
+ },
935
+ "value": {
936
+ "$ref": "#/$defs/relpath"
937
+ },
938
+ "show": {
939
+ "$ref": "#/$defs/relpath"
940
+ },
941
+ "kind": {
942
+ "$ref": "#/$defs/relpath"
943
+ }
944
+ }
945
+ },
946
+ "args_named": {
947
+ "type": "object",
948
+ "required": [
949
+ "set"
950
+ ],
951
+ "additionalProperties": false,
952
+ "description": "A position a name from a names set can stand for (spec 5.3, D-045).",
953
+ "properties": {
954
+ "set": {
955
+ "$ref": "#/$defs/set_name"
956
+ },
957
+ "by": {
958
+ "enum": [
959
+ "value",
960
+ "show"
961
+ ]
962
+ }
963
+ }
964
+ }
965
+ }
966
+ }