@sasjs/adapter 4.16.5 → 4.16.6
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/SASViyaApiClient.d.ts +4 -0
- package/index-dev.js +5 -3
- package/index.js +5 -3
- package/minified_sas9.js +1 -1
- package/node/SASViyaApiClient.d.ts +4 -0
- package/node/index.js +29 -4
- package/package.json +4 -4
- package/src/ContextManager.ts +16 -11
- package/src/SASViyaApiClient.ts +2 -3
- package/src/SASjs.ts +2 -2
- package/src/api/viya/executeOnComputeApi.ts +2 -3
- package/src/auth/AuthManager.ts +4 -4
- package/src/job-execution/ComputeJobExecutor.ts +4 -1
- package/src/job-execution/JesJobExecutor.ts +4 -1
- package/src/job-execution/JobExecutor.ts +4 -1
- package/src/types/errors/AuthorizeError.ts +4 -1
- package/src/types/errors/ComputeJobExecutionError.ts +4 -1
- package/src/types/errors/JobStatePollError.ts +4 -1
- package/src/utils/convertToCsv.ts +2 -2
package/package.json
CHANGED
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
"build": "npm run nodeVersionMessage && npx rimraf build && npx rimraf node && mkdir node && copyfiles -u 1 \"./src/**/*\" ./node && webpack && npx rimraf build/src && npx rimraf node",
|
|
8
8
|
"package:lib": "npm run build && copyfiles ./package.json build && cd build && npm version \"5.0.0\" && npm pack",
|
|
9
9
|
"publish:lib": "npm run build && cd build && npm publish",
|
|
10
|
-
"lint:fix": "npx prettier --
|
|
10
|
+
"lint:fix": "npx prettier --log-level silent --write \"src/**/*.{ts,tsx,js,jsx,html,css,sass,less,json,yml,md,graphql}\" && npx prettier --log-level silent --write \"sasjs-tests/src/**/*.{ts,tsx,js,jsx,html,css,sass,less,json,yml,md,graphql}\" && npx prettier --log-level silent --write \"cypress/**/*.{ts,tsx,js,jsx,html,css,sass,less,json,yml,md,graphql}\"",
|
|
11
11
|
"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}\"",
|
|
12
|
-
"lint:silent": "npx prettier --
|
|
12
|
+
"lint:silent": "npx prettier --log-level silent --check \"src/**/*.{ts,tsx,js,jsx,html,css,sass,less,json,yml,md,graphql}\" && npx prettier --log-level silent --check \"sasjs-tests/src/**/*.{ts,tsx,js,jsx,html,css,sass,less,json,yml,md,graphql}\" && npx prettier --log-level silent --check \"cypress/**/*.{ts,tsx,js,jsx,html,css,sass,less,json,yml,md,graphql}\"",
|
|
13
13
|
"test": "jest --silent --coverage",
|
|
14
14
|
"publishInit": "cp -r ./build/* . && rm -rf ./build",
|
|
15
15
|
"semantic-release": "semantic-release",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"node-polyfill-webpack-plugin": "1.1.4",
|
|
61
61
|
"path": "0.12.7",
|
|
62
62
|
"pem": "1.14.5",
|
|
63
|
-
"prettier": "
|
|
63
|
+
"prettier": "3.8.2",
|
|
64
64
|
"process": "0.11.10",
|
|
65
65
|
"semantic-release": "19.0.3",
|
|
66
66
|
"terser-webpack-plugin": "5.3.6",
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"https": "1.0.0",
|
|
84
84
|
"tough-cookie": "4.1.3"
|
|
85
85
|
},
|
|
86
|
-
"version": "4.16.
|
|
86
|
+
"version": "4.16.6"
|
|
87
87
|
}
|
package/src/ContextManager.ts
CHANGED
|
@@ -32,16 +32,18 @@ export class ContextManager {
|
|
|
32
32
|
return this.defaultLauncherContexts
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
constructor(
|
|
35
|
+
constructor(
|
|
36
|
+
private serverUrl: string,
|
|
37
|
+
private requestClient: RequestClient
|
|
38
|
+
) {
|
|
36
39
|
if (serverUrl) isUrl(serverUrl)
|
|
37
40
|
}
|
|
38
41
|
|
|
39
42
|
public async getComputeContexts(accessToken?: string) {
|
|
40
43
|
const { result: contexts } = await this.requestClient
|
|
41
|
-
.get<{
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
)
|
|
44
|
+
.get<{
|
|
45
|
+
items: Context[]
|
|
46
|
+
}>(`${this.serverUrl}/compute/contexts?limit=10000`, accessToken)
|
|
45
47
|
.catch((err) => {
|
|
46
48
|
throw prefixMessage(err, 'Error while getting compute contexts. ')
|
|
47
49
|
})
|
|
@@ -59,10 +61,9 @@ export class ContextManager {
|
|
|
59
61
|
|
|
60
62
|
public async getLauncherContexts(accessToken?: string) {
|
|
61
63
|
const { result: contexts } = await this.requestClient
|
|
62
|
-
.get<{
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
)
|
|
64
|
+
.get<{
|
|
65
|
+
items: Context[]
|
|
66
|
+
}>(`${this.serverUrl}/launcher/contexts?limit=10000`, accessToken)
|
|
66
67
|
.catch((err) => {
|
|
67
68
|
throw prefixMessage(err, 'Error while getting launcher contexts. ')
|
|
68
69
|
})
|
|
@@ -291,7 +292,9 @@ export class ContextManager {
|
|
|
291
292
|
accessToken?: string
|
|
292
293
|
): Promise<Context> {
|
|
293
294
|
const { result: contexts } = await this.requestClient
|
|
294
|
-
.get<{
|
|
295
|
+
.get<{
|
|
296
|
+
items: Context[]
|
|
297
|
+
}>(
|
|
295
298
|
`${this.serverUrl}/compute/contexts?filter=eq(name, "${contextName}")`,
|
|
296
299
|
accessToken
|
|
297
300
|
)
|
|
@@ -332,7 +335,9 @@ export class ContextManager {
|
|
|
332
335
|
authConfig?: AuthConfig
|
|
333
336
|
) {
|
|
334
337
|
const { result: contexts } = await this.requestClient
|
|
335
|
-
.get<{
|
|
338
|
+
.get<{
|
|
339
|
+
items: Context[]
|
|
340
|
+
}>(
|
|
336
341
|
`${this.serverUrl}/compute/contexts?limit=10000`,
|
|
337
342
|
authConfig?.access_token
|
|
338
343
|
)
|
package/src/SASViyaApiClient.ts
CHANGED
|
@@ -1026,9 +1026,8 @@ export class SASViyaApiClient {
|
|
|
1026
1026
|
}
|
|
1027
1027
|
|
|
1028
1028
|
files.forEach((fileInfo, index) => {
|
|
1029
|
-
jobArguments[
|
|
1030
|
-
|
|
1031
|
-
] = `/files/files/${fileInfo.file.id}`
|
|
1029
|
+
jobArguments[`_webin_fileuri${index + 1}`] =
|
|
1030
|
+
`/files/files/${fileInfo.file.id}`
|
|
1032
1031
|
jobArguments[`_webin_name${index + 1}`] = fileInfo.tableName
|
|
1033
1032
|
})
|
|
1034
1033
|
|
package/src/SASjs.ts
CHANGED
|
@@ -1063,8 +1063,8 @@ export default class SASjs {
|
|
|
1063
1063
|
this.sasjsConfig.serverType === ServerType.SasViya
|
|
1064
1064
|
? this.sasjsConfig.pathSASViya
|
|
1065
1065
|
: this.sasjsConfig.serverType === ServerType.Sas9
|
|
1066
|
-
|
|
1067
|
-
|
|
1066
|
+
? this.sasjsConfig.pathSAS9
|
|
1067
|
+
: this.sasjsConfig.pathSASJS
|
|
1068
1068
|
|
|
1069
1069
|
this.authManager = new AuthManager(
|
|
1070
1070
|
this.sasjsConfig.serverUrl,
|
|
@@ -125,9 +125,8 @@ export async function executeOnComputeApi(
|
|
|
125
125
|
jobVariables['_webin_file_count'] = files.length
|
|
126
126
|
|
|
127
127
|
files.forEach((fileInfo, index) => {
|
|
128
|
-
jobVariables[
|
|
129
|
-
|
|
130
|
-
] = `/files/files/${fileInfo.file.id}`
|
|
128
|
+
jobVariables[`_webin_fileuri${index + 1}`] =
|
|
129
|
+
`/files/files/${fileInfo.file.id}`
|
|
131
130
|
jobVariables[`_webin_name${index + 1}`] = fileInfo.tableName
|
|
132
131
|
})
|
|
133
132
|
} else {
|
package/src/auth/AuthManager.ts
CHANGED
|
@@ -27,8 +27,8 @@ export class AuthManager {
|
|
|
27
27
|
this.serverType === ServerType.Sas9
|
|
28
28
|
? '/SASLogon/logout?'
|
|
29
29
|
: this.serverType === ServerType.SasViya
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
? '/SASLogon/logout.do?'
|
|
31
|
+
: '/SASLogon/logout'
|
|
32
32
|
|
|
33
33
|
this.redirectedLoginUrl = this.serverUrl + this.redirectedLoginUrl
|
|
34
34
|
}
|
|
@@ -269,8 +269,8 @@ export class AuthManager {
|
|
|
269
269
|
this.serverType === ServerType.SasViya
|
|
270
270
|
? `${this.serverUrl}/identities/users/@currentUser`
|
|
271
271
|
: this.serverType === ServerType.Sas9
|
|
272
|
-
|
|
273
|
-
|
|
272
|
+
? `${this.serverUrl}/SASStoredProcess`
|
|
273
|
+
: `${this.serverUrl}/SASjsApi/session`
|
|
274
274
|
|
|
275
275
|
const { result: loginResponse } = await this.requestClient
|
|
276
276
|
.get<string>(url, undefined, 'text/plain')
|
|
@@ -8,7 +8,10 @@ import {
|
|
|
8
8
|
import { BaseJobExecutor } from './JobExecutor'
|
|
9
9
|
|
|
10
10
|
export class ComputeJobExecutor extends BaseJobExecutor {
|
|
11
|
-
constructor(
|
|
11
|
+
constructor(
|
|
12
|
+
serverUrl: string,
|
|
13
|
+
private sasViyaApiClient: SASViyaApiClient
|
|
14
|
+
) {
|
|
12
15
|
super(serverUrl, ServerType.SasViya)
|
|
13
16
|
}
|
|
14
17
|
|
|
@@ -10,7 +10,10 @@ import { BaseJobExecutor } from './JobExecutor'
|
|
|
10
10
|
import { appendExtraResponseAttributes } from '../utils'
|
|
11
11
|
|
|
12
12
|
export class JesJobExecutor extends BaseJobExecutor {
|
|
13
|
-
constructor(
|
|
13
|
+
constructor(
|
|
14
|
+
serverUrl: string,
|
|
15
|
+
private sasViyaApiClient: SASViyaApiClient
|
|
16
|
+
) {
|
|
14
17
|
super(serverUrl, ServerType.SasViya)
|
|
15
18
|
}
|
|
16
19
|
|
|
@@ -17,7 +17,10 @@ export interface JobExecutor {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export abstract class BaseJobExecutor implements JobExecutor {
|
|
20
|
-
constructor(
|
|
20
|
+
constructor(
|
|
21
|
+
protected serverUrl: string,
|
|
22
|
+
protected serverType: ServerType
|
|
23
|
+
) {}
|
|
21
24
|
|
|
22
25
|
private waitingRequests: ExecuteFunction[] = []
|
|
23
26
|
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export class AuthorizeError extends Error {
|
|
2
|
-
constructor(
|
|
2
|
+
constructor(
|
|
3
|
+
public message: string,
|
|
4
|
+
public confirmUrl: string
|
|
5
|
+
) {
|
|
3
6
|
super(message)
|
|
4
7
|
this.name = 'AuthorizeError'
|
|
5
8
|
Object.setPrototypeOf(this, AuthorizeError.prototype)
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { Job } from '../Job'
|
|
2
2
|
|
|
3
3
|
export class ComputeJobExecutionError extends Error {
|
|
4
|
-
constructor(
|
|
4
|
+
constructor(
|
|
5
|
+
public job: Job,
|
|
6
|
+
public log: string
|
|
7
|
+
) {
|
|
5
8
|
super('Error: Job execution failed')
|
|
6
9
|
this.name = 'ComputeJobExecutionError'
|
|
7
10
|
Object.setPrototypeOf(this, ComputeJobExecutionError.prototype)
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export class JobStatePollError extends Error {
|
|
2
|
-
constructor(
|
|
2
|
+
constructor(
|
|
3
|
+
id: string,
|
|
4
|
+
public originalError: Error
|
|
5
|
+
) {
|
|
3
6
|
super(
|
|
4
7
|
`Error while polling job state for job ${id}: ${
|
|
5
8
|
originalError.message || originalError
|