@distilled.cloud/stripe 1.0.0-rc.15 → 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/credentials.d.ts +1 -1
- package/lib/credentials.d.ts.map +1 -1
- package/lib/credentials.js +17 -14
- package/lib/credentials.js.map +1 -1
- package/lib/errors.d.ts +83 -83
- package/lib/errors.d.ts.map +1 -1
- package/lib/errors.js +99 -99
- package/lib/errors.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +12 -12
- package/lib/pagination.d.ts +3 -3
- package/lib/pagination.js +15 -15
- package/lib/protocol.d.ts +12 -12
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +240 -168
- package/lib/protocol.js.map +1 -1
- package/lib/retry.d.ts +1 -1
- package/lib/retry.d.ts.map +1 -1
- package/lib/retry.js +25 -24
- package/lib/retry.js.map +1 -1
- package/lib/services/stripe.d.ts +507 -14141
- package/lib/services/stripe.d.ts.map +1 -1
- package/lib/services/stripe.js +2173 -53133
- package/lib/traits.d.ts +2 -2
- package/lib/traits.js +11 -11
- package/lib/webhooks.js +2 -2
- package/lib/webhooks.js.map +1 -1
- package/package.json +13 -9
- package/src/credentials.ts +12 -11
- package/src/errors.ts +89 -88
- package/src/index.ts +1 -1
- package/src/pagination.ts +3 -3
- package/src/protocol.ts +278 -162
- package/src/retry.ts +6 -4
- package/src/services/stripe.ts +37296 -85780
- package/src/traits.ts +2 -2
- package/src/webhooks.ts +2 -2
- package/lib/protocol.test.d.ts +0 -2
- package/lib/protocol.test.d.ts.map +0 -1
- package/lib/protocol.test.js +0 -353
- package/lib/protocol.test.js.map +0 -1
- package/lib/services/stripe.js.map +0 -1
- package/src/protocol.test.ts +0 -519
package/lib/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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";
|
package/lib/pagination.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Stripe pagination
|
|
2
|
+
* Stripe pagination -- hand-written.
|
|
3
3
|
*
|
|
4
|
-
* Only the GET
|
|
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
|
|
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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
10
|
+
* request: credentials -> `Authorization: Bearer <apiKey>` + API base URL;
|
|
11
11
|
* per-call {@link StripeRequestOptions} (resolved from the
|
|
12
|
-
* calling fiber via {@link RequestOptions})
|
|
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)
|
|
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,
|
|
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
|
|
28
|
-
* idempotency_error
|
|
29
|
-
* InvalidRequestError, api_error
|
|
30
|
-
* Stripe-specific status map (402
|
|
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
|
|
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
|
|
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.
|
package/lib/protocol.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,K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