@ms-cloudpack/api-server 0.17.0 → 0.18.0
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 +6 -4
- 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/common/createSession.d.ts.map +1 -1
- package/lib/common/createSession.js +2 -1
- package/lib/common/createSession.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.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/addOverride.d.ts.map +1 -1
- package/lib/utilities/addOverride.js +4 -2
- package/lib/utilities/addOverride.js.map +1 -1
- package/lib/utilities/bundleTask.js +21 -9
- package/lib/utilities/bundleTask.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/getPackageHashEntries.d.ts +8 -7
- package/lib/utilities/getPackageHashEntries.d.ts.map +1 -1
- package/lib/utilities/getPackageHashEntries.js +5 -6
- package/lib/utilities/getPackageHashEntries.js.map +1 -1
- package/lib/utilities/getPackagePath.d.ts +22 -2
- package/lib/utilities/getPackagePath.d.ts.map +1 -1
- package/lib/utilities/getPackagePath.js +4 -3
- package/lib/utilities/getPackagePath.js.map +1 -1
- package/lib/utilities/hashPackage.d.ts.map +1 -1
- package/lib/utilities/hashPackage.js +18 -15
- package/lib/utilities/hashPackage.js.map +1 -1
- package/lib/utilities/parseRequestInfo.d.ts +7 -0
- package/lib/utilities/parseRequestInfo.d.ts.map +1 -0
- package/lib/utilities/parseRequestInfo.js +14 -0
- package/lib/utilities/parseRequestInfo.js.map +1 -0
- 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/lib/utilities/validateOverride.d.ts.map +1 -1
- package/lib/utilities/validateOverride.js +4 -2
- package/lib/utilities/validateOverride.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/parseRequestUrl.d.ts +0 -23
- package/lib/utilities/parseRequestUrl.d.ts.map +0 -1
- package/lib/utilities/parseRequestUrl.js +0 -48
- package/lib/utilities/parseRequestUrl.js.map +0 -1
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { PackageJsonDependencies } from '@ms-cloudpack/bundler-types';
|
|
2
|
-
export declare function calculateHashOfInlinedDependencies(options: {
|
|
3
|
-
inlinedDependencies: PackageJsonDependencies;
|
|
4
|
-
hashPackage: (options: {
|
|
5
|
-
name: string;
|
|
6
|
-
version?: string;
|
|
7
|
-
}) => Promise<string>;
|
|
8
|
-
}): Promise<Record<string, string>>;
|
|
9
|
-
//# sourceMappingURL=calculateHashOfInlinedDependencies.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"calculateHashOfInlinedDependencies.d.ts","sourceRoot":"","sources":["../../src/utilities/calculateHashOfInlinedDependencies.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAE3E,wBAAsB,kCAAkC,CAAC,OAAO,EAAE;IAChE,mBAAmB,EAAE,uBAAuB,CAAC;IAC7C,WAAW,EAAE,CAAC,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CAC/E,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAwB,MAAM,CAAY,CAAC,CAuBnE"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export async function calculateHashOfInlinedDependencies(options) {
|
|
2
|
-
const { inlinedDependencies, hashPackage } = options;
|
|
3
|
-
const calculatePackageHash = async ([name, version]) => {
|
|
4
|
-
return {
|
|
5
|
-
name,
|
|
6
|
-
hash: await hashPackage({ name, version }),
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
// Calculate the hashes of all inlined dependencies in parallel
|
|
10
|
-
const inlinedDependencyKeyValuePairs = await Promise.all(Object.entries(inlinedDependencies).map(calculatePackageHash));
|
|
11
|
-
// Convert the array of key value pairs to a dictionary
|
|
12
|
-
const inlinedDependenciesHashes = {};
|
|
13
|
-
for (const entry of inlinedDependencyKeyValuePairs) {
|
|
14
|
-
inlinedDependenciesHashes[entry.name] = entry.hash;
|
|
15
|
-
}
|
|
16
|
-
return inlinedDependenciesHashes;
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=calculateHashOfInlinedDependencies.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"calculateHashOfInlinedDependencies.js","sourceRoot":"","sources":["../../src/utilities/calculateHashOfInlinedDependencies.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,KAAK,UAAU,kCAAkC,CAAC,OAGxD;IACC,MAAM,EAAE,mBAAmB,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IAErD,MAAM,oBAAoB,GAAG,KAAK,EAAE,CAAC,IAAI,EAAE,OAAO,CAA+B,EAAE,EAAE;QACnF,OAAO;YACL,IAAI;YACJ,IAAI,EAAE,MAAM,WAAW,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;SAC3C,CAAC;IACJ,CAAC,CAAC;IAEF,+DAA+D;IAC/D,MAAM,8BAA8B,GAAG,MAAM,OAAO,CAAC,GAAG,CACtD,MAAM,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAC9D,CAAC;IAEF,uDAAuD;IACvD,MAAM,yBAAyB,GAA2B,EAAE,CAAC;IAE7D,KAAK,MAAM,KAAK,IAAI,8BAA8B,EAAE;QAClD,yBAAyB,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC;KACpD;IAED,OAAO,yBAAyB,CAAC;AACnC,CAAC","sourcesContent":["import type { PackageJsonDependencies } from '@ms-cloudpack/bundler-types';\n\nexport async function calculateHashOfInlinedDependencies(options: {\n inlinedDependencies: PackageJsonDependencies;\n hashPackage: (options: { name: string; version?: string }) => Promise<string>;\n}): Promise<Record<string /* dependency name */, string /* hash */>> {\n const { inlinedDependencies, hashPackage } = options;\n\n const calculatePackageHash = async ([name, version]: [string, string | undefined]) => {\n return {\n name,\n hash: await hashPackage({ name, version }),\n };\n };\n\n // Calculate the hashes of all inlined dependencies in parallel\n const inlinedDependencyKeyValuePairs = await Promise.all(\n Object.entries(inlinedDependencies).map(calculatePackageHash),\n );\n\n // Convert the array of key value pairs to a dictionary\n const inlinedDependenciesHashes: Record<string, string> = {};\n\n for (const entry of inlinedDependencyKeyValuePairs) {\n inlinedDependenciesHashes[entry.name] = entry.hash;\n }\n\n return inlinedDependenciesHashes;\n}\n"]}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Parse a request for a package file from the bundle server, such as
|
|
3
|
-
* `http://bundleServerDomain/@scope/package@version/v3.2/bundled/path/to/file.js`.
|
|
4
|
-
*
|
|
5
|
-
* Segments:
|
|
6
|
-
* - Package name (and optionally `@version`)
|
|
7
|
-
* - Optional refresh version `v#.#`
|
|
8
|
-
* - Optional type `bundled` or `unbundled` (defaults to unbundled)
|
|
9
|
-
* - Optional file path with leading slash (empty if no path)
|
|
10
|
-
*
|
|
11
|
-
* @returns Info about the requested package/file.
|
|
12
|
-
*/
|
|
13
|
-
export declare function parseRequestUrl(requestUrl: string): {
|
|
14
|
-
/** Package name */
|
|
15
|
-
packageName: string;
|
|
16
|
-
/** Optional package version (default: empty string) */
|
|
17
|
-
version: string;
|
|
18
|
-
/** Whether the bundled version is requested (default: false) */
|
|
19
|
-
bundled: boolean;
|
|
20
|
-
/** Optional file path (default: empty string) */
|
|
21
|
-
filePath: string;
|
|
22
|
-
};
|
|
23
|
-
//# sourceMappingURL=parseRequestUrl.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parseRequestUrl.d.ts","sourceRoot":"","sources":["../../src/utilities/parseRequestUrl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG;IACnD,mBAAmB;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,uDAAuD;IACvD,OAAO,EAAE,MAAM,CAAC;IAChB,gEAAgE;IAChE,OAAO,EAAE,OAAO,CAAC;IACjB,iDAAiD;IACjD,QAAQ,EAAE,MAAM,CAAC;CAClB,CAwCA"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Parse a request for a package file from the bundle server, such as
|
|
3
|
-
* `http://bundleServerDomain/@scope/package@version/v3.2/bundled/path/to/file.js`.
|
|
4
|
-
*
|
|
5
|
-
* Segments:
|
|
6
|
-
* - Package name (and optionally `@version`)
|
|
7
|
-
* - Optional refresh version `v#.#`
|
|
8
|
-
* - Optional type `bundled` or `unbundled` (defaults to unbundled)
|
|
9
|
-
* - Optional file path with leading slash (empty if no path)
|
|
10
|
-
*
|
|
11
|
-
* @returns Info about the requested package/file.
|
|
12
|
-
*/
|
|
13
|
-
export function parseRequestUrl(requestUrl) {
|
|
14
|
-
let packageName = '';
|
|
15
|
-
let version = '';
|
|
16
|
-
let bundled = false;
|
|
17
|
-
let filePath = '';
|
|
18
|
-
// get the path segments and remove leading and trailing slashes
|
|
19
|
-
const segments = new URL(requestUrl).pathname.split('/');
|
|
20
|
-
segments.shift(); // URL's pathname always starts with a slash
|
|
21
|
-
if (segments[segments.length - 1] === '')
|
|
22
|
-
segments.pop();
|
|
23
|
-
if (segments.length) {
|
|
24
|
-
// if the first segment starts with an `@`, it's a scope
|
|
25
|
-
const scope = segments[0].match(/^@[\w.-]+$/) ? segments.shift() + '/' : '';
|
|
26
|
-
// the next segment is the package name, optionally followed by `@version`
|
|
27
|
-
// (the regex uses named capture groups)
|
|
28
|
-
const packageMatch = segments.shift()?.match(/^(?<unscopedName>[\w.-]+)(@(?<version>[\w.-]+))?$/);
|
|
29
|
-
if (packageMatch?.groups) {
|
|
30
|
-
packageName = scope + packageMatch.groups.unscopedName;
|
|
31
|
-
version = packageMatch.groups.version || '';
|
|
32
|
-
// remove the optional refresh version segment, e.g. v3.2
|
|
33
|
-
if (/^v[\d.]+$/.test(segments[0] || '')) {
|
|
34
|
-
segments.shift();
|
|
35
|
-
}
|
|
36
|
-
// optional bundled/unbundled segment
|
|
37
|
-
if (segments[0] === 'bundled' || segments[0] === 'unbundled') {
|
|
38
|
-
bundled = segments.shift() === 'bundled';
|
|
39
|
-
}
|
|
40
|
-
// the rest is the file path
|
|
41
|
-
if (segments.length) {
|
|
42
|
-
filePath = '/' + segments.join('/');
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return { packageName, version, bundled, filePath };
|
|
47
|
-
}
|
|
48
|
-
//# sourceMappingURL=parseRequestUrl.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parseRequestUrl.js","sourceRoot":"","sources":["../../src/utilities/parseRequestUrl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,eAAe,CAAC,UAAkB;IAUhD,IAAI,WAAW,GAAG,EAAE,CAAC;IACrB,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,IAAI,QAAQ,GAAG,EAAE,CAAC;IAElB,gEAAgE;IAChE,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACzD,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,4CAA4C;IAC9D,IAAI,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE;QAAE,QAAQ,CAAC,GAAG,EAAE,CAAC;IAEzD,IAAI,QAAQ,CAAC,MAAM,EAAE;QACnB,wDAAwD;QACxD,MAAM,KAAK,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5E,0EAA0E;QAC1E,wCAAwC;QACxC,MAAM,YAAY,GAAG,QAAQ,CAAC,KAAK,EAAE,EAAE,KAAK,CAAC,mDAAmD,CAAC,CAAC;QAElG,IAAI,YAAY,EAAE,MAAM,EAAE;YACxB,WAAW,GAAG,KAAK,GAAG,YAAY,CAAC,MAAM,CAAC,YAAY,CAAC;YACvD,OAAO,GAAG,YAAY,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;YAE5C,yDAAyD;YACzD,IAAI,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE;gBACvC,QAAQ,CAAC,KAAK,EAAE,CAAC;aAClB;YAED,qCAAqC;YACrC,IAAI,QAAQ,CAAC,CAAC,CAAC,KAAK,SAAS,IAAI,QAAQ,CAAC,CAAC,CAAC,KAAK,WAAW,EAAE;gBAC5D,OAAO,GAAG,QAAQ,CAAC,KAAK,EAAE,KAAK,SAAS,CAAC;aAC1C;YAED,4BAA4B;YAC5B,IAAI,QAAQ,CAAC,MAAM,EAAE;gBACnB,QAAQ,GAAG,GAAG,GAAG,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;aACrC;SACF;KACF;IAED,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;AACrD,CAAC","sourcesContent":["/**\n * Parse a request for a package file from the bundle server, such as\n * `http://bundleServerDomain/@scope/package@version/v3.2/bundled/path/to/file.js`.\n *\n * Segments:\n * - Package name (and optionally `@version`)\n * - Optional refresh version `v#.#`\n * - Optional type `bundled` or `unbundled` (defaults to unbundled)\n * - Optional file path with leading slash (empty if no path)\n *\n * @returns Info about the requested package/file.\n */\nexport function parseRequestUrl(requestUrl: string): {\n /** Package name */\n packageName: string;\n /** Optional package version (default: empty string) */\n version: string;\n /** Whether the bundled version is requested (default: false) */\n bundled: boolean;\n /** Optional file path (default: empty string) */\n filePath: string;\n} {\n let packageName = '';\n let version = '';\n let bundled = false;\n let filePath = '';\n\n // get the path segments and remove leading and trailing slashes\n const segments = new URL(requestUrl).pathname.split('/');\n segments.shift(); // URL's pathname always starts with a slash\n if (segments[segments.length - 1] === '') segments.pop();\n\n if (segments.length) {\n // if the first segment starts with an `@`, it's a scope\n const scope = segments[0].match(/^@[\\w.-]+$/) ? segments.shift() + '/' : '';\n // the next segment is the package name, optionally followed by `@version`\n // (the regex uses named capture groups)\n const packageMatch = segments.shift()?.match(/^(?<unscopedName>[\\w.-]+)(@(?<version>[\\w.-]+))?$/);\n\n if (packageMatch?.groups) {\n packageName = scope + packageMatch.groups.unscopedName;\n version = packageMatch.groups.version || '';\n\n // remove the optional refresh version segment, e.g. v3.2\n if (/^v[\\d.]+$/.test(segments[0] || '')) {\n segments.shift();\n }\n\n // optional bundled/unbundled segment\n if (segments[0] === 'bundled' || segments[0] === 'unbundled') {\n bundled = segments.shift() === 'bundled';\n }\n\n // the rest is the file path\n if (segments.length) {\n filePath = '/' + segments.join('/');\n }\n }\n }\n\n return { packageName, version, bundled, filePath };\n}\n"]}
|