@sapphire/string-store 3.0.1-next.c1299bac → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +41 -0
- package/README.md +15 -18
- package/dist/index.d.mts +667 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +1255 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +18 -30
- package/dist/cjs/index.cjs +0 -1410
- package/dist/cjs/index.cjs.map +0 -1
- package/dist/cjs/index.d.cts +0 -747
- package/dist/esm/index.d.mts +0 -747
- package/dist/esm/index.mjs +0 -1375
- package/dist/esm/index.mjs.map +0 -1
- package/dist/iife/index.global.js +0 -1415
- package/dist/iife/index.global.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,47 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
# [@sapphire/string-store@4.0.0](https://github.com/sapphiredev/utilities/compare/@sapphire/string-store@3.0.0...@sapphire/string-store@4.0.0) - (2026-11-15)
|
|
6
|
+
|
|
7
|
+
## 🏠 Refactor
|
|
8
|
+
|
|
9
|
+
- **eslint:** Allow globals to be used ([3f08d87](https://github.com/sapphiredev/utilities/commit/3f08d87496c885a851cb48ec59a5d8c8822c5284))
|
|
10
|
+
- Revert back to using globals instead of `node:X` imports ([25e18d0](https://github.com/sapphiredev/utilities/commit/25e18d0bf975e311d1baae2e5645355f4ffbdd0d))
|
|
11
|
+
- **tsdown:** Integrate nodeGlobals plugin in configs ([84502f6](https://github.com/sapphiredev/utilities/commit/84502f6bdaf7a031961a969f5602b509862408bf))
|
|
12
|
+
- **fromUTF16:** Replace codePointAt with charCodeAt ([bc0f08e](https://github.com/sapphiredev/utilities/commit/bc0f08e470e6e7702ea348c87730cdd91126b751))
|
|
13
|
+
- Update to ESLint v10 ([991c466](https://github.com/sapphiredev/utilities/commit/991c4665ff10d9efa32d34cab134570fa7d2dd22))
|
|
14
|
+
- ***:** All round repository upgrade ([44c5c90](https://github.com/sapphiredev/utilities/commit/44c5c900ecd6f9164e073c09630a7800d69f745a))
|
|
15
|
+
- 💥 **BREAKING CHANGE:** Build system has been changed from tsup to tsdown. There may be unexpected changes in the build output.
|
|
16
|
+
- 💥 **BREAKING CHANGE:** CJS support has been entirely dropped, all packages in this repository are now ESM-only.
|
|
17
|
+
- 💥 **BREAKING CHANGE:** The `tslib` dependency has been removed from all packages.
|
|
18
|
+
- 💥 **BREAKING CHANGE:** TypeScript has been internally updated to v7.
|
|
19
|
+
- ***:** All round repository upgrade ([a58424e](https://github.com/sapphiredev/utilities/commit/a58424eadcea4990a730b0f89ce2d45f5d896c65))
|
|
20
|
+
- 💥 **BREAKING CHANGE:** Build system has been changed from tsup to tsdown. There may be unexpected changes in the build output.
|
|
21
|
+
- 💥 **BREAKING CHANGE:** CJS support has been entirely dropped, all packages in this repository are now ESM-only.
|
|
22
|
+
- 💥 **BREAKING CHANGE:** The `tslib` dependency has been removed from all packages.
|
|
23
|
+
- 💥 **BREAKING CHANGE:** TypeScript has been internally updated to v7.
|
|
24
|
+
|
|
25
|
+
## 🐛 Bug Fixes
|
|
26
|
+
|
|
27
|
+
- **deps:** Update all non-major dependencies ([09c1811](https://github.com/sapphiredev/utilities/commit/09c1811dae117f501f4e03b2015d8288e28734f8)) ([#982](https://github.com/sapphiredev/utilities/pull/982) by @renovate[bot])
|
|
28
|
+
- **deps:** Update all non-major dependencies ([72499d9](https://github.com/sapphiredev/utilities/commit/72499d99a9feb107fd3dccea601da462f1f725c1)) ([#980](https://github.com/sapphiredev/utilities/pull/980) by @renovate[bot])
|
|
29
|
+
- **deps:** Update all non-major dependencies ([e6d4bac](https://github.com/sapphiredev/utilities/commit/e6d4bac47e65e9e0ec95ebaaa1b679cfc01bd107)) ([#953](https://github.com/sapphiredev/utilities/pull/953) by @renovate[bot])
|
|
30
|
+
- **deps:** Update all non-major dependencies ([3f9fe93](https://github.com/sapphiredev/utilities/commit/3f9fe93b770479fd72b7fd56f476244c040fcb41)) ([#952](https://github.com/sapphiredev/utilities/pull/952) by @renovate[bot])
|
|
31
|
+
|
|
32
|
+
## 📝 Documentation
|
|
33
|
+
|
|
34
|
+
- **readme:** Update feature descriptions across packages ([302730a](https://github.com/sapphiredev/utilities/commit/302730a5b8eccb763b7b9761c3de1db9d3857394))
|
|
35
|
+
- Update typedoc to proper tsdoc ([1d29dd6](https://github.com/sapphiredev/utilities/commit/1d29dd63bc2ffd1ea25093ca2d0a9ab7d6efc9e9))
|
|
36
|
+
|
|
37
|
+
## 🚀 Features
|
|
38
|
+
|
|
39
|
+
- Target es2024 when bundling ([293e6b9](https://github.com/sapphiredev/utilities/commit/293e6b9eddbed5db178017d5ddedaaad0cfb3395))
|
|
40
|
+
- 💥 **BREAKING CHANGE:** if your project is not full ES2024 compatible this new version will not work
|
|
41
|
+
- Update eslint rules ([901aca9](https://github.com/sapphiredev/utilities/commit/901aca995e28bf5f4b343b441ab658d9c6511195))
|
|
42
|
+
- 💥 **BREAKING CHANGE:** ESLint has been updated to v10
|
|
43
|
+
- 💥 **BREAKING CHANGE:** ESLint configuration has been changed to a flat config
|
|
44
|
+
- 💥 **BREAKING CHANGE:** Our ESLint config is now a small layer on top of [eslint-config-neon](https://www.npmjs.com/package/eslint-config-neon) which brings a LOT more rules and stricter linting.
|
|
45
|
+
|
|
5
46
|
# [@sapphire/string-store@3.0.0](https://github.com/sapphiredev/utilities/compare/@sapphire/string-store@2.0.0...@sapphire/string-store@3.0.0) - (2025-12-14)
|
|
6
47
|
|
|
7
48
|
## 🐛 Bug Fixes
|
package/README.md
CHANGED
|
@@ -19,10 +19,9 @@ locations such as Discord's `custom_id` field in message components.
|
|
|
19
19
|
|
|
20
20
|
## Features
|
|
21
21
|
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
- Fully tested
|
|
22
|
+
- Serializes schema-defined data into compact UTF-16 strings
|
|
23
|
+
- Supports numeric, boolean, string, nullable, and array fields
|
|
24
|
+
- Reads and writes typed values through reusable schemas and stores
|
|
26
25
|
|
|
27
26
|
## Installation
|
|
28
27
|
|
|
@@ -34,11 +33,9 @@ npm install @sapphire/string-store
|
|
|
34
33
|
|
|
35
34
|
## Usage
|
|
36
35
|
|
|
37
|
-
**Note**: While this section uses `require`, the imports match 1:1 with ESM imports. For example, `const { SchemaStore } = require('@sapphire/string-store')` is equivalent to `import { SchemaStore } from '@sapphire/string-store'`.
|
|
38
|
-
|
|
39
36
|
```ts
|
|
40
37
|
// Require the store classes
|
|
41
|
-
|
|
38
|
+
import { SchemaStore, Schema, t } from '@sapphire/string-store';
|
|
42
39
|
|
|
43
40
|
// Define the enum with the IDs and export it
|
|
44
41
|
export const Id = Object.freeze({
|
|
@@ -66,21 +63,21 @@ const buffer = store.serialize(Id.AgeUpdate, { age: 20 }).toString();
|
|
|
66
63
|
> [!Important]
|
|
67
64
|
> The IDs passed in the `Schema` constant need to be known at compile time, this can be done in the following ways:
|
|
68
65
|
>
|
|
69
|
-
> -
|
|
70
|
-
> -
|
|
71
|
-
> -
|
|
72
|
-
> -
|
|
73
|
-
> -
|
|
74
|
-
> -
|
|
66
|
+
> - (TS) An `enum` object, which has all of its members strictly typed.
|
|
67
|
+
> - (TS) An object with `as const`, which makes the values known at compile time.
|
|
68
|
+
> - An object with `Object.freeze` as shown in the example, which is equivalent as the previous.
|
|
69
|
+
> - An object with a JSDoc defining the types as the specific values.
|
|
70
|
+
> - Multiple `const`ants for each value, or
|
|
71
|
+
> - (TS) Class fields marked as `readonly`.
|
|
75
72
|
|
|
76
73
|
> [!Tip]
|
|
77
74
|
> The serialized string is encoded in UTF-16, meaning it can store 16 bits per character. Each type stores a different number of bits, for example, a single character can store:
|
|
78
75
|
>
|
|
79
|
-
> -
|
|
80
|
-
> -
|
|
81
|
-
> -
|
|
82
|
-
> -
|
|
83
|
-
> -
|
|
76
|
+
> - 16 booleans
|
|
77
|
+
> - 8 2-bit unsigned integers (0-3)
|
|
78
|
+
> - 4 4-bit unsigned integers (0-15)
|
|
79
|
+
> - 2 8-bit unsigned integers (0-255)
|
|
80
|
+
> - 1 16-bit integer (0-65535)
|
|
84
81
|
>
|
|
85
82
|
> As a use-case, Discord's `custom_id` field in message components can store up to **100** UTF-16 characters, which means it has a storage of **1600 bits**, below you can see the supported types and their storage in bits. Keep in mind that the schema ID is stored as a [16-bit](#int16) integer, and that the property names are **not** stored.
|
|
86
83
|
|