@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/traits.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Stripe SDK trait surface
|
|
2
|
+
* Stripe SDK trait surface -- hand-written.
|
|
3
3
|
*
|
|
4
4
|
* Re-exports the generic protocol traits from core (so generated operations
|
|
5
5
|
* import everything from one place). The only Stripe-specific piece is the
|
|
6
6
|
* widened `Http` trait: nearly every Stripe operation's request body is
|
|
7
7
|
* `application/x-www-form-urlencoded` (with Stripe's deep bracket
|
|
8
|
-
* expansion), which core's `HttpTrait` doesn't model
|
|
8
|
+
* expansion), which core's `HttpTrait` doesn't model -- the Stripe protocol
|
|
9
9
|
* keys its body encoding on `contentType: "form-urlencoded"`.
|
|
10
10
|
*/
|
|
11
11
|
import { type HttpTrait as CoreHttpTrait } from "@distilled.cloud/core/trait";
|
package/lib/traits.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
11
|
import { Http as CoreHttp } from "@distilled.cloud/core/trait";
|
|
12
12
|
export { Body, Header, Query, Label, ResponseCode, HttpBody, FormDataFile, KeyDictionary, UnionCases, applyErrorMatchers, getErrorMatchers, bodySymbol, headerSymbol, querySymbol, labelSymbol, httpSymbol, responseCodeSymbol, httpBodySymbol, formDataFileSymbol, keyDictionarySymbol, unionCasesSymbol, } from "@distilled.cloud/core/trait";
|
|
13
13
|
export { RawResponse, RawResponseRoot, SensitiveValue, rawResponseSymbol, rawResponseRootSymbol, sensitiveValueSymbol, } from "@distilled.cloud/core/protocol-rest";
|
|
14
|
-
|
|
14
|
+
|
|
15
15
|
export const Http = (trait) => CoreHttp(trait);
|
|
16
16
|
//# sourceMappingURL=traits.js.map
|
package/lib/webhooks.js
CHANGED
|
@@ -2,8 +2,8 @@ import * as Effect from "effect/Effect";
|
|
|
2
2
|
import * as Redacted from "effect/Redacted";
|
|
3
3
|
import { StripeWebhookPayloadParseError, StripeWebhookSignatureError } from "./errors.js";
|
|
4
4
|
export const DEFAULT_WEBHOOK_TOLERANCE_SECONDS = 300;
|
|
5
|
-
const textEncoder = new TextEncoder();
|
|
6
|
-
const textDecoder = new TextDecoder("utf-8", { fatal: true });
|
|
5
|
+
const textEncoder = /*@__PURE__*/ new TextEncoder();
|
|
6
|
+
const textDecoder = /*@__PURE__*/ new TextDecoder("utf-8", { fatal: true });
|
|
7
7
|
const payloadToBytes = (payload) => {
|
|
8
8
|
if (typeof payload === "string") {
|
|
9
9
|
return textEncoder.encode(payload);
|
package/lib/webhooks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhooks.js","sourceRoot":"","sources":["../src/webhooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,8BAA8B,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC;AAE1F,MAAM,CAAC,MAAM,iCAAiC,GAAG,GAAG,CAAC;AAyCrD,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"webhooks.js","sourceRoot":"","sources":["../src/webhooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,8BAA8B,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC;AAE1F,MAAM,CAAC,MAAM,iCAAiC,GAAG,GAAG,CAAC;AAyCrD,MAAM,WAAW,GAAG,aAAa,CAAC,IAAI,WAAW,EAAE,CAAC;AACpD,MAAM,WAAW,GAAG,aAAa,CAAC,IAAI,WAAW,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAE5E,MAAM,cAAc,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AAM,CAAC,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;QAClE,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CACf,IAAI,8BAA8B,CAAC;QACjC,OAAO,EAAE,gDAAgD;QACzD,KAAK;KACN,CAAC;CACL,CAAC,CACH,CACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@distilled.cloud/stripe",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.16",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,7 +18,9 @@
|
|
|
18
18
|
"types": "./lib/index.d.ts",
|
|
19
19
|
"bun": "./src/index.ts",
|
|
20
20
|
"worker": "./src/index.ts",
|
|
21
|
-
"
|
|
21
|
+
"module": "./lib/index.full.js",
|
|
22
|
+
"module-sync": "./lib/index.js",
|
|
23
|
+
"default": "./lib/index.full.js"
|
|
22
24
|
},
|
|
23
25
|
"./Credentials": {
|
|
24
26
|
"types": "./lib/credentials.d.ts",
|
|
@@ -66,27 +68,29 @@
|
|
|
66
68
|
"types": "./lib/services/*.d.ts",
|
|
67
69
|
"bun": "./src/services/*.ts",
|
|
68
70
|
"worker": "./src/services/*.ts",
|
|
69
|
-
"
|
|
71
|
+
"module": "./lib/services.full/*.js",
|
|
72
|
+
"module-sync": "./lib/services/*.js",
|
|
73
|
+
"default": "./lib/services.full/*.js"
|
|
70
74
|
}
|
|
71
75
|
},
|
|
72
76
|
"dependencies": {
|
|
73
|
-
"@distilled.cloud/core": "1.0.0-rc.
|
|
77
|
+
"@distilled.cloud/core": "1.0.0-rc.16"
|
|
74
78
|
},
|
|
75
79
|
"devDependencies": {
|
|
76
|
-
"@types/node": "26.
|
|
80
|
+
"@types/node": "26.6.5"
|
|
77
81
|
},
|
|
78
82
|
"peerDependencies": {
|
|
79
|
-
"effect": "^4.0.
|
|
83
|
+
"effect": "^4.0.5"
|
|
80
84
|
},
|
|
81
85
|
"distilled": {
|
|
82
|
-
"generatedAt": "2026-10-
|
|
86
|
+
"generatedAt": "2026-10-09",
|
|
83
87
|
"specUpdatedAt": "2026-09-30"
|
|
84
88
|
},
|
|
85
89
|
"scripts": {
|
|
86
|
-
"build": "
|
|
90
|
+
"build": "tsrs -b",
|
|
87
91
|
"convert": "node --conditions=bun scripts/convert.ts",
|
|
88
92
|
"generate": "node --conditions=bun scripts/convert.ts && node --conditions=bun scripts/generate.ts",
|
|
89
|
-
"typecheck": "
|
|
93
|
+
"typecheck": "tsrs -p tsconfig.json",
|
|
90
94
|
"specs:fetch": "git submodule update --force --init --depth=1 specs/spec-mirror-stripe",
|
|
91
95
|
"specs:update": "git submodule update --remote --force --depth=1 specs/spec-mirror-stripe"
|
|
92
96
|
}
|
package/src/credentials.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import * as EffectConfig from "@distilled.cloud/core/config";
|
|
1
2
|
/**
|
|
2
|
-
* Stripe credentials
|
|
3
|
+
* Stripe credentials -- hand-written.
|
|
3
4
|
*
|
|
4
5
|
* API-compatible port of the distilled v0 stripe credentials module: the
|
|
5
6
|
* `Credentials` service holds an *effect* that resolves the current
|
|
6
7
|
* credentials on every request. `CredentialsFromEnv` reads `STRIPE_API_KEY`.
|
|
7
8
|
*/
|
|
8
9
|
import { ConfigError } from "@distilled.cloud/core/errors";
|
|
9
|
-
import * as EffectConfig from "effect/Config";
|
|
10
10
|
import * as Context from "effect/Context";
|
|
11
11
|
import * as Effect from "effect/Effect";
|
|
12
12
|
import * as Layer from "effect/Layer";
|
|
@@ -19,24 +19,25 @@ export interface Config {
|
|
|
19
19
|
readonly apiBaseUrl: string;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export class Credentials
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
export class Credentials
|
|
23
|
+
extends /*@__PURE__*/ Context.Service<Credentials, Effect.Effect<Config>>()(
|
|
24
|
+
"StripeCredentials",
|
|
25
|
+
) {}
|
|
25
26
|
|
|
26
|
-
const envConfig = EffectConfig.all({
|
|
27
|
-
apiKey: EffectConfig.String("STRIPE_API_KEY"),
|
|
27
|
+
const envConfig = /*@__PURE__*/ EffectConfig.all({
|
|
28
|
+
apiKey: /*@__PURE__*/ EffectConfig.String("STRIPE_API_KEY"),
|
|
28
29
|
});
|
|
29
30
|
|
|
30
|
-
export const CredentialsFromEnv = Layer.succeed(
|
|
31
|
+
export const CredentialsFromEnv = /*@__PURE__*/ Layer.succeed(
|
|
31
32
|
Credentials,
|
|
32
|
-
envConfig.pipe(
|
|
33
|
-
Effect.mapError(
|
|
33
|
+
/*@__PURE__*/ envConfig.pipe(
|
|
34
|
+
/*@__PURE__*/ Effect.mapError(
|
|
34
35
|
() =>
|
|
35
36
|
new ConfigError({
|
|
36
37
|
message: "STRIPE_API_KEY environment variable is required",
|
|
37
38
|
}),
|
|
38
39
|
),
|
|
39
|
-
Effect.map(({ apiKey }) => ({
|
|
40
|
+
/*@__PURE__*/ Effect.map(({ apiKey }) => ({
|
|
40
41
|
apiKey: Redacted.make(apiKey),
|
|
41
42
|
apiBaseUrl: DEFAULT_API_BASE_URL,
|
|
42
43
|
})),
|
package/src/errors.ts
CHANGED
|
@@ -26,90 +26,90 @@ export {
|
|
|
26
26
|
export type { DefaultErrors } from "@distilled.cloud/core/errors";
|
|
27
27
|
|
|
28
28
|
import * as Category from "@distilled.cloud/core/category";
|
|
29
|
-
import * as Schema from "
|
|
29
|
+
import * as Schema from "@distilled.cloud/core/schema-lite-typed";
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
|
-
* Payment error
|
|
32
|
+
* Payment error -- returned when a payment request fails (HTTP 402).
|
|
33
33
|
* The parameters were valid but the request failed (e.g., card declined).
|
|
34
34
|
*/
|
|
35
|
-
export class PaymentError
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
35
|
+
export class PaymentError
|
|
36
|
+
extends /*@__PURE__*/ Schema.TaggedError<PaymentError>()("PaymentError", {
|
|
37
|
+
message: /*@__PURE__*/ Schema.optional(Schema.String),
|
|
38
|
+
code: /*@__PURE__*/ Schema.optional(Schema.String),
|
|
39
|
+
decline_code: /*@__PURE__*/ Schema.optional(Schema.String),
|
|
40
|
+
charge: /*@__PURE__*/ Schema.optional(Schema.String),
|
|
41
|
+
param: /*@__PURE__*/ Schema.optional(Schema.String),
|
|
42
|
+
doc_url: /*@__PURE__*/ Schema.optional(Schema.String),
|
|
43
|
+
request_log_url: /*@__PURE__*/ Schema.optional(Schema.String),
|
|
44
|
+
}).pipe(Category.withBadRequestError) {}
|
|
44
45
|
|
|
45
46
|
/**
|
|
46
|
-
* Card error
|
|
47
|
+
* Card error -- returned when a card cannot be charged.
|
|
47
48
|
* Stripe error type: "card_error"
|
|
48
49
|
*/
|
|
49
|
-
export class CardError
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
50
|
+
export class CardError
|
|
51
|
+
extends /*@__PURE__*/ Schema.TaggedError<CardError>()("CardError", {
|
|
52
|
+
message: /*@__PURE__*/ Schema.optional(Schema.String),
|
|
53
|
+
code: /*@__PURE__*/ Schema.optional(Schema.String),
|
|
54
|
+
decline_code: /*@__PURE__*/ Schema.optional(Schema.String),
|
|
55
|
+
charge: /*@__PURE__*/ Schema.optional(Schema.String),
|
|
56
|
+
param: /*@__PURE__*/ Schema.optional(Schema.String),
|
|
57
|
+
doc_url: /*@__PURE__*/ Schema.optional(Schema.String),
|
|
58
|
+
advice_code: /*@__PURE__*/ Schema.optional(Schema.String),
|
|
59
|
+
network_advice_code: /*@__PURE__*/ Schema.optional(Schema.String),
|
|
60
|
+
network_decline_code: /*@__PURE__*/ Schema.optional(Schema.String),
|
|
61
|
+
payment_method_type: /*@__PURE__*/ Schema.optional(Schema.String),
|
|
62
|
+
request_log_url: /*@__PURE__*/ Schema.optional(Schema.String),
|
|
63
|
+
}).pipe(Category.withBadRequestError) {}
|
|
62
64
|
|
|
63
65
|
/**
|
|
64
|
-
* Idempotency error
|
|
66
|
+
* Idempotency error -- returned when an Idempotency-Key is re-used
|
|
65
67
|
* on a request that does not match the first request's API endpoint and parameters.
|
|
66
68
|
* Stripe error type: "idempotency_error"
|
|
67
69
|
*/
|
|
68
|
-
export class IdempotencyError
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
export class IdempotencyError
|
|
71
|
+
extends /*@__PURE__*/ Schema.TaggedError<IdempotencyError>()("IdempotencyError", {
|
|
72
|
+
message: /*@__PURE__*/ Schema.optional(Schema.String),
|
|
73
|
+
code: /*@__PURE__*/ Schema.optional(Schema.String),
|
|
74
|
+
doc_url: /*@__PURE__*/ Schema.optional(Schema.String),
|
|
75
|
+
request_log_url: /*@__PURE__*/ Schema.optional(Schema.String),
|
|
76
|
+
}).pipe(Category.withConflictError) {}
|
|
74
77
|
|
|
75
78
|
/**
|
|
76
|
-
* Invalid request error
|
|
79
|
+
* Invalid request error -- returned when the request has invalid parameters.
|
|
77
80
|
* Stripe error type: "invalid_request_error"
|
|
78
81
|
*/
|
|
79
|
-
export class InvalidRequestError
|
|
80
|
-
"InvalidRequestError",
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
},
|
|
88
|
-
).pipe(Category.withBadRequestError) {}
|
|
82
|
+
export class InvalidRequestError
|
|
83
|
+
extends /*@__PURE__*/ Schema.TaggedError<InvalidRequestError>()("InvalidRequestError", {
|
|
84
|
+
message: /*@__PURE__*/ Schema.optional(Schema.String),
|
|
85
|
+
code: /*@__PURE__*/ Schema.optional(Schema.String),
|
|
86
|
+
param: /*@__PURE__*/ Schema.optional(Schema.String),
|
|
87
|
+
doc_url: /*@__PURE__*/ Schema.optional(Schema.String),
|
|
88
|
+
request_log_url: /*@__PURE__*/ Schema.optional(Schema.String),
|
|
89
|
+
}).pipe(Category.withBadRequestError) {}
|
|
89
90
|
|
|
90
91
|
/**
|
|
91
|
-
* API error
|
|
92
|
+
* API error -- returned when something goes wrong on Stripe's end (HTTP 500+).
|
|
92
93
|
* Stripe error type: "api_error"
|
|
93
94
|
*/
|
|
94
|
-
export class ApiError
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
95
|
+
export class ApiError
|
|
96
|
+
extends /*@__PURE__*/ Schema.TaggedError<ApiError>()("ApiError", {
|
|
97
|
+
message: /*@__PURE__*/ Schema.optional(Schema.String),
|
|
98
|
+
code: /*@__PURE__*/ Schema.optional(Schema.String),
|
|
99
|
+
param: /*@__PURE__*/ Schema.optional(Schema.String),
|
|
100
|
+
doc_url: /*@__PURE__*/ Schema.optional(Schema.String),
|
|
101
|
+
request_log_url: /*@__PURE__*/ Schema.optional(Schema.String),
|
|
102
|
+
}).pipe(Category.withServerError, /*@__PURE__*/ Category.withRetryable()) {}
|
|
101
103
|
|
|
102
104
|
/**
|
|
103
|
-
* External dependency failed
|
|
105
|
+
* External dependency failed -- returned when an external dependency fails (HTTP 424).
|
|
104
106
|
*/
|
|
105
|
-
export class ExternalDependencyFailed
|
|
106
|
-
"ExternalDependencyFailed",
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
},
|
|
112
|
-
).pipe(Category.withServerError, Category.withRetryable()) {}
|
|
107
|
+
export class ExternalDependencyFailed
|
|
108
|
+
extends /*@__PURE__*/ Schema.TaggedError<ExternalDependencyFailed>()("ExternalDependencyFailed", {
|
|
109
|
+
message: /*@__PURE__*/ Schema.optional(Schema.String),
|
|
110
|
+
code: /*@__PURE__*/ Schema.optional(Schema.String),
|
|
111
|
+
doc_url: /*@__PURE__*/ Schema.optional(Schema.String),
|
|
112
|
+
}).pipe(Category.withServerError, /*@__PURE__*/ Category.withRetryable()) {}
|
|
113
113
|
|
|
114
114
|
/**
|
|
115
115
|
* Stripe HTTP status code to error class mapping.
|
|
@@ -120,23 +120,22 @@ export const STRIPE_HTTP_STATUS_MAP = {
|
|
|
120
120
|
424: ExternalDependencyFailed,
|
|
121
121
|
} as const;
|
|
122
122
|
|
|
123
|
-
// Unknown Stripe error
|
|
124
|
-
export class UnknownStripeError
|
|
125
|
-
"UnknownStripeError",
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
param: Schema.optional(Schema.String),
|
|
123
|
+
// Unknown Stripe error -- returned when an error type is not recognized
|
|
124
|
+
export class UnknownStripeError
|
|
125
|
+
extends /*@__PURE__*/ Schema.TaggedError<UnknownStripeError>()("UnknownStripeError", {
|
|
126
|
+
type: /*@__PURE__*/ Schema.optional(Schema.String),
|
|
127
|
+
code: /*@__PURE__*/ Schema.optional(Schema.String),
|
|
128
|
+
message: /*@__PURE__*/ Schema.optional(Schema.String),
|
|
129
|
+
param: /*@__PURE__*/ Schema.optional(Schema.String),
|
|
131
130
|
body: Schema.Unknown,
|
|
132
|
-
}
|
|
133
|
-
).pipe(Category.withServerError) {}
|
|
131
|
+
}).pipe(Category.withServerError) {}
|
|
134
132
|
|
|
135
133
|
// Schema parse error wrapper
|
|
136
|
-
export class StripeParseError
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
134
|
+
export class StripeParseError
|
|
135
|
+
extends /*@__PURE__*/ Schema.TaggedError<StripeParseError>()("StripeParseError", {
|
|
136
|
+
body: Schema.Unknown,
|
|
137
|
+
cause: Schema.Unknown,
|
|
138
|
+
}).pipe(Category.withParseError) {}
|
|
140
139
|
|
|
141
140
|
/**
|
|
142
141
|
* Stripe webhook signature verification failed.
|
|
@@ -144,21 +143,23 @@ export class StripeParseError extends Schema.TaggedError<StripeParseError>()("St
|
|
|
144
143
|
* This is raised by the local webhook helpers when the Stripe-Signature header
|
|
145
144
|
* is missing, malformed, expired, or does not match the raw request payload.
|
|
146
145
|
*/
|
|
147
|
-
export class StripeWebhookSignatureError
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
146
|
+
export class StripeWebhookSignatureError
|
|
147
|
+
extends /*@__PURE__*/ Schema.TaggedError<StripeWebhookSignatureError>()(
|
|
148
|
+
"StripeWebhookSignatureError",
|
|
149
|
+
{
|
|
150
|
+
message: Schema.String,
|
|
151
|
+
cause: /*@__PURE__*/ Schema.optional(Schema.Unknown),
|
|
152
|
+
},
|
|
153
|
+
).pipe(Category.withAuthError) {}
|
|
154
154
|
|
|
155
155
|
/**
|
|
156
156
|
* Stripe webhook payload JSON parsing failed after signature verification.
|
|
157
157
|
*/
|
|
158
|
-
export class StripeWebhookPayloadParseError
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
158
|
+
export class StripeWebhookPayloadParseError
|
|
159
|
+
extends /*@__PURE__*/ Schema.TaggedError<StripeWebhookPayloadParseError>()(
|
|
160
|
+
"StripeWebhookPayloadParseError",
|
|
161
|
+
{
|
|
162
|
+
message: Schema.String,
|
|
163
|
+
cause: /*@__PURE__*/ Schema.optional(Schema.Unknown),
|
|
164
|
+
},
|
|
165
|
+
).pipe(Category.withParseError) {}
|
package/src/index.ts
CHANGED
package/src/pagination.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
|
*
|