@disruptive-learning/n8n-nodes-gigstack 1.1.0 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/credentials/GigstackApi.credentials.d.ts +2 -1
  2. package/dist/credentials/GigstackApi.credentials.js +30 -17
  3. package/dist/nodes/Gigstack/GenericFunctions.d.ts +5 -0
  4. package/dist/nodes/Gigstack/GenericFunctions.js +78 -0
  5. package/dist/nodes/{Gigstack.node.d.ts → Gigstack/Gigstack.node.d.ts} +1 -1
  6. package/dist/nodes/Gigstack/Gigstack.node.js +952 -0
  7. package/dist/nodes/Gigstack/GigstackTrigger.node.d.ts +12 -0
  8. package/dist/nodes/Gigstack/GigstackTrigger.node.js +207 -0
  9. package/dist/nodes/Gigstack/descriptions/ClientDescription.d.ts +3 -0
  10. package/dist/nodes/Gigstack/descriptions/ClientDescription.js +595 -0
  11. package/dist/nodes/Gigstack/descriptions/InvoiceDescription.d.ts +3 -0
  12. package/dist/nodes/Gigstack/descriptions/InvoiceDescription.js +503 -0
  13. package/dist/nodes/Gigstack/descriptions/PaymentDescription.d.ts +3 -0
  14. package/dist/nodes/Gigstack/descriptions/PaymentDescription.js +454 -0
  15. package/dist/nodes/Gigstack/descriptions/ReceiptDescription.d.ts +3 -0
  16. package/dist/nodes/Gigstack/descriptions/ReceiptDescription.js +369 -0
  17. package/dist/nodes/Gigstack/descriptions/ServiceDescription.d.ts +3 -0
  18. package/dist/nodes/Gigstack/descriptions/ServiceDescription.js +381 -0
  19. package/dist/nodes/Gigstack/descriptions/TeamDescription.d.ts +3 -0
  20. package/dist/nodes/Gigstack/descriptions/TeamDescription.js +599 -0
  21. package/dist/nodes/Gigstack/descriptions/UserDescription.d.ts +3 -0
  22. package/dist/nodes/Gigstack/descriptions/UserDescription.js +362 -0
  23. package/dist/nodes/Gigstack/descriptions/WebhookDescription.d.ts +3 -0
  24. package/dist/nodes/Gigstack/descriptions/WebhookDescription.js +293 -0
  25. package/dist/nodes/Gigstack/descriptions/index.d.ts +8 -0
  26. package/dist/nodes/Gigstack/descriptions/index.js +24 -0
  27. package/dist/nodes/Gigstack/gigstack.svg +1 -0
  28. package/package.json +64 -57
  29. package/LICENSE +0 -21
  30. package/README.md +0 -72
  31. package/dist/nodes/Gigstack.node.js +0 -1213
  32. package/dist/nodes/gigstack.svg +0 -4
@@ -0,0 +1,12 @@
1
+ import type { IHookFunctions, IWebhookFunctions, INodeType, INodeTypeDescription, IWebhookResponseData } from 'n8n-workflow';
2
+ export declare class GigstackTrigger implements INodeType {
3
+ description: INodeTypeDescription;
4
+ webhookMethods: {
5
+ default: {
6
+ checkExists(this: IHookFunctions): Promise<boolean>;
7
+ create(this: IHookFunctions): Promise<boolean>;
8
+ delete(this: IHookFunctions): Promise<boolean>;
9
+ };
10
+ };
11
+ webhook(this: IWebhookFunctions): Promise<IWebhookResponseData>;
12
+ }
@@ -0,0 +1,207 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GigstackTrigger = void 0;
4
+ const GenericFunctions_1 = require("./GenericFunctions");
5
+ class GigstackTrigger {
6
+ constructor() {
7
+ this.description = {
8
+ displayName: 'Gigstack Trigger',
9
+ name: 'gigstackTrigger',
10
+ icon: 'file:gigstack.svg',
11
+ group: ['trigger'],
12
+ version: 1,
13
+ subtitle: '={{$parameter["events"].join(", ")}}',
14
+ description: 'Handle Gigstack webhook events',
15
+ defaults: {
16
+ name: 'Gigstack Trigger',
17
+ },
18
+ inputs: [],
19
+ outputs: ['main'],
20
+ credentials: [
21
+ {
22
+ name: 'gigstackApi',
23
+ required: true,
24
+ },
25
+ ],
26
+ webhooks: [
27
+ {
28
+ name: 'default',
29
+ httpMethod: 'POST',
30
+ responseMode: 'onReceived',
31
+ path: 'webhook',
32
+ },
33
+ ],
34
+ properties: [
35
+ {
36
+ displayName: 'Events',
37
+ name: 'events',
38
+ type: 'multiOptions',
39
+ required: true,
40
+ default: [],
41
+ options: [
42
+ {
43
+ name: 'Client Created',
44
+ value: 'client.created',
45
+ description: 'Triggered when a new client is created',
46
+ },
47
+ {
48
+ name: 'Client Deleted',
49
+ value: 'client.deleted',
50
+ description: 'Triggered when a client is deleted',
51
+ },
52
+ {
53
+ name: 'Client Updated',
54
+ value: 'client.updated',
55
+ description: 'Triggered when a client is updated',
56
+ },
57
+ {
58
+ name: 'Invoice Cancelled',
59
+ value: 'invoice.cancelled',
60
+ description: 'Triggered when an invoice is cancelled',
61
+ },
62
+ {
63
+ name: 'Invoice Created',
64
+ value: 'invoice.created',
65
+ description: 'Triggered when a new invoice is created',
66
+ },
67
+ {
68
+ name: 'Invoice Sent',
69
+ value: 'invoice.sent',
70
+ description: 'Triggered when an invoice is sent via email',
71
+ },
72
+ {
73
+ name: 'Invoice Stamped',
74
+ value: 'invoice.stamped',
75
+ description: 'Triggered when an invoice is stamped with SAT',
76
+ },
77
+ {
78
+ name: 'Payment Cancelled',
79
+ value: 'payment.cancelled',
80
+ description: 'Triggered when a payment is cancelled',
81
+ },
82
+ {
83
+ name: 'Payment Created',
84
+ value: 'payment.created',
85
+ description: 'Triggered when a new payment is created',
86
+ },
87
+ {
88
+ name: 'Payment Failed',
89
+ value: 'payment.failed',
90
+ description: 'Triggered when a payment fails',
91
+ },
92
+ {
93
+ name: 'Payment Refunded',
94
+ value: 'payment.refunded',
95
+ description: 'Triggered when a payment is refunded',
96
+ },
97
+ {
98
+ name: 'Payment Succeeded',
99
+ value: 'payment.succeeded',
100
+ description: 'Triggered when a payment succeeds',
101
+ },
102
+ {
103
+ name: 'Receipt Cancelled',
104
+ value: 'receipt.cancelled',
105
+ description: 'Triggered when a receipt is cancelled',
106
+ },
107
+ {
108
+ name: 'Receipt Created',
109
+ value: 'receipt.created',
110
+ description: 'Triggered when a new receipt is created',
111
+ },
112
+ {
113
+ name: 'Receipt Stamped',
114
+ value: 'receipt.stamped',
115
+ description: 'Triggered when a receipt is stamped as invoice',
116
+ },
117
+ ],
118
+ description: 'The events to listen for',
119
+ },
120
+ {
121
+ displayName: 'Team ID',
122
+ name: 'team',
123
+ type: 'string',
124
+ default: '',
125
+ description: 'Team ID for Gigstack Connect (multi-team access). Leave empty to use default team.',
126
+ },
127
+ ],
128
+ };
129
+ this.webhookMethods = {
130
+ default: {
131
+ async checkExists() {
132
+ const webhookUrl = this.getNodeWebhookUrl('default');
133
+ const webhookData = this.getWorkflowStaticData('node');
134
+ const team = this.getNodeParameter('team', '');
135
+ const qs = {};
136
+ if (team)
137
+ qs.team = team;
138
+ // Get all webhooks
139
+ const response = await GenericFunctions_1.gigstackApiRequest.call(this, 'GET', '/webhooks', {}, qs);
140
+ const webhooks = response.data || [];
141
+ // Check if webhook with our URL exists
142
+ for (const webhook of webhooks) {
143
+ if (webhook.url === webhookUrl) {
144
+ webhookData.webhookId = webhook.id;
145
+ return true;
146
+ }
147
+ }
148
+ return false;
149
+ },
150
+ async create() {
151
+ const webhookUrl = this.getNodeWebhookUrl('default');
152
+ const events = this.getNodeParameter('events');
153
+ const team = this.getNodeParameter('team', '');
154
+ const qs = {};
155
+ if (team)
156
+ qs.team = team;
157
+ const body = {
158
+ url: webhookUrl,
159
+ events,
160
+ status: 'active',
161
+ description: `n8n webhook - ${events.join(', ')}`,
162
+ };
163
+ const response = await GenericFunctions_1.gigstackApiRequest.call(this, 'POST', '/webhooks', body, qs);
164
+ const webhookData = this.getWorkflowStaticData('node');
165
+ if (response.data && response.data.id) {
166
+ webhookData.webhookId = response.data.id;
167
+ return true;
168
+ }
169
+ return false;
170
+ },
171
+ async delete() {
172
+ const webhookData = this.getWorkflowStaticData('node');
173
+ const team = this.getNodeParameter('team', '');
174
+ const qs = {};
175
+ if (team)
176
+ qs.team = team;
177
+ if (webhookData.webhookId) {
178
+ try {
179
+ await GenericFunctions_1.gigstackApiRequest.call(this, 'DELETE', `/webhooks/${webhookData.webhookId}`, {}, qs);
180
+ }
181
+ catch (error) {
182
+ return false;
183
+ }
184
+ delete webhookData.webhookId;
185
+ }
186
+ return true;
187
+ },
188
+ },
189
+ };
190
+ }
191
+ async webhook() {
192
+ const bodyData = this.getBodyData();
193
+ const events = this.getNodeParameter('events');
194
+ // Check if the event is one we're listening for
195
+ const eventType = bodyData.event;
196
+ if (eventType && !events.includes(eventType)) {
197
+ // Event type doesn't match, ignore
198
+ return {
199
+ noWebhookResponse: true,
200
+ };
201
+ }
202
+ return {
203
+ workflowData: [this.helpers.returnJsonArray(bodyData)],
204
+ };
205
+ }
206
+ }
207
+ exports.GigstackTrigger = GigstackTrigger;
@@ -0,0 +1,3 @@
1
+ import type { INodeProperties } from 'n8n-workflow';
2
+ export declare const clientOperations: INodeProperties[];
3
+ export declare const clientFields: INodeProperties[];