@openclaw/slack 2026.8.1-beta.3 → 2026.8.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.
- package/dist/account-configured-sUohAxZr.js +33 -0
- package/dist/account-inspect-CN2hBsim.js +87 -0
- package/dist/account-inspect-api.js +1 -1
- package/dist/{accounts-BlzxuYle.js → accounts-Dm_H77gH.js} +7 -10
- package/dist/{accounts.runtime-CbabBL8x.js → accounts.runtime-DRuEK6mL.js} +1 -1
- package/dist/{action-runtime-D6jg2CQd.js → action-runtime-044ldvNL.js} +53 -48
- package/dist/action-runtime.runtime-BL3KzX13.js +2 -0
- package/dist/{actions-DFk0ANVB.js → actions-BI7JkfVm.js} +266 -96
- package/dist/api.js +12 -12
- package/dist/{approval-handler.runtime-BNvAoKdK.js → approval-handler.runtime-DYv0UIZS.js} +53 -176
- package/dist/{channel-CA5w7qDF.js → channel-1vIJOzPx.js} +77 -142
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel-type-CZWv55Wu.js → channel-type-DlFSKeIZ.js} +3 -3
- package/dist/{channel.setup-CpyYsEXH.js → channel.setup-ofDi3_Pu.js} +34 -49
- package/dist/{config-schema-CN3XZRX5.js → config-schema-BVIMyiDN.js} +19 -12
- package/dist/configured-state.js +34 -0
- package/dist/{directory-config-BGYyuzWh.js → directory-config-DqfQ42OV.js} +1 -1
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-DjUJQLbq.js → directory-live-BPaNHjmP.js} +2 -2
- package/dist/{group-policy-DyfB_ZIE.js → group-policy-BdwszjYn.js} +581 -743
- package/dist/{message-tool-api-CqMr5Rmc.js → message-tool-api-CJ0kjcg5.js} +23 -5
- package/dist/message-tool-api.js +1 -1
- package/dist/{monitor-Chrecrb9.js → monitor-Dq5Cmrvp.js} +3 -3
- package/dist/{outbound-adapter-DuRqAQXK.js → outbound-adapter-DYaI8ThX.js} +93 -68
- package/dist/{pipeline.runtime-Bbfd5VFW.js → pipeline.runtime-Bd22U0ga.js} +128 -160
- package/dist/{policy-BKXSxrIS.js → policy-CtQVbde1.js} +2 -1
- package/dist/{probe-BVA65leh.js → probe-0usmAb0i.js} +209 -22
- package/dist/{provider-CUUiwsg2.js → provider-CN_8hFv2.js} +243 -146
- package/dist/{relay-source-mhpMMRG-.js → relay-source-BNGpsdwV.js} +1 -1
- package/dist/{replies-SnWyXcsL.js → replies-BSiRQOJ1.js} +15 -5
- package/dist/{resolve-channels-BSpqC8jU.js → resolve-channels-Czheznc8.js} +1 -1
- package/dist/{resolve-users-Dvz9pDe0.js → resolve-users-BAOlNimr.js} +1 -1
- package/dist/runtime-api.js +11 -11
- package/dist/{scopes-BSk4GZvZ.js → scopes-COSlmhnH.js} +1 -1
- package/dist/{send-CtnOxKCc.js → send-DS9ICrBI.js} +39 -31
- package/dist/send-results-eeOu_HYm.js +23 -0
- package/dist/{send.runtime-kYctMHSd.js → send.runtime-D_Bb6IuH.js} +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{setup-surface-BPFfp6So.js → setup-surface-BGnd2pSe.js} +6 -6
- package/dist/{shared-DJBaslN7.js → shared-D5B-5hBg.js} +26 -6
- package/dist/{slash-dispatch.runtime-Cf2FTrnf.js → slash-dispatch.runtime-CilDmI0c.js} +3 -3
- package/node_modules/@slack/bolt/node_modules/@types/node/README.md +1 -1
- package/node_modules/@slack/bolt/node_modules/@types/node/child_process.d.ts +0 -1
- package/node_modules/@slack/bolt/node_modules/@types/node/crypto.d.ts +6 -6
- package/node_modules/@slack/bolt/node_modules/@types/node/dns/promises.d.ts +5 -5
- package/node_modules/@slack/bolt/node_modules/@types/node/dns.d.ts +5 -5
- package/node_modules/@slack/bolt/node_modules/@types/node/fs.d.ts +7 -0
- package/node_modules/@slack/bolt/node_modules/@types/node/http.d.ts +30 -0
- package/node_modules/@slack/bolt/node_modules/@types/node/http2.d.ts +4 -4
- package/node_modules/@slack/bolt/node_modules/@types/node/os.d.ts +30 -30
- package/node_modules/@slack/bolt/node_modules/@types/node/package.json +2 -2
- package/node_modules/@slack/bolt/node_modules/@types/node/perf_hooks.d.ts +2 -1
- package/node_modules/@slack/bolt/node_modules/@types/node/process.d.ts +42 -43
- package/node_modules/@slack/bolt/node_modules/@types/node/quic.d.ts +1049 -84
- package/node_modules/@slack/bolt/node_modules/@types/node/sqlite.d.ts +14 -1
- package/node_modules/@slack/bolt/node_modules/@types/node/stream/iter.d.ts +3 -2
- package/node_modules/@slack/bolt/node_modules/@types/node/test.d.ts +61 -0
- package/node_modules/@slack/bolt/node_modules/@types/node/v8.d.ts +20 -23
- package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/README.md +2 -0
- package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/dist/index.d.ts +20 -0
- package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/dist/index.js +20 -14
- package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/dist/index.js.map +1 -1
- package/node_modules/@slack/bolt/node_modules/body-parser/node_modules/content-type/package.json +1 -1
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/README.md +2 -0
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/dist/index.d.ts +20 -0
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/dist/index.js +20 -14
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/dist/index.js.map +1 -1
- package/node_modules/@slack/bolt/node_modules/type-is/node_modules/content-type/package.json +1 -1
- package/node_modules/@slack/socket-mode/node_modules/@types/node/README.md +1 -1
- package/node_modules/@slack/socket-mode/node_modules/@types/node/child_process.d.ts +0 -1
- package/node_modules/@slack/socket-mode/node_modules/@types/node/crypto.d.ts +6 -6
- package/node_modules/@slack/socket-mode/node_modules/@types/node/dns/promises.d.ts +5 -5
- package/node_modules/@slack/socket-mode/node_modules/@types/node/dns.d.ts +5 -5
- package/node_modules/@slack/socket-mode/node_modules/@types/node/fs.d.ts +7 -0
- package/node_modules/@slack/socket-mode/node_modules/@types/node/http.d.ts +30 -0
- package/node_modules/@slack/socket-mode/node_modules/@types/node/http2.d.ts +4 -4
- package/node_modules/@slack/socket-mode/node_modules/@types/node/os.d.ts +30 -30
- package/node_modules/@slack/socket-mode/node_modules/@types/node/package.json +2 -2
- package/node_modules/@slack/socket-mode/node_modules/@types/node/perf_hooks.d.ts +2 -1
- package/node_modules/@slack/socket-mode/node_modules/@types/node/process.d.ts +42 -43
- package/node_modules/@slack/socket-mode/node_modules/@types/node/quic.d.ts +1049 -84
- package/node_modules/@slack/socket-mode/node_modules/@types/node/sqlite.d.ts +14 -1
- package/node_modules/@slack/socket-mode/node_modules/@types/node/stream/iter.d.ts +3 -2
- package/node_modules/@slack/socket-mode/node_modules/@types/node/test.d.ts +61 -0
- package/node_modules/@slack/socket-mode/node_modules/@types/node/v8.d.ts +20 -23
- package/node_modules/@slack/web-api/node_modules/@types/node/README.md +1 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/child_process.d.ts +0 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/crypto.d.ts +6 -6
- package/node_modules/@slack/web-api/node_modules/@types/node/dns/promises.d.ts +5 -5
- package/node_modules/@slack/web-api/node_modules/@types/node/dns.d.ts +5 -5
- package/node_modules/@slack/web-api/node_modules/@types/node/fs.d.ts +7 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/http.d.ts +30 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/http2.d.ts +4 -4
- package/node_modules/@slack/web-api/node_modules/@types/node/os.d.ts +30 -30
- package/node_modules/@slack/web-api/node_modules/@types/node/package.json +2 -2
- package/node_modules/@slack/web-api/node_modules/@types/node/perf_hooks.d.ts +2 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/process.d.ts +42 -43
- package/node_modules/@slack/web-api/node_modules/@types/node/quic.d.ts +1049 -84
- package/node_modules/@slack/web-api/node_modules/@types/node/sqlite.d.ts +14 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/stream/iter.d.ts +3 -2
- package/node_modules/@slack/web-api/node_modules/@types/node/test.d.ts +61 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/v8.d.ts +20 -23
- package/node_modules/typebox/build/format/date.d.mts +1 -1
- package/node_modules/typebox/build/format/date.mjs +1 -1
- package/node_modules/typebox/build/format/date_time.d.mts +2 -2
- package/node_modules/typebox/build/format/date_time.mjs +3 -3
- package/node_modules/typebox/build/format/email.d.mts +1 -1
- package/node_modules/typebox/build/format/email.mjs +2 -2
- package/node_modules/typebox/build/format/hostname.mjs +2 -10
- package/node_modules/typebox/build/format/idn_email.d.mts +1 -1
- package/node_modules/typebox/build/format/idn_email.mjs +3 -3
- package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idn_hostname.mjs +3 -11
- package/node_modules/typebox/build/format/idna/format/bidi.d.mts +3 -0
- package/node_modules/typebox/build/format/idna/format/bidi.mjs +98 -0
- package/node_modules/typebox/build/format/idna/format/puny.d.mts +3 -0
- package/node_modules/typebox/build/format/idna/format/puny.mjs +144 -0
- package/node_modules/typebox/build/format/idna/hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/hostname.mjs +16 -0
- package/node_modules/typebox/build/format/idna/idn-hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/idn-hostname.mjs +23 -0
- package/node_modules/typebox/build/format/idna/index.d.mts +2 -0
- package/node_modules/typebox/build/format/idna/index.mjs +2 -0
- package/node_modules/typebox/build/format/idna/label/ascii.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/ascii.mjs +9 -0
- package/node_modules/typebox/build/format/idna/label/puny.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/puny.mjs +28 -0
- package/node_modules/typebox/build/format/idna/label/unicode.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/unicode.mjs +106 -0
- package/node_modules/typebox/build/format/idna/pattern/pattern.d.mts +30 -0
- package/node_modules/typebox/build/format/idna/pattern/pattern.mjs +70 -0
- package/node_modules/typebox/build/format/ipv4.d.mts +0 -1
- package/node_modules/typebox/build/format/ipv4.mjs +2 -32
- package/node_modules/typebox/build/format/ipv6.mjs +2 -61
- package/node_modules/typebox/build/format/iri.d.mts +2 -2
- package/node_modules/typebox/build/format/iri.mjs +26 -8
- package/node_modules/typebox/build/format/iri_reference.d.mts +2 -2
- package/node_modules/typebox/build/format/iri_reference.mjs +9 -55
- package/node_modules/typebox/build/format/regex.d.mts +1 -2
- package/node_modules/typebox/build/format/regex.mjs +2 -6
- package/node_modules/typebox/build/format/time.d.mts +2 -2
- package/node_modules/typebox/build/format/time.mjs +19 -14
- package/node_modules/typebox/build/format/uri.d.mts +1 -1
- package/node_modules/typebox/build/format/uri.mjs +3 -130
- package/node_modules/typebox/build/format/uri_reference.d.mts +1 -1
- package/node_modules/typebox/build/format/uri_reference.mjs +2 -3
- package/node_modules/typebox/build/format/uri_template.d.mts +2 -3
- package/node_modules/typebox/build/format/uri_template.mjs +4 -5
- package/node_modules/typebox/build/format/url.d.mts +3 -3
- package/node_modules/typebox/build/format/url.mjs +4 -5
- package/node_modules/typebox/build/guard/emit.d.mts +3 -1
- package/node_modules/typebox/build/guard/emit.mjs +12 -5
- package/node_modules/typebox/build/guard/guard.d.mts +8 -2
- package/node_modules/typebox/build/guard/guard.mjs +25 -4
- package/node_modules/typebox/build/guard/string.d.mts +2 -2
- package/node_modules/typebox/build/guard/string.mjs +7 -7
- package/node_modules/typebox/build/schema/engine/_context.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -2
- package/node_modules/typebox/build/schema/engine/_regexp.d.mts +2 -0
- package/node_modules/typebox/build/schema/engine/_regexp.mjs +4 -0
- package/node_modules/typebox/build/schema/engine/_stack.mjs +12 -13
- package/node_modules/typebox/build/schema/engine/additionalItems.mjs +17 -7
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +4 -3
- package/node_modules/typebox/build/schema/engine/contains.mjs +18 -6
- package/node_modules/typebox/build/schema/engine/enum.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/items.mjs +26 -6
- package/node_modules/typebox/build/schema/engine/maxContains.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/minContains.mjs +14 -4
- package/node_modules/typebox/build/schema/engine/not.mjs +4 -2
- package/node_modules/typebox/build/schema/engine/oneOf.mjs +7 -6
- package/node_modules/typebox/build/schema/engine/pattern.mjs +3 -2
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +4 -3
- package/node_modules/typebox/build/schema/engine/ref.mjs +1 -7
- package/node_modules/typebox/build/schema/engine/schema.mjs +13 -4
- package/node_modules/typebox/build/schema/engine/type.mjs +1 -1
- package/node_modules/typebox/build/schema/resolve/resolve.d.mts +4 -1
- package/node_modules/typebox/build/schema/resolve/resolve.mjs +202 -1
- package/node_modules/typebox/build/schema/static/propertyNames.d.mts +5 -0
- package/node_modules/typebox/build/schema/static/propertyNames.mjs +3 -0
- package/node_modules/typebox/build/schema/static/schema.d.mts +3 -0
- package/node_modules/typebox/build/schema/types/index.d.mts +0 -2
- package/node_modules/typebox/build/schema/types/index.mjs +0 -2
- package/node_modules/typebox/build/system/memory/clone.mjs +14 -11
- package/node_modules/typebox/build/system/memory/discard.mjs +6 -5
- package/node_modules/typebox/build/system/settings/settings.d.mts +9 -0
- package/node_modules/typebox/build/system/settings/settings.mjs +2 -0
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.d.mts +6 -1
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +16 -3
- package/node_modules/typebox/build/type/engine/call/instantiate.mjs +34 -4
- package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +5 -5
- package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +20 -26
- package/node_modules/typebox/build/type/engine/evaluate/compare.d.mts +6 -10
- package/node_modules/typebox/build/type/engine/evaluate/compare.mjs +9 -13
- package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +7 -4
- package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +12 -19
- package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +4 -20
- package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +8 -20
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +4 -4
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +11 -8
- package/node_modules/typebox/build/type/engine/evaluate/flatten.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/evaluate/flatten.mjs +3 -4
- package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +17 -2
- package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +26 -6
- package/node_modules/typebox/build/type/engine/exclude/operation.mjs +3 -4
- package/node_modules/typebox/build/type/engine/extract/operation.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/extract/operation.mjs +3 -4
- package/node_modules/typebox/build/type/engine/priority/priority.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/priority/priority.mjs +3 -4
- package/node_modules/typebox/build/type/script/mapping.d.mts +32 -29
- package/node_modules/typebox/build/type/script/mapping.mjs +18 -25
- package/node_modules/typebox/build/type/script/parser.d.mts +19 -25
- package/node_modules/typebox/build/type/script/parser.mjs +27 -23
- package/node_modules/typebox/build/value/errors/errors.d.mts +2 -2
- package/node_modules/typebox/build/value/errors/errors.mjs +1 -1
- package/node_modules/typebox/package.json +27 -27
- package/node_modules/typebox/readme.md +79 -82
- package/node_modules/ws/lib/permessage-deflate.js +3 -1
- package/node_modules/ws/package.json +1 -1
- package/openclaw.plugin.json +14 -6
- package/package.json +9 -7
- package/dist/account-configured-BwfXBo_F.js +0 -14
- package/dist/account-inspect-YJvFBbCR.js +0 -89
- package/dist/action-runtime.runtime-JtoOK9l5.js +0 -2
- package/dist/actions.runtime-CYLsYRai.js +0 -2
- package/dist/runtime-api-DBi7xc_g.js +0 -10
- package/dist/slack-client-kind-BXyOOICI.js +0 -94
- package/node_modules/typebox/build/format/_idna.d.mts +0 -2
- package/node_modules/typebox/build/format/_idna.mjs +0 -246
- package/node_modules/typebox/build/format/_puny.d.mts +0 -1
- package/node_modules/typebox/build/format/_puny.mjs +0 -77
- package/node_modules/typebox/build/schema/resolve/ref.d.mts +0 -3
- package/node_modules/typebox/build/schema/resolve/ref.mjs +0 -146
- package/node_modules/typebox/build/schema/types/contentEncoding.d.mts +0 -9
- package/node_modules/typebox/build/schema/types/contentEncoding.mjs +0 -13
- package/node_modules/typebox/build/schema/types/contentMediaType.d.mts +0 -9
- package/node_modules/typebox/build/schema/types/contentMediaType.mjs +0 -13
|
@@ -298,10 +298,23 @@ declare module "node:sqlite" {
|
|
|
298
298
|
* Loads a shared library into the database connection. This method is a wrapper
|
|
299
299
|
* around [`sqlite3_load_extension()`](https://www.sqlite.org/c3ref/load_extension.html). It is required to enable the
|
|
300
300
|
* `allowExtension` option when constructing the `DatabaseSync` instance.
|
|
301
|
+
*
|
|
302
|
+
* ```js
|
|
303
|
+
* import { DatabaseSync } from 'node:sqlite';
|
|
304
|
+
* const database = new DatabaseSync(':memory:', { allowExtension: true });
|
|
305
|
+
*
|
|
306
|
+
* // Load using the entry point derived from the filename.
|
|
307
|
+
* database.loadExtension('./decimal.dylib');
|
|
308
|
+
*
|
|
309
|
+
* // Override the entry point when the derived name does not match.
|
|
310
|
+
* database.loadExtension('./base64.dylib', 'sqlite3_base64_init');
|
|
301
311
|
* @since v22.13.0
|
|
302
312
|
* @param path The path to the shared library to load.
|
|
313
|
+
* @param entryPoint The name of the extension's entry-point function. When
|
|
314
|
+
* omitted, SQLite derives the entry point from the shared library's filename;
|
|
315
|
+
* pass this argument explicitly when the derived name does not match.
|
|
303
316
|
*/
|
|
304
|
-
loadExtension(path: string): void;
|
|
317
|
+
loadExtension(path: string, entryPoint?: string): void;
|
|
305
318
|
/**
|
|
306
319
|
* Enables or disables the `loadExtension` SQL function, and the `loadExtension()`
|
|
307
320
|
* method. When `allowExtension` is `false` when constructing, you cannot enable
|
|
@@ -311,8 +311,9 @@ declare module "node:stream/iter" {
|
|
|
311
311
|
* return `false` or `-1`, deferring to the async path. The per-write
|
|
312
312
|
* `options.signal` parameter from the Writer interface is also ignored.
|
|
313
313
|
*
|
|
314
|
-
* The result is cached per instance
|
|
315
|
-
*
|
|
314
|
+
* The result is cached per instance and backpressure policy -- calling
|
|
315
|
+
* `fromWritable()` twice with the same stream and `backpressure` option returns
|
|
316
|
+
* the same Writer.
|
|
316
317
|
*
|
|
317
318
|
* For duck-typed streams that do not expose `writableHighWaterMark`,
|
|
318
319
|
* `writableLength`, or similar properties, sensible defaults are used.
|
|
@@ -264,6 +264,15 @@ declare module "node:test" {
|
|
|
264
264
|
* @since v22.1.0
|
|
265
265
|
*/
|
|
266
266
|
testSkipPatterns?: string | RegExp | ReadonlyArray<string | RegExp> | undefined;
|
|
267
|
+
/**
|
|
268
|
+
* A tag name, or an array of tag names,
|
|
269
|
+
* used to filter tests by their declared tags. Tests must contain every
|
|
270
|
+
* listed tag to run. Equivalent to passing `--experimental-test-tag-filter`
|
|
271
|
+
* on the command line. See [Test tags](https://nodejs.org/docs/latest-v26.x/api/test.html#test-tags).
|
|
272
|
+
* @default undefined
|
|
273
|
+
* @since v26.2.0
|
|
274
|
+
*/
|
|
275
|
+
testTagFilters?: string | readonly string[] | undefined;
|
|
267
276
|
/**
|
|
268
277
|
* The number of milliseconds after which the test execution will fail.
|
|
269
278
|
* If unspecified, subtests inherit this value from their parent.
|
|
@@ -668,6 +677,12 @@ declare module "node:test" {
|
|
|
668
677
|
* The nesting level of the test.
|
|
669
678
|
*/
|
|
670
679
|
nesting: number;
|
|
680
|
+
/**
|
|
681
|
+
* The flattened lowercased tags declared on the test
|
|
682
|
+
* and its ancestor suites, in declaration order. Empty for untagged tests.
|
|
683
|
+
* See [Test tags](https://nodejs.org/docs/latest-v26.x/api/test.html#test-tags).
|
|
684
|
+
*/
|
|
685
|
+
tags: string[];
|
|
671
686
|
/**
|
|
672
687
|
* A numeric identifier for this test instance, unique
|
|
673
688
|
* within the test file's process. Consistent across all events for the same
|
|
@@ -696,6 +711,12 @@ declare module "node:test" {
|
|
|
696
711
|
* The nesting level of the test.
|
|
697
712
|
*/
|
|
698
713
|
nesting: number;
|
|
714
|
+
/**
|
|
715
|
+
* The flattened lowercased tags declared on the test
|
|
716
|
+
* and its ancestor suites, in declaration order. Empty for untagged tests.
|
|
717
|
+
* See [Test tags](https://nodejs.org/docs/latest-v26.x/api/test.html#test-tags).
|
|
718
|
+
*/
|
|
719
|
+
tags: string[];
|
|
699
720
|
/**
|
|
700
721
|
* A numeric identifier for this test instance, unique
|
|
701
722
|
* within the test file's process. Consistent across all events for the same
|
|
@@ -717,6 +738,12 @@ declare module "node:test" {
|
|
|
717
738
|
* The nesting level of the test.
|
|
718
739
|
*/
|
|
719
740
|
nesting: number;
|
|
741
|
+
/**
|
|
742
|
+
* The flattened lowercased tags declared on the test
|
|
743
|
+
* and its ancestor suites, in declaration order. Empty for untagged tests.
|
|
744
|
+
* See [Test tags](https://nodejs.org/docs/latest-v26.x/api/test.html#test-tags).
|
|
745
|
+
*/
|
|
746
|
+
tags: string[];
|
|
720
747
|
/**
|
|
721
748
|
* A numeric identifier for this test instance, unique
|
|
722
749
|
* within the test file's process. Consistent across all events for the same
|
|
@@ -762,6 +789,12 @@ declare module "node:test" {
|
|
|
762
789
|
* The nesting level of the test.
|
|
763
790
|
*/
|
|
764
791
|
nesting: number;
|
|
792
|
+
/**
|
|
793
|
+
* The flattened lowercased tags declared on the test
|
|
794
|
+
* and its ancestor suites, in declaration order. Empty for untagged tests.
|
|
795
|
+
* See [Test tags](https://nodejs.org/docs/latest-v26.x/api/test.html#test-tags).
|
|
796
|
+
*/
|
|
797
|
+
tags: string[];
|
|
765
798
|
/**
|
|
766
799
|
* A numeric identifier for this test instance, unique
|
|
767
800
|
* within the test file's process. Consistent across all events for the same
|
|
@@ -823,6 +856,12 @@ declare module "node:test" {
|
|
|
823
856
|
* The nesting level of the test.
|
|
824
857
|
*/
|
|
825
858
|
nesting: number;
|
|
859
|
+
/**
|
|
860
|
+
* The flattened lowercased tags declared on the test
|
|
861
|
+
* and its ancestor suites, in declaration order. Empty for untagged tests.
|
|
862
|
+
* See [Test tags](https://nodejs.org/docs/latest-v26.x/api/test.html#test-tags).
|
|
863
|
+
*/
|
|
864
|
+
tags: string[];
|
|
826
865
|
/**
|
|
827
866
|
* A numeric identifier for this test instance, unique
|
|
828
867
|
* within the test file's process. Consistent across all events for the same
|
|
@@ -861,6 +900,12 @@ declare module "node:test" {
|
|
|
861
900
|
* The nesting level of the test.
|
|
862
901
|
*/
|
|
863
902
|
nesting: number;
|
|
903
|
+
/**
|
|
904
|
+
* The flattened lowercased tags declared on the test
|
|
905
|
+
* and its ancestor suites, in declaration order. Empty for untagged tests.
|
|
906
|
+
* See [Test tags](https://nodejs.org/docs/latest-v26.x/api/test.html#test-tags).
|
|
907
|
+
*/
|
|
908
|
+
tags: string[];
|
|
864
909
|
/**
|
|
865
910
|
* A numeric identifier for this test instance, unique
|
|
866
911
|
* within the test file's process. Consistent across all events for the same
|
|
@@ -1082,6 +1127,13 @@ declare module "node:test" {
|
|
|
1082
1127
|
* @since v21.7.0, v20.12.0
|
|
1083
1128
|
*/
|
|
1084
1129
|
readonly attempt: number;
|
|
1130
|
+
/**
|
|
1131
|
+
* A frozen array of the test's flattened lowercased tags, in declaration
|
|
1132
|
+
* order, including any tags inherited from ancestor suites. Empty when the
|
|
1133
|
+
* test has no tags. See [Test tags](https://nodejs.org/docs/latest-v26.x/api/test.html#test-tags).
|
|
1134
|
+
* @since v26.2.0
|
|
1135
|
+
*/
|
|
1136
|
+
readonly tags: readonly string[];
|
|
1085
1137
|
/**
|
|
1086
1138
|
* The unique identifier of the worker running the current test file. This value is
|
|
1087
1139
|
* derived from the `NODE_TEST_WORKER_ID` environment variable. When running tests
|
|
@@ -1443,6 +1495,15 @@ declare module "node:test" {
|
|
|
1443
1495
|
* @default false
|
|
1444
1496
|
*/
|
|
1445
1497
|
skip?: boolean | string | undefined;
|
|
1498
|
+
/**
|
|
1499
|
+
* An array of string labels associated with the test.
|
|
1500
|
+
* Used together with `--experimental-test-tag-filter` to filter which
|
|
1501
|
+
* tests run. Tags inherit from suites to nested tests by union. See
|
|
1502
|
+
* [Test tags](https://nodejs.org/docs/latest-v26.x/api/test.html#test-tags).
|
|
1503
|
+
* @default []
|
|
1504
|
+
* @since v26.2.0
|
|
1505
|
+
*/
|
|
1506
|
+
tags?: readonly string[] | undefined;
|
|
1446
1507
|
/**
|
|
1447
1508
|
* A number of milliseconds the test will fail after. If unspecified, subtests inherit this
|
|
1448
1509
|
* value from their parent.
|
|
@@ -89,23 +89,22 @@ declare module "node:v8" {
|
|
|
89
89
|
* `total_allocated_bytes` The value of total allocated bytes since the Isolate
|
|
90
90
|
* creation.
|
|
91
91
|
*
|
|
92
|
-
* ```
|
|
92
|
+
* ```json
|
|
93
93
|
* {
|
|
94
|
-
* total_heap_size: 7326976,
|
|
95
|
-
* total_heap_size_executable: 4194304,
|
|
96
|
-
* total_physical_size: 7326976,
|
|
97
|
-
* total_available_size: 1152656,
|
|
98
|
-
* used_heap_size: 3476208,
|
|
99
|
-
* heap_size_limit: 1535115264,
|
|
100
|
-
* malloced_memory: 16384,
|
|
101
|
-
* peak_malloced_memory: 1127496,
|
|
102
|
-
* does_zap_garbage: 0,
|
|
103
|
-
* number_of_native_contexts: 1,
|
|
104
|
-
* number_of_detached_contexts: 0,
|
|
105
|
-
* total_global_handles_size: 8192,
|
|
106
|
-
* used_global_handles_size: 3296,
|
|
107
|
-
* external_memory: 318824
|
|
108
|
-
* total_allocated_bytes: 45224088
|
|
94
|
+
* "total_heap_size": 7326976,
|
|
95
|
+
* "total_heap_size_executable": 4194304,
|
|
96
|
+
* "total_physical_size": 7326976,
|
|
97
|
+
* "total_available_size": 1152656,
|
|
98
|
+
* "used_heap_size": 3476208,
|
|
99
|
+
* "heap_size_limit": 1535115264,
|
|
100
|
+
* "malloced_memory": 16384,
|
|
101
|
+
* "peak_malloced_memory": 1127496,
|
|
102
|
+
* "does_zap_garbage": 0,
|
|
103
|
+
* "number_of_native_contexts": 1,
|
|
104
|
+
* "number_of_detached_contexts": 0,
|
|
105
|
+
* "total_global_handles_size": 8192,
|
|
106
|
+
* "used_global_handles_size": 3296,
|
|
107
|
+
* "external_memory": 318824
|
|
109
108
|
* }
|
|
110
109
|
* ```
|
|
111
110
|
* @since v1.0.0
|
|
@@ -386,12 +385,12 @@ declare module "node:v8" {
|
|
|
386
385
|
* V8 [`GetHeapCodeAndMetadataStatistics`](https://v8docs.nodesource.com/node-13.2/d5/dda/classv8_1_1_isolate.html#a6079122af17612ef54ef3348ce170866) API. Returns an object with the
|
|
387
386
|
* following properties:
|
|
388
387
|
*
|
|
389
|
-
* ```
|
|
388
|
+
* ```json
|
|
390
389
|
* {
|
|
391
|
-
* code_and_metadata_size: 212208,
|
|
392
|
-
* bytecode_and_metadata_size: 161368,
|
|
393
|
-
* external_script_source_size: 1410794,
|
|
394
|
-
* cpu_profiler_metadata_size: 0
|
|
390
|
+
* "code_and_metadata_size": 212208,
|
|
391
|
+
* "bytecode_and_metadata_size": 161368,
|
|
392
|
+
* "external_script_source_size": 1410794,
|
|
393
|
+
* "cpu_profiler_metadata_size": 0
|
|
395
394
|
* }
|
|
396
395
|
* ```
|
|
397
396
|
* @since v12.8.0
|
|
@@ -963,8 +962,6 @@ declare module "node:v8" {
|
|
|
963
962
|
* For example, if the `entry.js` contains the following script:
|
|
964
963
|
*
|
|
965
964
|
* ```js
|
|
966
|
-
* 'use strict';
|
|
967
|
-
*
|
|
968
965
|
* import fs from 'node:fs';
|
|
969
966
|
* import zlib from 'node:zlib';
|
|
970
967
|
* import path from 'node:path';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Returns true if the value is a ISO8601 DateTime string
|
|
3
|
-
* @
|
|
3
|
+
* @specification https://datatracker.ietf.org/doc/html/rfc3339
|
|
4
4
|
* @example `2020-12-12T20:20:40+00:00`
|
|
5
5
|
*/
|
|
6
|
-
export declare function IsDateTime(value: string
|
|
6
|
+
export declare function IsDateTime(value: string): boolean;
|
|
@@ -2,10 +2,10 @@ import { IsDate } from './date.mjs';
|
|
|
2
2
|
import { IsTime } from './time.mjs';
|
|
3
3
|
/**
|
|
4
4
|
* Returns true if the value is a ISO8601 DateTime string
|
|
5
|
-
* @
|
|
5
|
+
* @specification https://datatracker.ietf.org/doc/html/rfc3339
|
|
6
6
|
* @example `2020-12-12T20:20:40+00:00`
|
|
7
7
|
*/
|
|
8
|
-
export function IsDateTime(value
|
|
8
|
+
export function IsDateTime(value) {
|
|
9
9
|
const dateTime = value.split(/T/i);
|
|
10
|
-
return dateTime.length === 2 && IsDate(dateTime[0]) && IsTime(dateTime[1]
|
|
10
|
+
return dateTime.length === 2 && IsDate(dateTime[0]) && IsTime(dateTime[1]);
|
|
11
11
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const Email = /^(
|
|
1
|
+
const Email = /^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[^"\\]|\\.)*")@(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*|\[(?:IPv6:[a-f0-9:]+|(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])(?:\.(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3})\])$/i;
|
|
2
2
|
/**
|
|
3
3
|
* Returns true if the value is an Email
|
|
4
|
-
* @specification
|
|
4
|
+
* @specification https://datatracker.ietf.org/doc/html/rfc5322
|
|
5
5
|
*/
|
|
6
6
|
export function IsEmail(value) {
|
|
7
7
|
return Email.test(value);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as Idna from './
|
|
1
|
+
import * as Idna from './idna/index.mjs';
|
|
2
2
|
/**
|
|
3
3
|
* Returns true if the value is a valid hostname.
|
|
4
4
|
* @specification https://tools.ietf.org/html/rfc1123
|
|
@@ -6,13 +6,5 @@ import * as Idna from './_idna.mjs';
|
|
|
6
6
|
* @specification https://tools.ietf.org/html/rfc5892
|
|
7
7
|
*/
|
|
8
8
|
export function IsHostname(value) {
|
|
9
|
-
|
|
10
|
-
return false;
|
|
11
|
-
if (value.charCodeAt(value.length - 1) === 46)
|
|
12
|
-
return false;
|
|
13
|
-
for (const label of value.split('.')) {
|
|
14
|
-
if (!Idna.IsLabel(label))
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
return true;
|
|
9
|
+
return Idna.IsHostname(value);
|
|
18
10
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const IdnEmail = /^(
|
|
1
|
+
const IdnEmail = /^(?:[A-Za-z0-9!#$%&'*+\/=?^_`{|}~\u{0080}-\u{10FFFF}-]+(?:\.[A-Za-z0-9!#$%&'*+\/=?^_`{|}~\u{0080}-\u{10FFFF}-]+)*|"(?:[^"\\]|\\.)*")@[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,62})(?<!-)(?:\.[\p{L}\p{N}](?:[\p{L}\p{N}-]{0,62})(?<!-))*$/iu;
|
|
2
2
|
/**
|
|
3
3
|
* Returns true if the value is an IdnEmail
|
|
4
|
-
* @specification
|
|
4
|
+
* @specification https://datatracker.ietf.org/doc/html/rfc4952
|
|
5
5
|
*/
|
|
6
6
|
export function IsIdnEmail(value) {
|
|
7
|
-
return IdnEmail.test(value);
|
|
7
|
+
return IdnEmail.test(value.normalize('NFC'));
|
|
8
8
|
}
|
|
@@ -3,5 +3,6 @@
|
|
|
3
3
|
* @specification https://tools.ietf.org/html/rfc3490
|
|
4
4
|
* @specification https://tools.ietf.org/html/rfc5891
|
|
5
5
|
* @specification https://tools.ietf.org/html/rfc5892
|
|
6
|
+
* @specification https://tools.ietf.org/html/rfc5893
|
|
6
7
|
*/
|
|
7
8
|
export declare function IsIdnHostname(value: string): boolean;
|
|
@@ -1,19 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as Idna from './idna/index.mjs';
|
|
2
2
|
/**
|
|
3
3
|
* Returns true if the value is a valid internationalized (IDN) hostname.
|
|
4
4
|
* @specification https://tools.ietf.org/html/rfc3490
|
|
5
5
|
* @specification https://tools.ietf.org/html/rfc5891
|
|
6
6
|
* @specification https://tools.ietf.org/html/rfc5892
|
|
7
|
+
* @specification https://tools.ietf.org/html/rfc5893
|
|
7
8
|
*/
|
|
8
9
|
export function IsIdnHostname(value) {
|
|
9
|
-
|
|
10
|
-
return false;
|
|
11
|
-
const canonical = value.normalize('NFC').replace(/[\u002E\u3002\uFF0E\uFF61]/g, '.');
|
|
12
|
-
if (canonical.length > 253)
|
|
13
|
-
return false;
|
|
14
|
-
for (const label of canonical.split('.')) {
|
|
15
|
-
if (!IsIdnLabel(label))
|
|
16
|
-
return false;
|
|
17
|
-
}
|
|
18
|
-
return true;
|
|
10
|
+
return Idna.IsIdnHostname(value);
|
|
19
11
|
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// deno-fmt-ignore-file
|
|
2
|
+
import * as FormatPuny from './puny.mjs';
|
|
3
|
+
import * as Pattern from '../pattern/pattern.mjs';
|
|
4
|
+
// ------------------------------------------------------------------
|
|
5
|
+
// LOCAL REGEX: Allowed Bidi classes per direction (RFC 5893)
|
|
6
|
+
// ------------------------------------------------------------------
|
|
7
|
+
const RE_RTL_ALLOWED = /^(?:R|AL|AN|EN|ES|CS|ET|ON|BN|NSM)$/;
|
|
8
|
+
const RE_LTR_ALLOWED = /^(?:L|EN|ES|CS|ET|ON|BN|NSM)$/;
|
|
9
|
+
const RE_RTL_CLASSES = /^(?:R|AL|AN)$/;
|
|
10
|
+
// ------------------------------------------------------------------
|
|
11
|
+
// HasBidiChars
|
|
12
|
+
//
|
|
13
|
+
// Decodes a punycode label to its Unicode form (if it is one) and
|
|
14
|
+
// checks whether the result is an RTL label per RFC 5893 §1.4.
|
|
15
|
+
// ------------------------------------------------------------------
|
|
16
|
+
export function HasBidiChars(value) {
|
|
17
|
+
if (FormatPuny.IsAcePrefixed(value)) {
|
|
18
|
+
try {
|
|
19
|
+
return HasRightToLeftCharacters(FormatPuny.Decode(value.slice(4).toLowerCase()));
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return HasRightToLeftCharacters(value);
|
|
26
|
+
}
|
|
27
|
+
// ------------------------------------------------------------------
|
|
28
|
+
// GetBidiClass
|
|
29
|
+
// ------------------------------------------------------------------
|
|
30
|
+
function GetBidiClass(codePoint) {
|
|
31
|
+
const char = String.fromCodePoint(codePoint);
|
|
32
|
+
return (Pattern.RE_EUROPEAN_NUMBER.test(char) ? 'EN' :
|
|
33
|
+
Pattern.RE_ARABIC_INDIC_DIGIT.test(char) ? 'AN' :
|
|
34
|
+
// Pattern.RE_EUROPEAN_SEPARATOR.test(char) ? 'ES' : // (no-spec-coverage)
|
|
35
|
+
// Pattern.RE_COMMON_SEPARATOR.test(char) ? 'CS' : // (no-spec-coverage)
|
|
36
|
+
Pattern.RE_MARK_NONSPACING.test(char) ? 'NSM' :
|
|
37
|
+
Pattern.RE_SCRIPT_HEBREW.test(char) ? 'R' :
|
|
38
|
+
Pattern.RE_SCRIPT_ARABIC_LETTER.test(char) ? 'AL' :
|
|
39
|
+
Pattern.RE_LETTER.test(char) ? 'L' :
|
|
40
|
+
'ON');
|
|
41
|
+
}
|
|
42
|
+
// ------------------------------------------------------------------
|
|
43
|
+
// HasRightToLeftCharacters
|
|
44
|
+
//
|
|
45
|
+
// Per RFC 5893 §1.4: "An RTL label is a label that contains at least
|
|
46
|
+
// one character of type R, AL, or AN." Used to determine whether a
|
|
47
|
+
// domain name is a "Bidi domain name" (RFC 5893 §1.4), in which case
|
|
48
|
+
// the Bidi Rule applies to every label in the domain.
|
|
49
|
+
// ------------------------------------------------------------------
|
|
50
|
+
export function HasRightToLeftCharacters(value) {
|
|
51
|
+
for (const ch of value)
|
|
52
|
+
if (RE_RTL_CLASSES.test(GetBidiClass(ch.codePointAt(0))))
|
|
53
|
+
return true;
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
// ------------------------------------------------------------------
|
|
57
|
+
// SatisfiesBidiRule
|
|
58
|
+
// ------------------------------------------------------------------
|
|
59
|
+
export function SatisfiesBidiRule(value) {
|
|
60
|
+
let isRtl = false;
|
|
61
|
+
let allowed = RE_LTR_ALLOWED;
|
|
62
|
+
let sawEN = false;
|
|
63
|
+
let sawAN = false;
|
|
64
|
+
let isFirst = true;
|
|
65
|
+
// let lastClass: string | null = null // (no-spec-coverage)
|
|
66
|
+
for (const ch of value) {
|
|
67
|
+
const bidiClass = GetBidiClass(ch.codePointAt(0));
|
|
68
|
+
if (isFirst) {
|
|
69
|
+
// 1. The first character must be a character with Bidi property L, R, or AL.
|
|
70
|
+
if (bidiClass !== 'L' && bidiClass !== 'R' && bidiClass !== 'AL')
|
|
71
|
+
return false;
|
|
72
|
+
isRtl = bidiClass === 'R' || bidiClass === 'AL';
|
|
73
|
+
allowed = isRtl ? RE_RTL_ALLOWED : RE_LTR_ALLOWED;
|
|
74
|
+
isFirst = false;
|
|
75
|
+
}
|
|
76
|
+
// 2 / 5. Only characters in the allowed set for this direction may appear.
|
|
77
|
+
if (!allowed.test(bidiClass))
|
|
78
|
+
return false;
|
|
79
|
+
if (bidiClass === 'EN')
|
|
80
|
+
sawEN = true;
|
|
81
|
+
else if (bidiClass === 'AN')
|
|
82
|
+
sawAN = true;
|
|
83
|
+
// if (bidiClass !== 'NSM') lastClass = bidiClass // (no-spec-coverage)
|
|
84
|
+
}
|
|
85
|
+
if (isRtl && sawEN && sawAN)
|
|
86
|
+
return false; // spec coverage path
|
|
87
|
+
// (no-spec-coverage)
|
|
88
|
+
// if (isRtl) {
|
|
89
|
+
// // 3. The end of the label must be R, AL, EN, or AN (ignoring trailing NSM).
|
|
90
|
+
// // if (lastClass !== 'R' && lastClass !== 'AL' && lastClass !== 'EN' && lastClass !== 'AN') return false
|
|
91
|
+
// // 4. If an EN is present, no AN may be present, and vice versa.
|
|
92
|
+
// if (sawEN && sawAN) return false
|
|
93
|
+
// } else {
|
|
94
|
+
// // 6. The end of the label must be L or EN (ignoring trailing NSM).
|
|
95
|
+
// // if (lastClass !== 'L' && lastClass !== 'EN') return false
|
|
96
|
+
// }
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import * as Pattern from '../pattern/pattern.mjs';
|
|
2
|
+
// ------------------------------------------------------------------
|
|
3
|
+
// PunyCode (RFC 3492)
|
|
4
|
+
// ------------------------------------------------------------------
|
|
5
|
+
const PUNYCODE_BASE = 36;
|
|
6
|
+
const PUNYCODE_TMIN = 1;
|
|
7
|
+
const PUNYCODE_TMAX = 26;
|
|
8
|
+
const PUNYCODE_SKEW = 38;
|
|
9
|
+
const PUNYCODE_DAMP = 700;
|
|
10
|
+
const PUNYCODE_INITIAL_BIAS = 72;
|
|
11
|
+
const PUNYCODE_INITIAL_N = 128;
|
|
12
|
+
// ------------------------------------------------------------------
|
|
13
|
+
// ThrowDontCare
|
|
14
|
+
// ------------------------------------------------------------------
|
|
15
|
+
function ThrowDontCare() {
|
|
16
|
+
throw null;
|
|
17
|
+
}
|
|
18
|
+
// ------------------------------------------------------------------
|
|
19
|
+
// IsAcePrefixed
|
|
20
|
+
// ------------------------------------------------------------------
|
|
21
|
+
export function IsAcePrefixed(value) {
|
|
22
|
+
return value.toLowerCase().startsWith('xn--');
|
|
23
|
+
}
|
|
24
|
+
// ------------------------------------------------------------------
|
|
25
|
+
// Adapt
|
|
26
|
+
// ------------------------------------------------------------------
|
|
27
|
+
function Adapt(delta, numPoints, firstTime) {
|
|
28
|
+
delta = firstTime ? Math.floor(delta / PUNYCODE_DAMP) : delta >> 1;
|
|
29
|
+
delta += Math.floor(delta / numPoints);
|
|
30
|
+
let k = 0;
|
|
31
|
+
while (delta > (((PUNYCODE_BASE - PUNYCODE_TMIN) * PUNYCODE_TMAX) >> 1)) {
|
|
32
|
+
delta = Math.floor(delta / (PUNYCODE_BASE - PUNYCODE_TMIN));
|
|
33
|
+
k += PUNYCODE_BASE;
|
|
34
|
+
}
|
|
35
|
+
return k + Math.floor(((PUNYCODE_BASE - PUNYCODE_TMIN + 1) * delta) / (delta + PUNYCODE_SKEW));
|
|
36
|
+
}
|
|
37
|
+
// ------------------------------------------------------------------
|
|
38
|
+
// Decode
|
|
39
|
+
// ------------------------------------------------------------------
|
|
40
|
+
export function Decode(value) {
|
|
41
|
+
const output = [];
|
|
42
|
+
let n = PUNYCODE_INITIAL_N;
|
|
43
|
+
let i = 0;
|
|
44
|
+
let bias = PUNYCODE_INITIAL_BIAS;
|
|
45
|
+
const delimIdx = value.lastIndexOf('-');
|
|
46
|
+
if (delimIdx > 0) {
|
|
47
|
+
for (let j = 0; j < delimIdx; j++) {
|
|
48
|
+
const cp = value.charCodeAt(j);
|
|
49
|
+
if (cp >= 128)
|
|
50
|
+
ThrowDontCare(); // throw new Error('Invalid punycode: non-basic before delimiter')
|
|
51
|
+
output.push(cp);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
let inIdx = delimIdx < 0 ? 0 : delimIdx + 1;
|
|
55
|
+
while (inIdx < value.length) {
|
|
56
|
+
const oldi = i;
|
|
57
|
+
let w = 1;
|
|
58
|
+
let k = PUNYCODE_BASE;
|
|
59
|
+
while (true) {
|
|
60
|
+
if (inIdx >= value.length)
|
|
61
|
+
ThrowDontCare(); // throw new Error('Invalid punycode: unexpected end of input')
|
|
62
|
+
const ch = value.charCodeAt(inIdx++);
|
|
63
|
+
let digit;
|
|
64
|
+
if (ch >= 0x61 && ch <= 0x7a)
|
|
65
|
+
digit = ch - 0x61; // a-z => 0-25
|
|
66
|
+
else if (ch >= 0x30 && ch <= 0x39)
|
|
67
|
+
digit = ch - 0x30 + 26; // 0-9 => 26-35
|
|
68
|
+
// else if (ch >= 0x41 && ch <= 0x5a) digit = ch - 0x41 // A-Z => 0-25 // (no-spec-coverage)
|
|
69
|
+
else
|
|
70
|
+
ThrowDontCare(); // throw new Error('Invalid punycode: bad digit character')
|
|
71
|
+
i += digit * w;
|
|
72
|
+
const t = k <= bias ? PUNYCODE_TMIN : k >= bias + PUNYCODE_TMAX ? PUNYCODE_TMAX : k - bias;
|
|
73
|
+
if (digit < t)
|
|
74
|
+
break;
|
|
75
|
+
w *= PUNYCODE_BASE - t;
|
|
76
|
+
k += PUNYCODE_BASE;
|
|
77
|
+
}
|
|
78
|
+
const outLen = output.length + 1;
|
|
79
|
+
bias = Adapt(i - oldi, outLen, oldi === 0);
|
|
80
|
+
n += Math.floor(i / outLen);
|
|
81
|
+
i %= outLen;
|
|
82
|
+
output.splice(i, 0, n);
|
|
83
|
+
i++;
|
|
84
|
+
}
|
|
85
|
+
return String.fromCodePoint(...output);
|
|
86
|
+
}
|
|
87
|
+
// ------------------------------------------------------------------
|
|
88
|
+
// DigitToChar
|
|
89
|
+
// ------------------------------------------------------------------
|
|
90
|
+
function DigitToChar(digit) {
|
|
91
|
+
return digit < 26 ? String.fromCharCode(digit + 0x61) : String.fromCharCode(digit - 26 + 0x30);
|
|
92
|
+
}
|
|
93
|
+
// ------------------------------------------------------------------
|
|
94
|
+
// Encode
|
|
95
|
+
//
|
|
96
|
+
// Encodes a Unicode string into its Punycode payload (the part that
|
|
97
|
+
// follows the 'xn--' ACE prefix). Used to compute the true A-label
|
|
98
|
+
// length of a U-label, since the 63-octet label length limit (RFC
|
|
99
|
+
// 5891 §4.2.4) applies to the encoded form, not the code point count.
|
|
100
|
+
// ------------------------------------------------------------------
|
|
101
|
+
const RE_REPLACE_NON_ASCII = new RegExp(Pattern.RE_NON_ASCII.source, 'gu');
|
|
102
|
+
export function Encode(input) {
|
|
103
|
+
// Extract basic ASCII characters and set initial output array state
|
|
104
|
+
const basic = input.replace(RE_REPLACE_NON_ASCII, '');
|
|
105
|
+
const basicLength = basic.length;
|
|
106
|
+
const result = basicLength > 0 ? [basic, '-'] : [];
|
|
107
|
+
// Extract unicode codepoints
|
|
108
|
+
const codePoints = Array.from(input, (char) => char.codePointAt(0));
|
|
109
|
+
let n = PUNYCODE_INITIAL_N;
|
|
110
|
+
let delta = 0;
|
|
111
|
+
let bias = PUNYCODE_INITIAL_BIAS;
|
|
112
|
+
let handledCPCount = basicLength;
|
|
113
|
+
while (handledCPCount < codePoints.length) {
|
|
114
|
+
let m = Infinity;
|
|
115
|
+
for (const cp of codePoints) {
|
|
116
|
+
if (cp >= n && cp < m)
|
|
117
|
+
m = cp;
|
|
118
|
+
}
|
|
119
|
+
delta += (m - n) * (handledCPCount + 1);
|
|
120
|
+
n = m;
|
|
121
|
+
for (const cp of codePoints) {
|
|
122
|
+
if (cp < n)
|
|
123
|
+
delta++;
|
|
124
|
+
if (cp === n) {
|
|
125
|
+
let q = delta;
|
|
126
|
+
for (let k = PUNYCODE_BASE;; k += PUNYCODE_BASE) {
|
|
127
|
+
const t = k <= bias ? PUNYCODE_TMIN : k >= bias + PUNYCODE_TMAX ? PUNYCODE_TMAX : k - bias;
|
|
128
|
+
if (q < t)
|
|
129
|
+
break;
|
|
130
|
+
const digit = t + ((q - t) % (PUNYCODE_BASE - t));
|
|
131
|
+
result.push(DigitToChar(digit));
|
|
132
|
+
q = Math.floor((q - t) / (PUNYCODE_BASE - t));
|
|
133
|
+
}
|
|
134
|
+
result.push(DigitToChar(q));
|
|
135
|
+
bias = Adapt(delta, handledCPCount + 1, handledCPCount === basicLength);
|
|
136
|
+
delta = 0;
|
|
137
|
+
handledCPCount++;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
delta++;
|
|
141
|
+
n++;
|
|
142
|
+
}
|
|
143
|
+
return result.join('');
|
|
144
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function IsHostname(value: string): boolean;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as LabelAscii from './label/ascii.mjs';
|
|
2
|
+
import * as LabelPuny from './label/puny.mjs';
|
|
3
|
+
function IsValidLabelLength(value) {
|
|
4
|
+
return value.length > 0 && value.length <= 63;
|
|
5
|
+
}
|
|
6
|
+
function IsLabel(value) {
|
|
7
|
+
return IsValidLabelLength(value) && (LabelPuny.IsPunyLabel(value) ||
|
|
8
|
+
LabelAscii.IsAsciiLabel(value));
|
|
9
|
+
}
|
|
10
|
+
export function IsHostname(value) {
|
|
11
|
+
if (value.length === 0 || value.length > 253)
|
|
12
|
+
return false;
|
|
13
|
+
if (value.charCodeAt(value.length - 1) === 46)
|
|
14
|
+
return false;
|
|
15
|
+
return value.split('.').every((label) => IsLabel(label));
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function IsIdnHostname(value: string): boolean;
|