@headless-lms/core 0.3.0 → 0.5.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 +24 -18
- package/dist/assets/file-urls.d.ts +11 -7
- package/dist/assets/file-urls.js +14 -4
- package/dist/assets/file-urls.js.map +1 -1
- package/dist/assets/index.d.ts +5 -4
- package/dist/assets/index.js +4 -3
- package/dist/assets/jobs.d.ts +15 -0
- package/dist/assets/jobs.js +30 -0
- package/dist/assets/jobs.js.map +1 -0
- package/dist/assets/ports.d.ts +37 -17
- package/dist/assets/service.d.ts +30 -15
- package/dist/assets/service.js +229 -59
- package/dist/assets/service.js.map +1 -1
- package/dist/automations/actions.js +2 -63
- package/dist/automations/actions.js.map +1 -1
- package/dist/automations/catalog.d.ts +1 -2
- package/dist/automations/catalog.js +137 -65
- package/dist/automations/catalog.js.map +1 -1
- package/dist/automations/community-derivations.js +20 -20
- package/dist/automations/community-derivations.js.map +1 -1
- package/dist/automations/community-mail.d.ts +36 -20
- package/dist/automations/community-mail.js +32 -24
- 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/events.d.ts +0 -10
- package/dist/automations/index.d.ts +12 -4
- package/dist/automations/index.js +9 -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.d.ts +25 -0
- package/dist/automations/notifications/debounce.js +93 -0
- package/dist/automations/notifications/debounce.js.map +1 -0
- package/dist/automations/notifications/defaults.d.ts +8 -0
- package/dist/automations/notifications/defaults.js +346 -0
- package/dist/automations/notifications/defaults.js.map +1 -0
- package/dist/automations/notifications/delivery.d.ts +28 -0
- package/dist/automations/notifications/delivery.js +88 -0
- package/dist/automations/notifications/delivery.js.map +1 -0
- package/dist/automations/notifications/processor.d.ts +64 -0
- package/dist/automations/notifications/processor.js +270 -0
- package/dist/automations/notifications/processor.js.map +1 -0
- package/dist/automations/notifications/rules/content.d.ts +6 -0
- package/dist/automations/notifications/rules/content.js +96 -0
- package/dist/automations/notifications/rules/content.js.map +1 -0
- package/dist/automations/notifications/rules/discussion.d.ts +7 -0
- package/dist/automations/notifications/rules/discussion.js +678 -0
- package/dist/automations/notifications/rules/discussion.js.map +1 -0
- package/dist/automations/notifications/rules/entitlements.d.ts +6 -0
- package/dist/automations/notifications/rules/entitlements.js +276 -0
- package/dist/automations/notifications/rules/entitlements.js.map +1 -0
- 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/index.d.ts +6 -0
- package/dist/automations/notifications/rules/index.js +15 -0
- package/dist/automations/notifications/rules/index.js.map +1 -0
- package/dist/automations/notifications/rules/organizations.d.ts +6 -0
- package/dist/automations/notifications/rules/organizations.js +35 -0
- package/dist/automations/notifications/rules/organizations.js.map +1 -0
- package/dist/automations/notifications/rules/recipients.d.ts +32 -0
- package/dist/automations/notifications/rules/recipients.js +98 -0
- package/dist/automations/notifications/rules/recipients.js.map +1 -0
- package/dist/automations/notifications/service.d.ts +29 -0
- package/dist/automations/notifications/service.js +45 -0
- package/dist/automations/notifications/service.js.map +1 -0
- package/dist/automations/notifications/types.d.ts +7 -0
- package/dist/automations/notifications/types.js +560 -0
- package/dist/automations/notifications/types.js.map +1 -0
- package/dist/automations/ports.d.ts +134 -21
- package/dist/automations/service.d.ts +30 -30
- package/dist/automations/service.js +111 -144
- 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 +437 -46
- package/dist/content/events.js +45 -1
- package/dist/content/events.js.map +1 -1
- package/dist/content/index.d.ts +8 -4
- package/dist/content/index.js +5 -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 +37 -0
- package/dist/content/notification-categories.js +73 -0
- package/dist/content/notification-categories.js.map +1 -0
- package/dist/content/ports.d.ts +132 -68
- package/dist/content/service.d.ts +100 -68
- package/dist/content/service.js +703 -146
- package/dist/content/service.js.map +1 -1
- package/dist/content/titles.d.ts +25 -0
- package/dist/content/titles.js +82 -0
- package/dist/content/titles.js.map +1 -0
- 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 +63 -39
- package/dist/discussion/chats.js +455 -190
- package/dist/discussion/chats.js.map +1 -1
- package/dist/discussion/digests.d.ts +24 -0
- package/dist/discussion/digests.js +104 -0
- package/dist/discussion/digests.js.map +1 -0
- package/dist/discussion/events.d.ts +227 -23
- package/dist/discussion/events.js +114 -19
- package/dist/discussion/events.js.map +1 -1
- package/dist/discussion/index.d.ts +12 -4
- package/dist/discussion/index.js +9 -2
- package/dist/discussion/jobs.d.ts +16 -0
- package/dist/discussion/jobs.js +40 -0
- package/dist/discussion/jobs.js.map +1 -0
- 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.d.ts +11 -0
- package/dist/discussion/mentions.js +35 -0
- package/dist/discussion/mentions.js.map +1 -0
- package/dist/discussion/ports.d.ts +279 -114
- package/dist/discussion/ports.js.map +1 -1
- package/dist/discussion/posts.d.ts +60 -44
- package/dist/discussion/posts.js +453 -287
- 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 +50 -35
- package/dist/discussion/service.js +333 -205
- package/dist/discussion/service.js.map +1 -1
- package/dist/discussion/subscriptions.d.ts +37 -0
- package/dist/discussion/subscriptions.js +115 -0
- package/dist/discussion/subscriptions.js.map +1 -0
- package/dist/discussion/titles.d.ts +28 -0
- package/dist/discussion/titles.js +98 -0
- package/dist/discussion/titles.js.map +1 -0
- package/dist/entitlements/events.d.ts +20 -20
- package/dist/entitlements/index.d.ts +5 -4
- package/dist/entitlements/index.js +3 -2
- package/dist/entitlements/jobs.d.ts +12 -0
- package/dist/entitlements/jobs.js +18 -0
- package/dist/entitlements/jobs.js.map +1 -0
- package/dist/entitlements/model.d.ts +2 -2
- package/dist/entitlements/ports.d.ts +68 -38
- 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 +43 -28
- package/dist/entitlements/service.js +387 -160
- package/dist/entitlements/service.js.map +1 -1
- package/dist/identity/devices.d.ts +30 -0
- package/dist/identity/devices.js +109 -0
- package/dist/identity/devices.js.map +1 -0
- package/dist/identity/index.d.ts +6 -5
- package/dist/identity/index.js +4 -3
- package/dist/identity/model.d.ts +2 -2
- package/dist/identity/notification-settings.d.ts +28 -0
- package/dist/identity/notification-settings.js +114 -0
- package/dist/identity/notification-settings.js.map +1 -0
- package/dist/identity/ports.d.ts +80 -56
- package/dist/identity/service.d.ts +8 -7
- package/dist/identity/service.js +17 -13
- package/dist/identity/service.js.map +1 -1
- package/dist/integrations/ports.d.ts +9 -8
- package/dist/integrations/service.d.ts +9 -8
- package/dist/integrations/service.js +33 -16
- 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 +45 -0
- package/dist/organizations/effective-permissions.js +113 -0
- package/dist/organizations/effective-permissions.js.map +1 -0
- package/dist/organizations/events.d.ts +320 -181
- package/dist/organizations/events.js +90 -18
- package/dist/organizations/events.js.map +1 -1
- package/dist/organizations/index.d.ts +15 -10
- package/dist/organizations/index.js +8 -3
- package/dist/organizations/members.d.ts +66 -8
- package/dist/organizations/members.js.map +1 -1
- 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 +34 -0
- package/dist/organizations/notification-categories.js +66 -0
- package/dist/organizations/notification-categories.js.map +1 -0
- 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 +104 -35
- package/dist/organizations/service.js +1247 -323
- 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/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 +23 -8
- 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 +80 -26
- package/dist/reporting/member/ports.d.ts +50 -28
- package/dist/reporting/member/service.d.ts +81 -35
- package/dist/reporting/member/service.js +438 -145
- package/dist/reporting/member/service.js.map +1 -1
- package/dist/shared/actor.d.ts +22 -3
- package/dist/shared/errors.d.ts +15 -2
- package/dist/shared/errors.js +21 -2
- package/dist/shared/errors.js.map +1 -1
- package/dist/shared/id.d.ts +7 -0
- package/dist/shared/id.js +8 -1
- 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/mailer.d.ts +11 -1
- package/dist/shared/mailer.js +32 -5
- package/dist/shared/mailer.js.map +1 -1
- package/dist/shared/notification-categories.d.ts +16 -0
- package/dist/shared/notification-categories.js +94 -0
- package/dist/shared/notification-categories.js.map +1 -0
- package/dist/shared/notification-settings.d.ts +14 -0
- package/dist/shared/notification-settings.js +61 -0
- package/dist/shared/notification-settings.js.map +1 -0
- package/dist/shared/ports.d.ts +68 -2
- package/dist/shared/settings.d.ts +2 -1
- package/dist/shared/settings.js +1 -0
- package/dist/shared/settings.js.map +1 -1
- package/dist/types/automations.d.ts +8 -2
- package/dist/types/content.d.ts +2 -2
- package/dist/types/discussion.d.ts +4 -5
- package/dist/types/email-templates.d.ts +119 -6
- package/dist/types/entitlements.d.ts +2 -2
- package/dist/types/identity.d.ts +14 -17
- package/dist/types/index.d.ts +13 -12
- package/dist/types/index.js +2 -1
- package/dist/types/notifications.d.ts +157 -0
- package/dist/types/notifications.js +1 -0
- 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/automations.d.ts +1 -10
- package/dist/types/schemas/automations.js +1 -3
- package/dist/types/schemas/automations.js.map +1 -1
- package/dist/types/schemas/content.d.ts +596 -11
- package/dist/types/schemas/content.js +225 -9
- package/dist/types/schemas/content.js.map +1 -1
- package/dist/types/schemas/discussion.d.ts +362 -66
- package/dist/types/schemas/discussion.js +123 -15
- package/dist/types/schemas/discussion.js.map +1 -1
- package/dist/types/schemas/entitlements.d.ts +14 -1
- package/dist/types/schemas/entitlements.js +11 -4
- package/dist/types/schemas/entitlements.js.map +1 -1
- package/dist/types/schemas/identity.d.ts +1 -85
- package/dist/types/schemas/identity.js +1 -42
- package/dist/types/schemas/identity.js.map +1 -1
- package/dist/types/schemas/index.d.ts +8 -7
- package/dist/types/schemas/index.js +8 -7
- package/dist/types/schemas/notifications.d.ts +96 -0
- package/dist/types/schemas/notifications.js +57 -0
- package/dist/types/schemas/notifications.js.map +1 -0
- package/dist/types/schemas/organizations.d.ts +96 -60
- package/dist/types/schemas/organizations.js +78 -27
- package/dist/types/schemas/organizations.js.map +1 -1
- package/dist/types/schemas/progress.d.ts +0 -1
- package/dist/types/schemas/progress.js +0 -1
- package/dist/types/schemas/progress.js.map +1 -1
- package/package.json +1 -1
- package/dist/automations/community-notifications.d.ts +0 -16
- package/dist/automations/community-notifications.js +0 -84
- package/dist/automations/community-notifications.js.map +0 -1
- package/dist/automations/seeds.d.ts +0 -17
- package/dist/automations/seeds.js +0 -235
- package/dist/automations/seeds.js.map +0 -1
- package/dist/identity/notifications.d.ts +0 -27
- package/dist/identity/notifications.js +0 -101
- package/dist/identity/notifications.js.map +0 -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
|
@@ -29,15 +29,15 @@ declare const entitlementEvents: {
|
|
|
29
29
|
}, import("zod").ZodObject<{
|
|
30
30
|
orgId: import("zod").ZodString;
|
|
31
31
|
id: import("zod").ZodString;
|
|
32
|
-
|
|
32
|
+
createdAt: import("zod").ZodCoercedDate<unknown>;
|
|
33
|
+
updatedAt: import("zod").ZodCoercedDate<unknown>;
|
|
33
34
|
status: import("zod").ZodEnum<{
|
|
34
35
|
active: "active";
|
|
35
36
|
revoked: "revoked";
|
|
36
37
|
}>;
|
|
37
|
-
|
|
38
|
-
updatedAt: import("zod").ZodCoercedDate<unknown>;
|
|
39
|
-
bundleId: import("zod").ZodNullable<import("zod").ZodString>;
|
|
38
|
+
source: import("zod").ZodString;
|
|
40
39
|
contentId: import("zod").ZodNullable<import("zod").ZodString>;
|
|
40
|
+
bundleId: import("zod").ZodNullable<import("zod").ZodString>;
|
|
41
41
|
orgUserId: import("zod").ZodString;
|
|
42
42
|
grantedAt: import("zod").ZodCoercedDate<unknown>;
|
|
43
43
|
expiresAt: import("zod").ZodNullable<import("zod").ZodCoercedDate<unknown>>;
|
|
@@ -69,15 +69,15 @@ declare const entitlementEvents: {
|
|
|
69
69
|
}, import("zod").ZodObject<{
|
|
70
70
|
orgId: import("zod").ZodString;
|
|
71
71
|
id: import("zod").ZodString;
|
|
72
|
-
|
|
72
|
+
createdAt: import("zod").ZodCoercedDate<unknown>;
|
|
73
|
+
updatedAt: import("zod").ZodCoercedDate<unknown>;
|
|
73
74
|
status: import("zod").ZodEnum<{
|
|
74
75
|
active: "active";
|
|
75
76
|
revoked: "revoked";
|
|
76
77
|
}>;
|
|
77
|
-
|
|
78
|
-
updatedAt: import("zod").ZodCoercedDate<unknown>;
|
|
79
|
-
bundleId: import("zod").ZodNullable<import("zod").ZodString>;
|
|
78
|
+
source: import("zod").ZodString;
|
|
80
79
|
contentId: import("zod").ZodNullable<import("zod").ZodString>;
|
|
80
|
+
bundleId: import("zod").ZodNullable<import("zod").ZodString>;
|
|
81
81
|
orgUserId: import("zod").ZodString;
|
|
82
82
|
grantedAt: import("zod").ZodCoercedDate<unknown>;
|
|
83
83
|
expiresAt: import("zod").ZodNullable<import("zod").ZodCoercedDate<unknown>>;
|
|
@@ -109,15 +109,15 @@ declare const entitlementEvents: {
|
|
|
109
109
|
}, import("zod").ZodObject<{
|
|
110
110
|
orgId: import("zod").ZodString;
|
|
111
111
|
id: import("zod").ZodString;
|
|
112
|
-
|
|
112
|
+
createdAt: import("zod").ZodCoercedDate<unknown>;
|
|
113
|
+
updatedAt: import("zod").ZodCoercedDate<unknown>;
|
|
113
114
|
status: import("zod").ZodEnum<{
|
|
114
115
|
active: "active";
|
|
115
116
|
revoked: "revoked";
|
|
116
117
|
}>;
|
|
117
|
-
|
|
118
|
-
updatedAt: import("zod").ZodCoercedDate<unknown>;
|
|
119
|
-
bundleId: import("zod").ZodNullable<import("zod").ZodString>;
|
|
118
|
+
source: import("zod").ZodString;
|
|
120
119
|
contentId: import("zod").ZodNullable<import("zod").ZodString>;
|
|
120
|
+
bundleId: import("zod").ZodNullable<import("zod").ZodString>;
|
|
121
121
|
orgUserId: import("zod").ZodString;
|
|
122
122
|
grantedAt: import("zod").ZodCoercedDate<unknown>;
|
|
123
123
|
expiresAt: import("zod").ZodNullable<import("zod").ZodCoercedDate<unknown>>;
|
|
@@ -149,15 +149,15 @@ declare const entitlementEvents: {
|
|
|
149
149
|
}, import("zod").ZodObject<{
|
|
150
150
|
orgId: import("zod").ZodString;
|
|
151
151
|
id: import("zod").ZodString;
|
|
152
|
-
|
|
152
|
+
createdAt: import("zod").ZodCoercedDate<unknown>;
|
|
153
|
+
updatedAt: import("zod").ZodCoercedDate<unknown>;
|
|
153
154
|
status: import("zod").ZodEnum<{
|
|
154
155
|
active: "active";
|
|
155
156
|
revoked: "revoked";
|
|
156
157
|
}>;
|
|
157
|
-
|
|
158
|
-
updatedAt: import("zod").ZodCoercedDate<unknown>;
|
|
159
|
-
bundleId: import("zod").ZodNullable<import("zod").ZodString>;
|
|
158
|
+
source: import("zod").ZodString;
|
|
160
159
|
contentId: import("zod").ZodNullable<import("zod").ZodString>;
|
|
160
|
+
bundleId: import("zod").ZodNullable<import("zod").ZodString>;
|
|
161
161
|
orgUserId: import("zod").ZodString;
|
|
162
162
|
grantedAt: import("zod").ZodCoercedDate<unknown>;
|
|
163
163
|
expiresAt: import("zod").ZodNullable<import("zod").ZodCoercedDate<unknown>>;
|
|
@@ -191,15 +191,15 @@ declare const entitlementEvents: {
|
|
|
191
191
|
}, import("zod").ZodObject<{
|
|
192
192
|
orgId: import("zod").ZodString;
|
|
193
193
|
id: import("zod").ZodString;
|
|
194
|
-
|
|
194
|
+
createdAt: import("zod").ZodCoercedDate<unknown>;
|
|
195
|
+
updatedAt: import("zod").ZodCoercedDate<unknown>;
|
|
195
196
|
status: import("zod").ZodEnum<{
|
|
196
197
|
active: "active";
|
|
197
198
|
revoked: "revoked";
|
|
198
199
|
}>;
|
|
199
|
-
|
|
200
|
-
updatedAt: import("zod").ZodCoercedDate<unknown>;
|
|
201
|
-
bundleId: import("zod").ZodNullable<import("zod").ZodString>;
|
|
200
|
+
source: import("zod").ZodString;
|
|
202
201
|
contentId: import("zod").ZodNullable<import("zod").ZodString>;
|
|
202
|
+
bundleId: import("zod").ZodNullable<import("zod").ZodString>;
|
|
203
203
|
orgUserId: import("zod").ZodString;
|
|
204
204
|
grantedAt: import("zod").ZodCoercedDate<unknown>;
|
|
205
205
|
expiresAt: import("zod").ZodNullable<import("zod").ZodCoercedDate<unknown>>;
|
|
@@ -1,8 +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";
|
|
8
|
-
|
|
7
|
+
import { opensSpace, seesSpace } from "./rules.js";
|
|
8
|
+
import { GRANTS_EXPIRE_JOB, entitlementsJobs, entitlementsRecurringJobs } from "./jobs.js";
|
|
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,4 +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, opensSpace, seesSpace };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RecurringJob, ScheduledJob } from "../shared/ports.js";
|
|
2
|
+
import { EntitlementsService } from "./ports.js";
|
|
3
|
+
//#region src/entitlements/jobs.d.ts
|
|
4
|
+
declare const GRANTS_EXPIRE_JOB = "entitlements.grants.expire";
|
|
5
|
+
interface EntitlementsJobDeps {
|
|
6
|
+
grants: Pick<EntitlementsService, 'expireDueGrants'>;
|
|
7
|
+
}
|
|
8
|
+
declare function entitlementsJobs(deps: EntitlementsJobDeps): ScheduledJob[];
|
|
9
|
+
declare const entitlementsRecurringJobs: RecurringJob[];
|
|
10
|
+
//#endregion
|
|
11
|
+
export { EntitlementsJobDeps, GRANTS_EXPIRE_JOB, entitlementsJobs, entitlementsRecurringJobs };
|
|
12
|
+
//# sourceMappingURL=jobs.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region src/entitlements/jobs.ts
|
|
2
|
+
const GRANTS_EXPIRE_JOB = "entitlements.grants.expire";
|
|
3
|
+
function entitlementsJobs(deps) {
|
|
4
|
+
return [{
|
|
5
|
+
job: GRANTS_EXPIRE_JOB,
|
|
6
|
+
async run(_payload, fire) {
|
|
7
|
+
await deps.grants.expireDueGrants(fire.startedAt);
|
|
8
|
+
}
|
|
9
|
+
}];
|
|
10
|
+
}
|
|
11
|
+
const entitlementsRecurringJobs = [{
|
|
12
|
+
job: GRANTS_EXPIRE_JOB,
|
|
13
|
+
cron: "0 * * * *"
|
|
14
|
+
}];
|
|
15
|
+
//#endregion
|
|
16
|
+
export { GRANTS_EXPIRE_JOB, entitlementsJobs, entitlementsRecurringJobs };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=jobs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jobs.js","names":[],"sources":["../../src/entitlements/jobs.ts"],"sourcesContent":["import type { RecurringJob, ScheduledJob } from '../shared/ports.js';\nimport type { EntitlementsService } from './ports.js';\n\nexport const GRANTS_EXPIRE_JOB = 'entitlements.grants.expire';\n\nexport interface EntitlementsJobDeps {\n grants: Pick<EntitlementsService, 'expireDueGrants'>;\n}\n\nexport function entitlementsJobs(deps: EntitlementsJobDeps): ScheduledJob[] {\n return [\n {\n job: GRANTS_EXPIRE_JOB,\n async run(_payload, fire) {\n await deps.grants.expireDueGrants(fire.startedAt);\n },\n },\n ];\n}\n\nexport const entitlementsRecurringJobs: RecurringJob[] = [\n { job: GRANTS_EXPIRE_JOB, cron: '0 * * * *' },\n];\n"],"mappings":";AAGA,MAAa,oBAAoB;AAMjC,SAAgB,iBAAiB,MAA2C;CAC1E,OAAO,CACL;EACE,KAAK;EACL,MAAM,IAAI,UAAU,MAAM;GACxB,MAAM,KAAK,OAAO,gBAAgB,KAAK,SAAS;EAClD;CACF,CACF;AACF;AAEA,MAAa,4BAA4C,CACvD;CAAE,KAAK;CAAmB,MAAM;AAAY,CAC9C"}
|
|
@@ -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,46 +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>>;
|
|
98
|
-
|
|
99
|
-
hasDueNotices(orgId: string, now: Date): Promise<boolean>;
|
|
121
|
+
}, actor: Actor): Promise<Page<SpaceMember>>;
|
|
122
|
+
expireDueGrants(now: Date): Promise<void>;
|
|
100
123
|
communitiesOpenedBy(orgId: string, grant: GrantTarget): Promise<string[]>;
|
|
101
124
|
communityModeratorIds(orgId: string, communityId: string): Promise<string[]>;
|
|
102
125
|
communityIdsOpenedFor(orgId: string, orgUserId: string): Promise<string[]>;
|
|
126
|
+
openCommunityIds(actor: Actor): Promise<string[]>;
|
|
127
|
+
communityMemberIds(orgId: string, communityId: string): Promise<string[]>;
|
|
128
|
+
grantedOrgUserIds(orgId: string, contentId: string): Promise<string[]>;
|
|
103
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[]>;
|
|
104
132
|
}
|
|
105
133
|
interface EntitlementsRepository {
|
|
106
134
|
list(orgId: string, query: EntitlementsQuery): Promise<Page<Entitlement>>;
|
|
107
|
-
insert(orgId: string, input:
|
|
108
|
-
insertIfAbsent(orgId: string, input: GrantEntitlementInput): Promise<Entitlement | null>;
|
|
135
|
+
insert(orgId: string, input: InsertGrantInput): Promise<Entitlement>;
|
|
109
136
|
lockGrant(orgId: string, key: GrantKey): Promise<Entitlement | null>;
|
|
110
|
-
setExpiresAt(orgId: string, id: string, expiresAt: Date | null): Promise<Entitlement | null>;
|
|
111
137
|
setStatus(orgId: string, id: string, status: 'active' | 'revoked'): Promise<Entitlement | null>;
|
|
112
138
|
hasAccess(orgId: string, orgUserId: string, contentId: string): Promise<boolean>;
|
|
113
139
|
listAccessibleContent(orgId: string, orgUserId: string, type?: ContentType): Promise<string[]>;
|
|
114
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>;
|
|
115
143
|
communitiesOpenedBy(orgId: string, grant: GrantTarget): Promise<string[]>;
|
|
116
144
|
accessAmong(orgId: string, communityId: string, spaceId: string | null, orgUserIds: string[]): Promise<AccessFacts[]>;
|
|
117
145
|
findSpaceMember(orgId: string, spaceId: string, orgUserId: string): Promise<SpaceMember | null>;
|
|
@@ -121,17 +149,19 @@ interface EntitlementsRepository {
|
|
|
121
149
|
insertSpaceMember(orgId: string, input: InsertSpaceMemberInput): Promise<SpaceMember>;
|
|
122
150
|
updateSpaceMemberStatus(orgId: string, id: string, status: SpaceMemberStatus): Promise<SpaceMember | null>;
|
|
123
151
|
deleteSpaceMember(orgId: string, id: string): Promise<void>;
|
|
124
|
-
countActiveSpaceMembers(orgId: string, spaceId: string): Promise<number>;
|
|
152
|
+
countActiveSpaceMembers(orgId: string, spaceId: string, excluding: string[]): Promise<number>;
|
|
125
153
|
activeSpaceIds(orgId: string, orgUserId: string, communityId: string): Promise<string[]>;
|
|
126
154
|
/** Expired grants with no expiry notice, in id order, after `afterId` when given. */
|
|
127
155
|
listGrantsExpiredBy(orgId: string, now: Date, limit: number, afterId?: string): Promise<Entitlement[]>;
|
|
128
156
|
/** Grants ending in the window with no notice, in (grant id, community id) order, after `afterKey`. */
|
|
129
157
|
listGrantsEndingBetween(orgId: string, after: Date, until: Date, limit: number, afterKey?: EndingGrantKey): Promise<EndingGrant[]>;
|
|
130
|
-
|
|
158
|
+
orgIdsWithDueNotices(now: Date, until: Date): Promise<string[]>;
|
|
131
159
|
claimNotice(orgId: string, notice: EntitlementNotice, now: Date): Promise<boolean>;
|
|
132
|
-
|
|
133
|
-
communityMemberIds(orgId: string, communityId: string): Promise<string[]>;
|
|
160
|
+
communityMemberIds(orgId: string, communityId: string, readerIds: string[]): Promise<string[]>;
|
|
134
161
|
communityIdsOpenedFor(orgId: string, orgUserId: string): Promise<string[]>;
|
|
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>;
|
|
135
165
|
}
|
|
136
166
|
/** Tx-scoped port bundle for this context's mutating use cases — every member
|
|
137
167
|
* is bound to the UnitOfWork's transaction, so the write and the event append
|
|
@@ -143,5 +173,5 @@ interface EntitlementsTxScope {
|
|
|
143
173
|
}
|
|
144
174
|
type EntitlementsUnitOfWork = UnitOfWork<EntitlementsTxScope>;
|
|
145
175
|
//#endregion
|
|
146
|
-
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 };
|
|
147
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"}
|
|
@@ -2,17 +2,17 @@ import { Page } from "../types/shared.js";
|
|
|
2
2
|
import { Logger } from "../types/ports.js";
|
|
3
3
|
import { ContentType, Space } from "../types/schemas/content.js";
|
|
4
4
|
import { Entitlement, EntitlementsQuery, GrantEntitlementInput, SpaceMember } from "../types/schemas/entitlements.js";
|
|
5
|
-
import "../shared/ports.js";
|
|
6
5
|
import { Actor } from "../shared/actor.js";
|
|
7
|
-
import
|
|
6
|
+
import "../shared/ports.js";
|
|
8
7
|
import "../content/index.js";
|
|
9
8
|
import "./model.js";
|
|
10
|
-
import { EntitlementsRepository, EntitlementsService, EntitlementsUnitOfWork, GrantTarget, OpenableSpace } from "./ports.js";
|
|
9
|
+
import { ContentReader, EntitlementsRepository, EntitlementsService, EntitlementsUnitOfWork, GrantTarget, OpenableSpace, PermissionHolders, RevokeGrantInput } from "./ports.js";
|
|
11
10
|
//#region src/entitlements/service.d.ts
|
|
12
11
|
type EntitlementsServiceParams = {
|
|
13
12
|
/** Read-only access (list) — runs outside any transaction. */
|
|
14
13
|
repo: EntitlementsRepository;
|
|
15
|
-
content:
|
|
14
|
+
content: ContentReader;
|
|
15
|
+
permissions: PermissionHolders;
|
|
16
16
|
/** Atomic write scope: tx-bound repo + outbox appender. */
|
|
17
17
|
uow: EntitlementsUnitOfWork;
|
|
18
18
|
logger?: Logger;
|
|
@@ -20,49 +20,64 @@ type EntitlementsServiceParams = {
|
|
|
20
20
|
declare class EntitlementsServiceImpl implements EntitlementsService {
|
|
21
21
|
private readonly repo;
|
|
22
22
|
private readonly content;
|
|
23
|
+
private readonly permissions;
|
|
23
24
|
private readonly uow;
|
|
24
25
|
private readonly logger;
|
|
25
26
|
constructor(params: EntitlementsServiceParams);
|
|
26
|
-
list(
|
|
27
|
-
grant(
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
list(query: EntitlementsQuery, actor: Actor): Promise<Page<Entitlement>>;
|
|
28
|
+
grant(input: GrantEntitlementInput, actor: Actor): Promise<Entitlement>;
|
|
29
|
+
revoke(input: RevokeGrantInput, actor: Actor): Promise<Entitlement>;
|
|
30
|
+
private grantEvent;
|
|
31
|
+
private assertCanRegister;
|
|
32
|
+
private requireAttendeeManager;
|
|
33
|
+
private assertPlace;
|
|
34
|
+
private sourceOf;
|
|
35
|
+
private actorMetadata;
|
|
30
36
|
hasAccess(orgId: string, orgUserId: string, contentId: string): Promise<boolean>;
|
|
31
37
|
listAccessibleContent(orgId: string, orgUserId: string, type?: ContentType): Promise<string[]>;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
holdsAnyGrant(orgId: string, orgUserId: string): Promise<boolean>;
|
|
39
|
+
opensEverySpace(actor: Actor, communityId: string): Promise<boolean>;
|
|
40
|
+
isCommunityMember(communityId: string, actor: Actor): Promise<boolean>;
|
|
41
|
+
canOpenSpace(spaceId: string, actor: Actor): Promise<boolean>;
|
|
42
|
+
canOpen(space: OpenableSpace, actor: Actor): Promise<boolean>;
|
|
43
|
+
spaceStandings(communityId: string, actor: Actor): Promise<Record<string, SpaceMember['status']>>;
|
|
44
|
+
openSpacesFor(communityId: string, actor: Actor): Promise<Space[]>;
|
|
45
|
+
openSpaceIds(communityId: string, actor: Actor): Promise<string[]>;
|
|
38
46
|
communityMembersAmong(orgId: string, communityId: string, orgUserIds: string[]): Promise<string[]>;
|
|
39
47
|
spaceOpenersAmong(orgId: string, spaceId: string, orgUserIds: string[]): Promise<string[]>;
|
|
40
48
|
spaceOpeners(orgId: string, spaceId: string): Promise<string[]>;
|
|
41
49
|
communitiesOpenedBy(orgId: string, grant: GrantTarget): Promise<string[]>;
|
|
42
50
|
communityModeratorIds(orgId: string, communityId: string): Promise<string[]>;
|
|
43
51
|
communityIdsOpenedFor(orgId: string, orgUserId: string): Promise<string[]>;
|
|
52
|
+
openCommunityIds(actor: Actor): Promise<string[]>;
|
|
53
|
+
communityMemberIds(orgId: string, communityId: string): Promise<string[]>;
|
|
54
|
+
grantedOrgUserIds(orgId: string, contentId: string): Promise<string[]>;
|
|
44
55
|
countActiveSpaceMembers(orgId: string, spaceId: string): Promise<number>;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
56
|
+
everySpaceOpeners(orgId: string, communityId: string): Promise<string[]>;
|
|
57
|
+
requestJoin(communityId: string, spaceId: string, actor: Actor): Promise<SpaceMember>;
|
|
58
|
+
invite(communityId: string, spaceId: string, orgUserId: string, actor: Actor): Promise<SpaceMember>;
|
|
59
|
+
addSpaceMember(communityId: string, spaceId: string, orgUserId: string, actor: Actor): Promise<SpaceMember>;
|
|
60
|
+
accept(communityId: string, spaceId: string, actor: Actor): Promise<SpaceMember>;
|
|
61
|
+
approve(communityId: string, spaceId: string, orgUserId: string, actor: Actor): Promise<SpaceMember>;
|
|
62
|
+
decline(communityId: string, spaceId: string, orgUserId: string, actor: Actor): Promise<SpaceMember>;
|
|
63
|
+
refuse(communityId: string, spaceId: string, actor: Actor): Promise<SpaceMember>;
|
|
64
|
+
leave(communityId: string, spaceId: string, actor: Actor): Promise<SpaceMember>;
|
|
65
|
+
remove(communityId: string, spaceId: string, orgUserId: string, actor: Actor): Promise<SpaceMember>;
|
|
66
|
+
listSpaceMembers(communityId: string, spaceId: string, query: {
|
|
55
67
|
page: number;
|
|
56
68
|
pageSize: number;
|
|
57
|
-
}): Promise<Page<SpaceMember>>;
|
|
58
|
-
|
|
59
|
-
|
|
69
|
+
}, actor: Actor): Promise<Page<SpaceMember>>;
|
|
70
|
+
expireDueGrants(now: Date): Promise<void>;
|
|
71
|
+
private expireDueIn;
|
|
72
|
+
private system;
|
|
73
|
+
private teamOf;
|
|
74
|
+
private standingOf;
|
|
60
75
|
private requireSpaceIn;
|
|
61
76
|
private requireVisibleSpaceIn;
|
|
62
77
|
private assertHasMembers;
|
|
63
78
|
private assertRule;
|
|
64
79
|
private assertHolder;
|
|
65
|
-
private
|
|
80
|
+
private assertMember;
|
|
66
81
|
private assertHolds;
|
|
67
82
|
private assertCanManage;
|
|
68
83
|
private accessOf;
|