@augment-vir/common 12.1.1 → 12.2.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.
@@ -0,0 +1,23 @@
1
+ import { Jsonify, Primitive } from 'type-fest';
2
+ /**
3
+ * These are similar in purpose, name, and structure to type-fest's JsonValue types but these are
4
+ * permissive. The goal here is to allow any types that do not get serialized into just empty
5
+ * objects. (For example, JSON.stringify(new Map()) returns "{}", so we don't want to allow that
6
+ * type.)
7
+ */
8
+ export type JsonCompatiblePrimitiveValue = Jsonify<Primitive> | undefined;
9
+ export type JsonCompatibleObject = Partial<{
10
+ readonly [key: string | number]: JsonCompatibleValue | Readonly<JsonCompatibleValue>;
11
+ }> | Partial<{
12
+ [key: string | number]: JsonCompatibleValue | Readonly<JsonCompatibleValue>;
13
+ }>;
14
+ export type JsonCompatibleArray = JsonCompatibleValue[]
15
+ /**
16
+ * This weird readonly with object syntax for an array type is so that TypeScript doesn't
17
+ * complain about JsonCompatibleArray circularly referencing itself
18
+ */
19
+ | ({
20
+ readonly [P in number]: JsonCompatibleValue;
21
+ } & ReadonlyArray<any>);
22
+ export type JsonCompatibleValue = JsonCompatiblePrimitiveValue | JsonCompatibleObject | JsonCompatibleArray;
23
+ //# sourceMappingURL=json-compatible.d.ts.map
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -7,6 +7,7 @@ export * from './augments/date';
7
7
  export * from './augments/environment';
8
8
  export * from './augments/error';
9
9
  export * from './augments/function';
10
+ export * from './augments/json-compatible';
10
11
  export * from './augments/object/enum';
11
12
  export * from './augments/object/filter-object';
12
13
  export * from './augments/object/jsonify';
package/dist/cjs/index.js CHANGED
@@ -23,6 +23,7 @@ __exportStar(require("./augments/date"), exports);
23
23
  __exportStar(require("./augments/environment"), exports);
24
24
  __exportStar(require("./augments/error"), exports);
25
25
  __exportStar(require("./augments/function"), exports);
26
+ __exportStar(require("./augments/json-compatible"), exports);
26
27
  __exportStar(require("./augments/object/enum"), exports);
27
28
  __exportStar(require("./augments/object/filter-object"), exports);
28
29
  __exportStar(require("./augments/object/jsonify"), exports);
@@ -0,0 +1,23 @@
1
+ import { Jsonify, Primitive } from 'type-fest';
2
+ /**
3
+ * These are similar in purpose, name, and structure to type-fest's JsonValue types but these are
4
+ * permissive. The goal here is to allow any types that do not get serialized into just empty
5
+ * objects. (For example, JSON.stringify(new Map()) returns "{}", so we don't want to allow that
6
+ * type.)
7
+ */
8
+ export type JsonCompatiblePrimitiveValue = Jsonify<Primitive> | undefined;
9
+ export type JsonCompatibleObject = Partial<{
10
+ readonly [key: string | number]: JsonCompatibleValue | Readonly<JsonCompatibleValue>;
11
+ }> | Partial<{
12
+ [key: string | number]: JsonCompatibleValue | Readonly<JsonCompatibleValue>;
13
+ }>;
14
+ export type JsonCompatibleArray = JsonCompatibleValue[]
15
+ /**
16
+ * This weird readonly with object syntax for an array type is so that TypeScript doesn't
17
+ * complain about JsonCompatibleArray circularly referencing itself
18
+ */
19
+ | ({
20
+ readonly [P in number]: JsonCompatibleValue;
21
+ } & ReadonlyArray<any>);
22
+ export type JsonCompatibleValue = JsonCompatiblePrimitiveValue | JsonCompatibleObject | JsonCompatibleArray;
23
+ //# sourceMappingURL=json-compatible.d.ts.map
@@ -0,0 +1 @@
1
+ export {};
@@ -7,6 +7,7 @@ export * from './augments/date';
7
7
  export * from './augments/environment';
8
8
  export * from './augments/error';
9
9
  export * from './augments/function';
10
+ export * from './augments/json-compatible';
10
11
  export * from './augments/object/enum';
11
12
  export * from './augments/object/filter-object';
12
13
  export * from './augments/object/jsonify';
package/dist/esm/index.js CHANGED
@@ -7,6 +7,7 @@ export * from './augments/date';
7
7
  export * from './augments/environment';
8
8
  export * from './augments/error';
9
9
  export * from './augments/function';
10
+ export * from './augments/json-compatible';
10
11
  export * from './augments/object/enum';
11
12
  export * from './augments/object/filter-object';
12
13
  export * from './augments/object/jsonify';
@@ -0,0 +1,23 @@
1
+ import { Jsonify, Primitive } from 'type-fest';
2
+ /**
3
+ * These are similar in purpose, name, and structure to type-fest's JsonValue types but these are
4
+ * permissive. The goal here is to allow any types that do not get serialized into just empty
5
+ * objects. (For example, JSON.stringify(new Map()) returns "{}", so we don't want to allow that
6
+ * type.)
7
+ */
8
+ export type JsonCompatiblePrimitiveValue = Jsonify<Primitive> | undefined;
9
+ export type JsonCompatibleObject = Partial<{
10
+ readonly [key: string | number]: JsonCompatibleValue | Readonly<JsonCompatibleValue>;
11
+ }> | Partial<{
12
+ [key: string | number]: JsonCompatibleValue | Readonly<JsonCompatibleValue>;
13
+ }>;
14
+ export type JsonCompatibleArray = JsonCompatibleValue[]
15
+ /**
16
+ * This weird readonly with object syntax for an array type is so that TypeScript doesn't
17
+ * complain about JsonCompatibleArray circularly referencing itself
18
+ */
19
+ | ({
20
+ readonly [P in number]: JsonCompatibleValue;
21
+ } & ReadonlyArray<any>);
22
+ export type JsonCompatibleValue = JsonCompatiblePrimitiveValue | JsonCompatibleObject | JsonCompatibleArray;
23
+ //# sourceMappingURL=json-compatible.d.ts.map
@@ -7,6 +7,7 @@ export * from './augments/date';
7
7
  export * from './augments/environment';
8
8
  export * from './augments/error';
9
9
  export * from './augments/function';
10
+ export * from './augments/json-compatible';
10
11
  export * from './augments/object/enum';
11
12
  export * from './augments/object/filter-object';
12
13
  export * from './augments/object/jsonify';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@augment-vir/common",
3
- "version": "12.1.1",
3
+ "version": "12.2.0",
4
4
  "homepage": "https://github.com/electrovir/augment-vir/tree/main/packages/common",
5
5
  "bugs": {
6
6
  "url": "https://github.com/electrovir/augment-vir/issues"