@thisisagile/easy 17.16.1 → 17.17.1

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.
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-UR544PJT.mjs";
8
8
  import {
9
9
  Struct
10
- } from "./chunk-BYCWXUYD.mjs";
10
+ } from "./chunk-HAXA65A3.mjs";
11
11
  import {
12
12
  choose
13
13
  } from "./chunk-2KZ5UP6A.mjs";
@@ -47,4 +47,4 @@ __decorateClass([
47
47
  export {
48
48
  Audit
49
49
  };
50
- //# sourceMappingURL=chunk-4QAEEB5Z.mjs.map
50
+ //# sourceMappingURL=chunk-3BJDTSKH.mjs.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-MDXL65W4.mjs";
4
4
  import {
5
5
  json
6
- } from "./chunk-KPEGHJSZ.mjs";
6
+ } from "./chunk-KTENM2OG.mjs";
7
7
  import {
8
8
  isDefined
9
9
  } from "./chunk-DEJ7A5PY.mjs";
@@ -50,4 +50,4 @@ export {
50
50
  toCondition,
51
51
  isSortCondition
52
52
  };
53
- //# sourceMappingURL=chunk-SWBW2VJ2.mjs.map
53
+ //# sourceMappingURL=chunk-BU6LSSQP.mjs.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  json
3
- } from "./chunk-KPEGHJSZ.mjs";
3
+ } from "./chunk-KTENM2OG.mjs";
4
4
  import {
5
5
  validate
6
6
  } from "./chunk-2KZ5UP6A.mjs";
@@ -37,4 +37,4 @@ export {
37
37
  Struct,
38
38
  isStruct
39
39
  };
40
- //# sourceMappingURL=chunk-BYCWXUYD.mjs.map
40
+ //# sourceMappingURL=chunk-HAXA65A3.mjs.map
@@ -11,6 +11,7 @@ import {
11
11
  isA
12
12
  } from "./chunk-ZHXKBOK2.mjs";
13
13
  import {
14
+ isDefined,
14
15
  isEmpty,
15
16
  isObject
16
17
  } from "./chunk-DEJ7A5PY.mjs";
@@ -44,7 +45,7 @@ var Any = class {
44
45
  return this.value;
45
46
  }
46
47
  };
47
- var takeFirstKey = (j, alt = "") => entries(asJson(j)).first()?.[0] ?? alt;
48
+ var takeFirstKey = (j, alt = "") => entries(asJson(j)).first(([, v]) => isDefined(v))?.[0] ?? alt;
48
49
  var any = (value) => new Any(value);
49
50
 
50
51
  export {
@@ -55,4 +56,4 @@ export {
55
56
  takeFirstKey,
56
57
  any
57
58
  };
58
- //# sourceMappingURL=chunk-KPEGHJSZ.mjs.map
59
+ //# sourceMappingURL=chunk-KTENM2OG.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/types/Json.ts"],"sourcesContent":["import { isA } from './IsA';\nimport { isDefined, isEmpty, isObject } from './Is';\nimport { Get, ofGet } from './Get';\nimport { ifDefined } from '../utils/If';\nimport { TypeGuard } from './TypeGuard';\nimport { entries } from './Object';\n\nexport type JsonValue = string | number | boolean | null | Json | JsonValue[];\nexport type Json = { [key: string]: JsonValue };\n\nexport const isJson: TypeGuard<{ toJSON: () => Json }> = (subject?: unknown): subject is { toJSON: () => Json } =>\n isA<{ toJSON: () => Json }>(subject, 'toJSON');\n\nexport const json = {\n parse: <T extends Json = Json>(subject: unknown): T => JSON.parse(JSON.stringify(subject ?? {})),\n merge: (...subjects: unknown[]): Json => json.parse(subjects.map(s => asJson(s, s => json.parse(s))).reduce((js, j) => ({ ...js, ...j }), {})),\n delete: <T extends Json = Json>(subject: T, key: string): T => {\n ifDefined(subject, () => delete (subject as any)[key]);\n return subject;\n },\n set: <T extends Json = Json>(subject: T, key = '', value?: unknown): T =>\n isEmpty(key) ? subject : value !== undefined ? { ...(subject as any), ...{ [key]: value as JsonValue } } : json.delete(subject, key),\n omit: <T extends Json = Json>(subject: T, ...keys: string[]): T => keys.reduce((js, k) => json.delete(js, k), json.parse<T>(subject)),\n pick: <T extends Json = Json>(subject: T, ...keys: string[]): T => keys.reduce((js, k) => json.set(js, k, (subject as any)[k]), {} as T),\n defaults: <T extends Json = Json>(options: Partial<T> = {}, defaults: Partial<T> = {}): T => json.merge(defaults, options) as T,\n isSubset: (subject: Json, subset: Json): boolean => !entries(subset).some(([k, v]) => subject[k] !== v),\n};\n\nexport const toJson = json.merge;\n\nexport const asJson = (j?: unknown, alt: Get<Json> = {}): Json => (isJson(j) ? j.toJSON() : isObject(j) ? (j as Json) : ofGet(alt, j));\n\nclass Any<T extends Json> {\n constructor(readonly value: T) {}\n\n merge = (...subjects: T[]): Any<T> => any<T>(json.merge(this.value, ...subjects) as T);\n delete = (key: keyof T): Any<T> => any<T>(json.delete<T>(this.value, key as string));\n omit = (...keys: (keyof T)[]): Any<T> => any<T>(json.omit<T>(this.value, ...(keys as string[])));\n set = (key: keyof T, value?: unknown): Any<T> => any<T>(json.set(this.value, key as string, value));\n\n toJSON(): Json {\n return this.value;\n }\n}\n\nexport const takeFirstKey = (j: unknown, alt: string = ''): string => entries(asJson(j)).first(([, v]) => isDefined(v))?.[0] ?? alt;\n\nexport const any = <T extends Json = Json>(value: T): Any<T> => new Any<T>(value);\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAUO,IAAM,SAA4C,CAAC,YACxD,IAA4B,SAAS,QAAQ;AAExC,IAAM,OAAO;AAAA,EAClB,OAAO,CAAwB,YAAwB,KAAK,MAAM,KAAK,UAAU,WAAW,CAAC,CAAC,CAAC;AAAA,EAC/F,OAAO,IAAI,aAA8B,KAAK,MAAM,SAAS,IAAI,OAAK,OAAO,GAAG,CAAAA,OAAK,KAAK,MAAMA,EAAC,CAAC,CAAC,EAAE,OAAO,CAAC,IAAI,OAAO,EAAE,GAAG,IAAI,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;AAAA,EAC7I,QAAQ,CAAwB,SAAY,QAAmB;AAC7D,cAAU,SAAS,MAAM,OAAQ,QAAgB,GAAG,CAAC;AACrD,WAAO;AAAA,EACT;AAAA,EACA,KAAK,CAAwB,SAAY,MAAM,IAAI,UACjD,QAAQ,GAAG,IAAI,UAAU,UAAU,SAAY,EAAE,GAAI,SAAiB,GAAG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E,CAAC,MAAM,UAAU,CAAC,CAAC,IAAI,CAAC,KAAK;AAEzH,IAAM,MAAM,CAAwB,UAAqB,IAAI,IAAO,KAAK;","names":["s"]}
@@ -11,7 +11,7 @@ import {
11
11
  import {
12
12
  asJson,
13
13
  json
14
- } from "./chunk-KPEGHJSZ.mjs";
14
+ } from "./chunk-KTENM2OG.mjs";
15
15
  import {
16
16
  choose
17
17
  } from "./chunk-2KZ5UP6A.mjs";
@@ -96,4 +96,4 @@ export {
96
96
  view,
97
97
  views
98
98
  };
99
- //# sourceMappingURL=chunk-GMXD4KV6.mjs.map
99
+ //# sourceMappingURL=chunk-SRXIPWW3.mjs.map
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-GCY5A63A.mjs";
7
7
  import {
8
8
  json
9
- } from "./chunk-KPEGHJSZ.mjs";
9
+ } from "./chunk-KTENM2OG.mjs";
10
10
  import {
11
11
  meta
12
12
  } from "./chunk-WTFW6DLP.mjs";
@@ -133,4 +133,4 @@ export {
133
133
  Mapper,
134
134
  mappings
135
135
  };
136
- //# sourceMappingURL=chunk-X57327XS.mjs.map
136
+ //# sourceMappingURL=chunk-W7D4GZRE.mjs.map
@@ -4,9 +4,9 @@ import {
4
4
  SortCondition,
5
5
  isSortCondition,
6
6
  toCondition
7
- } from "../chunk-SWBW2VJ2.mjs";
7
+ } from "../chunk-BU6LSSQP.mjs";
8
8
  import "../chunk-MDXL65W4.mjs";
9
- import "../chunk-KPEGHJSZ.mjs";
9
+ import "../chunk-KTENM2OG.mjs";
10
10
  import "../chunk-H2762RTS.mjs";
11
11
  import "../chunk-A7C3XND3.mjs";
12
12
  import "../chunk-JSON7A4X.mjs";
@@ -4,9 +4,9 @@ import {
4
4
  import {
5
5
  SortCondition,
6
6
  toCondition
7
- } from "../chunk-SWBW2VJ2.mjs";
7
+ } from "../chunk-BU6LSSQP.mjs";
8
8
  import "../chunk-MDXL65W4.mjs";
9
- import "../chunk-KPEGHJSZ.mjs";
9
+ import "../chunk-KTENM2OG.mjs";
10
10
  import "../chunk-H2762RTS.mjs";
11
11
  import "../chunk-A7C3XND3.mjs";
12
12
  import "../chunk-JSON7A4X.mjs";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  Audit
3
- } from "../chunk-4QAEEB5Z.mjs";
3
+ } from "../chunk-3BJDTSKH.mjs";
4
4
  import "../chunk-RBQOVMPC.mjs";
5
5
  import "../chunk-UR544PJT.mjs";
6
6
  import "../chunk-JQQGQCYH.mjs";
7
7
  import "../chunk-ADJAEGCT.mjs";
8
- import "../chunk-BYCWXUYD.mjs";
9
- import "../chunk-KPEGHJSZ.mjs";
8
+ import "../chunk-HAXA65A3.mjs";
9
+ import "../chunk-KTENM2OG.mjs";
10
10
  import "../chunk-2KZ5UP6A.mjs";
11
11
  import "../chunk-OFGI5FLG.mjs";
12
12
  import "../chunk-NCEWAKOZ.mjs";
@@ -8,10 +8,10 @@ import {
8
8
  import "../chunk-ADJAEGCT.mjs";
9
9
  import {
10
10
  Struct
11
- } from "../chunk-BYCWXUYD.mjs";
11
+ } from "../chunk-HAXA65A3.mjs";
12
12
  import {
13
13
  json
14
- } from "../chunk-KPEGHJSZ.mjs";
14
+ } from "../chunk-KTENM2OG.mjs";
15
15
  import "../chunk-2KZ5UP6A.mjs";
16
16
  import "../chunk-OFGI5FLG.mjs";
17
17
  import "../chunk-NCEWAKOZ.mjs";
@@ -4,7 +4,7 @@ import {
4
4
  import "../chunk-LXQQ5N6S.mjs";
5
5
  import {
6
6
  Audit
7
- } from "../chunk-4QAEEB5Z.mjs";
7
+ } from "../chunk-3BJDTSKH.mjs";
8
8
  import {
9
9
  required
10
10
  } from "../chunk-RBQOVMPC.mjs";
@@ -13,10 +13,10 @@ import "../chunk-JQQGQCYH.mjs";
13
13
  import "../chunk-ADJAEGCT.mjs";
14
14
  import {
15
15
  Struct
16
- } from "../chunk-BYCWXUYD.mjs";
16
+ } from "../chunk-HAXA65A3.mjs";
17
17
  import {
18
18
  json
19
- } from "../chunk-KPEGHJSZ.mjs";
19
+ } from "../chunk-KTENM2OG.mjs";
20
20
  import "../chunk-2KZ5UP6A.mjs";
21
21
  import "../chunk-OFGI5FLG.mjs";
22
22
  import "../chunk-NCEWAKOZ.mjs";
@@ -3,7 +3,7 @@ import {
3
3
  } from "../chunk-ROTFIQND.mjs";
4
4
  import {
5
5
  toJson
6
- } from "../chunk-KPEGHJSZ.mjs";
6
+ } from "../chunk-KTENM2OG.mjs";
7
7
  import {
8
8
  when
9
9
  } from "../chunk-2KZ5UP6A.mjs";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  Struct,
3
3
  isStruct
4
- } from "../chunk-BYCWXUYD.mjs";
5
- import "../chunk-KPEGHJSZ.mjs";
4
+ } from "../chunk-HAXA65A3.mjs";
5
+ import "../chunk-KTENM2OG.mjs";
6
6
  import "../chunk-2KZ5UP6A.mjs";
7
7
  import "../chunk-OFGI5FLG.mjs";
8
8
  import "../chunk-NCEWAKOZ.mjs";
package/dist/index.js CHANGED
@@ -675,7 +675,7 @@ var Any = class {
675
675
  return this.value;
676
676
  }
677
677
  };
678
- var takeFirstKey = (j, alt = "") => entries(asJson(j)).first()?.[0] ?? alt;
678
+ var takeFirstKey = (j, alt = "") => entries(asJson(j)).first(([, v]) => isDefined(v))?.[0] ?? alt;
679
679
  var any = (value) => new Any(value);
680
680
 
681
681
  // src/utils/Convert.ts