1
0
mirror of https://github.com/sasjs/adapter.git synced 2026-01-07 20:40:05 +00:00

fix(deploy): to SASJS with complete JSON object

This commit is contained in:
Saad Jutt
2022-03-31 04:20:49 +05:00
parent ee97e8211e
commit fc0a450e94
6 changed files with 27 additions and 98 deletions

View File

@@ -1,5 +1,5 @@
import { AuthConfig, ServerType, StreamConfig } from '@sasjs/utils/types'
import { FileTree, ExecutionQuery } from './types'
import { AuthConfig, ServerType, ServicePackSASjs } from '@sasjs/utils/types'
import { ExecutionQuery } from './types'
import { RequestClient } from './request/RequestClient'
import { getAccessTokenForSasjs } from './auth/getAccessTokenForSasjs'
import { refreshTokensForSasjs } from './auth/refreshTokensForSasjs'
@@ -8,19 +8,11 @@ import { parseWeboutResponse } from './utils'
import { getTokens } from './auth/getTokens'
export class SASjsApiClient {
constructor(
private serverUrl: string,
private requestClient: RequestClient
) {}
public setConfig(serverUrl: string) {
if (serverUrl) this.serverUrl = serverUrl
}
constructor(private requestClient: RequestClient) {}
public async deploy(
members: FileTree,
dataJson: ServicePackSASjs,
appLoc: string,
streamConfig?: StreamConfig,
authConfig?: AuthConfig
) {
let access_token = (authConfig || {}).access_token
@@ -31,6 +23,9 @@ export class SASjsApiClient {
ServerType.Sasjs
))
}
dataJson.appLoc = dataJson.appLoc || appLoc
const { result } = await this.requestClient.post<{
status: string
message: string
@@ -38,13 +33,7 @@ export class SASjsApiClient {
example?: {}
}>(
'SASjsApi/drive/deploy',
{
fileTree: members,
appLoc: appLoc,
streamServiceName: streamConfig?.streamServiceName,
streamWebFolder: streamConfig?.streamWebFolder,
streamLogo: streamConfig?.streamLogo
},
dataJson,
access_token,
undefined,
{},