samva 0.5.0 → 0.7.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 (65) hide show
  1. package/AGENTS.md +3 -2
  2. package/README.md +14 -4
  3. package/dist/{categories-B9Nw2v_F.js → categories-DvsHUJtX.js} +32 -8
  4. package/dist/client/sdk.gen.d.ts +493 -88
  5. package/dist/client/types.gen.d.ts +3136 -416
  6. package/dist/{client-B7gEkvEq.js → client-5O8KsY5Z.js} +2638 -902
  7. package/dist/{client-attribution-B2yJBXdZ.js → client-attribution-27MNycCV.js} +2 -2
  8. package/dist/effect/analytics.d.ts +66 -0
  9. package/dist/effect/analytics.js +21 -0
  10. package/dist/effect/api-keys.d.ts +198 -34
  11. package/dist/effect/api-keys.js +1 -1
  12. package/dist/effect/attachments.d.ts +53 -0
  13. package/dist/effect/attachments.js +17 -0
  14. package/dist/effect/brands.d.ts +212 -0
  15. package/dist/effect/brands.js +24 -0
  16. package/dist/effect/campaigns.d.ts +36 -18
  17. package/dist/effect/campaigns.js +1 -1
  18. package/dist/effect/categories.d.ts +3 -3
  19. package/dist/effect/categories.js +1 -1
  20. package/dist/effect/client.js +1 -1
  21. package/dist/effect/contact-groups.d.ts +375 -0
  22. package/dist/effect/contact-groups.js +29 -0
  23. package/dist/effect/contacts.d.ts +35 -19
  24. package/dist/effect/contacts.js +1 -1
  25. package/dist/effect/conversations.d.ts +188 -47
  26. package/dist/effect/conversations.js +1 -1
  27. package/dist/effect/custom-fields.d.ts +111 -0
  28. package/dist/effect/custom-fields.js +17 -0
  29. package/dist/effect/email.d.ts +268 -121
  30. package/dist/effect/email.js +2 -2
  31. package/dist/effect/generated-metadata.d.ts +20 -4
  32. package/dist/effect/generated.d.ts +13934 -7968
  33. package/dist/effect/index.d.ts +7 -2
  34. package/dist/effect/index.js +9 -4
  35. package/dist/effect/internal/operation.d.ts +121 -27
  36. package/dist/effect/media.d.ts +5 -5
  37. package/dist/effect/media.js +1 -1
  38. package/dist/effect/messages.d.ts +319 -73
  39. package/dist/effect/messages.js +1 -1
  40. package/dist/effect/operations.d.ts +6 -6
  41. package/dist/effect/operations.js +1 -1
  42. package/dist/effect/organizations.d.ts +7 -374
  43. package/dist/effect/organizations.js +2 -4
  44. package/dist/effect/retry.js +1 -1
  45. package/dist/effect/scheduled-messages.d.ts +7 -7
  46. package/dist/effect/scheduled-messages.js +1 -1
  47. package/dist/effect/templates.d.ts +263 -305
  48. package/dist/effect/templates.js +7 -5
  49. package/dist/effect/unsubscribe-groups.d.ts +161 -0
  50. package/dist/effect/unsubscribe-groups.js +25 -0
  51. package/dist/effect/webhooks.d.ts +18 -18
  52. package/dist/effect/webhooks.js +2 -2
  53. package/dist/index.js +2 -2
  54. package/dist/{normalize-BiIJnycv.js → normalize-B79uJIeb.js} +13 -14
  55. package/dist/normalize.d.ts +3 -7
  56. package/dist/{operation-B4FjN6wq.js → operation-Cb5V9FJ7.js} +123 -11
  57. package/dist/promises/errors.gen.d.ts +50 -43
  58. package/dist/promises/index.d.ts +20 -6
  59. package/dist/promises/index.js +2 -2
  60. package/dist/promises/types.gen.d.ts +1 -1
  61. package/dist/{promises-CP_nxUus.js → promises-C2yyw-pf.js} +1582 -368
  62. package/dist/service-map.d.ts +189 -12
  63. package/package.json +32 -12
  64. package/dist/effect/design.d.ts +0 -209
  65. package/dist/effect/design.js +0 -13
package/AGENTS.md CHANGED
@@ -6,8 +6,9 @@ required.
6
6
 
7
7
  Effect applications should import Pascal-cased domain modules from focused subpaths such as
8
8
  `samva/effect/email` and provide `Client.layerFetch` from `samva/effect/client`. Install the optional
9
- peer `effect@4.0.0-rc.112` when using those entrypoints. Keep that exact release candidate pinned. Tagged API
10
- failures remain in the Effect error channel and can be handled with `Effect.catchTag`.
9
+ peer `effect` at the exact version this package's `peerDependencies` names when using those
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
12
 
12
13
  Treat exported request and response types as the API contract. Do not import package-internal files
13
14
  or generated implementation paths; use only the subpaths declared in `package.json`.
package/README.md CHANGED
@@ -65,7 +65,7 @@ const messages = await client.messages.list({
65
65
  Install `effect` next to `samva` when using the Effect entrypoint:
66
66
 
67
67
  ```bash
68
- bun add samva effect@4.0.0-rc.112
68
+ bun add samva effect@4.0.0-rc.117
69
69
  ```
70
70
 
71
71
  ```typescript
@@ -112,7 +112,7 @@ const client = createClient({
112
112
  - The token is user-scoped; send the target organization slug on every request via the `x-org-slug` header.
113
113
  - There is no SDK `orgSlug` helper — pass the header directly.
114
114
 
115
- For terminal workflows (`samva login`, `samva org use`, `samva email send --dry-run`), see the [`@samva/cli` README](https://github.com/AryaLabsHQ/samva/tree/main/packages/cli).
115
+ For terminal workflows (`samva login`, `samva org use`, `samva email send --dry-run`), see [`@samva/cli`](https://www.npmjs.com/package/@samva/cli).
116
116
 
117
117
  The Promise and Effect clients identify their public SDK surface and package version with the
118
118
  advisory `x-samva-client` request header. Supply your own value in `headers`, or set the header to
@@ -122,11 +122,15 @@ advisory `x-samva-client` request header. Supply your own value in `headers`, or
122
122
 
123
123
  The Promise client exposes:
124
124
 
125
+ - `analytics`
125
126
  - `apiKeys`
127
+ - `attachments`
128
+ - `brands`
126
129
  - `campaigns`
130
+ - `contactGroups`
127
131
  - `contacts`
128
132
  - `conversations`
129
- - `design`
133
+ - `customFields`
130
134
  - `email`
131
135
  - `media`
132
136
  - `messages`
@@ -134,15 +138,20 @@ The Promise client exposes:
134
138
  - `organizations`
135
139
  - `scheduledMessages`
136
140
  - `templates`
141
+ - `unsubscribeGroups`
137
142
  - `webhooks`
138
143
 
139
144
  The Effect SDK exposes Pascal-cased domain modules with lower-camel operations:
140
145
 
146
+ - `Analytics`
141
147
  - `ApiKeys`
148
+ - `Attachments`
149
+ - `Brands`
142
150
  - `Campaigns`
151
+ - `ContactGroups`
143
152
  - `Contacts`
144
153
  - `Conversations`
145
- - `Design`
154
+ - `CustomFields`
146
155
  - `Email`
147
156
  - `Media`
148
157
  - `Messages`
@@ -150,6 +159,7 @@ The Effect SDK exposes Pascal-cased domain modules with lower-camel operations:
150
159
  - `Organizations`
151
160
  - `ScheduledMessages`
152
161
  - `Templates`
162
+ - `UnsubscribeGroups`
153
163
  - `Webhooks`
154
164
 
155
165
  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.
@@ -2,14 +2,30 @@ import { Effect } from "effect";
2
2
  import * as Predicate$1 from "effect/Predicate";
3
3
  //#region src/effect/generated-metadata.ts
4
4
  const SamvaErrorMetadata = {
5
+ AnalyticsQueryError: {
6
+ categories: [],
7
+ retryable: false
8
+ },
5
9
  BillingProviderError: {
6
10
  categories: ["transient"],
7
11
  retryable: true
8
12
  },
13
+ BrandAddressRequiredError: {
14
+ categories: [],
15
+ retryable: false
16
+ },
17
+ CampaignFooterRequiredError: {
18
+ categories: [],
19
+ retryable: false
20
+ },
9
21
  ConflictError: {
10
22
  categories: ["conflict"],
11
23
  retryable: false
12
24
  },
25
+ DeliveryUnavailableError: {
26
+ categories: ["transient"],
27
+ retryable: true
28
+ },
13
29
  EmailChannelError: {
14
30
  categories: [],
15
31
  retryable: false
@@ -26,6 +42,10 @@ const SamvaErrorMetadata = {
26
42
  categories: ["auth"],
27
43
  retryable: false
28
44
  },
45
+ GatewayTimeoutError: {
46
+ categories: ["transient"],
47
+ retryable: true
48
+ },
29
49
  InternalError: {
30
50
  categories: ["transient"],
31
51
  retryable: true
@@ -53,10 +73,6 @@ const SamvaErrorMetadata = {
53
73
  ValidationError: {
54
74
  categories: ["validation"],
55
75
  retryable: false
56
- },
57
- WebhookEnqueueError: {
58
- categories: ["transient"],
59
- retryable: true
60
76
  }
61
77
  };
62
78
  //#endregion
@@ -118,7 +134,7 @@ const isRequestTransportError = (error) => {
118
134
  const reason = error.reason;
119
135
  return Predicate$1.isObject(reason) && Predicate$1.isTagged(reason, "TransportError");
120
136
  };
121
- /** True for transient failures, including raw request-transport errors (D4). */
137
+ /** True for transient failures, including raw request-transport errors. */
122
138
  const isTransient = (error) => hasCategory(error, "transient") || isRequestTransportError(error);
123
139
  /** True when an error is declared safe to retry (throttling / transient / transport). */
124
140
  const isRetryable = (error) => isRetryableError(error) || isRequestTransportError(error);
@@ -128,7 +144,15 @@ const isRetryable = (error) => isRetryableError(error) || isRequestTransportErro
128
144
  * category — while only total-membership classes are narrowed out of the error
129
145
  * channel (`EmailChannelError` stays: instances with other reasons pass through).
130
146
  */
131
- const catchCategory = (category, handler) => (effect) => Effect.catchIf(effect, (error) => hasCategory(error, category), handler);
147
+ const catchCategory = (category, handler) => (effect) => {
148
+ const inCategory = (error) => hasCategory(error, category);
149
+ const outsideCategory = (error) => !hasCategory(error, category);
150
+ return Effect.catch(effect, (error) => {
151
+ if (inCategory(error)) return handler(error);
152
+ if (outsideCategory(error)) return Effect.fail(error);
153
+ return Effect.die(error);
154
+ });
155
+ };
132
156
  const catchAuthError = (handler) => catchCategory("auth", handler);
133
157
  const catchValidationError = (handler) => catchCategory("validation", handler);
134
158
  const catchNotFoundError = (handler) => catchCategory("notFound", handler);
@@ -140,8 +164,8 @@ const catchBillingError = (handler) => catchCategory("billing", handler);
140
164
  * fallback/degrade paths. The declared error channel is left intact because
141
165
  * transient covers untyped transport errors as well.
142
166
  */
143
- const catchTransient = (handler) => (effect) => Effect.catchIf(effect, (error) => isTransient(error), handler);
167
+ const catchTransient = (handler) => (effect) => Effect.catchIf(effect, isTransient, handler);
144
168
  //#endregion
145
169
  export { isTransient as _, catchNotFoundError as a, catchValidationError as c, isAuthError as d, isBillingError as f, isThrottlingError as g, isRetryable as h, catchConflictError as i, categoriesOf as l, isNotFoundError as m, catchBillingError as n, catchThrottlingError as o, isConflictError as p, catchCategory as r, catchTransient as s, catchAuthError as t, hasCategory as u, isValidationError as v };
146
170
 
147
- //# sourceMappingURL=categories-B9Nw2v_F.js.map
171
+ //# sourceMappingURL=categories-DvsHUJtX.js.map