@makolabs/ripple 3.1.0 → 3.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.
|
@@ -856,10 +856,13 @@ export const approveUser = command('unchecked', async (input) => {
|
|
|
856
856
|
throw new Error('At least one permission scope is required to approve a user');
|
|
857
857
|
}
|
|
858
858
|
try {
|
|
859
|
-
|
|
859
|
+
// Org membership uses Clerk's built-in `org:member` role — app-specific
|
|
860
|
+
// roles are an authorization concept enforced via API key scopes, not via
|
|
861
|
+
// Clerk's organization roles (which would require pre-configuring each
|
|
862
|
+
// custom role in the Clerk dashboard). Mirrors createUser's pattern.
|
|
860
863
|
await makeClerkRequest(`/organizations/${ORGANIZATION_ID}/memberships`, {
|
|
861
864
|
method: 'POST',
|
|
862
|
-
body: JSON.stringify({ user_id: input.userId, role:
|
|
865
|
+
body: JSON.stringify({ user_id: input.userId, role: 'org:member' })
|
|
863
866
|
});
|
|
864
867
|
const user = await makeClerkRequest(`/users/${input.userId}`);
|
|
865
868
|
const email = user.email_addresses?.[0]?.email_address;
|
package/dist/index.d.ts
CHANGED
|
@@ -143,7 +143,7 @@ export { CompactFilters, FilterPopover, FilterBar, syncFiltersToUrl } from './fi
|
|
|
143
143
|
export * from './file-browser/index.js';
|
|
144
144
|
export * from './adapters/storage/index.js';
|
|
145
145
|
export * from './adapters/ai/index.js';
|
|
146
|
-
export { getUserDisplayName, getUserInitials } from './user-management/user-management.js';
|
|
146
|
+
export { getUserDisplayName, getUserInitials, adaptUserManagementRemote } from './user-management/user-management.js';
|
|
147
147
|
export { default as UserManagement } from './user-management/UserManagement.svelte';
|
|
148
148
|
export { default as UserTable } from './user-management/UserTable.svelte';
|
|
149
149
|
export { default as UserModal } from './user-management/UserModal.svelte';
|
package/dist/index.js
CHANGED
|
@@ -145,7 +145,7 @@ export * from './adapters/ai/index.js';
|
|
|
145
145
|
// ============================================================================
|
|
146
146
|
// User Management Helper Functions
|
|
147
147
|
// ============================================================================
|
|
148
|
-
export { getUserDisplayName, getUserInitials } from './user-management/user-management.js';
|
|
148
|
+
export { getUserDisplayName, getUserInitials, adaptUserManagementRemote } from './user-management/user-management.js';
|
|
149
149
|
// ============================================================================
|
|
150
150
|
// User Management Components
|
|
151
151
|
// ============================================================================
|
|
@@ -2,6 +2,34 @@
|
|
|
2
2
|
* User Management Utilities
|
|
3
3
|
* Helper functions for user management
|
|
4
4
|
*/
|
|
5
|
-
import type { User } from '../index.js';
|
|
5
|
+
import type { User, UserManagementAdapter } from '../index.js';
|
|
6
|
+
/**
|
|
7
|
+
* Wires a `*.remote.ts` module (typically `export * from
|
|
8
|
+
* '@makolabs/ripple/funcs/user-management.remote'`) to the strictly-typed
|
|
9
|
+
* `UserManagementAdapter` shape.
|
|
10
|
+
*
|
|
11
|
+
* Why this exists: SvelteKit ≥ 2.56 captures the inner async function's
|
|
12
|
+
* `Promise<X>` as `Output` in `RemoteCommand`'s call signature, so
|
|
13
|
+
* `command('unchecked', async (): Promise<X> => …)` types as
|
|
14
|
+
* `RemoteCommand<I, Promise<X>>` whose call returns `Promise<Promise<X>>`
|
|
15
|
+
* even though at runtime it resolves correctly to `Promise<X>`. That
|
|
16
|
+
* spurious extra wrap makes a direct `import * as adapter from
|
|
17
|
+
* './foo.remote'` reject the `UserManagementAdapter` assignment.
|
|
18
|
+
*
|
|
19
|
+
* The helper performs an `as unknown as` coercion in one place so
|
|
20
|
+
* consumers don't scatter casts in their pages, and so the workaround
|
|
21
|
+
* stays discoverable. Once SvelteKit fixes `RemoteCommand` to use
|
|
22
|
+
* `Awaited<Output>`, this helper becomes a transparent pass-through.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* // src/routes/+page.svelte
|
|
27
|
+
* import { adaptUserManagementRemote } from '@makolabs/ripple';
|
|
28
|
+
* import * as remote from './users.remote';
|
|
29
|
+
* const adapter = adaptUserManagementRemote(remote);
|
|
30
|
+
* <UserManagement {adapter} {roles} />
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare function adaptUserManagementRemote<T>(remote: T): UserManagementAdapter;
|
|
6
34
|
export declare function getUserDisplayName(user: User | null): string;
|
|
7
35
|
export declare function getUserInitials(user: User | null): string;
|
|
@@ -2,6 +2,36 @@
|
|
|
2
2
|
* User Management Utilities
|
|
3
3
|
* Helper functions for user management
|
|
4
4
|
*/
|
|
5
|
+
/**
|
|
6
|
+
* Wires a `*.remote.ts` module (typically `export * from
|
|
7
|
+
* '@makolabs/ripple/funcs/user-management.remote'`) to the strictly-typed
|
|
8
|
+
* `UserManagementAdapter` shape.
|
|
9
|
+
*
|
|
10
|
+
* Why this exists: SvelteKit ≥ 2.56 captures the inner async function's
|
|
11
|
+
* `Promise<X>` as `Output` in `RemoteCommand`'s call signature, so
|
|
12
|
+
* `command('unchecked', async (): Promise<X> => …)` types as
|
|
13
|
+
* `RemoteCommand<I, Promise<X>>` whose call returns `Promise<Promise<X>>`
|
|
14
|
+
* even though at runtime it resolves correctly to `Promise<X>`. That
|
|
15
|
+
* spurious extra wrap makes a direct `import * as adapter from
|
|
16
|
+
* './foo.remote'` reject the `UserManagementAdapter` assignment.
|
|
17
|
+
*
|
|
18
|
+
* The helper performs an `as unknown as` coercion in one place so
|
|
19
|
+
* consumers don't scatter casts in their pages, and so the workaround
|
|
20
|
+
* stays discoverable. Once SvelteKit fixes `RemoteCommand` to use
|
|
21
|
+
* `Awaited<Output>`, this helper becomes a transparent pass-through.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* // src/routes/+page.svelte
|
|
26
|
+
* import { adaptUserManagementRemote } from '@makolabs/ripple';
|
|
27
|
+
* import * as remote from './users.remote';
|
|
28
|
+
* const adapter = adaptUserManagementRemote(remote);
|
|
29
|
+
* <UserManagement {adapter} {roles} />
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export function adaptUserManagementRemote(remote) {
|
|
33
|
+
return remote;
|
|
34
|
+
}
|
|
5
35
|
// Export convenience function to format user display name
|
|
6
36
|
export function getUserDisplayName(user) {
|
|
7
37
|
if (!user)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@makolabs/ripple",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "Simple Svelte 5 powered component library ✨",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"repository": {
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
|
-
"
|
|
58
|
-
"
|
|
57
|
+
"@sveltejs/kit": "^2.0.0",
|
|
58
|
+
"svelte": "^5.0.0 || ^6.0.0"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@eslint/compat": "^1.4.1",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"@storybook/addon-svelte-csf": "^5.0.10",
|
|
67
67
|
"@storybook/sveltekit": "^10.0.7",
|
|
68
68
|
"@sveltejs/adapter-static": "^3.0.10",
|
|
69
|
-
"@sveltejs/kit": "^2.
|
|
69
|
+
"@sveltejs/kit": "^2.58.0",
|
|
70
70
|
"@sveltejs/package": "^2.5.4",
|
|
71
71
|
"@sveltejs/vite-plugin-svelte": "^6.2.1",
|
|
72
72
|
"@tailwindcss/vite": "^4.1.17",
|