@activepieces/piece-coupa 0.0.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.
- package/package.json +23 -0
- package/src/index.d.ts +7 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.js +74 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/add-file-attachment.d.ts +23 -0
- package/src/lib/actions/add-file-attachment.d.ts.map +1 -0
- package/src/lib/actions/add-file-attachment.js +122 -0
- package/src/lib/actions/add-file-attachment.js.map +1 -0
- package/src/lib/actions/cancel-purchase-order.d.ts +14 -0
- package/src/lib/actions/cancel-purchase-order.d.ts.map +1 -0
- package/src/lib/actions/cancel-purchase-order.js +30 -0
- package/src/lib/actions/cancel-purchase-order.js.map +1 -0
- package/src/lib/actions/close-purchase-order.d.ts +14 -0
- package/src/lib/actions/close-purchase-order.d.ts.map +1 -0
- package/src/lib/actions/close-purchase-order.js +30 -0
- package/src/lib/actions/close-purchase-order.js.map +1 -0
- package/src/lib/actions/create-object.d.ts +12 -0
- package/src/lib/actions/create-object.d.ts.map +1 -0
- package/src/lib/actions/create-object.js +39 -0
- package/src/lib/actions/create-object.js.map +1 -0
- package/src/lib/actions/get-object-by-id.d.ts +17 -0
- package/src/lib/actions/get-object-by-id.d.ts.map +1 -0
- package/src/lib/actions/get-object-by-id.js +39 -0
- package/src/lib/actions/get-object-by-id.js.map +1 -0
- package/src/lib/actions/get-remit-to-addresses.d.ts +15 -0
- package/src/lib/actions/get-remit-to-addresses.d.ts.map +1 -0
- package/src/lib/actions/get-remit-to-addresses.js +75 -0
- package/src/lib/actions/get-remit-to-addresses.js.map +1 -0
- package/src/lib/actions/get-supplier-sites.d.ts +14 -0
- package/src/lib/actions/get-supplier-sites.d.ts.map +1 -0
- package/src/lib/actions/get-supplier-sites.js +35 -0
- package/src/lib/actions/get-supplier-sites.js.map +1 -0
- package/src/lib/actions/grant-approval.d.ts +14 -0
- package/src/lib/actions/grant-approval.d.ts.map +1 -0
- package/src/lib/actions/grant-approval.js +30 -0
- package/src/lib/actions/grant-approval.js.map +1 -0
- package/src/lib/actions/reject-approval.d.ts +15 -0
- package/src/lib/actions/reject-approval.d.ts.map +1 -0
- package/src/lib/actions/reject-approval.js +43 -0
- package/src/lib/actions/reject-approval.js.map +1 -0
- package/src/lib/actions/search-objects.d.ts +11 -0
- package/src/lib/actions/search-objects.d.ts.map +1 -0
- package/src/lib/actions/search-objects.js +41 -0
- package/src/lib/actions/search-objects.js.map +1 -0
- package/src/lib/actions/set-integration-run-status.d.ts +10 -0
- package/src/lib/actions/set-integration-run-status.d.ts.map +1 -0
- package/src/lib/actions/set-integration-run-status.js +44 -0
- package/src/lib/actions/set-integration-run-status.js.map +1 -0
- package/src/lib/actions/update-object.d.ts +18 -0
- package/src/lib/actions/update-object.d.ts.map +1 -0
- package/src/lib/actions/update-object.js +41 -0
- package/src/lib/actions/update-object.js.map +1 -0
- package/src/lib/auth.d.ts +7 -0
- package/src/lib/auth.d.ts.map +1 -0
- package/src/lib/auth.js +50 -0
- package/src/lib/auth.js.map +1 -0
- package/src/lib/common/client.d.ts +34 -0
- package/src/lib/common/client.d.ts.map +1 -0
- package/src/lib/common/client.js +146 -0
- package/src/lib/common/client.js.map +1 -0
- package/src/lib/common/props.d.ts +47 -0
- package/src/lib/common/props.d.ts.map +1 -0
- package/src/lib/common/props.js +366 -0
- package/src/lib/common/props.js.map +1 -0
- package/src/lib/common/utils.d.ts +22 -0
- package/src/lib/common/utils.d.ts.map +1 -0
- package/src/lib/common/utils.js +182 -0
- package/src/lib/common/utils.js.map +1 -0
- package/src/lib/triggers/new-or-updated-object.d.ts +39 -0
- package/src/lib/triggers/new-or-updated-object.d.ts.map +1 -0
- package/src/lib/triggers/new-or-updated-object.js +98 -0
- package/src/lib/triggers/new-or-updated-object.js.map +1 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const getSupplierSites: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
clientId: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
+
clientSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
5
|
+
scope: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
6
|
+
}>, {
|
|
7
|
+
supplierId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
8
|
+
instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
9
|
+
clientId: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
10
|
+
clientSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
11
|
+
scope: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
12
|
+
}>>;
|
|
13
|
+
}>;
|
|
14
|
+
//# sourceMappingURL=get-supplier-sites.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-supplier-sites.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/get-supplier-sites.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;EAsB3B,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSupplierSites = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
7
|
+
const auth_1 = require("../auth");
|
|
8
|
+
const client_1 = require("../common/client");
|
|
9
|
+
const props_1 = require("../common/props");
|
|
10
|
+
const utils_1 = require("../common/utils");
|
|
11
|
+
exports.getSupplierSites = (0, pieces_framework_1.createAction)({
|
|
12
|
+
auth: auth_1.coupaAuth,
|
|
13
|
+
name: 'get_supplier_sites_by_supplier',
|
|
14
|
+
displayName: 'Get Supplier Sites by Supplier',
|
|
15
|
+
description: 'Lists supplier sites for a supplier (`GET /api/suppliers/:id/supplier_sites`).',
|
|
16
|
+
props: {
|
|
17
|
+
supplierId: props_1.supplierDropdown,
|
|
18
|
+
},
|
|
19
|
+
run(_a) {
|
|
20
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue }) {
|
|
21
|
+
const client = new client_1.CoupaClient(auth.props);
|
|
22
|
+
const result = yield client.request({
|
|
23
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
24
|
+
resourceUri: `/suppliers/${propsValue.supplierId}/supplier_sites`,
|
|
25
|
+
});
|
|
26
|
+
const list = Array.isArray(result) ? result : [result];
|
|
27
|
+
const formatted = (0, utils_1.formatCoupaOutputs)(list, 'suppliers');
|
|
28
|
+
return {
|
|
29
|
+
total_count: formatted.length,
|
|
30
|
+
supplier_sites: formatted,
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=get-supplier-sites.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-supplier-sites.js","sourceRoot":"","sources":["../../../../src/lib/actions/get-supplier-sites.ts"],"names":[],"mappings":";;;;AAAA,+DAAyD;AACzD,qEAA8D;AAC9D,kCAAoC;AACpC,6CAA+C;AAC/C,2CAAmD;AACnD,2CAAqD;AAExC,QAAA,gBAAgB,GAAG,IAAA,+BAAY,EAAC;IAC3C,IAAI,EAAE,gBAAS;IACf,IAAI,EAAE,gCAAgC;IACtC,WAAW,EAAE,gCAAgC;IAC7C,WAAW,EACT,gFAAgF;IAClF,KAAK,EAAE;QACL,UAAU,EAAE,wBAAgB;KAC7B;IACK,GAAG;qEAAC,EAAE,IAAI,EAAE,UAAU,EAAE;YAC5B,MAAM,MAAM,GAAG,IAAI,oBAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC3C,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,OAAO,CAA4B;gBAC7D,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,WAAW,EAAE,cAAc,UAAU,CAAC,UAAU,iBAAiB;aAClE,CAAC,CAAC;YACH,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;YACvD,MAAM,SAAS,GAAG,IAAA,0BAAkB,EAAC,IAAI,EAAE,WAAW,CAAC,CAAC;YACxD,OAAO;gBACL,WAAW,EAAE,SAAS,CAAC,MAAM;gBAC7B,cAAc,EAAE,SAAS;aAC1B,CAAC;QACJ,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const grantApproval: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
clientId: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
+
clientSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
5
|
+
scope: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
6
|
+
}>, {
|
|
7
|
+
approvalId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
8
|
+
instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
9
|
+
clientId: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
10
|
+
clientSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
11
|
+
scope: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
12
|
+
}>>;
|
|
13
|
+
}>;
|
|
14
|
+
//# sourceMappingURL=grant-approval.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grant-approval.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/grant-approval.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,aAAa;;;;;;;;;;;;EAiBxB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.grantApproval = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
7
|
+
const auth_1 = require("../auth");
|
|
8
|
+
const client_1 = require("../common/client");
|
|
9
|
+
const props_1 = require("../common/props");
|
|
10
|
+
const utils_1 = require("../common/utils");
|
|
11
|
+
exports.grantApproval = (0, pieces_framework_1.createAction)({
|
|
12
|
+
auth: auth_1.coupaAuth,
|
|
13
|
+
name: 'grant_approval',
|
|
14
|
+
displayName: 'Grant Approval',
|
|
15
|
+
description: 'Approves a pending approval in Coupa (e.g. a requisition or purchase order awaiting your decision). Pick the approval from the dropdown.',
|
|
16
|
+
props: {
|
|
17
|
+
approvalId: props_1.pendingApprovalDropdown,
|
|
18
|
+
},
|
|
19
|
+
run(_a) {
|
|
20
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue }) {
|
|
21
|
+
const client = new client_1.CoupaClient(auth.props);
|
|
22
|
+
const result = yield client.request({
|
|
23
|
+
method: pieces_common_1.HttpMethod.PUT,
|
|
24
|
+
resourceUri: `/approvals/${propsValue.approvalId}/approve`,
|
|
25
|
+
});
|
|
26
|
+
return (0, utils_1.flattenRecord)(result);
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
//# sourceMappingURL=grant-approval.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grant-approval.js","sourceRoot":"","sources":["../../../../src/lib/actions/grant-approval.ts"],"names":[],"mappings":";;;;AAAA,+DAAyD;AACzD,qEAA8D;AAC9D,kCAAoC;AACpC,6CAA+C;AAC/C,2CAA0D;AAC1D,2CAAgD;AAEnC,QAAA,aAAa,GAAG,IAAA,+BAAY,EAAC;IACxC,IAAI,EAAE,gBAAS;IACf,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EACT,0IAA0I;IAC5I,KAAK,EAAE;QACL,UAAU,EAAE,+BAAuB;KACpC;IACK,GAAG;qEAAC,EAAE,IAAI,EAAE,UAAU,EAAE;YAC5B,MAAM,MAAM,GAAG,IAAI,oBAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC3C,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,OAAO,CAA0B;gBAC3D,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,WAAW,EAAE,cAAc,UAAU,CAAC,UAAU,UAAU;aAC3D,CAAC,CAAC;YACH,OAAO,IAAA,qBAAa,EAAC,MAAM,CAAC,CAAC;QAC/B,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const rejectApproval: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
clientId: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
+
clientSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
5
|
+
scope: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
6
|
+
}>, {
|
|
7
|
+
approvalId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
8
|
+
instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
9
|
+
clientId: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
10
|
+
clientSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
11
|
+
scope: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
12
|
+
}>>;
|
|
13
|
+
reason: import("@activepieces/pieces-framework").LongTextProperty<false>;
|
|
14
|
+
}>;
|
|
15
|
+
//# sourceMappingURL=reject-approval.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reject-approval.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/reject-approval.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,cAAc;;;;;;;;;;;;;EA8BzB,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rejectApproval = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
7
|
+
const auth_1 = require("../auth");
|
|
8
|
+
const client_1 = require("../common/client");
|
|
9
|
+
const props_1 = require("../common/props");
|
|
10
|
+
const utils_1 = require("../common/utils");
|
|
11
|
+
exports.rejectApproval = (0, pieces_framework_1.createAction)({
|
|
12
|
+
auth: auth_1.coupaAuth,
|
|
13
|
+
name: 'reject_approval',
|
|
14
|
+
displayName: 'Reject Approval',
|
|
15
|
+
description: 'Rejects a pending approval in Coupa (e.g. a requisition or purchase order awaiting your decision). Pick the approval from the dropdown.',
|
|
16
|
+
props: {
|
|
17
|
+
approvalId: props_1.pendingApprovalDropdown,
|
|
18
|
+
reason: pieces_framework_1.Property.LongText({
|
|
19
|
+
displayName: 'Rejection Reason',
|
|
20
|
+
description: 'Optional note explaining why the approval was rejected.',
|
|
21
|
+
required: false,
|
|
22
|
+
}),
|
|
23
|
+
},
|
|
24
|
+
run(_a) {
|
|
25
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue }) {
|
|
26
|
+
const client = new client_1.CoupaClient(auth.props);
|
|
27
|
+
// Coupa expects the rejection reason as a URL query parameter, not in the
|
|
28
|
+
// request body: PUT /api/approvals/{id}/reject?reason=... (the client
|
|
29
|
+
// URL-encodes it). See Coupa Core API "Approvals" docs.
|
|
30
|
+
const query = {};
|
|
31
|
+
if (propsValue.reason) {
|
|
32
|
+
query['reason'] = propsValue.reason;
|
|
33
|
+
}
|
|
34
|
+
const result = yield client.request({
|
|
35
|
+
method: pieces_common_1.HttpMethod.PUT,
|
|
36
|
+
resourceUri: `/approvals/${propsValue.approvalId}/reject`,
|
|
37
|
+
query,
|
|
38
|
+
});
|
|
39
|
+
return (0, utils_1.flattenRecord)(result);
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
//# sourceMappingURL=reject-approval.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reject-approval.js","sourceRoot":"","sources":["../../../../src/lib/actions/reject-approval.ts"],"names":[],"mappings":";;;;AAAA,+DAAyD;AACzD,qEAAwE;AACxE,kCAAoC;AACpC,6CAA+C;AAC/C,2CAA0D;AAC1D,2CAAgD;AAEnC,QAAA,cAAc,GAAG,IAAA,+BAAY,EAAC;IACzC,IAAI,EAAE,gBAAS;IACf,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE,iBAAiB;IAC9B,WAAW,EACT,yIAAyI;IAC3I,KAAK,EAAE;QACL,UAAU,EAAE,+BAAuB;QACnC,MAAM,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACxB,WAAW,EAAE,kBAAkB;YAC/B,WAAW,EAAE,yDAAyD;YACtE,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG;qEAAC,EAAE,IAAI,EAAE,UAAU,EAAE;YAC5B,MAAM,MAAM,GAAG,IAAI,oBAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC3C,0EAA0E;YAC1E,sEAAsE;YACtE,wDAAwD;YACxD,MAAM,KAAK,GAAuC,EAAE,CAAC;YACrD,IAAI,UAAU,CAAC,MAAM,EAAE,CAAC;gBACtB,KAAK,CAAC,QAAQ,CAAC,GAAG,UAAU,CAAC,MAAM,CAAC;YACtC,CAAC;YACD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,OAAO,CAA0B;gBAC3D,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,WAAW,EAAE,cAAc,UAAU,CAAC,UAAU,SAAS;gBACzD,KAAK;aACN,CAAC,CAAC;YACH,OAAO,IAAA,qBAAa,EAAC,MAAM,CAAC,CAAC;QAC/B,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const searchObjects: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
clientId: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
+
clientSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
5
|
+
scope: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
6
|
+
}>, {
|
|
7
|
+
module: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
8
|
+
customResource: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
9
|
+
queryParams: import("@activepieces/pieces-framework").JsonProperty<false>;
|
|
10
|
+
}>;
|
|
11
|
+
//# sourceMappingURL=search-objects.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-objects.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/search-objects.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,aAAa;;;;;;;;;EAkCxB,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.searchObjects = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const auth_1 = require("../auth");
|
|
7
|
+
const client_1 = require("../common/client");
|
|
8
|
+
const props_1 = require("../common/props");
|
|
9
|
+
const utils_1 = require("../common/utils");
|
|
10
|
+
exports.searchObjects = (0, pieces_framework_1.createAction)({
|
|
11
|
+
auth: auth_1.coupaAuth,
|
|
12
|
+
name: 'search_objects',
|
|
13
|
+
displayName: 'Search Objects (Batch)',
|
|
14
|
+
description: 'Searches records in a Coupa module with pagination (50 per page) and returns standardized fields.',
|
|
15
|
+
props: {
|
|
16
|
+
module: props_1.moduleProperty,
|
|
17
|
+
customResource: props_1.customModuleResourceProperty,
|
|
18
|
+
queryParams: props_1.optionalQueryParamsProperty,
|
|
19
|
+
},
|
|
20
|
+
run(_a) {
|
|
21
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue }) {
|
|
22
|
+
const client = new client_1.CoupaClient(auth.props);
|
|
23
|
+
const resource = (0, props_1.resolveModuleResource)(propsValue.module, propsValue.customResource);
|
|
24
|
+
const query = (0, props_1.parseOptionalQuery)(propsValue.queryParams);
|
|
25
|
+
const records = yield client.fetchAllRecords(resource, query);
|
|
26
|
+
if (propsValue.module !== '__custom__') {
|
|
27
|
+
const coupaModule = (0, props_1.toCoupaModule)(propsValue.module);
|
|
28
|
+
const formatted = (0, utils_1.formatCoupaOutputs)(records, coupaModule);
|
|
29
|
+
return {
|
|
30
|
+
total_count: formatted.length,
|
|
31
|
+
records: formatted,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
total_count: records.length,
|
|
36
|
+
records,
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
//# sourceMappingURL=search-objects.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-objects.js","sourceRoot":"","sources":["../../../../src/lib/actions/search-objects.ts"],"names":[],"mappings":";;;;AAAA,qEAA8D;AAC9D,kCAAoC;AACpC,6CAA+C;AAC/C,2CAOyB;AACzB,2CAAqD;AAExC,QAAA,aAAa,GAAG,IAAA,+BAAY,EAAC;IACxC,IAAI,EAAE,gBAAS;IACf,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,wBAAwB;IACrC,WAAW,EACT,mGAAmG;IACrG,KAAK,EAAE;QACL,MAAM,EAAE,sBAAc;QACtB,cAAc,EAAE,oCAA4B;QAC5C,WAAW,EAAE,mCAA2B;KACzC;IACK,GAAG;qEAAC,EAAE,IAAI,EAAE,UAAU,EAAE;YAC5B,MAAM,MAAM,GAAG,IAAI,oBAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC3C,MAAM,QAAQ,GAAG,IAAA,6BAAqB,EACpC,UAAU,CAAC,MAAM,EACjB,UAAU,CAAC,cAAc,CAC1B,CAAC;YACF,MAAM,KAAK,GAAG,IAAA,0BAAkB,EAAC,UAAU,CAAC,WAAW,CAAC,CAAC;YACzD,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,eAAe,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;YAE9D,IAAI,UAAU,CAAC,MAAM,KAAK,YAAY,EAAE,CAAC;gBACvC,MAAM,WAAW,GAAG,IAAA,qBAAa,EAAC,UAAU,CAAC,MAAM,CAAC,CAAC;gBACrD,MAAM,SAAS,GAAG,IAAA,0BAAkB,EAAC,OAAO,EAAE,WAAW,CAAC,CAAC;gBAC3D,OAAO;oBACL,WAAW,EAAE,SAAS,CAAC,MAAM;oBAC7B,OAAO,EAAE,SAAS;iBACnB,CAAC;YACJ,CAAC;YAED,OAAO;gBACL,WAAW,EAAE,OAAO,CAAC,MAAM;gBAC3B,OAAO;aACR,CAAC;QACJ,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const setIntegrationRunStatus: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
clientId: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
+
clientSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
5
|
+
scope: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
6
|
+
}>, {
|
|
7
|
+
integrationRunId: import("@activepieces/pieces-framework").NumberProperty<true>;
|
|
8
|
+
status: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
9
|
+
}>;
|
|
10
|
+
//# sourceMappingURL=set-integration-run-status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-integration-run-status.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/set-integration-run-status.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,uBAAuB;;;;;;;;EA+BlC,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setIntegrationRunStatus = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
7
|
+
const auth_1 = require("../auth");
|
|
8
|
+
const client_1 = require("../common/client");
|
|
9
|
+
const props_1 = require("../common/props");
|
|
10
|
+
const utils_1 = require("../common/utils");
|
|
11
|
+
exports.setIntegrationRunStatus = (0, pieces_framework_1.createAction)({
|
|
12
|
+
auth: auth_1.coupaAuth,
|
|
13
|
+
name: 'set_integration_run_status',
|
|
14
|
+
displayName: 'Set Integration Run Status',
|
|
15
|
+
description: 'Updates an integration run status (`run`, `success`, `fail`, `pause`, or `pending`).',
|
|
16
|
+
props: {
|
|
17
|
+
integrationRunId: props_1.objectIdProperty,
|
|
18
|
+
status: pieces_framework_1.Property.StaticDropdown({
|
|
19
|
+
displayName: 'Status',
|
|
20
|
+
required: true,
|
|
21
|
+
options: {
|
|
22
|
+
disabled: false,
|
|
23
|
+
options: [
|
|
24
|
+
{ label: 'Running', value: 'run' },
|
|
25
|
+
{ label: 'Successful', value: 'success' },
|
|
26
|
+
{ label: 'Failed', value: 'fail' },
|
|
27
|
+
{ label: 'Paused', value: 'pause' },
|
|
28
|
+
{ label: 'Pending', value: 'pending' },
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
}),
|
|
32
|
+
},
|
|
33
|
+
run(_a) {
|
|
34
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue }) {
|
|
35
|
+
const client = new client_1.CoupaClient(auth.props);
|
|
36
|
+
const result = yield client.request({
|
|
37
|
+
method: pieces_common_1.HttpMethod.PUT,
|
|
38
|
+
resourceUri: `/integration_runs/${propsValue.integrationRunId}/${propsValue.status}`,
|
|
39
|
+
});
|
|
40
|
+
return (0, utils_1.flattenRecord)(result);
|
|
41
|
+
});
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=set-integration-run-status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-integration-run-status.js","sourceRoot":"","sources":["../../../../src/lib/actions/set-integration-run-status.ts"],"names":[],"mappings":";;;;AAAA,+DAAyD;AACzD,qEAAwE;AACxE,kCAAoC;AACpC,6CAA+C;AAC/C,2CAAmD;AACnD,2CAAgD;AAEnC,QAAA,uBAAuB,GAAG,IAAA,+BAAY,EAAC;IAClD,IAAI,EAAE,gBAAS;IACf,IAAI,EAAE,4BAA4B;IAClC,WAAW,EAAE,4BAA4B;IACzC,WAAW,EACT,sFAAsF;IACxF,KAAK,EAAE;QACL,gBAAgB,EAAE,wBAAgB;QAClC,MAAM,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAC9B,WAAW,EAAE,QAAQ;YACrB,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE;oBACP,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE;oBAClC,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,EAAE;oBACzC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE;oBAClC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE;oBACnC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;iBACvC;aACF;SACF,CAAC;KACH;IACK,GAAG;qEAAC,EAAE,IAAI,EAAE,UAAU,EAAE;YAC5B,MAAM,MAAM,GAAG,IAAI,oBAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC3C,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,OAAO,CAA0B;gBAC3D,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,WAAW,EAAE,qBAAqB,UAAU,CAAC,gBAAgB,IAAI,UAAU,CAAC,MAAM,EAAE;aACrF,CAAC,CAAC;YACH,OAAO,IAAA,qBAAa,EAAC,MAAM,CAAC,CAAC;QAC/B,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const updateObject: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
clientId: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
+
clientSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
5
|
+
scope: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
6
|
+
}>, {
|
|
7
|
+
module: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
8
|
+
customResource: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
9
|
+
record: import("@activepieces/pieces-framework").DynamicProperties<true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
10
|
+
instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
11
|
+
clientId: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
12
|
+
clientSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
13
|
+
scope: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
14
|
+
}>>;
|
|
15
|
+
bodyHelp: import("@activepieces/pieces-framework/dist/src/lib/property/input/markdown-property").MarkDownProperty;
|
|
16
|
+
body: import("@activepieces/pieces-framework").JsonProperty<true>;
|
|
17
|
+
}>;
|
|
18
|
+
//# sourceMappingURL=update-object.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-object.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/update-object.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;EA+BvB,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateObject = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
7
|
+
const auth_1 = require("../auth");
|
|
8
|
+
const client_1 = require("../common/client");
|
|
9
|
+
const props_1 = require("../common/props");
|
|
10
|
+
const utils_1 = require("../common/utils");
|
|
11
|
+
exports.updateObject = (0, pieces_framework_1.createAction)({
|
|
12
|
+
auth: auth_1.coupaAuth,
|
|
13
|
+
name: 'update_object',
|
|
14
|
+
displayName: 'Update Object',
|
|
15
|
+
description: 'Updates a record by ID in the selected Coupa module (Purchase Orders, Suppliers, or Contracts).',
|
|
16
|
+
props: {
|
|
17
|
+
module: props_1.moduleProperty,
|
|
18
|
+
customResource: props_1.customModuleResourceProperty,
|
|
19
|
+
record: props_1.objectSelector,
|
|
20
|
+
bodyHelp: props_1.requestBodyHelp,
|
|
21
|
+
body: props_1.requestBodyProperty,
|
|
22
|
+
},
|
|
23
|
+
run(_a) {
|
|
24
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue }) {
|
|
25
|
+
const client = new client_1.CoupaClient(auth.props);
|
|
26
|
+
const resource = (0, props_1.resolveModuleResource)(propsValue.module, propsValue.customResource);
|
|
27
|
+
const objectId = propsValue.record['objectId'];
|
|
28
|
+
const body = (0, utils_1.parseJsonBody)(propsValue.body);
|
|
29
|
+
const result = yield client.request({
|
|
30
|
+
method: pieces_common_1.HttpMethod.PUT,
|
|
31
|
+
resourceUri: `/${resource}/${objectId}`,
|
|
32
|
+
body,
|
|
33
|
+
});
|
|
34
|
+
if (propsValue.module !== '__custom__') {
|
|
35
|
+
return (0, utils_1.formatCoupaOutput)(result, (0, props_1.toCoupaModule)(propsValue.module));
|
|
36
|
+
}
|
|
37
|
+
return result;
|
|
38
|
+
});
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
//# sourceMappingURL=update-object.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-object.js","sourceRoot":"","sources":["../../../../src/lib/actions/update-object.ts"],"names":[],"mappings":";;;;AAAA,+DAAyD;AACzD,qEAA8D;AAC9D,kCAAoC;AACpC,6CAA+C;AAC/C,2CAQyB;AACzB,2CAAmE;AAEtD,QAAA,YAAY,GAAG,IAAA,+BAAY,EAAC;IACvC,IAAI,EAAE,gBAAS;IACf,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,eAAe;IAC5B,WAAW,EACT,iGAAiG;IACnG,KAAK,EAAE;QACL,MAAM,EAAE,sBAAc;QACtB,cAAc,EAAE,oCAA4B;QAC5C,MAAM,EAAE,sBAAc;QACtB,QAAQ,EAAE,uBAAe;QACzB,IAAI,EAAE,2BAAmB;KAC1B;IACK,GAAG;qEAAC,EAAE,IAAI,EAAE,UAAU,EAAE;YAC5B,MAAM,MAAM,GAAG,IAAI,oBAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC3C,MAAM,QAAQ,GAAG,IAAA,6BAAqB,EACpC,UAAU,CAAC,MAAM,EACjB,UAAU,CAAC,cAAc,CAC1B,CAAC;YACF,MAAM,QAAQ,GAAG,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;YAC/C,MAAM,IAAI,GAAG,IAAA,qBAAa,EAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YAC5C,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,OAAO,CAA0B;gBAC3D,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,WAAW,EAAE,IAAI,QAAQ,IAAI,QAAQ,EAAE;gBACvC,IAAI;aACL,CAAC,CAAC;YACH,IAAI,UAAU,CAAC,MAAM,KAAK,YAAY,EAAE,CAAC;gBACvC,OAAO,IAAA,yBAAiB,EAAC,MAAM,EAAE,IAAA,qBAAa,EAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;YACrE,CAAC;YACD,OAAO,MAAM,CAAC;QAChB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const coupaAuth: import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
instanceUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
clientId: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
+
clientSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
5
|
+
scope: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
6
|
+
}>;
|
|
7
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/lib/auth.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,SAAS;;;;;EA6CpB,CAAC"}
|
package/src/lib/auth.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.coupaAuth = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const client_1 = require("./common/client");
|
|
7
|
+
exports.coupaAuth = pieces_framework_1.PieceAuth.CustomAuth({
|
|
8
|
+
description: 'Connect using an OAuth 2.0 OpenID Connect client with the **Client Credentials** grant. In Coupa, go to **Setup → Integrations → OAuth2/OpenID Connect Clients**, create a client, and copy the Client ID and Client Secret. Scopes use the form `core.accounting.read` — list yours at `https://{your-instance}/oauth2/scopes`.',
|
|
9
|
+
required: true,
|
|
10
|
+
props: {
|
|
11
|
+
instanceUrl: pieces_framework_1.Property.ShortText({
|
|
12
|
+
displayName: 'Coupa Instance URL',
|
|
13
|
+
description: 'Your Coupa hostname only, e.g. `company.coupahost.com` (without `https://`).',
|
|
14
|
+
required: true,
|
|
15
|
+
}),
|
|
16
|
+
clientId: pieces_framework_1.PieceAuth.SecretText({
|
|
17
|
+
displayName: 'Client ID',
|
|
18
|
+
required: true,
|
|
19
|
+
}),
|
|
20
|
+
clientSecret: pieces_framework_1.PieceAuth.SecretText({
|
|
21
|
+
displayName: 'Client Secret',
|
|
22
|
+
required: true,
|
|
23
|
+
}),
|
|
24
|
+
scope: pieces_framework_1.Property.LongText({
|
|
25
|
+
displayName: 'OAuth Scopes',
|
|
26
|
+
description: 'Space-separated scopes granted to your OIDC client, e.g. `core.purchase_order.read core.purchase_order.write`.',
|
|
27
|
+
required: true,
|
|
28
|
+
defaultValue: 'core.common.read core.common.write',
|
|
29
|
+
}),
|
|
30
|
+
},
|
|
31
|
+
validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
32
|
+
try {
|
|
33
|
+
const client = new client_1.CoupaClient({
|
|
34
|
+
instanceUrl: auth.instanceUrl,
|
|
35
|
+
clientId: auth.clientId,
|
|
36
|
+
clientSecret: auth.clientSecret,
|
|
37
|
+
scope: auth.scope,
|
|
38
|
+
});
|
|
39
|
+
yield client.getAccessToken();
|
|
40
|
+
return { valid: true };
|
|
41
|
+
}
|
|
42
|
+
catch (_b) {
|
|
43
|
+
return {
|
|
44
|
+
valid: false,
|
|
45
|
+
error: 'Could not authenticate with Coupa. Check the instance URL, Client ID/Secret, and that the OIDC client uses the Client Credentials grant.',
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
}),
|
|
49
|
+
});
|
|
50
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/lib/auth.ts"],"names":[],"mappings":";;;;AAAA,qEAAqE;AACrE,4CAA8C;AAEjC,QAAA,SAAS,GAAG,4BAAS,CAAC,UAAU,CAAC;IAC5C,WAAW,EACT,kUAAkU;IACpU,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE;QACL,WAAW,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC9B,WAAW,EAAE,oBAAoB;YACjC,WAAW,EACT,8EAA8E;YAChF,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,QAAQ,EAAE,4BAAS,CAAC,UAAU,CAAC;YAC7B,WAAW,EAAE,WAAW;YACxB,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,YAAY,EAAE,4BAAS,CAAC,UAAU,CAAC;YACjC,WAAW,EAAE,eAAe;YAC5B,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,KAAK,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACvB,WAAW,EAAE,cAAc;YAC3B,WAAW,EACT,gHAAgH;YAClH,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,oCAAoC;SACnD,CAAC;KACH;IACD,QAAQ,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;QACvB,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,IAAI,oBAAW,CAAC;gBAC7B,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,YAAY,EAAE,IAAI,CAAC,YAAY;gBAC/B,KAAK,EAAE,IAAI,CAAC,KAAK;aAClB,CAAC,CAAC;YACH,MAAM,MAAM,CAAC,cAAc,EAAE,CAAC;YAC9B,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QACzB,CAAC;QAAC,WAAM,CAAC;YACP,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,KAAK,EACH,0IAA0I;aAC7I,CAAC;QACJ,CAAC;IACH,CAAC,CAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { HttpMethod, HttpMessageBody } from '@activepieces/pieces-common';
|
|
2
|
+
import FormData from 'form-data';
|
|
3
|
+
export type CoupaAuthProps = {
|
|
4
|
+
instanceUrl: string;
|
|
5
|
+
clientId: string;
|
|
6
|
+
clientSecret: string;
|
|
7
|
+
scope: string;
|
|
8
|
+
};
|
|
9
|
+
export declare class CoupaClient {
|
|
10
|
+
private readonly auth;
|
|
11
|
+
private readonly baseUrl;
|
|
12
|
+
private readonly tokenUrl;
|
|
13
|
+
private accessToken;
|
|
14
|
+
private tokenExpiresAt;
|
|
15
|
+
private tokenPromise;
|
|
16
|
+
constructor(auth: CoupaAuthProps);
|
|
17
|
+
getAccessToken(): Promise<string>;
|
|
18
|
+
private fetchAccessToken;
|
|
19
|
+
request<T extends HttpMessageBody>({ method, resourceUri, query, body, headers, }: {
|
|
20
|
+
method: HttpMethod;
|
|
21
|
+
resourceUri: string;
|
|
22
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
23
|
+
body?: unknown;
|
|
24
|
+
headers?: Record<string, string>;
|
|
25
|
+
}): Promise<T>;
|
|
26
|
+
requestMultipart<T extends HttpMessageBody>({ resourceUri, formData, }: {
|
|
27
|
+
resourceUri: string;
|
|
28
|
+
formData: FormData;
|
|
29
|
+
}): Promise<T>;
|
|
30
|
+
paginateRecords(resource: string, query?: Record<string, string | number | boolean | undefined>): AsyncGenerator<Record<string, unknown>[]>;
|
|
31
|
+
fetchAllRecords(resource: string, query?: Record<string, string | number | boolean | undefined>): Promise<Record<string, unknown>[]>;
|
|
32
|
+
}
|
|
33
|
+
export declare const COUPA_PAGE_SIZE = 50;
|
|
34
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,UAAU,EACV,eAAe,EAGhB,MAAM,6BAA6B,CAAC;AACrC,OAAO,QAAQ,MAAM,WAAW,CAAC;AAGjC,MAAM,MAAM,cAAc,GAAG;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAKF,qBAAa,WAAW;IAOV,OAAO,CAAC,QAAQ,CAAC,IAAI;IANjC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,WAAW,CAAuB;IAC1C,OAAO,CAAC,cAAc,CAAK;IAC3B,OAAO,CAAC,YAAY,CAAgC;gBAEvB,IAAI,EAAE,cAAc;IAM3C,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC;YAczB,gBAAgB;IAwBxB,OAAO,CAAC,CAAC,SAAS,eAAe,EAAE,EACvC,MAAM,EACN,WAAW,EACX,KAAK,EACL,IAAI,EACJ,OAAO,GACR,EAAE;QACD,MAAM,EAAE,UAAU,CAAC;QACnB,WAAW,EAAE,MAAM,CAAC;QACpB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAC;QAC9D,IAAI,CAAC,EAAE,OAAO,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAClC,GAAG,OAAO,CAAC,CAAC,CAAC;IAiCR,gBAAgB,CAAC,CAAC,SAAS,eAAe,EAAE,EAChD,WAAW,EACX,QAAQ,GACT,EAAE;QACD,WAAW,EAAE,MAAM,CAAC;QACpB,QAAQ,EAAE,QAAQ,CAAC;KACpB,GAAG,OAAO,CAAC,CAAC,CAAC;IAwBP,eAAe,CACpB,QAAQ,EAAE,MAAM,EAChB,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAM,GAChE,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IA0BtC,eAAe,CACnB,QAAQ,EAAE,MAAM,EAChB,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAM,GAChE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;CAOtC;AAED,eAAO,MAAM,eAAe,KAAmB,CAAC"}
|