n8n-nodes-lemonsqueezy 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +81 -6
- package/dist/nodes/LemonSqueezy/LemonSqueezy.node.js +3 -0
- package/dist/nodes/LemonSqueezy/constants.js +11 -2
- package/dist/nodes/LemonSqueezy/helpers.d.ts +44 -0
- package/dist/nodes/LemonSqueezy/helpers.js +194 -4
- package/dist/nodes/LemonSqueezy/resources/discountRedemption.d.ts +3 -0
- package/dist/nodes/LemonSqueezy/resources/discountRedemption.js +109 -0
- package/dist/nodes/LemonSqueezy/resources/index.d.ts +7 -1
- package/dist/nodes/LemonSqueezy/resources/index.js +37 -1
- package/dist/nodes/LemonSqueezy/resources/licenseKeyInstance.d.ts +3 -0
- package/dist/nodes/LemonSqueezy/resources/licenseKeyInstance.js +102 -0
- package/dist/nodes/LemonSqueezy/resources/orderItem.d.ts +3 -0
- package/dist/nodes/LemonSqueezy/resources/orderItem.js +116 -0
- package/dist/nodes/LemonSqueezy/resources/subscriptionInvoice.d.ts +3 -0
- package/dist/nodes/LemonSqueezy/resources/subscriptionInvoice.js +129 -0
- package/dist/nodes/LemonSqueezy/resources/usageRecord.d.ts +3 -0
- package/dist/nodes/LemonSqueezy/resources/usageRecord.js +102 -0
- package/dist/nodes/LemonSqueezy/resources/user.d.ts +3 -0
- package/dist/nodes/LemonSqueezy/resources/user.js +26 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/n8n-nodes-lemonsqueezy)
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
[](https://github.com/janmaaarc/n8n-nodes-lemonsqueezy/actions/workflows/ci.yml)
|
|
5
6
|
|
|
6
7
|
An [n8n](https://n8n.io/) community node for [Lemon Squeezy](https://lemonsqueezy.com) - a platform for selling digital products, subscriptions, and software licenses.
|
|
7
8
|
|
|
@@ -12,6 +13,8 @@ An [n8n](https://n8n.io/) community node for [Lemon Squeezy](https://lemonsqueez
|
|
|
12
13
|
- **License Key Management** - Validate, activate, and deactivate license keys
|
|
13
14
|
- **Checkout Links** - Create dynamic checkout URLs with custom options
|
|
14
15
|
- **Rate Limiting** - Built-in retry logic with exponential backoff
|
|
16
|
+
- **Input Validation** - Email, URL, and date format validation
|
|
17
|
+
- **Detailed Error Messages** - Descriptive error messages with field-level details
|
|
15
18
|
- **Type Safety** - Full TypeScript support with comprehensive type definitions
|
|
16
19
|
|
|
17
20
|
## Installation
|
|
@@ -51,11 +54,17 @@ The main node for interacting with the Lemon Squeezy API.
|
|
|
51
54
|
| **Checkout** | Create, Get, Get Many |
|
|
52
55
|
| **Customer** | Create, Update, Delete, Get, Get Many |
|
|
53
56
|
| **Discount** | Create, Delete, Get, Get Many |
|
|
57
|
+
| **Discount Redemption** | Get, Get Many |
|
|
54
58
|
| **License Key** | Get, Get Many, Update, Validate, Activate, Deactivate |
|
|
59
|
+
| **License Key Instance** | Get, Get Many |
|
|
55
60
|
| **Order** | Get, Get Many, Refund |
|
|
61
|
+
| **Order Item** | Get, Get Many |
|
|
56
62
|
| **Product** | Get, Get Many |
|
|
57
63
|
| **Store** | Get, Get Many |
|
|
58
64
|
| **Subscription** | Get, Get Many, Update, Cancel, Resume |
|
|
65
|
+
| **Subscription Invoice** | Get, Get Many |
|
|
66
|
+
| **Usage Record** | Get, Get Many |
|
|
67
|
+
| **User** | Get Current |
|
|
59
68
|
| **Variant** | Get, Get Many |
|
|
60
69
|
| **Webhook** | Create, Update, Delete, Get, Get Many |
|
|
61
70
|
|
|
@@ -129,19 +138,36 @@ Most "Get Many" operations support filtering:
|
|
|
129
138
|
| Filter | Description | Available On |
|
|
130
139
|
|--------|-------------|--------------|
|
|
131
140
|
| `storeId` | Filter by store | All resources |
|
|
132
|
-
| `status` | Filter by status | Orders, Subscriptions, Customers, License Keys |
|
|
141
|
+
| `status` | Filter by status | Orders, Subscriptions, Customers, License Keys, Subscription Invoices |
|
|
133
142
|
| `email` | Filter by email | Orders, Customers |
|
|
134
|
-
| `productId` | Filter by product | Subscriptions, License Keys, Variants |
|
|
135
|
-
| `variantId` | Filter by variant | Subscriptions, Checkouts |
|
|
136
|
-
| `orderId` | Filter by order | Subscriptions, License Keys |
|
|
143
|
+
| `productId` | Filter by product | Subscriptions, License Keys, Variants, Order Items |
|
|
144
|
+
| `variantId` | Filter by variant | Subscriptions, Checkouts, Order Items |
|
|
145
|
+
| `orderId` | Filter by order | Subscriptions, License Keys, Order Items, Discount Redemptions |
|
|
146
|
+
| `subscriptionId` | Filter by subscription | Subscription Invoices |
|
|
147
|
+
| `licenseKeyId` | Filter by license key | License Key Instances |
|
|
148
|
+
| `discountId` | Filter by discount | Discount Redemptions |
|
|
137
149
|
|
|
138
150
|
## Error Handling
|
|
139
151
|
|
|
140
|
-
The node includes built-in error handling:
|
|
152
|
+
The node includes built-in error handling with detailed messages:
|
|
141
153
|
|
|
142
154
|
- **Rate Limiting**: Automatically waits and retries when rate limited (429 errors)
|
|
143
155
|
- **Retry Logic**: Retries failed requests with exponential backoff for 5xx errors
|
|
144
156
|
- **Continue on Fail**: Enable to process remaining items even if some fail
|
|
157
|
+
- **Detailed Errors**: Field-level error details for validation failures
|
|
158
|
+
|
|
159
|
+
### Error Code Reference
|
|
160
|
+
|
|
161
|
+
| Status Code | Description |
|
|
162
|
+
|-------------|-------------|
|
|
163
|
+
| 400 | Bad Request - Invalid or malformed request |
|
|
164
|
+
| 401 | Unauthorized - Invalid or missing API key |
|
|
165
|
+
| 403 | Forbidden - No permission to access resource |
|
|
166
|
+
| 404 | Not Found - Resource does not exist |
|
|
167
|
+
| 409 | Conflict - Resource already exists |
|
|
168
|
+
| 422 | Unprocessable Entity - Invalid request data |
|
|
169
|
+
| 429 | Rate Limited - Too many requests |
|
|
170
|
+
| 500+ | Server Error - Something went wrong on the server |
|
|
145
171
|
|
|
146
172
|
## Troubleshooting
|
|
147
173
|
|
|
@@ -166,11 +192,28 @@ The node includes built-in error handling:
|
|
|
166
192
|
|
|
167
193
|
### Rate Limiting Issues
|
|
168
194
|
|
|
169
|
-
The node handles rate limiting automatically
|
|
195
|
+
The node handles rate limiting automatically with the following defaults:
|
|
196
|
+
|
|
197
|
+
| Setting | Value | Description |
|
|
198
|
+
|---------|-------|-------------|
|
|
199
|
+
| Max Retries | 3 | Maximum retry attempts for failed requests |
|
|
200
|
+
| Retry Delay | 1 second | Initial delay between retries (exponential backoff) |
|
|
201
|
+
| Rate Limit Wait | 60 seconds | Wait time when rate limited (429 response) |
|
|
202
|
+
|
|
203
|
+
If you're hitting rate limits frequently:
|
|
170
204
|
|
|
171
205
|
1. Reduce the frequency of API calls
|
|
172
206
|
2. Use "Return All" sparingly for large datasets
|
|
173
207
|
3. Consider caching responses where appropriate
|
|
208
|
+
4. Space out bulk operations with delays
|
|
209
|
+
|
|
210
|
+
### Validation Errors
|
|
211
|
+
|
|
212
|
+
If you receive validation errors:
|
|
213
|
+
|
|
214
|
+
1. Check email fields contain valid email addresses
|
|
215
|
+
2. Verify URLs are complete (including https://)
|
|
216
|
+
3. Ensure dates are in ISO 8601 format (e.g., 2024-01-15T10:30:00Z)
|
|
174
217
|
|
|
175
218
|
## Development
|
|
176
219
|
|
|
@@ -184,11 +227,17 @@ npm run build
|
|
|
184
227
|
# Run tests
|
|
185
228
|
npm test
|
|
186
229
|
|
|
230
|
+
# Run tests with coverage
|
|
231
|
+
npm run test:coverage
|
|
232
|
+
|
|
187
233
|
# Run linter
|
|
188
234
|
npm run lint
|
|
189
235
|
|
|
190
236
|
# Format code
|
|
191
237
|
npm run format
|
|
238
|
+
|
|
239
|
+
# Type check
|
|
240
|
+
npm run typecheck
|
|
192
241
|
```
|
|
193
242
|
|
|
194
243
|
## Contributing
|
|
@@ -207,6 +256,32 @@ Contributions are welcome! Please feel free to submit a Pull Request.
|
|
|
207
256
|
- [n8n Community Nodes Documentation](https://docs.n8n.io/integrations/community-nodes/)
|
|
208
257
|
- [n8n Community Forum](https://community.n8n.io/)
|
|
209
258
|
|
|
259
|
+
## Changelog
|
|
260
|
+
|
|
261
|
+
### v0.4.0
|
|
262
|
+
|
|
263
|
+
- Added User resource for fetching authenticated user information (`getCurrent` operation)
|
|
264
|
+
- Expanded test suite to 130 tests with 85%+ statement coverage
|
|
265
|
+
- Added comprehensive tests for credentials, node descriptions, and helpers
|
|
266
|
+
- Fixed TypeScript strict mode warnings in test files
|
|
267
|
+
- Updated coverage thresholds to 70%
|
|
268
|
+
|
|
269
|
+
### v0.3.0
|
|
270
|
+
|
|
271
|
+
- Added new resources: Order Items, Subscription Invoices, License Key Instances, Discount Redemptions, Usage Records
|
|
272
|
+
- Added input validation for emails, URLs, and dates
|
|
273
|
+
- Improved error messages with field-level details
|
|
274
|
+
- Added advanced filtering with sorting support
|
|
275
|
+
- Added relationship expansion helpers
|
|
276
|
+
- Added security audit in CI pipeline
|
|
277
|
+
- Added coverage reporting with lcov output
|
|
278
|
+
|
|
279
|
+
### v0.2.0
|
|
280
|
+
|
|
281
|
+
- Initial release with full Lemon Squeezy API support
|
|
282
|
+
- Webhook trigger node
|
|
283
|
+
- Rate limiting and retry logic
|
|
284
|
+
|
|
210
285
|
## License
|
|
211
286
|
|
|
212
287
|
[MIT](LICENSE)
|
|
@@ -338,6 +338,9 @@ class LemonSqueezy {
|
|
|
338
338
|
});
|
|
339
339
|
}
|
|
340
340
|
}
|
|
341
|
+
else if (resource === 'user' && operation === 'getCurrent') {
|
|
342
|
+
responseData = await helpers_1.lemonSqueezyApiRequest.call(this, 'GET', '/users/me');
|
|
343
|
+
}
|
|
341
344
|
const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(responseData), { itemData: { item: i } });
|
|
342
345
|
returnData.push(...executionData);
|
|
343
346
|
}
|
|
@@ -15,15 +15,20 @@ exports.RATE_LIMIT_DELAY_MS = 60000;
|
|
|
15
15
|
exports.RESOURCE_ENDPOINTS = {
|
|
16
16
|
product: 'products',
|
|
17
17
|
order: 'orders',
|
|
18
|
+
orderItem: 'order-items',
|
|
18
19
|
subscription: 'subscriptions',
|
|
20
|
+
subscriptionInvoice: 'subscription-invoices',
|
|
19
21
|
customer: 'customers',
|
|
20
22
|
licenseKey: 'license-keys',
|
|
23
|
+
licenseKeyInstance: 'license-key-instances',
|
|
21
24
|
discount: 'discounts',
|
|
25
|
+
discountRedemption: 'discount-redemptions',
|
|
22
26
|
store: 'stores',
|
|
23
27
|
variant: 'variants',
|
|
24
28
|
checkout: 'checkouts',
|
|
25
29
|
webhook: 'webhooks',
|
|
26
|
-
|
|
30
|
+
usageRecord: 'usage-records',
|
|
31
|
+
user: 'users',
|
|
27
32
|
};
|
|
28
33
|
/**
|
|
29
34
|
* Resource to ID parameter mapping
|
|
@@ -31,15 +36,19 @@ exports.RESOURCE_ENDPOINTS = {
|
|
|
31
36
|
exports.RESOURCE_ID_PARAMS = {
|
|
32
37
|
product: 'productId',
|
|
33
38
|
order: 'orderId',
|
|
39
|
+
orderItem: 'orderItemId',
|
|
34
40
|
subscription: 'subscriptionId',
|
|
41
|
+
subscriptionInvoice: 'subscriptionInvoiceId',
|
|
35
42
|
customer: 'customerId',
|
|
36
43
|
licenseKey: 'licenseKeyId',
|
|
44
|
+
licenseKeyInstance: 'licenseKeyInstanceId',
|
|
37
45
|
discount: 'discountId',
|
|
46
|
+
discountRedemption: 'discountRedemptionId',
|
|
38
47
|
store: 'storeId',
|
|
39
48
|
variant: 'variantId',
|
|
40
49
|
checkout: 'checkoutId',
|
|
41
50
|
webhook: 'webhookId',
|
|
42
|
-
|
|
51
|
+
usageRecord: 'usageRecordId',
|
|
43
52
|
};
|
|
44
53
|
/**
|
|
45
54
|
* Webhook event types with descriptions
|
|
@@ -1,4 +1,28 @@
|
|
|
1
1
|
import type { IExecuteFunctions, IWebhookFunctions, IHookFunctions, IHttpRequestMethods, IDataObject } from 'n8n-workflow';
|
|
2
|
+
/**
|
|
3
|
+
* Validate email format
|
|
4
|
+
*/
|
|
5
|
+
export declare function isValidEmail(email: string): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Validate URL format
|
|
8
|
+
*/
|
|
9
|
+
export declare function isValidUrl(url: string): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Validate ISO 8601 date format
|
|
12
|
+
*/
|
|
13
|
+
export declare function isValidIsoDate(dateString: string): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Validate that a value is a positive integer
|
|
16
|
+
*/
|
|
17
|
+
export declare function isPositiveInteger(value: unknown): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Validate field with specific type and throw descriptive error
|
|
20
|
+
*/
|
|
21
|
+
export declare function validateField(fieldName: string, value: unknown, validationType: 'email' | 'url' | 'date' | 'positiveInteger' | 'required'): void;
|
|
22
|
+
/**
|
|
23
|
+
* Safely parse JSON with error handling
|
|
24
|
+
*/
|
|
25
|
+
export declare function safeJsonParse<T = unknown>(jsonString: string, fieldName: string): T;
|
|
2
26
|
/**
|
|
3
27
|
* Make an authenticated request to the Lemon Squeezy API with retry logic
|
|
4
28
|
*/
|
|
@@ -26,3 +50,23 @@ export declare function buildJsonApiBody(type: string, attributes: IDataObject,
|
|
|
26
50
|
* Parse webhook signature for validation
|
|
27
51
|
*/
|
|
28
52
|
export declare function verifyWebhookSignature(payload: string, signature: string, secret: string): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Build query params with relationship expansion (include)
|
|
55
|
+
*/
|
|
56
|
+
export declare function buildIncludeParams(includes: string[]): Record<string, string>;
|
|
57
|
+
/**
|
|
58
|
+
* Build advanced filter params with date range support
|
|
59
|
+
*/
|
|
60
|
+
export declare function buildAdvancedFilterParams(filters: IDataObject, options?: {
|
|
61
|
+
dateFields?: string[];
|
|
62
|
+
sortField?: string;
|
|
63
|
+
sortDirection?: 'asc' | 'desc';
|
|
64
|
+
}): Record<string, string | number>;
|
|
65
|
+
/**
|
|
66
|
+
* Extract data from JSON:API response with proper typing
|
|
67
|
+
*/
|
|
68
|
+
export declare function extractResponseData<T = IDataObject>(response: IDataObject): T | T[] | undefined;
|
|
69
|
+
/**
|
|
70
|
+
* Extract included resources from JSON:API response
|
|
71
|
+
*/
|
|
72
|
+
export declare function extractIncludedResources(response: IDataObject): IDataObject[];
|
|
@@ -33,15 +33,108 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.isValidEmail = isValidEmail;
|
|
37
|
+
exports.isValidUrl = isValidUrl;
|
|
38
|
+
exports.isValidIsoDate = isValidIsoDate;
|
|
39
|
+
exports.isPositiveInteger = isPositiveInteger;
|
|
40
|
+
exports.validateField = validateField;
|
|
41
|
+
exports.safeJsonParse = safeJsonParse;
|
|
36
42
|
exports.lemonSqueezyApiRequest = lemonSqueezyApiRequest;
|
|
37
43
|
exports.lemonSqueezyApiRequestAllItems = lemonSqueezyApiRequestAllItems;
|
|
38
44
|
exports.validateRequiredFields = validateRequiredFields;
|
|
39
45
|
exports.buildFilterParams = buildFilterParams;
|
|
40
46
|
exports.buildJsonApiBody = buildJsonApiBody;
|
|
41
47
|
exports.verifyWebhookSignature = verifyWebhookSignature;
|
|
48
|
+
exports.buildIncludeParams = buildIncludeParams;
|
|
49
|
+
exports.buildAdvancedFilterParams = buildAdvancedFilterParams;
|
|
50
|
+
exports.extractResponseData = extractResponseData;
|
|
51
|
+
exports.extractIncludedResources = extractIncludedResources;
|
|
42
52
|
const crypto = __importStar(require("crypto"));
|
|
43
53
|
const n8n_workflow_1 = require("n8n-workflow");
|
|
44
54
|
const constants_1 = require("./constants");
|
|
55
|
+
// ============================================================================
|
|
56
|
+
// Validation Helpers
|
|
57
|
+
// ============================================================================
|
|
58
|
+
/**
|
|
59
|
+
* Validate email format
|
|
60
|
+
*/
|
|
61
|
+
function isValidEmail(email) {
|
|
62
|
+
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
63
|
+
return emailRegex.test(email);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Validate URL format
|
|
67
|
+
*/
|
|
68
|
+
function isValidUrl(url) {
|
|
69
|
+
try {
|
|
70
|
+
new URL(url);
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Validate ISO 8601 date format
|
|
79
|
+
*/
|
|
80
|
+
function isValidIsoDate(dateString) {
|
|
81
|
+
const date = new Date(dateString);
|
|
82
|
+
return !isNaN(date.getTime()) && dateString.includes('-');
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Validate that a value is a positive integer
|
|
86
|
+
*/
|
|
87
|
+
function isPositiveInteger(value) {
|
|
88
|
+
return typeof value === 'number' && Number.isInteger(value) && value > 0;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Validate field with specific type and throw descriptive error
|
|
92
|
+
*/
|
|
93
|
+
function validateField(fieldName, value, validationType) {
|
|
94
|
+
if (validationType === 'required') {
|
|
95
|
+
if (value === undefined || value === null || value === '') {
|
|
96
|
+
throw new Error(`${fieldName} is required`);
|
|
97
|
+
}
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
// Skip validation if value is empty (use 'required' for mandatory fields)
|
|
101
|
+
if (value === undefined || value === null || value === '') {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
switch (validationType) {
|
|
105
|
+
case 'email':
|
|
106
|
+
if (typeof value !== 'string' || !isValidEmail(value)) {
|
|
107
|
+
throw new Error(`${fieldName} must be a valid email address`);
|
|
108
|
+
}
|
|
109
|
+
break;
|
|
110
|
+
case 'url':
|
|
111
|
+
if (typeof value !== 'string' || !isValidUrl(value)) {
|
|
112
|
+
throw new Error(`${fieldName} must be a valid URL`);
|
|
113
|
+
}
|
|
114
|
+
break;
|
|
115
|
+
case 'date':
|
|
116
|
+
if (typeof value !== 'string' || !isValidIsoDate(value)) {
|
|
117
|
+
throw new Error(`${fieldName} must be a valid ISO 8601 date`);
|
|
118
|
+
}
|
|
119
|
+
break;
|
|
120
|
+
case 'positiveInteger':
|
|
121
|
+
if (!isPositiveInteger(value)) {
|
|
122
|
+
throw new Error(`${fieldName} must be a positive integer`);
|
|
123
|
+
}
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Safely parse JSON with error handling
|
|
129
|
+
*/
|
|
130
|
+
function safeJsonParse(jsonString, fieldName) {
|
|
131
|
+
try {
|
|
132
|
+
return JSON.parse(jsonString);
|
|
133
|
+
}
|
|
134
|
+
catch {
|
|
135
|
+
throw new Error(`${fieldName} contains invalid JSON`);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
45
138
|
/**
|
|
46
139
|
* Sleep for a specified number of milliseconds
|
|
47
140
|
*/
|
|
@@ -151,20 +244,48 @@ async function lemonSqueezyApiRequestAllItems(method, endpoint, qs = {}) {
|
|
|
151
244
|
return returnData;
|
|
152
245
|
}
|
|
153
246
|
/**
|
|
154
|
-
*
|
|
247
|
+
* Lemon Squeezy API error codes and their meanings
|
|
248
|
+
*/
|
|
249
|
+
const ERROR_MESSAGES = {
|
|
250
|
+
400: 'Bad Request: The request was invalid or malformed',
|
|
251
|
+
401: 'Unauthorized: Invalid or missing API key',
|
|
252
|
+
403: 'Forbidden: You do not have permission to access this resource',
|
|
253
|
+
404: 'Not Found: The requested resource does not exist',
|
|
254
|
+
409: 'Conflict: The resource already exists or there is a conflict',
|
|
255
|
+
422: 'Unprocessable Entity: The request data is invalid',
|
|
256
|
+
429: 'Rate Limited: Too many requests. Please wait before retrying',
|
|
257
|
+
500: 'Internal Server Error: Something went wrong on the server',
|
|
258
|
+
502: 'Bad Gateway: The server is temporarily unavailable',
|
|
259
|
+
503: 'Service Unavailable: The API is temporarily unavailable',
|
|
260
|
+
};
|
|
261
|
+
/**
|
|
262
|
+
* Extract detailed error message from error object
|
|
155
263
|
*/
|
|
156
264
|
function getErrorMessage(error) {
|
|
157
265
|
var _a, _b, _c, _d, _e;
|
|
158
266
|
if (error && typeof error === 'object') {
|
|
159
267
|
const err = error;
|
|
268
|
+
const statusCode = err.statusCode || ((_a = err.response) === null || _a === void 0 ? void 0 : _a.statusCode);
|
|
160
269
|
// Check for JSON:API error format
|
|
161
|
-
if ((_c = (_b =
|
|
162
|
-
const
|
|
163
|
-
|
|
270
|
+
if (((_c = (_b = err.response) === null || _b === void 0 ? void 0 : _b.body) === null || _c === void 0 ? void 0 : _c.errors) && err.response.body.errors.length > 0) {
|
|
271
|
+
const apiErrors = err.response.body.errors;
|
|
272
|
+
const errorMessages = apiErrors.map((e) => {
|
|
273
|
+
var _a;
|
|
274
|
+
let msg = e.detail || e.title || 'Unknown error';
|
|
275
|
+
if ((_a = e.source) === null || _a === void 0 ? void 0 : _a.pointer) {
|
|
276
|
+
msg += ` (field: ${e.source.pointer.replace('/data/attributes/', '')})`;
|
|
277
|
+
}
|
|
278
|
+
return msg;
|
|
279
|
+
});
|
|
280
|
+
return errorMessages.join('; ');
|
|
164
281
|
}
|
|
165
282
|
if ((_e = (_d = err.response) === null || _d === void 0 ? void 0 : _d.body) === null || _e === void 0 ? void 0 : _e.message) {
|
|
166
283
|
return err.response.body.message;
|
|
167
284
|
}
|
|
285
|
+
// Use status code mapping
|
|
286
|
+
if (statusCode && ERROR_MESSAGES[statusCode]) {
|
|
287
|
+
return ERROR_MESSAGES[statusCode];
|
|
288
|
+
}
|
|
168
289
|
if (err.message) {
|
|
169
290
|
return err.message;
|
|
170
291
|
}
|
|
@@ -239,3 +360,72 @@ function verifyWebhookSignature(payload, signature, secret) {
|
|
|
239
360
|
return false;
|
|
240
361
|
}
|
|
241
362
|
}
|
|
363
|
+
// ============================================================================
|
|
364
|
+
// Advanced Query Helpers
|
|
365
|
+
// ============================================================================
|
|
366
|
+
/**
|
|
367
|
+
* Build query params with relationship expansion (include)
|
|
368
|
+
*/
|
|
369
|
+
function buildIncludeParams(includes) {
|
|
370
|
+
if (includes.length === 0) {
|
|
371
|
+
return {};
|
|
372
|
+
}
|
|
373
|
+
return { include: includes.join(',') };
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Build advanced filter params with date range support
|
|
377
|
+
*/
|
|
378
|
+
function buildAdvancedFilterParams(filters, options) {
|
|
379
|
+
var _a;
|
|
380
|
+
const qs = {};
|
|
381
|
+
for (const [key, value] of Object.entries(filters)) {
|
|
382
|
+
if (value === undefined || value === null || value === '') {
|
|
383
|
+
continue;
|
|
384
|
+
}
|
|
385
|
+
// Convert camelCase to snake_case for API
|
|
386
|
+
const snakeKey = key.replace(/([A-Z])/g, '_$1').toLowerCase();
|
|
387
|
+
// Handle date range filters
|
|
388
|
+
if ((_a = options === null || options === void 0 ? void 0 : options.dateFields) === null || _a === void 0 ? void 0 : _a.includes(key)) {
|
|
389
|
+
if (typeof value === 'object' && value !== null) {
|
|
390
|
+
const dateRange = value;
|
|
391
|
+
if (dateRange.from) {
|
|
392
|
+
qs[`filter[${snakeKey}_after]`] = dateRange.from;
|
|
393
|
+
}
|
|
394
|
+
if (dateRange.to) {
|
|
395
|
+
qs[`filter[${snakeKey}_before]`] = dateRange.to;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
else {
|
|
399
|
+
qs[`filter[${snakeKey}]`] = value;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
else {
|
|
403
|
+
qs[`filter[${snakeKey}]`] = value;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
// Add sorting
|
|
407
|
+
if (options === null || options === void 0 ? void 0 : options.sortField) {
|
|
408
|
+
const sortPrefix = options.sortDirection === 'desc' ? '-' : '';
|
|
409
|
+
const snakeSortField = options.sortField.replace(/([A-Z])/g, '_$1').toLowerCase();
|
|
410
|
+
qs.sort = `${sortPrefix}${snakeSortField}`;
|
|
411
|
+
}
|
|
412
|
+
return qs;
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Extract data from JSON:API response with proper typing
|
|
416
|
+
*/
|
|
417
|
+
function extractResponseData(response) {
|
|
418
|
+
if (!response || typeof response !== 'object') {
|
|
419
|
+
return undefined;
|
|
420
|
+
}
|
|
421
|
+
return response.data;
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
424
|
+
* Extract included resources from JSON:API response
|
|
425
|
+
*/
|
|
426
|
+
function extractIncludedResources(response) {
|
|
427
|
+
if (!response || typeof response !== 'object') {
|
|
428
|
+
return [];
|
|
429
|
+
}
|
|
430
|
+
return response.included || [];
|
|
431
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.discountRedemptionFields = exports.discountRedemptionOperations = void 0;
|
|
4
|
+
exports.discountRedemptionOperations = [
|
|
5
|
+
{
|
|
6
|
+
displayName: 'Operation',
|
|
7
|
+
name: 'operation',
|
|
8
|
+
type: 'options',
|
|
9
|
+
noDataExpression: true,
|
|
10
|
+
displayOptions: {
|
|
11
|
+
show: {
|
|
12
|
+
resource: ['discountRedemption'],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
options: [
|
|
16
|
+
{
|
|
17
|
+
name: 'Get',
|
|
18
|
+
value: 'get',
|
|
19
|
+
description: 'Get a discount redemption by ID',
|
|
20
|
+
action: 'Get a discount redemption',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: 'Get Many',
|
|
24
|
+
value: 'getAll',
|
|
25
|
+
description: 'Get many discount redemptions',
|
|
26
|
+
action: 'Get many discount redemptions',
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
default: 'getAll',
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
exports.discountRedemptionFields = [
|
|
33
|
+
// Get
|
|
34
|
+
{
|
|
35
|
+
displayName: 'Discount Redemption ID',
|
|
36
|
+
name: 'discountRedemptionId',
|
|
37
|
+
type: 'string',
|
|
38
|
+
required: true,
|
|
39
|
+
default: '',
|
|
40
|
+
displayOptions: {
|
|
41
|
+
show: {
|
|
42
|
+
resource: ['discountRedemption'],
|
|
43
|
+
operation: ['get'],
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
description: 'The ID of the discount redemption to retrieve',
|
|
47
|
+
},
|
|
48
|
+
// Get All
|
|
49
|
+
{
|
|
50
|
+
displayName: 'Return All',
|
|
51
|
+
name: 'returnAll',
|
|
52
|
+
type: 'boolean',
|
|
53
|
+
default: false,
|
|
54
|
+
displayOptions: {
|
|
55
|
+
show: {
|
|
56
|
+
resource: ['discountRedemption'],
|
|
57
|
+
operation: ['getAll'],
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
description: 'Whether to return all results or only up to a given limit',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
displayName: 'Limit',
|
|
64
|
+
name: 'limit',
|
|
65
|
+
type: 'number',
|
|
66
|
+
default: 50,
|
|
67
|
+
typeOptions: {
|
|
68
|
+
minValue: 1,
|
|
69
|
+
maxValue: 100,
|
|
70
|
+
},
|
|
71
|
+
displayOptions: {
|
|
72
|
+
show: {
|
|
73
|
+
resource: ['discountRedemption'],
|
|
74
|
+
operation: ['getAll'],
|
|
75
|
+
returnAll: [false],
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
description: 'Max number of results to return',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
displayName: 'Filters',
|
|
82
|
+
name: 'filters',
|
|
83
|
+
type: 'collection',
|
|
84
|
+
placeholder: 'Add Filter',
|
|
85
|
+
default: {},
|
|
86
|
+
displayOptions: {
|
|
87
|
+
show: {
|
|
88
|
+
resource: ['discountRedemption'],
|
|
89
|
+
operation: ['getAll'],
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
options: [
|
|
93
|
+
{
|
|
94
|
+
displayName: 'Discount ID',
|
|
95
|
+
name: 'discountId',
|
|
96
|
+
type: 'string',
|
|
97
|
+
default: '',
|
|
98
|
+
description: 'Filter by discount ID',
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
displayName: 'Order ID',
|
|
102
|
+
name: 'orderId',
|
|
103
|
+
type: 'string',
|
|
104
|
+
default: '',
|
|
105
|
+
description: 'Filter by order ID',
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
},
|
|
109
|
+
];
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import type { INodeProperties } from 'n8n-workflow';
|
|
2
2
|
import { productOperations, productFields } from './product';
|
|
3
3
|
import { orderOperations, orderFields } from './order';
|
|
4
|
+
import { orderItemOperations, orderItemFields } from './orderItem';
|
|
4
5
|
import { subscriptionOperations, subscriptionFields } from './subscription';
|
|
6
|
+
import { subscriptionInvoiceOperations, subscriptionInvoiceFields } from './subscriptionInvoice';
|
|
5
7
|
import { customerOperations, customerFields } from './customer';
|
|
6
8
|
import { licenseKeyOperations, licenseKeyFields } from './licenseKey';
|
|
9
|
+
import { licenseKeyInstanceOperations, licenseKeyInstanceFields } from './licenseKeyInstance';
|
|
7
10
|
import { discountOperations, discountFields } from './discount';
|
|
11
|
+
import { discountRedemptionOperations, discountRedemptionFields } from './discountRedemption';
|
|
8
12
|
import { storeOperations, storeFields } from './store';
|
|
9
13
|
import { variantOperations, variantFields } from './variant';
|
|
10
14
|
import { checkoutOperations, checkoutFields } from './checkout';
|
|
11
15
|
import { webhookOperations, webhookFields } from './webhook';
|
|
16
|
+
import { usageRecordOperations, usageRecordFields } from './usageRecord';
|
|
17
|
+
import { userOperations, userFields } from './user';
|
|
12
18
|
export declare const resourceProperty: INodeProperties;
|
|
13
19
|
export declare const allOperations: INodeProperties[];
|
|
14
20
|
export declare const allFields: INodeProperties[];
|
|
15
|
-
export { productOperations, productFields, orderOperations, orderFields, subscriptionOperations, subscriptionFields, customerOperations, customerFields, licenseKeyOperations, licenseKeyFields, discountOperations, discountFields, storeOperations, storeFields, variantOperations, variantFields, checkoutOperations, checkoutFields, webhookOperations, webhookFields, };
|
|
21
|
+
export { productOperations, productFields, orderOperations, orderFields, orderItemOperations, orderItemFields, subscriptionOperations, subscriptionFields, subscriptionInvoiceOperations, subscriptionInvoiceFields, customerOperations, customerFields, licenseKeyOperations, licenseKeyFields, licenseKeyInstanceOperations, licenseKeyInstanceFields, discountOperations, discountFields, discountRedemptionOperations, discountRedemptionFields, storeOperations, storeFields, variantOperations, variantFields, checkoutOperations, checkoutFields, webhookOperations, webhookFields, usageRecordOperations, usageRecordFields, userOperations, userFields, };
|
|
@@ -1,24 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.webhookFields = exports.webhookOperations = exports.checkoutFields = exports.checkoutOperations = exports.variantFields = exports.variantOperations = exports.storeFields = exports.storeOperations = exports.discountFields = exports.discountOperations = exports.licenseKeyFields = exports.licenseKeyOperations = exports.customerFields = exports.customerOperations = exports.subscriptionFields = exports.subscriptionOperations = exports.orderFields = exports.orderOperations = exports.productFields = exports.productOperations = exports.allFields = exports.allOperations = exports.resourceProperty = void 0;
|
|
3
|
+
exports.userFields = exports.userOperations = exports.usageRecordFields = exports.usageRecordOperations = exports.webhookFields = exports.webhookOperations = exports.checkoutFields = exports.checkoutOperations = exports.variantFields = exports.variantOperations = exports.storeFields = exports.storeOperations = exports.discountRedemptionFields = exports.discountRedemptionOperations = exports.discountFields = exports.discountOperations = exports.licenseKeyInstanceFields = exports.licenseKeyInstanceOperations = exports.licenseKeyFields = exports.licenseKeyOperations = exports.customerFields = exports.customerOperations = exports.subscriptionInvoiceFields = exports.subscriptionInvoiceOperations = exports.subscriptionFields = exports.subscriptionOperations = exports.orderItemFields = exports.orderItemOperations = exports.orderFields = exports.orderOperations = exports.productFields = exports.productOperations = exports.allFields = exports.allOperations = exports.resourceProperty = void 0;
|
|
4
4
|
const product_1 = require("./product");
|
|
5
5
|
Object.defineProperty(exports, "productOperations", { enumerable: true, get: function () { return product_1.productOperations; } });
|
|
6
6
|
Object.defineProperty(exports, "productFields", { enumerable: true, get: function () { return product_1.productFields; } });
|
|
7
7
|
const order_1 = require("./order");
|
|
8
8
|
Object.defineProperty(exports, "orderOperations", { enumerable: true, get: function () { return order_1.orderOperations; } });
|
|
9
9
|
Object.defineProperty(exports, "orderFields", { enumerable: true, get: function () { return order_1.orderFields; } });
|
|
10
|
+
const orderItem_1 = require("./orderItem");
|
|
11
|
+
Object.defineProperty(exports, "orderItemOperations", { enumerable: true, get: function () { return orderItem_1.orderItemOperations; } });
|
|
12
|
+
Object.defineProperty(exports, "orderItemFields", { enumerable: true, get: function () { return orderItem_1.orderItemFields; } });
|
|
10
13
|
const subscription_1 = require("./subscription");
|
|
11
14
|
Object.defineProperty(exports, "subscriptionOperations", { enumerable: true, get: function () { return subscription_1.subscriptionOperations; } });
|
|
12
15
|
Object.defineProperty(exports, "subscriptionFields", { enumerable: true, get: function () { return subscription_1.subscriptionFields; } });
|
|
16
|
+
const subscriptionInvoice_1 = require("./subscriptionInvoice");
|
|
17
|
+
Object.defineProperty(exports, "subscriptionInvoiceOperations", { enumerable: true, get: function () { return subscriptionInvoice_1.subscriptionInvoiceOperations; } });
|
|
18
|
+
Object.defineProperty(exports, "subscriptionInvoiceFields", { enumerable: true, get: function () { return subscriptionInvoice_1.subscriptionInvoiceFields; } });
|
|
13
19
|
const customer_1 = require("./customer");
|
|
14
20
|
Object.defineProperty(exports, "customerOperations", { enumerable: true, get: function () { return customer_1.customerOperations; } });
|
|
15
21
|
Object.defineProperty(exports, "customerFields", { enumerable: true, get: function () { return customer_1.customerFields; } });
|
|
16
22
|
const licenseKey_1 = require("./licenseKey");
|
|
17
23
|
Object.defineProperty(exports, "licenseKeyOperations", { enumerable: true, get: function () { return licenseKey_1.licenseKeyOperations; } });
|
|
18
24
|
Object.defineProperty(exports, "licenseKeyFields", { enumerable: true, get: function () { return licenseKey_1.licenseKeyFields; } });
|
|
25
|
+
const licenseKeyInstance_1 = require("./licenseKeyInstance");
|
|
26
|
+
Object.defineProperty(exports, "licenseKeyInstanceOperations", { enumerable: true, get: function () { return licenseKeyInstance_1.licenseKeyInstanceOperations; } });
|
|
27
|
+
Object.defineProperty(exports, "licenseKeyInstanceFields", { enumerable: true, get: function () { return licenseKeyInstance_1.licenseKeyInstanceFields; } });
|
|
19
28
|
const discount_1 = require("./discount");
|
|
20
29
|
Object.defineProperty(exports, "discountOperations", { enumerable: true, get: function () { return discount_1.discountOperations; } });
|
|
21
30
|
Object.defineProperty(exports, "discountFields", { enumerable: true, get: function () { return discount_1.discountFields; } });
|
|
31
|
+
const discountRedemption_1 = require("./discountRedemption");
|
|
32
|
+
Object.defineProperty(exports, "discountRedemptionOperations", { enumerable: true, get: function () { return discountRedemption_1.discountRedemptionOperations; } });
|
|
33
|
+
Object.defineProperty(exports, "discountRedemptionFields", { enumerable: true, get: function () { return discountRedemption_1.discountRedemptionFields; } });
|
|
22
34
|
const store_1 = require("./store");
|
|
23
35
|
Object.defineProperty(exports, "storeOperations", { enumerable: true, get: function () { return store_1.storeOperations; } });
|
|
24
36
|
Object.defineProperty(exports, "storeFields", { enumerable: true, get: function () { return store_1.storeFields; } });
|
|
@@ -31,6 +43,12 @@ Object.defineProperty(exports, "checkoutFields", { enumerable: true, get: functi
|
|
|
31
43
|
const webhook_1 = require("./webhook");
|
|
32
44
|
Object.defineProperty(exports, "webhookOperations", { enumerable: true, get: function () { return webhook_1.webhookOperations; } });
|
|
33
45
|
Object.defineProperty(exports, "webhookFields", { enumerable: true, get: function () { return webhook_1.webhookFields; } });
|
|
46
|
+
const usageRecord_1 = require("./usageRecord");
|
|
47
|
+
Object.defineProperty(exports, "usageRecordOperations", { enumerable: true, get: function () { return usageRecord_1.usageRecordOperations; } });
|
|
48
|
+
Object.defineProperty(exports, "usageRecordFields", { enumerable: true, get: function () { return usageRecord_1.usageRecordFields; } });
|
|
49
|
+
const user_1 = require("./user");
|
|
50
|
+
Object.defineProperty(exports, "userOperations", { enumerable: true, get: function () { return user_1.userOperations; } });
|
|
51
|
+
Object.defineProperty(exports, "userFields", { enumerable: true, get: function () { return user_1.userFields; } });
|
|
34
52
|
exports.resourceProperty = {
|
|
35
53
|
displayName: 'Resource',
|
|
36
54
|
name: 'resource',
|
|
@@ -40,11 +58,17 @@ exports.resourceProperty = {
|
|
|
40
58
|
{ name: 'Checkout', value: 'checkout' },
|
|
41
59
|
{ name: 'Customer', value: 'customer' },
|
|
42
60
|
{ name: 'Discount', value: 'discount' },
|
|
61
|
+
{ name: 'Discount Redemption', value: 'discountRedemption' },
|
|
43
62
|
{ name: 'License Key', value: 'licenseKey' },
|
|
63
|
+
{ name: 'License Key Instance', value: 'licenseKeyInstance' },
|
|
44
64
|
{ name: 'Order', value: 'order' },
|
|
65
|
+
{ name: 'Order Item', value: 'orderItem' },
|
|
45
66
|
{ name: 'Product', value: 'product' },
|
|
46
67
|
{ name: 'Store', value: 'store' },
|
|
47
68
|
{ name: 'Subscription', value: 'subscription' },
|
|
69
|
+
{ name: 'Subscription Invoice', value: 'subscriptionInvoice' },
|
|
70
|
+
{ name: 'Usage Record', value: 'usageRecord' },
|
|
71
|
+
{ name: 'User', value: 'user' },
|
|
48
72
|
{ name: 'Variant', value: 'variant' },
|
|
49
73
|
{ name: 'Webhook', value: 'webhook' },
|
|
50
74
|
],
|
|
@@ -53,24 +77,36 @@ exports.resourceProperty = {
|
|
|
53
77
|
exports.allOperations = [
|
|
54
78
|
product_1.productOperations,
|
|
55
79
|
order_1.orderOperations,
|
|
80
|
+
...orderItem_1.orderItemOperations,
|
|
56
81
|
subscription_1.subscriptionOperations,
|
|
82
|
+
...subscriptionInvoice_1.subscriptionInvoiceOperations,
|
|
57
83
|
customer_1.customerOperations,
|
|
58
84
|
licenseKey_1.licenseKeyOperations,
|
|
85
|
+
...licenseKeyInstance_1.licenseKeyInstanceOperations,
|
|
59
86
|
discount_1.discountOperations,
|
|
87
|
+
...discountRedemption_1.discountRedemptionOperations,
|
|
60
88
|
store_1.storeOperations,
|
|
61
89
|
variant_1.variantOperations,
|
|
62
90
|
checkout_1.checkoutOperations,
|
|
63
91
|
webhook_1.webhookOperations,
|
|
92
|
+
...usageRecord_1.usageRecordOperations,
|
|
93
|
+
...user_1.userOperations,
|
|
64
94
|
];
|
|
65
95
|
exports.allFields = [
|
|
66
96
|
...product_1.productFields,
|
|
67
97
|
...order_1.orderFields,
|
|
98
|
+
...orderItem_1.orderItemFields,
|
|
68
99
|
...subscription_1.subscriptionFields,
|
|
100
|
+
...subscriptionInvoice_1.subscriptionInvoiceFields,
|
|
69
101
|
...customer_1.customerFields,
|
|
70
102
|
...licenseKey_1.licenseKeyFields,
|
|
103
|
+
...licenseKeyInstance_1.licenseKeyInstanceFields,
|
|
71
104
|
...discount_1.discountFields,
|
|
105
|
+
...discountRedemption_1.discountRedemptionFields,
|
|
72
106
|
...store_1.storeFields,
|
|
73
107
|
...variant_1.variantFields,
|
|
74
108
|
...checkout_1.checkoutFields,
|
|
75
109
|
...webhook_1.webhookFields,
|
|
110
|
+
...usageRecord_1.usageRecordFields,
|
|
111
|
+
...user_1.userFields,
|
|
76
112
|
];
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.licenseKeyInstanceFields = exports.licenseKeyInstanceOperations = void 0;
|
|
4
|
+
exports.licenseKeyInstanceOperations = [
|
|
5
|
+
{
|
|
6
|
+
displayName: 'Operation',
|
|
7
|
+
name: 'operation',
|
|
8
|
+
type: 'options',
|
|
9
|
+
noDataExpression: true,
|
|
10
|
+
displayOptions: {
|
|
11
|
+
show: {
|
|
12
|
+
resource: ['licenseKeyInstance'],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
options: [
|
|
16
|
+
{
|
|
17
|
+
name: 'Get',
|
|
18
|
+
value: 'get',
|
|
19
|
+
description: 'Get a license key instance by ID',
|
|
20
|
+
action: 'Get a license key instance',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: 'Get Many',
|
|
24
|
+
value: 'getAll',
|
|
25
|
+
description: 'Get many license key instances',
|
|
26
|
+
action: 'Get many license key instances',
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
default: 'getAll',
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
exports.licenseKeyInstanceFields = [
|
|
33
|
+
// Get
|
|
34
|
+
{
|
|
35
|
+
displayName: 'License Key Instance ID',
|
|
36
|
+
name: 'licenseKeyInstanceId',
|
|
37
|
+
type: 'string',
|
|
38
|
+
required: true,
|
|
39
|
+
default: '',
|
|
40
|
+
displayOptions: {
|
|
41
|
+
show: {
|
|
42
|
+
resource: ['licenseKeyInstance'],
|
|
43
|
+
operation: ['get'],
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
description: 'The ID of the license key instance to retrieve',
|
|
47
|
+
},
|
|
48
|
+
// Get All
|
|
49
|
+
{
|
|
50
|
+
displayName: 'Return All',
|
|
51
|
+
name: 'returnAll',
|
|
52
|
+
type: 'boolean',
|
|
53
|
+
default: false,
|
|
54
|
+
displayOptions: {
|
|
55
|
+
show: {
|
|
56
|
+
resource: ['licenseKeyInstance'],
|
|
57
|
+
operation: ['getAll'],
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
description: 'Whether to return all results or only up to a given limit',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
displayName: 'Limit',
|
|
64
|
+
name: 'limit',
|
|
65
|
+
type: 'number',
|
|
66
|
+
default: 50,
|
|
67
|
+
typeOptions: {
|
|
68
|
+
minValue: 1,
|
|
69
|
+
maxValue: 100,
|
|
70
|
+
},
|
|
71
|
+
displayOptions: {
|
|
72
|
+
show: {
|
|
73
|
+
resource: ['licenseKeyInstance'],
|
|
74
|
+
operation: ['getAll'],
|
|
75
|
+
returnAll: [false],
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
description: 'Max number of results to return',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
displayName: 'Filters',
|
|
82
|
+
name: 'filters',
|
|
83
|
+
type: 'collection',
|
|
84
|
+
placeholder: 'Add Filter',
|
|
85
|
+
default: {},
|
|
86
|
+
displayOptions: {
|
|
87
|
+
show: {
|
|
88
|
+
resource: ['licenseKeyInstance'],
|
|
89
|
+
operation: ['getAll'],
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
options: [
|
|
93
|
+
{
|
|
94
|
+
displayName: 'License Key ID',
|
|
95
|
+
name: 'licenseKeyId',
|
|
96
|
+
type: 'string',
|
|
97
|
+
default: '',
|
|
98
|
+
description: 'Filter by license key ID',
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
},
|
|
102
|
+
];
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.orderItemFields = exports.orderItemOperations = void 0;
|
|
4
|
+
exports.orderItemOperations = [
|
|
5
|
+
{
|
|
6
|
+
displayName: 'Operation',
|
|
7
|
+
name: 'operation',
|
|
8
|
+
type: 'options',
|
|
9
|
+
noDataExpression: true,
|
|
10
|
+
displayOptions: {
|
|
11
|
+
show: {
|
|
12
|
+
resource: ['orderItem'],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
options: [
|
|
16
|
+
{
|
|
17
|
+
name: 'Get',
|
|
18
|
+
value: 'get',
|
|
19
|
+
description: 'Get an order item by ID',
|
|
20
|
+
action: 'Get an order item',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: 'Get Many',
|
|
24
|
+
value: 'getAll',
|
|
25
|
+
description: 'Get many order items',
|
|
26
|
+
action: 'Get many order items',
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
default: 'getAll',
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
exports.orderItemFields = [
|
|
33
|
+
// Get
|
|
34
|
+
{
|
|
35
|
+
displayName: 'Order Item ID',
|
|
36
|
+
name: 'orderItemId',
|
|
37
|
+
type: 'string',
|
|
38
|
+
required: true,
|
|
39
|
+
default: '',
|
|
40
|
+
displayOptions: {
|
|
41
|
+
show: {
|
|
42
|
+
resource: ['orderItem'],
|
|
43
|
+
operation: ['get'],
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
description: 'The ID of the order item to retrieve',
|
|
47
|
+
},
|
|
48
|
+
// Get All
|
|
49
|
+
{
|
|
50
|
+
displayName: 'Return All',
|
|
51
|
+
name: 'returnAll',
|
|
52
|
+
type: 'boolean',
|
|
53
|
+
default: false,
|
|
54
|
+
displayOptions: {
|
|
55
|
+
show: {
|
|
56
|
+
resource: ['orderItem'],
|
|
57
|
+
operation: ['getAll'],
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
description: 'Whether to return all results or only up to a given limit',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
displayName: 'Limit',
|
|
64
|
+
name: 'limit',
|
|
65
|
+
type: 'number',
|
|
66
|
+
default: 50,
|
|
67
|
+
typeOptions: {
|
|
68
|
+
minValue: 1,
|
|
69
|
+
maxValue: 100,
|
|
70
|
+
},
|
|
71
|
+
displayOptions: {
|
|
72
|
+
show: {
|
|
73
|
+
resource: ['orderItem'],
|
|
74
|
+
operation: ['getAll'],
|
|
75
|
+
returnAll: [false],
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
description: 'Max number of results to return',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
displayName: 'Filters',
|
|
82
|
+
name: 'filters',
|
|
83
|
+
type: 'collection',
|
|
84
|
+
placeholder: 'Add Filter',
|
|
85
|
+
default: {},
|
|
86
|
+
displayOptions: {
|
|
87
|
+
show: {
|
|
88
|
+
resource: ['orderItem'],
|
|
89
|
+
operation: ['getAll'],
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
options: [
|
|
93
|
+
{
|
|
94
|
+
displayName: 'Order ID',
|
|
95
|
+
name: 'orderId',
|
|
96
|
+
type: 'string',
|
|
97
|
+
default: '',
|
|
98
|
+
description: 'Filter by order ID',
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
displayName: 'Product ID',
|
|
102
|
+
name: 'productId',
|
|
103
|
+
type: 'string',
|
|
104
|
+
default: '',
|
|
105
|
+
description: 'Filter by product ID',
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
displayName: 'Variant ID',
|
|
109
|
+
name: 'variantId',
|
|
110
|
+
type: 'string',
|
|
111
|
+
default: '',
|
|
112
|
+
description: 'Filter by variant ID',
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
},
|
|
116
|
+
];
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.subscriptionInvoiceFields = exports.subscriptionInvoiceOperations = void 0;
|
|
4
|
+
exports.subscriptionInvoiceOperations = [
|
|
5
|
+
{
|
|
6
|
+
displayName: 'Operation',
|
|
7
|
+
name: 'operation',
|
|
8
|
+
type: 'options',
|
|
9
|
+
noDataExpression: true,
|
|
10
|
+
displayOptions: {
|
|
11
|
+
show: {
|
|
12
|
+
resource: ['subscriptionInvoice'],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
options: [
|
|
16
|
+
{
|
|
17
|
+
name: 'Get',
|
|
18
|
+
value: 'get',
|
|
19
|
+
description: 'Get a subscription invoice by ID',
|
|
20
|
+
action: 'Get a subscription invoice',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: 'Get Many',
|
|
24
|
+
value: 'getAll',
|
|
25
|
+
description: 'Get many subscription invoices',
|
|
26
|
+
action: 'Get many subscription invoices',
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
default: 'getAll',
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
exports.subscriptionInvoiceFields = [
|
|
33
|
+
// Get
|
|
34
|
+
{
|
|
35
|
+
displayName: 'Subscription Invoice ID',
|
|
36
|
+
name: 'subscriptionInvoiceId',
|
|
37
|
+
type: 'string',
|
|
38
|
+
required: true,
|
|
39
|
+
default: '',
|
|
40
|
+
displayOptions: {
|
|
41
|
+
show: {
|
|
42
|
+
resource: ['subscriptionInvoice'],
|
|
43
|
+
operation: ['get'],
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
description: 'The ID of the subscription invoice to retrieve',
|
|
47
|
+
},
|
|
48
|
+
// Get All
|
|
49
|
+
{
|
|
50
|
+
displayName: 'Return All',
|
|
51
|
+
name: 'returnAll',
|
|
52
|
+
type: 'boolean',
|
|
53
|
+
default: false,
|
|
54
|
+
displayOptions: {
|
|
55
|
+
show: {
|
|
56
|
+
resource: ['subscriptionInvoice'],
|
|
57
|
+
operation: ['getAll'],
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
description: 'Whether to return all results or only up to a given limit',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
displayName: 'Limit',
|
|
64
|
+
name: 'limit',
|
|
65
|
+
type: 'number',
|
|
66
|
+
default: 50,
|
|
67
|
+
typeOptions: {
|
|
68
|
+
minValue: 1,
|
|
69
|
+
maxValue: 100,
|
|
70
|
+
},
|
|
71
|
+
displayOptions: {
|
|
72
|
+
show: {
|
|
73
|
+
resource: ['subscriptionInvoice'],
|
|
74
|
+
operation: ['getAll'],
|
|
75
|
+
returnAll: [false],
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
description: 'Max number of results to return',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
displayName: 'Filters',
|
|
82
|
+
name: 'filters',
|
|
83
|
+
type: 'collection',
|
|
84
|
+
placeholder: 'Add Filter',
|
|
85
|
+
default: {},
|
|
86
|
+
displayOptions: {
|
|
87
|
+
show: {
|
|
88
|
+
resource: ['subscriptionInvoice'],
|
|
89
|
+
operation: ['getAll'],
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
options: [
|
|
93
|
+
{
|
|
94
|
+
displayName: 'Store ID',
|
|
95
|
+
name: 'storeId',
|
|
96
|
+
type: 'string',
|
|
97
|
+
default: '',
|
|
98
|
+
description: 'Filter by store ID',
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
displayName: 'Subscription ID',
|
|
102
|
+
name: 'subscriptionId',
|
|
103
|
+
type: 'string',
|
|
104
|
+
default: '',
|
|
105
|
+
description: 'Filter by subscription ID',
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
displayName: 'Status',
|
|
109
|
+
name: 'status',
|
|
110
|
+
type: 'options',
|
|
111
|
+
default: '',
|
|
112
|
+
options: [
|
|
113
|
+
{ name: 'Pending', value: 'pending' },
|
|
114
|
+
{ name: 'Paid', value: 'paid' },
|
|
115
|
+
{ name: 'Void', value: 'void' },
|
|
116
|
+
{ name: 'Refunded', value: 'refunded' },
|
|
117
|
+
],
|
|
118
|
+
description: 'Filter by invoice status',
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
displayName: 'Refunded',
|
|
122
|
+
name: 'refunded',
|
|
123
|
+
type: 'boolean',
|
|
124
|
+
default: false,
|
|
125
|
+
description: 'Whether to filter by refunded invoices',
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
},
|
|
129
|
+
];
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.usageRecordFields = exports.usageRecordOperations = void 0;
|
|
4
|
+
exports.usageRecordOperations = [
|
|
5
|
+
{
|
|
6
|
+
displayName: 'Operation',
|
|
7
|
+
name: 'operation',
|
|
8
|
+
type: 'options',
|
|
9
|
+
noDataExpression: true,
|
|
10
|
+
displayOptions: {
|
|
11
|
+
show: {
|
|
12
|
+
resource: ['usageRecord'],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
options: [
|
|
16
|
+
{
|
|
17
|
+
name: 'Get',
|
|
18
|
+
value: 'get',
|
|
19
|
+
description: 'Get a usage record by ID',
|
|
20
|
+
action: 'Get a usage record',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: 'Get Many',
|
|
24
|
+
value: 'getAll',
|
|
25
|
+
description: 'Get many usage records',
|
|
26
|
+
action: 'Get many usage records',
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
default: 'getAll',
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
exports.usageRecordFields = [
|
|
33
|
+
// Get
|
|
34
|
+
{
|
|
35
|
+
displayName: 'Usage Record ID',
|
|
36
|
+
name: 'usageRecordId',
|
|
37
|
+
type: 'string',
|
|
38
|
+
required: true,
|
|
39
|
+
default: '',
|
|
40
|
+
displayOptions: {
|
|
41
|
+
show: {
|
|
42
|
+
resource: ['usageRecord'],
|
|
43
|
+
operation: ['get'],
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
description: 'The ID of the usage record to retrieve',
|
|
47
|
+
},
|
|
48
|
+
// Get All
|
|
49
|
+
{
|
|
50
|
+
displayName: 'Return All',
|
|
51
|
+
name: 'returnAll',
|
|
52
|
+
type: 'boolean',
|
|
53
|
+
default: false,
|
|
54
|
+
displayOptions: {
|
|
55
|
+
show: {
|
|
56
|
+
resource: ['usageRecord'],
|
|
57
|
+
operation: ['getAll'],
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
description: 'Whether to return all results or only up to a given limit',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
displayName: 'Limit',
|
|
64
|
+
name: 'limit',
|
|
65
|
+
type: 'number',
|
|
66
|
+
default: 50,
|
|
67
|
+
typeOptions: {
|
|
68
|
+
minValue: 1,
|
|
69
|
+
maxValue: 100,
|
|
70
|
+
},
|
|
71
|
+
displayOptions: {
|
|
72
|
+
show: {
|
|
73
|
+
resource: ['usageRecord'],
|
|
74
|
+
operation: ['getAll'],
|
|
75
|
+
returnAll: [false],
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
description: 'Max number of results to return',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
displayName: 'Filters',
|
|
82
|
+
name: 'filters',
|
|
83
|
+
type: 'collection',
|
|
84
|
+
placeholder: 'Add Filter',
|
|
85
|
+
default: {},
|
|
86
|
+
displayOptions: {
|
|
87
|
+
show: {
|
|
88
|
+
resource: ['usageRecord'],
|
|
89
|
+
operation: ['getAll'],
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
options: [
|
|
93
|
+
{
|
|
94
|
+
displayName: 'Subscription Item ID',
|
|
95
|
+
name: 'subscriptionItemId',
|
|
96
|
+
type: 'string',
|
|
97
|
+
default: '',
|
|
98
|
+
description: 'Filter by subscription item ID',
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
},
|
|
102
|
+
];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.userFields = exports.userOperations = void 0;
|
|
4
|
+
exports.userOperations = [
|
|
5
|
+
{
|
|
6
|
+
displayName: 'Operation',
|
|
7
|
+
name: 'operation',
|
|
8
|
+
type: 'options',
|
|
9
|
+
noDataExpression: true,
|
|
10
|
+
displayOptions: {
|
|
11
|
+
show: {
|
|
12
|
+
resource: ['user'],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
options: [
|
|
16
|
+
{
|
|
17
|
+
name: 'Get Current',
|
|
18
|
+
value: 'getCurrent',
|
|
19
|
+
description: 'Get the currently authenticated user',
|
|
20
|
+
action: 'Get current user',
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
default: 'getCurrent',
|
|
24
|
+
},
|
|
25
|
+
];
|
|
26
|
+
exports.userFields = [];
|