@ms-cloudpack/api-server 0.44.6 → 0.44.8
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addOverride.d.ts","sourceRoot":"","sources":["../../src/utilities/addOverride.ts"],"names":[],"mappings":"AAEA,OAAO,EAKL,KAAK,eAAe,EACrB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAEnE,KAAK,cAAc,GAAG;IACpB,kDAAkD;IAClD,aAAa,EAAE,OAAO,CAAC;IACvB,sEAAsE;IACtE,KAAK,EAAE,eAAe,GAAG,SAAS,CAAC;CACpC,CAAC;AAaF;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,eAAe,EACxB,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,UAAU,GAAG,SAAS,CAAC,GAC7C,OAAO,CAAC,cAAc,CAAC,
|
|
1
|
+
{"version":3,"file":"addOverride.d.ts","sourceRoot":"","sources":["../../src/utilities/addOverride.ts"],"names":[],"mappings":"AAEA,OAAO,EAKL,KAAK,eAAe,EACrB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAEnE,KAAK,cAAc,GAAG;IACpB,kDAAkD;IAClD,aAAa,EAAE,OAAO,CAAC;IACvB,sEAAsE;IACtE,KAAK,EAAE,eAAe,GAAG,SAAS,CAAC;CACpC,CAAC;AAaF;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,eAAe,EACxB,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,UAAU,GAAG,SAAS,CAAC,GAC7C,OAAO,CAAC,cAAc,CAAC,CAiGzB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ensureGeneratedSettingsForPackage, readGeneratedConfig, writeGeneratedConfig } from '@ms-cloudpack/config';
|
|
2
2
|
import { parseRequestInfo } from '@ms-cloudpack/import-map';
|
|
3
3
|
import { addExportsMapEntry, findResolveMapEntry, flattenExportsMap, getExportsMap, } from '@ms-cloudpack/package-utilities';
|
|
4
4
|
import { makeUrl, normalizeRelativePath } from '@ms-cloudpack/path-string-parsing';
|
|
@@ -46,11 +46,11 @@ export async function addOverride(options, context) {
|
|
|
46
46
|
console.debug(`The import path "${importPath}" already exists in the exports map for "${packageName}".`);
|
|
47
47
|
return { addedOverride, entry };
|
|
48
48
|
}
|
|
49
|
-
const
|
|
49
|
+
const addedExport = {};
|
|
50
50
|
// Add the single new exports entry to the exports map.
|
|
51
51
|
addedOverride = await addExportsMapEntry({
|
|
52
52
|
// This is required as addExportsMapEntry assumes addedExports is a record.
|
|
53
|
-
exports:
|
|
53
|
+
exports: addedExport,
|
|
54
54
|
packagePath,
|
|
55
55
|
importPath,
|
|
56
56
|
}, { packages, config: session.config });
|
|
@@ -58,49 +58,26 @@ export async function addOverride(options, context) {
|
|
|
58
58
|
console.warn(`Unable to add override for package "${packageName}" to "cloudpack.generated.json". The file "${normalizeRelativePath(importPath)}" could not be found. Please check the import path and try again.`);
|
|
59
59
|
return { addedOverride, entry };
|
|
60
60
|
}
|
|
61
|
-
if (Array.isArray(exports)) {
|
|
62
|
-
exports.push(addedExports);
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
const definition = await packages.get(packagePath);
|
|
66
|
-
if (!definition) {
|
|
67
|
-
console.error(`Could not find definition of package "${packageName}" in the cache`);
|
|
68
|
-
return { addedOverride, entry };
|
|
69
|
-
}
|
|
70
|
-
definition.exports = [exports, addedExports];
|
|
71
|
-
}
|
|
72
61
|
// Parse the user config if it exists.
|
|
73
62
|
const generatedConfig = await readGeneratedConfig(session.appPath);
|
|
74
63
|
// Ensure packageSettings exist.
|
|
75
|
-
generatedConfig
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
64
|
+
const generatedPackageSettings = await ensureGeneratedSettingsForPackage({ packagePath }, { config: { generated: generatedConfig }, packages });
|
|
65
|
+
// Add the addedExport to the generatedExports.
|
|
66
|
+
const generatedExports = (generatedPackageSettings.exports ??= {});
|
|
67
|
+
const [addedImportPath, addedEntry] = Object.entries(addedExport)[0];
|
|
68
|
+
generatedExports[addedImportPath] = addedEntry;
|
|
69
|
+
const definition = await packages.get(packagePath);
|
|
70
|
+
if (!definition) {
|
|
71
|
+
console.error(`Could not find definition of package "${packageName}" in the cache`);
|
|
72
|
+
return { addedOverride, entry };
|
|
73
|
+
}
|
|
74
|
+
// Apply the generated exports again to ensure the exports are up to date.
|
|
75
|
+
// We don't want to reset the cache as it would be too costly.
|
|
76
|
+
if (Array.isArray(definition.exports)) {
|
|
77
|
+
definition.exports.push(addedExport);
|
|
85
78
|
}
|
|
86
79
|
else {
|
|
87
|
-
|
|
88
|
-
console.debug(`Found multiple matches for package "${packageName}" in cloudpack.generated.json. Using the first match.`);
|
|
89
|
-
}
|
|
90
|
-
// Use the first match and ensure exports exist
|
|
91
|
-
configMatches[0].exports ??= {};
|
|
92
|
-
const flattenedMatchExports = flattenExportsMap(configMatches[0].exports);
|
|
93
|
-
// Return false if the import path already exists in the match exports map.
|
|
94
|
-
if (flattenedMatchExports[normalizeRelativePath(importPath)]) {
|
|
95
|
-
console.debug(`The import path "${importPath}" already exists in the config exports map for "${packageName}".`);
|
|
96
|
-
return { addedOverride: false, entry };
|
|
97
|
-
}
|
|
98
|
-
// Add the single new exports entry to the match exports map.
|
|
99
|
-
await addExportsMapEntry({
|
|
100
|
-
exports: configMatches[0].exports,
|
|
101
|
-
packagePath,
|
|
102
|
-
importPath,
|
|
103
|
-
}, { packages, config: session.config });
|
|
80
|
+
definition.exports = [exports, generatedExports];
|
|
104
81
|
}
|
|
105
82
|
await writeGeneratedConfig(generatedConfig, session.appPath);
|
|
106
83
|
console.log(`Added override for "${packageName}" to "cloudpack.generated.json".`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addOverride.js","sourceRoot":"","sources":["../../src/utilities/addOverride.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"addOverride.js","sourceRoot":"","sources":["../../src/utilities/addOverride.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iCAAiC,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACpH,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,GAEd,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAWnF;;;;;GAKG;AACH,IAAI,iBAAiB,GAA4B,OAAO,CAAC,OAAO,CAAC;IAC/D,aAAa,EAAE,KAAK;IACpB,KAAK,EAAE,SAAS;CACjB,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,OAAwB,EACxB,OAA8C;IAE9C,iBAAiB,GAAG,iBAAiB,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE;QACpD,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;QAChE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;QACtC,IAAI,aAAa,GAAG,KAAK,CAAC;QAC1B,IAAI,UAAU,GAAG,SAAS,CAAC;QAE3B,IAAI,SAAS,EAAE,CAAC;YACd,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,EA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C;QAC7D,OAAO,CAAC,GAAG,CAAC,uBAAuB,WAAW,kCAAkC,CAAC,CAAC;QAElF,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,OAAO,iBAAiB,CAAC;AAC3B,CAAC","sourcesContent":["import { ensureGeneratedSettingsForPackage, readGeneratedConfig, writeGeneratedConfig } from '@ms-cloudpack/config';\nimport { parseRequestInfo } from '@ms-cloudpack/import-map';\nimport {\n addExportsMapEntry,\n findResolveMapEntry,\n flattenExportsMap,\n getExportsMap,\n type ResolveMapEntry,\n} from '@ms-cloudpack/package-utilities';\nimport { makeUrl, normalizeRelativePath } from '@ms-cloudpack/path-string-parsing';\nimport type { Context } from '../types/Context.js';\nimport type { OverrideOptions } from '../types/OverrideOptions.js';\n\ntype OverrideReturn = {\n /** Whether the override was successfully added */\n addedOverride: boolean;\n /** The entry (if any) in the resolve map the override was added to */\n entry: ResolveMapEntry | undefined;\n};\n\n/**\n * Helper so that when addOverride is called multiple times in quick succession, we only process one at a time.\n * This is to avoid that multiple calls of addOverride first read the same version of the generated config,\n * then write the same version of the config with its corresponding update,\n * which would result in the last call overwriting the changes of the previous calls.\n */\nlet overrideInProcess: Promise<OverrideReturn> = Promise.resolve({\n addedOverride: false,\n entry: undefined,\n});\n\n/**\n * The addOverride method is triggered by a user action in the overlay, when we detect new usage of an import path\n * that isn't recognized. When the user triggers this override, we write it to the cloudpack generated config.\n */\nexport async function addOverride(\n options: OverrideOptions,\n context: Pick<Context, 'packages' | 'session'>,\n): Promise<OverrideReturn> {\n overrideInProcess = overrideInProcess.then(async () => {\n const { packageName, importPath, version, issuerUrl } = options;\n const { session, packages } = context;\n let addedOverride = false;\n let requiredBy = undefined;\n\n if (issuerUrl) {\n const { packageName: issuerName, version: issuerVersion } = parseRequestInfo(makeUrl(issuerUrl).pathname);\n requiredBy = { name: issuerName, version: issuerVersion };\n }\n\n const entry = findResolveMapEntry({\n packageName,\n resolveMap: session.resolveMap,\n definition: requiredBy,\n version,\n });\n\n if (!entry) {\n console.error(`Could not find entry of package \"${packageName}\" in resolve map`);\n return { addedOverride, entry };\n }\n\n const packagePath = entry.path;\n\n // Get current exports. We want to add an additional entry to what's there - not replace the default exports,\n // so we need the full map for the package.\n const exports = await getExportsMap({ packagePath }, { packages, config: session.config });\n const flattenedExports = flattenExportsMap(exports);\n\n // Return false if the import path already exists in the exports map.\n if (flattenedExports[normalizeRelativePath(importPath)]) {\n console.debug(`The import path \"${importPath}\" already exists in the exports map for \"${packageName}\".`);\n return { addedOverride, entry };\n }\n\n const addedExport: Record<string, string | Record<string, string>> = {};\n\n // Add the single new exports entry to the exports map.\n addedOverride = await addExportsMapEntry(\n {\n // This is required as addExportsMapEntry assumes addedExports is a record.\n exports: addedExport,\n packagePath,\n importPath,\n },\n { packages, config: session.config },\n );\n\n if (!addedOverride) {\n console.warn(\n `Unable to add override for package \"${packageName}\" to \"cloudpack.generated.json\". The file \"${normalizeRelativePath(\n importPath,\n )}\" could not be found. Please check the import path and try again.`,\n );\n return { addedOverride, entry };\n }\n\n // Parse the user config if it exists.\n const generatedConfig = await readGeneratedConfig(session.appPath);\n\n // Ensure packageSettings exist.\n const generatedPackageSettings = await ensureGeneratedSettingsForPackage(\n { packagePath },\n { config: { generated: generatedConfig }, packages },\n );\n\n // Add the addedExport to the generatedExports.\n const generatedExports = (generatedPackageSettings.exports ??= {}) as Record<\n string,\n string | Record<string, string>\n >;\n const [addedImportPath, addedEntry] = Object.entries(addedExport)[0];\n generatedExports[addedImportPath] = addedEntry;\n\n const definition = await packages.get(packagePath);\n if (!definition) {\n console.error(`Could not find definition of package \"${packageName}\" in the cache`);\n return { addedOverride, entry };\n }\n\n // Apply the generated exports again to ensure the exports are up to date.\n // We don't want to reset the cache as it would be too costly.\n if (Array.isArray(definition.exports)) {\n definition.exports.push(addedExport);\n } else {\n definition.exports = [exports, generatedExports];\n }\n\n await writeGeneratedConfig(generatedConfig, session.appPath);\n console.log(`Added override for \"${packageName}\" to \"cloudpack.generated.json\".`);\n\n return { addedOverride, entry };\n });\n\n return overrideInProcess;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/api-server",
|
|
3
|
-
"version": "0.44.
|
|
3
|
+
"version": "0.44.8",
|
|
4
4
|
"description": "An implementation of the API server that does interacts with a task scheduler.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -27,19 +27,19 @@
|
|
|
27
27
|
"@lage-run/logger": "^1.3.0",
|
|
28
28
|
"@lage-run/scheduler": "^1.2.1",
|
|
29
29
|
"@lage-run/target-graph": "^0.8.9",
|
|
30
|
-
"@ms-cloudpack/bundler": "^0.20.
|
|
31
|
-
"@ms-cloudpack/common-types": "^0.
|
|
32
|
-
"@ms-cloudpack/config": "^0.20.
|
|
33
|
-
"@ms-cloudpack/create-express-app": "^1.6.
|
|
30
|
+
"@ms-cloudpack/bundler": "^0.20.15",
|
|
31
|
+
"@ms-cloudpack/common-types": "^0.6.0",
|
|
32
|
+
"@ms-cloudpack/config": "^0.20.11",
|
|
33
|
+
"@ms-cloudpack/create-express-app": "^1.6.15",
|
|
34
34
|
"@ms-cloudpack/data-bus": "^0.4.2",
|
|
35
35
|
"@ms-cloudpack/file-watcher": "^0.1.2",
|
|
36
|
-
"@ms-cloudpack/import-map": "^0.5.
|
|
36
|
+
"@ms-cloudpack/import-map": "^0.5.6",
|
|
37
37
|
"@ms-cloudpack/json-utilities": "^0.1.4",
|
|
38
|
-
"@ms-cloudpack/package-hashes": "^0.5.
|
|
39
|
-
"@ms-cloudpack/package-utilities": "^7.4.
|
|
38
|
+
"@ms-cloudpack/package-hashes": "^0.5.22",
|
|
39
|
+
"@ms-cloudpack/package-utilities": "^7.4.9",
|
|
40
40
|
"@ms-cloudpack/path-string-parsing": "^1.2.2",
|
|
41
|
-
"@ms-cloudpack/path-utilities": "^2.7.
|
|
42
|
-
"@ms-cloudpack/remote-cache": "^0.7.
|
|
41
|
+
"@ms-cloudpack/path-utilities": "^2.7.12",
|
|
42
|
+
"@ms-cloudpack/remote-cache": "^0.7.6",
|
|
43
43
|
"@ms-cloudpack/task-reporter": "^0.14.1",
|
|
44
44
|
"@ms-cloudpack/telemetry": "^0.5.2",
|
|
45
45
|
"@trpc/client": "^10.45.0",
|