@unisource/sdk 0.2.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,23 +1,55 @@
1
- # tsdown-starter
2
-
3
- A starter for creating a TypeScript package.
4
-
5
- ## Development
6
-
7
- - Install dependencies:
8
-
9
- ```bash
10
- npm install
11
- ```
12
-
13
- - Run the unit tests:
14
-
15
- ```bash
16
- npm run test
17
- ```
18
-
19
- - Build the library:
20
-
21
- ```bash
22
- npm run build
23
- ```
1
+ # @unisource/sdk
2
+
3
+ Shared UniSource contracts and HTTP client used by both `apps/backend` and `apps/frontend`.
4
+
5
+ ## What is included
6
+
7
+ - Zod schemas and TypeScript types for uploads, files, folders, services, audit log, and share links
8
+ - `UnisourceClient` for authenticated app and admin API calls
9
+ - Standalone public share helpers: `getPublicFileInfo()` and `unlockPublicFile()`
10
+ - Typed error classes: `UnisourceError` and `UnisourceNetworkError`
11
+
12
+ ## Development
13
+
14
+ From the monorepo root:
15
+
16
+ ```bash
17
+ pnpm install
18
+ pnpm --filter @unisource/sdk build
19
+ pnpm --filter @unisource/sdk test
20
+ pnpm --filter @unisource/sdk typecheck
21
+ ```
22
+
23
+ ## Usage
24
+
25
+ ```ts
26
+ import { UnisourceClient } from '@unisource/sdk';
27
+
28
+ const client = new UnisourceClient({
29
+ baseUrl: 'https://api.example.com',
30
+ serviceId: 'usrc',
31
+ getToken: async () => 'jwt-or-api-key',
32
+ });
33
+
34
+ const files = await client.myFiles.list({ folder_id: null, limit: 25 });
35
+ ```
36
+
37
+ Public share flows do not require service headers:
38
+
39
+ ```ts
40
+ import { getPublicFileInfo, unlockPublicFile } from '@unisource/sdk';
41
+
42
+ const info = await getPublicFileInfo('https://api.example.com', 'share-slug');
43
+ const unlocked = await unlockPublicFile('https://api.example.com', 'share-slug', 'secret');
44
+ ```
45
+
46
+ ## Release workflow
47
+
48
+ Because `@unisource/sdk` is public, changes should ship with a changeset:
49
+
50
+ ```bash
51
+ pnpm changeset
52
+ pnpm changeset version
53
+ pnpm --filter @unisource/sdk build
54
+ pnpm changeset publish
55
+ ```