@lssm/lib.identity-rbac 0.0.0-canary-20251217083314 → 1.41.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/contracts/index.js +1 -5
- package/dist/contracts/organization.js +1 -607
- package/dist/contracts/rbac.js +1 -487
- package/dist/contracts/user.js +1 -335
- package/dist/entities/index.js +1 -35
- package/dist/entities/organization.js +1 -151
- package/dist/entities/rbac.js +1 -138
- package/dist/entities/user.js +1 -194
- package/dist/events.js +1 -543
- package/dist/identity-rbac.feature.js +1 -186
- package/dist/index.js +1 -14
- package/dist/policies/engine.js +1 -167
- package/dist/policies/index.js +1 -3
- package/package.json +18 -19
- package/dist/contracts/dist/capabilities/openbanking.js +0 -88
- package/dist/contracts/dist/client/index.js +0 -5
- package/dist/contracts/dist/client/react/feature-render.js +0 -2
- package/dist/contracts/dist/client/react/form-render.js +0 -4
- package/dist/contracts/dist/client/react/index.js +0 -4
- package/dist/contracts/dist/contract-registry/index.js +0 -1
- package/dist/contracts/dist/contract-registry/schemas.js +0 -60
- package/dist/contracts/dist/docs/PUBLISHING.docblock.js +0 -16
- package/dist/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js +0 -16
- package/dist/contracts/dist/docs/index.js +0 -29
- package/dist/contracts/dist/docs/presentations.js +0 -71
- package/dist/contracts/dist/docs/registry.js +0 -44
- package/dist/contracts/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +0 -16
- package/dist/contracts/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +0 -16
- package/dist/contracts/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +0 -16
- package/dist/contracts/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +0 -16
- package/dist/contracts/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +0 -16
- package/dist/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js +0 -80
- package/dist/contracts/dist/docs/tech/contracts/openapi-export.docblock.js +0 -57
- package/dist/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js +0 -16
- package/dist/contracts/dist/docs/tech/llm/llm-integration.docblock.js +0 -357
- package/dist/contracts/dist/docs/tech/mcp-endpoints.docblock.js +0 -37
- package/dist/contracts/dist/docs/tech/presentation-runtime.docblock.js +0 -16
- package/dist/contracts/dist/docs/tech/schema/README.docblock.js +0 -20
- package/dist/contracts/dist/docs/tech/studio/learning-events.docblock.js +0 -48
- package/dist/contracts/dist/docs/tech/studio/learning-journeys.docblock.js +0 -79
- package/dist/contracts/dist/docs/tech/studio/platform-admin-panel.docblock.js +0 -84
- package/dist/contracts/dist/docs/tech/studio/project-access-teams.docblock.js +0 -45
- package/dist/contracts/dist/docs/tech/studio/project-routing.docblock.js +0 -67
- package/dist/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js +0 -40
- package/dist/contracts/dist/docs/tech/studio/team-invitations.docblock.js +0 -69
- package/dist/contracts/dist/docs/tech/studio/workspace-ops.docblock.js +0 -47
- package/dist/contracts/dist/docs/tech/studio/workspaces.docblock.js +0 -62
- package/dist/contracts/dist/docs/tech/telemetry-ingest.docblock.js +0 -155
- package/dist/contracts/dist/docs/tech/templates/runtime.docblock.js +0 -20
- package/dist/contracts/dist/docs/tech/vscode-extension.docblock.js +0 -101
- package/dist/contracts/dist/docs/tech/workflows/overview.docblock.js +0 -20
- package/dist/contracts/dist/events.js +0 -10
- package/dist/contracts/dist/experiments/evaluator.js +0 -1
- package/dist/contracts/dist/index.js +0 -71
- package/dist/contracts/dist/install.js +0 -2
- package/dist/contracts/dist/integrations/contracts.js +0 -377
- package/dist/contracts/dist/integrations/index.js +0 -18
- package/dist/contracts/dist/integrations/openbanking/contracts/accounts.js +0 -228
- package/dist/contracts/dist/integrations/openbanking/contracts/balances.js +0 -159
- package/dist/contracts/dist/integrations/openbanking/contracts/index.js +0 -3
- package/dist/contracts/dist/integrations/openbanking/contracts/transactions.js +0 -210
- package/dist/contracts/dist/integrations/openbanking/models.js +0 -242
- package/dist/contracts/dist/integrations/openbanking/telemetry.js +0 -13
- package/dist/contracts/dist/integrations/providers/elevenlabs.js +0 -52
- package/dist/contracts/dist/integrations/providers/gcs-storage.js +0 -75
- package/dist/contracts/dist/integrations/providers/gmail.js +0 -87
- package/dist/contracts/dist/integrations/providers/google-calendar.js +0 -66
- package/dist/contracts/dist/integrations/providers/index.js +0 -11
- package/dist/contracts/dist/integrations/providers/mistral.js +0 -68
- package/dist/contracts/dist/integrations/providers/postmark.js +0 -68
- package/dist/contracts/dist/integrations/providers/powens.js +0 -116
- package/dist/contracts/dist/integrations/providers/qdrant.js +0 -73
- package/dist/contracts/dist/integrations/providers/registry.js +0 -10
- package/dist/contracts/dist/integrations/providers/stripe.js +0 -83
- package/dist/contracts/dist/integrations/providers/twilio-sms.js +0 -61
- package/dist/contracts/dist/jsonschema.js +0 -1
- package/dist/contracts/dist/knowledge/contracts.js +0 -306
- package/dist/contracts/dist/knowledge/index.js +0 -7
- package/dist/contracts/dist/knowledge/spaces/email-threads.js +0 -34
- package/dist/contracts/dist/knowledge/spaces/financial-docs.js +0 -34
- package/dist/contracts/dist/knowledge/spaces/financial-overview.js +0 -38
- package/dist/contracts/dist/knowledge/spaces/index.js +0 -6
- package/dist/contracts/dist/knowledge/spaces/product-canon.js +0 -34
- package/dist/contracts/dist/knowledge/spaces/support-faq.js +0 -37
- package/dist/contracts/dist/knowledge/spaces/uploaded-docs.js +0 -34
- package/dist/contracts/dist/llm/exporters.js +0 -19
- package/dist/contracts/dist/llm/index.js +0 -2
- package/dist/contracts/dist/llm/prompts.js +0 -1
- package/dist/contracts/dist/onboarding-base.js +0 -196
- package/dist/contracts/dist/openapi.js +0 -1
- package/dist/contracts/dist/ownership.js +0 -21
- package/dist/contracts/dist/presentations.js +0 -1
- package/dist/contracts/dist/presentations.v2.js +0 -11
- package/dist/contracts/dist/prompt.js +0 -1
- package/dist/contracts/dist/promptRegistry.js +0 -1
- package/dist/contracts/dist/regenerator/index.js +0 -1
- package/dist/contracts/dist/regenerator/service.js +0 -6
- package/dist/contracts/dist/registry.js +0 -2
- package/dist/contracts/dist/resources.js +0 -1
- package/dist/contracts/dist/schema/dist/EnumType.js +0 -2
- package/dist/contracts/dist/schema/dist/FieldType.js +0 -49
- package/dist/contracts/dist/schema/dist/ScalarTypeEnum.js +0 -236
- package/dist/contracts/dist/schema/dist/SchemaModel.js +0 -34
- package/dist/contracts/dist/schema/dist/entity/defineEntity.js +0 -1
- package/dist/contracts/dist/schema/dist/entity/index.js +0 -2
- package/dist/contracts/dist/schema/dist/entity/types.js +0 -1
- package/dist/contracts/dist/schema/dist/index.js +0 -6
- package/dist/contracts/dist/server/graphql-pothos.js +0 -6
- package/dist/contracts/dist/server/index.js +0 -8
- package/dist/contracts/dist/server/mcp/createMcpServer.js +0 -4
- package/dist/contracts/dist/server/mcp/registerPresentations.js +0 -2
- package/dist/contracts/dist/server/mcp/registerPrompts.js +0 -1
- package/dist/contracts/dist/server/mcp/registerResources.js +0 -2
- package/dist/contracts/dist/server/mcp/registerTools.js +0 -1
- package/dist/contracts/dist/server/provider-mcp.js +0 -1
- package/dist/contracts/dist/server/rest-elysia.js +0 -1
- package/dist/contracts/dist/server/rest-express.js +0 -1
- package/dist/contracts/dist/server/rest-generic.js +0 -1
- package/dist/contracts/dist/server/rest-next-app.js +0 -1
- package/dist/contracts/dist/server/rest-next-pages.js +0 -1
- package/dist/contracts/dist/spec.js +0 -34
- package/dist/contracts/dist/telemetry/index.js +0 -1
- package/dist/contracts/dist/telemetry/tracker.js +0 -1
- package/dist/contracts/dist/tests/index.js +0 -1
- package/dist/contracts/dist/tests/runner.js +0 -2
- package/dist/contracts/dist/workflow/index.js +0 -1
- package/dist/contracts/dist/workflow/runner.js +0 -1
- package/dist/contracts/index.d.ts +0 -4
- package/dist/contracts/organization.d.ts +0 -895
- package/dist/contracts/rbac.d.ts +0 -611
- package/dist/contracts/user.d.ts +0 -610
- package/dist/entities/index.d.ts +0 -176
- package/dist/entities/organization.d.ts +0 -86
- package/dist/entities/rbac.d.ts +0 -87
- package/dist/entities/user.d.ts +0 -87
- package/dist/events.d.ts +0 -689
- package/dist/identity-rbac.feature.d.ts +0 -11
- package/dist/index.d.ts +0 -11
- package/dist/policies/engine.d.ts +0 -132
- package/dist/policies/index.d.ts +0 -2
- package/dist/schema/dist/EnumType.js +0 -2
- package/dist/schema/dist/FieldType.js +0 -49
- package/dist/schema/dist/ScalarTypeEnum.js +0 -236
- package/dist/schema/dist/SchemaModel.js +0 -34
- package/dist/schema/dist/entity/defineEntity.js +0 -236
- package/dist/schema/dist/entity/index.js +0 -2
- package/dist/schema/dist/entity/types.js +0 -1
- package/dist/schema/dist/index.js +0 -6
package/dist/contracts/index.js
CHANGED
|
@@ -1,5 +1 @@
|
|
|
1
|
-
import { CreateUserContract, CreateUserInputModel, DeleteUserContract, DeleteUserInputModel, GetCurrentUserContract, ListUsersContract, ListUsersInputModel, ListUsersOutputModel, SuccessResultModel, UpdateUserContract, UpdateUserInputModel, UserDeletedPayloadModel, UserProfileModel
|
|
2
|
-
import { AcceptInviteContract, AcceptInviteInputModel, CreateOrgContract, CreateOrgInputModel, GetOrgContract, GetOrgInputModel, InvitationModel, InviteMemberContract, InviteMemberInputModel, ListMembersContract, ListMembersInputModel, ListMembersOutputModel, ListUserOrgsContract, ListUserOrgsOutputModel, MemberModel, MemberRemovedPayloadModel, MemberUserModel, OrganizationModel, OrganizationWithRoleModel, RemoveMemberContract, RemoveMemberInputModel, UpdateOrgContract, UpdateOrgInputModel } from "./organization.js";
|
|
3
|
-
import { AssignRoleContract, AssignRoleInputModel, BindingIdPayloadModel, CheckPermissionContract, CheckPermissionInputModel, CreateRoleContract, CreateRoleInputModel, DeleteRoleContract, DeleteRoleInputModel, ListRolesContract, ListRolesOutputModel, ListUserPermissionsContract, ListUserPermissionsInputModel, ListUserPermissionsOutputModel, PermissionCheckResultModel, PolicyBindingModel, RevokeRoleContract, RevokeRoleInputModel, RoleModel, UpdateRoleContract, UpdateRoleInputModel } from "./rbac.js";
|
|
4
|
-
|
|
5
|
-
export { AcceptInviteContract, AcceptInviteInputModel, AssignRoleContract, AssignRoleInputModel, BindingIdPayloadModel, CheckPermissionContract, CheckPermissionInputModel, CreateOrgContract, CreateOrgInputModel, CreateRoleContract, CreateRoleInputModel, CreateUserContract, CreateUserInputModel, DeleteRoleContract, DeleteRoleInputModel, DeleteUserContract, DeleteUserInputModel, GetCurrentUserContract, GetOrgContract, GetOrgInputModel, InvitationModel, InviteMemberContract, InviteMemberInputModel, ListMembersContract, ListMembersInputModel, ListMembersOutputModel, ListRolesContract, ListRolesOutputModel, ListUserOrgsContract, ListUserOrgsOutputModel, ListUserPermissionsContract, ListUserPermissionsInputModel, ListUserPermissionsOutputModel, ListUsersContract, ListUsersInputModel, ListUsersOutputModel, MemberModel, MemberRemovedPayloadModel, MemberUserModel, OrganizationModel, OrganizationWithRoleModel, PermissionCheckResultModel, PolicyBindingModel, RemoveMemberContract, RemoveMemberInputModel, RevokeRoleContract, RevokeRoleInputModel, RoleModel, SuccessResultModel, UpdateOrgContract, UpdateOrgInputModel, UpdateRoleContract, UpdateRoleInputModel, UpdateUserContract, UpdateUserInputModel, UserDeletedPayloadModel, UserProfileModel };
|
|
1
|
+
import{CreateUserContract as e,CreateUserInputModel as t,DeleteUserContract as n,DeleteUserInputModel as r,GetCurrentUserContract as i,ListUsersContract as a,ListUsersInputModel as o,ListUsersOutputModel as s,SuccessResultModel as c,UpdateUserContract as l,UpdateUserInputModel as u,UserDeletedPayloadModel as d,UserProfileModel as f}from"./user.js";import{AcceptInviteContract as p,AcceptInviteInputModel as m,CreateOrgContract as h,CreateOrgInputModel as g,GetOrgContract as _,GetOrgInputModel as v,InvitationModel as y,InviteMemberContract as b,InviteMemberInputModel as x,ListMembersContract as S,ListMembersInputModel as C,ListMembersOutputModel as w,ListUserOrgsContract as T,ListUserOrgsOutputModel as E,MemberModel as D,MemberRemovedPayloadModel as O,MemberUserModel as k,OrganizationModel as A,OrganizationWithRoleModel as j,RemoveMemberContract as M,RemoveMemberInputModel as N,UpdateOrgContract as P,UpdateOrgInputModel as F}from"./organization.js";import{AssignRoleContract as I,AssignRoleInputModel as L,BindingIdPayloadModel as R,CheckPermissionContract as z,CheckPermissionInputModel as B,CreateRoleContract as V,CreateRoleInputModel as H,DeleteRoleContract as U,DeleteRoleInputModel as W,ListRolesContract as G,ListRolesOutputModel as K,ListUserPermissionsContract as q,ListUserPermissionsInputModel as J,ListUserPermissionsOutputModel as Y,PermissionCheckResultModel as X,PolicyBindingModel as Z,RevokeRoleContract as Q,RevokeRoleInputModel as $,RoleModel as ee,UpdateRoleContract as te,UpdateRoleInputModel as ne}from"./rbac.js";export{p as AcceptInviteContract,m as AcceptInviteInputModel,I as AssignRoleContract,L as AssignRoleInputModel,R as BindingIdPayloadModel,z as CheckPermissionContract,B as CheckPermissionInputModel,h as CreateOrgContract,g as CreateOrgInputModel,V as CreateRoleContract,H as CreateRoleInputModel,e as CreateUserContract,t as CreateUserInputModel,U as DeleteRoleContract,W as DeleteRoleInputModel,n as DeleteUserContract,r as DeleteUserInputModel,i as GetCurrentUserContract,_ as GetOrgContract,v as GetOrgInputModel,y as InvitationModel,b as InviteMemberContract,x as InviteMemberInputModel,S as ListMembersContract,C as ListMembersInputModel,w as ListMembersOutputModel,G as ListRolesContract,K as ListRolesOutputModel,T as ListUserOrgsContract,E as ListUserOrgsOutputModel,q as ListUserPermissionsContract,J as ListUserPermissionsInputModel,Y as ListUserPermissionsOutputModel,a as ListUsersContract,o as ListUsersInputModel,s as ListUsersOutputModel,D as MemberModel,O as MemberRemovedPayloadModel,k as MemberUserModel,A as OrganizationModel,j as OrganizationWithRoleModel,X as PermissionCheckResultModel,Z as PolicyBindingModel,M as RemoveMemberContract,N as RemoveMemberInputModel,Q as RevokeRoleContract,$ as RevokeRoleInputModel,ee as RoleModel,c as SuccessResultModel,P as UpdateOrgContract,F as UpdateOrgInputModel,te as UpdateRoleContract,ne as UpdateRoleInputModel,l as UpdateUserContract,u as UpdateUserInputModel,d as UserDeletedPayloadModel,f as UserProfileModel};
|
|
@@ -1,607 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { SchemaModel } from "../schema/dist/SchemaModel.js";
|
|
3
|
-
import "../schema/dist/index.js";
|
|
4
|
-
import { defineCommand, defineQuery } from "./dist/spec.js";
|
|
5
|
-
import "./dist/index.js";
|
|
6
|
-
import { SuccessResultModel } from "./user.js";
|
|
7
|
-
|
|
8
|
-
//#region src/contracts/organization.ts
|
|
9
|
-
const OWNERS = ["platform.identity-rbac"];
|
|
10
|
-
const OrganizationModel = new SchemaModel({
|
|
11
|
-
name: "Organization",
|
|
12
|
-
description: "Organization details",
|
|
13
|
-
fields: {
|
|
14
|
-
id: {
|
|
15
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
16
|
-
isOptional: false
|
|
17
|
-
},
|
|
18
|
-
name: {
|
|
19
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
20
|
-
isOptional: false
|
|
21
|
-
},
|
|
22
|
-
slug: {
|
|
23
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
24
|
-
isOptional: true
|
|
25
|
-
},
|
|
26
|
-
logo: {
|
|
27
|
-
type: ScalarTypeEnum.URL(),
|
|
28
|
-
isOptional: true
|
|
29
|
-
},
|
|
30
|
-
description: {
|
|
31
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
32
|
-
isOptional: true
|
|
33
|
-
},
|
|
34
|
-
type: {
|
|
35
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
36
|
-
isOptional: false
|
|
37
|
-
},
|
|
38
|
-
onboardingCompleted: {
|
|
39
|
-
type: ScalarTypeEnum.Boolean(),
|
|
40
|
-
isOptional: false
|
|
41
|
-
},
|
|
42
|
-
createdAt: {
|
|
43
|
-
type: ScalarTypeEnum.DateTime(),
|
|
44
|
-
isOptional: false
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
const MemberUserModel = new SchemaModel({
|
|
49
|
-
name: "MemberUser",
|
|
50
|
-
description: "Basic user info within a member",
|
|
51
|
-
fields: {
|
|
52
|
-
id: {
|
|
53
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
54
|
-
isOptional: false
|
|
55
|
-
},
|
|
56
|
-
email: {
|
|
57
|
-
type: ScalarTypeEnum.EmailAddress(),
|
|
58
|
-
isOptional: false
|
|
59
|
-
},
|
|
60
|
-
name: {
|
|
61
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
62
|
-
isOptional: true
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
const MemberModel = new SchemaModel({
|
|
67
|
-
name: "Member",
|
|
68
|
-
description: "Organization member",
|
|
69
|
-
fields: {
|
|
70
|
-
id: {
|
|
71
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
72
|
-
isOptional: false
|
|
73
|
-
},
|
|
74
|
-
userId: {
|
|
75
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
76
|
-
isOptional: false
|
|
77
|
-
},
|
|
78
|
-
organizationId: {
|
|
79
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
80
|
-
isOptional: false
|
|
81
|
-
},
|
|
82
|
-
role: {
|
|
83
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
84
|
-
isOptional: false
|
|
85
|
-
},
|
|
86
|
-
createdAt: {
|
|
87
|
-
type: ScalarTypeEnum.DateTime(),
|
|
88
|
-
isOptional: false
|
|
89
|
-
},
|
|
90
|
-
user: {
|
|
91
|
-
type: MemberUserModel,
|
|
92
|
-
isOptional: false
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
const InvitationModel = new SchemaModel({
|
|
97
|
-
name: "Invitation",
|
|
98
|
-
description: "Organization invitation",
|
|
99
|
-
fields: {
|
|
100
|
-
id: {
|
|
101
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
102
|
-
isOptional: false
|
|
103
|
-
},
|
|
104
|
-
email: {
|
|
105
|
-
type: ScalarTypeEnum.EmailAddress(),
|
|
106
|
-
isOptional: false
|
|
107
|
-
},
|
|
108
|
-
role: {
|
|
109
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
110
|
-
isOptional: true
|
|
111
|
-
},
|
|
112
|
-
status: {
|
|
113
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
114
|
-
isOptional: false
|
|
115
|
-
},
|
|
116
|
-
expiresAt: {
|
|
117
|
-
type: ScalarTypeEnum.DateTime(),
|
|
118
|
-
isOptional: true
|
|
119
|
-
},
|
|
120
|
-
createdAt: {
|
|
121
|
-
type: ScalarTypeEnum.DateTime(),
|
|
122
|
-
isOptional: false
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
const CreateOrgInputModel = new SchemaModel({
|
|
127
|
-
name: "CreateOrgInput",
|
|
128
|
-
description: "Input for creating an organization",
|
|
129
|
-
fields: {
|
|
130
|
-
name: {
|
|
131
|
-
type: ScalarTypeEnum.NonEmptyString(),
|
|
132
|
-
isOptional: false
|
|
133
|
-
},
|
|
134
|
-
slug: {
|
|
135
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
136
|
-
isOptional: true
|
|
137
|
-
},
|
|
138
|
-
description: {
|
|
139
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
140
|
-
isOptional: true
|
|
141
|
-
},
|
|
142
|
-
type: {
|
|
143
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
144
|
-
isOptional: true
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
const GetOrgInputModel = new SchemaModel({
|
|
149
|
-
name: "GetOrgInput",
|
|
150
|
-
description: "Input for getting an organization",
|
|
151
|
-
fields: { orgId: {
|
|
152
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
153
|
-
isOptional: false
|
|
154
|
-
} }
|
|
155
|
-
});
|
|
156
|
-
const UpdateOrgInputModel = new SchemaModel({
|
|
157
|
-
name: "UpdateOrgInput",
|
|
158
|
-
description: "Input for updating an organization",
|
|
159
|
-
fields: {
|
|
160
|
-
orgId: {
|
|
161
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
162
|
-
isOptional: false
|
|
163
|
-
},
|
|
164
|
-
name: {
|
|
165
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
166
|
-
isOptional: true
|
|
167
|
-
},
|
|
168
|
-
slug: {
|
|
169
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
170
|
-
isOptional: true
|
|
171
|
-
},
|
|
172
|
-
logo: {
|
|
173
|
-
type: ScalarTypeEnum.URL(),
|
|
174
|
-
isOptional: true
|
|
175
|
-
},
|
|
176
|
-
description: {
|
|
177
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
178
|
-
isOptional: true
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
const InviteMemberInputModel = new SchemaModel({
|
|
183
|
-
name: "InviteMemberInput",
|
|
184
|
-
description: "Input for inviting a member",
|
|
185
|
-
fields: {
|
|
186
|
-
orgId: {
|
|
187
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
188
|
-
isOptional: false
|
|
189
|
-
},
|
|
190
|
-
email: {
|
|
191
|
-
type: ScalarTypeEnum.EmailAddress(),
|
|
192
|
-
isOptional: false
|
|
193
|
-
},
|
|
194
|
-
role: {
|
|
195
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
196
|
-
isOptional: false
|
|
197
|
-
},
|
|
198
|
-
teamId: {
|
|
199
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
200
|
-
isOptional: true
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
});
|
|
204
|
-
const AcceptInviteInputModel = new SchemaModel({
|
|
205
|
-
name: "AcceptInviteInput",
|
|
206
|
-
description: "Input for accepting an invitation",
|
|
207
|
-
fields: { invitationId: {
|
|
208
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
209
|
-
isOptional: false
|
|
210
|
-
} }
|
|
211
|
-
});
|
|
212
|
-
const RemoveMemberInputModel = new SchemaModel({
|
|
213
|
-
name: "RemoveMemberInput",
|
|
214
|
-
description: "Input for removing a member",
|
|
215
|
-
fields: {
|
|
216
|
-
orgId: {
|
|
217
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
218
|
-
isOptional: false
|
|
219
|
-
},
|
|
220
|
-
userId: {
|
|
221
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
222
|
-
isOptional: false
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
});
|
|
226
|
-
const MemberRemovedPayloadModel = new SchemaModel({
|
|
227
|
-
name: "MemberRemovedPayload",
|
|
228
|
-
description: "Payload for member removed event",
|
|
229
|
-
fields: {
|
|
230
|
-
orgId: {
|
|
231
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
232
|
-
isOptional: false
|
|
233
|
-
},
|
|
234
|
-
userId: {
|
|
235
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
236
|
-
isOptional: false
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
});
|
|
240
|
-
const ListMembersInputModel = new SchemaModel({
|
|
241
|
-
name: "ListMembersInput",
|
|
242
|
-
description: "Input for listing members",
|
|
243
|
-
fields: {
|
|
244
|
-
orgId: {
|
|
245
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
246
|
-
isOptional: false
|
|
247
|
-
},
|
|
248
|
-
limit: {
|
|
249
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
250
|
-
isOptional: true
|
|
251
|
-
},
|
|
252
|
-
offset: {
|
|
253
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
254
|
-
isOptional: true
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
});
|
|
258
|
-
const ListMembersOutputModel = new SchemaModel({
|
|
259
|
-
name: "ListMembersOutput",
|
|
260
|
-
description: "Output for listing members",
|
|
261
|
-
fields: {
|
|
262
|
-
members: {
|
|
263
|
-
type: MemberModel,
|
|
264
|
-
isOptional: false,
|
|
265
|
-
isArray: true
|
|
266
|
-
},
|
|
267
|
-
total: {
|
|
268
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
269
|
-
isOptional: false
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
});
|
|
273
|
-
const OrganizationWithRoleModel = new SchemaModel({
|
|
274
|
-
name: "OrganizationWithRole",
|
|
275
|
-
description: "Organization with user role",
|
|
276
|
-
fields: {
|
|
277
|
-
id: {
|
|
278
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
279
|
-
isOptional: false
|
|
280
|
-
},
|
|
281
|
-
name: {
|
|
282
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
283
|
-
isOptional: false
|
|
284
|
-
},
|
|
285
|
-
slug: {
|
|
286
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
287
|
-
isOptional: true
|
|
288
|
-
},
|
|
289
|
-
logo: {
|
|
290
|
-
type: ScalarTypeEnum.URL(),
|
|
291
|
-
isOptional: true
|
|
292
|
-
},
|
|
293
|
-
description: {
|
|
294
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
295
|
-
isOptional: true
|
|
296
|
-
},
|
|
297
|
-
type: {
|
|
298
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
299
|
-
isOptional: false
|
|
300
|
-
},
|
|
301
|
-
onboardingCompleted: {
|
|
302
|
-
type: ScalarTypeEnum.Boolean(),
|
|
303
|
-
isOptional: false
|
|
304
|
-
},
|
|
305
|
-
createdAt: {
|
|
306
|
-
type: ScalarTypeEnum.DateTime(),
|
|
307
|
-
isOptional: false
|
|
308
|
-
},
|
|
309
|
-
role: {
|
|
310
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
311
|
-
isOptional: false
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
});
|
|
315
|
-
const ListUserOrgsOutputModel = new SchemaModel({
|
|
316
|
-
name: "ListUserOrgsOutput",
|
|
317
|
-
description: "Output for listing user organizations",
|
|
318
|
-
fields: { organizations: {
|
|
319
|
-
type: OrganizationWithRoleModel,
|
|
320
|
-
isOptional: false,
|
|
321
|
-
isArray: true
|
|
322
|
-
} }
|
|
323
|
-
});
|
|
324
|
-
/**
|
|
325
|
-
* Create a new organization.
|
|
326
|
-
*/
|
|
327
|
-
const CreateOrgContract = defineCommand({
|
|
328
|
-
meta: {
|
|
329
|
-
name: "identity.org.create",
|
|
330
|
-
version: 1,
|
|
331
|
-
stability: "stable",
|
|
332
|
-
owners: [...OWNERS],
|
|
333
|
-
tags: [
|
|
334
|
-
"identity",
|
|
335
|
-
"org",
|
|
336
|
-
"create"
|
|
337
|
-
],
|
|
338
|
-
description: "Create a new organization.",
|
|
339
|
-
goal: "Allow users to create new organizations/workspaces.",
|
|
340
|
-
context: "Called during onboarding or when creating additional workspaces."
|
|
341
|
-
},
|
|
342
|
-
io: {
|
|
343
|
-
input: CreateOrgInputModel,
|
|
344
|
-
output: OrganizationModel,
|
|
345
|
-
errors: { SLUG_EXISTS: {
|
|
346
|
-
description: "An organization with this slug already exists",
|
|
347
|
-
http: 409,
|
|
348
|
-
gqlCode: "SLUG_EXISTS",
|
|
349
|
-
when: "Slug is already taken"
|
|
350
|
-
} }
|
|
351
|
-
},
|
|
352
|
-
policy: { auth: "user" },
|
|
353
|
-
sideEffects: {
|
|
354
|
-
emits: [{
|
|
355
|
-
name: "org.created",
|
|
356
|
-
version: 1,
|
|
357
|
-
when: "Organization is created",
|
|
358
|
-
payload: OrganizationModel
|
|
359
|
-
}],
|
|
360
|
-
audit: ["org.created"]
|
|
361
|
-
}
|
|
362
|
-
});
|
|
363
|
-
/**
|
|
364
|
-
* Get organization details.
|
|
365
|
-
*/
|
|
366
|
-
const GetOrgContract = defineQuery({
|
|
367
|
-
meta: {
|
|
368
|
-
name: "identity.org.get",
|
|
369
|
-
version: 1,
|
|
370
|
-
stability: "stable",
|
|
371
|
-
owners: [...OWNERS],
|
|
372
|
-
tags: [
|
|
373
|
-
"identity",
|
|
374
|
-
"org",
|
|
375
|
-
"get"
|
|
376
|
-
],
|
|
377
|
-
description: "Get organization details.",
|
|
378
|
-
goal: "Retrieve organization information.",
|
|
379
|
-
context: "Called when viewing organization settings or dashboard."
|
|
380
|
-
},
|
|
381
|
-
io: {
|
|
382
|
-
input: GetOrgInputModel,
|
|
383
|
-
output: OrganizationModel
|
|
384
|
-
},
|
|
385
|
-
policy: { auth: "user" }
|
|
386
|
-
});
|
|
387
|
-
/**
|
|
388
|
-
* Update organization.
|
|
389
|
-
*/
|
|
390
|
-
const UpdateOrgContract = defineCommand({
|
|
391
|
-
meta: {
|
|
392
|
-
name: "identity.org.update",
|
|
393
|
-
version: 1,
|
|
394
|
-
stability: "stable",
|
|
395
|
-
owners: [...OWNERS],
|
|
396
|
-
tags: [
|
|
397
|
-
"identity",
|
|
398
|
-
"org",
|
|
399
|
-
"update"
|
|
400
|
-
],
|
|
401
|
-
description: "Update organization details.",
|
|
402
|
-
goal: "Allow org admins to update organization settings.",
|
|
403
|
-
context: "Organization settings page."
|
|
404
|
-
},
|
|
405
|
-
io: {
|
|
406
|
-
input: UpdateOrgInputModel,
|
|
407
|
-
output: OrganizationModel
|
|
408
|
-
},
|
|
409
|
-
policy: { auth: "user" },
|
|
410
|
-
sideEffects: {
|
|
411
|
-
emits: [{
|
|
412
|
-
name: "org.updated",
|
|
413
|
-
version: 1,
|
|
414
|
-
when: "Organization is updated",
|
|
415
|
-
payload: OrganizationModel
|
|
416
|
-
}],
|
|
417
|
-
audit: ["org.updated"]
|
|
418
|
-
}
|
|
419
|
-
});
|
|
420
|
-
/**
|
|
421
|
-
* Invite a member to the organization.
|
|
422
|
-
*/
|
|
423
|
-
const InviteMemberContract = defineCommand({
|
|
424
|
-
meta: {
|
|
425
|
-
name: "identity.org.invite",
|
|
426
|
-
version: 1,
|
|
427
|
-
stability: "stable",
|
|
428
|
-
owners: [...OWNERS],
|
|
429
|
-
tags: [
|
|
430
|
-
"identity",
|
|
431
|
-
"org",
|
|
432
|
-
"invite",
|
|
433
|
-
"member"
|
|
434
|
-
],
|
|
435
|
-
description: "Invite a user to join the organization.",
|
|
436
|
-
goal: "Allow org admins to invite new members.",
|
|
437
|
-
context: "Team management. Sends invitation email."
|
|
438
|
-
},
|
|
439
|
-
io: {
|
|
440
|
-
input: InviteMemberInputModel,
|
|
441
|
-
output: InvitationModel,
|
|
442
|
-
errors: {
|
|
443
|
-
ALREADY_MEMBER: {
|
|
444
|
-
description: "User is already a member of this organization",
|
|
445
|
-
http: 409,
|
|
446
|
-
gqlCode: "ALREADY_MEMBER",
|
|
447
|
-
when: "Invitee is already a member"
|
|
448
|
-
},
|
|
449
|
-
INVITE_PENDING: {
|
|
450
|
-
description: "An invitation for this email is already pending",
|
|
451
|
-
http: 409,
|
|
452
|
-
gqlCode: "INVITE_PENDING",
|
|
453
|
-
when: "Active invitation exists"
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
},
|
|
457
|
-
policy: { auth: "user" },
|
|
458
|
-
sideEffects: {
|
|
459
|
-
emits: [{
|
|
460
|
-
name: "org.invite.sent",
|
|
461
|
-
version: 1,
|
|
462
|
-
when: "Invitation is sent",
|
|
463
|
-
payload: InvitationModel
|
|
464
|
-
}],
|
|
465
|
-
audit: ["org.invite.sent"]
|
|
466
|
-
}
|
|
467
|
-
});
|
|
468
|
-
/**
|
|
469
|
-
* Accept an invitation.
|
|
470
|
-
*/
|
|
471
|
-
const AcceptInviteContract = defineCommand({
|
|
472
|
-
meta: {
|
|
473
|
-
name: "identity.org.invite.accept",
|
|
474
|
-
version: 1,
|
|
475
|
-
stability: "stable",
|
|
476
|
-
owners: [...OWNERS],
|
|
477
|
-
tags: [
|
|
478
|
-
"identity",
|
|
479
|
-
"org",
|
|
480
|
-
"invite",
|
|
481
|
-
"accept"
|
|
482
|
-
],
|
|
483
|
-
description: "Accept an organization invitation.",
|
|
484
|
-
goal: "Allow users to join organizations via invitation.",
|
|
485
|
-
context: "Called from invitation email link."
|
|
486
|
-
},
|
|
487
|
-
io: {
|
|
488
|
-
input: AcceptInviteInputModel,
|
|
489
|
-
output: MemberModel,
|
|
490
|
-
errors: {
|
|
491
|
-
INVITE_EXPIRED: {
|
|
492
|
-
description: "The invitation has expired",
|
|
493
|
-
http: 410,
|
|
494
|
-
gqlCode: "INVITE_EXPIRED",
|
|
495
|
-
when: "Invitation is past expiry date"
|
|
496
|
-
},
|
|
497
|
-
INVITE_USED: {
|
|
498
|
-
description: "The invitation has already been used",
|
|
499
|
-
http: 409,
|
|
500
|
-
gqlCode: "INVITE_USED",
|
|
501
|
-
when: "Invitation was already accepted"
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
},
|
|
505
|
-
policy: { auth: "user" },
|
|
506
|
-
sideEffects: {
|
|
507
|
-
emits: [{
|
|
508
|
-
name: "org.member.added",
|
|
509
|
-
version: 1,
|
|
510
|
-
when: "Member joins org",
|
|
511
|
-
payload: MemberModel
|
|
512
|
-
}],
|
|
513
|
-
audit: ["org.member.added"]
|
|
514
|
-
}
|
|
515
|
-
});
|
|
516
|
-
/**
|
|
517
|
-
* Remove a member from the organization.
|
|
518
|
-
*/
|
|
519
|
-
const RemoveMemberContract = defineCommand({
|
|
520
|
-
meta: {
|
|
521
|
-
name: "identity.org.member.remove",
|
|
522
|
-
version: 1,
|
|
523
|
-
stability: "stable",
|
|
524
|
-
owners: [...OWNERS],
|
|
525
|
-
tags: [
|
|
526
|
-
"identity",
|
|
527
|
-
"org",
|
|
528
|
-
"member",
|
|
529
|
-
"remove"
|
|
530
|
-
],
|
|
531
|
-
description: "Remove a member from the organization.",
|
|
532
|
-
goal: "Allow org admins to remove members.",
|
|
533
|
-
context: "Team management."
|
|
534
|
-
},
|
|
535
|
-
io: {
|
|
536
|
-
input: RemoveMemberInputModel,
|
|
537
|
-
output: SuccessResultModel,
|
|
538
|
-
errors: { CANNOT_REMOVE_OWNER: {
|
|
539
|
-
description: "Cannot remove the organization owner",
|
|
540
|
-
http: 403,
|
|
541
|
-
gqlCode: "CANNOT_REMOVE_OWNER",
|
|
542
|
-
when: "Target is the org owner"
|
|
543
|
-
} }
|
|
544
|
-
},
|
|
545
|
-
policy: { auth: "user" },
|
|
546
|
-
sideEffects: {
|
|
547
|
-
emits: [{
|
|
548
|
-
name: "org.member.removed",
|
|
549
|
-
version: 1,
|
|
550
|
-
when: "Member is removed",
|
|
551
|
-
payload: MemberRemovedPayloadModel
|
|
552
|
-
}],
|
|
553
|
-
audit: ["org.member.removed"]
|
|
554
|
-
}
|
|
555
|
-
});
|
|
556
|
-
/**
|
|
557
|
-
* List organization members.
|
|
558
|
-
*/
|
|
559
|
-
const ListMembersContract = defineQuery({
|
|
560
|
-
meta: {
|
|
561
|
-
name: "identity.org.members.list",
|
|
562
|
-
version: 1,
|
|
563
|
-
stability: "stable",
|
|
564
|
-
owners: [...OWNERS],
|
|
565
|
-
tags: [
|
|
566
|
-
"identity",
|
|
567
|
-
"org",
|
|
568
|
-
"member",
|
|
569
|
-
"list"
|
|
570
|
-
],
|
|
571
|
-
description: "List organization members.",
|
|
572
|
-
goal: "View all members of an organization.",
|
|
573
|
-
context: "Team management page."
|
|
574
|
-
},
|
|
575
|
-
io: {
|
|
576
|
-
input: ListMembersInputModel,
|
|
577
|
-
output: ListMembersOutputModel
|
|
578
|
-
},
|
|
579
|
-
policy: { auth: "user" }
|
|
580
|
-
});
|
|
581
|
-
/**
|
|
582
|
-
* List user's organizations.
|
|
583
|
-
*/
|
|
584
|
-
const ListUserOrgsContract = defineQuery({
|
|
585
|
-
meta: {
|
|
586
|
-
name: "identity.org.list",
|
|
587
|
-
version: 1,
|
|
588
|
-
stability: "stable",
|
|
589
|
-
owners: [...OWNERS],
|
|
590
|
-
tags: [
|
|
591
|
-
"identity",
|
|
592
|
-
"org",
|
|
593
|
-
"list"
|
|
594
|
-
],
|
|
595
|
-
description: "List organizations the current user belongs to.",
|
|
596
|
-
goal: "Show user their organizations for workspace switching.",
|
|
597
|
-
context: "Workspace switcher, org selection."
|
|
598
|
-
},
|
|
599
|
-
io: {
|
|
600
|
-
input: null,
|
|
601
|
-
output: ListUserOrgsOutputModel
|
|
602
|
-
},
|
|
603
|
-
policy: { auth: "user" }
|
|
604
|
-
});
|
|
605
|
-
|
|
606
|
-
//#endregion
|
|
607
|
-
export { AcceptInviteContract, AcceptInviteInputModel, CreateOrgContract, CreateOrgInputModel, GetOrgContract, GetOrgInputModel, InvitationModel, InviteMemberContract, InviteMemberInputModel, ListMembersContract, ListMembersInputModel, ListMembersOutputModel, ListUserOrgsContract, ListUserOrgsOutputModel, MemberModel, MemberRemovedPayloadModel, MemberUserModel, OrganizationModel, OrganizationWithRoleModel, RemoveMemberContract, RemoveMemberInputModel, UpdateOrgContract, UpdateOrgInputModel };
|
|
1
|
+
import{SuccessResultModel as e}from"./user.js";import{ScalarTypeEnum as t,SchemaModel as n}from"@lssm/lib.schema";import{defineCommand as r,defineQuery as i}from"@lssm/lib.contracts";const a=[`platform.identity-rbac`],o=new n({name:`Organization`,description:`Organization details`,fields:{id:{type:t.String_unsecure(),isOptional:!1},name:{type:t.String_unsecure(),isOptional:!1},slug:{type:t.String_unsecure(),isOptional:!0},logo:{type:t.URL(),isOptional:!0},description:{type:t.String_unsecure(),isOptional:!0},type:{type:t.String_unsecure(),isOptional:!1},onboardingCompleted:{type:t.Boolean(),isOptional:!1},createdAt:{type:t.DateTime(),isOptional:!1}}}),s=new n({name:`MemberUser`,description:`Basic user info within a member`,fields:{id:{type:t.String_unsecure(),isOptional:!1},email:{type:t.EmailAddress(),isOptional:!1},name:{type:t.String_unsecure(),isOptional:!0}}}),c=new n({name:`Member`,description:`Organization member`,fields:{id:{type:t.String_unsecure(),isOptional:!1},userId:{type:t.String_unsecure(),isOptional:!1},organizationId:{type:t.String_unsecure(),isOptional:!1},role:{type:t.String_unsecure(),isOptional:!1},createdAt:{type:t.DateTime(),isOptional:!1},user:{type:s,isOptional:!1}}}),l=new n({name:`Invitation`,description:`Organization invitation`,fields:{id:{type:t.String_unsecure(),isOptional:!1},email:{type:t.EmailAddress(),isOptional:!1},role:{type:t.String_unsecure(),isOptional:!0},status:{type:t.String_unsecure(),isOptional:!1},expiresAt:{type:t.DateTime(),isOptional:!0},createdAt:{type:t.DateTime(),isOptional:!1}}}),u=new n({name:`CreateOrgInput`,description:`Input for creating an organization`,fields:{name:{type:t.NonEmptyString(),isOptional:!1},slug:{type:t.String_unsecure(),isOptional:!0},description:{type:t.String_unsecure(),isOptional:!0},type:{type:t.String_unsecure(),isOptional:!0}}}),d=new n({name:`GetOrgInput`,description:`Input for getting an organization`,fields:{orgId:{type:t.String_unsecure(),isOptional:!1}}}),f=new n({name:`UpdateOrgInput`,description:`Input for updating an organization`,fields:{orgId:{type:t.String_unsecure(),isOptional:!1},name:{type:t.String_unsecure(),isOptional:!0},slug:{type:t.String_unsecure(),isOptional:!0},logo:{type:t.URL(),isOptional:!0},description:{type:t.String_unsecure(),isOptional:!0}}}),p=new n({name:`InviteMemberInput`,description:`Input for inviting a member`,fields:{orgId:{type:t.String_unsecure(),isOptional:!1},email:{type:t.EmailAddress(),isOptional:!1},role:{type:t.String_unsecure(),isOptional:!1},teamId:{type:t.String_unsecure(),isOptional:!0}}}),m=new n({name:`AcceptInviteInput`,description:`Input for accepting an invitation`,fields:{invitationId:{type:t.String_unsecure(),isOptional:!1}}}),h=new n({name:`RemoveMemberInput`,description:`Input for removing a member`,fields:{orgId:{type:t.String_unsecure(),isOptional:!1},userId:{type:t.String_unsecure(),isOptional:!1}}}),g=new n({name:`MemberRemovedPayload`,description:`Payload for member removed event`,fields:{orgId:{type:t.String_unsecure(),isOptional:!1},userId:{type:t.String_unsecure(),isOptional:!1}}}),_=new n({name:`ListMembersInput`,description:`Input for listing members`,fields:{orgId:{type:t.String_unsecure(),isOptional:!1},limit:{type:t.Int_unsecure(),isOptional:!0},offset:{type:t.Int_unsecure(),isOptional:!0}}}),v=new n({name:`ListMembersOutput`,description:`Output for listing members`,fields:{members:{type:c,isOptional:!1,isArray:!0},total:{type:t.Int_unsecure(),isOptional:!1}}}),y=new n({name:`OrganizationWithRole`,description:`Organization with user role`,fields:{id:{type:t.String_unsecure(),isOptional:!1},name:{type:t.String_unsecure(),isOptional:!1},slug:{type:t.String_unsecure(),isOptional:!0},logo:{type:t.URL(),isOptional:!0},description:{type:t.String_unsecure(),isOptional:!0},type:{type:t.String_unsecure(),isOptional:!1},onboardingCompleted:{type:t.Boolean(),isOptional:!1},createdAt:{type:t.DateTime(),isOptional:!1},role:{type:t.String_unsecure(),isOptional:!1}}}),b=new n({name:`ListUserOrgsOutput`,description:`Output for listing user organizations`,fields:{organizations:{type:y,isOptional:!1,isArray:!0}}}),x=r({meta:{name:`identity.org.create`,version:1,stability:`stable`,owners:[...a],tags:[`identity`,`org`,`create`],description:`Create a new organization.`,goal:`Allow users to create new organizations/workspaces.`,context:`Called during onboarding or when creating additional workspaces.`},io:{input:u,output:o,errors:{SLUG_EXISTS:{description:`An organization with this slug already exists`,http:409,gqlCode:`SLUG_EXISTS`,when:`Slug is already taken`}}},policy:{auth:`user`},sideEffects:{emits:[{name:`org.created`,version:1,when:`Organization is created`,payload:o}],audit:[`org.created`]}}),S=i({meta:{name:`identity.org.get`,version:1,stability:`stable`,owners:[...a],tags:[`identity`,`org`,`get`],description:`Get organization details.`,goal:`Retrieve organization information.`,context:`Called when viewing organization settings or dashboard.`},io:{input:d,output:o},policy:{auth:`user`}}),C=r({meta:{name:`identity.org.update`,version:1,stability:`stable`,owners:[...a],tags:[`identity`,`org`,`update`],description:`Update organization details.`,goal:`Allow org admins to update organization settings.`,context:`Organization settings page.`},io:{input:f,output:o},policy:{auth:`user`},sideEffects:{emits:[{name:`org.updated`,version:1,when:`Organization is updated`,payload:o}],audit:[`org.updated`]}}),w=r({meta:{name:`identity.org.invite`,version:1,stability:`stable`,owners:[...a],tags:[`identity`,`org`,`invite`,`member`],description:`Invite a user to join the organization.`,goal:`Allow org admins to invite new members.`,context:`Team management. Sends invitation email.`},io:{input:p,output:l,errors:{ALREADY_MEMBER:{description:`User is already a member of this organization`,http:409,gqlCode:`ALREADY_MEMBER`,when:`Invitee is already a member`},INVITE_PENDING:{description:`An invitation for this email is already pending`,http:409,gqlCode:`INVITE_PENDING`,when:`Active invitation exists`}}},policy:{auth:`user`},sideEffects:{emits:[{name:`org.invite.sent`,version:1,when:`Invitation is sent`,payload:l}],audit:[`org.invite.sent`]}}),T=r({meta:{name:`identity.org.invite.accept`,version:1,stability:`stable`,owners:[...a],tags:[`identity`,`org`,`invite`,`accept`],description:`Accept an organization invitation.`,goal:`Allow users to join organizations via invitation.`,context:`Called from invitation email link.`},io:{input:m,output:c,errors:{INVITE_EXPIRED:{description:`The invitation has expired`,http:410,gqlCode:`INVITE_EXPIRED`,when:`Invitation is past expiry date`},INVITE_USED:{description:`The invitation has already been used`,http:409,gqlCode:`INVITE_USED`,when:`Invitation was already accepted`}}},policy:{auth:`user`},sideEffects:{emits:[{name:`org.member.added`,version:1,when:`Member joins org`,payload:c}],audit:[`org.member.added`]}}),E=r({meta:{name:`identity.org.member.remove`,version:1,stability:`stable`,owners:[...a],tags:[`identity`,`org`,`member`,`remove`],description:`Remove a member from the organization.`,goal:`Allow org admins to remove members.`,context:`Team management.`},io:{input:h,output:e,errors:{CANNOT_REMOVE_OWNER:{description:`Cannot remove the organization owner`,http:403,gqlCode:`CANNOT_REMOVE_OWNER`,when:`Target is the org owner`}}},policy:{auth:`user`},sideEffects:{emits:[{name:`org.member.removed`,version:1,when:`Member is removed`,payload:g}],audit:[`org.member.removed`]}}),D=i({meta:{name:`identity.org.members.list`,version:1,stability:`stable`,owners:[...a],tags:[`identity`,`org`,`member`,`list`],description:`List organization members.`,goal:`View all members of an organization.`,context:`Team management page.`},io:{input:_,output:v},policy:{auth:`user`}}),O=i({meta:{name:`identity.org.list`,version:1,stability:`stable`,owners:[...a],tags:[`identity`,`org`,`list`],description:`List organizations the current user belongs to.`,goal:`Show user their organizations for workspace switching.`,context:`Workspace switcher, org selection.`},io:{input:null,output:b},policy:{auth:`user`}});export{T as AcceptInviteContract,m as AcceptInviteInputModel,x as CreateOrgContract,u as CreateOrgInputModel,S as GetOrgContract,d as GetOrgInputModel,l as InvitationModel,w as InviteMemberContract,p as InviteMemberInputModel,D as ListMembersContract,_ as ListMembersInputModel,v as ListMembersOutputModel,O as ListUserOrgsContract,b as ListUserOrgsOutputModel,c as MemberModel,g as MemberRemovedPayloadModel,s as MemberUserModel,o as OrganizationModel,y as OrganizationWithRoleModel,E as RemoveMemberContract,h as RemoveMemberInputModel,C as UpdateOrgContract,f as UpdateOrgInputModel};
|