@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
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ContextManager = void 0;
|
|
13
|
+
const utils_1 = require("./utils");
|
|
14
|
+
const error_1 = require("@sasjs/utils/error");
|
|
15
|
+
class ContextManager {
|
|
16
|
+
get getDefaultComputeContexts() {
|
|
17
|
+
return this.defaultComputeContexts;
|
|
18
|
+
}
|
|
19
|
+
get getDefaultLauncherContexts() {
|
|
20
|
+
return this.defaultLauncherContexts;
|
|
21
|
+
}
|
|
22
|
+
constructor(serverUrl, requestClient) {
|
|
23
|
+
this.serverUrl = serverUrl;
|
|
24
|
+
this.requestClient = requestClient;
|
|
25
|
+
this.defaultComputeContexts = [
|
|
26
|
+
'CAS Formats service compute context',
|
|
27
|
+
'Data Mining compute context',
|
|
28
|
+
'Import 9 service compute context',
|
|
29
|
+
'SAS Job Execution compute context',
|
|
30
|
+
'SAS Model Manager compute context',
|
|
31
|
+
'SAS Studio compute context',
|
|
32
|
+
'SAS Visual Forecasting compute context'
|
|
33
|
+
];
|
|
34
|
+
this.defaultLauncherContexts = [
|
|
35
|
+
'CAS Formats service launcher context',
|
|
36
|
+
'Data Mining launcher context',
|
|
37
|
+
'Import 9 service launcher context',
|
|
38
|
+
'Job Flow Execution launcher context',
|
|
39
|
+
'SAS Job Execution launcher context',
|
|
40
|
+
'SAS Model Manager launcher context',
|
|
41
|
+
'SAS Studio launcher context',
|
|
42
|
+
'SAS Visual Forecasting launcher context'
|
|
43
|
+
];
|
|
44
|
+
if (serverUrl)
|
|
45
|
+
(0, utils_1.isUrl)(serverUrl);
|
|
46
|
+
}
|
|
47
|
+
getComputeContexts(accessToken) {
|
|
48
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
const { result: contexts } = yield this.requestClient
|
|
50
|
+
.get(`${this.serverUrl}/compute/contexts?limit=10000`, accessToken)
|
|
51
|
+
.catch((err) => {
|
|
52
|
+
throw (0, error_1.prefixMessage)(err, 'Error while getting compute contexts. ');
|
|
53
|
+
});
|
|
54
|
+
const contextsList = contexts && contexts.items ? contexts.items : [];
|
|
55
|
+
return contextsList.map((context) => ({
|
|
56
|
+
createdBy: context.createdBy,
|
|
57
|
+
id: context.id,
|
|
58
|
+
name: context.name,
|
|
59
|
+
version: context.version,
|
|
60
|
+
attributes: {}
|
|
61
|
+
}));
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
getLauncherContexts(accessToken) {
|
|
65
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
const { result: contexts } = yield this.requestClient
|
|
67
|
+
.get(`${this.serverUrl}/launcher/contexts?limit=10000`, accessToken)
|
|
68
|
+
.catch((err) => {
|
|
69
|
+
throw (0, error_1.prefixMessage)(err, 'Error while getting launcher contexts. ');
|
|
70
|
+
});
|
|
71
|
+
const contextsList = contexts && contexts.items ? contexts.items : [];
|
|
72
|
+
return contextsList.map((context) => ({
|
|
73
|
+
createdBy: context.createdBy,
|
|
74
|
+
id: context.id,
|
|
75
|
+
name: context.name,
|
|
76
|
+
version: context.version,
|
|
77
|
+
attributes: {}
|
|
78
|
+
}));
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
createComputeContext(contextName, launchContextName, sharedAccountId, autoExecLines, accessToken, authorizedUsers) {
|
|
82
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
83
|
+
this.validateContextName(contextName);
|
|
84
|
+
this.isDefaultContext(contextName, this.defaultComputeContexts, `Compute context '${contextName}' already exists.`);
|
|
85
|
+
const existingComputeContexts = yield this.getComputeContexts(accessToken);
|
|
86
|
+
if (existingComputeContexts.find((context) => context.name === contextName)) {
|
|
87
|
+
throw new Error(`Compute context '${contextName}' already exists.`);
|
|
88
|
+
}
|
|
89
|
+
if (launchContextName) {
|
|
90
|
+
if (!this.defaultLauncherContexts.includes(launchContextName)) {
|
|
91
|
+
const launcherContexts = yield this.getLauncherContexts(accessToken);
|
|
92
|
+
if (!launcherContexts.find((context) => context.name === launchContextName)) {
|
|
93
|
+
const description = `The launcher context for ${launchContextName}`;
|
|
94
|
+
const launchType = 'direct';
|
|
95
|
+
const newLauncherContext = yield this.createLauncherContext(launchContextName, description, launchType, accessToken).catch((err) => {
|
|
96
|
+
throw new Error(`Error while creating launcher context. ${err}`);
|
|
97
|
+
});
|
|
98
|
+
if (newLauncherContext && newLauncherContext.name) {
|
|
99
|
+
launchContextName = newLauncherContext.name;
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
throw new Error('Error while creating launcher context.');
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
const headers = {
|
|
108
|
+
'Content-Type': 'application/json'
|
|
109
|
+
};
|
|
110
|
+
if (accessToken) {
|
|
111
|
+
headers.Authorization = `Bearer ${accessToken}`;
|
|
112
|
+
}
|
|
113
|
+
let attributes = { reuseServerProcesses: true };
|
|
114
|
+
if (sharedAccountId)
|
|
115
|
+
attributes = Object.assign(Object.assign({}, attributes), { runServerAs: sharedAccountId });
|
|
116
|
+
const requestBody = {
|
|
117
|
+
name: contextName,
|
|
118
|
+
launchContext: {
|
|
119
|
+
contextName: launchContextName || ''
|
|
120
|
+
},
|
|
121
|
+
attributes
|
|
122
|
+
};
|
|
123
|
+
if (authorizedUsers && authorizedUsers.length) {
|
|
124
|
+
requestBody['authorizedUsers'] = authorizedUsers;
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
requestBody['authorizeAllAuthenticatedUsers'] = true;
|
|
128
|
+
}
|
|
129
|
+
if (autoExecLines) {
|
|
130
|
+
requestBody.environment = { autoExecLines };
|
|
131
|
+
}
|
|
132
|
+
const { result: context } = yield this.requestClient
|
|
133
|
+
.post(`${this.serverUrl}/compute/contexts`, requestBody, accessToken)
|
|
134
|
+
.catch((err) => {
|
|
135
|
+
throw (0, error_1.prefixMessage)(err, 'Error while creating compute context. ');
|
|
136
|
+
});
|
|
137
|
+
return context;
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
createLauncherContext(contextName, description, launchType = 'direct', accessToken) {
|
|
141
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
142
|
+
if (!contextName) {
|
|
143
|
+
throw new Error('Context name is required.');
|
|
144
|
+
}
|
|
145
|
+
this.isDefaultContext(contextName, this.defaultLauncherContexts, `Launcher context '${contextName}' already exists.`);
|
|
146
|
+
const existingLauncherContexts = yield this.getLauncherContexts(accessToken);
|
|
147
|
+
if (existingLauncherContexts.find((context) => context.name === contextName)) {
|
|
148
|
+
throw new Error(`Launcher context '${contextName}' already exists.`);
|
|
149
|
+
}
|
|
150
|
+
const headers = {
|
|
151
|
+
'Content-Type': 'application/json'
|
|
152
|
+
};
|
|
153
|
+
if (accessToken) {
|
|
154
|
+
headers.Authorization = `Bearer ${accessToken}`;
|
|
155
|
+
}
|
|
156
|
+
const requestBody = {
|
|
157
|
+
name: contextName,
|
|
158
|
+
description: description,
|
|
159
|
+
launchType
|
|
160
|
+
};
|
|
161
|
+
const { result: context } = yield this.requestClient
|
|
162
|
+
.post(`${this.serverUrl}/launcher/contexts`, requestBody, accessToken)
|
|
163
|
+
.catch((err) => {
|
|
164
|
+
throw (0, error_1.prefixMessage)(err, 'Error while creating launcher context. ');
|
|
165
|
+
});
|
|
166
|
+
return context;
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
editComputeContext(contextName, editedContext, accessToken) {
|
|
170
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
171
|
+
this.validateContextName(contextName);
|
|
172
|
+
this.isDefaultContext(contextName, this.defaultComputeContexts, 'Editing default SAS compute contexts is not allowed.', true);
|
|
173
|
+
let originalContext;
|
|
174
|
+
originalContext = yield this.getComputeContextByName(contextName, accessToken);
|
|
175
|
+
// Try to find context by id, when context name has been changed.
|
|
176
|
+
if (!originalContext) {
|
|
177
|
+
originalContext = yield this.getComputeContextById(editedContext.id, accessToken);
|
|
178
|
+
}
|
|
179
|
+
const { result: context, etag } = yield this.requestClient
|
|
180
|
+
.get(`${this.serverUrl}/compute/contexts/${originalContext.id}`, accessToken)
|
|
181
|
+
.catch((err) => {
|
|
182
|
+
if (err && err.status === 404) {
|
|
183
|
+
throw new Error(`The context '${contextName}' was not found on this server.`);
|
|
184
|
+
}
|
|
185
|
+
throw err;
|
|
186
|
+
});
|
|
187
|
+
// An If-Match header with the value of the last ETag for the context
|
|
188
|
+
// is required to be able to update it
|
|
189
|
+
// https://developer.sas.com/apis/rest/Compute/#update-a-context-definition
|
|
190
|
+
return yield this.requestClient.put(`/compute/contexts/${context.id}`, Object.assign(Object.assign(Object.assign({}, context), editedContext), { attributes: Object.assign(Object.assign({}, context.attributes), editedContext.attributes) }), accessToken, { 'If-Match': etag });
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
getComputeContextByName(contextName, accessToken) {
|
|
194
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
195
|
+
const { result: contexts } = yield this.requestClient
|
|
196
|
+
.get(`${this.serverUrl}/compute/contexts?filter=eq(name, "${contextName}")`, accessToken)
|
|
197
|
+
.catch((err) => {
|
|
198
|
+
throw (0, error_1.prefixMessage)(err, 'Error while getting compute context by name. ');
|
|
199
|
+
});
|
|
200
|
+
if (!contexts || !(contexts.items && contexts.items.length)) {
|
|
201
|
+
throw new Error(`The context '${contextName}' was not found at '${this.serverUrl}'.`);
|
|
202
|
+
}
|
|
203
|
+
return contexts.items[0];
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
getComputeContextById(contextId, accessToken) {
|
|
207
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
208
|
+
const { result: context } = yield this.requestClient
|
|
209
|
+
.get(`${this.serverUrl}/compute/contexts/${contextId}`, accessToken)
|
|
210
|
+
.catch((err) => {
|
|
211
|
+
throw (0, error_1.prefixMessage)(err, 'Error while getting compute context by id. ');
|
|
212
|
+
});
|
|
213
|
+
return context;
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
getExecutableContexts(executeScript, authConfig) {
|
|
217
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
218
|
+
const { result: contexts } = yield this.requestClient
|
|
219
|
+
.get(`${this.serverUrl}/compute/contexts?limit=10000`, authConfig === null || authConfig === void 0 ? void 0 : authConfig.access_token)
|
|
220
|
+
.catch((err) => {
|
|
221
|
+
throw (0, error_1.prefixMessage)(err, 'Error while fetching compute contexts.');
|
|
222
|
+
});
|
|
223
|
+
const contextsList = contexts.items || [];
|
|
224
|
+
const executableContexts = [];
|
|
225
|
+
const promises = contextsList.map((context) => {
|
|
226
|
+
const linesOfCode = ['%put &=sysuserid;'];
|
|
227
|
+
return () => executeScript(`test-${context.name}`, linesOfCode, context.name, authConfig, null, false, true, true).catch((err) => err);
|
|
228
|
+
});
|
|
229
|
+
let results = [];
|
|
230
|
+
for (const promise of promises)
|
|
231
|
+
results.push(yield promise());
|
|
232
|
+
results.forEach((result, index) => {
|
|
233
|
+
if (result && result.log) {
|
|
234
|
+
try {
|
|
235
|
+
const resultParsed = result.log;
|
|
236
|
+
let sysUserId = '';
|
|
237
|
+
const sysUserIdLog = resultParsed
|
|
238
|
+
.split('\n')
|
|
239
|
+
.find((line) => line.startsWith('SYSUSERID='));
|
|
240
|
+
if (sysUserIdLog) {
|
|
241
|
+
sysUserId = sysUserIdLog.replace('SYSUSERID=', '');
|
|
242
|
+
executableContexts.push({
|
|
243
|
+
createdBy: contextsList[index].createdBy,
|
|
244
|
+
id: contextsList[index].id,
|
|
245
|
+
name: contextsList[index].name,
|
|
246
|
+
version: contextsList[index].version,
|
|
247
|
+
attributes: {
|
|
248
|
+
sysUserId
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
catch (error) {
|
|
254
|
+
throw error;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
return executableContexts;
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
deleteComputeContext(contextName, accessToken) {
|
|
262
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
263
|
+
this.validateContextName(contextName);
|
|
264
|
+
this.isDefaultContext(contextName, this.defaultComputeContexts, 'Deleting default SAS compute contexts is not allowed.', true);
|
|
265
|
+
const headers = {
|
|
266
|
+
'Content-Type': 'application/json'
|
|
267
|
+
};
|
|
268
|
+
if (accessToken) {
|
|
269
|
+
headers.Authorization = `Bearer ${accessToken}`;
|
|
270
|
+
}
|
|
271
|
+
const context = yield this.getComputeContextByName(contextName, accessToken);
|
|
272
|
+
return yield this.requestClient.delete(`${this.serverUrl}/compute/contexts/${context.id}`, accessToken);
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
// TODO: implement editLauncherContext method
|
|
276
|
+
// TODO: implement deleteLauncherContext method
|
|
277
|
+
validateContextName(name) {
|
|
278
|
+
if (!name)
|
|
279
|
+
throw new Error('Context name is required.');
|
|
280
|
+
}
|
|
281
|
+
isDefaultContext(context, defaultContexts = this.defaultComputeContexts, errorMessage = '', listDefaults = false) {
|
|
282
|
+
if (defaultContexts.includes(context)) {
|
|
283
|
+
throw new Error(`${errorMessage}${listDefaults
|
|
284
|
+
? '\nDefault contexts:' +
|
|
285
|
+
defaultContexts.map((context, i) => `\n${i + 1}. ${context}`)
|
|
286
|
+
: ''}`);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
exports.ContextManager = ContextManager;
|
package/DISCLOSURE
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
DISCLOSURE
|
|
2
|
+
|
|
3
|
+
@sasjs/adapter is a client library for SAS servers, published by 4GL Apps
|
|
4
|
+
(https://sasapps.io). It is not a security tool, a penetration-testing
|
|
5
|
+
utility or an obfuscation tool. It does provide capabilities that
|
|
6
|
+
automated scanning can read as dual-use, so this file declares them and
|
|
7
|
+
their intended legitimate use.
|
|
8
|
+
|
|
9
|
+
Capabilities
|
|
10
|
+
|
|
11
|
+
- HTTP(S) requests to a SAS server. The destination is a base URL supplied
|
|
12
|
+
by the host application's own configuration (sasjsconfig.json, a
|
|
13
|
+
constructor argument, or an environment variable the application sets).
|
|
14
|
+
The package contains no hard-coded destination and does not contact any
|
|
15
|
+
host the host application has not been given.
|
|
16
|
+
|
|
17
|
+
- Credential and token handling. It sends credentials to that server as
|
|
18
|
+
part of its authentication flow: username and password, an access token,
|
|
19
|
+
or a Viya client id and secret for OAuth. Tokens are held in memory for
|
|
20
|
+
the session. Base64 is used for HTTP Basic headers and for SAS content
|
|
21
|
+
encoding, not for obfuscation.
|
|
22
|
+
|
|
23
|
+
- File transfer. It uploads local files to the SAS server, downloads
|
|
24
|
+
results, and writes response streams and log files under the project
|
|
25
|
+
directory.
|
|
26
|
+
|
|
27
|
+
- Job execution. On SAS 9 deployments it calls the server's job-execution
|
|
28
|
+
endpoints. The Node build exposes the same API surface as the browser
|
|
29
|
+
build.
|
|
30
|
+
|
|
31
|
+
Intended use
|
|
32
|
+
|
|
33
|
+
Applications that talk to a SAS server the operator owns or is authorised
|
|
34
|
+
to use: SASjs applications, the SASjs CLI, and Data Controller for SAS.
|
|
35
|
+
Every destination and every credential comes from the host application's
|
|
36
|
+
own configuration.
|
|
37
|
+
|
|
38
|
+
Packaging note
|
|
39
|
+
|
|
40
|
+
The published JavaScript is webpack output and bundles third-party
|
|
41
|
+
dependencies, so it contains constructs that can appear in a scan but are
|
|
42
|
+
not authored here, including webpack's globalThis polyfill and its module
|
|
43
|
+
runtime.
|
|
44
|
+
|
|
45
|
+
Source: https://github.com/sasjs/adapter
|
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ SASjs is a open-source framework for building Web Apps on SAS® platforms. You c
|
|
|
18
18
|
|
|
19
19
|
1 - `npm install @sasjs/adapter` - for use in a nodeJS project (recommended)
|
|
20
20
|
|
|
21
|
-
2 - [Download](https://cdn.jsdelivr.net/npm/@sasjs/adapter@
|
|
21
|
+
2 - [Download](https://cdn.jsdelivr.net/npm/@sasjs/adapter@5/dist/sasjs-adapter.min.js) and use a copy of the latest JS file
|
|
22
22
|
|
|
23
23
|
3 - Reference directly from the CDN - in which case click [here](https://www.jsdelivr.com/package/npm/@sasjs/adapter?tab=collection) and select "SRI" to get the script tag with the integrity hash.
|
|
24
24
|
|
package/SAS9ApiClient.d.ts
CHANGED
package/SAS9ApiClient.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.SAS9ApiClient = void 0;
|
|
16
|
+
const time_1 = require("@sasjs/utils/time");
|
|
17
|
+
const form_data_1 = __importDefault(require("form-data"));
|
|
18
|
+
const Sas9RequestClient_1 = require("./request/Sas9RequestClient");
|
|
19
|
+
const utils_1 = require("./utils");
|
|
20
|
+
/**
|
|
21
|
+
* A client for interfacing with the SAS9 REST API.
|
|
22
|
+
*
|
|
23
|
+
*/
|
|
24
|
+
class SAS9ApiClient {
|
|
25
|
+
constructor(serverUrl, jobsPath, httpsAgentOptions) {
|
|
26
|
+
this.serverUrl = serverUrl;
|
|
27
|
+
this.jobsPath = jobsPath;
|
|
28
|
+
if (serverUrl)
|
|
29
|
+
(0, utils_1.isUrl)(serverUrl);
|
|
30
|
+
this.requestClient = new Sas9RequestClient_1.Sas9RequestClient(serverUrl, httpsAgentOptions);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Returns an object containing server URL.
|
|
34
|
+
*/
|
|
35
|
+
getConfig() {
|
|
36
|
+
return {
|
|
37
|
+
serverUrl: this.serverUrl
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Updates server URL which is not null.
|
|
42
|
+
* @param serverUrl - URL of the server to be set.
|
|
43
|
+
*/
|
|
44
|
+
setConfig(serverUrl) {
|
|
45
|
+
if (serverUrl)
|
|
46
|
+
this.serverUrl = serverUrl;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Executes code on a SAS9 server.
|
|
50
|
+
* @param linesOfCode - an array of code lines to execute.
|
|
51
|
+
* @param userName - the user name to log into the current SAS server.
|
|
52
|
+
* @param password - the password to log into the current SAS server.
|
|
53
|
+
*/
|
|
54
|
+
executeScript(linesOfCode, userName, password) {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
yield this.requestClient.login(userName, password, this.jobsPath);
|
|
57
|
+
// This piece of code forces a webout to prevent Stored Process Errors.
|
|
58
|
+
const forceOutputCode = [
|
|
59
|
+
'data _null_;',
|
|
60
|
+
'file _webout;',
|
|
61
|
+
`put 'Executed sasjs run';`,
|
|
62
|
+
'run;'
|
|
63
|
+
];
|
|
64
|
+
const formData = generateFileUploadForm([...linesOfCode, ...forceOutputCode].join('\n'));
|
|
65
|
+
const codeInjectorPath = `/User Folders/${userName}/My Folder/sasjs/runner`;
|
|
66
|
+
const contentType = 'multipart/form-data; boundary=' + formData.getBoundary();
|
|
67
|
+
const contentLength = formData.getLengthSync();
|
|
68
|
+
const headers = {
|
|
69
|
+
'cache-control': 'no-cache',
|
|
70
|
+
Accept: '*/*',
|
|
71
|
+
'Content-Type': contentType,
|
|
72
|
+
'Content-Length': contentLength,
|
|
73
|
+
Connection: 'keep-alive'
|
|
74
|
+
};
|
|
75
|
+
const storedProcessUrl = `${this.jobsPath}/?${'_program=' + codeInjectorPath + '&_debug=log'}`;
|
|
76
|
+
const response = yield this.requestClient.post(storedProcessUrl, formData, undefined, contentType, headers);
|
|
77
|
+
return response.result;
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.SAS9ApiClient = SAS9ApiClient;
|
|
82
|
+
const generateFileUploadForm = (data) => {
|
|
83
|
+
const formData = new form_data_1.default();
|
|
84
|
+
const filename = `sasjs-execute-sas9-${(0, time_1.generateTimestamp)('')}.sas`;
|
|
85
|
+
formData.append(filename, data, {
|
|
86
|
+
filename,
|
|
87
|
+
contentType: 'text/plain'
|
|
88
|
+
});
|
|
89
|
+
return formData;
|
|
90
|
+
};
|