@amos.com/node 0.1.36 → 0.1.39
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/README.md +15 -15
- package/dist/index.d.mts +11 -13
- package/dist/index.d.ts +11 -13
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -2
- package/src/index.ts +10 -12
package/README.md
CHANGED
|
@@ -15,15 +15,15 @@ npm install @amos.com/node
|
|
|
15
15
|
```ts
|
|
16
16
|
import {
|
|
17
17
|
createPayApiClient,
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
AMOS_API_BASE_URL_PRODUCTION,
|
|
19
|
+
AMOS_API_VERSION,
|
|
20
20
|
} from "@amos.com/node";
|
|
21
21
|
|
|
22
22
|
const pay = createPayApiClient({
|
|
23
|
-
baseUrl:
|
|
23
|
+
baseUrl: AMOS_API_BASE_URL_PRODUCTION,
|
|
24
24
|
headers: {
|
|
25
25
|
"X-Api-Key": process.env.AMOS_API_KEY!,
|
|
26
|
-
"X-Api-Version":
|
|
26
|
+
"X-Api-Version": AMOS_API_VERSION,
|
|
27
27
|
},
|
|
28
28
|
});
|
|
29
29
|
|
|
@@ -45,15 +45,15 @@ Swap the base URL constant:
|
|
|
45
45
|
```ts
|
|
46
46
|
import {
|
|
47
47
|
createPayApiClient,
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
AMOS_API_BASE_URL_SANDBOX,
|
|
49
|
+
AMOS_API_VERSION,
|
|
50
50
|
} from "@amos.com/node";
|
|
51
51
|
|
|
52
52
|
const pay = createPayApiClient({
|
|
53
|
-
baseUrl:
|
|
53
|
+
baseUrl: AMOS_API_BASE_URL_SANDBOX,
|
|
54
54
|
headers: {
|
|
55
55
|
"X-Api-Key": process.env.AMOS_API_KEY!,
|
|
56
|
-
"X-Api-Version":
|
|
56
|
+
"X-Api-Version": AMOS_API_VERSION,
|
|
57
57
|
},
|
|
58
58
|
});
|
|
59
59
|
```
|
|
@@ -68,7 +68,7 @@ const pay = createPayApiClient({
|
|
|
68
68
|
fetch: customFetchImpl,
|
|
69
69
|
headers: {
|
|
70
70
|
"X-Api-Key": process.env.AMOS_API_KEY!,
|
|
71
|
-
"X-Api-Version":
|
|
71
|
+
"X-Api-Version": AMOS_API_VERSION,
|
|
72
72
|
"X-Trace-Id": "abc123",
|
|
73
73
|
},
|
|
74
74
|
});
|
|
@@ -96,16 +96,16 @@ pay.use(idempotencyKey);
|
|
|
96
96
|
```ts
|
|
97
97
|
import {
|
|
98
98
|
createPayApiClient,
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
AMOS_API_BASE_URL_PRODUCTION,
|
|
100
|
+
AMOS_API_BASE_URL_SANDBOX,
|
|
101
|
+
AMOS_API_VERSION,
|
|
102
102
|
} from "@amos.com/node";
|
|
103
103
|
import type { PayApiClient, ClientOptions, Middleware } from "@amos.com/node";
|
|
104
104
|
```
|
|
105
105
|
|
|
106
106
|
- `createPayApiClient(options)` — returns a typed [`openapi-fetch`](https://openapi-ts.dev/openapi-fetch) client. Exposes the full `openapi-fetch` interface: `GET`, `POST`, `PUT`, `DELETE`, `OPTIONS`, `HEAD`, `PATCH`, `TRACE`, `use`, `eject`.
|
|
107
|
-
- `
|
|
108
|
-
- `
|
|
107
|
+
- `AMOS_API_BASE_URL_PRODUCTION` / `AMOS_API_BASE_URL_SANDBOX` — base URLs for the two environments.
|
|
108
|
+
- `AMOS_API_VERSION` — the wire-level `X-Api-Version` this build targets. Pass it as the `X-Api-Version` header on every request (most easily as a default in `headers`, as shown above).
|
|
109
109
|
- `PayApiClient` — the type returned by `createPayApiClient`.
|
|
110
110
|
- `ClientOptions`, `Middleware` — re-exported from `openapi-fetch` for convenience.
|
|
111
111
|
|
|
@@ -128,7 +128,7 @@ We follow **SemVer** for the npm package, with one extra rule: **the major versi
|
|
|
128
128
|
| `@amos.com/node@1.x` | `1` |
|
|
129
129
|
| `@amos.com/node@2.x` | `2` (hypothetical) |
|
|
130
130
|
|
|
131
|
-
So bumping `
|
|
131
|
+
So bumping `AMOS_API_VERSION` is always a major release, and consumers who pin to `@amos.com/node@^1` know they will never be transparently upgraded onto a new wire contract.
|
|
132
132
|
|
|
133
133
|
The mental rule for bumps: _"would a program that typechecked against the previous `dist/index.d.ts` still typecheck against the new one?"_ If no, it's a major.
|
|
134
134
|
|
package/dist/index.d.mts
CHANGED
|
@@ -5256,9 +5256,9 @@ declare const refundAllowed_reverse_actionValues: ReadonlyArray<FlattenedDeepReq
|
|
|
5256
5256
|
declare const setupIntentStateValues: ReadonlyArray<FlattenedDeepRequired<components>["schemas"]["SetupIntent"]["state"]>;
|
|
5257
5257
|
declare const subscriptionStateValues: ReadonlyArray<FlattenedDeepRequired<components>["schemas"]["Subscription"]["state"]>;
|
|
5258
5258
|
|
|
5259
|
-
declare const
|
|
5260
|
-
declare const
|
|
5261
|
-
declare const
|
|
5259
|
+
declare const AMOS_API_BASE_URL_PRODUCTION = "https://api.amos.com";
|
|
5260
|
+
declare const AMOS_API_BASE_URL_SANDBOX = "https://api-sandbox.amos.com";
|
|
5261
|
+
declare const AMOS_API_VERSION = "1";
|
|
5262
5262
|
/**
|
|
5263
5263
|
* Create a typed `openapi-fetch` client for the Amos Pay API.
|
|
5264
5264
|
*
|
|
@@ -5266,29 +5266,27 @@ declare const PAY_API_VERSION = "1";
|
|
|
5266
5266
|
* fully typed against the OpenAPI spec — paths, path/query/header params,
|
|
5267
5267
|
* request bodies, and response bodies are all checked at compile time.
|
|
5268
5268
|
*
|
|
5269
|
-
* Provide credentials and the required `X-Api-Version` header
|
|
5270
|
-
*
|
|
5271
|
-
*
|
|
5272
|
-
* idempotency keys.
|
|
5269
|
+
* Provide credentials and the required `X-Api-Version` header as default
|
|
5270
|
+
* `headers` here. Use `client.use(middleware)` to add per-request behavior
|
|
5271
|
+
* such as fresh idempotency keys.
|
|
5273
5272
|
*
|
|
5274
5273
|
* @example
|
|
5275
5274
|
* ```ts
|
|
5276
5275
|
* import {
|
|
5277
5276
|
* createPayApiClient,
|
|
5278
|
-
*
|
|
5279
|
-
*
|
|
5277
|
+
* AMOS_API_BASE_URL_SANDBOX,
|
|
5278
|
+
* AMOS_API_VERSION,
|
|
5280
5279
|
* } from "@amos.com/node";
|
|
5281
5280
|
*
|
|
5282
5281
|
* const pay = createPayApiClient({
|
|
5283
|
-
* baseUrl:
|
|
5282
|
+
* baseUrl: AMOS_API_BASE_URL_SANDBOX,
|
|
5284
5283
|
* headers: {
|
|
5285
5284
|
* "X-Api-Key": process.env.AMOS_API_KEY!,
|
|
5286
|
-
* "X-Api-Version":
|
|
5285
|
+
* "X-Api-Version": AMOS_API_VERSION,
|
|
5287
5286
|
* },
|
|
5288
5287
|
* });
|
|
5289
5288
|
*
|
|
5290
5289
|
* const { data, error } = await pay.POST("/customers", {
|
|
5291
|
-
* params: { header: { "X-Api-Version": PAY_API_VERSION } },
|
|
5292
5290
|
* body: { customer: { email: "alex@example.com" } },
|
|
5293
5291
|
* });
|
|
5294
5292
|
* ```
|
|
@@ -5297,4 +5295,4 @@ declare function createPayApiClient(options: ClientOptions): openapi_fetch.Clien
|
|
|
5297
5295
|
/** A configured Amos Pay API client returned by {@link createPayApiClient}. */
|
|
5298
5296
|
type PayApiClient = ReturnType<typeof createPayApiClient>;
|
|
5299
5297
|
|
|
5300
|
-
export { type $defs,
|
|
5298
|
+
export { type $defs, AMOS_API_BASE_URL_PRODUCTION, AMOS_API_BASE_URL_SANDBOX, AMOS_API_VERSION, type PayApiClient, achVerificationTypeValues, allowedApplePayPaymentMethodInputTypeValues, allowedApplePayPaymentMethodTypeValues, allowedBankAccountPaymentMethodInputTypeValues, allowedBankAccountPaymentMethodTypeValues, allowedCardPaymentMethodInputTypeValues, allowedCardPaymentMethodTypeValues, allowedGooglePayPaymentMethodInputTypeValues, allowedGooglePayPaymentMethodTypeValues, bankAccountProfileFailure_reasonValues, cardProfileFailure_reasonValues, chargeAllowed_reverse_actionValues, chargeStateValues, type components, createPayApiClient, embedConfirmApplePayPaymentMethodInputTypeValues, embedConfirmBankAccountPaymentMethodInputTypeValues, embedConfirmCardPaymentMethodInputTypeValues, embedConfirmGooglePayPaymentMethodInputTypeValues, externalAccountTypeValues, internationalBillingAddressOptionsModeValues, legalEntityDocumentTypeValues, legalEntityEntityTypeValues, legalEntityOwnershipTypeValues, merchantBusinessCategoryTypeValues, type operations, type paths, pathsEmbedPayment_intentsIdGetParametersQueryPayment_method_typeValues, paymentIntentCaptureMethodTypeValues, paymentIntentStateValues, paymentLinkAmountTypeValues, paymentMethodTypeValues, payoutDirectionTypeValues, payoutStateTypeValues, processorTransactionPayment_transaction_typeValues, processorTransactionTransaction_typeValues, refundAllowed_reverse_actionValues, refundStateTypeValues, setupIntentStateValues, subscriptionIntervalTypeValues, subscriptionPlanTypeValues, subscriptionStateValues, transactionSourceTypeValues, usOnlyBillingAddressOptionsModeValues, usStateTypeValues, walletProviderTypeValues, webhookEventTypeValues, type webhooks };
|
package/dist/index.d.ts
CHANGED
|
@@ -5256,9 +5256,9 @@ declare const refundAllowed_reverse_actionValues: ReadonlyArray<FlattenedDeepReq
|
|
|
5256
5256
|
declare const setupIntentStateValues: ReadonlyArray<FlattenedDeepRequired<components>["schemas"]["SetupIntent"]["state"]>;
|
|
5257
5257
|
declare const subscriptionStateValues: ReadonlyArray<FlattenedDeepRequired<components>["schemas"]["Subscription"]["state"]>;
|
|
5258
5258
|
|
|
5259
|
-
declare const
|
|
5260
|
-
declare const
|
|
5261
|
-
declare const
|
|
5259
|
+
declare const AMOS_API_BASE_URL_PRODUCTION = "https://api.amos.com";
|
|
5260
|
+
declare const AMOS_API_BASE_URL_SANDBOX = "https://api-sandbox.amos.com";
|
|
5261
|
+
declare const AMOS_API_VERSION = "1";
|
|
5262
5262
|
/**
|
|
5263
5263
|
* Create a typed `openapi-fetch` client for the Amos Pay API.
|
|
5264
5264
|
*
|
|
@@ -5266,29 +5266,27 @@ declare const PAY_API_VERSION = "1";
|
|
|
5266
5266
|
* fully typed against the OpenAPI spec — paths, path/query/header params,
|
|
5267
5267
|
* request bodies, and response bodies are all checked at compile time.
|
|
5268
5268
|
*
|
|
5269
|
-
* Provide credentials and the required `X-Api-Version` header
|
|
5270
|
-
*
|
|
5271
|
-
*
|
|
5272
|
-
* idempotency keys.
|
|
5269
|
+
* Provide credentials and the required `X-Api-Version` header as default
|
|
5270
|
+
* `headers` here. Use `client.use(middleware)` to add per-request behavior
|
|
5271
|
+
* such as fresh idempotency keys.
|
|
5273
5272
|
*
|
|
5274
5273
|
* @example
|
|
5275
5274
|
* ```ts
|
|
5276
5275
|
* import {
|
|
5277
5276
|
* createPayApiClient,
|
|
5278
|
-
*
|
|
5279
|
-
*
|
|
5277
|
+
* AMOS_API_BASE_URL_SANDBOX,
|
|
5278
|
+
* AMOS_API_VERSION,
|
|
5280
5279
|
* } from "@amos.com/node";
|
|
5281
5280
|
*
|
|
5282
5281
|
* const pay = createPayApiClient({
|
|
5283
|
-
* baseUrl:
|
|
5282
|
+
* baseUrl: AMOS_API_BASE_URL_SANDBOX,
|
|
5284
5283
|
* headers: {
|
|
5285
5284
|
* "X-Api-Key": process.env.AMOS_API_KEY!,
|
|
5286
|
-
* "X-Api-Version":
|
|
5285
|
+
* "X-Api-Version": AMOS_API_VERSION,
|
|
5287
5286
|
* },
|
|
5288
5287
|
* });
|
|
5289
5288
|
*
|
|
5290
5289
|
* const { data, error } = await pay.POST("/customers", {
|
|
5291
|
-
* params: { header: { "X-Api-Version": PAY_API_VERSION } },
|
|
5292
5290
|
* body: { customer: { email: "alex@example.com" } },
|
|
5293
5291
|
* });
|
|
5294
5292
|
* ```
|
|
@@ -5297,4 +5295,4 @@ declare function createPayApiClient(options: ClientOptions): openapi_fetch.Clien
|
|
|
5297
5295
|
/** A configured Amos Pay API client returned by {@link createPayApiClient}. */
|
|
5298
5296
|
type PayApiClient = ReturnType<typeof createPayApiClient>;
|
|
5299
5297
|
|
|
5300
|
-
export { type $defs,
|
|
5298
|
+
export { type $defs, AMOS_API_BASE_URL_PRODUCTION, AMOS_API_BASE_URL_SANDBOX, AMOS_API_VERSION, type PayApiClient, achVerificationTypeValues, allowedApplePayPaymentMethodInputTypeValues, allowedApplePayPaymentMethodTypeValues, allowedBankAccountPaymentMethodInputTypeValues, allowedBankAccountPaymentMethodTypeValues, allowedCardPaymentMethodInputTypeValues, allowedCardPaymentMethodTypeValues, allowedGooglePayPaymentMethodInputTypeValues, allowedGooglePayPaymentMethodTypeValues, bankAccountProfileFailure_reasonValues, cardProfileFailure_reasonValues, chargeAllowed_reverse_actionValues, chargeStateValues, type components, createPayApiClient, embedConfirmApplePayPaymentMethodInputTypeValues, embedConfirmBankAccountPaymentMethodInputTypeValues, embedConfirmCardPaymentMethodInputTypeValues, embedConfirmGooglePayPaymentMethodInputTypeValues, externalAccountTypeValues, internationalBillingAddressOptionsModeValues, legalEntityDocumentTypeValues, legalEntityEntityTypeValues, legalEntityOwnershipTypeValues, merchantBusinessCategoryTypeValues, type operations, type paths, pathsEmbedPayment_intentsIdGetParametersQueryPayment_method_typeValues, paymentIntentCaptureMethodTypeValues, paymentIntentStateValues, paymentLinkAmountTypeValues, paymentMethodTypeValues, payoutDirectionTypeValues, payoutStateTypeValues, processorTransactionPayment_transaction_typeValues, processorTransactionTransaction_typeValues, refundAllowed_reverse_actionValues, refundStateTypeValues, setupIntentStateValues, subscriptionIntervalTypeValues, subscriptionPlanTypeValues, subscriptionStateValues, transactionSourceTypeValues, usOnlyBillingAddressOptionsModeValues, usStateTypeValues, walletProviderTypeValues, webhookEventTypeValues, type webhooks };
|
package/dist/index.js
CHANGED
|
@@ -30,9 +30,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
AMOS_API_BASE_URL_PRODUCTION: () => AMOS_API_BASE_URL_PRODUCTION,
|
|
34
|
+
AMOS_API_BASE_URL_SANDBOX: () => AMOS_API_BASE_URL_SANDBOX,
|
|
35
|
+
AMOS_API_VERSION: () => AMOS_API_VERSION,
|
|
36
36
|
achVerificationTypeValues: () => achVerificationTypeValues,
|
|
37
37
|
allowedApplePayPaymentMethodInputTypeValues: () => allowedApplePayPaymentMethodInputTypeValues,
|
|
38
38
|
allowedApplePayPaymentMethodTypeValues: () => allowedApplePayPaymentMethodTypeValues,
|
|
@@ -127,17 +127,17 @@ var setupIntentStateValues = ["requires_payment_method", "requires_confirmation"
|
|
|
127
127
|
var subscriptionStateValues = ["active", "paused", "past_due", "cancelled"];
|
|
128
128
|
|
|
129
129
|
// src/index.ts
|
|
130
|
-
var
|
|
131
|
-
var
|
|
132
|
-
var
|
|
130
|
+
var AMOS_API_BASE_URL_PRODUCTION = "https://api.amos.com";
|
|
131
|
+
var AMOS_API_BASE_URL_SANDBOX = "https://api-sandbox.amos.com";
|
|
132
|
+
var AMOS_API_VERSION = "1";
|
|
133
133
|
function createPayApiClient(options) {
|
|
134
134
|
return (0, import_openapi_fetch.default)(options);
|
|
135
135
|
}
|
|
136
136
|
// Annotate the CommonJS export names for ESM import in node:
|
|
137
137
|
0 && (module.exports = {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
138
|
+
AMOS_API_BASE_URL_PRODUCTION,
|
|
139
|
+
AMOS_API_BASE_URL_SANDBOX,
|
|
140
|
+
AMOS_API_VERSION,
|
|
141
141
|
achVerificationTypeValues,
|
|
142
142
|
allowedApplePayPaymentMethodInputTypeValues,
|
|
143
143
|
allowedApplePayPaymentMethodTypeValues,
|