@nodesecure/rc 1.2.1 → 1.4.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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2021 NodeSecure
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.
1
+ MIT License
2
+
3
+ Copyright (c) 2021 NodeSecure
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/README.md CHANGED
@@ -1,11 +1,26 @@
1
- # rc
2
- ![version](https://img.shields.io/badge/dynamic/json.svg?url=https://raw.githubusercontent.com/NodeSecure/rc/master/package.json&query=$.version&label=Version)
3
- [![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://github.com/NodeSecure/rc/commit-activity)
4
- [![mit](https://img.shields.io/github/license/Naereen/StrapDown.js.svg)](https://github.com/NodeSecure/rc/blob/master/LICENSE)
1
+ <p align="center">
2
+ <img src="https://user-images.githubusercontent.com/4438263/216045720-779bf16d-1d35-409f-a0e6-4019bda8edde.jpg" alt="@nodesecure/rc">
3
+ </p>
4
+
5
+ <p align="center">
6
+ <a href="https://github.com/NodeSecure/rc">
7
+ <img src="https://img.shields.io/badge/dynamic/json.svg?style=for-the-badge&url=https://raw.githubusercontent.com/NodeSecure/rc/master/package.json&query=$.version&label=Version" alt="npm version">
8
+ </a>
9
+ <a href="https://github.com/NodeSecure/rc/blob/master/LICENSE">
10
+ <img src="https://img.shields.io/github/license/Naereen/StrapDown.js.svg?style=for-the-badge" alt="license">
11
+ </a>
12
+ <a href="https://api.securityscorecards.dev/projects/github.com/NodeSecure/rc">
13
+ <img src="https://api.securityscorecards.dev/projects/github.com/NodeSecure/rc/badge?style=for-the-badge" alt="ossf scorecard">
14
+ </a>
15
+ <a href="https://github.com/NodeSecure/rc/actions?query=workflow%3A%22Node.js+CI%22">
16
+ <img src="https://img.shields.io/github/actions/workflow/status/NodeSecure/rc/main.yml?style=for-the-badge" alt="github ci workflow">
17
+ </a>
18
+ </p>
5
19
 
6
20
  NodeSecure runtime configuration.
7
21
 
8
22
  ## Requirements
23
+
9
24
  - [Node.js](https://nodejs.org/en/) v16 or higher
10
25
 
11
26
  ## Getting Started
@@ -20,7 +35,7 @@ $ yarn add @nodesecure/rc
20
35
 
21
36
  ## Usage example
22
37
 
23
- Read:
38
+ read:
24
39
 
25
40
  ```ts
26
41
  import * as RC from "@nodesecure/rc";
@@ -31,22 +46,37 @@ const configurationPayload = (
31
46
  console.log(configurationPayload);
32
47
  ```
33
48
 
34
- Write:
49
+ write:
50
+
35
51
  ```ts
36
52
  import assert from "node:assert/strict";
37
53
  import * as RC from "@nodesecure/rc";
38
54
 
39
55
  const writeOpts: RC.writeOptions = {
40
56
  payload: { version: "2.0.0" },
41
- partialUpdate: true
57
+ partialUpdate: true,
42
58
  };
43
59
 
44
- const result = (
45
- await RC.write(void 0, writeOpts)
46
- ).unwrap();
60
+ const result = (await RC.write(void 0, writeOpts)).unwrap();
47
61
  assert.strictEqual(result, void 0);
48
62
  ```
49
63
 
64
+ memoize/memoized:
65
+
66
+ ```ts
67
+ import * as RC from "@nodesecure/rc";
68
+ import assert from "node:assert";
69
+
70
+ const configurationPayload = (
71
+ await RC.read(void 0, { createMode: "ci" })
72
+ ).unwrap()
73
+
74
+ RC.memoize(configurationPayload, { overwrite: true });
75
+
76
+ const memoizedPayload = RC.memoized();
77
+ assert.deepEqual(configurationPayload, memoizedPayload);
78
+ ```
79
+
50
80
  > 👀 .read and .write return Rust like [Result](https://doc.rust-lang.org/std/result/) object. Under the hood we use [ts-results](https://github.com/vultix/ts-results) to achieve this.
51
81
 
52
82
  ## API
@@ -69,9 +99,18 @@ interface createReadOptions {
69
99
  * @default `minimal`
70
100
  */
71
101
  createMode?: RCGenerationMode | RCGenerationMode[];
102
+ /**
103
+ * RC automatic caching option. This option allows to cache a configuration passed in parameter.
104
+ *
105
+ * @default false
106
+ */
107
+ memoize?: boolean;
72
108
  }
73
109
 
74
- export type readOptions = RequireAtLeastOne<createReadOptions, "createIfDoesNotExist" | "createMode">;
110
+ export type readOptions = RequireAtLeastOne<
111
+ createReadOptions,
112
+ "createIfDoesNotExist" | "createMode"
113
+ >;
75
114
  ```
76
115
 
77
116
  The `createIfDoesNotExist` argument can be ignored if `createMode` is provided.
@@ -108,6 +147,28 @@ export interface writePartialPayload {
108
147
 
109
148
  export type writeOptions = writeCompletePayload | writePartialPayload;
110
149
  ```
150
+ ### memoize(payload: Partial< RC >, options: memoizeOptions = {}): void
151
+ By default, the memory API overwrites the previous stored payload. When the `OVERWRITE` option is `false`, it merges new properties with existing properties.
152
+
153
+ ```ts
154
+ export interface memoizeOptions {
155
+ overwrite?: boolean;
156
+ }
157
+ ```
158
+ The `overwrite` option is used to specify whether data should be overwritten or merged.
159
+
160
+ ### memoized(options: memoizedOptions): Partial< RC > | null
161
+ This method returns null, when the default value is null, otherwise, it returns the current value of `memoizedValue`.
162
+
163
+ ```ts
164
+ export interface memoizedOptions {
165
+ defaultValue: Partial<RC>;
166
+ }
167
+ ```
168
+ If the `defaultValue` property is at null, then this value will be returned when `memoized` is called.
169
+
170
+ ### clearMemoized(): void
171
+ Clear/reset memoized RC
111
172
 
112
173
  ### homedir(): string
113
174
 
@@ -143,7 +204,7 @@ Note that you can combine several modes:
143
204
  ```ts
144
205
  import * as RC from "@nodesecure/rc";
145
206
 
146
- await RC.read(void 0, { createMode: ["ci", "report"] })
207
+ await RC.read(void 0, { createMode: ["ci", "report"] });
147
208
  ```
148
209
 
149
210
  ## JSON Schema
@@ -151,6 +212,7 @@ await RC.read(void 0, { createMode: ["ci", "report"] })
151
212
  The runtime configuration is validated with a JSON Schema: `./src/schema/nodesecurerc.json`.
152
213
 
153
214
  It can be retrieved by API if required:
215
+
154
216
  ```ts
155
217
  import * as RC from "@nodesecure/rc";
156
218
 
@@ -160,7 +222,7 @@ console.log(RC.JSONSchema);
160
222
  ## Contributors ✨
161
223
 
162
224
  <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
163
- [![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors-)
225
+ [![All Contributors](https://img.shields.io/badge/all_contributors-4-orange.svg?style=flat-square)](#contributors-)
164
226
  <!-- ALL-CONTRIBUTORS-BADGE:END -->
165
227
 
166
228
  Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
@@ -169,11 +231,14 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
169
231
  <!-- prettier-ignore-start -->
170
232
  <!-- markdownlint-disable -->
171
233
  <table>
172
- <tr>
173
- <td align="center"><a href="https://www.linkedin.com/in/thomas-gentilhomme/"><img src="https://avatars.githubusercontent.com/u/4438263?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Gentilhomme</b></sub></a><br /><a href="https://github.com/NodeSecure/rc/commits?author=fraxken" title="Code">💻</a> <a href="https://github.com/NodeSecure/rc/issues?q=author%3Afraxken" title="Bug reports">🐛</a> <a href="https://github.com/NodeSecure/rc/pulls?q=is%3Apr+reviewed-by%3Afraxken" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/NodeSecure/rc/commits?author=fraxken" title="Documentation">📖</a> <a href="#security-fraxken" title="Security">🛡️</a></td>
174
- <td align="center"><a href="https://dev.to/antoinecoulon"><img src="https://avatars.githubusercontent.com/u/43391199?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Antoine Coulon</b></sub></a><br /><a href="https://github.com/NodeSecure/rc/commits?author=antoine-coulon" title="Code">💻</a> <a href="https://github.com/NodeSecure/rc/issues?q=author%3Aantoine-coulon" title="Bug reports">🐛</a> <a href="https://github.com/NodeSecure/rc/pulls?q=is%3Apr+reviewed-by%3Aantoine-coulon" title="Reviewed Pull Requests">👀</a></td>
175
- <td align="center"><a href="https://github.com/PierreDemailly"><img src="https://avatars.githubusercontent.com/u/39910767?v=4?s=100" width="100px;" alt=""/><br /><sub><b>PierreD</b></sub></a><br /><a href="https://github.com/NodeSecure/rc/commits?author=PierreDemailly" title="Code">💻</a></td>
176
- </tr>
234
+ <tbody>
235
+ <tr>
236
+ <td align="center" valign="top" width="14.28%"><a href="https://www.linkedin.com/in/thomas-gentilhomme/"><img src="https://avatars.githubusercontent.com/u/4438263?v=4?s=100" width="100px;" alt="Gentilhomme"/><br /><sub><b>Gentilhomme</b></sub></a><br /><a href="https://github.com/NodeSecure/rc/commits?author=fraxken" title="Code">💻</a> <a href="https://github.com/NodeSecure/rc/issues?q=author%3Afraxken" title="Bug reports">🐛</a> <a href="https://github.com/NodeSecure/rc/pulls?q=is%3Apr+reviewed-by%3Afraxken" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/NodeSecure/rc/commits?author=fraxken" title="Documentation">📖</a> <a href="#security-fraxken" title="Security">🛡️</a></td>
237
+ <td align="center" valign="top" width="14.28%"><a href="https://dev.to/antoinecoulon"><img src="https://avatars.githubusercontent.com/u/43391199?v=4?s=100" width="100px;" alt="Antoine Coulon"/><br /><sub><b>Antoine Coulon</b></sub></a><br /><a href="https://github.com/NodeSecure/rc/commits?author=antoine-coulon" title="Code">💻</a> <a href="https://github.com/NodeSecure/rc/issues?q=author%3Aantoine-coulon" title="Bug reports">🐛</a> <a href="https://github.com/NodeSecure/rc/pulls?q=is%3Apr+reviewed-by%3Aantoine-coulon" title="Reviewed Pull Requests">👀</a></td>
238
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/PierreDemailly"><img src="https://avatars.githubusercontent.com/u/39910767?v=4?s=100" width="100px;" alt="PierreD"/><br /><sub><b>PierreD</b></sub></a><br /><a href="https://github.com/NodeSecure/rc/commits?author=PierreDemailly" title="Code">💻</a></td>
239
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/fabnguess"><img src="https://avatars.githubusercontent.com/u/72697416?v=4?s=100" width="100px;" alt="Kouadio Fabrice Nguessan"/><br /><sub><b>Kouadio Fabrice Nguessan</b></sub></a><br /><a href="https://github.com/NodeSecure/rc/commits?author=fabnguess" title="Code">💻</a> <a href="#maintenance-fabnguess" title="Maintenance">🚧</a></td>
240
+ </tr>
241
+ </tbody>
177
242
  </table>
178
243
 
179
244
  <!-- markdownlint-restore -->
@@ -182,4 +247,5 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
182
247
  <!-- ALL-CONTRIBUTORS-LIST:END -->
183
248
 
184
249
  ## License
250
+
185
251
  MIT
@@ -0,0 +1,14 @@
1
+ import { RC } from "../rc.js";
2
+ export interface memoizeOptions {
3
+ /**
4
+ * If enabled it will overwrite (crush) the previous memoized RC
5
+ * @default true
6
+ */
7
+ overwrite?: boolean;
8
+ }
9
+ export declare function memoize(payload: Partial<RC>, options?: memoizeOptions): void;
10
+ export interface memoizedOptions {
11
+ defaultValue: Partial<RC>;
12
+ }
13
+ export declare function memoized(options?: memoizedOptions): Partial<RC> | null;
14
+ export declare function clearMemoized(): void;
@@ -0,0 +1,20 @@
1
+ // Import Third-party Dependencies
2
+ import merge from "lodash.merge";
3
+ let memoizedValue = null;
4
+ export function memoize(payload, options = {}) {
5
+ const { overwrite = true } = options;
6
+ if (memoizedValue === null || overwrite) {
7
+ memoizedValue = payload;
8
+ }
9
+ else {
10
+ memoizedValue = merge({}, memoizedValue, payload);
11
+ }
12
+ }
13
+ export function memoized(options) {
14
+ const { defaultValue = null } = options ?? {};
15
+ return memoizedValue ?? defaultValue;
16
+ }
17
+ export function clearMemoized() {
18
+ memoizedValue = null;
19
+ }
20
+ //# sourceMappingURL=memoize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memoize.js","sourceRoot":"","sources":["../../src/functions/memoize.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,OAAO,KAAK,MAAM,cAAc,CAAC;AAKjC,IAAI,aAAa,GAAuB,IAAI,CAAC;AAU7C,MAAM,UAAU,OAAO,CACrB,OAAoB,EACpB,UAA0B,EAAE;IAE5B,MAAM,EAAE,SAAS,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;IAErC,IAAI,aAAa,KAAK,IAAI,IAAI,SAAS,EAAE;QACvC,aAAa,GAAG,OAAO,CAAC;KACzB;SACI;QACH,aAAa,GAAG,KAAK,CAAC,EAAE,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;KACnD;AACH,CAAC;AAMD,MAAM,UAAU,QAAQ,CACtB,OAAyB;IAEzB,MAAM,EAAE,YAAY,GAAG,IAAI,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;IAE9C,OAAO,aAAa,IAAI,YAAY,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,aAAa,GAAG,IAAI,CAAC;AACvB,CAAC"}
@@ -15,7 +15,13 @@ interface createReadOptions {
15
15
  * @default `minimal`
16
16
  */
17
17
  createMode?: RCGenerationMode | RCGenerationMode[];
18
+ /**
19
+ * RC automatic caching option. This option allows to cache a configuration passed in parameter.
20
+ *
21
+ * @default false
22
+ */
23
+ memoize?: boolean;
18
24
  }
19
- export declare type readOptions = RequireAtLeastOne<createReadOptions, "createIfDoesNotExist" | "createMode">;
25
+ export type readOptions = RequireAtLeastOne<createReadOptions, "createIfDoesNotExist" | "createMode">;
20
26
  export declare function read(location?: string, options?: readOptions): Promise<Result<RC, NodeJS.ErrnoException>>;
21
27
  export {};
@@ -7,11 +7,12 @@ import TR from "ts-results";
7
7
  // Import Internal Dependencies
8
8
  import { JSONSchema, generateDefaultRC } from "../rc.js";
9
9
  import * as CONSTANTS from "../constants.js";
10
+ import { memoize } from "./memoize.js";
10
11
  // CONSTANTS
11
12
  const { Ok, Err } = TR;
12
13
  export async function read(location = process.cwd(), options = Object.create(null)) {
13
14
  try {
14
- const { createIfDoesNotExist = Boolean(options.createMode), createMode } = options;
15
+ const { createIfDoesNotExist = Boolean(options.createMode), createMode, memoize: memoizeRc = false } = options;
15
16
  const cfgPath = path.join(location, CONSTANTS.CONFIGURATION_NAME);
16
17
  const cfg = new Config(cfgPath, {
17
18
  defaultSchema: JSONSchema,
@@ -22,6 +23,9 @@ export async function read(location = process.cwd(), options = Object.create(nul
22
23
  await once(cfg, "configWritten");
23
24
  }
24
25
  const result = cfg.payload;
26
+ if (memoizeRc) {
27
+ memoize(result);
28
+ }
25
29
  await cfg.close();
26
30
  return new Ok(result);
27
31
  }
@@ -1 +1 @@
1
- {"version":3,"file":"read.js","sourceRoot":"","sources":["../../src/functions/read.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,kCAAkC;AAClC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAc,MAAM,YAAY,CAAC;AAGxC,+BAA+B;AAC/B,OAAO,EAAM,UAAU,EAAE,iBAAiB,EAAoB,MAAM,UAAU,CAAC;AAC/E,OAAO,KAAK,SAAS,MAAM,iBAAiB,CAAC;AAE7C,YAAY;AACZ,MAAM,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAmBvB,MAAM,CAAC,KAAK,UAAU,IAAI,CACxB,QAAQ,GAAG,OAAO,CAAC,GAAG,EAAE,EACxB,UAAuB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;IAE1C,IAAI;QACF,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;QAEnF,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,kBAAkB,CAAC,CAAC;QAClE,MAAM,GAAG,GAAG,IAAI,MAAM,CAAK,OAAO,EAAE;YAClC,aAAa,EAAE,UAAU;YACzB,eAAe,EAAE,oBAAoB;SACtC,CAAC,CAAC;QAEH,MAAM,GAAG,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;QAC9E,IAAI,oBAAoB,EAAE;YACxB,MAAM,IAAI,CAAC,GAAG,EAAE,eAAe,CAAC,CAAC;SAClC;QACD,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC;QAE3B,MAAM,GAAG,CAAC,KAAK,EAAE,CAAC;QAElB,OAAO,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC;KACvB;IACD,OAAO,KAAK,EAAE;QACZ,OAAO,IAAI,GAAG,CAAC,KAA8B,CAAC,CAAC;KAChD;AACH,CAAC"}
1
+ {"version":3,"file":"read.js","sourceRoot":"","sources":["../../src/functions/read.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,kCAAkC;AAClC,OAAO,MAAM,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAc,MAAM,YAAY,CAAC;AAGxC,+BAA+B;AAC/B,OAAO,EAAM,UAAU,EAAE,iBAAiB,EAAoB,MAAM,UAAU,CAAC;AAC/E,OAAO,KAAK,SAAS,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,YAAY;AACZ,MAAM,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AA0BvB,MAAM,CAAC,KAAK,UAAU,IAAI,CACxB,QAAQ,GAAG,OAAO,CAAC,GAAG,EAAE,EACxB,UAAuB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;IAE1C,IAAI;QACF,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,GAAG,KAAK,EAAE,GAAG,OAAO,CAAC;QAE/G,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,kBAAkB,CAAC,CAAC;QAClE,MAAM,GAAG,GAAG,IAAI,MAAM,CAAK,OAAO,EAAE;YAClC,aAAa,EAAE,UAAU;YACzB,eAAe,EAAE,oBAAoB;SACtC,CAAC,CAAC;QAEH,MAAM,GAAG,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;QAC9E,IAAI,oBAAoB,EAAE;YACxB,MAAM,IAAI,CAAC,GAAG,EAAE,eAAe,CAAC,CAAC;SAClC;QACD,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC;QAE3B,IAAI,SAAS,EAAE;YACb,OAAO,CAAC,MAAM,CAAC,CAAC;SACjB;QAED,MAAM,GAAG,CAAC,KAAK,EAAE,CAAC;QAElB,OAAO,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC;KACvB;IACD,OAAO,KAAK,EAAE;QACZ,OAAO,IAAI,GAAG,CAAC,KAA8B,CAAC,CAAC;KAChD;AACH,CAAC"}
@@ -15,5 +15,5 @@ export interface writePartialPayload {
15
15
  payload: Partial<RC>;
16
16
  partialUpdate: true;
17
17
  }
18
- export declare type writeOptions = writeCompletePayload | writePartialPayload;
18
+ export type writeOptions = writeCompletePayload | writePartialPayload;
19
19
  export declare function write(location: string | undefined, options: writeOptions): Promise<Result<void, NodeJS.ErrnoException>>;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from "./functions/read.js";
2
2
  export * from "./functions/write.js";
3
+ export * from "./functions/memoize.js";
3
4
  export * as CONSTANTS from "./constants.js";
4
5
  export { RC, JSONSchema, homedir } from "./rc.js";
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from "./functions/read.js";
2
2
  export * from "./functions/write.js";
3
+ export * from "./functions/memoize.js";
3
4
  export * as CONSTANTS from "./constants.js";
4
5
  export { JSONSchema, homedir } from "./rc.js";
5
6
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAM,UAAU,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAM,UAAU,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC"}
@@ -19,7 +19,7 @@ export interface CiConfiguration {
19
19
  */
20
20
  warnings?: CiWarnings | Record<jsxray.WarningName, CiWarnings>;
21
21
  }
22
- export declare type CiWarnings = "off" | "error" | "warning";
22
+ export type CiWarnings = "off" | "error" | "warning";
23
23
  export declare function generateCIConfiguration(): {
24
24
  ci: CiConfiguration;
25
25
  };
package/dist/rc.d.ts CHANGED
@@ -26,7 +26,7 @@ export interface RC {
26
26
  /** NodeSecure report Object configuration */
27
27
  report?: ReportConfiguration;
28
28
  }
29
- export declare type RCGenerationMode = "minimal" | "ci" | "report" | "complete";
29
+ export type RCGenerationMode = "minimal" | "ci" | "report" | "complete";
30
30
  /**
31
31
  * @example
32
32
  * generateDefaultRC("complete");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodesecure/rc",
3
- "version": "1.2.1",
3
+ "version": "1.4.0",
4
4
  "description": "NodeSecure runtime configuration",
5
5
  "exports": "./dist/index.js",
6
6
  "type": "module",
@@ -35,31 +35,31 @@
35
35
  },
36
36
  "homepage": "https://github.com/NodeSecure/rc#readme",
37
37
  "devDependencies": {
38
- "@nodesecure/eslint-config": "^1.5.0",
39
- "@types/chai": "^4.3.3",
38
+ "@nodesecure/eslint-config": "^1.7.0",
39
+ "@types/chai": "^4.3.4",
40
40
  "@types/lodash.merge": "^4.6.7",
41
- "@types/mocha": "^10.0.0",
42
- "@types/node": "^18.11.9",
41
+ "@types/mocha": "^10.0.1",
42
+ "@types/node": "^18.15.3",
43
43
  "@types/zen-observable": "^0.8.3",
44
- "ajv": "^8.11.0",
44
+ "ajv": "^8.12.0",
45
45
  "c8": "^7.12.0",
46
- "chai": "^4.3.6",
47
- "eslint": "^8.26.0",
48
- "lodash.merge": "^4.6.2",
49
- "mocha": "^10.1.0",
50
- "tape": "^5.6.1",
46
+ "chai": "^4.3.7",
47
+ "eslint": "^8.36.0",
48
+ "mocha": "^10.2.0",
49
+ "tape": "^5.6.3",
51
50
  "ts-node": "^10.9.1",
52
- "tsd": "^0.24.1",
53
- "typescript": "^4.8.4"
51
+ "tsd": "^0.28.0",
52
+ "typescript": "^5.0.2"
54
53
  },
55
54
  "dependencies": {
56
- "@nodesecure/i18n": "^1.5.0",
57
- "@nodesecure/js-x-ray": "^5.1.0",
55
+ "@nodesecure/i18n": "^3.2.0",
56
+ "@nodesecure/js-x-ray": "^6.0.1",
58
57
  "@nodesecure/vuln": "^1.7.0",
59
- "@slimio/config": "^1.1.0",
58
+ "@slimio/config": "^1.2.0",
59
+ "lodash.merge": "^4.6.2",
60
60
  "ts-results": "^3.3.0",
61
61
  "tslib": "^2.4.1",
62
- "type-fest": "^3.2.0"
62
+ "type-fest": "^3.6.1"
63
63
  },
64
64
  "tsd": {
65
65
  "directory": "test/types",