@next-core/easyops-runtime 0.10.19 → 0.10.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -61,7 +61,7 @@ function getApiArgsFromApiProfile({
|
|
|
61
61
|
}, ...args];
|
|
62
62
|
}
|
|
63
63
|
function getTransformedUriAndRestArgs(uri, originalArgs, name, namespace, serviceName, version) {
|
|
64
|
-
const prefix = version ? serviceName === "logic.api.gateway" ? "" : serviceName ? `api/gateway/${serviceName}` : `api/gateway/${namespace}.${name}@${version}` : `api/gateway/api_service.${namespace}.${name}`;
|
|
64
|
+
const prefix = version ? serviceName === "logic.api.gateway" || serviceName !== null && serviceName !== void 0 && serviceName.startsWith("logic.api.gateway.") ? "" : serviceName ? `api/gateway/${serviceName}` : `api/gateway/${namespace}.${name}@${version}` : `api/gateway/api_service.${namespace}.${name}`;
|
|
65
65
|
const restArgs = originalArgs.slice();
|
|
66
66
|
const transformedUri = uri.replace(/:([^/]+)/g, () => restArgs.shift());
|
|
67
67
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlowApi.js","names":["_jsYaml","_interopRequireDefault","require","_apiGatewaySdk","_CollectContracts","remoteContractCache","Map","isFlowApiProvider","provider","includes","getArgsOfFlowApi","originalArgs","method","stream","Error","apiDefinition","fetchFlowApiDefinition","FlowApiNotFoundError","apiProfile","getApiProfileFromApiDefinition","getApiArgsFromApiProfile","uri","apiMethod","ext_fields","name","namespace","serviceName","responseWrapper","version","isFileType","request","isDownload","fileName","shift","url","args","getTransformedUriAndRestArgs","originalUri","prefix","restArgs","slice","transformedUri","replace","api","_contract$response","contract","yaml","safeLoad","schema","JSON_SCHEMA","json","endpoint","response","wrapper","toLowerCase","type","namespaceName","nameWithVersion","split","getContract","namespaceId","promise","get","fetchFlowApiDefinitionFromRemote","set","_contractData$namespa","contractData","ContractApi_searchSingleContract","contractName","constructor","message","captureStackTrace"],"sources":["../../../src/flowApi/FlowApi.ts"],"sourcesContent":["import yaml from \"js-yaml\";\nimport { ContractApi_searchSingleContract } from \"@next-api-sdk/api-gateway-sdk\";\nimport { ContractRequest, ContractResponse, ExtField } from \"@next-core/types\";\nimport { getContract } from \"./CollectContracts.js\";\n\nconst remoteContractCache = new Map<\n string,\n Promise<CustomApiDefinition | null>\n>();\n\n// Legacy Custom API: `${namespace}@${name}`\n// Flow API: `${namespace}@${name}:${version}`\nexport function isFlowApiProvider(provider: string): boolean {\n return provider.includes(\"@\");\n}\n\nexport async function getArgsOfFlowApi(\n provider: string,\n originalArgs: unknown[],\n method?: string,\n stream?: boolean\n): Promise<unknown[]> {\n if (!provider.includes(\":\")) {\n throw new Error(\n `You're using legacy Custom API \"${provider}\" which is dropped in v3, please use Flow API instead`\n );\n }\n\n const apiDefinition = await fetchFlowApiDefinition(provider);\n\n if (!apiDefinition) {\n throw new FlowApiNotFoundError(`Flow API not found: \"${provider}\"`);\n }\n\n const apiProfile = getApiProfileFromApiDefinition(provider, apiDefinition);\n\n return getApiArgsFromApiProfile(apiProfile, originalArgs, method, stream);\n}\n\nfunction getApiArgsFromApiProfile(\n {\n uri,\n method: apiMethod,\n ext_fields,\n name,\n namespace,\n serviceName,\n responseWrapper,\n version,\n isFileType,\n request,\n }: CustomApiProfile,\n originalArgs: unknown[],\n method?: string,\n stream?: boolean\n): unknown[] {\n // `saveAs` requires the first argument to be the filename.\n const isDownload = method === \"saveAs\";\n let fileName: string | undefined;\n if (isDownload) {\n fileName = originalArgs.shift() as string;\n }\n\n const { url, args } = getTransformedUriAndRestArgs(\n uri,\n originalArgs,\n name,\n namespace,\n serviceName,\n version\n );\n\n return [\n ...(isDownload ? [fileName] : []),\n {\n url,\n originalUri: uri,\n method: apiMethod,\n ext_fields,\n responseWrapper,\n request,\n isFileType,\n stream,\n },\n ...args,\n ];\n}\n\nfunction getTransformedUriAndRestArgs(\n uri: string,\n originalArgs: unknown[],\n name: string,\n namespace: string,\n serviceName: string | undefined,\n version?: string\n): { url: string; args: unknown[] } {\n const prefix = version\n ? serviceName === \"logic.api.gateway\"\n ? \"\"\n : serviceName\n ? `api/gateway/${serviceName}`\n : `api/gateway/${namespace}.${name}@${version}`\n : `api/gateway/api_service.${namespace}.${name}`;\n const restArgs = originalArgs.slice();\n const transformedUri = uri.replace(\n /:([^/]+)/g,\n () => restArgs.shift() as string\n );\n return {\n url: prefix ? prefix + transformedUri : transformedUri.replace(/^\\//, \"\"),\n args: restArgs,\n };\n}\n\nfunction getApiProfileFromApiDefinition(\n provider: string,\n api: CustomApiDefinition\n): CustomApiProfile {\n const contract: CustomApiDefinition[\"contract\"] =\n typeof api.contract === \"string\"\n ? (yaml.safeLoad(api.contract, {\n schema: yaml.JSON_SCHEMA,\n json: true,\n }) as CustomApiDefinition[\"contract\"])\n : api.contract;\n const { uri, method = \"GET\", ext_fields } = contract?.endpoint ?? {};\n const responseWrapper = contract?.response\n ? contract.response.wrapper !== false\n : false;\n if (!uri) {\n throw new Error(\n `Missing endpoint.uri in contract of provider \"${provider}\"`\n );\n }\n return {\n uri,\n method: method.toLowerCase() === \"list\" ? \"get\" : method,\n ext_fields,\n name: api.name,\n namespace: api.namespace,\n serviceName: api.serviceName,\n version: api.version,\n isFileType: contract?.response?.type === \"file\",\n responseWrapper,\n request: contract?.request,\n };\n}\n\nasync function fetchFlowApiDefinition(\n provider: string\n): Promise<CustomApiDefinition | null> {\n const [namespaceName, nameWithVersion] = provider.split(\"@\");\n const [name, version] = nameWithVersion.split(\":\");\n\n // Do not cache the result of `geContract`, which will lead to no contract\n // will be found when render twice immediately.\n const contract = getContract(`${namespaceName}.${name}`);\n if (contract) {\n return {\n name: contract.name,\n namespace: contract.namespaceId,\n serviceName: contract.serviceName,\n version: contract.version,\n contract: {\n endpoint: contract.endpoint,\n response: contract.response,\n request: contract.request,\n },\n };\n }\n let promise = remoteContractCache.get(provider);\n if (!promise) {\n promise = fetchFlowApiDefinitionFromRemote(namespaceName, name, version);\n remoteContractCache.set(provider, promise);\n }\n return promise;\n}\n\nasync function fetchFlowApiDefinitionFromRemote(\n namespace: string,\n name: string,\n version: string\n): Promise<CustomApiDefinition | null> {\n const { contractData } = await ContractApi_searchSingleContract({\n contractName: `${namespace}.${name}`,\n version,\n });\n\n // return undefined if don't found contract\n return contractData\n ? {\n name: contractData.name,\n namespace: contractData.namespace?.[0]?.name,\n serviceName: contractData.serviceName,\n version: contractData.version,\n contract: {\n endpoint: contractData.endpoint,\n response: contractData.response,\n request: contractData.request,\n },\n }\n : null;\n}\n\nexport interface CustomApiDefinition {\n name: string;\n namespace: string;\n version?: string;\n serviceName?: string;\n contract?: {\n endpoint: {\n ext_fields?: ExtField[];\n uri: string;\n method:\n | \"POST\"\n | \"post\"\n | \"PUT\"\n | \"put\"\n | \"GET\"\n | \"get\"\n | \"DELETE\"\n | \"delete\"\n | \"LIST\"\n | \"list\"\n | \"PATCH\"\n | \"patch\"\n | \"HEAD\"\n | \"head\";\n };\n request?: ContractRequest;\n response?: ContractResponse;\n };\n}\n\nexport interface CustomApiProfile {\n uri: string;\n method: string;\n name: string;\n namespace: string;\n serviceName?: string;\n responseWrapper: boolean;\n version?: string;\n isFileType?: boolean;\n ext_fields?: ExtField[];\n request?: ContractRequest;\n}\n\nclass FlowApiNotFoundError extends Error {\n constructor(message: string) {\n // Pass remaining arguments (including vendor specific ones) to parent constructor\n super(message);\n\n this.name = \"FlowApiNotFoundError\";\n\n // Maintains proper stack trace for where our error was thrown (only available on V8)\n // istanbul ignore else\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, FlowApiNotFoundError);\n }\n }\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAEA,IAAAE,iBAAA,GAAAF,OAAA;AAEA,MAAMG,mBAAmB,GAAG,IAAIC,GAAG,CAGjC,CAAC;;AAEH;AACA;AACO,SAASC,iBAAiBA,CAACC,QAAgB,EAAW;EAC3D,OAAOA,Q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,WAAWA,CAACC,OAAe,EAAE;IAC3B;IACA,KAAK,CAACA,OAAO,CAAC;IAEd,IAAI,CAAC9C,IAAI,GAAG,sBAAsB;;IAElC;IACA;IACA,IAAIV,KAAK,CAACyD,iBAAiB,EAAE;MAC3BzD,KAAK,CAACyD,iBAAiB,CAAC,IAAI,EAAEtD,oBAAoB,CAAC;IACrD;EACF;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"FlowApi.js","names":["_jsYaml","_interopRequireDefault","require","_apiGatewaySdk","_CollectContracts","remoteContractCache","Map","isFlowApiProvider","provider","includes","getArgsOfFlowApi","originalArgs","method","stream","Error","apiDefinition","fetchFlowApiDefinition","FlowApiNotFoundError","apiProfile","getApiProfileFromApiDefinition","getApiArgsFromApiProfile","uri","apiMethod","ext_fields","name","namespace","serviceName","responseWrapper","version","isFileType","request","isDownload","fileName","shift","url","args","getTransformedUriAndRestArgs","originalUri","prefix","startsWith","restArgs","slice","transformedUri","replace","api","_contract$response","contract","yaml","safeLoad","schema","JSON_SCHEMA","json","endpoint","response","wrapper","toLowerCase","type","namespaceName","nameWithVersion","split","getContract","namespaceId","promise","get","fetchFlowApiDefinitionFromRemote","set","_contractData$namespa","contractData","ContractApi_searchSingleContract","contractName","constructor","message","captureStackTrace"],"sources":["../../../src/flowApi/FlowApi.ts"],"sourcesContent":["import yaml from \"js-yaml\";\nimport { ContractApi_searchSingleContract } from \"@next-api-sdk/api-gateway-sdk\";\nimport { ContractRequest, ContractResponse, ExtField } from \"@next-core/types\";\nimport { getContract } from \"./CollectContracts.js\";\n\nconst remoteContractCache = new Map<\n string,\n Promise<CustomApiDefinition | null>\n>();\n\n// Legacy Custom API: `${namespace}@${name}`\n// Flow API: `${namespace}@${name}:${version}`\nexport function isFlowApiProvider(provider: string): boolean {\n return provider.includes(\"@\");\n}\n\nexport async function getArgsOfFlowApi(\n provider: string,\n originalArgs: unknown[],\n method?: string,\n stream?: boolean\n): Promise<unknown[]> {\n if (!provider.includes(\":\")) {\n throw new Error(\n `You're using legacy Custom API \"${provider}\" which is dropped in v3, please use Flow API instead`\n );\n }\n\n const apiDefinition = await fetchFlowApiDefinition(provider);\n\n if (!apiDefinition) {\n throw new FlowApiNotFoundError(`Flow API not found: \"${provider}\"`);\n }\n\n const apiProfile = getApiProfileFromApiDefinition(provider, apiDefinition);\n\n return getApiArgsFromApiProfile(apiProfile, originalArgs, method, stream);\n}\n\nfunction getApiArgsFromApiProfile(\n {\n uri,\n method: apiMethod,\n ext_fields,\n name,\n namespace,\n serviceName,\n responseWrapper,\n version,\n isFileType,\n request,\n }: CustomApiProfile,\n originalArgs: unknown[],\n method?: string,\n stream?: boolean\n): unknown[] {\n // `saveAs` requires the first argument to be the filename.\n const isDownload = method === \"saveAs\";\n let fileName: string | undefined;\n if (isDownload) {\n fileName = originalArgs.shift() as string;\n }\n\n const { url, args } = getTransformedUriAndRestArgs(\n uri,\n originalArgs,\n name,\n namespace,\n serviceName,\n version\n );\n\n return [\n ...(isDownload ? [fileName] : []),\n {\n url,\n originalUri: uri,\n method: apiMethod,\n ext_fields,\n responseWrapper,\n request,\n isFileType,\n stream,\n },\n ...args,\n ];\n}\n\nfunction getTransformedUriAndRestArgs(\n uri: string,\n originalArgs: unknown[],\n name: string,\n namespace: string,\n serviceName: string | undefined,\n version?: string\n): { url: string; args: unknown[] } {\n const prefix = version\n ? serviceName === \"logic.api.gateway\" ||\n serviceName?.startsWith(\"logic.api.gateway.\")\n ? \"\"\n : serviceName\n ? `api/gateway/${serviceName}`\n : `api/gateway/${namespace}.${name}@${version}`\n : `api/gateway/api_service.${namespace}.${name}`;\n const restArgs = originalArgs.slice();\n const transformedUri = uri.replace(\n /:([^/]+)/g,\n () => restArgs.shift() as string\n );\n return {\n url: prefix ? prefix + transformedUri : transformedUri.replace(/^\\//, \"\"),\n args: restArgs,\n };\n}\n\nfunction getApiProfileFromApiDefinition(\n provider: string,\n api: CustomApiDefinition\n): CustomApiProfile {\n const contract: CustomApiDefinition[\"contract\"] =\n typeof api.contract === \"string\"\n ? (yaml.safeLoad(api.contract, {\n schema: yaml.JSON_SCHEMA,\n json: true,\n }) as CustomApiDefinition[\"contract\"])\n : api.contract;\n const { uri, method = \"GET\", ext_fields } = contract?.endpoint ?? {};\n const responseWrapper = contract?.response\n ? contract.response.wrapper !== false\n : false;\n if (!uri) {\n throw new Error(\n `Missing endpoint.uri in contract of provider \"${provider}\"`\n );\n }\n return {\n uri,\n method: method.toLowerCase() === \"list\" ? \"get\" : method,\n ext_fields,\n name: api.name,\n namespace: api.namespace,\n serviceName: api.serviceName,\n version: api.version,\n isFileType: contract?.response?.type === \"file\",\n responseWrapper,\n request: contract?.request,\n };\n}\n\nasync function fetchFlowApiDefinition(\n provider: string\n): Promise<CustomApiDefinition | null> {\n const [namespaceName, nameWithVersion] = provider.split(\"@\");\n const [name, version] = nameWithVersion.split(\":\");\n\n // Do not cache the result of `geContract`, which will lead to no contract\n // will be found when render twice immediately.\n const contract = getContract(`${namespaceName}.${name}`);\n if (contract) {\n return {\n name: contract.name,\n namespace: contract.namespaceId,\n serviceName: contract.serviceName,\n version: contract.version,\n contract: {\n endpoint: contract.endpoint,\n response: contract.response,\n request: contract.request,\n },\n };\n }\n let promise = remoteContractCache.get(provider);\n if (!promise) {\n promise = fetchFlowApiDefinitionFromRemote(namespaceName, name, version);\n remoteContractCache.set(provider, promise);\n }\n return promise;\n}\n\nasync function fetchFlowApiDefinitionFromRemote(\n namespace: string,\n name: string,\n version: string\n): Promise<CustomApiDefinition | null> {\n const { contractData } = await ContractApi_searchSingleContract({\n contractName: `${namespace}.${name}`,\n version,\n });\n\n // return undefined if don't found contract\n return contractData\n ? {\n name: contractData.name,\n namespace: contractData.namespace?.[0]?.name,\n serviceName: contractData.serviceName,\n version: contractData.version,\n contract: {\n endpoint: contractData.endpoint,\n response: contractData.response,\n request: contractData.request,\n },\n }\n : null;\n}\n\nexport interface CustomApiDefinition {\n name: string;\n namespace: string;\n version?: string;\n serviceName?: string;\n contract?: {\n endpoint: {\n ext_fields?: ExtField[];\n uri: string;\n method:\n | \"POST\"\n | \"post\"\n | \"PUT\"\n | \"put\"\n | \"GET\"\n | \"get\"\n | \"DELETE\"\n | \"delete\"\n | \"LIST\"\n | \"list\"\n | \"PATCH\"\n | \"patch\"\n | \"HEAD\"\n | \"head\";\n };\n request?: ContractRequest;\n response?: ContractResponse;\n };\n}\n\nexport interface CustomApiProfile {\n uri: string;\n method: string;\n name: string;\n namespace: string;\n serviceName?: string;\n responseWrapper: boolean;\n version?: string;\n isFileType?: boolean;\n ext_fields?: ExtField[];\n request?: ContractRequest;\n}\n\nclass FlowApiNotFoundError extends Error {\n constructor(message: string) {\n // Pass remaining arguments (including vendor specific ones) to parent constructor\n super(message);\n\n this.name = \"FlowApiNotFoundError\";\n\n // Maintains proper stack trace for where our error was thrown (only available on V8)\n // istanbul ignore else\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, FlowApiNotFoundError);\n }\n }\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAEA,IAAAE,iBAAA,GAAAF,OAAA;AAEA,MAAMG,mBAAmB,GAAG,IAAIC,GAAG,CAGjC,CAAC;;AAEH;AACA;AACO,SAASC,iBAAiBA,CAACC,QAAgB,EAAW;EAC3D,OAAOA,QAAQ,CAACC,QAAQ,CAAC,GAAG,CAAC;AAC/B;AAEO,eAAeC,gBAAgBA,CACpCF,QAAgB,EAChBG,YAAuB,EACvBC,MAAe,EACfC,MAAgB,EACI;EACpB,IAAI,CAACL,QAAQ,CAACC,QAAQ,CAAC,GAAG,CAAC,EAAE;IAC3B,MAAM,IAAIK,KAAK,CACb,mCAAmCN,QAAQ,uDAC7C,CAAC;EACH;EAEA,MAAMO,aAAa,GAAG,MAAMC,sBAAsB,CAACR,QAAQ,CAAC;EAE5D,IAAI,CAACO,aAAa,EAAE;IAClB,MAAM,IAAIE,oBAAoB,CAAC,wBA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Args, method, stream) {
|
|
|
54
54
|
}, ...args];
|
|
55
55
|
}
|
|
56
56
|
function getTransformedUriAndRestArgs(uri, originalArgs, name, namespace, serviceName, version) {
|
|
57
|
-
const prefix = version ? serviceName === "logic.api.gateway" ? "" : serviceName ? `api/gateway/${serviceName}` : `api/gateway/${namespace}.${name}@${version}` : `api/gateway/api_service.${namespace}.${name}`;
|
|
57
|
+
const prefix = version ? serviceName === "logic.api.gateway" || serviceName !== null && serviceName !== void 0 && serviceName.startsWith("logic.api.gateway.") ? "" : serviceName ? `api/gateway/${serviceName}` : `api/gateway/${namespace}.${name}@${version}` : `api/gateway/api_service.${namespace}.${name}`;
|
|
58
58
|
const restArgs = originalArgs.slice();
|
|
59
59
|
const transformedUri = uri.replace(/:([^/]+)/g, () => restArgs.shift());
|
|
60
60
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlowApi.js","names":["yaml","ContractApi_searchSingleContract","getContract","remoteContractCache","Map","isFlowApiProvider","provider","includes","getArgsOfFlowApi","originalArgs","method","stream","Error","apiDefinition","fetchFlowApiDefinition","FlowApiNotFoundError","apiProfile","getApiProfileFromApiDefinition","getApiArgsFromApiProfile","_ref","uri","apiMethod","ext_fields","name","namespace","serviceName","responseWrapper","version","isFileType","request","isDownload","fileName","shift","url","args","getTransformedUriAndRestArgs","originalUri","prefix","restArgs","slice","transformedUri","replace","api","_contract$response","contract","safeLoad","schema","JSON_SCHEMA","json","endpoint","response","wrapper","toLowerCase","type","namespaceName","nameWithVersion","split","namespaceId","promise","get","fetchFlowApiDefinitionFromRemote","set","_contractData$namespa","contractData","contractName","constructor","message","captureStackTrace"],"sources":["../../../src/flowApi/FlowApi.ts"],"sourcesContent":["import yaml from \"js-yaml\";\nimport { ContractApi_searchSingleContract } from \"@next-api-sdk/api-gateway-sdk\";\nimport { ContractRequest, ContractResponse, ExtField } from \"@next-core/types\";\nimport { getContract } from \"./CollectContracts.js\";\n\nconst remoteContractCache = new Map<\n string,\n Promise<CustomApiDefinition | null>\n>();\n\n// Legacy Custom API: `${namespace}@${name}`\n// Flow API: `${namespace}@${name}:${version}`\nexport function isFlowApiProvider(provider: string): boolean {\n return provider.includes(\"@\");\n}\n\nexport async function getArgsOfFlowApi(\n provider: string,\n originalArgs: unknown[],\n method?: string,\n stream?: boolean\n): Promise<unknown[]> {\n if (!provider.includes(\":\")) {\n throw new Error(\n `You're using legacy Custom API \"${provider}\" which is dropped in v3, please use Flow API instead`\n );\n }\n\n const apiDefinition = await fetchFlowApiDefinition(provider);\n\n if (!apiDefinition) {\n throw new FlowApiNotFoundError(`Flow API not found: \"${provider}\"`);\n }\n\n const apiProfile = getApiProfileFromApiDefinition(provider, apiDefinition);\n\n return getApiArgsFromApiProfile(apiProfile, originalArgs, method, stream);\n}\n\nfunction getApiArgsFromApiProfile(\n {\n uri,\n method: apiMethod,\n ext_fields,\n name,\n namespace,\n serviceName,\n responseWrapper,\n version,\n isFileType,\n request,\n }: CustomApiProfile,\n originalArgs: unknown[],\n method?: string,\n stream?: boolean\n): unknown[] {\n // `saveAs` requires the first argument to be the filename.\n const isDownload = method === \"saveAs\";\n let fileName: string | undefined;\n if (isDownload) {\n fileName = originalArgs.shift() as string;\n }\n\n const { url, args } = getTransformedUriAndRestArgs(\n uri,\n originalArgs,\n name,\n namespace,\n serviceName,\n version\n );\n\n return [\n ...(isDownload ? [fileName] : []),\n {\n url,\n originalUri: uri,\n method: apiMethod,\n ext_fields,\n responseWrapper,\n request,\n isFileType,\n stream,\n },\n ...args,\n ];\n}\n\nfunction getTransformedUriAndRestArgs(\n uri: string,\n originalArgs: unknown[],\n name: string,\n namespace: string,\n serviceName: string | undefined,\n version?: string\n): { url: string; args: unknown[] } {\n const prefix = version\n ? serviceName === \"logic.api.gateway\"\n ? \"\"\n : serviceName\n ? `api/gateway/${serviceName}`\n : `api/gateway/${namespace}.${name}@${version}`\n : `api/gateway/api_service.${namespace}.${name}`;\n const restArgs = originalArgs.slice();\n const transformedUri = uri.replace(\n /:([^/]+)/g,\n () => restArgs.shift() as string\n );\n return {\n url: prefix ? prefix + transformedUri : transformedUri.replace(/^\\//, \"\"),\n args: restArgs,\n };\n}\n\nfunction getApiProfileFromApiDefinition(\n provider: string,\n api: CustomApiDefinition\n): CustomApiProfile {\n const contract: CustomApiDefinition[\"contract\"] =\n typeof api.contract === \"string\"\n ? (yaml.safeLoad(api.contract, {\n schema: yaml.JSON_SCHEMA,\n json: true,\n }) as CustomApiDefinition[\"contract\"])\n : api.contract;\n const { uri, method = \"GET\", ext_fields } = contract?.endpoint ?? {};\n const responseWrapper = contract?.response\n ? contract.response.wrapper !== false\n : false;\n if (!uri) {\n throw new Error(\n `Missing endpoint.uri in contract of provider \"${provider}\"`\n );\n }\n return {\n uri,\n method: method.toLowerCase() === \"list\" ? \"get\" : method,\n ext_fields,\n name: api.name,\n namespace: api.namespace,\n serviceName: api.serviceName,\n version: api.version,\n isFileType: contract?.response?.type === \"file\",\n responseWrapper,\n request: contract?.request,\n };\n}\n\nasync function fetchFlowApiDefinition(\n provider: string\n): Promise<CustomApiDefinition | null> {\n const [namespaceName, nameWithVersion] = provider.split(\"@\");\n const [name, version] = nameWithVersion.split(\":\");\n\n // Do not cache the result of `geContract`, which will lead to no contract\n // will be found when render twice immediately.\n const contract = getContract(`${namespaceName}.${name}`);\n if (contract) {\n return {\n name: contract.name,\n namespace: contract.namespaceId,\n serviceName: contract.serviceName,\n version: contract.version,\n contract: {\n endpoint: contract.endpoint,\n response: contract.response,\n request: contract.request,\n },\n };\n }\n let promise = remoteContractCache.get(provider);\n if (!promise) {\n promise = fetchFlowApiDefinitionFromRemote(namespaceName, name, version);\n remoteContractCache.set(provider, promise);\n }\n return promise;\n}\n\nasync function fetchFlowApiDefinitionFromRemote(\n namespace: string,\n name: string,\n version: string\n): Promise<CustomApiDefinition | null> {\n const { contractData } = await ContractApi_searchSingleContract({\n contractName: `${namespace}.${name}`,\n version,\n });\n\n // return undefined if don't found contract\n return contractData\n ? {\n name: contractData.name,\n namespace: contractData.namespace?.[0]?.name,\n serviceName: contractData.serviceName,\n version: contractData.version,\n contract: {\n endpoint: contractData.endpoint,\n response: contractData.response,\n request: contractData.request,\n },\n }\n : null;\n}\n\nexport interface CustomApiDefinition {\n name: string;\n namespace: string;\n version?: string;\n serviceName?: string;\n contract?: {\n endpoint: {\n ext_fields?: ExtField[];\n uri: string;\n method:\n | \"POST\"\n | \"post\"\n | \"PUT\"\n | \"put\"\n | \"GET\"\n | \"get\"\n | \"DELETE\"\n | \"delete\"\n | \"LIST\"\n | \"list\"\n | \"PATCH\"\n | \"patch\"\n | \"HEAD\"\n | \"head\";\n };\n request?: ContractRequest;\n response?: ContractResponse;\n };\n}\n\nexport interface CustomApiProfile {\n uri: string;\n method: string;\n name: string;\n namespace: string;\n serviceName?: string;\n responseWrapper: boolean;\n version?: string;\n isFileType?: boolean;\n ext_fields?: ExtField[];\n request?: ContractRequest;\n}\n\nclass FlowApiNotFoundError extends Error {\n constructor(message: string) {\n // Pass remaining arguments (including vendor specific ones) to parent constructor\n super(message);\n\n this.name = \"FlowApiNotFoundError\";\n\n // Maintains proper stack trace for where our error was thrown (only available on V8)\n // istanbul ignore else\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, FlowApiNotFoundError);\n }\n }\n}\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,SAAS;AAC1B,SAASC,gCAAgC,QAAQ,+BAA+B;AAEhF,SAASC,WAAW,QAAQ,uBAAuB;AAEnD,MAAMC,mBAAmB,GAAG,IAAIC,GAAG,CAGjC,CAAC;;AAEH;AACA;AACA,OAAO,SAASC,iBAAiBA,CAACC,QAAgB,EAAW;EAC3D,OAAOA,QAAQ,CAACC,QAAQ,CAAC,GAAG,CAAC;AAC/B;AAEA,OAAO,eAAeC,gBAAgBA,CACpCF,QAAgB,EAChBG,YAAuB,EACvBC,MAAe,EACfC,MAAgB,EACI;EACpB,IAAI,CAACL,QAAQ,CAACC,QAAQ,CAAC,GAAG,CAAC,EAA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3BvD,KAAK,CAACuD,iBAAiB,CAAC,IAAI,EAAEpD,oBAAoB,CAAC;IACrD;EACF;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"FlowApi.js","names":["yaml","ContractApi_searchSingleContract","getContract","remoteContractCache","Map","isFlowApiProvider","provider","includes","getArgsOfFlowApi","originalArgs","method","stream","Error","apiDefinition","fetchFlowApiDefinition","FlowApiNotFoundError","apiProfile","getApiProfileFromApiDefinition","getApiArgsFromApiProfile","_ref","uri","apiMethod","ext_fields","name","namespace","serviceName","responseWrapper","version","isFileType","request","isDownload","fileName","shift","url","args","getTransformedUriAndRestArgs","originalUri","prefix","startsWith","restArgs","slice","transformedUri","replace","api","_contract$response","contract","safeLoad","schema","JSON_SCHEMA","json","endpoint","response","wrapper","toLowerCase","type","namespaceName","nameWithVersion","split","namespaceId","promise","get","fetchFlowApiDefinitionFromRemote","set","_contractData$namespa","contractData","contractName","constructor","message","captureStackTrace"],"sources":["../../../src/flowApi/FlowApi.ts"],"sourcesContent":["import yaml from \"js-yaml\";\nimport { ContractApi_searchSingleContract } from \"@next-api-sdk/api-gateway-sdk\";\nimport { ContractRequest, ContractResponse, ExtField } from \"@next-core/types\";\nimport { getContract } from \"./CollectContracts.js\";\n\nconst remoteContractCache = new Map<\n string,\n Promise<CustomApiDefinition | null>\n>();\n\n// Legacy Custom API: `${namespace}@${name}`\n// Flow API: `${namespace}@${name}:${version}`\nexport function isFlowApiProvider(provider: string): boolean {\n return provider.includes(\"@\");\n}\n\nexport async function getArgsOfFlowApi(\n provider: string,\n originalArgs: unknown[],\n method?: string,\n stream?: boolean\n): Promise<unknown[]> {\n if (!provider.includes(\":\")) {\n throw new Error(\n `You're using legacy Custom API \"${provider}\" which is dropped in v3, please use Flow API instead`\n );\n }\n\n const apiDefinition = await fetchFlowApiDefinition(provider);\n\n if (!apiDefinition) {\n throw new FlowApiNotFoundError(`Flow API not found: \"${provider}\"`);\n }\n\n const apiProfile = getApiProfileFromApiDefinition(provider, apiDefinition);\n\n return getApiArgsFromApiProfile(apiProfile, originalArgs, method, stream);\n}\n\nfunction getApiArgsFromApiProfile(\n {\n uri,\n method: apiMethod,\n ext_fields,\n name,\n namespace,\n serviceName,\n responseWrapper,\n version,\n isFileType,\n request,\n }: CustomApiProfile,\n originalArgs: unknown[],\n method?: string,\n stream?: boolean\n): unknown[] {\n // `saveAs` requires the first argument to be the filename.\n const isDownload = method === \"saveAs\";\n let fileName: string | undefined;\n if (isDownload) {\n fileName = originalArgs.shift() as string;\n }\n\n const { url, args } = getTransformedUriAndRestArgs(\n uri,\n originalArgs,\n name,\n namespace,\n serviceName,\n version\n );\n\n return [\n ...(isDownload ? [fileName] : []),\n {\n url,\n originalUri: uri,\n method: apiMethod,\n ext_fields,\n responseWrapper,\n request,\n isFileType,\n stream,\n },\n ...args,\n ];\n}\n\nfunction getTransformedUriAndRestArgs(\n uri: string,\n originalArgs: unknown[],\n name: string,\n namespace: string,\n serviceName: string | undefined,\n version?: string\n): { url: string; args: unknown[] } {\n const prefix = version\n ? serviceName === \"logic.api.gateway\" ||\n serviceName?.startsWith(\"logic.api.gateway.\")\n ? \"\"\n : serviceName\n ? `api/gateway/${serviceName}`\n : `api/gateway/${namespace}.${name}@${version}`\n : `api/gateway/api_service.${namespace}.${name}`;\n const restArgs = originalArgs.slice();\n const transformedUri = uri.replace(\n /:([^/]+)/g,\n () => restArgs.shift() as string\n );\n return {\n url: prefix ? prefix + transformedUri : transformedUri.replace(/^\\//, \"\"),\n args: restArgs,\n };\n}\n\nfunction getApiProfileFromApiDefinition(\n provider: string,\n api: CustomApiDefinition\n): CustomApiProfile {\n const contract: CustomApiDefinition[\"contract\"] =\n typeof api.contract === \"string\"\n ? (yaml.safeLoad(api.contract, {\n schema: yaml.JSON_SCHEMA,\n json: true,\n }) as CustomApiDefinition[\"contract\"])\n : api.contract;\n const { uri, method = \"GET\", ext_fields } = contract?.endpoint ?? {};\n const responseWrapper = contract?.response\n ? contract.response.wrapper !== false\n : false;\n if (!uri) {\n throw new Error(\n `Missing endpoint.uri in contract of provider \"${provider}\"`\n );\n }\n return {\n uri,\n method: method.toLowerCase() === \"list\" ? \"get\" : method,\n ext_fields,\n name: api.name,\n namespace: api.namespace,\n serviceName: api.serviceName,\n version: api.version,\n isFileType: contract?.response?.type === \"file\",\n responseWrapper,\n request: contract?.request,\n };\n}\n\nasync function fetchFlowApiDefinition(\n provider: string\n): Promise<CustomApiDefinition | null> {\n const [namespaceName, nameWithVersion] = provider.split(\"@\");\n const [name, version] = nameWithVersion.split(\":\");\n\n // Do not cache the result of `geContract`, which will lead to no contract\n // will be found when render twice immediately.\n const contract = getContract(`${namespaceName}.${name}`);\n if (contract) {\n return {\n name: contract.name,\n namespace: contract.namespaceId,\n serviceName: contract.serviceName,\n version: contract.version,\n contract: {\n endpoint: contract.endpoint,\n response: contract.response,\n request: contract.request,\n },\n };\n }\n let promise = remoteContractCache.get(provider);\n if (!promise) {\n promise = fetchFlowApiDefinitionFromRemote(namespaceName, name, version);\n remoteContractCache.set(provider, promise);\n }\n return promise;\n}\n\nasync function fetchFlowApiDefinitionFromRemote(\n namespace: string,\n name: string,\n version: string\n): Promise<CustomApiDefinition | null> {\n const { contractData } = await ContractApi_searchSingleContract({\n contractName: `${namespace}.${name}`,\n version,\n });\n\n // return undefined if don't found contract\n return contractData\n ? {\n name: contractData.name,\n namespace: contractData.namespace?.[0]?.name,\n serviceName: contractData.serviceName,\n version: contractData.version,\n contract: {\n endpoint: contractData.endpoint,\n response: contractData.response,\n request: contractData.request,\n },\n }\n : null;\n}\n\nexport interface CustomApiDefinition {\n name: string;\n namespace: string;\n version?: string;\n serviceName?: string;\n contract?: {\n endpoint: {\n ext_fields?: ExtField[];\n uri: string;\n method:\n | \"POST\"\n | \"post\"\n | \"PUT\"\n | \"put\"\n | \"GET\"\n | \"get\"\n | \"DELETE\"\n | \"delete\"\n | \"LIST\"\n | \"list\"\n | \"PATCH\"\n | \"patch\"\n | \"HEAD\"\n | \"head\";\n };\n request?: ContractRequest;\n response?: ContractResponse;\n };\n}\n\nexport interface CustomApiProfile {\n uri: string;\n method: string;\n name: string;\n namespace: string;\n serviceName?: string;\n responseWrapper: boolean;\n version?: string;\n isFileType?: boolean;\n ext_fields?: ExtField[];\n request?: ContractRequest;\n}\n\nclass FlowApiNotFoundError extends Error {\n constructor(message: string) {\n // Pass remaining arguments (including vendor specific ones) to parent constructor\n super(message);\n\n this.name = \"FlowApiNotFoundError\";\n\n // Maintains proper stack trace for where our error was thrown (only available on V8)\n // istanbul ignore else\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, FlowApiNotFoundError);\n }\n }\n}\n"],"mappings":"AAAA,OAAOA,IAAI,MAAM,SAAS;AAC1B,SAASC,gCAAgC,QAAQ,+BAA+B;AAEhF,SAASC,WAAW,QAAQ,uBAAuB;AAEnD,MAAMC,mBAAmB,GAAG,IAAIC,GAAG,CAGjC,CAAC;;AAEH;AACA;AACA,OAAO,SAASC,iBAAiBA,CAACC,QAAgB,EAAW;EAC3D,OAAOA,QAAQ,CAACC,QAAQ,CAAC,GAAG,CAAC;AAC/B;AAEA,OAAO,eAAeC,gBAAgBA,CACpCF,QAAgB,EAChBG,YAAuB,EACvBC,MAAe,EACfC,MAAgB,EACI;EACpB,IAAI,CAACL,QAAQ,CAACC,QAAQ,CAAC,GAAG,CAAC,EAAE;IAC3B,MAAM,IAAIK,KAAK,CACb,mCAAmCN,QAAQ,uDAC7C,CAAC;EACH;EAEA,MAAMO,aAAa,GAAG,MAAMC,sBAAsB,CAACR,QAAQ,CAAC;EAE5D,IAAI,CAACO,aAAa,EAAE;IAClB,MAAM,IAAIE,oBAAoB,CAAC,wBAAwBT,QAAQ,GAAG,CAAC;EACrE;EAEA,MAAMU,UAAU,GAAGC,8BAA8B,CAACX,QAAQ,EAAEO,aAAa,CAAC;EAE1E,OAAOK,wBAAwB,CAACF,UAAU,EAAEP,YAAY,EAAEC,MAAM,EAAEC,MAAM,CAAC;AAC3E;AAEA,SAASO,wBAA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AC7CrC,SAAiB,EACjBD,IAAY,EACZI,OAAe,EACsB;EAAA,IAAAoC,qBAAA;EACrC,MAAM;IAAEC;EAAa,CAAC,GAAG,MAAM/D,gCAAgC,CAAC;IAC9DgE,YAAY,EAAE,GAAGzC,SAAS,IAAID,IAAI,EAAE;IACpCI;EACF,CAAC,CAAC;;EAEF;EACA,OAAOqC,YAAY,GACf;IACEzC,IAAI,EAAEyC,YAAY,CAACzC,IAAI;IACvBC,SAAS,GAAAuC,qBAAA,GAAEC,YAAY,CAACxC,SAAS,cAAAuC,qBAAA,gBAAAA,qBAAA,GAAtBA,qBAAA,CAAyB,CAAC,CAAC,cAAAA,qBAAA,uBAA3BA,qBAAA,CAA6BxC,IAAI;IAC5CE,WAAW,EAAEuC,YAAY,CAACvC,WAAW;IACrCE,OAAO,EAAEqC,YAAY,CAACrC,OAAO;IAC7BkB,QAAQ,EAAE;MACRK,QAAQ,EAAEc,YAAY,CAACd,QAAQ;MAC/BC,QAAQ,EAAEa,YAAY,CAACb,QAAQ;MAC/BtB,OAAO,EAAEmC,YAAY,CAACnC;IACxB;EACF,CAAC,GACD,IAAI;AACV;AA6CA,MAAMd,oBAAoB,SAASH,KAAK,CAAC;EACvCsD,WAAWA,CAACC,OAAe,EAAE;IAC3B;IACA,KAAK,CAACA,OAAO,CAAC;IAEd,IAAI,CAAC5C,IAAI,GAAG,sBAAsB;;IAElC;IACA;IACA,IAAIX,KAAK,CAACwD,iBAAiB,EAAE;MAC3BxD,KAAK,CAACwD,iBAAiB,CAAC,IAAI,EAAErD,oBAAoB,CAAC;IACrD;EACF;AACF","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@next-core/easyops-runtime",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.21",
|
|
4
4
|
"homepage": "https://github.com/easyops-cn/next-core/tree/v3/packages/easyops-runtime",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"repository": {
|
|
@@ -45,20 +45,20 @@
|
|
|
45
45
|
"@next-api-sdk/cmdb-sdk": "^1.1.0",
|
|
46
46
|
"@next-api-sdk/micro-app-sdk": "^1.2.1",
|
|
47
47
|
"@next-api-sdk/micro-app-standalone-sdk": "^1.1.0",
|
|
48
|
-
"@next-core/cook": "^2.4.
|
|
49
|
-
"@next-core/http": "^1.2.
|
|
50
|
-
"@next-core/pipes": "^2.0.
|
|
51
|
-
"@next-core/runtime": "^1.49.
|
|
52
|
-
"@next-core/types": "^1.11.
|
|
53
|
-
"@next-core/utils": "^1.7.
|
|
48
|
+
"@next-core/cook": "^2.4.4",
|
|
49
|
+
"@next-core/http": "^1.2.5",
|
|
50
|
+
"@next-core/pipes": "^2.0.23",
|
|
51
|
+
"@next-core/runtime": "^1.49.6",
|
|
52
|
+
"@next-core/types": "^1.11.2",
|
|
53
|
+
"@next-core/utils": "^1.7.13",
|
|
54
54
|
"js-yaml": "^3.14.1",
|
|
55
55
|
"lodash": "^4.17.21"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@next-core/build-next-libs": "^1.0.
|
|
59
|
-
"@next-core/test-next": "^1.1.
|
|
58
|
+
"@next-core/build-next-libs": "^1.0.18",
|
|
59
|
+
"@next-core/test-next": "^1.1.4",
|
|
60
60
|
"jest-websocket-mock": "^2.5.0",
|
|
61
61
|
"whatwg-fetch": "^3.6.20"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "d84d4391ad8b3391d63e251cfdf020464a49e6c9"
|
|
64
64
|
}
|