@productcraft/platform-auth 0.1.3 → 0.2.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 +9 -9
- package/dist/index.d.cts +2106 -238
- package/dist/index.d.ts +2106 -238
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -62,7 +62,7 @@ PRODUCTCRAFT_API_KEY=pcft_live_...
|
|
|
62
62
|
|
|
63
63
|
## Configuration
|
|
64
64
|
|
|
65
|
-
```ts
|
|
65
|
+
```ts before
|
|
66
66
|
new PlatformAuth({
|
|
67
67
|
// Omit to use PRODUCTCRAFT_API_KEY from the environment
|
|
68
68
|
auth: { type: "apiKey", key: "pcft_live_..." }
|
|
@@ -77,7 +77,7 @@ new PlatformAuth({
|
|
|
77
77
|
|
|
78
78
|
### Authentication (PlatformUser sign-in)
|
|
79
79
|
|
|
80
|
-
```ts
|
|
80
|
+
```ts before
|
|
81
81
|
// Sign in
|
|
82
82
|
await platformAuth.client.POST(
|
|
83
83
|
"/v1/auth/signin",
|
|
@@ -104,7 +104,7 @@ await platformAuth.client.POST(
|
|
|
104
104
|
|
|
105
105
|
### Introspect — used by every other ProductCraft backend
|
|
106
106
|
|
|
107
|
-
```ts
|
|
107
|
+
```ts before
|
|
108
108
|
// Resolve the bearer of a token: returns account + email_verified_at + workspaces.
|
|
109
109
|
// Accepts a `pcft_live_*` PAK too — the response carries a synthetic verified
|
|
110
110
|
// account block so downstream `RequireEmailVerifiedGuard`-style gates pass.
|
|
@@ -126,7 +126,7 @@ The latter two are cached by every consuming service for ~60 seconds. Reach for
|
|
|
126
126
|
|
|
127
127
|
### Workspaces
|
|
128
128
|
|
|
129
|
-
```ts
|
|
129
|
+
```ts before
|
|
130
130
|
// List — for a PAK caller, this returns exactly the workspace the PAK is
|
|
131
131
|
// bound to (member_role / member_role_id are null on that lane).
|
|
132
132
|
await platformAuth.client.GET("/v1/workspaces");
|
|
@@ -146,7 +146,7 @@ await platformAuth.client.DELETE("/v1/workspaces/{workspace_slug}", { ... });
|
|
|
146
146
|
|
|
147
147
|
### Members, invites, roles
|
|
148
148
|
|
|
149
|
-
```ts
|
|
149
|
+
```ts before
|
|
150
150
|
// Members
|
|
151
151
|
await platformAuth.client.GET("/v1/workspaces/{workspace_slug}/members", { ... });
|
|
152
152
|
await platformAuth.client.PATCH(
|
|
@@ -170,7 +170,7 @@ await platformAuth.client.POST(
|
|
|
170
170
|
|
|
171
171
|
### IAM policies
|
|
172
172
|
|
|
173
|
-
```ts
|
|
173
|
+
```ts before
|
|
174
174
|
// List the canonical permission catalogue (what verbs exist for each service)
|
|
175
175
|
await platformAuth.client.GET(
|
|
176
176
|
"/v1/workspaces/{workspace_slug}/policies/actions/catalog",
|
|
@@ -199,7 +199,7 @@ PATs bind to one or more managed `workspace_policy` rows. Author the policy firs
|
|
|
199
199
|
|
|
200
200
|
Mint / rotate / revoke require a cookie or JWT — a PAK cannot mint another PAK.
|
|
201
201
|
|
|
202
|
-
```ts
|
|
202
|
+
```ts before
|
|
203
203
|
// 1. Author (or reuse) a managed policy
|
|
204
204
|
const { data: policy } = await platformAuth.client.POST(
|
|
205
205
|
"/v1/workspaces/{workspace_slug}/policies",
|
|
@@ -244,7 +244,7 @@ await platformAuth.client.PATCH(
|
|
|
244
244
|
|
|
245
245
|
### Service activation
|
|
246
246
|
|
|
247
|
-
```ts
|
|
247
|
+
```ts before
|
|
248
248
|
// Enable / disable a service for the workspace (mail, waitlist, social, auth, …)
|
|
249
249
|
await platformAuth.client.PUT(
|
|
250
250
|
"/v1/workspaces/{workspace_slug}/services/{service}",
|
|
@@ -260,7 +260,7 @@ await platformAuth.client.PUT(
|
|
|
260
260
|
|
|
261
261
|
### Audit
|
|
262
262
|
|
|
263
|
-
```ts
|
|
263
|
+
```ts before
|
|
264
264
|
// Read the workspace audit log
|
|
265
265
|
await platformAuth.client.GET(
|
|
266
266
|
"/v1/workspaces/{workspace_slug}/audit-logs",
|