@echovisionlab/geul-proto 0.1.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.
Files changed (120) hide show
  1. package/LICENSE.md +6 -0
  2. package/README.md +6 -0
  3. package/eslint.config.mjs +15 -0
  4. package/gen/api/common/v1/common_pb.ts +391 -0
  5. package/gen/api/common/v1/media_pb.ts +578 -0
  6. package/gen/api/content/v1/block_catalog.ts +5978 -0
  7. package/gen/api/content/v1/block_content_pb.ts +11420 -0
  8. package/gen/api/intra/v1/artist_pb.ts +597 -0
  9. package/gen/api/intra/v1/campaign_pb.ts +383 -0
  10. package/gen/api/intra/v1/collaboration_pb.ts +661 -0
  11. package/gen/api/intra/v1/email_courier_pb.ts +98 -0
  12. package/gen/api/intra/v1/email_layout_pb.ts +295 -0
  13. package/gen/api/intra/v1/email_template_pb.ts +384 -0
  14. package/gen/api/intra/v1/file_ingest_pb.ts +144 -0
  15. package/gen/api/intra/v1/form_locale_catalog.ts +128 -0
  16. package/gen/api/intra/v1/form_locale_catalog_parity.json +24 -0
  17. package/gen/api/intra/v1/form_pb.ts +276 -0
  18. package/gen/api/intra/v1/gateway_authorization_pb.ts +96 -0
  19. package/gen/api/intra/v1/label_pb.ts +558 -0
  20. package/gen/api/intra/v1/map_pb.ts +382 -0
  21. package/gen/api/intra/v1/menu_pb.ts +282 -0
  22. package/gen/api/intra/v1/og_pb.ts +335 -0
  23. package/gen/api/intra/v1/page_pb.ts +572 -0
  24. package/gen/api/intra/v1/post_pb.ts +657 -0
  25. package/gen/api/intra/v1/post_series_pb.ts +217 -0
  26. package/gen/api/intra/v1/privacy_pb.ts +384 -0
  27. package/gen/api/intra/v1/program_event_pb.ts +390 -0
  28. package/gen/api/intra/v1/release_pb.ts +462 -0
  29. package/gen/api/intra/v1/terms_pb.ts +384 -0
  30. package/gen/api/intra/v1/work_pb.ts +477 -0
  31. package/gen/api/manage/v1/account_pb.ts +1311 -0
  32. package/gen/api/manage/v1/admin_pb.ts +681 -0
  33. package/gen/api/manage/v1/ai_pb.ts +2621 -0
  34. package/gen/api/manage/v1/artist_pb.ts +1271 -0
  35. package/gen/api/manage/v1/audience_pb.ts +597 -0
  36. package/gen/api/manage/v1/campaign_pb.ts +1289 -0
  37. package/gen/api/manage/v1/category_pb.ts +351 -0
  38. package/gen/api/manage/v1/client_pb.ts +512 -0
  39. package/gen/api/manage/v1/collaboration_pb.ts +112 -0
  40. package/gen/api/manage/v1/comment_pb.ts +530 -0
  41. package/gen/api/manage/v1/common_pb.ts +192 -0
  42. package/gen/api/manage/v1/email_layout_pb.ts +487 -0
  43. package/gen/api/manage/v1/email_suppression_pb.ts +192 -0
  44. package/gen/api/manage/v1/email_template_pb.ts +683 -0
  45. package/gen/api/manage/v1/events_pb.ts +3251 -0
  46. package/gen/api/manage/v1/file_pb.ts +2810 -0
  47. package/gen/api/manage/v1/form_pb.ts +1046 -0
  48. package/gen/api/manage/v1/format_pb.ts +321 -0
  49. package/gen/api/manage/v1/genre_pb.ts +340 -0
  50. package/gen/api/manage/v1/label_pb.ts +1105 -0
  51. package/gen/api/manage/v1/mail_adapter_pb.ts +656 -0
  52. package/gen/api/manage/v1/map_place_pb.ts +572 -0
  53. package/gen/api/manage/v1/map_theme_pb.ts +691 -0
  54. package/gen/api/manage/v1/member_pb.ts +1281 -0
  55. package/gen/api/manage/v1/menu_pb.ts +535 -0
  56. package/gen/api/manage/v1/page_pb.ts +894 -0
  57. package/gen/api/manage/v1/post_pb.ts +1475 -0
  58. package/gen/api/manage/v1/privacy_pb.ts +518 -0
  59. package/gen/api/manage/v1/program_event_pb.ts +2234 -0
  60. package/gen/api/manage/v1/release_pb.ts +1168 -0
  61. package/gen/api/manage/v1/series_pb.ts +1033 -0
  62. package/gen/api/manage/v1/share_link_pb.ts +351 -0
  63. package/gen/api/manage/v1/site_setting_pb.ts +623 -0
  64. package/gen/api/manage/v1/style_pb.ts +340 -0
  65. package/gen/api/manage/v1/tag_pb.ts +323 -0
  66. package/gen/api/manage/v1/terms_pb.ts +517 -0
  67. package/gen/api/manage/v1/track_pb.ts +543 -0
  68. package/gen/api/manage/v1/translation_pb.ts +1838 -0
  69. package/gen/api/manage/v1/work_pb.ts +1662 -0
  70. package/gen/api/open/v1/account_pb.ts +243 -0
  71. package/gen/api/open/v1/artist_pb.ts +732 -0
  72. package/gen/api/open/v1/category_pb.ts +143 -0
  73. package/gen/api/open/v1/client_pb.ts +190 -0
  74. package/gen/api/open/v1/file_pb.ts +244 -0
  75. package/gen/api/open/v1/form_pb.ts +698 -0
  76. package/gen/api/open/v1/label_pb.ts +512 -0
  77. package/gen/api/open/v1/manifest_pb.ts +326 -0
  78. package/gen/api/open/v1/map_place_pb.ts +228 -0
  79. package/gen/api/open/v1/map_theme_pb.ts +400 -0
  80. package/gen/api/open/v1/member_pb.ts +200 -0
  81. package/gen/api/open/v1/newsletter_pb.ts +77 -0
  82. package/gen/api/open/v1/page_pb.ts +236 -0
  83. package/gen/api/open/v1/post_pb.ts +834 -0
  84. package/gen/api/open/v1/privacy_pb.ts +257 -0
  85. package/gen/api/open/v1/program_event_pb.ts +1024 -0
  86. package/gen/api/open/v1/release_pb.ts +758 -0
  87. package/gen/api/open/v1/series_pb.ts +210 -0
  88. package/gen/api/open/v1/share_link_pb.ts +106 -0
  89. package/gen/api/open/v1/sitemap_pb.ts +188 -0
  90. package/gen/api/open/v1/tag_pb.ts +136 -0
  91. package/gen/api/open/v1/terms_pb.ts +257 -0
  92. package/gen/api/open/v1/translation_pb.ts +103 -0
  93. package/gen/api/open/v1/work_pb.ts +904 -0
  94. package/gen/api/policy/v1/access_pb.ts +105 -0
  95. package/gen/api/policy/v1/spicedb/artist.ts +101 -0
  96. package/gen/api/policy/v1/spicedb/audience.ts +64 -0
  97. package/gen/api/policy/v1/spicedb/campaign.ts +49 -0
  98. package/gen/api/policy/v1/spicedb/core.ts +196 -0
  99. package/gen/api/policy/v1/spicedb/email_authoring.ts +91 -0
  100. package/gen/api/policy/v1/spicedb/email_delivery.ts +44 -0
  101. package/gen/api/policy/v1/spicedb/file.ts +49 -0
  102. package/gen/api/policy/v1/spicedb/form.ts +54 -0
  103. package/gen/api/policy/v1/spicedb/internal.ts +350 -0
  104. package/gen/api/policy/v1/spicedb/label.ts +98 -0
  105. package/gen/api/policy/v1/spicedb/legal_policy.ts +103 -0
  106. package/gen/api/policy/v1/spicedb/map_theme.ts +48 -0
  107. package/gen/api/policy/v1/spicedb/member.ts +47 -0
  108. package/gen/api/policy/v1/spicedb/menu.ts +48 -0
  109. package/gen/api/policy/v1/spicedb/page.ts +54 -0
  110. package/gen/api/policy/v1/spicedb/post.ts +105 -0
  111. package/gen/api/policy/v1/spicedb/post_series.ts +70 -0
  112. package/gen/api/policy/v1/spicedb/program_event.ts +66 -0
  113. package/gen/api/policy/v1/spicedb/program_event_series.ts +62 -0
  114. package/gen/api/policy/v1/spicedb/reference_data.ts +209 -0
  115. package/gen/api/policy/v1/spicedb/release.ts +81 -0
  116. package/gen/api/policy/v1/spicedb/site_settings.ts +49 -0
  117. package/gen/api/policy/v1/spicedb/translation.ts +46 -0
  118. package/gen/api/policy/v1/spicedb/work.ts +58 -0
  119. package/package.json +66 -0
  120. package/tsconfig.json +15 -0
@@ -0,0 +1,49 @@
1
+ // Code generated by scripts/generated/generate-spicedb-catalog.mjs.
2
+ // DO NOT EDIT.
3
+ //
4
+ // Domain: file — File resource policy
5
+
6
+ import {
7
+ accountIdentityRelationshipSubject,
8
+ createCan,
9
+ createRelationshipMutation,
10
+ createRelationshipSnapshotPlan,
11
+ createResource,
12
+ platformRelationshipSubject,
13
+ RelationshipOperation,
14
+ resourceRelationshipSubject,
15
+ } from "./internal.ts";
16
+ import type {
17
+ Actor,
18
+ Can,
19
+ RelationshipMutation,
20
+ RelationshipSnapshotPlan,
21
+ Resource,
22
+ } from "./internal.ts";
23
+
24
+ export const File = Object.freeze({
25
+ Resource: (id: string): Resource => createResource("file", id),
26
+ View: (id: string): Can => createCan("file", id, "view", "view"),
27
+ Edit: (id: string): Can => createCan("file", id, "edit", "edit"),
28
+ Delete: (id: string): Can => createCan("file", id, "delete", "delete"),
29
+ Manage: (id: string): Can => createCan("file", id, "manage", "manage"),
30
+ ManageLibrary: (): Can =>
31
+ createCan("platform", "global", "file.manage_library", "is_admin"),
32
+ List: (): Can => createCan("platform", "global", "file.list", "is_author"),
33
+ Snapshot: (id: string): RelationshipSnapshotPlan =>
34
+ createRelationshipSnapshotPlan("file", id, "platform_admin", ""),
35
+ TouchPolicy: (id: string): RelationshipMutation =>
36
+ createRelationshipMutation(
37
+ createResource("file", id),
38
+ "policy",
39
+ platformRelationshipSubject(),
40
+ RelationshipOperation.Touch,
41
+ ),
42
+ DeletePolicy: (id: string): RelationshipMutation =>
43
+ createRelationshipMutation(
44
+ createResource("file", id),
45
+ "policy",
46
+ platformRelationshipSubject(),
47
+ RelationshipOperation.Delete,
48
+ ),
49
+ });
@@ -0,0 +1,54 @@
1
+ // Code generated by scripts/generated/generate-spicedb-catalog.mjs.
2
+ // DO NOT EDIT.
3
+ //
4
+ // Domain: form — Form lifecycle and share-link policy
5
+
6
+ import {
7
+ accountIdentityRelationshipSubject,
8
+ createCan,
9
+ createRelationshipMutation,
10
+ createRelationshipSnapshotPlan,
11
+ createResource,
12
+ createResourceLookup,
13
+ platformRelationshipSubject,
14
+ RelationshipOperation,
15
+ resourceRelationshipSubject,
16
+ } from "./internal.ts";
17
+ import type {
18
+ Actor,
19
+ Can,
20
+ RelationshipMutation,
21
+ RelationshipSnapshotPlan,
22
+ Resource,
23
+ ResourceLookup,
24
+ } from "./internal.ts";
25
+
26
+ export const Form = Object.freeze({
27
+ Resource: (id: string): Resource => createResource("form", id),
28
+ LookupManage: (): ResourceLookup => createResourceLookup("form", "manage"),
29
+ View: (id: string): Can => createCan("form", id, "view", "view"),
30
+ Edit: (id: string): Can => createCan("form", id, "edit", "edit"),
31
+ Delete: (id: string): Can => createCan("form", id, "delete", "delete"),
32
+ Publish: (id: string): Can => createCan("form", id, "publish", "publish"),
33
+ Manage: (id: string): Can => createCan("form", id, "manage", "manage"),
34
+ ManageShareLinks: (id: string): Can =>
35
+ createCan("form", id, "manage_share_links", "manage_share_links"),
36
+ Create: (): Can => createCan("platform", "global", "form.create", "is_admin"),
37
+ List: (): Can => createCan("platform", "global", "form.list", "is_admin"),
38
+ Snapshot: (id: string): RelationshipSnapshotPlan =>
39
+ createRelationshipSnapshotPlan("form", id, "platform_admin", ""),
40
+ TouchPolicy: (id: string): RelationshipMutation =>
41
+ createRelationshipMutation(
42
+ createResource("form", id),
43
+ "policy",
44
+ platformRelationshipSubject(),
45
+ RelationshipOperation.Touch,
46
+ ),
47
+ DeletePolicy: (id: string): RelationshipMutation =>
48
+ createRelationshipMutation(
49
+ createResource("form", id),
50
+ "policy",
51
+ platformRelationshipSubject(),
52
+ RelationshipOperation.Delete,
53
+ ),
54
+ });
@@ -0,0 +1,350 @@
1
+ // Code generated by scripts/generated/generate-spicedb-catalog.mjs.
2
+ // DO NOT EDIT.
3
+ // This implementation module is intentionally absent from package exports.
4
+
5
+ export const DelegationKind = Object.freeze({
6
+ DirectSession: "direct_session",
7
+ MCPOAuth: "mcp_oauth",
8
+ } as const);
9
+ export type DelegationKind =
10
+ (typeof DelegationKind)[keyof typeof DelegationKind];
11
+
12
+ export const RelationshipOperation = Object.freeze({
13
+ Touch: "touch",
14
+ Delete: "delete",
15
+ } as const);
16
+ export type RelationshipOperation =
17
+ (typeof RelationshipOperation)[keyof typeof RelationshipOperation];
18
+
19
+ class ActorDescriptor {
20
+ readonly #actorBrand = undefined;
21
+
22
+ constructor(readonly accountIdentityId: string) {}
23
+ }
24
+
25
+ class DelegationDescriptor {
26
+ readonly #delegationBrand = undefined;
27
+
28
+ constructor(
29
+ readonly kind: DelegationKind,
30
+ readonly sessionId?: string,
31
+ readonly delegationId?: string,
32
+ readonly delegationDisplayName?: string,
33
+ ) {}
34
+ }
35
+
36
+ class ResourceDescriptor {
37
+ readonly #resourceBrand = undefined;
38
+
39
+ constructor(
40
+ readonly type: string,
41
+ readonly id: string,
42
+ ) {}
43
+ }
44
+
45
+ class ResourceLookupDescriptor {
46
+ readonly #resourceLookupBrand = undefined;
47
+
48
+ constructor(
49
+ readonly resourceType: string,
50
+ readonly permission: string,
51
+ ) {}
52
+ }
53
+
54
+ class SubjectLookupDescriptor {
55
+ readonly #subjectLookupBrand = undefined;
56
+
57
+ constructor(
58
+ readonly resourceType: string,
59
+ readonly resourceId: string,
60
+ readonly permission: string,
61
+ readonly subjectType: string,
62
+ ) {}
63
+ }
64
+
65
+ class ActionDescriptor {
66
+ readonly #actionBrand = undefined;
67
+
68
+ constructor(
69
+ readonly name: string,
70
+ readonly permission: string,
71
+ ) {}
72
+ }
73
+
74
+ class CanDescriptor {
75
+ readonly #canBrand = undefined;
76
+ readonly engineKey: string;
77
+
78
+ constructor(
79
+ readonly resource: ResourceDescriptor,
80
+ readonly action: ActionDescriptor,
81
+ ) {
82
+ this.engineKey = `${resource.type}\0${resource.id}\0${action.permission}`;
83
+ }
84
+ }
85
+
86
+ class AuthorizationDecisionDescriptor {
87
+ readonly #decisionBrand = undefined;
88
+ readonly resource: ResourceDescriptor;
89
+ readonly action: ActionDescriptor;
90
+ readonly engineKey: string;
91
+
92
+ constructor(
93
+ readonly actor: ActorDescriptor,
94
+ readonly delegation: DelegationDescriptor,
95
+ can: CanDescriptor,
96
+ ) {
97
+ this.resource = can.resource;
98
+ this.action = can.action;
99
+ this.engineKey = can.engineKey;
100
+ }
101
+ }
102
+
103
+ class RoleIDDescriptor {
104
+ readonly #roleBrand = undefined;
105
+
106
+ constructor(readonly id: string) {}
107
+ }
108
+
109
+ class RelationshipSubjectDescriptor {
110
+ readonly #relationshipSubjectBrand = undefined;
111
+
112
+ constructor(
113
+ readonly type: string,
114
+ readonly id: string,
115
+ readonly relation: string,
116
+ ) {}
117
+ }
118
+
119
+ class RelationshipMutationDescriptor {
120
+ readonly #relationshipBrand = undefined;
121
+
122
+ constructor(
123
+ readonly resource: ResourceDescriptor,
124
+ readonly relation: string,
125
+ readonly subject: RelationshipSubjectDescriptor,
126
+ readonly operation: RelationshipOperation,
127
+ ) {}
128
+ }
129
+
130
+ class RelationshipSnapshotPlanDescriptor {
131
+ readonly #relationshipSnapshotPlanBrand = undefined;
132
+
133
+ constructor(
134
+ readonly resource: ResourceDescriptor,
135
+ readonly probePermission: string,
136
+ readonly incomingParentRelation: string,
137
+ ) {}
138
+ }
139
+
140
+ export type Actor = ActorDescriptor;
141
+ export type Delegation = DelegationDescriptor;
142
+ export type Resource = ResourceDescriptor;
143
+ export type ResourceLookup = ResourceLookupDescriptor;
144
+ export type SubjectLookup = SubjectLookupDescriptor;
145
+ export type Action = ActionDescriptor;
146
+ export type Can = CanDescriptor;
147
+ export type AuthorizationDecision = AuthorizationDecisionDescriptor;
148
+ export type RoleID = RoleIDDescriptor;
149
+ type RelationshipSubject = RelationshipSubjectDescriptor;
150
+ export type RelationshipMutation = RelationshipMutationDescriptor;
151
+ export type RelationshipSnapshotPlan = RelationshipSnapshotPlanDescriptor;
152
+
153
+ function immutable<T extends object>(value: T): T {
154
+ Object.freeze(value);
155
+ return value;
156
+ }
157
+
158
+ function assertIdentifier(kind: string, value: string): void {
159
+ if (value.length === 0 || value.trim() !== value) {
160
+ throw new TypeError(`${kind} must be non-empty and trimmed`);
161
+ }
162
+ }
163
+
164
+ export function createActor(accountIdentityId: string): Actor {
165
+ assertIdentifier("account identity id", accountIdentityId);
166
+ return immutable(new ActorDescriptor(accountIdentityId));
167
+ }
168
+
169
+ export function createDelegation(
170
+ kind: DelegationKind,
171
+ values: {
172
+ readonly sessionId?: string;
173
+ readonly delegationId?: string;
174
+ readonly delegationDisplayName?: string;
175
+ },
176
+ ): Delegation {
177
+ if (kind === DelegationKind.DirectSession) {
178
+ assertIdentifier("session id", values.sessionId ?? "");
179
+ if (
180
+ values.delegationId !== undefined ||
181
+ values.delegationDisplayName !== undefined
182
+ ) {
183
+ throw new TypeError(
184
+ "direct session delegation cannot carry MCP attribution",
185
+ );
186
+ }
187
+ } else if (kind === DelegationKind.MCPOAuth) {
188
+ assertIdentifier("delegation id", values.delegationId ?? "");
189
+ assertIdentifier(
190
+ "delegation display name",
191
+ values.delegationDisplayName ?? "",
192
+ );
193
+ if (values.sessionId !== undefined) {
194
+ throw new TypeError("MCP delegation cannot carry a session id");
195
+ }
196
+ } else {
197
+ throw new TypeError("delegation kind is invalid");
198
+ }
199
+ return immutable(
200
+ new DelegationDescriptor(
201
+ kind,
202
+ values.sessionId,
203
+ values.delegationId,
204
+ values.delegationDisplayName,
205
+ ),
206
+ );
207
+ }
208
+
209
+ export function createResource(type: string, id: string): Resource {
210
+ assertIdentifier("resource type", type);
211
+ assertIdentifier("resource id", id);
212
+ return immutable(new ResourceDescriptor(type, id));
213
+ }
214
+
215
+ export function createResourceLookup(
216
+ resourceType: string,
217
+ permission: string,
218
+ ): ResourceLookup {
219
+ assertIdentifier("resource type", resourceType);
220
+ assertIdentifier("permission", permission);
221
+ return immutable(new ResourceLookupDescriptor(resourceType, permission));
222
+ }
223
+
224
+ export function createRelationshipSnapshotPlan(
225
+ resourceType: string,
226
+ resourceId: string,
227
+ probePermission: string,
228
+ incomingParentRelation: string,
229
+ ): RelationshipSnapshotPlan {
230
+ assertIdentifier("probe permission", probePermission);
231
+ if (incomingParentRelation.trim() !== incomingParentRelation) {
232
+ throw new TypeError("incoming parent relation must be trimmed");
233
+ }
234
+ return immutable(
235
+ new RelationshipSnapshotPlanDescriptor(
236
+ createResource(resourceType, resourceId),
237
+ probePermission,
238
+ incomingParentRelation,
239
+ ),
240
+ );
241
+ }
242
+
243
+ export function createSubjectLookup(
244
+ resourceType: string,
245
+ resourceId: string,
246
+ permission: string,
247
+ subjectType: string,
248
+ ): SubjectLookup {
249
+ assertIdentifier("resource type", resourceType);
250
+ assertIdentifier("resource id", resourceId);
251
+ assertIdentifier("permission", permission);
252
+ assertIdentifier("subject type", subjectType);
253
+ return immutable(
254
+ new SubjectLookupDescriptor(
255
+ resourceType,
256
+ resourceId,
257
+ permission,
258
+ subjectType,
259
+ ),
260
+ );
261
+ }
262
+
263
+ export function createCan(
264
+ resourceType: string,
265
+ resourceId: string,
266
+ actionName: string,
267
+ permission: string,
268
+ ): Can {
269
+ const resource = createResource(resourceType, resourceId);
270
+ assertIdentifier("action", actionName);
271
+ assertIdentifier("permission", permission);
272
+ const action = immutable(new ActionDescriptor(actionName, permission));
273
+ return immutable(new CanDescriptor(resource, action));
274
+ }
275
+
276
+ export function createDecision(
277
+ actor: Actor,
278
+ delegation: Delegation,
279
+ can: Can,
280
+ ): AuthorizationDecision {
281
+ if (
282
+ !(actor instanceof ActorDescriptor) ||
283
+ !(delegation instanceof DelegationDescriptor) ||
284
+ !(can instanceof CanDescriptor)
285
+ ) {
286
+ throw new TypeError(
287
+ "actor, delegation, and can must use supported constructors",
288
+ );
289
+ }
290
+ return immutable(new AuthorizationDecisionDescriptor(actor, delegation, can));
291
+ }
292
+
293
+ export function createRole(id: string): RoleID {
294
+ assertIdentifier("role id", id);
295
+ return immutable(new RoleIDDescriptor(id));
296
+ }
297
+
298
+ export function accountIdentityRelationshipSubject(
299
+ actor: Actor,
300
+ ): RelationshipSubject {
301
+ if (!(actor instanceof ActorDescriptor)) {
302
+ throw new TypeError("actor must use NewAccountIdentityActor");
303
+ }
304
+ return immutable(
305
+ new RelationshipSubjectDescriptor(
306
+ "account_identity",
307
+ actor.accountIdentityId,
308
+ "",
309
+ ),
310
+ );
311
+ }
312
+
313
+ export function platformRelationshipSubject(): RelationshipSubject {
314
+ return immutable(new RelationshipSubjectDescriptor("platform", "global", ""));
315
+ }
316
+
317
+ export function resourceRelationshipSubject(
318
+ type: string,
319
+ id: string,
320
+ relation: string,
321
+ ): RelationshipSubject {
322
+ const resource = createResource(type, id);
323
+ return immutable(
324
+ new RelationshipSubjectDescriptor(resource.type, resource.id, relation),
325
+ );
326
+ }
327
+
328
+ export function createRelationshipMutation(
329
+ resource: Resource,
330
+ relation: string,
331
+ subject: RelationshipSubject,
332
+ operation: RelationshipOperation,
333
+ ): RelationshipMutation {
334
+ if (!(resource instanceof ResourceDescriptor)) {
335
+ throw new TypeError("resource must use a domain constructor");
336
+ }
337
+ if (!(subject instanceof RelationshipSubjectDescriptor)) {
338
+ throw new TypeError("relationship subject must use a domain constructor");
339
+ }
340
+ if (
341
+ operation !== RelationshipOperation.Touch &&
342
+ operation !== RelationshipOperation.Delete
343
+ ) {
344
+ throw new TypeError("relationship operation is invalid");
345
+ }
346
+ assertIdentifier("relation", relation);
347
+ return immutable(
348
+ new RelationshipMutationDescriptor(resource, relation, subject, operation),
349
+ );
350
+ }
@@ -0,0 +1,98 @@
1
+ // Code generated by scripts/generated/generate-spicedb-catalog.mjs.
2
+ // DO NOT EDIT.
3
+ //
4
+ // Domain: label — Label ownership, management, hierarchy, and share links
5
+
6
+ import {
7
+ accountIdentityRelationshipSubject,
8
+ createCan,
9
+ createRelationshipMutation,
10
+ createRelationshipSnapshotPlan,
11
+ createResource,
12
+ platformRelationshipSubject,
13
+ RelationshipOperation,
14
+ resourceRelationshipSubject,
15
+ } from "./internal.ts";
16
+ import type {
17
+ Actor,
18
+ Can,
19
+ RelationshipMutation,
20
+ RelationshipSnapshotPlan,
21
+ Resource,
22
+ } from "./internal.ts";
23
+
24
+ export const Label = Object.freeze({
25
+ Resource: (id: string): Resource => createResource("label", id),
26
+ Edit: (id: string): Can => createCan("label", id, "edit", "edit"),
27
+ View: (id: string): Can => createCan("label", id, "view", "view"),
28
+ Delete: (id: string): Can => createCan("label", id, "delete", "delete"),
29
+ Publish: (id: string): Can => createCan("label", id, "publish", "publish"),
30
+ Manage: (id: string): Can => createCan("label", id, "manage", "manage"),
31
+ ManageParticipants: (id: string): Can =>
32
+ createCan("label", id, "manage_participants", "manage_participants"),
33
+ ManageShareLinks: (id: string): Can =>
34
+ createCan("label", id, "manage_share_links", "manage_share_links"),
35
+ RemoveOwner: (id: string): Can =>
36
+ createCan("label", id, "remove_owner", "platform_admin"),
37
+ Create: (): Can =>
38
+ createCan("platform", "global", "label.create", "is_admin"),
39
+ List: (): Can => createCan("platform", "global", "label.list", "is_admin"),
40
+ Snapshot: (id: string): RelationshipSnapshotPlan =>
41
+ createRelationshipSnapshotPlan("label", id, "platform_admin", "parent"),
42
+ TouchPolicy: (id: string): RelationshipMutation =>
43
+ createRelationshipMutation(
44
+ createResource("label", id),
45
+ "policy",
46
+ platformRelationshipSubject(),
47
+ RelationshipOperation.Touch,
48
+ ),
49
+ DeletePolicy: (id: string): RelationshipMutation =>
50
+ createRelationshipMutation(
51
+ createResource("label", id),
52
+ "policy",
53
+ platformRelationshipSubject(),
54
+ RelationshipOperation.Delete,
55
+ ),
56
+ TouchOwner: (id: string, actor: Actor): RelationshipMutation =>
57
+ createRelationshipMutation(
58
+ createResource("label", id),
59
+ "owner",
60
+ accountIdentityRelationshipSubject(actor),
61
+ RelationshipOperation.Touch,
62
+ ),
63
+ DeleteOwner: (id: string, actor: Actor): RelationshipMutation =>
64
+ createRelationshipMutation(
65
+ createResource("label", id),
66
+ "owner",
67
+ accountIdentityRelationshipSubject(actor),
68
+ RelationshipOperation.Delete,
69
+ ),
70
+ TouchManager: (id: string, actor: Actor): RelationshipMutation =>
71
+ createRelationshipMutation(
72
+ createResource("label", id),
73
+ "manager",
74
+ accountIdentityRelationshipSubject(actor),
75
+ RelationshipOperation.Touch,
76
+ ),
77
+ DeleteManager: (id: string, actor: Actor): RelationshipMutation =>
78
+ createRelationshipMutation(
79
+ createResource("label", id),
80
+ "manager",
81
+ accountIdentityRelationshipSubject(actor),
82
+ RelationshipOperation.Delete,
83
+ ),
84
+ TouchParent: (id: string, parentId: string): RelationshipMutation =>
85
+ createRelationshipMutation(
86
+ createResource("label", id),
87
+ "parent",
88
+ resourceRelationshipSubject("label", parentId, ""),
89
+ RelationshipOperation.Touch,
90
+ ),
91
+ DeleteParent: (id: string, parentId: string): RelationshipMutation =>
92
+ createRelationshipMutation(
93
+ createResource("label", id),
94
+ "parent",
95
+ resourceRelationshipSubject("label", parentId, ""),
96
+ RelationshipOperation.Delete,
97
+ ),
98
+ });
@@ -0,0 +1,103 @@
1
+ // Code generated by scripts/generated/generate-spicedb-catalog.mjs.
2
+ // DO NOT EDIT.
3
+ //
4
+ // Domain: legal_policy — Terms and Privacy history policy
5
+
6
+ import {
7
+ accountIdentityRelationshipSubject,
8
+ createCan,
9
+ createRelationshipMutation,
10
+ createRelationshipSnapshotPlan,
11
+ createResource,
12
+ platformRelationshipSubject,
13
+ RelationshipOperation,
14
+ resourceRelationshipSubject,
15
+ } from "./internal.ts";
16
+ import type {
17
+ Actor,
18
+ Can,
19
+ RelationshipMutation,
20
+ RelationshipSnapshotPlan,
21
+ Resource,
22
+ } from "./internal.ts";
23
+
24
+ export const TermsHistory = Object.freeze({
25
+ Resource: (id: string): Resource => createResource("terms_history", id),
26
+ View: (id: string): Can => createCan("terms_history", id, "view", "view"),
27
+ Edit: (id: string): Can => createCan("terms_history", id, "edit", "edit"),
28
+ ViewArchived: (id: string): Can =>
29
+ createCan("terms_history", id, "view_archived", "view_archived"),
30
+ EditArchived: (id: string): Can =>
31
+ createCan("terms_history", id, "edit_archived", "edit_archived"),
32
+ Delete: (id: string): Can =>
33
+ createCan("terms_history", id, "delete", "delete"),
34
+ Publish: (id: string): Can =>
35
+ createCan("terms_history", id, "publish", "publish"),
36
+ Manage: (id: string): Can =>
37
+ createCan("terms_history", id, "manage", "manage"),
38
+ ManageShareLinks: (id: string): Can =>
39
+ createCan("terms_history", id, "manage_share_links", "manage_share_links"),
40
+ Create: (): Can =>
41
+ createCan("platform", "global", "terms_history.create", "is_admin"),
42
+ List: (): Can =>
43
+ createCan("platform", "global", "terms_history.list", "is_admin"),
44
+ Snapshot: (id: string): RelationshipSnapshotPlan =>
45
+ createRelationshipSnapshotPlan("terms_history", id, "platform_admin", ""),
46
+ TouchPolicy: (id: string): RelationshipMutation =>
47
+ createRelationshipMutation(
48
+ createResource("terms_history", id),
49
+ "policy",
50
+ platformRelationshipSubject(),
51
+ RelationshipOperation.Touch,
52
+ ),
53
+ DeletePolicy: (id: string): RelationshipMutation =>
54
+ createRelationshipMutation(
55
+ createResource("terms_history", id),
56
+ "policy",
57
+ platformRelationshipSubject(),
58
+ RelationshipOperation.Delete,
59
+ ),
60
+ });
61
+
62
+ export const PrivacyHistory = Object.freeze({
63
+ Resource: (id: string): Resource => createResource("privacy_history", id),
64
+ View: (id: string): Can => createCan("privacy_history", id, "view", "view"),
65
+ Edit: (id: string): Can => createCan("privacy_history", id, "edit", "edit"),
66
+ ViewArchived: (id: string): Can =>
67
+ createCan("privacy_history", id, "view_archived", "view_archived"),
68
+ EditArchived: (id: string): Can =>
69
+ createCan("privacy_history", id, "edit_archived", "edit_archived"),
70
+ Delete: (id: string): Can =>
71
+ createCan("privacy_history", id, "delete", "delete"),
72
+ Publish: (id: string): Can =>
73
+ createCan("privacy_history", id, "publish", "publish"),
74
+ Manage: (id: string): Can =>
75
+ createCan("privacy_history", id, "manage", "manage"),
76
+ ManageShareLinks: (id: string): Can =>
77
+ createCan(
78
+ "privacy_history",
79
+ id,
80
+ "manage_share_links",
81
+ "manage_share_links",
82
+ ),
83
+ Create: (): Can =>
84
+ createCan("platform", "global", "privacy_history.create", "is_admin"),
85
+ List: (): Can =>
86
+ createCan("platform", "global", "privacy_history.list", "is_admin"),
87
+ Snapshot: (id: string): RelationshipSnapshotPlan =>
88
+ createRelationshipSnapshotPlan("privacy_history", id, "platform_admin", ""),
89
+ TouchPolicy: (id: string): RelationshipMutation =>
90
+ createRelationshipMutation(
91
+ createResource("privacy_history", id),
92
+ "policy",
93
+ platformRelationshipSubject(),
94
+ RelationshipOperation.Touch,
95
+ ),
96
+ DeletePolicy: (id: string): RelationshipMutation =>
97
+ createRelationshipMutation(
98
+ createResource("privacy_history", id),
99
+ "policy",
100
+ platformRelationshipSubject(),
101
+ RelationshipOperation.Delete,
102
+ ),
103
+ });
@@ -0,0 +1,48 @@
1
+ // Code generated by scripts/generated/generate-spicedb-catalog.mjs.
2
+ // DO NOT EDIT.
3
+ //
4
+ // Domain: map_theme — Map Theme resource policy
5
+
6
+ import {
7
+ accountIdentityRelationshipSubject,
8
+ createCan,
9
+ createRelationshipMutation,
10
+ createRelationshipSnapshotPlan,
11
+ createResource,
12
+ platformRelationshipSubject,
13
+ RelationshipOperation,
14
+ resourceRelationshipSubject,
15
+ } from "./internal.ts";
16
+ import type {
17
+ Actor,
18
+ Can,
19
+ RelationshipMutation,
20
+ RelationshipSnapshotPlan,
21
+ Resource,
22
+ } from "./internal.ts";
23
+
24
+ export const MapTheme = Object.freeze({
25
+ Resource: (id: string): Resource => createResource("map_theme", id),
26
+ View: (id: string): Can => createCan("map_theme", id, "view", "view"),
27
+ Edit: (id: string): Can => createCan("map_theme", id, "edit", "edit"),
28
+ Delete: (id: string): Can => createCan("map_theme", id, "delete", "delete"),
29
+ Manage: (id: string): Can => createCan("map_theme", id, "manage", "manage"),
30
+ Create: (): Can =>
31
+ createCan("platform", "global", "map_theme.create", "is_admin"),
32
+ Snapshot: (id: string): RelationshipSnapshotPlan =>
33
+ createRelationshipSnapshotPlan("map_theme", id, "platform_admin", ""),
34
+ TouchPolicy: (id: string): RelationshipMutation =>
35
+ createRelationshipMutation(
36
+ createResource("map_theme", id),
37
+ "policy",
38
+ platformRelationshipSubject(),
39
+ RelationshipOperation.Touch,
40
+ ),
41
+ DeletePolicy: (id: string): RelationshipMutation =>
42
+ createRelationshipMutation(
43
+ createResource("map_theme", id),
44
+ "policy",
45
+ platformRelationshipSubject(),
46
+ RelationshipOperation.Delete,
47
+ ),
48
+ });