@hearth-auth/sdk 0.0.1

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 (40) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +680 -0
  3. package/package.json +44 -0
  4. package/src/admin.ts +157 -0
  5. package/src/browser-auth.ts +130 -0
  6. package/src/claims.ts +180 -0
  7. package/src/client.ts +251 -0
  8. package/src/errors.ts +173 -0
  9. package/src/generated/google/api/annotations_pb.ts +44 -0
  10. package/src/generated/google/api/http_pb.ts +467 -0
  11. package/src/generated/hearth/authz/v1/authz_pb.ts +593 -0
  12. package/src/generated/hearth/cluster/v1/raft_pb.ts +183 -0
  13. package/src/generated/hearth/events/v1/audit_pb.ts +886 -0
  14. package/src/generated/hearth/identity/v1/identity_pb.ts +1673 -0
  15. package/src/generated/hearth/identity/v1/oauth_pb.ts +1138 -0
  16. package/src/generated/hearth/rbac/v1/rbac_pb.ts +2000 -0
  17. package/src/hearth-client.ts +288 -0
  18. package/src/hearth.ts +224 -0
  19. package/src/index.ts +106 -0
  20. package/src/introspection-client.ts +83 -0
  21. package/src/jwks-client.ts +45 -0
  22. package/src/middleware.ts +82 -0
  23. package/src/pkce.ts +129 -0
  24. package/src/react.tsx +57 -0
  25. package/src/session-version-cache.ts +167 -0
  26. package/src/types.ts +188 -0
  27. package/tests/admin-crud.test.ts +97 -0
  28. package/tests/auth-flow.test.ts +75 -0
  29. package/tests/authorize.test.ts +386 -0
  30. package/tests/claims.test.ts +159 -0
  31. package/tests/hasPermission.test.ts +152 -0
  32. package/tests/hearth-client.test.ts +243 -0
  33. package/tests/helpers.ts +90 -0
  34. package/tests/jwks.test.ts +62 -0
  35. package/tests/pkce.test.ts +210 -0
  36. package/tests/react-useHasPermission.test.tsx +92 -0
  37. package/tests/required-action.test.ts +276 -0
  38. package/tests/session-version.test.ts +391 -0
  39. package/tsconfig.json +16 -0
  40. package/vitest.config.ts +8 -0
@@ -0,0 +1,593 @@
1
+ // @generated by protoc-gen-es v2.12.0 with parameter "target=ts"
2
+ // @generated from file hearth/authz/v1/authz.proto (package hearth.authz.v1, syntax proto3)
3
+ /* eslint-disable */
4
+
5
+ import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";
6
+ import { enumDesc, fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv2";
7
+ import type { Message } from "@bufbuild/protobuf";
8
+
9
+ /**
10
+ * Describes the file hearth/authz/v1/authz.proto.
11
+ */
12
+ export const file_hearth_authz_v1_authz: GenFile = /*@__PURE__*/
13
+ fileDesc("ChtoZWFydGgvYXV0aHovdjEvYXV0aHoucHJvdG8SD2hlYXJ0aC5hdXRoei52MSIzCglPYmplY3RSZWYSEwoLb2JqZWN0X3R5cGUYASABKAkSEQoJb2JqZWN0X2lkGAIgASgJInIKClN1YmplY3RSZWYSLAoGZGlyZWN0GAEgASgLMhouaGVhcnRoLmF1dGh6LnYxLk9iamVjdFJlZkgAEi4KB3VzZXJzZXQYAiABKAsyGy5oZWFydGguYXV0aHoudjEuVXNlcnNldFJlZkgAQgYKBGtpbmQiSgoKVXNlcnNldFJlZhIqCgZvYmplY3QYASABKAsyGi5oZWFydGguYXV0aHoudjEuT2JqZWN0UmVmEhAKCHJlbGF0aW9uGAIgASgJIn8KEVJlbGF0aW9uc2hpcFR1cGxlEioKBm9iamVjdBgBIAEoCzIaLmhlYXJ0aC5hdXRoei52MS5PYmplY3RSZWYSEAoIcmVsYXRpb24YAiABKAkSLAoHc3ViamVjdBgDIAEoCzIbLmhlYXJ0aC5hdXRoei52MS5TdWJqZWN0UmVmIngKClR1cGxlV3JpdGUSNwoJb3BlcmF0aW9uGAEgASgOMiQuaGVhcnRoLmF1dGh6LnYxLlR1cGxlV3JpdGVPcGVyYXRpb24SMQoFdHVwbGUYAiABKAsyIi5oZWFydGguYXV0aHoudjEuUmVsYXRpb25zaGlwVHVwbGUiIwoQQ29uc2lzdGVuY3lUb2tlbhIP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9hdXRoei92MTthdXRoenYxYgZwcm90bzM");
14
+
15
+ /**
16
+ * A reference to an object: {type}:{id}.
17
+ *
18
+ * @generated from message hearth.authz.v1.ObjectRef
19
+ */
20
+ export type ObjectRef = Message<"hearth.authz.v1.ObjectRef"> & {
21
+ /**
22
+ * @generated from field: string object_type = 1;
23
+ */
24
+ objectType: string;
25
+
26
+ /**
27
+ * @generated from field: string object_id = 2;
28
+ */
29
+ objectId: string;
30
+ };
31
+
32
+ /**
33
+ * Describes the message hearth.authz.v1.ObjectRef.
34
+ * Use `create(ObjectRefSchema)` to create a new message.
35
+ */
36
+ export const ObjectRefSchema: GenMessage<ObjectRef> = /*@__PURE__*/
37
+ messageDesc(file_hearth_authz_v1_authz, 0);
38
+
39
+ /**
40
+ * A reference to a subject: either a direct entity or a userset.
41
+ *
42
+ * @generated from message hearth.authz.v1.SubjectRef
43
+ */
44
+ export type SubjectRef = Message<"hearth.authz.v1.SubjectRef"> & {
45
+ /**
46
+ * @generated from oneof hearth.authz.v1.SubjectRef.kind
47
+ */
48
+ kind: {
49
+ /**
50
+ * A direct entity reference (e.g., user:alice).
51
+ *
52
+ * @generated from field: hearth.authz.v1.ObjectRef direct = 1;
53
+ */
54
+ value: ObjectRef;
55
+ case: "direct";
56
+ } | {
57
+ /**
58
+ * A userset reference (e.g., group:eng#member).
59
+ *
60
+ * @generated from field: hearth.authz.v1.UsersetRef userset = 2;
61
+ */
62
+ value: UsersetRef;
63
+ case: "userset";
64
+ } | { case: undefined; value?: undefined };
65
+ };
66
+
67
+ /**
68
+ * Describes the message hearth.authz.v1.SubjectRef.
69
+ * Use `create(SubjectRefSchema)` to create a new message.
70
+ */
71
+ export const SubjectRefSchema: GenMessage<SubjectRef> = /*@__PURE__*/
72
+ messageDesc(file_hearth_authz_v1_authz, 1);
73
+
74
+ /**
75
+ * A userset reference: object#relation.
76
+ *
77
+ * @generated from message hearth.authz.v1.UsersetRef
78
+ */
79
+ export type UsersetRef = Message<"hearth.authz.v1.UsersetRef"> & {
80
+ /**
81
+ * @generated from field: hearth.authz.v1.ObjectRef object = 1;
82
+ */
83
+ object?: ObjectRef | undefined;
84
+
85
+ /**
86
+ * @generated from field: string relation = 2;
87
+ */
88
+ relation: string;
89
+ };
90
+
91
+ /**
92
+ * Describes the message hearth.authz.v1.UsersetRef.
93
+ * Use `create(UsersetRefSchema)` to create a new message.
94
+ */
95
+ export const UsersetRefSchema: GenMessage<UsersetRef> = /*@__PURE__*/
96
+ messageDesc(file_hearth_authz_v1_authz, 2);
97
+
98
+ /**
99
+ * A complete relationship tuple: (object#relation@subject).
100
+ *
101
+ * @generated from message hearth.authz.v1.RelationshipTuple
102
+ */
103
+ export type RelationshipTuple = Message<"hearth.authz.v1.RelationshipTuple"> & {
104
+ /**
105
+ * @generated from field: hearth.authz.v1.ObjectRef object = 1;
106
+ */
107
+ object?: ObjectRef | undefined;
108
+
109
+ /**
110
+ * @generated from field: string relation = 2;
111
+ */
112
+ relation: string;
113
+
114
+ /**
115
+ * @generated from field: hearth.authz.v1.SubjectRef subject = 3;
116
+ */
117
+ subject?: SubjectRef | undefined;
118
+ };
119
+
120
+ /**
121
+ * Describes the message hearth.authz.v1.RelationshipTuple.
122
+ * Use `create(RelationshipTupleSchema)` to create a new message.
123
+ */
124
+ export const RelationshipTupleSchema: GenMessage<RelationshipTuple> = /*@__PURE__*/
125
+ messageDesc(file_hearth_authz_v1_authz, 3);
126
+
127
+ /**
128
+ * A write operation on a relationship tuple.
129
+ *
130
+ * @generated from message hearth.authz.v1.TupleWrite
131
+ */
132
+ export type TupleWrite = Message<"hearth.authz.v1.TupleWrite"> & {
133
+ /**
134
+ * @generated from field: hearth.authz.v1.TupleWriteOperation operation = 1;
135
+ */
136
+ operation: TupleWriteOperation;
137
+
138
+ /**
139
+ * @generated from field: hearth.authz.v1.RelationshipTuple tuple = 2;
140
+ */
141
+ tuple?: RelationshipTuple | undefined;
142
+ };
143
+
144
+ /**
145
+ * Describes the message hearth.authz.v1.TupleWrite.
146
+ * Use `create(TupleWriteSchema)` to create a new message.
147
+ */
148
+ export const TupleWriteSchema: GenMessage<TupleWrite> = /*@__PURE__*/
149
+ messageDesc(file_hearth_authz_v1_authz, 4);
150
+
151
+ /**
152
+ * An opaque consistency token (Zanzibar "zookie").
153
+ *
154
+ * @generated from message hearth.authz.v1.ConsistencyToken
155
+ */
156
+ export type ConsistencyToken = Message<"hearth.authz.v1.ConsistencyToken"> & {
157
+ /**
158
+ * @generated from field: uint64 version = 1;
159
+ */
160
+ version: bigint;
161
+ };
162
+
163
+ /**
164
+ * Describes the message hearth.authz.v1.ConsistencyToken.
165
+ * Use `create(ConsistencyTokenSchema)` to create a new message.
166
+ */
167
+ export const ConsistencyTokenSchema: GenMessage<ConsistencyToken> = /*@__PURE__*/
168
+ messageDesc(file_hearth_authz_v1_authz, 5);
169
+
170
+ /**
171
+ * An event representing a change to a relationship tuple.
172
+ *
173
+ * @generated from message hearth.authz.v1.TupleChangeEvent
174
+ */
175
+ export type TupleChangeEvent = Message<"hearth.authz.v1.TupleChangeEvent"> & {
176
+ /**
177
+ * @generated from field: uint64 sequence = 1;
178
+ */
179
+ sequence: bigint;
180
+
181
+ /**
182
+ * @generated from field: hearth.authz.v1.TupleChangeAction action = 2;
183
+ */
184
+ action: TupleChangeAction;
185
+
186
+ /**
187
+ * @generated from field: string object_type = 3;
188
+ */
189
+ objectType: string;
190
+
191
+ /**
192
+ * @generated from field: string object_id = 4;
193
+ */
194
+ objectId: string;
195
+
196
+ /**
197
+ * @generated from field: string relation = 5;
198
+ */
199
+ relation: string;
200
+
201
+ /**
202
+ * @generated from field: string subject = 6;
203
+ */
204
+ subject: string;
205
+
206
+ /**
207
+ * @generated from field: string realm_id = 7;
208
+ */
209
+ realmId: string;
210
+
211
+ /**
212
+ * @generated from field: uint64 timestamp_us = 8;
213
+ */
214
+ timestampUs: bigint;
215
+ };
216
+
217
+ /**
218
+ * Describes the message hearth.authz.v1.TupleChangeEvent.
219
+ * Use `create(TupleChangeEventSchema)` to create a new message.
220
+ */
221
+ export const TupleChangeEventSchema: GenMessage<TupleChangeEvent> = /*@__PURE__*/
222
+ messageDesc(file_hearth_authz_v1_authz, 6);
223
+
224
+ /**
225
+ * Filter for the watch operation.
226
+ *
227
+ * @generated from message hearth.authz.v1.WatchFilter
228
+ */
229
+ export type WatchFilter = Message<"hearth.authz.v1.WatchFilter"> & {
230
+ /**
231
+ * @generated from field: optional string object_type = 1;
232
+ */
233
+ objectType?: string | undefined;
234
+ };
235
+
236
+ /**
237
+ * Describes the message hearth.authz.v1.WatchFilter.
238
+ * Use `create(WatchFilterSchema)` to create a new message.
239
+ */
240
+ export const WatchFilterSchema: GenMessage<WatchFilter> = /*@__PURE__*/
241
+ messageDesc(file_hearth_authz_v1_authz, 7);
242
+
243
+ /**
244
+ * Namespace configuration defining valid object types and relations.
245
+ *
246
+ * @generated from message hearth.authz.v1.NamespaceConfig
247
+ */
248
+ export type NamespaceConfig = Message<"hearth.authz.v1.NamespaceConfig"> & {
249
+ /**
250
+ * @generated from field: map<string, hearth.authz.v1.ObjectTypeConfig> object_types = 1;
251
+ */
252
+ objectTypes: { [key: string]: ObjectTypeConfig };
253
+ };
254
+
255
+ /**
256
+ * Describes the message hearth.authz.v1.NamespaceConfig.
257
+ * Use `create(NamespaceConfigSchema)` to create a new message.
258
+ */
259
+ export const NamespaceConfigSchema: GenMessage<NamespaceConfig> = /*@__PURE__*/
260
+ messageDesc(file_hearth_authz_v1_authz, 8);
261
+
262
+ /**
263
+ * Configuration for a single object type within the namespace.
264
+ *
265
+ * @generated from message hearth.authz.v1.ObjectTypeConfig
266
+ */
267
+ export type ObjectTypeConfig = Message<"hearth.authz.v1.ObjectTypeConfig"> & {
268
+ /**
269
+ * @generated from field: map<string, hearth.authz.v1.RelationConfig> relations = 1;
270
+ */
271
+ relations: { [key: string]: RelationConfig };
272
+ };
273
+
274
+ /**
275
+ * Describes the message hearth.authz.v1.ObjectTypeConfig.
276
+ * Use `create(ObjectTypeConfigSchema)` to create a new message.
277
+ */
278
+ export const ObjectTypeConfigSchema: GenMessage<ObjectTypeConfig> = /*@__PURE__*/
279
+ messageDesc(file_hearth_authz_v1_authz, 9);
280
+
281
+ /**
282
+ * Configuration for a single relation within an object type.
283
+ *
284
+ * @generated from message hearth.authz.v1.RelationConfig
285
+ */
286
+ export type RelationConfig = Message<"hearth.authz.v1.RelationConfig"> & {
287
+ /**
288
+ * @generated from field: repeated string allowed_subject_types = 1;
289
+ */
290
+ allowedSubjectTypes: string[];
291
+ };
292
+
293
+ /**
294
+ * Describes the message hearth.authz.v1.RelationConfig.
295
+ * Use `create(RelationConfigSchema)` to create a new message.
296
+ */
297
+ export const RelationConfigSchema: GenMessage<RelationConfig> = /*@__PURE__*/
298
+ messageDesc(file_hearth_authz_v1_authz, 10);
299
+
300
+ /**
301
+ * @generated from message hearth.authz.v1.CheckRequest
302
+ */
303
+ export type CheckRequest = Message<"hearth.authz.v1.CheckRequest"> & {
304
+ /**
305
+ * @generated from field: hearth.authz.v1.ObjectRef object = 1;
306
+ */
307
+ object?: ObjectRef | undefined;
308
+
309
+ /**
310
+ * @generated from field: string relation = 2;
311
+ */
312
+ relation: string;
313
+
314
+ /**
315
+ * @generated from field: hearth.authz.v1.SubjectRef subject = 3;
316
+ */
317
+ subject?: SubjectRef | undefined;
318
+
319
+ /**
320
+ * @generated from field: optional hearth.authz.v1.ConsistencyToken at_least_as_fresh_as = 4;
321
+ */
322
+ atLeastAsFreshAs?: ConsistencyToken | undefined;
323
+ };
324
+
325
+ /**
326
+ * Describes the message hearth.authz.v1.CheckRequest.
327
+ * Use `create(CheckRequestSchema)` to create a new message.
328
+ */
329
+ export const CheckRequestSchema: GenMessage<CheckRequest> = /*@__PURE__*/
330
+ messageDesc(file_hearth_authz_v1_authz, 11);
331
+
332
+ /**
333
+ * @generated from message hearth.authz.v1.CheckResponse
334
+ */
335
+ export type CheckResponse = Message<"hearth.authz.v1.CheckResponse"> & {
336
+ /**
337
+ * @generated from field: bool allowed = 1;
338
+ */
339
+ allowed: boolean;
340
+
341
+ /**
342
+ * @generated from field: hearth.authz.v1.ConsistencyToken token = 2;
343
+ */
344
+ token?: ConsistencyToken | undefined;
345
+ };
346
+
347
+ /**
348
+ * Describes the message hearth.authz.v1.CheckResponse.
349
+ * Use `create(CheckResponseSchema)` to create a new message.
350
+ */
351
+ export const CheckResponseSchema: GenMessage<CheckResponse> = /*@__PURE__*/
352
+ messageDesc(file_hearth_authz_v1_authz, 12);
353
+
354
+ /**
355
+ * @generated from message hearth.authz.v1.ExpandRequest
356
+ */
357
+ export type ExpandRequest = Message<"hearth.authz.v1.ExpandRequest"> & {
358
+ /**
359
+ * @generated from field: hearth.authz.v1.ObjectRef object = 1;
360
+ */
361
+ object?: ObjectRef | undefined;
362
+
363
+ /**
364
+ * @generated from field: string relation = 2;
365
+ */
366
+ relation: string;
367
+
368
+ /**
369
+ * @generated from field: optional hearth.authz.v1.ConsistencyToken at_least_as_fresh_as = 3;
370
+ */
371
+ atLeastAsFreshAs?: ConsistencyToken | undefined;
372
+ };
373
+
374
+ /**
375
+ * Describes the message hearth.authz.v1.ExpandRequest.
376
+ * Use `create(ExpandRequestSchema)` to create a new message.
377
+ */
378
+ export const ExpandRequestSchema: GenMessage<ExpandRequest> = /*@__PURE__*/
379
+ messageDesc(file_hearth_authz_v1_authz, 13);
380
+
381
+ /**
382
+ * A tree of subjects for a given (object, relation). Flattened from the
383
+ * engine's recursive expand tree; each node is keyed by its userset id.
384
+ *
385
+ * @generated from message hearth.authz.v1.ExpandResponse
386
+ */
387
+ export type ExpandResponse = Message<"hearth.authz.v1.ExpandResponse"> & {
388
+ /**
389
+ * @generated from field: hearth.authz.v1.ConsistencyToken token = 1;
390
+ */
391
+ token?: ConsistencyToken | undefined;
392
+
393
+ /**
394
+ * @generated from field: repeated hearth.authz.v1.SubjectRef subjects = 2;
395
+ */
396
+ subjects: SubjectRef[];
397
+ };
398
+
399
+ /**
400
+ * Describes the message hearth.authz.v1.ExpandResponse.
401
+ * Use `create(ExpandResponseSchema)` to create a new message.
402
+ */
403
+ export const ExpandResponseSchema: GenMessage<ExpandResponse> = /*@__PURE__*/
404
+ messageDesc(file_hearth_authz_v1_authz, 14);
405
+
406
+ /**
407
+ * @generated from message hearth.authz.v1.WriteTuplesRequest
408
+ */
409
+ export type WriteTuplesRequest = Message<"hearth.authz.v1.WriteTuplesRequest"> & {
410
+ /**
411
+ * @generated from field: repeated hearth.authz.v1.TupleWrite writes = 1;
412
+ */
413
+ writes: TupleWrite[];
414
+ };
415
+
416
+ /**
417
+ * Describes the message hearth.authz.v1.WriteTuplesRequest.
418
+ * Use `create(WriteTuplesRequestSchema)` to create a new message.
419
+ */
420
+ export const WriteTuplesRequestSchema: GenMessage<WriteTuplesRequest> = /*@__PURE__*/
421
+ messageDesc(file_hearth_authz_v1_authz, 15);
422
+
423
+ /**
424
+ * @generated from message hearth.authz.v1.WriteTuplesResponse
425
+ */
426
+ export type WriteTuplesResponse = Message<"hearth.authz.v1.WriteTuplesResponse"> & {
427
+ /**
428
+ * @generated from field: hearth.authz.v1.ConsistencyToken token = 1;
429
+ */
430
+ token?: ConsistencyToken | undefined;
431
+ };
432
+
433
+ /**
434
+ * Describes the message hearth.authz.v1.WriteTuplesResponse.
435
+ * Use `create(WriteTuplesResponseSchema)` to create a new message.
436
+ */
437
+ export const WriteTuplesResponseSchema: GenMessage<WriteTuplesResponse> = /*@__PURE__*/
438
+ messageDesc(file_hearth_authz_v1_authz, 16);
439
+
440
+ /**
441
+ * @generated from message hearth.authz.v1.WatchRequest
442
+ */
443
+ export type WatchRequest = Message<"hearth.authz.v1.WatchRequest"> & {
444
+ /**
445
+ * Start streaming events strictly after this token. When unset, the
446
+ * stream starts from "now" and only future events are delivered.
447
+ *
448
+ * @generated from field: optional hearth.authz.v1.ConsistencyToken start_after = 1;
449
+ */
450
+ startAfter?: ConsistencyToken | undefined;
451
+
452
+ /**
453
+ * @generated from field: optional hearth.authz.v1.WatchFilter filter = 2;
454
+ */
455
+ filter?: WatchFilter | undefined;
456
+ };
457
+
458
+ /**
459
+ * Describes the message hearth.authz.v1.WatchRequest.
460
+ * Use `create(WatchRequestSchema)` to create a new message.
461
+ */
462
+ export const WatchRequestSchema: GenMessage<WatchRequest> = /*@__PURE__*/
463
+ messageDesc(file_hearth_authz_v1_authz, 17);
464
+
465
+ /**
466
+ * A streamed tuple-change event.
467
+ *
468
+ * @generated from message hearth.authz.v1.WatchEvent
469
+ */
470
+ export type WatchEvent = Message<"hearth.authz.v1.WatchEvent"> & {
471
+ /**
472
+ * @generated from field: hearth.authz.v1.TupleChangeEvent event = 1;
473
+ */
474
+ event?: TupleChangeEvent | undefined;
475
+
476
+ /**
477
+ * @generated from field: hearth.authz.v1.ConsistencyToken token = 2;
478
+ */
479
+ token?: ConsistencyToken | undefined;
480
+ };
481
+
482
+ /**
483
+ * Describes the message hearth.authz.v1.WatchEvent.
484
+ * Use `create(WatchEventSchema)` to create a new message.
485
+ */
486
+ export const WatchEventSchema: GenMessage<WatchEvent> = /*@__PURE__*/
487
+ messageDesc(file_hearth_authz_v1_authz, 18);
488
+
489
+ /**
490
+ * The operation type for a tuple write.
491
+ *
492
+ * @generated from enum hearth.authz.v1.TupleWriteOperation
493
+ */
494
+ export enum TupleWriteOperation {
495
+ /**
496
+ * @generated from enum value: TUPLE_WRITE_OPERATION_UNSPECIFIED = 0;
497
+ */
498
+ UNSPECIFIED = 0,
499
+
500
+ /**
501
+ * @generated from enum value: TUPLE_WRITE_OPERATION_TOUCH = 1;
502
+ */
503
+ TOUCH = 1,
504
+
505
+ /**
506
+ * @generated from enum value: TUPLE_WRITE_OPERATION_DELETE = 2;
507
+ */
508
+ DELETE = 2,
509
+
510
+ /**
511
+ * @generated from enum value: TUPLE_WRITE_OPERATION_TOUCH_IF_ABSENT = 3;
512
+ */
513
+ TOUCH_IF_ABSENT = 3,
514
+
515
+ /**
516
+ * @generated from enum value: TUPLE_WRITE_OPERATION_DELETE_IF_PRESENT = 4;
517
+ */
518
+ DELETE_IF_PRESENT = 4,
519
+ }
520
+
521
+ /**
522
+ * Describes the enum hearth.authz.v1.TupleWriteOperation.
523
+ */
524
+ export const TupleWriteOperationSchema: GenEnum<TupleWriteOperation> = /*@__PURE__*/
525
+ enumDesc(file_hearth_authz_v1_authz, 0);
526
+
527
+ /**
528
+ * The action type in a tuple change event.
529
+ *
530
+ * @generated from enum hearth.authz.v1.TupleChangeAction
531
+ */
532
+ export enum TupleChangeAction {
533
+ /**
534
+ * @generated from enum value: TUPLE_CHANGE_ACTION_UNSPECIFIED = 0;
535
+ */
536
+ UNSPECIFIED = 0,
537
+
538
+ /**
539
+ * @generated from enum value: TUPLE_CHANGE_ACTION_TOUCH = 1;
540
+ */
541
+ TOUCH = 1,
542
+
543
+ /**
544
+ * @generated from enum value: TUPLE_CHANGE_ACTION_DELETE = 2;
545
+ */
546
+ DELETE = 2,
547
+ }
548
+
549
+ /**
550
+ * Describes the enum hearth.authz.v1.TupleChangeAction.
551
+ */
552
+ export const TupleChangeActionSchema: GenEnum<TupleChangeAction> = /*@__PURE__*/
553
+ enumDesc(file_hearth_authz_v1_authz, 1);
554
+
555
+ /**
556
+ * @generated from service hearth.authz.v1.AuthorizationService
557
+ */
558
+ export const AuthorizationService: GenService<{
559
+ /**
560
+ * @generated from rpc hearth.authz.v1.AuthorizationService.Check
561
+ */
562
+ check: {
563
+ methodKind: "unary";
564
+ input: typeof CheckRequestSchema;
565
+ output: typeof CheckResponseSchema;
566
+ },
567
+ /**
568
+ * @generated from rpc hearth.authz.v1.AuthorizationService.Expand
569
+ */
570
+ expand: {
571
+ methodKind: "unary";
572
+ input: typeof ExpandRequestSchema;
573
+ output: typeof ExpandResponseSchema;
574
+ },
575
+ /**
576
+ * @generated from rpc hearth.authz.v1.AuthorizationService.WriteTuples
577
+ */
578
+ writeTuples: {
579
+ methodKind: "unary";
580
+ input: typeof WriteTuplesRequestSchema;
581
+ output: typeof WriteTuplesResponseSchema;
582
+ },
583
+ /**
584
+ * @generated from rpc hearth.authz.v1.AuthorizationService.Watch
585
+ */
586
+ watch: {
587
+ methodKind: "server_streaming";
588
+ input: typeof WatchRequestSchema;
589
+ output: typeof WatchEventSchema;
590
+ },
591
+ }> = /*@__PURE__*/
592
+ serviceDesc(file_hearth_authz_v1_authz, 0);
593
+