1
0
mirror of https://github.com/sasjs/adapter.git synced 2025-12-10 17:04:36 +00:00

feat: Update dependency axios to version 1.12.2

This commit is contained in:
Stephan Markiefka
2025-09-18 11:57:09 +02:00
parent b49010cfe5
commit afff422333
16 changed files with 61 additions and 40 deletions

10
package-lock.json generated
View File

@@ -9,7 +9,7 @@
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@sasjs/utils": "3.5.2", "@sasjs/utils": "3.5.2",
"axios": "1.8.2", "axios": "1.12.2",
"axios-cookiejar-support": "5.0.5", "axios-cookiejar-support": "5.0.5",
"form-data": "4.0.4", "form-data": "4.0.4",
"https": "1.0.0", "https": "1.0.0",
@@ -3510,13 +3510,13 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/axios": { "node_modules/axios": {
"version": "1.8.2", "version": "1.12.2",
"resolved": "https://registry.npmjs.org/axios/-/axios-1.8.2.tgz", "resolved": "https://registry.npmjs.org/axios/-/axios-1.12.2.tgz",
"integrity": "sha512-ls4GYBm5aig9vWx8AWDSGLpnpDQRtWAfrjU+EuytuODrFBkqesN2RkOQCBzrA1RQNHw1SmRMSDDDSwzNAYQ6Rg==", "integrity": "sha512-vMJzPewAlRyOgxV2dU0Cuz2O8zzzx9VYtbJOaBgXFeLc4IV/Eg50n4LowmehOOR61S8ZMpc2K5Sa7g6A4jfkUw==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"follow-redirects": "^1.15.6", "follow-redirects": "^1.15.6",
"form-data": "^4.0.0", "form-data": "^4.0.4",
"proxy-from-env": "^1.1.0" "proxy-from-env": "^1.1.0"
} }
}, },

View File

@@ -80,7 +80,7 @@
"main": "index.js", "main": "index.js",
"dependencies": { "dependencies": {
"@sasjs/utils": "3.5.2", "@sasjs/utils": "3.5.2",
"axios": "1.8.2", "axios": "1.12.2",
"axios-cookiejar-support": "5.0.5", "axios-cookiejar-support": "5.0.5",
"form-data": "4.0.4", "form-data": "4.0.4",
"https": "1.0.0", "https": "1.0.0",

View File

@@ -32,16 +32,18 @@ export class ContextManager {
return this.defaultLauncherContexts return this.defaultLauncherContexts
} }
constructor(private serverUrl: string, private requestClient: RequestClient) { constructor(
private serverUrl: string,
private requestClient: RequestClient
) {
if (serverUrl) isUrl(serverUrl) if (serverUrl) isUrl(serverUrl)
} }
public async getComputeContexts(accessToken?: string) { public async getComputeContexts(accessToken?: string) {
const { result: contexts } = await this.requestClient const { result: contexts } = await this.requestClient
.get<{ items: Context[] }>( .get<{
`${this.serverUrl}/compute/contexts?limit=10000`, items: Context[]
accessToken }>(`${this.serverUrl}/compute/contexts?limit=10000`, accessToken)
)
.catch((err) => { .catch((err) => {
throw prefixMessage(err, 'Error while getting compute contexts. ') throw prefixMessage(err, 'Error while getting compute contexts. ')
}) })
@@ -59,10 +61,9 @@ export class ContextManager {
public async getLauncherContexts(accessToken?: string) { public async getLauncherContexts(accessToken?: string) {
const { result: contexts } = await this.requestClient const { result: contexts } = await this.requestClient
.get<{ items: Context[] }>( .get<{
`${this.serverUrl}/launcher/contexts?limit=10000`, items: Context[]
accessToken }>(`${this.serverUrl}/launcher/contexts?limit=10000`, accessToken)
)
.catch((err) => { .catch((err) => {
throw prefixMessage(err, 'Error while getting launcher contexts. ') throw prefixMessage(err, 'Error while getting launcher contexts. ')
}) })
@@ -291,7 +292,9 @@ export class ContextManager {
accessToken?: string accessToken?: string
): Promise<Context> { ): Promise<Context> {
const { result: contexts } = await this.requestClient const { result: contexts } = await this.requestClient
.get<{ items: Context[] }>( .get<{
items: Context[]
}>(
`${this.serverUrl}/compute/contexts?filter=eq(name, "${contextName}")`, `${this.serverUrl}/compute/contexts?filter=eq(name, "${contextName}")`,
accessToken accessToken
) )
@@ -332,7 +335,9 @@ export class ContextManager {
authConfig?: AuthConfig authConfig?: AuthConfig
) { ) {
const { result: contexts } = await this.requestClient const { result: contexts } = await this.requestClient
.get<{ items: Context[] }>( .get<{
items: Context[]
}>(
`${this.serverUrl}/compute/contexts?limit=10000`, `${this.serverUrl}/compute/contexts?limit=10000`,
authConfig?.access_token authConfig?.access_token
) )

View File

@@ -882,9 +882,8 @@ export class SASViyaApiClient {
} }
files.forEach((fileInfo, index) => { files.forEach((fileInfo, index) => {
jobArguments[ jobArguments[`_webin_fileuri${index + 1}`] =
`_webin_fileuri${index + 1}` `/files/files/${fileInfo.file.id}`
] = `/files/files/${fileInfo.file.id}`
jobArguments[`_webin_name${index + 1}`] = fileInfo.tableName jobArguments[`_webin_name${index + 1}`] = fileInfo.tableName
}) })

View File

@@ -1063,8 +1063,8 @@ export default class SASjs {
this.sasjsConfig.serverType === ServerType.SasViya this.sasjsConfig.serverType === ServerType.SasViya
? this.sasjsConfig.pathSASViya ? this.sasjsConfig.pathSASViya
: this.sasjsConfig.serverType === ServerType.Sas9 : this.sasjsConfig.serverType === ServerType.Sas9
? this.sasjsConfig.pathSAS9 ? this.sasjsConfig.pathSAS9
: this.sasjsConfig.pathSASJS : this.sasjsConfig.pathSASJS
this.authManager = new AuthManager( this.authManager = new AuthManager(
this.sasjsConfig.serverUrl, this.sasjsConfig.serverUrl,

View File

@@ -125,9 +125,8 @@ export async function executeOnComputeApi(
jobVariables['_webin_file_count'] = files.length jobVariables['_webin_file_count'] = files.length
files.forEach((fileInfo, index) => { files.forEach((fileInfo, index) => {
jobVariables[ jobVariables[`_webin_fileuri${index + 1}`] =
`_webin_fileuri${index + 1}` `/files/files/${fileInfo.file.id}`
] = `/files/files/${fileInfo.file.id}`
jobVariables[`_webin_name${index + 1}`] = fileInfo.tableName jobVariables[`_webin_name${index + 1}`] = fileInfo.tableName
}) })
} else { } else {

View File

@@ -683,8 +683,8 @@ const mockSimplePoll = (runningCount = 2) => {
count === 0 count === 0
? 'pending' ? 'pending'
: count <= runningCount : count <= runningCount
? 'running' ? 'running'
: 'completed', : 'completed',
etag: '', etag: '',
status: 200 status: 200
}) })

View File

@@ -27,8 +27,8 @@ export class AuthManager {
this.serverType === ServerType.Sas9 this.serverType === ServerType.Sas9
? '/SASLogon/logout?' ? '/SASLogon/logout?'
: this.serverType === ServerType.SasViya : this.serverType === ServerType.SasViya
? '/SASLogon/logout.do?' ? '/SASLogon/logout.do?'
: '/SASLogon/logout' : '/SASLogon/logout'
this.redirectedLoginUrl = this.serverUrl + this.redirectedLoginUrl this.redirectedLoginUrl = this.serverUrl + this.redirectedLoginUrl
} }
@@ -269,8 +269,8 @@ export class AuthManager {
this.serverType === ServerType.SasViya this.serverType === ServerType.SasViya
? `${this.serverUrl}/identities/users/@currentUser` ? `${this.serverUrl}/identities/users/@currentUser`
: this.serverType === ServerType.Sas9 : this.serverType === ServerType.Sas9
? `${this.serverUrl}/SASStoredProcess` ? `${this.serverUrl}/SASStoredProcess`
: `${this.serverUrl}/SASjsApi/session` : `${this.serverUrl}/SASjsApi/session`
const { result: loginResponse } = await this.requestClient const { result: loginResponse } = await this.requestClient
.get<string>(url, undefined, 'text/plain') .get<string>(url, undefined, 'text/plain')

View File

@@ -10,7 +10,7 @@ describe('openWebPage', () => {
describe('window.open is not blocked', () => { describe('window.open is not blocked', () => {
const mockedOpen = jest const mockedOpen = jest
.fn() .fn()
.mockImplementation(() => ({} as unknown as Window)) .mockImplementation(() => ({}) as unknown as Window)
const originalOpen = window.open const originalOpen = window.open
beforeAll(() => { beforeAll(() => {

View File

@@ -8,7 +8,10 @@ import {
import { BaseJobExecutor } from './JobExecutor' import { BaseJobExecutor } from './JobExecutor'
export class ComputeJobExecutor extends BaseJobExecutor { export class ComputeJobExecutor extends BaseJobExecutor {
constructor(serverUrl: string, private sasViyaApiClient: SASViyaApiClient) { constructor(
serverUrl: string,
private sasViyaApiClient: SASViyaApiClient
) {
super(serverUrl, ServerType.SasViya) super(serverUrl, ServerType.SasViya)
} }

View File

@@ -10,7 +10,10 @@ import { BaseJobExecutor } from './JobExecutor'
import { appendExtraResponseAttributes } from '../utils' import { appendExtraResponseAttributes } from '../utils'
export class JesJobExecutor extends BaseJobExecutor { export class JesJobExecutor extends BaseJobExecutor {
constructor(serverUrl: string, private sasViyaApiClient: SASViyaApiClient) { constructor(
serverUrl: string,
private sasViyaApiClient: SASViyaApiClient
) {
super(serverUrl, ServerType.SasViya) super(serverUrl, ServerType.SasViya)
} }

View File

@@ -17,7 +17,10 @@ export interface JobExecutor {
} }
export abstract class BaseJobExecutor implements JobExecutor { export abstract class BaseJobExecutor implements JobExecutor {
constructor(protected serverUrl: string, protected serverType: ServerType) {} constructor(
protected serverUrl: string,
protected serverType: ServerType
) {}
private waitingRequests: ExecuteFunction[] = [] private waitingRequests: ExecuteFunction[] = []

View File

@@ -1,5 +1,8 @@
export class AuthorizeError extends Error { export class AuthorizeError extends Error {
constructor(public message: string, public confirmUrl: string) { constructor(
public message: string,
public confirmUrl: string
) {
super(message) super(message)
this.name = 'AuthorizeError' this.name = 'AuthorizeError'
Object.setPrototypeOf(this, AuthorizeError.prototype) Object.setPrototypeOf(this, AuthorizeError.prototype)

View File

@@ -1,7 +1,10 @@
import { Job } from '../Job' import { Job } from '../Job'
export class ComputeJobExecutionError extends Error { export class ComputeJobExecutionError extends Error {
constructor(public job: Job, public log: string) { constructor(
public job: Job,
public log: string
) {
super('Error: Job execution failed') super('Error: Job execution failed')
this.name = 'ComputeJobExecutionError' this.name = 'ComputeJobExecutionError'
Object.setPrototypeOf(this, ComputeJobExecutionError.prototype) Object.setPrototypeOf(this, ComputeJobExecutionError.prototype)

View File

@@ -1,5 +1,8 @@
export class JobStatePollError extends Error { export class JobStatePollError extends Error {
constructor(id: string, public originalError: Error) { constructor(
id: string,
public originalError: Error
) {
super( super(
`Error while polling job state for job ${id}: ${ `Error while polling job state for job ${id}: ${
originalError.message || originalError originalError.message || originalError

View File

@@ -110,8 +110,8 @@ export const convertToCSV = (
longestValueForField longestValueForField
? longestValueForField ? longestValueForField
: firstFoundType === 'chars' : firstFoundType === 'chars'
? '1' ? '1'
: 'best' : 'best'
}.` }.`
) )
} }