初始化

This commit is contained in:
2025-04-09 18:55:14 +08:00
commit 6e1ae24845
2315 changed files with 256628 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
import { RequestConfig } from '../types';
import { Logger } from '../util/logger';
/**
*
* @param requestData 请求参数
* @param options 请求配置
* @example request({ name: 'test' }, { operation-type: 'xxx.xxx.xxx' })
*/
export declare function request<T>(requestData: Record<string, any> | undefined, options: RequestConfig, logger: Logger): Promise<T>;

180
node_modules/@alipay/ams-checkout/esm/request/index.js generated vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,28 @@
/**
* Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), the rights to use, copy, modify, merge, and/or distribute the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
* 1. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE; and
* 2. If applicable, the use of the Software is also subject to the terms and conditions of any non-disclosure agreement signed by you and the relevant Ant Group entity.
*/
import { errorEnum } from '../types';
export declare const safeJson: (data: any, obj: any) => any;
export declare const fomatGetwayError: (headers: Record<string, any>, traceId: string) => {
success: boolean;
traceId: string;
errorCode: errorEnum;
resultStatus: any;
errorMessage?: undefined;
result?: undefined;
} | {
success: boolean;
traceId: string;
errorCode: errorEnum;
errorMessage: string;
result: {
resultStatus: any;
tips: string;
memo: string;
};
resultStatus: any;
};

59
node_modules/@alipay/ams-checkout/esm/request/utils.js generated vendored Normal file
View File

@@ -0,0 +1,59 @@
/**
* Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), the rights to use, copy, modify, merge, and/or distribute the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
* 1. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE; and
* 2. If applicable, the use of the Software is also subject to the terms and conditions of any non-disclosure agreement signed by you and the relevant Ant Group entity.
*/
/* eslint-disable @typescript-eslint/no-explicit-any */
import { errorEnum } from "../types";
import { get } from "../util/get";
export var safeJson = function safeJson(data, obj) {
try {
return JSON.parse(data) || obj;
} catch (_unused) {
return obj;
}
};
// 判断header 中的resultStatus
export var fomatGetwayError = function fomatGetwayError(headers, traceId) {
var resultStatus = get(headers, 'Result-Status') || get(headers, 'result-status', '');
// 请求静态数据情况
if (!resultStatus) return null;
// 未登录
if (+resultStatus === 2000) {
return {
success: false,
traceId: traceId,
errorCode: errorEnum.LOGIN,
resultStatus: resultStatus
};
}
// 网关超时
if (+resultStatus === 4001) {
return {
success: false,
traceId: traceId,
errorCode: errorEnum.TIMEOUT,
resultStatus: resultStatus
};
}
if (+resultStatus !== 1000) {
var tips = get(headers, 'Tips') || get(headers, 'tips', '');
var memo = get(headers, 'Memo') || get(headers, 'memo', '');
return {
success: false,
traceId: traceId,
errorCode: errorEnum.GATEWAY,
errorMessage: decodeURIComponent(tips || ''),
result: {
resultStatus: resultStatus || '',
tips: decodeURIComponent(tips || ''),
memo: decodeURIComponent(memo || '')
},
resultStatus: resultStatus
};
}
return null;
};