pi-proactive 0.2.0-beta.2 → 0.2.0-beta.3

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.
Files changed (243) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +32 -28
  3. package/build/cli.mjs +121 -0
  4. package/build/extensions/proactive.js +47 -6
  5. package/build/src/commands.js +78 -2
  6. package/build/src/config.js +511 -4
  7. package/build/src/daemon-config.js +221 -0
  8. package/build/src/daemon-contact.js +103 -0
  9. package/build/src/daemon-host.js +84 -0
  10. package/build/src/daemon.js +193 -3
  11. package/build/src/health.js +84 -0
  12. package/build/src/lineage.js +41 -2
  13. package/build/src/notify.js +183 -0
  14. package/build/src/progress-eta.js +134 -0
  15. package/build/src/trigger.js +43 -0
  16. package/build/src/trust-loop.js +321 -0
  17. package/build/src/trust-metrics.js +236 -0
  18. package/build/src/trust-notify.js +73 -0
  19. package/build/src/trust-policy.js +58 -0
  20. package/build/src/trust-registry.js +323 -0
  21. package/daemon/launchd.plist +48 -0
  22. package/daemon/pi-proactive-daemon.service +29 -0
  23. package/daemon/run-daemon.sh +84 -0
  24. package/node_modules/typebox/build/compile/code.mjs +2 -1
  25. package/node_modules/typebox/build/compile/validator.mjs +1 -5
  26. package/node_modules/typebox/build/format/date_time.d.mts +1 -2
  27. package/node_modules/typebox/build/format/date_time.mjs +3 -12
  28. package/node_modules/typebox/build/format/duration.d.mts +2 -2
  29. package/node_modules/typebox/build/format/duration.mjs +2 -2
  30. package/node_modules/typebox/build/format/idn_email.d.mts +0 -1
  31. package/node_modules/typebox/build/format/idn_email.mjs +0 -1
  32. package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -1
  33. package/node_modules/typebox/build/format/idn_hostname.mjs +1 -1
  34. package/node_modules/typebox/build/format/ipv4.d.mts +2 -2
  35. package/node_modules/typebox/build/format/ipv4.mjs +2 -2
  36. package/node_modules/typebox/build/format/ipv6.d.mts +1 -1
  37. package/node_modules/typebox/build/format/ipv6.mjs +1 -1
  38. package/node_modules/typebox/build/format/iri.mjs +9 -16
  39. package/node_modules/typebox/build/format/relative_json_pointer.d.mts +2 -2
  40. package/node_modules/typebox/build/format/relative_json_pointer.mjs +2 -2
  41. package/node_modules/typebox/build/guard/emit.mjs +2 -2
  42. package/node_modules/typebox/build/guard/guard.d.mts +5 -7
  43. package/node_modules/typebox/build/guard/guard.mjs +9 -14
  44. package/node_modules/typebox/build/guard/index.mjs +0 -6
  45. package/node_modules/typebox/build/guard/{unicode/unicode_segment.mjs → string.mjs} +19 -16
  46. package/node_modules/typebox/build/schema/build.mjs +5 -5
  47. package/node_modules/typebox/build/schema/check.mjs +1 -1
  48. package/node_modules/typebox/build/schema/engine/_context.d.mts +1 -5
  49. package/node_modules/typebox/build/schema/engine/_context.mjs +3 -16
  50. package/node_modules/typebox/build/schema/engine/_functions.d.mts +2 -2
  51. package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -1
  52. package/node_modules/typebox/build/schema/engine/_reducer.d.mts +3 -3
  53. package/node_modules/typebox/build/schema/engine/_refine.d.mts +5 -5
  54. package/node_modules/typebox/build/schema/engine/_refine.mjs +9 -14
  55. package/node_modules/typebox/build/schema/engine/_stack.d.mts +20 -34
  56. package/node_modules/typebox/build/schema/engine/_stack.mjs +202 -143
  57. package/node_modules/typebox/build/schema/engine/_unique.d.mts +2 -4
  58. package/node_modules/typebox/build/schema/engine/_unique.mjs +3 -7
  59. package/node_modules/typebox/build/schema/engine/additionalItems.d.mts +4 -4
  60. package/node_modules/typebox/build/schema/engine/additionalItems.mjs +3 -3
  61. package/node_modules/typebox/build/schema/engine/additionalProperties.d.mts +8 -5
  62. package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +32 -27
  63. package/node_modules/typebox/build/schema/engine/allOf.d.mts +4 -4
  64. package/node_modules/typebox/build/schema/engine/allOf.mjs +1 -1
  65. package/node_modules/typebox/build/schema/engine/anyOf.d.mts +4 -4
  66. package/node_modules/typebox/build/schema/engine/anyOf.mjs +9 -4
  67. package/node_modules/typebox/build/schema/engine/boolean.d.mts +4 -4
  68. package/node_modules/typebox/build/schema/engine/boolean.mjs +6 -2
  69. package/node_modules/typebox/build/schema/engine/const.d.mts +4 -4
  70. package/node_modules/typebox/build/schema/engine/const.mjs +6 -2
  71. package/node_modules/typebox/build/schema/engine/contains.d.mts +4 -4
  72. package/node_modules/typebox/build/schema/engine/contains.mjs +9 -5
  73. package/node_modules/typebox/build/schema/engine/dependencies.d.mts +4 -4
  74. package/node_modules/typebox/build/schema/engine/dependencies.mjs +7 -5
  75. package/node_modules/typebox/build/schema/engine/dependentRequired.d.mts +4 -4
  76. package/node_modules/typebox/build/schema/engine/dependentRequired.mjs +6 -2
  77. package/node_modules/typebox/build/schema/engine/dependentSchemas.d.mts +4 -4
  78. package/node_modules/typebox/build/schema/engine/dependentSchemas.mjs +1 -2
  79. package/node_modules/typebox/build/schema/engine/dynamicRef.d.mts +4 -4
  80. package/node_modules/typebox/build/schema/engine/dynamicRef.mjs +8 -12
  81. package/node_modules/typebox/build/schema/engine/enum.d.mts +4 -4
  82. package/node_modules/typebox/build/schema/engine/enum.mjs +6 -2
  83. package/node_modules/typebox/build/schema/engine/exclusiveMaximum.d.mts +4 -4
  84. package/node_modules/typebox/build/schema/engine/exclusiveMaximum.mjs +6 -2
  85. package/node_modules/typebox/build/schema/engine/exclusiveMinimum.d.mts +4 -4
  86. package/node_modules/typebox/build/schema/engine/exclusiveMinimum.mjs +6 -2
  87. package/node_modules/typebox/build/schema/engine/format.d.mts +4 -4
  88. package/node_modules/typebox/build/schema/engine/format.mjs +8 -11
  89. package/node_modules/typebox/build/schema/engine/if.d.mts +4 -4
  90. package/node_modules/typebox/build/schema/engine/if.mjs +13 -5
  91. package/node_modules/typebox/build/schema/engine/index.d.mts +0 -1
  92. package/node_modules/typebox/build/schema/engine/index.mjs +0 -1
  93. package/node_modules/typebox/build/schema/engine/items.d.mts +4 -4
  94. package/node_modules/typebox/build/schema/engine/items.mjs +5 -8
  95. package/node_modules/typebox/build/schema/engine/maxContains.d.mts +4 -4
  96. package/node_modules/typebox/build/schema/engine/maxContains.mjs +8 -4
  97. package/node_modules/typebox/build/schema/engine/maxItems.d.mts +4 -4
  98. package/node_modules/typebox/build/schema/engine/maxItems.mjs +6 -2
  99. package/node_modules/typebox/build/schema/engine/maxLength.d.mts +4 -4
  100. package/node_modules/typebox/build/schema/engine/maxLength.mjs +6 -2
  101. package/node_modules/typebox/build/schema/engine/maxProperties.d.mts +4 -4
  102. package/node_modules/typebox/build/schema/engine/maxProperties.mjs +6 -2
  103. package/node_modules/typebox/build/schema/engine/maximum.d.mts +4 -4
  104. package/node_modules/typebox/build/schema/engine/maximum.mjs +6 -2
  105. package/node_modules/typebox/build/schema/engine/minContains.d.mts +4 -4
  106. package/node_modules/typebox/build/schema/engine/minContains.mjs +9 -5
  107. package/node_modules/typebox/build/schema/engine/minItems.d.mts +5 -5
  108. package/node_modules/typebox/build/schema/engine/minItems.mjs +6 -2
  109. package/node_modules/typebox/build/schema/engine/minLength.d.mts +4 -4
  110. package/node_modules/typebox/build/schema/engine/minLength.mjs +6 -2
  111. package/node_modules/typebox/build/schema/engine/minProperties.d.mts +4 -4
  112. package/node_modules/typebox/build/schema/engine/minProperties.mjs +6 -2
  113. package/node_modules/typebox/build/schema/engine/minimum.d.mts +4 -4
  114. package/node_modules/typebox/build/schema/engine/minimum.mjs +6 -2
  115. package/node_modules/typebox/build/schema/engine/multipleOf.d.mts +4 -4
  116. package/node_modules/typebox/build/schema/engine/multipleOf.mjs +6 -2
  117. package/node_modules/typebox/build/schema/engine/not.d.mts +4 -4
  118. package/node_modules/typebox/build/schema/engine/not.mjs +8 -4
  119. package/node_modules/typebox/build/schema/engine/oneOf.d.mts +4 -4
  120. package/node_modules/typebox/build/schema/engine/oneOf.mjs +11 -6
  121. package/node_modules/typebox/build/schema/engine/pattern.d.mts +4 -4
  122. package/node_modules/typebox/build/schema/engine/pattern.mjs +7 -3
  123. package/node_modules/typebox/build/schema/engine/patternProperties.d.mts +4 -4
  124. package/node_modules/typebox/build/schema/engine/patternProperties.mjs +5 -6
  125. package/node_modules/typebox/build/schema/engine/prefixItems.d.mts +4 -4
  126. package/node_modules/typebox/build/schema/engine/prefixItems.mjs +1 -1
  127. package/node_modules/typebox/build/schema/engine/properties.d.mts +4 -4
  128. package/node_modules/typebox/build/schema/engine/properties.mjs +3 -4
  129. package/node_modules/typebox/build/schema/engine/propertyNames.d.mts +4 -4
  130. package/node_modules/typebox/build/schema/engine/propertyNames.mjs +10 -7
  131. package/node_modules/typebox/build/schema/engine/recursiveRef.d.mts +4 -4
  132. package/node_modules/typebox/build/schema/engine/recursiveRef.mjs +8 -12
  133. package/node_modules/typebox/build/schema/engine/ref.d.mts +4 -4
  134. package/node_modules/typebox/build/schema/engine/ref.mjs +14 -18
  135. package/node_modules/typebox/build/schema/engine/required.d.mts +4 -4
  136. package/node_modules/typebox/build/schema/engine/required.mjs +6 -2
  137. package/node_modules/typebox/build/schema/engine/schema.d.mts +7 -7
  138. package/node_modules/typebox/build/schema/engine/schema.mjs +138 -136
  139. package/node_modules/typebox/build/schema/engine/type.d.mts +4 -4
  140. package/node_modules/typebox/build/schema/engine/type.mjs +6 -2
  141. package/node_modules/typebox/build/schema/engine/unevaluatedItems.d.mts +4 -4
  142. package/node_modules/typebox/build/schema/engine/unevaluatedItems.mjs +9 -5
  143. package/node_modules/typebox/build/schema/engine/unevaluatedProperties.d.mts +4 -4
  144. package/node_modules/typebox/build/schema/engine/unevaluatedProperties.mjs +9 -5
  145. package/node_modules/typebox/build/schema/engine/uniqueItems.d.mts +4 -4
  146. package/node_modules/typebox/build/schema/engine/uniqueItems.mjs +6 -2
  147. package/node_modules/typebox/build/schema/errors.mjs +1 -1
  148. package/node_modules/typebox/build/schema/intern/intern.d.mts +9 -6
  149. package/node_modules/typebox/build/schema/intern/intern.mjs +56 -90
  150. package/node_modules/typebox/build/schema/parse.mjs +0 -3
  151. package/node_modules/typebox/build/schema/pointer/pointer.d.mts +6 -1
  152. package/node_modules/typebox/build/schema/pointer/pointer.mjs +64 -47
  153. package/node_modules/typebox/build/schema/resolve/resolve.d.mts +32 -6
  154. package/node_modules/typebox/build/schema/resolve/resolve.mjs +227 -231
  155. package/node_modules/typebox/build/schema/schema.d.mts +0 -1
  156. package/node_modules/typebox/build/schema/schema.mjs +0 -1
  157. package/node_modules/typebox/build/system/hashing/hash.mjs +34 -63
  158. package/node_modules/typebox/build/system/locale/en_US.mjs +1 -2
  159. package/node_modules/typebox/build/system/memory/assign.d.mts +8 -2
  160. package/node_modules/typebox/build/system/memory/assign.mjs +6 -13
  161. package/node_modules/typebox/build/system/memory/clone.d.mts +5 -4
  162. package/node_modules/typebox/build/system/memory/clone.mjs +96 -8
  163. package/node_modules/typebox/build/system/memory/create.d.mts +5 -1
  164. package/node_modules/typebox/build/system/memory/create.mjs +13 -18
  165. package/node_modules/typebox/build/system/memory/discard.d.mts +1 -1
  166. package/node_modules/typebox/build/system/memory/discard.mjs +8 -9
  167. package/node_modules/typebox/build/system/memory/freeze.d.mts +4 -0
  168. package/node_modules/typebox/build/system/memory/freeze.mjs +6 -0
  169. package/node_modules/typebox/build/system/memory/update.d.mts +4 -1
  170. package/node_modules/typebox/build/system/memory/update.mjs +16 -43
  171. package/node_modules/typebox/build/system/settings/settings.d.mts +0 -11
  172. package/node_modules/typebox/build/system/settings/settings.mjs +0 -14
  173. package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +24 -2
  174. package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +29 -2
  175. package/node_modules/typebox/build/type/engine/evaluate/index.d.mts +0 -1
  176. package/node_modules/typebox/build/type/engine/evaluate/index.mjs +0 -1
  177. package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +1 -5
  178. package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +1 -6
  179. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.d.mts +3 -1
  180. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +4 -1
  181. package/node_modules/typebox/build/type/engine/object/from_intersect.d.mts +2 -2
  182. package/node_modules/typebox/build/type/engine/object/from_intersect.mjs +2 -2
  183. package/node_modules/typebox/build/type/engine/object/from_union.d.mts +2 -2
  184. package/node_modules/typebox/build/type/engine/object/from_union.mjs +2 -2
  185. package/node_modules/typebox/build/type/engine/optional/instantiate_add.d.mts +3 -1
  186. package/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +4 -1
  187. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.d.mts +3 -1
  188. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +4 -1
  189. package/node_modules/typebox/build/type/extends/inference.d.mts +1 -1
  190. package/node_modules/typebox/build/type/extends/inference.mjs +2 -15
  191. package/node_modules/typebox/build/type/extends/tuple.d.mts +1 -2
  192. package/node_modules/typebox/build/type/extends/tuple.mjs +1 -21
  193. package/node_modules/typebox/build/value/clean/from_object.mjs +1 -1
  194. package/node_modules/typebox/build/value/clone/clone.d.mts +3 -4
  195. package/node_modules/typebox/build/value/clone/clone.mjs +7 -5
  196. package/node_modules/typebox/build/value/parse/parse.mjs +4 -10
  197. package/node_modules/typebox/build/value/shared/union_priority_sort.mjs +14 -25
  198. package/node_modules/typebox/package.json +1 -1
  199. package/node_modules/typebox/readme.md +84 -52
  200. package/package.json +11 -3
  201. package/skills/pi-proactive/SKILL.md +27 -24
  202. package/tools/cli.mjs +121 -0
  203. package/tools/daemon-install.sh +397 -0
  204. package/tools/daemon-uninstall.sh +226 -0
  205. package/node_modules/typebox/build/guard/unicode/unicode.d.mts +0 -6
  206. package/node_modules/typebox/build/guard/unicode/unicode.mjs +0 -35
  207. package/node_modules/typebox/build/schema/engine/_pathing.d.mts +0 -1
  208. package/node_modules/typebox/build/schema/engine/_pathing.mjs +0 -11
  209. package/node_modules/typebox/build/schema/meta/draft_2019_09.d.mts +0 -2
  210. package/node_modules/typebox/build/schema/meta/draft_2019_09.mjs +0 -288
  211. package/node_modules/typebox/build/schema/meta/draft_2020_12.d.mts +0 -2
  212. package/node_modules/typebox/build/schema/meta/draft_2020_12.mjs +0 -300
  213. package/node_modules/typebox/build/schema/meta/draft_3.d.mts +0 -2
  214. package/node_modules/typebox/build/schema/meta/draft_3.mjs +0 -143
  215. package/node_modules/typebox/build/schema/meta/draft_4.d.mts +0 -2
  216. package/node_modules/typebox/build/schema/meta/draft_4.mjs +0 -149
  217. package/node_modules/typebox/build/schema/meta/draft_6.d.mts +0 -2
  218. package/node_modules/typebox/build/schema/meta/draft_6.mjs +0 -155
  219. package/node_modules/typebox/build/schema/meta/draft_7.d.mts +0 -2
  220. package/node_modules/typebox/build/schema/meta/draft_7.mjs +0 -172
  221. package/node_modules/typebox/build/schema/meta/index.d.mts +0 -2
  222. package/node_modules/typebox/build/schema/meta/index.mjs +0 -2
  223. package/node_modules/typebox/build/schema/meta/meta.d.mts +0 -9
  224. package/node_modules/typebox/build/schema/meta/meta.mjs +0 -15
  225. package/node_modules/typebox/build/schema/meta/schema.d.mts +0 -6
  226. package/node_modules/typebox/build/schema/meta/schema.mjs +0 -1
  227. package/node_modules/typebox/build/system/memory/deep.d.mts +0 -2
  228. package/node_modules/typebox/build/system/memory/deep.mjs +0 -108
  229. package/node_modules/typebox/build/system/memory/finalize.d.mts +0 -4
  230. package/node_modules/typebox/build/system/memory/finalize.mjs +0 -30
  231. package/node_modules/typebox/build/system/memory/keys.d.mts +0 -2
  232. package/node_modules/typebox/build/system/memory/keys.mjs +0 -8
  233. package/node_modules/typebox/build/system/settings/internal.d.mts +0 -2
  234. package/node_modules/typebox/build/system/settings/internal.mjs +0 -20
  235. package/node_modules/typebox/build/type/engine/call/index.d.mts +0 -1
  236. package/node_modules/typebox/build/type/engine/call/index.mjs +0 -1
  237. package/node_modules/typebox/build/type/engine/evaluate/property.d.mts +0 -30
  238. package/node_modules/typebox/build/type/engine/evaluate/property.mjs +0 -29
  239. package/node_modules/typebox/build/type/engine/this/index.d.mts +0 -1
  240. package/node_modules/typebox/build/type/engine/this/index.mjs +0 -1
  241. package/node_modules/typebox/build/value/repair/from_cyclic.d.mts +0 -2
  242. package/node_modules/typebox/build/value/repair/from_cyclic.mjs +0 -6
  243. /package/node_modules/typebox/build/guard/{unicode/unicode_segment.d.mts → string.d.mts} +0 -0
@@ -1,108 +0,0 @@
1
- // deno-fmt-ignore-file
2
- import { Guard, GlobalsGuard } from '../../guard/index.mjs';
3
- // ------------------------------------------------------------------
4
- // ClassInstance
5
- //
6
- // TypeBox does not clone arbitrary class instances. Class instances
7
- // cannot be safely cloned without potentially breaking private
8
- // members of the instance.
9
- //
10
- // ------------------------------------------------------------------
11
- function FromClassInstance(value) {
12
- return value; // atomic
13
- }
14
- // ------------------------------------------------------------------
15
- // SchemaObject
16
- //
17
- // Schema objects have non-enumerable properties that MUST be preserved
18
- // on Clone. The following is the optimal path these objects.
19
- // ------------------------------------------------------------------
20
- function IsSchemaObject(value) {
21
- return (Guard.HasPropertyKey(value, '~kind') ||
22
- Guard.HasPropertyKey(value, '~unsafe'));
23
- }
24
- function FromSchemaObject(value) {
25
- const result = {};
26
- for (const key of Guard.Keys(value)) {
27
- if (Guard.IsUnsafePropertyKey(key))
28
- continue; // (ignore: prototype-pollution)
29
- const descriptor = Object.getOwnPropertyDescriptor(value, key); // safe-name!
30
- descriptor.value = FromValue(descriptor.value);
31
- if (Guard.IsEqual(descriptor.enumerable, true)) {
32
- result[key] = descriptor.value;
33
- }
34
- else {
35
- Object.defineProperty(result, key, descriptor);
36
- }
37
- }
38
- return result;
39
- }
40
- // ------------------------------------------------------------------
41
- // PlainObject
42
- // ------------------------------------------------------------------
43
- function FromPlainObject(value) {
44
- const result = {};
45
- for (const key of Guard.Keys(value)) {
46
- if (Guard.IsUnsafePropertyKey(key))
47
- continue; // (ignore: prototype-pollution)
48
- result[key] = FromValue(value[key]);
49
- }
50
- for (const key of Guard.Symbols(value)) {
51
- result[key] = FromValue(value[key]);
52
- }
53
- return result;
54
- }
55
- // ------------------------------------------------------------------
56
- // Object
57
- // ------------------------------------------------------------------
58
- function FromObject(value) {
59
- return (Guard.IsClassInstance(value) ? FromClassInstance(value) :
60
- IsSchemaObject(value) ? FromSchemaObject(value) :
61
- FromPlainObject(value));
62
- }
63
- // ------------------------------------------------------------------
64
- // Array
65
- // ------------------------------------------------------------------
66
- function FromArray(value) {
67
- return value.map((element) => FromValue(element));
68
- }
69
- // ------------------------------------------------------------------
70
- // TypeArray
71
- // ------------------------------------------------------------------
72
- function FromTypedArray(value) {
73
- return value.slice();
74
- }
75
- // ------------------------------------------------------------------
76
- // RegExp
77
- // ------------------------------------------------------------------
78
- function FromRegExp(value) {
79
- return new RegExp(value.source, value.flags);
80
- }
81
- // ------------------------------------------------------------------
82
- // Map
83
- // ------------------------------------------------------------------
84
- function FromMap(value) {
85
- return new Map(FromValue([...value.entries()]));
86
- }
87
- // ------------------------------------------------------------------
88
- // Set
89
- // ------------------------------------------------------------------
90
- function FromSet(value) {
91
- return new Set(FromValue([...value.values()]));
92
- }
93
- function FromValue(value) {
94
- return (GlobalsGuard.IsTypeArray(value) ? FromTypedArray(value) :
95
- GlobalsGuard.IsRegExp(value) ? FromRegExp(value) :
96
- GlobalsGuard.IsMap(value) ? FromMap(value) :
97
- GlobalsGuard.IsSet(value) ? FromSet(value) :
98
- Guard.IsArray(value) ? FromArray(value) :
99
- Guard.IsObject(value) ? FromObject(value) :
100
- value);
101
- }
102
- // ------------------------------------------------------------------
103
- // Deep
104
- // ------------------------------------------------------------------
105
- /** Returns a deep Clone of the given value. This function is similar to structuredClone() but also supports deep cloning instances of Map, Set and TypeArray. */
106
- export function Deep(value) {
107
- return FromValue(value);
108
- }
@@ -1,4 +0,0 @@
1
- type ObjectLike = Record<PropertyKey, any>;
2
- /** Finalizes a type. Will recursively freeze if `immutableTypes` is true, otherwise no action. */
3
- export declare function Finalize(value: ObjectLike): ObjectLike;
4
- export {};
@@ -1,30 +0,0 @@
1
- // deno-lint-ignore-file no-explicit-any
2
- import { Guard } from '../../guard/index.mjs';
3
- import { Settings } from '../settings/index.mjs';
4
- import { Keys } from './keys.mjs';
5
- // ------------------------------------------------------------------
6
- // Freeze
7
- // ------------------------------------------------------------------
8
- function Freeze(value, seen) {
9
- if (seen.has(value))
10
- return;
11
- seen.add(value);
12
- for (const key of Keys(value)) {
13
- const descriptor = Object.getOwnPropertyDescriptor(value, key);
14
- if (!descriptor || !('value' in descriptor))
15
- continue;
16
- if (Guard.IsObject(descriptor.value))
17
- Freeze(descriptor.value, seen);
18
- }
19
- Object.freeze(value);
20
- }
21
- // ------------------------------------------------------------------
22
- // Finalize
23
- // ------------------------------------------------------------------
24
- /** Finalizes a type. Will recursively freeze if `immutableTypes` is true, otherwise no action. */
25
- export function Finalize(value) {
26
- if (!Settings.Get().immutableTypes)
27
- return value;
28
- Freeze(value, new WeakSet());
29
- return value;
30
- }
@@ -1,2 +0,0 @@
1
- /** Returns the own string and symbol keys of the given object. */
2
- export declare function Keys(value: Record<PropertyKey, unknown>): PropertyKey[];
@@ -1,8 +0,0 @@
1
- import { Guard } from '../../guard/index.mjs';
2
- // ------------------------------------------------------------------
3
- // Keys (alternatively, Reflect.ownKeys(...))
4
- // ------------------------------------------------------------------
5
- /** Returns the own string and symbol keys of the given object. */
6
- export function Keys(value) {
7
- return [...Guard.Keys(value), ...Guard.Symbols(value)];
8
- }
@@ -1,2 +0,0 @@
1
- export declare function EnableParseErrors(): void;
2
- export declare function DisableParseErrors(): void;
@@ -1,20 +0,0 @@
1
- import { Get } from './settings.mjs';
2
- // ------------------------------------------------------------------
3
- // TempMaxErrors
4
- // ------------------------------------------------------------------
5
- let TempMaxErrors = 0;
6
- // ------------------------------------------------------------------
7
- // [Internal] EnableParseErrors
8
- // ------------------------------------------------------------------
9
- export function EnableParseErrors() {
10
- const settings = Get();
11
- TempMaxErrors = settings.maxErrors;
12
- settings.maxErrors = settings.maxParseErrors;
13
- }
14
- // ------------------------------------------------------------------
15
- // [Internal] DisableParseErrors
16
- // ------------------------------------------------------------------
17
- export function DisableParseErrors() {
18
- const settings = Get();
19
- settings.maxErrors = TempMaxErrors;
20
- }
@@ -1 +0,0 @@
1
- export * from './instantiate.mjs';
@@ -1 +0,0 @@
1
- export * from './instantiate.mjs';
@@ -1,30 +0,0 @@
1
- import { type TSchema } from '../../types/schema.mjs';
2
- import { type TOptional } from '../../types/_optional.mjs';
3
- import { type TReadonly } from '../../types/_readonly.mjs';
4
- import { type TAddOptionalAction } from '../optional/instantiate_add.mjs';
5
- import { type TAddReadonlyAction } from '../readonly/instantiate_add.mjs';
6
- import { type TRemoveOptionalAction } from '../optional/instantiate_remove.mjs';
7
- import { type TRemoveReadonlyAction } from '../readonly/instantiate_remove.mjs';
8
- import { type TEvaluateIntersect, type TEvaluateUnion } from './evaluate.mjs';
9
- export type TEvaluatePropertyIntersect<Left extends TSchema, Right extends TSchema, IsReadonly extends boolean = Left extends TReadonly ? Right extends TReadonly ? true : false : false, IsOptional extends boolean = Left extends TOptional ? Right extends TOptional ? true : false : false, Evaluated extends TSchema = TEvaluateIntersect<[Left, Right]>, Property extends TSchema = TRemoveReadonlyAction<TRemoveOptionalAction<Evaluated>>> = ([
10
- IsReadonly,
11
- IsOptional
12
- ] extends [true, true] ? TAddReadonlyAction<TAddOptionalAction<Property>> : [
13
- IsReadonly,
14
- IsOptional
15
- ] extends [true, false] ? TAddReadonlyAction<Property> : [
16
- IsReadonly,
17
- IsOptional
18
- ] extends [false, true] ? TAddOptionalAction<Property> : Property);
19
- export declare function EvaluatePropertyIntersect<Left extends TSchema, Right extends TSchema>(left: Left, right: Right): TEvaluatePropertyIntersect<Left, Right>;
20
- export type TEvaluatePropertyUnion<Left extends TSchema, Right extends TSchema, IsReadonly extends boolean = Left extends TReadonly ? true : Right extends TReadonly ? true : false, IsOptional extends boolean = Left extends TOptional ? true : Right extends TOptional ? true : false, LeftProperty extends TSchema = TRemoveReadonlyAction<TRemoveOptionalAction<Left>>, RightProperty extends TSchema = TRemoveReadonlyAction<TRemoveOptionalAction<Right>>, Property extends TSchema = TEvaluateUnion<[LeftProperty, RightProperty]>> = ([
21
- IsReadonly,
22
- IsOptional
23
- ] extends [true, true] ? TAddReadonlyAction<TAddOptionalAction<Property>> : [
24
- IsReadonly,
25
- IsOptional
26
- ] extends [true, false] ? TAddReadonlyAction<Property> : [
27
- IsReadonly,
28
- IsOptional
29
- ] extends [false, true] ? TAddOptionalAction<Property> : Property);
30
- export declare function EvaluatePropertyUnion<Left extends TSchema, Right extends TSchema>(left: Left, right: Right): TEvaluatePropertyUnion<Left, Right>;
@@ -1,29 +0,0 @@
1
- // deno-fmt-ignore-file
2
- import { IsOptional } from '../../types/_optional.mjs';
3
- import { IsReadonly } from '../../types/_readonly.mjs';
4
- import { AddOptionalAction } from '../optional/instantiate_add.mjs';
5
- import { AddReadonlyAction } from '../readonly/instantiate_add.mjs';
6
- import { RemoveOptionalAction } from '../optional/instantiate_remove.mjs';
7
- import { RemoveReadonlyAction } from '../readonly/instantiate_remove.mjs';
8
- import { EvaluateIntersect, EvaluateUnion } from './evaluate.mjs';
9
- export function EvaluatePropertyIntersect(left, right) {
10
- const isReadonly = IsReadonly(left) && IsReadonly(right);
11
- const isOptional = IsOptional(left) && IsOptional(right);
12
- const evaluated = EvaluateIntersect([left, right]);
13
- const property = RemoveReadonlyAction(RemoveOptionalAction(evaluated, {}), {});
14
- return (isReadonly && isOptional ? AddReadonlyAction(AddOptionalAction(property, {}), {}) :
15
- isReadonly ? AddReadonlyAction(property, {}) :
16
- isOptional ? AddOptionalAction(property, {}) :
17
- property);
18
- }
19
- export function EvaluatePropertyUnion(left, right) {
20
- const isReadonly = IsReadonly(left) || IsReadonly(right);
21
- const isOptional = IsOptional(left) || IsOptional(right);
22
- const leftProperty = RemoveReadonlyAction(RemoveOptionalAction(left, {}), {});
23
- const rightProperty = RemoveReadonlyAction(RemoveOptionalAction(right, {}), {});
24
- const property = EvaluateUnion([leftProperty, rightProperty]);
25
- return (isReadonly && isOptional ? AddReadonlyAction(AddOptionalAction(property, {}), {}) :
26
- isReadonly ? AddReadonlyAction(property, {}) :
27
- isOptional ? AddOptionalAction(property, {}) :
28
- property);
29
- }
@@ -1 +0,0 @@
1
- export * from './expand_this.mjs';
@@ -1 +0,0 @@
1
- export * from './expand_this.mjs';
@@ -1,2 +0,0 @@
1
- import { type TProperties, type TCyclic } from '../../type/index.mjs';
2
- export declare function FromCyclic(context: TProperties, type: TCyclic, value: unknown): unknown;
@@ -1,6 +0,0 @@
1
- // deno-fmt-ignore-file
2
- import { Ref } from '../../type/index.mjs';
3
- import { FromType } from './from_type.mjs';
4
- export function FromCyclic(context, type, value) {
5
- return FromType({ ...context, ...type.$defs }, Ref(type.$ref), value);
6
- }