mirror of
https://github.com/sasjs/adapter.git
synced 2025-12-11 01:14:36 +00:00
feat(deploy): stream app deployment on SASJS server
This commit is contained in:
14
package-lock.json
generated
14
package-lock.json
generated
@@ -8,7 +8,7 @@
|
|||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sasjs/utils": "2.36.1",
|
"@sasjs/utils": "2.40.0",
|
||||||
"axios": "0.26.0",
|
"axios": "0.26.0",
|
||||||
"axios-cookiejar-support": "1.0.1",
|
"axios-cookiejar-support": "1.0.1",
|
||||||
"form-data": "4.0.0",
|
"form-data": "4.0.0",
|
||||||
@@ -1142,9 +1142,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@sasjs/utils": {
|
"node_modules/@sasjs/utils": {
|
||||||
"version": "2.36.1",
|
"version": "2.40.0",
|
||||||
"resolved": "https://registry.npmjs.org/@sasjs/utils/-/utils-2.36.1.tgz",
|
"resolved": "https://registry.npmjs.org/@sasjs/utils/-/utils-2.40.0.tgz",
|
||||||
"integrity": "sha512-JkGUpLOODsvkeU+S25jb9k2WnvzyD2w6cEk7YyQ/byuqKL8xawH91PPWegrVcJlDY8WmqKE4CPcA3d1mM3B3LA==",
|
"integrity": "sha512-U0y/eqRlvfkMHmKDlr1xmeN+Rask7TnJPuRpOz71P8QpGYTw1M9AyZvzRSk503p4KCJb8ysdcqXyGVLfhuoM+A==",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/fs-extra": "9.0.13",
|
"@types/fs-extra": "9.0.13",
|
||||||
@@ -13870,9 +13870,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@sasjs/utils": {
|
"@sasjs/utils": {
|
||||||
"version": "2.36.1",
|
"version": "2.40.0",
|
||||||
"resolved": "https://registry.npmjs.org/@sasjs/utils/-/utils-2.36.1.tgz",
|
"resolved": "https://registry.npmjs.org/@sasjs/utils/-/utils-2.40.0.tgz",
|
||||||
"integrity": "sha512-JkGUpLOODsvkeU+S25jb9k2WnvzyD2w6cEk7YyQ/byuqKL8xawH91PPWegrVcJlDY8WmqKE4CPcA3d1mM3B3LA==",
|
"integrity": "sha512-U0y/eqRlvfkMHmKDlr1xmeN+Rask7TnJPuRpOz71P8QpGYTw1M9AyZvzRSk503p4KCJb8ysdcqXyGVLfhuoM+A==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@types/fs-extra": "9.0.13",
|
"@types/fs-extra": "9.0.13",
|
||||||
"@types/prompts": "2.0.13",
|
"@types/prompts": "2.0.13",
|
||||||
|
|||||||
@@ -72,7 +72,7 @@
|
|||||||
},
|
},
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sasjs/utils": "2.36.1",
|
"@sasjs/utils": "2.40.0",
|
||||||
"axios": "0.26.0",
|
"axios": "0.26.0",
|
||||||
"axios-cookiejar-support": "1.0.1",
|
"axios-cookiejar-support": "1.0.1",
|
||||||
"form-data": "4.0.0",
|
"form-data": "4.0.0",
|
||||||
|
|||||||
16
src/SASjs.ts
16
src/SASjs.ts
@@ -17,7 +17,8 @@ import {
|
|||||||
MacroVar,
|
MacroVar,
|
||||||
AuthConfig,
|
AuthConfig,
|
||||||
ExtraResponseAttributes,
|
ExtraResponseAttributes,
|
||||||
SasAuthResponse
|
SasAuthResponse,
|
||||||
|
StreamConfig
|
||||||
} from '@sasjs/utils/types'
|
} from '@sasjs/utils/types'
|
||||||
import { RequestClient } from './request/RequestClient'
|
import { RequestClient } from './request/RequestClient'
|
||||||
import { SasjsRequestClient } from './request/SasjsRequestClient'
|
import { SasjsRequestClient } from './request/SasjsRequestClient'
|
||||||
@@ -891,17 +892,24 @@ export default class SASjs {
|
|||||||
* @param members - the JSON specifying the folders and services to be created.
|
* @param members - the JSON specifying the folders and services to be created.
|
||||||
* @param appLoc - the base folder in which to create the new folders and
|
* @param appLoc - the base folder in which to create the new folders and
|
||||||
* services. If not provided, is taken from SASjsConfig.
|
* services. If not provided, is taken from SASjsConfig.
|
||||||
* @param authConfig - a valid client, secret, refresh and access tokens that are authorised to execute compute jobs.
|
* @param streamConfig - optional configuration object of StreamConfig for deploying streaming app.
|
||||||
|
* @param authConfig - a valid client, secret, refresh and access tokens that are authorized to execute compute jobs.
|
||||||
*/
|
*/
|
||||||
public async deployToSASjs(
|
public async deployToSASjs(
|
||||||
members: FileTree,
|
members: FileTree,
|
||||||
appLoc?: string,
|
appLoc?: string,
|
||||||
|
streamConfig?: StreamConfig,
|
||||||
authConfig?: AuthConfig
|
authConfig?: AuthConfig
|
||||||
) {
|
) {
|
||||||
if (!appLoc) {
|
if (!appLoc) {
|
||||||
appLoc = this.sasjsConfig.appLoc
|
appLoc = this.sasjsConfig.appLoc
|
||||||
}
|
}
|
||||||
return await this.sasJSApiClient?.deploy(members, appLoc, authConfig)
|
return await this.sasJSApiClient?.deploy(
|
||||||
|
members,
|
||||||
|
appLoc,
|
||||||
|
streamConfig,
|
||||||
|
authConfig
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
public async executeJobSASjs(query: ExecutionQuery) {
|
public async executeJobSASjs(query: ExecutionQuery) {
|
||||||
@@ -919,7 +927,7 @@ export default class SASjs {
|
|||||||
* @param config - provide any changes to the config here, for instance to
|
* @param config - provide any changes to the config here, for instance to
|
||||||
* enable/disable `debug`. Any change provided will override the global config,
|
* enable/disable `debug`. Any change provided will override the global config,
|
||||||
* for that particular function call.
|
* for that particular function call.
|
||||||
* @param authConfig - a valid client, secret, refresh and access tokens that are authorised to execute compute jobs.
|
* @param authConfig - a valid client, secret, refresh and access tokens that are authorized to execute compute jobs.
|
||||||
* The access token is not required when the user is authenticated via the browser.
|
* The access token is not required when the user is authenticated via the browser.
|
||||||
* @param waitForResult - a boolean that indicates whether the function needs to wait for execution to complete.
|
* @param waitForResult - a boolean that indicates whether the function needs to wait for execution to complete.
|
||||||
* @param pollOptions - an object that represents poll interval(milliseconds) and maximum amount of attempts. Object example: { MAX_POLL_COUNT: 24 * 60 * 60, POLL_INTERVAL: 1000 }.
|
* @param pollOptions - an object that represents poll interval(milliseconds) and maximum amount of attempts. Object example: { MAX_POLL_COUNT: 24 * 60 * 60, POLL_INTERVAL: 1000 }.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { AuthConfig, ServerType } from '@sasjs/utils/types'
|
import { AuthConfig, ServerType, StreamConfig } from '@sasjs/utils/types'
|
||||||
import { FileTree, ExecutionQuery } from './types'
|
import { FileTree, ExecutionQuery } from './types'
|
||||||
import { RequestClient } from './request/RequestClient'
|
import { RequestClient } from './request/RequestClient'
|
||||||
import { getAccessTokenForSasjs } from './auth/getAccessTokenForSasjs'
|
import { getAccessTokenForSasjs } from './auth/getAccessTokenForSasjs'
|
||||||
@@ -20,6 +20,7 @@ export class SASjsApiClient {
|
|||||||
public async deploy(
|
public async deploy(
|
||||||
members: FileTree,
|
members: FileTree,
|
||||||
appLoc: string,
|
appLoc: string,
|
||||||
|
streamConfig?: StreamConfig,
|
||||||
authConfig?: AuthConfig
|
authConfig?: AuthConfig
|
||||||
) {
|
) {
|
||||||
let access_token = (authConfig || {}).access_token
|
let access_token = (authConfig || {}).access_token
|
||||||
@@ -36,7 +37,13 @@ export class SASjsApiClient {
|
|||||||
example?: {}
|
example?: {}
|
||||||
}>(
|
}>(
|
||||||
'SASjsApi/drive/deploy',
|
'SASjsApi/drive/deploy',
|
||||||
{ fileTree: members, appLoc: appLoc },
|
{
|
||||||
|
fileTree: members,
|
||||||
|
appLoc: appLoc,
|
||||||
|
streamServiceName: streamConfig?.streamServiceName,
|
||||||
|
streamWebFolder: streamConfig?.streamWebFolder,
|
||||||
|
streamLogo: streamConfig?.streamLogo
|
||||||
|
},
|
||||||
access_token,
|
access_token,
|
||||||
undefined,
|
undefined,
|
||||||
{},
|
{},
|
||||||
|
|||||||
Reference in New Issue
Block a user