samva 0.0.1 → 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 (79) hide show
  1. package/AGENTS.md +13 -0
  2. package/LICENSE +21 -0
  3. package/README.md +392 -5
  4. package/dist/categories-CsUa8ojo.js +143 -0
  5. package/dist/client/client/client.gen.d.ts +2 -0
  6. package/dist/client/client/index.d.ts +10 -0
  7. package/dist/client/client/types.gen.d.ts +120 -0
  8. package/dist/client/client/utils.gen.d.ts +37 -0
  9. package/dist/client/client.gen.d.ts +12 -0
  10. package/dist/client/core/auth.gen.d.ts +25 -0
  11. package/dist/client/core/bodySerializer.gen.d.ts +25 -0
  12. package/dist/client/core/params.gen.d.ts +43 -0
  13. package/dist/client/core/pathSerializer.gen.d.ts +33 -0
  14. package/dist/client/core/queryKeySerializer.gen.d.ts +18 -0
  15. package/dist/client/core/serverSentEvents.gen.d.ts +71 -0
  16. package/dist/client/core/types.gen.d.ts +83 -0
  17. package/dist/client/core/utils.gen.d.ts +19 -0
  18. package/dist/client/sdk.gen.d.ts +1558 -0
  19. package/dist/client/types.gen.d.ts +7917 -0
  20. package/dist/client-BqkU-sFv.js +6049 -0
  21. package/dist/effect/api-keys.d.ts +190 -0
  22. package/dist/effect/api-keys.js +27 -0
  23. package/dist/effect/campaigns.d.ts +2055 -0
  24. package/dist/effect/campaigns.js +33 -0
  25. package/dist/effect/categories.d.ts +65 -0
  26. package/dist/effect/categories.js +2 -0
  27. package/dist/effect/client.d.ts +9 -0
  28. package/dist/effect/client.js +13 -0
  29. package/dist/effect/contacts.d.ts +1278 -0
  30. package/dist/effect/contacts.js +39 -0
  31. package/dist/effect/conversations.d.ts +1604 -0
  32. package/dist/effect/conversations.js +23 -0
  33. package/dist/effect/design.d.ts +209 -0
  34. package/dist/effect/design.js +13 -0
  35. package/dist/effect/email.d.ts +1022 -0
  36. package/dist/effect/email.js +111 -0
  37. package/dist/effect/generated-metadata.d.ts +54 -0
  38. package/dist/effect/generated.d.ts +32156 -0
  39. package/dist/effect/index.d.ts +36 -0
  40. package/dist/effect/index.js +17 -0
  41. package/dist/effect/internal/client.d.ts +35 -0
  42. package/dist/effect/internal/operation.d.ts +466 -0
  43. package/dist/effect/messages.d.ts +1047 -0
  44. package/dist/effect/messages.js +23 -0
  45. package/dist/effect/operations.d.ts +97 -0
  46. package/dist/effect/operations.js +15 -0
  47. package/dist/effect/organizations.d.ts +559 -0
  48. package/dist/effect/organizations.js +21 -0
  49. package/dist/effect/pagination.d.ts +37 -0
  50. package/dist/effect/retry.d.ts +60 -0
  51. package/dist/effect/retry.js +112 -0
  52. package/dist/effect/runtime.d.ts +7 -0
  53. package/dist/effect/scheduled-messages.d.ts +1009 -0
  54. package/dist/effect/scheduled-messages.js +17 -0
  55. package/dist/effect/templates.d.ts +2591 -0
  56. package/dist/effect/templates.js +66 -0
  57. package/dist/effect/webhooks.d.ts +228 -0
  58. package/dist/effect/webhooks.js +33 -0
  59. package/dist/index.d.ts +1 -0
  60. package/dist/index.js +2 -0
  61. package/dist/normalize-LkWl4HUF.js +82 -0
  62. package/dist/normalize.d.ts +87 -0
  63. package/dist/operation-Ccqh_yxb.js +596 -0
  64. package/dist/promises/errors.gen.d.ts +179 -0
  65. package/dist/promises/index.d.ts +153 -0
  66. package/dist/promises/index.js +2 -0
  67. package/dist/promises/types.gen.d.ts +1 -0
  68. package/dist/promises-Dgv8UmCC.js +5911 -0
  69. package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
  70. package/dist/service-map.d.ts +732 -0
  71. package/dist/webhooks/effect.d.ts +1 -0
  72. package/dist/webhooks/effect.js +1 -0
  73. package/dist/webhooks/promise.d.ts +1 -0
  74. package/dist/webhooks/promise.js +1 -0
  75. package/package.json +151 -4
  76. package/CLAUDE.md +0 -111
  77. package/bun.lock +0 -29
  78. package/index.ts +0 -1
  79. package/tsconfig.json +0 -29
@@ -0,0 +1,33 @@
1
+ import { t as __exportAll } from "../rolldown-runtime-D7D4PA-g.js";
2
+ import { n as make } from "../operation-Ccqh_yxb.js";
3
+ //#region src/effect/campaigns.ts
4
+ var campaigns_exports = /* @__PURE__ */ __exportAll({
5
+ archive: () => archive,
6
+ cancelRun: () => cancelRun,
7
+ create: () => create,
8
+ get: () => get,
9
+ getRun: () => getRun,
10
+ list: () => list,
11
+ listRecipients: () => listRecipients,
12
+ listRuns: () => listRuns,
13
+ pauseRun: () => pauseRun,
14
+ resumeRun: () => resumeRun,
15
+ scheduleRun: () => scheduleRun,
16
+ update: () => update
17
+ });
18
+ const list = make("campaignsList");
19
+ const create = make("campaignsCreate");
20
+ const get = make("campaignsGet");
21
+ const archive = make("campaignsArchive");
22
+ const update = make("campaignsUpdate");
23
+ const listRuns = make("campaignsListRuns");
24
+ const scheduleRun = make("campaignsScheduleRun");
25
+ const getRun = make("campaignsGetRun");
26
+ const pauseRun = make("campaignsPauseRun");
27
+ const resumeRun = make("campaignsResumeRun");
28
+ const cancelRun = make("campaignsCancelRun");
29
+ const listRecipients = make("campaignsListRecipients");
30
+ //#endregion
31
+ export { archive, cancelRun, create, get, getRun, list, listRecipients, listRuns, pauseRun, resumeRun, scheduleRun, campaigns_exports as t, update };
32
+
33
+ //# sourceMappingURL=campaigns.js.map
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Semantic error-category helpers for the Effect SDK.
3
+ *
4
+ * Every operation's error channel carries the server's real tagged errors
5
+ * ({@link import("./index").ConflictError} …). These helpers let callers catch
6
+ * or test by *category* — auth, validation, throttling, transient … — without
7
+ * enumerating tags, and cover the raw transport/decode errors too. The category
8
+ * assignments are generated from the OpenAPI category extensions.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * import { catchAuthError, isRetryable } from "samva/effect";
13
+ *
14
+ * samva.messages.send(input).pipe(
15
+ * catchAuthError((error) => Effect.logError(`auth failed: ${error.message}`)),
16
+ * Effect.retry({ while: isRetryable }),
17
+ * );
18
+ * ```
19
+ */
20
+ import { Effect } from "effect";
21
+ import type { BillingProviderError, ConflictError, EmailChannelError, ExternalServiceError, ForbiddenError, InternalError, PaymentRequiredError, RateLimitedError, ResourceNotFoundError, UnauthorizedError, ValidationError, WebhookEnqueueError } from "./index";
22
+ export type ErrorCategory = "auth" | "validation" | "notFound" | "conflict" | "throttling" | "billing" | "transient";
23
+ export declare const categoriesOf: (error: unknown) => ReadonlyArray<ErrorCategory>;
24
+ export declare const hasCategory: (error: unknown, category: ErrorCategory) => boolean;
25
+ type CategoryError = {
26
+ readonly auth: UnauthorizedError | ForbiddenError;
27
+ readonly validation: ValidationError;
28
+ readonly notFound: ResourceNotFoundError;
29
+ readonly conflict: ConflictError;
30
+ readonly throttling: RateLimitedError;
31
+ readonly billing: PaymentRequiredError;
32
+ readonly transient: InternalError | ExternalServiceError | BillingProviderError | WebhookEnqueueError;
33
+ };
34
+ type EmailChannelCategory = "auth" | "validation" | "throttling" | "transient";
35
+ type CategoryHandlerError<Category extends ErrorCategory> = CategoryError[Category] | (Category extends EmailChannelCategory ? EmailChannelError : never);
36
+ export declare const isAuthError: (error: unknown) => error is CategoryHandlerError<"auth">;
37
+ export declare const isValidationError: (error: unknown) => error is CategoryHandlerError<"validation">;
38
+ export declare const isNotFoundError: (error: unknown) => error is ResourceNotFoundError;
39
+ export declare const isConflictError: (error: unknown) => error is ConflictError;
40
+ export declare const isThrottlingError: (error: unknown) => error is CategoryHandlerError<"throttling">;
41
+ export declare const isBillingError: (error: unknown) => error is PaymentRequiredError;
42
+ /** True for transient failures, including raw request-transport errors (D4). */
43
+ export declare const isTransient: (error: unknown) => boolean;
44
+ /** True when an error is declared safe to retry (throttling / transient / transport). */
45
+ export declare const isRetryable: (error: unknown) => boolean;
46
+ /**
47
+ * Catch every error in `category`. The handler receives the category's error
48
+ * union — including `EmailChannelError` where its `reason` can place it in the
49
+ * category — while only total-membership classes are narrowed out of the error
50
+ * channel (`EmailChannelError` stays: instances with other reasons pass through).
51
+ */
52
+ export declare const catchCategory: <Category extends ErrorCategory, A2, E2, R2>(category: Category, handler: (error: CategoryHandlerError<Category>) => Effect.Effect<A2, E2, R2>) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A | A2, Exclude<E, CategoryError[Category]> | E2, R | R2>;
53
+ export declare const catchAuthError: <A2, E2, R2>(handler: (error: CategoryHandlerError<"auth">) => Effect.Effect<A2, E2, R2>) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A2 | A, E2 | Exclude<E, ForbiddenError | UnauthorizedError>, R2 | R>;
54
+ export declare const catchValidationError: <A2, E2, R2>(handler: (error: CategoryHandlerError<"validation">) => Effect.Effect<A2, E2, R2>) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A2 | A, E2 | Exclude<E, ValidationError>, R2 | R>;
55
+ export declare const catchNotFoundError: <A2, E2, R2>(handler: (error: CategoryHandlerError<"notFound">) => Effect.Effect<A2, E2, R2>) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A2 | A, E2 | Exclude<E, ResourceNotFoundError>, R2 | R>;
56
+ export declare const catchConflictError: <A2, E2, R2>(handler: (error: CategoryHandlerError<"conflict">) => Effect.Effect<A2, E2, R2>) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A2 | A, E2 | Exclude<E, ConflictError>, R2 | R>;
57
+ export declare const catchThrottlingError: <A2, E2, R2>(handler: (error: CategoryHandlerError<"throttling">) => Effect.Effect<A2, E2, R2>) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A2 | A, E2 | Exclude<E, RateLimitedError>, R2 | R>;
58
+ export declare const catchBillingError: <A2, E2, R2>(handler: (error: CategoryHandlerError<"billing">) => Effect.Effect<A2, E2, R2>) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A2 | A, E2 | Exclude<E, PaymentRequiredError>, R2 | R>;
59
+ /**
60
+ * Catch transient failures — including raw request-transport errors — for
61
+ * fallback/degrade paths. The declared error channel is left intact because
62
+ * transient covers untyped transport errors as well.
63
+ */
64
+ export declare const catchTransient: <A2, E2, R2>(handler: (error: unknown) => Effect.Effect<A2, E2, R2>) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A | A2, E | E2, R | R2>;
65
+ export {};
@@ -0,0 +1,2 @@
1
+ import { _ as isTransient, a as catchNotFoundError, c as catchValidationError, d as isAuthError, f as isBillingError, g as isThrottlingError, h as isRetryable, i as catchConflictError, l as categoriesOf, m as isNotFoundError, n as catchBillingError, o as catchThrottlingError, p as isConflictError, r as catchCategory, s as catchTransient, t as catchAuthError, u as hasCategory, v as isValidationError } from "../categories-CsUa8ojo.js";
2
+ export { catchAuthError, catchBillingError, catchCategory, catchConflictError, catchNotFoundError, catchThrottlingError, catchTransient, catchValidationError, categoriesOf, hasCategory, isAuthError, isBillingError, isConflictError, isNotFoundError, isRetryable, isThrottlingError, isTransient, isValidationError };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Samva Effect client capability.
3
+ *
4
+ * Provide {@link layer} when the application already owns an `HttpClient`, or
5
+ * {@link layerFetch} for the standard Fetch transport. Domain modules obtain
6
+ * the generated OpenAPI client through {@link Service}; callers do not need to
7
+ * construct or thread a client object through their programs.
8
+ */
9
+ export { type Config, type ConfigBase, type Interface, type Raw, Service, layer, layerFetch, raw, } from "./internal/client";
@@ -0,0 +1,13 @@
1
+ import { t as __exportAll } from "../rolldown-runtime-D7D4PA-g.js";
2
+ import { i as raw, n as layer, r as layerFetch, t as Service } from "../client-BqkU-sFv.js";
3
+ //#region src/effect/client.ts
4
+ var client_exports = /* @__PURE__ */ __exportAll({
5
+ Service: () => Service,
6
+ layer: () => layer,
7
+ layerFetch: () => layerFetch,
8
+ raw: () => raw
9
+ });
10
+ //#endregion
11
+ export { Service, layer, layerFetch, raw, client_exports as t };
12
+
13
+ //# sourceMappingURL=client.js.map