@replit/protocol 0.4.26 → 0.4.28

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.
@@ -184,6 +184,15 @@ export interface Org {
184
184
  * @generated from protobuf field: bool is_enterprise = 4
185
185
  */
186
186
  isEnterprise: boolean;
187
+ /**
188
+ * Customer ID is the entity billed for this org, as determined by Replit web
189
+ * (the shared billing customer, not the org id — sibling orgs can share one).
190
+ * Opaque to goval; used as the customer segment of the repl's SPIFFE
191
+ * identity. Empty when web does not provide one.
192
+ *
193
+ * @generated from protobuf field: string customer_id = 5
194
+ */
195
+ customerId: string;
187
196
  }
188
197
  /**
189
198
  * Organization type. There are legacy types, but we are not
@@ -378,7 +378,8 @@ class Org$Type extends MessageType {
378
378
  { no: 1, name: "id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
379
379
  { no: 2, name: "type", kind: "enum", T: () => ["replit.goval.api.repl.Org.OrgType", Org_OrgType] },
380
380
  { no: 3, name: "slug", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
381
- { no: 4, name: "is_enterprise", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }
381
+ { no: 4, name: "is_enterprise", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
382
+ { no: 5, name: "customer_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
382
383
  ]);
383
384
  }
384
385
  create(value) {
@@ -387,6 +388,7 @@ class Org$Type extends MessageType {
387
388
  message.type = 0;
388
389
  message.slug = "";
389
390
  message.isEnterprise = false;
391
+ message.customerId = "";
390
392
  if (value !== undefined)
391
393
  reflectionMergePartial(this, message, value);
392
394
  return message;
@@ -408,6 +410,9 @@ class Org$Type extends MessageType {
408
410
  case /* bool is_enterprise */ 4:
409
411
  message.isEnterprise = reader.bool();
410
412
  break;
413
+ case /* string customer_id */ 5:
414
+ message.customerId = reader.string();
415
+ break;
411
416
  default:
412
417
  let u = options.readUnknownField;
413
418
  if (u === "throw")
@@ -432,6 +437,9 @@ class Org$Type extends MessageType {
432
437
  /* bool is_enterprise = 4; */
433
438
  if (message.isEnterprise !== false)
434
439
  writer.tag(4, WireType.Varint).bool(message.isEnterprise);
440
+ /* string customer_id = 5; */
441
+ if (message.customerId !== "")
442
+ writer.tag(5, WireType.LengthDelimited).string(message.customerId);
435
443
  let u = options.writeUnknownFields;
436
444
  if (u !== false)
437
445
  (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -4,6 +4,7 @@ import type { BinaryReadOptions } from "@protobuf-ts/runtime";
4
4
  import type { IBinaryReader } from "@protobuf-ts/runtime";
5
5
  import type { PartialMessage } from "@protobuf-ts/runtime";
6
6
  import { MessageType } from "@protobuf-ts/runtime";
7
+ import { Duration } from "../../google/protobuf/duration.js";
7
8
  import { Pid2Binary } from "../repl/repl.js";
8
9
  import { BuildInfo } from "../repl/repl.js";
9
10
  import { Feature } from "../features/features.js";
@@ -186,13 +187,19 @@ export interface ReplToken {
186
187
  */
187
188
  before?: Timestamp;
188
189
  /**
189
- * Resource tier selects the Goval 3 ReplPool/resource shape. Current values
190
- * are "free-medium", "paid-medium", and "paid-large". This is only used by
191
- * Goval 3.
190
+ * Resource tier selects the Goval 3 resource size. Current values are
191
+ * "medium" and "large". Goval 3 combines this with `paid` to select a
192
+ * ReplPool tier such as "free-medium", "paid-medium", or "paid-large".
192
193
  *
193
194
  * @generated from protobuf field: string resource_tier = 25
194
195
  */
195
196
  resourceTier: string;
197
+ /**
198
+ * Idle timeout override for this repl.
199
+ *
200
+ * @generated from protobuf field: optional google.protobuf.Duration idle_timeout = 26
201
+ */
202
+ idleTimeout?: Duration;
196
203
  }
197
204
  /**
198
205
  * Metadata for the classroom. This is deprecated and should be removed
@@ -2,6 +2,7 @@ import { WireType } from "@protobuf-ts/runtime";
2
2
  import { UnknownFieldHandler } from "@protobuf-ts/runtime";
3
3
  import { reflectionMergePartial } from "@protobuf-ts/runtime";
4
4
  import { MessageType } from "@protobuf-ts/runtime";
5
+ import { Duration } from "../../google/protobuf/duration.js";
5
6
  import { Pid2Binary } from "../repl/repl.js";
6
7
  import { BuildInfo } from "../repl/repl.js";
7
8
  import { Feature } from "../features/features.js";
@@ -67,7 +68,8 @@ class ReplToken$Type extends MessageType {
67
68
  { no: 21, name: "replexec", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
68
69
  { no: 22, name: "external_secrets", kind: "message", repeat: 2 /*RepeatType.UNPACKED*/, T: () => ReplToken_ExternalSecret },
69
70
  { no: 23, name: "before", kind: "message", T: () => Timestamp },
70
- { no: 25, name: "resource_tier", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
71
+ { no: 25, name: "resource_tier", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
72
+ { no: 26, name: "idle_timeout", kind: "message", T: () => Duration }
71
73
  ]);
72
74
  }
73
75
  create(value) {
@@ -164,6 +166,9 @@ class ReplToken$Type extends MessageType {
164
166
  case /* string resource_tier */ 25:
165
167
  message.resourceTier = reader.string();
166
168
  break;
169
+ case /* optional google.protobuf.Duration idle_timeout */ 26:
170
+ message.idleTimeout = Duration.internalBinaryRead(reader, reader.uint32(), options, message.idleTimeout);
171
+ break;
167
172
  default:
168
173
  let u = options.readUnknownField;
169
174
  if (u === "throw")
@@ -239,6 +244,9 @@ class ReplToken$Type extends MessageType {
239
244
  /* string resource_tier = 25; */
240
245
  if (message.resourceTier !== "")
241
246
  writer.tag(25, WireType.LengthDelimited).string(message.resourceTier);
247
+ /* optional google.protobuf.Duration idle_timeout = 26; */
248
+ if (message.idleTimeout)
249
+ Duration.internalBinaryWrite(message.idleTimeout, writer.tag(26, WireType.LengthDelimited).fork(), options).join();
242
250
  let u = options.writeUnknownFields;
243
251
  if (u !== false)
244
252
  (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -0,0 +1,112 @@
1
+ import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
2
+ import type { IBinaryWriter } from "@protobuf-ts/runtime";
3
+ import type { BinaryReadOptions } from "@protobuf-ts/runtime";
4
+ import type { IBinaryReader } from "@protobuf-ts/runtime";
5
+ import type { PartialMessage } from "@protobuf-ts/runtime";
6
+ import type { JsonValue } from "@protobuf-ts/runtime";
7
+ import type { JsonReadOptions } from "@protobuf-ts/runtime";
8
+ import type { JsonWriteOptions } from "@protobuf-ts/runtime";
9
+ import { MessageType } from "@protobuf-ts/runtime";
10
+ /**
11
+ * A Duration represents a signed, fixed-length span of time represented
12
+ * as a count of seconds and fractions of seconds at nanosecond
13
+ * resolution. It is independent of any calendar and concepts like "day"
14
+ * or "month". It is related to Timestamp in that the difference between
15
+ * two Timestamp values is a Duration and it can be added or subtracted
16
+ * from a Timestamp. Range is approximately +-10,000 years.
17
+ *
18
+ * # Examples
19
+ *
20
+ * Example 1: Compute Duration from two Timestamps in pseudo code.
21
+ *
22
+ * Timestamp start = ...;
23
+ * Timestamp end = ...;
24
+ * Duration duration = ...;
25
+ *
26
+ * duration.seconds = end.seconds - start.seconds;
27
+ * duration.nanos = end.nanos - start.nanos;
28
+ *
29
+ * if (duration.seconds < 0 && duration.nanos > 0) {
30
+ * duration.seconds += 1;
31
+ * duration.nanos -= 1000000000;
32
+ * } else if (duration.seconds > 0 && duration.nanos < 0) {
33
+ * duration.seconds -= 1;
34
+ * duration.nanos += 1000000000;
35
+ * }
36
+ *
37
+ * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
38
+ *
39
+ * Timestamp start = ...;
40
+ * Duration duration = ...;
41
+ * Timestamp end = ...;
42
+ *
43
+ * end.seconds = start.seconds + duration.seconds;
44
+ * end.nanos = start.nanos + duration.nanos;
45
+ *
46
+ * if (end.nanos < 0) {
47
+ * end.seconds -= 1;
48
+ * end.nanos += 1000000000;
49
+ * } else if (end.nanos >= 1000000000) {
50
+ * end.seconds += 1;
51
+ * end.nanos -= 1000000000;
52
+ * }
53
+ *
54
+ * Example 3: Compute Duration from datetime.timedelta in Python.
55
+ *
56
+ * td = datetime.timedelta(days=3, minutes=10)
57
+ * duration = Duration()
58
+ * duration.FromTimedelta(td)
59
+ *
60
+ * # JSON Mapping
61
+ *
62
+ * In JSON format, the Duration type is encoded as a string rather than an
63
+ * object, where the string ends in the suffix "s" (indicating seconds) and
64
+ * is preceded by the number of seconds, with nanoseconds expressed as
65
+ * fractional seconds. For example, 3 seconds with 0 nanoseconds should be
66
+ * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
67
+ * be expressed in JSON format as "3.000000001s", and 3 seconds and 1
68
+ * microsecond should be expressed in JSON format as "3.000001s".
69
+ *
70
+ *
71
+ * @generated from protobuf message google.protobuf.Duration
72
+ */
73
+ export interface Duration {
74
+ /**
75
+ * Signed seconds of the span of time. Must be from -315,576,000,000
76
+ * to +315,576,000,000 inclusive. Note: these bounds are computed from:
77
+ * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
78
+ *
79
+ * @generated from protobuf field: int64 seconds = 1
80
+ */
81
+ seconds: bigint;
82
+ /**
83
+ * Signed fractions of a second at nanosecond resolution of the span
84
+ * of time. Durations less than one second are represented with a 0
85
+ * `seconds` field and a positive or negative `nanos` field. For durations
86
+ * of one second or more, a non-zero value for the `nanos` field must be
87
+ * of the same sign as the `seconds` field. Must be from -999,999,999
88
+ * to +999,999,999 inclusive.
89
+ *
90
+ * @generated from protobuf field: int32 nanos = 2
91
+ */
92
+ nanos: number;
93
+ }
94
+ declare class Duration$Type extends MessageType<Duration> {
95
+ constructor();
96
+ /**
97
+ * Encode `Duration` to JSON string like "3.000001s".
98
+ */
99
+ internalJsonWrite(message: Duration, options: JsonWriteOptions): JsonValue;
100
+ /**
101
+ * Decode `Duration` from JSON string like "3.000001s"
102
+ */
103
+ internalJsonRead(json: JsonValue, options: JsonReadOptions, target?: Duration): Duration;
104
+ create(value?: PartialMessage<Duration>): Duration;
105
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Duration): Duration;
106
+ internalBinaryWrite(message: Duration, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
107
+ }
108
+ /**
109
+ * @generated MessageType for protobuf message google.protobuf.Duration
110
+ */
111
+ export declare const Duration: Duration$Type;
112
+ export {};
@@ -0,0 +1,104 @@
1
+ import { WireType } from "@protobuf-ts/runtime";
2
+ import { UnknownFieldHandler } from "@protobuf-ts/runtime";
3
+ import { reflectionMergePartial } from "@protobuf-ts/runtime";
4
+ import { typeofJsonValue } from "@protobuf-ts/runtime";
5
+ import { PbLong } from "@protobuf-ts/runtime";
6
+ import { MessageType } from "@protobuf-ts/runtime";
7
+ // @generated message type with reflection information, may provide speed optimized methods
8
+ class Duration$Type extends MessageType {
9
+ constructor() {
10
+ super("google.protobuf.Duration", [
11
+ { no: 1, name: "seconds", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
12
+ { no: 2, name: "nanos", kind: "scalar", T: 5 /*ScalarType.INT32*/ }
13
+ ]);
14
+ }
15
+ /**
16
+ * Encode `Duration` to JSON string like "3.000001s".
17
+ */
18
+ internalJsonWrite(message, options) {
19
+ let s = PbLong.from(message.seconds).toNumber();
20
+ if (s > 315576000000 || s < -315576000000)
21
+ throw new Error("Duration value out of range.");
22
+ let text = message.seconds.toString();
23
+ if (s === 0 && message.nanos < 0)
24
+ text = "-" + text;
25
+ if (message.nanos !== 0) {
26
+ let nanosStr = Math.abs(message.nanos).toString();
27
+ nanosStr = "0".repeat(9 - nanosStr.length) + nanosStr;
28
+ if (nanosStr.substring(3) === "000000")
29
+ nanosStr = nanosStr.substring(0, 3);
30
+ else if (nanosStr.substring(6) === "000")
31
+ nanosStr = nanosStr.substring(0, 6);
32
+ text += "." + nanosStr;
33
+ }
34
+ return text + "s";
35
+ }
36
+ /**
37
+ * Decode `Duration` from JSON string like "3.000001s"
38
+ */
39
+ internalJsonRead(json, options, target) {
40
+ if (typeof json !== "string")
41
+ throw new Error("Unable to parse Duration from JSON " + typeofJsonValue(json) + ". Expected string.");
42
+ let match = json.match(/^(-?)([0-9]+)(?:\.([0-9]+))?s/);
43
+ if (match === null)
44
+ throw new Error("Unable to parse Duration from JSON string. Invalid format.");
45
+ if (!target)
46
+ target = this.create();
47
+ let [, sign, secs, nanos] = match;
48
+ let longSeconds = PbLong.from(sign + secs);
49
+ if (longSeconds.toNumber() > 315576000000 || longSeconds.toNumber() < -315576000000)
50
+ throw new Error("Unable to parse Duration from JSON string. Value out of range.");
51
+ target.seconds = longSeconds.toBigInt();
52
+ if (typeof nanos == "string") {
53
+ let nanosStr = sign + nanos + "0".repeat(9 - nanos.length);
54
+ target.nanos = parseInt(nanosStr);
55
+ }
56
+ return target;
57
+ }
58
+ create(value) {
59
+ const message = globalThis.Object.create((this.messagePrototype));
60
+ message.seconds = 0n;
61
+ message.nanos = 0;
62
+ if (value !== undefined)
63
+ reflectionMergePartial(this, message, value);
64
+ return message;
65
+ }
66
+ internalBinaryRead(reader, length, options, target) {
67
+ let message = target ?? this.create(), end = reader.pos + length;
68
+ while (reader.pos < end) {
69
+ let [fieldNo, wireType] = reader.tag();
70
+ switch (fieldNo) {
71
+ case /* int64 seconds */ 1:
72
+ message.seconds = reader.int64().toBigInt();
73
+ break;
74
+ case /* int32 nanos */ 2:
75
+ message.nanos = reader.int32();
76
+ break;
77
+ default:
78
+ let u = options.readUnknownField;
79
+ if (u === "throw")
80
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
81
+ let d = reader.skip(wireType);
82
+ if (u !== false)
83
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
84
+ }
85
+ }
86
+ return message;
87
+ }
88
+ internalBinaryWrite(message, writer, options) {
89
+ /* int64 seconds = 1; */
90
+ if (message.seconds !== 0n)
91
+ writer.tag(1, WireType.Varint).int64(message.seconds);
92
+ /* int32 nanos = 2; */
93
+ if (message.nanos !== 0)
94
+ writer.tag(2, WireType.Varint).int32(message.nanos);
95
+ let u = options.writeUnknownFields;
96
+ if (u !== false)
97
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
98
+ return writer;
99
+ }
100
+ }
101
+ /**
102
+ * @generated MessageType for protobuf message google.protobuf.Duration
103
+ */
104
+ export const Duration = new Duration$Type();
package/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@ export * from './api/types.js';
2
2
  export * from './api/client.js';
3
3
  export * from './api/signing.js';
4
4
  export * from './api/token/token.js';
5
+ export * as ChateauResources from './api/chateau/resources.js';
5
6
  export * from './api/lore/lore.js';
6
7
  export * from './api/features/features.js';
7
8
  export * from './api/powerup.js';
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@ export * from './api/types.js';
3
3
  export * from './api/client.js';
4
4
  export * from './api/signing.js';
5
5
  export * from './api/token/token.js';
6
+ export * as ChateauResources from './api/chateau/resources.js';
6
7
  export * from './api/lore/lore.js';
7
8
  export * from './api/features/features.js';
8
9
  export * from './api/powerup.js';