zudello-execute-local 1.1.44 → 1.1.45
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 +2 -2
- package/src/utils/nodeVM.js +31 -18
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zudello-execute-local",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.45",
|
|
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.
|
|
32
|
+
"zudello-integration-sdk-v1": "1.0.91"
|
|
33
33
|
},
|
|
34
34
|
"overrides": {
|
|
35
35
|
"e2b": {
|
package/src/utils/nodeVM.js
CHANGED
|
@@ -2,25 +2,22 @@ const { NodeVM, makeResolverFromLegacyOptions } = require('vm2')
|
|
|
2
2
|
const path = require('path')
|
|
3
3
|
const fs = require('fs')
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const createSdkMock = (sdkOverridePath) => {
|
|
6
6
|
if (!sdkOverridePath) {
|
|
7
|
-
return
|
|
7
|
+
return {}
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
const absoluteSdkPath = path.resolve(sdkOverridePath)
|
|
11
11
|
|
|
12
12
|
if (!fs.existsSync(absoluteSdkPath)) {
|
|
13
13
|
console.warn(`[WARN] INTEGRATION_SDK_PATH does not exist: ${absoluteSdkPath}`)
|
|
14
|
-
return
|
|
14
|
+
return {}
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
console.log(`[INFO] Using SDK override path: ${absoluteSdkPath}`)
|
|
18
18
|
|
|
19
|
-
return
|
|
20
|
-
|
|
21
|
-
return absoluteSdkPath
|
|
22
|
-
}
|
|
23
|
-
return undefined
|
|
19
|
+
return {
|
|
20
|
+
'zudello-integration-sdk-v1': require(absoluteSdkPath)
|
|
24
21
|
}
|
|
25
22
|
}
|
|
26
23
|
|
|
@@ -173,17 +170,17 @@ const connectionSdkMapping = {
|
|
|
173
170
|
variable: 'SunSystems',
|
|
174
171
|
class: 'SunSystemsSDK',
|
|
175
172
|
isExternal: true
|
|
176
|
-
}]
|
|
173
|
+
}],
|
|
174
|
+
unleashed: [{
|
|
175
|
+
variable: 'Unleashed',
|
|
176
|
+
class: 'UnleashedSDK',
|
|
177
|
+
isExternal: true
|
|
178
|
+
}],
|
|
177
179
|
}
|
|
178
180
|
|
|
179
181
|
const initiateNodeVM = (dirNamePath) => {
|
|
180
182
|
const sdkOverridePath = process.env.INTEGRATION_SDK_PATH
|
|
181
183
|
|
|
182
|
-
const rootPaths = [dirNamePath]
|
|
183
|
-
if (sdkOverridePath) {
|
|
184
|
-
rootPaths.push(path.resolve(sdkOverridePath))
|
|
185
|
-
}
|
|
186
|
-
|
|
187
184
|
return new NodeVM({
|
|
188
185
|
console: 'inherit',
|
|
189
186
|
sandbox: {
|
|
@@ -201,7 +198,7 @@ const initiateNodeVM = (dirNamePath) => {
|
|
|
201
198
|
],
|
|
202
199
|
},
|
|
203
200
|
builtin: ['https'],
|
|
204
|
-
root:
|
|
201
|
+
root: [dirNamePath],
|
|
205
202
|
import: [
|
|
206
203
|
'lodash',
|
|
207
204
|
'performance-now',
|
|
@@ -210,8 +207,8 @@ const initiateNodeVM = (dirNamePath) => {
|
|
|
210
207
|
'he',
|
|
211
208
|
'zudello-integration-sdk-v1',
|
|
212
209
|
],
|
|
213
|
-
resolve: createCustomResolver(sdkOverridePath),
|
|
214
210
|
mock: {
|
|
211
|
+
...createSdkMock(sdkOverridePath),
|
|
215
212
|
fs: {
|
|
216
213
|
readFileSync() {
|
|
217
214
|
return 'Nice try!'
|
|
@@ -240,7 +237,8 @@ const runScript = async (handler, source, object, loggerMode, dirNamePath, dirNa
|
|
|
240
237
|
|
|
241
238
|
const classesInUse = [
|
|
242
239
|
'Logger', 'Message', 'Metadata', 'Tags', 'AI', 'FileBucket', 'EDIBucket', 'Trigger', 'Properties', 'MiscHelper',
|
|
243
|
-
'ModelHelper', 'DatasetHelper', 'S3Client', 'Auth', 'ZudelloSDK', 'ZudelloAuthSDK', 'ZudelloStoreSDK'
|
|
240
|
+
'ModelHelper', 'DatasetHelper', 'S3Client', 'Auth', 'ZudelloSDK', 'ZudelloAuthSDK', 'ZudelloStoreSDK',
|
|
241
|
+
'ClickHouse', 'Checkpoint'
|
|
244
242
|
]
|
|
245
243
|
|
|
246
244
|
const initAuth = `
|
|
@@ -301,6 +299,7 @@ const runScript = async (handler, source, object, loggerMode, dirNamePath, dirNa
|
|
|
301
299
|
let File
|
|
302
300
|
let EDI
|
|
303
301
|
let triggerNode
|
|
302
|
+
let clickhouse
|
|
304
303
|
|
|
305
304
|
if (auth) {
|
|
306
305
|
message = new Message(auth.getApiInstance(), auth.teamUUID)
|
|
@@ -308,8 +307,22 @@ const runScript = async (handler, source, object, loggerMode, dirNamePath, dirNa
|
|
|
308
307
|
File = new FileBucket(auth.getApiInstance(), auth.teamUUID)
|
|
309
308
|
EDI = new EDIBucket(auth.getApiInstance(), auth.teamUUID)
|
|
310
309
|
triggerNode = new Trigger(auth.getApiInstance(), auth.teamUUID)
|
|
310
|
+
clickhouse = new ClickHouse(auth.getApiInstance(), auth.teamUUID)
|
|
311
|
+
metadata.init({
|
|
312
|
+
apiInstance: auth.getApiInstance(),
|
|
313
|
+
apiURL: '${authData.api_url}',
|
|
314
|
+
teamUUID: auth.teamUUID,
|
|
315
|
+
triggerUUID: ${process.env.TRIGGER_UUID ? `'${process.env.TRIGGER_UUID}'` : 'null'},
|
|
316
|
+
connectionUUID: ${externalConnectionUUID ? `'${externalConnectionUUID}'` : 'null'}
|
|
317
|
+
})
|
|
311
318
|
}
|
|
312
319
|
|
|
320
|
+
const checkpoint = new Checkpoint({
|
|
321
|
+
logger,
|
|
322
|
+
metadata,
|
|
323
|
+
s3Config: {}
|
|
324
|
+
})
|
|
325
|
+
|
|
313
326
|
${source}
|
|
314
327
|
|
|
315
328
|
const startTime = now()
|
|
@@ -359,4 +372,4 @@ const runScript = async (handler, source, object, loggerMode, dirNamePath, dirNa
|
|
|
359
372
|
|
|
360
373
|
module.exports = {
|
|
361
374
|
runScript
|
|
362
|
-
}
|
|
375
|
+
}
|