@puppi/adapter-square 0.0.0-stage → 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,36 @@
1
- # Temporary Holding Version
1
+ # @puppi/adapter-square
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Source connector for the Square Connect API. It reads locations, payments, customers, orders, and refunds. Auth is a bearer access token. Every request sends `Square-Version`.
4
+
5
+ The pinned version is `2026-09-16`, the `Square-Version` default in Square's published OpenAPI document (commit `79ccc3f89e1527f7b943cc2f6628b6098572583e` of [connect-api-specification](https://github.com/square/connect-api-specification/blob/79ccc3f89e1527f7b943cc2f6628b6098572583e/api.json)). A binding that sets `api_version` must use that value. The header overrides the application's default version in the Developer Console.
6
+
7
+ `base_url` defaults to `https://connect.squareup.com`. Sandbox is `https://connect.squareupsandbox.com`. A production token against Sandbox, or the reverse, is `UNAUTHORIZED`.
8
+
9
+ `access_token` is sent as `Authorization: Bearer`. A personal access token has full access to that Square account. An OAuth access token uses the same header. This client does not refresh tokens. An OAuth token needs `MERCHANT_PROFILE_READ` for locations, `PAYMENTS_READ` for payments and refunds, `CUSTOMERS_READ` for customers, and `ORDERS_READ` for orders.
10
+
11
+ The pinned file is that document trimmed to `GET /v2/locations`, `GET /v2/payments`, `GET /v2/customers`, `POST /v2/orders/search`, and `GET /v2/refunds`. The published document references `AppFeeAllocation` and `CurrencyExchange` and does not define them, so the trim drops `Payment.app_fee_allocations`, `Payment.buyer_currency_exchange`, and `PaymentRefund.app_fee_allocations`.
12
+
13
+ `check()` calls `GET /v2/locations`. It proves the token can list locations.
14
+
15
+ `locations()` is `GET /v2/locations`. Inactive locations are included. The response has no cursor.
16
+
17
+ `payments({ query, limit, cursor })` is `GET /v2/payments`. `cursor` is the response `cursor`, sent back as the `cursor` query parameter. The last page omits `cursor`. Omitting `begin_time` lists payments from the last year.
18
+
19
+ `customers({ query, limit, cursor })` is `GET /v2/customers`. The cursor works the same way. Profiles without a public name, company, email, or phone are omitted. An empty account is `{}`.
20
+
21
+ `orders({ locationIds, query, limit, cursor })` is `POST /v2/orders/search`. The POST only reads. `locationIds` is `location_ids`. `cursor` goes in the JSON body with the same locations, query, and limit. `return_entries` is not sent, so each row is an order.
22
+
23
+ `refunds({ query, limit, cursor })` is `GET /v2/refunds`. The cursor works the same way as payments. Omitting `begin_time` lists refunds from the last year.
24
+
25
+ A cursor expires after 5 minutes.
26
+
27
+ ```json
28
+ {
29
+ "square": {
30
+ "config": {},
31
+ "secret_refs": { "access_token": "square_access_token" }
32
+ }
33
+ }
34
+ ```
35
+
36
+ Reference: <https://developer.squareup.com/reference/square>
@@ -0,0 +1,18 @@
1
+ declare const _default: {
2
+ readonly type: "square";
3
+ readonly docs: "https://developer.squareup.com/reference/square";
4
+ readonly configSchema: {
5
+ readonly base_url: "string";
6
+ readonly api_version: "string";
7
+ };
8
+ readonly secretFields: readonly ["access_token"];
9
+ readonly auth: {
10
+ readonly scheme: "bearer";
11
+ readonly secret: "access_token";
12
+ };
13
+ readonly apiVersions: readonly ["2026-09-16"];
14
+ readonly defaultApiVersion: "2026-09-16";
15
+ readonly defaultBaseUrl: "https://connect.squareup.com";
16
+ };
17
+ export default _default;
18
+ //# sourceMappingURL=define.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define.d.ts","sourceRoot":"","sources":["../src/define.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAEA,wBASG"}
package/dist/define.js ADDED
@@ -0,0 +1,12 @@
1
+ import { defineConnector } from "@puppi/sdk";
2
+ export default defineConnector({
3
+ type: "square",
4
+ docs: "https://developer.squareup.com/reference/square",
5
+ configSchema: { base_url: "string", api_version: "string" },
6
+ secretFields: ["access_token"],
7
+ auth: { scheme: "bearer", secret: "access_token" },
8
+ apiVersions: ["2026-09-16"],
9
+ defaultApiVersion: "2026-09-16",
10
+ defaultBaseUrl: "https://connect.squareup.com",
11
+ });
12
+ //# sourceMappingURL=define.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define.js","sourceRoot":"","sources":["../src/define.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,eAAe,eAAe,CAAC;IAC7B,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,iDAAiD;IACvD,YAAY,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE;IAC3D,YAAY,EAAE,CAAC,cAAc,CAAC;IAC9B,IAAI,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE;IAClD,WAAW,EAAE,CAAC,YAAY,CAAC;IAC3B,iBAAiB,EAAE,YAAY;IAC/B,cAAc,EAAE,8BAA8B;CAC/C,CAAC,CAAC"}
@@ -0,0 +1,155 @@
1
+ import { type CredentialCheck, type ClientOptions, type PageArgs, OpenApiClient } from "@puppi/sdk";
2
+ import connector from "./define.js";
3
+ import type { SchemaCustomer as Customer, SchemaLocation as Location, SchemaOrder as Order, SchemaPayment as Payment, SchemaPaymentRefund as PaymentRefund, SchemaSearchOrdersQuery as OrdersQuery, operations as spec } from "./openapi.js";
4
+ import { type Api } from "./operations.js";
5
+ export type { Customer, Location, Order, OrdersQuery, Payment, PaymentRefund };
6
+ type ListQuery<Id extends "ListCustomers" | "ListPayments" | "ListPaymentRefunds"> = Omit<NonNullable<spec[Id]["parameters"]["query"]>, "cursor" | "limit">;
7
+ export type CustomersQuery = ListQuery<"ListCustomers">;
8
+ export type PaymentsQuery = ListQuery<"ListPayments">;
9
+ export type RefundsQuery = ListQuery<"ListPaymentRefunds">;
10
+ export default connector;
11
+ export declare class Client extends OpenApiClient<Api> {
12
+ constructor(config: Record<string, unknown>, secrets?: Record<string, string>, options?: ClientOptions);
13
+ check(): Promise<CredentialCheck>;
14
+ /** Every location, including inactive ones, in one response. */
15
+ locations(): Promise<Location[]>;
16
+ payments(args?: {
17
+ query?: PaymentsQuery;
18
+ limit?: number;
19
+ cursor?: PageArgs["cursor"];
20
+ }): AsyncGenerator<import("@puppi/sdk").Page<{
21
+ readonly id?: string;
22
+ readonly created_at?: string;
23
+ readonly updated_at?: string;
24
+ amount_money?: import("./openapi.js").components["schemas"]["Money"];
25
+ tip_money?: import("./openapi.js").components["schemas"]["Money"];
26
+ readonly total_money?: import("./openapi.js").components["schemas"]["Money"];
27
+ app_fee_money?: import("./openapi.js").components["schemas"]["Money"];
28
+ approved_money?: import("./openapi.js").components["schemas"]["Money"];
29
+ readonly processing_fee?: import("./openapi.js").components["schemas"]["ProcessingFee"][];
30
+ readonly refunded_money?: import("./openapi.js").components["schemas"]["Money"];
31
+ readonly status?: string;
32
+ readonly delay_duration?: string;
33
+ delay_action?: string | null;
34
+ readonly delayed_until?: string;
35
+ readonly source_type?: string;
36
+ card_details?: import("./openapi.js").components["schemas"]["CardPaymentDetails"];
37
+ cash_details?: import("./openapi.js").components["schemas"]["CashPaymentDetails"];
38
+ readonly bank_account_details?: import("./openapi.js").components["schemas"]["BankAccountPaymentDetails"];
39
+ electronic_money_details?: import("./openapi.js").components["schemas"]["ElectronicMoneyDetails"];
40
+ readonly external_details?: import("./openapi.js").components["schemas"]["ExternalPaymentDetails"];
41
+ readonly wallet_details?: import("./openapi.js").components["schemas"]["DigitalWalletDetails"];
42
+ readonly buy_now_pay_later_details?: import("./openapi.js").components["schemas"]["BuyNowPayLaterDetails"];
43
+ readonly square_account_details?: import("./openapi.js").components["schemas"]["SquareAccountDetails"];
44
+ readonly location_id?: string;
45
+ readonly order_id?: string;
46
+ readonly reference_id?: string;
47
+ readonly customer_id?: string;
48
+ readonly employee_id?: string;
49
+ team_member_id?: string | null;
50
+ readonly refund_ids?: string[];
51
+ readonly risk_evaluation?: import("./openapi.js").components["schemas"]["RiskEvaluation"];
52
+ readonly terminal_checkout_id?: string;
53
+ readonly buyer_email_address?: string;
54
+ readonly billing_address?: import("./openapi.js").components["schemas"]["Address"];
55
+ readonly shipping_address?: import("./openapi.js").components["schemas"]["Address"];
56
+ readonly note?: string;
57
+ readonly statement_description_identifier?: string;
58
+ readonly capabilities?: string[];
59
+ readonly receipt_number?: string;
60
+ readonly receipt_url?: string;
61
+ readonly device_details?: import("./openapi.js").components["schemas"]["DeviceDetails"];
62
+ readonly application_details?: import("./openapi.js").components["schemas"]["ApplicationDetails"];
63
+ readonly is_offline_payment?: boolean;
64
+ readonly offline_payment_details?: import("./openapi.js").components["schemas"]["OfflinePaymentDetails"];
65
+ version_token?: string | null;
66
+ }, string | number>, any, any>;
67
+ customers(args?: {
68
+ query?: CustomersQuery;
69
+ limit?: number;
70
+ cursor?: PageArgs["cursor"];
71
+ }): AsyncGenerator<import("@puppi/sdk").Page<{
72
+ id?: string;
73
+ readonly created_at?: string;
74
+ readonly updated_at?: string;
75
+ given_name?: string | null;
76
+ family_name?: string | null;
77
+ nickname?: string | null;
78
+ company_name?: string | null;
79
+ email_address?: string | null;
80
+ address?: import("./openapi.js").components["schemas"]["Address"];
81
+ phone_number?: string | null;
82
+ birthday?: string | null;
83
+ reference_id?: string | null;
84
+ note?: string | null;
85
+ preferences?: import("./openapi.js").components["schemas"]["CustomerPreferences"];
86
+ creation_source?: import("./openapi.js").components["schemas"]["CustomerCreationSource"];
87
+ group_ids?: string[] | null;
88
+ segment_ids?: string[] | null;
89
+ version?: number;
90
+ tax_ids?: import("./openapi.js").components["schemas"]["CustomerTaxIds"];
91
+ }, string | number>, any, any>;
92
+ orders(args: {
93
+ locationIds: readonly string[];
94
+ query?: OrdersQuery;
95
+ limit?: number;
96
+ cursor?: PageArgs["cursor"];
97
+ }): AsyncGenerator<import("@puppi/sdk").Page<{
98
+ readonly id?: string;
99
+ location_id: string;
100
+ reference_id?: string | null;
101
+ source?: import("./openapi.js").components["schemas"]["OrderSource"];
102
+ customer_id?: string | null;
103
+ line_items?: import("./openapi.js").components["schemas"]["OrderLineItem"][] | null;
104
+ taxes?: import("./openapi.js").components["schemas"]["OrderLineItemTax"][] | null;
105
+ discounts?: import("./openapi.js").components["schemas"]["OrderLineItemDiscount"][] | null;
106
+ service_charges?: import("./openapi.js").components["schemas"]["OrderServiceCharge"][] | null;
107
+ fulfillments?: import("./openapi.js").components["schemas"]["Fulfillment"][] | null;
108
+ readonly returns?: import("./openapi.js").components["schemas"]["OrderReturn"][];
109
+ readonly return_amounts?: import("./openapi.js").components["schemas"]["OrderMoneyAmounts"];
110
+ readonly net_amounts?: import("./openapi.js").components["schemas"]["OrderMoneyAmounts"];
111
+ readonly rounding_adjustment?: import("./openapi.js").components["schemas"]["OrderRoundingAdjustment"];
112
+ readonly tenders?: import("./openapi.js").components["schemas"]["Tender"][];
113
+ readonly refunds?: import("./openapi.js").components["schemas"]["Refund"][];
114
+ metadata?: {
115
+ [key: string]: string;
116
+ } | null;
117
+ readonly created_at?: string;
118
+ readonly updated_at?: string;
119
+ readonly closed_at?: string;
120
+ state?: import("./openapi.js").components["schemas"]["OrderState"];
121
+ version?: number;
122
+ readonly total_money?: import("./openapi.js").components["schemas"]["Money"];
123
+ readonly total_tax_money?: import("./openapi.js").components["schemas"]["Money"];
124
+ readonly total_discount_money?: import("./openapi.js").components["schemas"]["Money"];
125
+ readonly total_tip_money?: import("./openapi.js").components["schemas"]["Money"];
126
+ readonly total_service_charge_money?: import("./openapi.js").components["schemas"]["Money"];
127
+ ticket_name?: string | null;
128
+ pricing_options?: import("./openapi.js").components["schemas"]["OrderPricingOptions"];
129
+ readonly rewards?: import("./openapi.js").components["schemas"]["OrderReward"][];
130
+ readonly net_amount_due_money?: import("./openapi.js").components["schemas"]["Money"];
131
+ }, string | number>, any, any>;
132
+ refunds(args?: {
133
+ query?: RefundsQuery;
134
+ limit?: number;
135
+ cursor?: PageArgs["cursor"];
136
+ }): AsyncGenerator<import("@puppi/sdk").Page<{
137
+ id: string;
138
+ status?: string | null;
139
+ location_id?: string | null;
140
+ readonly unlinked?: boolean;
141
+ destination_type?: string | null;
142
+ readonly destination_details?: import("./openapi.js").components["schemas"]["DestinationDetails"];
143
+ amount_money: import("./openapi.js").components["schemas"]["Money"];
144
+ app_fee_money?: import("./openapi.js").components["schemas"]["Money"];
145
+ processing_fee?: import("./openapi.js").components["schemas"]["ProcessingFee"][] | null;
146
+ payment_id?: string | null;
147
+ order_id?: string | null;
148
+ reason?: string | null;
149
+ readonly created_at?: string;
150
+ readonly updated_at?: string;
151
+ readonly team_member_id?: string;
152
+ readonly terminal_refund_id?: string;
153
+ }, string | number>, any, any>;
154
+ }
155
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,aAAa,EAEd,MAAM,YAAY,CAAC;AAEpB,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,KAAK,EACV,cAAc,IAAI,QAAQ,EAC1B,cAAc,IAAI,QAAQ,EAC1B,WAAW,IAAI,KAAK,EACpB,aAAa,IAAI,OAAO,EACxB,mBAAmB,IAAI,aAAa,EACpC,uBAAuB,IAAI,WAAW,EACtC,UAAU,IAAI,IAAI,EACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,GAAG,EAAc,MAAM,iBAAiB,CAAC;AAEvD,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC;AAE/E,KAAK,SAAS,CAAC,EAAE,SAAS,eAAe,GAAG,cAAc,GAAG,oBAAoB,IAAI,IAAI,CACvF,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC,EAC5C,Q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,CAAC,QAAQ,CAAC,CAAA;KAAO;;;;;;;;;kBA0D4g+B,4CAAsB;;;;;sBAAwxB,4CAAsB;0BAAsO,4CAAsB;;;;kBAAy6B,4CAAsB;;IAjDvmiC,MAAM,CAAC,IAAI,EAAE;QACX,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;QAC/B,KAAK,CAAC,EAAE,WAAW,CAAC;QACpB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;KAC7B;;;;iBA4Ci/wG,4CAAsB;;qBAAikB,4CAAsB;gBAA0xB,4CAAsB;oBAAuuB,4CAAsB;0BAAqI,4CAAsB;uBAAqS,4CAAsB;2BAAkT,4CAAsB;kCAAsH,4CAAsB;+BAAgI,4CAAsB;uCAAoV,4CAAsB;2BAAgI,4CAAsB;2BAAyG,4CAAsB;;;;;;;gBAA4+D,4CAAsB;;+BAA6hB,4CAAsB;mCAA6H,4CAAsB;wCAAuI,4CAAsB;mCAA6H,4CAAsB;8CAAya,4CAAsB;;0BAA6iB,4CAAsB;2BAAyI,4CAAsB;wCAA4H,4CAAsB;;IA5BtnhH,OAAO,CAAC,IAAI,GAAE;QAAE,KAAK,CAAC,EAAE,YAAY,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAA;KAAO;;;;;;uCA4Bus1L,4CAAsB;sBAA0Q,4CAAsB;wBAAme,4CAAsB;yBAAmI,4CAAsB;;;;;;;;;CArBxu3L"}
package/dist/index.js ADDED
@@ -0,0 +1,118 @@
1
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
2
+ var useValue = arguments.length > 2;
3
+ for (var i = 0; i < initializers.length; i++) {
4
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
5
+ }
6
+ return useValue ? value : void 0;
7
+ };
8
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
9
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
10
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
11
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
12
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
13
+ var _, done = false;
14
+ for (var i = decorators.length - 1; i >= 0; i--) {
15
+ var context = {};
16
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
17
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
18
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
19
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
20
+ if (kind === "accessor") {
21
+ if (result === void 0) continue;
22
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
23
+ if (_ = accept(result.get)) descriptor.get = _;
24
+ if (_ = accept(result.set)) descriptor.set = _;
25
+ if (_ = accept(result.init)) initializers.unshift(_);
26
+ }
27
+ else if (_ = accept(result)) {
28
+ if (kind === "field") initializers.unshift(_);
29
+ else descriptor[key] = _;
30
+ }
31
+ }
32
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
33
+ done = true;
34
+ };
35
+ import { read, OpenApiClient, openApiClientOptions, } from "@puppi/sdk";
36
+ import connector from "./define.js";
37
+ import { operations } from "./operations.js";
38
+ export default connector;
39
+ const auth = connector.auth;
40
+ const CURSOR = { next: "cursor", param: "cursor" };
41
+ let Client = (() => {
42
+ let _classSuper = OpenApiClient;
43
+ let _instanceExtraInitializers = [];
44
+ let _locations_decorators;
45
+ let _payments_decorators;
46
+ let _customers_decorators;
47
+ let _orders_decorators;
48
+ let _refunds_decorators;
49
+ return class Client extends _classSuper {
50
+ static {
51
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
52
+ _locations_decorators = [read];
53
+ _payments_decorators = [read];
54
+ _customers_decorators = [read];
55
+ _orders_decorators = [read];
56
+ _refunds_decorators = [read];
57
+ __esDecorate(this, null, _locations_decorators, { kind: "method", name: "locations", static: false, private: false, access: { has: obj => "locations" in obj, get: obj => obj.locations }, metadata: _metadata }, null, _instanceExtraInitializers);
58
+ __esDecorate(this, null, _payments_decorators, { kind: "method", name: "payments", static: false, private: false, access: { has: obj => "payments" in obj, get: obj => obj.payments }, metadata: _metadata }, null, _instanceExtraInitializers);
59
+ __esDecorate(this, null, _customers_decorators, { kind: "method", name: "customers", static: false, private: false, access: { has: obj => "customers" in obj, get: obj => obj.customers }, metadata: _metadata }, null, _instanceExtraInitializers);
60
+ __esDecorate(this, null, _orders_decorators, { kind: "method", name: "orders", static: false, private: false, access: { has: obj => "orders" in obj, get: obj => obj.orders }, metadata: _metadata }, null, _instanceExtraInitializers);
61
+ __esDecorate(this, null, _refunds_decorators, { kind: "method", name: "refunds", static: false, private: false, access: { has: obj => "refunds" in obj, get: obj => obj.refunds }, metadata: _metadata }, null, _instanceExtraInitializers);
62
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
63
+ }
64
+ constructor(config, secrets = {}, options = {}) {
65
+ super(config, options, ...openApiClientOptions(connector, config, secrets, operations, {
66
+ headers: (version) => ({ "Square-Version": version }),
67
+ extract,
68
+ }));
69
+ __runInitializers(this, _instanceExtraInitializers);
70
+ }
71
+ check() {
72
+ return this.prove("/v2/locations", auth.secret);
73
+ }
74
+ /** Every location, including inactive ones, in one response. */
75
+ async locations() {
76
+ const body = await this.read("ListLocations");
77
+ const locations = body?.locations;
78
+ return Array.isArray(locations) ? locations : [];
79
+ }
80
+ payments(args = {}) {
81
+ return this.pages("ListPayments", { rows: "payments", ...CURSOR }, { cursor: args.cursor, query: { ...args.query, limit: args.limit } });
82
+ }
83
+ customers(args = {}) {
84
+ return this.pages("ListCustomers", { rows: "customers", ...CURSOR }, { cursor: args.cursor, query: { ...args.query, limit: args.limit } });
85
+ }
86
+ orders(args) {
87
+ return this.pages("SearchOrders", { rows: "orders", ...CURSOR }, {
88
+ cursor: args.cursor,
89
+ body: {
90
+ location_ids: [...args.locationIds],
91
+ query: args.query,
92
+ limit: args.limit,
93
+ },
94
+ });
95
+ }
96
+ refunds(args = {}) {
97
+ return this.pages("ListPaymentRefunds", { rows: "refunds", ...CURSOR }, { cursor: args.cursor, query: { ...args.query, limit: args.limit } });
98
+ }
99
+ };
100
+ })();
101
+ export { Client };
102
+ const ROWS = {
103
+ ListCustomers: "customers",
104
+ ListPayments: "payments",
105
+ ListPaymentRefunds: "refunds",
106
+ SearchOrders: "orders",
107
+ };
108
+ // ListCustomers returns `{}` for an empty account. pages() requires the row field to be an array.
109
+ function extract(operationId, body) {
110
+ const key = ROWS[operationId];
111
+ if (key === undefined)
112
+ return undefined;
113
+ const record = body !== null && typeof body === "object" ? body : {};
114
+ if (record[key] !== undefined)
115
+ return undefined;
116
+ return { data: [], next: null };
117
+ }
118
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EACL,IAAI,EAIJ,aAAa,EACb,oBAAoB,GACrB,MAAM,YAAY,CAAC;AAEpB,OAAO,SAAS,MAAM,aAAa,CAAC;AAUpC,OAAO,EAAY,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAavD,eAAe,SAAS,CAAC;AAEzB,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC;AAE5B,MAAM,MAAM,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAW,CAAC;IAE/C,MAAM;sBAAS,aAAa;;;;;;;iBAA5B,MAAO,SAA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