1
0
mirror of https://github.com/sasjs/adapter.git synced 2025-12-11 01:14:36 +00:00

Compare commits

...

6 Commits

Author SHA1 Message Date
Allan Bowe
b23f199334 Merge pull request #203 from sasjs/relative-service-paths
fix(relative-paths): process relative and absolute paths the same way
2021-01-05 21:02:45 +01:00
Krishna Acondy
ed5dabee9f fix(relative-paths): process relative and absolute paths the same way 2021-01-05 19:37:40 +00:00
Allan Bowe
0c88c5a522 Merge pull request #201 from sasjs/services-subfolder
fix(deploy-service-pack): deploy services into 'services' subfolder
2021-01-05 18:23:52 +01:00
Krishna Acondy
640e7015c8 fix(*): deploy services into 'services' subfolder 2021-01-05 17:19:05 +00:00
Yury Shkoda
2fd306f435 Merge pull request #195 from sasjs/v2-bump
test(coverage): enabled gathering coverage
2020-12-30 15:31:01 +03:00
Yury Shkoda
e3f779dbd1 test(coverage): enabled gathering coverage
BREAKING CHANGE: SASjs Adapter 2.0 - Electric Boogaloo
2020-12-30 15:04:59 +03:00
4 changed files with 34 additions and 76 deletions

4
.gitignore vendored
View File

@@ -1,4 +1,6 @@
node_modules
build
.env
.env
/coverage

View File

@@ -7,7 +7,7 @@
"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": "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",
"postpublish": "git clean -fd",
"semantic-release": "semantic-release",

View File

@@ -833,23 +833,20 @@ export class SASViyaApiClient {
)
}
if (isRelativePath(sasJob)) {
const folderName = sasJob.split('/')[0]
await this.populateFolderMap(
`${this.rootFolderName}/${folderName}`,
accessToken
)
const folderPathParts = sasJob.split('/')
const jobName = folderPathParts.pop()
const folderPath = folderPathParts.join('/')
const fullFolderPath = isRelativePath(sasJob)
? `${this.rootFolderName}/${folderPath}`
: folderPath
if (!this.folderMap.get(`${this.rootFolderName}/${folderName}`)) {
throw new Error(
`The folder '${folderName}' was not found at '${this.serverUrl}/${this.rootFolderName}'`
)
}
} else {
const folderPathParts = sasJob.split('/')
folderPathParts.pop()
const folderPath = folderPathParts.join('/')
await this.populateFolderMap(folderPath, accessToken)
await this.populateFolderMap(fullFolderPath, accessToken)
const jobFolder = this.folderMap.get(fullFolderPath)
if (!jobFolder) {
throw new Error(
`The folder '${fullFolderPath}' was not found on '${this.serverUrl}'`
)
}
const headers: any = { 'Content-Type': 'application/json' }
@@ -857,21 +854,7 @@ export class SASViyaApiClient {
headers.Authorization = `Bearer ${accessToken}`
}
let jobToExecute
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)
}
const jobToExecute = jobFolder?.find((item) => item.name === jobName)
if (!jobToExecute) {
throw new Error(`Job was not found.`)
@@ -937,52 +920,28 @@ export class SASViyaApiClient {
)
}
if (isRelativePath(sasJob)) {
const folderName = sasJob.split('/')[0]
await this.populateFolderMap(
`${this.rootFolderName}/${folderName}`,
accessToken
)
const folderPathParts = sasJob.split('/')
const jobName = folderPathParts.pop()
const folderPath = folderPathParts.join('/')
const fullFolderPath = isRelativePath(sasJob)
? `${this.rootFolderName}/${folderPath}`
: folderPath
await this.populateFolderMap(fullFolderPath, accessToken)
if (!this.folderMap.get(`${this.rootFolderName}/${folderName}`)) {
throw new Error(
`The folder '${folderName}' was not found at '${this.serverUrl}/${this.rootFolderName}'.`
)
}
} 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 jobFolder = this.folderMap.get(fullFolderPath)
if (!jobFolder) {
throw new Error(
`The folder '${fullFolderPath}' was not found on '${this.serverUrl}'.`
)
}
const jobToExecute = jobFolder?.find((item) => item.name === jobName)
let files: any[] = []
if (data && Object.keys(data).length) {
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) {
throw new Error(`Job was not found.`)
}
@@ -1007,7 +966,7 @@ export class SASViyaApiClient {
const jobArguments: { [key: string]: any } = {
_contextName: contextName,
_program: `${jobPath}/${jobName}`,
_program: `${fullFolderPath}/${jobName}`,
_webin_file_count: files.length,
_OMITJSONLISTING: true,
_OMITJSONLOG: true,

View File

@@ -747,10 +747,7 @@ export default class SASjs {
)
}
const members =
serviceJson.members[0].name === 'services'
? serviceJson.members[0].members
: serviceJson.members
const members = serviceJson.members
await this.createFoldersAndServices(
appLoc,