@mtkruto/node 0.0.971 → 0.0.973

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 (135) hide show
  1. package/esm/constants.d.ts +1 -1
  2. package/esm/constants.js +1 -1
  3. package/esm/deps/deno.land/std@0.196.0/assert/_constants.d.ts +1 -0
  4. package/esm/deps/deno.land/std@0.196.0/assert/_constants.js +2 -0
  5. package/esm/deps/deno.land/std@0.196.0/assert/assert.d.ts +2 -0
  6. package/esm/deps/deno.land/std@0.196.0/assert/assert.js +8 -0
  7. package/esm/deps/deno.land/std@0.196.0/assert/assert_almost_equals.d.ts +18 -0
  8. package/esm/deps/deno.land/std@0.196.0/assert/assert_almost_equals.js +32 -0
  9. package/esm/deps/deno.land/std@0.196.0/assert/assert_array_includes.d.ts +14 -0
  10. package/esm/deps/deno.land/std@0.196.0/assert/assert_array_includes.js +38 -0
  11. package/esm/deps/deno.land/std@0.196.0/assert/assert_equals.d.ts +17 -0
  12. package/esm/deps/deno.land/std@0.196.0/assert/assert_equals.js +45 -0
  13. package/esm/deps/deno.land/std@0.196.0/assert/assert_exists.d.ts +5 -0
  14. package/esm/deps/deno.land/std@0.196.0/assert/assert_exists.js +14 -0
  15. package/esm/deps/deno.land/std@0.196.0/assert/assert_false.d.ts +4 -0
  16. package/esm/deps/deno.land/std@0.196.0/assert/assert_false.js +7 -0
  17. package/esm/deps/deno.land/std@0.196.0/assert/assert_instance_of.d.ts +8 -0
  18. package/esm/deps/deno.land/std@0.196.0/assert/assert_instance_of.js +38 -0
  19. package/esm/deps/deno.land/std@0.196.0/assert/assert_is_error.d.ts +7 -0
  20. package/esm/deps/deno.land/std@0.196.0/assert/assert_is_error.js +26 -0
  21. package/esm/deps/deno.land/std@0.196.0/assert/assert_match.d.ts +5 -0
  22. package/esm/deps/deno.land/std@0.196.0/assert/assert_match.js +13 -0
  23. package/esm/deps/deno.land/std@0.196.0/assert/assert_not_equals.d.ts +14 -0
  24. package/esm/deps/deno.land/std@0.196.0/assert/assert_not_equals.js +37 -0
  25. package/esm/deps/deno.land/std@0.196.0/assert/assert_not_instance_of.d.ts +5 -0
  26. package/esm/deps/deno.land/std@0.196.0/assert/assert_not_instance_of.js +14 -0
  27. package/esm/deps/deno.land/std@0.196.0/assert/assert_not_match.d.ts +5 -0
  28. package/esm/deps/deno.land/std@0.196.0/assert/assert_not_match.js +14 -0
  29. package/esm/deps/deno.land/std@0.196.0/assert/assert_not_strict_equals.d.ts +11 -0
  30. package/esm/deps/deno.land/std@0.196.0/assert/assert_not_strict_equals.js +20 -0
  31. package/esm/deps/deno.land/std@0.196.0/assert/assert_object_match.d.ts +5 -0
  32. package/esm/deps/deno.land/std@0.196.0/assert/assert_object_match.js +78 -0
  33. package/esm/deps/deno.land/std@0.196.0/assert/assert_rejects.d.ts +64 -0
  34. package/esm/deps/deno.land/std@0.196.0/assert/assert_rejects.js +50 -0
  35. package/esm/deps/deno.land/std@0.196.0/assert/assert_strict_equals.d.ts +23 -0
  36. package/esm/deps/deno.land/std@0.196.0/assert/assert_strict_equals.js +60 -0
  37. package/esm/deps/deno.land/std@0.196.0/assert/assert_string_includes.d.ts +5 -0
  38. package/esm/deps/deno.land/std@0.196.0/assert/assert_string_includes.js +13 -0
  39. package/esm/deps/deno.land/std@0.196.0/assert/assert_throws.d.ts +54 -0
  40. package/esm/deps/deno.land/std@0.196.0/assert/assert_throws.js +44 -0
  41. package/esm/deps/deno.land/std@0.196.0/assert/assertion_error.d.ts +4 -0
  42. package/esm/deps/deno.land/std@0.196.0/assert/assertion_error.js +12 -0
  43. package/esm/deps/deno.land/std@0.196.0/assert/equal.d.ts +6 -0
  44. package/esm/deps/deno.land/std@0.196.0/assert/equal.js +102 -0
  45. package/esm/deps/deno.land/std@0.196.0/assert/fail.d.ts +4 -0
  46. package/esm/deps/deno.land/std@0.196.0/assert/fail.js +9 -0
  47. package/esm/deps/deno.land/std@0.196.0/assert/mod.d.ts +32 -0
  48. package/esm/deps/deno.land/std@0.196.0/assert/mod.js +33 -0
  49. package/esm/deps/deno.land/std@0.196.0/assert/unimplemented.d.ts +2 -0
  50. package/esm/deps/deno.land/std@0.196.0/assert/unimplemented.js +7 -0
  51. package/esm/deps/deno.land/std@0.196.0/assert/unreachable.d.ts +2 -0
  52. package/esm/deps/deno.land/std@0.196.0/assert/unreachable.js +6 -0
  53. package/esm/deps/deno.land/{std@0.190.0 → std@0.196.0}/fmt/colors.js +2 -2
  54. package/{script/deps/deno.land/std@0.190.0 → esm/deps/deno.land/std@0.196.0}/testing/asserts.d.ts +204 -159
  55. package/esm/deps/deno.land/std@0.196.0/testing/asserts.js +330 -0
  56. package/esm/deps.d.ts +2 -2
  57. package/esm/deps.js +2 -2
  58. package/esm/storage/0_storage.d.ts +1 -1
  59. package/esm/storage/0_storage.js +7 -2
  60. package/package.json +1 -1
  61. package/script/constants.d.ts +1 -1
  62. package/script/constants.js +1 -1
  63. package/script/deps/deno.land/std@0.196.0/assert/_constants.d.ts +1 -0
  64. package/script/deps/deno.land/std@0.196.0/assert/_constants.js +5 -0
  65. package/script/deps/deno.land/std@0.196.0/assert/assert.d.ts +2 -0
  66. package/script/deps/deno.land/std@0.196.0/assert/assert.js +12 -0
  67. package/script/deps/deno.land/std@0.196.0/assert/assert_almost_equals.d.ts +18 -0
  68. package/script/deps/deno.land/std@0.196.0/assert/assert_almost_equals.js +36 -0
  69. package/script/deps/deno.land/std@0.196.0/assert/assert_array_includes.d.ts +14 -0
  70. package/script/deps/deno.land/std@0.196.0/assert/assert_array_includes.js +42 -0
  71. package/script/deps/deno.land/std@0.196.0/assert/assert_equals.d.ts +17 -0
  72. package/script/deps/deno.land/std@0.196.0/assert/assert_equals.js +49 -0
  73. package/script/deps/deno.land/std@0.196.0/assert/assert_exists.d.ts +5 -0
  74. package/script/deps/deno.land/std@0.196.0/assert/assert_exists.js +18 -0
  75. package/script/deps/deno.land/std@0.196.0/assert/assert_false.d.ts +4 -0
  76. package/script/deps/deno.land/std@0.196.0/assert/assert_false.js +11 -0
  77. package/script/deps/deno.land/std@0.196.0/assert/assert_instance_of.d.ts +8 -0
  78. package/script/deps/deno.land/std@0.196.0/assert/assert_instance_of.js +42 -0
  79. package/script/deps/deno.land/std@0.196.0/assert/assert_is_error.d.ts +7 -0
  80. package/script/deps/deno.land/std@0.196.0/assert/assert_is_error.js +30 -0
  81. package/script/deps/deno.land/std@0.196.0/assert/assert_match.d.ts +5 -0
  82. package/script/deps/deno.land/std@0.196.0/assert/assert_match.js +17 -0
  83. package/script/deps/deno.land/std@0.196.0/assert/assert_not_equals.d.ts +14 -0
  84. package/script/deps/deno.land/std@0.196.0/assert/assert_not_equals.js +41 -0
  85. package/script/deps/deno.land/std@0.196.0/assert/assert_not_instance_of.d.ts +5 -0
  86. package/script/deps/deno.land/std@0.196.0/assert/assert_not_instance_of.js +18 -0
  87. package/script/deps/deno.land/std@0.196.0/assert/assert_not_match.d.ts +5 -0
  88. package/script/deps/deno.land/std@0.196.0/assert/assert_not_match.js +18 -0
  89. package/script/deps/deno.land/std@0.196.0/assert/assert_not_strict_equals.d.ts +11 -0
  90. package/script/deps/deno.land/std@0.196.0/assert/assert_not_strict_equals.js +24 -0
  91. package/script/deps/deno.land/std@0.196.0/assert/assert_object_match.d.ts +5 -0
  92. package/script/deps/deno.land/std@0.196.0/assert/assert_object_match.js +82 -0
  93. package/script/deps/deno.land/std@0.196.0/assert/assert_rejects.d.ts +64 -0
  94. package/script/deps/deno.land/std@0.196.0/assert/assert_rejects.js +54 -0
  95. package/script/deps/deno.land/std@0.196.0/assert/assert_strict_equals.d.ts +23 -0
  96. package/script/deps/deno.land/std@0.196.0/assert/assert_strict_equals.js +64 -0
  97. package/script/deps/deno.land/std@0.196.0/assert/assert_string_includes.d.ts +5 -0
  98. package/script/deps/deno.land/std@0.196.0/assert/assert_string_includes.js +17 -0
  99. package/script/deps/deno.land/std@0.196.0/assert/assert_throws.d.ts +54 -0
  100. package/script/deps/deno.land/std@0.196.0/assert/assert_throws.js +48 -0
  101. package/script/deps/deno.land/std@0.196.0/assert/assertion_error.d.ts +4 -0
  102. package/script/deps/deno.land/std@0.196.0/assert/assertion_error.js +16 -0
  103. package/script/deps/deno.land/std@0.196.0/assert/equal.d.ts +6 -0
  104. package/script/deps/deno.land/std@0.196.0/assert/equal.js +106 -0
  105. package/script/deps/deno.land/std@0.196.0/assert/fail.d.ts +4 -0
  106. package/script/deps/deno.land/std@0.196.0/assert/fail.js +13 -0
  107. package/script/deps/deno.land/std@0.196.0/assert/mod.d.ts +32 -0
  108. package/script/deps/deno.land/std@0.196.0/assert/mod.js +49 -0
  109. package/script/deps/deno.land/std@0.196.0/assert/unimplemented.d.ts +2 -0
  110. package/script/deps/deno.land/std@0.196.0/assert/unimplemented.js +11 -0
  111. package/script/deps/deno.land/std@0.196.0/assert/unreachable.d.ts +2 -0
  112. package/script/deps/deno.land/std@0.196.0/assert/unreachable.js +10 -0
  113. package/script/deps/deno.land/{std@0.190.0 → std@0.196.0}/fmt/colors.js +2 -2
  114. package/{esm/deps/deno.land/std@0.190.0 → script/deps/deno.land/std@0.196.0}/testing/asserts.d.ts +204 -159
  115. package/script/deps/deno.land/std@0.196.0/testing/asserts.js +333 -0
  116. package/script/deps.d.ts +2 -2
  117. package/script/deps.js +2 -2
  118. package/script/storage/0_storage.d.ts +1 -1
  119. package/script/storage/0_storage.js +7 -2
  120. package/esm/deps/deno.land/std@0.190.0/testing/asserts.js +0 -633
  121. package/script/deps/deno.land/std@0.190.0/testing/asserts.js +0 -659
  122. /package/esm/deps/deno.land/{std@0.190.0/testing/_diff.d.ts → std@0.196.0/_util/diff.d.ts} +0 -0
  123. /package/esm/deps/deno.land/{std@0.190.0/testing/_diff.js → std@0.196.0/_util/diff.js} +0 -0
  124. /package/esm/deps/deno.land/{std@0.190.0/testing → std@0.196.0/assert}/_format.d.ts +0 -0
  125. /package/esm/deps/deno.land/{std@0.190.0/testing → std@0.196.0/assert}/_format.js +0 -0
  126. /package/esm/deps/deno.land/{std@0.190.0 → std@0.196.0}/encoding/base64.d.ts +0 -0
  127. /package/esm/deps/deno.land/{std@0.190.0 → std@0.196.0}/encoding/base64.js +0 -0
  128. /package/esm/deps/deno.land/{std@0.190.0 → std@0.196.0}/fmt/colors.d.ts +0 -0
  129. /package/script/deps/deno.land/{std@0.190.0/testing/_diff.d.ts → std@0.196.0/_util/diff.d.ts} +0 -0
  130. /package/script/deps/deno.land/{std@0.190.0/testing/_diff.js → std@0.196.0/_util/diff.js} +0 -0
  131. /package/script/deps/deno.land/{std@0.190.0/testing → std@0.196.0/assert}/_format.d.ts +0 -0
  132. /package/script/deps/deno.land/{std@0.190.0/testing → std@0.196.0/assert}/_format.js +0 -0
  133. /package/script/deps/deno.land/{std@0.190.0 → std@0.196.0}/encoding/base64.d.ts +0 -0
  134. /package/script/deps/deno.land/{std@0.190.0 → std@0.196.0}/encoding/base64.js +0 -0
  135. /package/script/deps/deno.land/{std@0.190.0 → std@0.196.0}/fmt/colors.d.ts +0 -0
@@ -0,0 +1,330 @@
1
+ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
2
+ /**
3
+ * @deprecated (will be removed after 1.0.0) Import from `std/assert/mod.ts` instead.
4
+ *
5
+ * A library of assertion functions.
6
+ * If the assertion is false an `AssertionError` will be thrown which will
7
+ * result in pretty-printed diff of failing assertion.
8
+ *
9
+ * This module is browser compatible, but do not rely on good formatting of
10
+ * values for AssertionError messages in browsers.
11
+ *
12
+ * @module
13
+ */
14
+ export {
15
+ /**
16
+ * @deprecated (will be removed after 1.0.0) Import from `std/assert/assert.ts` instead.
17
+ *
18
+ * Make an assertion, error will be thrown if `expr` does not have truthy value.
19
+ */
20
+ assert,
21
+ /**
22
+ * @deprecated (will be removed after 1.0.0) Import from `std/assert/assert_almost_equals.ts` instead.
23
+ *
24
+ * Make an assertion that `actual` and `expected` are almost equal numbers through
25
+ * a given tolerance. It can be used to take into account IEEE-754 double-precision
26
+ * floating-point representation limitations.
27
+ * If the values are not almost equal then throw.
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * import { assertAlmostEquals, assertThrows } from "https://deno.land/std@$STD_VERSION/testing/asserts.ts";
32
+ *
33
+ * assertAlmostEquals(0.1, 0.2);
34
+ *
35
+ * // Using a custom tolerance value
36
+ * assertAlmostEquals(0.1 + 0.2, 0.3, 1e-16);
37
+ * assertThrows(() => assertAlmostEquals(0.1 + 0.2, 0.3, 1e-17));
38
+ * ```
39
+ */
40
+ assertAlmostEquals,
41
+ /**
42
+ * @deprecated (will be removed after 1.0.0) Import from `std/assert/assert_array_includes.ts` instead.
43
+ *
44
+ * Make an assertion that `actual` includes the `expected` values.
45
+ * If not then an error will be thrown.
46
+ *
47
+ * Type parameter can be specified to ensure values under comparison have the same type.
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * import { assertArrayIncludes } from "https://deno.land/std@$STD_VERSION/testing/asserts.ts";
52
+ *
53
+ * assertArrayIncludes<number>([1, 2], [2])
54
+ * ```
55
+ */
56
+ assertArrayIncludes,
57
+ /**
58
+ * @deprecated (will be removed after 1.0.0) Import from `std/assert/assert_equals.ts` instead.
59
+ *
60
+ * Make an assertion that `actual` and `expected` are equal, deeply. If not
61
+ * deeply equal, then throw.
62
+ *
63
+ * Type parameter can be specified to ensure values under comparison have the same type.
64
+ *
65
+ * @example
66
+ * ```ts
67
+ * import { assertEquals } from "https://deno.land/std@$STD_VERSION/testing/asserts.ts";
68
+ *
69
+ * Deno.test("example", function (): void {
70
+ * assertEquals("world", "world");
71
+ * assertEquals({ hello: "world" }, { hello: "world" });
72
+ * });
73
+ * ```
74
+ */
75
+ assertEquals,
76
+ /**
77
+ * @deprecated (will be removed after 1.0.0) Import from `std/assert/assert_exists.ts` instead.
78
+ *
79
+ * Make an assertion that actual is not null or undefined.
80
+ * If not then throw.
81
+ */
82
+ assertExists,
83
+ /**
84
+ * @deprecated (will be removed after 1.0.0) Import from `std/assert/assert_false.ts` instead.
85
+ *
86
+ * Make an assertion, error will be thrown if `expr` have truthy value.
87
+ */
88
+ assertFalse,
89
+ /**
90
+ * @deprecated (will be removed after 1.0.0) Import from `std/assert/assert_instance_of.ts` instead.
91
+ *
92
+ * Make an assertion that `obj` is an instance of `type`.
93
+ * If not then throw.
94
+ */
95
+ assertInstanceOf,
96
+ /** @deprecated (will be removed after 1.0.0) Import from `std/assert/assertion_error.ts` instead. */
97
+ AssertionError,
98
+ /**
99
+ * @deprecated (will be removed after 1.0.0) Import from `std/assert/assert_is_error.ts` instead.
100
+ *
101
+ * Make an assertion that `error` is an `Error`.
102
+ * If not then an error will be thrown.
103
+ * An error class and a string that should be included in the
104
+ * error message can also be asserted.
105
+ */
106
+ assertIsError,
107
+ /**
108
+ * @deprecated (will be removed after 1.0.0) Import from `std/assert/assert_match.ts` instead.
109
+ *
110
+ * Make an assertion that `actual` match RegExp `expected`. If not
111
+ * then throw.
112
+ */
113
+ assertMatch,
114
+ /**
115
+ * @deprecated (will be removed after 1.0.0) Import from `std/assert/assert_not_equals.ts` instead.
116
+ *
117
+ * Make an assertion that `actual` and `expected` are not equal, deeply.
118
+ * If not then throw.
119
+ *
120
+ * Type parameter can be specified to ensure values under comparison have the same type.
121
+ *
122
+ * @example
123
+ * ```ts
124
+ * import { assertNotEquals } from "https://deno.land/std@$STD_VERSION/testing/asserts.ts";
125
+ *
126
+ * assertNotEquals<number>(1, 2)
127
+ * ```
128
+ */
129
+ assertNotEquals,
130
+ /**
131
+ * @deprecated (will be removed after 1.0.0) Import from `std/assert/assert_not_instance_of.ts` instead.
132
+ *
133
+ * Make an assertion that `obj` is not an instance of `type`.
134
+ * If so, then throw.
135
+ */
136
+ assertNotInstanceOf,
137
+ /**
138
+ * @deprecated (will be removed after 1.0.0) Import from `std/assert/assert_not_match.ts` instead.
139
+ *
140
+ * Make an assertion that `actual` object is a subset of `expected` object, deeply.
141
+ * If not, then throw.
142
+ */
143
+ assertNotMatch,
144
+ /**
145
+ * @deprecated (will be removed after 1.0.0) Import from `std/assert/assert_not_strict_equals.ts` instead.
146
+ *
147
+ * Make an assertion that `actual` and `expected` are not strictly equal.
148
+ * If the values are strictly equal then throw.
149
+ *
150
+ * ```ts
151
+ * import { assertNotStrictEquals } from "https://deno.land/std@$STD_VERSION/testing/asserts.ts";
152
+ *
153
+ * assertNotStrictEquals(1, 1)
154
+ * ```
155
+ */
156
+ assertNotStrictEquals,
157
+ /**
158
+ * Make an assertion that `actual` object is a subset of `expected` object, deeply.
159
+ * If not, then throw.
160
+ */
161
+ assertObjectMatch,
162
+ /**
163
+ * Executes a function which returns a promise, expecting it to reject.
164
+ * If it does not, then it throws. An error class and a string that should be
165
+ * included in the error message can also be asserted.
166
+ *
167
+ * @example
168
+ * ```ts
169
+ * import { assertRejects } from "https://deno.land/std@$STD_VERSION/testing/asserts.ts";
170
+ *
171
+ * Deno.test("doesThrow", async function () {
172
+ * await assertRejects(async () => {
173
+ * throw new TypeError("hello world!");
174
+ * }, TypeError);
175
+ * await assertRejects(
176
+ * async () => {
177
+ * throw new TypeError("hello world!");
178
+ * },
179
+ * TypeError,
180
+ * "hello",
181
+ * );
182
+ * });
183
+ *
184
+ * // This test will not pass.
185
+ * Deno.test("fails", async function () {
186
+ * await assertRejects(
187
+ * async () => {
188
+ * console.log("Hello world");
189
+ * },
190
+ * );
191
+ * });
192
+ * ```
193
+ *
194
+ * * @example
195
+ * ```ts
196
+ * import { assertRejects } from "https://deno.land/std@$STD_VERSION/testing/asserts.ts";
197
+ *
198
+ * Deno.test("doesThrow", async function () {
199
+ * await assertRejects(
200
+ * async () => {
201
+ * throw new TypeError("hello world!");
202
+ * },
203
+ * );
204
+ * await assertRejects(
205
+ * async () => {
206
+ * return Promise.reject(new Error());
207
+ * },
208
+ * );
209
+ * });
210
+ *
211
+ * // This test will not pass.
212
+ * Deno.test("fails", async function () {
213
+ * await assertRejects(
214
+ * async () => {
215
+ * console.log("Hello world");
216
+ * },
217
+ * );
218
+ * });
219
+ * ```
220
+ */
221
+ assertRejects,
222
+ /**
223
+ * @deprecated (will be removed after 1.0.0) Import from `std/assert/assert_strict_equals.ts` instead.
224
+ *
225
+ * Make an assertion that `actual` and `expected` are strictly equal. If
226
+ * not then throw.
227
+ *
228
+ * @example
229
+ * ```ts
230
+ * import { assertStrictEquals } from "https://deno.land/std@$STD_VERSION/testing/asserts.ts";
231
+ *
232
+ * Deno.test("isStrictlyEqual", function (): void {
233
+ * const a = {};
234
+ * const b = a;
235
+ * assertStrictEquals(a, b);
236
+ * });
237
+ *
238
+ * // This test fails
239
+ * Deno.test("isNotStrictlyEqual", function (): void {
240
+ * const a = {};
241
+ * const b = {};
242
+ * assertStrictEquals(a, b);
243
+ * });
244
+ * ```
245
+ */
246
+ assertStrictEquals,
247
+ /**
248
+ * @deprecated (will be removed after 1.0.0) Import from `std/assert/assert_string_includes.ts` instead.
249
+ *
250
+ * Make an assertion that actual includes expected. If not
251
+ * then throw.
252
+ */
253
+ assertStringIncludes,
254
+ /**
255
+ * @deprecated (will be removed after 1.0.0) Import from `std/assert/assert_throws.ts` instead.
256
+ *
257
+ * Executes a function, expecting it to throw. If it does not, then it
258
+ * throws. An error class and a string that should be included in the
259
+ * error message can also be asserted.
260
+ *
261
+ * @example
262
+ * ```ts
263
+ * import { assertThrows } from "https://deno.land/std@$STD_VERSION/testing/asserts.ts";
264
+ *
265
+ * Deno.test("doesThrow", function (): void {
266
+ * assertThrows((): void => {
267
+ * throw new TypeError("hello world!");
268
+ * }, TypeError);
269
+ * assertThrows(
270
+ * (): void => {
271
+ * throw new TypeError("hello world!");
272
+ * },
273
+ * TypeError,
274
+ * "hello",
275
+ * );
276
+ * });
277
+ *
278
+ * // This test will not pass.
279
+ * Deno.test("fails", function (): void {
280
+ * assertThrows((): void => {
281
+ * console.log("Hello world");
282
+ * });
283
+ * });
284
+ * ```
285
+ *
286
+ * @example
287
+ * ```ts
288
+ * import { assertThrows } from "https://deno.land/std@$STD_VERSION/testing/asserts.ts";
289
+ *
290
+ * Deno.test("doesThrow", function (): void {
291
+ * assertThrows((): void => {
292
+ * throw new TypeError("hello world!");
293
+ * });
294
+ * });
295
+ *
296
+ * // This test will not pass.
297
+ * Deno.test("fails", function (): void {
298
+ * assertThrows((): void => {
299
+ * console.log("Hello world");
300
+ * });
301
+ * });
302
+ * ```
303
+ */
304
+ assertThrows,
305
+ /**
306
+ * @deprecated (will be removed after 1.0.0) Import from `std/assert/equal.ts` instead.
307
+ *
308
+ * Deep equality comparison used in assertions
309
+ * @param c actual value
310
+ * @param d expected value
311
+ */
312
+ equal,
313
+ /**
314
+ * @deprecated (will be removed after 1.0.0) Import from `std/assert/fail.ts` instead.
315
+ *
316
+ * Forcefully throws a failed assertion
317
+ */
318
+ fail,
319
+ /**
320
+ * @deprecated (will be removed after 1.0.0) Import from `std/assert/unimplemented.ts` instead.
321
+ *
322
+ * Use this to stub out methods that will throw when invoked.
323
+ */
324
+ unimplemented,
325
+ /**
326
+ * @deprecated (will be removed after 1.0.0) Import from `std/assert/unreachable.ts` instead.
327
+ *
328
+ * Use this to assert unreachable code.
329
+ */
330
+ unreachable, } from "../assert/mod.js";
package/esm/deps.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- export * from "./deps/deno.land/std@0.190.0/testing/asserts.js";
1
+ export * from "./deps/deno.land/std@0.196.0/testing/asserts.js";
2
2
  export { ctr256Decrypt, ctr256Encrypt, factorize, ige256Decrypt, ige256Encrypt, init as initTgCrypto } from "./deps/deno.land/x/tgcrypto@0.1.3/mod.js";
3
3
  export { gunzip, gzip } from "./deps/raw.githubusercontent.com/MTKruto/compress/master/gzip/gzip.js";
4
4
  export { Mutex, type MutexInterface } from "async-mutex";
5
5
  export { Parser } from "./deps/deno.land/x/html_parser@v0.1.3/src/mod.js";
6
6
  import { debug as debug_ } from "./deps/raw.githubusercontent.com/MTKruto/debug/master/mod.js";
7
7
  export declare const debug: typeof debug_;
8
- export { decode as base64Decode, encode as base64Encode } from "./deps/deno.land/std@0.190.0/encoding/base64.js";
8
+ export { decode as base64Decode, encode as base64Encode } from "./deps/deno.land/std@0.196.0/encoding/base64.js";
package/esm/deps.js CHANGED
@@ -1,8 +1,8 @@
1
- export * from "./deps/deno.land/std@0.190.0/testing/asserts.js";
1
+ export * from "./deps/deno.land/std@0.196.0/testing/asserts.js";
2
2
  export { ctr256Decrypt, ctr256Encrypt, factorize, ige256Decrypt, ige256Encrypt, init as initTgCrypto } from "./deps/deno.land/x/tgcrypto@0.1.3/mod.js";
3
3
  export { gunzip, gzip } from "./deps/raw.githubusercontent.com/MTKruto/compress/master/gzip/gzip.js";
4
4
  export { Mutex } from "async-mutex";
5
5
  export { Parser } from "./deps/deno.land/x/html_parser@v0.1.3/src/mod.js";
6
6
  import { debug as debug_ } from "./deps/raw.githubusercontent.com/MTKruto/debug/master/mod.js";
7
7
  export const debug = (v) => debug_(`mtkruto/${v}`);
8
- export { decode as base64Decode, encode as base64Encode } from "./deps/deno.land/std@0.190.0/encoding/base64.js";
8
+ export { decode as base64Decode, encode as base64Encode } from "./deps/deno.land/std@0.196.0/encoding/base64.js";
@@ -19,7 +19,7 @@ export declare abstract class Storage {
19
19
  setUserAccessHash(id: bigint, accessHash: bigint): MaybePromise<void>;
20
20
  getUserAccessHash(id: bigint): MaybePromise<bigint | null>;
21
21
  updateUsernames(type: "user" | "channel", id: bigint, usernames: string[]): Promise<void>;
22
- getUsername(username: string): MaybePromise<["channel" | "user", bigint, Date] | null>;
22
+ getUsername(username: string): Promise<["channel" | "user", bigint, Date] | null>;
23
23
  setTlObject(key: readonly StorageKeyPart[], value: TLObject | null): Promise<void>;
24
24
  getTLObject(key: readonly StorageKeyPart[]): Promise<import("../tl/3_tl_reader.js").ReadObject | null>;
25
25
  setState(state: types.UpdatesState): Promise<void>;
@@ -71,9 +71,14 @@ export class Storage {
71
71
  await this.set(KPARTS__USERNAME(username), [type, String(id), new Date()]);
72
72
  }
73
73
  }
74
- getUsername(username) {
74
+ async getUsername(username) {
75
75
  username = username.toLowerCase();
76
- return this.get(KPARTS__USERNAME(username));
76
+ const v = await this.get(KPARTS__USERNAME(username));
77
+ if (v != null) {
78
+ v[1] = BigInt(v[1]);
79
+ v[2] = new Date(v[2]);
80
+ }
81
+ return v;
77
82
  }
78
83
  async setTlObject(key, value) {
79
84
  if (value == null) {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "module": "./esm/mod.js",
3
3
  "main": "./script/mod.js",
4
4
  "name": "@mtkruto/node",
5
- "version": "0.0.971",
5
+ "version": "0.0.973",
6
6
  "description": "MTKruto for Node.js",
7
7
  "author": "Roj <rojvv@icloud.com>",
8
8
  "license": "LGPL-3.0-or-later",
@@ -5,7 +5,7 @@ export declare const PUBLIC_KEYS: PublicKeys;
5
5
  export declare const VECTOR_CONSTRUCTOR = 481674261;
6
6
  export declare const INITIAL_DC: DC;
7
7
  export declare const LAYER = 160;
8
- export declare const APP_VERSION = "MTKruto 0.0.971";
8
+ export declare const APP_VERSION = "MTKruto 0.0.973";
9
9
  export declare const DEVICE_MODEL: string;
10
10
  export declare const LANG_CODE: string;
11
11
  export declare const LANG_PACK = "";
@@ -80,7 +80,7 @@ exports.PUBLIC_KEYS = Object.freeze([
80
80
  exports.VECTOR_CONSTRUCTOR = 0x1CB5C415;
81
81
  exports.INITIAL_DC = "2-test";
82
82
  exports.LAYER = 160;
83
- exports.APP_VERSION = "MTKruto 0.0.971";
83
+ exports.APP_VERSION = "MTKruto 0.0.973";
84
84
  // @ts-ignore: lib
85
85
  exports.DEVICE_MODEL = typeof dntShim.Deno === "undefined" ? typeof navigator === "undefined" ? typeof process === "undefined" ? "Unknown" : process.platform + "-" + process.arch : navigator.userAgent.split(" ")[0] : dntShim.Deno.build.os + "-" + dntShim.Deno.build.arch;
86
86
  exports.LANG_CODE = typeof navigator === "undefined" ? "en" : navigator.language.split("-")[0];
@@ -0,0 +1 @@
1
+ export declare const CAN_NOT_DISPLAY = "[Cannot display]";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CAN_NOT_DISPLAY = void 0;
4
+ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
5
+ exports.CAN_NOT_DISPLAY = "[Cannot display]";
@@ -0,0 +1,2 @@
1
+ /** Make an assertion, error will be thrown if `expr` does not have truthy value. */
2
+ export declare function assert(expr: unknown, msg?: string): asserts expr;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assert = void 0;
4
+ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
5
+ const assertion_error_js_1 = require("./assertion_error.js");
6
+ /** Make an assertion, error will be thrown if `expr` does not have truthy value. */
7
+ function assert(expr, msg = "") {
8
+ if (!expr) {
9
+ throw new assertion_error_js_1.AssertionError(msg);
10
+ }
11
+ }
12
+ exports.assert = assert;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Make an assertion that `actual` and `expected` are almost equal numbers through
3
+ * a given tolerance. It can be used to take into account IEEE-754 double-precision
4
+ * floating-point representation limitations.
5
+ * If the values are not almost equal then throw.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * import { assertAlmostEquals, assertThrows } from "https://deno.land/std@$STD_VERSION/assert/mod.ts";
10
+ *
11
+ * assertAlmostEquals(0.1, 0.2);
12
+ *
13
+ * // Using a custom tolerance value
14
+ * assertAlmostEquals(0.1 + 0.2, 0.3, 1e-16);
15
+ * assertThrows(() => assertAlmostEquals(0.1 + 0.2, 0.3, 1e-17));
16
+ * ```
17
+ */
18
+ export declare function assertAlmostEquals(actual: number, expected: number, tolerance?: number, msg?: string): void;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assertAlmostEquals = void 0;
4
+ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
5
+ const assertion_error_js_1 = require("./assertion_error.js");
6
+ /**
7
+ * Make an assertion that `actual` and `expected` are almost equal numbers through
8
+ * a given tolerance. It can be used to take into account IEEE-754 double-precision
9
+ * floating-point representation limitations.
10
+ * If the values are not almost equal then throw.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * import { assertAlmostEquals, assertThrows } from "https://deno.land/std@$STD_VERSION/assert/mod.ts";
15
+ *
16
+ * assertAlmostEquals(0.1, 0.2);
17
+ *
18
+ * // Using a custom tolerance value
19
+ * assertAlmostEquals(0.1 + 0.2, 0.3, 1e-16);
20
+ * assertThrows(() => assertAlmostEquals(0.1 + 0.2, 0.3, 1e-17));
21
+ * ```
22
+ */
23
+ function assertAlmostEquals(actual, expected, tolerance = 1e-7, msg) {
24
+ if (Object.is(actual, expected)) {
25
+ return;
26
+ }
27
+ const delta = Math.abs(expected - actual);
28
+ if (delta <= tolerance) {
29
+ return;
30
+ }
31
+ const msgSuffix = msg ? `: ${msg}` : ".";
32
+ const f = (n) => Number.isInteger(n) ? n : n.toExponential();
33
+ throw new assertion_error_js_1.AssertionError(`Expected actual: "${f(actual)}" to be close to "${f(expected)}": \
34
+ delta "${f(delta)}" is greater than "${f(tolerance)}"${msgSuffix}`);
35
+ }
36
+ exports.assertAlmostEquals = assertAlmostEquals;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Make an assertion that `actual` includes the `expected` values.
3
+ * If not then an error will be thrown.
4
+ *
5
+ * Type parameter can be specified to ensure values under comparison have the same type.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * import { assertArrayIncludes } from "https://deno.land/std@$STD_VERSION/assert/assert_array_includes.ts";
10
+ *
11
+ * assertArrayIncludes<number>([1, 2], [2])
12
+ * ```
13
+ */
14
+ export declare function assertArrayIncludes<T>(actual: ArrayLike<T>, expected: ArrayLike<T>, msg?: string): void;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assertArrayIncludes = void 0;
4
+ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
5
+ const equal_js_1 = require("./equal.js");
6
+ const _format_js_1 = require("./_format.js");
7
+ const assertion_error_js_1 = require("./assertion_error.js");
8
+ /**
9
+ * Make an assertion that `actual` includes the `expected` values.
10
+ * If not then an error will be thrown.
11
+ *
12
+ * Type parameter can be specified to ensure values under comparison have the same type.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * import { assertArrayIncludes } from "https://deno.land/std@$STD_VERSION/assert/assert_array_includes.ts";
17
+ *
18
+ * assertArrayIncludes<number>([1, 2], [2])
19
+ * ```
20
+ */
21
+ function assertArrayIncludes(actual, expected, msg) {
22
+ const missing = [];
23
+ for (let i = 0; i < expected.length; i++) {
24
+ let found = false;
25
+ for (let j = 0; j < actual.length; j++) {
26
+ if ((0, equal_js_1.equal)(expected[i], actual[j])) {
27
+ found = true;
28
+ break;
29
+ }
30
+ }
31
+ if (!found) {
32
+ missing.push(expected[i]);
33
+ }
34
+ }
35
+ if (missing.length === 0) {
36
+ return;
37
+ }
38
+ const msgSuffix = msg ? `: ${msg}` : ".";
39
+ msg = `Expected actual: "${(0, _format_js_1.format)(actual)}" to include: "${(0, _format_js_1.format)(expected)}"${msgSuffix}\nmissing: ${(0, _format_js_1.format)(missing)}`;
40
+ throw new assertion_error_js_1.AssertionError(msg);
41
+ }
42
+ exports.assertArrayIncludes = assertArrayIncludes;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Make an assertion that `actual` and `expected` are equal, deeply. If not
3
+ * deeply equal, then throw.
4
+ *
5
+ * Type parameter can be specified to ensure values under comparison have the same type.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * import { assertEquals } from "https://deno.land/std@$STD_VERSION/assert/assert_equals.ts";
10
+ *
11
+ * Deno.test("example", function (): void {
12
+ * assertEquals("world", "world");
13
+ * assertEquals({ hello: "world" }, { hello: "world" });
14
+ * });
15
+ * ```
16
+ */
17
+ export declare function assertEquals<T>(actual: T, expected: T, msg?: string): void;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assertEquals = void 0;
4
+ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
5
+ const equal_js_1 = require("./equal.js");
6
+ const _format_js_1 = require("./_format.js");
7
+ const assertion_error_js_1 = require("./assertion_error.js");
8
+ const colors_js_1 = require("../fmt/colors.js");
9
+ const diff_js_1 = require("../_util/diff.js");
10
+ const _constants_js_1 = require("./_constants.js");
11
+ /**
12
+ * Make an assertion that `actual` and `expected` are equal, deeply. If not
13
+ * deeply equal, then throw.
14
+ *
15
+ * Type parameter can be specified to ensure values under comparison have the same type.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * import { assertEquals } from "https://deno.land/std@$STD_VERSION/assert/assert_equals.ts";
20
+ *
21
+ * Deno.test("example", function (): void {
22
+ * assertEquals("world", "world");
23
+ * assertEquals({ hello: "world" }, { hello: "world" });
24
+ * });
25
+ * ```
26
+ */
27
+ function assertEquals(actual, expected, msg) {
28
+ if ((0, equal_js_1.equal)(actual, expected)) {
29
+ return;
30
+ }
31
+ const msgSuffix = msg ? `: ${msg}` : ".";
32
+ let message = `Values are not equal${msgSuffix}`;
33
+ const actualString = (0, _format_js_1.format)(actual);
34
+ const expectedString = (0, _format_js_1.format)(expected);
35
+ try {
36
+ const stringDiff = (typeof actual === "string") &&
37
+ (typeof expected === "string");
38
+ const diffResult = stringDiff
39
+ ? (0, diff_js_1.diffstr)(actual, expected)
40
+ : (0, diff_js_1.diff)(actualString.split("\n"), expectedString.split("\n"));
41
+ const diffMsg = (0, diff_js_1.buildMessage)(diffResult, { stringDiff }).join("\n");
42
+ message = `${message}\n${diffMsg}`;
43
+ }
44
+ catch {
45
+ message = `${message}\n${(0, colors_js_1.red)(_constants_js_1.CAN_NOT_DISPLAY)} + \n\n`;
46
+ }
47
+ throw new assertion_error_js_1.AssertionError(message);
48
+ }
49
+ exports.assertEquals = assertEquals;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Make an assertion that actual is not null or undefined.
3
+ * If not then throw.
4
+ */
5
+ export declare function assertExists<T>(actual: T, msg?: string): asserts actual is NonNullable<T>;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assertExists = void 0;
4
+ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
5
+ const assertion_error_js_1 = require("./assertion_error.js");
6
+ /**
7
+ * Make an assertion that actual is not null or undefined.
8
+ * If not then throw.
9
+ */
10
+ function assertExists(actual, msg) {
11
+ if (actual === undefined || actual === null) {
12
+ const msgSuffix = msg ? `: ${msg}` : ".";
13
+ msg =
14
+ `Expected actual: "${actual}" to not be null or undefined${msgSuffix}`;
15
+ throw new assertion_error_js_1.AssertionError(msg);
16
+ }
17
+ }
18
+ exports.assertExists = assertExists;
@@ -0,0 +1,4 @@
1
+ /** Make an assertion, error will be thrown if `expr` have truthy value. */
2
+ type Falsy = false | 0 | 0n | "" | null | undefined;
3
+ export declare function assertFalse(expr: unknown, msg?: string): asserts expr is Falsy;
4
+ export {};
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assertFalse = void 0;
4
+ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
5
+ const assertion_error_js_1 = require("./assertion_error.js");
6
+ function assertFalse(expr, msg = "") {
7
+ if (expr) {
8
+ throw new assertion_error_js_1.AssertionError(msg);
9
+ }
10
+ }
11
+ exports.assertFalse = assertFalse;