@cypress/github-action 6.7.9 → 6.7.11

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 (2) hide show
  1. package/dist/index.js +29 -2884
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -220,7 +220,7 @@ function restoreCacheV2(paths, primaryKey, restoreKeys, options, enableCrossOsAr
220
220
  };
221
221
  const response = yield twirpClient.GetCacheEntryDownloadURL(request);
222
222
  if (!response.ok) {
223
- core.warning(`Cache not found for keys: ${keys.join(', ')}`);
223
+ core.debug(`Cache not found for keys: ${keys.join(', ')}`);
224
224
  return undefined;
225
225
  }
226
226
  core.info(`Cache hit for: ${request.key}`);
@@ -458,156 +458,13 @@ function saveCacheV2(paths, key, options, enableCrossOsArchive = false) {
458
458
 
459
459
  /***/ }),
460
460
 
461
- /***/ 4469:
462
- /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
463
-
464
- "use strict";
465
-
466
- Object.defineProperty(exports, "__esModule", ({ value: true }));
467
- exports.Timestamp = void 0;
468
- const runtime_1 = __nccwpck_require__(4061);
469
- const runtime_2 = __nccwpck_require__(4061);
470
- const runtime_3 = __nccwpck_require__(4061);
471
- const runtime_4 = __nccwpck_require__(4061);
472
- const runtime_5 = __nccwpck_require__(4061);
473
- const runtime_6 = __nccwpck_require__(4061);
474
- const runtime_7 = __nccwpck_require__(4061);
475
- // @generated message type with reflection information, may provide speed optimized methods
476
- class Timestamp$Type extends runtime_7.MessageType {
477
- constructor() {
478
- super("google.protobuf.Timestamp", [
479
- { no: 1, name: "seconds", kind: "scalar", T: 3 /*ScalarType.INT64*/ },
480
- { no: 2, name: "nanos", kind: "scalar", T: 5 /*ScalarType.INT32*/ }
481
- ]);
482
- }
483
- /**
484
- * Creates a new `Timestamp` for the current time.
485
- */
486
- now() {
487
- const msg = this.create();
488
- const ms = Date.now();
489
- msg.seconds = runtime_6.PbLong.from(Math.floor(ms / 1000)).toString();
490
- msg.nanos = (ms % 1000) * 1000000;
491
- return msg;
492
- }
493
- /**
494
- * Converts a `Timestamp` to a JavaScript Date.
495
- */
496
- toDate(message) {
497
- return new Date(runtime_6.PbLong.from(message.seconds).toNumber() * 1000 + Math.ceil(message.nanos / 1000000));
498
- }
499
- /**
500
- * Converts a JavaScript Date to a `Timestamp`.
501
- */
502
- fromDate(date) {
503
- const msg = this.create();
504
- const ms = date.getTime();
505
- msg.seconds = runtime_6.PbLong.from(Math.floor(ms / 1000)).toString();
506
- msg.nanos = (ms % 1000) * 1000000;
507
- return msg;
508
- }
509
- /**
510
- * In JSON format, the `Timestamp` type is encoded as a string
511
- * in the RFC 3339 format.
512
- */
513
- internalJsonWrite(message, options) {
514
- let ms = runtime_6.PbLong.from(message.seconds).toNumber() * 1000;
515
- if (ms < Date.parse("0001-01-01T00:00:00Z") || ms > Date.parse("9999-12-31T23:59:59Z"))
516
- throw new Error("Unable to encode Timestamp to JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.");
517
- if (message.nanos < 0)
518
- throw new Error("Unable to encode invalid Timestamp to JSON. Nanos must not be negative.");
519
- let z = "Z";
520
- if (message.nanos > 0) {
521
- let nanosStr = (message.nanos + 1000000000).toString().substring(1);
522
- if (nanosStr.substring(3) === "000000")
523
- z = "." + nanosStr.substring(0, 3) + "Z";
524
- else if (nanosStr.substring(6) === "000")
525
- z = "." + nanosStr.substring(0, 6) + "Z";
526
- else
527
- z = "." + nanosStr + "Z";
528
- }
529
- return new Date(ms).toISOString().replace(".000Z", z);
530
- }
531
- /**
532
- * In JSON format, the `Timestamp` type is encoded as a string
533
- * in the RFC 3339 format.
534
- */
535
- internalJsonRead(json, options, target) {
536
- if (typeof json !== "string")
537
- throw new Error("Unable to parse Timestamp from JSON " + (0, runtime_5.typeofJsonValue)(json) + ".");
538
- let matches = json.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/);
539
- if (!matches)
540
- throw new Error("Unable to parse Timestamp from JSON. Invalid format.");
541
- let ms = Date.parse(matches[1] + "-" + matches[2] + "-" + matches[3] + "T" + matches[4] + ":" + matches[5] + ":" + matches[6] + (matches[8] ? matches[8] : "Z"));
542
- if (Number.isNaN(ms))
543
- throw new Error("Unable to parse Timestamp from JSON. Invalid value.");
544
- if (ms < Date.parse("0001-01-01T00:00:00Z") || ms > Date.parse("9999-12-31T23:59:59Z"))
545
- throw new globalThis.Error("Unable to parse Timestamp from JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.");
546
- if (!target)
547
- target = this.create();
548
- target.seconds = runtime_6.PbLong.from(ms / 1000).toString();
549
- target.nanos = 0;
550
- if (matches[7])
551
- target.nanos = (parseInt("1" + matches[7] + "0".repeat(9 - matches[7].length)) - 1000000000);
552
- return target;
553
- }
554
- create(value) {
555
- const message = { seconds: "0", nanos: 0 };
556
- globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this });
557
- if (value !== undefined)
558
- (0, runtime_3.reflectionMergePartial)(this, message, value);
559
- return message;
560
- }
561
- internalBinaryRead(reader, length, options, target) {
562
- let message = target !== null && target !== void 0 ? target : this.create(), end = reader.pos + length;
563
- while (reader.pos < end) {
564
- let [fieldNo, wireType] = reader.tag();
565
- switch (fieldNo) {
566
- case /* int64 seconds */ 1:
567
- message.seconds = reader.int64().toString();
568
- break;
569
- case /* int32 nanos */ 2:
570
- message.nanos = reader.int32();
571
- break;
572
- default:
573
- let u = options.readUnknownField;
574
- if (u === "throw")
575
- throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
576
- let d = reader.skip(wireType);
577
- if (u !== false)
578
- (u === true ? runtime_2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
579
- }
580
- }
581
- return message;
582
- }
583
- internalBinaryWrite(message, writer, options) {
584
- /* int64 seconds = 1; */
585
- if (message.seconds !== "0")
586
- writer.tag(1, runtime_1.WireType.Varint).int64(message.seconds);
587
- /* int32 nanos = 2; */
588
- if (message.nanos !== 0)
589
- writer.tag(2, runtime_1.WireType.Varint).int32(message.nanos);
590
- let u = options.writeUnknownFields;
591
- if (u !== false)
592
- (u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
593
- return writer;
594
- }
595
- }
596
- /**
597
- * @generated MessageType for protobuf message google.protobuf.Timestamp
598
- */
599
- exports.Timestamp = new Timestamp$Type();
600
- //# sourceMappingURL=timestamp.js.map
601
-
602
- /***/ }),
603
-
604
461
  /***/ 4388:
605
462
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
606
463
 
607
464
  "use strict";
608
465
 
609
466
  Object.defineProperty(exports, "__esModule", ({ value: true }));
610
- exports.CacheService = exports.LookupCacheEntryResponse = exports.LookupCacheEntryRequest = exports.ListCacheEntriesResponse = exports.ListCacheEntriesRequest = exports.DeleteCacheEntryResponse = exports.DeleteCacheEntryRequest = exports.GetCacheEntryDownloadURLResponse = exports.GetCacheEntryDownloadURLRequest = exports.FinalizeCacheEntryUploadResponse = exports.FinalizeCacheEntryUploadRequest = exports.CreateCacheEntryResponse = exports.CreateCacheEntryRequest = void 0;
467
+ exports.CacheService = exports.GetCacheEntryDownloadURLResponse = exports.GetCacheEntryDownloadURLRequest = exports.FinalizeCacheEntryUploadResponse = exports.FinalizeCacheEntryUploadRequest = exports.CreateCacheEntryResponse = exports.CreateCacheEntryRequest = void 0;
611
468
  // @generated by protobuf-ts 2.9.1 with parameter long_type_string,client_none,generate_dependencies
612
469
  // @generated from protobuf file "results/api/v1/cache.proto" (package "github.actions.results.api.v1", syntax proto3)
613
470
  // tslint:disable
@@ -617,7 +474,6 @@ const runtime_2 = __nccwpck_require__(4061);
617
474
  const runtime_3 = __nccwpck_require__(4061);
618
475
  const runtime_4 = __nccwpck_require__(4061);
619
476
  const runtime_5 = __nccwpck_require__(4061);
620
- const cacheentry_1 = __nccwpck_require__(3639);
621
477
  const cachemetadata_1 = __nccwpck_require__(7988);
622
478
  // @generated message type with reflection information, may provide speed optimized methods
623
479
  class CreateCacheEntryRequest$Type extends runtime_5.MessageType {
@@ -985,376 +841,25 @@ class GetCacheEntryDownloadURLResponse$Type extends runtime_5.MessageType {
985
841
  * @generated MessageType for protobuf message github.actions.results.api.v1.GetCacheEntryDownloadURLResponse
986
842
  */
987
843
  exports.GetCacheEntryDownloadURLResponse = new GetCacheEntryDownloadURLResponse$Type();
988
- // @generated message type with reflection information, may provide speed optimized methods
989
- class DeleteCacheEntryRequest$Type extends runtime_5.MessageType {
990
- constructor() {
991
- super("github.actions.results.api.v1.DeleteCacheEntryRequest", [
992
- { no: 1, name: "metadata", kind: "message", T: () => cachemetadata_1.CacheMetadata },
993
- { no: 2, name: "key", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
994
- ]);
995
- }
996
- create(value) {
997
- const message = { key: "" };
998
- globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this });
999
- if (value !== undefined)
1000
- (0, runtime_3.reflectionMergePartial)(this, message, value);
1001
- return message;
1002
- }
1003
- internalBinaryRead(reader, length, options, target) {
1004
- let message = target !== null && target !== void 0 ? target : this.create(), end = reader.pos + length;
1005
- while (reader.pos < end) {
1006
- let [fieldNo, wireType] = reader.tag();
1007
- switch (fieldNo) {
1008
- case /* github.actions.results.entities.v1.CacheMetadata metadata */ 1:
1009
- message.metadata = cachemetadata_1.CacheMetadata.internalBinaryRead(reader, reader.uint32(), options, message.metadata);
1010
- break;
1011
- case /* string key */ 2:
1012
- message.key = reader.string();
1013
- break;
1014
- default:
1015
- let u = options.readUnknownField;
1016
- if (u === "throw")
1017
- throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
1018
- let d = reader.skip(wireType);
1019
- if (u !== false)
1020
- (u === true ? runtime_2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
1021
- }
1022
- }
1023
- return message;
1024
- }
1025
- internalBinaryWrite(message, writer, options) {
1026
- /* github.actions.results.entities.v1.CacheMetadata metadata = 1; */
1027
- if (message.metadata)
1028
- cachemetadata_1.CacheMetadata.internalBinaryWrite(message.metadata, writer.tag(1, runtime_1.WireType.LengthDelimited).fork(), options).join();
1029
- /* string key = 2; */
1030
- if (message.key !== "")
1031
- writer.tag(2, runtime_1.WireType.LengthDelimited).string(message.key);
1032
- let u = options.writeUnknownFields;
1033
- if (u !== false)
1034
- (u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
1035
- return writer;
1036
- }
1037
- }
1038
- /**
1039
- * @generated MessageType for protobuf message github.actions.results.api.v1.DeleteCacheEntryRequest
1040
- */
1041
- exports.DeleteCacheEntryRequest = new DeleteCacheEntryRequest$Type();
1042
- // @generated message type with reflection information, may provide speed optimized methods
1043
- class DeleteCacheEntryResponse$Type extends runtime_5.MessageType {
1044
- constructor() {
1045
- super("github.actions.results.api.v1.DeleteCacheEntryResponse", [
1046
- { no: 1, name: "ok", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
1047
- { no: 2, name: "entry_id", kind: "scalar", T: 3 /*ScalarType.INT64*/ }
1048
- ]);
1049
- }
1050
- create(value) {
1051
- const message = { ok: false, entryId: "0" };
1052
- globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this });
1053
- if (value !== undefined)
1054
- (0, runtime_3.reflectionMergePartial)(this, message, value);
1055
- return message;
1056
- }
1057
- internalBinaryRead(reader, length, options, target) {
1058
- let message = target !== null && target !== void 0 ? target : this.create(), end = reader.pos + length;
1059
- while (reader.pos < end) {
1060
- let [fieldNo, wireType] = reader.tag();
1061
- switch (fieldNo) {
1062
- case /* bool ok */ 1:
1063
- message.ok = reader.bool();
1064
- break;
1065
- case /* int64 entry_id */ 2:
1066
- message.entryId = reader.int64().toString();
1067
- break;
1068
- default:
1069
- let u = options.readUnknownField;
1070
- if (u === "throw")
1071
- throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
1072
- let d = reader.skip(wireType);
1073
- if (u !== false)
1074
- (u === true ? runtime_2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
1075
- }
1076
- }
1077
- return message;
1078
- }
1079
- internalBinaryWrite(message, writer, options) {
1080
- /* bool ok = 1; */
1081
- if (message.ok !== false)
1082
- writer.tag(1, runtime_1.WireType.Varint).bool(message.ok);
1083
- /* int64 entry_id = 2; */
1084
- if (message.entryId !== "0")
1085
- writer.tag(2, runtime_1.WireType.Varint).int64(message.entryId);
1086
- let u = options.writeUnknownFields;
1087
- if (u !== false)
1088
- (u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
1089
- return writer;
1090
- }
1091
- }
1092
- /**
1093
- * @generated MessageType for protobuf message github.actions.results.api.v1.DeleteCacheEntryResponse
1094
- */
1095
- exports.DeleteCacheEntryResponse = new DeleteCacheEntryResponse$Type();
1096
- // @generated message type with reflection information, may provide speed optimized methods
1097
- class ListCacheEntriesRequest$Type extends runtime_5.MessageType {
1098
- constructor() {
1099
- super("github.actions.results.api.v1.ListCacheEntriesRequest", [
1100
- { no: 1, name: "metadata", kind: "message", T: () => cachemetadata_1.CacheMetadata },
1101
- { no: 2, name: "key", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
1102
- { no: 3, name: "restore_keys", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/ }
1103
- ]);
1104
- }
1105
- create(value) {
1106
- const message = { key: "", restoreKeys: [] };
1107
- globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this });
1108
- if (value !== undefined)
1109
- (0, runtime_3.reflectionMergePartial)(this, message, value);
1110
- return message;
1111
- }
1112
- internalBinaryRead(reader, length, options, target) {
1113
- let message = target !== null && target !== void 0 ? target : this.create(), end = reader.pos + length;
1114
- while (reader.pos < end) {
1115
- let [fieldNo, wireType] = reader.tag();
1116
- switch (fieldNo) {
1117
- case /* github.actions.results.entities.v1.CacheMetadata metadata */ 1:
1118
- message.metadata = cachemetadata_1.CacheMetadata.internalBinaryRead(reader, reader.uint32(), options, message.metadata);
1119
- break;
1120
- case /* string key */ 2:
1121
- message.key = reader.string();
1122
- break;
1123
- case /* repeated string restore_keys */ 3:
1124
- message.restoreKeys.push(reader.string());
1125
- break;
1126
- default:
1127
- let u = options.readUnknownField;
1128
- if (u === "throw")
1129
- throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
1130
- let d = reader.skip(wireType);
1131
- if (u !== false)
1132
- (u === true ? runtime_2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
1133
- }
1134
- }
1135
- return message;
1136
- }
1137
- internalBinaryWrite(message, writer, options) {
1138
- /* github.actions.results.entities.v1.CacheMetadata metadata = 1; */
1139
- if (message.metadata)
1140
- cachemetadata_1.CacheMetadata.internalBinaryWrite(message.metadata, writer.tag(1, runtime_1.WireType.LengthDelimited).fork(), options).join();
1141
- /* string key = 2; */
1142
- if (message.key !== "")
1143
- writer.tag(2, runtime_1.WireType.LengthDelimited).string(message.key);
1144
- /* repeated string restore_keys = 3; */
1145
- for (let i = 0; i < message.restoreKeys.length; i++)
1146
- writer.tag(3, runtime_1.WireType.LengthDelimited).string(message.restoreKeys[i]);
1147
- let u = options.writeUnknownFields;
1148
- if (u !== false)
1149
- (u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
1150
- return writer;
1151
- }
1152
- }
1153
- /**
1154
- * @generated MessageType for protobuf message github.actions.results.api.v1.ListCacheEntriesRequest
1155
- */
1156
- exports.ListCacheEntriesRequest = new ListCacheEntriesRequest$Type();
1157
- // @generated message type with reflection information, may provide speed optimized methods
1158
- class ListCacheEntriesResponse$Type extends runtime_5.MessageType {
1159
- constructor() {
1160
- super("github.actions.results.api.v1.ListCacheEntriesResponse", [
1161
- { no: 1, name: "entries", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => cacheentry_1.CacheEntry }
1162
- ]);
1163
- }
1164
- create(value) {
1165
- const message = { entries: [] };
1166
- globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this });
1167
- if (value !== undefined)
1168
- (0, runtime_3.reflectionMergePartial)(this, message, value);
1169
- return message;
1170
- }
1171
- internalBinaryRead(reader, length, options, target) {
1172
- let message = target !== null && target !== void 0 ? target : this.create(), end = reader.pos + length;
1173
- while (reader.pos < end) {
1174
- let [fieldNo, wireType] = reader.tag();
1175
- switch (fieldNo) {
1176
- case /* repeated github.actions.results.entities.v1.CacheEntry entries */ 1:
1177
- message.entries.push(cacheentry_1.CacheEntry.internalBinaryRead(reader, reader.uint32(), options));
1178
- break;
1179
- default:
1180
- let u = options.readUnknownField;
1181
- if (u === "throw")
1182
- throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
1183
- let d = reader.skip(wireType);
1184
- if (u !== false)
1185
- (u === true ? runtime_2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
1186
- }
1187
- }
1188
- return message;
1189
- }
1190
- internalBinaryWrite(message, writer, options) {
1191
- /* repeated github.actions.results.entities.v1.CacheEntry entries = 1; */
1192
- for (let i = 0; i < message.entries.length; i++)
1193
- cacheentry_1.CacheEntry.internalBinaryWrite(message.entries[i], writer.tag(1, runtime_1.WireType.LengthDelimited).fork(), options).join();
1194
- let u = options.writeUnknownFields;
1195
- if (u !== false)
1196
- (u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
1197
- return writer;
1198
- }
1199
- }
1200
- /**
1201
- * @generated MessageType for protobuf message github.actions.results.api.v1.ListCacheEntriesResponse
1202
- */
1203
- exports.ListCacheEntriesResponse = new ListCacheEntriesResponse$Type();
1204
- // @generated message type with reflection information, may provide speed optimized methods
1205
- class LookupCacheEntryRequest$Type extends runtime_5.MessageType {
1206
- constructor() {
1207
- super("github.actions.results.api.v1.LookupCacheEntryRequest", [
1208
- { no: 1, name: "metadata", kind: "message", T: () => cachemetadata_1.CacheMetadata },
1209
- { no: 2, name: "key", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
1210
- { no: 3, name: "restore_keys", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/ },
1211
- { no: 4, name: "version", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
1212
- ]);
1213
- }
1214
- create(value) {
1215
- const message = { key: "", restoreKeys: [], version: "" };
1216
- globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this });
1217
- if (value !== undefined)
1218
- (0, runtime_3.reflectionMergePartial)(this, message, value);
1219
- return message;
1220
- }
1221
- internalBinaryRead(reader, length, options, target) {
1222
- let message = target !== null && target !== void 0 ? target : this.create(), end = reader.pos + length;
1223
- while (reader.pos < end) {
1224
- let [fieldNo, wireType] = reader.tag();
1225
- switch (fieldNo) {
1226
- case /* github.actions.results.entities.v1.CacheMetadata metadata */ 1:
1227
- message.metadata = cachemetadata_1.CacheMetadata.internalBinaryRead(reader, reader.uint32(), options, message.metadata);
1228
- break;
1229
- case /* string key */ 2:
1230
- message.key = reader.string();
1231
- break;
1232
- case /* repeated string restore_keys */ 3:
1233
- message.restoreKeys.push(reader.string());
1234
- break;
1235
- case /* string version */ 4:
1236
- message.version = reader.string();
1237
- break;
1238
- default:
1239
- let u = options.readUnknownField;
1240
- if (u === "throw")
1241
- throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
1242
- let d = reader.skip(wireType);
1243
- if (u !== false)
1244
- (u === true ? runtime_2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
1245
- }
1246
- }
1247
- return message;
1248
- }
1249
- internalBinaryWrite(message, writer, options) {
1250
- /* github.actions.results.entities.v1.CacheMetadata metadata = 1; */
1251
- if (message.metadata)
1252
- cachemetadata_1.CacheMetadata.internalBinaryWrite(message.metadata, writer.tag(1, runtime_1.WireType.LengthDelimited).fork(), options).join();
1253
- /* string key = 2; */
1254
- if (message.key !== "")
1255
- writer.tag(2, runtime_1.WireType.LengthDelimited).string(message.key);
1256
- /* repeated string restore_keys = 3; */
1257
- for (let i = 0; i < message.restoreKeys.length; i++)
1258
- writer.tag(3, runtime_1.WireType.LengthDelimited).string(message.restoreKeys[i]);
1259
- /* string version = 4; */
1260
- if (message.version !== "")
1261
- writer.tag(4, runtime_1.WireType.LengthDelimited).string(message.version);
1262
- let u = options.writeUnknownFields;
1263
- if (u !== false)
1264
- (u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
1265
- return writer;
1266
- }
1267
- }
1268
- /**
1269
- * @generated MessageType for protobuf message github.actions.results.api.v1.LookupCacheEntryRequest
1270
- */
1271
- exports.LookupCacheEntryRequest = new LookupCacheEntryRequest$Type();
1272
- // @generated message type with reflection information, may provide speed optimized methods
1273
- class LookupCacheEntryResponse$Type extends runtime_5.MessageType {
1274
- constructor() {
1275
- super("github.actions.results.api.v1.LookupCacheEntryResponse", [
1276
- { no: 1, name: "exists", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
1277
- { no: 2, name: "entry", kind: "message", T: () => cacheentry_1.CacheEntry }
1278
- ]);
1279
- }
1280
- create(value) {
1281
- const message = { exists: false };
1282
- globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this });
1283
- if (value !== undefined)
1284
- (0, runtime_3.reflectionMergePartial)(this, message, value);
1285
- return message;
1286
- }
1287
- internalBinaryRead(reader, length, options, target) {
1288
- let message = target !== null && target !== void 0 ? target : this.create(), end = reader.pos + length;
1289
- while (reader.pos < end) {
1290
- let [fieldNo, wireType] = reader.tag();
1291
- switch (fieldNo) {
1292
- case /* bool exists */ 1:
1293
- message.exists = reader.bool();
1294
- break;
1295
- case /* github.actions.results.entities.v1.CacheEntry entry */ 2:
1296
- message.entry = cacheentry_1.CacheEntry.internalBinaryRead(reader, reader.uint32(), options, message.entry);
1297
- break;
1298
- default:
1299
- let u = options.readUnknownField;
1300
- if (u === "throw")
1301
- throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
1302
- let d = reader.skip(wireType);
1303
- if (u !== false)
1304
- (u === true ? runtime_2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
1305
- }
1306
- }
1307
- return message;
1308
- }
1309
- internalBinaryWrite(message, writer, options) {
1310
- /* bool exists = 1; */
1311
- if (message.exists !== false)
1312
- writer.tag(1, runtime_1.WireType.Varint).bool(message.exists);
1313
- /* github.actions.results.entities.v1.CacheEntry entry = 2; */
1314
- if (message.entry)
1315
- cacheentry_1.CacheEntry.internalBinaryWrite(message.entry, writer.tag(2, runtime_1.WireType.LengthDelimited).fork(), options).join();
1316
- let u = options.writeUnknownFields;
1317
- if (u !== false)
1318
- (u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
1319
- return writer;
1320
- }
1321
- }
1322
- /**
1323
- * @generated MessageType for protobuf message github.actions.results.api.v1.LookupCacheEntryResponse
1324
- */
1325
- exports.LookupCacheEntryResponse = new LookupCacheEntryResponse$Type();
1326
844
  /**
1327
845
  * @generated ServiceType for protobuf service github.actions.results.api.v1.CacheService
1328
846
  */
1329
847
  exports.CacheService = new runtime_rpc_1.ServiceType("github.actions.results.api.v1.CacheService", [
1330
848
  { name: "CreateCacheEntry", options: {}, I: exports.CreateCacheEntryRequest, O: exports.CreateCacheEntryResponse },
1331
849
  { name: "FinalizeCacheEntryUpload", options: {}, I: exports.FinalizeCacheEntryUploadRequest, O: exports.FinalizeCacheEntryUploadResponse },
1332
- { name: "GetCacheEntryDownloadURL", options: {}, I: exports.GetCacheEntryDownloadURLRequest, O: exports.GetCacheEntryDownloadURLResponse },
1333
- { name: "DeleteCacheEntry", options: {}, I: exports.DeleteCacheEntryRequest, O: exports.DeleteCacheEntryResponse },
1334
- { name: "ListCacheEntries", options: {}, I: exports.ListCacheEntriesRequest, O: exports.ListCacheEntriesResponse },
1335
- { name: "LookupCacheEntry", options: {}, I: exports.LookupCacheEntryRequest, O: exports.LookupCacheEntryResponse }
850
+ { name: "GetCacheEntryDownloadURL", options: {}, I: exports.GetCacheEntryDownloadURLRequest, O: exports.GetCacheEntryDownloadURLResponse }
1336
851
  ]);
1337
852
  //# sourceMappingURL=cache.js.map
1338
853
 
1339
854
  /***/ }),
1340
855
 
1341
- /***/ 267:
1342
- /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
856
+ /***/ 2655:
857
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
1343
858
 
1344
859
  "use strict";
1345
860
 
1346
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
1347
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
1348
- return new (P || (P = Promise))(function (resolve, reject) {
1349
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
1350
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
1351
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
1352
- step((generator = generator.apply(thisArg, _arguments || [])).next());
1353
- });
1354
- };
1355
861
  Object.defineProperty(exports, "__esModule", ({ value: true }));
1356
- exports.createCacheServiceServer = exports.CacheServiceMethodList = exports.CacheServiceMethod = exports.CacheServiceClientProtobuf = exports.CacheServiceClientJSON = void 0;
1357
- const twirp_ts_1 = __nccwpck_require__(6465);
862
+ exports.CacheServiceClientProtobuf = exports.CacheServiceClientJSON = void 0;
1358
863
  const cache_1 = __nccwpck_require__(4388);
1359
864
  class CacheServiceClientJSON {
1360
865
  constructor(rpc) {
@@ -1362,9 +867,6 @@ class CacheServiceClientJSON {
1362
867
  this.CreateCacheEntry.bind(this);
1363
868
  this.FinalizeCacheEntryUpload.bind(this);
1364
869
  this.GetCacheEntryDownloadURL.bind(this);
1365
- this.DeleteCacheEntry.bind(this);
1366
- this.ListCacheEntries.bind(this);
1367
- this.LookupCacheEntry.bind(this);
1368
870
  }
1369
871
  CreateCacheEntry(request) {
1370
872
  const data = cache_1.CreateCacheEntryRequest.toJson(request, {
@@ -1396,36 +898,6 @@ class CacheServiceClientJSON {
1396
898
  ignoreUnknownFields: true,
1397
899
  }));
1398
900
  }
1399
- DeleteCacheEntry(request) {
1400
- const data = cache_1.DeleteCacheEntryRequest.toJson(request, {
1401
- useProtoFieldName: true,
1402
- emitDefaultValues: false,
1403
- });
1404
- const promise = this.rpc.request("github.actions.results.api.v1.CacheService", "DeleteCacheEntry", "application/json", data);
1405
- return promise.then((data) => cache_1.DeleteCacheEntryResponse.fromJson(data, {
1406
- ignoreUnknownFields: true,
1407
- }));
1408
- }
1409
- ListCacheEntries(request) {
1410
- const data = cache_1.ListCacheEntriesRequest.toJson(request, {
1411
- useProtoFieldName: true,
1412
- emitDefaultValues: false,
1413
- });
1414
- const promise = this.rpc.request("github.actions.results.api.v1.CacheService", "ListCacheEntries", "application/json", data);
1415
- return promise.then((data) => cache_1.ListCacheEntriesResponse.fromJson(data, {
1416
- ignoreUnknownFields: true,
1417
- }));
1418
- }
1419
- LookupCacheEntry(request) {
1420
- const data = cache_1.LookupCacheEntryRequest.toJson(request, {
1421
- useProtoFieldName: true,
1422
- emitDefaultValues: false,
1423
- });
1424
- const promise = this.rpc.request("github.actions.results.api.v1.CacheService", "LookupCacheEntry", "application/json", data);
1425
- return promise.then((data) => cache_1.LookupCacheEntryResponse.fromJson(data, {
1426
- ignoreUnknownFields: true,
1427
- }));
1428
- }
1429
901
  }
1430
902
  exports.CacheServiceClientJSON = CacheServiceClientJSON;
1431
903
  class CacheServiceClientProtobuf {
@@ -1434,9 +906,6 @@ class CacheServiceClientProtobuf {
1434
906
  this.CreateCacheEntry.bind(this);
1435
907
  this.FinalizeCacheEntryUpload.bind(this);
1436
908
  this.GetCacheEntryDownloadURL.bind(this);
1437
- this.DeleteCacheEntry.bind(this);
1438
- this.ListCacheEntries.bind(this);
1439
- this.LookupCacheEntry.bind(this);
1440
909
  }
1441
910
  CreateCacheEntry(request) {
1442
911
  const data = cache_1.CreateCacheEntryRequest.toBinary(request);
@@ -1453,610 +922,9 @@ class CacheServiceClientProtobuf {
1453
922
  const promise = this.rpc.request("github.actions.results.api.v1.CacheService", "GetCacheEntryDownloadURL", "application/protobuf", data);
1454
923
  return promise.then((data) => cache_1.GetCacheEntryDownloadURLResponse.fromBinary(data));
1455
924
  }
1456
- DeleteCacheEntry(request) {
1457
- const data = cache_1.DeleteCacheEntryRequest.toBinary(request);
1458
- const promise = this.rpc.request("github.actions.results.api.v1.CacheService", "DeleteCacheEntry", "application/protobuf", data);
1459
- return promise.then((data) => cache_1.DeleteCacheEntryResponse.fromBinary(data));
1460
- }
1461
- ListCacheEntries(request) {
1462
- const data = cache_1.ListCacheEntriesRequest.toBinary(request);
1463
- const promise = this.rpc.request("github.actions.results.api.v1.CacheService", "ListCacheEntries", "application/protobuf", data);
1464
- return promise.then((data) => cache_1.ListCacheEntriesResponse.fromBinary(data));
1465
- }
1466
- LookupCacheEntry(request) {
1467
- const data = cache_1.LookupCacheEntryRequest.toBinary(request);
1468
- const promise = this.rpc.request("github.actions.results.api.v1.CacheService", "LookupCacheEntry", "application/protobuf", data);
1469
- return promise.then((data) => cache_1.LookupCacheEntryResponse.fromBinary(data));
1470
- }
1471
925
  }
1472
926
  exports.CacheServiceClientProtobuf = CacheServiceClientProtobuf;
1473
- var CacheServiceMethod;
1474
- (function (CacheServiceMethod) {
1475
- CacheServiceMethod["CreateCacheEntry"] = "CreateCacheEntry";
1476
- CacheServiceMethod["FinalizeCacheEntryUpload"] = "FinalizeCacheEntryUpload";
1477
- CacheServiceMethod["GetCacheEntryDownloadURL"] = "GetCacheEntryDownloadURL";
1478
- CacheServiceMethod["DeleteCacheEntry"] = "DeleteCacheEntry";
1479
- CacheServiceMethod["ListCacheEntries"] = "ListCacheEntries";
1480
- CacheServiceMethod["LookupCacheEntry"] = "LookupCacheEntry";
1481
- })(CacheServiceMethod || (exports.CacheServiceMethod = CacheServiceMethod = {}));
1482
- exports.CacheServiceMethodList = [
1483
- CacheServiceMethod.CreateCacheEntry,
1484
- CacheServiceMethod.FinalizeCacheEntryUpload,
1485
- CacheServiceMethod.GetCacheEntryDownloadURL,
1486
- CacheServiceMethod.DeleteCacheEntry,
1487
- CacheServiceMethod.ListCacheEntries,
1488
- CacheServiceMethod.LookupCacheEntry,
1489
- ];
1490
- function createCacheServiceServer(service) {
1491
- return new twirp_ts_1.TwirpServer({
1492
- service,
1493
- packageName: "github.actions.results.api.v1",
1494
- serviceName: "CacheService",
1495
- methodList: exports.CacheServiceMethodList,
1496
- matchRoute: matchCacheServiceRoute,
1497
- });
1498
- }
1499
- exports.createCacheServiceServer = createCacheServiceServer;
1500
- function matchCacheServiceRoute(method, events) {
1501
- switch (method) {
1502
- case "CreateCacheEntry":
1503
- return (ctx, service, data, interceptors) => __awaiter(this, void 0, void 0, function* () {
1504
- ctx = Object.assign(Object.assign({}, ctx), { methodName: "CreateCacheEntry" });
1505
- yield events.onMatch(ctx);
1506
- return handleCacheServiceCreateCacheEntryRequest(ctx, service, data, interceptors);
1507
- });
1508
- case "FinalizeCacheEntryUpload":
1509
- return (ctx, service, data, interceptors) => __awaiter(this, void 0, void 0, function* () {
1510
- ctx = Object.assign(Object.assign({}, ctx), { methodName: "FinalizeCacheEntryUpload" });
1511
- yield events.onMatch(ctx);
1512
- return handleCacheServiceFinalizeCacheEntryUploadRequest(ctx, service, data, interceptors);
1513
- });
1514
- case "GetCacheEntryDownloadURL":
1515
- return (ctx, service, data, interceptors) => __awaiter(this, void 0, void 0, function* () {
1516
- ctx = Object.assign(Object.assign({}, ctx), { methodName: "GetCacheEntryDownloadURL" });
1517
- yield events.onMatch(ctx);
1518
- return handleCacheServiceGetCacheEntryDownloadURLRequest(ctx, service, data, interceptors);
1519
- });
1520
- case "DeleteCacheEntry":
1521
- return (ctx, service, data, interceptors) => __awaiter(this, void 0, void 0, function* () {
1522
- ctx = Object.assign(Object.assign({}, ctx), { methodName: "DeleteCacheEntry" });
1523
- yield events.onMatch(ctx);
1524
- return handleCacheServiceDeleteCacheEntryRequest(ctx, service, data, interceptors);
1525
- });
1526
- case "ListCacheEntries":
1527
- return (ctx, service, data, interceptors) => __awaiter(this, void 0, void 0, function* () {
1528
- ctx = Object.assign(Object.assign({}, ctx), { methodName: "ListCacheEntries" });
1529
- yield events.onMatch(ctx);
1530
- return handleCacheServiceListCacheEntriesRequest(ctx, service, data, interceptors);
1531
- });
1532
- case "LookupCacheEntry":
1533
- return (ctx, service, data, interceptors) => __awaiter(this, void 0, void 0, function* () {
1534
- ctx = Object.assign(Object.assign({}, ctx), { methodName: "LookupCacheEntry" });
1535
- yield events.onMatch(ctx);
1536
- return handleCacheServiceLookupCacheEntryRequest(ctx, service, data, interceptors);
1537
- });
1538
- default:
1539
- events.onNotFound();
1540
- const msg = `no handler found`;
1541
- throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.BadRoute, msg);
1542
- }
1543
- }
1544
- function handleCacheServiceCreateCacheEntryRequest(ctx, service, data, interceptors) {
1545
- switch (ctx.contentType) {
1546
- case twirp_ts_1.TwirpContentType.JSON:
1547
- return handleCacheServiceCreateCacheEntryJSON(ctx, service, data, interceptors);
1548
- case twirp_ts_1.TwirpContentType.Protobuf:
1549
- return handleCacheServiceCreateCacheEntryProtobuf(ctx, service, data, interceptors);
1550
- default:
1551
- const msg = "unexpected Content-Type";
1552
- throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.BadRoute, msg);
1553
- }
1554
- }
1555
- function handleCacheServiceFinalizeCacheEntryUploadRequest(ctx, service, data, interceptors) {
1556
- switch (ctx.contentType) {
1557
- case twirp_ts_1.TwirpContentType.JSON:
1558
- return handleCacheServiceFinalizeCacheEntryUploadJSON(ctx, service, data, interceptors);
1559
- case twirp_ts_1.TwirpContentType.Protobuf:
1560
- return handleCacheServiceFinalizeCacheEntryUploadProtobuf(ctx, service, data, interceptors);
1561
- default:
1562
- const msg = "unexpected Content-Type";
1563
- throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.BadRoute, msg);
1564
- }
1565
- }
1566
- function handleCacheServiceGetCacheEntryDownloadURLRequest(ctx, service, data, interceptors) {
1567
- switch (ctx.contentType) {
1568
- case twirp_ts_1.TwirpContentType.JSON:
1569
- return handleCacheServiceGetCacheEntryDownloadURLJSON(ctx, service, data, interceptors);
1570
- case twirp_ts_1.TwirpContentType.Protobuf:
1571
- return handleCacheServiceGetCacheEntryDownloadURLProtobuf(ctx, service, data, interceptors);
1572
- default:
1573
- const msg = "unexpected Content-Type";
1574
- throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.BadRoute, msg);
1575
- }
1576
- }
1577
- function handleCacheServiceDeleteCacheEntryRequest(ctx, service, data, interceptors) {
1578
- switch (ctx.contentType) {
1579
- case twirp_ts_1.TwirpContentType.JSON:
1580
- return handleCacheServiceDeleteCacheEntryJSON(ctx, service, data, interceptors);
1581
- case twirp_ts_1.TwirpContentType.Protobuf:
1582
- return handleCacheServiceDeleteCacheEntryProtobuf(ctx, service, data, interceptors);
1583
- default:
1584
- const msg = "unexpected Content-Type";
1585
- throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.BadRoute, msg);
1586
- }
1587
- }
1588
- function handleCacheServiceListCacheEntriesRequest(ctx, service, data, interceptors) {
1589
- switch (ctx.contentType) {
1590
- case twirp_ts_1.TwirpContentType.JSON:
1591
- return handleCacheServiceListCacheEntriesJSON(ctx, service, data, interceptors);
1592
- case twirp_ts_1.TwirpContentType.Protobuf:
1593
- return handleCacheServiceListCacheEntriesProtobuf(ctx, service, data, interceptors);
1594
- default:
1595
- const msg = "unexpected Content-Type";
1596
- throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.BadRoute, msg);
1597
- }
1598
- }
1599
- function handleCacheServiceLookupCacheEntryRequest(ctx, service, data, interceptors) {
1600
- switch (ctx.contentType) {
1601
- case twirp_ts_1.TwirpContentType.JSON:
1602
- return handleCacheServiceLookupCacheEntryJSON(ctx, service, data, interceptors);
1603
- case twirp_ts_1.TwirpContentType.Protobuf:
1604
- return handleCacheServiceLookupCacheEntryProtobuf(ctx, service, data, interceptors);
1605
- default:
1606
- const msg = "unexpected Content-Type";
1607
- throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.BadRoute, msg);
1608
- }
1609
- }
1610
- function handleCacheServiceCreateCacheEntryJSON(ctx, service, data, interceptors) {
1611
- return __awaiter(this, void 0, void 0, function* () {
1612
- let request;
1613
- let response;
1614
- try {
1615
- const body = JSON.parse(data.toString() || "{}");
1616
- request = cache_1.CreateCacheEntryRequest.fromJson(body, {
1617
- ignoreUnknownFields: true,
1618
- });
1619
- }
1620
- catch (e) {
1621
- if (e instanceof Error) {
1622
- const msg = "the json request could not be decoded";
1623
- throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true);
1624
- }
1625
- }
1626
- if (interceptors && interceptors.length > 0) {
1627
- const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors);
1628
- response = yield interceptor(ctx, request, (ctx, inputReq) => {
1629
- return service.CreateCacheEntry(ctx, inputReq);
1630
- });
1631
- }
1632
- else {
1633
- response = yield service.CreateCacheEntry(ctx, request);
1634
- }
1635
- return JSON.stringify(cache_1.CreateCacheEntryResponse.toJson(response, {
1636
- useProtoFieldName: true,
1637
- emitDefaultValues: false,
1638
- }));
1639
- });
1640
- }
1641
- function handleCacheServiceFinalizeCacheEntryUploadJSON(ctx, service, data, interceptors) {
1642
- return __awaiter(this, void 0, void 0, function* () {
1643
- let request;
1644
- let response;
1645
- try {
1646
- const body = JSON.parse(data.toString() || "{}");
1647
- request = cache_1.FinalizeCacheEntryUploadRequest.fromJson(body, {
1648
- ignoreUnknownFields: true,
1649
- });
1650
- }
1651
- catch (e) {
1652
- if (e instanceof Error) {
1653
- const msg = "the json request could not be decoded";
1654
- throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true);
1655
- }
1656
- }
1657
- if (interceptors && interceptors.length > 0) {
1658
- const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors);
1659
- response = yield interceptor(ctx, request, (ctx, inputReq) => {
1660
- return service.FinalizeCacheEntryUpload(ctx, inputReq);
1661
- });
1662
- }
1663
- else {
1664
- response = yield service.FinalizeCacheEntryUpload(ctx, request);
1665
- }
1666
- return JSON.stringify(cache_1.FinalizeCacheEntryUploadResponse.toJson(response, {
1667
- useProtoFieldName: true,
1668
- emitDefaultValues: false,
1669
- }));
1670
- });
1671
- }
1672
- function handleCacheServiceGetCacheEntryDownloadURLJSON(ctx, service, data, interceptors) {
1673
- return __awaiter(this, void 0, void 0, function* () {
1674
- let request;
1675
- let response;
1676
- try {
1677
- const body = JSON.parse(data.toString() || "{}");
1678
- request = cache_1.GetCacheEntryDownloadURLRequest.fromJson(body, {
1679
- ignoreUnknownFields: true,
1680
- });
1681
- }
1682
- catch (e) {
1683
- if (e instanceof Error) {
1684
- const msg = "the json request could not be decoded";
1685
- throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true);
1686
- }
1687
- }
1688
- if (interceptors && interceptors.length > 0) {
1689
- const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors);
1690
- response = yield interceptor(ctx, request, (ctx, inputReq) => {
1691
- return service.GetCacheEntryDownloadURL(ctx, inputReq);
1692
- });
1693
- }
1694
- else {
1695
- response = yield service.GetCacheEntryDownloadURL(ctx, request);
1696
- }
1697
- return JSON.stringify(cache_1.GetCacheEntryDownloadURLResponse.toJson(response, {
1698
- useProtoFieldName: true,
1699
- emitDefaultValues: false,
1700
- }));
1701
- });
1702
- }
1703
- function handleCacheServiceDeleteCacheEntryJSON(ctx, service, data, interceptors) {
1704
- return __awaiter(this, void 0, void 0, function* () {
1705
- let request;
1706
- let response;
1707
- try {
1708
- const body = JSON.parse(data.toString() || "{}");
1709
- request = cache_1.DeleteCacheEntryRequest.fromJson(body, {
1710
- ignoreUnknownFields: true,
1711
- });
1712
- }
1713
- catch (e) {
1714
- if (e instanceof Error) {
1715
- const msg = "the json request could not be decoded";
1716
- throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true);
1717
- }
1718
- }
1719
- if (interceptors && interceptors.length > 0) {
1720
- const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors);
1721
- response = yield interceptor(ctx, request, (ctx, inputReq) => {
1722
- return service.DeleteCacheEntry(ctx, inputReq);
1723
- });
1724
- }
1725
- else {
1726
- response = yield service.DeleteCacheEntry(ctx, request);
1727
- }
1728
- return JSON.stringify(cache_1.DeleteCacheEntryResponse.toJson(response, {
1729
- useProtoFieldName: true,
1730
- emitDefaultValues: false,
1731
- }));
1732
- });
1733
- }
1734
- function handleCacheServiceListCacheEntriesJSON(ctx, service, data, interceptors) {
1735
- return __awaiter(this, void 0, void 0, function* () {
1736
- let request;
1737
- let response;
1738
- try {
1739
- const body = JSON.parse(data.toString() || "{}");
1740
- request = cache_1.ListCacheEntriesRequest.fromJson(body, {
1741
- ignoreUnknownFields: true,
1742
- });
1743
- }
1744
- catch (e) {
1745
- if (e instanceof Error) {
1746
- const msg = "the json request could not be decoded";
1747
- throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true);
1748
- }
1749
- }
1750
- if (interceptors && interceptors.length > 0) {
1751
- const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors);
1752
- response = yield interceptor(ctx, request, (ctx, inputReq) => {
1753
- return service.ListCacheEntries(ctx, inputReq);
1754
- });
1755
- }
1756
- else {
1757
- response = yield service.ListCacheEntries(ctx, request);
1758
- }
1759
- return JSON.stringify(cache_1.ListCacheEntriesResponse.toJson(response, {
1760
- useProtoFieldName: true,
1761
- emitDefaultValues: false,
1762
- }));
1763
- });
1764
- }
1765
- function handleCacheServiceLookupCacheEntryJSON(ctx, service, data, interceptors) {
1766
- return __awaiter(this, void 0, void 0, function* () {
1767
- let request;
1768
- let response;
1769
- try {
1770
- const body = JSON.parse(data.toString() || "{}");
1771
- request = cache_1.LookupCacheEntryRequest.fromJson(body, {
1772
- ignoreUnknownFields: true,
1773
- });
1774
- }
1775
- catch (e) {
1776
- if (e instanceof Error) {
1777
- const msg = "the json request could not be decoded";
1778
- throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true);
1779
- }
1780
- }
1781
- if (interceptors && interceptors.length > 0) {
1782
- const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors);
1783
- response = yield interceptor(ctx, request, (ctx, inputReq) => {
1784
- return service.LookupCacheEntry(ctx, inputReq);
1785
- });
1786
- }
1787
- else {
1788
- response = yield service.LookupCacheEntry(ctx, request);
1789
- }
1790
- return JSON.stringify(cache_1.LookupCacheEntryResponse.toJson(response, {
1791
- useProtoFieldName: true,
1792
- emitDefaultValues: false,
1793
- }));
1794
- });
1795
- }
1796
- function handleCacheServiceCreateCacheEntryProtobuf(ctx, service, data, interceptors) {
1797
- return __awaiter(this, void 0, void 0, function* () {
1798
- let request;
1799
- let response;
1800
- try {
1801
- request = cache_1.CreateCacheEntryRequest.fromBinary(data);
1802
- }
1803
- catch (e) {
1804
- if (e instanceof Error) {
1805
- const msg = "the protobuf request could not be decoded";
1806
- throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true);
1807
- }
1808
- }
1809
- if (interceptors && interceptors.length > 0) {
1810
- const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors);
1811
- response = yield interceptor(ctx, request, (ctx, inputReq) => {
1812
- return service.CreateCacheEntry(ctx, inputReq);
1813
- });
1814
- }
1815
- else {
1816
- response = yield service.CreateCacheEntry(ctx, request);
1817
- }
1818
- return Buffer.from(cache_1.CreateCacheEntryResponse.toBinary(response));
1819
- });
1820
- }
1821
- function handleCacheServiceFinalizeCacheEntryUploadProtobuf(ctx, service, data, interceptors) {
1822
- return __awaiter(this, void 0, void 0, function* () {
1823
- let request;
1824
- let response;
1825
- try {
1826
- request = cache_1.FinalizeCacheEntryUploadRequest.fromBinary(data);
1827
- }
1828
- catch (e) {
1829
- if (e instanceof Error) {
1830
- const msg = "the protobuf request could not be decoded";
1831
- throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true);
1832
- }
1833
- }
1834
- if (interceptors && interceptors.length > 0) {
1835
- const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors);
1836
- response = yield interceptor(ctx, request, (ctx, inputReq) => {
1837
- return service.FinalizeCacheEntryUpload(ctx, inputReq);
1838
- });
1839
- }
1840
- else {
1841
- response = yield service.FinalizeCacheEntryUpload(ctx, request);
1842
- }
1843
- return Buffer.from(cache_1.FinalizeCacheEntryUploadResponse.toBinary(response));
1844
- });
1845
- }
1846
- function handleCacheServiceGetCacheEntryDownloadURLProtobuf(ctx, service, data, interceptors) {
1847
- return __awaiter(this, void 0, void 0, function* () {
1848
- let request;
1849
- let response;
1850
- try {
1851
- request = cache_1.GetCacheEntryDownloadURLRequest.fromBinary(data);
1852
- }
1853
- catch (e) {
1854
- if (e instanceof Error) {
1855
- const msg = "the protobuf request could not be decoded";
1856
- throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true);
1857
- }
1858
- }
1859
- if (interceptors && interceptors.length > 0) {
1860
- const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors);
1861
- response = yield interceptor(ctx, request, (ctx, inputReq) => {
1862
- return service.GetCacheEntryDownloadURL(ctx, inputReq);
1863
- });
1864
- }
1865
- else {
1866
- response = yield service.GetCacheEntryDownloadURL(ctx, request);
1867
- }
1868
- return Buffer.from(cache_1.GetCacheEntryDownloadURLResponse.toBinary(response));
1869
- });
1870
- }
1871
- function handleCacheServiceDeleteCacheEntryProtobuf(ctx, service, data, interceptors) {
1872
- return __awaiter(this, void 0, void 0, function* () {
1873
- let request;
1874
- let response;
1875
- try {
1876
- request = cache_1.DeleteCacheEntryRequest.fromBinary(data);
1877
- }
1878
- catch (e) {
1879
- if (e instanceof Error) {
1880
- const msg = "the protobuf request could not be decoded";
1881
- throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true);
1882
- }
1883
- }
1884
- if (interceptors && interceptors.length > 0) {
1885
- const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors);
1886
- response = yield interceptor(ctx, request, (ctx, inputReq) => {
1887
- return service.DeleteCacheEntry(ctx, inputReq);
1888
- });
1889
- }
1890
- else {
1891
- response = yield service.DeleteCacheEntry(ctx, request);
1892
- }
1893
- return Buffer.from(cache_1.DeleteCacheEntryResponse.toBinary(response));
1894
- });
1895
- }
1896
- function handleCacheServiceListCacheEntriesProtobuf(ctx, service, data, interceptors) {
1897
- return __awaiter(this, void 0, void 0, function* () {
1898
- let request;
1899
- let response;
1900
- try {
1901
- request = cache_1.ListCacheEntriesRequest.fromBinary(data);
1902
- }
1903
- catch (e) {
1904
- if (e instanceof Error) {
1905
- const msg = "the protobuf request could not be decoded";
1906
- throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true);
1907
- }
1908
- }
1909
- if (interceptors && interceptors.length > 0) {
1910
- const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors);
1911
- response = yield interceptor(ctx, request, (ctx, inputReq) => {
1912
- return service.ListCacheEntries(ctx, inputReq);
1913
- });
1914
- }
1915
- else {
1916
- response = yield service.ListCacheEntries(ctx, request);
1917
- }
1918
- return Buffer.from(cache_1.ListCacheEntriesResponse.toBinary(response));
1919
- });
1920
- }
1921
- function handleCacheServiceLookupCacheEntryProtobuf(ctx, service, data, interceptors) {
1922
- return __awaiter(this, void 0, void 0, function* () {
1923
- let request;
1924
- let response;
1925
- try {
1926
- request = cache_1.LookupCacheEntryRequest.fromBinary(data);
1927
- }
1928
- catch (e) {
1929
- if (e instanceof Error) {
1930
- const msg = "the protobuf request could not be decoded";
1931
- throw new twirp_ts_1.TwirpError(twirp_ts_1.TwirpErrorCode.Malformed, msg).withCause(e, true);
1932
- }
1933
- }
1934
- if (interceptors && interceptors.length > 0) {
1935
- const interceptor = (0, twirp_ts_1.chainInterceptors)(...interceptors);
1936
- response = yield interceptor(ctx, request, (ctx, inputReq) => {
1937
- return service.LookupCacheEntry(ctx, inputReq);
1938
- });
1939
- }
1940
- else {
1941
- response = yield service.LookupCacheEntry(ctx, request);
1942
- }
1943
- return Buffer.from(cache_1.LookupCacheEntryResponse.toBinary(response));
1944
- });
1945
- }
1946
- //# sourceMappingURL=cache.twirp.js.map
1947
-
1948
- /***/ }),
1949
-
1950
- /***/ 3639:
1951
- /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
1952
-
1953
- "use strict";
1954
-
1955
- Object.defineProperty(exports, "__esModule", ({ value: true }));
1956
- exports.CacheEntry = void 0;
1957
- const runtime_1 = __nccwpck_require__(4061);
1958
- const runtime_2 = __nccwpck_require__(4061);
1959
- const runtime_3 = __nccwpck_require__(4061);
1960
- const runtime_4 = __nccwpck_require__(4061);
1961
- const runtime_5 = __nccwpck_require__(4061);
1962
- const timestamp_1 = __nccwpck_require__(4469);
1963
- // @generated message type with reflection information, may provide speed optimized methods
1964
- class CacheEntry$Type extends runtime_5.MessageType {
1965
- constructor() {
1966
- super("github.actions.results.entities.v1.CacheEntry", [
1967
- { no: 1, name: "key", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
1968
- { no: 2, name: "hash", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
1969
- { no: 3, name: "size_bytes", kind: "scalar", T: 3 /*ScalarType.INT64*/ },
1970
- { no: 4, name: "scope", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
1971
- { no: 5, name: "version", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
1972
- { no: 6, name: "created_at", kind: "message", T: () => timestamp_1.Timestamp },
1973
- { no: 7, name: "last_accessed_at", kind: "message", T: () => timestamp_1.Timestamp },
1974
- { no: 8, name: "expires_at", kind: "message", T: () => timestamp_1.Timestamp }
1975
- ]);
1976
- }
1977
- create(value) {
1978
- const message = { key: "", hash: "", sizeBytes: "0", scope: "", version: "" };
1979
- globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this });
1980
- if (value !== undefined)
1981
- (0, runtime_3.reflectionMergePartial)(this, message, value);
1982
- return message;
1983
- }
1984
- internalBinaryRead(reader, length, options, target) {
1985
- let message = target !== null && target !== void 0 ? target : this.create(), end = reader.pos + length;
1986
- while (reader.pos < end) {
1987
- let [fieldNo, wireType] = reader.tag();
1988
- switch (fieldNo) {
1989
- case /* string key */ 1:
1990
- message.key = reader.string();
1991
- break;
1992
- case /* string hash */ 2:
1993
- message.hash = reader.string();
1994
- break;
1995
- case /* int64 size_bytes */ 3:
1996
- message.sizeBytes = reader.int64().toString();
1997
- break;
1998
- case /* string scope */ 4:
1999
- message.scope = reader.string();
2000
- break;
2001
- case /* string version */ 5:
2002
- message.version = reader.string();
2003
- break;
2004
- case /* google.protobuf.Timestamp created_at */ 6:
2005
- message.createdAt = timestamp_1.Timestamp.internalBinaryRead(reader, reader.uint32(), options, message.createdAt);
2006
- break;
2007
- case /* google.protobuf.Timestamp last_accessed_at */ 7:
2008
- message.lastAccessedAt = timestamp_1.Timestamp.internalBinaryRead(reader, reader.uint32(), options, message.lastAccessedAt);
2009
- break;
2010
- case /* google.protobuf.Timestamp expires_at */ 8:
2011
- message.expiresAt = timestamp_1.Timestamp.internalBinaryRead(reader, reader.uint32(), options, message.expiresAt);
2012
- break;
2013
- default:
2014
- let u = options.readUnknownField;
2015
- if (u === "throw")
2016
- throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
2017
- let d = reader.skip(wireType);
2018
- if (u !== false)
2019
- (u === true ? runtime_2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
2020
- }
2021
- }
2022
- return message;
2023
- }
2024
- internalBinaryWrite(message, writer, options) {
2025
- /* string key = 1; */
2026
- if (message.key !== "")
2027
- writer.tag(1, runtime_1.WireType.LengthDelimited).string(message.key);
2028
- /* string hash = 2; */
2029
- if (message.hash !== "")
2030
- writer.tag(2, runtime_1.WireType.LengthDelimited).string(message.hash);
2031
- /* int64 size_bytes = 3; */
2032
- if (message.sizeBytes !== "0")
2033
- writer.tag(3, runtime_1.WireType.Varint).int64(message.sizeBytes);
2034
- /* string scope = 4; */
2035
- if (message.scope !== "")
2036
- writer.tag(4, runtime_1.WireType.LengthDelimited).string(message.scope);
2037
- /* string version = 5; */
2038
- if (message.version !== "")
2039
- writer.tag(5, runtime_1.WireType.LengthDelimited).string(message.version);
2040
- /* google.protobuf.Timestamp created_at = 6; */
2041
- if (message.createdAt)
2042
- timestamp_1.Timestamp.internalBinaryWrite(message.createdAt, writer.tag(6, runtime_1.WireType.LengthDelimited).fork(), options).join();
2043
- /* google.protobuf.Timestamp last_accessed_at = 7; */
2044
- if (message.lastAccessedAt)
2045
- timestamp_1.Timestamp.internalBinaryWrite(message.lastAccessedAt, writer.tag(7, runtime_1.WireType.LengthDelimited).fork(), options).join();
2046
- /* google.protobuf.Timestamp expires_at = 8; */
2047
- if (message.expiresAt)
2048
- timestamp_1.Timestamp.internalBinaryWrite(message.expiresAt, writer.tag(8, runtime_1.WireType.LengthDelimited).fork(), options).join();
2049
- let u = options.writeUnknownFields;
2050
- if (u !== false)
2051
- (u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
2052
- return writer;
2053
- }
2054
- }
2055
- /**
2056
- * @generated MessageType for protobuf message github.actions.results.entities.v1.CacheEntry
2057
- */
2058
- exports.CacheEntry = new CacheEntry$Type();
2059
- //# sourceMappingURL=cacheentry.js.map
927
+ //# sourceMappingURL=cache.twirp-client.js.map
2060
928
 
2061
929
  /***/ }),
2062
930
 
@@ -3327,7 +2195,7 @@ const config_1 = __nccwpck_require__(5147);
3327
2195
  const cacheUtils_1 = __nccwpck_require__(1518);
3328
2196
  const auth_1 = __nccwpck_require__(5526);
3329
2197
  const http_client_1 = __nccwpck_require__(6255);
3330
- const cache_twirp_1 = __nccwpck_require__(267);
2198
+ const cache_twirp_client_1 = __nccwpck_require__(2655);
3331
2199
  /**
3332
2200
  * This class is a wrapper around the CacheServiceClientJSON class generated by Twirp.
3333
2201
  *
@@ -3464,7 +2332,7 @@ class CacheServiceClient {
3464
2332
  }
3465
2333
  function internalCacheTwirpClient(options) {
3466
2334
  const client = new CacheServiceClient((0, user_agent_1.getUserAgentString)(), options === null || options === void 0 ? void 0 : options.maxAttempts, options === null || options === void 0 ? void 0 : options.retryIntervalMs, options === null || options === void 0 ? void 0 : options.retryMultiplier);
3467
- return new cache_twirp_1.CacheServiceClientJSON(client);
2335
+ return new cache_twirp_client_1.CacheServiceClientJSON(client);
3468
2336
  }
3469
2337
  exports.internalCacheTwirpClient = internalCacheTwirpClient;
3470
2338
  //# sourceMappingURL=cacheTwirpClient.js.map
@@ -56852,599 +55720,6 @@ class Deprecation extends Error {
56852
55720
  exports.Deprecation = Deprecation;
56853
55721
 
56854
55722
 
56855
- /***/ }),
56856
-
56857
- /***/ 4365:
56858
- /***/ ((module) => {
56859
-
56860
- "use strict";
56861
-
56862
-
56863
- function _process (v, mod) {
56864
- var i
56865
- var r
56866
-
56867
- if (typeof mod === 'function') {
56868
- r = mod(v)
56869
- if (r !== undefined) {
56870
- v = r
56871
- }
56872
- } else if (Array.isArray(mod)) {
56873
- for (i = 0; i < mod.length; i++) {
56874
- r = mod[i](v)
56875
- if (r !== undefined) {
56876
- v = r
56877
- }
56878
- }
56879
- }
56880
-
56881
- return v
56882
- }
56883
-
56884
- function parseKey (key, val) {
56885
- // detect negative index notation
56886
- if (key[0] === '-' && Array.isArray(val) && /^-\d+$/.test(key)) {
56887
- return val.length + parseInt(key, 10)
56888
- }
56889
- return key
56890
- }
56891
-
56892
- function isIndex (k) {
56893
- return /^\d+$/.test(k)
56894
- }
56895
-
56896
- function isObject (val) {
56897
- return Object.prototype.toString.call(val) === '[object Object]'
56898
- }
56899
-
56900
- function isArrayOrObject (val) {
56901
- return Object(val) === val
56902
- }
56903
-
56904
- function isEmptyObject (val) {
56905
- return Object.keys(val).length === 0
56906
- }
56907
-
56908
- var blacklist = ['__proto__', 'prototype', 'constructor']
56909
- var blacklistFilter = function (part) { return blacklist.indexOf(part) === -1 }
56910
-
56911
- function parsePath (path, sep) {
56912
- if (path.indexOf('[') >= 0) {
56913
- path = path.replace(/\[/g, sep).replace(/]/g, '')
56914
- }
56915
-
56916
- var parts = path.split(sep)
56917
-
56918
- var check = parts.filter(blacklistFilter)
56919
-
56920
- if (check.length !== parts.length) {
56921
- throw Error('Refusing to update blacklisted property ' + path)
56922
- }
56923
-
56924
- return parts
56925
- }
56926
-
56927
- var hasOwnProperty = Object.prototype.hasOwnProperty
56928
-
56929
- function DotObject (separator, override, useArray, useBrackets) {
56930
- if (!(this instanceof DotObject)) {
56931
- return new DotObject(separator, override, useArray, useBrackets)
56932
- }
56933
-
56934
- if (typeof override === 'undefined') override = false
56935
- if (typeof useArray === 'undefined') useArray = true
56936
- if (typeof useBrackets === 'undefined') useBrackets = true
56937
- this.separator = separator || '.'
56938
- this.override = override
56939
- this.useArray = useArray
56940
- this.useBrackets = useBrackets
56941
- this.keepArray = false
56942
-
56943
- // contains touched arrays
56944
- this.cleanup = []
56945
- }
56946
-
56947
- var dotDefault = new DotObject('.', false, true, true)
56948
- function wrap (method) {
56949
- return function () {
56950
- return dotDefault[method].apply(dotDefault, arguments)
56951
- }
56952
- }
56953
-
56954
- DotObject.prototype._fill = function (a, obj, v, mod) {
56955
- var k = a.shift()
56956
-
56957
- if (a.length > 0) {
56958
- obj[k] = obj[k] || (this.useArray && isIndex(a[0]) ? [] : {})
56959
-
56960
- if (!isArrayOrObject(obj[k])) {
56961
- if (this.override) {
56962
- obj[k] = {}
56963
- } else {
56964
- if (!(isArrayOrObject(v) && isEmptyObject(v))) {
56965
- throw new Error(
56966
- 'Trying to redefine `' + k + '` which is a ' + typeof obj[k]
56967
- )
56968
- }
56969
-
56970
- return
56971
- }
56972
- }
56973
-
56974
- this._fill(a, obj[k], v, mod)
56975
- } else {
56976
- if (!this.override && isArrayOrObject(obj[k]) && !isEmptyObject(obj[k])) {
56977
- if (!(isArrayOrObject(v) && isEmptyObject(v))) {
56978
- throw new Error("Trying to redefine non-empty obj['" + k + "']")
56979
- }
56980
-
56981
- return
56982
- }
56983
-
56984
- obj[k] = _process(v, mod)
56985
- }
56986
- }
56987
-
56988
- /**
56989
- *
56990
- * Converts an object with dotted-key/value pairs to it's expanded version
56991
- *
56992
- * Optionally transformed by a set of modifiers.
56993
- *
56994
- * Usage:
56995
- *
56996
- * var row = {
56997
- * 'nr': 200,
56998
- * 'doc.name': ' My Document '
56999
- * }
57000
- *
57001
- * var mods = {
57002
- * 'doc.name': [_s.trim, _s.underscored]
57003
- * }
57004
- *
57005
- * dot.object(row, mods)
57006
- *
57007
- * @param {Object} obj
57008
- * @param {Object} mods
57009
- */
57010
- DotObject.prototype.object = function (obj, mods) {
57011
- var self = this
57012
-
57013
- Object.keys(obj).forEach(function (k) {
57014
- var mod = mods === undefined ? null : mods[k]
57015
- // normalize array notation.
57016
- var ok = parsePath(k, self.separator).join(self.separator)
57017
-
57018
- if (ok.indexOf(self.separator) !== -1) {
57019
- self._fill(ok.split(self.separator), obj, obj[k], mod)
57020
- delete obj[k]
57021
- } else {
57022
- obj[k] = _process(obj[k], mod)
57023
- }
57024
- })
57025
-
57026
- return obj
57027
- }
57028
-
57029
- /**
57030
- * @param {String} path dotted path
57031
- * @param {String} v value to be set
57032
- * @param {Object} obj object to be modified
57033
- * @param {Function|Array} mod optional modifier
57034
- */
57035
- DotObject.prototype.str = function (path, v, obj, mod) {
57036
- var ok = parsePath(path, this.separator).join(this.separator)
57037
-
57038
- if (path.indexOf(this.separator) !== -1) {
57039
- this._fill(ok.split(this.separator), obj, v, mod)
57040
- } else {
57041
- obj[path] = _process(v, mod)
57042
- }
57043
-
57044
- return obj
57045
- }
57046
-
57047
- /**
57048
- *
57049
- * Pick a value from an object using dot notation.
57050
- *
57051
- * Optionally remove the value
57052
- *
57053
- * @param {String} path
57054
- * @param {Object} obj
57055
- * @param {Boolean} remove
57056
- */
57057
- DotObject.prototype.pick = function (path, obj, remove, reindexArray) {
57058
- var i
57059
- var keys
57060
- var val
57061
- var key
57062
- var cp
57063
-
57064
- keys = parsePath(path, this.separator)
57065
- for (i = 0; i < keys.length; i++) {
57066
- key = parseKey(keys[i], obj)
57067
- if (obj && typeof obj === 'object' && key in obj) {
57068
- if (i === keys.length - 1) {
57069
- if (remove) {
57070
- val = obj[key]
57071
- if (reindexArray && Array.isArray(obj)) {
57072
- obj.splice(key, 1)
57073
- } else {
57074
- delete obj[key]
57075
- }
57076
- if (Array.isArray(obj)) {
57077
- cp = keys.slice(0, -1).join('.')
57078
- if (this.cleanup.indexOf(cp) === -1) {
57079
- this.cleanup.push(cp)
57080
- }
57081
- }
57082
- return val
57083
- } else {
57084
- return obj[key]
57085
- }
57086
- } else {
57087
- obj = obj[key]
57088
- }
57089
- } else {
57090
- return undefined
57091
- }
57092
- }
57093
- if (remove && Array.isArray(obj)) {
57094
- obj = obj.filter(function (n) {
57095
- return n !== undefined
57096
- })
57097
- }
57098
- return obj
57099
- }
57100
- /**
57101
- *
57102
- * Delete value from an object using dot notation.
57103
- *
57104
- * @param {String} path
57105
- * @param {Object} obj
57106
- * @return {any} The removed value
57107
- */
57108
- DotObject.prototype.delete = function (path, obj) {
57109
- return this.remove(path, obj, true)
57110
- }
57111
-
57112
- /**
57113
- *
57114
- * Remove value from an object using dot notation.
57115
- *
57116
- * Will remove multiple items if path is an array.
57117
- * In this case array indexes will be retained until all
57118
- * removals have been processed.
57119
- *
57120
- * Use dot.delete() to automatically re-index arrays.
57121
- *
57122
- * @param {String|Array<String>} path
57123
- * @param {Object} obj
57124
- * @param {Boolean} reindexArray
57125
- * @return {any} The removed value
57126
- */
57127
- DotObject.prototype.remove = function (path, obj, reindexArray) {
57128
- var i
57129
-
57130
- this.cleanup = []
57131
- if (Array.isArray(path)) {
57132
- for (i = 0; i < path.length; i++) {
57133
- this.pick(path[i], obj, true, reindexArray)
57134
- }
57135
- if (!reindexArray) {
57136
- this._cleanup(obj)
57137
- }
57138
- return obj
57139
- } else {
57140
- return this.pick(path, obj, true, reindexArray)
57141
- }
57142
- }
57143
-
57144
- DotObject.prototype._cleanup = function (obj) {
57145
- var ret
57146
- var i
57147
- var keys
57148
- var root
57149
- if (this.cleanup.length) {
57150
- for (i = 0; i < this.cleanup.length; i++) {
57151
- keys = this.cleanup[i].split('.')
57152
- root = keys.splice(0, -1).join('.')
57153
- ret = root ? this.pick(root, obj) : obj
57154
- ret = ret[keys[0]].filter(function (v) {
57155
- return v !== undefined
57156
- })
57157
- this.set(this.cleanup[i], ret, obj)
57158
- }
57159
- this.cleanup = []
57160
- }
57161
- }
57162
-
57163
- /**
57164
- * Alias method for `dot.remove`
57165
- *
57166
- * Note: this is not an alias for dot.delete()
57167
- *
57168
- * @param {String|Array<String>} path
57169
- * @param {Object} obj
57170
- * @param {Boolean} reindexArray
57171
- * @return {any} The removed value
57172
- */
57173
- DotObject.prototype.del = DotObject.prototype.remove
57174
-
57175
- /**
57176
- *
57177
- * Move a property from one place to the other.
57178
- *
57179
- * If the source path does not exist (undefined)
57180
- * the target property will not be set.
57181
- *
57182
- * @param {String} source
57183
- * @param {String} target
57184
- * @param {Object} obj
57185
- * @param {Function|Array} mods
57186
- * @param {Boolean} merge
57187
- */
57188
- DotObject.prototype.move = function (source, target, obj, mods, merge) {
57189
- if (typeof mods === 'function' || Array.isArray(mods)) {
57190
- this.set(target, _process(this.pick(source, obj, true), mods), obj, merge)
57191
- } else {
57192
- merge = mods
57193
- this.set(target, this.pick(source, obj, true), obj, merge)
57194
- }
57195
-
57196
- return obj
57197
- }
57198
-
57199
- /**
57200
- *
57201
- * Transfer a property from one object to another object.
57202
- *
57203
- * If the source path does not exist (undefined)
57204
- * the property on the other object will not be set.
57205
- *
57206
- * @param {String} source
57207
- * @param {String} target
57208
- * @param {Object} obj1
57209
- * @param {Object} obj2
57210
- * @param {Function|Array} mods
57211
- * @param {Boolean} merge
57212
- */
57213
- DotObject.prototype.transfer = function (
57214
- source,
57215
- target,
57216
- obj1,
57217
- obj2,
57218
- mods,
57219
- merge
57220
- ) {
57221
- if (typeof mods === 'function' || Array.isArray(mods)) {
57222
- this.set(
57223
- target,
57224
- _process(this.pick(source, obj1, true), mods),
57225
- obj2,
57226
- merge
57227
- )
57228
- } else {
57229
- merge = mods
57230
- this.set(target, this.pick(source, obj1, true), obj2, merge)
57231
- }
57232
-
57233
- return obj2
57234
- }
57235
-
57236
- /**
57237
- *
57238
- * Copy a property from one object to another object.
57239
- *
57240
- * If the source path does not exist (undefined)
57241
- * the property on the other object will not be set.
57242
- *
57243
- * @param {String} source
57244
- * @param {String} target
57245
- * @param {Object} obj1
57246
- * @param {Object} obj2
57247
- * @param {Function|Array} mods
57248
- * @param {Boolean} merge
57249
- */
57250
- DotObject.prototype.copy = function (source, target, obj1, obj2, mods, merge) {
57251
- if (typeof mods === 'function' || Array.isArray(mods)) {
57252
- this.set(
57253
- target,
57254
- _process(
57255
- // clone what is picked
57256
- JSON.parse(JSON.stringify(this.pick(source, obj1, false))),
57257
- mods
57258
- ),
57259
- obj2,
57260
- merge
57261
- )
57262
- } else {
57263
- merge = mods
57264
- this.set(target, this.pick(source, obj1, false), obj2, merge)
57265
- }
57266
-
57267
- return obj2
57268
- }
57269
-
57270
- /**
57271
- *
57272
- * Set a property on an object using dot notation.
57273
- *
57274
- * @param {String} path
57275
- * @param {any} val
57276
- * @param {Object} obj
57277
- * @param {Boolean} merge
57278
- */
57279
- DotObject.prototype.set = function (path, val, obj, merge) {
57280
- var i
57281
- var k
57282
- var keys
57283
- var key
57284
-
57285
- // Do not operate if the value is undefined.
57286
- if (typeof val === 'undefined') {
57287
- return obj
57288
- }
57289
- keys = parsePath(path, this.separator)
57290
-
57291
- for (i = 0; i < keys.length; i++) {
57292
- key = keys[i]
57293
- if (i === keys.length - 1) {
57294
- if (merge && isObject(val) && isObject(obj[key])) {
57295
- for (k in val) {
57296
- if (hasOwnProperty.call(val, k)) {
57297
- obj[key][k] = val[k]
57298
- }
57299
- }
57300
- } else if (merge && Array.isArray(obj[key]) && Array.isArray(val)) {
57301
- for (var j = 0; j < val.length; j++) {
57302
- obj[keys[i]].push(val[j])
57303
- }
57304
- } else {
57305
- obj[key] = val
57306
- }
57307
- } else if (
57308
- // force the value to be an object
57309
- !hasOwnProperty.call(obj, key) ||
57310
- (!isObject(obj[key]) && !Array.isArray(obj[key]))
57311
- ) {
57312
- // initialize as array if next key is numeric
57313
- if (/^\d+$/.test(keys[i + 1])) {
57314
- obj[key] = []
57315
- } else {
57316
- obj[key] = {}
57317
- }
57318
- }
57319
- obj = obj[key]
57320
- }
57321
- return obj
57322
- }
57323
-
57324
- /**
57325
- *
57326
- * Transform an object
57327
- *
57328
- * Usage:
57329
- *
57330
- * var obj = {
57331
- * "id": 1,
57332
- * "some": {
57333
- * "thing": "else"
57334
- * }
57335
- * }
57336
- *
57337
- * var transform = {
57338
- * "id": "nr",
57339
- * "some.thing": "name"
57340
- * }
57341
- *
57342
- * var tgt = dot.transform(transform, obj)
57343
- *
57344
- * @param {Object} recipe Transform recipe
57345
- * @param {Object} obj Object to be transformed
57346
- * @param {Array} mods modifiers for the target
57347
- */
57348
- DotObject.prototype.transform = function (recipe, obj, tgt) {
57349
- obj = obj || {}
57350
- tgt = tgt || {}
57351
- Object.keys(recipe).forEach(
57352
- function (key) {
57353
- this.set(recipe[key], this.pick(key, obj), tgt)
57354
- }.bind(this)
57355
- )
57356
- return tgt
57357
- }
57358
-
57359
- /**
57360
- *
57361
- * Convert object to dotted-key/value pair
57362
- *
57363
- * Usage:
57364
- *
57365
- * var tgt = dot.dot(obj)
57366
- *
57367
- * or
57368
- *
57369
- * var tgt = {}
57370
- * dot.dot(obj, tgt)
57371
- *
57372
- * @param {Object} obj source object
57373
- * @param {Object} tgt target object
57374
- * @param {Array} path path array (internal)
57375
- */
57376
- DotObject.prototype.dot = function (obj, tgt, path) {
57377
- tgt = tgt || {}
57378
- path = path || []
57379
- var isArray = Array.isArray(obj)
57380
-
57381
- Object.keys(obj).forEach(
57382
- function (key) {
57383
- var index = isArray && this.useBrackets ? '[' + key + ']' : key
57384
- if (
57385
- isArrayOrObject(obj[key]) &&
57386
- ((isObject(obj[key]) && !isEmptyObject(obj[key])) ||
57387
- (Array.isArray(obj[key]) && !this.keepArray && obj[key].length !== 0))
57388
- ) {
57389
- if (isArray && this.useBrackets) {
57390
- var previousKey = path[path.length - 1] || ''
57391
- return this.dot(
57392
- obj[key],
57393
- tgt,
57394
- path.slice(0, -1).concat(previousKey + index)
57395
- )
57396
- } else {
57397
- return this.dot(obj[key], tgt, path.concat(index))
57398
- }
57399
- } else {
57400
- if (isArray && this.useBrackets) {
57401
- tgt[path.join(this.separator).concat('[' + key + ']')] = obj[key]
57402
- } else {
57403
- tgt[path.concat(index).join(this.separator)] = obj[key]
57404
- }
57405
- }
57406
- }.bind(this)
57407
- )
57408
- return tgt
57409
- }
57410
-
57411
- DotObject.pick = wrap('pick')
57412
- DotObject.move = wrap('move')
57413
- DotObject.transfer = wrap('transfer')
57414
- DotObject.transform = wrap('transform')
57415
- DotObject.copy = wrap('copy')
57416
- DotObject.object = wrap('object')
57417
- DotObject.str = wrap('str')
57418
- DotObject.set = wrap('set')
57419
- DotObject.delete = wrap('delete')
57420
- DotObject.del = DotObject.remove = wrap('remove')
57421
- DotObject.dot = wrap('dot');
57422
- ['override', 'overwrite'].forEach(function (prop) {
57423
- Object.defineProperty(DotObject, prop, {
57424
- get: function () {
57425
- return dotDefault.override
57426
- },
57427
- set: function (val) {
57428
- dotDefault.override = !!val
57429
- }
57430
- })
57431
- });
57432
- ['useArray', 'keepArray', 'useBrackets'].forEach(function (prop) {
57433
- Object.defineProperty(DotObject, prop, {
57434
- get: function () {
57435
- return dotDefault[prop]
57436
- },
57437
- set: function (val) {
57438
- dotDefault[prop] = val
57439
- }
57440
- })
57441
- })
57442
-
57443
- DotObject._process = _process
57444
-
57445
- module.exports = DotObject
57446
-
57447
-
57448
55723
  /***/ }),
57449
55724
 
57450
55725
  /***/ 1205:
@@ -57804,7 +56079,7 @@ module.exports = fill;
57804
56079
 
57805
56080
  /***/ }),
57806
56081
 
57807
- /***/ 2670:
56082
+ /***/ 6748:
57808
56083
  /***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
57809
56084
 
57810
56085
  "use strict";
@@ -74286,1152 +72561,6 @@ if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) {
74286
72561
  exports.debug = debug; // for test
74287
72562
 
74288
72563
 
74289
- /***/ }),
74290
-
74291
- /***/ 1524:
74292
- /***/ ((__unused_webpack_module, exports) => {
74293
-
74294
- "use strict";
74295
-
74296
- Object.defineProperty(exports, "__esModule", ({ value: true }));
74297
-
74298
-
74299
- /***/ }),
74300
-
74301
- /***/ 6647:
74302
- /***/ ((__unused_webpack_module, exports) => {
74303
-
74304
- "use strict";
74305
-
74306
- Object.defineProperty(exports, "__esModule", ({ value: true }));
74307
- exports.isValidErrorCode = exports.httpStatusFromErrorCode = exports.TwirpErrorCode = exports.BadRouteError = exports.InternalServerErrorWith = exports.InternalServerError = exports.RequiredArgumentError = exports.InvalidArgumentError = exports.NotFoundError = exports.TwirpError = void 0;
74308
- /**
74309
- * Represents a twirp error
74310
- */
74311
- class TwirpError extends Error {
74312
- constructor(code, msg) {
74313
- super(msg);
74314
- this.code = TwirpErrorCode.Internal;
74315
- this.meta = {};
74316
- this.code = code;
74317
- this.msg = msg;
74318
- Object.setPrototypeOf(this, TwirpError.prototype);
74319
- }
74320
- /**
74321
- * Adds a metadata kv to the error
74322
- * @param key
74323
- * @param value
74324
- */
74325
- withMeta(key, value) {
74326
- this.meta[key] = value;
74327
- return this;
74328
- }
74329
- /**
74330
- * Returns a single metadata value
74331
- * return "" if not found
74332
- * @param key
74333
- */
74334
- getMeta(key) {
74335
- return this.meta[key] || "";
74336
- }
74337
- /**
74338
- * Add the original error cause
74339
- * @param err
74340
- * @param addMeta
74341
- */
74342
- withCause(err, addMeta = false) {
74343
- this._originalCause = err;
74344
- if (addMeta) {
74345
- this.withMeta("cause", err.message);
74346
- }
74347
- return this;
74348
- }
74349
- cause() {
74350
- return this._originalCause;
74351
- }
74352
- /**
74353
- * Returns the error representation to JSON
74354
- */
74355
- toJSON() {
74356
- try {
74357
- return JSON.stringify({
74358
- code: this.code,
74359
- msg: this.msg,
74360
- meta: this.meta,
74361
- });
74362
- }
74363
- catch (e) {
74364
- return `{"code": "internal", "msg": "There was an error but it could not be serialized into JSON"}`;
74365
- }
74366
- }
74367
- /**
74368
- * Create a twirp error from an object
74369
- * @param obj
74370
- */
74371
- static fromObject(obj) {
74372
- const code = obj["code"] || TwirpErrorCode.Unknown;
74373
- const msg = obj["msg"] || "unknown";
74374
- const error = new TwirpError(code, msg);
74375
- if (obj["meta"]) {
74376
- Object.keys(obj["meta"]).forEach((key) => {
74377
- error.withMeta(key, obj["meta"][key]);
74378
- });
74379
- }
74380
- return error;
74381
- }
74382
- }
74383
- exports.TwirpError = TwirpError;
74384
- /**
74385
- * NotFoundError constructor for the common NotFound error.
74386
- */
74387
- class NotFoundError extends TwirpError {
74388
- constructor(msg) {
74389
- super(TwirpErrorCode.NotFound, msg);
74390
- }
74391
- }
74392
- exports.NotFoundError = NotFoundError;
74393
- /**
74394
- * InvalidArgumentError constructor for the common InvalidArgument error. Can be
74395
- * used when an argument has invalid format, is a number out of range, is a bad
74396
- * option, etc).
74397
- */
74398
- class InvalidArgumentError extends TwirpError {
74399
- constructor(argument, validationMsg) {
74400
- super(TwirpErrorCode.InvalidArgument, argument + " " + validationMsg);
74401
- this.withMeta("argument", argument);
74402
- }
74403
- }
74404
- exports.InvalidArgumentError = InvalidArgumentError;
74405
- /**
74406
- * RequiredArgumentError is a more specific constructor for InvalidArgument
74407
- * error. Should be used when the argument is required (expected to have a
74408
- * non-zero value).
74409
- */
74410
- class RequiredArgumentError extends InvalidArgumentError {
74411
- constructor(argument) {
74412
- super(argument, "is required");
74413
- }
74414
- }
74415
- exports.RequiredArgumentError = RequiredArgumentError;
74416
- /**
74417
- * InternalError constructor for the common Internal error. Should be used to
74418
- * specify that something bad or unexpected happened.
74419
- */
74420
- class InternalServerError extends TwirpError {
74421
- constructor(msg) {
74422
- super(TwirpErrorCode.Internal, msg);
74423
- }
74424
- }
74425
- exports.InternalServerError = InternalServerError;
74426
- /**
74427
- * InternalErrorWith makes an internal error, wrapping the original error and using it
74428
- * for the error message, and with metadata "cause" with the original error type.
74429
- * This function is used by Twirp services to wrap non-Twirp errors as internal errors.
74430
- * The wrapped error can be extracted later with err.cause()
74431
- */
74432
- class InternalServerErrorWith extends InternalServerError {
74433
- constructor(err) {
74434
- super(err.message);
74435
- this.withMeta("cause", err.name);
74436
- this.withCause(err);
74437
- }
74438
- }
74439
- exports.InternalServerErrorWith = InternalServerErrorWith;
74440
- /**
74441
- * A standard BadRoute Error
74442
- */
74443
- class BadRouteError extends TwirpError {
74444
- constructor(msg, method, url) {
74445
- super(TwirpErrorCode.BadRoute, msg);
74446
- this.withMeta("twirp_invalid_route", method + " " + url);
74447
- }
74448
- }
74449
- exports.BadRouteError = BadRouteError;
74450
- var TwirpErrorCode;
74451
- (function (TwirpErrorCode) {
74452
- // Canceled indicates the operation was cancelled (typically by the caller).
74453
- TwirpErrorCode["Canceled"] = "canceled";
74454
- // Unknown error. For example when handling errors raised by APIs that do not
74455
- // return enough error information.
74456
- TwirpErrorCode["Unknown"] = "unknown";
74457
- // InvalidArgument indicates client specified an invalid argument. It
74458
- // indicates arguments that are problematic regardless of the state of the
74459
- // system (i.e. a malformed file name, required argument, number out of range,
74460
- // etc.).
74461
- TwirpErrorCode["InvalidArgument"] = "invalid_argument";
74462
- // Malformed indicates an error occurred while decoding the client's request.
74463
- // This may mean that the message was encoded improperly, or that there is a
74464
- // disagreement in message format between the client and server.
74465
- TwirpErrorCode["Malformed"] = "malformed";
74466
- // DeadlineExceeded means operation expired before completion. For operations
74467
- // that change the state of the system, this error may be returned even if the
74468
- // operation has completed successfully (timeout).
74469
- TwirpErrorCode["DeadlineExceeded"] = "deadline_exceeded";
74470
- // NotFound means some requested entity was not found.
74471
- TwirpErrorCode["NotFound"] = "not_found";
74472
- // BadRoute means that the requested URL path wasn't routable to a Twirp
74473
- // service and method. This is returned by the generated server, and usually
74474
- // shouldn't be returned by applications. Instead, applications should use
74475
- // NotFound or Unimplemented.
74476
- TwirpErrorCode["BadRoute"] = "bad_route";
74477
- // AlreadyExists means an attempt to create an entity failed because one
74478
- // already exists.
74479
- TwirpErrorCode["AlreadyExists"] = "already_exists";
74480
- // PermissionDenied indicates the caller does not have permission to execute
74481
- // the specified operation. It must not be used if the caller cannot be
74482
- // identified (Unauthenticated).
74483
- TwirpErrorCode["PermissionDenied"] = "permission_denied";
74484
- // Unauthenticated indicates the request does not have valid authentication
74485
- // credentials for the operation.
74486
- TwirpErrorCode["Unauthenticated"] = "unauthenticated";
74487
- // ResourceExhausted indicates some resource has been exhausted, perhaps a
74488
- // per-user quota, or perhaps the entire file system is out of space.
74489
- TwirpErrorCode["ResourceExhausted"] = "resource_exhausted";
74490
- // FailedPrecondition indicates operation was rejected because the system is
74491
- // not in a state required for the operation's execution. For example, doing
74492
- // an rmdir operation on a directory that is non-empty, or on a non-directory
74493
- // object, or when having conflicting read-modify-write on the same resource.
74494
- TwirpErrorCode["FailedPrecondition"] = "failed_precondition";
74495
- // Aborted indicates the operation was aborted, typically due to a concurrency
74496
- // issue like sequencer check failures, transaction aborts, etc.
74497
- TwirpErrorCode["Aborted"] = "aborted";
74498
- // OutOfRange means operation was attempted past the valid range. For example,
74499
- // seeking or reading past end of a paginated collection.
74500
- //
74501
- // Unlike InvalidArgument, this error indicates a problem that may be fixed if
74502
- // the system state changes (i.e. adding more items to the collection).
74503
- //
74504
- // There is a fair bit of overlap between FailedPrecondition and OutOfRange.
74505
- // We recommend using OutOfRange (the more specific error) when it applies so
74506
- // that callers who are iterating through a space can easily look for an
74507
- // OutOfRange error to detect when they are done.
74508
- TwirpErrorCode["OutOfRange"] = "out_of_range";
74509
- // Unimplemented indicates operation is not implemented or not
74510
- // supported/enabled in this service.
74511
- TwirpErrorCode["Unimplemented"] = "unimplemented";
74512
- // Internal errors. When some invariants expected by the underlying system
74513
- // have been broken. In other words, something bad happened in the library or
74514
- // backend service. Do not confuse with HTTP Internal Server Error; an
74515
- // Internal error could also happen on the client code, i.e. when parsing a
74516
- // server response.
74517
- TwirpErrorCode["Internal"] = "internal";
74518
- // Unavailable indicates the service is currently unavailable. This is a most
74519
- // likely a transient condition and may be corrected by retrying with a
74520
- // backoff.
74521
- TwirpErrorCode["Unavailable"] = "unavailable";
74522
- // DataLoss indicates unrecoverable data loss or corruption.
74523
- TwirpErrorCode["DataLoss"] = "data_loss";
74524
- })(TwirpErrorCode = exports.TwirpErrorCode || (exports.TwirpErrorCode = {}));
74525
- // ServerHTTPStatusFromErrorCode maps a Twirp error type into a similar HTTP
74526
- // response status. It is used by the Twirp server handler to set the HTTP
74527
- // response status code. Returns 0 if the ErrorCode is invalid.
74528
- function httpStatusFromErrorCode(code) {
74529
- switch (code) {
74530
- case TwirpErrorCode.Canceled:
74531
- return 408; // RequestTimeout
74532
- case TwirpErrorCode.Unknown:
74533
- return 500; // Internal Server Error
74534
- case TwirpErrorCode.InvalidArgument:
74535
- return 400; // BadRequest
74536
- case TwirpErrorCode.Malformed:
74537
- return 400; // BadRequest
74538
- case TwirpErrorCode.DeadlineExceeded:
74539
- return 408; // RequestTimeout
74540
- case TwirpErrorCode.NotFound:
74541
- return 404; // Not Found
74542
- case TwirpErrorCode.BadRoute:
74543
- return 404; // Not Found
74544
- case TwirpErrorCode.AlreadyExists:
74545
- return 409; // Conflict
74546
- case TwirpErrorCode.PermissionDenied:
74547
- return 403; // Forbidden
74548
- case TwirpErrorCode.Unauthenticated:
74549
- return 401; // Unauthorized
74550
- case TwirpErrorCode.ResourceExhausted:
74551
- return 429; // Too Many Requests
74552
- case TwirpErrorCode.FailedPrecondition:
74553
- return 412; // Precondition Failed
74554
- case TwirpErrorCode.Aborted:
74555
- return 409; // Conflict
74556
- case TwirpErrorCode.OutOfRange:
74557
- return 400; // Bad Request
74558
- case TwirpErrorCode.Unimplemented:
74559
- return 501; // Not Implemented
74560
- case TwirpErrorCode.Internal:
74561
- return 500; // Internal Server Error
74562
- case TwirpErrorCode.Unavailable:
74563
- return 503; // Service Unavailable
74564
- case TwirpErrorCode.DataLoss:
74565
- return 500; // Internal Server Error
74566
- default:
74567
- return 0; // Invalid!
74568
- }
74569
- }
74570
- exports.httpStatusFromErrorCode = httpStatusFromErrorCode;
74571
- // IsValidErrorCode returns true if is one of the valid predefined constants.
74572
- function isValidErrorCode(code) {
74573
- return httpStatusFromErrorCode(code) != 0;
74574
- }
74575
- exports.isValidErrorCode = isValidErrorCode;
74576
-
74577
-
74578
- /***/ }),
74579
-
74580
- /***/ 6748:
74581
- /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
74582
-
74583
- "use strict";
74584
-
74585
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
74586
- if (k2 === undefined) k2 = k;
74587
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
74588
- }) : (function(o, m, k, k2) {
74589
- if (k2 === undefined) k2 = k;
74590
- o[k2] = m[k];
74591
- }));
74592
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
74593
- Object.defineProperty(o, "default", { enumerable: true, value: v });
74594
- }) : function(o, v) {
74595
- o["default"] = v;
74596
- });
74597
- var __importStar = (this && this.__importStar) || function (mod) {
74598
- if (mod && mod.__esModule) return mod;
74599
- var result = {};
74600
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
74601
- __setModuleDefault(result, mod);
74602
- return result;
74603
- };
74604
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
74605
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
74606
- return new (P || (P = Promise))(function (resolve, reject) {
74607
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
74608
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
74609
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
74610
- step((generator = generator.apply(thisArg, _arguments || [])).next());
74611
- });
74612
- };
74613
- var __rest = (this && this.__rest) || function (s, e) {
74614
- var t = {};
74615
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
74616
- t[p] = s[p];
74617
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
74618
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
74619
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
74620
- t[p[i]] = s[p[i]];
74621
- }
74622
- return t;
74623
- };
74624
- Object.defineProperty(exports, "__esModule", ({ value: true }));
74625
- exports.Gateway = exports.Pattern = void 0;
74626
- const querystring_1 = __nccwpck_require__(3477);
74627
- const dotObject = __importStar(__nccwpck_require__(4365));
74628
- const request_1 = __nccwpck_require__(8347);
74629
- const errors_1 = __nccwpck_require__(6647);
74630
- const http_client_1 = __nccwpck_require__(4091);
74631
- const server_1 = __nccwpck_require__(6604);
74632
- var Pattern;
74633
- (function (Pattern) {
74634
- Pattern["POST"] = "post";
74635
- Pattern["GET"] = "get";
74636
- Pattern["PATCH"] = "patch";
74637
- Pattern["PUT"] = "put";
74638
- Pattern["DELETE"] = "delete";
74639
- })(Pattern = exports.Pattern || (exports.Pattern = {}));
74640
- /**
74641
- * The Gateway proxies http requests to Twirp Compliant
74642
- * handlers
74643
- */
74644
- class Gateway {
74645
- constructor(routes) {
74646
- this.routes = routes;
74647
- }
74648
- /**
74649
- * Middleware that rewrite the current request
74650
- * to a Twirp compliant request
74651
- */
74652
- twirpRewrite(prefix = "/twirp") {
74653
- return (req, resp, next) => {
74654
- this.rewrite(req, resp, prefix)
74655
- .then(() => next())
74656
- .catch((e) => {
74657
- if (e instanceof errors_1.TwirpError) {
74658
- if (e.code !== errors_1.TwirpErrorCode.NotFound) {
74659
- server_1.writeError(resp, e);
74660
- }
74661
- else {
74662
- next();
74663
- }
74664
- }
74665
- });
74666
- };
74667
- }
74668
- /**
74669
- * Rewrite an incoming request to a Twirp compliant request
74670
- * @param req
74671
- * @param resp
74672
- * @param prefix
74673
- */
74674
- rewrite(req, resp, prefix = "/twirp") {
74675
- return __awaiter(this, void 0, void 0, function* () {
74676
- const [match, route] = this.matchRoute(req);
74677
- const body = yield this.prepareTwirpBody(req, match, route);
74678
- const twirpUrl = `${prefix}/${route.packageName}.${route.serviceName}/${route.methodName}`;
74679
- req.url = twirpUrl;
74680
- req.originalUrl = twirpUrl;
74681
- req.method = "POST";
74682
- req.headers["content-type"] = "application/json";
74683
- req.rawBody = Buffer.from(JSON.stringify(body));
74684
- if (route.responseBodyKey) {
74685
- const endFn = resp.end.bind(resp);
74686
- resp.end = function (chunk) {
74687
- if (resp.statusCode === 200) {
74688
- endFn(`{ "${route.responseBodyKey}": ${chunk} }`);
74689
- }
74690
- else {
74691
- endFn(chunk);
74692
- }
74693
- };
74694
- }
74695
- });
74696
- }
74697
- /**
74698
- * Create a reverse proxy handler to
74699
- * proxy http requests to Twirp Compliant handlers
74700
- * @param httpClientOption
74701
- */
74702
- reverseProxy(httpClientOption) {
74703
- const client = http_client_1.NodeHttpRPC(httpClientOption);
74704
- return (req, res) => __awaiter(this, void 0, void 0, function* () {
74705
- try {
74706
- const [match, route] = this.matchRoute(req);
74707
- const body = yield this.prepareTwirpBody(req, match, route);
74708
- const response = yield client.request(`${route.packageName}.${route.serviceName}`, route.methodName, "application/json", body);
74709
- res.statusCode = 200;
74710
- res.setHeader("content-type", "application/json");
74711
- let jsonResponse;
74712
- if (route.responseBodyKey) {
74713
- jsonResponse = JSON.stringify({ [route.responseBodyKey]: response });
74714
- }
74715
- else {
74716
- jsonResponse = JSON.stringify(response);
74717
- }
74718
- res.end(jsonResponse);
74719
- }
74720
- catch (e) {
74721
- server_1.writeError(res, e);
74722
- }
74723
- });
74724
- }
74725
- /**
74726
- * Prepares twirp body requests using http.google.annotions
74727
- * compliant spec
74728
- *
74729
- * @param req
74730
- * @param match
74731
- * @param route
74732
- * @protected
74733
- */
74734
- prepareTwirpBody(req, match, route) {
74735
- return __awaiter(this, void 0, void 0, function* () {
74736
- const _a = match.params, { query_string } = _a, params = __rest(_a, ["query_string"]);
74737
- let requestBody = Object.assign({}, params);
74738
- if (query_string && route.bodyKey !== "*") {
74739
- const queryParams = this.parseQueryString(query_string);
74740
- requestBody = Object.assign(Object.assign({}, queryParams), requestBody);
74741
- }
74742
- let body = {};
74743
- if (route.bodyKey) {
74744
- const data = yield request_1.getRequestData(req);
74745
- try {
74746
- const jsonBody = JSON.parse(data.toString() || "{}");
74747
- if (route.bodyKey === "*") {
74748
- body = jsonBody;
74749
- }
74750
- else {
74751
- body[route.bodyKey] = jsonBody;
74752
- }
74753
- }
74754
- catch (e) {
74755
- const msg = "the json request could not be decoded";
74756
- throw new errors_1.TwirpError(errors_1.TwirpErrorCode.Malformed, msg).withCause(e, true);
74757
- }
74758
- }
74759
- return Object.assign(Object.assign({}, body), requestBody);
74760
- });
74761
- }
74762
- /**
74763
- * Matches a route
74764
- * @param req
74765
- */
74766
- matchRoute(req) {
74767
- var _a;
74768
- const httpMethod = (_a = req.method) === null || _a === void 0 ? void 0 : _a.toLowerCase();
74769
- if (!httpMethod) {
74770
- throw new errors_1.BadRouteError(`method not allowed`, req.method || "", req.url || "");
74771
- }
74772
- const routes = this.routes[httpMethod];
74773
- for (const route of routes) {
74774
- const match = route.matcher(req.url || "/");
74775
- if (match) {
74776
- return [match, route];
74777
- }
74778
- }
74779
- throw new errors_1.NotFoundError(`url ${req.url} not found`);
74780
- }
74781
- /**
74782
- * Parse query string
74783
- * @param queryString
74784
- */
74785
- parseQueryString(queryString) {
74786
- const queryParams = querystring_1.parse(queryString.replace("?", ""));
74787
- return dotObject.object(queryParams);
74788
- }
74789
- }
74790
- exports.Gateway = Gateway;
74791
-
74792
-
74793
- /***/ }),
74794
-
74795
- /***/ 4263:
74796
- /***/ (function(__unused_webpack_module, exports) {
74797
-
74798
- "use strict";
74799
-
74800
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
74801
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
74802
- return new (P || (P = Promise))(function (resolve, reject) {
74803
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
74804
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
74805
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
74806
- step((generator = generator.apply(thisArg, _arguments || [])).next());
74807
- });
74808
- };
74809
- Object.defineProperty(exports, "__esModule", ({ value: true }));
74810
- exports.isHook = exports.chainHooks = void 0;
74811
- // ChainHooks creates a new ServerHook which chains the callbacks in
74812
- // each of the constituent hooks passed in. Each hook function will be
74813
- // called in the order of the ServerHooks values passed in.
74814
- //
74815
- // For the erroring hooks, RequestReceived and RequestRouted, any returned
74816
- // errors prevent processing by later hooks.
74817
- function chainHooks(...hooks) {
74818
- if (hooks.length === 0) {
74819
- return null;
74820
- }
74821
- if (hooks.length === 1) {
74822
- return hooks[0];
74823
- }
74824
- const serverHook = {
74825
- requestReceived(ctx) {
74826
- return __awaiter(this, void 0, void 0, function* () {
74827
- for (const hook of hooks) {
74828
- if (!hook.requestReceived) {
74829
- continue;
74830
- }
74831
- yield hook.requestReceived(ctx);
74832
- }
74833
- });
74834
- },
74835
- requestPrepared(ctx) {
74836
- return __awaiter(this, void 0, void 0, function* () {
74837
- for (const hook of hooks) {
74838
- if (!hook.requestPrepared) {
74839
- continue;
74840
- }
74841
- console.warn("hook requestPrepared is deprecated and will be removed in the next release. " +
74842
- "Please use responsePrepared instead.");
74843
- yield hook.requestPrepared(ctx);
74844
- }
74845
- });
74846
- },
74847
- responsePrepared(ctx) {
74848
- return __awaiter(this, void 0, void 0, function* () {
74849
- for (const hook of hooks) {
74850
- if (!hook.responsePrepared) {
74851
- continue;
74852
- }
74853
- yield hook.responsePrepared(ctx);
74854
- }
74855
- });
74856
- },
74857
- requestSent(ctx) {
74858
- return __awaiter(this, void 0, void 0, function* () {
74859
- for (const hook of hooks) {
74860
- if (!hook.requestSent) {
74861
- continue;
74862
- }
74863
- console.warn("hook requestSent is deprecated and will be removed in the next release. " +
74864
- "Please use responseSent instead.");
74865
- yield hook.requestSent(ctx);
74866
- }
74867
- });
74868
- },
74869
- responseSent(ctx) {
74870
- return __awaiter(this, void 0, void 0, function* () {
74871
- for (const hook of hooks) {
74872
- if (!hook.responseSent) {
74873
- continue;
74874
- }
74875
- yield hook.responseSent(ctx);
74876
- }
74877
- });
74878
- },
74879
- requestRouted(ctx) {
74880
- return __awaiter(this, void 0, void 0, function* () {
74881
- for (const hook of hooks) {
74882
- if (!hook.requestRouted) {
74883
- continue;
74884
- }
74885
- yield hook.requestRouted(ctx);
74886
- }
74887
- });
74888
- },
74889
- error(ctx, err) {
74890
- return __awaiter(this, void 0, void 0, function* () {
74891
- for (const hook of hooks) {
74892
- if (!hook.error) {
74893
- continue;
74894
- }
74895
- yield hook.error(ctx, err);
74896
- }
74897
- });
74898
- },
74899
- };
74900
- return serverHook;
74901
- }
74902
- exports.chainHooks = chainHooks;
74903
- function isHook(object) {
74904
- return ("requestReceived" in object ||
74905
- "requestPrepared" in object ||
74906
- "requestSent" in object ||
74907
- "requestRouted" in object ||
74908
- "responsePrepared" in object ||
74909
- "responseSent" in object ||
74910
- "error" in object);
74911
- }
74912
- exports.isHook = isHook;
74913
-
74914
-
74915
- /***/ }),
74916
-
74917
- /***/ 4091:
74918
- /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
74919
-
74920
- "use strict";
74921
-
74922
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
74923
- if (k2 === undefined) k2 = k;
74924
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
74925
- }) : (function(o, m, k, k2) {
74926
- if (k2 === undefined) k2 = k;
74927
- o[k2] = m[k];
74928
- }));
74929
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
74930
- Object.defineProperty(o, "default", { enumerable: true, value: v });
74931
- }) : function(o, v) {
74932
- o["default"] = v;
74933
- });
74934
- var __importStar = (this && this.__importStar) || function (mod) {
74935
- if (mod && mod.__esModule) return mod;
74936
- var result = {};
74937
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
74938
- __setModuleDefault(result, mod);
74939
- return result;
74940
- };
74941
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
74942
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
74943
- return new (P || (P = Promise))(function (resolve, reject) {
74944
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
74945
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
74946
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
74947
- step((generator = generator.apply(thisArg, _arguments || [])).next());
74948
- });
74949
- };
74950
- Object.defineProperty(exports, "__esModule", ({ value: true }));
74951
- exports.FetchRPC = exports.wrapErrorResponseToTwirpError = exports.NodeHttpRPC = void 0;
74952
- const http = __importStar(__nccwpck_require__(3685));
74953
- const https = __importStar(__nccwpck_require__(5687));
74954
- const url_1 = __nccwpck_require__(7310);
74955
- const errors_1 = __nccwpck_require__(6647);
74956
- /**
74957
- * a node HTTP RPC implementation
74958
- * @param options
74959
- * @constructor
74960
- */
74961
- const NodeHttpRPC = (options) => ({
74962
- request(service, method, contentType, data) {
74963
- let client;
74964
- return new Promise((resolve, rejected) => {
74965
- const responseChunks = [];
74966
- const requestData = contentType === "application/protobuf"
74967
- ? Buffer.from(data)
74968
- : JSON.stringify(data);
74969
- const url = new url_1.URL(options.baseUrl);
74970
- const isHttps = url.protocol === "https:";
74971
- if (isHttps) {
74972
- client = https;
74973
- }
74974
- else {
74975
- client = http;
74976
- }
74977
- const prefix = url.pathname !== "/" ? url.pathname : "";
74978
- const req = client
74979
- .request(Object.assign(Object.assign({}, (options ? options : {})), { method: "POST", protocol: url.protocol, host: url.hostname, port: url.port ? url.port : isHttps ? 443 : 80, path: `${prefix}/${service}/${method}`, headers: Object.assign(Object.assign({}, (options.headers ? options.headers : {})), { "Content-Type": contentType, "Content-Length": contentType === "application/protobuf"
74980
- ? Buffer.byteLength(requestData)
74981
- : Buffer.from(requestData).byteLength }) }), (res) => {
74982
- res.on("data", (chunk) => responseChunks.push(chunk));
74983
- res.on("end", () => {
74984
- const data = Buffer.concat(responseChunks);
74985
- if (res.statusCode != 200) {
74986
- rejected(wrapErrorResponseToTwirpError(data.toString()));
74987
- }
74988
- else {
74989
- if (contentType === "application/json") {
74990
- resolve(JSON.parse(data.toString()));
74991
- }
74992
- else {
74993
- resolve(data);
74994
- }
74995
- }
74996
- });
74997
- res.on("error", (err) => {
74998
- rejected(err);
74999
- });
75000
- })
75001
- .on("error", (err) => {
75002
- rejected(err);
75003
- });
75004
- req.end(requestData);
75005
- });
75006
- },
75007
- });
75008
- exports.NodeHttpRPC = NodeHttpRPC;
75009
- function wrapErrorResponseToTwirpError(errorResponse) {
75010
- return errors_1.TwirpError.fromObject(JSON.parse(errorResponse));
75011
- }
75012
- exports.wrapErrorResponseToTwirpError = wrapErrorResponseToTwirpError;
75013
- /**
75014
- * a browser fetch RPC implementation
75015
- */
75016
- const FetchRPC = (options) => ({
75017
- request(service, method, contentType, data) {
75018
- return __awaiter(this, void 0, void 0, function* () {
75019
- const headers = new Headers(options.headers);
75020
- headers.set("content-type", contentType);
75021
- const response = yield fetch(`${options.baseUrl}/${service}/${method}`, Object.assign(Object.assign({}, options), { method: "POST", headers, body: data instanceof Uint8Array ? data : JSON.stringify(data) }));
75022
- if (response.status === 200) {
75023
- if (contentType === "application/json") {
75024
- return yield response.json();
75025
- }
75026
- return new Uint8Array(yield response.arrayBuffer());
75027
- }
75028
- throw errors_1.TwirpError.fromObject(yield response.json());
75029
- });
75030
- },
75031
- });
75032
- exports.FetchRPC = FetchRPC;
75033
-
75034
-
75035
- /***/ }),
75036
-
75037
- /***/ 6465:
75038
- /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
75039
-
75040
- "use strict";
75041
-
75042
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
75043
- if (k2 === undefined) k2 = k;
75044
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
75045
- }) : (function(o, m, k, k2) {
75046
- if (k2 === undefined) k2 = k;
75047
- o[k2] = m[k];
75048
- }));
75049
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
75050
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
75051
- };
75052
- Object.defineProperty(exports, "__esModule", ({ value: true }));
75053
- exports.TwirpContentType = void 0;
75054
- __exportStar(__nccwpck_require__(1524), exports);
75055
- __exportStar(__nccwpck_require__(6604), exports);
75056
- __exportStar(__nccwpck_require__(8913), exports);
75057
- __exportStar(__nccwpck_require__(4263), exports);
75058
- __exportStar(__nccwpck_require__(6647), exports);
75059
- __exportStar(__nccwpck_require__(6748), exports);
75060
- __exportStar(__nccwpck_require__(4091), exports);
75061
- var request_1 = __nccwpck_require__(8347);
75062
- Object.defineProperty(exports, "TwirpContentType", ({ enumerable: true, get: function () { return request_1.TwirpContentType; } }));
75063
-
75064
-
75065
- /***/ }),
75066
-
75067
- /***/ 8913:
75068
- /***/ (function(__unused_webpack_module, exports) {
75069
-
75070
- "use strict";
75071
-
75072
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
75073
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
75074
- return new (P || (P = Promise))(function (resolve, reject) {
75075
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
75076
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
75077
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
75078
- step((generator = generator.apply(thisArg, _arguments || [])).next());
75079
- });
75080
- };
75081
- Object.defineProperty(exports, "__esModule", ({ value: true }));
75082
- exports.chainInterceptors = void 0;
75083
- // chains multiple Interceptors into a single Interceptor.
75084
- // The first interceptor wraps the second one, and so on.
75085
- // Returns null if interceptors is empty.
75086
- function chainInterceptors(...interceptors) {
75087
- if (interceptors.length === 0) {
75088
- return;
75089
- }
75090
- if (interceptors.length === 1) {
75091
- return interceptors[0];
75092
- }
75093
- const first = interceptors[0];
75094
- return (ctx, request, handler) => __awaiter(this, void 0, void 0, function* () {
75095
- let next = handler;
75096
- for (let i = interceptors.length - 1; i > 0; i--) {
75097
- next = ((next) => (ctx, typedRequest) => {
75098
- return interceptors[i](ctx, typedRequest, next);
75099
- })(next);
75100
- }
75101
- return first(ctx, request, next);
75102
- });
75103
- }
75104
- exports.chainInterceptors = chainInterceptors;
75105
-
75106
-
75107
- /***/ }),
75108
-
75109
- /***/ 8347:
75110
- /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
75111
-
75112
- "use strict";
75113
-
75114
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
75115
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
75116
- return new (P || (P = Promise))(function (resolve, reject) {
75117
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
75118
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
75119
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
75120
- step((generator = generator.apply(thisArg, _arguments || [])).next());
75121
- });
75122
- };
75123
- Object.defineProperty(exports, "__esModule", ({ value: true }));
75124
- exports.parseTwirpPath = exports.getRequestData = exports.validateRequest = exports.getContentType = exports.TwirpContentType = void 0;
75125
- const errors_1 = __nccwpck_require__(6647);
75126
- /**
75127
- * Supported Twirp Content-Type
75128
- */
75129
- var TwirpContentType;
75130
- (function (TwirpContentType) {
75131
- TwirpContentType[TwirpContentType["Protobuf"] = 0] = "Protobuf";
75132
- TwirpContentType[TwirpContentType["JSON"] = 1] = "JSON";
75133
- TwirpContentType[TwirpContentType["Unknown"] = 2] = "Unknown";
75134
- })(TwirpContentType = exports.TwirpContentType || (exports.TwirpContentType = {}));
75135
- /**
75136
- * Get supported content-type
75137
- * @param mimeType
75138
- */
75139
- function getContentType(mimeType) {
75140
- switch (mimeType) {
75141
- case "application/protobuf":
75142
- return TwirpContentType.Protobuf;
75143
- case "application/json":
75144
- return TwirpContentType.JSON;
75145
- default:
75146
- return TwirpContentType.Unknown;
75147
- }
75148
- }
75149
- exports.getContentType = getContentType;
75150
- /**
75151
- * Validate a twirp request
75152
- * @param ctx
75153
- * @param request
75154
- * @param pathPrefix
75155
- */
75156
- function validateRequest(ctx, request, pathPrefix) {
75157
- if (request.method !== "POST") {
75158
- const msg = `unsupported method ${request.method} (only POST is allowed)`;
75159
- throw new errors_1.BadRouteError(msg, request.method || "", request.url || "");
75160
- }
75161
- const path = parseTwirpPath(request.url || "");
75162
- if (path.pkgService !==
75163
- (ctx.packageName ? ctx.packageName + "." : "") + ctx.serviceName) {
75164
- const msg = `no handler for path ${request.url}`;
75165
- throw new errors_1.BadRouteError(msg, request.method || "", request.url || "");
75166
- }
75167
- if (path.prefix !== pathPrefix) {
75168
- const msg = `invalid path prefix ${path.prefix}, expected ${pathPrefix}, on path ${request.url}`;
75169
- throw new errors_1.BadRouteError(msg, request.method || "", request.url || "");
75170
- }
75171
- const mimeContentType = request.headers["content-type"] || "";
75172
- if (ctx.contentType === TwirpContentType.Unknown) {
75173
- const msg = `unexpected Content-Type: ${request.headers["content-type"]}`;
75174
- throw new errors_1.BadRouteError(msg, request.method || "", request.url || "");
75175
- }
75176
- return Object.assign(Object.assign({}, path), { mimeContentType, contentType: ctx.contentType });
75177
- }
75178
- exports.validateRequest = validateRequest;
75179
- /**
75180
- * Get request data from the body
75181
- * @param req
75182
- */
75183
- function getRequestData(req) {
75184
- return new Promise((resolve, reject) => {
75185
- const reqWithRawBody = req;
75186
- if (reqWithRawBody.rawBody instanceof Buffer) {
75187
- resolve(reqWithRawBody.rawBody);
75188
- return;
75189
- }
75190
- const chunks = [];
75191
- req.on("data", (chunk) => chunks.push(chunk));
75192
- req.on("end", () => __awaiter(this, void 0, void 0, function* () {
75193
- const data = Buffer.concat(chunks);
75194
- resolve(data);
75195
- }));
75196
- req.on("error", (err) => {
75197
- if (req.aborted) {
75198
- reject(new errors_1.TwirpError(errors_1.TwirpErrorCode.DeadlineExceeded, "failed to read request: deadline exceeded"));
75199
- }
75200
- else {
75201
- reject(new errors_1.TwirpError(errors_1.TwirpErrorCode.Malformed, err.message).withCause(err));
75202
- }
75203
- });
75204
- req.on("close", () => {
75205
- reject(new errors_1.TwirpError(errors_1.TwirpErrorCode.Canceled, "failed to read request: context canceled"));
75206
- });
75207
- });
75208
- }
75209
- exports.getRequestData = getRequestData;
75210
- /**
75211
- * Parses twirp url path
75212
- * @param path
75213
- */
75214
- function parseTwirpPath(path) {
75215
- const parts = path.split("/");
75216
- if (parts.length < 2) {
75217
- return {
75218
- pkgService: "",
75219
- method: "",
75220
- prefix: "",
75221
- };
75222
- }
75223
- return {
75224
- method: parts[parts.length - 1],
75225
- pkgService: parts[parts.length - 2],
75226
- prefix: parts.slice(0, parts.length - 2).join("/"),
75227
- };
75228
- }
75229
- exports.parseTwirpPath = parseTwirpPath;
75230
-
75231
-
75232
- /***/ }),
75233
-
75234
- /***/ 6604:
75235
- /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
75236
-
75237
- "use strict";
75238
-
75239
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
75240
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
75241
- return new (P || (P = Promise))(function (resolve, reject) {
75242
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
75243
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
75244
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
75245
- step((generator = generator.apply(thisArg, _arguments || [])).next());
75246
- });
75247
- };
75248
- Object.defineProperty(exports, "__esModule", ({ value: true }));
75249
- exports.writeError = exports.TwirpServer = void 0;
75250
- const hooks_1 = __nccwpck_require__(4263);
75251
- const request_1 = __nccwpck_require__(8347);
75252
- const errors_1 = __nccwpck_require__(6647);
75253
- /**
75254
- * Runtime server implementation of a TwirpServer
75255
- */
75256
- class TwirpServer {
75257
- constructor(options) {
75258
- this.pathPrefix = "/twirp";
75259
- this.hooks = [];
75260
- this.interceptors = [];
75261
- this.packageName = options.packageName;
75262
- this.serviceName = options.serviceName;
75263
- this.methodList = options.methodList;
75264
- this.matchRoute = options.matchRoute;
75265
- this.service = options.service;
75266
- }
75267
- /**
75268
- * Returns the prefix for this server
75269
- */
75270
- get prefix() {
75271
- return this.pathPrefix;
75272
- }
75273
- /**
75274
- * The http handler for twirp complaint endpoints
75275
- * @param options
75276
- */
75277
- httpHandler(options) {
75278
- return (req, resp) => {
75279
- // setup prefix
75280
- if ((options === null || options === void 0 ? void 0 : options.prefix) !== undefined) {
75281
- this.withPrefix(options.prefix);
75282
- }
75283
- return this._httpHandler(req, resp);
75284
- };
75285
- }
75286
- /**
75287
- * Adds interceptors or hooks to the request stack
75288
- * @param middlewares
75289
- */
75290
- use(...middlewares) {
75291
- middlewares.forEach((middleware) => {
75292
- if (hooks_1.isHook(middleware)) {
75293
- this.hooks.push(middleware);
75294
- return this;
75295
- }
75296
- this.interceptors.push(middleware);
75297
- });
75298
- return this;
75299
- }
75300
- /**
75301
- * Adds a prefix to the service url path
75302
- * @param prefix
75303
- */
75304
- withPrefix(prefix) {
75305
- if (prefix === false) {
75306
- this.pathPrefix = "";
75307
- }
75308
- else {
75309
- this.pathPrefix = prefix;
75310
- }
75311
- return this;
75312
- }
75313
- /**
75314
- * Returns the regex matching path for this twirp server
75315
- */
75316
- matchingPath() {
75317
- const baseRegex = this.baseURI().replace(/\./g, "\\.");
75318
- return new RegExp(`${baseRegex}\/(${this.methodList.join("|")})`);
75319
- }
75320
- /**
75321
- * Returns the base URI for this twirp server
75322
- */
75323
- baseURI() {
75324
- return `${this.pathPrefix}/${this.packageName ? this.packageName + "." : ""}${this.serviceName}`;
75325
- }
75326
- /**
75327
- * Create a twirp context
75328
- * @param req
75329
- * @param res
75330
- * @private
75331
- */
75332
- createContext(req, res) {
75333
- return {
75334
- packageName: this.packageName,
75335
- serviceName: this.serviceName,
75336
- methodName: "",
75337
- contentType: request_1.getContentType(req.headers["content-type"]),
75338
- req: req,
75339
- res: res,
75340
- };
75341
- }
75342
- /**
75343
- * Twrip server http handler implementation
75344
- * @param req
75345
- * @param resp
75346
- * @private
75347
- */
75348
- _httpHandler(req, resp) {
75349
- return __awaiter(this, void 0, void 0, function* () {
75350
- const ctx = this.createContext(req, resp);
75351
- try {
75352
- yield this.invokeHook("requestReceived", ctx);
75353
- const { method, mimeContentType } = request_1.validateRequest(ctx, req, this.pathPrefix || "");
75354
- const handler = this.matchRoute(method, {
75355
- onMatch: (ctx) => {
75356
- return this.invokeHook("requestRouted", ctx);
75357
- },
75358
- onNotFound: () => {
75359
- const msg = `no handler for path ${req.url}`;
75360
- throw new errors_1.BadRouteError(msg, req.method || "", req.url || "");
75361
- },
75362
- });
75363
- const body = yield request_1.getRequestData(req);
75364
- const response = yield handler(ctx, this.service, body, this.interceptors);
75365
- yield Promise.all([
75366
- this.invokeHook("responsePrepared", ctx),
75367
- // keep backwards compatibility till next release
75368
- this.invokeHook("requestPrepared", ctx),
75369
- ]);
75370
- resp.statusCode = 200;
75371
- resp.setHeader("Content-Type", mimeContentType);
75372
- resp.end(response);
75373
- }
75374
- catch (e) {
75375
- yield this.invokeHook("error", ctx, mustBeTwirpError(e));
75376
- if (!resp.headersSent) {
75377
- writeError(resp, e);
75378
- }
75379
- }
75380
- finally {
75381
- yield Promise.all([
75382
- this.invokeHook("responseSent", ctx),
75383
- // keep backwards compatibility till next release
75384
- this.invokeHook("requestSent", ctx),
75385
- ]);
75386
- }
75387
- });
75388
- }
75389
- /**
75390
- * Invoke a hook
75391
- * @param hookName
75392
- * @param ctx
75393
- * @param err
75394
- * @protected
75395
- */
75396
- invokeHook(hookName, ctx, err) {
75397
- return __awaiter(this, void 0, void 0, function* () {
75398
- if (this.hooks.length === 0) {
75399
- return;
75400
- }
75401
- const chainedHooks = hooks_1.chainHooks(...this.hooks);
75402
- const hook = chainedHooks === null || chainedHooks === void 0 ? void 0 : chainedHooks[hookName];
75403
- if (hook) {
75404
- yield hook(ctx, err || new errors_1.InternalServerError("internal server error"));
75405
- }
75406
- });
75407
- }
75408
- }
75409
- exports.TwirpServer = TwirpServer;
75410
- /**
75411
- * Write http error response
75412
- * @param res
75413
- * @param error
75414
- */
75415
- function writeError(res, error) {
75416
- const twirpError = mustBeTwirpError(error);
75417
- res.setHeader("Content-Type", "application/json");
75418
- res.statusCode = errors_1.httpStatusFromErrorCode(twirpError.code);
75419
- res.end(twirpError.toJSON());
75420
- }
75421
- exports.writeError = writeError;
75422
- /**
75423
- * Make sure that the error passed is a TwirpError
75424
- * otherwise it will wrap it into an InternalError
75425
- * @param err
75426
- */
75427
- function mustBeTwirpError(err) {
75428
- if (err instanceof errors_1.TwirpError) {
75429
- return err;
75430
- }
75431
- return new errors_1.InternalServerErrorWith(err);
75432
- }
75433
-
75434
-
75435
72564
  /***/ }),
75436
72565
 
75437
72566
  /***/ 1773:
@@ -83494,6 +80623,14 @@ const { isUint8Array, isArrayBuffer } = __nccwpck_require__(9830)
83494
80623
  const { File: UndiciFile } = __nccwpck_require__(8511)
83495
80624
  const { parseMIMEType, serializeAMimeType } = __nccwpck_require__(685)
83496
80625
 
80626
+ let random
80627
+ try {
80628
+ const crypto = __nccwpck_require__(6005)
80629
+ random = (max) => crypto.randomInt(0, max)
80630
+ } catch {
80631
+ random = (max) => Math.floor(Math.random(max))
80632
+ }
80633
+
83497
80634
  let ReadableStream = globalThis.ReadableStream
83498
80635
 
83499
80636
  /** @type {globalThis['File']} */
@@ -83579,7 +80716,7 @@ function extractBody (object, keepalive = false) {
83579
80716
  // Set source to a copy of the bytes held by object.
83580
80717
  source = new Uint8Array(object.buffer.slice(object.byteOffset, object.byteOffset + object.byteLength))
83581
80718
  } else if (util.isFormDataLike(object)) {
83582
- const boundary = `----formdata-undici-0${`${Math.floor(Math.random() * 1e11)}`.padStart(11, '0')}`
80719
+ const boundary = `----formdata-undici-0${`${random(1e11)}`.padStart(11, '0')}`
83583
80720
  const prefix = `--${boundary}\r\nContent-Disposition: form-data`
83584
80721
 
83585
80722
  /*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */
@@ -104835,6 +101972,14 @@ module.exports = require("net");
104835
101972
 
104836
101973
  /***/ }),
104837
101974
 
101975
+ /***/ 6005:
101976
+ /***/ ((module) => {
101977
+
101978
+ "use strict";
101979
+ module.exports = require("node:crypto");
101980
+
101981
+ /***/ }),
101982
+
104838
101983
  /***/ 5673:
104839
101984
  /***/ ((module) => {
104840
101985
 
@@ -106822,7 +103967,7 @@ const supportsColor = {
106822
103967
  /***/ ((module) => {
106823
103968
 
106824
103969
  "use strict";
106825
- module.exports = JSON.parse('{"name":"@actions/cache","version":"4.0.0","preview":true,"description":"Actions cache lib","keywords":["github","actions","cache"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/cache","license":"MIT","main":"lib/cache.js","types":"lib/cache.d.ts","directories":{"lib":"lib","test":"__tests__"},"files":["lib","!.DS_Store"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/actions/toolkit.git","directory":"packages/cache"},"scripts":{"audit-moderate":"npm install && npm audit --json --audit-level=moderate > audit.json","test":"echo \\"Error: run tests from root\\" && exit 1","tsc":"tsc"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^1.11.1","@actions/exec":"^1.0.1","@actions/glob":"^0.1.0","@actions/http-client":"^2.1.1","@actions/io":"^1.0.1","@azure/abort-controller":"^1.1.0","@azure/ms-rest-js":"^2.6.0","@azure/storage-blob":"^12.13.0","@protobuf-ts/plugin":"^2.9.4","semver":"^6.3.1","twirp-ts":"^2.5.0"},"devDependencies":{"@types/semver":"^6.0.0","typescript":"^5.2.2"}}');
103970
+ module.exports = JSON.parse('{"name":"@actions/cache","version":"4.0.1","preview":true,"description":"Actions cache lib","keywords":["github","actions","cache"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/cache","license":"MIT","main":"lib/cache.js","types":"lib/cache.d.ts","directories":{"lib":"lib","test":"__tests__"},"files":["lib","!.DS_Store"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/actions/toolkit.git","directory":"packages/cache"},"scripts":{"audit-moderate":"npm install && npm audit --json --audit-level=moderate > audit.json","test":"echo \\"Error: run tests from root\\" && exit 1","tsc":"tsc"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^1.11.1","@actions/exec":"^1.0.1","@actions/glob":"^0.1.0","@actions/http-client":"^2.1.1","@actions/io":"^1.0.1","@azure/abort-controller":"^1.1.0","@azure/ms-rest-js":"^2.6.0","@azure/storage-blob":"^12.13.0","@protobuf-ts/plugin":"^2.9.4","semver":"^6.3.1"},"devDependencies":{"@types/semver":"^6.0.0","typescript":"^5.2.2"}}');
106826
103971
 
106827
103972
  /***/ }),
106828
103973
 
@@ -106923,7 +104068,7 @@ const os = __nccwpck_require__(2037)
106923
104068
  const path = __nccwpck_require__(1017)
106924
104069
  const quote = __nccwpck_require__(5427)
106925
104070
  const cliParser = __nccwpck_require__(8604)()
106926
- const findYarnWorkspaceRoot = __nccwpck_require__(2670)
104071
+ const findYarnWorkspaceRoot = __nccwpck_require__(6748)
106927
104072
  const debug = __nccwpck_require__(8237)('@cypress/github-action')
106928
104073
  const { ping } = __nccwpck_require__(9390)
106929
104074
  const { SUMMARY_ENV_VAR } = __nccwpck_require__(1327)