mirror of
https://github.com/sasjs/adapter.git
synced 2026-01-05 03:30:05 +00:00
Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
daeb753f9e | ||
|
|
f50a99d0b8 | ||
|
|
e6d0d3efd5 | ||
|
|
057460467c | ||
|
|
5aee9d955e | ||
|
|
7fb1da31e4 | ||
|
|
1aa92c0a69 | ||
|
|
4c097a69fd | ||
|
|
2634933e84 | ||
|
|
d60c0850c2 | ||
|
|
491bc3371c | ||
|
|
c1bab07b08 | ||
|
|
95f3ebd51d | ||
|
|
0e5b72b54f | ||
|
|
33ce592379 | ||
|
|
9f6591d7e3 | ||
|
|
5343ca00d8 |
17
PULL_REQUEST_TEMPLATE.md
Normal file
17
PULL_REQUEST_TEMPLATE.md
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
## Issue
|
||||||
|
|
||||||
|
Link any related issue(s) in this section.
|
||||||
|
|
||||||
|
## Intent
|
||||||
|
|
||||||
|
What this PR intends to achieve.
|
||||||
|
|
||||||
|
## Implementation
|
||||||
|
|
||||||
|
What code changes have been made to achieve the intent.
|
||||||
|
|
||||||
|
## Checks
|
||||||
|
|
||||||
|
- [ ] Code is formatted correctly (`npm run lint:fix`).
|
||||||
|
- [ ] All unit tests are passing (`npm test`).
|
||||||
|
- [ ] All `sasjs-tests` are passing (instructions available [here](https://github.com/sasjs/adapter/blob/master/sasjs-tests/README.md)).
|
||||||
File diff suppressed because one or more lines are too long
231
docs/classes/reflection-734.reflection-194.fileuploader.html
Normal file
231
docs/classes/reflection-734.reflection-194.fileuploader.html
Normal file
File diff suppressed because one or more lines are too long
312
docs/classes/reflection-734.reflection-194.sas9apiclient.html
Normal file
312
docs/classes/reflection-734.reflection-194.sas9apiclient.html
Normal file
File diff suppressed because one or more lines are too long
1385
docs/classes/reflection-734.reflection-194.sasjs.html
Normal file
1385
docs/classes/reflection-734.reflection-194.sasjs.html
Normal file
File diff suppressed because one or more lines are too long
1350
docs/classes/reflection-734.reflection-194.sasviyaapiclient.html
Normal file
1350
docs/classes/reflection-734.reflection-194.sasviyaapiclient.html
Normal file
File diff suppressed because one or more lines are too long
271
docs/classes/reflection-734.reflection-194.sessionmanager.html
Normal file
271
docs/classes/reflection-734.reflection-194.sessionmanager.html
Normal file
File diff suppressed because one or more lines are too long
231
docs/classes/reflection-743.reflection-195.fileuploader.html
Normal file
231
docs/classes/reflection-743.reflection-195.fileuploader.html
Normal file
File diff suppressed because one or more lines are too long
312
docs/classes/reflection-743.reflection-195.sas9apiclient.html
Normal file
312
docs/classes/reflection-743.reflection-195.sas9apiclient.html
Normal file
File diff suppressed because one or more lines are too long
1419
docs/classes/reflection-743.reflection-195.sasjs.html
Normal file
1419
docs/classes/reflection-743.reflection-195.sasjs.html
Normal file
File diff suppressed because one or more lines are too long
1415
docs/classes/reflection-743.reflection-195.sasviyaapiclient.html
Normal file
1415
docs/classes/reflection-743.reflection-195.sasviyaapiclient.html
Normal file
File diff suppressed because one or more lines are too long
271
docs/classes/reflection-743.reflection-195.sessionmanager.html
Normal file
271
docs/classes/reflection-743.reflection-195.sessionmanager.html
Normal file
File diff suppressed because one or more lines are too long
231
docs/classes/reflection-759.reflection-211.fileuploader.html
Normal file
231
docs/classes/reflection-759.reflection-211.fileuploader.html
Normal file
File diff suppressed because one or more lines are too long
312
docs/classes/reflection-759.reflection-211.sas9apiclient.html
Normal file
312
docs/classes/reflection-759.reflection-211.sas9apiclient.html
Normal file
File diff suppressed because one or more lines are too long
1430
docs/classes/reflection-759.reflection-211.sasjs.html
Normal file
1430
docs/classes/reflection-759.reflection-211.sasjs.html
Normal file
File diff suppressed because one or more lines are too long
1395
docs/classes/reflection-759.reflection-211.sasviyaapiclient.html
Normal file
1395
docs/classes/reflection-759.reflection-211.sasviyaapiclient.html
Normal file
File diff suppressed because one or more lines are too long
271
docs/classes/reflection-759.reflection-211.sessionmanager.html
Normal file
271
docs/classes/reflection-759.reflection-211.sessionmanager.html
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
372
docs/interfaces/types.contextallattributes.html
Normal file
372
docs/interfaces/types.contextallattributes.html
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
106
docs/modules/reflection-734.html
Normal file
106
docs/modules/reflection-734.html
Normal file
File diff suppressed because one or more lines are too long
128
docs/modules/reflection-734.reflection-194.html
Normal file
128
docs/modules/reflection-734.reflection-194.html
Normal file
File diff suppressed because one or more lines are too long
106
docs/modules/reflection-743.html
Normal file
106
docs/modules/reflection-743.html
Normal file
File diff suppressed because one or more lines are too long
128
docs/modules/reflection-743.reflection-195.html
Normal file
128
docs/modules/reflection-743.reflection-195.html
Normal file
File diff suppressed because one or more lines are too long
106
docs/modules/reflection-759.html
Normal file
106
docs/modules/reflection-759.html
Normal file
File diff suppressed because one or more lines are too long
128
docs/modules/reflection-759.reflection-211.html
Normal file
128
docs/modules/reflection-759.reflection-211.html
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
6
sasjs-tests/package-lock.json
generated
6
sasjs-tests/package-lock.json
generated
@@ -1357,9 +1357,9 @@
|
|||||||
"integrity": "sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw=="
|
"integrity": "sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw=="
|
||||||
},
|
},
|
||||||
"@sasjs/adapter": {
|
"@sasjs/adapter": {
|
||||||
"version": "1.3.13",
|
"version": "1.12.0",
|
||||||
"resolved": "https://registry.npmjs.org/@sasjs/adapter/-/adapter-1.3.13.tgz",
|
"resolved": "https://registry.npmjs.org/@sasjs/adapter/-/adapter-1.12.0.tgz",
|
||||||
"integrity": "sha512-dWcDxgY3FB7Yx1I5dPpeQeyJDu4lezhIFrjn6lbdwRhV15aqOt4l9o9qZP+VbgOXqyi9gN0Y+p+vs2chBDFQqg==",
|
"integrity": "sha512-0uGQH9ynomWzdBaEujEtcR38q6V7LCgG0mrb1Wellv6cC/IHD3j6WfeZZAgtiMPeOSJjbCDBOlVnzC2TlBqJFw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"es6-promise": "^4.2.8",
|
"es6-promise": "^4.2.8",
|
||||||
"form-data": "^3.0.0",
|
"form-data": "^3.0.0",
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
"homepage": ".",
|
"homepage": ".",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sasjs/adapter": "^1.3.13",
|
"@sasjs/adapter": "^1.12.0",
|
||||||
"@sasjs/test-framework": "^1.4.0",
|
"@sasjs/test-framework": "^1.4.0",
|
||||||
"@testing-library/jest-dom": "^4.2.4",
|
"@testing-library/jest-dom": "^4.2.4",
|
||||||
"@testing-library/react": "^9.5.0",
|
"@testing-library/react": "^9.5.0",
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ export const sendArrTests = (adapter: SASjs): TestSuite => ({
|
|||||||
return adapter.request("common/sendArr", data).catch((e) => e);
|
return adapter.request("common/sendArr", data).catch((e) => e);
|
||||||
},
|
},
|
||||||
assertion: (error: any) => {
|
assertion: (error: any) => {
|
||||||
return !!error && !!error.MESSAGE;
|
return !!error && !!error.body && !!error.body.message;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -185,7 +185,7 @@ export const sendObjTests = (adapter: SASjs): TestSuite => ({
|
|||||||
};
|
};
|
||||||
return adapter.request("common/sendObj", invalidData).catch((e) => e);
|
return adapter.request("common/sendObj", invalidData).catch((e) => e);
|
||||||
},
|
},
|
||||||
assertion: (error: any) => !!error && !!error.MESSAGE
|
assertion: (error: any) => !!error && !!error.body && !!error.body.message
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Single string value",
|
title: "Single string value",
|
||||||
@@ -219,7 +219,7 @@ export const sendObjTests = (adapter: SASjs): TestSuite => ({
|
|||||||
.catch((e) => e);
|
.catch((e) => e);
|
||||||
},
|
},
|
||||||
assertion: (error: any) => {
|
assertion: (error: any) => {
|
||||||
return !!error && !!error.MESSAGE;
|
return !!error && !!error.body && !!error.body.message;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import {
|
|||||||
Job,
|
Job,
|
||||||
Session,
|
Session,
|
||||||
Context,
|
Context,
|
||||||
|
ContextAllAttributes,
|
||||||
Folder,
|
Folder,
|
||||||
CsrfToken,
|
CsrfToken,
|
||||||
EditContextInput,
|
EditContextInput,
|
||||||
@@ -36,6 +37,7 @@ export class SASViyaApiClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private csrfToken: CsrfToken | null = null
|
private csrfToken: CsrfToken | null = null
|
||||||
|
private fileUploadCsrfToken: CsrfToken | null = null
|
||||||
private sessionManager = new SessionManager(
|
private sessionManager = new SessionManager(
|
||||||
this.serverUrl,
|
this.serverUrl,
|
||||||
this.contextName,
|
this.contextName,
|
||||||
@@ -223,16 +225,16 @@ export class SASViyaApiClient {
|
|||||||
* @param launchContextName - the name of the launcher context used by the compute service.
|
* @param launchContextName - the name of the launcher context used by the compute service.
|
||||||
* @param sharedAccountId - the ID of the account to run the servers for this context.
|
* @param sharedAccountId - the ID of the account to run the servers for this context.
|
||||||
* @param autoExecLines - the lines of code to execute during session initialization.
|
* @param autoExecLines - the lines of code to execute during session initialization.
|
||||||
* @param authorizedUsers - an optional list of authorized user IDs.
|
|
||||||
* @param accessToken - an access token for an authorized user.
|
* @param accessToken - an access token for an authorized user.
|
||||||
|
* @param authorizedUsers - an optional list of authorized user IDs.
|
||||||
*/
|
*/
|
||||||
public async createContext(
|
public async createContext(
|
||||||
contextName: string,
|
contextName: string,
|
||||||
launchContextName: string,
|
launchContextName: string,
|
||||||
sharedAccountId: string,
|
sharedAccountId: string,
|
||||||
autoExecLines: string[],
|
autoExecLines: string[],
|
||||||
authorizedUsers: string[],
|
accessToken?: string,
|
||||||
accessToken?: string
|
authorizedUsers?: string[]
|
||||||
) {
|
) {
|
||||||
if (!contextName) {
|
if (!contextName) {
|
||||||
throw new Error('Context name is required.')
|
throw new Error('Context name is required.')
|
||||||
@@ -312,10 +314,22 @@ export class SASViyaApiClient {
|
|||||||
headers.Authorization = `Bearer ${accessToken}`
|
headers.Authorization = `Bearer ${accessToken}`
|
||||||
}
|
}
|
||||||
|
|
||||||
const originalContext = await this.getContextByName(
|
let originalContext
|
||||||
|
|
||||||
|
originalContext = await this.getComputeContextByName(
|
||||||
contextName,
|
contextName,
|
||||||
accessToken
|
accessToken
|
||||||
)
|
).catch((_) => {})
|
||||||
|
|
||||||
|
// Try to find context by id, when context name has been changed.
|
||||||
|
if (!originalContext) {
|
||||||
|
originalContext = await this.getComputeContextById(
|
||||||
|
editedContext.id!,
|
||||||
|
accessToken
|
||||||
|
).catch((err) => {
|
||||||
|
throw err
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const { result: context, etag } = await this.request<Context>(
|
const { result: context, etag } = await this.request<Context>(
|
||||||
`${this.serverUrl}/compute/contexts/${originalContext.id}`,
|
`${this.serverUrl}/compute/contexts/${originalContext.id}`,
|
||||||
@@ -371,7 +385,7 @@ export class SASViyaApiClient {
|
|||||||
headers.Authorization = `Bearer ${accessToken}`
|
headers.Authorization = `Bearer ${accessToken}`
|
||||||
}
|
}
|
||||||
|
|
||||||
const context = await this.getContextByName(contextName, accessToken)
|
const context = await this.getComputeContextByName(contextName, accessToken)
|
||||||
|
|
||||||
const deleteContextRequest: RequestInit = {
|
const deleteContextRequest: RequestInit = {
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
@@ -931,7 +945,10 @@ export class SASViyaApiClient {
|
|||||||
|
|
||||||
if (isRelativePath(sasJob)) {
|
if (isRelativePath(sasJob)) {
|
||||||
const folderName = sasJob.split('/')[0]
|
const folderName = sasJob.split('/')[0]
|
||||||
await this.populateFolderMap(`${this.rootFolderName}/${folderName}`)
|
await this.populateFolderMap(
|
||||||
|
`${this.rootFolderName}/${folderName}`,
|
||||||
|
accessToken
|
||||||
|
)
|
||||||
|
|
||||||
if (!this.folderMap.get(`${this.rootFolderName}/${folderName}`)) {
|
if (!this.folderMap.get(`${this.rootFolderName}/${folderName}`)) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
@@ -1028,7 +1045,10 @@ export class SASViyaApiClient {
|
|||||||
|
|
||||||
if (isRelativePath(sasJob)) {
|
if (isRelativePath(sasJob)) {
|
||||||
const folderName = sasJob.split('/')[0]
|
const folderName = sasJob.split('/')[0]
|
||||||
await this.populateFolderMap(`${this.rootFolderName}/${folderName}`)
|
await this.populateFolderMap(
|
||||||
|
`${this.rootFolderName}/${folderName}`,
|
||||||
|
accessToken
|
||||||
|
)
|
||||||
|
|
||||||
if (!this.folderMap.get(`${this.rootFolderName}/${folderName}`)) {
|
if (!this.folderMap.get(`${this.rootFolderName}/${folderName}`)) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
@@ -1335,7 +1355,9 @@ export class SASViyaApiClient {
|
|||||||
|
|
||||||
const uploadResponse = await this.request<any>(
|
const uploadResponse = await this.request<any>(
|
||||||
`${this.serverUrl}/files/files#rawUpload`,
|
`${this.serverUrl}/files/files#rawUpload`,
|
||||||
createFileRequest
|
createFileRequest,
|
||||||
|
'json',
|
||||||
|
'fileUpload'
|
||||||
)
|
)
|
||||||
|
|
||||||
uploadedFiles.push({ tableName, file: uploadResponse.result })
|
uploadedFiles.push({ tableName, file: uploadResponse.result })
|
||||||
@@ -1384,7 +1406,13 @@ export class SASViyaApiClient {
|
|||||||
return `/folders/folders/${folder.id}`
|
return `/folders/folders/${folder.id}`
|
||||||
}
|
}
|
||||||
|
|
||||||
private async getContextByName(
|
/**
|
||||||
|
* Returns a JSON representation of a compute context.
|
||||||
|
* @example: { "createdBy": "admin", "links": [...], "id": "ID", "version": 2, "name": "context1" }
|
||||||
|
* @param contextName - the name of the context to return.
|
||||||
|
* @param accessToken - an access token for an authorized user.
|
||||||
|
*/
|
||||||
|
public async getComputeContextByName(
|
||||||
contextName: string,
|
contextName: string,
|
||||||
accessToken?: string
|
accessToken?: string
|
||||||
): Promise<Context> {
|
): Promise<Context> {
|
||||||
@@ -1399,9 +1427,7 @@ export class SASViyaApiClient {
|
|||||||
const { result: contexts } = await this.request<{ items: Context[] }>(
|
const { result: contexts } = await this.request<{ items: Context[] }>(
|
||||||
`${this.serverUrl}/compute/contexts?filter=eq(name, "${contextName}")`,
|
`${this.serverUrl}/compute/contexts?filter=eq(name, "${contextName}")`,
|
||||||
{ headers }
|
{ headers }
|
||||||
).catch((err) => {
|
)
|
||||||
throw err
|
|
||||||
})
|
|
||||||
|
|
||||||
if (!contexts || !(contexts.items && contexts.items.length)) {
|
if (!contexts || !(contexts.items && contexts.items.length)) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
@@ -1412,6 +1438,33 @@ export class SASViyaApiClient {
|
|||||||
return contexts.items[0]
|
return contexts.items[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a JSON representation of a compute context.
|
||||||
|
* @param contextId - an id of the context to return.
|
||||||
|
* @param accessToken - an access token for an authorized user.
|
||||||
|
*/
|
||||||
|
public async getComputeContextById(
|
||||||
|
contextId: string,
|
||||||
|
accessToken?: string
|
||||||
|
): Promise<ContextAllAttributes> {
|
||||||
|
const headers: any = {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
}
|
||||||
|
|
||||||
|
if (accessToken) {
|
||||||
|
headers.Authorization = `Bearer ${accessToken}`
|
||||||
|
}
|
||||||
|
|
||||||
|
const { result: context } = await this.request<ContextAllAttributes>(
|
||||||
|
`${this.serverUrl}/compute/contexts/${contextId}`,
|
||||||
|
{ headers }
|
||||||
|
).catch((err) => {
|
||||||
|
throw err
|
||||||
|
})
|
||||||
|
|
||||||
|
return context
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Moves a Viya folder to a new location. The folder may be renamed at the same time.
|
* Moves a Viya folder to a new location. The folder may be renamed at the same time.
|
||||||
* @param sourceFolder - the full path (eg `/Public/example/myFolder`) or URI of the source folder to be moved. Providing URI instead of path will save one extra request.
|
* @param sourceFolder - the full path (eg `/Public/example/myFolder`) or URI of the source folder to be moved. Providing URI instead of path will save one extra request.
|
||||||
@@ -1490,22 +1543,36 @@ export class SASViyaApiClient {
|
|||||||
this.setCsrfToken(csrfToken)
|
this.setCsrfToken(csrfToken)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setFileUploadCsrfToken = (csrfToken: CsrfToken) => {
|
||||||
|
this.fileUploadCsrfToken = csrfToken
|
||||||
|
}
|
||||||
|
|
||||||
private async request<T>(
|
private async request<T>(
|
||||||
url: string,
|
url: string,
|
||||||
options: RequestInit,
|
options: RequestInit,
|
||||||
contentType: 'text' | 'json' = 'json'
|
contentType: 'text' | 'json' = 'json',
|
||||||
|
type: 'fileUpload' | 'other' = 'other'
|
||||||
) {
|
) {
|
||||||
if (this.csrfToken) {
|
const callback =
|
||||||
options.headers = {
|
type === 'fileUpload'
|
||||||
...options.headers,
|
? this.setFileUploadCsrfToken
|
||||||
[this.csrfToken.headerName]: this.csrfToken.value
|
: this.setCsrfTokenLocal
|
||||||
|
|
||||||
|
if (type === 'other') {
|
||||||
|
if (this.csrfToken) {
|
||||||
|
options.headers = {
|
||||||
|
...options.headers,
|
||||||
|
[this.csrfToken.headerName]: this.csrfToken.value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (this.fileUploadCsrfToken) {
|
||||||
|
options.headers = {
|
||||||
|
...options.headers,
|
||||||
|
[this.fileUploadCsrfToken.headerName]: this.fileUploadCsrfToken.value
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return await makeRequest<T>(
|
return await makeRequest<T>(url, options, callback, contentType)
|
||||||
url,
|
|
||||||
options,
|
|
||||||
this.setCsrfTokenLocal,
|
|
||||||
contentType
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
42
src/SASjs.ts
42
src/SASjs.ts
@@ -113,16 +113,16 @@ export default class SASjs {
|
|||||||
* @param launchContextName - the name of the launcher context used by the compute service.
|
* @param launchContextName - the name of the launcher context used by the compute service.
|
||||||
* @param sharedAccountId - the ID of the account to run the servers for this context as.
|
* @param sharedAccountId - the ID of the account to run the servers for this context as.
|
||||||
* @param autoExecLines - the lines of code to execute during session initialization.
|
* @param autoExecLines - the lines of code to execute during session initialization.
|
||||||
* @param authorizedUsers - an optional list of authorized user IDs.
|
|
||||||
* @param accessToken - an access token for an authorized user.
|
* @param accessToken - an access token for an authorized user.
|
||||||
|
* @param authorizedUsers - an optional list of authorized user IDs.
|
||||||
*/
|
*/
|
||||||
public async createContext(
|
public async createContext(
|
||||||
contextName: string,
|
contextName: string,
|
||||||
launchContextName: string,
|
launchContextName: string,
|
||||||
sharedAccountId: string,
|
sharedAccountId: string,
|
||||||
autoExecLines: string[],
|
autoExecLines: string[],
|
||||||
authorizedUsers: string[],
|
accessToken: string,
|
||||||
accessToken: string
|
authorizedUsers?: string[]
|
||||||
) {
|
) {
|
||||||
this.isMethodSupported('createContext', ServerType.SASViya)
|
this.isMethodSupported('createContext', ServerType.SASViya)
|
||||||
|
|
||||||
@@ -131,8 +131,8 @@ export default class SASjs {
|
|||||||
launchContextName,
|
launchContextName,
|
||||||
sharedAccountId,
|
sharedAccountId,
|
||||||
autoExecLines,
|
autoExecLines,
|
||||||
authorizedUsers,
|
accessToken,
|
||||||
accessToken
|
authorizedUsers
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,6 +167,38 @@ export default class SASjs {
|
|||||||
return await this.sasViyaApiClient!.deleteContext(contextName, accessToken)
|
return await this.sasViyaApiClient!.deleteContext(contextName, accessToken)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a JSON representation of a compute context.
|
||||||
|
* @example: { "createdBy": "admin", "links": [...], "id": "ID", "version": 2, "name": "context1" }
|
||||||
|
* @param contextName - the name of the context to return.
|
||||||
|
* @param accessToken - an access token for an authorized user.
|
||||||
|
*/
|
||||||
|
public async getComputeContextByName(
|
||||||
|
contextName: string,
|
||||||
|
accessToken?: string
|
||||||
|
) {
|
||||||
|
this.isMethodSupported('getComputeContextByName', ServerType.SASViya)
|
||||||
|
|
||||||
|
return await this.sasViyaApiClient!.getComputeContextByName(
|
||||||
|
contextName,
|
||||||
|
accessToken
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a JSON representation of a compute context.
|
||||||
|
* @param contextId - an id of the context to return.
|
||||||
|
* @param accessToken - an access token for an authorized user.
|
||||||
|
*/
|
||||||
|
public async getComputeContextById(contextId: string, accessToken?: string) {
|
||||||
|
this.isMethodSupported('getComputeContextById', ServerType.SASViya)
|
||||||
|
|
||||||
|
return await this.sasViyaApiClient!.getComputeContextById(
|
||||||
|
contextId,
|
||||||
|
accessToken
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
public async createSession(contextName: string, accessToken: string) {
|
public async createSession(contextName: string, accessToken: string) {
|
||||||
this.isMethodSupported('createSession', ServerType.SASViya)
|
this.isMethodSupported('createSession', ServerType.SASViya)
|
||||||
|
|
||||||
|
|||||||
@@ -14,4 +14,23 @@ export interface EditContextInput {
|
|||||||
attributes?: any
|
attributes?: any
|
||||||
authorizedUsers?: string[]
|
authorizedUsers?: string[]
|
||||||
authorizeAllAuthenticatedUsers?: boolean
|
authorizeAllAuthenticatedUsers?: boolean
|
||||||
|
id?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ContextAllAttributes {
|
||||||
|
attributes: {
|
||||||
|
reuseServerProcesses: boolean
|
||||||
|
runServerAs: string
|
||||||
|
}
|
||||||
|
modifiedTimeStamp: string
|
||||||
|
createdBy: string
|
||||||
|
creationTimeStamp: string
|
||||||
|
launchType: string
|
||||||
|
launchContext: {
|
||||||
|
contextName: string
|
||||||
|
}
|
||||||
|
modifiedBy: string
|
||||||
|
id: string
|
||||||
|
version: number
|
||||||
|
name: string
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,8 +40,7 @@ const browserConfig = {
|
|||||||
filename: null,
|
filename: null,
|
||||||
exclude: [/node_modules/],
|
exclude: [/node_modules/],
|
||||||
test: /\.ts($|\?)/i
|
test: /\.ts($|\?)/i
|
||||||
}),
|
})
|
||||||
new webpack.IgnorePlugin(/\/iconv-loader$/)
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user