@sasjs/adapter 4.19.4 → 5.1.0
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/ContextManager.js +290 -0
- package/DISCLOSURE +45 -0
- package/README.md +1 -1
- package/SAS9ApiClient.d.ts +1 -1
- package/SAS9ApiClient.js +90 -0
- package/SASViyaApiClient.js +918 -0
- package/SASjs.js +794 -0
- package/SASjsApiClient.d.ts +1 -0
- package/SASjsApiClient.js +132 -0
- package/SessionManager.js +353 -0
- package/api/viya/executeOnComputeApi.js +198 -0
- package/api/viya/getFileStream.js +32 -0
- package/api/viya/pollJobState.js +247 -0
- package/api/viya/saveLog.js +45 -0
- package/api/viya/uploadTables.js +45 -0
- package/api/viya/writeStream.js +25 -0
- package/auth/AuthManager.js +305 -0
- package/auth/getAccessTokenForSasjs.js +43 -0
- package/auth/getAccessTokenForViya.js +54 -0
- package/auth/getTokenRequestErrorPrefix.js +70 -0
- package/auth/getTokens.js +110 -0
- package/auth/index.js +20 -0
- package/auth/isAuthorizeFormRequired.js +7 -0
- package/auth/isLoginRequired.js +9 -0
- package/auth/loginHeader.js +87 -0
- package/auth/openWebPage.js +31 -0
- package/auth/refreshTokensForSasjs.js +42 -0
- package/auth/refreshTokensForViya.js +53 -0
- package/auth/verifySas9Login.js +32 -0
- package/auth/verifySasViyaLogin.js +44 -0
- package/dist/minified_sas9.js +10892 -0
- package/dist/sasjs-adapter.js +19569 -0
- package/file/generateFileUploadForm.js +43 -0
- package/file/generateTableUploadForm.js +38 -0
- package/index.js +9 -80376
- package/job-execution/ComputeJobExecutor.js +55 -0
- package/job-execution/FileUploader.js +114 -0
- package/job-execution/JesJobExecutor.js +55 -0
- package/job-execution/JobExecutor.js +40 -0
- package/job-execution/Sas9JobExecutor.d.ts +1 -1
- package/job-execution/Sas9JobExecutor.js +115 -0
- package/job-execution/SasjsJobExecutor.js +100 -0
- package/job-execution/WebJobExecutor.js +254 -0
- package/job-execution/index.js +23 -0
- package/minified/sas9/SASjs.js +198 -0
- package/minified/sas9/WebJobExecutor.js +105 -0
- package/minified/sas9/index.js +22 -0
- package/node/index.d.ts +2 -9
- package/node/index.js +1 -30570
- package/package.json +40 -14
- package/request/RequestClient.d.ts +1 -1
- package/request/RequestClient.js +717 -0
- package/request/Sas9RequestClient.d.ts +1 -1
- package/request/Sas9RequestClient.js +121 -0
- package/request/SasjsRequestClient.js +77 -0
- package/types/Context.js +2 -0
- package/types/CsrfToken.js +2 -0
- package/types/ExecuteScript.js +2 -0
- package/types/File.js +2 -0
- package/types/FileResource.js +2 -0
- package/types/Folder.js +2 -0
- package/types/Job.js +2 -0
- package/types/JobDefinition.js +2 -0
- package/types/JobResult.js +2 -0
- package/types/Link.js +2 -0
- package/types/LogStatistics.js +2 -0
- package/types/Login.js +2 -0
- package/types/PollOptions.js +2 -0
- package/types/RequestClient.js +2 -0
- package/types/SASjsConfig.d.ts +1 -1
- package/types/SASjsConfig.js +91 -0
- package/types/Session.js +14 -0
- package/types/Tables.js +28 -0
- package/types/UploadFile.js +2 -0
- package/types/WriteStream.d.ts +1 -1
- package/types/WriteStream.js +2 -0
- package/types/errors/ArgumentError.js +12 -0
- package/types/errors/AuthorizeError.js +13 -0
- package/types/errors/CertificateError.js +12 -0
- package/types/errors/ComputeJobExecutionError.js +13 -0
- package/types/errors/ErrorResponse.js +23 -0
- package/types/errors/InternalServerError.js +11 -0
- package/types/errors/InvalidJsonError.js +11 -0
- package/types/errors/InvalidSASjsCsrfError.js +12 -0
- package/types/errors/JobExecutionError.js +14 -0
- package/types/errors/JobStatePollError.js +12 -0
- package/types/errors/JsonParseArrayError.js +11 -0
- package/types/errors/LoginRequiredError.js +14 -0
- package/types/errors/NoSessionStateError.js +14 -0
- package/types/errors/NotFoundError.js +12 -0
- package/types/errors/RootFolderNotFoundError.js +22 -0
- package/types/errors/SAS9AuthError.js +11 -0
- package/types/errors/WeboutResponseError.js +12 -0
- package/types/errors/index.js +31 -0
- package/types/index.js +34 -0
- package/utils/appendExtraResponseAttributes.js +25 -0
- package/utils/asyncForEach.js +20 -0
- package/utils/compareTimestamps.js +11 -0
- package/utils/convertToCsv.js +154 -0
- package/utils/createAxiosInstance.d.ts +1 -1
- package/utils/createAxiosInstance.js +9 -0
- package/utils/delay.js +5 -0
- package/{src/utils/extractWeboutBlob.ts → utils/extractWeboutBlob.js} +19 -20
- package/utils/fetchLogByChunks.js +56 -0
- package/utils/formatDataForRequest.js +39 -0
- package/utils/getFormData.js +10 -0
- package/{node/utils/getUserLanguage.d.ts → utils/getUserLanguage.js} +5 -1
- package/utils/getValidJson.js +27 -0
- package/utils/host.d.ts +24 -0
- package/utils/host.js +36 -0
- package/utils/index.js +41 -0
- package/utils/isIeOrEdge.js +30 -0
- package/utils/isNode.js +7 -0
- package/utils/isRelativePath.js +5 -0
- package/utils/isUri.js +9 -0
- package/utils/isUrl.js +20 -0
- package/utils/loginPrompt/index.js +180 -0
- package/utils/needsRetry.js +14 -0
- package/utils/parseGeneratedCode.js +10 -0
- package/utils/parseSasViyaLog.js +17 -0
- package/utils/parseSourceCode.js +9 -0
- package/utils/parseViyaDebugResponse.js +46 -0
- package/utils/parseViyaLogDebugResponse.js +32 -0
- package/utils/parseWeboutResponse.js +22 -0
- package/utils/sas9/extractUserLongNameSas9.js +30 -0
- package/utils/serialize.js +20 -0
- package/utils/splitChunks.js +13 -0
- package/utils/validateInput.js +83 -0
- package/.env.example +0 -2
- package/.git-hooks/commit-msg +0 -39
- package/.git-hooks/pre-commit +0 -12
- package/.gitattributes +0 -1
- package/.pre-commit-config.yaml +0 -25
- package/.vscode/settings.json +0 -3
- package/SASViyaApiClient.spec.d.ts +0 -1
- package/__mocks__/axios.d.ts +0 -3
- package/api/viya/spec/executeScript.spec.d.ts +0 -1
- package/api/viya/spec/getFileStream.spec.d.ts +0 -1
- package/api/viya/spec/mockResponses.d.ts +0 -10
- package/api/viya/spec/pollJobState.spec.d.ts +0 -1
- package/api/viya/spec/saveLog.spec.d.ts +0 -1
- package/api/viya/spec/uploadTables.spec.d.ts +0 -1
- package/api/viya/spec/writeStream.spec.d.ts +0 -1
- package/auth/spec/AuthManager.spec.d.ts +0 -4
- package/auth/spec/getAccessTokenForSasjs.spec.d.ts +0 -1
- package/auth/spec/getAccessTokenForViya.spec.d.ts +0 -1
- package/auth/spec/getTokenRequestErrorPrefix.spec.d.ts +0 -1
- package/auth/spec/getTokens.spec.d.ts +0 -1
- package/auth/spec/loginHeader.spec.d.ts +0 -4
- package/auth/spec/mockResponses.d.ts +0 -23
- package/auth/spec/openWebPage.spec.d.ts +0 -1
- package/auth/spec/refreshTokensForSasjs.spec.d.ts +0 -1
- package/auth/spec/refreshTokensForViya.spec.d.ts +0 -1
- package/auth/spec/verifySas9Login.spec.d.ts +0 -1
- package/auth/spec/verifySasViyaLogin.spec.d.ts +0 -1
- package/createTSDocs.js +0 -35
- package/cypress.config.js +0 -18
- package/example.html +0 -109
- package/file/spec/generateFileUploadForm.spec.d.ts +0 -1
- package/file/spec/generateTableUploadForm.spec.d.ts +0 -1
- package/index-dev.js +0 -80394
- package/job-execution/spec/ComputeJobExecutor.spec.d.ts +0 -1
- package/job-execution/spec/JesJobExecutor.spec.d.ts +0 -1
- package/job-execution/spec/Sas9JobExecutor.spec.d.ts +0 -1
- package/job-execution/spec/SasjsJobExecutor.spec.d.ts +0 -1
- package/job-execution/spec/WebJobExecutor.debug.spec.d.ts +0 -1
- package/job-execution/spec/WebJobExecutor.spec.d.ts +0 -1
- package/job-execution/spec/executionTasks.spec.d.ts +0 -1
- package/minified_sas9.js +0 -14039
- package/node/ContextManager.d.ts +0 -41
- package/node/SAS9ApiClient.d.ts +0 -30
- package/node/SASViyaApiClient.d.ts +0 -298
- package/node/SASjs.d.ts +0 -387
- package/node/SASjsApiClient.d.ts +0 -65
- package/node/SessionManager.d.ts +0 -115
- package/node/api/viya/executeOnComputeApi.d.ts +0 -21
- package/node/api/viya/getFileStream.d.ts +0 -2
- package/node/api/viya/pollJobState.d.ts +0 -57
- package/node/api/viya/saveLog.d.ts +0 -15
- package/node/api/viya/uploadTables.d.ts +0 -13
- package/node/api/viya/writeStream.d.ts +0 -2
- package/node/auth/AuthManager.d.ts +0 -49
- package/node/auth/getAccessTokenForSasjs.d.ts +0 -11
- package/node/auth/getAccessTokenForViya.d.ts +0 -10
- package/node/auth/getTokenRequestErrorPrefix.d.ts +0 -44
- package/node/auth/getTokens.d.ts +0 -22
- package/node/auth/index.d.ts +0 -4
- package/node/auth/isAuthorizeFormRequired.d.ts +0 -1
- package/node/auth/isLoginRequired.d.ts +0 -1
- package/node/auth/loginHeader.d.ts +0 -17
- package/node/auth/openWebPage.d.ts +0 -6
- package/node/auth/refreshTokensForSasjs.d.ts +0 -10
- package/node/auth/refreshTokensForViya.d.ts +0 -11
- package/node/auth/verifySas9Login.d.ts +0 -3
- package/node/auth/verifySasViyaLogin.d.ts +0 -4
- package/node/file/generateFileUploadForm.d.ts +0 -11
- package/node/file/generateTableUploadForm.d.ts +0 -5
- package/node/job-execution/ComputeJobExecutor.d.ts +0 -8
- package/node/job-execution/FileUploader.d.ts +0 -9
- package/node/job-execution/JesJobExecutor.d.ts +0 -9
- package/node/job-execution/JobExecutor.d.ts +0 -17
- package/node/job-execution/Sas9JobExecutor.d.ts +0 -19
- package/node/job-execution/SasjsJobExecutor.d.ts +0 -9
- package/node/job-execution/WebJobExecutor.d.ts +0 -18
- package/node/job-execution/index.d.ts +0 -7
- package/node/request/RequestClient.d.ts +0 -125
- package/node/request/Sas9RequestClient.d.ts +0 -25
- package/node/request/SasjsRequestClient.d.ts +0 -12
- package/node/types/Context.d.ts +0 -42
- package/node/types/CsrfToken.d.ts +0 -4
- package/node/types/ExecuteScript.d.ts +0 -4
- package/node/types/File.d.ts +0 -7
- package/node/types/FileResource.d.ts +0 -32
- package/node/types/Folder.d.ts +0 -7
- package/node/types/Job.d.ts +0 -14
- package/node/types/JobDefinition.d.ts +0 -3
- package/node/types/JobResult.d.ts +0 -3
- package/node/types/Link.d.ts +0 -7
- package/node/types/LogStatistics.d.ts +0 -4
- package/node/types/Login.d.ts +0 -14
- package/node/types/PollOptions.d.ts +0 -8
- package/node/types/RequestClient.d.ts +0 -46
- package/node/types/SASjsConfig.d.ts +0 -94
- package/node/types/Session.d.ts +0 -30
- package/node/types/Tables.d.ts +0 -7
- package/node/types/UploadFile.d.ts +0 -8
- package/node/types/WriteStream.d.ts +0 -7
- package/node/types/errors/ArgumentError.d.ts +0 -4
- package/node/types/errors/AuthorizeError.d.ts +0 -5
- package/node/types/errors/CertificateError.d.ts +0 -3
- package/node/types/errors/ComputeJobExecutionError.d.ts +0 -6
- package/node/types/errors/ErrorResponse.d.ts +0 -9
- package/node/types/errors/InternalServerError.d.ts +0 -3
- package/node/types/errors/InvalidJsonError.d.ts +0 -3
- package/node/types/errors/InvalidSASjsCsrfError.d.ts +0 -3
- package/node/types/errors/JobExecutionError.d.ts +0 -6
- package/node/types/errors/JobStatePollError.d.ts +0 -4
- package/node/types/errors/JsonParseArrayError.d.ts +0 -3
- package/node/types/errors/LoginRequiredError.d.ts +0 -3
- package/node/types/errors/NoSessionStateError.d.ts +0 -6
- package/node/types/errors/NotFoundError.d.ts +0 -4
- package/node/types/errors/RootFolderNotFoundError.d.ts +0 -3
- package/node/types/errors/SAS9AuthError.d.ts +0 -3
- package/node/types/errors/WeboutResponseError.d.ts +0 -4
- package/node/types/errors/index.d.ts +0 -15
- package/node/types/index.d.ts +0 -18
- package/node/utils/appendExtraResponseAttributes.d.ts +0 -2
- package/node/utils/asyncForEach.d.ts +0 -1
- package/node/utils/compareTimestamps.d.ts +0 -6
- package/node/utils/convertToCsv.d.ts +0 -12
- package/node/utils/createAxiosInstance.d.ts +0 -2
- package/node/utils/delay.d.ts +0 -1
- package/node/utils/extractWeboutBlob.d.ts +0 -13
- package/node/utils/fetchLogByChunks.d.ts +0 -20
- package/node/utils/formatDataForRequest.d.ts +0 -1
- package/node/utils/getFormData.d.ts +0 -2
- package/node/utils/getValidJson.d.ts +0 -5
- package/node/utils/index.d.ts +0 -25
- package/node/utils/isNode.d.ts +0 -1
- package/node/utils/isRelativePath.d.ts +0 -1
- package/node/utils/isUri.d.ts +0 -5
- package/node/utils/isUrl.d.ts +0 -5
- package/node/utils/loginPrompt/index.d.ts +0 -1
- package/node/utils/needsRetry.d.ts +0 -1
- package/node/utils/parseGeneratedCode.d.ts +0 -1
- package/node/utils/parseSasViyaLog.d.ts +0 -5
- package/node/utils/parseSourceCode.d.ts +0 -1
- package/node/utils/parseViyaDebugResponse.d.ts +0 -12
- package/node/utils/parseViyaLogDebugResponse.d.ts +0 -8
- package/node/utils/parseWeboutResponse.d.ts +0 -1
- package/node/utils/sas9/extractUserLongNameSas9.d.ts +0 -6
- package/node/utils/serialize.d.ts +0 -1
- package/node/utils/splitChunks.d.ts +0 -1
- package/node/utils/validateInput.d.ts +0 -14
- package/request/spec/SasjsRequestClient.spec.d.ts +0 -1
- package/screenshots/session-manager-first-request.png +0 -0
- package/screenshots/subsequent-session-request.png +0 -0
- package/spec/SAS9ApiClient.spec.d.ts +0 -1
- package/spec/SASjs.startComputeJob.spec.d.ts +0 -1
- package/spec/SASjsApiClient.spec.d.ts +0 -1
- package/src/ContextManager.ts +0 -454
- package/src/SAS9ApiClient.ts +0 -100
- package/src/SASViyaApiClient.ts +0 -1417
- package/src/SASjs.ts +0 -1268
- package/src/SASjsApiClient.ts +0 -177
- package/src/SessionManager.ts +0 -465
- package/src/__mocks__/axios.ts +0 -7
- package/src/api/viya/executeOnComputeApi.ts +0 -307
- package/src/api/viya/getFileStream.ts +0 -17
- package/src/api/viya/pollJobState.ts +0 -393
- package/src/api/viya/saveLog.ts +0 -55
- package/src/api/viya/spec/mockResponses.ts +0 -75
- package/src/api/viya/uploadTables.ts +0 -41
- package/src/api/viya/writeStream.ts +0 -16
- package/src/auth/AuthManager.ts +0 -387
- package/src/auth/getAccessTokenForSasjs.ts +0 -48
- package/src/auth/getAccessTokenForViya.ts +0 -61
- package/src/auth/getTokenRequestErrorPrefix.ts +0 -88
- package/src/auth/getTokens.ts +0 -127
- package/src/auth/index.ts +0 -4
- package/src/auth/isAuthorizeFormRequired.ts +0 -3
- package/src/auth/isLoginRequired.ts +0 -5
- package/src/auth/loginHeader.ts +0 -97
- package/src/auth/openWebPage.ts +0 -40
- package/src/auth/refreshTokensForSasjs.ts +0 -45
- package/src/auth/refreshTokensForViya.ts +0 -66
- package/src/auth/spec/mockResponses.ts +0 -53
- package/src/auth/verifySas9Login.ts +0 -25
- package/src/auth/verifySasViyaLogin.ts +0 -43
- package/src/file/generateFileUploadForm.ts +0 -48
- package/src/file/generateTableUploadForm.ts +0 -50
- package/src/index.ts +0 -9
- package/src/job-execution/ComputeJobExecutor.ts +0 -76
- package/src/job-execution/FileUploader.ts +0 -152
- package/src/job-execution/JesJobExecutor.ts +0 -78
- package/src/job-execution/JobExecutor.ts +0 -63
- package/src/job-execution/Sas9JobExecutor.ts +0 -137
- package/src/job-execution/SasjsJobExecutor.ts +0 -152
- package/src/job-execution/WebJobExecutor.ts +0 -341
- package/src/job-execution/index.ts +0 -7
- package/src/minified/sas9/SASjs.ts +0 -274
- package/src/minified/sas9/WebJobExecutor.ts +0 -156
- package/src/minified/sas9/index.ts +0 -3
- package/src/request/RequestClient.ts +0 -941
- package/src/request/Sas9RequestClient.ts +0 -132
- package/src/request/SasjsRequestClient.ts +0 -82
- package/src/test/SAS_server_app.ts +0 -47
- package/src/types/Context.ts +0 -39
- package/src/types/CsrfToken.ts +0 -4
- package/src/types/ExecuteScript.ts +0 -4
- package/src/types/File.ts +0 -8
- package/src/types/FileResource.ts +0 -33
- package/src/types/Folder.ts +0 -8
- package/src/types/Job.ts +0 -15
- package/src/types/JobDefinition.ts +0 -3
- package/src/types/JobResult.ts +0 -3
- package/src/types/Link.ts +0 -7
- package/src/types/LogStatistics.ts +0 -4
- package/src/types/Login.ts +0 -15
- package/src/types/PollOptions.ts +0 -9
- package/src/types/Process.d.ts +0 -5
- package/src/types/RequestClient.ts +0 -55
- package/src/types/SASjsConfig.ts +0 -95
- package/src/types/Session.ts +0 -34
- package/src/types/Tables.ts +0 -29
- package/src/types/UploadFile.ts +0 -8
- package/src/types/WriteStream.ts +0 -10
- package/src/types/errors/ArgumentError.ts +0 -7
- package/src/types/errors/AuthorizeError.ts +0 -10
- package/src/types/errors/CertificateError.ts +0 -12
- package/src/types/errors/ComputeJobExecutionError.ts +0 -12
- package/src/types/errors/ErrorResponse.ts +0 -28
- package/src/types/errors/InternalServerError.ts +0 -9
- package/src/types/errors/InvalidJsonError.ts +0 -7
- package/src/types/errors/InvalidSASjsCsrfError.ts +0 -9
- package/src/types/errors/JobExecutionError.ts +0 -11
- package/src/types/errors/JobStatePollError.ts +0 -14
- package/src/types/errors/JsonParseArrayError.ts +0 -7
- package/src/types/errors/LoginRequiredError.ts +0 -11
- package/src/types/errors/NoSessionStateError.ts +0 -15
- package/src/types/errors/NotFoundError.ts +0 -7
- package/src/types/errors/RootFolderNotFoundError.ts +0 -24
- package/src/types/errors/SAS9AuthError.ts +0 -9
- package/src/types/errors/WeboutResponseError.ts +0 -7
- package/src/types/errors/index.ts +0 -15
- package/src/types/index.ts +0 -18
- package/src/types/system/global.d.ts +0 -1
- package/src/utils/appendExtraResponseAttributes.ts +0 -22
- package/src/utils/asyncForEach.ts +0 -5
- package/src/utils/compareTimestamps.ts +0 -9
- package/src/utils/convertToCsv.ts +0 -198
- package/src/utils/createAxiosInstance.ts +0 -7
- package/src/utils/delay.ts +0 -2
- package/src/utils/fetchLogByChunks.ts +0 -63
- package/src/utils/formatDataForRequest.ts +0 -48
- package/src/utils/getFormData.ts +0 -5
- package/src/utils/getUserLanguage.ts +0 -10
- package/src/utils/getValidJson.ts +0 -23
- package/src/utils/index.ts +0 -25
- package/src/utils/isIeOrEdge.ts +0 -34
- package/src/utils/isNode.ts +0 -4
- package/src/utils/isRelativePath.ts +0 -2
- package/src/utils/isUri.ts +0 -5
- package/src/utils/isUrl.ts +0 -17
- package/src/utils/loginPrompt/index.ts +0 -177
- package/src/utils/needsRetry.ts +0 -14
- package/src/utils/parseGeneratedCode.ts +0 -7
- package/src/utils/parseSasViyaLog.ts +0 -12
- package/src/utils/parseSourceCode.ts +0 -6
- package/src/utils/parseViyaDebugResponse.ts +0 -46
- package/src/utils/parseViyaLogDebugResponse.ts +0 -22
- package/src/utils/parseWeboutResponse.ts +0 -20
- package/src/utils/sas9/extractUserLongNameSas9.ts +0 -31
- package/src/utils/serialize.ts +0 -15
- package/src/utils/splitChunks.ts +0 -12
- package/src/utils/validateInput.ts +0 -93
- package/test/ContextManager.spec.d.ts +0 -1
- package/test/FileUploader.spec.d.ts +0 -4
- package/test/FolderOperations.spec.d.ts +0 -1
- package/test/RequestClient.spec.d.ts +0 -1
- package/test/SAS_server_app.d.ts +0 -10
- package/test/SessionManager.spec.d.ts +0 -1
- package/test/getJobsInFolder.spec.d.ts +0 -1
- package/test/utils/formatDataForRequest.spec.d.ts +0 -1
- package/test/utils/getValidJson.spec.d.ts +0 -1
- package/test/utils/isUrl.spec.d.ts +0 -1
- package/test/utils/parseGeneratedCode.spec.d.ts +0 -1
- package/test/utils/parseSourceCode.spec.d.ts +0 -1
- package/types/Tables.spec.d.ts +0 -1
- package/types/errors/RootFolderNotFoundError.spec.d.ts +0 -1
- package/types/errors/spec/SAS9AuthError.spec.d.ts +0 -1
- package/utils/spec/convertToCsv.spec.d.ts +0 -1
- package/utils/spec/extractUserLongNameSas9.spec.d.ts +0 -1
- package/utils/spec/getFormData.spec.d.ts +0 -1
- package/utils/spec/parseSasViyaLog.spec.d.ts +0 -1
- package/utils/spec/parseViyaDebugResponse.spec.d.ts +0 -1
- package/utils/spec/parseViyaLogDebugResponse.spec.d.ts +0 -1
- package/utils/spec/validateInput.spec.d.ts +0 -1
package/src/ContextManager.ts
DELETED
|
@@ -1,454 +0,0 @@
|
|
|
1
|
-
import { Context, EditContextInput, ContextAllAttributes } from './types'
|
|
2
|
-
import { isUrl } from './utils'
|
|
3
|
-
import { prefixMessage } from '@sasjs/utils/error'
|
|
4
|
-
import { RequestClient } from './request/RequestClient'
|
|
5
|
-
import { AuthConfig } from '@sasjs/utils/types'
|
|
6
|
-
|
|
7
|
-
export class ContextManager {
|
|
8
|
-
private defaultComputeContexts = [
|
|
9
|
-
'CAS Formats service compute context',
|
|
10
|
-
'Data Mining compute context',
|
|
11
|
-
'Import 9 service compute context',
|
|
12
|
-
'SAS Job Execution compute context',
|
|
13
|
-
'SAS Model Manager compute context',
|
|
14
|
-
'SAS Studio compute context',
|
|
15
|
-
'SAS Visual Forecasting compute context'
|
|
16
|
-
]
|
|
17
|
-
private defaultLauncherContexts = [
|
|
18
|
-
'CAS Formats service launcher context',
|
|
19
|
-
'Data Mining launcher context',
|
|
20
|
-
'Import 9 service launcher context',
|
|
21
|
-
'Job Flow Execution launcher context',
|
|
22
|
-
'SAS Job Execution launcher context',
|
|
23
|
-
'SAS Model Manager launcher context',
|
|
24
|
-
'SAS Studio launcher context',
|
|
25
|
-
'SAS Visual Forecasting launcher context'
|
|
26
|
-
]
|
|
27
|
-
|
|
28
|
-
get getDefaultComputeContexts() {
|
|
29
|
-
return this.defaultComputeContexts
|
|
30
|
-
}
|
|
31
|
-
get getDefaultLauncherContexts() {
|
|
32
|
-
return this.defaultLauncherContexts
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
constructor(
|
|
36
|
-
private serverUrl: string,
|
|
37
|
-
private requestClient: RequestClient
|
|
38
|
-
) {
|
|
39
|
-
if (serverUrl) isUrl(serverUrl)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
public async getComputeContexts(accessToken?: string) {
|
|
43
|
-
const { result: contexts } = await this.requestClient
|
|
44
|
-
.get<{
|
|
45
|
-
items: Context[]
|
|
46
|
-
}>(`${this.serverUrl}/compute/contexts?limit=10000`, accessToken)
|
|
47
|
-
.catch((err) => {
|
|
48
|
-
throw prefixMessage(err, 'Error while getting compute contexts. ')
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
const contextsList = contexts && contexts.items ? contexts.items : []
|
|
52
|
-
|
|
53
|
-
return contextsList.map((context: any) => ({
|
|
54
|
-
createdBy: context.createdBy,
|
|
55
|
-
id: context.id,
|
|
56
|
-
name: context.name,
|
|
57
|
-
version: context.version,
|
|
58
|
-
attributes: {}
|
|
59
|
-
}))
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
public async getLauncherContexts(accessToken?: string) {
|
|
63
|
-
const { result: contexts } = await this.requestClient
|
|
64
|
-
.get<{
|
|
65
|
-
items: Context[]
|
|
66
|
-
}>(`${this.serverUrl}/launcher/contexts?limit=10000`, accessToken)
|
|
67
|
-
.catch((err) => {
|
|
68
|
-
throw prefixMessage(err, 'Error while getting launcher contexts. ')
|
|
69
|
-
})
|
|
70
|
-
|
|
71
|
-
const contextsList = contexts && contexts.items ? contexts.items : []
|
|
72
|
-
|
|
73
|
-
return contextsList.map((context: any) => ({
|
|
74
|
-
createdBy: context.createdBy,
|
|
75
|
-
id: context.id,
|
|
76
|
-
name: context.name,
|
|
77
|
-
version: context.version,
|
|
78
|
-
attributes: {}
|
|
79
|
-
}))
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
public async createComputeContext(
|
|
83
|
-
contextName: string,
|
|
84
|
-
launchContextName: string,
|
|
85
|
-
sharedAccountId: string,
|
|
86
|
-
autoExecLines: string[],
|
|
87
|
-
accessToken?: string,
|
|
88
|
-
authorizedUsers?: string[]
|
|
89
|
-
) {
|
|
90
|
-
this.validateContextName(contextName)
|
|
91
|
-
|
|
92
|
-
this.isDefaultContext(
|
|
93
|
-
contextName,
|
|
94
|
-
this.defaultComputeContexts,
|
|
95
|
-
`Compute context '${contextName}' already exists.`
|
|
96
|
-
)
|
|
97
|
-
|
|
98
|
-
const existingComputeContexts = await this.getComputeContexts(accessToken)
|
|
99
|
-
|
|
100
|
-
if (
|
|
101
|
-
existingComputeContexts.find((context) => context.name === contextName)
|
|
102
|
-
) {
|
|
103
|
-
throw new Error(`Compute context '${contextName}' already exists.`)
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
if (launchContextName) {
|
|
107
|
-
if (!this.defaultLauncherContexts.includes(launchContextName)) {
|
|
108
|
-
const launcherContexts = await this.getLauncherContexts(accessToken)
|
|
109
|
-
|
|
110
|
-
if (
|
|
111
|
-
!launcherContexts.find(
|
|
112
|
-
(context) => context.name === launchContextName
|
|
113
|
-
)
|
|
114
|
-
) {
|
|
115
|
-
const description = `The launcher context for ${launchContextName}`
|
|
116
|
-
const launchType = 'direct'
|
|
117
|
-
|
|
118
|
-
const newLauncherContext = await this.createLauncherContext(
|
|
119
|
-
launchContextName,
|
|
120
|
-
description,
|
|
121
|
-
launchType,
|
|
122
|
-
accessToken
|
|
123
|
-
).catch((err) => {
|
|
124
|
-
throw new Error(`Error while creating launcher context. ${err}`)
|
|
125
|
-
})
|
|
126
|
-
|
|
127
|
-
if (newLauncherContext && newLauncherContext.name) {
|
|
128
|
-
launchContextName = newLauncherContext.name
|
|
129
|
-
} else {
|
|
130
|
-
throw new Error('Error while creating launcher context.')
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
const headers: any = {
|
|
137
|
-
'Content-Type': 'application/json'
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
if (accessToken) {
|
|
141
|
-
headers.Authorization = `Bearer ${accessToken}`
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
let attributes = { reuseServerProcesses: true } as object
|
|
145
|
-
|
|
146
|
-
if (sharedAccountId)
|
|
147
|
-
attributes = { ...attributes, runServerAs: sharedAccountId }
|
|
148
|
-
|
|
149
|
-
const requestBody: any = {
|
|
150
|
-
name: contextName,
|
|
151
|
-
launchContext: {
|
|
152
|
-
contextName: launchContextName || ''
|
|
153
|
-
},
|
|
154
|
-
attributes
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
if (authorizedUsers && authorizedUsers.length) {
|
|
158
|
-
requestBody['authorizedUsers'] = authorizedUsers
|
|
159
|
-
} else {
|
|
160
|
-
requestBody['authorizeAllAuthenticatedUsers'] = true
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
if (autoExecLines) {
|
|
164
|
-
requestBody.environment = { autoExecLines }
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
const { result: context } = await this.requestClient
|
|
168
|
-
.post<Context>(
|
|
169
|
-
`${this.serverUrl}/compute/contexts`,
|
|
170
|
-
requestBody,
|
|
171
|
-
accessToken
|
|
172
|
-
)
|
|
173
|
-
.catch((err) => {
|
|
174
|
-
throw prefixMessage(err, 'Error while creating compute context. ')
|
|
175
|
-
})
|
|
176
|
-
|
|
177
|
-
return context
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
public async createLauncherContext(
|
|
181
|
-
contextName: string,
|
|
182
|
-
description: string,
|
|
183
|
-
launchType = 'direct',
|
|
184
|
-
accessToken?: string
|
|
185
|
-
) {
|
|
186
|
-
if (!contextName) {
|
|
187
|
-
throw new Error('Context name is required.')
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
this.isDefaultContext(
|
|
191
|
-
contextName,
|
|
192
|
-
this.defaultLauncherContexts,
|
|
193
|
-
`Launcher context '${contextName}' already exists.`
|
|
194
|
-
)
|
|
195
|
-
|
|
196
|
-
const existingLauncherContexts = await this.getLauncherContexts(accessToken)
|
|
197
|
-
|
|
198
|
-
if (
|
|
199
|
-
existingLauncherContexts.find((context) => context.name === contextName)
|
|
200
|
-
) {
|
|
201
|
-
throw new Error(`Launcher context '${contextName}' already exists.`)
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
const headers: any = {
|
|
205
|
-
'Content-Type': 'application/json'
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
if (accessToken) {
|
|
209
|
-
headers.Authorization = `Bearer ${accessToken}`
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
const requestBody: any = {
|
|
213
|
-
name: contextName,
|
|
214
|
-
description: description,
|
|
215
|
-
launchType
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
const { result: context } = await this.requestClient
|
|
219
|
-
.post<Context>(
|
|
220
|
-
`${this.serverUrl}/launcher/contexts`,
|
|
221
|
-
requestBody,
|
|
222
|
-
accessToken
|
|
223
|
-
)
|
|
224
|
-
.catch((err) => {
|
|
225
|
-
throw prefixMessage(err, 'Error while creating launcher context. ')
|
|
226
|
-
})
|
|
227
|
-
|
|
228
|
-
return context
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
public async editComputeContext(
|
|
232
|
-
contextName: string,
|
|
233
|
-
editedContext: EditContextInput,
|
|
234
|
-
accessToken?: string
|
|
235
|
-
) {
|
|
236
|
-
this.validateContextName(contextName)
|
|
237
|
-
|
|
238
|
-
this.isDefaultContext(
|
|
239
|
-
contextName,
|
|
240
|
-
this.defaultComputeContexts,
|
|
241
|
-
'Editing default SAS compute contexts is not allowed.',
|
|
242
|
-
true
|
|
243
|
-
)
|
|
244
|
-
|
|
245
|
-
let originalContext
|
|
246
|
-
|
|
247
|
-
originalContext = await this.getComputeContextByName(
|
|
248
|
-
contextName,
|
|
249
|
-
accessToken
|
|
250
|
-
)
|
|
251
|
-
|
|
252
|
-
// Try to find context by id, when context name has been changed.
|
|
253
|
-
if (!originalContext) {
|
|
254
|
-
originalContext = await this.getComputeContextById(
|
|
255
|
-
editedContext.id!,
|
|
256
|
-
accessToken
|
|
257
|
-
)
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
const { result: context, etag } = await this.requestClient
|
|
261
|
-
.get<Context>(
|
|
262
|
-
`${this.serverUrl}/compute/contexts/${originalContext.id}`,
|
|
263
|
-
accessToken
|
|
264
|
-
)
|
|
265
|
-
.catch((err) => {
|
|
266
|
-
if (err && err.status === 404) {
|
|
267
|
-
throw new Error(
|
|
268
|
-
`The context '${contextName}' was not found on this server.`
|
|
269
|
-
)
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
throw err
|
|
273
|
-
})
|
|
274
|
-
|
|
275
|
-
// An If-Match header with the value of the last ETag for the context
|
|
276
|
-
// is required to be able to update it
|
|
277
|
-
// https://developer.sas.com/apis/rest/Compute/#update-a-context-definition
|
|
278
|
-
return await this.requestClient.put<Context>(
|
|
279
|
-
`/compute/contexts/${context.id}`,
|
|
280
|
-
{
|
|
281
|
-
...context,
|
|
282
|
-
...editedContext,
|
|
283
|
-
attributes: { ...context.attributes, ...editedContext.attributes }
|
|
284
|
-
},
|
|
285
|
-
accessToken,
|
|
286
|
-
{ 'If-Match': etag }
|
|
287
|
-
)
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
public async getComputeContextByName(
|
|
291
|
-
contextName: string,
|
|
292
|
-
accessToken?: string
|
|
293
|
-
): Promise<Context> {
|
|
294
|
-
const { result: contexts } = await this.requestClient
|
|
295
|
-
.get<{
|
|
296
|
-
items: Context[]
|
|
297
|
-
}>(
|
|
298
|
-
`${this.serverUrl}/compute/contexts?filter=eq(name, "${contextName}")`,
|
|
299
|
-
accessToken
|
|
300
|
-
)
|
|
301
|
-
.catch((err) => {
|
|
302
|
-
throw prefixMessage(
|
|
303
|
-
err,
|
|
304
|
-
'Error while getting compute context by name. '
|
|
305
|
-
)
|
|
306
|
-
})
|
|
307
|
-
|
|
308
|
-
if (!contexts || !(contexts.items && contexts.items.length)) {
|
|
309
|
-
throw new Error(
|
|
310
|
-
`The context '${contextName}' was not found at '${this.serverUrl}'.`
|
|
311
|
-
)
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
return contexts.items[0]
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
public async getComputeContextById(
|
|
318
|
-
contextId: string,
|
|
319
|
-
accessToken?: string
|
|
320
|
-
): Promise<ContextAllAttributes> {
|
|
321
|
-
const { result: context } = await this.requestClient
|
|
322
|
-
.get<ContextAllAttributes>(
|
|
323
|
-
`${this.serverUrl}/compute/contexts/${contextId}`,
|
|
324
|
-
accessToken
|
|
325
|
-
)
|
|
326
|
-
.catch((err) => {
|
|
327
|
-
throw prefixMessage(err, 'Error while getting compute context by id. ')
|
|
328
|
-
})
|
|
329
|
-
|
|
330
|
-
return context
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
public async getExecutableContexts(
|
|
334
|
-
executeScript: Function,
|
|
335
|
-
authConfig?: AuthConfig
|
|
336
|
-
) {
|
|
337
|
-
const { result: contexts } = await this.requestClient
|
|
338
|
-
.get<{
|
|
339
|
-
items: Context[]
|
|
340
|
-
}>(
|
|
341
|
-
`${this.serverUrl}/compute/contexts?limit=10000`,
|
|
342
|
-
authConfig?.access_token
|
|
343
|
-
)
|
|
344
|
-
.catch((err) => {
|
|
345
|
-
throw prefixMessage(err, 'Error while fetching compute contexts.')
|
|
346
|
-
})
|
|
347
|
-
|
|
348
|
-
const contextsList = contexts.items || []
|
|
349
|
-
const executableContexts: any[] = []
|
|
350
|
-
|
|
351
|
-
const promises = contextsList.map((context: any) => {
|
|
352
|
-
const linesOfCode = ['%put &=sysuserid;']
|
|
353
|
-
|
|
354
|
-
return () =>
|
|
355
|
-
executeScript(
|
|
356
|
-
`test-${context.name}`,
|
|
357
|
-
linesOfCode,
|
|
358
|
-
context.name,
|
|
359
|
-
authConfig,
|
|
360
|
-
null,
|
|
361
|
-
false,
|
|
362
|
-
true,
|
|
363
|
-
true
|
|
364
|
-
).catch((err: any) => err)
|
|
365
|
-
})
|
|
366
|
-
|
|
367
|
-
let results: any[] = []
|
|
368
|
-
|
|
369
|
-
for (const promise of promises) results.push(await promise())
|
|
370
|
-
|
|
371
|
-
results.forEach((result: any, index: number) => {
|
|
372
|
-
if (result && result.log) {
|
|
373
|
-
try {
|
|
374
|
-
const resultParsed = result.log
|
|
375
|
-
let sysUserId = ''
|
|
376
|
-
|
|
377
|
-
const sysUserIdLog = resultParsed
|
|
378
|
-
.split('\n')
|
|
379
|
-
.find((line: string) => line.startsWith('SYSUSERID='))
|
|
380
|
-
|
|
381
|
-
if (sysUserIdLog) {
|
|
382
|
-
sysUserId = sysUserIdLog.replace('SYSUSERID=', '')
|
|
383
|
-
|
|
384
|
-
executableContexts.push({
|
|
385
|
-
createdBy: contextsList[index].createdBy,
|
|
386
|
-
id: contextsList[index].id,
|
|
387
|
-
name: contextsList[index].name,
|
|
388
|
-
version: contextsList[index].version,
|
|
389
|
-
attributes: {
|
|
390
|
-
sysUserId
|
|
391
|
-
}
|
|
392
|
-
})
|
|
393
|
-
}
|
|
394
|
-
} catch (error) {
|
|
395
|
-
throw error
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
})
|
|
399
|
-
|
|
400
|
-
return executableContexts
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
public async deleteComputeContext(contextName: string, accessToken?: string) {
|
|
404
|
-
this.validateContextName(contextName)
|
|
405
|
-
|
|
406
|
-
this.isDefaultContext(
|
|
407
|
-
contextName,
|
|
408
|
-
this.defaultComputeContexts,
|
|
409
|
-
'Deleting default SAS compute contexts is not allowed.',
|
|
410
|
-
true
|
|
411
|
-
)
|
|
412
|
-
|
|
413
|
-
const headers: any = {
|
|
414
|
-
'Content-Type': 'application/json'
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
if (accessToken) {
|
|
418
|
-
headers.Authorization = `Bearer ${accessToken}`
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
const context = await this.getComputeContextByName(contextName, accessToken)
|
|
422
|
-
|
|
423
|
-
return await this.requestClient.delete<Context>(
|
|
424
|
-
`${this.serverUrl}/compute/contexts/${context.id}`,
|
|
425
|
-
accessToken
|
|
426
|
-
)
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
// TODO: implement editLauncherContext method
|
|
430
|
-
|
|
431
|
-
// TODO: implement deleteLauncherContext method
|
|
432
|
-
|
|
433
|
-
private validateContextName(name: string) {
|
|
434
|
-
if (!name) throw new Error('Context name is required.')
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
public isDefaultContext(
|
|
438
|
-
context: string,
|
|
439
|
-
defaultContexts: string[] = this.defaultComputeContexts,
|
|
440
|
-
errorMessage = '',
|
|
441
|
-
listDefaults = false
|
|
442
|
-
) {
|
|
443
|
-
if (defaultContexts.includes(context)) {
|
|
444
|
-
throw new Error(
|
|
445
|
-
`${errorMessage}${
|
|
446
|
-
listDefaults
|
|
447
|
-
? '\nDefault contexts:' +
|
|
448
|
-
defaultContexts.map((context, i) => `\n${i + 1}. ${context}`)
|
|
449
|
-
: ''
|
|
450
|
-
}`
|
|
451
|
-
)
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
}
|
package/src/SAS9ApiClient.ts
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import * as https from 'https'
|
|
2
|
-
import { generateTimestamp } from '@sasjs/utils/time'
|
|
3
|
-
import NodeFormData from 'form-data'
|
|
4
|
-
import { Sas9RequestClient } from './request/Sas9RequestClient'
|
|
5
|
-
import { isUrl } from './utils'
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* A client for interfacing with the SAS9 REST API.
|
|
9
|
-
*
|
|
10
|
-
*/
|
|
11
|
-
export class SAS9ApiClient {
|
|
12
|
-
private requestClient: Sas9RequestClient
|
|
13
|
-
|
|
14
|
-
constructor(
|
|
15
|
-
private serverUrl: string,
|
|
16
|
-
private jobsPath: string,
|
|
17
|
-
httpsAgentOptions?: https.AgentOptions
|
|
18
|
-
) {
|
|
19
|
-
if (serverUrl) isUrl(serverUrl)
|
|
20
|
-
this.requestClient = new Sas9RequestClient(serverUrl, httpsAgentOptions)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Returns an object containing server URL.
|
|
25
|
-
*/
|
|
26
|
-
public getConfig() {
|
|
27
|
-
return {
|
|
28
|
-
serverUrl: this.serverUrl
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Updates server URL which is not null.
|
|
34
|
-
* @param serverUrl - URL of the server to be set.
|
|
35
|
-
*/
|
|
36
|
-
public setConfig(serverUrl: string) {
|
|
37
|
-
if (serverUrl) this.serverUrl = serverUrl
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Executes code on a SAS9 server.
|
|
42
|
-
* @param linesOfCode - an array of code lines to execute.
|
|
43
|
-
* @param userName - the user name to log into the current SAS server.
|
|
44
|
-
* @param password - the password to log into the current SAS server.
|
|
45
|
-
*/
|
|
46
|
-
public async executeScript(
|
|
47
|
-
linesOfCode: string[],
|
|
48
|
-
userName: string,
|
|
49
|
-
password: string
|
|
50
|
-
) {
|
|
51
|
-
await this.requestClient.login(userName, password, this.jobsPath)
|
|
52
|
-
|
|
53
|
-
// This piece of code forces a webout to prevent Stored Process Errors.
|
|
54
|
-
const forceOutputCode = [
|
|
55
|
-
'data _null_;',
|
|
56
|
-
'file _webout;',
|
|
57
|
-
`put 'Executed sasjs run';`,
|
|
58
|
-
'run;'
|
|
59
|
-
]
|
|
60
|
-
const formData = generateFileUploadForm(
|
|
61
|
-
[...linesOfCode, ...forceOutputCode].join('\n')
|
|
62
|
-
)
|
|
63
|
-
|
|
64
|
-
const codeInjectorPath = `/User Folders/${userName}/My Folder/sasjs/runner`
|
|
65
|
-
const contentType =
|
|
66
|
-
'multipart/form-data; boundary=' + formData.getBoundary()
|
|
67
|
-
const contentLength = formData.getLengthSync()
|
|
68
|
-
|
|
69
|
-
const headers = {
|
|
70
|
-
'cache-control': 'no-cache',
|
|
71
|
-
Accept: '*/*',
|
|
72
|
-
'Content-Type': contentType,
|
|
73
|
-
'Content-Length': contentLength,
|
|
74
|
-
Connection: 'keep-alive'
|
|
75
|
-
}
|
|
76
|
-
const storedProcessUrl = `${this.jobsPath}/?${
|
|
77
|
-
'_program=' + codeInjectorPath + '&_debug=log'
|
|
78
|
-
}`
|
|
79
|
-
const response = await this.requestClient.post(
|
|
80
|
-
storedProcessUrl,
|
|
81
|
-
formData,
|
|
82
|
-
undefined,
|
|
83
|
-
contentType,
|
|
84
|
-
headers
|
|
85
|
-
)
|
|
86
|
-
|
|
87
|
-
return response.result as string
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
const generateFileUploadForm = (data: any): NodeFormData => {
|
|
92
|
-
const formData = new NodeFormData()
|
|
93
|
-
const filename = `sasjs-execute-sas9-${generateTimestamp('')}.sas`
|
|
94
|
-
formData.append(filename, data, {
|
|
95
|
-
filename,
|
|
96
|
-
contentType: 'text/plain'
|
|
97
|
-
})
|
|
98
|
-
|
|
99
|
-
return formData
|
|
100
|
-
}
|