@distilled.cloud/stripe 1.0.0-rc.14 → 1.0.0-rc.16

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.
package/lib/index.js CHANGED
@@ -1,15 +1,15 @@
1
- /**
2
- * @distilled.cloud/stripe — Stripe SDK for Effect.
3
- *
4
- * `./services` is generated by `scripts/generate.ts` from the Smithy model
5
- * in `.generated-specs` (written by `scripts/convert.ts` from the Stripe
6
- * OpenAPI SDK spec). Everything else in this folder is hand-written.
7
- *
8
- * @example
9
- * ```ts
10
- * import * as Stripe from "@distilled.cloud/stripe";
11
- * ```
12
- */
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
13
  export * from "./credentials.js";
14
14
  export * from "./errors.js";
15
15
  export * as T from "./traits.js";
@@ -1,10 +1,10 @@
1
1
  /**
2
- * Stripe pagination — hand-written.
2
+ * Stripe pagination -- hand-written.
3
3
  *
4
- * Only the GET …/search operations paginate (v0 parity): the converter
4
+ * Only the GET .../search operations paginate (v0 parity): the converter
5
5
  * detects them as `mode: "page"` (inputToken `page`, outputToken
6
6
  * `next_page`, items `data`), but Stripe's `page` parameter is an OPAQUE
7
- * CURSOR — `next_page` is the next cursor string, not a page number — so
7
+ * CURSOR -- `next_page` is the next cursor string, not a page number -- so
8
8
  * "page" mode traverses by following the cursor, exactly core's
9
9
  * `paginateCursor` semantics.
10
10
  *
package/lib/pagination.js CHANGED
@@ -1,19 +1,19 @@
1
- /**
2
- * Stripe pagination — hand-written.
3
- *
4
- * Only the GET …/search operations paginate (v0 parity): the converter
5
- * detects them as `mode: "page"` (inputToken `page`, outputToken
6
- * `next_page`, items `data`), but Stripe's `page` parameter is an OPAQUE
7
- * CURSOR — `next_page` is the next cursor string, not a page number — so
8
- * "page" mode traverses by following the cursor, exactly core's
9
- * `paginateCursor` semantics.
10
- *
11
- * Stripe's regular list endpoints (starting_after / ending_before +
12
- * has_more) are plain operations without the paginated surface, mirroring
13
- * distilled v0.
14
- */
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
15
  import * as Pagination from "@distilled.cloud/core/pagination";
16
- /** Dispatch on the operation's pagination mode, Stripe-style. */
16
+
17
17
  export const stripeSearchPaginate = (operation, input, pagination) => {
18
18
  switch (pagination.mode) {
19
19
  case "page":
package/lib/protocol.d.ts CHANGED
@@ -1,15 +1,15 @@
1
1
  import * as API from "@distilled.cloud/core/api";
2
2
  import { ConfigError, type DefaultErrors as CoreDefaultErrors, BadRequest, Conflict, Forbidden, Locked, NotFound, UnprocessableEntity } from "@distilled.cloud/core/errors";
3
3
  /**
4
- * StripeProtocol — hand-written.
4
+ * StripeProtocol -- hand-written.
5
5
  *
6
6
  * Speaks Stripe's REST protocol. The generic trait helpers live in
7
7
  * `@distilled.cloud/core/protocol-http`; this module supplies what is
8
8
  * Stripe's own (ported from the distilled v0 stripe client):
9
9
  *
10
- * request: credentials → `Authorization: Bearer <apiKey>` + API base URL;
10
+ * request: credentials -> `Authorization: Bearer <apiKey>` + API base URL;
11
11
  * per-call {@link StripeRequestOptions} (resolved from the
12
- * calling fiber via {@link RequestOptions}) → Idempotency-Key /
12
+ * calling fiber via {@link RequestOptions}) -> Idempotency-Key /
13
13
  * Stripe-Account / Stripe-Context / Stripe-Version headers;
14
14
  * GET inputs flatten body-bound members into the query string
15
15
  * with Stripe bracket notation (`created[gte]`, `expand[]`);
@@ -20,20 +20,20 @@ import { ConfigError, type DefaultErrors as CoreDefaultErrors, BadRequest, Confl
20
20
  * as JSON otherwise (the /v2 ops), and as multipart form-data
21
21
  * for `contentType: "multipart"` (POST /v1/files)
22
22
  *
23
- * response: 2xx JSON is the payload (no envelope) → wire→TS key mapping →
23
+ * response: 2xx JSON is the payload (no envelope) -> wire->TS key mapping ->
24
24
  * Redacted wrapping of sensitive members; failures parse the
25
- * `{ error: { type, code, message, … } }` envelope and dispatch
25
+ * `{ error: { type, code, message, ... } }` envelope and dispatch
26
26
  * by per-op matcher classes first (`matchTypedError`, e.g.
27
- * ProductHasPrices), then `error.type` (card_error → CardError,
28
- * idempotency_error → IdempotencyError, invalid_request_error →
29
- * InvalidRequestError, api_error → ApiError), then the
30
- * Stripe-specific status map (402 → PaymentError, 424 →
27
+ * ProductHasPrices), then `error.type` (card_error -> CardError,
28
+ * idempotency_error -> IdempotencyError, invalid_request_error ->
29
+ * InvalidRequestError, api_error -> ApiError), then the
30
+ * Stripe-specific status map (402 -> PaymentError, 424 ->
31
31
  * ExternalDependencyFailed), then core's HTTP status map (with
32
32
  * retryAfter hints), then UnknownStripeError.
33
33
  */
34
34
  import * as Context from "effect/Context";
35
35
  import * as Effect from "effect/Effect";
36
- import type * as HttpClient from "effect/http/HttpClient";
36
+ import * as HttpClient from "effect/http/HttpClient";
37
37
  import type * as HttpClientError from "effect/http/HttpClientError";
38
38
  import * as Layer from "effect/Layer";
39
39
  import { Credentials } from "./credentials.ts";
@@ -53,9 +53,9 @@ declare const RequestOptions_base: Context.ServiceClass<RequestOptions, "StripeR
53
53
  /**
54
54
  * Per-call request options service. distilled v0 passed these as a second
55
55
  * call argument; v1 operations take only their input, so options travel on
56
- * the calling fiber's context instead — see {@link withRequestOptions}.
56
+ * the calling fiber's context instead -- see {@link withRequestOptions}.
57
57
  */
58
- export declare class RequestOptions extends RequestOptions_base {
58
+ export declare class RequestOptions extends /*@__PURE__*/ RequestOptions_base {
59
59
  }
60
60
  /**
61
61
  * Provide {@link StripeRequestOptions} to every Stripe API call below it.
@@ -1 +1 @@
1
- {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,2BAA2B,CAAC;AACjD,OAAO,EACL,WAAW,EAGX,KAAK,aAAa,IAAI,iBAAiB,EACvC,UAAU,EACV,QAAQ,EACR,SAAS,EACT,MAAM,EACN,QAAQ,EACR,mBAAmB,EACpB,MAAM,8BAA8B,CAAC;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