@mountaya/client 0.1.0 → 0.2.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 (67) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/README.md +2 -2
  3. package/dist/admin/index.cjs +2876 -3502
  4. package/dist/admin/index.cjs.map +1 -1
  5. package/dist/admin/index.d.cts +731 -912
  6. package/dist/admin/index.d.ts +731 -912
  7. package/dist/admin/index.js +188 -285
  8. package/dist/admin/index.js.map +1 -1
  9. package/dist/browser.cjs +5913 -7993
  10. package/dist/browser.cjs.map +1 -1
  11. package/dist/browser.d.cts +42 -78
  12. package/dist/browser.d.ts +42 -78
  13. package/dist/browser.js +18 -49
  14. package/dist/browser.js.map +1 -1
  15. package/dist/chunk-CeEX7ayk.d.cts +75531 -0
  16. package/dist/chunk-CeEX7ayk.d.ts +75531 -0
  17. package/dist/chunk-Cg7Dtcb4.js +2987 -0
  18. package/dist/chunk-Cg7Dtcb4.js.map +1 -0
  19. package/dist/chunk-DJqUsgsy.d.ts +1463 -0
  20. package/dist/chunk-DNc8T5K1.js +241 -0
  21. package/dist/chunk-DNc8T5K1.js.map +1 -0
  22. package/dist/chunk-DTxzw3hu.d.cts +1463 -0
  23. package/dist/chunk-DmxQID5X.js +2289 -0
  24. package/dist/chunk-DmxQID5X.js.map +1 -0
  25. package/dist/chunk-DoZt_oIV.d.ts +3991 -0
  26. package/dist/chunk-DpJrqANO.js +11 -0
  27. package/dist/chunk-Dx8mPAdC.d.cts +3991 -0
  28. package/dist/chunk-X2ukY3ho.js +419 -0
  29. package/dist/chunk-X2ukY3ho.js.map +1 -0
  30. package/dist/events/index.cjs +1338 -1874
  31. package/dist/events/index.cjs.map +1 -1
  32. package/dist/events/index.d.cts +373 -382
  33. package/dist/events/index.d.ts +373 -382
  34. package/dist/events/index.js +523 -806
  35. package/dist/events/index.js.map +1 -1
  36. package/dist/index.cjs +5908 -7988
  37. package/dist/index.cjs.map +1 -1
  38. package/dist/index.d.cts +37 -69
  39. package/dist/index.d.ts +37 -69
  40. package/dist/index.js +17 -48
  41. package/dist/index.js.map +1 -1
  42. package/package.json +7 -8
  43. package/src/browser.ts +1 -0
  44. package/src/core/rules/clientHeader.ts +1 -1
  45. package/src/core/rules/errors.ts +1 -1
  46. package/src/core/rules/nullMasks.gen.ts +14 -2
  47. package/src/core/rules/version.gen.ts +1 -1
  48. package/src/events/index.ts +1 -5
  49. package/src/rest/adminResources.gen.ts +2 -0
  50. package/src/rest/dates.gen.ts +1 -1
  51. package/src/rest/resources.gen.ts +2 -0
  52. package/src/rest/schema.gen.ts +247 -60
  53. package/src/tiles/schema.gen.ts +1 -3
  54. package/dist/chunk-BM526BHG.js +0 -342
  55. package/dist/chunk-BM526BHG.js.map +0 -1
  56. package/dist/chunk-D2YEVTG7.js +0 -327
  57. package/dist/chunk-D2YEVTG7.js.map +0 -1
  58. package/dist/chunk-OHKVUREN.js +0 -3500
  59. package/dist/chunk-OHKVUREN.js.map +0 -1
  60. package/dist/chunk-TDTK2L5H.js +0 -3842
  61. package/dist/chunk-TDTK2L5H.js.map +0 -1
  62. package/dist/coreOperations.gen-BMYPoBbz.d.ts +0 -1760
  63. package/dist/coreOperations.gen-BxX5xRxw.d.cts +0 -1760
  64. package/dist/errors-B-GqAtQv.d.cts +0 -75960
  65. package/dist/errors-B-GqAtQv.d.ts +0 -75960
  66. package/dist/operations.gen-CvTyzKNF.d.cts +0 -3993
  67. package/dist/operations.gen-DUD406TV.d.ts +0 -3993
@@ -1,301 +1,204 @@
1
- import { decodeRestSchema, decodeSchemaInstants } from '../chunk-BM526BHG.js';
2
- import { __export, postSession, postOrganizationWebhookEndpoint, postOrganizationWebhookDelivery, postOrganizationPublishableKey, postOrganizationInvitation, postOrganizationBillingSubscription, postOrganizationBillingProvision, postOrganizationBillingPaymentMethodSetup, postOrganizationBillingPaymentMethodSetDefault, postOrganizationBillingPaymentMethod, postOrganizationAiProviderConfig, postOrganization, postMyInvitationAccept, patchOrganizationWebhookEndpoint, patchOrganizationSettings, patchOrganizationPublishableKey, patchOrganizationMember, patchOrganizationBillingInfo, patchOrganizationAiProviderConfig, patchOrganization, patchMyPreferences, patchMyOrganizationNotificationPreferences, getWebhookEventTypes, getOrganizationWebhookHealth, getOrganizationWebhookEvents, getOrganizationWebhookEvent, getOrganizationWebhookEndpoints, getOrganizationWebhookEndpoint, getOrganizationWebhookDelivery, getOrganizationWebhookDeliveries, getOrganizationUsageTiles, getOrganizationUsageData, getOrganizationSettings, getOrganizationPublishableKeys, getOrganizationPublishableKey, getOrganizationMembers, getOrganizationInvitations, getOrganizationInvitation, getOrganizationBillingSubscription, getOrganizationBillingPromotionCode, getOrganizationBillingPaymentMethods, getOrganizationBillingInvoices, getOrganizationBillingInfo, getOrganizationAiProviderConfig, getOrganization, getMyPreferences, getMyOrganizations, getMyOrganizationNotificationPreferences, getMyInvitations, getBillingProducts, getAiProviders, deleteOrganizationWebhookEndpoint, deleteOrganizationPublishableKey, deleteOrganizationMember, deleteOrganizationInvitation, deleteOrganizationBillingSubscription, deleteOrganizationBillingPaymentMethod, deleteOrganizationAiProviderConfig, deleteMyInvitation, MountayaError, MountayaConfigurationError, describeType, refuseOption, bind } from '../chunk-TDTK2L5H.js';
3
-
4
- // src/rest/adminOperations.gen.ts
5
- var adminOperations_gen_exports = {};
6
- __export(adminOperations_gen_exports, {
7
- deleteMyInvitation: () => deleteMyInvitation,
8
- deleteOrganizationAiProviderConfig: () => deleteOrganizationAiProviderConfig,
9
- deleteOrganizationBillingPaymentMethod: () => deleteOrganizationBillingPaymentMethod,
10
- deleteOrganizationBillingSubscription: () => deleteOrganizationBillingSubscription,
11
- deleteOrganizationInvitation: () => deleteOrganizationInvitation,
12
- deleteOrganizationMember: () => deleteOrganizationMember,
13
- deleteOrganizationPublishableKey: () => deleteOrganizationPublishableKey,
14
- deleteOrganizationWebhookEndpoint: () => deleteOrganizationWebhookEndpoint,
15
- getAiProviders: () => getAiProviders,
16
- getBillingProducts: () => getBillingProducts,
17
- getMyInvitations: () => getMyInvitations,
18
- getMyOrganizationNotificationPreferences: () => getMyOrganizationNotificationPreferences,
19
- getMyOrganizations: () => getMyOrganizations,
20
- getMyPreferences: () => getMyPreferences,
21
- getOrganization: () => getOrganization,
22
- getOrganizationAiProviderConfig: () => getOrganizationAiProviderConfig,
23
- getOrganizationBillingInfo: () => getOrganizationBillingInfo,
24
- getOrganizationBillingInvoices: () => getOrganizationBillingInvoices,
25
- getOrganizationBillingPaymentMethods: () => getOrganizationBillingPaymentMethods,
26
- getOrganizationBillingPromotionCode: () => getOrganizationBillingPromotionCode,
27
- getOrganizationBillingSubscription: () => getOrganizationBillingSubscription,
28
- getOrganizationInvitation: () => getOrganizationInvitation,
29
- getOrganizationInvitations: () => getOrganizationInvitations,
30
- getOrganizationMembers: () => getOrganizationMembers,
31
- getOrganizationPublishableKey: () => getOrganizationPublishableKey,
32
- getOrganizationPublishableKeys: () => getOrganizationPublishableKeys,
33
- getOrganizationSettings: () => getOrganizationSettings,
34
- getOrganizationUsageData: () => getOrganizationUsageData,
35
- getOrganizationUsageTiles: () => getOrganizationUsageTiles,
36
- getOrganizationWebhookDeliveries: () => getOrganizationWebhookDeliveries,
37
- getOrganizationWebhookDelivery: () => getOrganizationWebhookDelivery,
38
- getOrganizationWebhookEndpoint: () => getOrganizationWebhookEndpoint,
39
- getOrganizationWebhookEndpoints: () => getOrganizationWebhookEndpoints,
40
- getOrganizationWebhookEvent: () => getOrganizationWebhookEvent,
41
- getOrganizationWebhookEvents: () => getOrganizationWebhookEvents,
42
- getOrganizationWebhookHealth: () => getOrganizationWebhookHealth,
43
- getWebhookEventTypes: () => getWebhookEventTypes,
44
- patchMyOrganizationNotificationPreferences: () => patchMyOrganizationNotificationPreferences,
45
- patchMyPreferences: () => patchMyPreferences,
46
- patchOrganization: () => patchOrganization,
47
- patchOrganizationAiProviderConfig: () => patchOrganizationAiProviderConfig,
48
- patchOrganizationBillingInfo: () => patchOrganizationBillingInfo,
49
- patchOrganizationMember: () => patchOrganizationMember,
50
- patchOrganizationPublishableKey: () => patchOrganizationPublishableKey,
51
- patchOrganizationSettings: () => patchOrganizationSettings,
52
- patchOrganizationWebhookEndpoint: () => patchOrganizationWebhookEndpoint,
53
- postMyInvitationAccept: () => postMyInvitationAccept,
54
- postOrganization: () => postOrganization,
55
- postOrganizationAiProviderConfig: () => postOrganizationAiProviderConfig,
56
- postOrganizationBillingPaymentMethod: () => postOrganizationBillingPaymentMethod,
57
- postOrganizationBillingPaymentMethodSetDefault: () => postOrganizationBillingPaymentMethodSetDefault,
58
- postOrganizationBillingPaymentMethodSetup: () => postOrganizationBillingPaymentMethodSetup,
59
- postOrganizationBillingProvision: () => postOrganizationBillingProvision,
60
- postOrganizationBillingSubscription: () => postOrganizationBillingSubscription,
61
- postOrganizationInvitation: () => postOrganizationInvitation,
62
- postOrganizationPublishableKey: () => postOrganizationPublishableKey,
63
- postOrganizationWebhookDelivery: () => postOrganizationWebhookDelivery,
64
- postOrganizationWebhookEndpoint: () => postOrganizationWebhookEndpoint,
65
- postSession: () => postSession
1
+ import { t as __exportAll } from "../chunk-DpJrqANO.js";
2
+ import { $ as getOrganizationPublishableKey, $t as postMyInvitationAccept, B as getMyOrganizations, Ct as patchOrganization, Dt as patchOrganizationPublishableKey, Et as patchOrganizationMember, G as getOrganizationBillingInvoices, H as getOrganization, J as getOrganizationBillingSubscription, K as getOrganizationBillingPaymentMethods, Mn as MountayaError, On as MountayaConfigurationError, Ot as patchOrganizationSettings, Q as getOrganizationMembers, R as getMyInvitations, St as patchMyPreferences, T as getBillingProducts, Tt as patchOrganizationBillingInfo, U as getOrganizationAiProviderConfig, V as getMyPreferences, W as getOrganizationBillingInfo, Wn as describeType, X as getOrganizationInvitation, Z as getOrganizationInvitations, _ as deleteOrganizationMember, an as postOrganizationBillingProvision, at as getOrganizationWebhookDelivery, ct as getOrganizationWebhookEvent, dn as postOrganizationWebhookEndpoint, dt as getWebhookEventTypes, en as postOrganization, er as refuseOption, et as getOrganizationPublishableKeys, f as deleteMyInvitation, fn as postSession, g as deleteOrganizationInvitation, h as deleteOrganizationBillingSubscription, in as postOrganizationBillingPaymentMethodSetup, it as getOrganizationWebhookDeliveries, kt as patchOrganizationWebhookEndpoint, ln as postOrganizationPublishableKey, lt as getOrganizationWebhookEvents, m as deleteOrganizationBillingPaymentMethod, nn as postOrganizationBillingPaymentMethod, nt as getOrganizationUsageData, on as postOrganizationBillingSubscription, ot as getOrganizationWebhookEndpoint, p as deleteOrganizationAiProviderConfig, q as getOrganizationBillingPromotionCode, rn as postOrganizationBillingPaymentMethodSetDefault, rt as getOrganizationUsageTiles, sn as postOrganizationInvitation, st as getOrganizationWebhookEndpoints, t as bind, tn as postOrganizationAiProviderConfig, tt as getOrganizationSettings, un as postOrganizationWebhookDelivery, ut as getOrganizationWebhookHealth, v as deleteOrganizationPublishableKey, w as getAiProviders, wt as patchOrganizationAiProviderConfig, xt as patchMyOrganizationNotificationPreferences, y as deleteOrganizationWebhookEndpoint, z as getMyOrganizationNotificationPreferences } from "../chunk-Cg7Dtcb4.js";
3
+ import { n as decodeSchemaInstants, t as decodeRestSchema } from "../chunk-X2ukY3ho.js";
4
+ var adminOperations_gen_exports = /* @__PURE__ */ __exportAll({
5
+ deleteMyInvitation: () => deleteMyInvitation,
6
+ deleteOrganizationAiProviderConfig: () => deleteOrganizationAiProviderConfig,
7
+ deleteOrganizationBillingPaymentMethod: () => deleteOrganizationBillingPaymentMethod,
8
+ deleteOrganizationBillingSubscription: () => deleteOrganizationBillingSubscription,
9
+ deleteOrganizationInvitation: () => deleteOrganizationInvitation,
10
+ deleteOrganizationMember: () => deleteOrganizationMember,
11
+ deleteOrganizationPublishableKey: () => deleteOrganizationPublishableKey,
12
+ deleteOrganizationWebhookEndpoint: () => deleteOrganizationWebhookEndpoint,
13
+ getAiProviders: () => getAiProviders,
14
+ getBillingProducts: () => getBillingProducts,
15
+ getMyInvitations: () => getMyInvitations,
16
+ getMyOrganizationNotificationPreferences: () => getMyOrganizationNotificationPreferences,
17
+ getMyOrganizations: () => getMyOrganizations,
18
+ getMyPreferences: () => getMyPreferences,
19
+ getOrganization: () => getOrganization,
20
+ getOrganizationAiProviderConfig: () => getOrganizationAiProviderConfig,
21
+ getOrganizationBillingInfo: () => getOrganizationBillingInfo,
22
+ getOrganizationBillingInvoices: () => getOrganizationBillingInvoices,
23
+ getOrganizationBillingPaymentMethods: () => getOrganizationBillingPaymentMethods,
24
+ getOrganizationBillingPromotionCode: () => getOrganizationBillingPromotionCode,
25
+ getOrganizationBillingSubscription: () => getOrganizationBillingSubscription,
26
+ getOrganizationInvitation: () => getOrganizationInvitation,
27
+ getOrganizationInvitations: () => getOrganizationInvitations,
28
+ getOrganizationMembers: () => getOrganizationMembers,
29
+ getOrganizationPublishableKey: () => getOrganizationPublishableKey,
30
+ getOrganizationPublishableKeys: () => getOrganizationPublishableKeys,
31
+ getOrganizationSettings: () => getOrganizationSettings,
32
+ getOrganizationUsageData: () => getOrganizationUsageData,
33
+ getOrganizationUsageTiles: () => getOrganizationUsageTiles,
34
+ getOrganizationWebhookDeliveries: () => getOrganizationWebhookDeliveries,
35
+ getOrganizationWebhookDelivery: () => getOrganizationWebhookDelivery,
36
+ getOrganizationWebhookEndpoint: () => getOrganizationWebhookEndpoint,
37
+ getOrganizationWebhookEndpoints: () => getOrganizationWebhookEndpoints,
38
+ getOrganizationWebhookEvent: () => getOrganizationWebhookEvent,
39
+ getOrganizationWebhookEvents: () => getOrganizationWebhookEvents,
40
+ getOrganizationWebhookHealth: () => getOrganizationWebhookHealth,
41
+ getWebhookEventTypes: () => getWebhookEventTypes,
42
+ patchMyOrganizationNotificationPreferences: () => patchMyOrganizationNotificationPreferences,
43
+ patchMyPreferences: () => patchMyPreferences,
44
+ patchOrganization: () => patchOrganization,
45
+ patchOrganizationAiProviderConfig: () => patchOrganizationAiProviderConfig,
46
+ patchOrganizationBillingInfo: () => patchOrganizationBillingInfo,
47
+ patchOrganizationMember: () => patchOrganizationMember,
48
+ patchOrganizationPublishableKey: () => patchOrganizationPublishableKey,
49
+ patchOrganizationSettings: () => patchOrganizationSettings,
50
+ patchOrganizationWebhookEndpoint: () => patchOrganizationWebhookEndpoint,
51
+ postMyInvitationAccept: () => postMyInvitationAccept,
52
+ postOrganization: () => postOrganization,
53
+ postOrganizationAiProviderConfig: () => postOrganizationAiProviderConfig,
54
+ postOrganizationBillingPaymentMethod: () => postOrganizationBillingPaymentMethod,
55
+ postOrganizationBillingPaymentMethodSetDefault: () => postOrganizationBillingPaymentMethodSetDefault,
56
+ postOrganizationBillingPaymentMethodSetup: () => postOrganizationBillingPaymentMethodSetup,
57
+ postOrganizationBillingProvision: () => postOrganizationBillingProvision,
58
+ postOrganizationBillingSubscription: () => postOrganizationBillingSubscription,
59
+ postOrganizationInvitation: () => postOrganizationInvitation,
60
+ postOrganizationPublishableKey: () => postOrganizationPublishableKey,
61
+ postOrganizationWebhookDelivery: () => postOrganizationWebhookDelivery,
62
+ postOrganizationWebhookEndpoint: () => postOrganizationWebhookEndpoint,
63
+ postSession: () => postSession
66
64
  });
67
-
68
- // src/webhooks/rules/constructWebhookEvent.ts
69
- var CONTEXT = "constructWebhookEvent";
70
- var DEFAULT_TOLERANCE_SECONDS = 300;
71
- var SECRET_PREFIX = "whsk_";
72
- var wholeSeconds = /^\d+$/;
73
- var LATEST_WRITTEN_SECONDS = 253402300799;
74
- var signedAt = (timestamp) => timestamp <= LATEST_WRITTEN_SECONDS ? new Date(timestamp * 1e3).toISOString() : `t=${timestamp}`;
65
+ const CONTEXT = "constructWebhookEvent";
66
+ const DEFAULT_TOLERANCE_SECONDS = 300;
67
+ const SECRET_PREFIX = "whsk_";
68
+ const wholeSeconds = /^\d+$/;
69
+ const LATEST_WRITTEN_SECONDS = 253402300799;
70
+ const signedAt = (timestamp) => timestamp <= LATEST_WRITTEN_SECONDS ? (/* @__PURE__ */ new Date(timestamp * 1e3)).toISOString() : `t=${timestamp}`;
75
71
  var MountayaWebhookSignatureError = class extends MountayaError {
76
- name = "MountayaWebhookSignatureError";
77
- /** Why the delivery was refused: see {@link WebhookSignatureFailure}. */
78
- reason;
79
- /**
80
- * @param message - what was refused, and what to do about it.
81
- * @param reason - why the delivery was refused.
82
- */
83
- constructor(message, reason) {
84
- super(message);
85
- this.reason = reason;
86
- }
72
+ name = "MountayaWebhookSignatureError";
73
+ reason;
74
+ constructor(message, reason) {
75
+ super(message);
76
+ this.reason = reason;
77
+ }
87
78
  };
88
- var parseSignatureHeader = (header) => {
89
- const signatures = [];
90
- const timestamps = [];
91
- for (const element of header.split(",")) {
92
- const separator = element.indexOf("=");
93
- if (separator === -1) {
94
- return void 0;
95
- }
96
- const key = element.slice(0, separator).trim();
97
- const value = element.slice(separator + 1).trim();
98
- if (key === "t") {
99
- timestamps.push(value);
100
- } else if (key === "v1") {
101
- signatures.push(value);
102
- }
103
- }
104
- const [stated] = timestamps;
105
- if (timestamps.length !== 1 || stated === void 0 || !wholeSeconds.test(stated)) {
106
- return void 0;
107
- }
108
- const timestamp = Number(stated);
109
- if (!Number.isSafeInteger(timestamp) || signatures.length === 0) {
110
- return void 0;
111
- }
112
- return { signatures, stated, timestamp };
79
+ const parseSignatureHeader = (header) => {
80
+ const signatures = [];
81
+ const timestamps = [];
82
+ for (const element of header.split(",")) {
83
+ const separator = element.indexOf("=");
84
+ if (separator === -1) return;
85
+ const key = element.slice(0, separator).trim();
86
+ const value = element.slice(separator + 1).trim();
87
+ if (key === "t") timestamps.push(value);
88
+ else if (key === "v1") signatures.push(value);
89
+ }
90
+ const [stated] = timestamps;
91
+ if (timestamps.length !== 1 || stated === void 0 || !wholeSeconds.test(stated)) return;
92
+ const timestamp = Number(stated);
93
+ if (!Number.isSafeInteger(timestamp) || signatures.length === 0) return;
94
+ return {
95
+ signatures,
96
+ stated,
97
+ timestamp
98
+ };
113
99
  };
114
- var subtleCrypto = () => {
115
- const runtime = globalThis;
116
- return runtime.crypto?.subtle;
100
+ const subtleCrypto = () => {
101
+ return globalThis.crypto?.subtle;
117
102
  };
118
- var hexOf = (bytes) => Array.from(new Uint8Array(bytes), (byte) => byte.toString(16).padStart(2, "0")).join("");
119
- var equalInConstantTime = (candidate, expected) => {
120
- if (candidate.length !== expected.length) {
121
- return false;
122
- }
123
- let difference = 0;
124
- for (let index = 0; index < expected.length; index += 1) {
125
- difference |= candidate.charCodeAt(index) ^ expected.charCodeAt(index);
126
- }
127
- return difference === 0;
103
+ const hexOf = (bytes) => Array.from(new Uint8Array(bytes), (byte) => byte.toString(16).padStart(2, "0")).join("");
104
+ const equalInConstantTime = (candidate, expected) => {
105
+ if (candidate.length !== expected.length) return false;
106
+ let difference = 0;
107
+ for (let index = 0; index < expected.length; index += 1) difference |= candidate.charCodeAt(index) ^ expected.charCodeAt(index);
108
+ return difference === 0;
128
109
  };
129
- var signedBytes = (stated, body) => {
130
- const prefix = new TextEncoder().encode(`${stated}.`);
131
- const signed = new Uint8Array(prefix.length + body.length);
132
- signed.set(prefix);
133
- signed.set(body, prefix.length);
134
- return signed;
110
+ const signedBytes = (stated, body) => {
111
+ const prefix = new TextEncoder().encode(`${stated}.`);
112
+ const signed = new Uint8Array(prefix.length + body.length);
113
+ signed.set(prefix);
114
+ signed.set(body, prefix.length);
115
+ return signed;
135
116
  };
136
- var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
137
- var envelopeOf = (body) => {
138
- const refusal = `${CONTEXT}: the delivery verified and its body holds no webhook event, not even the envelope every event is delivered in. Answer the request with a 400 and act on nothing it asks.`;
139
- let parsed;
140
- try {
141
- parsed = JSON.parse(new TextDecoder().decode(body));
142
- } catch (cause) {
143
- throw new MountayaConfigurationError(refusal, { cause });
144
- }
145
- if (!isRecord(parsed)) {
146
- throw new MountayaConfigurationError(refusal);
147
- }
148
- return parsed;
117
+ const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
118
+ const envelopeOf = (body) => {
119
+ const refusal = `${CONTEXT}: the delivery verified and its body holds no webhook event, not even the envelope every event is delivered in. Answer the request with a 400 and act on nothing it asks.`;
120
+ let parsed;
121
+ try {
122
+ parsed = JSON.parse(new TextDecoder().decode(body));
123
+ } catch (cause) {
124
+ throw new MountayaConfigurationError(refusal, { cause });
125
+ }
126
+ if (!isRecord(parsed)) throw new MountayaConfigurationError(refusal);
127
+ return parsed;
149
128
  };
150
- var withPreviousAttributes = (event) => {
151
- if (!isRecord(event) || !isRecord(event.data) || !isRecord(event.data.previous_attributes)) {
152
- return event;
153
- }
154
- const held = event.data.previous_attributes;
155
- const decoded = decodeSchemaInstants("WebhookEventObject", held);
156
- return decoded === held ? event : { ...event, data: { ...event.data, previous_attributes: decoded } };
129
+ const withPreviousAttributes = (event) => {
130
+ if (!isRecord(event) || !isRecord(event.data) || !isRecord(event.data.previous_attributes)) return event;
131
+ const held = event.data.previous_attributes;
132
+ const decoded = decodeSchemaInstants("WebhookEventObject", held);
133
+ return decoded === held ? event : {
134
+ ...event,
135
+ data: {
136
+ ...event.data,
137
+ previous_attributes: decoded
138
+ }
139
+ };
157
140
  };
158
- var millisecondsOf = (value) => {
159
- try {
160
- return Date.prototype.getTime.call(value);
161
- } catch {
162
- return void 0;
163
- }
141
+ const millisecondsOf = (value) => {
142
+ try {
143
+ return Date.prototype.getTime.call(value);
144
+ } catch {
145
+ return;
146
+ }
164
147
  };
165
- var constructWebhookEvent = async (rawBody, signatureHeader, secret, options) => {
166
- if (typeof rawBody !== "string" && !(rawBody instanceof Uint8Array)) {
167
- throw new MountayaConfigurationError(
168
- `${CONTEXT}: rawBody is ${describeType(rawBody)}; pass the body exactly as it arrived, as a string or a Uint8Array, before any JSON parser reads it.`
169
- );
170
- }
171
- if (typeof secret !== "string" || !secret.startsWith(SECRET_PREFIX)) {
172
- throw new MountayaConfigurationError(
173
- `${CONTEXT}: secret is ${typeof secret === "string" ? "a string that does not start with whsk_" : describeType(secret)}; pass the signing secret of the endpoint the delivery was sent to, whsk_ included.`
174
- );
175
- }
176
- if (options !== void 0 && (typeof options !== "object" || options === null)) {
177
- throw refuseOption(
178
- "options",
179
- options,
180
- "pass an object such as { toleranceSeconds: 600 }, or leave it out for the defaults.",
181
- CONTEXT
182
- );
183
- }
184
- const toleranceSeconds = options?.toleranceSeconds ?? DEFAULT_TOLERANCE_SECONDS;
185
- if (typeof toleranceSeconds !== "number" || !Number.isFinite(toleranceSeconds) || toleranceSeconds < 0) {
186
- throw refuseOption(
187
- "toleranceSeconds",
188
- toleranceSeconds,
189
- `pass a finite number of seconds from 0, or leave it out for ${DEFAULT_TOLERANCE_SECONDS}.`,
190
- CONTEXT
191
- );
192
- }
193
- const stated = options?.now;
194
- const statedMilliseconds = stated === void 0 ? void 0 : millisecondsOf(stated);
195
- if (stated !== void 0 && (statedMilliseconds === void 0 || !Number.isFinite(statedMilliseconds))) {
196
- throw refuseOption(
197
- "now",
198
- stated,
199
- "pass a Date that names an instant, or leave it out for the machine's wall clock.",
200
- CONTEXT
201
- );
202
- }
203
- const subtle = subtleCrypto();
204
- if (subtle === void 0) {
205
- throw new MountayaConfigurationError(
206
- `${CONTEXT}: this runtime provides no Web Crypto (crypto.subtle) to compute the signature with. Verify the delivery on a server, in Node 22.18 or later, a worker or an edge runtime.`
207
- );
208
- }
209
- if (signatureHeader === null || signatureHeader === void 0 || signatureHeader.trim() === "") {
210
- throw new MountayaWebhookSignatureError(
211
- `${CONTEXT}: the request carries no Mountaya-Signature header. Pass the header the request carries, such as request.headers.get("Mountaya-Signature"), and answer a request without one with a 400.`,
212
- "missing-header"
213
- );
214
- }
215
- const header = parseSignatureHeader(signatureHeader);
216
- if (header === void 0) {
217
- throw new MountayaWebhookSignatureError(
218
- `${CONTEXT}: the Mountaya-Signature header ${JSON.stringify(signatureHeader)} is not t=<unix seconds>,v1=<signature>. Pass the header exactly as the request carries it.`,
219
- "malformed-header"
220
- );
221
- }
222
- const body = typeof rawBody === "string" ? new TextEncoder().encode(rawBody) : rawBody;
223
- const key = await subtle.importKey(
224
- "raw",
225
- new TextEncoder().encode(secret),
226
- { hash: "SHA-256", name: "HMAC" },
227
- false,
228
- ["sign"]
229
- );
230
- const expected = hexOf(await subtle.sign("HMAC", key, signedBytes(header.stated, body)));
231
- const verified = header.signatures.reduce(
232
- (found, candidate) => equalInConstantTime(candidate, expected) || found,
233
- false
234
- );
235
- if (!verified) {
236
- throw new MountayaWebhookSignatureError(
237
- `${CONTEXT}: no v1 of the Mountaya-Signature header is the signature of this body under this secret. Pass the body exactly as it arrived, before any JSON parser reads it, and the secret of the endpoint the delivery was sent to.`,
238
- "signature"
239
- );
240
- }
241
- const skew = Math.abs((statedMilliseconds ?? Date.now()) / 1e3 - header.timestamp);
242
- if (skew > toleranceSeconds) {
243
- throw new MountayaWebhookSignatureError(
244
- `${CONTEXT}: the delivery was signed at ${signedAt(header.timestamp)}, ${Math.round(skew)} seconds from this clock, past the tolerance of ${toleranceSeconds} seconds. A delivery replayed later is refused this way; where the clock is wrong, set it right.`,
245
- "timestamp"
246
- );
247
- }
248
- const event = withPreviousAttributes(decodeRestSchema("WebhookEvent", envelopeOf(body)));
249
- return event;
148
+ const constructWebhookEvent = async (rawBody, signatureHeader, secret, options) => {
149
+ if (typeof rawBody !== "string" && !(rawBody instanceof Uint8Array)) throw new MountayaConfigurationError(`${CONTEXT}: rawBody is ${describeType(rawBody)}; pass the body exactly as it arrived, as a string or a Uint8Array, before any JSON parser reads it.`);
150
+ if (typeof secret !== "string" || !secret.startsWith(SECRET_PREFIX)) throw new MountayaConfigurationError(`${CONTEXT}: secret is ${typeof secret === "string" ? "a string that does not start with whsk_" : describeType(secret)}; pass the signing secret of the endpoint the delivery was sent to, whsk_ included.`);
151
+ if (options !== void 0 && (typeof options !== "object" || options === null)) throw refuseOption("options", options, "pass an object such as { toleranceSeconds: 600 }, or leave it out for the defaults.", CONTEXT);
152
+ const toleranceSeconds = options?.toleranceSeconds ?? DEFAULT_TOLERANCE_SECONDS;
153
+ if (typeof toleranceSeconds !== "number" || !Number.isFinite(toleranceSeconds) || toleranceSeconds < 0) throw refuseOption("toleranceSeconds", toleranceSeconds, `pass a finite number of seconds from 0, or leave it out for ${DEFAULT_TOLERANCE_SECONDS}.`, CONTEXT);
154
+ const stated = options?.now;
155
+ const statedMilliseconds = stated === void 0 ? void 0 : millisecondsOf(stated);
156
+ if (stated !== void 0 && (statedMilliseconds === void 0 || !Number.isFinite(statedMilliseconds))) throw refuseOption("now", stated, "pass a Date that names an instant, or leave it out for the machine's wall clock.", CONTEXT);
157
+ const subtle = subtleCrypto();
158
+ if (subtle === void 0) throw new MountayaConfigurationError(`${CONTEXT}: this runtime provides no Web Crypto (crypto.subtle) to compute the signature with. Verify the delivery on a server, in Node 22.18 or later, a worker or an edge runtime.`);
159
+ if (signatureHeader === null || signatureHeader === void 0 || signatureHeader.trim() === "") throw new MountayaWebhookSignatureError(`${CONTEXT}: the request carries no Mountaya-Signature header. Pass the header the request carries, such as request.headers.get("Mountaya-Signature"), and answer a request without one with a 400.`, "missing-header");
160
+ const header = parseSignatureHeader(signatureHeader);
161
+ if (header === void 0) throw new MountayaWebhookSignatureError(`${CONTEXT}: the Mountaya-Signature header ${JSON.stringify(signatureHeader)} is not t=<unix seconds>,v1=<signature>. Pass the header exactly as the request carries it.`, "malformed-header");
162
+ const body = typeof rawBody === "string" ? new TextEncoder().encode(rawBody) : rawBody;
163
+ const key = await subtle.importKey("raw", new TextEncoder().encode(secret), {
164
+ hash: "SHA-256",
165
+ name: "HMAC"
166
+ }, false, ["sign"]);
167
+ const expected = hexOf(await subtle.sign("HMAC", key, signedBytes(header.stated, body)));
168
+ if (!header.signatures.reduce((found, candidate) => equalInConstantTime(candidate, expected) || found, false)) throw new MountayaWebhookSignatureError(`${CONTEXT}: no v1 of the Mountaya-Signature header is the signature of this body under this secret. Pass the body exactly as it arrived, before any JSON parser reads it, and the secret of the endpoint the delivery was sent to.`, "signature");
169
+ const skew = Math.abs((statedMilliseconds ?? Date.now()) / 1e3 - header.timestamp);
170
+ if (skew > toleranceSeconds) throw new MountayaWebhookSignatureError(`${CONTEXT}: the delivery was signed at ${signedAt(header.timestamp)}, ${Math.round(skew)} seconds from this clock, past the tolerance of ${toleranceSeconds} seconds. A delivery replayed later is refused this way; where the clock is wrong, set it right.`, "timestamp");
171
+ return withPreviousAttributes(decodeRestSchema("WebhookEvent", envelopeOf(body)));
250
172
  };
251
-
252
- // src/admin/rules/mountayaAdmin.ts
253
- var bound = /* @__PURE__ */ new WeakMap();
254
- var adminOperationsOf = (transport) => {
255
- const held = bound.get(transport);
256
- if (held !== void 0) {
257
- return held;
258
- }
259
- const table = bind(transport).admin;
260
- bound.set(transport, table);
261
- return table;
173
+ const bound = /* @__PURE__ */ new WeakMap();
174
+ const adminOperationsOf = (transport) => {
175
+ const held = bound.get(transport);
176
+ if (held !== void 0) return held;
177
+ const table = bind(transport).admin;
178
+ bound.set(transport, table);
179
+ return table;
262
180
  };
263
181
  var MountayaAdmin = class {
264
- /** The organization's billing: its subscription, its payment methods, its details and invoices. */
265
- billing;
266
- /** The organization's invitations. */
267
- invitations;
268
- /** The organization's publishable keys. */
269
- keys;
270
- /** The organization's members. */
271
- members;
272
- /** The organizations themselves: their details, settings, usage and AI provider configuration. */
273
- organizations;
274
- /** Minting a session token for a publishable key. */
275
- sessions;
276
- /** The acting user's own memberships, invitations and preferences. */
277
- users;
278
- /** The organization's webhook endpoints, the events it was sent and their deliveries. */
279
- webhooks;
280
- /**
281
- * Binds the admin unit's operations to the transport of `mountaya`.
282
- *
283
- * @param mountaya The client whose transport the operations call through: a `Mountaya` of
284
- * `@mountaya/client` or of `@mountaya/client/browser`.
285
- */
286
- constructor(mountaya) {
287
- const operations = adminOperationsOf(mountaya.transport);
288
- this.billing = operations.billing;
289
- this.invitations = operations.invitations;
290
- this.keys = operations.keys;
291
- this.members = operations.members;
292
- this.organizations = operations.organizations;
293
- this.sessions = operations.sessions;
294
- this.users = operations.users;
295
- this.webhooks = operations.webhooks;
296
- }
182
+ billing;
183
+ invitations;
184
+ keys;
185
+ members;
186
+ organizations;
187
+ sessions;
188
+ users;
189
+ webhooks;
190
+ constructor(mountaya) {
191
+ const operations = adminOperationsOf(mountaya.transport);
192
+ this.billing = operations.billing;
193
+ this.invitations = operations.invitations;
194
+ this.keys = operations.keys;
195
+ this.members = operations.members;
196
+ this.organizations = operations.organizations;
197
+ this.sessions = operations.sessions;
198
+ this.users = operations.users;
199
+ this.webhooks = operations.webhooks;
200
+ }
297
201
  };
298
-
299
202
  export { MountayaAdmin, MountayaWebhookSignatureError, constructWebhookEvent, adminOperations_gen_exports as rest };
300
- //# sourceMappingURL=index.js.map
203
+
301
204
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/rest/adminOperations.gen.ts","../../src/webhooks/rules/constructWebhookEvent.ts","../../src/admin/rules/mountayaAdmin.ts"],"names":[],"mappings":";;;;AAAA,IAAA,2BAAA,GAAA;AAAA,QAAA,CAAA,2BAAA,EAAA;AAAA,EAAA,kBAAA,EAAA,MAAA,kBAAA;AAAA,EAAA,kCAAA,EAAA,MAAA,kCAAA;AAAA,EAAA,sCAAA,EAAA,MAAA,sCAAA;AAAA,EAAA,qCAAA,EAAA,MAAA,qCAAA;AAAA,EAAA,4BAAA,EAAA,MAAA,4BAAA;AAAA,EAAA,wBAAA,EAAA,MAAA,wBAAA;AAAA,EAAA,gCAAA,EAAA,MAAA,gCAAA;AAAA,EAAA,iCAAA,EAAA,MAAA,iCAAA;AAAA,EAAA,cAAA,EAAA,MAAA,cAAA;AAAA,EAAA,kBAAA,EAAA,MAAA,kBAAA;AAAA,EAAA,gBAAA,EAAA,MAAA,gBAAA;AAAA,EAAA,wCAAA,EAAA,MAAA,wCAAA;AAAA,EAAA,kBAAA,EAAA,MAAA,kBAAA;AAAA,EAAA,gBAAA,EAAA,MAAA,gBAAA;AAAA,EAAA,eAAA,EAAA,MAAA,eAAA;AAAA,EAAA,+BAAA,EAAA,MAAA,+BAAA;AAAA,EAAA,0BAAA,EAAA,MAAA,0BAAA;AAAA,EAAA,8BAAA,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AAA,EAEA,OAAA;AAAA;AAAA,EAEA,aAAA;AAAA;AAAA,EAEA,QAAA;AAAA;AAAA,EAEA,KAAA;AAAA;AAAA,EAEA,QAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQT,YAAY,QAAA,EAAqD;AAC/D,IAAA,MAAM,UAAA,GAAa,iBAAA,CAAkB,QAAA,CAAS,SAAS,CAAA;AAEvD,IAAA,IAAA,CAAK,UAAU,UAAA,CAAW,OAAA;AAC1B,IAAA,IAAA,CAAK,cAAc,UAAA,CAAW,WAAA;AAC9B,IAAA,IAAA,CAAK,OAAO,UAAA,CAAW,IAAA;AACvB,IAAA,IAAA,CAAK,UAAU,UAAA,CAAW,OAAA;AAC1B,IAAA,IAAA,CAAK,gBAAgB,UAAA,CAAW,aAAA;AAChC,IAAA,IAAA,CAAK,WAAW,UAAA,CAAW,QAAA;AAC3B,IAAA,IAAA,CAAK,QAAQ,UAAA,CAAW,KAAA;AACxB,IAAA,IAAA,CAAK,WAAW,UAAA,CAAW,QAAA;AAAA,EAC7B;AACF","file":"index.js"}
1
+ {"version":3,"file":"index.js","names":["runtime"],"sources":["../../src/rest/adminOperations.gen.ts","../../src/webhooks/rules/constructWebhookEvent.ts","../../src/admin/rules/mountayaAdmin.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACoCA,MAAM,UAAU;AAGhB,MAAM,4BAA4B;AAGlC,MAAM,gBAAgB;AAGtB,MAAM,eAAe;AAGrB,MAAM,yBAAyB;AAM/B,MAAM,YAAY,cAChB,aAAa,0CAAyB,IAAI,KAAK,YAAY,GAAI,EAAA,CAAE,YAAY,IAAI,KAAK;AA8BxF,IAAa,gCAAb,cAAmD,cAAc;CAC/D,OAAyB;CAGzB;CAMA,YAAY,SAAiB,QAAiC;EAC5D,MAAM,OAAO;EACb,KAAK,SAAS;CAChB;AACF;AAyCA,MAAM,wBAAwB,WAAgD;C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