@marinoscar/platform-contract 0.1.0-next.18 → 0.1.0-next.20

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 (159) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +5 -0
  3. package/dist/cjs/alerts/constants.d.ts +195 -0
  4. package/dist/cjs/alerts/constants.d.ts.map +1 -0
  5. package/dist/cjs/alerts/constants.js +165 -0
  6. package/dist/cjs/alerts/constants.js.map +1 -0
  7. package/dist/cjs/alerts/enum.d.ts +5 -0
  8. package/dist/cjs/alerts/enum.d.ts.map +1 -0
  9. package/dist/cjs/alerts/enum.js +9 -0
  10. package/dist/cjs/alerts/enum.js.map +1 -0
  11. package/dist/cjs/alerts/index.d.ts +5 -0
  12. package/dist/cjs/alerts/index.d.ts.map +1 -0
  13. package/dist/cjs/alerts/index.js +68 -0
  14. package/dist/cjs/alerts/index.js.map +1 -0
  15. package/dist/cjs/alerts/schemas.d.ts +351 -0
  16. package/dist/cjs/alerts/schemas.d.ts.map +1 -0
  17. package/dist/cjs/alerts/schemas.js +432 -0
  18. package/dist/cjs/alerts/schemas.js.map +1 -0
  19. package/dist/cjs/nodes/admin-schemas.d.ts +85 -1
  20. package/dist/cjs/nodes/admin-schemas.d.ts.map +1 -1
  21. package/dist/cjs/nodes/admin-schemas.js +55 -1
  22. package/dist/cjs/nodes/admin-schemas.js.map +1 -1
  23. package/dist/cjs/nodes/constants.d.ts +12 -0
  24. package/dist/cjs/nodes/constants.d.ts.map +1 -1
  25. package/dist/cjs/nodes/constants.js +13 -1
  26. package/dist/cjs/nodes/constants.js.map +1 -1
  27. package/dist/cjs/nodes/index.d.ts +5 -5
  28. package/dist/cjs/nodes/index.d.ts.map +1 -1
  29. package/dist/cjs/nodes/index.js +14 -1
  30. package/dist/cjs/nodes/index.js.map +1 -1
  31. package/dist/cjs/nodes/schemas.d.ts +178 -0
  32. package/dist/cjs/nodes/schemas.d.ts.map +1 -1
  33. package/dist/cjs/nodes/schemas.js +149 -1
  34. package/dist/cjs/nodes/schemas.js.map +1 -1
  35. package/dist/cjs/settings/index.d.ts +1 -1
  36. package/dist/cjs/settings/index.d.ts.map +1 -1
  37. package/dist/cjs/settings/index.js +3 -2
  38. package/dist/cjs/settings/index.js.map +1 -1
  39. package/dist/cjs/settings/schemas.d.ts +11 -0
  40. package/dist/cjs/settings/schemas.d.ts.map +1 -1
  41. package/dist/cjs/settings/schemas.js +20 -0
  42. package/dist/cjs/settings/schemas.js.map +1 -1
  43. package/dist/cjs/telemetry/constants.d.ts.map +1 -1
  44. package/dist/cjs/telemetry/constants.js +6 -0
  45. package/dist/cjs/telemetry/constants.js.map +1 -1
  46. package/dist/cjs/telemetry/dashboard.d.ts +5 -5
  47. package/dist/cjs/telemetry/presentation.d.ts +5 -5
  48. package/dist/cjs/telemetry/stack.d.ts +2 -2
  49. package/dist/cjs/timezone/constants.d.ts +16 -0
  50. package/dist/cjs/timezone/constants.d.ts.map +1 -0
  51. package/dist/cjs/timezone/constants.js +19 -0
  52. package/dist/cjs/timezone/constants.js.map +1 -0
  53. package/dist/cjs/timezone/index.d.ts +15 -0
  54. package/dist/cjs/timezone/index.d.ts.map +1 -0
  55. package/dist/cjs/timezone/index.js +34 -0
  56. package/dist/cjs/timezone/index.js.map +1 -0
  57. package/dist/cjs/timezone/schemas.d.ts +111 -0
  58. package/dist/cjs/timezone/schemas.d.ts.map +1 -0
  59. package/dist/cjs/timezone/schemas.js +194 -0
  60. package/dist/cjs/timezone/schemas.js.map +1 -0
  61. package/dist/cjs/webhooks/constants.d.ts +154 -0
  62. package/dist/cjs/webhooks/constants.d.ts.map +1 -0
  63. package/dist/cjs/webhooks/constants.js +136 -0
  64. package/dist/cjs/webhooks/constants.js.map +1 -0
  65. package/dist/cjs/webhooks/enum.d.ts +5 -0
  66. package/dist/cjs/webhooks/enum.d.ts.map +1 -0
  67. package/dist/cjs/webhooks/enum.js +9 -0
  68. package/dist/cjs/webhooks/enum.js.map +1 -0
  69. package/dist/cjs/webhooks/index.d.ts +7 -0
  70. package/dist/cjs/webhooks/index.d.ts.map +1 -0
  71. package/dist/cjs/webhooks/index.js +48 -0
  72. package/dist/cjs/webhooks/index.js.map +1 -0
  73. package/dist/cjs/webhooks/schemas.d.ts +288 -0
  74. package/dist/cjs/webhooks/schemas.d.ts.map +1 -0
  75. package/dist/cjs/webhooks/schemas.js +295 -0
  76. package/dist/cjs/webhooks/schemas.js.map +1 -0
  77. package/dist/cjs/webhooks/signature.d.ts +54 -0
  78. package/dist/cjs/webhooks/signature.d.ts.map +1 -0
  79. package/dist/cjs/webhooks/signature.js +97 -0
  80. package/dist/cjs/webhooks/signature.js.map +1 -0
  81. package/dist/esm/alerts/constants.d.ts +195 -0
  82. package/dist/esm/alerts/constants.d.ts.map +1 -0
  83. package/dist/esm/alerts/constants.js +162 -0
  84. package/dist/esm/alerts/constants.js.map +1 -0
  85. package/dist/esm/alerts/enum.d.ts +5 -0
  86. package/dist/esm/alerts/enum.d.ts.map +1 -0
  87. package/dist/esm/alerts/enum.js +6 -0
  88. package/dist/esm/alerts/enum.js.map +1 -0
  89. package/dist/esm/alerts/index.d.ts +5 -0
  90. package/dist/esm/alerts/index.d.ts.map +1 -0
  91. package/dist/esm/alerts/index.js +8 -0
  92. package/dist/esm/alerts/index.js.map +1 -0
  93. package/dist/esm/alerts/schemas.d.ts +351 -0
  94. package/dist/esm/alerts/schemas.d.ts.map +1 -0
  95. package/dist/esm/alerts/schemas.js +429 -0
  96. package/dist/esm/alerts/schemas.js.map +1 -0
  97. package/dist/esm/nodes/admin-schemas.d.ts +85 -1
  98. package/dist/esm/nodes/admin-schemas.d.ts.map +1 -1
  99. package/dist/esm/nodes/admin-schemas.js +55 -1
  100. package/dist/esm/nodes/admin-schemas.js.map +1 -1
  101. package/dist/esm/nodes/constants.d.ts +12 -0
  102. package/dist/esm/nodes/constants.d.ts.map +1 -1
  103. package/dist/esm/nodes/constants.js +12 -0
  104. package/dist/esm/nodes/constants.js.map +1 -1
  105. package/dist/esm/nodes/index.d.ts +5 -5
  106. package/dist/esm/nodes/index.d.ts.map +1 -1
  107. package/dist/esm/nodes/index.js +3 -3
  108. package/dist/esm/nodes/index.js.map +1 -1
  109. package/dist/esm/nodes/schemas.d.ts +178 -0
  110. package/dist/esm/nodes/schemas.d.ts.map +1 -1
  111. package/dist/esm/nodes/schemas.js +149 -1
  112. package/dist/esm/nodes/schemas.js.map +1 -1
  113. package/dist/esm/settings/index.d.ts +1 -1
  114. package/dist/esm/settings/index.d.ts.map +1 -1
  115. package/dist/esm/settings/index.js +1 -1
  116. package/dist/esm/settings/index.js.map +1 -1
  117. package/dist/esm/settings/schemas.d.ts +11 -0
  118. package/dist/esm/settings/schemas.d.ts.map +1 -1
  119. package/dist/esm/settings/schemas.js +19 -0
  120. package/dist/esm/settings/schemas.js.map +1 -1
  121. package/dist/esm/telemetry/constants.d.ts.map +1 -1
  122. package/dist/esm/telemetry/constants.js +6 -0
  123. package/dist/esm/telemetry/constants.js.map +1 -1
  124. package/dist/esm/telemetry/dashboard.d.ts +5 -5
  125. package/dist/esm/telemetry/presentation.d.ts +5 -5
  126. package/dist/esm/telemetry/stack.d.ts +2 -2
  127. package/dist/esm/timezone/constants.d.ts +16 -0
  128. package/dist/esm/timezone/constants.d.ts.map +1 -0
  129. package/dist/esm/timezone/constants.js +16 -0
  130. package/dist/esm/timezone/constants.js.map +1 -0
  131. package/dist/esm/timezone/index.d.ts +15 -0
  132. package/dist/esm/timezone/index.d.ts.map +1 -0
  133. package/dist/esm/timezone/index.js +15 -0
  134. package/dist/esm/timezone/index.js.map +1 -0
  135. package/dist/esm/timezone/schemas.d.ts +111 -0
  136. package/dist/esm/timezone/schemas.d.ts.map +1 -0
  137. package/dist/esm/timezone/schemas.js +185 -0
  138. package/dist/esm/timezone/schemas.js.map +1 -0
  139. package/dist/esm/webhooks/constants.d.ts +154 -0
  140. package/dist/esm/webhooks/constants.d.ts.map +1 -0
  141. package/dist/esm/webhooks/constants.js +133 -0
  142. package/dist/esm/webhooks/constants.js.map +1 -0
  143. package/dist/esm/webhooks/enum.d.ts +5 -0
  144. package/dist/esm/webhooks/enum.d.ts.map +1 -0
  145. package/dist/esm/webhooks/enum.js +6 -0
  146. package/dist/esm/webhooks/enum.js.map +1 -0
  147. package/dist/esm/webhooks/index.d.ts +7 -0
  148. package/dist/esm/webhooks/index.d.ts.map +1 -0
  149. package/dist/esm/webhooks/index.js +8 -0
  150. package/dist/esm/webhooks/index.js.map +1 -0
  151. package/dist/esm/webhooks/schemas.d.ts +288 -0
  152. package/dist/esm/webhooks/schemas.d.ts.map +1 -0
  153. package/dist/esm/webhooks/schemas.js +292 -0
  154. package/dist/esm/webhooks/schemas.js.map +1 -0
  155. package/dist/esm/webhooks/signature.d.ts +54 -0
  156. package/dist/esm/webhooks/signature.d.ts.map +1 -0
  157. package/dist/esm/webhooks/signature.js +93 -0
  158. package/dist/esm/webhooks/signature.js.map +1 -0
  159. package/package.json +31 -1
@@ -0,0 +1,111 @@
1
+ /**
2
+ * A `YYYY-MM-DD` calendar day.
3
+ *
4
+ * @stability experimental
5
+ */
6
+ export type DateKey = string;
7
+ /**
8
+ * Wall-clock fields of an instant in a zone.
9
+ *
10
+ * @stability experimental
11
+ */
12
+ export interface ZonedParts {
13
+ /** The four-digit year. */
14
+ readonly year: number;
15
+ /** 1 to 12. */
16
+ readonly month: number;
17
+ /** Day of the month, 1 to 31. */
18
+ readonly day: number;
19
+ /** 0 to 23. */
20
+ readonly hour: number;
21
+ /** 0 to 59. */
22
+ readonly minute: number;
23
+ /** 0 to 59. */
24
+ readonly second: number;
25
+ }
26
+ /**
27
+ * The wall-clock fields of `instant` in `timeZone`.
28
+ *
29
+ * @param instant - the instant.
30
+ * @param timeZone - an IANA zone id.
31
+ * @returns year, month (1-12), day, hour, minute and second there.
32
+ *
33
+ * @stability experimental
34
+ */
35
+ export declare function getZonedParts(instant: Date | number, timeZone: string): ZonedParts;
36
+ /**
37
+ * Minutes the zone is ahead of UTC at `instant` (positive east, so
38
+ * `America/Costa_Rica` is `-360`). DST-aware.
39
+ *
40
+ * @param instant - the instant.
41
+ * @param timeZone - an IANA zone id.
42
+ * @returns the offset in minutes.
43
+ *
44
+ * @stability experimental
45
+ */
46
+ export declare function getTimeZoneOffsetMinutes(instant: Date | number, timeZone: string): number;
47
+ /**
48
+ * The calendar day (`YYYY-MM-DD`) `instant` falls on in `timeZone`.
49
+ *
50
+ * @param instant - the instant.
51
+ * @param timeZone - an IANA zone id.
52
+ * @returns the zone's calendar day.
53
+ *
54
+ * @stability experimental
55
+ */
56
+ export declare function zonedDateKey(instant: Date | number, timeZone: string): DateKey;
57
+ /**
58
+ * Whether `value` is a well-formed `YYYY-MM-DD` that names a real day.
59
+ *
60
+ * @stability experimental
61
+ */
62
+ export declare function isDateKey(value: unknown): value is DateKey;
63
+ /**
64
+ * `day` shifted by whole calendar days, with no time zone involved.
65
+ *
66
+ * @param day - a `YYYY-MM-DD` day.
67
+ * @param days - days to add (negative subtracts).
68
+ * @returns the shifted day.
69
+ *
70
+ * @stability experimental
71
+ */
72
+ export declare function addDaysToDateKey(day: DateKey, days: number): DateKey;
73
+ /**
74
+ * The instant of local midnight at the start of `day` in `timeZone`. DST-safe:
75
+ * the day may be 23 or 25 hours long, and where midnight itself is skipped the
76
+ * day starts at the first instant after the gap.
77
+ *
78
+ * @param day - a `YYYY-MM-DD` day.
79
+ * @param timeZone - an IANA zone id.
80
+ * @returns the day's first instant.
81
+ *
82
+ * @stability experimental
83
+ */
84
+ export declare function zonedDayStart(day: DateKey, timeZone: string): Date;
85
+ /**
86
+ * What {@link addCalendarInZone} adds: whole days or whole months.
87
+ *
88
+ * @stability experimental
89
+ */
90
+ export type CalendarDuration = {
91
+ /** Calendar days to add (negative to subtract). */
92
+ readonly days: number;
93
+ } | {
94
+ /** Calendar months to add (negative to subtract); the day clamps to the month's last day. */
95
+ readonly months: number;
96
+ };
97
+ /**
98
+ * `instant` plus calendar days or months, computed on the wall clock of
99
+ * `timeZone` so the time of day is kept across DST changes. A month step clamps
100
+ * to the end of a shorter month (Jan 31 plus one month is Feb 28, or 29 in a
101
+ * leap year).
102
+ *
103
+ * @param instant - the starting instant.
104
+ * @param duration - `{ days }` or `{ months }` (integers, negative allowed).
105
+ * @param timeZone - an IANA zone id.
106
+ * @returns the resulting instant.
107
+ *
108
+ * @stability experimental
109
+ */
110
+ export declare function addCalendarInZone(instant: Date | number, duration: CalendarDuration, timeZone: string): Date;
111
+ //# sourceMappingURL=schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/timezone/schemas.ts"],"names":[],"mappings":"AACA;;;;GAIG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC;AAE7B;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,2BAA2B;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,eAAe;IACf,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,iCAAiC;IACjC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,eAAe;IACf,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,eAAe;IACf,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,eAAe;IACf,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AA8BD;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,IAAI,GAAG,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,UAAU,CAalF;AAED;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,IAAI,GAAG,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAOzF;AAMD;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,IAAI,GAAG,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAG9E;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,OAAO,CAO1D;AAQD;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAIpE;AAwBD;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAGlE;AAED;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GACxB;IACE,mDAAmD;IACnD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB,GACD;IACE,6FAA6F;IAC7F,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,CAAC;AAEN;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,IAAI,GAAG,MAAM,EAAE,QAAQ,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAkB5G"}
@@ -0,0 +1,194 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getZonedParts = getZonedParts;
4
+ exports.getTimeZoneOffsetMinutes = getTimeZoneOffsetMinutes;
5
+ exports.zonedDateKey = zonedDateKey;
6
+ exports.isDateKey = isDateKey;
7
+ exports.addDaysToDateKey = addDaysToDateKey;
8
+ exports.zonedDayStart = zonedDayStart;
9
+ exports.addCalendarInZone = addCalendarInZone;
10
+ const MINUTE_MS = 60_000;
11
+ const DAY_MS = 86_400_000;
12
+ const DATE_KEY = /^(\d{4})-(\d{2})-(\d{2})$/;
13
+ const formatters = new Map();
14
+ function formatterFor(timeZone) {
15
+ let fmt = formatters.get(timeZone);
16
+ if (!fmt) {
17
+ fmt = new Intl.DateTimeFormat('en-US', {
18
+ timeZone,
19
+ hourCycle: 'h23',
20
+ year: 'numeric',
21
+ month: 'numeric',
22
+ day: 'numeric',
23
+ hour: 'numeric',
24
+ minute: 'numeric',
25
+ second: 'numeric',
26
+ });
27
+ formatters.set(timeZone, fmt);
28
+ }
29
+ return fmt;
30
+ }
31
+ function toMs(instant) {
32
+ return typeof instant === 'number' ? instant : instant.getTime();
33
+ }
34
+ /**
35
+ * The wall-clock fields of `instant` in `timeZone`.
36
+ *
37
+ * @param instant - the instant.
38
+ * @param timeZone - an IANA zone id.
39
+ * @returns year, month (1-12), day, hour, minute and second there.
40
+ *
41
+ * @stability experimental
42
+ */
43
+ function getZonedParts(instant, timeZone) {
44
+ const out = {};
45
+ for (const part of formatterFor(timeZone).formatToParts(toMs(instant))) {
46
+ if (part.type !== 'literal')
47
+ out[part.type] = Number(part.value);
48
+ }
49
+ return {
50
+ year: out.year,
51
+ month: out.month,
52
+ day: out.day,
53
+ hour: out.hour % 24,
54
+ minute: out.minute,
55
+ second: out.second,
56
+ };
57
+ }
58
+ /**
59
+ * Minutes the zone is ahead of UTC at `instant` (positive east, so
60
+ * `America/Costa_Rica` is `-360`). DST-aware.
61
+ *
62
+ * @param instant - the instant.
63
+ * @param timeZone - an IANA zone id.
64
+ * @returns the offset in minutes.
65
+ *
66
+ * @stability experimental
67
+ */
68
+ function getTimeZoneOffsetMinutes(instant, timeZone) {
69
+ const ms = toMs(instant);
70
+ const p = getZonedParts(ms, timeZone);
71
+ const asUtc = Date.UTC(p.year, p.month - 1, p.day, p.hour, p.minute, p.second);
72
+ // Drop the sub-second part so it does not skew the minute count.
73
+ const wholeSecond = Math.floor(ms / 1000) * 1000;
74
+ return Math.round((asUtc - wholeSecond) / MINUTE_MS);
75
+ }
76
+ function pad(n, width = 2) {
77
+ return String(n).padStart(width, '0');
78
+ }
79
+ /**
80
+ * The calendar day (`YYYY-MM-DD`) `instant` falls on in `timeZone`.
81
+ *
82
+ * @param instant - the instant.
83
+ * @param timeZone - an IANA zone id.
84
+ * @returns the zone's calendar day.
85
+ *
86
+ * @stability experimental
87
+ */
88
+ function zonedDateKey(instant, timeZone) {
89
+ const p = getZonedParts(instant, timeZone);
90
+ return `${pad(p.year, 4)}-${pad(p.month)}-${pad(p.day)}`;
91
+ }
92
+ /**
93
+ * Whether `value` is a well-formed `YYYY-MM-DD` that names a real day.
94
+ *
95
+ * @stability experimental
96
+ */
97
+ function isDateKey(value) {
98
+ if (typeof value !== 'string')
99
+ return false;
100
+ const m = DATE_KEY.exec(value);
101
+ if (!m)
102
+ return false;
103
+ const [y, mo, d] = [Number(m[1]), Number(m[2]), Number(m[3])];
104
+ const probe = new Date(Date.UTC(y, mo - 1, d));
105
+ return probe.getUTCFullYear() === y && probe.getUTCMonth() === mo - 1 && probe.getUTCDate() === d;
106
+ }
107
+ function parseKey(day) {
108
+ if (!isDateKey(day))
109
+ throw new RangeError(`Not a YYYY-MM-DD day: ${day}`);
110
+ const m = DATE_KEY.exec(day);
111
+ return { y: Number(m[1]), m: Number(m[2]), d: Number(m[3]) };
112
+ }
113
+ /**
114
+ * `day` shifted by whole calendar days, with no time zone involved.
115
+ *
116
+ * @param day - a `YYYY-MM-DD` day.
117
+ * @param days - days to add (negative subtracts).
118
+ * @returns the shifted day.
119
+ *
120
+ * @stability experimental
121
+ */
122
+ function addDaysToDateKey(day, days) {
123
+ const { y, m, d } = parseKey(day);
124
+ const shifted = new Date(Date.UTC(y, m - 1, d + days));
125
+ return `${pad(shifted.getUTCFullYear(), 4)}-${pad(shifted.getUTCMonth() + 1)}-${pad(shifted.getUTCDate())}`;
126
+ }
127
+ /**
128
+ * The instant at which the wall clock in `timeZone` reads the given fields.
129
+ * A repeated local time (clocks going back) resolves to the earlier instant; a
130
+ * skipped one (clocks going forward) resolves to the first instant after the gap.
131
+ */
132
+ function zonedWallToInstant(fields, timeZone) {
133
+ const localMs = Date.UTC(fields.year, fields.month - 1, fields.day, fields.hour, fields.minute, fields.second, fields.ms);
134
+ const offsets = new Set([
135
+ getTimeZoneOffsetMinutes(localMs - DAY_MS, timeZone),
136
+ getTimeZoneOffsetMinutes(localMs + DAY_MS, timeZone),
137
+ ]);
138
+ const candidates = [...offsets].map((o) => localMs - o * MINUTE_MS);
139
+ const valid = candidates.filter((c) => localMs - getTimeZoneOffsetMinutes(c, timeZone) * MINUTE_MS === c);
140
+ if (valid.length > 0)
141
+ return new Date(Math.min(...valid));
142
+ // Inside a gap: the wall time never happened. Use the pre-transition offset,
143
+ // which lands on the first instant after the gap.
144
+ return new Date(Math.max(...candidates));
145
+ }
146
+ /**
147
+ * The instant of local midnight at the start of `day` in `timeZone`. DST-safe:
148
+ * the day may be 23 or 25 hours long, and where midnight itself is skipped the
149
+ * day starts at the first instant after the gap.
150
+ *
151
+ * @param day - a `YYYY-MM-DD` day.
152
+ * @param timeZone - an IANA zone id.
153
+ * @returns the day's first instant.
154
+ *
155
+ * @stability experimental
156
+ */
157
+ function zonedDayStart(day, timeZone) {
158
+ const { y, m, d } = parseKey(day);
159
+ return zonedWallToInstant({ year: y, month: m, day: d, hour: 0, minute: 0, second: 0, ms: 0 }, timeZone);
160
+ }
161
+ /**
162
+ * `instant` plus calendar days or months, computed on the wall clock of
163
+ * `timeZone` so the time of day is kept across DST changes. A month step clamps
164
+ * to the end of a shorter month (Jan 31 plus one month is Feb 28, or 29 in a
165
+ * leap year).
166
+ *
167
+ * @param instant - the starting instant.
168
+ * @param duration - `{ days }` or `{ months }` (integers, negative allowed).
169
+ * @param timeZone - an IANA zone id.
170
+ * @returns the resulting instant.
171
+ *
172
+ * @stability experimental
173
+ */
174
+ function addCalendarInZone(instant, duration, timeZone) {
175
+ const ms = toMs(instant);
176
+ const p = getZonedParts(ms, timeZone);
177
+ const subMs = ((ms % 1000) + 1000) % 1000;
178
+ let { year, month, day } = p;
179
+ if ('days' in duration) {
180
+ const shifted = new Date(Date.UTC(year, month - 1, day + duration.days));
181
+ year = shifted.getUTCFullYear();
182
+ month = shifted.getUTCMonth() + 1;
183
+ day = shifted.getUTCDate();
184
+ }
185
+ else {
186
+ const total = year * 12 + (month - 1) + duration.months;
187
+ year = Math.floor(total / 12);
188
+ month = (total % 12 + 12) % 12 + 1;
189
+ const lastDay = new Date(Date.UTC(year, month, 0)).getUTCDate();
190
+ day = Math.min(day, lastDay);
191
+ }
192
+ return zonedWallToInstant({ year, month, day, hour: p.hour, minute: p.minute, second: p.second, ms: subMs }, timeZone);
193
+ }
194
+ //# sourceMappingURL=schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../../src/timezone/schemas.ts"],"names":[],"mappings":";;AAiEA,sCAaC;AAYD,4DAOC;AAeD,oCAGC;AAOD,8BAOC;AAiBD,4CAIC;AAmCD,sCAGC;AA8BD,8CAkBC;AAhND,MAAM,SAAS,GAAG,MAAM,CAAC;AACzB,MAAM,MAAM,GAAG,UAAU,CAAC;AAC1B,MAAM,QAAQ,GAAG,2BAA2B,CAAC;AAE7C,MAAM,UAAU,GAAG,IAAI,GAAG,EAA+B,CAAC;AAE1D,SAAS,YAAY,CAAC,QAAgB;IACpC,IAAI,GAAG,GAAG,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACnC,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,GAAG,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE;YACrC,QAAQ;YACR,SAAS,EAAE,KAAK;YAChB,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,SAAS;YAChB,GAAG,EAAE,SAAS;YACd,IAAI,EAAE,SAAS;YACf,MAAM,EAAE,SAAS;YACjB,MAAM,EAAE,SAAS;SAClB,CAAC,CAAC;QACH,UAAU,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IAChC,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,IAAI,CAAC,OAAsB;IAClC,OAAO,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;AACnE,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,aAAa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AE,EAAE,KAAK,EAAE,EAAE,QAAQ,CAAC,CAAC;AACzH,CAAC"}
@@ -0,0 +1,154 @@
1
+ /**
2
+ * The entries type `z.enum` builds for a list of values, named so the API
3
+ * reference shows one type instead of an anonymous object per property.
4
+ *
5
+ * @typeParam V - the values.
6
+ * @stability experimental
7
+ */
8
+ export type WebhookEnumEntries<V extends string> = {
9
+ readonly [K in V]: K;
10
+ };
11
+ /**
12
+ * Who owns an endpoint: a `user` (their own, inside the active organization),
13
+ * an `org` (shared by the organization's administrators) or the `system`
14
+ * (the deployment; administrators only).
15
+ *
16
+ * @stability experimental
17
+ */
18
+ export declare const WEBHOOK_SCOPES: readonly ["user", "org", "system"];
19
+ /**
20
+ * One webhook scope.
21
+ *
22
+ * @stability experimental
23
+ */
24
+ export type WebhookScope = (typeof WEBHOOK_SCOPES)[number];
25
+ /**
26
+ * The lifecycle of one delivery: `pending` (queued), `delivering` (an attempt
27
+ * is running), `succeeded` (a 2xx answer), `failed` (an attempt failed and a
28
+ * retry is scheduled) and `dead` (retries exhausted, or the endpoint is gone).
29
+ *
30
+ * @stability experimental
31
+ */
32
+ export declare const WEBHOOK_DELIVERY_STATUSES: readonly ["pending", "delivering", "succeeded", "failed", "dead"];
33
+ /**
34
+ * One delivery status.
35
+ *
36
+ * @stability experimental
37
+ */
38
+ export type WebhookDeliveryStatus = (typeof WEBHOOK_DELIVERY_STATUSES)[number];
39
+ /**
40
+ * The permission strings the webhook routes enforce, per scope: user
41
+ * (`webhooks:*`), organization (`org_webhooks:*`) and system
42
+ * (`system_webhooks:*`).
43
+ *
44
+ * @stability experimental
45
+ */
46
+ export declare const WEBHOOK_PERMISSIONS: {
47
+ /** View your own endpoints and their deliveries. */
48
+ readonly READ: "webhooks:read";
49
+ /** Manage your own endpoints. */
50
+ readonly WRITE: "webhooks:write";
51
+ /** View the organization's endpoints and deliveries. */
52
+ readonly ORG_READ: "org_webhooks:read";
53
+ /** Manage the organization's endpoints. */
54
+ readonly ORG_WRITE: "org_webhooks:write";
55
+ /** View the deployment's endpoints and deliveries. */
56
+ readonly SYSTEM_READ: "system_webhooks:read";
57
+ /** Manage the deployment's endpoints. */
58
+ readonly SYSTEM_WRITE: "system_webhooks:write";
59
+ };
60
+ /**
61
+ * The request headers of a delivery (the Standard Webhooks names).
62
+ *
63
+ * @stability experimental
64
+ */
65
+ export declare const WEBHOOK_HEADERS: {
66
+ /** The event id; identical across retries, so a receiver can dedupe. */
67
+ readonly ID: "webhook-id";
68
+ /** Unix seconds at signing time. */
69
+ readonly TIMESTAMP: "webhook-timestamp";
70
+ /** Space separated `v1,<base64>` signatures (two during a rotation overlap). */
71
+ readonly SIGNATURE: "webhook-signature";
72
+ };
73
+ /**
74
+ * The `apiVersion` of the envelope.
75
+ *
76
+ * @stability experimental
77
+ */
78
+ export declare const WEBHOOK_API_VERSION = "2026-11-01";
79
+ /**
80
+ * The prefix of a signing secret (`whsec_<base64 key>`).
81
+ *
82
+ * @stability experimental
83
+ */
84
+ export declare const WEBHOOK_SECRET_PREFIX = "whsec_";
85
+ /**
86
+ * The signature scheme tag of a `webhook-signature` entry.
87
+ *
88
+ * @stability experimental
89
+ */
90
+ export declare const WEBHOOK_SIGNATURE_VERSION = "v1";
91
+ /**
92
+ * The default clock tolerance of {@link verifyWebhookSignature}, in seconds.
93
+ *
94
+ * @stability experimental
95
+ */
96
+ export declare const WEBHOOK_DEFAULT_TOLERANCE_SECONDS = 300;
97
+ /**
98
+ * The stable error codes of the webhook routes.
99
+ *
100
+ * @stability experimental
101
+ */
102
+ export declare const WEBHOOK_ERROR_CODES: {
103
+ /** The endpoint does not exist, or is not the caller's to see (404). */
104
+ readonly WEBHOOK_NOT_FOUND: "WEBHOOK_NOT_FOUND";
105
+ /** The delivery does not exist for this endpoint (404). */
106
+ readonly WEBHOOK_DELIVERY_NOT_FOUND: "WEBHOOK_DELIVERY_NOT_FOUND";
107
+ /** The URL is malformed or not http(s) (400). */
108
+ readonly WEBHOOK_URL_INVALID: "WEBHOOK_URL_INVALID";
109
+ /** The URL targets a host the egress policy refuses (400). */
110
+ readonly WEBHOOK_URL_FORBIDDEN: "WEBHOOK_URL_FORBIDDEN";
111
+ /** A subscription names an event that is not registered (400). */
112
+ readonly WEBHOOK_EVENT_UNKNOWN: "WEBHOOK_EVENT_UNKNOWN";
113
+ /** The owner may not subscribe to an event (403). */
114
+ readonly WEBHOOK_EVENT_NOT_PERMITTED: "WEBHOOK_EVENT_NOT_PERMITTED";
115
+ /** The owner already has the most endpoints allowed (409). */
116
+ readonly WEBHOOK_LIMIT_REACHED: "WEBHOOK_LIMIT_REACHED";
117
+ };
118
+ /**
119
+ * One webhook error code.
120
+ *
121
+ * @stability experimental
122
+ */
123
+ export type WebhookErrorCode = (typeof WEBHOOK_ERROR_CODES)[keyof typeof WEBHOOK_ERROR_CODES];
124
+ /**
125
+ * What an event key looks like: dot separated lower-case segments
126
+ * (`nodes.node.offline`), at least two. Event keys are an OPEN vocabulary
127
+ * (an app registers its own).
128
+ *
129
+ * @stability experimental
130
+ */
131
+ export declare const WEBHOOK_EVENT_KEY_REGEX_SOURCE = "[a-z][a-z0-9_]*(?:\\.[a-z][a-z0-9_]*)+";
132
+ /**
133
+ * What a subscription entry may be: an exact event key (`jobs.job.failed`), a
134
+ * group wildcard (`nodes.*`, `notification.*`) or `*` for every event the
135
+ * owner is permitted to receive.
136
+ *
137
+ * @stability experimental
138
+ */
139
+ export declare const WEBHOOK_EVENT_KEY_PATTERN: RegExp;
140
+ /** The longest event key or subscription entry. @stability experimental */
141
+ export declare const WEBHOOK_EVENT_KEY_MAX = 128;
142
+ /** The most subscription entries on one endpoint. @stability experimental */
143
+ export declare const WEBHOOK_EVENT_KEYS_MAX = 100;
144
+ /** The longest endpoint name. @stability experimental */
145
+ export declare const WEBHOOK_NAME_MAX = 120;
146
+ /** The longest endpoint description. @stability experimental */
147
+ export declare const WEBHOOK_DESCRIPTION_MAX = 500;
148
+ /** The longest endpoint URL. @stability experimental */
149
+ export declare const WEBHOOK_URL_MAX = 2048;
150
+ /** The largest delivery list page. @stability experimental */
151
+ export declare const WEBHOOK_DELIVERIES_PAGE_SIZE_MAX = 100;
152
+ /** The default delivery list page size. @stability experimental */
153
+ export declare const WEBHOOK_DELIVERIES_PAGE_SIZE_DEFAULT = 20;
154
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/webhooks/constants.ts"],"names":[],"mappings":"AAQA;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,MAAM,IAAI;IAAE,QAAQ,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC;CAAE,CAAC;AAE5E;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,oCAAqC,CAAC;AAEjE;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE3D;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,mEAAoE,CAAC;AAE3G;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,yBAAyB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/E;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB;IAC9B,oDAAoD;;IAEpD,iCAAiC;;IAEjC,wDAAwD;;IAExD,2CAA2C;;IAE3C,sDAAsD;;IAEtD,yCAAyC;;CAEjC,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,eAAe;IAC1B,wEAAwE;;IAExE,oCAAoC;;IAEpC,gFAAgF;;CAExE,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,eAAe,CAAC;AAEhD;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,WAAW,CAAC;AAE9C;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,OAAO,CAAC;AAE9C;;;;GAIG;AACH,eAAO,MAAM,iCAAiC,MAAM,CAAC;AAErD;;;;GAIG;AACH,eAAO,MAAM,mBAAmB;IAC9B,wEAAwE;;IAExE,2DAA2D;;IAE3D,iDAAiD;;IAEjD,8DAA8D;;IAE9D,kEAAkE;;IAElE,qDAAqD;;IAErD,8DAA8D;;CAEtD,CAAC;AAEX;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,OAAO,mBAAmB,CAAC,CAAC;AAE9F;;;;;;GAMG;AACH,eAAO,MAAM,8BAA8B,2CAA2C,CAAC;AAEvF;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,QAErC,CAAC;AAEF,2EAA2E;AAC3E,eAAO,MAAM,qBAAqB,MAAM,CAAC;AACzC,6EAA6E;AAC7E,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAC1C,yDAAyD;AACzD,eAAO,MAAM,gBAAgB,MAAM,CAAC;AACpC,gEAAgE;AAChE,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAC3C,wDAAwD;AACxD,eAAO,MAAM,eAAe,OAAO,CAAC;AACpC,8DAA8D;AAC9D,eAAO,MAAM,gCAAgC,MAAM,CAAC;AACpD,mEAAmE;AACnE,eAAO,MAAM,oCAAoC,KAAK,CAAC"}
@@ -0,0 +1,136 @@
1
+ "use strict";
2
+ // =============================================================================
3
+ // The webhooks slice's zod-free constants (issue #1046)
4
+ // =============================================================================
5
+ //
6
+ // Plain values and string-literal unions only (no zod), so a browser that needs
7
+ // a constant or a type never bundles zod (test/no-zod-in-constants.test.ts).
8
+ // =============================================================================
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.WEBHOOK_DELIVERIES_PAGE_SIZE_DEFAULT = exports.WEBHOOK_DELIVERIES_PAGE_SIZE_MAX = exports.WEBHOOK_URL_MAX = exports.WEBHOOK_DESCRIPTION_MAX = exports.WEBHOOK_NAME_MAX = exports.WEBHOOK_EVENT_KEYS_MAX = exports.WEBHOOK_EVENT_KEY_MAX = exports.WEBHOOK_EVENT_KEY_PATTERN = exports.WEBHOOK_EVENT_KEY_REGEX_SOURCE = exports.WEBHOOK_ERROR_CODES = exports.WEBHOOK_DEFAULT_TOLERANCE_SECONDS = exports.WEBHOOK_SIGNATURE_VERSION = exports.WEBHOOK_SECRET_PREFIX = exports.WEBHOOK_API_VERSION = exports.WEBHOOK_HEADERS = exports.WEBHOOK_PERMISSIONS = exports.WEBHOOK_DELIVERY_STATUSES = exports.WEBHOOK_SCOPES = void 0;
11
+ /**
12
+ * Who owns an endpoint: a `user` (their own, inside the active organization),
13
+ * an `org` (shared by the organization's administrators) or the `system`
14
+ * (the deployment; administrators only).
15
+ *
16
+ * @stability experimental
17
+ */
18
+ exports.WEBHOOK_SCOPES = ['user', 'org', 'system'];
19
+ /**
20
+ * The lifecycle of one delivery: `pending` (queued), `delivering` (an attempt
21
+ * is running), `succeeded` (a 2xx answer), `failed` (an attempt failed and a
22
+ * retry is scheduled) and `dead` (retries exhausted, or the endpoint is gone).
23
+ *
24
+ * @stability experimental
25
+ */
26
+ exports.WEBHOOK_DELIVERY_STATUSES = ['pending', 'delivering', 'succeeded', 'failed', 'dead'];
27
+ /**
28
+ * The permission strings the webhook routes enforce, per scope: user
29
+ * (`webhooks:*`), organization (`org_webhooks:*`) and system
30
+ * (`system_webhooks:*`).
31
+ *
32
+ * @stability experimental
33
+ */
34
+ exports.WEBHOOK_PERMISSIONS = {
35
+ /** View your own endpoints and their deliveries. */
36
+ READ: 'webhooks:read',
37
+ /** Manage your own endpoints. */
38
+ WRITE: 'webhooks:write',
39
+ /** View the organization's endpoints and deliveries. */
40
+ ORG_READ: 'org_webhooks:read',
41
+ /** Manage the organization's endpoints. */
42
+ ORG_WRITE: 'org_webhooks:write',
43
+ /** View the deployment's endpoints and deliveries. */
44
+ SYSTEM_READ: 'system_webhooks:read',
45
+ /** Manage the deployment's endpoints. */
46
+ SYSTEM_WRITE: 'system_webhooks:write',
47
+ };
48
+ /**
49
+ * The request headers of a delivery (the Standard Webhooks names).
50
+ *
51
+ * @stability experimental
52
+ */
53
+ exports.WEBHOOK_HEADERS = {
54
+ /** The event id; identical across retries, so a receiver can dedupe. */
55
+ ID: 'webhook-id',
56
+ /** Unix seconds at signing time. */
57
+ TIMESTAMP: 'webhook-timestamp',
58
+ /** Space separated `v1,<base64>` signatures (two during a rotation overlap). */
59
+ SIGNATURE: 'webhook-signature',
60
+ };
61
+ /**
62
+ * The `apiVersion` of the envelope.
63
+ *
64
+ * @stability experimental
65
+ */
66
+ exports.WEBHOOK_API_VERSION = '2026-11-01';
67
+ /**
68
+ * The prefix of a signing secret (`whsec_<base64 key>`).
69
+ *
70
+ * @stability experimental
71
+ */
72
+ exports.WEBHOOK_SECRET_PREFIX = 'whsec_';
73
+ /**
74
+ * The signature scheme tag of a `webhook-signature` entry.
75
+ *
76
+ * @stability experimental
77
+ */
78
+ exports.WEBHOOK_SIGNATURE_VERSION = 'v1';
79
+ /**
80
+ * The default clock tolerance of {@link verifyWebhookSignature}, in seconds.
81
+ *
82
+ * @stability experimental
83
+ */
84
+ exports.WEBHOOK_DEFAULT_TOLERANCE_SECONDS = 300;
85
+ /**
86
+ * The stable error codes of the webhook routes.
87
+ *
88
+ * @stability experimental
89
+ */
90
+ exports.WEBHOOK_ERROR_CODES = {
91
+ /** The endpoint does not exist, or is not the caller's to see (404). */
92
+ WEBHOOK_NOT_FOUND: 'WEBHOOK_NOT_FOUND',
93
+ /** The delivery does not exist for this endpoint (404). */
94
+ WEBHOOK_DELIVERY_NOT_FOUND: 'WEBHOOK_DELIVERY_NOT_FOUND',
95
+ /** The URL is malformed or not http(s) (400). */
96
+ WEBHOOK_URL_INVALID: 'WEBHOOK_URL_INVALID',
97
+ /** The URL targets a host the egress policy refuses (400). */
98
+ WEBHOOK_URL_FORBIDDEN: 'WEBHOOK_URL_FORBIDDEN',
99
+ /** A subscription names an event that is not registered (400). */
100
+ WEBHOOK_EVENT_UNKNOWN: 'WEBHOOK_EVENT_UNKNOWN',
101
+ /** The owner may not subscribe to an event (403). */
102
+ WEBHOOK_EVENT_NOT_PERMITTED: 'WEBHOOK_EVENT_NOT_PERMITTED',
103
+ /** The owner already has the most endpoints allowed (409). */
104
+ WEBHOOK_LIMIT_REACHED: 'WEBHOOK_LIMIT_REACHED',
105
+ };
106
+ /**
107
+ * What an event key looks like: dot separated lower-case segments
108
+ * (`nodes.node.offline`), at least two. Event keys are an OPEN vocabulary
109
+ * (an app registers its own).
110
+ *
111
+ * @stability experimental
112
+ */
113
+ exports.WEBHOOK_EVENT_KEY_REGEX_SOURCE = '[a-z][a-z0-9_]*(?:\\.[a-z][a-z0-9_]*)+';
114
+ /**
115
+ * What a subscription entry may be: an exact event key (`jobs.job.failed`), a
116
+ * group wildcard (`nodes.*`, `notification.*`) or `*` for every event the
117
+ * owner is permitted to receive.
118
+ *
119
+ * @stability experimental
120
+ */
121
+ exports.WEBHOOK_EVENT_KEY_PATTERN = new RegExp(`^(?:\\*|[a-z][a-z0-9_]*(?:\\.[a-z][a-z0-9_]*)*\\.\\*|${exports.WEBHOOK_EVENT_KEY_REGEX_SOURCE})$`);
122
+ /** The longest event key or subscription entry. @stability experimental */
123
+ exports.WEBHOOK_EVENT_KEY_MAX = 128;
124
+ /** The most subscription entries on one endpoint. @stability experimental */
125
+ exports.WEBHOOK_EVENT_KEYS_MAX = 100;
126
+ /** The longest endpoint name. @stability experimental */
127
+ exports.WEBHOOK_NAME_MAX = 120;
128
+ /** The longest endpoint description. @stability experimental */
129
+ exports.WEBHOOK_DESCRIPTION_MAX = 500;
130
+ /** The longest endpoint URL. @stability experimental */
131
+ exports.WEBHOOK_URL_MAX = 2048;
132
+ /** The largest delivery list page. @stability experimental */
133
+ exports.WEBHOOK_DELIVERIES_PAGE_SIZE_MAX = 100;
134
+ /** The default delivery list page size. @stability experimental */
135
+ exports.WEBHOOK_DELIVERIES_PAGE_SIZE_DEFAULT = 20;
136
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src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AqB,EAAE,uBAAuB;IAC9C,kEAAkE;IAClE,qBAAqB,EAAE,uBAAuB;IAC9C,qDAAqD;IACrD,2BAA2B,EAAE,6BAA6B;IAC1D,8DAA8D;IAC9D,qBAAqB,EAAE,uBAAuB;CACtC,CAAC;AASX;;;;;;GAMG;AACU,QAAA,8BAA8B,GAAG,wCAAwC,CAAC;AAEvF;;;;;;GAMG;AACU,QAAA,yBAAyB,GAAG,IAAI,MAAM,CACjD,wDAAwD,sCAA8B,IAAI,CAC3F,CAAC;AAEF,2EAA2E;AAC9D,QAAA,qBAAqB,GAAG,GAAG,CAAC;AACzC,6EAA6E;AAChE,QAAA,sBAAsB,GAAG,GAAG,CAAC;AAC1C,yDAAyD;AAC5C,QAAA,gBAAgB,GAAG,GAAG,CAAC;AACpC,gEAAgE;AACnD,QAAA,uBAAuB,GAAG,GAAG,CAAC;AAC3C,wDAAwD;AAC3C,QAAA,eAAe,GAAG,IAAI,CAAC;AACpC,8DAA8D;AACjD,QAAA,gCAAgC,GAAG,GAAG,CAAC;AACpD,mEAAmE;AACtD,QAAA,oCAAoC,GAAG,EAAE,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { z } from 'zod';
2
+ import type { WebhookEnumEntries } from './constants.js';
3
+ /** `z.enum(values)`, typed as `ZodEnum<WebhookEnumEntries<value>>` (a named entries type for the API reference). */
4
+ export declare function wireEnum<const T extends readonly [string, ...string[]]>(values: T): z.ZodEnum<WebhookEnumEntries<T[number]>>;
5
+ //# sourceMappingURL=enum.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enum.d.ts","sourceRoot":"","sources":["../../../src/webhooks/enum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,oHAAoH;AACpH,wBAAgB,QAAQ,CAAC,KAAK,CAAC,CAAC,SAAS,SAAS,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAE5H"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.wireEnum = wireEnum;
4
+ const zod_1 = require("zod");
5
+ /** `z.enum(values)`, typed as `ZodEnum<WebhookEnumEntries<value>>` (a named entries type for the API reference). */
6
+ function wireEnum(values) {
7
+ return zod_1.z.enum(values);
8
+ }
9
+ //# sourceMappingURL=enum.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enum.js","sourceRoot":"","sources":["../../../src/webhooks/enum.ts"],"names":[],"mappings":";;AAKA,4BAEC;AAPD,6BAAwB;AAIxB,oHAAoH;AACpH,SAAgB,QAAQ,CAAiD,MAAS;IAChF,OAAO,OAAC,CAAC,IAAI,CAAC,MAAM,CAAwD,CAAC;AAC/E,CAAC"}
@@ -0,0 +1,7 @@
1
+ export { WEBHOOK_API_VERSION, WEBHOOK_DEFAULT_TOLERANCE_SECONDS, WEBHOOK_DELIVERIES_PAGE_SIZE_DEFAULT, WEBHOOK_DELIVERIES_PAGE_SIZE_MAX, WEBHOOK_DELIVERY_STATUSES, WEBHOOK_DESCRIPTION_MAX, WEBHOOK_ERROR_CODES, WEBHOOK_EVENT_KEY_MAX, WEBHOOK_EVENT_KEY_PATTERN, WEBHOOK_EVENT_KEY_REGEX_SOURCE, WEBHOOK_EVENT_KEYS_MAX, WEBHOOK_HEADERS, WEBHOOK_NAME_MAX, WEBHOOK_PERMISSIONS, WEBHOOK_SCOPES, WEBHOOK_SECRET_PREFIX, WEBHOOK_SIGNATURE_VERSION, WEBHOOK_URL_MAX, } from './constants.js';
2
+ export type { WebhookDeliveryStatus, WebhookEnumEntries, WebhookErrorCode, WebhookScope } from './constants.js';
3
+ export { createWebhookEndpointSchema, rotateWebhookSecretResponseSchema, updateWebhookEndpointSchema, webhookDeliveryDetailSchema, webhookDeliveryListQuerySchema, webhookDeliveryListSchema, webhookDeliverySchema, webhookDeliveryStatusSchema, webhookEndpointCreatedSchema, webhookEndpointListSchema, webhookEndpointSchema, webhookEnvelopeSchema, webhookEventCatalogEntrySchema, webhookEventCatalogSchema, webhookEventKeySchema, webhookScopeSchema, webhookTestResponseSchema, } from './schemas.js';
4
+ export type { CreateWebhookEndpoint, CreateWebhookEndpointInput, RotateWebhookSecretResponse, UpdateWebhookEndpoint, WebhookDelivery, WebhookDeliveryDetail, WebhookDeliveryList, WebhookDeliveryListQuery, WebhookEndpoint, WebhookEndpointCreated, WebhookEndpointList, WebhookEnvelope, WebhookEventCatalog, WebhookEventCatalogEntry, WebhookTestResponse, } from './schemas.js';
5
+ export { signWebhookPayload, verifyWebhookSignature } from './signature.js';
6
+ export type { SignWebhookPayloadInput, VerifyWebhookSignatureInput } from './signature.js';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/webhooks/index.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,mBAAmB,EACnB,iCAAiC,EACjC,oCAAoC,EACpC,gCAAgC,EAChC,yBAAyB,EACzB,uBAAuB,EACvB,mBAAmB,EACnB,qBAAqB,EACrB,yBAAyB,EACzB,8BAA8B,EAC9B,sBAAsB,EACtB,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EACd,qBAAqB,EACrB,yBAAyB,EACzB,eAAe,GAChB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAChH,OAAO,EACL,2BAA2B,EAC3B,iCAAiC,EACjC,2BAA2B,EAC3B,2BAA2B,EAC3B,8BAA8B,EAC9B,yBAAyB,EACzB,qBAAqB,EACrB,2BAA2B,EAC3B,4BAA4B,EAC5B,yBAAyB,EACzB,qBAAqB,EACrB,qBAAqB,EACrB,8BAA8B,EAC9B,yBAAyB,EACzB,qBAAqB,EACrB,kBAAkB,EAClB,yBAAyB,GAC1B,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,qBAAqB,EACrB,0BAA0B,EAC1B,2BAA2B,EAC3B,qBAAqB,EACrB,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,wBAAwB,EACxB,eAAe,EACf,sBAAsB,EACtB,mBAAmB,EACnB,eAAe,EACf,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAC5E,YAAY,EAAE,uBAAuB,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC"}