@amos.com/node 0.1.0 → 0.1.2

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/dist/index.js ADDED
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ PAY_API_BASE_URL_PRODUCTION: () => PAY_API_BASE_URL_PRODUCTION,
34
+ PAY_API_BASE_URL_SANDBOX: () => PAY_API_BASE_URL_SANDBOX,
35
+ PAY_API_VERSION: () => PAY_API_VERSION,
36
+ createPayApiClient: () => createPayApiClient
37
+ });
38
+ module.exports = __toCommonJS(index_exports);
39
+ var import_openapi_fetch = __toESM(require("openapi-fetch"));
40
+ var PAY_API_BASE_URL_PRODUCTION = "https://pay.subfi.com";
41
+ var PAY_API_BASE_URL_SANDBOX = "https://pay-sandbox.subfi.com";
42
+ var PAY_API_VERSION = "1";
43
+ function createPayApiClient(options) {
44
+ return (0, import_openapi_fetch.default)(options);
45
+ }
46
+ // Annotate the CommonJS export names for ESM import in node:
47
+ 0 && (module.exports = {
48
+ PAY_API_BASE_URL_PRODUCTION,
49
+ PAY_API_BASE_URL_SANDBOX,
50
+ PAY_API_VERSION,
51
+ createPayApiClient
52
+ });
53
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import createClient, {\n type ClientOptions,\n type Middleware,\n} from \"openapi-fetch\";\nimport type { paths } from \"../openapi/schema\";\n\nexport * from \"../openapi/schema\";\n\nexport const PAY_API_BASE_URL_PRODUCTION = \"https://pay.subfi.com\";\nexport const PAY_API_BASE_URL_SANDBOX = \"https://pay-sandbox.subfi.com\";\nexport const PAY_API_VERSION = \"1\";\n\n/**\n * Create a typed `openapi-fetch` client for the SubFi Pay API.\n *\n * The returned client exposes `GET`, `POST`, `PUT`, `DELETE`, etc., each\n * fully typed against the OpenAPI spec — paths, path/query/header params,\n * request bodies, and response bodies are all checked at compile time.\n *\n * Provide credentials and the required `X-Api-Version` header either as\n * default `headers` here or via `params.header` on each call. Use\n * `client.use(middleware)` to add per-request behavior such as fresh\n * idempotency keys.\n *\n * @example\n * ```ts\n * import {\n * createPayApiClient,\n * PAY_API_BASE_URL_SANDBOX,\n * PAY_API_VERSION,\n * } from \"@subfico/pay-js-sdk/api\";\n *\n * const pay = createPayApiClient({\n * baseUrl: PAY_API_BASE_URL_SANDBOX,\n * headers: {\n * \"X-Api-Key\": process.env.SUBFI_API_KEY!,\n * \"X-Api-Version\": PAY_API_VERSION,\n * },\n * });\n *\n * const { data, error } = await pay.POST(\"/customers\", {\n * params: { header: { \"X-Api-Version\": PAY_API_VERSION } },\n * body: { customer: { email: \"alex@example.com\" } },\n * });\n * ```\n */\nexport function createPayApiClient(options: ClientOptions) {\n return createClient<paths>(options);\n}\n\n/** A configured SubFi Pay API client returned by {@link createPayApiClient}. */\nexport type PayApiClient = ReturnType<typeof createPayApiClient>;\n\nexport type { ClientOptions, Middleware };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAGO;AAKA,IAAM,8BAA8B;AACpC,IAAM,2BAA2B;AACjC,IAAM,kBAAkB;AAoCxB,SAAS,mBAAmB,SAAwB;AACzD,aAAO,qBAAAA,SAAoB,OAAO;AACpC;","names":["createClient"]}
package/dist/index.mjs ADDED
@@ -0,0 +1,15 @@
1
+ // src/index.ts
2
+ import createClient from "openapi-fetch";
3
+ var PAY_API_BASE_URL_PRODUCTION = "https://pay.subfi.com";
4
+ var PAY_API_BASE_URL_SANDBOX = "https://pay-sandbox.subfi.com";
5
+ var PAY_API_VERSION = "1";
6
+ function createPayApiClient(options) {
7
+ return createClient(options);
8
+ }
9
+ export {
10
+ PAY_API_BASE_URL_PRODUCTION,
11
+ PAY_API_BASE_URL_SANDBOX,
12
+ PAY_API_VERSION,
13
+ createPayApiClient
14
+ };
15
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import createClient, {\n type ClientOptions,\n type Middleware,\n} from \"openapi-fetch\";\nimport type { paths } from \"../openapi/schema\";\n\nexport * from \"../openapi/schema\";\n\nexport const PAY_API_BASE_URL_PRODUCTION = \"https://pay.subfi.com\";\nexport const PAY_API_BASE_URL_SANDBOX = \"https://pay-sandbox.subfi.com\";\nexport const PAY_API_VERSION = \"1\";\n\n/**\n * Create a typed `openapi-fetch` client for the SubFi Pay API.\n *\n * The returned client exposes `GET`, `POST`, `PUT`, `DELETE`, etc., each\n * fully typed against the OpenAPI spec — paths, path/query/header params,\n * request bodies, and response bodies are all checked at compile time.\n *\n * Provide credentials and the required `X-Api-Version` header either as\n * default `headers` here or via `params.header` on each call. Use\n * `client.use(middleware)` to add per-request behavior such as fresh\n * idempotency keys.\n *\n * @example\n * ```ts\n * import {\n * createPayApiClient,\n * PAY_API_BASE_URL_SANDBOX,\n * PAY_API_VERSION,\n * } from \"@subfico/pay-js-sdk/api\";\n *\n * const pay = createPayApiClient({\n * baseUrl: PAY_API_BASE_URL_SANDBOX,\n * headers: {\n * \"X-Api-Key\": process.env.SUBFI_API_KEY!,\n * \"X-Api-Version\": PAY_API_VERSION,\n * },\n * });\n *\n * const { data, error } = await pay.POST(\"/customers\", {\n * params: { header: { \"X-Api-Version\": PAY_API_VERSION } },\n * body: { customer: { email: \"alex@example.com\" } },\n * });\n * ```\n */\nexport function createPayApiClient(options: ClientOptions) {\n return createClient<paths>(options);\n}\n\n/** A configured SubFi Pay API client returned by {@link createPayApiClient}. */\nexport type PayApiClient = ReturnType<typeof createPayApiClient>;\n\nexport type { ClientOptions, Middleware };\n"],"mappings":";AAAA,OAAO,kBAGA;AAKA,IAAM,8BAA8B;AACpC,IAAM,2BAA2B;AACjC,IAAM,kBAAkB;AAoCxB,SAAS,mBAAmB,SAAwB;AACzD,SAAO,aAAoB,OAAO;AACpC;","names":[]}
package/openapi/schema.ts CHANGED
@@ -65,7 +65,8 @@ export interface paths {
65
65
  };
66
66
  /** Retrieve a charge */
67
67
  get: operations["GetCharge"];
68
- put?: never;
68
+ /** Update a charge */
69
+ put: operations["UpdateCharge"];
69
70
  post?: never;
70
71
  delete?: never;
71
72
  options?: never;
@@ -521,6 +522,24 @@ export interface paths {
521
522
  patch?: never;
522
523
  trace?: never;
523
524
  };
525
+ "/payment_links": {
526
+ parameters: {
527
+ query?: never;
528
+ header?: never;
529
+ path?: never;
530
+ cookie?: never;
531
+ };
532
+ /** List payment links */
533
+ get: operations["ListPaymentLinks"];
534
+ put?: never;
535
+ /** Create a new payment link */
536
+ post: operations["CreatePaymentLink"];
537
+ delete?: never;
538
+ options?: never;
539
+ head?: never;
540
+ patch?: never;
541
+ trace?: never;
542
+ };
524
543
  "/payment_intents/{id}": {
525
544
  parameters: {
526
545
  query?: never;
@@ -737,7 +756,8 @@ export interface paths {
737
756
  };
738
757
  /** Retrieve a refund by ID */
739
758
  get: operations["GetRefund"];
740
- put?: never;
759
+ /** Update a refund */
760
+ put: operations["UpdateRefund"];
741
761
  post?: never;
742
762
  delete?: never;
743
763
  options?: never;
@@ -979,7 +999,8 @@ export interface paths {
979
999
  };
980
1000
  /** Retrieve a void by ID */
981
1001
  get: operations["GetVoid"];
982
- put?: never;
1002
+ /** Update a void */
1003
+ put: operations["UpdateVoid"];
983
1004
  post?: never;
984
1005
  delete?: never;
985
1006
  options?: never;
@@ -1075,6 +1096,23 @@ export interface paths {
1075
1096
  patch?: never;
1076
1097
  trace?: never;
1077
1098
  };
1099
+ "/webhook_requests/{id}": {
1100
+ parameters: {
1101
+ query?: never;
1102
+ header?: never;
1103
+ path?: never;
1104
+ cookie?: never;
1105
+ };
1106
+ /** Get webhook request by ID */
1107
+ get: operations["RetrieveWebhookRequest"];
1108
+ put?: never;
1109
+ post?: never;
1110
+ delete?: never;
1111
+ options?: never;
1112
+ head?: never;
1113
+ patch?: never;
1114
+ trace?: never;
1115
+ };
1078
1116
  }
1079
1117
  export type webhooks = Record<string, never>;
1080
1118
  export interface components {
@@ -1667,6 +1705,59 @@ export interface components {
1667
1705
  /** Format: date-time */
1668
1706
  updated_at?: string;
1669
1707
  };
1708
+ CreatePaymentLinkInput: {
1709
+ slug?: string;
1710
+ active?: boolean;
1711
+ /** @enum {string} */
1712
+ amount_type?: "fixed" | "open";
1713
+ amount?: number;
1714
+ /** Format: uri */
1715
+ image_url?: string;
1716
+ minimum_amount?: number;
1717
+ maximum_amount?: number;
1718
+ suggested_amounts?: number[];
1719
+ currency?: string;
1720
+ description?: string | null;
1721
+ statement_descriptor?: string;
1722
+ /** Format: uri */
1723
+ success_url?: string;
1724
+ title?: string;
1725
+ /** Format: uri */
1726
+ cancel_url?: string;
1727
+ allowed_payment_method_types?: string[];
1728
+ metadata?: components["schemas"]["Metadata"];
1729
+ };
1730
+ CreatePaymentLinkRequest: {
1731
+ payment_link: components["schemas"]["CreatePaymentLinkInput"];
1732
+ };
1733
+ PaymentLink: {
1734
+ /** Format: uuid */
1735
+ id?: string;
1736
+ /** Format: uuid */
1737
+ organization_id?: string;
1738
+ /** Format: uuid */
1739
+ account_id?: string;
1740
+ slug?: string;
1741
+ active?: boolean;
1742
+ /** @enum {string} */
1743
+ amount_type?: "fixed" | "open";
1744
+ amount?: number;
1745
+ /** Format: uri */
1746
+ image_url?: string;
1747
+ minimum_amount?: number;
1748
+ maximum_amount?: number;
1749
+ suggested_amounts?: number[];
1750
+ currency?: string;
1751
+ description?: string | null;
1752
+ statement_descriptor?: string;
1753
+ /** Format: uri */
1754
+ success_url?: string;
1755
+ title?: string;
1756
+ /** Format: uri */
1757
+ cancel_url?: string;
1758
+ allowed_payment_method_types?: string[];
1759
+ metadata?: components["schemas"]["Metadata"];
1760
+ };
1670
1761
  PaymentMethod: {
1671
1762
  /** Format: uuid */
1672
1763
  id?: string;
@@ -1793,6 +1884,13 @@ export interface components {
1793
1884
  CreateRefundRequest: {
1794
1885
  refund: components["schemas"]["CreateRefundInput"];
1795
1886
  };
1887
+ UpdateRefundInput: {
1888
+ description?: string;
1889
+ metadata?: components["schemas"]["Metadata"];
1890
+ };
1891
+ UpdateRefundRequest: {
1892
+ refund: components["schemas"]["UpdateRefundInput"];
1893
+ };
1796
1894
  Refund: {
1797
1895
  /** Format: uuid */
1798
1896
  id?: string;
@@ -1949,6 +2047,13 @@ export interface components {
1949
2047
  CreateSubscriptionPlanRequest: {
1950
2048
  subscription_plan: components["schemas"]["CreateSubscriptionPlanInput"];
1951
2049
  };
2050
+ UpdateChargeInput: {
2051
+ description?: string;
2052
+ metadata?: components["schemas"]["Metadata"];
2053
+ };
2054
+ UpdateChargeRequest: {
2055
+ charge: components["schemas"]["UpdateChargeInput"];
2056
+ };
1952
2057
  SubscriptionPlan: {
1953
2058
  /** Format: uuid */
1954
2059
  id?: string;
@@ -1984,6 +2089,13 @@ export interface components {
1984
2089
  CreateVoidRequest: {
1985
2090
  void: components["schemas"]["CreateVoidInput"];
1986
2091
  };
2092
+ UpdateVoidInput: {
2093
+ description?: string;
2094
+ metadata?: components["schemas"]["Metadata"];
2095
+ };
2096
+ UpdateVoidRequest: {
2097
+ void: components["schemas"]["UpdateVoidInput"];
2098
+ };
1987
2099
  Void: {
1988
2100
  /** Format: uuid */
1989
2101
  id?: string;
@@ -2242,6 +2354,35 @@ export interface operations {
2242
2354
  };
2243
2355
  };
2244
2356
  };
2357
+ UpdateCharge: {
2358
+ parameters: {
2359
+ query?: never;
2360
+ header: {
2361
+ "X-Api-Version": components["parameters"]["XApiVersionHeader"];
2362
+ "X-Account-Id": components["parameters"]["XAccountIdHeader"];
2363
+ };
2364
+ path: {
2365
+ id: string;
2366
+ };
2367
+ cookie?: never;
2368
+ };
2369
+ requestBody: {
2370
+ content: {
2371
+ "application/json": components["schemas"]["UpdateChargeRequest"];
2372
+ };
2373
+ };
2374
+ responses: {
2375
+ /** @description Charge updated successfully */
2376
+ 200: {
2377
+ headers: {
2378
+ [name: string]: unknown;
2379
+ };
2380
+ content: {
2381
+ "application/json": components["schemas"]["Charge"];
2382
+ };
2383
+ };
2384
+ };
2385
+ };
2245
2386
  ListCustomers: {
2246
2387
  parameters: {
2247
2388
  query?: {
@@ -3163,6 +3304,64 @@ export interface operations {
3163
3304
  };
3164
3305
  };
3165
3306
  };
3307
+ ListPaymentLinks: {
3308
+ parameters: {
3309
+ query?: {
3310
+ /** @description The page of results to retrieve. */
3311
+ page?: components["parameters"]["PageQuery"];
3312
+ /** @description Number of results per page. */
3313
+ per_page?: components["parameters"]["PerPageQuery"];
3314
+ };
3315
+ header: {
3316
+ "X-Api-Version": components["parameters"]["XApiVersionHeader"];
3317
+ "X-Account-Id": components["parameters"]["XAccountIdHeader"];
3318
+ };
3319
+ path?: never;
3320
+ cookie?: never;
3321
+ };
3322
+ requestBody?: never;
3323
+ responses: {
3324
+ /** @description A list of payment links */
3325
+ 200: {
3326
+ headers: {
3327
+ [name: string]: unknown;
3328
+ };
3329
+ content: {
3330
+ "application/json": {
3331
+ data?: components["schemas"]["PaymentLink"][];
3332
+ meta?: components["schemas"]["Meta"];
3333
+ };
3334
+ };
3335
+ };
3336
+ };
3337
+ };
3338
+ CreatePaymentLink: {
3339
+ parameters: {
3340
+ query?: never;
3341
+ header: {
3342
+ "X-Api-Version": components["parameters"]["XApiVersionHeader"];
3343
+ "X-Account-Id": components["parameters"]["XAccountIdHeader"];
3344
+ };
3345
+ path?: never;
3346
+ cookie?: never;
3347
+ };
3348
+ requestBody: {
3349
+ content: {
3350
+ "application/json": components["schemas"]["CreatePaymentLinkRequest"];
3351
+ };
3352
+ };
3353
+ responses: {
3354
+ /** @description Payment link created successfully */
3355
+ 201: {
3356
+ headers: {
3357
+ [name: string]: unknown;
3358
+ };
3359
+ content: {
3360
+ "application/json": components["schemas"]["PaymentLink"];
3361
+ };
3362
+ };
3363
+ };
3364
+ };
3166
3365
  GetPaymentIntent: {
3167
3366
  parameters: {
3168
3367
  query?: never;
@@ -3682,6 +3881,36 @@ export interface operations {
3682
3881
  };
3683
3882
  };
3684
3883
  };
3884
+ UpdateRefund: {
3885
+ parameters: {
3886
+ query?: never;
3887
+ header: {
3888
+ "X-Api-Version": components["parameters"]["XApiVersionHeader"];
3889
+ "X-Account-Id": components["parameters"]["XAccountIdHeader"];
3890
+ };
3891
+ path: {
3892
+ /** @description The ID of the refund to update */
3893
+ id: string;
3894
+ };
3895
+ cookie?: never;
3896
+ };
3897
+ requestBody: {
3898
+ content: {
3899
+ "application/json": components["schemas"]["UpdateRefundRequest"];
3900
+ };
3901
+ };
3902
+ responses: {
3903
+ /** @description Refund updated successfully */
3904
+ 200: {
3905
+ headers: {
3906
+ [name: string]: unknown;
3907
+ };
3908
+ content: {
3909
+ "application/json": components["schemas"]["Refund"];
3910
+ };
3911
+ };
3912
+ };
3913
+ };
3685
3914
  CancelRefund: {
3686
3915
  parameters: {
3687
3916
  query?: never;
@@ -4188,6 +4417,36 @@ export interface operations {
4188
4417
  };
4189
4418
  };
4190
4419
  };
4420
+ UpdateVoid: {
4421
+ parameters: {
4422
+ query?: never;
4423
+ header: {
4424
+ "X-Api-Version": components["parameters"]["XApiVersionHeader"];
4425
+ "X-Account-Id": components["parameters"]["XAccountIdHeader"];
4426
+ };
4427
+ path: {
4428
+ /** @description The ID of the void to update */
4429
+ id: string;
4430
+ };
4431
+ cookie?: never;
4432
+ };
4433
+ requestBody: {
4434
+ content: {
4435
+ "application/json": components["schemas"]["UpdateVoidRequest"];
4436
+ };
4437
+ };
4438
+ responses: {
4439
+ /** @description Void updated successfully */
4440
+ 200: {
4441
+ headers: {
4442
+ [name: string]: unknown;
4443
+ };
4444
+ content: {
4445
+ "application/json": components["schemas"]["Void"];
4446
+ };
4447
+ };
4448
+ };
4449
+ };
4191
4450
  ListWebhookAttempts: {
4192
4451
  parameters: {
4193
4452
  query: {
@@ -4403,4 +4662,29 @@ export interface operations {
4403
4662
  };
4404
4663
  };
4405
4664
  };
4665
+ RetrieveWebhookRequest: {
4666
+ parameters: {
4667
+ query?: never;
4668
+ header: {
4669
+ "X-Api-Version": components["parameters"]["XApiVersionHeader"];
4670
+ };
4671
+ path: {
4672
+ /** @description The ID of the webhook request to retrieve */
4673
+ id: string;
4674
+ };
4675
+ cookie?: never;
4676
+ };
4677
+ requestBody?: never;
4678
+ responses: {
4679
+ /** @description Webhook request retrieved successfully */
4680
+ 200: {
4681
+ headers: {
4682
+ [name: string]: unknown;
4683
+ };
4684
+ content: {
4685
+ "application/json": components["schemas"]["WebhookRequest"];
4686
+ };
4687
+ };
4688
+ };
4689
+ };
4406
4690
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amos.com/node",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Node.js client for the Amos Pay API.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -19,9 +19,10 @@
19
19
  ],
20
20
  "scripts": {
21
21
  "biome": "biome check --write",
22
- "prebuild": "npm run generate",
23
- "build": "tsc",
22
+ "build": "tsup",
23
+ "typecheck": "tsc --noEmit",
24
24
  "generate": "git -C ../openapi pull && rm -rf openapi/schema.ts && openapi-typescript ../openapi/amos/openapi.public.yaml --output openapi/schema.ts",
25
+ "prepack": "npm run build",
25
26
  "changeset": "changeset",
26
27
  "version": "changeset version",
27
28
  "release": "npm run build && changeset publish"
@@ -50,6 +51,7 @@
50
51
  "@changesets/cli": "2.31.0",
51
52
  "@types/node": "25.6.2",
52
53
  "openapi-typescript": "7.13.0",
54
+ "tsup": "^8.5.1",
53
55
  "typescript": "5.9.3"
54
56
  },
55
57
  "engines": {