@fonderie/workspaces 5.3.2 → 6.0.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/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { IFonderieModule, IFonderieApp } from '@fonderie/core';
1
+ import { IFonderieModule, IFonderieApp, Middleware } from '@fonderie/core';
2
2
  import { IStoreAdapter } from '@fonderie/store';
3
3
  import { EventBus } from '@fonderie/events';
4
4
  import { IInvitation, IMember, IRole, IWorkspaceSettings, IWorkspace } from './types.cjs';
@@ -16,6 +16,8 @@ declare const EVENT_KEYS: {
16
16
  type WorkspacesEventKey = (typeof EVENT_KEYS)[keyof typeof EVENT_KEYS];
17
17
  interface IWorkspacesConfig {
18
18
  invitationTtl?: string;
19
+ management?: 'owner-or-admin' | 'any-member';
20
+ managerRoles?: string[];
19
21
  personalWorkspace?: boolean;
20
22
  routes?: Partial<Record<WorkspaceRouteId, WorkspaceRouteOverride>>;
21
23
  }
@@ -122,6 +124,8 @@ declare function toMemberDTO(m: IMember): IMemberDTO;
122
124
  declare function toInvitationDTO(inv: IInvitation): IInvitationDTO;
123
125
  declare function toSettingsDTO(s: IWorkspaceSettings): IWorkspaceSettingsDTO;
124
126
 
127
+ declare function requireManager(store: IStoreAdapter, config: IWorkspacesConfig): Middleware;
128
+
125
129
  declare const createWorkspaceSchema: z.ZodObject<{
126
130
  name: z.ZodString;
127
131
  description: z.ZodOptional<z.ZodString>;
@@ -159,9 +163,11 @@ declare const createInvitationsSchema: z.ZodUnion<readonly [z.ZodObject<{
159
163
  email: z.ZodPipe<z.ZodString, z.ZodEmail>;
160
164
  roleId: z.ZodOptional<z.ZodString>;
161
165
  }, z.core.$strip>>]>;
162
- declare const acceptInvitationSchema: z.ZodObject<{
166
+ declare const acceptInvitationSchema: z.ZodUnion<readonly [z.ZodObject<{
163
167
  pin: z.ZodString;
164
- }, z.core.$strip>;
168
+ }, z.core.$strip>, z.ZodObject<{
169
+ token: z.ZodString;
170
+ }, z.core.$strip>]>;
165
171
  declare const createRoleSchema: z.ZodObject<{
166
172
  name: z.ZodString;
167
173
  description: z.ZodOptional<z.ZodString>;
@@ -242,4 +248,4 @@ declare function workspaceExportContributor(store: IStoreAdapter): {
242
248
  collect: (userId: string) => Promise<unknown>;
243
249
  };
244
250
 
245
- export { DEFAULT_TEMPLATES, EVENT_KEYS, type IImportMembership, type IImportRole, type IImportWorkspace, IInvitation, type IInvitationDTO, IMember, type IMemberDTO, IRole, type IRoleDTO, IWorkspace, type IWorkspaceDTO, IWorkspaceSettings, type IWorkspaceSettingsDTO, type IWorkspacesConfig, MESSAGE_KEYS, type WorkspacesEventKey, type WorkspacesMessageKey, WorkspacesModule, deleteUserData, exportUserData, importMembership, importRole, importWorkspace, schemas, toInvitationDTO, toMemberDTO, toRoleDTO, toSettingsDTO, toWorkspaceDTO, workspaceExportContributor };
251
+ export { DEFAULT_TEMPLATES, EVENT_KEYS, type IImportMembership, type IImportRole, type IImportWorkspace, IInvitation, type IInvitationDTO, IMember, type IMemberDTO, IRole, type IRoleDTO, IWorkspace, type IWorkspaceDTO, IWorkspaceSettings, type IWorkspaceSettingsDTO, type IWorkspacesConfig, MESSAGE_KEYS, type WorkspacesEventKey, type WorkspacesMessageKey, WorkspacesModule, deleteUserData, exportUserData, importMembership, importRole, importWorkspace, requireManager, schemas, toInvitationDTO, toMemberDTO, toRoleDTO, toSettingsDTO, toWorkspaceDTO, workspaceExportContributor };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { IFonderieModule, IFonderieApp } from '@fonderie/core';
1
+ import { IFonderieModule, IFonderieApp, Middleware } from '@fonderie/core';
2
2
  import { IStoreAdapter } from '@fonderie/store';
3
3
  import { EventBus } from '@fonderie/events';
4
4
  import { IInvitation, IMember, IRole, IWorkspaceSettings, IWorkspace } from './types.js';
@@ -16,6 +16,8 @@ declare const EVENT_KEYS: {
16
16
  type WorkspacesEventKey = (typeof EVENT_KEYS)[keyof typeof EVENT_KEYS];
17
17
  interface IWorkspacesConfig {
18
18
  invitationTtl?: string;
19
+ management?: 'owner-or-admin' | 'any-member';
20
+ managerRoles?: string[];
19
21
  personalWorkspace?: boolean;
20
22
  routes?: Partial<Record<WorkspaceRouteId, WorkspaceRouteOverride>>;
21
23
  }
@@ -122,6 +124,8 @@ declare function toMemberDTO(m: IMember): IMemberDTO;
122
124
  declare function toInvitationDTO(inv: IInvitation): IInvitationDTO;
123
125
  declare function toSettingsDTO(s: IWorkspaceSettings): IWorkspaceSettingsDTO;
124
126
 
127
+ declare function requireManager(store: IStoreAdapter, config: IWorkspacesConfig): Middleware;
128
+
125
129
  declare const createWorkspaceSchema: z.ZodObject<{
126
130
  name: z.ZodString;
127
131
  description: z.ZodOptional<z.ZodString>;
@@ -159,9 +163,11 @@ declare const createInvitationsSchema: z.ZodUnion<readonly [z.ZodObject<{
159
163
  email: z.ZodPipe<z.ZodString, z.ZodEmail>;
160
164
  roleId: z.ZodOptional<z.ZodString>;
161
165
  }, z.core.$strip>>]>;
162
- declare const acceptInvitationSchema: z.ZodObject<{
166
+ declare const acceptInvitationSchema: z.ZodUnion<readonly [z.ZodObject<{
163
167
  pin: z.ZodString;
164
- }, z.core.$strip>;
168
+ }, z.core.$strip>, z.ZodObject<{
169
+ token: z.ZodString;
170
+ }, z.core.$strip>]>;
165
171
  declare const createRoleSchema: z.ZodObject<{
166
172
  name: z.ZodString;
167
173
  description: z.ZodOptional<z.ZodString>;
@@ -242,4 +248,4 @@ declare function workspaceExportContributor(store: IStoreAdapter): {
242
248
  collect: (userId: string) => Promise<unknown>;
243
249
  };
244
250
 
245
- export { DEFAULT_TEMPLATES, EVENT_KEYS, type IImportMembership, type IImportRole, type IImportWorkspace, IInvitation, type IInvitationDTO, IMember, type IMemberDTO, IRole, type IRoleDTO, IWorkspace, type IWorkspaceDTO, IWorkspaceSettings, type IWorkspaceSettingsDTO, type IWorkspacesConfig, MESSAGE_KEYS, type WorkspacesEventKey, type WorkspacesMessageKey, WorkspacesModule, deleteUserData, exportUserData, importMembership, importRole, importWorkspace, schemas, toInvitationDTO, toMemberDTO, toRoleDTO, toSettingsDTO, toWorkspaceDTO, workspaceExportContributor };
251
+ export { DEFAULT_TEMPLATES, EVENT_KEYS, type IImportMembership, type IImportRole, type IImportWorkspace, IInvitation, type IInvitationDTO, IMember, type IMemberDTO, IRole, type IRoleDTO, IWorkspace, type IWorkspaceDTO, IWorkspaceSettings, type IWorkspaceSettingsDTO, type IWorkspacesConfig, MESSAGE_KEYS, type WorkspacesEventKey, type WorkspacesMessageKey, WorkspacesModule, deleteUserData, exportUserData, importMembership, importRole, importWorkspace, requireManager, schemas, toInvitationDTO, toMemberDTO, toRoleDTO, toSettingsDTO, toWorkspaceDTO, workspaceExportContributor };