@curviate/cli 0.47.0 → 0.49.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.
Files changed (48) hide show
  1. package/CHANGELOG.md +231 -1
  2. package/README.md +136 -88
  3. package/dist/{account-RFJ63QYL.js → account-2BH2Q6VG.js} +41 -31
  4. package/dist/chunk-3RCW7URJ.js +41 -0
  5. package/dist/{chunk-UJOTQPL6.js → chunk-5ZGTU4VD.js} +47 -14
  6. package/dist/chunk-D2S5OCYU.js +38 -0
  7. package/dist/{chunk-HOQ7EUHJ.js → chunk-FDJMAF7D.js} +1 -0
  8. package/dist/{chunk-ERBYEC5P.js → chunk-JYKYD57J.js} +1 -1
  9. package/dist/chunk-MGB6FE4A.js +58 -0
  10. package/dist/chunk-NNV2OYEF.js +23 -0
  11. package/dist/{chunk-76SWLAZ6.js → chunk-RXWODUWA.js} +43 -1
  12. package/dist/{chunk-V3MVOVQT.js → chunk-SA2QHAXG.js} +8 -1
  13. package/dist/chunk-TEAWYLPO.js +1493 -0
  14. package/dist/{chunk-PD2I5TYC.js → chunk-V7FJWTZW.js} +3 -3
  15. package/dist/{chunk-TC4ZPUWI.js → chunk-Y7MZZRYR.js} +21 -80
  16. package/dist/{chunk-FXYK2GTO.js → chunk-Z7OQSWBD.js} +38 -33
  17. package/dist/chunk-ZYURL5VK.js +83 -0
  18. package/dist/cli.js +79 -98
  19. package/dist/{comment-MCXE7B7V.js → comment-MRDPDA33.js} +29 -24
  20. package/dist/{company-EUUN372H.js → company-2AEHSGHA.js} +57 -52
  21. package/dist/{config-K4G3VSBA.js → config-NRBKHXES.js} +13 -5
  22. package/dist/{connect-2AL7XVJO.js → connect-4XEBV5V3.js} +42 -38
  23. package/dist/core-RGU2SCBN.js +46 -0
  24. package/dist/{doctor-WPYI7X2T.js → doctor-BZ4DA7DV.js} +9 -5
  25. package/dist/document-RKHRWXNT.js +27 -0
  26. package/dist/{draft-G65DVXT7.js → draft-C5N6EOO5.js} +27 -22
  27. package/dist/enrollment-BNQOUKI7.js +472 -0
  28. package/dist/examples-NIMSIXMV.js +53 -0
  29. package/dist/{exit-codes-AW6KHDDN.js → exit-codes-TLMKTLRI.js} +1 -1
  30. package/dist/{feed-HV24WME4.js → feed-DFUU7SUJ.js} +15 -11
  31. package/dist/{group-HADXNVJW.js → group-CSD2OWOZ.js} +17 -13
  32. package/dist/{inbox-G3EE54OB.js → inbox-SNSPWI7J.js} +23 -19
  33. package/dist/{inboxes-237XOBTP.js → inboxes-RIRHPS4H.js} +18 -14
  34. package/dist/{job-LIN6RWD7.js → job-6PNXXZNF.js} +31 -27
  35. package/dist/{login-OHAHNBRW.js → login-Y7JBAHCW.js} +10 -5
  36. package/dist/{message-U2O2JQSW.js → message-2IK4MBBG.js} +10 -8
  37. package/dist/motion-7ATUXO6R.js +946 -0
  38. package/dist/{notification-3VG32LWM.js → notification-VYK5NDEB.js} +19 -15
  39. package/dist/{post-ECDK2KJL.js → post-AN6T2OJF.js} +35 -30
  40. package/dist/{profile-JOHS6SDW.js → profile-UQY64642.js} +46 -42
  41. package/dist/{recruiter-7VXEIXN3.js → recruiter-OY4RN5HH.js} +122 -119
  42. package/dist/{sales-nav-K4BMBH7R.js → sales-nav-KLODLYMW.js} +36 -30
  43. package/dist/{search-C2UYO6PI.js → search-NWP5S6CF.js} +68 -58
  44. package/dist/{setup-GYEZFDEN.js → setup-YPPFLH2N.js} +14 -9
  45. package/dist/{webhook-KCOQOH7D.js → webhook-OHKBL3YS.js} +51 -55
  46. package/package.json +2 -2
  47. package/dist/chunk-KJ24DIAJ.js +0 -60
  48. package/dist/examples-IJL3A6SZ.js +0 -18
@@ -0,0 +1,1493 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ editDistance
4
+ } from "./chunk-FDJMAF7D.js";
5
+ import {
6
+ isStdinToken
7
+ } from "./chunk-ZYURL5VK.js";
8
+
9
+ // src/lib/document.ts
10
+ import { closeSync, openSync, readSync, statSync } from "fs";
11
+
12
+ // src/schemas/documents.json
13
+ var documents_default = {
14
+ "core recruiter job create": {
15
+ type: "object",
16
+ properties: {
17
+ job_title: {
18
+ type: "object",
19
+ properties: {
20
+ id: {
21
+ type: "string",
22
+ minLength: 1
23
+ },
24
+ name: {
25
+ type: "string",
26
+ minLength: 1
27
+ }
28
+ },
29
+ required: [
30
+ "id",
31
+ "name"
32
+ ],
33
+ additionalProperties: false
34
+ },
35
+ company: {
36
+ oneOf: [
37
+ {
38
+ type: "object",
39
+ properties: {
40
+ id: {
41
+ type: "string",
42
+ minLength: 1
43
+ }
44
+ },
45
+ required: [
46
+ "id"
47
+ ],
48
+ additionalProperties: false
49
+ },
50
+ {
51
+ type: "object",
52
+ properties: {
53
+ name: {
54
+ type: "string",
55
+ minLength: 1
56
+ }
57
+ },
58
+ required: [
59
+ "name"
60
+ ],
61
+ additionalProperties: false
62
+ }
63
+ ]
64
+ },
65
+ workplace_type: {
66
+ type: "string",
67
+ enum: [
68
+ "ON_SITE",
69
+ "HYBRID",
70
+ "REMOTE"
71
+ ]
72
+ },
73
+ location: {
74
+ type: "string",
75
+ minLength: 1
76
+ },
77
+ employment_status: {
78
+ type: "string",
79
+ enum: [
80
+ "FULL_TIME",
81
+ "PART_TIME",
82
+ "CONTRACT",
83
+ "TEMPORARY",
84
+ "OTHER",
85
+ "VOLUNTEER",
86
+ "INTERNSHIP"
87
+ ]
88
+ },
89
+ seniority_level: {
90
+ type: "string",
91
+ enum: [
92
+ "INTERNSHIP",
93
+ "ENTRY_LEVEL",
94
+ "ASSOCIATE",
95
+ "MID_SENIOR_LEVEL",
96
+ "DIRECTOR",
97
+ "EXECUTIVE",
98
+ "NOT_APPLICABLE"
99
+ ]
100
+ },
101
+ description: {
102
+ type: "string",
103
+ minLength: 200
104
+ },
105
+ industry: {
106
+ type: "array",
107
+ items: {
108
+ type: "string",
109
+ minLength: 1
110
+ }
111
+ },
112
+ job_function: {
113
+ type: "array",
114
+ items: {
115
+ type: "string",
116
+ minLength: 1
117
+ }
118
+ },
119
+ apply_method: {
120
+ oneOf: [
121
+ {
122
+ type: "object",
123
+ properties: {
124
+ method: {
125
+ type: "string",
126
+ const: "linkedin"
127
+ },
128
+ notification_email: {
129
+ type: "string"
130
+ },
131
+ resume_required: {
132
+ type: "boolean"
133
+ }
134
+ },
135
+ required: [
136
+ "method",
137
+ "notification_email"
138
+ ],
139
+ additionalProperties: false
140
+ },
141
+ {
142
+ type: "object",
143
+ properties: {
144
+ method: {
145
+ type: "string",
146
+ const: "external"
147
+ },
148
+ website_url: {
149
+ type: "string",
150
+ minLength: 1
151
+ }
152
+ },
153
+ required: [
154
+ "method",
155
+ "website_url"
156
+ ],
157
+ additionalProperties: false
158
+ }
159
+ ],
160
+ discriminator: {
161
+ propertyName: "method",
162
+ mapping: {
163
+ linkedin: "#/oneOf/0",
164
+ external: "#/oneOf/1"
165
+ }
166
+ }
167
+ },
168
+ skills: {
169
+ type: "array",
170
+ items: {
171
+ type: "string",
172
+ minLength: 1
173
+ }
174
+ },
175
+ include_poster_info: {
176
+ type: "boolean"
177
+ },
178
+ tracking_pixel_url: {
179
+ type: "string",
180
+ minLength: 1
181
+ },
182
+ company_job_id: {
183
+ type: "string",
184
+ minLength: 1
185
+ },
186
+ screening_questions: {
187
+ type: "array",
188
+ items: {
189
+ type: "object",
190
+ properties: {
191
+ question: {
192
+ type: "string",
193
+ minLength: 1
194
+ },
195
+ answer_type: {
196
+ type: "string",
197
+ minLength: 1
198
+ },
199
+ qualification_required: {
200
+ type: "boolean"
201
+ }
202
+ },
203
+ required: [
204
+ "question",
205
+ "answer_type"
206
+ ],
207
+ additionalProperties: false
208
+ }
209
+ },
210
+ salary: {
211
+ type: "object",
212
+ properties: {
213
+ currency: {
214
+ type: "string",
215
+ minLength: 1
216
+ },
217
+ pay_frequency: {
218
+ type: "string",
219
+ enum: [
220
+ "YEARLY",
221
+ "MONTHLY",
222
+ "HOURLY"
223
+ ]
224
+ },
225
+ min: {
226
+ type: "number",
227
+ minimum: 0
228
+ },
229
+ max: {
230
+ type: "number",
231
+ minimum: 0
232
+ }
233
+ },
234
+ required: [
235
+ "currency",
236
+ "pay_frequency",
237
+ "min",
238
+ "max"
239
+ ],
240
+ additionalProperties: false
241
+ },
242
+ additional_compensation: {
243
+ type: "object",
244
+ properties: {
245
+ currency: {
246
+ type: "string",
247
+ minLength: 1
248
+ },
249
+ pay_frequency: {
250
+ type: "string",
251
+ enum: [
252
+ "YEARLY",
253
+ "MONTHLY",
254
+ "HOURLY"
255
+ ]
256
+ },
257
+ min: {
258
+ type: "number",
259
+ minimum: 0
260
+ },
261
+ max: {
262
+ type: "number",
263
+ minimum: 0
264
+ }
265
+ },
266
+ required: [
267
+ "currency",
268
+ "pay_frequency",
269
+ "min",
270
+ "max"
271
+ ],
272
+ additionalProperties: false
273
+ },
274
+ rejection_settings: {
275
+ type: "object",
276
+ properties: {
277
+ send_rejection_notification: {
278
+ type: "boolean"
279
+ },
280
+ rejection_template: {
281
+ type: "string",
282
+ minLength: 1
283
+ },
284
+ reject_unqualified_applicants: {
285
+ type: "boolean"
286
+ },
287
+ reject_out_of_country_applicants: {
288
+ type: "boolean"
289
+ }
290
+ },
291
+ required: [
292
+ "send_rejection_notification"
293
+ ],
294
+ additionalProperties: false
295
+ },
296
+ project_name: {
297
+ type: "string",
298
+ minLength: 1
299
+ }
300
+ },
301
+ required: [
302
+ "job_title",
303
+ "company",
304
+ "workplace_type",
305
+ "location",
306
+ "employment_status",
307
+ "seniority_level",
308
+ "description",
309
+ "industry",
310
+ "job_function",
311
+ "apply_method",
312
+ "project_name"
313
+ ],
314
+ additionalProperties: false
315
+ },
316
+ "core recruiter project-job create": {
317
+ type: "object",
318
+ properties: {
319
+ job_title: {
320
+ type: "object",
321
+ properties: {
322
+ id: {
323
+ type: "string",
324
+ minLength: 1
325
+ },
326
+ name: {
327
+ type: "string",
328
+ minLength: 1
329
+ }
330
+ },
331
+ required: [
332
+ "id",
333
+ "name"
334
+ ],
335
+ additionalProperties: false
336
+ },
337
+ company: {
338
+ oneOf: [
339
+ {
340
+ type: "object",
341
+ properties: {
342
+ id: {
343
+ type: "string",
344
+ minLength: 1
345
+ }
346
+ },
347
+ required: [
348
+ "id"
349
+ ],
350
+ additionalProperties: false
351
+ },
352
+ {
353
+ type: "object",
354
+ properties: {
355
+ name: {
356
+ type: "string",
357
+ minLength: 1
358
+ }
359
+ },
360
+ required: [
361
+ "name"
362
+ ],
363
+ additionalProperties: false
364
+ }
365
+ ]
366
+ },
367
+ workplace_type: {
368
+ type: "string",
369
+ enum: [
370
+ "ON_SITE",
371
+ "HYBRID",
372
+ "REMOTE"
373
+ ]
374
+ },
375
+ location: {
376
+ type: "string",
377
+ minLength: 1
378
+ },
379
+ employment_status: {
380
+ type: "string",
381
+ enum: [
382
+ "FULL_TIME",
383
+ "PART_TIME",
384
+ "CONTRACT",
385
+ "TEMPORARY",
386
+ "OTHER",
387
+ "VOLUNTEER",
388
+ "INTERNSHIP"
389
+ ]
390
+ },
391
+ seniority_level: {
392
+ type: "string",
393
+ enum: [
394
+ "INTERNSHIP",
395
+ "ENTRY_LEVEL",
396
+ "ASSOCIATE",
397
+ "MID_SENIOR_LEVEL",
398
+ "DIRECTOR",
399
+ "EXECUTIVE",
400
+ "NOT_APPLICABLE"
401
+ ]
402
+ },
403
+ description: {
404
+ type: "string",
405
+ minLength: 200
406
+ },
407
+ industry: {
408
+ type: "array",
409
+ items: {
410
+ type: "string",
411
+ minLength: 1
412
+ }
413
+ },
414
+ job_function: {
415
+ type: "array",
416
+ items: {
417
+ type: "string",
418
+ minLength: 1
419
+ }
420
+ },
421
+ apply_method: {
422
+ oneOf: [
423
+ {
424
+ type: "object",
425
+ properties: {
426
+ method: {
427
+ type: "string",
428
+ const: "linkedin"
429
+ },
430
+ notification_email: {
431
+ type: "string"
432
+ },
433
+ resume_required: {
434
+ type: "boolean"
435
+ }
436
+ },
437
+ required: [
438
+ "method",
439
+ "notification_email"
440
+ ],
441
+ additionalProperties: false
442
+ },
443
+ {
444
+ type: "object",
445
+ properties: {
446
+ method: {
447
+ type: "string",
448
+ const: "external"
449
+ },
450
+ website_url: {
451
+ type: "string",
452
+ minLength: 1
453
+ }
454
+ },
455
+ required: [
456
+ "method",
457
+ "website_url"
458
+ ],
459
+ additionalProperties: false
460
+ }
461
+ ],
462
+ discriminator: {
463
+ propertyName: "method",
464
+ mapping: {
465
+ linkedin: "#/oneOf/0",
466
+ external: "#/oneOf/1"
467
+ }
468
+ }
469
+ },
470
+ skills: {
471
+ type: "array",
472
+ items: {
473
+ type: "string",
474
+ minLength: 1
475
+ }
476
+ },
477
+ include_poster_info: {
478
+ type: "boolean"
479
+ },
480
+ tracking_pixel_url: {
481
+ type: "string",
482
+ minLength: 1
483
+ },
484
+ company_job_id: {
485
+ type: "string",
486
+ minLength: 1
487
+ },
488
+ screening_questions: {
489
+ type: "array",
490
+ items: {
491
+ type: "object",
492
+ properties: {
493
+ question: {
494
+ type: "string",
495
+ minLength: 1
496
+ },
497
+ answer_type: {
498
+ type: "string",
499
+ minLength: 1
500
+ },
501
+ qualification_required: {
502
+ type: "boolean"
503
+ }
504
+ },
505
+ required: [
506
+ "question",
507
+ "answer_type"
508
+ ],
509
+ additionalProperties: false
510
+ }
511
+ },
512
+ salary: {
513
+ type: "object",
514
+ properties: {
515
+ currency: {
516
+ type: "string",
517
+ minLength: 1
518
+ },
519
+ pay_frequency: {
520
+ type: "string",
521
+ enum: [
522
+ "YEARLY",
523
+ "MONTHLY",
524
+ "HOURLY"
525
+ ]
526
+ },
527
+ min: {
528
+ type: "number",
529
+ minimum: 0
530
+ },
531
+ max: {
532
+ type: "number",
533
+ minimum: 0
534
+ }
535
+ },
536
+ required: [
537
+ "currency",
538
+ "pay_frequency",
539
+ "min",
540
+ "max"
541
+ ],
542
+ additionalProperties: false
543
+ },
544
+ additional_compensation: {
545
+ type: "object",
546
+ properties: {
547
+ currency: {
548
+ type: "string",
549
+ minLength: 1
550
+ },
551
+ pay_frequency: {
552
+ type: "string",
553
+ enum: [
554
+ "YEARLY",
555
+ "MONTHLY",
556
+ "HOURLY"
557
+ ]
558
+ },
559
+ min: {
560
+ type: "number",
561
+ minimum: 0
562
+ },
563
+ max: {
564
+ type: "number",
565
+ minimum: 0
566
+ }
567
+ },
568
+ required: [
569
+ "currency",
570
+ "pay_frequency",
571
+ "min",
572
+ "max"
573
+ ],
574
+ additionalProperties: false
575
+ },
576
+ rejection_settings: {
577
+ type: "object",
578
+ properties: {
579
+ send_rejection_notification: {
580
+ type: "boolean"
581
+ },
582
+ rejection_template: {
583
+ type: "string",
584
+ minLength: 1
585
+ },
586
+ reject_unqualified_applicants: {
587
+ type: "boolean"
588
+ },
589
+ reject_out_of_country_applicants: {
590
+ type: "boolean"
591
+ }
592
+ },
593
+ required: [
594
+ "send_rejection_notification"
595
+ ],
596
+ additionalProperties: false
597
+ }
598
+ },
599
+ required: [
600
+ "job_title",
601
+ "company",
602
+ "workplace_type",
603
+ "location",
604
+ "employment_status",
605
+ "seniority_level",
606
+ "description",
607
+ "industry",
608
+ "job_function",
609
+ "apply_method"
610
+ ],
611
+ additionalProperties: false
612
+ },
613
+ "core recruiter project-job update": {
614
+ type: "object",
615
+ properties: {
616
+ job_title: {
617
+ type: "object",
618
+ properties: {
619
+ id: {
620
+ type: "string",
621
+ minLength: 1
622
+ },
623
+ name: {
624
+ type: "string",
625
+ minLength: 1
626
+ }
627
+ },
628
+ required: [
629
+ "id",
630
+ "name"
631
+ ],
632
+ additionalProperties: false
633
+ },
634
+ company: {
635
+ oneOf: [
636
+ {
637
+ type: "object",
638
+ properties: {
639
+ id: {
640
+ type: "string",
641
+ minLength: 1
642
+ }
643
+ },
644
+ required: [
645
+ "id"
646
+ ],
647
+ additionalProperties: false
648
+ },
649
+ {
650
+ type: "object",
651
+ properties: {
652
+ name: {
653
+ type: "string",
654
+ minLength: 1
655
+ }
656
+ },
657
+ required: [
658
+ "name"
659
+ ],
660
+ additionalProperties: false
661
+ }
662
+ ]
663
+ },
664
+ workplace_type: {
665
+ type: "string",
666
+ enum: [
667
+ "ON_SITE",
668
+ "HYBRID",
669
+ "REMOTE"
670
+ ]
671
+ },
672
+ location: {
673
+ type: "string",
674
+ minLength: 1
675
+ },
676
+ employment_status: {
677
+ type: "string",
678
+ enum: [
679
+ "FULL_TIME",
680
+ "PART_TIME",
681
+ "CONTRACT",
682
+ "TEMPORARY",
683
+ "OTHER",
684
+ "VOLUNTEER",
685
+ "INTERNSHIP"
686
+ ]
687
+ },
688
+ seniority_level: {
689
+ type: "string",
690
+ enum: [
691
+ "INTERNSHIP",
692
+ "ENTRY_LEVEL",
693
+ "ASSOCIATE",
694
+ "MID_SENIOR_LEVEL",
695
+ "DIRECTOR",
696
+ "EXECUTIVE",
697
+ "NOT_APPLICABLE"
698
+ ]
699
+ },
700
+ description: {
701
+ type: "string",
702
+ minLength: 200
703
+ },
704
+ industry: {
705
+ type: "array",
706
+ items: {
707
+ type: "string",
708
+ minLength: 1
709
+ }
710
+ },
711
+ job_function: {
712
+ type: "array",
713
+ items: {
714
+ type: "string",
715
+ minLength: 1
716
+ }
717
+ },
718
+ apply_method: {
719
+ oneOf: [
720
+ {
721
+ type: "object",
722
+ properties: {
723
+ method: {
724
+ type: "string",
725
+ const: "linkedin"
726
+ },
727
+ notification_email: {
728
+ type: "string"
729
+ },
730
+ resume_required: {
731
+ type: "boolean"
732
+ }
733
+ },
734
+ required: [
735
+ "method",
736
+ "notification_email"
737
+ ],
738
+ additionalProperties: false
739
+ },
740
+ {
741
+ type: "object",
742
+ properties: {
743
+ method: {
744
+ type: "string",
745
+ const: "external"
746
+ },
747
+ website_url: {
748
+ type: "string",
749
+ minLength: 1
750
+ }
751
+ },
752
+ required: [
753
+ "method",
754
+ "website_url"
755
+ ],
756
+ additionalProperties: false
757
+ }
758
+ ],
759
+ discriminator: {
760
+ propertyName: "method",
761
+ mapping: {
762
+ linkedin: "#/oneOf/0",
763
+ external: "#/oneOf/1"
764
+ }
765
+ }
766
+ },
767
+ skills: {
768
+ type: "array",
769
+ items: {
770
+ type: "string",
771
+ minLength: 1
772
+ }
773
+ },
774
+ include_poster_info: {
775
+ type: "boolean"
776
+ },
777
+ tracking_pixel_url: {
778
+ type: "string",
779
+ minLength: 1
780
+ },
781
+ company_job_id: {
782
+ type: "string",
783
+ minLength: 1
784
+ },
785
+ screening_questions: {
786
+ type: "array",
787
+ items: {
788
+ type: "object",
789
+ properties: {
790
+ question: {
791
+ type: "string",
792
+ minLength: 1
793
+ },
794
+ answer_type: {
795
+ type: "string",
796
+ minLength: 1
797
+ },
798
+ qualification_required: {
799
+ type: "boolean"
800
+ }
801
+ },
802
+ required: [
803
+ "question",
804
+ "answer_type"
805
+ ],
806
+ additionalProperties: false
807
+ }
808
+ },
809
+ salary: {
810
+ type: "object",
811
+ properties: {
812
+ currency: {
813
+ type: "string",
814
+ minLength: 1
815
+ },
816
+ pay_frequency: {
817
+ type: "string",
818
+ enum: [
819
+ "YEARLY",
820
+ "MONTHLY",
821
+ "HOURLY"
822
+ ]
823
+ },
824
+ min: {
825
+ type: "number",
826
+ minimum: 0
827
+ },
828
+ max: {
829
+ type: "number",
830
+ minimum: 0
831
+ }
832
+ },
833
+ required: [
834
+ "currency",
835
+ "pay_frequency",
836
+ "min",
837
+ "max"
838
+ ],
839
+ additionalProperties: false
840
+ },
841
+ additional_compensation: {
842
+ type: "object",
843
+ properties: {
844
+ currency: {
845
+ type: "string",
846
+ minLength: 1
847
+ },
848
+ pay_frequency: {
849
+ type: "string",
850
+ enum: [
851
+ "YEARLY",
852
+ "MONTHLY",
853
+ "HOURLY"
854
+ ]
855
+ },
856
+ min: {
857
+ type: "number",
858
+ minimum: 0
859
+ },
860
+ max: {
861
+ type: "number",
862
+ minimum: 0
863
+ }
864
+ },
865
+ required: [
866
+ "currency",
867
+ "pay_frequency",
868
+ "min",
869
+ "max"
870
+ ],
871
+ additionalProperties: false
872
+ },
873
+ rejection_settings: {
874
+ type: "object",
875
+ properties: {
876
+ send_rejection_notification: {
877
+ type: "boolean"
878
+ },
879
+ rejection_template: {
880
+ type: "string",
881
+ minLength: 1
882
+ },
883
+ reject_unqualified_applicants: {
884
+ type: "boolean"
885
+ },
886
+ reject_out_of_country_applicants: {
887
+ type: "boolean"
888
+ }
889
+ },
890
+ required: [
891
+ "send_rejection_notification"
892
+ ],
893
+ additionalProperties: false
894
+ }
895
+ },
896
+ additionalProperties: false
897
+ },
898
+ "motion create": {
899
+ type: "object",
900
+ properties: {
901
+ name: {
902
+ type: "string",
903
+ minLength: 1,
904
+ maxLength: 100
905
+ },
906
+ contact_list_ids: {
907
+ type: "array",
908
+ items: {
909
+ type: "string",
910
+ minLength: 1,
911
+ maxLength: 64
912
+ }
913
+ },
914
+ exclusion_list_ids: {
915
+ type: "array",
916
+ items: {
917
+ type: "string",
918
+ minLength: 1,
919
+ maxLength: 64
920
+ }
921
+ },
922
+ account_ids: {
923
+ type: "array",
924
+ items: {
925
+ type: "string",
926
+ minLength: 1,
927
+ maxLength: 64
928
+ }
929
+ },
930
+ schedule: {
931
+ type: "object",
932
+ properties: {
933
+ timezone: {
934
+ type: "string",
935
+ maxLength: 64,
936
+ nullable: true
937
+ },
938
+ days: {
939
+ type: "array",
940
+ items: {
941
+ type: "string",
942
+ enum: [
943
+ "mon",
944
+ "tue",
945
+ "wed",
946
+ "thu",
947
+ "fri",
948
+ "sat",
949
+ "sun"
950
+ ]
951
+ }
952
+ },
953
+ hours: {
954
+ type: "object",
955
+ properties: {
956
+ start: {
957
+ type: "string"
958
+ },
959
+ end: {
960
+ type: "string"
961
+ }
962
+ },
963
+ required: [
964
+ "start",
965
+ "end"
966
+ ],
967
+ additionalProperties: false
968
+ },
969
+ start_at: {
970
+ type: "string",
971
+ nullable: true
972
+ },
973
+ end_at: {
974
+ type: "string",
975
+ nullable: true
976
+ }
977
+ },
978
+ additionalProperties: false
979
+ },
980
+ settings: {
981
+ type: "object",
982
+ properties: {
983
+ accounts_per_contact: {
984
+ type: "integer",
985
+ minimum: 1,
986
+ maximum: 10
987
+ },
988
+ assign: {
989
+ type: "string",
990
+ enum: [
991
+ "auto",
992
+ "even",
993
+ "already_connected"
994
+ ]
995
+ },
996
+ new_enrollments_per_account_per_day: {
997
+ type: "integer",
998
+ minimum: 1,
999
+ maximum: 1e3
1000
+ },
1001
+ exclude: {
1002
+ type: "object",
1003
+ properties: {
1004
+ other_motions: {
1005
+ type: "boolean"
1006
+ },
1007
+ known_chats: {
1008
+ type: "boolean"
1009
+ }
1010
+ },
1011
+ additionalProperties: false
1012
+ },
1013
+ acceptance_floor: {
1014
+ type: "object",
1015
+ properties: {
1016
+ percent: {
1017
+ type: "integer",
1018
+ minimum: 0,
1019
+ maximum: 100
1020
+ },
1021
+ min_invites: {
1022
+ type: "integer",
1023
+ minimum: 10,
1024
+ maximum: 1e3
1025
+ }
1026
+ },
1027
+ additionalProperties: false,
1028
+ nullable: true
1029
+ },
1030
+ variables: {
1031
+ type: "object",
1032
+ additionalProperties: {
1033
+ type: "string",
1034
+ minLength: 1,
1035
+ nullable: true
1036
+ }
1037
+ },
1038
+ stop_on_engagement: {
1039
+ type: "boolean"
1040
+ }
1041
+ },
1042
+ additionalProperties: false
1043
+ },
1044
+ where: {
1045
+ type: "array",
1046
+ items: {}
1047
+ },
1048
+ sequence: {}
1049
+ },
1050
+ required: [
1051
+ "name"
1052
+ ],
1053
+ additionalProperties: false,
1054
+ "x-curviate-response-only": [
1055
+ "object",
1056
+ "id",
1057
+ "status",
1058
+ "pause_reason",
1059
+ "sequence_version",
1060
+ "sequence_revision",
1061
+ "sequence_updated_by_user_id",
1062
+ "counts",
1063
+ "warnings",
1064
+ "created_by_user_id",
1065
+ "created_at",
1066
+ "updated_at",
1067
+ "started_at",
1068
+ "completed_at",
1069
+ "archived_at",
1070
+ "safety_warning"
1071
+ ]
1072
+ },
1073
+ "motion update": {
1074
+ type: "object",
1075
+ properties: {
1076
+ name: {
1077
+ type: "string",
1078
+ minLength: 1,
1079
+ maxLength: 100
1080
+ },
1081
+ contact_list_ids: {
1082
+ type: "array",
1083
+ items: {
1084
+ type: "string",
1085
+ minLength: 1,
1086
+ maxLength: 64
1087
+ }
1088
+ },
1089
+ exclusion_list_ids: {
1090
+ type: "array",
1091
+ items: {
1092
+ type: "string",
1093
+ minLength: 1,
1094
+ maxLength: 64
1095
+ }
1096
+ },
1097
+ account_ids: {
1098
+ type: "array",
1099
+ items: {
1100
+ type: "string",
1101
+ minLength: 1,
1102
+ maxLength: 64
1103
+ }
1104
+ },
1105
+ schedule: {
1106
+ type: "object",
1107
+ properties: {
1108
+ timezone: {
1109
+ type: "string",
1110
+ maxLength: 64,
1111
+ nullable: true
1112
+ },
1113
+ days: {
1114
+ type: "array",
1115
+ items: {
1116
+ type: "string",
1117
+ enum: [
1118
+ "mon",
1119
+ "tue",
1120
+ "wed",
1121
+ "thu",
1122
+ "fri",
1123
+ "sat",
1124
+ "sun"
1125
+ ]
1126
+ }
1127
+ },
1128
+ hours: {
1129
+ type: "object",
1130
+ properties: {
1131
+ start: {
1132
+ type: "string"
1133
+ },
1134
+ end: {
1135
+ type: "string"
1136
+ }
1137
+ },
1138
+ required: [
1139
+ "start",
1140
+ "end"
1141
+ ],
1142
+ additionalProperties: false
1143
+ },
1144
+ start_at: {
1145
+ type: "string",
1146
+ nullable: true
1147
+ },
1148
+ end_at: {
1149
+ type: "string",
1150
+ nullable: true
1151
+ }
1152
+ },
1153
+ additionalProperties: false
1154
+ },
1155
+ settings: {
1156
+ type: "object",
1157
+ properties: {
1158
+ accounts_per_contact: {
1159
+ type: "integer",
1160
+ minimum: 1,
1161
+ maximum: 10
1162
+ },
1163
+ assign: {
1164
+ type: "string",
1165
+ enum: [
1166
+ "auto",
1167
+ "even",
1168
+ "already_connected"
1169
+ ]
1170
+ },
1171
+ new_enrollments_per_account_per_day: {
1172
+ type: "integer",
1173
+ minimum: 1,
1174
+ maximum: 1e3
1175
+ },
1176
+ exclude: {
1177
+ type: "object",
1178
+ properties: {
1179
+ other_motions: {
1180
+ type: "boolean"
1181
+ },
1182
+ known_chats: {
1183
+ type: "boolean"
1184
+ }
1185
+ },
1186
+ additionalProperties: false
1187
+ },
1188
+ acceptance_floor: {
1189
+ type: "object",
1190
+ properties: {
1191
+ percent: {
1192
+ type: "integer",
1193
+ minimum: 0,
1194
+ maximum: 100
1195
+ },
1196
+ min_invites: {
1197
+ type: "integer",
1198
+ minimum: 10,
1199
+ maximum: 1e3
1200
+ }
1201
+ },
1202
+ additionalProperties: false,
1203
+ nullable: true
1204
+ },
1205
+ variables: {
1206
+ type: "object",
1207
+ additionalProperties: {
1208
+ type: "string",
1209
+ minLength: 1,
1210
+ nullable: true
1211
+ }
1212
+ },
1213
+ stop_on_engagement: {
1214
+ type: "boolean"
1215
+ }
1216
+ },
1217
+ additionalProperties: false
1218
+ },
1219
+ where: {
1220
+ type: "array",
1221
+ items: {}
1222
+ },
1223
+ sequence: {},
1224
+ if_sequence_revision: {
1225
+ type: "integer",
1226
+ minimum: 0
1227
+ }
1228
+ },
1229
+ additionalProperties: false,
1230
+ "x-curviate-response-only": [
1231
+ "object",
1232
+ "id",
1233
+ "status",
1234
+ "pause_reason",
1235
+ "sequence_version",
1236
+ "sequence_revision",
1237
+ "sequence_updated_by_user_id",
1238
+ "counts",
1239
+ "warnings",
1240
+ "created_by_user_id",
1241
+ "created_at",
1242
+ "updated_at",
1243
+ "started_at",
1244
+ "completed_at",
1245
+ "archived_at",
1246
+ "safety_warning"
1247
+ ]
1248
+ }
1249
+ };
1250
+
1251
+ // src/lib/document.ts
1252
+ var ENFORCED = /* @__PURE__ */ new Set(["type", "properties", "required", "additionalProperties", "enum", "const", "minLength", "maxLength", "minimum", "maximum", "items", "minItems", "maxItems", "oneOf", "nullable"]);
1253
+ var ANNOTATIONS = /* @__PURE__ */ new Set(["description", "title", "default", "discriminator"]);
1254
+ function documentSchema(key) {
1255
+ const s = documents_default[key];
1256
+ if (!s) throw new Error(`no document schema for ${key}`);
1257
+ return s;
1258
+ }
1259
+ var MAX_DOCUMENT_BYTES = 5 * 1024 * 1024;
1260
+ var TOO_LARGE = (flag) => `--${flag}: larger than ${MAX_DOCUMENT_BYTES / 1024 / 1024} MiB, the most a document may be.`;
1261
+ function readCapped(fd) {
1262
+ const chunks = [];
1263
+ let total = 0;
1264
+ const buf = Buffer.alloc(64 * 1024);
1265
+ for (; ; ) {
1266
+ let n;
1267
+ try {
1268
+ n = readSync(fd, buf, 0, buf.length, null);
1269
+ } catch (err) {
1270
+ if (err.code === "EAGAIN") continue;
1271
+ if (err.code === "EOF") break;
1272
+ throw err;
1273
+ }
1274
+ if (n === 0) break;
1275
+ total += n;
1276
+ if (total > MAX_DOCUMENT_BYTES) return null;
1277
+ chunks.push(Buffer.from(buf.subarray(0, n)));
1278
+ }
1279
+ return Buffer.concat(chunks);
1280
+ }
1281
+ async function readStdinCapped(flag = "file") {
1282
+ const chunks = [];
1283
+ let total = 0;
1284
+ for await (const chunk of process.stdin) {
1285
+ const b = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
1286
+ total += b.length;
1287
+ if (total > MAX_DOCUMENT_BYTES) usage(TOO_LARGE(flag));
1288
+ chunks.push(b);
1289
+ }
1290
+ return decode(flag, Buffer.concat(chunks)).replace(/\n+$/, "");
1291
+ }
1292
+ function decode(flag, bytes) {
1293
+ if (bytes[0] === 239 && bytes[1] === 187 && bytes[2] === 191) usage(`--${flag}: starts with a byte order mark (BOM). Save it as UTF-8 without a BOM.`);
1294
+ try {
1295
+ return new TextDecoder("utf-8", { fatal: true }).decode(bytes);
1296
+ } catch {
1297
+ usage(`--${flag}: not valid UTF-8. Save it as UTF-8.`);
1298
+ }
1299
+ }
1300
+ function usage(message) {
1301
+ process.stderr.write(`error: ${message}
1302
+ `);
1303
+ process.exit(2);
1304
+ }
1305
+ async function readFileFlag(flag, value, io = {}) {
1306
+ const v = value.trimStart();
1307
+ if (v.startsWith("{") || v.startsWith("[")) {
1308
+ usage(`--${flag} takes a path or -, not inline JSON. Pass the document on stdin: --${flag} - <<'EOF' ... EOF`);
1309
+ }
1310
+ let text;
1311
+ if (isStdinToken(value)) {
1312
+ const second = Object.entries(io.others ?? {}).find(([k, o]) => k !== flag && k !== "_" && isStdinToken(o));
1313
+ if (second) usage(`--${flag} - and --${second[0]} - both read stdin. Only one input can come from stdin.`);
1314
+ if (io.stdinIsTTY ?? process.stdin.isTTY) usage(`--${flag} -: stdin is a terminal. Pipe the document in or use a heredoc: --${flag} - <<'EOF' ... EOF`);
1315
+ text = await (io.readStdin ?? (() => readStdinCapped(flag)))();
1316
+ if (Buffer.byteLength(text) > MAX_DOCUMENT_BYTES) usage(TOO_LARGE(flag));
1317
+ } else {
1318
+ let isDir = false;
1319
+ try {
1320
+ isDir = statSync(value).isDirectory();
1321
+ } catch {
1322
+ usage(`--${flag}: no such file: ${value}`);
1323
+ }
1324
+ if (isDir) usage(`--${flag}: ${value} is a directory, not a file.`);
1325
+ let bytes;
1326
+ try {
1327
+ const fd = openSync(value, "r");
1328
+ try {
1329
+ bytes = readCapped(fd);
1330
+ } finally {
1331
+ closeSync(fd);
1332
+ }
1333
+ } catch (err) {
1334
+ usage(`--${flag}: cannot read ${value}: ${err.code ?? "read error"}.`);
1335
+ }
1336
+ if (bytes === null) usage(TOO_LARGE(flag));
1337
+ text = decode(flag, bytes);
1338
+ }
1339
+ if (text.trim() === "") usage(`--${flag}: empty input.`);
1340
+ return text;
1341
+ }
1342
+ function parseDocument(flag, text) {
1343
+ try {
1344
+ return JSON.parse(text);
1345
+ } catch (err) {
1346
+ const msg = err instanceof Error ? err.message : "";
1347
+ const lc = /line (\d+) column (\d+)/.exec(msg);
1348
+ const pos = /position (\d+)/.exec(msg);
1349
+ let at = "";
1350
+ if (lc) at = ` at line ${lc[1]}, column ${lc[2]}`;
1351
+ else {
1352
+ const before = text.slice(0, pos ? Number(pos[1]) : text.length).split("\n");
1353
+ at = ` at line ${before.length}, column ${before[before.length - 1].length + 1}`;
1354
+ }
1355
+ usage(`--${flag}: not valid JSON${at}.`);
1356
+ }
1357
+ }
1358
+ var own = (o, k) => Object.prototype.hasOwnProperty.call(o, k);
1359
+ var typeOf = (v) => v === null ? "null" : Array.isArray(v) ? "array" : typeof v;
1360
+ var isType = (v, t) => t === "integer" ? Number.isInteger(v) : t === "number" ? typeof v === "number" : typeOf(v) === t;
1361
+ var join = (path, key) => path ? `${path}.${key}` : String(key);
1362
+ function assertKnown(schema) {
1363
+ for (const k of Object.keys(schema)) {
1364
+ if (!ENFORCED.has(k) && !ANNOTATIONS.has(k) && !k.startsWith("x-")) throw new Error(`document schema keyword not supported by the validator: ${k}`);
1365
+ }
1366
+ }
1367
+ function validate(schema, value, path = "") {
1368
+ assertKnown(schema);
1369
+ const at = path || "(document)";
1370
+ const out = [];
1371
+ if (Array.isArray(schema["oneOf"])) {
1372
+ const branches = schema["oneOf"];
1373
+ const disc = schema["discriminator"]?.propertyName;
1374
+ if (disc && value && typeof value === "object" && own(value, disc)) {
1375
+ const tag = value[disc];
1376
+ const hit = branches.find((b) => b["properties"]?.[disc]?.["const"] === tag);
1377
+ if (hit) return validate(hit, value, path);
1378
+ const tags = branches.map((b) => b["properties"]?.[disc]?.["const"]).join(", ");
1379
+ return [{ path: join(path, disc), rule: `must be one of ${tags}` }];
1380
+ }
1381
+ const results = branches.map((b) => validate(b, value, path));
1382
+ if (results.some((r) => r.length === 0)) return [];
1383
+ return [{ path: at, rule: `must match one of: ${branches.map(shape).join(" | ")}` }];
1384
+ }
1385
+ if (value === null && schema["nullable"] === true) return out;
1386
+ const t = schema["type"];
1387
+ if (t && !isType(value, t)) return [{ path: at, rule: `must be ${t === "array" || t === "object" || t === "integer" ? "an" : "a"} ${t}` }];
1388
+ if ("const" in schema && value !== schema["const"]) out.push({ path: at, rule: `must be ${JSON.stringify(schema["const"])}` });
1389
+ if (Array.isArray(schema["enum"]) && !schema["enum"].includes(value)) out.push({ path: at, rule: `must be one of ${schema["enum"].join(", ")}` });
1390
+ if (typeof value === "string") {
1391
+ if (typeof schema["minLength"] === "number" && value.length < schema["minLength"]) out.push({ path: at, rule: schema["minLength"] === 1 ? "must not be empty" : `must be at least ${schema["minLength"]} characters` });
1392
+ if (typeof schema["maxLength"] === "number" && value.length > schema["maxLength"]) out.push({ path: at, rule: `must be at most ${schema["maxLength"]} characters` });
1393
+ }
1394
+ if (typeof value === "number") {
1395
+ if (typeof schema["minimum"] === "number" && value < schema["minimum"]) out.push({ path: at, rule: `must be at least ${schema["minimum"]}` });
1396
+ if (typeof schema["maximum"] === "number" && value > schema["maximum"]) out.push({ path: at, rule: `must be at most ${schema["maximum"]}` });
1397
+ }
1398
+ if (Array.isArray(value)) {
1399
+ if (typeof schema["minItems"] === "number" && value.length < schema["minItems"]) out.push({ path: at, rule: `must have at least ${schema["minItems"]} items` });
1400
+ if (typeof schema["maxItems"] === "number" && value.length > schema["maxItems"]) out.push({ path: at, rule: `must have at most ${schema["maxItems"]} items` });
1401
+ if (schema["items"]) value.forEach((item, i) => out.push(...validate(schema["items"], item, join(path, i))));
1402
+ }
1403
+ if (value && typeof value === "object" && !Array.isArray(value)) {
1404
+ const props = schema["properties"] ?? {};
1405
+ const obj = value;
1406
+ for (const key of Object.keys(obj)) {
1407
+ if (own(props, key)) out.push(...validate(props[key], obj[key], join(path, key)));
1408
+ else if (schema["additionalProperties"] === false) {
1409
+ const near = Object.keys(props).filter((p) => editDistance(key, p) <= 2).sort((a, b) => editDistance(key, a) - editDistance(key, b))[0];
1410
+ out.push({ path: join(path, key), rule: "unknown field", ...near ? { suggestion: near } : {} });
1411
+ }
1412
+ }
1413
+ for (const req of schema["required"] ?? []) {
1414
+ if (!own(obj, req)) out.push({ path: join(path, req), rule: "required" });
1415
+ }
1416
+ }
1417
+ return out;
1418
+ }
1419
+ function shape(s) {
1420
+ const req = s["required"] ?? Object.keys(s["properties"] ?? {});
1421
+ return `{${req.join(", ")}}`;
1422
+ }
1423
+ function reportIssues(issues, json, out = process) {
1424
+ const line = (i) => `${i.path}: ${i.rule}${i.suggestion ? ` (did you mean ${i.suggestion}?)` : ""}`;
1425
+ const message = `The document has ${issues.length} problem${issues.length === 1 ? "" : "s"}.`;
1426
+ if (json) out.stdout.write(JSON.stringify({ error: { code: "INVALID_REQUEST", message, errors: issues } }) + "\n");
1427
+ out.stderr.write(`error: ${message}
1428
+ ${issues.map((i) => ` ${line(i)}
1429
+ `).join("")}`);
1430
+ process.exit(2);
1431
+ }
1432
+ function ruleOf(s) {
1433
+ if (Array.isArray(s["oneOf"])) return `one of ${s["oneOf"].map(shape).join(" | ")}`;
1434
+ const r = [];
1435
+ if (Array.isArray(s["enum"])) r.push(`one of ${s["enum"].join(", ")}`);
1436
+ if ("const" in s) r.push(`exactly ${JSON.stringify(s["const"])}`);
1437
+ if (typeof s["minLength"] === "number" && s["minLength"] > 1) r.push(`at least ${s["minLength"]} characters`);
1438
+ if (s["minLength"] === 1) r.push("non-empty");
1439
+ if (typeof s["maxLength"] === "number") r.push(`at most ${s["maxLength"]} characters`);
1440
+ if (typeof s["minimum"] === "number") r.push(`at least ${s["minimum"]}`);
1441
+ if (typeof s["maximum"] === "number") r.push(`at most ${s["maximum"]}`);
1442
+ if (typeof s["minItems"] === "number") r.push(`at least ${s["minItems"]} items`);
1443
+ if (typeof s["maxItems"] === "number") r.push(`at most ${s["maxItems"]} items`);
1444
+ return r.join("; ");
1445
+ }
1446
+ var typeName = (s) => Array.isArray(s["oneOf"]) ? "object" : s["type"] === "array" && s["items"] ? `${typeName(s["items"])}[]` : String(s["type"] ?? "any");
1447
+ function renderDocument(key) {
1448
+ const rows = /* @__PURE__ */ new Map();
1449
+ const walk = (s, prefix, when, branches = 1) => {
1450
+ const props = s["properties"] ?? {};
1451
+ const req = new Set(s["required"] ?? []);
1452
+ for (const [name, p] of Object.entries(props)) {
1453
+ const path = prefix ? `${prefix}.${name}` : name;
1454
+ const row = rows.get(path) ?? { type: typeName(p), req: [], def: "", rules: [], branches };
1455
+ rows.set(path, row);
1456
+ row.req.push(req.has(name) ? when ? `required ${when}` : "required" : "optional");
1457
+ if ("default" in p) row.def = `default ${JSON.stringify(p["default"])}`;
1458
+ row.rules.push(ruleOf(p));
1459
+ if (p["type"] === "object" && p["properties"]) walk(p, path);
1460
+ const oneOf = p["oneOf"] ?? [];
1461
+ const disc = p["discriminator"]?.propertyName;
1462
+ for (const b of oneOf) {
1463
+ const tag = disc ? b["properties"]?.[disc]?.["const"] : void 0;
1464
+ walk(b, path, tag !== void 0 ? `if ${disc} is ${JSON.stringify(tag)}` : `in ${shape(b)}`, oneOf.length);
1465
+ }
1466
+ const items = p["items"];
1467
+ if (items?.["type"] === "object") walk(items, `${path}[]`);
1468
+ }
1469
+ };
1470
+ walk(documentSchema(key), "");
1471
+ const merged = [...rows].map(([path, r]) => {
1472
+ const everywhere = r.req.length === r.branches && r.req.every((q) => q.startsWith("required"));
1473
+ const req = everywhere ? "required" : [...new Set(r.req)].join(", ");
1474
+ const consts = r.rules.map((x) => /^exactly (".*")$/.exec(x)?.[1]);
1475
+ const rule = r.rules.length > 1 && consts.every(Boolean) ? `one of ${[...new Set(consts.map((c) => JSON.parse(c)))].join(", ")}` : [...new Set(r.rules.filter(Boolean))].join(" | ");
1476
+ return [path, r.type, req, r.def, rule];
1477
+ });
1478
+ const widths = [0, 1, 2].map((c) => Math.max(...merged.map((r) => r[c].length)));
1479
+ return merged.map((r) => [r[0].padEnd(widths[0]), r[1].padEnd(widths[1]), r[2].padEnd(widths[2]), r[3], r[4]].filter(Boolean).join(" ").trimEnd());
1480
+ }
1481
+
1482
+ export {
1483
+ ENFORCED,
1484
+ ANNOTATIONS,
1485
+ documentSchema,
1486
+ MAX_DOCUMENT_BYTES,
1487
+ readStdinCapped,
1488
+ readFileFlag,
1489
+ parseDocument,
1490
+ validate,
1491
+ reportIssues,
1492
+ renderDocument
1493
+ };