@sasjs/adapter 4.19.3 → 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 +41 -12
- 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/checkNodeVersion.js +0 -16
- 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
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
const instructionsToFix =
|
|
2
|
-
'https://github.com/sasjs/cli/issues/1181#issuecomment-1090638584'
|
|
3
|
-
|
|
4
|
-
export class CertificateError extends Error {
|
|
5
|
-
constructor(message: string) {
|
|
6
|
-
super(
|
|
7
|
-
`${message}\nPlease visit the link below for further information on this issue:\n- ${instructionsToFix}\n`
|
|
8
|
-
)
|
|
9
|
-
this.name = 'CertificateError'
|
|
10
|
-
Object.setPrototypeOf(this, CertificateError.prototype)
|
|
11
|
-
}
|
|
12
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Job } from '../Job'
|
|
2
|
-
|
|
3
|
-
export class ComputeJobExecutionError extends Error {
|
|
4
|
-
constructor(
|
|
5
|
-
public job: Job,
|
|
6
|
-
public log: string
|
|
7
|
-
) {
|
|
8
|
-
super('Error: Job execution failed')
|
|
9
|
-
this.name = 'ComputeJobExecutionError'
|
|
10
|
-
Object.setPrototypeOf(this, ComputeJobExecutionError.prototype)
|
|
11
|
-
}
|
|
12
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export class ErrorResponse {
|
|
2
|
-
error: ErrorBody
|
|
3
|
-
|
|
4
|
-
constructor(message: string, details?: any, raw?: any) {
|
|
5
|
-
let detailsString = details
|
|
6
|
-
|
|
7
|
-
if (typeof details !== 'object') {
|
|
8
|
-
try {
|
|
9
|
-
detailsString = JSON.parse(details)
|
|
10
|
-
} catch {
|
|
11
|
-
raw = details
|
|
12
|
-
detailsString = ''
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
this.error = {
|
|
17
|
-
message,
|
|
18
|
-
details: detailsString,
|
|
19
|
-
raw
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface ErrorBody {
|
|
25
|
-
message: string
|
|
26
|
-
details: any
|
|
27
|
-
raw: any
|
|
28
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export class JobExecutionError extends Error {
|
|
2
|
-
constructor(
|
|
3
|
-
public errorCode: number,
|
|
4
|
-
public errorMessage: string,
|
|
5
|
-
public result: string
|
|
6
|
-
) {
|
|
7
|
-
super(`Error Code ${errorCode}: ${errorMessage}`)
|
|
8
|
-
this.name = 'JobExecutionError'
|
|
9
|
-
Object.setPrototypeOf(this, JobExecutionError.prototype)
|
|
10
|
-
}
|
|
11
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export class JobStatePollError extends Error {
|
|
2
|
-
constructor(
|
|
3
|
-
id: string,
|
|
4
|
-
public originalError: Error
|
|
5
|
-
) {
|
|
6
|
-
super(
|
|
7
|
-
`Error while polling job state for job ${id}: ${
|
|
8
|
-
originalError.message || originalError
|
|
9
|
-
}`
|
|
10
|
-
)
|
|
11
|
-
this.name = 'JobStatePollError'
|
|
12
|
-
Object.setPrototypeOf(this, JobStatePollError.prototype)
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export class LoginRequiredError extends Error {
|
|
2
|
-
constructor(details?: any) {
|
|
3
|
-
const message = details
|
|
4
|
-
? JSON.stringify(details, null, 2)
|
|
5
|
-
: 'You must be logged in to access this resource'
|
|
6
|
-
|
|
7
|
-
super(`Auth error: ${message}`)
|
|
8
|
-
this.name = 'LoginRequiredError'
|
|
9
|
-
Object.setPrototypeOf(this, LoginRequiredError.prototype)
|
|
10
|
-
}
|
|
11
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export class NoSessionStateError extends Error {
|
|
2
|
-
constructor(
|
|
3
|
-
public serverResponseStatus: number,
|
|
4
|
-
public sessionStateUrl: string,
|
|
5
|
-
public logUrl: string
|
|
6
|
-
) {
|
|
7
|
-
super(
|
|
8
|
-
`Could not get session state. Server responded with ${serverResponseStatus} whilst checking state: ${sessionStateUrl}`
|
|
9
|
-
)
|
|
10
|
-
|
|
11
|
-
this.name = 'NoSessionStatus'
|
|
12
|
-
|
|
13
|
-
Object.setPrototypeOf(this, NoSessionStateError.prototype)
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { decodeToken } from '@sasjs/utils/auth'
|
|
2
|
-
|
|
3
|
-
export class RootFolderNotFoundError extends Error {
|
|
4
|
-
constructor(
|
|
5
|
-
parentFolderPath: string,
|
|
6
|
-
serverUrl: string,
|
|
7
|
-
accessToken?: string
|
|
8
|
-
) {
|
|
9
|
-
let message: string =
|
|
10
|
-
`Root folder ${parentFolderPath} was not found.` +
|
|
11
|
-
`\nPlease check ${serverUrl}/SASDrive.` +
|
|
12
|
-
`\nIf the folder DOES exist then it is likely a permission problem.\n`
|
|
13
|
-
if (accessToken) {
|
|
14
|
-
const decodedToken = decodeToken(accessToken)
|
|
15
|
-
let scope = decodedToken.scope
|
|
16
|
-
scope = scope.map((element) => '* ' + element)
|
|
17
|
-
message +=
|
|
18
|
-
`Your access token contains the following scopes:\n` + scope.join('\n')
|
|
19
|
-
}
|
|
20
|
-
super(message)
|
|
21
|
-
this.name = 'RootFolderNotFoundError'
|
|
22
|
-
Object.setPrototypeOf(this, RootFolderNotFoundError.prototype)
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export class SAS9AuthError extends Error {
|
|
2
|
-
constructor() {
|
|
3
|
-
super(
|
|
4
|
-
'The credentials you provided cannot be authenticated. Please provide a valid set of credentials.'
|
|
5
|
-
)
|
|
6
|
-
this.name = 'AuthorizeError'
|
|
7
|
-
Object.setPrototypeOf(this, SAS9AuthError.prototype)
|
|
8
|
-
}
|
|
9
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export * from './ArgumentError'
|
|
2
|
-
export * from './AuthorizeError'
|
|
3
|
-
export * from './CertificateError'
|
|
4
|
-
export * from './ComputeJobExecutionError'
|
|
5
|
-
export * from './ErrorResponse'
|
|
6
|
-
export * from './InternalServerError'
|
|
7
|
-
export * from './InvalidJsonError'
|
|
8
|
-
export * from './JobExecutionError'
|
|
9
|
-
export * from './JobStatePollError'
|
|
10
|
-
export * from './JsonParseArrayError'
|
|
11
|
-
export * from './LoginRequiredError'
|
|
12
|
-
export * from './NoSessionStateError'
|
|
13
|
-
export * from './NotFoundError'
|
|
14
|
-
export * from './RootFolderNotFoundError'
|
|
15
|
-
export * from './WeboutResponseError'
|
package/src/types/index.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export * from './Context'
|
|
2
|
-
export * from './CsrfToken'
|
|
3
|
-
export * from './Folder'
|
|
4
|
-
export * from './File'
|
|
5
|
-
export * from './Job'
|
|
6
|
-
export * from './JobDefinition'
|
|
7
|
-
export * from './JobResult'
|
|
8
|
-
export * from './Link'
|
|
9
|
-
export * from './Login'
|
|
10
|
-
export * from './SASjsConfig'
|
|
11
|
-
export * from './RequestClient'
|
|
12
|
-
export * from './Session'
|
|
13
|
-
export * from './UploadFile'
|
|
14
|
-
export * from './PollOptions'
|
|
15
|
-
export * from './WriteStream'
|
|
16
|
-
export * from './ExecuteScript'
|
|
17
|
-
export * from './errors'
|
|
18
|
-
export * from './Tables'
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import 'jest-extended'
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { ExtraResponseAttributes } from '@sasjs/utils/types'
|
|
2
|
-
|
|
3
|
-
export async function appendExtraResponseAttributes(
|
|
4
|
-
response: any,
|
|
5
|
-
extraResponseAttributes: ExtraResponseAttributes[]
|
|
6
|
-
) {
|
|
7
|
-
let responseObject = {}
|
|
8
|
-
|
|
9
|
-
if (extraResponseAttributes?.length) {
|
|
10
|
-
const extraAttributes = extraResponseAttributes.reduce(
|
|
11
|
-
(map: any, obj: any) => ((map[obj] = response[obj]), map),
|
|
12
|
-
{}
|
|
13
|
-
)
|
|
14
|
-
|
|
15
|
-
responseObject = {
|
|
16
|
-
result: response.result,
|
|
17
|
-
...extraAttributes
|
|
18
|
-
}
|
|
19
|
-
} else responseObject = response.result
|
|
20
|
-
|
|
21
|
-
return responseObject
|
|
22
|
-
}
|
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
import { isSpecialMissing } from '@sasjs/utils/input/validators'
|
|
2
|
-
import { prefixMessage } from '@sasjs/utils/error'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Converts the given JSON object array to a CSV string.
|
|
6
|
-
* @param data - the array of JSON objects to convert.
|
|
7
|
-
*/
|
|
8
|
-
export const convertToCSV = (
|
|
9
|
-
data: { [key: string]: any },
|
|
10
|
-
tableName: string
|
|
11
|
-
) => {
|
|
12
|
-
if (!data[tableName]) {
|
|
13
|
-
const error = prefixMessage(
|
|
14
|
-
'No table provided to be converted to CSV.',
|
|
15
|
-
'Error while converting to CSV. '
|
|
16
|
-
)
|
|
17
|
-
|
|
18
|
-
if (typeof error === 'string') throw new Error(error)
|
|
19
|
-
|
|
20
|
-
throw error
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const table = data[tableName]
|
|
24
|
-
|
|
25
|
-
if (!Array.isArray(table)) return ''
|
|
26
|
-
|
|
27
|
-
let formats = data[`$${tableName}`]?.formats
|
|
28
|
-
let headers: string[] = []
|
|
29
|
-
let csvTest
|
|
30
|
-
let invalidString = false
|
|
31
|
-
|
|
32
|
-
if (formats) {
|
|
33
|
-
headers = Object.keys(formats).map((key) => `${key}:${formats![key]}`)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const headerFields = Object.keys(table[0])
|
|
37
|
-
|
|
38
|
-
headerFields.forEach((field) => {
|
|
39
|
-
if (!formats || !Object.keys(formats).includes(field)) {
|
|
40
|
-
let hasNullOrNumber = false
|
|
41
|
-
let hasSpecialMissingString = false
|
|
42
|
-
|
|
43
|
-
table.forEach((row: { [key: string]: any }) => {
|
|
44
|
-
if (row[field] === null || typeof row[field] === 'number') {
|
|
45
|
-
hasNullOrNumber = true
|
|
46
|
-
} else if (
|
|
47
|
-
typeof row[field] === 'string' &&
|
|
48
|
-
isSpecialMissing(row[field])
|
|
49
|
-
) {
|
|
50
|
-
hasSpecialMissingString = true
|
|
51
|
-
}
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
if (hasNullOrNumber && hasSpecialMissingString) {
|
|
55
|
-
headers.push(`${field}:best.`)
|
|
56
|
-
|
|
57
|
-
if (!formats) formats = {}
|
|
58
|
-
|
|
59
|
-
formats[field] = 'best.'
|
|
60
|
-
} else {
|
|
61
|
-
let firstFoundType: string | null = null
|
|
62
|
-
let hasMixedTypes: boolean = false
|
|
63
|
-
let rowNumError: number = -1
|
|
64
|
-
|
|
65
|
-
const longestValueForField = table
|
|
66
|
-
.map((row: any, index: number) => {
|
|
67
|
-
if (row[field] || row[field] === '') {
|
|
68
|
-
if (firstFoundType) {
|
|
69
|
-
let currentFieldType =
|
|
70
|
-
row[field] === '' || typeof row[field] === 'string'
|
|
71
|
-
? 'chars'
|
|
72
|
-
: 'number'
|
|
73
|
-
|
|
74
|
-
if (!hasMixedTypes) {
|
|
75
|
-
hasMixedTypes = currentFieldType !== firstFoundType
|
|
76
|
-
rowNumError = hasMixedTypes ? index + 1 : -1
|
|
77
|
-
}
|
|
78
|
-
} else {
|
|
79
|
-
if (row[field] === '') {
|
|
80
|
-
firstFoundType = 'chars'
|
|
81
|
-
} else {
|
|
82
|
-
firstFoundType =
|
|
83
|
-
typeof row[field] === 'string' ? 'chars' : 'number'
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
let byteSize
|
|
88
|
-
|
|
89
|
-
if (typeof row[field] === 'string') {
|
|
90
|
-
byteSize = getByteSize(row[field])
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return byteSize
|
|
94
|
-
}
|
|
95
|
-
})
|
|
96
|
-
.sort((a: any, b: any) => b - a)[0]
|
|
97
|
-
|
|
98
|
-
if (longestValueForField && longestValueForField > 32765) {
|
|
99
|
-
invalidString = true
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
if (hasMixedTypes) {
|
|
103
|
-
console.error(
|
|
104
|
-
`Row (${rowNumError}), Column (${field}) has mixed types: ERROR`
|
|
105
|
-
)
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
headers.push(
|
|
109
|
-
`${field}:${firstFoundType === 'chars' ? '$char' : ''}${
|
|
110
|
-
longestValueForField
|
|
111
|
-
? longestValueForField
|
|
112
|
-
: firstFoundType === 'chars'
|
|
113
|
-
? '1'
|
|
114
|
-
: 'best'
|
|
115
|
-
}.`
|
|
116
|
-
)
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
})
|
|
120
|
-
|
|
121
|
-
if (formats) {
|
|
122
|
-
headers = headers.sort(
|
|
123
|
-
(a, b) =>
|
|
124
|
-
headerFields.indexOf(a.replace(/:.*/, '')) -
|
|
125
|
-
headerFields.indexOf(b.replace(/:.*/, ''))
|
|
126
|
-
)
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
if (invalidString) return 'ERROR: LARGE STRING LENGTH'
|
|
130
|
-
|
|
131
|
-
csvTest = table.map((row: any) => {
|
|
132
|
-
const fields = Object.keys(row).map((fieldName, index) => {
|
|
133
|
-
let value
|
|
134
|
-
const currentCell = row[fieldName]
|
|
135
|
-
|
|
136
|
-
if (typeof currentCell === 'number') return currentCell
|
|
137
|
-
|
|
138
|
-
// stringify with replacer converts null values to empty strings
|
|
139
|
-
value = currentCell === null ? '' : currentCell
|
|
140
|
-
|
|
141
|
-
if (formats && formats[fieldName] === 'best.') {
|
|
142
|
-
if (value && !isSpecialMissing(value)) {
|
|
143
|
-
throw new Error(
|
|
144
|
-
`A Special missing value can only be a single character from 'A' to 'Z', '_', '.[a-z]', '._'`
|
|
145
|
-
)
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
const dot = value.includes('.') ? '' : '.'
|
|
149
|
-
|
|
150
|
-
return `${dot}${value.toLowerCase()}`
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
// if there any present, it should have preceding (") for escaping
|
|
154
|
-
value = value.replace(/"/g, `""`)
|
|
155
|
-
|
|
156
|
-
// also wraps the value in double quotes
|
|
157
|
-
value = `"${value}"`
|
|
158
|
-
|
|
159
|
-
if (
|
|
160
|
-
value.substring(1, value.length - 1).search(/(\t|\n|\r|,|\'|\")/gm) < 0
|
|
161
|
-
) {
|
|
162
|
-
// Remove wrapping quotes for values that don't contain special characters
|
|
163
|
-
value = value.substring(1, value.length - 1)
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
value = value.replace(/\r\n/gm, '\n')
|
|
167
|
-
|
|
168
|
-
if (value === '' && headers[index].includes('best')) {
|
|
169
|
-
value = '.'
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
return value
|
|
173
|
-
})
|
|
174
|
-
return fields.join(',')
|
|
175
|
-
})
|
|
176
|
-
|
|
177
|
-
let finalCSV =
|
|
178
|
-
headers.join(',').replace(/,/g, ' ') + '\r\n' + csvTest.join('\r\n')
|
|
179
|
-
|
|
180
|
-
return finalCSV
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Checks if table is table of formats (table name should start from '$' character).
|
|
185
|
-
* @param tableName - table name.
|
|
186
|
-
*/
|
|
187
|
-
export const isFormatsTable = (tableName: string) => /^\$.*/.test(tableName)
|
|
188
|
-
|
|
189
|
-
const getByteSize = (str: string) => {
|
|
190
|
-
let byteSize = str.length
|
|
191
|
-
for (let i = str.length - 1; i >= 0; i--) {
|
|
192
|
-
const code = str.charCodeAt(i)
|
|
193
|
-
if (code > 0x7f && code <= 0x7ff) byteSize++
|
|
194
|
-
else if (code > 0x7ff && code <= 0xffff) byteSize += 2
|
|
195
|
-
if (code >= 0xdc00 && code <= 0xdfff) i-- //trail surrogate
|
|
196
|
-
}
|
|
197
|
-
return byteSize
|
|
198
|
-
}
|
package/src/utils/delay.ts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { RequestClient } from '../request/RequestClient'
|
|
2
|
-
import { prefixMessage } from '@sasjs/utils/error'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Fetches content of the log file
|
|
6
|
-
* @param {object} requestClient - client object of Request Client.
|
|
7
|
-
* @param {string} accessToken - an access token for an authorized user.
|
|
8
|
-
* @param {string} logUrl - url of the log file.
|
|
9
|
-
* @param {number} logCount- total number of log lines in file.
|
|
10
|
-
* @returns an string containing log lines.
|
|
11
|
-
*/
|
|
12
|
-
export const fetchLogByChunks = async (
|
|
13
|
-
requestClient: RequestClient,
|
|
14
|
-
accessToken: string,
|
|
15
|
-
logUrl: string,
|
|
16
|
-
logCount: number
|
|
17
|
-
): Promise<string> => {
|
|
18
|
-
return await fetchLog(requestClient, accessToken, logUrl, 0, logCount)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Fetches a section of the log file delineated by start and end lines
|
|
23
|
-
* @param {object} requestClient - client object of Request Client.
|
|
24
|
-
* @param {string} accessToken - an access token for an authorized user.
|
|
25
|
-
* @param {string} logUrl - url of the log file.
|
|
26
|
-
* @param {number} start - the line at which to start fetching the log.
|
|
27
|
-
* @param {number} end - the line at which to stop fetching the log.
|
|
28
|
-
* @returns an string containing log lines.
|
|
29
|
-
*/
|
|
30
|
-
export const fetchLog = async (
|
|
31
|
-
requestClient: RequestClient,
|
|
32
|
-
accessToken: string,
|
|
33
|
-
logUrl: string,
|
|
34
|
-
start: number,
|
|
35
|
-
end: number
|
|
36
|
-
): Promise<string> => {
|
|
37
|
-
const logger = process.logger || console
|
|
38
|
-
|
|
39
|
-
let log: string = ''
|
|
40
|
-
|
|
41
|
-
const loglimit = end < 10000 ? end : 10000
|
|
42
|
-
do {
|
|
43
|
-
logger.info(
|
|
44
|
-
`Fetching logs from line no: ${start + 1} to ${
|
|
45
|
-
start + loglimit
|
|
46
|
-
} of ${end}.`
|
|
47
|
-
)
|
|
48
|
-
const logChunkJson = await requestClient!
|
|
49
|
-
.get<any>(`${logUrl}?start=${start}&limit=${loglimit}`, accessToken)
|
|
50
|
-
.then((res: any) => res.result)
|
|
51
|
-
.catch((err) => {
|
|
52
|
-
throw prefixMessage(err, 'Error while getting log. ')
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
if (logChunkJson.items.length === 0) break
|
|
56
|
-
|
|
57
|
-
const logChunk = logChunkJson.items.map((i: any) => i.line).join('\n')
|
|
58
|
-
log += logChunk
|
|
59
|
-
|
|
60
|
-
start += loglimit
|
|
61
|
-
} while (start < end)
|
|
62
|
-
return log
|
|
63
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { convertToCSV, isFormatsTable } from './convertToCsv'
|
|
2
|
-
import { splitChunks } from './splitChunks'
|
|
3
|
-
|
|
4
|
-
export const formatDataForRequest = (data: any) => {
|
|
5
|
-
const sasjsTables = []
|
|
6
|
-
let tableCounter = 0
|
|
7
|
-
const result: any = {}
|
|
8
|
-
|
|
9
|
-
for (const tableName in data) {
|
|
10
|
-
if (
|
|
11
|
-
isFormatsTable(tableName) &&
|
|
12
|
-
Object.keys(data).includes(tableName.replace(/^\$/, ''))
|
|
13
|
-
) {
|
|
14
|
-
continue
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
tableCounter++
|
|
18
|
-
|
|
19
|
-
// Formats table should not be sent as part of 'sasjs_tables'
|
|
20
|
-
if (!isFormatsTable(tableName)) sasjsTables.push(tableName)
|
|
21
|
-
|
|
22
|
-
const csv = convertToCSV(data, tableName)
|
|
23
|
-
|
|
24
|
-
if (csv === 'ERROR: LARGE STRING LENGTH') {
|
|
25
|
-
throw new Error(
|
|
26
|
-
'The max length of a string value in SASjs is 32765 characters.'
|
|
27
|
-
)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// if csv has length more then 16k, send in chunks
|
|
31
|
-
if (csv.length > 16000) {
|
|
32
|
-
const csvChunks = splitChunks(csv)
|
|
33
|
-
|
|
34
|
-
// append chunks to form data with same key
|
|
35
|
-
result[`sasjs${tableCounter}data0`] = csvChunks.length
|
|
36
|
-
|
|
37
|
-
csvChunks.forEach((chunk, index) => {
|
|
38
|
-
result[`sasjs${tableCounter}data${index + 1}`] = chunk
|
|
39
|
-
})
|
|
40
|
-
} else {
|
|
41
|
-
result[`sasjs${tableCounter}data`] = csv
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
result['sasjs_tables'] = sasjsTables.join(' ')
|
|
46
|
-
|
|
47
|
-
return result
|
|
48
|
-
}
|
package/src/utils/getFormData.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
interface IEnavigator {
|
|
2
|
-
userLanguage?: string
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Provides preferred language of the user.
|
|
7
|
-
* @returns A string representing the preferred language of the user, usually the language of the browser UI. Examples of valid language codes include "en", "en-US", "fr", "fr-FR", "es-ES". More info available https://datatracker.ietf.org/doc/html/rfc5646
|
|
8
|
-
*/
|
|
9
|
-
export const getUserLanguage = () =>
|
|
10
|
-
window.navigator.language || (window.navigator as IEnavigator).userLanguage
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { JsonParseArrayError, InvalidJsonError } from '../types/errors'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* if string passed then parse the string to json else if throw error for all other types unless it is not a valid json object.
|
|
5
|
-
* @param str - string to check.
|
|
6
|
-
*/
|
|
7
|
-
export const getValidJson = (str: string | object): object => {
|
|
8
|
-
try {
|
|
9
|
-
if (str === null || str === undefined) throw new InvalidJsonError()
|
|
10
|
-
|
|
11
|
-
if (Array.isArray(str)) throw new JsonParseArrayError()
|
|
12
|
-
|
|
13
|
-
if (typeof str === 'object') return str
|
|
14
|
-
|
|
15
|
-
if (str === '') return {}
|
|
16
|
-
|
|
17
|
-
return JSON.parse(str)
|
|
18
|
-
} catch (e: any) {
|
|
19
|
-
if (e instanceof JsonParseArrayError) throw e
|
|
20
|
-
|
|
21
|
-
throw new InvalidJsonError()
|
|
22
|
-
}
|
|
23
|
-
}
|