@memberjunction/dynamic-packages 0.0.0 → 6.1.0-edge.6

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.
@@ -0,0 +1,104 @@
1
+ /**
2
+ * Process identity and prefix matching.
3
+ *
4
+ * Process IDs are hierarchical, colon-separated, lowercase strings: `mjapi`, `cli`,
5
+ * `cli:sync`, `cli:sync:push`, `mcp`. A pattern matches an ID when it equals the ID or names
6
+ * one of its ancestor segments — `cli:sync` matches `cli:sync:push` but not `cli:syncother`
7
+ * or `cli:migrate`. This is what lets a config author scope a package to "all of the CLI",
8
+ * "just mj sync", or exactly one command with the same field.
9
+ */
10
+ /** Wildcard pattern that matches every process. */
11
+ export const ANY_PROCESS = '*';
12
+ /** Lowercases, trims, and collapses whitespace around the colon separators. */
13
+ export function NormalizeProcessId(value) {
14
+ return value
15
+ .trim()
16
+ .toLowerCase()
17
+ .split(':')
18
+ .map((segment) => segment.trim())
19
+ .filter((segment) => segment.length > 0)
20
+ .join(':');
21
+ }
22
+ /**
23
+ * Builds a CLI process ID from an oclif command ID. oclif reports IDs as either `sync:push`
24
+ * or `sync push` (with `topicSeparator: ' '`); both become `cli:sync:push`.
25
+ */
26
+ export function CliProcessId(commandId) {
27
+ const normalized = NormalizeProcessId((commandId ?? '').replace(/\s+/g, ':'));
28
+ return normalized.length > 0 ? `cli:${normalized}` : 'cli';
29
+ }
30
+ /** True when `pattern` equals `processId` or is an ancestor prefix of it (segment-aware). */
31
+ export function ProcessIdMatches(processId, pattern) {
32
+ const id = NormalizeProcessId(processId);
33
+ const pat = NormalizeProcessId(pattern);
34
+ if (pat === ANY_PROCESS) {
35
+ return true;
36
+ }
37
+ if (pat.length === 0 || id.length === 0) {
38
+ return false;
39
+ }
40
+ return id === pat || id.startsWith(`${pat}:`);
41
+ }
42
+ /**
43
+ * Evaluates an entry's `Processes` / `ExcludeProcesses` against a process ID.
44
+ * No `Processes` (or an empty list) means "everywhere"; `ExcludeProcesses` is applied after.
45
+ */
46
+ export function MatchesProcess(processId, filter) {
47
+ const includes = (filter?.Processes ?? []).filter((p) => typeof p === 'string' && p.trim().length > 0);
48
+ const excludes = (filter?.ExcludeProcesses ?? []).filter((p) => typeof p === 'string' && p.trim().length > 0);
49
+ if (includes.length > 0 && !includes.some((p) => ProcessIdMatches(processId, p))) {
50
+ return false;
51
+ }
52
+ if (excludes.some((p) => ProcessIdMatches(processId, p))) {
53
+ return false;
54
+ }
55
+ return true;
56
+ }
57
+ /**
58
+ * Picks the value of the most specific key in `map` that matches `processId`.
59
+ * `'cli:sync'` beats `'cli'` beats `'*'`. Returns `undefined` when nothing matches.
60
+ */
61
+ export function ResolveMostSpecific(processId, map) {
62
+ if (!map) {
63
+ return undefined;
64
+ }
65
+ let bestKey;
66
+ let bestDepth = -1;
67
+ for (const key of Object.keys(map)) {
68
+ if (!ProcessIdMatches(processId, key)) {
69
+ continue;
70
+ }
71
+ const normalized = NormalizeProcessId(key);
72
+ const depth = normalized === ANY_PROCESS ? 0 : normalized.split(':').length;
73
+ if (depth > bestDepth) {
74
+ bestDepth = depth;
75
+ bestKey = key;
76
+ }
77
+ }
78
+ return bestKey === undefined ? undefined : map[bestKey];
79
+ }
80
+ /**
81
+ * Environment variable through which an OUTER host tells nested hosts which process they are
82
+ * running inside. The `mj` CLI's prerun hook sets it to its own ID (`cli:ai:agents:run`) before
83
+ * the command imports `@memberjunction/ai-cli` or `@memberjunction/testing-cli`; those packages'
84
+ * provider bootstraps then evaluate `Processes` / `ExcludeProcesses` / `policy` under the SAME
85
+ * ID instead of their standalone `ai-cli` / `testing-cli` identity. Without it, an entry an
86
+ * operator excluded from `cli` would be loaded by the nested host a moment later.
87
+ */
88
+ export const DYNAMIC_PACKAGES_PROCESS_ENV_VAR = 'MJ_DYNAMIC_PACKAGES_PROCESS';
89
+ /**
90
+ * The process ID a host should load under: the one an enclosing host published through
91
+ * {@link DYNAMIC_PACKAGES_PROCESS_ENV_VAR} when there is one, else the host's own default.
92
+ *
93
+ * @example
94
+ * ```ts
95
+ * // packages/AI/AICLI — `mj-ai` standalone loads as 'ai-cli'; under `mj ai …` it inherits 'cli:ai:…'
96
+ * await LoadDynamicPackages({ processId: EffectiveProcessId('ai-cli'), ... });
97
+ * ```
98
+ */
99
+ export function EffectiveProcessId(hostDefault) {
100
+ const fromEnv = typeof process !== 'undefined' && process.env ? process.env[DYNAMIC_PACKAGES_PROCESS_ENV_VAR] : undefined;
101
+ const normalized = fromEnv ? NormalizeProcessId(fromEnv) : '';
102
+ return normalized.length > 0 ? normalized : NormalizeProcessId(hostDefault);
103
+ }
104
+ //# sourceMappingURL=process-id.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process-id.js","sourceRoot":"","sources":["../src/process-id.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,mDAAmD;AACnD,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,CAAC;AAE/B,+EAA+E;AAC/E,MAAM,UAAU,kBAAkB,CAAC,KAAa;IAC5C,OAAO,KAAK;SACP,IAAI,EAAE;SACN,WAAW,EAAE;SACb,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;SAChC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;SACvC,IAAI,CAAC,GAAG,CAAC,CAAC;AACnB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,SAAoC;IAC7D,MAAM,UAAU,GAAG,kBAAkB,CAAC,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;IAC9E,OAAO,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,UAAU,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;AAC/D,CAAC;AAED,6FAA6F;AA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U,GAAG,OAAO,CAAC,CAAC,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9D,OAAO,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;AAChF,CAAC"}
@@ -0,0 +1,153 @@
1
+ /**
2
+ * Types for the process-agnostic dynamic package loader.
3
+ *
4
+ * A "dynamic package" is an npm package whose name is only known at runtime — it is named by
5
+ * configuration (`mj.config.cjs` `dynamicPackages.*[]`, written by `mj app install`; the
6
+ * host's `codeGeneration.packages`), or by an Open App's own `mj-app.json` when a process runs
7
+ * inside that app's repository. Importing one triggers its `@RegisterClass` decorators so the
8
+ * ClassFactory returns the app's entity/action/provider subclasses instead of base-class
9
+ * fallbacks. MJAPI has always done this at boot; every other MJ process (the CLI, MCP/A2A
10
+ * servers, test bootstraps, ad-hoc scripts) needs the same thing, which is why the loader lives
11
+ * in a package with no MJ runtime dependencies.
12
+ */
13
+ /** Which package tier a process wants: server-side (Node) packages or client (browser) ones. */
14
+ export type DynamicPackageTier = 'server' | 'client';
15
+ /**
16
+ * Whether a process should load dynamic packages at all. `'none'` is the escape hatch for
17
+ * "raw" runs — restoring dumps, bulk ingestion, or diagnosing a package that breaks boot —
18
+ * where custom `Save()` logic and lifecycle hooks must NOT run.
19
+ */
20
+ export type DynamicPackagesMode = 'load' | 'none';
21
+ /**
22
+ * Where the resolved mode came from, highest precedence first:
23
+ * `MJ_DYNAMIC_PACKAGES` env var > programmatic option > `dynamicPackages.policy` > default.
24
+ */
25
+ export type DynamicPackagesModeSource = 'env' | 'option' | 'policy' | 'default';
26
+ /**
27
+ * One entry of `dynamicPackages.server[]` / `dynamicPackages.client[]` in mj.config.cjs.
28
+ * `PackageName`, `StartupExport`, `AppName` and `Enabled` are written by `mj app install`;
29
+ * `Processes` / `ExcludeProcesses` are hand-authored scoping (see {@link MatchesProcess}).
30
+ */
31
+ export interface DynamicPackageEntry {
32
+ /** npm package name to import. */
33
+ PackageName: string;
34
+ /** Optional named export to invoke after import (a registration kicker). */
35
+ StartupExport?: string;
36
+ /** Open App name this package belongs to (for tracking / pruning). */
37
+ AppName?: string;
38
+ /** Whether this package should be loaded anywhere. Treated as enabled unless explicitly `false`. */
39
+ Enabled?: boolean;
40
+ /**
41
+ * Process IDs (or prefixes) this entry loads in. Omitted or empty = every process that asks
42
+ * for the entry's tier. `['cli:sync']` loads for `cli:sync:push` and `cli:sync:pull` only;
43
+ * `['mjapi', 'cli']` loads in the API and in every CLI command.
44
+ */
45
+ Processes?: string[];
46
+ /** Process IDs (or prefixes) this entry must NOT load in, evaluated after {@link Processes}. */
47
+ ExcludeProcesses?: string[];
48
+ }
49
+ /**
50
+ * The `dynamicPackages` section of mj.config.cjs as this loader reads it.
51
+ */
52
+ export interface DynamicPackagesConfig {
53
+ server?: DynamicPackageEntry[];
54
+ client?: DynamicPackageEntry[];
55
+ /**
56
+ * Per-process on/off policy keyed by process ID or prefix, e.g. `{ 'cli:codegen': 'none' }`.
57
+ * The most specific matching key wins. Overridden by the `MJ_DYNAMIC_PACKAGES` env var and
58
+ * by a programmatic `mode` option.
59
+ */
60
+ policy?: Record<string, DynamicPackagesMode>;
61
+ }
62
+ /** Where a loadable entry was discovered. */
63
+ export type DynamicPackageSource = 'config' | 'generated' | 'manifest';
64
+ /** Where a manifest-sourced package's workspace member lives on disk (the app's own repository). */
65
+ export interface WorkspaceHome {
66
+ /** Directory holding the app's `mj-app.json`. */
67
+ RepoDir: string;
68
+ /** `code.sourceDirectory` from the manifest (default `packages`), relative to {@link RepoDir}. */
69
+ SourceDirectory: string;
70
+ }
71
+ /** An entry the loader decided about, with its provenance. */
72
+ export interface DiscoveredDynamicPackage {
73
+ Entry: DynamicPackageEntry;
74
+ Source: DynamicPackageSource;
75
+ /**
76
+ * Present only for `'manifest'` entries: lets the loader fall back to importing the
77
+ * workspace member by path when no resolution anchor can see it (pnpm strict layout).
78
+ */
79
+ WorkspaceHome?: WorkspaceHome;
80
+ }
81
+ /** A package the loader imported (and whose startup export, if any, it ran). */
82
+ export interface LoadedDynamicPackage extends DiscoveredDynamicPackage {
83
+ /** The imported module namespace — hosts read conventions like `RESOLVER_PATHS` off it. */
84
+ Module: Record<string, unknown>;
85
+ /**
86
+ * True when `StartupExport` named a function and it was invoked by THIS call. False when the
87
+ * entry has no startup export, the named export is missing, or the package was already loaded
88
+ * earlier in this process (the module is still returned; the hook is not run twice).
89
+ */
90
+ RanStartupExport: boolean;
91
+ }
92
+ /** Why an entry was not loaded. */
93
+ export type DynamicPackageSkipReason = 'disabled' | 'process-filter' | 'mode-none' | 'duplicate';
94
+ export interface SkippedDynamicPackage extends DiscoveredDynamicPackage {
95
+ Reason: DynamicPackageSkipReason;
96
+ }
97
+ /** A package that resolved but failed while loading (its own error — never masked). */
98
+ export interface FailedDynamicPackage extends DiscoveredDynamicPackage {
99
+ Error: unknown;
100
+ }
101
+ /** Logger seam so each host routes loader output through its own channel (stdout, stderr, spinner). */
102
+ export interface DynamicPackagesLogger {
103
+ /** Normal progress ("Loaded …"). */
104
+ info(message: string): void;
105
+ /** Recoverable problems the operator must see (a package that threw while loading). */
106
+ warn(message: string, error?: unknown): void;
107
+ /** Detail that only matters when debugging (skips, filters, mode source). */
108
+ verbose?(message: string): void;
109
+ }
110
+ export interface LoadDynamicPackagesOptions {
111
+ /**
112
+ * Identity of the calling process, lowercase and colon-separated: `mjapi`, `cli:sync:push`,
113
+ * `mcp`, `a2a`, `integration-tests`. Entry `Processes` / `ExcludeProcesses` and
114
+ * `dynamicPackages.policy` match against it by exact ID or by prefix segment.
115
+ */
116
+ processId: string;
117
+ /** Raw (un-validated) mj.config.cjs object. Zod-parsed configs usually strip `dynamicPackages`; pass the raw one. */
118
+ config?: Record<string, unknown> | null;
119
+ /** Absolute path of the mj.config.cjs the config came from — the primary resolution anchor. */
120
+ configFilePath?: string;
121
+ /** Which tier to load. Defaults to `'server'`. */
122
+ tier?: DynamicPackageTier;
123
+ /**
124
+ * Also load the host's generated packages named under `codeGeneration.packages`
125
+ * (entities / actions / graphqlResolvers for the server tier). Defaults to `true`.
126
+ */
127
+ includeGeneratedPackages?: boolean;
128
+ /**
129
+ * Also discover packages from an Open App manifest (`mj-app.json`) found in
130
+ * {@link appManifestDir} — the "running inside the app's own repo" case, where the app's
131
+ * packages are workspace members but nothing has installed them into a host config.
132
+ * Defaults to `true`.
133
+ */
134
+ discoverAppManifest?: boolean;
135
+ /** Directory holding `mj-app.json`. Defaults to the config file's directory, else `process.cwd()`. */
136
+ appManifestDir?: string;
137
+ /** Programmatic mode override (below the env var, above config policy). */
138
+ mode?: DynamicPackagesMode;
139
+ /** Output channel. Defaults to `console`. */
140
+ log?: DynamicPackagesLogger;
141
+ }
142
+ export interface DynamicPackagesReport {
143
+ ProcessId: string;
144
+ Tier: DynamicPackageTier;
145
+ Mode: DynamicPackagesMode;
146
+ ModeSource: DynamicPackagesModeSource;
147
+ Loaded: LoadedDynamicPackage[];
148
+ Skipped: SkippedDynamicPackage[];
149
+ /** Package names no anchor could resolve — expected before `npm install` or an unbuilt workspace member. */
150
+ NotFound: DiscoveredDynamicPackage[];
151
+ Failed: FailedDynamicPackage[];
152
+ }
153
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,gGAAgG;AAChG,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAErD;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,MAAM,CAAC;AAElD;;;GAGG;AACH,MAAM,MAAM,yBAAyB,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEhF;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAChC,kCAAkC;IAClC,WAAW,EAAE,MAA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ACrC,MAAM,EAAE,oBAAoB,EAAE,CAAC;CAClC"}
package/dist/types.js ADDED
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Types for the process-agnostic dynamic package loader.
3
+ *
4
+ * A "dynamic package" is an npm package whose name is only known at runtime — it is named by
5
+ * configuration (`mj.config.cjs` `dynamicPackages.*[]`, written by `mj app install`; the
6
+ * host's `codeGeneration.packages`), or by an Open App's own `mj-app.json` when a process runs
7
+ * inside that app's repository. Importing one triggers its `@RegisterClass` decorators so the
8
+ * ClassFactory returns the app's entity/action/provider subclasses instead of base-class
9
+ * fallbacks. MJAPI has always done this at boot; every other MJ process (the CLI, MCP/A2A
10
+ * servers, test bootstraps, ad-hoc scripts) needs the same thing, which is why the loader lives
11
+ * in a package with no MJ runtime dependencies.
12
+ */
13
+ export {};
14
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG"}
package/package.json CHANGED
@@ -1,10 +1,39 @@
1
1
  {
2
2
  "name": "@memberjunction/dynamic-packages",
3
- "version": "0.0.0",
4
- "description": "OIDC trusted publishing setup package for @memberjunction/dynamic-packages",
3
+ "version": "6.1.0-edge.6",
4
+ "description": "MemberJunction: process-agnostic loader for runtime-configured packages (Open App server/client packages, generated entity packages) with per-process scoping",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "type": "module",
8
+ "files": [
9
+ "/dist"
10
+ ],
5
11
  "keywords": [
6
- "oidc",
7
- "trusted-publishing",
8
- "setup"
9
- ]
10
- }
12
+ "memberjunction",
13
+ "open-app",
14
+ "dynamic-packages",
15
+ "bootstrap"
16
+ ],
17
+ "author": "MemberJunction.com",
18
+ "license": "BUSL-1.1",
19
+ "dependencies": {
20
+ "cosmiconfig": "^9.0.0"
21
+ },
22
+ "devDependencies": {
23
+ "@types/node": "^24.10.11",
24
+ "tsc-alias": "^1.8.16",
25
+ "typescript": "^5.9.3",
26
+ "vitest": "^3.1.1",
27
+ "vite-tsconfig-paths": "^5.1.4"
28
+ },
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "https://github.com/MemberJunction/MJ"
32
+ },
33
+ "scripts": {
34
+ "build": "tsc && tsc-alias -f",
35
+ "test": "vitest run",
36
+ "test:watch": "vitest",
37
+ "test:coverage": "vitest run --coverage"
38
+ }
39
+ }