mirror of
https://github.com/sasjs/adapter.git
synced 2025-12-11 09:24:35 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d8467c24b1 | ||
|
|
fc9056c1ac | ||
|
|
9b1d295b82 | ||
|
|
99d0b01a24 | ||
|
|
131c672020 | ||
|
|
338f2fb2dd | ||
|
|
4552a9a856 |
File diff suppressed because one or more lines are too long
231
docs/classes/reflection-762.reflection-214.fileuploader.html
Normal file
231
docs/classes/reflection-762.reflection-214.fileuploader.html
Normal file
File diff suppressed because one or more lines are too long
312
docs/classes/reflection-762.reflection-214.sas9apiclient.html
Normal file
312
docs/classes/reflection-762.reflection-214.sas9apiclient.html
Normal file
File diff suppressed because one or more lines are too long
1430
docs/classes/reflection-762.reflection-214.sasjs.html
Normal file
1430
docs/classes/reflection-762.reflection-214.sasjs.html
Normal file
File diff suppressed because one or more lines are too long
1395
docs/classes/reflection-762.reflection-214.sasviyaapiclient.html
Normal file
1395
docs/classes/reflection-762.reflection-214.sasviyaapiclient.html
Normal file
File diff suppressed because one or more lines are too long
271
docs/classes/reflection-762.reflection-214.sessionmanager.html
Normal file
271
docs/classes/reflection-762.reflection-214.sessionmanager.html
Normal file
File diff suppressed because one or more lines are too long
@@ -76,7 +76,7 @@
|
||||
<section class="tsd-index-section ">
|
||||
<h3>Modules</h3>
|
||||
<ul class="tsd-index-list">
|
||||
<li class="tsd-kind-module tsd-is-not-exported"><a href="modules/reflection-759.html" class="tsd-kind-icon"><em>Module</em></a></li>
|
||||
<li class="tsd-kind-module tsd-is-not-exported"><a href="modules/reflection-762.html" class="tsd-kind-icon"><em>Module</em></a></li>
|
||||
<li class="tsd-kind-module"><a href="modules/types.html" class="tsd-kind-icon">types</a></li>
|
||||
<li class="tsd-kind-module"><a href="modules/utils.html" class="tsd-kind-icon">utils</a></li>
|
||||
</ul>
|
||||
|
||||
@@ -93,6 +93,7 @@
|
||||
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="types.contextallattributes.html#attributes" class="tsd-kind-icon">attributes</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="types.contextallattributes.html#createdby" class="tsd-kind-icon">createdBy</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="types.contextallattributes.html#creationtimestamp" class="tsd-kind-icon">creationTimeStamp</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="types.contextallattributes.html#environment" class="tsd-kind-icon">environment</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="types.contextallattributes.html#id" class="tsd-kind-icon">id</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="types.contextallattributes.html#launchcontext" class="tsd-kind-icon">launchContext</a></li>
|
||||
<li class="tsd-kind-property tsd-parent-kind-interface"><a href="types.contextallattributes.html#launchtype" class="tsd-kind-icon">launchType</a></li>
|
||||
@@ -160,6 +161,28 @@
|
||||
</ul>
|
||||
</aside>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
||||
<a name="environment" class="tsd-anchor"></a>
|
||||
<h3>environment</h3>
|
||||
<div class="tsd-signature tsd-kind-icon">environment<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">object</span></div>
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in
|
||||
<a href="https://github.com/sasjs/adapter/blob/master/src/types/Context.ts#L29">
|
||||
types/Context.ts:29
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</aside>
|
||||
<div class="tsd-type-declaration">
|
||||
<h4>Type declaration</h4>
|
||||
<ul class="tsd-parameters">
|
||||
<li class="tsd-parameter">
|
||||
<h5>auto<wbr>Exec<wbr>Lines<span class="tsd-signature-symbol">: </span><span class="tsd-signature-symbol">[</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">]</span></h5>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface">
|
||||
<a name="id" class="tsd-anchor"></a>
|
||||
<h3>id</h3>
|
||||
@@ -167,8 +190,8 @@
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in
|
||||
<a href="https://github.com/sasjs/adapter/blob/master/src/types/Context.ts#L33">
|
||||
types/Context.ts:33
|
||||
<a href="https://github.com/sasjs/adapter/blob/master/src/types/Context.ts#L36">
|
||||
types/Context.ts:36
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -181,8 +204,8 @@
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in
|
||||
<a href="https://github.com/sasjs/adapter/blob/master/src/types/Context.ts#L29">
|
||||
types/Context.ts:29
|
||||
<a href="https://github.com/sasjs/adapter/blob/master/src/types/Context.ts#L32">
|
||||
types/Context.ts:32
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -217,8 +240,8 @@
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in
|
||||
<a href="https://github.com/sasjs/adapter/blob/master/src/types/Context.ts#L32">
|
||||
types/Context.ts:32
|
||||
<a href="https://github.com/sasjs/adapter/blob/master/src/types/Context.ts#L35">
|
||||
types/Context.ts:35
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -245,8 +268,8 @@
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in
|
||||
<a href="https://github.com/sasjs/adapter/blob/master/src/types/Context.ts#L35">
|
||||
types/Context.ts:35
|
||||
<a href="https://github.com/sasjs/adapter/blob/master/src/types/Context.ts#L38">
|
||||
types/Context.ts:38
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -259,8 +282,8 @@
|
||||
<aside class="tsd-sources">
|
||||
<ul>
|
||||
<li>Defined in
|
||||
<a href="https://github.com/sasjs/adapter/blob/master/src/types/Context.ts#L34">
|
||||
types/Context.ts:34
|
||||
<a href="https://github.com/sasjs/adapter/blob/master/src/types/Context.ts#L37">
|
||||
types/Context.ts:37
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -298,6 +321,9 @@
|
||||
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
||||
<a href="types.contextallattributes.html#creationtimestamp" class="tsd-kind-icon">creation<wbr>Time<wbr>Stamp</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
||||
<a href="types.contextallattributes.html#environment" class="tsd-kind-icon">environment</a>
|
||||
</li>
|
||||
<li class=" tsd-kind-property tsd-parent-kind-interface">
|
||||
<a href="types.contextallattributes.html#id" class="tsd-kind-icon">id</a>
|
||||
</li>
|
||||
|
||||
106
docs/modules/reflection-762.html
Normal file
106
docs/modules/reflection-762.html
Normal file
File diff suppressed because one or more lines are too long
128
docs/modules/reflection-762.reflection-214.html
Normal file
128
docs/modules/reflection-762.reflection-214.html
Normal file
File diff suppressed because one or more lines are too long
@@ -30,8 +30,8 @@
|
||||
$('#chart-container').append('<canvas id="myChart" style="display: none;"></canvas>')
|
||||
// make a request to a SAS service
|
||||
var type = $("#cars")[0].options[$("#cars")[0].selectedIndex].value;
|
||||
// request data from an endpoint under your appLoc
|
||||
sasJs.request("/common/getdata", {
|
||||
// request data from an endpoint under your appLoc (missing opening slash implies relative path)
|
||||
sasJs.request("common/getdata", {
|
||||
// send data as an array of objects - each object is one row
|
||||
fromjs: [{ type: type }]
|
||||
}).then((response) => {
|
||||
|
||||
@@ -43,7 +43,6 @@ export class SASViyaApiClient {
|
||||
this.contextName,
|
||||
this.setCsrfToken
|
||||
)
|
||||
private isForceDeploy: boolean = false
|
||||
private folderMap = new Map<string, Job[]>()
|
||||
|
||||
/**
|
||||
@@ -625,8 +624,6 @@ export class SASViyaApiClient {
|
||||
if (!parentFolderUri && parentFolderPath) {
|
||||
parentFolderUri = await this.getFolderUri(parentFolderPath, accessToken)
|
||||
if (!parentFolderUri) {
|
||||
if (isForced) this.isForceDeploy = true
|
||||
|
||||
console.log(
|
||||
`Parent folder at path '${parentFolderPath}' is not present.`
|
||||
)
|
||||
@@ -652,37 +649,16 @@ export class SASViyaApiClient {
|
||||
`Parent folder '${newFolderName}' has been successfully created.`
|
||||
)
|
||||
parentFolderUri = `/folders/folders/${parentFolder.id}`
|
||||
} else if (isForced && accessToken && !this.isForceDeploy) {
|
||||
this.isForceDeploy = true
|
||||
} else if (isForced && accessToken) {
|
||||
const folderPath = parentFolderPath + '/' + folderName
|
||||
const folderUri = await this.getFolderUri(folderPath, accessToken)
|
||||
|
||||
await this.deleteFolder(parentFolderPath, accessToken)
|
||||
|
||||
const newParentFolderPath = parentFolderPath.substring(
|
||||
0,
|
||||
parentFolderPath.lastIndexOf('/')
|
||||
)
|
||||
const newFolderName = `${parentFolderPath.split('/').pop()}`
|
||||
|
||||
if (newParentFolderPath === '') {
|
||||
throw new Error(`Root folder has to be present on the server.`)
|
||||
if (folderUri) {
|
||||
await this.deleteFolder(
|
||||
parentFolderPath + '/' + folderName,
|
||||
accessToken
|
||||
)
|
||||
}
|
||||
|
||||
console.log(
|
||||
`Creating parent folder:\n'${newFolderName}' in '${newParentFolderPath}'`
|
||||
)
|
||||
|
||||
const parentFolder = await this.createFolder(
|
||||
newFolderName,
|
||||
newParentFolderPath,
|
||||
undefined,
|
||||
accessToken
|
||||
)
|
||||
|
||||
console.log(
|
||||
`Parent folder '${newFolderName}' has been successfully created.`
|
||||
)
|
||||
|
||||
parentFolderUri = `/folders/folders/${parentFolder.id}`
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1508,6 +1484,16 @@ export class SASViyaApiClient {
|
||||
`${this.serverUrl}${url}`,
|
||||
requestInfo
|
||||
).catch((err) => {
|
||||
if (err.code && err.code === 'ENOTFOUND') {
|
||||
const notFoundError = {
|
||||
body: JSON.stringify({
|
||||
message: `Folder '${sourceFolder.split('/').pop()}' was not found.`
|
||||
})
|
||||
}
|
||||
|
||||
throw notFoundError
|
||||
}
|
||||
|
||||
throw err
|
||||
})
|
||||
|
||||
|
||||
36
src/SASjs.ts
36
src/SASjs.ts
@@ -243,8 +243,6 @@ export default class SASjs {
|
||||
sasApiClient?: SASViyaApiClient,
|
||||
isForced?: boolean
|
||||
) {
|
||||
this.isMethodSupported('createFolder', ServerType.SASViya)
|
||||
|
||||
if (sasApiClient)
|
||||
return await sasApiClient.createFolder(
|
||||
folderName,
|
||||
@@ -261,6 +259,40 @@ export default class SASjs {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* For performance (and in case of accidental error) the `deleteFolder` function does not actually delete the folder (and all its content and subfolder content). Instead the folder is simply moved to the recycle bin. Deletion time will be added to the folder name.
|
||||
* @param folderPath - the full path (eg `/Public/example/deleteThis`) of the folder to be deleted.
|
||||
* @param accessToken - an access token for authorizing the request.
|
||||
*/
|
||||
public async deleteFolder(folderPath: string, accessToken: string) {
|
||||
this.isMethodSupported('deleteFolder', ServerType.SASViya)
|
||||
|
||||
return await this.sasViyaApiClient?.deleteFolder(folderPath, accessToken)
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves 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 targetParentFolder - the full path or URI of the _parent_ folder to which the `sourceFolder` will be moved (eg `/Public/newDestination`). To move a folder, a user has to have write permissions in targetParentFolder. Providing URI instead of path will save one extra request.
|
||||
* @param targetFolderName - the name of the "moved" folder. If left blank, the original folder name will be used (eg `myFolder` in `/Public/newDestination/myFolder` for the example above). Optional field.
|
||||
* @param accessToken - an access token for authorizing the request.
|
||||
*/
|
||||
public async moveFolder(
|
||||
sourceFolder: string,
|
||||
targetParentFolder: string,
|
||||
targetFolderName: string,
|
||||
accessToken: string
|
||||
) {
|
||||
this.isMethodSupported('moveFolder', ServerType.SASViya)
|
||||
|
||||
return await this.sasViyaApiClient?.moveFolder(
|
||||
sourceFolder,
|
||||
targetParentFolder,
|
||||
targetFolderName,
|
||||
accessToken
|
||||
)
|
||||
}
|
||||
|
||||
public async createJobDefinition(
|
||||
jobName: string,
|
||||
code: string,
|
||||
|
||||
@@ -26,6 +26,9 @@ export interface ContextAllAttributes {
|
||||
createdBy: string
|
||||
creationTimeStamp: string
|
||||
launchType: string
|
||||
environment: {
|
||||
autoExecLines: [string]
|
||||
}
|
||||
launchContext: {
|
||||
contextName: string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user