@use-stall/core 0.0.2 → 0.0.3
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 +345 -430
- package/dist/index.d.mts +690 -657
- package/dist/index.d.ts +690 -657
- package/dist/index.js +2084 -1247
- package/dist/index.mjs +2056 -1239
- package/package.json +3 -2
- package/bun.lock +0 -211
package/dist/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,1305 +17,2140 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
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
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// src/index.ts
|
|
21
31
|
var index_exports = {};
|
|
22
32
|
__export(index_exports, {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
categories: () => categories,
|
|
34
|
+
collections: () => collections,
|
|
35
|
+
customers: () => customers,
|
|
36
|
+
fulfillments: () => fulfillments,
|
|
37
|
+
initializeStallCore: () => initializeStallCore,
|
|
38
|
+
inventory_levels: () => inventory_levels,
|
|
39
|
+
locations: () => locations,
|
|
40
|
+
order_notes: () => order_notes,
|
|
41
|
+
orders: () => orders,
|
|
42
|
+
payment_providers: () => payment_providers,
|
|
43
|
+
payments: () => payments,
|
|
44
|
+
products: () => products,
|
|
45
|
+
promotions: () => promotions,
|
|
46
|
+
refunds: () => refunds,
|
|
47
|
+
tax_rates: () => tax_rates,
|
|
48
|
+
tax_regions: () => tax_regions,
|
|
49
|
+
variants: () => variants
|
|
37
50
|
});
|
|
38
51
|
module.exports = __toCommonJS(index_exports);
|
|
39
52
|
|
|
40
|
-
// src/
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
53
|
+
// src/db/db.ts
|
|
54
|
+
var import_dexie = __toESM(require("dexie"));
|
|
55
|
+
|
|
56
|
+
// src/db/schema.ts
|
|
57
|
+
var schemas = {
|
|
58
|
+
connector_cache: "id",
|
|
59
|
+
products: "++id",
|
|
60
|
+
variants: "++id",
|
|
61
|
+
collections: "++id",
|
|
62
|
+
categories: "++id",
|
|
63
|
+
inventory_levels: "++id",
|
|
64
|
+
inventory_history: "++id",
|
|
65
|
+
promotions: "++id",
|
|
66
|
+
orders: "++id",
|
|
67
|
+
order_notes: "++id",
|
|
68
|
+
refunds: "++id",
|
|
69
|
+
payment_providers: "++id",
|
|
70
|
+
payments: "++id",
|
|
71
|
+
tax_regions: "++id",
|
|
72
|
+
tax_rates: "++id",
|
|
73
|
+
customers: "++id",
|
|
74
|
+
locations: "++id",
|
|
75
|
+
fulfillments: "++id"
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
// src/db/db.ts
|
|
79
|
+
var options = { allowEmptyDB: true };
|
|
80
|
+
var local_db = new import_dexie.default("stall-core-db", options);
|
|
81
|
+
local_db.version(1).stores(schemas);
|
|
82
|
+
|
|
83
|
+
// src/core/init.ts
|
|
84
|
+
var initializeStallCore = (options2) => {
|
|
85
|
+
const sdk = {
|
|
86
|
+
options: options2,
|
|
87
|
+
adapter: async () => getAdapter(sdk),
|
|
88
|
+
refreshAdapter: async () => getAdapter(sdk, true)
|
|
89
|
+
};
|
|
90
|
+
void sdk.adapter();
|
|
91
|
+
return sdk;
|
|
92
|
+
};
|
|
93
|
+
var getAdapter = async (sdk, force) => {
|
|
94
|
+
const date = Date.now();
|
|
95
|
+
let module_code;
|
|
96
|
+
const cache_key = "connector-module";
|
|
97
|
+
const cached = await local_db.connector_cache.get(cache_key);
|
|
98
|
+
if (cached && !force) {
|
|
99
|
+
module_code = cached.code;
|
|
100
|
+
} else {
|
|
101
|
+
const response = await fetch(sdk.options.connector_url, {
|
|
102
|
+
mode: "cors",
|
|
103
|
+
method: "GET"
|
|
104
|
+
});
|
|
105
|
+
if (!response.ok) {
|
|
106
|
+
throw new Error(`Failed to fetch connector: ${response.statusText}`);
|
|
62
107
|
}
|
|
63
|
-
|
|
108
|
+
module_code = await response.text();
|
|
109
|
+
await local_db.connector_cache.put({
|
|
110
|
+
id: cache_key,
|
|
111
|
+
code: module_code,
|
|
112
|
+
timestamp: date
|
|
113
|
+
});
|
|
64
114
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
115
|
+
const blob = new Blob([module_code], { type: "application/javascript" });
|
|
116
|
+
const blobUrl = URL.createObjectURL(blob);
|
|
117
|
+
const module2 = await import(blobUrl);
|
|
118
|
+
URL.revokeObjectURL(blobUrl);
|
|
119
|
+
return module2;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
// src/services/products.service.ts
|
|
123
|
+
var list = async (props) => {
|
|
124
|
+
try {
|
|
125
|
+
const { sdk, query } = props;
|
|
126
|
+
const adapter = await sdk.adapter();
|
|
127
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
128
|
+
const products2 = await adapter.products.list({
|
|
129
|
+
connector_config: sdk.options.configuration,
|
|
130
|
+
query
|
|
131
|
+
});
|
|
132
|
+
return products2;
|
|
133
|
+
} catch (error) {
|
|
134
|
+
throw error;
|
|
69
135
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
136
|
+
};
|
|
137
|
+
var retrieve = async (props) => {
|
|
138
|
+
try {
|
|
139
|
+
const { sdk, id } = props;
|
|
140
|
+
const adapter = await sdk.adapter();
|
|
141
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
142
|
+
const product = await adapter.products.retrieve({
|
|
143
|
+
connector_config: sdk.options.configuration,
|
|
144
|
+
id
|
|
145
|
+
});
|
|
146
|
+
return product;
|
|
147
|
+
} catch (error) {
|
|
148
|
+
throw error;
|
|
74
149
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
150
|
+
};
|
|
151
|
+
var create = async (props) => {
|
|
152
|
+
try {
|
|
153
|
+
const { sdk, data } = props;
|
|
154
|
+
const adapter = await sdk.adapter();
|
|
155
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
156
|
+
const product = await adapter.products.create({
|
|
157
|
+
connector_config: sdk.options.configuration,
|
|
158
|
+
data
|
|
159
|
+
});
|
|
160
|
+
return product;
|
|
161
|
+
} catch (error) {
|
|
162
|
+
throw error;
|
|
79
163
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
164
|
+
};
|
|
165
|
+
var update = async (props) => {
|
|
166
|
+
try {
|
|
167
|
+
const { sdk, id, data } = props;
|
|
168
|
+
const adapter = await sdk.adapter();
|
|
169
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
170
|
+
const product = await adapter.products.update({
|
|
171
|
+
connector_config: sdk.options.configuration,
|
|
172
|
+
id,
|
|
173
|
+
data
|
|
174
|
+
});
|
|
175
|
+
return product;
|
|
176
|
+
} catch (error) {
|
|
177
|
+
throw error;
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
var _delete = async (props) => {
|
|
181
|
+
try {
|
|
182
|
+
const { sdk, id } = props;
|
|
183
|
+
const adapter = await sdk.adapter();
|
|
184
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
185
|
+
await adapter.products.delete({
|
|
186
|
+
connector_config: sdk.options.configuration,
|
|
187
|
+
id
|
|
188
|
+
});
|
|
189
|
+
return;
|
|
190
|
+
} catch (error) {
|
|
191
|
+
throw error;
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
var bulk_create = async (props) => {
|
|
195
|
+
try {
|
|
196
|
+
const { sdk, data } = props;
|
|
197
|
+
const adapter = await sdk.adapter();
|
|
198
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
199
|
+
const products2 = await adapter.products.bulk_create({
|
|
200
|
+
connector_config: sdk.options.configuration,
|
|
201
|
+
data
|
|
202
|
+
});
|
|
203
|
+
return products2;
|
|
204
|
+
} catch (error) {
|
|
205
|
+
throw error;
|
|
85
206
|
}
|
|
86
|
-
|
|
87
|
-
|
|
207
|
+
};
|
|
208
|
+
var bulk_update = async (props) => {
|
|
209
|
+
try {
|
|
210
|
+
const { sdk, data } = props;
|
|
211
|
+
const adapter = await sdk.adapter();
|
|
212
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
213
|
+
const products2 = await adapter.products.bulk_update({
|
|
214
|
+
connector_config: sdk.options.configuration,
|
|
215
|
+
data
|
|
216
|
+
});
|
|
217
|
+
return products2;
|
|
218
|
+
} catch (error) {
|
|
219
|
+
throw error;
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
var bulk_delete = async (props) => {
|
|
223
|
+
try {
|
|
224
|
+
const { sdk, ids } = props;
|
|
225
|
+
const adapter = await sdk.adapter();
|
|
226
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
227
|
+
await adapter.products.bulk_delete({
|
|
228
|
+
connector_config: sdk.options.configuration,
|
|
229
|
+
ids
|
|
230
|
+
});
|
|
231
|
+
return;
|
|
232
|
+
} catch (error) {
|
|
233
|
+
throw error;
|
|
88
234
|
}
|
|
89
235
|
};
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
236
|
+
var products = {
|
|
237
|
+
list,
|
|
238
|
+
retrieve,
|
|
239
|
+
create,
|
|
240
|
+
update,
|
|
241
|
+
delete: _delete,
|
|
242
|
+
bulk_create,
|
|
243
|
+
bulk_update,
|
|
244
|
+
bulk_delete
|
|
245
|
+
};
|
|
93
246
|
|
|
94
|
-
// src/
|
|
95
|
-
var
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
function handleConnectorError(error, context) {
|
|
135
|
-
if (error instanceof StallConnectorError) {
|
|
136
|
-
return error;
|
|
137
|
-
}
|
|
138
|
-
if (error?.response) {
|
|
139
|
-
const statusCode = error.response.status;
|
|
140
|
-
const data = error.response.data || error.response.body;
|
|
141
|
-
let code = ErrorCodes.REQUEST_FAILED;
|
|
142
|
-
if (statusCode === 401) code = ErrorCodes.UNAUTHORIZED;
|
|
143
|
-
else if (statusCode === 403) code = ErrorCodes.FORBIDDEN;
|
|
144
|
-
else if (statusCode === 429) code = ErrorCodes.RATE_LIMITED;
|
|
145
|
-
else if (statusCode >= 500) code = ErrorCodes.INTERNAL_ERROR;
|
|
146
|
-
return new StallConnectorError(
|
|
147
|
-
`${context}: ${data?.message || error.message}`,
|
|
148
|
-
code,
|
|
149
|
-
statusCode,
|
|
247
|
+
// src/services/orders.service.ts
|
|
248
|
+
var list2 = async (props) => {
|
|
249
|
+
try {
|
|
250
|
+
const { sdk, query } = props;
|
|
251
|
+
const adapter = await sdk.adapter();
|
|
252
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
253
|
+
const orders2 = await adapter.orders.list({
|
|
254
|
+
connector_config: sdk.options.configuration,
|
|
255
|
+
query
|
|
256
|
+
});
|
|
257
|
+
return orders2;
|
|
258
|
+
} catch (error) {
|
|
259
|
+
throw new Error(
|
|
260
|
+
`Failed to list orders: ${error instanceof Error ? error.message : String(error)}`
|
|
261
|
+
);
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
var retrieve2 = async (props) => {
|
|
265
|
+
try {
|
|
266
|
+
const { sdk, id } = props;
|
|
267
|
+
const adapter = await sdk.adapter();
|
|
268
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
269
|
+
const order = await adapter.orders.retrieve({
|
|
270
|
+
connector_config: sdk.options.configuration,
|
|
271
|
+
id
|
|
272
|
+
});
|
|
273
|
+
return order;
|
|
274
|
+
} catch (error) {
|
|
275
|
+
throw new Error(
|
|
276
|
+
`Failed to retrieve order: ${error instanceof Error ? error.message : String(error)}`
|
|
277
|
+
);
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
var create2 = async (props) => {
|
|
281
|
+
try {
|
|
282
|
+
const { sdk, data } = props;
|
|
283
|
+
const adapter = await sdk.adapter();
|
|
284
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
285
|
+
const order = await adapter.orders.create({
|
|
286
|
+
connector_config: sdk.options.configuration,
|
|
150
287
|
data
|
|
288
|
+
});
|
|
289
|
+
return order;
|
|
290
|
+
} catch (error) {
|
|
291
|
+
throw new Error(
|
|
292
|
+
`Failed to create order: ${error instanceof Error ? error.message : String(error)}`
|
|
151
293
|
);
|
|
152
294
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
295
|
+
};
|
|
296
|
+
var update2 = async (props) => {
|
|
297
|
+
try {
|
|
298
|
+
const { sdk, id, data } = props;
|
|
299
|
+
const adapter = await sdk.adapter();
|
|
300
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
301
|
+
const order = await adapter.orders.update({
|
|
302
|
+
connector_config: sdk.options.configuration,
|
|
303
|
+
id,
|
|
304
|
+
data
|
|
305
|
+
});
|
|
306
|
+
return order;
|
|
307
|
+
} catch (error) {
|
|
308
|
+
throw new Error(
|
|
309
|
+
`Failed to update order: ${error instanceof Error ? error.message : String(error)}`
|
|
157
310
|
);
|
|
158
311
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
312
|
+
};
|
|
313
|
+
var _delete2 = async (props) => {
|
|
314
|
+
try {
|
|
315
|
+
const { sdk, id } = props;
|
|
316
|
+
const adapter = await sdk.adapter();
|
|
317
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
318
|
+
await adapter.orders.delete({
|
|
319
|
+
connector_config: sdk.options.configuration,
|
|
320
|
+
id
|
|
321
|
+
});
|
|
322
|
+
return;
|
|
323
|
+
} catch (error) {
|
|
324
|
+
throw new Error(
|
|
325
|
+
`Failed to delete order: ${error instanceof Error ? error.message : String(error)}`
|
|
163
326
|
);
|
|
164
327
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
328
|
+
};
|
|
329
|
+
var bulk_create2 = async (props) => {
|
|
330
|
+
try {
|
|
331
|
+
const { sdk, data } = props;
|
|
332
|
+
const adapter = await sdk.adapter();
|
|
333
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
334
|
+
const orders2 = await adapter.orders.bulk_create({
|
|
335
|
+
connector_config: sdk.options.configuration,
|
|
336
|
+
data
|
|
337
|
+
});
|
|
338
|
+
return orders2;
|
|
339
|
+
} catch (error) {
|
|
340
|
+
throw new Error(
|
|
341
|
+
`Failed to bulk create orders: ${error instanceof Error ? error.message : String(error)}`
|
|
171
342
|
);
|
|
172
343
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
344
|
+
};
|
|
345
|
+
var bulk_update2 = async (props) => {
|
|
346
|
+
try {
|
|
347
|
+
const { sdk, data } = props;
|
|
348
|
+
const adapter = await sdk.adapter();
|
|
349
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
350
|
+
const orders2 = await adapter.orders.bulk_update({
|
|
351
|
+
connector_config: sdk.options.configuration,
|
|
352
|
+
data
|
|
353
|
+
});
|
|
354
|
+
return orders2;
|
|
355
|
+
} catch (error) {
|
|
356
|
+
throw new Error(
|
|
357
|
+
`Failed to bulk update orders: ${error instanceof Error ? error.message : String(error)}`
|
|
358
|
+
);
|
|
359
|
+
}
|
|
360
|
+
};
|
|
361
|
+
var bulk_delete2 = async (props) => {
|
|
362
|
+
try {
|
|
363
|
+
const { sdk, ids } = props;
|
|
364
|
+
const adapter = await sdk.adapter();
|
|
365
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
366
|
+
await adapter.orders.bulk_delete({
|
|
367
|
+
connector_config: sdk.options.configuration,
|
|
368
|
+
ids
|
|
369
|
+
});
|
|
370
|
+
return;
|
|
371
|
+
} catch (error) {
|
|
372
|
+
throw new Error(
|
|
373
|
+
`Failed to bulk delete orders: ${error instanceof Error ? error.message : String(error)}`
|
|
374
|
+
);
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
var orders = {
|
|
378
|
+
list: list2,
|
|
379
|
+
retrieve: retrieve2,
|
|
380
|
+
create: create2,
|
|
381
|
+
update: update2,
|
|
382
|
+
delete: _delete2,
|
|
383
|
+
bulk_create: bulk_create2,
|
|
384
|
+
bulk_update: bulk_update2,
|
|
385
|
+
bulk_delete: bulk_delete2
|
|
386
|
+
};
|
|
200
387
|
|
|
201
|
-
// src/
|
|
202
|
-
var
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
* URL pattern: {connectorUrl}/{integrationId}/index.js
|
|
215
|
-
*/
|
|
216
|
-
async loadConnector(integrationId) {
|
|
217
|
-
const cacheKey = integrationId;
|
|
218
|
-
if (this.cache.has(cacheKey)) {
|
|
219
|
-
this.logger.debug(`Loaded ${integrationId} from cache`);
|
|
220
|
-
return this.cache.get(cacheKey);
|
|
221
|
-
}
|
|
222
|
-
try {
|
|
223
|
-
this.logger.info(`Loading connector plugin: ${integrationId}`);
|
|
224
|
-
const url = this.buildConnectorUrl(integrationId);
|
|
225
|
-
this.logger.debug(`Fetching from: ${url}`);
|
|
226
|
-
const response = await fetch(url);
|
|
227
|
-
if (!response.ok) {
|
|
228
|
-
throw new Error(
|
|
229
|
-
`Failed to fetch connector: ${response.statusText} (${response.status})`
|
|
230
|
-
);
|
|
231
|
-
}
|
|
232
|
-
const code = await response.text();
|
|
233
|
-
const plugin = await this.instantiatePlugin(code, integrationId);
|
|
234
|
-
this.logger.info(`Successfully loaded ${integrationId}`);
|
|
235
|
-
this.cache.set(cacheKey, plugin);
|
|
236
|
-
return plugin;
|
|
237
|
-
} catch (error) {
|
|
238
|
-
this.logger.error(
|
|
239
|
-
`Failed to load connector ${integrationId}`,
|
|
240
|
-
error
|
|
241
|
-
);
|
|
242
|
-
throw new StallConnectorError(
|
|
243
|
-
`Failed to load connector plugin: ${integrationId}`,
|
|
244
|
-
ErrorCodes.PLUGIN_LOAD_FAILED,
|
|
245
|
-
void 0,
|
|
246
|
-
{ originalError: error.message }
|
|
247
|
-
);
|
|
248
|
-
}
|
|
388
|
+
// src/services/customers.service.ts
|
|
389
|
+
var list3 = async (props) => {
|
|
390
|
+
try {
|
|
391
|
+
const { sdk, query } = props;
|
|
392
|
+
const adapter = await sdk.adapter();
|
|
393
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
394
|
+
const customers2 = await adapter.customers.list({
|
|
395
|
+
connector_config: sdk.options.configuration,
|
|
396
|
+
query
|
|
397
|
+
});
|
|
398
|
+
return customers2;
|
|
399
|
+
} catch (error) {
|
|
400
|
+
throw error;
|
|
249
401
|
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
const pluginModule = fn(
|
|
264
|
-
module2,
|
|
265
|
-
moduleExports,
|
|
266
|
-
this.createRequireProxy()
|
|
267
|
-
);
|
|
268
|
-
const PluginClass = pluginModule.default || pluginModule.Plugin;
|
|
269
|
-
if (!PluginClass) {
|
|
270
|
-
throw new Error("Plugin module does not export a default or Plugin");
|
|
271
|
-
}
|
|
272
|
-
const instance = new PluginClass();
|
|
273
|
-
if (!this.validatePlugin(instance)) {
|
|
274
|
-
throw new Error("Plugin does not implement IConnectorPlugin interface");
|
|
275
|
-
}
|
|
276
|
-
return instance;
|
|
277
|
-
} catch (error) {
|
|
278
|
-
throw new StallConnectorError(
|
|
279
|
-
`Failed to instantiate plugin: ${integrationId}`,
|
|
280
|
-
ErrorCodes.PLUGIN_LOAD_FAILED,
|
|
281
|
-
void 0,
|
|
282
|
-
{ originalError: error.message }
|
|
283
|
-
);
|
|
284
|
-
}
|
|
402
|
+
};
|
|
403
|
+
var retrieve3 = async (props) => {
|
|
404
|
+
try {
|
|
405
|
+
const { sdk, id } = props;
|
|
406
|
+
const adapter = await sdk.adapter();
|
|
407
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
408
|
+
const customer = await adapter.customers.retrieve({
|
|
409
|
+
connector_config: sdk.options.configuration,
|
|
410
|
+
id
|
|
411
|
+
});
|
|
412
|
+
return customer;
|
|
413
|
+
} catch (error) {
|
|
414
|
+
throw error;
|
|
285
415
|
}
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
const
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
416
|
+
};
|
|
417
|
+
var create3 = async (props) => {
|
|
418
|
+
try {
|
|
419
|
+
const { sdk, data } = props;
|
|
420
|
+
const adapter = await sdk.adapter();
|
|
421
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
422
|
+
const customer = await adapter.customers.create({
|
|
423
|
+
connector_config: sdk.options.configuration,
|
|
424
|
+
data
|
|
425
|
+
});
|
|
426
|
+
return customer;
|
|
427
|
+
} catch (error) {
|
|
428
|
+
throw error;
|
|
429
|
+
}
|
|
430
|
+
};
|
|
431
|
+
var update3 = async (props) => {
|
|
432
|
+
try {
|
|
433
|
+
const { sdk, id, data } = props;
|
|
434
|
+
const adapter = await sdk.adapter();
|
|
435
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
436
|
+
const customer = await adapter.customers.update({
|
|
437
|
+
connector_config: sdk.options.configuration,
|
|
438
|
+
id,
|
|
439
|
+
data
|
|
440
|
+
});
|
|
441
|
+
return customer;
|
|
442
|
+
} catch (error) {
|
|
443
|
+
throw error;
|
|
444
|
+
}
|
|
445
|
+
};
|
|
446
|
+
var _delete3 = async (props) => {
|
|
447
|
+
try {
|
|
448
|
+
const { sdk, id } = props;
|
|
449
|
+
const adapter = await sdk.adapter();
|
|
450
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
451
|
+
await adapter.customers.delete({
|
|
452
|
+
connector_config: sdk.options.configuration,
|
|
453
|
+
id
|
|
454
|
+
});
|
|
455
|
+
return;
|
|
456
|
+
} catch (error) {
|
|
457
|
+
throw error;
|
|
458
|
+
}
|
|
459
|
+
};
|
|
460
|
+
var bulk_create3 = async (props) => {
|
|
461
|
+
try {
|
|
462
|
+
const { sdk, data } = props;
|
|
463
|
+
const adapter = await sdk.adapter();
|
|
464
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
465
|
+
const customers2 = await adapter.customers.bulk_create({
|
|
466
|
+
connector_config: sdk.options.configuration,
|
|
467
|
+
data
|
|
468
|
+
});
|
|
469
|
+
return customers2;
|
|
470
|
+
} catch (error) {
|
|
471
|
+
throw error;
|
|
472
|
+
}
|
|
473
|
+
};
|
|
474
|
+
var bulk_update3 = async (props) => {
|
|
475
|
+
try {
|
|
476
|
+
const { sdk, data } = props;
|
|
477
|
+
const adapter = await sdk.adapter();
|
|
478
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
479
|
+
const customers2 = await adapter.customers.bulk_update({
|
|
480
|
+
connector_config: sdk.options.configuration,
|
|
481
|
+
data
|
|
482
|
+
});
|
|
483
|
+
return customers2;
|
|
484
|
+
} catch (error) {
|
|
485
|
+
throw error;
|
|
486
|
+
}
|
|
487
|
+
};
|
|
488
|
+
var bulk_delete3 = async (props) => {
|
|
489
|
+
try {
|
|
490
|
+
const { sdk, ids } = props;
|
|
491
|
+
const adapter = await sdk.adapter();
|
|
492
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
493
|
+
await adapter.customers.bulk_delete({
|
|
494
|
+
connector_config: sdk.options.configuration,
|
|
495
|
+
ids
|
|
496
|
+
});
|
|
497
|
+
return;
|
|
498
|
+
} catch (error) {
|
|
499
|
+
throw error;
|
|
340
500
|
}
|
|
341
501
|
};
|
|
502
|
+
var customers = {
|
|
503
|
+
list: list3,
|
|
504
|
+
retrieve: retrieve3,
|
|
505
|
+
create: create3,
|
|
506
|
+
update: update3,
|
|
507
|
+
delete: _delete3,
|
|
508
|
+
bulk_create: bulk_create3,
|
|
509
|
+
bulk_update: bulk_update3,
|
|
510
|
+
bulk_delete: bulk_delete3
|
|
511
|
+
};
|
|
342
512
|
|
|
343
|
-
// src/
|
|
344
|
-
var
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
try {
|
|
357
|
-
if (!plugin) {
|
|
358
|
-
const connectorUrl = options.options?.connectorUrl || "https://connectors.myapp.xyz";
|
|
359
|
-
this.connectorLoader = new ConnectorLoader({
|
|
360
|
-
connectorUrl,
|
|
361
|
-
cache: options.options?.cachePlugins !== false
|
|
362
|
-
});
|
|
363
|
-
plugin = await this.connectorLoader.loadConnector(
|
|
364
|
-
options.integration_id
|
|
365
|
-
);
|
|
366
|
-
}
|
|
367
|
-
if (!plugin) {
|
|
368
|
-
throw new StallConnectorError(
|
|
369
|
-
"Failed to load connector plugin",
|
|
370
|
-
ErrorCodes.PLUGIN_NOT_FOUND
|
|
371
|
-
);
|
|
372
|
-
}
|
|
373
|
-
this.plugin = plugin;
|
|
374
|
-
const pluginConfig = {
|
|
375
|
-
connectorId: options.id,
|
|
376
|
-
integrationId: options.integration_id,
|
|
377
|
-
organizationId: options.id,
|
|
378
|
-
// Use the config id as org context
|
|
379
|
-
configuration: options.configuration,
|
|
380
|
-
options: options.options
|
|
381
|
-
};
|
|
382
|
-
await this.plugin.initialize(pluginConfig);
|
|
383
|
-
this.logger.info(
|
|
384
|
-
`Plugin initialized: ${this.plugin.metadata.name}@${this.plugin.metadata.version}`
|
|
385
|
-
);
|
|
386
|
-
this.initialized = true;
|
|
387
|
-
} catch (error) {
|
|
388
|
-
this.logger.error("Failed to initialize plugin manager", error);
|
|
389
|
-
throw error;
|
|
390
|
-
}
|
|
513
|
+
// src/services/collections.service.ts
|
|
514
|
+
var list4 = async (props) => {
|
|
515
|
+
try {
|
|
516
|
+
const { sdk, query } = props;
|
|
517
|
+
const adapter = await sdk.adapter();
|
|
518
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
519
|
+
const collections2 = await adapter.collections.list({
|
|
520
|
+
connector_config: sdk.options.configuration,
|
|
521
|
+
query
|
|
522
|
+
});
|
|
523
|
+
return collections2;
|
|
524
|
+
} catch (error) {
|
|
525
|
+
throw error;
|
|
391
526
|
}
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
}
|
|
402
|
-
return
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
* Check if plugin is initialized
|
|
406
|
-
*/
|
|
407
|
-
isInitialized() {
|
|
408
|
-
return this.initialized && this.plugin !== null;
|
|
409
|
-
}
|
|
410
|
-
/**
|
|
411
|
-
* Verify the plugin configuration
|
|
412
|
-
*/
|
|
413
|
-
async verify() {
|
|
414
|
-
if (!this.isInitialized()) {
|
|
415
|
-
throw new StallConnectorError(
|
|
416
|
-
"Plugin not initialized",
|
|
417
|
-
ErrorCodes.INVALID_CONFIGURATION
|
|
418
|
-
);
|
|
419
|
-
}
|
|
420
|
-
const result = await this.plugin.verify();
|
|
421
|
-
return result.success && result.data === true;
|
|
422
|
-
}
|
|
423
|
-
/**
|
|
424
|
-
* Get metadata about the loaded plugin
|
|
425
|
-
*/
|
|
426
|
-
getMetadata() {
|
|
427
|
-
if (!this.plugin) {
|
|
428
|
-
throw new StallConnectorError(
|
|
429
|
-
"Plugin not initialized",
|
|
430
|
-
ErrorCodes.INVALID_CONFIGURATION
|
|
431
|
-
);
|
|
432
|
-
}
|
|
433
|
-
return {
|
|
434
|
-
id: this.plugin.metadata.id,
|
|
435
|
-
name: this.plugin.metadata.name,
|
|
436
|
-
version: this.plugin.metadata.version,
|
|
437
|
-
description: this.plugin.metadata.description,
|
|
438
|
-
supportedModules: this.plugin.getSupportedModules()
|
|
439
|
-
};
|
|
440
|
-
}
|
|
441
|
-
/**
|
|
442
|
-
* Check if a module is supported
|
|
443
|
-
*/
|
|
444
|
-
isModuleSupported(module2) {
|
|
445
|
-
if (!this.plugin) return false;
|
|
446
|
-
return this.plugin.getSupportedModules().includes(module2);
|
|
447
|
-
}
|
|
448
|
-
/**
|
|
449
|
-
* Clear plugin cache (if using remote loading)
|
|
450
|
-
*/
|
|
451
|
-
clearCache() {
|
|
452
|
-
if (this.connectorLoader) {
|
|
453
|
-
this.connectorLoader.clearCache();
|
|
454
|
-
this.logger.info("Plugin cache cleared");
|
|
455
|
-
}
|
|
527
|
+
};
|
|
528
|
+
var retrieve4 = async (props) => {
|
|
529
|
+
try {
|
|
530
|
+
const { sdk, id } = props;
|
|
531
|
+
const adapter = await sdk.adapter();
|
|
532
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
533
|
+
const collection = await adapter.collections.retrieve({
|
|
534
|
+
connector_config: sdk.options.configuration,
|
|
535
|
+
id
|
|
536
|
+
});
|
|
537
|
+
return collection;
|
|
538
|
+
} catch (error) {
|
|
539
|
+
throw error;
|
|
456
540
|
}
|
|
457
541
|
};
|
|
542
|
+
var create4 = async (props) => {
|
|
543
|
+
try {
|
|
544
|
+
const { sdk, data } = props;
|
|
545
|
+
const adapter = await sdk.adapter();
|
|
546
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
547
|
+
const collection = await adapter.collections.create({
|
|
548
|
+
connector_config: sdk.options.configuration,
|
|
549
|
+
data
|
|
550
|
+
});
|
|
551
|
+
return collection;
|
|
552
|
+
} catch (error) {
|
|
553
|
+
throw error;
|
|
554
|
+
}
|
|
555
|
+
};
|
|
556
|
+
var update4 = async (props) => {
|
|
557
|
+
try {
|
|
558
|
+
const { sdk, id, data } = props;
|
|
559
|
+
const adapter = await sdk.adapter();
|
|
560
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
561
|
+
const collection = await adapter.collections.update({
|
|
562
|
+
connector_config: sdk.options.configuration,
|
|
563
|
+
id,
|
|
564
|
+
data
|
|
565
|
+
});
|
|
566
|
+
return collection;
|
|
567
|
+
} catch (error) {
|
|
568
|
+
throw error;
|
|
569
|
+
}
|
|
570
|
+
};
|
|
571
|
+
var _delete4 = async (props) => {
|
|
572
|
+
try {
|
|
573
|
+
const { sdk, id } = props;
|
|
574
|
+
const adapter = await sdk.adapter();
|
|
575
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
576
|
+
await adapter.collections.delete({
|
|
577
|
+
connector_config: sdk.options.configuration,
|
|
578
|
+
id
|
|
579
|
+
});
|
|
580
|
+
return;
|
|
581
|
+
} catch (error) {
|
|
582
|
+
throw error;
|
|
583
|
+
}
|
|
584
|
+
};
|
|
585
|
+
var bulk_create4 = async (props) => {
|
|
586
|
+
try {
|
|
587
|
+
const { sdk, data } = props;
|
|
588
|
+
const adapter = await sdk.adapter();
|
|
589
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
590
|
+
const collections2 = await adapter.collections.bulk_create({
|
|
591
|
+
connector_config: sdk.options.configuration,
|
|
592
|
+
data
|
|
593
|
+
});
|
|
594
|
+
return collections2;
|
|
595
|
+
} catch (error) {
|
|
596
|
+
throw error;
|
|
597
|
+
}
|
|
598
|
+
};
|
|
599
|
+
var bulk_update4 = async (props) => {
|
|
600
|
+
try {
|
|
601
|
+
const { sdk, data } = props;
|
|
602
|
+
const adapter = await sdk.adapter();
|
|
603
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
604
|
+
const collections2 = await adapter.collections.bulk_update({
|
|
605
|
+
connector_config: sdk.options.configuration,
|
|
606
|
+
data
|
|
607
|
+
});
|
|
608
|
+
return collections2;
|
|
609
|
+
} catch (error) {
|
|
610
|
+
throw error;
|
|
611
|
+
}
|
|
612
|
+
};
|
|
613
|
+
var bulk_delete4 = async (props) => {
|
|
614
|
+
try {
|
|
615
|
+
const { sdk, ids } = props;
|
|
616
|
+
const adapter = await sdk.adapter();
|
|
617
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
618
|
+
await adapter.collections.bulk_delete({
|
|
619
|
+
connector_config: sdk.options.configuration,
|
|
620
|
+
ids
|
|
621
|
+
});
|
|
622
|
+
return;
|
|
623
|
+
} catch (error) {
|
|
624
|
+
throw error;
|
|
625
|
+
}
|
|
626
|
+
};
|
|
627
|
+
var collections = {
|
|
628
|
+
list: list4,
|
|
629
|
+
retrieve: retrieve4,
|
|
630
|
+
create: create4,
|
|
631
|
+
update: update4,
|
|
632
|
+
delete: _delete4,
|
|
633
|
+
bulk_create: bulk_create4,
|
|
634
|
+
bulk_update: bulk_update4,
|
|
635
|
+
bulk_delete: bulk_delete4
|
|
636
|
+
};
|
|
458
637
|
|
|
459
|
-
// src/services/
|
|
460
|
-
var
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
async executeOperation(operation, fn) {
|
|
473
|
-
const requestId = generateRequestId();
|
|
474
|
-
const startTime = Date.now();
|
|
475
|
-
try {
|
|
476
|
-
this.logger.debug(`[${requestId}] Starting operation: ${operation}`);
|
|
477
|
-
const result = await fn();
|
|
478
|
-
const duration = Date.now() - startTime;
|
|
479
|
-
this.logger.info(
|
|
480
|
-
`[${requestId}] Operation completed: ${operation} (${duration}ms)`,
|
|
481
|
-
{ success: result.success }
|
|
482
|
-
);
|
|
483
|
-
return {
|
|
484
|
-
...result,
|
|
485
|
-
metadata: {
|
|
486
|
-
...result.metadata,
|
|
487
|
-
connector_id: this.connectorId,
|
|
488
|
-
operation,
|
|
489
|
-
timestamp: Date.now(),
|
|
490
|
-
request_id: requestId
|
|
491
|
-
}
|
|
492
|
-
};
|
|
493
|
-
} catch (error) {
|
|
494
|
-
const duration = Date.now() - startTime;
|
|
495
|
-
this.logger.error(
|
|
496
|
-
`[${requestId}] Operation failed: ${operation} (${duration}ms)`,
|
|
497
|
-
error
|
|
498
|
-
);
|
|
499
|
-
return createErrorResponse(
|
|
500
|
-
error,
|
|
501
|
-
operation,
|
|
502
|
-
this.connectorId
|
|
503
|
-
);
|
|
504
|
-
}
|
|
638
|
+
// src/services/categories.service.ts
|
|
639
|
+
var list5 = async (props) => {
|
|
640
|
+
try {
|
|
641
|
+
const { sdk, query } = props;
|
|
642
|
+
const adapter = await sdk.adapter();
|
|
643
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
644
|
+
const categories2 = await adapter.categories.list({
|
|
645
|
+
connector_config: sdk.options.configuration,
|
|
646
|
+
query
|
|
647
|
+
});
|
|
648
|
+
return categories2;
|
|
649
|
+
} catch (error) {
|
|
650
|
+
throw error;
|
|
505
651
|
}
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
return
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
652
|
+
};
|
|
653
|
+
var retrieve5 = async (props) => {
|
|
654
|
+
try {
|
|
655
|
+
const { sdk, id } = props;
|
|
656
|
+
const adapter = await sdk.adapter();
|
|
657
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
658
|
+
const category = await adapter.categories.retrieve({
|
|
659
|
+
connector_config: sdk.options.configuration,
|
|
660
|
+
id
|
|
661
|
+
});
|
|
662
|
+
return category;
|
|
663
|
+
} catch (error) {
|
|
664
|
+
throw error;
|
|
665
|
+
}
|
|
666
|
+
};
|
|
667
|
+
var create5 = async (props) => {
|
|
668
|
+
try {
|
|
669
|
+
const { sdk, data } = props;
|
|
670
|
+
const adapter = await sdk.adapter();
|
|
671
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
672
|
+
const category = await adapter.categories.create({
|
|
673
|
+
connector_config: sdk.options.configuration,
|
|
674
|
+
data
|
|
675
|
+
});
|
|
676
|
+
return category;
|
|
677
|
+
} catch (error) {
|
|
678
|
+
throw error;
|
|
679
|
+
}
|
|
680
|
+
};
|
|
681
|
+
var update5 = async (props) => {
|
|
682
|
+
try {
|
|
683
|
+
const { sdk, id, data } = props;
|
|
684
|
+
const adapter = await sdk.adapter();
|
|
685
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
686
|
+
const category = await adapter.categories.update({
|
|
687
|
+
connector_config: sdk.options.configuration,
|
|
688
|
+
id,
|
|
689
|
+
data
|
|
690
|
+
});
|
|
691
|
+
return category;
|
|
692
|
+
} catch (error) {
|
|
693
|
+
throw error;
|
|
694
|
+
}
|
|
695
|
+
};
|
|
696
|
+
var _delete5 = async (props) => {
|
|
697
|
+
try {
|
|
698
|
+
const { sdk, id } = props;
|
|
699
|
+
const adapter = await sdk.adapter();
|
|
700
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
701
|
+
await adapter.categories.delete({
|
|
702
|
+
connector_config: sdk.options.configuration,
|
|
703
|
+
id
|
|
704
|
+
});
|
|
705
|
+
return;
|
|
706
|
+
} catch (error) {
|
|
707
|
+
throw error;
|
|
708
|
+
}
|
|
709
|
+
};
|
|
710
|
+
var bulk_create5 = async (props) => {
|
|
711
|
+
try {
|
|
712
|
+
const { sdk, data } = props;
|
|
713
|
+
const adapter = await sdk.adapter();
|
|
714
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
715
|
+
const categories2 = await adapter.categories.bulk_create({
|
|
716
|
+
connector_config: sdk.options.configuration,
|
|
717
|
+
data
|
|
718
|
+
});
|
|
719
|
+
return categories2;
|
|
720
|
+
} catch (error) {
|
|
721
|
+
throw error;
|
|
722
|
+
}
|
|
723
|
+
};
|
|
724
|
+
var bulk_update5 = async (props) => {
|
|
725
|
+
try {
|
|
726
|
+
const { sdk, data } = props;
|
|
727
|
+
const adapter = await sdk.adapter();
|
|
728
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
729
|
+
const categories2 = await adapter.categories.bulk_update({
|
|
730
|
+
connector_config: sdk.options.configuration,
|
|
731
|
+
data
|
|
732
|
+
});
|
|
733
|
+
return categories2;
|
|
734
|
+
} catch (error) {
|
|
735
|
+
throw error;
|
|
736
|
+
}
|
|
737
|
+
};
|
|
738
|
+
var bulk_delete5 = async (props) => {
|
|
739
|
+
try {
|
|
740
|
+
const { sdk, ids } = props;
|
|
741
|
+
const adapter = await sdk.adapter();
|
|
742
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
743
|
+
await adapter.categories.bulk_delete({
|
|
744
|
+
connector_config: sdk.options.configuration,
|
|
745
|
+
ids
|
|
746
|
+
});
|
|
747
|
+
return;
|
|
748
|
+
} catch (error) {
|
|
749
|
+
throw error;
|
|
528
750
|
}
|
|
529
751
|
};
|
|
752
|
+
var categories = {
|
|
753
|
+
list: list5,
|
|
754
|
+
retrieve: retrieve5,
|
|
755
|
+
create: create5,
|
|
756
|
+
update: update5,
|
|
757
|
+
delete: _delete5,
|
|
758
|
+
bulk_create: bulk_create5,
|
|
759
|
+
bulk_update: bulk_update5,
|
|
760
|
+
bulk_delete: bulk_delete5
|
|
761
|
+
};
|
|
530
762
|
|
|
531
|
-
// src/services/
|
|
532
|
-
var
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
error: {
|
|
584
|
-
code: "MODULE_NOT_SUPPORTED",
|
|
585
|
-
message: "Orders module is not supported by this connector"
|
|
586
|
-
}
|
|
587
|
-
};
|
|
588
|
-
}
|
|
589
|
-
const plugin = this.getPlugin();
|
|
590
|
-
return plugin.orders.update(orderId, order);
|
|
591
|
-
});
|
|
592
|
-
}
|
|
593
|
-
/**
|
|
594
|
-
* Delete/cancel an order
|
|
595
|
-
*/
|
|
596
|
-
async deleteOrder(orderId) {
|
|
597
|
-
return this.executeOperation("orders.delete", async () => {
|
|
598
|
-
this.ensurePluginInitialized();
|
|
599
|
-
if (!this.isModuleSupported("orders")) {
|
|
600
|
-
return {
|
|
601
|
-
success: false,
|
|
602
|
-
error: {
|
|
603
|
-
code: "MODULE_NOT_SUPPORTED",
|
|
604
|
-
message: "Orders module is not supported by this connector"
|
|
605
|
-
}
|
|
606
|
-
};
|
|
607
|
-
}
|
|
608
|
-
const plugin = this.getPlugin();
|
|
609
|
-
return plugin.orders.delete(orderId);
|
|
610
|
-
});
|
|
611
|
-
}
|
|
612
|
-
/**
|
|
613
|
-
* List orders with optional filtering
|
|
614
|
-
*/
|
|
615
|
-
async listOrders(options) {
|
|
616
|
-
return this.executeOperation("orders.list", async () => {
|
|
617
|
-
this.ensurePluginInitialized();
|
|
618
|
-
if (!this.isModuleSupported("orders")) {
|
|
619
|
-
return {
|
|
620
|
-
success: false,
|
|
621
|
-
error: {
|
|
622
|
-
code: "MODULE_NOT_SUPPORTED",
|
|
623
|
-
message: "Orders module is not supported by this connector"
|
|
624
|
-
}
|
|
625
|
-
};
|
|
626
|
-
}
|
|
627
|
-
const plugin = this.getPlugin();
|
|
628
|
-
return plugin.orders.list(options);
|
|
629
|
-
});
|
|
630
|
-
}
|
|
631
|
-
/**
|
|
632
|
-
* Create a refund for an order
|
|
633
|
-
*/
|
|
634
|
-
async createRefund(orderId, refund) {
|
|
635
|
-
return this.executeOperation("refunds.create", async () => {
|
|
636
|
-
this.ensurePluginInitialized();
|
|
637
|
-
if (!this.isModuleSupported("orders")) {
|
|
638
|
-
return {
|
|
639
|
-
success: false,
|
|
640
|
-
error: {
|
|
641
|
-
code: "MODULE_NOT_SUPPORTED",
|
|
642
|
-
message: "Orders module is not supported by this connector"
|
|
643
|
-
}
|
|
644
|
-
};
|
|
645
|
-
}
|
|
646
|
-
const plugin = this.getPlugin();
|
|
647
|
-
return plugin.refunds.create(orderId, refund);
|
|
648
|
-
});
|
|
649
|
-
}
|
|
650
|
-
/**
|
|
651
|
-
* Get a refund by ID
|
|
652
|
-
*/
|
|
653
|
-
async getRefund(refundId) {
|
|
654
|
-
return this.executeOperation("refunds.get", async () => {
|
|
655
|
-
this.ensurePluginInitialized();
|
|
656
|
-
if (!this.isModuleSupported("orders")) {
|
|
657
|
-
return {
|
|
658
|
-
success: false,
|
|
659
|
-
error: {
|
|
660
|
-
code: "MODULE_NOT_SUPPORTED",
|
|
661
|
-
message: "Orders module is not supported by this connector"
|
|
662
|
-
}
|
|
663
|
-
};
|
|
664
|
-
}
|
|
665
|
-
const plugin = this.getPlugin();
|
|
666
|
-
return plugin.refunds.get(refundId);
|
|
667
|
-
});
|
|
668
|
-
}
|
|
669
|
-
/**
|
|
670
|
-
* List refunds for an order
|
|
671
|
-
*/
|
|
672
|
-
async listRefunds(orderId, options) {
|
|
673
|
-
return this.executeOperation("refunds.list", async () => {
|
|
674
|
-
this.ensurePluginInitialized();
|
|
675
|
-
if (!this.isModuleSupported("orders")) {
|
|
676
|
-
return {
|
|
677
|
-
success: false,
|
|
678
|
-
error: {
|
|
679
|
-
code: "MODULE_NOT_SUPPORTED",
|
|
680
|
-
message: "Orders module is not supported by this connector"
|
|
681
|
-
}
|
|
682
|
-
};
|
|
683
|
-
}
|
|
684
|
-
const plugin = this.getPlugin();
|
|
685
|
-
return plugin.refunds.list(orderId, options);
|
|
763
|
+
// src/services/variants.service.ts
|
|
764
|
+
var list6 = async (props) => {
|
|
765
|
+
try {
|
|
766
|
+
const { sdk, query } = props;
|
|
767
|
+
const adapter = await sdk.adapter();
|
|
768
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
769
|
+
const variants2 = await adapter.variants.list({
|
|
770
|
+
connector_config: sdk.options.configuration,
|
|
771
|
+
query
|
|
772
|
+
});
|
|
773
|
+
return variants2;
|
|
774
|
+
} catch (error) {
|
|
775
|
+
throw error;
|
|
776
|
+
}
|
|
777
|
+
};
|
|
778
|
+
var retrieve6 = async (props) => {
|
|
779
|
+
try {
|
|
780
|
+
const { sdk, id } = props;
|
|
781
|
+
const adapter = await sdk.adapter();
|
|
782
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
783
|
+
const variant = await adapter.variants.retrieve({
|
|
784
|
+
connector_config: sdk.options.configuration,
|
|
785
|
+
id
|
|
786
|
+
});
|
|
787
|
+
return variant;
|
|
788
|
+
} catch (error) {
|
|
789
|
+
throw error;
|
|
790
|
+
}
|
|
791
|
+
};
|
|
792
|
+
var create6 = async (props) => {
|
|
793
|
+
try {
|
|
794
|
+
const { sdk, data } = props;
|
|
795
|
+
const adapter = await sdk.adapter();
|
|
796
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
797
|
+
const variant = await adapter.variants.create({
|
|
798
|
+
connector_config: sdk.options.configuration,
|
|
799
|
+
data
|
|
800
|
+
});
|
|
801
|
+
return variant;
|
|
802
|
+
} catch (error) {
|
|
803
|
+
throw error;
|
|
804
|
+
}
|
|
805
|
+
};
|
|
806
|
+
var update6 = async (props) => {
|
|
807
|
+
try {
|
|
808
|
+
const { sdk, id, data } = props;
|
|
809
|
+
const adapter = await sdk.adapter();
|
|
810
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
811
|
+
const variant = await adapter.variants.update({
|
|
812
|
+
connector_config: sdk.options.configuration,
|
|
813
|
+
id,
|
|
814
|
+
data
|
|
686
815
|
});
|
|
816
|
+
return variant;
|
|
817
|
+
} catch (error) {
|
|
818
|
+
throw error;
|
|
687
819
|
}
|
|
688
820
|
};
|
|
821
|
+
var _delete6 = async (props) => {
|
|
822
|
+
try {
|
|
823
|
+
const { sdk, id } = props;
|
|
824
|
+
const adapter = await sdk.adapter();
|
|
825
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
826
|
+
await adapter.variants.delete({
|
|
827
|
+
connector_config: sdk.options.configuration,
|
|
828
|
+
id
|
|
829
|
+
});
|
|
830
|
+
return;
|
|
831
|
+
} catch (error) {
|
|
832
|
+
throw error;
|
|
833
|
+
}
|
|
834
|
+
};
|
|
835
|
+
var bulk_create6 = async (props) => {
|
|
836
|
+
try {
|
|
837
|
+
const { sdk, data } = props;
|
|
838
|
+
const adapter = await sdk.adapter();
|
|
839
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
840
|
+
const variants2 = await adapter.variants.bulk_create({
|
|
841
|
+
connector_config: sdk.options.configuration,
|
|
842
|
+
data
|
|
843
|
+
});
|
|
844
|
+
return variants2;
|
|
845
|
+
} catch (error) {
|
|
846
|
+
throw error;
|
|
847
|
+
}
|
|
848
|
+
};
|
|
849
|
+
var bulk_update6 = async (props) => {
|
|
850
|
+
try {
|
|
851
|
+
const { sdk, data } = props;
|
|
852
|
+
const adapter = await sdk.adapter();
|
|
853
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
854
|
+
const variants2 = await adapter.variants.bulk_update({
|
|
855
|
+
connector_config: sdk.options.configuration,
|
|
856
|
+
data
|
|
857
|
+
});
|
|
858
|
+
return variants2;
|
|
859
|
+
} catch (error) {
|
|
860
|
+
throw error;
|
|
861
|
+
}
|
|
862
|
+
};
|
|
863
|
+
var bulk_delete6 = async (props) => {
|
|
864
|
+
try {
|
|
865
|
+
const { sdk, ids } = props;
|
|
866
|
+
const adapter = await sdk.adapter();
|
|
867
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
868
|
+
await adapter.variants.bulk_delete({
|
|
869
|
+
connector_config: sdk.options.configuration,
|
|
870
|
+
ids
|
|
871
|
+
});
|
|
872
|
+
return;
|
|
873
|
+
} catch (error) {
|
|
874
|
+
throw error;
|
|
875
|
+
}
|
|
876
|
+
};
|
|
877
|
+
var variants = {
|
|
878
|
+
list: list6,
|
|
879
|
+
retrieve: retrieve6,
|
|
880
|
+
create: create6,
|
|
881
|
+
update: update6,
|
|
882
|
+
delete: _delete6,
|
|
883
|
+
bulk_create: bulk_create6,
|
|
884
|
+
bulk_update: bulk_update6,
|
|
885
|
+
bulk_delete: bulk_delete6
|
|
886
|
+
};
|
|
689
887
|
|
|
690
|
-
// src/services/
|
|
691
|
-
var
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
return this.executeOperation("products.create", async () => {
|
|
700
|
-
this.ensurePluginInitialized();
|
|
701
|
-
if (!this.isModuleSupported("products")) {
|
|
702
|
-
return {
|
|
703
|
-
success: false,
|
|
704
|
-
error: {
|
|
705
|
-
code: "MODULE_NOT_SUPPORTED",
|
|
706
|
-
message: "Products module is not supported by this connector"
|
|
707
|
-
}
|
|
708
|
-
};
|
|
709
|
-
}
|
|
710
|
-
const plugin = this.getPlugin();
|
|
711
|
-
return plugin.products.create(product);
|
|
712
|
-
});
|
|
713
|
-
}
|
|
714
|
-
/**
|
|
715
|
-
* Get a product by ID
|
|
716
|
-
*/
|
|
717
|
-
async getProduct(productId) {
|
|
718
|
-
return this.executeOperation("products.get", async () => {
|
|
719
|
-
this.ensurePluginInitialized();
|
|
720
|
-
if (!this.isModuleSupported("products")) {
|
|
721
|
-
return {
|
|
722
|
-
success: false,
|
|
723
|
-
error: {
|
|
724
|
-
code: "MODULE_NOT_SUPPORTED",
|
|
725
|
-
message: "Products module is not supported by this connector"
|
|
726
|
-
}
|
|
727
|
-
};
|
|
728
|
-
}
|
|
729
|
-
const plugin = this.getPlugin();
|
|
730
|
-
return plugin.products.get(productId);
|
|
731
|
-
});
|
|
732
|
-
}
|
|
733
|
-
/**
|
|
734
|
-
* Update an existing product
|
|
735
|
-
*/
|
|
736
|
-
async updateProduct(productId, product) {
|
|
737
|
-
return this.executeOperation("products.update", async () => {
|
|
738
|
-
this.ensurePluginInitialized();
|
|
739
|
-
if (!this.isModuleSupported("products")) {
|
|
740
|
-
return {
|
|
741
|
-
success: false,
|
|
742
|
-
error: {
|
|
743
|
-
code: "MODULE_NOT_SUPPORTED",
|
|
744
|
-
message: "Products module is not supported by this connector"
|
|
745
|
-
}
|
|
746
|
-
};
|
|
747
|
-
}
|
|
748
|
-
const plugin = this.getPlugin();
|
|
749
|
-
return plugin.products.update(productId, product);
|
|
750
|
-
});
|
|
751
|
-
}
|
|
752
|
-
/**
|
|
753
|
-
* Delete a product
|
|
754
|
-
*/
|
|
755
|
-
async deleteProduct(productId) {
|
|
756
|
-
return this.executeOperation("products.delete", async () => {
|
|
757
|
-
this.ensurePluginInitialized();
|
|
758
|
-
if (!this.isModuleSupported("products")) {
|
|
759
|
-
return {
|
|
760
|
-
success: false,
|
|
761
|
-
error: {
|
|
762
|
-
code: "MODULE_NOT_SUPPORTED",
|
|
763
|
-
message: "Products module is not supported by this connector"
|
|
764
|
-
}
|
|
765
|
-
};
|
|
766
|
-
}
|
|
767
|
-
const plugin = this.getPlugin();
|
|
768
|
-
return plugin.products.delete(productId);
|
|
769
|
-
});
|
|
770
|
-
}
|
|
771
|
-
/**
|
|
772
|
-
* List products with optional filtering
|
|
773
|
-
*/
|
|
774
|
-
async listProducts(options) {
|
|
775
|
-
return this.executeOperation("products.list", async () => {
|
|
776
|
-
this.ensurePluginInitialized();
|
|
777
|
-
if (!this.isModuleSupported("products")) {
|
|
778
|
-
return {
|
|
779
|
-
success: false,
|
|
780
|
-
error: {
|
|
781
|
-
code: "MODULE_NOT_SUPPORTED",
|
|
782
|
-
message: "Products module is not supported by this connector"
|
|
783
|
-
}
|
|
784
|
-
};
|
|
785
|
-
}
|
|
786
|
-
const plugin = this.getPlugin();
|
|
787
|
-
return plugin.products.list(options);
|
|
888
|
+
// src/services/inventory-levels.service.ts
|
|
889
|
+
var list7 = async (props) => {
|
|
890
|
+
try {
|
|
891
|
+
const { sdk, query } = props;
|
|
892
|
+
const adapter = await sdk.adapter();
|
|
893
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
894
|
+
const inventories = await adapter.inventory_levels.list({
|
|
895
|
+
connector_config: sdk.options.configuration,
|
|
896
|
+
query
|
|
788
897
|
});
|
|
898
|
+
return inventories;
|
|
899
|
+
} catch (error) {
|
|
900
|
+
throw error;
|
|
789
901
|
}
|
|
790
902
|
};
|
|
903
|
+
var retrieve7 = async (props) => {
|
|
904
|
+
try {
|
|
905
|
+
const { sdk, id } = props;
|
|
906
|
+
const adapter = await sdk.adapter();
|
|
907
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
908
|
+
const inventory = await adapter.inventory_levels.retrieve({
|
|
909
|
+
connector_config: sdk.options.configuration,
|
|
910
|
+
id
|
|
911
|
+
});
|
|
912
|
+
return inventory;
|
|
913
|
+
} catch (error) {
|
|
914
|
+
throw error;
|
|
915
|
+
}
|
|
916
|
+
};
|
|
917
|
+
var create7 = async (props) => {
|
|
918
|
+
try {
|
|
919
|
+
const { sdk, data } = props;
|
|
920
|
+
const adapter = await sdk.adapter();
|
|
921
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
922
|
+
const inventory = await adapter.inventory_levels.create({
|
|
923
|
+
connector_config: sdk.options.configuration,
|
|
924
|
+
data
|
|
925
|
+
});
|
|
926
|
+
return inventory;
|
|
927
|
+
} catch (error) {
|
|
928
|
+
throw error;
|
|
929
|
+
}
|
|
930
|
+
};
|
|
931
|
+
var update7 = async (props) => {
|
|
932
|
+
try {
|
|
933
|
+
const { sdk, id, data } = props;
|
|
934
|
+
const adapter = await sdk.adapter();
|
|
935
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
936
|
+
const inventory = await adapter.inventory_levels.update({
|
|
937
|
+
connector_config: sdk.options.configuration,
|
|
938
|
+
id,
|
|
939
|
+
data
|
|
940
|
+
});
|
|
941
|
+
return inventory;
|
|
942
|
+
} catch (error) {
|
|
943
|
+
throw error;
|
|
944
|
+
}
|
|
945
|
+
};
|
|
946
|
+
var _delete7 = async (props) => {
|
|
947
|
+
try {
|
|
948
|
+
const { sdk, id } = props;
|
|
949
|
+
const adapter = await sdk.adapter();
|
|
950
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
951
|
+
await adapter.inventory_levels.delete({
|
|
952
|
+
connector_config: sdk.options.configuration,
|
|
953
|
+
id
|
|
954
|
+
});
|
|
955
|
+
return;
|
|
956
|
+
} catch (error) {
|
|
957
|
+
throw error;
|
|
958
|
+
}
|
|
959
|
+
};
|
|
960
|
+
var bulk_create7 = async (props) => {
|
|
961
|
+
try {
|
|
962
|
+
const { sdk, data } = props;
|
|
963
|
+
const adapter = await sdk.adapter();
|
|
964
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
965
|
+
const inventories = await adapter.inventory_levels.bulk_create({
|
|
966
|
+
connector_config: sdk.options.configuration,
|
|
967
|
+
data
|
|
968
|
+
});
|
|
969
|
+
return inventories;
|
|
970
|
+
} catch (error) {
|
|
971
|
+
throw error;
|
|
972
|
+
}
|
|
973
|
+
};
|
|
974
|
+
var bulk_update7 = async (props) => {
|
|
975
|
+
try {
|
|
976
|
+
const { sdk, data } = props;
|
|
977
|
+
const adapter = await sdk.adapter();
|
|
978
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
979
|
+
const inventories = await adapter.inventory_levels.bulk_update({
|
|
980
|
+
connector_config: sdk.options.configuration,
|
|
981
|
+
data
|
|
982
|
+
});
|
|
983
|
+
return inventories;
|
|
984
|
+
} catch (error) {
|
|
985
|
+
throw error;
|
|
986
|
+
}
|
|
987
|
+
};
|
|
988
|
+
var bulk_delete7 = async (props) => {
|
|
989
|
+
try {
|
|
990
|
+
const { sdk, ids } = props;
|
|
991
|
+
const adapter = await sdk.adapter();
|
|
992
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
993
|
+
await adapter.inventory_levels.bulk_delete({
|
|
994
|
+
connector_config: sdk.options.configuration,
|
|
995
|
+
ids
|
|
996
|
+
});
|
|
997
|
+
return;
|
|
998
|
+
} catch (error) {
|
|
999
|
+
throw error;
|
|
1000
|
+
}
|
|
1001
|
+
};
|
|
1002
|
+
var inventory_levels = {
|
|
1003
|
+
list: list7,
|
|
1004
|
+
retrieve: retrieve7,
|
|
1005
|
+
create: create7,
|
|
1006
|
+
update: update7,
|
|
1007
|
+
delete: _delete7,
|
|
1008
|
+
bulk_create: bulk_create7,
|
|
1009
|
+
bulk_update: bulk_update7,
|
|
1010
|
+
bulk_delete: bulk_delete7
|
|
1011
|
+
};
|
|
791
1012
|
|
|
792
|
-
// src/
|
|
793
|
-
var
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
this.orders = new OrdersService(this.pluginManager, options.id);
|
|
806
|
-
this.products = new ProductsService(this.pluginManager, options.id);
|
|
807
|
-
}
|
|
808
|
-
/**
|
|
809
|
-
* Firebase-style initialization with automatic plugin loading
|
|
810
|
-
* Loads connector from public URL: {connectorUrl}/{integration_id}/index.js
|
|
811
|
-
* Default URL: https://connectors.myapp.xyz
|
|
812
|
-
*/
|
|
813
|
-
static async initialize(options) {
|
|
814
|
-
const sdk = new _StallCore(options);
|
|
815
|
-
try {
|
|
816
|
-
await sdk.pluginManager.initialize(null, options);
|
|
817
|
-
sdk.logger.info("StallSDK initialized successfully");
|
|
818
|
-
} catch (error) {
|
|
819
|
-
sdk.logger.error("Failed to initialize StallSDK", error);
|
|
820
|
-
throw error;
|
|
821
|
-
}
|
|
822
|
-
return sdk;
|
|
823
|
-
}
|
|
824
|
-
/**
|
|
825
|
-
* Initialize with a provided plugin instance (for testing/custom plugins)
|
|
826
|
-
* Useful for mock plugins or custom implementations
|
|
827
|
-
*/
|
|
828
|
-
static async initializeWithPlugin(options, plugin) {
|
|
829
|
-
const sdk = new _StallCore(options);
|
|
830
|
-
try {
|
|
831
|
-
await sdk.pluginManager.initialize(plugin, options);
|
|
832
|
-
sdk.logger.info("StallSDK initialized with custom plugin");
|
|
833
|
-
} catch (error) {
|
|
834
|
-
sdk.logger.error("Failed to initialize StallSDK", error);
|
|
835
|
-
throw error;
|
|
836
|
-
}
|
|
837
|
-
return sdk;
|
|
838
|
-
}
|
|
839
|
-
/**
|
|
840
|
-
* Get plugin metadata
|
|
841
|
-
*/
|
|
842
|
-
getMetadata() {
|
|
843
|
-
return this.pluginManager.getMetadata();
|
|
844
|
-
}
|
|
845
|
-
/**
|
|
846
|
-
* Verify the connector configuration
|
|
847
|
-
*/
|
|
848
|
-
async verify() {
|
|
849
|
-
return this.pluginManager.verify();
|
|
850
|
-
}
|
|
851
|
-
/**
|
|
852
|
-
* Check if a module is supported
|
|
853
|
-
*/
|
|
854
|
-
isModuleSupported(module2) {
|
|
855
|
-
return this.pluginManager.isModuleSupported(module2);
|
|
856
|
-
}
|
|
857
|
-
/**
|
|
858
|
-
* Check if SDK is initialized
|
|
859
|
-
*/
|
|
860
|
-
isInitialized() {
|
|
861
|
-
return this.pluginManager.isInitialized();
|
|
862
|
-
}
|
|
863
|
-
/**
|
|
864
|
-
* Clear plugin cache
|
|
865
|
-
*/
|
|
866
|
-
clearCache() {
|
|
867
|
-
this.pluginManager.clearCache();
|
|
868
|
-
}
|
|
869
|
-
/**
|
|
870
|
-
* Get the underlying plugin instance
|
|
871
|
-
*/
|
|
872
|
-
getPlugin() {
|
|
873
|
-
return this.pluginManager.getPlugin();
|
|
874
|
-
}
|
|
875
|
-
/**
|
|
876
|
-
* Get SDK configuration
|
|
877
|
-
*/
|
|
878
|
-
getConfiguration() {
|
|
879
|
-
return {
|
|
880
|
-
id: this.options.id,
|
|
881
|
-
integration_id: this.options.integration_id,
|
|
882
|
-
created_at: this.options.created_at,
|
|
883
|
-
updated_at: this.options.updated_at
|
|
884
|
-
};
|
|
1013
|
+
// src/services/promotions.service.ts
|
|
1014
|
+
var list8 = async (props) => {
|
|
1015
|
+
try {
|
|
1016
|
+
const { sdk, query } = props;
|
|
1017
|
+
const adapter = await sdk.adapter();
|
|
1018
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1019
|
+
const promotions2 = await adapter.promotions.list({
|
|
1020
|
+
connector_config: sdk.options.configuration,
|
|
1021
|
+
query
|
|
1022
|
+
});
|
|
1023
|
+
return promotions2;
|
|
1024
|
+
} catch (error) {
|
|
1025
|
+
throw error;
|
|
885
1026
|
}
|
|
886
1027
|
};
|
|
1028
|
+
var retrieve8 = async (props) => {
|
|
1029
|
+
try {
|
|
1030
|
+
const { sdk, id } = props;
|
|
1031
|
+
const adapter = await sdk.adapter();
|
|
1032
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1033
|
+
const promotion = await adapter.promotions.retrieve({
|
|
1034
|
+
connector_config: sdk.options.configuration,
|
|
1035
|
+
id
|
|
1036
|
+
});
|
|
1037
|
+
return promotion;
|
|
1038
|
+
} catch (error) {
|
|
1039
|
+
throw error;
|
|
1040
|
+
}
|
|
1041
|
+
};
|
|
1042
|
+
var create8 = async (props) => {
|
|
1043
|
+
try {
|
|
1044
|
+
const { sdk, data } = props;
|
|
1045
|
+
const adapter = await sdk.adapter();
|
|
1046
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1047
|
+
const promotion = await adapter.promotions.create({
|
|
1048
|
+
connector_config: sdk.options.configuration,
|
|
1049
|
+
data
|
|
1050
|
+
});
|
|
1051
|
+
return promotion;
|
|
1052
|
+
} catch (error) {
|
|
1053
|
+
throw error;
|
|
1054
|
+
}
|
|
1055
|
+
};
|
|
1056
|
+
var update8 = async (props) => {
|
|
1057
|
+
try {
|
|
1058
|
+
const { sdk, id, data } = props;
|
|
1059
|
+
const adapter = await sdk.adapter();
|
|
1060
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1061
|
+
const promotion = await adapter.promotions.update({
|
|
1062
|
+
connector_config: sdk.options.configuration,
|
|
1063
|
+
id,
|
|
1064
|
+
data
|
|
1065
|
+
});
|
|
1066
|
+
return promotion;
|
|
1067
|
+
} catch (error) {
|
|
1068
|
+
throw error;
|
|
1069
|
+
}
|
|
1070
|
+
};
|
|
1071
|
+
var _delete8 = async (props) => {
|
|
1072
|
+
try {
|
|
1073
|
+
const { sdk, id } = props;
|
|
1074
|
+
const adapter = await sdk.adapter();
|
|
1075
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1076
|
+
await adapter.promotions.delete({
|
|
1077
|
+
connector_config: sdk.options.configuration,
|
|
1078
|
+
id
|
|
1079
|
+
});
|
|
1080
|
+
return;
|
|
1081
|
+
} catch (error) {
|
|
1082
|
+
throw error;
|
|
1083
|
+
}
|
|
1084
|
+
};
|
|
1085
|
+
var bulk_create8 = async (props) => {
|
|
1086
|
+
try {
|
|
1087
|
+
const { sdk, data } = props;
|
|
1088
|
+
const adapter = await sdk.adapter();
|
|
1089
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1090
|
+
const promotions2 = await adapter.promotions.bulk_create({
|
|
1091
|
+
connector_config: sdk.options.configuration,
|
|
1092
|
+
data
|
|
1093
|
+
});
|
|
1094
|
+
return promotions2;
|
|
1095
|
+
} catch (error) {
|
|
1096
|
+
throw error;
|
|
1097
|
+
}
|
|
1098
|
+
};
|
|
1099
|
+
var bulk_update8 = async (props) => {
|
|
1100
|
+
try {
|
|
1101
|
+
const { sdk, data } = props;
|
|
1102
|
+
const adapter = await sdk.adapter();
|
|
1103
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1104
|
+
const promotions2 = await adapter.promotions.bulk_update({
|
|
1105
|
+
connector_config: sdk.options.configuration,
|
|
1106
|
+
data
|
|
1107
|
+
});
|
|
1108
|
+
return promotions2;
|
|
1109
|
+
} catch (error) {
|
|
1110
|
+
throw error;
|
|
1111
|
+
}
|
|
1112
|
+
};
|
|
1113
|
+
var bulk_delete8 = async (props) => {
|
|
1114
|
+
try {
|
|
1115
|
+
const { sdk, ids } = props;
|
|
1116
|
+
const adapter = await sdk.adapter();
|
|
1117
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1118
|
+
await adapter.promotions.bulk_delete({
|
|
1119
|
+
connector_config: sdk.options.configuration,
|
|
1120
|
+
ids
|
|
1121
|
+
});
|
|
1122
|
+
return;
|
|
1123
|
+
} catch (error) {
|
|
1124
|
+
throw error;
|
|
1125
|
+
}
|
|
1126
|
+
};
|
|
1127
|
+
var promotions = {
|
|
1128
|
+
list: list8,
|
|
1129
|
+
retrieve: retrieve8,
|
|
1130
|
+
create: create8,
|
|
1131
|
+
update: update8,
|
|
1132
|
+
delete: _delete8,
|
|
1133
|
+
bulk_create: bulk_create8,
|
|
1134
|
+
bulk_update: bulk_update8,
|
|
1135
|
+
bulk_delete: bulk_delete8
|
|
1136
|
+
};
|
|
887
1137
|
|
|
888
|
-
// src/
|
|
889
|
-
var
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
}
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
}
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
}
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
}
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
data
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
data
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
data
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
}
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
}
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
}
|
|
1301
|
-
|
|
1138
|
+
// src/services/order-notes.service.ts
|
|
1139
|
+
var list9 = async (props) => {
|
|
1140
|
+
try {
|
|
1141
|
+
const { sdk, query } = props;
|
|
1142
|
+
const adapter = await sdk.adapter();
|
|
1143
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1144
|
+
const notes = await adapter.order_notes.list({
|
|
1145
|
+
connector_config: sdk.options.configuration,
|
|
1146
|
+
query
|
|
1147
|
+
});
|
|
1148
|
+
return notes;
|
|
1149
|
+
} catch (error) {
|
|
1150
|
+
throw error;
|
|
1151
|
+
}
|
|
1152
|
+
};
|
|
1153
|
+
var retrieve9 = async (props) => {
|
|
1154
|
+
try {
|
|
1155
|
+
const { sdk, id } = props;
|
|
1156
|
+
const adapter = await sdk.adapter();
|
|
1157
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1158
|
+
const note = await adapter.order_notes.retrieve({
|
|
1159
|
+
connector_config: sdk.options.configuration,
|
|
1160
|
+
id
|
|
1161
|
+
});
|
|
1162
|
+
return note;
|
|
1163
|
+
} catch (error) {
|
|
1164
|
+
throw error;
|
|
1165
|
+
}
|
|
1166
|
+
};
|
|
1167
|
+
var create9 = async (props) => {
|
|
1168
|
+
try {
|
|
1169
|
+
const { sdk, data } = props;
|
|
1170
|
+
const adapter = await sdk.adapter();
|
|
1171
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1172
|
+
const note = await adapter.order_notes.create({
|
|
1173
|
+
connector_config: sdk.options.configuration,
|
|
1174
|
+
data
|
|
1175
|
+
});
|
|
1176
|
+
return note;
|
|
1177
|
+
} catch (error) {
|
|
1178
|
+
throw error;
|
|
1179
|
+
}
|
|
1180
|
+
};
|
|
1181
|
+
var update9 = async (props) => {
|
|
1182
|
+
try {
|
|
1183
|
+
const { sdk, id, data } = props;
|
|
1184
|
+
const adapter = await sdk.adapter();
|
|
1185
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1186
|
+
const note = await adapter.order_notes.update({
|
|
1187
|
+
connector_config: sdk.options.configuration,
|
|
1188
|
+
id,
|
|
1189
|
+
data
|
|
1190
|
+
});
|
|
1191
|
+
return note;
|
|
1192
|
+
} catch (error) {
|
|
1193
|
+
throw error;
|
|
1194
|
+
}
|
|
1195
|
+
};
|
|
1196
|
+
var _delete9 = async (props) => {
|
|
1197
|
+
try {
|
|
1198
|
+
const { sdk, id } = props;
|
|
1199
|
+
const adapter = await sdk.adapter();
|
|
1200
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1201
|
+
await adapter.order_notes.delete({
|
|
1202
|
+
connector_config: sdk.options.configuration,
|
|
1203
|
+
id
|
|
1204
|
+
});
|
|
1205
|
+
return;
|
|
1206
|
+
} catch (error) {
|
|
1207
|
+
throw error;
|
|
1208
|
+
}
|
|
1209
|
+
};
|
|
1210
|
+
var bulk_create9 = async (props) => {
|
|
1211
|
+
try {
|
|
1212
|
+
const { sdk, data } = props;
|
|
1213
|
+
const adapter = await sdk.adapter();
|
|
1214
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1215
|
+
const notes = await adapter.order_notes.bulk_create({
|
|
1216
|
+
connector_config: sdk.options.configuration,
|
|
1217
|
+
data
|
|
1218
|
+
});
|
|
1219
|
+
return notes;
|
|
1220
|
+
} catch (error) {
|
|
1221
|
+
throw error;
|
|
1222
|
+
}
|
|
1223
|
+
};
|
|
1224
|
+
var bulk_update9 = async (props) => {
|
|
1225
|
+
try {
|
|
1226
|
+
const { sdk, data } = props;
|
|
1227
|
+
const adapter = await sdk.adapter();
|
|
1228
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1229
|
+
const notes = await adapter.order_notes.bulk_update({
|
|
1230
|
+
connector_config: sdk.options.configuration,
|
|
1231
|
+
data
|
|
1232
|
+
});
|
|
1233
|
+
return notes;
|
|
1234
|
+
} catch (error) {
|
|
1235
|
+
throw error;
|
|
1236
|
+
}
|
|
1237
|
+
};
|
|
1238
|
+
var bulk_delete9 = async (props) => {
|
|
1239
|
+
try {
|
|
1240
|
+
const { sdk, ids } = props;
|
|
1241
|
+
const adapter = await sdk.adapter();
|
|
1242
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1243
|
+
await adapter.order_notes.bulk_delete({
|
|
1244
|
+
connector_config: sdk.options.configuration,
|
|
1245
|
+
ids
|
|
1246
|
+
});
|
|
1247
|
+
return;
|
|
1248
|
+
} catch (error) {
|
|
1249
|
+
throw error;
|
|
1250
|
+
}
|
|
1251
|
+
};
|
|
1252
|
+
var order_notes = {
|
|
1253
|
+
list: list9,
|
|
1254
|
+
retrieve: retrieve9,
|
|
1255
|
+
create: create9,
|
|
1256
|
+
update: update9,
|
|
1257
|
+
delete: _delete9,
|
|
1258
|
+
bulk_create: bulk_create9,
|
|
1259
|
+
bulk_update: bulk_update9,
|
|
1260
|
+
bulk_delete: bulk_delete9
|
|
1261
|
+
};
|
|
1262
|
+
|
|
1263
|
+
// src/services/refunds.service.ts
|
|
1264
|
+
var list10 = async (props) => {
|
|
1265
|
+
try {
|
|
1266
|
+
const { sdk, query } = props;
|
|
1267
|
+
const adapter = await sdk.adapter();
|
|
1268
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1269
|
+
const refunds2 = await adapter.refunds.list({
|
|
1270
|
+
connector_config: sdk.options.configuration,
|
|
1271
|
+
query
|
|
1272
|
+
});
|
|
1273
|
+
return refunds2;
|
|
1274
|
+
} catch (error) {
|
|
1275
|
+
throw error;
|
|
1276
|
+
}
|
|
1277
|
+
};
|
|
1278
|
+
var retrieve10 = async (props) => {
|
|
1279
|
+
try {
|
|
1280
|
+
const { sdk, id } = props;
|
|
1281
|
+
const adapter = await sdk.adapter();
|
|
1282
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1283
|
+
const refund = await adapter.refunds.retrieve({
|
|
1284
|
+
connector_config: sdk.options.configuration,
|
|
1285
|
+
id
|
|
1286
|
+
});
|
|
1287
|
+
return refund;
|
|
1288
|
+
} catch (error) {
|
|
1289
|
+
throw error;
|
|
1290
|
+
}
|
|
1291
|
+
};
|
|
1292
|
+
var create10 = async (props) => {
|
|
1293
|
+
try {
|
|
1294
|
+
const { sdk, data } = props;
|
|
1295
|
+
const adapter = await sdk.adapter();
|
|
1296
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1297
|
+
const refund = await adapter.refunds.create({
|
|
1298
|
+
connector_config: sdk.options.configuration,
|
|
1299
|
+
data
|
|
1300
|
+
});
|
|
1301
|
+
return refund;
|
|
1302
|
+
} catch (error) {
|
|
1303
|
+
throw error;
|
|
1304
|
+
}
|
|
1305
|
+
};
|
|
1306
|
+
var update10 = async (props) => {
|
|
1307
|
+
try {
|
|
1308
|
+
const { sdk, id, data } = props;
|
|
1309
|
+
const adapter = await sdk.adapter();
|
|
1310
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1311
|
+
const refund = await adapter.refunds.update({
|
|
1312
|
+
connector_config: sdk.options.configuration,
|
|
1313
|
+
id,
|
|
1314
|
+
data
|
|
1315
|
+
});
|
|
1316
|
+
return refund;
|
|
1317
|
+
} catch (error) {
|
|
1318
|
+
throw error;
|
|
1319
|
+
}
|
|
1320
|
+
};
|
|
1321
|
+
var _delete10 = async (props) => {
|
|
1322
|
+
try {
|
|
1323
|
+
const { sdk, id } = props;
|
|
1324
|
+
const adapter = await sdk.adapter();
|
|
1325
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1326
|
+
await adapter.refunds.delete({
|
|
1327
|
+
connector_config: sdk.options.configuration,
|
|
1328
|
+
id
|
|
1329
|
+
});
|
|
1330
|
+
return;
|
|
1331
|
+
} catch (error) {
|
|
1332
|
+
throw error;
|
|
1333
|
+
}
|
|
1334
|
+
};
|
|
1335
|
+
var bulk_create10 = async (props) => {
|
|
1336
|
+
try {
|
|
1337
|
+
const { sdk, data } = props;
|
|
1338
|
+
const adapter = await sdk.adapter();
|
|
1339
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1340
|
+
const refunds2 = await adapter.refunds.bulk_create({
|
|
1341
|
+
connector_config: sdk.options.configuration,
|
|
1342
|
+
data
|
|
1343
|
+
});
|
|
1344
|
+
return refunds2;
|
|
1345
|
+
} catch (error) {
|
|
1346
|
+
throw error;
|
|
1347
|
+
}
|
|
1348
|
+
};
|
|
1349
|
+
var bulk_update10 = async (props) => {
|
|
1350
|
+
try {
|
|
1351
|
+
const { sdk, data } = props;
|
|
1352
|
+
const adapter = await sdk.adapter();
|
|
1353
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1354
|
+
const refunds2 = await adapter.refunds.bulk_update({
|
|
1355
|
+
connector_config: sdk.options.configuration,
|
|
1356
|
+
data
|
|
1357
|
+
});
|
|
1358
|
+
return refunds2;
|
|
1359
|
+
} catch (error) {
|
|
1360
|
+
throw error;
|
|
1361
|
+
}
|
|
1362
|
+
};
|
|
1363
|
+
var bulk_delete10 = async (props) => {
|
|
1364
|
+
try {
|
|
1365
|
+
const { sdk, ids } = props;
|
|
1366
|
+
const adapter = await sdk.adapter();
|
|
1367
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1368
|
+
await adapter.refunds.bulk_delete({
|
|
1369
|
+
connector_config: sdk.options.configuration,
|
|
1370
|
+
ids
|
|
1371
|
+
});
|
|
1372
|
+
return;
|
|
1373
|
+
} catch (error) {
|
|
1374
|
+
throw error;
|
|
1375
|
+
}
|
|
1376
|
+
};
|
|
1377
|
+
var refunds = {
|
|
1378
|
+
list: list10,
|
|
1379
|
+
retrieve: retrieve10,
|
|
1380
|
+
create: create10,
|
|
1381
|
+
update: update10,
|
|
1382
|
+
delete: _delete10,
|
|
1383
|
+
bulk_create: bulk_create10,
|
|
1384
|
+
bulk_update: bulk_update10,
|
|
1385
|
+
bulk_delete: bulk_delete10
|
|
1386
|
+
};
|
|
1387
|
+
|
|
1388
|
+
// src/services/payment-providers.service.ts
|
|
1389
|
+
var list11 = async (props) => {
|
|
1390
|
+
try {
|
|
1391
|
+
const { sdk, query } = props;
|
|
1392
|
+
const adapter = await sdk.adapter();
|
|
1393
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1394
|
+
const providers = await adapter.payment_providers.list({
|
|
1395
|
+
connector_config: sdk.options.configuration,
|
|
1396
|
+
query
|
|
1397
|
+
});
|
|
1398
|
+
return providers;
|
|
1399
|
+
} catch (error) {
|
|
1400
|
+
throw error;
|
|
1401
|
+
}
|
|
1402
|
+
};
|
|
1403
|
+
var retrieve11 = async (props) => {
|
|
1404
|
+
try {
|
|
1405
|
+
const { sdk, id } = props;
|
|
1406
|
+
const adapter = await sdk.adapter();
|
|
1407
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1408
|
+
const provider = await adapter.payment_providers.retrieve({
|
|
1409
|
+
connector_config: sdk.options.configuration,
|
|
1410
|
+
id
|
|
1411
|
+
});
|
|
1412
|
+
return provider;
|
|
1413
|
+
} catch (error) {
|
|
1414
|
+
throw error;
|
|
1415
|
+
}
|
|
1416
|
+
};
|
|
1417
|
+
var create11 = async (props) => {
|
|
1418
|
+
try {
|
|
1419
|
+
const { sdk, data } = props;
|
|
1420
|
+
const adapter = await sdk.adapter();
|
|
1421
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1422
|
+
const provider = await adapter.payment_providers.create({
|
|
1423
|
+
connector_config: sdk.options.configuration,
|
|
1424
|
+
data
|
|
1425
|
+
});
|
|
1426
|
+
return provider;
|
|
1427
|
+
} catch (error) {
|
|
1428
|
+
throw error;
|
|
1429
|
+
}
|
|
1430
|
+
};
|
|
1431
|
+
var update11 = async (props) => {
|
|
1432
|
+
try {
|
|
1433
|
+
const { sdk, id, data } = props;
|
|
1434
|
+
const adapter = await sdk.adapter();
|
|
1435
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1436
|
+
const provider = await adapter.payment_providers.update({
|
|
1437
|
+
connector_config: sdk.options.configuration,
|
|
1438
|
+
id,
|
|
1439
|
+
data
|
|
1440
|
+
});
|
|
1441
|
+
return provider;
|
|
1442
|
+
} catch (error) {
|
|
1443
|
+
throw error;
|
|
1444
|
+
}
|
|
1445
|
+
};
|
|
1446
|
+
var _delete11 = async (props) => {
|
|
1447
|
+
try {
|
|
1448
|
+
const { sdk, id } = props;
|
|
1449
|
+
const adapter = await sdk.adapter();
|
|
1450
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1451
|
+
await adapter.payment_providers.delete({
|
|
1452
|
+
connector_config: sdk.options.configuration,
|
|
1453
|
+
id
|
|
1454
|
+
});
|
|
1455
|
+
return;
|
|
1456
|
+
} catch (error) {
|
|
1457
|
+
throw error;
|
|
1458
|
+
}
|
|
1459
|
+
};
|
|
1460
|
+
var bulk_create11 = async (props) => {
|
|
1461
|
+
try {
|
|
1462
|
+
const { sdk, data } = props;
|
|
1463
|
+
const adapter = await sdk.adapter();
|
|
1464
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1465
|
+
const providers = await adapter.payment_providers.bulk_create({
|
|
1466
|
+
connector_config: sdk.options.configuration,
|
|
1467
|
+
data
|
|
1468
|
+
});
|
|
1469
|
+
return providers;
|
|
1470
|
+
} catch (error) {
|
|
1471
|
+
throw error;
|
|
1472
|
+
}
|
|
1473
|
+
};
|
|
1474
|
+
var bulk_update11 = async (props) => {
|
|
1475
|
+
try {
|
|
1476
|
+
const { sdk, data } = props;
|
|
1477
|
+
const adapter = await sdk.adapter();
|
|
1478
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1479
|
+
const providers = await adapter.payment_providers.bulk_update({
|
|
1480
|
+
connector_config: sdk.options.configuration,
|
|
1481
|
+
data
|
|
1482
|
+
});
|
|
1483
|
+
return providers;
|
|
1484
|
+
} catch (error) {
|
|
1485
|
+
throw error;
|
|
1486
|
+
}
|
|
1487
|
+
};
|
|
1488
|
+
var bulk_delete11 = async (props) => {
|
|
1489
|
+
try {
|
|
1490
|
+
const { sdk, ids } = props;
|
|
1491
|
+
const adapter = await sdk.adapter();
|
|
1492
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1493
|
+
await adapter.payment_providers.bulk_delete({
|
|
1494
|
+
connector_config: sdk.options.configuration,
|
|
1495
|
+
ids
|
|
1496
|
+
});
|
|
1497
|
+
return;
|
|
1498
|
+
} catch (error) {
|
|
1499
|
+
throw error;
|
|
1500
|
+
}
|
|
1501
|
+
};
|
|
1502
|
+
var payment_providers = {
|
|
1503
|
+
list: list11,
|
|
1504
|
+
retrieve: retrieve11,
|
|
1505
|
+
create: create11,
|
|
1506
|
+
update: update11,
|
|
1507
|
+
delete: _delete11,
|
|
1508
|
+
bulk_create: bulk_create11,
|
|
1509
|
+
bulk_update: bulk_update11,
|
|
1510
|
+
bulk_delete: bulk_delete11
|
|
1511
|
+
};
|
|
1512
|
+
|
|
1513
|
+
// src/services/payments.service.ts
|
|
1514
|
+
var list12 = async (props) => {
|
|
1515
|
+
try {
|
|
1516
|
+
const { sdk, query } = props;
|
|
1517
|
+
const adapter = await sdk.adapter();
|
|
1518
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1519
|
+
const payments2 = await adapter.payments.list({
|
|
1520
|
+
connector_config: sdk.options.configuration,
|
|
1521
|
+
query
|
|
1522
|
+
});
|
|
1523
|
+
return payments2;
|
|
1524
|
+
} catch (error) {
|
|
1525
|
+
throw error;
|
|
1526
|
+
}
|
|
1527
|
+
};
|
|
1528
|
+
var retrieve12 = async (props) => {
|
|
1529
|
+
try {
|
|
1530
|
+
const { sdk, id } = props;
|
|
1531
|
+
const adapter = await sdk.adapter();
|
|
1532
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1533
|
+
const payment = await adapter.payments.retrieve({
|
|
1534
|
+
connector_config: sdk.options.configuration,
|
|
1535
|
+
id
|
|
1536
|
+
});
|
|
1537
|
+
return payment;
|
|
1538
|
+
} catch (error) {
|
|
1539
|
+
throw error;
|
|
1540
|
+
}
|
|
1541
|
+
};
|
|
1542
|
+
var create12 = async (props) => {
|
|
1543
|
+
try {
|
|
1544
|
+
const { sdk, data } = props;
|
|
1545
|
+
const adapter = await sdk.adapter();
|
|
1546
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1547
|
+
const payment = await adapter.payments.create({
|
|
1548
|
+
connector_config: sdk.options.configuration,
|
|
1549
|
+
data
|
|
1550
|
+
});
|
|
1551
|
+
return payment;
|
|
1552
|
+
} catch (error) {
|
|
1553
|
+
throw error;
|
|
1554
|
+
}
|
|
1555
|
+
};
|
|
1556
|
+
var update12 = async (props) => {
|
|
1557
|
+
try {
|
|
1558
|
+
const { sdk, id, data } = props;
|
|
1559
|
+
const adapter = await sdk.adapter();
|
|
1560
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1561
|
+
const payment = await adapter.payments.update({
|
|
1562
|
+
connector_config: sdk.options.configuration,
|
|
1563
|
+
id,
|
|
1564
|
+
data
|
|
1565
|
+
});
|
|
1566
|
+
return payment;
|
|
1567
|
+
} catch (error) {
|
|
1568
|
+
throw error;
|
|
1569
|
+
}
|
|
1570
|
+
};
|
|
1571
|
+
var _delete12 = async (props) => {
|
|
1572
|
+
try {
|
|
1573
|
+
const { sdk, id } = props;
|
|
1574
|
+
const adapter = await sdk.adapter();
|
|
1575
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1576
|
+
await adapter.payments.delete({
|
|
1577
|
+
connector_config: sdk.options.configuration,
|
|
1578
|
+
id
|
|
1579
|
+
});
|
|
1580
|
+
return;
|
|
1581
|
+
} catch (error) {
|
|
1582
|
+
throw error;
|
|
1583
|
+
}
|
|
1584
|
+
};
|
|
1585
|
+
var bulk_create12 = async (props) => {
|
|
1586
|
+
try {
|
|
1587
|
+
const { sdk, data } = props;
|
|
1588
|
+
const adapter = await sdk.adapter();
|
|
1589
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1590
|
+
const payments2 = await adapter.payments.bulk_create({
|
|
1591
|
+
connector_config: sdk.options.configuration,
|
|
1592
|
+
data
|
|
1593
|
+
});
|
|
1594
|
+
return payments2;
|
|
1595
|
+
} catch (error) {
|
|
1596
|
+
throw error;
|
|
1597
|
+
}
|
|
1598
|
+
};
|
|
1599
|
+
var bulk_update12 = async (props) => {
|
|
1600
|
+
try {
|
|
1601
|
+
const { sdk, data } = props;
|
|
1602
|
+
const adapter = await sdk.adapter();
|
|
1603
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1604
|
+
const payments2 = await adapter.payments.bulk_update({
|
|
1605
|
+
connector_config: sdk.options.configuration,
|
|
1606
|
+
data
|
|
1607
|
+
});
|
|
1608
|
+
return payments2;
|
|
1609
|
+
} catch (error) {
|
|
1610
|
+
throw error;
|
|
1611
|
+
}
|
|
1612
|
+
};
|
|
1613
|
+
var bulk_delete12 = async (props) => {
|
|
1614
|
+
try {
|
|
1615
|
+
const { sdk, ids } = props;
|
|
1616
|
+
const adapter = await sdk.adapter();
|
|
1617
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1618
|
+
await adapter.payments.bulk_delete({
|
|
1619
|
+
connector_config: sdk.options.configuration,
|
|
1620
|
+
ids
|
|
1621
|
+
});
|
|
1622
|
+
return;
|
|
1623
|
+
} catch (error) {
|
|
1624
|
+
throw error;
|
|
1625
|
+
}
|
|
1626
|
+
};
|
|
1627
|
+
var payments = {
|
|
1628
|
+
list: list12,
|
|
1629
|
+
retrieve: retrieve12,
|
|
1630
|
+
create: create12,
|
|
1631
|
+
update: update12,
|
|
1632
|
+
delete: _delete12,
|
|
1633
|
+
bulk_create: bulk_create12,
|
|
1634
|
+
bulk_update: bulk_update12,
|
|
1635
|
+
bulk_delete: bulk_delete12
|
|
1636
|
+
};
|
|
1637
|
+
|
|
1638
|
+
// src/services/tax-regions.service.ts
|
|
1639
|
+
var list13 = async (props) => {
|
|
1640
|
+
try {
|
|
1641
|
+
const { sdk, query } = props;
|
|
1642
|
+
const adapter = await sdk.adapter();
|
|
1643
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1644
|
+
const regions = await adapter.tax_regions.list({
|
|
1645
|
+
connector_config: sdk.options.configuration,
|
|
1646
|
+
query
|
|
1647
|
+
});
|
|
1648
|
+
return regions;
|
|
1649
|
+
} catch (error) {
|
|
1650
|
+
throw error;
|
|
1651
|
+
}
|
|
1652
|
+
};
|
|
1653
|
+
var retrieve13 = async (props) => {
|
|
1654
|
+
try {
|
|
1655
|
+
const { sdk, id } = props;
|
|
1656
|
+
const adapter = await sdk.adapter();
|
|
1657
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1658
|
+
const region = await adapter.tax_regions.retrieve({
|
|
1659
|
+
connector_config: sdk.options.configuration,
|
|
1660
|
+
id
|
|
1661
|
+
});
|
|
1662
|
+
return region;
|
|
1663
|
+
} catch (error) {
|
|
1664
|
+
throw error;
|
|
1665
|
+
}
|
|
1666
|
+
};
|
|
1667
|
+
var create13 = async (props) => {
|
|
1668
|
+
try {
|
|
1669
|
+
const { sdk, data } = props;
|
|
1670
|
+
const adapter = await sdk.adapter();
|
|
1671
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1672
|
+
const region = await adapter.tax_regions.create({
|
|
1673
|
+
connector_config: sdk.options.configuration,
|
|
1674
|
+
data
|
|
1675
|
+
});
|
|
1676
|
+
return region;
|
|
1677
|
+
} catch (error) {
|
|
1678
|
+
throw error;
|
|
1679
|
+
}
|
|
1680
|
+
};
|
|
1681
|
+
var update13 = async (props) => {
|
|
1682
|
+
try {
|
|
1683
|
+
const { sdk, id, data } = props;
|
|
1684
|
+
const adapter = await sdk.adapter();
|
|
1685
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1686
|
+
const region = await adapter.tax_regions.update({
|
|
1687
|
+
connector_config: sdk.options.configuration,
|
|
1688
|
+
id,
|
|
1689
|
+
data
|
|
1690
|
+
});
|
|
1691
|
+
return region;
|
|
1692
|
+
} catch (error) {
|
|
1693
|
+
throw error;
|
|
1694
|
+
}
|
|
1695
|
+
};
|
|
1696
|
+
var _delete13 = async (props) => {
|
|
1697
|
+
try {
|
|
1698
|
+
const { sdk, id } = props;
|
|
1699
|
+
const adapter = await sdk.adapter();
|
|
1700
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1701
|
+
await adapter.tax_regions.delete({
|
|
1702
|
+
connector_config: sdk.options.configuration,
|
|
1703
|
+
id
|
|
1704
|
+
});
|
|
1705
|
+
return;
|
|
1706
|
+
} catch (error) {
|
|
1707
|
+
throw error;
|
|
1708
|
+
}
|
|
1709
|
+
};
|
|
1710
|
+
var bulk_create13 = async (props) => {
|
|
1711
|
+
try {
|
|
1712
|
+
const { sdk, data } = props;
|
|
1713
|
+
const adapter = await sdk.adapter();
|
|
1714
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1715
|
+
const regions = await adapter.tax_regions.bulk_create({
|
|
1716
|
+
connector_config: sdk.options.configuration,
|
|
1717
|
+
data
|
|
1718
|
+
});
|
|
1719
|
+
return regions;
|
|
1720
|
+
} catch (error) {
|
|
1721
|
+
throw error;
|
|
1722
|
+
}
|
|
1723
|
+
};
|
|
1724
|
+
var bulk_update13 = async (props) => {
|
|
1725
|
+
try {
|
|
1726
|
+
const { sdk, data } = props;
|
|
1727
|
+
const adapter = await sdk.adapter();
|
|
1728
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1729
|
+
const regions = await adapter.tax_regions.bulk_update({
|
|
1730
|
+
connector_config: sdk.options.configuration,
|
|
1731
|
+
data
|
|
1732
|
+
});
|
|
1733
|
+
return regions;
|
|
1734
|
+
} catch (error) {
|
|
1735
|
+
throw error;
|
|
1736
|
+
}
|
|
1737
|
+
};
|
|
1738
|
+
var bulk_delete13 = async (props) => {
|
|
1739
|
+
try {
|
|
1740
|
+
const { sdk, ids } = props;
|
|
1741
|
+
const adapter = await sdk.adapter();
|
|
1742
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1743
|
+
await adapter.tax_regions.bulk_delete({
|
|
1744
|
+
connector_config: sdk.options.configuration,
|
|
1745
|
+
ids
|
|
1746
|
+
});
|
|
1747
|
+
return;
|
|
1748
|
+
} catch (error) {
|
|
1749
|
+
throw error;
|
|
1750
|
+
}
|
|
1751
|
+
};
|
|
1752
|
+
var tax_regions = {
|
|
1753
|
+
list: list13,
|
|
1754
|
+
retrieve: retrieve13,
|
|
1755
|
+
create: create13,
|
|
1756
|
+
update: update13,
|
|
1757
|
+
delete: _delete13,
|
|
1758
|
+
bulk_create: bulk_create13,
|
|
1759
|
+
bulk_update: bulk_update13,
|
|
1760
|
+
bulk_delete: bulk_delete13
|
|
1761
|
+
};
|
|
1762
|
+
|
|
1763
|
+
// src/services/tax-rates.service.ts
|
|
1764
|
+
var list14 = async (props) => {
|
|
1765
|
+
try {
|
|
1766
|
+
const { sdk, query } = props;
|
|
1767
|
+
const adapter = await sdk.adapter();
|
|
1768
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1769
|
+
const rates = await adapter.tax_rates.list({
|
|
1770
|
+
connector_config: sdk.options.configuration,
|
|
1771
|
+
query
|
|
1772
|
+
});
|
|
1773
|
+
return rates;
|
|
1774
|
+
} catch (error) {
|
|
1775
|
+
throw error;
|
|
1776
|
+
}
|
|
1777
|
+
};
|
|
1778
|
+
var retrieve14 = async (props) => {
|
|
1779
|
+
try {
|
|
1780
|
+
const { sdk, id } = props;
|
|
1781
|
+
const adapter = await sdk.adapter();
|
|
1782
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1783
|
+
const rate = await adapter.tax_rates.retrieve({
|
|
1784
|
+
connector_config: sdk.options.configuration,
|
|
1785
|
+
id
|
|
1786
|
+
});
|
|
1787
|
+
return rate;
|
|
1788
|
+
} catch (error) {
|
|
1789
|
+
throw error;
|
|
1790
|
+
}
|
|
1791
|
+
};
|
|
1792
|
+
var create14 = async (props) => {
|
|
1793
|
+
try {
|
|
1794
|
+
const { sdk, data } = props;
|
|
1795
|
+
const adapter = await sdk.adapter();
|
|
1796
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1797
|
+
const rate = await adapter.tax_rates.create({
|
|
1798
|
+
connector_config: sdk.options.configuration,
|
|
1799
|
+
data
|
|
1800
|
+
});
|
|
1801
|
+
return rate;
|
|
1802
|
+
} catch (error) {
|
|
1803
|
+
throw error;
|
|
1804
|
+
}
|
|
1805
|
+
};
|
|
1806
|
+
var update14 = async (props) => {
|
|
1807
|
+
try {
|
|
1808
|
+
const { sdk, id, data } = props;
|
|
1809
|
+
const adapter = await sdk.adapter();
|
|
1810
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1811
|
+
const rate = await adapter.tax_rates.update({
|
|
1812
|
+
connector_config: sdk.options.configuration,
|
|
1813
|
+
id,
|
|
1814
|
+
data
|
|
1815
|
+
});
|
|
1816
|
+
return rate;
|
|
1817
|
+
} catch (error) {
|
|
1818
|
+
throw error;
|
|
1819
|
+
}
|
|
1820
|
+
};
|
|
1821
|
+
var _delete14 = async (props) => {
|
|
1822
|
+
try {
|
|
1823
|
+
const { sdk, id } = props;
|
|
1824
|
+
const adapter = await sdk.adapter();
|
|
1825
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1826
|
+
await adapter.tax_rates.delete({
|
|
1827
|
+
connector_config: sdk.options.configuration,
|
|
1828
|
+
id
|
|
1829
|
+
});
|
|
1830
|
+
return;
|
|
1831
|
+
} catch (error) {
|
|
1832
|
+
throw error;
|
|
1833
|
+
}
|
|
1834
|
+
};
|
|
1835
|
+
var bulk_create14 = async (props) => {
|
|
1836
|
+
try {
|
|
1837
|
+
const { sdk, data } = props;
|
|
1838
|
+
const adapter = await sdk.adapter();
|
|
1839
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1840
|
+
const rates = await adapter.tax_rates.bulk_create({
|
|
1841
|
+
connector_config: sdk.options.configuration,
|
|
1842
|
+
data
|
|
1843
|
+
});
|
|
1844
|
+
return rates;
|
|
1845
|
+
} catch (error) {
|
|
1846
|
+
throw error;
|
|
1847
|
+
}
|
|
1848
|
+
};
|
|
1849
|
+
var bulk_update14 = async (props) => {
|
|
1850
|
+
try {
|
|
1851
|
+
const { sdk, data } = props;
|
|
1852
|
+
const adapter = await sdk.adapter();
|
|
1853
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1854
|
+
const rates = await adapter.tax_rates.bulk_update({
|
|
1855
|
+
connector_config: sdk.options.configuration,
|
|
1856
|
+
data
|
|
1857
|
+
});
|
|
1858
|
+
return rates;
|
|
1859
|
+
} catch (error) {
|
|
1860
|
+
throw error;
|
|
1861
|
+
}
|
|
1862
|
+
};
|
|
1863
|
+
var bulk_delete14 = async (props) => {
|
|
1864
|
+
try {
|
|
1865
|
+
const { sdk, ids } = props;
|
|
1866
|
+
const adapter = await sdk.adapter();
|
|
1867
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1868
|
+
await adapter.tax_rates.bulk_delete({
|
|
1869
|
+
connector_config: sdk.options.configuration,
|
|
1870
|
+
ids
|
|
1871
|
+
});
|
|
1872
|
+
return;
|
|
1873
|
+
} catch (error) {
|
|
1874
|
+
throw error;
|
|
1875
|
+
}
|
|
1876
|
+
};
|
|
1877
|
+
var tax_rates = {
|
|
1878
|
+
list: list14,
|
|
1879
|
+
retrieve: retrieve14,
|
|
1880
|
+
create: create14,
|
|
1881
|
+
update: update14,
|
|
1882
|
+
delete: _delete14,
|
|
1883
|
+
bulk_create: bulk_create14,
|
|
1884
|
+
bulk_update: bulk_update14,
|
|
1885
|
+
bulk_delete: bulk_delete14
|
|
1886
|
+
};
|
|
1887
|
+
|
|
1888
|
+
// src/services/locations.service.ts
|
|
1889
|
+
var list15 = async (props) => {
|
|
1890
|
+
try {
|
|
1891
|
+
const { sdk, query } = props;
|
|
1892
|
+
const adapter = await sdk.adapter();
|
|
1893
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1894
|
+
const locations2 = await adapter.locations.list({
|
|
1895
|
+
connector_config: sdk.options.configuration,
|
|
1896
|
+
query
|
|
1897
|
+
});
|
|
1898
|
+
return locations2;
|
|
1899
|
+
} catch (error) {
|
|
1900
|
+
throw error;
|
|
1901
|
+
}
|
|
1902
|
+
};
|
|
1903
|
+
var retrieve15 = async (props) => {
|
|
1904
|
+
try {
|
|
1905
|
+
const { sdk, id } = props;
|
|
1906
|
+
const adapter = await sdk.adapter();
|
|
1907
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1908
|
+
const location = await adapter.locations.retrieve({
|
|
1909
|
+
connector_config: sdk.options.configuration,
|
|
1910
|
+
id
|
|
1911
|
+
});
|
|
1912
|
+
return location;
|
|
1913
|
+
} catch (error) {
|
|
1914
|
+
throw error;
|
|
1915
|
+
}
|
|
1916
|
+
};
|
|
1917
|
+
var create15 = async (props) => {
|
|
1918
|
+
try {
|
|
1919
|
+
const { sdk, data } = props;
|
|
1920
|
+
const adapter = await sdk.adapter();
|
|
1921
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1922
|
+
const location = await adapter.locations.create({
|
|
1923
|
+
connector_config: sdk.options.configuration,
|
|
1924
|
+
data
|
|
1925
|
+
});
|
|
1926
|
+
return location;
|
|
1927
|
+
} catch (error) {
|
|
1928
|
+
throw error;
|
|
1929
|
+
}
|
|
1930
|
+
};
|
|
1931
|
+
var update15 = async (props) => {
|
|
1932
|
+
try {
|
|
1933
|
+
const { sdk, id, data } = props;
|
|
1934
|
+
const adapter = await sdk.adapter();
|
|
1935
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1936
|
+
const location = await adapter.locations.update({
|
|
1937
|
+
connector_config: sdk.options.configuration,
|
|
1938
|
+
id,
|
|
1939
|
+
data
|
|
1940
|
+
});
|
|
1941
|
+
return location;
|
|
1942
|
+
} catch (error) {
|
|
1943
|
+
throw error;
|
|
1944
|
+
}
|
|
1945
|
+
};
|
|
1946
|
+
var _delete15 = async (props) => {
|
|
1947
|
+
try {
|
|
1948
|
+
const { sdk, id } = props;
|
|
1949
|
+
const adapter = await sdk.adapter();
|
|
1950
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1951
|
+
await adapter.locations.delete({
|
|
1952
|
+
connector_config: sdk.options.configuration,
|
|
1953
|
+
id
|
|
1954
|
+
});
|
|
1955
|
+
return;
|
|
1956
|
+
} catch (error) {
|
|
1957
|
+
throw error;
|
|
1958
|
+
}
|
|
1959
|
+
};
|
|
1960
|
+
var bulk_create15 = async (props) => {
|
|
1961
|
+
try {
|
|
1962
|
+
const { sdk, data } = props;
|
|
1963
|
+
const adapter = await sdk.adapter();
|
|
1964
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1965
|
+
const locations2 = await adapter.locations.bulk_create({
|
|
1966
|
+
connector_config: sdk.options.configuration,
|
|
1967
|
+
data
|
|
1968
|
+
});
|
|
1969
|
+
return locations2;
|
|
1970
|
+
} catch (error) {
|
|
1971
|
+
throw error;
|
|
1972
|
+
}
|
|
1973
|
+
};
|
|
1974
|
+
var bulk_update15 = async (props) => {
|
|
1975
|
+
try {
|
|
1976
|
+
const { sdk, data } = props;
|
|
1977
|
+
const adapter = await sdk.adapter();
|
|
1978
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1979
|
+
const locations2 = await adapter.locations.bulk_update({
|
|
1980
|
+
connector_config: sdk.options.configuration,
|
|
1981
|
+
data
|
|
1982
|
+
});
|
|
1983
|
+
return locations2;
|
|
1984
|
+
} catch (error) {
|
|
1985
|
+
throw error;
|
|
1986
|
+
}
|
|
1987
|
+
};
|
|
1988
|
+
var bulk_delete15 = async (props) => {
|
|
1989
|
+
try {
|
|
1990
|
+
const { sdk, ids } = props;
|
|
1991
|
+
const adapter = await sdk.adapter();
|
|
1992
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
1993
|
+
await adapter.locations.bulk_delete({
|
|
1994
|
+
connector_config: sdk.options.configuration,
|
|
1995
|
+
ids
|
|
1996
|
+
});
|
|
1997
|
+
return;
|
|
1998
|
+
} catch (error) {
|
|
1999
|
+
throw error;
|
|
2000
|
+
}
|
|
2001
|
+
};
|
|
2002
|
+
var locations = {
|
|
2003
|
+
list: list15,
|
|
2004
|
+
retrieve: retrieve15,
|
|
2005
|
+
create: create15,
|
|
2006
|
+
update: update15,
|
|
2007
|
+
delete: _delete15,
|
|
2008
|
+
bulk_create: bulk_create15,
|
|
2009
|
+
bulk_update: bulk_update15,
|
|
2010
|
+
bulk_delete: bulk_delete15
|
|
2011
|
+
};
|
|
2012
|
+
|
|
2013
|
+
// src/services/fulfillments.service.ts
|
|
2014
|
+
var list16 = async (props) => {
|
|
2015
|
+
try {
|
|
2016
|
+
const { sdk, query } = props;
|
|
2017
|
+
const adapter = await sdk.adapter();
|
|
2018
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
2019
|
+
const fulfillments2 = await adapter.fulfillments.list({
|
|
2020
|
+
connector_config: sdk.options.configuration,
|
|
2021
|
+
query
|
|
2022
|
+
});
|
|
2023
|
+
return fulfillments2;
|
|
2024
|
+
} catch (error) {
|
|
2025
|
+
throw error;
|
|
2026
|
+
}
|
|
2027
|
+
};
|
|
2028
|
+
var retrieve16 = async (props) => {
|
|
2029
|
+
try {
|
|
2030
|
+
const { sdk, id } = props;
|
|
2031
|
+
const adapter = await sdk.adapter();
|
|
2032
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
2033
|
+
const fulfillment = await adapter.fulfillments.retrieve({
|
|
2034
|
+
connector_config: sdk.options.configuration,
|
|
2035
|
+
id
|
|
2036
|
+
});
|
|
2037
|
+
return fulfillment;
|
|
2038
|
+
} catch (error) {
|
|
2039
|
+
throw error;
|
|
2040
|
+
}
|
|
2041
|
+
};
|
|
2042
|
+
var create16 = async (props) => {
|
|
2043
|
+
try {
|
|
2044
|
+
const { sdk, data } = props;
|
|
2045
|
+
const adapter = await sdk.adapter();
|
|
2046
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
2047
|
+
const fulfillment = await adapter.fulfillments.create({
|
|
2048
|
+
connector_config: sdk.options.configuration,
|
|
2049
|
+
data
|
|
2050
|
+
});
|
|
2051
|
+
return fulfillment;
|
|
2052
|
+
} catch (error) {
|
|
2053
|
+
throw error;
|
|
2054
|
+
}
|
|
2055
|
+
};
|
|
2056
|
+
var update16 = async (props) => {
|
|
2057
|
+
try {
|
|
2058
|
+
const { sdk, id, data } = props;
|
|
2059
|
+
const adapter = await sdk.adapter();
|
|
2060
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
2061
|
+
const fulfillment = await adapter.fulfillments.update({
|
|
2062
|
+
connector_config: sdk.options.configuration,
|
|
2063
|
+
id,
|
|
2064
|
+
data
|
|
2065
|
+
});
|
|
2066
|
+
return fulfillment;
|
|
2067
|
+
} catch (error) {
|
|
2068
|
+
throw error;
|
|
2069
|
+
}
|
|
2070
|
+
};
|
|
2071
|
+
var _delete16 = async (props) => {
|
|
2072
|
+
try {
|
|
2073
|
+
const { sdk, id } = props;
|
|
2074
|
+
const adapter = await sdk.adapter();
|
|
2075
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
2076
|
+
await adapter.fulfillments.delete({
|
|
2077
|
+
connector_config: sdk.options.configuration,
|
|
2078
|
+
id
|
|
2079
|
+
});
|
|
2080
|
+
return;
|
|
2081
|
+
} catch (error) {
|
|
2082
|
+
throw error;
|
|
2083
|
+
}
|
|
2084
|
+
};
|
|
2085
|
+
var bulk_create16 = async (props) => {
|
|
2086
|
+
try {
|
|
2087
|
+
const { sdk, data } = props;
|
|
2088
|
+
const adapter = await sdk.adapter();
|
|
2089
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
2090
|
+
const fulfillments2 = await adapter.fulfillments.bulk_create({
|
|
2091
|
+
connector_config: sdk.options.configuration,
|
|
2092
|
+
data
|
|
2093
|
+
});
|
|
2094
|
+
return fulfillments2;
|
|
2095
|
+
} catch (error) {
|
|
2096
|
+
throw error;
|
|
2097
|
+
}
|
|
2098
|
+
};
|
|
2099
|
+
var bulk_update16 = async (props) => {
|
|
2100
|
+
try {
|
|
2101
|
+
const { sdk, data } = props;
|
|
2102
|
+
const adapter = await sdk.adapter();
|
|
2103
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
2104
|
+
const fulfillments2 = await adapter.fulfillments.bulk_update({
|
|
2105
|
+
connector_config: sdk.options.configuration,
|
|
2106
|
+
data
|
|
2107
|
+
});
|
|
2108
|
+
return fulfillments2;
|
|
2109
|
+
} catch (error) {
|
|
2110
|
+
throw error;
|
|
2111
|
+
}
|
|
2112
|
+
};
|
|
2113
|
+
var bulk_delete16 = async (props) => {
|
|
2114
|
+
try {
|
|
2115
|
+
const { sdk, ids } = props;
|
|
2116
|
+
const adapter = await sdk.adapter();
|
|
2117
|
+
if (!adapter) throw new Error("Adapter not found");
|
|
2118
|
+
await adapter.fulfillments.bulk_delete({
|
|
2119
|
+
connector_config: sdk.options.configuration,
|
|
2120
|
+
ids
|
|
2121
|
+
});
|
|
2122
|
+
return;
|
|
2123
|
+
} catch (error) {
|
|
2124
|
+
throw error;
|
|
2125
|
+
}
|
|
2126
|
+
};
|
|
2127
|
+
var fulfillments = {
|
|
2128
|
+
list: list16,
|
|
2129
|
+
retrieve: retrieve16,
|
|
2130
|
+
create: create16,
|
|
2131
|
+
update: update16,
|
|
2132
|
+
delete: _delete16,
|
|
2133
|
+
bulk_create: bulk_create16,
|
|
2134
|
+
bulk_update: bulk_update16,
|
|
2135
|
+
bulk_delete: bulk_delete16
|
|
1302
2136
|
};
|
|
1303
2137
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1304
2138
|
0 && (module.exports = {
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
2139
|
+
categories,
|
|
2140
|
+
collections,
|
|
2141
|
+
customers,
|
|
2142
|
+
fulfillments,
|
|
2143
|
+
initializeStallCore,
|
|
2144
|
+
inventory_levels,
|
|
2145
|
+
locations,
|
|
2146
|
+
order_notes,
|
|
2147
|
+
orders,
|
|
2148
|
+
payment_providers,
|
|
2149
|
+
payments,
|
|
2150
|
+
products,
|
|
2151
|
+
promotions,
|
|
2152
|
+
refunds,
|
|
2153
|
+
tax_rates,
|
|
2154
|
+
tax_regions,
|
|
2155
|
+
variants
|
|
1319
2156
|
});
|