@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,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
exports.Sas9RequestClient = void 0;
|
|
36
|
+
const axios_cookiejar_support_1 = require("axios-cookiejar-support");
|
|
37
|
+
const tough = __importStar(require("tough-cookie"));
|
|
38
|
+
const error_1 = require("@sasjs/utils/error");
|
|
39
|
+
const RequestClient_1 = require("./RequestClient");
|
|
40
|
+
const errors_1 = require("../types/errors");
|
|
41
|
+
/**
|
|
42
|
+
* Specific request client for SAS9 in Node.js environments.
|
|
43
|
+
* Handles redirects and cookie management.
|
|
44
|
+
*/
|
|
45
|
+
class Sas9RequestClient extends RequestClient_1.RequestClient {
|
|
46
|
+
constructor(baseUrl, httpsAgentOptions) {
|
|
47
|
+
super(baseUrl, httpsAgentOptions);
|
|
48
|
+
this.httpClient.defaults.maxRedirects = 0;
|
|
49
|
+
this.httpClient.defaults.validateStatus = (status) => status >= 200 && status < 303;
|
|
50
|
+
if (axios_cookiejar_support_1.wrapper) {
|
|
51
|
+
(0, axios_cookiejar_support_1.wrapper)(this.httpClient);
|
|
52
|
+
this.httpClient.defaults.jar = new tough.CookieJar();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
resetInMemoryAuthState() {
|
|
56
|
+
super.resetInMemoryAuthState();
|
|
57
|
+
if (this.httpClient.defaults.jar) {
|
|
58
|
+
;
|
|
59
|
+
this.httpClient.defaults.jar.removeAllCookiesSync();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
login(username, password, jobsPath) {
|
|
63
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
const codeInjectorPath = `/User Folders/${username}/My Folder/sasjs/runner`;
|
|
65
|
+
if (this.httpClient.defaults.jar) {
|
|
66
|
+
;
|
|
67
|
+
this.httpClient.defaults.jar.removeAllCookies();
|
|
68
|
+
yield this.get(`${jobsPath}?_program=${codeInjectorPath}&_username=${username}&_password=${password}`, undefined, 'text/plain');
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
get(url, accessToken, contentType = 'application/json', overrideHeaders = {}, debug = false) {
|
|
73
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
const headers = Object.assign(Object.assign({}, this.getHeaders(accessToken, contentType)), overrideHeaders);
|
|
75
|
+
const requestConfig = {
|
|
76
|
+
headers,
|
|
77
|
+
responseType: contentType === 'text/plain' ? 'text' : 'json',
|
|
78
|
+
withXSRFToken: true
|
|
79
|
+
};
|
|
80
|
+
if (contentType === 'text/plain') {
|
|
81
|
+
requestConfig.transformResponse = undefined;
|
|
82
|
+
}
|
|
83
|
+
return this.httpClient
|
|
84
|
+
.get(url, requestConfig)
|
|
85
|
+
.then((response) => {
|
|
86
|
+
if (response.status === 302) {
|
|
87
|
+
return this.get(response.headers['location'], accessToken, contentType);
|
|
88
|
+
}
|
|
89
|
+
(0, RequestClient_1.throwIfError)(response);
|
|
90
|
+
return this.parseResponse(response);
|
|
91
|
+
})
|
|
92
|
+
.catch((e) => __awaiter(this, void 0, void 0, function* () {
|
|
93
|
+
if (e instanceof errors_1.JobExecutionError)
|
|
94
|
+
throw e;
|
|
95
|
+
return yield this.handleError(e, () => this.get(url, accessToken, contentType, overrideHeaders).catch((err) => {
|
|
96
|
+
throw (0, error_1.prefixMessage)(err, 'Error while executing handle error callback. ');
|
|
97
|
+
}), debug).catch((err) => {
|
|
98
|
+
throw (0, error_1.prefixMessage)(err, 'Error while handling error. ');
|
|
99
|
+
});
|
|
100
|
+
}));
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
post(url, data, accessToken, contentType = 'application/json', overrideHeaders = {}) {
|
|
104
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
105
|
+
const headers = Object.assign(Object.assign({}, this.getHeaders(accessToken, contentType)), overrideHeaders);
|
|
106
|
+
return this.httpClient
|
|
107
|
+
.post(url, data, { headers, withXSRFToken: true })
|
|
108
|
+
.then((response) => __awaiter(this, void 0, void 0, function* () {
|
|
109
|
+
if (response.status === 302) {
|
|
110
|
+
return yield this.get(response.headers['location'], undefined, contentType, overrideHeaders);
|
|
111
|
+
}
|
|
112
|
+
(0, RequestClient_1.throwIfError)(response);
|
|
113
|
+
return this.parseResponse(response);
|
|
114
|
+
}))
|
|
115
|
+
.catch((e) => __awaiter(this, void 0, void 0, function* () {
|
|
116
|
+
return yield this.handleError(e, () => this.post(url, data, accessToken, contentType, overrideHeaders));
|
|
117
|
+
}));
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
exports.Sas9RequestClient = Sas9RequestClient;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SASJS_LOGS_SEPARATOR = exports.SasjsRequestClient = void 0;
|
|
4
|
+
const RequestClient_1 = require("./RequestClient");
|
|
5
|
+
/**
|
|
6
|
+
* Specific request client for SASJS.
|
|
7
|
+
* Append tokens in headers.
|
|
8
|
+
*/
|
|
9
|
+
class SasjsRequestClient extends RequestClient_1.RequestClient {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this.getHeaders = (accessToken, contentType) => {
|
|
13
|
+
var _a;
|
|
14
|
+
const headers = {};
|
|
15
|
+
if (contentType !== 'application/x-www-form-urlencoded')
|
|
16
|
+
headers['Content-Type'] = contentType;
|
|
17
|
+
headers.Accept = contentType === 'application/json' ? contentType : '*/*';
|
|
18
|
+
if (!accessToken && typeof window !== 'undefined')
|
|
19
|
+
accessToken = (_a = localStorage.getItem('accessToken')) !== null && _a !== void 0 ? _a : undefined;
|
|
20
|
+
if (accessToken)
|
|
21
|
+
headers.Authorization = `Bearer ${accessToken}`;
|
|
22
|
+
return headers;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
parseResponse(response) {
|
|
26
|
+
const etag = (response === null || response === void 0 ? void 0 : response.headers) ? response.headers['etag'] : '';
|
|
27
|
+
let parsedResponse = {};
|
|
28
|
+
let webout, log, printOutput;
|
|
29
|
+
try {
|
|
30
|
+
if (typeof response.data === 'string') {
|
|
31
|
+
parsedResponse = JSON.parse(response.data);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
parsedResponse = response.data;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
catch (_a) {
|
|
38
|
+
if (response.data.includes(exports.SASJS_LOGS_SEPARATOR)) {
|
|
39
|
+
const { data } = response;
|
|
40
|
+
const splittedResponse = data.split(exports.SASJS_LOGS_SEPARATOR);
|
|
41
|
+
webout = splittedResponse.splice(0, 1)[0];
|
|
42
|
+
if (webout !== undefined)
|
|
43
|
+
parsedResponse = webout;
|
|
44
|
+
// log can contain nested logs
|
|
45
|
+
const logs = splittedResponse.splice(0, splittedResponse.length - 1);
|
|
46
|
+
// tests if string ends with SASJS_LOGS_SEPARATOR
|
|
47
|
+
const endingWithLogSepRegExp = new RegExp(`${exports.SASJS_LOGS_SEPARATOR}$`);
|
|
48
|
+
// at this point splittedResponse can contain only one item
|
|
49
|
+
const lastChunk = splittedResponse[0];
|
|
50
|
+
if (lastChunk) {
|
|
51
|
+
// if the last chunk doesn't end with SASJS_LOGS_SEPARATOR, then it is a printOutput
|
|
52
|
+
// else the last chunk is part of the log and has to be joined
|
|
53
|
+
if (!endingWithLogSepRegExp.test(data))
|
|
54
|
+
printOutput = lastChunk;
|
|
55
|
+
else if (logs.length > 1)
|
|
56
|
+
logs.push(lastChunk);
|
|
57
|
+
}
|
|
58
|
+
// join logs into single log with SASJS_LOGS_SEPARATOR
|
|
59
|
+
log = logs.join(exports.SASJS_LOGS_SEPARATOR);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
parsedResponse = response.data;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const returnResult = {
|
|
66
|
+
result: parsedResponse,
|
|
67
|
+
log: log || '',
|
|
68
|
+
etag,
|
|
69
|
+
status: response.status
|
|
70
|
+
};
|
|
71
|
+
if (printOutput)
|
|
72
|
+
returnResult.printOutput = printOutput;
|
|
73
|
+
return returnResult;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
exports.SasjsRequestClient = SasjsRequestClient;
|
|
77
|
+
exports.SASJS_LOGS_SEPARATOR = 'SASJS_LOGS_SEPARATOR_163ee17b6ff24f028928972d80a26784';
|
package/types/Context.js
ADDED
package/types/File.js
ADDED
package/types/Folder.js
ADDED
package/types/Job.js
ADDED
package/types/Link.js
ADDED
package/types/Login.js
ADDED
package/types/SASjsConfig.d.ts
CHANGED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LoginMechanism = exports.SASjsConfig = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Specifies the configuration for the SASjs instance - eg where and how to
|
|
6
|
+
* connect to SAS.
|
|
7
|
+
*/
|
|
8
|
+
class SASjsConfig {
|
|
9
|
+
constructor() {
|
|
10
|
+
/**
|
|
11
|
+
* The location (including http protocol and port) of the SAS Server.
|
|
12
|
+
* Can be omitted, eg if serving directly from the SAS Web Server or being
|
|
13
|
+
* streamed.
|
|
14
|
+
*/
|
|
15
|
+
this.serverUrl = '';
|
|
16
|
+
/**
|
|
17
|
+
* The location of the STP Process Web Application. By default the adapter
|
|
18
|
+
* will use '/SASjsApi/stp/execute' on SAS JS.
|
|
19
|
+
*/
|
|
20
|
+
this.pathSASJS = '';
|
|
21
|
+
/**
|
|
22
|
+
* The location of the Stored Process Web Application. By default the adapter
|
|
23
|
+
* will use '/SASStoredProcess/do' on SAS 9.
|
|
24
|
+
*/
|
|
25
|
+
this.pathSAS9 = '';
|
|
26
|
+
/**
|
|
27
|
+
* The location of the Job Execution Web Application. By default the adapter
|
|
28
|
+
* will use '/SASJobExecution' on SAS Viya.
|
|
29
|
+
*/
|
|
30
|
+
this.pathSASViya = '';
|
|
31
|
+
/**
|
|
32
|
+
* The appLoc is the parent folder under which the SAS services (STPs or Job
|
|
33
|
+
* Execution Services) are stored. We recommend that each app is stored in
|
|
34
|
+
* a dedicated parent folder (the appLoc) and the services are grouped inside
|
|
35
|
+
* subfolders within the appLoc - allowing functionality to be restricted
|
|
36
|
+
* according to those groups at backend.
|
|
37
|
+
* When using appLoc, the paths provided in the `request` function should be
|
|
38
|
+
* _without_ a leading slash (/).
|
|
39
|
+
*/
|
|
40
|
+
this.appLoc = '';
|
|
41
|
+
/**
|
|
42
|
+
* Can be `SAS9` or `SASVIYA`.
|
|
43
|
+
*/
|
|
44
|
+
this.serverType = null;
|
|
45
|
+
/**
|
|
46
|
+
* Set to `true` to enable additional debugging.
|
|
47
|
+
*/
|
|
48
|
+
this.debug = true;
|
|
49
|
+
/**
|
|
50
|
+
* Set to `true` to enable verbose mode that will log a summary of every HTTP response.
|
|
51
|
+
*/
|
|
52
|
+
this.verbose = true;
|
|
53
|
+
/**
|
|
54
|
+
* The name of the compute context to use when calling the Viya services directly.
|
|
55
|
+
* Example value: 'SAS Job Execution compute context'
|
|
56
|
+
*/
|
|
57
|
+
this.contextName = '';
|
|
58
|
+
/**
|
|
59
|
+
* If it's `false` adapter will use the JES API as connection approach. To enhance VIYA
|
|
60
|
+
* performance, set to `true` and provide a `contextName` on which to run
|
|
61
|
+
* the code. When running on a named context, the code executes under the
|
|
62
|
+
* user identity. When running as a Job Execution service, the code runs
|
|
63
|
+
* under the identity in the JES context. If `useComputeApi` is `null` or `undefined`, the service will run as a Job, except
|
|
64
|
+
* triggered using the APIs instead of the Job Execution Web Service broker.
|
|
65
|
+
*/
|
|
66
|
+
this.useComputeApi = null;
|
|
67
|
+
/**
|
|
68
|
+
* Supported login mechanisms are - Redirected and Default
|
|
69
|
+
*/
|
|
70
|
+
this.loginMechanism = LoginMechanism.Default;
|
|
71
|
+
/**
|
|
72
|
+
* Optional setting to configure request history limit. Increasing this limit
|
|
73
|
+
* may affect browser performance, especially with debug (logs) enabled.
|
|
74
|
+
*/
|
|
75
|
+
this.requestHistoryLimit = 10;
|
|
76
|
+
/**
|
|
77
|
+
* Optional setting. When `true`, the request runs as a Viya execution task —
|
|
78
|
+
* appends `_executionTasks=true` to the request URL. Only applies to the Viya
|
|
79
|
+
* web jobs path, i.e. when `serverType === SASVIYA` AND
|
|
80
|
+
* `useComputeApi` is `null`/`undefined`. Has no effect when `useComputeApi`
|
|
81
|
+
* is explicitly set to `true` or `false`.
|
|
82
|
+
*/
|
|
83
|
+
this.runAsTask = false;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
exports.SASjsConfig = SASjsConfig;
|
|
87
|
+
var LoginMechanism;
|
|
88
|
+
(function (LoginMechanism) {
|
|
89
|
+
LoginMechanism["Default"] = "Default";
|
|
90
|
+
LoginMechanism["Redirected"] = "Redirected";
|
|
91
|
+
})(LoginMechanism = exports.LoginMechanism || (exports.LoginMechanism = {}));
|
package/types/Session.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SessionState = void 0;
|
|
4
|
+
var SessionState;
|
|
5
|
+
(function (SessionState) {
|
|
6
|
+
SessionState["Completed"] = "completed";
|
|
7
|
+
SessionState["Running"] = "running";
|
|
8
|
+
SessionState["Pending"] = "pending";
|
|
9
|
+
SessionState["Idle"] = "idle";
|
|
10
|
+
SessionState["Unavailable"] = "unavailable";
|
|
11
|
+
SessionState["NoState"] = "";
|
|
12
|
+
SessionState["Failed"] = "failed";
|
|
13
|
+
SessionState["Error"] = "error";
|
|
14
|
+
})(SessionState = exports.SessionState || (exports.SessionState = {}));
|
package/types/Tables.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Tables = void 0;
|
|
4
|
+
const errors_1 = require("./errors");
|
|
5
|
+
class Tables {
|
|
6
|
+
constructor(table, macroName) {
|
|
7
|
+
this._tables = {};
|
|
8
|
+
this.add(table, macroName);
|
|
9
|
+
}
|
|
10
|
+
add(table, macroName) {
|
|
11
|
+
if (table && macroName) {
|
|
12
|
+
if (!(table instanceof Array)) {
|
|
13
|
+
throw new errors_1.ArgumentError('First argument must be array');
|
|
14
|
+
}
|
|
15
|
+
if (typeof macroName !== 'string') {
|
|
16
|
+
throw new errors_1.ArgumentError('Second argument must be string');
|
|
17
|
+
}
|
|
18
|
+
if (!isNaN(Number(macroName[macroName.length - 1]))) {
|
|
19
|
+
throw new errors_1.ArgumentError('Macro name cannot have number at the end');
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
throw new errors_1.ArgumentError('Missing arguments');
|
|
24
|
+
}
|
|
25
|
+
this._tables[macroName] = table;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.Tables = Tables;
|
package/types/WriteStream.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
|
-
import { WriteStream as FsWriteStream } from 'fs';
|
|
3
|
+
import type { WriteStream as FsWriteStream } from 'fs';
|
|
4
4
|
export interface WriteStream extends FsWriteStream {
|
|
5
5
|
write(chunk: any, encoding?: BufferEncoding | ((error: Error | null | undefined) => void), cb?: (error: Error | null | undefined) => void): boolean;
|
|
6
6
|
path: string | Buffer;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ArgumentError = void 0;
|
|
4
|
+
class ArgumentError extends Error {
|
|
5
|
+
constructor(message) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.message = message;
|
|
8
|
+
this.name = 'ArgumentError';
|
|
9
|
+
Object.setPrototypeOf(this, ArgumentError.prototype);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.ArgumentError = ArgumentError;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AuthorizeError = void 0;
|
|
4
|
+
class AuthorizeError extends Error {
|
|
5
|
+
constructor(message, confirmUrl) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.message = message;
|
|
8
|
+
this.confirmUrl = confirmUrl;
|
|
9
|
+
this.name = 'AuthorizeError';
|
|
10
|
+
Object.setPrototypeOf(this, AuthorizeError.prototype);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.AuthorizeError = AuthorizeError;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CertificateError = void 0;
|
|
4
|
+
const instructionsToFix = 'https://github.com/sasjs/cli/issues/1181#issuecomment-1090638584';
|
|
5
|
+
class CertificateError extends Error {
|
|
6
|
+
constructor(message) {
|
|
7
|
+
super(`${message}\nPlease visit the link below for further information on this issue:\n- ${instructionsToFix}\n`);
|
|
8
|
+
this.name = 'CertificateError';
|
|
9
|
+
Object.setPrototypeOf(this, CertificateError.prototype);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.CertificateError = CertificateError;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ComputeJobExecutionError = void 0;
|
|
4
|
+
class ComputeJobExecutionError extends Error {
|
|
5
|
+
constructor(job, log) {
|
|
6
|
+
super('Error: Job execution failed');
|
|
7
|
+
this.job = job;
|
|
8
|
+
this.log = log;
|
|
9
|
+
this.name = 'ComputeJobExecutionError';
|
|
10
|
+
Object.setPrototypeOf(this, ComputeJobExecutionError.prototype);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.ComputeJobExecutionError = ComputeJobExecutionError;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ErrorResponse = void 0;
|
|
4
|
+
class ErrorResponse {
|
|
5
|
+
constructor(message, details, raw) {
|
|
6
|
+
let detailsString = details;
|
|
7
|
+
if (typeof details !== 'object') {
|
|
8
|
+
try {
|
|
9
|
+
detailsString = JSON.parse(details);
|
|
10
|
+
}
|
|
11
|
+
catch (_a) {
|
|
12
|
+
raw = details;
|
|
13
|
+
detailsString = '';
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
this.error = {
|
|
17
|
+
message,
|
|
18
|
+
details: detailsString,
|
|
19
|
+
raw
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.ErrorResponse = ErrorResponse;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InternalServerError = void 0;
|
|
4
|
+
class InternalServerError extends Error {
|
|
5
|
+
constructor() {
|
|
6
|
+
super('Error: Internal server error.');
|
|
7
|
+
this.name = 'InternalServerError';
|
|
8
|
+
Object.setPrototypeOf(this, InternalServerError.prototype);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.InternalServerError = InternalServerError;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InvalidJsonError = void 0;
|
|
4
|
+
class InvalidJsonError extends Error {
|
|
5
|
+
constructor() {
|
|
6
|
+
super('Error: invalid Json string');
|
|
7
|
+
this.name = 'InvalidJsonError';
|
|
8
|
+
Object.setPrototypeOf(this, InvalidJsonError.prototype);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.InvalidJsonError = InvalidJsonError;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InvalidSASjsCsrfError = void 0;
|
|
4
|
+
class InvalidSASjsCsrfError extends Error {
|
|
5
|
+
constructor() {
|
|
6
|
+
const message = 'Invalid CSRF token!';
|
|
7
|
+
super(`Auth error: ${message}`);
|
|
8
|
+
this.name = 'InvalidSASjsCsrfError';
|
|
9
|
+
Object.setPrototypeOf(this, InvalidSASjsCsrfError.prototype);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.InvalidSASjsCsrfError = InvalidSASjsCsrfError;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JobExecutionError = void 0;
|
|
4
|
+
class JobExecutionError extends Error {
|
|
5
|
+
constructor(errorCode, errorMessage, result) {
|
|
6
|
+
super(`Error Code ${errorCode}: ${errorMessage}`);
|
|
7
|
+
this.errorCode = errorCode;
|
|
8
|
+
this.errorMessage = errorMessage;
|
|
9
|
+
this.result = result;
|
|
10
|
+
this.name = 'JobExecutionError';
|
|
11
|
+
Object.setPrototypeOf(this, JobExecutionError.prototype);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.JobExecutionError = JobExecutionError;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JobStatePollError = void 0;
|
|
4
|
+
class JobStatePollError extends Error {
|
|
5
|
+
constructor(id, originalError) {
|
|
6
|
+
super(`Error while polling job state for job ${id}: ${originalError.message || originalError}`);
|
|
7
|
+
this.originalError = originalError;
|
|
8
|
+
this.name = 'JobStatePollError';
|
|
9
|
+
Object.setPrototypeOf(this, JobStatePollError.prototype);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.JobStatePollError = JobStatePollError;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JsonParseArrayError = void 0;
|
|
4
|
+
class JsonParseArrayError extends Error {
|
|
5
|
+
constructor() {
|
|
6
|
+
super('Can not parse array object to json.');
|
|
7
|
+
this.name = 'JsonParseArrayError';
|
|
8
|
+
Object.setPrototypeOf(this, JsonParseArrayError.prototype);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.JsonParseArrayError = JsonParseArrayError;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LoginRequiredError = void 0;
|
|
4
|
+
class LoginRequiredError extends Error {
|
|
5
|
+
constructor(details) {
|
|
6
|
+
const message = details
|
|
7
|
+
? JSON.stringify(details, null, 2)
|
|
8
|
+
: 'You must be logged in to access this resource';
|
|
9
|
+
super(`Auth error: ${message}`);
|
|
10
|
+
this.name = 'LoginRequiredError';
|
|
11
|
+
Object.setPrototypeOf(this, LoginRequiredError.prototype);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.LoginRequiredError = LoginRequiredError;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NoSessionStateError = void 0;
|
|
4
|
+
class NoSessionStateError extends Error {
|
|
5
|
+
constructor(serverResponseStatus, sessionStateUrl, logUrl) {
|
|
6
|
+
super(`Could not get session state. Server responded with ${serverResponseStatus} whilst checking state: ${sessionStateUrl}`);
|
|
7
|
+
this.serverResponseStatus = serverResponseStatus;
|
|
8
|
+
this.sessionStateUrl = sessionStateUrl;
|
|
9
|
+
this.logUrl = logUrl;
|
|
10
|
+
this.name = 'NoSessionStatus';
|
|
11
|
+
Object.setPrototypeOf(this, NoSessionStateError.prototype);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.NoSessionStateError = NoSessionStateError;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NotFoundError = void 0;
|
|
4
|
+
class NotFoundError extends Error {
|
|
5
|
+
constructor(url) {
|
|
6
|
+
super(`Error: Resource at ${url} was not found`);
|
|
7
|
+
this.url = url;
|
|
8
|
+
this.name = 'NotFoundError';
|
|
9
|
+
Object.setPrototypeOf(this, NotFoundError.prototype);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.NotFoundError = NotFoundError;
|