@fayz-ai/sdk 0.1.0 → 0.1.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.
Files changed (2) hide show
  1. package/README.md +70 -0
  2. package/package.json +12 -2
package/README.md ADDED
@@ -0,0 +1,70 @@
1
+ # @fayz-ai/sdk
2
+
3
+ Lean TypeScript SDK for generated Fayz projects.
4
+
5
+ This package is intentionally small: no React peer dependency, no UI bundle, no Supabase dependency, and no provider secrets. It is safe to install in every Fayz-generated project for normalized API access, app params, shared types, and Runtime OAuth broker calls.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install @fayz-ai/sdk
11
+ ```
12
+
13
+ ## Basic Usage
14
+
15
+ ```ts
16
+ import { fayz } from '@fayz-ai/sdk'
17
+ import { appParams } from '@fayz-ai/sdk/app-params'
18
+
19
+ const currentUser = await fayz.auth.me()
20
+
21
+ console.log(appParams.appId, currentUser)
22
+ ```
23
+
24
+ ## Custom Client
25
+
26
+ ```ts
27
+ import { createFayzClient } from '@fayz-ai/sdk'
28
+
29
+ const fayz = createFayzClient({
30
+ baseUrl: 'https://api.fayz.ai',
31
+ appId: 'app_123',
32
+ token: 'runtime-token',
33
+ })
34
+
35
+ const user = await fayz.auth.me()
36
+ ```
37
+
38
+ ## Runtime OAuth Broker
39
+
40
+ Provider OAuth secrets and refresh tokens stay server-side in Fayz. Generated projects should exchange a short-lived runtime token through Fayz and call brokered helpers.
41
+
42
+ ```ts
43
+ import { createFayzRuntimeClient } from '@fayz-ai/sdk/runtime'
44
+
45
+ const runtime = createFayzRuntimeClient({
46
+ baseUrl: 'https://api.fayz.ai',
47
+ projectId: 'project_123',
48
+ runtimeToken: 'runtime-token',
49
+ })
50
+
51
+ const grant = await runtime.exchangePluginOAuth({
52
+ pluginId: 'agenda',
53
+ scopes: ['google.calendar.readonly'],
54
+ })
55
+
56
+ const calendars = await runtime.googleCalendar(grant.token).listCalendars()
57
+ ```
58
+
59
+ ## Package Roles
60
+
61
+ - `@fayz-ai/sdk`: lean default package for every generated project.
62
+ - `@fayz-ai/runtime`: manifest app rendering and UI/plugin runtime package. Use it only when rendering a Fayz manifest app.
63
+
64
+ ## Security Boundary
65
+
66
+ Do not put OAuth client secrets, provider refresh tokens, partner API keys, tenant authority decisions, or raw Fayz service secrets in SDK packages, generated repos, manifests, or browser code.
67
+
68
+ ## License
69
+
70
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fayz-ai/sdk",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Fayz SDK — lean client, app params, runtime broker helpers, and shared types for generated Fayz projects",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -40,7 +40,8 @@
40
40
  },
41
41
  "files": [
42
42
  "dist",
43
- "src"
43
+ "src",
44
+ "README.md"
44
45
  ],
45
46
  "scripts": {
46
47
  "build": "tsup && tsc --emitDeclarationOnly --declaration --declarationMap --noEmit false",
@@ -55,6 +56,15 @@
55
56
  "vitest": "^2.1.9"
56
57
  },
57
58
  "license": "MIT",
59
+ "homepage": "https://github.com/FayaLabs/fayz-sdk#readme",
60
+ "repository": {
61
+ "type": "git",
62
+ "url": "git+https://github.com/FayaLabs/fayz-sdk.git",
63
+ "directory": "packages/sdk"
64
+ },
65
+ "bugs": {
66
+ "url": "https://github.com/FayaLabs/fayz-sdk/issues"
67
+ },
58
68
  "publishConfig": {
59
69
  "access": "public"
60
70
  },