@rxap/config 16.0.0-dev.2 → 16.0.0-dev.4

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.
@@ -5,6 +5,7 @@ export interface ConfigLoadOptions {
5
5
  fromUrlParam?: string | boolean;
6
6
  fromLocalStorage?: boolean;
7
7
  schema?: AnySchema;
8
+ url?: string | string[];
8
9
  }
9
10
  export declare class ConfigService<Config extends Record<string, any> = Record<string, any>> {
10
11
  static Config: any;
@@ -20,10 +21,12 @@ export declare class ConfigService<Config extends Record<string, any> = Record<s
20
21
  */
21
22
  static Overwrites: any;
22
23
  static LocalStorageKey: string;
24
+ /**
25
+ * @deprecated instead use the url property of the ConfigLoadOptions
26
+ */
23
27
  static Urls: string[];
24
- private static loadConfig;
25
- private static showError;
26
- static SideLoad(url: string, propertyPath: string, required?: boolean, schema?: AnySchema): Promise<void>;
28
+ readonly config: Config;
29
+ constructor(config?: any | null);
27
30
  /**
28
31
  * Used to load the app config from a remote resource.
29
32
  *
@@ -33,10 +36,11 @@ export declare class ConfigService<Config extends Record<string, any> = Record<s
33
36
  *
34
37
  */
35
38
  static Load(options?: ConfigLoadOptions): Promise<void>;
39
+ private static loadConfig;
36
40
  private static LoadConfigDefaultFromUrlParam;
41
+ static SideLoad(url: string, propertyPath: string, required?: boolean, schema?: AnySchema): Promise<void>;
37
42
  static Get<T = any, K extends Record<string, any> = Record<string, any>>(path: string, defaultValue: T | undefined, config: Record<string, any>): T;
38
- readonly config: Config;
39
- constructor(config?: any | null);
43
+ private static showError;
40
44
  setLocalConfig(config: Config): void;
41
45
  clearLocalConfig(): void;
42
46
  get<T = any>(propertyPath: string): T | undefined;
package/package.json CHANGED
@@ -1,52 +1,50 @@
1
1
  {
2
2
  "name": "@rxap/config",
3
- "version": "16.0.0-dev.2",
4
- "private": false,
5
- "author": "Merzough Münker",
6
- "homepage": "https://gitlab.com/rxap/packages/libs/config",
7
- "repository": "git@gitlab.com:rxap/packages.git",
8
- "license": "MIT",
3
+ "version": "16.0.0-dev.4",
4
+ "dependencies": {
5
+ "joi": "^17.6.3",
6
+ "tslib": "2.5.3"
7
+ },
8
+ "sideEffects": false,
9
+ "peerDependencies": {
10
+ "@angular/common": "^16.1.4",
11
+ "@angular/core": "^16.1.4",
12
+ "@rxap/utilities": "^16.0.0-dev.2",
13
+ "rxjs": "^7.8.0"
14
+ },
15
+ "description": "Simple config file manager for angular applications.",
16
+ "publishConfig": {
17
+ "access": "public",
18
+ "directory": "../../../dist/packages/angular/config"
19
+ },
9
20
  "keywords": [
10
21
  "rxap",
11
- "config",
12
- "angular"
22
+ "angular",
23
+ "ngx"
13
24
  ],
25
+ "homepage": "https:/gitlab.com/rxap/packages/packages/angular/config",
14
26
  "bugs": {
15
27
  "url": "https://gitlab.com/rxap/packages/-/issues",
16
28
  "email": "incoming+rxap-packages-14898188-issue-@incoming.gitlab.com"
17
29
  },
18
- "description": "Simple config file manager for angular applications.",
19
- "peerDependencies": {
20
- "@angular-devkit/schematics": "^15.0.3",
21
- "@angular/common": "^16.0.2",
22
- "@angular/core": "^16.0.2",
23
- "@angular/platform-browser-dynamic": "^16.0.2",
24
- "@rxap/utilities": "^16.0.0-dev.1",
25
- "joi": "^17.6.3",
26
- "reflect-metadata": "^0.1.13",
27
- "rxjs": "^6.6.0"
30
+ "license": "GPL-3.0-or-later",
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "https://gitlab.com/rxap/packages.git",
34
+ "directory": "packages/angular/config"
35
+ },
36
+ "author": {
37
+ "name": "Merzough Münker",
38
+ "email": "mmuenker@digitaix.com"
28
39
  },
29
- "schematics": "./collection.json",
30
- "ng-update": {
31
- "migrations": "./migration.json",
40
+ "nx-migrations": {
32
41
  "packageGroup": [
33
- "@rxap/config",
34
- "@rxap/utilities"
42
+ {
43
+ "package": "@rxap/utilities",
44
+ "version": "16.0.0-dev.2"
45
+ }
35
46
  ]
36
47
  },
37
- "publishConfig": {
38
- "directory": "../../dist/libs/config",
39
- "access": "public"
40
- },
41
- "ng-add": {
42
- "save": "dependencies"
43
- },
44
- "dependencies": {
45
- "@rxap/schematics-ts-morph": "^16.0.0-dev.1",
46
- "@rxap/schematics-utilities": "^16.0.0-dev.1",
47
- "ts-morph": "^13.0.3",
48
- "tslib": "^2.3.1"
49
- },
50
48
  "module": "fesm2022/rxap-config.mjs",
51
49
  "typings": "index.d.ts",
52
50
  "exports": {
@@ -59,6 +57,5 @@
59
57
  "esm": "./esm2022/rxap-config.mjs",
60
58
  "default": "./fesm2022/rxap-config.mjs"
61
59
  }
62
- },
63
- "sideEffects": false
60
+ }
64
61
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2021 Merzough Münker
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
package/collection.json DELETED
@@ -1,15 +0,0 @@
1
- {
2
- "schematics": {
3
- "ng-add": {
4
- "description": "Setup the package @rxap/config for the workspace.",
5
- "factory": "./src/schematics/ng-add/index",
6
- "schema": "./src/schematics/ng-add/schema.json"
7
- },
8
- "side-load": {
9
- "description": "Add a side load config to the project main file.",
10
- "factory": "./src/schematics/side-load/index",
11
- "schema": "./src/schematics/side-load/schema.json"
12
- }
13
- },
14
- "$schema": "../../node_modules/@angular-devkit/schematics/collection-schema.json"
15
- }
package/migration.json DELETED
@@ -1,4 +0,0 @@
1
- {
2
- "schematics": {},
3
- "$schema": "../../node_modules/@angular-devkit/schematics/collection-schema.json"
4
- }
@@ -1,3 +0,0 @@
1
- import { Rule } from '@angular-devkit/schematics';
2
- import { NgAddSchema } from './schema';
3
- export default function (options: NgAddSchema): Rule;
@@ -1,59 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const schematics_1 = require("@angular-devkit/schematics");
4
- const schematics_utilities_1 = require("@rxap/schematics-utilities");
5
- const ts_morph_1 = require("ts-morph");
6
- const schematics_ts_morph_1 = require("@rxap/schematics-ts-morph");
7
- const path_1 = require("path");
8
- function default_1(options) {
9
- return (host) => {
10
- const rules = [
11
- (0, schematics_utilities_1.InstallPeerDependencies)()
12
- ];
13
- if (options.project) {
14
- const projectSourceRoot = (0, schematics_utilities_1.GetProjectSourceRoot)(host, options.project);
15
- const project = new ts_morph_1.Project({
16
- useInMemoryFileSystem: true,
17
- manipulationSettings: { quoteKind: ts_morph_1.QuoteKind.Single, indentationText: ts_morph_1.IndentationText.TwoSpaces }
18
- });
19
- (0, schematics_ts_morph_1.AddDir)(host.getDir(projectSourceRoot), project);
20
- const mainSourceFile = project.getSourceFile('/main.ts');
21
- if (!mainSourceFile) {
22
- throw new schematics_1.SchematicsException(`Could not find the main.ts source file in '[projectSourceRoot]/main.ts'`);
23
- }
24
- (0, schematics_ts_morph_1.AddToArray)(mainSourceFile, 'configSideLoad', 'Promise.resolve()', 'Promise<any>[]');
25
- (0, schematics_ts_morph_1.AddToArray)(mainSourceFile, 'setup', 'ConfigService.Load().then(() => Promise.all(configSideLoad))', 'Promise<any>[]');
26
- mainSourceFile.addImportDeclarations([
27
- {
28
- namedImports: ['ConfigService'],
29
- moduleSpecifier: '@rxap/config'
30
- }
31
- ]);
32
- rules.push((0, schematics_ts_morph_1.ApplyTsMorphProject)(project, projectSourceRoot));
33
- const configFilePath = (0, path_1.join)(projectSourceRoot, 'config.json');
34
- rules.push((0, schematics_utilities_1.UpdateAngularJson)(angular => {
35
- const p = angular.projects.get(options.project);
36
- if (p) {
37
- const buildTarget = p.targets.get('build');
38
- if (buildTarget) {
39
- if (!buildTarget.options.assets) {
40
- buildTarget.options.assets = [];
41
- }
42
- const assets = buildTarget.options.assets;
43
- if (!assets.includes(configFilePath)) {
44
- assets.push(configFilePath);
45
- }
46
- }
47
- }
48
- }));
49
- rules.push(tree => {
50
- if (!tree.exists(configFilePath)) {
51
- tree.create(configFilePath, '{}');
52
- }
53
- });
54
- }
55
- return (0, schematics_1.chain)(rules);
56
- };
57
- }
58
- exports.default = default_1;
59
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/config/src/schematics/ng-add/index.ts"],"names":[],"mappings":";;AAAA,2DAKoC;AACpC,qEAIoC;AAEpC,uCAIkB;AAClB,mEAImC;AACnC,+BAA4B;AAE5B,mBAAwB,OAAoB;IAC1C,OAAO,CAAC,IAAU,EAAE,EAAE;QAEpB,MAAM,KAAK,GAAW;YACpB,IAAA,8CAAuB,GAAE;SAC1B,CAAC;QAEF,IAAI,OAAO,CAAC,OAAO,EAAE;YAEnB,MAAM,iBAAiB,GAAG,IAAA,2CAAoB,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;YACtE,MAAM,OAAO,GAAa,IAAI,kBAAO,CAAC;gBACpC,qBAAqB,EAAE,IAAI;gBAC3B,oBAAoB,EAAG,EAAE,SAAS,EAAE,oBAAS,CAAC,MAAM,EAAE,eAAe,EAAE,0BAAe,CAAC,SAAS,EAAE;aACnG,CAAC,CAAC;YACH,IAA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pC,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;yBAC7B;qBACF;iBACF;YAEH,CAAC,CAAC,CAAC,CAAC;YAEJ,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;gBAChB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE;oBAChC,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;iBACnC;YACH,CAAC,CAAC,CAAC;SAEJ;QAED,OAAO,IAAA,kBAAK,EAAC,KAAK,CAAC,CAAC;IAEtB,CAAC,CAAC;AACJ,CAAC;AA7ED,4BA6EC"}
@@ -1,15 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema",
3
- "$id": "config-ng-add",
4
- "type": "object",
5
- "properties": {
6
- "project": {
7
- "type": "string",
8
- "description": "The project where the environment feature should be added",
9
- "$default": {
10
- "$source": "projectName"
11
- }
12
- }
13
- },
14
- "required": []
15
- }
@@ -1,3 +0,0 @@
1
- import { Rule } from '@angular-devkit/schematics';
2
- import { SideLoadSchema } from './schema';
3
- export default function (options: SideLoadSchema): Rule;
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const schematics_1 = require("@angular-devkit/schematics");
5
- const ts_morph_1 = require("ts-morph");
6
- const schematics_utilities_1 = require("@rxap/schematics-utilities");
7
- const schematics_ts_morph_1 = require("@rxap/schematics-ts-morph");
8
- const path_1 = require("path");
9
- function default_1(options) {
10
- return (host) => tslib_1.__awaiter(this, void 0, void 0, function* () {
11
- var _a;
12
- const project = new ts_morph_1.Project({
13
- manipulationSettings: {
14
- indentationText: ts_morph_1.IndentationText.TwoSpaces
15
- },
16
- useInMemoryFileSystem: true
17
- });
18
- const projectSourceRoot = (0, schematics_utilities_1.GetProjectSourceRoot)(host, options.project);
19
- const mainSourceFile = project.createSourceFile('main.ts', host.read((0, path_1.join)(projectSourceRoot, 'main.ts')).toString('utf-8'));
20
- (0, schematics_ts_morph_1.AddToArray)(mainSourceFile, 'configSideLoad', `ConfigService.SideLoad('${options.url}', '${options.propertyPath}', ${(_a = options.required) !== null && _a !== void 0 ? _a : false})`, 'Promise<any>[]');
21
- return (0, schematics_1.chain)([
22
- (0, schematics_ts_morph_1.ApplyTsMorphProject)(project, projectSourceRoot)
23
- ]);
24
- });
25
- }
26
- exports.default = default_1;
27
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/config/src/schematics/side-load/index.ts"],"names":[],"mappings":";;;AAAA,2DAIoC;AAEpC,uCAGkB;AAClB,qEAAkE;AAClE,mEAGmC;AACnC,+BAA4B;AAE5B,mBAAwB,OAAuB;IAE7C,OAAO,CAAO,IAAU,EAAE,EAAE;;QAE1B,MAAM,OAAO,GAAG,IAAI,kBAAO,CAAC;YAC1B,oBAAoB,EAAG;gBACrB,eAAe,EAAE,0BAAe,CAAC,SAAS;aAC3C;YACD,qBAAqB,EAAE,IAAI;SAC5B,CAAC,CAAC;QAEH,MAAM,iBAAiB,GAAG,IAAA,2CAAoB,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QAEtE,MAAM,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAC7C,SAAS,EACT,IAAI,CAAC,IAAI,CAAC,IAAA,WAAI,EAAC,iBAAiB,EAAE,SAAS,CAAC,CAC1C,CAAC,QAAQ,CAAC,OAAO,CAAC,CACrB,CAAC;QAEF,IAAA,gCAAU,EACR,cAAc,EACd,gBAAgB,EAChB,2BAA2B,OAAO,CAAC,GAAG,OAAO,OAAO,CAAC,YAAY,MAAM,MAAA,OAAO,CAAC,QAAQ,mCAAI,KAAK,GAAG,EACnG,gBAAgB,CACjB,CAAC;QAEF,OAAO,IAAA,kBAAK,EAAC;YACX,IAAA,yCAAmB,EAAC,OAAO,EAAE,iBAAiB,CAAC;SAChD,CAAC,CAAC;IAEL,CAAC,CAAA,CAAC;AAEJ,CAAC;AAhCD,4BAgCC"}
@@ -1,29 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/schema",
3
- "$id": "config-side-load",
4
- "title": "SideLoad",
5
- "type": "object",
6
- "properties": {
7
- "project": {
8
- "type": "string",
9
- "description": "The project name"
10
- },
11
- "url": {
12
- "type": "string",
13
- "description": "Url for the config that should be side loaded"
14
- },
15
- "propertyPath": {
16
- "type": "string",
17
- "description": "Property path where the config should be added"
18
- },
19
- "required": {
20
- "type": "boolean",
21
- "default": false
22
- }
23
- },
24
- "required": [
25
- "project",
26
- "url",
27
- "propertyPath"
28
- ]
29
- }