@activepieces/piece-quickbooks 0.1.5 → 0.1.7

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 (57) hide show
  1. package/package.json +7 -13
  2. package/src/index.js +13 -57
  3. package/src/actions/create-expense.d.ts +0 -9
  4. package/src/actions/create-expense.d.ts.map +0 -1
  5. package/src/actions/create-expense.js +0 -197
  6. package/src/actions/create-expense.js.map +0 -1
  7. package/src/actions/create-invoice.d.ts +0 -12
  8. package/src/actions/create-invoice.d.ts.map +0 -1
  9. package/src/actions/create-invoice.js +0 -193
  10. package/src/actions/create-invoice.js.map +0 -1
  11. package/src/actions/find-customer.d.ts +0 -4
  12. package/src/actions/find-customer.d.ts.map +0 -1
  13. package/src/actions/find-customer.js +0 -65
  14. package/src/actions/find-customer.js.map +0 -1
  15. package/src/actions/find-invoice.d.ts +0 -4
  16. package/src/actions/find-invoice.d.ts.map +0 -1
  17. package/src/actions/find-invoice.js +0 -65
  18. package/src/actions/find-invoice.js.map +0 -1
  19. package/src/actions/find-payment.d.ts +0 -4
  20. package/src/actions/find-payment.d.ts.map +0 -1
  21. package/src/actions/find-payment.js +0 -58
  22. package/src/actions/find-payment.js.map +0 -1
  23. package/src/index.d.ts +0 -2
  24. package/src/index.d.ts.map +0 -1
  25. package/src/index.js.map +0 -1
  26. package/src/lib/auth.d.ts +0 -2
  27. package/src/lib/auth.d.ts.map +0 -1
  28. package/src/lib/auth.js +0 -18
  29. package/src/lib/auth.js.map +0 -1
  30. package/src/lib/common.d.ts +0 -22
  31. package/src/lib/common.d.ts.map +0 -1
  32. package/src/lib/common.js +0 -12
  33. package/src/lib/common.js.map +0 -1
  34. package/src/lib/types.d.ts +0 -281
  35. package/src/lib/types.d.ts.map +0 -1
  36. package/src/lib/types.js +0 -3
  37. package/src/lib/types.js.map +0 -1
  38. package/src/triggers/new-customer.d.ts +0 -3
  39. package/src/triggers/new-customer.d.ts.map +0 -1
  40. package/src/triggers/new-customer.js +0 -81
  41. package/src/triggers/new-customer.js.map +0 -1
  42. package/src/triggers/new-deposit.d.ts +0 -3
  43. package/src/triggers/new-deposit.d.ts.map +0 -1
  44. package/src/triggers/new-deposit.js +0 -81
  45. package/src/triggers/new-deposit.js.map +0 -1
  46. package/src/triggers/new-expense.d.ts +0 -3
  47. package/src/triggers/new-expense.d.ts.map +0 -1
  48. package/src/triggers/new-expense.js +0 -81
  49. package/src/triggers/new-expense.js.map +0 -1
  50. package/src/triggers/new-invoice.d.ts +0 -3
  51. package/src/triggers/new-invoice.d.ts.map +0 -1
  52. package/src/triggers/new-invoice.js +0 -81
  53. package/src/triggers/new-invoice.js.map +0 -1
  54. package/src/triggers/new-transfer.d.ts +0 -3
  55. package/src/triggers/new-transfer.d.ts.map +0 -1
  56. package/src/triggers/new-transfer.js +0 -81
  57. package/src/triggers/new-transfer.js.map +0 -1
@@ -1,3 +0,0 @@
1
- import { TriggerStrategy } from '@activepieces/pieces-framework';
2
- export declare const newExpense: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {}>;
3
- //# sourceMappingURL=new-expense.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"new-expense.d.ts","sourceRoot":"","sources":["../../../src/triggers/new-expense.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAIhB,MAAM,gCAAgC,CAAC;AAoDxC,eAAO,MAAM,UAAU,kwBA+BrB,CAAC"}
@@ -1,81 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.newExpense = void 0;
4
- const tslib_1 = require("tslib");
5
- const pieces_framework_1 = require("@activepieces/pieces-framework");
6
- const auth_1 = require("../lib/auth");
7
- const pieces_common_1 = require("@activepieces/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 Purchase ORDERBY Metadata.CreateTime DESC MAXRESULTS 10`
20
- : `SELECT * FROM Purchase 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 purchases = (_d = (_c = response.body.QueryResponse) === null || _c === void 0 ? void 0 : _c['Purchase']) !== null && _d !== void 0 ? _d : [];
31
- return purchases.map((purchase) => {
32
- var _a;
33
- return ({
34
- epochMilliSeconds: (0, dayjs_1.default)((_a = purchase.MetaData) === null || _a === void 0 ? void 0 : _a.CreateTime).valueOf(),
35
- data: purchase,
36
- });
37
- });
38
- });
39
- },
40
- };
41
- exports.newExpense = (0, pieces_framework_1.createTrigger)({
42
- auth: auth_1.quickbooksAuth,
43
- name: 'new_expense',
44
- displayName: 'New Expense (Purchase)',
45
- description: 'Triggers when an Expense (Purchase) is created.',
46
- aiMetadata: {
47
- description: 'Fires when a new expense (purchase transaction) is created in the connected QuickBooks company, emitting the newly created purchase record. Use to react to money being spent or a bill being recorded.',
48
- },
49
- props: {},
50
- type: pieces_framework_1.TriggerStrategy.POLLING,
51
- onEnable(context) {
52
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
53
- yield pieces_common_1.pollingHelper.onEnable(polling, {
54
- auth: context.auth,
55
- store: context.store,
56
- propsValue: context.propsValue,
57
- });
58
- });
59
- },
60
- onDisable(context) {
61
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
62
- yield pieces_common_1.pollingHelper.onDisable(polling, {
63
- auth: context.auth,
64
- store: context.store,
65
- propsValue: context.propsValue,
66
- });
67
- });
68
- },
69
- test(context) {
70
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
71
- return yield pieces_common_1.pollingHelper.test(polling, context);
72
- });
73
- },
74
- run(context) {
75
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
76
- return yield pieces_common_1.pollingHelper.poll(polling, context);
77
- });
78
- },
79
- sampleData: undefined,
80
- });
81
- //# sourceMappingURL=new-expense.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"new-expense.js","sourceRoot":"","sources":["../../../src/triggers/new-expense.ts"],"names":[],"mappings":";;;;AAAA,qEAKwC;AACxC,sCAA6C;AAC7C,+DAMqC;AACrC,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,CA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AAI;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"}
@@ -1,3 +0,0 @@
1
- import { TriggerStrategy } from '@activepieces/pieces-framework';
2
- export declare const newInvoice: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {}>;
3
- //# sourceMappingURL=new-invoice.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"new-invoice.d.ts","sourceRoot":"","sources":["../../../src/triggers/new-invoice.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAIhB,MAAM,gCAAgC,CAAC;AAoDxC,eAAO,MAAM,UAAU,kwBA+BrB,CAAC"}
@@ -1,81 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.newInvoice = void 0;
4
- const tslib_1 = require("tslib");
5
- const pieces_framework_1 = require("@activepieces/pieces-framework");
6
- const auth_1 = require("../lib/auth");
7
- const pieces_common_1 = require("@activepieces/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 Invoice ORDERBY Metadata.CreateTime DESC MAXRESULTS 10`
20
- : `SELECT * FROM Invoice 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 invoices = (_d = (_c = response.body.QueryResponse) === null || _c === void 0 ? void 0 : _c['Invoice']) !== null && _d !== void 0 ? _d : [];
31
- return invoices.map((invoice) => {
32
- var _a;
33
- return ({
34
- epochMilliSeconds: (0, dayjs_1.default)((_a = invoice.MetaData) === null || _a === void 0 ? void 0 : _a.CreateTime).valueOf(),
35
- data: invoice,
36
- });
37
- });
38
- });
39
- },
40
- };
41
- exports.newInvoice = (0, pieces_framework_1.createTrigger)({
42
- auth: auth_1.quickbooksAuth,
43
- name: 'new_invoice',
44
- displayName: 'New Invoice',
45
- description: 'Triggers when an invoice is created .',
46
- aiMetadata: {
47
- description: 'Fires when a new invoice is created in the connected QuickBooks company, emitting the newly created invoice record. Use to react to billing being issued to a customer.',
48
- },
49
- props: {},
50
- type: pieces_framework_1.TriggerStrategy.POLLING,
51
- onEnable(context) {
52
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
53
- yield pieces_common_1.pollingHelper.onEnable(polling, {
54
- auth: context.auth,
55
- store: context.store,
56
- propsValue: context.propsValue,
57
- });
58
- });
59
- },
60
- onDisable(context) {
61
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
62
- yield pieces_common_1.pollingHelper.onDisable(polling, {
63
- auth: context.auth,
64
- store: context.store,
65
- propsValue: context.propsValue,
66
- });
67
- });
68
- },
69
- test(context) {
70
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
71
- return yield pieces_common_1.pollingHelper.test(polling, context);
72
- });
73
- },
74
- run(context) {
75
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
76
- return yield pieces_common_1.pollingHelper.poll(polling, context);
77
- });
78
- },
79
- sampleData: undefined,
80
- });
81
- //# sourceMappingURL=new-invoice.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"new-invoice.js","sourceRoot":"","sources":["../../../src/triggers/new-invoice.ts"],"names":[],"mappings":";;;;AAAA,qEAKwC;AACxC,sCAA6C;AAC7C,+DAMqC;AACrC,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,MAAM,SAAS,GAAG,MAAA,IAAI,CAAC,KAAK,0CAAG,WAAW,CAAW,CAAC;YAEtD,MAAM,MAA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C,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"}
@@ -1,3 +0,0 @@
1
- import { TriggerStrategy } from '@activepieces/pieces-framework';
2
- export declare const newTransfer: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {}>;
3
- //# sourceMappingURL=new-transfer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"new-transfer.d.ts","sourceRoot":"","sources":["../../../src/triggers/new-transfer.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAIhB,MAAM,gCAAgC,CAAC;AAoDxC,eAAO,MAAM,WAAW,kwBAgCtB,CAAC"}
@@ -1,81 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.newTransfer = void 0;
4
- const tslib_1 = require("tslib");
5
- const pieces_framework_1 = require("@activepieces/pieces-framework");
6
- const auth_1 = require("../lib/auth");
7
- const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
8
- const pieces_common_1 = require("@activepieces/pieces-common");
9
- const common_1 = require("../lib/common");
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 Transfer ORDERBY Metadata.CreateTime DESC MAXRESULTS 10`
20
- : `SELECT * FROM Transfer 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 transers = (_d = (_c = response.body.QueryResponse) === null || _c === void 0 ? void 0 : _c['Transfer']) !== null && _d !== void 0 ? _d : [];
31
- return transers.map((transfer) => {
32
- var _a;
33
- return ({
34
- epochMilliSeconds: (0, dayjs_1.default)((_a = transfer.MetaData) === null || _a === void 0 ? void 0 : _a.CreateTime).valueOf(),
35
- data: transfer,
36
- });
37
- });
38
- });
39
- },
40
- };
41
- exports.newTransfer = (0, pieces_framework_1.createTrigger)({
42
- auth: auth_1.quickbooksAuth,
43
- name: 'new_transfer',
44
- displayName: 'New Transfer',
45
- description: 'Triggers when a Transfer is created.',
46
- aiMetadata: {
47
- description: 'Fires when a new transfer is created in the connected QuickBooks company, emitting the newly created transfer record. Use to react to funds being moved between two accounts.',
48
- },
49
- props: {},
50
- type: pieces_framework_1.TriggerStrategy.POLLING,
51
- onEnable(context) {
52
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
53
- yield pieces_common_1.pollingHelper.onEnable(polling, {
54
- auth: context.auth,
55
- store: context.store,
56
- propsValue: context.propsValue,
57
- });
58
- });
59
- },
60
- onDisable(context) {
61
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
62
- yield pieces_common_1.pollingHelper.onDisable(polling, {
63
- auth: context.auth,
64
- store: context.store,
65
- propsValue: context.propsValue,
66
- });
67
- });
68
- },
69
- test(context) {
70
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
71
- return yield pieces_common_1.pollingHelper.test(polling, context);
72
- });
73
- },
74
- run(context) {
75
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
76
- return yield pieces_common_1.pollingHelper.poll(polling, context);
77
- });
78
- },
79
- sampleData: undefined,
80
- });
81
- //# sourceMappingURL=new-transfer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"new-transfer.js","sourceRoot":"","sources":["../../../src/triggers/new-transfer.ts"],"names":[],"mappings":";;;;AAAA,qEAKwC;AACxC,sCAA6C;AAC7C,0DAA0B;AAC1B,+DAMqC;AACrC,0CAA2E;AAG3E,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,K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