@esposter/shared 4.3.2 → 4.4.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/README.md +8 -19
- package/dist/index.d.ts +34 -438
- package/dist/index.js +238 -324
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -5,12 +5,14 @@
|
|
|
5
5
|
[![NPM downloads][badge-npm-downloads]][url-npm]
|
|
6
6
|
[![NPM Unpacked Size (with version)][badge-npm-unpacked-size]][url-npm]
|
|
7
7
|
|
|
8
|
-
Shared TypeScript utilities, types, and error classes for the Esposter platform.
|
|
8
|
+
Shared TypeScript utilities, types, and error classes for the Esposter platform.
|
|
9
|
+
|
|
10
|
+
Design notes live in [the specs](https://github.com/Esposter/Esposter/tree/main/openspec/specs/shared).
|
|
9
11
|
|
|
10
12
|
## Table of Contents
|
|
11
13
|
|
|
12
14
|
- 🚀 [Getting Started](#getting-started)
|
|
13
|
-
-
|
|
15
|
+
- 🧩 [Key Exports](#key-exports)
|
|
14
16
|
- ⚖️ [License](#license)
|
|
15
17
|
|
|
16
18
|
---
|
|
@@ -21,11 +23,9 @@ Shared TypeScript utilities, types, and error classes for the Esposter platform.
|
|
|
21
23
|
pnpm i @esposter/shared zod
|
|
22
24
|
```
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
We highly recommend you take a look at the [documentation](https://github.com/Esposter/Esposter/tree/main/openspec/specs/shared) to level up.
|
|
26
|
+
Works in both browser and server environments.
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
## <a name="key-exports">🧩 Key Exports</a>
|
|
29
29
|
|
|
30
30
|
#### Error Classes
|
|
31
31
|
|
|
@@ -40,7 +40,7 @@ throw new InvalidOperationError(Operation.Read, file.name, zodError.message);
|
|
|
40
40
|
```ts
|
|
41
41
|
import { takeOne } from "@esposter/shared";
|
|
42
42
|
|
|
43
|
-
//
|
|
43
|
+
// The first item, typed without `undefined`; an out-of-bounds index still yields `undefined` at runtime
|
|
44
44
|
const first = takeOne(items);
|
|
45
45
|
```
|
|
46
46
|
|
|
@@ -49,7 +49,7 @@ const first = takeOne(items);
|
|
|
49
49
|
```ts
|
|
50
50
|
import type { ToData, DeepOmit, GetPaths } from "@esposter/shared";
|
|
51
51
|
|
|
52
|
-
// ToData<T> —
|
|
52
|
+
// ToData<T> — the plain data shape of T, with its `toJSON` method removed at every depth
|
|
53
53
|
type RawColumn = ToData<Column>;
|
|
54
54
|
```
|
|
55
55
|
|
|
@@ -74,17 +74,6 @@ import { capitalize, truncate, toKebabCase } from "@esposter/shared";
|
|
|
74
74
|
import { getResult, getResultAsync, withFinalizer } from "@esposter/shared";
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
-
### Commands
|
|
78
|
-
|
|
79
|
-
Run from `packages/shared/`:
|
|
80
|
-
|
|
81
|
-
```bash
|
|
82
|
-
pnpm build # compile to dist/
|
|
83
|
-
pnpm test # vitest watch mode (coverage is run from the repo root)
|
|
84
|
-
pnpm lint:fix # auto-fix lint
|
|
85
|
-
pnpm typecheck # type check
|
|
86
|
-
```
|
|
87
|
-
|
|
88
77
|
## <a name="license">⚖️ License</a>
|
|
89
78
|
|
|
90
79
|
This project is licensed under the [Apache-2.0 license](https://github.com/Esposter/Esposter/blob/main/LICENSE).
|