@scopieflows/app-quickbooks 0.1.1

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 (41) hide show
  1. package/README.md +7 -0
  2. package/package.json +29 -0
  3. package/src/actions/create-expense.d.ts +8 -0
  4. package/src/actions/create-expense.js +192 -0
  5. package/src/actions/create-expense.js.map +1 -0
  6. package/src/actions/create-invoice.d.ts +11 -0
  7. package/src/actions/create-invoice.js +188 -0
  8. package/src/actions/create-invoice.js.map +1 -0
  9. package/src/actions/find-customer.d.ts +3 -0
  10. package/src/actions/find-customer.js +60 -0
  11. package/src/actions/find-customer.js.map +1 -0
  12. package/src/actions/find-invoice.d.ts +3 -0
  13. package/src/actions/find-invoice.js +60 -0
  14. package/src/actions/find-invoice.js.map +1 -0
  15. package/src/actions/find-payment.d.ts +3 -0
  16. package/src/actions/find-payment.js +53 -0
  17. package/src/actions/find-payment.js.map +1 -0
  18. package/src/index.d.ts +2 -0
  19. package/src/index.js +69 -0
  20. package/src/index.js.map +1 -0
  21. package/src/lib/common.d.ts +21 -0
  22. package/src/lib/common.js +12 -0
  23. package/src/lib/common.js.map +1 -0
  24. package/src/lib/types.d.ts +280 -0
  25. package/src/lib/types.js +3 -0
  26. package/src/lib/types.js.map +1 -0
  27. package/src/triggers/new-customer.d.ts +2 -0
  28. package/src/triggers/new-customer.js +78 -0
  29. package/src/triggers/new-customer.js.map +1 -0
  30. package/src/triggers/new-deposit.d.ts +2 -0
  31. package/src/triggers/new-deposit.js +78 -0
  32. package/src/triggers/new-deposit.js.map +1 -0
  33. package/src/triggers/new-expense.d.ts +2 -0
  34. package/src/triggers/new-expense.js +78 -0
  35. package/src/triggers/new-expense.js.map +1 -0
  36. package/src/triggers/new-invoice.d.ts +2 -0
  37. package/src/triggers/new-invoice.js +78 -0
  38. package/src/triggers/new-invoice.js.map +1 -0
  39. package/src/triggers/new-transfer.d.ts +2 -0
  40. package/src/triggers/new-transfer.js +78 -0
  41. package/src/triggers/new-transfer.js.map +1 -0
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findPaymentAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
6
+ const index_1 = require("../index"); // Correct path relative to actions/find-payment.ts
7
+ const pieces_common_1 = require("@scopieflows/pieces-common");
8
+ const common_1 = require("../lib/common");
9
+ exports.findPaymentAction = (0, pieces_framework_1.createAction)({
10
+ auth: index_1.quickbooksAuth,
11
+ name: 'find_payment',
12
+ displayName: 'Find Payment',
13
+ description: 'Finds an existing payment in QuickBooks.',
14
+ props: {
15
+ customerId: pieces_framework_1.Property.ShortText({
16
+ displayName: 'Customer ID',
17
+ description: 'The ID of the customer to find payments for.',
18
+ required: true,
19
+ }),
20
+ },
21
+ run(context) {
22
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
23
+ var _a, _b, _c, _d;
24
+ const { customerId } = context.propsValue;
25
+ const companyId = (_a = context.auth.props) === null || _a === void 0 ? void 0 : _a['companyId'];
26
+ if (!companyId) {
27
+ throw new Error('Realm ID not found in authentication data. Please reconnect.');
28
+ }
29
+ const apiUrl = common_1.quickbooksCommon.getApiUrl(companyId);
30
+ const query = `SELECT * FROM Payment WHERE CustomerRef = '${customerId}'`;
31
+ const response = yield pieces_common_1.httpClient.sendRequest({
32
+ method: pieces_common_1.HttpMethod.GET,
33
+ url: `${apiUrl}/query?query=${encodeURIComponent(query)}&minorversion=70`,
34
+ headers: {
35
+ Authorization: `Bearer ${context.auth.access_token}`,
36
+ Accept: 'application/json',
37
+ },
38
+ });
39
+ if (((_b = response.body.QueryResponse) === null || _b === void 0 ? void 0 : _b['Payment']) &&
40
+ ((_c = response.body.QueryResponse) === null || _c === void 0 ? void 0 : _c['Payment'].length) > 0) {
41
+ return {
42
+ found: true,
43
+ result: (_d = response.body.QueryResponse) === null || _d === void 0 ? void 0 : _d['Payment'],
44
+ };
45
+ }
46
+ return {
47
+ found: false,
48
+ result: [],
49
+ };
50
+ });
51
+ },
52
+ });
53
+ //# sourceMappingURL=find-payment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find-payment.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/community/quickbooks/src/actions/find-payment.ts"],"names":[],"mappings":";;;;AAAA,oEAAuE;AACvE,oCAA0C,CAAC,mDAAmD;AAC9F,8DAAoE;AACpE,0CAA2E;AA8C9D,QAAA,iBAAiB,GAAG,IAAA,+BAAY,EAAC;IAC7C,IAAI,EAAE,sBAAc;IACpB,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,0CAA0C;IACvD,KAAK,EAAE;QACN,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC9B,WAAW,EAAE,aAAa;YAC1B,WAAW,EAAE,8CAA8C;YAC3D,QAAQ,EAAE,IAAI;SACd,CAAC;KACF;IACK,GAAG,CAAC,OAAO;;;YAChB,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAC1C,MAAM,SAAS,GAAG,MAAA,OAAO,CAAC,IAAI,CAAC,KAAK,0CAAG,WAAW,CAAC,CAAC;YAEpD,IAAI,CAAC,SAAS,EAAE,CAAC;gBAChB,MAAM,IAAI,KAAK,CAAC,8DAA8D,CAAC,CAAC;YACjF,CAAC;YAED,MAAM,MAAM,GAAG,yBAAgB,CAAC,SAAS,CAAC,SAAmB,CAAC,CAAC;YAC/D,MAAM,KAAK,GAAG,8CAA8C,UAAU,GAAG,CAAC;YAE1E,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAA8C;gBAC1F,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG,EAAE,GAAG,MAAM,gBAAgB,kBAAkB,CAAC,KAAK,CAAC,kBAAkB;gBACzE,OAAO,EAAE;oBACR,aAAa,EAAE,UAAU,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE;oBACpD,MAAM,EAAE,kBAAkB;iBAC1B;aACD,CAAC,CAAC;YAEH,IACC,CAAA,MAAA,QAAQ,CAAC,IAAI,CAAC,aAAa,0CAAG,SAAS,CAAC;gBACxC,CAAA,MAAA,QAAQ,CAAC,IAAI,CAAC,aAAa,0CAAG,SAAS,EAAE,MAAM,IAAG,CAAC,EAClD,CAAC;gBACF,OAAO;oBACN,KAAK,EAAE,IAAI;oBACX,MAAM,EAAE,MAAA,QAAQ,CAAC,IAAI,CAAC,aAAa,0CAAG,SAAS,CAAC;iBAChD,CAAC;YACH,CAAC;YAED,OAAO;gBACN,KAAK,EAAE,KAAK;gBACZ,MAAM,EAAE,EAAE;aACV,CAAC;QACH,CAAC;KAAA;CACD,CAAC,CAAC"}
package/src/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export declare const quickbooksAuth: import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>;
2
+ export declare const quickbooks: import("@scopieflows/pieces-framework").Piece<import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>>;
package/src/index.js ADDED
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.quickbooks = exports.quickbooksAuth = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
6
+ const find_invoice_1 = require("./actions/find-invoice");
7
+ const find_customer_1 = require("./actions/find-customer");
8
+ const find_payment_1 = require("./actions/find-payment");
9
+ const create_invoice_1 = require("./actions/create-invoice");
10
+ const create_expense_1 = require("./actions/create-expense");
11
+ const new_invoice_1 = require("./triggers/new-invoice");
12
+ const new_expense_1 = require("./triggers/new-expense");
13
+ const new_customer_1 = require("./triggers/new-customer");
14
+ const new_deposit_1 = require("./triggers/new-deposit");
15
+ const new_transfer_1 = require("./triggers/new-transfer");
16
+ const pieces_common_1 = require("@scopieflows/pieces-common");
17
+ const common_1 = require("./lib/common");
18
+ exports.quickbooksAuth = pieces_framework_1.PieceAuth.OAuth2({
19
+ description: 'You can find Company ID under **settings->Additional Info**.',
20
+ required: true,
21
+ props: {
22
+ companyId: pieces_framework_1.Property.ShortText({
23
+ displayName: 'Company ID',
24
+ required: true,
25
+ })
26
+ },
27
+ authUrl: 'https://appcenter.intuit.com/connect/oauth2',
28
+ tokenUrl: 'https://oauth.platform.intuit.com/oauth2/v1/tokens/bearer',
29
+ scope: ['com.intuit.quickbooks.accounting'],
30
+ });
31
+ exports.quickbooks = (0, pieces_framework_1.createPiece)({
32
+ displayName: "Quickbooks Online",
33
+ auth: exports.quickbooksAuth,
34
+ minimumSupportedRelease: '0.36.1',
35
+ logoUrl: "/pieces/quickbooks.png",
36
+ authors: [
37
+ 'onyedikachi-david'
38
+ ],
39
+ actions: [
40
+ find_invoice_1.findInvoiceAction,
41
+ find_customer_1.findCustomerAction,
42
+ find_payment_1.findPaymentAction,
43
+ create_invoice_1.createInvoiceAction,
44
+ create_expense_1.createExpenseAction,
45
+ (0, pieces_common_1.createCustomApiCallAction)({
46
+ auth: exports.quickbooksAuth,
47
+ baseUrl: (auth) => {
48
+ var _a;
49
+ const authValue = auth;
50
+ const companyId = (_a = authValue.props) === null || _a === void 0 ? void 0 : _a['companyId'];
51
+ const apiUrl = common_1.quickbooksCommon.getApiUrl(companyId);
52
+ return apiUrl;
53
+ },
54
+ authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
55
+ return {
56
+ Authorization: `Bearer ${auth.access_token}`
57
+ };
58
+ })
59
+ })
60
+ ],
61
+ triggers: [
62
+ new_invoice_1.newInvoice,
63
+ new_expense_1.newExpense,
64
+ new_customer_1.newCustomer,
65
+ new_deposit_1.newDeposit,
66
+ new_transfer_1.newTransfer
67
+ ],
68
+ });
69
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/quickbooks/src/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A4B,CAAC,YAAY,EAAE;iBACrE,CAAA;YACH,CAAC,CAAA;SACL,CAAC;KACA;IACD,QAAQ,EAAE;QACR,wBAAU;QACV,wBAAU;QACV,0BAAW;QACX,wBAAU;QACV,0BAAW;KACZ;CACF,CAAC,CAAC"}
@@ -0,0 +1,21 @@
1
+ export declare const quickbooksCommon: {
2
+ getApiUrl: (realmId: string) => string;
3
+ };
4
+ export interface QuickbooksEntityResponse<T> {
5
+ QueryResponse?: {
6
+ startPosition?: number;
7
+ maxResults?: number;
8
+ totalCount?: number;
9
+ } & {
10
+ [key: string]: T[] | undefined;
11
+ };
12
+ Fault?: {
13
+ Error: {
14
+ Message: string;
15
+ Detail?: string;
16
+ code: string;
17
+ }[];
18
+ type: string;
19
+ };
20
+ time?: string;
21
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.quickbooksCommon = void 0;
4
+ const QUICKBOOKS_API_URL_SANDBOX = 'https://sandbox-quickbooks.api.intuit.com/v3/company';
5
+ const QUICKBOOKS_API_URL_PRODUCTION = 'https://quickbooks.api.intuit.com/v3/company';
6
+ exports.quickbooksCommon = {
7
+ getApiUrl: (realmId) => {
8
+ const baseUrl = QUICKBOOKS_API_URL_PRODUCTION;
9
+ return `${baseUrl}/${realmId}`;
10
+ },
11
+ };
12
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/community/quickbooks/src/lib/common.ts"],"names":[],"mappings":";;;AAAA,MAAM,0BAA0B,GAAG,sDAAsD,CAAC;AAC1F,MAAM,6BAA6B,GAAG,8CAA8C,CAAC;AAExE,QAAA,gBAAgB,GAAG;IAC5B,SAAS,EAAE,CAAC,OAAe,EAAE,EAAE;QAC3B,MAAM,OAAO,GAAG,6BAA6B,CAAC;QAC9C,OAAO,GAAG,OAAO,IAAI,OAAO,EAAE,CAAC;IACnC,CAAC;CACJ,CAAC"}
@@ -0,0 +1,280 @@
1
+ export interface QuickbooksRef {
2
+ value: string;
3
+ name?: string;
4
+ }
5
+ export interface QuickbooksAddress {
6
+ Id?: string;
7
+ Line1?: string;
8
+ City?: string;
9
+ CountrySubDivisionCode?: string;
10
+ PostalCode?: string;
11
+ Lat?: string;
12
+ Long?: string;
13
+ }
14
+ export interface QuickbooksEmail {
15
+ Address?: string;
16
+ }
17
+ export interface QuickbooksWebsite {
18
+ URI?: string;
19
+ }
20
+ export interface QuickbooksPhoneNumber {
21
+ FreeFormNumber?: string;
22
+ }
23
+ export interface QuickbooksCurrencyRef {
24
+ value: string;
25
+ name?: string;
26
+ }
27
+ export interface QuickbooksMetaData {
28
+ CreateTime?: string;
29
+ LastUpdatedTime?: string;
30
+ }
31
+ export interface QuickbooksCustomField {
32
+ DefinitionId: string;
33
+ Name?: string;
34
+ Type: 'BooleanType' | 'DateType' | 'NumberType' | 'StringType';
35
+ StringValue?: string;
36
+ BooleanValue?: boolean;
37
+ DateValue?: string;
38
+ NumberValue?: number;
39
+ }
40
+ export interface QuickbooksCustomer {
41
+ Id: string;
42
+ SyncToken?: string;
43
+ MetaData?: QuickbooksMetaData;
44
+ GivenName?: string;
45
+ FamilyName?: string;
46
+ FullyQualifiedName?: string;
47
+ CompanyName?: string;
48
+ DisplayName: string;
49
+ PrintOnCheckName?: string;
50
+ Active?: boolean;
51
+ PrimaryPhone?: QuickbooksPhoneNumber;
52
+ PrimaryEmailAddr?: QuickbooksEmail;
53
+ WebAddr?: QuickbooksWebsite;
54
+ BillAddr?: QuickbooksAddress;
55
+ ShipAddr?: QuickbooksAddress;
56
+ Job?: boolean;
57
+ BillWithParent?: boolean;
58
+ ParentRef?: QuickbooksRef;
59
+ Level?: number;
60
+ SalesTermRef?: QuickbooksRef;
61
+ PaymentMethodRef?: QuickbooksRef;
62
+ Balance?: number;
63
+ OpenBalanceDate?: string;
64
+ BalanceWithJobs?: number;
65
+ CurrencyRef?: QuickbooksCurrencyRef;
66
+ PreferredDeliveryMethod?: string;
67
+ Taxable?: boolean;
68
+ TaxExemptionReasonId?: QuickbooksRef;
69
+ DefaultTaxCodeRef?: QuickbooksRef;
70
+ Notes?: string;
71
+ domain?: string;
72
+ sparse?: boolean;
73
+ }
74
+ export interface QuickbooksInvoice {
75
+ Id: string;
76
+ SyncToken?: string;
77
+ MetaData?: QuickbooksMetaData;
78
+ CustomField?: QuickbooksCustomField[];
79
+ DocNumber?: string;
80
+ TxnDate?: string;
81
+ CurrencyRef?: QuickbooksCurrencyRef;
82
+ LinkedTxn?: any[];
83
+ Line: QuickbooksInvoiceLine[];
84
+ TxnTaxDetail?: {
85
+ TotalTax?: number;
86
+ TaxLine?: any[];
87
+ };
88
+ CustomerRef: QuickbooksRef;
89
+ CustomerMemo?: {
90
+ value: string;
91
+ };
92
+ BillAddr?: QuickbooksAddress;
93
+ ShipAddr?: QuickbooksAddress;
94
+ SalesTermRef?: QuickbooksRef;
95
+ DueDate?: string;
96
+ TotalAmt: number;
97
+ ApplyTaxAfterDiscount?: boolean;
98
+ PrintStatus?: string;
99
+ EmailStatus?: string;
100
+ BillEmail?: QuickbooksEmail;
101
+ Balance: number;
102
+ Deposit?: number;
103
+ AllowIPNPayment?: boolean;
104
+ AllowOnlinePayment?: boolean;
105
+ AllowOnlineCreditCardPayment?: boolean;
106
+ AllowOnlineACHPayment?: boolean;
107
+ domain?: string;
108
+ sparse?: boolean;
109
+ PrivateNote?: string;
110
+ ProjectRef?: QuickbooksRef;
111
+ }
112
+ export interface QuickbooksInvoiceLine {
113
+ Id?: string;
114
+ LineNum?: number;
115
+ Description?: string;
116
+ Amount: number;
117
+ LinkedTxn?: any[];
118
+ DetailType: 'SalesItemLineDetail' | 'GroupLineDetail' | 'DescriptionOnly' | 'DiscountLineDetail' | 'SubTotalLineDetail';
119
+ SalesItemLineDetail?: {
120
+ ItemRef: QuickbooksRef;
121
+ UnitPrice?: number;
122
+ Qty?: number;
123
+ TaxCodeRef?: QuickbooksRef;
124
+ };
125
+ DiscountLineDetail?: {
126
+ PercentBased?: boolean;
127
+ DiscountPercent?: number;
128
+ DiscountAccountRef?: QuickbooksRef;
129
+ };
130
+ SubTotalLineDetail?: Record<string, never>;
131
+ DescriptionOnly?: Record<string, never>;
132
+ }
133
+ export interface QuickbooksItem {
134
+ Id: string;
135
+ Name: string;
136
+ Description?: string;
137
+ Active?: boolean;
138
+ FullyQualifiedName?: string;
139
+ Taxable?: boolean;
140
+ UnitPrice?: number;
141
+ Type: 'Inventory' | 'NonInventory' | 'Service' | 'Category' | 'Bundle';
142
+ IncomeAccountRef?: QuickbooksRef;
143
+ PurchaseDesc?: string;
144
+ PurchaseCost?: number;
145
+ ExpenseAccountRef?: QuickbooksRef;
146
+ AssetAccountRef?: QuickbooksRef;
147
+ TrackQtyOnHand?: boolean;
148
+ QtyOnHand?: number;
149
+ InvStartDate?: string;
150
+ SubItem?: boolean;
151
+ ParentRef?: QuickbooksRef;
152
+ Level?: number;
153
+ TaxClassificationRef?: QuickbooksRef;
154
+ domain?: string;
155
+ sparse?: boolean;
156
+ MetaData?: QuickbooksMetaData;
157
+ }
158
+ export interface QuickbooksAccount {
159
+ Id: string;
160
+ Name: string;
161
+ AccountType: string;
162
+ AccountSubType?: string;
163
+ Classification?: string;
164
+ Active?: boolean;
165
+ CurrencyRef?: QuickbooksCurrencyRef;
166
+ CurrentBalance?: number;
167
+ domain?: string;
168
+ sparse?: boolean;
169
+ MetaData?: QuickbooksMetaData;
170
+ }
171
+ export interface QuickbooksVendor {
172
+ Id: string;
173
+ SyncToken?: string;
174
+ DisplayName: string;
175
+ CompanyName?: string;
176
+ PrintOnCheckName?: string;
177
+ Active?: boolean;
178
+ PrimaryPhone?: QuickbooksPhoneNumber;
179
+ PrimaryEmailAddr?: QuickbooksEmail;
180
+ WebAddr?: QuickbooksWebsite;
181
+ BillAddr?: QuickbooksAddress;
182
+ Balance?: number;
183
+ CurrencyRef?: QuickbooksCurrencyRef;
184
+ Vendor1099?: boolean;
185
+ TaxIdentifier?: string;
186
+ TermRef?: QuickbooksRef;
187
+ domain?: string;
188
+ sparse?: boolean;
189
+ MetaData?: QuickbooksMetaData;
190
+ }
191
+ export interface QuickbooksPurchase {
192
+ Id?: string;
193
+ SyncToken?: string;
194
+ MetaData?: QuickbooksMetaData;
195
+ DocNumber?: string;
196
+ TxnDate?: string;
197
+ CurrencyRef?: QuickbooksCurrencyRef;
198
+ PrivateNote?: string;
199
+ Line: QuickbooksPurchaseLine[];
200
+ AccountRef: QuickbooksRef;
201
+ EntityRef?: QuickbooksRef;
202
+ PaymentType: 'Cash' | 'Check' | 'CreditCard';
203
+ TotalAmt: number;
204
+ PrintStatus?: string;
205
+ ExchangeRate?: number;
206
+ GlobalTaxCalculation?: string;
207
+ TransactionLocationType?: string;
208
+ Credit?: boolean;
209
+ domain?: string;
210
+ sparse?: boolean;
211
+ }
212
+ export interface QuickbooksPurchaseLine {
213
+ Id?: string;
214
+ LineNum?: number;
215
+ Description?: string;
216
+ Amount: number;
217
+ LinkedTxn?: any[];
218
+ DetailType: 'AccountBasedExpenseLineDetail' | 'ItemBasedExpenseLineDetail';
219
+ AccountBasedExpenseLineDetail?: {
220
+ AccountRef: QuickbooksRef;
221
+ BillableStatus?: string;
222
+ CustomerRef?: QuickbooksRef;
223
+ TaxCodeRef?: QuickbooksRef;
224
+ };
225
+ ItemBasedExpenseLineDetail?: {
226
+ ItemRef: QuickbooksRef;
227
+ Qty?: number;
228
+ UnitPrice?: number;
229
+ BillableStatus?: string;
230
+ CustomerRef?: QuickbooksRef;
231
+ TaxCodeRef?: QuickbooksRef;
232
+ };
233
+ }
234
+ export interface QuickbooksEstimate {
235
+ Id: string;
236
+ SyncToken?: string;
237
+ MetaData?: QuickbooksMetaData;
238
+ CustomField?: QuickbooksCustomField[];
239
+ DocNumber?: string;
240
+ TxnDate?: string;
241
+ CurrencyRef?: QuickbooksCurrencyRef;
242
+ LinkedTxn?: any[];
243
+ Line: QuickbooksInvoiceLine[];
244
+ TxnTaxDetail?: {
245
+ TxnTaxCodeRef?: QuickbooksRef;
246
+ TotalTax?: number;
247
+ TaxLine?: {
248
+ DetailType: 'TaxLineDetail';
249
+ Amount?: number;
250
+ TaxLineDetail?: {
251
+ TaxRateRef?: QuickbooksRef;
252
+ PercentBased?: boolean;
253
+ TaxPercent?: number;
254
+ NetAmountTaxable?: number;
255
+ };
256
+ }[];
257
+ };
258
+ CustomerRef: QuickbooksRef;
259
+ CustomerMemo?: {
260
+ value: string;
261
+ };
262
+ BillAddr?: QuickbooksAddress;
263
+ ShipAddr?: QuickbooksAddress;
264
+ SalesTermRef?: QuickbooksRef;
265
+ DueDate?: string;
266
+ TotalAmt?: number;
267
+ ApplyTaxAfterDiscount?: boolean;
268
+ PrintStatus?: string;
269
+ EmailStatus?: string;
270
+ BillEmail?: QuickbooksEmail;
271
+ AcceptedBy?: string;
272
+ AcceptedDate?: string;
273
+ ExpirationDate?: string;
274
+ TxnStatus?: string;
275
+ domain?: string;
276
+ sparse?: boolean;
277
+ PrivateNote?: string;
278
+ GlobalTaxCalculation?: string;
279
+ ProjectRef?: QuickbooksRef;
280
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/community/quickbooks/src/lib/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import { TriggerStrategy } from '@scopieflows/pieces-framework';
2
+ export declare const newCustomer: import("@scopieflows/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>, {}> | import("@scopieflows/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>, {}> | import("@scopieflows/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>, {}> | import("@scopieflows/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>, {}>;
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.newCustomer = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
6
+ const index_1 = require("../index");
7
+ const pieces_common_1 = require("@scopieflows/pieces-common");
8
+ const common_1 = require("../lib/common");
9
+ const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
10
+ const polling = {
11
+ strategy: pieces_common_1.DedupeStrategy.TIMEBASED,
12
+ items(_a) {
13
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, lastFetchEpochMS }) {
14
+ var _b, _c, _d;
15
+ const { access_token } = auth;
16
+ const companyId = (_b = auth.props) === null || _b === void 0 ? void 0 : _b['companyId'];
17
+ const apiUrl = common_1.quickbooksCommon.getApiUrl(companyId);
18
+ const query = lastFetchEpochMS === 0
19
+ ? `SELECT * FROM Customer ORDERBY Metadata.CreateTime DESC MAXRESULTS 10`
20
+ : `SELECT * FROM Customer WHERE Metadata.CreateTime >= '${(0, dayjs_1.default)(lastFetchEpochMS).toISOString()}' ORDERBY Metadata.CreateTime DESC`;
21
+ const response = yield pieces_common_1.httpClient.sendRequest({
22
+ method: pieces_common_1.HttpMethod.GET,
23
+ url: `${apiUrl}/query`,
24
+ queryParams: { query: query, minorversion: '70' },
25
+ headers: {
26
+ Authorization: `Bearer ${access_token}`,
27
+ Accept: 'application/json',
28
+ },
29
+ });
30
+ const customers = (_d = (_c = response.body.QueryResponse) === null || _c === void 0 ? void 0 : _c['Customer']) !== null && _d !== void 0 ? _d : [];
31
+ return customers.map((customer) => {
32
+ var _a;
33
+ return ({
34
+ epochMilliSeconds: (0, dayjs_1.default)((_a = customer.MetaData) === null || _a === void 0 ? void 0 : _a.CreateTime).valueOf(),
35
+ data: customer,
36
+ });
37
+ });
38
+ });
39
+ },
40
+ };
41
+ exports.newCustomer = (0, pieces_framework_1.createTrigger)({
42
+ auth: index_1.quickbooksAuth,
43
+ name: 'new_customer',
44
+ displayName: 'New Customer',
45
+ description: 'Triggers when a new customer is created.',
46
+ props: {},
47
+ type: pieces_framework_1.TriggerStrategy.POLLING,
48
+ onEnable(context) {
49
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
50
+ yield pieces_common_1.pollingHelper.onEnable(polling, {
51
+ auth: context.auth,
52
+ store: context.store,
53
+ propsValue: context.propsValue,
54
+ });
55
+ });
56
+ },
57
+ onDisable(context) {
58
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
59
+ yield pieces_common_1.pollingHelper.onDisable(polling, {
60
+ auth: context.auth,
61
+ store: context.store,
62
+ propsValue: context.propsValue,
63
+ });
64
+ });
65
+ },
66
+ test(context) {
67
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
68
+ return yield pieces_common_1.pollingHelper.test(polling, context);
69
+ });
70
+ },
71
+ run(context) {
72
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
73
+ return yield pieces_common_1.pollingHelper.poll(polling, context);
74
+ });
75
+ },
76
+ sampleData: undefined,
77
+ });
78
+ //# sourceMappingURL=new-customer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"new-customer.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/community/quickbooks/src/triggers/new-customer.ts"],"names":[],"mappings":";;;;AAAA,oEAKuC;AACvC,oCAA0C;AAC1C,8DAMoC;AACpC,0CAA2E;AAC3E,0DAA0B;AAG1B,MAAM,OAAO,GAGT;IACF,QAAQ,EAAE,8BAAc,CAAC,SAAS;IAC5B,KAAK;qEAAC,EAAE,IAAI,EAAE,gBAAgB,EAAE;;YACpC,MAAM,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC;YAC9B,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YACpB,MAAM,6BAAa,CAAC,QAAQ,CAAC,OAAO,EAAE;gBACpC,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,UAAU,EAAE,OAAO,CAAC,UAAU;aAC/B,CAAC,CAAC;QACL,CAAC;KAAA;IACK,SAAS,CAAC,OAAO;;YACrB,MAAM,6BAAa,CAAC,SAAS,CAAC,OAAO,EAAE;gBACrC,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,UAAU,EAAE,OAAO,CAAC,UAAU;aAC/B,CAAC,CAAC;QACL,CAAC;KAAA;IACK,IAAI,CAAC,OAAO;;YAChB,OAAO,MAAM,6BAAa,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACpD,CAAC;KAAA;IACK,GAAG,CAAC,OAAO;;YACf,OAAO,MAAM,6BAAa,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACpD,CAAC;KAAA;IACD,UAAU,EAAE,SAAS;CACtB,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { TriggerStrategy } from "@scopieflows/pieces-framework";
2
+ export declare const newDeposit: import("@scopieflows/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>, {}> | import("@scopieflows/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>, {}> | import("@scopieflows/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>, {}> | import("@scopieflows/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>, {}>;
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.newDeposit = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@scopieflows/pieces-framework");
6
+ const index_1 = require("../index");
7
+ const pieces_common_1 = require("@scopieflows/pieces-common");
8
+ const common_1 = require("../lib/common");
9
+ const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
10
+ const polling = {
11
+ strategy: pieces_common_1.DedupeStrategy.TIMEBASED,
12
+ items(_a) {
13
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, lastFetchEpochMS }) {
14
+ var _b, _c, _d;
15
+ const { access_token } = auth;
16
+ const companyId = (_b = auth.props) === null || _b === void 0 ? void 0 : _b['companyId'];
17
+ const apiUrl = common_1.quickbooksCommon.getApiUrl(companyId);
18
+ const query = lastFetchEpochMS === 0
19
+ ? `SELECT * FROM Deposit ORDERBY Metadata.CreateTime DESC MAXRESULTS 10`
20
+ : `SELECT * FROM Deposit WHERE Metadata.CreateTime >= '${(0, dayjs_1.default)(lastFetchEpochMS).toISOString()}' ORDERBY Metadata.CreateTime DESC`;
21
+ const response = yield pieces_common_1.httpClient.sendRequest({
22
+ method: pieces_common_1.HttpMethod.GET,
23
+ url: `${apiUrl}/query`,
24
+ queryParams: { query: query, minorversion: '70' },
25
+ headers: {
26
+ Authorization: `Bearer ${access_token}`,
27
+ Accept: 'application/json',
28
+ },
29
+ });
30
+ const deposits = (_d = (_c = response.body.QueryResponse) === null || _c === void 0 ? void 0 : _c['Deposit']) !== null && _d !== void 0 ? _d : [];
31
+ return deposits.map((deposit) => {
32
+ var _a;
33
+ return ({
34
+ epochMilliSeconds: (0, dayjs_1.default)((_a = deposit.MetaData) === null || _a === void 0 ? void 0 : _a.CreateTime).valueOf(),
35
+ data: deposit,
36
+ });
37
+ });
38
+ });
39
+ },
40
+ };
41
+ exports.newDeposit = (0, pieces_framework_1.createTrigger)({
42
+ auth: index_1.quickbooksAuth,
43
+ name: 'new_deposit',
44
+ displayName: 'New Deposit',
45
+ description: 'Triggers when a Deposit is created.',
46
+ props: {},
47
+ type: pieces_framework_1.TriggerStrategy.POLLING,
48
+ onEnable(context) {
49
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
50
+ yield pieces_common_1.pollingHelper.onEnable(polling, {
51
+ auth: context.auth,
52
+ store: context.store,
53
+ propsValue: context.propsValue,
54
+ });
55
+ });
56
+ },
57
+ onDisable(context) {
58
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
59
+ yield pieces_common_1.pollingHelper.onDisable(polling, {
60
+ auth: context.auth,
61
+ store: context.store,
62
+ propsValue: context.propsValue,
63
+ });
64
+ });
65
+ },
66
+ test(context) {
67
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
68
+ return yield pieces_common_1.pollingHelper.test(polling, context);
69
+ });
70
+ },
71
+ run(context) {
72
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
73
+ return yield pieces_common_1.pollingHelper.poll(polling, context);
74
+ });
75
+ },
76
+ sampleData: undefined,
77
+ });
78
+ //# sourceMappingURL=new-deposit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"new-deposit.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/community/quickbooks/src/triggers/new-deposit.ts"],"names":[],"mappings":";;;;AAAA,oEAKuC;AACvC,oCAA0C;AAC1C,8DAA4G;AAC5G,0CAA2E;AAE3E,0DAA0B;AAE1B,MAAM,OAAO,GAGT;IACF,QAAQ,EAAE,8BAAc,CAAC,SAAS;IAC5B,KAAK;qEAAC,EAAE,IAAI,EAAE,gBAAgB,EAAE;;YACpC,MAAM,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC;YAC9B,MAAM,SAAS,GAAG,MAAA,IAAI,CAAC,KAAK,0CAAG,WAAW,CAAW,CAAC;YAEtD,MAAM,MAAM,GAAG,yBAAgB,CAAC,SAAS,CAAC,SAAU,CAAC,CAAC;YAEtD,MAAM,KAAK,GACT,gBAAgB,KAAK,CAAC;gBAC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,CAAC;KAAA;IACK,SAAS,CAAC,OAAO;;YACrB,MAAM,6BAAa,CAAC,SAAS,CAAC,OAAO,EAAE;gBACrC,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,UAAU,EAAE,OAAO,CAAC,UAAU;aAC/B,CAAC,CAAC;QACL,CAAC;KAAA;IACK,IAAI,CAAC,OAAO;;YAChB,OAAO,MAAM,6BAAa,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACpD,CAAC;KAAA;IACK,GAAG,CAAC,OAAO;;YACf,OAAO,MAAM,6BAAa,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACpD,CAAC;KAAA;IACD,UAAU,EAAE,SAAS;CACtB,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { TriggerStrategy } from '@scopieflows/pieces-framework';
2
+ export declare const newExpense: import("@scopieflows/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>, {}> | import("@scopieflows/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>, {}> | import("@scopieflows/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>, {}> | import("@scopieflows/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@scopieflows/pieces-framework").OAuth2Property<import("@scopieflows/pieces-framework").OAuth2Props>, {}>;