From 0f7d1145d9b4b343cf045ab976011a8a5b4c7d39 Mon Sep 17 00:00:00 2001 From: tai-kun Date: Sat, 19 Oct 2024 20:04:10 +0900 Subject: [PATCH] =?UTF-8?q?change:=20flat=20exports=20=E3=81=AB=E5=85=A8?= =?UTF-8?q?=E9=9D=A2=E7=A7=BB=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 +- .../content/v2/api/data/bound-excluded.mdx | 12 +- .../content/v2/api/data/bound-included.mdx | 8 +- .../ja2en/content/v2/api/data/datetime.mdx | 118 +++---- .../ja2en/content/v2/api/data/decimal.mdx | 24 +- .../ja2en/content/v2/api/data/duration.mdx | 192 ++++++------ .../ja2en/content/v2/api/data/future.mdx | 40 +-- .../v2/api/data/geometry-collection.mdx | 12 +- .../content/v2/api/data/geometry-line.mdx | 10 +- .../v2/api/data/geometry-multi-line.mdx | 8 +- .../v2/api/data/geometry-multi-point.mdx | 10 +- .../v2/api/data/geometry-multi-polygon.mdx | 10 +- .../content/v2/api/data/geometry-point.mdx | 6 +- .../content/v2/api/data/geometry-polygon.mdx | 12 +- .../cache/ja2en/content/v2/api/data/range.mdx | 34 +- .../cache/ja2en/content/v2/api/data/table.mdx | 36 +-- .../cache/ja2en/content/v2/api/data/thing.mdx | 44 +-- docs/cache/ja2en/content/v2/api/data/uuid.mdx | 68 ++-- .../ja2en/content/v2/getting-started.mdx | 6 +- docs/cache/ja2en/content/v2/guides/errors.mdx | 296 +++++++++--------- docs/cache/ja2en/content/v2/supports.mdx | 10 +- docs/cache/ja2en/meta.json | 40 +-- .../content/v2/api/data/bound-excluded.mdx | 14 +- .../content/v2/api/data/bound-included.mdx | 12 +- .../ja2ko/content/v2/api/data/datetime.mdx | 128 ++++---- .../ja2ko/content/v2/api/data/decimal.mdx | 32 +- .../ja2ko/content/v2/api/data/duration.mdx | 266 ++++++++-------- .../ja2ko/content/v2/api/data/future.mdx | 58 ++-- .../v2/api/data/geometry-collection.mdx | 10 +- .../content/v2/api/data/geometry-line.mdx | 14 +- .../v2/api/data/geometry-multi-line.mdx | 10 +- .../v2/api/data/geometry-multi-point.mdx | 8 +- .../v2/api/data/geometry-multi-polygon.mdx | 8 +- .../content/v2/api/data/geometry-point.mdx | 10 +- .../content/v2/api/data/geometry-polygon.mdx | 8 +- .../cache/ja2ko/content/v2/api/data/range.mdx | 20 +- .../cache/ja2ko/content/v2/api/data/table.mdx | 40 +-- .../cache/ja2ko/content/v2/api/data/thing.mdx | 48 +-- docs/cache/ja2ko/content/v2/api/data/uuid.mdx | 52 +-- .../ja2ko/content/v2/getting-started.mdx | 10 +- docs/cache/ja2ko/content/v2/guides/errors.mdx | 294 ++++++++--------- docs/cache/ja2ko/content/v2/supports.mdx | 10 +- docs/cache/ja2ko/meta.json | 40 +-- .../content/v2/api/data/bound-excluded.mdx | 8 +- .../content/v2/api/data/bound-included.mdx | 10 +- .../ja2zh-CN/content/v2/api/data/datetime.mdx | 98 +++--- .../ja2zh-CN/content/v2/api/data/decimal.mdx | 30 +- .../ja2zh-CN/content/v2/api/data/duration.mdx | 160 +++++----- .../ja2zh-CN/content/v2/api/data/future.mdx | 56 ++-- .../v2/api/data/geometry-collection.mdx | 10 +- .../content/v2/api/data/geometry-line.mdx | 12 +- .../v2/api/data/geometry-multi-line.mdx | 14 +- .../v2/api/data/geometry-multi-point.mdx | 16 +- .../v2/api/data/geometry-multi-polygon.mdx | 8 +- .../content/v2/api/data/geometry-point.mdx | 8 +- .../content/v2/api/data/geometry-polygon.mdx | 14 +- .../ja2zh-CN/content/v2/api/data/range.mdx | 30 +- .../ja2zh-CN/content/v2/api/data/table.mdx | 30 +- .../ja2zh-CN/content/v2/api/data/thing.mdx | 40 +-- .../ja2zh-CN/content/v2/api/data/uuid.mdx | 44 +-- .../ja2zh-CN/content/v2/getting-started.mdx | 10 +- .../ja2zh-CN/content/v2/guides/errors.mdx | 212 ++++++------- docs/cache/ja2zh-CN/content/v2/supports.mdx | 12 +- docs/cache/ja2zh-CN/meta.json | 40 +-- .../docs/en/v2/api/data/bound-excluded.mdx | 12 +- .../docs/en/v2/api/data/bound-included.mdx | 8 +- .../content/docs/en/v2/api/data/datetime.mdx | 118 +++---- .../content/docs/en/v2/api/data/decimal.mdx | 24 +- .../content/docs/en/v2/api/data/duration.mdx | 192 ++++++------ .../content/docs/en/v2/api/data/future.mdx | 40 +-- .../en/v2/api/data/geometry-collection.mdx | 12 +- .../docs/en/v2/api/data/geometry-line.mdx | 10 +- .../en/v2/api/data/geometry-multi-line.mdx | 8 +- .../en/v2/api/data/geometry-multi-point.mdx | 10 +- .../en/v2/api/data/geometry-multi-polygon.mdx | 10 +- .../docs/en/v2/api/data/geometry-point.mdx | 6 +- .../docs/en/v2/api/data/geometry-polygon.mdx | 12 +- .../src/content/docs/en/v2/api/data/range.mdx | 34 +- .../src/content/docs/en/v2/api/data/table.mdx | 36 +-- .../src/content/docs/en/v2/api/data/thing.mdx | 44 +-- docs/src/content/docs/en/v2/api/data/uuid.mdx | 68 ++-- .../content/docs/en/v2/getting-started.mdx | 6 +- docs/src/content/docs/en/v2/guides/errors.mdx | 296 +++++++++--------- docs/src/content/docs/en/v2/supports.mdx | 10 +- .../docs/ja/v2/api/data/bound-excluded.mdx | 6 +- .../docs/ja/v2/api/data/bound-included.mdx | 6 +- .../content/docs/ja/v2/api/data/datetime.mdx | 24 +- .../content/docs/ja/v2/api/data/decimal.mdx | 8 +- .../content/docs/ja/v2/api/data/duration.mdx | 16 +- .../content/docs/ja/v2/api/data/future.mdx | 14 +- .../ja/v2/api/data/geometry-collection.mdx | 6 +- .../docs/ja/v2/api/data/geometry-line.mdx | 6 +- .../ja/v2/api/data/geometry-multi-line.mdx | 6 +- .../ja/v2/api/data/geometry-multi-point.mdx | 6 +- .../ja/v2/api/data/geometry-multi-polygon.mdx | 6 +- .../docs/ja/v2/api/data/geometry-point.mdx | 6 +- .../docs/ja/v2/api/data/geometry-polygon.mdx | 6 +- .../src/content/docs/ja/v2/api/data/range.mdx | 8 +- .../src/content/docs/ja/v2/api/data/table.mdx | 14 +- .../src/content/docs/ja/v2/api/data/thing.mdx | 14 +- docs/src/content/docs/ja/v2/api/data/uuid.mdx | 12 +- .../content/docs/ja/v2/getting-started.mdx | 6 +- docs/src/content/docs/ja/v2/guides/errors.mdx | 6 +- .../docs/ko/v2/api/data/bound-excluded.mdx | 14 +- .../docs/ko/v2/api/data/bound-included.mdx | 12 +- .../content/docs/ko/v2/api/data/datetime.mdx | 128 ++++---- .../content/docs/ko/v2/api/data/decimal.mdx | 32 +- .../content/docs/ko/v2/api/data/duration.mdx | 266 ++++++++-------- .../content/docs/ko/v2/api/data/future.mdx | 58 ++-- .../ko/v2/api/data/geometry-collection.mdx | 10 +- .../docs/ko/v2/api/data/geometry-line.mdx | 14 +- .../ko/v2/api/data/geometry-multi-line.mdx | 10 +- .../ko/v2/api/data/geometry-multi-point.mdx | 8 +- .../ko/v2/api/data/geometry-multi-polygon.mdx | 8 +- .../docs/ko/v2/api/data/geometry-point.mdx | 10 +- .../docs/ko/v2/api/data/geometry-polygon.mdx | 8 +- .../src/content/docs/ko/v2/api/data/range.mdx | 20 +- .../src/content/docs/ko/v2/api/data/table.mdx | 40 +-- .../src/content/docs/ko/v2/api/data/thing.mdx | 48 +-- docs/src/content/docs/ko/v2/api/data/uuid.mdx | 52 +-- .../content/docs/ko/v2/getting-started.mdx | 10 +- docs/src/content/docs/ko/v2/guides/errors.mdx | 294 ++++++++--------- docs/src/content/docs/ko/v2/supports.mdx | 10 +- .../docs/zh-CN/v2/api/data/bound-excluded.mdx | 8 +- .../docs/zh-CN/v2/api/data/bound-included.mdx | 10 +- .../docs/zh-CN/v2/api/data/datetime.mdx | 98 +++--- .../docs/zh-CN/v2/api/data/decimal.mdx | 30 +- .../docs/zh-CN/v2/api/data/duration.mdx | 160 +++++----- .../content/docs/zh-CN/v2/api/data/future.mdx | 56 ++-- .../zh-CN/v2/api/data/geometry-collection.mdx | 10 +- .../docs/zh-CN/v2/api/data/geometry-line.mdx | 12 +- .../zh-CN/v2/api/data/geometry-multi-line.mdx | 14 +- .../v2/api/data/geometry-multi-point.mdx | 16 +- .../v2/api/data/geometry-multi-polygon.mdx | 8 +- .../docs/zh-CN/v2/api/data/geometry-point.mdx | 8 +- .../zh-CN/v2/api/data/geometry-polygon.mdx | 14 +- .../content/docs/zh-CN/v2/api/data/range.mdx | 30 +- .../content/docs/zh-CN/v2/api/data/table.mdx | 30 +- .../content/docs/zh-CN/v2/api/data/thing.mdx | 40 +-- .../content/docs/zh-CN/v2/api/data/uuid.mdx | 44 +-- .../content/docs/zh-CN/v2/getting-started.mdx | 10 +- .../content/docs/zh-CN/v2/guides/errors.mdx | 212 ++++++------- docs/src/content/docs/zh-CN/v2/supports.mdx | 12 +- package.json | 6 +- src/clients/standard/client.ts | 4 +- src/clients/standard/jwt.ts | 2 +- src/data-types/encodable/bound-excluded.ts | 2 +- src/data-types/encodable/bound-included.ts | 2 +- src/data-types/encodable/datetime.ts | 2 +- src/data-types/encodable/decimal.ts | 2 +- src/data-types/encodable/duration.ts | 2 +- src/data-types/encodable/future.ts | 2 +- .../encodable/geometry-collection.ts | 2 +- src/data-types/encodable/geometry-line.ts | 2 +- .../encodable/geometry-multiline.ts | 2 +- .../encodable/geometry-multipoint.ts | 2 +- .../encodable/geometry-multipolygon.ts | 2 +- src/data-types/encodable/geometry-point.ts | 2 +- src/data-types/encodable/geometry-polygon.ts | 2 +- src/data-types/encodable/range.ts | 2 +- src/data-types/encodable/table.ts | 2 +- src/data-types/encodable/thing.ts | 2 +- src/data-types/encodable/uuid.ts | 2 +- src/data-types/standard/bound-excluded.ts | 2 +- src/data-types/standard/bound-included.ts | 2 +- src/data-types/standard/datetime.ts | 2 +- src/data-types/standard/decimal.ts | 2 +- src/data-types/standard/duration.ts | 2 +- src/data-types/standard/future.ts | 4 +- .../standard/geometry-collection.ts | 2 +- src/data-types/standard/geometry-line.ts | 2 +- src/data-types/standard/geometry-multiline.ts | 2 +- .../standard/geometry-multipoint.ts | 2 +- .../standard/geometry-multipolygon.ts | 2 +- src/data-types/standard/geometry-point.ts | 2 +- src/data-types/standard/geometry-polygon.ts | 2 +- src/data-types/standard/range.ts | 2 +- src/data-types/standard/spec.ts | 2 +- src/data-types/standard/table.ts | 2 +- src/data-types/standard/thing.ts | 2 +- src/data-types/standard/uuid.ts | 2 +- src/formatters/cbor/formatter.ts | 4 +- src/surreal/data-types.ts | 6 +- src/surreal/default.ts | 10 +- src/surreal/init-pool.ts | 4 +- src/surreal/init-surreal.ts | 4 +- src/surreal/inline/create-query.ts | 2 +- src/surreal/inline/query.ts | 2 +- src/surreal/inline/rpc.ts | 6 +- src/surreal/utils/auto-reconnect.ts | 2 +- src/surreal/utils/types.ts | 2 +- .../websocket/reconnection.test.ts | 6 +- tests/medium/inline/query.test.ts | 2 +- tests/medium/inline/rpc.test.ts | 6 +- tests/medium/surreal.ts | 12 +- tests/small/data-types/datetime.test.ts | 4 +- tests/small/data-types/decimal.test.ts | 4 +- tests/small/data-types/duration.test.ts | 4 +- tests/small/data-types/future.test.ts | 2 +- .../data-types/geometry-collection.test.ts | 4 +- tests/small/data-types/geometry-line.test.ts | 4 +- .../data-types/geometry-multiline.test.ts | 4 +- .../data-types/geometry-multipoint.test.ts | 4 +- .../data-types/geometry-multipolygon.test.ts | 4 +- tests/small/data-types/geometry-point.test.ts | 4 +- .../small/data-types/geometry-polygon.test.ts | 4 +- tests/small/data-types/range.test.ts | 2 +- tests/small/data-types/table.test.ts | 2 +- tests/small/data-types/thing.test.ts | 2 +- tests/small/data-types/uuid.test.ts | 2 +- tests/small/surreal/slot.test.ts | 2 +- tsconfig.json | 18 +- 212 files changed, 3088 insertions(+), 3096 deletions(-) diff --git a/README.md b/README.md index 623b6221..8a08bdb9 100644 --- a/README.md +++ b/README.md @@ -51,9 +51,9 @@ try { ```ts import { initSurreal } from "@tai-kun/surrealdb"; -import Client from "@tai-kun/surrealdb/clients/standard"; -import HttpEngine from "@tai-kun/surrealdb/engines/http"; -import JsonFormatter from "@tai-kun/surrealdb/formatters/json"; +import Client from "@tai-kun/surrealdb/standard-client"; +import HttpEngine from "@tai-kun/surrealdb/http-engine"; +import JsonFormatter from "@tai-kun/surrealdb/json-formatter"; const { Surreal } = initSurreal({ Client: Client, diff --git a/docs/cache/ja2en/content/v2/api/data/bound-excluded.mdx b/docs/cache/ja2en/content/v2/api/data/bound-excluded.mdx index 1a2f181b..8af56a33 100644 --- a/docs/cache/ja2en/content/v2/api/data/bound-excluded.mdx +++ b/docs/cache/ja2en/content/v2/api/data/bound-excluded.mdx @@ -12,9 +12,9 @@ See [`Range`](/v2/api/data/range). ### Import ```ts -import { BoundExcluded } from "@tai-kun/surrealdb/data-types/decode-only"; -import { BoundExcluded } from "@tai-kun/surrealdb/data-types/encodable"; -import { BoundExcluded } from "@tai-kun/surrealdb/data-types/standard"; +import { BoundExcluded } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { BoundExcluded } from "@tai-kun/surrealdb/encodable-datatypes"; +import { BoundExcluded } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -29,12 +29,12 @@ new BoundExcluded(source: unknown); ##### `source` -This argument is under investigation and its specific usage is not yet documented. +Under investigation. #### Returns -When called via `new`, `BoundExcluded` returns its instance. +When called through `new`, `BoundExcluded` returns its instance. ### `.value` -This property is under investigation and its specific usage is not yet documented. +Under investigation. diff --git a/docs/cache/ja2en/content/v2/api/data/bound-included.mdx b/docs/cache/ja2en/content/v2/api/data/bound-included.mdx index 1da5be14..e2757bf3 100644 --- a/docs/cache/ja2en/content/v2/api/data/bound-included.mdx +++ b/docs/cache/ja2en/content/v2/api/data/bound-included.mdx @@ -12,9 +12,9 @@ See [`Range`](/v2/api/data/range). ### Import ```ts -import { BoundIncluded } from "@tai-kun/surrealdb/data-types/decode-only"; -import { BoundIncluded } from "@tai-kun/surrealdb/data-types/encodable"; -import { BoundIncluded } from "@tai-kun/surrealdb/data-types/standard"; +import { BoundIncluded } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { BoundIncluded } from "@tai-kun/surrealdb/encodable-datatypes"; +import { BoundIncluded } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -31,7 +31,7 @@ new BoundIncluded(source: unknown); Under investigation. -#### Returns +#### Return Value When called via `new`, `BoundIncluded` returns its instance. diff --git a/docs/cache/ja2en/content/v2/api/data/datetime.mdx b/docs/cache/ja2en/content/v2/api/data/datetime.mdx index 1fda4f7f..8c1971c6 100644 --- a/docs/cache/ja2en/content/v2/api/data/datetime.mdx +++ b/docs/cache/ja2en/content/v2/api/data/datetime.mdx @@ -5,14 +5,14 @@ slug: en/v2/api/data/datetime import Badge from "~/components/en/Badge.astro"; -`Datetime` is a class that represents a date and time. It corresponds to the SurrealQL [`datetime`](https://surrealdb.com/docs/surrealql/datamodel/datetimes) type. +`Datetime` is a class that represents dates and times. It corresponds to the [`datetime`](https://surrealdb.com/docs/surrealql/datamodel/datetimes) type in SurrealQL. -### Importing +### Import ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Datetime } from "@tai-kun/surrealdb/data-types/encodable"; -import { Datetime } from "@tai-kun/surrealdb/data-types/standard"; +import { Datetime } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Datetime } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Datetime } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -47,19 +47,19 @@ new Datetime( ##### `source` -A pair of seconds and nanoseconds, or a string. If the preset is standard, it also supports inputs such as `Date` object and `bigint`. +A pair of seconds and nanoseconds, or a string. If the preset is standard, it also supports input of `Date` objects and `bigint`. ##### `year`, `monthIndex`, ... -Same as the arguments for the `Date` class. However, it also supports `nanoseconds` input. `number` cannot be provided after an argument that provides `undefined`. This is roughly the same specification as the `Date` class. +These are the same as the arguments for the `Date` class. However, it also supports `nanoseconds` input. You cannot provide a `number` after an argument that has been provided with `undefined`. This is roughly the same specification as the `Date` class. -#### Return value +#### Return Value -When called through `new`, `Datetime` returns its instance. If the preset is standard, it is also an instance of `Date`. +When invoked through `new`, `Datetime` returns its instance. If the preset is standard, it is also an instance of `Date`. ### `.seconds` -The seconds part of a nanosecond-precise time. Read-only in presets below standard. The value is an integer from -253-1 to 253-1 or `NaN`. +The seconds part of the nanosecond-precision time. It is read-only in presets below standard. The value is an integer between -253-1 and 253-1, or `NaN`. ```ts .seconds: number; @@ -67,7 +67,7 @@ The seconds part of a nanosecond-precise time. Read-only in presets below standa ### `.nanoseconds` -The nanoseconds part of a nanosecond-precise time. Read-only in presets below standard. The value is an integer from 0 to 999999999 or `NaN`. +The nanoseconds part of the nanosecond-precision time. It is read-only in presets below standard. The value is an integer between 0 and 999999999, or `NaN`. ```ts .nanoseconds: number; @@ -75,7 +75,7 @@ The nanoseconds part of a nanosecond-precise time. Read-only in presets below st ### `.valueOf()` -Gets the millisecond-precise time. +Gets the millisecond-precision time. ```ts .valueOf(): number; @@ -85,14 +85,14 @@ Gets the millisecond-precise time. None. -#### Return value +#### Return Value -Returns the millisecond-precise time. +Returns the millisecond-precision time. #### Example ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/encodable"; +import { Datetime } from "@tai-kun/surrealdb/encodable-datatypes"; const date = new Datetime("2024-06-01T12:34:56.780123456Z"); console.log(date.valueOf()); @@ -101,7 +101,7 @@ console.log(date.valueOf()); ### `.toString()` -Gets the string representation of the millisecond-precise time. Same as the `.toString()` of the `Date` object. +Gets the string representation of the millisecond-precision time. It is the same as `.toString()` of a `Date` object. ```ts .toString(): string; @@ -111,23 +111,23 @@ Gets the string representation of the millisecond-precise time. Same as the `.to None. -#### Return value +#### Return Value -Returns the string representation of the millisecond-precise time. +Returns the string representation of the millisecond-precision time. #### Example ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/encodable"; +import { Datetime } from "@tai-kun/surrealdb/encodable-datatypes"; const date = new Datetime("2024-06-01T12:34:56.780123456Z"); console.log(date.toString()); -//-> Sat Jun 01 2024 21:34:56 GMT+0900 (Japan Standard Time) +//-> Sat Jun 01 2024 21:34:56 GMT+0900 (日本標準時) ``` ### `.toISOString()` -Gets the string representation of the nanosecond-precise time in ISO format. Similar to the `.toISOString()` of the `Date` object, but it is nanosecond-precise, so it is stringified to the ninth decimal place. +Gets the nanosecond-precision time string in ISO format. It is similar to `.toISOString()` of a `Date` object, but it is nanosecond-precision, so it is serialized up to the ninth decimal place. ```ts .toISOString(): string; @@ -137,14 +137,14 @@ Gets the string representation of the nanosecond-precise time in ISO format. Sim None. -#### Return value +#### Return Value -Returns the string representation of the nanosecond-precise time in ISO format. +Returns the nanosecond-precision time string in ISO format. #### Example ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/encodable"; +import { Datetime } from "@tai-kun/surrealdb/encodable-datatypes"; const date = new Datetime([1717245296, 780123456]); console.log(date.toISOString()); @@ -153,7 +153,7 @@ console.log(date.toISOString()); ### `.toDate()` -Converts to a runtime built-in `Date` object. Note that it will be millisecond-precise. +Converts to a runtime-built-in `Date` object. Note that it will be millisecond-precision. ```ts .toDate(): Date; @@ -163,13 +163,13 @@ Converts to a runtime built-in `Date` object. Note that it will be millisecond-p None. -#### Return value +#### Return Value -Returns a runtime built-in `Date` object. +Returns a runtime-built-in `Date` object. ### `.toSurql()` -Converts the `Datetime` object to a string embeddable in SurrealQL. Similar to `.toISOString()`, but adds the `d` prefix to tell the query parser that the string is a UUID. +Converts the `Datetime` object to a string that can be embedded in SurrealQL. It is similar to `.toISOString()`, but it adds the `d` prefix to tell the query parser that the string is a UUID. ```ts .toSurql(): string; @@ -179,14 +179,14 @@ Converts the `Datetime` object to a string embeddable in SurrealQL. Similar to ` None. -#### Return value +#### Return Value -Returns the ISO formatted date and time with the `d` prefix. +Returns the ISO format datetime with the `d` prefix. #### Example ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/encodable"; +import { Datetime } from "@tai-kun/surrealdb/encodable-datatypes"; const date = new Datetime([1717245296, 780123456]); console.log(date.toSurql()); @@ -195,7 +195,7 @@ console.log(date.toSurql()); ### `.getCompact()` -Gets a pair of seconds and nanoseconds. +Gets the pair of seconds and nanoseconds. ```ts .getCompact(): [seconds: number, nanoseconds: number]; @@ -205,13 +205,13 @@ Gets a pair of seconds and nanoseconds. None. -#### Return value +#### Return Value -Returns a pair of seconds and nanoseconds. +Returns the pair of seconds and nanoseconds. ### `.setCompact()` -Sets the date and time with a pair of seconds and nanoseconds. +Sets the datetime with a pair of seconds and nanoseconds. ```ts .setCompact(compact: [seconds: number, nanoseconds: number]): number; @@ -223,14 +223,14 @@ Sets the date and time with a pair of seconds and nanoseconds. A pair of seconds and nanoseconds. -#### Return value +#### Return Value -Returns the millisecond-precise time. +Returns the millisecond-precision time. #### Example ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/standard"; +import { Datetime } from "@tai-kun/surrealdb/standard-datatypes"; const date = new Datetime(0); const time = dt.setCompact([1717245296, 780123456]); @@ -240,9 +240,9 @@ console.log(time); ### `.getMicroseconds()` -Gets the microseconds of the date using the local time. +Gets the microseconds of the date using local time. -`.getUTCMicroseconds()` behaves the same as this method. +`.getUTCMicroseconds()` behaves the same way as this method. ```ts .getMicroseconds(): number; @@ -252,14 +252,14 @@ Gets the microseconds of the date using the local time. None. -#### Return value +#### Return Value Returns the microseconds. #### Example ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/standard"; +import { Datetime } from "@tai-kun/surrealdb/standard-datatypes"; const date = new Datetime([1717245296, 780123456]); console.log(date.toISOString()); @@ -276,7 +276,7 @@ console.log(date.getMicroseconds()); Sets the microseconds. -`.setUTCMicroseconds()` behaves the same as this method. +`.setUTCMicroseconds()` behaves the same way as this method. ```ts .setMicroseconds(us: number): number; @@ -288,14 +288,14 @@ Sets the microseconds. The microseconds to set. The value is converted to an integer. Note that if the value is not between 0 and 999, the entire time will be affected. -#### Return value +#### Return Value -Returns the millisecond-precise time. +Returns the millisecond-precision time. #### Example ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/standard"; +import { Datetime } from "@tai-kun/surrealdb/standard-datatypes"; const date = new Datetime([1717245296, 780123456]); console.log(date.toISOString()); @@ -310,9 +310,9 @@ console.log(time); ### `.getNanoseconds()` -Gets the nanoseconds of the date using the local time. +Gets the nanoseconds of the date using local time. -`.getUTCNanoseconds()` behaves the same as this method. +`.getUTCNanoseconds()` behaves the same way as this method. ```ts .getNanoseconds(): number; @@ -322,14 +322,14 @@ Gets the nanoseconds of the date using the local time. None. -#### Return value +#### Return Value Returns the nanoseconds. #### Example ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/standard"; +import { Datetime } from "@tai-kun/surrealdb/standard-datatypes"; const date = new Datetime([1717245296, 780123456]); console.log(date.toISOString()); @@ -346,7 +346,7 @@ console.log(date.getNanoseconds()); Sets the microseconds. -`.setUTCNanoseconds()` behaves the same as this method. +`.setUTCNanoseconds()` behaves the same way as this method. ```ts .setNanoseconds(us: number): number; @@ -358,14 +358,14 @@ Sets the microseconds. The nanoseconds to set. The value is converted to an integer. Note that if the value is not between 0 and 999, the entire time will be affected. -#### Return value +#### Return Value -Returns the millisecond-precise time. +Returns the millisecond-precision time. #### Example ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/standard"; +import { Datetime } from "@tai-kun/surrealdb/standard-datatypes"; const date = new Datetime([1717245296, 780123456]); console.log(date.toISOString()); @@ -390,23 +390,23 @@ Clones the `Datetime` object. None. -#### Return value +#### Return Value -Returns a new `Datetime` object. If inheriting the `Datetime` class, an instance of that class will be returned. +Returns a new `Datetime` object. If the `Datetime` class is inherited, an instance of that class is returned. ### Development #### Generic Determination of `Datetime` Objects -It is recommended to use the `isDatetime` function to determine whether a value is a `Datetime` object without relying on the preset. This function does not use `instanceof`, so it is useful when the preset of the value to be verified is unknown. +To determine if a value is a `Datetime` object regardless of the preset, it is recommended to use the `isDatetime` function. This function does not use `instanceof`, which is useful when the preset of the value to be validated is unknown. ```ts import { isDatetime } from "@tai-kun/surrealdb"; ``` -#### Datetime Before UNIX Epoch +#### Datetime Before the UNIX Epoch -SurrealDB's `datetime` type can hold nanosecond precision. This requires careful handling in JavaScript. If you pass a SurrealDB-serialized `datetime`, such as `"1969-12-31T23:59:59.999999999Z"`, to JavaScript's `Date.parse`, WebKit will return 0 milliseconds, while others (Node.js, Deno, Bun, Chromium, Firefox) will return -1 millisecond. +The `datetime` type in SurrealDB can hold up to nanosecond precision. Therefore, care must be taken when dealing with it in JavaScript. If you pass a SurrealDB serialized `datetime`, such as `"1969-12-31T23:59:59.999999999Z"`, to JavaScript's `Date.parse`, WebKit will return 0 milliseconds, but other implementations (Node.js, Deno, Bun, Chromium, Firefox) will return -1 milliseconds. WebKit: diff --git a/docs/cache/ja2en/content/v2/api/data/decimal.mdx b/docs/cache/ja2en/content/v2/api/data/decimal.mdx index 459abaf2..6f54dda2 100644 --- a/docs/cache/ja2en/content/v2/api/data/decimal.mdx +++ b/docs/cache/ja2en/content/v2/api/data/decimal.mdx @@ -5,14 +5,14 @@ slug: en/v2/api/data/decimal import Badge from "~/components/en/Badge.astro"; -`Decimal` is a class that represents arbitrary-precision real numbers. When the preset is `standard`, it inherits from the [`big.js`](https://github.com/MikeMcl/big.js) class. This may result in differences in the results of methods like `.toString()` across presets. +`Decimal` is a class for representing arbitrary-precision real numbers. When the preset is `standard`, the class inherits from [`big.js`](https://github.com/MikeMcl/big.js). This may lead to inconsistencies in the results of methods like `.toString()`, depending on the preset. -### Import +### Importing ```ts -import { Decimal } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Decimal } from "@tai-kun/surrealdb/data-types/encodable"; -import { Decimal } from "@tai-kun/surrealdb/data-types/standard"; +import { Decimal } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Decimal } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Decimal } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -28,7 +28,7 @@ new Decimal(source: string | number | Decimal); // standard ##### `source` -A string representing the real number. If the preset is `standard`, a number can also be passed. +A real number represented as a string. If the preset is `standard`, a number can also be passed. #### Return Value @@ -36,7 +36,7 @@ When called through `new`, `Decimal` returns its instance. ### `.toString()` -Gets the real number as a string. +Retrieves the real number as a string. #### Arguments @@ -44,11 +44,11 @@ None. #### Return Value -Returns a string representation of the real number. +Returns the string representation of the real number. ### `.toSurql()` -Converts the `Decimal` object to a string that can be embedded in SurrealQL. Similar to `.toString()`, but it adds the `dec` suffix to tell the query parser that the string is a `decimal` type. +Converts the `Decimal` object to a string that can be embedded into SurrealQL. It is similar to `.toString()`, but it adds a `dec` suffix to inform the query parser that the string is of `decimal` type. ```ts .toSurql(): string; @@ -65,7 +65,7 @@ Returns the real number with the `dec` suffix. #### Example ```ts -import { Decimal } from "@tai-kun/surrealdb/data-types/encodable"; +import { Decimal } from "@tai-kun/surrealdb/encodable-datatypes"; const decimal = new Decimal("3.14"); console.log(decimal.toSurql()); @@ -92,13 +92,13 @@ Returns a new `Decimal` object. If the `Decimal` class is inherited, an instance If you are using the `standard` preset, the `Decimal` class inherits from the `Big` class of `big.js`, so refer to the `big.js` documentation for instance methods and properties: -[`big.js` documentation](https://mikemcl.github.io/big.js/#prototype-methods) +[`big.js` Documentation](https://mikemcl.github.io/big.js/#prototype-methods) ### Development #### Generic Determination of `Decimal` Objects -To determine if a value is a `Decimal` object regardless of the preset, it is recommended to use the `isDecimal` function. This function does not use `instanceof`, so it is useful when the preset of the value to be validated is unknown. +It is recommended to use the `isDecimal` function to determine if a value is a `Decimal` object without depending on the preset. This function does not use `instanceof`, making it helpful when the preset of the value to be verified is unknown. ```ts import { isDecimal } from "@tai-kun/surrealdb"; diff --git a/docs/cache/ja2en/content/v2/api/data/duration.mdx b/docs/cache/ja2en/content/v2/api/data/duration.mdx index 91c30be6..c7235941 100644 --- a/docs/cache/ja2en/content/v2/api/data/duration.mdx +++ b/docs/cache/ja2en/content/v2/api/data/duration.mdx @@ -5,14 +5,14 @@ slug: en/v2/api/data/duration import Badge from "~/components/en/Badge.astro"; -`Duration` is a class that represents a time duration. +`Duration` is a class that represents a time period. -### Import +### Importing ```ts -import { Duration } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Duration } from "@tai-kun/surrealdb/data-types/encodable"; -import { Duration } from "@tai-kun/surrealdb/data-types/standard"; +import { Duration } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Duration } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Duration } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -40,9 +40,9 @@ new Duration( ##### `source` -A pair of seconds and nanoseconds. If the preset is standard, you can use more values to make a `Duration` object. +A pair of seconds and nanoseconds. If the preset is standard, more values can be converted to a `Duration` object. -An input of type `number` is calculated in milliseconds. This is intended for use cases where the difference between `Date` objects is to be made into a `Duration` object: +An input of type `number` is calculated in milliseconds. This is intended for use in converting the difference between `Date` objects into `Duration` objects: ```ts const begin = new Date("2024-06-01T12:00:00.000Z"); @@ -50,7 +50,7 @@ const end = new Date("2024-06-01T21:00:00.000Z"); new Duration(end - begin); ``` -An input of type `bigint` is calculated in nanoseconds. This is intended for use cases where, for example, high-precision time, such as nanoseconds returned by [`process.hrtime.bigint()`](https://nodejs.org/api/process.html#processhrtimebigint), is to be made into a `Duration` object: +An input of type `bigint` is calculated in nanoseconds. This is intended for use in converting high-precision times, such as nanoseconds returned by [`process.hrtime.bigint()`](https://nodejs.org/api/process.html#processhrtimebigint), into `Duration` objects: ```ts const begin = process.hrtime.bigint(); @@ -59,7 +59,7 @@ const end = process.hrtime.bigint(); new Duration(end - begin); ``` -An input of type `string` must be a string representation of a duration. The string representation of a duration refers to a format in which a set of numbers and units are concatenated. For example, `1h4h30m20s1350ms` is "1 day and 4 hours 30 minutes, 21 seconds 350 milliseconds". The available units are as follows: +An input of type `string` must be a string representation of the duration. The string representation of a duration is a format where a number and a unit are paired and they are listed consecutively. For example, `1h4h30m20s1350ms` represents "1 day and 4 hours 30 minutes, 21 seconds 350 milliseconds". The available units are as follows: | Unit | Description | Conversion | | --- | --- | --- | @@ -73,15 +73,15 @@ An input of type `string` must be a string representation of a duration. The str | `w` | week | `1w` -> `7d` | | `y` | year | `1y` -> `365d` | -`us` (`0x75`, `0x73`) can also be written as `µs` (`0xc2`, `0xb5`, `0x73`) or `μs` (`0xce`, `0xbc`, `0x73`) (the hexadecimal numbers in parentheses are the results of UTF-8 encoding of the unit string). +`us` (`0x75`, `0x73`) can also be written as `µs` (`0xc2`, `0xb5`, `0x73`) or `μs` (`0xce`, `0xbc`, `0x73`) (the hexadecimal numbers in parentheses are the results of encoding the unit string in UTF-8). -#### Returns +#### Return value -When called via `new`, `Duration` returns its instance. +When called through `new`, `Duration` returns its instance. ### `.seconds` -The seconds part of the duration. It is read-only in presets below standard. The value is an integer from 0 to 264-1. +The seconds part of the duration. Read-only for presets below standard. The value is an integer between 0 and 264-1. ```ts .seconds: bigint; @@ -89,7 +89,7 @@ The seconds part of the duration. It is read-only in presets below standard. The ### `.nanoseconds` -The nanoseconds part of the duration. It is read-only in presets below standard. The value is an integer from 0 to 999999999. +The nanoseconds part of the duration. Read-only for presets below standard. The value is an integer between 0 and 999999999. ```ts .nanoseconds: number; @@ -97,7 +97,7 @@ The nanoseconds part of the duration. It is read-only in presets below standard. ### `.parse()` -Maps the duration to each unit. The value of each unit will be greater than or equal to 0 and less than the maximum value of that unit. Note that if the duration is 0, an object with only the `nanoseconds` property set to `0` will be returned. +Maps the duration to each unit. The value of each unit is between 0 and the maximum value of that unit. Note that if the duration is 0, it returns an object with only `nanoseconds` property that has `0`. ```ts .parse(): { @@ -117,14 +117,14 @@ Maps the duration to each unit. The value of each unit will be greater than or e None. -#### Returns +#### Return value -Returns the result of mapping the duration to each unit. If the value of the unit is 0, the property will be omitted, but if the duration is 0, an object with only `nanoseconds` set to `0` will be returned. +Returns the result of mapping the duration to each unit. If the value of a unit is 0, the property is omitted, but if the duration is 0, it returns an object with only `nanoseconds` property that has `0`. -#### Example +#### Examples ```ts -import { Duration } from "@tai-kun/surrealdb/data-types/encodable"; +import { Duration } from "@tai-kun/surrealdb/encodable-datatypes"; const duration = new Duration(0); console.log(duration.parse()); @@ -132,7 +132,7 @@ console.log(duration.parse()); ``` ```ts -import { Duration } from "@tai-kun/surrealdb/data-types/encodable"; +import { Duration } from "@tai-kun/surrealdb/encodable-datatypes"; const duration = new Duration(12_345_000n); console.log(duration.parse()); @@ -151,12 +151,12 @@ Gets the duration in nanoseconds. None. -#### Returns +#### Return value Returns the duration in nanoseconds. ```ts -import { Duration } from "@tai-kun/surrealdb/data-types/encodable"; +import { Duration } from "@tai-kun/surrealdb/encodable-datatypes"; const duration = new Duration(12_345_000n); console.log(duration.valueOf()); @@ -177,14 +177,14 @@ Gets the string representation of the duration. None. -#### Returns +#### Return value -Gets the string representation of the duration in milliseconds precision. +Returns the string representation of the time in millisecond precision. -#### Example +#### Examples ```ts -import { Duration } from "@tai-kun/surrealdb/data-types/encodable"; +import { Duration } from "@tai-kun/surrealdb/encodable-datatypes"; const duration = new Duration(12_345_000n); console.log(duration.toString()); @@ -203,14 +203,14 @@ Gets the duration string in ISO format. None. -#### Returns +#### Return value Returns the duration string in ISO format. -#### Example +#### Examples ```ts -import { Duration } from "@tai-kun/surrealdb/data-types/encodable"; +import { Duration } from "@tai-kun/surrealdb/encodable-datatypes"; const duration = new Duration("2m3s456ms"); console.log(duration.toISOString()); @@ -219,7 +219,7 @@ console.log(duration.toISOString()); ### `.getCompact()` -Gets a pair of seconds and nanoseconds. +Gets the pair of seconds and nanoseconds. ```ts .getCompact(): [seconds: bigint, nanoseconds: number]; @@ -229,9 +229,9 @@ Gets a pair of seconds and nanoseconds. None. -#### Returns +#### Return value -Returns a pair of seconds and nanoseconds. +Returns the pair of seconds and nanoseconds. ### `.setCompact()` @@ -247,13 +247,13 @@ Sets the date and time with a pair of seconds and nanoseconds. A pair of seconds and nanoseconds. -#### Returns +#### Return value None. ### `.getYears()` -Gets the years. If it does not result in a non-negative integer, 0 will be returned. +Gets the years. If it is not a non-negative integer, 0 is returned. ```ts .getYears(): number; @@ -263,7 +263,7 @@ Gets the years. If it does not result in a non-negative integer, 0 will be retur None. -#### Returns +#### Return value Returns a non-negative integer representing the years. @@ -281,7 +281,7 @@ Adds the specified number of years to the duration. The number of years. -#### Returns +#### Return value None. @@ -299,13 +299,13 @@ Subtracts the specified number of years from the duration. The number of years. -#### Returns +#### Return value None. ### `.asYears()` -Gets the millisecond representation of the number of years. +Gets the millisecond representation of the years. ```ts .asYears(): number; @@ -315,13 +315,13 @@ Gets the millisecond representation of the number of years. None. -#### Returns +#### Return value -The millisecond representation of the number of years. +The millisecond representation of the years. ### `.getWeeks()` -Gets the weeks. If it does not result in a non-negative integer, 0 will be returned. +Gets the weeks. If it is not a non-negative integer, 0 is returned. ```ts .getWeeks(): number; @@ -331,7 +331,7 @@ Gets the weeks. If it does not result in a non-negative integer, 0 will be retur None. -#### Returns +#### Return value Returns a non-negative integer representing the weeks. @@ -349,7 +349,7 @@ Adds the specified number of weeks to the duration. The number of weeks. -#### Returns +#### Return value None. @@ -367,13 +367,13 @@ Subtracts the specified number of weeks from the duration. The number of weeks. -#### Returns +#### Return value None. ### `.asWeeks()` -Gets the millisecond representation of the number of weeks. +Gets the millisecond representation of the weeks. ```ts .asWeeks(): number; @@ -383,13 +383,13 @@ Gets the millisecond representation of the number of weeks. None. -#### Returns +#### Return value -The millisecond representation of the number of weeks. +The millisecond representation of the weeks. ### `.getDays()` -Gets the days. If it does not result in a non-negative integer, 0 will be returned. +Gets the days. If it is not a non-negative integer, 0 is returned. ```ts .getDays(): number; @@ -399,7 +399,7 @@ Gets the days. If it does not result in a non-negative integer, 0 will be return None. -#### Returns +#### Return value Returns a non-negative integer representing the days. @@ -417,7 +417,7 @@ Adds the specified number of days to the duration. The number of days. -#### Returns +#### Return value None. @@ -435,13 +435,13 @@ Subtracts the specified number of days from the duration. The number of days. -#### Returns +#### Return value None. ### `.asDays()` -Gets the millisecond representation of the number of days. +Gets the millisecond representation of the days. ```ts .asDays(): number; @@ -451,13 +451,13 @@ Gets the millisecond representation of the number of days. None. -#### Returns +#### Return value -The millisecond representation of the number of days. +The millisecond representation of the days. ### `.getHours()` -Gets the hours. If it does not result in a non-negative integer, 0 will be returned. +Gets the hours. If it is not a non-negative integer, 0 is returned. ```ts .getHours(): number; @@ -467,7 +467,7 @@ Gets the hours. If it does not result in a non-negative integer, 0 will be retur None. -#### Returns +#### Return value Returns a non-negative integer representing the hours. @@ -485,7 +485,7 @@ Adds the specified number of hours to the duration. The number of hours. -#### Returns +#### Return value None. @@ -503,13 +503,13 @@ Subtracts the specified number of hours from the duration. The number of hours. -#### Returns +#### Return value None. ### `.asHours()` -Gets the millisecond representation of the number of hours. +Gets the millisecond representation of the hours. ```ts .asHours(): number; @@ -519,13 +519,13 @@ Gets the millisecond representation of the number of hours. None. -#### Returns +#### Return value -The millisecond representation of the number of hours. +The millisecond representation of the hours. ### `.getMinutes()` -Gets the minutes. If it does not result in a non-negative integer, 0 will be returned. +Gets the minutes. If it is not a non-negative integer, 0 is returned. ```ts .getMinutes(): number; @@ -535,7 +535,7 @@ Gets the minutes. If it does not result in a non-negative integer, 0 will be ret None. -#### Returns +#### Return value Returns a non-negative integer representing the minutes. @@ -553,7 +553,7 @@ Adds the specified number of minutes to the duration. The number of minutes. -#### Returns +#### Return value None. @@ -571,13 +571,13 @@ Subtracts the specified number of minutes from the duration. The number of minutes. -#### Returns +#### Return value None. ### `.asMinutes()` -Gets the millisecond representation of the number of minutes. +Gets the millisecond representation of the minutes. ```ts .asMinutes(): number; @@ -587,13 +587,13 @@ Gets the millisecond representation of the number of minutes. None. -#### Returns +#### Return value -The millisecond representation of the number of minutes. +The millisecond representation of the minutes. ### `.getSeconds()` -Gets the seconds. If it does not result in a non-negative integer, 0 will be returned. +Gets the seconds. If it is not a non-negative integer, 0 is returned. ```ts .getSeconds(): number; @@ -603,7 +603,7 @@ Gets the seconds. If it does not result in a non-negative integer, 0 will be ret None. -#### Returns +#### Return value Returns a non-negative integer representing the seconds. @@ -621,7 +621,7 @@ Adds the specified number of seconds to the duration. The number of seconds. -#### Returns +#### Return value None. @@ -639,13 +639,13 @@ Subtracts the specified number of seconds from the duration. The number of seconds. -#### Returns +#### Return value None. ### `.asSeconds()` -Gets the millisecond representation of the number of seconds. +Gets the millisecond representation of the seconds. ```ts .asSeconds(): number; @@ -655,13 +655,13 @@ Gets the millisecond representation of the number of seconds. None. -#### Returns +#### Return value -The millisecond representation of the number of seconds. +The millisecond representation of the seconds. ### `.getMilliseconds()` -Gets the milliseconds. If it does not result in a non-negative integer, 0 will be returned. +Gets the milliseconds. If it is not a non-negative integer, 0 is returned. ```ts .getMilliseconds(): number; @@ -671,7 +671,7 @@ Gets the milliseconds. If it does not result in a non-negative integer, 0 will b None. -#### Returns +#### Return value Returns a non-negative integer representing the milliseconds. @@ -689,7 +689,7 @@ Adds the specified number of milliseconds to the duration. The number of milliseconds. -#### Returns +#### Return value None. @@ -707,13 +707,13 @@ Subtracts the specified number of milliseconds from the duration. The number of milliseconds. -#### Returns +#### Return value None. ### `.asMilliseconds()` -Gets the millisecond representation of the number of milliseconds. +Gets the millisecond representation of the milliseconds. ```ts .asMilliseconds(): number; @@ -723,13 +723,13 @@ Gets the millisecond representation of the number of milliseconds. None. -#### Returns +#### Return value -The millisecond representation of the number of milliseconds. +The millisecond representation of the milliseconds. ### `.getMicroseconds()` -Gets the microseconds. If it does not result in a non-negative integer, 0 will be returned. +Gets the microseconds. If it is not a non-negative integer, 0 is returned. ```ts .getMicroseconds(): number; @@ -739,7 +739,7 @@ Gets the microseconds. If it does not result in a non-negative integer, 0 will b None. -#### Returns +#### Return value Returns a non-negative integer representing the microseconds. @@ -757,7 +757,7 @@ Adds the specified number of microseconds to the duration. The number of microseconds. -#### Returns +#### Return value None. @@ -775,13 +775,13 @@ Subtracts the specified number of microseconds from the duration. The number of microseconds. -#### Returns +#### Return value None. ### `.asMicroseconds()` -Gets the millisecond representation of the number of microseconds. +Gets the millisecond representation of the microseconds. ```ts .asMicroseconds(): number; @@ -791,13 +791,13 @@ Gets the millisecond representation of the number of microseconds. None. -#### Returns +#### Return value -The millisecond representation of the number of microseconds. +The millisecond representation of the microseconds. ### `.getNanoseconds()` -Gets the nanoseconds. If it does not result in a non-negative integer, 0 will be returned. +Gets the nanoseconds. If it is not a non-negative integer, 0 is returned. ```ts .getNanoseconds(): number; @@ -807,7 +807,7 @@ Gets the nanoseconds. If it does not result in a non-negative integer, 0 will be None. -#### Returns +#### Return value Returns a non-negative integer representing the nanoseconds. @@ -825,7 +825,7 @@ Adds the specified number of nanoseconds to the duration. The number of nanoseconds. -#### Returns +#### Return value None. @@ -843,13 +843,13 @@ Subtracts the specified number of nanoseconds from the duration. The number of nanoseconds. -#### Returns +#### Return value None. ### `.asNanoseconds()` -Gets the millisecond representation of the number of nanoseconds. +Gets the millisecond representation of the nanoseconds. ```ts .asNanoseconds(): number; @@ -859,6 +859,6 @@ Gets the millisecond representation of the number of nanoseconds. None. -#### Returns +#### Return value -The millisecond representation of the number of nanoseconds. +The millisecond representation of the nanoseconds. diff --git a/docs/cache/ja2en/content/v2/api/data/future.mdx b/docs/cache/ja2en/content/v2/api/data/future.mdx index ae84af59..9ba44c8d 100644 --- a/docs/cache/ja2en/content/v2/api/data/future.mdx +++ b/docs/cache/ja2en/content/v2/api/data/future.mdx @@ -7,14 +7,14 @@ banner: import Badge from "~/components/en/Badge.astro"; -The `Future` class represents the [Futures feature](https://surrealdb.com/docs/surrealql/datamodel/futures) of SurrealDB. +`Future` is a class that represents SurrealDB's [Futures Feature](https://surrealdb.com/docs/surrealql/datamodel/futures). ### Import ```ts -import { Future } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Future } from "@tai-kun/surrealdb/data-types/encodable"; -import { Future } from "@tai-kun/surrealdb/data-types/standard"; +import { Future } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Future } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Future } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -31,9 +31,9 @@ new Future(source: string); The value or expression inside the future's block. -#### Return Value +#### Returns -When called through `new`, `Future` returns its instance. +When called with `new`, `Future` returns its instance. ### `.block` @@ -45,7 +45,7 @@ The value or expression inside the future's block. ### `.toString()` -Converts a `Future` object to a string. +Converts the `Future` object into a string. ```ts .toString(): string; @@ -55,14 +55,14 @@ Converts a `Future` object to a string. None. -#### Return Value +#### Returns Returns the value or expression inside the future's block. #### Example ```ts -import { Future } from "@tai-kun/surrealdb/data-types/encodable"; +import { Future } from "@tai-kun/surrealdb/encodable-datatypes"; const future = new Future(`time::now()`); console.log(future.toString()); @@ -71,7 +71,7 @@ console.log(future.toString()); ### `.toSurql()` -Converts a `Future` object to a string that can be embedded in SurrealQL. Similar to `.toString()`, but the block is enclosed in curly braces (`{}`) and cast with ``. +Converts the `Future` object into a string that can be embedded in SurrealQL. Similar to `.toString()`, but the block is wrapped in curly braces (`{}`) and cast with ``. ```ts .toSurql(): string; @@ -81,14 +81,14 @@ Converts a `Future` object to a string that can be embedded in SurrealQL. Simila None. -#### Return Value +#### Returns Returns the future that can be embedded in SurrealQL. #### Example ```ts -import { Future } from "@tai-kun/surrealdb/data-types/encodable"; +import { Future } from "@tai-kun/surrealdb/encodable-datatypes"; const future = new Future(`time::now()`); console.log(future.toSurql()); @@ -97,7 +97,7 @@ console.log(future.toSurql()); ### `.surql()` -This method helps with writing SurrealQL. You can use template literals to write SurrealQL. Values embedded in template literals are automatically converted to SurrealQL. Also, if you have installed the [SurrealDB official extension](https://marketplace.visualstudio.com/items?itemName=surrealdb.surrealql) for VSCode, syntax highlighting for template literals will be enabled. +This method assists in writing SurrealQL. You can write SurrealQL using template literals. Values embedded in the template literal are automatically converted to SurrealQL. Additionally, if you have installed the [SurrealDB official extension](https://marketplace.visualstudio.com/items?itemName=surrealdb.surrealql) in VSCode, syntax highlighting for template literals will be enabled. ```ts .surql(texts: TemplateStringsArray, ...values: unknown[]): string; @@ -111,16 +111,16 @@ An array of strings that make up the template literal. ##### `values` -The values to embed between each element of `texts`. +Values to be embedded between each element in `texts`. -#### Return Value +#### Returns SurrealQL. #### Example ```ts -import { Future, Thing } from "@tai-kun/surrealdb/data-types/standard"; +import { Future, Thing } from "@tai-kun/surrealdb/standard-datatypes"; const foo = "foo"; const rid = new Thing("person", "tai-kun"); @@ -140,7 +140,7 @@ console.log(future.toSurql()); Without using `.surql()`, the above example would be: ```ts -import { Future, Thing } from "@tai-kun/surrealdb/data-types/standard"; +import { Future, Thing } from "@tai-kun/surrealdb/standard-datatypes"; import { toSurql } from "@tai-kun/surrealdb/utils"; const foo = "foo"; @@ -158,14 +158,14 @@ console.log(future.toSurql()); //-> } ``` -- You need to convert strings and objects to SurrealQL using the `toSurql` helper function or `.toSurql()` method. +- You need to convert strings and objects to SurrealQL using the `toSurql` helper function or the `.toSurql()` method. - You can embed strings in SurrealQL without using `Future.raw`. ### Development -#### Generic Determination of `Future` Objects +#### Generic Judgment of `Future` Objects -To determine if a value is a `Future` object without relying on presets, it is recommended to use the `isFuture` function. This function does not use `instanceof`, which is useful when the preset of the value to be verified is unknown. +To determine if a value is a `Future` object without relying on presets, it is recommended to use the `isFuture` function. This function does not use `instanceof`, making it useful when the preset of the value to be verified is unknown. ```ts import { isFuture } from "@tai-kun/surrealdb"; diff --git a/docs/cache/ja2en/content/v2/api/data/geometry-collection.mdx b/docs/cache/ja2en/content/v2/api/data/geometry-collection.mdx index 488901a6..e7c410ab 100644 --- a/docs/cache/ja2en/content/v2/api/data/geometry-collection.mdx +++ b/docs/cache/ja2en/content/v2/api/data/geometry-collection.mdx @@ -5,14 +5,14 @@ slug: en/v2/api/data/geometry-collection import Badge from "~/components/en/Badge.astro"; -This documentation is still under construction. +This page is under construction. ### Import ```ts -import { GeometryCollection } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryCollection } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryCollection } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryCollection } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryCollection } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryCollection } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -27,8 +27,8 @@ new GeometryCollection(source); ##### `source` -This section is still under construction. +This section is under construction. -#### Return Value +#### Returns When called through `new`, `GeometryCollection` returns its instance. diff --git a/docs/cache/ja2en/content/v2/api/data/geometry-line.mdx b/docs/cache/ja2en/content/v2/api/data/geometry-line.mdx index a45149e0..03199f7c 100644 --- a/docs/cache/ja2en/content/v2/api/data/geometry-line.mdx +++ b/docs/cache/ja2en/content/v2/api/data/geometry-line.mdx @@ -10,9 +10,9 @@ This page is under construction. ### Import ```ts -import { GeometryLine } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryLine } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryLine } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryLine } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryLine } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryLine } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -29,6 +29,6 @@ new GeometryLine(source); This section is under construction. -#### Returns +#### Return Value -When called via `new`, `GeometryLine` returns its instance. +When invoked through `new`, `GeometryLine` returns its instance. diff --git a/docs/cache/ja2en/content/v2/api/data/geometry-multi-line.mdx b/docs/cache/ja2en/content/v2/api/data/geometry-multi-line.mdx index aa9e3411..6950c4b7 100644 --- a/docs/cache/ja2en/content/v2/api/data/geometry-multi-line.mdx +++ b/docs/cache/ja2en/content/v2/api/data/geometry-multi-line.mdx @@ -10,9 +10,9 @@ This page is under construction. ### Import ```ts -import { GeometryMultiLine } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryMultiLine } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryMultiLine } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryMultiLine } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryMultiLine } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryMultiLine } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -29,6 +29,6 @@ new GeometryMultiLine(source); This page is under construction. -#### Return Value +#### Returns When called via `new`, `GeometryMultiLine` returns its instance. diff --git a/docs/cache/ja2en/content/v2/api/data/geometry-multi-point.mdx b/docs/cache/ja2en/content/v2/api/data/geometry-multi-point.mdx index b3ed5f86..8f6f292a 100644 --- a/docs/cache/ja2en/content/v2/api/data/geometry-multi-point.mdx +++ b/docs/cache/ja2en/content/v2/api/data/geometry-multi-point.mdx @@ -5,14 +5,14 @@ slug: en/v2/api/data/geometry-multi-point import Badge from "~/components/en/Badge.astro"; -This document is under construction. +This document is still under construction. ### Import ```ts -import { GeometryMultiPoint } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryMultiPoint } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryMultiPoint } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryMultiPoint } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryMultiPoint } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryMultiPoint } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -27,7 +27,7 @@ new GeometryMultiPoint(source); ##### `source` -This section is under construction. +This document is still under construction. #### Return Value diff --git a/docs/cache/ja2en/content/v2/api/data/geometry-multi-polygon.mdx b/docs/cache/ja2en/content/v2/api/data/geometry-multi-polygon.mdx index aa6f81c2..02550351 100644 --- a/docs/cache/ja2en/content/v2/api/data/geometry-multi-polygon.mdx +++ b/docs/cache/ja2en/content/v2/api/data/geometry-multi-polygon.mdx @@ -5,14 +5,14 @@ slug: en/v2/api/data/geometry-multi-polygon import Badge from "~/components/en/Badge.astro"; -This page is under construction. +**Work in progress.** ### Import ```ts -import { GeometryMultiPolygon } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryMultiPolygon } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryMultiPolygon } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryMultiPolygon } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryMultiPolygon } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryMultiPolygon } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -27,7 +27,7 @@ new GeometryMultiPolygon(source); ##### `source` -This page is under construction. +**Work in progress.** #### Returns diff --git a/docs/cache/ja2en/content/v2/api/data/geometry-point.mdx b/docs/cache/ja2en/content/v2/api/data/geometry-point.mdx index 4967c6f7..e9e3ec13 100644 --- a/docs/cache/ja2en/content/v2/api/data/geometry-point.mdx +++ b/docs/cache/ja2en/content/v2/api/data/geometry-point.mdx @@ -10,9 +10,9 @@ This page is under construction. ### Import ```ts -import { GeometryPoint } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryPoint } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryPoint } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryPoint } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryPoint } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryPoint } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` diff --git a/docs/cache/ja2en/content/v2/api/data/geometry-polygon.mdx b/docs/cache/ja2en/content/v2/api/data/geometry-polygon.mdx index c00c8eca..6c103448 100644 --- a/docs/cache/ja2en/content/v2/api/data/geometry-polygon.mdx +++ b/docs/cache/ja2en/content/v2/api/data/geometry-polygon.mdx @@ -5,14 +5,14 @@ slug: en/v2/api/data/geometry-polygon import Badge from "~/components/en/Badge.astro"; -Under Construction. +This page is under construction. ### Import ```ts -import { GeometryPolygon } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryPolygon } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryPolygon } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryPolygon } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryPolygon } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryPolygon } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -27,8 +27,8 @@ new GeometryPolygon(source); ##### `source` -Under Construction. +This page is under construction. -#### Returns +#### Return Value When called via `new`, `GeometryPolygon` returns its instance. diff --git a/docs/cache/ja2en/content/v2/api/data/range.mdx b/docs/cache/ja2en/content/v2/api/data/range.mdx index 9092287c..0be599c8 100644 --- a/docs/cache/ja2en/content/v2/api/data/range.mdx +++ b/docs/cache/ja2en/content/v2/api/data/range.mdx @@ -7,18 +7,14 @@ banner: import Badge from "~/components/en/Badge.astro"; -## Range - -### Description - -This type represents a range of values. +## Description ### Import ```ts -import { Range } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Range } from "@tai-kun/surrealdb/data-types/encodable"; -import { Range } from "@tai-kun/surrealdb/data-types/standard"; +import { Range } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Range } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Range } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -38,15 +34,15 @@ new Range( ##### `source` -A pair of minimum and maximum values for the range. `null` if unbounded. +A pair of minimum and maximum values for the range. If there is no limit, it is `null`. #### Return Value -When invoked via `new`, `Range` returns its instance. +When called through `new`, `Range` returns its instance. ### `.begin` -The minimum value of the range. `null` if unbounded on the lower end. +The minimum value of the range. If there is no lower bound, it is `null`. ```ts .begin: BoundIncluded | BoundExcluded | null; @@ -54,7 +50,7 @@ The minimum value of the range. `null` if unbounded on the lower end. ### `.end` -The maximum value of the range. `null` if unbounded on the upper end. +The maximum value of the range. If there is no upper bound, it is `null`. ```ts .end: BoundIncluded | BoundExcluded | null; @@ -62,7 +58,7 @@ The maximum value of the range. `null` if unbounded on the upper end. ### `.toString()` -Converts the `Range` object to a SurrealQL-usable string. +Converts the `Range` object into a string usable in SurrealQL. `.toJSON()` and `.toSurql()` return the same result as this method. @@ -76,16 +72,16 @@ None. #### Return Value -Returns a string representation of the range. +Returns the string representation of the range. -#### Example +#### Examples ```ts import { Range, BoundIncluded, BoundExcluded, -} from "@tai-kun/surrealdb/data-types/encodable"; +} from "@tai-kun/surrealdb/encodable-datatypes"; const range = new Range([new BoundIncluded(1), new BoundIncluded(3)]); console.log(range.toString()); @@ -124,11 +120,11 @@ console.log(range.toString()); // -> .. ``` -### Advancement +### Further Development -#### General Purpose Determination of `Range` Objects +#### Generic Judgement of `Range` Objects -To determine if a value is a `Range` object without relying on presets, it is recommended to use the `isRange` function. This function does not use `instanceof`, making it useful when the preset of the value to be validated is unknown. +It is recommended to use the `isRange` function to determine whether a value is a `Range` object without relying on presets. This function does not use `instanceof`, making it useful when the preset of the value to be verified is unknown. ```ts import { isRange } from "@tai-kun/surrealdb"; diff --git a/docs/cache/ja2en/content/v2/api/data/table.mdx b/docs/cache/ja2en/content/v2/api/data/table.mdx index 5427f26f..1a4fd23b 100644 --- a/docs/cache/ja2en/content/v2/api/data/table.mdx +++ b/docs/cache/ja2en/content/v2/api/data/table.mdx @@ -5,14 +5,14 @@ slug: en/v2/api/data/table import Badge from "~/components/en/Badge.astro"; -`Table` is a class that represents a table name with a record ID. +`Table` is a class that represents the name of a table of record IDs. ### Import ```ts -import { Table } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Table } from "@tai-kun/surrealdb/data-types/encodable"; -import { Table } from "@tai-kun/surrealdb/data-types/standard"; +import { Table } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Table } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Table } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -36,7 +36,7 @@ When called through `new`, `Table` returns its instance. ### `.name` -The table name. When retrieving this property, the string is not escaped. +The table name. When getting this property, the string is not escaped. ```ts .name: string; @@ -44,10 +44,10 @@ The table name. When retrieving this property, the string is not escaped. #### Example -When retrieving this property, the string is not escaped. +When getting this property, the string is not escaped. ```ts -import { Table } from "@tai-kun/surrealdb/data-types/decode-only"; +import { Table } from "@tai-kun/surrealdb/decodeonly-datatypes"; const table = new Table("foo-bar"); console.log(table.name); @@ -56,7 +56,7 @@ console.log(table.name); ### `.toString()` -Converts the `Table` object to a string that can be used in SurrealQL variables. +Converts the `Table` object to a string that can be used in a SurrealQL variable. `.valueOf()` and `.toJSON()` return the same result as this method. @@ -75,7 +75,7 @@ Returns the table name. #### Example ```ts -import { Table } from "@tai-kun/surrealdb/data-types/encodable"; +import { Table } from "@tai-kun/surrealdb/encodable-datatypes"; const table = new Table("foo-bar"); console.log(table.toString()); @@ -84,7 +84,7 @@ console.log(table.toString()); ### `.toSurql()` -Converts the `Table` object to a string that can be embedded in SurrealQL. Similar to `.toString()`, but the table name is escaped the same way as in the SurrealDB implementation. +Converts the `Table` object to a string that can be embedded in SurrealQL. Similar to `.toString()`, but the table name is escaped as in SurrealDB's implementation. ```ts .toSurql(): string; @@ -96,12 +96,12 @@ None. #### Return value -Returns the table name with an escaped string. +Returns a string with the escaped table name. #### Example ```ts -import { Table } from "@tai-kun/surrealdb/data-types/encodable"; +import { Table } from "@tai-kun/surrealdb/encodable-datatypes"; const table = new Table("foo-bar"); console.log(table.toSurql()); @@ -122,16 +122,16 @@ None. #### Return value -Returns a new `Table` object. If you inherit the `Table` class, an instance of that class is returned. +Returns a new `Table` object. If the `Table` class is inherited, an instance of that class is returned. -### Advanced +### Development #### Type Guard -You can type-safe the table name of `Table` using a type parameter: +You can make the table name of a `Table` type-safe using a type parameter: ```ts -import { Table } from "@tai-kun/surrealdb/data-types/standard"; +import { Table } from "@tai-kun/surrealdb/standard-datatypes"; function isUserTable(table: unknown): table is Table<"user"> { return table instanceof Table @@ -139,9 +139,9 @@ function isUserTable(table: unknown): table is Table<"user"> { } ``` -#### Generic Judgment of `Table` Objects +#### Generic Determination of `Table` Objects -To determine whether a value is a `Table` object without relying on the preset, it is recommended to use the `isTable` function. This function does not use `instanceof`, which is helpful when the preset of the value to be verified is unknown. +To determine if a value is a `Table` object without relying on the preset, it is recommended to use the `isTable` function. This function does not use `instanceof`, so it is useful when the preset of the value to be verified is unknown. ```ts import { isTable } from "@tai-kun/surrealdb"; diff --git a/docs/cache/ja2en/content/v2/api/data/thing.mdx b/docs/cache/ja2en/content/v2/api/data/thing.mdx index a8c503ca..565cd4cd 100644 --- a/docs/cache/ja2en/content/v2/api/data/thing.mdx +++ b/docs/cache/ja2en/content/v2/api/data/thing.mdx @@ -10,9 +10,9 @@ The `Thing` class represents a [record ID](https://surrealdb.com/docs/surrealql/ ### Import ```ts -import { Thing } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Thing } from "@tai-kun/surrealdb/data-types/encodable"; -import { Thing } from "@tai-kun/surrealdb/data-types/standard"; +import { Thing } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Thing } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Thing } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -28,7 +28,7 @@ new Thing(table: string, id: string | number | bigint | object); ##### `source` -A pair of table and ID parts of the record ID. +A pair of the table and ID parts of the record ID. ##### `table` @@ -38,13 +38,13 @@ The table part of the record ID. The ID part of the record ID. -#### Return Value +#### Returns -When invoked through `new`, `Thing` returns its instance. +When called via `new`, the `Thing` returns its instance. ### `.table` -The table part of the record ID. This property will not escape the string when retrieved. +The table part of the record ID. When getting this property, the string is not escaped. ```ts .table: string; @@ -52,10 +52,10 @@ The table part of the record ID. This property will not escape the string when r #### Example -This property will not escape the string when retrieved. +When getting this property, the string is not escaped. ```ts -import { Thing } from "@tai-kun/surrealdb/data-types/decode-only"; +import { Thing } from "@tai-kun/surrealdb/decodeonly-datatypes"; const thing = new Thing("foo-bar", 0); console.log(this.id); @@ -72,7 +72,7 @@ The ID part of the record ID. ### `.toString()` -Converts the `Thing` object into a string that can be used as a variable in SurrealQL. The table name and ID part will be escaped and formatted the same way as SurrealDB's implementation. Also, the object's properties are sorted in ascending order. +Converts the `Thing` object into a string usable as a SurrealQL variable. The table and ID parts are escaped and formatted in the same way as the SurrealDB implementation. Also, the object's properties are sorted in ascending order. `.valueOf()` and `.toJSON()` return the same result as this method. @@ -84,14 +84,14 @@ Converts the `Thing` object into a string that can be used as a variable in Surr None. -#### Return Value +#### Returns Returns a string formatted as a record ID. #### Example ```ts -import { Thing } from "@tai-kun/surrealdb/data-types/encodable"; +import { Thing } from "@tai-kun/surrealdb/encodable-datatypes"; const thing = new Thing([ "foo-bar", @@ -103,7 +103,7 @@ console.log(thing.toString()); ### `.toSurql()` -Converts the `Thing` object into a string that can be embedded in SurrealQL. Similar to `.toString()`, but adds an `r` prefix to tell the query parser that the string is a record ID. +Converts the `Thing` object into a string embeddable in SurrealQL. Similar to `.toString()`, but it adds the `r` prefix to tell the query parser that the string is a record ID. ```ts .toSurql(): string; @@ -113,14 +113,14 @@ Converts the `Thing` object into a string that can be embedded in SurrealQL. Sim None. -#### Return Value +#### Returns Returns a string formatted as a record ID. #### Example ```ts -import { Thing } from "@tai-kun/surrealdb/data-types/encodable"; +import { Thing } from "@tai-kun/surrealdb/encodable-datatypes"; const thing = new Thing("foo", "bar"); console.log(thing.toSurql()); @@ -129,7 +129,7 @@ console.log(thing.toSurql()); ### `.clone()` -Clones the `Thing` object. However, the ID part will not be cloned and referenced. +Clones the `Thing` object. However, the ID part is referenced, not cloned. ```ts .clone(): this; @@ -139,18 +139,18 @@ Clones the `Thing` object. However, the ID part will not be cloned and reference None. -#### Return Value +#### Returns -Returns a new `Thing` object. If the `Thing` class is inherited, an instance of that class will be returned. +Returns a new `Thing` object. If the `Thing` class is inherited, it returns an instance of that class. ### Development #### Type Guard -You can type-safely set the table part and ID part of `Thing` with type parameters: +You can use type parameters for type safety for both the table and ID parts of the `Thing`. ```ts -import { Thing, Uuid } from "@tai-kun/surrealdb/data-types/standard"; +import { Thing, Uuid } from "@tai-kun/surrealdb/standard-datatypes"; function isUserRecordId(thing: unknown): thing is Thing<"user", Uuid> { return thing instanceof Thing @@ -159,9 +159,9 @@ function isUserRecordId(thing: unknown): thing is Thing<"user", Uuid> { } ``` -#### Generic `Thing` Object Determination +#### General Purpose Judgement of `Thing` Objects -It is recommended to use the `isThing` function to determine if a value is a `Thing` object without relying on presets. This function does not use `instanceof`, making it useful when the preset of the value being validated is unknown. +It is recommended to use the `isThing` function to determine if a value is a `Thing` object without relying on presets. This function does not use `instanceof`, so it is helpful when the preset of the value to be validated is unknown. ```ts import { isThing } from "@tai-kun/surrealdb"; diff --git a/docs/cache/ja2en/content/v2/api/data/uuid.mdx b/docs/cache/ja2en/content/v2/api/data/uuid.mdx index 6e69a3ce..2c190451 100644 --- a/docs/cache/ja2en/content/v2/api/data/uuid.mdx +++ b/docs/cache/ja2en/content/v2/api/data/uuid.mdx @@ -5,14 +5,14 @@ slug: en/v2/api/data/uuid import Badge from "~/components/en/Badge.astro"; -A UUID (Universally Unique Identifier) is a 128-bit identifier used to uniquely identify a specific entity. `Uuid` is a class that represents this. It supports UUID versions v1 through v7. Note that generating UUIDs requires a separate library or a built-in feature in the runtime (such as `node:crypto`). +A UUID (Universally Unique Identifier) is a 128-bit identifier used to uniquely identify a particular entity. The `Uuid` class represents a UUID and supports versions v1 to v7. To generate a UUID, you will need to use a separate library or a built-in function provided by your runtime environment (e.g., `node:crypto`). ### Import ```ts -import { Uuid } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Uuid } from "@tai-kun/surrealdb/data-types/encodable"; -import { Uuid } from "@tai-kun/surrealdb/data-types/standard"; +import { Uuid } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Uuid } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Uuid } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -28,11 +28,11 @@ new Uuid(source: Uint8Array | string); // standard ##### `source` -An array of bytes representing the UUID or a string if using the standard preset. +The byte array representation of the UUID or a string if it's a standard preset. -#### Return Value +#### Returns -When invoked through `new`, `Uuid` returns its instance. +When called via `new`, `Uuid` returns its instance. ### `.bytes` @@ -44,23 +44,23 @@ The byte array of the UUID. ### `.variant` -The variant of the UUID. This is defined by the top 3 bits of the 13th byte of the UUID. There are 3 main variants and one reserved for future use. +The variant of the UUID. This is defined by the top 4 bits of the 13th bit of the UUID. There are three main variants and one reserved for future use: 1. NCS compatible - `0b0xxx` - - Indicates that the UUID is compatible with NCS (Network Computing System). - - Not commonly used. + - Indicates that the UUID is compatible with the NCS (Network Computing System). + - Not widely used. 2. RFC 4122 compatible - `0b10xx` - UUIDs based on RFC 4122 (the standard specification for UUIDs). - - The most commonly used format for UUIDs. Includes formats like v1 (time-based) and v4 (random). + - The most common UUID format used, including versions like v1 (time-based) and v4 (random). 3. Microsoft GUID compatible - `0b110x` - - The format of GUID (Globally Unique Identifier) used by Microsoft. + - The format of GUIDs (Globally Unique Identifier) used by Microsoft. 4. Reserved for future use - `0b111x` -This property also represents NIL UUID and MAX UUID in addition to the above variants. +This property represents the above variants as well as NIL UUID and MAX UUID. ```ts .variant: @@ -74,7 +74,7 @@ This property also represents NIL UUID and MAX UUID in addition to the above var ### `.version` -The UUID version number if the variant is `"RFC"`. Otherwise, it's `null`. +The UUID version number if the variant is `"RFC"`, otherwise `null`. ```ts .version: 1 | 2 | 3 | 4 | 5 | 6 | 7 | null; @@ -82,7 +82,7 @@ The UUID version number if the variant is `"RFC"`. Otherwise, it's `null`. ### `.timestamp` -The timestamp portion of the UUID if the variant is `"RFC"` and the version is either v1, v6, or v7. Otherwise, it's `null`. For convenience, all timestamps are calculated as milliseconds since the UNIX epoch. +The timestamp portion of the UUID if the variant is `"RFC"` and the version is either v1, v6, or v7, otherwise `null`. For convenience, timestamps are all calculated to milliseconds since the Unix epoch. ```ts .timestamp: number | null; @@ -90,7 +90,7 @@ The timestamp portion of the UUID if the variant is `"RFC"` and the version is e ### `.toString()` -Converts the `Uuid` object to a string that can be used as a variable in SurrealQL. +Converts the `Uuid` object into a string usable as a SurrealQL variable. `.valueOf()` and `.toJSON()` return the same result as this method. @@ -102,14 +102,14 @@ Converts the `Uuid` object to a string that can be used as a variable in Surreal None. -#### Return Value +#### Returns -Returns the UUID string in hexadecimal format. +Returns the hexadecimal UUID string. #### Example ```ts -import { Uuid } from "@tai-kun/surrealdb/data-types/encodable"; +import { Uuid } from "@tai-kun/surrealdb/encodable-datatypes"; const bytes = new Uint8Array([ 0x26, 0xc8, 0x01, 0x63, @@ -125,7 +125,7 @@ console.log(uuid.toString()); ### `.toSurql()` -Converts the `Uuid` object to a string that can be embedded in SurrealQL. Similar to `.toString()` but adds a `u` prefix to tell the query parser that the string is a UUID. +Converts the `Uuid` object into a string embeddable in SurrealQL. Similar to `.toString()` but adds a `u` prefix to signal to the query parser that the string is a UUID. ```ts .toSurql(): string; @@ -135,14 +135,14 @@ Converts the `Uuid` object to a string that can be embedded in SurrealQL. Simila None. -#### Return Value +#### Returns -Returns the UUID string in hexadecimal format with a `u` prefix. +Returns the hexadecimal UUID string with the `u` prefix. #### Example ```ts -import { Uuid } from "@tai-kun/surrealdb/data-types/encodable"; +import { Uuid } from "@tai-kun/surrealdb/encodable-datatypes"; const bytes = new Uint8Array([ 0x26, 0xc8, 0x01, 0x63, @@ -168,13 +168,13 @@ Clones the `Uuid` object. None. -#### Return Value +#### Returns -Returns a new `Uuid` object. If `Uuid` is extended, an instance of that class is returned. +Returns a new `Uuid` object. If the `Uuid` class is extended, an instance of that class is returned. ### `.compareTo()` -Compares the timestamp of the `Uuid` object. +Compares the timestamps of `Uuid` objects. ```ts .compareTo(other: Uuid): -1 | 0 | 1; @@ -184,18 +184,18 @@ Compares the timestamp of the `Uuid` object. ##### `other` -The UUID to compare to. +The UUID to compare against. -#### Return Value +#### Returns -Returns `0` if either one of the timestamps is missing or if the timestamps are the same. Returns `-1` if the timestamp of the compared UUID is later in time and `1` if it's earlier. +Returns `0` if either one has no timestamp portion or if the timestamps are the same. Returns `-1` if the timestamp of the compared UUID is later, and `1` if it's earlier. #### Example -The following example compares the timestamps of different UUID versions to sort them in ascending order: +This example compares the timestamps of different UUID versions and sorts them in ascending order: ```ts -import { Uuid } from "@tai-kun/surrealdb/data-types/standard"; +import { Uuid } from "@tai-kun/surrealdb/standard-datatypes"; const uuidv1 = new Uuid("0e004000-2073-11ef-8451-eb2a011f8691"); const uuidv6 = new Uuid("1ef1fa9e-3968-6000-a77e-683eb1a35ebe"); @@ -219,11 +219,11 @@ console.log(uuidList); //-> ] ``` -### Further Development +### Advanced -#### General Purpose `Uuid` Object Check +#### Universal `Uuid` Object Verification -It is recommended to use the `isUuid` function to check if a value is a `Uuid` object without relying on any specific preset. This function does not use `instanceof`, so it is helpful when the preset of the value to be verified is unknown. +To determine if a value is a `Uuid` object without relying on presets, it's recommended to use the `isUuid` function. This function does not use `instanceof`, making it helpful when the preset of the value being checked is unknown. ```ts import { isUuid } from "@tai-kun/surrealdb"; diff --git a/docs/cache/ja2en/content/v2/getting-started.mdx b/docs/cache/ja2en/content/v2/getting-started.mdx index 1199f0ee..6e26f1cf 100644 --- a/docs/cache/ja2en/content/v2/getting-started.mdx +++ b/docs/cache/ja2en/content/v2/getting-started.mdx @@ -52,9 +52,9 @@ try { ```ts import { initSurreal } from "@tai-kun/surrealdb"; -import Client from "@tai-kun/surrealdb/clients/standard"; -import HttpEngine from "@tai-kun/surrealdb/engines/http"; -import JsonFormatter from "@tai-kun/surrealdb/formatters/json"; +import Client from "@tai-kun/surrealdb/standard-client"; +import HttpEngine from "@tai-kun/surrealdb/http-engine"; +import JsonFormatter from "@tai-kun/surrealdb/json-formatter"; const { Surreal } = initSurreal({ Client: Client, diff --git a/docs/cache/ja2en/content/v2/guides/errors.mdx b/docs/cache/ja2en/content/v2/guides/errors.mdx index 8fc342b0..11e2cbd4 100644 --- a/docs/cache/ja2en/content/v2/guides/errors.mdx +++ b/docs/cache/ja2en/content/v2/guides/errors.mdx @@ -5,99 +5,99 @@ slug: en/v2/guides/errors ## Introduction -Some error objects may have a `.cause` property. In most cases, this is of type `unknown`, and its value is subject to change without notice. +Some error objects may have a `.cause` property. In most cases, this is of type `unknown` and the value may change without notice. ## General ### SurrealError -`SurrealError` is the base class that most error objects thrown explicitly by this SDK inherit from. This class inherits from JavaScript's `Error` class. This error object is rarely thrown on its own. Instead, inherited error objects with specific meanings are typically thrown. It is recommended to use this error object as a way to easily categorize errors caught in `try-catch` blocks as errors explicitly thrown by this SDK. +`SurrealError` is the base class inherited by most of the error objects that this SDK throws explicitly. This class inherits from JavaScript's `Error` class. This error object is rarely thrown alone, and it is basically thrown by special error objects with inherited meaning. This is recommended for easy classification of errors caught in `try-catch` syntax, etc., to see if the error was thrown explicitly by this SDK. #### Properties `.name: "SurrealError"` -: The name of the error. +: Error name. `.message` -: The error message. +: Error message. `.stack` -: A stack trace may be recorded. +: Stack trace may be recorded. `.cause` : The cause or context of the error may be set. ### SurrealTypeError -Inherits from: `SurrealError` +Inherited from: `SurrealError` -This error is thrown when there is a failure in input value or other validations. +This error is thrown when input values or other validations fail. #### Properties `.name: "SurrealTypeError"` -: The name of the error. +: Error name. `.expected` -: The expected data format. +: Expected data format. `.actual` -: The string representation of the actual value. +: String representation of the actual value. #### Solution -Trace the stack to find the source of the unexpected data format. +Follow the stack trace to find the source of the unexpected data format. ### SurrealValueError -Inherits from: `SurrealError` +Inherited from: `SurrealError` -This error is thrown when there is a failure in input value or other validations. +This error is thrown when input values or other validations fail. #### Properties `.name: "SurrealValueError"` -: The name of the error. +: Error name. `.expected` -: The expected data format. +: Expected data format. `.actual` -: The actual value. +: Actual value. #### Solution -Trace the stack to find the source of the unexpected data format. +Follow the stack trace to find the source of the unexpected data format. ### SurrealAggregateError -Inherits from: `SurrealError` +Inherited from: `SurrealError` -This error represents an aggregation of multiple errors or error messages. +This is an error that combines multiple errors or error messages. #### Properties `.name: "SurrealAggregateError"` -: The name of the error. +: Error name. `.cause: unknown[]` -: Each element of the array contains errors, error messages, or other relevant information. +: Each element of the array contains an error or error message. ### CircularReferenceError -Inherits from: `SurrealError` +Inherited from: `SurrealError` -This error is thrown when a circular reference is detected, primarily during the process of converting JavaScript values into another format. This typically occurs when a parent object is found to contain the same object within itself. +This error is thrown when a circular reference is detected. This is mainly thrown when converting a JavaScript value to another format, such as when the same object is detected as the parent object. #### Properties `.name: "CircularReferenceError"` -: The name of the error. +: Error name. `.reference: unknown` : The value where the circular reference occurred. -For example, this error is thrown in cases like: +For example, this error is thrown in cases like this: ```ts import { toSurql } from "@tai-kun/surrealdb/utils"; @@ -112,57 +112,57 @@ toSurql(a); // throws CircularReferenceError #### Solution -This error can occur beyond the `toSurql` function. It is a general error that requires careful debugging to identify and resolve circular references within objects. +This error is a common error that can be thrown other than the `toSurql` function. You need to carefully debug whether the object contains the object itself. ### NumberRangeError -Inherits from: `SurrealError` +Inherited from: `SurrealError` -This error is thrown when a number falls outside the expected range. +This error is thrown when a number is out of range. #### Properties `.name: "NumberRangeError"` -: The name of the error. +: Error name. `.range` -: The expected range. +: Expected range. `.actual` -: The actual value. +: Actual value. `.integer` -: If `true`, an integer is expected. +: If `true`, expects an integer. #### Solution -Trace the stack to find the source of the unexpected data format. +Follow the stack trace to find the source of the unexpected data format. ### UnsupportedRuntimeError -Inherits from: `SurrealError` +Inherited from: `SurrealError` -This error is thrown when an unsupported runtime is detected. +This error is thrown when it is determined that an unsupported runtime is being used. #### Properties `.name: "UnsupportedRuntimeError"` -: The name of the error. +: Error name. #### Solution -Either avoid using that runtime or use a polyfill and thoroughly test. +Either don't use that runtime or polyfill and test thoroughly. ### UnreachableError -Inherits from: `SurrealError` +Inherited from: `SurrealError` -This error is thrown when unreachable code is reached. It is likely that you have encountered a bug in this SDK if you encounter this error. +This error is thrown when unreachable code is reached. If this error is thrown, you have probably encountered a bug in this SDK. #### Properties `.name: "UnreachableError"` -: The name of the error. +: Error name. #### Solution @@ -174,22 +174,22 @@ You can raise this issue at the following URL: ### CircularEngineReferenceError -Inherits from: `CircularReferenceError` +Inherited from: `CircularReferenceError` -This error is thrown when a circular reference is detected among engines during database connection. +This error is thrown when a circular reference occurs between engines when connecting to the database. #### Properties `.name: "CircularEngineReferenceError"` -: The name of the error. +: Error name. `.reference: string` -: The scheme name where the circular reference occurred. +: Scheme name where circular reference occurred. `.seen: string[]` -: List of scheme names traversed before the circular reference was detected. +: List of scheme names that were traversed before the circular reference occurred. -For example, this error is thrown in cases like: +For example, this error is thrown in cases like this: ```ts import { initSurreal } from "@tai-kun/surrealdb"; @@ -206,15 +206,15 @@ await using db = new Surreal(); await db.connect("https://localhost:8000"); // throws CircularEngineReferenceError: Circular engine reference: http,https ``` -In the above example, the https protocol engine tries to use the engine configured for the http protocol, but the http protocol engine attempts to use the engine configured for the https protocol, leading to a circular reference. +In the example above, the https protocol engine is set to use the engine set to http, but the http protocol engine tries to use the engine set to https, so a circular reference error is thrown. #### Solution -Instead of assigning a string that is a protocol name to a value that is another protocol name, replace it with a specific implementation that creates an engine: +Instead of setting the protocol name specified by the string to the value of another protocol name, replace it with the specific implementation that creates the engine: ```ts del={6} ins={7-10} import { initSurreal } from "@tai-kun/surrealdb"; -import HttpEngine from "@tai-kun/surrealdb/engines/http"; +import HttpEngine from "@tai-kun/surrealdb/http-engine"; const { Surreal } = initSurreal({ engines: { @@ -231,19 +231,19 @@ const { Surreal } = initSurreal({ ### EngineNotFoundError -Inherits from: `SurrealError` +Inherited from: `SurrealError` -This error is thrown when an attempt is made to connect with a protocol for which no engine is configured. +This error is thrown when you try to connect with a protocol for which no engine is configured. #### Properties `.name: "EngineNotFoundError"` -: The name of the error. +: Error name. `.scheme: string` -: The protocol name of the target endpoint. +: The name of the protocol to connect to. -For example, this error is thrown in cases like: +For example, this error is thrown in cases like this: ```ts import { initSurreal } from "@tai-kun/surrealdb"; @@ -261,7 +261,7 @@ await db.connect("https://localhost:8000"); // throws EngineNotFoundError: No ht #### Solution -Check if the protocol of the target endpoint has an engine configured in the `engines` property. +Check the `engines` property to see if an engine can be created for the protocol of the connecting endpoint. ```ts ins={6} import { initSurreal } from "@tai-kun/surrealdb"; @@ -277,17 +277,17 @@ const { Surreal } = initSurreal({ ### ConnectionConflictError -Inherits from: `SurrealError` +Inherited from: `SurrealError` This error is thrown when the client attempts to connect to multiple endpoints simultaneously. #### Properties `.name: "ConnectionConflictError"` -: The name of the error. +: Error name. `.endpoint1: string` -: The endpoint that is already connected. +: Already connected endpoint. `.endpoint2: string` : The other endpoint. @@ -301,7 +301,7 @@ await db.connect("ws://localhost:8000"); await db.connect("ws://localhost:1129"); // throws ConnectionConflictError: An attempt was made to connect to ws://localhost:1129/rpc while ws://localhost:8000/rpc was already connected. ``` -The `.connect` method appends `/rpc` to the end of the provided URL path if it does not end with it. Therefore, it is possible for an error not to occur, contrary to appearances, if the URL path of one of the endpoints ends with `/rpc`: +`.connect` method adds `/rpc` to the end of the URL passed, so the error may not occur, contrary to appearances, if the URL path of one of the endpoints ends in `/rpc`: ```ts import { Surreal } from "@tai-kun/surrealdb"; @@ -337,19 +337,19 @@ await db.connect("http://localhost:11298"); ### MissingNamespaceError -Inherits from: `SurrealError` +Inherited from: `SurrealError` -This error is thrown when a namespace is not selected before selecting a database, or when attempting to leave the namespace unselected while a database is selected. +This error is thrown when no namespace is selected before selecting a database. Or, it is thrown even if you try to leave the namespace unselected after selecting the database. #### Properties `.name: "MissingNamespaceError"` -: The name of the error. +: Error name. `.database: string` -: The database name. +: Database name. -For example, this error is thrown in cases like: +For example, this error is thrown in cases like this: ```ts import { Surreal } from "@tai-kun/surrealdb"; @@ -364,7 +364,7 @@ await db.use({ #### Solution -Select the namespace as well when selecting the database. +When selecting a database, make sure to also select a namespace. ```ts ins={7} import { Surreal } from "@tai-kun/surrealdb"; @@ -380,40 +380,40 @@ await db.use({ ### RpcResponseError -Inherits from: `SurrealError` +Inherited from: `SurrealError` -This error is thrown when the RPC response indicates an error. This means that there are no issues with the communication or the decoding of the response body based on the protocol used to connect, but SurrealDB cannot process the RPC request. +This error is thrown when the RPC response indicates an error. There are no problems with communication or response body decoding due to the connected protocol, but it means that SurrealDB cannot process the RPC request. #### Properties `.name: "RpcResponseError"` -: The name of the error. +: Error name. `.id?: string` -: The ID that identifies the RPC request. The ID always starts with `_`. +: The ID that identifies the RPC request. The ID always starts with ``. `.code: number` -: This is likely the JSON-RPC error code, though it is not explicitly documented in the SurrealDB documentation. +: It is not explicitly stated in the SurrealDB documentation, but it is probably the JSON-RPC error code. #### Solution -The cause of this error can vary. One possible reason is that the version of SurrealDB supported by this SDK differs from the version of SurrealDB that processes the RPC request. +There are many possible causes, but the version of SurrelDB that this SDK supports may be different from the version of SurrealDB that processes the RPC request. ### QueryFailedError -Inherits from: `SurrealAggregateError` +Inherited from: `SurrealAggregateError` -This error is thrown when a query fails. +This error is thrown when the query fails. #### Properties `.name: "QueryFailedError"` -: The name of the error. +: Error name. `.cause: string[]` -: A list of errors. +: List of errors. -For example, this error is thrown in cases like: +For example, this error is thrown in cases like this: ```ts await using db = new Surreal(); @@ -424,20 +424,20 @@ await db.query("OUTPUT 'Hello'"); // throws QueryFailedError: Query failed with #### Solution -Check the correctness of the SurrelQL syntax. +Check if the SurrelQL syntax is correct. ### Closed -Inherits from: `SurrealError` +Inherited from: `SurrealError` This error indicates that the connection has been forcibly terminated. #### Properties `.name: "Closed"` -: The name of the error. +: Error name. -For example, you will get this error in the following case: +For example, you get this error in cases like this: ```ts const db = new Surreal(); @@ -460,92 +460,92 @@ await db.close({ force: true }); ### EngineError -Inherits from: `SurrealError` +Inherited from: `SurrealError` -This indicates that an error originated from the engine. It is emitted through event listeners. +This indicates that the error is due to the engine. It is sent via event listener. #### Properties `.name: "EngineError"` -: The name of the error. +: Error name. `.fatal: boolean | undefined` : Indicates whether this error is fatal. ### HttpEngineError -Inherits from: `EngineError` +Inherited from: `EngineError` -This indicates that an error originated from the HTTP engine. Currently, this is only defined and not used. +This indicates that the error is due to the HTTP engine. It is currently defined but not used. #### Properties `.name: "HttpEngineError"` -: The name of the error. +: Error name. ### WebSocketEngineError -Inherits from: `EngineError` +Inherited from: `EngineError` -This indicates that an error originated from the WebSocket engine. This is used when there is an issue with parsing the response body before identifying the RPC request ID, when receiving an error event from the WebSocket object, or when the WebSocket connection is closed. +This indicates that the error is due to the WebSocket engine. It is used when the response body fails to parse before finding the RPC request identifier, when an error event is received from the WebSocket object, when the WebSocket connection is disconnected, etc. -This SDK uses `315x` as custom status codes. This range is unassigned for status codes in [IANA](https://www.iana.org/assignments/websocket/websocket.xml#close-code-number). +This SDK uses `315x` for custom status codes. This range is unassigned in [IANA](https://www.iana.org/assignments/websocket/websocket.xml#close-code-number). #### Properties `.name: "WebSocketEngineError"` -: The name of the error. +: Error name. `.code: number` : One of the following status codes: - `1000`~`1015`: [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/code) - - `3150`: Indicates an "error" event was received from the `WebSocket`[^1] instance. - - `3151`: Indicates an error occurred within the "open" event handler registered by the WebSocket engine. This is most likely a `StateTransitionError` during the transition from the connecting state to the connected state. - - `3152`: Indicates an error occurred within the "message" event handler registered by the WebSocket engine. While there can be various causes, it is likely that a `ServerResponseError` or `RpcResponseError` was thrown inside the event handler. This could be caused by requesting with invalid RPC parameters. In this case, the method calling the RPC (by default) times out after 5 seconds and fails. In versions of SurrealDB prior to v2.0.2, timeouts could occur for more broad reasons. - - `3153`: Indicates a failure in sending or receiving a ping. While this could be a temporary error, if it continues, it could mean that the connection is not being maintained. - - `3154`: Indicates an error occurred within the "close" event handler registered by the WebSocket engine. This is most likely a `StateTransitionError` during the transition from the closing state to the closed state. -: Note that the following status codes are excluded from the above. They are not treated as errors in this SDK. - - `1000`: Indicates a normal closure. - - `1001`: Early closure is common. + - `3150`: Indicates that the "error" event was received from the `WebSocket`[^1] instance. + - `3151`: Indicates that an error occurred in the "open" event handler registered by the WebSocket engine. In most cases, a `StateTransitionError` occurs during the transition from the connecting state to the connected state. + - `3152`: Indicates that an error occurred in the "message" event handler registered by the WebSocket engine. There are many possible causes, but it is likely that a `ServerResponseError` or `RpcResponseError` was thrown in the event handler. It is likely that the request was made with invalid RPC parameters. In this case, the calling method of the RPC (by default) times out after 5 seconds and fails. In versions prior to SurrealDB v2.0.2, it may timeout due to a wider range of causes. + - `3153`: Indicates that the ping failed to be sent or received. This could be a temporary error, but if you keep receiving it, you may not be able to maintain the connection. + - `3154`: Indicates that an error occurred in the "close" event handler registered by the WebSocket engine. In most cases, a `StateTransitionError` occurs during the transition from the disconnecting state to the disconnected state. +: Note that the following status codes are excluded from the above. This SDK does not treat them as errors. + - `1000`: The connection has been closed normally. + - `1001`: Early disconnections are common. - `1004`: Reserved. - `1005`: Reserved. - `1006`: Reserved. - `1015`: Reserved. -^1: `WebSocket` can be a class defined as a global variable by the runtime or a class from `ws`. +^1: `WebSocket` is either a class defined in the global variable by the runtime or a class of `ws`. #### Solution `1002`,`1003`,`1007`...`1011`,`1014`,`3150`,`3151`,`3154` -: There is likely no automatic way to recover from these status codes. You need to modify the runtime, SurrealDB settings, or hard-coded implementations. +: There is probably no automatic way to recover from this status code. You need to fix the runtime, SurrealDB settings, or hardcoded implementation. `3152` -: Verify the arguments passed to the method (i.e., the content of the RPC request). +: Check if the arguments passed to the method (i.e., the content of the RPC request) are correct. `1012`,`1013`,`3153` : You may be able to automatically recover using the experimental feature [`autoReconnect()`](/v2/experimental/auto-reconnect). ### StateTransitionError -Inherits from: `SurrealAggregateError` +Inherited from: `SurrealAggregateError` -This error is thrown when the execution of the event listener fails during a state transition. +This error is thrown when the event listener fails to execute during the state transition. #### Properties `.name: "StateTransitionError"` -: The name of the error. +: Error name. `.from: string` -: The state at the start of the transition. +: The state at the start of the state transition. `.to: string` -: The target state of the transition. +: The state to which the transition is intended. `.fallback: string` -: The alternative target state in case the state transition fails. If the value is the same as `.to`, it means that the transition was forced. +: Alternative transition destination if the state transition fails. If it is the same value as `.to`, it means that the transition was forced. -For example, this error is thrown in cases like: +For example, this error is thrown in cases like this: ```ts import { Surreal } from "@tai-kun/surrealdb"; @@ -571,127 +571,127 @@ await db.connect("http://localhost:8000"); // throws ... ### ConnectionUnavailableError -Inherits from: `SurrealError` +Inherited from: `SurrealError` -This error is thrown when an attempt is made to send an RPC request while not connected. +This error is thrown when you try to send an RPC request in an unconnected state. #### Properties `.name: "ConnectionUnavailableError"` -: The name of the error. +: Error name. ### ServerResponseError -Inherits from: `SurrealError` +Inherited from: `SurrealError` This error is thrown when the response cannot be parsed as a PRC response. This is different from `RpcResponseError`. #### Properties `.name: "ServerResponseError"` -: The name of the error. +: Error name. #### Solution -Typically, this error should not be thrown. If it is thrown, the version of SurrealDB supported by this SDK may differ from the version of SurrealDB processing the RPC request. +This error should never be thrown normally, but if it is thrown, the version of SurrelDB that this SDK supports may be different from the version of SurrealDB that processes the RPC request. ## CBOR ### CborError -Inherits from: `SurrealError` +Inherited from: `SurrealError` -This is the class that all errors related to CBOR explicitly thrown by `@tai-kun/surrealdb/cbor` inherit from. It is never thrown directly. +This is the class inherited by all errors related to CBOR that are thrown explicitly by `@tai-kun/surrealdb/cbor`. This is never thrown directly. #### Properties `.name: "CborError"` -: The name of the error. +: Error name. ### CborWellFormednessError -Inherits from: `CborError` +Inherited from: `CborError` #### Properties -This is the class that all errors related to CBOR decoding explicitly thrown by `@tai-kun/surrealdb/cbor` inherit from. It is never thrown directly. +This is the class inherited by all errors related to CBOR decoding that are thrown explicitly by `@tai-kun/surrealdb/cbor`. This is never thrown directly. -Refer to the "Well-Formedness Errors and Examples" in Appendix F of RFC8949 ([https://datatracker.ietf.org/doc/html/rfc8949#name-well-formedness-errors-and-](https://datatracker.ietf.org/doc/html/rfc8949#name-well-formedness-errors-and-)). +Refer to "Well-Formedness Errors and Examples" in Appendix F of RFC8949 [https://datatracker.ietf.org/doc/html/rfc8949#name-well-formedness-errors-and-](https://datatracker.ietf.org/doc/html/rfc8949#name-well-formedness-errors-and-). `.name: "CborWellFormednessError"` -: The name of the error. +: Error name. ### CborTooMuchDataError -Inherits from: `CborWellFormednessError` +Inherited from: `CborWellFormednessError` -This indicates that there are remaining input bytes that were not consumed. +Indicates that there are input bytes remaining that were not consumed. [RFC8949](https://datatracker.ietf.org/doc/html/rfc8949#section-appendix.f-2.2) #### Properties `.name: "CborTooMuchDataError"` -: The name of the error. +: Error name. #### Solution -Verify that the byte array being decoded is in the correct CBOR format. +Check if the byte array to be decoded is in the correct CBOR format. ### CborTooLittleDataError -Inherits from: `CborWellFormednessError` +Inherited from: `CborWellFormednessError` -This indicates that the input bytes are incomplete. +Indicates that the input bytes are incomplete. [RFC8949](https://datatracker.ietf.org/doc/html/rfc8949#section-appendix.f-2.4) #### Properties `.name: "CborTooLittleDataError"` -: The name of the error. +: Error name. #### Solution -Verify that the byte array being decoded is in the correct CBOR format. +Check if the byte array to be decoded is in the correct CBOR format. ### CborSyntaxError -Inherits from: `CborWellFormednessError` +Inherited from: `CborWellFormednessError` -This indicates that the input bytes do not match the CBOR encoding format. +Indicates that the input bytes do not match the CBOR encoding format. [RFC8949](https://datatracker.ietf.org/doc/html/rfc8949#section-appendix.f-2.6) #### Properties `.name: "CborSyntaxError"` -: The name of the error. +: Error name. #### Solution -Verify that the byte array being decoded is in the correct CBOR format. +Check if the byte array to be decoded is in the correct CBOR format. ### CborMaxDepthReachedError -Inherits from: `CborError` +Inherited from: `CborError` -This error is thrown when the maximum depth of the JavaScript object is reached during CBOR encoding or decoding. The depth increases by 1 for each object or array entered. +This error is thrown when the depth of the JavaScript object reaches the maximum value during CBOR encoding or decoding. The depth increases by 1 every time you enter an object or array. #### Properties `.name: "CborMaxDepthReachedError"` -: The name of the error. +: Error name. `.maxDepth: number` -: The maximum depth. +: Maximum depth. #### Solution -Either loosen the upper limit of the optional `.maxDepth` or restructure the data so that the nesting of objects is shallower. +Relax the upper limit of the optional `.maxDepth` option or revise the data structure so that the object nesting is shallow. ```ts -import CborFormatter from "@tai-kun/surrealdb/formatters/cbor"; +import CborFormatter from "@tai-kun/surrealdb/cbor-formatter"; const cborFormatter = new CborFormatter({ encode: { @@ -706,41 +706,41 @@ const cborFormatter = new CborFormatter({ ### CborUnsafeMapKeyError -Inherits from: `CborError` +Inherited from: `CborError` This error is thrown when an unsafe map key is found during CBOR encoding or decoding. #### Properties `.name: "CborUnsafeMapKeyError"` -: The name of the error. +: Error name. `.key: unknown` -: The map key that is deemed unsafe. +: The map key that was determined to be unsafe. ## JSON ### JsonError -Inherits from: `SurrealError` +Inherited from: `SurrealError` -This is the class that all errors related to JSON explicitly thrown by `@tai-kun/surrealdb/formatters/json` inherit from. It is never thrown directly. +This is the JSON-formatter that is thrown explicitly by `@tai-kun/surrealdb/json`. #### Properties `.name: "JsonError"` -: The name of the error. +: Error name. ### JsonUnsafeMapKeyError -Inherits from: `JsonError` +Inherited from: `JsonError` This error is thrown when an unsafe map key is found during JSON decoding. #### Properties `.name: "JsonUnsafeMapKeyError"` -: The name of the error. +: Error name. `.key: unknown` -: The map key that is deemed unsafe. +: The map key that was determined to be unsafe. diff --git a/docs/cache/ja2en/content/v2/supports.mdx b/docs/cache/ja2en/content/v2/supports.mdx index 56c2e144..2eb64801 100644 --- a/docs/cache/ja2en/content/v2/supports.mdx +++ b/docs/cache/ja2en/content/v2/supports.mdx @@ -7,7 +7,7 @@ import { Aside } from "@astrojs/starlight/components" ## JavaScript -This SDK uses `bigint`, so it requires ES2020 or later as the JavaScript language specification. In addition, considering the features this SDK requires at runtime, it is expected to work on the following runtimes: +This SDK uses `bigint`, so it requires ES2020 or later as the JavaScript language specification. In addition, considering the features required by this SDK at runtime, it is expected to run on the following runtimes: | Runtime | Version | | --- | --- | @@ -21,18 +21,18 @@ This SDK uses `bigint`, so it requires ES2020 or later as the JavaScript languag ## Testing -Testing uses Vitest and Playwright. We are testing on the minimum version of runtime that these work, so it may actually work on runtimes older than those listed below. +Vitest and Playwright are used for testing. We test on the minimum version of the runtime where these are functional, so it may actually work on older runtimes than those shown below. ### Server | Runtime | Version | Status | | --- | --- | --- | | SurrealDB | `^2.0.0` | [GitHub](https://github.com/surrealdb/surrealdb) | -| Node.js | `18.x`,
`20.x`,
`^22.5.1` | [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/tai-kun/surrealdb.js/nodejs.yml?branch=main&logo=Node.js&label=Node.js)](https://github.com/tai-kun/surrealdb.js/actions/workflows/nodejs.yml) | +| Node.js | `18.x`,
`20.x`,
`^22.5.1`,
`23.x` | [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/tai-kun/surrealdb.js/nodejs.yml?branch=main&logo=Node.js&label=Node.js)](https://github.com/tai-kun/surrealdb.js/actions/workflows/nodejs.yml) | | Deno | `1.x`, `2.x` | [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/tai-kun/surrealdb.js/deno.yml?branch=main&logo=Deno&label=Deno)](https://github.com/tai-kun/surrealdb.js/actions/workflows/deno.yml) | | Bun | `^1.1.13` | [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/tai-kun/surrealdb.js/bun.yml?branch=main&logo=Bun&label=Bun)](https://github.com/tai-kun/surrealdb.js/actions/workflows/bun.yml) | -- Note that Node.js v22 is not yet LTS. +- Please note that Node.js v22 is not yet LTS. - We recommend using the latest version of Deno at all times. - We recommend using the latest version of Bun at all times. @@ -44,4 +44,4 @@ Testing uses Vitest and Playwright. We are testing on the minimum version of run | Firefox | `>=100` | [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/tai-kun/surrealdb.js/firefox.yml?branch=main&logo=Firefox&label=Firefox)](https://github.com/tai-kun/surrealdb.js/actions/workflows/firefox.yml) | | WebKit | `>=15.4` | [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/tai-kun/surrealdb.js/webkit.yml?branch=main&style=flat&logo=safari&label=WebKit)](https://github.com/tai-kun/surrealdb.js/actions/workflows/webkit.yml) | -- The supported browsers (engines) correspond to the minimum versions where Playwright works on CI. Therefore, it may work on versions lower than those listed above, but it is not tested. +- The browser (engine) we support matches the minimum version where Playwright works on CI. Therefore, it may work on versions below the above, but we do not test it. diff --git a/docs/cache/ja2en/meta.json b/docs/cache/ja2en/meta.json index 016f2284..8eb2d191 100644 --- a/docs/cache/ja2en/meta.json +++ b/docs/cache/ja2en/meta.json @@ -34,23 +34,23 @@ "src/content/docs/ja/v2/api/cbor/others.mdx": "b145d4dec91d19c1ba3f079439c6ae24f00d9f39df6c42f792fa26c759fbd151", "src/content/docs/ja/v2/api/cbor/simple.mdx": "049e4b39b3c8058d2ea6beb4cf02ad1354cbbb769614a0af9c826fbe6a9c4c61", "src/content/docs/ja/v2/api/cbor/tagged.mdx": "eaaccc73d7eede688d61a8df1bcce558520862902587e3b42a453e414b910f79", - "src/content/docs/ja/v2/api/data/bound-excluded.mdx": "535cee4e8e9c7b717e6c91793fd5b0c8e046e6d00b48d54e4155e73c8162251f", - "src/content/docs/ja/v2/api/data/bound-included.mdx": "7e0ed8b43323f0b1c598be745a0b007460e9a67893dc82df1888418dd0ebf26f", - "src/content/docs/ja/v2/api/data/datetime.mdx": "66c73131a99bf3730b4bb2e69972f0b8e34fd5d13db4db28e1a3c479cabf0b5b", - "src/content/docs/ja/v2/api/data/decimal.mdx": "305509f5ffdf5a138e118e8ac2bec8ed538346df2cd397743aacc226edd50fbb", - "src/content/docs/ja/v2/api/data/duration.mdx": "09d6f603708d7268137a018af36998e204b4e1b8939638602f1e712b4558a716", - "src/content/docs/ja/v2/api/data/future.mdx": "be260b3684e743d2e14441a49c9173c1a3eb5590a3959301854813ba45392f2c", - "src/content/docs/ja/v2/api/data/geometry-collection.mdx": "178d0402d33935e207792f3c7442ec7aed928100f55f5627672fbd136e7cd8a3", - "src/content/docs/ja/v2/api/data/geometry-line.mdx": "b6acb8a1b5fc40415bf351445fefd92db6bbad5c471f9f9b561920ca0174d9ef", - "src/content/docs/ja/v2/api/data/geometry-multi-line.mdx": "2fc6fc4df7d6fac208cf0e4d9602e9162202f33266028502fe51b61ca209cb40", - "src/content/docs/ja/v2/api/data/geometry-multi-point.mdx": "ade5c8cedde13cd8f3d6820fc06e29a7075f3ea74a8d97e3353c9a9adc4c2e0b", - "src/content/docs/ja/v2/api/data/geometry-multi-polygon.mdx": "f758b5d58aaef14de7015b09c569a5399b88a30bf891798c5ca85a6f3c416e2b", - "src/content/docs/ja/v2/api/data/geometry-point.mdx": "2b8ff579cd126d47ea463296767bc5b8cfb0d332bdc957f63a31b07ba54bf994", - "src/content/docs/ja/v2/api/data/geometry-polygon.mdx": "7fb7006ac2f9aaf13e83120307066db07b3775d8bce92a35ecb5d54618eb2dd4", - "src/content/docs/ja/v2/api/data/range.mdx": "7b04bf21730cf383680175086e77eb7dfaa7ffeb3dbad536e400e4aaf12dac40", - "src/content/docs/ja/v2/api/data/table.mdx": "63c1a17261ae912a3afb674f423c2b4f1cfecbc186f1e8b533427cd63dcd03d6", - "src/content/docs/ja/v2/api/data/thing.mdx": "ea726d56de0c2a77243139a82470bb478111315d9242557bed7d6693d36b4957", - "src/content/docs/ja/v2/api/data/uuid.mdx": "20c413705ca46443d160e9c862d89ec55c130fe5c3ffcc83d1e8a850b4bf2010", + "src/content/docs/ja/v2/api/data/bound-excluded.mdx": "4ca974c26583a19e18874b9e191436a954ff134c23b3aa33423f0844d5c70ec3", + "src/content/docs/ja/v2/api/data/bound-included.mdx": "d3f57a189634088ef6a1bfee925cc3780e64e5fa5c8d83d5666e7fcb3e7a8890", + "src/content/docs/ja/v2/api/data/datetime.mdx": "42b526d7a4b5861e78a29344fda693ed82f6a28e71e6e54924040035ac2178a9", + "src/content/docs/ja/v2/api/data/decimal.mdx": "5144af18ec3653860276629d66292954829c861aac6413a957f1e7bc26f16965", + "src/content/docs/ja/v2/api/data/duration.mdx": "1d41cea1aa0970ce9038db8caa17a681cc52c7992906c57d6ba469dbf2a9ac03", + "src/content/docs/ja/v2/api/data/future.mdx": "9b38aaae94064918d4095639fd0b520579045b43db2b7698b93b302ac565c01c", + "src/content/docs/ja/v2/api/data/geometry-collection.mdx": "2a030e60dac28ff7db1cf45c397d00f6895f2735ce1e9f9d8190de723cc06e14", + "src/content/docs/ja/v2/api/data/geometry-line.mdx": "25a97999d42ca7d9a7c57e1c62453886205f2c045c461f1ce73b0a77c8fcf56e", + "src/content/docs/ja/v2/api/data/geometry-multi-line.mdx": "1f9e43eea7ae478d66e83b83cb81c6c7beb6ce418f96f5321f852a703639d5bb", + "src/content/docs/ja/v2/api/data/geometry-multi-point.mdx": "38b69ae433d86367d40d3781f49ef6ad6c6ef040a837735825b03dc4a46b04c4", + "src/content/docs/ja/v2/api/data/geometry-multi-polygon.mdx": "e332a5723638d29f04234755b8fde0c3c9bfe2be4fb950e867154c62f8348f5e", + "src/content/docs/ja/v2/api/data/geometry-point.mdx": "b8b33e46ed3785d4f88825d460218a869c6093493ce810c5af12d7caa392f190", + "src/content/docs/ja/v2/api/data/geometry-polygon.mdx": "bf3186571209421aa35af05b4d98d9c4f42128143d038d69b64c177cd17275d1", + "src/content/docs/ja/v2/api/data/range.mdx": "d9a6c951acfa5bc2681ba0e64eed6d2c92ea90f3b8dbd3537ec34ecacf907944", + "src/content/docs/ja/v2/api/data/table.mdx": "95fd31ca9dde61cd5eb28972387ebbd5d16a0d2a10ead1dcb47a0a44682aca52", + "src/content/docs/ja/v2/api/data/thing.mdx": "70ab67345d6ac8ed927d433b765352a33954410a564c2d9bb7771d68d9922ff9", + "src/content/docs/ja/v2/api/data/uuid.mdx": "66827ba5f26abffa06b84888f84b0524172fa19479a06b5e1682a5e617889c80", "src/content/docs/ja/v2/api/errors.mdx": "0123aa6e46d40265660dfb332b5ac40d30a5c2611181a51044facdf6d59c9bf0", "src/content/docs/ja/v2/api/utils/escape.mdx": "53ff6cc5ac2237b7fe89e83fbcf77e52fc07da950aa0737a00d6c22aba962955", "src/content/docs/ja/v2/api/utils/get-timeout-signal.mdx": "5e0d6e9e7d59ffbe26e842fb341cd85e4e83147d53018aa097b2839e9a582663", @@ -68,12 +68,12 @@ "src/content/docs/ja/v2/experimental/auto-reconnect.mdx": "5ab2638cd2f6b24f0ab9c7057c5d55d2bba2a1c15323d8400d3c56cc508a1c33", "src/content/docs/ja/v2/experimental/inline-query.mdx": "01c3eefb276d98513df5b65420a728818d074fa05fccaeba7aafa920dfd783ba", "src/content/docs/ja/v2/experimental/inline-rpc.mdx": "9ed5e094662ef832297f02c6d3b54ae106b69fa0063aca5934f08f079ef2260a", - "src/content/docs/ja/v2/getting-started.mdx": "b384c3fce1c8bb5e013f8ff58aba4299a01ca8d562e255e11d94f711e8a1935b", + "src/content/docs/ja/v2/getting-started.mdx": "10750269305fac724905c519f828978c619941d204e0663d6e02a47e9a12c9f0", "src/content/docs/ja/v2/guides/authentication.mdx": "4e14a03ccf5e9909d8e34c91d1cd57e6967adba64f42cc70977e4336e108bd43", "src/content/docs/ja/v2/guides/connecting.mdx": "935a36cc67811ee08309c9403b6b1a4adcf92978549ed22398ee895795ba3721", - "src/content/docs/ja/v2/guides/errors.mdx": "4c0c801e584c778a94d0cbdbfe80083425e00916c34a255f6164dfd6190398d2", + "src/content/docs/ja/v2/guides/errors.mdx": "4b7cb65027d0cdcece48f9a97c6aa1542e0a4cf2b362cd81a1ab4838f470f18c", "src/content/docs/ja/v2/guides/prepared-query.mdx": "f50edd1d83e2e296b6ca019fb27823f0b63c498742bc3b4f9de32c461952f7cf", "src/content/docs/ja/v2/guides/querying.mdx": "4fa8ff5de559a0a1d119b0f29ddef09ae1c814d0658a836f36a1495d98ba8a26", "src/content/docs/ja/v2/index.mdx": "b43660b727904827fa71595a2f5422771813f90ffb962ae8a6258236f6fc6ef2", - "src/content/docs/ja/v2/supports.mdx": "de67802f5acb169e19c16891077ff4f3952c2c8a69d5dae7a1d606227c28377a" + "src/content/docs/ja/v2/supports.mdx": "dbc53ced802569e4fba39ce33393b128a3beb946491a9cec11325683cb0076f2" } \ No newline at end of file diff --git a/docs/cache/ja2ko/content/v2/api/data/bound-excluded.mdx b/docs/cache/ja2ko/content/v2/api/data/bound-excluded.mdx index 59caa717..a5a86101 100644 --- a/docs/cache/ja2ko/content/v2/api/data/bound-excluded.mdx +++ b/docs/cache/ja2ko/content/v2/api/data/bound-excluded.mdx @@ -2,24 +2,24 @@ title: BoundExcluded slug: ko/v2/api/data/bound-excluded banner: - content: 이것은 실험적인 기능입니다. + content: 이 기능은 실험적인 기능입니다. --- import Badge from "~/components/ko/Badge.astro"; -[`Range`](/v2/api/data/range)를 참조하십시오. +[`Range`](/v2/api/data/range) 를 참조하십시오. ### 가져오기 ```ts -import { BoundExcluded } from "@tai-kun/surrealdb/data-types/decode-only"; -import { BoundExcluded } from "@tai-kun/surrealdb/data-types/encodable"; -import { BoundExcluded } from "@tai-kun/surrealdb/data-types/standard"; +import { BoundExcluded } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { BoundExcluded } from "@tai-kun/surrealdb/encodable-datatypes"; +import { BoundExcluded } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` -새로운 `BoundExcluded` 객체를 만듭니다. +새로운 `BoundExcluded` 객체를 생성합니다. ```ts new BoundExcluded(source: unknown); @@ -33,7 +33,7 @@ new BoundExcluded(source: unknown); #### 반환 값 -`new`를 통해 호출하면 `BoundExcluded`는 해당 인스턴스를 반환합니다. +`new` 를 통해 호출되는 경우 `BoundExcluded` 는 해당 인스턴스를 반환합니다. ### `.value` diff --git a/docs/cache/ja2ko/content/v2/api/data/bound-included.mdx b/docs/cache/ja2ko/content/v2/api/data/bound-included.mdx index d558600c..c14a72ad 100644 --- a/docs/cache/ja2ko/content/v2/api/data/bound-included.mdx +++ b/docs/cache/ja2ko/content/v2/api/data/bound-included.mdx @@ -12,9 +12,9 @@ import Badge from "~/components/ko/Badge.astro"; ### 임포트 ```ts -import { BoundIncluded } from "@tai-kun/surrealdb/data-types/decode-only"; -import { BoundIncluded } from "@tai-kun/surrealdb/data-types/encodable"; -import { BoundIncluded } from "@tai-kun/surrealdb/data-types/standard"; +import { BoundIncluded } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { BoundIncluded } from "@tai-kun/surrealdb/encodable-datatypes"; +import { BoundIncluded } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -29,12 +29,12 @@ new BoundIncluded(source: unknown); ##### `source` -조사 중. +조사 중입니다. #### 반환 값 -`new` 를 통해 호출된 경우 `BoundIncluded` 는 해당 인스턴스를 반환합니다. +`new` 를 통해 호출될 경우 `BoundIncluded` 는 해당 인스턴스를 반환합니다. ### `.value` -조사 중. +조사 중입니다. diff --git a/docs/cache/ja2ko/content/v2/api/data/datetime.mdx b/docs/cache/ja2ko/content/v2/api/data/datetime.mdx index c469b80f..1a91b6d1 100644 --- a/docs/cache/ja2ko/content/v2/api/data/datetime.mdx +++ b/docs/cache/ja2ko/content/v2/api/data/datetime.mdx @@ -5,19 +5,19 @@ slug: ko/v2/api/data/datetime import Badge from "~/components/ko/Badge.astro"; -`Datetime`은 날짜와 시간을 나타내는 클래스입니다. SurrealQL의 [`datetime`](https://surrealdb.com/docs/surrealql/datamodel/datetimes) 형식을 지원합니다. +`Datetime`은 날짜와 시간을 나타내는 클래스입니다. SurrealQL의 [`datetime`](https://surrealdb.com/docs/surrealql/datamodel/datetimes) 유형과 호환됩니다. ### 가져오기 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Datetime } from "@tai-kun/surrealdb/data-types/encodable"; -import { Datetime } from "@tai-kun/surrealdb/data-types/standard"; +import { Datetime } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Datetime } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Datetime } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` -새 `Datetime` 객체를 생성합니다. +새로운 `Datetime` 객체를 만듭니다. ```ts new Datetime(source: [number, number] | string); // decode-only, encodable @@ -43,23 +43,23 @@ new Datetime( ); // standard ``` -#### 인수 +#### 매개변수 ##### `source` -초 단위 및 나노초 단위의 쌍 또는 문자열입니다. `standard` 이하의 프리셋에서는 `Date` 객체나 `bigint` 입력도 지원합니다. +초 단위 및 나노초 단위 쌍 또는 문자열입니다. 프리셋이 standard이면 `Date` 객체나 `bigint` 입력도 지원합니다. ##### `year`, `monthIndex`, ... -`Date` 클래스의 인수와 동일합니다. 다만 `nanoseconds` 입력도 지원합니다. `undefined`를 제공한 인수 이후에 `number`를 제공할 수 없습니다. 이는 `Date` 클래스와 거의 동일한 사양입니다. +`Date` 클래스의 매개변수와 동일합니다. 단, `nanoseconds` 입력도 지원합니다. `undefined`를 제공한 매개변수 뒤에 `number`를 제공할 수 없습니다. 이는 `Date` 클래스와 거의 동일한 사양입니다. -#### 반환 값 +#### 반환값 -`new`를 통해 호출될 경우 `Datetime`은 해당 인스턴스를 반환합니다. `standard` 이하의 프리셋에서는 `Date` 인스턴스이기도 합니다. +`new`를 통해 호출된 경우 `Datetime`은 해당 인스턴스를 반환합니다. 프리셋이 standard이면 `Date` 인스턴스이기도 합니다. ### `.seconds` -나노초 단위 시간의 초 단위 부분입니다. `standard` 이하의 프리셋에서는 읽기 전용입니다. 값은 -253-1에서 253-1 사이의 정수 또는 `NaN`입니다. +나노초 단위 시간의 초 단위 부분입니다. standard 미만의 프리셋에서는 읽기 전용입니다. 값은 -253-1에서 253-1까지의 정수 또는 `NaN`입니다. ```ts .seconds: number; @@ -67,7 +67,7 @@ new Datetime( ### `.nanoseconds` -나노초 단위 시간의 나노초 단위 부분입니다. `standard` 이하의 프리셋에서는 읽기 전용입니다. 값은 0에서 999999999 사이의 정수 또는 `NaN`입니다. +나노초 단위 시간의 나노초 단위 부분입니다. standard 미만의 프리셋에서는 읽기 전용입니다. 값은 0에서 999999999까지의 정수 또는 `NaN`입니다. ```ts .nanoseconds: number; @@ -81,18 +81,18 @@ new Datetime( .valueOf(): number; ``` -#### 인수 +#### 매개변수 없음. -#### 반환 값 +#### 반환값 밀리초 단위 시간을 반환합니다. #### 예 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/encodable"; +import { Datetime } from "@tai-kun/surrealdb/encodable-datatypes"; const date = new Datetime("2024-06-01T12:34:56.780123456Z"); console.log(date.valueOf()); @@ -107,18 +107,18 @@ console.log(date.valueOf()); .toString(): string; ``` -#### 인수 +#### 매개변수 없음. -#### 반환 값 +#### 반환값 밀리초 단위 시간의 문자열 표현을 반환합니다. #### 예 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/encodable"; +import { Datetime } from "@tai-kun/surrealdb/encodable-datatypes"; const date = new Datetime("2024-06-01T12:34:56.780123456Z"); console.log(date.toString()); @@ -133,18 +133,18 @@ console.log(date.toString()); .toISOString(): string; ``` -#### 인수 +#### 매개변수 없음. -#### 반환 값 +#### 반환값 나노초 단위 시간의 문자열을 ISO 형식으로 반환합니다. #### 예 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/encodable"; +import { Datetime } from "@tai-kun/surrealdb/encodable-datatypes"; const date = new Datetime([1717245296, 780123456]); console.log(date.toISOString()); @@ -153,40 +153,40 @@ console.log(date.toISOString()); ### `.toDate()` -런타임 기본 제공 `Date` 객체로 변환합니다. 밀리초 단위로 변환된다는 점에 유의하십시오. +런타임 내장 `Date` 객체로 변환합니다. 밀리초 단위로 변환된다는 점에 유의하십시오. ```ts .toDate(): Date; ``` -#### 인수 +#### 매개변수 없음. -#### 반환 값 +#### 반환값 -런타임 기본 제공 `Date` 객체를 반환합니다. +런타임 내장 `Date` 객체를 반환합니다. ### `.toSurql()` -`Datetime` 객체를 SurrealQL에 포함할 수 있는 문자열로 변환합니다. `.toISOString()`과 유사하지만 `d` 접두사를 추가하여 쿼리 파서에 문자열이 UUID임을 알립니다. +`Datetime` 객체를 SurrealQL에 삽입할 수 있는 문자열로 변환합니다. `.toISOString()`과 유사하지만 `d` 접두사를 추가하여 쿼리 파서에 문자열이 UUID임을 알립니다. ```ts .toSurql(): string; ``` -#### 인수 +#### 매개변수 없음. -#### 반환 값 +#### 반환값 `d` 접두사가 붙은 ISO 형식의 날짜 및 시간을 반환합니다. #### 예 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/encodable"; +import { Datetime } from "@tai-kun/surrealdb/encodable-datatypes"; const date = new Datetime([1717245296, 780123456]); console.log(date.toSurql()); @@ -195,42 +195,42 @@ console.log(date.toSurql()); ### `.getCompact()` -초 단위 및 나노초 단위의 쌍을 가져옵니다. +초 단위 및 나노초 단위 쌍을 가져옵니다. ```ts .getCompact(): [seconds: number, nanoseconds: number]; ``` -#### 인수 +#### 매개변수 없음. -#### 반환 값 +#### 반환값 -초 단위 및 나노초 단위의 쌍을 반환합니다. +초 단위 및 나노초 단위 쌍을 반환합니다. ### `.setCompact()` -초 단위 및 나노초 단위의 쌍으로 날짜 및 시간을 설정합니다. +초 단위 및 나노초 단위 쌍으로 날짜 및 시간을 설정합니다. ```ts .setCompact(compact: [seconds: number, nanoseconds: number]): number; ``` -#### 인수 +#### 매개변수 ##### `compact` -초 단위 및 나노초 단위의 쌍입니다. +초 단위 및 나노초 단위 쌍입니다. -#### 반환 값 +#### 반환값 밀리초 단위 시간을 반환합니다. #### 예 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/standard"; +import { Datetime } from "@tai-kun/surrealdb/standard-datatypes"; const date = new Datetime(0); const time = dt.setCompact([1717245296, 780123456]); @@ -242,24 +242,24 @@ console.log(time); 현지 시간을 사용하여 날짜의 마이크로초를 가져옵니다. -`.getUTCMicroseconds()`는 이 메서드와 동일한 방식으로 동작합니다. +`.getUTCMicroseconds()`는 이 메서드와 동일하게 동작합니다. ```ts .getMicroseconds(): number; ``` -#### 인수 +#### 매개변수 없음. -#### 반환 값 +#### 반환값 마이크로초를 반환합니다. #### 예 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/standard"; +import { Datetime } from "@tai-kun/surrealdb/standard-datatypes"; const date = new Datetime([1717245296, 780123456]); console.log(date.toISOString()); @@ -276,26 +276,26 @@ console.log(date.getMicroseconds()); 마이크로초를 설정합니다. -`.setUTCMicroseconds()`는 이 메서드와 동일한 방식으로 동작합니다. +`.setUTCMicroseconds()`는 이 메서드와 동일하게 동작합니다. ```ts .setMicroseconds(us: number): number; ``` -#### 인수 +#### 매개변수 ##### `us` -설정할 마이크로초입니다. 값은 정수로 변환됩니다. 값이 0에서 999 사이가 아니면 전체 시간에 영향을 미칠 수 있습니다. +설정할 마이크로초입니다. 값은 정수로 변환됩니다. 값이 0에서 999 사이가 아니면 전체 시간에 영향을 미친다는 점에 유의하십시오. -#### 반환 값 +#### 반환값 밀리초 단위 시간을 반환합니다. #### 예 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/standard"; +import { Datetime } from "@tai-kun/surrealdb/standard-datatypes"; const date = new Datetime([1717245296, 780123456]); console.log(date.toISOString()); @@ -312,24 +312,24 @@ console.log(time); 현지 시간을 사용하여 날짜의 나노초를 가져옵니다. -`.getUTCNanoseconds()`는 이 메서드와 동일한 방식으로 동작합니다. +`.getUTCNanoseconds()`는 이 메서드와 동일하게 동작합니다. ```ts .getNanoseconds(): number; ``` -#### 인수 +#### 매개변수 없음. -#### 반환 값 +#### 반환값 나노초를 반환합니다. #### 예 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/standard"; +import { Datetime } from "@tai-kun/surrealdb/standard-datatypes"; const date = new Datetime([1717245296, 780123456]); console.log(date.toISOString()); @@ -346,26 +346,26 @@ console.log(date.getNanoseconds()); 마이크로초를 설정합니다. -`.setUTCNanoseconds()`는 이 메서드와 동일한 방식으로 동작합니다. +`.setUTCNanoseconds()`는 이 메서드와 동일하게 동작합니다. ```ts .setNanoseconds(us: number): number; ``` -#### 인수 +#### 매개변수 ##### `us` -설정할 나노초입니다. 값은 정수로 변환됩니다. 값이 0에서 999 사이가 아니면 전체 시간에 영향을 미칠 수 있습니다. +설정할 나노초입니다. 값은 정수로 변환됩니다. 값이 0에서 999 사이가 아니면 전체 시간에 영향을 미친다는 점에 유의하십시오. -#### 반환 값 +#### 반환값 밀리초 단위 시간을 반환합니다. #### 예 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/standard"; +import { Datetime } from "@tai-kun/surrealdb/standard-datatypes"; const date = new Datetime([1717245296, 780123456]); console.log(date.toISOString()); @@ -386,27 +386,27 @@ console.log(time); .clone(): this; ``` -#### 인수 +#### 매개변수 없음. -#### 반환 값 +#### 반환값 -새 `Datetime` 객체를 반환합니다. `Datetime` 클래스를 상속한 경우 해당 클래스의 인스턴스가 반환됩니다. +새로운 `Datetime` 객체를 반환합니다. `Datetime` 클래스를 상속하는 경우 해당 클래스의 인스턴스를 반환합니다. -### 개발 +### 확장 -#### `Datetime` 객체의 범용적인 판별 +#### `Datetime` 객체의 일반적인 판별 -프리셋에 의존하지 않고 값이 `Datetime` 객체인지 판별하려면 `isDatetime` 함수를 사용하는 것이 좋습니다. 이 함수는 `instanceof`를 사용하지 않으므로 검증할 값의 프리셋을 알 수 없는 경우에 유용합니다. +프리셋에 의존하지 않고 값이 `Datetime` 객체인지 판별하려면 `isDatetime` 함수를 사용하는 것이 좋습니다. 이 함수는 `instanceof`를 사용하지 않으므로 검증할 값의 프리셋이 알 수 없는 경우에 유용합니다. ```ts import { isDatetime } from "@tai-kun/surrealdb"; ``` -#### UNIX 에포크 이전의 날짜 및 시간 +#### UNIX 에포크 이전 날짜 및 시간 -SurrealDB의 `datetime` 형식은 나노초 단위까지 보관할 수 있습니다. 따라서 JavaScript에서 처리할 때는 주의해야 합니다. SurrealDB가 직렬화한 `datetime` (예: `"1969-12-31T23:59:59.999999999Z"`)을 JavaScript의 `Date.parse`에 전달하면 WebKit에서는 0밀리초가 되지만, 그 외 (Node.js, Deno, Bun, Chromium, Firefox)는 -1밀리초가 됩니다. +SurrealDB의 `datetime` 유형은 나노초 단위까지 유지할 수 있습니다. 따라서 JavaScript로 처리할 때는 주의해야 합니다. SurrealDB가 직렬화한 `datetime` 예를 들어 `"1969-12-31T23:59:59.999999999Z"`를 JavaScript의 `Date.parse`에 전달하면 WebKit에서는 0밀리초가 되지만 다른 경우(Node.js, Deno, Bun, Chromium, Firefox)에는 -1밀리초가 됩니다. WebKit: diff --git a/docs/cache/ja2ko/content/v2/api/data/decimal.mdx b/docs/cache/ja2ko/content/v2/api/data/decimal.mdx index e882ce00..21960783 100644 --- a/docs/cache/ja2ko/content/v2/api/data/decimal.mdx +++ b/docs/cache/ja2ko/content/v2/api/data/decimal.mdx @@ -1,18 +1,18 @@ --- -title: Decimal +title: 소수 slug: ko/v2/api/data/decimal --- import Badge from "~/components/ko/Badge.astro"; -`Decimal`은 임의 정밀도 실수를 표현하기 위한 클래스입니다. 프리셋이 standard인 경우 [`big.js`](https://github.com/MikeMcl/big.js)를 상속한 클래스가 됩니다. 이로 인해 `.toString()` 메서드와 같은 결과가 프리셋 간에 일치하지 않을 수 있습니다. +`Decimal`은 임의 정밀도 실수를 나타내는 클래스입니다. 프리셋이 `standard`인 경우 [`big.js`](https://github.com/MikeMcl/big.js)를 상속받은 클래스입니다. 이로 인해 `.toString()` 메서드와 같은 결과가 프리셋 간에 일치하지 않을 수 있습니다. ### 가져오기 ```ts -import { Decimal } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Decimal } from "@tai-kun/surrealdb/data-types/encodable"; -import { Decimal } from "@tai-kun/surrealdb/data-types/standard"; +import { Decimal } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Decimal } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Decimal } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -28,11 +28,11 @@ new Decimal(source: string | number | Decimal); // standard ##### `source` -문자열로 표현된 실수입니다. 프리셋이 standard인 경우 숫자도 전달할 수 있습니다. +문자열로 표현된 실수입니다. 프리셋이 `standard`인 경우 숫자도 전달할 수 있습니다. -#### 반환값 +#### 반환 값 -`new`를 통해 호출될 경우 `Decimal`은 해당 인스턴스를 반환합니다. +`new`를 통해 호출된 경우 `Decimal`은 해당 인스턴스를 반환합니다. ### `.toString()` @@ -42,13 +42,13 @@ new Decimal(source: string | number | Decimal); // standard 없음. -#### 반환값 +#### 반환 값 실수의 문자열 표현을 반환합니다. ### `.toSurql()` -`Decimal` 객체를 SurrealQL에 삽입 가능한 문자열로 변환합니다. `.toString()`과 유사하지만 `dec` 접미사를 추가하여 쿼리 파서에 문자열이 `decimal` 형식임을 알립니다. +`Decimal` 객체를 SurrealQL에 삽입할 수 있는 문자열로 변환합니다. `.toString()`과 비슷하지만 `dec` 접미사를 추가하여 쿼리 파서에 문자열이 `decimal` 형식임을 알립니다. ```ts .toSurql(): string; @@ -58,14 +58,14 @@ new Decimal(source: string | number | Decimal); // standard 없음. -#### 반환값 +#### 반환 값 `dec` 접미사가 붙은 실수를 반환합니다. #### 예 ```ts -import { Decimal } from "@tai-kun/surrealdb/data-types/encodable"; +import { Decimal } from "@tai-kun/surrealdb/encodable-datatypes"; const decimal = new Decimal("3.14"); console.log(decimal.toSurql()); @@ -84,13 +84,13 @@ console.log(decimal.toSurql()); 없음. -#### 반환값 +#### 반환 값 -새로운 `Decimal` 객체를 반환합니다. `Decimal` 클래스를 상속하는 경우 해당 클래스의 인스턴스가 반환됩니다. +새로운 `Decimal` 객체를 반환합니다. `Decimal` 클래스를 상속받은 경우 해당 클래스의 인스턴스가 반환됩니다. ### 기타 메서드 -standard 프리셋을 사용하는 경우 `Decimal` 클래스는 `big.js`의 `Big` 클래스를 상속하므로 인스턴스 메서드 및 속성은 `big.js` 문서를 참조하십시오. +`standard` 프리셋을 사용하는 경우 `Decimal` 클래스는 `big.js`의 `Big` 클래스를 상속받으므로 인스턴스 메서드와 프로퍼티는 `big.js`의 문서를 참조하십시오: [`big.js` 문서](https://mikemcl.github.io/big.js/#prototype-methods) @@ -98,7 +98,7 @@ standard 프리셋을 사용하는 경우 `Decimal` 클래스는 `big.js`의 `Bi #### `Decimal` 객체의 범용적인 판별 -프리셋에 의존하지 않고 값이 `Decimal` 객체인지 판별하려면 `isDecimal` 함수를 사용하는 것이 좋습니다. 이 함수는 `instanceof`를 사용하지 않으므로 검증할 값의 프리셋이 알려지지 않은 경우 유용합니다. +프리셋에 의존하지 않고 값이 `Decimal` 객체인지 판별하려면 `isDecimal` 함수를 사용하는 것이 좋습니다. 이 함수는 `instanceof`를 사용하지 않으므로 검증할 값의 프리셋이 알 수 없는 경우에 유용합니다. ```ts import { isDecimal } from "@tai-kun/surrealdb"; diff --git a/docs/cache/ja2ko/content/v2/api/data/duration.mdx b/docs/cache/ja2ko/content/v2/api/data/duration.mdx index df36f7ef..ecaaafc4 100644 --- a/docs/cache/ja2ko/content/v2/api/data/duration.mdx +++ b/docs/cache/ja2ko/content/v2/api/data/duration.mdx @@ -10,14 +10,14 @@ import Badge from "~/components/ko/Badge.astro"; ### 가져오기 ```ts -import { Duration } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Duration } from "@tai-kun/surrealdb/data-types/encodable"; -import { Duration } from "@tai-kun/surrealdb/data-types/standard"; +import { Duration } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Duration } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Duration } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` -새로운 `Duration` 객체를 만듭니다. +새로운 `Duration` 객체를 생성합니다. ```ts new Duration( @@ -40,9 +40,9 @@ new Duration( ##### `source` -초 단위와 나노초 단위의 쌍입니다. 프리셋이 standard인 경우 `Duration` 객체를 구성하는 데 더 많은 값을 사용할 수 있습니다. +초와 나노초 쌍입니다. 프리셋이 `standard`인 경우 더 많은 값을 `Duration` 객체로 만들 수 있습니다. -`number` 타입의 입력은 밀리초 단위로 계산됩니다. 이는 `Date` 객체 간의 차이를 `Duration` 객체로 변환하는 용도를 위해 사용됩니다: +`number` 유형의 입력은 밀리초 단위로 계산됩니다. 이는 `Date` 객체 간의 차이를 `Duration` 객체로 변환하기 위한 용도입니다. ```ts const begin = new Date("2024-06-01T12:00:00.000Z"); @@ -50,7 +50,7 @@ const end = new Date("2024-06-01T21:00:00.000Z"); new Duration(end - begin); ``` -`bigint` 타입의 입력은 나노초 단위로 계산됩니다. 이는 예를 들어 [`process.hrtime.bigint()`](https://nodejs.org/api/process.html#processhrtimebigint)에서 반환된 나노초와 같이 고정밀 시간을 `Duration` 객체로 변환하는 용도를 위해 사용됩니다: +`bigint` 유형의 입력은 나노초 단위로 계산됩니다. 이는 예를 들어 [`process.hrtime.bigint()`](https://nodejs.org/api/process.html#processhrtimebigint)에서 반환되는 나노초와 같이 고정밀 시간을 `Duration` 객체로 변환하기 위한 용도입니다. ```ts const begin = process.hrtime.bigint(); @@ -59,7 +59,7 @@ const end = process.hrtime.bigint(); new Duration(end - begin); ``` -`string` 타입의 입력은 기간의 문자열 표현이어야 합니다. 기간의 문자열 표현은 숫자와 단위의 조합으로 구성되며, 이들이 연속적으로 이어지는 형식을 의미합니다. 예를 들어 `1h4h30m20s1350ms`는 "1일 4시간 30분 21초 350밀리초"를 나타냅니다. 사용 가능한 단위는 다음과 같습니다: +`string` 유형의 입력은 기간을 나타내는 문자열 표현이어야 합니다. 기간을 나타내는 문자열 표현은 숫자와 단위를 한 쌍으로 하여 이들이 연속적으로 나열된 형식을 말합니다. 예를 들어 `1h4h30m20s1350ms`는 "1일과 4시간 30분, 21초 350밀리초"를 나타냅니다. 사용 가능한 단위는 다음과 같습니다. | 단위 | 설명 | 변환 | | --- | --- | --- | @@ -73,15 +73,15 @@ new Duration(end - begin); | `w` | 주 | `1w` -> `7d` | | `y` | 년 | `1y` -> `365d` | -`us` (`0x75`, `0x73`)는 `µs` (`0xc2`, `0xb5`, `0x73`) 또는 `μs` (`0xce`, `0xbc`, `0x73`)로도 사용할 수 있습니다(괄호 안의 16진수는 단위 문자열을 UTF-8로 인코딩한 결과입니다). +`us` (`0x75`, `0x73`)는 `µs` (`0xc2`, `0xb5`, `0x73`) 또는 `μs` (`0xce`, `0xbc`, `0x73`)로 표기할 수 있습니다(괄호 안의 16진수는 단위 문자열을 UTF-8로 인코딩한 결과입니다). #### 반환값 -`new`를 통해 호출된 경우 `Duration`은 해당 인스턴스를 반환합니다. +`new`를 통해 호출될 경우 `Duration`은 해당 인스턴스를 반환합니다. ### `.seconds` -기간의 초 단위 부분입니다. standard 미만의 프리셋에서는 읽기 전용입니다. 값은 0에서 264-1까지의 정수입니다. +기간의 초 부분입니다. `standard` 미만의 프리셋에서는 읽기 전용입니다. 값은 0에서 264-1까지의 정수입니다. ```ts .seconds: bigint; @@ -89,7 +89,7 @@ new Duration(end - begin); ### `.nanoseconds` -기간의 나노초 단위 부분입니다. standard 미만의 프리셋에서는 읽기 전용입니다. 값은 0에서 999999999까지의 정수입니다. +기간의 나노초 부분입니다. `standard` 미만의 프리셋에서는 읽기 전용입니다. 값은 0에서 999999999까지의 정수입니다. ```ts .nanoseconds: number; @@ -97,7 +97,7 @@ new Duration(end - begin); ### `.parse()` -기간을 각 단위에 매핑합니다. 각 단위의 값은 0 이상이고 해당 단위의 최대값 미만입니다. 기간이 0인 경우 0나노초, 즉 `nanoseconds` 프로퍼티만 `0`을 가진 객체가 반환됩니다. +기간을 각 단위에 매핑합니다. 각 단위의 값은 0 이상 해당 단위의 최댓값 미만입니다. 기간이 0인 경우 0 나노초, 즉 `nanoseconds` 속성만 `0`을 가진 객체를 반환합니다. ```ts .parse(): { @@ -115,16 +115,16 @@ new Duration(end - begin); #### 인수 -없음. +없습니다. #### 반환값 -기간을 각 단위에 매핑한 결과를 반환합니다. 단위의 값이 0인 경우 프로퍼티가 생략되지만 기간이 0인 경우 `nanoseconds`만 `0`을 가진 객체가 반환됩니다. +기간을 각 단위에 매핑한 결과를 반환합니다. 단위의 값이 0인 경우 속성이 생략되지만, 기간이 0인 경우 `nanoseconds`만 `0`을 가진 객체를 반환합니다. #### 예 ```ts -import { Duration } from "@tai-kun/surrealdb/data-types/encodable"; +import { Duration } from "@tai-kun/surrealdb/encodable-datatypes"; const duration = new Duration(0); console.log(duration.parse()); @@ -132,7 +132,7 @@ console.log(duration.parse()); ``` ```ts -import { Duration } from "@tai-kun/surrealdb/data-types/encodable"; +import { Duration } from "@tai-kun/surrealdb/encodable-datatypes"; const duration = new Duration(12_345_000n); console.log(duration.parse()); @@ -149,14 +149,14 @@ console.log(duration.parse()); #### 인수 -없음. +없습니다. #### 반환값 기간을 나노초 단위로 반환합니다. ```ts -import { Duration } from "@tai-kun/surrealdb/data-types/encodable"; +import { Duration } from "@tai-kun/surrealdb/encodable-datatypes"; const duration = new Duration(12_345_000n); console.log(duration.valueOf()); @@ -165,7 +165,7 @@ console.log(duration.valueOf()); ### `.toString()` -기간의 문자열 표현을 가져옵니다. +기간을 나타내는 문자열을 가져옵니다. `.toJSON()`과 `.toSurql()`은 이 메서드와 동일한 결과를 반환합니다. @@ -175,16 +175,16 @@ console.log(duration.valueOf()); #### 인수 -없음. +없습니다. #### 반환값 -밀리초 단위로 표현된 시간의 문자열 표현을 반환합니다. +밀리초 정밀도의 시간 문자열을 가져옵니다. #### 예 ```ts -import { Duration } from "@tai-kun/surrealdb/data-types/encodable"; +import { Duration } from "@tai-kun/surrealdb/encodable-datatypes"; const duration = new Duration(12_345_000n); console.log(duration.toString()); @@ -193,7 +193,7 @@ console.log(duration.toString()); ### `.toISOString()` -기간의 문자열을 ISO 형식으로 가져옵니다. +기간을 나타내는 문자열을 ISO 형식으로 가져옵니다. ```ts .toISOString(): string; @@ -201,16 +201,16 @@ console.log(duration.toString()); #### 인수 -없음. +없습니다. #### 반환값 -기간의 문자열을 ISO 형식으로 반환합니다. +기간을 나타내는 문자열을 ISO 형식으로 반환합니다. #### 예 ```ts -import { Duration } from "@tai-kun/surrealdb/data-types/encodable"; +import { Duration } from "@tai-kun/surrealdb/encodable-datatypes"; const duration = new Duration("2m3s456ms"); console.log(duration.toISOString()); @@ -219,7 +219,7 @@ console.log(duration.toISOString()); ### `.getCompact()` -초 단위와 나노초 단위의 쌍을 가져옵니다. +초와 나노초 쌍을 가져옵니다. ```ts .getCompact(): [seconds: bigint, nanoseconds: number]; @@ -227,15 +227,15 @@ console.log(duration.toISOString()); #### 인수 -없음. +없습니다. #### 반환값 -초 단위와 나노초 단위의 쌍을 반환합니다. +초와 나노초 쌍을 반환합니다. ### `.setCompact()` -초 단위와 나노초 단위의 쌍으로 날짜와 시간을 설정합니다. +초와 나노초 쌍으로 날짜와 시간을 설정합니다. ```ts .setCompact(compact: [seconds: bigint, nanoseconds: number]): void; @@ -245,15 +245,15 @@ console.log(duration.toISOString()); ##### `compact` -초 단위와 나노초 단위의 쌍입니다. +초와 나노초 쌍입니다. #### 반환값 -없음. +없습니다. ### `.getYears()` -년도를 가져옵니다. 0 이상의 정수가 아니면 0이 반환됩니다. +년을 가져옵니다. 0 이상의 정수가 아닌 경우 0을 반환합니다. ```ts .getYears(): number; @@ -261,15 +261,15 @@ console.log(duration.toISOString()); #### 인수 -없음. +없습니다. #### 반환값 -년도를 나타내는 0 이상의 정수를 반환합니다. +년을 나타내는 0 이상의 정수를 반환합니다. ### `.addYears()` -기간에 지정된 수만큼 년도를 추가합니다. +기간에서 년을 지정된 수만큼 더합니다. ```ts .addYears(value: number): void; @@ -279,15 +279,15 @@ console.log(duration.toISOString()); ##### `value` -년도입니다. +년 수입니다. #### 반환값 -없음. +없습니다. ### `.subYears()` -기간에서 지정된 수만큼 년도를 뺍니다. +기간에서 년을 지정된 수만큼 뺍니다. ```ts .subYears(value: number): void; @@ -297,15 +297,15 @@ console.log(duration.toISOString()); ##### `value` -년도입니다. +년 수입니다. #### 반환값 -없음. +없습니다. ### `.asYears()` -년도를 밀리초로 변환한 값을 가져옵니다. +년 수를 밀리초 표현으로 가져옵니다. ```ts .asYears(): number; @@ -313,15 +313,15 @@ console.log(duration.toISOString()); #### 인수 -없음. +없습니다. #### 반환값 -년도를 밀리초로 변환한 값입니다. +년 수를 밀리초 표현으로 반환합니다. ### `.getWeeks()` -주를 가져옵니다. 0 이상의 정수가 아니면 0이 반환됩니다. +주를 가져옵니다. 0 이상의 정수가 아닌 경우 0을 반환합니다. ```ts .getWeeks(): number; @@ -329,7 +329,7 @@ console.log(duration.toISOString()); #### 인수 -없음. +없습니다. #### 반환값 @@ -337,7 +337,7 @@ console.log(duration.toISOString()); ### `.addWeeks()` -기간에 지정된 수만큼 주를 추가합니다. +기간에서 주를 지정된 수만큼 더합니다. ```ts .addWeeks(value: number): void; @@ -347,15 +347,15 @@ console.log(duration.toISOString()); ##### `value` -주입니다. +주 수입니다. #### 반환값 -없음. +없습니다. ### `.subWeeks()` -기간에서 지정된 수만큼 주를 뺍니다. +기간에서 주를 지정된 수만큼 뺍니다. ```ts .subWeeks(value: number): void; @@ -365,15 +365,15 @@ console.log(duration.toISOString()); ##### `value` -주입니다. +주 수입니다. #### 반환값 -없음. +없습니다. ### `.asWeeks()` -주를 밀리초로 변환한 값을 가져옵니다. +주 수를 밀리초 표현으로 가져옵니다. ```ts .asWeeks(): number; @@ -381,15 +381,15 @@ console.log(duration.toISOString()); #### 인수 -없음. +없습니다. #### 반환값 -주를 밀리초로 변환한 값입니다. +주 수를 밀리초 표현으로 반환합니다. ### `.getDays()` -일을 가져옵니다. 0 이상의 정수가 아니면 0이 반환됩니다. +일을 가져옵니다. 0 이상의 정수가 아닌 경우 0을 반환합니다. ```ts .getDays(): number; @@ -397,7 +397,7 @@ console.log(duration.toISOString()); #### 인수 -없음. +없습니다. #### 반환값 @@ -405,7 +405,7 @@ console.log(duration.toISOString()); ### `.addDays()` -기간에 지정된 수만큼 일을 추가합니다. +기간에서 일을 지정된 수만큼 더합니다. ```ts .addDays(value: number): void; @@ -415,15 +415,15 @@ console.log(duration.toISOString()); ##### `value` -일입니다. +일 수입니다. #### 반환값 -없음. +없습니다. ### `.subDays()` -기간에서 지정된 수만큼 일을 뺍니다. +기간에서 일을 지정된 수만큼 뺍니다. ```ts .subDays(value: number): void; @@ -433,15 +433,15 @@ console.log(duration.toISOString()); ##### `value` -일입니다. +일 수입니다. #### 반환값 -없음. +없습니다. ### `.asDays()` -일을 밀리초로 변환한 값을 가져옵니다. +일 수를 밀리초 표현으로 가져옵니다. ```ts .asDays(): number; @@ -449,15 +449,15 @@ console.log(duration.toISOString()); #### 인수 -없음. +없습니다. #### 반환값 -일을 밀리초로 변환한 값입니다. +일 수를 밀리초 표현으로 반환합니다. ### `.getHours()` -시를 가져옵니다. 0 이상의 정수가 아니면 0이 반환됩니다. +시를 가져옵니다. 0 이상의 정수가 아닌 경우 0을 반환합니다. ```ts .getHours(): number; @@ -465,7 +465,7 @@ console.log(duration.toISOString()); #### 인수 -없음. +없습니다. #### 반환값 @@ -473,7 +473,7 @@ console.log(duration.toISOString()); ### `.addHours()` -기간에 지정된 수만큼 시를 추가합니다. +기간에서 시를 지정된 수만큼 더합니다. ```ts .addHours(value: number): void; @@ -483,15 +483,15 @@ console.log(duration.toISOString()); ##### `value` -시입니다. +시 수입니다. #### 반환값 -없음. +없습니다. ### `.subHours()` -기간에서 지정된 수만큼 시를 뺍니다. +기간에서 시를 지정된 수만큼 뺍니다. ```ts .subHours(value: number): void; @@ -501,15 +501,15 @@ console.log(duration.toISOString()); ##### `value` -시입니다. +시 수입니다. #### 반환값 -없음. +없습니다. ### `.asHours()` -시를 밀리초로 변환한 값을 가져옵니다. +시 수를 밀리초 표현으로 가져옵니다. ```ts .asHours(): number; @@ -517,15 +517,15 @@ console.log(duration.toISOString()); #### 인수 -없음. +없습니다. #### 반환값 -시를 밀리초로 변환한 값입니다. +시 수를 밀리초 표현으로 반환합니다. ### `.getMinutes()` -분을 가져옵니다. 0 이상의 정수가 아니면 0이 반환됩니다. +분을 가져옵니다. 0 이상의 정수가 아닌 경우 0을 반환합니다. ```ts .getMinutes(): number; @@ -533,7 +533,7 @@ console.log(duration.toISOString()); #### 인수 -없음. +없습니다. #### 반환값 @@ -541,7 +541,7 @@ console.log(duration.toISOString()); ### `.addMinutes()` -기간에 지정된 수만큼 분을 추가합니다. +기간에서 분을 지정된 수만큼 더합니다. ```ts .addMinutes(value: number): void; @@ -551,15 +551,15 @@ console.log(duration.toISOString()); ##### `value` -분입니다. +분 수입니다. #### 반환값 -없음. +없습니다. ### `.subMinutes()` -기간에서 지정된 수만큼 분을 뺍니다. +기간에서 분을 지정된 수만큼 뺍니다. ```ts .subMinutes(value: number): void; @@ -569,15 +569,15 @@ console.log(duration.toISOString()); ##### `value` -분입니다. +분 수입니다. #### 반환값 -없음. +없습니다. ### `.asMinutes()` -분을 밀리초로 변환한 값을 가져옵니다. +분 수를 밀리초 표현으로 가져옵니다. ```ts .asMinutes(): number; @@ -585,15 +585,15 @@ console.log(duration.toISOString()); #### 인수 -없음. +없습니다. #### 반환값 -분을 밀리초로 변환한 값입니다. +분 수를 밀리초 표현으로 반환합니다. ### `.getSeconds()` -초를 가져옵니다. 0 이상의 정수가 아니면 0이 반환됩니다. +초를 가져옵니다. 0 이상의 정수가 아닌 경우 0을 반환합니다. ```ts .getSeconds(): number; @@ -601,7 +601,7 @@ console.log(duration.toISOString()); #### 인수 -없음. +없습니다. #### 반환값 @@ -609,7 +609,7 @@ console.log(duration.toISOString()); ### `.addSeconds()` -기간에 지정된 수만큼 초를 추가합니다. +기간에서 초를 지정된 수만큼 더합니다. ```ts .addSeconds(value: number): void; @@ -619,15 +619,15 @@ console.log(duration.toISOString()); ##### `value` -초입니다. +초 수입니다. #### 반환값 -없음. +없습니다. ### `.subSeconds()` -기간에서 지정된 수만큼 초를 뺍니다. +기간에서 초를 지정된 수만큼 뺍니다. ```ts .subSeconds(value: number): void; @@ -637,15 +637,15 @@ console.log(duration.toISOString()); ##### `value` -초입니다. +초 수입니다. #### 반환값 -없음. +없습니다. ### `.asSeconds()` -초를 밀리초로 변환한 값을 가져옵니다. +초 수를 밀리초 표현으로 가져옵니다. ```ts .asSeconds(): number; @@ -653,15 +653,15 @@ console.log(duration.toISOString()); #### 인수 -없음. +없습니다. #### 반환값 -초를 밀리초로 변환한 값입니다. +초 수를 밀리초 표현으로 반환합니다. ### `.getMilliseconds()` -밀리초를 가져옵니다. 0 이상의 정수가 아니면 0이 반환됩니다. +밀리초를 가져옵니다. 0 이상의 정수가 아닌 경우 0을 반환합니다. ```ts .getMilliseconds(): number; @@ -669,7 +669,7 @@ console.log(duration.toISOString()); #### 인수 -없음. +없습니다. #### 반환값 @@ -677,7 +677,7 @@ console.log(duration.toISOString()); ### `.addMilliseconds()` -기간에 지정된 수만큼 밀리초를 추가합니다. +기간에서 밀리초를 지정된 수만큼 더합니다. ```ts .addMilliseconds(value: number): void; @@ -687,15 +687,15 @@ console.log(duration.toISOString()); ##### `value` -밀리초입니다. +밀리초 수입니다. #### 반환값 -없음. +없습니다. ### `.subMilliseconds()` -기간에서 지정된 수만큼 밀리초를 뺍니다. +기간에서 밀리초를 지정된 수만큼 뺍니다. ```ts .subMilliseconds(value: number): void; @@ -705,15 +705,15 @@ console.log(duration.toISOString()); ##### `value` -밀리초입니다. +밀리초 수입니다. #### 반환값 -없음. +없습니다. ### `.asMilliseconds()` -밀리초를 밀리초로 변환한 값을 가져옵니다. +밀리초 수를 밀리초 표현으로 가져옵니다. ```ts .asMilliseconds(): number; @@ -721,15 +721,15 @@ console.log(duration.toISOString()); #### 인수 -없음. +없습니다. #### 반환값 -밀리초를 밀리초로 변환한 값입니다. +밀리초 수를 밀리초 표현으로 반환합니다. ### `.getMicroseconds()` -마이크로초를 가져옵니다. 0 이상의 정수가 아니면 0이 반환됩니다. +마이크로초를 가져옵니다. 0 이상의 정수가 아닌 경우 0을 반환합니다. ```ts .getMicroseconds(): number; @@ -737,7 +737,7 @@ console.log(duration.toISOString()); #### 인수 -없음. +없습니다. #### 반환값 @@ -745,7 +745,7 @@ console.log(duration.toISOString()); ### `.addMicroseconds()` -기간에 지정된 수만큼 마이크로초를 추가합니다. +기간에서 마이크로초를 지정된 수만큼 더합니다. ```ts .addMicroseconds(value: number): void; @@ -755,15 +755,15 @@ console.log(duration.toISOString()); ##### `value` -마이크로초입니다. +마이크로초 수입니다. #### 반환값 -없음. +없습니다. ### `.subMicroseconds()` -기간에서 지정된 수만큼 마이크로초를 뺍니다. +기간에서 마이크로초를 지정된 수만큼 뺍니다. ```ts .subMicroseconds(value: number): void; @@ -773,15 +773,15 @@ console.log(duration.toISOString()); ##### `value` -마이크로초입니다. +마이크로초 수입니다. #### 반환값 -없음. +없습니다. ### `.asMicroseconds()` -마이크로초를 밀리초로 변환한 값을 가져옵니다. +마이크로초 수를 밀리초 표현으로 가져옵니다. ```ts .asMicroseconds(): number; @@ -789,15 +789,15 @@ console.log(duration.toISOString()); #### 인수 -없음. +없습니다. #### 반환값 -마이크로초를 밀리초로 변환한 값입니다. +마이크로초 수를 밀리초 표현으로 반환합니다. ### `.getNanoseconds()` -나노초를 가져옵니다. 0 이상의 정수가 아니면 0이 반환됩니다. +나노초를 가져옵니다. 0 이상의 정수가 아닌 경우 0을 반환합니다. ```ts .getNanoseconds(): number; @@ -805,7 +805,7 @@ console.log(duration.toISOString()); #### 인수 -없음. +없습니다. #### 반환값 @@ -813,7 +813,7 @@ console.log(duration.toISOString()); ### `.addNanoseconds()` -기간에 지정된 수만큼 나노초를 추가합니다. +기간에서 나노초를 지정된 수만큼 더합니다. ```ts .addNanoseconds(value: number): void; @@ -823,15 +823,15 @@ console.log(duration.toISOString()); ##### `value` -나노초입니다. +나노초 수입니다. #### 반환값 -없음. +없습니다. ### `.subNanoseconds()` -기간에서 지정된 수만큼 나노초를 뺍니다. +기간에서 나노초를 지정된 수만큼 뺍니다. ```ts .subNanoseconds(value: number): void; @@ -841,15 +841,15 @@ console.log(duration.toISOString()); ##### `value` -나노초입니다. +나노초 수입니다. #### 반환값 -없음. +없습니다. ### `.asNanoseconds()` -나노초를 밀리초로 변환한 값을 가져옵니다. +나노초 수를 밀리초 표현으로 가져옵니다. ```ts .asNanoseconds(): number; @@ -857,8 +857,8 @@ console.log(duration.toISOString()); #### 인수 -없음. +없습니다. #### 반환값 -나노초를 밀리초로 변환한 값입니다. +나노초 수를 밀리초 표현으로 반환합니다. diff --git a/docs/cache/ja2ko/content/v2/api/data/future.mdx b/docs/cache/ja2ko/content/v2/api/data/future.mdx index 2eba7c3a..334e9f2c 100644 --- a/docs/cache/ja2ko/content/v2/api/data/future.mdx +++ b/docs/cache/ja2ko/content/v2/api/data/future.mdx @@ -1,25 +1,25 @@ --- -title: 퓨처 +title: Future slug: ko/v2/api/data/future banner: - content: 이 기능은 실험적인 기능입니다. + content: 이것은 실험적인 기능입니다. --- import Badge from "~/components/ko/Badge.astro"; -`Future`는 SurrealDB의 [퓨처 기능](https://surrealdb.com/docs/surrealql/datamodel/futures)을 나타내는 클래스입니다. +`Future`는 SurrealDB의 [Futures 기능](https://surrealdb.com/docs/surrealql/datamodel/futures)을 나타내는 클래스입니다. -### 임포트 +### 가져오기 ```ts -import { Future } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Future } from "@tai-kun/surrealdb/data-types/encodable"; -import { Future } from "@tai-kun/surrealdb/data-types/standard"; +import { Future } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Future } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Future } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` -새로운 `Future` 객체를 만듭니다. +새로운 `Future` 객체를 생성합니다. ```ts new Future(source: string); @@ -29,15 +29,15 @@ new Future(source: string); ##### `source` -퓨처 블록 내의 값이나 식입니다. +future 블록 내의 값이나 식입니다. -#### 반환 값 +#### 반환값 -`new`를 통해 호출된 경우 `Future`는 인스턴스를 반환합니다. +`new`를 통해 호출될 경우, `Future`는 해당 인스턴스를 반환합니다. ### `.block` -퓨처 블록 내의 값이나 식입니다. +future 블록 내의 값이나 식입니다. ```ts .block: number; @@ -55,14 +55,14 @@ new Future(source: string); 없음. -#### 반환 값 +#### 반환값 -퓨처 블록 내의 값이나 식을 반환합니다. +future 블록 내의 값이나 식을 반환합니다. -#### 예시 +#### 예 ```ts -import { Future } from "@tai-kun/surrealdb/data-types/encodable"; +import { Future } from "@tai-kun/surrealdb/encodable-datatypes"; const future = new Future(`time::now()`); console.log(future.toString()); @@ -71,7 +71,7 @@ console.log(future.toString()); ### `.toSurql()` -`Future` 객체를 SurrealQL에 삽입 가능한 문자열로 변환합니다. `.toString()`과 유사하지만 블록은 중괄호(`{}`)로 둘러싸여 있으며 ``로 캐스팅됩니다. +`Future` 객체를 SurrealQL에 삽입 가능한 문자열로 변환합니다. `.toString()`과 유사하지만, 블록은 중괄호(`{}`)로 둘러싸이고 ``로 캐스팅됩니다. ```ts .toSurql(): string; @@ -81,14 +81,14 @@ console.log(future.toString()); 없음. -#### 반환 값 +#### 반환값 -SurrealQL에 삽입 가능한 퓨처를 반환합니다. +SurrealQL에 삽입 가능한 future를 반환합니다. -#### 예시 +#### 예 ```ts -import { Future } from "@tai-kun/surrealdb/data-types/encodable"; +import { Future } from "@tai-kun/surrealdb/encodable-datatypes"; const future = new Future(`time::now()`); console.log(future.toSurql()); @@ -97,7 +97,7 @@ console.log(future.toSurql()); ### `.surql()` -이 메서드는 SurrealQL 작성을 돕습니다. 템플릿 리터럴을 사용하여 SurrealQL을 작성할 수 있습니다. 템플릿 리터럴에 삽입된 값은 자동으로 SurrealQL로 변환됩니다. 또한 VSCode에서 [SurrealDB 공식 확장 기능](https://marketplace.visualstudio.com/items?itemName=surrealdb.surrealql)을 설치한 경우 템플릿 리터럴의 구문 강조 표시가 활성화됩니다. +이 메서드는 SurrealQL 작성을 돕습니다. 템플릿 리터럴을 사용하여 SurrealQL을 작성할 수 있습니다. 템플릿 리터럴에 포함된 값은 자동으로 SurrealQL로 변환됩니다. 또한 VSCode에서 [SurrealDB 공식 확장 기능](https://marketplace.visualstudio.com/items?itemName=surrealdb.surrealql)을 설치한 경우, 템플릿 리터럴의 구문 강조가 활성화됩니다. ```ts .surql(texts: TemplateStringsArray, ...values: unknown[]): string; @@ -107,20 +107,20 @@ console.log(future.toSurql()); ##### `texts` -템플릿 리터럴을 구성하는 문자열의 배열입니다. +템플릿 리터럴을 구성하는 문자열 배열입니다. ##### `values` `texts`의 각 요소 사이에 삽입할 값입니다. -#### 반환 값 +#### 반환값 SurrealQL입니다. -#### 예시 +#### 예 ```ts -import { Future, Thing } from "@tai-kun/surrealdb/data-types/standard"; +import { Future, Thing } from "@tai-kun/surrealdb/standard-datatypes"; const foo = "foo"; const rid = new Thing("person", "tai-kun"); @@ -137,10 +137,10 @@ console.log(future.toSurql()); //-> } ``` -위의 예시를 `.surql()`을 사용하지 않으면 다음과 같습니다. +위 예를 `.surql()`을 사용하지 않으면: ```ts -import { Future, Thing } from "@tai-kun/surrealdb/data-types/standard"; +import { Future, Thing } from "@tai-kun/surrealdb/standard-datatypes"; import { toSurql } from "@tai-kun/surrealdb/utils"; const foo = "foo"; @@ -165,7 +165,7 @@ console.log(future.toSurql()); #### `Future` 객체의 범용적인 판별 -프리셋에 의존하지 않고 값이 `Future` 객체인지 판별하려면 `isFuture` 함수를 사용하는 것이 좋습니다. 이 함수는 `instanceof`를 사용하지 않기 때문에 검증할 값의 프리셋이 알 수 없는 경우 유용합니다. +프리셋에 의존하지 않고 값이 `Future` 객체인지 판별하려면 `isFuture` 함수를 사용하는 것을 권장합니다. 이 함수는 `instanceof`를 사용하지 않으므로, 검증할 값의 프리셋이 불분명한 경우 유용합니다. ```ts import { isFuture } from "@tai-kun/surrealdb"; diff --git a/docs/cache/ja2ko/content/v2/api/data/geometry-collection.mdx b/docs/cache/ja2ko/content/v2/api/data/geometry-collection.mdx index 043b07d9..03ad15c4 100644 --- a/docs/cache/ja2ko/content/v2/api/data/geometry-collection.mdx +++ b/docs/cache/ja2ko/content/v2/api/data/geometry-collection.mdx @@ -10,14 +10,14 @@ import Badge from "~/components/ko/Badge.astro"; ### 가져오기 ```ts -import { GeometryCollection } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryCollection } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryCollection } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryCollection } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryCollection } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryCollection } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` -새로운 `GeometryCollection` 객체를 생성합니다. +새로운 `GeometryCollection` 객체를 만듭니다. ```ts new GeometryCollection(source); @@ -31,4 +31,4 @@ new GeometryCollection(source); #### 반환 값 -`new`를 통해 호출될 때 `GeometryCollection`은 해당 인스턴스를 반환합니다. +`new`를 통해 호출될 경우 `GeometryCollection`은 해당 인스턴스를 반환합니다. diff --git a/docs/cache/ja2ko/content/v2/api/data/geometry-line.mdx b/docs/cache/ja2ko/content/v2/api/data/geometry-line.mdx index 9fc35069..14e411df 100644 --- a/docs/cache/ja2ko/content/v2/api/data/geometry-line.mdx +++ b/docs/cache/ja2ko/content/v2/api/data/geometry-line.mdx @@ -7,17 +7,17 @@ import Badge from "~/components/ko/Badge.astro"; 편집 중입니다. -### 임포트 +### 가져오기 ```ts -import { GeometryLine } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryLine } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryLine } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryLine } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryLine } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryLine } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` -새로운 `GeometryLine` 객체를 만듭니다. +새로운 `GeometryLine` 객체를 생성합니다. ```ts new GeometryLine(source); @@ -29,6 +29,6 @@ new GeometryLine(source); 편집 중입니다. -#### 반환 값 +#### 반환값 -`new`를 통해 호출될 경우 `GeometryLine`은 해당 인스턴스를 반환합니다. +`new` 를 통해 호출될 때, `GeometryLine` 은 해당 인스턴스를 반환합니다. diff --git a/docs/cache/ja2ko/content/v2/api/data/geometry-multi-line.mdx b/docs/cache/ja2ko/content/v2/api/data/geometry-multi-line.mdx index 2c43f421..c4ff2aa3 100644 --- a/docs/cache/ja2ko/content/v2/api/data/geometry-multi-line.mdx +++ b/docs/cache/ja2ko/content/v2/api/data/geometry-multi-line.mdx @@ -10,14 +10,14 @@ import Badge from "~/components/ko/Badge.astro"; ### 가져오기 ```ts -import { GeometryMultiLine } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryMultiLine } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryMultiLine } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryMultiLine } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryMultiLine } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryMultiLine } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` -새로운 `GeometryMultiLine` 객체를 만듭니다. +새로운 `GeometryMultiLine` 객체를 생성합니다. ```ts new GeometryMultiLine(source); @@ -31,4 +31,4 @@ new GeometryMultiLine(source); #### 반환 값 -`new`를 통해 호출될 때, `GeometryMultiLine`은 해당 인스턴스를 반환합니다. +`new` 를 통해 호출하면 `GeometryMultiLine` 은 해당 인스턴스를 반환합니다. diff --git a/docs/cache/ja2ko/content/v2/api/data/geometry-multi-point.mdx b/docs/cache/ja2ko/content/v2/api/data/geometry-multi-point.mdx index 0c6892b9..979159f3 100644 --- a/docs/cache/ja2ko/content/v2/api/data/geometry-multi-point.mdx +++ b/docs/cache/ja2ko/content/v2/api/data/geometry-multi-point.mdx @@ -10,9 +10,9 @@ import Badge from "~/components/ko/Badge.astro"; ### 가져오기 ```ts -import { GeometryMultiPoint } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryMultiPoint } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryMultiPoint } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryMultiPoint } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryMultiPoint } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryMultiPoint } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -31,4 +31,4 @@ new GeometryMultiPoint(source); #### 반환 값 -`new`를 통해 호출된 경우 `GeometryMultiPoint`는 해당 인스턴스를 반환합니다. +`new`를 통해 호출될 경우, `GeometryMultiPoint`는 해당 인스턴스를 반환합니다. diff --git a/docs/cache/ja2ko/content/v2/api/data/geometry-multi-polygon.mdx b/docs/cache/ja2ko/content/v2/api/data/geometry-multi-polygon.mdx index 31b1c603..716863ce 100644 --- a/docs/cache/ja2ko/content/v2/api/data/geometry-multi-polygon.mdx +++ b/docs/cache/ja2ko/content/v2/api/data/geometry-multi-polygon.mdx @@ -10,9 +10,9 @@ import Badge from "~/components/ko/Badge.astro"; ### 가져오기 ```ts -import { GeometryMultiPolygon } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryMultiPolygon } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryMultiPolygon } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryMultiPolygon } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryMultiPolygon } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryMultiPolygon } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -31,4 +31,4 @@ new GeometryMultiPolygon(source); #### 반환 값 -`new`를 통해 호출될 경우 `GeometryMultiPolygon`은 해당 인스턴스를 반환합니다. +`new`를 통해 호출된 경우, `GeometryMultiPolygon`은 해당 인스턴스를 반환합니다. diff --git a/docs/cache/ja2ko/content/v2/api/data/geometry-point.mdx b/docs/cache/ja2ko/content/v2/api/data/geometry-point.mdx index 0509ee38..1a7ff854 100644 --- a/docs/cache/ja2ko/content/v2/api/data/geometry-point.mdx +++ b/docs/cache/ja2ko/content/v2/api/data/geometry-point.mdx @@ -10,9 +10,9 @@ import Badge from "~/components/ko/Badge.astro"; ### 가져오기 ```ts -import { GeometryPoint } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryPoint } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryPoint } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryPoint } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryPoint } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryPoint } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -29,6 +29,6 @@ new GeometryPoint(source); 편집 중입니다. -#### 반환값 +#### 반환 값 -`new`를 통해 호출된 경우 `GeometryPoint`는 해당 인스턴스를 반환합니다. +`new`를 통해 호출된 경우, `GeometryPoint`는 해당 인스턴스를 반환합니다. diff --git a/docs/cache/ja2ko/content/v2/api/data/geometry-polygon.mdx b/docs/cache/ja2ko/content/v2/api/data/geometry-polygon.mdx index 5c159210..ae99091c 100644 --- a/docs/cache/ja2ko/content/v2/api/data/geometry-polygon.mdx +++ b/docs/cache/ja2ko/content/v2/api/data/geometry-polygon.mdx @@ -10,9 +10,9 @@ import Badge from "~/components/ko/Badge.astro"; ### 가져오기 ```ts -import { GeometryPolygon } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryPolygon } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryPolygon } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryPolygon } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryPolygon } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryPolygon } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -31,4 +31,4 @@ new GeometryPolygon(source); #### 반환 값 -`new`를 통해 호출하면 `GeometryPolygon`은 해당 인스턴스를 반환합니다. +`new`를 통해 호출된 경우 `GeometryPolygon`은 해당 인스턴스를 반환합니다. diff --git a/docs/cache/ja2ko/content/v2/api/data/range.mdx b/docs/cache/ja2ko/content/v2/api/data/range.mdx index b8b2f104..022ad94a 100644 --- a/docs/cache/ja2ko/content/v2/api/data/range.mdx +++ b/docs/cache/ja2ko/content/v2/api/data/range.mdx @@ -2,7 +2,7 @@ title: 범위 slug: ko/v2/api/data/range banner: - content: 이 기능은 실험적인 기능입니다. + content: 이 기능은 실험적입니다. --- import Badge from "~/components/ko/Badge.astro"; @@ -12,9 +12,9 @@ import Badge from "~/components/ko/Badge.astro"; ### 가져오기 ```ts -import { Range } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Range } from "@tai-kun/surrealdb/data-types/encodable"; -import { Range } from "@tai-kun/surrealdb/data-types/standard"; +import { Range } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Range } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Range } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -60,7 +60,7 @@ new Range( `Range` 객체를 SurrealQL에서 사용 가능한 문자열로 변환합니다. -`.toJSON()`과 `.toSurql()`은 이 메서드와 동일한 결과를 반환합니다. +`.toJSON()`과 `.toSurql()`은 이 메소드와 동일한 결과를 반환합니다. ```ts .toString(): string; @@ -74,14 +74,14 @@ new Range( 범위의 문자열 표현을 반환합니다. -#### 예시 +#### 예 ```ts import { Range, BoundIncluded, BoundExcluded, -} from "@tai-kun/surrealdb/data-types/encodable"; +} from "@tai-kun/surrealdb/encodable-datatypes"; const range = new Range([new BoundIncluded(1), new BoundIncluded(3)]); console.log(range.toString()); @@ -120,11 +120,11 @@ console.log(range.toString()); // -> .. ``` -### 발전 +### 추가 정보 -#### `Range` 객체의 범용적인 판단 +#### `Range` 객체의 일반적인 판별 -프리셋에 의존하지 않고 값이 `Range` 객체인지 판단하려면 `isRange` 함수를 사용하는 것이 좋습니다. 이 함수는 `instanceof`를 사용하지 않으므로, 검증할 값의 프리셋이 불명확한 경우에 유용합니다. +사전 설정에 의존하지 않고 값이 `Range` 객체인지 판별하려면 `isRange` 함수를 사용하는 것이 좋습니다. 이 함수는 `instanceof`를 사용하지 않으므로 검증할 값의 사전 설정이 알 수 없는 경우 유용합니다. ```ts import { isRange } from "@tai-kun/surrealdb"; diff --git a/docs/cache/ja2ko/content/v2/api/data/table.mdx b/docs/cache/ja2ko/content/v2/api/data/table.mdx index 2632bb01..a4c191d4 100644 --- a/docs/cache/ja2ko/content/v2/api/data/table.mdx +++ b/docs/cache/ja2ko/content/v2/api/data/table.mdx @@ -5,14 +5,14 @@ slug: ko/v2/api/data/table import Badge from "~/components/ko/Badge.astro"; -`Table`은 레코드 ID의 테이블 이름을 명시하는 클래스입니다. +`Table`은 레코드 ID의 테이블 이름을 명시적으로 표현하는 클래스입니다. -### 가져오기 +### 임포트 ```ts -import { Table } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Table } from "@tai-kun/surrealdb/data-types/encodable"; -import { Table } from "@tai-kun/surrealdb/data-types/standard"; +import { Table } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Table } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Table } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -30,13 +30,13 @@ new Table(source: string | { name: string }); // standard 테이블 이름 또는 `Table` 객체입니다. 프리셋이 standard 미만이면 테이블 이름만 전달할 수 있습니다. -#### 반환 값 +#### 반환값 `new`를 통해 호출된 경우 `Table`은 해당 인스턴스를 반환합니다. ### `.name` -테이블 이름입니다. 이 속성을 가져올 때 문자열은 이스케이프되지 않습니다. +테이블 이름입니다. 이 프로퍼티를 가져올 경우 문자열은 이스케이프되지 않습니다. ```ts .name: string; @@ -44,10 +44,10 @@ new Table(source: string | { name: string }); // standard #### 예시 -이 속성을 가져올 때 문자열은 이스케이프되지 않습니다. +이 프로퍼티를 가져올 경우 문자열은 이스케이프되지 않습니다. ```ts -import { Table } from "@tai-kun/surrealdb/data-types/decode-only"; +import { Table } from "@tai-kun/surrealdb/decodeonly-datatypes"; const table = new Table("foo-bar"); console.log(table.name); @@ -56,9 +56,9 @@ console.log(table.name); ### `.toString()` -`Table` 객체를 SurrealQL의 변수로 사용할 수 있는 문자열로 변환합니다. +`Table` 객체를 SurrealQL 변수에서 사용 가능한 문자열로 변환합니다. -`.valueOf()`와 `.toJSON()`은 이 메서드와 동일한 결과를 반환합니다. +`.valueOf()` 및 `.toJSON()`은 이 메서드와 동일한 결과를 반환합니다. ```ts .toString(): string; @@ -68,14 +68,14 @@ console.log(table.name); 없음. -#### 반환 값 +#### 반환값 테이블 이름을 반환합니다. #### 예시 ```ts -import { Table } from "@tai-kun/surrealdb/data-types/encodable"; +import { Table } from "@tai-kun/surrealdb/encodable-datatypes"; const table = new Table("foo-bar"); console.log(table.toString()); @@ -94,14 +94,14 @@ console.log(table.toString()); 없음. -#### 반환 값 +#### 반환값 테이블 이름에 이스케이프된 문자열을 반환합니다. #### 예시 ```ts -import { Table } from "@tai-kun/surrealdb/data-types/encodable"; +import { Table } from "@tai-kun/surrealdb/encodable-datatypes"; const table = new Table("foo-bar"); console.log(table.toSurql()); @@ -120,18 +120,18 @@ console.log(table.toSurql()); 없음. -#### 반환 값 +#### 반환값 -새로운 `Table` 객체를 반환합니다. `Table` 클래스를 상속하는 경우 해당 클래스의 인스턴스가 반환됩니다. +새로운 `Table` 객체를 반환합니다. `Table` 클래스를 상속하는 경우 해당 클래스의 인스턴스를 반환합니다. -### 발전 +### 심화 #### 형식 보호 `Table`의 테이블 이름을 형식 매개변수를 사용하여 형식 안전하게 만들 수 있습니다. ```ts -import { Table } from "@tai-kun/surrealdb/data-types/standard"; +import { Table } from "@tai-kun/surrealdb/standard-datatypes"; function isUserTable(table: unknown): table is Table<"user"> { return table instanceof Table @@ -141,7 +141,7 @@ function isUserTable(table: unknown): table is Table<"user"> { #### `Table` 객체의 범용적인 판정 -프리셋에 의존하지 않고 값이 `Table` 객체인지 판단하려면 `isTable` 함수를 사용하는 것이 좋습니다. 이 함수는 `instanceof`를 사용하지 않으므로 검증할 값의 프리셋이 알 수 없는 경우 유용합니다. +프리셋에 의존하지 않고 값이 `Table` 객체인지 판단하려면 `isTable` 함수를 사용하는 것이 좋습니다. 이 함수는 `instanceof`를 사용하지 않으므로 검증할 값의 프리셋이 불명확한 경우에 유용합니다. ```ts import { isTable } from "@tai-kun/surrealdb"; diff --git a/docs/cache/ja2ko/content/v2/api/data/thing.mdx b/docs/cache/ja2ko/content/v2/api/data/thing.mdx index 57877f53..9e2a7c05 100644 --- a/docs/cache/ja2ko/content/v2/api/data/thing.mdx +++ b/docs/cache/ja2ko/content/v2/api/data/thing.mdx @@ -5,14 +5,14 @@ slug: ko/v2/api/data/thing import Badge from "~/components/ko/Badge.astro"; -`Thing`은 [레코드 ID](https://surrealdb.com/docs/surrealql/datamodel/ids)를 표현하기 위한 클래스입니다. +`Thing`는 [레코드 ID](https://surrealdb.com/docs/surrealql/datamodel/ids)를 표현하기 위한 클래스입니다. ### 가져오기 ```ts -import { Thing } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Thing } from "@tai-kun/surrealdb/data-types/encodable"; -import { Thing } from "@tai-kun/surrealdb/data-types/standard"; +import { Thing } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Thing } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Thing } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -28,7 +28,7 @@ new Thing(table: string, id: string | number | bigint | object); ##### `source` -레코드 ID의 테이블 부분과 ID 부분의 쌍입니다. +레코드 ID의 테이블 부분과 ID 부분을 쌍으로 나타냅니다. ##### `table` @@ -40,22 +40,22 @@ new Thing(table: string, id: string | number | bigint | object); #### 반환 값 -`new`를 통해 호출되는 경우 `Thing`은 해당 인스턴스를 반환합니다. +`new`를 통해 호출할 경우 `Thing`은 해당 인스턴스를 반환합니다. ### `.table` -레코드 ID의 테이블 부분입니다. 이 프로퍼티를 가져올 때 문자열은 이스케이프되지 않습니다. +레코드 ID의 테이블 부분입니다. 이 프로퍼티를 가져올 경우 문자열은 이스케이프되지 않습니다. ```ts .table: string; ``` -#### 예 +#### 예제 -이 프로퍼티를 가져올 때 문자열은 이스케이프되지 않습니다. +이 프로퍼티를 가져올 경우 문자열은 이스케이프되지 않습니다. ```ts -import { Thing } from "@tai-kun/surrealdb/data-types/decode-only"; +import { Thing } from "@tai-kun/surrealdb/decodeonly-datatypes"; const thing = new Thing("foo-bar", 0); console.log(this.id); @@ -72,7 +72,7 @@ console.log(this.id); ### `.toString()` -`Thing` 객체를 SurrealQL의 변수로 사용할 수 있는 문자열로 변환합니다. 테이블 이름과 ID 부분은 각각 SurrealDB 구현과 동일하게 이스케이프되고 포맷됩니다. 또한 객체의 프로퍼티는 오름차순으로 정렬됩니다. +`Thing` 객체를 SurrealQL에서 사용할 수 있는 문자열로 변환합니다. 테이블 이름과 ID 부분은 각각 SurrealDB 구현과 동일하게 이스케이프 및 포맷됩니다. 또한 객체의 프로퍼티는 오름차순으로 정렬됩니다. `.valueOf()`와 `.toJSON()`은 이 메서드와 동일한 결과를 반환합니다. @@ -88,10 +88,10 @@ console.log(this.id); 레코드 ID로 포맷된 문자열을 반환합니다. -#### 예 +#### 예제 ```ts -import { Thing } from "@tai-kun/surrealdb/data-types/encodable"; +import { Thing } from "@tai-kun/surrealdb/encodable-datatypes"; const thing = new Thing([ "foo-bar", @@ -103,7 +103,7 @@ console.log(thing.toString()); ### `.toSurql()` -`Thing` 객체를 SurrealQL에 삽입할 수 있는 문자열로 변환합니다. `.toString()`과 비슷하지만 `r` 접두사를 추가하여 쿼리 파서에 문자열이 레코드 ID임을 알립니다. +`Thing` 객체를 SurrealQL에 삽입 가능한 문자열로 변환합니다. `.toString()`과 유사하지만, `r` 접두사를 추가하여 쿼리 파서에 문자열이 레코드 ID임을 알립니다. ```ts .toSurql(): string; @@ -117,10 +117,10 @@ console.log(thing.toString()); 레코드 ID로 포맷된 문자열을 반환합니다. -#### 예 +#### 예제 ```ts -import { Thing } from "@tai-kun/surrealdb/data-types/encodable"; +import { Thing } from "@tai-kun/surrealdb/encodable-datatypes"; const thing = new Thing("foo", "bar"); console.log(thing.toSurql()); @@ -129,7 +129,7 @@ console.log(thing.toSurql()); ### `.clone()` -`Thing` 객체를 복제합니다. 단 ID 부분은 복제되지 않고 참조됩니다. +`Thing` 객체를 복제합니다. 하지만 ID 부분은 복제되지 않고 참조됩니다. ```ts .clone(): this; @@ -141,16 +141,16 @@ console.log(thing.toSurql()); #### 반환 값 -새로운 `Thing` 객체를 반환합니다. `Thing` 클래스를 상속하고 있는 경우 해당 클래스의 인스턴스를 반환합니다. +새로운 `Thing` 객체를 반환합니다. `Thing` 클래스를 상속하는 경우 해당 클래스의 인스턴스를 반환합니다. -### 개발 +### 발전 -#### 타입 가드 +#### 형식 보호 -`Thing`의 테이블 부분과 ID 부분을 각각 타입 매개변수를 사용하여 타입 안전하게 할 수 있습니다: +`Thing`의 테이블 부분과 ID 부분을 각각 형식 매개변수를 사용하여 형식 안전하게 만들 수 있습니다: ```ts -import { Thing, Uuid } from "@tai-kun/surrealdb/data-types/standard"; +import { Thing, Uuid } from "@tai-kun/surrealdb/standard-datatypes"; function isUserRecordId(thing: unknown): thing is Thing<"user", Uuid> { return thing instanceof Thing @@ -159,9 +159,9 @@ function isUserRecordId(thing: unknown): thing is Thing<"user", Uuid> { } ``` -#### `Thing` 객체의 범용적인 판단 +#### `Thing` 객체의 일반적인 판별 -프리셋에 의존하지 않고 값이 `Thing` 객체인지 판단하려면 `isThing` 함수를 사용하는 것이 좋습니다. 이 함수는 `instanceof`를 사용하지 않으므로 검증할 값의 프리셋이 불명확한 경우에 유용합니다. +프리셋에 의존하지 않고 값이 `Thing` 객체인지 판별하려면 `isThing` 함수를 사용하는 것이 좋습니다. 이 함수는 `instanceof`를 사용하지 않으므로, 검증할 값의 프리셋이 불분명할 때 유용합니다. ```ts import { isThing } from "@tai-kun/surrealdb"; diff --git a/docs/cache/ja2ko/content/v2/api/data/uuid.mdx b/docs/cache/ja2ko/content/v2/api/data/uuid.mdx index b7c8e45d..0338178b 100644 --- a/docs/cache/ja2ko/content/v2/api/data/uuid.mdx +++ b/docs/cache/ja2ko/content/v2/api/data/uuid.mdx @@ -5,14 +5,14 @@ slug: ko/v2/api/data/uuid import Badge from "~/components/ko/Badge.astro"; -UUID(Universally Unique Identifier)는 특정 엔티티를 고유하게 식별하기 위해 사용되는 128비트 식별자입니다. `Uuid`는 이를 표현하기 위한 클래스입니다. UUID v1부터 v7까지 지원합니다. UUID를 생성하려면 별도의 라이브러리 또는 런타임에 내장된 기능(`node:crypto` 등)을 사용해야 합니다. +UUID(Universally Unique Identifier)는 특정 엔터티를 고유하게 식별하는 데 사용되는 128비트 식별자입니다. `Uuid`는 이를 표현하기 위한 클래스입니다. UUID v1부터 v7까지 지원합니다. UUID를 생성하려면 별도의 라이브러리 또는 런타임에 내장된 기능(`node:crypto` 등)을 사용해야 합니다. -### 임포트 +### 가져오기 ```ts -import { Uuid } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Uuid } from "@tai-kun/surrealdb/data-types/encodable"; -import { Uuid } from "@tai-kun/surrealdb/data-types/standard"; +import { Uuid } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Uuid } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Uuid } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -28,11 +28,11 @@ new Uuid(source: Uint8Array | string); // standard ##### `source` -UUID의 바이트 배열 표현 또는 standard 프리셋이라면 문자열입니다. +UUID의 바이트 배열 표현 또는 standard 프리셋이면 문자열입니다. #### 반환 값 -`new`를 통해 호출될 경우 `Uuid`는 해당 인스턴스를 반환합니다. +`new`를 통해 호출된 경우 `Uuid`는 해당 인스턴스를 반환합니다. ### `.bytes` @@ -44,7 +44,7 @@ UUID의 바이트 배열입니다. ### `.variant` -UUID의 변형입니다. 이는 UUID의 13번째 비트의 상위 비트로 정의되며, 다음의 3가지 주요 변형과 미래를 위해 예약된 1가지 변형이 있습니다. +UUID의 변형입니다. 이는 UUID의 13번째 비트의 상위 비트로 정의되며, 다음과 같은 3가지 주요 변형과 미래를 위한 예약된 변형이 하나 있습니다. 1. NCS 호환 - `0b0xxx` @@ -52,15 +52,15 @@ UUID의 변형입니다. 이는 UUID의 13번째 비트의 상위 비트로 정 - 일반적으로 사용되지 않습니다. 2. RFC 4122 호환 - `0b10xx` - - RFC 4122(UUID 표준 사양) 기반 UUID입니다. - - 일반적으로 사용되는 UUID 형식입니다. v1(시간 기반) 및 v4(랜덤)과 같은 형식이 포함됩니다. + - RFC 4122(UUID 표준 사양)에 따른 UUID입니다. + - 일반적으로 사용되는 UUID 형식입니다. v1(시간 기반) 또는 v4(랜덤)와 같은 형식이 포함됩니다. 3. Microsoft GUID 호환 - `0b110x` - - Microsoft에서 사용하는 GUID(Globally Unique Identifier) 형식입니다. + - Microsoft에서 사용하는 GUID(Globally Unique Identifier)의 형식입니다. 4. 미래를 위해 예약됨 - `0b111x` -이 프로퍼티는 위 변형 외에 NIL UUID와 MAX UUID도 표현합니다. +이 속성은 위의 변형 외에도 NIL UUID와 MAX UUID도 표현합니다. ```ts .variant: @@ -74,7 +74,7 @@ UUID의 변형입니다. 이는 UUID의 13번째 비트의 상위 비트로 정 ### `.version` -UUID의 변형이 `"RFC"`라면, UUID 버전 번호입니다. 그렇지 않으면 `null`입니다. +UUID의 변형이 `"RFC"`이면 UUID 버전 번호입니다. 그렇지 않으면 `null`입니다. ```ts .version: 1 | 2 | 3 | 4 | 5 | 6 | 7 | null; @@ -82,7 +82,7 @@ UUID의 변형이 `"RFC"`라면, UUID 버전 번호입니다. 그렇지 않으 ### `.timestamp` -UUID의 변형이 `"RFC"`이고 버전이 v1, v6, v7 중 하나라면, 타임스탬프 부분입니다. 그렇지 않으면 `null`입니다. 편의상, 타임스탬프는 모두 UNIX 에포크부터 밀리초 단위로 계산됩니다. +UUID의 변형이 `"RFC"`이고 버전이 v1, v6, v7 중 하나이면 타임스탬프 부분입니다. 그렇지 않으면 `null`입니다. 편의상 타임스탬프는 모두 UNIX 에포크부터 밀리초로 계산됩니다. ```ts .timestamp: number | null; @@ -90,9 +90,9 @@ UUID의 변형이 `"RFC"`이고 버전이 v1, v6, v7 중 하나라면, 타임스 ### `.toString()` -`Uuid` 객체를 SurrealQL 변수에서 사용 가능한 문자열로 변환합니다. +`Uuid` 객체를 SurrealQL 변수에서 사용할 수 있는 문자열로 변환합니다. -`.valueOf()`와 `.toJSON()`은 이 메서드와 동일한 결과를 반환합니다. +`.valueOf()`와 `.toJSON()`은 이 메서드와 같은 결과를 반환합니다. ```ts .toString(): string; @@ -109,7 +109,7 @@ UUID의 변형이 `"RFC"`이고 버전이 v1, v6, v7 중 하나라면, 타임스 #### 예 ```ts -import { Uuid } from "@tai-kun/surrealdb/data-types/encodable"; +import { Uuid } from "@tai-kun/surrealdb/encodable-datatypes"; const bytes = new Uint8Array([ 0x26, 0xc8, 0x01, 0x63, @@ -125,7 +125,7 @@ console.log(uuid.toString()); ### `.toSurql()` -`Uuid` 객체를 SurrealQL에 삽입 가능한 문자열로 변환합니다. `.toString()`과 유사하지만 `u` 접두사를 추가하여 쿼리 파서에게 문자열이 UUID임을 알립니다. +`Uuid` 객체를 SurrealQL에 삽입할 수 있는 문자열로 변환합니다. `.toString()`과 비슷하지만 `u` 접두사를 추가하여 쿼리 파서에 문자열이 UUID임을 알립니다. ```ts .toSurql(): string; @@ -142,7 +142,7 @@ console.log(uuid.toString()); #### 예 ```ts -import { Uuid } from "@tai-kun/surrealdb/data-types/encodable"; +import { Uuid } from "@tai-kun/surrealdb/encodable-datatypes"; const bytes = new Uint8Array([ 0x26, 0xc8, 0x01, 0x63, @@ -170,7 +170,7 @@ console.log(uuid.toSurql()); #### 반환 값 -새로운 `Uuid` 객체를 반환합니다. `Uuid` 클래스를 상속받은 경우 해당 클래스의 인스턴스를 반환합니다. +새로운 `Uuid` 객체를 반환합니다. `Uuid` 클래스를 상속하는 경우 해당 클래스의 인스턴스가 반환됩니다. ### `.compareTo()` @@ -188,14 +188,14 @@ console.log(uuid.toSurql()); #### 반환 값 -양쪽 중 하나에 타임스탬프 부분이 없거나, 타임스탬프가 같으면 `0`을 반환합니다. 비교 대상 UUID의 타임스탬프가 더 빠른 시간이면 `-1`을, 더 늦은 시간이면 `1`을 반환합니다. +둘 중 하나에 타임스탬프 부분이 없거나 타임스탬프가 같으면 `0`을 반환합니다. 비교 대상 UUID의 타임스탬프가 더 이후 시간이면 `-1`, 더 이전 시간이면 `1`을 반환합니다. #### 예 -다음 예에서는, 서로 다른 UUID 버전의 타임스탬프를 비교하여 오름차순으로 정렬합니다: +다음 예에서는 서로 다른 UUID 버전의 타임스탬프를 비교하여 오름차순으로 정렬합니다. ```ts -import { Uuid } from "@tai-kun/surrealdb/data-types/standard"; +import { Uuid } from "@tai-kun/surrealdb/standard-datatypes"; const uuidv1 = new Uuid("0e004000-2073-11ef-8451-eb2a011f8691"); const uuidv6 = new Uuid("1ef1fa9e-3968-6000-a77e-683eb1a35ebe"); @@ -219,11 +219,11 @@ console.log(uuidList); //-> ] ``` -### 발전 +### 개발 -#### `Uuid` 객체의 범용적인 판정 +#### `Uuid` 객체의 범용적인 판별 -프리셋에 의존하지 않고 값이 `Uuid` 객체인지 판정하려면 `isUuid` 함수를 사용하는 것을 권장합니다. 이 함수는 `instanceof`를 사용하지 않으므로 검증할 값의 프리셋이 불분명한 경우 유용합니다. +프리셋에 의존하지 않고 값이 `Uuid` 객체인지 판별하려면 `isUuid` 함수를 사용하는 것이 좋습니다. 이 함수는 `instanceof`를 사용하지 않으므로 확인할 값의 프리셋이 불분명한 경우 유용합니다. ```ts import { isUuid } from "@tai-kun/surrealdb"; diff --git a/docs/cache/ja2ko/content/v2/getting-started.mdx b/docs/cache/ja2ko/content/v2/getting-started.mdx index 4f9ef036..9e409e07 100644 --- a/docs/cache/ja2ko/content/v2/getting-started.mdx +++ b/docs/cache/ja2ko/content/v2/getting-started.mdx @@ -30,7 +30,7 @@ import { Tabs, TabItem } from "@astrojs/starlight/components"; -## 사용해 보기 +## 사용 방법 ```ts import { Surreal } from "@tai-kun/surrealdb"; @@ -48,13 +48,13 @@ try { } ``` -## 사용자 정의 +## 사용자 지정 ```ts import { initSurreal } from "@tai-kun/surrealdb"; -import Client from "@tai-kun/surrealdb/clients/standard"; -import HttpEngine from "@tai-kun/surrealdb/engines/http"; -import JsonFormatter from "@tai-kun/surrealdb/formatters/json"; +import Client from "@tai-kun/surrealdb/standard-client"; +import HttpEngine from "@tai-kun/surrealdb/http-engine"; +import JsonFormatter from "@tai-kun/surrealdb/json-formatter"; const { Surreal } = initSurreal({ Client: Client, diff --git a/docs/cache/ja2ko/content/v2/guides/errors.mdx b/docs/cache/ja2ko/content/v2/guides/errors.mdx index 2f82a1f8..61cdba7e 100644 --- a/docs/cache/ja2ko/content/v2/guides/errors.mdx +++ b/docs/cache/ja2ko/content/v2/guides/errors.mdx @@ -1,103 +1,103 @@ --- -title: 에러 +title: 오류 slug: ko/v2/guides/errors --- ## 소개 -일부 에러 객체에는 `.cause` 속성이 설정되어 있을 수 있습니다. 대부분의 경우 `unknown` 유형이며, 값은 추후 예고 없이 변경될 수 있습니다. +일부 오류 객체에는 `.cause` 속성이 설정되어 있을 수 있습니다. 대부분의 경우 `unknown` 유형이며 값은 향후 예고 없이 변경될 수 있습니다. ## 일반 ### SurrealError -`SurrealError`는 이 SDK가 명시적으로 던지는 대부분의 에러 객체가 상속하는 기본 클래스입니다. 이 클래스는 JavaScript의 `Error` 클래스를 상속합니다. 이 에러 객체가 단독으로 던져지는 경우는 거의 없으며, 기본적으로 상속받은 특별한 의미를 가진 에러 객체가 던져집니다. `try-catch` 구문 등으로 잡힌 에러가 이 SDK가 명시적으로 던진 에러인지 쉽게 분류하기 위해 사용하는 것을 권장합니다. +`SurrealError`는 이 SDK에서 명시적으로 throw되는 오류 객체의 대부분이 상속하는 기본 클래스입니다. 이 클래스는 JavaScript의 `Error` 클래스를 상속합니다. 이 오류 객체가 단독으로 throw되는 경우는 거의 없으며, 일반적으로 상속된 특정 의미를 가진 오류 객체가 throw됩니다. `try-catch` 구문 등을 사용하여 오류를 포착할 때 이 SDK에서 명시적으로 throw된 오류인지 쉽게 분류하기 위해 사용하는 것이 좋습니다. #### 속성 `.name: "SurrealError"` -: 에러 이름입니다. +: 오류 이름입니다. `.message` -: 에러 메시지입니다. +: 오류 메시지입니다. `.stack` -: 스택 트레이스가 기록될 수 있습니다. +: 스택 추적이 기록될 수 있습니다. `.cause` -: 에러가 발생한 원인이나 컨텍스트가 설정될 수 있습니다. +: 오류가 발생한 원인이나 컨텍스트가 설정될 수 있습니다. ### SurrealTypeError -상속: `SurrealError` +상속 원본: `SurrealError` -이는 입력 값이나 기타 검증에 실패한 경우 던져지는 에러입니다. +입력 값 또는 기타 검증에 실패한 경우 throw되는 오류입니다. #### 속성 `.name: "SurrealTypeError"` -: 에러 이름입니다. +: 오류 이름입니다. `.expected` -: 예상되는 데이터 형식입니다. +: 예상 데이터 형식입니다. `.actual` : 실제 값의 문자열 표현입니다. #### 해결책 -스택 트레이스를 따라 예상되는 데이터 형식이 입력되지 않는 원인을 찾습니다. +스택 추적을 따라 예상되는 데이터 형식이 입력되지 않는 원인을 찾습니다. ### SurrealValueError -상속: `SurrealError` +상속 원본: `SurrealError` -이는 입력 값이나 기타 검증에 실패한 경우 던져지는 에러입니다. +입력 값 또는 기타 검증에 실패한 경우 throw되는 오류입니다. #### 속성 `.name: "SurrealValueError"` -: 에러 이름입니다. +: 오류 이름입니다. `.expected` -: 예상되는 데이터 형식입니다. +: 예상 데이터 형식입니다. `.actual` : 실제 값입니다. #### 해결책 -스택 트레이스를 따라 예상되는 데이터 형식이 입력되지 않는 원인을 찾습니다. +스택 추적을 따라 예상되는 데이터 형식이 입력되지 않는 원인을 찾습니다. ### SurrealAggregateError -상속: `SurrealError` +상속 원본: `SurrealError` -이는 여러 에러나 에러 메시지가 모아진 에러입니다. +여러 오류 또는 오류 메시지가 결합된 오류입니다. #### 속성 `.name: "SurrealAggregateError"` -: 에러 이름입니다. +: 오류 이름입니다. `.cause: unknown[]` -: 배열의 각 요소에 에러나 에러 메시지 등이 포함되어 있습니다. +: 배열의 각 요소에 오류 또는 오류 메시지 등이 포함되어 있습니다. ### CircularReferenceError -상속: `SurrealError` +상속 원본: `SurrealError` -이는 순환 참조를 감지한 경우 던져지는 에러입니다. 주로 JavaScript 값을 다른 형식으로 변환하는 과정에서 부모 객체와 동일한 객체가 감지된 경우 던져집니다. +순환 참조를 감지한 경우 throw되는 오류입니다. 주로 JavaScript 값을 다른 형식으로 변환하는 과정에서 부모 객체와 동일한 객체가 감지된 경우 throw됩니다. #### 속성 `.name: "CircularReferenceError"` -: 에러 이름입니다. +: 오류 이름입니다. `.reference: unknown` : 순환 참조가 발생한 값입니다. -예를 들어 다음과 같은 경우 이 에러가 던져집니다. +예를 들어 다음과 같은 경우에 이 오류가 throw됩니다: ```ts import { toSurql } from "@tai-kun/surrealdb/utils"; @@ -112,21 +112,21 @@ toSurql(a); // throws CircularReferenceError #### 해결책 -이 에러는 `toSurql` 함수 이외에도 던져지는 일반적인 에러입니다. 객체 내부에 그 객체 자체가 포함되어 있는지 신중하게 디버깅해야 합니다. +이 오류는 `toSurql` 함수 외에도 일반적인 오류로 throw될 수 있습니다. 객체 내부에 그 객체 자체가 포함되어 있는지 신중하게 디버깅해야 합니다. ### NumberRangeError -상속: `SurrealError` +상속 원본: `SurrealError` -이는 숫자가 범위를 벗어난 값을 가진 경우 던져지는 에러입니다. +숫자가 범위를 벗어난 값을 가진 경우 throw되는 오류입니다. #### 속성 `.name: "NumberRangeError"` -: 에러 이름입니다. +: 오류 이름입니다. `.range` -: 예상되는 범위입니다. +: 예상 범위입니다. `.actual` : 실제 값입니다. @@ -136,33 +136,33 @@ toSurql(a); // throws CircularReferenceError #### 해결책 -스택 트레이스를 따라 예상되는 데이터 형식이 입력되지 않는 원인을 찾습니다. +스택 추적을 따라 예상되는 데이터 형식이 입력되지 않는 원인을 찾습니다. ### UnsupportedRuntimeError -상속: `SurrealError` +상속 원본: `SurrealError` -이는 지원되지 않는 런타임을 사용하고 있다고 판단된 경우 던져지는 에러입니다. +지원되지 않는 런타임을 사용하고 있다고 판단된 경우 throw되는 오류입니다. #### 속성 `.name: "UnsupportedRuntimeError"` -: 에러 이름입니다. +: 오류 이름입니다. #### 해결책 -해당 런타임을 사용하지 않거나, 폴리필을 사용하여 충분히 테스트해야 합니다. +해당 런타임을 사용하지 않거나 폴리필을 사용하여 충분히 테스트해야 합니다. ### UnreachableError -상속: `SurrealError` +상속 원본: `SurrealError` -이는 도달할 수 없는 코드에 도달한 경우 던져지는 에러입니다. 이 에러가 던져진 경우, 아마도 이 SDK의 버그를 만난 것으로 판단할 수 있습니다. +도달할 수 없는 코드에 도달한 경우 throw되는 오류입니다. 이 오류가 throw된 경우 이 SDK의 버그를 만난 것일 가능성이 높습니다. #### 속성 `.name: "UnreachableError"` -: 에러 이름입니다. +: 오류 이름입니다. #### 해결책 @@ -174,22 +174,22 @@ toSurql(a); // throws CircularReferenceError ### CircularEngineReferenceError -상속: `CircularReferenceError` +상속 원본: `CircularReferenceError` -이는 데이터베이스에 연결할 때, 엔진 간에 순환 참조가 발생한 경우 던져지는 에러입니다. +데이터베이스에 연결할 때 엔진 간에 순환 참조가 발생한 경우 throw되는 오류입니다. #### 속성 `.name: "CircularEngineReferenceError"` -: 에러 이름입니다. +: 오류 이름입니다. `.reference: string` : 순환 참조가 발생한 스키마 이름입니다. `.seen: string[]` -: 순환 참조가 발생하기 전에 거친 스키마 이름 목록입니다. +: 순환 참조가 발생할 때까지 거친 스키마 이름 목록입니다. -예를 들어 다음과 같은 경우 이 에러가 던져집니다. +예를 들어 다음과 같은 경우에 이 오류가 throw됩니다: ```ts import { initSurreal } from "@tai-kun/surrealdb"; @@ -206,15 +206,15 @@ await using db = new Surreal(); await db.connect("https://localhost:8000"); // throws CircularEngineReferenceError: Circular engine reference: http,https ``` -위 예제에서는 https 프로토콜 엔진이 http에 설정된 엔진을 사용하도록 지정했지만, http 프로토콜 엔진은 https에 설정된 엔진을 사용하려고 하기 때문에 순환 참조 에러가 던져집니다. +위 예에서 https 프로토콜 엔진은 http에 설정된 엔진을 사용하도록 지정되어 있지만 http 프로토콜 엔진은 https에 설정된 엔진을 사용하려고 하기 때문에 순환 참조 오류가 throw됩니다. #### 해결책 -문자열로 지정된 프로토콜 이름을 다른 프로토콜 이름의 값으로 설정하지 않고, 대신 엔진을 만드는 구체적인 구현으로 대체합니다. +문자열로 지정된 프로토콜 이름을 다른 프로토콜 이름의 값으로 설정하는 대신 엔진을 생성하는 구체적인 구현으로 바꿉니다: ```ts del={6} ins={7-10} import { initSurreal } from "@tai-kun/surrealdb"; -import HttpEngine from "@tai-kun/surrealdb/engines/http"; +import HttpEngine from "@tai-kun/surrealdb/http-engine"; const { Surreal } = initSurreal({ engines: { @@ -231,19 +231,19 @@ const { Surreal } = initSurreal({ ### EngineNotFoundError -상속: `SurrealError` +상속 원본: `SurrealError` -이는 엔진이 설정되지 않은 프로토콜로 연결하려고 했을 때 던져지는 에러입니다. +엔진이 설정되지 않은 프로토콜로 연결하려고 시도한 경우 throw되는 오류입니다. #### 속성 `.name: "EngineNotFoundError"` -: 에러 이름입니다. +: 오류 이름입니다. `.scheme: string` : 연결할 프로토콜 이름입니다. -예를 들어 다음과 같은 경우 이 에러가 던져집니다. +예를 들어 다음과 같은 경우에 이 오류가 throw됩니다: ```ts import { initSurreal } from "@tai-kun/surrealdb"; @@ -261,7 +261,7 @@ await db.connect("https://localhost:8000"); // throws EngineNotFoundError: No ht #### 해결책 -연결할 엔드포인트의 프로토콜로 엔진을 만들 수 있는지 `engines` 속성을 확인합니다. +연결할 엔드포인트의 프로토콜로 엔진을 생성할 수 있는지 `engines` 속성을 확인합니다. ```ts ins={6} import { initSurreal } from "@tai-kun/surrealdb"; @@ -277,14 +277,14 @@ const { Surreal } = initSurreal({ ### ConnectionConflictError -상속: `SurrealError` +상속 원본: `SurrealError` -이는 클라이언트가 여러 엔드포인트에 동시에 연결하려고 했을 때 던져지는 에러입니다. +클라이언트가 여러 엔드포인트에 동시에 연결하려고 시도한 경우 throw되는 오류입니다. #### 속성 `.name: "ConnectionConflictError"` -: 에러 이름입니다. +: 오류 이름입니다. `.endpoint1: string` : 이미 연결된 엔드포인트입니다. @@ -301,7 +301,7 @@ await db.connect("ws://localhost:8000"); await db.connect("ws://localhost:1129"); // throws ConnectionConflictError: An attempt was made to connect to ws://localhost:1129/rpc while ws://localhost:8000/rpc was already connected. ``` -`.connect` 메서드는 전달된 URL의 경로가 `/rpc`로 끝나지 않는 경우, 그것을 끝에 추가합니다. 따라서, 한쪽 엔드포인트의 URL 경로가 `/rpc`로 끝나는 경우, 외관상으로는 에러가 발생하지 않을 수 있습니다. +`.connect` 메서드는 전달된 URL의 경로가 `/rpc`로 끝나지 않는 경우 이를 맨 뒤에 추가합니다. 따라서 한쪽 엔드포인트의 URL 경로가 `/rpc`로 끝나는 경우 외관상으로는 오류가 발생하지 않을 수 있습니다. ```ts import { Surreal } from "@tai-kun/surrealdb"; @@ -323,7 +323,7 @@ await db.connect("http://localhost:8000"); // OK! #### 해결책 -`.connect` 메서드를 호출하기 전에 `.close` 메서드를 호출하면 원하는 엔드포인트에 연결할 수 있습니다. +`.connect` 메서드를 호출하기 전에 `.close` 메서드를 호출하여 원하는 엔드포인트에 연결할 수 있습니다. ```ts ins={6} import { Surreal } from "@tai-kun/surrealdb"; @@ -337,19 +337,19 @@ await db.connect("http://localhost:11298"); ### MissingNamespaceError -상속: `SurrealError` +상속 원본: `SurrealError` -이는 데이터베이스를 선택하기 전에 네임스페이스가 선택되지 않은 경우 던져지는 에러입니다. 또는, 데이터베이스를 선택한 상태로 네임스페이스를 미선택 상태로 만들려고 해도 던져집니다. +데이터베이스를 선택하기 전에 네임스페이스가 선택되지 않은 경우 throw되는 오류입니다. 또는 데이터베이스를 선택한 상태로 네임스페이스를 선택하지 않은 상태로 유지하려고 시도해도 throw됩니다. #### 속성 `.name: "MissingNamespaceError"` -: 에러 이름입니다. +: 오류 이름입니다. `.database: string` : 데이터베이스 이름입니다. -예를 들어 다음과 같은 경우 이 에러가 던져집니다. +예를 들어 다음과 같은 경우에 이 오류가 throw됩니다: ```ts import { Surreal } from "@tai-kun/surrealdb"; @@ -364,7 +364,7 @@ await db.use({ #### 해결책 -데이터베이스를 선택하는 경우 네임스페이스도 선택하도록 합니다. +데이터베이스를 선택하는 경우 네임스페이스도 함께 선택합니다. ```ts ins={7} import { Surreal } from "@tai-kun/surrealdb"; @@ -380,40 +380,40 @@ await db.use({ ### RpcResponseError -상속: `SurrealError` +상속 원본: `SurrealError` -이는 RPC 응답이 에러를 나타내는 경우 던져지는 에러입니다. 연결된 프로토콜을 통한 통신이나 응답 본문의 디코딩에는 문제가 없지만, SurrealDB가 RPC 요청을 처리할 수 없음을 의미합니다. +RPC 응답이 오류를 나타내는 경우 throw되는 오류입니다. 연결된 프로토콜에 의한 통신 또는 응답 본문 디코딩에 문제는 없지만 SurrealDB가 RPC 요청을 처리할 수 없음을 의미합니다. #### 속성 `.name: "RpcResponseError"` -: 에러 이름입니다. +: 오류 이름입니다. `.id?: string` : RPC 요청을 식별하는 ID입니다. ID는 항상 `<메서드 이름>_`으로 시작합니다. `.code: number` -: SurrealDB 문서에 명시되어 있지는 않지만, 아마도 JSON-RPC의 에러 코드일 것입니다. +: SurrealDB 문서에 명시되어 있지 않지만 아마도 JSON-RPC의 오류 코드일 것입니다. #### 해결책 -다양한 원인이 생각되지만, 이 SDK가 지원하는 SurrelDB 버전과 RPC 요청을 처리하는 SurrealDB 버전이 다른 경우일 수 있습니다. +다양한 원인이 있을 수 있지만 이 SDK에서 지원하는 SurrealDB 버전과 RPC 요청을 처리하는 SurrealDB 버전이 다른 가능성이 있습니다. ### QueryFailedError -상속: `SurrealAggregateError` +상속 원본: `SurrealAggregateError` -이는 쿼리가 실패한 경우 던져지는 에러입니다. +쿼리가 실패한 경우 throw되는 오류입니다. #### 속성 `.name: "QueryFailedError"` -: 에러 이름입니다. +: 오류 이름입니다. `.cause: string[]` -: 에러 목록입니다. +: 오류 목록입니다. -예를 들어 다음과 같은 경우 이 에러가 던져집니다. +예를 들어 다음과 같은 경우에 이 오류가 throw됩니다: ```ts await using db = new Surreal(); @@ -428,16 +428,16 @@ SurrelQL 구문이 올바른지 확인합니다. ### Closed -상속: `SurrealError` +상속 원본: `SurrealError` -이는 연결이 강제로 종료되었음을 나타내는 에러입니다. +연결이 강제로 종료되었음을 나타내는 오류입니다. #### 속성 `.name: "Closed"` -: 에러 이름입니다. +: 오류 이름입니다. -예를 들어 다음과 같은 경우 이 에러를 얻습니다. +예를 들어 다음과 같은 경우에 이 오류를 얻습니다: ```ts const db = new Surreal(); @@ -460,92 +460,92 @@ await db.close({ force: true }); ### EngineError -상속: `SurrealError` +상속 원본: `SurrealError` -이는 엔진에 의한 에러임을 나타냅니다. 이벤트 리스너를 통해 전송됩니다. +엔진에서 발생한 오류임을 나타냅니다. 이벤트 리스너를 통해 발송됩니다. #### 속성 `.name: "EngineError"` -: 에러 이름입니다. +: 오류 이름입니다. `.fatal: boolean | undefined` -: 이 에러가 치명적인지 여부를 나타냅니다. +: 이 오류가 치명적인지 여부를 나타냅니다. ### HttpEngineError -상속: `EngineError` +상속 원본: `EngineError` -이는 HTTP 엔진에 의한 에러임을 나타냅니다. 현재 정의만 되어 있으며, 사용되고 있지 않습니다. +HTTP 엔진에서 발생한 오류임을 나타냅니다. 현재 정의만 되어 있으며 사용되지 않습니다. #### 속성 `.name: "HttpEngineError"` -: 에러 이름입니다. +: 오류 이름입니다. ### WebSocketEngineError -상속: `EngineError` +상속 원본: `EngineError` -이는 WebSocket 엔진에 의한 에러임을 나타냅니다. RPC 요청을 식별하는 ID를 찾기 전에 응답 본문의 구문 분석에 실패했거나, WebSocket 객체에서 에러 이벤트를 받았거나, WebSocket 연결을 끊었을 때 등 사용됩니다. +WebSocket 엔진에서 발생한 오류임을 나타냅니다. RPC 요청을 식별하는 ID를 찾기 전에 응답 본문을 분석하는 데 실패하거나 WebSocket 객체에서 오류 이벤트를 받았거나 WebSocket 연결을 끊은 경우 등에 사용됩니다. -이 SDK에서는 `315x`를 사용자 지정 상태 코드로 사용합니다. 이 범위는 [IANA](https://www.iana.org/assignments/websocket/websocket.xml#close-code-number)에서 할당되지 않은 상태 코드입니다. +이 SDK는 `315x`를 사용자 지정 상태 코드로 사용합니다. 이 범위는 [IANA](https://www.iana.org/assignments/websocket/websocket.xml#close-code-number)에서는 할당되지 않은 상태 코드입니다. #### 속성 `.name: "WebSocketEngineError"` -: 에러 이름입니다. +: 오류 이름입니다. `.code: number` -: 다음 상태 코드 중 하나입니다. +: 다음 상태 코드 중 하나입니다: - `1000`~`1015`: [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/code) - `3150`: `WebSocket`[^1] 인스턴스에서 "error" 이벤트를 받았음을 나타냅니다. - - `3151`: WebSocket 엔진이 등록한 "open" 이벤트 핸들러 내에서 에러가 발생했음을 나타냅니다. 연결 중 상태에서 연결 상태로 전환하는 과정에서 `StateTransitionError`가 발생한 경우가 대부분입니다. - - `3152`: WebSocket 엔진이 등록한 "message" 이벤트 핸들러 내에서 에러가 발생했음을 나타냅니다. 다양한 원인이 생각되지만, 이벤트 핸들러 내에서 `ServerResponseError` 또는 `RpcResponseError`가 던져졌을 가능성이 높습니다. 잘못된 RPC 매개 변수로 요청했기 때문일 수 있습니다. 이 경우, RPC 호출의 원래 메서드는 (기본적으로) 5초 후에 타임 아웃되어 실패합니다. SurrealDB v2.0.2 이전 버전에서는 더 광범위한 원인으로 타임 아웃될 수 있습니다. - - `3153`: ping의 송수신에 실패했음을 나타냅니다. 일시적인 에러일 수 있지만, 지속적으로 받고 있다면 연결을 유지하지 못하고 있을 가능성이 있습니다. - - `3154`: WebSocket 엔진이 등록한 "close" 이벤트 핸들러 내에서 에러가 발생했음을 나타냅니다. 연결 해제 중 상태에서 연결 해제 상태로 전환하는 과정에서 `StateTransitionError`가 발생한 경우가 대부분입니다. -: 참고로, 위에서 다음 상태 코드를 제외합니다. 이 SDK에서는 에러로 처리하지 않습니다. - - `1000`: 정상적으로 연결이 해제되었습니다. - - `1001`: 조기 연결 해제는 흔히 있습니다. - - `1004`: 예약되었습니다. - - `1005`: 예약되었습니다. - - `1006`: 예약되었습니다. - - `1015`: 예약되었습니다. - -^1: `WebSocket`는 런타임이 전역 변수에 정의한 클래스이거나, `ws`의 클래스일 수 있습니다. + - `3151`: WebSocket 엔진이 등록한 "open" 이벤트 핸들러에서 오류가 발생했음을 나타냅니다. 연결 중 상태에서 연결 상태로 전환하는 동안 `StateTransitionError`가 발생하는 경우가 대부분입니다. + - `3152`: WebSocket 엔진이 등록한 "message" 이벤트 핸들러에서 오류가 발생했음을 나타냅니다. 다양한 원인이 있을 수 있지만 이벤트 핸들러에서 `ServerResponseError` 또는 `RpcResponseError`가 throw된 가능성이 높습니다. 잘못된 RPC 매개변수로 요청한 것이 원인일 수 있습니다. 이 경우 RPC 호출의 원본 메서드는 (기본적으로) 5초 후에 타임아웃되어 실패합니다. SurrealDB v2.0.2 이전 버전에서는 더 광범위한 원인으로 타임아웃될 수 있습니다. + - `3153`: ping을 송수신하는 데 실패했음을 나타냅니다. 일시적인 오류일 수 있지만 계속해서 받는 경우 연결을 유지하지 못하고 있을 가능성이 있습니다. + - `3154`: WebSocket 엔진이 등록한 "close" 이벤트 핸들러에서 오류가 발생했음을 나타냅니다. 연결 해제 중 상태에서 연결 해제 상태로 전환하는 동안 `StateTransitionError`가 발생하는 경우가 대부분입니다. +: 위에서 다음 상태 코드를 제외합니다. 이 SDK에서는 오류로 처리하지 않습니다. + - `1000`: 정상적으로 연결 해제되었습니다. + - `1001`: 조기 연결 해제는 흔히 발생합니다. + - `1004`: 예약됨. + - `1005`: 예약됨. + - `1006`: 예약됨. + - `1015`: 예약됨. + +^1: `WebSocket`은 런타임에서 전역 변수에 정의된 클래스이거나 `ws`의 클래스일 수 있습니다. #### 해결책 `1002`,`1003`,`1007`...`1011`,`1014`,`3150`,`3151`,`3154` -: 이 상태 코드에서 자동으로 복구하는 방법은 아마도 없을 것입니다. 런타임이나 SurrealDB 설정, 하드코딩된 구현을 수정해야 합니다. +: 이 상태 코드에서 자동으로 복구하는 방법은 아마 없을 것입니다. 런타임 또는 SurrealDB 설정, 하드코딩된 구현을 수정해야 합니다. `3152` -: 메서드에 전달한 인수(즉, RPC 요청의 내용)가 올바른지 확인합니다. +: 메서드에 전달된 인수(즉, RPC 요청의 내용)가 올바른지 확인합니다. `1012`,`1013`,`3153` : 실험적인 기능인 [`autoReconnect()`](/v2/experimental/auto-reconnect)를 사용하여 자동으로 복구할 수 있습니다. ### StateTransitionError -상속: `SurrealAggregateError` +상속 원본: `SurrealAggregateError` -이는 상태 전환 중에 이벤트 리스너의 실행에 실패한 경우 던져지는 에러입니다. +상태 전환 중에 이벤트 리스너 실행에 실패한 경우 throw되는 오류입니다. #### 속성 `.name: "StateTransitionError"` -: 에러 이름입니다. +: 오류 이름입니다. `.from: string` : 상태 전환 시작 시의 상태입니다. `.to: string` -: 전환할 상태입니다. +: 전환할 대상 상태입니다. `.fallback: string` -: 상태 전환에 실패한 경우 대신 전환할 상태입니다. `.to`와 동일한 값이면, 강제로 전환했음을 의미합니다. +: 상태 전환에 실패한 경우 대체 전환할 대상입니다. `.to`와 동일한 값이면 강제로 전환되었음을 의미합니다. -예를 들어 다음과 같은 경우 이 에러가 던져집니다. +예를 들어 다음과 같은 경우에 이 오류가 throw됩니다: ```ts import { Surreal } from "@tai-kun/surrealdb"; @@ -571,93 +571,93 @@ await db.connect("http://localhost:8000"); // throws ... ### ConnectionUnavailableError -상속: `SurrealError` +상속 원본: `SurrealError` -이는 연결되지 않은 상태에서 RPC 요청을 보내려고 했을 때 던져지는 에러입니다. +연결되지 않은 상태에서 RPC 요청을 보내려고 시도한 경우 throw되는 오류입니다. #### 속성 `.name: "ConnectionUnavailableError"` -: 에러 이름입니다. +: 오류 이름입니다. ### ServerResponseError -상속: `SurrealError` +상속 원본: `SurrealError` -이는 응답을 PRC 응답으로 구문 분석할 수 없는 경우 던져지는 에러입니다. `RpcResponseError`와는 다릅니다. +응답을 PRC 응답으로 분석할 수 없는 경우 throw되는 오류입니다. `RpcResponseError`와 다릅니다. #### 속성 `.name: "ServerResponseError"` -: 에러 이름입니다. +: 오류 이름입니다. #### 해결책 -일반적으로 이 에러가 던져지는 일은 없어야 하지만, 만약 던져졌다면, 이 SDK가 지원하는 SurrelDB 버전과 RPC 요청을 처리하는 SurrealDB 버전이 다른 경우일 수 있습니다. +일반적으로 이 오류가 throw되는 경우는 없어야 하지만 throw되는 경우 이 SDK에서 지원하는 SurrealDB 버전과 RPC 요청을 처리하는 SurrealDB 버전이 다른 가능성이 있습니다. ## CBOR ### CborError -상속: `SurrealError` +상속 원본: `SurrealError` -이는 `@tai-kun/surrealdb/cbor`가 명시적으로 던지는, CBOR와 관련된 모든 에러가 상속하는 클래스입니다. 이것이 직접 던져지는 경우는 없습니다. +`@tai-kun/surrealdb/cbor`가 명시적으로 throw하는 CBOR 관련 모든 오류가 상속하는 클래스입니다. 이것이 직접 throw되는 경우는 없습니다. #### 속성 `.name: "CborError"` -: 에러 이름입니다. +: 오류 이름입니다. ### CborWellFormednessError -상속: `CborError` +상속 원본: `CborError` #### 속성 -이는 `@tai-kun/surrealdb/cbor`가 명시적으로 던지는, CBOR의 디코딩과 관련된 모든 에러가 상속하는 클래스입니다. 이것이 직접 던져지는 경우는 없습니다. +`@tai-kun/surrealdb/cbor`가 명시적으로 throw하는 CBOR 디코딩 관련 모든 오류가 상속하는 클래스입니다. 이것이 직접 throw되는 경우는 없습니다. -RFC8949의 부록 F에 있는 "Well-Formedness Errors and Examples](https://datatracker.ietf.org/doc/html/rfc8949#name-well-formedness-errors-and-)"을 참조하십시오. +RFC8949의 부록 F에 있는 "\[Well-Formedness Errors and Examples](https://datatracker.ietf.org/doc/html/rfc8949#name-well-formedness-errors-and-)"를 참조합니다. `.name: "CborWellFormednessError"` -: 에러 이름입니다. +: 오류 이름입니다. ### CborTooMuchDataError -상속: `CborWellFormednessError` +상속 원본: `CborWellFormednessError` -이는 소비되지 않은 입력 바이트가 남아 있음을 나타냅니다. +소비되지 않은 입력 바이트가 남아 있음을 나타냅니다. [RFC8949](https://datatracker.ietf.org/doc/html/rfc8949#section-appendix.f-2.2) #### 속성 `.name: "CborTooMuchDataError"` -: 에러 이름입니다. +: 오류 이름입니다. #### 해결책 -디코딩 대상 바이트 배열이 올바른 CBOR 형식인지 확인합니다. +디코딩할 바이트 배열이 올바른 CBOR 형식인지 확인합니다. ### CborTooLittleDataError -상속: `CborWellFormednessError` +상속 원본: `CborWellFormednessError` -이는 입력 바이트가 불완전함을 나타냅니다. +입력 바이트가 불완전함을 나타냅니다. [RFC8949](https://datatracker.ietf.org/doc/html/rfc8949#section-appendix.f-2.4) #### 속성 `.name: "CborTooLittleDataError"` -: 에러 이름입니다. +: 오류 이름입니다. #### 해결책 -디코딩 대상 바이트 배열이 올바른 CBOR 형식인지 확인합니다. +디코딩할 바이트 배열이 올바른 CBOR 형식인지 확인합니다. ### CborSyntaxError -상속: `CborWellFormednessError` +상속 원본: `CborWellFormednessError` 입력 바이트가 CBOR의 인코딩 형식과 일치하지 않음을 나타냅니다. @@ -666,32 +666,32 @@ RFC8949의 부록 F에 있는 "Well-Formedness Errors and Examples](https://data #### 속성 `.name: "CborSyntaxError"` -: 에러 이름입니다. +: 오류 이름입니다. #### 해결책 -디코딩 대상 바이트 배열이 올바른 CBOR 형식인지 확인합니다. +디코딩할 바이트 배열이 올바른 CBOR 형식인지 확인합니다. ### CborMaxDepthReachedError -상속: `CborError` +상속 원본: `CborError` -CBOR의 인코딩 또는 디코딩 중에 JavaScript 객체의 깊이가 최대값에 도달한 경우 던져지는 에러입니다. 객체 또는 배열에 들어갈 때마다 깊이가 1 증가합니다. +CBOR 인코딩 또는 디코딩 시 JavaScript 객체의 깊이가 최대 값에 도달한 경우 throw되는 오류입니다. 객체 또는 배열에 들어갈 때마다 깊이가 1 증가합니다. #### 속성 `.name: "CborMaxDepthReachedError"` -: 에러 이름입니다. +: 오류 이름입니다. `.maxDepth: number` : 최대 깊이입니다. #### 해결책 -옵션의 `.maxDepth` 상한선을 완화하거나, 객체의 중첩이 얕아지도록 데이터 구조를 재검토합니다. +옵션의 `.maxDepth` 상한을 완화하거나 객체의 중첩이 얕아지도록 데이터 구조를 재검토합니다. ```ts -import CborFormatter from "@tai-kun/surrealdb/formatters/cbor"; +import CborFormatter from "@tai-kun/surrealdb/cbor-formatter"; const cborFormatter = new CborFormatter({ encode: { @@ -706,14 +706,14 @@ const cborFormatter = new CborFormatter({ ### CborUnsafeMapKeyError -상속: `CborError` +상속 원본: `CborError` -CBOR의 인코딩 또는 디코딩 중에 안전하지 않은 맵 키가 발견되면 던져지는 에러입니다. +CBOR 인코딩 또는 디코딩 시 안전하지 않은 맵 키가 발견되면 throw되는 오류입니다. #### 속성 `.name: "CborUnsafeMapKeyError"` -: 에러 이름입니다. +: 오류 이름입니다. `.key: unknown` : 안전하지 않다고 판단된 맵 키입니다. @@ -722,25 +722,25 @@ CBOR의 인코딩 또는 디코딩 중에 안전하지 않은 맵 키가 발견 ### JsonError -상속: `SurrealError` +상속 원본: `SurrealError` -이는 `@tai-kun/surrealdb/formatters/json`이 명시적으로 던지는, JSON과 관련된 모든 에러가 상속하는 클래스입니다. 이것이 직접 던져지는 경우는 없습니다. +`@tai-kun/surrealdb/json`가 명시적으로 throw하는 JSON-formatter입니다. #### 속성 `.name: "JsonError"` -: 에러 이름입니다. +: 오류 이름입니다. ### JsonUnsafeMapKeyError -상속: `JsonError` +상속 원본: `JsonError` -JSON의 디코딩 중에 안전하지 않은 맵 키가 발견되면 던져지는 에러입니다. +JSON을 디코딩할 때 안전하지 않은 맵 키가 발견되면 throw되는 오류입니다. #### 속성 `.name: "JsonUnsafeMapKeyError"` -: 에러 이름입니다. +: 오류 이름입니다. `.key: unknown` : 안전하지 않다고 판단된 맵 키입니다. diff --git a/docs/cache/ja2ko/content/v2/supports.mdx b/docs/cache/ja2ko/content/v2/supports.mdx index 8a8fe3d2..27fa25dd 100644 --- a/docs/cache/ja2ko/content/v2/supports.mdx +++ b/docs/cache/ja2ko/content/v2/supports.mdx @@ -7,7 +7,7 @@ import { Aside } from "@astrojs/starlight/components" ## JavaScript -이 SDK는 `bigint`를 사용하므로 JavaScript 언어 사양으로 ES2020 이상이 필요합니다. 또한 이 SDK가 런타임에 요구하는 기능을 고려하면 다음 런타임에서 작동할 것으로 예상됩니다. +이 SDK는 `bigint`를 사용하기 때문에 ES2020 이상의 JavaScript 언어 사양이 필요합니다. 또한 이 SDK가 런타임에 요구하는 기능을 고려하면 다음 런타임에서 작동할 것으로 예상됩니다. | 런타임 | 버전 | | --- | --- | @@ -21,18 +21,18 @@ import { Aside } from "@astrojs/starlight/components" ## 테스트 -테스트에는 Vitest 및 Playwright를 사용합니다. 이들이 작동하는 최소 버전의 런타임에서 테스트하고 있으므로 실제로는 아래에 나열된 버전보다 이전 런타임에서도 작동할 수 있습니다. +테스트에는 Vitest와 Playwright를 사용합니다. 이들은 작동하는 최소 버전의 런타임에서 테스트되므로 실제로는 아래에 표시된 버전보다 이전 버전에서도 작동할 가능성이 있습니다. ### 서버 | 런타임 | 버전 | 상태 | | --- | --- | --- | | SurrealDB | `^2.0.0` | [GitHub](https://github.com/surrealdb/surrealdb) | -| Node.js | `18.x`,
`20.x`,
`^22.5.1` | [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/tai-kun/surrealdb.js/nodejs.yml?branch=main&logo=Node.js&label=Node.js)](https://github.com/tai-kun/surrealdb.js/actions/workflows/nodejs.yml) | +| Node.js | `18.x`,
`20.x`,
`^22.5.1`,
`23.x` | [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/tai-kun/surrealdb.js/nodejs.yml?branch=main&logo=Node.js&label=Node.js)](https://github.com/tai-kun/surrealdb.js/actions/workflows/nodejs.yml) | | Deno | `1.x`, `2.x` | [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/tai-kun/surrealdb.js/deno.yml?branch=main&logo=Deno&label=Deno)](https://github.com/tai-kun/surrealdb.js/actions/workflows/deno.yml) | | Bun | `^1.1.13` | [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/tai-kun/surrealdb.js/bun.yml?branch=main&logo=Bun&label=Bun)](https://github.com/tai-kun/surrealdb.js/actions/workflows/bun.yml) | -- Node.js v22를 사용하는 경우 아직 LTS가 아니라는 점에 유의하십시오. +- Node.js v22를 사용하는 경우, 아직 LTS가 아님을 유의하십시오. - Deno는 항상 최신 버전을 사용하는 것이 좋습니다. - Bun은 항상 최신 버전을 사용하는 것이 좋습니다. @@ -44,4 +44,4 @@ import { Aside } from "@astrojs/starlight/components" | Firefox | `>=100` | [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/tai-kun/surrealdb.js/firefox.yml?branch=main&logo=Firefox&label=Firefox)](https://github.com/tai-kun/surrealdb.js/actions/workflows/firefox.yml) | | WebKit | `>=15.4` | [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/tai-kun/surrealdb.js/webkit.yml?branch=main&style=flat&logo=safari&label=WebKit)](https://github.com/tai-kun/surrealdb.js/actions/workflows/webkit.yml) | -- 지원하는 브라우저(엔진)는 CI에서 Playwright가 작동하는 최소 버전과 일치합니다. 따라서 위 버전보다 낮더라도 작동할 수 있지만 테스트하지 않았습니다. +- 지원하는 브라우저(엔진)는 CI에서 Playwright가 작동하는 최소 버전과 일치합니다. 따라서 위 버전보다 낮더라도 작동할 가능성이 있지만 테스트하지 않았습니다. diff --git a/docs/cache/ja2ko/meta.json b/docs/cache/ja2ko/meta.json index 016f2284..8eb2d191 100644 --- a/docs/cache/ja2ko/meta.json +++ b/docs/cache/ja2ko/meta.json @@ -34,23 +34,23 @@ "src/content/docs/ja/v2/api/cbor/others.mdx": "b145d4dec91d19c1ba3f079439c6ae24f00d9f39df6c42f792fa26c759fbd151", "src/content/docs/ja/v2/api/cbor/simple.mdx": "049e4b39b3c8058d2ea6beb4cf02ad1354cbbb769614a0af9c826fbe6a9c4c61", "src/content/docs/ja/v2/api/cbor/tagged.mdx": "eaaccc73d7eede688d61a8df1bcce558520862902587e3b42a453e414b910f79", - "src/content/docs/ja/v2/api/data/bound-excluded.mdx": "535cee4e8e9c7b717e6c91793fd5b0c8e046e6d00b48d54e4155e73c8162251f", - "src/content/docs/ja/v2/api/data/bound-included.mdx": "7e0ed8b43323f0b1c598be745a0b007460e9a67893dc82df1888418dd0ebf26f", - "src/content/docs/ja/v2/api/data/datetime.mdx": "66c73131a99bf3730b4bb2e69972f0b8e34fd5d13db4db28e1a3c479cabf0b5b", - "src/content/docs/ja/v2/api/data/decimal.mdx": "305509f5ffdf5a138e118e8ac2bec8ed538346df2cd397743aacc226edd50fbb", - "src/content/docs/ja/v2/api/data/duration.mdx": "09d6f603708d7268137a018af36998e204b4e1b8939638602f1e712b4558a716", - "src/content/docs/ja/v2/api/data/future.mdx": "be260b3684e743d2e14441a49c9173c1a3eb5590a3959301854813ba45392f2c", - "src/content/docs/ja/v2/api/data/geometry-collection.mdx": "178d0402d33935e207792f3c7442ec7aed928100f55f5627672fbd136e7cd8a3", - "src/content/docs/ja/v2/api/data/geometry-line.mdx": "b6acb8a1b5fc40415bf351445fefd92db6bbad5c471f9f9b561920ca0174d9ef", - "src/content/docs/ja/v2/api/data/geometry-multi-line.mdx": "2fc6fc4df7d6fac208cf0e4d9602e9162202f33266028502fe51b61ca209cb40", - "src/content/docs/ja/v2/api/data/geometry-multi-point.mdx": "ade5c8cedde13cd8f3d6820fc06e29a7075f3ea74a8d97e3353c9a9adc4c2e0b", - "src/content/docs/ja/v2/api/data/geometry-multi-polygon.mdx": "f758b5d58aaef14de7015b09c569a5399b88a30bf891798c5ca85a6f3c416e2b", - "src/content/docs/ja/v2/api/data/geometry-point.mdx": "2b8ff579cd126d47ea463296767bc5b8cfb0d332bdc957f63a31b07ba54bf994", - "src/content/docs/ja/v2/api/data/geometry-polygon.mdx": "7fb7006ac2f9aaf13e83120307066db07b3775d8bce92a35ecb5d54618eb2dd4", - "src/content/docs/ja/v2/api/data/range.mdx": "7b04bf21730cf383680175086e77eb7dfaa7ffeb3dbad536e400e4aaf12dac40", - "src/content/docs/ja/v2/api/data/table.mdx": "63c1a17261ae912a3afb674f423c2b4f1cfecbc186f1e8b533427cd63dcd03d6", - "src/content/docs/ja/v2/api/data/thing.mdx": "ea726d56de0c2a77243139a82470bb478111315d9242557bed7d6693d36b4957", - "src/content/docs/ja/v2/api/data/uuid.mdx": "20c413705ca46443d160e9c862d89ec55c130fe5c3ffcc83d1e8a850b4bf2010", + "src/content/docs/ja/v2/api/data/bound-excluded.mdx": "4ca974c26583a19e18874b9e191436a954ff134c23b3aa33423f0844d5c70ec3", + "src/content/docs/ja/v2/api/data/bound-included.mdx": "d3f57a189634088ef6a1bfee925cc3780e64e5fa5c8d83d5666e7fcb3e7a8890", + "src/content/docs/ja/v2/api/data/datetime.mdx": "42b526d7a4b5861e78a29344fda693ed82f6a28e71e6e54924040035ac2178a9", + "src/content/docs/ja/v2/api/data/decimal.mdx": "5144af18ec3653860276629d66292954829c861aac6413a957f1e7bc26f16965", + "src/content/docs/ja/v2/api/data/duration.mdx": "1d41cea1aa0970ce9038db8caa17a681cc52c7992906c57d6ba469dbf2a9ac03", + "src/content/docs/ja/v2/api/data/future.mdx": "9b38aaae94064918d4095639fd0b520579045b43db2b7698b93b302ac565c01c", + "src/content/docs/ja/v2/api/data/geometry-collection.mdx": "2a030e60dac28ff7db1cf45c397d00f6895f2735ce1e9f9d8190de723cc06e14", + "src/content/docs/ja/v2/api/data/geometry-line.mdx": "25a97999d42ca7d9a7c57e1c62453886205f2c045c461f1ce73b0a77c8fcf56e", + "src/content/docs/ja/v2/api/data/geometry-multi-line.mdx": "1f9e43eea7ae478d66e83b83cb81c6c7beb6ce418f96f5321f852a703639d5bb", + "src/content/docs/ja/v2/api/data/geometry-multi-point.mdx": "38b69ae433d86367d40d3781f49ef6ad6c6ef040a837735825b03dc4a46b04c4", + "src/content/docs/ja/v2/api/data/geometry-multi-polygon.mdx": "e332a5723638d29f04234755b8fde0c3c9bfe2be4fb950e867154c62f8348f5e", + "src/content/docs/ja/v2/api/data/geometry-point.mdx": "b8b33e46ed3785d4f88825d460218a869c6093493ce810c5af12d7caa392f190", + "src/content/docs/ja/v2/api/data/geometry-polygon.mdx": "bf3186571209421aa35af05b4d98d9c4f42128143d038d69b64c177cd17275d1", + "src/content/docs/ja/v2/api/data/range.mdx": "d9a6c951acfa5bc2681ba0e64eed6d2c92ea90f3b8dbd3537ec34ecacf907944", + "src/content/docs/ja/v2/api/data/table.mdx": "95fd31ca9dde61cd5eb28972387ebbd5d16a0d2a10ead1dcb47a0a44682aca52", + "src/content/docs/ja/v2/api/data/thing.mdx": "70ab67345d6ac8ed927d433b765352a33954410a564c2d9bb7771d68d9922ff9", + "src/content/docs/ja/v2/api/data/uuid.mdx": "66827ba5f26abffa06b84888f84b0524172fa19479a06b5e1682a5e617889c80", "src/content/docs/ja/v2/api/errors.mdx": "0123aa6e46d40265660dfb332b5ac40d30a5c2611181a51044facdf6d59c9bf0", "src/content/docs/ja/v2/api/utils/escape.mdx": "53ff6cc5ac2237b7fe89e83fbcf77e52fc07da950aa0737a00d6c22aba962955", "src/content/docs/ja/v2/api/utils/get-timeout-signal.mdx": "5e0d6e9e7d59ffbe26e842fb341cd85e4e83147d53018aa097b2839e9a582663", @@ -68,12 +68,12 @@ "src/content/docs/ja/v2/experimental/auto-reconnect.mdx": "5ab2638cd2f6b24f0ab9c7057c5d55d2bba2a1c15323d8400d3c56cc508a1c33", "src/content/docs/ja/v2/experimental/inline-query.mdx": "01c3eefb276d98513df5b65420a728818d074fa05fccaeba7aafa920dfd783ba", "src/content/docs/ja/v2/experimental/inline-rpc.mdx": "9ed5e094662ef832297f02c6d3b54ae106b69fa0063aca5934f08f079ef2260a", - "src/content/docs/ja/v2/getting-started.mdx": "b384c3fce1c8bb5e013f8ff58aba4299a01ca8d562e255e11d94f711e8a1935b", + "src/content/docs/ja/v2/getting-started.mdx": "10750269305fac724905c519f828978c619941d204e0663d6e02a47e9a12c9f0", "src/content/docs/ja/v2/guides/authentication.mdx": "4e14a03ccf5e9909d8e34c91d1cd57e6967adba64f42cc70977e4336e108bd43", "src/content/docs/ja/v2/guides/connecting.mdx": "935a36cc67811ee08309c9403b6b1a4adcf92978549ed22398ee895795ba3721", - "src/content/docs/ja/v2/guides/errors.mdx": "4c0c801e584c778a94d0cbdbfe80083425e00916c34a255f6164dfd6190398d2", + "src/content/docs/ja/v2/guides/errors.mdx": "4b7cb65027d0cdcece48f9a97c6aa1542e0a4cf2b362cd81a1ab4838f470f18c", "src/content/docs/ja/v2/guides/prepared-query.mdx": "f50edd1d83e2e296b6ca019fb27823f0b63c498742bc3b4f9de32c461952f7cf", "src/content/docs/ja/v2/guides/querying.mdx": "4fa8ff5de559a0a1d119b0f29ddef09ae1c814d0658a836f36a1495d98ba8a26", "src/content/docs/ja/v2/index.mdx": "b43660b727904827fa71595a2f5422771813f90ffb962ae8a6258236f6fc6ef2", - "src/content/docs/ja/v2/supports.mdx": "de67802f5acb169e19c16891077ff4f3952c2c8a69d5dae7a1d606227c28377a" + "src/content/docs/ja/v2/supports.mdx": "dbc53ced802569e4fba39ce33393b128a3beb946491a9cec11325683cb0076f2" } \ No newline at end of file diff --git a/docs/cache/ja2zh-CN/content/v2/api/data/bound-excluded.mdx b/docs/cache/ja2zh-CN/content/v2/api/data/bound-excluded.mdx index 893aedd4..5d570e16 100644 --- a/docs/cache/ja2zh-CN/content/v2/api/data/bound-excluded.mdx +++ b/docs/cache/ja2zh-CN/content/v2/api/data/bound-excluded.mdx @@ -2,7 +2,7 @@ title: BoundExcluded slug: zh-CN/v2/api/data/bound-excluded banner: - content: 这是一个实验性功能。 + content: 此功能尚处于实验阶段。 --- import Badge from "~/components/zh-CN/Badge.astro"; @@ -12,9 +12,9 @@ import Badge from "~/components/zh-CN/Badge.astro"; ### 导入 ```ts -import { BoundExcluded } from "@tai-kun/surrealdb/data-types/decode-only"; -import { BoundExcluded } from "@tai-kun/surrealdb/data-types/encodable"; -import { BoundExcluded } from "@tai-kun/surrealdb/data-types/standard"; +import { BoundExcluded } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { BoundExcluded } from "@tai-kun/surrealdb/encodable-datatypes"; +import { BoundExcluded } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` diff --git a/docs/cache/ja2zh-CN/content/v2/api/data/bound-included.mdx b/docs/cache/ja2zh-CN/content/v2/api/data/bound-included.mdx index 7f0e2b28..f8bd3942 100644 --- a/docs/cache/ja2zh-CN/content/v2/api/data/bound-included.mdx +++ b/docs/cache/ja2zh-CN/content/v2/api/data/bound-included.mdx @@ -12,9 +12,9 @@ import Badge from "~/components/zh-CN/Badge.astro"; ### 导入 ```ts -import { BoundIncluded } from "@tai-kun/surrealdb/data-types/decode-only"; -import { BoundIncluded } from "@tai-kun/surrealdb/data-types/encodable"; -import { BoundIncluded } from "@tai-kun/surrealdb/data-types/standard"; +import { BoundIncluded } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { BoundIncluded } from "@tai-kun/surrealdb/encodable-datatypes"; +import { BoundIncluded } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -29,7 +29,7 @@ new BoundIncluded(source: unknown); ##### `source` -待调查。 +正在调查中。 #### 返回值 @@ -37,4 +37,4 @@ new BoundIncluded(source: unknown); ### `.value` -待调查。 +正在调查中。 diff --git a/docs/cache/ja2zh-CN/content/v2/api/data/datetime.mdx b/docs/cache/ja2zh-CN/content/v2/api/data/datetime.mdx index 1a3ce41a..e1d61467 100644 --- a/docs/cache/ja2zh-CN/content/v2/api/data/datetime.mdx +++ b/docs/cache/ja2zh-CN/content/v2/api/data/datetime.mdx @@ -5,14 +5,14 @@ slug: zh-CN/v2/api/data/datetime import Badge from "~/components/zh-CN/Badge.astro"; -`Datetime` 是用于表示日期和时间的类,对应 SurrealQL 中的 [`datetime`](https://surrealdb.com/docs/surrealql/datamodel/datetimes) 类型。 +`Datetime` 是一个用于表示日期和时间的类。它对应 SurrealQL 的 [`datetime`](https://surrealdb.com/docs/surrealql/datamodel/datetimes) 类型。 ### 导入 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Datetime } from "@tai-kun/surrealdb/data-types/encodable"; -import { Datetime } from "@tai-kun/surrealdb/data-types/standard"; +import { Datetime } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Datetime } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Datetime } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -47,19 +47,19 @@ new Datetime( ##### `source` -秒数和纳秒数对,或字符串。如果预设是标准的,则还支持 `Date` 对象或 `bigint` 的输入。 +秒数和纳秒数的数组,或者字符串。如果预设为 standard,还可以接受 `Date` 对象或 `bigint` 作为输入。 ##### `year`, `monthIndex`, ... -与 `Date` 类中的参数相同。但它也支持 `nanoseconds` 的输入。在提供 `undefined` 的参数之后不能再提供 `number`。这与 `Date` 类大致相同。 +与 `Date` 类的参数相同。但它也支持 `nanoseconds` 的输入。在提供 `undefined` 的参数之后,不能再提供 `number`。这与 `Date` 类的规范大体相同。 #### 返回值 -如果通过 `new` 调用,`Datetime` 会返回其实例。如果预设是标准的,它也是 `Date` 的实例。 +如果通过 `new` 调用,`Datetime` 会返回其实例。如果预设为 standard,它也是 `Date` 的实例。 ### `.seconds` -纳秒精度时间戳的秒数部分。在低于标准的预设中,它是只读的。该值是一个介于 -253-1 到 253-1 之间的整数或 `NaN`。 +纳秒精度的时间的秒数部分。在 standard 以下的预设中,它是只读的。值是一个 -253-1 到 253-1 之间的整数或 `NaN`。 ```ts .seconds: number; @@ -67,7 +67,7 @@ new Datetime( ### `.nanoseconds` -纳秒精度时间戳的纳秒数部分。在低于标准的预设中,它是只读的。该值是一个介于 0 到 999999999 之间的整数或 `NaN`。 +纳秒精度的时间的纳秒数部分。在 standard 以下的预设中,它是只读的。值是一个 0 到 999999999 之间的整数或 `NaN`。 ```ts .nanoseconds: number; @@ -75,7 +75,7 @@ new Datetime( ### `.valueOf()` -获取毫秒精度时间戳。 +获取毫秒精度的时间。 ```ts .valueOf(): number; @@ -87,12 +87,12 @@ new Datetime( #### 返回值 -返回毫秒精度时间戳。 +返回毫秒精度的时间。 #### 例子 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/encodable"; +import { Datetime } from "@tai-kun/surrealdb/encodable-datatypes"; const date = new Datetime("2024-06-01T12:34:56.780123456Z"); console.log(date.valueOf()); @@ -101,7 +101,7 @@ console.log(date.valueOf()); ### `.toString()` -获取毫秒精度时间戳的字符串表示。与 `Date` 对象的 `.toString()` 相同。 +获取毫秒精度的时间的字符串表示。与 `Date` 对象的 `.toString()` 相同。 ```ts .toString(): string; @@ -113,21 +113,21 @@ console.log(date.valueOf()); #### 返回值 -返回毫秒精度时间戳的字符串表示。 +返回毫秒精度的时间的字符串表示。 #### 例子 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/encodable"; +import { Datetime } from "@tai-kun/surrealdb/encodable-datatypes"; const date = new Datetime("2024-06-01T12:34:56.780123456Z"); console.log(date.toString()); -//-> Sat Jun 01 2024 21:34:56 GMT+0900 (日本标准时) +//-> Sat Jun 01 2024 21:34:56 GMT+0900 (日本標準時) ``` ### `.toISOString()` -获取纳秒精度时间戳的 ISO 格式字符串。与 `Date` 对象的 `.toISOString()` 类似,但由于是纳秒精度,因此会被序列化到小数点后第九位。 +获取纳秒精度的时间的 ISO 形式字符串。与 `Date` 对象的 `.toISOString()` 相似,但它具有纳秒精度,因此会将字符串化到小数点后第九位。 ```ts .toISOString(): string; @@ -139,12 +139,12 @@ console.log(date.toString()); #### 返回值 -返回纳秒精度时间戳的 ISO 格式字符串。 +返回纳秒精度的时间的 ISO 形式字符串。 #### 例子 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/encodable"; +import { Datetime } from "@tai-kun/surrealdb/encodable-datatypes"; const date = new Datetime([1717245296, 780123456]); console.log(date.toISOString()); @@ -169,7 +169,7 @@ console.log(date.toISOString()); ### `.toSurql()` -将 `Datetime` 对象转换为可嵌入 SurrealQL 的字符串。与 `.toISOString()` 类似,但添加 `d` 前缀以告诉查询解析器该字符串是一个 UUID。 +将 `Datetime` 对象转换为可以嵌入 SurrealQL 的字符串。与 `.toISOString()` 相似,但通过添加 `d` 前缀,告知查询解析器该字符串是 UUID。 ```ts .toSurql(): string; @@ -181,12 +181,12 @@ console.log(date.toISOString()); #### 返回值 -返回带有 `d` 前缀的 ISO 格式日期时间。 +返回带有 `d` 前缀的 ISO 形式日期时间。 #### 例子 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/encodable"; +import { Datetime } from "@tai-kun/surrealdb/encodable-datatypes"; const date = new Datetime([1717245296, 780123456]); console.log(date.toSurql()); @@ -225,12 +225,12 @@ console.log(date.toSurql()); #### 返回值 -返回毫秒精度时间戳。 +返回毫秒精度的时间。 #### 例子 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/standard"; +import { Datetime } from "@tai-kun/surrealdb/standard-datatypes"; const date = new Datetime(0); const time = dt.setCompact([1717245296, 780123456]); @@ -240,9 +240,9 @@ console.log(time); ### `.getMicroseconds()` -使用本地时间获取日期的微秒。 +使用本地时间获取日期的微秒数。 -`.getUTCMicroseconds()` 与该方法的行为相同。 +`.getUTCMicroseconds()` 与此方法的行为相同。 ```ts .getMicroseconds(): number; @@ -254,12 +254,12 @@ console.log(time); #### 返回值 -返回微秒。 +返回微秒数。 #### 例子 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/standard"; +import { Datetime } from "@tai-kun/surrealdb/standard-datatypes"; const date = new Datetime([1717245296, 780123456]); console.log(date.toISOString()); @@ -274,9 +274,9 @@ console.log(date.getMicroseconds()); ### `.setMicroseconds()` -设置微秒。 +设置微秒数。 -`.setUTCMicroseconds()` 与该方法的行为相同。 +`.setUTCMicroseconds()` 与此方法的行为相同。 ```ts .setMicroseconds(us: number): number; @@ -286,16 +286,16 @@ console.log(date.getMicroseconds()); ##### `us` -要设置的微秒。该值将被转换为整数。请注意,如果值不在 0 到 999 之间,则整个时间戳将受到影响。 +要设置的微秒数。值将被转换为整数。请注意,如果值不在 0 到 999 之间,则整个时间将受到影响。 #### 返回值 -返回毫秒精度时间戳。 +返回毫秒精度的时间。 #### 例子 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/standard"; +import { Datetime } from "@tai-kun/surrealdb/standard-datatypes"; const date = new Datetime([1717245296, 780123456]); console.log(date.toISOString()); @@ -310,9 +310,9 @@ console.log(time); ### `.getNanoseconds()` -使用本地时间获取日期的纳秒。 +使用本地时间获取日期的纳秒数。 -`.getUTCNanoseconds()` 与该方法的行为相同。 +`.getUTCNanoseconds()` 与此方法的行为相同。 ```ts .getNanoseconds(): number; @@ -324,12 +324,12 @@ console.log(time); #### 返回值 -返回纳秒。 +返回纳秒数。 #### 例子 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/standard"; +import { Datetime } from "@tai-kun/surrealdb/standard-datatypes"; const date = new Datetime([1717245296, 780123456]); console.log(date.toISOString()); @@ -344,9 +344,9 @@ console.log(date.getNanoseconds()); ### `.setNanoseconds()` -设置纳秒。 +设置纳秒数。 -`.setUTCNanoseconds()` 与该方法的行为相同。 +`.setUTCNanoseconds()` 与此方法的行为相同。 ```ts .setNanoseconds(us: number): number; @@ -356,16 +356,16 @@ console.log(date.getNanoseconds()); ##### `us` -要设置的纳秒。该值将被转换为整数。请注意,如果值不在 0 到 999 之间,则整个时间戳将受到影响。 +要设置的纳秒数。值将被转换为整数。请注意,如果值不在 0 到 999 之间,则整个时间将受到影响。 #### 返回值 -返回毫秒精度时间戳。 +返回毫秒精度的时间。 #### 例子 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/standard"; +import { Datetime } from "@tai-kun/surrealdb/standard-datatypes"; const date = new Datetime([1717245296, 780123456]); console.log(date.toISOString()); @@ -380,7 +380,7 @@ console.log(time); ### `.clone()` -复制 `Datetime` 对象。 +克隆 `Datetime` 对象。 ```ts .clone(): this; @@ -394,19 +394,19 @@ console.log(time); 返回一个新的 `Datetime` 对象。如果继承了 `Datetime` 类,则返回该类的实例。 -### 扩展 +### 发展 -#### `Datetime` 对象的通用判断 +#### `Datetime` 对象的通用判定 -建议使用 `isDatetime` 函数来判断一个值是否为 `Datetime` 对象,而无需依赖预设。该函数不使用 `instanceof`,因此在验证值的预设未知时很有用。 +建议使用 `isDatetime` 函数来判断值是否是 `Datetime` 对象,而不依赖于预设。该函数不使用 `instanceof`,因此在验证值的预设未知时非常有用。 ```ts import { isDatetime } from "@tai-kun/surrealdb"; ``` -#### 早于 UNIX 纪元的日期时间 +#### UNIX 纪元之前的时间 -SurrealDB 的 `datetime` 类型可以精确到纳秒。因此,在 JavaScript 中处理它时要小心。如果将 SurrealDB 序列化的 `datetime`,例如 `"1969-12-31T23:59:59.999999999Z"` 传递给 JavaScript 的 `Date.parse`,那么在 WebKit 中它将是 0 毫秒,而在其他环境(Node.js、Deno、Bun、Chromium、Firefox)中则是 -1 毫秒。 +SurrealDB 的 `datetime` 类型可以精确到纳秒。因此在 JavaScript 中处理时需要小心。如果将 SurrealDB 序列化的 `datetime`,例如 `"1969-12-31T23:59:59.999999999Z"`,传递给 JavaScript 的 `Date.parse`,它会在 WebKit 中返回 0 毫秒,但在其他环境(Node.js, Deno, Bun, Chromium, Firefox)中会返回 -1 毫秒。 WebKit: @@ -416,7 +416,7 @@ console.log(date.getTime()); //-> 0 ``` -Node.js、Deno、Bun、Chromium、Firefox: +Node.js, Deno, Bun, Chromium, Firefox: ```ts const date = new Date("1969-12-31T23:59:59.999999999Z"); diff --git a/docs/cache/ja2zh-CN/content/v2/api/data/decimal.mdx b/docs/cache/ja2zh-CN/content/v2/api/data/decimal.mdx index 26d100fc..8940e750 100644 --- a/docs/cache/ja2zh-CN/content/v2/api/data/decimal.mdx +++ b/docs/cache/ja2zh-CN/content/v2/api/data/decimal.mdx @@ -5,19 +5,19 @@ slug: zh-CN/v2/api/data/decimal import Badge from "~/components/zh-CN/Badge.astro"; -`Decimal` 是用于表示任意精度的实数的类。如果预设为 standard,则该类将继承 [`big.js`](https://github.com/MikeMcl/big.js) 类。因此,`.toString()` 方法等的结果在不同预设之间可能不一致。 +`Decimal` 是用于表示任意精度实数的类。当预设为 `standard` 时,它将继承 [`big.js`](https://github.com/MikeMcl/big.js) 的类。这可能会导致 `.toString()` 方法等结果在不同预设之间不一致。 ### 导入 ```ts -import { Decimal } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Decimal } from "@tai-kun/surrealdb/data-types/encodable"; -import { Decimal } from "@tai-kun/surrealdb/data-types/standard"; +import { Decimal } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Decimal } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Decimal } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` -创建新的 `Decimal` 对象。 +创建一个新的 `Decimal` 对象。 ```ts new Decimal(source: string); // decode-only, encodable @@ -28,15 +28,15 @@ new Decimal(source: string | number | Decimal); // standard ##### `source` -表示实数的字符串。如果预设为 standard,则也可以传入数字。 +以字符串形式表示的实数。当预设为 `standard` 时,也可以传入数字。 #### 返回值 -通过 `new` 调用时,`Decimal` 将返回其实例。 +当通过 `new` 调用时,`Decimal` 将返回其实例。 ### `.toString()` -获取实数的字符串形式。 +获取实数的字符串表示。 #### 参数 @@ -48,7 +48,7 @@ new Decimal(source: string | number | Decimal); // standard ### `.toSurql()` -将 `Decimal` 对象转换为可以嵌入 SurrealQL 的字符串。与 `.toString()` 相似,但它通过添加 `dec` 后缀来告知查询解析器该字符串是 `decimal` 类型。 +将 `Decimal` 对象转换为可以嵌入 SurrealQL 的字符串。类似于 `.toString()`,但会添加 `dec` 后缀,以便让查询解析器知道该字符串是 `decimal` 类型。 ```ts .toSurql(): string; @@ -65,7 +65,7 @@ new Decimal(source: string | number | Decimal); // standard #### 例子 ```ts -import { Decimal } from "@tai-kun/surrealdb/data-types/encodable"; +import { Decimal } from "@tai-kun/surrealdb/encodable-datatypes"; const decimal = new Decimal("3.14"); console.log(decimal.toSurql()); @@ -86,19 +86,19 @@ console.log(decimal.toSurql()); #### 返回值 -返回新的 `Decimal` 对象。如果继承了 `Decimal` 类,则返回该类的实例。 +返回一个新的 `Decimal` 对象。如果继承了 `Decimal` 类,则返回该类的实例。 ### 其他方法 -如果使用 standard 预设,则 `Decimal` 类继承自 `big.js` 的 `Big` 类,因此实例方法和属性请参考 `big.js` 文档: +如果使用 `standard` 预设,则 `Decimal` 类将继承 `big.js` 的 `Big` 类,因此实例方法和属性请参考 `big.js` 文档: [`big.js` 文档](https://mikemcl.github.io/big.js/#prototype-methods) -### 扩展 +### 拓展 -#### `Decimal` 对象的通用判定 +#### `Decimal` 对象的通用判断 -建议使用 `isDecimal` 函数来判断值是否是 `Decimal` 对象,而不用依赖预设。该函数不使用 `instanceof`,因此在验证值的预设未知时非常有用。 +建议使用 `isDecimal` 函数来判断值是否为 `Decimal` 对象,而无需依赖预设。此函数不使用 `instanceof`,因此在验证值预设未知的情况下非常有用。 ```ts import { isDecimal } from "@tai-kun/surrealdb"; diff --git a/docs/cache/ja2zh-CN/content/v2/api/data/duration.mdx b/docs/cache/ja2zh-CN/content/v2/api/data/duration.mdx index 18c0113e..f6da2b11 100644 --- a/docs/cache/ja2zh-CN/content/v2/api/data/duration.mdx +++ b/docs/cache/ja2zh-CN/content/v2/api/data/duration.mdx @@ -1,18 +1,18 @@ --- -title: 时长 +title: 持续时间 slug: zh-CN/v2/api/data/duration --- import Badge from "~/components/zh-CN/Badge.astro"; -`Duration` 是用于表示时长的类。 +`Duration` 是一个表示持续时间的类。 ### 导入 ```ts -import { Duration } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Duration } from "@tai-kun/surrealdb/data-types/encodable"; -import { Duration } from "@tai-kun/surrealdb/data-types/standard"; +import { Duration } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Duration } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Duration } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -40,9 +40,9 @@ new Duration( ##### `source` -秒数和纳秒数对。如果预设为 standard,则可以将更多值转换为 `Duration` 对象。 +秒数和纳秒数的配对。如果预设为 standard,则可以将更多值转换为 `Duration` 对象。 -`number` 类型的输入以毫秒为单位计算。这适用于将两个 `Date` 对象之间的差转换为 `Duration` 对象的情况: +`number` 类型的输入以毫秒为单位计算。这适用于将两个 `Date` 对象的差值转换为 `Duration` 对象的用途: ```ts const begin = new Date("2024-06-01T12:00:00.000Z"); @@ -50,7 +50,7 @@ const end = new Date("2024-06-01T21:00:00.000Z"); new Duration(end - begin); ``` -`bigint` 类型的输入以纳秒为单位计算。这适用于将例如 [`process.hrtime.bigint()`](https://nodejs.org/api/process.html#processhrtimebigint) 返回的纳秒转换为 `Duration` 对象的情况: +`bigint` 类型的输入以纳秒为单位计算。这适用于将例如 [`process.hrtime.bigint()`](https://nodejs.org/api/process.html#processhrtimebigint) 返回的纳秒等高精度时间转换为 `Duration` 对象的用途: ```ts const begin = process.hrtime.bigint(); @@ -59,11 +59,11 @@ const end = process.hrtime.bigint(); new Duration(end - begin); ``` -`string` 类型的输入必须是时长字符串表示形式。时长字符串表示形式是指由数字和单位组成,并连续排列的格式。例如,`1h4h30m20s1350ms` 表示“1 天 4 小时 30 分 21 秒 350 毫秒”。可用的单位如下: +`string` 类型的输入必须是持续时间的字符串表示形式。持续时间的字符串表示形式是指数字和单位组合在一起,并连续排列的格式。例如 `1h4h30m20s1350ms` 表示“1 天 4 小时 30 分钟,21 秒 350 毫秒”。可用的单位如下: | 单位 | 描述 | 转换 | | --- | --- | --- | -| `ns` | 纳秒 | | +| `ns` | 纳秒 | | `us` | 微秒 | `1us` -> `1000ns` | | `ms` | 毫秒 | `1ms` -> `1000us` | | `s` | 秒 | `1s` -> `1000ms` | @@ -73,15 +73,15 @@ new Duration(end - begin); | `w` | 周 | `1w` -> `7d` | | `y` | 年 | `1y` -> `365d` | -`us` (`0x75`, `0x73`) 也可以写成 `µs` (`0xc2`, `0xb5`, `0x73`) 或 `μs` (`0xce`, `0xbc`, `0x73`)(括号内的 16 进制数是单位字符串的 UTF-8 编码结果)。 +`us` (`0x75`, `0x73`) 也可以写成 `µs` (`0xc2`, `0xb5`, `0x73`) 或 `μs` (`0xce`, `0xbc`, `0x73`)(括号中的十六进制数是单位字符串的 UTF-8 编码结果)。 #### 返回值 -如果通过 `new` 调用,`Duration` 将返回其实例。 +如果通过 `new` 调用,`Duration` 会返回其实例。 ### `.seconds` -时长的秒数部分。在低于 standard 的预设中,它是只读的。该值为 0 到 264-1 之间的整数。 +持续时间的秒数部分。在低于 standard 的预设中,它是只读的。该值为 0 到 264-1 之间的整数。 ```ts .seconds: bigint; @@ -89,7 +89,7 @@ new Duration(end - begin); ### `.nanoseconds` -时长的纳秒数部分。在低于 standard 的预设中,它是只读的。该值为 0 到 999999999 之间的整数。 +持续时间的纳秒数部分。在低于 standard 的预设中,它是只读的。该值为 0 到 999999999 之间的整数。 ```ts .nanoseconds: number; @@ -97,7 +97,7 @@ new Duration(end - begin); ### `.parse()` -将时长映射到各个单位。每个单位的值都大于等于 0 且小于该单位的最大值。注意,如果时长为 0,则返回的将是一个仅具有 `nanoseconds` 属性且值为 `0` 的对象。 +将持续时间映射到各个单位。每个单位的值都大于等于 0,小于该单位的最大值。此外,如果持续时间为 0,则将返回一个仅 `nanoseconds` 属性为 `0` 的对象。 ```ts .parse(): { @@ -119,12 +119,12 @@ new Duration(end - begin); #### 返回值 -返回将时长映射到各个单位的结果。如果单位的值为 0,则该属性将被省略,但如果时长为 0,则将返回一个仅具有 `nanoseconds` 属性且值为 `0` 的对象。 +返回将持续时间映射到各个单位的结果。如果单位的值为 0,则该属性将被省略,但如果持续时间为 0,则仅返回 `nanoseconds` 为 `0` 的对象。 #### 例子 ```ts -import { Duration } from "@tai-kun/surrealdb/data-types/encodable"; +import { Duration } from "@tai-kun/surrealdb/encodable-datatypes"; const duration = new Duration(0); console.log(duration.parse()); @@ -132,7 +132,7 @@ console.log(duration.parse()); ``` ```ts -import { Duration } from "@tai-kun/surrealdb/data-types/encodable"; +import { Duration } from "@tai-kun/surrealdb/encodable-datatypes"; const duration = new Duration(12_345_000n); console.log(duration.parse()); @@ -141,7 +141,7 @@ console.log(duration.parse()); ### `.valueOf()` -以纳秒为单位获取时长。 +以纳秒为单位获取持续时间。 ```ts .valueOf(): bigint; @@ -153,10 +153,10 @@ console.log(duration.parse()); #### 返回值 -以纳秒为单位返回时长。 +以纳秒为单位返回持续时间。 ```ts -import { Duration } from "@tai-kun/surrealdb/data-types/encodable"; +import { Duration } from "@tai-kun/surrealdb/encodable-datatypes"; const duration = new Duration(12_345_000n); console.log(duration.valueOf()); @@ -165,9 +165,9 @@ console.log(duration.valueOf()); ### `.toString()` -获取时长的字符串表示形式。 +获取持续时间的字符串表示形式。 -`.toJSON()` 和 `.toSurql()` 返回与该方法相同的结果。 +`.toJSON()` 和 `.toSurql()` 会返回与该方法相同的结果。 ```ts .toString(): string; @@ -179,12 +179,12 @@ console.log(duration.valueOf()); #### 返回值 -获取毫秒精度的时长字符串表示形式。 +获取毫秒精度的时刻的字符串表示形式。 #### 例子 ```ts -import { Duration } from "@tai-kun/surrealdb/data-types/encodable"; +import { Duration } from "@tai-kun/surrealdb/encodable-datatypes"; const duration = new Duration(12_345_000n); console.log(duration.toString()); @@ -193,7 +193,7 @@ console.log(duration.toString()); ### `.toISOString()` -获取时长字符串的 ISO 格式。 +以 ISO 格式获取持续时间的字符串。 ```ts .toISOString(): string; @@ -205,12 +205,12 @@ console.log(duration.toString()); #### 返回值 -以 ISO 格式返回时长字符串。 +以 ISO 格式返回持续时间的字符串。 #### 例子 ```ts -import { Duration } from "@tai-kun/surrealdb/data-types/encodable"; +import { Duration } from "@tai-kun/surrealdb/encodable-datatypes"; const duration = new Duration("2m3s456ms"); console.log(duration.toISOString()); @@ -219,7 +219,7 @@ console.log(duration.toISOString()); ### `.getCompact()` -获取秒数和纳秒数对。 +获取秒数和纳秒数的配对。 ```ts .getCompact(): [seconds: bigint, nanoseconds: number]; @@ -231,11 +231,11 @@ console.log(duration.toISOString()); #### 返回值 -返回秒数和纳秒数对。 +返回秒数和纳秒数的配对。 ### `.setCompact()` -使用秒数和纳秒数对设置时间。 +使用秒数和纳秒数的配对设置日期时间。 ```ts .setCompact(compact: [seconds: bigint, nanoseconds: number]): void; @@ -245,7 +245,7 @@ console.log(duration.toISOString()); ##### `compact` -秒数和纳秒数对。 +秒数和纳秒数的配对。 #### 返回值 @@ -253,7 +253,7 @@ console.log(duration.toISOString()); ### `.getYears()` -获取年数。如果结果不是大于等于 0 的整数,则返回 0。 +获取年。如果结果不是大于等于 0 的整数,则返回 0。 ```ts .getYears(): number; @@ -265,11 +265,11 @@ console.log(duration.toISOString()); #### 返回值 -返回表示年数的大于等于 0 的整数。 +返回表示年的大于等于 0 的整数。 ### `.addYears()` -从时长中添加指定年数。 +从持续时间中添加指定数量的年。 ```ts .addYears(value: number): void; @@ -287,7 +287,7 @@ console.log(duration.toISOString()); ### `.subYears()` -从时长中减去指定年数。 +从持续时间中减去指定数量的年。 ```ts .subYears(value: number): void; @@ -321,7 +321,7 @@ console.log(duration.toISOString()); ### `.getWeeks()` -获取周数。如果结果不是大于等于 0 的整数,则返回 0。 +获取周。如果结果不是大于等于 0 的整数,则返回 0。 ```ts .getWeeks(): number; @@ -333,11 +333,11 @@ console.log(duration.toISOString()); #### 返回值 -返回表示周数的大于等于 0 的整数。 +返回表示周的大于等于 0 的整数。 ### `.addWeeks()` -从时长中添加指定周数。 +从持续时间中添加指定数量的周。 ```ts .addWeeks(value: number): void; @@ -355,7 +355,7 @@ console.log(duration.toISOString()); ### `.subWeeks()` -从时长中减去指定周数。 +从持续时间中减去指定数量的周。 ```ts .subWeeks(value: number): void; @@ -389,7 +389,7 @@ console.log(duration.toISOString()); ### `.getDays()` -获取天数。如果结果不是大于等于 0 的整数,则返回 0。 +获取日。如果结果不是大于等于 0 的整数,则返回 0。 ```ts .getDays(): number; @@ -401,11 +401,11 @@ console.log(duration.toISOString()); #### 返回值 -返回表示天数的大于等于 0 的整数。 +返回表示日的大于等于 0 的整数。 ### `.addDays()` -从时长中添加指定天数。 +从持续时间中添加指定数量的日。 ```ts .addDays(value: number): void; @@ -415,7 +415,7 @@ console.log(duration.toISOString()); ##### `value` -天数。 +日数。 #### 返回值 @@ -423,7 +423,7 @@ console.log(duration.toISOString()); ### `.subDays()` -从时长中减去指定天数。 +从持续时间中减去指定数量的日。 ```ts .subDays(value: number): void; @@ -433,7 +433,7 @@ console.log(duration.toISOString()); ##### `value` -天数。 +日数。 #### 返回值 @@ -441,7 +441,7 @@ console.log(duration.toISOString()); ### `.asDays()` -获取天数的毫秒表示形式。 +获取日数的毫秒表示形式。 ```ts .asDays(): number; @@ -453,11 +453,11 @@ console.log(duration.toISOString()); #### 返回值 -天数的毫秒表示形式。 +日数的毫秒表示形式。 ### `.getHours()` -获取小时数。如果结果不是大于等于 0 的整数,则返回 0。 +获取时。如果结果不是大于等于 0 的整数,则返回 0。 ```ts .getHours(): number; @@ -469,11 +469,11 @@ console.log(duration.toISOString()); #### 返回值 -返回表示小时数的大于等于 0 的整数。 +返回表示时的大于等于 0 的整数。 ### `.addHours()` -从时长中添加指定小时数。 +从持续时间中添加指定数量的时。 ```ts .addHours(value: number): void; @@ -483,7 +483,7 @@ console.log(duration.toISOString()); ##### `value` -小时数。 +时数。 #### 返回值 @@ -491,7 +491,7 @@ console.log(duration.toISOString()); ### `.subHours()` -从时长中减去指定小时数。 +从持续时间中减去指定数量的时。 ```ts .subHours(value: number): void; @@ -501,7 +501,7 @@ console.log(duration.toISOString()); ##### `value` -小时数。 +时数。 #### 返回值 @@ -509,7 +509,7 @@ console.log(duration.toISOString()); ### `.asHours()` -获取小时数的毫秒表示形式。 +获取时数的毫秒表示形式。 ```ts .asHours(): number; @@ -521,11 +521,11 @@ console.log(duration.toISOString()); #### 返回值 -小时数的毫秒表示形式。 +时数的毫秒表示形式。 ### `.getMinutes()` -获取分钟数。如果结果不是大于等于 0 的整数,则返回 0。 +获取分。如果结果不是大于等于 0 的整数,则返回 0。 ```ts .getMinutes(): number; @@ -537,11 +537,11 @@ console.log(duration.toISOString()); #### 返回值 -返回表示分钟数的大于等于 0 的整数。 +返回表示分的大于等于 0 的整数。 ### `.addMinutes()` -从时长中添加指定分钟数。 +从持续时间中添加指定数量的分。 ```ts .addMinutes(value: number): void; @@ -551,7 +551,7 @@ console.log(duration.toISOString()); ##### `value` -分钟数。 +分数。 #### 返回值 @@ -559,7 +559,7 @@ console.log(duration.toISOString()); ### `.subMinutes()` -从时长中减去指定分钟数。 +从持续时间中减去指定数量的分。 ```ts .subMinutes(value: number): void; @@ -569,7 +569,7 @@ console.log(duration.toISOString()); ##### `value` -分钟数。 +分数。 #### 返回值 @@ -577,7 +577,7 @@ console.log(duration.toISOString()); ### `.asMinutes()` -获取分钟数的毫秒表示形式。 +获取分数的毫秒表示形式。 ```ts .asMinutes(): number; @@ -589,11 +589,11 @@ console.log(duration.toISOString()); #### 返回值 -分钟数的毫秒表示形式。 +分数的毫秒表示形式。 ### `.getSeconds()` -获取秒数。如果结果不是大于等于 0 的整数,则返回 0。 +获取秒。如果结果不是大于等于 0 的整数,则返回 0。 ```ts .getSeconds(): number; @@ -605,11 +605,11 @@ console.log(duration.toISOString()); #### 返回值 -返回表示秒数的大于等于 0 的整数。 +返回表示秒的大于等于 0 的整数。 ### `.addSeconds()` -从时长中添加指定秒数。 +从持续时间中添加指定数量的秒。 ```ts .addSeconds(value: number): void; @@ -627,7 +627,7 @@ console.log(duration.toISOString()); ### `.subSeconds()` -从时长中减去指定秒数。 +从持续时间中减去指定数量的秒。 ```ts .subSeconds(value: number): void; @@ -661,7 +661,7 @@ console.log(duration.toISOString()); ### `.getMilliseconds()` -获取毫秒数。如果结果不是大于等于 0 的整数,则返回 0。 +获取毫秒。如果结果不是大于等于 0 的整数,则返回 0。 ```ts .getMilliseconds(): number; @@ -673,11 +673,11 @@ console.log(duration.toISOString()); #### 返回值 -返回表示毫秒数的大于等于 0 的整数。 +返回表示毫秒的大于等于 0 的整数。 ### `.addMilliseconds()` -从时长中添加指定毫秒数。 +从持续时间中添加指定数量的毫秒。 ```ts .addMilliseconds(value: number): void; @@ -695,7 +695,7 @@ console.log(duration.toISOString()); ### `.subMilliseconds()` -从时长中减去指定毫秒数。 +从持续时间中减去指定数量的毫秒。 ```ts .subMilliseconds(value: number): void; @@ -729,7 +729,7 @@ console.log(duration.toISOString()); ### `.getMicroseconds()` -获取微秒数。如果结果不是大于等于 0 的整数,则返回 0。 +获取微秒。如果结果不是大于等于 0 的整数,则返回 0。 ```ts .getMicroseconds(): number; @@ -741,11 +741,11 @@ console.log(duration.toISOString()); #### 返回值 -返回表示微秒数的大于等于 0 的整数。 +返回表示微秒的大于等于 0 的整数。 ### `.addMicroseconds()` -从时长中添加指定微秒数。 +从持续时间中添加指定数量的微秒。 ```ts .addMicroseconds(value: number): void; @@ -763,7 +763,7 @@ console.log(duration.toISOString()); ### `.subMicroseconds()` -从时长中减去指定微秒数。 +从持续时间中减去指定数量的微秒。 ```ts .subMicroseconds(value: number): void; @@ -797,7 +797,7 @@ console.log(duration.toISOString()); ### `.getNanoseconds()` -获取纳秒数。如果结果不是大于等于 0 的整数,则返回 0。 +获取纳秒。如果结果不是大于等于 0 的整数,则返回 0。 ```ts .getNanoseconds(): number; @@ -809,11 +809,11 @@ console.log(duration.toISOString()); #### 返回值 -返回表示纳秒数的大于等于 0 的整数。 +返回表示纳秒的大于等于 0 的整数。 ### `.addNanoseconds()` -从时长中添加指定纳秒数。 +从持续时间中添加指定数量的纳秒。 ```ts .addNanoseconds(value: number): void; @@ -831,7 +831,7 @@ console.log(duration.toISOString()); ### `.subNanoseconds()` -从时长中减去指定纳秒数。 +从持续时间中减去指定数量的纳秒。 ```ts .subNanoseconds(value: number): void; diff --git a/docs/cache/ja2zh-CN/content/v2/api/data/future.mdx b/docs/cache/ja2zh-CN/content/v2/api/data/future.mdx index f9243eba..1abdc054 100644 --- a/docs/cache/ja2zh-CN/content/v2/api/data/future.mdx +++ b/docs/cache/ja2zh-CN/content/v2/api/data/future.mdx @@ -1,5 +1,5 @@ --- -title: 未来值 +title: 未来 slug: zh-CN/v2/api/data/future banner: content: 这是一个实验性功能。 @@ -7,19 +7,19 @@ banner: import Badge from "~/components/zh-CN/Badge.astro"; -`Future` 是 SurrealDB [未来值功能](https://surrealdb.com/docs/surrealql/datamodel/futures) 的表示类。 +`Future` 类表示 SurrealDB 的 [Futures 功能](https://surrealdb.com/docs/surrealql/datamodel/futures)。 ### 导入 ```ts -import { Future } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Future } from "@tai-kun/surrealdb/data-types/encodable"; -import { Future } from "@tai-kun/surrealdb/data-types/standard"; +import { Future } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Future } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Future } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` -创建新的 `Future` 对象。 +创建一个新的 `Future` 对象。 ```ts new Future(source: string); @@ -29,15 +29,15 @@ new Future(source: string); ##### `source` -future 块内的值或表达式。 +future 块中的值或表达式。 #### 返回值 -如果通过 `new` 调用,`Future` 将返回其实例。 +当通过 `new` 调用时,`Future` 将返回其实例。 ### `.block` -future 块内的值或表达式。 +future 块中的值或表达式。 ```ts .block: number; @@ -57,12 +57,12 @@ future 块内的值或表达式。 #### 返回值 -返回 future 块内的值或表达式。 +返回 future 块中的值或表达式。 -#### 示例 +#### 例子 ```ts -import { Future } from "@tai-kun/surrealdb/data-types/encodable"; +import { Future } from "@tai-kun/surrealdb/encodable-datatypes"; const future = new Future(`time::now()`); console.log(future.toString()); @@ -71,7 +71,7 @@ console.log(future.toString()); ### `.toSurql()` -将 `Future` 对象转换为可嵌入 SurrealQL 的字符串。类似于 `.toString()`,但块被波括号(`{}`)包围,并用 `` 转换。 +将 `Future` 对象转换为可以嵌入 SurrealQL 的字符串。与 `.toString()` 相似,但块将用波括号 (`{}`) 包围并用 `` 强制转换。 ```ts .toSurql(): string; @@ -83,12 +83,12 @@ console.log(future.toString()); #### 返回值 -返回可嵌入 SurrealQL 的 future。 +返回可以嵌入 SurrealQL 的 future。 -#### 示例 +#### 例子 ```ts -import { Future } from "@tai-kun/surrealdb/data-types/encodable"; +import { Future } from "@tai-kun/surrealdb/encodable-datatypes"; const future = new Future(`time::now()`); console.log(future.toSurql()); @@ -97,7 +97,7 @@ console.log(future.toSurql()); ### `.surql()` -此方法有助于编写 SurrealQL 代码。可以使用模板字面量来编写 SurrealQL 代码。嵌入模板字面量的值将自动转换为 SurrealQL。此外,如果您安装了 [SurrealDB 官方扩展](https://marketplace.visualstudio.com/items?itemName=surrealdb.surrealql) ,VSCode 中的模板字面量的语法高亮将生效。 +此方法有助于编写 SurrealQL。您可以使用模板字面量来编写 SurrealQL。嵌入到模板字面量中的值将自动转换为 SurrealQL。此外,如果您在 VSCode 中安装了 [SurrealDB 官方扩展](https://marketplace.visualstudio.com/items?itemName=surrealdb.surrealql),则模板字面量的语法高亮将生效。 ```ts .surql(texts: TemplateStringsArray, ...values: unknown[]): string; @@ -111,16 +111,16 @@ console.log(future.toSurql()); ##### `values` -在 `texts` 的每个元素之间嵌入的值。 +要嵌入到每个 `texts` 元素之间的值。 #### 返回值 -SurrealQL 代码。 +SurrealQL。 -#### 示例 +#### 例子 ```ts -import { Future, Thing } from "@tai-kun/surrealdb/data-types/standard"; +import { Future, Thing } from "@tai-kun/surrealdb/standard-datatypes"; const foo = "foo"; const rid = new Thing("person", "tai-kun"); @@ -137,10 +137,10 @@ console.log(future.toSurql()); //-> } ``` -如果不使用 `.surql()`,上述示例将变为: +如果不使用 `.surql()`,上面的例子将是: ```ts -import { Future, Thing } from "@tai-kun/surrealdb/data-types/standard"; +import { Future, Thing } from "@tai-kun/surrealdb/standard-datatypes"; import { toSurql } from "@tai-kun/surrealdb/utils"; const foo = "foo"; @@ -158,14 +158,14 @@ console.log(future.toSurql()); //-> } ``` -- 必须使用 `toSurql` 辅助函数或 `.toSurql()` 方法将字符串或对象转换为 SurrealQL。 -- 可以将字符串直接嵌入 SurrealQL 中,而无需使用 `Future.raw`。 +- 您需要使用 `toSurql` 辅助函数或 `.toSurql()` 方法将字符串或对象转换为 SurrealQL。 +- 您可以将字符串嵌入到 SurrealQL 中,而无需使用 `Future.raw`。 -### 扩展 +### 发展 -#### `Future` 对象的通用判定 +#### `Future` 对象的通用判断 -建议使用 `isFuture` 函数来判定值是否为 `Future` 对象,而无需依赖预设。此函数不使用 `instanceof`,因此在验证值的预设未知的情况下非常有用。 +建议使用 `isFuture` 函数来判断一个值是否为 `Future` 对象,而无需依赖预设。此函数不使用 `instanceof`,因此在验证值预设未知的情况下很有用。 ```ts import { isFuture } from "@tai-kun/surrealdb"; diff --git a/docs/cache/ja2zh-CN/content/v2/api/data/geometry-collection.mdx b/docs/cache/ja2zh-CN/content/v2/api/data/geometry-collection.mdx index 73a19eb0..c02386c6 100644 --- a/docs/cache/ja2zh-CN/content/v2/api/data/geometry-collection.mdx +++ b/docs/cache/ja2zh-CN/content/v2/api/data/geometry-collection.mdx @@ -1,5 +1,5 @@ --- -title: 几何集合 +title: GeometryCollection slug: zh-CN/v2/api/data/geometry-collection --- @@ -10,9 +10,9 @@ import Badge from "~/components/zh-CN/Badge.astro"; ### 导入 ```ts -import { GeometryCollection } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryCollection } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryCollection } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryCollection } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryCollection } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryCollection } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -31,4 +31,4 @@ new GeometryCollection(source); #### 返回值 -当通过 `new` 调用时,`GeometryCollection` 将返回其实例。 +通过 `new` 调用时,`GeometryCollection` 将返回其实例。 diff --git a/docs/cache/ja2zh-CN/content/v2/api/data/geometry-line.mdx b/docs/cache/ja2zh-CN/content/v2/api/data/geometry-line.mdx index 5ad878e1..460e5c70 100644 --- a/docs/cache/ja2zh-CN/content/v2/api/data/geometry-line.mdx +++ b/docs/cache/ja2zh-CN/content/v2/api/data/geometry-line.mdx @@ -5,14 +5,14 @@ slug: zh-CN/v2/api/data/geometry-line import Badge from "~/components/zh-CN/Badge.astro"; -正在编辑。 +编辑中。 ### 导入 ```ts -import { GeometryLine } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryLine } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryLine } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryLine } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryLine } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryLine } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -27,8 +27,8 @@ new GeometryLine(source); ##### `source` -正在编辑。 +编辑中。 #### 返回值 -当通过 `new` 调用时,`GeometryLine` 将返回其实例。 +当通过 `new` 调用时,`GeometryLine` 会返回其实例。 diff --git a/docs/cache/ja2zh-CN/content/v2/api/data/geometry-multi-line.mdx b/docs/cache/ja2zh-CN/content/v2/api/data/geometry-multi-line.mdx index c7680344..65f55fcf 100644 --- a/docs/cache/ja2zh-CN/content/v2/api/data/geometry-multi-line.mdx +++ b/docs/cache/ja2zh-CN/content/v2/api/data/geometry-multi-line.mdx @@ -1,18 +1,18 @@ --- -title: 几何多线 +title: GeometryMultiLine slug: zh-CN/v2/api/data/geometry-multi-line --- import Badge from "~/components/zh-CN/Badge.astro"; -正在编写。 +正在编辑。 ### 导入 ```ts -import { GeometryMultiLine } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryMultiLine } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryMultiLine } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryMultiLine } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryMultiLine } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryMultiLine } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -27,8 +27,8 @@ new GeometryMultiLine(source); ##### `source` -正在编写。 +正在编辑。 #### 返回值 -当通过 `new` 调用时,`GeometryMultiLine` 会返回其实例。 +通过 `new` 调用时,`GeometryMultiLine` 会返回其实例。 diff --git a/docs/cache/ja2zh-CN/content/v2/api/data/geometry-multi-point.mdx b/docs/cache/ja2zh-CN/content/v2/api/data/geometry-multi-point.mdx index 9839c69b..3d3e1a07 100644 --- a/docs/cache/ja2zh-CN/content/v2/api/data/geometry-multi-point.mdx +++ b/docs/cache/ja2zh-CN/content/v2/api/data/geometry-multi-point.mdx @@ -1,23 +1,23 @@ --- -title: 几何多点 +title: GeometryMultiPoint slug: zh-CN/v2/api/data/geometry-multi-point --- import Badge from "~/components/zh-CN/Badge.astro"; -正在编辑中。 +正在编辑。 ### 导入 ```ts -import { GeometryMultiPoint } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryMultiPoint } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryMultiPoint } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryMultiPoint } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryMultiPoint } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryMultiPoint } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` -创建一个新的 `GeometryMultiPoint` 对象。 +创建新的 `GeometryMultiPoint` 对象。 ```ts new GeometryMultiPoint(source); @@ -27,8 +27,8 @@ new GeometryMultiPoint(source); ##### `source` -正在编辑中。 +正在编辑。 #### 返回值 -通过 `new` 调用时,`GeometryMultiPoint` 会返回其实例。 +通过 `new` 调用时,`GeometryMultiPoint` 会返回自身的实例。 diff --git a/docs/cache/ja2zh-CN/content/v2/api/data/geometry-multi-polygon.mdx b/docs/cache/ja2zh-CN/content/v2/api/data/geometry-multi-polygon.mdx index e0d7c4ae..e0ef2837 100644 --- a/docs/cache/ja2zh-CN/content/v2/api/data/geometry-multi-polygon.mdx +++ b/docs/cache/ja2zh-CN/content/v2/api/data/geometry-multi-polygon.mdx @@ -10,9 +10,9 @@ import Badge from "~/components/zh-CN/Badge.astro"; ### 导入 ```ts -import { GeometryMultiPolygon } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryMultiPolygon } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryMultiPolygon } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryMultiPolygon } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryMultiPolygon } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryMultiPolygon } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -31,4 +31,4 @@ new GeometryMultiPolygon(source); #### 返回值 -当通过 `new` 调用时,`GeometryMultiPolygon` 将返回其实例。 +如果通过 `new` 调用,`GeometryMultiPolygon` 将返回其实例。 diff --git a/docs/cache/ja2zh-CN/content/v2/api/data/geometry-point.mdx b/docs/cache/ja2zh-CN/content/v2/api/data/geometry-point.mdx index 625f9b96..af08765a 100644 --- a/docs/cache/ja2zh-CN/content/v2/api/data/geometry-point.mdx +++ b/docs/cache/ja2zh-CN/content/v2/api/data/geometry-point.mdx @@ -10,9 +10,9 @@ import Badge from "~/components/zh-CN/Badge.astro"; ### 导入 ```ts -import { GeometryPoint } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryPoint } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryPoint } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryPoint } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryPoint } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryPoint } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -31,4 +31,4 @@ new GeometryPoint(source); #### 返回值 -如果通过 `new` 调用,`GeometryPoint` 将返回它的实例。 +通过 `new` 调用时,`GeometryPoint` 将返回其实例。 diff --git a/docs/cache/ja2zh-CN/content/v2/api/data/geometry-polygon.mdx b/docs/cache/ja2zh-CN/content/v2/api/data/geometry-polygon.mdx index 16cbd45a..714377c1 100644 --- a/docs/cache/ja2zh-CN/content/v2/api/data/geometry-polygon.mdx +++ b/docs/cache/ja2zh-CN/content/v2/api/data/geometry-polygon.mdx @@ -1,18 +1,18 @@ --- -title: GeometryPolygon +title: 几何多边形 slug: zh-CN/v2/api/data/geometry-polygon --- import Badge from "~/components/zh-CN/Badge.astro"; -正在编辑中。 +正在编辑。 ### 导入 ```ts -import { GeometryPolygon } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryPolygon } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryPolygon } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryPolygon } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryPolygon } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryPolygon } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -27,8 +27,8 @@ new GeometryPolygon(source); ##### `source` -正在编辑中。 +正在编辑。 #### 返回值 -通过 `new` 调用时,`GeometryPolygon` 将返回其实例。 +当通过 `new` 调用时,`GeometryPolygon` 会返回其实例。 diff --git a/docs/cache/ja2zh-CN/content/v2/api/data/range.mdx b/docs/cache/ja2zh-CN/content/v2/api/data/range.mdx index debce5c2..48bd56c7 100644 --- a/docs/cache/ja2zh-CN/content/v2/api/data/range.mdx +++ b/docs/cache/ja2zh-CN/content/v2/api/data/range.mdx @@ -2,19 +2,19 @@ title: 范围 slug: zh-CN/v2/api/data/range banner: - content: 这是一个实验性功能。 + content: 此功能尚处于实验阶段。 --- import Badge from "~/components/zh-CN/Badge.astro"; -## 说明 +## 描述 ### 导入 ```ts -import { Range } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Range } from "@tai-kun/surrealdb/data-types/encodable"; -import { Range } from "@tai-kun/surrealdb/data-types/standard"; +import { Range } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Range } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Range } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -34,15 +34,15 @@ new Range( ##### `source` -范围的最小值和最大值对。如果无限制,则为 `null`。 +范围的最小值和最大值的配对。如果无限制则为 `null`。 #### 返回值 -当通过 `new` 调用时,`Range` 将返回其实例。 +如果通过 `new` 调用,`Range` 会返回其实例。 ### `.begin` -范围的最小值。如果无下限,则为 `null`。 +范围的最小值。如果无下限则为 `null`。 ```ts .begin: BoundIncluded | BoundExcluded | null; @@ -50,7 +50,7 @@ new Range( ### `.end` -范围的最大值。如果无上限,则为 `null`。 +范围的最大值。如果无上限则为 `null`。 ```ts .end: BoundIncluded | BoundExcluded | null; @@ -58,9 +58,9 @@ new Range( ### `.toString()` -将 `Range` 对象转换为 SurrealQL 中可用的字符串。 +将 `Range` 对象转换为 SurrealQL 可用的字符串。 -`.toJSON()` 和 `.toSurql()` 方法将返回相同的结果。 +`.toJSON()` 和 `.toSurql()` 方法返回与该方法相同的结果。 ```ts .toString(): string; @@ -81,7 +81,7 @@ import { Range, BoundIncluded, BoundExcluded, -} from "@tai-kun/surrealdb/data-types/encodable"; +} from "@tai-kun/surrealdb/encodable-datatypes"; const range = new Range([new BoundIncluded(1), new BoundIncluded(3)]); console.log(range.toString()); @@ -120,11 +120,11 @@ console.log(range.toString()); // -> .. ``` -### 进阶 +### 扩展 -#### `Range` 对象的通用判定 +#### `Range` 对象的通用判断 -建议使用 `isRange` 函数来判定一个值是否为 `Range` 对象,而不依赖预设。此函数不使用 `instanceof`,因此在预设未知的情况下,可以用于验证值。 +建议使用 `isRange` 函数来判断值是否为 `Range` 对象,而不依赖预设。该函数不使用 `instanceof`,因此在无法确定验证值预设的情况下非常有用。 ```ts import { isRange } from "@tai-kun/surrealdb"; diff --git a/docs/cache/ja2zh-CN/content/v2/api/data/table.mdx b/docs/cache/ja2zh-CN/content/v2/api/data/table.mdx index 66386c55..1421272d 100644 --- a/docs/cache/ja2zh-CN/content/v2/api/data/table.mdx +++ b/docs/cache/ja2zh-CN/content/v2/api/data/table.mdx @@ -10,9 +10,9 @@ import Badge from "~/components/zh-CN/Badge.astro"; ### 导入 ```ts -import { Table } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Table } from "@tai-kun/surrealdb/data-types/encodable"; -import { Table } from "@tai-kun/surrealdb/data-types/standard"; +import { Table } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Table } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Table } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -47,7 +47,7 @@ new Table(source: string | { name: string }); // standard 获取此属性时,字符串不会被转义。 ```ts -import { Table } from "@tai-kun/surrealdb/data-types/decode-only"; +import { Table } from "@tai-kun/surrealdb/decodeonly-datatypes"; const table = new Table("foo-bar"); console.log(table.name); @@ -56,9 +56,9 @@ console.log(table.name); ### `.toString()` -将 `Table` 对象转换为可在 SurrealQL 中使用的字符串形式。 +将 `Table` 对象转换为可在 SurrealQL 中使用的字符串变量。 -`.valueOf()` 和 `.toJSON()` 将返回与该方法相同的结果。 +`.valueOf()` 和 `.toJSON()` 会返回与该方法相同的结果。 ```ts .toString(): string; @@ -75,7 +75,7 @@ console.log(table.name); #### 例子 ```ts -import { Table } from "@tai-kun/surrealdb/data-types/encodable"; +import { Table } from "@tai-kun/surrealdb/encodable-datatypes"; const table = new Table("foo-bar"); console.log(table.toString()); @@ -84,7 +84,7 @@ console.log(table.toString()); ### `.toSurql()` -将 `Table` 对象转换为可嵌入 SurrealQL 的字符串形式。类似于 `.toString()`,但表格名称将按照 SurrealDB 的实现进行转义。 +将 `Table` 对象转换为可以嵌入 SurrealQL 的字符串。与 `.toString()` 相似,但表格名称会像 SurrealDB 的实现一样被转义。 ```ts .toSurql(): string; @@ -96,12 +96,12 @@ console.log(table.toString()); #### 返回值 -返回转义的表格名称字符串。 +返回转义后的表格名称字符串。 #### 例子 ```ts -import { Table } from "@tai-kun/surrealdb/data-types/encodable"; +import { Table } from "@tai-kun/surrealdb/encodable-datatypes"; const table = new Table("foo-bar"); console.log(table.toSurql()); @@ -110,7 +110,7 @@ console.log(table.toSurql()); ### `.clone()` -克隆 `Table` 对象。 +复制 `Table` 对象。 ```ts .clone(): this; @@ -122,7 +122,7 @@ console.log(table.toSurql()); #### 返回值 -返回一个新的 `Table` 对象。如果继承了 `Table` 类,则返回该类的实例。 +返回一个新的 `Table` 对象。如果继承了 `Table` 类,则会返回该类的实例。 ### 进阶 @@ -131,7 +131,7 @@ console.log(table.toSurql()); 可以使用类型参数来使 `Table` 的表格名称类型安全: ```ts -import { Table } from "@tai-kun/surrealdb/data-types/standard"; +import { Table } from "@tai-kun/surrealdb/standard-datatypes"; function isUserTable(table: unknown): table is Table<"user"> { return table instanceof Table @@ -139,9 +139,9 @@ function isUserTable(table: unknown): table is Table<"user"> { } ``` -#### 通用 `Table` 对象判定 +#### `Table` 对象的通用判定 -建议使用 `isTable` 函数来判定一个值是否是 `Table` 对象,而不依赖于预设。该函数不使用 `instanceof`,因此当验证的值的预设未知时很有用。 +建议使用 `isTable` 函数来判断一个值是否为 `Table` 对象,而无需依赖预设。该函数不使用 `instanceof`,因此当验证值的预设未知时非常有用。 ```ts import { isTable } from "@tai-kun/surrealdb"; diff --git a/docs/cache/ja2zh-CN/content/v2/api/data/thing.mdx b/docs/cache/ja2zh-CN/content/v2/api/data/thing.mdx index afd59adc..157245e9 100644 --- a/docs/cache/ja2zh-CN/content/v2/api/data/thing.mdx +++ b/docs/cache/ja2zh-CN/content/v2/api/data/thing.mdx @@ -5,14 +5,14 @@ slug: zh-CN/v2/api/data/thing import Badge from "~/components/zh-CN/Badge.astro"; -`Thing` 是用来表示[记录 ID](https://surrealdb.com/docs/surrealql/datamodel/ids) 的类。 +`Thing` 是一个表示[记录 ID](https://surrealdb.com/docs/surrealql/datamodel/ids) 的类。 ### 导入 ```ts -import { Thing } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Thing } from "@tai-kun/surrealdb/data-types/encodable"; -import { Thing } from "@tai-kun/surrealdb/data-types/standard"; +import { Thing } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Thing } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Thing } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -28,7 +28,7 @@ new Thing(table: string, id: string | number | bigint | object); ##### `source` -记录 ID 的表部分和 ID 部分的组合。 +记录 ID 的表部分和 ID 部分的配对。 ##### `table` @@ -40,11 +40,11 @@ new Thing(table: string, id: string | number | bigint | object); #### 返回值 -当通过 `new` 调用时,`Thing` 会返回它的实例。 +如果通过 `new` 调用,`Thing` 将返回其实例。 ### `.table` -记录 ID 的表部分。获取该属性时,字符串不会被转义。 +记录 ID 的表部分。获取此属性时,字符串不会被转义。 ```ts .table: string; @@ -52,10 +52,10 @@ new Thing(table: string, id: string | number | bigint | object); #### 例子 -获取该属性时,字符串不会被转义。 +获取此属性时,字符串不会被转义。 ```ts -import { Thing } from "@tai-kun/surrealdb/data-types/decode-only"; +import { Thing } from "@tai-kun/surrealdb/decodeonly-datatypes"; const thing = new Thing("foo-bar", 0); console.log(this.id); @@ -72,7 +72,7 @@ console.log(this.id); ### `.toString()` -将 `Thing` 对象转换为 SurrealQL 中可用的字符串形式。表名和 ID 部分分别按照 SurrealDB 的实现进行转义和格式化。此外,对象属性将按升序排序。 +将 `Thing` 对象转换为在 SurrealQL 中可用的变量字符串。表名和 ID 部分将分别按照 SurrealDB 的实现进行转义和格式化。此外,对象的属性将按照升序进行排序。 `.valueOf()` 和 `.toJSON()` 将返回与该方法相同的结果。 @@ -86,12 +86,12 @@ console.log(this.id); #### 返回值 -返回格式化后的记录 ID 字符串。 +返回格式化的记录 ID 字符串。 #### 例子 ```ts -import { Thing } from "@tai-kun/surrealdb/data-types/encodable"; +import { Thing } from "@tai-kun/surrealdb/encodable-datatypes"; const thing = new Thing([ "foo-bar", @@ -103,7 +103,7 @@ console.log(thing.toString()); ### `.toSurql()` -将 `Thing` 对象转换为可嵌入 SurrealQL 的字符串。类似于 `.toString()`,但添加 `r` 前缀,以便告诉查询解析器该字符串是记录 ID。 +将 `Thing` 对象转换为可以在 SurrealQL 中嵌入的字符串。与 `.toString()` 相似,但它添加 `r` 前缀,以告知查询解析器该字符串是记录 ID。 ```ts .toSurql(): string; @@ -115,12 +115,12 @@ console.log(thing.toString()); #### 返回值 -返回格式化后的记录 ID 字符串。 +返回格式化的记录 ID 字符串。 #### 例子 ```ts -import { Thing } from "@tai-kun/surrealdb/data-types/encodable"; +import { Thing } from "@tai-kun/surrealdb/encodable-datatypes"; const thing = new Thing("foo", "bar"); console.log(thing.toSurql()); @@ -129,7 +129,7 @@ console.log(thing.toSurql()); ### `.clone()` -复制 `Thing` 对象。但 ID 部分不会被复制,而是被引用。 +克隆 `Thing` 对象。但是,ID 部分不会被克隆,而是被引用。 ```ts .clone(): this; @@ -147,10 +147,10 @@ console.log(thing.toSurql()); #### 类型守卫 -可以使用类型参数使 `Thing` 的表部分和 ID 部分分别具有类型安全性: +可以使用类型参数为 `Thing` 的表部分和 ID 部分分别进行类型安全: ```ts -import { Thing, Uuid } from "@tai-kun/surrealdb/data-types/standard"; +import { Thing, Uuid } from "@tai-kun/surrealdb/standard-datatypes"; function isUserRecordId(thing: unknown): thing is Thing<"user", Uuid> { return thing instanceof Thing @@ -159,9 +159,9 @@ function isUserRecordId(thing: unknown): thing is Thing<"user", Uuid> { } ``` -#### `Thing` 对象的通用判断 +#### `Thing` 对象的通用判定 -建议使用 `isThing` 函数来判断一个值是否为 `Thing` 对象,而无需依赖预设。该函数不使用 `instanceof`,因此在验证值的预设未知时非常有用。 +建议使用 `isThing` 函数来判定一个值是否为 `Thing` 对象,而不依赖于预设。此函数不使用 `instanceof`,因此在验证值预设未知的情况下非常有用。 ```ts import { isThing } from "@tai-kun/surrealdb"; diff --git a/docs/cache/ja2zh-CN/content/v2/api/data/uuid.mdx b/docs/cache/ja2zh-CN/content/v2/api/data/uuid.mdx index e452a53e..af1c26f7 100644 --- a/docs/cache/ja2zh-CN/content/v2/api/data/uuid.mdx +++ b/docs/cache/ja2zh-CN/content/v2/api/data/uuid.mdx @@ -5,14 +5,14 @@ slug: zh-CN/v2/api/data/uuid import Badge from "~/components/zh-CN/Badge.astro"; -UUID(通用唯一识别码)是一个 128 位的标识符,用于唯一地标识特定实体。`Uuid` 类表示 UUID,支持 UUID v1 到 v7。需要注意的是,生成 UUID 需要使用单独的库或运行时内置功能(例如 `node:crypto`)。 +UUID(Universally Unique Identifier)是一种用于唯一标识特定实体的 128 位标识符。`Uuid` 类用于表示 UUID。它支持 UUID v1 到 v7。需要注意的是,要生成 UUID,需要使用单独的库或运行时内置的函数(例如 `node:crypto`)。 ### 导入 ```ts -import { Uuid } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Uuid } from "@tai-kun/surrealdb/data-types/encodable"; -import { Uuid } from "@tai-kun/surrealdb/data-types/standard"; +import { Uuid } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Uuid } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Uuid } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -28,11 +28,11 @@ new Uuid(source: Uint8Array | string); // standard ##### `source` -UUID 的字节数组表示,如果是 `standard` 预设,则为字符串。 +UUID 的字节数组表示形式,如果使用 standard 预设,则为字符串。 #### 返回值 -通过 `new` 调用时,`Uuid` 返回其实例。 +通过 `new` 调用时,`Uuid` 将返回其实例。 ### `.bytes` @@ -44,23 +44,23 @@ UUID 的字节数组。 ### `.variant` -UUID 的变体。它由 UUID 第 13 位的高位比特定义,有三个主要变体和一个为将来保留的变体。 +UUID 的变体。这由 UUID 的第 13 位的上位比特定义,包括以下三个主要变体和一个为将来保留的变体: 1. NCS 兼容 - `0b0xxx` - - 表示 UUID 与 NCS(网络计算系统)兼容。 - - 不常使用。 + - 表示 UUID 与 NCS(Network Computing System)兼容。 + - 不常被使用。 2. RFC 4122 兼容 - `0b10xx` - 基于 RFC 4122(UUID 标准规范)的 UUID。 - - 是最常用的 UUID 格式,包括 v1(时间戳)和 v4(随机)等格式。 + - 是 UUID 的常用形式,包括 v1(基于时间)和 v4(随机)等形式。 3. Microsoft GUID 兼容 - `0b110x` - - Microsoft 使用的 GUID(全局唯一标识符)格式。 + - Microsoft 使用的 GUID(Globally Unique Identifier)的格式。 4. 为将来保留 - `0b111x` -此属性除了以上变体外,还表示 NIL UUID 和 MAX UUID。 +此属性除了以上变体之外,还表示 NIL UUID 和 MAX UUID。 ```ts .variant: @@ -74,7 +74,7 @@ UUID 的变体。它由 UUID 第 13 位的高位比特定义,有三个主要 ### `.version` -如果 UUID 的变体为 `"RFC"`,则为 UUID 版本号。否则为 `null`。 +如果 UUID 的变体为 `"RFC"`,则表示 UUID 版本号。否则为 `null`。 ```ts .version: 1 | 2 | 3 | 4 | 5 | 6 | 7 | null; @@ -82,7 +82,7 @@ UUID 的变体。它由 UUID 第 13 位的高位比特定义,有三个主要 ### `.timestamp` -如果 UUID 的变体为 `"RFC"`,版本为 v1、v6 或 v7 之一,则为时间戳部分。否则为 `null`。为了方便,所有时间戳都计算为自 UNIX 纪元以来的毫秒数。 +如果 UUID 的变体为 `"RFC"` 且版本为 v1、v6 或 v7 之一,则表示时间戳部分。否则为 `null`。为了方便起见,所有时间戳都被计算为自 UNIX 纪元以来的毫秒数。 ```ts .timestamp: number | null; @@ -92,7 +92,7 @@ UUID 的变体。它由 UUID 第 13 位的高位比特定义,有三个主要 将 `Uuid` 对象转换为 SurrealQL 变量中可用的字符串。 -`.valueOf()` 和 `.toJSON()` 返回与该方法相同的结果。 +`.valueOf()` 和 `.toJSON()` 将返回与该方法相同的结果。 ```ts .toString(): string; @@ -109,7 +109,7 @@ UUID 的变体。它由 UUID 第 13 位的高位比特定义,有三个主要 #### 例子 ```ts -import { Uuid } from "@tai-kun/surrealdb/data-types/encodable"; +import { Uuid } from "@tai-kun/surrealdb/encodable-datatypes"; const bytes = new Uint8Array([ 0x26, 0xc8, 0x01, 0x63, @@ -125,7 +125,7 @@ console.log(uuid.toString()); ### `.toSurql()` -将 `Uuid` 对象转换为可以嵌入 SurrealQL 的字符串。类似于 `.toString()`,但添加了 `u` 前缀,告诉查询解析器该字符串是一个 UUID。 +将 `Uuid` 对象转换为可嵌入 SurrealQL 的字符串。与 `.toString()` 类似,但添加了 `u` 前缀,告诉查询解析器该字符串是 UUID。 ```ts .toSurql(): string; @@ -142,7 +142,7 @@ console.log(uuid.toString()); #### 例子 ```ts -import { Uuid } from "@tai-kun/surrealdb/data-types/encodable"; +import { Uuid } from "@tai-kun/surrealdb/encodable-datatypes"; const bytes = new Uint8Array([ 0x26, 0xc8, 0x01, 0x63, @@ -188,14 +188,14 @@ console.log(uuid.toSurql()); #### 返回值 -如果任一方没有时间戳部分,或者时间戳相同,则返回 `0`。如果比较的 UUID 的时间戳比当前时间戳更早,则返回 `-1`,如果更晚,则返回 `1`。 +如果一方没有时间戳部分,或者时间戳相同,则返回 `0`。如果比较对象的 UUID 时间戳比当前时间戳更早,则返回 `-1`,如果更晚,则返回 `1`。 #### 例子 -以下示例比较不同 UUID 版本的时间戳,并按升序排列: +以下示例比较不同 UUID 版本的时间戳,并按升序排序: ```ts -import { Uuid } from "@tai-kun/surrealdb/data-types/standard"; +import { Uuid } from "@tai-kun/surrealdb/standard-datatypes"; const uuidv1 = new Uuid("0e004000-2073-11ef-8451-eb2a011f8691"); const uuidv6 = new Uuid("1ef1fa9e-3968-6000-a77e-683eb1a35ebe"); @@ -223,7 +223,7 @@ console.log(uuidList); #### `Uuid` 对象的通用判断 -建议使用 `isUuid` 函数来判断值是否为 `Uuid` 对象,而不依赖于预设。该函数不使用 `instanceof`,因此当验证值的预设未知时很有用。 +建议使用 `isUuid` 函数来判断值是否为 `Uuid` 对象,而无需依赖于预设。该函数不使用 `instanceof`,因此在验证值预设未知的情况下非常有用。 ```ts import { isUuid } from "@tai-kun/surrealdb"; diff --git a/docs/cache/ja2zh-CN/content/v2/getting-started.mdx b/docs/cache/ja2zh-CN/content/v2/getting-started.mdx index 809ad780..58bf99b4 100644 --- a/docs/cache/ja2zh-CN/content/v2/getting-started.mdx +++ b/docs/cache/ja2zh-CN/content/v2/getting-started.mdx @@ -36,7 +36,7 @@ import { Tabs, TabItem } from "@astrojs/starlight/components"; import { Surreal } from "@tai-kun/surrealdb"; const db = new Surreal(); -await db.connect(""); // 例如 ws://localhost:8000 +await db.connect(""); // e.g. ws://localhost:8000 try { await db.signin({ user: "root", pass: "root" }); @@ -52,16 +52,16 @@ try { ```ts import { initSurreal } from "@tai-kun/surrealdb"; -import Client from "@tai-kun/surrealdb/clients/standard"; -import HttpEngine from "@tai-kun/surrealdb/engines/http"; -import JsonFormatter from "@tai-kun/surrealdb/formatters/json"; +import Client from "@tai-kun/surrealdb/standard-client"; +import HttpEngine from "@tai-kun/surrealdb/http-engine"; +import JsonFormatter from "@tai-kun/surrealdb/json-formatter"; const { Surreal } = initSurreal({ Client: Client, engines: { http: config => new HttpEngine({ ...config, - // fetch: <您的自定义fetch函数> + // fetch: }), https: "http", }, diff --git a/docs/cache/ja2zh-CN/content/v2/guides/errors.mdx b/docs/cache/ja2zh-CN/content/v2/guides/errors.mdx index 9372eec8..a967dff0 100644 --- a/docs/cache/ja2zh-CN/content/v2/guides/errors.mdx +++ b/docs/cache/ja2zh-CN/content/v2/guides/errors.mdx @@ -3,15 +3,15 @@ title: 错误 slug: zh-CN/v2/guides/errors --- -## 简介 +## 概述 -一些错误对象可能具有 `.cause` 属性。大多数情况下,此属性类型为 `unknown`,其值可能会在将来发生更改,恕不另行通知。 +某些错误对象可能设置了 `.cause` 属性。在大多数情况下,它将是 `unknown` 类型,其值可能会在将来更改而不会另行通知。 -## 通用 +## 通用错误 ### SurrealError -`SurrealError` 是此 SDK 显式抛出的大多数错误对象的基类。此类继承自 JavaScript 的 `Error` 类。此错误对象很少单独抛出,通常抛出的是其继承的具有特定含义的错误对象。建议使用 `try-catch` 语句等捕获此错误,以便轻松地将此 SDK 显式抛出的错误进行分类。 +`SurrealError` 是此 SDK 显式抛出的几乎所有错误对象的基类。该类继承自 JavaScript 的 `Error` 类。很少单独抛出此错误对象,通常会抛出具有特定含义的子类错误对象。建议使用它来简单地分类在 `try-catch` 语句中捕获的错误,以判断该错误是否是由此 SDK 显式抛出的。 #### 属性 @@ -29,7 +29,7 @@ slug: zh-CN/v2/guides/errors ### SurrealTypeError -继承自: `SurrealError` +继承自:`SurrealError` 当输入值或其他验证失败时抛出此错误。 @@ -39,18 +39,18 @@ slug: zh-CN/v2/guides/errors : 错误名称。 `.expected` -: 期望的数据格式。 +: 预期的数据格式。 `.actual` : 实际值的字符串表示形式。 #### 解决方法 -跟踪堆栈跟踪,找出导致不输入期望数据格式的原因。 +沿着堆栈跟踪查找导致未输入预期数据格式的原因。 ### SurrealValueError -继承自: `SurrealError` +继承自:`SurrealError` 当输入值或其他验证失败时抛出此错误。 @@ -60,20 +60,20 @@ slug: zh-CN/v2/guides/errors : 错误名称。 `.expected` -: 期望的数据格式。 +: 预期的数据格式。 `.actual` : 实际值。 #### 解决方法 -跟踪堆栈跟踪,找出导致不输入期望数据格式的原因。 +沿着堆栈跟踪查找导致未输入预期数据格式的原因。 ### SurrealAggregateError -继承自: `SurrealError` +继承自:`SurrealError` -这是一个聚合了多个错误或错误消息的错误。 +这是一个包含多个错误或错误消息的错误。 #### 属性 @@ -81,13 +81,13 @@ slug: zh-CN/v2/guides/errors : 错误名称。 `.cause: unknown[]` -: 数组的每个元素都包含错误或错误消息等。 +: 数组中的每个元素都包含错误或错误消息等。 ### CircularReferenceError -继承自: `SurrealError` +继承自:`SurrealError` -当检测到循环引用时抛出此错误。主要是在将 JavaScript 值转换为其他格式的过程中,如果检测到父对象与同一对象,则会抛出此错误。 +当检测到循环引用时抛出此错误。主要是在将 JavaScript 值转换为其他格式的过程中,当检测到与父对象相同的对象时抛出。 #### 属性 @@ -112,11 +112,11 @@ toSurql(a); // throws CircularReferenceError #### 解决方法 -此错误也可能在 `toSurql` 函数之外抛出,这是一个常见的错误。您需要仔细调试对象内部,查看它是否包含自身。 +此错误也可能在除 `toSurql` 函数之外的其他地方抛出。需要仔细调试对象内部,以确保其中不包含该对象本身。 ### NumberRangeError -继承自: `SurrealError` +继承自:`SurrealError` 当数值超出范围时抛出此错误。 @@ -126,23 +126,23 @@ toSurql(a); // throws CircularReferenceError : 错误名称。 `.range` -: 期望的范围。 +: 预期范围。 `.actual` : 实际值。 `.integer` -: 如果为 `true`,则期望整数。 +: 如果为 `true`,则表示预期为整数。 #### 解决方法 -跟踪堆栈跟踪,找出导致不输入期望数据格式的原因。 +沿着堆栈跟踪查找导致未输入预期数据格式的原因。 ### UnsupportedRuntimeError -继承自: `SurrealError` +继承自:`SurrealError` -当检测到使用不受支持的运行时时抛出此错误。 +当判断正在使用不受支持的运行时环境时抛出此错误。 #### 属性 @@ -151,13 +151,13 @@ toSurql(a); // throws CircularReferenceError #### 解决方法 -您需要避免使用该运行时,或者使用 polyfill 并进行充分测试。 +要么不要使用该运行时环境,要么使用 polyfill 并充分测试。 ### UnreachableError -继承自: `SurrealError` +继承自:`SurrealError` -当到达不可达代码时抛出此错误。如果抛出此错误,则可能遇到了此 SDK 的错误。 +当遇到不可达的代码时抛出此错误。如果遇到此错误,则可能遇到了此 SDK 的错误。 #### 属性 @@ -166,7 +166,7 @@ toSurql(a); // throws CircularReferenceError #### 解决方法 -您可以通过以下 URL 报告此问题: +可以通过以下 URL 提交此问题: [https://github.com/tai-kun/surrealdb.js/issues](https://github.com/tai-kun/surrealdb.js/issues) @@ -174,9 +174,9 @@ toSurql(a); // throws CircularReferenceError ### CircularEngineReferenceError -继承自: `CircularReferenceError` +继承自:`CircularReferenceError` -当在数据库连接过程中发生引擎之间的循环引用时抛出此错误。 +当在连接到数据库时,在引擎之间出现循环引用时抛出此错误。 #### 属性 @@ -184,10 +184,10 @@ toSurql(a); // throws CircularReferenceError : 错误名称。 `.reference: string` -: 发生循环引用的方案名称。 +: 发生循环引用的模式名称。 `.seen: string[]` -: 发生循环引用之前经过的方案名称列表。 +: 发生循环引用之前经过的模式名称列表。 例如,在以下情况下会抛出此错误: @@ -206,15 +206,15 @@ await using db = new Surreal(); await db.connect("https://localhost:8000"); // throws CircularEngineReferenceError: Circular engine reference: http,https ``` -在上面的示例中,尽管 https 协议的引擎指示使用 http 的引擎,但 http 协议的引擎又试图使用 https 的引擎,从而导致循环引用错误。 +在上面的示例中,尽管 https 协议的引擎指示使用 http 的引擎,但 http 协议的引擎尝试使用 https 的引擎,从而导致循环引用错误。 #### 解决方法 -不要将字符串形式的协议名称设置为另一个协议名称的值,而是将其替换为创建引擎的具体实现: +不要将字符串指定为协议名称的值,而是将它替换为创建引擎的具体实现: ```ts del={6} ins={7-10} import { initSurreal } from "@tai-kun/surrealdb"; -import HttpEngine from "@tai-kun/surrealdb/engines/http"; +import HttpEngine from "@tai-kun/surrealdb/http-engine"; const { Surreal } = initSurreal({ engines: { @@ -231,9 +231,9 @@ const { Surreal } = initSurreal({ ### EngineNotFoundError -继承自: `SurrealError` +继承自:`SurrealError` -当尝试使用未设置引擎的协议进行连接时抛出此错误。 +当尝试使用未设置引擎的协议连接时抛出此错误。 #### 属性 @@ -241,7 +241,7 @@ const { Surreal } = initSurreal({ : 错误名称。 `.scheme: string` -: 要连接到的协议名称。 +: 要连接的协议名称。 例如,在以下情况下会抛出此错误: @@ -261,7 +261,7 @@ await db.connect("https://localhost:8000"); // throws EngineNotFoundError: No ht #### 解决方法 -检查 `engines` 属性,查看要连接到的端点的协议是否可以创建引擎。 +检查 `engines` 属性以确定连接目标终结点的协议是否可以创建引擎。 ```ts ins={6} import { initSurreal } from "@tai-kun/surrealdb"; @@ -277,9 +277,9 @@ const { Surreal } = initSurreal({ ### ConnectionConflictError -继承自: `SurrealError` +继承自:`SurrealError` -当客户端尝试同时连接到多个端点时抛出此错误。 +当客户端尝试同时连接到多个终结点时抛出此错误。 #### 属性 @@ -287,10 +287,10 @@ const { Surreal } = initSurreal({ : 错误名称。 `.endpoint1: string` -: 已经连接的端点。 +: 已连接的终结点。 `.endpoint2: string` -: 另一个端点。 +: 另一个终结点。 ```ts import { Surreal } from "@tai-kun/surrealdb"; @@ -301,7 +301,7 @@ await db.connect("ws://localhost:8000"); await db.connect("ws://localhost:1129"); // throws ConnectionConflictError: An attempt was made to connect to ws://localhost:1129/rpc while ws://localhost:8000/rpc was already connected. ``` -`.connect` 方法会在传递的 URL 的路径不以 `/rpc` 结尾时在末尾添加 `/rpc`。因此,如果一方的端点 URL 路径以 `/rpc` 结尾,则可能不会出现错误,尽管它看起来并非如此: +`.connect` 方法会在传递的 URL 的路径不以 `/rpc` 结尾时,在末尾添加它。因此,如果一方终结点的 URL 路径以 `/rpc` 结尾,则它可能不会抛出错误,这与表面看起来不同: ```ts import { Surreal } from "@tai-kun/surrealdb"; @@ -323,7 +323,7 @@ await db.connect("http://localhost:8000"); // OK! #### 解决方法 -在调用 `.connect` 方法之前调用 `.close` 方法,就可以连接到任意端点。 +通过调用 `.close` 方法,可以在调用 `.connect` 方法之前连接到任何终结点。 ```ts ins={6} import { Surreal } from "@tai-kun/surrealdb"; @@ -337,9 +337,9 @@ await db.connect("http://localhost:11298"); ### MissingNamespaceError -继承自: `SurrealError` +继承自:`SurrealError` -当在选择数据库之前未选择命名空间时抛出此错误。或者,当您选择数据库后尝试将命名空间设为未选择状态时也会抛出此错误。 +当在选择数据库之前未选择命名空间时抛出此错误。或者,即使选择了数据库,但仍尝试将其设置为未选择命名空间状态时也会抛出此错误。 #### 属性 @@ -364,7 +364,7 @@ await db.use({ #### 解决方法 -选择数据库时,也要选择命名空间。 +选择数据库时,应同时选择命名空间。 ```ts ins={7} import { Surreal } from "@tai-kun/surrealdb"; @@ -380,9 +380,9 @@ await db.use({ ### RpcResponseError -继承自: `SurrealError` +继承自:`SurrealError` -当 RPC 响应指示错误时抛出此错误。连接的协议的通信和响应体的解码都没有问题,但这意味着 SurrealDB 无法处理 RPC 请求。 +当 RPC 响应指示错误时抛出此错误。连接的协议、响应正文的解码等都没有问题,但这意味着 SurrealDB 无法处理 RPC 请求。 #### 属性 @@ -390,18 +390,18 @@ await db.use({ : 错误名称。 `.id?: string` -: 识别 RPC 请求的 ID。ID 始终以 `<方法名>_` 开头。 +: 标识 RPC 请求的 ID。ID 始终以 `<方法名>_` 开头。 `.code: number` -: 尽管在 SurrealDB 的文档中没有明确说明,但它可能是 JSON-RPC 的错误代码。 +: SurrealDB 文档中没有明确说明,但可能代表 JSON-RPC 错误代码。 #### 解决方法 -可能有多种原因,但可能是此 SDK 支持的 SurrelDB 版本与处理 RPC 请求的 SurrealDB 版本不同。 +可能有各种原因,但可能是此 SDK 支持的 SurrelDB 版本与处理 RPC 请求的 SurrealDB 版本不一致。 ### QueryFailedError -继承自: `SurrealAggregateError` +继承自:`SurrealAggregateError` 当查询失败时抛出此错误。 @@ -424,20 +424,20 @@ await db.query("OUTPUT 'Hello'"); // throws QueryFailedError: Query failed with #### 解决方法 -检查 SurrelQL 语法是否正确。 +确认 SurrelQL 语法是否正确。 ### Closed -继承自: `SurrealError` +继承自:`SurrealError` -指示连接被强制关闭的错误。 +表示连接已被强制终止。 #### 属性 `.name: "Closed"` : 错误名称。 -例如,在以下情况下会得到此错误: +例如,在以下情况下会收到此错误: ```ts const db = new Surreal(); @@ -460,9 +460,9 @@ await db.close({ force: true }); ### EngineError -继承自: `SurrealError` +继承自:`SurrealError` -指示这是一个由引擎引起的错误。它通过事件监听器发送。 +表示这是由引擎导致的错误。它通过事件监听器发出。 #### 属性 @@ -474,9 +474,9 @@ await db.close({ force: true }); ### HttpEngineError -继承自: `EngineError` +继承自:`EngineError` -指示这是一个由 HTTP 引擎引起的错误。目前仅定义,尚未使用。 +表示这是由 HTTP 引擎导致的错误。目前仅定义,尚未使用。 #### 属性 @@ -485,11 +485,11 @@ await db.close({ force: true }); ### WebSocketEngineError -继承自: `EngineError` +继承自:`EngineError` -指示这是一个由 WebSocket 引擎引起的错误。它在解析响应体之前无法找到识别 RPC 请求的 ID、从 WebSocket 对象接收错误事件或断开 WebSocket 连接时使用。 +表示这是由 WebSocket 引擎导致的错误。当在找到标识 RPC 请求的 ID 之前解析响应正文失败,或从 WebSocket 对象接收错误事件,或断开 WebSocket 连接时使用。 -此 SDK 使用 `315x` 作为自定义状态代码。此范围在 [IANA](https://www.iana.org/assignments/websocket/websocket.xml#close-code-number) 中是未分配的状态代码。 +此 SDK 使用 `315x` 作为自定义状态代码。此范围在 [IANA](https://www.iana.org/assignments/websocket/websocket.xml#close-code-number) 中未分配状态代码。 #### 属性 @@ -499,12 +499,12 @@ await db.close({ force: true }); `.code: number` : 以下状态代码之一: - `1000`~`1015`: [MDN 参考](https://developer.mozilla.org/docs/Web/API/CloseEvent/code) - - `3150`: 指示从 `WebSocket`[^1] 实例接收 "error" 事件。 - - `3151`: 指示 WebSocket 引擎注册的 "open" 事件处理程序内发生错误。大多数情况下,是在连接中状态到连接状态的转换过程中发生了 `StateTransitionError`。 - - `3152`: 指示 WebSocket 引擎注册的 "message" 事件处理程序内发生错误。可能有多种原因,但最有可能的是,事件处理程序内抛出了 `ServerResponseError` 或 `RpcResponseError`。可能是由于请求了无效的 RPC 参数导致的。在这种情况下,RPC 的调用方方法将(默认情况下)在 5 秒后超时并失败。在 SurrealDB v2.0.2 之前的版本中,超时可能由更广泛的原因导致。 - - `3153`: 指示 ping 的发送或接收失败。这可能是暂时的错误,但如果持续收到此错误,则可能无法维持连接。 - - `3154`: 指示 WebSocket 引擎注册的 "close" 事件处理程序内发生错误。大多数情况下,是在断开连接状态到断开连接状态的转换过程中发生了 `StateTransitionError`。 -: 请注意,上面的代码不包括以下状态代码。此 SDK 不会将其视为错误。 + - `3150`: 表示从 `WebSocket`[^1] 实例收到 "error" 事件。 + - `3151`: 表示 WebSocket 引擎在注册的 "open" 事件处理程序中发生错误。大多数情况下是由于在连接状态到连接状态的转换过程中发生 `StateTransitionError`。 + - `3152`: 表示 WebSocket 引擎在注册的 "message" 事件处理程序中发生错误。可能有各种原因,但最有可能是事件处理程序中抛出了 `ServerResponseError` 或 `RpcResponseError`。可能是由于使用无效的 RPC 参数发送请求导致的。在这种情况下,RPC 的调用方方法(默认情况下)会在 5 秒后超时并失败。在 SurrealDB v2.0.2 之前的版本中,可能存在更广泛的原因导致超时。 + - `3153`: 表示 ping 的发送或接收失败。可能是暂时性错误,但如果持续收到,则可能表示连接无法维持。 + - `3154`: 表示 WebSocket 引擎在注册的 "close" 事件处理程序中发生错误。大多数情况下是由于在断开连接状态到断开连接状态的转换过程中发生 `StateTransitionError`。 +: 需要注意的是,上述状态代码中不包含以下状态代码。此 SDK 将其视为非错误。 - `1000`: 正常断开连接。 - `1001`: 早期断开连接很常见。 - `1004`: 保留。 @@ -517,19 +517,19 @@ await db.close({ force: true }); #### 解决方法 `1002`,`1003`,`1007`...`1011`,`1014`,`3150`,`3151`,`3154` -: 可能无法自动恢复这些状态代码。您需要修复运行时、SurrealDB 的配置或硬编码的实现。 +: 可能没有自动恢复此状态代码的方法。需要修改运行时环境、SurrealDB 设置或硬编码的实现。 `3152` : 检查传递给方法的参数(即 RPC 请求的内容)是否正确。 `1012`,`1013`,`3153` -: 您可能可以使用实验性功能 [`autoReconnect()`](/v2/experimental/auto-reconnect) 自动恢复。 +: 可以使用实验性功能 [`autoReconnect()`](/v2/experimental/auto-reconnect) 来实现自动恢复。 ### StateTransitionError -继承自: `SurrealAggregateError` +继承自:`SurrealAggregateError` -当在状态转换过程中事件监听器执行失败时抛出此错误。 +当状态转换期间事件监听器的执行失败时抛出此错误。 #### 属性 @@ -540,10 +540,10 @@ await db.close({ force: true }); : 状态转换开始时的状态。 `.to: string` -: 要转换到的状态。 +: 目标状态。 `.fallback: string` -: 如果状态转换失败,则作为替代转换目标。如果它与 `.to` 相同,则意味着它被强制转换。 +: 状态转换失败时的备用目标转换。如果它与 `.to` 相同,则表示已强制进行转换。 例如,在以下情况下会抛出此错误: @@ -571,9 +571,9 @@ await db.connect("http://localhost:8000"); // throws ... ### ConnectionUnavailableError -继承自: `SurrealError` +继承自:`SurrealError` -当在未连接状态下尝试发送 RPC 请求时抛出此错误。 +当尝试在未连接状态下发送 RPC 请求时抛出此错误。 #### 属性 @@ -582,9 +582,9 @@ await db.connect("http://localhost:8000"); // throws ... ### ServerResponseError -继承自: `SurrealError` +继承自:`SurrealError` -当无法将响应解析为 PRC 响应时抛出此错误。这与 `RpcResponseError` 不同。 +当无法将响应解析为 PRC 响应时抛出此错误。它与 `RpcResponseError` 不同。 #### 属性 @@ -593,15 +593,15 @@ await db.connect("http://localhost:8000"); // throws ... #### 解决方法 -通常不应该抛出此错误,但如果抛出,则可能是此 SDK 支持的 SurrelDB 版本与处理 RPC 请求的 SurrealDB 版本不同。 +通常不会抛出此错误,但如果抛出,则可能是此 SDK 支持的 SurrelDB 版本与处理 RPC 请求的 SurrealDB 版本不一致。 ## CBOR ### CborError -继承自: `SurrealError` +继承自:`SurrealError` -这是 `@tai-kun/surrealdb/cbor` 显式抛出的与 CBOR 相关的所有错误的基类。它不会直接抛出。 +它是 `@tai-kun/surrealdb/cbor` 显式抛出的所有与 CBOR 相关的错误的基类。它不会直接抛出。 #### 属性 @@ -610,22 +610,22 @@ await db.connect("http://localhost:8000"); // throws ... ### CborWellFormednessError -继承自: `CborError` +继承自:`CborError` #### 属性 -这是 `@tai-kun/surrealdb/cbor` 显式抛出的与 CBOR 解码相关的错误的基类。它不会直接抛出。 +它是 `@tai-kun/surrealdb/cbor` 显式抛出的所有与 CBOR 解码相关的错误的基类。它不会直接抛出。 -请参考 RFC8949 附录 F 中的“**[Well-Formedness Errors and Examples](https://datatracker.ietf.org/doc/html/rfc8949#name-well-formedness-errors-and-)**”。 +请参考 RFC8949 附录 F 中的“ [Well-Formedness Errors and Examples](https://datatracker.ietf.org/doc/html/rfc8949#name-well-formedness-errors-and-)”。 `.name: "CborWellFormednessError"` : 错误名称。 ### CborTooMuchDataError -继承自: `CborWellFormednessError` +继承自:`CborWellFormednessError` -它指示存在未使用的输入字节。 +表示有未消耗的输入字节剩余。 [RFC8949](https://datatracker.ietf.org/doc/html/rfc8949#section-appendix.f-2.2) @@ -636,13 +636,13 @@ await db.connect("http://localhost:8000"); // throws ... #### 解决方法 -检查要解码的字节数组是否为正确的 CBOR 格式。 +检查要解码的字节数组是否是正确的 CBOR 格式。 ### CborTooLittleDataError -继承自: `CborWellFormednessError` +继承自:`CborWellFormednessError` -它指示输入字节不完整。 +表示输入字节不完整。 [RFC8949](https://datatracker.ietf.org/doc/html/rfc8949#section-appendix.f-2.4) @@ -653,13 +653,13 @@ await db.connect("http://localhost:8000"); // throws ... #### 解决方法 -检查要解码的字节数组是否为正确的 CBOR 格式。 +检查要解码的字节数组是否是正确的 CBOR 格式。 ### CborSyntaxError -继承自: `CborWellFormednessError` +继承自:`CborWellFormednessError` -它指示输入字节与 CBOR 编码格式不匹配。 +表示输入字节与 CBOR 编码格式不匹配。 [RFC8949](https://datatracker.ietf.org/doc/html/rfc8949#section-appendix.f-2.6) @@ -670,13 +670,13 @@ await db.connect("http://localhost:8000"); // throws ... #### 解决方法 -检查要解码的字节数组是否为正确的 CBOR 格式。 +检查要解码的字节数组是否是正确的 CBOR 格式。 ### CborMaxDepthReachedError -继承自: `CborError` +继承自:`CborError` -当在 CBOR 编码或解码过程中 JavaScript 对象的深度达到最大值时抛出此错误。每次进入对象或数组时深度都会增加 1。 +当在 CBOR 编码或解码期间 JavaScript 对象的深度达到最大值时抛出此错误。每次进入对象或数组时,深度都会增加 1。 #### 属性 @@ -688,10 +688,10 @@ await db.connect("http://localhost:8000"); // throws ... #### 解决方法 -放松可选的 `.maxDepth` 上限,或者重新设计数据结构,使其嵌套更浅。 +放宽可选的 `.maxDepth` 上限,或重新设计数据结构以使其嵌套较浅。 ```ts -import CborFormatter from "@tai-kun/surrealdb/formatters/cbor"; +import CborFormatter from "@tai-kun/surrealdb/cbor-formatter"; const cborFormatter = new CborFormatter({ encode: { @@ -706,9 +706,9 @@ const cborFormatter = new CborFormatter({ ### CborUnsafeMapKeyError -继承自: `CborError` +继承自:`CborError` -当在 CBOR 编码或解码过程中遇到不安全的映射键时抛出此错误。 +当在 CBOR 编码或解码期间遇到不安全的映射键时抛出此错误。 #### 属性 @@ -716,15 +716,15 @@ const cborFormatter = new CborFormatter({ : 错误名称。 `.key: unknown` -: 被判定为不安全的映射键。 +: 被判断为不安全的映射键。 ## JSON ### JsonError -继承自: `SurrealError` +继承自:`SurrealError` -这是 `@tai-kun/surrealdb/formatters/json` 显式抛出的与 JSON 相关的错误的基类。它不会直接抛出。 +它是 `@tai-kun/surrealdb/json` 显式抛出的所有与 JSON-formatter 相关的错误的基类。 #### 属性 @@ -733,9 +733,9 @@ const cborFormatter = new CborFormatter({ ### JsonUnsafeMapKeyError -继承自: `JsonError` +继承自:`JsonError` -当在 JSON 解码过程中遇到不安全的映射键时抛出此错误。 +当在 JSON 解码期间遇到不安全的映射键时抛出此错误。 #### 属性 @@ -743,4 +743,4 @@ const cborFormatter = new CborFormatter({ : 错误名称。 `.key: unknown` -: 被判定为不安全的映射键。 +: 被判断为不安全的映射键。 diff --git a/docs/cache/ja2zh-CN/content/v2/supports.mdx b/docs/cache/ja2zh-CN/content/v2/supports.mdx index 0cd02a16..cebc0150 100644 --- a/docs/cache/ja2zh-CN/content/v2/supports.mdx +++ b/docs/cache/ja2zh-CN/content/v2/supports.mdx @@ -1,5 +1,5 @@ --- -title: 支持的環境 +title: 支持的环境 slug: zh-CN/v2/supports --- @@ -7,7 +7,7 @@ import { Aside } from "@astrojs/starlight/components" ## JavaScript -该 SDK 使用了 `bigint`,因此需要 JavaScript 语言规范 ES2020 或更高版本。此外,考虑到该 SDK 在运行时的要求,它预计可以在以下运行时环境中运行: +该 SDK 使用 `bigint`,因此需要 JavaScript 语言规范 ES2020 及更高版本。此外,考虑到 SDK 在运行时所需的特性,它应该可以在以下运行时环境中运行: | 运行时 | 版本 | | --- | --- | @@ -21,18 +21,18 @@ import { Aside } from "@astrojs/starlight/components" ## 测试 -测试使用 Vitest 和 Playwright。由于我们在运行时环境的最低版本上进行测试,因此实际运行时环境可能低于此处列出的版本,但仍可能正常工作。 +测试使用 Vitest 和 Playwright。由于我们在测试的运行时环境是最小版本,因此实际上可能在更旧的运行时环境中也能工作。 ### 服务器 | 运行时 | 版本 | 状态 | | --- | --- | --- | | SurrealDB | `^2.0.0` | [GitHub](https://github.com/surrealdb/surrealdb) | -| Node.js | `18.x`,
`20.x`,
`^22.5.1` | [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/tai-kun/surrealdb.js/nodejs.yml?branch=main&logo=Node.js&label=Node.js)](https://github.com/tai-kun/surrealdb.js/actions/workflows/nodejs.yml) | +| Node.js | `18.x`,
`20.x`,
`^22.5.1`,
`23.x` | [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/tai-kun/surrealdb.js/nodejs.yml?branch=main&logo=Node.js&label=Node.js)](https://github.com/tai-kun/surrealdb.js/actions/workflows/nodejs.yml) | | Deno | `1.x`, `2.x` | [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/tai-kun/surrealdb.js/deno.yml?branch=main&logo=Deno&label=Deno)](https://github.com/tai-kun/surrealdb.js/actions/workflows/deno.yml) | | Bun | `^1.1.13` | [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/tai-kun/surrealdb.js/bun.yml?branch=main&logo=Bun&label=Bun)](https://github.com/tai-kun/surrealdb.js/actions/workflows/bun.yml) | -- 使用 Node.js v22 时,请注意它尚未成为 LTS 版本。 +- 使用 Node.js v22 时,请注意它还不是 LTS 版本。 - 建议始终使用 Deno 的最新版本。 - 建议始终使用 Bun 的最新版本。 @@ -44,4 +44,4 @@ import { Aside } from "@astrojs/starlight/components" | Firefox | `>=100` | [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/tai-kun/surrealdb.js/firefox.yml?branch=main&logo=Firefox&label=Firefox)](https://github.com/tai-kun/surrealdb.js/actions/workflows/firefox.yml) | | WebKit | `>=15.4` | [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/tai-kun/surrealdb.js/webkit.yml?branch=main&style=flat&logo=safari&label=WebKit)](https://github.com/tai-kun/surrealdb.js/actions/workflows/webkit.yml) | -- 支持的浏览器(引擎)与 CI 上 Playwright 可运行的最低版本相匹配。因此,低于这些版本的浏览器也可能正常工作,但我们并未对其进行测试。 +- 支持的浏览器 (引擎) 与 CI 上 Playwright 工作的最小版本一致。因此,它可能在低于上述版本的版本中也能工作,但尚未测试。 diff --git a/docs/cache/ja2zh-CN/meta.json b/docs/cache/ja2zh-CN/meta.json index 016f2284..8eb2d191 100644 --- a/docs/cache/ja2zh-CN/meta.json +++ b/docs/cache/ja2zh-CN/meta.json @@ -34,23 +34,23 @@ "src/content/docs/ja/v2/api/cbor/others.mdx": "b145d4dec91d19c1ba3f079439c6ae24f00d9f39df6c42f792fa26c759fbd151", "src/content/docs/ja/v2/api/cbor/simple.mdx": "049e4b39b3c8058d2ea6beb4cf02ad1354cbbb769614a0af9c826fbe6a9c4c61", "src/content/docs/ja/v2/api/cbor/tagged.mdx": "eaaccc73d7eede688d61a8df1bcce558520862902587e3b42a453e414b910f79", - "src/content/docs/ja/v2/api/data/bound-excluded.mdx": "535cee4e8e9c7b717e6c91793fd5b0c8e046e6d00b48d54e4155e73c8162251f", - "src/content/docs/ja/v2/api/data/bound-included.mdx": "7e0ed8b43323f0b1c598be745a0b007460e9a67893dc82df1888418dd0ebf26f", - "src/content/docs/ja/v2/api/data/datetime.mdx": "66c73131a99bf3730b4bb2e69972f0b8e34fd5d13db4db28e1a3c479cabf0b5b", - "src/content/docs/ja/v2/api/data/decimal.mdx": "305509f5ffdf5a138e118e8ac2bec8ed538346df2cd397743aacc226edd50fbb", - "src/content/docs/ja/v2/api/data/duration.mdx": "09d6f603708d7268137a018af36998e204b4e1b8939638602f1e712b4558a716", - "src/content/docs/ja/v2/api/data/future.mdx": "be260b3684e743d2e14441a49c9173c1a3eb5590a3959301854813ba45392f2c", - "src/content/docs/ja/v2/api/data/geometry-collection.mdx": "178d0402d33935e207792f3c7442ec7aed928100f55f5627672fbd136e7cd8a3", - "src/content/docs/ja/v2/api/data/geometry-line.mdx": "b6acb8a1b5fc40415bf351445fefd92db6bbad5c471f9f9b561920ca0174d9ef", - "src/content/docs/ja/v2/api/data/geometry-multi-line.mdx": "2fc6fc4df7d6fac208cf0e4d9602e9162202f33266028502fe51b61ca209cb40", - "src/content/docs/ja/v2/api/data/geometry-multi-point.mdx": "ade5c8cedde13cd8f3d6820fc06e29a7075f3ea74a8d97e3353c9a9adc4c2e0b", - "src/content/docs/ja/v2/api/data/geometry-multi-polygon.mdx": "f758b5d58aaef14de7015b09c569a5399b88a30bf891798c5ca85a6f3c416e2b", - "src/content/docs/ja/v2/api/data/geometry-point.mdx": "2b8ff579cd126d47ea463296767bc5b8cfb0d332bdc957f63a31b07ba54bf994", - "src/content/docs/ja/v2/api/data/geometry-polygon.mdx": "7fb7006ac2f9aaf13e83120307066db07b3775d8bce92a35ecb5d54618eb2dd4", - "src/content/docs/ja/v2/api/data/range.mdx": "7b04bf21730cf383680175086e77eb7dfaa7ffeb3dbad536e400e4aaf12dac40", - "src/content/docs/ja/v2/api/data/table.mdx": "63c1a17261ae912a3afb674f423c2b4f1cfecbc186f1e8b533427cd63dcd03d6", - "src/content/docs/ja/v2/api/data/thing.mdx": "ea726d56de0c2a77243139a82470bb478111315d9242557bed7d6693d36b4957", - "src/content/docs/ja/v2/api/data/uuid.mdx": "20c413705ca46443d160e9c862d89ec55c130fe5c3ffcc83d1e8a850b4bf2010", + "src/content/docs/ja/v2/api/data/bound-excluded.mdx": "4ca974c26583a19e18874b9e191436a954ff134c23b3aa33423f0844d5c70ec3", + "src/content/docs/ja/v2/api/data/bound-included.mdx": "d3f57a189634088ef6a1bfee925cc3780e64e5fa5c8d83d5666e7fcb3e7a8890", + "src/content/docs/ja/v2/api/data/datetime.mdx": "42b526d7a4b5861e78a29344fda693ed82f6a28e71e6e54924040035ac2178a9", + "src/content/docs/ja/v2/api/data/decimal.mdx": "5144af18ec3653860276629d66292954829c861aac6413a957f1e7bc26f16965", + "src/content/docs/ja/v2/api/data/duration.mdx": "1d41cea1aa0970ce9038db8caa17a681cc52c7992906c57d6ba469dbf2a9ac03", + "src/content/docs/ja/v2/api/data/future.mdx": "9b38aaae94064918d4095639fd0b520579045b43db2b7698b93b302ac565c01c", + "src/content/docs/ja/v2/api/data/geometry-collection.mdx": "2a030e60dac28ff7db1cf45c397d00f6895f2735ce1e9f9d8190de723cc06e14", + "src/content/docs/ja/v2/api/data/geometry-line.mdx": "25a97999d42ca7d9a7c57e1c62453886205f2c045c461f1ce73b0a77c8fcf56e", + "src/content/docs/ja/v2/api/data/geometry-multi-line.mdx": "1f9e43eea7ae478d66e83b83cb81c6c7beb6ce418f96f5321f852a703639d5bb", + "src/content/docs/ja/v2/api/data/geometry-multi-point.mdx": "38b69ae433d86367d40d3781f49ef6ad6c6ef040a837735825b03dc4a46b04c4", + "src/content/docs/ja/v2/api/data/geometry-multi-polygon.mdx": "e332a5723638d29f04234755b8fde0c3c9bfe2be4fb950e867154c62f8348f5e", + "src/content/docs/ja/v2/api/data/geometry-point.mdx": "b8b33e46ed3785d4f88825d460218a869c6093493ce810c5af12d7caa392f190", + "src/content/docs/ja/v2/api/data/geometry-polygon.mdx": "bf3186571209421aa35af05b4d98d9c4f42128143d038d69b64c177cd17275d1", + "src/content/docs/ja/v2/api/data/range.mdx": "d9a6c951acfa5bc2681ba0e64eed6d2c92ea90f3b8dbd3537ec34ecacf907944", + "src/content/docs/ja/v2/api/data/table.mdx": "95fd31ca9dde61cd5eb28972387ebbd5d16a0d2a10ead1dcb47a0a44682aca52", + "src/content/docs/ja/v2/api/data/thing.mdx": "70ab67345d6ac8ed927d433b765352a33954410a564c2d9bb7771d68d9922ff9", + "src/content/docs/ja/v2/api/data/uuid.mdx": "66827ba5f26abffa06b84888f84b0524172fa19479a06b5e1682a5e617889c80", "src/content/docs/ja/v2/api/errors.mdx": "0123aa6e46d40265660dfb332b5ac40d30a5c2611181a51044facdf6d59c9bf0", "src/content/docs/ja/v2/api/utils/escape.mdx": "53ff6cc5ac2237b7fe89e83fbcf77e52fc07da950aa0737a00d6c22aba962955", "src/content/docs/ja/v2/api/utils/get-timeout-signal.mdx": "5e0d6e9e7d59ffbe26e842fb341cd85e4e83147d53018aa097b2839e9a582663", @@ -68,12 +68,12 @@ "src/content/docs/ja/v2/experimental/auto-reconnect.mdx": "5ab2638cd2f6b24f0ab9c7057c5d55d2bba2a1c15323d8400d3c56cc508a1c33", "src/content/docs/ja/v2/experimental/inline-query.mdx": "01c3eefb276d98513df5b65420a728818d074fa05fccaeba7aafa920dfd783ba", "src/content/docs/ja/v2/experimental/inline-rpc.mdx": "9ed5e094662ef832297f02c6d3b54ae106b69fa0063aca5934f08f079ef2260a", - "src/content/docs/ja/v2/getting-started.mdx": "b384c3fce1c8bb5e013f8ff58aba4299a01ca8d562e255e11d94f711e8a1935b", + "src/content/docs/ja/v2/getting-started.mdx": "10750269305fac724905c519f828978c619941d204e0663d6e02a47e9a12c9f0", "src/content/docs/ja/v2/guides/authentication.mdx": "4e14a03ccf5e9909d8e34c91d1cd57e6967adba64f42cc70977e4336e108bd43", "src/content/docs/ja/v2/guides/connecting.mdx": "935a36cc67811ee08309c9403b6b1a4adcf92978549ed22398ee895795ba3721", - "src/content/docs/ja/v2/guides/errors.mdx": "4c0c801e584c778a94d0cbdbfe80083425e00916c34a255f6164dfd6190398d2", + "src/content/docs/ja/v2/guides/errors.mdx": "4b7cb65027d0cdcece48f9a97c6aa1542e0a4cf2b362cd81a1ab4838f470f18c", "src/content/docs/ja/v2/guides/prepared-query.mdx": "f50edd1d83e2e296b6ca019fb27823f0b63c498742bc3b4f9de32c461952f7cf", "src/content/docs/ja/v2/guides/querying.mdx": "4fa8ff5de559a0a1d119b0f29ddef09ae1c814d0658a836f36a1495d98ba8a26", "src/content/docs/ja/v2/index.mdx": "b43660b727904827fa71595a2f5422771813f90ffb962ae8a6258236f6fc6ef2", - "src/content/docs/ja/v2/supports.mdx": "de67802f5acb169e19c16891077ff4f3952c2c8a69d5dae7a1d606227c28377a" + "src/content/docs/ja/v2/supports.mdx": "dbc53ced802569e4fba39ce33393b128a3beb946491a9cec11325683cb0076f2" } \ No newline at end of file diff --git a/docs/src/content/docs/en/v2/api/data/bound-excluded.mdx b/docs/src/content/docs/en/v2/api/data/bound-excluded.mdx index 1a2f181b..8af56a33 100644 --- a/docs/src/content/docs/en/v2/api/data/bound-excluded.mdx +++ b/docs/src/content/docs/en/v2/api/data/bound-excluded.mdx @@ -12,9 +12,9 @@ See [`Range`](/v2/api/data/range). ### Import ```ts -import { BoundExcluded } from "@tai-kun/surrealdb/data-types/decode-only"; -import { BoundExcluded } from "@tai-kun/surrealdb/data-types/encodable"; -import { BoundExcluded } from "@tai-kun/surrealdb/data-types/standard"; +import { BoundExcluded } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { BoundExcluded } from "@tai-kun/surrealdb/encodable-datatypes"; +import { BoundExcluded } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -29,12 +29,12 @@ new BoundExcluded(source: unknown); ##### `source` -This argument is under investigation and its specific usage is not yet documented. +Under investigation. #### Returns -When called via `new`, `BoundExcluded` returns its instance. +When called through `new`, `BoundExcluded` returns its instance. ### `.value` -This property is under investigation and its specific usage is not yet documented. +Under investigation. diff --git a/docs/src/content/docs/en/v2/api/data/bound-included.mdx b/docs/src/content/docs/en/v2/api/data/bound-included.mdx index 1da5be14..e2757bf3 100644 --- a/docs/src/content/docs/en/v2/api/data/bound-included.mdx +++ b/docs/src/content/docs/en/v2/api/data/bound-included.mdx @@ -12,9 +12,9 @@ See [`Range`](/v2/api/data/range). ### Import ```ts -import { BoundIncluded } from "@tai-kun/surrealdb/data-types/decode-only"; -import { BoundIncluded } from "@tai-kun/surrealdb/data-types/encodable"; -import { BoundIncluded } from "@tai-kun/surrealdb/data-types/standard"; +import { BoundIncluded } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { BoundIncluded } from "@tai-kun/surrealdb/encodable-datatypes"; +import { BoundIncluded } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -31,7 +31,7 @@ new BoundIncluded(source: unknown); Under investigation. -#### Returns +#### Return Value When called via `new`, `BoundIncluded` returns its instance. diff --git a/docs/src/content/docs/en/v2/api/data/datetime.mdx b/docs/src/content/docs/en/v2/api/data/datetime.mdx index 1fda4f7f..8c1971c6 100644 --- a/docs/src/content/docs/en/v2/api/data/datetime.mdx +++ b/docs/src/content/docs/en/v2/api/data/datetime.mdx @@ -5,14 +5,14 @@ slug: en/v2/api/data/datetime import Badge from "~/components/en/Badge.astro"; -`Datetime` is a class that represents a date and time. It corresponds to the SurrealQL [`datetime`](https://surrealdb.com/docs/surrealql/datamodel/datetimes) type. +`Datetime` is a class that represents dates and times. It corresponds to the [`datetime`](https://surrealdb.com/docs/surrealql/datamodel/datetimes) type in SurrealQL. -### Importing +### Import ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Datetime } from "@tai-kun/surrealdb/data-types/encodable"; -import { Datetime } from "@tai-kun/surrealdb/data-types/standard"; +import { Datetime } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Datetime } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Datetime } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -47,19 +47,19 @@ new Datetime( ##### `source` -A pair of seconds and nanoseconds, or a string. If the preset is standard, it also supports inputs such as `Date` object and `bigint`. +A pair of seconds and nanoseconds, or a string. If the preset is standard, it also supports input of `Date` objects and `bigint`. ##### `year`, `monthIndex`, ... -Same as the arguments for the `Date` class. However, it also supports `nanoseconds` input. `number` cannot be provided after an argument that provides `undefined`. This is roughly the same specification as the `Date` class. +These are the same as the arguments for the `Date` class. However, it also supports `nanoseconds` input. You cannot provide a `number` after an argument that has been provided with `undefined`. This is roughly the same specification as the `Date` class. -#### Return value +#### Return Value -When called through `new`, `Datetime` returns its instance. If the preset is standard, it is also an instance of `Date`. +When invoked through `new`, `Datetime` returns its instance. If the preset is standard, it is also an instance of `Date`. ### `.seconds` -The seconds part of a nanosecond-precise time. Read-only in presets below standard. The value is an integer from -253-1 to 253-1 or `NaN`. +The seconds part of the nanosecond-precision time. It is read-only in presets below standard. The value is an integer between -253-1 and 253-1, or `NaN`. ```ts .seconds: number; @@ -67,7 +67,7 @@ The seconds part of a nanosecond-precise time. Read-only in presets below standa ### `.nanoseconds` -The nanoseconds part of a nanosecond-precise time. Read-only in presets below standard. The value is an integer from 0 to 999999999 or `NaN`. +The nanoseconds part of the nanosecond-precision time. It is read-only in presets below standard. The value is an integer between 0 and 999999999, or `NaN`. ```ts .nanoseconds: number; @@ -75,7 +75,7 @@ The nanoseconds part of a nanosecond-precise time. Read-only in presets below st ### `.valueOf()` -Gets the millisecond-precise time. +Gets the millisecond-precision time. ```ts .valueOf(): number; @@ -85,14 +85,14 @@ Gets the millisecond-precise time. None. -#### Return value +#### Return Value -Returns the millisecond-precise time. +Returns the millisecond-precision time. #### Example ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/encodable"; +import { Datetime } from "@tai-kun/surrealdb/encodable-datatypes"; const date = new Datetime("2024-06-01T12:34:56.780123456Z"); console.log(date.valueOf()); @@ -101,7 +101,7 @@ console.log(date.valueOf()); ### `.toString()` -Gets the string representation of the millisecond-precise time. Same as the `.toString()` of the `Date` object. +Gets the string representation of the millisecond-precision time. It is the same as `.toString()` of a `Date` object. ```ts .toString(): string; @@ -111,23 +111,23 @@ Gets the string representation of the millisecond-precise time. Same as the `.to None. -#### Return value +#### Return Value -Returns the string representation of the millisecond-precise time. +Returns the string representation of the millisecond-precision time. #### Example ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/encodable"; +import { Datetime } from "@tai-kun/surrealdb/encodable-datatypes"; const date = new Datetime("2024-06-01T12:34:56.780123456Z"); console.log(date.toString()); -//-> Sat Jun 01 2024 21:34:56 GMT+0900 (Japan Standard Time) +//-> Sat Jun 01 2024 21:34:56 GMT+0900 (日本標準時) ``` ### `.toISOString()` -Gets the string representation of the nanosecond-precise time in ISO format. Similar to the `.toISOString()` of the `Date` object, but it is nanosecond-precise, so it is stringified to the ninth decimal place. +Gets the nanosecond-precision time string in ISO format. It is similar to `.toISOString()` of a `Date` object, but it is nanosecond-precision, so it is serialized up to the ninth decimal place. ```ts .toISOString(): string; @@ -137,14 +137,14 @@ Gets the string representation of the nanosecond-precise time in ISO format. Sim None. -#### Return value +#### Return Value -Returns the string representation of the nanosecond-precise time in ISO format. +Returns the nanosecond-precision time string in ISO format. #### Example ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/encodable"; +import { Datetime } from "@tai-kun/surrealdb/encodable-datatypes"; const date = new Datetime([1717245296, 780123456]); console.log(date.toISOString()); @@ -153,7 +153,7 @@ console.log(date.toISOString()); ### `.toDate()` -Converts to a runtime built-in `Date` object. Note that it will be millisecond-precise. +Converts to a runtime-built-in `Date` object. Note that it will be millisecond-precision. ```ts .toDate(): Date; @@ -163,13 +163,13 @@ Converts to a runtime built-in `Date` object. Note that it will be millisecond-p None. -#### Return value +#### Return Value -Returns a runtime built-in `Date` object. +Returns a runtime-built-in `Date` object. ### `.toSurql()` -Converts the `Datetime` object to a string embeddable in SurrealQL. Similar to `.toISOString()`, but adds the `d` prefix to tell the query parser that the string is a UUID. +Converts the `Datetime` object to a string that can be embedded in SurrealQL. It is similar to `.toISOString()`, but it adds the `d` prefix to tell the query parser that the string is a UUID. ```ts .toSurql(): string; @@ -179,14 +179,14 @@ Converts the `Datetime` object to a string embeddable in SurrealQL. Similar to ` None. -#### Return value +#### Return Value -Returns the ISO formatted date and time with the `d` prefix. +Returns the ISO format datetime with the `d` prefix. #### Example ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/encodable"; +import { Datetime } from "@tai-kun/surrealdb/encodable-datatypes"; const date = new Datetime([1717245296, 780123456]); console.log(date.toSurql()); @@ -195,7 +195,7 @@ console.log(date.toSurql()); ### `.getCompact()` -Gets a pair of seconds and nanoseconds. +Gets the pair of seconds and nanoseconds. ```ts .getCompact(): [seconds: number, nanoseconds: number]; @@ -205,13 +205,13 @@ Gets a pair of seconds and nanoseconds. None. -#### Return value +#### Return Value -Returns a pair of seconds and nanoseconds. +Returns the pair of seconds and nanoseconds. ### `.setCompact()` -Sets the date and time with a pair of seconds and nanoseconds. +Sets the datetime with a pair of seconds and nanoseconds. ```ts .setCompact(compact: [seconds: number, nanoseconds: number]): number; @@ -223,14 +223,14 @@ Sets the date and time with a pair of seconds and nanoseconds. A pair of seconds and nanoseconds. -#### Return value +#### Return Value -Returns the millisecond-precise time. +Returns the millisecond-precision time. #### Example ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/standard"; +import { Datetime } from "@tai-kun/surrealdb/standard-datatypes"; const date = new Datetime(0); const time = dt.setCompact([1717245296, 780123456]); @@ -240,9 +240,9 @@ console.log(time); ### `.getMicroseconds()` -Gets the microseconds of the date using the local time. +Gets the microseconds of the date using local time. -`.getUTCMicroseconds()` behaves the same as this method. +`.getUTCMicroseconds()` behaves the same way as this method. ```ts .getMicroseconds(): number; @@ -252,14 +252,14 @@ Gets the microseconds of the date using the local time. None. -#### Return value +#### Return Value Returns the microseconds. #### Example ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/standard"; +import { Datetime } from "@tai-kun/surrealdb/standard-datatypes"; const date = new Datetime([1717245296, 780123456]); console.log(date.toISOString()); @@ -276,7 +276,7 @@ console.log(date.getMicroseconds()); Sets the microseconds. -`.setUTCMicroseconds()` behaves the same as this method. +`.setUTCMicroseconds()` behaves the same way as this method. ```ts .setMicroseconds(us: number): number; @@ -288,14 +288,14 @@ Sets the microseconds. The microseconds to set. The value is converted to an integer. Note that if the value is not between 0 and 999, the entire time will be affected. -#### Return value +#### Return Value -Returns the millisecond-precise time. +Returns the millisecond-precision time. #### Example ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/standard"; +import { Datetime } from "@tai-kun/surrealdb/standard-datatypes"; const date = new Datetime([1717245296, 780123456]); console.log(date.toISOString()); @@ -310,9 +310,9 @@ console.log(time); ### `.getNanoseconds()` -Gets the nanoseconds of the date using the local time. +Gets the nanoseconds of the date using local time. -`.getUTCNanoseconds()` behaves the same as this method. +`.getUTCNanoseconds()` behaves the same way as this method. ```ts .getNanoseconds(): number; @@ -322,14 +322,14 @@ Gets the nanoseconds of the date using the local time. None. -#### Return value +#### Return Value Returns the nanoseconds. #### Example ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/standard"; +import { Datetime } from "@tai-kun/surrealdb/standard-datatypes"; const date = new Datetime([1717245296, 780123456]); console.log(date.toISOString()); @@ -346,7 +346,7 @@ console.log(date.getNanoseconds()); Sets the microseconds. -`.setUTCNanoseconds()` behaves the same as this method. +`.setUTCNanoseconds()` behaves the same way as this method. ```ts .setNanoseconds(us: number): number; @@ -358,14 +358,14 @@ Sets the microseconds. The nanoseconds to set. The value is converted to an integer. Note that if the value is not between 0 and 999, the entire time will be affected. -#### Return value +#### Return Value -Returns the millisecond-precise time. +Returns the millisecond-precision time. #### Example ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/standard"; +import { Datetime } from "@tai-kun/surrealdb/standard-datatypes"; const date = new Datetime([1717245296, 780123456]); console.log(date.toISOString()); @@ -390,23 +390,23 @@ Clones the `Datetime` object. None. -#### Return value +#### Return Value -Returns a new `Datetime` object. If inheriting the `Datetime` class, an instance of that class will be returned. +Returns a new `Datetime` object. If the `Datetime` class is inherited, an instance of that class is returned. ### Development #### Generic Determination of `Datetime` Objects -It is recommended to use the `isDatetime` function to determine whether a value is a `Datetime` object without relying on the preset. This function does not use `instanceof`, so it is useful when the preset of the value to be verified is unknown. +To determine if a value is a `Datetime` object regardless of the preset, it is recommended to use the `isDatetime` function. This function does not use `instanceof`, which is useful when the preset of the value to be validated is unknown. ```ts import { isDatetime } from "@tai-kun/surrealdb"; ``` -#### Datetime Before UNIX Epoch +#### Datetime Before the UNIX Epoch -SurrealDB's `datetime` type can hold nanosecond precision. This requires careful handling in JavaScript. If you pass a SurrealDB-serialized `datetime`, such as `"1969-12-31T23:59:59.999999999Z"`, to JavaScript's `Date.parse`, WebKit will return 0 milliseconds, while others (Node.js, Deno, Bun, Chromium, Firefox) will return -1 millisecond. +The `datetime` type in SurrealDB can hold up to nanosecond precision. Therefore, care must be taken when dealing with it in JavaScript. If you pass a SurrealDB serialized `datetime`, such as `"1969-12-31T23:59:59.999999999Z"`, to JavaScript's `Date.parse`, WebKit will return 0 milliseconds, but other implementations (Node.js, Deno, Bun, Chromium, Firefox) will return -1 milliseconds. WebKit: diff --git a/docs/src/content/docs/en/v2/api/data/decimal.mdx b/docs/src/content/docs/en/v2/api/data/decimal.mdx index 459abaf2..6f54dda2 100644 --- a/docs/src/content/docs/en/v2/api/data/decimal.mdx +++ b/docs/src/content/docs/en/v2/api/data/decimal.mdx @@ -5,14 +5,14 @@ slug: en/v2/api/data/decimal import Badge from "~/components/en/Badge.astro"; -`Decimal` is a class that represents arbitrary-precision real numbers. When the preset is `standard`, it inherits from the [`big.js`](https://github.com/MikeMcl/big.js) class. This may result in differences in the results of methods like `.toString()` across presets. +`Decimal` is a class for representing arbitrary-precision real numbers. When the preset is `standard`, the class inherits from [`big.js`](https://github.com/MikeMcl/big.js). This may lead to inconsistencies in the results of methods like `.toString()`, depending on the preset. -### Import +### Importing ```ts -import { Decimal } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Decimal } from "@tai-kun/surrealdb/data-types/encodable"; -import { Decimal } from "@tai-kun/surrealdb/data-types/standard"; +import { Decimal } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Decimal } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Decimal } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -28,7 +28,7 @@ new Decimal(source: string | number | Decimal); // standard ##### `source` -A string representing the real number. If the preset is `standard`, a number can also be passed. +A real number represented as a string. If the preset is `standard`, a number can also be passed. #### Return Value @@ -36,7 +36,7 @@ When called through `new`, `Decimal` returns its instance. ### `.toString()` -Gets the real number as a string. +Retrieves the real number as a string. #### Arguments @@ -44,11 +44,11 @@ None. #### Return Value -Returns a string representation of the real number. +Returns the string representation of the real number. ### `.toSurql()` -Converts the `Decimal` object to a string that can be embedded in SurrealQL. Similar to `.toString()`, but it adds the `dec` suffix to tell the query parser that the string is a `decimal` type. +Converts the `Decimal` object to a string that can be embedded into SurrealQL. It is similar to `.toString()`, but it adds a `dec` suffix to inform the query parser that the string is of `decimal` type. ```ts .toSurql(): string; @@ -65,7 +65,7 @@ Returns the real number with the `dec` suffix. #### Example ```ts -import { Decimal } from "@tai-kun/surrealdb/data-types/encodable"; +import { Decimal } from "@tai-kun/surrealdb/encodable-datatypes"; const decimal = new Decimal("3.14"); console.log(decimal.toSurql()); @@ -92,13 +92,13 @@ Returns a new `Decimal` object. If the `Decimal` class is inherited, an instance If you are using the `standard` preset, the `Decimal` class inherits from the `Big` class of `big.js`, so refer to the `big.js` documentation for instance methods and properties: -[`big.js` documentation](https://mikemcl.github.io/big.js/#prototype-methods) +[`big.js` Documentation](https://mikemcl.github.io/big.js/#prototype-methods) ### Development #### Generic Determination of `Decimal` Objects -To determine if a value is a `Decimal` object regardless of the preset, it is recommended to use the `isDecimal` function. This function does not use `instanceof`, so it is useful when the preset of the value to be validated is unknown. +It is recommended to use the `isDecimal` function to determine if a value is a `Decimal` object without depending on the preset. This function does not use `instanceof`, making it helpful when the preset of the value to be verified is unknown. ```ts import { isDecimal } from "@tai-kun/surrealdb"; diff --git a/docs/src/content/docs/en/v2/api/data/duration.mdx b/docs/src/content/docs/en/v2/api/data/duration.mdx index 91c30be6..c7235941 100644 --- a/docs/src/content/docs/en/v2/api/data/duration.mdx +++ b/docs/src/content/docs/en/v2/api/data/duration.mdx @@ -5,14 +5,14 @@ slug: en/v2/api/data/duration import Badge from "~/components/en/Badge.astro"; -`Duration` is a class that represents a time duration. +`Duration` is a class that represents a time period. -### Import +### Importing ```ts -import { Duration } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Duration } from "@tai-kun/surrealdb/data-types/encodable"; -import { Duration } from "@tai-kun/surrealdb/data-types/standard"; +import { Duration } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Duration } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Duration } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -40,9 +40,9 @@ new Duration( ##### `source` -A pair of seconds and nanoseconds. If the preset is standard, you can use more values to make a `Duration` object. +A pair of seconds and nanoseconds. If the preset is standard, more values can be converted to a `Duration` object. -An input of type `number` is calculated in milliseconds. This is intended for use cases where the difference between `Date` objects is to be made into a `Duration` object: +An input of type `number` is calculated in milliseconds. This is intended for use in converting the difference between `Date` objects into `Duration` objects: ```ts const begin = new Date("2024-06-01T12:00:00.000Z"); @@ -50,7 +50,7 @@ const end = new Date("2024-06-01T21:00:00.000Z"); new Duration(end - begin); ``` -An input of type `bigint` is calculated in nanoseconds. This is intended for use cases where, for example, high-precision time, such as nanoseconds returned by [`process.hrtime.bigint()`](https://nodejs.org/api/process.html#processhrtimebigint), is to be made into a `Duration` object: +An input of type `bigint` is calculated in nanoseconds. This is intended for use in converting high-precision times, such as nanoseconds returned by [`process.hrtime.bigint()`](https://nodejs.org/api/process.html#processhrtimebigint), into `Duration` objects: ```ts const begin = process.hrtime.bigint(); @@ -59,7 +59,7 @@ const end = process.hrtime.bigint(); new Duration(end - begin); ``` -An input of type `string` must be a string representation of a duration. The string representation of a duration refers to a format in which a set of numbers and units are concatenated. For example, `1h4h30m20s1350ms` is "1 day and 4 hours 30 minutes, 21 seconds 350 milliseconds". The available units are as follows: +An input of type `string` must be a string representation of the duration. The string representation of a duration is a format where a number and a unit are paired and they are listed consecutively. For example, `1h4h30m20s1350ms` represents "1 day and 4 hours 30 minutes, 21 seconds 350 milliseconds". The available units are as follows: | Unit | Description | Conversion | | --- | --- | --- | @@ -73,15 +73,15 @@ An input of type `string` must be a string representation of a duration. The str | `w` | week | `1w` -> `7d` | | `y` | year | `1y` -> `365d` | -`us` (`0x75`, `0x73`) can also be written as `µs` (`0xc2`, `0xb5`, `0x73`) or `μs` (`0xce`, `0xbc`, `0x73`) (the hexadecimal numbers in parentheses are the results of UTF-8 encoding of the unit string). +`us` (`0x75`, `0x73`) can also be written as `µs` (`0xc2`, `0xb5`, `0x73`) or `μs` (`0xce`, `0xbc`, `0x73`) (the hexadecimal numbers in parentheses are the results of encoding the unit string in UTF-8). -#### Returns +#### Return value -When called via `new`, `Duration` returns its instance. +When called through `new`, `Duration` returns its instance. ### `.seconds` -The seconds part of the duration. It is read-only in presets below standard. The value is an integer from 0 to 264-1. +The seconds part of the duration. Read-only for presets below standard. The value is an integer between 0 and 264-1. ```ts .seconds: bigint; @@ -89,7 +89,7 @@ The seconds part of the duration. It is read-only in presets below standard. The ### `.nanoseconds` -The nanoseconds part of the duration. It is read-only in presets below standard. The value is an integer from 0 to 999999999. +The nanoseconds part of the duration. Read-only for presets below standard. The value is an integer between 0 and 999999999. ```ts .nanoseconds: number; @@ -97,7 +97,7 @@ The nanoseconds part of the duration. It is read-only in presets below standard. ### `.parse()` -Maps the duration to each unit. The value of each unit will be greater than or equal to 0 and less than the maximum value of that unit. Note that if the duration is 0, an object with only the `nanoseconds` property set to `0` will be returned. +Maps the duration to each unit. The value of each unit is between 0 and the maximum value of that unit. Note that if the duration is 0, it returns an object with only `nanoseconds` property that has `0`. ```ts .parse(): { @@ -117,14 +117,14 @@ Maps the duration to each unit. The value of each unit will be greater than or e None. -#### Returns +#### Return value -Returns the result of mapping the duration to each unit. If the value of the unit is 0, the property will be omitted, but if the duration is 0, an object with only `nanoseconds` set to `0` will be returned. +Returns the result of mapping the duration to each unit. If the value of a unit is 0, the property is omitted, but if the duration is 0, it returns an object with only `nanoseconds` property that has `0`. -#### Example +#### Examples ```ts -import { Duration } from "@tai-kun/surrealdb/data-types/encodable"; +import { Duration } from "@tai-kun/surrealdb/encodable-datatypes"; const duration = new Duration(0); console.log(duration.parse()); @@ -132,7 +132,7 @@ console.log(duration.parse()); ``` ```ts -import { Duration } from "@tai-kun/surrealdb/data-types/encodable"; +import { Duration } from "@tai-kun/surrealdb/encodable-datatypes"; const duration = new Duration(12_345_000n); console.log(duration.parse()); @@ -151,12 +151,12 @@ Gets the duration in nanoseconds. None. -#### Returns +#### Return value Returns the duration in nanoseconds. ```ts -import { Duration } from "@tai-kun/surrealdb/data-types/encodable"; +import { Duration } from "@tai-kun/surrealdb/encodable-datatypes"; const duration = new Duration(12_345_000n); console.log(duration.valueOf()); @@ -177,14 +177,14 @@ Gets the string representation of the duration. None. -#### Returns +#### Return value -Gets the string representation of the duration in milliseconds precision. +Returns the string representation of the time in millisecond precision. -#### Example +#### Examples ```ts -import { Duration } from "@tai-kun/surrealdb/data-types/encodable"; +import { Duration } from "@tai-kun/surrealdb/encodable-datatypes"; const duration = new Duration(12_345_000n); console.log(duration.toString()); @@ -203,14 +203,14 @@ Gets the duration string in ISO format. None. -#### Returns +#### Return value Returns the duration string in ISO format. -#### Example +#### Examples ```ts -import { Duration } from "@tai-kun/surrealdb/data-types/encodable"; +import { Duration } from "@tai-kun/surrealdb/encodable-datatypes"; const duration = new Duration("2m3s456ms"); console.log(duration.toISOString()); @@ -219,7 +219,7 @@ console.log(duration.toISOString()); ### `.getCompact()` -Gets a pair of seconds and nanoseconds. +Gets the pair of seconds and nanoseconds. ```ts .getCompact(): [seconds: bigint, nanoseconds: number]; @@ -229,9 +229,9 @@ Gets a pair of seconds and nanoseconds. None. -#### Returns +#### Return value -Returns a pair of seconds and nanoseconds. +Returns the pair of seconds and nanoseconds. ### `.setCompact()` @@ -247,13 +247,13 @@ Sets the date and time with a pair of seconds and nanoseconds. A pair of seconds and nanoseconds. -#### Returns +#### Return value None. ### `.getYears()` -Gets the years. If it does not result in a non-negative integer, 0 will be returned. +Gets the years. If it is not a non-negative integer, 0 is returned. ```ts .getYears(): number; @@ -263,7 +263,7 @@ Gets the years. If it does not result in a non-negative integer, 0 will be retur None. -#### Returns +#### Return value Returns a non-negative integer representing the years. @@ -281,7 +281,7 @@ Adds the specified number of years to the duration. The number of years. -#### Returns +#### Return value None. @@ -299,13 +299,13 @@ Subtracts the specified number of years from the duration. The number of years. -#### Returns +#### Return value None. ### `.asYears()` -Gets the millisecond representation of the number of years. +Gets the millisecond representation of the years. ```ts .asYears(): number; @@ -315,13 +315,13 @@ Gets the millisecond representation of the number of years. None. -#### Returns +#### Return value -The millisecond representation of the number of years. +The millisecond representation of the years. ### `.getWeeks()` -Gets the weeks. If it does not result in a non-negative integer, 0 will be returned. +Gets the weeks. If it is not a non-negative integer, 0 is returned. ```ts .getWeeks(): number; @@ -331,7 +331,7 @@ Gets the weeks. If it does not result in a non-negative integer, 0 will be retur None. -#### Returns +#### Return value Returns a non-negative integer representing the weeks. @@ -349,7 +349,7 @@ Adds the specified number of weeks to the duration. The number of weeks. -#### Returns +#### Return value None. @@ -367,13 +367,13 @@ Subtracts the specified number of weeks from the duration. The number of weeks. -#### Returns +#### Return value None. ### `.asWeeks()` -Gets the millisecond representation of the number of weeks. +Gets the millisecond representation of the weeks. ```ts .asWeeks(): number; @@ -383,13 +383,13 @@ Gets the millisecond representation of the number of weeks. None. -#### Returns +#### Return value -The millisecond representation of the number of weeks. +The millisecond representation of the weeks. ### `.getDays()` -Gets the days. If it does not result in a non-negative integer, 0 will be returned. +Gets the days. If it is not a non-negative integer, 0 is returned. ```ts .getDays(): number; @@ -399,7 +399,7 @@ Gets the days. If it does not result in a non-negative integer, 0 will be return None. -#### Returns +#### Return value Returns a non-negative integer representing the days. @@ -417,7 +417,7 @@ Adds the specified number of days to the duration. The number of days. -#### Returns +#### Return value None. @@ -435,13 +435,13 @@ Subtracts the specified number of days from the duration. The number of days. -#### Returns +#### Return value None. ### `.asDays()` -Gets the millisecond representation of the number of days. +Gets the millisecond representation of the days. ```ts .asDays(): number; @@ -451,13 +451,13 @@ Gets the millisecond representation of the number of days. None. -#### Returns +#### Return value -The millisecond representation of the number of days. +The millisecond representation of the days. ### `.getHours()` -Gets the hours. If it does not result in a non-negative integer, 0 will be returned. +Gets the hours. If it is not a non-negative integer, 0 is returned. ```ts .getHours(): number; @@ -467,7 +467,7 @@ Gets the hours. If it does not result in a non-negative integer, 0 will be retur None. -#### Returns +#### Return value Returns a non-negative integer representing the hours. @@ -485,7 +485,7 @@ Adds the specified number of hours to the duration. The number of hours. -#### Returns +#### Return value None. @@ -503,13 +503,13 @@ Subtracts the specified number of hours from the duration. The number of hours. -#### Returns +#### Return value None. ### `.asHours()` -Gets the millisecond representation of the number of hours. +Gets the millisecond representation of the hours. ```ts .asHours(): number; @@ -519,13 +519,13 @@ Gets the millisecond representation of the number of hours. None. -#### Returns +#### Return value -The millisecond representation of the number of hours. +The millisecond representation of the hours. ### `.getMinutes()` -Gets the minutes. If it does not result in a non-negative integer, 0 will be returned. +Gets the minutes. If it is not a non-negative integer, 0 is returned. ```ts .getMinutes(): number; @@ -535,7 +535,7 @@ Gets the minutes. If it does not result in a non-negative integer, 0 will be ret None. -#### Returns +#### Return value Returns a non-negative integer representing the minutes. @@ -553,7 +553,7 @@ Adds the specified number of minutes to the duration. The number of minutes. -#### Returns +#### Return value None. @@ -571,13 +571,13 @@ Subtracts the specified number of minutes from the duration. The number of minutes. -#### Returns +#### Return value None. ### `.asMinutes()` -Gets the millisecond representation of the number of minutes. +Gets the millisecond representation of the minutes. ```ts .asMinutes(): number; @@ -587,13 +587,13 @@ Gets the millisecond representation of the number of minutes. None. -#### Returns +#### Return value -The millisecond representation of the number of minutes. +The millisecond representation of the minutes. ### `.getSeconds()` -Gets the seconds. If it does not result in a non-negative integer, 0 will be returned. +Gets the seconds. If it is not a non-negative integer, 0 is returned. ```ts .getSeconds(): number; @@ -603,7 +603,7 @@ Gets the seconds. If it does not result in a non-negative integer, 0 will be ret None. -#### Returns +#### Return value Returns a non-negative integer representing the seconds. @@ -621,7 +621,7 @@ Adds the specified number of seconds to the duration. The number of seconds. -#### Returns +#### Return value None. @@ -639,13 +639,13 @@ Subtracts the specified number of seconds from the duration. The number of seconds. -#### Returns +#### Return value None. ### `.asSeconds()` -Gets the millisecond representation of the number of seconds. +Gets the millisecond representation of the seconds. ```ts .asSeconds(): number; @@ -655,13 +655,13 @@ Gets the millisecond representation of the number of seconds. None. -#### Returns +#### Return value -The millisecond representation of the number of seconds. +The millisecond representation of the seconds. ### `.getMilliseconds()` -Gets the milliseconds. If it does not result in a non-negative integer, 0 will be returned. +Gets the milliseconds. If it is not a non-negative integer, 0 is returned. ```ts .getMilliseconds(): number; @@ -671,7 +671,7 @@ Gets the milliseconds. If it does not result in a non-negative integer, 0 will b None. -#### Returns +#### Return value Returns a non-negative integer representing the milliseconds. @@ -689,7 +689,7 @@ Adds the specified number of milliseconds to the duration. The number of milliseconds. -#### Returns +#### Return value None. @@ -707,13 +707,13 @@ Subtracts the specified number of milliseconds from the duration. The number of milliseconds. -#### Returns +#### Return value None. ### `.asMilliseconds()` -Gets the millisecond representation of the number of milliseconds. +Gets the millisecond representation of the milliseconds. ```ts .asMilliseconds(): number; @@ -723,13 +723,13 @@ Gets the millisecond representation of the number of milliseconds. None. -#### Returns +#### Return value -The millisecond representation of the number of milliseconds. +The millisecond representation of the milliseconds. ### `.getMicroseconds()` -Gets the microseconds. If it does not result in a non-negative integer, 0 will be returned. +Gets the microseconds. If it is not a non-negative integer, 0 is returned. ```ts .getMicroseconds(): number; @@ -739,7 +739,7 @@ Gets the microseconds. If it does not result in a non-negative integer, 0 will b None. -#### Returns +#### Return value Returns a non-negative integer representing the microseconds. @@ -757,7 +757,7 @@ Adds the specified number of microseconds to the duration. The number of microseconds. -#### Returns +#### Return value None. @@ -775,13 +775,13 @@ Subtracts the specified number of microseconds from the duration. The number of microseconds. -#### Returns +#### Return value None. ### `.asMicroseconds()` -Gets the millisecond representation of the number of microseconds. +Gets the millisecond representation of the microseconds. ```ts .asMicroseconds(): number; @@ -791,13 +791,13 @@ Gets the millisecond representation of the number of microseconds. None. -#### Returns +#### Return value -The millisecond representation of the number of microseconds. +The millisecond representation of the microseconds. ### `.getNanoseconds()` -Gets the nanoseconds. If it does not result in a non-negative integer, 0 will be returned. +Gets the nanoseconds. If it is not a non-negative integer, 0 is returned. ```ts .getNanoseconds(): number; @@ -807,7 +807,7 @@ Gets the nanoseconds. If it does not result in a non-negative integer, 0 will be None. -#### Returns +#### Return value Returns a non-negative integer representing the nanoseconds. @@ -825,7 +825,7 @@ Adds the specified number of nanoseconds to the duration. The number of nanoseconds. -#### Returns +#### Return value None. @@ -843,13 +843,13 @@ Subtracts the specified number of nanoseconds from the duration. The number of nanoseconds. -#### Returns +#### Return value None. ### `.asNanoseconds()` -Gets the millisecond representation of the number of nanoseconds. +Gets the millisecond representation of the nanoseconds. ```ts .asNanoseconds(): number; @@ -859,6 +859,6 @@ Gets the millisecond representation of the number of nanoseconds. None. -#### Returns +#### Return value -The millisecond representation of the number of nanoseconds. +The millisecond representation of the nanoseconds. diff --git a/docs/src/content/docs/en/v2/api/data/future.mdx b/docs/src/content/docs/en/v2/api/data/future.mdx index ae84af59..9ba44c8d 100644 --- a/docs/src/content/docs/en/v2/api/data/future.mdx +++ b/docs/src/content/docs/en/v2/api/data/future.mdx @@ -7,14 +7,14 @@ banner: import Badge from "~/components/en/Badge.astro"; -The `Future` class represents the [Futures feature](https://surrealdb.com/docs/surrealql/datamodel/futures) of SurrealDB. +`Future` is a class that represents SurrealDB's [Futures Feature](https://surrealdb.com/docs/surrealql/datamodel/futures). ### Import ```ts -import { Future } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Future } from "@tai-kun/surrealdb/data-types/encodable"; -import { Future } from "@tai-kun/surrealdb/data-types/standard"; +import { Future } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Future } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Future } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -31,9 +31,9 @@ new Future(source: string); The value or expression inside the future's block. -#### Return Value +#### Returns -When called through `new`, `Future` returns its instance. +When called with `new`, `Future` returns its instance. ### `.block` @@ -45,7 +45,7 @@ The value or expression inside the future's block. ### `.toString()` -Converts a `Future` object to a string. +Converts the `Future` object into a string. ```ts .toString(): string; @@ -55,14 +55,14 @@ Converts a `Future` object to a string. None. -#### Return Value +#### Returns Returns the value or expression inside the future's block. #### Example ```ts -import { Future } from "@tai-kun/surrealdb/data-types/encodable"; +import { Future } from "@tai-kun/surrealdb/encodable-datatypes"; const future = new Future(`time::now()`); console.log(future.toString()); @@ -71,7 +71,7 @@ console.log(future.toString()); ### `.toSurql()` -Converts a `Future` object to a string that can be embedded in SurrealQL. Similar to `.toString()`, but the block is enclosed in curly braces (`{}`) and cast with ``. +Converts the `Future` object into a string that can be embedded in SurrealQL. Similar to `.toString()`, but the block is wrapped in curly braces (`{}`) and cast with ``. ```ts .toSurql(): string; @@ -81,14 +81,14 @@ Converts a `Future` object to a string that can be embedded in SurrealQL. Simila None. -#### Return Value +#### Returns Returns the future that can be embedded in SurrealQL. #### Example ```ts -import { Future } from "@tai-kun/surrealdb/data-types/encodable"; +import { Future } from "@tai-kun/surrealdb/encodable-datatypes"; const future = new Future(`time::now()`); console.log(future.toSurql()); @@ -97,7 +97,7 @@ console.log(future.toSurql()); ### `.surql()` -This method helps with writing SurrealQL. You can use template literals to write SurrealQL. Values embedded in template literals are automatically converted to SurrealQL. Also, if you have installed the [SurrealDB official extension](https://marketplace.visualstudio.com/items?itemName=surrealdb.surrealql) for VSCode, syntax highlighting for template literals will be enabled. +This method assists in writing SurrealQL. You can write SurrealQL using template literals. Values embedded in the template literal are automatically converted to SurrealQL. Additionally, if you have installed the [SurrealDB official extension](https://marketplace.visualstudio.com/items?itemName=surrealdb.surrealql) in VSCode, syntax highlighting for template literals will be enabled. ```ts .surql(texts: TemplateStringsArray, ...values: unknown[]): string; @@ -111,16 +111,16 @@ An array of strings that make up the template literal. ##### `values` -The values to embed between each element of `texts`. +Values to be embedded between each element in `texts`. -#### Return Value +#### Returns SurrealQL. #### Example ```ts -import { Future, Thing } from "@tai-kun/surrealdb/data-types/standard"; +import { Future, Thing } from "@tai-kun/surrealdb/standard-datatypes"; const foo = "foo"; const rid = new Thing("person", "tai-kun"); @@ -140,7 +140,7 @@ console.log(future.toSurql()); Without using `.surql()`, the above example would be: ```ts -import { Future, Thing } from "@tai-kun/surrealdb/data-types/standard"; +import { Future, Thing } from "@tai-kun/surrealdb/standard-datatypes"; import { toSurql } from "@tai-kun/surrealdb/utils"; const foo = "foo"; @@ -158,14 +158,14 @@ console.log(future.toSurql()); //-> } ``` -- You need to convert strings and objects to SurrealQL using the `toSurql` helper function or `.toSurql()` method. +- You need to convert strings and objects to SurrealQL using the `toSurql` helper function or the `.toSurql()` method. - You can embed strings in SurrealQL without using `Future.raw`. ### Development -#### Generic Determination of `Future` Objects +#### Generic Judgment of `Future` Objects -To determine if a value is a `Future` object without relying on presets, it is recommended to use the `isFuture` function. This function does not use `instanceof`, which is useful when the preset of the value to be verified is unknown. +To determine if a value is a `Future` object without relying on presets, it is recommended to use the `isFuture` function. This function does not use `instanceof`, making it useful when the preset of the value to be verified is unknown. ```ts import { isFuture } from "@tai-kun/surrealdb"; diff --git a/docs/src/content/docs/en/v2/api/data/geometry-collection.mdx b/docs/src/content/docs/en/v2/api/data/geometry-collection.mdx index 488901a6..e7c410ab 100644 --- a/docs/src/content/docs/en/v2/api/data/geometry-collection.mdx +++ b/docs/src/content/docs/en/v2/api/data/geometry-collection.mdx @@ -5,14 +5,14 @@ slug: en/v2/api/data/geometry-collection import Badge from "~/components/en/Badge.astro"; -This documentation is still under construction. +This page is under construction. ### Import ```ts -import { GeometryCollection } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryCollection } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryCollection } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryCollection } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryCollection } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryCollection } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -27,8 +27,8 @@ new GeometryCollection(source); ##### `source` -This section is still under construction. +This section is under construction. -#### Return Value +#### Returns When called through `new`, `GeometryCollection` returns its instance. diff --git a/docs/src/content/docs/en/v2/api/data/geometry-line.mdx b/docs/src/content/docs/en/v2/api/data/geometry-line.mdx index a45149e0..03199f7c 100644 --- a/docs/src/content/docs/en/v2/api/data/geometry-line.mdx +++ b/docs/src/content/docs/en/v2/api/data/geometry-line.mdx @@ -10,9 +10,9 @@ This page is under construction. ### Import ```ts -import { GeometryLine } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryLine } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryLine } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryLine } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryLine } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryLine } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -29,6 +29,6 @@ new GeometryLine(source); This section is under construction. -#### Returns +#### Return Value -When called via `new`, `GeometryLine` returns its instance. +When invoked through `new`, `GeometryLine` returns its instance. diff --git a/docs/src/content/docs/en/v2/api/data/geometry-multi-line.mdx b/docs/src/content/docs/en/v2/api/data/geometry-multi-line.mdx index aa9e3411..6950c4b7 100644 --- a/docs/src/content/docs/en/v2/api/data/geometry-multi-line.mdx +++ b/docs/src/content/docs/en/v2/api/data/geometry-multi-line.mdx @@ -10,9 +10,9 @@ This page is under construction. ### Import ```ts -import { GeometryMultiLine } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryMultiLine } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryMultiLine } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryMultiLine } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryMultiLine } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryMultiLine } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -29,6 +29,6 @@ new GeometryMultiLine(source); This page is under construction. -#### Return Value +#### Returns When called via `new`, `GeometryMultiLine` returns its instance. diff --git a/docs/src/content/docs/en/v2/api/data/geometry-multi-point.mdx b/docs/src/content/docs/en/v2/api/data/geometry-multi-point.mdx index b3ed5f86..8f6f292a 100644 --- a/docs/src/content/docs/en/v2/api/data/geometry-multi-point.mdx +++ b/docs/src/content/docs/en/v2/api/data/geometry-multi-point.mdx @@ -5,14 +5,14 @@ slug: en/v2/api/data/geometry-multi-point import Badge from "~/components/en/Badge.astro"; -This document is under construction. +This document is still under construction. ### Import ```ts -import { GeometryMultiPoint } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryMultiPoint } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryMultiPoint } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryMultiPoint } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryMultiPoint } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryMultiPoint } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -27,7 +27,7 @@ new GeometryMultiPoint(source); ##### `source` -This section is under construction. +This document is still under construction. #### Return Value diff --git a/docs/src/content/docs/en/v2/api/data/geometry-multi-polygon.mdx b/docs/src/content/docs/en/v2/api/data/geometry-multi-polygon.mdx index aa6f81c2..02550351 100644 --- a/docs/src/content/docs/en/v2/api/data/geometry-multi-polygon.mdx +++ b/docs/src/content/docs/en/v2/api/data/geometry-multi-polygon.mdx @@ -5,14 +5,14 @@ slug: en/v2/api/data/geometry-multi-polygon import Badge from "~/components/en/Badge.astro"; -This page is under construction. +**Work in progress.** ### Import ```ts -import { GeometryMultiPolygon } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryMultiPolygon } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryMultiPolygon } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryMultiPolygon } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryMultiPolygon } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryMultiPolygon } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -27,7 +27,7 @@ new GeometryMultiPolygon(source); ##### `source` -This page is under construction. +**Work in progress.** #### Returns diff --git a/docs/src/content/docs/en/v2/api/data/geometry-point.mdx b/docs/src/content/docs/en/v2/api/data/geometry-point.mdx index 4967c6f7..e9e3ec13 100644 --- a/docs/src/content/docs/en/v2/api/data/geometry-point.mdx +++ b/docs/src/content/docs/en/v2/api/data/geometry-point.mdx @@ -10,9 +10,9 @@ This page is under construction. ### Import ```ts -import { GeometryPoint } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryPoint } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryPoint } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryPoint } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryPoint } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryPoint } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` diff --git a/docs/src/content/docs/en/v2/api/data/geometry-polygon.mdx b/docs/src/content/docs/en/v2/api/data/geometry-polygon.mdx index c00c8eca..6c103448 100644 --- a/docs/src/content/docs/en/v2/api/data/geometry-polygon.mdx +++ b/docs/src/content/docs/en/v2/api/data/geometry-polygon.mdx @@ -5,14 +5,14 @@ slug: en/v2/api/data/geometry-polygon import Badge from "~/components/en/Badge.astro"; -Under Construction. +This page is under construction. ### Import ```ts -import { GeometryPolygon } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryPolygon } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryPolygon } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryPolygon } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryPolygon } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryPolygon } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -27,8 +27,8 @@ new GeometryPolygon(source); ##### `source` -Under Construction. +This page is under construction. -#### Returns +#### Return Value When called via `new`, `GeometryPolygon` returns its instance. diff --git a/docs/src/content/docs/en/v2/api/data/range.mdx b/docs/src/content/docs/en/v2/api/data/range.mdx index 9092287c..0be599c8 100644 --- a/docs/src/content/docs/en/v2/api/data/range.mdx +++ b/docs/src/content/docs/en/v2/api/data/range.mdx @@ -7,18 +7,14 @@ banner: import Badge from "~/components/en/Badge.astro"; -## Range - -### Description - -This type represents a range of values. +## Description ### Import ```ts -import { Range } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Range } from "@tai-kun/surrealdb/data-types/encodable"; -import { Range } from "@tai-kun/surrealdb/data-types/standard"; +import { Range } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Range } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Range } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -38,15 +34,15 @@ new Range( ##### `source` -A pair of minimum and maximum values for the range. `null` if unbounded. +A pair of minimum and maximum values for the range. If there is no limit, it is `null`. #### Return Value -When invoked via `new`, `Range` returns its instance. +When called through `new`, `Range` returns its instance. ### `.begin` -The minimum value of the range. `null` if unbounded on the lower end. +The minimum value of the range. If there is no lower bound, it is `null`. ```ts .begin: BoundIncluded | BoundExcluded | null; @@ -54,7 +50,7 @@ The minimum value of the range. `null` if unbounded on the lower end. ### `.end` -The maximum value of the range. `null` if unbounded on the upper end. +The maximum value of the range. If there is no upper bound, it is `null`. ```ts .end: BoundIncluded | BoundExcluded | null; @@ -62,7 +58,7 @@ The maximum value of the range. `null` if unbounded on the upper end. ### `.toString()` -Converts the `Range` object to a SurrealQL-usable string. +Converts the `Range` object into a string usable in SurrealQL. `.toJSON()` and `.toSurql()` return the same result as this method. @@ -76,16 +72,16 @@ None. #### Return Value -Returns a string representation of the range. +Returns the string representation of the range. -#### Example +#### Examples ```ts import { Range, BoundIncluded, BoundExcluded, -} from "@tai-kun/surrealdb/data-types/encodable"; +} from "@tai-kun/surrealdb/encodable-datatypes"; const range = new Range([new BoundIncluded(1), new BoundIncluded(3)]); console.log(range.toString()); @@ -124,11 +120,11 @@ console.log(range.toString()); // -> .. ``` -### Advancement +### Further Development -#### General Purpose Determination of `Range` Objects +#### Generic Judgement of `Range` Objects -To determine if a value is a `Range` object without relying on presets, it is recommended to use the `isRange` function. This function does not use `instanceof`, making it useful when the preset of the value to be validated is unknown. +It is recommended to use the `isRange` function to determine whether a value is a `Range` object without relying on presets. This function does not use `instanceof`, making it useful when the preset of the value to be verified is unknown. ```ts import { isRange } from "@tai-kun/surrealdb"; diff --git a/docs/src/content/docs/en/v2/api/data/table.mdx b/docs/src/content/docs/en/v2/api/data/table.mdx index 5427f26f..1a4fd23b 100644 --- a/docs/src/content/docs/en/v2/api/data/table.mdx +++ b/docs/src/content/docs/en/v2/api/data/table.mdx @@ -5,14 +5,14 @@ slug: en/v2/api/data/table import Badge from "~/components/en/Badge.astro"; -`Table` is a class that represents a table name with a record ID. +`Table` is a class that represents the name of a table of record IDs. ### Import ```ts -import { Table } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Table } from "@tai-kun/surrealdb/data-types/encodable"; -import { Table } from "@tai-kun/surrealdb/data-types/standard"; +import { Table } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Table } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Table } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -36,7 +36,7 @@ When called through `new`, `Table` returns its instance. ### `.name` -The table name. When retrieving this property, the string is not escaped. +The table name. When getting this property, the string is not escaped. ```ts .name: string; @@ -44,10 +44,10 @@ The table name. When retrieving this property, the string is not escaped. #### Example -When retrieving this property, the string is not escaped. +When getting this property, the string is not escaped. ```ts -import { Table } from "@tai-kun/surrealdb/data-types/decode-only"; +import { Table } from "@tai-kun/surrealdb/decodeonly-datatypes"; const table = new Table("foo-bar"); console.log(table.name); @@ -56,7 +56,7 @@ console.log(table.name); ### `.toString()` -Converts the `Table` object to a string that can be used in SurrealQL variables. +Converts the `Table` object to a string that can be used in a SurrealQL variable. `.valueOf()` and `.toJSON()` return the same result as this method. @@ -75,7 +75,7 @@ Returns the table name. #### Example ```ts -import { Table } from "@tai-kun/surrealdb/data-types/encodable"; +import { Table } from "@tai-kun/surrealdb/encodable-datatypes"; const table = new Table("foo-bar"); console.log(table.toString()); @@ -84,7 +84,7 @@ console.log(table.toString()); ### `.toSurql()` -Converts the `Table` object to a string that can be embedded in SurrealQL. Similar to `.toString()`, but the table name is escaped the same way as in the SurrealDB implementation. +Converts the `Table` object to a string that can be embedded in SurrealQL. Similar to `.toString()`, but the table name is escaped as in SurrealDB's implementation. ```ts .toSurql(): string; @@ -96,12 +96,12 @@ None. #### Return value -Returns the table name with an escaped string. +Returns a string with the escaped table name. #### Example ```ts -import { Table } from "@tai-kun/surrealdb/data-types/encodable"; +import { Table } from "@tai-kun/surrealdb/encodable-datatypes"; const table = new Table("foo-bar"); console.log(table.toSurql()); @@ -122,16 +122,16 @@ None. #### Return value -Returns a new `Table` object. If you inherit the `Table` class, an instance of that class is returned. +Returns a new `Table` object. If the `Table` class is inherited, an instance of that class is returned. -### Advanced +### Development #### Type Guard -You can type-safe the table name of `Table` using a type parameter: +You can make the table name of a `Table` type-safe using a type parameter: ```ts -import { Table } from "@tai-kun/surrealdb/data-types/standard"; +import { Table } from "@tai-kun/surrealdb/standard-datatypes"; function isUserTable(table: unknown): table is Table<"user"> { return table instanceof Table @@ -139,9 +139,9 @@ function isUserTable(table: unknown): table is Table<"user"> { } ``` -#### Generic Judgment of `Table` Objects +#### Generic Determination of `Table` Objects -To determine whether a value is a `Table` object without relying on the preset, it is recommended to use the `isTable` function. This function does not use `instanceof`, which is helpful when the preset of the value to be verified is unknown. +To determine if a value is a `Table` object without relying on the preset, it is recommended to use the `isTable` function. This function does not use `instanceof`, so it is useful when the preset of the value to be verified is unknown. ```ts import { isTable } from "@tai-kun/surrealdb"; diff --git a/docs/src/content/docs/en/v2/api/data/thing.mdx b/docs/src/content/docs/en/v2/api/data/thing.mdx index a8c503ca..565cd4cd 100644 --- a/docs/src/content/docs/en/v2/api/data/thing.mdx +++ b/docs/src/content/docs/en/v2/api/data/thing.mdx @@ -10,9 +10,9 @@ The `Thing` class represents a [record ID](https://surrealdb.com/docs/surrealql/ ### Import ```ts -import { Thing } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Thing } from "@tai-kun/surrealdb/data-types/encodable"; -import { Thing } from "@tai-kun/surrealdb/data-types/standard"; +import { Thing } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Thing } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Thing } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -28,7 +28,7 @@ new Thing(table: string, id: string | number | bigint | object); ##### `source` -A pair of table and ID parts of the record ID. +A pair of the table and ID parts of the record ID. ##### `table` @@ -38,13 +38,13 @@ The table part of the record ID. The ID part of the record ID. -#### Return Value +#### Returns -When invoked through `new`, `Thing` returns its instance. +When called via `new`, the `Thing` returns its instance. ### `.table` -The table part of the record ID. This property will not escape the string when retrieved. +The table part of the record ID. When getting this property, the string is not escaped. ```ts .table: string; @@ -52,10 +52,10 @@ The table part of the record ID. This property will not escape the string when r #### Example -This property will not escape the string when retrieved. +When getting this property, the string is not escaped. ```ts -import { Thing } from "@tai-kun/surrealdb/data-types/decode-only"; +import { Thing } from "@tai-kun/surrealdb/decodeonly-datatypes"; const thing = new Thing("foo-bar", 0); console.log(this.id); @@ -72,7 +72,7 @@ The ID part of the record ID. ### `.toString()` -Converts the `Thing` object into a string that can be used as a variable in SurrealQL. The table name and ID part will be escaped and formatted the same way as SurrealDB's implementation. Also, the object's properties are sorted in ascending order. +Converts the `Thing` object into a string usable as a SurrealQL variable. The table and ID parts are escaped and formatted in the same way as the SurrealDB implementation. Also, the object's properties are sorted in ascending order. `.valueOf()` and `.toJSON()` return the same result as this method. @@ -84,14 +84,14 @@ Converts the `Thing` object into a string that can be used as a variable in Surr None. -#### Return Value +#### Returns Returns a string formatted as a record ID. #### Example ```ts -import { Thing } from "@tai-kun/surrealdb/data-types/encodable"; +import { Thing } from "@tai-kun/surrealdb/encodable-datatypes"; const thing = new Thing([ "foo-bar", @@ -103,7 +103,7 @@ console.log(thing.toString()); ### `.toSurql()` -Converts the `Thing` object into a string that can be embedded in SurrealQL. Similar to `.toString()`, but adds an `r` prefix to tell the query parser that the string is a record ID. +Converts the `Thing` object into a string embeddable in SurrealQL. Similar to `.toString()`, but it adds the `r` prefix to tell the query parser that the string is a record ID. ```ts .toSurql(): string; @@ -113,14 +113,14 @@ Converts the `Thing` object into a string that can be embedded in SurrealQL. Sim None. -#### Return Value +#### Returns Returns a string formatted as a record ID. #### Example ```ts -import { Thing } from "@tai-kun/surrealdb/data-types/encodable"; +import { Thing } from "@tai-kun/surrealdb/encodable-datatypes"; const thing = new Thing("foo", "bar"); console.log(thing.toSurql()); @@ -129,7 +129,7 @@ console.log(thing.toSurql()); ### `.clone()` -Clones the `Thing` object. However, the ID part will not be cloned and referenced. +Clones the `Thing` object. However, the ID part is referenced, not cloned. ```ts .clone(): this; @@ -139,18 +139,18 @@ Clones the `Thing` object. However, the ID part will not be cloned and reference None. -#### Return Value +#### Returns -Returns a new `Thing` object. If the `Thing` class is inherited, an instance of that class will be returned. +Returns a new `Thing` object. If the `Thing` class is inherited, it returns an instance of that class. ### Development #### Type Guard -You can type-safely set the table part and ID part of `Thing` with type parameters: +You can use type parameters for type safety for both the table and ID parts of the `Thing`. ```ts -import { Thing, Uuid } from "@tai-kun/surrealdb/data-types/standard"; +import { Thing, Uuid } from "@tai-kun/surrealdb/standard-datatypes"; function isUserRecordId(thing: unknown): thing is Thing<"user", Uuid> { return thing instanceof Thing @@ -159,9 +159,9 @@ function isUserRecordId(thing: unknown): thing is Thing<"user", Uuid> { } ``` -#### Generic `Thing` Object Determination +#### General Purpose Judgement of `Thing` Objects -It is recommended to use the `isThing` function to determine if a value is a `Thing` object without relying on presets. This function does not use `instanceof`, making it useful when the preset of the value being validated is unknown. +It is recommended to use the `isThing` function to determine if a value is a `Thing` object without relying on presets. This function does not use `instanceof`, so it is helpful when the preset of the value to be validated is unknown. ```ts import { isThing } from "@tai-kun/surrealdb"; diff --git a/docs/src/content/docs/en/v2/api/data/uuid.mdx b/docs/src/content/docs/en/v2/api/data/uuid.mdx index 6e69a3ce..2c190451 100644 --- a/docs/src/content/docs/en/v2/api/data/uuid.mdx +++ b/docs/src/content/docs/en/v2/api/data/uuid.mdx @@ -5,14 +5,14 @@ slug: en/v2/api/data/uuid import Badge from "~/components/en/Badge.astro"; -A UUID (Universally Unique Identifier) is a 128-bit identifier used to uniquely identify a specific entity. `Uuid` is a class that represents this. It supports UUID versions v1 through v7. Note that generating UUIDs requires a separate library or a built-in feature in the runtime (such as `node:crypto`). +A UUID (Universally Unique Identifier) is a 128-bit identifier used to uniquely identify a particular entity. The `Uuid` class represents a UUID and supports versions v1 to v7. To generate a UUID, you will need to use a separate library or a built-in function provided by your runtime environment (e.g., `node:crypto`). ### Import ```ts -import { Uuid } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Uuid } from "@tai-kun/surrealdb/data-types/encodable"; -import { Uuid } from "@tai-kun/surrealdb/data-types/standard"; +import { Uuid } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Uuid } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Uuid } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -28,11 +28,11 @@ new Uuid(source: Uint8Array | string); // standard ##### `source` -An array of bytes representing the UUID or a string if using the standard preset. +The byte array representation of the UUID or a string if it's a standard preset. -#### Return Value +#### Returns -When invoked through `new`, `Uuid` returns its instance. +When called via `new`, `Uuid` returns its instance. ### `.bytes` @@ -44,23 +44,23 @@ The byte array of the UUID. ### `.variant` -The variant of the UUID. This is defined by the top 3 bits of the 13th byte of the UUID. There are 3 main variants and one reserved for future use. +The variant of the UUID. This is defined by the top 4 bits of the 13th bit of the UUID. There are three main variants and one reserved for future use: 1. NCS compatible - `0b0xxx` - - Indicates that the UUID is compatible with NCS (Network Computing System). - - Not commonly used. + - Indicates that the UUID is compatible with the NCS (Network Computing System). + - Not widely used. 2. RFC 4122 compatible - `0b10xx` - UUIDs based on RFC 4122 (the standard specification for UUIDs). - - The most commonly used format for UUIDs. Includes formats like v1 (time-based) and v4 (random). + - The most common UUID format used, including versions like v1 (time-based) and v4 (random). 3. Microsoft GUID compatible - `0b110x` - - The format of GUID (Globally Unique Identifier) used by Microsoft. + - The format of GUIDs (Globally Unique Identifier) used by Microsoft. 4. Reserved for future use - `0b111x` -This property also represents NIL UUID and MAX UUID in addition to the above variants. +This property represents the above variants as well as NIL UUID and MAX UUID. ```ts .variant: @@ -74,7 +74,7 @@ This property also represents NIL UUID and MAX UUID in addition to the above var ### `.version` -The UUID version number if the variant is `"RFC"`. Otherwise, it's `null`. +The UUID version number if the variant is `"RFC"`, otherwise `null`. ```ts .version: 1 | 2 | 3 | 4 | 5 | 6 | 7 | null; @@ -82,7 +82,7 @@ The UUID version number if the variant is `"RFC"`. Otherwise, it's `null`. ### `.timestamp` -The timestamp portion of the UUID if the variant is `"RFC"` and the version is either v1, v6, or v7. Otherwise, it's `null`. For convenience, all timestamps are calculated as milliseconds since the UNIX epoch. +The timestamp portion of the UUID if the variant is `"RFC"` and the version is either v1, v6, or v7, otherwise `null`. For convenience, timestamps are all calculated to milliseconds since the Unix epoch. ```ts .timestamp: number | null; @@ -90,7 +90,7 @@ The timestamp portion of the UUID if the variant is `"RFC"` and the version is e ### `.toString()` -Converts the `Uuid` object to a string that can be used as a variable in SurrealQL. +Converts the `Uuid` object into a string usable as a SurrealQL variable. `.valueOf()` and `.toJSON()` return the same result as this method. @@ -102,14 +102,14 @@ Converts the `Uuid` object to a string that can be used as a variable in Surreal None. -#### Return Value +#### Returns -Returns the UUID string in hexadecimal format. +Returns the hexadecimal UUID string. #### Example ```ts -import { Uuid } from "@tai-kun/surrealdb/data-types/encodable"; +import { Uuid } from "@tai-kun/surrealdb/encodable-datatypes"; const bytes = new Uint8Array([ 0x26, 0xc8, 0x01, 0x63, @@ -125,7 +125,7 @@ console.log(uuid.toString()); ### `.toSurql()` -Converts the `Uuid` object to a string that can be embedded in SurrealQL. Similar to `.toString()` but adds a `u` prefix to tell the query parser that the string is a UUID. +Converts the `Uuid` object into a string embeddable in SurrealQL. Similar to `.toString()` but adds a `u` prefix to signal to the query parser that the string is a UUID. ```ts .toSurql(): string; @@ -135,14 +135,14 @@ Converts the `Uuid` object to a string that can be embedded in SurrealQL. Simila None. -#### Return Value +#### Returns -Returns the UUID string in hexadecimal format with a `u` prefix. +Returns the hexadecimal UUID string with the `u` prefix. #### Example ```ts -import { Uuid } from "@tai-kun/surrealdb/data-types/encodable"; +import { Uuid } from "@tai-kun/surrealdb/encodable-datatypes"; const bytes = new Uint8Array([ 0x26, 0xc8, 0x01, 0x63, @@ -168,13 +168,13 @@ Clones the `Uuid` object. None. -#### Return Value +#### Returns -Returns a new `Uuid` object. If `Uuid` is extended, an instance of that class is returned. +Returns a new `Uuid` object. If the `Uuid` class is extended, an instance of that class is returned. ### `.compareTo()` -Compares the timestamp of the `Uuid` object. +Compares the timestamps of `Uuid` objects. ```ts .compareTo(other: Uuid): -1 | 0 | 1; @@ -184,18 +184,18 @@ Compares the timestamp of the `Uuid` object. ##### `other` -The UUID to compare to. +The UUID to compare against. -#### Return Value +#### Returns -Returns `0` if either one of the timestamps is missing or if the timestamps are the same. Returns `-1` if the timestamp of the compared UUID is later in time and `1` if it's earlier. +Returns `0` if either one has no timestamp portion or if the timestamps are the same. Returns `-1` if the timestamp of the compared UUID is later, and `1` if it's earlier. #### Example -The following example compares the timestamps of different UUID versions to sort them in ascending order: +This example compares the timestamps of different UUID versions and sorts them in ascending order: ```ts -import { Uuid } from "@tai-kun/surrealdb/data-types/standard"; +import { Uuid } from "@tai-kun/surrealdb/standard-datatypes"; const uuidv1 = new Uuid("0e004000-2073-11ef-8451-eb2a011f8691"); const uuidv6 = new Uuid("1ef1fa9e-3968-6000-a77e-683eb1a35ebe"); @@ -219,11 +219,11 @@ console.log(uuidList); //-> ] ``` -### Further Development +### Advanced -#### General Purpose `Uuid` Object Check +#### Universal `Uuid` Object Verification -It is recommended to use the `isUuid` function to check if a value is a `Uuid` object without relying on any specific preset. This function does not use `instanceof`, so it is helpful when the preset of the value to be verified is unknown. +To determine if a value is a `Uuid` object without relying on presets, it's recommended to use the `isUuid` function. This function does not use `instanceof`, making it helpful when the preset of the value being checked is unknown. ```ts import { isUuid } from "@tai-kun/surrealdb"; diff --git a/docs/src/content/docs/en/v2/getting-started.mdx b/docs/src/content/docs/en/v2/getting-started.mdx index 1199f0ee..6e26f1cf 100644 --- a/docs/src/content/docs/en/v2/getting-started.mdx +++ b/docs/src/content/docs/en/v2/getting-started.mdx @@ -52,9 +52,9 @@ try { ```ts import { initSurreal } from "@tai-kun/surrealdb"; -import Client from "@tai-kun/surrealdb/clients/standard"; -import HttpEngine from "@tai-kun/surrealdb/engines/http"; -import JsonFormatter from "@tai-kun/surrealdb/formatters/json"; +import Client from "@tai-kun/surrealdb/standard-client"; +import HttpEngine from "@tai-kun/surrealdb/http-engine"; +import JsonFormatter from "@tai-kun/surrealdb/json-formatter"; const { Surreal } = initSurreal({ Client: Client, diff --git a/docs/src/content/docs/en/v2/guides/errors.mdx b/docs/src/content/docs/en/v2/guides/errors.mdx index 8fc342b0..11e2cbd4 100644 --- a/docs/src/content/docs/en/v2/guides/errors.mdx +++ b/docs/src/content/docs/en/v2/guides/errors.mdx @@ -5,99 +5,99 @@ slug: en/v2/guides/errors ## Introduction -Some error objects may have a `.cause` property. In most cases, this is of type `unknown`, and its value is subject to change without notice. +Some error objects may have a `.cause` property. In most cases, this is of type `unknown` and the value may change without notice. ## General ### SurrealError -`SurrealError` is the base class that most error objects thrown explicitly by this SDK inherit from. This class inherits from JavaScript's `Error` class. This error object is rarely thrown on its own. Instead, inherited error objects with specific meanings are typically thrown. It is recommended to use this error object as a way to easily categorize errors caught in `try-catch` blocks as errors explicitly thrown by this SDK. +`SurrealError` is the base class inherited by most of the error objects that this SDK throws explicitly. This class inherits from JavaScript's `Error` class. This error object is rarely thrown alone, and it is basically thrown by special error objects with inherited meaning. This is recommended for easy classification of errors caught in `try-catch` syntax, etc., to see if the error was thrown explicitly by this SDK. #### Properties `.name: "SurrealError"` -: The name of the error. +: Error name. `.message` -: The error message. +: Error message. `.stack` -: A stack trace may be recorded. +: Stack trace may be recorded. `.cause` : The cause or context of the error may be set. ### SurrealTypeError -Inherits from: `SurrealError` +Inherited from: `SurrealError` -This error is thrown when there is a failure in input value or other validations. +This error is thrown when input values or other validations fail. #### Properties `.name: "SurrealTypeError"` -: The name of the error. +: Error name. `.expected` -: The expected data format. +: Expected data format. `.actual` -: The string representation of the actual value. +: String representation of the actual value. #### Solution -Trace the stack to find the source of the unexpected data format. +Follow the stack trace to find the source of the unexpected data format. ### SurrealValueError -Inherits from: `SurrealError` +Inherited from: `SurrealError` -This error is thrown when there is a failure in input value or other validations. +This error is thrown when input values or other validations fail. #### Properties `.name: "SurrealValueError"` -: The name of the error. +: Error name. `.expected` -: The expected data format. +: Expected data format. `.actual` -: The actual value. +: Actual value. #### Solution -Trace the stack to find the source of the unexpected data format. +Follow the stack trace to find the source of the unexpected data format. ### SurrealAggregateError -Inherits from: `SurrealError` +Inherited from: `SurrealError` -This error represents an aggregation of multiple errors or error messages. +This is an error that combines multiple errors or error messages. #### Properties `.name: "SurrealAggregateError"` -: The name of the error. +: Error name. `.cause: unknown[]` -: Each element of the array contains errors, error messages, or other relevant information. +: Each element of the array contains an error or error message. ### CircularReferenceError -Inherits from: `SurrealError` +Inherited from: `SurrealError` -This error is thrown when a circular reference is detected, primarily during the process of converting JavaScript values into another format. This typically occurs when a parent object is found to contain the same object within itself. +This error is thrown when a circular reference is detected. This is mainly thrown when converting a JavaScript value to another format, such as when the same object is detected as the parent object. #### Properties `.name: "CircularReferenceError"` -: The name of the error. +: Error name. `.reference: unknown` : The value where the circular reference occurred. -For example, this error is thrown in cases like: +For example, this error is thrown in cases like this: ```ts import { toSurql } from "@tai-kun/surrealdb/utils"; @@ -112,57 +112,57 @@ toSurql(a); // throws CircularReferenceError #### Solution -This error can occur beyond the `toSurql` function. It is a general error that requires careful debugging to identify and resolve circular references within objects. +This error is a common error that can be thrown other than the `toSurql` function. You need to carefully debug whether the object contains the object itself. ### NumberRangeError -Inherits from: `SurrealError` +Inherited from: `SurrealError` -This error is thrown when a number falls outside the expected range. +This error is thrown when a number is out of range. #### Properties `.name: "NumberRangeError"` -: The name of the error. +: Error name. `.range` -: The expected range. +: Expected range. `.actual` -: The actual value. +: Actual value. `.integer` -: If `true`, an integer is expected. +: If `true`, expects an integer. #### Solution -Trace the stack to find the source of the unexpected data format. +Follow the stack trace to find the source of the unexpected data format. ### UnsupportedRuntimeError -Inherits from: `SurrealError` +Inherited from: `SurrealError` -This error is thrown when an unsupported runtime is detected. +This error is thrown when it is determined that an unsupported runtime is being used. #### Properties `.name: "UnsupportedRuntimeError"` -: The name of the error. +: Error name. #### Solution -Either avoid using that runtime or use a polyfill and thoroughly test. +Either don't use that runtime or polyfill and test thoroughly. ### UnreachableError -Inherits from: `SurrealError` +Inherited from: `SurrealError` -This error is thrown when unreachable code is reached. It is likely that you have encountered a bug in this SDK if you encounter this error. +This error is thrown when unreachable code is reached. If this error is thrown, you have probably encountered a bug in this SDK. #### Properties `.name: "UnreachableError"` -: The name of the error. +: Error name. #### Solution @@ -174,22 +174,22 @@ You can raise this issue at the following URL: ### CircularEngineReferenceError -Inherits from: `CircularReferenceError` +Inherited from: `CircularReferenceError` -This error is thrown when a circular reference is detected among engines during database connection. +This error is thrown when a circular reference occurs between engines when connecting to the database. #### Properties `.name: "CircularEngineReferenceError"` -: The name of the error. +: Error name. `.reference: string` -: The scheme name where the circular reference occurred. +: Scheme name where circular reference occurred. `.seen: string[]` -: List of scheme names traversed before the circular reference was detected. +: List of scheme names that were traversed before the circular reference occurred. -For example, this error is thrown in cases like: +For example, this error is thrown in cases like this: ```ts import { initSurreal } from "@tai-kun/surrealdb"; @@ -206,15 +206,15 @@ await using db = new Surreal(); await db.connect("https://localhost:8000"); // throws CircularEngineReferenceError: Circular engine reference: http,https ``` -In the above example, the https protocol engine tries to use the engine configured for the http protocol, but the http protocol engine attempts to use the engine configured for the https protocol, leading to a circular reference. +In the example above, the https protocol engine is set to use the engine set to http, but the http protocol engine tries to use the engine set to https, so a circular reference error is thrown. #### Solution -Instead of assigning a string that is a protocol name to a value that is another protocol name, replace it with a specific implementation that creates an engine: +Instead of setting the protocol name specified by the string to the value of another protocol name, replace it with the specific implementation that creates the engine: ```ts del={6} ins={7-10} import { initSurreal } from "@tai-kun/surrealdb"; -import HttpEngine from "@tai-kun/surrealdb/engines/http"; +import HttpEngine from "@tai-kun/surrealdb/http-engine"; const { Surreal } = initSurreal({ engines: { @@ -231,19 +231,19 @@ const { Surreal } = initSurreal({ ### EngineNotFoundError -Inherits from: `SurrealError` +Inherited from: `SurrealError` -This error is thrown when an attempt is made to connect with a protocol for which no engine is configured. +This error is thrown when you try to connect with a protocol for which no engine is configured. #### Properties `.name: "EngineNotFoundError"` -: The name of the error. +: Error name. `.scheme: string` -: The protocol name of the target endpoint. +: The name of the protocol to connect to. -For example, this error is thrown in cases like: +For example, this error is thrown in cases like this: ```ts import { initSurreal } from "@tai-kun/surrealdb"; @@ -261,7 +261,7 @@ await db.connect("https://localhost:8000"); // throws EngineNotFoundError: No ht #### Solution -Check if the protocol of the target endpoint has an engine configured in the `engines` property. +Check the `engines` property to see if an engine can be created for the protocol of the connecting endpoint. ```ts ins={6} import { initSurreal } from "@tai-kun/surrealdb"; @@ -277,17 +277,17 @@ const { Surreal } = initSurreal({ ### ConnectionConflictError -Inherits from: `SurrealError` +Inherited from: `SurrealError` This error is thrown when the client attempts to connect to multiple endpoints simultaneously. #### Properties `.name: "ConnectionConflictError"` -: The name of the error. +: Error name. `.endpoint1: string` -: The endpoint that is already connected. +: Already connected endpoint. `.endpoint2: string` : The other endpoint. @@ -301,7 +301,7 @@ await db.connect("ws://localhost:8000"); await db.connect("ws://localhost:1129"); // throws ConnectionConflictError: An attempt was made to connect to ws://localhost:1129/rpc while ws://localhost:8000/rpc was already connected. ``` -The `.connect` method appends `/rpc` to the end of the provided URL path if it does not end with it. Therefore, it is possible for an error not to occur, contrary to appearances, if the URL path of one of the endpoints ends with `/rpc`: +`.connect` method adds `/rpc` to the end of the URL passed, so the error may not occur, contrary to appearances, if the URL path of one of the endpoints ends in `/rpc`: ```ts import { Surreal } from "@tai-kun/surrealdb"; @@ -337,19 +337,19 @@ await db.connect("http://localhost:11298"); ### MissingNamespaceError -Inherits from: `SurrealError` +Inherited from: `SurrealError` -This error is thrown when a namespace is not selected before selecting a database, or when attempting to leave the namespace unselected while a database is selected. +This error is thrown when no namespace is selected before selecting a database. Or, it is thrown even if you try to leave the namespace unselected after selecting the database. #### Properties `.name: "MissingNamespaceError"` -: The name of the error. +: Error name. `.database: string` -: The database name. +: Database name. -For example, this error is thrown in cases like: +For example, this error is thrown in cases like this: ```ts import { Surreal } from "@tai-kun/surrealdb"; @@ -364,7 +364,7 @@ await db.use({ #### Solution -Select the namespace as well when selecting the database. +When selecting a database, make sure to also select a namespace. ```ts ins={7} import { Surreal } from "@tai-kun/surrealdb"; @@ -380,40 +380,40 @@ await db.use({ ### RpcResponseError -Inherits from: `SurrealError` +Inherited from: `SurrealError` -This error is thrown when the RPC response indicates an error. This means that there are no issues with the communication or the decoding of the response body based on the protocol used to connect, but SurrealDB cannot process the RPC request. +This error is thrown when the RPC response indicates an error. There are no problems with communication or response body decoding due to the connected protocol, but it means that SurrealDB cannot process the RPC request. #### Properties `.name: "RpcResponseError"` -: The name of the error. +: Error name. `.id?: string` -: The ID that identifies the RPC request. The ID always starts with `_`. +: The ID that identifies the RPC request. The ID always starts with ``. `.code: number` -: This is likely the JSON-RPC error code, though it is not explicitly documented in the SurrealDB documentation. +: It is not explicitly stated in the SurrealDB documentation, but it is probably the JSON-RPC error code. #### Solution -The cause of this error can vary. One possible reason is that the version of SurrealDB supported by this SDK differs from the version of SurrealDB that processes the RPC request. +There are many possible causes, but the version of SurrelDB that this SDK supports may be different from the version of SurrealDB that processes the RPC request. ### QueryFailedError -Inherits from: `SurrealAggregateError` +Inherited from: `SurrealAggregateError` -This error is thrown when a query fails. +This error is thrown when the query fails. #### Properties `.name: "QueryFailedError"` -: The name of the error. +: Error name. `.cause: string[]` -: A list of errors. +: List of errors. -For example, this error is thrown in cases like: +For example, this error is thrown in cases like this: ```ts await using db = new Surreal(); @@ -424,20 +424,20 @@ await db.query("OUTPUT 'Hello'"); // throws QueryFailedError: Query failed with #### Solution -Check the correctness of the SurrelQL syntax. +Check if the SurrelQL syntax is correct. ### Closed -Inherits from: `SurrealError` +Inherited from: `SurrealError` This error indicates that the connection has been forcibly terminated. #### Properties `.name: "Closed"` -: The name of the error. +: Error name. -For example, you will get this error in the following case: +For example, you get this error in cases like this: ```ts const db = new Surreal(); @@ -460,92 +460,92 @@ await db.close({ force: true }); ### EngineError -Inherits from: `SurrealError` +Inherited from: `SurrealError` -This indicates that an error originated from the engine. It is emitted through event listeners. +This indicates that the error is due to the engine. It is sent via event listener. #### Properties `.name: "EngineError"` -: The name of the error. +: Error name. `.fatal: boolean | undefined` : Indicates whether this error is fatal. ### HttpEngineError -Inherits from: `EngineError` +Inherited from: `EngineError` -This indicates that an error originated from the HTTP engine. Currently, this is only defined and not used. +This indicates that the error is due to the HTTP engine. It is currently defined but not used. #### Properties `.name: "HttpEngineError"` -: The name of the error. +: Error name. ### WebSocketEngineError -Inherits from: `EngineError` +Inherited from: `EngineError` -This indicates that an error originated from the WebSocket engine. This is used when there is an issue with parsing the response body before identifying the RPC request ID, when receiving an error event from the WebSocket object, or when the WebSocket connection is closed. +This indicates that the error is due to the WebSocket engine. It is used when the response body fails to parse before finding the RPC request identifier, when an error event is received from the WebSocket object, when the WebSocket connection is disconnected, etc. -This SDK uses `315x` as custom status codes. This range is unassigned for status codes in [IANA](https://www.iana.org/assignments/websocket/websocket.xml#close-code-number). +This SDK uses `315x` for custom status codes. This range is unassigned in [IANA](https://www.iana.org/assignments/websocket/websocket.xml#close-code-number). #### Properties `.name: "WebSocketEngineError"` -: The name of the error. +: Error name. `.code: number` : One of the following status codes: - `1000`~`1015`: [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/code) - - `3150`: Indicates an "error" event was received from the `WebSocket`[^1] instance. - - `3151`: Indicates an error occurred within the "open" event handler registered by the WebSocket engine. This is most likely a `StateTransitionError` during the transition from the connecting state to the connected state. - - `3152`: Indicates an error occurred within the "message" event handler registered by the WebSocket engine. While there can be various causes, it is likely that a `ServerResponseError` or `RpcResponseError` was thrown inside the event handler. This could be caused by requesting with invalid RPC parameters. In this case, the method calling the RPC (by default) times out after 5 seconds and fails. In versions of SurrealDB prior to v2.0.2, timeouts could occur for more broad reasons. - - `3153`: Indicates a failure in sending or receiving a ping. While this could be a temporary error, if it continues, it could mean that the connection is not being maintained. - - `3154`: Indicates an error occurred within the "close" event handler registered by the WebSocket engine. This is most likely a `StateTransitionError` during the transition from the closing state to the closed state. -: Note that the following status codes are excluded from the above. They are not treated as errors in this SDK. - - `1000`: Indicates a normal closure. - - `1001`: Early closure is common. + - `3150`: Indicates that the "error" event was received from the `WebSocket`[^1] instance. + - `3151`: Indicates that an error occurred in the "open" event handler registered by the WebSocket engine. In most cases, a `StateTransitionError` occurs during the transition from the connecting state to the connected state. + - `3152`: Indicates that an error occurred in the "message" event handler registered by the WebSocket engine. There are many possible causes, but it is likely that a `ServerResponseError` or `RpcResponseError` was thrown in the event handler. It is likely that the request was made with invalid RPC parameters. In this case, the calling method of the RPC (by default) times out after 5 seconds and fails. In versions prior to SurrealDB v2.0.2, it may timeout due to a wider range of causes. + - `3153`: Indicates that the ping failed to be sent or received. This could be a temporary error, but if you keep receiving it, you may not be able to maintain the connection. + - `3154`: Indicates that an error occurred in the "close" event handler registered by the WebSocket engine. In most cases, a `StateTransitionError` occurs during the transition from the disconnecting state to the disconnected state. +: Note that the following status codes are excluded from the above. This SDK does not treat them as errors. + - `1000`: The connection has been closed normally. + - `1001`: Early disconnections are common. - `1004`: Reserved. - `1005`: Reserved. - `1006`: Reserved. - `1015`: Reserved. -^1: `WebSocket` can be a class defined as a global variable by the runtime or a class from `ws`. +^1: `WebSocket` is either a class defined in the global variable by the runtime or a class of `ws`. #### Solution `1002`,`1003`,`1007`...`1011`,`1014`,`3150`,`3151`,`3154` -: There is likely no automatic way to recover from these status codes. You need to modify the runtime, SurrealDB settings, or hard-coded implementations. +: There is probably no automatic way to recover from this status code. You need to fix the runtime, SurrealDB settings, or hardcoded implementation. `3152` -: Verify the arguments passed to the method (i.e., the content of the RPC request). +: Check if the arguments passed to the method (i.e., the content of the RPC request) are correct. `1012`,`1013`,`3153` : You may be able to automatically recover using the experimental feature [`autoReconnect()`](/v2/experimental/auto-reconnect). ### StateTransitionError -Inherits from: `SurrealAggregateError` +Inherited from: `SurrealAggregateError` -This error is thrown when the execution of the event listener fails during a state transition. +This error is thrown when the event listener fails to execute during the state transition. #### Properties `.name: "StateTransitionError"` -: The name of the error. +: Error name. `.from: string` -: The state at the start of the transition. +: The state at the start of the state transition. `.to: string` -: The target state of the transition. +: The state to which the transition is intended. `.fallback: string` -: The alternative target state in case the state transition fails. If the value is the same as `.to`, it means that the transition was forced. +: Alternative transition destination if the state transition fails. If it is the same value as `.to`, it means that the transition was forced. -For example, this error is thrown in cases like: +For example, this error is thrown in cases like this: ```ts import { Surreal } from "@tai-kun/surrealdb"; @@ -571,127 +571,127 @@ await db.connect("http://localhost:8000"); // throws ... ### ConnectionUnavailableError -Inherits from: `SurrealError` +Inherited from: `SurrealError` -This error is thrown when an attempt is made to send an RPC request while not connected. +This error is thrown when you try to send an RPC request in an unconnected state. #### Properties `.name: "ConnectionUnavailableError"` -: The name of the error. +: Error name. ### ServerResponseError -Inherits from: `SurrealError` +Inherited from: `SurrealError` This error is thrown when the response cannot be parsed as a PRC response. This is different from `RpcResponseError`. #### Properties `.name: "ServerResponseError"` -: The name of the error. +: Error name. #### Solution -Typically, this error should not be thrown. If it is thrown, the version of SurrealDB supported by this SDK may differ from the version of SurrealDB processing the RPC request. +This error should never be thrown normally, but if it is thrown, the version of SurrelDB that this SDK supports may be different from the version of SurrealDB that processes the RPC request. ## CBOR ### CborError -Inherits from: `SurrealError` +Inherited from: `SurrealError` -This is the class that all errors related to CBOR explicitly thrown by `@tai-kun/surrealdb/cbor` inherit from. It is never thrown directly. +This is the class inherited by all errors related to CBOR that are thrown explicitly by `@tai-kun/surrealdb/cbor`. This is never thrown directly. #### Properties `.name: "CborError"` -: The name of the error. +: Error name. ### CborWellFormednessError -Inherits from: `CborError` +Inherited from: `CborError` #### Properties -This is the class that all errors related to CBOR decoding explicitly thrown by `@tai-kun/surrealdb/cbor` inherit from. It is never thrown directly. +This is the class inherited by all errors related to CBOR decoding that are thrown explicitly by `@tai-kun/surrealdb/cbor`. This is never thrown directly. -Refer to the "Well-Formedness Errors and Examples" in Appendix F of RFC8949 ([https://datatracker.ietf.org/doc/html/rfc8949#name-well-formedness-errors-and-](https://datatracker.ietf.org/doc/html/rfc8949#name-well-formedness-errors-and-)). +Refer to "Well-Formedness Errors and Examples" in Appendix F of RFC8949 [https://datatracker.ietf.org/doc/html/rfc8949#name-well-formedness-errors-and-](https://datatracker.ietf.org/doc/html/rfc8949#name-well-formedness-errors-and-). `.name: "CborWellFormednessError"` -: The name of the error. +: Error name. ### CborTooMuchDataError -Inherits from: `CborWellFormednessError` +Inherited from: `CborWellFormednessError` -This indicates that there are remaining input bytes that were not consumed. +Indicates that there are input bytes remaining that were not consumed. [RFC8949](https://datatracker.ietf.org/doc/html/rfc8949#section-appendix.f-2.2) #### Properties `.name: "CborTooMuchDataError"` -: The name of the error. +: Error name. #### Solution -Verify that the byte array being decoded is in the correct CBOR format. +Check if the byte array to be decoded is in the correct CBOR format. ### CborTooLittleDataError -Inherits from: `CborWellFormednessError` +Inherited from: `CborWellFormednessError` -This indicates that the input bytes are incomplete. +Indicates that the input bytes are incomplete. [RFC8949](https://datatracker.ietf.org/doc/html/rfc8949#section-appendix.f-2.4) #### Properties `.name: "CborTooLittleDataError"` -: The name of the error. +: Error name. #### Solution -Verify that the byte array being decoded is in the correct CBOR format. +Check if the byte array to be decoded is in the correct CBOR format. ### CborSyntaxError -Inherits from: `CborWellFormednessError` +Inherited from: `CborWellFormednessError` -This indicates that the input bytes do not match the CBOR encoding format. +Indicates that the input bytes do not match the CBOR encoding format. [RFC8949](https://datatracker.ietf.org/doc/html/rfc8949#section-appendix.f-2.6) #### Properties `.name: "CborSyntaxError"` -: The name of the error. +: Error name. #### Solution -Verify that the byte array being decoded is in the correct CBOR format. +Check if the byte array to be decoded is in the correct CBOR format. ### CborMaxDepthReachedError -Inherits from: `CborError` +Inherited from: `CborError` -This error is thrown when the maximum depth of the JavaScript object is reached during CBOR encoding or decoding. The depth increases by 1 for each object or array entered. +This error is thrown when the depth of the JavaScript object reaches the maximum value during CBOR encoding or decoding. The depth increases by 1 every time you enter an object or array. #### Properties `.name: "CborMaxDepthReachedError"` -: The name of the error. +: Error name. `.maxDepth: number` -: The maximum depth. +: Maximum depth. #### Solution -Either loosen the upper limit of the optional `.maxDepth` or restructure the data so that the nesting of objects is shallower. +Relax the upper limit of the optional `.maxDepth` option or revise the data structure so that the object nesting is shallow. ```ts -import CborFormatter from "@tai-kun/surrealdb/formatters/cbor"; +import CborFormatter from "@tai-kun/surrealdb/cbor-formatter"; const cborFormatter = new CborFormatter({ encode: { @@ -706,41 +706,41 @@ const cborFormatter = new CborFormatter({ ### CborUnsafeMapKeyError -Inherits from: `CborError` +Inherited from: `CborError` This error is thrown when an unsafe map key is found during CBOR encoding or decoding. #### Properties `.name: "CborUnsafeMapKeyError"` -: The name of the error. +: Error name. `.key: unknown` -: The map key that is deemed unsafe. +: The map key that was determined to be unsafe. ## JSON ### JsonError -Inherits from: `SurrealError` +Inherited from: `SurrealError` -This is the class that all errors related to JSON explicitly thrown by `@tai-kun/surrealdb/formatters/json` inherit from. It is never thrown directly. +This is the JSON-formatter that is thrown explicitly by `@tai-kun/surrealdb/json`. #### Properties `.name: "JsonError"` -: The name of the error. +: Error name. ### JsonUnsafeMapKeyError -Inherits from: `JsonError` +Inherited from: `JsonError` This error is thrown when an unsafe map key is found during JSON decoding. #### Properties `.name: "JsonUnsafeMapKeyError"` -: The name of the error. +: Error name. `.key: unknown` -: The map key that is deemed unsafe. +: The map key that was determined to be unsafe. diff --git a/docs/src/content/docs/en/v2/supports.mdx b/docs/src/content/docs/en/v2/supports.mdx index 56c2e144..2eb64801 100644 --- a/docs/src/content/docs/en/v2/supports.mdx +++ b/docs/src/content/docs/en/v2/supports.mdx @@ -7,7 +7,7 @@ import { Aside } from "@astrojs/starlight/components" ## JavaScript -This SDK uses `bigint`, so it requires ES2020 or later as the JavaScript language specification. In addition, considering the features this SDK requires at runtime, it is expected to work on the following runtimes: +This SDK uses `bigint`, so it requires ES2020 or later as the JavaScript language specification. In addition, considering the features required by this SDK at runtime, it is expected to run on the following runtimes: | Runtime | Version | | --- | --- | @@ -21,18 +21,18 @@ This SDK uses `bigint`, so it requires ES2020 or later as the JavaScript languag ## Testing -Testing uses Vitest and Playwright. We are testing on the minimum version of runtime that these work, so it may actually work on runtimes older than those listed below. +Vitest and Playwright are used for testing. We test on the minimum version of the runtime where these are functional, so it may actually work on older runtimes than those shown below. ### Server | Runtime | Version | Status | | --- | --- | --- | | SurrealDB | `^2.0.0` | [GitHub](https://github.com/surrealdb/surrealdb) | -| Node.js | `18.x`,
`20.x`,
`^22.5.1` | [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/tai-kun/surrealdb.js/nodejs.yml?branch=main&logo=Node.js&label=Node.js)](https://github.com/tai-kun/surrealdb.js/actions/workflows/nodejs.yml) | +| Node.js | `18.x`,
`20.x`,
`^22.5.1`,
`23.x` | [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/tai-kun/surrealdb.js/nodejs.yml?branch=main&logo=Node.js&label=Node.js)](https://github.com/tai-kun/surrealdb.js/actions/workflows/nodejs.yml) | | Deno | `1.x`, `2.x` | [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/tai-kun/surrealdb.js/deno.yml?branch=main&logo=Deno&label=Deno)](https://github.com/tai-kun/surrealdb.js/actions/workflows/deno.yml) | | Bun | `^1.1.13` | [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/tai-kun/surrealdb.js/bun.yml?branch=main&logo=Bun&label=Bun)](https://github.com/tai-kun/surrealdb.js/actions/workflows/bun.yml) | -- Note that Node.js v22 is not yet LTS. +- Please note that Node.js v22 is not yet LTS. - We recommend using the latest version of Deno at all times. - We recommend using the latest version of Bun at all times. @@ -44,4 +44,4 @@ Testing uses Vitest and Playwright. We are testing on the minimum version of run | Firefox | `>=100` | [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/tai-kun/surrealdb.js/firefox.yml?branch=main&logo=Firefox&label=Firefox)](https://github.com/tai-kun/surrealdb.js/actions/workflows/firefox.yml) | | WebKit | `>=15.4` | [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/tai-kun/surrealdb.js/webkit.yml?branch=main&style=flat&logo=safari&label=WebKit)](https://github.com/tai-kun/surrealdb.js/actions/workflows/webkit.yml) | -- The supported browsers (engines) correspond to the minimum versions where Playwright works on CI. Therefore, it may work on versions lower than those listed above, but it is not tested. +- The browser (engine) we support matches the minimum version where Playwright works on CI. Therefore, it may work on versions below the above, but we do not test it. diff --git a/docs/src/content/docs/ja/v2/api/data/bound-excluded.mdx b/docs/src/content/docs/ja/v2/api/data/bound-excluded.mdx index 43aa740f..5ed4244d 100644 --- a/docs/src/content/docs/ja/v2/api/data/bound-excluded.mdx +++ b/docs/src/content/docs/ja/v2/api/data/bound-excluded.mdx @@ -12,9 +12,9 @@ import Badge from "~/components/ja/Badge.astro"; ### インポート ```ts -import { BoundExcluded } from "@tai-kun/surrealdb/data-types/decode-only"; -import { BoundExcluded } from "@tai-kun/surrealdb/data-types/encodable"; -import { BoundExcluded } from "@tai-kun/surrealdb/data-types/standard"; +import { BoundExcluded } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { BoundExcluded } from "@tai-kun/surrealdb/encodable-datatypes"; +import { BoundExcluded } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` diff --git a/docs/src/content/docs/ja/v2/api/data/bound-included.mdx b/docs/src/content/docs/ja/v2/api/data/bound-included.mdx index 82e83983..cbc8b35f 100644 --- a/docs/src/content/docs/ja/v2/api/data/bound-included.mdx +++ b/docs/src/content/docs/ja/v2/api/data/bound-included.mdx @@ -12,9 +12,9 @@ import Badge from "~/components/ja/Badge.astro"; ### インポート ```ts -import { BoundIncluded } from "@tai-kun/surrealdb/data-types/decode-only"; -import { BoundIncluded } from "@tai-kun/surrealdb/data-types/encodable"; -import { BoundIncluded } from "@tai-kun/surrealdb/data-types/standard"; +import { BoundIncluded } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { BoundIncluded } from "@tai-kun/surrealdb/encodable-datatypes"; +import { BoundIncluded } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` diff --git a/docs/src/content/docs/ja/v2/api/data/datetime.mdx b/docs/src/content/docs/ja/v2/api/data/datetime.mdx index f84a2409..00857274 100644 --- a/docs/src/content/docs/ja/v2/api/data/datetime.mdx +++ b/docs/src/content/docs/ja/v2/api/data/datetime.mdx @@ -10,9 +10,9 @@ import Badge from "~/components/ja/Badge.astro"; ### インポート ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Datetime } from "@tai-kun/surrealdb/data-types/encodable"; -import { Datetime } from "@tai-kun/surrealdb/data-types/standard"; +import { Datetime } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Datetime } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Datetime } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -92,7 +92,7 @@ new Datetime( #### 例 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/encodable"; +import { Datetime } from "@tai-kun/surrealdb/encodable-datatypes"; const date = new Datetime("2024-06-01T12:34:56.780123456Z"); console.log(date.valueOf()); @@ -118,7 +118,7 @@ console.log(date.valueOf()); #### 例 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/encodable"; +import { Datetime } from "@tai-kun/surrealdb/encodable-datatypes"; const date = new Datetime("2024-06-01T12:34:56.780123456Z"); console.log(date.toString()); @@ -144,7 +144,7 @@ console.log(date.toString()); #### 例 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/encodable"; +import { Datetime } from "@tai-kun/surrealdb/encodable-datatypes"; const date = new Datetime([1717245296, 780123456]); console.log(date.toISOString()); @@ -186,7 +186,7 @@ console.log(date.toISOString()); #### 例 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/encodable"; +import { Datetime } from "@tai-kun/surrealdb/encodable-datatypes"; const date = new Datetime([1717245296, 780123456]); console.log(date.toSurql()); @@ -230,7 +230,7 @@ console.log(date.toSurql()); #### 例 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/standard"; +import { Datetime } from "@tai-kun/surrealdb/standard-datatypes"; const date = new Datetime(0); const time = dt.setCompact([1717245296, 780123456]); @@ -259,7 +259,7 @@ console.log(time); #### 例 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/standard"; +import { Datetime } from "@tai-kun/surrealdb/standard-datatypes"; const date = new Datetime([1717245296, 780123456]); console.log(date.toISOString()); @@ -295,7 +295,7 @@ console.log(date.getMicroseconds()); #### 例 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/standard"; +import { Datetime } from "@tai-kun/surrealdb/standard-datatypes"; const date = new Datetime([1717245296, 780123456]); console.log(date.toISOString()); @@ -329,7 +329,7 @@ console.log(time); #### 例 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/standard"; +import { Datetime } from "@tai-kun/surrealdb/standard-datatypes"; const date = new Datetime([1717245296, 780123456]); console.log(date.toISOString()); @@ -365,7 +365,7 @@ console.log(date.getNanoseconds()); #### 例 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/standard"; +import { Datetime } from "@tai-kun/surrealdb/standard-datatypes"; const date = new Datetime([1717245296, 780123456]); console.log(date.toISOString()); diff --git a/docs/src/content/docs/ja/v2/api/data/decimal.mdx b/docs/src/content/docs/ja/v2/api/data/decimal.mdx index 16748263..7c89a591 100644 --- a/docs/src/content/docs/ja/v2/api/data/decimal.mdx +++ b/docs/src/content/docs/ja/v2/api/data/decimal.mdx @@ -10,9 +10,9 @@ import Badge from "~/components/ja/Badge.astro"; ### インポート ```ts -import { Decimal } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Decimal } from "@tai-kun/surrealdb/data-types/encodable"; -import { Decimal } from "@tai-kun/surrealdb/data-types/standard"; +import { Decimal } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Decimal } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Decimal } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -65,7 +65,7 @@ new Decimal(source: string | number | Decimal); // standard #### 例 ```ts -import { Decimal } from "@tai-kun/surrealdb/data-types/encodable"; +import { Decimal } from "@tai-kun/surrealdb/encodable-datatypes"; const decimal = new Decimal("3.14"); console.log(decimal.toSurql()); diff --git a/docs/src/content/docs/ja/v2/api/data/duration.mdx b/docs/src/content/docs/ja/v2/api/data/duration.mdx index ad06720b..50fd0d3c 100644 --- a/docs/src/content/docs/ja/v2/api/data/duration.mdx +++ b/docs/src/content/docs/ja/v2/api/data/duration.mdx @@ -10,9 +10,9 @@ import Badge from "~/components/ja/Badge.astro"; ### インポート ```ts -import { Duration } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Duration } from "@tai-kun/surrealdb/data-types/encodable"; -import { Duration } from "@tai-kun/surrealdb/data-types/standard"; +import { Duration } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Duration } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Duration } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -124,7 +124,7 @@ new Duration(end - begin); #### 例 ```ts -import { Duration } from "@tai-kun/surrealdb/data-types/encodable"; +import { Duration } from "@tai-kun/surrealdb/encodable-datatypes"; const duration = new Duration(0); console.log(duration.parse()); @@ -132,7 +132,7 @@ console.log(duration.parse()); ``` ```ts -import { Duration } from "@tai-kun/surrealdb/data-types/encodable"; +import { Duration } from "@tai-kun/surrealdb/encodable-datatypes"; const duration = new Duration(12_345_000n); console.log(duration.parse()); @@ -156,7 +156,7 @@ console.log(duration.parse()); 期間をナノ秒単位で返します。 ```ts -import { Duration } from "@tai-kun/surrealdb/data-types/encodable"; +import { Duration } from "@tai-kun/surrealdb/encodable-datatypes"; const duration = new Duration(12_345_000n); console.log(duration.valueOf()); @@ -184,7 +184,7 @@ console.log(duration.valueOf()); #### 例 ```ts -import { Duration } from "@tai-kun/surrealdb/data-types/encodable"; +import { Duration } from "@tai-kun/surrealdb/encodable-datatypes"; const duration = new Duration(12_345_000n); console.log(duration.toString()); @@ -210,7 +210,7 @@ console.log(duration.toString()); #### 例 ```ts -import { Duration } from "@tai-kun/surrealdb/data-types/encodable"; +import { Duration } from "@tai-kun/surrealdb/encodable-datatypes"; const duration = new Duration("2m3s456ms"); console.log(duration.toISOString()); diff --git a/docs/src/content/docs/ja/v2/api/data/future.mdx b/docs/src/content/docs/ja/v2/api/data/future.mdx index a0a5f0dc..8157ddac 100644 --- a/docs/src/content/docs/ja/v2/api/data/future.mdx +++ b/docs/src/content/docs/ja/v2/api/data/future.mdx @@ -12,9 +12,9 @@ import Badge from "~/components/ja/Badge.astro"; ### インポート ```ts -import { Future } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Future } from "@tai-kun/surrealdb/data-types/encodable"; -import { Future } from "@tai-kun/surrealdb/data-types/standard"; +import { Future } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Future } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Future } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -62,7 +62,7 @@ future のブロック内の値や式を返します。 #### 例 ```ts -import { Future } from "@tai-kun/surrealdb/data-types/encodable"; +import { Future } from "@tai-kun/surrealdb/encodable-datatypes"; const future = new Future(`time::now()`); console.log(future.toString()); @@ -88,7 +88,7 @@ SurrealQL に埋め込める future を返します。 #### 例 ```ts -import { Future } from "@tai-kun/surrealdb/data-types/encodable"; +import { Future } from "@tai-kun/surrealdb/encodable-datatypes"; const future = new Future(`time::now()`); console.log(future.toSurql()); @@ -120,7 +120,7 @@ SurrealQL です。 #### 例 ```ts -import { Future, Thing } from "@tai-kun/surrealdb/data-types/standard"; +import { Future, Thing } from "@tai-kun/surrealdb/standard-datatypes"; const foo = "foo"; const rid = new Thing("person", "tai-kun"); @@ -140,7 +140,7 @@ console.log(future.toSurql()); 上記の例を `.surql()` を使わないとすると: ```ts -import { Future, Thing } from "@tai-kun/surrealdb/data-types/standard"; +import { Future, Thing } from "@tai-kun/surrealdb/standard-datatypes"; import { toSurql } from "@tai-kun/surrealdb/utils"; const foo = "foo"; diff --git a/docs/src/content/docs/ja/v2/api/data/geometry-collection.mdx b/docs/src/content/docs/ja/v2/api/data/geometry-collection.mdx index 6f38730f..0833aac3 100644 --- a/docs/src/content/docs/ja/v2/api/data/geometry-collection.mdx +++ b/docs/src/content/docs/ja/v2/api/data/geometry-collection.mdx @@ -10,9 +10,9 @@ import Badge from "~/components/ja/Badge.astro"; ### インポート ```ts -import { GeometryCollection } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryCollection } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryCollection } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryCollection } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryCollection } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryCollection } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` diff --git a/docs/src/content/docs/ja/v2/api/data/geometry-line.mdx b/docs/src/content/docs/ja/v2/api/data/geometry-line.mdx index b4f67fb3..7b290109 100644 --- a/docs/src/content/docs/ja/v2/api/data/geometry-line.mdx +++ b/docs/src/content/docs/ja/v2/api/data/geometry-line.mdx @@ -10,9 +10,9 @@ import Badge from "~/components/ja/Badge.astro"; ### インポート ```ts -import { GeometryLine } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryLine } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryLine } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryLine } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryLine } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryLine } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` diff --git a/docs/src/content/docs/ja/v2/api/data/geometry-multi-line.mdx b/docs/src/content/docs/ja/v2/api/data/geometry-multi-line.mdx index b1290455..9af816d9 100644 --- a/docs/src/content/docs/ja/v2/api/data/geometry-multi-line.mdx +++ b/docs/src/content/docs/ja/v2/api/data/geometry-multi-line.mdx @@ -10,9 +10,9 @@ import Badge from "~/components/ja/Badge.astro"; ### インポート ```ts -import { GeometryMultiLine } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryMultiLine } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryMultiLine } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryMultiLine } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryMultiLine } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryMultiLine } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` diff --git a/docs/src/content/docs/ja/v2/api/data/geometry-multi-point.mdx b/docs/src/content/docs/ja/v2/api/data/geometry-multi-point.mdx index bbbc7c63..8de7e27c 100644 --- a/docs/src/content/docs/ja/v2/api/data/geometry-multi-point.mdx +++ b/docs/src/content/docs/ja/v2/api/data/geometry-multi-point.mdx @@ -10,9 +10,9 @@ import Badge from "~/components/ja/Badge.astro"; ### インポート ```ts -import { GeometryMultiPoint } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryMultiPoint } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryMultiPoint } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryMultiPoint } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryMultiPoint } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryMultiPoint } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` diff --git a/docs/src/content/docs/ja/v2/api/data/geometry-multi-polygon.mdx b/docs/src/content/docs/ja/v2/api/data/geometry-multi-polygon.mdx index 7797e47d..ed475a9e 100644 --- a/docs/src/content/docs/ja/v2/api/data/geometry-multi-polygon.mdx +++ b/docs/src/content/docs/ja/v2/api/data/geometry-multi-polygon.mdx @@ -10,9 +10,9 @@ import Badge from "~/components/ja/Badge.astro"; ### インポート ```ts -import { GeometryMultiPolygon } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryMultiPolygon } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryMultiPolygon } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryMultiPolygon } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryMultiPolygon } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryMultiPolygon } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` diff --git a/docs/src/content/docs/ja/v2/api/data/geometry-point.mdx b/docs/src/content/docs/ja/v2/api/data/geometry-point.mdx index a952fa72..c75df114 100644 --- a/docs/src/content/docs/ja/v2/api/data/geometry-point.mdx +++ b/docs/src/content/docs/ja/v2/api/data/geometry-point.mdx @@ -10,9 +10,9 @@ import Badge from "~/components/ja/Badge.astro"; ### インポート ```ts -import { GeometryPoint } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryPoint } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryPoint } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryPoint } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryPoint } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryPoint } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` diff --git a/docs/src/content/docs/ja/v2/api/data/geometry-polygon.mdx b/docs/src/content/docs/ja/v2/api/data/geometry-polygon.mdx index 32c8403c..54326dc8 100644 --- a/docs/src/content/docs/ja/v2/api/data/geometry-polygon.mdx +++ b/docs/src/content/docs/ja/v2/api/data/geometry-polygon.mdx @@ -10,9 +10,9 @@ import Badge from "~/components/ja/Badge.astro"; ### インポート ```ts -import { GeometryPolygon } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryPolygon } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryPolygon } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryPolygon } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryPolygon } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryPolygon } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` diff --git a/docs/src/content/docs/ja/v2/api/data/range.mdx b/docs/src/content/docs/ja/v2/api/data/range.mdx index a690cc1b..301f74a8 100644 --- a/docs/src/content/docs/ja/v2/api/data/range.mdx +++ b/docs/src/content/docs/ja/v2/api/data/range.mdx @@ -12,9 +12,9 @@ import Badge from "~/components/ja/Badge.astro"; ### インポート ```ts -import { Range } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Range } from "@tai-kun/surrealdb/data-types/encodable"; -import { Range } from "@tai-kun/surrealdb/data-types/standard"; +import { Range } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Range } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Range } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -81,7 +81,7 @@ import { Range, BoundIncluded, BoundExcluded, -} from "@tai-kun/surrealdb/data-types/encodable"; +} from "@tai-kun/surrealdb/encodable-datatypes"; const range = new Range([new BoundIncluded(1), new BoundIncluded(3)]); console.log(range.toString()); diff --git a/docs/src/content/docs/ja/v2/api/data/table.mdx b/docs/src/content/docs/ja/v2/api/data/table.mdx index 62a5b542..5238da59 100644 --- a/docs/src/content/docs/ja/v2/api/data/table.mdx +++ b/docs/src/content/docs/ja/v2/api/data/table.mdx @@ -10,9 +10,9 @@ import Badge from "~/components/ja/Badge.astro"; ### インポート ```ts -import { Table } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Table } from "@tai-kun/surrealdb/data-types/encodable"; -import { Table } from "@tai-kun/surrealdb/data-types/standard"; +import { Table } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Table } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Table } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -47,7 +47,7 @@ new Table(source: string | { name: string }); // standard このプロパティーを取得する場合、文字列はエスケープされません。 ```ts -import { Table } from "@tai-kun/surrealdb/data-types/decode-only"; +import { Table } from "@tai-kun/surrealdb/decodeonly-datatypes"; const table = new Table("foo-bar"); console.log(table.name); @@ -75,7 +75,7 @@ console.log(table.name); #### 例 ```ts -import { Table } from "@tai-kun/surrealdb/data-types/encodable"; +import { Table } from "@tai-kun/surrealdb/encodable-datatypes"; const table = new Table("foo-bar"); console.log(table.toString()); @@ -101,7 +101,7 @@ console.log(table.toString()); #### 例 ```ts -import { Table } from "@tai-kun/surrealdb/data-types/encodable"; +import { Table } from "@tai-kun/surrealdb/encodable-datatypes"; const table = new Table("foo-bar"); console.log(table.toSurql()); @@ -131,7 +131,7 @@ console.log(table.toSurql()); `Table` のテーブル名を型パラメーターを使って型安全にすることができます: ```ts -import { Table } from "@tai-kun/surrealdb/data-types/standard"; +import { Table } from "@tai-kun/surrealdb/standard-datatypes"; function isUserTable(table: unknown): table is Table<"user"> { return table instanceof Table diff --git a/docs/src/content/docs/ja/v2/api/data/thing.mdx b/docs/src/content/docs/ja/v2/api/data/thing.mdx index 049ce8f6..6ed19990 100644 --- a/docs/src/content/docs/ja/v2/api/data/thing.mdx +++ b/docs/src/content/docs/ja/v2/api/data/thing.mdx @@ -10,9 +10,9 @@ import Badge from "~/components/ja/Badge.astro"; ### インポート ```ts -import { Thing } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Thing } from "@tai-kun/surrealdb/data-types/encodable"; -import { Thing } from "@tai-kun/surrealdb/data-types/standard"; +import { Thing } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Thing } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Thing } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -55,7 +55,7 @@ new Thing(table: string, id: string | number | bigint | object); このプロパティーを取得する場合、文字列はエスケープされません。 ```ts -import { Thing } from "@tai-kun/surrealdb/data-types/decode-only"; +import { Thing } from "@tai-kun/surrealdb/decodeonly-datatypes"; const thing = new Thing("foo-bar", 0); console.log(this.id); @@ -91,7 +91,7 @@ console.log(this.id); #### 例 ```ts -import { Thing } from "@tai-kun/surrealdb/data-types/encodable"; +import { Thing } from "@tai-kun/surrealdb/encodable-datatypes"; const thing = new Thing([ "foo-bar", @@ -120,7 +120,7 @@ console.log(thing.toString()); #### 例 ```ts -import { Thing } from "@tai-kun/surrealdb/data-types/encodable"; +import { Thing } from "@tai-kun/surrealdb/encodable-datatypes"; const thing = new Thing("foo", "bar"); console.log(thing.toSurql()); @@ -150,7 +150,7 @@ console.log(thing.toSurql()); `Thing` のテーブル部と ID 部のそれぞれを型パラメーターを使って型安全にすることができます: ```ts -import { Thing, Uuid } from "@tai-kun/surrealdb/data-types/standard"; +import { Thing, Uuid } from "@tai-kun/surrealdb/standard-datatypes"; function isUserRecordId(thing: unknown): thing is Thing<"user", Uuid> { return thing instanceof Thing diff --git a/docs/src/content/docs/ja/v2/api/data/uuid.mdx b/docs/src/content/docs/ja/v2/api/data/uuid.mdx index 4fade8bb..6e671879 100644 --- a/docs/src/content/docs/ja/v2/api/data/uuid.mdx +++ b/docs/src/content/docs/ja/v2/api/data/uuid.mdx @@ -10,9 +10,9 @@ UUID(Universally Unique Identifier)は、特定のエンティティを一 ### インポート ```ts -import { Uuid } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Uuid } from "@tai-kun/surrealdb/data-types/encodable"; -import { Uuid } from "@tai-kun/surrealdb/data-types/standard"; +import { Uuid } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Uuid } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Uuid } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -109,7 +109,7 @@ UUID のバリアントが `"RFC"` でバージョンが v1、v6、v7 のいず #### 例 ```ts -import { Uuid } from "@tai-kun/surrealdb/data-types/encodable"; +import { Uuid } from "@tai-kun/surrealdb/encodable-datatypes"; const bytes = new Uint8Array([ 0x26, 0xc8, 0x01, 0x63, @@ -142,7 +142,7 @@ console.log(uuid.toString()); #### 例 ```ts -import { Uuid } from "@tai-kun/surrealdb/data-types/encodable"; +import { Uuid } from "@tai-kun/surrealdb/encodable-datatypes"; const bytes = new Uint8Array([ 0x26, 0xc8, 0x01, 0x63, @@ -195,7 +195,7 @@ console.log(uuid.toSurql()); 次の例では、異なる UUID のバージョンのタイムスタンプを比較して、昇順に並び替えています: ```ts -import { Uuid } from "@tai-kun/surrealdb/data-types/standard"; +import { Uuid } from "@tai-kun/surrealdb/standard-datatypes"; const uuidv1 = new Uuid("0e004000-2073-11ef-8451-eb2a011f8691"); const uuidv6 = new Uuid("1ef1fa9e-3968-6000-a77e-683eb1a35ebe"); diff --git a/docs/src/content/docs/ja/v2/getting-started.mdx b/docs/src/content/docs/ja/v2/getting-started.mdx index e3770658..6628e3aa 100644 --- a/docs/src/content/docs/ja/v2/getting-started.mdx +++ b/docs/src/content/docs/ja/v2/getting-started.mdx @@ -52,9 +52,9 @@ try { ```ts import { initSurreal } from "@tai-kun/surrealdb"; -import Client from "@tai-kun/surrealdb/clients/standard"; -import HttpEngine from "@tai-kun/surrealdb/engines/http"; -import JsonFormatter from "@tai-kun/surrealdb/formatters/json"; +import Client from "@tai-kun/surrealdb/standard-client"; +import HttpEngine from "@tai-kun/surrealdb/http-engine"; +import JsonFormatter from "@tai-kun/surrealdb/json-formatter"; const { Surreal } = initSurreal({ Client: Client, diff --git a/docs/src/content/docs/ja/v2/guides/errors.mdx b/docs/src/content/docs/ja/v2/guides/errors.mdx index 2759c296..b2c1e8aa 100644 --- a/docs/src/content/docs/ja/v2/guides/errors.mdx +++ b/docs/src/content/docs/ja/v2/guides/errors.mdx @@ -214,7 +214,7 @@ await db.connect("https://localhost:8000"); // throws CircularEngineReferenceErr ```ts del={6} ins={7-10} import { initSurreal } from "@tai-kun/surrealdb"; -import HttpEngine from "@tai-kun/surrealdb/engines/http"; +import HttpEngine from "@tai-kun/surrealdb/http-engine"; const { Surreal } = initSurreal({ engines: { @@ -691,7 +691,7 @@ CBOR のエンコードまたはデコード時に JavaScript オブジェクト オプションの `.maxDepth` の上限を緩和するか、オブジェクトのネストが浅くなるようにデータ構造を見直します。 ```ts -import CborFormatter from "@tai-kun/surrealdb/formatters/cbor"; +import CborFormatter from "@tai-kun/surrealdb/cbor-formatter"; const cborFormatter = new CborFormatter({ encode: { @@ -724,7 +724,7 @@ CBOR のエンコードまたはデコード時に安全ではないマップキ 継承元: `SurrealError` -これは `@tai-kun/surrealdb/formatters/json` が明示的に投げる、JSON に関連したすべてのエラーが継承するクラスです。これが直接投げられることはありません。 +これは `@tai-kun/surrealdb/json` が明示的に投げる、JSON-formatter。 #### プロパティー diff --git a/docs/src/content/docs/ko/v2/api/data/bound-excluded.mdx b/docs/src/content/docs/ko/v2/api/data/bound-excluded.mdx index 59caa717..a5a86101 100644 --- a/docs/src/content/docs/ko/v2/api/data/bound-excluded.mdx +++ b/docs/src/content/docs/ko/v2/api/data/bound-excluded.mdx @@ -2,24 +2,24 @@ title: BoundExcluded slug: ko/v2/api/data/bound-excluded banner: - content: 이것은 실험적인 기능입니다. + content: 이 기능은 실험적인 기능입니다. --- import Badge from "~/components/ko/Badge.astro"; -[`Range`](/v2/api/data/range)를 참조하십시오. +[`Range`](/v2/api/data/range) 를 참조하십시오. ### 가져오기 ```ts -import { BoundExcluded } from "@tai-kun/surrealdb/data-types/decode-only"; -import { BoundExcluded } from "@tai-kun/surrealdb/data-types/encodable"; -import { BoundExcluded } from "@tai-kun/surrealdb/data-types/standard"; +import { BoundExcluded } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { BoundExcluded } from "@tai-kun/surrealdb/encodable-datatypes"; +import { BoundExcluded } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` -새로운 `BoundExcluded` 객체를 만듭니다. +새로운 `BoundExcluded` 객체를 생성합니다. ```ts new BoundExcluded(source: unknown); @@ -33,7 +33,7 @@ new BoundExcluded(source: unknown); #### 반환 값 -`new`를 통해 호출하면 `BoundExcluded`는 해당 인스턴스를 반환합니다. +`new` 를 통해 호출되는 경우 `BoundExcluded` 는 해당 인스턴스를 반환합니다. ### `.value` diff --git a/docs/src/content/docs/ko/v2/api/data/bound-included.mdx b/docs/src/content/docs/ko/v2/api/data/bound-included.mdx index d558600c..c14a72ad 100644 --- a/docs/src/content/docs/ko/v2/api/data/bound-included.mdx +++ b/docs/src/content/docs/ko/v2/api/data/bound-included.mdx @@ -12,9 +12,9 @@ import Badge from "~/components/ko/Badge.astro"; ### 임포트 ```ts -import { BoundIncluded } from "@tai-kun/surrealdb/data-types/decode-only"; -import { BoundIncluded } from "@tai-kun/surrealdb/data-types/encodable"; -import { BoundIncluded } from "@tai-kun/surrealdb/data-types/standard"; +import { BoundIncluded } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { BoundIncluded } from "@tai-kun/surrealdb/encodable-datatypes"; +import { BoundIncluded } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -29,12 +29,12 @@ new BoundIncluded(source: unknown); ##### `source` -조사 중. +조사 중입니다. #### 반환 값 -`new` 를 통해 호출된 경우 `BoundIncluded` 는 해당 인스턴스를 반환합니다. +`new` 를 통해 호출될 경우 `BoundIncluded` 는 해당 인스턴스를 반환합니다. ### `.value` -조사 중. +조사 중입니다. diff --git a/docs/src/content/docs/ko/v2/api/data/datetime.mdx b/docs/src/content/docs/ko/v2/api/data/datetime.mdx index c469b80f..1a91b6d1 100644 --- a/docs/src/content/docs/ko/v2/api/data/datetime.mdx +++ b/docs/src/content/docs/ko/v2/api/data/datetime.mdx @@ -5,19 +5,19 @@ slug: ko/v2/api/data/datetime import Badge from "~/components/ko/Badge.astro"; -`Datetime`은 날짜와 시간을 나타내는 클래스입니다. SurrealQL의 [`datetime`](https://surrealdb.com/docs/surrealql/datamodel/datetimes) 형식을 지원합니다. +`Datetime`은 날짜와 시간을 나타내는 클래스입니다. SurrealQL의 [`datetime`](https://surrealdb.com/docs/surrealql/datamodel/datetimes) 유형과 호환됩니다. ### 가져오기 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Datetime } from "@tai-kun/surrealdb/data-types/encodable"; -import { Datetime } from "@tai-kun/surrealdb/data-types/standard"; +import { Datetime } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Datetime } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Datetime } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` -새 `Datetime` 객체를 생성합니다. +새로운 `Datetime` 객체를 만듭니다. ```ts new Datetime(source: [number, number] | string); // decode-only, encodable @@ -43,23 +43,23 @@ new Datetime( ); // standard ``` -#### 인수 +#### 매개변수 ##### `source` -초 단위 및 나노초 단위의 쌍 또는 문자열입니다. `standard` 이하의 프리셋에서는 `Date` 객체나 `bigint` 입력도 지원합니다. +초 단위 및 나노초 단위 쌍 또는 문자열입니다. 프리셋이 standard이면 `Date` 객체나 `bigint` 입력도 지원합니다. ##### `year`, `monthIndex`, ... -`Date` 클래스의 인수와 동일합니다. 다만 `nanoseconds` 입력도 지원합니다. `undefined`를 제공한 인수 이후에 `number`를 제공할 수 없습니다. 이는 `Date` 클래스와 거의 동일한 사양입니다. +`Date` 클래스의 매개변수와 동일합니다. 단, `nanoseconds` 입력도 지원합니다. `undefined`를 제공한 매개변수 뒤에 `number`를 제공할 수 없습니다. 이는 `Date` 클래스와 거의 동일한 사양입니다. -#### 반환 값 +#### 반환값 -`new`를 통해 호출될 경우 `Datetime`은 해당 인스턴스를 반환합니다. `standard` 이하의 프리셋에서는 `Date` 인스턴스이기도 합니다. +`new`를 통해 호출된 경우 `Datetime`은 해당 인스턴스를 반환합니다. 프리셋이 standard이면 `Date` 인스턴스이기도 합니다. ### `.seconds` -나노초 단위 시간의 초 단위 부분입니다. `standard` 이하의 프리셋에서는 읽기 전용입니다. 값은 -253-1에서 253-1 사이의 정수 또는 `NaN`입니다. +나노초 단위 시간의 초 단위 부분입니다. standard 미만의 프리셋에서는 읽기 전용입니다. 값은 -253-1에서 253-1까지의 정수 또는 `NaN`입니다. ```ts .seconds: number; @@ -67,7 +67,7 @@ new Datetime( ### `.nanoseconds` -나노초 단위 시간의 나노초 단위 부분입니다. `standard` 이하의 프리셋에서는 읽기 전용입니다. 값은 0에서 999999999 사이의 정수 또는 `NaN`입니다. +나노초 단위 시간의 나노초 단위 부분입니다. standard 미만의 프리셋에서는 읽기 전용입니다. 값은 0에서 999999999까지의 정수 또는 `NaN`입니다. ```ts .nanoseconds: number; @@ -81,18 +81,18 @@ new Datetime( .valueOf(): number; ``` -#### 인수 +#### 매개변수 없음. -#### 반환 값 +#### 반환값 밀리초 단위 시간을 반환합니다. #### 예 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/encodable"; +import { Datetime } from "@tai-kun/surrealdb/encodable-datatypes"; const date = new Datetime("2024-06-01T12:34:56.780123456Z"); console.log(date.valueOf()); @@ -107,18 +107,18 @@ console.log(date.valueOf()); .toString(): string; ``` -#### 인수 +#### 매개변수 없음. -#### 반환 값 +#### 반환값 밀리초 단위 시간의 문자열 표현을 반환합니다. #### 예 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/encodable"; +import { Datetime } from "@tai-kun/surrealdb/encodable-datatypes"; const date = new Datetime("2024-06-01T12:34:56.780123456Z"); console.log(date.toString()); @@ -133,18 +133,18 @@ console.log(date.toString()); .toISOString(): string; ``` -#### 인수 +#### 매개변수 없음. -#### 반환 값 +#### 반환값 나노초 단위 시간의 문자열을 ISO 형식으로 반환합니다. #### 예 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/encodable"; +import { Datetime } from "@tai-kun/surrealdb/encodable-datatypes"; const date = new Datetime([1717245296, 780123456]); console.log(date.toISOString()); @@ -153,40 +153,40 @@ console.log(date.toISOString()); ### `.toDate()` -런타임 기본 제공 `Date` 객체로 변환합니다. 밀리초 단위로 변환된다는 점에 유의하십시오. +런타임 내장 `Date` 객체로 변환합니다. 밀리초 단위로 변환된다는 점에 유의하십시오. ```ts .toDate(): Date; ``` -#### 인수 +#### 매개변수 없음. -#### 반환 값 +#### 반환값 -런타임 기본 제공 `Date` 객체를 반환합니다. +런타임 내장 `Date` 객체를 반환합니다. ### `.toSurql()` -`Datetime` 객체를 SurrealQL에 포함할 수 있는 문자열로 변환합니다. `.toISOString()`과 유사하지만 `d` 접두사를 추가하여 쿼리 파서에 문자열이 UUID임을 알립니다. +`Datetime` 객체를 SurrealQL에 삽입할 수 있는 문자열로 변환합니다. `.toISOString()`과 유사하지만 `d` 접두사를 추가하여 쿼리 파서에 문자열이 UUID임을 알립니다. ```ts .toSurql(): string; ``` -#### 인수 +#### 매개변수 없음. -#### 반환 값 +#### 반환값 `d` 접두사가 붙은 ISO 형식의 날짜 및 시간을 반환합니다. #### 예 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/encodable"; +import { Datetime } from "@tai-kun/surrealdb/encodable-datatypes"; const date = new Datetime([1717245296, 780123456]); console.log(date.toSurql()); @@ -195,42 +195,42 @@ console.log(date.toSurql()); ### `.getCompact()` -초 단위 및 나노초 단위의 쌍을 가져옵니다. +초 단위 및 나노초 단위 쌍을 가져옵니다. ```ts .getCompact(): [seconds: number, nanoseconds: number]; ``` -#### 인수 +#### 매개변수 없음. -#### 반환 값 +#### 반환값 -초 단위 및 나노초 단위의 쌍을 반환합니다. +초 단위 및 나노초 단위 쌍을 반환합니다. ### `.setCompact()` -초 단위 및 나노초 단위의 쌍으로 날짜 및 시간을 설정합니다. +초 단위 및 나노초 단위 쌍으로 날짜 및 시간을 설정합니다. ```ts .setCompact(compact: [seconds: number, nanoseconds: number]): number; ``` -#### 인수 +#### 매개변수 ##### `compact` -초 단위 및 나노초 단위의 쌍입니다. +초 단위 및 나노초 단위 쌍입니다. -#### 반환 값 +#### 반환값 밀리초 단위 시간을 반환합니다. #### 예 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/standard"; +import { Datetime } from "@tai-kun/surrealdb/standard-datatypes"; const date = new Datetime(0); const time = dt.setCompact([1717245296, 780123456]); @@ -242,24 +242,24 @@ console.log(time); 현지 시간을 사용하여 날짜의 마이크로초를 가져옵니다. -`.getUTCMicroseconds()`는 이 메서드와 동일한 방식으로 동작합니다. +`.getUTCMicroseconds()`는 이 메서드와 동일하게 동작합니다. ```ts .getMicroseconds(): number; ``` -#### 인수 +#### 매개변수 없음. -#### 반환 값 +#### 반환값 마이크로초를 반환합니다. #### 예 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/standard"; +import { Datetime } from "@tai-kun/surrealdb/standard-datatypes"; const date = new Datetime([1717245296, 780123456]); console.log(date.toISOString()); @@ -276,26 +276,26 @@ console.log(date.getMicroseconds()); 마이크로초를 설정합니다. -`.setUTCMicroseconds()`는 이 메서드와 동일한 방식으로 동작합니다. +`.setUTCMicroseconds()`는 이 메서드와 동일하게 동작합니다. ```ts .setMicroseconds(us: number): number; ``` -#### 인수 +#### 매개변수 ##### `us` -설정할 마이크로초입니다. 값은 정수로 변환됩니다. 값이 0에서 999 사이가 아니면 전체 시간에 영향을 미칠 수 있습니다. +설정할 마이크로초입니다. 값은 정수로 변환됩니다. 값이 0에서 999 사이가 아니면 전체 시간에 영향을 미친다는 점에 유의하십시오. -#### 반환 값 +#### 반환값 밀리초 단위 시간을 반환합니다. #### 예 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/standard"; +import { Datetime } from "@tai-kun/surrealdb/standard-datatypes"; const date = new Datetime([1717245296, 780123456]); console.log(date.toISOString()); @@ -312,24 +312,24 @@ console.log(time); 현지 시간을 사용하여 날짜의 나노초를 가져옵니다. -`.getUTCNanoseconds()`는 이 메서드와 동일한 방식으로 동작합니다. +`.getUTCNanoseconds()`는 이 메서드와 동일하게 동작합니다. ```ts .getNanoseconds(): number; ``` -#### 인수 +#### 매개변수 없음. -#### 반환 값 +#### 반환값 나노초를 반환합니다. #### 예 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/standard"; +import { Datetime } from "@tai-kun/surrealdb/standard-datatypes"; const date = new Datetime([1717245296, 780123456]); console.log(date.toISOString()); @@ -346,26 +346,26 @@ console.log(date.getNanoseconds()); 마이크로초를 설정합니다. -`.setUTCNanoseconds()`는 이 메서드와 동일한 방식으로 동작합니다. +`.setUTCNanoseconds()`는 이 메서드와 동일하게 동작합니다. ```ts .setNanoseconds(us: number): number; ``` -#### 인수 +#### 매개변수 ##### `us` -설정할 나노초입니다. 값은 정수로 변환됩니다. 값이 0에서 999 사이가 아니면 전체 시간에 영향을 미칠 수 있습니다. +설정할 나노초입니다. 값은 정수로 변환됩니다. 값이 0에서 999 사이가 아니면 전체 시간에 영향을 미친다는 점에 유의하십시오. -#### 반환 값 +#### 반환값 밀리초 단위 시간을 반환합니다. #### 예 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/standard"; +import { Datetime } from "@tai-kun/surrealdb/standard-datatypes"; const date = new Datetime([1717245296, 780123456]); console.log(date.toISOString()); @@ -386,27 +386,27 @@ console.log(time); .clone(): this; ``` -#### 인수 +#### 매개변수 없음. -#### 반환 값 +#### 반환값 -새 `Datetime` 객체를 반환합니다. `Datetime` 클래스를 상속한 경우 해당 클래스의 인스턴스가 반환됩니다. +새로운 `Datetime` 객체를 반환합니다. `Datetime` 클래스를 상속하는 경우 해당 클래스의 인스턴스를 반환합니다. -### 개발 +### 확장 -#### `Datetime` 객체의 범용적인 판별 +#### `Datetime` 객체의 일반적인 판별 -프리셋에 의존하지 않고 값이 `Datetime` 객체인지 판별하려면 `isDatetime` 함수를 사용하는 것이 좋습니다. 이 함수는 `instanceof`를 사용하지 않으므로 검증할 값의 프리셋을 알 수 없는 경우에 유용합니다. +프리셋에 의존하지 않고 값이 `Datetime` 객체인지 판별하려면 `isDatetime` 함수를 사용하는 것이 좋습니다. 이 함수는 `instanceof`를 사용하지 않으므로 검증할 값의 프리셋이 알 수 없는 경우에 유용합니다. ```ts import { isDatetime } from "@tai-kun/surrealdb"; ``` -#### UNIX 에포크 이전의 날짜 및 시간 +#### UNIX 에포크 이전 날짜 및 시간 -SurrealDB의 `datetime` 형식은 나노초 단위까지 보관할 수 있습니다. 따라서 JavaScript에서 처리할 때는 주의해야 합니다. SurrealDB가 직렬화한 `datetime` (예: `"1969-12-31T23:59:59.999999999Z"`)을 JavaScript의 `Date.parse`에 전달하면 WebKit에서는 0밀리초가 되지만, 그 외 (Node.js, Deno, Bun, Chromium, Firefox)는 -1밀리초가 됩니다. +SurrealDB의 `datetime` 유형은 나노초 단위까지 유지할 수 있습니다. 따라서 JavaScript로 처리할 때는 주의해야 합니다. SurrealDB가 직렬화한 `datetime` 예를 들어 `"1969-12-31T23:59:59.999999999Z"`를 JavaScript의 `Date.parse`에 전달하면 WebKit에서는 0밀리초가 되지만 다른 경우(Node.js, Deno, Bun, Chromium, Firefox)에는 -1밀리초가 됩니다. WebKit: diff --git a/docs/src/content/docs/ko/v2/api/data/decimal.mdx b/docs/src/content/docs/ko/v2/api/data/decimal.mdx index e882ce00..21960783 100644 --- a/docs/src/content/docs/ko/v2/api/data/decimal.mdx +++ b/docs/src/content/docs/ko/v2/api/data/decimal.mdx @@ -1,18 +1,18 @@ --- -title: Decimal +title: 소수 slug: ko/v2/api/data/decimal --- import Badge from "~/components/ko/Badge.astro"; -`Decimal`은 임의 정밀도 실수를 표현하기 위한 클래스입니다. 프리셋이 standard인 경우 [`big.js`](https://github.com/MikeMcl/big.js)를 상속한 클래스가 됩니다. 이로 인해 `.toString()` 메서드와 같은 결과가 프리셋 간에 일치하지 않을 수 있습니다. +`Decimal`은 임의 정밀도 실수를 나타내는 클래스입니다. 프리셋이 `standard`인 경우 [`big.js`](https://github.com/MikeMcl/big.js)를 상속받은 클래스입니다. 이로 인해 `.toString()` 메서드와 같은 결과가 프리셋 간에 일치하지 않을 수 있습니다. ### 가져오기 ```ts -import { Decimal } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Decimal } from "@tai-kun/surrealdb/data-types/encodable"; -import { Decimal } from "@tai-kun/surrealdb/data-types/standard"; +import { Decimal } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Decimal } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Decimal } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -28,11 +28,11 @@ new Decimal(source: string | number | Decimal); // standard ##### `source` -문자열로 표현된 실수입니다. 프리셋이 standard인 경우 숫자도 전달할 수 있습니다. +문자열로 표현된 실수입니다. 프리셋이 `standard`인 경우 숫자도 전달할 수 있습니다. -#### 반환값 +#### 반환 값 -`new`를 통해 호출될 경우 `Decimal`은 해당 인스턴스를 반환합니다. +`new`를 통해 호출된 경우 `Decimal`은 해당 인스턴스를 반환합니다. ### `.toString()` @@ -42,13 +42,13 @@ new Decimal(source: string | number | Decimal); // standard 없음. -#### 반환값 +#### 반환 값 실수의 문자열 표현을 반환합니다. ### `.toSurql()` -`Decimal` 객체를 SurrealQL에 삽입 가능한 문자열로 변환합니다. `.toString()`과 유사하지만 `dec` 접미사를 추가하여 쿼리 파서에 문자열이 `decimal` 형식임을 알립니다. +`Decimal` 객체를 SurrealQL에 삽입할 수 있는 문자열로 변환합니다. `.toString()`과 비슷하지만 `dec` 접미사를 추가하여 쿼리 파서에 문자열이 `decimal` 형식임을 알립니다. ```ts .toSurql(): string; @@ -58,14 +58,14 @@ new Decimal(source: string | number | Decimal); // standard 없음. -#### 반환값 +#### 반환 값 `dec` 접미사가 붙은 실수를 반환합니다. #### 예 ```ts -import { Decimal } from "@tai-kun/surrealdb/data-types/encodable"; +import { Decimal } from "@tai-kun/surrealdb/encodable-datatypes"; const decimal = new Decimal("3.14"); console.log(decimal.toSurql()); @@ -84,13 +84,13 @@ console.log(decimal.toSurql()); 없음. -#### 반환값 +#### 반환 값 -새로운 `Decimal` 객체를 반환합니다. `Decimal` 클래스를 상속하는 경우 해당 클래스의 인스턴스가 반환됩니다. +새로운 `Decimal` 객체를 반환합니다. `Decimal` 클래스를 상속받은 경우 해당 클래스의 인스턴스가 반환됩니다. ### 기타 메서드 -standard 프리셋을 사용하는 경우 `Decimal` 클래스는 `big.js`의 `Big` 클래스를 상속하므로 인스턴스 메서드 및 속성은 `big.js` 문서를 참조하십시오. +`standard` 프리셋을 사용하는 경우 `Decimal` 클래스는 `big.js`의 `Big` 클래스를 상속받으므로 인스턴스 메서드와 프로퍼티는 `big.js`의 문서를 참조하십시오: [`big.js` 문서](https://mikemcl.github.io/big.js/#prototype-methods) @@ -98,7 +98,7 @@ standard 프리셋을 사용하는 경우 `Decimal` 클래스는 `big.js`의 `Bi #### `Decimal` 객체의 범용적인 판별 -프리셋에 의존하지 않고 값이 `Decimal` 객체인지 판별하려면 `isDecimal` 함수를 사용하는 것이 좋습니다. 이 함수는 `instanceof`를 사용하지 않으므로 검증할 값의 프리셋이 알려지지 않은 경우 유용합니다. +프리셋에 의존하지 않고 값이 `Decimal` 객체인지 판별하려면 `isDecimal` 함수를 사용하는 것이 좋습니다. 이 함수는 `instanceof`를 사용하지 않으므로 검증할 값의 프리셋이 알 수 없는 경우에 유용합니다. ```ts import { isDecimal } from "@tai-kun/surrealdb"; diff --git a/docs/src/content/docs/ko/v2/api/data/duration.mdx b/docs/src/content/docs/ko/v2/api/data/duration.mdx index df36f7ef..ecaaafc4 100644 --- a/docs/src/content/docs/ko/v2/api/data/duration.mdx +++ b/docs/src/content/docs/ko/v2/api/data/duration.mdx @@ -10,14 +10,14 @@ import Badge from "~/components/ko/Badge.astro"; ### 가져오기 ```ts -import { Duration } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Duration } from "@tai-kun/surrealdb/data-types/encodable"; -import { Duration } from "@tai-kun/surrealdb/data-types/standard"; +import { Duration } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Duration } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Duration } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` -새로운 `Duration` 객체를 만듭니다. +새로운 `Duration` 객체를 생성합니다. ```ts new Duration( @@ -40,9 +40,9 @@ new Duration( ##### `source` -초 단위와 나노초 단위의 쌍입니다. 프리셋이 standard인 경우 `Duration` 객체를 구성하는 데 더 많은 값을 사용할 수 있습니다. +초와 나노초 쌍입니다. 프리셋이 `standard`인 경우 더 많은 값을 `Duration` 객체로 만들 수 있습니다. -`number` 타입의 입력은 밀리초 단위로 계산됩니다. 이는 `Date` 객체 간의 차이를 `Duration` 객체로 변환하는 용도를 위해 사용됩니다: +`number` 유형의 입력은 밀리초 단위로 계산됩니다. 이는 `Date` 객체 간의 차이를 `Duration` 객체로 변환하기 위한 용도입니다. ```ts const begin = new Date("2024-06-01T12:00:00.000Z"); @@ -50,7 +50,7 @@ const end = new Date("2024-06-01T21:00:00.000Z"); new Duration(end - begin); ``` -`bigint` 타입의 입력은 나노초 단위로 계산됩니다. 이는 예를 들어 [`process.hrtime.bigint()`](https://nodejs.org/api/process.html#processhrtimebigint)에서 반환된 나노초와 같이 고정밀 시간을 `Duration` 객체로 변환하는 용도를 위해 사용됩니다: +`bigint` 유형의 입력은 나노초 단위로 계산됩니다. 이는 예를 들어 [`process.hrtime.bigint()`](https://nodejs.org/api/process.html#processhrtimebigint)에서 반환되는 나노초와 같이 고정밀 시간을 `Duration` 객체로 변환하기 위한 용도입니다. ```ts const begin = process.hrtime.bigint(); @@ -59,7 +59,7 @@ const end = process.hrtime.bigint(); new Duration(end - begin); ``` -`string` 타입의 입력은 기간의 문자열 표현이어야 합니다. 기간의 문자열 표현은 숫자와 단위의 조합으로 구성되며, 이들이 연속적으로 이어지는 형식을 의미합니다. 예를 들어 `1h4h30m20s1350ms`는 "1일 4시간 30분 21초 350밀리초"를 나타냅니다. 사용 가능한 단위는 다음과 같습니다: +`string` 유형의 입력은 기간을 나타내는 문자열 표현이어야 합니다. 기간을 나타내는 문자열 표현은 숫자와 단위를 한 쌍으로 하여 이들이 연속적으로 나열된 형식을 말합니다. 예를 들어 `1h4h30m20s1350ms`는 "1일과 4시간 30분, 21초 350밀리초"를 나타냅니다. 사용 가능한 단위는 다음과 같습니다. | 단위 | 설명 | 변환 | | --- | --- | --- | @@ -73,15 +73,15 @@ new Duration(end - begin); | `w` | 주 | `1w` -> `7d` | | `y` | 년 | `1y` -> `365d` | -`us` (`0x75`, `0x73`)는 `µs` (`0xc2`, `0xb5`, `0x73`) 또는 `μs` (`0xce`, `0xbc`, `0x73`)로도 사용할 수 있습니다(괄호 안의 16진수는 단위 문자열을 UTF-8로 인코딩한 결과입니다). +`us` (`0x75`, `0x73`)는 `µs` (`0xc2`, `0xb5`, `0x73`) 또는 `μs` (`0xce`, `0xbc`, `0x73`)로 표기할 수 있습니다(괄호 안의 16진수는 단위 문자열을 UTF-8로 인코딩한 결과입니다). #### 반환값 -`new`를 통해 호출된 경우 `Duration`은 해당 인스턴스를 반환합니다. +`new`를 통해 호출될 경우 `Duration`은 해당 인스턴스를 반환합니다. ### `.seconds` -기간의 초 단위 부분입니다. standard 미만의 프리셋에서는 읽기 전용입니다. 값은 0에서 264-1까지의 정수입니다. +기간의 초 부분입니다. `standard` 미만의 프리셋에서는 읽기 전용입니다. 값은 0에서 264-1까지의 정수입니다. ```ts .seconds: bigint; @@ -89,7 +89,7 @@ new Duration(end - begin); ### `.nanoseconds` -기간의 나노초 단위 부분입니다. standard 미만의 프리셋에서는 읽기 전용입니다. 값은 0에서 999999999까지의 정수입니다. +기간의 나노초 부분입니다. `standard` 미만의 프리셋에서는 읽기 전용입니다. 값은 0에서 999999999까지의 정수입니다. ```ts .nanoseconds: number; @@ -97,7 +97,7 @@ new Duration(end - begin); ### `.parse()` -기간을 각 단위에 매핑합니다. 각 단위의 값은 0 이상이고 해당 단위의 최대값 미만입니다. 기간이 0인 경우 0나노초, 즉 `nanoseconds` 프로퍼티만 `0`을 가진 객체가 반환됩니다. +기간을 각 단위에 매핑합니다. 각 단위의 값은 0 이상 해당 단위의 최댓값 미만입니다. 기간이 0인 경우 0 나노초, 즉 `nanoseconds` 속성만 `0`을 가진 객체를 반환합니다. ```ts .parse(): { @@ -115,16 +115,16 @@ new Duration(end - begin); #### 인수 -없음. +없습니다. #### 반환값 -기간을 각 단위에 매핑한 결과를 반환합니다. 단위의 값이 0인 경우 프로퍼티가 생략되지만 기간이 0인 경우 `nanoseconds`만 `0`을 가진 객체가 반환됩니다. +기간을 각 단위에 매핑한 결과를 반환합니다. 단위의 값이 0인 경우 속성이 생략되지만, 기간이 0인 경우 `nanoseconds`만 `0`을 가진 객체를 반환합니다. #### 예 ```ts -import { Duration } from "@tai-kun/surrealdb/data-types/encodable"; +import { Duration } from "@tai-kun/surrealdb/encodable-datatypes"; const duration = new Duration(0); console.log(duration.parse()); @@ -132,7 +132,7 @@ console.log(duration.parse()); ``` ```ts -import { Duration } from "@tai-kun/surrealdb/data-types/encodable"; +import { Duration } from "@tai-kun/surrealdb/encodable-datatypes"; const duration = new Duration(12_345_000n); console.log(duration.parse()); @@ -149,14 +149,14 @@ console.log(duration.parse()); #### 인수 -없음. +없습니다. #### 반환값 기간을 나노초 단위로 반환합니다. ```ts -import { Duration } from "@tai-kun/surrealdb/data-types/encodable"; +import { Duration } from "@tai-kun/surrealdb/encodable-datatypes"; const duration = new Duration(12_345_000n); console.log(duration.valueOf()); @@ -165,7 +165,7 @@ console.log(duration.valueOf()); ### `.toString()` -기간의 문자열 표현을 가져옵니다. +기간을 나타내는 문자열을 가져옵니다. `.toJSON()`과 `.toSurql()`은 이 메서드와 동일한 결과를 반환합니다. @@ -175,16 +175,16 @@ console.log(duration.valueOf()); #### 인수 -없음. +없습니다. #### 반환값 -밀리초 단위로 표현된 시간의 문자열 표현을 반환합니다. +밀리초 정밀도의 시간 문자열을 가져옵니다. #### 예 ```ts -import { Duration } from "@tai-kun/surrealdb/data-types/encodable"; +import { Duration } from "@tai-kun/surrealdb/encodable-datatypes"; const duration = new Duration(12_345_000n); console.log(duration.toString()); @@ -193,7 +193,7 @@ console.log(duration.toString()); ### `.toISOString()` -기간의 문자열을 ISO 형식으로 가져옵니다. +기간을 나타내는 문자열을 ISO 형식으로 가져옵니다. ```ts .toISOString(): string; @@ -201,16 +201,16 @@ console.log(duration.toString()); #### 인수 -없음. +없습니다. #### 반환값 -기간의 문자열을 ISO 형식으로 반환합니다. +기간을 나타내는 문자열을 ISO 형식으로 반환합니다. #### 예 ```ts -import { Duration } from "@tai-kun/surrealdb/data-types/encodable"; +import { Duration } from "@tai-kun/surrealdb/encodable-datatypes"; const duration = new Duration("2m3s456ms"); console.log(duration.toISOString()); @@ -219,7 +219,7 @@ console.log(duration.toISOString()); ### `.getCompact()` -초 단위와 나노초 단위의 쌍을 가져옵니다. +초와 나노초 쌍을 가져옵니다. ```ts .getCompact(): [seconds: bigint, nanoseconds: number]; @@ -227,15 +227,15 @@ console.log(duration.toISOString()); #### 인수 -없음. +없습니다. #### 반환값 -초 단위와 나노초 단위의 쌍을 반환합니다. +초와 나노초 쌍을 반환합니다. ### `.setCompact()` -초 단위와 나노초 단위의 쌍으로 날짜와 시간을 설정합니다. +초와 나노초 쌍으로 날짜와 시간을 설정합니다. ```ts .setCompact(compact: [seconds: bigint, nanoseconds: number]): void; @@ -245,15 +245,15 @@ console.log(duration.toISOString()); ##### `compact` -초 단위와 나노초 단위의 쌍입니다. +초와 나노초 쌍입니다. #### 반환값 -없음. +없습니다. ### `.getYears()` -년도를 가져옵니다. 0 이상의 정수가 아니면 0이 반환됩니다. +년을 가져옵니다. 0 이상의 정수가 아닌 경우 0을 반환합니다. ```ts .getYears(): number; @@ -261,15 +261,15 @@ console.log(duration.toISOString()); #### 인수 -없음. +없습니다. #### 반환값 -년도를 나타내는 0 이상의 정수를 반환합니다. +년을 나타내는 0 이상의 정수를 반환합니다. ### `.addYears()` -기간에 지정된 수만큼 년도를 추가합니다. +기간에서 년을 지정된 수만큼 더합니다. ```ts .addYears(value: number): void; @@ -279,15 +279,15 @@ console.log(duration.toISOString()); ##### `value` -년도입니다. +년 수입니다. #### 반환값 -없음. +없습니다. ### `.subYears()` -기간에서 지정된 수만큼 년도를 뺍니다. +기간에서 년을 지정된 수만큼 뺍니다. ```ts .subYears(value: number): void; @@ -297,15 +297,15 @@ console.log(duration.toISOString()); ##### `value` -년도입니다. +년 수입니다. #### 반환값 -없음. +없습니다. ### `.asYears()` -년도를 밀리초로 변환한 값을 가져옵니다. +년 수를 밀리초 표현으로 가져옵니다. ```ts .asYears(): number; @@ -313,15 +313,15 @@ console.log(duration.toISOString()); #### 인수 -없음. +없습니다. #### 반환값 -년도를 밀리초로 변환한 값입니다. +년 수를 밀리초 표현으로 반환합니다. ### `.getWeeks()` -주를 가져옵니다. 0 이상의 정수가 아니면 0이 반환됩니다. +주를 가져옵니다. 0 이상의 정수가 아닌 경우 0을 반환합니다. ```ts .getWeeks(): number; @@ -329,7 +329,7 @@ console.log(duration.toISOString()); #### 인수 -없음. +없습니다. #### 반환값 @@ -337,7 +337,7 @@ console.log(duration.toISOString()); ### `.addWeeks()` -기간에 지정된 수만큼 주를 추가합니다. +기간에서 주를 지정된 수만큼 더합니다. ```ts .addWeeks(value: number): void; @@ -347,15 +347,15 @@ console.log(duration.toISOString()); ##### `value` -주입니다. +주 수입니다. #### 반환값 -없음. +없습니다. ### `.subWeeks()` -기간에서 지정된 수만큼 주를 뺍니다. +기간에서 주를 지정된 수만큼 뺍니다. ```ts .subWeeks(value: number): void; @@ -365,15 +365,15 @@ console.log(duration.toISOString()); ##### `value` -주입니다. +주 수입니다. #### 반환값 -없음. +없습니다. ### `.asWeeks()` -주를 밀리초로 변환한 값을 가져옵니다. +주 수를 밀리초 표현으로 가져옵니다. ```ts .asWeeks(): number; @@ -381,15 +381,15 @@ console.log(duration.toISOString()); #### 인수 -없음. +없습니다. #### 반환값 -주를 밀리초로 변환한 값입니다. +주 수를 밀리초 표현으로 반환합니다. ### `.getDays()` -일을 가져옵니다. 0 이상의 정수가 아니면 0이 반환됩니다. +일을 가져옵니다. 0 이상의 정수가 아닌 경우 0을 반환합니다. ```ts .getDays(): number; @@ -397,7 +397,7 @@ console.log(duration.toISOString()); #### 인수 -없음. +없습니다. #### 반환값 @@ -405,7 +405,7 @@ console.log(duration.toISOString()); ### `.addDays()` -기간에 지정된 수만큼 일을 추가합니다. +기간에서 일을 지정된 수만큼 더합니다. ```ts .addDays(value: number): void; @@ -415,15 +415,15 @@ console.log(duration.toISOString()); ##### `value` -일입니다. +일 수입니다. #### 반환값 -없음. +없습니다. ### `.subDays()` -기간에서 지정된 수만큼 일을 뺍니다. +기간에서 일을 지정된 수만큼 뺍니다. ```ts .subDays(value: number): void; @@ -433,15 +433,15 @@ console.log(duration.toISOString()); ##### `value` -일입니다. +일 수입니다. #### 반환값 -없음. +없습니다. ### `.asDays()` -일을 밀리초로 변환한 값을 가져옵니다. +일 수를 밀리초 표현으로 가져옵니다. ```ts .asDays(): number; @@ -449,15 +449,15 @@ console.log(duration.toISOString()); #### 인수 -없음. +없습니다. #### 반환값 -일을 밀리초로 변환한 값입니다. +일 수를 밀리초 표현으로 반환합니다. ### `.getHours()` -시를 가져옵니다. 0 이상의 정수가 아니면 0이 반환됩니다. +시를 가져옵니다. 0 이상의 정수가 아닌 경우 0을 반환합니다. ```ts .getHours(): number; @@ -465,7 +465,7 @@ console.log(duration.toISOString()); #### 인수 -없음. +없습니다. #### 반환값 @@ -473,7 +473,7 @@ console.log(duration.toISOString()); ### `.addHours()` -기간에 지정된 수만큼 시를 추가합니다. +기간에서 시를 지정된 수만큼 더합니다. ```ts .addHours(value: number): void; @@ -483,15 +483,15 @@ console.log(duration.toISOString()); ##### `value` -시입니다. +시 수입니다. #### 반환값 -없음. +없습니다. ### `.subHours()` -기간에서 지정된 수만큼 시를 뺍니다. +기간에서 시를 지정된 수만큼 뺍니다. ```ts .subHours(value: number): void; @@ -501,15 +501,15 @@ console.log(duration.toISOString()); ##### `value` -시입니다. +시 수입니다. #### 반환값 -없음. +없습니다. ### `.asHours()` -시를 밀리초로 변환한 값을 가져옵니다. +시 수를 밀리초 표현으로 가져옵니다. ```ts .asHours(): number; @@ -517,15 +517,15 @@ console.log(duration.toISOString()); #### 인수 -없음. +없습니다. #### 반환값 -시를 밀리초로 변환한 값입니다. +시 수를 밀리초 표현으로 반환합니다. ### `.getMinutes()` -분을 가져옵니다. 0 이상의 정수가 아니면 0이 반환됩니다. +분을 가져옵니다. 0 이상의 정수가 아닌 경우 0을 반환합니다. ```ts .getMinutes(): number; @@ -533,7 +533,7 @@ console.log(duration.toISOString()); #### 인수 -없음. +없습니다. #### 반환값 @@ -541,7 +541,7 @@ console.log(duration.toISOString()); ### `.addMinutes()` -기간에 지정된 수만큼 분을 추가합니다. +기간에서 분을 지정된 수만큼 더합니다. ```ts .addMinutes(value: number): void; @@ -551,15 +551,15 @@ console.log(duration.toISOString()); ##### `value` -분입니다. +분 수입니다. #### 반환값 -없음. +없습니다. ### `.subMinutes()` -기간에서 지정된 수만큼 분을 뺍니다. +기간에서 분을 지정된 수만큼 뺍니다. ```ts .subMinutes(value: number): void; @@ -569,15 +569,15 @@ console.log(duration.toISOString()); ##### `value` -분입니다. +분 수입니다. #### 반환값 -없음. +없습니다. ### `.asMinutes()` -분을 밀리초로 변환한 값을 가져옵니다. +분 수를 밀리초 표현으로 가져옵니다. ```ts .asMinutes(): number; @@ -585,15 +585,15 @@ console.log(duration.toISOString()); #### 인수 -없음. +없습니다. #### 반환값 -분을 밀리초로 변환한 값입니다. +분 수를 밀리초 표현으로 반환합니다. ### `.getSeconds()` -초를 가져옵니다. 0 이상의 정수가 아니면 0이 반환됩니다. +초를 가져옵니다. 0 이상의 정수가 아닌 경우 0을 반환합니다. ```ts .getSeconds(): number; @@ -601,7 +601,7 @@ console.log(duration.toISOString()); #### 인수 -없음. +없습니다. #### 반환값 @@ -609,7 +609,7 @@ console.log(duration.toISOString()); ### `.addSeconds()` -기간에 지정된 수만큼 초를 추가합니다. +기간에서 초를 지정된 수만큼 더합니다. ```ts .addSeconds(value: number): void; @@ -619,15 +619,15 @@ console.log(duration.toISOString()); ##### `value` -초입니다. +초 수입니다. #### 반환값 -없음. +없습니다. ### `.subSeconds()` -기간에서 지정된 수만큼 초를 뺍니다. +기간에서 초를 지정된 수만큼 뺍니다. ```ts .subSeconds(value: number): void; @@ -637,15 +637,15 @@ console.log(duration.toISOString()); ##### `value` -초입니다. +초 수입니다. #### 반환값 -없음. +없습니다. ### `.asSeconds()` -초를 밀리초로 변환한 값을 가져옵니다. +초 수를 밀리초 표현으로 가져옵니다. ```ts .asSeconds(): number; @@ -653,15 +653,15 @@ console.log(duration.toISOString()); #### 인수 -없음. +없습니다. #### 반환값 -초를 밀리초로 변환한 값입니다. +초 수를 밀리초 표현으로 반환합니다. ### `.getMilliseconds()` -밀리초를 가져옵니다. 0 이상의 정수가 아니면 0이 반환됩니다. +밀리초를 가져옵니다. 0 이상의 정수가 아닌 경우 0을 반환합니다. ```ts .getMilliseconds(): number; @@ -669,7 +669,7 @@ console.log(duration.toISOString()); #### 인수 -없음. +없습니다. #### 반환값 @@ -677,7 +677,7 @@ console.log(duration.toISOString()); ### `.addMilliseconds()` -기간에 지정된 수만큼 밀리초를 추가합니다. +기간에서 밀리초를 지정된 수만큼 더합니다. ```ts .addMilliseconds(value: number): void; @@ -687,15 +687,15 @@ console.log(duration.toISOString()); ##### `value` -밀리초입니다. +밀리초 수입니다. #### 반환값 -없음. +없습니다. ### `.subMilliseconds()` -기간에서 지정된 수만큼 밀리초를 뺍니다. +기간에서 밀리초를 지정된 수만큼 뺍니다. ```ts .subMilliseconds(value: number): void; @@ -705,15 +705,15 @@ console.log(duration.toISOString()); ##### `value` -밀리초입니다. +밀리초 수입니다. #### 반환값 -없음. +없습니다. ### `.asMilliseconds()` -밀리초를 밀리초로 변환한 값을 가져옵니다. +밀리초 수를 밀리초 표현으로 가져옵니다. ```ts .asMilliseconds(): number; @@ -721,15 +721,15 @@ console.log(duration.toISOString()); #### 인수 -없음. +없습니다. #### 반환값 -밀리초를 밀리초로 변환한 값입니다. +밀리초 수를 밀리초 표현으로 반환합니다. ### `.getMicroseconds()` -마이크로초를 가져옵니다. 0 이상의 정수가 아니면 0이 반환됩니다. +마이크로초를 가져옵니다. 0 이상의 정수가 아닌 경우 0을 반환합니다. ```ts .getMicroseconds(): number; @@ -737,7 +737,7 @@ console.log(duration.toISOString()); #### 인수 -없음. +없습니다. #### 반환값 @@ -745,7 +745,7 @@ console.log(duration.toISOString()); ### `.addMicroseconds()` -기간에 지정된 수만큼 마이크로초를 추가합니다. +기간에서 마이크로초를 지정된 수만큼 더합니다. ```ts .addMicroseconds(value: number): void; @@ -755,15 +755,15 @@ console.log(duration.toISOString()); ##### `value` -마이크로초입니다. +마이크로초 수입니다. #### 반환값 -없음. +없습니다. ### `.subMicroseconds()` -기간에서 지정된 수만큼 마이크로초를 뺍니다. +기간에서 마이크로초를 지정된 수만큼 뺍니다. ```ts .subMicroseconds(value: number): void; @@ -773,15 +773,15 @@ console.log(duration.toISOString()); ##### `value` -마이크로초입니다. +마이크로초 수입니다. #### 반환값 -없음. +없습니다. ### `.asMicroseconds()` -마이크로초를 밀리초로 변환한 값을 가져옵니다. +마이크로초 수를 밀리초 표현으로 가져옵니다. ```ts .asMicroseconds(): number; @@ -789,15 +789,15 @@ console.log(duration.toISOString()); #### 인수 -없음. +없습니다. #### 반환값 -마이크로초를 밀리초로 변환한 값입니다. +마이크로초 수를 밀리초 표현으로 반환합니다. ### `.getNanoseconds()` -나노초를 가져옵니다. 0 이상의 정수가 아니면 0이 반환됩니다. +나노초를 가져옵니다. 0 이상의 정수가 아닌 경우 0을 반환합니다. ```ts .getNanoseconds(): number; @@ -805,7 +805,7 @@ console.log(duration.toISOString()); #### 인수 -없음. +없습니다. #### 반환값 @@ -813,7 +813,7 @@ console.log(duration.toISOString()); ### `.addNanoseconds()` -기간에 지정된 수만큼 나노초를 추가합니다. +기간에서 나노초를 지정된 수만큼 더합니다. ```ts .addNanoseconds(value: number): void; @@ -823,15 +823,15 @@ console.log(duration.toISOString()); ##### `value` -나노초입니다. +나노초 수입니다. #### 반환값 -없음. +없습니다. ### `.subNanoseconds()` -기간에서 지정된 수만큼 나노초를 뺍니다. +기간에서 나노초를 지정된 수만큼 뺍니다. ```ts .subNanoseconds(value: number): void; @@ -841,15 +841,15 @@ console.log(duration.toISOString()); ##### `value` -나노초입니다. +나노초 수입니다. #### 반환값 -없음. +없습니다. ### `.asNanoseconds()` -나노초를 밀리초로 변환한 값을 가져옵니다. +나노초 수를 밀리초 표현으로 가져옵니다. ```ts .asNanoseconds(): number; @@ -857,8 +857,8 @@ console.log(duration.toISOString()); #### 인수 -없음. +없습니다. #### 반환값 -나노초를 밀리초로 변환한 값입니다. +나노초 수를 밀리초 표현으로 반환합니다. diff --git a/docs/src/content/docs/ko/v2/api/data/future.mdx b/docs/src/content/docs/ko/v2/api/data/future.mdx index 2eba7c3a..334e9f2c 100644 --- a/docs/src/content/docs/ko/v2/api/data/future.mdx +++ b/docs/src/content/docs/ko/v2/api/data/future.mdx @@ -1,25 +1,25 @@ --- -title: 퓨처 +title: Future slug: ko/v2/api/data/future banner: - content: 이 기능은 실험적인 기능입니다. + content: 이것은 실험적인 기능입니다. --- import Badge from "~/components/ko/Badge.astro"; -`Future`는 SurrealDB의 [퓨처 기능](https://surrealdb.com/docs/surrealql/datamodel/futures)을 나타내는 클래스입니다. +`Future`는 SurrealDB의 [Futures 기능](https://surrealdb.com/docs/surrealql/datamodel/futures)을 나타내는 클래스입니다. -### 임포트 +### 가져오기 ```ts -import { Future } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Future } from "@tai-kun/surrealdb/data-types/encodable"; -import { Future } from "@tai-kun/surrealdb/data-types/standard"; +import { Future } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Future } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Future } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` -새로운 `Future` 객체를 만듭니다. +새로운 `Future` 객체를 생성합니다. ```ts new Future(source: string); @@ -29,15 +29,15 @@ new Future(source: string); ##### `source` -퓨처 블록 내의 값이나 식입니다. +future 블록 내의 값이나 식입니다. -#### 반환 값 +#### 반환값 -`new`를 통해 호출된 경우 `Future`는 인스턴스를 반환합니다. +`new`를 통해 호출될 경우, `Future`는 해당 인스턴스를 반환합니다. ### `.block` -퓨처 블록 내의 값이나 식입니다. +future 블록 내의 값이나 식입니다. ```ts .block: number; @@ -55,14 +55,14 @@ new Future(source: string); 없음. -#### 반환 값 +#### 반환값 -퓨처 블록 내의 값이나 식을 반환합니다. +future 블록 내의 값이나 식을 반환합니다. -#### 예시 +#### 예 ```ts -import { Future } from "@tai-kun/surrealdb/data-types/encodable"; +import { Future } from "@tai-kun/surrealdb/encodable-datatypes"; const future = new Future(`time::now()`); console.log(future.toString()); @@ -71,7 +71,7 @@ console.log(future.toString()); ### `.toSurql()` -`Future` 객체를 SurrealQL에 삽입 가능한 문자열로 변환합니다. `.toString()`과 유사하지만 블록은 중괄호(`{}`)로 둘러싸여 있으며 ``로 캐스팅됩니다. +`Future` 객체를 SurrealQL에 삽입 가능한 문자열로 변환합니다. `.toString()`과 유사하지만, 블록은 중괄호(`{}`)로 둘러싸이고 ``로 캐스팅됩니다. ```ts .toSurql(): string; @@ -81,14 +81,14 @@ console.log(future.toString()); 없음. -#### 반환 값 +#### 반환값 -SurrealQL에 삽입 가능한 퓨처를 반환합니다. +SurrealQL에 삽입 가능한 future를 반환합니다. -#### 예시 +#### 예 ```ts -import { Future } from "@tai-kun/surrealdb/data-types/encodable"; +import { Future } from "@tai-kun/surrealdb/encodable-datatypes"; const future = new Future(`time::now()`); console.log(future.toSurql()); @@ -97,7 +97,7 @@ console.log(future.toSurql()); ### `.surql()` -이 메서드는 SurrealQL 작성을 돕습니다. 템플릿 리터럴을 사용하여 SurrealQL을 작성할 수 있습니다. 템플릿 리터럴에 삽입된 값은 자동으로 SurrealQL로 변환됩니다. 또한 VSCode에서 [SurrealDB 공식 확장 기능](https://marketplace.visualstudio.com/items?itemName=surrealdb.surrealql)을 설치한 경우 템플릿 리터럴의 구문 강조 표시가 활성화됩니다. +이 메서드는 SurrealQL 작성을 돕습니다. 템플릿 리터럴을 사용하여 SurrealQL을 작성할 수 있습니다. 템플릿 리터럴에 포함된 값은 자동으로 SurrealQL로 변환됩니다. 또한 VSCode에서 [SurrealDB 공식 확장 기능](https://marketplace.visualstudio.com/items?itemName=surrealdb.surrealql)을 설치한 경우, 템플릿 리터럴의 구문 강조가 활성화됩니다. ```ts .surql(texts: TemplateStringsArray, ...values: unknown[]): string; @@ -107,20 +107,20 @@ console.log(future.toSurql()); ##### `texts` -템플릿 리터럴을 구성하는 문자열의 배열입니다. +템플릿 리터럴을 구성하는 문자열 배열입니다. ##### `values` `texts`의 각 요소 사이에 삽입할 값입니다. -#### 반환 값 +#### 반환값 SurrealQL입니다. -#### 예시 +#### 예 ```ts -import { Future, Thing } from "@tai-kun/surrealdb/data-types/standard"; +import { Future, Thing } from "@tai-kun/surrealdb/standard-datatypes"; const foo = "foo"; const rid = new Thing("person", "tai-kun"); @@ -137,10 +137,10 @@ console.log(future.toSurql()); //-> } ``` -위의 예시를 `.surql()`을 사용하지 않으면 다음과 같습니다. +위 예를 `.surql()`을 사용하지 않으면: ```ts -import { Future, Thing } from "@tai-kun/surrealdb/data-types/standard"; +import { Future, Thing } from "@tai-kun/surrealdb/standard-datatypes"; import { toSurql } from "@tai-kun/surrealdb/utils"; const foo = "foo"; @@ -165,7 +165,7 @@ console.log(future.toSurql()); #### `Future` 객체의 범용적인 판별 -프리셋에 의존하지 않고 값이 `Future` 객체인지 판별하려면 `isFuture` 함수를 사용하는 것이 좋습니다. 이 함수는 `instanceof`를 사용하지 않기 때문에 검증할 값의 프리셋이 알 수 없는 경우 유용합니다. +프리셋에 의존하지 않고 값이 `Future` 객체인지 판별하려면 `isFuture` 함수를 사용하는 것을 권장합니다. 이 함수는 `instanceof`를 사용하지 않으므로, 검증할 값의 프리셋이 불분명한 경우 유용합니다. ```ts import { isFuture } from "@tai-kun/surrealdb"; diff --git a/docs/src/content/docs/ko/v2/api/data/geometry-collection.mdx b/docs/src/content/docs/ko/v2/api/data/geometry-collection.mdx index 043b07d9..03ad15c4 100644 --- a/docs/src/content/docs/ko/v2/api/data/geometry-collection.mdx +++ b/docs/src/content/docs/ko/v2/api/data/geometry-collection.mdx @@ -10,14 +10,14 @@ import Badge from "~/components/ko/Badge.astro"; ### 가져오기 ```ts -import { GeometryCollection } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryCollection } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryCollection } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryCollection } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryCollection } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryCollection } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` -새로운 `GeometryCollection` 객체를 생성합니다. +새로운 `GeometryCollection` 객체를 만듭니다. ```ts new GeometryCollection(source); @@ -31,4 +31,4 @@ new GeometryCollection(source); #### 반환 값 -`new`를 통해 호출될 때 `GeometryCollection`은 해당 인스턴스를 반환합니다. +`new`를 통해 호출될 경우 `GeometryCollection`은 해당 인스턴스를 반환합니다. diff --git a/docs/src/content/docs/ko/v2/api/data/geometry-line.mdx b/docs/src/content/docs/ko/v2/api/data/geometry-line.mdx index 9fc35069..14e411df 100644 --- a/docs/src/content/docs/ko/v2/api/data/geometry-line.mdx +++ b/docs/src/content/docs/ko/v2/api/data/geometry-line.mdx @@ -7,17 +7,17 @@ import Badge from "~/components/ko/Badge.astro"; 편집 중입니다. -### 임포트 +### 가져오기 ```ts -import { GeometryLine } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryLine } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryLine } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryLine } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryLine } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryLine } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` -새로운 `GeometryLine` 객체를 만듭니다. +새로운 `GeometryLine` 객체를 생성합니다. ```ts new GeometryLine(source); @@ -29,6 +29,6 @@ new GeometryLine(source); 편집 중입니다. -#### 반환 값 +#### 반환값 -`new`를 통해 호출될 경우 `GeometryLine`은 해당 인스턴스를 반환합니다. +`new` 를 통해 호출될 때, `GeometryLine` 은 해당 인스턴스를 반환합니다. diff --git a/docs/src/content/docs/ko/v2/api/data/geometry-multi-line.mdx b/docs/src/content/docs/ko/v2/api/data/geometry-multi-line.mdx index 2c43f421..c4ff2aa3 100644 --- a/docs/src/content/docs/ko/v2/api/data/geometry-multi-line.mdx +++ b/docs/src/content/docs/ko/v2/api/data/geometry-multi-line.mdx @@ -10,14 +10,14 @@ import Badge from "~/components/ko/Badge.astro"; ### 가져오기 ```ts -import { GeometryMultiLine } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryMultiLine } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryMultiLine } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryMultiLine } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryMultiLine } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryMultiLine } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` -새로운 `GeometryMultiLine` 객체를 만듭니다. +새로운 `GeometryMultiLine` 객체를 생성합니다. ```ts new GeometryMultiLine(source); @@ -31,4 +31,4 @@ new GeometryMultiLine(source); #### 반환 값 -`new`를 통해 호출될 때, `GeometryMultiLine`은 해당 인스턴스를 반환합니다. +`new` 를 통해 호출하면 `GeometryMultiLine` 은 해당 인스턴스를 반환합니다. diff --git a/docs/src/content/docs/ko/v2/api/data/geometry-multi-point.mdx b/docs/src/content/docs/ko/v2/api/data/geometry-multi-point.mdx index 0c6892b9..979159f3 100644 --- a/docs/src/content/docs/ko/v2/api/data/geometry-multi-point.mdx +++ b/docs/src/content/docs/ko/v2/api/data/geometry-multi-point.mdx @@ -10,9 +10,9 @@ import Badge from "~/components/ko/Badge.astro"; ### 가져오기 ```ts -import { GeometryMultiPoint } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryMultiPoint } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryMultiPoint } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryMultiPoint } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryMultiPoint } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryMultiPoint } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -31,4 +31,4 @@ new GeometryMultiPoint(source); #### 반환 값 -`new`를 통해 호출된 경우 `GeometryMultiPoint`는 해당 인스턴스를 반환합니다. +`new`를 통해 호출될 경우, `GeometryMultiPoint`는 해당 인스턴스를 반환합니다. diff --git a/docs/src/content/docs/ko/v2/api/data/geometry-multi-polygon.mdx b/docs/src/content/docs/ko/v2/api/data/geometry-multi-polygon.mdx index 31b1c603..716863ce 100644 --- a/docs/src/content/docs/ko/v2/api/data/geometry-multi-polygon.mdx +++ b/docs/src/content/docs/ko/v2/api/data/geometry-multi-polygon.mdx @@ -10,9 +10,9 @@ import Badge from "~/components/ko/Badge.astro"; ### 가져오기 ```ts -import { GeometryMultiPolygon } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryMultiPolygon } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryMultiPolygon } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryMultiPolygon } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryMultiPolygon } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryMultiPolygon } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -31,4 +31,4 @@ new GeometryMultiPolygon(source); #### 반환 값 -`new`를 통해 호출될 경우 `GeometryMultiPolygon`은 해당 인스턴스를 반환합니다. +`new`를 통해 호출된 경우, `GeometryMultiPolygon`은 해당 인스턴스를 반환합니다. diff --git a/docs/src/content/docs/ko/v2/api/data/geometry-point.mdx b/docs/src/content/docs/ko/v2/api/data/geometry-point.mdx index 0509ee38..1a7ff854 100644 --- a/docs/src/content/docs/ko/v2/api/data/geometry-point.mdx +++ b/docs/src/content/docs/ko/v2/api/data/geometry-point.mdx @@ -10,9 +10,9 @@ import Badge from "~/components/ko/Badge.astro"; ### 가져오기 ```ts -import { GeometryPoint } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryPoint } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryPoint } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryPoint } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryPoint } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryPoint } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -29,6 +29,6 @@ new GeometryPoint(source); 편집 중입니다. -#### 반환값 +#### 반환 값 -`new`를 통해 호출된 경우 `GeometryPoint`는 해당 인스턴스를 반환합니다. +`new`를 통해 호출된 경우, `GeometryPoint`는 해당 인스턴스를 반환합니다. diff --git a/docs/src/content/docs/ko/v2/api/data/geometry-polygon.mdx b/docs/src/content/docs/ko/v2/api/data/geometry-polygon.mdx index 5c159210..ae99091c 100644 --- a/docs/src/content/docs/ko/v2/api/data/geometry-polygon.mdx +++ b/docs/src/content/docs/ko/v2/api/data/geometry-polygon.mdx @@ -10,9 +10,9 @@ import Badge from "~/components/ko/Badge.astro"; ### 가져오기 ```ts -import { GeometryPolygon } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryPolygon } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryPolygon } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryPolygon } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryPolygon } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryPolygon } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -31,4 +31,4 @@ new GeometryPolygon(source); #### 반환 값 -`new`를 통해 호출하면 `GeometryPolygon`은 해당 인스턴스를 반환합니다. +`new`를 통해 호출된 경우 `GeometryPolygon`은 해당 인스턴스를 반환합니다. diff --git a/docs/src/content/docs/ko/v2/api/data/range.mdx b/docs/src/content/docs/ko/v2/api/data/range.mdx index b8b2f104..022ad94a 100644 --- a/docs/src/content/docs/ko/v2/api/data/range.mdx +++ b/docs/src/content/docs/ko/v2/api/data/range.mdx @@ -2,7 +2,7 @@ title: 범위 slug: ko/v2/api/data/range banner: - content: 이 기능은 실험적인 기능입니다. + content: 이 기능은 실험적입니다. --- import Badge from "~/components/ko/Badge.astro"; @@ -12,9 +12,9 @@ import Badge from "~/components/ko/Badge.astro"; ### 가져오기 ```ts -import { Range } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Range } from "@tai-kun/surrealdb/data-types/encodable"; -import { Range } from "@tai-kun/surrealdb/data-types/standard"; +import { Range } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Range } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Range } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -60,7 +60,7 @@ new Range( `Range` 객체를 SurrealQL에서 사용 가능한 문자열로 변환합니다. -`.toJSON()`과 `.toSurql()`은 이 메서드와 동일한 결과를 반환합니다. +`.toJSON()`과 `.toSurql()`은 이 메소드와 동일한 결과를 반환합니다. ```ts .toString(): string; @@ -74,14 +74,14 @@ new Range( 범위의 문자열 표현을 반환합니다. -#### 예시 +#### 예 ```ts import { Range, BoundIncluded, BoundExcluded, -} from "@tai-kun/surrealdb/data-types/encodable"; +} from "@tai-kun/surrealdb/encodable-datatypes"; const range = new Range([new BoundIncluded(1), new BoundIncluded(3)]); console.log(range.toString()); @@ -120,11 +120,11 @@ console.log(range.toString()); // -> .. ``` -### 발전 +### 추가 정보 -#### `Range` 객체의 범용적인 판단 +#### `Range` 객체의 일반적인 판별 -프리셋에 의존하지 않고 값이 `Range` 객체인지 판단하려면 `isRange` 함수를 사용하는 것이 좋습니다. 이 함수는 `instanceof`를 사용하지 않으므로, 검증할 값의 프리셋이 불명확한 경우에 유용합니다. +사전 설정에 의존하지 않고 값이 `Range` 객체인지 판별하려면 `isRange` 함수를 사용하는 것이 좋습니다. 이 함수는 `instanceof`를 사용하지 않으므로 검증할 값의 사전 설정이 알 수 없는 경우 유용합니다. ```ts import { isRange } from "@tai-kun/surrealdb"; diff --git a/docs/src/content/docs/ko/v2/api/data/table.mdx b/docs/src/content/docs/ko/v2/api/data/table.mdx index 2632bb01..a4c191d4 100644 --- a/docs/src/content/docs/ko/v2/api/data/table.mdx +++ b/docs/src/content/docs/ko/v2/api/data/table.mdx @@ -5,14 +5,14 @@ slug: ko/v2/api/data/table import Badge from "~/components/ko/Badge.astro"; -`Table`은 레코드 ID의 테이블 이름을 명시하는 클래스입니다. +`Table`은 레코드 ID의 테이블 이름을 명시적으로 표현하는 클래스입니다. -### 가져오기 +### 임포트 ```ts -import { Table } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Table } from "@tai-kun/surrealdb/data-types/encodable"; -import { Table } from "@tai-kun/surrealdb/data-types/standard"; +import { Table } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Table } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Table } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -30,13 +30,13 @@ new Table(source: string | { name: string }); // standard 테이블 이름 또는 `Table` 객체입니다. 프리셋이 standard 미만이면 테이블 이름만 전달할 수 있습니다. -#### 반환 값 +#### 반환값 `new`를 통해 호출된 경우 `Table`은 해당 인스턴스를 반환합니다. ### `.name` -테이블 이름입니다. 이 속성을 가져올 때 문자열은 이스케이프되지 않습니다. +테이블 이름입니다. 이 프로퍼티를 가져올 경우 문자열은 이스케이프되지 않습니다. ```ts .name: string; @@ -44,10 +44,10 @@ new Table(source: string | { name: string }); // standard #### 예시 -이 속성을 가져올 때 문자열은 이스케이프되지 않습니다. +이 프로퍼티를 가져올 경우 문자열은 이스케이프되지 않습니다. ```ts -import { Table } from "@tai-kun/surrealdb/data-types/decode-only"; +import { Table } from "@tai-kun/surrealdb/decodeonly-datatypes"; const table = new Table("foo-bar"); console.log(table.name); @@ -56,9 +56,9 @@ console.log(table.name); ### `.toString()` -`Table` 객체를 SurrealQL의 변수로 사용할 수 있는 문자열로 변환합니다. +`Table` 객체를 SurrealQL 변수에서 사용 가능한 문자열로 변환합니다. -`.valueOf()`와 `.toJSON()`은 이 메서드와 동일한 결과를 반환합니다. +`.valueOf()` 및 `.toJSON()`은 이 메서드와 동일한 결과를 반환합니다. ```ts .toString(): string; @@ -68,14 +68,14 @@ console.log(table.name); 없음. -#### 반환 값 +#### 반환값 테이블 이름을 반환합니다. #### 예시 ```ts -import { Table } from "@tai-kun/surrealdb/data-types/encodable"; +import { Table } from "@tai-kun/surrealdb/encodable-datatypes"; const table = new Table("foo-bar"); console.log(table.toString()); @@ -94,14 +94,14 @@ console.log(table.toString()); 없음. -#### 반환 값 +#### 반환값 테이블 이름에 이스케이프된 문자열을 반환합니다. #### 예시 ```ts -import { Table } from "@tai-kun/surrealdb/data-types/encodable"; +import { Table } from "@tai-kun/surrealdb/encodable-datatypes"; const table = new Table("foo-bar"); console.log(table.toSurql()); @@ -120,18 +120,18 @@ console.log(table.toSurql()); 없음. -#### 반환 값 +#### 반환값 -새로운 `Table` 객체를 반환합니다. `Table` 클래스를 상속하는 경우 해당 클래스의 인스턴스가 반환됩니다. +새로운 `Table` 객체를 반환합니다. `Table` 클래스를 상속하는 경우 해당 클래스의 인스턴스를 반환합니다. -### 발전 +### 심화 #### 형식 보호 `Table`의 테이블 이름을 형식 매개변수를 사용하여 형식 안전하게 만들 수 있습니다. ```ts -import { Table } from "@tai-kun/surrealdb/data-types/standard"; +import { Table } from "@tai-kun/surrealdb/standard-datatypes"; function isUserTable(table: unknown): table is Table<"user"> { return table instanceof Table @@ -141,7 +141,7 @@ function isUserTable(table: unknown): table is Table<"user"> { #### `Table` 객체의 범용적인 판정 -프리셋에 의존하지 않고 값이 `Table` 객체인지 판단하려면 `isTable` 함수를 사용하는 것이 좋습니다. 이 함수는 `instanceof`를 사용하지 않으므로 검증할 값의 프리셋이 알 수 없는 경우 유용합니다. +프리셋에 의존하지 않고 값이 `Table` 객체인지 판단하려면 `isTable` 함수를 사용하는 것이 좋습니다. 이 함수는 `instanceof`를 사용하지 않으므로 검증할 값의 프리셋이 불명확한 경우에 유용합니다. ```ts import { isTable } from "@tai-kun/surrealdb"; diff --git a/docs/src/content/docs/ko/v2/api/data/thing.mdx b/docs/src/content/docs/ko/v2/api/data/thing.mdx index 57877f53..9e2a7c05 100644 --- a/docs/src/content/docs/ko/v2/api/data/thing.mdx +++ b/docs/src/content/docs/ko/v2/api/data/thing.mdx @@ -5,14 +5,14 @@ slug: ko/v2/api/data/thing import Badge from "~/components/ko/Badge.astro"; -`Thing`은 [레코드 ID](https://surrealdb.com/docs/surrealql/datamodel/ids)를 표현하기 위한 클래스입니다. +`Thing`는 [레코드 ID](https://surrealdb.com/docs/surrealql/datamodel/ids)를 표현하기 위한 클래스입니다. ### 가져오기 ```ts -import { Thing } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Thing } from "@tai-kun/surrealdb/data-types/encodable"; -import { Thing } from "@tai-kun/surrealdb/data-types/standard"; +import { Thing } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Thing } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Thing } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -28,7 +28,7 @@ new Thing(table: string, id: string | number | bigint | object); ##### `source` -레코드 ID의 테이블 부분과 ID 부분의 쌍입니다. +레코드 ID의 테이블 부분과 ID 부분을 쌍으로 나타냅니다. ##### `table` @@ -40,22 +40,22 @@ new Thing(table: string, id: string | number | bigint | object); #### 반환 값 -`new`를 통해 호출되는 경우 `Thing`은 해당 인스턴스를 반환합니다. +`new`를 통해 호출할 경우 `Thing`은 해당 인스턴스를 반환합니다. ### `.table` -레코드 ID의 테이블 부분입니다. 이 프로퍼티를 가져올 때 문자열은 이스케이프되지 않습니다. +레코드 ID의 테이블 부분입니다. 이 프로퍼티를 가져올 경우 문자열은 이스케이프되지 않습니다. ```ts .table: string; ``` -#### 예 +#### 예제 -이 프로퍼티를 가져올 때 문자열은 이스케이프되지 않습니다. +이 프로퍼티를 가져올 경우 문자열은 이스케이프되지 않습니다. ```ts -import { Thing } from "@tai-kun/surrealdb/data-types/decode-only"; +import { Thing } from "@tai-kun/surrealdb/decodeonly-datatypes"; const thing = new Thing("foo-bar", 0); console.log(this.id); @@ -72,7 +72,7 @@ console.log(this.id); ### `.toString()` -`Thing` 객체를 SurrealQL의 변수로 사용할 수 있는 문자열로 변환합니다. 테이블 이름과 ID 부분은 각각 SurrealDB 구현과 동일하게 이스케이프되고 포맷됩니다. 또한 객체의 프로퍼티는 오름차순으로 정렬됩니다. +`Thing` 객체를 SurrealQL에서 사용할 수 있는 문자열로 변환합니다. 테이블 이름과 ID 부분은 각각 SurrealDB 구현과 동일하게 이스케이프 및 포맷됩니다. 또한 객체의 프로퍼티는 오름차순으로 정렬됩니다. `.valueOf()`와 `.toJSON()`은 이 메서드와 동일한 결과를 반환합니다. @@ -88,10 +88,10 @@ console.log(this.id); 레코드 ID로 포맷된 문자열을 반환합니다. -#### 예 +#### 예제 ```ts -import { Thing } from "@tai-kun/surrealdb/data-types/encodable"; +import { Thing } from "@tai-kun/surrealdb/encodable-datatypes"; const thing = new Thing([ "foo-bar", @@ -103,7 +103,7 @@ console.log(thing.toString()); ### `.toSurql()` -`Thing` 객체를 SurrealQL에 삽입할 수 있는 문자열로 변환합니다. `.toString()`과 비슷하지만 `r` 접두사를 추가하여 쿼리 파서에 문자열이 레코드 ID임을 알립니다. +`Thing` 객체를 SurrealQL에 삽입 가능한 문자열로 변환합니다. `.toString()`과 유사하지만, `r` 접두사를 추가하여 쿼리 파서에 문자열이 레코드 ID임을 알립니다. ```ts .toSurql(): string; @@ -117,10 +117,10 @@ console.log(thing.toString()); 레코드 ID로 포맷된 문자열을 반환합니다. -#### 예 +#### 예제 ```ts -import { Thing } from "@tai-kun/surrealdb/data-types/encodable"; +import { Thing } from "@tai-kun/surrealdb/encodable-datatypes"; const thing = new Thing("foo", "bar"); console.log(thing.toSurql()); @@ -129,7 +129,7 @@ console.log(thing.toSurql()); ### `.clone()` -`Thing` 객체를 복제합니다. 단 ID 부분은 복제되지 않고 참조됩니다. +`Thing` 객체를 복제합니다. 하지만 ID 부분은 복제되지 않고 참조됩니다. ```ts .clone(): this; @@ -141,16 +141,16 @@ console.log(thing.toSurql()); #### 반환 값 -새로운 `Thing` 객체를 반환합니다. `Thing` 클래스를 상속하고 있는 경우 해당 클래스의 인스턴스를 반환합니다. +새로운 `Thing` 객체를 반환합니다. `Thing` 클래스를 상속하는 경우 해당 클래스의 인스턴스를 반환합니다. -### 개발 +### 발전 -#### 타입 가드 +#### 형식 보호 -`Thing`의 테이블 부분과 ID 부분을 각각 타입 매개변수를 사용하여 타입 안전하게 할 수 있습니다: +`Thing`의 테이블 부분과 ID 부분을 각각 형식 매개변수를 사용하여 형식 안전하게 만들 수 있습니다: ```ts -import { Thing, Uuid } from "@tai-kun/surrealdb/data-types/standard"; +import { Thing, Uuid } from "@tai-kun/surrealdb/standard-datatypes"; function isUserRecordId(thing: unknown): thing is Thing<"user", Uuid> { return thing instanceof Thing @@ -159,9 +159,9 @@ function isUserRecordId(thing: unknown): thing is Thing<"user", Uuid> { } ``` -#### `Thing` 객체의 범용적인 판단 +#### `Thing` 객체의 일반적인 판별 -프리셋에 의존하지 않고 값이 `Thing` 객체인지 판단하려면 `isThing` 함수를 사용하는 것이 좋습니다. 이 함수는 `instanceof`를 사용하지 않으므로 검증할 값의 프리셋이 불명확한 경우에 유용합니다. +프리셋에 의존하지 않고 값이 `Thing` 객체인지 판별하려면 `isThing` 함수를 사용하는 것이 좋습니다. 이 함수는 `instanceof`를 사용하지 않으므로, 검증할 값의 프리셋이 불분명할 때 유용합니다. ```ts import { isThing } from "@tai-kun/surrealdb"; diff --git a/docs/src/content/docs/ko/v2/api/data/uuid.mdx b/docs/src/content/docs/ko/v2/api/data/uuid.mdx index b7c8e45d..0338178b 100644 --- a/docs/src/content/docs/ko/v2/api/data/uuid.mdx +++ b/docs/src/content/docs/ko/v2/api/data/uuid.mdx @@ -5,14 +5,14 @@ slug: ko/v2/api/data/uuid import Badge from "~/components/ko/Badge.astro"; -UUID(Universally Unique Identifier)는 특정 엔티티를 고유하게 식별하기 위해 사용되는 128비트 식별자입니다. `Uuid`는 이를 표현하기 위한 클래스입니다. UUID v1부터 v7까지 지원합니다. UUID를 생성하려면 별도의 라이브러리 또는 런타임에 내장된 기능(`node:crypto` 등)을 사용해야 합니다. +UUID(Universally Unique Identifier)는 특정 엔터티를 고유하게 식별하는 데 사용되는 128비트 식별자입니다. `Uuid`는 이를 표현하기 위한 클래스입니다. UUID v1부터 v7까지 지원합니다. UUID를 생성하려면 별도의 라이브러리 또는 런타임에 내장된 기능(`node:crypto` 등)을 사용해야 합니다. -### 임포트 +### 가져오기 ```ts -import { Uuid } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Uuid } from "@tai-kun/surrealdb/data-types/encodable"; -import { Uuid } from "@tai-kun/surrealdb/data-types/standard"; +import { Uuid } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Uuid } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Uuid } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -28,11 +28,11 @@ new Uuid(source: Uint8Array | string); // standard ##### `source` -UUID의 바이트 배열 표현 또는 standard 프리셋이라면 문자열입니다. +UUID의 바이트 배열 표현 또는 standard 프리셋이면 문자열입니다. #### 반환 값 -`new`를 통해 호출될 경우 `Uuid`는 해당 인스턴스를 반환합니다. +`new`를 통해 호출된 경우 `Uuid`는 해당 인스턴스를 반환합니다. ### `.bytes` @@ -44,7 +44,7 @@ UUID의 바이트 배열입니다. ### `.variant` -UUID의 변형입니다. 이는 UUID의 13번째 비트의 상위 비트로 정의되며, 다음의 3가지 주요 변형과 미래를 위해 예약된 1가지 변형이 있습니다. +UUID의 변형입니다. 이는 UUID의 13번째 비트의 상위 비트로 정의되며, 다음과 같은 3가지 주요 변형과 미래를 위한 예약된 변형이 하나 있습니다. 1. NCS 호환 - `0b0xxx` @@ -52,15 +52,15 @@ UUID의 변형입니다. 이는 UUID의 13번째 비트의 상위 비트로 정 - 일반적으로 사용되지 않습니다. 2. RFC 4122 호환 - `0b10xx` - - RFC 4122(UUID 표준 사양) 기반 UUID입니다. - - 일반적으로 사용되는 UUID 형식입니다. v1(시간 기반) 및 v4(랜덤)과 같은 형식이 포함됩니다. + - RFC 4122(UUID 표준 사양)에 따른 UUID입니다. + - 일반적으로 사용되는 UUID 형식입니다. v1(시간 기반) 또는 v4(랜덤)와 같은 형식이 포함됩니다. 3. Microsoft GUID 호환 - `0b110x` - - Microsoft에서 사용하는 GUID(Globally Unique Identifier) 형식입니다. + - Microsoft에서 사용하는 GUID(Globally Unique Identifier)의 형식입니다. 4. 미래를 위해 예약됨 - `0b111x` -이 프로퍼티는 위 변형 외에 NIL UUID와 MAX UUID도 표현합니다. +이 속성은 위의 변형 외에도 NIL UUID와 MAX UUID도 표현합니다. ```ts .variant: @@ -74,7 +74,7 @@ UUID의 변형입니다. 이는 UUID의 13번째 비트의 상위 비트로 정 ### `.version` -UUID의 변형이 `"RFC"`라면, UUID 버전 번호입니다. 그렇지 않으면 `null`입니다. +UUID의 변형이 `"RFC"`이면 UUID 버전 번호입니다. 그렇지 않으면 `null`입니다. ```ts .version: 1 | 2 | 3 | 4 | 5 | 6 | 7 | null; @@ -82,7 +82,7 @@ UUID의 변형이 `"RFC"`라면, UUID 버전 번호입니다. 그렇지 않으 ### `.timestamp` -UUID의 변형이 `"RFC"`이고 버전이 v1, v6, v7 중 하나라면, 타임스탬프 부분입니다. 그렇지 않으면 `null`입니다. 편의상, 타임스탬프는 모두 UNIX 에포크부터 밀리초 단위로 계산됩니다. +UUID의 변형이 `"RFC"`이고 버전이 v1, v6, v7 중 하나이면 타임스탬프 부분입니다. 그렇지 않으면 `null`입니다. 편의상 타임스탬프는 모두 UNIX 에포크부터 밀리초로 계산됩니다. ```ts .timestamp: number | null; @@ -90,9 +90,9 @@ UUID의 변형이 `"RFC"`이고 버전이 v1, v6, v7 중 하나라면, 타임스 ### `.toString()` -`Uuid` 객체를 SurrealQL 변수에서 사용 가능한 문자열로 변환합니다. +`Uuid` 객체를 SurrealQL 변수에서 사용할 수 있는 문자열로 변환합니다. -`.valueOf()`와 `.toJSON()`은 이 메서드와 동일한 결과를 반환합니다. +`.valueOf()`와 `.toJSON()`은 이 메서드와 같은 결과를 반환합니다. ```ts .toString(): string; @@ -109,7 +109,7 @@ UUID의 변형이 `"RFC"`이고 버전이 v1, v6, v7 중 하나라면, 타임스 #### 예 ```ts -import { Uuid } from "@tai-kun/surrealdb/data-types/encodable"; +import { Uuid } from "@tai-kun/surrealdb/encodable-datatypes"; const bytes = new Uint8Array([ 0x26, 0xc8, 0x01, 0x63, @@ -125,7 +125,7 @@ console.log(uuid.toString()); ### `.toSurql()` -`Uuid` 객체를 SurrealQL에 삽입 가능한 문자열로 변환합니다. `.toString()`과 유사하지만 `u` 접두사를 추가하여 쿼리 파서에게 문자열이 UUID임을 알립니다. +`Uuid` 객체를 SurrealQL에 삽입할 수 있는 문자열로 변환합니다. `.toString()`과 비슷하지만 `u` 접두사를 추가하여 쿼리 파서에 문자열이 UUID임을 알립니다. ```ts .toSurql(): string; @@ -142,7 +142,7 @@ console.log(uuid.toString()); #### 예 ```ts -import { Uuid } from "@tai-kun/surrealdb/data-types/encodable"; +import { Uuid } from "@tai-kun/surrealdb/encodable-datatypes"; const bytes = new Uint8Array([ 0x26, 0xc8, 0x01, 0x63, @@ -170,7 +170,7 @@ console.log(uuid.toSurql()); #### 반환 값 -새로운 `Uuid` 객체를 반환합니다. `Uuid` 클래스를 상속받은 경우 해당 클래스의 인스턴스를 반환합니다. +새로운 `Uuid` 객체를 반환합니다. `Uuid` 클래스를 상속하는 경우 해당 클래스의 인스턴스가 반환됩니다. ### `.compareTo()` @@ -188,14 +188,14 @@ console.log(uuid.toSurql()); #### 반환 값 -양쪽 중 하나에 타임스탬프 부분이 없거나, 타임스탬프가 같으면 `0`을 반환합니다. 비교 대상 UUID의 타임스탬프가 더 빠른 시간이면 `-1`을, 더 늦은 시간이면 `1`을 반환합니다. +둘 중 하나에 타임스탬프 부분이 없거나 타임스탬프가 같으면 `0`을 반환합니다. 비교 대상 UUID의 타임스탬프가 더 이후 시간이면 `-1`, 더 이전 시간이면 `1`을 반환합니다. #### 예 -다음 예에서는, 서로 다른 UUID 버전의 타임스탬프를 비교하여 오름차순으로 정렬합니다: +다음 예에서는 서로 다른 UUID 버전의 타임스탬프를 비교하여 오름차순으로 정렬합니다. ```ts -import { Uuid } from "@tai-kun/surrealdb/data-types/standard"; +import { Uuid } from "@tai-kun/surrealdb/standard-datatypes"; const uuidv1 = new Uuid("0e004000-2073-11ef-8451-eb2a011f8691"); const uuidv6 = new Uuid("1ef1fa9e-3968-6000-a77e-683eb1a35ebe"); @@ -219,11 +219,11 @@ console.log(uuidList); //-> ] ``` -### 발전 +### 개발 -#### `Uuid` 객체의 범용적인 판정 +#### `Uuid` 객체의 범용적인 판별 -프리셋에 의존하지 않고 값이 `Uuid` 객체인지 판정하려면 `isUuid` 함수를 사용하는 것을 권장합니다. 이 함수는 `instanceof`를 사용하지 않으므로 검증할 값의 프리셋이 불분명한 경우 유용합니다. +프리셋에 의존하지 않고 값이 `Uuid` 객체인지 판별하려면 `isUuid` 함수를 사용하는 것이 좋습니다. 이 함수는 `instanceof`를 사용하지 않으므로 확인할 값의 프리셋이 불분명한 경우 유용합니다. ```ts import { isUuid } from "@tai-kun/surrealdb"; diff --git a/docs/src/content/docs/ko/v2/getting-started.mdx b/docs/src/content/docs/ko/v2/getting-started.mdx index 4f9ef036..9e409e07 100644 --- a/docs/src/content/docs/ko/v2/getting-started.mdx +++ b/docs/src/content/docs/ko/v2/getting-started.mdx @@ -30,7 +30,7 @@ import { Tabs, TabItem } from "@astrojs/starlight/components"; -## 사용해 보기 +## 사용 방법 ```ts import { Surreal } from "@tai-kun/surrealdb"; @@ -48,13 +48,13 @@ try { } ``` -## 사용자 정의 +## 사용자 지정 ```ts import { initSurreal } from "@tai-kun/surrealdb"; -import Client from "@tai-kun/surrealdb/clients/standard"; -import HttpEngine from "@tai-kun/surrealdb/engines/http"; -import JsonFormatter from "@tai-kun/surrealdb/formatters/json"; +import Client from "@tai-kun/surrealdb/standard-client"; +import HttpEngine from "@tai-kun/surrealdb/http-engine"; +import JsonFormatter from "@tai-kun/surrealdb/json-formatter"; const { Surreal } = initSurreal({ Client: Client, diff --git a/docs/src/content/docs/ko/v2/guides/errors.mdx b/docs/src/content/docs/ko/v2/guides/errors.mdx index 2f82a1f8..61cdba7e 100644 --- a/docs/src/content/docs/ko/v2/guides/errors.mdx +++ b/docs/src/content/docs/ko/v2/guides/errors.mdx @@ -1,103 +1,103 @@ --- -title: 에러 +title: 오류 slug: ko/v2/guides/errors --- ## 소개 -일부 에러 객체에는 `.cause` 속성이 설정되어 있을 수 있습니다. 대부분의 경우 `unknown` 유형이며, 값은 추후 예고 없이 변경될 수 있습니다. +일부 오류 객체에는 `.cause` 속성이 설정되어 있을 수 있습니다. 대부분의 경우 `unknown` 유형이며 값은 향후 예고 없이 변경될 수 있습니다. ## 일반 ### SurrealError -`SurrealError`는 이 SDK가 명시적으로 던지는 대부분의 에러 객체가 상속하는 기본 클래스입니다. 이 클래스는 JavaScript의 `Error` 클래스를 상속합니다. 이 에러 객체가 단독으로 던져지는 경우는 거의 없으며, 기본적으로 상속받은 특별한 의미를 가진 에러 객체가 던져집니다. `try-catch` 구문 등으로 잡힌 에러가 이 SDK가 명시적으로 던진 에러인지 쉽게 분류하기 위해 사용하는 것을 권장합니다. +`SurrealError`는 이 SDK에서 명시적으로 throw되는 오류 객체의 대부분이 상속하는 기본 클래스입니다. 이 클래스는 JavaScript의 `Error` 클래스를 상속합니다. 이 오류 객체가 단독으로 throw되는 경우는 거의 없으며, 일반적으로 상속된 특정 의미를 가진 오류 객체가 throw됩니다. `try-catch` 구문 등을 사용하여 오류를 포착할 때 이 SDK에서 명시적으로 throw된 오류인지 쉽게 분류하기 위해 사용하는 것이 좋습니다. #### 속성 `.name: "SurrealError"` -: 에러 이름입니다. +: 오류 이름입니다. `.message` -: 에러 메시지입니다. +: 오류 메시지입니다. `.stack` -: 스택 트레이스가 기록될 수 있습니다. +: 스택 추적이 기록될 수 있습니다. `.cause` -: 에러가 발생한 원인이나 컨텍스트가 설정될 수 있습니다. +: 오류가 발생한 원인이나 컨텍스트가 설정될 수 있습니다. ### SurrealTypeError -상속: `SurrealError` +상속 원본: `SurrealError` -이는 입력 값이나 기타 검증에 실패한 경우 던져지는 에러입니다. +입력 값 또는 기타 검증에 실패한 경우 throw되는 오류입니다. #### 속성 `.name: "SurrealTypeError"` -: 에러 이름입니다. +: 오류 이름입니다. `.expected` -: 예상되는 데이터 형식입니다. +: 예상 데이터 형식입니다. `.actual` : 실제 값의 문자열 표현입니다. #### 해결책 -스택 트레이스를 따라 예상되는 데이터 형식이 입력되지 않는 원인을 찾습니다. +스택 추적을 따라 예상되는 데이터 형식이 입력되지 않는 원인을 찾습니다. ### SurrealValueError -상속: `SurrealError` +상속 원본: `SurrealError` -이는 입력 값이나 기타 검증에 실패한 경우 던져지는 에러입니다. +입력 값 또는 기타 검증에 실패한 경우 throw되는 오류입니다. #### 속성 `.name: "SurrealValueError"` -: 에러 이름입니다. +: 오류 이름입니다. `.expected` -: 예상되는 데이터 형식입니다. +: 예상 데이터 형식입니다. `.actual` : 실제 값입니다. #### 해결책 -스택 트레이스를 따라 예상되는 데이터 형식이 입력되지 않는 원인을 찾습니다. +스택 추적을 따라 예상되는 데이터 형식이 입력되지 않는 원인을 찾습니다. ### SurrealAggregateError -상속: `SurrealError` +상속 원본: `SurrealError` -이는 여러 에러나 에러 메시지가 모아진 에러입니다. +여러 오류 또는 오류 메시지가 결합된 오류입니다. #### 속성 `.name: "SurrealAggregateError"` -: 에러 이름입니다. +: 오류 이름입니다. `.cause: unknown[]` -: 배열의 각 요소에 에러나 에러 메시지 등이 포함되어 있습니다. +: 배열의 각 요소에 오류 또는 오류 메시지 등이 포함되어 있습니다. ### CircularReferenceError -상속: `SurrealError` +상속 원본: `SurrealError` -이는 순환 참조를 감지한 경우 던져지는 에러입니다. 주로 JavaScript 값을 다른 형식으로 변환하는 과정에서 부모 객체와 동일한 객체가 감지된 경우 던져집니다. +순환 참조를 감지한 경우 throw되는 오류입니다. 주로 JavaScript 값을 다른 형식으로 변환하는 과정에서 부모 객체와 동일한 객체가 감지된 경우 throw됩니다. #### 속성 `.name: "CircularReferenceError"` -: 에러 이름입니다. +: 오류 이름입니다. `.reference: unknown` : 순환 참조가 발생한 값입니다. -예를 들어 다음과 같은 경우 이 에러가 던져집니다. +예를 들어 다음과 같은 경우에 이 오류가 throw됩니다: ```ts import { toSurql } from "@tai-kun/surrealdb/utils"; @@ -112,21 +112,21 @@ toSurql(a); // throws CircularReferenceError #### 해결책 -이 에러는 `toSurql` 함수 이외에도 던져지는 일반적인 에러입니다. 객체 내부에 그 객체 자체가 포함되어 있는지 신중하게 디버깅해야 합니다. +이 오류는 `toSurql` 함수 외에도 일반적인 오류로 throw될 수 있습니다. 객체 내부에 그 객체 자체가 포함되어 있는지 신중하게 디버깅해야 합니다. ### NumberRangeError -상속: `SurrealError` +상속 원본: `SurrealError` -이는 숫자가 범위를 벗어난 값을 가진 경우 던져지는 에러입니다. +숫자가 범위를 벗어난 값을 가진 경우 throw되는 오류입니다. #### 속성 `.name: "NumberRangeError"` -: 에러 이름입니다. +: 오류 이름입니다. `.range` -: 예상되는 범위입니다. +: 예상 범위입니다. `.actual` : 실제 값입니다. @@ -136,33 +136,33 @@ toSurql(a); // throws CircularReferenceError #### 해결책 -스택 트레이스를 따라 예상되는 데이터 형식이 입력되지 않는 원인을 찾습니다. +스택 추적을 따라 예상되는 데이터 형식이 입력되지 않는 원인을 찾습니다. ### UnsupportedRuntimeError -상속: `SurrealError` +상속 원본: `SurrealError` -이는 지원되지 않는 런타임을 사용하고 있다고 판단된 경우 던져지는 에러입니다. +지원되지 않는 런타임을 사용하고 있다고 판단된 경우 throw되는 오류입니다. #### 속성 `.name: "UnsupportedRuntimeError"` -: 에러 이름입니다. +: 오류 이름입니다. #### 해결책 -해당 런타임을 사용하지 않거나, 폴리필을 사용하여 충분히 테스트해야 합니다. +해당 런타임을 사용하지 않거나 폴리필을 사용하여 충분히 테스트해야 합니다. ### UnreachableError -상속: `SurrealError` +상속 원본: `SurrealError` -이는 도달할 수 없는 코드에 도달한 경우 던져지는 에러입니다. 이 에러가 던져진 경우, 아마도 이 SDK의 버그를 만난 것으로 판단할 수 있습니다. +도달할 수 없는 코드에 도달한 경우 throw되는 오류입니다. 이 오류가 throw된 경우 이 SDK의 버그를 만난 것일 가능성이 높습니다. #### 속성 `.name: "UnreachableError"` -: 에러 이름입니다. +: 오류 이름입니다. #### 해결책 @@ -174,22 +174,22 @@ toSurql(a); // throws CircularReferenceError ### CircularEngineReferenceError -상속: `CircularReferenceError` +상속 원본: `CircularReferenceError` -이는 데이터베이스에 연결할 때, 엔진 간에 순환 참조가 발생한 경우 던져지는 에러입니다. +데이터베이스에 연결할 때 엔진 간에 순환 참조가 발생한 경우 throw되는 오류입니다. #### 속성 `.name: "CircularEngineReferenceError"` -: 에러 이름입니다. +: 오류 이름입니다. `.reference: string` : 순환 참조가 발생한 스키마 이름입니다. `.seen: string[]` -: 순환 참조가 발생하기 전에 거친 스키마 이름 목록입니다. +: 순환 참조가 발생할 때까지 거친 스키마 이름 목록입니다. -예를 들어 다음과 같은 경우 이 에러가 던져집니다. +예를 들어 다음과 같은 경우에 이 오류가 throw됩니다: ```ts import { initSurreal } from "@tai-kun/surrealdb"; @@ -206,15 +206,15 @@ await using db = new Surreal(); await db.connect("https://localhost:8000"); // throws CircularEngineReferenceError: Circular engine reference: http,https ``` -위 예제에서는 https 프로토콜 엔진이 http에 설정된 엔진을 사용하도록 지정했지만, http 프로토콜 엔진은 https에 설정된 엔진을 사용하려고 하기 때문에 순환 참조 에러가 던져집니다. +위 예에서 https 프로토콜 엔진은 http에 설정된 엔진을 사용하도록 지정되어 있지만 http 프로토콜 엔진은 https에 설정된 엔진을 사용하려고 하기 때문에 순환 참조 오류가 throw됩니다. #### 해결책 -문자열로 지정된 프로토콜 이름을 다른 프로토콜 이름의 값으로 설정하지 않고, 대신 엔진을 만드는 구체적인 구현으로 대체합니다. +문자열로 지정된 프로토콜 이름을 다른 프로토콜 이름의 값으로 설정하는 대신 엔진을 생성하는 구체적인 구현으로 바꿉니다: ```ts del={6} ins={7-10} import { initSurreal } from "@tai-kun/surrealdb"; -import HttpEngine from "@tai-kun/surrealdb/engines/http"; +import HttpEngine from "@tai-kun/surrealdb/http-engine"; const { Surreal } = initSurreal({ engines: { @@ -231,19 +231,19 @@ const { Surreal } = initSurreal({ ### EngineNotFoundError -상속: `SurrealError` +상속 원본: `SurrealError` -이는 엔진이 설정되지 않은 프로토콜로 연결하려고 했을 때 던져지는 에러입니다. +엔진이 설정되지 않은 프로토콜로 연결하려고 시도한 경우 throw되는 오류입니다. #### 속성 `.name: "EngineNotFoundError"` -: 에러 이름입니다. +: 오류 이름입니다. `.scheme: string` : 연결할 프로토콜 이름입니다. -예를 들어 다음과 같은 경우 이 에러가 던져집니다. +예를 들어 다음과 같은 경우에 이 오류가 throw됩니다: ```ts import { initSurreal } from "@tai-kun/surrealdb"; @@ -261,7 +261,7 @@ await db.connect("https://localhost:8000"); // throws EngineNotFoundError: No ht #### 해결책 -연결할 엔드포인트의 프로토콜로 엔진을 만들 수 있는지 `engines` 속성을 확인합니다. +연결할 엔드포인트의 프로토콜로 엔진을 생성할 수 있는지 `engines` 속성을 확인합니다. ```ts ins={6} import { initSurreal } from "@tai-kun/surrealdb"; @@ -277,14 +277,14 @@ const { Surreal } = initSurreal({ ### ConnectionConflictError -상속: `SurrealError` +상속 원본: `SurrealError` -이는 클라이언트가 여러 엔드포인트에 동시에 연결하려고 했을 때 던져지는 에러입니다. +클라이언트가 여러 엔드포인트에 동시에 연결하려고 시도한 경우 throw되는 오류입니다. #### 속성 `.name: "ConnectionConflictError"` -: 에러 이름입니다. +: 오류 이름입니다. `.endpoint1: string` : 이미 연결된 엔드포인트입니다. @@ -301,7 +301,7 @@ await db.connect("ws://localhost:8000"); await db.connect("ws://localhost:1129"); // throws ConnectionConflictError: An attempt was made to connect to ws://localhost:1129/rpc while ws://localhost:8000/rpc was already connected. ``` -`.connect` 메서드는 전달된 URL의 경로가 `/rpc`로 끝나지 않는 경우, 그것을 끝에 추가합니다. 따라서, 한쪽 엔드포인트의 URL 경로가 `/rpc`로 끝나는 경우, 외관상으로는 에러가 발생하지 않을 수 있습니다. +`.connect` 메서드는 전달된 URL의 경로가 `/rpc`로 끝나지 않는 경우 이를 맨 뒤에 추가합니다. 따라서 한쪽 엔드포인트의 URL 경로가 `/rpc`로 끝나는 경우 외관상으로는 오류가 발생하지 않을 수 있습니다. ```ts import { Surreal } from "@tai-kun/surrealdb"; @@ -323,7 +323,7 @@ await db.connect("http://localhost:8000"); // OK! #### 해결책 -`.connect` 메서드를 호출하기 전에 `.close` 메서드를 호출하면 원하는 엔드포인트에 연결할 수 있습니다. +`.connect` 메서드를 호출하기 전에 `.close` 메서드를 호출하여 원하는 엔드포인트에 연결할 수 있습니다. ```ts ins={6} import { Surreal } from "@tai-kun/surrealdb"; @@ -337,19 +337,19 @@ await db.connect("http://localhost:11298"); ### MissingNamespaceError -상속: `SurrealError` +상속 원본: `SurrealError` -이는 데이터베이스를 선택하기 전에 네임스페이스가 선택되지 않은 경우 던져지는 에러입니다. 또는, 데이터베이스를 선택한 상태로 네임스페이스를 미선택 상태로 만들려고 해도 던져집니다. +데이터베이스를 선택하기 전에 네임스페이스가 선택되지 않은 경우 throw되는 오류입니다. 또는 데이터베이스를 선택한 상태로 네임스페이스를 선택하지 않은 상태로 유지하려고 시도해도 throw됩니다. #### 속성 `.name: "MissingNamespaceError"` -: 에러 이름입니다. +: 오류 이름입니다. `.database: string` : 데이터베이스 이름입니다. -예를 들어 다음과 같은 경우 이 에러가 던져집니다. +예를 들어 다음과 같은 경우에 이 오류가 throw됩니다: ```ts import { Surreal } from "@tai-kun/surrealdb"; @@ -364,7 +364,7 @@ await db.use({ #### 해결책 -데이터베이스를 선택하는 경우 네임스페이스도 선택하도록 합니다. +데이터베이스를 선택하는 경우 네임스페이스도 함께 선택합니다. ```ts ins={7} import { Surreal } from "@tai-kun/surrealdb"; @@ -380,40 +380,40 @@ await db.use({ ### RpcResponseError -상속: `SurrealError` +상속 원본: `SurrealError` -이는 RPC 응답이 에러를 나타내는 경우 던져지는 에러입니다. 연결된 프로토콜을 통한 통신이나 응답 본문의 디코딩에는 문제가 없지만, SurrealDB가 RPC 요청을 처리할 수 없음을 의미합니다. +RPC 응답이 오류를 나타내는 경우 throw되는 오류입니다. 연결된 프로토콜에 의한 통신 또는 응답 본문 디코딩에 문제는 없지만 SurrealDB가 RPC 요청을 처리할 수 없음을 의미합니다. #### 속성 `.name: "RpcResponseError"` -: 에러 이름입니다. +: 오류 이름입니다. `.id?: string` : RPC 요청을 식별하는 ID입니다. ID는 항상 `<메서드 이름>_`으로 시작합니다. `.code: number` -: SurrealDB 문서에 명시되어 있지는 않지만, 아마도 JSON-RPC의 에러 코드일 것입니다. +: SurrealDB 문서에 명시되어 있지 않지만 아마도 JSON-RPC의 오류 코드일 것입니다. #### 해결책 -다양한 원인이 생각되지만, 이 SDK가 지원하는 SurrelDB 버전과 RPC 요청을 처리하는 SurrealDB 버전이 다른 경우일 수 있습니다. +다양한 원인이 있을 수 있지만 이 SDK에서 지원하는 SurrealDB 버전과 RPC 요청을 처리하는 SurrealDB 버전이 다른 가능성이 있습니다. ### QueryFailedError -상속: `SurrealAggregateError` +상속 원본: `SurrealAggregateError` -이는 쿼리가 실패한 경우 던져지는 에러입니다. +쿼리가 실패한 경우 throw되는 오류입니다. #### 속성 `.name: "QueryFailedError"` -: 에러 이름입니다. +: 오류 이름입니다. `.cause: string[]` -: 에러 목록입니다. +: 오류 목록입니다. -예를 들어 다음과 같은 경우 이 에러가 던져집니다. +예를 들어 다음과 같은 경우에 이 오류가 throw됩니다: ```ts await using db = new Surreal(); @@ -428,16 +428,16 @@ SurrelQL 구문이 올바른지 확인합니다. ### Closed -상속: `SurrealError` +상속 원본: `SurrealError` -이는 연결이 강제로 종료되었음을 나타내는 에러입니다. +연결이 강제로 종료되었음을 나타내는 오류입니다. #### 속성 `.name: "Closed"` -: 에러 이름입니다. +: 오류 이름입니다. -예를 들어 다음과 같은 경우 이 에러를 얻습니다. +예를 들어 다음과 같은 경우에 이 오류를 얻습니다: ```ts const db = new Surreal(); @@ -460,92 +460,92 @@ await db.close({ force: true }); ### EngineError -상속: `SurrealError` +상속 원본: `SurrealError` -이는 엔진에 의한 에러임을 나타냅니다. 이벤트 리스너를 통해 전송됩니다. +엔진에서 발생한 오류임을 나타냅니다. 이벤트 리스너를 통해 발송됩니다. #### 속성 `.name: "EngineError"` -: 에러 이름입니다. +: 오류 이름입니다. `.fatal: boolean | undefined` -: 이 에러가 치명적인지 여부를 나타냅니다. +: 이 오류가 치명적인지 여부를 나타냅니다. ### HttpEngineError -상속: `EngineError` +상속 원본: `EngineError` -이는 HTTP 엔진에 의한 에러임을 나타냅니다. 현재 정의만 되어 있으며, 사용되고 있지 않습니다. +HTTP 엔진에서 발생한 오류임을 나타냅니다. 현재 정의만 되어 있으며 사용되지 않습니다. #### 속성 `.name: "HttpEngineError"` -: 에러 이름입니다. +: 오류 이름입니다. ### WebSocketEngineError -상속: `EngineError` +상속 원본: `EngineError` -이는 WebSocket 엔진에 의한 에러임을 나타냅니다. RPC 요청을 식별하는 ID를 찾기 전에 응답 본문의 구문 분석에 실패했거나, WebSocket 객체에서 에러 이벤트를 받았거나, WebSocket 연결을 끊었을 때 등 사용됩니다. +WebSocket 엔진에서 발생한 오류임을 나타냅니다. RPC 요청을 식별하는 ID를 찾기 전에 응답 본문을 분석하는 데 실패하거나 WebSocket 객체에서 오류 이벤트를 받았거나 WebSocket 연결을 끊은 경우 등에 사용됩니다. -이 SDK에서는 `315x`를 사용자 지정 상태 코드로 사용합니다. 이 범위는 [IANA](https://www.iana.org/assignments/websocket/websocket.xml#close-code-number)에서 할당되지 않은 상태 코드입니다. +이 SDK는 `315x`를 사용자 지정 상태 코드로 사용합니다. 이 범위는 [IANA](https://www.iana.org/assignments/websocket/websocket.xml#close-code-number)에서는 할당되지 않은 상태 코드입니다. #### 속성 `.name: "WebSocketEngineError"` -: 에러 이름입니다. +: 오류 이름입니다. `.code: number` -: 다음 상태 코드 중 하나입니다. +: 다음 상태 코드 중 하나입니다: - `1000`~`1015`: [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/code) - `3150`: `WebSocket`[^1] 인스턴스에서 "error" 이벤트를 받았음을 나타냅니다. - - `3151`: WebSocket 엔진이 등록한 "open" 이벤트 핸들러 내에서 에러가 발생했음을 나타냅니다. 연결 중 상태에서 연결 상태로 전환하는 과정에서 `StateTransitionError`가 발생한 경우가 대부분입니다. - - `3152`: WebSocket 엔진이 등록한 "message" 이벤트 핸들러 내에서 에러가 발생했음을 나타냅니다. 다양한 원인이 생각되지만, 이벤트 핸들러 내에서 `ServerResponseError` 또는 `RpcResponseError`가 던져졌을 가능성이 높습니다. 잘못된 RPC 매개 변수로 요청했기 때문일 수 있습니다. 이 경우, RPC 호출의 원래 메서드는 (기본적으로) 5초 후에 타임 아웃되어 실패합니다. SurrealDB v2.0.2 이전 버전에서는 더 광범위한 원인으로 타임 아웃될 수 있습니다. - - `3153`: ping의 송수신에 실패했음을 나타냅니다. 일시적인 에러일 수 있지만, 지속적으로 받고 있다면 연결을 유지하지 못하고 있을 가능성이 있습니다. - - `3154`: WebSocket 엔진이 등록한 "close" 이벤트 핸들러 내에서 에러가 발생했음을 나타냅니다. 연결 해제 중 상태에서 연결 해제 상태로 전환하는 과정에서 `StateTransitionError`가 발생한 경우가 대부분입니다. -: 참고로, 위에서 다음 상태 코드를 제외합니다. 이 SDK에서는 에러로 처리하지 않습니다. - - `1000`: 정상적으로 연결이 해제되었습니다. - - `1001`: 조기 연결 해제는 흔히 있습니다. - - `1004`: 예약되었습니다. - - `1005`: 예약되었습니다. - - `1006`: 예약되었습니다. - - `1015`: 예약되었습니다. - -^1: `WebSocket`는 런타임이 전역 변수에 정의한 클래스이거나, `ws`의 클래스일 수 있습니다. + - `3151`: WebSocket 엔진이 등록한 "open" 이벤트 핸들러에서 오류가 발생했음을 나타냅니다. 연결 중 상태에서 연결 상태로 전환하는 동안 `StateTransitionError`가 발생하는 경우가 대부분입니다. + - `3152`: WebSocket 엔진이 등록한 "message" 이벤트 핸들러에서 오류가 발생했음을 나타냅니다. 다양한 원인이 있을 수 있지만 이벤트 핸들러에서 `ServerResponseError` 또는 `RpcResponseError`가 throw된 가능성이 높습니다. 잘못된 RPC 매개변수로 요청한 것이 원인일 수 있습니다. 이 경우 RPC 호출의 원본 메서드는 (기본적으로) 5초 후에 타임아웃되어 실패합니다. SurrealDB v2.0.2 이전 버전에서는 더 광범위한 원인으로 타임아웃될 수 있습니다. + - `3153`: ping을 송수신하는 데 실패했음을 나타냅니다. 일시적인 오류일 수 있지만 계속해서 받는 경우 연결을 유지하지 못하고 있을 가능성이 있습니다. + - `3154`: WebSocket 엔진이 등록한 "close" 이벤트 핸들러에서 오류가 발생했음을 나타냅니다. 연결 해제 중 상태에서 연결 해제 상태로 전환하는 동안 `StateTransitionError`가 발생하는 경우가 대부분입니다. +: 위에서 다음 상태 코드를 제외합니다. 이 SDK에서는 오류로 처리하지 않습니다. + - `1000`: 정상적으로 연결 해제되었습니다. + - `1001`: 조기 연결 해제는 흔히 발생합니다. + - `1004`: 예약됨. + - `1005`: 예약됨. + - `1006`: 예약됨. + - `1015`: 예약됨. + +^1: `WebSocket`은 런타임에서 전역 변수에 정의된 클래스이거나 `ws`의 클래스일 수 있습니다. #### 해결책 `1002`,`1003`,`1007`...`1011`,`1014`,`3150`,`3151`,`3154` -: 이 상태 코드에서 자동으로 복구하는 방법은 아마도 없을 것입니다. 런타임이나 SurrealDB 설정, 하드코딩된 구현을 수정해야 합니다. +: 이 상태 코드에서 자동으로 복구하는 방법은 아마 없을 것입니다. 런타임 또는 SurrealDB 설정, 하드코딩된 구현을 수정해야 합니다. `3152` -: 메서드에 전달한 인수(즉, RPC 요청의 내용)가 올바른지 확인합니다. +: 메서드에 전달된 인수(즉, RPC 요청의 내용)가 올바른지 확인합니다. `1012`,`1013`,`3153` : 실험적인 기능인 [`autoReconnect()`](/v2/experimental/auto-reconnect)를 사용하여 자동으로 복구할 수 있습니다. ### StateTransitionError -상속: `SurrealAggregateError` +상속 원본: `SurrealAggregateError` -이는 상태 전환 중에 이벤트 리스너의 실행에 실패한 경우 던져지는 에러입니다. +상태 전환 중에 이벤트 리스너 실행에 실패한 경우 throw되는 오류입니다. #### 속성 `.name: "StateTransitionError"` -: 에러 이름입니다. +: 오류 이름입니다. `.from: string` : 상태 전환 시작 시의 상태입니다. `.to: string` -: 전환할 상태입니다. +: 전환할 대상 상태입니다. `.fallback: string` -: 상태 전환에 실패한 경우 대신 전환할 상태입니다. `.to`와 동일한 값이면, 강제로 전환했음을 의미합니다. +: 상태 전환에 실패한 경우 대체 전환할 대상입니다. `.to`와 동일한 값이면 강제로 전환되었음을 의미합니다. -예를 들어 다음과 같은 경우 이 에러가 던져집니다. +예를 들어 다음과 같은 경우에 이 오류가 throw됩니다: ```ts import { Surreal } from "@tai-kun/surrealdb"; @@ -571,93 +571,93 @@ await db.connect("http://localhost:8000"); // throws ... ### ConnectionUnavailableError -상속: `SurrealError` +상속 원본: `SurrealError` -이는 연결되지 않은 상태에서 RPC 요청을 보내려고 했을 때 던져지는 에러입니다. +연결되지 않은 상태에서 RPC 요청을 보내려고 시도한 경우 throw되는 오류입니다. #### 속성 `.name: "ConnectionUnavailableError"` -: 에러 이름입니다. +: 오류 이름입니다. ### ServerResponseError -상속: `SurrealError` +상속 원본: `SurrealError` -이는 응답을 PRC 응답으로 구문 분석할 수 없는 경우 던져지는 에러입니다. `RpcResponseError`와는 다릅니다. +응답을 PRC 응답으로 분석할 수 없는 경우 throw되는 오류입니다. `RpcResponseError`와 다릅니다. #### 속성 `.name: "ServerResponseError"` -: 에러 이름입니다. +: 오류 이름입니다. #### 해결책 -일반적으로 이 에러가 던져지는 일은 없어야 하지만, 만약 던져졌다면, 이 SDK가 지원하는 SurrelDB 버전과 RPC 요청을 처리하는 SurrealDB 버전이 다른 경우일 수 있습니다. +일반적으로 이 오류가 throw되는 경우는 없어야 하지만 throw되는 경우 이 SDK에서 지원하는 SurrealDB 버전과 RPC 요청을 처리하는 SurrealDB 버전이 다른 가능성이 있습니다. ## CBOR ### CborError -상속: `SurrealError` +상속 원본: `SurrealError` -이는 `@tai-kun/surrealdb/cbor`가 명시적으로 던지는, CBOR와 관련된 모든 에러가 상속하는 클래스입니다. 이것이 직접 던져지는 경우는 없습니다. +`@tai-kun/surrealdb/cbor`가 명시적으로 throw하는 CBOR 관련 모든 오류가 상속하는 클래스입니다. 이것이 직접 throw되는 경우는 없습니다. #### 속성 `.name: "CborError"` -: 에러 이름입니다. +: 오류 이름입니다. ### CborWellFormednessError -상속: `CborError` +상속 원본: `CborError` #### 속성 -이는 `@tai-kun/surrealdb/cbor`가 명시적으로 던지는, CBOR의 디코딩과 관련된 모든 에러가 상속하는 클래스입니다. 이것이 직접 던져지는 경우는 없습니다. +`@tai-kun/surrealdb/cbor`가 명시적으로 throw하는 CBOR 디코딩 관련 모든 오류가 상속하는 클래스입니다. 이것이 직접 throw되는 경우는 없습니다. -RFC8949의 부록 F에 있는 "Well-Formedness Errors and Examples](https://datatracker.ietf.org/doc/html/rfc8949#name-well-formedness-errors-and-)"을 참조하십시오. +RFC8949의 부록 F에 있는 "\[Well-Formedness Errors and Examples](https://datatracker.ietf.org/doc/html/rfc8949#name-well-formedness-errors-and-)"를 참조합니다. `.name: "CborWellFormednessError"` -: 에러 이름입니다. +: 오류 이름입니다. ### CborTooMuchDataError -상속: `CborWellFormednessError` +상속 원본: `CborWellFormednessError` -이는 소비되지 않은 입력 바이트가 남아 있음을 나타냅니다. +소비되지 않은 입력 바이트가 남아 있음을 나타냅니다. [RFC8949](https://datatracker.ietf.org/doc/html/rfc8949#section-appendix.f-2.2) #### 속성 `.name: "CborTooMuchDataError"` -: 에러 이름입니다. +: 오류 이름입니다. #### 해결책 -디코딩 대상 바이트 배열이 올바른 CBOR 형식인지 확인합니다. +디코딩할 바이트 배열이 올바른 CBOR 형식인지 확인합니다. ### CborTooLittleDataError -상속: `CborWellFormednessError` +상속 원본: `CborWellFormednessError` -이는 입력 바이트가 불완전함을 나타냅니다. +입력 바이트가 불완전함을 나타냅니다. [RFC8949](https://datatracker.ietf.org/doc/html/rfc8949#section-appendix.f-2.4) #### 속성 `.name: "CborTooLittleDataError"` -: 에러 이름입니다. +: 오류 이름입니다. #### 해결책 -디코딩 대상 바이트 배열이 올바른 CBOR 형식인지 확인합니다. +디코딩할 바이트 배열이 올바른 CBOR 형식인지 확인합니다. ### CborSyntaxError -상속: `CborWellFormednessError` +상속 원본: `CborWellFormednessError` 입력 바이트가 CBOR의 인코딩 형식과 일치하지 않음을 나타냅니다. @@ -666,32 +666,32 @@ RFC8949의 부록 F에 있는 "Well-Formedness Errors and Examples](https://data #### 속성 `.name: "CborSyntaxError"` -: 에러 이름입니다. +: 오류 이름입니다. #### 해결책 -디코딩 대상 바이트 배열이 올바른 CBOR 형식인지 확인합니다. +디코딩할 바이트 배열이 올바른 CBOR 형식인지 확인합니다. ### CborMaxDepthReachedError -상속: `CborError` +상속 원본: `CborError` -CBOR의 인코딩 또는 디코딩 중에 JavaScript 객체의 깊이가 최대값에 도달한 경우 던져지는 에러입니다. 객체 또는 배열에 들어갈 때마다 깊이가 1 증가합니다. +CBOR 인코딩 또는 디코딩 시 JavaScript 객체의 깊이가 최대 값에 도달한 경우 throw되는 오류입니다. 객체 또는 배열에 들어갈 때마다 깊이가 1 증가합니다. #### 속성 `.name: "CborMaxDepthReachedError"` -: 에러 이름입니다. +: 오류 이름입니다. `.maxDepth: number` : 최대 깊이입니다. #### 해결책 -옵션의 `.maxDepth` 상한선을 완화하거나, 객체의 중첩이 얕아지도록 데이터 구조를 재검토합니다. +옵션의 `.maxDepth` 상한을 완화하거나 객체의 중첩이 얕아지도록 데이터 구조를 재검토합니다. ```ts -import CborFormatter from "@tai-kun/surrealdb/formatters/cbor"; +import CborFormatter from "@tai-kun/surrealdb/cbor-formatter"; const cborFormatter = new CborFormatter({ encode: { @@ -706,14 +706,14 @@ const cborFormatter = new CborFormatter({ ### CborUnsafeMapKeyError -상속: `CborError` +상속 원본: `CborError` -CBOR의 인코딩 또는 디코딩 중에 안전하지 않은 맵 키가 발견되면 던져지는 에러입니다. +CBOR 인코딩 또는 디코딩 시 안전하지 않은 맵 키가 발견되면 throw되는 오류입니다. #### 속성 `.name: "CborUnsafeMapKeyError"` -: 에러 이름입니다. +: 오류 이름입니다. `.key: unknown` : 안전하지 않다고 판단된 맵 키입니다. @@ -722,25 +722,25 @@ CBOR의 인코딩 또는 디코딩 중에 안전하지 않은 맵 키가 발견 ### JsonError -상속: `SurrealError` +상속 원본: `SurrealError` -이는 `@tai-kun/surrealdb/formatters/json`이 명시적으로 던지는, JSON과 관련된 모든 에러가 상속하는 클래스입니다. 이것이 직접 던져지는 경우는 없습니다. +`@tai-kun/surrealdb/json`가 명시적으로 throw하는 JSON-formatter입니다. #### 속성 `.name: "JsonError"` -: 에러 이름입니다. +: 오류 이름입니다. ### JsonUnsafeMapKeyError -상속: `JsonError` +상속 원본: `JsonError` -JSON의 디코딩 중에 안전하지 않은 맵 키가 발견되면 던져지는 에러입니다. +JSON을 디코딩할 때 안전하지 않은 맵 키가 발견되면 throw되는 오류입니다. #### 속성 `.name: "JsonUnsafeMapKeyError"` -: 에러 이름입니다. +: 오류 이름입니다. `.key: unknown` : 안전하지 않다고 판단된 맵 키입니다. diff --git a/docs/src/content/docs/ko/v2/supports.mdx b/docs/src/content/docs/ko/v2/supports.mdx index 8a8fe3d2..27fa25dd 100644 --- a/docs/src/content/docs/ko/v2/supports.mdx +++ b/docs/src/content/docs/ko/v2/supports.mdx @@ -7,7 +7,7 @@ import { Aside } from "@astrojs/starlight/components" ## JavaScript -이 SDK는 `bigint`를 사용하므로 JavaScript 언어 사양으로 ES2020 이상이 필요합니다. 또한 이 SDK가 런타임에 요구하는 기능을 고려하면 다음 런타임에서 작동할 것으로 예상됩니다. +이 SDK는 `bigint`를 사용하기 때문에 ES2020 이상의 JavaScript 언어 사양이 필요합니다. 또한 이 SDK가 런타임에 요구하는 기능을 고려하면 다음 런타임에서 작동할 것으로 예상됩니다. | 런타임 | 버전 | | --- | --- | @@ -21,18 +21,18 @@ import { Aside } from "@astrojs/starlight/components" ## 테스트 -테스트에는 Vitest 및 Playwright를 사용합니다. 이들이 작동하는 최소 버전의 런타임에서 테스트하고 있으므로 실제로는 아래에 나열된 버전보다 이전 런타임에서도 작동할 수 있습니다. +테스트에는 Vitest와 Playwright를 사용합니다. 이들은 작동하는 최소 버전의 런타임에서 테스트되므로 실제로는 아래에 표시된 버전보다 이전 버전에서도 작동할 가능성이 있습니다. ### 서버 | 런타임 | 버전 | 상태 | | --- | --- | --- | | SurrealDB | `^2.0.0` | [GitHub](https://github.com/surrealdb/surrealdb) | -| Node.js | `18.x`,
`20.x`,
`^22.5.1` | [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/tai-kun/surrealdb.js/nodejs.yml?branch=main&logo=Node.js&label=Node.js)](https://github.com/tai-kun/surrealdb.js/actions/workflows/nodejs.yml) | +| Node.js | `18.x`,
`20.x`,
`^22.5.1`,
`23.x` | [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/tai-kun/surrealdb.js/nodejs.yml?branch=main&logo=Node.js&label=Node.js)](https://github.com/tai-kun/surrealdb.js/actions/workflows/nodejs.yml) | | Deno | `1.x`, `2.x` | [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/tai-kun/surrealdb.js/deno.yml?branch=main&logo=Deno&label=Deno)](https://github.com/tai-kun/surrealdb.js/actions/workflows/deno.yml) | | Bun | `^1.1.13` | [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/tai-kun/surrealdb.js/bun.yml?branch=main&logo=Bun&label=Bun)](https://github.com/tai-kun/surrealdb.js/actions/workflows/bun.yml) | -- Node.js v22를 사용하는 경우 아직 LTS가 아니라는 점에 유의하십시오. +- Node.js v22를 사용하는 경우, 아직 LTS가 아님을 유의하십시오. - Deno는 항상 최신 버전을 사용하는 것이 좋습니다. - Bun은 항상 최신 버전을 사용하는 것이 좋습니다. @@ -44,4 +44,4 @@ import { Aside } from "@astrojs/starlight/components" | Firefox | `>=100` | [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/tai-kun/surrealdb.js/firefox.yml?branch=main&logo=Firefox&label=Firefox)](https://github.com/tai-kun/surrealdb.js/actions/workflows/firefox.yml) | | WebKit | `>=15.4` | [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/tai-kun/surrealdb.js/webkit.yml?branch=main&style=flat&logo=safari&label=WebKit)](https://github.com/tai-kun/surrealdb.js/actions/workflows/webkit.yml) | -- 지원하는 브라우저(엔진)는 CI에서 Playwright가 작동하는 최소 버전과 일치합니다. 따라서 위 버전보다 낮더라도 작동할 수 있지만 테스트하지 않았습니다. +- 지원하는 브라우저(엔진)는 CI에서 Playwright가 작동하는 최소 버전과 일치합니다. 따라서 위 버전보다 낮더라도 작동할 가능성이 있지만 테스트하지 않았습니다. diff --git a/docs/src/content/docs/zh-CN/v2/api/data/bound-excluded.mdx b/docs/src/content/docs/zh-CN/v2/api/data/bound-excluded.mdx index 893aedd4..5d570e16 100644 --- a/docs/src/content/docs/zh-CN/v2/api/data/bound-excluded.mdx +++ b/docs/src/content/docs/zh-CN/v2/api/data/bound-excluded.mdx @@ -2,7 +2,7 @@ title: BoundExcluded slug: zh-CN/v2/api/data/bound-excluded banner: - content: 这是一个实验性功能。 + content: 此功能尚处于实验阶段。 --- import Badge from "~/components/zh-CN/Badge.astro"; @@ -12,9 +12,9 @@ import Badge from "~/components/zh-CN/Badge.astro"; ### 导入 ```ts -import { BoundExcluded } from "@tai-kun/surrealdb/data-types/decode-only"; -import { BoundExcluded } from "@tai-kun/surrealdb/data-types/encodable"; -import { BoundExcluded } from "@tai-kun/surrealdb/data-types/standard"; +import { BoundExcluded } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { BoundExcluded } from "@tai-kun/surrealdb/encodable-datatypes"; +import { BoundExcluded } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` diff --git a/docs/src/content/docs/zh-CN/v2/api/data/bound-included.mdx b/docs/src/content/docs/zh-CN/v2/api/data/bound-included.mdx index 7f0e2b28..f8bd3942 100644 --- a/docs/src/content/docs/zh-CN/v2/api/data/bound-included.mdx +++ b/docs/src/content/docs/zh-CN/v2/api/data/bound-included.mdx @@ -12,9 +12,9 @@ import Badge from "~/components/zh-CN/Badge.astro"; ### 导入 ```ts -import { BoundIncluded } from "@tai-kun/surrealdb/data-types/decode-only"; -import { BoundIncluded } from "@tai-kun/surrealdb/data-types/encodable"; -import { BoundIncluded } from "@tai-kun/surrealdb/data-types/standard"; +import { BoundIncluded } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { BoundIncluded } from "@tai-kun/surrealdb/encodable-datatypes"; +import { BoundIncluded } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -29,7 +29,7 @@ new BoundIncluded(source: unknown); ##### `source` -待调查。 +正在调查中。 #### 返回值 @@ -37,4 +37,4 @@ new BoundIncluded(source: unknown); ### `.value` -待调查。 +正在调查中。 diff --git a/docs/src/content/docs/zh-CN/v2/api/data/datetime.mdx b/docs/src/content/docs/zh-CN/v2/api/data/datetime.mdx index 1a3ce41a..e1d61467 100644 --- a/docs/src/content/docs/zh-CN/v2/api/data/datetime.mdx +++ b/docs/src/content/docs/zh-CN/v2/api/data/datetime.mdx @@ -5,14 +5,14 @@ slug: zh-CN/v2/api/data/datetime import Badge from "~/components/zh-CN/Badge.astro"; -`Datetime` 是用于表示日期和时间的类,对应 SurrealQL 中的 [`datetime`](https://surrealdb.com/docs/surrealql/datamodel/datetimes) 类型。 +`Datetime` 是一个用于表示日期和时间的类。它对应 SurrealQL 的 [`datetime`](https://surrealdb.com/docs/surrealql/datamodel/datetimes) 类型。 ### 导入 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Datetime } from "@tai-kun/surrealdb/data-types/encodable"; -import { Datetime } from "@tai-kun/surrealdb/data-types/standard"; +import { Datetime } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Datetime } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Datetime } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -47,19 +47,19 @@ new Datetime( ##### `source` -秒数和纳秒数对,或字符串。如果预设是标准的,则还支持 `Date` 对象或 `bigint` 的输入。 +秒数和纳秒数的数组,或者字符串。如果预设为 standard,还可以接受 `Date` 对象或 `bigint` 作为输入。 ##### `year`, `monthIndex`, ... -与 `Date` 类中的参数相同。但它也支持 `nanoseconds` 的输入。在提供 `undefined` 的参数之后不能再提供 `number`。这与 `Date` 类大致相同。 +与 `Date` 类的参数相同。但它也支持 `nanoseconds` 的输入。在提供 `undefined` 的参数之后,不能再提供 `number`。这与 `Date` 类的规范大体相同。 #### 返回值 -如果通过 `new` 调用,`Datetime` 会返回其实例。如果预设是标准的,它也是 `Date` 的实例。 +如果通过 `new` 调用,`Datetime` 会返回其实例。如果预设为 standard,它也是 `Date` 的实例。 ### `.seconds` -纳秒精度时间戳的秒数部分。在低于标准的预设中,它是只读的。该值是一个介于 -253-1 到 253-1 之间的整数或 `NaN`。 +纳秒精度的时间的秒数部分。在 standard 以下的预设中,它是只读的。值是一个 -253-1 到 253-1 之间的整数或 `NaN`。 ```ts .seconds: number; @@ -67,7 +67,7 @@ new Datetime( ### `.nanoseconds` -纳秒精度时间戳的纳秒数部分。在低于标准的预设中,它是只读的。该值是一个介于 0 到 999999999 之间的整数或 `NaN`。 +纳秒精度的时间的纳秒数部分。在 standard 以下的预设中,它是只读的。值是一个 0 到 999999999 之间的整数或 `NaN`。 ```ts .nanoseconds: number; @@ -75,7 +75,7 @@ new Datetime( ### `.valueOf()` -获取毫秒精度时间戳。 +获取毫秒精度的时间。 ```ts .valueOf(): number; @@ -87,12 +87,12 @@ new Datetime( #### 返回值 -返回毫秒精度时间戳。 +返回毫秒精度的时间。 #### 例子 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/encodable"; +import { Datetime } from "@tai-kun/surrealdb/encodable-datatypes"; const date = new Datetime("2024-06-01T12:34:56.780123456Z"); console.log(date.valueOf()); @@ -101,7 +101,7 @@ console.log(date.valueOf()); ### `.toString()` -获取毫秒精度时间戳的字符串表示。与 `Date` 对象的 `.toString()` 相同。 +获取毫秒精度的时间的字符串表示。与 `Date` 对象的 `.toString()` 相同。 ```ts .toString(): string; @@ -113,21 +113,21 @@ console.log(date.valueOf()); #### 返回值 -返回毫秒精度时间戳的字符串表示。 +返回毫秒精度的时间的字符串表示。 #### 例子 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/encodable"; +import { Datetime } from "@tai-kun/surrealdb/encodable-datatypes"; const date = new Datetime("2024-06-01T12:34:56.780123456Z"); console.log(date.toString()); -//-> Sat Jun 01 2024 21:34:56 GMT+0900 (日本标准时) +//-> Sat Jun 01 2024 21:34:56 GMT+0900 (日本標準時) ``` ### `.toISOString()` -获取纳秒精度时间戳的 ISO 格式字符串。与 `Date` 对象的 `.toISOString()` 类似,但由于是纳秒精度,因此会被序列化到小数点后第九位。 +获取纳秒精度的时间的 ISO 形式字符串。与 `Date` 对象的 `.toISOString()` 相似,但它具有纳秒精度,因此会将字符串化到小数点后第九位。 ```ts .toISOString(): string; @@ -139,12 +139,12 @@ console.log(date.toString()); #### 返回值 -返回纳秒精度时间戳的 ISO 格式字符串。 +返回纳秒精度的时间的 ISO 形式字符串。 #### 例子 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/encodable"; +import { Datetime } from "@tai-kun/surrealdb/encodable-datatypes"; const date = new Datetime([1717245296, 780123456]); console.log(date.toISOString()); @@ -169,7 +169,7 @@ console.log(date.toISOString()); ### `.toSurql()` -将 `Datetime` 对象转换为可嵌入 SurrealQL 的字符串。与 `.toISOString()` 类似,但添加 `d` 前缀以告诉查询解析器该字符串是一个 UUID。 +将 `Datetime` 对象转换为可以嵌入 SurrealQL 的字符串。与 `.toISOString()` 相似,但通过添加 `d` 前缀,告知查询解析器该字符串是 UUID。 ```ts .toSurql(): string; @@ -181,12 +181,12 @@ console.log(date.toISOString()); #### 返回值 -返回带有 `d` 前缀的 ISO 格式日期时间。 +返回带有 `d` 前缀的 ISO 形式日期时间。 #### 例子 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/encodable"; +import { Datetime } from "@tai-kun/surrealdb/encodable-datatypes"; const date = new Datetime([1717245296, 780123456]); console.log(date.toSurql()); @@ -225,12 +225,12 @@ console.log(date.toSurql()); #### 返回值 -返回毫秒精度时间戳。 +返回毫秒精度的时间。 #### 例子 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/standard"; +import { Datetime } from "@tai-kun/surrealdb/standard-datatypes"; const date = new Datetime(0); const time = dt.setCompact([1717245296, 780123456]); @@ -240,9 +240,9 @@ console.log(time); ### `.getMicroseconds()` -使用本地时间获取日期的微秒。 +使用本地时间获取日期的微秒数。 -`.getUTCMicroseconds()` 与该方法的行为相同。 +`.getUTCMicroseconds()` 与此方法的行为相同。 ```ts .getMicroseconds(): number; @@ -254,12 +254,12 @@ console.log(time); #### 返回值 -返回微秒。 +返回微秒数。 #### 例子 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/standard"; +import { Datetime } from "@tai-kun/surrealdb/standard-datatypes"; const date = new Datetime([1717245296, 780123456]); console.log(date.toISOString()); @@ -274,9 +274,9 @@ console.log(date.getMicroseconds()); ### `.setMicroseconds()` -设置微秒。 +设置微秒数。 -`.setUTCMicroseconds()` 与该方法的行为相同。 +`.setUTCMicroseconds()` 与此方法的行为相同。 ```ts .setMicroseconds(us: number): number; @@ -286,16 +286,16 @@ console.log(date.getMicroseconds()); ##### `us` -要设置的微秒。该值将被转换为整数。请注意,如果值不在 0 到 999 之间,则整个时间戳将受到影响。 +要设置的微秒数。值将被转换为整数。请注意,如果值不在 0 到 999 之间,则整个时间将受到影响。 #### 返回值 -返回毫秒精度时间戳。 +返回毫秒精度的时间。 #### 例子 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/standard"; +import { Datetime } from "@tai-kun/surrealdb/standard-datatypes"; const date = new Datetime([1717245296, 780123456]); console.log(date.toISOString()); @@ -310,9 +310,9 @@ console.log(time); ### `.getNanoseconds()` -使用本地时间获取日期的纳秒。 +使用本地时间获取日期的纳秒数。 -`.getUTCNanoseconds()` 与该方法的行为相同。 +`.getUTCNanoseconds()` 与此方法的行为相同。 ```ts .getNanoseconds(): number; @@ -324,12 +324,12 @@ console.log(time); #### 返回值 -返回纳秒。 +返回纳秒数。 #### 例子 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/standard"; +import { Datetime } from "@tai-kun/surrealdb/standard-datatypes"; const date = new Datetime([1717245296, 780123456]); console.log(date.toISOString()); @@ -344,9 +344,9 @@ console.log(date.getNanoseconds()); ### `.setNanoseconds()` -设置纳秒。 +设置纳秒数。 -`.setUTCNanoseconds()` 与该方法的行为相同。 +`.setUTCNanoseconds()` 与此方法的行为相同。 ```ts .setNanoseconds(us: number): number; @@ -356,16 +356,16 @@ console.log(date.getNanoseconds()); ##### `us` -要设置的纳秒。该值将被转换为整数。请注意,如果值不在 0 到 999 之间,则整个时间戳将受到影响。 +要设置的纳秒数。值将被转换为整数。请注意,如果值不在 0 到 999 之间,则整个时间将受到影响。 #### 返回值 -返回毫秒精度时间戳。 +返回毫秒精度的时间。 #### 例子 ```ts -import { Datetime } from "@tai-kun/surrealdb/data-types/standard"; +import { Datetime } from "@tai-kun/surrealdb/standard-datatypes"; const date = new Datetime([1717245296, 780123456]); console.log(date.toISOString()); @@ -380,7 +380,7 @@ console.log(time); ### `.clone()` -复制 `Datetime` 对象。 +克隆 `Datetime` 对象。 ```ts .clone(): this; @@ -394,19 +394,19 @@ console.log(time); 返回一个新的 `Datetime` 对象。如果继承了 `Datetime` 类,则返回该类的实例。 -### 扩展 +### 发展 -#### `Datetime` 对象的通用判断 +#### `Datetime` 对象的通用判定 -建议使用 `isDatetime` 函数来判断一个值是否为 `Datetime` 对象,而无需依赖预设。该函数不使用 `instanceof`,因此在验证值的预设未知时很有用。 +建议使用 `isDatetime` 函数来判断值是否是 `Datetime` 对象,而不依赖于预设。该函数不使用 `instanceof`,因此在验证值的预设未知时非常有用。 ```ts import { isDatetime } from "@tai-kun/surrealdb"; ``` -#### 早于 UNIX 纪元的日期时间 +#### UNIX 纪元之前的时间 -SurrealDB 的 `datetime` 类型可以精确到纳秒。因此,在 JavaScript 中处理它时要小心。如果将 SurrealDB 序列化的 `datetime`,例如 `"1969-12-31T23:59:59.999999999Z"` 传递给 JavaScript 的 `Date.parse`,那么在 WebKit 中它将是 0 毫秒,而在其他环境(Node.js、Deno、Bun、Chromium、Firefox)中则是 -1 毫秒。 +SurrealDB 的 `datetime` 类型可以精确到纳秒。因此在 JavaScript 中处理时需要小心。如果将 SurrealDB 序列化的 `datetime`,例如 `"1969-12-31T23:59:59.999999999Z"`,传递给 JavaScript 的 `Date.parse`,它会在 WebKit 中返回 0 毫秒,但在其他环境(Node.js, Deno, Bun, Chromium, Firefox)中会返回 -1 毫秒。 WebKit: @@ -416,7 +416,7 @@ console.log(date.getTime()); //-> 0 ``` -Node.js、Deno、Bun、Chromium、Firefox: +Node.js, Deno, Bun, Chromium, Firefox: ```ts const date = new Date("1969-12-31T23:59:59.999999999Z"); diff --git a/docs/src/content/docs/zh-CN/v2/api/data/decimal.mdx b/docs/src/content/docs/zh-CN/v2/api/data/decimal.mdx index 26d100fc..8940e750 100644 --- a/docs/src/content/docs/zh-CN/v2/api/data/decimal.mdx +++ b/docs/src/content/docs/zh-CN/v2/api/data/decimal.mdx @@ -5,19 +5,19 @@ slug: zh-CN/v2/api/data/decimal import Badge from "~/components/zh-CN/Badge.astro"; -`Decimal` 是用于表示任意精度的实数的类。如果预设为 standard,则该类将继承 [`big.js`](https://github.com/MikeMcl/big.js) 类。因此,`.toString()` 方法等的结果在不同预设之间可能不一致。 +`Decimal` 是用于表示任意精度实数的类。当预设为 `standard` 时,它将继承 [`big.js`](https://github.com/MikeMcl/big.js) 的类。这可能会导致 `.toString()` 方法等结果在不同预设之间不一致。 ### 导入 ```ts -import { Decimal } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Decimal } from "@tai-kun/surrealdb/data-types/encodable"; -import { Decimal } from "@tai-kun/surrealdb/data-types/standard"; +import { Decimal } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Decimal } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Decimal } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` -创建新的 `Decimal` 对象。 +创建一个新的 `Decimal` 对象。 ```ts new Decimal(source: string); // decode-only, encodable @@ -28,15 +28,15 @@ new Decimal(source: string | number | Decimal); // standard ##### `source` -表示实数的字符串。如果预设为 standard,则也可以传入数字。 +以字符串形式表示的实数。当预设为 `standard` 时,也可以传入数字。 #### 返回值 -通过 `new` 调用时,`Decimal` 将返回其实例。 +当通过 `new` 调用时,`Decimal` 将返回其实例。 ### `.toString()` -获取实数的字符串形式。 +获取实数的字符串表示。 #### 参数 @@ -48,7 +48,7 @@ new Decimal(source: string | number | Decimal); // standard ### `.toSurql()` -将 `Decimal` 对象转换为可以嵌入 SurrealQL 的字符串。与 `.toString()` 相似,但它通过添加 `dec` 后缀来告知查询解析器该字符串是 `decimal` 类型。 +将 `Decimal` 对象转换为可以嵌入 SurrealQL 的字符串。类似于 `.toString()`,但会添加 `dec` 后缀,以便让查询解析器知道该字符串是 `decimal` 类型。 ```ts .toSurql(): string; @@ -65,7 +65,7 @@ new Decimal(source: string | number | Decimal); // standard #### 例子 ```ts -import { Decimal } from "@tai-kun/surrealdb/data-types/encodable"; +import { Decimal } from "@tai-kun/surrealdb/encodable-datatypes"; const decimal = new Decimal("3.14"); console.log(decimal.toSurql()); @@ -86,19 +86,19 @@ console.log(decimal.toSurql()); #### 返回值 -返回新的 `Decimal` 对象。如果继承了 `Decimal` 类,则返回该类的实例。 +返回一个新的 `Decimal` 对象。如果继承了 `Decimal` 类,则返回该类的实例。 ### 其他方法 -如果使用 standard 预设,则 `Decimal` 类继承自 `big.js` 的 `Big` 类,因此实例方法和属性请参考 `big.js` 文档: +如果使用 `standard` 预设,则 `Decimal` 类将继承 `big.js` 的 `Big` 类,因此实例方法和属性请参考 `big.js` 文档: [`big.js` 文档](https://mikemcl.github.io/big.js/#prototype-methods) -### 扩展 +### 拓展 -#### `Decimal` 对象的通用判定 +#### `Decimal` 对象的通用判断 -建议使用 `isDecimal` 函数来判断值是否是 `Decimal` 对象,而不用依赖预设。该函数不使用 `instanceof`,因此在验证值的预设未知时非常有用。 +建议使用 `isDecimal` 函数来判断值是否为 `Decimal` 对象,而无需依赖预设。此函数不使用 `instanceof`,因此在验证值预设未知的情况下非常有用。 ```ts import { isDecimal } from "@tai-kun/surrealdb"; diff --git a/docs/src/content/docs/zh-CN/v2/api/data/duration.mdx b/docs/src/content/docs/zh-CN/v2/api/data/duration.mdx index 18c0113e..f6da2b11 100644 --- a/docs/src/content/docs/zh-CN/v2/api/data/duration.mdx +++ b/docs/src/content/docs/zh-CN/v2/api/data/duration.mdx @@ -1,18 +1,18 @@ --- -title: 时长 +title: 持续时间 slug: zh-CN/v2/api/data/duration --- import Badge from "~/components/zh-CN/Badge.astro"; -`Duration` 是用于表示时长的类。 +`Duration` 是一个表示持续时间的类。 ### 导入 ```ts -import { Duration } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Duration } from "@tai-kun/surrealdb/data-types/encodable"; -import { Duration } from "@tai-kun/surrealdb/data-types/standard"; +import { Duration } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Duration } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Duration } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -40,9 +40,9 @@ new Duration( ##### `source` -秒数和纳秒数对。如果预设为 standard,则可以将更多值转换为 `Duration` 对象。 +秒数和纳秒数的配对。如果预设为 standard,则可以将更多值转换为 `Duration` 对象。 -`number` 类型的输入以毫秒为单位计算。这适用于将两个 `Date` 对象之间的差转换为 `Duration` 对象的情况: +`number` 类型的输入以毫秒为单位计算。这适用于将两个 `Date` 对象的差值转换为 `Duration` 对象的用途: ```ts const begin = new Date("2024-06-01T12:00:00.000Z"); @@ -50,7 +50,7 @@ const end = new Date("2024-06-01T21:00:00.000Z"); new Duration(end - begin); ``` -`bigint` 类型的输入以纳秒为单位计算。这适用于将例如 [`process.hrtime.bigint()`](https://nodejs.org/api/process.html#processhrtimebigint) 返回的纳秒转换为 `Duration` 对象的情况: +`bigint` 类型的输入以纳秒为单位计算。这适用于将例如 [`process.hrtime.bigint()`](https://nodejs.org/api/process.html#processhrtimebigint) 返回的纳秒等高精度时间转换为 `Duration` 对象的用途: ```ts const begin = process.hrtime.bigint(); @@ -59,11 +59,11 @@ const end = process.hrtime.bigint(); new Duration(end - begin); ``` -`string` 类型的输入必须是时长字符串表示形式。时长字符串表示形式是指由数字和单位组成,并连续排列的格式。例如,`1h4h30m20s1350ms` 表示“1 天 4 小时 30 分 21 秒 350 毫秒”。可用的单位如下: +`string` 类型的输入必须是持续时间的字符串表示形式。持续时间的字符串表示形式是指数字和单位组合在一起,并连续排列的格式。例如 `1h4h30m20s1350ms` 表示“1 天 4 小时 30 分钟,21 秒 350 毫秒”。可用的单位如下: | 单位 | 描述 | 转换 | | --- | --- | --- | -| `ns` | 纳秒 | | +| `ns` | 纳秒 | | `us` | 微秒 | `1us` -> `1000ns` | | `ms` | 毫秒 | `1ms` -> `1000us` | | `s` | 秒 | `1s` -> `1000ms` | @@ -73,15 +73,15 @@ new Duration(end - begin); | `w` | 周 | `1w` -> `7d` | | `y` | 年 | `1y` -> `365d` | -`us` (`0x75`, `0x73`) 也可以写成 `µs` (`0xc2`, `0xb5`, `0x73`) 或 `μs` (`0xce`, `0xbc`, `0x73`)(括号内的 16 进制数是单位字符串的 UTF-8 编码结果)。 +`us` (`0x75`, `0x73`) 也可以写成 `µs` (`0xc2`, `0xb5`, `0x73`) 或 `μs` (`0xce`, `0xbc`, `0x73`)(括号中的十六进制数是单位字符串的 UTF-8 编码结果)。 #### 返回值 -如果通过 `new` 调用,`Duration` 将返回其实例。 +如果通过 `new` 调用,`Duration` 会返回其实例。 ### `.seconds` -时长的秒数部分。在低于 standard 的预设中,它是只读的。该值为 0 到 264-1 之间的整数。 +持续时间的秒数部分。在低于 standard 的预设中,它是只读的。该值为 0 到 264-1 之间的整数。 ```ts .seconds: bigint; @@ -89,7 +89,7 @@ new Duration(end - begin); ### `.nanoseconds` -时长的纳秒数部分。在低于 standard 的预设中,它是只读的。该值为 0 到 999999999 之间的整数。 +持续时间的纳秒数部分。在低于 standard 的预设中,它是只读的。该值为 0 到 999999999 之间的整数。 ```ts .nanoseconds: number; @@ -97,7 +97,7 @@ new Duration(end - begin); ### `.parse()` -将时长映射到各个单位。每个单位的值都大于等于 0 且小于该单位的最大值。注意,如果时长为 0,则返回的将是一个仅具有 `nanoseconds` 属性且值为 `0` 的对象。 +将持续时间映射到各个单位。每个单位的值都大于等于 0,小于该单位的最大值。此外,如果持续时间为 0,则将返回一个仅 `nanoseconds` 属性为 `0` 的对象。 ```ts .parse(): { @@ -119,12 +119,12 @@ new Duration(end - begin); #### 返回值 -返回将时长映射到各个单位的结果。如果单位的值为 0,则该属性将被省略,但如果时长为 0,则将返回一个仅具有 `nanoseconds` 属性且值为 `0` 的对象。 +返回将持续时间映射到各个单位的结果。如果单位的值为 0,则该属性将被省略,但如果持续时间为 0,则仅返回 `nanoseconds` 为 `0` 的对象。 #### 例子 ```ts -import { Duration } from "@tai-kun/surrealdb/data-types/encodable"; +import { Duration } from "@tai-kun/surrealdb/encodable-datatypes"; const duration = new Duration(0); console.log(duration.parse()); @@ -132,7 +132,7 @@ console.log(duration.parse()); ``` ```ts -import { Duration } from "@tai-kun/surrealdb/data-types/encodable"; +import { Duration } from "@tai-kun/surrealdb/encodable-datatypes"; const duration = new Duration(12_345_000n); console.log(duration.parse()); @@ -141,7 +141,7 @@ console.log(duration.parse()); ### `.valueOf()` -以纳秒为单位获取时长。 +以纳秒为单位获取持续时间。 ```ts .valueOf(): bigint; @@ -153,10 +153,10 @@ console.log(duration.parse()); #### 返回值 -以纳秒为单位返回时长。 +以纳秒为单位返回持续时间。 ```ts -import { Duration } from "@tai-kun/surrealdb/data-types/encodable"; +import { Duration } from "@tai-kun/surrealdb/encodable-datatypes"; const duration = new Duration(12_345_000n); console.log(duration.valueOf()); @@ -165,9 +165,9 @@ console.log(duration.valueOf()); ### `.toString()` -获取时长的字符串表示形式。 +获取持续时间的字符串表示形式。 -`.toJSON()` 和 `.toSurql()` 返回与该方法相同的结果。 +`.toJSON()` 和 `.toSurql()` 会返回与该方法相同的结果。 ```ts .toString(): string; @@ -179,12 +179,12 @@ console.log(duration.valueOf()); #### 返回值 -获取毫秒精度的时长字符串表示形式。 +获取毫秒精度的时刻的字符串表示形式。 #### 例子 ```ts -import { Duration } from "@tai-kun/surrealdb/data-types/encodable"; +import { Duration } from "@tai-kun/surrealdb/encodable-datatypes"; const duration = new Duration(12_345_000n); console.log(duration.toString()); @@ -193,7 +193,7 @@ console.log(duration.toString()); ### `.toISOString()` -获取时长字符串的 ISO 格式。 +以 ISO 格式获取持续时间的字符串。 ```ts .toISOString(): string; @@ -205,12 +205,12 @@ console.log(duration.toString()); #### 返回值 -以 ISO 格式返回时长字符串。 +以 ISO 格式返回持续时间的字符串。 #### 例子 ```ts -import { Duration } from "@tai-kun/surrealdb/data-types/encodable"; +import { Duration } from "@tai-kun/surrealdb/encodable-datatypes"; const duration = new Duration("2m3s456ms"); console.log(duration.toISOString()); @@ -219,7 +219,7 @@ console.log(duration.toISOString()); ### `.getCompact()` -获取秒数和纳秒数对。 +获取秒数和纳秒数的配对。 ```ts .getCompact(): [seconds: bigint, nanoseconds: number]; @@ -231,11 +231,11 @@ console.log(duration.toISOString()); #### 返回值 -返回秒数和纳秒数对。 +返回秒数和纳秒数的配对。 ### `.setCompact()` -使用秒数和纳秒数对设置时间。 +使用秒数和纳秒数的配对设置日期时间。 ```ts .setCompact(compact: [seconds: bigint, nanoseconds: number]): void; @@ -245,7 +245,7 @@ console.log(duration.toISOString()); ##### `compact` -秒数和纳秒数对。 +秒数和纳秒数的配对。 #### 返回值 @@ -253,7 +253,7 @@ console.log(duration.toISOString()); ### `.getYears()` -获取年数。如果结果不是大于等于 0 的整数,则返回 0。 +获取年。如果结果不是大于等于 0 的整数,则返回 0。 ```ts .getYears(): number; @@ -265,11 +265,11 @@ console.log(duration.toISOString()); #### 返回值 -返回表示年数的大于等于 0 的整数。 +返回表示年的大于等于 0 的整数。 ### `.addYears()` -从时长中添加指定年数。 +从持续时间中添加指定数量的年。 ```ts .addYears(value: number): void; @@ -287,7 +287,7 @@ console.log(duration.toISOString()); ### `.subYears()` -从时长中减去指定年数。 +从持续时间中减去指定数量的年。 ```ts .subYears(value: number): void; @@ -321,7 +321,7 @@ console.log(duration.toISOString()); ### `.getWeeks()` -获取周数。如果结果不是大于等于 0 的整数,则返回 0。 +获取周。如果结果不是大于等于 0 的整数,则返回 0。 ```ts .getWeeks(): number; @@ -333,11 +333,11 @@ console.log(duration.toISOString()); #### 返回值 -返回表示周数的大于等于 0 的整数。 +返回表示周的大于等于 0 的整数。 ### `.addWeeks()` -从时长中添加指定周数。 +从持续时间中添加指定数量的周。 ```ts .addWeeks(value: number): void; @@ -355,7 +355,7 @@ console.log(duration.toISOString()); ### `.subWeeks()` -从时长中减去指定周数。 +从持续时间中减去指定数量的周。 ```ts .subWeeks(value: number): void; @@ -389,7 +389,7 @@ console.log(duration.toISOString()); ### `.getDays()` -获取天数。如果结果不是大于等于 0 的整数,则返回 0。 +获取日。如果结果不是大于等于 0 的整数,则返回 0。 ```ts .getDays(): number; @@ -401,11 +401,11 @@ console.log(duration.toISOString()); #### 返回值 -返回表示天数的大于等于 0 的整数。 +返回表示日的大于等于 0 的整数。 ### `.addDays()` -从时长中添加指定天数。 +从持续时间中添加指定数量的日。 ```ts .addDays(value: number): void; @@ -415,7 +415,7 @@ console.log(duration.toISOString()); ##### `value` -天数。 +日数。 #### 返回值 @@ -423,7 +423,7 @@ console.log(duration.toISOString()); ### `.subDays()` -从时长中减去指定天数。 +从持续时间中减去指定数量的日。 ```ts .subDays(value: number): void; @@ -433,7 +433,7 @@ console.log(duration.toISOString()); ##### `value` -天数。 +日数。 #### 返回值 @@ -441,7 +441,7 @@ console.log(duration.toISOString()); ### `.asDays()` -获取天数的毫秒表示形式。 +获取日数的毫秒表示形式。 ```ts .asDays(): number; @@ -453,11 +453,11 @@ console.log(duration.toISOString()); #### 返回值 -天数的毫秒表示形式。 +日数的毫秒表示形式。 ### `.getHours()` -获取小时数。如果结果不是大于等于 0 的整数,则返回 0。 +获取时。如果结果不是大于等于 0 的整数,则返回 0。 ```ts .getHours(): number; @@ -469,11 +469,11 @@ console.log(duration.toISOString()); #### 返回值 -返回表示小时数的大于等于 0 的整数。 +返回表示时的大于等于 0 的整数。 ### `.addHours()` -从时长中添加指定小时数。 +从持续时间中添加指定数量的时。 ```ts .addHours(value: number): void; @@ -483,7 +483,7 @@ console.log(duration.toISOString()); ##### `value` -小时数。 +时数。 #### 返回值 @@ -491,7 +491,7 @@ console.log(duration.toISOString()); ### `.subHours()` -从时长中减去指定小时数。 +从持续时间中减去指定数量的时。 ```ts .subHours(value: number): void; @@ -501,7 +501,7 @@ console.log(duration.toISOString()); ##### `value` -小时数。 +时数。 #### 返回值 @@ -509,7 +509,7 @@ console.log(duration.toISOString()); ### `.asHours()` -获取小时数的毫秒表示形式。 +获取时数的毫秒表示形式。 ```ts .asHours(): number; @@ -521,11 +521,11 @@ console.log(duration.toISOString()); #### 返回值 -小时数的毫秒表示形式。 +时数的毫秒表示形式。 ### `.getMinutes()` -获取分钟数。如果结果不是大于等于 0 的整数,则返回 0。 +获取分。如果结果不是大于等于 0 的整数,则返回 0。 ```ts .getMinutes(): number; @@ -537,11 +537,11 @@ console.log(duration.toISOString()); #### 返回值 -返回表示分钟数的大于等于 0 的整数。 +返回表示分的大于等于 0 的整数。 ### `.addMinutes()` -从时长中添加指定分钟数。 +从持续时间中添加指定数量的分。 ```ts .addMinutes(value: number): void; @@ -551,7 +551,7 @@ console.log(duration.toISOString()); ##### `value` -分钟数。 +分数。 #### 返回值 @@ -559,7 +559,7 @@ console.log(duration.toISOString()); ### `.subMinutes()` -从时长中减去指定分钟数。 +从持续时间中减去指定数量的分。 ```ts .subMinutes(value: number): void; @@ -569,7 +569,7 @@ console.log(duration.toISOString()); ##### `value` -分钟数。 +分数。 #### 返回值 @@ -577,7 +577,7 @@ console.log(duration.toISOString()); ### `.asMinutes()` -获取分钟数的毫秒表示形式。 +获取分数的毫秒表示形式。 ```ts .asMinutes(): number; @@ -589,11 +589,11 @@ console.log(duration.toISOString()); #### 返回值 -分钟数的毫秒表示形式。 +分数的毫秒表示形式。 ### `.getSeconds()` -获取秒数。如果结果不是大于等于 0 的整数,则返回 0。 +获取秒。如果结果不是大于等于 0 的整数,则返回 0。 ```ts .getSeconds(): number; @@ -605,11 +605,11 @@ console.log(duration.toISOString()); #### 返回值 -返回表示秒数的大于等于 0 的整数。 +返回表示秒的大于等于 0 的整数。 ### `.addSeconds()` -从时长中添加指定秒数。 +从持续时间中添加指定数量的秒。 ```ts .addSeconds(value: number): void; @@ -627,7 +627,7 @@ console.log(duration.toISOString()); ### `.subSeconds()` -从时长中减去指定秒数。 +从持续时间中减去指定数量的秒。 ```ts .subSeconds(value: number): void; @@ -661,7 +661,7 @@ console.log(duration.toISOString()); ### `.getMilliseconds()` -获取毫秒数。如果结果不是大于等于 0 的整数,则返回 0。 +获取毫秒。如果结果不是大于等于 0 的整数,则返回 0。 ```ts .getMilliseconds(): number; @@ -673,11 +673,11 @@ console.log(duration.toISOString()); #### 返回值 -返回表示毫秒数的大于等于 0 的整数。 +返回表示毫秒的大于等于 0 的整数。 ### `.addMilliseconds()` -从时长中添加指定毫秒数。 +从持续时间中添加指定数量的毫秒。 ```ts .addMilliseconds(value: number): void; @@ -695,7 +695,7 @@ console.log(duration.toISOString()); ### `.subMilliseconds()` -从时长中减去指定毫秒数。 +从持续时间中减去指定数量的毫秒。 ```ts .subMilliseconds(value: number): void; @@ -729,7 +729,7 @@ console.log(duration.toISOString()); ### `.getMicroseconds()` -获取微秒数。如果结果不是大于等于 0 的整数,则返回 0。 +获取微秒。如果结果不是大于等于 0 的整数,则返回 0。 ```ts .getMicroseconds(): number; @@ -741,11 +741,11 @@ console.log(duration.toISOString()); #### 返回值 -返回表示微秒数的大于等于 0 的整数。 +返回表示微秒的大于等于 0 的整数。 ### `.addMicroseconds()` -从时长中添加指定微秒数。 +从持续时间中添加指定数量的微秒。 ```ts .addMicroseconds(value: number): void; @@ -763,7 +763,7 @@ console.log(duration.toISOString()); ### `.subMicroseconds()` -从时长中减去指定微秒数。 +从持续时间中减去指定数量的微秒。 ```ts .subMicroseconds(value: number): void; @@ -797,7 +797,7 @@ console.log(duration.toISOString()); ### `.getNanoseconds()` -获取纳秒数。如果结果不是大于等于 0 的整数,则返回 0。 +获取纳秒。如果结果不是大于等于 0 的整数,则返回 0。 ```ts .getNanoseconds(): number; @@ -809,11 +809,11 @@ console.log(duration.toISOString()); #### 返回值 -返回表示纳秒数的大于等于 0 的整数。 +返回表示纳秒的大于等于 0 的整数。 ### `.addNanoseconds()` -从时长中添加指定纳秒数。 +从持续时间中添加指定数量的纳秒。 ```ts .addNanoseconds(value: number): void; @@ -831,7 +831,7 @@ console.log(duration.toISOString()); ### `.subNanoseconds()` -从时长中减去指定纳秒数。 +从持续时间中减去指定数量的纳秒。 ```ts .subNanoseconds(value: number): void; diff --git a/docs/src/content/docs/zh-CN/v2/api/data/future.mdx b/docs/src/content/docs/zh-CN/v2/api/data/future.mdx index f9243eba..1abdc054 100644 --- a/docs/src/content/docs/zh-CN/v2/api/data/future.mdx +++ b/docs/src/content/docs/zh-CN/v2/api/data/future.mdx @@ -1,5 +1,5 @@ --- -title: 未来值 +title: 未来 slug: zh-CN/v2/api/data/future banner: content: 这是一个实验性功能。 @@ -7,19 +7,19 @@ banner: import Badge from "~/components/zh-CN/Badge.astro"; -`Future` 是 SurrealDB [未来值功能](https://surrealdb.com/docs/surrealql/datamodel/futures) 的表示类。 +`Future` 类表示 SurrealDB 的 [Futures 功能](https://surrealdb.com/docs/surrealql/datamodel/futures)。 ### 导入 ```ts -import { Future } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Future } from "@tai-kun/surrealdb/data-types/encodable"; -import { Future } from "@tai-kun/surrealdb/data-types/standard"; +import { Future } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Future } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Future } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` -创建新的 `Future` 对象。 +创建一个新的 `Future` 对象。 ```ts new Future(source: string); @@ -29,15 +29,15 @@ new Future(source: string); ##### `source` -future 块内的值或表达式。 +future 块中的值或表达式。 #### 返回值 -如果通过 `new` 调用,`Future` 将返回其实例。 +当通过 `new` 调用时,`Future` 将返回其实例。 ### `.block` -future 块内的值或表达式。 +future 块中的值或表达式。 ```ts .block: number; @@ -57,12 +57,12 @@ future 块内的值或表达式。 #### 返回值 -返回 future 块内的值或表达式。 +返回 future 块中的值或表达式。 -#### 示例 +#### 例子 ```ts -import { Future } from "@tai-kun/surrealdb/data-types/encodable"; +import { Future } from "@tai-kun/surrealdb/encodable-datatypes"; const future = new Future(`time::now()`); console.log(future.toString()); @@ -71,7 +71,7 @@ console.log(future.toString()); ### `.toSurql()` -将 `Future` 对象转换为可嵌入 SurrealQL 的字符串。类似于 `.toString()`,但块被波括号(`{}`)包围,并用 `` 转换。 +将 `Future` 对象转换为可以嵌入 SurrealQL 的字符串。与 `.toString()` 相似,但块将用波括号 (`{}`) 包围并用 `` 强制转换。 ```ts .toSurql(): string; @@ -83,12 +83,12 @@ console.log(future.toString()); #### 返回值 -返回可嵌入 SurrealQL 的 future。 +返回可以嵌入 SurrealQL 的 future。 -#### 示例 +#### 例子 ```ts -import { Future } from "@tai-kun/surrealdb/data-types/encodable"; +import { Future } from "@tai-kun/surrealdb/encodable-datatypes"; const future = new Future(`time::now()`); console.log(future.toSurql()); @@ -97,7 +97,7 @@ console.log(future.toSurql()); ### `.surql()` -此方法有助于编写 SurrealQL 代码。可以使用模板字面量来编写 SurrealQL 代码。嵌入模板字面量的值将自动转换为 SurrealQL。此外,如果您安装了 [SurrealDB 官方扩展](https://marketplace.visualstudio.com/items?itemName=surrealdb.surrealql) ,VSCode 中的模板字面量的语法高亮将生效。 +此方法有助于编写 SurrealQL。您可以使用模板字面量来编写 SurrealQL。嵌入到模板字面量中的值将自动转换为 SurrealQL。此外,如果您在 VSCode 中安装了 [SurrealDB 官方扩展](https://marketplace.visualstudio.com/items?itemName=surrealdb.surrealql),则模板字面量的语法高亮将生效。 ```ts .surql(texts: TemplateStringsArray, ...values: unknown[]): string; @@ -111,16 +111,16 @@ console.log(future.toSurql()); ##### `values` -在 `texts` 的每个元素之间嵌入的值。 +要嵌入到每个 `texts` 元素之间的值。 #### 返回值 -SurrealQL 代码。 +SurrealQL。 -#### 示例 +#### 例子 ```ts -import { Future, Thing } from "@tai-kun/surrealdb/data-types/standard"; +import { Future, Thing } from "@tai-kun/surrealdb/standard-datatypes"; const foo = "foo"; const rid = new Thing("person", "tai-kun"); @@ -137,10 +137,10 @@ console.log(future.toSurql()); //-> } ``` -如果不使用 `.surql()`,上述示例将变为: +如果不使用 `.surql()`,上面的例子将是: ```ts -import { Future, Thing } from "@tai-kun/surrealdb/data-types/standard"; +import { Future, Thing } from "@tai-kun/surrealdb/standard-datatypes"; import { toSurql } from "@tai-kun/surrealdb/utils"; const foo = "foo"; @@ -158,14 +158,14 @@ console.log(future.toSurql()); //-> } ``` -- 必须使用 `toSurql` 辅助函数或 `.toSurql()` 方法将字符串或对象转换为 SurrealQL。 -- 可以将字符串直接嵌入 SurrealQL 中,而无需使用 `Future.raw`。 +- 您需要使用 `toSurql` 辅助函数或 `.toSurql()` 方法将字符串或对象转换为 SurrealQL。 +- 您可以将字符串嵌入到 SurrealQL 中,而无需使用 `Future.raw`。 -### 扩展 +### 发展 -#### `Future` 对象的通用判定 +#### `Future` 对象的通用判断 -建议使用 `isFuture` 函数来判定值是否为 `Future` 对象,而无需依赖预设。此函数不使用 `instanceof`,因此在验证值的预设未知的情况下非常有用。 +建议使用 `isFuture` 函数来判断一个值是否为 `Future` 对象,而无需依赖预设。此函数不使用 `instanceof`,因此在验证值预设未知的情况下很有用。 ```ts import { isFuture } from "@tai-kun/surrealdb"; diff --git a/docs/src/content/docs/zh-CN/v2/api/data/geometry-collection.mdx b/docs/src/content/docs/zh-CN/v2/api/data/geometry-collection.mdx index 73a19eb0..c02386c6 100644 --- a/docs/src/content/docs/zh-CN/v2/api/data/geometry-collection.mdx +++ b/docs/src/content/docs/zh-CN/v2/api/data/geometry-collection.mdx @@ -1,5 +1,5 @@ --- -title: 几何集合 +title: GeometryCollection slug: zh-CN/v2/api/data/geometry-collection --- @@ -10,9 +10,9 @@ import Badge from "~/components/zh-CN/Badge.astro"; ### 导入 ```ts -import { GeometryCollection } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryCollection } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryCollection } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryCollection } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryCollection } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryCollection } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -31,4 +31,4 @@ new GeometryCollection(source); #### 返回值 -当通过 `new` 调用时,`GeometryCollection` 将返回其实例。 +通过 `new` 调用时,`GeometryCollection` 将返回其实例。 diff --git a/docs/src/content/docs/zh-CN/v2/api/data/geometry-line.mdx b/docs/src/content/docs/zh-CN/v2/api/data/geometry-line.mdx index 5ad878e1..460e5c70 100644 --- a/docs/src/content/docs/zh-CN/v2/api/data/geometry-line.mdx +++ b/docs/src/content/docs/zh-CN/v2/api/data/geometry-line.mdx @@ -5,14 +5,14 @@ slug: zh-CN/v2/api/data/geometry-line import Badge from "~/components/zh-CN/Badge.astro"; -正在编辑。 +编辑中。 ### 导入 ```ts -import { GeometryLine } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryLine } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryLine } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryLine } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryLine } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryLine } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -27,8 +27,8 @@ new GeometryLine(source); ##### `source` -正在编辑。 +编辑中。 #### 返回值 -当通过 `new` 调用时,`GeometryLine` 将返回其实例。 +当通过 `new` 调用时,`GeometryLine` 会返回其实例。 diff --git a/docs/src/content/docs/zh-CN/v2/api/data/geometry-multi-line.mdx b/docs/src/content/docs/zh-CN/v2/api/data/geometry-multi-line.mdx index c7680344..65f55fcf 100644 --- a/docs/src/content/docs/zh-CN/v2/api/data/geometry-multi-line.mdx +++ b/docs/src/content/docs/zh-CN/v2/api/data/geometry-multi-line.mdx @@ -1,18 +1,18 @@ --- -title: 几何多线 +title: GeometryMultiLine slug: zh-CN/v2/api/data/geometry-multi-line --- import Badge from "~/components/zh-CN/Badge.astro"; -正在编写。 +正在编辑。 ### 导入 ```ts -import { GeometryMultiLine } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryMultiLine } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryMultiLine } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryMultiLine } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryMultiLine } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryMultiLine } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -27,8 +27,8 @@ new GeometryMultiLine(source); ##### `source` -正在编写。 +正在编辑。 #### 返回值 -当通过 `new` 调用时,`GeometryMultiLine` 会返回其实例。 +通过 `new` 调用时,`GeometryMultiLine` 会返回其实例。 diff --git a/docs/src/content/docs/zh-CN/v2/api/data/geometry-multi-point.mdx b/docs/src/content/docs/zh-CN/v2/api/data/geometry-multi-point.mdx index 9839c69b..3d3e1a07 100644 --- a/docs/src/content/docs/zh-CN/v2/api/data/geometry-multi-point.mdx +++ b/docs/src/content/docs/zh-CN/v2/api/data/geometry-multi-point.mdx @@ -1,23 +1,23 @@ --- -title: 几何多点 +title: GeometryMultiPoint slug: zh-CN/v2/api/data/geometry-multi-point --- import Badge from "~/components/zh-CN/Badge.astro"; -正在编辑中。 +正在编辑。 ### 导入 ```ts -import { GeometryMultiPoint } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryMultiPoint } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryMultiPoint } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryMultiPoint } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryMultiPoint } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryMultiPoint } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` -创建一个新的 `GeometryMultiPoint` 对象。 +创建新的 `GeometryMultiPoint` 对象。 ```ts new GeometryMultiPoint(source); @@ -27,8 +27,8 @@ new GeometryMultiPoint(source); ##### `source` -正在编辑中。 +正在编辑。 #### 返回值 -通过 `new` 调用时,`GeometryMultiPoint` 会返回其实例。 +通过 `new` 调用时,`GeometryMultiPoint` 会返回自身的实例。 diff --git a/docs/src/content/docs/zh-CN/v2/api/data/geometry-multi-polygon.mdx b/docs/src/content/docs/zh-CN/v2/api/data/geometry-multi-polygon.mdx index e0d7c4ae..e0ef2837 100644 --- a/docs/src/content/docs/zh-CN/v2/api/data/geometry-multi-polygon.mdx +++ b/docs/src/content/docs/zh-CN/v2/api/data/geometry-multi-polygon.mdx @@ -10,9 +10,9 @@ import Badge from "~/components/zh-CN/Badge.astro"; ### 导入 ```ts -import { GeometryMultiPolygon } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryMultiPolygon } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryMultiPolygon } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryMultiPolygon } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryMultiPolygon } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryMultiPolygon } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -31,4 +31,4 @@ new GeometryMultiPolygon(source); #### 返回值 -当通过 `new` 调用时,`GeometryMultiPolygon` 将返回其实例。 +如果通过 `new` 调用,`GeometryMultiPolygon` 将返回其实例。 diff --git a/docs/src/content/docs/zh-CN/v2/api/data/geometry-point.mdx b/docs/src/content/docs/zh-CN/v2/api/data/geometry-point.mdx index 625f9b96..af08765a 100644 --- a/docs/src/content/docs/zh-CN/v2/api/data/geometry-point.mdx +++ b/docs/src/content/docs/zh-CN/v2/api/data/geometry-point.mdx @@ -10,9 +10,9 @@ import Badge from "~/components/zh-CN/Badge.astro"; ### 导入 ```ts -import { GeometryPoint } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryPoint } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryPoint } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryPoint } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryPoint } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryPoint } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -31,4 +31,4 @@ new GeometryPoint(source); #### 返回值 -如果通过 `new` 调用,`GeometryPoint` 将返回它的实例。 +通过 `new` 调用时,`GeometryPoint` 将返回其实例。 diff --git a/docs/src/content/docs/zh-CN/v2/api/data/geometry-polygon.mdx b/docs/src/content/docs/zh-CN/v2/api/data/geometry-polygon.mdx index 16cbd45a..714377c1 100644 --- a/docs/src/content/docs/zh-CN/v2/api/data/geometry-polygon.mdx +++ b/docs/src/content/docs/zh-CN/v2/api/data/geometry-polygon.mdx @@ -1,18 +1,18 @@ --- -title: GeometryPolygon +title: 几何多边形 slug: zh-CN/v2/api/data/geometry-polygon --- import Badge from "~/components/zh-CN/Badge.astro"; -正在编辑中。 +正在编辑。 ### 导入 ```ts -import { GeometryPolygon } from "@tai-kun/surrealdb/data-types/decode-only"; -import { GeometryPolygon } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryPolygon } from "@tai-kun/surrealdb/data-types/standard"; +import { GeometryPolygon } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { GeometryPolygon } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryPolygon } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -27,8 +27,8 @@ new GeometryPolygon(source); ##### `source` -正在编辑中。 +正在编辑。 #### 返回值 -通过 `new` 调用时,`GeometryPolygon` 将返回其实例。 +当通过 `new` 调用时,`GeometryPolygon` 会返回其实例。 diff --git a/docs/src/content/docs/zh-CN/v2/api/data/range.mdx b/docs/src/content/docs/zh-CN/v2/api/data/range.mdx index debce5c2..48bd56c7 100644 --- a/docs/src/content/docs/zh-CN/v2/api/data/range.mdx +++ b/docs/src/content/docs/zh-CN/v2/api/data/range.mdx @@ -2,19 +2,19 @@ title: 范围 slug: zh-CN/v2/api/data/range banner: - content: 这是一个实验性功能。 + content: 此功能尚处于实验阶段。 --- import Badge from "~/components/zh-CN/Badge.astro"; -## 说明 +## 描述 ### 导入 ```ts -import { Range } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Range } from "@tai-kun/surrealdb/data-types/encodable"; -import { Range } from "@tai-kun/surrealdb/data-types/standard"; +import { Range } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Range } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Range } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -34,15 +34,15 @@ new Range( ##### `source` -范围的最小值和最大值对。如果无限制,则为 `null`。 +范围的最小值和最大值的配对。如果无限制则为 `null`。 #### 返回值 -当通过 `new` 调用时,`Range` 将返回其实例。 +如果通过 `new` 调用,`Range` 会返回其实例。 ### `.begin` -范围的最小值。如果无下限,则为 `null`。 +范围的最小值。如果无下限则为 `null`。 ```ts .begin: BoundIncluded | BoundExcluded | null; @@ -50,7 +50,7 @@ new Range( ### `.end` -范围的最大值。如果无上限,则为 `null`。 +范围的最大值。如果无上限则为 `null`。 ```ts .end: BoundIncluded | BoundExcluded | null; @@ -58,9 +58,9 @@ new Range( ### `.toString()` -将 `Range` 对象转换为 SurrealQL 中可用的字符串。 +将 `Range` 对象转换为 SurrealQL 可用的字符串。 -`.toJSON()` 和 `.toSurql()` 方法将返回相同的结果。 +`.toJSON()` 和 `.toSurql()` 方法返回与该方法相同的结果。 ```ts .toString(): string; @@ -81,7 +81,7 @@ import { Range, BoundIncluded, BoundExcluded, -} from "@tai-kun/surrealdb/data-types/encodable"; +} from "@tai-kun/surrealdb/encodable-datatypes"; const range = new Range([new BoundIncluded(1), new BoundIncluded(3)]); console.log(range.toString()); @@ -120,11 +120,11 @@ console.log(range.toString()); // -> .. ``` -### 进阶 +### 扩展 -#### `Range` 对象的通用判定 +#### `Range` 对象的通用判断 -建议使用 `isRange` 函数来判定一个值是否为 `Range` 对象,而不依赖预设。此函数不使用 `instanceof`,因此在预设未知的情况下,可以用于验证值。 +建议使用 `isRange` 函数来判断值是否为 `Range` 对象,而不依赖预设。该函数不使用 `instanceof`,因此在无法确定验证值预设的情况下非常有用。 ```ts import { isRange } from "@tai-kun/surrealdb"; diff --git a/docs/src/content/docs/zh-CN/v2/api/data/table.mdx b/docs/src/content/docs/zh-CN/v2/api/data/table.mdx index 66386c55..1421272d 100644 --- a/docs/src/content/docs/zh-CN/v2/api/data/table.mdx +++ b/docs/src/content/docs/zh-CN/v2/api/data/table.mdx @@ -10,9 +10,9 @@ import Badge from "~/components/zh-CN/Badge.astro"; ### 导入 ```ts -import { Table } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Table } from "@tai-kun/surrealdb/data-types/encodable"; -import { Table } from "@tai-kun/surrealdb/data-types/standard"; +import { Table } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Table } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Table } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -47,7 +47,7 @@ new Table(source: string | { name: string }); // standard 获取此属性时,字符串不会被转义。 ```ts -import { Table } from "@tai-kun/surrealdb/data-types/decode-only"; +import { Table } from "@tai-kun/surrealdb/decodeonly-datatypes"; const table = new Table("foo-bar"); console.log(table.name); @@ -56,9 +56,9 @@ console.log(table.name); ### `.toString()` -将 `Table` 对象转换为可在 SurrealQL 中使用的字符串形式。 +将 `Table` 对象转换为可在 SurrealQL 中使用的字符串变量。 -`.valueOf()` 和 `.toJSON()` 将返回与该方法相同的结果。 +`.valueOf()` 和 `.toJSON()` 会返回与该方法相同的结果。 ```ts .toString(): string; @@ -75,7 +75,7 @@ console.log(table.name); #### 例子 ```ts -import { Table } from "@tai-kun/surrealdb/data-types/encodable"; +import { Table } from "@tai-kun/surrealdb/encodable-datatypes"; const table = new Table("foo-bar"); console.log(table.toString()); @@ -84,7 +84,7 @@ console.log(table.toString()); ### `.toSurql()` -将 `Table` 对象转换为可嵌入 SurrealQL 的字符串形式。类似于 `.toString()`,但表格名称将按照 SurrealDB 的实现进行转义。 +将 `Table` 对象转换为可以嵌入 SurrealQL 的字符串。与 `.toString()` 相似,但表格名称会像 SurrealDB 的实现一样被转义。 ```ts .toSurql(): string; @@ -96,12 +96,12 @@ console.log(table.toString()); #### 返回值 -返回转义的表格名称字符串。 +返回转义后的表格名称字符串。 #### 例子 ```ts -import { Table } from "@tai-kun/surrealdb/data-types/encodable"; +import { Table } from "@tai-kun/surrealdb/encodable-datatypes"; const table = new Table("foo-bar"); console.log(table.toSurql()); @@ -110,7 +110,7 @@ console.log(table.toSurql()); ### `.clone()` -克隆 `Table` 对象。 +复制 `Table` 对象。 ```ts .clone(): this; @@ -122,7 +122,7 @@ console.log(table.toSurql()); #### 返回值 -返回一个新的 `Table` 对象。如果继承了 `Table` 类,则返回该类的实例。 +返回一个新的 `Table` 对象。如果继承了 `Table` 类,则会返回该类的实例。 ### 进阶 @@ -131,7 +131,7 @@ console.log(table.toSurql()); 可以使用类型参数来使 `Table` 的表格名称类型安全: ```ts -import { Table } from "@tai-kun/surrealdb/data-types/standard"; +import { Table } from "@tai-kun/surrealdb/standard-datatypes"; function isUserTable(table: unknown): table is Table<"user"> { return table instanceof Table @@ -139,9 +139,9 @@ function isUserTable(table: unknown): table is Table<"user"> { } ``` -#### 通用 `Table` 对象判定 +#### `Table` 对象的通用判定 -建议使用 `isTable` 函数来判定一个值是否是 `Table` 对象,而不依赖于预设。该函数不使用 `instanceof`,因此当验证的值的预设未知时很有用。 +建议使用 `isTable` 函数来判断一个值是否为 `Table` 对象,而无需依赖预设。该函数不使用 `instanceof`,因此当验证值的预设未知时非常有用。 ```ts import { isTable } from "@tai-kun/surrealdb"; diff --git a/docs/src/content/docs/zh-CN/v2/api/data/thing.mdx b/docs/src/content/docs/zh-CN/v2/api/data/thing.mdx index afd59adc..157245e9 100644 --- a/docs/src/content/docs/zh-CN/v2/api/data/thing.mdx +++ b/docs/src/content/docs/zh-CN/v2/api/data/thing.mdx @@ -5,14 +5,14 @@ slug: zh-CN/v2/api/data/thing import Badge from "~/components/zh-CN/Badge.astro"; -`Thing` 是用来表示[记录 ID](https://surrealdb.com/docs/surrealql/datamodel/ids) 的类。 +`Thing` 是一个表示[记录 ID](https://surrealdb.com/docs/surrealql/datamodel/ids) 的类。 ### 导入 ```ts -import { Thing } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Thing } from "@tai-kun/surrealdb/data-types/encodable"; -import { Thing } from "@tai-kun/surrealdb/data-types/standard"; +import { Thing } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Thing } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Thing } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -28,7 +28,7 @@ new Thing(table: string, id: string | number | bigint | object); ##### `source` -记录 ID 的表部分和 ID 部分的组合。 +记录 ID 的表部分和 ID 部分的配对。 ##### `table` @@ -40,11 +40,11 @@ new Thing(table: string, id: string | number | bigint | object); #### 返回值 -当通过 `new` 调用时,`Thing` 会返回它的实例。 +如果通过 `new` 调用,`Thing` 将返回其实例。 ### `.table` -记录 ID 的表部分。获取该属性时,字符串不会被转义。 +记录 ID 的表部分。获取此属性时,字符串不会被转义。 ```ts .table: string; @@ -52,10 +52,10 @@ new Thing(table: string, id: string | number | bigint | object); #### 例子 -获取该属性时,字符串不会被转义。 +获取此属性时,字符串不会被转义。 ```ts -import { Thing } from "@tai-kun/surrealdb/data-types/decode-only"; +import { Thing } from "@tai-kun/surrealdb/decodeonly-datatypes"; const thing = new Thing("foo-bar", 0); console.log(this.id); @@ -72,7 +72,7 @@ console.log(this.id); ### `.toString()` -将 `Thing` 对象转换为 SurrealQL 中可用的字符串形式。表名和 ID 部分分别按照 SurrealDB 的实现进行转义和格式化。此外,对象属性将按升序排序。 +将 `Thing` 对象转换为在 SurrealQL 中可用的变量字符串。表名和 ID 部分将分别按照 SurrealDB 的实现进行转义和格式化。此外,对象的属性将按照升序进行排序。 `.valueOf()` 和 `.toJSON()` 将返回与该方法相同的结果。 @@ -86,12 +86,12 @@ console.log(this.id); #### 返回值 -返回格式化后的记录 ID 字符串。 +返回格式化的记录 ID 字符串。 #### 例子 ```ts -import { Thing } from "@tai-kun/surrealdb/data-types/encodable"; +import { Thing } from "@tai-kun/surrealdb/encodable-datatypes"; const thing = new Thing([ "foo-bar", @@ -103,7 +103,7 @@ console.log(thing.toString()); ### `.toSurql()` -将 `Thing` 对象转换为可嵌入 SurrealQL 的字符串。类似于 `.toString()`,但添加 `r` 前缀,以便告诉查询解析器该字符串是记录 ID。 +将 `Thing` 对象转换为可以在 SurrealQL 中嵌入的字符串。与 `.toString()` 相似,但它添加 `r` 前缀,以告知查询解析器该字符串是记录 ID。 ```ts .toSurql(): string; @@ -115,12 +115,12 @@ console.log(thing.toString()); #### 返回值 -返回格式化后的记录 ID 字符串。 +返回格式化的记录 ID 字符串。 #### 例子 ```ts -import { Thing } from "@tai-kun/surrealdb/data-types/encodable"; +import { Thing } from "@tai-kun/surrealdb/encodable-datatypes"; const thing = new Thing("foo", "bar"); console.log(thing.toSurql()); @@ -129,7 +129,7 @@ console.log(thing.toSurql()); ### `.clone()` -复制 `Thing` 对象。但 ID 部分不会被复制,而是被引用。 +克隆 `Thing` 对象。但是,ID 部分不会被克隆,而是被引用。 ```ts .clone(): this; @@ -147,10 +147,10 @@ console.log(thing.toSurql()); #### 类型守卫 -可以使用类型参数使 `Thing` 的表部分和 ID 部分分别具有类型安全性: +可以使用类型参数为 `Thing` 的表部分和 ID 部分分别进行类型安全: ```ts -import { Thing, Uuid } from "@tai-kun/surrealdb/data-types/standard"; +import { Thing, Uuid } from "@tai-kun/surrealdb/standard-datatypes"; function isUserRecordId(thing: unknown): thing is Thing<"user", Uuid> { return thing instanceof Thing @@ -159,9 +159,9 @@ function isUserRecordId(thing: unknown): thing is Thing<"user", Uuid> { } ``` -#### `Thing` 对象的通用判断 +#### `Thing` 对象的通用判定 -建议使用 `isThing` 函数来判断一个值是否为 `Thing` 对象,而无需依赖预设。该函数不使用 `instanceof`,因此在验证值的预设未知时非常有用。 +建议使用 `isThing` 函数来判定一个值是否为 `Thing` 对象,而不依赖于预设。此函数不使用 `instanceof`,因此在验证值预设未知的情况下非常有用。 ```ts import { isThing } from "@tai-kun/surrealdb"; diff --git a/docs/src/content/docs/zh-CN/v2/api/data/uuid.mdx b/docs/src/content/docs/zh-CN/v2/api/data/uuid.mdx index e452a53e..af1c26f7 100644 --- a/docs/src/content/docs/zh-CN/v2/api/data/uuid.mdx +++ b/docs/src/content/docs/zh-CN/v2/api/data/uuid.mdx @@ -5,14 +5,14 @@ slug: zh-CN/v2/api/data/uuid import Badge from "~/components/zh-CN/Badge.astro"; -UUID(通用唯一识别码)是一个 128 位的标识符,用于唯一地标识特定实体。`Uuid` 类表示 UUID,支持 UUID v1 到 v7。需要注意的是,生成 UUID 需要使用单独的库或运行时内置功能(例如 `node:crypto`)。 +UUID(Universally Unique Identifier)是一种用于唯一标识特定实体的 128 位标识符。`Uuid` 类用于表示 UUID。它支持 UUID v1 到 v7。需要注意的是,要生成 UUID,需要使用单独的库或运行时内置的函数(例如 `node:crypto`)。 ### 导入 ```ts -import { Uuid } from "@tai-kun/surrealdb/data-types/decode-only"; -import { Uuid } from "@tai-kun/surrealdb/data-types/encodable"; -import { Uuid } from "@tai-kun/surrealdb/data-types/standard"; +import { Uuid } from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Uuid } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Uuid } from "@tai-kun/surrealdb/standard-datatypes"; ``` ### `.constructor()` @@ -28,11 +28,11 @@ new Uuid(source: Uint8Array | string); // standard ##### `source` -UUID 的字节数组表示,如果是 `standard` 预设,则为字符串。 +UUID 的字节数组表示形式,如果使用 standard 预设,则为字符串。 #### 返回值 -通过 `new` 调用时,`Uuid` 返回其实例。 +通过 `new` 调用时,`Uuid` 将返回其实例。 ### `.bytes` @@ -44,23 +44,23 @@ UUID 的字节数组。 ### `.variant` -UUID 的变体。它由 UUID 第 13 位的高位比特定义,有三个主要变体和一个为将来保留的变体。 +UUID 的变体。这由 UUID 的第 13 位的上位比特定义,包括以下三个主要变体和一个为将来保留的变体: 1. NCS 兼容 - `0b0xxx` - - 表示 UUID 与 NCS(网络计算系统)兼容。 - - 不常使用。 + - 表示 UUID 与 NCS(Network Computing System)兼容。 + - 不常被使用。 2. RFC 4122 兼容 - `0b10xx` - 基于 RFC 4122(UUID 标准规范)的 UUID。 - - 是最常用的 UUID 格式,包括 v1(时间戳)和 v4(随机)等格式。 + - 是 UUID 的常用形式,包括 v1(基于时间)和 v4(随机)等形式。 3. Microsoft GUID 兼容 - `0b110x` - - Microsoft 使用的 GUID(全局唯一标识符)格式。 + - Microsoft 使用的 GUID(Globally Unique Identifier)的格式。 4. 为将来保留 - `0b111x` -此属性除了以上变体外,还表示 NIL UUID 和 MAX UUID。 +此属性除了以上变体之外,还表示 NIL UUID 和 MAX UUID。 ```ts .variant: @@ -74,7 +74,7 @@ UUID 的变体。它由 UUID 第 13 位的高位比特定义,有三个主要 ### `.version` -如果 UUID 的变体为 `"RFC"`,则为 UUID 版本号。否则为 `null`。 +如果 UUID 的变体为 `"RFC"`,则表示 UUID 版本号。否则为 `null`。 ```ts .version: 1 | 2 | 3 | 4 | 5 | 6 | 7 | null; @@ -82,7 +82,7 @@ UUID 的变体。它由 UUID 第 13 位的高位比特定义,有三个主要 ### `.timestamp` -如果 UUID 的变体为 `"RFC"`,版本为 v1、v6 或 v7 之一,则为时间戳部分。否则为 `null`。为了方便,所有时间戳都计算为自 UNIX 纪元以来的毫秒数。 +如果 UUID 的变体为 `"RFC"` 且版本为 v1、v6 或 v7 之一,则表示时间戳部分。否则为 `null`。为了方便起见,所有时间戳都被计算为自 UNIX 纪元以来的毫秒数。 ```ts .timestamp: number | null; @@ -92,7 +92,7 @@ UUID 的变体。它由 UUID 第 13 位的高位比特定义,有三个主要 将 `Uuid` 对象转换为 SurrealQL 变量中可用的字符串。 -`.valueOf()` 和 `.toJSON()` 返回与该方法相同的结果。 +`.valueOf()` 和 `.toJSON()` 将返回与该方法相同的结果。 ```ts .toString(): string; @@ -109,7 +109,7 @@ UUID 的变体。它由 UUID 第 13 位的高位比特定义,有三个主要 #### 例子 ```ts -import { Uuid } from "@tai-kun/surrealdb/data-types/encodable"; +import { Uuid } from "@tai-kun/surrealdb/encodable-datatypes"; const bytes = new Uint8Array([ 0x26, 0xc8, 0x01, 0x63, @@ -125,7 +125,7 @@ console.log(uuid.toString()); ### `.toSurql()` -将 `Uuid` 对象转换为可以嵌入 SurrealQL 的字符串。类似于 `.toString()`,但添加了 `u` 前缀,告诉查询解析器该字符串是一个 UUID。 +将 `Uuid` 对象转换为可嵌入 SurrealQL 的字符串。与 `.toString()` 类似,但添加了 `u` 前缀,告诉查询解析器该字符串是 UUID。 ```ts .toSurql(): string; @@ -142,7 +142,7 @@ console.log(uuid.toString()); #### 例子 ```ts -import { Uuid } from "@tai-kun/surrealdb/data-types/encodable"; +import { Uuid } from "@tai-kun/surrealdb/encodable-datatypes"; const bytes = new Uint8Array([ 0x26, 0xc8, 0x01, 0x63, @@ -188,14 +188,14 @@ console.log(uuid.toSurql()); #### 返回值 -如果任一方没有时间戳部分,或者时间戳相同,则返回 `0`。如果比较的 UUID 的时间戳比当前时间戳更早,则返回 `-1`,如果更晚,则返回 `1`。 +如果一方没有时间戳部分,或者时间戳相同,则返回 `0`。如果比较对象的 UUID 时间戳比当前时间戳更早,则返回 `-1`,如果更晚,则返回 `1`。 #### 例子 -以下示例比较不同 UUID 版本的时间戳,并按升序排列: +以下示例比较不同 UUID 版本的时间戳,并按升序排序: ```ts -import { Uuid } from "@tai-kun/surrealdb/data-types/standard"; +import { Uuid } from "@tai-kun/surrealdb/standard-datatypes"; const uuidv1 = new Uuid("0e004000-2073-11ef-8451-eb2a011f8691"); const uuidv6 = new Uuid("1ef1fa9e-3968-6000-a77e-683eb1a35ebe"); @@ -223,7 +223,7 @@ console.log(uuidList); #### `Uuid` 对象的通用判断 -建议使用 `isUuid` 函数来判断值是否为 `Uuid` 对象,而不依赖于预设。该函数不使用 `instanceof`,因此当验证值的预设未知时很有用。 +建议使用 `isUuid` 函数来判断值是否为 `Uuid` 对象,而无需依赖于预设。该函数不使用 `instanceof`,因此在验证值预设未知的情况下非常有用。 ```ts import { isUuid } from "@tai-kun/surrealdb"; diff --git a/docs/src/content/docs/zh-CN/v2/getting-started.mdx b/docs/src/content/docs/zh-CN/v2/getting-started.mdx index 809ad780..58bf99b4 100644 --- a/docs/src/content/docs/zh-CN/v2/getting-started.mdx +++ b/docs/src/content/docs/zh-CN/v2/getting-started.mdx @@ -36,7 +36,7 @@ import { Tabs, TabItem } from "@astrojs/starlight/components"; import { Surreal } from "@tai-kun/surrealdb"; const db = new Surreal(); -await db.connect(""); // 例如 ws://localhost:8000 +await db.connect(""); // e.g. ws://localhost:8000 try { await db.signin({ user: "root", pass: "root" }); @@ -52,16 +52,16 @@ try { ```ts import { initSurreal } from "@tai-kun/surrealdb"; -import Client from "@tai-kun/surrealdb/clients/standard"; -import HttpEngine from "@tai-kun/surrealdb/engines/http"; -import JsonFormatter from "@tai-kun/surrealdb/formatters/json"; +import Client from "@tai-kun/surrealdb/standard-client"; +import HttpEngine from "@tai-kun/surrealdb/http-engine"; +import JsonFormatter from "@tai-kun/surrealdb/json-formatter"; const { Surreal } = initSurreal({ Client: Client, engines: { http: config => new HttpEngine({ ...config, - // fetch: <您的自定义fetch函数> + // fetch: }), https: "http", }, diff --git a/docs/src/content/docs/zh-CN/v2/guides/errors.mdx b/docs/src/content/docs/zh-CN/v2/guides/errors.mdx index 9372eec8..a967dff0 100644 --- a/docs/src/content/docs/zh-CN/v2/guides/errors.mdx +++ b/docs/src/content/docs/zh-CN/v2/guides/errors.mdx @@ -3,15 +3,15 @@ title: 错误 slug: zh-CN/v2/guides/errors --- -## 简介 +## 概述 -一些错误对象可能具有 `.cause` 属性。大多数情况下,此属性类型为 `unknown`,其值可能会在将来发生更改,恕不另行通知。 +某些错误对象可能设置了 `.cause` 属性。在大多数情况下,它将是 `unknown` 类型,其值可能会在将来更改而不会另行通知。 -## 通用 +## 通用错误 ### SurrealError -`SurrealError` 是此 SDK 显式抛出的大多数错误对象的基类。此类继承自 JavaScript 的 `Error` 类。此错误对象很少单独抛出,通常抛出的是其继承的具有特定含义的错误对象。建议使用 `try-catch` 语句等捕获此错误,以便轻松地将此 SDK 显式抛出的错误进行分类。 +`SurrealError` 是此 SDK 显式抛出的几乎所有错误对象的基类。该类继承自 JavaScript 的 `Error` 类。很少单独抛出此错误对象,通常会抛出具有特定含义的子类错误对象。建议使用它来简单地分类在 `try-catch` 语句中捕获的错误,以判断该错误是否是由此 SDK 显式抛出的。 #### 属性 @@ -29,7 +29,7 @@ slug: zh-CN/v2/guides/errors ### SurrealTypeError -继承自: `SurrealError` +继承自:`SurrealError` 当输入值或其他验证失败时抛出此错误。 @@ -39,18 +39,18 @@ slug: zh-CN/v2/guides/errors : 错误名称。 `.expected` -: 期望的数据格式。 +: 预期的数据格式。 `.actual` : 实际值的字符串表示形式。 #### 解决方法 -跟踪堆栈跟踪,找出导致不输入期望数据格式的原因。 +沿着堆栈跟踪查找导致未输入预期数据格式的原因。 ### SurrealValueError -继承自: `SurrealError` +继承自:`SurrealError` 当输入值或其他验证失败时抛出此错误。 @@ -60,20 +60,20 @@ slug: zh-CN/v2/guides/errors : 错误名称。 `.expected` -: 期望的数据格式。 +: 预期的数据格式。 `.actual` : 实际值。 #### 解决方法 -跟踪堆栈跟踪,找出导致不输入期望数据格式的原因。 +沿着堆栈跟踪查找导致未输入预期数据格式的原因。 ### SurrealAggregateError -继承自: `SurrealError` +继承自:`SurrealError` -这是一个聚合了多个错误或错误消息的错误。 +这是一个包含多个错误或错误消息的错误。 #### 属性 @@ -81,13 +81,13 @@ slug: zh-CN/v2/guides/errors : 错误名称。 `.cause: unknown[]` -: 数组的每个元素都包含错误或错误消息等。 +: 数组中的每个元素都包含错误或错误消息等。 ### CircularReferenceError -继承自: `SurrealError` +继承自:`SurrealError` -当检测到循环引用时抛出此错误。主要是在将 JavaScript 值转换为其他格式的过程中,如果检测到父对象与同一对象,则会抛出此错误。 +当检测到循环引用时抛出此错误。主要是在将 JavaScript 值转换为其他格式的过程中,当检测到与父对象相同的对象时抛出。 #### 属性 @@ -112,11 +112,11 @@ toSurql(a); // throws CircularReferenceError #### 解决方法 -此错误也可能在 `toSurql` 函数之外抛出,这是一个常见的错误。您需要仔细调试对象内部,查看它是否包含自身。 +此错误也可能在除 `toSurql` 函数之外的其他地方抛出。需要仔细调试对象内部,以确保其中不包含该对象本身。 ### NumberRangeError -继承自: `SurrealError` +继承自:`SurrealError` 当数值超出范围时抛出此错误。 @@ -126,23 +126,23 @@ toSurql(a); // throws CircularReferenceError : 错误名称。 `.range` -: 期望的范围。 +: 预期范围。 `.actual` : 实际值。 `.integer` -: 如果为 `true`,则期望整数。 +: 如果为 `true`,则表示预期为整数。 #### 解决方法 -跟踪堆栈跟踪,找出导致不输入期望数据格式的原因。 +沿着堆栈跟踪查找导致未输入预期数据格式的原因。 ### UnsupportedRuntimeError -继承自: `SurrealError` +继承自:`SurrealError` -当检测到使用不受支持的运行时时抛出此错误。 +当判断正在使用不受支持的运行时环境时抛出此错误。 #### 属性 @@ -151,13 +151,13 @@ toSurql(a); // throws CircularReferenceError #### 解决方法 -您需要避免使用该运行时,或者使用 polyfill 并进行充分测试。 +要么不要使用该运行时环境,要么使用 polyfill 并充分测试。 ### UnreachableError -继承自: `SurrealError` +继承自:`SurrealError` -当到达不可达代码时抛出此错误。如果抛出此错误,则可能遇到了此 SDK 的错误。 +当遇到不可达的代码时抛出此错误。如果遇到此错误,则可能遇到了此 SDK 的错误。 #### 属性 @@ -166,7 +166,7 @@ toSurql(a); // throws CircularReferenceError #### 解决方法 -您可以通过以下 URL 报告此问题: +可以通过以下 URL 提交此问题: [https://github.com/tai-kun/surrealdb.js/issues](https://github.com/tai-kun/surrealdb.js/issues) @@ -174,9 +174,9 @@ toSurql(a); // throws CircularReferenceError ### CircularEngineReferenceError -继承自: `CircularReferenceError` +继承自:`CircularReferenceError` -当在数据库连接过程中发生引擎之间的循环引用时抛出此错误。 +当在连接到数据库时,在引擎之间出现循环引用时抛出此错误。 #### 属性 @@ -184,10 +184,10 @@ toSurql(a); // throws CircularReferenceError : 错误名称。 `.reference: string` -: 发生循环引用的方案名称。 +: 发生循环引用的模式名称。 `.seen: string[]` -: 发生循环引用之前经过的方案名称列表。 +: 发生循环引用之前经过的模式名称列表。 例如,在以下情况下会抛出此错误: @@ -206,15 +206,15 @@ await using db = new Surreal(); await db.connect("https://localhost:8000"); // throws CircularEngineReferenceError: Circular engine reference: http,https ``` -在上面的示例中,尽管 https 协议的引擎指示使用 http 的引擎,但 http 协议的引擎又试图使用 https 的引擎,从而导致循环引用错误。 +在上面的示例中,尽管 https 协议的引擎指示使用 http 的引擎,但 http 协议的引擎尝试使用 https 的引擎,从而导致循环引用错误。 #### 解决方法 -不要将字符串形式的协议名称设置为另一个协议名称的值,而是将其替换为创建引擎的具体实现: +不要将字符串指定为协议名称的值,而是将它替换为创建引擎的具体实现: ```ts del={6} ins={7-10} import { initSurreal } from "@tai-kun/surrealdb"; -import HttpEngine from "@tai-kun/surrealdb/engines/http"; +import HttpEngine from "@tai-kun/surrealdb/http-engine"; const { Surreal } = initSurreal({ engines: { @@ -231,9 +231,9 @@ const { Surreal } = initSurreal({ ### EngineNotFoundError -继承自: `SurrealError` +继承自:`SurrealError` -当尝试使用未设置引擎的协议进行连接时抛出此错误。 +当尝试使用未设置引擎的协议连接时抛出此错误。 #### 属性 @@ -241,7 +241,7 @@ const { Surreal } = initSurreal({ : 错误名称。 `.scheme: string` -: 要连接到的协议名称。 +: 要连接的协议名称。 例如,在以下情况下会抛出此错误: @@ -261,7 +261,7 @@ await db.connect("https://localhost:8000"); // throws EngineNotFoundError: No ht #### 解决方法 -检查 `engines` 属性,查看要连接到的端点的协议是否可以创建引擎。 +检查 `engines` 属性以确定连接目标终结点的协议是否可以创建引擎。 ```ts ins={6} import { initSurreal } from "@tai-kun/surrealdb"; @@ -277,9 +277,9 @@ const { Surreal } = initSurreal({ ### ConnectionConflictError -继承自: `SurrealError` +继承自:`SurrealError` -当客户端尝试同时连接到多个端点时抛出此错误。 +当客户端尝试同时连接到多个终结点时抛出此错误。 #### 属性 @@ -287,10 +287,10 @@ const { Surreal } = initSurreal({ : 错误名称。 `.endpoint1: string` -: 已经连接的端点。 +: 已连接的终结点。 `.endpoint2: string` -: 另一个端点。 +: 另一个终结点。 ```ts import { Surreal } from "@tai-kun/surrealdb"; @@ -301,7 +301,7 @@ await db.connect("ws://localhost:8000"); await db.connect("ws://localhost:1129"); // throws ConnectionConflictError: An attempt was made to connect to ws://localhost:1129/rpc while ws://localhost:8000/rpc was already connected. ``` -`.connect` 方法会在传递的 URL 的路径不以 `/rpc` 结尾时在末尾添加 `/rpc`。因此,如果一方的端点 URL 路径以 `/rpc` 结尾,则可能不会出现错误,尽管它看起来并非如此: +`.connect` 方法会在传递的 URL 的路径不以 `/rpc` 结尾时,在末尾添加它。因此,如果一方终结点的 URL 路径以 `/rpc` 结尾,则它可能不会抛出错误,这与表面看起来不同: ```ts import { Surreal } from "@tai-kun/surrealdb"; @@ -323,7 +323,7 @@ await db.connect("http://localhost:8000"); // OK! #### 解决方法 -在调用 `.connect` 方法之前调用 `.close` 方法,就可以连接到任意端点。 +通过调用 `.close` 方法,可以在调用 `.connect` 方法之前连接到任何终结点。 ```ts ins={6} import { Surreal } from "@tai-kun/surrealdb"; @@ -337,9 +337,9 @@ await db.connect("http://localhost:11298"); ### MissingNamespaceError -继承自: `SurrealError` +继承自:`SurrealError` -当在选择数据库之前未选择命名空间时抛出此错误。或者,当您选择数据库后尝试将命名空间设为未选择状态时也会抛出此错误。 +当在选择数据库之前未选择命名空间时抛出此错误。或者,即使选择了数据库,但仍尝试将其设置为未选择命名空间状态时也会抛出此错误。 #### 属性 @@ -364,7 +364,7 @@ await db.use({ #### 解决方法 -选择数据库时,也要选择命名空间。 +选择数据库时,应同时选择命名空间。 ```ts ins={7} import { Surreal } from "@tai-kun/surrealdb"; @@ -380,9 +380,9 @@ await db.use({ ### RpcResponseError -继承自: `SurrealError` +继承自:`SurrealError` -当 RPC 响应指示错误时抛出此错误。连接的协议的通信和响应体的解码都没有问题,但这意味着 SurrealDB 无法处理 RPC 请求。 +当 RPC 响应指示错误时抛出此错误。连接的协议、响应正文的解码等都没有问题,但这意味着 SurrealDB 无法处理 RPC 请求。 #### 属性 @@ -390,18 +390,18 @@ await db.use({ : 错误名称。 `.id?: string` -: 识别 RPC 请求的 ID。ID 始终以 `<方法名>_` 开头。 +: 标识 RPC 请求的 ID。ID 始终以 `<方法名>_` 开头。 `.code: number` -: 尽管在 SurrealDB 的文档中没有明确说明,但它可能是 JSON-RPC 的错误代码。 +: SurrealDB 文档中没有明确说明,但可能代表 JSON-RPC 错误代码。 #### 解决方法 -可能有多种原因,但可能是此 SDK 支持的 SurrelDB 版本与处理 RPC 请求的 SurrealDB 版本不同。 +可能有各种原因,但可能是此 SDK 支持的 SurrelDB 版本与处理 RPC 请求的 SurrealDB 版本不一致。 ### QueryFailedError -继承自: `SurrealAggregateError` +继承自:`SurrealAggregateError` 当查询失败时抛出此错误。 @@ -424,20 +424,20 @@ await db.query("OUTPUT 'Hello'"); // throws QueryFailedError: Query failed with #### 解决方法 -检查 SurrelQL 语法是否正确。 +确认 SurrelQL 语法是否正确。 ### Closed -继承自: `SurrealError` +继承自:`SurrealError` -指示连接被强制关闭的错误。 +表示连接已被强制终止。 #### 属性 `.name: "Closed"` : 错误名称。 -例如,在以下情况下会得到此错误: +例如,在以下情况下会收到此错误: ```ts const db = new Surreal(); @@ -460,9 +460,9 @@ await db.close({ force: true }); ### EngineError -继承自: `SurrealError` +继承自:`SurrealError` -指示这是一个由引擎引起的错误。它通过事件监听器发送。 +表示这是由引擎导致的错误。它通过事件监听器发出。 #### 属性 @@ -474,9 +474,9 @@ await db.close({ force: true }); ### HttpEngineError -继承自: `EngineError` +继承自:`EngineError` -指示这是一个由 HTTP 引擎引起的错误。目前仅定义,尚未使用。 +表示这是由 HTTP 引擎导致的错误。目前仅定义,尚未使用。 #### 属性 @@ -485,11 +485,11 @@ await db.close({ force: true }); ### WebSocketEngineError -继承自: `EngineError` +继承自:`EngineError` -指示这是一个由 WebSocket 引擎引起的错误。它在解析响应体之前无法找到识别 RPC 请求的 ID、从 WebSocket 对象接收错误事件或断开 WebSocket 连接时使用。 +表示这是由 WebSocket 引擎导致的错误。当在找到标识 RPC 请求的 ID 之前解析响应正文失败,或从 WebSocket 对象接收错误事件,或断开 WebSocket 连接时使用。 -此 SDK 使用 `315x` 作为自定义状态代码。此范围在 [IANA](https://www.iana.org/assignments/websocket/websocket.xml#close-code-number) 中是未分配的状态代码。 +此 SDK 使用 `315x` 作为自定义状态代码。此范围在 [IANA](https://www.iana.org/assignments/websocket/websocket.xml#close-code-number) 中未分配状态代码。 #### 属性 @@ -499,12 +499,12 @@ await db.close({ force: true }); `.code: number` : 以下状态代码之一: - `1000`~`1015`: [MDN 参考](https://developer.mozilla.org/docs/Web/API/CloseEvent/code) - - `3150`: 指示从 `WebSocket`[^1] 实例接收 "error" 事件。 - - `3151`: 指示 WebSocket 引擎注册的 "open" 事件处理程序内发生错误。大多数情况下,是在连接中状态到连接状态的转换过程中发生了 `StateTransitionError`。 - - `3152`: 指示 WebSocket 引擎注册的 "message" 事件处理程序内发生错误。可能有多种原因,但最有可能的是,事件处理程序内抛出了 `ServerResponseError` 或 `RpcResponseError`。可能是由于请求了无效的 RPC 参数导致的。在这种情况下,RPC 的调用方方法将(默认情况下)在 5 秒后超时并失败。在 SurrealDB v2.0.2 之前的版本中,超时可能由更广泛的原因导致。 - - `3153`: 指示 ping 的发送或接收失败。这可能是暂时的错误,但如果持续收到此错误,则可能无法维持连接。 - - `3154`: 指示 WebSocket 引擎注册的 "close" 事件处理程序内发生错误。大多数情况下,是在断开连接状态到断开连接状态的转换过程中发生了 `StateTransitionError`。 -: 请注意,上面的代码不包括以下状态代码。此 SDK 不会将其视为错误。 + - `3150`: 表示从 `WebSocket`[^1] 实例收到 "error" 事件。 + - `3151`: 表示 WebSocket 引擎在注册的 "open" 事件处理程序中发生错误。大多数情况下是由于在连接状态到连接状态的转换过程中发生 `StateTransitionError`。 + - `3152`: 表示 WebSocket 引擎在注册的 "message" 事件处理程序中发生错误。可能有各种原因,但最有可能是事件处理程序中抛出了 `ServerResponseError` 或 `RpcResponseError`。可能是由于使用无效的 RPC 参数发送请求导致的。在这种情况下,RPC 的调用方方法(默认情况下)会在 5 秒后超时并失败。在 SurrealDB v2.0.2 之前的版本中,可能存在更广泛的原因导致超时。 + - `3153`: 表示 ping 的发送或接收失败。可能是暂时性错误,但如果持续收到,则可能表示连接无法维持。 + - `3154`: 表示 WebSocket 引擎在注册的 "close" 事件处理程序中发生错误。大多数情况下是由于在断开连接状态到断开连接状态的转换过程中发生 `StateTransitionError`。 +: 需要注意的是,上述状态代码中不包含以下状态代码。此 SDK 将其视为非错误。 - `1000`: 正常断开连接。 - `1001`: 早期断开连接很常见。 - `1004`: 保留。 @@ -517,19 +517,19 @@ await db.close({ force: true }); #### 解决方法 `1002`,`1003`,`1007`...`1011`,`1014`,`3150`,`3151`,`3154` -: 可能无法自动恢复这些状态代码。您需要修复运行时、SurrealDB 的配置或硬编码的实现。 +: 可能没有自动恢复此状态代码的方法。需要修改运行时环境、SurrealDB 设置或硬编码的实现。 `3152` : 检查传递给方法的参数(即 RPC 请求的内容)是否正确。 `1012`,`1013`,`3153` -: 您可能可以使用实验性功能 [`autoReconnect()`](/v2/experimental/auto-reconnect) 自动恢复。 +: 可以使用实验性功能 [`autoReconnect()`](/v2/experimental/auto-reconnect) 来实现自动恢复。 ### StateTransitionError -继承自: `SurrealAggregateError` +继承自:`SurrealAggregateError` -当在状态转换过程中事件监听器执行失败时抛出此错误。 +当状态转换期间事件监听器的执行失败时抛出此错误。 #### 属性 @@ -540,10 +540,10 @@ await db.close({ force: true }); : 状态转换开始时的状态。 `.to: string` -: 要转换到的状态。 +: 目标状态。 `.fallback: string` -: 如果状态转换失败,则作为替代转换目标。如果它与 `.to` 相同,则意味着它被强制转换。 +: 状态转换失败时的备用目标转换。如果它与 `.to` 相同,则表示已强制进行转换。 例如,在以下情况下会抛出此错误: @@ -571,9 +571,9 @@ await db.connect("http://localhost:8000"); // throws ... ### ConnectionUnavailableError -继承自: `SurrealError` +继承自:`SurrealError` -当在未连接状态下尝试发送 RPC 请求时抛出此错误。 +当尝试在未连接状态下发送 RPC 请求时抛出此错误。 #### 属性 @@ -582,9 +582,9 @@ await db.connect("http://localhost:8000"); // throws ... ### ServerResponseError -继承自: `SurrealError` +继承自:`SurrealError` -当无法将响应解析为 PRC 响应时抛出此错误。这与 `RpcResponseError` 不同。 +当无法将响应解析为 PRC 响应时抛出此错误。它与 `RpcResponseError` 不同。 #### 属性 @@ -593,15 +593,15 @@ await db.connect("http://localhost:8000"); // throws ... #### 解决方法 -通常不应该抛出此错误,但如果抛出,则可能是此 SDK 支持的 SurrelDB 版本与处理 RPC 请求的 SurrealDB 版本不同。 +通常不会抛出此错误,但如果抛出,则可能是此 SDK 支持的 SurrelDB 版本与处理 RPC 请求的 SurrealDB 版本不一致。 ## CBOR ### CborError -继承自: `SurrealError` +继承自:`SurrealError` -这是 `@tai-kun/surrealdb/cbor` 显式抛出的与 CBOR 相关的所有错误的基类。它不会直接抛出。 +它是 `@tai-kun/surrealdb/cbor` 显式抛出的所有与 CBOR 相关的错误的基类。它不会直接抛出。 #### 属性 @@ -610,22 +610,22 @@ await db.connect("http://localhost:8000"); // throws ... ### CborWellFormednessError -继承自: `CborError` +继承自:`CborError` #### 属性 -这是 `@tai-kun/surrealdb/cbor` 显式抛出的与 CBOR 解码相关的错误的基类。它不会直接抛出。 +它是 `@tai-kun/surrealdb/cbor` 显式抛出的所有与 CBOR 解码相关的错误的基类。它不会直接抛出。 -请参考 RFC8949 附录 F 中的“**[Well-Formedness Errors and Examples](https://datatracker.ietf.org/doc/html/rfc8949#name-well-formedness-errors-and-)**”。 +请参考 RFC8949 附录 F 中的“ [Well-Formedness Errors and Examples](https://datatracker.ietf.org/doc/html/rfc8949#name-well-formedness-errors-and-)”。 `.name: "CborWellFormednessError"` : 错误名称。 ### CborTooMuchDataError -继承自: `CborWellFormednessError` +继承自:`CborWellFormednessError` -它指示存在未使用的输入字节。 +表示有未消耗的输入字节剩余。 [RFC8949](https://datatracker.ietf.org/doc/html/rfc8949#section-appendix.f-2.2) @@ -636,13 +636,13 @@ await db.connect("http://localhost:8000"); // throws ... #### 解决方法 -检查要解码的字节数组是否为正确的 CBOR 格式。 +检查要解码的字节数组是否是正确的 CBOR 格式。 ### CborTooLittleDataError -继承自: `CborWellFormednessError` +继承自:`CborWellFormednessError` -它指示输入字节不完整。 +表示输入字节不完整。 [RFC8949](https://datatracker.ietf.org/doc/html/rfc8949#section-appendix.f-2.4) @@ -653,13 +653,13 @@ await db.connect("http://localhost:8000"); // throws ... #### 解决方法 -检查要解码的字节数组是否为正确的 CBOR 格式。 +检查要解码的字节数组是否是正确的 CBOR 格式。 ### CborSyntaxError -继承自: `CborWellFormednessError` +继承自:`CborWellFormednessError` -它指示输入字节与 CBOR 编码格式不匹配。 +表示输入字节与 CBOR 编码格式不匹配。 [RFC8949](https://datatracker.ietf.org/doc/html/rfc8949#section-appendix.f-2.6) @@ -670,13 +670,13 @@ await db.connect("http://localhost:8000"); // throws ... #### 解决方法 -检查要解码的字节数组是否为正确的 CBOR 格式。 +检查要解码的字节数组是否是正确的 CBOR 格式。 ### CborMaxDepthReachedError -继承自: `CborError` +继承自:`CborError` -当在 CBOR 编码或解码过程中 JavaScript 对象的深度达到最大值时抛出此错误。每次进入对象或数组时深度都会增加 1。 +当在 CBOR 编码或解码期间 JavaScript 对象的深度达到最大值时抛出此错误。每次进入对象或数组时,深度都会增加 1。 #### 属性 @@ -688,10 +688,10 @@ await db.connect("http://localhost:8000"); // throws ... #### 解决方法 -放松可选的 `.maxDepth` 上限,或者重新设计数据结构,使其嵌套更浅。 +放宽可选的 `.maxDepth` 上限,或重新设计数据结构以使其嵌套较浅。 ```ts -import CborFormatter from "@tai-kun/surrealdb/formatters/cbor"; +import CborFormatter from "@tai-kun/surrealdb/cbor-formatter"; const cborFormatter = new CborFormatter({ encode: { @@ -706,9 +706,9 @@ const cborFormatter = new CborFormatter({ ### CborUnsafeMapKeyError -继承自: `CborError` +继承自:`CborError` -当在 CBOR 编码或解码过程中遇到不安全的映射键时抛出此错误。 +当在 CBOR 编码或解码期间遇到不安全的映射键时抛出此错误。 #### 属性 @@ -716,15 +716,15 @@ const cborFormatter = new CborFormatter({ : 错误名称。 `.key: unknown` -: 被判定为不安全的映射键。 +: 被判断为不安全的映射键。 ## JSON ### JsonError -继承自: `SurrealError` +继承自:`SurrealError` -这是 `@tai-kun/surrealdb/formatters/json` 显式抛出的与 JSON 相关的错误的基类。它不会直接抛出。 +它是 `@tai-kun/surrealdb/json` 显式抛出的所有与 JSON-formatter 相关的错误的基类。 #### 属性 @@ -733,9 +733,9 @@ const cborFormatter = new CborFormatter({ ### JsonUnsafeMapKeyError -继承自: `JsonError` +继承自:`JsonError` -当在 JSON 解码过程中遇到不安全的映射键时抛出此错误。 +当在 JSON 解码期间遇到不安全的映射键时抛出此错误。 #### 属性 @@ -743,4 +743,4 @@ const cborFormatter = new CborFormatter({ : 错误名称。 `.key: unknown` -: 被判定为不安全的映射键。 +: 被判断为不安全的映射键。 diff --git a/docs/src/content/docs/zh-CN/v2/supports.mdx b/docs/src/content/docs/zh-CN/v2/supports.mdx index 0cd02a16..cebc0150 100644 --- a/docs/src/content/docs/zh-CN/v2/supports.mdx +++ b/docs/src/content/docs/zh-CN/v2/supports.mdx @@ -1,5 +1,5 @@ --- -title: 支持的環境 +title: 支持的环境 slug: zh-CN/v2/supports --- @@ -7,7 +7,7 @@ import { Aside } from "@astrojs/starlight/components" ## JavaScript -该 SDK 使用了 `bigint`,因此需要 JavaScript 语言规范 ES2020 或更高版本。此外,考虑到该 SDK 在运行时的要求,它预计可以在以下运行时环境中运行: +该 SDK 使用 `bigint`,因此需要 JavaScript 语言规范 ES2020 及更高版本。此外,考虑到 SDK 在运行时所需的特性,它应该可以在以下运行时环境中运行: | 运行时 | 版本 | | --- | --- | @@ -21,18 +21,18 @@ import { Aside } from "@astrojs/starlight/components" ## 测试 -测试使用 Vitest 和 Playwright。由于我们在运行时环境的最低版本上进行测试,因此实际运行时环境可能低于此处列出的版本,但仍可能正常工作。 +测试使用 Vitest 和 Playwright。由于我们在测试的运行时环境是最小版本,因此实际上可能在更旧的运行时环境中也能工作。 ### 服务器 | 运行时 | 版本 | 状态 | | --- | --- | --- | | SurrealDB | `^2.0.0` | [GitHub](https://github.com/surrealdb/surrealdb) | -| Node.js | `18.x`,
`20.x`,
`^22.5.1` | [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/tai-kun/surrealdb.js/nodejs.yml?branch=main&logo=Node.js&label=Node.js)](https://github.com/tai-kun/surrealdb.js/actions/workflows/nodejs.yml) | +| Node.js | `18.x`,
`20.x`,
`^22.5.1`,
`23.x` | [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/tai-kun/surrealdb.js/nodejs.yml?branch=main&logo=Node.js&label=Node.js)](https://github.com/tai-kun/surrealdb.js/actions/workflows/nodejs.yml) | | Deno | `1.x`, `2.x` | [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/tai-kun/surrealdb.js/deno.yml?branch=main&logo=Deno&label=Deno)](https://github.com/tai-kun/surrealdb.js/actions/workflows/deno.yml) | | Bun | `^1.1.13` | [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/tai-kun/surrealdb.js/bun.yml?branch=main&logo=Bun&label=Bun)](https://github.com/tai-kun/surrealdb.js/actions/workflows/bun.yml) | -- 使用 Node.js v22 时,请注意它尚未成为 LTS 版本。 +- 使用 Node.js v22 时,请注意它还不是 LTS 版本。 - 建议始终使用 Deno 的最新版本。 - 建议始终使用 Bun 的最新版本。 @@ -44,4 +44,4 @@ import { Aside } from "@astrojs/starlight/components" | Firefox | `>=100` | [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/tai-kun/surrealdb.js/firefox.yml?branch=main&logo=Firefox&label=Firefox)](https://github.com/tai-kun/surrealdb.js/actions/workflows/firefox.yml) | | WebKit | `>=15.4` | [![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/tai-kun/surrealdb.js/webkit.yml?branch=main&style=flat&logo=safari&label=WebKit)](https://github.com/tai-kun/surrealdb.js/actions/workflows/webkit.yml) | -- 支持的浏览器(引擎)与 CI 上 Playwright 可运行的最低版本相匹配。因此,低于这些版本的浏览器也可能正常工作,但我们并未对其进行测试。 +- 支持的浏览器 (引擎) 与 CI 上 Playwright 工作的最小版本一致。因此,它可能在低于上述版本的版本中也能工作,但尚未测试。 diff --git a/package.json b/package.json index d851624e..41bf8cdc 100644 --- a/package.json +++ b/package.json @@ -164,17 +164,17 @@ "import": "./dist/formatters/json/index.mjs", "require": "./dist/formatters/json/index.cjs" }, - "./decode-only-data-types": { + "./decodeonly-datatypes": { "types": "./dist/data-types/decode-only/index.d.ts", "import": "./dist/data-types/decode-only/index.mjs", "require": "./dist/data-types/decode-only/index.cjs" }, - "./encodable-data-types": { + "./encodable-datatypes": { "types": "./dist/data-types/encodable/index.d.ts", "import": "./dist/data-types/encodable/index.mjs", "require": "./dist/data-types/encodable/index.cjs" }, - "./standard-data-types": { + "./standard-datatypes": { "types": "./dist/data-types/standard/index.d.ts", "import": "./dist/data-types/standard/index.mjs", "require": "./dist/data-types/standard/index.cjs" diff --git a/src/clients/standard/client.ts b/src/clients/standard/client.ts index 4b75cd83..f7033e79 100644 --- a/src/clients/standard/client.ts +++ b/src/clients/standard/client.ts @@ -1,4 +1,4 @@ -import Base, { type ClientRpcOptions } from "@tai-kun/surrealdb/clients/basic"; +import Base, { type ClientRpcOptions } from "@tai-kun/surrealdb/basic-client"; import { QueryFailedError } from "@tai-kun/surrealdb/errors"; import type { Auth, @@ -18,7 +18,7 @@ import type { DataType } from "../../surreal/data-types"; import Jwt from "./jwt"; // re-exports -export type * from "@tai-kun/surrealdb/clients/basic"; +export type * from "@tai-kun/surrealdb/basic-client"; type Override = Simplify & U>; diff --git a/src/clients/standard/jwt.ts b/src/clients/standard/jwt.ts index 7ddd9e03..b6ddc736 100644 --- a/src/clients/standard/jwt.ts +++ b/src/clients/standard/jwt.ts @@ -1,4 +1,4 @@ -import type { Encodable } from "@tai-kun/surrealdb/data-types/encodable"; +import type { Encodable } from "@tai-kun/surrealdb/encodable-datatypes"; import { SurrealValueError } from "@tai-kun/surrealdb/errors"; import { base64url, quoteStr } from "@tai-kun/surrealdb/utils"; diff --git a/src/data-types/encodable/bound-excluded.ts b/src/data-types/encodable/bound-excluded.ts index fbe58050..d15acc2e 100644 --- a/src/data-types/encodable/bound-excluded.ts +++ b/src/data-types/encodable/bound-excluded.ts @@ -1,7 +1,7 @@ import { BoundExcluded as Base, type BoundExcludedSource, -} from "@tai-kun/surrealdb/data-types/decode-only"; +} from "@tai-kun/surrealdb/decodeonly-datatypes"; import { toSurql } from "@tai-kun/surrealdb/utils"; import { CBOR_TAG_BOUND_EXCLUDED, type Encodable } from "./spec"; diff --git a/src/data-types/encodable/bound-included.ts b/src/data-types/encodable/bound-included.ts index 88013d24..97ca114e 100644 --- a/src/data-types/encodable/bound-included.ts +++ b/src/data-types/encodable/bound-included.ts @@ -1,7 +1,7 @@ import { BoundIncluded as Base, type BoundIncludedSource, -} from "@tai-kun/surrealdb/data-types/decode-only"; +} from "@tai-kun/surrealdb/decodeonly-datatypes"; import { toSurql } from "@tai-kun/surrealdb/utils"; import { CBOR_TAG_BOUND_INCLUDED, type Encodable } from "./spec"; diff --git a/src/data-types/encodable/datetime.ts b/src/data-types/encodable/datetime.ts index e5dee883..d35965fc 100644 --- a/src/data-types/encodable/datetime.ts +++ b/src/data-types/encodable/datetime.ts @@ -1,4 +1,4 @@ -import { Datetime as Base } from "@tai-kun/surrealdb/data-types/decode-only"; +import { Datetime as Base } from "@tai-kun/surrealdb/decodeonly-datatypes"; import { quoteStr } from "@tai-kun/surrealdb/utils"; import { toISOString } from "../_internals/datetime"; import { CBOR_TAG_DATETIME, type Encodable } from "./spec"; diff --git a/src/data-types/encodable/decimal.ts b/src/data-types/encodable/decimal.ts index 62905821..e2d88adb 100644 --- a/src/data-types/encodable/decimal.ts +++ b/src/data-types/encodable/decimal.ts @@ -1,4 +1,4 @@ -import { Decimal as Base } from "@tai-kun/surrealdb/data-types/decode-only"; +import { Decimal as Base } from "@tai-kun/surrealdb/decodeonly-datatypes"; import { CBOR_TAG_DECIMAL, type Encodable } from "./spec"; export type * from "../decode-only/decimal"; diff --git a/src/data-types/encodable/duration.ts b/src/data-types/encodable/duration.ts index d5a2797a..8d91f362 100644 --- a/src/data-types/encodable/duration.ts +++ b/src/data-types/encodable/duration.ts @@ -1,4 +1,4 @@ -import { Duration as Base } from "@tai-kun/surrealdb/data-types/decode-only"; +import { Duration as Base } from "@tai-kun/surrealdb/decodeonly-datatypes"; import { NumberRangeError } from "@tai-kun/surrealdb/errors"; import { CBOR_TAG_DURATION, type Encodable } from "./spec"; diff --git a/src/data-types/encodable/future.ts b/src/data-types/encodable/future.ts index f3bad8dc..84884367 100644 --- a/src/data-types/encodable/future.ts +++ b/src/data-types/encodable/future.ts @@ -1,4 +1,4 @@ -import { Future as Base } from "@tai-kun/surrealdb/data-types/decode-only"; +import { Future as Base } from "@tai-kun/surrealdb/decodeonly-datatypes"; import { CBOR_TAG_FUTURE, type Encodable } from "./spec"; export type * from "../decode-only/future"; diff --git a/src/data-types/encodable/geometry-collection.ts b/src/data-types/encodable/geometry-collection.ts index 3de9e202..6d60628a 100644 --- a/src/data-types/encodable/geometry-collection.ts +++ b/src/data-types/encodable/geometry-collection.ts @@ -2,7 +2,7 @@ import { GeometryCollectionBase as Base, type GeometryCollectionSource as GeometryCollectionSourceBase, type GeometryCollectionTypes as GeometryCollectionTypesBase, -} from "@tai-kun/surrealdb/data-types/decode-only"; +} from "@tai-kun/surrealdb/decodeonly-datatypes"; import { toSurql } from "@tai-kun/surrealdb/utils"; import type { Coord } from "../_internals/geometry"; import { diff --git a/src/data-types/encodable/geometry-line.ts b/src/data-types/encodable/geometry-line.ts index 483f183b..92e78d86 100644 --- a/src/data-types/encodable/geometry-line.ts +++ b/src/data-types/encodable/geometry-line.ts @@ -2,7 +2,7 @@ import { GeometryLineBase as Base, type GeometryLineSource as GeometryLineSourceBase, type GeometryLineTypes as GeometryLineTypesBase, -} from "@tai-kun/surrealdb/data-types/decode-only"; +} from "@tai-kun/surrealdb/decodeonly-datatypes"; import { toSurql } from "@tai-kun/surrealdb/utils"; import { type Coord, map } from "../_internals/geometry"; import { diff --git a/src/data-types/encodable/geometry-multiline.ts b/src/data-types/encodable/geometry-multiline.ts index a6761acf..4e2eb9a6 100644 --- a/src/data-types/encodable/geometry-multiline.ts +++ b/src/data-types/encodable/geometry-multiline.ts @@ -2,7 +2,7 @@ import { GeometryMultiLineBase as Base, type GeometryMultiLineSource as GeometryMultiLineSourceBase, type GeometryMultiLineTypes as GeometryMultiLineTypesBase, -} from "@tai-kun/surrealdb/data-types/decode-only"; +} from "@tai-kun/surrealdb/decodeonly-datatypes"; import { toSurql } from "@tai-kun/surrealdb/utils"; import { type Coord, map } from "../_internals/geometry"; import { diff --git a/src/data-types/encodable/geometry-multipoint.ts b/src/data-types/encodable/geometry-multipoint.ts index 43197034..73bb7936 100644 --- a/src/data-types/encodable/geometry-multipoint.ts +++ b/src/data-types/encodable/geometry-multipoint.ts @@ -2,7 +2,7 @@ import { GeometryMultiPointBase as Base, type GeometryMultiPointSource as GeometryMultiPointSourceBase, type GeometryMultiPointTypes as GeometryMultiPointTypesBase, -} from "@tai-kun/surrealdb/data-types/decode-only"; +} from "@tai-kun/surrealdb/decodeonly-datatypes"; import { toSurql } from "@tai-kun/surrealdb/utils"; import { type Coord, map } from "../_internals/geometry"; import { diff --git a/src/data-types/encodable/geometry-multipolygon.ts b/src/data-types/encodable/geometry-multipolygon.ts index af841896..a5e6f8fe 100644 --- a/src/data-types/encodable/geometry-multipolygon.ts +++ b/src/data-types/encodable/geometry-multipolygon.ts @@ -2,7 +2,7 @@ import { GeometryMultiPolygonBase as Base, type GeometryMultiPolygonSource as GeometryMultiPolygonSourceBase, type GeometryMultiPolygonTypes as GeometryMultiPolygonTypesBase, -} from "@tai-kun/surrealdb/data-types/decode-only"; +} from "@tai-kun/surrealdb/decodeonly-datatypes"; import { toSurql } from "@tai-kun/surrealdb/utils"; import { type Coord, map } from "../_internals/geometry"; import type { GeometryLineBase, GeometryLineTypes } from "./geometry-line"; diff --git a/src/data-types/encodable/geometry-point.ts b/src/data-types/encodable/geometry-point.ts index cc4c101b..2935605c 100644 --- a/src/data-types/encodable/geometry-point.ts +++ b/src/data-types/encodable/geometry-point.ts @@ -2,7 +2,7 @@ import { GeometryPointBase as Base, type GeometryPointSource, type GeometryPointTypes, -} from "@tai-kun/surrealdb/data-types/decode-only"; +} from "@tai-kun/surrealdb/decodeonly-datatypes"; import { toSurql } from "@tai-kun/surrealdb/utils"; import { type CoordValue, map } from "../_internals/geometry"; import { CBOR_TAG_GEOMETRY_POINT, type Encodable } from "./spec"; diff --git a/src/data-types/encodable/geometry-polygon.ts b/src/data-types/encodable/geometry-polygon.ts index f01a732a..e97412c3 100644 --- a/src/data-types/encodable/geometry-polygon.ts +++ b/src/data-types/encodable/geometry-polygon.ts @@ -2,7 +2,7 @@ import { GeometryPolygonBase as Base, type GeometryPolygonSource as GeometryPolygonSourceBase, type GeometryPolygonTypes as GeometryPolygonTypesBase, -} from "@tai-kun/surrealdb/data-types/decode-only"; +} from "@tai-kun/surrealdb/decodeonly-datatypes"; import { toSurql } from "@tai-kun/surrealdb/utils"; import { type Coord, map } from "../_internals/geometry"; import { diff --git a/src/data-types/encodable/range.ts b/src/data-types/encodable/range.ts index eee3db4a..4967ea43 100644 --- a/src/data-types/encodable/range.ts +++ b/src/data-types/encodable/range.ts @@ -1,4 +1,4 @@ -import { RangeBase as Base } from "@tai-kun/surrealdb/data-types/decode-only"; +import { RangeBase as Base } from "@tai-kun/surrealdb/decodeonly-datatypes"; import { SurrealTypeError } from "@tai-kun/surrealdb/errors"; import { isBoundExcluded, isBoundIncluded } from "@tai-kun/surrealdb/utils"; import BoundExcluded from "./bound-excluded"; diff --git a/src/data-types/encodable/table.ts b/src/data-types/encodable/table.ts index 0709c659..8c0fb37e 100644 --- a/src/data-types/encodable/table.ts +++ b/src/data-types/encodable/table.ts @@ -1,7 +1,7 @@ import { Table as Base, type TableSource, -} from "@tai-kun/surrealdb/data-types/decode-only"; +} from "@tai-kun/surrealdb/decodeonly-datatypes"; import { escapeIdent } from "@tai-kun/surrealdb/utils"; import { CBOR_TAG_TABLE, type Encodable } from "./spec"; diff --git a/src/data-types/encodable/thing.ts b/src/data-types/encodable/thing.ts index 6ed17d02..ea09ef50 100644 --- a/src/data-types/encodable/thing.ts +++ b/src/data-types/encodable/thing.ts @@ -3,7 +3,7 @@ import { type ThingIdSource, type ThingSource, type ThingTableSource, -} from "@tai-kun/surrealdb/data-types/decode-only"; +} from "@tai-kun/surrealdb/decodeonly-datatypes"; import { quoteStr } from "@tai-kun/surrealdb/utils"; import { toString } from "../_internals/thing"; import { CBOR_TAG_RECORDID, type Encodable } from "./spec"; diff --git a/src/data-types/encodable/uuid.ts b/src/data-types/encodable/uuid.ts index 19826b1f..f85e9e3f 100644 --- a/src/data-types/encodable/uuid.ts +++ b/src/data-types/encodable/uuid.ts @@ -1,4 +1,4 @@ -import { Uuid as Base } from "@tai-kun/surrealdb/data-types/decode-only"; +import { Uuid as Base } from "@tai-kun/surrealdb/decodeonly-datatypes"; import { quoteStr } from "@tai-kun/surrealdb/utils"; import { CBOR_TAG_UUID, type Encodable } from "./spec"; diff --git a/src/data-types/standard/bound-excluded.ts b/src/data-types/standard/bound-excluded.ts index e93424c5..2fd934ff 100644 --- a/src/data-types/standard/bound-excluded.ts +++ b/src/data-types/standard/bound-excluded.ts @@ -1,7 +1,7 @@ import { BoundExcluded as Base, type BoundExcludedSource, -} from "@tai-kun/surrealdb/data-types/encodable"; +} from "@tai-kun/surrealdb/encodable-datatypes"; import type { Standard } from "./spec"; export type * from "../encodable/bound-excluded"; diff --git a/src/data-types/standard/bound-included.ts b/src/data-types/standard/bound-included.ts index e32978cc..db59258e 100644 --- a/src/data-types/standard/bound-included.ts +++ b/src/data-types/standard/bound-included.ts @@ -1,7 +1,7 @@ import { BoundIncluded as Base, type BoundIncludedSource, -} from "@tai-kun/surrealdb/data-types/encodable"; +} from "@tai-kun/surrealdb/encodable-datatypes"; import type { Standard } from "./spec"; export type * from "../encodable/bound-included"; diff --git a/src/data-types/standard/datetime.ts b/src/data-types/standard/datetime.ts index 3adfc2ea..264f6cca 100644 --- a/src/data-types/standard/datetime.ts +++ b/src/data-types/standard/datetime.ts @@ -2,7 +2,7 @@ import { CBOR_TAG_DATETIME, type DatetimeSource, type Encodable, -} from "@tai-kun/surrealdb/data-types/encodable"; +} from "@tai-kun/surrealdb/encodable-datatypes"; import { SurrealValueError } from "@tai-kun/surrealdb/errors"; import { isSafeNumber, quoteStr } from "@tai-kun/surrealdb/utils"; import { toISOString } from "../_internals/datetime"; diff --git a/src/data-types/standard/decimal.ts b/src/data-types/standard/decimal.ts index 770fb870..cfe3ab5d 100644 --- a/src/data-types/standard/decimal.ts +++ b/src/data-types/standard/decimal.ts @@ -1,7 +1,7 @@ import { CBOR_TAG_DECIMAL, type Encodable, -} from "@tai-kun/surrealdb/data-types/encodable"; +} from "@tai-kun/surrealdb/encodable-datatypes"; import { Big } from "big.js"; import { defineAsDecimal } from "../_internals/define"; diff --git a/src/data-types/standard/duration.ts b/src/data-types/standard/duration.ts index 5b1771ee..8966041b 100644 --- a/src/data-types/standard/duration.ts +++ b/src/data-types/standard/duration.ts @@ -1,7 +1,7 @@ import { Duration as Base, type DurationSource, -} from "@tai-kun/surrealdb/data-types/encodable"; +} from "@tai-kun/surrealdb/encodable-datatypes"; import { NumberRangeError, SurrealTypeError, diff --git a/src/data-types/standard/future.ts b/src/data-types/standard/future.ts index 91e9d63c..a974d355 100644 --- a/src/data-types/standard/future.ts +++ b/src/data-types/standard/future.ts @@ -1,4 +1,4 @@ -import { Future as Base } from "@tai-kun/surrealdb/data-types/encodable"; +import { Future as Base } from "@tai-kun/surrealdb/encodable-datatypes"; import { SurrealTypeError, SurrealValueError } from "@tai-kun/surrealdb/errors"; import { toSurql } from "@tai-kun/surrealdb/utils"; import { escapeTb, toString } from "../_internals/thing"; @@ -71,7 +71,7 @@ export default class Future extends Base implements Standard { } } -const THING = /* @__PURE__ */ Symbol.for("@tai-kun/surrealdb/data-types/thing"); +const THING = /* @__PURE__ */ Symbol.for("@tai-kun/surrealdb/thing-datatypes"); function isThing(o: unknown): o is { readonly table: string; diff --git a/src/data-types/standard/geometry-collection.ts b/src/data-types/standard/geometry-collection.ts index c069040d..0c4408d3 100644 --- a/src/data-types/standard/geometry-collection.ts +++ b/src/data-types/standard/geometry-collection.ts @@ -3,7 +3,7 @@ import { GeometryCollectionBase as Base, type GeometryCollectionSource as GeometryCollectionSourceBase, type GeometryCollectionTypes as GeometryCollectionTypesBase, -} from "@tai-kun/surrealdb/data-types/encodable"; +} from "@tai-kun/surrealdb/encodable-datatypes"; import { type Coord, isGeometryCollection } from "../_internals/geometry"; import { GeometryLine, diff --git a/src/data-types/standard/geometry-line.ts b/src/data-types/standard/geometry-line.ts index fc81ed57..b98d4baa 100644 --- a/src/data-types/standard/geometry-line.ts +++ b/src/data-types/standard/geometry-line.ts @@ -3,7 +3,7 @@ import { GeometryLineBase as Base, type GeometryLineSource as GeometryLineSourceBase, type GeometryLineTypes as GeometryLineTypesBase, -} from "@tai-kun/surrealdb/data-types/encodable"; +} from "@tai-kun/surrealdb/encodable-datatypes"; import { type Coord, isGeometryLine, map } from "../_internals/geometry"; import { GeometryPoint, diff --git a/src/data-types/standard/geometry-multiline.ts b/src/data-types/standard/geometry-multiline.ts index 7e29f5b3..52d5344b 100644 --- a/src/data-types/standard/geometry-multiline.ts +++ b/src/data-types/standard/geometry-multiline.ts @@ -3,7 +3,7 @@ import { GeometryMultiLineBase as Base, type GeometryMultiLineSource as GeometryMultiLineSourceBase, type GeometryMultiLineTypes as GeometryMultiLineTypesBase, -} from "@tai-kun/surrealdb/data-types/encodable"; +} from "@tai-kun/surrealdb/encodable-datatypes"; import { type Coord, isGeometryMultiLine, map } from "../_internals/geometry"; import { GeometryLine, diff --git a/src/data-types/standard/geometry-multipoint.ts b/src/data-types/standard/geometry-multipoint.ts index 26844e57..c4b63c8a 100644 --- a/src/data-types/standard/geometry-multipoint.ts +++ b/src/data-types/standard/geometry-multipoint.ts @@ -3,7 +3,7 @@ import { GeometryMultiPointBase as Base, type GeometryMultiPointSource as GeometryMultiPointSourceBase, type GeometryMultiPointTypes as GeometryMultiPointTypesBase, -} from "@tai-kun/surrealdb/data-types/encodable"; +} from "@tai-kun/surrealdb/encodable-datatypes"; import { type Coord, isGeometryMultiPoint, map } from "../_internals/geometry"; import { GeometryPoint, diff --git a/src/data-types/standard/geometry-multipolygon.ts b/src/data-types/standard/geometry-multipolygon.ts index 78ff8301..1f8641e7 100644 --- a/src/data-types/standard/geometry-multipolygon.ts +++ b/src/data-types/standard/geometry-multipolygon.ts @@ -3,7 +3,7 @@ import { GeometryMultiPolygonBase as Base, type GeometryMultiPolygonSource as GeometryMultiPolygonSourceBase, type GeometryMultiPolygonTypes as GeometryMultiPolygonTypesBase, -} from "@tai-kun/surrealdb/data-types/encodable"; +} from "@tai-kun/surrealdb/encodable-datatypes"; import { type Coord, isGeometryMultiPolygon, diff --git a/src/data-types/standard/geometry-point.ts b/src/data-types/standard/geometry-point.ts index 75aa3e76..0b4a8d64 100644 --- a/src/data-types/standard/geometry-point.ts +++ b/src/data-types/standard/geometry-point.ts @@ -3,7 +3,7 @@ import { GeometryPointBase as Base, type GeometryPointSource, type GeometryPointTypes, -} from "@tai-kun/surrealdb/data-types/encodable"; +} from "@tai-kun/surrealdb/encodable-datatypes"; import { canClone } from "@tai-kun/surrealdb/utils"; import { coord, diff --git a/src/data-types/standard/geometry-polygon.ts b/src/data-types/standard/geometry-polygon.ts index 471d4e55..d8884be7 100644 --- a/src/data-types/standard/geometry-polygon.ts +++ b/src/data-types/standard/geometry-polygon.ts @@ -3,7 +3,7 @@ import { GeometryPolygonBase as Base, type GeometryPolygonSource as GeometryPolygonSourceBase, type GeometryPolygonTypes as GeometryPolygonTypesBase, -} from "@tai-kun/surrealdb/data-types/encodable"; +} from "@tai-kun/surrealdb/encodable-datatypes"; import { type Coord, isGeometryPolygon, map } from "../_internals/geometry"; import { GeometryLine, diff --git a/src/data-types/standard/range.ts b/src/data-types/standard/range.ts index 756cfb91..4bfa5ce8 100644 --- a/src/data-types/standard/range.ts +++ b/src/data-types/standard/range.ts @@ -1,4 +1,4 @@ -import { RangeBase as Base } from "@tai-kun/surrealdb/data-types/encodable"; +import { RangeBase as Base } from "@tai-kun/surrealdb/encodable-datatypes"; import BoundExcluded from "./bound-excluded"; import BoundIncluded from "./bound-included"; import type { Standard } from "./spec"; diff --git a/src/data-types/standard/spec.ts b/src/data-types/standard/spec.ts index 9be08141..b3cba94a 100644 --- a/src/data-types/standard/spec.ts +++ b/src/data-types/standard/spec.ts @@ -1,4 +1,4 @@ -import type { Encodable } from "@tai-kun/surrealdb/data-types/encodable"; +import type { Encodable } from "@tai-kun/surrealdb/encodable-datatypes"; import type { Clone } from "@tai-kun/surrealdb/utils"; export interface Standard extends Encodable, Clone {} diff --git a/src/data-types/standard/table.ts b/src/data-types/standard/table.ts index a42d46da..31189ed1 100644 --- a/src/data-types/standard/table.ts +++ b/src/data-types/standard/table.ts @@ -1,7 +1,7 @@ import { Table as Base, type TableSource, -} from "@tai-kun/surrealdb/data-types/encodable"; +} from "@tai-kun/surrealdb/encodable-datatypes"; export type * from "../encodable/table"; diff --git a/src/data-types/standard/thing.ts b/src/data-types/standard/thing.ts index 7f2e7125..04a1f632 100644 --- a/src/data-types/standard/thing.ts +++ b/src/data-types/standard/thing.ts @@ -3,7 +3,7 @@ import { type ThingIdSource, type ThingSource, type ThingTableSource, -} from "@tai-kun/surrealdb/data-types/encodable"; +} from "@tai-kun/surrealdb/encodable-datatypes"; import type { TableLike } from "./table"; export type { ThingIdSource, ThingSource, ThingTableSource }; diff --git a/src/data-types/standard/uuid.ts b/src/data-types/standard/uuid.ts index 0dac0bf6..f81f3e22 100644 --- a/src/data-types/standard/uuid.ts +++ b/src/data-types/standard/uuid.ts @@ -1,7 +1,7 @@ import { Uuid as Base, type UuidSource, -} from "@tai-kun/surrealdb/data-types/encodable"; +} from "@tai-kun/surrealdb/encodable-datatypes"; import { SurrealValueError, unreachable } from "@tai-kun/surrealdb/errors"; import { isValidBytes } from "../_internals/uuid"; diff --git a/src/formatters/cbor/formatter.ts b/src/formatters/cbor/formatter.ts index c2d88aac..204bd7eb 100644 --- a/src/formatters/cbor/formatter.ts +++ b/src/formatters/cbor/formatter.ts @@ -24,7 +24,7 @@ import type { TableSource, ThingSource, UuidSource, -} from "@tai-kun/surrealdb/data-types/decode-only"; +} from "@tai-kun/surrealdb/decodeonly-datatypes"; import { CBOR_TAG_BOUND_EXCLUDED, CBOR_TAG_BOUND_INCLUDED, @@ -44,7 +44,7 @@ import { CBOR_TAG_RECORDID, CBOR_TAG_TABLE, CBOR_TAG_UUID, -} from "@tai-kun/surrealdb/data-types/encodable"; +} from "@tai-kun/surrealdb/encodable-datatypes"; import { SurrealTypeError } from "@tai-kun/surrealdb/errors"; import { type Data, diff --git a/src/surreal/data-types.ts b/src/surreal/data-types.ts index fe41defe..ea5dff94 100644 --- a/src/surreal/data-types.ts +++ b/src/surreal/data-types.ts @@ -16,7 +16,7 @@ import type { Table as DecodeOnlyTable, Thing as DecodeOnlyThing, Uuid as DecodeOnlyUuid, -} from "@tai-kun/surrealdb/data-types/decode-only"; +} from "@tai-kun/surrealdb/decodeonly-datatypes"; import type { BoundExcluded as EncodableBoundExcluded, BoundIncluded as EncodableBoundIncluded, @@ -35,7 +35,7 @@ import type { Table as EncodableTable, Thing as EncodableThing, Uuid as EncodableUuid, -} from "@tai-kun/surrealdb/data-types/encodable"; +} from "@tai-kun/surrealdb/encodable-datatypes"; import type { BoundExcluded as StandardBoundExcluded, BoundIncluded as StandardBoundIncluded, @@ -54,7 +54,7 @@ import type { Table as StandardTable, Thing as StandardThing, Uuid as StandardUuid, -} from "@tai-kun/surrealdb/data-types/standard"; +} from "@tai-kun/surrealdb/standard-datatypes"; import { isDataTypeOf } from "@tai-kun/surrealdb/utils"; export namespace DataType { diff --git a/src/surreal/default.ts b/src/surreal/default.ts index 9cc126c4..65be26de 100644 --- a/src/surreal/default.ts +++ b/src/surreal/default.ts @@ -1,4 +1,6 @@ -import Client from "@tai-kun/surrealdb/clients/standard"; +import Formatter from "@tai-kun/surrealdb/cbor-formatter"; +import HttpEngine from "@tai-kun/surrealdb/http-engine"; +import Client from "@tai-kun/surrealdb/standard-client"; import { BoundExcluded, BoundIncluded, @@ -17,12 +19,10 @@ import { Table, Thing, Uuid, -} from "@tai-kun/surrealdb/data-types/standard"; -import HttpEngine from "@tai-kun/surrealdb/engines/http"; +} from "@tai-kun/surrealdb/standard-datatypes"; import WebSocketEngine, { type WebSocketEngineConfig, -} from "@tai-kun/surrealdb/engines/websocket"; -import Formatter from "@tai-kun/surrealdb/formatters/cbor"; +} from "@tai-kun/surrealdb/websocket-engine"; import { WebSocket } from "isows"; import initPool from "./init-pool"; import initSurreal from "./init-surreal"; diff --git a/src/surreal/init-pool.ts b/src/surreal/init-pool.ts index c6e01f32..ba13e52a 100644 --- a/src/surreal/init-pool.ts +++ b/src/surreal/init-pool.ts @@ -1,8 +1,8 @@ -import type ClientBase from "@tai-kun/surrealdb/clients/basic"; +import type ClientBase from "@tai-kun/surrealdb/basic-client"; import type { ClientCloseOptions, ClientConfig, -} from "@tai-kun/surrealdb/clients/basic"; +} from "@tai-kun/surrealdb/basic-client"; import { SurrealValueError } from "../errors"; import { mutex } from "../utils"; import createSurql, { diff --git a/src/surreal/init-surreal.ts b/src/surreal/init-surreal.ts index 7bb5e881..227cf994 100644 --- a/src/surreal/init-surreal.ts +++ b/src/surreal/init-surreal.ts @@ -1,5 +1,5 @@ -import type ClientBase from "@tai-kun/surrealdb/clients/basic"; -import type { ClientConfig } from "@tai-kun/surrealdb/clients/basic"; +import type ClientBase from "@tai-kun/surrealdb/basic-client"; +import type { ClientConfig } from "@tai-kun/surrealdb/basic-client"; import createSurql, { type CreateSurqlConfig, type Surql, diff --git a/src/surreal/inline/create-query.ts b/src/surreal/inline/create-query.ts index e785c11a..0e4706c5 100644 --- a/src/surreal/inline/create-query.ts +++ b/src/surreal/inline/create-query.ts @@ -1,5 +1,5 @@ -import type { InferSlotVars } from "@tai-kun/surrealdb/clients/standard"; import { SurrealTypeError } from "@tai-kun/surrealdb/errors"; +import type { InferSlotVars } from "@tai-kun/surrealdb/standard-client"; import type { PreparedQueryLike, SlotLike } from "@tai-kun/surrealdb/types"; import { getTimeoutSignal } from "@tai-kun/surrealdb/utils"; import type { Simplify } from "type-fest"; diff --git a/src/surreal/inline/query.ts b/src/surreal/inline/query.ts index 80e564fa..4d684f54 100644 --- a/src/surreal/inline/query.ts +++ b/src/surreal/inline/query.ts @@ -1,5 +1,5 @@ -import type { InferSlotVars } from "@tai-kun/surrealdb/clients/standard"; import { QueryFailedError } from "@tai-kun/surrealdb/errors"; +import type { InferSlotVars } from "@tai-kun/surrealdb/standard-client"; import type { PreparedQueryLike, SlotLike } from "@tai-kun/surrealdb/types"; import type { Simplify } from "type-fest"; import rpc, { type InlineRpcOptions } from "./rpc"; diff --git a/src/surreal/inline/rpc.ts b/src/surreal/inline/rpc.ts index 0de7af6e..78a8e91a 100644 --- a/src/surreal/inline/rpc.ts +++ b/src/surreal/inline/rpc.ts @@ -1,10 +1,8 @@ -import type { Jwt } from "@tai-kun/surrealdb/clients/standard"; import { processEndpoint, type ProcessEndpointOptions, processQueryRequest, } from "@tai-kun/surrealdb/engine"; -import type { HttpFetcherRequestInit } from "@tai-kun/surrealdb/engines/http"; import { MissingNamespaceError, RpcResponseError, @@ -12,7 +10,9 @@ import { SurrealTypeError, } from "@tai-kun/surrealdb/errors"; import type { Formatter } from "@tai-kun/surrealdb/formatter"; -import JsonFormatter from "@tai-kun/surrealdb/formatters/json"; +import type { HttpFetcherRequestInit } from "@tai-kun/surrealdb/http-engine"; +import JsonFormatter from "@tai-kun/surrealdb/json-formatter"; +import type { Jwt } from "@tai-kun/surrealdb/standard-client"; import type { RpcParams, RpcResultMapping } from "@tai-kun/surrealdb/types"; import { getTimeoutSignal, diff --git a/src/surreal/utils/auto-reconnect.ts b/src/surreal/utils/auto-reconnect.ts index 981d3875..c5be97c2 100644 --- a/src/surreal/utils/auto-reconnect.ts +++ b/src/surreal/utils/auto-reconnect.ts @@ -1,4 +1,4 @@ -import type Client from "@tai-kun/surrealdb/clients/basic"; +import type Client from "@tai-kun/surrealdb/basic-client"; import type { EngineEventMap } from "@tai-kun/surrealdb/engine"; import { WebSocketEngineError } from "@tai-kun/surrealdb/errors"; import { TaskEmitter } from "@tai-kun/surrealdb/utils"; diff --git a/src/surreal/utils/types.ts b/src/surreal/utils/types.ts index 730ce1ab..67d0bb90 100644 --- a/src/surreal/utils/types.ts +++ b/src/surreal/utils/types.ts @@ -1,4 +1,4 @@ -import type { InferSlotVars } from "@tai-kun/surrealdb/clients/standard"; +import type { InferSlotVars } from "@tai-kun/surrealdb/standard-client"; import type { PreparedQueryLike } from "@tai-kun/surrealdb/types"; export type InferQueryResult< diff --git a/tests/medium/availability/websocket/reconnection.test.ts b/tests/medium/availability/websocket/reconnection.test.ts index 99fe306c..b2d50b03 100644 --- a/tests/medium/availability/websocket/reconnection.test.ts +++ b/tests/medium/availability/websocket/reconnection.test.ts @@ -1,8 +1,8 @@ import { autoReconnect, initSurreal } from "@tai-kun/surrealdb"; -import Client from "@tai-kun/surrealdb/clients/standard"; -import WebSocketEngine from "@tai-kun/surrealdb/engines/websocket"; -import JsonFormatter from "@tai-kun/surrealdb/formatters/json"; +import JsonFormatter from "@tai-kun/surrealdb/json-formatter"; +import Client from "@tai-kun/surrealdb/standard-client"; import { channel } from "@tai-kun/surrealdb/utils"; +import WebSocketEngine from "@tai-kun/surrealdb/websocket-engine"; import { WebSocket } from "isows"; import { afterEach, beforeEach, expect, test, vi } from "vitest"; import { stopSurrealDb, viWaitForSurrealDb } from "../../surrealdb"; diff --git a/tests/medium/inline/query.test.ts b/tests/medium/inline/query.test.ts index 3db661bd..eee28728 100644 --- a/tests/medium/inline/query.test.ts +++ b/tests/medium/inline/query.test.ts @@ -1,5 +1,5 @@ import { createSurql, query, rpc } from "@tai-kun/surrealdb"; -import JsonFormatter from "@tai-kun/surrealdb/formatters/json"; +import JsonFormatter from "@tai-kun/surrealdb/json-formatter"; import { beforeAll, expect, expectTypeOf, test } from "vitest"; import { host } from "../surreal"; diff --git a/tests/medium/inline/rpc.test.ts b/tests/medium/inline/rpc.test.ts index 76ba3b9a..99cd7570 100644 --- a/tests/medium/inline/rpc.test.ts +++ b/tests/medium/inline/rpc.test.ts @@ -1,7 +1,7 @@ import { rpc } from "@tai-kun/surrealdb"; -import { Jwt } from "@tai-kun/surrealdb/clients/standard"; -import * as decodeOnlyDataTypes from "@tai-kun/surrealdb/data-types/decode-only"; -import CborFormatter from "@tai-kun/surrealdb/formatters/cbor"; +import CborFormatter from "@tai-kun/surrealdb/cbor-formatter"; +import * as decodeOnlyDataTypes from "@tai-kun/surrealdb/decodeonly-datatypes"; +import { Jwt } from "@tai-kun/surrealdb/standard-client"; import { expect, test } from "vitest"; import { host } from "../surreal"; diff --git a/tests/medium/surreal.ts b/tests/medium/surreal.ts index 29a549ce..c6255ee8 100644 --- a/tests/medium/surreal.ts +++ b/tests/medium/surreal.ts @@ -1,10 +1,10 @@ import { type InitializedSurreal, initSurreal } from "@tai-kun/surrealdb"; -import Client from "@tai-kun/surrealdb/clients/standard"; -import * as dataTypes from "@tai-kun/surrealdb/data-types/standard"; -import HttpEngine from "@tai-kun/surrealdb/engines/http"; -import WebSocketEngine from "@tai-kun/surrealdb/engines/websocket"; -import CborFormatter from "@tai-kun/surrealdb/formatters/cbor"; -import JsonFormatter from "@tai-kun/surrealdb/formatters/json"; +import CborFormatter from "@tai-kun/surrealdb/cbor-formatter"; +import HttpEngine from "@tai-kun/surrealdb/http-engine"; +import JsonFormatter from "@tai-kun/surrealdb/json-formatter"; +import Client from "@tai-kun/surrealdb/standard-client"; +import * as dataTypes from "@tai-kun/surrealdb/standard-datatypes"; +import WebSocketEngine from "@tai-kun/surrealdb/websocket-engine"; import { SemVer } from "semver"; import { afterAll, beforeAll } from "vitest"; import { WebSocket } from "ws"; diff --git a/tests/small/data-types/datetime.test.ts b/tests/small/data-types/datetime.test.ts index d3178023..f4b135b6 100644 --- a/tests/small/data-types/datetime.test.ts +++ b/tests/small/data-types/datetime.test.ts @@ -3,8 +3,8 @@ import { decode, encode } from "@tai-kun/surrealdb/cbor"; import { CBOR_TAG_DATETIME, Datetime as EncodableDatetime, -} from "@tai-kun/surrealdb/data-types/encodable"; -import { Datetime } from "@tai-kun/surrealdb/data-types/standard"; +} from "@tai-kun/surrealdb/encodable-datatypes"; +import { Datetime } from "@tai-kun/surrealdb/standard-datatypes"; import { describe, expect, test } from "vitest"; type Suite = diff --git a/tests/small/data-types/decimal.test.ts b/tests/small/data-types/decimal.test.ts index 2021c3d6..b5f627f5 100644 --- a/tests/small/data-types/decimal.test.ts +++ b/tests/small/data-types/decimal.test.ts @@ -3,8 +3,8 @@ import { decode, encode } from "@tai-kun/surrealdb/cbor"; import { CBOR_TAG_DECIMAL, Decimal as EncodableDecimal, -} from "@tai-kun/surrealdb/data-types/encodable"; -import { Decimal } from "@tai-kun/surrealdb/data-types/standard"; +} from "@tai-kun/surrealdb/encodable-datatypes"; +import { Decimal } from "@tai-kun/surrealdb/standard-datatypes"; import { describe, expect, test } from "vitest"; // ----------------------------------------------------------------------------- diff --git a/tests/small/data-types/duration.test.ts b/tests/small/data-types/duration.test.ts index b6d38f2c..a4286cd6 100644 --- a/tests/small/data-types/duration.test.ts +++ b/tests/small/data-types/duration.test.ts @@ -1,7 +1,7 @@ import { isDuration } from "@tai-kun/surrealdb"; import { decode, encode } from "@tai-kun/surrealdb/cbor"; -import { CBOR_TAG_DURATION } from "@tai-kun/surrealdb/data-types/encodable"; -import { Duration } from "@tai-kun/surrealdb/data-types/standard"; +import { CBOR_TAG_DURATION } from "@tai-kun/surrealdb/encodable-datatypes"; +import { Duration } from "@tai-kun/surrealdb/standard-datatypes"; import { describe, expect, test } from "vitest"; const valid = Object.entries({ diff --git a/tests/small/data-types/future.test.ts b/tests/small/data-types/future.test.ts index b4e991d4..14ff2b3e 100644 --- a/tests/small/data-types/future.test.ts +++ b/tests/small/data-types/future.test.ts @@ -1,4 +1,4 @@ -import { Future, Thing } from "@tai-kun/surrealdb/data-types/standard"; +import { Future, Thing } from "@tai-kun/surrealdb/standard-datatypes"; import { toSurql } from "@tai-kun/surrealdb/utils"; import { expect, test } from "vitest"; diff --git a/tests/small/data-types/geometry-collection.test.ts b/tests/small/data-types/geometry-collection.test.ts index cfa4891e..19ecb1cb 100644 --- a/tests/small/data-types/geometry-collection.test.ts +++ b/tests/small/data-types/geometry-collection.test.ts @@ -8,7 +8,7 @@ import { CBOR_TAG_GEOMETRY_MULTIPOLYGON, CBOR_TAG_GEOMETRY_POINT, CBOR_TAG_GEOMETRY_POLYGON, -} from "@tai-kun/surrealdb/data-types/encodable"; +} from "@tai-kun/surrealdb/encodable-datatypes"; import { GeometryCollection, GeometryLine, @@ -17,7 +17,7 @@ import { GeometryMultiPolygon, GeometryPoint, GeometryPolygon, -} from "@tai-kun/surrealdb/data-types/standard"; +} from "@tai-kun/surrealdb/standard-datatypes"; import { expect, test } from "vitest"; test(".collection", () => { diff --git a/tests/small/data-types/geometry-line.test.ts b/tests/small/data-types/geometry-line.test.ts index 251c5827..31b404e3 100644 --- a/tests/small/data-types/geometry-line.test.ts +++ b/tests/small/data-types/geometry-line.test.ts @@ -3,11 +3,11 @@ import { decode, encode } from "@tai-kun/surrealdb/cbor"; import { CBOR_TAG_GEOMETRY_LINE, CBOR_TAG_GEOMETRY_POINT, -} from "@tai-kun/surrealdb/data-types/encodable"; +} from "@tai-kun/surrealdb/encodable-datatypes"; import { GeometryLine, GeometryPoint, -} from "@tai-kun/surrealdb/data-types/standard"; +} from "@tai-kun/surrealdb/standard-datatypes"; import { expect, test } from "vitest"; test(".line", () => { diff --git a/tests/small/data-types/geometry-multiline.test.ts b/tests/small/data-types/geometry-multiline.test.ts index 6afd5a79..ff6a0fae 100644 --- a/tests/small/data-types/geometry-multiline.test.ts +++ b/tests/small/data-types/geometry-multiline.test.ts @@ -4,12 +4,12 @@ import { CBOR_TAG_GEOMETRY_LINE, CBOR_TAG_GEOMETRY_MULTILINE, CBOR_TAG_GEOMETRY_POINT, -} from "@tai-kun/surrealdb/data-types/encodable"; +} from "@tai-kun/surrealdb/encodable-datatypes"; import { GeometryLine, GeometryMultiLine, GeometryPoint, -} from "@tai-kun/surrealdb/data-types/standard"; +} from "@tai-kun/surrealdb/standard-datatypes"; import { expect, test } from "vitest"; test(".lines", () => { diff --git a/tests/small/data-types/geometry-multipoint.test.ts b/tests/small/data-types/geometry-multipoint.test.ts index fa30bc39..4f854828 100644 --- a/tests/small/data-types/geometry-multipoint.test.ts +++ b/tests/small/data-types/geometry-multipoint.test.ts @@ -3,11 +3,11 @@ import { decode, encode } from "@tai-kun/surrealdb/cbor"; import { CBOR_TAG_GEOMETRY_MULTIPOINT, CBOR_TAG_GEOMETRY_POINT, -} from "@tai-kun/surrealdb/data-types/encodable"; +} from "@tai-kun/surrealdb/encodable-datatypes"; import { GeometryMultiPoint, GeometryPoint, -} from "@tai-kun/surrealdb/data-types/standard"; +} from "@tai-kun/surrealdb/standard-datatypes"; import { expect, test } from "vitest"; test(".points", () => { diff --git a/tests/small/data-types/geometry-multipolygon.test.ts b/tests/small/data-types/geometry-multipolygon.test.ts index 8a6793be..5377a877 100644 --- a/tests/small/data-types/geometry-multipolygon.test.ts +++ b/tests/small/data-types/geometry-multipolygon.test.ts @@ -5,13 +5,13 @@ import { CBOR_TAG_GEOMETRY_MULTIPOLYGON, CBOR_TAG_GEOMETRY_POINT, CBOR_TAG_GEOMETRY_POLYGON, -} from "@tai-kun/surrealdb/data-types/encodable"; +} from "@tai-kun/surrealdb/encodable-datatypes"; import { GeometryLine, GeometryMultiPolygon, GeometryPoint, GeometryPolygon, -} from "@tai-kun/surrealdb/data-types/standard"; +} from "@tai-kun/surrealdb/standard-datatypes"; import { expect, test } from "vitest"; test(".polygons", () => { diff --git a/tests/small/data-types/geometry-point.test.ts b/tests/small/data-types/geometry-point.test.ts index c5880eae..2adce481 100644 --- a/tests/small/data-types/geometry-point.test.ts +++ b/tests/small/data-types/geometry-point.test.ts @@ -1,7 +1,7 @@ import { isGeometryPoint } from "@tai-kun/surrealdb"; import { decode, encode } from "@tai-kun/surrealdb/cbor"; -import { CBOR_TAG_GEOMETRY_POINT } from "@tai-kun/surrealdb/data-types/encodable"; -import { GeometryPoint } from "@tai-kun/surrealdb/data-types/standard"; +import { CBOR_TAG_GEOMETRY_POINT } from "@tai-kun/surrealdb/encodable-datatypes"; +import { GeometryPoint } from "@tai-kun/surrealdb/standard-datatypes"; import { expect, test } from "vitest"; test(".point", () => { diff --git a/tests/small/data-types/geometry-polygon.test.ts b/tests/small/data-types/geometry-polygon.test.ts index 8921eb22..da4d5299 100644 --- a/tests/small/data-types/geometry-polygon.test.ts +++ b/tests/small/data-types/geometry-polygon.test.ts @@ -4,12 +4,12 @@ import { CBOR_TAG_GEOMETRY_LINE, CBOR_TAG_GEOMETRY_POINT, CBOR_TAG_GEOMETRY_POLYGON, -} from "@tai-kun/surrealdb/data-types/encodable"; +} from "@tai-kun/surrealdb/encodable-datatypes"; import { GeometryLine, GeometryPoint, GeometryPolygon, -} from "@tai-kun/surrealdb/data-types/standard"; +} from "@tai-kun/surrealdb/standard-datatypes"; import { expect, test } from "vitest"; test(".polygon", () => { diff --git a/tests/small/data-types/range.test.ts b/tests/small/data-types/range.test.ts index 48cf210c..c9d838a7 100644 --- a/tests/small/data-types/range.test.ts +++ b/tests/small/data-types/range.test.ts @@ -2,7 +2,7 @@ import { BoundExcluded, BoundIncluded, Range, -} from "@tai-kun/surrealdb/data-types/standard"; +} from "@tai-kun/surrealdb/standard-datatypes"; import { describe, expect, test } from "vitest"; type Bound = BoundIncluded | BoundExcluded; diff --git a/tests/small/data-types/table.test.ts b/tests/small/data-types/table.test.ts index 2142ab1d..08e69e70 100644 --- a/tests/small/data-types/table.test.ts +++ b/tests/small/data-types/table.test.ts @@ -1,5 +1,5 @@ import { decode, encode } from "@tai-kun/surrealdb/cbor"; -import { CBOR_TAG_TABLE, Table } from "@tai-kun/surrealdb/data-types/standard"; +import { CBOR_TAG_TABLE, Table } from "@tai-kun/surrealdb/standard-datatypes"; import { expect, test } from "vitest"; test(".name", () => { diff --git a/tests/small/data-types/thing.test.ts b/tests/small/data-types/thing.test.ts index c1caa0cc..41e3b07e 100644 --- a/tests/small/data-types/thing.test.ts +++ b/tests/small/data-types/thing.test.ts @@ -3,7 +3,7 @@ import { CBOR_TAG_RECORDID, Thing, Uuid, -} from "@tai-kun/surrealdb/data-types/standard"; +} from "@tai-kun/surrealdb/standard-datatypes"; import { expect, test } from "vitest"; test(".table, .id", () => { diff --git a/tests/small/data-types/uuid.test.ts b/tests/small/data-types/uuid.test.ts index 5d4de90f..ce026260 100644 --- a/tests/small/data-types/uuid.test.ts +++ b/tests/small/data-types/uuid.test.ts @@ -1,4 +1,4 @@ -import { Uuid } from "@tai-kun/surrealdb/data-types/standard"; +import { Uuid } from "@tai-kun/surrealdb/standard-datatypes"; // @ts-expect-error import * as uuids from "uuid"; import { expect, test } from "vitest"; diff --git a/tests/small/surreal/slot.test.ts b/tests/small/surreal/slot.test.ts index 7275e782..a398423e 100644 --- a/tests/small/surreal/slot.test.ts +++ b/tests/small/surreal/slot.test.ts @@ -1,7 +1,7 @@ import { surql } from "@tai-kun/surrealdb"; import type { Writer } from "@tai-kun/surrealdb/cbor"; -import type { InferSlotVars } from "@tai-kun/surrealdb/clients/standard"; import { Encoded, EncodedCBOR } from "@tai-kun/surrealdb/formatter"; +import type { InferSlotVars } from "@tai-kun/surrealdb/standard-client"; import { expect, expectTypeOf, test, vi } from "vitest"; test("unknown 型の必須スロット", () => { diff --git a/tsconfig.json b/tsconfig.json index 12908c1c..68daa892 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -22,18 +22,18 @@ "@tai-kun/surrealdb/errors": ["src/errors/index.ts"], "@tai-kun/surrealdb/formatter": ["src/formatter/index.ts"], - "@tai-kun/surrealdb/clients/basic": ["src/clients/basic/index.ts"], - "@tai-kun/surrealdb/clients/standard": ["src/clients/standard/index.ts"], + "@tai-kun/surrealdb/basic-client": ["src/clients/basic/index.ts"], + "@tai-kun/surrealdb/standard-client": ["src/clients/standard/index.ts"], - "@tai-kun/surrealdb/data-types/decode-only": ["src/data-types/decode-only/index.ts"], - "@tai-kun/surrealdb/data-types/encodable": ["src/data-types/encodable/index.ts"], - "@tai-kun/surrealdb/data-types/standard": ["src/data-types/standard/index.ts"], + "@tai-kun/surrealdb/decodeonly-datatypes": ["src/data-types/decode-only/index.ts"], + "@tai-kun/surrealdb/encodable-datatypes": ["src/data-types/encodable/index.ts"], + "@tai-kun/surrealdb/standard-datatypes": ["src/data-types/standard/index.ts"], - "@tai-kun/surrealdb/engines/http": ["src/engines/http/index.ts"], - "@tai-kun/surrealdb/engines/websocket": ["src/engines/websocket/index.ts"], + "@tai-kun/surrealdb/http-engine": ["src/engines/http/index.ts"], + "@tai-kun/surrealdb/websocket-engine": ["src/engines/websocket/index.ts"], - "@tai-kun/surrealdb/formatters/cbor": ["src/formatters/cbor/index.ts"], - "@tai-kun/surrealdb/formatters/json": ["src/formatters/json/index.ts"] + "@tai-kun/surrealdb/cbor-formatter": ["src/formatters/cbor/index.ts"], + "@tai-kun/surrealdb/json-formatter": ["src/formatters/json/index.ts"] } } }