@sasjs/adapter 3.9.4 → 3.10.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/index.js +2 -2
- package/node/index.js +2 -2
- package/node/index.js.LICENSE.txt +1 -0
- package/package.json +12 -6
- package/src/auth/AuthManager.ts +6 -0
- package/src/job-execution/WebJobExecutor.ts +12 -8
- package/.gitpod.yml +0 -2
- package/.prettierrc +0 -6
- package/jest.config.js +0 -184
- package/tsconfig.json +0 -14
- package/tslint.json +0 -9
- package/typedoc.json +0 -13
- package/webpack.config.js +0 -79
package/package.json
CHANGED
|
@@ -8,15 +8,17 @@
|
|
|
8
8
|
"build": "rimraf build && rimraf node && mkdir node && copyfiles -u 1 \"./src/**/*\" ./node && webpack && rimraf build/src && rimraf node",
|
|
9
9
|
"package:lib": "npm run build && copyfiles ./package.json ./checkNodeVersion.js build && cd build && npm version \"5.0.0\" && npm pack",
|
|
10
10
|
"publish:lib": "npm run build && cd build && npm publish",
|
|
11
|
-
"lint:fix": "npx prettier --loglevel silent --write \"src/**/*.{ts,tsx,js,jsx,html,css,sass,less,json,yml,md,graphql}\" && npx prettier --loglevel silent --write \"sasjs-tests/src/**/*.{ts,tsx,js,jsx,html,css,sass,less,json,yml,md,graphql}\"",
|
|
12
|
-
"lint": "npx prettier --check \"src/**/*.{ts,tsx,js,jsx,html,css,sass,less,json,yml,md,graphql}\" && npx prettier --check \"sasjs-tests/src/**/*.{ts,tsx,js,jsx,html,css,sass,less,json,yml,md,graphql}\"",
|
|
13
|
-
"lint:silent": "npx prettier --loglevel silent --check \"src/**/*.{ts,tsx,js,jsx,html,css,sass,less,json,yml,md,graphql}\" && npx prettier --loglevel silent --check \"sasjs-tests/src/**/*.{ts,tsx,js,jsx,html,css,sass,less,json,yml,md,graphql}\"",
|
|
11
|
+
"lint:fix": "npx prettier --loglevel silent --write \"src/**/*.{ts,tsx,js,jsx,html,css,sass,less,json,yml,md,graphql}\" && npx prettier --loglevel silent --write \"sasjs-tests/src/**/*.{ts,tsx,js,jsx,html,css,sass,less,json,yml,md,graphql}\" && npx prettier --loglevel silent --write \"cypress/**/*.{ts,tsx,js,jsx,html,css,sass,less,json,yml,md,graphql}\"",
|
|
12
|
+
"lint": "npx prettier --check \"src/**/*.{ts,tsx,js,jsx,html,css,sass,less,json,yml,md,graphql}\" && npx prettier --check \"sasjs-tests/src/**/*.{ts,tsx,js,jsx,html,css,sass,less,json,yml,md,graphql}\" && npx prettier --check \"cypress/**/*.{ts,tsx,js,jsx,html,css,sass,less,json,yml,md,graphql}\"",
|
|
13
|
+
"lint:silent": "npx prettier --loglevel silent --check \"src/**/*.{ts,tsx,js,jsx,html,css,sass,less,json,yml,md,graphql}\" && npx prettier --loglevel silent --check \"sasjs-tests/src/**/*.{ts,tsx,js,jsx,html,css,sass,less,json,yml,md,graphql}\" && npx prettier --loglevel silent --check \"cypress/**/*.{ts,tsx,js,jsx,html,css,sass,less,json,yml,md,graphql}\"",
|
|
14
14
|
"test": "jest --silent --coverage",
|
|
15
15
|
"prepublishOnly": "cp -r ./build/* . && rm -rf ./build",
|
|
16
16
|
"postpublish": "git clean -fd",
|
|
17
17
|
"semantic-release": "semantic-release",
|
|
18
18
|
"typedoc": "node createTSDocs",
|
|
19
|
-
"prepare": "git rev-parse --git-dir && git config core.hooksPath ./.git-hooks && git config core.autocrlf false || true"
|
|
19
|
+
"prepare": "git rev-parse --git-dir && git config core.hooksPath ./.git-hooks && git config core.autocrlf false || true",
|
|
20
|
+
"cypress": "cypress open",
|
|
21
|
+
"cy:run": "cypress run"
|
|
20
22
|
},
|
|
21
23
|
"publishConfig": {
|
|
22
24
|
"access": "public"
|
|
@@ -41,9 +43,13 @@
|
|
|
41
43
|
},
|
|
42
44
|
"license": "ISC",
|
|
43
45
|
"devDependencies": {
|
|
46
|
+
"@cypress/webpack-preprocessor": "5.9.1",
|
|
47
|
+
"@types/form-data": "2.5.0",
|
|
48
|
+
"cypress": "7.7.0",
|
|
49
|
+
"typedoc-neo-theme": "1.1.1",
|
|
50
|
+
"typedoc-plugin-external-module-name": "4.0.6",
|
|
44
51
|
"@types/axios": "0.14.0",
|
|
45
52
|
"@types/express": "4.17.13",
|
|
46
|
-
"@types/form-data": "2.5.0",
|
|
47
53
|
"@types/jest": "27.4.0",
|
|
48
54
|
"@types/mime": "2.0.3",
|
|
49
55
|
"@types/pem": "1.9.6",
|
|
@@ -80,5 +86,5 @@
|
|
|
80
86
|
"https": "1.0.0",
|
|
81
87
|
"tough-cookie": "4.0.0"
|
|
82
88
|
},
|
|
83
|
-
"version": "3.
|
|
89
|
+
"version": "3.10.0"
|
|
84
90
|
}
|
package/src/auth/AuthManager.ts
CHANGED
|
@@ -257,6 +257,12 @@ export class AuthManager {
|
|
|
257
257
|
const isLoggedIn = loginResponse !== 'authErr'
|
|
258
258
|
const userName = isLoggedIn ? this.extractUserName(loginResponse) : ''
|
|
259
259
|
|
|
260
|
+
if (!isLoggedIn) {
|
|
261
|
+
//We will logout to make sure cookies are removed and login form is presented
|
|
262
|
+
//Residue can happen in case of session expiration
|
|
263
|
+
await this.logOut()
|
|
264
|
+
}
|
|
265
|
+
|
|
260
266
|
return { isLoggedIn, userName }
|
|
261
267
|
}
|
|
262
268
|
|
|
@@ -92,7 +92,7 @@ export class WebJobExecutor extends BaseJobExecutor {
|
|
|
92
92
|
if (jobUri.length > 0) {
|
|
93
93
|
apiUrl += '&_job=' + jobUri
|
|
94
94
|
/**
|
|
95
|
-
* Using both _job and _program parameters will cause a conflict in the JES web app, as it
|
|
95
|
+
* Using both _job and _program parameters will cause a conflict in the JES web app, as it's not clear whether or not the server should make the extra fetch for the job uri.
|
|
96
96
|
* To handle this, we add the extra underscore and recreate the _program variable in the SAS side of the SASjs adapter so it remains available for backend developers.
|
|
97
97
|
*/
|
|
98
98
|
apiUrl = apiUrl.replace('_program=', '__program=')
|
|
@@ -169,13 +169,17 @@ export class WebJobExecutor extends BaseJobExecutor {
|
|
|
169
169
|
? res.result.log.map((logLine: any) => logLine.line).join('\n')
|
|
170
170
|
: res.result.log
|
|
171
171
|
|
|
172
|
-
const resObj =
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
172
|
+
const resObj = res
|
|
173
|
+
|
|
174
|
+
if (this.serverType === ServerType.Sasjs) {
|
|
175
|
+
if (res.result._webout < 1)
|
|
176
|
+
throw new JobExecutionError(
|
|
177
|
+
0,
|
|
178
|
+
'Job execution failed',
|
|
179
|
+
parsedSasjsServerLog
|
|
180
|
+
)
|
|
181
|
+
}
|
|
182
|
+
|
|
179
183
|
this.requestClient!.appendRequest(resObj, sasJob, config.debug)
|
|
180
184
|
|
|
181
185
|
let jsonResponse = res.result
|
package/.gitpod.yml
DELETED
package/.prettierrc
DELETED
package/jest.config.js
DELETED
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
// For a detailed explanation regarding each configuration property, visit:
|
|
2
|
-
// https://jestjs.io/docs/en/configuration.html
|
|
3
|
-
|
|
4
|
-
module.exports = {
|
|
5
|
-
testTimeout: 90000,
|
|
6
|
-
// All imported modules in your tests should be mocked automatically
|
|
7
|
-
// automock: false,
|
|
8
|
-
|
|
9
|
-
// Stop running tests after `n` failures
|
|
10
|
-
// bail: 1,
|
|
11
|
-
|
|
12
|
-
// Respect "browser" field in package.json when resolving modules
|
|
13
|
-
// browser: false,
|
|
14
|
-
|
|
15
|
-
// The directory where Jest should store its cached dependency information
|
|
16
|
-
// cacheDirectory: "/private/var/folders/7y/nmqg1srj29q6210rs9dfsdzc0000gn/T/jest_dx",
|
|
17
|
-
|
|
18
|
-
// Automatically clear mock calls and instances between every test
|
|
19
|
-
clearMocks: true,
|
|
20
|
-
|
|
21
|
-
// Indicates whether the coverage information should be collected while executing the test
|
|
22
|
-
// collectCoverage: false,
|
|
23
|
-
|
|
24
|
-
// An array of glob patterns indicating a set of files for which coverage information should be collected
|
|
25
|
-
// collectCoverageFrom: undefined,
|
|
26
|
-
|
|
27
|
-
// The directory where Jest should output its coverage files
|
|
28
|
-
coverageDirectory: 'coverage',
|
|
29
|
-
|
|
30
|
-
// An array of regexp pattern strings used to skip coverage collection
|
|
31
|
-
// coveragePathIgnorePatterns: [
|
|
32
|
-
// "/node_modules/"
|
|
33
|
-
// ],
|
|
34
|
-
|
|
35
|
-
// A list of reporter names that Jest uses when writing coverage reports
|
|
36
|
-
// coverageReporters: [
|
|
37
|
-
// "json",
|
|
38
|
-
// "text",
|
|
39
|
-
// "lcov",
|
|
40
|
-
// "clover"
|
|
41
|
-
// ],
|
|
42
|
-
|
|
43
|
-
// An object that configures minimum threshold enforcement for coverage results
|
|
44
|
-
// coverageThreshold: undefined,
|
|
45
|
-
|
|
46
|
-
// A path to a custom dependency extractor
|
|
47
|
-
// dependencyExtractor: undefined,
|
|
48
|
-
|
|
49
|
-
// Make calling deprecated APIs throw helpful error messages
|
|
50
|
-
// errorOnDeprecated: false,
|
|
51
|
-
|
|
52
|
-
// Force coverage collection from ignored files using an array of glob patterns
|
|
53
|
-
// forceCoverageMatch: [],
|
|
54
|
-
|
|
55
|
-
// A path to a module which exports an async function that is triggered once before all test suites
|
|
56
|
-
// globalSetup: undefined,
|
|
57
|
-
|
|
58
|
-
// A path to a module which exports an async function that is triggered once after all test suites
|
|
59
|
-
// globalTeardown: undefined,
|
|
60
|
-
|
|
61
|
-
// A set of global variables that need to be available in all test environments
|
|
62
|
-
// globals: {},
|
|
63
|
-
|
|
64
|
-
// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
|
|
65
|
-
// maxWorkers: "50%",
|
|
66
|
-
|
|
67
|
-
// An array of directory names to be searched recursively up from the requiring module's location
|
|
68
|
-
// moduleDirectories: [
|
|
69
|
-
// "node_modules"
|
|
70
|
-
// ],
|
|
71
|
-
|
|
72
|
-
// An array of file extensions your modules use
|
|
73
|
-
// moduleFileExtensions: [
|
|
74
|
-
// "js",
|
|
75
|
-
// "json",
|
|
76
|
-
// "jsx",
|
|
77
|
-
// "ts",
|
|
78
|
-
// "tsx",
|
|
79
|
-
// "node"
|
|
80
|
-
// ],
|
|
81
|
-
|
|
82
|
-
// A map from regular expressions to module names that allow to stub out resources with a single module
|
|
83
|
-
moduleNameMapper: {},
|
|
84
|
-
|
|
85
|
-
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
|
|
86
|
-
// modulePathIgnorePatterns: [],
|
|
87
|
-
|
|
88
|
-
// Activates notifications for test results
|
|
89
|
-
// notify: false,
|
|
90
|
-
|
|
91
|
-
// An enum that specifies notification mode. Requires { notify: true }
|
|
92
|
-
// notifyMode: "failure-change",
|
|
93
|
-
|
|
94
|
-
// A preset that is used as a base for Jest's configuration
|
|
95
|
-
preset: 'ts-jest/presets/js-with-ts',
|
|
96
|
-
|
|
97
|
-
// Run tests from one or more projects
|
|
98
|
-
// projects: undefined,
|
|
99
|
-
|
|
100
|
-
// Use this configuration option to add custom reporters to Jest
|
|
101
|
-
// reporters: undefined,
|
|
102
|
-
|
|
103
|
-
// Automatically reset mock state between every test
|
|
104
|
-
// resetMocks: false,
|
|
105
|
-
|
|
106
|
-
// Reset the module registry before running each individual test
|
|
107
|
-
// resetModules: false,
|
|
108
|
-
|
|
109
|
-
// A path to a custom resolver
|
|
110
|
-
// resolver: undefined,
|
|
111
|
-
|
|
112
|
-
// Automatically restore mock state between every test
|
|
113
|
-
// restoreMocks: false,
|
|
114
|
-
|
|
115
|
-
// The root directory that Jest should scan for tests and modules within
|
|
116
|
-
// rootDir: undefined,
|
|
117
|
-
|
|
118
|
-
// A list of paths to directories that Jest should use to search for files in
|
|
119
|
-
// roots: [
|
|
120
|
-
// "<rootDir>"
|
|
121
|
-
// ],
|
|
122
|
-
|
|
123
|
-
// Allows you to use a custom runner instead of Jest's default test runner
|
|
124
|
-
// runner: "jest-runner",
|
|
125
|
-
|
|
126
|
-
// The paths to modules that run some code to configure or set up the testing environment before each test
|
|
127
|
-
setupFiles: [],
|
|
128
|
-
|
|
129
|
-
// A list of paths to modules that run some code to configure or set up the testing framework before each test
|
|
130
|
-
setupFilesAfterEnv: ['jest-extended/all'],
|
|
131
|
-
|
|
132
|
-
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
|
|
133
|
-
// snapshotSerializers: [],
|
|
134
|
-
|
|
135
|
-
// Options that will be passed to the testEnvironment
|
|
136
|
-
// testEnvironmentOptions: {},
|
|
137
|
-
|
|
138
|
-
// Adds a location field to test results
|
|
139
|
-
// testLocationInResults: false,
|
|
140
|
-
|
|
141
|
-
// The glob patterns Jest uses to detect test files
|
|
142
|
-
testMatch: ['**/*spec.[j|t]s?(x)'],
|
|
143
|
-
|
|
144
|
-
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
|
|
145
|
-
testPathIgnorePatterns: ['/node_modules/', '/build'],
|
|
146
|
-
|
|
147
|
-
// The regexp pattern or array of patterns that Jest uses to detect test files
|
|
148
|
-
// testRegex: [],
|
|
149
|
-
|
|
150
|
-
// This option allows the use of a custom results processor
|
|
151
|
-
// testResultsProcessor: undefined,
|
|
152
|
-
|
|
153
|
-
// This option allows use of a custom test runner
|
|
154
|
-
// testRunner: "jasmine2",
|
|
155
|
-
|
|
156
|
-
// This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
|
|
157
|
-
// testURL: "http://localhost",
|
|
158
|
-
|
|
159
|
-
// Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
|
|
160
|
-
// timers: "real",
|
|
161
|
-
|
|
162
|
-
// A map from regular expressions to paths to transformers
|
|
163
|
-
transform: {
|
|
164
|
-
'^.+\\.ts?$': 'ts-jest'
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
|
|
168
|
-
// transformIgnorePatterns: [
|
|
169
|
-
// '**/test/**/*.ts?(x)',
|
|
170
|
-
// '**/?(*.)+(spec|test).ts?(x)'
|
|
171
|
-
// ]
|
|
172
|
-
|
|
173
|
-
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
|
|
174
|
-
// unmockedModulePathPatterns: undefined,
|
|
175
|
-
|
|
176
|
-
// Indicates whether each individual test should be reported during the run
|
|
177
|
-
// verbose: undefined,
|
|
178
|
-
|
|
179
|
-
// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
|
|
180
|
-
// watchPathIgnorePatterns: [],
|
|
181
|
-
|
|
182
|
-
// Whether to use watchman for file crawling
|
|
183
|
-
// watchman: true,
|
|
184
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"lib": ["ES2018", "DOM", "ES2019.String"],
|
|
4
|
-
"target": "es5",
|
|
5
|
-
"module": "commonjs",
|
|
6
|
-
"declaration": true,
|
|
7
|
-
"outDir": "./build",
|
|
8
|
-
"strict": true,
|
|
9
|
-
"sourceMap": true,
|
|
10
|
-
"typeRoots": ["./node_modules/@types", "./src/types/system"]
|
|
11
|
-
},
|
|
12
|
-
"include": ["src"],
|
|
13
|
-
"exclude": ["node_modules"]
|
|
14
|
-
}
|
package/tslint.json
DELETED
package/typedoc.json
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"out": "docs",
|
|
3
|
-
"exclude": ["**/*+(index|.spec|.e2e).ts"],
|
|
4
|
-
"excludeExternals": true,
|
|
5
|
-
"excludePrivate": true,
|
|
6
|
-
"entryPoints": [
|
|
7
|
-
"src/SASjs.ts",
|
|
8
|
-
"src/SAS9ApiClient.ts",
|
|
9
|
-
"src/SASjsApiClient.ts",
|
|
10
|
-
"src/SASViyaApiClient.ts",
|
|
11
|
-
"src/types"
|
|
12
|
-
]
|
|
13
|
-
}
|
package/webpack.config.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
const path = require('path')
|
|
2
|
-
const webpack = require('webpack')
|
|
3
|
-
const terserPlugin = require('terser-webpack-plugin')
|
|
4
|
-
const nodePolyfillPlugin = require('node-polyfill-webpack-plugin')
|
|
5
|
-
|
|
6
|
-
const defaultPlugins = [
|
|
7
|
-
new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /en/),
|
|
8
|
-
new webpack.SourceMapDevToolPlugin({
|
|
9
|
-
filename: null,
|
|
10
|
-
exclude: [/node_modules/],
|
|
11
|
-
test: /\.ts($|\?)/i
|
|
12
|
-
})
|
|
13
|
-
]
|
|
14
|
-
|
|
15
|
-
const optimization = {
|
|
16
|
-
minimize: true,
|
|
17
|
-
minimizer: [
|
|
18
|
-
new terserPlugin({
|
|
19
|
-
parallel: true,
|
|
20
|
-
terserOptions: {}
|
|
21
|
-
})
|
|
22
|
-
]
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const browserConfig = {
|
|
26
|
-
entry: './src/index.ts',
|
|
27
|
-
devtool: 'inline-source-map',
|
|
28
|
-
mode: 'production',
|
|
29
|
-
optimization: optimization,
|
|
30
|
-
module: {
|
|
31
|
-
rules: [
|
|
32
|
-
{
|
|
33
|
-
test: /\.ts?$/,
|
|
34
|
-
use: 'ts-loader',
|
|
35
|
-
exclude: /node_modules/
|
|
36
|
-
}
|
|
37
|
-
]
|
|
38
|
-
},
|
|
39
|
-
resolve: {
|
|
40
|
-
extensions: ['.ts', '.js'],
|
|
41
|
-
fallback: { https: false, fs: false, readline: false }
|
|
42
|
-
},
|
|
43
|
-
output: {
|
|
44
|
-
filename: 'index.js',
|
|
45
|
-
path: path.resolve(__dirname, 'build'),
|
|
46
|
-
libraryTarget: 'umd',
|
|
47
|
-
library: 'SASjs'
|
|
48
|
-
},
|
|
49
|
-
plugins: [
|
|
50
|
-
...defaultPlugins,
|
|
51
|
-
new webpack.ProvidePlugin({
|
|
52
|
-
process: 'process/browser'
|
|
53
|
-
}),
|
|
54
|
-
new nodePolyfillPlugin()
|
|
55
|
-
]
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const browserConfigWithoutProcessPlugin = {
|
|
59
|
-
entry: browserConfig.entry,
|
|
60
|
-
devtool: browserConfig.devtool,
|
|
61
|
-
mode: browserConfig.mode,
|
|
62
|
-
optimization: optimization,
|
|
63
|
-
module: browserConfig.module,
|
|
64
|
-
resolve: browserConfig.resolve,
|
|
65
|
-
output: browserConfig.output,
|
|
66
|
-
plugins: defaultPlugins
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const nodeConfig = {
|
|
70
|
-
...browserConfigWithoutProcessPlugin,
|
|
71
|
-
target: 'node',
|
|
72
|
-
entry: './node/index.ts',
|
|
73
|
-
output: {
|
|
74
|
-
...browserConfig.output,
|
|
75
|
-
path: path.resolve(__dirname, 'build', 'node')
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
module.exports = [browserConfig, nodeConfig]
|