@adminide-stack/core 3.1.2-alpha.13 → 3.1.2-alpha.136
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/lib/constants/configuration.d.ts +2 -1
- package/lib/constants/configuration.js +3 -2
- package/lib/constants/configuration.js.map +1 -1
- package/lib/core/configurations/configuration.d.ts +31 -15
- package/lib/core/configurations/configuration.js +279 -47
- package/lib/core/configurations/configuration.js.map +1 -1
- package/lib/core/configurations/configuration.test.d.ts +1 -0
- package/lib/core/configurations/configuration.test.js +20 -0
- package/lib/core/configurations/configuration.test.js.map +1 -0
- package/lib/core/configurations/events/AbstractConfigurationChangEvent.d.ts +0 -0
- package/lib/core/configurations/events/AbstractConfigurationChangEvent.js +25 -0
- package/lib/core/configurations/events/AbstractConfigurationChangEvent.js.map +1 -0
- package/lib/core/configurations/events/AllKeysConfigurationChangeEvent.d.ts +0 -0
- package/lib/core/configurations/events/AllKeysConfigurationChangeEvent.js +27 -0
- package/lib/core/configurations/events/AllKeysConfigurationChangeEvent.js.map +1 -0
- package/lib/core/configurations/events/ConfigurationChangeEvent.d.ts +21 -0
- package/lib/core/configurations/events/ConfigurationChangeEvent.js +59 -0
- package/lib/core/configurations/events/ConfigurationChangeEvent.js.map +1 -0
- package/lib/core/configurations/events/OrganizationConfigurationChangeEvent.d.ts +0 -0
- package/lib/core/configurations/events/OrganizationConfigurationChangeEvent.js +37 -0
- package/lib/core/configurations/events/OrganizationConfigurationChangeEvent.js.map +1 -0
- package/lib/core/configurations/events/index.d.ts +1 -4
- package/lib/core/configurations/events/index.js +4 -4
- package/lib/core/configurations/events/index.js.map +1 -1
- package/lib/core/configurations/helpers/configuration.d.ts +2 -8
- package/lib/core/configurations/helpers/configuration.js +23 -40
- package/lib/core/configurations/helpers/configuration.js.map +1 -1
- package/lib/core/configurations/models/{configuration-model.d.ts → ConfigurationModel.d.ts} +11 -4
- package/lib/core/configurations/models/{configuration-model.js → ConfigurationModel.js} +89 -29
- package/lib/core/configurations/models/ConfigurationModel.js.map +1 -0
- package/lib/core/configurations/models/ConfigurationModel.test.d.ts +1 -0
- package/lib/core/configurations/models/ConfigurationModel.test.js +172 -0
- package/lib/core/configurations/models/ConfigurationModel.test.js.map +1 -0
- package/lib/core/configurations/models/index.d.ts +1 -1
- package/lib/core/configurations/models/index.js +1 -1
- package/lib/core/configurations/models/index.js.map +1 -1
- package/lib/core/organization/configuration.d.ts +4 -19
- package/lib/core/organization/configuration.js +2 -68
- package/lib/core/organization/configuration.js.map +1 -1
- package/lib/enums/integrations.d.ts +2 -1
- package/lib/enums/integrations.js +1 -0
- package/lib/enums/integrations.js.map +1 -1
- package/lib/errors/auth-error-messages.js +1 -1
- package/lib/interfaces/configuration/configuration.d.ts +89 -1
- package/lib/interfaces/configuration/configuration.js +8 -0
- package/lib/interfaces/configuration/configuration.js.map +1 -1
- package/lib/interfaces/configuration/configurationRegistry.d.ts +144 -0
- package/lib/interfaces/configuration/configurationRegistry.js +3 -0
- package/lib/interfaces/configuration/configurationRegistry.js.map +1 -0
- package/lib/interfaces/configuration/configuraton-service.d.ts +7 -11
- package/lib/interfaces/configuration/event.d.ts +7 -10
- package/lib/interfaces/configuration/index.d.ts +1 -0
- package/lib/interfaces/configuration/index.js +1 -0
- package/lib/interfaces/configuration/index.js.map +1 -1
- package/lib/interfaces/generated/generated-models.d.ts +708 -430
- package/lib/interfaces/generated/generated-models.js +121 -124
- package/lib/interfaces/generated/generated-models.js.map +1 -1
- package/lib/interfaces/workbench-exports.d.ts +0 -4
- package/lib/interfaces/workbench-exports.js +3 -0
- package/lib/interfaces/workbench-exports.js.map +1 -1
- package/lib/modules/account-api/enums/index.d.ts +22 -11
- package/lib/modules/account-api/enums/index.js +26 -11
- package/lib/modules/account-api/enums/index.js.map +1 -1
- package/lib/services/abstract-configuration.d.ts +12 -12
- package/lib/services/abstract-configuration.js +59 -6
- package/lib/services/abstract-configuration.js.map +1 -1
- package/lib/services/abstract-organization-context-service.js +5 -5
- package/lib/services/abstract-organization-context-service.js.map +1 -1
- package/package.json +5 -2
- package/lib/core/configurations/events/abstract-configuration-change-event.d.ts +0 -6
- package/lib/core/configurations/events/abstract-configuration-change-event.js +0 -27
- package/lib/core/configurations/events/abstract-configuration-change-event.js.map +0 -1
- package/lib/core/configurations/events/all-keys-configuration-change-event.d.ts +0 -17
- package/lib/core/configurations/events/all-keys-configuration-change-event.js +0 -33
- package/lib/core/configurations/events/all-keys-configuration-change-event.js.map +0 -1
- package/lib/core/configurations/events/configuration-change-event.d.ts +0 -24
- package/lib/core/configurations/events/configuration-change-event.js +0 -84
- package/lib/core/configurations/events/configuration-change-event.js.map +0 -1
- package/lib/core/configurations/events/organization-configuration-change-event.d.ts +0 -15
- package/lib/core/configurations/events/organization-configuration-change-event.js +0 -39
- package/lib/core/configurations/events/organization-configuration-change-event.js.map +0 -1
- package/lib/core/configurations/models/configuration-model.js.map +0 -1
@@ -0,0 +1,20 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
require("reflect-metadata");
|
4
|
+
const configuration_1 = require("./configuration");
|
5
|
+
const models_1 = require("./models");
|
6
|
+
// use this tests in the server side
|
7
|
+
// /Users/veeramarni/Documents/development/workspace/projects/IDEx/adminIde-stack/packages/adminide-platform/server/src/core/configuration/models/Configuration.test.ts
|
8
|
+
describe('Configuration ', () => {
|
9
|
+
test('Test inspect for overrideIdentifiers', () => {
|
10
|
+
const defaultConfigurationModel = new models_1.ConfigurationModel({ '[l1]': { 'a': 1 }, '[l2]': { 'b': 1 } });
|
11
|
+
const userConfigurationModel = new models_1.ConfigurationModel({ '[l3]': { 'a': 2 } });
|
12
|
+
const orgConfigurationModel = new models_1.ConfigurationModel({ '[l1]': { 'a': 3 }, '[l4]': { 'a': 3 } });
|
13
|
+
const testObject = new configuration_1.Configuration(defaultConfigurationModel, new models_1.ConfigurationModel(), userConfigurationModel, orgConfigurationModel);
|
14
|
+
console.log('---JSON---', JSON.stringify((testObject)));
|
15
|
+
const { overrideIdentifiers } = testObject.inspect('a', {}, undefined);
|
16
|
+
console.log('---overrider', overrideIdentifiers);
|
17
|
+
//assert.deepStrictEqual(overrideIdentifiers, ['l1', 'l3', 'l4']);
|
18
|
+
});
|
19
|
+
});
|
20
|
+
//# sourceMappingURL=configuration.test.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"configuration.test.js","sourceRoot":"","sources":["../../../src/core/configurations/configuration.test.ts"],"names":[],"mappings":";;AAAA,4BAA0B;AAC1B,mDAAgD;AAChD,qCAA8C;AAE9C,oCAAoC;AACpC,uKAAuK;AACvK,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,IAAI,CAAC,sCAAsC,EAAE,GAAG,EAAE;QAChD,MAAM,yBAAyB,GAAG,IAAI,2BAAkB,CAAC,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,CAAC,EAAC,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,EAAC,CAAC,CAAC;QACnG,MAAM,sBAAsB,GAAG,IAAI,2BAAkB,CAAC,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,EAAC,CAAC,CAAC;QAC7E,MAAM,qBAAqB,GAAG,IAAI,2BAAkB,CAAC,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,EAAC,CAAC,CAAC;QAChG,MAAM,UAAU,GAAkB,IAAI,6BAAa,CAAC,yBAAyB,EAAE,IAAI,2BAAkB,EAAE,EAAE,sBAAsB,EAAE,qBAAqB,CAAC,CAAC;QAGxJ,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAA;QACvD,MAAM,EAAE,mBAAmB,EAAE,GAAG,UAAU,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,EAAE,SAAS,CAAC,CAAC;QACvE,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,mBAAmB,CAAC,CAAA;QAChD,kEAAkE;IACpE,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAC"}
|
File without changes
|
@@ -0,0 +1,25 @@
|
|
1
|
+
// import { URI } from '@vscode-alt/monaco-editor/esm/vs/base/common/uri';
|
2
|
+
// import { ConfigurationModel } from '../models/ConfigurationModel';
|
3
|
+
// import { toValuesTree } from '../helpers';
|
4
|
+
// //src/vs/platform/configuration/common/configurationModels.ts
|
5
|
+
// export class AbstractConfigurationChangEvent {
|
6
|
+
// protected doesConfigurationContains(configuration: ConfigurationModel, config: string): boolean {
|
7
|
+
// let changedKeysTree = configuration.contents;
|
8
|
+
// let requestedTree = toValuesTree({ [config]: true }, () => { });
|
9
|
+
// let key;
|
10
|
+
// while (typeof requestedTree === 'object' && (key = Object.keys(requestedTree)[0])) { // Only one key should present, since we added only one property
|
11
|
+
// changedKeysTree = changedKeysTree[key];
|
12
|
+
// if (!changedKeysTree) {
|
13
|
+
// return false; // Requested tree is not found
|
14
|
+
// }
|
15
|
+
// requestedTree = requestedTree[key];
|
16
|
+
// }
|
17
|
+
// return true;
|
18
|
+
// }
|
19
|
+
// protected updateKeys(configuration: ConfigurationModel, keys: string[], resource?: URI): void {
|
20
|
+
// for (const key of keys) {
|
21
|
+
// configuration.setValue(key, {});
|
22
|
+
// }
|
23
|
+
// }
|
24
|
+
// }
|
25
|
+
//# sourceMappingURL=AbstractConfigurationChangEvent.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"AbstractConfigurationChangEvent.js","sourceRoot":"","sources":["../../../../src/core/configurations/events/AbstractConfigurationChangEvent.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,qEAAqE;AACrE,6CAA6C;AAE7C,gEAAgE;AAChE,iDAAiD;AAEjD,wGAAwG;AACxG,wDAAwD;AACxD,2EAA2E;AAE3E,mBAAmB;AACnB,gKAAgK;AAChK,sDAAsD;AACtD,sCAAsC;AACtC,+DAA+D;AAC/D,gBAAgB;AAChB,kDAAkD;AAClD,YAAY;AACZ,uBAAuB;AACvB,QAAQ;AAER,sGAAsG;AACtG,oCAAoC;AACpC,+CAA+C;AAC/C,YAAY;AACZ,QAAQ;AACR,IAAI"}
|
File without changes
|
@@ -0,0 +1,27 @@
|
|
1
|
+
// import { ResourceMap } from '@vscode-alt/monaco-editor/esm/vs/base/common/map';
|
2
|
+
// import { URI } from '@vscode-alt/monaco-editor/esm/vs/base/common/uri';
|
3
|
+
// import { AbstractConfigurationChangEvent } from './AbstractConfigurationChangEvent';
|
4
|
+
// import { IConfigurationChangeEvent, ConfigurationTarget, IConfigurationModel } from '../../../interfaces';
|
5
|
+
// import { ConfigurationModel } from '../models';
|
6
|
+
// import { OrganizationConfiguration as Configuration } from '../../organization';
|
7
|
+
// export class AllKeysConfigurationChangeEvent extends AbstractConfigurationChangEvent implements IConfigurationChangeEvent {
|
8
|
+
// private _changedConfiguration: ConfigurationModel | null = null;
|
9
|
+
// constructor(private _configuration: Configuration, readonly source: ConfigurationTarget, readonly sourceConfig: any) { super(); }
|
10
|
+
// get changedConfiguration(): ConfigurationModel {
|
11
|
+
// if (!this._changedConfiguration) {
|
12
|
+
// this._changedConfiguration = new ConfigurationModel();
|
13
|
+
// this.updateKeys(this._changedConfiguration, this.affectedKeys);
|
14
|
+
// }
|
15
|
+
// return this._changedConfiguration;
|
16
|
+
// }
|
17
|
+
// get changedConfigurationByResource(): ResourceMap<IConfigurationModel> {
|
18
|
+
// return new ResourceMap();
|
19
|
+
// }
|
20
|
+
// get affectedKeys(): string[] {
|
21
|
+
// return this._configuration.allKeys();
|
22
|
+
// }
|
23
|
+
// affectsConfiguration(config: string, resource?: URI): boolean {
|
24
|
+
// return this.doesConfigurationContains(this.changedConfiguration, config);
|
25
|
+
// }
|
26
|
+
// }
|
27
|
+
//# sourceMappingURL=AllKeysConfigurationChangeEvent.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"AllKeysConfigurationChangeEvent.js","sourceRoot":"","sources":["../../../../src/core/configurations/events/AllKeysConfigurationChangeEvent.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,0EAA0E;AAC1E,uFAAuF;AACvF,6GAA6G;AAC7G,kDAAkD;AAClD,mFAAmF;AAGnF,8HAA8H;AAE9H,uEAAuE;AAEvE,wIAAwI;AAExI,uDAAuD;AACvD,6CAA6C;AAC7C,qEAAqE;AACrE,8EAA8E;AAC9E,YAAY;AACZ,6CAA6C;AAC7C,QAAQ;AAER,+EAA+E;AAC/E,oCAAoC;AACpC,QAAQ;AAER,qCAAqC;AACrC,gDAAgD;AAChD,QAAQ;AAER,sEAAsE;AACtE,oFAAoF;AACpF,QAAQ;AACR,IAAI"}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { IConfigurationChange, IConfigurationChangeEvent, IConfigurationData, IConfigurationOverrides, IOrganizationContext } from '../../../interfaces';
|
2
|
+
import { ConfigurationTarget } from '../../../interfaces';
|
3
|
+
import { Configuration } from '../configuration';
|
4
|
+
export declare class ConfigurationChangeEvent implements IConfigurationChangeEvent {
|
5
|
+
readonly change: IConfigurationChange;
|
6
|
+
private readonly previous;
|
7
|
+
private readonly currentConfiguraiton;
|
8
|
+
private readonly currentOrganization?;
|
9
|
+
private readonly affectedKeysTree;
|
10
|
+
readonly affectedKeys: string[];
|
11
|
+
source: ConfigurationTarget;
|
12
|
+
sourceConfig: any;
|
13
|
+
constructor(change: IConfigurationChange, previous: {
|
14
|
+
organization?: IOrganizationContext;
|
15
|
+
data: IConfigurationData;
|
16
|
+
} | undefined, currentConfiguraiton: Configuration, currentOrganization?: IOrganizationContext);
|
17
|
+
private _previousConfiguration;
|
18
|
+
get previousConfiguration(): Configuration | undefined;
|
19
|
+
affectsConfiguration(section: string, overrides?: IConfigurationOverrides): boolean;
|
20
|
+
private doesAffectedKeysTreeContains;
|
21
|
+
}
|
@@ -0,0 +1,59 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.ConfigurationChangeEvent = void 0;
|
4
|
+
/* tslint:disable */
|
5
|
+
const objects = require("@vscode-alt/monaco-editor/esm/vs/base/common/objects");
|
6
|
+
const interfaces_1 = require("../../../interfaces");
|
7
|
+
const configuration_1 = require("../configuration");
|
8
|
+
const helpers_1 = require("../helpers");
|
9
|
+
const models_1 = require("../models");
|
10
|
+
organization: interfaces_1.IOrganizationContext;
|
11
|
+
// https://github.com/microsoft/vscode/blob/1562a35c863c312eec35c161b9ceac9921afa50e/src/vs/platform/configuration/common/configurationModels.ts
|
12
|
+
class ConfigurationChangeEvent {
|
13
|
+
constructor(change, previous, currentConfiguraiton, currentOrganization) {
|
14
|
+
this.change = change;
|
15
|
+
this.previous = previous;
|
16
|
+
this.currentConfiguraiton = currentConfiguraiton;
|
17
|
+
this.currentOrganization = currentOrganization;
|
18
|
+
this._previousConfiguration = undefined;
|
19
|
+
const keysSet = new Set();
|
20
|
+
change.keys.forEach(key => keysSet.add(key));
|
21
|
+
change.overrides.forEach(([, keys]) => keys.forEach(key => keysSet.add(key)));
|
22
|
+
this.affectedKeys = [...keysSet.values()];
|
23
|
+
const configurationModel = new models_1.ConfigurationModel();
|
24
|
+
this.affectedKeys.forEach(key => configurationModel.setValue(key, {}));
|
25
|
+
this.affectedKeysTree = configurationModel.contents;
|
26
|
+
}
|
27
|
+
get previousConfiguration() {
|
28
|
+
if (!this._previousConfiguration && this.previous) {
|
29
|
+
this._previousConfiguration = configuration_1.Configuration.parse(this.previous.data);
|
30
|
+
}
|
31
|
+
return this._previousConfiguration;
|
32
|
+
}
|
33
|
+
affectsConfiguration(section, overrides) {
|
34
|
+
var _a;
|
35
|
+
if (this.doesAffectedKeysTreeContains(this.affectedKeysTree, section)) {
|
36
|
+
if (overrides) {
|
37
|
+
const value1 = this.previousConfiguration ? this.previousConfiguration.getValue(section, overrides, (_a = this.previous) === null || _a === void 0 ? void 0 : _a.organization) : undefined;
|
38
|
+
const value2 = this.currentConfiguraiton.getValue(section, overrides, this.currentOrganization);
|
39
|
+
return !objects.equals(value1, value2);
|
40
|
+
}
|
41
|
+
return true;
|
42
|
+
}
|
43
|
+
return false;
|
44
|
+
}
|
45
|
+
doesAffectedKeysTreeContains(affectedKeysTree, section) {
|
46
|
+
let requestedTree = (0, helpers_1.toValuesTree)({ [section]: true }, () => { });
|
47
|
+
let key;
|
48
|
+
while (typeof requestedTree === 'object' && (key = Object.keys(requestedTree)[0])) { // Only one key should present, since we added only one property
|
49
|
+
affectedKeysTree = affectedKeysTree[key];
|
50
|
+
if (!affectedKeysTree) {
|
51
|
+
return false; // Requested tree is not found
|
52
|
+
}
|
53
|
+
requestedTree = requestedTree[key];
|
54
|
+
}
|
55
|
+
return true;
|
56
|
+
}
|
57
|
+
}
|
58
|
+
exports.ConfigurationChangeEvent = ConfigurationChangeEvent;
|
59
|
+
//# sourceMappingURL=ConfigurationChangeEvent.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ConfigurationChangeEvent.js","sourceRoot":"","sources":["../../../../src/core/configurations/events/ConfigurationChangeEvent.ts"],"names":[],"mappings":";;;AAAA,oBAAoB;AACpB,gFAAgF;AAChF,oDAAyJ;AAEzJ,oDAAiD;AACjD,wCAA0C;AAC1C,sCAA+C;AAE/C,YAAY,EAAE,iCAAoB,CAAA;AAClC,gJAAgJ;AAChJ,MAAa,wBAAwB;IAOpC,YAAqB,MAA4B,EAAmB,QAAuF,EAAmB,oBAAmC,EAAmB,mBAA0C;QAAzP,WAAM,GAAN,MAAM,CAAsB;QAAmB,aAAQ,GAAR,QAAQ,CAA+E;QAAmB,yBAAoB,GAApB,oBAAoB,CAAe;QAAmB,wBAAmB,GAAnB,mBAAmB,CAAuB;QAWtQ,2BAAsB,GAA8B,SAAS,CAAC;QAVrE,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;QAClC,MAAM,CAAC,IAAI,C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,GAAG,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;gBAChG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;aACvC;YACD,OAAO,IAAI,CAAC;SACZ;QACD,OAAO,KAAK,CAAC;IACd,CAAC;IAEO,4BAA4B,CAAC,gBAAqB,EAAE,OAAe;QAC1E,IAAI,aAAa,GAAG,IAAA,sBAAY,EAAC,EAAE,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;QAEjE,IAAI,GAAG,CAAC;QACR,OAAO,OAAO,aAAa,KAAK,QAAQ,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,gEAAgE;YACpJ,gBAAgB,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC;YACzC,IAAI,CAAC,gBAAgB,EAAE;gBACtB,OAAO,KAAK,CAAC,CAAC,8BAA8B;aAC5C;YACD,aAAa,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;SACnC;QACD,OAAO,IAAI,CAAC;IACb,CAAC;CACD;AAnDD,4DAmDC"}
|
File without changes
|
@@ -0,0 +1,37 @@
|
|
1
|
+
// /* tslint:disable */
|
2
|
+
// import { IConfigurationChangeEvent } from '../../../interfaces';
|
3
|
+
// import { IConfigurationModel, ConfigurationTarget, IOrganizationContext } from '../../../interfaces';
|
4
|
+
// import { URI } from '@vscode-alt/monaco-editor/esm/vs/base/common/uri';
|
5
|
+
// import { ResourceMap } from '@vscode-alt/monaco-editor/esm/vs/base/common/map';
|
6
|
+
// // src/vs/workbench/services/configuration/common/configurationModels.ts
|
7
|
+
// export class OrganizationConfigurationChangeEvent implements IConfigurationChangeEvent {
|
8
|
+
// constructor(private configurationChangeEvent: IConfigurationChangeEvent, private organization: IOrganizationContext | undefined) { }
|
9
|
+
// get changedConfiguration(): IConfigurationModel {
|
10
|
+
// return this.configurationChangeEvent.changedConfiguration;
|
11
|
+
// }
|
12
|
+
// get changedConfigurationByResource(): ResourceMap<IConfigurationModel> {
|
13
|
+
// return this.configurationChangeEvent.changedConfigurationByResource;
|
14
|
+
// }
|
15
|
+
// get affectedKeys(): string[] {
|
16
|
+
// return this.configurationChangeEvent.affectedKeys;
|
17
|
+
// }
|
18
|
+
// get source(): ConfigurationTarget {
|
19
|
+
// return this.configurationChangeEvent.source;
|
20
|
+
// }
|
21
|
+
// get sourceConfig(): any {
|
22
|
+
// return this.configurationChangeEvent.sourceConfig;
|
23
|
+
// }
|
24
|
+
// affectsConfiguration(config: string, resource?: URI): boolean {
|
25
|
+
// if (this.configurationChangeEvent.affectsConfiguration(config, resource)) {
|
26
|
+
// return true;
|
27
|
+
// }
|
28
|
+
// if (resource && this.organization) {
|
29
|
+
// let organizationResource = this.organization.getResource(resource);
|
30
|
+
// if (organizationResource) {
|
31
|
+
// return this.configurationChangeEvent.affectsConfiguration(config, organizationResource.uri);
|
32
|
+
// }
|
33
|
+
// }
|
34
|
+
// return false;
|
35
|
+
// }
|
36
|
+
// }
|
37
|
+
//# sourceMappingURL=OrganizationConfigurationChangeEvent.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"OrganizationConfigurationChangeEvent.js","sourceRoot":"","sources":["../../../../src/core/configurations/events/OrganizationConfigurationChangeEvent.ts"],"names":[],"mappings":"AAAA,uBAAuB;AACvB,mEAAmE;AACnE,yGAAyG;AACzG,0EAA0E;AAC1E,kFAAkF;AAElF,2EAA2E;AAE3E,2FAA2F;AAE3F,wIAAwI;AAExI,qDAAqD;AACrD,+DAA+D;AAC/D,KAAK;AAEL,4EAA4E;AAC5E,yEAAyE;AACzE,KAAK;AAEL,kCAAkC;AAClC,uDAAuD;AACvD,KAAK;AAEL,uCAAuC;AACvC,iDAAiD;AACjD,KAAK;AAEL,6BAA6B;AAC7B,uDAAuD;AACvD,KAAK;AAEL,mEAAmE;AACnE,gFAAgF;AAChF,kBAAkB;AAClB,MAAM;AAEN,yCAAyC;AACzC,yEAAyE;AACzE,iCAAiC;AACjC,mGAAmG;AACnG,OAAO;AACP,MAAM;AAEN,kBAAkB;AAClB,KAAK;AACL,IAAI"}
|
@@ -14,8 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
15
|
};
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
-
|
18
|
-
__exportStar(require("./
|
19
|
-
|
20
|
-
|
17
|
+
// export * from './AbstractConfigurationChangEvent';
|
18
|
+
__exportStar(require("./ConfigurationChangeEvent"), exports);
|
19
|
+
// export * from './OrganizationConfigurationChangeEvent';
|
20
|
+
// export * from './AllKeysConfigurationChangeEvent';
|
21
21
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/configurations/events/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/configurations/events/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAqD;AACrD,6DAA2C;AAC3C,0DAA0D;AAC1D,qDAAqD"}
|
@@ -1,16 +1,10 @@
|
|
1
|
-
import {
|
1
|
+
import { ConfigurationTarget, IConfigurationService, IConfigurationOverrides, ISettingsSubject } from '../../../interfaces';
|
2
2
|
export declare function isConfigurationOverrides(thing: any): thing is IConfigurationOverrides;
|
3
3
|
/**
|
4
4
|
* @SRI modified to match to the union type of graphql type Settings
|
5
5
|
*/
|
6
6
|
export declare function ConfigurationTargetToString(configurationTarget: ConfigurationTarget): ISettingsSubject['__typename'];
|
7
|
-
export declare function SettingsTypeToConfiguraitonTarget(settings: ISettingsSubject['__typename']): ConfigurationTarget;
|
8
|
-
export declare function compare(from: IConfigurationModel, to: IConfigurationModel): {
|
9
|
-
added: string[];
|
10
|
-
removed: string[];
|
11
|
-
updated: string[];
|
12
|
-
};
|
13
|
-
export declare function toOverrides(raw: any, configurationProperties: any, conflictReporter: (message: string) => void): IOverrides[];
|
7
|
+
export declare function SettingsTypeToConfiguraitonTarget(settings: ISettingsSubject['__typename']): ConfigurationTarget.USER | ConfigurationTarget.APPLICATION | ConfigurationTarget.MACHINE | ConfigurationTarget.ORGANIZATION | ConfigurationTarget.ORGANIZATION_RESOURCE | ConfigurationTarget.DEFAULT | ConfigurationTarget.MEMORY;
|
14
8
|
export declare function toValuesTree(properties: {
|
15
9
|
[qualifiedKey: string]: any;
|
16
10
|
}, conflictReporter: (message: string) => void): any;
|
@@ -1,10 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.getMigratedSettingValue = exports.keyFromOverrideIdentifier = exports.overrideIdentifierFromKey = exports.merge = exports.getConfigurationValue = exports.removeFromValueTree = exports.addToValueTree = exports.toValuesTree = exports.
|
3
|
+
exports.getMigratedSettingValue = exports.keyFromOverrideIdentifier = exports.overrideIdentifierFromKey = exports.merge = exports.getConfigurationValue = exports.removeFromValueTree = exports.addToValueTree = exports.toValuesTree = exports.SettingsTypeToConfiguraitonTarget = exports.ConfigurationTargetToString = exports.isConfigurationOverrides = void 0;
|
4
4
|
/* tslint:disable */
|
5
|
-
const objects = require("@vscode-alt/monaco-editor/esm/vs/base/common/objects");
|
6
5
|
const types = require("@vscode-alt/monaco-editor/esm/vs/base/common/types");
|
7
|
-
const constants_1 = require("../../../constants");
|
8
6
|
const uri_1 = require("@vscode-alt/monaco-editor/esm/vs/base/common/uri");
|
9
7
|
// src/vs/platform/configuration/common/configuration.ts
|
10
8
|
function isConfigurationOverrides(thing) {
|
@@ -41,42 +39,27 @@ function SettingsTypeToConfiguraitonTarget(settings) {
|
|
41
39
|
}
|
42
40
|
}
|
43
41
|
exports.SettingsTypeToConfiguraitonTarget = SettingsTypeToConfiguraitonTarget;
|
44
|
-
function compare(from, to) {
|
45
|
-
const added = to.keys.filter(key => from.keys.indexOf(key) === -1);
|
46
|
-
const removed = from.keys.filter(key => to.keys.indexOf(key) === -1);
|
47
|
-
const updated = [];
|
48
|
-
for (const key of from.keys) {
|
49
|
-
const value1 = getConfigurationValue(from.contents, key);
|
50
|
-
const value2 = getConfigurationValue(to.contents, key);
|
51
|
-
if (!objects.equals(value1, value2)) {
|
52
|
-
updated.push(key);
|
53
|
-
}
|
54
|
-
}
|
55
|
-
return { added, removed, updated };
|
56
|
-
}
|
57
|
-
exports.compare = compare;
|
58
42
|
// not using currently but stays here for future reference
|
59
43
|
//@sri modified function to take ConfigurationRegistry as second argument input
|
60
|
-
function toOverrides(raw, configurationProperties, conflictReporter) {
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
}
|
79
|
-
exports.toOverrides = toOverrides;
|
44
|
+
// export function toOverrides(raw: any, configurationProperties, conflictReporter: (message: string) => void): IOverrides[] {
|
45
|
+
// const overrides: IOverrides[] = [];
|
46
|
+
// // const configurationProperties = Registry.Instance.as<IConfigurationRegistry>(Extensions.Configuration).getConfigurationProperties();
|
47
|
+
// for (const key of Object.keys(raw)) {
|
48
|
+
// if (OVERRIDE_PROPERTY_PATTERN.test(key)) {
|
49
|
+
// const overrideRaw = {};
|
50
|
+
// for (const keyInOverrideRaw in raw[key]) {
|
51
|
+
// if (configurationProperties[keyInOverrideRaw] && configurationProperties[keyInOverrideRaw].overridable) {
|
52
|
+
// overrideRaw[keyInOverrideRaw] = raw[key][keyInOverrideRaw];
|
53
|
+
// }
|
54
|
+
// }
|
55
|
+
// overrides.push({
|
56
|
+
// identifiers: [overrideIdentifierFromKey(key).trim()],
|
57
|
+
// contents: toValuesTree(overrideRaw, conflictReporter)
|
58
|
+
// });
|
59
|
+
// }
|
60
|
+
// }
|
61
|
+
// return overrides;
|
62
|
+
// }
|
80
63
|
function toValuesTree(properties, conflictReporter) {
|
81
64
|
const root = Object.create(null);
|
82
65
|
for (let key in properties) {
|
@@ -189,14 +172,14 @@ exports.keyFromOverrideIdentifier = keyFromOverrideIdentifier;
|
|
189
172
|
function getMigratedSettingValue(configurationService, currentSettingName, legacySettingName) {
|
190
173
|
const setting = configurationService.inspect(currentSettingName);
|
191
174
|
const legacySetting = configurationService.inspect(legacySettingName);
|
192
|
-
if (typeof setting.
|
175
|
+
if (typeof setting.userValue !== 'undefined' || typeof setting.organizationValue !== 'undefined' || typeof setting.organizationResourceValue !== 'undefined') {
|
193
176
|
return setting.value;
|
194
177
|
}
|
195
|
-
else if (typeof legacySetting.
|
178
|
+
else if (typeof legacySetting.userValue !== 'undefined' || typeof legacySetting.organizationValue !== 'undefined' || typeof legacySetting.organizationResourceValue !== 'undefined') {
|
196
179
|
return legacySetting.value;
|
197
180
|
}
|
198
181
|
else {
|
199
|
-
return setting.
|
182
|
+
return setting.defaultValue;
|
200
183
|
}
|
201
184
|
}
|
202
185
|
exports.getMigratedSettingValue = getMigratedSettingValue;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../../../src/core/configurations/helpers/configuration.ts"],"names":[],"mappings":";;;AAAA,oBAAoB;AACpB,
|
1
|
+
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../../../src/core/configurations/helpers/configuration.ts"],"names":[],"mappings":";;;AAAA,oBAAoB;AACpB,4EAA4E;AAE5E,0EAAuE;AACvE,wDAAwD;AAGxD,SAAgB,wBAAwB,CAAC,KAAU;IAC/C,OAAO,KAAK;WACL,OAAO,KAAK,KAAK,QAAQ;WACzB,CAAC,CAAC,KAAK,CA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AG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;aACrB;SACD;aAAM;YACN,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;SACrB;IACF,CAAC,CAAC,CAAC;AACJ,CAAC;AAZD,sBAYC;AAED,kDAAkD;AAElD,8CAA8C;AAE9C,SAAgB,yBAAyB,CAAC,GAAW;IACpD,OAAO,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACzC,CAAC;AAFD,8DAEC;AAED,SAAgB,yBAAyB,CAAC,kBAA0B;IACnE,OAAO,IAAI,kBAAkB,GAAG,CAAC;AAClC,CAAC;AAFD,8DAEC;AAGD,SAAgB,uBAAuB,CAAI,oBAA2C,EAAE,kBAA0B,EAAE,iBAAyB;IAC5I,MAAM,OAAO,GAAG,oBAAoB,CAAC,OAAO,CAAI,kBAAkB,CAAC,CAAC;IACpE,MAAM,aAAa,GAAG,oBAAoB,CAAC,OAAO,CAAI,iBAAiB,CAAC,CAAC;IAEzE,IAAI,OAAO,OAAO,CAAC,SAAS,KAAK,WAAW,IAAI,OAAO,OAAO,CAAC,iBAAiB,KAAK,WAAW,IAAI,OAAO,OAAO,CAAC,yBAAyB,KAAK,WAAW,EAAE;QAC7J,OAAO,OAAO,CAAC,KAAM,CAAC;KACtB;SAAM,IAAI,OAAO,aAAa,CAAC,SAAS,KAAK,WAAW,IAAI,OAAO,aAAa,CAAC,iBAAiB,KAAK,WAAW,IAAI,OAAO,aAAa,CAAC,yBAAyB,KAAK,WAAW,EAAE;QACtL,OAAO,aAAa,CAAC,KAAM,CAAC;KAC5B;SAAM;QACN,OAAO,OAAO,CAAC,YAAa,CAAC;KAC7B;AACF,CAAC;AAXD,0DAWC"}
|
@@ -1,18 +1,25 @@
|
|
1
1
|
import { IOverrides, IIConfigurationModel as IConfigurationModel } from '../../../interfaces';
|
2
2
|
export declare class ConfigurationModel implements IConfigurationModel {
|
3
|
-
private _contents;
|
4
|
-
private _keys;
|
5
|
-
private _overrides;
|
6
|
-
private
|
3
|
+
private readonly _contents;
|
4
|
+
private readonly _keys;
|
5
|
+
private readonly _overrides;
|
6
|
+
private frozen;
|
7
|
+
private readonly overrideConfigurations;
|
7
8
|
constructor(_contents?: any, _keys?: string[], _overrides?: IOverrides[]);
|
8
9
|
get contents(): any;
|
9
10
|
get overrides(): IOverrides[];
|
10
11
|
get keys(): string[];
|
11
12
|
isEmpty(): boolean;
|
13
|
+
isFrozen(): boolean;
|
12
14
|
getValue<V>(section: string | undefined): V;
|
15
|
+
getOverrideValue<V>(section: string | undefined, overrideIdentifier: string): V | undefined;
|
16
|
+
getKeysForOverrideIdentifier(identifier: string): string[];
|
17
|
+
getAllOverrideIdentifiers(): string[];
|
13
18
|
override(identifier: string): ConfigurationModel;
|
14
19
|
merge(...others: ConfigurationModel[]): ConfigurationModel;
|
15
20
|
freeze(): ConfigurationModel;
|
21
|
+
clone(): ConfigurationModel;
|
22
|
+
private createOverrideConfigurationModel;
|
16
23
|
private mergeContents;
|
17
24
|
private checkAndFreeze;
|
18
25
|
private getContentsForOverrideIdentifer;
|
@@ -5,12 +5,14 @@ const objects = require("@vscode-alt/monaco-editor/esm/vs/base/common/objects");
|
|
5
5
|
const arrays = require("@vscode-alt/monaco-editor/esm/vs/base/common/arrays");
|
6
6
|
const types = require("@vscode-alt/monaco-editor/esm/vs/base/common/types");
|
7
7
|
const configuration_1 = require("../helpers/configuration");
|
8
|
+
// https://github.com/microsoft/vscode/blob/1562a35c863c312eec35c161b9ceac9921afa50e/src/vs/platform/configuration/common/configurationModels.ts
|
8
9
|
class ConfigurationModel {
|
9
10
|
constructor(_contents = {}, _keys = [], _overrides = []) {
|
10
11
|
this._contents = _contents;
|
11
12
|
this._keys = _keys;
|
12
13
|
this._overrides = _overrides;
|
13
|
-
this.
|
14
|
+
this.frozen = false;
|
15
|
+
this.overrideConfigurations = new Map();
|
14
16
|
}
|
15
17
|
get contents() {
|
16
18
|
return this.checkAndFreeze(this._contents);
|
@@ -24,44 +26,57 @@ class ConfigurationModel {
|
|
24
26
|
isEmpty() {
|
25
27
|
return this._keys.length === 0 && Object.keys(this._contents).length === 0 && this._overrides.length === 0;
|
26
28
|
}
|
29
|
+
isFrozen() {
|
30
|
+
return this.frozen;
|
31
|
+
}
|
27
32
|
getValue(section) {
|
28
33
|
return section ? (0, configuration_1.getConfigurationValue)(this.contents, section) : this.contents;
|
29
34
|
}
|
30
|
-
|
31
|
-
const overrideContents = this.getContentsForOverrideIdentifer(
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
if (overrideContentsForKey) {
|
42
|
-
// Clone and merge only if base contents and override contents are of type object otherwise just override
|
43
|
-
if (typeof contentsForKey === 'object' && typeof overrideContentsForKey === 'object') {
|
44
|
-
contentsForKey = objects.deepClone(contentsForKey);
|
45
|
-
this.mergeContents(contentsForKey, overrideContentsForKey);
|
46
|
-
}
|
47
|
-
else {
|
48
|
-
contentsForKey = overrideContentsForKey;
|
49
|
-
}
|
35
|
+
getOverrideValue(section, overrideIdentifier) {
|
36
|
+
const overrideContents = this.getContentsForOverrideIdentifer(overrideIdentifier);
|
37
|
+
return overrideContents
|
38
|
+
? section ? (0, configuration_1.getConfigurationValue)(overrideContents, section) : overrideContents
|
39
|
+
: undefined;
|
40
|
+
}
|
41
|
+
getKeysForOverrideIdentifier(identifier) {
|
42
|
+
const keys = [];
|
43
|
+
for (const override of this.overrides) {
|
44
|
+
if (override.identifiers.includes(identifier)) {
|
45
|
+
keys.push(...override.keys);
|
50
46
|
}
|
51
|
-
contents[key] = contentsForKey;
|
52
47
|
}
|
53
|
-
return
|
48
|
+
return arrays.distinct(keys);
|
49
|
+
}
|
50
|
+
getAllOverrideIdentifiers() {
|
51
|
+
const result = [];
|
52
|
+
for (const override of this.overrides) {
|
53
|
+
result.push(...override.identifiers);
|
54
|
+
}
|
55
|
+
return arrays.distinct(result);
|
56
|
+
}
|
57
|
+
override(identifier) {
|
58
|
+
let overrideConfigurationModel = this.overrideConfigurations.get(identifier);
|
59
|
+
if (!overrideConfigurationModel) {
|
60
|
+
overrideConfigurationModel = this.createOverrideConfigurationModel(identifier);
|
61
|
+
this.overrideConfigurations.set(identifier, overrideConfigurationModel);
|
62
|
+
}
|
63
|
+
return overrideConfigurationModel;
|
54
64
|
}
|
55
65
|
merge(...others) {
|
56
66
|
const contents = objects.deepClone(this.contents);
|
57
67
|
const overrides = objects.deepClone(this.overrides);
|
58
68
|
const keys = [...this.keys];
|
59
69
|
for (const other of others) {
|
70
|
+
if (other.isEmpty()) {
|
71
|
+
continue;
|
72
|
+
}
|
60
73
|
this.mergeContents(contents, other.contents);
|
61
74
|
for (const otherOverride of other.overrides) {
|
62
75
|
const [override] = overrides.filter(o => arrays.equals(o.identifiers, otherOverride.identifiers));
|
63
76
|
if (override) {
|
64
77
|
this.mergeContents(override.contents, otherOverride.contents);
|
78
|
+
override.keys.push(...otherOverride.keys);
|
79
|
+
override.keys = arrays.distinct(override.keys);
|
65
80
|
}
|
66
81
|
else {
|
67
82
|
overrides.push(objects.deepClone(otherOverride));
|
@@ -76,9 +91,37 @@ class ConfigurationModel {
|
|
76
91
|
return new ConfigurationModel(contents, keys, overrides);
|
77
92
|
}
|
78
93
|
freeze() {
|
79
|
-
this.
|
94
|
+
this.frozen = true;
|
80
95
|
return this;
|
81
96
|
}
|
97
|
+
clone() {
|
98
|
+
return new ConfigurationModel(objects.deepClone(this.contents), [...this.keys], objects.deepClone(this.overrides));
|
99
|
+
}
|
100
|
+
createOverrideConfigurationModel(identifier) {
|
101
|
+
const overrideContents = this.getContentsForOverrideIdentifer(identifier);
|
102
|
+
if (!overrideContents || typeof overrideContents !== 'object' || !Object.keys(overrideContents).length) {
|
103
|
+
// If there are no valid overrides, return self
|
104
|
+
return this;
|
105
|
+
}
|
106
|
+
const contents = {};
|
107
|
+
for (const key of arrays.distinct([...Object.keys(this.contents), ...Object.keys(overrideContents)])) {
|
108
|
+
let contentsForKey = this.contents[key];
|
109
|
+
const overrideContentsForKey = overrideContents[key];
|
110
|
+
// If there are override contents for the key, clone and merge otherwise use base contents
|
111
|
+
if (overrideContentsForKey) {
|
112
|
+
// Clone and merge only if base contents and override contents are of type object otherwise just override
|
113
|
+
if (typeof contentsForKey === 'object' && typeof overrideContentsForKey === 'object') {
|
114
|
+
contentsForKey = objects.deepClone(contentsForKey);
|
115
|
+
this.mergeContents(contentsForKey, overrideContentsForKey);
|
116
|
+
}
|
117
|
+
else {
|
118
|
+
contentsForKey = overrideContentsForKey;
|
119
|
+
}
|
120
|
+
}
|
121
|
+
contents[key] = contentsForKey;
|
122
|
+
}
|
123
|
+
return new ConfigurationModel(contents, this.keys, this.overrides);
|
124
|
+
}
|
82
125
|
mergeContents(source, target) {
|
83
126
|
for (const key of Object.keys(target)) {
|
84
127
|
if (key in source) {
|
@@ -91,18 +134,35 @@ class ConfigurationModel {
|
|
91
134
|
}
|
92
135
|
}
|
93
136
|
checkAndFreeze(data) {
|
94
|
-
if (this.
|
137
|
+
if (this.frozen && !Object.isFrozen(data)) {
|
95
138
|
return objects.deepFreeze(data);
|
96
139
|
}
|
97
140
|
return data;
|
98
141
|
}
|
99
142
|
getContentsForOverrideIdentifer(identifier) {
|
143
|
+
let contentsForIdentifierOnly = null;
|
144
|
+
let contents = null;
|
145
|
+
const mergeContents = (contentsToMerge) => {
|
146
|
+
if (contentsToMerge) {
|
147
|
+
if (contents) {
|
148
|
+
this.mergeContents(contents, contentsToMerge);
|
149
|
+
}
|
150
|
+
else {
|
151
|
+
contents = objects.deepClone(contentsToMerge);
|
152
|
+
}
|
153
|
+
}
|
154
|
+
};
|
100
155
|
for (const override of this.overrides) {
|
101
|
-
if (override.identifiers
|
102
|
-
|
156
|
+
if (arrays.equals(override.identifiers, [identifier])) {
|
157
|
+
contentsForIdentifierOnly = override.contents;
|
158
|
+
}
|
159
|
+
else if (override.identifiers.includes(identifier)) {
|
160
|
+
mergeContents(override.contents);
|
103
161
|
}
|
104
162
|
}
|
105
|
-
|
163
|
+
// Merge contents of the identifier only at the end to take precedence.
|
164
|
+
mergeContents(contentsForIdentifierOnly);
|
165
|
+
return contents;
|
106
166
|
}
|
107
167
|
toJSON() {
|
108
168
|
return {
|
@@ -140,4 +200,4 @@ class ConfigurationModel {
|
|
140
200
|
}
|
141
201
|
}
|
142
202
|
exports.ConfigurationModel = ConfigurationModel;
|
143
|
-
//# sourceMappingURL=
|
203
|
+
//# sourceMappingURL=ConfigurationModel.js.map
|