-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathwatchpermissionsets.ts
More file actions
939 lines (939 loc) · 47.5 KB
/
watchpermissionsets.ts
File metadata and controls
939 lines (939 loc) · 47.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
// @generated by protobuf-ts 2.9.1 with parameter generate_dependencies,long_type_string,client_grpc1
// @generated from protobuf file "authzed/api/materialize/v0/watchpermissionsets.proto" (package "authzed.api.materialize.v0", syntax proto3)
// tslint:disable
import { ServiceType } from "@protobuf-ts/runtime-rpc";
import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
import type { IBinaryWriter } from "@protobuf-ts/runtime";
import { WireType } from "@protobuf-ts/runtime";
import type { BinaryReadOptions } from "@protobuf-ts/runtime";
import type { IBinaryReader } from "@protobuf-ts/runtime";
import { UnknownFieldHandler } from "@protobuf-ts/runtime";
import type { PartialMessage } from "@protobuf-ts/runtime";
import { reflectionMergePartial } from "@protobuf-ts/runtime";
import { MESSAGE_TYPE } from "@protobuf-ts/runtime";
import { MessageType } from "@protobuf-ts/runtime";
import { ZedToken } from "../../v1/core.js";
/**
* @generated from protobuf message authzed.api.materialize.v0.WatchPermissionSetsRequest
*/
export interface WatchPermissionSetsRequest {
/**
* optional_starting_after is used to specify the SpiceDB revision to start watching from.
* If not specified, the watch will start from the current SpiceDB revision time of the request ("head revision").
*
* @generated from protobuf field: authzed.api.v1.ZedToken optional_starting_after = 1;
*/
optionalStartingAfter?: ZedToken;
}
/**
* @generated from protobuf message authzed.api.materialize.v0.WatchPermissionSetsResponse
*/
export interface WatchPermissionSetsResponse {
/**
* @generated from protobuf oneof: response
*/
response: {
oneofKind: "change";
/**
* change is the permission set delta that has occurred as result of a mutation in origin SpiceDB.
* The consumer should apply this change to the current state of the permission sets in their target system.
* Once an event arrives with completed_revision instead, the consumer shall consider the set of
* changes originating from that revision completed.
*
* The consumer should keep track of the revision in order to resume streaming in the event of consumer restarts.
*
* @generated from protobuf field: authzed.api.materialize.v0.PermissionSetChange change = 1;
*/
change: PermissionSetChange;
} | {
oneofKind: "completedRevision";
/**
* completed_revision is the revision token that indicates the completion of a set of changes. It may also be
* received without accompanying set of changes, indicating that a mutation in the origin SpiceDB cluster did
* not yield any effective changes in the permission sets
*
* @generated from protobuf field: authzed.api.v1.ZedToken completed_revision = 2;
*/
completedRevision: ZedToken;
} | {
oneofKind: "lookupPermissionSetsRequired";
/**
* lookup_permission_sets_required is a signal that the consumer should perform a LookupPermissionSets call because
* the permission set snapshot needs to be rebuilt from scratch. This typically happens when the origin SpiceDB
* cluster has seen its schema changed.
*
* @generated from protobuf field: authzed.api.materialize.v0.LookupPermissionSetsRequired lookup_permission_sets_required = 3;
*/
lookupPermissionSetsRequired: LookupPermissionSetsRequired;
} | {
oneofKind: "breakingSchemaChange";
/**
* breaking_schema_change is a signal that a breaking schema change has been written to the origin SpiceDB cluster,
* and that the consumer should expect delays in the ingestion of new changes,
* because the permission set snapshot needs to be rebuilt from scratch. Once the snapshot is ready, the consumer
* will receive a LookupPermissionSetsRequired event.
*
* @generated from protobuf field: authzed.api.materialize.v0.BreakingSchemaChange breaking_schema_change = 4;
*/
breakingSchemaChange: BreakingSchemaChange;
} | {
oneofKind: undefined;
};
}
/**
* @generated from protobuf message authzed.api.materialize.v0.Cursor
*/
export interface Cursor {
/**
* limit is the number of permission sets to stream over a single LookupPermissionSets call that was requested.
*
* @generated from protobuf field: uint32 limit = 1;
*/
limit: number;
/**
* token is the snapshot revision at which the cursor was computed.
*
* @generated from protobuf field: authzed.api.v1.ZedToken token = 4;
*/
token?: ZedToken;
/**
* starting_index is an offset of the permission set represented by this cursor
*
* @generated from protobuf field: uint32 starting_index = 5;
*/
startingIndex: number;
/**
* completed_members is a boolean flag that indicates that the cursor has reached the end of the permission sets
*
* @generated from protobuf field: bool completed_members = 6;
*/
completedMembers: boolean;
/**
* starting_key is a string cursor used by some backends to resume the stream from a specific point.
*
* @generated from protobuf field: string starting_key = 7;
*/
startingKey: string;
/**
* cursor is a string-encoded internal materialize cursor.
*
* @generated from protobuf field: string cursor = 8;
*/
cursor: string;
}
/**
* @generated from protobuf message authzed.api.materialize.v0.LookupPermissionSetsRequest
*/
export interface LookupPermissionSetsRequest {
/**
* limit is the number of permission sets to stream over a single LookupPermissionSets. Once the limit is reached,
* the server will close the stream. If more permission sets are available, the consume should open a new stream
* providing optional_starting_after_cursor, using the cursor from the last response.
*
* @generated from protobuf field: uint32 limit = 1;
*/
limit: number;
/**
* optional_at_revision specifies the client is requesting to lookup PermissionSets at a specific revision. It's
* optional, and if not provided, PermissionSets will be looked up at the current revision. The cursor always
* takes precedence in defining the revision when present.
*
* @generated from protobuf field: authzed.api.v1.ZedToken optional_at_revision = 2;
*/
optionalAtRevision?: ZedToken;
/**
* optional_starting_after_cursor is used to specify the offset to start streaming permission sets from.
*
* @generated from protobuf field: authzed.api.materialize.v0.Cursor optional_starting_after_cursor = 4;
*/
optionalStartingAfterCursor?: Cursor;
}
/**
* @generated from protobuf message authzed.api.materialize.v0.LookupPermissionSetsResponse
*/
export interface LookupPermissionSetsResponse {
/**
* change represents the permission set delta necessary to transition an uninitialized target system to
* a specific snapshot revision. In practice it's not different from the WatchPermissionSetsResponse.change, except
* all changes will be of time SET_OPERATION_ADDED because it's assumed there is no known previous state.
*
* Applying the deltas to a previously initialized target system would yield incorrect results.
*
* @generated from protobuf field: authzed.api.materialize.v0.PermissionSetChange change = 1;
*/
change?: PermissionSetChange;
/**
* cursor points to a specific permission set in a revision.
* The consumer should keep track of the cursor in order to resume streaming in the event of consumer restarts. This
* is particularly important in backfill scenarios that may take hours or event days to complete.
*
* @generated from protobuf field: authzed.api.materialize.v0.Cursor cursor = 2;
*/
cursor?: Cursor;
}
/**
* @generated from protobuf message authzed.api.materialize.v0.PermissionSetChange
*/
export interface PermissionSetChange {
/**
* revision represents the revision at which the permission set change occurred.
*
* @generated from protobuf field: authzed.api.v1.ZedToken at_revision = 1;
*/
atRevision?: ZedToken;
/**
* operation represents the type of set operation that took place as part of the change
*
* @generated from protobuf field: authzed.api.materialize.v0.PermissionSetChange.SetOperation operation = 2;
*/
operation: PermissionSetChange_SetOperation;
/**
* parent_set represents the permission set parent of either another set or a member
*
* @generated from protobuf field: authzed.api.materialize.v0.SetReference parent_set = 3;
*/
parentSet?: SetReference;
/**
* @generated from protobuf oneof: child
*/
child: {
oneofKind: "childSet";
/**
* child_set represents the scenario where another set is considered member of the parent set
*
* @generated from protobuf field: authzed.api.materialize.v0.SetReference child_set = 4;
*/
childSet: SetReference;
} | {
oneofKind: "childMember";
/**
* child_member represents the scenario where an specific object is considered member of the parent set
*
* @generated from protobuf field: authzed.api.materialize.v0.MemberReference child_member = 5;
*/
childMember: MemberReference;
} | {
oneofKind: undefined;
};
}
/**
* @generated from protobuf enum authzed.api.materialize.v0.PermissionSetChange.SetOperation
*/
export enum PermissionSetChange_SetOperation {
/**
* @generated from protobuf enum value: SET_OPERATION_UNSPECIFIED = 0;
*/
UNSPECIFIED = 0,
/**
* @generated from protobuf enum value: SET_OPERATION_ADDED = 1;
*/
ADDED = 1,
/**
* @generated from protobuf enum value: SET_OPERATION_REMOVED = 2;
*/
REMOVED = 2
}
/**
* @generated from protobuf message authzed.api.materialize.v0.SetReference
*/
export interface SetReference {
/**
* object_type is the type of object in a permission set
*
* @generated from protobuf field: string object_type = 1;
*/
objectType: string;
/**
* object_id is the ID of a permission set
*
* @generated from protobuf field: string object_id = 2;
*/
objectId: string;
/**
* permission_or_relation is the permission or relation referenced by this permission set
*
* @generated from protobuf field: string permission_or_relation = 3;
*/
permissionOrRelation: string;
}
/**
* @generated from protobuf message authzed.api.materialize.v0.MemberReference
*/
export interface MemberReference {
/**
* object_type is the type of object of a permission set member
*
* @generated from protobuf field: string object_type = 1;
*/
objectType: string;
/**
* object_id is the ID of a permission set member
*
* @generated from protobuf field: string object_id = 2;
*/
objectId: string;
/**
* optional_permission_or_relation is the permission or relation referenced by this permission set member
*
* @generated from protobuf field: string optional_permission_or_relation = 3;
*/
optionalPermissionOrRelation: string;
}
/**
* LookupPermissionSetsRequired is a signal that the consumer should perform a LookupPermissionSets call because
* the permission set snapshot needs to be rebuilt from scratch. This typically happens when the origin SpiceDB
* cluster has seen its schema changed, see BreakingSchemaChange event.
*
* @generated from protobuf message authzed.api.materialize.v0.LookupPermissionSetsRequired
*/
export interface LookupPermissionSetsRequired {
/**
* required_lookup_at is the snapshot revision at which the permission set needs to be rebuilt to.
*
* @generated from protobuf field: authzed.api.v1.ZedToken required_lookup_at = 1;
*/
requiredLookupAt?: ZedToken;
}
/**
* BreakingSchemaChange is used to signal a breaking schema change has happened, and that the consumer should
* expect delays in the ingestion of new changes, because the permission set snapshot needs to be rebuilt from scratch.
* Once the snapshot is ready, the consumer will receive a LookupPermissionSetsRequired event.
*
* @generated from protobuf message authzed.api.materialize.v0.BreakingSchemaChange
*/
export interface BreakingSchemaChange {
/**
* change_at is the revision at which a breaking schema event has happened.
*
* @generated from protobuf field: authzed.api.v1.ZedToken change_at = 1;
*/
changeAt?: ZedToken;
}
// @generated message type with reflection information, may provide speed optimized methods
class WatchPermissionSetsRequest$Type extends MessageType<WatchPermissionSetsRequest> {
constructor() {
super("authzed.api.materialize.v0.WatchPermissionSetsRequest", [
{ no: 1, name: "optional_starting_after", kind: "message", T: () => ZedToken }
]);
}
create(value?: PartialMessage<WatchPermissionSetsRequest>): WatchPermissionSetsRequest {
const message = {};
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
if (value !== undefined)
reflectionMergePartial<WatchPermissionSetsRequest>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: WatchPermissionSetsRequest): WatchPermissionSetsRequest {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* authzed.api.v1.ZedToken optional_starting_after */ 1:
message.optionalStartingAfter = ZedToken.internalBinaryRead(reader, reader.uint32(), options, message.optionalStartingAfter);
break;
default:
let u = options.readUnknownField;
if (u === "throw")
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
let d = reader.skip(wireType);
if (u !== false)
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
}
}
return message;
}
internalBinaryWrite(message: WatchPermissionSetsRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* authzed.api.v1.ZedToken optional_starting_after = 1; */
if (message.optionalStartingAfter)
ZedToken.internalBinaryWrite(message.optionalStartingAfter, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message authzed.api.materialize.v0.WatchPermissionSetsRequest
*/
export const WatchPermissionSetsRequest = new WatchPermissionSetsRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class WatchPermissionSetsResponse$Type extends MessageType<WatchPermissionSetsResponse> {
constructor() {
super("authzed.api.materialize.v0.WatchPermissionSetsResponse", [
{ no: 1, name: "change", kind: "message", oneof: "response", T: () => PermissionSetChange },
{ no: 2, name: "completed_revision", kind: "message", oneof: "response", T: () => ZedToken },
{ no: 3, name: "lookup_permission_sets_required", kind: "message", oneof: "response", T: () => LookupPermissionSetsRequired },
{ no: 4, name: "breaking_schema_change", kind: "message", oneof: "response", T: () => BreakingSchemaChange }
]);
}
create(value?: PartialMessage<WatchPermissionSetsResponse>): WatchPermissionSetsResponse {
const message = { response: { oneofKind: undefined } };
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
if (value !== undefined)
reflectionMergePartial<WatchPermissionSetsResponse>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: WatchPermissionSetsResponse): WatchPermissionSetsResponse {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* authzed.api.materialize.v0.PermissionSetChange change */ 1:
message.response = {
oneofKind: "change",
change: PermissionSetChange.internalBinaryRead(reader, reader.uint32(), options, (message.response as any).change)
};
break;
case /* authzed.api.v1.ZedToken completed_revision */ 2:
message.response = {
oneofKind: "completedRevision",
completedRevision: ZedToken.internalBinaryRead(reader, reader.uint32(), options, (message.response as any).completedRevision)
};
break;
case /* authzed.api.materialize.v0.LookupPermissionSetsRequired lookup_permission_sets_required */ 3:
message.response = {
oneofKind: "lookupPermissionSetsRequired",
lookupPermissionSetsRequired: LookupPermissionSetsRequired.internalBinaryRead(reader, reader.uint32(), options, (message.response as any).lookupPermissionSetsRequired)
};
break;
case /* authzed.api.materialize.v0.BreakingSchemaChange breaking_schema_change */ 4:
message.response = {
oneofKind: "breakingSchemaChange",
breakingSchemaChange: BreakingSchemaChange.internalBinaryRead(reader, reader.uint32(), options, (message.response as any).breakingSchemaChange)
};
break;
default:
let u = options.readUnknownField;
if (u === "throw")
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
let d = reader.skip(wireType);
if (u !== false)
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
}
}
return message;
}
internalBinaryWrite(message: WatchPermissionSetsResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* authzed.api.materialize.v0.PermissionSetChange change = 1; */
if (message.response.oneofKind === "change")
PermissionSetChange.internalBinaryWrite(message.response.change, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
/* authzed.api.v1.ZedToken completed_revision = 2; */
if (message.response.oneofKind === "completedRevision")
ZedToken.internalBinaryWrite(message.response.completedRevision, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
/* authzed.api.materialize.v0.LookupPermissionSetsRequired lookup_permission_sets_required = 3; */
if (message.response.oneofKind === "lookupPermissionSetsRequired")
LookupPermissionSetsRequired.internalBinaryWrite(message.response.lookupPermissionSetsRequired, writer.tag(3, WireType.LengthDelimited).fork(), options).join();
/* authzed.api.materialize.v0.BreakingSchemaChange breaking_schema_change = 4; */
if (message.response.oneofKind === "breakingSchemaChange")
BreakingSchemaChange.internalBinaryWrite(message.response.breakingSchemaChange, writer.tag(4, WireType.LengthDelimited).fork(), options).join();
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message authzed.api.materialize.v0.WatchPermissionSetsResponse
*/
export const WatchPermissionSetsResponse = new WatchPermissionSetsResponse$Type();
// @generated message type with reflection information, may provide speed optimized methods
class Cursor$Type extends MessageType<Cursor> {
constructor() {
super("authzed.api.materialize.v0.Cursor", [
{ no: 1, name: "limit", kind: "scalar", T: 13 /*ScalarType.UINT32*/ },
{ no: 4, name: "token", kind: "message", T: () => ZedToken },
{ no: 5, name: "starting_index", kind: "scalar", T: 13 /*ScalarType.UINT32*/ },
{ no: 6, name: "completed_members", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
{ no: 7, name: "starting_key", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 8, name: "cursor", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
]);
}
create(value?: PartialMessage<Cursor>): Cursor {
const message = { limit: 0, startingIndex: 0, completedMembers: false, startingKey: "", cursor: "" };
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
if (value !== undefined)
reflectionMergePartial<Cursor>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Cursor): Cursor {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* uint32 limit */ 1:
message.limit = reader.uint32();
break;
case /* authzed.api.v1.ZedToken token */ 4:
message.token = ZedToken.internalBinaryRead(reader, reader.uint32(), options, message.token);
break;
case /* uint32 starting_index */ 5:
message.startingIndex = reader.uint32();
break;
case /* bool completed_members */ 6:
message.completedMembers = reader.bool();
break;
case /* string starting_key */ 7:
message.startingKey = reader.string();
break;
case /* string cursor */ 8:
message.cursor = reader.string();
break;
default:
let u = options.readUnknownField;
if (u === "throw")
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
let d = reader.skip(wireType);
if (u !== false)
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
}
}
return message;
}
internalBinaryWrite(message: Cursor, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* uint32 limit = 1; */
if (message.limit !== 0)
writer.tag(1, WireType.Varint).uint32(message.limit);
/* authzed.api.v1.ZedToken token = 4; */
if (message.token)
ZedToken.internalBinaryWrite(message.token, writer.tag(4, WireType.LengthDelimited).fork(), options).join();
/* uint32 starting_index = 5; */
if (message.startingIndex !== 0)
writer.tag(5, WireType.Varint).uint32(message.startingIndex);
/* bool completed_members = 6; */
if (message.completedMembers !== false)
writer.tag(6, WireType.Varint).bool(message.completedMembers);
/* string starting_key = 7; */
if (message.startingKey !== "")
writer.tag(7, WireType.LengthDelimited).string(message.startingKey);
/* string cursor = 8; */
if (message.cursor !== "")
writer.tag(8, WireType.LengthDelimited).string(message.cursor);
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message authzed.api.materialize.v0.Cursor
*/
export const Cursor = new Cursor$Type();
// @generated message type with reflection information, may provide speed optimized methods
class LookupPermissionSetsRequest$Type extends MessageType<LookupPermissionSetsRequest> {
constructor() {
super("authzed.api.materialize.v0.LookupPermissionSetsRequest", [
{ no: 1, name: "limit", kind: "scalar", T: 13 /*ScalarType.UINT32*/ },
{ no: 2, name: "optional_at_revision", kind: "message", T: () => ZedToken },
{ no: 4, name: "optional_starting_after_cursor", kind: "message", T: () => Cursor }
]);
}
create(value?: PartialMessage<LookupPermissionSetsRequest>): LookupPermissionSetsRequest {
const message = { limit: 0 };
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
if (value !== undefined)
reflectionMergePartial<LookupPermissionSetsRequest>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: LookupPermissionSetsRequest): LookupPermissionSetsRequest {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* uint32 limit */ 1:
message.limit = reader.uint32();
break;
case /* authzed.api.v1.ZedToken optional_at_revision */ 2:
message.optionalAtRevision = ZedToken.internalBinaryRead(reader, reader.uint32(), options, message.optionalAtRevision);
break;
case /* authzed.api.materialize.v0.Cursor optional_starting_after_cursor */ 4:
message.optionalStartingAfterCursor = Cursor.internalBinaryRead(reader, reader.uint32(), options, message.optionalStartingAfterCursor);
break;
default:
let u = options.readUnknownField;
if (u === "throw")
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
let d = reader.skip(wireType);
if (u !== false)
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
}
}
return message;
}
internalBinaryWrite(message: LookupPermissionSetsRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* uint32 limit = 1; */
if (message.limit !== 0)
writer.tag(1, WireType.Varint).uint32(message.limit);
/* authzed.api.v1.ZedToken optional_at_revision = 2; */
if (message.optionalAtRevision)
ZedToken.internalBinaryWrite(message.optionalAtRevision, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
/* authzed.api.materialize.v0.Cursor optional_starting_after_cursor = 4; */
if (message.optionalStartingAfterCursor)
Cursor.internalBinaryWrite(message.optionalStartingAfterCursor, writer.tag(4, WireType.LengthDelimited).fork(), options).join();
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message authzed.api.materialize.v0.LookupPermissionSetsRequest
*/
export const LookupPermissionSetsRequest = new LookupPermissionSetsRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class LookupPermissionSetsResponse$Type extends MessageType<LookupPermissionSetsResponse> {
constructor() {
super("authzed.api.materialize.v0.LookupPermissionSetsResponse", [
{ no: 1, name: "change", kind: "message", T: () => PermissionSetChange },
{ no: 2, name: "cursor", kind: "message", T: () => Cursor }
]);
}
create(value?: PartialMessage<LookupPermissionSetsResponse>): LookupPermissionSetsResponse {
const message = {};
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
if (value !== undefined)
reflectionMergePartial<LookupPermissionSetsResponse>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: LookupPermissionSetsResponse): LookupPermissionSetsResponse {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* authzed.api.materialize.v0.PermissionSetChange change */ 1:
message.change = PermissionSetChange.internalBinaryRead(reader, reader.uint32(), options, message.change);
break;
case /* authzed.api.materialize.v0.Cursor cursor */ 2:
message.cursor = Cursor.internalBinaryRead(reader, reader.uint32(), options, message.cursor);
break;
default:
let u = options.readUnknownField;
if (u === "throw")
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
let d = reader.skip(wireType);
if (u !== false)
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
}
}
return message;
}
internalBinaryWrite(message: LookupPermissionSetsResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* authzed.api.materialize.v0.PermissionSetChange change = 1; */
if (message.change)
PermissionSetChange.internalBinaryWrite(message.change, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
/* authzed.api.materialize.v0.Cursor cursor = 2; */
if (message.cursor)
Cursor.internalBinaryWrite(message.cursor, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message authzed.api.materialize.v0.LookupPermissionSetsResponse
*/
export const LookupPermissionSetsResponse = new LookupPermissionSetsResponse$Type();
// @generated message type with reflection information, may provide speed optimized methods
class PermissionSetChange$Type extends MessageType<PermissionSetChange> {
constructor() {
super("authzed.api.materialize.v0.PermissionSetChange", [
{ no: 1, name: "at_revision", kind: "message", T: () => ZedToken },
{ no: 2, name: "operation", kind: "enum", T: () => ["authzed.api.materialize.v0.PermissionSetChange.SetOperation", PermissionSetChange_SetOperation, "SET_OPERATION_"] },
{ no: 3, name: "parent_set", kind: "message", T: () => SetReference },
{ no: 4, name: "child_set", kind: "message", oneof: "child", T: () => SetReference },
{ no: 5, name: "child_member", kind: "message", oneof: "child", T: () => MemberReference }
]);
}
create(value?: PartialMessage<PermissionSetChange>): PermissionSetChange {
const message = { operation: 0, child: { oneofKind: undefined } };
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
if (value !== undefined)
reflectionMergePartial<PermissionSetChange>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: PermissionSetChange): PermissionSetChange {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* authzed.api.v1.ZedToken at_revision */ 1:
message.atRevision = ZedToken.internalBinaryRead(reader, reader.uint32(), options, message.atRevision);
break;
case /* authzed.api.materialize.v0.PermissionSetChange.SetOperation operation */ 2:
message.operation = reader.int32();
break;
case /* authzed.api.materialize.v0.SetReference parent_set */ 3:
message.parentSet = SetReference.internalBinaryRead(reader, reader.uint32(), options, message.parentSet);
break;
case /* authzed.api.materialize.v0.SetReference child_set */ 4:
message.child = {
oneofKind: "childSet",
childSet: SetReference.internalBinaryRead(reader, reader.uint32(), options, (message.child as any).childSet)
};
break;
case /* authzed.api.materialize.v0.MemberReference child_member */ 5:
message.child = {
oneofKind: "childMember",
childMember: MemberReference.internalBinaryRead(reader, reader.uint32(), options, (message.child as any).childMember)
};
break;
default:
let u = options.readUnknownField;
if (u === "throw")
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
let d = reader.skip(wireType);
if (u !== false)
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
}
}
return message;
}
internalBinaryWrite(message: PermissionSetChange, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* authzed.api.v1.ZedToken at_revision = 1; */
if (message.atRevision)
ZedToken.internalBinaryWrite(message.atRevision, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
/* authzed.api.materialize.v0.PermissionSetChange.SetOperation operation = 2; */
if (message.operation !== 0)
writer.tag(2, WireType.Varint).int32(message.operation);
/* authzed.api.materialize.v0.SetReference parent_set = 3; */
if (message.parentSet)
SetReference.internalBinaryWrite(message.parentSet, writer.tag(3, WireType.LengthDelimited).fork(), options).join();
/* authzed.api.materialize.v0.SetReference child_set = 4; */
if (message.child.oneofKind === "childSet")
SetReference.internalBinaryWrite(message.child.childSet, writer.tag(4, WireType.LengthDelimited).fork(), options).join();
/* authzed.api.materialize.v0.MemberReference child_member = 5; */
if (message.child.oneofKind === "childMember")
MemberReference.internalBinaryWrite(message.child.childMember, writer.tag(5, WireType.LengthDelimited).fork(), options).join();
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message authzed.api.materialize.v0.PermissionSetChange
*/
export const PermissionSetChange = new PermissionSetChange$Type();
// @generated message type with reflection information, may provide speed optimized methods
class SetReference$Type extends MessageType<SetReference> {
constructor() {
super("authzed.api.materialize.v0.SetReference", [
{ no: 1, name: "object_type", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 2, name: "object_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 3, name: "permission_or_relation", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
]);
}
create(value?: PartialMessage<SetReference>): SetReference {
const message = { objectType: "", objectId: "", permissionOrRelation: "" };
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
if (value !== undefined)
reflectionMergePartial<SetReference>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: SetReference): SetReference {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* string object_type */ 1:
message.objectType = reader.string();
break;
case /* string object_id */ 2:
message.objectId = reader.string();
break;
case /* string permission_or_relation */ 3:
message.permissionOrRelation = reader.string();
break;
default:
let u = options.readUnknownField;
if (u === "throw")
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
let d = reader.skip(wireType);
if (u !== false)
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
}
}
return message;
}
internalBinaryWrite(message: SetReference, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* string object_type = 1; */
if (message.objectType !== "")
writer.tag(1, WireType.LengthDelimited).string(message.objectType);
/* string object_id = 2; */
if (message.objectId !== "")
writer.tag(2, WireType.LengthDelimited).string(message.objectId);
/* string permission_or_relation = 3; */
if (message.permissionOrRelation !== "")
writer.tag(3, WireType.LengthDelimited).string(message.permissionOrRelation);
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message authzed.api.materialize.v0.SetReference
*/
export const SetReference = new SetReference$Type();
// @generated message type with reflection information, may provide speed optimized methods
class MemberReference$Type extends MessageType<MemberReference> {
constructor() {
super("authzed.api.materialize.v0.MemberReference", [
{ no: 1, name: "object_type", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 2, name: "object_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 3, name: "optional_permission_or_relation", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
]);
}
create(value?: PartialMessage<MemberReference>): MemberReference {
const message = { objectType: "", objectId: "", optionalPermissionOrRelation: "" };
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
if (value !== undefined)
reflectionMergePartial<MemberReference>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: MemberReference): MemberReference {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* string object_type */ 1:
message.objectType = reader.string();
break;
case /* string object_id */ 2:
message.objectId = reader.string();
break;
case /* string optional_permission_or_relation */ 3:
message.optionalPermissionOrRelation = reader.string();
break;
default:
let u = options.readUnknownField;
if (u === "throw")
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
let d = reader.skip(wireType);
if (u !== false)
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
}
}
return message;
}
internalBinaryWrite(message: MemberReference, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* string object_type = 1; */
if (message.objectType !== "")
writer.tag(1, WireType.LengthDelimited).string(message.objectType);
/* string object_id = 2; */
if (message.objectId !== "")
writer.tag(2, WireType.LengthDelimited).string(message.objectId);
/* string optional_permission_or_relation = 3; */
if (message.optionalPermissionOrRelation !== "")
writer.tag(3, WireType.LengthDelimited).string(message.optionalPermissionOrRelation);
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message authzed.api.materialize.v0.MemberReference
*/
export const MemberReference = new MemberReference$Type();
// @generated message type with reflection information, may provide speed optimized methods
class LookupPermissionSetsRequired$Type extends MessageType<LookupPermissionSetsRequired> {
constructor() {
super("authzed.api.materialize.v0.LookupPermissionSetsRequired", [
{ no: 1, name: "required_lookup_at", kind: "message", T: () => ZedToken }
]);
}
create(value?: PartialMessage<LookupPermissionSetsRequired>): LookupPermissionSetsRequired {
const message = {};
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
if (value !== undefined)
reflectionMergePartial<LookupPermissionSetsRequired>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: LookupPermissionSetsRequired): LookupPermissionSetsRequired {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* authzed.api.v1.ZedToken required_lookup_at */ 1:
message.requiredLookupAt = ZedToken.internalBinaryRead(reader, reader.uint32(), options, message.requiredLookupAt);
break;
default:
let u = options.readUnknownField;
if (u === "throw")
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
let d = reader.skip(wireType);
if (u !== false)
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
}
}
return message;
}
internalBinaryWrite(message: LookupPermissionSetsRequired, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* authzed.api.v1.ZedToken required_lookup_at = 1; */
if (message.requiredLookupAt)
ZedToken.internalBinaryWrite(message.requiredLookupAt, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message authzed.api.materialize.v0.LookupPermissionSetsRequired
*/
export const LookupPermissionSetsRequired = new LookupPermissionSetsRequired$Type();
// @generated message type with reflection information, may provide speed optimized methods
class BreakingSchemaChange$Type extends MessageType<BreakingSchemaChange> {
constructor() {
super("authzed.api.materialize.v0.BreakingSchemaChange", [
{ no: 1, name: "change_at", kind: "message", T: () => ZedToken }
]);
}
create(value?: PartialMessage<BreakingSchemaChange>): BreakingSchemaChange {
const message = {};
globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this });
if (value !== undefined)
reflectionMergePartial<BreakingSchemaChange>(this, message, value);
return message;
}
internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: BreakingSchemaChange): BreakingSchemaChange {
let message = target ?? this.create(), end = reader.pos + length;
while (reader.pos < end) {
let [fieldNo, wireType] = reader.tag();
switch (fieldNo) {
case /* authzed.api.v1.ZedToken change_at */ 1:
message.changeAt = ZedToken.internalBinaryRead(reader, reader.uint32(), options, message.changeAt);
break;
default:
let u = options.readUnknownField;
if (u === "throw")
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
let d = reader.skip(wireType);
if (u !== false)
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
}
}
return message;
}
internalBinaryWrite(message: BreakingSchemaChange, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
/* authzed.api.v1.ZedToken change_at = 1; */
if (message.changeAt)
ZedToken.internalBinaryWrite(message.changeAt, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
let u = options.writeUnknownFields;
if (u !== false)
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
return writer;
}
}
/**
* @generated MessageType for protobuf message authzed.api.materialize.v0.BreakingSchemaChange
*/
export const BreakingSchemaChange = new BreakingSchemaChange$Type();
/**
* @generated ServiceType for protobuf service authzed.api.materialize.v0.WatchPermissionSetsService
*/
export const WatchPermissionSetsService = new ServiceType("authzed.api.materialize.v0.WatchPermissionSetsService", [
{ name: "WatchPermissionSets", serverStreaming: true, options: {}, I: WatchPermissionSetsRequest, O: WatchPermissionSetsResponse },
{ name: "LookupPermissionSets", serverStreaming: true, options: {}, I: LookupPermissionSetsRequest, O: LookupPermissionSetsResponse }
]);