From b31552e8f2710a17ea22cee788a83d7f0f508d44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halvard=20M=C3=B8rstad?= Date: Sun, 4 Oct 2026 22:55:20 +0200 Subject: [PATCH] chore: changed jsr namespace to stdx --- AGENTS.md | 6 +- README.md | 58 +++++++-------- Releases.md | 106 +++++++++++++------------- _wasm/xml_xml/src/lib.rs | 2 +- assert/README.md | 4 +- assert/deno.json | 2 +- assert/is_number.ts | 4 +- assert/is_numeric.ts | 4 +- assert/is_record.ts | 4 +- assert/is_string.ts | 4 +- assert/mod.ts | 2 +- cli/README.md | 6 +- cli/command.test.ts | 8 +- cli/command.ts | 6 +- cli/deno.json | 4 +- cli/parse_args.ts | 2 +- collections/README.md | 4 +- collections/deferred_stack.ts | 2 +- collections/deno.json | 2 +- crypto/README.md | 20 ++--- crypto/deno.json | 2 +- crypto/hash.ts | 6 +- crypto/hash/argon2.ts | 8 +- crypto/hash/bcrypt.ts | 8 +- crypto/hash/mod.ts | 2 +- crypto/hash/scrypt.ts | 8 +- crypto/hmac.ts | 4 +- crypto/hotp.ts | 8 +- crypto/scram.ts | 4 +- crypto/totp.ts | 6 +- crypto/utils.ts | 6 +- database/README.md | 18 ++--- database/RFC_SQL.md | 14 ++-- database/deno.json | 2 +- database/drivers/sqlite/client.ts | 6 +- database/drivers/sqlite/driver.ts | 10 +-- database/drivers/sqlite/mod.ts | 4 +- database/sql/README.md | 26 +++---- database/sql/asserts.ts | 120 +++++++++++++++--------------- database/sql/client.ts | 12 +-- database/sql/core.ts | 90 +++++++++++----------- database/sql/errors.ts | 16 ++-- database/sql/events.ts | 26 +++---- database/sql/template.ts | 8 +- database/sql/testing.ts | 32 ++++---- database/sql/utils.ts | 8 +- encoding/README.md | 4 +- encoding/binary.ts | 6 +- encoding/deno.json | 2 +- encoding/hex.ts | 4 +- event/README.md | 2 +- event/deno.json | 2 +- event/mod.ts | 4 +- ffi/README.md | 2 +- ffi/deno.json | 4 +- ffi/dlopen.test.ts | 2 +- ffi/dlopen.ts | 8 +- fs/README.md | 2 +- fs/cache.ts | 2 +- fs/deno.json | 4 +- http/README.md | 2 +- http/deno.json | 2 +- json/README.md | 8 +- json/deno.json | 2 +- json/json_schema.ts | 2 +- json/json_schema/2020_12.ts | 2 +- json/jsonpath.ts | 6 +- json/mod.ts | 4 +- lexer/README.md | 4 +- lexer/deno.json | 2 +- lexer/mod.ts | 4 +- lexer/string_tokenizer.ts | 6 +- types/README.md | 4 +- types/deno.json | 2 +- types/mod.ts | 26 +++---- validation/README.md | 22 +++--- validation/composites.ts | 2 +- validation/constraints.ts | 2 +- validation/core.test.ts | 2 +- validation/core.ts | 10 +-- validation/deno.json | 2 +- validation/mod.test.ts | 2 +- validation/mod.ts | 4 +- validation/schemas.ts | 2 +- validation/utils.ts | 2 +- xml/README.md | 16 ++-- xml/_wasm/xml_xml.mjs | 2 +- xml/deno.json | 2 +- xml/mod.test.ts | 4 +- xml/mod.ts | 12 +-- zip/README.md | 4 +- zip/deno.json | 4 +- zip/fs.ts | 4 +- zip/unzip.ts | 6 +- zip/zip.ts | 4 +- 95 files changed, 468 insertions(+), 468 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index e3ee32d..df96710 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,7 +1,7 @@ # AGENTS.md An extension of the [Deno Standard Library](https://github.com/denoland/std), -published on JSR under the `@stdext` scope. +published on JSR under the `@stdx` scope. ## Repository layout @@ -10,8 +10,8 @@ Each top-level directory (except `_tools`, `_wasm`, `coverage`) is one package: ``` / - deno.json # name (@stdext/), version, exports map - README.md # package docs, follows the stdext template + deno.json # name (@stdx/), version, exports map + README.md # package docs, follows the stdx template mod.ts # root module, re-exports the package's public API *.test.ts # colocated tests *.bench.ts # optional benchmarks diff --git a/README.md b/README.md index 2c65387..ea1d50d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Deno Standard Library Extended +# Deno Standard Library Extended (stdx) -[![JSR @stdext](https://jsr.io/badges/@stdext)](https://jsr.io/@stdext) +[![JSR @stdx](https://jsr.io/badges/@stdx)](https://jsr.io/@stdx) [![codecov](https://codecov.io/gh/halvardssm/std-js/graph/badge.svg?token=T1JEMGF8VW)](https://codecov.io/gh/halvardssm/std-js) [![ci](https://github.com/halvardssm/std-js/actions/workflows/ci.yml/badge.svg)](https://github.com/halvardssm/std-js/actions/workflows/ci.yml) @@ -16,13 +16,13 @@ which are provided in the standard library of other languages. Add the JSR package. ``` -deno add @stdext/[package] +deno add @stdx/[package] ``` Example: ``` -deno add @stdext/encoding +deno add @stdx/encoding ``` ## Usage @@ -30,7 +30,7 @@ deno add @stdext/encoding Import the module or sub-module. ```ts -import { dump } from "@stdext/encoding/hex"; +import { dump } from "@stdx/encoding/hex"; const buffer = new TextEncoder().encode( "The quick brown fox jumps over the lazy dog.", @@ -43,40 +43,40 @@ console.log(dump(buffer)); ## Packages -- [assert](https://jsr.io/@stdext/assert): The assert package, contains - validators and assertions -- [cli](https://jsr.io/@stdext/cli): The cli package contains a command - framework and helpers for building command line applications -- [collections](https://jsr.io/@stdext/collections): The collections package +- [assert](https://jsr.io/@stdx/assert): The assert package, contains validators + and assertions +- [cli](https://jsr.io/@stdx/cli): The cli package contains a command framework + and helpers for building command line applications +- [collections](https://jsr.io/@stdx/collections): The collections package contains commonly used utilities and structures -- [crypto](https://jsr.io/@stdext/crypto): The crypto package contains utility - for crypto, hashing, HMAC and SCRAM authentication -- [database](https://jsr.io/@stdext/database): The database package contains +- [crypto](https://jsr.io/@stdx/crypto): The crypto package contains utility for + crypto, hashing, HMAC and SCRAM authentication +- [database](https://jsr.io/@stdx/database): The database package contains interfaces and helpers for interacting with databases, and SQLite and Postgres drivers -- [encoding](https://jsr.io/@stdext/encoding): The encoding package contains +- [encoding](https://jsr.io/@stdx/encoding): The encoding package contains utility for text and binary encoding. -- [event](https://jsr.io/@stdext/event): The event package contains extensions - for events -- [ffi](https://jsr.io/@stdext/ffi): The FFI package contains helpers when using +- [event](https://jsr.io/@stdx/event): The event package contains extensions for + events +- [ffi](https://jsr.io/@stdx/ffi): The FFI package contains helpers when using FFI -- [fs](https://jsr.io/@stdext/fs): The fs package contains helpers for the file +- [fs](https://jsr.io/@stdx/fs): The fs package contains helpers for the file system -- [http](https://jsr.io/@stdext/http): The http package contains utility for +- [http](https://jsr.io/@stdx/http): The http package contains utility for fetching and http servers -- [json](https://jsr.io/@stdext/json): The json package, contains helpers for - json parsing, querying (jsonpath) and processing -- [lexer](https://jsr.io/@stdext/lexer): The lexer package contains general +- [json](https://jsr.io/@stdx/json): The json package, contains helpers for json + parsing, querying (jsonpath) and processing +- [lexer](https://jsr.io/@stdx/lexer): The lexer package contains general purpose lexers/tokenizers -- [types](https://jsr.io/@stdext/types): The types package, contains general +- [types](https://jsr.io/@stdx/types): The types package, contains general purpose type helpers -- [validation](https://jsr.io/@stdext/validation): The validation package, - builds schemas that implement both Standard Schema and Standard JSON Schema, - with fully inferred types -- [xml](https://jsr.io/@stdext/xml): The xml package provides XML parsing, +- [validation](https://jsr.io/@stdx/validation): The validation package, builds + schemas that implement both Standard Schema and Standard JSON Schema, with + fully inferred types +- [xml](https://jsr.io/@stdx/xml): The xml package provides XML parsing, serialization, and XSD validation, backed by a WebAssembly implementation -- [zip](https://jsr.io/@stdext/zip): The zip package contains helpers for - creating and extracting zip archives +- [zip](https://jsr.io/@stdx/zip): The zip package contains helpers for creating + and extracting zip archives ## Platform support diff --git a/Releases.md b/Releases.md index 5e73847..6793226 100644 --- a/Releases.md +++ b/Releases.md @@ -1,30 +1,30 @@ ### 2026.10.04 -#### @stdext/assert 0.1.1 (patch) +#### @stdx/assert 0.1.1 (patch) - fix(assert): Added message as option argument to asserts, and added object asserts -#### @stdext/cli 0.0.2 (patch) +#### @stdx/cli 0.0.2 (patch) - feat(cli): added further options to command - feat(cli): added command - feat(cli): Added cli module with parseArgs -#### @stdext/collections 0.1.0 (minor) +#### @stdx/collections 0.1.0 (minor) - feat(collections)!: fix DeferredStack release, add clear and abortable pop - feat(collections): add deferred stack - fix(collections): added release and remove callbacks -#### @stdext/crypto 0.2.0 (minor) +#### @stdx/crypto 0.2.0 (minor) - feat(crypto)!: add HMAC and SCRAM, align module interfaces - fix(crypto): password verification - fix(crypto): Fixed errors due to changes in deno types - chore(crypto): change ts-ignore to ts-expect-error -#### @stdext/database 0.1.0 (minor) +#### @stdx/database 0.1.0 (minor) - feat(database): added docs and examples - feat(database)!: refactored code @@ -41,35 +41,35 @@ - docs(database): Moved the RFC - chore(database): removed postgres driver and cleaned up tests -#### @stdext/encoding 0.1.1 (patch) +#### @stdx/encoding 0.1.1 (patch) - feat(encoding): add binary reader and writer -#### @stdext/event 0.1.1 (patch) +#### @stdx/event 0.1.1 (patch) - feat(event): added docs and tests -#### @stdext/ffi 0.0.2 (patch) +#### @stdx/ffi 0.0.2 (patch) - feat(ffi): added docs and tests -#### @stdext/fs 0.0.2 (patch) +#### @stdx/fs 0.0.2 (patch) - feat(fs): added docs and tests -#### @stdext/json 0.1.1 (patch) +#### @stdx/json 0.1.1 (patch) - feat(json): Added JSON Schema - fix(json): Added exports and format types - chore(json): fix lint -#### @stdext/types 0.1.1 (patch) +#### @stdx/types 0.1.1 (patch) - feat(types): added new constructor type helper and added examples to existing type helpers - feat(types): added type and improved documentation -#### @stdext/validation 0.1.2 (patch) +#### @stdx/validation 0.1.2 (patch) - feat(validation): added more helpers - feat(validation): refactor validation @@ -81,32 +81,32 @@ - fix(validation): Improved docs and tests - chore(validation): Added jsdoc and improved readme - thanks AI -#### @stdext/zip 0.0.2 (patch) +#### @stdx/zip 0.0.2 (patch) - feat(zip): add zip and unzip for archives and directories - fix(zip): replace with std ### 2026.10.03 -#### @stdext/assert 0.1.1 (patch) +#### @stdx/assert 0.1.1 (patch) - fix(assert): Added message as option argument to asserts, and added object asserts -#### @stdext/collections 0.0.5 (patch) +#### @stdx/collections 0.0.5 (patch) - feat(collections)!: fix DeferredStack release, add clear and abortable pop - feat(collections): add deferred stack - fix(collections): added release and remove callbacks -#### @stdext/crypto 0.1.1 (patch) +#### @stdx/crypto 0.1.1 (patch) - feat(crypto)!: add HMAC and SCRAM, align module interfaces - fix(crypto): password verification - fix(crypto): Fixed errors due to changes in deno types - chore(crypto): change ts-ignore to ts-expect-error -#### @stdext/database 0.0.1 (patch) +#### @stdx/database 0.0.1 (patch) - feat(database): added docs and examples - feat(database)!: refactored code @@ -122,35 +122,35 @@ - docs(database): Moved the RFC - chore(database): removed postgres driver and cleaned up tests -#### @stdext/encoding 0.1.1 (patch) +#### @stdx/encoding 0.1.1 (patch) - feat(encoding): add binary reader and writer -#### @stdext/event 0.1.0 (minor) +#### @stdx/event 0.1.0 (minor) - feat(event): added docs and tests -#### @stdext/ffi 0.0.1 (patch) +#### @stdx/ffi 0.0.1 (patch) - feat(ffi): added docs and tests -#### @stdext/fs 0.0.1 (patch) +#### @stdx/fs 0.0.1 (patch) - feat(fs): added docs and tests -#### @stdext/json 0.1.1 (patch) +#### @stdx/json 0.1.1 (patch) - feat(json): Added JSON Schema - fix(json): Added exports and format types - chore(json): fix lint -#### @stdext/types 0.1.1 (patch) +#### @stdx/types 0.1.1 (patch) - feat(types): added new constructor type helper and added examples to existing type helpers - feat(types): added type and improved documentation -#### @stdext/validation 0.1.0 (minor) +#### @stdx/validation 0.1.0 (minor) - feat(validation): Added tests and jsdoc - thanks AI - feat(validation): Implemented a basic validator implementing StandardSchemaV1, @@ -160,23 +160,23 @@ ### 2026.10.02 -#### @stdext/crypto 0.1.1 (patch) +#### @stdx/crypto 0.1.1 (patch) - fix(crypto): password verification - fix(crypto): Fixed errors due to changes in deno types -#### @stdext/json 0.1.1 (patch) +#### @stdx/json 0.1.1 (patch) - feat(json): Added JSON Schema - fix(json): Added exports and format types - chore(json): fix lint -#### @stdext/types 0.1.1 (patch) +#### @stdx/types 0.1.1 (patch) - feat(types): added new constructor type helper and added examples to existing type helpers -#### @stdext/validation 0.1.0 (minor) +#### @stdx/validation 0.1.0 (minor) - feat(validation): Added tests and jsdoc - thanks AI - feat(validation): Implemented a basic validator implementing StandardSchemaV1, @@ -186,22 +186,22 @@ ### 2026.08.14 -#### @stdext/crypto 0.1.1 (patch) +#### @stdx/crypto 0.1.1 (patch) - fix(crypto): Fixed errors due to changes in deno types -#### @stdext/json 0.1.1 (patch) +#### @stdx/json 0.1.1 (patch) - feat(json): Added JSON Schema - fix(json): Added exports and format types - chore(json): fix lint -#### @stdext/types 0.1.1 (patch) +#### @stdx/types 0.1.1 (patch) - feat(types): added new constructor type helper and added examples to existing type helpers -#### @stdext/validation 0.1.0 (minor) +#### @stdx/validation 0.1.0 (minor) - feat(validation): Added tests and jsdoc - thanks AI - feat(validation): Implemented a basic validator implementing StandardSchemaV1, @@ -211,93 +211,93 @@ ### 2024.12.29a -#### @stdext/assert 0.1.0 (minor) +#### @stdx/assert 0.1.0 (minor) - BREAKING(*): bump all versions to minor 1.0 -#### @stdext/crypto 0.1.0 (minor) +#### @stdx/crypto 0.1.0 (minor) - BREAKING(*): bump all versions to minor 1.0 -#### @stdext/encoding 0.1.0 (minor) +#### @stdx/encoding 0.1.0 (minor) - BREAKING(*): bump all versions to minor 1.0 -#### @stdext/http 0.1.0 (minor) +#### @stdx/http 0.1.0 (minor) - BREAKING(*): bump all versions to minor 1.0 -#### @stdext/json 0.1.0 (minor) +#### @stdx/json 0.1.0 (minor) - BREAKING(*): bump all versions to minor 1.0 -#### @stdext/lexer 0.1.0 (minor) +#### @stdx/lexer 0.1.0 (minor) - BREAKING(*): bump all versions to minor 1.0 -#### @stdext/types 0.1.0 (minor) +#### @stdx/types 0.1.0 (minor) - BREAKING(*): bump all versions to minor 1.0 ### 2024.12.29 -#### @stdext/crypto 0.0.7 (patch) +#### @stdx/crypto 0.0.7 (patch) - fix(crypto): Improved throw messages ### 2024.10.15 -#### @stdext/assert 0.0.2 (patch) +#### @stdx/assert 0.0.2 (patch) - feat(assert): updated readme -#### @stdext/crypto 0.0.6 (patch) +#### @stdx/crypto 0.0.6 (patch) - feat(crypto): updated readme -#### @stdext/encoding 0.0.6 (patch) +#### @stdx/encoding 0.0.6 (patch) - feat(encoding): updated readme -#### @stdext/http 0.0.6 (patch) +#### @stdx/http 0.0.6 (patch) - feat(http): updated readme -#### @stdext/json 0.0.2 (patch) +#### @stdx/json 0.0.2 (patch) - feat(json): updated readme -#### @stdext/lexer 0.0.2 (patch) +#### @stdx/lexer 0.0.2 (patch) - feat(lexer): updated readme -#### @stdext/types 0.0.2 (patch) +#### @stdx/types 0.0.2 (patch) - feat(types): updated readme ### 2024.10.15 -#### @stdext/collections 0.0.5 (patch) +#### @stdx/collections 0.0.5 (patch) - feat(collections): add deferred stack - fix(collections): added release and remove callbacks ### 2024.05.06 -#### @stdext/crypto 0.0.5 (patch) +#### @stdx/crypto 0.0.5 (patch) - refactor(crypto/hash): crypto hash to allign with the signature of WebCrypto - feat(crypto/hash): added scrypt hashing algorithm ### 2024.04.29 -#### @stdext/crypto 0.0.3 (patch) +#### @stdx/crypto 0.0.3 (patch) - feat(crypto): added package - feat(crypto/hash): added argon2 hash - feat(crypto/hash): added bcrypt hash -#### @stdext/http 0.0.3 (patch) +#### @stdx/http 0.0.3 (patch) - feat(http): added package - feat(http/header): added IANA HTTP headers @@ -305,13 +305,13 @@ ### 2024.04.28 -#### @stdext/encoding 0.0.2 (patch) +#### @stdx/encoding 0.0.2 (patch) - chore(core): added documentation ### 2024.04.28 -#### @stdext/encoding 0.0.1 (patch) +#### @stdx/encoding 0.0.1 (patch) - feat(encoding): added package - feat(encoding/hex): added hexdump diff --git a/_wasm/xml_xml/src/lib.rs b/_wasm/xml_xml/src/lib.rs index e662c9f..13e513a 100644 --- a/_wasm/xml_xml/src/lib.rs +++ b/_wasm/xml_xml/src/lib.rs @@ -1,6 +1,6 @@ // _wasm/xml_xml/src/lib.rs // -// @stdext/xml — wasm bindings for the `uppsala` crate, producing trees that +// @stdx/xml — wasm bindings for the `uppsala` crate, producing trees that // are drop-in compatible with @std/xml (https://jsr.io/@std/xml). // // Values cross the wasm boundary as plain JS values (serde-wasm-bindgen): diff --git a/assert/README.md b/assert/README.md index a783733..3d1ed30 100644 --- a/assert/README.md +++ b/assert/README.md @@ -1,4 +1,4 @@ -# @stdext/assert +# @stdx/assert Extends [@std/assert](https://jsr.io/@std/assert) @@ -7,7 +7,7 @@ The assert package, contains validators and assertions ## Example ```ts -import { assertIsString, isString } from "@stdext/assert"; +import { assertIsString, isString } from "@stdx/assert"; const someVar: unknown = "hello"; diff --git a/assert/deno.json b/assert/deno.json index 84b5130..3a3f922 100644 --- a/assert/deno.json +++ b/assert/deno.json @@ -1,6 +1,6 @@ { "version": "0.1.1", - "name": "@stdext/assert", + "name": "@stdx/assert", "exports": { ".": "./mod.ts", "./is_number": "./is_number.ts", diff --git a/assert/is_number.ts b/assert/is_number.ts index 20a4d3a..c4ce3bf 100644 --- a/assert/is_number.ts +++ b/assert/is_number.ts @@ -11,7 +11,7 @@ import { AssertionError } from "@std/assert"; * * @example * ```ts - * import { isNumber } from "@stdext/assert"; + * import { isNumber } from "@stdx/assert"; * import { assert, assertFalse } from "@std/assert"; * * assert(isNumber(42)); @@ -33,7 +33,7 @@ export function isNumber(value: unknown): value is number { * * @example * ```ts - * import { assertIsNumber } from "@stdext/assert"; + * import { assertIsNumber } from "@stdx/assert"; * import { assertThrows } from "@std/assert"; * * assertIsNumber(42); diff --git a/assert/is_numeric.ts b/assert/is_numeric.ts index 7b61edf..a815f8a 100644 --- a/assert/is_numeric.ts +++ b/assert/is_numeric.ts @@ -12,7 +12,7 @@ import { isNumber } from "./is_number.ts"; * * @example * ```ts - * import { isNumeric } from "@stdext/assert"; + * import { isNumeric } from "@stdx/assert"; * import { assert, assertFalse } from "@std/assert"; * * assert(isNumeric(42)); @@ -33,7 +33,7 @@ export function isNumeric(value: unknown): value is number { * * @example * ```ts - * import { assertIsNumeric } from "@stdext/assert"; + * import { assertIsNumeric } from "@stdx/assert"; * import { assertThrows } from "@std/assert"; * * assertIsNumeric(42); diff --git a/assert/is_record.ts b/assert/is_record.ts index e1f576a..b61e68f 100644 --- a/assert/is_record.ts +++ b/assert/is_record.ts @@ -13,7 +13,7 @@ import { isObject } from "./is_object.ts"; * * @example * ```ts - * import { isRecord } from "@stdext/assert"; + * import { isRecord } from "@stdx/assert"; * import { assert, assertFalse } from "@std/assert"; * * assert(isRecord({})); @@ -49,7 +49,7 @@ export function isRecord(value: unknown): value is Record { * * @example * ```ts - * import { assertIsRecord } from "@stdext/assert"; + * import { assertIsRecord } from "@stdx/assert"; * import { assertThrows } from "@std/assert"; * * assertIsRecord({ key: "value" }); diff --git a/assert/is_string.ts b/assert/is_string.ts index b6dbb96..5318e6d 100644 --- a/assert/is_string.ts +++ b/assert/is_string.ts @@ -11,7 +11,7 @@ import { AssertionError } from "@std/assert"; * * @example * ```ts - * import { isString } from "@stdext/assert"; + * import { isString } from "@stdx/assert"; * import { assert, assertFalse } from "@std/assert"; * * assert(isString("hello")); @@ -32,7 +32,7 @@ export function isString(value: unknown): value is string { * * @example * ```ts - * import { assertIsString } from "@stdext/assert"; + * import { assertIsString } from "@stdx/assert"; * import { assertThrows } from "@std/assert"; * * assertIsString("hello"); diff --git a/assert/mod.ts b/assert/mod.ts index d708a30..a1d238f 100644 --- a/assert/mod.ts +++ b/assert/mod.ts @@ -8,7 +8,7 @@ * * @example * ```ts - * import { assertIsNumber, isString } from "@stdext/assert"; + * import { assertIsNumber, isString } from "@stdx/assert"; * import { assert } from "@std/assert"; * * const value: unknown = "hello"; diff --git a/cli/README.md b/cli/README.md index 7b95ef0..ef556ea 100644 --- a/cli/README.md +++ b/cli/README.md @@ -1,4 +1,4 @@ -# @stdext/cli +# @stdx/cli Extends [@std/cli](https://jsr.io/@std/cli) @@ -10,7 +10,7 @@ The cli package contains helpers for building command line applications. arguments given to `run` are typed from the definition. ```ts ignore -import { defineCommand, runCommand } from "@stdext/cli"; +import { defineCommand, runCommand } from "@stdx/cli"; const serve = defineCommand({ name: "serve", @@ -87,7 +87,7 @@ flags in `required`, and in `default`, are not `undefined` in the type of the result. ```ts -import { parseArgs } from "@stdext/cli/parse-args"; +import { parseArgs } from "@stdx/cli/parse-args"; const args = parseArgs(["--name", "foo"], { string: ["name"], diff --git a/cli/command.test.ts b/cli/command.test.ts index c6ef60e..5328912 100644 --- a/cli/command.test.ts +++ b/cli/command.test.ts @@ -815,17 +815,17 @@ Deno.test("runCommand helpOnEmpty", async (t) => { Deno.test("runCommand reads the environment", async (t) => { const command = defineCommand({ name: "x", - options: { v: { type: "string", env: "STDEXT_CLI_TEST_VAR" } }, + options: { v: { type: "string", env: "STDX_CLI_TEST_VAR" } }, run: ({ flags, stdout }) => stdout(String(flags.v)), }); await t.step("from the process", async () => { const out: string[] = []; - Deno.env.set("STDEXT_CLI_TEST_VAR", "from-process"); + Deno.env.set("STDX_CLI_TEST_VAR", "from-process"); try { await runCommand(command, [], { stdout: (line) => out.push(line) }); } finally { - Deno.env.delete("STDEXT_CLI_TEST_VAR"); + Deno.env.delete("STDX_CLI_TEST_VAR"); } assertEquals(out, ["from-process"]); }); @@ -837,7 +837,7 @@ Deno.test("runCommand reads the environment", async (t) => { }"; const command = defineCommand({ name: "x", - options: { v: { type: "string", env: "STDEXT_CLI_TEST_VAR" } }, + options: { v: { type: "string", env: "STDX_CLI_TEST_VAR" } }, run: ({ flags, stdout }) => stdout(String(flags.v)), }); Deno.exit(await runCommand(command, [])); diff --git a/cli/command.ts b/cli/command.ts index 8198ce3..56f1512 100644 --- a/cli/command.ts +++ b/cli/command.ts @@ -148,7 +148,7 @@ export type AnyCommand = Command; * * @example * ```ts - * import { defineCommand } from "@stdext/cli/command"; + * import { defineCommand } from "@stdx/cli/command"; * import { assertEquals } from "@std/assert"; * * const serve = defineCommand({ @@ -249,7 +249,7 @@ function versions(path: ReadonlyArray): string[] { * * @example * ```ts - * import { defineCommand, renderHelp } from "@stdext/cli/command"; + * import { defineCommand, renderHelp } from "@stdx/cli/command"; * import { assert } from "@std/assert"; * * const cli = defineCommand({ name: "tool", description: "Does things" }); @@ -376,7 +376,7 @@ const FALSE = ["0", "false", "no", "off"]; * * @example * ```ts - * import { defineCommand, runCommand } from "@stdext/cli/command"; + * import { defineCommand, runCommand } from "@stdx/cli/command"; * import { assertEquals } from "@std/assert"; * * const cli = defineCommand({ diff --git a/cli/deno.json b/cli/deno.json index f314bc4..f8f92c2 100644 --- a/cli/deno.json +++ b/cli/deno.json @@ -1,6 +1,6 @@ { - "version": "0.0.2", - "name": "@stdext/cli", + "version": "0.1.0", + "name": "@stdx/cli", "exports": { ".": "./mod.ts", "./parse-args": "./parse_args.ts", diff --git a/cli/parse_args.ts b/cli/parse_args.ts index 6ccae94..c1faf15 100644 --- a/cli/parse_args.ts +++ b/cli/parse_args.ts @@ -105,7 +105,7 @@ export interface ParseArgsOptions< * * @example * ```ts - * import { parseArgs } from "@stdext/cli/parse-args"; + * import { parseArgs } from "@stdx/cli/parse-args"; * import { assertEquals, assertThrows } from "@std/assert"; * * const options = { string: ["name"], boolean: ["verbose"], required: ["name"] }; diff --git a/collections/README.md b/collections/README.md index 621dbaf..d8597ca 100644 --- a/collections/README.md +++ b/collections/README.md @@ -1,4 +1,4 @@ -# @stdext/collections +# @stdx/collections The collections package contains commonly used utilities and structures. @@ -11,7 +11,7 @@ until one is available. It is useful for resource pools, such as connection pools. ```ts -import { DeferredStack } from "@stdext/collections"; +import { DeferredStack } from "@stdx/collections"; const deferred = new DeferredStack({ maxSize: 1, diff --git a/collections/deferred_stack.ts b/collections/deferred_stack.ts index ccd05c0..2bb5816 100644 --- a/collections/deferred_stack.ts +++ b/collections/deferred_stack.ts @@ -39,7 +39,7 @@ export type DeferredStackPopOptions = { * * @example * ```ts - * import { DeferredStack } from "@stdext/collections"; + * import { DeferredStack } from "@stdx/collections"; * * const deferred = new DeferredStack({ maxSize: 1 }); * deferred.add(1); diff --git a/collections/deno.json b/collections/deno.json index 6600e61..3109097 100644 --- a/collections/deno.json +++ b/collections/deno.json @@ -1,6 +1,6 @@ { "version": "0.1.0", - "name": "@stdext/collections", + "name": "@stdx/collections", "exports": { ".": "./mod.ts", "./deferred-stack": "./deferred_stack.ts" diff --git a/crypto/README.md b/crypto/README.md index ec40797..7dbdd96 100644 --- a/crypto/README.md +++ b/crypto/README.md @@ -1,4 +1,4 @@ -# @stdext/crypto +# @stdx/crypto Extends [@std/crypto](https://jsr.io/@std/crypto) @@ -36,7 +36,7 @@ The following algorithms are provided: - Scrypt ```ts -import { AlgorithmName, hash, verify } from "@stdext/crypto/hash"; +import { AlgorithmName, hash, verify } from "@stdx/crypto/hash"; // By name, using default options const h = hash("argon2", "password"); @@ -55,7 +55,7 @@ Hashes can also be imported individually, although this should not be needed if tree shaking is available in your build process. ```ts -import { hash, verify } from "@stdext/crypto/hash/argon2"; +import { hash, verify } from "@stdx/crypto/hash/argon2"; const h = hash("password", { memoryCost: 8192 }); verify("password", h); @@ -66,7 +66,7 @@ verify("password", h); Keyed-hash message authentication codes, using the Web Crypto API. ```ts -import { hmac } from "@stdext/crypto/hmac"; +import { hmac } from "@stdx/crypto/hmac"; const mac = await hmac("SHA-256", "key", "message"); ``` @@ -78,7 +78,7 @@ The client side of the Salted Challenge Response Authentication Mechanism in for example Postgres, MongoDB, Kafka, IMAP and XMPP. ```ts ignore -import { ScramClient } from "@stdext/crypto/scram"; +import { ScramClient } from "@stdx/crypto/scram"; const scram = new ScramClient({ user: "user", password: "pencil" }); // Send scram.mechanism and scram.clientFirst() to the server @@ -90,8 +90,8 @@ await scram.verify(serverFinal); ### HOTP (HMAC One-Time Password) ```ts -import { generateHotp, verifyHotp } from "@stdext/crypto/hotp"; -import { generateSecret } from "@stdext/crypto/utils"; +import { generateHotp, verifyHotp } from "@stdx/crypto/hotp"; +import { generateSecret } from "@stdx/crypto/utils"; const secret = generateSecret(); const hotp = await generateHotp(secret, 42); @@ -106,8 +106,8 @@ await verifyHotp(hotp8, secret, 42, options); ### TOTP (Time-based One-Time Password) ```ts -import { generateTotp, verifyTotp } from "@stdext/crypto/totp"; -import { generateSecret } from "@stdext/crypto/utils"; +import { generateTotp, verifyTotp } from "@stdx/crypto/totp"; +import { generateSecret } from "@stdx/crypto/utils"; const secret = generateSecret(); const totp = await generateTotp(secret); @@ -122,7 +122,7 @@ await verifyTotp(totpAt, secret, options); ### Utils ```ts -import { generateSecretBytes } from "@stdext/crypto/utils"; +import { generateSecretBytes } from "@stdx/crypto/utils"; const secretBytes = generateSecretBytes(); // You can select your own encoding const encodedSecret = secretBytes.toBase64(); diff --git a/crypto/deno.json b/crypto/deno.json index 47b6916..cd7d2f4 100644 --- a/crypto/deno.json +++ b/crypto/deno.json @@ -1,6 +1,6 @@ { "version": "0.2.0", - "name": "@stdext/crypto", + "name": "@stdx/crypto", "exports": { "./hash": "./hash.ts", "./hash/argon2": "./hash/argon2.ts", diff --git a/crypto/hash.ts b/crypto/hash.ts index 89937f6..cf07182 100644 --- a/crypto/hash.ts +++ b/crypto/hash.ts @@ -12,7 +12,7 @@ * created with. * * ```ts - * import { hash, verify } from "@stdext/crypto/hash"; + * import { hash, verify } from "@stdx/crypto/hash"; * import { assert } from "@std/assert"; * * // By name, using default options: @@ -84,7 +84,7 @@ function getAlgorithm(algorithm: AlgorithmIdentifier): Algorithm { * * @example * ```ts - * import { hash } from "@stdext/crypto/hash"; + * import { hash } from "@stdx/crypto/hash"; * import { assertMatch } from "@std/assert"; * * // Argon2 with default options: @@ -126,7 +126,7 @@ export function hash(algorithm: AlgorithmIdentifier, data: string): string { * * @example * ```ts - * import { hash, verify } from "@stdext/crypto/hash"; + * import { hash, verify } from "@stdx/crypto/hash"; * import { assert, assertFalse } from "@std/assert"; * * const h = hash("bcrypt", "password"); diff --git a/crypto/hash/argon2.ts b/crypto/hash/argon2.ts index 5fe8963..89cdf8a 100644 --- a/crypto/hash/argon2.ts +++ b/crypto/hash/argon2.ts @@ -3,12 +3,12 @@ * * The hashes are PHC strings (`$argon2id$v=19$m=19456,t=2,p=1$...`) that embed the options and salt, so * {@linkcode verify} reads them from the hash. Prefer the - * algorithm-agnostic versions in `@stdext/crypto/hash` unless you need + * algorithm-agnostic versions in `@stdx/crypto/hash` unless you need * argon2-specific options. * * @example * ```ts - * import { hash, verify } from "@stdext/crypto/hash/argon2"; + * import { hash, verify } from "@stdx/crypto/hash/argon2"; * import { assert } from "@std/assert"; * * const h = hash("password", { algorithm: "argon2i", memoryCost: 8192, timeCost: 1 }); @@ -39,7 +39,7 @@ export type { Argon2Algorithm, Argon2Options }; * * @example * ```ts - * import { hash } from "@stdext/crypto/hash/argon2"; + * import { hash } from "@stdx/crypto/hash/argon2"; * * const h = hash("password", { algorithm: "argon2i", memoryCost: 8192, timeCost: 1 }); * ``` @@ -62,7 +62,7 @@ export function hash(data: string, options: Argon2Options = {}): string { * * @example * ```ts - * import { hash, verify } from "@stdext/crypto/hash/argon2"; + * import { hash, verify } from "@stdx/crypto/hash/argon2"; * import { assert, assertFalse } from "@std/assert"; * * const h = hash("password", { algorithm: "argon2i", memoryCost: 8192, timeCost: 1 }); diff --git a/crypto/hash/bcrypt.ts b/crypto/hash/bcrypt.ts index 697db0e..284d344 100644 --- a/crypto/hash/bcrypt.ts +++ b/crypto/hash/bcrypt.ts @@ -3,12 +3,12 @@ * * The hashes are PHC strings (`$2b$12$...`) that embed the options and salt, so * {@linkcode verify} reads them from the hash. Prefer the - * algorithm-agnostic versions in `@stdext/crypto/hash` unless you need + * algorithm-agnostic versions in `@stdx/crypto/hash` unless you need * bcrypt-specific options. * * @example * ```ts - * import { hash, verify } from "@stdext/crypto/hash/bcrypt"; + * import { hash, verify } from "@stdx/crypto/hash/bcrypt"; * import { assert } from "@std/assert"; * * const h = hash("password", { cost: 4 }); @@ -36,7 +36,7 @@ export type { BcryptOptions }; * * @example * ```ts - * import { hash } from "@stdext/crypto/hash/bcrypt"; + * import { hash } from "@stdx/crypto/hash/bcrypt"; * * const h = hash("password", { cost: 4 }); * ``` @@ -59,7 +59,7 @@ export function hash(data: string, options: BcryptOptions = {}): string { * * @example * ```ts - * import { hash, verify } from "@stdext/crypto/hash/bcrypt"; + * import { hash, verify } from "@stdx/crypto/hash/bcrypt"; * import { assert, assertFalse } from "@std/assert"; * * const h = hash("password", { cost: 4 }); diff --git a/crypto/hash/mod.ts b/crypto/hash/mod.ts index ef69daf..a938518 100644 --- a/crypto/hash/mod.ts +++ b/crypto/hash/mod.ts @@ -2,7 +2,7 @@ * The individual password hashing algorithms, each in its own namespace: * {@linkcode argon2}, {@linkcode bcrypt} and {@linkcode scrypt}. * - * Prefer the algorithm-agnostic `hash`/`verify` in `@stdext/crypto/hash`, + * Prefer the algorithm-agnostic `hash`/`verify` in `@stdx/crypto/hash`, * which dispatches on the algorithm name; these namespaces are for * algorithm-specific use. * diff --git a/crypto/hash/scrypt.ts b/crypto/hash/scrypt.ts index 1b33aa3..cce267a 100644 --- a/crypto/hash/scrypt.ts +++ b/crypto/hash/scrypt.ts @@ -3,12 +3,12 @@ * * The hashes are PHC strings (`$scrypt$ln=17,r=8,p=1$...`) that embed the options and salt, so * {@linkcode verify} reads them from the hash. Prefer the - * algorithm-agnostic versions in `@stdext/crypto/hash` unless you need + * algorithm-agnostic versions in `@stdx/crypto/hash` unless you need * scrypt-specific options. * * @example * ```ts - * import { hash, verify } from "@stdext/crypto/hash/scrypt"; + * import { hash, verify } from "@stdx/crypto/hash/scrypt"; * import { assert } from "@std/assert"; * * const h = hash("password", { logN: 10 }); @@ -36,7 +36,7 @@ export type { ScryptOptions }; * * @example * ```ts - * import { hash } from "@stdext/crypto/hash/scrypt"; + * import { hash } from "@stdx/crypto/hash/scrypt"; * * const h = hash("password", { logN: 10 }); * ``` @@ -59,7 +59,7 @@ export function hash(data: string, options: ScryptOptions = {}): string { * * @example * ```ts - * import { hash, verify } from "@stdext/crypto/hash/scrypt"; + * import { hash, verify } from "@stdx/crypto/hash/scrypt"; * import { assert, assertFalse } from "@std/assert"; * * const h = hash("password", { logN: 10 }); diff --git a/crypto/hmac.ts b/crypto/hmac.ts index 1f14064..c231f06 100644 --- a/crypto/hmac.ts +++ b/crypto/hmac.ts @@ -3,7 +3,7 @@ * * @example * ```ts - * import { hmac } from "@stdext/crypto/hmac"; + * import { hmac } from "@stdx/crypto/hmac"; * import { assertEquals } from "@std/assert"; * * const mac = await hmac("SHA-256", "key", "The quick brown fox jumps over the lazy dog"); @@ -37,7 +37,7 @@ function toBufferSource(value: BufferSource | string): BufferSource { * * @example * ```ts - * import { hmac } from "@stdext/crypto/hmac"; + * import { hmac } from "@stdx/crypto/hmac"; * import { assertEquals } from "@std/assert"; * * const mac = await hmac("SHA-1", new Uint8Array(20), "data"); diff --git a/crypto/hotp.ts b/crypto/hotp.ts index c94acbb..bd1b7fc 100644 --- a/crypto/hotp.ts +++ b/crypto/hotp.ts @@ -3,7 +3,7 @@ * * @example * ```ts - * import { generateHotp, verifyHotp } from "@stdext/crypto/hotp"; + * import { generateHotp, verifyHotp } from "@stdx/crypto/hotp"; * import { assert } from "@std/assert"; * * const key = "OCOMBLGUREYUXFQJIL75FQFCKYFCKLQP"; @@ -64,7 +64,7 @@ export function counterToBuffer(counter: number): Uint8Array { /** * Generates an HMAC-SHA1 hash of the key and data. * - * @deprecated Use {@linkcode hmac} from `@stdext/crypto/hmac` instead: + * @deprecated Use {@linkcode hmac} from `@stdx/crypto/hmac` instead: * `hmac("SHA-1", key, data)`. * * @ignore @@ -140,7 +140,7 @@ export function equalOtp(a: string, b: string): boolean { * * @example * ```ts - * import { generateHotp } from "@stdext/crypto/hotp"; + * import { generateHotp } from "@stdx/crypto/hotp"; * import { assertEquals } from "@std/assert"; * * // Same key and counter always produce the same value. @@ -183,7 +183,7 @@ export async function generateHotp( * * @example * ```ts - * import { verifyHotp } from "@stdext/crypto/hotp"; + * import { verifyHotp } from "@stdx/crypto/hotp"; * import { assert, assertFalse } from "@std/assert"; * * assert(await verifyHotp("187492", "OCOMBLGUREYUXFQJIL75FQFCKYFCKLQP", 0)); diff --git a/crypto/scram.ts b/crypto/scram.ts index ec32b1a..2aad609 100644 --- a/crypto/scram.ts +++ b/crypto/scram.ts @@ -7,7 +7,7 @@ * * @example * ```ts - * import { ScramClient } from "@stdext/crypto/scram"; + * import { ScramClient } from "@stdx/crypto/scram"; * * const scram = new ScramClient({ hash: "SHA-256", user: "user", password: "pencil" }); * // 1. Send `scram.mechanism` and `scram.clientFirst()` to the server @@ -99,7 +99,7 @@ function escapeName(name: string): string { * * @example RFC 7677 test vector * ```ts - * import { ScramClient } from "@stdext/crypto/scram"; + * import { ScramClient } from "@stdx/crypto/scram"; * import { assertEquals } from "@std/assert"; * * const scram = new ScramClient({ diff --git a/crypto/totp.ts b/crypto/totp.ts index 2811c94..0a1d848 100644 --- a/crypto/totp.ts +++ b/crypto/totp.ts @@ -3,7 +3,7 @@ * * @example * ```ts - * import { generateTotp, verifyTotp } from "@stdext/crypto/totp"; + * import { generateTotp, verifyTotp } from "@stdx/crypto/totp"; * import { assert } from "@std/assert"; * * const key = "OCOMBLGUREYUXFQJIL75FQFCKYFCKLQP"; @@ -76,7 +76,7 @@ function getCounter(options: TotpOptions | undefined): number { * * @example * ```ts - * import { generateTotp } from "@stdext/crypto/totp"; + * import { generateTotp } from "@stdx/crypto/totp"; * import { assertEquals } from "@std/assert"; * * // Same key and time always produce the same value. @@ -111,7 +111,7 @@ export async function generateTotp( * * @example * ```ts - * import { verifyTotp } from "@stdext/crypto/totp"; + * import { verifyTotp } from "@stdx/crypto/totp"; * import { assert, assertFalse } from "@std/assert"; * * const key = "OCOMBLGUREYUXFQJIL75FQFCKYFCKLQP"; diff --git a/crypto/utils.ts b/crypto/utils.ts index e7f8467..d193b0d 100644 --- a/crypto/utils.ts +++ b/crypto/utils.ts @@ -11,7 +11,7 @@ import { encodeBase32 } from "@std/encoding/base32"; * * @example * ```ts - * import { generateSecretBytes } from "@stdext/crypto/utils"; + * import { generateSecretBytes } from "@stdx/crypto/utils"; * import { assert } from "@std/assert"; * * const secret = generateSecretBytes(20); @@ -42,8 +42,8 @@ export function generateSecretBytes(length: number = 20): Uint8Array { * * @example * ```ts - * import { generateSecret } from "@stdext/crypto/utils"; - * import { generateTotp } from "@stdext/crypto/totp"; + * import { generateSecret } from "@stdx/crypto/utils"; + * import { generateTotp } from "@stdx/crypto/totp"; * import { assert } from "@std/assert"; * * const secret = generateSecret(); diff --git a/database/README.md b/database/README.md index 99cd306..9e18838 100644 --- a/database/README.md +++ b/database/README.md @@ -1,4 +1,4 @@ -# @stdext/database +# @stdx/database The database package contains a standard interface for SQL databases, and drivers implementing it for SQLite and Postgres. It draws inspiration from @@ -8,7 +8,7 @@ Applications use one of the [drivers](#drivers), which all share the same interface: ```ts -import { SqliteClient } from "@stdext/database/drivers/sqlite"; +import { SqliteClient } from "@stdx/database/drivers/sqlite"; await using client = new SqliteClient(":memory:"); await client.execute("CREATE TABLE users (id INTEGER, name TEXT)"); @@ -41,12 +41,12 @@ connection: `DriverConnection`, with its `DriverRows`, `DriverStatement` and `DriverTransaction`. The client level adds pooling, nested transactions, SQL templates, lazy results, prepared statement caching, events and options. Driver authors verify their implementation with the conformance suites of -[`@stdext/database/sql/testing`](./sql/README.md#testing); no base classes are +[`@stdx/database/sql/testing`](./sql/README.md#testing); no base classes are required. #### SQLite -`@stdext/database/drivers/sqlite`, backed by the built-in `node:sqlite` module. +`@stdx/database/drivers/sqlite`, backed by the built-in `node:sqlite` module. The connection URL is a file path, a `file:` URL, or `:memory:`. Parameters use `?` placeholders, or `:name`, `@name` and `$name` placeholders with a record. @@ -61,7 +61,7 @@ The connection URL is a file path, a `file:` URL, or `:memory:`. Parameters use reports the `rowid` of inserted rows as `lastInsertId`. ```ts -import { SqliteClient } from "@stdext/database/drivers/sqlite"; +import { SqliteClient } from "@stdx/database/drivers/sqlite"; await using client = new SqliteClient(":memory:"); await client.execute("CREATE TABLE users (id INTEGER, name TEXT)"); @@ -71,7 +71,7 @@ console.log(await client.query("SELECT * FROM users").toRecords()); #### Postgres -`@stdext/database/drivers/postgres`, implemented in TypeScript on top of the +`@stdx/database/drivers/postgres`, implemented in TypeScript on top of the Postgres frontend/backend protocol, and requires the `net` permission. It supports SCRAM-SHA-256, MD5 and cleartext password authentication, TLS, streaming results, prepared statements, and cancelling queries with an @@ -93,7 +93,7 @@ streaming results, prepared statements, and cancelling queries with an and arrays of these. Override the parsers with `connectionOptions.parsers`. ```ts ignore -import { PostgresClient } from "@stdext/database/drivers/postgres"; +import { PostgresClient } from "@stdx/database/drivers/postgres"; await using client = new PostgresClient("postgres://user@localhost:5432/db", { connectionOptions: { password: "secret" }, @@ -108,9 +108,9 @@ console.log( ); ``` -The Postgres tests run against a live server when `STDEXT_POSTGRES_URL` is set: +The Postgres tests run against a live server when `STDX_POSTGRES_URL` is set: ```sh docker run -d -p 54329:5432 -e POSTGRES_PASSWORD=postgres postgres:17 -STDEXT_POSTGRES_URL=postgres://postgres:postgres@localhost:54329/postgres deno task test +STDX_POSTGRES_URL=postgres://postgres:postgres@localhost:54329/postgres deno task test ``` diff --git a/database/RFC_SQL.md b/database/RFC_SQL.md index 3aa4d33..8f76f8f 100644 --- a/database/RFC_SQL.md +++ b/database/RFC_SQL.md @@ -1,4 +1,4 @@ -# RFC: @stdext/database/sql - Standardized SQL Database Interface Specification +# RFC: @stdx/database/sql - Standardized SQL Database Interface Specification This RFC proposes a standardized interface for SQL-like database drivers. @@ -24,7 +24,7 @@ query builders. The specification is shown using TypeScript. The interfaces, the standard implementation of the client level, helper utilities and conformance test suites -are implemented in the [`@stdext/database`](https://jsr.io/@stdext/database) +are implemented in the [`@stdx/database`](https://jsr.io/@stdx/database) package, published on [JSR](https://jsr.io/). Drivers do not need to import the types to be compliant, as long as they follow the specification, but are encouraged to. @@ -238,8 +238,8 @@ This RFC is intended for: - The **client level** is the user facing interface: pooling, nested transactions, SQL templates, lazy results, prepared statement caching, events and options. It is implemented once, generically on top of any - driver, by the standard implementation in `@stdext/database/sql`. Drivers - do not implement it, so its behavior is the same for every database. + driver, by the standard implementation in `@stdx/database/sql`. Drivers do + not implement it, so its behavior is the same for every database. 2. **Async only.** All methods resolve to a `Promise`, except the client level `query`, which returns a lazy result whose consuming methods resolve to promises. Synchronous databases implement the driver level by wrapping their @@ -279,7 +279,7 @@ The specification defines: applications, migration tools, query builders │ Client level: Client, Connection, Transaction, │ PreparedStatement, ResultIterableContext - SqlClient (standard implementation, @stdext/database/sql) + SqlClient (standard implementation, @stdx/database/sql) │ Driver level: Driver, DriverConnection, DriverRows, │ DriverStatement, DriverTransaction, Dialect drivers: SQLite, Postgres, MySQL, ... (node:sqlite, bun:sqlite, ...) @@ -598,7 +598,7 @@ interface DriverSavepoint extends AsyncDisposable { ### Client Level The client level is the user facing interface. The standard implementation in -`@stdext/database/sql` implements it on top of any driver: +`@stdx/database/sql` implements it on top of any driver: ```ts ignore const client = new SqlClient(new SqliteDriver(), ":memory:", options); @@ -905,7 +905,7 @@ The driver level maps closely onto the database APIs of the JavaScript runtimes: ### Conformance -The `@stdext/database/sql/testing` entrypoint contains two conformance suites: +The `@stdx/database/sql/testing` entrypoint contains two conformance suites: - `testDriver(t, driver, url, sql)` tests the driver level, so that a library that only implements a driver can verify it. diff --git a/database/deno.json b/database/deno.json index 2606e9b..c67ec23 100644 --- a/database/deno.json +++ b/database/deno.json @@ -1,6 +1,6 @@ { "version": "0.1.0", - "name": "@stdext/database", + "name": "@stdx/database", "exports": { "./sql": "./sql/mod.ts", "./sql/testing": "./sql/testing.ts", diff --git a/database/drivers/sqlite/client.ts b/database/drivers/sqlite/client.ts index 94aac5a..92644ab 100644 --- a/database/drivers/sqlite/client.ts +++ b/database/drivers/sqlite/client.ts @@ -13,8 +13,8 @@ import { * * @example * ```ts - * import type { SqliteClientOptions } from "@stdext/database/drivers/sqlite"; - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; + * import type { SqliteClientOptions } from "@stdx/database/drivers/sqlite"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; * * const options: SqliteClientOptions = { * connectionOptions: { readOnly: true }, @@ -42,7 +42,7 @@ export interface SqliteClientOptions * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; * * await using client = new SqliteClient(":memory:"); * await client.execute("CREATE TABLE users (id INTEGER, name TEXT)"); diff --git a/database/drivers/sqlite/driver.ts b/database/drivers/sqlite/driver.ts index 0833f3d..5de6049 100644 --- a/database/drivers/sqlite/driver.ts +++ b/database/drivers/sqlite/driver.ts @@ -29,7 +29,7 @@ import { * * @example * ```ts - * import { SqliteDriver } from "@stdext/database/drivers/sqlite"; + * import { SqliteDriver } from "@stdx/database/drivers/sqlite"; * * const driver = new SqliteDriver(); * await using connection = await driver.connect(":memory:", { @@ -67,7 +67,7 @@ export interface SqliteConnectionOptions extends ConnectionOptions { * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; * * await using client = new SqliteClient(":memory:"); * // An immediate transaction takes its write lock right away. @@ -139,7 +139,7 @@ function wrapError( * * @example * ```ts - * import { sqliteDialect } from "@stdext/database/drivers/sqlite"; + * import { sqliteDialect } from "@stdx/database/drivers/sqlite"; * * console.log(sqliteDialect.name); // "sqlite" * console.log(sqliteDialect.placeholder(0)); // "?" @@ -166,7 +166,7 @@ export const sqliteDialect: Dialect = { * * @example * ```ts - * import { SqliteDriver } from "@stdext/database/drivers/sqlite"; + * import { SqliteDriver } from "@stdx/database/drivers/sqlite"; * * const driver = new SqliteDriver(); * await using connection = await driver.connect(":memory:"); @@ -217,7 +217,7 @@ export class SqliteDriver * * @example * ```ts - * import { SqliteDriver } from "@stdext/database/drivers/sqlite"; + * import { SqliteDriver } from "@stdx/database/drivers/sqlite"; * * const driver = new SqliteDriver(); * await using connection = await driver.connect(":memory:"); diff --git a/database/drivers/sqlite/mod.ts b/database/drivers/sqlite/mod.ts index 75e6fd8..2aa3084 100644 --- a/database/drivers/sqlite/mod.ts +++ b/database/drivers/sqlite/mod.ts @@ -1,6 +1,6 @@ /** * A SQLite driver implementing the - * {@link https://jsr.io/@stdext/database/doc/sql | @stdext/database/sql} + * {@link https://jsr.io/@stdx/database/doc/sql | @stdx/database/sql} * specification, backed by the built-in `node:sqlite` module. * * The {@linkcode SqliteDriver} implements the driver level: a `Dialect` and @@ -11,7 +11,7 @@ * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; * * await using client = new SqliteClient(":memory:"); * console.log(await client.query("SELECT 1 + 1 AS solution").toRecords()); diff --git a/database/sql/README.md b/database/sql/README.md index 6050c57..0e08a0a 100644 --- a/database/sql/README.md +++ b/database/sql/README.md @@ -1,4 +1,4 @@ -# @stdext/database/sql +# @stdx/database/sql The SQL package contains a standard interface for SQL based databases. @@ -9,7 +9,7 @@ in [RFC_SQL.md](../RFC_SQL.md). The goal for this package is to have a standard interface for SQL-like database clients that can be used in Deno, Node and other JS runtimes. Applications use a driver with its preconfigured client, such as -[`@stdext/database/drivers/sqlite`](../README.md); this entrypoint is meant for +[`@stdx/database/drivers/sqlite`](../README.md); this entrypoint is meant for driver authors and for applications that wire up a driver with the standard client themselves. @@ -56,7 +56,7 @@ The examples use the SQLite driver, but every driver implementing the interfaces is used the same way: ```ts -import { SqliteClient } from "@stdext/database/drivers/sqlite"; +import { SqliteClient } from "@stdx/database/drivers/sqlite"; await using client = new SqliteClient(":memory:"); await client.execute("CREATE TABLE users (id INTEGER, name TEXT)"); @@ -89,8 +89,8 @@ The placeholder style of the parameters (`?`, `$1`, `:name`, ...) and the mapping of values depend on the driver. ```ts -import { sql } from "@stdext/database/sql"; -import { SqliteClient } from "@stdext/database/drivers/sqlite"; +import { sql } from "@stdx/database/sql"; +import { SqliteClient } from "@stdx/database/drivers/sqlite"; await using client = new SqliteClient(":memory:"); await client.execute("CREATE TABLE users (id INTEGER, name TEXT)"); @@ -117,7 +117,7 @@ and releases the underlying connection. Prepared statements are created with `prepare` (`Preparable`): ```ts -import { SqliteClient } from "@stdext/database/drivers/sqlite"; +import { SqliteClient } from "@stdx/database/drivers/sqlite"; await using client = new SqliteClient(":memory:"); await client.execute("CREATE TABLE users (id INTEGER, name TEXT)"); @@ -132,7 +132,7 @@ Transactions are created with `beginTransaction` or the `transaction` wrapper (`Transactionable`): ```ts -import { SqliteClient } from "@stdext/database/drivers/sqlite"; +import { SqliteClient } from "@stdx/database/drivers/sqlite"; await using client = new SqliteClient(":memory:"); await client.execute("CREATE TABLE users (id INTEGER, name TEXT)"); @@ -143,7 +143,7 @@ await tx.commit(); ``` ```ts -import { SqliteClient } from "@stdext/database/drivers/sqlite"; +import { SqliteClient } from "@stdx/database/drivers/sqlite"; await using client = new SqliteClient(":memory:"); await client.execute("CREATE TABLE users (id INTEGER, name TEXT)"); @@ -182,7 +182,7 @@ is finished or the prepared statement is deallocated. A connection can also be held manually: ```ts -import { SqliteClient } from "@stdext/database/drivers/sqlite"; +import { SqliteClient } from "@stdx/database/drivers/sqlite"; await using client = new SqliteClient(":memory:"); await client.execute("CREATE TABLE users (id INTEGER, name TEXT)"); @@ -215,8 +215,8 @@ need to be implemented: the standard `SqlClient` works on top of any driver, and a driver usually exports a preconfigured client bound to it: ```ts ignore -import type { ClientOptions } from "@stdext/database/sql"; -import { SqlClient } from "@stdext/database/sql"; +import type { ClientOptions } from "@stdx/database/sql"; +import { SqlClient } from "@stdx/database/sql"; export class MyDriver implements Driver { /* connect, and run statements on a single connection */ @@ -240,12 +240,12 @@ Helper utilities for driver authors are available in [utils.ts](./utils.ts) and ### Testing -The `@stdext/database/sql/testing` entrypoint contains two conformance suites. A +The `@stdx/database/sql/testing` entrypoint contains two conformance suites. A driver that passes the driver suite, and whose client passes the client suite, is compliant with the specification: ```ts ignore -import { testClient, testDriver } from "@stdext/database/sql/testing"; +import { testClient, testDriver } from "@stdx/database/sql/testing"; Deno.test("MyDriver conformance", async (t) => { await testDriver(t, new MyDriver(), url, sql); diff --git a/database/sql/asserts.ts b/database/sql/asserts.ts index 824292a..a6cff64 100644 --- a/database/sql/asserts.ts +++ b/database/sql/asserts.ts @@ -9,7 +9,7 @@ import { optional, shape, string, -} from "@stdext/validation"; +} from "@stdx/validation"; import type { Eventable } from "./events.ts"; import type { Client, @@ -140,7 +140,7 @@ function assert( * * @example * ```ts - * import { isDialect } from "@stdext/database/sql"; + * import { isDialect } from "@stdx/database/sql"; * import { assert } from "@std/assert"; * * assert(isDialect({ @@ -159,7 +159,7 @@ export function isDialect(value: unknown): value is Dialect { * * @example * ```ts - * import { assertIsDialect } from "@stdext/database/sql"; + * import { assertIsDialect } from "@stdx/database/sql"; * import { assertThrows } from "@std/assert"; * import { AssertionError } from "@std/assert"; * @@ -180,8 +180,8 @@ export function assertIsDialect(value: unknown): asserts value is Dialect { * * @example * ```ts - * import { SqliteDriver } from "@stdext/database/drivers/sqlite"; - * import { isDriver } from "@stdext/database/sql"; + * import { SqliteDriver } from "@stdx/database/drivers/sqlite"; + * import { isDriver } from "@stdx/database/sql"; * import { assert, assertFalse } from "@std/assert"; * * assert(isDriver(new SqliteDriver())); @@ -197,8 +197,8 @@ export function isDriver(value: unknown): value is Driver { * * @example * ```ts - * import { SqliteDriver } from "@stdext/database/drivers/sqlite"; - * import { assertIsDriver } from "@stdext/database/sql"; + * import { SqliteDriver } from "@stdx/database/drivers/sqlite"; + * import { assertIsDriver } from "@stdx/database/sql"; * import { assertThrows } from "@std/assert"; * import { AssertionError } from "@std/assert"; * @@ -215,8 +215,8 @@ export function assertIsDriver(value: unknown): asserts value is Driver { * * @example * ```ts - * import { SqliteDriver } from "@stdext/database/drivers/sqlite"; - * import { isDriverConnection } from "@stdext/database/sql"; + * import { SqliteDriver } from "@stdx/database/drivers/sqlite"; + * import { isDriverConnection } from "@stdx/database/sql"; * import { assert, assertFalse } from "@std/assert"; * * const driver = new SqliteDriver(); @@ -235,8 +235,8 @@ export function isDriverConnection(value: unknown): value is DriverConnection { * * @example * ```ts - * import { SqliteDriver } from "@stdext/database/drivers/sqlite"; - * import { assertIsDriverConnection } from "@stdext/database/sql"; + * import { SqliteDriver } from "@stdx/database/drivers/sqlite"; + * import { assertIsDriverConnection } from "@stdx/database/sql"; * import { assertThrows } from "@std/assert"; * import { AssertionError } from "@std/assert"; * @@ -259,8 +259,8 @@ export function assertIsDriverConnection( * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; - * import { isConnectable } from "@stdext/database/sql"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; + * import { isConnectable } from "@stdx/database/sql"; * import { assert, assertFalse } from "@std/assert"; * * assert(isConnectable(new SqliteClient(":memory:"))); @@ -269,8 +269,8 @@ export function assertIsDriverConnection( * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; - * import { isConnectable } from "@stdext/database/sql"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; + * import { isConnectable } from "@stdx/database/sql"; * import { assert, assertFalse } from "@std/assert"; * * await using client = new SqliteClient(":memory:"); @@ -287,8 +287,8 @@ export function isConnectable(value: unknown): value is Connectable { * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; - * import { assertIsConnectable } from "@stdext/database/sql"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; + * import { assertIsConnectable } from "@stdx/database/sql"; * import { AssertionError, assertThrows } from "@std/assert"; * * await using client = new SqliteClient(":memory:"); @@ -307,8 +307,8 @@ export function assertIsConnectable( * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; - * import { isPingable } from "@stdext/database/sql"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; + * import { isPingable } from "@stdx/database/sql"; * import { assert, assertFalse } from "@std/assert"; * * await using client = new SqliteClient(":memory:"); @@ -325,8 +325,8 @@ export function isPingable(value: unknown): value is Pingable { * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; - * import { assertIsPingable } from "@stdext/database/sql"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; + * import { assertIsPingable } from "@stdx/database/sql"; * import { AssertionError, assertThrows } from "@std/assert"; * * await using client = new SqliteClient(":memory:"); @@ -343,7 +343,7 @@ export function assertIsPingable(value: unknown): asserts value is Pingable { * * @example * ```ts - * import { isQueryable } from "@stdext/database/sql"; + * import { isQueryable } from "@stdx/database/sql"; * import { assert, assertFalse } from "@std/assert"; * * assert(isQueryable({ execute() {}, query() {}, executeScript() {} })); @@ -359,8 +359,8 @@ export function isQueryable(value: unknown): value is Queryable { * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; - * import { assertIsQueryable } from "@stdext/database/sql"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; + * import { assertIsQueryable } from "@stdx/database/sql"; * import { AssertionError, assertThrows } from "@std/assert"; * * await using client = new SqliteClient(":memory:"); @@ -377,8 +377,8 @@ export function assertIsQueryable(value: unknown): asserts value is Queryable { * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; - * import { isPreparable } from "@stdext/database/sql"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; + * import { isPreparable } from "@stdx/database/sql"; * import { assert, assertFalse } from "@std/assert"; * * await using client = new SqliteClient(":memory:"); @@ -395,8 +395,8 @@ export function isPreparable(value: unknown): value is Preparable { * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; - * import { assertIsPreparable } from "@stdext/database/sql"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; + * import { assertIsPreparable } from "@stdx/database/sql"; * import { AssertionError, assertThrows } from "@std/assert"; * * await using client = new SqliteClient(":memory:"); @@ -415,8 +415,8 @@ export function assertIsPreparable( * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; - * import { isTransactionable } from "@stdext/database/sql"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; + * import { isTransactionable } from "@stdx/database/sql"; * import { assert, assertFalse } from "@std/assert"; * * await using client = new SqliteClient(":memory:"); @@ -433,8 +433,8 @@ export function isTransactionable(value: unknown): value is Transactionable { * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; - * import { assertIsTransactionable } from "@stdext/database/sql"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; + * import { assertIsTransactionable } from "@stdx/database/sql"; * import { AssertionError, assertThrows } from "@std/assert"; * * await using client = new SqliteClient(":memory:"); @@ -453,8 +453,8 @@ export function assertIsTransactionable( * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; - * import { isDialectable } from "@stdext/database/sql"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; + * import { isDialectable } from "@stdx/database/sql"; * import { assert, assertFalse } from "@std/assert"; * * await using client = new SqliteClient(":memory:"); @@ -471,8 +471,8 @@ export function isDialectable(value: unknown): value is Dialectable { * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; - * import { assertIsDialectable } from "@stdext/database/sql"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; + * import { assertIsDialectable } from "@stdx/database/sql"; * import { AssertionError, assertThrows } from "@std/assert"; * * await using client = new SqliteClient(":memory:"); @@ -491,8 +491,8 @@ export function assertIsDialectable( * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; - * import { isEventable } from "@stdext/database/sql"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; + * import { isEventable } from "@stdx/database/sql"; * import { assert, assertFalse } from "@std/assert"; * * await using client = new SqliteClient(":memory:"); @@ -509,8 +509,8 @@ export function isEventable(value: unknown): value is Eventable { * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; - * import { assertIsEventable } from "@stdext/database/sql"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; + * import { assertIsEventable } from "@stdx/database/sql"; * import { AssertionError, assertThrows } from "@std/assert"; * * await using client = new SqliteClient(":memory:"); @@ -527,8 +527,8 @@ export function assertIsEventable(value: unknown): asserts value is Eventable { * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; - * import { isPoolable } from "@stdext/database/sql"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; + * import { isPoolable } from "@stdx/database/sql"; * import { assert, assertFalse } from "@std/assert"; * * await using client = new SqliteClient(":memory:"); @@ -545,8 +545,8 @@ export function isPoolable(value: unknown): value is Poolable { * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; - * import { assertIsPoolable } from "@stdext/database/sql"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; + * import { assertIsPoolable } from "@stdx/database/sql"; * import { AssertionError, assertThrows } from "@std/assert"; * * await using client = new SqliteClient(":memory:"); @@ -563,8 +563,8 @@ export function assertIsPoolable(value: unknown): asserts value is Poolable { * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; - * import { isTransaction } from "@stdext/database/sql"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; + * import { isTransaction } from "@stdx/database/sql"; * import { assert, assertFalse } from "@std/assert"; * * await using client = new SqliteClient(":memory:"); @@ -582,8 +582,8 @@ export function isTransaction(value: unknown): value is Transaction { * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; - * import { assertIsTransaction } from "@stdext/database/sql"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; + * import { assertIsTransaction } from "@stdx/database/sql"; * import { AssertionError, assertThrows } from "@std/assert"; * * await using client = new SqliteClient(":memory:"); @@ -603,8 +603,8 @@ export function assertIsTransaction( * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; - * import { isPreparedStatement } from "@stdext/database/sql"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; + * import { isPreparedStatement } from "@stdx/database/sql"; * import { assert, assertFalse } from "@std/assert"; * * await using client = new SqliteClient(":memory:"); @@ -624,8 +624,8 @@ export function isPreparedStatement( * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; - * import { assertIsPreparedStatement } from "@stdext/database/sql"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; + * import { assertIsPreparedStatement } from "@stdx/database/sql"; * import { AssertionError, assertThrows } from "@std/assert"; * * await using client = new SqliteClient(":memory:"); @@ -645,8 +645,8 @@ export function assertIsPreparedStatement( * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; - * import { isConnection } from "@stdext/database/sql"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; + * import { isConnection } from "@stdx/database/sql"; * import { assert, assertFalse } from "@std/assert"; * * await using client = new SqliteClient(":memory:"); @@ -664,8 +664,8 @@ export function isConnection(value: unknown): value is Connection { * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; - * import { assertIsConnection } from "@stdext/database/sql"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; + * import { assertIsConnection } from "@stdx/database/sql"; * import { AssertionError, assertThrows } from "@std/assert"; * * await using client = new SqliteClient(":memory:"); @@ -685,8 +685,8 @@ export function assertIsConnection( * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; - * import { isClient } from "@stdext/database/sql"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; + * import { isClient } from "@stdx/database/sql"; * import { assert, assertFalse } from "@std/assert"; * * await using client = new SqliteClient(":memory:"); @@ -703,8 +703,8 @@ export function isClient(value: unknown): value is Client { * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; - * import { assertIsClient } from "@stdext/database/sql"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; + * import { assertIsClient } from "@stdx/database/sql"; * import { AssertionError, assertThrows } from "@std/assert"; * * await using client = new SqliteClient(":memory:"); diff --git a/database/sql/client.ts b/database/sql/client.ts index 990daef..777cb71 100644 --- a/database/sql/client.ts +++ b/database/sql/client.ts @@ -3,7 +3,7 @@ * * @module */ -import { DeferredStack, type DeferredStackElement } from "@stdext/collections"; +import { DeferredStack, type DeferredStackElement } from "@stdx/collections"; import type { Client, ClientOptions, @@ -246,7 +246,7 @@ interface PreparedStatementCalls { * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; * * await using client = new SqliteClient(":memory:"); * await client.execute("CREATE TABLE users (id INTEGER, name TEXT)"); @@ -349,7 +349,7 @@ interface TransactionContext { * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; * * await using client = new SqliteClient(":memory:"); * await client.execute("CREATE TABLE users (id INTEGER, name TEXT)"); @@ -543,7 +543,7 @@ export class SqlTransaction implements Transaction { * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; * * await using client = new SqliteClient(":memory:"); * await client.execute("CREATE TABLE users (id INTEGER, name TEXT)"); @@ -924,8 +924,8 @@ export class SqlConnection implements Connection { * * @example * ```ts - * import { SqlClient } from "@stdext/database/sql"; - * import { SqliteDriver } from "@stdext/database/drivers/sqlite"; + * import { SqlClient } from "@stdx/database/sql"; + * import { SqliteDriver } from "@stdx/database/drivers/sqlite"; * * await using client = new SqlClient(new SqliteDriver(), ":memory:"); * await client.execute("CREATE TABLE users (id INTEGER, name TEXT)"); diff --git a/database/sql/core.ts b/database/sql/core.ts index c03afb8..f895844 100644 --- a/database/sql/core.ts +++ b/database/sql/core.ts @@ -15,7 +15,7 @@ import type { ClientEventTarget, Eventable } from "./events.ts"; * * @example * ```ts - * import type { ParameterType } from "@stdext/database/sql"; + * import type { ParameterType } from "@stdx/database/sql"; * * // The types that JavaScript runtimes bind natively. * const values: ParameterType[] = [ @@ -50,7 +50,7 @@ export type ParameterType = * * @example * ```ts - * import type { QueryParameters } from "@stdext/database/sql"; + * import type { QueryParameters } from "@stdx/database/sql"; * * // Positional parameters, for databases with `?` or `$1` placeholders. * const positional: QueryParameters = ["Alice", 1]; @@ -70,7 +70,7 @@ export type QueryParameters = * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; * * await using client = new SqliteClient(":memory:"); * await client.execute("CREATE TABLE users (id INTEGER PRIMARY KEY)"); @@ -107,7 +107,7 @@ export interface ExecuteResult { * * @example * ```ts - * import { sql } from "@stdext/database/sql"; + * import { sql } from "@stdx/database/sql"; * import { assertEquals } from "@std/assert"; * * const id = 1; @@ -136,8 +136,8 @@ export interface SqlTemplate { * * @example * ```ts - * import { sql } from "@stdext/database/sql"; - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; + * import { sql } from "@stdx/database/sql"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; * * await using client = new SqliteClient(":memory:"); * await client.execute("CREATE TABLE users (id INTEGER, name TEXT)"); @@ -158,8 +158,8 @@ export type Statement = string | SqlTemplate; * * @example * ```ts - * import type { ConnectionOptions } from "@stdext/database/sql"; - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; + * import type { ConnectionOptions } from "@stdx/database/sql"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; * * // The standard option, and a driver specific one. * const options: ConnectionOptions = { @@ -187,7 +187,7 @@ export interface ConnectionOptions { * * @example * ```ts - * import { SqliteDriver } from "@stdext/database/drivers/sqlite"; + * import { SqliteDriver } from "@stdx/database/drivers/sqlite"; * * const driver = new SqliteDriver(); * await using connection = await driver.connect(":memory:"); @@ -216,7 +216,7 @@ export interface DriverQueryOptions { * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; * * await using client = new SqliteClient(":memory:", { * // Merged into every query of the client. @@ -258,7 +258,7 @@ export interface QueryOptions extends DriverQueryOptions { * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; * * await using client = new SqliteClient(":memory:"); * // SqliteTransactionOptions, extended by the driver: @@ -277,7 +277,7 @@ export interface TransactionOptions { * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; * * // A pool of four connections that closes connections after a minute idle. * await using client = new SqliteClient(":memory:", { @@ -328,8 +328,8 @@ export interface PoolOptions { * * @example * ```ts - * import type { ClientOptions } from "@stdext/database/sql"; - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; + * import type { ClientOptions } from "@stdx/database/sql"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; * * const options: ClientOptions = { * connectionOptions: { connectTimeout: 5000 }, @@ -378,8 +378,8 @@ export interface ClientOptions< * * @example * ```ts - * import type { Dialect } from "@stdext/database/sql"; - * import { SqliteDriver } from "@stdext/database/drivers/sqlite"; + * import type { Dialect } from "@stdx/database/sql"; + * import { SqliteDriver } from "@stdx/database/drivers/sqlite"; * * // A driver for a database with `?` placeholders. * const dialect: Dialect = new SqliteDriver().dialect; @@ -415,8 +415,8 @@ export interface Dialect { * * @example * ```ts - * import { SqliteDriver } from "@stdext/database/drivers/sqlite"; - * import { assertIsDriver } from "@stdext/database/sql"; + * import { SqliteDriver } from "@stdx/database/drivers/sqlite"; + * import { assertIsDriver } from "@stdx/database/sql"; * * const driver = new SqliteDriver(); * assertIsDriver(driver); @@ -463,8 +463,8 @@ export interface Driver< * * @example * ```ts - * import { SqliteDriver } from "@stdext/database/drivers/sqlite"; - * import { assertIsDriverConnection } from "@stdext/database/sql"; + * import { SqliteDriver } from "@stdx/database/drivers/sqlite"; + * import { assertIsDriverConnection } from "@stdx/database/sql"; * * const driver = new SqliteDriver(); * await using connection = await driver.connect(":memory:"); @@ -535,7 +535,7 @@ export interface DriverConnection< * * @example * ```ts - * import { SqliteDriver } from "@stdext/database/drivers/sqlite"; + * import { SqliteDriver } from "@stdx/database/drivers/sqlite"; * * const driver = new SqliteDriver(); * await using connection = await driver.connect(":memory:"); @@ -561,7 +561,7 @@ export interface DriverRows extends AsyncIterable, AsyncDisposable { * * @example * ```ts - * import { SqliteDriver } from "@stdext/database/drivers/sqlite"; + * import { SqliteDriver } from "@stdx/database/drivers/sqlite"; * * const driver = new SqliteDriver(); * await using connection = await driver.connect(":memory:"); @@ -605,7 +605,7 @@ export interface DriverStatement extends AsyncDisposable { * * @example * ```ts - * import { SqliteDriver } from "@stdext/database/drivers/sqlite"; + * import { SqliteDriver } from "@stdx/database/drivers/sqlite"; * * const driver = new SqliteDriver(); * await using connection = await driver.connect(":memory:"); @@ -645,7 +645,7 @@ export interface DriverTransaction extends AsyncDisposable { * * @example * ```ts - * import { SqliteDriver } from "@stdext/database/drivers/sqlite"; + * import { SqliteDriver } from "@stdx/database/drivers/sqlite"; * * const driver = new SqliteDriver(); * await using connection = await driver.connect(":memory:"); @@ -683,7 +683,7 @@ export interface DriverSavepoint extends AsyncDisposable { * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; * * await using client = new SqliteClient(":memory:"); * await client.execute("CREATE TABLE users (id INTEGER, name TEXT)"); @@ -732,7 +732,7 @@ export interface ResultObject< * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; * * await using client = new SqliteClient(":memory:"); * await client.execute("CREATE TABLE users (id INTEGER, name TEXT)"); @@ -773,7 +773,7 @@ export interface ResultIterableContext< * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; * * await using client = new SqliteClient(":memory:"); * console.log(client.connected); // false @@ -811,7 +811,7 @@ export interface Connectable extends AsyncDisposable { * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; * * await using client = new SqliteClient(":memory:"); * await client.ping(); // rejects with a ConnectionError when not alive @@ -833,9 +833,9 @@ export interface Pingable { * * @example * ```ts - * import type { Dialectable, Queryable } from "@stdext/database/sql"; - * import { sql } from "@stdext/database/sql"; - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; + * import type { Dialectable, Queryable } from "@stdx/database/sql"; + * import { sql } from "@stdx/database/sql"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; * * // A tool generating dialect specific SQL, such as RETURNING. * function returning(db: Queryable & Dialectable, id: number) { @@ -866,8 +866,8 @@ export interface Dialectable { * * @example * ```ts - * import type { Queryable } from "@stdext/database/sql"; - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; + * import type { Queryable } from "@stdx/database/sql"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; * * // A migration tool only depends on the Queryable capability, so that it * // works with any implementation. @@ -929,8 +929,8 @@ export interface Queryable { * * @example * ```ts - * import type { Preparable, PreparedStatement } from "@stdext/database/sql"; - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; + * import type { Preparable, PreparedStatement } from "@stdx/database/sql"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; * * // A tool depending on the Preparable capability only. * async function countBy(db: Preparable, table: string): Promise { @@ -953,7 +953,7 @@ export interface Preparable { * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; * * await using client = new SqliteClient(":memory:"); * await client.execute("CREATE TABLE users (id INTEGER, name TEXT)"); @@ -972,7 +972,7 @@ export interface Preparable { * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; * * await using client = new SqliteClient(":memory:"); * await client.execute("CREATE TABLE users (id INTEGER, name TEXT)"); @@ -1019,8 +1019,8 @@ export interface PreparedStatement extends AsyncDisposable { * * @example * ```ts - * import type { Transactionable } from "@stdext/database/sql"; - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; + * import type { Transactionable } from "@stdx/database/sql"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; * * // A tool depending on the Transactionable capability only: the callback * // commits on success, and rolls back and rethrows on errors. @@ -1047,7 +1047,7 @@ export interface Transactionable { * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; * * await using client = new SqliteClient(":memory:"); * await client.execute("CREATE TABLE users (id INTEGER, name TEXT)"); @@ -1072,7 +1072,7 @@ export interface Transactionable { * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; * * await using client = new SqliteClient(":memory:"); * await client.execute("CREATE TABLE users (id INTEGER, name TEXT)"); @@ -1122,7 +1122,7 @@ export interface Transaction * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; * * await using client = new SqliteClient(":memory:"); * await client.execute("CREATE TABLE users (id INTEGER)"); @@ -1153,7 +1153,7 @@ export interface Poolable { * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; * * await using client = new SqliteClient(":memory:"); * await client.execute("CREATE TABLE users (id INTEGER, name TEXT)"); @@ -1208,8 +1208,8 @@ export interface Connection * * @example * ```ts - * import type { Client } from "@stdext/database/sql"; - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; + * import type { Client } from "@stdx/database/sql"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; * * // Tools can depend on the Client interface, with every implementation. * const client: Client = new SqliteClient(":memory:"); diff --git a/database/sql/errors.ts b/database/sql/errors.ts index 155c50d..95075db 100644 --- a/database/sql/errors.ts +++ b/database/sql/errors.ts @@ -5,8 +5,8 @@ * * @example * ```ts - * import { DatabaseError } from "@stdext/database/sql"; - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; + * import { DatabaseError } from "@stdx/database/sql"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; * * try { * await new SqliteClient(":memory:").execute("THIS IS NOT VALID SQL"); @@ -31,8 +31,8 @@ export class DatabaseError extends Error { * * @example * ```ts - * import { ConnectionError } from "@stdext/database/sql"; - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; + * import { ConnectionError } from "@stdx/database/sql"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; * * await using client = new SqliteClient(":memory:"); * await client.close(); @@ -53,8 +53,8 @@ export class ConnectionError extends DatabaseError {} * * @example * ```ts - * import { QueryError } from "@stdext/database/sql"; - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; + * import { QueryError } from "@stdx/database/sql"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; * * await using client = new SqliteClient(":memory:"); * try { @@ -74,8 +74,8 @@ export class QueryError extends DatabaseError {} * * @example * ```ts - * import { TransactionError } from "@stdext/database/sql"; - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; + * import { TransactionError } from "@stdx/database/sql"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; * * await using client = new SqliteClient(":memory:"); * const tx = await client.beginTransaction(); diff --git a/database/sql/events.ts b/database/sql/events.ts index 63f72c0..8b701f2 100644 --- a/database/sql/events.ts +++ b/database/sql/events.ts @@ -1,5 +1,5 @@ import type { Client } from "./core.ts"; -import { CustomEvent, CustomEventTarget } from "@stdext/event"; +import { CustomEvent, CustomEventTarget } from "@stdx/event"; import type { DatabaseError } from "./errors.ts"; /** @@ -13,8 +13,8 @@ import type { DatabaseError } from "./errors.ts"; * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; - * import type { ClientEvent, ClientEventType } from "@stdext/database/sql"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; + * import type { ClientEvent, ClientEventType } from "@stdx/database/sql"; * * await using client = new SqliteClient(":memory:"); * client.eventTarget.addEventListener( @@ -44,8 +44,8 @@ export type ClientEventType = * * @example * ```ts - * import type { EventDetail } from "@stdext/database/sql"; - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; + * import type { EventDetail } from "@stdx/database/sql"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; * * await using client = new SqliteClient(":memory:"); * // Every event carries the client that dispatched it. @@ -70,9 +70,9 @@ export interface EventDetail { * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; - * import { QueryError } from "@stdext/database/sql"; - * import type { ClientEvent, ErrorEventDetail } from "@stdext/database/sql"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; + * import { QueryError } from "@stdx/database/sql"; + * import type { ClientEvent, ErrorEventDetail } from "@stdx/database/sql"; * * await using client = new SqliteClient(":memory:"); * client.eventTarget.addEventListener("error", (event) => { @@ -96,8 +96,8 @@ export interface ErrorEventDetail * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; - * import { ClientEvent } from "@stdext/database/sql"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; + * import { ClientEvent } from "@stdx/database/sql"; * * const events: ClientEvent[] = []; * await using client = new SqliteClient(":memory:"); @@ -119,7 +119,7 @@ export class ClientEvent< * * @example * ```ts - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; * * await using client = new SqliteClient(":memory:"); * let connects = 0; @@ -141,8 +141,8 @@ export class ClientEventTarget< * * @example * ```ts - * import type { Eventable } from "@stdext/database/sql"; - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; + * import type { Eventable } from "@stdx/database/sql"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; * * // Tools can depend on the events without depending on a client class. * function logEvents(db: Eventable): void { diff --git a/database/sql/template.ts b/database/sql/template.ts index 14b2456..19ce72d 100644 --- a/database/sql/template.ts +++ b/database/sql/template.ts @@ -11,8 +11,8 @@ import { QueryError } from "./errors.ts"; * * @example * ```ts - * import { sql } from "@stdext/database/sql"; - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; + * import { sql } from "@stdx/database/sql"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; * * await using client = new SqliteClient(":memory:"); * await client.execute(sql`CREATE TABLE users (id INTEGER, name TEXT)`); @@ -37,7 +37,7 @@ export function sql( * * @example * ```ts - * import { isSqlTemplate, sql } from "@stdext/database/sql"; + * import { isSqlTemplate, sql } from "@stdx/database/sql"; * import { assert, assertFalse } from "@std/assert"; * * assert(isSqlTemplate(sql`SELECT 1`)); @@ -66,7 +66,7 @@ export function isSqlTemplate(value: unknown): value is SqlTemplate { * * @example * ```ts - * import { renderStatement, sql } from "@stdext/database/sql"; + * import { renderStatement, sql } from "@stdx/database/sql"; * import { assertEquals } from "@std/assert"; * * const id = 1; diff --git a/database/sql/testing.ts b/database/sql/testing.ts index 26f099c..4d315da 100644 --- a/database/sql/testing.ts +++ b/database/sql/testing.ts @@ -44,8 +44,8 @@ import type { ClientEventTarget, Eventable } from "./events.ts"; * * @example * ```ts - * import type { Factory } from "@stdext/database/sql/testing"; - * import { SqliteClient } from "@stdext/database/drivers/sqlite"; + * import type { Factory } from "@stdx/database/sql/testing"; + * import { SqliteClient } from "@stdx/database/drivers/sqlite"; * * // A fresh client for every test step. * const create: Factory = () => new SqliteClient(":memory:"); @@ -61,8 +61,8 @@ export type Factory = () => T | Promise; * * @example * ```ts - * import { sql } from "@stdext/database/sql"; - * import type { TestSql } from "@stdext/database/sql/testing"; + * import { sql } from "@stdx/database/sql"; + * import type { TestSql } from "@stdx/database/sql/testing"; * * // The statements of the database dialect under test. * const sqlite: TestSql = { @@ -150,7 +150,7 @@ async function assertWaitsFor( * * @example * ```ts ignore - * import { testConnectable } from "@stdext/database/sql/testing"; + * import { testConnectable } from "@stdx/database/sql/testing"; * import { MyClient } from "./my_client.ts"; * * Deno.test("MyClient connectable", async (t) => { @@ -211,7 +211,7 @@ export async function testConnectable( * * @example * ```ts ignore - * import { testPingable } from "@stdext/database/sql/testing"; + * import { testPingable } from "@stdx/database/sql/testing"; * import { MyClient } from "./my_client.ts"; * * Deno.test("MyClient pingable", async (t) => { @@ -256,7 +256,7 @@ export async function testPingable( * * @example * ```ts ignore - * import { testQueryable } from "@stdext/database/sql/testing"; + * import { testQueryable } from "@stdx/database/sql/testing"; * import { MyClient } from "./my_client.ts"; * * Deno.test("MyClient queryable", async (t) => { @@ -492,7 +492,7 @@ export async function testQueryable( * * @example * ```ts ignore - * import { testPreparable } from "@stdext/database/sql/testing"; + * import { testPreparable } from "@stdx/database/sql/testing"; * import { MyClient } from "./my_client.ts"; * * Deno.test("MyClient preparable", async (t) => { @@ -591,7 +591,7 @@ export async function testPreparable( * * @example * ```ts ignore - * import { testTransactionable } from "@stdext/database/sql/testing"; + * import { testTransactionable } from "@stdx/database/sql/testing"; * import { MyClient } from "./my_client.ts"; * * Deno.test("MyClient transactionable", async (t) => { @@ -778,7 +778,7 @@ export async function testTransactionable( * * @example * ```ts ignore - * import { testEventable } from "@stdext/database/sql/testing"; + * import { testEventable } from "@stdx/database/sql/testing"; * import { MyClient } from "./my_client.ts"; * * Deno.test("MyClient eventable", async (t) => { @@ -821,7 +821,7 @@ export async function testEventable( * * @example * ```ts ignore - * import { testPoolable } from "@stdext/database/sql/testing"; + * import { testPoolable } from "@stdx/database/sql/testing"; * import { MyClient } from "./my_client.ts"; * * Deno.test("MyClient poolable", async (t) => { @@ -902,7 +902,7 @@ export async function testPoolable( * * @example * ```ts ignore - * import { testPool } from "@stdext/database/sql/testing"; + * import { testPool } from "@stdx/database/sql/testing"; * import { MyClient } from "./my_client.ts"; * * Deno.test("MyClient pool", async (t) => { @@ -1028,7 +1028,7 @@ export async function testPool( * * @example * ```ts ignore - * import { testConnection } from "@stdext/database/sql/testing"; + * import { testConnection } from "@stdx/database/sql/testing"; * import { MyClient } from "./my_client.ts"; * * Deno.test("MyClient connection", async (t) => { @@ -1097,8 +1097,8 @@ export async function testConnection( * * @example * ```ts ignore - * import { SqlClient } from "@stdext/database/sql"; - * import { testClient } from "@stdext/database/sql/testing"; + * import { SqlClient } from "@stdx/database/sql"; + * import { testClient } from "@stdx/database/sql/testing"; * * Deno.test("client conformance", async (t) => { * await testClient(t, (options) => new SqlClient(driver, url, options), sql); @@ -1219,7 +1219,7 @@ export async function testClient( * * @example * ```ts ignore - * import { testDriver } from "@stdext/database/sql/testing"; + * import { testDriver } from "@stdx/database/sql/testing"; * * Deno.test("driver conformance", async (t) => { * await testDriver(t, new MyDriver(), url, sql); diff --git a/database/sql/utils.ts b/database/sql/utils.ts index 6c3c4cf..8758d57 100644 --- a/database/sql/utils.ts +++ b/database/sql/utils.ts @@ -10,7 +10,7 @@ import { QueryError } from "./errors.ts"; * * @example * ```ts - * import type { Row } from "@stdext/database/sql"; + * import type { Row } from "@stdx/database/sql"; * * const row: Row = { * columns: ["id", "name"], @@ -47,7 +47,7 @@ export interface Row { * * @example * ```ts - * import { getObjectFromRow } from "@stdext/database/sql"; + * import { getObjectFromRow } from "@stdx/database/sql"; * import { assertEquals } from "@std/assert"; * * assertEquals( @@ -74,7 +74,7 @@ export function getObjectFromRow(row: Row): Record { * * @example * ```ts - * import type { ResultSource } from "@stdext/database/sql"; + * import type { ResultSource } from "@stdx/database/sql"; * * const source: ResultSource = { * // The columns are known before the first row. @@ -119,7 +119,7 @@ export interface ResultSource { * * @example * ```ts - * import { createResultIterableContext } from "@stdext/database/sql"; + * import { createResultIterableContext } from "@stdx/database/sql"; * import { assertEquals } from "@std/assert"; * * async function* rows() { diff --git a/encoding/README.md b/encoding/README.md index 3043075..6b352a4 100644 --- a/encoding/README.md +++ b/encoding/README.md @@ -1,4 +1,4 @@ -# @stdext/encoding +# @stdx/encoding Extends [@std/encoding](https://jsr.io/@std/encoding) @@ -13,7 +13,7 @@ messages of network protocols: signed and unsigned integers, big integers and floats in big or little endian byte order, raw bytes and UTF-8 strings. ```ts -import { BinaryReader, BinaryWriter } from "@stdext/encoding/binary"; +import { BinaryReader, BinaryWriter } from "@stdx/encoding/binary"; const writer = new BinaryWriter({ endian: "big" }); writer.uint8(1).int32(-2).cstring("hello").float64(1.5, "little"); diff --git a/encoding/binary.ts b/encoding/binary.ts index 28e057b..677d967 100644 --- a/encoding/binary.ts +++ b/encoding/binary.ts @@ -5,7 +5,7 @@ * * @example * ```ts - * import { BinaryReader, BinaryWriter } from "@stdext/encoding/binary"; + * import { BinaryReader, BinaryWriter } from "@stdx/encoding/binary"; * import { assertEquals } from "@std/assert"; * * const writer = new BinaryWriter(); @@ -63,7 +63,7 @@ const decoder = new TextDecoder(); * * @example Writing a length prefixed message * ```ts - * import { BinaryWriter } from "@stdext/encoding/binary"; + * import { BinaryWriter } from "@stdx/encoding/binary"; * import { assertEquals } from "@std/assert"; * * const writer = new BinaryWriter(); @@ -252,7 +252,7 @@ export class BinaryWriter { * * @example * ```ts - * import { BinaryReader } from "@stdext/encoding/binary"; + * import { BinaryReader } from "@stdx/encoding/binary"; * import { assertEquals } from "@std/assert"; * * const reader = new BinaryReader(new Uint8Array([0, 1, 2, 0, 104, 105, 0])); diff --git a/encoding/deno.json b/encoding/deno.json index 90931fe..2d4cc62 100644 --- a/encoding/deno.json +++ b/encoding/deno.json @@ -1,6 +1,6 @@ { "version": "0.1.1", - "name": "@stdext/encoding", + "name": "@stdx/encoding", "exports": { "./binary": "./binary.ts", "./hex": "./hex.ts" diff --git a/encoding/hex.ts b/encoding/hex.ts index 845f782..f6aed66 100644 --- a/encoding/hex.ts +++ b/encoding/hex.ts @@ -3,7 +3,7 @@ * * @example * ```ts - * import { dump } from "@stdext/encoding/hex"; + * import { dump } from "@stdx/encoding/hex"; * import { assertEquals } from "@std/assert"; * * const buffer = new TextEncoder().encode("Hello world!"); @@ -27,7 +27,7 @@ * * @example * ```ts - * import { dump } from "@stdext/encoding/hex"; + * import { dump } from "@stdx/encoding/hex"; * * const buffer = new TextEncoder().encode("The quick brown fox jumps over the lazy dog."); * console.log(dump(buffer)); diff --git a/event/README.md b/event/README.md index cc72c6f..b4e6d53 100644 --- a/event/README.md +++ b/event/README.md @@ -1,4 +1,4 @@ -# @stdext/event +# @stdx/event Extends [@std/event](https://jsr.io/@std/event) diff --git a/event/deno.json b/event/deno.json index ba95da5..0c5e8b6 100644 --- a/event/deno.json +++ b/event/deno.json @@ -1,6 +1,6 @@ { "version": "0.1.1", - "name": "@stdext/event", + "name": "@stdx/event", "exports": { ".": "./mod.ts" } diff --git a/event/mod.ts b/event/mod.ts index 8010c8e..abdb7e4 100644 --- a/event/mod.ts +++ b/event/mod.ts @@ -20,7 +20,7 @@ * * @example * ```ts - * import { CustomEvent } from "@stdext/event"; + * import { CustomEvent } from "@stdx/event"; * * const event = new CustomEvent<"notify", { message: string }>("notify", { * detail: { message: "hi" }, @@ -60,7 +60,7 @@ export class CustomEvent * * @example * ```ts - * import { CustomEvent, CustomEventTarget } from "@stdext/event"; + * import { CustomEvent, CustomEventTarget } from "@stdx/event"; * * type MyEvents = "notify"; * interface NotifyEvent extends CustomEvent {} diff --git a/ffi/README.md b/ffi/README.md index 93b0582..7c11d0a 100644 --- a/ffi/README.md +++ b/ffi/README.md @@ -1,3 +1,3 @@ -# @stdext/ffi +# @stdx/ffi The FFI package contains helpers when using FFI. diff --git a/ffi/deno.json b/ffi/deno.json index 7cca918..dee2b3e 100644 --- a/ffi/deno.json +++ b/ffi/deno.json @@ -1,6 +1,6 @@ { - "version": "0.0.2", - "name": "@stdext/ffi", + "version": "0.1.0", + "name": "@stdx/ffi", "exports": { ".": "./mod.ts", "./dlopen": "./dlopen.ts" diff --git a/ffi/dlopen.test.ts b/ffi/dlopen.test.ts index ef6a02b..606eca1 100644 --- a/ffi/dlopen.test.ts +++ b/ffi/dlopen.test.ts @@ -197,7 +197,7 @@ Deno.test("getCachePath", async (t) => { denoWithWritableBuild.build = { ...originalBuild, os: "linux" }; const result = await getCachePath(); - assertEquals(result, join(tempDir, ".cache/deno/stdext_dlopen_cache")); + assertEquals(result, join(tempDir, ".cache/deno/stdx_dlopen_cache")); } finally { // Restore environment if (originalDenoDir) { diff --git a/ffi/dlopen.ts b/ffi/dlopen.ts index 2cf80e3..63f1d34 100644 --- a/ffi/dlopen.ts +++ b/ffi/dlopen.ts @@ -1,7 +1,7 @@ import { ensureDir, exists } from "@std/fs"; -import { cacheFile, type CacheFileOptions, denoCacheDir } from "@stdext/fs"; +import { cacheFile, type CacheFileOptions, denoCacheDir } from "@stdx/fs"; import { dirname, join, resolve } from "@std/path"; -import { unzipDir } from "@stdext/zip/unzip"; +import { unzipDir } from "@stdx/zip/unzip"; /** * Options for dlopen function @@ -58,7 +58,7 @@ export type CacheOptions = CacheFileOptions & { * * @example * ```ts ignore - * import { dlopen } from "@stdext/ffi/dlopen"; + * import { dlopen } from "@stdx/ffi/dlopen"; * * const dylib = await dlopen( * { @@ -198,7 +198,7 @@ export async function getCachePath(path?: string): Promise { const denoCacheDirPath = await denoCacheDir(); - return join(denoCacheDirPath, "stdext_dlopen_cache"); + return join(denoCacheDirPath, "stdx_dlopen_cache"); } /** diff --git a/fs/README.md b/fs/README.md index 280a286..1b6d99f 100644 --- a/fs/README.md +++ b/fs/README.md @@ -1,4 +1,4 @@ -# @stdext/fs +# @stdx/fs Extends [@std/fs](https://jsr.io/@std/fs) diff --git a/fs/cache.ts b/fs/cache.ts index a477b95..16e15b0 100644 --- a/fs/cache.ts +++ b/fs/cache.ts @@ -41,7 +41,7 @@ export type CacheFileOptions = { * * @example * ```ts ignore - * import { cacheFile } from "@stdext/fs/cache"; + * import { cacheFile } from "@stdx/fs/cache"; * * // Downloads the file on the first call, and reuses it afterwards. * const readme = await cacheFile( diff --git a/fs/deno.json b/fs/deno.json index a1db87f..7223f7c 100644 --- a/fs/deno.json +++ b/fs/deno.json @@ -1,6 +1,6 @@ { - "version": "0.0.2", - "name": "@stdext/fs", + "version": "0.1.0", + "name": "@stdx/fs", "exports": { ".": "./mod.ts", "./cache": "./cache.ts" diff --git a/http/README.md b/http/README.md index 0738382..0048e48 100644 --- a/http/README.md +++ b/http/README.md @@ -1,4 +1,4 @@ -# @stdext/http +# @stdx/http Extends [@std/http](https://jsr.io/@std/http) diff --git a/http/deno.json b/http/deno.json index 950624b..82c8746 100644 --- a/http/deno.json +++ b/http/deno.json @@ -1,6 +1,6 @@ { "version": "0.1.0", - "name": "@stdext/http", + "name": "@stdx/http", "exports": { "./header": "./header.ts", "./method": "./method.ts" diff --git a/json/README.md b/json/README.md index 0705b3e..058e10e 100644 --- a/json/README.md +++ b/json/README.md @@ -1,4 +1,4 @@ -# @stdext/json +# @stdx/json Extends [@std/json](https://jsr.io/@std/json) @@ -12,8 +12,8 @@ processing JSONPath ([RFC9535](https://datatracker.ietf.org/doc/html/rfc9535)) ```ts -import { JSONPath } from "@stdext/json"; -// or: import { JSONPath } from "@stdext/json/jsonpath"; +import { JSONPath } from "@stdx/json"; +// or: import { JSONPath } from "@stdx/json/jsonpath"; const jp = new JSONPath({ a: "b" }); jp.query("$.a"); // ["b"] @@ -24,7 +24,7 @@ jp.query("$.a"); // ["b"] JSON Schema ([see](https://json-schema.org)) ```ts -import type { JSONSchema } from "@stdext/json/json-schema/2020-12"; +import type { JSONSchema } from "@stdx/json/json-schema/2020-12"; const schema: JSONSchema = { $schema: "https://json-schema.org/draft/2020-12/schema", diff --git a/json/deno.json b/json/deno.json index f71ef83..11e52f1 100644 --- a/json/deno.json +++ b/json/deno.json @@ -1,6 +1,6 @@ { "version": "0.1.1", - "name": "@stdext/json", + "name": "@stdx/json", "exports": { ".": "./mod.ts", "./jsonpath": "./jsonpath.ts", diff --git a/json/json_schema.ts b/json/json_schema.ts index f3420cc..6c68fac 100644 --- a/json/json_schema.ts +++ b/json/json_schema.ts @@ -6,7 +6,7 @@ * interface itself, import from the subpath: * * ```ts - * import type { JSONSchema } from "@stdext/json/json-schema/2020-12"; + * import type { JSONSchema } from "@stdx/json/json-schema/2020-12"; * * const schema: JSONSchema = { * $schema: "https://json-schema.org/draft/2020-12/schema", diff --git a/json/json_schema/2020_12.ts b/json/json_schema/2020_12.ts index 2189110..0f30d32 100644 --- a/json/json_schema/2020_12.ts +++ b/json/json_schema/2020_12.ts @@ -6,7 +6,7 @@ * * @example * ```ts - * import type { JSONSchema } from "@stdext/json/json-schema/2020-12"; + * import type { JSONSchema } from "@stdx/json/json-schema/2020-12"; * * const schema: JSONSchema = { * $schema: "https://json-schema.org/draft/2020-12/schema", diff --git a/json/jsonpath.ts b/json/jsonpath.ts index defb3d3..2f18a8a 100644 --- a/json/jsonpath.ts +++ b/json/jsonpath.ts @@ -19,7 +19,7 @@ export type JSONPathResult = WasmJSONPathResult; * * @example * ```ts - * import { JSONPath } from "@stdext/json/jsonpath"; + * import { JSONPath } from "@stdx/json/jsonpath"; * import { assertEquals } from "@std/assert"; * * const jp = new JSONPath({ a: "b", c: [1, 2, 3] }); @@ -57,7 +57,7 @@ export class JSONPath { * * @example * ```ts - * import { JSONPath } from "@stdext/json/jsonpath"; + * import { JSONPath } from "@stdx/json/jsonpath"; * import { assertEquals } from "@std/assert"; * * const jp = new JSONPath({ a: "b" }); @@ -81,7 +81,7 @@ export class JSONPath { * * @example * ```ts - * import { JSONPath } from "@stdext/json/jsonpath"; + * import { JSONPath } from "@stdx/json/jsonpath"; * import { assertEquals } from "@std/assert"; * * const jp = new JSONPath({ a: "b", c: [1, 2, 3] }); diff --git a/json/mod.ts b/json/mod.ts index 5d8698a..419f57a 100644 --- a/json/mod.ts +++ b/json/mod.ts @@ -1,12 +1,12 @@ /** - * The `@stdext/json` package. + * The `@stdx/json` package. * * Extends `@std/json` with a JSONPath implementation (RFC 9535) and JSON * Schema types for draft 2020-12. * * @example * ```ts - * import { JSONPath } from "@stdext/json"; + * import { JSONPath } from "@stdx/json"; * import { assertEquals } from "@std/assert"; * * const jp = new JSONPath({ a: "b" }); diff --git a/lexer/README.md b/lexer/README.md index cdbad6b..cd604eb 100644 --- a/lexer/README.md +++ b/lexer/README.md @@ -1,11 +1,11 @@ -# @stdext/lexer +# @stdx/lexer The lexer package contains general purpose lexers/tokenizers. ## Example ```ts -import { StringTokenizer } from "@stdext/lexer"; +import { StringTokenizer } from "@stdx/lexer"; const t = new StringTokenizer({ data: "ab1", diff --git a/lexer/deno.json b/lexer/deno.json index 3bde441..793aacc 100644 --- a/lexer/deno.json +++ b/lexer/deno.json @@ -1,6 +1,6 @@ { "version": "0.1.0", - "name": "@stdext/lexer", + "name": "@stdx/lexer", "exports": { ".": "./mod.ts", "./string_tokenizer": "./string_tokenizer.ts" diff --git a/lexer/mod.ts b/lexer/mod.ts index 8dcd8fd..41e359c 100644 --- a/lexer/mod.ts +++ b/lexer/mod.ts @@ -1,11 +1,11 @@ /** - * The `@stdext/lexer` package. + * The `@stdx/lexer` package. * * Lexing utilities: a general purpose {@linkcode StringTokenizer}. * * @example * ```ts - * import { StringTokenizer } from "@stdext/lexer"; + * import { StringTokenizer } from "@stdx/lexer"; * import { assertEquals } from "@std/assert"; * * const t = new StringTokenizer({ diff --git a/lexer/string_tokenizer.ts b/lexer/string_tokenizer.ts index 2961379..c87385f 100644 --- a/lexer/string_tokenizer.ts +++ b/lexer/string_tokenizer.ts @@ -1,4 +1,4 @@ -import { isNumeric } from "@stdext/assert"; +import { isNumeric } from "@stdx/assert"; /** * A token produced by {@linkcode StringTokenizer.tokenize}. @@ -109,7 +109,7 @@ export type StringTokenizerOptions = { * * @example * ```ts - * import { StringTokenizer } from "@stdext/lexer/string_tokenizer"; + * import { StringTokenizer } from "@stdx/lexer/string_tokenizer"; * import { assertEquals } from "@std/assert"; * * const t = new StringTokenizer({ @@ -140,7 +140,7 @@ export type StringTokenizerOptions = { * * @example With a default handler * ```ts - * import { StringTokenizer } from "@stdext/lexer/string_tokenizer"; + * import { StringTokenizer } from "@stdx/lexer/string_tokenizer"; * import { assertEquals } from "@std/assert"; * * const t = new StringTokenizer({ diff --git a/types/README.md b/types/README.md index 1218318..98bde78 100644 --- a/types/README.md +++ b/types/README.md @@ -1,11 +1,11 @@ -# @stdext/types +# @stdx/types The types package, contains general purpose type helpers. ## Examples ```ts -import { ValueOf } from "jsr:@stdext/types"; +import { ValueOf } from "jsr:@stdx/types"; const SOME_MAP = { a: "b", diff --git a/types/deno.json b/types/deno.json index c747ff4..5fc769c 100644 --- a/types/deno.json +++ b/types/deno.json @@ -1,6 +1,6 @@ { "version": "0.1.1", - "name": "@stdext/types", + "name": "@stdx/types", "exports": { ".": "./mod.ts" } diff --git a/types/mod.ts b/types/mod.ts index 103c3ff..3e82449 100644 --- a/types/mod.ts +++ b/types/mod.ts @@ -1,5 +1,5 @@ /** - * The `@stdext/types` package. + * The `@stdx/types` package. * * Utility types missing from TypeScript's built-ins: property modifiers * (`PartialBy`, `RequiredBy`, ...), map flips, value extraction and a @@ -7,7 +7,7 @@ * * @example * ```ts - * import type { PartialBy, ValueOf } from "@stdext/types"; + * import type { PartialBy, ValueOf } from "@stdx/types"; * * type Person = { name: string; age: number }; * type PersonDraft = PartialBy; // { name: string; age?: number } @@ -24,7 +24,7 @@ * * @example * ```ts - * import type { FlipMap } from "@stdext/types"; + * import type { FlipMap } from "@stdx/types"; * * type Ages = { alice: 30, bob: 40 }; * type Names = FlipMap; // { 30: "alice", 40: "bob" } @@ -43,7 +43,7 @@ export type FlipMap> = { * * @example * ```ts - * import type { PartialBy } from "@stdext/types"; + * import type { PartialBy } from "@stdx/types"; * * type A = { a: string; b: string }; * type B = PartialBy; // { a: string; b?: string } @@ -58,7 +58,7 @@ export type PartialBy = Omit & Partial>; * * @example * ```ts - * import type { RequiredBy } from "@stdext/types"; + * import type { RequiredBy } from "@stdx/types"; * * type A = { a?: string; b?: string }; * type B = RequiredBy; // { a?: string; b: string } @@ -75,7 +75,7 @@ export type RequiredBy = * * @example * ```ts - * import type { RequiredPartialBy } from "@stdext/types"; + * import type { RequiredPartialBy } from "@stdx/types"; * * type A = { a: string; b?: string; c?: string }; * type B = RequiredPartialBy; // { a?: string; b: string; c?: string } @@ -95,7 +95,7 @@ export type RequiredPartialBy = * * @example * ```ts - * import type { ReadonlyBy } from "@stdext/types"; + * import type { ReadonlyBy } from "@stdx/types"; * * type A = { a: string; b: string }; * type B = ReadonlyBy; // { readonly a: string; b: string } @@ -112,7 +112,7 @@ export type ReadonlyBy = * * @example * ```ts - * import type { Writeable } from "@stdext/types"; + * import type { Writeable } from "@stdx/types"; * * type A = { readonly a: string }; * type B = Writeable; // { a: string } @@ -128,7 +128,7 @@ export type Writeable = { -readonly [P in keyof T]: T[P] }; * * @example * ```ts - * import type { WriteableBy } from "@stdext/types"; + * import type { WriteableBy } from "@stdx/types"; * * type A = { readonly a: string; readonly b: string }; * type B = WriteableBy; // { a: string; readonly b: string } @@ -146,7 +146,7 @@ export type WriteableBy = * * @example With a type * ```ts - * import type { ValueOf } from "@stdext/types"; + * import type { ValueOf } from "@stdx/types"; * * type A = { a: "hello"; b: "world" }; * type B = ValueOf; // "hello" | "world" @@ -156,7 +156,7 @@ export type WriteableBy = * * @example With a const object * ```ts - * import type { ValueOf } from "@stdext/types"; + * import type { ValueOf } from "@stdx/types"; * * const a = { a: "hello", b: "world" } as const; * type B = ValueOf; // "hello" | "world" @@ -175,7 +175,7 @@ export type ValueOf = T[keyof T]; * * @example As a parameter * ```ts - * import type { AnyConstructor } from "@stdext/types"; + * import type { AnyConstructor } from "@stdx/types"; * * class Foo {} * @@ -188,7 +188,7 @@ export type ValueOf = T[keyof T]; * * @example For other types * ```ts - * import type { AnyConstructor } from "@stdext/types"; + * import type { AnyConstructor } from "@stdx/types"; * * class Foo { * constructor(_name: string) {} diff --git a/validation/README.md b/validation/README.md index 4a4fdfa..c58ace5 100644 --- a/validation/README.md +++ b/validation/README.md @@ -1,4 +1,4 @@ -# @stdext/validation +# @stdx/validation Schemas that implement both [Standard Schema](https://standardschema.dev/) and [Standard JSON Schema](https://standardschema.dev/#json-schema), and a small, @@ -8,7 +8,7 @@ fully typed factory to build them. libraries, OpenAPI generators. - `createSchema` infers the input type, output type and kind from the options. - Schemas nest by calling one schema's `validate` from another's, sync or async. -- It uses `@stdext/validation` as vendor identifier. +- It uses `@stdx/validation` as vendor identifier. ## Helper functions @@ -32,7 +32,7 @@ schemas `true` (accepts everything) and `false` (rejects everything). ```ts import { z } from "@zod/zod"; -import { parse, string, toJSONSchema, validate } from "@stdext/validation"; +import { parse, string, toJSONSchema, validate } from "@stdx/validation"; const User = z.object({ name: z.string() }); @@ -99,7 +99,7 @@ import { type Schema, string, validate, -} from "@stdext/validation"; +} from "@stdx/validation"; const user = object({ name: string(), @@ -139,7 +139,7 @@ inherited members like methods and getters, and returns the value itself, so its identity and prototype are kept. With `isValid` it makes a type guard: ```ts -import { boolean, func, isValid, optional, shape } from "@stdext/validation"; +import { boolean, func, isValid, optional, shape } from "@stdx/validation"; const closable = shape({ closed: boolean(), @@ -197,7 +197,7 @@ Options that are not valid, such as `minLength: -1` or `minItems` greater than `maxItems`, throw a `TypeError` when the schema is created. ```ts -import { array, integer, object, string, validate } from "@stdext/validation"; +import { array, integer, object, string, validate } from "@stdx/validation"; const user = object({ name: string({ minLength: 1, message: "Name is required" }), @@ -215,7 +215,7 @@ validate(user, { name: "", email: "x", age: -1, tags: [], extra: 1 }); the schema: ```ts -import { createSchema } from "@stdext/validation"; +import { createSchema } from "@stdx/validation"; const string = createSchema("string", { validate: (value) => @@ -250,7 +250,7 @@ Standard JSON Schema at once. Read the types with the standard's helpers: ```ts -import { createSchema } from "@stdext/validation"; +import { createSchema } from "@stdx/validation"; import type { StandardSchemaV1 } from "@standard-schema/spec"; const length = createSchema("length", { @@ -276,7 +276,7 @@ A schema is async when `validate` returns a promise. Nothing else changes: the types are inferred through the promise. ```ts -import { createSchema } from "@stdext/validation"; +import { createSchema } from "@stdx/validation"; const taken = new Set(["admin"]); const isTaken = (name: string) => Promise.resolve(taken.has(name)); @@ -300,7 +300,7 @@ schema, or you can reuse its `validate` directly. A container validates its items with the item schema and prefixes the issue paths: ```ts -import { type CombinedSchemaV1, createSchema } from "@stdext/validation"; +import { type CombinedSchemaV1, createSchema } from "@stdx/validation"; import type { StandardSchemaV1 } from "@standard-schema/spec"; function list(item: TItem) { @@ -354,7 +354,7 @@ Schema of what the schema accepts and `output` of what it produces; they only differ for schemas that transform their input. ```ts -import { createSchema } from "@stdext/validation"; +import { createSchema } from "@stdx/validation"; const age = createSchema("age", { validate: (value) => diff --git a/validation/composites.ts b/validation/composites.ts index d8360a1..6ad6e16 100644 --- a/validation/composites.ts +++ b/validation/composites.ts @@ -45,7 +45,7 @@ import type { StandardJSONSchemaV1, StandardSchemaV1, } from "@standard-schema/spec"; -import type { JSONSchema } from "@stdext/json/json-schema/2020-12"; +import type { JSONSchema } from "@stdx/json/json-schema/2020-12"; import { acceptsUndefined, chain, diff --git a/validation/constraints.ts b/validation/constraints.ts index 6564e29..fb35688 100644 --- a/validation/constraints.ts +++ b/validation/constraints.ts @@ -9,7 +9,7 @@ * @module */ -import type { JSONSchema } from "@stdext/json/json-schema/2020-12"; +import type { JSONSchema } from "@stdx/json/json-schema/2020-12"; import type { Issue } from "./core.ts"; import { isStringFormat, matchesFormat, type StringFormat } from "./formats.ts"; diff --git a/validation/core.test.ts b/validation/core.test.ts index e770dd4..936a62e 100644 --- a/validation/core.test.ts +++ b/validation/core.test.ts @@ -70,7 +70,7 @@ Deno.test("createSchema", async (t) => { await t.step("builds a Standard Schema and a Standard JSON Schema", () => { assertEquals(string.kind, "string"); assertEquals(string["~standard"].version, 1); - assertEquals(string["~standard"].vendor, "@stdext/validation"); + assertEquals(string["~standard"].vendor, "@stdx/validation"); assertEquals(string["~standard"].validate("a"), { value: "a" }); assertEquals(string["~standard"].validate(1), expectedString); assertEquals( diff --git a/validation/core.ts b/validation/core.ts index 7dc3a3e..4f4bea2 100644 --- a/validation/core.ts +++ b/validation/core.ts @@ -1,5 +1,5 @@ /** - * The core of `@stdext/validation`: {@linkcode createSchema}, the factory that + * The core of `@stdx/validation`: {@linkcode createSchema}, the factory that * builds a schema which is both a * {@link https://standardschema.dev | Standard Schema} and a * {@link https://standardschema.dev/#json-schema | Standard JSON Schema}, @@ -12,7 +12,7 @@ * * @example * ```ts - * import { createSchema } from "@stdext/validation"; + * import { createSchema } from "@stdx/validation"; * import { assertEquals } from "@std/assert"; * * const port = createSchema("port", { @@ -41,7 +41,7 @@ import type { StandardJSONSchemaV1, StandardSchemaV1, } from "@standard-schema/spec"; -import type { JSONSchema } from "@stdext/json/json-schema/2020-12"; +import type { JSONSchema } from "@stdx/json/json-schema/2020-12"; import { validateAsync } from "./utils.ts"; /** @@ -67,7 +67,7 @@ import { validateAsync } from "./utils.ts"; * * @example * ```ts - * import { createSchema } from "@stdext/validation"; + * import { createSchema } from "@stdx/validation"; * import { assertEquals } from "@std/assert"; * * const string = createSchema("string", { @@ -107,7 +107,7 @@ export function createSchema< kind, "~standard": { version: 1, - vendor: "@stdext/validation", + vendor: "@stdx/validation", ...options, }, } as Schema, TKind>; diff --git a/validation/deno.json b/validation/deno.json index cfede84..d9c2c74 100644 --- a/validation/deno.json +++ b/validation/deno.json @@ -1,6 +1,6 @@ { "version": "0.1.2", - "name": "@stdext/validation", + "name": "@stdx/validation", "exports": { ".": "./mod.ts" } diff --git a/validation/mod.test.ts b/validation/mod.test.ts index 57f799d..92f6b97 100644 --- a/validation/mod.test.ts +++ b/validation/mod.test.ts @@ -137,7 +137,7 @@ Deno.test("every ready-made schema is a Standard Schema and a Standard JSON Sche assert(isStandardSchemaV1(schema)); assert(isStandardJSONSchemaV1(schema)); assertEquals(schema["~standard"].version, 1); - assertEquals(schema["~standard"].vendor, "@stdext/validation"); + assertEquals(schema["~standard"].vendor, "@stdx/validation"); // both directions give a JSON Schema object, without throwing for (const io of ["input", "output"] as const) { diff --git a/validation/mod.ts b/validation/mod.ts index 22b6eb2..c512ecf 100644 --- a/validation/mod.ts +++ b/validation/mod.ts @@ -1,5 +1,5 @@ /** - * The `@stdext/validation` package: schemas that implement both + * The `@stdx/validation` package: schemas that implement both * {@link https://standardschema.dev | Standard Schema} and * {@link https://standardschema.dev/#json-schema | Standard JSON Schema}. * @@ -31,7 +31,7 @@ * string, * toJSONSchema, * validate, - * } from "@stdext/validation"; + * } from "@stdx/validation"; * import { assertEquals } from "@std/assert"; * * // a schema of your own diff --git a/validation/schemas.ts b/validation/schemas.ts index 332e7fb..8b9feff 100644 --- a/validation/schemas.ts +++ b/validation/schemas.ts @@ -32,7 +32,7 @@ */ import type { StandardSchemaV1 } from "@standard-schema/spec"; -import type { JSONSchema } from "@stdext/json/json-schema/2020-12"; +import type { JSONSchema } from "@stdx/json/json-schema/2020-12"; import { type CombinedSchemaV1, type CommonOptions, diff --git a/validation/utils.ts b/validation/utils.ts index 20bba03..176b43e 100644 --- a/validation/utils.ts +++ b/validation/utils.ts @@ -303,7 +303,7 @@ export interface ToJSONSchemaOptions * * @example * ```ts - * import { createSchema } from "@stdext/validation"; + * import { createSchema } from "@stdx/validation"; * import { toJSONSchema } from "./utils.ts"; * import { assertEquals } from "@std/assert"; * diff --git a/xml/README.md b/xml/README.md index c73e733..fe15704 100644 --- a/xml/README.md +++ b/xml/README.md @@ -1,4 +1,4 @@ -# @stdext/xml +# @stdx/xml Extends [@std/xml](https://jsr.io/@std/xml) @@ -18,7 +18,7 @@ and throws `@std/xml`'s `XmlSyntaxError` for malformed input. `XML.safeParse` never throws — every problem is an issue. ```ts -import { XML } from "@stdext/xml"; +import { XML } from "@stdx/xml"; const doc = XML.parse(`hello`); @@ -43,7 +43,7 @@ Parser options are `@std/xml`'s `ParseOptions` (`ignoreWhitespace`, `ignoreComments`, `ignoreDeclaration`): ```ts -import { XML } from "@stdext/xml"; +import { XML } from "@stdx/xml"; const doc = XML.parse(`\n \n`, { ignoreComments: true, @@ -58,8 +58,8 @@ built programmatically instead of parsed. The node types (`XmlElement`, `XmlTextNode`, `XmlCommentNode`, `XmlCDataNode`) are `@std/xml`'s: ```ts -import { XML } from "@stdext/xml"; -import type { XmlElement, XmlTextNode } from "@stdext/xml"; +import { XML } from "@stdx/xml"; +import type { XmlElement, XmlTextNode } from "@stdx/xml"; const child: XmlElement = { type: "element", @@ -91,7 +91,7 @@ many documents. Release it deterministically with `using`, or let garbage collection do it. ```ts -import { XMLValidator } from "@stdext/xml"; +import { XMLValidator } from "@stdx/xml"; using validator = new XMLValidator(` @@ -106,7 +106,7 @@ validator.validate("-5"); // { issues: [...] } const tree = validator.parse("25"); // Documents accept a validator directly -import { XML } from "@stdext/xml"; +import { XML } from "@stdx/xml"; XML.parse("25").validate(validator); // { value: ... } ``` @@ -118,7 +118,7 @@ input; issues carry `path` (element names + sibling indices) and std-style `line`/`column` when a position is known. ```ts -import { xml } from "@stdext/xml"; +import { xml } from "@stdx/xml"; const schema = xml(` diff --git a/xml/_wasm/xml_xml.mjs b/xml/_wasm/xml_xml.mjs index d7d3fc5..0774ba1 100644 --- a/xml/_wasm/xml_xml.mjs +++ b/xml/_wasm/xml_xml.mjs @@ -4,7 +4,7 @@ // deno-fmt-ignore-file // @ts-self-types="./xml_xml.d.mts" -// source-hash: 262982256bfc83888bf3474b945d8404f7e4bf3c +// source-hash: 4b1658953e46182ad663d04ff9150ce9198345bf import * as imports from "./xml_xml.internal.mjs"; const bytes = base64decode("\ AGFzbQEAAAAB+gNGYAJ/fwBgAn9/AX9gAX8AYAN/f38Bf2ADf39/AGABfwF/YAR/f39/AGAFf39/f3\ diff --git a/xml/deno.json b/xml/deno.json index 03cf015..4e59445 100644 --- a/xml/deno.json +++ b/xml/deno.json @@ -1,6 +1,6 @@ { "version": "0.1.2", - "name": "@stdext/xml", + "name": "@stdx/xml", "exports": { ".": "./mod.ts" } diff --git a/xml/mod.test.ts b/xml/mod.test.ts index 4fcbbd3..7270957 100644 --- a/xml/mod.test.ts +++ b/xml/mod.test.ts @@ -9,7 +9,7 @@ import { XML, xml, XMLValidator } from "./mod.ts"; import type { ParseOptions, StringifyOptions, XmlDocument } from "@std/xml"; import { getDotPath, SchemaError } from "@standard-schema/utils"; import type { StandardSchemaV1 } from "@standard-schema/spec"; -import { validate as v } from "@stdext/validation"; +import { validate as v } from "@stdx/validation"; // --------------------------------------------------------------------------- // Helpers (thin class-API adapters, so the fixtures below stay declarative) @@ -497,7 +497,7 @@ Deno.test("validator > invalid schema throws on construction", () => { Deno.test("standard > xml() returns a v1 entity", () => { const schema = xml(AGE_XSD); assertEquals(schema["~standard"].version, 1); - assertEquals(schema["~standard"].vendor, "@stdext/xml"); + assertEquals(schema["~standard"].vendor, "@stdx/xml"); assert(typeof schema["~standard"].validate === "function"); }); diff --git a/xml/mod.ts b/xml/mod.ts index 5c7fc5b..9543aaf 100644 --- a/xml/mod.ts +++ b/xml/mod.ts @@ -26,11 +26,11 @@ * Standard-Schema-shaped `path` segments (element names + sibling * indices) derived from the validator's line/column positions, plus * std-style `line`/`column` when the message carries a position, so - * any Standard Schema consumer can use `@stdext/xml` schemas. + * any Standard Schema consumer can use `@stdx/xml` schemas. * * @example * ```ts - * import { XML } from "@stdext/xml"; + * import { XML } from "@stdx/xml"; * import { assertEquals } from "@std/assert"; * * const doc = XML.parse(``); @@ -78,7 +78,7 @@ export type { // interfaces are NEVER redeclared here. export type { XmlValidationResult } from "./_wasm/xml_xml.mjs"; -// Re-export the spec types so consumers of @stdext/xml don't have to +// Re-export the spec types so consumers of @stdx/xml don't have to // depend on @standard-schema/spec to spell the public surface. export type { StandardSchemaV1 } from "@standard-schema/spec"; @@ -297,7 +297,7 @@ export class XML implements XmlDocument { * * @example Usage * ```ts - * import { XMLValidator } from "@stdext/xml"; + * import { XMLValidator } from "@stdx/xml"; * import { assert, assertThrows } from "@std/assert"; * * using validator = new XMLValidator(` => { try { if (validator) { diff --git a/zip/README.md b/zip/README.md index 23e1e12..76af6b9 100644 --- a/zip/README.md +++ b/zip/README.md @@ -1,4 +1,4 @@ -# @stdext/zip +# @stdx/zip The zip package contains helpers for creating and extracting zip archives, with no dependencies other than the Deno runtime. @@ -11,7 +11,7 @@ two, which covers practically all archives in use. Encryption and ZIP64 (more than 65535 entries, or sizes above 4 GiB) are not supported, and throw. ```ts -import { unzip, zip } from "@stdext/zip"; +import { unzip, zip } from "@stdx/zip"; const archive = await zip([ { path: "hello.txt", data: "Hello, world!" }, diff --git a/zip/deno.json b/zip/deno.json index d3c7afa..d79467b 100644 --- a/zip/deno.json +++ b/zip/deno.json @@ -1,6 +1,6 @@ { - "version": "0.0.2", - "name": "@stdext/zip", + "version": "0.1.0", + "name": "@stdx/zip", "exports": { ".": "./mod.ts", "./zip": "./zip.ts", diff --git a/zip/fs.ts b/zip/fs.ts index feb25b3..8742799 100644 --- a/zip/fs.ts +++ b/zip/fs.ts @@ -25,7 +25,7 @@ const PERMISSION_MASK = 0o777; * * @example * ```ts ignore - * import { zipDir } from "@stdext/zip/fs"; + * import { zipDir } from "@stdx/zip/fs"; * * await zipDir("./dist", "./dist.zip"); * ``` @@ -74,7 +74,7 @@ export async function zipDir( * * @example * ```ts ignore - * import { unzipDir } from "@stdext/zip/fs"; + * import { unzipDir } from "@stdx/zip/fs"; * * await unzipDir("./dist.zip", "./dist"); * ``` diff --git a/zip/unzip.ts b/zip/unzip.ts index 08c8523..59ac66b 100644 --- a/zip/unzip.ts +++ b/zip/unzip.ts @@ -65,8 +65,8 @@ function fromDosDateTime(date: number, time: number): Date { * * @example * ```ts - * import { unzip } from "@stdext/zip/unzip"; - * import { zip } from "@stdext/zip/zip"; + * import { unzip } from "@stdx/zip/unzip"; + * import { zip } from "@stdx/zip/zip"; * import { assertEquals } from "@std/assert"; * * const archive = await zip([{ path: "hello.txt", data: "Hello, world!" }]); @@ -196,7 +196,7 @@ export async function unzip(archive: Uint8Array): Promise { * * @example * ```ts ignore - * import { unzipDir } from "@stdext/zip/unzip"; + * import { unzipDir } from "@stdx/zip/unzip"; * * await unzipDir("./dist.zip", "./dist"); * ``` diff --git a/zip/zip.ts b/zip/zip.ts index 69ea022..15044bc 100644 --- a/zip/zip.ts +++ b/zip/zip.ts @@ -67,7 +67,7 @@ function toDosDateTime(date: Date): { time: number; date: number } { * * @example * ```ts - * import { zip } from "@stdext/zip/zip"; + * import { zip } from "@stdx/zip/zip"; * import { assertEquals } from "@std/assert"; * * const archive = await zip([ @@ -185,7 +185,7 @@ export async function zip(entries: Iterable): Promise { * * @example * ```ts ignore - * import { zipDir } from "@stdext/zip/zip"; + * import { zipDir } from "@stdx/zip/zip"; * * await zipDir("./dist", "./dist.zip"); * ```