@productcraft/heimdall 0.2.0 → 0.2.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 +35 -16
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -23,11 +23,17 @@ The SDK splits into three caller contexts.
23
23
  ### 1. Workspace-wide admin
24
24
 
25
25
  ```ts
26
- // /v1/apps, /v1/idp/*, /v1/stats/me
26
+ // /v1/apps, /v1/stats/me
27
27
  const apps = await heimdall.apps.list();
28
- await heimdall.apps.create({ name: "My App", slug: "my-app" });
29
- await heimdall.idp.list();
30
- await heimdall.stats.get();
28
+
29
+ // Create requires display_name + workspace_id (not `name`).
30
+ await heimdall.apps.create({
31
+ display_name: "My App",
32
+ slug: "my-app",
33
+ workspace_id: "<workspace-uuid>",
34
+ });
35
+
36
+ const stats = await heimdall.stats.get();
31
37
  ```
32
38
 
33
39
  ### 2. App-scoped admin — `heimdall.app(appId)`
@@ -35,25 +41,31 @@ await heimdall.stats.get();
35
41
  Pre-binds the appId path param so resource methods read like `app.endUsers.list()`.
36
42
 
37
43
  ```ts
38
- const app = heimdall.app("app_xyz_uuid");
44
+ const app = heimdall.app("<app-uuid>");
39
45
 
40
- // EndUsers
46
+ // EndUsers — profile updates only carry { display_name?, email? }.
47
+ // Status / role transitions are separate calls.
41
48
  const users = await app.endUsers.list({ limit: "20", cursor: "..." });
42
- await app.endUsers.update(userId, { status: "active" });
49
+ await app.endUsers.update(userId, { display_name: "Alice Smith" });
50
+ await app.endUsers.updateStatus(userId, { status: "active" });
43
51
  await app.endUsers.revokeAllSessions(userId);
44
52
 
45
- // Roles / Permissions
46
- await app.roles.create({ name: "admin", permissions: ["billing.read"] });
53
+ // Roles `CreateRoleDto` is { name, description? }. Permissions are
54
+ // bound separately, after the role exists.
55
+ await app.roles.create({ name: "admin", description: "Billing admin" });
56
+ await app.roles.setPermissions("admin", { permissions: ["billing.read"] });
47
57
  await app.roles.assign({ userId, roleName: "admin" });
48
58
  await app.permissions.list();
49
59
 
50
- // API keys + M2M creds
51
- await app.apiKeys.create({ name: "ci" });
60
+ // API keys permissions[] is required even if empty.
61
+ await app.apiKeys.create({ name: "ci", permissions: [] });
62
+
63
+ // M2M credentials
52
64
  const m2m = await app.credentials.create({ name: "backend-svc" });
53
65
 
54
- // Audit + invites + auth config
66
+ // Audit + invites + auth config (camelCase post-pipe)
55
67
  await app.auditLogs.list({ limit: "100" });
56
- await app.authConfig.update({ passwordPolicy: { minLength: 12 } });
68
+ await app.authConfig.update({ passwordMinLength: 12 });
57
69
  ```
58
70
 
59
71
  ### 3. Consumer-side (BFF) — `heimdall.consumer(appSlug)`
@@ -63,16 +75,23 @@ For backend route handlers mediating auth between your SPA and Heimdall. Pre-bin
63
75
  ```ts
64
76
  const consumer = heimdall.consumer("my-app-slug");
65
77
 
66
- // Sign-in flows
78
+ // Sign-in
67
79
  const { access_token, refresh_token } = await consumer.auth.signin({
68
80
  identifier: "alice@example.com",
69
81
  password: "...",
70
82
  });
71
- await consumer.auth.signup({ identifier, password });
83
+
84
+ // Sign-up requires { email, password, username, display_name? } — not `identifier`.
85
+ await consumer.auth.signup({
86
+ email: "alice@example.com",
87
+ password: "...",
88
+ username: "alice",
89
+ });
90
+
72
91
  await consumer.auth.refresh({ refresh_token });
73
92
  await consumer.auth.logout({ refresh_token });
74
93
  await consumer.auth.requestReset({ email });
75
- await consumer.auth.resetPassword({ code, newPassword });
94
+ await consumer.auth.resetPassword({ token, new_password: "..." });
76
95
 
77
96
  // Sign in with Apple (native iOS flow). See "Federated sign-in" below.
78
97
  await consumer.auth.signinWithProvider({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@productcraft/heimdall",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Customer auth & EndUsers — sign-in flows, OTP, sessions for ProductCraft Heimdall. Generated from the production OpenAPI spec.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",