@activepieces/piece-netsuite 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/README.md +7 -0
- package/package.json +36 -0
- package/src/index.d.ts +14 -0
- package/src/index.js +47 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/get-customer.d.ts +9 -0
- package/src/lib/actions/get-customer.js +41 -0
- package/src/lib/actions/get-customer.js.map +1 -0
- package/src/lib/actions/get-vendor.d.ts +9 -0
- package/src/lib/actions/get-vendor.js +41 -0
- package/src/lib/actions/get-vendor.js.map +1 -0
- package/src/lib/oauth.d.ts +3 -0
- package/src/lib/oauth.js +53 -0
- package/src/lib/oauth.js.map +1 -0
package/README.md
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@activepieces/piece-netsuite",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"dependencies": {
|
|
5
|
+
"@anthropic-ai/sdk": "0.39.0",
|
|
6
|
+
"@sinclair/typebox": "0.34.11",
|
|
7
|
+
"axios": "1.8.3",
|
|
8
|
+
"axios-retry": "4.4.1",
|
|
9
|
+
"deepmerge-ts": "7.1.0",
|
|
10
|
+
"mime-types": "2.1.35",
|
|
11
|
+
"nanoid": "3.3.8",
|
|
12
|
+
"openai": "4.67.1",
|
|
13
|
+
"replicate": "0.34.1",
|
|
14
|
+
"semver": "7.6.0",
|
|
15
|
+
"zod": "3.24.2",
|
|
16
|
+
"@activepieces/pieces-common": "0.4.5",
|
|
17
|
+
"@activepieces/pieces-framework": "0.8.1",
|
|
18
|
+
"@activepieces/shared": "0.10.178",
|
|
19
|
+
"tslib": "1.14.1"
|
|
20
|
+
},
|
|
21
|
+
"overrides": {
|
|
22
|
+
"cross-spawn": "7.0.6",
|
|
23
|
+
"@tryfabric/martian": {
|
|
24
|
+
"@notionhq/client": "$@notionhq/client"
|
|
25
|
+
},
|
|
26
|
+
"vite": {
|
|
27
|
+
"rollup": "npm:@rollup/wasm-node"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"resolutions": {
|
|
31
|
+
"rollup": "npm:@rollup/wasm-node"
|
|
32
|
+
},
|
|
33
|
+
"main": "./src/index.js",
|
|
34
|
+
"type": "commonjs",
|
|
35
|
+
"types": "./src/index.d.ts"
|
|
36
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const netsuiteAuth: import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
accountId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
consumerKey: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
consumerSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
5
|
+
tokenId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
tokenSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
7
|
+
}>;
|
|
8
|
+
export declare const netsuite: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
9
|
+
accountId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
10
|
+
consumerKey: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
11
|
+
consumerSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
12
|
+
tokenId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
13
|
+
tokenSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
14
|
+
}>>;
|
package/src/index.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.netsuite = exports.netsuiteAuth = void 0;
|
|
4
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
5
|
+
const get_vendor_1 = require("./lib/actions/get-vendor");
|
|
6
|
+
const get_customer_1 = require("./lib/actions/get-customer");
|
|
7
|
+
const shared_1 = require("@activepieces/shared");
|
|
8
|
+
exports.netsuiteAuth = pieces_framework_1.PieceAuth.CustomAuth({
|
|
9
|
+
required: true,
|
|
10
|
+
props: {
|
|
11
|
+
accountId: pieces_framework_1.Property.ShortText({
|
|
12
|
+
displayName: 'Account ID',
|
|
13
|
+
required: true,
|
|
14
|
+
description: 'Your NetSuite account ID',
|
|
15
|
+
}),
|
|
16
|
+
consumerKey: pieces_framework_1.Property.ShortText({
|
|
17
|
+
displayName: 'Consumer Key',
|
|
18
|
+
required: true,
|
|
19
|
+
description: 'Your NetSuite consumer key',
|
|
20
|
+
}),
|
|
21
|
+
consumerSecret: pieces_framework_1.PieceAuth.SecretText({
|
|
22
|
+
displayName: 'Consumer Secret',
|
|
23
|
+
required: true,
|
|
24
|
+
description: 'Your NetSuite consumer secret',
|
|
25
|
+
}),
|
|
26
|
+
tokenId: pieces_framework_1.Property.ShortText({
|
|
27
|
+
displayName: 'Token ID',
|
|
28
|
+
required: true,
|
|
29
|
+
description: 'Your NetSuite token ID',
|
|
30
|
+
}),
|
|
31
|
+
tokenSecret: pieces_framework_1.PieceAuth.SecretText({
|
|
32
|
+
displayName: 'Token Secret',
|
|
33
|
+
required: true,
|
|
34
|
+
description: 'Your NetSuite token secret',
|
|
35
|
+
}),
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
exports.netsuite = (0, pieces_framework_1.createPiece)({
|
|
39
|
+
displayName: 'NetSuite',
|
|
40
|
+
logoUrl: 'https://cdn.activepieces.com/pieces/netsuite.png',
|
|
41
|
+
categories: [shared_1.PieceCategory.SALES_AND_CRM],
|
|
42
|
+
auth: exports.netsuiteAuth,
|
|
43
|
+
authors: ["geekyme"],
|
|
44
|
+
actions: [get_vendor_1.getVendor, get_customer_1.getCustomer],
|
|
45
|
+
triggers: [],
|
|
46
|
+
});
|
|
47
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/netsuite/src/index.ts"],"names":[],"mappings":";;;AAAA,qEAAkF;AAClF,yDAAqD;AACrD,6DAAyD;AACzD,iDAAqD;AAExC,QAAA,YAAY,GAAG,4BAAS,CAAC,UAAU,CAAC;IAC/C,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE;QACL,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC5B,WAAW,EAAE,YAAY;YACzB,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,0BAA0B;SACxC,CAAC;QACF,WAAW,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC9B,WAAW,EAAE,cAAc;YAC3B,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,4BAA4B;SAC1C,CAAC;QACF,cAAc,EAAE,4BAAS,CAAC,UAAU,CAAC;YACnC,WAAW,EAAE,iBAAiB;YAC9B,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,+BAA+B;SAC7C,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,UAAU;YACvB,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,wBAAwB;SACtC,CAAC;QACF,WAAW,EAAE,4BAAS,CAAC,UAAU,CAAC;YAChC,WAAW,EAAE,cAAc;YAC3B,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,4BAA4B;SAC1C,CAAC;KACH;CACF,CAAC,CAAC;AAEU,QAAA,QAAQ,GAAG,IAAA,8BAAW,EAAC;IAClC,WAAW,EAAE,UAAU;IACvB,OAAO,EAAE,kDAAkD;IAC3D,UAAU,EAAC,CAAC,sBAAa,CAAC,aAAa,CAAC;IACxC,IAAI,EAAE,oBAAY;IAClB,OAAO,EAAE,CAAC,SAAS,CAAC;IACpB,OAAO,EAAE,CAAC,sBAAS,EAAE,0BAAW,CAAC;IACjC,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const getCustomer: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
accountId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
consumerKey: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
consumerSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
5
|
+
tokenId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
tokenSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
7
|
+
}>, {
|
|
8
|
+
customerId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
9
|
+
}>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCustomer = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const __1 = require("../..");
|
|
8
|
+
const oauth_1 = require("../oauth");
|
|
9
|
+
exports.getCustomer = (0, pieces_framework_1.createAction)({
|
|
10
|
+
name: 'getCustomer',
|
|
11
|
+
auth: __1.netsuiteAuth,
|
|
12
|
+
displayName: 'Get Customer',
|
|
13
|
+
description: 'Gets customer details from NetSuite.',
|
|
14
|
+
props: {
|
|
15
|
+
customerId: pieces_framework_1.Property.ShortText({
|
|
16
|
+
displayName: 'Customer ID',
|
|
17
|
+
required: true,
|
|
18
|
+
description: 'The ID of the customer to retrieve.',
|
|
19
|
+
}),
|
|
20
|
+
},
|
|
21
|
+
run(context) {
|
|
22
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
const { accountId, consumerKey, consumerSecret, tokenId, tokenSecret } = context.auth;
|
|
24
|
+
const { customerId } = context.propsValue;
|
|
25
|
+
const baseUrl = `https://${accountId}.suitetalk.api.netsuite.com/services/rest/record/v1/customer/${customerId}`;
|
|
26
|
+
const httpMethod = pieces_common_1.HttpMethod.GET;
|
|
27
|
+
const authHeader = (0, oauth_1.createOAuthHeader)(accountId, consumerKey, consumerSecret, tokenId, tokenSecret, baseUrl, httpMethod);
|
|
28
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
29
|
+
method: httpMethod,
|
|
30
|
+
url: baseUrl,
|
|
31
|
+
headers: {
|
|
32
|
+
Authorization: authHeader,
|
|
33
|
+
'prefer': 'transient',
|
|
34
|
+
'Cookie': 'NS_ROUTING_VERSION=LAGGING',
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
return response.body;
|
|
38
|
+
});
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
//# sourceMappingURL=get-customer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-customer.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/netsuite/src/lib/actions/get-customer.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,6BAAqC;AACrC,oCAA6C;AAEhC,QAAA,WAAW,GAAG,IAAA,+BAAY,EAAC;IACtC,IAAI,EAAE,aAAa;IACnB,IAAI,EAAE,gBAAY;IAClB,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,sCAAsC;IACnD,KAAK,EAAE;QACL,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC7B,WAAW,EAAE,aAAa;YAC1B,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,qCAAqC;SACnD,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,cAAc,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;YACtF,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAE1C,MAAM,OAAO,GAAG,WAAW,SAAS,gEAAgE,UAAU,EAAE,CAAC;YACjH,MAAM,UAAU,GAAG,0BAAU,CAAC,GAAG,CAAC;YAElC,MAAM,UAAU,GAAG,IAAA,yBAAiB,EAClC,SAAS,EACT,WAAW,EACX,cAAc,EACd,OAAO,EACP,WAAW,EACX,OAAO,EACP,UAAU,CACX,CAAC;YAEF,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC5C,MAAM,EAAE,UAAU;gBAClB,GAAG,EAAE,OAAO;gBACZ,OAAO,EAAE;oBACP,aAAa,EAAE,UAAU;oBACzB,QAAQ,EAAE,WAAW;oBACrB,QAAQ,EAAE,4BAA4B;iBACvC;aACF,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const getVendor: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
accountId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
consumerKey: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
consumerSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
5
|
+
tokenId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
tokenSecret: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
7
|
+
}>, {
|
|
8
|
+
vendorId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
9
|
+
}>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getVendor = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const __1 = require("../..");
|
|
8
|
+
const oauth_1 = require("../oauth");
|
|
9
|
+
exports.getVendor = (0, pieces_framework_1.createAction)({
|
|
10
|
+
name: 'getVendor',
|
|
11
|
+
auth: __1.netsuiteAuth,
|
|
12
|
+
displayName: 'Get Vendor',
|
|
13
|
+
description: 'Gets vendor details from NetSuite.',
|
|
14
|
+
props: {
|
|
15
|
+
vendorId: pieces_framework_1.Property.ShortText({
|
|
16
|
+
displayName: 'Vendor ID',
|
|
17
|
+
required: true,
|
|
18
|
+
description: 'The ID of the vendor to retrieve.',
|
|
19
|
+
}),
|
|
20
|
+
},
|
|
21
|
+
run(context) {
|
|
22
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
const { accountId, consumerKey, consumerSecret, tokenId, tokenSecret } = context.auth;
|
|
24
|
+
const { vendorId } = context.propsValue;
|
|
25
|
+
const baseUrl = `https://${accountId}.suitetalk.api.netsuite.com/services/rest/record/v1/vendor/${vendorId}`;
|
|
26
|
+
const httpMethod = pieces_common_1.HttpMethod.GET;
|
|
27
|
+
const authHeader = (0, oauth_1.createOAuthHeader)(accountId, consumerKey, consumerSecret, tokenId, tokenSecret, baseUrl, httpMethod);
|
|
28
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
29
|
+
method: httpMethod,
|
|
30
|
+
url: baseUrl,
|
|
31
|
+
headers: {
|
|
32
|
+
Authorization: authHeader,
|
|
33
|
+
'prefer': 'transient',
|
|
34
|
+
'Cookie': 'NS_ROUTING_VERSION=LAGGING',
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
return response.body;
|
|
38
|
+
});
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
//# sourceMappingURL=get-vendor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-vendor.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/netsuite/src/lib/actions/get-vendor.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,6BAAqC;AACrC,oCAA6C;AAEhC,QAAA,SAAS,GAAG,IAAA,+BAAY,EAAC;IACpC,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,gBAAY;IAClB,WAAW,EAAE,YAAY;IACzB,WAAW,EAAE,oCAAoC;IACjD,KAAK,EAAE;QACL,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,WAAW;YACxB,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,mCAAmC;SACjD,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,cAAc,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;YACtF,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAExC,MAAM,OAAO,GAAG,WAAW,SAAS,8DAA8D,QAAQ,EAAE,CAAC;YAC7G,MAAM,UAAU,GAAG,0BAAU,CAAC,GAAG,CAAC;YAElC,MAAM,UAAU,GAAG,IAAA,yBAAiB,EAClC,SAAS,EACT,WAAW,EACX,cAAc,EACd,OAAO,EACP,WAAW,EACX,OAAO,EACP,UAAU,CACX,CAAC;YAEF,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC5C,MAAM,EAAE,UAAU;gBAClB,GAAG,EAAE,OAAO;gBACZ,OAAO,EAAE;oBACP,aAAa,EAAE,UAAU;oBACzB,QAAQ,EAAE,WAAW;oBACrB,QAAQ,EAAE,4BAA4B;iBACvC;aACF,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare function generateNonce(): string;
|
|
2
|
+
export declare function generateSignature(baseUrl: string, httpMethod: string, oauthNonce: string, timestamp: number, consumerKey: string, consumerSecret: string, tokenId: string, tokenSecret: string): string;
|
|
3
|
+
export declare function createOAuthHeader(accountId: string, consumerKey: string, consumerSecret: string, tokenId: string, tokenSecret: string, baseUrl: string, httpMethod: string): string;
|
package/src/lib/oauth.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateNonce = generateNonce;
|
|
4
|
+
exports.generateSignature = generateSignature;
|
|
5
|
+
exports.createOAuthHeader = createOAuthHeader;
|
|
6
|
+
const crypto_1 = require("crypto");
|
|
7
|
+
const SIGN_METHOD = 'HMAC-SHA256';
|
|
8
|
+
const OAUTH_VERSION = '1.0';
|
|
9
|
+
function generateNonce() {
|
|
10
|
+
const length = 11;
|
|
11
|
+
const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
12
|
+
return Array.from({ length }, () => possible[Math.floor(Math.random() * possible.length)]).join('');
|
|
13
|
+
}
|
|
14
|
+
function generateSignature(baseUrl, httpMethod, oauthNonce, timestamp, consumerKey, consumerSecret, tokenId, tokenSecret) {
|
|
15
|
+
const params = new URLSearchParams({
|
|
16
|
+
oauth_consumer_key: consumerKey,
|
|
17
|
+
oauth_nonce: oauthNonce,
|
|
18
|
+
oauth_signature_method: SIGN_METHOD,
|
|
19
|
+
oauth_timestamp: timestamp.toString(),
|
|
20
|
+
oauth_token: tokenId,
|
|
21
|
+
oauth_version: OAUTH_VERSION,
|
|
22
|
+
});
|
|
23
|
+
const signatureBaseString = [
|
|
24
|
+
httpMethod,
|
|
25
|
+
encodeURIComponent(baseUrl),
|
|
26
|
+
encodeURIComponent(params.toString()),
|
|
27
|
+
].join('&');
|
|
28
|
+
const signingKey = [
|
|
29
|
+
encodeURIComponent(consumerSecret),
|
|
30
|
+
encodeURIComponent(tokenSecret),
|
|
31
|
+
].join('&');
|
|
32
|
+
const hmac = (0, crypto_1.createHmac)('sha256', signingKey);
|
|
33
|
+
hmac.update(signatureBaseString);
|
|
34
|
+
const signature = hmac.digest('base64');
|
|
35
|
+
return encodeURIComponent(signature);
|
|
36
|
+
}
|
|
37
|
+
function createOAuthHeader(accountId, consumerKey, consumerSecret, tokenId, tokenSecret, baseUrl, httpMethod) {
|
|
38
|
+
const oauthNonce = generateNonce();
|
|
39
|
+
const timestamp = Math.floor(Date.now() / 1000);
|
|
40
|
+
const signature = generateSignature(baseUrl, httpMethod, oauthNonce, timestamp, consumerKey, consumerSecret, tokenId, tokenSecret);
|
|
41
|
+
const headerParams = [
|
|
42
|
+
`realm="${accountId}"`,
|
|
43
|
+
`oauth_token="${tokenId}"`,
|
|
44
|
+
`oauth_consumer_key="${consumerKey}"`,
|
|
45
|
+
`oauth_nonce="${oauthNonce}"`,
|
|
46
|
+
`oauth_timestamp="${timestamp}"`,
|
|
47
|
+
`oauth_signature_method="${SIGN_METHOD}"`,
|
|
48
|
+
`oauth_version="${OAUTH_VERSION}"`,
|
|
49
|
+
`oauth_signature="${signature}"`,
|
|
50
|
+
].join(',');
|
|
51
|
+
return `OAuth ${headerParams}`;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=oauth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/community/netsuite/src/lib/oauth.ts"],"names":[],"mappings":";;AAOA,sCAIC;AAED,8CAmCC;AAED,8CAkCC;AAnFD,mCAAoC;AAGpC,MAAM,WAAW,GAAG,aAAa,CAAC;AAClC,MAAM,aAAa,GAAG,KAAK,CAAC;AAE5B,SAAgB,aAAa;IAC3B,MAAM,MAAM,GAAG,EAAE,CAAC;IAClB,MAAM,QAAQ,GAAG,gEAAgE,CAAC;IAClF,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,QAAQ,CA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