mirror of
https://github.com/sasjs/adapter.git
synced 2026-01-07 20:40:05 +00:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b23f199334 | ||
|
|
ed5dabee9f | ||
|
|
0c88c5a522 | ||
|
|
640e7015c8 | ||
|
|
2fd306f435 | ||
|
|
e3f779dbd1 |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1,4 +1,6 @@
|
|||||||
node_modules
|
node_modules
|
||||||
build
|
build
|
||||||
|
|
||||||
.env
|
.env
|
||||||
|
|
||||||
|
/coverage
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
"publish:lib": "npm run build && cd build && npm publish",
|
"publish:lib": "npm run build && cd build && npm publish",
|
||||||
"lint:fix": "npx prettier --write 'src/**/*.{ts,tsx,js,jsx,html,css,sass,less,json,yml,md,graphql}'",
|
"lint:fix": "npx prettier --write 'src/**/*.{ts,tsx,js,jsx,html,css,sass,less,json,yml,md,graphql}'",
|
||||||
"lint": "npx prettier --check 'src/**/*.{ts,tsx,js,jsx,html,css,sass,less,json,yml,md,graphql}'",
|
"lint": "npx prettier --check 'src/**/*.{ts,tsx,js,jsx,html,css,sass,less,json,yml,md,graphql}'",
|
||||||
"test": "jest",
|
"test": "jest --coverage",
|
||||||
"prepublishOnly": "cp -r ./build/* . && rm -rf ./build",
|
"prepublishOnly": "cp -r ./build/* . && rm -rf ./build",
|
||||||
"postpublish": "git clean -fd",
|
"postpublish": "git clean -fd",
|
||||||
"semantic-release": "semantic-release",
|
"semantic-release": "semantic-release",
|
||||||
|
|||||||
@@ -833,23 +833,20 @@ export class SASViyaApiClient {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isRelativePath(sasJob)) {
|
const folderPathParts = sasJob.split('/')
|
||||||
const folderName = sasJob.split('/')[0]
|
const jobName = folderPathParts.pop()
|
||||||
await this.populateFolderMap(
|
const folderPath = folderPathParts.join('/')
|
||||||
`${this.rootFolderName}/${folderName}`,
|
const fullFolderPath = isRelativePath(sasJob)
|
||||||
accessToken
|
? `${this.rootFolderName}/${folderPath}`
|
||||||
)
|
: folderPath
|
||||||
|
|
||||||
if (!this.folderMap.get(`${this.rootFolderName}/${folderName}`)) {
|
await this.populateFolderMap(fullFolderPath, accessToken)
|
||||||
throw new Error(
|
|
||||||
`The folder '${folderName}' was not found at '${this.serverUrl}/${this.rootFolderName}'`
|
const jobFolder = this.folderMap.get(fullFolderPath)
|
||||||
)
|
if (!jobFolder) {
|
||||||
}
|
throw new Error(
|
||||||
} else {
|
`The folder '${fullFolderPath}' was not found on '${this.serverUrl}'`
|
||||||
const folderPathParts = sasJob.split('/')
|
)
|
||||||
folderPathParts.pop()
|
|
||||||
const folderPath = folderPathParts.join('/')
|
|
||||||
await this.populateFolderMap(folderPath, accessToken)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const headers: any = { 'Content-Type': 'application/json' }
|
const headers: any = { 'Content-Type': 'application/json' }
|
||||||
@@ -857,21 +854,7 @@ export class SASViyaApiClient {
|
|||||||
headers.Authorization = `Bearer ${accessToken}`
|
headers.Authorization = `Bearer ${accessToken}`
|
||||||
}
|
}
|
||||||
|
|
||||||
let jobToExecute
|
const jobToExecute = jobFolder?.find((item) => item.name === jobName)
|
||||||
if (isRelativePath(sasJob)) {
|
|
||||||
const folderName = sasJob.split('/')[0]
|
|
||||||
const jobName = sasJob.split('/')[1]
|
|
||||||
const jobFolder = this.folderMap.get(
|
|
||||||
`${this.rootFolderName}/${folderName}`
|
|
||||||
)
|
|
||||||
jobToExecute = jobFolder?.find((item) => item.name === jobName)
|
|
||||||
} else {
|
|
||||||
const folderPathParts = sasJob.split('/')
|
|
||||||
const jobName = folderPathParts.pop()
|
|
||||||
const folderPath = folderPathParts.join('/')
|
|
||||||
const jobFolder = this.folderMap.get(folderPath)
|
|
||||||
jobToExecute = jobFolder?.find((item) => item.name === jobName)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!jobToExecute) {
|
if (!jobToExecute) {
|
||||||
throw new Error(`Job was not found.`)
|
throw new Error(`Job was not found.`)
|
||||||
@@ -937,52 +920,28 @@ export class SASViyaApiClient {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isRelativePath(sasJob)) {
|
const folderPathParts = sasJob.split('/')
|
||||||
const folderName = sasJob.split('/')[0]
|
const jobName = folderPathParts.pop()
|
||||||
await this.populateFolderMap(
|
const folderPath = folderPathParts.join('/')
|
||||||
`${this.rootFolderName}/${folderName}`,
|
const fullFolderPath = isRelativePath(sasJob)
|
||||||
accessToken
|
? `${this.rootFolderName}/${folderPath}`
|
||||||
)
|
: folderPath
|
||||||
|
await this.populateFolderMap(fullFolderPath, accessToken)
|
||||||
|
|
||||||
if (!this.folderMap.get(`${this.rootFolderName}/${folderName}`)) {
|
const jobFolder = this.folderMap.get(fullFolderPath)
|
||||||
throw new Error(
|
if (!jobFolder) {
|
||||||
`The folder '${folderName}' was not found at '${this.serverUrl}/${this.rootFolderName}'.`
|
throw new Error(
|
||||||
)
|
`The folder '${fullFolderPath}' was not found on '${this.serverUrl}'.`
|
||||||
}
|
)
|
||||||
} else {
|
|
||||||
const folderPathParts = sasJob.split('/')
|
|
||||||
folderPathParts.pop()
|
|
||||||
const folderPath = folderPathParts.join('/')
|
|
||||||
await this.populateFolderMap(folderPath, accessToken)
|
|
||||||
if (!this.folderMap.get(folderPath)) {
|
|
||||||
throw new Error(
|
|
||||||
`The folder '${folderPath}' was not found at '${this.serverUrl}'.`
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const jobToExecute = jobFolder?.find((item) => item.name === jobName)
|
||||||
|
|
||||||
let files: any[] = []
|
let files: any[] = []
|
||||||
if (data && Object.keys(data).length) {
|
if (data && Object.keys(data).length) {
|
||||||
files = await this.uploadTables(data, accessToken)
|
files = await this.uploadTables(data, accessToken)
|
||||||
}
|
}
|
||||||
|
|
||||||
let jobToExecute: Job | undefined
|
|
||||||
let jobName: string | undefined
|
|
||||||
let jobPath: string | undefined
|
|
||||||
if (isRelativePath(sasJob)) {
|
|
||||||
const folderName = sasJob.split('/')[0]
|
|
||||||
jobName = sasJob.split('/')[1]
|
|
||||||
jobPath = `${this.rootFolderName}/${folderName}`
|
|
||||||
const jobFolder = this.folderMap.get(jobPath)
|
|
||||||
jobToExecute = jobFolder?.find((item) => item.name === jobName)
|
|
||||||
} else {
|
|
||||||
const folderPathParts = sasJob.split('/')
|
|
||||||
jobName = folderPathParts.pop()
|
|
||||||
jobPath = folderPathParts.join('/')
|
|
||||||
const jobFolder = this.folderMap.get(jobPath)
|
|
||||||
jobToExecute = jobFolder?.find((item) => item.name === jobName)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!jobToExecute) {
|
if (!jobToExecute) {
|
||||||
throw new Error(`Job was not found.`)
|
throw new Error(`Job was not found.`)
|
||||||
}
|
}
|
||||||
@@ -1007,7 +966,7 @@ export class SASViyaApiClient {
|
|||||||
|
|
||||||
const jobArguments: { [key: string]: any } = {
|
const jobArguments: { [key: string]: any } = {
|
||||||
_contextName: contextName,
|
_contextName: contextName,
|
||||||
_program: `${jobPath}/${jobName}`,
|
_program: `${fullFolderPath}/${jobName}`,
|
||||||
_webin_file_count: files.length,
|
_webin_file_count: files.length,
|
||||||
_OMITJSONLISTING: true,
|
_OMITJSONLISTING: true,
|
||||||
_OMITJSONLOG: true,
|
_OMITJSONLOG: true,
|
||||||
|
|||||||
@@ -747,10 +747,7 @@ export default class SASjs {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const members =
|
const members = serviceJson.members
|
||||||
serviceJson.members[0].name === 'services'
|
|
||||||
? serviceJson.members[0].members
|
|
||||||
: serviceJson.members
|
|
||||||
|
|
||||||
await this.createFoldersAndServices(
|
await this.createFoldersAndServices(
|
||||||
appLoc,
|
appLoc,
|
||||||
|
|||||||
Reference in New Issue
Block a user