@ms-cloudpack/api-server 0.27.2 → 0.27.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.
@@ -2,7 +2,7 @@ import type { Context } from '../types/Context.js';
2
2
  import type { OverrideOptions } from '../types/OverrideOptions.js';
3
3
  /**
4
4
  * The addOverride method is triggered by a user action in the overlay, when we detect new usage of an import path
5
- * that isn't recognized. When the user trigers this override, we write it to the cloudpack user config, rather
5
+ * that isn't recognized. When the user triggers this override, we write it to the cloudpack user config, rather
6
6
  * than generated configs which could get "reset" on `init --reset`.
7
7
  */
8
8
  export declare function addOverride(options: OverrideOptions, context: Pick<Context, 'packages' | 'session'>): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"addOverride.d.ts","sourceRoot":"","sources":["../../src/utilities/addOverride.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAEnE;;;;GAIG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,UAAU,GAAG,SAAS,CAAC,iBAwDzG"}
1
+ {"version":3,"file":"addOverride.d.ts","sourceRoot":"","sources":["../../src/utilities/addOverride.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAGnE;;;;GAIG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,UAAU,GAAG,SAAS,CAAC,iBA8EzG"}
@@ -1,9 +1,10 @@
1
1
  import { readUserConfig, writeUserConfig } from '@ms-cloudpack/config';
2
2
  import { addExportsMapEntry, findResolveMapEntry, getExportsMap } from '@ms-cloudpack/package-utilities';
3
3
  import { parseRequestUrl } from './parseRequestUrl.js';
4
+ import { satisfies } from 'semver';
4
5
  /**
5
6
  * The addOverride method is triggered by a user action in the overlay, when we detect new usage of an import path
6
- * that isn't recognized. When the user trigers this override, we write it to the cloudpack user config, rather
7
+ * that isn't recognized. When the user triggers this override, we write it to the cloudpack user config, rather
7
8
  * than generated configs which could get "reset" on `init --reset`.
8
9
  */
9
10
  export async function addOverride(options, context) {
@@ -23,26 +24,42 @@ export async function addOverride(options, context) {
23
24
  console.error(`Could not find entry of package "${packageName}" in resolve map`);
24
25
  return;
25
26
  }
26
- // Get current exports. We want to add an additional entry to what's there - not replace the default exports,
27
- // so we need the full map for the package.
28
- const exports = await getExportsMap({ packagePath: entry.path }, { packages, config: session.config });
29
- // Now add the single new exports entry.
30
- await addExportsMapEntry({
31
- exports,
32
- packagePath: entry.path,
33
- importPath,
34
- }, { packages, config: session.config });
35
27
  // Parse the user config if it exists.
36
28
  const config = await readUserConfig(session.appPath);
37
29
  // Ensure packageSettings exist.
38
30
  config.packageSettings ??= [];
39
- config.packageSettings.push({
40
- match: {
41
- name: packageName,
42
- version: entry.version?.match(/^\d+\.\d+\.\d+(-[a-z0-9.-]+)?$/) ? `^${entry.version}` : undefined,
43
- },
44
- exports,
45
- });
31
+ const matches = config.packageSettings.filter(({ match }) => match?.name === packageName && (!match.version || satisfies(entry.version, match.version)));
32
+ if (!matches.length) {
33
+ // Get current exports. We want to add an additional entry to what's there - not replace the default exports,
34
+ // so we need the full map for the package.
35
+ const exports = await getExportsMap({ packagePath: entry.path }, { packages, config: session.config });
36
+ // Add the single new exports entry.
37
+ await addExportsMapEntry({
38
+ exports,
39
+ packagePath: entry.path,
40
+ importPath,
41
+ }, { packages, config: session.config });
42
+ config.packageSettings.push({
43
+ match: {
44
+ name: packageName,
45
+ version: entry.version?.match(/^\d+\.\d+\.\d+(-[a-z0-9.-]+)?$/) ? `^${entry.version}` : undefined,
46
+ },
47
+ exports,
48
+ });
49
+ }
50
+ else {
51
+ if (matches.length > 1) {
52
+ console.debug(`Found multiple matches for package "${packageName}" in cloudpack.config.json. Using the first match.`);
53
+ }
54
+ // Use the first match.
55
+ matches[0].exports ??= {};
56
+ // Add the single new exports entry.
57
+ await addExportsMapEntry({
58
+ exports: matches[0].exports,
59
+ packagePath: entry.path,
60
+ importPath,
61
+ }, { packages, config: session.config });
62
+ }
46
63
  // Write config.
47
64
  await writeUserConfig(config, session.appPath);
48
65
  console.debug(`Added override for "${packageName}" to "cloudpack.config.json".`);
@@ -1 +1 @@
1
- {"version":3,"file":"addOverride.js","sourceRoot":"","sources":["../../src/utilities/addOverride.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AACzG,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAIvD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,OAAwB,EAAE,OAA8C;IACxG,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;IACvD,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IACtC,IAAI,UAAU,GAAG,SAAS,CAAC;IAE3B,IAAI,SAAS,EAAE;QACb,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC;QAClE,UAAU,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;KAChC;IAED,MAAM,KAAK,GAAG,mBAAmB,CAAC;QAChC,WAAW;QACX,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,UAAU;KACX,CAAC,CAAC;IAEH,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,CAAC,KAAK,CAAC,oCAAoC,WAAW,kBAAkB,CAAC,CAAC;QACjF,OAAO;KACR;IAED,6GAA6G;IAC7G,2CAA2C;IAC3C,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC,EAAE,WAAW,EAAE,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAEvG,wCAAwC;IACxC,MAAM,kBAAkB,CACtB;QACE,OAAO;QACP,WAAW,EAAE,KAAK,CAAC,IAAI;QACvB,UAAU;KACX,EACD,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CACrC,CAAC;IAEF,sCAAsC;IACtC,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAErD,gCAAgC;IAChC,MAAM,CAAC,eAAe,KAAK,EAAE,CAAC;IAE9B,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC;QAC1B,KAAK,EAAE;YACL,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,gCAAgC,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,SAAS;SAClG;QACD,OAAO;KACR,CAAC,CAAC;IAEH,gBAAgB;IAChB,MAAM,eAAe,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAE/C,OAAO,CAAC,KAAK,CAAC,uBAAuB,WAAW,+BAA+B,CAAC,CAAC;IAEjF,2GAA2G;IAC3G,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,CAAC;AACxC,CAAC","sourcesContent":["import { readUserConfig, writeUserConfig } from '@ms-cloudpack/config';\nimport { addExportsMapEntry, findResolveMapEntry, getExportsMap } from '@ms-cloudpack/package-utilities';\nimport { parseRequestUrl } from './parseRequestUrl.js';\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 trigers this override, we write it to the cloudpack user config, rather\n * than generated configs which could get \"reset\" on `init --reset`.\n */\nexport async function addOverride(options: OverrideOptions, context: Pick<Context, 'packages' | 'session'>) {\n const { packageName, importPath, issuerUrl } = options;\n const { session, packages } = context;\n let definition = undefined;\n\n if (issuerUrl) {\n const { packageName: name, version } = parseRequestUrl(issuerUrl);\n definition = { name, version };\n }\n\n const entry = findResolveMapEntry({\n packageName,\n resolveMap: session.resolveMap,\n definition,\n });\n\n if (!entry) {\n console.error(`Could not find entry of package \"${packageName}\" in resolve map`);\n return;\n }\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: entry.path }, { packages, config: session.config });\n\n // Now add the single new exports entry.\n await addExportsMapEntry(\n {\n exports,\n packagePath: entry.path,\n importPath,\n },\n { packages, config: session.config },\n );\n\n // Parse the user config if it exists.\n const config = await readUserConfig(session.appPath);\n\n // Ensure packageSettings exist.\n config.packageSettings ??= [];\n\n config.packageSettings.push({\n match: {\n name: packageName,\n version: entry.version?.match(/^\\d+\\.\\d+\\.\\d+(-[a-z0-9.-]+)?$/) ? `^${entry.version}` : undefined,\n },\n exports,\n });\n\n // Write config.\n await writeUserConfig(config, session.appPath);\n\n console.debug(`Added override for \"${packageName}\" to \"cloudpack.config.json\".`);\n\n // Instruct the package cache to reset, so that transforms can respect the modification to the exports map.\n packages.reset({ newConfig: config });\n}\n"]}
1
+ {"version":3,"file":"addOverride.js","sourceRoot":"","sources":["../../src/utilities/addOverride.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AACzG,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGv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from '@ms-cloudpack/config';\nimport { addExportsMapEntry, findResolveMapEntry, getExportsMap } from '@ms-cloudpack/package-utilities';\nimport { parseRequestUrl } from './parseRequestUrl.js';\nimport type { Context } from '../types/Context.js';\nimport type { OverrideOptions } from '../types/OverrideOptions.js';\nimport { satisfies } from 'semver';\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 user config, rather\n * than generated configs which could get \"reset\" on `init --reset`.\n */\nexport async function addOverride(options: OverrideOptions, context: Pick<Context, 'packages' | 'session'>) {\n const { packageName, importPath, issuerUrl } = options;\n const { session, packages } = context;\n let definition = undefined;\n\n if (issuerUrl) {\n const { packageName: name, version } = parseRequestUrl(issuerUrl);\n definition = { name, version };\n }\n\n const entry = findResolveMapEntry({\n packageName,\n resolveMap: session.resolveMap,\n definition,\n });\n\n if (!entry) {\n console.error(`Could not find entry of package \"${packageName}\" in resolve map`);\n return;\n }\n\n // Parse the user config if it exists.\n const config = await readUserConfig(session.appPath);\n\n // Ensure packageSettings exist.\n config.packageSettings ??= [];\n\n const matches = config.packageSettings.filter(\n ({ match }) => match?.name === packageName && (!match.version || satisfies(entry.version, match.version)),\n );\n\n if (!matches.length) {\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: entry.path }, { packages, config: session.config });\n\n // Add the single new exports entry.\n await addExportsMapEntry(\n {\n exports,\n packagePath: entry.path,\n importPath,\n },\n { packages, config: session.config },\n );\n config.packageSettings.push({\n match: {\n name: packageName,\n version: entry.version?.match(/^\\d+\\.\\d+\\.\\d+(-[a-z0-9.-]+)?$/) ? `^${entry.version}` : undefined,\n },\n exports,\n });\n } else {\n if (matches.length > 1) {\n console.debug(\n `Found multiple matches for package \"${packageName}\" in cloudpack.config.json. Using the first match.`,\n );\n }\n // Use the first match.\n matches[0].exports ??= {};\n // Add the single new exports entry.\n await addExportsMapEntry(\n {\n exports: matches[0].exports,\n packagePath: entry.path,\n importPath,\n },\n { packages, config: session.config },\n );\n }\n\n // Write config.\n await writeUserConfig(config, session.appPath);\n\n console.debug(`Added override for \"${packageName}\" to \"cloudpack.config.json\".`);\n\n // Instruct the package cache to reset, so that transforms can respect the modification to the exports map.\n packages.reset({ newConfig: config });\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/api-server",
3
- "version": "0.27.2",
3
+ "version": "0.27.3",
4
4
  "description": "An implementation of the API server that does interacts with a task scheduler.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -28,21 +28,21 @@
28
28
  "@lage-run/scheduler": "^1.1.9",
29
29
  "@lage-run/target-graph": "^0.8.7",
30
30
  "@lage-run/hasher": "^1.0.5",
31
- "@ms-cloudpack/bundler": "^0.16.1",
32
- "@ms-cloudpack/bundler-types": "^1.0.0",
33
- "@ms-cloudpack/config": "^0.17.0",
31
+ "@ms-cloudpack/bundler": "^0.16.2",
32
+ "@ms-cloudpack/bundler-types": "^0.22.0",
33
+ "@ms-cloudpack/config": "^0.17.1",
34
34
  "@ms-cloudpack/config-types": "^0.1.0",
35
35
  "@ms-cloudpack/create-express-app": "^1.3.12",
36
- "@ms-cloudpack/data-bus": "^0.4.1",
36
+ "@ms-cloudpack/data-bus": "^0.4.2",
37
37
  "@ms-cloudpack/file-watcher": "^0.1.1",
38
- "@ms-cloudpack/json-utilities": "^0.1.1",
39
- "@ms-cloudpack/package-hashes": "^0.2.1",
40
- "@ms-cloudpack/package-utilities": "^5.5.1",
38
+ "@ms-cloudpack/json-utilities": "^0.1.2",
39
+ "@ms-cloudpack/package-hashes": "^0.2.2",
40
+ "@ms-cloudpack/package-utilities": "^5.5.2",
41
41
  "@ms-cloudpack/path-string-parsing": "^1.1.1",
42
42
  "@ms-cloudpack/path-utilities": "^2.3.5",
43
- "@ms-cloudpack/task-reporter": "^0.10.0",
44
- "@ms-cloudpack/telemetry": "^0.4.3",
45
- "@ms-cloudpack/remote-cache": "^0.1.16",
43
+ "@ms-cloudpack/task-reporter": "^0.10.1",
44
+ "@ms-cloudpack/telemetry": "^0.4.4",
45
+ "@ms-cloudpack/remote-cache": "^0.1.17",
46
46
  "@trpc/client": "^10.41.0",
47
47
  "@trpc/server": "^10.41.0",
48
48
  "cors": "^2.8.5",