@headless-lms/core 0.2.0 → 0.3.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/assets/events.d.ts +39 -21
- package/dist/assets/events.js +1 -1
- package/dist/assets/events.js.map +1 -1
- package/dist/assets/file-urls.d.ts +20 -0
- package/dist/assets/file-urls.js +25 -0
- package/dist/assets/file-urls.js.map +1 -0
- package/dist/assets/index.d.ts +5 -4
- package/dist/assets/index.js +3 -2
- package/dist/assets/model.d.ts +2 -2
- package/dist/assets/ports.d.ts +45 -15
- package/dist/assets/service.d.ts +39 -7
- package/dist/assets/service.js +291 -38
- package/dist/assets/service.js.map +1 -1
- package/dist/automations/actions.d.ts +13 -24
- package/dist/automations/actions.js +168 -43
- package/dist/automations/actions.js.map +1 -1
- package/dist/automations/catalog.d.ts +2 -1
- package/dist/automations/catalog.js +229 -13
- package/dist/automations/catalog.js.map +1 -1
- package/dist/automations/community-derivations.d.ts +14 -0
- package/dist/automations/community-derivations.js +439 -0
- package/dist/automations/community-derivations.js.map +1 -0
- package/dist/automations/community-mail.d.ts +112 -0
- package/dist/automations/community-mail.js +90 -0
- package/dist/automations/community-mail.js.map +1 -0
- package/dist/automations/community-notifications.d.ts +16 -0
- package/dist/automations/community-notifications.js +84 -0
- package/dist/automations/community-notifications.js.map +1 -0
- package/dist/automations/events.d.ts +28 -0
- package/dist/automations/index.d.ts +4 -2
- package/dist/automations/index.js +3 -2
- package/dist/automations/model.d.ts +10 -3
- package/dist/automations/model.js +15 -2
- package/dist/automations/model.js.map +1 -1
- package/dist/automations/ports.d.ts +5 -1
- package/dist/automations/schedule.d.ts +6 -0
- package/dist/automations/schedule.js +41 -0
- package/dist/automations/schedule.js.map +1 -0
- package/dist/automations/seeds.d.ts +17 -0
- package/dist/automations/seeds.js +235 -0
- package/dist/automations/seeds.js.map +1 -0
- package/dist/automations/service.d.ts +22 -3
- package/dist/automations/service.js +306 -43
- package/dist/automations/service.js.map +1 -1
- package/dist/content/events.d.ts +631 -19
- package/dist/content/events.js +44 -1
- package/dist/content/events.js.map +1 -1
- package/dist/content/index.d.ts +4 -4
- package/dist/content/model.d.ts +2 -2
- package/dist/content/ports.d.ts +71 -18
- package/dist/content/service.d.ts +57 -18
- package/dist/content/service.js +502 -23
- package/dist/content/service.js.map +1 -1
- package/dist/content/types.d.ts +2 -2
- package/dist/discussion/authors.d.ts +10 -0
- package/dist/discussion/authors.js +23 -0
- package/dist/discussion/authors.js.map +1 -0
- package/dist/discussion/chats.d.ts +104 -0
- package/dist/discussion/chats.js +798 -0
- package/dist/discussion/chats.js.map +1 -0
- package/dist/discussion/events.d.ts +619 -56
- package/dist/discussion/events.js +106 -3
- package/dist/discussion/events.js.map +1 -1
- package/dist/discussion/index.d.ts +7 -3
- package/dist/discussion/index.js +4 -1
- package/dist/discussion/ports.d.ts +288 -27
- package/dist/discussion/ports.js +6 -1
- package/dist/discussion/ports.js.map +1 -0
- package/dist/discussion/posts.d.ts +103 -0
- package/dist/discussion/posts.js +723 -0
- package/dist/discussion/posts.js.map +1 -0
- package/dist/discussion/service.d.ts +32 -10
- package/dist/discussion/service.js +293 -78
- package/dist/discussion/service.js.map +1 -1
- package/dist/entitlements/events.d.ts +178 -11
- package/dist/entitlements/events.js +28 -1
- package/dist/entitlements/events.js.map +1 -1
- package/dist/entitlements/index.d.ts +5 -4
- package/dist/entitlements/index.js +2 -1
- package/dist/entitlements/model.d.ts +3 -2
- package/dist/entitlements/ports.d.ts +124 -11
- package/dist/entitlements/rules.d.ts +12 -0
- package/dist/entitlements/rules.js +17 -0
- package/dist/entitlements/rules.js.map +1 -0
- package/dist/entitlements/service.d.ts +54 -3
- package/dist/entitlements/service.js +472 -2
- package/dist/entitlements/service.js.map +1 -1
- package/dist/identity/access.d.ts +6 -0
- package/dist/identity/access.js +7 -0
- package/dist/identity/access.js.map +1 -0
- package/dist/identity/index.d.ts +6 -4
- package/dist/identity/index.js +3 -1
- package/dist/identity/model.d.ts +2 -1
- package/dist/identity/notifications.d.ts +27 -0
- package/dist/identity/notifications.js +101 -0
- package/dist/identity/notifications.js.map +1 -0
- package/dist/identity/ports.d.ts +73 -3
- package/dist/identity/service.d.ts +14 -3
- package/dist/identity/service.js +62 -5
- package/dist/identity/service.js.map +1 -1
- package/dist/integrations/model.js +1 -1
- package/dist/integrations/model.js.map +1 -1
- package/dist/integrations/service.js +2 -2
- package/dist/integrations/service.js.map +1 -1
- package/dist/organizations/access-scopes.d.ts +19 -0
- package/dist/organizations/access-scopes.js +89 -0
- package/dist/organizations/access-scopes.js.map +1 -0
- package/dist/organizations/events.d.ts +74 -32
- package/dist/organizations/events.js +6 -0
- package/dist/organizations/events.js.map +1 -1
- package/dist/organizations/index.d.ts +7 -6
- package/dist/organizations/index.js +4 -3
- package/dist/organizations/members.d.ts +8 -5
- package/dist/organizations/members.js.map +1 -1
- package/dist/organizations/ports.d.ts +14 -11
- package/dist/organizations/roles.d.ts +6 -10
- package/dist/organizations/roles.js +19 -7
- package/dist/organizations/roles.js.map +1 -1
- package/dist/organizations/service.d.ts +20 -11
- package/dist/organizations/service.js +157 -47
- package/dist/organizations/service.js.map +1 -1
- package/dist/organizations/types.d.ts +1 -10
- package/dist/progress/index.d.ts +2 -2
- package/dist/progress/ports.d.ts +6 -1
- package/dist/progress/service.d.ts +3 -1
- package/dist/progress/service.js +6 -2
- package/dist/progress/service.js.map +1 -1
- package/dist/reporting/admin/index.d.ts +4 -0
- package/dist/reporting/admin/index.js +2 -0
- package/dist/reporting/admin/model.d.ts +108 -0
- package/dist/reporting/admin/ports.d.ts +27 -0
- package/dist/reporting/admin/service.d.ts +22 -0
- package/dist/reporting/admin/service.js +38 -0
- package/dist/reporting/admin/service.js.map +1 -0
- package/dist/reporting/member/index.d.ts +5 -0
- package/dist/reporting/member/index.js +2 -0
- package/dist/reporting/member/model.d.ts +124 -0
- package/dist/reporting/member/ports.d.ts +45 -0
- package/dist/reporting/member/service.d.ts +73 -0
- package/dist/reporting/member/service.js +286 -0
- package/dist/reporting/member/service.js.map +1 -0
- package/dist/shared/actor.d.ts +9 -0
- package/dist/shared/errors.d.ts +7 -1
- package/dist/shared/errors.js +10 -1
- package/dist/shared/errors.js.map +1 -1
- package/dist/shared/id.d.ts +11 -0
- package/dist/shared/id.js +12 -1
- package/dist/shared/id.js.map +1 -1
- package/dist/shared/mailer.d.ts +4 -1
- package/dist/shared/mailer.js.map +1 -1
- package/dist/shared/network.d.ts +10 -0
- package/dist/shared/network.js +211 -0
- package/dist/shared/network.js.map +1 -0
- package/dist/types/assets.d.ts +2 -2
- package/dist/types/automations.d.ts +10 -2
- package/dist/types/content.d.ts +2 -2
- package/dist/types/discussion.d.ts +11 -3
- package/dist/types/email-templates.d.ts +121 -0
- package/dist/types/entitlements.d.ts +2 -2
- package/dist/types/identity.d.ts +48 -2
- package/dist/types/index.d.ts +9 -9
- package/dist/types/ports.d.ts +6 -0
- package/dist/types/schemas/assets.d.ts +65 -37
- package/dist/types/schemas/assets.js +17 -12
- package/dist/types/schemas/assets.js.map +1 -1
- package/dist/types/schemas/automations.d.ts +18 -1
- package/dist/types/schemas/automations.js +15 -6
- package/dist/types/schemas/automations.js.map +1 -1
- package/dist/types/schemas/content.d.ts +335 -3
- package/dist/types/schemas/content.js +139 -3
- package/dist/types/schemas/content.js.map +1 -1
- package/dist/types/schemas/discussion.d.ts +370 -3
- package/dist/types/schemas/discussion.js +199 -4
- package/dist/types/schemas/discussion.js.map +1 -1
- package/dist/types/schemas/entitlements.d.ts +36 -2
- package/dist/types/schemas/entitlements.js +23 -1
- package/dist/types/schemas/entitlements.js.map +1 -1
- package/dist/types/schemas/identity.d.ts +111 -1
- package/dist/types/schemas/identity.js +55 -2
- package/dist/types/schemas/identity.js.map +1 -1
- package/dist/types/schemas/index.d.ts +8 -8
- package/dist/types/schemas/index.js +8 -8
- package/dist/types/schemas/organizations.d.ts +8 -0
- package/dist/types/schemas/organizations.js +2 -0
- package/dist/types/schemas/organizations.js.map +1 -1
- package/dist/types/schemas/shared.d.ts +3 -1
- package/dist/types/schemas/shared.js +5 -1
- package/dist/types/schemas/shared.js.map +1 -1
- package/package.json +2 -2
- package/dist/reporting/courses/index.d.ts +0 -4
- package/dist/reporting/courses/index.js +0 -2
- package/dist/reporting/courses/model.d.ts +0 -24
- package/dist/reporting/courses/ports.d.ts +0 -13
- package/dist/reporting/courses/service.d.ts +0 -19
- package/dist/reporting/courses/service.js +0 -20
- package/dist/reporting/courses/service.js.map +0 -1
- package/dist/reporting/dashboard/index.d.ts +0 -4
- package/dist/reporting/dashboard/index.js +0 -2
- package/dist/reporting/dashboard/model.d.ts +0 -14
- package/dist/reporting/dashboard/ports.d.ts +0 -13
- package/dist/reporting/dashboard/service.d.ts +0 -19
- package/dist/reporting/dashboard/service.js +0 -20
- package/dist/reporting/dashboard/service.js.map +0 -1
- package/dist/reporting/learn/index.d.ts +0 -5
- package/dist/reporting/learn/index.js +0 -2
- package/dist/reporting/learn/model.d.ts +0 -23
- package/dist/reporting/learn/ports.d.ts +0 -43
- package/dist/reporting/learn/ports.js +0 -1
- package/dist/reporting/learn/service.d.ts +0 -49
- package/dist/reporting/learn/service.js +0 -116
- package/dist/reporting/learn/service.js.map +0 -1
- package/dist/reporting/students/index.d.ts +0 -4
- package/dist/reporting/students/index.js +0 -2
- package/dist/reporting/students/model.d.ts +0 -51
- package/dist/reporting/students/model.js +0 -1
- package/dist/reporting/students/ports.d.ts +0 -15
- package/dist/reporting/students/ports.js +0 -1
- package/dist/reporting/students/service.d.ts +0 -20
- package/dist/reporting/students/service.js +0 -23
- package/dist/reporting/students/service.js.map +0 -1
- /package/dist/reporting/{courses → admin}/model.js +0 -0
- /package/dist/reporting/{courses → admin}/ports.js +0 -0
- /package/dist/reporting/{dashboard → member}/model.js +0 -0
- /package/dist/reporting/{dashboard → member}/ports.js +0 -0
- /package/dist/{reporting/learn/model.js → shared/actor.js} +0 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { ForbiddenError } from "../shared/errors.js";
|
|
2
|
+
import { capability, isStaffRole } from "./roles.js";
|
|
3
|
+
//#region src/organizations/access-scopes.ts
|
|
4
|
+
const ACCESS_SCOPES = [
|
|
5
|
+
"courses:read",
|
|
6
|
+
"courses:write",
|
|
7
|
+
"courses:delete",
|
|
8
|
+
"downloads:read",
|
|
9
|
+
"downloads:write",
|
|
10
|
+
"downloads:delete",
|
|
11
|
+
"bundles:read",
|
|
12
|
+
"bundles:write",
|
|
13
|
+
"bundles:delete",
|
|
14
|
+
"media:read",
|
|
15
|
+
"students:read",
|
|
16
|
+
"students:invite",
|
|
17
|
+
"access:read",
|
|
18
|
+
"access:write",
|
|
19
|
+
"analytics:read",
|
|
20
|
+
"automations:read",
|
|
21
|
+
"automations:write",
|
|
22
|
+
"automations:delete",
|
|
23
|
+
"comments:read",
|
|
24
|
+
"comments:moderate",
|
|
25
|
+
"communities:read",
|
|
26
|
+
"communities:write",
|
|
27
|
+
"communities:delete",
|
|
28
|
+
"community_members:read",
|
|
29
|
+
"community_members:write",
|
|
30
|
+
"community_moderation:read",
|
|
31
|
+
"community_moderation:write"
|
|
32
|
+
];
|
|
33
|
+
const SCOPE_PERMISSION = {
|
|
34
|
+
"courses:read": null,
|
|
35
|
+
"courses:write": "create_course",
|
|
36
|
+
"courses:delete": "create_course",
|
|
37
|
+
"downloads:read": null,
|
|
38
|
+
"downloads:write": "create_course",
|
|
39
|
+
"downloads:delete": "create_course",
|
|
40
|
+
"bundles:read": null,
|
|
41
|
+
"bundles:write": "create_course",
|
|
42
|
+
"bundles:delete": "create_course",
|
|
43
|
+
"media:read": null,
|
|
44
|
+
"students:read": "view_student_progress",
|
|
45
|
+
"students:invite": "manage_users",
|
|
46
|
+
"access:read": "view_student_progress",
|
|
47
|
+
"access:write": "manage_users",
|
|
48
|
+
"analytics:read": "view_student_progress",
|
|
49
|
+
"automations:read": null,
|
|
50
|
+
"automations:write": "manage_org_settings",
|
|
51
|
+
"automations:delete": "manage_org_settings",
|
|
52
|
+
"comments:read": null,
|
|
53
|
+
"comments:moderate": "edit_assigned_course",
|
|
54
|
+
"communities:read": null,
|
|
55
|
+
"communities:write": "create_course",
|
|
56
|
+
"communities:delete": "create_course",
|
|
57
|
+
"community_members:read": null,
|
|
58
|
+
"community_members:write": "moderate",
|
|
59
|
+
"community_moderation:read": null,
|
|
60
|
+
"community_moderation:write": "moderate"
|
|
61
|
+
};
|
|
62
|
+
function isAccessScope(value) {
|
|
63
|
+
return ACCESS_SCOPES.includes(value);
|
|
64
|
+
}
|
|
65
|
+
function isDeleteScope(scope) {
|
|
66
|
+
return scope.endsWith(":delete");
|
|
67
|
+
}
|
|
68
|
+
function roleHoldsScope(role, scope) {
|
|
69
|
+
if (!isStaffRole(role)) return false;
|
|
70
|
+
const permission = SCOPE_PERMISSION[scope];
|
|
71
|
+
return permission === null || capability(role, permission) === true;
|
|
72
|
+
}
|
|
73
|
+
function scopesForRole(role) {
|
|
74
|
+
return ACCESS_SCOPES.filter((scope) => roleHoldsScope(role, scope));
|
|
75
|
+
}
|
|
76
|
+
function scopeOptions(role) {
|
|
77
|
+
return ACCESS_SCOPES.map((scope) => ({
|
|
78
|
+
scope,
|
|
79
|
+
allowed: roleHoldsScope(role, scope)
|
|
80
|
+
}));
|
|
81
|
+
}
|
|
82
|
+
function assertRoleHoldsScopes(role, scopes) {
|
|
83
|
+
const missing = scopes.filter((scope) => !roleHoldsScope(role, scope));
|
|
84
|
+
if (missing.length > 0) throw new ForbiddenError(`Your role cannot grant ${missing.join(", ")}`);
|
|
85
|
+
}
|
|
86
|
+
//#endregion
|
|
87
|
+
export { ACCESS_SCOPES, SCOPE_PERMISSION, assertRoleHoldsScopes, isAccessScope, isDeleteScope, roleHoldsScope, scopeOptions, scopesForRole };
|
|
88
|
+
|
|
89
|
+
//# sourceMappingURL=access-scopes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"access-scopes.js","names":[],"sources":["../../src/organizations/access-scopes.ts"],"sourcesContent":["import { ForbiddenError } from '../shared/errors.js';\nimport { capability, isStaffRole, type Permission, type Role } from './roles.js';\n\nexport const ACCESS_SCOPES = [\n 'courses:read',\n 'courses:write',\n 'courses:delete',\n 'downloads:read',\n 'downloads:write',\n 'downloads:delete',\n 'bundles:read',\n 'bundles:write',\n 'bundles:delete',\n 'media:read',\n 'students:read',\n 'students:invite',\n 'access:read',\n 'access:write',\n 'analytics:read',\n 'automations:read',\n 'automations:write',\n 'automations:delete',\n 'comments:read',\n 'comments:moderate',\n 'communities:read',\n 'communities:write',\n 'communities:delete',\n 'community_members:read',\n 'community_members:write',\n 'community_moderation:read',\n 'community_moderation:write',\n] as const;\n\nexport type AccessScope = (typeof ACCESS_SCOPES)[number];\n\nexport const SCOPE_PERMISSION: Record<AccessScope, Permission | null> = {\n 'courses:read': null,\n 'courses:write': 'create_course',\n 'courses:delete': 'create_course',\n 'downloads:read': null,\n 'downloads:write': 'create_course',\n 'downloads:delete': 'create_course',\n 'bundles:read': null,\n 'bundles:write': 'create_course',\n 'bundles:delete': 'create_course',\n 'media:read': null,\n 'students:read': 'view_student_progress',\n 'students:invite': 'manage_users',\n 'access:read': 'view_student_progress',\n 'access:write': 'manage_users',\n 'analytics:read': 'view_student_progress',\n 'automations:read': null,\n 'automations:write': 'manage_org_settings',\n 'automations:delete': 'manage_org_settings',\n 'comments:read': null,\n 'comments:moderate': 'edit_assigned_course',\n 'communities:read': null,\n 'communities:write': 'create_course',\n 'communities:delete': 'create_course',\n 'community_members:read': null,\n 'community_members:write': 'moderate',\n 'community_moderation:read': null,\n 'community_moderation:write': 'moderate',\n};\n\nexport type ScopeOption = { scope: AccessScope; allowed: boolean };\n\nexport function isAccessScope(value: string): value is AccessScope {\n return (ACCESS_SCOPES as readonly string[]).includes(value);\n}\n\nexport function isDeleteScope(scope: AccessScope): boolean {\n return scope.endsWith(':delete');\n}\n\nexport function roleHoldsScope(role: Role, scope: AccessScope): boolean {\n if (!isStaffRole(role)) {\n return false;\n }\n const permission = SCOPE_PERMISSION[scope];\n return permission === null || capability(role, permission) === true;\n}\n\nexport function scopesForRole(role: Role): AccessScope[] {\n return ACCESS_SCOPES.filter((scope) => roleHoldsScope(role, scope));\n}\n\nexport function scopeOptions(role: Role): ScopeOption[] {\n return ACCESS_SCOPES.map((scope) => ({ scope, allowed: roleHoldsScope(role, scope) }));\n}\n\nexport function assertRoleHoldsScopes(role: Role, scopes: readonly AccessScope[]): void {\n const missing = scopes.filter((scope) => !roleHoldsScope(role, scope));\n if (missing.length > 0) {\n throw new ForbiddenError(`Your role cannot grant ${missing.join(', ')}`);\n }\n}\n"],"mappings":";;;AAGA,MAAa,gBAAgB;CAC3B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAIA,MAAa,mBAA2D;CACtE,gBAAgB;CAChB,iBAAiB;CACjB,kBAAkB;CAClB,kBAAkB;CAClB,mBAAmB;CACnB,oBAAoB;CACpB,gBAAgB;CAChB,iBAAiB;CACjB,kBAAkB;CAClB,cAAc;CACd,iBAAiB;CACjB,mBAAmB;CACnB,eAAe;CACf,gBAAgB;CAChB,kBAAkB;CAClB,oBAAoB;CACpB,qBAAqB;CACrB,sBAAsB;CACtB,iBAAiB;CACjB,qBAAqB;CACrB,oBAAoB;CACpB,qBAAqB;CACrB,sBAAsB;CACtB,0BAA0B;CAC1B,2BAA2B;CAC3B,6BAA6B;CAC7B,8BAA8B;AAChC;AAIA,SAAgB,cAAc,OAAqC;CACjE,OAAQ,cAAoC,SAAS,KAAK;AAC5D;AAEA,SAAgB,cAAc,OAA6B;CACzD,OAAO,MAAM,SAAS,SAAS;AACjC;AAEA,SAAgB,eAAe,MAAY,OAA6B;CACtE,IAAI,CAAC,YAAY,IAAI,GACnB,OAAO;CAET,MAAM,aAAa,iBAAiB;CACpC,OAAO,eAAe,QAAQ,WAAW,MAAM,UAAU,MAAM;AACjE;AAEA,SAAgB,cAAc,MAA2B;CACvD,OAAO,cAAc,QAAQ,UAAU,eAAe,MAAM,KAAK,CAAC;AACpE;AAEA,SAAgB,aAAa,MAA2B;CACtD,OAAO,cAAc,KAAK,WAAW;EAAE;EAAO,SAAS,eAAe,MAAM,KAAK;CAAE,EAAE;AACvF;AAEA,SAAgB,sBAAsB,MAAY,QAAsC;CACtF,MAAM,UAAU,OAAO,QAAQ,UAAU,CAAC,eAAe,MAAM,KAAK,CAAC;CACrE,IAAI,QAAQ,SAAS,GACnB,MAAM,IAAI,eAAe,0BAA0B,QAAQ,KAAK,IAAI,GAAG;AAE3E"}
|
|
@@ -20,9 +20,9 @@ declare const organizationEvents: {
|
|
|
20
20
|
updatedAt: unknown;
|
|
21
21
|
}, import("zod").ZodObject<{
|
|
22
22
|
id: import("zod").ZodString;
|
|
23
|
-
name: import("zod").ZodString;
|
|
24
23
|
createdAt: import("zod").ZodCoercedDate<unknown>;
|
|
25
24
|
updatedAt: import("zod").ZodCoercedDate<unknown>;
|
|
25
|
+
name: import("zod").ZodString;
|
|
26
26
|
slug: import("zod").ZodString;
|
|
27
27
|
ownerId: import("zod").ZodString;
|
|
28
28
|
}, import("zod/v4/core").$strip>>;
|
|
@@ -44,9 +44,9 @@ declare const organizationEvents: {
|
|
|
44
44
|
updatedAt: unknown;
|
|
45
45
|
}, import("zod").ZodObject<{
|
|
46
46
|
id: import("zod").ZodString;
|
|
47
|
-
name: import("zod").ZodString;
|
|
48
47
|
createdAt: import("zod").ZodCoercedDate<unknown>;
|
|
49
48
|
updatedAt: import("zod").ZodCoercedDate<unknown>;
|
|
49
|
+
name: import("zod").ZodString;
|
|
50
50
|
slug: import("zod").ZodString;
|
|
51
51
|
ownerId: import("zod").ZodString;
|
|
52
52
|
}, import("zod/v4/core").$strip>>;
|
|
@@ -68,9 +68,9 @@ declare const organizationEvents: {
|
|
|
68
68
|
updatedAt: unknown;
|
|
69
69
|
}, import("zod").ZodObject<{
|
|
70
70
|
id: import("zod").ZodString;
|
|
71
|
-
name: import("zod").ZodString;
|
|
72
71
|
createdAt: import("zod").ZodCoercedDate<unknown>;
|
|
73
72
|
updatedAt: import("zod").ZodCoercedDate<unknown>;
|
|
73
|
+
name: import("zod").ZodString;
|
|
74
74
|
slug: import("zod").ZodString;
|
|
75
75
|
ownerId: import("zod").ZodString;
|
|
76
76
|
}, import("zod/v4/core").$strip>>;
|
|
@@ -78,7 +78,7 @@ declare const organizationEvents: {
|
|
|
78
78
|
id: string;
|
|
79
79
|
orgId: string;
|
|
80
80
|
userId: string;
|
|
81
|
-
role: "owner" | "admin" | "instructor" | "student";
|
|
81
|
+
role: "owner" | "admin" | "instructor" | "moderator" | "student";
|
|
82
82
|
status: "active" | "invited";
|
|
83
83
|
createdAt: Date;
|
|
84
84
|
updatedAt: Date;
|
|
@@ -86,24 +86,25 @@ declare const organizationEvents: {
|
|
|
86
86
|
id: string;
|
|
87
87
|
orgId: string;
|
|
88
88
|
userId: string;
|
|
89
|
-
role: "owner" | "admin" | "instructor" | "student";
|
|
89
|
+
role: "owner" | "admin" | "instructor" | "moderator" | "student";
|
|
90
90
|
status: "active" | "invited";
|
|
91
91
|
createdAt: unknown;
|
|
92
92
|
updatedAt: unknown;
|
|
93
93
|
}, import("zod").ZodObject<{
|
|
94
94
|
orgId: import("zod").ZodString;
|
|
95
95
|
id: import("zod").ZodString;
|
|
96
|
-
createdAt: import("zod").ZodCoercedDate<unknown>;
|
|
97
|
-
updatedAt: import("zod").ZodCoercedDate<unknown>;
|
|
98
96
|
status: import("zod").ZodEnum<{
|
|
99
97
|
active: "active";
|
|
100
98
|
invited: "invited";
|
|
101
99
|
}>;
|
|
100
|
+
createdAt: import("zod").ZodCoercedDate<unknown>;
|
|
101
|
+
updatedAt: import("zod").ZodCoercedDate<unknown>;
|
|
102
102
|
userId: import("zod").ZodString;
|
|
103
103
|
role: import("zod").ZodEnum<{
|
|
104
104
|
owner: "owner";
|
|
105
105
|
admin: "admin";
|
|
106
106
|
instructor: "instructor";
|
|
107
|
+
moderator: "moderator";
|
|
107
108
|
student: "student";
|
|
108
109
|
}>;
|
|
109
110
|
}, import("zod/v4/core").$strip>>;
|
|
@@ -111,7 +112,7 @@ declare const organizationEvents: {
|
|
|
111
112
|
id: string;
|
|
112
113
|
orgId: string;
|
|
113
114
|
userId: string;
|
|
114
|
-
role: "owner" | "admin" | "instructor" | "student";
|
|
115
|
+
role: "owner" | "admin" | "instructor" | "moderator" | "student";
|
|
115
116
|
status: "active" | "invited";
|
|
116
117
|
createdAt: Date;
|
|
117
118
|
updatedAt: Date;
|
|
@@ -119,24 +120,59 @@ declare const organizationEvents: {
|
|
|
119
120
|
id: string;
|
|
120
121
|
orgId: string;
|
|
121
122
|
userId: string;
|
|
122
|
-
role: "owner" | "admin" | "instructor" | "student";
|
|
123
|
+
role: "owner" | "admin" | "instructor" | "moderator" | "student";
|
|
123
124
|
status: "active" | "invited";
|
|
124
125
|
createdAt: unknown;
|
|
125
126
|
updatedAt: unknown;
|
|
126
127
|
}, import("zod").ZodObject<{
|
|
127
128
|
orgId: import("zod").ZodString;
|
|
128
129
|
id: import("zod").ZodString;
|
|
130
|
+
status: import("zod").ZodEnum<{
|
|
131
|
+
active: "active";
|
|
132
|
+
invited: "invited";
|
|
133
|
+
}>;
|
|
129
134
|
createdAt: import("zod").ZodCoercedDate<unknown>;
|
|
130
135
|
updatedAt: import("zod").ZodCoercedDate<unknown>;
|
|
136
|
+
userId: import("zod").ZodString;
|
|
137
|
+
role: import("zod").ZodEnum<{
|
|
138
|
+
owner: "owner";
|
|
139
|
+
admin: "admin";
|
|
140
|
+
instructor: "instructor";
|
|
141
|
+
moderator: "moderator";
|
|
142
|
+
student: "student";
|
|
143
|
+
}>;
|
|
144
|
+
}, import("zod/v4/core").$strip>>;
|
|
145
|
+
orgUserUpdated: RuntimeEventDefinition<VersionedDomainEvent<{
|
|
146
|
+
id: string;
|
|
147
|
+
orgId: string;
|
|
148
|
+
userId: string;
|
|
149
|
+
role: "owner" | "admin" | "instructor" | "moderator" | "student";
|
|
150
|
+
status: "active" | "invited";
|
|
151
|
+
createdAt: Date;
|
|
152
|
+
updatedAt: Date;
|
|
153
|
+
}, "organization.user.updated", 1>, {
|
|
154
|
+
id: string;
|
|
155
|
+
orgId: string;
|
|
156
|
+
userId: string;
|
|
157
|
+
role: "owner" | "admin" | "instructor" | "moderator" | "student";
|
|
158
|
+
status: "active" | "invited";
|
|
159
|
+
createdAt: unknown;
|
|
160
|
+
updatedAt: unknown;
|
|
161
|
+
}, import("zod").ZodObject<{
|
|
162
|
+
orgId: import("zod").ZodString;
|
|
163
|
+
id: import("zod").ZodString;
|
|
131
164
|
status: import("zod").ZodEnum<{
|
|
132
165
|
active: "active";
|
|
133
166
|
invited: "invited";
|
|
134
167
|
}>;
|
|
168
|
+
createdAt: import("zod").ZodCoercedDate<unknown>;
|
|
169
|
+
updatedAt: import("zod").ZodCoercedDate<unknown>;
|
|
135
170
|
userId: import("zod").ZodString;
|
|
136
171
|
role: import("zod").ZodEnum<{
|
|
137
172
|
owner: "owner";
|
|
138
173
|
admin: "admin";
|
|
139
174
|
instructor: "instructor";
|
|
175
|
+
moderator: "moderator";
|
|
140
176
|
student: "student";
|
|
141
177
|
}>;
|
|
142
178
|
}, import("zod/v4/core").$strip>>;
|
|
@@ -144,7 +180,7 @@ declare const organizationEvents: {
|
|
|
144
180
|
id: string;
|
|
145
181
|
orgId: string;
|
|
146
182
|
email: string;
|
|
147
|
-
role: "admin" | "instructor" | "student";
|
|
183
|
+
role: "admin" | "instructor" | "moderator" | "student";
|
|
148
184
|
status: "pending" | "accepted" | "rejected" | "canceled";
|
|
149
185
|
invitedBy: string;
|
|
150
186
|
tokenHash: string | null;
|
|
@@ -155,7 +191,7 @@ declare const organizationEvents: {
|
|
|
155
191
|
id: string;
|
|
156
192
|
orgId: string;
|
|
157
193
|
email: string;
|
|
158
|
-
role: "admin" | "instructor" | "student";
|
|
194
|
+
role: "admin" | "instructor" | "moderator" | "student";
|
|
159
195
|
status: "pending" | "accepted" | "rejected" | "canceled";
|
|
160
196
|
invitedBy: string;
|
|
161
197
|
tokenHash: string | null;
|
|
@@ -165,19 +201,20 @@ declare const organizationEvents: {
|
|
|
165
201
|
}, import("zod").ZodObject<{
|
|
166
202
|
orgId: import("zod").ZodString;
|
|
167
203
|
id: import("zod").ZodString;
|
|
168
|
-
createdAt: import("zod").ZodCoercedDate<unknown>;
|
|
169
|
-
updatedAt: import("zod").ZodCoercedDate<unknown>;
|
|
170
204
|
status: import("zod").ZodEnum<{
|
|
171
205
|
pending: "pending";
|
|
172
206
|
accepted: "accepted";
|
|
173
207
|
rejected: "rejected";
|
|
174
208
|
canceled: "canceled";
|
|
175
209
|
}>;
|
|
210
|
+
createdAt: import("zod").ZodCoercedDate<unknown>;
|
|
211
|
+
updatedAt: import("zod").ZodCoercedDate<unknown>;
|
|
176
212
|
expiresAt: import("zod").ZodNullable<import("zod").ZodCoercedDate<unknown>>;
|
|
177
213
|
email: import("zod").ZodEmail;
|
|
178
214
|
role: import("zod").ZodEnum<{
|
|
179
215
|
admin: "admin";
|
|
180
216
|
instructor: "instructor";
|
|
217
|
+
moderator: "moderator";
|
|
181
218
|
student: "student";
|
|
182
219
|
}>;
|
|
183
220
|
invitedBy: import("zod").ZodString;
|
|
@@ -186,7 +223,7 @@ declare const organizationEvents: {
|
|
|
186
223
|
id: string;
|
|
187
224
|
orgId: string;
|
|
188
225
|
email: string;
|
|
189
|
-
role: "admin" | "instructor" | "student";
|
|
226
|
+
role: "admin" | "instructor" | "moderator" | "student";
|
|
190
227
|
status: "pending" | "accepted" | "rejected" | "canceled";
|
|
191
228
|
invitedBy: string;
|
|
192
229
|
tokenHash: string | null;
|
|
@@ -197,7 +234,7 @@ declare const organizationEvents: {
|
|
|
197
234
|
id: string;
|
|
198
235
|
orgId: string;
|
|
199
236
|
email: string;
|
|
200
|
-
role: "admin" | "instructor" | "student";
|
|
237
|
+
role: "admin" | "instructor" | "moderator" | "student";
|
|
201
238
|
status: "pending" | "accepted" | "rejected" | "canceled";
|
|
202
239
|
invitedBy: string;
|
|
203
240
|
tokenHash: string | null;
|
|
@@ -207,19 +244,20 @@ declare const organizationEvents: {
|
|
|
207
244
|
}, import("zod").ZodObject<{
|
|
208
245
|
orgId: import("zod").ZodString;
|
|
209
246
|
id: import("zod").ZodString;
|
|
210
|
-
createdAt: import("zod").ZodCoercedDate<unknown>;
|
|
211
|
-
updatedAt: import("zod").ZodCoercedDate<unknown>;
|
|
212
247
|
status: import("zod").ZodEnum<{
|
|
213
248
|
pending: "pending";
|
|
214
249
|
accepted: "accepted";
|
|
215
250
|
rejected: "rejected";
|
|
216
251
|
canceled: "canceled";
|
|
217
252
|
}>;
|
|
253
|
+
createdAt: import("zod").ZodCoercedDate<unknown>;
|
|
254
|
+
updatedAt: import("zod").ZodCoercedDate<unknown>;
|
|
218
255
|
expiresAt: import("zod").ZodNullable<import("zod").ZodCoercedDate<unknown>>;
|
|
219
256
|
email: import("zod").ZodEmail;
|
|
220
257
|
role: import("zod").ZodEnum<{
|
|
221
258
|
admin: "admin";
|
|
222
259
|
instructor: "instructor";
|
|
260
|
+
moderator: "moderator";
|
|
223
261
|
student: "student";
|
|
224
262
|
}>;
|
|
225
263
|
invitedBy: import("zod").ZodString;
|
|
@@ -228,7 +266,7 @@ declare const organizationEvents: {
|
|
|
228
266
|
id: string;
|
|
229
267
|
orgId: string;
|
|
230
268
|
email: string;
|
|
231
|
-
role: "admin" | "instructor" | "student";
|
|
269
|
+
role: "admin" | "instructor" | "moderator" | "student";
|
|
232
270
|
status: "pending" | "accepted" | "rejected" | "canceled";
|
|
233
271
|
invitedBy: string;
|
|
234
272
|
tokenHash: string | null;
|
|
@@ -239,7 +277,7 @@ declare const organizationEvents: {
|
|
|
239
277
|
id: string;
|
|
240
278
|
orgId: string;
|
|
241
279
|
email: string;
|
|
242
|
-
role: "admin" | "instructor" | "student";
|
|
280
|
+
role: "admin" | "instructor" | "moderator" | "student";
|
|
243
281
|
status: "pending" | "accepted" | "rejected" | "canceled";
|
|
244
282
|
invitedBy: string;
|
|
245
283
|
tokenHash: string | null;
|
|
@@ -251,7 +289,7 @@ declare const organizationEvents: {
|
|
|
251
289
|
id: string;
|
|
252
290
|
orgId: string;
|
|
253
291
|
userId: string;
|
|
254
|
-
role: "owner" | "admin" | "instructor" | "student";
|
|
292
|
+
role: "owner" | "admin" | "instructor" | "moderator" | "student";
|
|
255
293
|
status: "active" | "invited";
|
|
256
294
|
createdAt: Date;
|
|
257
295
|
updatedAt: Date;
|
|
@@ -259,24 +297,25 @@ declare const organizationEvents: {
|
|
|
259
297
|
id: string;
|
|
260
298
|
orgId: string;
|
|
261
299
|
userId: string;
|
|
262
|
-
role: "owner" | "admin" | "instructor" | "student";
|
|
300
|
+
role: "owner" | "admin" | "instructor" | "moderator" | "student";
|
|
263
301
|
status: "active" | "invited";
|
|
264
302
|
createdAt: unknown;
|
|
265
303
|
updatedAt: unknown;
|
|
266
304
|
}, import("zod").ZodObject<{
|
|
267
305
|
orgId: import("zod").ZodString;
|
|
268
306
|
id: import("zod").ZodString;
|
|
269
|
-
createdAt: import("zod").ZodCoercedDate<unknown>;
|
|
270
|
-
updatedAt: import("zod").ZodCoercedDate<unknown>;
|
|
271
307
|
status: import("zod").ZodEnum<{
|
|
272
308
|
active: "active";
|
|
273
309
|
invited: "invited";
|
|
274
310
|
}>;
|
|
311
|
+
createdAt: import("zod").ZodCoercedDate<unknown>;
|
|
312
|
+
updatedAt: import("zod").ZodCoercedDate<unknown>;
|
|
275
313
|
userId: import("zod").ZodString;
|
|
276
314
|
role: import("zod").ZodEnum<{
|
|
277
315
|
owner: "owner";
|
|
278
316
|
admin: "admin";
|
|
279
317
|
instructor: "instructor";
|
|
318
|
+
moderator: "moderator";
|
|
280
319
|
student: "student";
|
|
281
320
|
}>;
|
|
282
321
|
}, import("zod/v4/core").$strip>>;
|
|
@@ -284,7 +323,7 @@ declare const organizationEvents: {
|
|
|
284
323
|
id: string;
|
|
285
324
|
orgId: string;
|
|
286
325
|
userId: string;
|
|
287
|
-
role: "owner" | "admin" | "instructor" | "student";
|
|
326
|
+
role: "owner" | "admin" | "instructor" | "moderator" | "student";
|
|
288
327
|
status: "active" | "invited";
|
|
289
328
|
createdAt: Date;
|
|
290
329
|
updatedAt: Date;
|
|
@@ -292,24 +331,25 @@ declare const organizationEvents: {
|
|
|
292
331
|
id: string;
|
|
293
332
|
orgId: string;
|
|
294
333
|
userId: string;
|
|
295
|
-
role: "owner" | "admin" | "instructor" | "student";
|
|
334
|
+
role: "owner" | "admin" | "instructor" | "moderator" | "student";
|
|
296
335
|
status: "active" | "invited";
|
|
297
336
|
createdAt: unknown;
|
|
298
337
|
updatedAt: unknown;
|
|
299
338
|
}, import("zod").ZodObject<{
|
|
300
339
|
orgId: import("zod").ZodString;
|
|
301
340
|
id: import("zod").ZodString;
|
|
302
|
-
createdAt: import("zod").ZodCoercedDate<unknown>;
|
|
303
|
-
updatedAt: import("zod").ZodCoercedDate<unknown>;
|
|
304
341
|
status: import("zod").ZodEnum<{
|
|
305
342
|
active: "active";
|
|
306
343
|
invited: "invited";
|
|
307
344
|
}>;
|
|
345
|
+
createdAt: import("zod").ZodCoercedDate<unknown>;
|
|
346
|
+
updatedAt: import("zod").ZodCoercedDate<unknown>;
|
|
308
347
|
userId: import("zod").ZodString;
|
|
309
348
|
role: import("zod").ZodEnum<{
|
|
310
349
|
owner: "owner";
|
|
311
350
|
admin: "admin";
|
|
312
351
|
instructor: "instructor";
|
|
352
|
+
moderator: "moderator";
|
|
313
353
|
student: "student";
|
|
314
354
|
}>;
|
|
315
355
|
}, import("zod/v4/core").$strip>>;
|
|
@@ -317,7 +357,7 @@ declare const organizationEvents: {
|
|
|
317
357
|
id: string;
|
|
318
358
|
orgId: string;
|
|
319
359
|
userId: string;
|
|
320
|
-
role: "owner" | "admin" | "instructor" | "student";
|
|
360
|
+
role: "owner" | "admin" | "instructor" | "moderator" | "student";
|
|
321
361
|
status: "active" | "invited";
|
|
322
362
|
createdAt: Date;
|
|
323
363
|
updatedAt: Date;
|
|
@@ -325,24 +365,25 @@ declare const organizationEvents: {
|
|
|
325
365
|
id: string;
|
|
326
366
|
orgId: string;
|
|
327
367
|
userId: string;
|
|
328
|
-
role: "owner" | "admin" | "instructor" | "student";
|
|
368
|
+
role: "owner" | "admin" | "instructor" | "moderator" | "student";
|
|
329
369
|
status: "active" | "invited";
|
|
330
370
|
createdAt: unknown;
|
|
331
371
|
updatedAt: unknown;
|
|
332
372
|
}, import("zod").ZodObject<{
|
|
333
373
|
orgId: import("zod").ZodString;
|
|
334
374
|
id: import("zod").ZodString;
|
|
335
|
-
createdAt: import("zod").ZodCoercedDate<unknown>;
|
|
336
|
-
updatedAt: import("zod").ZodCoercedDate<unknown>;
|
|
337
375
|
status: import("zod").ZodEnum<{
|
|
338
376
|
active: "active";
|
|
339
377
|
invited: "invited";
|
|
340
378
|
}>;
|
|
379
|
+
createdAt: import("zod").ZodCoercedDate<unknown>;
|
|
380
|
+
updatedAt: import("zod").ZodCoercedDate<unknown>;
|
|
341
381
|
userId: import("zod").ZodString;
|
|
342
382
|
role: import("zod").ZodEnum<{
|
|
343
383
|
owner: "owner";
|
|
344
384
|
admin: "admin";
|
|
345
385
|
instructor: "instructor";
|
|
386
|
+
moderator: "moderator";
|
|
346
387
|
student: "student";
|
|
347
388
|
}>;
|
|
348
389
|
}, import("zod/v4/core").$strip>>;
|
|
@@ -352,6 +393,7 @@ type OrganizationUpdated = EventOf<typeof organizationEvents.organizationUpdated
|
|
|
352
393
|
type OrganizationDeleted = EventOf<typeof organizationEvents.organizationDeleted>;
|
|
353
394
|
type OrgUserLinked = EventOf<typeof organizationEvents.orgUserLinked>;
|
|
354
395
|
type OrgUserDeleted = EventOf<typeof organizationEvents.orgUserDeleted>;
|
|
396
|
+
type OrgUserUpdated = EventOf<typeof organizationEvents.orgUserUpdated>;
|
|
355
397
|
type InviteCreated = EventOf<typeof organizationEvents.inviteCreated>;
|
|
356
398
|
type InviteAccepted = EventOf<typeof organizationEvents.inviteAccepted>;
|
|
357
399
|
type InviteCanceled = EventOf<typeof organizationEvents.inviteCanceled>;
|
|
@@ -360,5 +402,5 @@ type StudentDeleted = EventOf<typeof organizationEvents.studentDeleted>;
|
|
|
360
402
|
type StudentLinked = EventOf<typeof organizationEvents.studentLinked>;
|
|
361
403
|
type OrganizationEvent = EventOfValues<typeof organizationEvents>;
|
|
362
404
|
//#endregion
|
|
363
|
-
export { InviteAccepted, InviteCanceled, InviteCreated, OrgUserDeleted, OrgUserLinked, OrganizationCreated, OrganizationDeleted, OrganizationEvent, OrganizationUpdated, StudentCreated, StudentDeleted, StudentLinked, organizationEvents };
|
|
405
|
+
export { InviteAccepted, InviteCanceled, InviteCreated, OrgUserDeleted, OrgUserLinked, OrgUserUpdated, OrganizationCreated, OrganizationDeleted, OrganizationEvent, OrganizationUpdated, StudentCreated, StudentDeleted, StudentLinked, organizationEvents };
|
|
364
406
|
//# sourceMappingURL=events.d.ts.map
|
|
@@ -60,6 +60,12 @@ const organizationEvents = {
|
|
|
60
60
|
data: orgUserSchema,
|
|
61
61
|
publicData: publicOrgUser
|
|
62
62
|
}),
|
|
63
|
+
orgUserUpdated: defineEvent({
|
|
64
|
+
type: "organization.user.updated",
|
|
65
|
+
version: 1,
|
|
66
|
+
data: orgUserSchema,
|
|
67
|
+
publicData: publicOrgUser
|
|
68
|
+
}),
|
|
63
69
|
inviteCreated: defineEvent({
|
|
64
70
|
type: "organization.invite.created",
|
|
65
71
|
version: 1,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","names":[],"sources":["../../src/organizations/events.ts"],"sourcesContent":["import { inviteSchema, organizationSchema, orgUserSchema } from '../types/schemas/index.js';\nimport { defineEvent, type EventOf, type EventOfValues } from '../shared/ports.js';\n\nconst publicOrganization = organizationSchema\n .pick({\n id: true,\n name: true,\n slug: true,\n ownerId: true,\n createdAt: true,\n updatedAt: true,\n })\n .strip();\n\nconst publicOrgUser = orgUserSchema\n .pick({\n id: true,\n orgId: true,\n userId: true,\n role: true,\n status: true,\n createdAt: true,\n updatedAt: true,\n })\n .strip();\n\nconst publicInvite = inviteSchema\n .pick({\n id: true,\n orgId: true,\n email: true,\n role: true,\n status: true,\n invitedBy: true,\n expiresAt: true,\n createdAt: true,\n updatedAt: true,\n })\n .strip();\n\nexport const organizationEvents = {\n organizationCreated: defineEvent({\n type: 'organization.created',\n version: 1,\n data: organizationSchema,\n publicData: publicOrganization,\n }),\n organizationUpdated: defineEvent({\n type: 'organization.updated',\n version: 1,\n data: organizationSchema,\n publicData: publicOrganization,\n }),\n organizationDeleted: defineEvent({\n type: 'organization.deleted',\n version: 1,\n data: organizationSchema,\n publicData: publicOrganization,\n }),\n orgUserLinked: defineEvent({\n type: 'organization.user.linked',\n version: 1,\n data: orgUserSchema,\n publicData: publicOrgUser,\n }),\n orgUserDeleted: defineEvent({\n type: 'organization.user.deleted',\n version: 1,\n data: orgUserSchema,\n publicData: publicOrgUser,\n }),\n inviteCreated: defineEvent({\n type: 'organization.invite.created',\n version: 1,\n data: inviteSchema,\n publicData: publicInvite,\n }),\n inviteAccepted: defineEvent({\n type: 'organization.invite.accepted',\n version: 1,\n data: inviteSchema,\n publicData: publicInvite,\n }),\n inviteCanceled: defineEvent({\n type: 'organization.invite.canceled',\n version: 1,\n data: inviteSchema,\n }),\n studentCreated: defineEvent({\n type: 'organization.student.created',\n version: 1,\n data: orgUserSchema,\n publicData: publicOrgUser,\n }),\n studentDeleted: defineEvent({\n type: 'organization.student.deleted',\n version: 1,\n data: orgUserSchema,\n publicData: publicOrgUser,\n }),\n studentLinked: defineEvent({\n type: 'organization.student.linked',\n version: 1,\n data: orgUserSchema,\n publicData: publicOrgUser,\n }),\n};\n\nexport type OrganizationCreated = EventOf<typeof organizationEvents.organizationCreated>;\nexport type OrganizationUpdated = EventOf<typeof organizationEvents.organizationUpdated>;\nexport type OrganizationDeleted = EventOf<typeof organizationEvents.organizationDeleted>;\nexport type OrgUserLinked = EventOf<typeof organizationEvents.orgUserLinked>;\nexport type OrgUserDeleted = EventOf<typeof organizationEvents.orgUserDeleted>;\nexport type InviteCreated = EventOf<typeof organizationEvents.inviteCreated>;\nexport type InviteAccepted = EventOf<typeof organizationEvents.inviteAccepted>;\nexport type InviteCanceled = EventOf<typeof organizationEvents.inviteCanceled>;\nexport type StudentCreated = EventOf<typeof organizationEvents.studentCreated>;\nexport type StudentDeleted = EventOf<typeof organizationEvents.studentDeleted>;\nexport type StudentLinked = EventOf<typeof organizationEvents.studentLinked>;\nexport type OrganizationEvent = EventOfValues<typeof organizationEvents>;\n"],"mappings":";;;AAGA,MAAM,qBAAqB,mBACxB,KAAK;CACJ,IAAI;CACJ,MAAM;CACN,MAAM;CACN,SAAS;CACT,WAAW;CACX,WAAW;AACb,CAAC,CAAC,CACD,MAAM;AAET,MAAM,gBAAgB,cACnB,KAAK;CACJ,IAAI;CACJ,OAAO;CACP,QAAQ;CACR,MAAM;CACN,QAAQ;CACR,WAAW;CACX,WAAW;AACb,CAAC,CAAC,CACD,MAAM;AAET,MAAM,eAAe,aAClB,KAAK;CACJ,IAAI;CACJ,OAAO;CACP,OAAO;CACP,MAAM;CACN,QAAQ;CACR,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;AACb,CAAC,CAAC,CACD,MAAM;AAET,MAAa,qBAAqB;CAChC,qBAAqB,YAAY;EAC/B,MAAM;EACN,SAAS;EACT,MAAM;EACN,YAAY;CACd,CAAC;CACD,qBAAqB,YAAY;EAC/B,MAAM;EACN,SAAS;EACT,MAAM;EACN,YAAY;CACd,CAAC;CACD,qBAAqB,YAAY;EAC/B,MAAM;EACN,SAAS;EACT,MAAM;EACN,YAAY;CACd,CAAC;CACD,eAAe,YAAY;EACzB,MAAM;EACN,SAAS;EACT,MAAM;EACN,YAAY;CACd,CAAC;CACD,gBAAgB,YAAY;EAC1B,MAAM;EACN,SAAS;EACT,MAAM;EACN,YAAY;CACd,CAAC;CACD,eAAe,YAAY;EACzB,MAAM;EACN,SAAS;EACT,MAAM;EACN,YAAY;CACd,CAAC;CACD,gBAAgB,YAAY;EAC1B,MAAM;EACN,SAAS;EACT,MAAM;EACN,YAAY;CACd,CAAC;CACD,gBAAgB,YAAY;EAC1B,MAAM;EACN,SAAS;EACT,MAAM;CACR,CAAC;CACD,gBAAgB,YAAY;EAC1B,MAAM;EACN,SAAS;EACT,MAAM;EACN,YAAY;CACd,CAAC;CACD,gBAAgB,YAAY;EAC1B,MAAM;EACN,SAAS;EACT,MAAM;EACN,YAAY;CACd,CAAC;CACD,eAAe,YAAY;EACzB,MAAM;EACN,SAAS;EACT,MAAM;EACN,YAAY;CACd,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"events.js","names":[],"sources":["../../src/organizations/events.ts"],"sourcesContent":["import { inviteSchema, organizationSchema, orgUserSchema } from '../types/schemas/index.js';\nimport { defineEvent, type EventOf, type EventOfValues } from '../shared/ports.js';\n\nconst publicOrganization = organizationSchema\n .pick({\n id: true,\n name: true,\n slug: true,\n ownerId: true,\n createdAt: true,\n updatedAt: true,\n })\n .strip();\n\nconst publicOrgUser = orgUserSchema\n .pick({\n id: true,\n orgId: true,\n userId: true,\n role: true,\n status: true,\n createdAt: true,\n updatedAt: true,\n })\n .strip();\n\nconst publicInvite = inviteSchema\n .pick({\n id: true,\n orgId: true,\n email: true,\n role: true,\n status: true,\n invitedBy: true,\n expiresAt: true,\n createdAt: true,\n updatedAt: true,\n })\n .strip();\n\nexport const organizationEvents = {\n organizationCreated: defineEvent({\n type: 'organization.created',\n version: 1,\n data: organizationSchema,\n publicData: publicOrganization,\n }),\n organizationUpdated: defineEvent({\n type: 'organization.updated',\n version: 1,\n data: organizationSchema,\n publicData: publicOrganization,\n }),\n organizationDeleted: defineEvent({\n type: 'organization.deleted',\n version: 1,\n data: organizationSchema,\n publicData: publicOrganization,\n }),\n orgUserLinked: defineEvent({\n type: 'organization.user.linked',\n version: 1,\n data: orgUserSchema,\n publicData: publicOrgUser,\n }),\n orgUserDeleted: defineEvent({\n type: 'organization.user.deleted',\n version: 1,\n data: orgUserSchema,\n publicData: publicOrgUser,\n }),\n orgUserUpdated: defineEvent({\n type: 'organization.user.updated',\n version: 1,\n data: orgUserSchema,\n publicData: publicOrgUser,\n }),\n inviteCreated: defineEvent({\n type: 'organization.invite.created',\n version: 1,\n data: inviteSchema,\n publicData: publicInvite,\n }),\n inviteAccepted: defineEvent({\n type: 'organization.invite.accepted',\n version: 1,\n data: inviteSchema,\n publicData: publicInvite,\n }),\n inviteCanceled: defineEvent({\n type: 'organization.invite.canceled',\n version: 1,\n data: inviteSchema,\n }),\n studentCreated: defineEvent({\n type: 'organization.student.created',\n version: 1,\n data: orgUserSchema,\n publicData: publicOrgUser,\n }),\n studentDeleted: defineEvent({\n type: 'organization.student.deleted',\n version: 1,\n data: orgUserSchema,\n publicData: publicOrgUser,\n }),\n studentLinked: defineEvent({\n type: 'organization.student.linked',\n version: 1,\n data: orgUserSchema,\n publicData: publicOrgUser,\n }),\n};\n\nexport type OrganizationCreated = EventOf<typeof organizationEvents.organizationCreated>;\nexport type OrganizationUpdated = EventOf<typeof organizationEvents.organizationUpdated>;\nexport type OrganizationDeleted = EventOf<typeof organizationEvents.organizationDeleted>;\nexport type OrgUserLinked = EventOf<typeof organizationEvents.orgUserLinked>;\nexport type OrgUserDeleted = EventOf<typeof organizationEvents.orgUserDeleted>;\nexport type OrgUserUpdated = EventOf<typeof organizationEvents.orgUserUpdated>;\nexport type InviteCreated = EventOf<typeof organizationEvents.inviteCreated>;\nexport type InviteAccepted = EventOf<typeof organizationEvents.inviteAccepted>;\nexport type InviteCanceled = EventOf<typeof organizationEvents.inviteCanceled>;\nexport type StudentCreated = EventOf<typeof organizationEvents.studentCreated>;\nexport type StudentDeleted = EventOf<typeof organizationEvents.studentDeleted>;\nexport type StudentLinked = EventOf<typeof organizationEvents.studentLinked>;\nexport type OrganizationEvent = EventOfValues<typeof organizationEvents>;\n"],"mappings":";;;AAGA,MAAM,qBAAqB,mBACxB,KAAK;CACJ,IAAI;CACJ,MAAM;CACN,MAAM;CACN,SAAS;CACT,WAAW;CACX,WAAW;AACb,CAAC,CAAC,CACD,MAAM;AAET,MAAM,gBAAgB,cACnB,KAAK;CACJ,IAAI;CACJ,OAAO;CACP,QAAQ;CACR,MAAM;CACN,QAAQ;CACR,WAAW;CACX,WAAW;AACb,CAAC,CAAC,CACD,MAAM;AAET,MAAM,eAAe,aAClB,KAAK;CACJ,IAAI;CACJ,OAAO;CACP,OAAO;CACP,MAAM;CACN,QAAQ;CACR,WAAW;CACX,WAAW;CACX,WAAW;CACX,WAAW;AACb,CAAC,CAAC,CACD,MAAM;AAET,MAAa,qBAAqB;CAChC,qBAAqB,YAAY;EAC/B,MAAM;EACN,SAAS;EACT,MAAM;EACN,YAAY;CACd,CAAC;CACD,qBAAqB,YAAY;EAC/B,MAAM;EACN,SAAS;EACT,MAAM;EACN,YAAY;CACd,CAAC;CACD,qBAAqB,YAAY;EAC/B,MAAM;EACN,SAAS;EACT,MAAM;EACN,YAAY;CACd,CAAC;CACD,eAAe,YAAY;EACzB,MAAM;EACN,SAAS;EACT,MAAM;EACN,YAAY;CACd,CAAC;CACD,gBAAgB,YAAY;EAC1B,MAAM;EACN,SAAS;EACT,MAAM;EACN,YAAY;CACd,CAAC;CACD,gBAAgB,YAAY;EAC1B,MAAM;EACN,SAAS;EACT,MAAM;EACN,YAAY;CACd,CAAC;CACD,eAAe,YAAY;EACzB,MAAM;EACN,SAAS;EACT,MAAM;EACN,YAAY;CACd,CAAC;CACD,gBAAgB,YAAY;EAC1B,MAAM;EACN,SAAS;EACT,MAAM;EACN,YAAY;CACd,CAAC;CACD,gBAAgB,YAAY;EAC1B,MAAM;EACN,SAAS;EACT,MAAM;CACR,CAAC;CACD,gBAAgB,YAAY;EAC1B,MAAM;EACN,SAAS;EACT,MAAM;EACN,YAAY;CACd,CAAC;CACD,gBAAgB,YAAY;EAC1B,MAAM;EACN,SAAS;EACT,MAAM;EACN,YAAY;CACd,CAAC;CACD,eAAe,YAAY;EACzB,MAAM;EACN,SAAS;EACT,MAAM;EACN,YAAY;CACd,CAAC;AACH"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { AcceptInviteInput, AddOrgUserInput, CreateInviteInput, CreateOrgUserInput, Invite, InviteRole, NewOrganizationInput, OrgUser, OrgUserStatus, Organization, Role, UpdateOrgUserInput } from "../types/schemas/organizations.js";
|
|
2
2
|
import { InviteId, OrgUserId, OrganizationId } from "../types/organizations.js";
|
|
3
|
-
import { AuthHeaders } from "../identity/ports.js";
|
|
4
|
-
import { InviteAccepted, InviteCanceled, InviteCreated, OrgUserDeleted, OrgUserLinked, OrganizationCreated, OrganizationDeleted, OrganizationEvent, OrganizationUpdated, StudentCreated, StudentDeleted, StudentLinked, organizationEvents } from "./events.js";
|
|
5
3
|
import "./model.js";
|
|
6
|
-
import { Capability, Permission, ROLES, STAFF_ROLES, STUDENT_ROLE, StaffRole, capability, isRole, isStaffRole, normalizeRole, parseRole } from "./roles.js";
|
|
7
|
-
import { Member, MemberStatus, MembersQuery, OrganizationRuleError, Page } from "./members.js";
|
|
8
|
-
import { CreateOrganizationInput, LinkOrgUserInput, ResendStudentInviteInput, UnlinkOrgUserInput, UpdateOrganizationInput
|
|
4
|
+
import { Capability, Permission, ROLES, STAFF_ROLES, STUDENT_ROLE, StaffRole, TeamRole, canModerate, capability, isRole, isStaffRole, normalizeRole, parseRole } from "./roles.js";
|
|
5
|
+
import { InviteError, Member, MemberRoleChange, MemberStatus, MembersQuery, OrganizationRuleError, Page } from "./members.js";
|
|
6
|
+
import { CreateOrganizationInput, LinkOrgUserInput, ResendStudentInviteInput, UnlinkOrgUserInput, UpdateOrganizationInput } from "./types.js";
|
|
7
|
+
import { AuthHeaders } from "../identity/ports.js";
|
|
9
8
|
import { AuthOrganization, MemberRecord, MemberWriteContext, MembersRepository, NewInviteRow, NewOrganizationRow, OrgAdmin, OrganizationService, OrganizationsRepository } from "./ports.js";
|
|
10
9
|
import { OrganizationServiceImpl } from "./service.js";
|
|
11
|
-
|
|
10
|
+
import { InviteAccepted, InviteCanceled, InviteCreated, OrgUserDeleted, OrgUserLinked, OrgUserUpdated, OrganizationCreated, OrganizationDeleted, OrganizationEvent, OrganizationUpdated, StudentCreated, StudentDeleted, StudentLinked, organizationEvents } from "./events.js";
|
|
11
|
+
import { ACCESS_SCOPES, AccessScope, SCOPE_PERMISSION, ScopeOption, assertRoleHoldsScopes, isAccessScope, isDeleteScope, roleHoldsScope, scopeOptions, scopesForRole } from "./access-scopes.js";
|
|
12
|
+
export { ACCESS_SCOPES, type AcceptInviteInput, AccessScope, type AddOrgUserInput, type AuthHeaders, type AuthOrganization, type Capability, type CreateInviteInput, type CreateOrgUserInput, type CreateOrganizationInput, type Invite, type InviteAccepted, type InviteCanceled, type InviteCreated, InviteError, type InviteId, type InviteRole, type LinkOrgUserInput, type Member, type MemberRecord, type MemberRoleChange, type MemberStatus, type MemberWriteContext, type MembersQuery, type MembersRepository, type NewInviteRow, type NewOrganizationInput, type NewOrganizationRow, type OrgAdmin, type OrgUser, type OrgUserDeleted, type OrgUserId, type OrgUserLinked, type OrgUserStatus, type OrgUserUpdated, type Organization, type OrganizationCreated, type OrganizationDeleted, type OrganizationEvent, type OrganizationId, OrganizationRuleError, type OrganizationService, OrganizationServiceImpl, type OrganizationUpdated, type OrganizationsRepository, type Page, type Permission, ROLES, type ResendStudentInviteInput, type Role, SCOPE_PERMISSION, STAFF_ROLES, STUDENT_ROLE, ScopeOption, type StaffRole, type StudentCreated, type StudentDeleted, type StudentLinked, type TeamRole, type UnlinkOrgUserInput, type UpdateOrgUserInput, type UpdateOrganizationInput, assertRoleHoldsScopes, canModerate, capability, isAccessScope, isDeleteScope, isRole, isStaffRole, normalizeRole, organizationEvents, parseRole, roleHoldsScope, scopeOptions, scopesForRole };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { ROLES, STAFF_ROLES, STUDENT_ROLE, capability, isRole, isStaffRole, normalizeRole, parseRole } from "./roles.js";
|
|
2
|
-
import { OrganizationRuleError } from "./members.js";
|
|
1
|
+
import { ROLES, STAFF_ROLES, STUDENT_ROLE, canModerate, capability, isRole, isStaffRole, normalizeRole, parseRole } from "./roles.js";
|
|
2
|
+
import { InviteError, OrganizationRuleError } from "./members.js";
|
|
3
3
|
import { organizationEvents } from "./events.js";
|
|
4
4
|
import { OrganizationServiceImpl } from "./service.js";
|
|
5
|
-
|
|
5
|
+
import { ACCESS_SCOPES, SCOPE_PERMISSION, assertRoleHoldsScopes, isAccessScope, isDeleteScope, roleHoldsScope, scopeOptions, scopesForRole } from "./access-scopes.js";
|
|
6
|
+
export { ACCESS_SCOPES, InviteError, OrganizationRuleError, OrganizationServiceImpl, ROLES, SCOPE_PERMISSION, STAFF_ROLES, STUDENT_ROLE, assertRoleHoldsScopes, canModerate, capability, isAccessScope, isDeleteScope, isRole, isStaffRole, normalizeRole, organizationEvents, parseRole, roleHoldsScope, scopeOptions, scopesForRole };
|
|
@@ -1,20 +1,23 @@
|
|
|
1
|
-
import { OrgUserProfile } from "../types/schemas/organizations.js";
|
|
1
|
+
import { OrgUserProfile, Role } from "../types/schemas/organizations.js";
|
|
2
2
|
import "../types/index.js";
|
|
3
|
-
import {
|
|
3
|
+
import { TeamRole } from "./roles.js";
|
|
4
4
|
//#region src/organizations/members.d.ts
|
|
5
5
|
type MemberStatus = 'active' | 'invited';
|
|
6
6
|
interface Member extends OrgUserProfile {
|
|
7
|
-
role:
|
|
7
|
+
role: TeamRole;
|
|
8
8
|
status: MemberStatus;
|
|
9
9
|
joinedAt: string | null;
|
|
10
10
|
invitedAt: string | null;
|
|
11
11
|
}
|
|
12
|
+
interface MemberRoleChange extends Omit<Member, 'role'> {
|
|
13
|
+
role: Role;
|
|
14
|
+
}
|
|
12
15
|
interface MembersQuery {
|
|
13
16
|
page: number;
|
|
14
17
|
pageSize: number;
|
|
15
18
|
search?: string | undefined;
|
|
16
19
|
sort?: string | undefined;
|
|
17
|
-
role?:
|
|
20
|
+
role?: TeamRole | undefined;
|
|
18
21
|
status?: MemberStatus | undefined;
|
|
19
22
|
}
|
|
20
23
|
interface Page<T> {
|
|
@@ -28,5 +31,5 @@ declare class InviteError extends Error {
|
|
|
28
31
|
constructor(message: string);
|
|
29
32
|
}
|
|
30
33
|
//#endregion
|
|
31
|
-
export { InviteError, Member, MemberStatus, MembersQuery, OrganizationRuleError, Page };
|
|
34
|
+
export { InviteError, Member, MemberRoleChange, MemberStatus, MembersQuery, OrganizationRuleError, Page };
|
|
32
35
|
//# sourceMappingURL=members.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"members.js","names":[],"sources":["../../src/organizations/members.ts"],"sourcesContent":["// organizations context — member-management types (invite / change-role / remove).\n// The operational surface over the org's members and pending invites. Roles\n// come from ./roles.ts (the single role model); writes go through Better Auth.\nimport type {
|
|
1
|
+
{"version":3,"file":"members.js","names":[],"sources":["../../src/organizations/members.ts"],"sourcesContent":["// organizations context — member-management types (invite / change-role / remove).\n// The operational surface over the org's members and pending invites. Roles\n// come from ./roles.ts (the single role model); writes go through Better Auth.\nimport type { Role, TeamRole } from './roles.js';\nimport type { OrgUserProfile } from '../types/index.js';\n\nexport type MemberStatus = 'active' | 'invited';\n\nexport interface Member extends OrgUserProfile {\n role: TeamRole;\n status: MemberStatus;\n joinedAt: string | null;\n invitedAt: string | null;\n}\n\nexport interface MemberRoleChange extends Omit<Member, 'role'> {\n role: Role;\n}\n\nexport interface MembersQuery {\n page: number;\n pageSize: number;\n search?: string | undefined;\n sort?: string | undefined;\n role?: TeamRole | undefined;\n status?: MemberStatus | undefined;\n}\n\nexport interface Page<T> {\n rows: T[];\n total: number;\n page: number;\n pageSize: number;\n}\n\nexport class OrganizationRuleError extends Error {}\nexport class InviteError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'InviteError';\n }\n}\n"],"mappings":";AAmCA,IAAa,wBAAb,cAA2C,MAAM,CAAC;AAClD,IAAa,cAAb,cAAiC,MAAM;CACrC,YAAY,SAAiB;EAC3B,MAAM,OAAO;EACb,KAAK,OAAO;CACd;AACF"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { AcceptInviteInput, AddOrgUserInput, CreateInviteInput, CreateOrgUserInput, Invite, InviteRole, NewOrganizationInput, OrgUser, Organization, Role, UpdateOrgUserInput } from "../types/schemas/organizations.js";
|
|
2
2
|
import { OutboxAppender, UnitOfWork } from "../shared/ports.js";
|
|
3
|
-
import {
|
|
4
|
-
import "../identity/index.js";
|
|
3
|
+
import { Actor } from "../shared/actor.js";
|
|
5
4
|
import "./model.js";
|
|
6
5
|
import "./roles.js";
|
|
7
|
-
import { Member, MembersQuery, Page } from "./members.js";
|
|
8
|
-
import { CreateOrganizationInput, ResendStudentInviteInput, UpdateOrganizationInput
|
|
6
|
+
import { Member, MemberRoleChange, MembersQuery, Page } from "./members.js";
|
|
7
|
+
import { CreateOrganizationInput, ResendStudentInviteInput, UpdateOrganizationInput } from "./types.js";
|
|
8
|
+
import { AuthHeaders } from "../identity/ports.js";
|
|
9
|
+
import "../identity/index.js";
|
|
9
10
|
//#region src/organizations/ports.d.ts
|
|
10
11
|
interface OrganizationService {
|
|
11
12
|
createOrganization(input: CreateOrganizationInput): Promise<Organization>;
|
|
@@ -16,18 +17,19 @@ interface OrganizationService {
|
|
|
16
17
|
updateOrgUser(orgId: string, userId: string, patch: UpdateOrgUserInput): Promise<OrgUser>;
|
|
17
18
|
getByExternalId(externalId: string): Promise<Organization | null>;
|
|
18
19
|
getOrgUser(orgId: string, userId: string): Promise<OrgUser | null>;
|
|
20
|
+
getOrgUserById(orgId: string, id: string): Promise<OrgUser | null>;
|
|
19
21
|
getOrgUsersForUser(userId: string): Promise<OrgUser[]>;
|
|
20
22
|
getById(id: string): Promise<Organization | null>;
|
|
21
|
-
createInvite(input: CreateInviteInput): Promise<Invite>;
|
|
23
|
+
createInvite(actor: Actor, input: CreateInviteInput): Promise<Invite>;
|
|
22
24
|
peekInvite(token: string): Promise<Invite | null>;
|
|
23
25
|
acceptInvite(input: AcceptInviteInput): Promise<OrgUser>;
|
|
24
|
-
deleteOrgUser(orgId: string, id: string): Promise<OrgUser>;
|
|
25
|
-
resendStudentInvite(input: ResendStudentInviteInput): Promise<void>;
|
|
26
|
-
updateStudent(input: UpdateStudentInput): Promise<OrgUser>;
|
|
26
|
+
deleteOrgUser(orgId: string, actor: Actor, id: string): Promise<OrgUser>;
|
|
27
|
+
resendStudentInvite(actor: Actor, input: ResendStudentInviteInput): Promise<void>;
|
|
27
28
|
getBySlug(slug: string): Promise<Organization | null>;
|
|
28
29
|
listMembers(orgId: string, query: MembersQuery): Promise<Page<Member>>;
|
|
29
|
-
updateMemberRole(ctx: MemberWriteContext, id: string, role: Role): Promise<
|
|
30
|
-
removeMember(ctx: MemberWriteContext, id: string): Promise<boolean>;
|
|
30
|
+
updateMemberRole(ctx: MemberWriteContext, actor: Actor, id: string, role: Role): Promise<MemberRoleChange | null>;
|
|
31
|
+
removeMember(ctx: MemberWriteContext, actor: Actor, id: string): Promise<boolean>;
|
|
32
|
+
staffOrgUserIds(orgId: string): Promise<string[]>;
|
|
31
33
|
}
|
|
32
34
|
/** Atomic write scope: tx-bound repo + outbox appender, one transaction. */
|
|
33
35
|
interface OrganizationsWriteScope {
|
|
@@ -72,6 +74,8 @@ interface OrganizationsRepository {
|
|
|
72
74
|
/** Every org this person belongs to, oldest first. */
|
|
73
75
|
findOrgUsersByUser(userId: string): Promise<OrgUser[]>;
|
|
74
76
|
findOrgUserById(orgId: string, id: string): Promise<OrgUser | null>;
|
|
77
|
+
findOrgUsersByIds(orgId: string, ids: string[]): Promise<OrgUser[]>;
|
|
78
|
+
findOrgUserIdsByRole(orgId: string, roles: Role[]): Promise<string[]>;
|
|
75
79
|
/** Links a user to the org under a role. Throws ConflictError when they
|
|
76
80
|
* already hold a row there. */
|
|
77
81
|
createOrgUser(input: CreateOrgUserInput): Promise<OrgUser>;
|
|
@@ -79,7 +83,6 @@ interface OrganizationsRepository {
|
|
|
79
83
|
/** Every org this person is a student in — the scope of `student.linked`. */
|
|
80
84
|
findStudentOrgUsers(userId: string): Promise<OrgUser[]>;
|
|
81
85
|
/** Kills the org's pending invite for an address, if any. */
|
|
82
|
-
cancelPendingInvite(orgId: string, email: string): Promise<Invite | null>;
|
|
83
86
|
deleteOrgUser(orgId: string, id: string): Promise<OrgUser | null>;
|
|
84
87
|
}
|
|
85
88
|
/** A member row enriched with the ids needed to drive writes. */
|