mirror of
https://github.com/sasjs/adapter.git
synced 2026-04-20 20:53:13 +00:00
refactor: added isUri utility
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+2
-2
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+38
-1
File diff suppressed because one or more lines are too long
@@ -2,7 +2,8 @@ import {
|
|||||||
isAuthorizeFormRequired,
|
isAuthorizeFormRequired,
|
||||||
parseAndSubmitAuthorizeForm,
|
parseAndSubmitAuthorizeForm,
|
||||||
convertToCSV,
|
convertToCSV,
|
||||||
makeRequest
|
makeRequest,
|
||||||
|
isUri
|
||||||
} from './utils'
|
} from './utils'
|
||||||
import * as NodeFormData from 'form-data'
|
import * as NodeFormData from 'form-data'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
@@ -1154,14 +1155,12 @@ export class SASViyaApiClient {
|
|||||||
accessToken: string
|
accessToken: string
|
||||||
) {
|
) {
|
||||||
// checks if 'sourceFolder' is already a URI
|
// checks if 'sourceFolder' is already a URI
|
||||||
const sourceFolderUri = /^\/folders\/folders\//.test(sourceFolder)
|
const sourceFolderUri = isUri(sourceFolder)
|
||||||
? sourceFolder
|
? sourceFolder
|
||||||
: await this.getFolderUri(sourceFolder, accessToken)
|
: await this.getFolderUri(sourceFolder, accessToken)
|
||||||
|
|
||||||
// checks if 'targetParentFolder' is already a URI
|
// checks if 'targetParentFolder' is already a URI
|
||||||
const targetParentFolderUri = /^\/folders\/folders\//.test(
|
const targetParentFolderUri = isUri(targetParentFolder)
|
||||||
targetParentFolder
|
|
||||||
)
|
|
||||||
? targetParentFolder
|
? targetParentFolder
|
||||||
: await this.getFolderUri(targetParentFolder, accessToken)
|
: await this.getFolderUri(targetParentFolder, accessToken)
|
||||||
|
|
||||||
|
|||||||
@@ -13,3 +13,4 @@ export * from './parseSasViyaLog'
|
|||||||
export * from './serialize'
|
export * from './serialize'
|
||||||
export * from './splitChunks'
|
export * from './splitChunks'
|
||||||
export * from './parseWeboutResponse'
|
export * from './parseWeboutResponse'
|
||||||
|
export * from './isUri'
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
/**
|
||||||
|
* Checks if string is in URI format
|
||||||
|
* @param str string to check
|
||||||
|
*/
|
||||||
|
export const isUri = (str: string): boolean => /^\/folders\/folders\//.test(str)
|
||||||
Reference in New Issue
Block a user