@ms-cloudpack/api-server 0.13.2 → 0.13.3
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.
- package/lib/apis/addPackageOverride.d.ts +2 -2
- package/lib/apis/ensurePackageBundled.d.ts +31 -9
- package/lib/apis/ensurePackageBundled.d.ts.map +1 -1
- package/lib/apis/ensurePackageBundled.js +27 -5
- package/lib/apis/ensurePackageBundled.js.map +1 -1
- package/lib/apis/getData.d.ts +2 -2
- package/lib/apis/getSessionId.d.ts +2 -2
- package/lib/apis/index.d.ts +1 -0
- package/lib/apis/index.d.ts.map +1 -1
- package/lib/apis/index.js +1 -0
- package/lib/apis/index.js.map +1 -1
- package/lib/apis/onDataChanged.d.ts +2 -2
- package/lib/apis/openCodeEditor.d.ts +2 -2
- package/lib/apis/openConfigEditor.d.ts +2 -2
- package/lib/apis/openFilePath.d.ts +2 -2
- package/lib/apis/reportMetric.d.ts +2 -2
- package/lib/apis/syncDownload.d.ts +2 -2
- package/lib/apis/syncUpload.d.ts +2 -2
- package/lib/apis/validatePackageOverride.d.ts +2 -2
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/trpc/common.d.ts +3 -3
- package/lib/trpc/createAppRouter.d.ts +185 -23
- package/lib/trpc/createAppRouter.d.ts.map +1 -1
- package/lib/trpc/createCloudpackServer.d.ts +62 -1
- package/lib/trpc/createCloudpackServer.d.ts.map +1 -1
- package/lib/trpc/createCloudpackServer.js.map +1 -1
- package/lib/trpc/createRouterFromApis.d.ts +1 -1
- package/lib/utilities/bundleTask.d.ts.map +1 -1
- package/lib/utilities/bundleTask.js +3 -6
- package/lib/utilities/bundleTask.js.map +1 -1
- package/lib/utilities/createBundleRequestForPackage.d.ts +3 -0
- package/lib/utilities/createBundleRequestForPackage.d.ts.map +1 -1
- package/lib/utilities/createBundleRequestForPackage.js +3 -2
- package/lib/utilities/createBundleRequestForPackage.js.map +1 -1
- package/lib/utilities/validateBundleRequestResult.d.ts +13 -0
- package/lib/utilities/validateBundleRequestResult.d.ts.map +1 -0
- package/lib/utilities/validateBundleRequestResult.js +28 -0
- package/lib/utilities/validateBundleRequestResult.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validates the result of a bundle request.
|
|
3
|
+
* @param options - The options to use when validating the result.
|
|
4
|
+
* @returns True if the result is valid, false otherwise.
|
|
5
|
+
*/
|
|
6
|
+
export function validateBundleRequestResult(options) {
|
|
7
|
+
const { bundleRequest, hash } = options;
|
|
8
|
+
const { enableCacheInternalPackages, enableFindImports, isExternal, result } = bundleRequest;
|
|
9
|
+
if (!result) {
|
|
10
|
+
// The result is undefined, so the result is invalid
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
if (result?.errors?.length) {
|
|
14
|
+
// There are errors, so the result is invalid
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
const { dependencies } = result;
|
|
18
|
+
if (enableFindImports && !dependencies) {
|
|
19
|
+
// enableFindImports is true, but dependencies are undefined, dependencies should have been populated by bundleTask. This is an invalid result.
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
if (enableCacheInternalPackages && !isExternal && result.hash !== hash) {
|
|
23
|
+
// The package is internal, enableCacheInternalPackages is enabled but hashes do not match, this is an invalid result.
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=validateBundleRequestResult.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateBundleRequestResult.js","sourceRoot":"","sources":["../../src/utilities/validateBundleRequestResult.ts"],"names":[],"mappings":"AAOA;;;;GAIG;AACH,MAAM,UAAU,2BAA2B,CAAC,OAAmC;IAC7E,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;IACxC,MAAM,EAAE,2BAA2B,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,aAAa,CAAC;IAE7F,IAAI,CAAC,MAAM,EAAE;QACX,oDAAoD;QACpD,OAAO,KAAK,CAAC;KACd;IAED,IAAI,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE;QAC1B,6CAA6C;QAC7C,OAAO,KAAK,CAAC;KACd;IAED,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,CAAC;IAChC,IAAI,iBAAiB,IAAI,CAAC,YAAY,EAAE;QACtC,+IAA+I;QAC/I,OAAO,KAAK,CAAC;KACd;IAED,IAAI,2BAA2B,IAAI,CAAC,UAAU,IAAI,MAAM,CAAC,IAAI,KAAK,IAAI,EAAE;QACtE,sHAAsH;QACtH,OAAO,KAAK,CAAC;KACd;IAED,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import type { BundleRequest } from '../types/BundleRequest.js';\n\ninterface ValidateResultsJsonOptions {\n bundleRequest: BundleRequest;\n hash?: string;\n}\n\n/**\n * Validates the result of a bundle request.\n * @param options - The options to use when validating the result.\n * @returns True if the result is valid, false otherwise.\n */\nexport function validateBundleRequestResult(options: ValidateResultsJsonOptions): boolean {\n const { bundleRequest, hash } = options;\n const { enableCacheInternalPackages, enableFindImports, isExternal, result } = bundleRequest;\n\n if (!result) {\n // The result is undefined, so the result is invalid\n return false;\n }\n\n if (result?.errors?.length) {\n // There are errors, so the result is invalid\n return false;\n }\n\n const { dependencies } = result;\n if (enableFindImports && !dependencies) {\n // enableFindImports is true, but dependencies are undefined, dependencies should have been populated by bundleTask. This is an invalid result.\n return false;\n }\n\n if (enableCacheInternalPackages && !isExternal && result.hash !== hash) {\n // The package is internal, enableCacheInternalPackages is enabled but hashes do not match, this is an invalid result.\n return false;\n }\n\n return true;\n}\n"]}
|