zudello-execute-local 1.1.42 → 1.1.44

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zudello-execute-local",
3
- "version": "1.1.42",
3
+ "version": "1.1.44",
4
4
  "description": "Zudello Execute tool for local runs",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -29,7 +29,7 @@
29
29
  "xml2js": "^0.6.2",
30
30
  "yargs": "^17.7.2",
31
31
  "zudello-integration-sdk": "^1.0.95",
32
- "zudello-integration-sdk-v1": "1.0.86"
32
+ "zudello-integration-sdk-v1": "1.0.87"
33
33
  },
34
34
  "overrides": {
35
35
  "e2b": {
@@ -1,4 +1,28 @@
1
1
  const { NodeVM, makeResolverFromLegacyOptions } = require('vm2')
2
+ const path = require('path')
3
+ const fs = require('fs')
4
+
5
+ const createCustomResolver = (sdkOverridePath) => {
6
+ if (!sdkOverridePath) {
7
+ return undefined
8
+ }
9
+
10
+ const absoluteSdkPath = path.resolve(sdkOverridePath)
11
+
12
+ if (!fs.existsSync(absoluteSdkPath)) {
13
+ console.warn(`[WARN] INTEGRATION_SDK_PATH does not exist: ${absoluteSdkPath}`)
14
+ return undefined
15
+ }
16
+
17
+ console.log(`[INFO] Using SDK override path: ${absoluteSdkPath}`)
18
+
19
+ return (moduleName, fromPath) => {
20
+ if (moduleName === 'zudello-integration-sdk-v1') {
21
+ return absoluteSdkPath
22
+ }
23
+ return undefined
24
+ }
25
+ }
2
26
 
3
27
  const connectionSdkMapping = {
4
28
  netsuite: [{
@@ -153,6 +177,13 @@ const connectionSdkMapping = {
153
177
  }
154
178
 
155
179
  const initiateNodeVM = (dirNamePath) => {
180
+ const sdkOverridePath = process.env.INTEGRATION_SDK_PATH
181
+
182
+ const rootPaths = [dirNamePath]
183
+ if (sdkOverridePath) {
184
+ rootPaths.push(path.resolve(sdkOverridePath))
185
+ }
186
+
156
187
  return new NodeVM({
157
188
  console: 'inherit',
158
189
  sandbox: {
@@ -170,7 +201,7 @@ const initiateNodeVM = (dirNamePath) => {
170
201
  ],
171
202
  },
172
203
  builtin: ['https'],
173
- root: dirNamePath,
204
+ root: rootPaths,
174
205
  import: [
175
206
  'lodash',
176
207
  'performance-now',
@@ -179,6 +210,7 @@ const initiateNodeVM = (dirNamePath) => {
179
210
  'he',
180
211
  'zudello-integration-sdk-v1',
181
212
  ],
213
+ resolve: createCustomResolver(sdkOverridePath),
182
214
  mock: {
183
215
  fs: {
184
216
  readFileSync() {