@structured-id/proto 0.14.0 → 0.15.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.
@@ -6,6 +6,8 @@ import type { IBinaryReader } from "@protobuf-ts/runtime";
6
6
  import type { PartialMessage } from "@protobuf-ts/runtime";
7
7
  import { MessageType } from "@protobuf-ts/runtime";
8
8
  import { Timestamp } from "../../../google/protobuf/timestamp.js";
9
+ import { ProfileId } from "../ids/ids.js";
10
+ import { PatId } from "../ids/ids.js";
9
11
  /**
10
12
  * PAT metadata (returned in responses — NEVER includes token plaintext).
11
13
  *
@@ -13,13 +15,15 @@ import { Timestamp } from "../../../google/protobuf/timestamp.js";
13
15
  */
14
16
  export interface Pat {
15
17
  /**
16
- * @generated from protobuf field: string id = 1
18
+ * @generated from protobuf field: sid.v1.ids.PatId id = 1
17
19
  */
18
- id: string;
20
+ id?: PatId;
19
21
  /**
20
- * @generated from protobuf field: string profile_id = 2
22
+ * Profile the token acts for.
23
+ *
24
+ * @generated from protobuf field: sid.v1.ids.ProfileId profile_id = 2
21
25
  */
22
- profileId: string;
26
+ profileId?: ProfileId;
23
27
  /**
24
28
  * @generated from protobuf field: string name = 3
25
29
  */
@@ -99,9 +103,9 @@ export interface CreatePatRequest {
99
103
  */
100
104
  export interface CreatePatResponse {
101
105
  /**
102
- * @generated from protobuf field: string pat_id = 1
106
+ * @generated from protobuf field: sid.v1.ids.PatId pat_id = 1
103
107
  */
104
- patId: string;
108
+ patId?: PatId;
105
109
  /**
106
110
  * @generated from protobuf field: string token = 2
107
111
  */
@@ -134,9 +138,9 @@ export interface ListPatsResponse {
134
138
  */
135
139
  export interface GetPatRequest {
136
140
  /**
137
- * @generated from protobuf field: string pat_id = 1
141
+ * @generated from protobuf field: sid.v1.ids.PatId pat_id = 1
138
142
  */
139
- patId: string;
143
+ patId?: PatId;
140
144
  }
141
145
  /**
142
146
  * @generated from protobuf message sid.v1.machine.PatResponse
@@ -152,9 +156,9 @@ export interface PatResponse {
152
156
  */
153
157
  export interface RevokePatRequest {
154
158
  /**
155
- * @generated from protobuf field: string pat_id = 1
159
+ * @generated from protobuf field: sid.v1.ids.PatId pat_id = 1
156
160
  */
157
- patId: string;
161
+ patId?: PatId;
158
162
  }
159
163
  /**
160
164
  * @generated from protobuf message sid.v1.machine.RevokePatResponse
@@ -214,9 +218,9 @@ export interface ListAllPatsResponse {
214
218
  */
215
219
  export interface AdminRevokePatRequest {
216
220
  /**
217
- * @generated from protobuf field: string pat_id = 1
221
+ * @generated from protobuf field: sid.v1.ids.PatId pat_id = 1
218
222
  */
219
- patId: string;
223
+ patId?: PatId;
220
224
  }
221
225
  /**
222
226
  * Status of a personal access token.
@@ -8,6 +8,8 @@ import { UnknownFieldHandler } from "@protobuf-ts/runtime";
8
8
  import { reflectionMergePartial } from "@protobuf-ts/runtime";
9
9
  import { MessageType } from "@protobuf-ts/runtime";
10
10
  import { Timestamp } from "../../../google/protobuf/timestamp.js";
11
+ import { ProfileId } from "../ids/ids.js";
12
+ import { PatId } from "../ids/ids.js";
11
13
  /**
12
14
  * Status of a personal access token.
13
15
  *
@@ -36,8 +38,8 @@ export var PatStatus;
36
38
  class Pat$Type extends MessageType {
37
39
  constructor() {
38
40
  super("sid.v1.machine.Pat", [
39
- { no: 1, name: "id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
40
- { no: 2, name: "profile_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
41
+ { no: 1, name: "id", kind: "message", T: () => PatId },
42
+ { no: 2, name: "profile_id", kind: "message", T: () => ProfileId },
41
43
  { no: 3, name: "name", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
42
44
  { no: 4, name: "description", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
43
45
  { no: 5, name: "token_prefix", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
@@ -54,8 +56,6 @@ class Pat$Type extends MessageType {
54
56
  }
55
57
  create(value) {
56
58
  const message = globalThis.Object.create((this.messagePrototype));
57
- message.id = "";
58
- message.profileId = "";
59
59
  message.name = "";
60
60
  message.description = "";
61
61
  message.tokenPrefix = "";
@@ -73,11 +73,11 @@ class Pat$Type extends MessageType {
73
73
  while (reader.pos < end) {
74
74
  let [fieldNo, wireType] = reader.tag();
75
75
  switch (fieldNo) {
76
- case /* string id */ 1:
77
- message.id = reader.string();
76
+ case /* sid.v1.ids.PatId id */ 1:
77
+ message.id = PatId.internalBinaryRead(reader, reader.uint32(), options, message.id);
78
78
  break;
79
- case /* string profile_id */ 2:
80
- message.profileId = reader.string();
79
+ case /* sid.v1.ids.ProfileId profile_id */ 2:
80
+ message.profileId = ProfileId.internalBinaryRead(reader, reader.uint32(), options, message.profileId);
81
81
  break;
82
82
  case /* string name */ 3:
83
83
  message.name = reader.string();
@@ -127,12 +127,12 @@ class Pat$Type extends MessageType {
127
127
  return message;
128
128
  }
129
129
  internalBinaryWrite(message, writer, options) {
130
- /* string id = 1; */
131
- if (message.id !== "")
132
- writer.tag(1, WireType.LengthDelimited).string(message.id);
133
- /* string profile_id = 2; */
134
- if (message.profileId !== "")
135
- writer.tag(2, WireType.LengthDelimited).string(message.profileId);
130
+ /* sid.v1.ids.PatId id = 1; */
131
+ if (message.id)
132
+ PatId.internalBinaryWrite(message.id, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
133
+ /* sid.v1.ids.ProfileId profile_id = 2; */
134
+ if (message.profileId)
135
+ ProfileId.internalBinaryWrite(message.profileId, writer.tag(2, WireType.LengthDelimited).fork(), options).join();
136
136
  /* string name = 3; */
137
137
  if (message.name !== "")
138
138
  writer.tag(3, WireType.LengthDelimited).string(message.name);
@@ -261,7 +261,7 @@ export const CreatePatRequest = new CreatePatRequest$Type();
261
261
  class CreatePatResponse$Type extends MessageType {
262
262
  constructor() {
263
263
  super("sid.v1.machine.CreatePatResponse", [
264
- { no: 1, name: "pat_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
264
+ { no: 1, name: "pat_id", kind: "message", T: () => PatId },
265
265
  { no: 2, name: "token", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
266
266
  { no: 3, name: "token_prefix", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
267
267
  { no: 4, name: "metadata", kind: "message", T: () => Pat }
@@ -269,7 +269,6 @@ class CreatePatResponse$Type extends MessageType {
269
269
  }
270
270
  create(value) {
271
271
  const message = globalThis.Object.create((this.messagePrototype));
272
- message.patId = "";
273
272
  message.token = "";
274
273
  message.tokenPrefix = "";
275
274
  if (value !== undefined)
@@ -281,8 +280,8 @@ class CreatePatResponse$Type extends MessageType {
281
280
  while (reader.pos < end) {
282
281
  let [fieldNo, wireType] = reader.tag();
283
282
  switch (fieldNo) {
284
- case /* string pat_id */ 1:
285
- message.patId = reader.string();
283
+ case /* sid.v1.ids.PatId pat_id */ 1:
284
+ message.patId = PatId.internalBinaryRead(reader, reader.uint32(), options, message.patId);
286
285
  break;
287
286
  case /* string token */ 2:
288
287
  message.token = reader.string();
@@ -305,9 +304,9 @@ class CreatePatResponse$Type extends MessageType {
305
304
  return message;
306
305
  }
307
306
  internalBinaryWrite(message, writer, options) {
308
- /* string pat_id = 1; */
309
- if (message.patId !== "")
310
- writer.tag(1, WireType.LengthDelimited).string(message.patId);
307
+ /* sid.v1.ids.PatId pat_id = 1; */
308
+ if (message.patId)
309
+ PatId.internalBinaryWrite(message.patId, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
311
310
  /* string token = 2; */
312
311
  if (message.token !== "")
313
312
  writer.tag(2, WireType.LengthDelimited).string(message.token);
@@ -416,12 +415,11 @@ export const ListPatsResponse = new ListPatsResponse$Type();
416
415
  class GetPatRequest$Type extends MessageType {
417
416
  constructor() {
418
417
  super("sid.v1.machine.GetPatRequest", [
419
- { no: 1, name: "pat_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
418
+ { no: 1, name: "pat_id", kind: "message", T: () => PatId }
420
419
  ]);
421
420
  }
422
421
  create(value) {
423
422
  const message = globalThis.Object.create((this.messagePrototype));
424
- message.patId = "";
425
423
  if (value !== undefined)
426
424
  reflectionMergePartial(this, message, value);
427
425
  return message;
@@ -431,8 +429,8 @@ class GetPatRequest$Type extends MessageType {
431
429
  while (reader.pos < end) {
432
430
  let [fieldNo, wireType] = reader.tag();
433
431
  switch (fieldNo) {
434
- case /* string pat_id */ 1:
435
- message.patId = reader.string();
432
+ case /* sid.v1.ids.PatId pat_id */ 1:
433
+ message.patId = PatId.internalBinaryRead(reader, reader.uint32(), options, message.patId);
436
434
  break;
437
435
  default:
438
436
  let u = options.readUnknownField;
@@ -446,9 +444,9 @@ class GetPatRequest$Type extends MessageType {
446
444
  return message;
447
445
  }
448
446
  internalBinaryWrite(message, writer, options) {
449
- /* string pat_id = 1; */
450
- if (message.patId !== "")
451
- writer.tag(1, WireType.LengthDelimited).string(message.patId);
447
+ /* sid.v1.ids.PatId pat_id = 1; */
448
+ if (message.patId)
449
+ PatId.internalBinaryWrite(message.patId, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
452
450
  let u = options.writeUnknownFields;
453
451
  if (u !== false)
454
452
  (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -509,12 +507,11 @@ export const PatResponse = new PatResponse$Type();
509
507
  class RevokePatRequest$Type extends MessageType {
510
508
  constructor() {
511
509
  super("sid.v1.machine.RevokePatRequest", [
512
- { no: 1, name: "pat_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
510
+ { no: 1, name: "pat_id", kind: "message", T: () => PatId }
513
511
  ]);
514
512
  }
515
513
  create(value) {
516
514
  const message = globalThis.Object.create((this.messagePrototype));
517
- message.patId = "";
518
515
  if (value !== undefined)
519
516
  reflectionMergePartial(this, message, value);
520
517
  return message;
@@ -524,8 +521,8 @@ class RevokePatRequest$Type extends MessageType {
524
521
  while (reader.pos < end) {
525
522
  let [fieldNo, wireType] = reader.tag();
526
523
  switch (fieldNo) {
527
- case /* string pat_id */ 1:
528
- message.patId = reader.string();
524
+ case /* sid.v1.ids.PatId pat_id */ 1:
525
+ message.patId = PatId.internalBinaryRead(reader, reader.uint32(), options, message.patId);
529
526
  break;
530
527
  default:
531
528
  let u = options.readUnknownField;
@@ -539,9 +536,9 @@ class RevokePatRequest$Type extends MessageType {
539
536
  return message;
540
537
  }
541
538
  internalBinaryWrite(message, writer, options) {
542
- /* string pat_id = 1; */
543
- if (message.patId !== "")
544
- writer.tag(1, WireType.LengthDelimited).string(message.patId);
539
+ /* sid.v1.ids.PatId pat_id = 1; */
540
+ if (message.patId)
541
+ PatId.internalBinaryWrite(message.patId, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
545
542
  let u = options.writeUnknownFields;
546
543
  if (u !== false)
547
544
  (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -805,12 +802,11 @@ export const ListAllPatsResponse = new ListAllPatsResponse$Type();
805
802
  class AdminRevokePatRequest$Type extends MessageType {
806
803
  constructor() {
807
804
  super("sid.v1.machine.AdminRevokePatRequest", [
808
- { no: 1, name: "pat_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
805
+ { no: 1, name: "pat_id", kind: "message", T: () => PatId }
809
806
  ]);
810
807
  }
811
808
  create(value) {
812
809
  const message = globalThis.Object.create((this.messagePrototype));
813
- message.patId = "";
814
810
  if (value !== undefined)
815
811
  reflectionMergePartial(this, message, value);
816
812
  return message;
@@ -820,8 +816,8 @@ class AdminRevokePatRequest$Type extends MessageType {
820
816
  while (reader.pos < end) {
821
817
  let [fieldNo, wireType] = reader.tag();
822
818
  switch (fieldNo) {
823
- case /* string pat_id */ 1:
824
- message.patId = reader.string();
819
+ case /* sid.v1.ids.PatId pat_id */ 1:
820
+ message.patId = PatId.internalBinaryRead(reader, reader.uint32(), options, message.patId);
825
821
  break;
826
822
  default:
827
823
  let u = options.readUnknownField;
@@ -835,9 +831,9 @@ class AdminRevokePatRequest$Type extends MessageType {
835
831
  return message;
836
832
  }
837
833
  internalBinaryWrite(message, writer, options) {
838
- /* string pat_id = 1; */
839
- if (message.patId !== "")
840
- writer.tag(1, WireType.LengthDelimited).string(message.patId);
834
+ /* sid.v1.ids.PatId pat_id = 1; */
835
+ if (message.patId)
836
+ PatId.internalBinaryWrite(message.patId, writer.tag(1, WireType.LengthDelimited).fork(), options).join();
841
837
  let u = options.writeUnknownFields;
842
838
  if (u !== false)
843
839
  (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -854,10 +850,10 @@ export const AdminRevokePatRequest = new AdminRevokePatRequest$Type();
854
850
  export const PatService = new ServiceType("sid.v1.machine.PatService", [
855
851
  { name: "CreatePat", idempotency: "IDEMPOTENT", options: { "google.api.http": { post: "/v1/pats", body: "*" }, "sid.v1.common.retry": { keyed: true } }, I: CreatePatRequest, O: CreatePatResponse },
856
852
  { name: "ListPats", idempotency: "NO_SIDE_EFFECTS", options: { "google.api.http": { get: "/v1/pats" } }, I: ListPatsRequest, O: ListPatsResponse },
857
- { name: "GetPat", idempotency: "NO_SIDE_EFFECTS", options: { "google.api.http": { get: "/v1/pats/{pat_id}" } }, I: GetPatRequest, O: PatResponse },
858
- { name: "RevokePat", idempotency: "IDEMPOTENT", options: { "google.api.http": { delete: "/v1/pats/{pat_id}" }, "sid.v1.common.retry": { natural: "a revoked token is never reactivated: a repeat finds it revoked and answers as the first" } }, I: RevokePatRequest, O: RevokePatResponse },
853
+ { name: "GetPat", idempotency: "NO_SIDE_EFFECTS", options: { "google.api.http": { get: "/v1/pats/{pat_id.value}" } }, I: GetPatRequest, O: PatResponse },
854
+ { name: "RevokePat", idempotency: "IDEMPOTENT", options: { "google.api.http": { delete: "/v1/pats/{pat_id.value}" }, "sid.v1.common.retry": { natural: "a revoked token is never reactivated: a repeat finds it revoked and answers as the first" } }, I: RevokePatRequest, O: RevokePatResponse },
859
855
  { name: "ExchangePat", options: { "google.api.http": { post: "/v1/pats/exchange", body: "*" }, "sid.v1.common.retry": { ceremony: "RFC 8693 \u00A72: each exchange issues its own short-lived access token from the presented token; an issued token is never replayed from a record" } }, I: ExchangePatRequest, O: ExchangePatResponse },
860
856
  { name: "ListAllPats", idempotency: "NO_SIDE_EFFECTS", options: { "google.api.http": { get: "/v1/admin/pats" } }, I: ListAllPatsRequest, O: ListAllPatsResponse },
861
- { name: "AdminRevokePat", idempotency: "IDEMPOTENT", options: { "google.api.http": { delete: "/v1/admin/pats/{pat_id}" }, "sid.v1.common.retry": { natural: "a revoked token is never reactivated: a repeat finds it revoked and answers as the first" } }, I: AdminRevokePatRequest, O: RevokePatResponse }
857
+ { name: "AdminRevokePat", idempotency: "IDEMPOTENT", options: { "google.api.http": { delete: "/v1/admin/pats/{pat_id.value}" }, "sid.v1.common.retry": { natural: "a revoked token is never reactivated: a repeat finds it revoked and answers as the first" } }, I: AdminRevokePatRequest, O: RevokePatResponse }
862
858
  ]);
863
859
  //# sourceMappingURL=pat.js.map