@headless-lms/core 0.4.0 → 0.6.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 +15 -9
- package/dist/assets/file-urls.d.ts +14 -7
- package/dist/assets/file-urls.js +15 -4
- package/dist/assets/file-urls.js.map +1 -1
- package/dist/assets/index.d.ts +4 -4
- package/dist/assets/index.js +3 -3
- package/dist/assets/ports.d.ts +34 -15
- package/dist/assets/service.d.ts +30 -14
- package/dist/assets/service.js +233 -54
- package/dist/assets/service.js.map +1 -1
- package/dist/automations/actions.js.map +1 -1
- package/dist/automations/catalog.js +68 -3
- package/dist/automations/catalog.js.map +1 -1
- package/dist/automations/community-derivations.js +16 -16
- package/dist/automations/community-derivations.js.map +1 -1
- package/dist/automations/community-mail.d.ts +34 -4
- package/dist/automations/community-mail.js +32 -4
- package/dist/automations/community-mail.js.map +1 -1
- package/dist/automations/event-permissions.d.ts +12 -0
- package/dist/automations/event-permissions.js +38 -0
- package/dist/automations/event-permissions.js.map +1 -0
- package/dist/automations/index.d.ts +2 -1
- package/dist/automations/index.js +2 -1
- package/dist/automations/notifications/applicable.d.ts +8 -0
- package/dist/automations/notifications/applicable.js +12 -0
- package/dist/automations/notifications/applicable.js.map +1 -0
- package/dist/automations/notifications/debounce.js +1 -1
- package/dist/automations/notifications/debounce.js.map +1 -1
- package/dist/automations/notifications/defaults.js +33 -3
- package/dist/automations/notifications/defaults.js.map +1 -1
- package/dist/automations/notifications/processor.js +1 -1
- package/dist/automations/notifications/processor.js.map +1 -1
- package/dist/automations/notifications/rules/content.js +60 -3
- package/dist/automations/notifications/rules/content.js.map +1 -1
- package/dist/automations/notifications/rules/discussion.js +29 -29
- package/dist/automations/notifications/rules/discussion.js.map +1 -1
- package/dist/automations/notifications/rules/entitlements.js +36 -9
- package/dist/automations/notifications/rules/entitlements.js.map +1 -1
- package/dist/automations/notifications/rules/events.d.ts +9 -0
- package/dist/automations/notifications/rules/events.js +27 -0
- package/dist/automations/notifications/rules/events.js.map +1 -0
- package/dist/automations/notifications/rules/organizations.js +17 -10
- package/dist/automations/notifications/rules/organizations.js.map +1 -1
- package/dist/automations/notifications/rules/recipients.js +0 -1
- package/dist/automations/notifications/rules/recipients.js.map +1 -1
- package/dist/automations/notifications/service.d.ts +8 -6
- package/dist/automations/notifications/service.js +12 -12
- package/dist/automations/notifications/service.js.map +1 -1
- package/dist/automations/notifications/types.js +94 -7
- package/dist/automations/notifications/types.js.map +1 -1
- package/dist/automations/ports.d.ts +30 -31
- package/dist/automations/service.d.ts +20 -17
- package/dist/automations/service.js +90 -61
- package/dist/automations/service.js.map +1 -1
- package/dist/content/event-sight.d.ts +11 -0
- package/dist/content/event-sight.js +11 -0
- package/dist/content/event-sight.js.map +1 -0
- package/dist/content/events.d.ts +465 -88
- package/dist/content/events.js +34 -1
- package/dist/content/events.js.map +1 -1
- package/dist/content/index.d.ts +6 -4
- package/dist/content/index.js +3 -1
- package/dist/content/jobs.d.ts +16 -0
- package/dist/content/jobs.js +37 -0
- package/dist/content/jobs.js.map +1 -0
- package/dist/content/model.d.ts +2 -2
- package/dist/content/notification-categories.d.ts +5 -4
- package/dist/content/notification-categories.js +15 -6
- package/dist/content/notification-categories.js.map +1 -1
- package/dist/content/ports.d.ts +113 -68
- package/dist/content/service.d.ts +103 -67
- package/dist/content/service.js +739 -152
- package/dist/content/service.js.map +1 -1
- package/dist/content/titles.d.ts +6 -3
- package/dist/content/titles.js +37 -24
- package/dist/content/titles.js.map +1 -1
- package/dist/content/types.d.ts +2 -2
- package/dist/discussion/authors.d.ts +4 -2
- package/dist/discussion/authors.js +9 -5
- package/dist/discussion/authors.js.map +1 -1
- package/dist/discussion/chats.d.ts +56 -37
- package/dist/discussion/chats.js +392 -160
- package/dist/discussion/chats.js.map +1 -1
- package/dist/discussion/events.d.ts +85 -47
- package/dist/discussion/events.js +41 -3
- package/dist/discussion/events.js.map +1 -1
- package/dist/discussion/index.d.ts +8 -5
- package/dist/discussion/index.js +5 -3
- package/dist/discussion/live.d.ts +106 -0
- package/dist/discussion/live.js +642 -0
- package/dist/discussion/live.js.map +1 -0
- package/dist/discussion/mentions.js +2 -2
- package/dist/discussion/mentions.js.map +1 -1
- package/dist/discussion/ports.d.ts +182 -100
- package/dist/discussion/ports.js.map +1 -1
- package/dist/discussion/posts.d.ts +45 -39
- package/dist/discussion/posts.js +266 -152
- package/dist/discussion/posts.js.map +1 -1
- package/dist/discussion/rules.d.ts +18 -0
- package/dist/discussion/rules.js +22 -0
- package/dist/discussion/rules.js.map +1 -0
- package/dist/discussion/service.d.ts +37 -31
- package/dist/discussion/service.js +250 -186
- package/dist/discussion/service.js.map +1 -1
- package/dist/discussion/subscriptions.d.ts +8 -8
- package/dist/discussion/subscriptions.js +28 -12
- package/dist/discussion/subscriptions.js.map +1 -1
- package/dist/discussion/titles.d.ts +4 -2
- package/dist/discussion/titles.js +27 -13
- package/dist/discussion/titles.js.map +1 -1
- package/dist/entitlements/events.d.ts +58 -58
- package/dist/entitlements/index.d.ts +4 -4
- package/dist/entitlements/index.js +2 -2
- package/dist/entitlements/model.d.ts +2 -2
- package/dist/entitlements/ports.d.ts +65 -39
- package/dist/entitlements/rules.d.ts +3 -6
- package/dist/entitlements/rules.js +5 -10
- package/dist/entitlements/rules.js.map +1 -1
- package/dist/entitlements/service.d.ts +40 -28
- package/dist/entitlements/service.js +369 -162
- package/dist/entitlements/service.js.map +1 -1
- package/dist/identity/devices.d.ts +3 -3
- package/dist/identity/devices.js +6 -4
- package/dist/identity/devices.js.map +1 -1
- package/dist/identity/index.d.ts +2 -2
- package/dist/identity/index.js +2 -2
- package/dist/identity/notification-settings.d.ts +1 -1
- package/dist/identity/notification-settings.js +2 -1
- package/dist/identity/notification-settings.js.map +1 -1
- package/dist/identity/ports.d.ts +7 -7
- package/dist/identity/service.d.ts +8 -7
- package/dist/identity/service.js +16 -12
- package/dist/identity/service.js.map +1 -1
- package/dist/integrations/events.d.ts +3 -3
- package/dist/integrations/ports.d.ts +9 -8
- package/dist/integrations/service.d.ts +9 -8
- package/dist/integrations/service.js +31 -14
- package/dist/integrations/service.js.map +1 -1
- package/dist/organizations/default-roles.d.ts +22 -0
- package/dist/organizations/default-roles.js +89 -0
- package/dist/organizations/default-roles.js.map +1 -0
- package/dist/organizations/effective-permissions.d.ts +47 -0
- package/dist/organizations/effective-permissions.js +118 -0
- package/dist/organizations/effective-permissions.js.map +1 -0
- package/dist/organizations/events.d.ts +326 -181
- package/dist/organizations/events.js +90 -18
- package/dist/organizations/events.js.map +1 -1
- package/dist/organizations/index.d.ts +14 -10
- package/dist/organizations/index.js +7 -3
- package/dist/organizations/members.d.ts +66 -8
- package/dist/organizations/members.js.map +1 -1
- package/dist/organizations/model.d.ts +2 -2
- package/dist/organizations/notification-catalog.d.ts +31 -0
- package/dist/organizations/notification-catalog.js +32 -0
- package/dist/organizations/notification-catalog.js.map +1 -0
- package/dist/organizations/notification-categories.d.ts +6 -4
- package/dist/organizations/notification-categories.js +25 -10
- package/dist/organizations/notification-categories.js.map +1 -1
- package/dist/organizations/org-roles.d.ts +33 -0
- package/dist/organizations/org-roles.js +49 -0
- package/dist/organizations/org-roles.js.map +1 -0
- package/dist/organizations/permissions.d.ts +311 -0
- package/dist/organizations/permissions.js +327 -0
- package/dist/organizations/permissions.js.map +1 -0
- package/dist/organizations/ports.d.ts +187 -65
- package/dist/organizations/service.d.ts +102 -35
- package/dist/organizations/service.js +1254 -327
- package/dist/organizations/service.js.map +1 -1
- package/dist/organizations/testing.d.ts +18 -0
- package/dist/organizations/testing.js +37 -0
- package/dist/organizations/testing.js.map +1 -0
- package/dist/organizations/types.d.ts +5 -16
- package/dist/progress/events.d.ts +14 -14
- package/dist/progress/index.d.ts +2 -2
- package/dist/progress/ports.d.ts +11 -3
- package/dist/progress/service.d.ts +6 -5
- package/dist/progress/service.js +21 -6
- package/dist/progress/service.js.map +1 -1
- package/dist/reporting/admin/index.d.ts +6 -4
- package/dist/reporting/admin/model.d.ts +36 -3
- package/dist/reporting/admin/ports.d.ts +39 -14
- package/dist/reporting/admin/service.d.ts +32 -11
- package/dist/reporting/admin/service.js +102 -18
- package/dist/reporting/admin/service.js.map +1 -1
- package/dist/reporting/events/index.d.ts +27 -0
- package/dist/reporting/events/index.js +20 -0
- package/dist/reporting/events/index.js.map +1 -0
- package/dist/reporting/member/calendar.d.ts +11 -0
- package/dist/reporting/member/calendar.js +75 -0
- package/dist/reporting/member/calendar.js.map +1 -0
- package/dist/reporting/member/index.d.ts +3 -2
- package/dist/reporting/member/model.d.ts +29 -5
- package/dist/reporting/member/ports.d.ts +49 -29
- package/dist/reporting/member/service.d.ts +57 -29
- package/dist/reporting/member/service.js +345 -114
- package/dist/reporting/member/service.js.map +1 -1
- package/dist/shared/actor.d.ts +23 -3
- package/dist/shared/errors.d.ts +2 -1
- package/dist/shared/errors.js +3 -1
- package/dist/shared/errors.js.map +1 -1
- package/dist/shared/id.d.ts +4 -0
- package/dist/shared/id.js +4 -0
- package/dist/shared/id.js.map +1 -1
- package/dist/shared/logger.d.ts +2 -1
- package/dist/shared/logger.js +10 -1
- package/dist/shared/logger.js.map +1 -1
- package/dist/shared/ports.d.ts +25 -5
- package/dist/types/content.d.ts +2 -2
- package/dist/types/discussion.d.ts +4 -5
- package/dist/types/email-templates.d.ts +22 -3
- package/dist/types/entitlements.d.ts +2 -2
- package/dist/types/identity.d.ts +13 -16
- package/dist/types/index.d.ts +9 -9
- package/dist/types/index.js +2 -1
- package/dist/types/notifications.d.ts +4 -4
- package/dist/types/organizations.d.ts +3 -2
- package/dist/types/ports.d.ts +8 -1
- package/dist/types/ports.js +7 -1
- package/dist/types/ports.js.map +1 -0
- package/dist/types/schemas/assets.d.ts +5 -5
- package/dist/types/schemas/assets.js +4 -3
- package/dist/types/schemas/assets.js.map +1 -1
- package/dist/types/schemas/content.d.ts +599 -13
- package/dist/types/schemas/content.js +219 -8
- package/dist/types/schemas/content.js.map +1 -1
- package/dist/types/schemas/discussion.d.ts +280 -57
- package/dist/types/schemas/discussion.js +77 -3
- package/dist/types/schemas/discussion.js.map +1 -1
- package/dist/types/schemas/entitlements.d.ts +21 -8
- package/dist/types/schemas/entitlements.js +11 -4
- package/dist/types/schemas/entitlements.js.map +1 -1
- package/dist/types/schemas/index.d.ts +5 -5
- package/dist/types/schemas/index.js +5 -5
- package/dist/types/schemas/notifications.d.ts +11 -10
- package/dist/types/schemas/notifications.js +3 -2
- package/dist/types/schemas/notifications.js.map +1 -1
- package/dist/types/schemas/organizations.d.ts +99 -60
- package/dist/types/schemas/organizations.js +80 -27
- package/dist/types/schemas/organizations.js.map +1 -1
- package/dist/types/schemas/progress.d.ts +3 -4
- package/dist/types/schemas/progress.js +0 -1
- package/dist/types/schemas/progress.js.map +1 -1
- package/package.json +1 -1
- package/dist/organizations/access-scopes.d.ts +0 -19
- package/dist/organizations/access-scopes.js +0 -89
- package/dist/organizations/access-scopes.js.map +0 -1
- package/dist/organizations/roles.d.ts +0 -19
- package/dist/organizations/roles.js +0 -82
- package/dist/organizations/roles.js.map +0 -1
|
@@ -8,7 +8,7 @@ declare const entitlementEvents: {
|
|
|
8
8
|
orgUserId: string;
|
|
9
9
|
bundleId: string | null;
|
|
10
10
|
contentId: string | null;
|
|
11
|
-
status: "
|
|
11
|
+
status: "revoked" | "active";
|
|
12
12
|
source: string;
|
|
13
13
|
grantedAt: Date;
|
|
14
14
|
expiresAt: Date | null;
|
|
@@ -20,25 +20,25 @@ declare const entitlementEvents: {
|
|
|
20
20
|
orgUserId: string;
|
|
21
21
|
bundleId: string | null;
|
|
22
22
|
contentId: string | null;
|
|
23
|
-
status: "
|
|
23
|
+
status: "revoked" | "active";
|
|
24
24
|
source: string;
|
|
25
25
|
grantedAt: unknown;
|
|
26
26
|
expiresAt: unknown;
|
|
27
27
|
createdAt: unknown;
|
|
28
28
|
updatedAt: unknown;
|
|
29
29
|
}, import("zod").ZodObject<{
|
|
30
|
-
id: import("zod").ZodString;
|
|
31
30
|
orgId: import("zod").ZodString;
|
|
32
|
-
|
|
33
|
-
createdAt: import("zod").ZodCoercedDate<unknown>;
|
|
34
|
-
updatedAt: import("zod").ZodCoercedDate<unknown>;
|
|
31
|
+
id: import("zod").ZodString;
|
|
35
32
|
source: import("zod").ZodString;
|
|
36
33
|
status: import("zod").ZodEnum<{
|
|
37
|
-
active: "active";
|
|
38
34
|
revoked: "revoked";
|
|
35
|
+
active: "active";
|
|
39
36
|
}>;
|
|
40
|
-
bundleId: import("zod").ZodNullable<import("zod").ZodString>;
|
|
41
37
|
contentId: import("zod").ZodNullable<import("zod").ZodString>;
|
|
38
|
+
createdAt: import("zod").ZodCoercedDate<unknown>;
|
|
39
|
+
updatedAt: import("zod").ZodCoercedDate<unknown>;
|
|
40
|
+
bundleId: import("zod").ZodNullable<import("zod").ZodString>;
|
|
41
|
+
orgUserId: import("zod").ZodString;
|
|
42
42
|
grantedAt: import("zod").ZodCoercedDate<unknown>;
|
|
43
43
|
expiresAt: import("zod").ZodNullable<import("zod").ZodCoercedDate<unknown>>;
|
|
44
44
|
}, import("zod/v4/core").$strip>>;
|
|
@@ -48,7 +48,7 @@ declare const entitlementEvents: {
|
|
|
48
48
|
orgUserId: string;
|
|
49
49
|
bundleId: string | null;
|
|
50
50
|
contentId: string | null;
|
|
51
|
-
status: "
|
|
51
|
+
status: "revoked" | "active";
|
|
52
52
|
source: string;
|
|
53
53
|
grantedAt: Date;
|
|
54
54
|
expiresAt: Date | null;
|
|
@@ -60,25 +60,25 @@ declare const entitlementEvents: {
|
|
|
60
60
|
orgUserId: string;
|
|
61
61
|
bundleId: string | null;
|
|
62
62
|
contentId: string | null;
|
|
63
|
-
status: "
|
|
63
|
+
status: "revoked" | "active";
|
|
64
64
|
source: string;
|
|
65
65
|
grantedAt: unknown;
|
|
66
66
|
expiresAt: unknown;
|
|
67
67
|
createdAt: unknown;
|
|
68
68
|
updatedAt: unknown;
|
|
69
69
|
}, import("zod").ZodObject<{
|
|
70
|
-
id: import("zod").ZodString;
|
|
71
70
|
orgId: import("zod").ZodString;
|
|
72
|
-
|
|
73
|
-
createdAt: import("zod").ZodCoercedDate<unknown>;
|
|
74
|
-
updatedAt: import("zod").ZodCoercedDate<unknown>;
|
|
71
|
+
id: import("zod").ZodString;
|
|
75
72
|
source: import("zod").ZodString;
|
|
76
73
|
status: import("zod").ZodEnum<{
|
|
77
|
-
active: "active";
|
|
78
74
|
revoked: "revoked";
|
|
75
|
+
active: "active";
|
|
79
76
|
}>;
|
|
80
|
-
bundleId: import("zod").ZodNullable<import("zod").ZodString>;
|
|
81
77
|
contentId: import("zod").ZodNullable<import("zod").ZodString>;
|
|
78
|
+
createdAt: import("zod").ZodCoercedDate<unknown>;
|
|
79
|
+
updatedAt: import("zod").ZodCoercedDate<unknown>;
|
|
80
|
+
bundleId: import("zod").ZodNullable<import("zod").ZodString>;
|
|
81
|
+
orgUserId: import("zod").ZodString;
|
|
82
82
|
grantedAt: import("zod").ZodCoercedDate<unknown>;
|
|
83
83
|
expiresAt: import("zod").ZodNullable<import("zod").ZodCoercedDate<unknown>>;
|
|
84
84
|
}, import("zod/v4/core").$strip>>;
|
|
@@ -88,7 +88,7 @@ declare const entitlementEvents: {
|
|
|
88
88
|
orgUserId: string;
|
|
89
89
|
bundleId: string | null;
|
|
90
90
|
contentId: string | null;
|
|
91
|
-
status: "
|
|
91
|
+
status: "revoked" | "active";
|
|
92
92
|
source: string;
|
|
93
93
|
grantedAt: Date;
|
|
94
94
|
expiresAt: Date | null;
|
|
@@ -100,25 +100,25 @@ declare const entitlementEvents: {
|
|
|
100
100
|
orgUserId: string;
|
|
101
101
|
bundleId: string | null;
|
|
102
102
|
contentId: string | null;
|
|
103
|
-
status: "
|
|
103
|
+
status: "revoked" | "active";
|
|
104
104
|
source: string;
|
|
105
105
|
grantedAt: unknown;
|
|
106
106
|
expiresAt: unknown;
|
|
107
107
|
createdAt: unknown;
|
|
108
108
|
updatedAt: unknown;
|
|
109
109
|
}, import("zod").ZodObject<{
|
|
110
|
-
id: import("zod").ZodString;
|
|
111
110
|
orgId: import("zod").ZodString;
|
|
112
|
-
|
|
113
|
-
createdAt: import("zod").ZodCoercedDate<unknown>;
|
|
114
|
-
updatedAt: import("zod").ZodCoercedDate<unknown>;
|
|
111
|
+
id: import("zod").ZodString;
|
|
115
112
|
source: import("zod").ZodString;
|
|
116
113
|
status: import("zod").ZodEnum<{
|
|
117
|
-
active: "active";
|
|
118
114
|
revoked: "revoked";
|
|
115
|
+
active: "active";
|
|
119
116
|
}>;
|
|
120
|
-
bundleId: import("zod").ZodNullable<import("zod").ZodString>;
|
|
121
117
|
contentId: import("zod").ZodNullable<import("zod").ZodString>;
|
|
118
|
+
createdAt: import("zod").ZodCoercedDate<unknown>;
|
|
119
|
+
updatedAt: import("zod").ZodCoercedDate<unknown>;
|
|
120
|
+
bundleId: import("zod").ZodNullable<import("zod").ZodString>;
|
|
121
|
+
orgUserId: import("zod").ZodString;
|
|
122
122
|
grantedAt: import("zod").ZodCoercedDate<unknown>;
|
|
123
123
|
expiresAt: import("zod").ZodNullable<import("zod").ZodCoercedDate<unknown>>;
|
|
124
124
|
}, import("zod/v4/core").$strip>>;
|
|
@@ -128,7 +128,7 @@ declare const entitlementEvents: {
|
|
|
128
128
|
orgUserId: string;
|
|
129
129
|
bundleId: string | null;
|
|
130
130
|
contentId: string | null;
|
|
131
|
-
status: "
|
|
131
|
+
status: "revoked" | "active";
|
|
132
132
|
source: string;
|
|
133
133
|
grantedAt: Date;
|
|
134
134
|
expiresAt: Date | null;
|
|
@@ -140,25 +140,25 @@ declare const entitlementEvents: {
|
|
|
140
140
|
orgUserId: string;
|
|
141
141
|
bundleId: string | null;
|
|
142
142
|
contentId: string | null;
|
|
143
|
-
status: "
|
|
143
|
+
status: "revoked" | "active";
|
|
144
144
|
source: string;
|
|
145
145
|
grantedAt: unknown;
|
|
146
146
|
expiresAt: unknown;
|
|
147
147
|
createdAt: unknown;
|
|
148
148
|
updatedAt: unknown;
|
|
149
149
|
}, import("zod").ZodObject<{
|
|
150
|
-
id: import("zod").ZodString;
|
|
151
150
|
orgId: import("zod").ZodString;
|
|
152
|
-
|
|
153
|
-
createdAt: import("zod").ZodCoercedDate<unknown>;
|
|
154
|
-
updatedAt: import("zod").ZodCoercedDate<unknown>;
|
|
151
|
+
id: import("zod").ZodString;
|
|
155
152
|
source: import("zod").ZodString;
|
|
156
153
|
status: import("zod").ZodEnum<{
|
|
157
|
-
active: "active";
|
|
158
154
|
revoked: "revoked";
|
|
155
|
+
active: "active";
|
|
159
156
|
}>;
|
|
160
|
-
bundleId: import("zod").ZodNullable<import("zod").ZodString>;
|
|
161
157
|
contentId: import("zod").ZodNullable<import("zod").ZodString>;
|
|
158
|
+
createdAt: import("zod").ZodCoercedDate<unknown>;
|
|
159
|
+
updatedAt: import("zod").ZodCoercedDate<unknown>;
|
|
160
|
+
bundleId: import("zod").ZodNullable<import("zod").ZodString>;
|
|
161
|
+
orgUserId: import("zod").ZodString;
|
|
162
162
|
grantedAt: import("zod").ZodCoercedDate<unknown>;
|
|
163
163
|
expiresAt: import("zod").ZodNullable<import("zod").ZodCoercedDate<unknown>>;
|
|
164
164
|
}, import("zod/v4/core").$strip>>;
|
|
@@ -168,7 +168,7 @@ declare const entitlementEvents: {
|
|
|
168
168
|
orgUserId: string;
|
|
169
169
|
bundleId: string | null;
|
|
170
170
|
contentId: string | null;
|
|
171
|
-
status: "
|
|
171
|
+
status: "revoked" | "active";
|
|
172
172
|
source: string;
|
|
173
173
|
grantedAt: Date;
|
|
174
174
|
expiresAt: Date | null;
|
|
@@ -181,7 +181,7 @@ declare const entitlementEvents: {
|
|
|
181
181
|
orgUserId: string;
|
|
182
182
|
bundleId: string | null;
|
|
183
183
|
contentId: string | null;
|
|
184
|
-
status: "
|
|
184
|
+
status: "revoked" | "active";
|
|
185
185
|
source: string;
|
|
186
186
|
grantedAt: unknown;
|
|
187
187
|
expiresAt: unknown;
|
|
@@ -189,18 +189,18 @@ declare const entitlementEvents: {
|
|
|
189
189
|
updatedAt: unknown;
|
|
190
190
|
communityId: string;
|
|
191
191
|
}, import("zod").ZodObject<{
|
|
192
|
-
id: import("zod").ZodString;
|
|
193
192
|
orgId: import("zod").ZodString;
|
|
194
|
-
|
|
195
|
-
createdAt: import("zod").ZodCoercedDate<unknown>;
|
|
196
|
-
updatedAt: import("zod").ZodCoercedDate<unknown>;
|
|
193
|
+
id: import("zod").ZodString;
|
|
197
194
|
source: import("zod").ZodString;
|
|
198
195
|
status: import("zod").ZodEnum<{
|
|
199
|
-
active: "active";
|
|
200
196
|
revoked: "revoked";
|
|
197
|
+
active: "active";
|
|
201
198
|
}>;
|
|
202
|
-
bundleId: import("zod").ZodNullable<import("zod").ZodString>;
|
|
203
199
|
contentId: import("zod").ZodNullable<import("zod").ZodString>;
|
|
200
|
+
createdAt: import("zod").ZodCoercedDate<unknown>;
|
|
201
|
+
updatedAt: import("zod").ZodCoercedDate<unknown>;
|
|
202
|
+
bundleId: import("zod").ZodNullable<import("zod").ZodString>;
|
|
203
|
+
orgUserId: import("zod").ZodString;
|
|
204
204
|
grantedAt: import("zod").ZodCoercedDate<unknown>;
|
|
205
205
|
expiresAt: import("zod").ZodNullable<import("zod").ZodCoercedDate<unknown>>;
|
|
206
206
|
communityId: import("zod").ZodString;
|
|
@@ -211,8 +211,8 @@ declare const entitlementEvents: {
|
|
|
211
211
|
communityId: string;
|
|
212
212
|
spaceId: string;
|
|
213
213
|
orgUserId: string;
|
|
214
|
-
status: "
|
|
215
|
-
source: "
|
|
214
|
+
status: "revoked" | "active" | "requested" | "invited";
|
|
215
|
+
source: "manual" | "request" | "invite";
|
|
216
216
|
createdAt: Date;
|
|
217
217
|
updatedAt: Date;
|
|
218
218
|
}, "entitlement.space_member.created", 1>, {
|
|
@@ -221,8 +221,8 @@ declare const entitlementEvents: {
|
|
|
221
221
|
communityId: string;
|
|
222
222
|
spaceId: string;
|
|
223
223
|
orgUserId: string;
|
|
224
|
-
status: "
|
|
225
|
-
source: "
|
|
224
|
+
status: "revoked" | "active" | "requested" | "invited";
|
|
225
|
+
source: "manual" | "request" | "invite";
|
|
226
226
|
createdAt: unknown;
|
|
227
227
|
updatedAt: unknown;
|
|
228
228
|
}, import("zod").ZodObject<{
|
|
@@ -232,15 +232,15 @@ declare const entitlementEvents: {
|
|
|
232
232
|
spaceId: import("zod").ZodString;
|
|
233
233
|
orgUserId: import("zod").ZodString;
|
|
234
234
|
status: import("zod").ZodEnum<{
|
|
235
|
-
active: "active";
|
|
236
235
|
revoked: "revoked";
|
|
236
|
+
active: "active";
|
|
237
237
|
requested: "requested";
|
|
238
238
|
invited: "invited";
|
|
239
239
|
}>;
|
|
240
240
|
source: import("zod").ZodEnum<{
|
|
241
|
+
manual: "manual";
|
|
241
242
|
request: "request";
|
|
242
243
|
invite: "invite";
|
|
243
|
-
manual: "manual";
|
|
244
244
|
}>;
|
|
245
245
|
createdAt: import("zod").ZodCoercedDate<unknown>;
|
|
246
246
|
updatedAt: import("zod").ZodCoercedDate<unknown>;
|
|
@@ -251,8 +251,8 @@ declare const entitlementEvents: {
|
|
|
251
251
|
communityId: string;
|
|
252
252
|
spaceId: string;
|
|
253
253
|
orgUserId: string;
|
|
254
|
-
status: "
|
|
255
|
-
source: "
|
|
254
|
+
status: "revoked" | "active" | "requested" | "invited";
|
|
255
|
+
source: "manual" | "request" | "invite";
|
|
256
256
|
createdAt: Date;
|
|
257
257
|
updatedAt: Date;
|
|
258
258
|
}, "entitlement.space_member.updated", 1>, {
|
|
@@ -261,8 +261,8 @@ declare const entitlementEvents: {
|
|
|
261
261
|
communityId: string;
|
|
262
262
|
spaceId: string;
|
|
263
263
|
orgUserId: string;
|
|
264
|
-
status: "
|
|
265
|
-
source: "
|
|
264
|
+
status: "revoked" | "active" | "requested" | "invited";
|
|
265
|
+
source: "manual" | "request" | "invite";
|
|
266
266
|
createdAt: unknown;
|
|
267
267
|
updatedAt: unknown;
|
|
268
268
|
}, import("zod").ZodObject<{
|
|
@@ -272,15 +272,15 @@ declare const entitlementEvents: {
|
|
|
272
272
|
spaceId: import("zod").ZodString;
|
|
273
273
|
orgUserId: import("zod").ZodString;
|
|
274
274
|
status: import("zod").ZodEnum<{
|
|
275
|
-
active: "active";
|
|
276
275
|
revoked: "revoked";
|
|
276
|
+
active: "active";
|
|
277
277
|
requested: "requested";
|
|
278
278
|
invited: "invited";
|
|
279
279
|
}>;
|
|
280
280
|
source: import("zod").ZodEnum<{
|
|
281
|
+
manual: "manual";
|
|
281
282
|
request: "request";
|
|
282
283
|
invite: "invite";
|
|
283
|
-
manual: "manual";
|
|
284
284
|
}>;
|
|
285
285
|
createdAt: import("zod").ZodCoercedDate<unknown>;
|
|
286
286
|
updatedAt: import("zod").ZodCoercedDate<unknown>;
|
|
@@ -291,8 +291,8 @@ declare const entitlementEvents: {
|
|
|
291
291
|
communityId: string;
|
|
292
292
|
spaceId: string;
|
|
293
293
|
orgUserId: string;
|
|
294
|
-
status: "
|
|
295
|
-
source: "
|
|
294
|
+
status: "revoked" | "active" | "requested" | "invited";
|
|
295
|
+
source: "manual" | "request" | "invite";
|
|
296
296
|
createdAt: Date;
|
|
297
297
|
updatedAt: Date;
|
|
298
298
|
}, "entitlement.space_member.deleted", 1>, {
|
|
@@ -301,8 +301,8 @@ declare const entitlementEvents: {
|
|
|
301
301
|
communityId: string;
|
|
302
302
|
spaceId: string;
|
|
303
303
|
orgUserId: string;
|
|
304
|
-
status: "
|
|
305
|
-
source: "
|
|
304
|
+
status: "revoked" | "active" | "requested" | "invited";
|
|
305
|
+
source: "manual" | "request" | "invite";
|
|
306
306
|
createdAt: unknown;
|
|
307
307
|
updatedAt: unknown;
|
|
308
308
|
}, import("zod").ZodObject<{
|
|
@@ -312,15 +312,15 @@ declare const entitlementEvents: {
|
|
|
312
312
|
spaceId: import("zod").ZodString;
|
|
313
313
|
orgUserId: import("zod").ZodString;
|
|
314
314
|
status: import("zod").ZodEnum<{
|
|
315
|
-
active: "active";
|
|
316
315
|
revoked: "revoked";
|
|
316
|
+
active: "active";
|
|
317
317
|
requested: "requested";
|
|
318
318
|
invited: "invited";
|
|
319
319
|
}>;
|
|
320
320
|
source: import("zod").ZodEnum<{
|
|
321
|
+
manual: "manual";
|
|
321
322
|
request: "request";
|
|
322
323
|
invite: "invite";
|
|
323
|
-
manual: "manual";
|
|
324
324
|
}>;
|
|
325
325
|
createdAt: import("zod").ZodCoercedDate<unknown>;
|
|
326
326
|
updatedAt: import("zod").ZodCoercedDate<unknown>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Page } from "../types/shared.js";
|
|
2
|
-
import { Entitlement, EntitlementStatus, EntitlementsQuery, GrantEntitlementInput, SpaceMember, SpaceMemberSource, SpaceMemberStatus } from "../types/schemas/entitlements.js";
|
|
2
|
+
import { Entitlement, EntitlementStatus, EntitlementsQuery, GrantEntitlementInput, GrantSource, SpaceMember, SpaceMemberSource, SpaceMemberStatus } from "../types/schemas/entitlements.js";
|
|
3
3
|
import "./model.js";
|
|
4
|
-
import { AccessFacts, CommunityAccessReader, EndingGrant, EndingGrantKey, EntitlementNotice, EntitlementsRepository, EntitlementsService, GrantKey, GrantTarget, InsertSpaceMemberInput, OpenableSpace, SpaceAccessRule, SpaceMembersQuery } from "./ports.js";
|
|
4
|
+
import { AccessFacts, CommunityAccessReader, CommunityReaders, ContentReader, EndingGrant, EndingGrantKey, EntitlementNotice, EntitlementsRepository, EntitlementsService, GrantKey, GrantTarget, InsertGrantInput, InsertSpaceMemberInput, OpenableSpace, PermissionHolders, RevokeGrantInput, SpaceAccessRule, SpaceMembersQuery } from "./ports.js";
|
|
5
5
|
import { EntitlementsServiceImpl } from "./service.js";
|
|
6
6
|
import { EntitlementCreated, EntitlementDeleted, EntitlementEndingSoon, EntitlementEvent, EntitlementExpired, EntitlementUpdated, SpaceMemberCreated, SpaceMemberDeleted, SpaceMemberUpdated, entitlementEvents } from "./events.js";
|
|
7
|
-
import { seesSpace } from "./rules.js";
|
|
7
|
+
import { opensSpace, seesSpace } from "./rules.js";
|
|
8
8
|
import { GRANTS_EXPIRE_JOB, entitlementsJobs, entitlementsRecurringJobs } from "./jobs.js";
|
|
9
|
-
export { type AccessFacts, type CommunityAccessReader, type EndingGrant, type EndingGrantKey, type Entitlement, type EntitlementCreated, type EntitlementDeleted, type EntitlementEndingSoon, type EntitlementEvent, type EntitlementExpired, type EntitlementNotice, type EntitlementStatus, type EntitlementUpdated, type EntitlementsQuery, type EntitlementsRepository, type EntitlementsService, EntitlementsServiceImpl, GRANTS_EXPIRE_JOB, type GrantEntitlementInput, type GrantKey, type GrantTarget, type InsertSpaceMemberInput, type OpenableSpace, type Page, type SpaceAccessRule, type SpaceMember, type SpaceMemberCreated, type SpaceMemberDeleted, type SpaceMemberSource, type SpaceMemberStatus, type SpaceMemberUpdated, type SpaceMembersQuery, entitlementEvents, entitlementsJobs, entitlementsRecurringJobs, seesSpace };
|
|
9
|
+
export { type AccessFacts, type CommunityAccessReader, type CommunityReaders, type ContentReader, type EndingGrant, type EndingGrantKey, type Entitlement, type EntitlementCreated, type EntitlementDeleted, type EntitlementEndingSoon, type EntitlementEvent, type EntitlementExpired, type EntitlementNotice, type EntitlementStatus, type EntitlementUpdated, type EntitlementsQuery, type EntitlementsRepository, type EntitlementsService, EntitlementsServiceImpl, GRANTS_EXPIRE_JOB, type GrantEntitlementInput, type GrantKey, type GrantSource, type GrantTarget, type InsertGrantInput, type InsertSpaceMemberInput, type OpenableSpace, type Page, type PermissionHolders, type RevokeGrantInput, type SpaceAccessRule, type SpaceMember, type SpaceMemberCreated, type SpaceMemberDeleted, type SpaceMemberSource, type SpaceMemberStatus, type SpaceMemberUpdated, type SpaceMembersQuery, entitlementEvents, entitlementsJobs, entitlementsRecurringJobs, opensSpace, seesSpace };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { entitlementEvents } from "./events.js";
|
|
2
|
-
import { seesSpace } from "./rules.js";
|
|
2
|
+
import { opensSpace, seesSpace } from "./rules.js";
|
|
3
3
|
import { EntitlementsServiceImpl } from "./service.js";
|
|
4
4
|
import { GRANTS_EXPIRE_JOB, entitlementsJobs, entitlementsRecurringJobs } from "./jobs.js";
|
|
5
|
-
export { EntitlementsServiceImpl, GRANTS_EXPIRE_JOB, entitlementEvents, entitlementsJobs, entitlementsRecurringJobs, seesSpace };
|
|
5
|
+
export { EntitlementsServiceImpl, GRANTS_EXPIRE_JOB, entitlementEvents, entitlementsJobs, entitlementsRecurringJobs, opensSpace, seesSpace };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Page } from "../types/shared.js";
|
|
2
2
|
import { ContentType } from "../types/schemas/content.js";
|
|
3
|
-
import { Entitlement, EntitlementStatus, EntitlementsQuery, GrantEntitlementInput, SpaceMember, SpaceMemberSource, SpaceMemberStatus } from "../types/schemas/entitlements.js";
|
|
3
|
+
import { Entitlement, EntitlementStatus, EntitlementsQuery, GrantEntitlementInput, GrantSource, SpaceMember, SpaceMemberSource, SpaceMemberStatus } from "../types/schemas/entitlements.js";
|
|
4
4
|
import "../types/index.js";
|
|
5
|
-
export type { ContentType, Entitlement, EntitlementStatus, EntitlementsQuery, GrantEntitlementInput, Page, SpaceMember, SpaceMemberSource, SpaceMemberStatus };
|
|
5
|
+
export type { ContentType, Entitlement, EntitlementStatus, EntitlementsQuery, GrantEntitlementInput, GrantSource, Page, SpaceMember, SpaceMemberSource, SpaceMemberStatus };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Page } from "../types/shared.js";
|
|
2
|
-
import { ContentType, Space } from "../types/schemas/content.js";
|
|
3
|
-
import {
|
|
4
|
-
import { Entitlement, EntitlementsQuery, GrantEntitlementInput, SpaceMember, SpaceMemberSource, SpaceMemberStatus } from "../types/schemas/entitlements.js";
|
|
5
|
-
import
|
|
2
|
+
import { ContentType, Event, Space } from "../types/schemas/content.js";
|
|
3
|
+
import { Permission } from "../types/schemas/organizations.js";
|
|
4
|
+
import { Entitlement, EntitlementsQuery, GrantEntitlementInput, GrantSource, SpaceMember, SpaceMemberSource, SpaceMemberStatus } from "../types/schemas/entitlements.js";
|
|
5
|
+
import "../types/index.js";
|
|
6
6
|
import { Actor } from "../shared/actor.js";
|
|
7
|
+
import { OutboxAppender, UnitOfWork } from "../shared/ports.js";
|
|
7
8
|
import { SpaceRowLock } from "../content/ports.js";
|
|
8
9
|
import "../content/index.js";
|
|
9
10
|
import "./model.js";
|
|
10
|
-
import "../organizations/index.js";
|
|
11
11
|
//#region src/entitlements/ports.d.ts
|
|
12
12
|
interface GrantTarget {
|
|
13
13
|
contentId: string | null;
|
|
@@ -20,12 +20,12 @@ interface OpenableSpace {
|
|
|
20
20
|
accessRule: SpaceAccessRule;
|
|
21
21
|
}
|
|
22
22
|
interface CommunityAccessReader {
|
|
23
|
-
isCommunityMember(
|
|
24
|
-
canOpenSpace(
|
|
25
|
-
canOpen(
|
|
26
|
-
openSpaceIds(
|
|
27
|
-
openSpacesFor(
|
|
28
|
-
spaceStandings(
|
|
23
|
+
isCommunityMember(communityId: string, actor: Actor): Promise<boolean>;
|
|
24
|
+
canOpenSpace(spaceId: string, actor: Actor): Promise<boolean>;
|
|
25
|
+
canOpen(space: OpenableSpace, actor: Actor): Promise<boolean>;
|
|
26
|
+
openSpaceIds(communityId: string, actor: Actor): Promise<string[]>;
|
|
27
|
+
openSpacesFor(communityId: string, actor: Actor): Promise<Space[]>;
|
|
28
|
+
spaceStandings(communityId: string, actor: Actor): Promise<Record<string, SpaceMember['status']>>;
|
|
29
29
|
communityMembersAmong(orgId: string, communityId: string, orgUserIds: string[]): Promise<string[]>;
|
|
30
30
|
spaceOpenersAmong(orgId: string, spaceId: string, orgUserIds: string[]): Promise<string[]>;
|
|
31
31
|
spaceOpeners(orgId: string, spaceId: string): Promise<string[]>;
|
|
@@ -50,10 +50,28 @@ interface EndingGrantKey {
|
|
|
50
50
|
}
|
|
51
51
|
interface AccessFacts {
|
|
52
52
|
orgUserId: string;
|
|
53
|
-
|
|
54
|
-
member: boolean;
|
|
53
|
+
granted: boolean;
|
|
55
54
|
activeInSpace: boolean;
|
|
56
55
|
}
|
|
56
|
+
interface PermissionHolders {
|
|
57
|
+
holders(orgId: string, permission: Permission, on?: string): Promise<string[]>;
|
|
58
|
+
systemActor(orgId: string): Actor;
|
|
59
|
+
}
|
|
60
|
+
interface ContentReader {
|
|
61
|
+
getSpace(spaceId: string, actor: Actor): Promise<Space | null>;
|
|
62
|
+
listSpaces(communityId: string, actor: Actor): Promise<Space[]>;
|
|
63
|
+
getEvent(eventId: string, actor: Actor): Promise<Event>;
|
|
64
|
+
}
|
|
65
|
+
interface RevokeGrantInput {
|
|
66
|
+
orgUserId: string;
|
|
67
|
+
contentId?: string | null;
|
|
68
|
+
bundleId?: string | null;
|
|
69
|
+
contentType?: ContentType;
|
|
70
|
+
}
|
|
71
|
+
interface CommunityReaders {
|
|
72
|
+
all: boolean;
|
|
73
|
+
ids: string[];
|
|
74
|
+
}
|
|
57
75
|
interface GrantKey {
|
|
58
76
|
orgUserId: string;
|
|
59
77
|
contentId?: string | null;
|
|
@@ -63,7 +81,11 @@ interface SpaceMembersQuery {
|
|
|
63
81
|
page: number;
|
|
64
82
|
pageSize: number;
|
|
65
83
|
statuses?: SpaceMemberStatus[];
|
|
84
|
+
excluding?: string[];
|
|
66
85
|
}
|
|
86
|
+
type InsertGrantInput = Omit<GrantEntitlementInput, 'contentType'> & {
|
|
87
|
+
source: GrantSource;
|
|
88
|
+
};
|
|
67
89
|
interface InsertSpaceMemberInput {
|
|
68
90
|
communityId: string;
|
|
69
91
|
spaceId: string;
|
|
@@ -72,48 +94,52 @@ interface InsertSpaceMemberInput {
|
|
|
72
94
|
source: SpaceMemberSource;
|
|
73
95
|
}
|
|
74
96
|
interface EntitlementsService extends CommunityAccessReader {
|
|
75
|
-
list(
|
|
76
|
-
grant(
|
|
77
|
-
|
|
78
|
-
setStatus(orgId: string, id: string, status: 'active' | 'revoked'): Promise<Entitlement | null>;
|
|
97
|
+
list(query: EntitlementsQuery, actor: Actor): Promise<Page<Entitlement>>;
|
|
98
|
+
grant(input: GrantEntitlementInput, actor: Actor): Promise<Entitlement>;
|
|
99
|
+
revoke(input: RevokeGrantInput, actor: Actor): Promise<Entitlement>;
|
|
79
100
|
/** Whether this org user can open the content right now, through a grant to
|
|
80
101
|
* it or to a bundle holding it. The only access check — nothing else may
|
|
81
102
|
* derive access from grants. */
|
|
82
103
|
hasAccess(orgId: string, orgUserId: string, contentId: string): Promise<boolean>;
|
|
83
104
|
/** Ids of the content this org user can open right now, optionally of one type. */
|
|
84
105
|
listAccessibleContent(orgId: string, orgUserId: string, type?: ContentType): Promise<string[]>;
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
106
|
+
holdsAnyGrant(orgId: string, orgUserId: string): Promise<boolean>;
|
|
107
|
+
/** `communities:read` on the community, or a member of it holding `communities:moderate` on it. */
|
|
108
|
+
opensEverySpace(actor: Actor, communityId: string): Promise<boolean>;
|
|
109
|
+
requestJoin(communityId: string, spaceId: string, actor: Actor): Promise<SpaceMember>;
|
|
110
|
+
invite(communityId: string, spaceId: string, orgUserId: string, actor: Actor): Promise<SpaceMember>;
|
|
111
|
+
addSpaceMember(communityId: string, spaceId: string, orgUserId: string, actor: Actor): Promise<SpaceMember>;
|
|
112
|
+
accept(communityId: string, spaceId: string, actor: Actor): Promise<SpaceMember>;
|
|
113
|
+
approve(communityId: string, spaceId: string, orgUserId: string, actor: Actor): Promise<SpaceMember>;
|
|
114
|
+
decline(communityId: string, spaceId: string, orgUserId: string, actor: Actor): Promise<SpaceMember>;
|
|
115
|
+
refuse(communityId: string, spaceId: string, actor: Actor): Promise<SpaceMember>;
|
|
116
|
+
leave(communityId: string, spaceId: string, actor: Actor): Promise<SpaceMember>;
|
|
117
|
+
remove(communityId: string, spaceId: string, orgUserId: string, actor: Actor): Promise<SpaceMember>;
|
|
118
|
+
listSpaceMembers(communityId: string, spaceId: string, query: {
|
|
95
119
|
page: number;
|
|
96
120
|
pageSize: number;
|
|
97
|
-
}): Promise<Page<SpaceMember>>;
|
|
121
|
+
}, actor: Actor): Promise<Page<SpaceMember>>;
|
|
98
122
|
expireDueGrants(now: Date): Promise<void>;
|
|
99
123
|
communitiesOpenedBy(orgId: string, grant: GrantTarget): Promise<string[]>;
|
|
100
124
|
communityModeratorIds(orgId: string, communityId: string): Promise<string[]>;
|
|
101
125
|
communityIdsOpenedFor(orgId: string, orgUserId: string): Promise<string[]>;
|
|
102
|
-
openCommunityIds(
|
|
126
|
+
openCommunityIds(actor: Actor): Promise<string[]>;
|
|
103
127
|
communityMemberIds(orgId: string, communityId: string): Promise<string[]>;
|
|
104
|
-
|
|
128
|
+
grantedOrgUserIds(orgId: string, contentId: string): Promise<string[]>;
|
|
105
129
|
countActiveSpaceMembers(orgId: string, spaceId: string): Promise<number>;
|
|
130
|
+
/** Org users who open every space of the community, so hold no place in its spaces. */
|
|
131
|
+
everySpaceOpeners(orgId: string, communityId: string): Promise<string[]>;
|
|
106
132
|
}
|
|
107
133
|
interface EntitlementsRepository {
|
|
108
134
|
list(orgId: string, query: EntitlementsQuery): Promise<Page<Entitlement>>;
|
|
109
|
-
insert(orgId: string, input:
|
|
110
|
-
insertIfAbsent(orgId: string, input: GrantEntitlementInput): Promise<Entitlement | null>;
|
|
135
|
+
insert(orgId: string, input: InsertGrantInput): Promise<Entitlement>;
|
|
111
136
|
lockGrant(orgId: string, key: GrantKey): Promise<Entitlement | null>;
|
|
112
|
-
setExpiresAt(orgId: string, id: string, expiresAt: Date | null): Promise<Entitlement | null>;
|
|
113
137
|
setStatus(orgId: string, id: string, status: 'active' | 'revoked'): Promise<Entitlement | null>;
|
|
114
138
|
hasAccess(orgId: string, orgUserId: string, contentId: string): Promise<boolean>;
|
|
115
139
|
listAccessibleContent(orgId: string, orgUserId: string, type?: ContentType): Promise<string[]>;
|
|
116
140
|
hasCommunityAccess(orgId: string, orgUserId: string, communityId: string): Promise<boolean>;
|
|
141
|
+
holdsAnyGrant(orgId: string, orgUserId: string): Promise<boolean>;
|
|
142
|
+
contentTypeOf(orgId: string, contentId: string): Promise<ContentType | null>;
|
|
117
143
|
communitiesOpenedBy(orgId: string, grant: GrantTarget): Promise<string[]>;
|
|
118
144
|
accessAmong(orgId: string, communityId: string, spaceId: string | null, orgUserIds: string[]): Promise<AccessFacts[]>;
|
|
119
145
|
findSpaceMember(orgId: string, spaceId: string, orgUserId: string): Promise<SpaceMember | null>;
|
|
@@ -123,7 +149,7 @@ interface EntitlementsRepository {
|
|
|
123
149
|
insertSpaceMember(orgId: string, input: InsertSpaceMemberInput): Promise<SpaceMember>;
|
|
124
150
|
updateSpaceMemberStatus(orgId: string, id: string, status: SpaceMemberStatus): Promise<SpaceMember | null>;
|
|
125
151
|
deleteSpaceMember(orgId: string, id: string): Promise<void>;
|
|
126
|
-
countActiveSpaceMembers(orgId: string, spaceId: string): Promise<number>;
|
|
152
|
+
countActiveSpaceMembers(orgId: string, spaceId: string, excluding: string[]): Promise<number>;
|
|
127
153
|
activeSpaceIds(orgId: string, orgUserId: string, communityId: string): Promise<string[]>;
|
|
128
154
|
/** Expired grants with no expiry notice, in id order, after `afterId` when given. */
|
|
129
155
|
listGrantsExpiredBy(orgId: string, now: Date, limit: number, afterId?: string): Promise<Entitlement[]>;
|
|
@@ -131,11 +157,11 @@ interface EntitlementsRepository {
|
|
|
131
157
|
listGrantsEndingBetween(orgId: string, after: Date, until: Date, limit: number, afterKey?: EndingGrantKey): Promise<EndingGrant[]>;
|
|
132
158
|
orgIdsWithDueNotices(now: Date, until: Date): Promise<string[]>;
|
|
133
159
|
claimNotice(orgId: string, notice: EntitlementNotice, now: Date): Promise<boolean>;
|
|
134
|
-
|
|
135
|
-
communityMemberIds(orgId: string, communityId: string): Promise<string[]>;
|
|
160
|
+
communityMemberIds(orgId: string, communityId: string, readerIds: string[]): Promise<string[]>;
|
|
136
161
|
communityIdsOpenedFor(orgId: string, orgUserId: string): Promise<string[]>;
|
|
137
|
-
openCommunityIds(orgId: string, orgUserId: string): Promise<string[]>;
|
|
138
|
-
|
|
162
|
+
openCommunityIds(orgId: string, orgUserId: string, readers: CommunityReaders): Promise<string[]>;
|
|
163
|
+
grantedOrgUserIds(orgId: string, contentId: string): Promise<string[]>;
|
|
164
|
+
lockCapacity(orgId: string, contentId: string): Promise<void>;
|
|
139
165
|
}
|
|
140
166
|
/** Tx-scoped port bundle for this context's mutating use cases — every member
|
|
141
167
|
* is bound to the UnitOfWork's transaction, so the write and the event append
|
|
@@ -147,5 +173,5 @@ interface EntitlementsTxScope {
|
|
|
147
173
|
}
|
|
148
174
|
type EntitlementsUnitOfWork = UnitOfWork<EntitlementsTxScope>;
|
|
149
175
|
//#endregion
|
|
150
|
-
export { AccessFacts, CommunityAccessReader, EndingGrant, EndingGrantKey, EntitlementNotice, EntitlementsRepository, EntitlementsService, EntitlementsTxScope, EntitlementsUnitOfWork, GrantKey, GrantTarget, InsertSpaceMemberInput, OpenableSpace, SpaceAccessRule, SpaceMembersQuery };
|
|
176
|
+
export { AccessFacts, CommunityAccessReader, CommunityReaders, ContentReader, EndingGrant, EndingGrantKey, EntitlementNotice, EntitlementsRepository, EntitlementsService, EntitlementsTxScope, EntitlementsUnitOfWork, GrantKey, GrantTarget, InsertGrantInput, InsertSpaceMemberInput, OpenableSpace, PermissionHolders, RevokeGrantInput, SpaceAccessRule, SpaceMembersQuery };
|
|
151
177
|
//# sourceMappingURL=ports.d.ts.map
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import { Role } from "../types/schemas/organizations.js";
|
|
2
1
|
import { SpaceMemberStatus } from "../types/schemas/entitlements.js";
|
|
3
2
|
import "./model.js";
|
|
4
|
-
import "../organizations/index.js";
|
|
5
3
|
import { SpaceAccessRule } from "./ports.js";
|
|
6
4
|
//#region src/entitlements/rules.d.ts
|
|
7
|
-
declare function opensSpace(
|
|
8
|
-
declare function seesSpace(
|
|
9
|
-
declare function laterExpiry(a: Date | null, b: Date | null): Date | null;
|
|
5
|
+
declare function opensSpace(member: boolean, everySpace: boolean, accessRule: SpaceAccessRule, activeInSpace: boolean): boolean;
|
|
6
|
+
declare function seesSpace(everySpace: boolean, accessRule: SpaceAccessRule, status: SpaceMemberStatus | undefined): boolean;
|
|
10
7
|
//#endregion
|
|
11
|
-
export {
|
|
8
|
+
export { opensSpace, seesSpace };
|
|
12
9
|
//# sourceMappingURL=rules.d.ts.map
|
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
import { canModerate } from "../organizations/roles.js";
|
|
2
1
|
//#region src/entitlements/rules.ts
|
|
3
|
-
function opensSpace(
|
|
2
|
+
function opensSpace(member, everySpace, accessRule, activeInSpace) {
|
|
4
3
|
if (!member) return false;
|
|
5
|
-
return
|
|
4
|
+
return everySpace || accessRule === "all_members" || activeInSpace;
|
|
6
5
|
}
|
|
7
|
-
function seesSpace(
|
|
8
|
-
return
|
|
9
|
-
}
|
|
10
|
-
function laterExpiry(a, b) {
|
|
11
|
-
if (a === null || b === null) return null;
|
|
12
|
-
return a.getTime() >= b.getTime() ? a : b;
|
|
6
|
+
function seesSpace(everySpace, accessRule, status) {
|
|
7
|
+
return everySpace || accessRule !== "by_invite" || status !== void 0 && status !== "revoked";
|
|
13
8
|
}
|
|
14
9
|
//#endregion
|
|
15
|
-
export {
|
|
10
|
+
export { opensSpace, seesSpace };
|
|
16
11
|
|
|
17
12
|
//# sourceMappingURL=rules.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rules.js","names":[],"sources":["../../src/entitlements/rules.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"rules.js","names":[],"sources":["../../src/entitlements/rules.ts"],"sourcesContent":["import type { SpaceAccessRule } from './ports.js';\nimport type { SpaceMemberStatus } from './model.js';\n\nexport function opensSpace(\n member: boolean,\n everySpace: boolean,\n accessRule: SpaceAccessRule,\n activeInSpace: boolean,\n): boolean {\n if (!member) {\n return false;\n }\n return everySpace || accessRule === 'all_members' || activeInSpace;\n}\n\nexport function seesSpace(\n everySpace: boolean,\n accessRule: SpaceAccessRule,\n status: SpaceMemberStatus | undefined,\n): boolean {\n return everySpace || accessRule !== 'by_invite' || (status !== undefined && status !== 'revoked');\n}\n"],"mappings":";AAGA,SAAgB,WACd,QACA,YACA,YACA,eACS;CACT,IAAI,CAAC,QACH,OAAO;CAET,OAAO,cAAc,eAAe,iBAAiB;AACvD;AAEA,SAAgB,UACd,YACA,YACA,QACS;CACT,OAAO,cAAc,eAAe,eAAgB,WAAW,KAAA,KAAa,WAAW;AACzF"}
|