@docupace/ihub-config 1.1.22-admin.6 → 1.1.23

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.
@@ -3,34 +3,11 @@ import { ConfigStoreParams } from './config-service.js';
3
3
  import type { ConfigInjectorResolvers } from './injector-resolvers/config-injector.js';
4
4
  import type { ConfigProviders } from './providers/index.js';
5
5
  import type { ConfigResolversConfig } from './resolvers/index.js';
6
- export interface ConfigurationOverride {
7
- value: string;
8
- contentType?: string | null;
9
- }
10
- export interface ConfigurationOverrideResult {
11
- /** The whole-object override for `configPath`, if one is set. */
12
- whole: ConfigurationOverride | null;
13
- /**
14
- * One winning value per distinct JSONPath found for `configPath` (e.g.
15
- * `{ '$.columns': [...] }`), scope-resolved for the current identity.
16
- * `null` when there are no sub-path override rows for `configPath` at all.
17
- */
18
- subPaths: Record<string, unknown> | null;
19
- }
20
- export interface ConfigurationOverrideProvider {
21
- /**
22
- * Resolves both the whole-object override and any sub-path overrides for
23
- * `configPath` in a single lookup, since both are drawn from the same set
24
- * of override rows.
25
- */
26
- resolve(configPath: string, context: any): Promise<ConfigurationOverrideResult>;
27
- }
28
6
  export interface ConfigExtensionOptions {
29
7
  configInjectorResolvers?: ConfigInjectorResolvers;
30
8
  providers?: ConfigProviders;
31
9
  resolvers?: ConfigResolversConfig;
32
10
  configStores?: ConfigStoreParams[];
33
- configurationOverrideProvider?: ConfigurationOverrideProvider;
34
11
  }
35
12
  export declare const getConfigExtension: (options?: ConfigExtensionOptions) => Promise<ExtensionConfig>;
36
13
  //# sourceMappingURL=config-extension.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config-extension.d.ts","sourceRoot":"","sources":["../src/config-extension.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D,OAAO,EAAE,iBAAiB,EAAwB,MAAM,qBAAqB,CAAC;AAE9E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAA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AM,sBAAsB,CAAC;AAGlE,MAAM,WAAW,sBAAsB;IACrC,uBAAuB,CAAC,EAAE,uBAAuB,CAAC;IAClD,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,SAAS,CAAC,EAAE,qBAAqB,CAAC;IAClC,YAAY,CAAC,EAAE,iBAAiB,EAAE,CAAC;CACpC;AA8BD,eAAO,MAAM,kBAAkB,GAC7B,UAAS,sBAA2B,KACnC,OAAO,CAAC,eAAe,CA2BzB,CAAC"}
@@ -25,7 +25,6 @@ const initializeConfigStores = async (configStores) => {
25
25
  configInjectorResolvers: undefined,
26
26
  providers: undefined,
27
27
  resolvers: undefined,
28
- configurationOverrideProvider: undefined,
29
28
  });
30
29
  await configService.init();
31
30
  };
@@ -38,7 +37,6 @@ export const getConfigExtension = async (options = {}) => {
38
37
  providers: options.providers,
39
38
  resolvers: options.resolvers,
40
39
  configStores,
41
- configurationOverrideProvider: options.configurationOverrideProvider,
42
40
  });
43
41
  return {
44
42
  name: 'config',
@@ -1 +1 @@
1
- {"version":3,"file":"config-extension.js","sourceRoot":"","sources":["../src/config-extension.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAqB,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAGrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAsCrD,MAAM,qBAAqB,GAAG,CAAC,YAAiC,EAAE,EAAE;IAClE,OAAO,YAAY,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QACxC,GAAG,EAAE,WAAW,CAAC,GAAG;QACpB,IAAI,EAAE,WAAW,CAAC,IAAI;QACtB,QAAQ,EAAE,WAA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,CAAC;QACzC,KAAK,EAAE,SAAS;QAChB,YAAY;QACZ,uBAAuB,EAAE,SAAS;QAClC,SAAS,EAAE,SAAS;QACpB,SAAS,EAAE,SAAS;KACrB,CAAC,CAAC;IAEH,MAAM,aAAa,CAAC,IAAI,EAAE,CAAC;AAC7B,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,EACrC,UAAkC,EAAE,EACV,EAAE;IAC5B,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,IAAI,eAAe,EAAE,CAAC;IAE/D,MAAM,sBAAsB,CAAC,YAAY,CAAC,CAAC;IAE3C,MAAM,gBAAgB,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CACxD,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC,CAC7C,CAAC;IAEF,MAAM,WAAW,GAAG,uBAAuB,CAAC;QAC1C,uBAAuB,EAAE,OAAO,CAAC,uBAAuB;QACxD,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,YAAY;KACb,CAAC,CAAC;IAEH,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,CAAC,mBAAmB,EAAE,EAAE,GAAG,gBAAgB,CAAC;QACxD,OAAO,EAAE;YACP;gBACE,WAAW;aACZ;SACF;QACD,KAAK,EAAE,EAAE;QACT,SAAS,EAAE,EAAE;KACd,CAAC;AACJ,CAAC,CAAC"}
@@ -23,7 +23,6 @@ export interface DefaultConfigServiceParams {
23
23
  configInjectorResolvers: ConfigExtensionOptions['configInjectorResolvers'];
24
24
  providers: ConfigExtensionOptions['providers'];
25
25
  resolvers: ConfigExtensionOptions['resolvers'];
26
- configurationOverrideProvider: ConfigExtensionOptions['configurationOverrideProvider'];
27
26
  }
28
27
  export declare class ConfigFileStore implements ConfigStore {
29
28
  private readonly localPath;
@@ -49,7 +48,6 @@ declare class ConfigService {
49
48
  private readonly configInjectorResolvers;
50
49
  private readonly providers;
51
50
  private readonly resolvers;
52
- private readonly configurationOverrideProvider;
53
51
  constructor(model: Model | undefined, configStores: ConfigStore[], extensionOptions?: ConfigExtensionOptions);
54
52
  private filterConfigsBySearch;
55
53
  private appendTestConfigPaths;
@@ -60,14 +58,10 @@ declare class ConfigService {
60
58
  private processObjectArray;
61
59
  private processObjectProperties;
62
60
  private applyReferenceOverrides;
63
- private applyReferenceExtensions;
64
61
  private processReferencedObject;
65
62
  private injectConfigValue;
66
63
  generateResolvers(): void;
67
- processConfig(config: any, context: any, processProviders?: boolean, rootSubPathOverrides?: Record<string, unknown> | null): Promise<any>;
68
- private processConfigTree;
69
- private applyConfigPathOverride;
70
- private applyTypenameProvider;
64
+ processConfig(config: any, context: any, processProviders?: boolean): Promise<any>;
71
65
  getRefConfig(configPath: string, refConfigPath: string, context: any, values?: any): Promise<any>;
72
66
  updatePathValues(obj: any, inputPath: string): any;
73
67
  flattenArray(arr: any[]): any[];
@@ -75,10 +69,7 @@ declare class ConfigService {
75
69
  private processImageReference;
76
70
  processObject(configPath: string, obj: any, context: any, values?: any): Promise<any>;
77
71
  private getFileMimeType;
78
- getConfigFromStore(configPath: string, context?: any): Promise<{
79
- config: any;
80
- subPathOverrides: Record<string, unknown> | null;
81
- }>;
72
+ getConfigFromStore(path: string): Promise<any>;
82
73
  hasConfig(configPath: string): Promise<boolean>;
83
74
  getConfig(configPath: string, context: any, values?: any, processProviders?: boolean): Promise<any>;
84
75
  getDirectConfig(configPath: string, context: any, values?: any, processProviders?: boolean): Promise<any>;
@@ -107,6 +98,6 @@ declare class ConfigService {
107
98
  getPageConfig(pagePath: string, context: any, processConfig?: boolean, rulesContext?: any): Promise<any>;
108
99
  init(): Promise<void[]>;
109
100
  }
110
- export declare const defaultConfigService: ({ model, configStores, configInjectorResolvers, providers, resolvers, configurationOverrideProvider, }: DefaultConfigServiceParams) => ConfigService;
101
+ export declare const defaultConfigService: ({ model, configStores, configInjectorResolvers, providers, resolvers, }: DefaultConfigServiceParams) => ConfigService;
111
102
  export default ConfigService;
112
103
  //# sourceMappingURL=config-service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config-service.d.ts","sourceRoot":"","sources":["../src/config-service.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAgN5C,MAAM,WAAW,WAAW;IAC1B,eAAe,IAAI,OAAO,CAAC;IAC3B,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1C,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IACtC,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IACxC,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IACtD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B;AAED,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,0BAA0B;IACzC,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,YAAY,EAAE,iBAAiB,EAAE,CAAC;IAClC,uBAAuB,EAAE,sBAAsB,CAAC,yBAAyB,CAAC,CAAC;IAC3E,SAAS,EAAE,sBAAsB,CAAC,WAAW,CAAC,CAAC;IAC/C,SAAS,EAAE,sBAAsB,CAAC,WAA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Mf,OAAO,CAAC,wBAAwB;IAOhC,OAAO,CAAC,uBAAuB;IA2B/B,OAAO,CAAC,sBAAsB;YAiChB,yBAAyB;YA6DzB,wBAAwB;IAiCtC,OAAO,CAAC,UAAU;IAyBlB,OAAO,CAAC,uBAAuB;IAkD/B,OAAO,CAAC,iBAAiB;IAazB,OAAO,CAAC,sBAAsB;IAuB9B,OAAO,CAAC,sBAAsB;IAyB9B,OAAO,CAAC,oBAAoB;IAY5B,OAAO,CAAC,sBAAsB;IAc9B,OAAO,CAAC,iBAAiB;IAwBzB,OAAO,CAAC,iBAAiB;IASzB,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,sBAAsB;IAmB9B,OAAO,CAAC,oBAAoB;IAyB5B,OAAO,CAAC,6BAA6B;IAcrC,OAAO,CAAC,qBAAqB;IAOvB,aAAa,CAAC,YAAY,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAoC9D,aAAa,CACjB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,GAAG,EACZ,aAAa,CAAC,EAAE,OAAO,EACvB,YAAY,CAAC,EAAE,GAAG;IAed,IAAI;CAKX;AAED,eAAO,MAAM,oBAAoB,GAAI,yEAMlC,0BAA0B,KAAG,aAY/B,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -11,158 +11,8 @@ import { builtInProviders } from './providers/index.js';
11
11
  import { deepMergeResolvers, } from './resolvers/index.js';
12
12
  import { dump, load } from 'js-yaml';
13
13
  import { buildQuery } from '@docupace/ihub-core/query';
14
- import jp from 'jsonpath';
15
14
  const FULL_OBJECT_EXPRESSION_PATTERN = /^\${(.*?)}$/;
16
15
  const INLINE_OBJECT_EXPRESSION_PATTERN = /\${(.*?)}/g;
17
- function isNamedObjectArray(value) {
18
- return (Array.isArray(value) &&
19
- value.every((item) => item !== null &&
20
- typeof item === 'object' &&
21
- typeof item.name === 'string'));
22
- }
23
- // An override element counts as "self-contained" when it carries enough of
24
- // its own definition to render on its own — a real attribute path (or paths)
25
- // or a computed expression — as opposed to a thin `{ name, visible }`-style
26
- // reference that only makes sense resolved against a base/predefined
27
- // counterpart of the same name.
28
- function isSelfContainedOverrideElement(item) {
29
- const paths = item.paths;
30
- return ((Array.isArray(paths) && paths.length > 0) ||
31
- (typeof item.expression === 'string' && item.expression.length > 0));
32
- }
33
- /**
34
- * Merge semantics for a config sub-path override against the value already
35
- * at that JSONPath. Generic — used for any typename/sub-path the
36
- * configPath/subPath mechanism resolves, not just `Table.columns`.
37
- *
38
- * When both the current value and the override value are arrays of objects
39
- * each carrying a string `name`, override elements are merged onto their
40
- * base counterpart by name (override wins per-attribute, everything else
41
- * inherited) instead of the override replacing the array wholesale. This is
42
- * what makes a saved override non-destructive:
43
- * - Reordering falls out of the override array's own element order.
44
- * - "Hiding" an element is an attribute override (e.g. `visible: false`) on
45
- * an element that's still present, not a deletion.
46
- * - A base element the override never mentions is appended unchanged, so a
47
- * base element added later still surfaces for someone with an existing
48
- * override, instead of being permanently absent from their frozen array.
49
- * - An override element naming something not found in the base is kept
50
- * as-is when it's self-contained (has its own path(s)/expression — e.g. a
51
- * hand-authored column), or silently dropped when it's a thin reference
52
- * whose target (e.g. a predefined column) no longer exists — this never
53
- * throws; the stale reference just doesn't round-trip into the next save.
54
- *
55
- * Any other shape (scalars, plain objects, arrays without a `name` key) is
56
- * returned untouched, so the caller's plain whole-value replace applies
57
- * exactly as it did before this merge existed.
58
- */
59
- function mergeSubPathOverrideValue(base, override) {
60
- if (!isNamedObjectArray(override) || !isNamedObjectArray(base)) {
61
- return override;
62
- }
63
- const baseByName = new Map(base.map((item) => [item.name, item]));
64
- const merged = [];
65
- const seenNames = new Set();
66
- for (const overrideItem of override) {
67
- // Guard against a corrupted/hand-edited override array carrying two
68
- // elements with the same name — only the first is kept, so the merged
69
- // result never has duplicate names.
70
- if (seenNames.has(overrideItem.name)) {
71
- continue;
72
- }
73
- seenNames.add(overrideItem.name);
74
- const baseItem = baseByName.get(overrideItem.name);
75
- if (baseItem) {
76
- merged.push({ ...baseItem, ...overrideItem });
77
- }
78
- else if (isSelfContainedOverrideElement(overrideItem)) {
79
- merged.push(overrideItem);
80
- }
81
- // else: a thin reference to a name that no longer resolves — drop it.
82
- }
83
- const mergedNames = new Set(merged.map((item) => item.name));
84
- const untouchedBaseItems = base.filter((item) => !mergedNames.has(item.name));
85
- return [...merged, ...untouchedBaseItems];
86
- }
87
- function isRefElement(item) {
88
- return (item !== null &&
89
- typeof item === 'object' &&
90
- typeof item.$ref === 'string');
91
- }
92
- // Resolves a config-path override array element's fragment-only `$ref`
93
- // (e.g. `"#$.predefinedColumns[?(@.name=='email')]"`) against `refRoot` —
94
- // the config-path's own sibling fields, not another file. This is
95
- // deliberately narrower than `template`'s YAML `$ref` (processed by
96
- // `processReferencedObject`/`getRefConfig`, which loads another config
97
- // file): an override-array `$ref` only ever supports the `#<jsonpath>`
98
- // self-reference form, resolved with the already-vendored `jsonpath`
99
- // package (the same one `applyConfigPathOverride` uses for `subPath`
100
- // strings). A ref that doesn't start with `#`, resolves to nothing, or
101
- // resolves to a non-object is treated the same as any other unresolved
102
- // override reference elsewhere in this module — silently dropped rather
103
- // than thrown, so a stale reference just doesn't round-trip into the next
104
- // save. Multiple matches take the first, in JSONPath document order.
105
- //
106
- // The resolved object keeps the original fragment string under `ref` (not
107
- // `$ref` — GraphQL field names can't start with `$`) rather than dropping
108
- // it once resolved. Without this, a client re-saving the array unchanged
109
- // (e.g. reordering a different column) would have no way to tell this
110
- // element apart from a plain inline column and would flatten it back into
111
- // a frozen copy on that save — exactly the staleness problem `$ref` exists
112
- // to avoid. `Column.ref` (the GraphQL field) surfaces it back to the client
113
- // so `docupace-ui-main` can keep re-emitting the same `$ref` indefinitely.
114
- function resolveOverrideElementRef(item, refRoot) {
115
- const ref = item.$ref;
116
- if (!ref.startsWith('#')) {
117
- return undefined;
118
- }
119
- const [match] = jp.query(refRoot, ref.slice(1));
120
- if (match === null || typeof match !== 'object') {
121
- return undefined;
122
- }
123
- const { $ref: _unusedRef, ...localOverrides } = item;
124
- return {
125
- ...match,
126
- ...localOverrides,
127
- ref,
128
- };
129
- }
130
- // Expands any `$ref` elements of a config-path override array into the
131
- // full object they point at (merged with whatever local attributes the
132
- // element carries alongside `$ref`, e.g. `visible`) before the array is
133
- // handed to `mergeSubPathOverrideValue`. Runs first so that a `{ $ref,
134
- // visible }` stub — which has no `name` of its own — always arrives at the
135
- // name-keyed merge as a proper named object; `mergeSubPathOverrideValue`
136
- // itself needs no `$ref` awareness.
137
- function expandRefOverrideElements(value, refRoot) {
138
- if (!Array.isArray(value)) {
139
- return value;
140
- }
141
- return value
142
- .map((item) => isRefElement(item) ? resolveOverrideElementRef(item, refRoot) : item)
143
- .filter((item) => item !== undefined);
144
- }
145
- // Builds the object a config-path override's `$ref` fragments resolve
146
- // against: the config being overridden, overlaid with the *raw* (not yet
147
- // merged) override value of every other simple top-level subPath in this
148
- // same patch (e.g. `$.predefinedColumns`). Using the raw override value
149
- // rather than depending on loop order elsewhere in
150
- // `applyConfigPathOverride` means a `$.columns` override's `$ref` into
151
- // `$.predefinedColumns` resolves correctly regardless of which subPath
152
- // happens to be processed first. Only single-segment paths (`$.foo`) are
153
- // overlaid — nested subPaths (`$.filter.criteria`) fall back to whatever
154
- // value is already on `config`, which is fine since nothing currently
155
- // needs to `$ref` into a nested subPath.
156
- function buildRefResolutionRoot(config, subPathPatch) {
157
- const overlay = {};
158
- for (const [jsonPath, value] of Object.entries(subPathPatch)) {
159
- const topLevelMatch = /^\$\.([^.[]+)$/.exec(jsonPath);
160
- if (topLevelMatch) {
161
- overlay[topLevelMatch[1]] = value;
162
- }
163
- }
164
- return { ...config, ...overlay };
165
- }
166
16
  export class ConfigFileStore {
167
17
  localPath;
168
18
  remotePath;
@@ -305,7 +155,6 @@ class ConfigService {
305
155
  configInjectorResolvers;
306
156
  providers;
307
157
  resolvers;
308
- configurationOverrideProvider;
309
158
  constructor(model, configStores, extensionOptions = {}) {
310
159
  this.configStores = configStores;
311
160
  this.model = model;
@@ -318,8 +167,6 @@ class ConfigService {
318
167
  this.resolvers = extensionOptions.resolvers
319
168
  ? { ...extensionOptions.resolvers }
320
169
  : {};
321
- this.configurationOverrideProvider =
322
- extensionOptions.configurationOverrideProvider;
323
170
  if (this.model) {
324
171
  this.generateResolvers();
325
172
  }
@@ -385,34 +232,12 @@ class ConfigService {
385
232
  }
386
233
  return processedData;
387
234
  }
388
- applyReferenceExtensions(processedData, referenceConfig) {
389
- if (typeof referenceConfig?.extend !== 'object') {
390
- return processedData;
391
- }
392
- const { extend } = referenceConfig;
393
- for (const key in extend) {
394
- const extensionValue = extend[key];
395
- if (!Array.isArray(extensionValue)) {
396
- throw new GraphQLError(`$ref.extend.${key} must be an array; received ${typeof extensionValue}`);
397
- }
398
- const baseValue = processedData[key];
399
- if (baseValue === undefined) {
400
- processedData[key] = extensionValue;
401
- continue;
402
- }
403
- if (!Array.isArray(baseValue)) {
404
- throw new GraphQLError(`$ref.extend.${key} can only extend an array property; "${key}" resolved to ${typeof baseValue}`);
405
- }
406
- processedData[key] = [...baseValue, ...extensionValue];
407
- }
408
- return processedData;
409
- }
410
235
  async processReferencedObject(configPath, obj, context, values) {
411
236
  const referenceConfig = obj.$ref;
412
237
  const refConfigPath = typeof referenceConfig === 'object' && referenceConfig.refPath
413
238
  ? referenceConfig.refPath
414
239
  : referenceConfig;
415
- const imageData = await this.processImageReference(refConfigPath, context);
240
+ const imageData = await this.processImageReference(refConfigPath);
416
241
  if (imageData) {
417
242
  return imageData;
418
243
  }
@@ -421,7 +246,6 @@ class ConfigService {
421
246
  ? this.updatePathValues(referencedData, referenceConfig.path)
422
247
  : referencedData;
423
248
  processedData = this.applyReferenceOverrides(processedData, referenceConfig);
424
- processedData = this.applyReferenceExtensions(processedData, referenceConfig);
425
249
  processedData = await this.processObjectExpressions(processedData, values, context);
426
250
  return this.processObject(configPath, processedData, context, values);
427
251
  }
@@ -438,16 +262,7 @@ class ConfigService {
438
262
  const builtInQueryResolvers = {
439
263
  pages: () => ({
440
264
  getPageConfig: async (obj, context) => {
441
- // `impersonateRoleId`/`impersonateGeneral` are a plain
442
- // pass-through onto context here — this engine never inspects
443
- // identity itself; the host's resolveCurrentIdentity is what
444
- // interprets them and enforces the admin-only restriction.
445
- const impersonation = obj.impersonateRoleId
446
- ? { impersonateRoleId: obj.impersonateRoleId }
447
- : obj.impersonateGeneral
448
- ? { impersonateGeneral: true }
449
- : null;
450
- const pageConfig = await this.getPageConfig(obj.path, impersonation ? { ...context, ...impersonation } : context, true, obj.context);
265
+ const pageConfig = await this.getPageConfig(obj.path, context, true, obj.context);
451
266
  return pageConfig;
452
267
  },
453
268
  getAIConfig: async (obj, context) => {
@@ -531,37 +346,29 @@ class ConfigService {
531
346
  return deepMergeResolvers(builtInMutationResolvers, hostMutationResolvers);
532
347
  };
533
348
  }
534
- // Applies any stored config-path sub-path overrides across the whole
535
- // config tree before processConfig's own recursive walk runs, so that
536
- // overridden values (which may introduce new sub-config) still go
537
- // through provider injection/__typename dispatch below.
538
- //
539
- // rootSubPathOverrides lets a caller that already resolved overrides for
540
- // the root config (e.g. getConfigFromStore, which fetches the whole-object
541
- // and sub-path overrides together in one round trip) hand them in directly
542
- // instead of having the root node re-resolved a second time below; nested
543
- // nodes discovered deeper in the tree are still resolved individually,
544
- // since their configPaths aren't known until the tree has been loaded.
545
- async processConfig(config, context, processProviders, rootSubPathOverrides) {
546
- const overriddenConfig = await this.applyConfigPathOverride(config, context, processProviders, rootSubPathOverrides);
547
- return this.processConfigTree(overriddenConfig, context, processProviders);
548
- }
549
- async processConfigTree(config, context, processProviders) {
349
+ async processConfig(config, context, processProviders) {
550
350
  if (!config) {
551
351
  return config;
552
352
  }
553
353
  // Handle arrays
554
354
  if (Array.isArray(config)) {
555
- return Promise.all(config.map((item) => this.processConfigTree(item, context, processProviders)));
355
+ return Promise.all(config.map((item) => this.processConfig(item, context, processProviders)));
556
356
  }
557
357
  // Handle objects
558
358
  if (typeof config === 'object') {
559
359
  // Recursively process all properties of config
560
360
  let processedConfig = { ...config };
561
361
  for (const key in processedConfig) {
562
- processedConfig[key] = await this.processConfigTree(processedConfig[key], context, processProviders);
362
+ processedConfig[key] = await this.processConfig(processedConfig[key], context, processProviders);
363
+ }
364
+ // First process the current object if it has __typename
365
+ if (processedConfig?.__typename && processProviders) {
366
+ const providerClass = this.providers[processedConfig.__typename];
367
+ if (providerClass) {
368
+ const provider = new providerClass();
369
+ processedConfig = await provider.processConfig(processedConfig, this, context);
370
+ }
563
371
  }
564
- processedConfig = await this.applyTypenameProvider(processedConfig, context, processProviders);
565
372
  return processedConfig;
566
373
  }
567
374
  if (processProviders) {
@@ -569,83 +376,6 @@ class ConfigService {
569
376
  }
570
377
  return config;
571
378
  }
572
- // Walks the whole config tree up front (pre-order) and, for every object
573
- // that declares a configPath, deep-sets any stored sub-path overrides
574
- // (JSONPath-addressed, e.g. "$.columns" or "$.filter.criteria").
575
- //
576
- // preFetchedSubPaths is only honored for the root node of the walk (the
577
- // one being called with a defined third argument); nested calls always
578
- // omit it so their own configPath gets resolved fresh.
579
- async applyConfigPathOverride(config, context, processProviders, preFetchedSubPaths) {
580
- if (!config) {
581
- return config;
582
- }
583
- if (Array.isArray(config)) {
584
- return Promise.all(config.map((item) => this.applyConfigPathOverride(item, context, processProviders)));
585
- }
586
- if (typeof config !== 'object') {
587
- return config;
588
- }
589
- let result = config;
590
- if (processProviders) {
591
- const subPathPatch = preFetchedSubPaths !== undefined
592
- ? preFetchedSubPaths
593
- : result.configPath && this.configurationOverrideProvider
594
- ? (await this.configurationOverrideProvider.resolve(result.configPath, context)).subPaths
595
- : null;
596
- if (subPathPatch) {
597
- const refRoot = buildRefResolutionRoot(result, subPathPatch);
598
- // Deep-clone once, up front — `jp.value` mutates its target in
599
- // place, and a shallow `{ ...result }` per jsonPath only protects
600
- // the top level. A nested subPath (e.g. `$.filter.criteria`) would
601
- // otherwise still mutate `result.filter`, which is the *same*
602
- // object reference as the original, potentially-shared config
603
- // (e.g. reused across tables via `extend`/fragment composition).
604
- // Config values are always plain JSON (from YAML/domain storage),
605
- // so a JSON round-trip clone is sufficient and avoids
606
- // `structuredClone`'s cross-realm `instanceof` pitfalls (its output
607
- // fails `instanceof Object` checks — e.g. inside the `jsonpath`
608
- // package — when the calling code runs in a different VM
609
- // realm/context, as test sandboxes commonly do).
610
- result = JSON.parse(JSON.stringify(result));
611
- for (const [jsonPath, value] of Object.entries(subPathPatch)) {
612
- // A single malformed override (an unparseable `$ref` JSONPath, or
613
- // a jsonPath that doesn't resolve to a settable location) must not
614
- // abort resolution of the rest of this config tree — that would
615
- // take down the page for every user over one bad admin-authored
616
- // row. Log and skip just this jsonPath instead.
617
- try {
618
- const currentValue = jp.value(result, jsonPath);
619
- const expandedValue = expandRefOverrideElements(value, refRoot);
620
- const mergedValue = mergeSubPathOverrideValue(currentValue, expandedValue);
621
- const applied = jp.value(result, jsonPath, mergedValue);
622
- if (applied === undefined) {
623
- throw new Error(`does not resolve to a settable location: "${jsonPath}"`);
624
- }
625
- }
626
- catch (error) {
627
- log.warn(`Skipping configuration override for "${result.configPath}" at "${jsonPath}": ${error.message}`);
628
- }
629
- }
630
- }
631
- }
632
- const overriddenEntries = await Promise.all(Object.entries(result).map(async ([key, value]) => [
633
- key,
634
- await this.applyConfigPathOverride(value, context, processProviders),
635
- ]));
636
- return Object.fromEntries(overriddenEntries);
637
- }
638
- async applyTypenameProvider(processedConfig, context, processProviders) {
639
- if (!processedConfig?.__typename || !processProviders) {
640
- return processedConfig;
641
- }
642
- const providerClass = this.providers[processedConfig.__typename];
643
- if (!providerClass) {
644
- return processedConfig;
645
- }
646
- const provider = new providerClass();
647
- return await provider.processConfig(processedConfig, this, context);
648
- }
649
379
  async getRefConfig(configPath, refConfigPath, context, values) {
650
380
  let fullPath;
651
381
  if (refConfigPath.startsWith('.')) {
@@ -732,21 +462,13 @@ class ConfigService {
732
462
  };
733
463
  return await processValue(object);
734
464
  }
735
- async processImageReference(refConfigPath, context) {
465
+ async processImageReference(refConfigPath) {
736
466
  const SUPPORTED_IMAGE_FORMATS = ['.jpg', '.jpeg', '.png', '.svg'];
737
467
  // Check if the reference is an image file
738
468
  const ext = path.extname(refConfigPath).toLowerCase();
739
469
  if (!SUPPORTED_IMAGE_FORMATS.includes(ext)) {
740
470
  return null;
741
471
  }
742
- const override = await this.configurationOverrideProvider?.resolve(refConfigPath, context);
743
- if (override?.whole?.contentType) {
744
- return {
745
- data: override.whole.value,
746
- mimeType: override.whole.contentType,
747
- hash: createHash('sha256').update(override.whole.value).digest('hex'),
748
- };
749
- }
750
472
  let standardStore;
751
473
  for (const store of this.configStores) {
752
474
  if (store instanceof ConfigFileStore) {
@@ -798,31 +520,19 @@ class ConfigService {
798
520
  return 'application/octet-stream';
799
521
  }
800
522
  }
801
- // Resolves the whole-object override and any sub-path overrides for
802
- // configPath together, in one provider round trip, instead of fetching
803
- // them separately at different points of the processing pipeline. The
804
- // sub-path overrides are handed back alongside the config so callers can
805
- // thread them into processConfig rather than re-resolving them later.
806
- async getConfigFromStore(configPath, context) {
807
- const override = await this.configurationOverrideProvider?.resolve(configPath, context);
808
- const subPathOverrides = override?.subPaths ?? null;
809
- if (override?.whole && !override.whole.contentType) {
810
- return { config: load(override.whole.value), subPathOverrides };
811
- }
523
+ async getConfigFromStore(path) {
812
524
  const exceptions = [];
813
525
  for (const [index, configStore] of this.configStores.entries()) {
814
526
  try {
815
- const config = await configStore.getConfig(configPath);
816
- return { config, subPathOverrides };
527
+ return await configStore.getConfig(path);
817
528
  }
818
529
  catch (e) {
819
530
  exceptions.push(e);
820
531
  if (index == this.configStores.length - 1) {
821
- throw new GraphQLError(`Config not found in path in any store: ${configPath}`, { originalError: exceptions });
532
+ throw new GraphQLError(`Config not found in path in any store: ${path}`, { originalError: exceptions });
822
533
  }
823
534
  }
824
535
  }
825
- return { config: undefined, subPathOverrides };
826
536
  }
827
537
  async hasConfig(configPath) {
828
538
  return (await Promise.all(this.configStores.map((configStore) => configStore.hasConfig(configPath)))).some(Boolean);
@@ -832,9 +542,9 @@ class ConfigService {
832
542
  return this.getDirectConfig(globalPath, context, values, processProviders);
833
543
  }
834
544
  async getDirectConfig(configPath, context, values, processProviders) {
835
- const { config: obj, subPathOverrides } = await this.getConfigFromStore(configPath, context);
545
+ const obj = await this.getConfigFromStore(configPath);
836
546
  const fullObj = await this.processObject(configPath, obj, context, values);
837
- const processedObj = await this.processConfig(fullObj, context, processProviders, subPathOverrides);
547
+ const processedObj = await this.processConfig(fullObj, context, processProviders);
838
548
  return processedObj;
839
549
  }
840
550
  async listDirectConfigs(configPath) {
@@ -1185,22 +895,21 @@ class ConfigService {
1185
895
  }
1186
896
  async getPageConfig(pagePath, context, processConfig, rulesContext) {
1187
897
  const globalPath = path.join('global', 'pages', pagePath);
1188
- const { config: obj, subPathOverrides } = await this.getConfigFromStore(globalPath, context);
898
+ const obj = await this.getConfigFromStore(globalPath);
1189
899
  const fullObj = await this.processObject(globalPath, obj, context, null);
1190
900
  const matchingRuleGroups = await this.getRuleGroups(rulesContext, context);
1191
901
  const configToProcess = this.applyFieldRuleOverrides(fullObj, matchingRuleGroups);
1192
- return await this.processConfig(configToProcess, context, processConfig, subPathOverrides);
902
+ return await this.processConfig(configToProcess, context, processConfig);
1193
903
  }
1194
904
  async init() {
1195
905
  return Promise.all(this.configStores.map((configStore) => configStore.init()));
1196
906
  }
1197
907
  }
1198
- export const defaultConfigService = ({ model, configStores, configInjectorResolvers, providers, resolvers, configurationOverrideProvider, }) => {
908
+ export const defaultConfigService = ({ model, configStores, configInjectorResolvers, providers, resolvers, }) => {
1199
909
  const extensionOptions = {
1200
910
  configInjectorResolvers,
1201
911
  providers,
1202
912
  resolvers,
1203
- configurationOverrideProvider,
1204
913
  };
1205
914
  return new ConfigService(model, configStores.map((configStore) => new ConfigFileStore(configStore)), extensionOptions);
1206
915
  };