@memberjunction/config 0.0.1 → 3.0.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/dist/config-loader.d.ts +86 -0
- package/dist/config-loader.d.ts.map +1 -0
- package/dist/config-loader.js +141 -0
- package/dist/config-loader.js.map +1 -0
- package/dist/config-merger.d.ts +41 -0
- package/dist/config-merger.d.ts.map +1 -0
- package/dist/config-merger.js +105 -0
- package/dist/config-merger.js.map +1 -0
- package/dist/config-types.d.ts +21 -0
- package/dist/config-types.d.ts.map +1 -0
- package/dist/config-types.js +22 -0
- package/dist/config-types.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/package.json +28 -5
- package/README.md +0 -45
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { MergeOptions } from './config-merger';
|
|
2
|
+
/**
|
|
3
|
+
* Configuration loading options
|
|
4
|
+
*/
|
|
5
|
+
export interface LoadConfigOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Directory to start searching for config file.
|
|
8
|
+
* Default: process.cwd()
|
|
9
|
+
*/
|
|
10
|
+
searchFrom?: string;
|
|
11
|
+
/**
|
|
12
|
+
* If true, throws error when config file is not found.
|
|
13
|
+
* If false, returns empty object when no config file exists.
|
|
14
|
+
* Default: false
|
|
15
|
+
*/
|
|
16
|
+
requireConfigFile?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Merge behavior options
|
|
19
|
+
*/
|
|
20
|
+
mergeOptions?: MergeOptions;
|
|
21
|
+
/**
|
|
22
|
+
* If true, logs configuration loading details
|
|
23
|
+
* Default: false
|
|
24
|
+
*/
|
|
25
|
+
verbose?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Default configuration to use as base.
|
|
28
|
+
* Typically provided by the calling package.
|
|
29
|
+
*/
|
|
30
|
+
defaultConfig?: Record<string, any>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Result of configuration loading
|
|
34
|
+
*/
|
|
35
|
+
export interface LoadConfigResult<T = Record<string, any>> {
|
|
36
|
+
/**
|
|
37
|
+
* Final merged configuration
|
|
38
|
+
*/
|
|
39
|
+
config: T;
|
|
40
|
+
/**
|
|
41
|
+
* Path to user config file (undefined if using only defaults)
|
|
42
|
+
*/
|
|
43
|
+
configFilePath?: string;
|
|
44
|
+
/**
|
|
45
|
+
* True if user config file was found and loaded
|
|
46
|
+
*/
|
|
47
|
+
hasUserConfig: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Keys that were overridden from defaults
|
|
50
|
+
*/
|
|
51
|
+
overriddenKeys: string[];
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Loads and merges MemberJunction configuration from multiple sources:
|
|
55
|
+
* 1. Default configuration (provided by calling package)
|
|
56
|
+
* 2. Optional mj.config.cjs file (found via cosmiconfig)
|
|
57
|
+
* 3. Environment variables (applied on top of merged config)
|
|
58
|
+
*
|
|
59
|
+
* @param options - Configuration loading options
|
|
60
|
+
* @returns Merged configuration result
|
|
61
|
+
*/
|
|
62
|
+
export declare function loadMJConfig<T = Record<string, any>>(options?: LoadConfigOptions): Promise<LoadConfigResult<T>>;
|
|
63
|
+
/**
|
|
64
|
+
* Loads configuration synchronously (for CommonJS compatibility).
|
|
65
|
+
* Note: This does NOT search for config files, only loads from explicit path.
|
|
66
|
+
*
|
|
67
|
+
* @param configPath - Explicit path to config file
|
|
68
|
+
* @param options - Loading options
|
|
69
|
+
*/
|
|
70
|
+
export declare function loadMJConfigSync<T = Record<string, any>>(configPath: string, options?: Omit<LoadConfigOptions, 'searchFrom' | 'requireConfigFile'>): T;
|
|
71
|
+
/**
|
|
72
|
+
* Helper to build a complete MJ config by merging configurations from multiple packages.
|
|
73
|
+
* Each package provides its own default configuration.
|
|
74
|
+
*
|
|
75
|
+
* @param packageDefaults - Object with package-specific default configs
|
|
76
|
+
* @param userConfigOverrides - Optional user overrides
|
|
77
|
+
* @returns Merged configuration
|
|
78
|
+
*/
|
|
79
|
+
export declare function buildMJConfig(packageDefaults: {
|
|
80
|
+
codegen?: Record<string, any>;
|
|
81
|
+
server?: Record<string, any>;
|
|
82
|
+
mcpServer?: Record<string, any>;
|
|
83
|
+
a2aServer?: Record<string, any>;
|
|
84
|
+
queryGen?: Record<string, any>;
|
|
85
|
+
}, userConfigOverrides?: Record<string, any>): Record<string, any>;
|
|
86
|
+
//# sourceMappingURL=config-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-loader.d.ts","sourceRoot":"","sources":["../src/config-loader.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE7D;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B;;OAEG;IACH,YAAY,CAAC,EAAE,YAAY,CAAC;IAE5B;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACrC;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IACvD;;OAEG;IACH,MAAM,EAAE,CAAC,CAAC;IAEV;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,aAAa,EAAE,OAAO,CAAC;IAEvB;;OAEG;IACH,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED;;;;;;;;GAQG;AACH,wBAAsB,YAAY,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACxD,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CA6E9B;AAmBD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACtD,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,IAAI,CAAC,iBAAiB,EAAE,YAAY,GAAG,mBAAmB,CAAM,GACxE,CAAC,CAUH;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAC3B,eAAe,EAAE;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAChC,EACD,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACxC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CA2BrB"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildMJConfig = exports.loadMJConfigSync = exports.loadMJConfig = void 0;
|
|
4
|
+
const cosmiconfig_1 = require("cosmiconfig");
|
|
5
|
+
const config_merger_1 = require("./config-merger");
|
|
6
|
+
/**
|
|
7
|
+
* Loads and merges MemberJunction configuration from multiple sources:
|
|
8
|
+
* 1. Default configuration (provided by calling package)
|
|
9
|
+
* 2. Optional mj.config.cjs file (found via cosmiconfig)
|
|
10
|
+
* 3. Environment variables (applied on top of merged config)
|
|
11
|
+
*
|
|
12
|
+
* @param options - Configuration loading options
|
|
13
|
+
* @returns Merged configuration result
|
|
14
|
+
*/
|
|
15
|
+
async function loadMJConfig(options = {}) {
|
|
16
|
+
const { searchFrom = process.cwd(), requireConfigFile = false, mergeOptions = {}, verbose = false, defaultConfig = {} } = options;
|
|
17
|
+
if (verbose) {
|
|
18
|
+
console.log(`\n📄 Loading MemberJunction configuration...`);
|
|
19
|
+
console.log(` Search directory: ${searchFrom}`);
|
|
20
|
+
}
|
|
21
|
+
// Search for user config file
|
|
22
|
+
const explorer = (0, cosmiconfig_1.cosmiconfig)('mj', {
|
|
23
|
+
searchPlaces: [
|
|
24
|
+
'mj.config.cjs',
|
|
25
|
+
'mj.config.js',
|
|
26
|
+
'.mjrc',
|
|
27
|
+
'.mjrc.js',
|
|
28
|
+
'.mjrc.cjs',
|
|
29
|
+
'package.json' // Look for "mj" key
|
|
30
|
+
]
|
|
31
|
+
});
|
|
32
|
+
const searchResult = await explorer.search(searchFrom);
|
|
33
|
+
if (!searchResult) {
|
|
34
|
+
if (requireConfigFile) {
|
|
35
|
+
throw new Error(`No mj.config.cjs file found in ${searchFrom} or parent directories. ` +
|
|
36
|
+
`Either create a config file or set requireConfigFile: false to use defaults.`);
|
|
37
|
+
}
|
|
38
|
+
if (verbose) {
|
|
39
|
+
console.log(` ℹ No user config file found, using defaults only`);
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
config: defaultConfig,
|
|
43
|
+
hasUserConfig: false,
|
|
44
|
+
overriddenKeys: []
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
if (verbose) {
|
|
48
|
+
console.log(` ✓ Found config file: ${searchResult.filepath}`);
|
|
49
|
+
}
|
|
50
|
+
// Merge user config into defaults
|
|
51
|
+
const userConfig = searchResult.config;
|
|
52
|
+
const mergedConfig = (0, config_merger_1.mergeConfigs)(defaultConfig, userConfig, mergeOptions);
|
|
53
|
+
// Identify overridden keys for logging
|
|
54
|
+
const overriddenKeys = identifyOverriddenKeys(defaultConfig, userConfig);
|
|
55
|
+
if (verbose) {
|
|
56
|
+
console.log(` ✓ Merged ${overriddenKeys.length} configuration override(s)`);
|
|
57
|
+
if (overriddenKeys.length > 0 && overriddenKeys.length <= 10) {
|
|
58
|
+
console.log(` Overridden keys: ${overriddenKeys.join(', ')}`);
|
|
59
|
+
}
|
|
60
|
+
else if (overriddenKeys.length > 10) {
|
|
61
|
+
console.log(` Overridden keys: ${overriddenKeys.slice(0, 10).join(', ')}, ... (${overriddenKeys.length - 10} more)`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (verbose) {
|
|
65
|
+
console.log(` ✓ Configuration loaded successfully\n`);
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
config: mergedConfig,
|
|
69
|
+
configFilePath: searchResult.filepath,
|
|
70
|
+
hasUserConfig: true,
|
|
71
|
+
overriddenKeys
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
exports.loadMJConfig = loadMJConfig;
|
|
75
|
+
/**
|
|
76
|
+
* Identifies which top-level keys were overridden in user config
|
|
77
|
+
*/
|
|
78
|
+
function identifyOverriddenKeys(defaults, overrides) {
|
|
79
|
+
if (!overrides)
|
|
80
|
+
return [];
|
|
81
|
+
return Object.keys(overrides).filter(key => {
|
|
82
|
+
const hasOverride = key in overrides;
|
|
83
|
+
// Only count as override if the value is different
|
|
84
|
+
const isDifferent = JSON.stringify(defaults[key]) !== JSON.stringify(overrides[key]);
|
|
85
|
+
return hasOverride && isDifferent;
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Loads configuration synchronously (for CommonJS compatibility).
|
|
90
|
+
* Note: This does NOT search for config files, only loads from explicit path.
|
|
91
|
+
*
|
|
92
|
+
* @param configPath - Explicit path to config file
|
|
93
|
+
* @param options - Loading options
|
|
94
|
+
*/
|
|
95
|
+
function loadMJConfigSync(configPath, options = {}) {
|
|
96
|
+
const { defaultConfig = {}, mergeOptions = {} } = options;
|
|
97
|
+
try {
|
|
98
|
+
const userConfig = require(configPath);
|
|
99
|
+
const mergedConfig = (0, config_merger_1.mergeConfigs)(defaultConfig, userConfig, mergeOptions);
|
|
100
|
+
return mergedConfig;
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
throw new Error(`Failed to load config from ${configPath}: ${error.message}`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
exports.loadMJConfigSync = loadMJConfigSync;
|
|
107
|
+
/**
|
|
108
|
+
* Helper to build a complete MJ config by merging configurations from multiple packages.
|
|
109
|
+
* Each package provides its own default configuration.
|
|
110
|
+
*
|
|
111
|
+
* @param packageDefaults - Object with package-specific default configs
|
|
112
|
+
* @param userConfigOverrides - Optional user overrides
|
|
113
|
+
* @returns Merged configuration
|
|
114
|
+
*/
|
|
115
|
+
function buildMJConfig(packageDefaults, userConfigOverrides) {
|
|
116
|
+
// Start with empty config
|
|
117
|
+
let config = {};
|
|
118
|
+
// Merge each package's defaults
|
|
119
|
+
if (packageDefaults.codegen) {
|
|
120
|
+
config = (0, config_merger_1.mergeConfigs)(config, packageDefaults.codegen);
|
|
121
|
+
}
|
|
122
|
+
if (packageDefaults.server) {
|
|
123
|
+
config = (0, config_merger_1.mergeConfigs)(config, packageDefaults.server);
|
|
124
|
+
}
|
|
125
|
+
if (packageDefaults.mcpServer) {
|
|
126
|
+
config = (0, config_merger_1.mergeConfigs)(config, packageDefaults.mcpServer);
|
|
127
|
+
}
|
|
128
|
+
if (packageDefaults.a2aServer) {
|
|
129
|
+
config = (0, config_merger_1.mergeConfigs)(config, packageDefaults.a2aServer);
|
|
130
|
+
}
|
|
131
|
+
if (packageDefaults.queryGen) {
|
|
132
|
+
config = { ...config, queryGen: packageDefaults.queryGen };
|
|
133
|
+
}
|
|
134
|
+
// Apply user overrides
|
|
135
|
+
if (userConfigOverrides) {
|
|
136
|
+
config = (0, config_merger_1.mergeConfigs)(config, userConfigOverrides);
|
|
137
|
+
}
|
|
138
|
+
return config;
|
|
139
|
+
}
|
|
140
|
+
exports.buildMJConfig = buildMJConfig;
|
|
141
|
+
//# sourceMappingURL=config-loader.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eAAe,CAAC,SAAS,EAAE,CAAC;QAC9B,MAAM,GAAG,IAAA,4BAAY,EAAC,MAAM,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;IAC3D,CAAC;IACD,IAAI,eAAe,CAAC,SAAS,EAAE,CAAC;QAC9B,MAAM,GAAG,IAAA,4BAAY,EAAC,MAAM,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;IAC3D,CAAC;IACD,IAAI,eAAe,CAAC,QAAQ,EAAE,CAAC;QAC7B,MAAM,GAAG,EAAE,GAAG,MAAM,EAAE,QAAQ,EAAE,eAAe,CAAC,QAAQ,EAAE,CAAC;IAC7D,CAAC;IAED,uBAAuB;IACvB,IAAI,mBAAmB,EAAE,CAAC;QACxB,MAAM,GAAG,IAAA,4BAAY,EAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IACrD,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AApCD,sCAoCC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration merge options
|
|
3
|
+
*/
|
|
4
|
+
export interface MergeOptions {
|
|
5
|
+
/**
|
|
6
|
+
* If true, arrays are concatenated instead of replaced.
|
|
7
|
+
* Default: false (arrays replace)
|
|
8
|
+
*/
|
|
9
|
+
concatenateArrays?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* If true, null values in override config will replace default values.
|
|
12
|
+
* If false, null values are ignored and defaults are preserved.
|
|
13
|
+
* Default: false
|
|
14
|
+
*/
|
|
15
|
+
allowNullOverrides?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Deep merges user configuration into default configuration.
|
|
19
|
+
*
|
|
20
|
+
* Merge Rules:
|
|
21
|
+
* 1. Primitives (string, number, boolean): User value replaces default
|
|
22
|
+
* 2. Objects: Recursively merge properties
|
|
23
|
+
* 3. Arrays: Replace entirely (unless concatenateArrays option is true)
|
|
24
|
+
* 4. Null/Undefined: Preserved based on allowNullOverrides option
|
|
25
|
+
* 5. Special _append suffix: Concatenates arrays (e.g., excludeSchemas_append)
|
|
26
|
+
*
|
|
27
|
+
* @param defaults - Default configuration object
|
|
28
|
+
* @param overrides - User override configuration object
|
|
29
|
+
* @param options - Merge behavior options
|
|
30
|
+
* @returns Merged configuration object
|
|
31
|
+
*/
|
|
32
|
+
export declare function mergeConfigs<T extends Record<string, any>>(defaults: T, overrides: Partial<T> | undefined, options?: MergeOptions): T;
|
|
33
|
+
/**
|
|
34
|
+
* Validates merged configuration against expected structure.
|
|
35
|
+
* Logs warnings for unexpected keys that might indicate typos.
|
|
36
|
+
*
|
|
37
|
+
* @param config - Merged configuration object
|
|
38
|
+
* @param allowedKeys - Set of allowed top-level keys
|
|
39
|
+
*/
|
|
40
|
+
export declare function validateConfigStructure(config: Record<string, any>, allowedKeys: Set<string>): void;
|
|
41
|
+
//# sourceMappingURL=config-merger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-merger.d.ts","sourceRoot":"","sources":["../src/config-merger.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACxD,QAAQ,EAAE,CAAC,EACX,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,SAAS,EACjC,OAAO,GAAE,YAAiB,GACzB,CAAC,CAqBH;AA0ED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,GACvB,IAAI,CAUN"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.validateConfigStructure = exports.mergeConfigs = void 0;
|
|
7
|
+
const lodash_mergewith_1 = __importDefault(require("lodash.mergewith"));
|
|
8
|
+
/**
|
|
9
|
+
* Deep merges user configuration into default configuration.
|
|
10
|
+
*
|
|
11
|
+
* Merge Rules:
|
|
12
|
+
* 1. Primitives (string, number, boolean): User value replaces default
|
|
13
|
+
* 2. Objects: Recursively merge properties
|
|
14
|
+
* 3. Arrays: Replace entirely (unless concatenateArrays option is true)
|
|
15
|
+
* 4. Null/Undefined: Preserved based on allowNullOverrides option
|
|
16
|
+
* 5. Special _append suffix: Concatenates arrays (e.g., excludeSchemas_append)
|
|
17
|
+
*
|
|
18
|
+
* @param defaults - Default configuration object
|
|
19
|
+
* @param overrides - User override configuration object
|
|
20
|
+
* @param options - Merge behavior options
|
|
21
|
+
* @returns Merged configuration object
|
|
22
|
+
*/
|
|
23
|
+
function mergeConfigs(defaults, overrides, options = {}) {
|
|
24
|
+
const { concatenateArrays = false, allowNullOverrides = false } = options;
|
|
25
|
+
if (!overrides || typeof overrides !== 'object') {
|
|
26
|
+
return defaults;
|
|
27
|
+
}
|
|
28
|
+
// Process _append suffixed keys first
|
|
29
|
+
const processedOverrides = processAppendKeys(overrides, defaults);
|
|
30
|
+
return (0, lodash_mergewith_1.default)({}, defaults, processedOverrides, (defaultValue, overrideValue, key) => {
|
|
31
|
+
return customMergeStrategy(defaultValue, overrideValue, key, {
|
|
32
|
+
concatenateArrays,
|
|
33
|
+
allowNullOverrides
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
exports.mergeConfigs = mergeConfigs;
|
|
38
|
+
/**
|
|
39
|
+
* Processes keys with _append suffix to concatenate arrays
|
|
40
|
+
*/
|
|
41
|
+
function processAppendKeys(overrides, defaults) {
|
|
42
|
+
const processed = { ...overrides };
|
|
43
|
+
for (const key in overrides) {
|
|
44
|
+
if (key.endsWith('_append')) {
|
|
45
|
+
const baseKey = key.slice(0, -7); // Remove '_append' suffix
|
|
46
|
+
const defaultValue = defaults[baseKey];
|
|
47
|
+
const appendValue = overrides[key];
|
|
48
|
+
if (Array.isArray(defaultValue) && Array.isArray(appendValue)) {
|
|
49
|
+
processed[baseKey] = [...defaultValue, ...appendValue];
|
|
50
|
+
delete processed[key]; // Remove the _append key
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
console.warn(`Warning: ${key} expects both default and override to be arrays. ` +
|
|
54
|
+
`Default type: ${typeof defaultValue}, Override type: ${typeof appendValue}`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return processed;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Custom merge strategy for lodash.mergeWith
|
|
62
|
+
*/
|
|
63
|
+
function customMergeStrategy(defaultValue, overrideValue, key, options) {
|
|
64
|
+
const { concatenateArrays, allowNullOverrides } = options;
|
|
65
|
+
// Handle null/undefined overrides
|
|
66
|
+
if (overrideValue === null || overrideValue === undefined) {
|
|
67
|
+
return allowNullOverrides ? overrideValue : defaultValue;
|
|
68
|
+
}
|
|
69
|
+
// Arrays: Replace or concatenate based on option
|
|
70
|
+
if (Array.isArray(defaultValue) && Array.isArray(overrideValue)) {
|
|
71
|
+
return concatenateArrays ? [...defaultValue, ...overrideValue] : overrideValue;
|
|
72
|
+
}
|
|
73
|
+
// Objects: Let lodash continue recursive merge (return undefined)
|
|
74
|
+
if (isPlainObject(defaultValue) && isPlainObject(overrideValue)) {
|
|
75
|
+
return undefined; // Continue default merge behavior
|
|
76
|
+
}
|
|
77
|
+
// Primitives: Override replaces default
|
|
78
|
+
return overrideValue;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Checks if value is a plain object (not array, not class instance)
|
|
82
|
+
*/
|
|
83
|
+
function isPlainObject(value) {
|
|
84
|
+
return (typeof value === 'object' &&
|
|
85
|
+
value !== null &&
|
|
86
|
+
!Array.isArray(value) &&
|
|
87
|
+
Object.getPrototypeOf(value) === Object.prototype);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Validates merged configuration against expected structure.
|
|
91
|
+
* Logs warnings for unexpected keys that might indicate typos.
|
|
92
|
+
*
|
|
93
|
+
* @param config - Merged configuration object
|
|
94
|
+
* @param allowedKeys - Set of allowed top-level keys
|
|
95
|
+
*/
|
|
96
|
+
function validateConfigStructure(config, allowedKeys) {
|
|
97
|
+
const configKeys = Object.keys(config);
|
|
98
|
+
const unexpectedKeys = configKeys.filter(key => !allowedKeys.has(key));
|
|
99
|
+
if (unexpectedKeys.length > 0) {
|
|
100
|
+
console.warn(`Warning: Unexpected configuration keys found: ${unexpectedKeys.join(', ')}. ` +
|
|
101
|
+
`These may be typos or deprecated settings.`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
exports.validateConfigStructure = validateConfigStructure;
|
|
105
|
+
//# sourceMappingURL=config-merger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-merger.js","sourceRoot":"","sources":["../src/config-merger.ts"],"names":[],"mappings":";;;;;;AAAA,wEAAyC;AAoBzC;;;;;;;;;;;;;;GAcG;AACH,SAAgB,YAAY,CAC1B,QAAW,EACX,SAAiC,EACjC,UAAwB,EAAE;IAE1B,MAAM,EAAE,iBAAiB,GAAG,KAAK,EAAE,kBAAkB,GAAG,KAAK,EAAE,GAAG,OAAO,CAAC;IAE1E,IAAI,CAAC,SAAS,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;QAChD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,sCAAsC;IACtC,MAAM,kBAAkB,GAAG,iBAAiB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAElE,OAAO,IAAA,0BAAS,EACd,EA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C,IAAI,CACV,iDAAiD,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;YAC9E,4CAA4C,CAC7C,CAAC;IACJ,CAAC;AACH,CAAC;AAbD,0DAaC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration type definitions for MemberJunction.
|
|
3
|
+
*
|
|
4
|
+
* Note: This file provides type re-exports for convenience.
|
|
5
|
+
* The actual type definitions and defaults live in their respective packages:
|
|
6
|
+
* - @memberjunction/server (MJServerConfig)
|
|
7
|
+
* - @memberjunction/codegen-lib (CodeGenConfig)
|
|
8
|
+
* - @memberjunction/mcp-server (MCPServerConfig)
|
|
9
|
+
* - @memberjunction/a2a-server (A2AServerConfig)
|
|
10
|
+
* - @memberjunction/querygen (QueryGenConfig)
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Generic configuration type for MemberJunction.
|
|
14
|
+
* Each consuming package should define its own specific configuration type.
|
|
15
|
+
*/
|
|
16
|
+
export type MJConfig = Record<string, any>;
|
|
17
|
+
/**
|
|
18
|
+
* Type guard to check if a value is a valid configuration object
|
|
19
|
+
*/
|
|
20
|
+
export declare function isValidConfig(value: unknown): value is MJConfig;
|
|
21
|
+
//# sourceMappingURL=config-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-types.d.ts","sourceRoot":"","sources":["../src/config-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAE3C;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAE/D"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Configuration type definitions for MemberJunction.
|
|
4
|
+
*
|
|
5
|
+
* Note: This file provides type re-exports for convenience.
|
|
6
|
+
* The actual type definitions and defaults live in their respective packages:
|
|
7
|
+
* - @memberjunction/server (MJServerConfig)
|
|
8
|
+
* - @memberjunction/codegen-lib (CodeGenConfig)
|
|
9
|
+
* - @memberjunction/mcp-server (MCPServerConfig)
|
|
10
|
+
* - @memberjunction/a2a-server (A2AServerConfig)
|
|
11
|
+
* - @memberjunction/querygen (QueryGenConfig)
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.isValidConfig = void 0;
|
|
15
|
+
/**
|
|
16
|
+
* Type guard to check if a value is a valid configuration object
|
|
17
|
+
*/
|
|
18
|
+
function isValidConfig(value) {
|
|
19
|
+
return typeof value === 'object' && value !== null;
|
|
20
|
+
}
|
|
21
|
+
exports.isValidConfig = isValidConfig;
|
|
22
|
+
//# sourceMappingURL=config-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-types.js","sourceRoot":"","sources":["../src/config-types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAQH;;GAEG;AACH,SAAgB,aAAa,CAAC,KAAc;IAC1C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACrD,CAAC;AAFD,sCAEC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @memberjunction/config
|
|
3
|
+
*
|
|
4
|
+
* Central configuration utilities for MemberJunction framework.
|
|
5
|
+
* Provides utilities for loading and merging user overrides with package defaults.
|
|
6
|
+
*
|
|
7
|
+
* Architecture:
|
|
8
|
+
* - Each package (server, codegen-lib, etc.) exports its own DEFAULT_CONFIG
|
|
9
|
+
* - This package provides utilities to discover, load, and merge configurations
|
|
10
|
+
* - User's mj.config.cjs file overrides package defaults
|
|
11
|
+
* - Environment variables override everything
|
|
12
|
+
*/
|
|
13
|
+
export { loadMJConfig, loadMJConfigSync, buildMJConfig, type LoadConfigOptions, type LoadConfigResult } from './config-loader';
|
|
14
|
+
export { mergeConfigs, validateConfigStructure, type MergeOptions } from './config-merger';
|
|
15
|
+
export { type MJConfig, isValidConfig } from './config-types';
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACtB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,YAAY,EACZ,uBAAuB,EACvB,KAAK,YAAY,EAClB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,KAAK,QAAQ,EACb,aAAa,EACd,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @memberjunction/config
|
|
4
|
+
*
|
|
5
|
+
* Central configuration utilities for MemberJunction framework.
|
|
6
|
+
* Provides utilities for loading and merging user overrides with package defaults.
|
|
7
|
+
*
|
|
8
|
+
* Architecture:
|
|
9
|
+
* - Each package (server, codegen-lib, etc.) exports its own DEFAULT_CONFIG
|
|
10
|
+
* - This package provides utilities to discover, load, and merge configurations
|
|
11
|
+
* - User's mj.config.cjs file overrides package defaults
|
|
12
|
+
* - Environment variables override everything
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.isValidConfig = exports.validateConfigStructure = exports.mergeConfigs = exports.buildMJConfig = exports.loadMJConfigSync = exports.loadMJConfig = void 0;
|
|
16
|
+
var config_loader_1 = require("./config-loader");
|
|
17
|
+
Object.defineProperty(exports, "loadMJConfig", { enumerable: true, get: function () { return config_loader_1.loadMJConfig; } });
|
|
18
|
+
Object.defineProperty(exports, "loadMJConfigSync", { enumerable: true, get: function () { return config_loader_1.loadMJConfigSync; } });
|
|
19
|
+
Object.defineProperty(exports, "buildMJConfig", { enumerable: true, get: function () { return config_loader_1.buildMJConfig; } });
|
|
20
|
+
var config_merger_1 = require("./config-merger");
|
|
21
|
+
Object.defineProperty(exports, "mergeConfigs", { enumerable: true, get: function () { return config_merger_1.mergeConfigs; } });
|
|
22
|
+
Object.defineProperty(exports, "validateConfigStructure", { enumerable: true, get: function () { return config_merger_1.validateConfigStructure; } });
|
|
23
|
+
var config_types_1 = require("./config-types");
|
|
24
|
+
Object.defineProperty(exports, "isValidConfig", { enumerable: true, get: function () { return config_types_1.isValidConfig; } });
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAEH,iDAMyB;AALvB,6GAAA,YAAY,OAAA;AACZ,iHAAA,gBAAgB,OAAA;AAChB,8GAAA,aAAa,OAAA;AAKf,iDAIyB;AAHvB,6GAAA,YAAY,OAAA;AACZ,wHAAA,uBAAuB,OAAA;AAIzB,+CAGwB;AADtB,6GAAA,aAAa,OAAA"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/config",
|
|
3
|
-
"version": "0.0
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"description": "Central configuration package for MemberJunction framework with default configurations and merge utilities",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc",
|
|
9
|
+
"watch": "tsc --watch",
|
|
10
|
+
"clean": "rm -rf dist",
|
|
11
|
+
"test": "jest"
|
|
12
|
+
},
|
|
5
13
|
"keywords": [
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
14
|
+
"memberjunction",
|
|
15
|
+
"configuration",
|
|
16
|
+
"config"
|
|
17
|
+
],
|
|
18
|
+
"author": "MemberJunction",
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"cosmiconfig": "^9.0.0",
|
|
22
|
+
"lodash.mergewith": "^4.6.2",
|
|
23
|
+
"zod": "^3.22.0"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/lodash.mergewith": "^4.6.9",
|
|
27
|
+
"@types/node": "^20.0.0",
|
|
28
|
+
"typescript": "^5.3.0"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist"
|
|
9
32
|
]
|
|
10
33
|
}
|
package/README.md
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
# @memberjunction/config
|
|
2
|
-
|
|
3
|
-
## ⚠️ IMPORTANT NOTICE ⚠️
|
|
4
|
-
|
|
5
|
-
**This package is created solely for the purpose of setting up OIDC (OpenID Connect) trusted publishing with npm.**
|
|
6
|
-
|
|
7
|
-
This is **NOT** a functional package and contains **NO** code or functionality beyond the OIDC setup configuration.
|
|
8
|
-
|
|
9
|
-
## Purpose
|
|
10
|
-
|
|
11
|
-
This package exists to:
|
|
12
|
-
1. Configure OIDC trusted publishing for the package name `@memberjunction/config`
|
|
13
|
-
2. Enable secure, token-less publishing from CI/CD workflows
|
|
14
|
-
3. Establish provenance for packages published under this name
|
|
15
|
-
|
|
16
|
-
## What is OIDC Trusted Publishing?
|
|
17
|
-
|
|
18
|
-
OIDC trusted publishing allows package maintainers to publish packages directly from their CI/CD workflows without needing to manage npm access tokens. Instead, it uses OpenID Connect to establish trust between the CI/CD provider (like GitHub Actions) and npm.
|
|
19
|
-
|
|
20
|
-
## Setup Instructions
|
|
21
|
-
|
|
22
|
-
To properly configure OIDC trusted publishing for this package:
|
|
23
|
-
|
|
24
|
-
1. Go to [npmjs.com](https://www.npmjs.com/) and navigate to your package settings
|
|
25
|
-
2. Configure the trusted publisher (e.g., GitHub Actions)
|
|
26
|
-
3. Specify the repository and workflow that should be allowed to publish
|
|
27
|
-
4. Use the configured workflow to publish your actual package
|
|
28
|
-
|
|
29
|
-
## DO NOT USE THIS PACKAGE
|
|
30
|
-
|
|
31
|
-
This package is a placeholder for OIDC configuration only. It:
|
|
32
|
-
- Contains no executable code
|
|
33
|
-
- Provides no functionality
|
|
34
|
-
- Should not be installed as a dependency
|
|
35
|
-
- Exists only for administrative purposes
|
|
36
|
-
|
|
37
|
-
## More Information
|
|
38
|
-
|
|
39
|
-
For more details about npm's trusted publishing feature, see:
|
|
40
|
-
- [npm Trusted Publishing Documentation](https://docs.npmjs.com/generating-provenance-statements)
|
|
41
|
-
- [GitHub Actions OIDC Documentation](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect)
|
|
42
|
-
|
|
43
|
-
---
|
|
44
|
-
|
|
45
|
-
**Maintained for OIDC setup purposes only**
|