@fonderie/workspaces 5.3.2 → 6.0.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/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,7 @@ 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';
19
20
  personalWorkspace?: boolean;
20
21
  routes?: Partial<Record<WorkspaceRouteId, WorkspaceRouteOverride>>;
21
22
  }
@@ -122,6 +123,8 @@ declare function toMemberDTO(m: IMember): IMemberDTO;
122
123
  declare function toInvitationDTO(inv: IInvitation): IInvitationDTO;
123
124
  declare function toSettingsDTO(s: IWorkspaceSettings): IWorkspaceSettingsDTO;
124
125
 
126
+ declare function requireManager(store: IStoreAdapter, config: IWorkspacesConfig): Middleware;
127
+
125
128
  declare const createWorkspaceSchema: z.ZodObject<{
126
129
  name: z.ZodString;
127
130
  description: z.ZodOptional<z.ZodString>;
@@ -159,9 +162,11 @@ declare const createInvitationsSchema: z.ZodUnion<readonly [z.ZodObject<{
159
162
  email: z.ZodPipe<z.ZodString, z.ZodEmail>;
160
163
  roleId: z.ZodOptional<z.ZodString>;
161
164
  }, z.core.$strip>>]>;
162
- declare const acceptInvitationSchema: z.ZodObject<{
165
+ declare const acceptInvitationSchema: z.ZodUnion<readonly [z.ZodObject<{
163
166
  pin: z.ZodString;
164
- }, z.core.$strip>;
167
+ }, z.core.$strip>, z.ZodObject<{
168
+ token: z.ZodString;
169
+ }, z.core.$strip>]>;
165
170
  declare const createRoleSchema: z.ZodObject<{
166
171
  name: z.ZodString;
167
172
  description: z.ZodOptional<z.ZodString>;
@@ -242,4 +247,4 @@ declare function workspaceExportContributor(store: IStoreAdapter): {
242
247
  collect: (userId: string) => Promise<unknown>;
243
248
  };
244
249
 
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 };
250
+ 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,7 @@ 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';
19
20
  personalWorkspace?: boolean;
20
21
  routes?: Partial<Record<WorkspaceRouteId, WorkspaceRouteOverride>>;
21
22
  }
@@ -122,6 +123,8 @@ declare function toMemberDTO(m: IMember): IMemberDTO;
122
123
  declare function toInvitationDTO(inv: IInvitation): IInvitationDTO;
123
124
  declare function toSettingsDTO(s: IWorkspaceSettings): IWorkspaceSettingsDTO;
124
125
 
126
+ declare function requireManager(store: IStoreAdapter, config: IWorkspacesConfig): Middleware;
127
+
125
128
  declare const createWorkspaceSchema: z.ZodObject<{
126
129
  name: z.ZodString;
127
130
  description: z.ZodOptional<z.ZodString>;
@@ -159,9 +162,11 @@ declare const createInvitationsSchema: z.ZodUnion<readonly [z.ZodObject<{
159
162
  email: z.ZodPipe<z.ZodString, z.ZodEmail>;
160
163
  roleId: z.ZodOptional<z.ZodString>;
161
164
  }, z.core.$strip>>]>;
162
- declare const acceptInvitationSchema: z.ZodObject<{
165
+ declare const acceptInvitationSchema: z.ZodUnion<readonly [z.ZodObject<{
163
166
  pin: z.ZodString;
164
- }, z.core.$strip>;
167
+ }, z.core.$strip>, z.ZodObject<{
168
+ token: z.ZodString;
169
+ }, z.core.$strip>]>;
165
170
  declare const createRoleSchema: z.ZodObject<{
166
171
  name: z.ZodString;
167
172
  description: z.ZodOptional<z.ZodString>;
@@ -242,4 +247,4 @@ declare function workspaceExportContributor(store: IStoreAdapter): {
242
247
  collect: (userId: string) => Promise<unknown>;
243
248
  };
244
249
 
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 };
250
+ 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 };