@ms-cloudpack/api-server 0.44.0 → 0.44.2

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.
@@ -29,7 +29,7 @@ export async function addOverride(options, context) {
29
29
  // Get current exports. We want to add an additional entry to what's there - not replace the default exports,
30
30
  // so we need the full map for the package.
31
31
  const exports = await getExportsMap({ packagePath }, { packages, config: session.config });
32
- const flattenedExports = flattenExportsMap(exports, { packagePath });
32
+ const flattenedExports = flattenExportsMap(exports);
33
33
  // Return false if the import path already exists in the exports map.
34
34
  if (flattenedExports[normalizeRelativePath(importPath)]) {
35
35
  console.debug(`The import path "${importPath}" already exists in the exports map for "${packageName}".`);
@@ -78,7 +78,7 @@ export async function addOverride(options, context) {
78
78
  }
79
79
  // Use the first match and ensure exports exist
80
80
  configMatches[0].exports ??= {};
81
- const flattenedMatchExports = flattenExportsMap(configMatches[0].exports, { packagePath });
81
+ const flattenedMatchExports = flattenExportsMap(configMatches[0].exports);
82
82
  // Return false if the import path already exists in the match exports map.
83
83
  if (flattenedMatchExports[normalizeRelativePath(importPath)]) {
84
84
  console.debug(`The import path "${importPath}" already exists in the config exports map for "${packageName}".`);
@@ -1 +1 @@
1
- {"version":3,"file":"addOverride.js","sourceRoot":"","sources":["../../src/utilities/addOverride.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC7F,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;AAInF;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,OAAwB,EACxB,OAA8C;IAO9C,MAAM,EAAE,WAAW,EAAE,UA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EAAE,CAAC;AAClC,CAAC","sourcesContent":["import { checkMatch, 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\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<{\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;\n}> {\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, { packagePath });\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 addedExports = {};\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: addedExports,\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.config.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 if (Array.isArray(exports)) {\n exports.push(addedExports);\n } else {\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 definition.exports = [exports, addedExports];\n }\n\n // Parse the user config if it exists.\n const config = await readGeneratedConfig(session.appPath);\n\n // Ensure packageSettings exist.\n config.packageSettings ??= [];\n\n const configMatches = config.packageSettings.filter(({ match }) =>\n checkMatch({ name: packageName, version: entry.version, match, exactMatch: true }),\n );\n\n if (!configMatches.length) {\n config.packageSettings.push({\n match: {\n name: packageName,\n version: `^${entry.version}`,\n },\n exports: addedExports,\n });\n } else {\n if (configMatches.length > 1) {\n console.debug(\n `Found multiple matches for package \"${packageName}\" in cloudpack.config.json. Using the first match.`,\n );\n }\n\n // Use the first match and ensure exports exist\n configMatches[0].exports ??= {};\n\n const flattenedMatchExports = flattenExportsMap(configMatches[0].exports, { packagePath });\n\n // Return false if the import path already exists in the match exports map.\n if (flattenedMatchExports[normalizeRelativePath(importPath)]) {\n console.debug(`The import path \"${importPath}\" already exists in the config exports map for \"${packageName}\".`);\n return { addedOverride: false, entry };\n }\n\n // Add the single new exports entry to the match exports map.\n await addExportsMapEntry(\n {\n exports: configMatches[0].exports,\n packagePath,\n importPath,\n },\n { packages, config: session.config },\n );\n }\n\n await writeGeneratedConfig(config, session.appPath);\n console.debug(`Added override for \"${packageName}\" to \"cloudpack.config.json\".`);\n\n return { addedOverride, entry };\n}\n"]}
1
+ {"version":3,"file":"addOverride.js","sourceRoot":"","sources":["../../src/utilities/addOverride.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU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ACE,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,OAAO;YACjC,WAAW;YACX,UAAU;SACX,EACD,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CACrC,CAAC;IACJ,CAAC;IAED,MAAM,oBAAoB,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IACpD,OAAO,CAAC,KAAK,CAAC,uBAAuB,WAAW,+BAA+B,CAAC,CAAC;IAEjF,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;AAClC,CAAC","sourcesContent":["import { checkMatch, 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\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<{\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;\n}> {\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 addedExports = {};\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: addedExports,\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.config.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 if (Array.isArray(exports)) {\n exports.push(addedExports);\n } else {\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 definition.exports = [exports, addedExports];\n }\n\n // Parse the user config if it exists.\n const config = await readGeneratedConfig(session.appPath);\n\n // Ensure packageSettings exist.\n config.packageSettings ??= [];\n\n const configMatches = config.packageSettings.filter(({ match }) =>\n checkMatch({ name: packageName, version: entry.version, match, exactMatch: true }),\n );\n\n if (!configMatches.length) {\n config.packageSettings.push({\n match: {\n name: packageName,\n version: `^${entry.version}`,\n },\n exports: addedExports,\n });\n } else {\n if (configMatches.length > 1) {\n console.debug(\n `Found multiple matches for package \"${packageName}\" in cloudpack.config.json. Using the first match.`,\n );\n }\n\n // Use the first match and ensure exports exist\n configMatches[0].exports ??= {};\n\n const flattenedMatchExports = flattenExportsMap(configMatches[0].exports);\n\n // Return false if the import path already exists in the match exports map.\n if (flattenedMatchExports[normalizeRelativePath(importPath)]) {\n console.debug(`The import path \"${importPath}\" already exists in the config exports map for \"${packageName}\".`);\n return { addedOverride: false, entry };\n }\n\n // Add the single new exports entry to the match exports map.\n await addExportsMapEntry(\n {\n exports: configMatches[0].exports,\n packagePath,\n importPath,\n },\n { packages, config: session.config },\n );\n }\n\n await writeGeneratedConfig(config, session.appPath);\n console.debug(`Added override for \"${packageName}\" to \"cloudpack.config.json\".`);\n\n return { addedOverride, entry };\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/api-server",
3
- "version": "0.44.0",
3
+ "version": "0.44.2",
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.8",
30
+ "@ms-cloudpack/bundler": "^0.20.9",
31
31
  "@ms-cloudpack/common-types": "^0.5.2",
32
- "@ms-cloudpack/config": "^0.20.5",
32
+ "@ms-cloudpack/config": "^0.20.6",
33
33
  "@ms-cloudpack/create-express-app": "^1.6.12",
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.1",
36
+ "@ms-cloudpack/import-map": "^0.5.2",
37
37
  "@ms-cloudpack/json-utilities": "^0.1.4",
38
- "@ms-cloudpack/package-hashes": "^0.5.16",
39
- "@ms-cloudpack/package-utilities": "^7.4.4",
38
+ "@ms-cloudpack/package-hashes": "^0.5.17",
39
+ "@ms-cloudpack/package-utilities": "^7.4.5",
40
40
  "@ms-cloudpack/path-string-parsing": "^1.2.2",
41
41
  "@ms-cloudpack/path-utilities": "^2.7.9",
42
- "@ms-cloudpack/remote-cache": "^0.7.3",
42
+ "@ms-cloudpack/remote-cache": "^0.7.4",
43
43
  "@ms-cloudpack/task-reporter": "^0.14.0",
44
44
  "@ms-cloudpack/telemetry": "^0.5.2",
45
45
  "@trpc/client": "^10.45.0",