@paklo/core 0.3.0 → 0.5.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 (51) hide show
  1. package/LICENSE +664 -21
  2. package/dist/azure/{index.d.ts → index.d.mts} +56 -24
  3. package/dist/azure/{index.js → index.mjs} +66 -10
  4. package/dist/azure/index.mjs.map +1 -0
  5. package/dist/dependabot/index.d.mts +3 -0
  6. package/dist/dependabot/{index.js → index.mjs} +5 -5
  7. package/dist/{dependabot-B5pw4XDa.js → dependabot-C6dqpHHO.mjs} +4 -9
  8. package/dist/dependabot-C6dqpHHO.mjs.map +1 -0
  9. package/dist/environment/{index.d.ts → index.d.mts} +1 -1
  10. package/dist/environment/{index.js → index.mjs} +1 -1
  11. package/dist/{environment-DX5CD-dD.js → environment-Bn2AKsNP.mjs} +1 -1
  12. package/dist/environment-Bn2AKsNP.mjs.map +1 -0
  13. package/dist/github/index.d.mts +2 -0
  14. package/dist/github/{index.js → index.mjs} +81 -46
  15. package/dist/github/index.mjs.map +1 -0
  16. package/dist/http/{index.d.ts → index.d.mts} +1 -1
  17. package/dist/http/{index.js → index.mjs} +2 -2
  18. package/dist/{http-Be3uWaqn.js → http-BVlIr273.mjs} +2 -2
  19. package/dist/http-BVlIr273.mjs.map +1 -0
  20. package/dist/{index-3wZw74Ah.d.ts → index-B5hYujx0.d.mts} +30 -12
  21. package/dist/{index-Dr0PB1As.d.ts → index-Djd8_Qnk.d.mts} +91 -32
  22. package/dist/{job-CxYcRj_D.js → job-CYxNnXAx.mjs} +10 -1
  23. package/dist/job-CYxNnXAx.mjs.map +1 -0
  24. package/dist/keygen.d.mts +42 -0
  25. package/dist/keygen.mjs +58 -0
  26. package/dist/keygen.mjs.map +1 -0
  27. package/dist/logger-BhxvmS3E.mjs +14 -0
  28. package/dist/logger-BhxvmS3E.mjs.map +1 -0
  29. package/dist/logger.d.mts +7 -0
  30. package/dist/logger.mjs +4 -0
  31. package/dist/shared-data/{index.d.ts → index.d.mts} +1 -1
  32. package/dist/shared-data/{index.js → index.mjs} +1 -1
  33. package/dist/shared-data/index.mjs.map +1 -0
  34. package/dist/{usage.d.ts → usage.d.mts} +1 -1
  35. package/dist/{usage.js → usage.mjs} +2 -2
  36. package/dist/usage.mjs.map +1 -0
  37. package/package.json +23 -18
  38. package/dist/azure/index.js.map +0 -1
  39. package/dist/dependabot/index.d.ts +0 -3
  40. package/dist/dependabot-B5pw4XDa.js.map +0 -1
  41. package/dist/environment-DX5CD-dD.js.map +0 -1
  42. package/dist/github/index.d.ts +0 -2
  43. package/dist/github/index.js.map +0 -1
  44. package/dist/http-Be3uWaqn.js.map +0 -1
  45. package/dist/job-CxYcRj_D.js.map +0 -1
  46. package/dist/logger-bWnHxtAf.js +0 -31
  47. package/dist/logger-bWnHxtAf.js.map +0 -1
  48. package/dist/logger.d.ts +0 -23
  49. package/dist/logger.js +0 -4
  50. package/dist/shared-data/index.js.map +0 -1
  51. package/dist/usage.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { p as SecurityVulnerability } from "./index-3wZw74Ah.js";
1
+ import { p as SecurityVulnerability } from "./index-B5hYujx0.mjs";
2
2
  import { z } from "zod/v4";
3
3
  import { Hono } from "hono";
4
4
 
@@ -113,11 +113,11 @@ type DependabotGroup = z.infer<typeof DependabotGroupSchema>;
113
113
  declare const DependabotAllowConditionSchema: z.ZodObject<{
114
114
  'dependency-name': z.ZodOptional<z.ZodString>;
115
115
  'dependency-type': z.ZodOptional<z.ZodEnum<{
116
- all: "all";
117
116
  development: "development";
118
117
  production: "production";
119
118
  direct: "direct";
120
119
  indirect: "indirect";
120
+ all: "all";
121
121
  }>>;
122
122
  'update-type': z.ZodOptional<z.ZodEnum<{
123
123
  all: "all";
@@ -135,7 +135,7 @@ declare const DependabotIgnoreConditionSchema: z.ZodIntersection<z.ZodObject<{
135
135
  }>>>;
136
136
  }, z.core.$strip>, z.ZodRecord<z.ZodString, z.ZodAny>>;
137
137
  type DependabotIgnoreCondition = z.infer<typeof DependabotIgnoreConditionSchema>;
138
- declare const DependabotScheduleSchema: z.ZodObject<{
138
+ declare const DependabotScheduleSchema: z.ZodPipe<z.ZodObject<{
139
139
  interval: z.ZodEnum<{
140
140
  daily: "daily";
141
141
  weekly: "weekly";
@@ -157,7 +157,19 @@ declare const DependabotScheduleSchema: z.ZodObject<{
157
157
  time: z.ZodOptional<z.ZodDefault<z.ZodString>>;
158
158
  timezone: z.ZodDefault<z.ZodOptional<z.ZodString>>;
159
159
  cronjob: z.ZodOptional<z.ZodString>;
160
- }, z.core.$strip>;
160
+ }, z.core.$strip>, z.ZodTransform<{
161
+ interval: "daily" | "weekly" | "monthly" | "quarterly" | "semiannually" | "yearly" | "cron";
162
+ day: "sunday" | "monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday";
163
+ timezone: string;
164
+ time?: string | undefined;
165
+ cronjob?: string | undefined;
166
+ }, {
167
+ interval: "daily" | "weekly" | "monthly" | "quarterly" | "semiannually" | "yearly" | "cron";
168
+ day: "sunday" | "monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday";
169
+ timezone: string;
170
+ time?: string | undefined;
171
+ cronjob?: string | undefined;
172
+ }>>;
161
173
  type DependabotSchedule = z.infer<typeof DependabotScheduleSchema>;
162
174
  declare const DependabotCommitMessageSchema: z.ZodObject<{
163
175
  prefix: z.ZodOptional<z.ZodString>;
@@ -213,10 +225,10 @@ declare const PackageEcosystemSchema: z.ZodEnum<{
213
225
  }>;
214
226
  type PackageEcosystem = z.infer<typeof PackageEcosystemSchema>;
215
227
  declare const VersioningStrategySchema: z.ZodEnum<{
216
- "lockfile-only": "lockfile-only";
217
228
  auto: "auto";
218
229
  increase: "increase";
219
230
  "increase-if-necessary": "increase-if-necessary";
231
+ "lockfile-only": "lockfile-only";
220
232
  widen: "widen";
221
233
  }>;
222
234
  type VersioningStrategy = z.infer<typeof VersioningStrategySchema>;
@@ -260,11 +272,11 @@ declare const DependabotUpdateSchema: z.ZodPipe<z.ZodObject<{
260
272
  allow: z.ZodOptional<z.ZodArray<z.ZodObject<{
261
273
  'dependency-name': z.ZodOptional<z.ZodString>;
262
274
  'dependency-type': z.ZodOptional<z.ZodEnum<{
263
- all: "all";
264
275
  development: "development";
265
276
  production: "production";
266
277
  direct: "direct";
267
278
  indirect: "indirect";
279
+ all: "all";
268
280
  }>>;
269
281
  'update-type': z.ZodOptional<z.ZodEnum<{
270
282
  all: "all";
@@ -324,7 +336,7 @@ declare const DependabotUpdateSchema: z.ZodPipe<z.ZodObject<{
324
336
  }, z.core.$strip>>;
325
337
  'rebase-strategy': z.ZodOptional<z.ZodString>;
326
338
  registries: z.ZodOptional<z.ZodArray<z.ZodString>>;
327
- schedule: z.ZodOptional<z.ZodObject<{
339
+ schedule: z.ZodOptional<z.ZodPipe<z.ZodObject<{
328
340
  interval: z.ZodEnum<{
329
341
  daily: "daily";
330
342
  weekly: "weekly";
@@ -346,14 +358,26 @@ declare const DependabotUpdateSchema: z.ZodPipe<z.ZodObject<{
346
358
  time: z.ZodOptional<z.ZodDefault<z.ZodString>>;
347
359
  timezone: z.ZodDefault<z.ZodOptional<z.ZodString>>;
348
360
  cronjob: z.ZodOptional<z.ZodString>;
349
- }, z.core.$strip>>;
361
+ }, z.core.$strip>, z.ZodTransform<{
362
+ interval: "daily" | "weekly" | "monthly" | "quarterly" | "semiannually" | "yearly" | "cron";
363
+ day: "sunday" | "monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday";
364
+ timezone: string;
365
+ time?: string | undefined;
366
+ cronjob?: string | undefined;
367
+ }, {
368
+ interval: "daily" | "weekly" | "monthly" | "quarterly" | "semiannually" | "yearly" | "cron";
369
+ day: "sunday" | "monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday";
370
+ timezone: string;
371
+ time?: string | undefined;
372
+ cronjob?: string | undefined;
373
+ }>>>;
350
374
  'target-branch': z.ZodOptional<z.ZodString>;
351
375
  vendor: z.ZodOptional<z.ZodBoolean>;
352
376
  'versioning-strategy': z.ZodOptional<z.ZodEnum<{
353
- "lockfile-only": "lockfile-only";
354
377
  auto: "auto";
355
378
  increase: "increase";
356
379
  "increase-if-necessary": "increase-if-necessary";
380
+ "lockfile-only": "lockfile-only";
357
381
  widen: "widen";
358
382
  }>>;
359
383
  patterns: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -365,7 +389,7 @@ declare const DependabotUpdateSchema: z.ZodPipe<z.ZodObject<{
365
389
  'exclude-paths'?: string[] | undefined;
366
390
  allow?: {
367
391
  'dependency-name'?: string | undefined;
368
- 'dependency-type'?: "all" | "development" | "production" | "direct" | "indirect" | undefined;
392
+ 'dependency-type'?: "development" | "production" | "direct" | "indirect" | "all" | undefined;
369
393
  'update-type'?: "all" | "security" | undefined;
370
394
  }[] | undefined;
371
395
  assignees?: string[] | undefined;
@@ -413,7 +437,7 @@ declare const DependabotUpdateSchema: z.ZodPipe<z.ZodObject<{
413
437
  } | undefined;
414
438
  'target-branch'?: string | undefined;
415
439
  vendor?: boolean | undefined;
416
- 'versioning-strategy'?: "lockfile-only" | "auto" | "increase" | "increase-if-necessary" | "widen" | undefined;
440
+ 'versioning-strategy'?: "auto" | "increase" | "increase-if-necessary" | "lockfile-only" | "widen" | undefined;
417
441
  patterns?: string[] | undefined;
418
442
  'multi-ecosystem-group'?: string | undefined;
419
443
  }, {
@@ -423,7 +447,7 @@ declare const DependabotUpdateSchema: z.ZodPipe<z.ZodObject<{
423
447
  'exclude-paths'?: string[] | undefined;
424
448
  allow?: {
425
449
  'dependency-name'?: string | undefined;
426
- 'dependency-type'?: "all" | "development" | "production" | "direct" | "indirect" | undefined;
450
+ 'dependency-type'?: "development" | "production" | "direct" | "indirect" | "all" | undefined;
427
451
  'update-type'?: "all" | "security" | undefined;
428
452
  }[] | undefined;
429
453
  assignees?: string[] | undefined;
@@ -471,13 +495,13 @@ declare const DependabotUpdateSchema: z.ZodPipe<z.ZodObject<{
471
495
  } | undefined;
472
496
  'target-branch'?: string | undefined;
473
497
  vendor?: boolean | undefined;
474
- 'versioning-strategy'?: "lockfile-only" | "auto" | "increase" | "increase-if-necessary" | "widen" | undefined;
498
+ 'versioning-strategy'?: "auto" | "increase" | "increase-if-necessary" | "lockfile-only" | "widen" | undefined;
475
499
  patterns?: string[] | undefined;
476
500
  'multi-ecosystem-group'?: string | undefined;
477
501
  }>>;
478
502
  type DependabotUpdate = z.infer<typeof DependabotUpdateSchema>;
479
503
  declare const DependabotMultiEcosystemGroupSchema: z.ZodObject<{
480
- schedule: z.ZodObject<{
504
+ schedule: z.ZodPipe<z.ZodObject<{
481
505
  interval: z.ZodEnum<{
482
506
  daily: "daily";
483
507
  weekly: "weekly";
@@ -499,7 +523,19 @@ declare const DependabotMultiEcosystemGroupSchema: z.ZodObject<{
499
523
  time: z.ZodOptional<z.ZodDefault<z.ZodString>>;
500
524
  timezone: z.ZodDefault<z.ZodOptional<z.ZodString>>;
501
525
  cronjob: z.ZodOptional<z.ZodString>;
502
- }, z.core.$strip>;
526
+ }, z.core.$strip>, z.ZodTransform<{
527
+ interval: "daily" | "weekly" | "monthly" | "quarterly" | "semiannually" | "yearly" | "cron";
528
+ day: "sunday" | "monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday";
529
+ timezone: string;
530
+ time?: string | undefined;
531
+ cronjob?: string | undefined;
532
+ }, {
533
+ interval: "daily" | "weekly" | "monthly" | "quarterly" | "semiannually" | "yearly" | "cron";
534
+ day: "sunday" | "monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday";
535
+ timezone: string;
536
+ time?: string | undefined;
537
+ cronjob?: string | undefined;
538
+ }>>;
503
539
  labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
504
540
  milestone: z.ZodOptional<z.ZodCoercedString<unknown>>;
505
541
  assignees: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -521,7 +557,7 @@ type DependabotMultiEcosystemGroup = z.infer<typeof DependabotMultiEcosystemGrou
521
557
  declare const DependabotConfigSchema: z.ZodPipe<z.ZodObject<{
522
558
  version: z.ZodNumber;
523
559
  'multi-ecosystem-groups': z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
524
- schedule: z.ZodObject<{
560
+ schedule: z.ZodPipe<z.ZodObject<{
525
561
  interval: z.ZodEnum<{
526
562
  daily: "daily";
527
563
  weekly: "weekly";
@@ -543,7 +579,19 @@ declare const DependabotConfigSchema: z.ZodPipe<z.ZodObject<{
543
579
  time: z.ZodOptional<z.ZodDefault<z.ZodString>>;
544
580
  timezone: z.ZodDefault<z.ZodOptional<z.ZodString>>;
545
581
  cronjob: z.ZodOptional<z.ZodString>;
546
- }, z.core.$strip>;
582
+ }, z.core.$strip>, z.ZodTransform<{
583
+ interval: "daily" | "weekly" | "monthly" | "quarterly" | "semiannually" | "yearly" | "cron";
584
+ day: "sunday" | "monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday";
585
+ timezone: string;
586
+ time?: string | undefined;
587
+ cronjob?: string | undefined;
588
+ }, {
589
+ interval: "daily" | "weekly" | "monthly" | "quarterly" | "semiannually" | "yearly" | "cron";
590
+ day: "sunday" | "monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday";
591
+ timezone: string;
592
+ time?: string | undefined;
593
+ cronjob?: string | undefined;
594
+ }>>;
547
595
  labels: z.ZodOptional<z.ZodArray<z.ZodString>>;
548
596
  milestone: z.ZodOptional<z.ZodCoercedString<unknown>>;
549
597
  assignees: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -597,11 +645,11 @@ declare const DependabotConfigSchema: z.ZodPipe<z.ZodObject<{
597
645
  allow: z.ZodOptional<z.ZodArray<z.ZodObject<{
598
646
  'dependency-name': z.ZodOptional<z.ZodString>;
599
647
  'dependency-type': z.ZodOptional<z.ZodEnum<{
600
- all: "all";
601
648
  development: "development";
602
649
  production: "production";
603
650
  direct: "direct";
604
651
  indirect: "indirect";
652
+ all: "all";
605
653
  }>>;
606
654
  'update-type': z.ZodOptional<z.ZodEnum<{
607
655
  all: "all";
@@ -661,7 +709,7 @@ declare const DependabotConfigSchema: z.ZodPipe<z.ZodObject<{
661
709
  }, z.core.$strip>>;
662
710
  'rebase-strategy': z.ZodOptional<z.ZodString>;
663
711
  registries: z.ZodOptional<z.ZodArray<z.ZodString>>;
664
- schedule: z.ZodOptional<z.ZodObject<{
712
+ schedule: z.ZodOptional<z.ZodPipe<z.ZodObject<{
665
713
  interval: z.ZodEnum<{
666
714
  daily: "daily";
667
715
  weekly: "weekly";
@@ -683,14 +731,26 @@ declare const DependabotConfigSchema: z.ZodPipe<z.ZodObject<{
683
731
  time: z.ZodOptional<z.ZodDefault<z.ZodString>>;
684
732
  timezone: z.ZodDefault<z.ZodOptional<z.ZodString>>;
685
733
  cronjob: z.ZodOptional<z.ZodString>;
686
- }, z.core.$strip>>;
734
+ }, z.core.$strip>, z.ZodTransform<{
735
+ interval: "daily" | "weekly" | "monthly" | "quarterly" | "semiannually" | "yearly" | "cron";
736
+ day: "sunday" | "monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday";
737
+ timezone: string;
738
+ time?: string | undefined;
739
+ cronjob?: string | undefined;
740
+ }, {
741
+ interval: "daily" | "weekly" | "monthly" | "quarterly" | "semiannually" | "yearly" | "cron";
742
+ day: "sunday" | "monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday";
743
+ timezone: string;
744
+ time?: string | undefined;
745
+ cronjob?: string | undefined;
746
+ }>>>;
687
747
  'target-branch': z.ZodOptional<z.ZodString>;
688
748
  vendor: z.ZodOptional<z.ZodBoolean>;
689
749
  'versioning-strategy': z.ZodOptional<z.ZodEnum<{
690
- "lockfile-only": "lockfile-only";
691
750
  auto: "auto";
692
751
  increase: "increase";
693
752
  "increase-if-necessary": "increase-if-necessary";
753
+ "lockfile-only": "lockfile-only";
694
754
  widen: "widen";
695
755
  }>>;
696
756
  patterns: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -702,7 +762,7 @@ declare const DependabotConfigSchema: z.ZodPipe<z.ZodObject<{
702
762
  'exclude-paths'?: string[] | undefined;
703
763
  allow?: {
704
764
  'dependency-name'?: string | undefined;
705
- 'dependency-type'?: "all" | "development" | "production" | "direct" | "indirect" | undefined;
765
+ 'dependency-type'?: "development" | "production" | "direct" | "indirect" | "all" | undefined;
706
766
  'update-type'?: "all" | "security" | undefined;
707
767
  }[] | undefined;
708
768
  assignees?: string[] | undefined;
@@ -750,7 +810,7 @@ declare const DependabotConfigSchema: z.ZodPipe<z.ZodObject<{
750
810
  } | undefined;
751
811
  'target-branch'?: string | undefined;
752
812
  vendor?: boolean | undefined;
753
- 'versioning-strategy'?: "lockfile-only" | "auto" | "increase" | "increase-if-necessary" | "widen" | undefined;
813
+ 'versioning-strategy'?: "auto" | "increase" | "increase-if-necessary" | "lockfile-only" | "widen" | undefined;
754
814
  patterns?: string[] | undefined;
755
815
  'multi-ecosystem-group'?: string | undefined;
756
816
  }, {
@@ -760,7 +820,7 @@ declare const DependabotConfigSchema: z.ZodPipe<z.ZodObject<{
760
820
  'exclude-paths'?: string[] | undefined;
761
821
  allow?: {
762
822
  'dependency-name'?: string | undefined;
763
- 'dependency-type'?: "all" | "development" | "production" | "direct" | "indirect" | undefined;
823
+ 'dependency-type'?: "development" | "production" | "direct" | "indirect" | "all" | undefined;
764
824
  'update-type'?: "all" | "security" | undefined;
765
825
  }[] | undefined;
766
826
  assignees?: string[] | undefined;
@@ -808,7 +868,7 @@ declare const DependabotConfigSchema: z.ZodPipe<z.ZodObject<{
808
868
  } | undefined;
809
869
  'target-branch'?: string | undefined;
810
870
  vendor?: boolean | undefined;
811
- 'versioning-strategy'?: "lockfile-only" | "auto" | "increase" | "increase-if-necessary" | "widen" | undefined;
871
+ 'versioning-strategy'?: "auto" | "increase" | "increase-if-necessary" | "lockfile-only" | "widen" | undefined;
812
872
  patterns?: string[] | undefined;
813
873
  'multi-ecosystem-group'?: string | undefined;
814
874
  }>>>;
@@ -890,7 +950,7 @@ declare const DependabotConfigSchema: z.ZodPipe<z.ZodObject<{
890
950
  'exclude-paths'?: string[] | undefined;
891
951
  allow?: {
892
952
  'dependency-name'?: string | undefined;
893
- 'dependency-type'?: "all" | "development" | "production" | "direct" | "indirect" | undefined;
953
+ 'dependency-type'?: "development" | "production" | "direct" | "indirect" | "all" | undefined;
894
954
  'update-type'?: "all" | "security" | undefined;
895
955
  }[] | undefined;
896
956
  assignees?: string[] | undefined;
@@ -938,7 +998,7 @@ declare const DependabotConfigSchema: z.ZodPipe<z.ZodObject<{
938
998
  } | undefined;
939
999
  'target-branch'?: string | undefined;
940
1000
  vendor?: boolean | undefined;
941
- 'versioning-strategy'?: "lockfile-only" | "auto" | "increase" | "increase-if-necessary" | "widen" | undefined;
1001
+ 'versioning-strategy'?: "auto" | "increase" | "increase-if-necessary" | "lockfile-only" | "widen" | undefined;
942
1002
  patterns?: string[] | undefined;
943
1003
  'multi-ecosystem-group'?: string | undefined;
944
1004
  }[];
@@ -991,7 +1051,7 @@ declare const DependabotConfigSchema: z.ZodPipe<z.ZodObject<{
991
1051
  'exclude-paths'?: string[] | undefined;
992
1052
  allow?: {
993
1053
  'dependency-name'?: string | undefined;
994
- 'dependency-type'?: "all" | "development" | "production" | "direct" | "indirect" | undefined;
1054
+ 'dependency-type'?: "development" | "production" | "direct" | "indirect" | "all" | undefined;
995
1055
  'update-type'?: "all" | "security" | undefined;
996
1056
  }[] | undefined;
997
1057
  assignees?: string[] | undefined;
@@ -1039,7 +1099,7 @@ declare const DependabotConfigSchema: z.ZodPipe<z.ZodObject<{
1039
1099
  } | undefined;
1040
1100
  'target-branch'?: string | undefined;
1041
1101
  vendor?: boolean | undefined;
1042
- 'versioning-strategy'?: "lockfile-only" | "auto" | "increase" | "increase-if-necessary" | "widen" | undefined;
1102
+ 'versioning-strategy'?: "auto" | "increase" | "increase-if-necessary" | "lockfile-only" | "widen" | undefined;
1043
1103
  patterns?: string[] | undefined;
1044
1104
  'multi-ecosystem-group'?: string | undefined;
1045
1105
  }[];
@@ -1653,7 +1713,6 @@ declare function mapCredentials({
1653
1713
  registries?: Record<string, DependabotRegistry>;
1654
1714
  }): DependabotCredential[];
1655
1715
  declare function makeRandomJobId(): number;
1656
- declare function makeRandomJobToken(): string;
1657
1716
  //#endregion
1658
1717
  //#region src/dependabot/server.d.ts
1659
1718
  declare const DependabotRequestTypeSchema: z.ZodEnum<{
@@ -2080,5 +2139,5 @@ declare const DependabotMetricSchema: z.ZodObject<{
2080
2139
  }, z.core.$strip>;
2081
2140
  type DependabotMetric = z.infer<typeof DependabotMetricSchema>;
2082
2141
  //#endregion
2083
- export { sanitizeRef as $, DependabotGroup as $t, DependabotRequest as A, DependabotProxyConfig as At, makeRandomJobToken as B, DependabotSourceProviderSchema as Bt, DependabotRecordUpdateJobUnknownError as C, extractPlaceholder as Cn, DependabotGroupRuleJobSchema as Ct, DependabotUpdatePullRequest as D, DependabotJobFileSchema as Dt, DependabotUpdateDependencyListSchema as E, GitAuthor as En, DependabotJobFile as Et, createApiServerApp as F, DependabotRequirementSourceSchema as Ft, mapIgnoreConditionsFromDependabotConfigToJobConfig as G, DependabotAllowCondition as Gt, mapCredentials as H, FetchedFiles as Ht, DependabotJobBuilder as I, DependabotSecurityAdvisory as It, mapSourceFromDependabotConfigToJobConfig as J, DependabotCommitMessageSchema as Jt, mapPackageEcosystemToPackageManager as K, DependabotAllowConditionSchema as Kt, DependabotJobBuilderOutput as L, DependabotSecurityAdvisorySchema as Lt, DependabotRequestType as M, DependabotRequirement as Mt, DependabotRequestTypeSchema as N, DependabotRequirementSchema as Nt, DependabotUpdatePullRequestSchema as O, DependabotPackageManager as Ot, DependabotTokenType as P, DependabotRequirementSource as Pt, getBranchNameForUpdate as Q, DependabotCooldownSchema as Qt, DependabotSourceInfo as R, DependabotSource as Rt, DependabotRecordUpdateJobErrorSchema as S, convertPlaceholder as Sn, DependabotGroupRuleJob as St, DependabotUpdateDependencyList as T, DEPENDABOT_DEFAULT_AUTHOR_NAME as Tn, DependabotJobConfigSchema as Tt, mapExperiments as U, FileFetcherInput as Ut, mapAllowedUpdatesFromDependabotConfigToJobConfig as V, DependabotSourceSchema as Vt, mapGroupsFromDependabotConfigToJobConfig as W, FileUpdaterInput as Wt, DEFAULT_EXPERIMENTS as X, DependabotConfigSchema as Xt, mapVersionStrategyToRequirementsUpdateStrategy as Y, DependabotConfig as Yt, parseExperiments as Z, DependabotCooldown as Zt, DependabotRecordEcosystemMeta as _, parseDependabotConfig as _n, DependabotExistingPRSchema as _t, DependabotDependencyFile as a, DependabotPullRequestBranchName as an, DependabotCommandSchema as at, DependabotRecordEcosystemVersionsSchema as b, validateConfiguration as bn, DependabotGroupJob as bt, DependabotEcosystemMetaSchema as c, DependabotSchedule as cn, DependabotCondition as ct, DependabotIncrementMetric as d, DependabotUpdateSchema as dn, DependabotCredentialSchema as dt, DependabotGroupSchema as en, CertificateAuthority as et, DependabotIncrementMetricSchema as f, POSSIBLE_CONFIG_FILE_PATHS as fn, DependabotDependency as ft, DependabotMetricSchema as g, VersioningStrategySchema as gn, DependabotExistingPR as gt, DependabotMetric as h, VersioningStrategy as hn, DependabotExistingGroupPRSchema as ht, DependabotCreatePullRequestSchema as i, DependabotMultiEcosystemGroupSchema as in, DependabotCommand as it, DependabotRequestSchema as j, DependabotProxyConfigSchema as jt, CreateApiServerAppOptions as k, DependabotPackageManagerSchema as kt, DependabotEcosystemVersionManager as l, DependabotScheduleSchema as ln, DependabotConditionSchema as lt, DependabotMarkAsProcessedSchema as m, PackageEcosystemSchema as mn, DependabotExistingGroupPR as mt, DependabotClosePullRequestSchema as n, DependabotIgnoreConditionSchema as nn, DependabotAllowed as nt, DependabotDependencyFileSchema as o, DependabotRegistry as on, DependabotCommitOptions as ot, DependabotMarkAsProcessed as p, PackageEcosystem as pn, DependabotDependencySchema as pt, mapSecurityAdvisories as q, DependabotCommitMessage as qt, DependabotCreatePullRequest as r, DependabotMultiEcosystemGroup as rn, DependabotAllowedSchema as rt, DependabotEcosystemMeta as s, DependabotRegistrySchema as sn, DependabotCommitOptionsSchema as st, DependabotClosePullRequest as t, DependabotIgnoreCondition as tn, CertificateAuthoritySchema as tt, DependabotEcosystemVersionManagerSchema as u, DependabotUpdate as un, DependabotCredential as ut, DependabotRecordEcosystemMetaSchema as v, parseRegistries as vn, DependabotExperiments as vt, DependabotRecordUpdateJobUnknownErrorSchema as w, DEPENDABOT_DEFAULT_AUTHOR_EMAIL as wn, DependabotJobConfig as wt, DependabotRecordUpdateJobError as x, VariableFinderFn as xn, DependabotGroupJobSchema as xt, DependabotRecordEcosystemVersions as y, parseUpdates as yn, DependabotExperimentsSchema as yt, makeRandomJobId as z, DependabotSourceProvider as zt };
2084
- //# sourceMappingURL=index-Dr0PB1As.d.ts.map
2142
+ export { CertificateAuthority as $, DependabotGroupSchema as $t, DependabotRequest as A, DependabotProxyConfigSchema as At, mapAllowedUpdatesFromDependabotConfigToJobConfig as B, DependabotSourceSchema as Bt, DependabotRecordUpdateJobUnknownError as C, DEPENDABOT_DEFAULT_AUTHOR_EMAIL as Cn, DependabotJobConfig as Ct, DependabotUpdatePullRequest as D, DependabotPackageManager as Dt, DependabotUpdateDependencyListSchema as E, DependabotJobFileSchema as Et, createApiServerApp as F, DependabotSecurityAdvisory as Ft, mapPackageEcosystemToPackageManager as G, DependabotAllowConditionSchema as Gt, mapExperiments as H, FileFetcherInput as Ht, DependabotJobBuilder as I, DependabotSecurityAdvisorySchema as It, mapVersionStrategyToRequirementsUpdateStrategy as J, DependabotConfig as Jt, mapSecurityAdvisories as K, DependabotCommitMessage as Kt, DependabotJobBuilderOutput as L, DependabotSource as Lt, DependabotRequestType as M, DependabotRequirementSchema as Mt, DependabotRequestTypeSchema as N, DependabotRequirementSource as Nt, DependabotUpdatePullRequestSchema as O, DependabotPackageManagerSchema as Ot, DependabotTokenType as P, DependabotRequirementSourceSchema as Pt, sanitizeRef as Q, DependabotGroup as Qt, DependabotSourceInfo as R, DependabotSourceProvider as Rt, DependabotRecordUpdateJobErrorSchema as S, extractPlaceholder as Sn, DependabotGroupRuleJobSchema as St, DependabotUpdateDependencyList as T, GitAuthor as Tn, DependabotJobFile as Tt, mapGroupsFromDependabotConfigToJobConfig as U, FileUpdaterInput as Ut, mapCredentials as V, FetchedFiles as Vt, mapIgnoreConditionsFromDependabotConfigToJobConfig as W, DependabotAllowCondition as Wt, parseExperiments as X, DependabotCooldown as Xt, DEFAULT_EXPERIMENTS as Y, DependabotConfigSchema as Yt, getBranchNameForUpdate as Z, DependabotCooldownSchema as Zt, DependabotRecordEcosystemMeta as _, parseRegistries as _n, DependabotExperiments as _t, DependabotDependencyFile as a, DependabotRegistry as an, DependabotCommitOptions as at, DependabotRecordEcosystemVersionsSchema as b, VariableFinderFn as bn, DependabotGroupJobSchema as bt, DependabotEcosystemMetaSchema as c, DependabotScheduleSchema as cn, DependabotConditionSchema as ct, DependabotIncrementMetric as d, POSSIBLE_CONFIG_FILE_PATHS as dn, DependabotDependency as dt, DependabotIgnoreCondition as en, CertificateAuthoritySchema as et, DependabotIncrementMetricSchema as f, PackageEcosystem as fn, DependabotDependencySchema as ft, DependabotMetricSchema as g, parseDependabotConfig as gn, DependabotExistingPRSchema as gt, DependabotMetric as h, VersioningStrategySchema as hn, DependabotExistingPR as ht, DependabotCreatePullRequestSchema as i, DependabotPullRequestBranchName as in, DependabotCommandSchema as it, DependabotRequestSchema as j, DependabotRequirement as jt, CreateApiServerAppOptions as k, DependabotProxyConfig as kt, DependabotEcosystemVersionManager as l, DependabotUpdate as ln, DependabotCredential as lt, DependabotMarkAsProcessedSchema as m, VersioningStrategy as mn, DependabotExistingGroupPRSchema as mt, DependabotClosePullRequestSchema as n, DependabotMultiEcosystemGroup as nn, DependabotAllowedSchema as nt, DependabotDependencyFileSchema as o, DependabotRegistrySchema as on, DependabotCommitOptionsSchema as ot, DependabotMarkAsProcessed as p, PackageEcosystemSchema as pn, DependabotExistingGroupPR as pt, mapSourceFromDependabotConfigToJobConfig as q, DependabotCommitMessageSchema as qt, DependabotCreatePullRequest as r, DependabotMultiEcosystemGroupSchema as rn, DependabotCommand as rt, DependabotEcosystemMeta as s, DependabotSchedule as sn, DependabotCondition as st, DependabotClosePullRequest as t, DependabotIgnoreConditionSchema as tn, DependabotAllowed as tt, DependabotEcosystemVersionManagerSchema as u, DependabotUpdateSchema as un, DependabotCredentialSchema as ut, DependabotRecordEcosystemMetaSchema as v, parseUpdates as vn, DependabotExperimentsSchema as vt, DependabotRecordUpdateJobUnknownErrorSchema as w, DEPENDABOT_DEFAULT_AUTHOR_NAME as wn, DependabotJobConfigSchema as wt, DependabotRecordUpdateJobError as x, convertPlaceholder as xn, DependabotGroupRuleJob as xt, DependabotRecordEcosystemVersions as y, validateConfiguration as yn, DependabotGroupJob as yt, makeRandomJobId as z, DependabotSourceProviderSchema as zt };
2143
+ //# sourceMappingURL=index-Djd8_Qnk.d.mts.map
@@ -126,6 +126,9 @@ const DependabotScheduleSchema = z.object({
126
126
  }
127
127
  }, { message: "Invalid IANA time zone" }),
128
128
  cronjob: z.string().check(z.regex(/^\S+ \S+ \S+ \S+ \S+$/, { message: "Cronjob must be in standard cron format" })).optional()
129
+ }).transform((value, { addIssue }) => {
130
+ if (value.interval === "cron" && !value.cronjob) addIssue("The 'cronjob' field must be specified when the interval is set to 'cron'.");
131
+ return value;
129
132
  });
130
133
  const DependabotCommitMessageSchema = z.object({
131
134
  prefix: z.string().optional(),
@@ -241,6 +244,12 @@ const DependabotConfigSchema = z.object({
241
244
  if (value["multi-ecosystem-groups"]) {
242
245
  for (const update of value.updates) for (const key of groupOnlyKeys) if (key in update) addIssue(`The '${key}' field must not be specified in the 'updates' section when using 'multi-ecosystem-groups'. It is a group-only field.`);
243
246
  }
247
+ const seen = /* @__PURE__ */ new Set();
248
+ for (const update of value.updates) {
249
+ const key = `${update["package-ecosystem"]}:${update.directory ?? update.directories?.join(",")}`;
250
+ if (seen.has(key)) addIssue(`Duplicate update configuration found for '${update["package-ecosystem"]}' and directory: '${update.directory ?? update.directories?.join(",")}'`);
251
+ seen.add(key);
252
+ }
244
253
  return value;
245
254
  });
246
255
  function parseUpdates(config, configPath) {
@@ -484,4 +493,4 @@ const DependabotJobFileSchema = z.object({ job: DependabotJobConfigSchema });
484
493
 
485
494
  //#endregion
486
495
  export { DependabotScheduleSchema as A, extractPlaceholder as B, DependabotCommitMessageSchema as C, DependabotIgnoreConditionSchema as D, DependabotGroupSchema as E, parseDependabotConfig as F, parseRegistries as I, parseUpdates as L, POSSIBLE_CONFIG_FILE_PATHS as M, PackageEcosystemSchema as N, DependabotMultiEcosystemGroupSchema as O, VersioningStrategySchema as P, validateConfiguration as R, DependabotAllowConditionSchema as S, DependabotCooldownSchema as T, DependabotRequirementSchema as _, DependabotConditionSchema as a, DependabotSourceProviderSchema as b, DependabotExistingGroupPRSchema as c, DependabotGroupJobSchema as d, DependabotGroupRuleJobSchema as f, DependabotProxyConfigSchema as g, DependabotPackageManagerSchema as h, DependabotCommitOptionsSchema as i, DependabotUpdateSchema as j, DependabotRegistrySchema as k, DependabotExistingPRSchema as l, DependabotJobFileSchema as m, DependabotAllowedSchema as n, DependabotCredentialSchema as o, DependabotJobConfigSchema as p, DependabotCommandSchema as r, DependabotDependencySchema as s, CertificateAuthoritySchema as t, DependabotExperimentsSchema as u, DependabotRequirementSourceSchema as v, DependabotConfigSchema as w, DependabotSourceSchema as x, DependabotSecurityAdvisorySchema as y, convertPlaceholder as z };
487
- //# sourceMappingURL=job-CxYcRj_D.js.map
496
+ //# sourceMappingURL=job-CYxNnXAx.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"job-CYxNnXAx.mjs","names":["matches: RegExpExecArray[]","updates: DependabotUpdate[]","registries: Record<string, DependabotRegistry>","referenced: string[]"],"sources":["../src/dependabot/placeholder.ts","../src/dependabot/config.ts","../src/dependabot/job.ts"],"sourcesContent":["export type VariableFinderFn = (name: string) => string | undefined | Promise<string | undefined>;\n\nasync function convertPlaceholder({\n input,\n variableFinder,\n}: {\n input?: string;\n variableFinder: VariableFinderFn;\n}): Promise<string | undefined> {\n if (!input) return undefined;\n\n const matches: RegExpExecArray[] = extractPlaceholder(input);\n let result = input;\n for (const match of matches) {\n const placeholder = match[0];\n const name = match[1]!;\n const value = (await variableFinder(name)) ?? placeholder;\n result = result.replace(placeholder, value);\n }\n return result;\n}\n\nfunction extractPlaceholder(input: string) {\n const regexp: RegExp = /\\${{\\s*([a-zA-Z_]+[a-zA-Z0-9._-]*)\\s*}}/g;\n\n return matchAll(input, regexp);\n}\n\nfunction matchAll(input: string, regexp: RegExp, matches: Array<RegExpExecArray> = []) {\n const matchIfAny = regexp.exec(input);\n if (matchIfAny) {\n matches.push(matchIfAny);\n\n // recurse until no more matches\n matchAll(input, regexp, matches);\n }\n return matches;\n}\n\nexport { convertPlaceholder, extractPlaceholder };\n","import * as yaml from 'js-yaml';\nimport { z } from 'zod/v4';\n\nimport { convertPlaceholder, type VariableFinderFn } from './placeholder';\n\nexport const DependabotRegistrySchema = z\n .object({\n type: z.enum([\n // order matches\n // https://docs.github.com/en/enterprise-cloud@latest/code-security/dependabot/working-with-dependabot/configuring-access-to-private-registries-for-dependabot#supported-private-registries\n\n 'cargo-registry',\n 'composer-repository',\n 'docker-registry',\n 'git',\n 'goproxy-server',\n 'helm-registry',\n 'hex-organization',\n 'hex-repository',\n 'maven-repository',\n 'npm-registry',\n 'nuget-feed',\n 'pub-repository',\n 'python-index',\n 'rubygems-server',\n 'terraform-registry',\n ]),\n url: z.string().optional(),\n username: z.string().optional(),\n password: z.string().optional(),\n key: z.string().optional(),\n token: z.string().optional(),\n 'replaces-base': z.boolean().optional(),\n host: z.string().optional(), // for terraform and composer only\n registry: z.string().optional(), // for npm only\n organization: z.string().optional(), // for hex-organisation only\n repo: z.string().optional(), // for hex-repository only\n 'public-key-fingerprint': z.string().optional(), // for hex-repository only\n 'index-url': z.string().optional(), // for python-index only\n 'auth-key': z.string().optional(), // used by composer-repository, docker-registry, etc\n 'tenant-id': z.string().optional(), // can only be for azure related stuff, not sure\n 'client-id': z.string().optional(), // can only be for azure related stuff, not sure\n })\n // change underscore to dash in the registry key/type\n .transform((value) => ({ ...value, type: value.type.replace('-', '_') }));\nexport type DependabotRegistry = z.infer<typeof DependabotRegistrySchema>;\n\nexport const DependabotGroupSchema = z.object({\n // Define an identifier for the group to use in branch names and pull request titles.\n // This must start and end with a letter, and can contain letters, pipes |, underscores _, or hyphens -.\n IDENTIFIER: z\n .string()\n .check(\n z.regex(/^[a-zA-Z][a-zA-Z0-9|_-]*[a-zA-Z]$/, {\n message:\n 'Group identifier must start and end with a letter, and can contain letters, pipes |, underscores _, or hyphens -.',\n }),\n )\n .optional(),\n 'applies-to': z.enum(['version-updates', 'security-updates']).optional(),\n 'dependency-type': z.enum(['development', 'production']).optional(),\n patterns: z.string().array().optional(),\n 'exclude-patterns': z.string().array().optional(),\n 'update-types': z.enum(['major', 'minor', 'patch']).array().optional(),\n});\nexport type DependabotGroup = z.infer<typeof DependabotGroupSchema>;\n\nexport const DependabotAllowConditionSchema = z.object({\n 'dependency-name': z.string().optional(),\n 'dependency-type': z.enum(['direct', 'indirect', 'all', 'production', 'development']).optional(),\n 'update-type': z.enum(['all', 'security']).optional(),\n});\nexport type DependabotAllowCondition = z.infer<typeof DependabotAllowConditionSchema>;\n\nexport const DependabotIgnoreConditionSchema = z\n .object({\n 'dependency-name': z.string().optional(),\n versions: z.string().array().or(z.string()).optional(),\n 'update-types': z\n .enum(['version-update:semver-major', 'version-update:semver-minor', 'version-update:semver-patch'])\n .array()\n .optional(),\n })\n .and(z.record(z.string(), z.any()));\nexport type DependabotIgnoreCondition = z.infer<typeof DependabotIgnoreConditionSchema>;\n\nexport const DependabotScheduleSchema = z\n .object({\n interval: z.enum(['daily', 'weekly', 'monthly', 'quarterly', 'semiannually', 'yearly', 'cron']),\n\n day: z\n .enum(['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'])\n .optional()\n .default('monday'),\n\n time: z\n .string()\n .default('02:00')\n .check(z.regex(/^(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$/, { message: 'Time must be in HH:MM format' }))\n .optional(),\n\n timezone: z\n .string()\n .optional()\n .default('Etc/UTC')\n .refine(\n (value) => {\n try {\n // If tz is not a valid IANA name, this throws a RangeError\n Intl.DateTimeFormat(undefined, { timeZone: value });\n return true;\n } catch {\n return false;\n }\n },\n { message: 'Invalid IANA time zone' },\n ),\n cronjob: z\n .string()\n .check(z.regex(/^\\S+ \\S+ \\S+ \\S+ \\S+$/, { message: 'Cronjob must be in standard cron format' }))\n .optional(),\n })\n .transform((value, { addIssue }) => {\n // if interval is 'cron', cronjob must be specified\n if (value.interval === 'cron' && !value.cronjob) {\n addIssue(\"The 'cronjob' field must be specified when the interval is set to 'cron'.\");\n }\n\n return value;\n });\nexport type DependabotSchedule = z.infer<typeof DependabotScheduleSchema>;\n\nexport const DependabotCommitMessageSchema = z.object({\n prefix: z.string().optional(),\n 'prefix-development': z.string().optional(),\n include: z.string().optional(),\n});\nexport type DependabotCommitMessage = z.infer<typeof DependabotCommitMessageSchema>;\n\nexport const DependabotCooldownSchema = z.object({\n 'default-days': z.number().optional(),\n 'semver-major-days': z.number().optional(),\n 'semver-minor-days': z.number().optional(),\n 'semver-patch-days': z.number().optional(),\n include: z.string().array().optional(),\n exclude: z.string().array().optional(),\n});\nexport type DependabotCooldown = z.infer<typeof DependabotCooldownSchema>;\n\nconst DependabotPullRequestBranchNameSchema = z.object({\n separator: z.string().optional(),\n});\nexport type DependabotPullRequestBranchName = z.infer<typeof DependabotPullRequestBranchNameSchema>;\n\nexport const PackageEcosystemSchema = z.enum([\n // order matches\n // https://docs.github.com/en/code-security/dependabot/working-with-dependabot/dependabot-options-reference#package-ecosystem-\n\n 'bun',\n 'bundler',\n 'cargo',\n 'composer',\n 'devcontainers',\n 'docker',\n 'docker-compose',\n 'dotnet-sdk',\n 'helm',\n 'mix',\n 'elm',\n 'gitsubmodule',\n 'github-actions',\n 'gomod',\n 'gradle',\n 'julia',\n 'maven',\n 'npm',\n 'nuget',\n 'pip',\n 'pip-compile', // alias mapped to 'pip'\n 'pipenv', // alias mapped to 'pip'\n 'pnpm', // alias mapped to 'npm'\n 'poetry', // alias mapped to 'pip'\n 'pub',\n 'rust-toolchain',\n 'swift',\n 'terraform',\n 'uv',\n 'vcpkg',\n 'yarn', // alias mapped to 'npm'\n]);\nexport type PackageEcosystem = z.infer<typeof PackageEcosystemSchema>;\n\nexport const VersioningStrategySchema = z.enum(['auto', 'increase', 'increase-if-necessary', 'lockfile-only', 'widen']);\nexport type VersioningStrategy = z.infer<typeof VersioningStrategySchema>;\n\nexport const DependabotUpdateSchema = z\n .object({\n 'package-ecosystem': PackageEcosystemSchema,\n directory: z.string().optional(),\n directories: z.string().array().optional(),\n 'exclude-paths': z.string().array().optional(),\n allow: DependabotAllowConditionSchema.array().optional(),\n assignees: z.string().array().optional(),\n 'commit-message': DependabotCommitMessageSchema.optional(),\n cooldown: DependabotCooldownSchema.optional(),\n groups: z.record(z.string(), DependabotGroupSchema).optional(),\n ignore: DependabotIgnoreConditionSchema.array().optional(),\n 'insecure-external-code-execution': z.enum(['allow', 'deny']).optional(),\n labels: z.string().array().optional(),\n milestone: z.coerce.string().optional(),\n 'open-pull-requests-limit': z.number().check(z.int(), z.gte(0)).optional(),\n 'pull-request-branch-name': DependabotPullRequestBranchNameSchema.optional(),\n 'rebase-strategy': z.string().optional(),\n registries: z.string().array().optional(),\n schedule: DependabotScheduleSchema.optional(), // TODO: make required after 2025-Nov-30\n 'target-branch': z.string().optional(),\n vendor: z.boolean().optional(),\n 'versioning-strategy': VersioningStrategySchema.optional(),\n patterns: z.string().array().optional(),\n 'multi-ecosystem-group': z.string().optional(),\n })\n .transform((value, { addIssue }) => {\n // either 'directory' or 'directories' must be specified\n if (!value.directory && (!value.directories || value.directories.length === 0)) {\n addIssue(\"Either 'directory' or 'directories' must be specified in the dependency update configuration.\");\n }\n\n // validate that 'directory' does not contain glob patterns\n if (value.directory && /[*?[\\]{}]/.test(value.directory)) {\n addIssue(\"The 'directory' field must not include glob pattern.\");\n }\n\n value['open-pull-requests-limit'] ??= 5; // default to 5 if not specified\n\n // The patterns key is required when using multi-ecosystem-group.\n // You can specify dependency patterns to include only certain dependencies in the group,\n // or use [\"*\"] to include all dependencies.\n if (value['multi-ecosystem-group'] && (!value.patterns || value.patterns.length === 0)) {\n addIssue(\n \"The 'patterns' field must be specified and contain at least one pattern when using 'multi-ecosystem-group'.\",\n );\n }\n\n return value;\n });\nexport type DependabotUpdate = z.infer<typeof DependabotUpdateSchema>;\n\nexport const DependabotMultiEcosystemGroupSchema = z.object({\n schedule: DependabotScheduleSchema,\n labels: z.string().array().optional(), // behaviour: additive\n milestone: z.coerce.string().optional(), // behaviour: group-only\n assignees: z.string().array().optional(), // behaviour: additive\n 'target-branch': z.string().optional(), // behaviour: group-only\n 'commit-message': DependabotCommitMessageSchema.optional(), // behaviour: group-only\n 'pull-request-branch-name': DependabotPullRequestBranchNameSchema.optional(), // behaviour: group-only\n});\nexport type DependabotMultiEcosystemGroup = z.infer<typeof DependabotMultiEcosystemGroupSchema>;\n\n/**\n * Represents the dependabot.yaml configuration file options.\n * See: https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates#configuration-options-for-dependabotyml\n */\nexport const DependabotConfigSchema = z\n .object({\n /**\n * Mandatory. configuration file version.\n **/\n version: z.number().refine((v) => v === 2, { message: 'Only version 2 of dependabot is supported' }),\n\n /**\n * Optional. Configure groups of ecosystems to update together in a single pull request.\n */\n 'multi-ecosystem-groups': z.record(z.string(), DependabotMultiEcosystemGroupSchema).optional(),\n\n /**\n * Mandatory. Configure how Dependabot updates the versions or project dependencies.\n * Each entry configures the update settings for a particular package manager.\n */\n updates: DependabotUpdateSchema.array().check(\n z.minLength(1, { message: 'At least one update configuration is required' }),\n ),\n\n /**\n * Optional.\n * Specify authentication details to access private package registries.\n */\n registries: z.record(z.string(), DependabotRegistrySchema).optional(),\n\n /**\n * Optional. Enables updates for ecosystems that are not yet generally available.\n * https://docs.github.com/en/code-security/dependabot/working-with-dependabot/dependabot-options-reference#enable-beta-ecosystems-\n */\n 'enable-beta-ecosystems': z.boolean().optional(),\n })\n .transform((value, { addIssue }) => {\n // If you attempt to set group-only keys at the ecosystem level (in updates entries),\n // Dependabot will throw a configuration error and fail to process your dependabot.yml file.\n // These keys must only be specified in the multi-ecosystem-groups section.\n // https://docs.github.com/en/code-security/dependabot/working-with-dependabot/configuring-multi-ecosystem-updates#group-only-keys\n const groupOnlyKeys = ['milestone', 'target-branch', 'commit-message', 'pull-request-branch-name'] as const;\n if (value['multi-ecosystem-groups']) {\n for (const update of value.updates) {\n for (const key of groupOnlyKeys) {\n if (key in update) {\n addIssue(\n `The '${key}' field must not be specified in the 'updates' section when using 'multi-ecosystem-groups'. It is a group-only field.`,\n );\n }\n }\n }\n }\n\n // ensure there is no update with the same package-ecosystem and directory/directories combination\n const seen = new Set<string>();\n for (const update of value.updates) {\n const key = `${update['package-ecosystem']}:${update.directory ?? update.directories?.join(',')}`;\n if (seen.has(key)) {\n addIssue(\n `Duplicate update configuration found for '${update['package-ecosystem']}' and directory: '${update.directory ?? update.directories?.join(',')}'`,\n );\n }\n seen.add(key);\n }\n\n return value;\n });\n\nexport type DependabotConfig = z.infer<typeof DependabotConfigSchema>;\n\nexport function parseUpdates(config: DependabotConfig, configPath: string): DependabotUpdate[] {\n const updates: DependabotUpdate[] = [];\n\n // Parse the value of each of the updates obtained from the file\n for (const update of config.updates) {\n // populate the 'ignore' conditions 'source' and 'updated-at' properties, if missing\n // NOTE: 'source' and 'updated-at' are not documented in the dependabot.yml config docs, but are defined in the dependabot-core and dependabot-cli models.\n // Currently they don't appear to add much value to the update process, but are populated here for completeness.\n if (update.ignore) {\n for (const condition of update.ignore) {\n condition.source ??= configPath;\n // we don't know the last updated time, so we use the current time\n condition['updated-at'] ??= new Date().toISOString();\n }\n }\n\n updates.push(update);\n }\n return updates;\n}\n\nexport async function parseRegistries(\n config: DependabotConfig,\n variableFinder: VariableFinderFn,\n): Promise<Record<string, DependabotRegistry>> {\n // Parse the value of each of the registries obtained from the config\n const registries: Record<string, DependabotRegistry> = {};\n for (const [key, registry] of Object.entries(config.registries || {})) {\n const updated = { ...registry };\n const { type } = updated;\n\n // handle special fields for 'hex-organization' types\n if (type === 'hex_organization' && !updated.organization) {\n throw new Error(`The value 'organization' in dependency registry config '${type}' is missing`);\n }\n\n // handle special fields for 'hex-repository' types\n if (type === 'hex_repository' && !updated.repo) {\n throw new Error(`The value 'repo' in dependency registry config '${key}' is missing`);\n }\n\n // parse username, password, key, and token while replacing tokens where necessary\n updated.username = await convertPlaceholder({ input: updated.username, variableFinder: variableFinder });\n updated.password = await convertPlaceholder({ input: updated.password, variableFinder: variableFinder });\n updated.key = await convertPlaceholder({ input: updated.key, variableFinder: variableFinder });\n updated.token = await convertPlaceholder({ input: updated.token, variableFinder: variableFinder });\n\n // TODO: include sources for this logic, otherwise it looks like magic.\n // Initially, this was based on reading through the dependabot-core logic\n // but much has since changed.\n\n // parse the url\n const url = updated.url;\n if (!url && type !== 'hex_organization') {\n throw new Error(`The value 'url' in dependency registry config '${key}' is missing`);\n }\n if (url) {\n /*\n * Some credentials do not use the 'url' property in the Ruby updater.\n * The 'host' and 'registry' properties are derived from the given URL.\n * The 'registry' property is derived from the 'url' by stripping off the scheme.\n * The 'host' property is derived from the hostname of the 'url'.\n *\n * 'npm_registry' and 'docker_registry' use 'registry' only.\n * 'terraform_registry' uses 'host' only.\n * 'composer_repository' uses both 'url' and 'host'.\n * 'python_index' uses 'index-url' instead of 'url'.\n */\n\n if (URL.canParse(url)) {\n const parsedUrl = new URL(url);\n\n const addRegistry = type === 'docker_registry' || type === 'npm_registry';\n if (addRegistry) updated.registry = url.replace('https://', '').replace('http://', '');\n\n const addHost = type === 'composer_repository' || type === 'terraform_registry';\n if (addHost) updated.host = parsedUrl.hostname;\n }\n\n if (type === 'python_index') updated['index-url'] = url;\n\n const removeUrl =\n type === 'docker_registry' ||\n type === 'npm_registry' ||\n type === 'terraform_registry' ||\n type === 'python_index';\n if (removeUrl) delete updated.url; // remove the url if not needed\n }\n\n // add to list\n registries[key] = updated;\n }\n return registries;\n}\n\nexport function validateConfiguration(updates: DependabotUpdate[], registries: Record<string, DependabotRegistry>) {\n const configured = Object.keys(registries);\n const referenced: string[] = [];\n for (const u of updates) referenced.push(...(u.registries ?? []));\n\n // ensure there are no configured registries that have not been referenced\n const missingConfiguration = referenced.filter((el) => !configured.includes(el));\n if (missingConfiguration.length > 0) {\n throw new Error(\n `Referenced registries: '${missingConfiguration.join(',')}' have not been configured in the root of dependabot.yml`,\n );\n }\n\n // ensure there are no registries referenced but not configured\n const missingReferences = configured.filter((el) => !referenced.includes(el));\n if (missingReferences.length > 0) {\n throw new Error(`Registries: '${missingReferences.join(',')}' have not been referenced by any update`);\n }\n}\n\n/**\n * Possible paths to the dependabot config file.\n * Remember to prefix with a forward slash when querying API endpoints or where necessary.\n */\nexport const POSSIBLE_CONFIG_FILE_PATHS = [\n '.azuredevops/dependabot.yml',\n '.azuredevops/dependabot.yaml',\n '.github/dependabot.yaml',\n '.github/dependabot.yml',\n];\n\n/**\n * Parse the contents of a dependabot config YAML file\n * @returns {DependabotConfig} config - the dependabot configuration\n */\nexport async function parseDependabotConfig({\n configContents,\n configPath,\n variableFinder,\n}: {\n configContents: string;\n configPath: string;\n variableFinder: VariableFinderFn;\n}): Promise<DependabotConfig> {\n // Load the config\n const loadedConfig = yaml.load(configContents);\n if (loadedConfig === null || typeof loadedConfig !== 'object') {\n throw new Error('Invalid dependabot config object');\n }\n\n // Parse the config\n const config = await DependabotConfigSchema.parseAsync(loadedConfig);\n const updates = parseUpdates(config, configPath);\n const registries = await parseRegistries(config, variableFinder);\n validateConfiguration(updates, registries);\n\n return { ...config, updates, registries };\n}\n","import { z } from 'zod/v4';\nimport { DependabotCooldownSchema } from './config';\n\n// we use nullish() because it does optional() and allows the value to be set to null\n\nexport const DependabotCredentialSchema = z.record(z.string(), z.any());\nexport type DependabotCredential = z.infer<typeof DependabotCredentialSchema>;\n\nexport const CertificateAuthoritySchema = z.object({\n cert: z.string(),\n key: z.string(),\n});\nexport type CertificateAuthority = z.infer<typeof CertificateAuthoritySchema>;\n\nexport const DependabotProxyConfigSchema = z.object({\n all_credentials: DependabotCredentialSchema.array(),\n ca: CertificateAuthoritySchema,\n});\nexport type DependabotProxyConfig = z.infer<typeof DependabotProxyConfigSchema>;\n\nexport const DependabotSourceProviderSchema = z.enum(['azure']);\nexport type DependabotSourceProvider = z.infer<typeof DependabotSourceProviderSchema>;\n\nexport const DependabotSourceSchema = z.object({\n provider: DependabotSourceProviderSchema,\n repo: z.string(),\n directory: z.string().nullish(),\n directories: z.string().array().nullish(),\n branch: z.string().nullish(),\n commit: z.string().nullish(),\n hostname: z.string().nullish(), // Must be provided if api-endpoint is\n 'api-endpoint': z.string().nullish(), // Must be provided if hostname is\n});\nexport type DependabotSource = z.infer<typeof DependabotSourceSchema>;\n\nexport const DependabotExistingPRSchema = z.object({\n 'dependency-name': z.string(),\n 'dependency-version': z.string().nullish(),\n directory: z.string().nullish(),\n removed: z.boolean().nullish(),\n});\nexport type DependabotExistingPR = z.infer<typeof DependabotExistingPRSchema>;\n\nexport const DependabotExistingGroupPRSchema = z.object({\n 'dependency-group-name': z.string(),\n dependencies: DependabotExistingPRSchema.array(),\n});\nexport type DependabotExistingGroupPR = z.infer<typeof DependabotExistingGroupPRSchema>;\n\nexport const DependabotAllowedSchema = z.object({\n 'dependency-name': z.string().nullish(),\n 'dependency-type': z.string().nullish(),\n 'update-type': z.enum(['all', 'security']).optional(),\n});\nexport type DependabotAllowed = z.infer<typeof DependabotAllowedSchema>;\n\nexport const DependabotGroupRuleJobSchema = z.object({\n patterns: z.string().array().nullish(),\n 'exclude-patterns': z.string().array().nullish(),\n 'dependency-type': z.string().nullish(),\n 'update-types': z.string().array().nullish(),\n});\nexport type DependabotGroupRuleJob = z.infer<typeof DependabotGroupRuleJobSchema>;\n\nexport const DependabotGroupJobSchema = z.object({\n name: z.string(),\n 'applies-to': z.string().nullish(),\n rules: DependabotGroupRuleJobSchema,\n});\nexport type DependabotGroupJob = z.infer<typeof DependabotGroupJobSchema>;\n\nexport const DependabotConditionSchema = z.object({\n 'dependency-name': z.string(),\n source: z.string().nullish(),\n 'update-types': z.string().array().nullish(),\n 'updated-at': z.coerce.string().nullish(),\n 'version-requirement': z.string().nullish(),\n});\nexport type DependabotCondition = z.infer<typeof DependabotConditionSchema>;\n\nexport const DependabotSecurityAdvisorySchema = z.object({\n 'dependency-name': z.string(),\n 'affected-versions': z.string().array(),\n 'patched-versions': z.string().array().nullish(), // may not be patched as of yet\n 'unaffected-versions': z.string().array(),\n});\nexport type DependabotSecurityAdvisory = z.infer<typeof DependabotSecurityAdvisorySchema>;\n\nexport const DependabotRequirementSourceSchema = z.record(z.string(), z.any());\nexport type DependabotRequirementSource = z.infer<typeof DependabotRequirementSourceSchema>;\n\nexport const DependabotRequirementSchema = z.object({\n file: z.string().nullish(), // e.g. 'requirements.txt' or '/Root.csproj'\n groups: z.string().array().nullish(), // e.g. ['dependencies']\n metadata: z.record(z.string(), z.any()).nullish(),\n requirement: z.string().nullish(), // e.g. '==3.2.0' or '8.1.0'\n source: DependabotRequirementSourceSchema.nullish(),\n version: z.string().nullish(),\n 'previous-version': z.string().nullish(),\n});\nexport type DependabotRequirement = z.infer<typeof DependabotRequirementSchema>;\n\nexport const DependabotDependencySchema = z.object({\n name: z.string(), // e.g. 'django' or 'GraphQL.Server.Ui.Voyager'\n 'previous-requirements': DependabotRequirementSchema.array().nullish(),\n 'previous-version': z.string().nullish(),\n version: z.string().nullish(), // e.g. '5.0.1' or '8.1.0'\n requirements: DependabotRequirementSchema.array().nullish(),\n removed: z.boolean().nullish(),\n directory: z.string().nullish(),\n});\nexport type DependabotDependency = z.infer<typeof DependabotDependencySchema>;\n\nexport const DependabotCommitOptionsSchema = z.object({\n prefix: z.string().nullish(),\n 'prefix-development': z.string().nullish(),\n 'include-scope': z.boolean().nullish(),\n});\nexport type DependabotCommitOptions = z.infer<typeof DependabotCommitOptionsSchema>;\n\nexport const DependabotExperimentsSchema = z.record(z.string(), z.union([z.string(), z.boolean()]));\nexport type DependabotExperiments = z.infer<typeof DependabotExperimentsSchema>;\n\nexport const DependabotPackageManagerSchema = z.enum([\n // order matches dependabot-action/src/update-containers.ts\n\n 'bundler',\n 'cargo',\n 'composer',\n 'pub',\n 'docker',\n 'elm',\n 'github_actions', // ecosystem(s): 'github-actions'\n 'submodules', // ecosystem(s): 'gitsubmodule'\n 'go_modules', // ecosystem(s): 'gomod'\n 'gradle',\n 'maven',\n 'hex', // ecosystem(s): 'mix'\n 'nuget',\n 'npm_and_yarn', // ecosystem(s): 'npm', 'pnpm', 'yarn'\n 'pip', // ecosystem(s): 'pipenv', 'pip-compile', 'poetry'\n 'rust_toolchain', // ecosystem(s): 'rust-toolchain'\n 'swift',\n 'terraform',\n 'devcontainers',\n 'dotnet_sdk', // ecosystem(s): 'dotnet-sdk'\n 'bun',\n 'docker_compose', // // ecosystem(s): 'docker-compose',\n 'uv',\n 'vcpkg',\n 'helm',\n 'julia',\n]);\nexport type DependabotPackageManager = z.infer<typeof DependabotPackageManagerSchema>;\n\nexport const DependabotCommandSchema = z.enum(['graph', 'version', 'recreate']);\nexport type DependabotCommand = z.infer<typeof DependabotCommandSchema>;\n\n// See: https://github.com/dependabot/cli/blob/main/internal/model/job.go\n// https://github.com/dependabot/dependabot-core/blob/main/updater/lib/dependabot/job.rb\nexport const DependabotJobConfigSchema = z.object({\n id: z.number().optional(),\n command: DependabotCommandSchema.optional(),\n 'package-manager': DependabotPackageManagerSchema,\n 'allowed-updates': DependabotAllowedSchema.array(),\n debug: z.boolean().nullable(),\n 'dependency-groups': DependabotGroupJobSchema.array().nullish(),\n dependencies: z.string().array().nullable(),\n 'dependency-group-to-refresh': z.string().nullish(),\n 'existing-pull-requests': DependabotExistingPRSchema.array().array(),\n 'existing-group-pull-requests': DependabotExistingGroupPRSchema.array(),\n experiments: DependabotExperimentsSchema,\n 'ignore-conditions': DependabotConditionSchema.array(),\n 'lockfile-only': z.boolean(),\n 'requirements-update-strategy': z.string().nullable(),\n 'security-advisories': DependabotSecurityAdvisorySchema.array(),\n 'security-updates-only': z.boolean(),\n source: DependabotSourceSchema,\n 'update-subdependencies': z.boolean(),\n 'updating-a-pull-request': z.boolean(),\n 'vendor-dependencies': z.boolean(),\n 'reject-external-code': z.boolean().nullish(),\n 'repo-private': z.boolean(),\n 'commit-message-options': DependabotCommitOptionsSchema,\n 'credentials-metadata': DependabotCredentialSchema.array().nullish(),\n 'max-updater-run-time': z.int().nullish(),\n cooldown: DependabotCooldownSchema.nullish(),\n 'proxy-log-response-body-on-auth-failure': z.boolean().nullish(),\n 'enable-beta-ecosystems': z.boolean().nullish(),\n 'multi-ecosystem-update': z.boolean().nullish(),\n 'exclude-paths': z.string().array().optional(),\n});\nexport type DependabotJobConfig = z.infer<typeof DependabotJobConfigSchema>;\n\nexport const DependabotJobFileSchema = z.object({\n job: DependabotJobConfigSchema,\n});\nexport type DependabotJobFile = z.infer<typeof DependabotJobFileSchema>;\n\n// Code below is borrowed and adapted from dependabot-action\n\n// biome-ignore-start lint/suspicious/noExplicitAny: generic\nexport type FetchedFiles = {\n base_commit_sha: string;\n dependency_files: any[];\n base64_dependency_files: any[];\n};\n// biome-ignore-end lint/suspicious/noExplicitAny: generic\n\nexport type FileFetcherInput = {\n job: DependabotJobConfig;\n};\n\nexport type FileUpdaterInput = FetchedFiles & {\n job: DependabotJobConfig;\n};\n"],"mappings":";;;;AAEA,eAAe,mBAAmB,EAChC,OACA,kBAI8B;AAC9B,KAAI,CAAC,MAAO,QAAO;CAEnB,MAAMA,UAA6B,mBAAmB,MAAM;CAC5D,IAAI,SAAS;AACb,MAAK,MAAM,SAAS,SAAS;EAC3B,MAAM,cAAc,MAAM;EAC1B,MAAM,OAAO,MAAM;EACnB,MAAM,QAAS,MAAM,eAAe,KAAK,IAAK;AAC9C,WAAS,OAAO,QAAQ,aAAa,MAAM;;AAE7C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B,EAAE,SAAS;CACtC,uBAAuB,EAAE,SAAS;CAClC,wBAAwB,EAAE,SAAS,CAAC,SAAS;CAC7C,gBAAgB,EAAE,SAAS;CAC3B,0BAA0B;CAC1B,wBAAwB,2BAA2B,OAAO,CAAC,SAAS;CACpE,wBAAwB,EAAE,KAAK,CAAC,SAAS;CACzC,UAAU,yBAAyB,SAAS;CAC5C,2CAA2C,EAAE,SAAS,CAAC,SAAS;CAChE,0BAA0B,EAAE,SAAS,CAAC,SAAS;CAC/C,0BAA0B,EAAE,SAAS,CAAC,SAAS;CAC/C,iBAAiB,EAAE,QAAQ,CAAC,OAAO,CAAC,UAAU;CAC/C,CAAC;AAGF,MAAa,0BAA0B,EAAE,OAAO,EAC9C,KAAK,2BACN,CAAC"}
@@ -0,0 +1,42 @@
1
+ //#region src/keygen.d.ts
2
+ type GenerateKeyOptions = {
3
+ /** Length in bytes (default: 32) */
4
+ length?: number;
5
+ /** Encoding format (default: 'base64url') */
6
+ encoding?: 'base64' | 'base64url' | 'base32' | 'hex';
7
+ };
8
+ /**
9
+ * Generates a cryptographically secure random key.
10
+ *
11
+ * @param options Configuration options for key generation
12
+ * @returns A randomly generated key string
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * // Generate a 32-byte base64url token (default)
17
+ * const token = generateKey();
18
+ *
19
+ * // Generate a 16-byte hex key
20
+ * const token = generateKey({ length: 16, encoding: 'hex' });
21
+ *
22
+ * // Generate a 20-byte base32 key
23
+ * const token = generateKey({ length: 20, encoding: 'base32' });
24
+ *
25
+ * // Generate a 64-byte base64 key with padding
26
+ * const key = generateKey({ length: 64, encoding: 'base64' });
27
+ * ```
28
+ */
29
+ declare function generateKey({
30
+ length,
31
+ encoding
32
+ }?: GenerateKeyOptions): string;
33
+ type GenerateIdOptions = {
34
+ /** Length of the ID string (default: 16) */
35
+ length?: number;
36
+ };
37
+ declare function generateId({
38
+ length
39
+ }?: GenerateIdOptions): string;
40
+ //#endregion
41
+ export { GenerateIdOptions, GenerateKeyOptions, generateId, generateKey };
42
+ //# sourceMappingURL=keygen.d.mts.map
@@ -0,0 +1,58 @@
1
+ //#region src/keygen.ts
2
+ /**
3
+ * Generates a cryptographically secure random key.
4
+ *
5
+ * @param options Configuration options for key generation
6
+ * @returns A randomly generated key string
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * // Generate a 32-byte base64url token (default)
11
+ * const token = generateKey();
12
+ *
13
+ * // Generate a 16-byte hex key
14
+ * const token = generateKey({ length: 16, encoding: 'hex' });
15
+ *
16
+ * // Generate a 20-byte base32 key
17
+ * const token = generateKey({ length: 20, encoding: 'base32' });
18
+ *
19
+ * // Generate a 64-byte base64 key with padding
20
+ * const key = generateKey({ length: 64, encoding: 'base64' });
21
+ * ```
22
+ */
23
+ function generateKey({ length = 32, encoding = "base64url" } = {}) {
24
+ const bytes = new Uint8Array(length);
25
+ crypto.getRandomValues(bytes);
26
+ const buffer = Buffer.from(bytes);
27
+ switch (encoding) {
28
+ case "base64": return buffer.toString("base64");
29
+ case "base64url": return buffer.toString("base64url");
30
+ case "base32": {
31
+ const base32Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
32
+ let result = "";
33
+ let bufferValue = 0;
34
+ let bitsLeft = 0;
35
+ for (const byte of bytes) {
36
+ bufferValue = bufferValue << 8 | byte;
37
+ bitsLeft += 8;
38
+ while (bitsLeft >= 5) {
39
+ result += base32Chars[bufferValue >>> bitsLeft - 5 & 31];
40
+ bitsLeft -= 5;
41
+ }
42
+ }
43
+ if (bitsLeft > 0) result += base32Chars[bufferValue << 5 - bitsLeft & 31];
44
+ return result;
45
+ }
46
+ case "hex": return buffer.toString("hex");
47
+ default: throw new Error(`Unsupported encoding: ${encoding}`);
48
+ }
49
+ }
50
+ function generateId({ length = 16 } = {}) {
51
+ const bytes = new Uint8Array(length);
52
+ crypto.getRandomValues(bytes);
53
+ return Array.from(bytes, (byte) => (byte % 36).toString(36)).join("");
54
+ }
55
+
56
+ //#endregion
57
+ export { generateId, generateKey };
58
+ //# sourceMappingURL=keygen.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keygen.mjs","names":[],"sources":["../src/keygen.ts"],"sourcesContent":["export type GenerateKeyOptions = {\n /** Length in bytes (default: 32) */\n length?: number;\n /** Encoding format (default: 'base64url') */\n encoding?: 'base64' | 'base64url' | 'base32' | 'hex';\n};\n\n/**\n * Generates a cryptographically secure random key.\n *\n * @param options Configuration options for key generation\n * @returns A randomly generated key string\n *\n * @example\n * ```typescript\n * // Generate a 32-byte base64url token (default)\n * const token = generateKey();\n *\n * // Generate a 16-byte hex key\n * const token = generateKey({ length: 16, encoding: 'hex' });\n *\n * // Generate a 20-byte base32 key\n * const token = generateKey({ length: 20, encoding: 'base32' });\n *\n * // Generate a 64-byte base64 key with padding\n * const key = generateKey({ length: 64, encoding: 'base64' });\n * ```\n */\nexport function generateKey({ length = 32, encoding = 'base64url' }: GenerateKeyOptions = {}): string {\n const bytes = new Uint8Array(length);\n crypto.getRandomValues(bytes);\n const buffer = Buffer.from(bytes);\n\n switch (encoding) {\n case 'base64':\n return buffer.toString('base64');\n\n case 'base64url':\n return buffer.toString('base64url');\n\n case 'base32': {\n // RFC 4648 Base32 encoding\n const base32Chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';\n let result = '';\n let bufferValue = 0;\n let bitsLeft = 0;\n\n for (const byte of bytes) {\n bufferValue = (bufferValue << 8) | byte;\n bitsLeft += 8;\n\n while (bitsLeft >= 5) {\n result += base32Chars[(bufferValue >>> (bitsLeft - 5)) & 31];\n bitsLeft -= 5;\n }\n }\n\n if (bitsLeft > 0) {\n result += base32Chars[(bufferValue << (5 - bitsLeft)) & 31];\n }\n\n return result;\n }\n\n case 'hex':\n return buffer.toString('hex');\n\n default:\n throw new Error(`Unsupported encoding: ${encoding}`);\n }\n}\n\nexport type GenerateIdOptions = {\n /** Length of the ID string (default: 16) */\n length?: number;\n};\n\nexport function generateId({ length = 16 }: GenerateIdOptions = {}): string {\n const bytes = new Uint8Array(length);\n crypto.getRandomValues(bytes);\n return Array.from(bytes, (byte) => (byte % 36).toString(36)).join('');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA4BA,SAAgB,YAAY,EAAE,SAAS,IAAI,WAAW,gBAAoC,EAAE,EAAU;CACpG,MAAM,QAAQ,IAAI,WAAW,OAAO;AACpC,QAAO,gBAAgB,MAAM;CAC7B,MAAM,SAAS,OAAO,KAAK,MAAM;AAEjC,SAAQ,UAAR;EACE,KAAK,SACH,QAAO,OAAO,SAAS,SAAS;EAElC,KAAK,YACH,QAAO,OAAO,SAAS,YAAY;EAErC,KAAK,UAAU;GAEb,MAAM,cAAc;GACpB,IAAI,SAAS;GACb,IAAI,cAAc;GAClB,IAAI,WAAW;AAEf,QAAK,MAAM,QAAQ,OAAO;AACxB,kBAAe,eAAe,IAAK;AACnC,gBAAY;AAEZ,WAAO,YAAY,GAAG;AACpB,eAAU,YAAa,gBAAiB,WAAW,IAAM;AACzD,iBAAY;;;AAIhB,OAAI,WAAW,EACb,WAAU,YAAa,eAAgB,IAAI,WAAa;AAG1D,UAAO;;EAGT,KAAK,MACH,QAAO,OAAO,SAAS,MAAM;EAE/B,QACE,OAAM,IAAI,MAAM,yBAAyB,WAAW;;;AAS1D,SAAgB,WAAW,EAAE,SAAS,OAA0B,EAAE,EAAU;CAC1E,MAAM,QAAQ,IAAI,WAAW,OAAO;AACpC,QAAO,gBAAgB,MAAM;AAC7B,QAAO,MAAM,KAAK,QAAQ,UAAU,OAAO,IAAI,SAAS,GAAG,CAAC,CAAC,KAAK,GAAG"}
@@ -0,0 +1,14 @@
1
+ import { t as environment } from "./environment-Bn2AKsNP.mjs";
2
+ import pino from "pino";
3
+ import pretty from "pino-pretty";
4
+
5
+ //#region src/logger.ts
6
+ const stream = pretty({
7
+ colorize: true,
8
+ ignore: "pid,hostname"
9
+ });
10
+ const logger = pino({ level: process.env.LOG_LEVEL || (environment.production ? "warn" : "debug") }, stream);
11
+
12
+ //#endregion
13
+ export { logger as t };
14
+ //# sourceMappingURL=logger-BhxvmS3E.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger-BhxvmS3E.mjs","names":[],"sources":["../src/logger.ts"],"sourcesContent":["import pino from 'pino';\nimport pretty from 'pino-pretty';\n\nimport { environment } from '@/environment';\n\nconst stream = pretty({ colorize: true, ignore: 'pid,hostname' });\n\nexport const logger = pino(\n {\n level: process.env.LOG_LEVEL || (environment.production ? 'warn' : 'debug'),\n },\n stream,\n);\n"],"mappings":";;;;;AAKA,MAAM,SAAS,OAAO;CAAE,UAAU;CAAM,QAAQ;CAAgB,CAAC;AAEjE,MAAa,SAAS,KACpB,EACE,OAAO,QAAQ,IAAI,cAAc,YAAY,aAAa,SAAS,UACpE,EACD,OACD"}
@@ -0,0 +1,7 @@
1
+ import pino from "pino";
2
+
3
+ //#region src/logger.d.ts
4
+ declare const logger: pino.Logger<never, boolean>;
5
+ //#endregion
6
+ export { logger };
7
+ //# sourceMappingURL=logger.d.mts.map