@ms-cloudpack/api-server 0.17.1 → 0.18.1
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/ensurePackageBundled.d.ts +23 -0
- package/lib/apis/ensurePackageBundled.d.ts.map +1 -1
- package/lib/apis/ensurePackageBundled.js +8 -11
- package/lib/apis/ensurePackageBundled.js.map +1 -1
- package/lib/apis/index.d.ts +1 -0
- package/lib/apis/index.d.ts.map +1 -1
- package/lib/apis/index.js.map +1 -1
- package/lib/apis.d.ts +1 -0
- package/lib/apis.d.ts.map +1 -1
- package/lib/apis.js.map +1 -1
- package/lib/trpc/createAppRouter.d.ts +6 -0
- package/lib/trpc/createAppRouter.d.ts.map +1 -1
- package/lib/trpc/createCloudpackServer.d.ts +3 -0
- package/lib/trpc/createCloudpackServer.d.ts.map +1 -1
- package/lib/types/BundleRequest.d.ts +1 -1
- package/lib/types/BundleRequest.d.ts.map +1 -1
- package/lib/types/BundleRequest.js.map +1 -1
- package/lib/utilities/bundleTask.d.ts +0 -2
- package/lib/utilities/bundleTask.d.ts.map +1 -1
- package/lib/utilities/bundleTask.js +25 -13
- package/lib/utilities/bundleTask.js.map +1 -1
- package/lib/utilities/createBundleRequestForPackage.d.ts +1 -2
- package/lib/utilities/createBundleRequestForPackage.d.ts.map +1 -1
- package/lib/utilities/createBundleRequestForPackage.js +2 -3
- package/lib/utilities/createBundleRequestForPackage.js.map +1 -1
- package/lib/utilities/createBundleTask.d.ts +1 -7
- package/lib/utilities/createBundleTask.d.ts.map +1 -1
- package/lib/utilities/createBundleTask.js +2 -3
- package/lib/utilities/createBundleTask.js.map +1 -1
- package/lib/utilities/findImports.d.ts +2 -2
- package/lib/utilities/findImports.d.ts.map +1 -1
- package/lib/utilities/findImports.js +6 -6
- package/lib/utilities/findImports.js.map +1 -1
- package/lib/utilities/getBundleDetails.d.ts +0 -2
- package/lib/utilities/getBundleDetails.d.ts.map +1 -1
- package/lib/utilities/getBundleDetails.js +7 -3
- package/lib/utilities/getBundleDetails.js.map +1 -1
- package/lib/utilities/getPackagesToSync.js +1 -1
- package/lib/utilities/getPackagesToSync.js.map +1 -1
- package/lib/utilities/hashPackage.d.ts +4 -6
- package/lib/utilities/hashPackage.d.ts.map +1 -1
- package/lib/utilities/hashPackage.js +15 -21
- package/lib/utilities/hashPackage.js.map +1 -1
- package/lib/utilities/validateBundleRequestResult.d.ts +1 -1
- package/lib/utilities/validateBundleRequestResult.d.ts.map +1 -1
- package/lib/utilities/validateBundleRequestResult.js +2 -7
- package/lib/utilities/validateBundleRequestResult.js.map +1 -1
- package/package.json +7 -7
- package/lib/utilities/calculateHashOfInlinedDependencies.d.ts +0 -9
- package/lib/utilities/calculateHashOfInlinedDependencies.d.ts.map +0 -1
- package/lib/utilities/calculateHashOfInlinedDependencies.js +0 -18
- package/lib/utilities/calculateHashOfInlinedDependencies.js.map +0 -1
- package/lib/utilities/getPackageHashEntries.d.ts +0 -69
- package/lib/utilities/getPackageHashEntries.d.ts.map +0 -1
- package/lib/utilities/getPackageHashEntries.js +0 -29
- package/lib/utilities/getPackageHashEntries.js.map +0 -1
- package/lib/utilities/getPackagePath.d.ts +0 -16
- package/lib/utilities/getPackagePath.d.ts.map +0 -1
- package/lib/utilities/getPackagePath.js +0 -19
- package/lib/utilities/getPackagePath.js.map +0 -1
- package/lib/utilities/getSourceHash.d.ts +0 -9
- package/lib/utilities/getSourceHash.d.ts.map +0 -1
- package/lib/utilities/getSourceHash.js +0 -21
- package/lib/utilities/getSourceHash.js.map +0 -1
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { isExternalPackage } from '@ms-cloudpack/package-utilities';
|
|
2
|
-
import { getPackagePath } from './getPackagePath.js';
|
|
3
|
-
import { getSourceHash } from './getSourceHash.js';
|
|
4
|
-
/**
|
|
5
|
-
* @returns the entries that are used to calculate the hash of a package
|
|
6
|
-
*/
|
|
7
|
-
export async function getPackageHashEntries(packageIdentifier, context) {
|
|
8
|
-
const { packages, resolveMap, hashDependencies } = context;
|
|
9
|
-
const packagePath = getPackagePath(packageIdentifier, { resolveMap });
|
|
10
|
-
const definition = await packages.get(packagePath);
|
|
11
|
-
if (!definition) {
|
|
12
|
-
throw new Error(`Package definition (package.json) missing or invalid at "${packagePath}"`);
|
|
13
|
-
}
|
|
14
|
-
const { name, inlinedDependencies } = definition;
|
|
15
|
-
if (!name) {
|
|
16
|
-
throw new Error(`Package definition (package.json) missing name at "${packagePath}"`);
|
|
17
|
-
}
|
|
18
|
-
const isExternal = isExternalPackage(packagePath);
|
|
19
|
-
const filesHash = !isExternal ? await getSourceHash({ packagePath }) : undefined;
|
|
20
|
-
const inlinedDependenciesHash = inlinedDependencies && (await hashDependencies(inlinedDependencies));
|
|
21
|
-
const version = (isExternal ? definition.version : packagePath) || packagePath;
|
|
22
|
-
return {
|
|
23
|
-
...definition,
|
|
24
|
-
version,
|
|
25
|
-
filesHash,
|
|
26
|
-
inlinedDependenciesHash,
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=getPackageHashEntries.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getPackageHashEntries.js","sourceRoot":"","sources":["../../src/utilities/getPackageHashEntries.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAmB,MAAM,iCAAiC,CAAC;AACrF,OAAO,EAAE,cAAc,EAA0B,MAAM,qBAAqB,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,iBAAoC,EACpC,OAIC;IAED,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC;IAC3D,MAAM,WAAW,GAAG,cAAc,CAAC,iBAAiB,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC;IAEtE,MAAM,UAAU,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAEnD,IAAI,CAAC,UAAU,EAAE;QACf,MAAM,IAAI,KAAK,CAAC,4DAA4D,WAAW,GAAG,CAAC,CAAC;KAC7F;IAED,MAAM,EAAE,IAAI,EAAE,mBAAmB,EAAE,GAAG,UAAU,CAAC;IAEjD,IAAI,CAAC,IAAI,EAAE;QACT,MAAM,IAAI,KAAK,CAAC,sDAAsD,WAAW,GAAG,CAAC,CAAC;KACvF;IAED,MAAM,UAAU,GAAG,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAElD,MAAM,SAAS,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,aAAa,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAEjF,MAAM,uBAAuB,GAAG,mBAAmB,IAAI,CAAC,MAAM,gBAAgB,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAErG,MAAM,OAAO,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,WAAW,CAAC;IAE/E,OAAO;QACL,GAAG,UAAU;QACb,OAAO;QACP,SAAS;QACT,uBAAuB;KACxB,CAAC;AACJ,CAAC","sourcesContent":["import type { PackageDefinitionsCache, PackageJsonDependencies } from '@ms-cloudpack/bundler-types';\nimport { isExternalPackage, type ResolveMap } from '@ms-cloudpack/package-utilities';\nimport { getPackagePath, type PackageIdentifier } from './getPackagePath.js';\nimport { getSourceHash } from './getSourceHash.js';\n\n/**\n * @returns the entries that are used to calculate the hash of a package\n */\nexport async function getPackageHashEntries(\n packageIdentifier: PackageIdentifier,\n context: {\n packages: PackageDefinitionsCache;\n resolveMap: ResolveMap;\n hashDependencies: (dependencies: PackageJsonDependencies) => Promise<Record<string, string>>;\n },\n) {\n const { packages, resolveMap, hashDependencies } = context;\n const packagePath = getPackagePath(packageIdentifier, { resolveMap });\n\n const definition = await packages.get(packagePath);\n\n if (!definition) {\n throw new Error(`Package definition (package.json) missing or invalid at \"${packagePath}\"`);\n }\n\n const { name, inlinedDependencies } = definition;\n\n if (!name) {\n throw new Error(`Package definition (package.json) missing name at \"${packagePath}\"`);\n }\n\n const isExternal = isExternalPackage(packagePath);\n\n const filesHash = !isExternal ? await getSourceHash({ packagePath }) : undefined;\n\n const inlinedDependenciesHash = inlinedDependencies && (await hashDependencies(inlinedDependencies));\n\n const version = (isExternal ? definition.version : packagePath) || packagePath;\n\n return {\n ...definition,\n version,\n filesHash,\n inlinedDependenciesHash,\n };\n}\n"]}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { type ResolveMap } from '@ms-cloudpack/package-utilities';
|
|
2
|
-
export type PackageIdentifier = {
|
|
3
|
-
name: string;
|
|
4
|
-
version?: string;
|
|
5
|
-
} | {
|
|
6
|
-
packagePath: string;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Given the name and version of a package, or the path to a package, return the path to the package.
|
|
10
|
-
* @param packageIdentifier Either name and version or packagePath
|
|
11
|
-
* @returns The path to the package
|
|
12
|
-
*/
|
|
13
|
-
export declare function getPackagePath(packageIdentifier: PackageIdentifier, context: {
|
|
14
|
-
resolveMap: ResolveMap;
|
|
15
|
-
}): string;
|
|
16
|
-
//# sourceMappingURL=getPackagePath.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getPackagePath.d.ts","sourceRoot":"","sources":["../../src/utilities/getPackagePath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAEvF,MAAM,MAAM,iBAAiB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7F;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,iBAAiB,EAAE,iBAAiB,EAAE,OAAO,EAAE;IAAE,UAAU,EAAE,UAAU,CAAA;CAAE,UAavG"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { findResolveMapEntry } from '@ms-cloudpack/package-utilities';
|
|
2
|
-
/**
|
|
3
|
-
* Given the name and version of a package, or the path to a package, return the path to the package.
|
|
4
|
-
* @param packageIdentifier Either name and version or packagePath
|
|
5
|
-
* @returns The path to the package
|
|
6
|
-
*/
|
|
7
|
-
export function getPackagePath(packageIdentifier, context) {
|
|
8
|
-
if ('packagePath' in packageIdentifier) {
|
|
9
|
-
return packageIdentifier.packagePath;
|
|
10
|
-
}
|
|
11
|
-
const { resolveMap } = context;
|
|
12
|
-
const { name, version } = packageIdentifier;
|
|
13
|
-
const resolveMapEntry = findResolveMapEntry({ packageName: name, version, resolveMap });
|
|
14
|
-
if (!resolveMapEntry) {
|
|
15
|
-
throw new Error(`Missing dependency. Can not find ${name} in the resolve map`);
|
|
16
|
-
}
|
|
17
|
-
return resolveMapEntry.path;
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=getPackagePath.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getPackagePath.js","sourceRoot":"","sources":["../../src/utilities/getPackagePath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAmB,MAAM,iCAAiC,CAAC;AAIvF;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,iBAAoC,EAAE,OAAmC;IACtG,IAAI,aAAa,IAAI,iBAAiB,EAAE;QACtC,OAAO,iBAAiB,CAAC,WAAW,CAAC;KACtC;IAED,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAC/B,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,iBAAiB,CAAC;IAC5C,MAAM,eAAe,GAAG,mBAAmB,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,CAAC;IACxF,IAAI,CAAC,eAAe,EAAE;QACpB,MAAM,IAAI,KAAK,CAAC,oCAAoC,IAAI,qBAAqB,CAAC,CAAC;KAChF;IAED,OAAO,eAAe,CAAC,IAAI,CAAC;AAC9B,CAAC","sourcesContent":["import { findResolveMapEntry, type ResolveMap } from '@ms-cloudpack/package-utilities';\n\nexport type PackageIdentifier = { name: string; version?: string } | { packagePath: string };\n\n/**\n * Given the name and version of a package, or the path to a package, return the path to the package.\n * @param packageIdentifier Either name and version or packagePath\n * @returns The path to the package\n */\nexport function getPackagePath(packageIdentifier: PackageIdentifier, context: { resolveMap: ResolveMap }) {\n if ('packagePath' in packageIdentifier) {\n return packageIdentifier.packagePath;\n }\n\n const { resolveMap } = context;\n const { name, version } = packageIdentifier;\n const resolveMapEntry = findResolveMapEntry({ packageName: name, version, resolveMap });\n if (!resolveMapEntry) {\n throw new Error(`Missing dependency. Can not find ${name} in the resolve map`);\n }\n\n return resolveMapEntry.path;\n}\n"]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get the hash of the source files in a package
|
|
3
|
-
* If there is a src folder, only hash the files in that folder and the .*json files
|
|
4
|
-
* Otherwise, hash all files except node_modules
|
|
5
|
-
*/
|
|
6
|
-
export declare function getSourceHash(options: {
|
|
7
|
-
packagePath: string;
|
|
8
|
-
}): Promise<Record<string, string> | null>;
|
|
9
|
-
//# sourceMappingURL=getSourceHash.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getSourceHash.d.ts","sourceRoot":"","sources":["../../src/utilities/getSourceHash.ts"],"names":[],"mappings":"AAOA;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,0CAanE"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import glob from 'fast-glob';
|
|
2
|
-
import { existsSync } from 'fs';
|
|
3
|
-
import { hash } from 'glob-hasher';
|
|
4
|
-
import path from 'path';
|
|
5
|
-
const excludeNodeModules = '!**/node_modules/**';
|
|
6
|
-
/**
|
|
7
|
-
* Get the hash of the source files in a package
|
|
8
|
-
* If there is a src folder, only hash the files in that folder and the .*json files
|
|
9
|
-
* Otherwise, hash all files except node_modules
|
|
10
|
-
*/
|
|
11
|
-
export async function getSourceHash(options) {
|
|
12
|
-
const { packagePath } = options;
|
|
13
|
-
const shouldUseSrc = existsSync(path.join(packagePath, 'src'));
|
|
14
|
-
const patterns = shouldUseSrc ? ['src/**', '*.json', excludeNodeModules] : ['**', excludeNodeModules];
|
|
15
|
-
const files = await glob(patterns, {
|
|
16
|
-
cwd: packagePath,
|
|
17
|
-
});
|
|
18
|
-
const globHash = hash(files, { cwd: packagePath });
|
|
19
|
-
return globHash;
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=getSourceHash.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getSourceHash.js","sourceRoot":"","sources":["../../src/utilities/getSourceHash.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,MAAM,kBAAkB,GAAG,qBAAqB,CAAC;AAEjD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAAgC;IAClE,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IAEhC,MAAM,YAAY,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC;IAC/D,MAAM,QAAQ,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC;IAEtG,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE;QACjC,GAAG,EAAE,WAAW;KACjB,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,WAAW,EAAE,CAAC,CAAC;IAEnD,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import glob from 'fast-glob';\nimport { existsSync } from 'fs';\nimport { hash } from 'glob-hasher';\nimport path from 'path';\n\nconst excludeNodeModules = '!**/node_modules/**';\n\n/**\n * Get the hash of the source files in a package\n * If there is a src folder, only hash the files in that folder and the .*json files\n * Otherwise, hash all files except node_modules\n */\nexport async function getSourceHash(options: { packagePath: string }) {\n const { packagePath } = options;\n\n const shouldUseSrc = existsSync(path.join(packagePath, 'src'));\n const patterns = shouldUseSrc ? ['src/**', '*.json', excludeNodeModules] : ['**', excludeNodeModules];\n\n const files = await glob(patterns, {\n cwd: packagePath,\n });\n\n const globHash = hash(files, { cwd: packagePath });\n\n return globHash;\n}\n"]}
|