samva 0.15.0 → 0.17.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 (128) hide show
  1. package/AGENTS.md +4 -1
  2. package/README.md +46 -1
  3. package/dist/analytics-CaqPRsry.js +207 -0
  4. package/dist/api-keys-Ce1Y4_Ip.js +274 -0
  5. package/dist/attachments-DYqVIraC.js +140 -0
  6. package/dist/brands-ZwuOGIWO.js +175 -0
  7. package/dist/campaigns-DZlz1E9E.js +522 -0
  8. package/dist/categories-CA4XIQAb.js +1011 -0
  9. package/dist/client/sdk.gen.d.ts +234 -49
  10. package/dist/client/types.gen.d.ts +1521 -348
  11. package/dist/client-DOzUrdTE.js +1115 -0
  12. package/dist/contact-groups-BLbFXnjq.js +446 -0
  13. package/dist/contacts-BbsoXXB4.js +787 -0
  14. package/dist/conversations-_sRHueML.js +494 -0
  15. package/dist/custom-fields-BHWbwlKn.js +176 -0
  16. package/dist/effect/analytics.js +2 -21
  17. package/dist/effect/api-keys.d.ts +1 -0
  18. package/dist/effect/api-keys.js +2 -25
  19. package/dist/effect/attachments.js +2 -17
  20. package/dist/effect/brands.d.ts +1 -1
  21. package/dist/effect/brands.js +3 -24
  22. package/dist/effect/campaigns.js +2 -33
  23. package/dist/effect/categories.js +1 -1
  24. package/dist/effect/client.d.ts +1 -1
  25. package/dist/effect/client.js +3 -4
  26. package/dist/effect/contact-groups.js +2 -29
  27. package/dist/effect/contacts.d.ts +52 -0
  28. package/dist/effect/contacts.js +2 -47
  29. package/dist/effect/conversations.js +2 -35
  30. package/dist/effect/custom-fields.js +2 -17
  31. package/dist/effect/email.d.ts +3 -20
  32. package/dist/effect/email.js +2 -141
  33. package/dist/effect/events.d.ts +121 -0
  34. package/dist/effect/events.js +3 -0
  35. package/dist/effect/extension-installations.js +2 -27
  36. package/dist/effect/extensions.js +2 -19
  37. package/dist/effect/feedback.d.ts +1 -1
  38. package/dist/effect/feedback.js +3 -13
  39. package/dist/effect/generated/analytics.d.ts +715 -0
  40. package/dist/effect/generated/api-keys.d.ts +1627 -0
  41. package/dist/effect/generated/attachments.d.ts +554 -0
  42. package/dist/effect/generated/brands.d.ts +1118 -0
  43. package/dist/effect/generated/campaigns.d.ts +3783 -0
  44. package/dist/effect/generated/contact-events.d.ts +158 -0
  45. package/dist/effect/generated/contact-groups.d.ts +1445 -0
  46. package/dist/effect/generated/contacts.d.ts +3789 -0
  47. package/dist/effect/generated/conversations.d.ts +2870 -0
  48. package/dist/effect/generated/custom-fields.d.ts +562 -0
  49. package/dist/effect/generated/email.d.ts +10622 -0
  50. package/dist/effect/generated/events.d.ts +463 -0
  51. package/dist/effect/generated/extension-installations.d.ts +1786 -0
  52. package/dist/effect/generated/extensions.d.ts +927 -0
  53. package/dist/effect/generated/feedback.d.ts +116 -0
  54. package/dist/effect/generated/index.d.ts +61 -0
  55. package/dist/effect/generated/journeys.d.ts +6135 -0
  56. package/dist/effect/generated/mailboxes.d.ts +13641 -0
  57. package/dist/effect/generated/media.d.ts +741 -0
  58. package/dist/effect/generated/messages.d.ts +2355 -0
  59. package/dist/effect/generated/namespaces.d.ts +654 -0
  60. package/dist/effect/generated/operations.d.ts +514 -0
  61. package/dist/effect/generated/organizations.d.ts +1111 -0
  62. package/dist/effect/generated/scheduled-messages.d.ts +1798 -0
  63. package/dist/effect/generated/shared.d.ts +3250 -0
  64. package/dist/effect/generated/subscriptions.d.ts +188 -0
  65. package/dist/effect/generated/templates.d.ts +8177 -0
  66. package/dist/effect/generated/unsubscribe-groups.d.ts +1153 -0
  67. package/dist/effect/generated/webhooks.d.ts +1697 -0
  68. package/dist/effect/generated/whoami.d.ts +291 -0
  69. package/dist/effect/generated-metadata.d.ts +1631 -0
  70. package/dist/effect/index.d.ts +4 -1
  71. package/dist/effect/index.js +29 -26
  72. package/dist/effect/internal/client.d.ts +10 -7
  73. package/dist/effect/internal/email-sender.d.ts +17 -0
  74. package/dist/effect/internal/operation.d.ts +12 -72
  75. package/dist/effect/internal/send.d.ts +60 -0
  76. package/dist/effect/journeys.d.ts +2153 -0
  77. package/dist/effect/journeys.js +2 -0
  78. package/dist/effect/mailboxes.d.ts +255 -205
  79. package/dist/effect/mailboxes.js +2 -2
  80. package/dist/effect/media.js +3 -1
  81. package/dist/effect/messages.d.ts +2 -2
  82. package/dist/effect/messages.js +3 -1
  83. package/dist/effect/namespaces.js +2 -19
  84. package/dist/effect/operations.js +2 -15
  85. package/dist/effect/organizations.js +2 -23
  86. package/dist/effect/retry.js +1 -1
  87. package/dist/effect/scheduled-messages.js +2 -19
  88. package/dist/effect/subscriptions.js +2 -9
  89. package/dist/effect/templates.d.ts +1 -1
  90. package/dist/effect/templates.js +3 -78
  91. package/dist/effect/unsubscribe-groups.js +2 -27
  92. package/dist/effect/webhooks.d.ts +9 -9
  93. package/dist/effect/webhooks.js +3 -33
  94. package/dist/effect/whoami.d.ts +46 -0
  95. package/dist/effect/whoami.js +2 -0
  96. package/dist/email-R0NAA9PW.js +2498 -0
  97. package/dist/events-CxbTUHYT.js +82 -0
  98. package/dist/extension-installations-CD94LPmk.js +407 -0
  99. package/dist/extensions-BKyNQLvu.js +220 -0
  100. package/dist/feedback-Bpa09JOS.js +52 -0
  101. package/dist/index.js +3 -3
  102. package/dist/{inline-attachments-UxLeyytJ.js → inline-attachments-Bi1hDltp.js} +2 -2
  103. package/dist/journeys-CARo_BJT.js +499 -0
  104. package/dist/mailboxes-BRDn7BIK.js +2470 -0
  105. package/dist/media-VrrtNnft.js +181 -0
  106. package/dist/namespaces-CcvEbG-y.js +152 -0
  107. package/dist/{operation-BZ5Xov-x.js → operation-n_IYgNVK.js} +85 -102
  108. package/dist/operations-CmB3FHwf.js +93 -0
  109. package/dist/organizations-A-plufWc.js +252 -0
  110. package/dist/promises/errors.gen.d.ts +12 -2
  111. package/dist/promises/index.d.ts +9 -3
  112. package/dist/promises/index.js +3 -3
  113. package/dist/promises/types.gen.d.ts +1 -1
  114. package/dist/{promises-Cd6Jamqk.js → promises---Kbh-7z.js} +745 -195
  115. package/dist/runtime-P0l1_2-C.js +25 -0
  116. package/dist/scheduled-messages-DkKZRRaN.js +207 -0
  117. package/dist/send-Bxc0XfGE.js +722 -0
  118. package/dist/service-map.d.ts +101 -15
  119. package/dist/subscriptions-DEXYtMXg.js +67 -0
  120. package/dist/templates-DZomxsG7.js +2289 -0
  121. package/dist/unsubscribe-groups-Iqk4Isf9.js +291 -0
  122. package/dist/webhooks-CPXuu8Xf.js +530 -0
  123. package/dist/whoami-Ccz0jwlt.js +59 -0
  124. package/package.json +17 -3
  125. package/dist/categories-BGUBFdH9.js +0 -183
  126. package/dist/client-CDg7zJs0.js +0 -13726
  127. package/dist/effect/generated.d.ts +0 -64059
  128. package/dist/mailboxes-BH_JPmOE.js +0 -159
package/AGENTS.md CHANGED
@@ -8,7 +8,10 @@ Effect applications should import Pascal-cased domain modules from focused subpa
8
8
  `samva/effect/email` and provide `Client.layerFetch` from `samva/effect/client`. Install the optional
9
9
  peer `effect` at the exact version this package's `peerDependencies` names when using those
10
10
  entrypoints; a different release candidate is unsupported. Tagged API failures remain in the
11
- Effect error channel and can be handled with `Effect.catchTag`.
11
+ Effect error channel and can be handled with `Effect.catchTag`. In Cloudflare Workers and Lambda,
12
+ import focused entrypoints rather than the `samva/effect` barrel, which loads every domain. In a
13
+ Worker, provide the client Layer per request with the request's abort signal; in Lambda or another
14
+ long-lived process, build it once in a module-scope `ManagedRuntime`.
12
15
 
13
16
  Treat exported request and response types as the API contract. Do not import package-internal files
14
17
  or generated implementation paths; use only the subpaths declared in `package.json`.
package/README.md CHANGED
@@ -83,6 +83,49 @@ const program = Email.send({
83
83
  const message = await Effect.runPromise(program);
84
84
  ```
85
85
 
86
+ ### Serverless Runtimes
87
+
88
+ Each `samva/effect/<domain>` entrypoint loads only that domain's part of the API, so a Cloudflare
89
+ Worker or Lambda function pays at startup only for the domains it imports. `Email.send` and
90
+ `Messages.send` also load Media, because an oversized inline attachment is uploaded as media. The
91
+ `samva/effect` barrel loads every domain; import focused entrypoints in serverless code.
92
+
93
+ `Client.layerFetch` does no work until the first call, and the first call to a domain prepares only
94
+ that domain, so providing the Layer costs little. In a Cloudflare Worker, provide it per request and
95
+ pass the request's abort signal, so no request waits on work another request started:
96
+
97
+ ```typescript
98
+ import { Effect } from "effect";
99
+ import * as Client from "samva/effect/client";
100
+ import * as Contacts from "samva/effect/contacts";
101
+
102
+ export default {
103
+ async fetch(request: Request, env: { SAMVA_API_KEY: string }): Promise<Response> {
104
+ const page = await Effect.runPromise(
105
+ Contacts.list({}).pipe(Effect.provide(Client.layerFetch({ apiKey: env.SAMVA_API_KEY }))),
106
+ { signal: request.signal },
107
+ );
108
+ return Response.json(page.items);
109
+ },
110
+ };
111
+ ```
112
+
113
+ In Lambda or another runtime that keeps one process alive across invocations, build the Layer once
114
+ in a `ManagedRuntime` at module scope so each domain is prepared once for the life of the process:
115
+
116
+ ```typescript
117
+ import { ManagedRuntime } from "effect";
118
+ import * as Client from "samva/effect/client";
119
+ import * as Contacts from "samva/effect/contacts";
120
+
121
+ const runtime = ManagedRuntime.make(Client.layerFetch({ apiKey: process.env.SAMVA_API_KEY! }));
122
+
123
+ export const handler = async () => {
124
+ const page = await runtime.runPromise(Contacts.list({}));
125
+ return page.items;
126
+ };
127
+ ```
128
+
86
129
  ## Authentication
87
130
 
88
131
  Samva supports two client auth modes. Use one per `createClient` instance.
@@ -166,6 +209,7 @@ The Promise client exposes:
166
209
  - `templates`
167
210
  - `unsubscribeGroups`
168
211
  - `webhooks`
212
+ - `whoami`
169
213
 
170
214
  The Effect SDK exposes Pascal-cased domain modules with lower-camel operations:
171
215
 
@@ -192,8 +236,9 @@ The Effect SDK exposes Pascal-cased domain modules with lower-camel operations:
192
236
  - `Templates`
193
237
  - `UnsubscribeGroups`
194
238
  - `Webhooks`
239
+ - `Whoami`
195
240
 
196
- Effect operations take direct parameter objects: body, path, and query fields are not wrapped in `payload` or `params` envelopes. Import the modules you use from `samva/effect/<lower-kebab>` and provide `Client.layerFetch` once at the program boundary. `Client.raw` exposes the underlying generated client for advanced access, but ordinary workflows do not require it.
241
+ Effect operations take direct parameter objects: body, path, and query fields are not wrapped in `payload` or `params` envelopes. Import the modules you use from `samva/effect/<lower-kebab>` and provide `Client.layerFetch` once at the program boundary.
197
242
 
198
243
  Email attachments use organization-owned media. Call `media.create`, upload the bytes with the
199
244
  returned instruction, call `media.complete`, and pass the ready `mediaId` to `email.send` or
@@ -0,0 +1,207 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
2
+ import { t as AbsoluteInstant } from "./runtime-P0l1_2-C.js";
3
+ import { Jt as UnauthorizedError, K as ForbiddenError, Y as InternalError, en as ValidationError, i as AnalyticsQueryError, q as GatewayTimeoutError, s as ApiKeySecurityMiddleware } from "./client-DOzUrdTE.js";
4
+ import { n as forGroup } from "./operation-n_IYgNVK.js";
5
+ import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from "effect/http-api";
6
+ import * as Schema from "effect/Schema";
7
+ //#region src/effect/generated/analytics.ts
8
+ const AnalyticsGetChannelStatsQuery = /* @__PURE__ */ Schema.Struct({
9
+ after: Schema.optionalKey(Schema.Union([AbsoluteInstant, Schema.Null])),
10
+ before: Schema.optionalKey(Schema.Union([AbsoluteInstant, Schema.Null]))
11
+ });
12
+ const AnalyticsGetChannelStats200 = /* @__PURE__ */ Schema.Struct({ email: Schema.Struct({
13
+ sent: Schema.Finite.check(Schema.isInt().annotate({ expected: "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" })),
14
+ deliveryRate: Schema.Finite.check(Schema.isFinite().annotate({ expected: "a finite number" })),
15
+ uniqueOpenedMessages: Schema.Finite.check(Schema.isInt().annotate({ expected: "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" })),
16
+ openTrackingEligibleDeliveredMessages: Schema.Finite.check(Schema.isInt().annotate({ expected: "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" })),
17
+ uniqueMessageOpenRate: Schema.Finite.check(Schema.isFinite().annotate({ expected: "a finite number" })),
18
+ uniqueClickedMessages: Schema.Finite.check(Schema.isInt().annotate({ expected: "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" })),
19
+ clickTrackingEligibleDeliveredMessages: Schema.Finite.check(Schema.isInt().annotate({ expected: "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" })),
20
+ uniqueMessageClickRate: Schema.Finite.check(Schema.isFinite().annotate({ expected: "a finite number" })),
21
+ bounceRate: Schema.Finite.check(Schema.isFinite().annotate({ expected: "a finite number" }))
22
+ }) });
23
+ const AnalyticsGetChannelStats400 = AnalyticsQueryError;
24
+ const AnalyticsGetChannelStats401 = UnauthorizedError;
25
+ const AnalyticsGetChannelStats403 = ForbiddenError;
26
+ const AnalyticsGetChannelStats422 = ValidationError;
27
+ const AnalyticsGetChannelStats500 = InternalError;
28
+ const AnalyticsGetChannelStats504 = GatewayTimeoutError;
29
+ const AnalyticsGetDeliveryMetricsQuery = /* @__PURE__ */ Schema.Struct({
30
+ after: Schema.optionalKey(Schema.Union([AbsoluteInstant, Schema.Null])),
31
+ before: Schema.optionalKey(Schema.Union([AbsoluteInstant, Schema.Null])),
32
+ channel: Schema.optionalKey(Schema.Union([Schema.Literal("email"), Schema.Null]))
33
+ });
34
+ const AnalyticsGetDeliveryMetrics200 = /* @__PURE__ */ Schema.Struct({
35
+ deliveredRate: Schema.Finite.check(Schema.isFinite().annotate({ expected: "a finite number" })),
36
+ failedRate: Schema.Finite.check(Schema.isFinite().annotate({ expected: "a finite number" })),
37
+ pendingRate: Schema.Finite.check(Schema.isFinite().annotate({ expected: "a finite number" })),
38
+ avgDeliveryTimeMs: Schema.Finite.check(Schema.isFinite().annotate({ expected: "a finite number" }))
39
+ });
40
+ const AnalyticsGetDeliveryMetrics400 = AnalyticsQueryError;
41
+ const AnalyticsGetDeliveryMetrics401 = UnauthorizedError;
42
+ const AnalyticsGetDeliveryMetrics403 = ForbiddenError;
43
+ const AnalyticsGetDeliveryMetrics422 = ValidationError;
44
+ const AnalyticsGetDeliveryMetrics500 = InternalError;
45
+ const AnalyticsGetDeliveryMetrics504 = GatewayTimeoutError;
46
+ const AnalyticsExportDataRequestJson = /* @__PURE__ */ Schema.Struct({
47
+ after: AbsoluteInstant,
48
+ before: AbsoluteInstant,
49
+ format: Schema.optionalKey(Schema.Union([Schema.Union([Schema.Literal("csv"), Schema.Literal("json")]), Schema.Null])),
50
+ includeChannels: Schema.optionalKey(Schema.Union([Schema.Array(Schema.Literal("email")), Schema.Null]))
51
+ });
52
+ const AnalyticsExportData200 = /* @__PURE__ */ Schema.Struct({
53
+ content: Schema.String,
54
+ mimeType: Schema.String,
55
+ filename: Schema.String
56
+ });
57
+ const AnalyticsExportData400 = AnalyticsQueryError;
58
+ const AnalyticsExportData401 = UnauthorizedError;
59
+ const AnalyticsExportData403 = ForbiddenError;
60
+ const AnalyticsExportData422 = ValidationError;
61
+ const AnalyticsExportData500 = InternalError;
62
+ const AnalyticsExportData504 = GatewayTimeoutError;
63
+ const AnalyticsGetHourlyDistributionQuery = /* @__PURE__ */ Schema.Struct({
64
+ after: Schema.optionalKey(Schema.Union([AbsoluteInstant, Schema.Null])),
65
+ before: Schema.optionalKey(Schema.Union([AbsoluteInstant, Schema.Null]))
66
+ });
67
+ const AnalyticsGetHourlyDistribution200 = /* @__PURE__ */ Schema.Array(Schema.Struct({
68
+ hour: Schema.String,
69
+ count: Schema.Finite.check(Schema.isInt().annotate({ expected: "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }))
70
+ }));
71
+ const AnalyticsGetHourlyDistribution400 = AnalyticsQueryError;
72
+ const AnalyticsGetHourlyDistribution401 = UnauthorizedError;
73
+ const AnalyticsGetHourlyDistribution403 = ForbiddenError;
74
+ const AnalyticsGetHourlyDistribution422 = ValidationError;
75
+ const AnalyticsGetHourlyDistribution500 = InternalError;
76
+ const AnalyticsGetHourlyDistribution504 = GatewayTimeoutError;
77
+ const AnalyticsGetStatsQuery = /* @__PURE__ */ Schema.Struct({
78
+ after: Schema.optionalKey(Schema.Union([AbsoluteInstant, Schema.Null])),
79
+ before: Schema.optionalKey(Schema.Union([AbsoluteInstant, Schema.Null])),
80
+ groupBy: Schema.optionalKey(Schema.Union([Schema.Union([
81
+ Schema.Literal("day"),
82
+ Schema.Literal("week"),
83
+ Schema.Literal("month")
84
+ ]), Schema.Null])),
85
+ channel: Schema.optionalKey(Schema.Union([Schema.Literal("email"), Schema.Null]))
86
+ });
87
+ const AnalyticsGetStats200 = /* @__PURE__ */ Schema.Struct({ volumeHistory: Schema.Array(Schema.Struct({
88
+ date: Schema.String,
89
+ email: Schema.Finite.check(Schema.isInt().annotate({ expected: "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }))
90
+ })) });
91
+ const AnalyticsGetStats400 = AnalyticsQueryError;
92
+ const AnalyticsGetStats401 = UnauthorizedError;
93
+ const AnalyticsGetStats403 = ForbiddenError;
94
+ const AnalyticsGetStats422 = ValidationError;
95
+ const AnalyticsGetStats500 = InternalError;
96
+ const AnalyticsGetStats504 = GatewayTimeoutError;
97
+ const AnalyticsGetTopContactsQuery = /* @__PURE__ */ Schema.Struct({
98
+ after: Schema.optionalKey(Schema.Union([AbsoluteInstant, Schema.Null])),
99
+ before: Schema.optionalKey(Schema.Union([AbsoluteInstant, Schema.Null])),
100
+ limit: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
101
+ sortBy: Schema.optionalKey(Schema.Union([Schema.Union([
102
+ Schema.Literal("sent"),
103
+ Schema.Literal("received"),
104
+ Schema.Literal("total")
105
+ ]), Schema.Null]))
106
+ });
107
+ const AnalyticsGetTopContacts200 = /* @__PURE__ */ Schema.Array(Schema.Struct({
108
+ id: Schema.String,
109
+ name: Schema.Union([Schema.String, Schema.Null]),
110
+ email: Schema.Union([Schema.String, Schema.Null]),
111
+ phone: Schema.Union([Schema.String, Schema.Null]),
112
+ messageCount: Schema.Finite.check(Schema.isInt().annotate({ expected: "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }))
113
+ }));
114
+ const AnalyticsGetTopContacts400 = AnalyticsQueryError;
115
+ const AnalyticsGetTopContacts401 = UnauthorizedError;
116
+ const AnalyticsGetTopContacts403 = ForbiddenError;
117
+ const AnalyticsGetTopContacts422 = ValidationError;
118
+ const AnalyticsGetTopContacts500 = InternalError;
119
+ const AnalyticsGetTopContacts504 = GatewayTimeoutError;
120
+ var AnalyticsGroup = class extends HttpApiGroup.make("Analytics").add(HttpApiEndpoint.get("analyticsGetChannelStats", "/v1/analytics/channel-stats", {
121
+ query: AnalyticsGetChannelStatsQuery,
122
+ success: AnalyticsGetChannelStats200,
123
+ error: [
124
+ AnalyticsGetChannelStats400.pipe(HttpApiSchema.status(400)),
125
+ AnalyticsGetChannelStats401.pipe(HttpApiSchema.status(401)),
126
+ AnalyticsGetChannelStats403.pipe(HttpApiSchema.status(403)),
127
+ AnalyticsGetChannelStats422.pipe(HttpApiSchema.status(422)),
128
+ AnalyticsGetChannelStats500,
129
+ AnalyticsGetChannelStats504.pipe(HttpApiSchema.status(504))
130
+ ]
131
+ }).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "analytics.getChannelStats").annotate(OpenApi.Summary, "Get channel performance analytics").annotate(OpenApi.Description, "Returns aggregate delivery metrics plus unique-message email Open and Click rates over the selected date range. `sent` counts every outbound message accepted in the range; each rate is taken over the messages the channel actually attempted, so one still waiting to be sent neither helps nor hurts it. Each engagement rate uses the corresponding tracking-eligible delivered-message cohort; repeated provider observations do not inflate the numerator."), HttpApiEndpoint.get("analyticsGetDeliveryMetrics", "/v1/analytics/delivery-metrics", {
132
+ query: AnalyticsGetDeliveryMetricsQuery,
133
+ success: AnalyticsGetDeliveryMetrics200,
134
+ error: [
135
+ AnalyticsGetDeliveryMetrics400.pipe(HttpApiSchema.status(400)),
136
+ AnalyticsGetDeliveryMetrics401.pipe(HttpApiSchema.status(401)),
137
+ AnalyticsGetDeliveryMetrics403.pipe(HttpApiSchema.status(403)),
138
+ AnalyticsGetDeliveryMetrics422.pipe(HttpApiSchema.status(422)),
139
+ AnalyticsGetDeliveryMetrics500,
140
+ AnalyticsGetDeliveryMetrics504.pipe(HttpApiSchema.status(504))
141
+ ]
142
+ }).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "analytics.getDeliveryMetrics").annotate(OpenApi.Summary, "Get message delivery metrics").annotate(OpenApi.Description, "Returns delivered, failed, and pending rates plus average delivery time for the outbound messages accepted in the selected date range, optionally filtered by channel. Every accepted message falls into exactly one of the three, so they always sum to 100%: a complaint counts as delivered because the message arrived, a bounce counts as failed, and anything the provider has not resolved yet counts as pending. Mail your organization received is not rated here."), HttpApiEndpoint.post("analyticsExportData", "/v1/analytics/export", {
143
+ payload: AnalyticsExportDataRequestJson,
144
+ success: AnalyticsExportData200,
145
+ error: [
146
+ AnalyticsExportData400.pipe(HttpApiSchema.status(400)),
147
+ AnalyticsExportData401.pipe(HttpApiSchema.status(401)),
148
+ AnalyticsExportData403.pipe(HttpApiSchema.status(403)),
149
+ AnalyticsExportData422.pipe(HttpApiSchema.status(422)),
150
+ AnalyticsExportData500,
151
+ AnalyticsExportData504.pipe(HttpApiSchema.status(504))
152
+ ]
153
+ }).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "analytics.exportData").annotate(OpenApi.Summary, "Export messaging analytics data").annotate(OpenApi.Description, "Exports one record per outbound message accepted in the given date range as CSV or JSON and returns the file content inline. CSV follows RFC 4180: fields containing a quote, comma, or line break are quoted with embedded quotes doubled, and records are separated by CRLF. At most 10,000 records are returned, newest first."), HttpApiEndpoint.get("analyticsGetHourlyDistribution", "/v1/analytics/hourly-distribution", {
154
+ query: AnalyticsGetHourlyDistributionQuery,
155
+ success: AnalyticsGetHourlyDistribution200,
156
+ error: [
157
+ AnalyticsGetHourlyDistribution400.pipe(HttpApiSchema.status(400)),
158
+ AnalyticsGetHourlyDistribution401.pipe(HttpApiSchema.status(401)),
159
+ AnalyticsGetHourlyDistribution403.pipe(HttpApiSchema.status(403)),
160
+ AnalyticsGetHourlyDistribution422.pipe(HttpApiSchema.status(422)),
161
+ AnalyticsGetHourlyDistribution500,
162
+ AnalyticsGetHourlyDistribution504.pipe(HttpApiSchema.status(504))
163
+ ]
164
+ }).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "analytics.getHourlyDistribution").annotate(OpenApi.Summary, "Get hourly message distribution").annotate(OpenApi.Description, "Returns outbound message counts over the half-open selected instant range, bucketed by organization-local hour. Empty ranges return no rows; non-empty ranges include all 24 hours."), HttpApiEndpoint.get("analyticsGetStats", "/v1/analytics/stats", {
165
+ query: AnalyticsGetStatsQuery,
166
+ success: AnalyticsGetStats200,
167
+ error: [
168
+ AnalyticsGetStats400.pipe(HttpApiSchema.status(400)),
169
+ AnalyticsGetStats401.pipe(HttpApiSchema.status(401)),
170
+ AnalyticsGetStats403.pipe(HttpApiSchema.status(403)),
171
+ AnalyticsGetStats422.pipe(HttpApiSchema.status(422)),
172
+ AnalyticsGetStats500,
173
+ AnalyticsGetStats504.pipe(HttpApiSchema.status(504))
174
+ ]
175
+ }).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "analytics.getStats").annotate(OpenApi.Summary, "Get message volume analytics").annotate(OpenApi.Description, "Returns outbound message counts over the half-open selected instant range, grouped by organization-local calendar day, week, or month. A range with traffic returns every bucket in it, including the ones that saw none; a range with no outbound traffic at all returns no buckets. A range with no `before` runs through the current instant, so its quiet trailing buckets are reported as zero."), HttpApiEndpoint.get("analyticsGetTopContacts", "/v1/analytics/top-contacts", {
176
+ query: AnalyticsGetTopContactsQuery,
177
+ success: AnalyticsGetTopContacts200,
178
+ error: [
179
+ AnalyticsGetTopContacts400.pipe(HttpApiSchema.status(400)),
180
+ AnalyticsGetTopContacts401.pipe(HttpApiSchema.status(401)),
181
+ AnalyticsGetTopContacts403.pipe(HttpApiSchema.status(403)),
182
+ AnalyticsGetTopContacts422.pipe(HttpApiSchema.status(422)),
183
+ AnalyticsGetTopContacts500,
184
+ AnalyticsGetTopContacts504.pipe(HttpApiSchema.status(504))
185
+ ]
186
+ }).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "analytics.getTopContacts").annotate(OpenApi.Summary, "List top contacts by message volume").annotate(OpenApi.Description, "Returns the contacts your organization exchanged the most messages with over the selected date range. `sortBy` chooses the traffic `messageCount` reports and ranks by: `sent` counts outbound messages addressed to the contact, `received` counts inbound messages the contact sent you, and `total` (the default) counts both. Contacts with no traffic in the range are omitted, and at most 100 are returned.")).annotate(OpenApi.Description, "Messaging analytics, channel stats, and data export. Every date range is half-open — `after` inclusive, `before` exclusive — and may span at most 366 days. Both bounds are absolute ISO-8601 instants carrying `Z` or a numeric offset; a bare calendar date is rejected, because reading it as UTC midnight would shift every bucket for an organization outside UTC. `AnalyticsQueryError` refuses a longer span and a `before` sent without an `after`, which bounds nothing. Omitting both bounds reports the organization's whole history. Calendar buckets follow the organization's timezone.") {};
187
+ //#endregion
188
+ //#region src/effect/analytics.ts
189
+ var analytics_exports = /* @__PURE__ */ __exportAll({
190
+ exportData: () => exportData,
191
+ getChannelStats: () => getChannelStats,
192
+ getDeliveryMetrics: () => getDeliveryMetrics,
193
+ getHourlyDistribution: () => getHourlyDistribution,
194
+ getStats: () => getStats,
195
+ getTopContacts: () => getTopContacts
196
+ });
197
+ const make = forGroup(AnalyticsGroup);
198
+ const getStats = make("analyticsGetStats");
199
+ const getChannelStats = make("analyticsGetChannelStats");
200
+ const getTopContacts = make("analyticsGetTopContacts");
201
+ const getHourlyDistribution = make("analyticsGetHourlyDistribution");
202
+ const getDeliveryMetrics = make("analyticsGetDeliveryMetrics");
203
+ const exportData = make("analyticsExportData");
204
+ //#endregion
205
+ export { getHourlyDistribution as a, getDeliveryMetrics as i, exportData as n, getStats as o, getChannelStats as r, getTopContacts as s, analytics_exports as t };
206
+
207
+ //# sourceMappingURL=analytics-CaqPRsry.js.map
@@ -0,0 +1,274 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
2
+ import { n as SensitiveString } from "./runtime-P0l1_2-C.js";
3
+ import { D as Cursor, Ht as SuccessResponse, Jt as UnauthorizedError, K as ForbiddenError, Lt as ResourceNotFoundError, Nt as PaymentRequiredError, Pt as RateLimitedError, Y as InternalError, a as ApiKeyAccess, en as ValidationError, ht as MailboxSendMode, l as BillingProviderError, o as ApiKeyId, q as GatewayTimeoutError, s as ApiKeySecurityMiddleware } from "./client-DOzUrdTE.js";
4
+ import { n as forGroup } from "./operation-n_IYgNVK.js";
5
+ import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema, OpenApi } from "effect/http-api";
6
+ import * as Schema from "effect/Schema";
7
+ //#region src/effect/generated/api-keys.ts
8
+ const ApiKeyOwner = /* @__PURE__ */ Schema.Struct({
9
+ id: Schema.String,
10
+ name: Schema.String,
11
+ email: Schema.String
12
+ }).annotate({ identifier: "ApiKeyOwner" });
13
+ const ApiKeyActivityPage = /* @__PURE__ */ Schema.Struct({
14
+ items: Schema.Array(Schema.Struct({
15
+ id: Schema.String,
16
+ timestamp: Schema.String,
17
+ method: Schema.String,
18
+ endpoint: Schema.String,
19
+ statusCode: Schema.Finite.check(Schema.isInt().annotate({ expected: "an integer" })).check(Schema.isGreaterThanOrEqualTo(100).annotate({ expected: "a value greater than or equal to 100" })).check(Schema.isLessThanOrEqualTo(599).annotate({ expected: "a value less than or equal to 599" })),
20
+ latency: Schema.Finite.check(Schema.isFinite().annotate({ expected: "a finite number" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }))
21
+ })),
22
+ nextCursor: Schema.Union([Schema.String, Schema.Null])
23
+ }).annotate({ identifier: "ApiKeyActivityPage" });
24
+ const ApiKeyMailboxAccessUpdate = /* @__PURE__ */ Schema.Struct({ sendMode: MailboxSendMode }).annotate({ identifier: "ApiKeyMailboxAccessUpdate" });
25
+ const ApiKey = /* @__PURE__ */ Schema.Struct({
26
+ id: Schema.String,
27
+ name: Schema.String,
28
+ key: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
29
+ start: Schema.Union([Schema.String, Schema.Null]),
30
+ description: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
31
+ createdAt: Schema.String,
32
+ expiresAt: Schema.Union([Schema.String, Schema.Null]),
33
+ lastUsedAt: Schema.Union([Schema.String, Schema.Null]),
34
+ isActive: Schema.Boolean,
35
+ access: ApiKeyAccess,
36
+ owner: Schema.Union([ApiKeyOwner, Schema.Null])
37
+ }).annotate({ identifier: "ApiKey" });
38
+ const ApiKeyWithSecret = /* @__PURE__ */ Schema.Struct({
39
+ id: Schema.String,
40
+ name: Schema.String,
41
+ key: SensitiveString,
42
+ start: Schema.Union([Schema.String, Schema.Null]),
43
+ description: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
44
+ createdAt: Schema.String,
45
+ expiresAt: Schema.Union([Schema.String, Schema.Null]),
46
+ lastUsedAt: Schema.Union([Schema.String, Schema.Null]),
47
+ isActive: Schema.Boolean,
48
+ access: ApiKeyAccess,
49
+ owner: Schema.Union([ApiKeyOwner, Schema.Null])
50
+ }).annotate({ identifier: "ApiKeyWithSecret" });
51
+ const ApiKeyPage = /* @__PURE__ */ Schema.Struct({
52
+ items: Schema.Array(ApiKey),
53
+ nextCursor: Schema.Union([Schema.String, Schema.Null])
54
+ }).annotate({ identifier: "ApiKeyPage" });
55
+ const ApiKeysListQuery = /* @__PURE__ */ Schema.Struct({
56
+ limit: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
57
+ cursor: Schema.optionalKey(Schema.Union([Cursor, Schema.Null])),
58
+ status: Schema.optionalKey(Schema.Union([Schema.Union([Schema.Literal("active"), Schema.Literal("revoked")]), Schema.Null])),
59
+ search: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null]))
60
+ });
61
+ const ApiKeysList200 = ApiKeyPage;
62
+ const ApiKeysList401 = UnauthorizedError;
63
+ const ApiKeysList403 = ForbiddenError;
64
+ const ApiKeysList422 = ValidationError;
65
+ const ApiKeysList500 = InternalError;
66
+ const ApiKeysList504 = GatewayTimeoutError;
67
+ const ApiKeysCreateRequestJson = /* @__PURE__ */ Schema.Struct({
68
+ name: Schema.String.check(Schema.isMinLength(1).annotate({ expected: "a value with a length of at least 1" })).check(Schema.isMaxCodePoints(32).annotate({ expected: "a string with at most 32 code points" })).check(Schema.isMaxLength(32).annotate({ expected: "a value with a length of at most 32" })),
69
+ description: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
70
+ expiresAt: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
71
+ access: Schema.optionalKey(Schema.Union([ApiKeyAccess, Schema.Null]).annotate({ description: "Defaults to full access. A restricted API key creating a key defaults to its own grants and cannot issue full access." }))
72
+ });
73
+ const ApiKeysCreate201 = ApiKeyWithSecret;
74
+ const ApiKeysCreate401 = UnauthorizedError;
75
+ const ApiKeysCreate402 = PaymentRequiredError;
76
+ const ApiKeysCreate403 = ForbiddenError;
77
+ const ApiKeysCreate404 = ResourceNotFoundError;
78
+ const ApiKeysCreate422 = ValidationError;
79
+ const ApiKeysCreate429 = RateLimitedError;
80
+ const ApiKeysCreate500 = InternalError;
81
+ const ApiKeysCreate502 = BillingProviderError;
82
+ const ApiKeysCreate504 = GatewayTimeoutError;
83
+ const ApiKeysGetPathParams = /* @__PURE__ */ Schema.Struct({ id: ApiKeyId });
84
+ const ApiKeysGet200 = ApiKey;
85
+ const ApiKeysGet401 = UnauthorizedError;
86
+ const ApiKeysGet403 = ForbiddenError;
87
+ const ApiKeysGet404 = ResourceNotFoundError;
88
+ const ApiKeysGet422 = ValidationError;
89
+ const ApiKeysGet500 = InternalError;
90
+ const ApiKeysGet504 = GatewayTimeoutError;
91
+ const ApiKeysUpdatePathParams = /* @__PURE__ */ Schema.Struct({ id: ApiKeyId });
92
+ const ApiKeysUpdateRequestJson = /* @__PURE__ */ Schema.Struct({
93
+ name: Schema.optionalKey(Schema.Union([Schema.String.check(Schema.isMinLength(1).annotate({ expected: "a value with a length of at least 1" })).check(Schema.isMaxCodePoints(32).annotate({ expected: "a string with at most 32 code points" })).check(Schema.isMaxLength(32).annotate({ expected: "a value with a length of at most 32" })), Schema.Null])),
94
+ description: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
95
+ mailboxes: Schema.optionalKey(Schema.Union([ApiKeyMailboxAccessUpdate, Schema.Null]).annotate({ description: "Changes the mailbox send mode of a key that holds mailbox access. Only a person can change it; the change applies to the key's next request." }))
96
+ });
97
+ const ApiKeysUpdate200 = ApiKey;
98
+ const ApiKeysUpdate401 = UnauthorizedError;
99
+ const ApiKeysUpdate403 = ForbiddenError;
100
+ const ApiKeysUpdate404 = ResourceNotFoundError;
101
+ const ApiKeysUpdate422 = ValidationError;
102
+ const ApiKeysUpdate500 = InternalError;
103
+ const ApiKeysUpdate504 = GatewayTimeoutError;
104
+ const ApiKeysGetActivityPathParams = /* @__PURE__ */ Schema.Struct({ id: ApiKeyId });
105
+ const ApiKeysGetActivityQuery = /* @__PURE__ */ Schema.Struct({
106
+ limit: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
107
+ cursor: Schema.optionalKey(Schema.Union([Cursor, Schema.Null]))
108
+ });
109
+ const ApiKeysGetActivity200 = ApiKeyActivityPage;
110
+ const ApiKeysGetActivity401 = UnauthorizedError;
111
+ const ApiKeysGetActivity403 = ForbiddenError;
112
+ const ApiKeysGetActivity404 = ResourceNotFoundError;
113
+ const ApiKeysGetActivity422 = ValidationError;
114
+ const ApiKeysGetActivity500 = InternalError;
115
+ const ApiKeysGetActivity504 = GatewayTimeoutError;
116
+ const ApiKeysRevokePathParams = /* @__PURE__ */ Schema.Struct({ id: ApiKeyId });
117
+ const ApiKeysRevoke200 = SuccessResponse;
118
+ const ApiKeysRevoke401 = UnauthorizedError;
119
+ const ApiKeysRevoke403 = ForbiddenError;
120
+ const ApiKeysRevoke404 = ResourceNotFoundError;
121
+ const ApiKeysRevoke422 = ValidationError;
122
+ const ApiKeysRevoke500 = InternalError;
123
+ const ApiKeysRevoke502 = BillingProviderError;
124
+ const ApiKeysRevoke504 = GatewayTimeoutError;
125
+ const ApiKeysRotatePathParams = /* @__PURE__ */ Schema.Struct({ id: ApiKeyId });
126
+ const ApiKeysRotate200 = ApiKeyWithSecret;
127
+ const ApiKeysRotate401 = UnauthorizedError;
128
+ const ApiKeysRotate403 = ForbiddenError;
129
+ const ApiKeysRotate404 = ResourceNotFoundError;
130
+ const ApiKeysRotate422 = ValidationError;
131
+ const ApiKeysRotate500 = InternalError;
132
+ const ApiKeysRotate504 = GatewayTimeoutError;
133
+ const ApiKeysGetStatsPathParams = /* @__PURE__ */ Schema.Struct({ id: ApiKeyId });
134
+ const ApiKeysGetStatsQuery = /* @__PURE__ */ Schema.Struct({
135
+ after: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null])),
136
+ before: Schema.optionalKey(Schema.Union([Schema.String, Schema.Null]))
137
+ });
138
+ const ApiKeysGetStats200 = /* @__PURE__ */ Schema.Struct({
139
+ totalRequests: Schema.Finite.check(Schema.isInt().annotate({ expected: "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" })),
140
+ successfulRequests: Schema.Finite.check(Schema.isInt().annotate({ expected: "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" })),
141
+ failedRequests: Schema.Finite.check(Schema.isInt().annotate({ expected: "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" })),
142
+ dailyVolume: Schema.Array(Schema.Struct({
143
+ date: Schema.String,
144
+ requests: Schema.Finite.check(Schema.isInt().annotate({ expected: "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" }))
145
+ }))
146
+ });
147
+ const ApiKeysGetStats401 = UnauthorizedError;
148
+ const ApiKeysGetStats403 = ForbiddenError;
149
+ const ApiKeysGetStats404 = ResourceNotFoundError;
150
+ const ApiKeysGetStats422 = ValidationError;
151
+ const ApiKeysGetStats500 = InternalError;
152
+ const ApiKeysGetStats504 = GatewayTimeoutError;
153
+ var APIKeysGroup = class extends HttpApiGroup.make("API Keys").add(HttpApiEndpoint.get("apiKeysList", "/v1/api-keys", {
154
+ query: ApiKeysListQuery,
155
+ success: ApiKeysList200,
156
+ error: [
157
+ ApiKeysList401.pipe(HttpApiSchema.status(401)),
158
+ ApiKeysList403.pipe(HttpApiSchema.status(403)),
159
+ ApiKeysList422.pipe(HttpApiSchema.status(422)),
160
+ ApiKeysList500,
161
+ ApiKeysList504.pipe(HttpApiSchema.status(504))
162
+ ]
163
+ }).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "apiKeys.list").annotate(OpenApi.Summary, "List API keys").annotate(OpenApi.Description, "Returns the organization's API keys, newest first, filterable by status and a search term matched against name and description. Pass `nextCursor` back as `cursor` for the next page; it is null on the last page."), HttpApiEndpoint.post("apiKeysCreate", "/v1/api-keys", {
164
+ payload: ApiKeysCreateRequestJson,
165
+ success: ApiKeysCreate201.pipe(HttpApiSchema.status(201)),
166
+ error: [
167
+ ApiKeysCreate401.pipe(HttpApiSchema.status(401)),
168
+ ApiKeysCreate402.pipe(HttpApiSchema.status(402)),
169
+ ApiKeysCreate403.pipe(HttpApiSchema.status(403)),
170
+ ApiKeysCreate404.pipe(HttpApiSchema.status(404)),
171
+ ApiKeysCreate422.pipe(HttpApiSchema.status(422)),
172
+ ApiKeysCreate429.pipe(HttpApiSchema.status(429)),
173
+ ApiKeysCreate500,
174
+ ApiKeysCreate502.pipe(HttpApiSchema.status(502)),
175
+ ApiKeysCreate504.pipe(HttpApiSchema.status(504))
176
+ ]
177
+ }).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "apiKeys.create").annotate(OpenApi.Summary, "Create an API key").annotate(OpenApi.Description, "Creates a new API key for the organization and returns the created key, including the plaintext secret, with a 201 response."), HttpApiEndpoint.get("apiKeysGet", "/v1/api-keys/:id", {
178
+ params: ApiKeysGetPathParams,
179
+ success: ApiKeysGet200,
180
+ error: [
181
+ ApiKeysGet401.pipe(HttpApiSchema.status(401)),
182
+ ApiKeysGet403.pipe(HttpApiSchema.status(403)),
183
+ ApiKeysGet404.pipe(HttpApiSchema.status(404)),
184
+ ApiKeysGet422.pipe(HttpApiSchema.status(422)),
185
+ ApiKeysGet500,
186
+ ApiKeysGet504.pipe(HttpApiSchema.status(504))
187
+ ]
188
+ }).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "apiKeys.get").annotate(OpenApi.Summary, "Get an API key").annotate(OpenApi.Description, "Returns the API key with the given ID, including its metadata and access."), HttpApiEndpoint.patch("apiKeysUpdate", "/v1/api-keys/:id", {
189
+ params: ApiKeysUpdatePathParams,
190
+ payload: ApiKeysUpdateRequestJson,
191
+ success: ApiKeysUpdate200,
192
+ error: [
193
+ ApiKeysUpdate401.pipe(HttpApiSchema.status(401)),
194
+ ApiKeysUpdate403.pipe(HttpApiSchema.status(403)),
195
+ ApiKeysUpdate404.pipe(HttpApiSchema.status(404)),
196
+ ApiKeysUpdate422.pipe(HttpApiSchema.status(422)),
197
+ ApiKeysUpdate500,
198
+ ApiKeysUpdate504.pipe(HttpApiSchema.status(504))
199
+ ]
200
+ }).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "apiKeys.update").annotate(OpenApi.Summary, "Update an API key").annotate(OpenApi.Description, "Updates an API key's settings and returns the updated key. A field left out keeps its value."), HttpApiEndpoint.get("apiKeysGetActivity", "/v1/api-keys/:id/activity", {
201
+ params: ApiKeysGetActivityPathParams,
202
+ query: ApiKeysGetActivityQuery,
203
+ success: ApiKeysGetActivity200,
204
+ error: [
205
+ ApiKeysGetActivity401.pipe(HttpApiSchema.status(401)),
206
+ ApiKeysGetActivity403.pipe(HttpApiSchema.status(403)),
207
+ ApiKeysGetActivity404.pipe(HttpApiSchema.status(404)),
208
+ ApiKeysGetActivity422.pipe(HttpApiSchema.status(422)),
209
+ ApiKeysGetActivity500,
210
+ ApiKeysGetActivity504.pipe(HttpApiSchema.status(504))
211
+ ]
212
+ }).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "apiKeys.getActivity").annotate(OpenApi.Summary, "List API key activity").annotate(OpenApi.Description, "Returns the sends attributed to an API key, newest first. Pass `nextCursor` back as `cursor` for the next page; it is null on the last page."), HttpApiEndpoint.post("apiKeysRevoke", "/v1/api-keys/:id/revoke", {
213
+ params: ApiKeysRevokePathParams,
214
+ success: ApiKeysRevoke200,
215
+ error: [
216
+ ApiKeysRevoke401.pipe(HttpApiSchema.status(401)),
217
+ ApiKeysRevoke403.pipe(HttpApiSchema.status(403)),
218
+ ApiKeysRevoke404.pipe(HttpApiSchema.status(404)),
219
+ ApiKeysRevoke422.pipe(HttpApiSchema.status(422)),
220
+ ApiKeysRevoke500,
221
+ ApiKeysRevoke502.pipe(HttpApiSchema.status(502)),
222
+ ApiKeysRevoke504.pipe(HttpApiSchema.status(504))
223
+ ]
224
+ }).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "apiKeys.revoke").annotate(OpenApi.Summary, "Revoke an API key").annotate(OpenApi.Description, "Deactivates an API key so it can no longer authenticate requests. Revocation is final: a revoked key never authenticates again. Its record stays listable, so the messages it sent stay attributed to it."), HttpApiEndpoint.post("apiKeysRotate", "/v1/api-keys/:id/rotate", {
225
+ params: ApiKeysRotatePathParams,
226
+ success: ApiKeysRotate200,
227
+ error: [
228
+ ApiKeysRotate401.pipe(HttpApiSchema.status(401)),
229
+ ApiKeysRotate403.pipe(HttpApiSchema.status(403)),
230
+ ApiKeysRotate404.pipe(HttpApiSchema.status(404)),
231
+ ApiKeysRotate422.pipe(HttpApiSchema.status(422)),
232
+ ApiKeysRotate500,
233
+ ApiKeysRotate504.pipe(HttpApiSchema.status(504))
234
+ ]
235
+ }).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "apiKeys.rotate").annotate(OpenApi.Summary, "Rotate an API key").annotate(OpenApi.Description, "Issues a replacement with the same owner, name, and access, then deactivates the existing key. Returns the new key, including the plaintext secret."), HttpApiEndpoint.get("apiKeysGetStats", "/v1/api-keys/:id/stats", {
236
+ params: ApiKeysGetStatsPathParams,
237
+ query: ApiKeysGetStatsQuery,
238
+ success: ApiKeysGetStats200,
239
+ error: [
240
+ ApiKeysGetStats401.pipe(HttpApiSchema.status(401)),
241
+ ApiKeysGetStats403.pipe(HttpApiSchema.status(403)),
242
+ ApiKeysGetStats404.pipe(HttpApiSchema.status(404)),
243
+ ApiKeysGetStats422.pipe(HttpApiSchema.status(422)),
244
+ ApiKeysGetStats500,
245
+ ApiKeysGetStats504.pipe(HttpApiSchema.status(504))
246
+ ]
247
+ }).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "apiKeys.getStats").annotate(OpenApi.Summary, "Get API key send statistics").annotate(OpenApi.Description, "Returns aggregate send counts and daily volume attributed to an API key between `after` and `before`, a window of at most 90 days that defaults to the last 30 days.")).annotate(OpenApi.Description, "API key management, rotation, and usage statistics") {};
248
+ //#endregion
249
+ //#region src/effect/api-keys.ts
250
+ var api_keys_exports = /* @__PURE__ */ __exportAll({
251
+ CreatePayload: () => ApiKeysCreateRequestJson,
252
+ UpdatePayload: () => ApiKeysUpdateRequestJson,
253
+ create: () => create,
254
+ get: () => get,
255
+ getActivity: () => getActivity,
256
+ getStats: () => getStats,
257
+ list: () => list,
258
+ revoke: () => revoke,
259
+ rotate: () => rotate,
260
+ update: () => update
261
+ });
262
+ const make = forGroup(APIKeysGroup);
263
+ const list = make("apiKeysList");
264
+ const create = make("apiKeysCreate");
265
+ const get = make("apiKeysGet");
266
+ const revoke = make("apiKeysRevoke");
267
+ const update = make("apiKeysUpdate");
268
+ const rotate = make("apiKeysRotate");
269
+ const getStats = make("apiKeysGetStats");
270
+ const getActivity = make("apiKeysGetActivity");
271
+ //#endregion
272
+ export { getStats as a, rotate as c, ApiKeysUpdateRequestJson as d, getActivity as i, update as l, create as n, list as o, get as r, revoke as s, api_keys_exports as t, ApiKeysCreateRequestJson as u };
273
+
274
+ //# sourceMappingURL=api-keys-Ce1Y4_Ip.js.map