@openclaw/imessage 2026.10.10 → 2026.11.5-beta.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.
Files changed (137) hide show
  1. package/dist/.setup/{accounts-BH0coL46.mjs → accounts-C1Ypv3Wn.mjs} +6 -7
  2. package/dist/.setup/{actions-CW7XYYF4.mjs → actions-qOuKy8To.mjs} +360 -108
  3. package/dist/.setup/{actions.runtime-B2ZHQ3TJ.mjs → actions.runtime-Ccg9CARL.mjs} +10 -56
  4. package/dist/.setup/{api-6xi-NBrt.mjs → api-BXXuQQCS.mjs} +7 -7
  5. package/dist/.setup/{api-B0ih8Iof.mjs → api-DTbxSOPc.mjs} +8 -8
  6. package/dist/.setup/{approval-handler.runtime-BKmqba3L.mjs → approval-handler.runtime-B6vrFfZx.mjs} +112 -131
  7. package/dist/.setup/{approval-reactions-B9CJS0NT.mjs → approval-reactions-DBBsqbRC.mjs} +152 -72
  8. package/dist/.setup/{channel-6kcKpSRw.mjs → channel-CLaN4mQn.mjs} +142 -119
  9. package/dist/.setup/{channel.runtime-BW4A0m4h.mjs → channel.runtime-XJGx1MIH.mjs} +205 -363
  10. package/dist/.setup/chat-context-fTfJVqAi.mjs +77 -0
  11. package/dist/.setup/chat-lookup-xtPsOBkl.mjs +50 -0
  12. package/dist/.setup/client-D_BaG8sC.mjs +367 -0
  13. package/dist/.setup/{config-schema-DRkdRC21.mjs → config-schema-BjkQV5P5.mjs} +1 -2
  14. package/dist/.setup/{conversation-bindings-vZFn6sN2.mjs → conversation-bindings-8DjxoIYU.mjs} +9 -6
  15. package/dist/.setup/{media-contract-CoixpXRX.mjs → media-contract-BErFBKV9.mjs} +1 -1
  16. package/dist/.setup/{message-tool-api-CxSY_rh7.mjs → message-tool-api-DtZ1wKbT.mjs} +3 -6
  17. package/dist/.setup/{remote-file-CCgMYZ-u.mjs → remote-file-DpK3GQFD.mjs} +8 -22
  18. package/dist/.setup/{sanitize-outbound-C02fJrn6.mjs → sanitize-outbound-Dhjhz0a-.mjs} +23 -27
  19. package/dist/.setup/{send-D98hQFdv.mjs → send-DhEW0gfe.mjs} +150 -226
  20. package/dist/.setup/{setup-core-BWnW0czE.mjs → setup-core-B1_P_t4T.mjs} +2 -2
  21. package/dist/.setup/{setup-surface-aRZhAzzQ.mjs → setup-surface-CD28mXWK.mjs} +11 -25
  22. package/dist/.setup/{targets-CIx4BKqL.mjs → targets-C7CIWJ0k.mjs} +12 -3
  23. package/dist/.source-module-urls/929c518fa2986b0f85f66bceefead22868db0ab452dee914dc6a2bb86b2e60ad.json +1 -1
  24. package/dist/api.js +8 -8
  25. package/dist/channel-config-api.js +1 -1
  26. package/dist/channel-plugin-api.js +1 -1
  27. package/dist/contract-api.js +1 -1
  28. package/dist/media-contract-api.js +1 -1
  29. package/dist/message-tool-api.js +1 -1
  30. package/dist/runtime-api.js +1 -3
  31. package/dist/session-binding-contract-api.js +1 -1
  32. package/dist/setup-entry.js +1 -1
  33. package/dist/src/chat-db.worker.js +1 -1
  34. package/node_modules/typebox/build/format/duration.d.mts +2 -2
  35. package/node_modules/typebox/build/format/duration.mjs +2 -2
  36. package/node_modules/typebox/build/format/idn_email.d.mts +1 -0
  37. package/node_modules/typebox/build/format/idn_email.mjs +1 -0
  38. package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -1
  39. package/node_modules/typebox/build/format/idn_hostname.mjs +1 -1
  40. package/node_modules/typebox/build/format/ipv4.d.mts +2 -2
  41. package/node_modules/typebox/build/format/ipv4.mjs +2 -2
  42. package/node_modules/typebox/build/format/ipv6.d.mts +1 -1
  43. package/node_modules/typebox/build/format/ipv6.mjs +1 -1
  44. package/node_modules/typebox/build/format/relative_json_pointer.d.mts +2 -2
  45. package/node_modules/typebox/build/format/relative_json_pointer.mjs +2 -2
  46. package/node_modules/typebox/build/schema/build.mjs +1 -0
  47. package/node_modules/typebox/build/schema/engine/_unique.d.mts +4 -2
  48. package/node_modules/typebox/build/schema/engine/_unique.mjs +7 -3
  49. package/node_modules/typebox/build/schema/engine/additionalItems.mjs +3 -3
  50. package/node_modules/typebox/build/schema/engine/additionalProperties.d.mts +0 -3
  51. package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +15 -17
  52. package/node_modules/typebox/build/schema/engine/contains.mjs +3 -3
  53. package/node_modules/typebox/build/schema/engine/index.d.mts +1 -0
  54. package/node_modules/typebox/build/schema/engine/index.mjs +1 -0
  55. package/node_modules/typebox/build/schema/engine/items.mjs +7 -4
  56. package/node_modules/typebox/build/schema/engine/maxContains.mjs +2 -2
  57. package/node_modules/typebox/build/schema/engine/minContains.mjs +3 -3
  58. package/node_modules/typebox/build/schema/engine/oneOf.mjs +2 -2
  59. package/node_modules/typebox/build/schema/engine/patternProperties.mjs +2 -2
  60. package/node_modules/typebox/build/schema/engine/propertyNames.mjs +2 -2
  61. package/node_modules/typebox/build/schema/engine/unevaluatedItems.mjs +2 -2
  62. package/node_modules/typebox/build/schema/engine/unevaluatedProperties.mjs +2 -2
  63. package/node_modules/typebox/build/system/hashing/hash.mjs +63 -34
  64. package/node_modules/typebox/build/system/locale/en_US.mjs +2 -1
  65. package/node_modules/typebox/build/system/memory/assign.d.mts +2 -8
  66. package/node_modules/typebox/build/system/memory/assign.mjs +13 -6
  67. package/node_modules/typebox/build/system/memory/clone.d.mts +4 -5
  68. package/node_modules/typebox/build/system/memory/clone.mjs +8 -96
  69. package/node_modules/typebox/build/system/memory/create.d.mts +1 -5
  70. package/node_modules/typebox/build/system/memory/create.mjs +18 -13
  71. package/node_modules/typebox/build/system/memory/deep.d.mts +2 -0
  72. package/node_modules/typebox/build/system/memory/deep.mjs +108 -0
  73. package/node_modules/typebox/build/system/memory/discard.d.mts +1 -1
  74. package/node_modules/typebox/build/system/memory/discard.mjs +9 -8
  75. package/node_modules/typebox/build/system/memory/finalize.d.mts +4 -0
  76. package/node_modules/typebox/build/system/memory/finalize.mjs +30 -0
  77. package/node_modules/typebox/build/system/memory/keys.d.mts +2 -0
  78. package/node_modules/typebox/build/system/memory/keys.mjs +8 -0
  79. package/node_modules/typebox/build/system/memory/update.d.mts +1 -4
  80. package/node_modules/typebox/build/system/memory/update.mjs +43 -16
  81. package/node_modules/typebox/build/type/engine/call/index.d.mts +1 -0
  82. package/node_modules/typebox/build/type/engine/call/index.mjs +1 -0
  83. package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +2 -24
  84. package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +2 -29
  85. package/node_modules/typebox/build/type/engine/evaluate/index.d.mts +1 -0
  86. package/node_modules/typebox/build/type/engine/evaluate/index.mjs +1 -0
  87. package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +5 -1
  88. package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +6 -1
  89. package/node_modules/typebox/build/type/engine/evaluate/property.d.mts +30 -0
  90. package/node_modules/typebox/build/type/engine/evaluate/property.mjs +29 -0
  91. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.d.mts +1 -3
  92. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +1 -4
  93. package/node_modules/typebox/build/type/engine/object/from_intersect.d.mts +2 -2
  94. package/node_modules/typebox/build/type/engine/object/from_intersect.mjs +2 -2
  95. package/node_modules/typebox/build/type/engine/object/from_union.d.mts +2 -2
  96. package/node_modules/typebox/build/type/engine/object/from_union.mjs +2 -2
  97. package/node_modules/typebox/build/type/engine/optional/instantiate_add.d.mts +1 -3
  98. package/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +1 -4
  99. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.d.mts +1 -3
  100. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +1 -4
  101. package/node_modules/typebox/build/type/engine/this/index.d.mts +1 -0
  102. package/node_modules/typebox/build/type/engine/this/index.mjs +1 -0
  103. package/node_modules/typebox/build/value/clone/clone.d.mts +4 -3
  104. package/node_modules/typebox/build/value/clone/clone.mjs +5 -7
  105. package/node_modules/typebox/build/value/repair/from_cyclic.d.mts +2 -0
  106. package/node_modules/typebox/build/value/repair/from_cyclic.mjs +6 -0
  107. package/node_modules/typebox/build/value/shared/union_priority_sort.mjs +25 -14
  108. package/node_modules/typebox/package.json +1 -1
  109. package/node_modules/typebox/readme.md +1 -1
  110. package/node_modules/zod/package.json +1 -1
  111. package/node_modules/zod/src/v4/classic/tests/array.test.ts +27 -0
  112. package/node_modules/zod/src/v4/classic/tests/map.test.ts +7 -0
  113. package/node_modules/zod/src/v4/classic/tests/set.test.ts +6 -0
  114. package/node_modules/zod/src/v4/core/compile.ts +9 -0
  115. package/node_modules/zod/src/v4/core/schemas.ts +35 -1
  116. package/node_modules/zod/src/v4/core/util.ts +13 -0
  117. package/node_modules/zod/src/v4/core/versions.ts +1 -1
  118. package/node_modules/zod/v4/core/compile.cjs +8 -0
  119. package/node_modules/zod/v4/core/compile.js +8 -0
  120. package/node_modules/zod/v4/core/schemas.cjs +30 -0
  121. package/node_modules/zod/v4/core/schemas.d.cts +3 -1
  122. package/node_modules/zod/v4/core/schemas.d.ts +3 -1
  123. package/node_modules/zod/v4/core/schemas.js +30 -0
  124. package/node_modules/zod/v4/core/util.cjs +15 -0
  125. package/node_modules/zod/v4/core/util.d.cts +2 -0
  126. package/node_modules/zod/v4/core/util.d.ts +2 -0
  127. package/node_modules/zod/v4/core/util.js +14 -0
  128. package/node_modules/zod/v4/core/versions.cjs +1 -1
  129. package/node_modules/zod/v4/core/versions.js +1 -1
  130. package/openclaw.plugin.json +0 -30
  131. package/package.json +6 -6
  132. package/dist/.setup/client-C3e7ZLqA.mjs +0 -739
  133. package/dist/.setup/question-reactions-DTj-VH3N.mjs +0 -67
  134. package/dist/.setup/reaction-context-Bw00FkmU.mjs +0 -105
  135. package/dist/.setup/runtime-BRQCPuAD.mjs +0 -7
  136. package/node_modules/typebox/build/system/memory/freeze.d.mts +0 -4
  137. package/node_modules/typebox/build/system/memory/freeze.mjs +0 -6
@@ -1,6 +1,6 @@
1
1
  // deno-fmt-ignore-file
2
2
  import * as Schema from '../types/index.mjs';
3
- import { Unique } from './_unique.mjs';
3
+ import * as Unique from './_unique.mjs';
4
4
  import { Guard as G, EmitGuard as E } from '../../guard/index.mjs';
5
5
  import { BuildSchema, CheckSchema } from './schema.mjs';
6
6
  // ------------------------------------------------------------------
@@ -13,12 +13,12 @@ function IsValid(schema) {
13
13
  // Build
14
14
  // ------------------------------------------------------------------
15
15
  function BuildMinContainsStandard(stack, context, schema, value) {
16
- const [item, index] = [Unique(), Unique()];
16
+ const [item, index] = [Unique.CreateUnique(), Unique.CreateUnique()];
17
17
  const count = E.Counted(value, [item, index], E.And(BuildSchema(stack, context, schema.contains, item), context.AddIndex(index)));
18
18
  return E.IsGreaterEqualThan(count, E.Constant(schema.minContains));
19
19
  }
20
20
  function BuildMinContainsFast(stack, context, schema, value) {
21
- const [item] = [Unique()];
21
+ const [item] = [Unique.CreateUnique()];
22
22
  const count = E.Counted(value, [item, '_'], BuildSchema(stack, context, schema.contains, item));
23
23
  return E.IsGreaterEqualThan(count, E.Constant(schema.minContains));
24
24
  }
@@ -1,6 +1,6 @@
1
1
  // deno-fmt-ignore-file
2
2
  import { Reducer } from './_reducer.mjs';
3
- import { Unique } from './_unique.mjs';
3
+ import * as Unique from './_unique.mjs';
4
4
  import { CheckContext, ErrorContext } from './_context.mjs';
5
5
  import { BuildSchema, CheckSchema, ErrorSchema } from './schema.mjs';
6
6
  import { EmitGuard as E, Guard as G } from '../../guard/index.mjs';
@@ -11,7 +11,7 @@ function BuildOneOfStandard(stack, context, schema, value) {
11
11
  return Reducer(stack, context, schema.oneOf, value, E.IsEqual(E.Member('results', 'length'), E.Constant(1)));
12
12
  }
13
13
  function BuildOneOfFast(stack, context, schema, value) {
14
- const [result] = [Unique()];
14
+ const [result] = [Unique.CreateUnique()];
15
15
  const results = E.ArrayLiteral(schema.oneOf.map((schema) => BuildSchema(stack, context, schema, value)));
16
16
  const count = E.Counted(results, [result, '_'], E.IsEqual(result, E.Constant(true)));
17
17
  return E.IsEqual(count, E.Constant(1));
@@ -1,7 +1,7 @@
1
1
  // deno-fmt-ignore-file
2
+ import * as Unique from './_unique.mjs';
2
3
  import * as Externals from './_externals.mjs';
3
4
  import * as Pathing from './_pathing.mjs';
4
- import { Unique } from './_unique.mjs';
5
5
  import { UnicodeRegExp } from './_regexp.mjs';
6
6
  import { BuildSchemaPushStack, CheckSchemaPushStack, ErrorSchemaPushStack } from './schema.mjs';
7
7
  import { Guard as G, EmitGuard as E } from '../../guard/index.mjs';
@@ -10,7 +10,7 @@ import { Guard as G, EmitGuard as E } from '../../guard/index.mjs';
10
10
  // ------------------------------------------------------------------
11
11
  export function BuildPatternProperties(stack, context, schema, value) {
12
12
  return E.ReduceAnd(G.Entries(schema.patternProperties).map(([pattern, schema]) => {
13
- const [key, prop] = [Unique(), Unique()];
13
+ const [key, prop] = [Unique.CreateUnique(), Unique.CreateUnique()];
14
14
  const regexp = Externals.CreateVariable(UnicodeRegExp(pattern));
15
15
  const notKey = E.Not(E.Call(E.Member(regexp, 'test'), [key]));
16
16
  const isSchema = BuildSchemaPushStack(stack, context, schema, prop);
@@ -1,13 +1,13 @@
1
1
  // deno-fmt-ignore-file
2
2
  import * as Pathing from './_pathing.mjs';
3
- import { Unique } from './_unique.mjs';
3
+ import * as Unique from './_unique.mjs';
4
4
  import { BuildSchema, CheckSchema, ErrorSchema } from './schema.mjs';
5
5
  import { EmitGuard as E, Guard as G } from '../../guard/index.mjs';
6
6
  // ------------------------------------------------------------------
7
7
  // Build
8
8
  // ------------------------------------------------------------------
9
9
  export function BuildPropertyNames(stack, context, schema, value) {
10
- const [key, _index] = [Unique(), Unique()];
10
+ const [key, _index] = [Unique.CreateUnique(), Unique.CreateUnique()];
11
11
  return E.Every(E.Keys(value), E.Constant(0), [key, _index], BuildSchema(stack, context, schema.propertyNames, key));
12
12
  }
13
13
  // ------------------------------------------------------------------
@@ -1,5 +1,5 @@
1
1
  // deno-fmt-ignore-file
2
- import { Unique } from './_unique.mjs';
2
+ import * as Unique from './_unique.mjs';
3
3
  import { ErrorContext } from './_context.mjs';
4
4
  import { BuildSchema, CheckSchema, ErrorSchema } from './schema.mjs';
5
5
  import { Guard as G, EmitGuard as E } from '../../guard/index.mjs';
@@ -7,7 +7,7 @@ import { Guard as G, EmitGuard as E } from '../../guard/index.mjs';
7
7
  // Build
8
8
  // ------------------------------------------------------------------
9
9
  export function BuildUnevaluatedItems(stack, context, schema, value) {
10
- const [index, item] = [Unique(), Unique()];
10
+ const [index, item] = [Unique.CreateUnique(), Unique.CreateUnique()];
11
11
  const indices = E.Call(E.Member('context', 'GetIndices'), []);
12
12
  const hasIndex = E.Call(E.Member('indices', 'has'), [index]);
13
13
  const isSchema = BuildSchema(stack, context, schema.unevaluatedItems, item);
@@ -1,5 +1,5 @@
1
1
  // deno-fmt-ignore-file
2
- import { Unique } from './_unique.mjs';
2
+ import * as Unique from './_unique.mjs';
3
3
  import { ErrorContext } from './_context.mjs';
4
4
  import { BuildSchema, CheckSchema, ErrorSchema } from './schema.mjs';
5
5
  import { Guard as G, EmitGuard as E } from '../../guard/index.mjs';
@@ -7,7 +7,7 @@ import { Guard as G, EmitGuard as E } from '../../guard/index.mjs';
7
7
  // Build
8
8
  // ------------------------------------------------------------------
9
9
  export function BuildUnevaluatedProperties(stack, context, schema, value) {
10
- const [key, prop] = [Unique(), Unique()];
10
+ const [key, prop] = [Unique.CreateUnique(), Unique.CreateUnique()];
11
11
  const keys = E.Call(E.Member('context', 'GetKeys'), []);
12
12
  const hasKey = E.Call(E.Member('keys', 'has'), [key]);
13
13
  const addKey = E.Call(E.Member('context', 'AddKey'), [key]);
@@ -1,16 +1,16 @@
1
1
  // deno-fmt-ignore-file
2
2
  import { Unreachable } from '../unreachable/index.mjs';
3
- import { Guard, GlobalsGuard } from '../../guard/index.mjs';
3
+ import { GlobalsGuard, Guard } from '../../guard/index.mjs';
4
4
  // ------------------------------------------------------------------
5
5
  // InstanceKeys
6
6
  //
7
- // Retrieves all enumerable and non-enumerable own property keys
8
- // and inherited prototype keys (excluding symbols and the 'constructor')
7
+ // Retrieves all enumerable and non-enumerable own property keys
8
+ // and inherited prototype keys (excluding symbols and the 'constructor')
9
9
  // from an object instance.
10
10
  //
11
- // This function is useful for differentiating between class instances
12
- // based on their structural keys rather than relying on the
13
- // constructor name. It provides a more reliable structural comparison
11
+ // This function is useful for differentiating between class instances
12
+ // based on their structural keys rather than relying on the
13
+ // constructor name. It provides a more reliable structural comparison
14
14
  // by capturing both own and prototype properties.
15
15
  //
16
16
  // ------------------------------------------------------------------
@@ -40,38 +40,57 @@ function IsIEEE754(value) {
40
40
  // ------------------------------------------------------------------
41
41
  // ByteMarker
42
42
  // ------------------------------------------------------------------
43
- var ByteMarker;
44
- (function (ByteMarker) {
45
- ByteMarker[ByteMarker["Array"] = 0] = "Array";
46
- ByteMarker[ByteMarker["BigInt"] = 1] = "BigInt";
47
- ByteMarker[ByteMarker["Boolean"] = 2] = "Boolean";
48
- ByteMarker[ByteMarker["Date"] = 3] = "Date";
49
- ByteMarker[ByteMarker["Constructor"] = 4] = "Constructor";
50
- ByteMarker[ByteMarker["Function"] = 5] = "Function";
51
- ByteMarker[ByteMarker["Null"] = 6] = "Null";
52
- ByteMarker[ByteMarker["Number"] = 7] = "Number";
53
- ByteMarker[ByteMarker["Object"] = 8] = "Object";
54
- ByteMarker[ByteMarker["RegExp"] = 9] = "RegExp";
55
- ByteMarker[ByteMarker["String"] = 10] = "String";
56
- ByteMarker[ByteMarker["Symbol"] = 11] = "Symbol";
57
- ByteMarker[ByteMarker["TypeArray"] = 12] = "TypeArray";
58
- ByteMarker[ByteMarker["Undefined"] = 13] = "Undefined";
59
- })(ByteMarker || (ByteMarker = {}));
43
+ const ByteMarker = {
44
+ Array: 0x0,
45
+ BigInt: 0x1,
46
+ Boolean: 0x2,
47
+ Date: 0x3,
48
+ Constructor: 0x4,
49
+ Function: 0x5,
50
+ Null: 0x6,
51
+ Number: 0x7,
52
+ Object: 0x8,
53
+ RegExp: 0x9,
54
+ String: 0xA,
55
+ Symbol: 0xB,
56
+ TypeArray: 0xC,
57
+ Undefined: 0xD
58
+ };
60
59
  // ------------------------------------------------------------------
61
60
  // State
62
61
  // ------------------------------------------------------------------
63
- let Accumulator = BigInt('14695981039346656037');
64
- const [Prime, Size] = [BigInt('1099511628211'), BigInt('18446744073709551616' /* 2 ^ 64 */)];
65
- const Bytes = Array.from({ length: 256 }).map((_, i) => BigInt(i));
62
+ //
63
+ // The 64-bit accumulator is held as four 16-bit limbs (A0 is the least
64
+ // significant) so the FNV1A64 operation can be computed with number
65
+ // arithmetic, avoiding a BigInt multiply and modulo for every byte.
66
+ //
67
+ // Offset: 14695981039346656037 (0xCBF29CE484222325)
68
+ //
69
+ // ------------------------------------------------------------------
70
+ let A0 = 0x2325, A1 = 0x8422, A2 = 0x9CE4, A3 = 0xCBF2;
66
71
  const F64 = new Float64Array(1);
67
72
  const F64In = new DataView(F64.buffer);
68
73
  const F64Out = new Uint8Array(F64.buffer);
69
74
  // ------------------------------------------------------------------
70
75
  // Operation
76
+ //
77
+ // Prime: 1099511628211 (0x100000001B3 = 2^40 + 0x1B3)
78
+ //
79
+ // The multiply is computed as (A * 0x1B3) + (A << 40) modulo 2^64,
80
+ // where (A << 40) adds (A0 << 8) to the third limb and (A1 << 8)
81
+ // to the fourth.
82
+ //
71
83
  // ------------------------------------------------------------------
72
84
  function FNV1A64_OP(byte) {
73
- Accumulator = Accumulator ^ Bytes[byte];
74
- Accumulator = (Accumulator * Prime) % Size;
85
+ const L0 = A0 ^ byte;
86
+ const T0 = L0 * 0x1B3;
87
+ const T1 = A1 * 0x1B3 + (T0 >>> 16);
88
+ const T2 = A2 * 0x1B3 + (T1 >>> 16) + (L0 << 8);
89
+ const T3 = A3 * 0x1B3 + (T2 >>> 16) + (A1 << 8);
90
+ A0 = T0 & 0xFFFF;
91
+ A1 = T1 & 0xFFFF;
92
+ A2 = T2 & 0xFFFF;
93
+ A3 = T3 & 0xFFFF;
75
94
  }
76
95
  // ------------------------------------------------------------------
77
96
  // Array
@@ -159,8 +178,15 @@ function FromRegExp(value) {
159
178
  const encoder = new TextEncoder();
160
179
  function FromString(value) {
161
180
  FNV1A64_OP(ByteMarker.String);
162
- for (const byte of encoder.encode(value)) {
163
- FNV1A64_OP(byte);
181
+ for (let i = 0; i < value.length; i++) {
182
+ const code = value.charCodeAt(i);
183
+ if (code > 0x7F) {
184
+ for (const byte of encoder.encode(value.slice(i))) {
185
+ FNV1A64_OP(byte);
186
+ }
187
+ return;
188
+ }
189
+ FNV1A64_OP(code);
164
190
  }
165
191
  }
166
192
  // ------------------------------------------------------------------
@@ -220,13 +246,16 @@ function FromValue(value) {
220
246
  // ------------------------------------------------------------------
221
247
  // Hash
222
248
  // ------------------------------------------------------------------
249
+ function Hex(limb) {
250
+ return limb.toString(16).padStart(4, '0');
251
+ }
223
252
  /** Generates a FNV1A-64 non cryptographic hash of the given value */
224
253
  export function HashCode(value) {
225
- Accumulator = BigInt('14695981039346656037');
226
- FromValue(value);
227
- return Accumulator;
254
+ return BigInt(`0x${Hash(value)}`);
228
255
  }
229
256
  /** Generates a FNV1A-64 non cryptographic hash of the given value */
230
257
  export function Hash(value) {
231
- return HashCode(value).toString(16).padStart(16, '0');
258
+ A0 = 0x2325, A1 = 0x8422, A2 = 0x9CE4, A3 = 0xCBF2;
259
+ FromValue(value);
260
+ return `${Hex(A3)}${Hex(A2)}${Hex(A1)}${Hex(A0)}`;
232
261
  }
@@ -33,7 +33,8 @@ export function en_US(error) {
33
33
  case 'unevaluatedProperties': return 'must not have unevaluated properties';
34
34
  case 'uniqueItems': return `must not have duplicate items`;
35
35
  case '~refine': return error.params.message;
36
- // deno-coverage-ignore - unreachable
36
+ // deno-coverage-ignore-start - unreachable
37
37
  default: return 'an unknown validation error occurred';
38
+ // deno-coverage-ignore-stop
38
39
  }
39
40
  }
@@ -1,14 +1,8 @@
1
1
  type ObjectLike = Record<PropertyKey, any>;
2
- /**
3
- * Performs an Object assign using the Left and Right object types. We track this operation as it
4
- * creates a new GC handle per assignment.
5
- */
2
+ /** Performs an Object assign using the Left and Right object types. */
6
3
  export type TAssign<Left extends ObjectLike, Right extends ObjectLike, Assigned extends ObjectLike = Omit<Left, keyof Right> & Right> = {
7
4
  [Key in keyof Assigned]: Assigned[Key];
8
5
  } & {};
9
- /**
10
- * Performs an Object assign using the Left and Right object types. We track this operation as it
11
- * creates a new GC handle per assignment.
12
- */
6
+ /** Performs an Object assign using the Left and Right object types. */
13
7
  export declare function Assign<Left extends ObjectLike, Right extends ObjectLike>(left: Left, right: Right): TAssign<Left, Right>;
14
8
  export {};
@@ -1,12 +1,19 @@
1
1
  // deno-lint-ignore-file ban-types no-explicit-any
2
2
  // deno-fmt-ignore-file
3
3
  import { Metrics } from './metrics.mjs';
4
- import { Freeze } from './freeze.mjs';
5
- /**
6
- * Performs an Object assign using the Left and Right object types. We track this operation as it
7
- * creates a new GC handle per assignment.
8
- */
4
+ import { Finalize } from './finalize.mjs';
5
+ import { Keys } from './keys.mjs';
6
+ /** Performs an Object assign using the Left and Right object types. */
9
7
  export function Assign(left, right) {
10
8
  Metrics.assign += 1;
11
- return Freeze({ ...left, ...right });
9
+ const result = {}, rightKeys = Keys(right), leftKeys = Keys(left);
10
+ for (const key of leftKeys) {
11
+ if (rightKeys.includes(key))
12
+ continue;
13
+ Object.defineProperty(result, key, Object.getOwnPropertyDescriptor(left, key));
14
+ }
15
+ for (const key of rightKeys) {
16
+ Object.defineProperty(result, key, Object.getOwnPropertyDescriptor(right, key));
17
+ }
18
+ return Finalize(result);
12
19
  }
@@ -1,5 +1,4 @@
1
- /**
2
- * Returns a Clone of the given value. This function is similar to structuredClone()
3
- * but also supports deep cloning instances of Map, Set and TypeArray.
4
- */
5
- export declare function Clone<Value extends unknown = unknown>(value: Value): Value;
1
+ type ObjectLike = Record<PropertyKey, any>;
2
+ /** Returns a shallow clone of the given object. */
3
+ export declare function Clone<Value extends ObjectLike = ObjectLike>(value: Value): Value;
4
+ export {};
@@ -1,34 +1,19 @@
1
+ // deno-lint-ignore-file no-explicit-any
1
2
  // deno-fmt-ignore-file
2
- import { Guard, GlobalsGuard } from '../../guard/index.mjs';
3
+ import { Guard } from '../../guard/index.mjs';
3
4
  import { Metrics } from './metrics.mjs';
5
+ import { Keys } from './keys.mjs';
4
6
  // ------------------------------------------------------------------
5
- // ClassInstance
6
- //
7
- // TypeBox does not clone arbitrary class instances. Class instances
8
- // cannot be safely cloned without potentially breaking private
9
- // members of the instance.
10
- //
11
- // ------------------------------------------------------------------
12
- function FromClassInstance(value) {
13
- return value; // atomic
14
- }
15
- // ------------------------------------------------------------------
16
- // SchemaObject
17
- //
18
- // Schema objects have non-enumerable properties that MUST be preserved
19
- // on Clone. The following is the optimal path these objects.
7
+ // Clone
20
8
  // ------------------------------------------------------------------
21
- function IsSchemaObject(value) {
22
- return (Guard.HasPropertyKey(value, '~kind') ||
23
- Guard.HasPropertyKey(value, '~unsafe'));
24
- }
25
- function FromSchemaObject(value) {
9
+ /** Returns a shallow clone of the given object. */
10
+ export function Clone(value) {
11
+ Metrics.clone += 1;
26
12
  const result = {};
27
- for (const key of Guard.Keys(value)) {
13
+ for (const key of Keys(value)) {
28
14
  if (Guard.IsUnsafePropertyKey(key))
29
15
  continue; // (ignore: prototype-pollution)
30
16
  const descriptor = Object.getOwnPropertyDescriptor(value, key); // safe-name!
31
- descriptor.value = FromValue(descriptor.value);
32
17
  if (Guard.IsEqual(descriptor.enumerable, true)) {
33
18
  result[key] = descriptor.value;
34
19
  }
@@ -38,76 +23,3 @@ function FromSchemaObject(value) {
38
23
  }
39
24
  return result;
40
25
  }
41
- // ------------------------------------------------------------------
42
- // PlainObject
43
- // ------------------------------------------------------------------
44
- function FromPlainObject(value) {
45
- const result = {};
46
- for (const key of Guard.Keys(value)) {
47
- if (Guard.IsUnsafePropertyKey(key))
48
- continue; // (ignore: prototype-pollution)
49
- result[key] = FromValue(value[key]);
50
- }
51
- for (const key of Guard.Symbols(value)) {
52
- result[key] = FromValue(value[key]);
53
- }
54
- return result;
55
- }
56
- // ------------------------------------------------------------------
57
- // Object
58
- // ------------------------------------------------------------------
59
- function FromObject(value) {
60
- return (Guard.IsClassInstance(value) ? FromClassInstance(value) :
61
- IsSchemaObject(value) ? FromSchemaObject(value) :
62
- FromPlainObject(value));
63
- }
64
- // ------------------------------------------------------------------
65
- // Array
66
- // ------------------------------------------------------------------
67
- function FromArray(value) {
68
- return value.map((element) => FromValue(element));
69
- }
70
- // ------------------------------------------------------------------
71
- // TypeArray
72
- // ------------------------------------------------------------------
73
- function FromTypedArray(value) {
74
- return value.slice();
75
- }
76
- // ------------------------------------------------------------------
77
- // RegExp
78
- // ------------------------------------------------------------------
79
- function FromRegExp(value) {
80
- return new RegExp(value.source, value.flags);
81
- }
82
- // ------------------------------------------------------------------
83
- // Map
84
- // ------------------------------------------------------------------
85
- function FromMap(value) {
86
- return new Map(FromValue([...value.entries()]));
87
- }
88
- // ------------------------------------------------------------------
89
- // Set
90
- // ------------------------------------------------------------------
91
- function FromSet(value) {
92
- return new Set(FromValue([...value.values()]));
93
- }
94
- function FromValue(value) {
95
- return (GlobalsGuard.IsTypeArray(value) ? FromTypedArray(value) :
96
- GlobalsGuard.IsRegExp(value) ? FromRegExp(value) :
97
- GlobalsGuard.IsMap(value) ? FromMap(value) :
98
- GlobalsGuard.IsSet(value) ? FromSet(value) :
99
- Guard.IsArray(value) ? FromArray(value) :
100
- Guard.IsObject(value) ? FromObject(value) :
101
- value);
102
- }
103
- // ------------------------------------------------------------------
104
- // Clone
105
- // ------------------------------------------------------------------
106
- /**
107
- * Returns a Clone of the given value. This function is similar to structuredClone()
108
- * but also supports deep cloning instances of Map, Set and TypeArray.
109
- */
110
- export function Clone(value) {
111
- Metrics.clone += 1;
112
- return FromValue(value);
113
- }
@@ -1,8 +1,4 @@
1
1
  type ObjectLike = Record<PropertyKey, any>;
2
- /**
3
- * Creates an object with hidden, enumerable, and optional property sets. This function
4
- * ensures types are instantiated according to configuration rules for enumerable and
5
- * non-enumerable properties.
6
- */
2
+ /** Creates an object with hidden, enumerable, and optional property sets. */
7
3
  export declare function Create(hidden: ObjectLike, enumerable: ObjectLike, options?: ObjectLike): ObjectLike;
8
4
  export {};
@@ -1,8 +1,17 @@
1
1
  // deno-lint-ignore-file no-explicit-any
2
2
  import { Settings } from '../settings/index.mjs';
3
3
  import { Metrics } from './metrics.mjs';
4
- import { Freeze } from './freeze.mjs';
5
- function MergeHidden(left, right) {
4
+ import { Finalize } from './finalize.mjs';
5
+ // ------------------------------------------------------------------
6
+ // WithEnumerable
7
+ // ------------------------------------------------------------------
8
+ function WithEnumerable(left, right) {
9
+ return { ...left, ...right };
10
+ }
11
+ // ------------------------------------------------------------------
12
+ // WithHidden
13
+ // ------------------------------------------------------------------
14
+ function WithHidden(left, right) {
6
15
  for (const key of Object.keys(right)) {
7
16
  Object.defineProperty(left, key, {
8
17
  configurable: true,
@@ -13,17 +22,13 @@ function MergeHidden(left, right) {
13
22
  }
14
23
  return left;
15
24
  }
16
- function Merge(left, right) {
17
- return { ...left, ...right };
18
- }
19
- /**
20
- * Creates an object with hidden, enumerable, and optional property sets. This function
21
- * ensures types are instantiated according to configuration rules for enumerable and
22
- * non-enumerable properties.
23
- */
25
+ // ------------------------------------------------------------------
26
+ // Create
27
+ // ------------------------------------------------------------------
28
+ /** Creates an object with hidden, enumerable, and optional property sets. */
24
29
  export function Create(hidden, enumerable, options = {}) {
25
30
  Metrics.create += 1;
26
- const withOptions = Merge(enumerable, options);
27
- const withHidden = Settings.Get().enumerableKind ? Merge(withOptions, hidden) : MergeHidden(withOptions, hidden);
28
- return Freeze(withHidden);
31
+ const withEnumerable = WithEnumerable(enumerable, options);
32
+ const withHidden = Settings.Get().enumerableKind ? WithEnumerable(withEnumerable, hidden) : WithHidden(withEnumerable, hidden);
33
+ return Finalize(withHidden);
29
34
  }
@@ -0,0 +1,2 @@
1
+ /** 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. */
2
+ export declare function Deep<Value extends unknown = unknown>(value: Value): Value;
@@ -0,0 +1,108 @@
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 +1,4 @@
1
1
  type ObjectLike = Record<PropertyKey, any>;
2
- /** Discards multiple property keys from the given object value */
2
+ /** Discards property keys from the given object. */
3
3
  export declare function Discard(value: ObjectLike, propertyKeys: PropertyKey[]): ObjectLike;
4
4
  export {};
@@ -1,18 +1,19 @@
1
1
  // deno-lint-ignore-file no-explicit-any
2
- import { Guard } from '../../guard/index.mjs';
3
2
  import { Metrics } from './metrics.mjs';
4
- import { Freeze } from './freeze.mjs';
5
- import { Clone } from './clone.mjs';
6
- /** Discards multiple property keys from the given object value */
3
+ import { Finalize } from './finalize.mjs';
4
+ import { Keys } from './keys.mjs';
5
+ // ------------------------------------------------------------------
6
+ // Discard
7
+ // ------------------------------------------------------------------
8
+ /** Discards property keys from the given object. */
7
9
  export function Discard(value, propertyKeys) {
8
10
  Metrics.discard += 1;
9
11
  const result = {};
10
- for (const key of Guard.Keys(value)) {
12
+ for (const key of Keys(value)) {
11
13
  if (propertyKeys.includes(key))
12
14
  continue;
13
- const descriptor = Object.getOwnPropertyDescriptor(value, key); // safe-name!
14
- descriptor.value = Clone(descriptor.value);
15
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
15
16
  Object.defineProperty(result, key, descriptor);
16
17
  }
17
- return Freeze(result);
18
+ return Finalize(result);
18
19
  }
@@ -0,0 +1,4 @@
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 {};