diff --git a/packages/cache/src/generated/results/api/v1/cache.ts b/packages/cache/src/generated/results/api/v1/cache.ts index 5345a2b1..5e998c37 100644 --- a/packages/cache/src/generated/results/api/v1/cache.ts +++ b/packages/cache/src/generated/results/api/v1/cache.ts @@ -12,7 +12,6 @@ import type { PartialMessage } from "@protobuf-ts/runtime"; import { reflectionMergePartial } from "@protobuf-ts/runtime"; import { MESSAGE_TYPE } from "@protobuf-ts/runtime"; import { MessageType } from "@protobuf-ts/runtime"; -import { CacheEntry } from "../../entities/v1/cacheentry"; import { CacheMetadata } from "../../entities/v1/cachemetadata"; /** * @generated from protobuf message github.actions.results.api.v1.CreateCacheEntryRequest @@ -146,72 +145,6 @@ export interface GetCacheEntryDownloadURLResponse { */ matchedKey: string; } -/** - * @generated from protobuf message github.actions.results.api.v1.DeleteCacheEntryRequest - */ -export interface DeleteCacheEntryRequest { - /** - * Scope and other metadata for the cache entry - * - * @generated from protobuf field: github.actions.results.entities.v1.CacheMetadata metadata = 1; - */ - metadata?: CacheMetadata; - /** - * An explicit key for a cache entry - * - * @generated from protobuf field: string key = 2; - */ - key: string; -} -/** - * @generated from protobuf message github.actions.results.api.v1.DeleteCacheEntryResponse - */ -export interface DeleteCacheEntryResponse { - /** - * @generated from protobuf field: bool ok = 1; - */ - ok: boolean; - /** - * Cache entry database ID - * - * @generated from protobuf field: int64 entry_id = 2; - */ - entryId: string; -} -/** - * @generated from protobuf message github.actions.results.api.v1.ListCacheEntriesRequest - */ -export interface ListCacheEntriesRequest { - /** - * Scope and other metadata for the cache entry - * - * @generated from protobuf field: github.actions.results.entities.v1.CacheMetadata metadata = 1; - */ - metadata?: CacheMetadata; - /** - * An explicit key for a cache entry - * - * @generated from protobuf field: string key = 2; - */ - key: string; - /** - * Restore keys used for prefix searching - * - * @generated from protobuf field: repeated string restore_keys = 3; - */ - restoreKeys: string[]; -} -/** - * @generated from protobuf message github.actions.results.api.v1.ListCacheEntriesResponse - */ -export interface ListCacheEntriesResponse { - /** - * Cache entries in the defined scope - * - * @generated from protobuf field: repeated github.actions.results.entities.v1.CacheEntry entries = 1; - */ - entries: CacheEntry[]; -} // @generated message type with reflection information, may provide speed optimized methods class CreateCacheEntryRequest$Type extends MessageType { constructor() { @@ -578,229 +511,11 @@ class GetCacheEntryDownloadURLResponse$Type extends MessageType { - constructor() { - super("github.actions.results.api.v1.DeleteCacheEntryRequest", [ - { no: 1, name: "metadata", kind: "message", T: () => CacheMetadata }, - { no: 2, name: "key", kind: "scalar", T: 9 /*ScalarType.STRING*/ } - ]); - } - create(value?: PartialMessage): DeleteCacheEntryRequest { - const message = { key: "" }; - globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: DeleteCacheEntryRequest): DeleteCacheEntryRequest { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* github.actions.results.entities.v1.CacheMetadata metadata */ 1: - message.metadata = CacheMetadata.internalBinaryRead(reader, reader.uint32(), options, message.metadata); - break; - case /* string key */ 2: - message.key = reader.string(); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: DeleteCacheEntryRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* github.actions.results.entities.v1.CacheMetadata metadata = 1; */ - if (message.metadata) - CacheMetadata.internalBinaryWrite(message.metadata, writer.tag(1, WireType.LengthDelimited).fork(), options).join(); - /* string key = 2; */ - if (message.key !== "") - writer.tag(2, WireType.LengthDelimited).string(message.key); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message github.actions.results.api.v1.DeleteCacheEntryRequest - */ -export const DeleteCacheEntryRequest = new DeleteCacheEntryRequest$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class DeleteCacheEntryResponse$Type extends MessageType { - constructor() { - super("github.actions.results.api.v1.DeleteCacheEntryResponse", [ - { no: 1, name: "ok", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }, - { no: 2, name: "entry_id", kind: "scalar", T: 3 /*ScalarType.INT64*/ } - ]); - } - create(value?: PartialMessage): DeleteCacheEntryResponse { - const message = { ok: false, entryId: "0" }; - globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: DeleteCacheEntryResponse): DeleteCacheEntryResponse { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* bool ok */ 1: - message.ok = reader.bool(); - break; - case /* int64 entry_id */ 2: - message.entryId = reader.int64().toString(); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: DeleteCacheEntryResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* bool ok = 1; */ - if (message.ok !== false) - writer.tag(1, WireType.Varint).bool(message.ok); - /* int64 entry_id = 2; */ - if (message.entryId !== "0") - writer.tag(2, WireType.Varint).int64(message.entryId); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message github.actions.results.api.v1.DeleteCacheEntryResponse - */ -export const DeleteCacheEntryResponse = new DeleteCacheEntryResponse$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class ListCacheEntriesRequest$Type extends MessageType { - constructor() { - super("github.actions.results.api.v1.ListCacheEntriesRequest", [ - { no: 1, name: "metadata", kind: "message", T: () => CacheMetadata }, - { no: 2, name: "key", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 3, name: "restore_keys", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/ } - ]); - } - create(value?: PartialMessage): ListCacheEntriesRequest { - const message = { key: "", restoreKeys: [] }; - globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ListCacheEntriesRequest): ListCacheEntriesRequest { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* github.actions.results.entities.v1.CacheMetadata metadata */ 1: - message.metadata = CacheMetadata.internalBinaryRead(reader, reader.uint32(), options, message.metadata); - break; - case /* string key */ 2: - message.key = reader.string(); - break; - case /* repeated string restore_keys */ 3: - message.restoreKeys.push(reader.string()); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: ListCacheEntriesRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* github.actions.results.entities.v1.CacheMetadata metadata = 1; */ - if (message.metadata) - CacheMetadata.internalBinaryWrite(message.metadata, writer.tag(1, WireType.LengthDelimited).fork(), options).join(); - /* string key = 2; */ - if (message.key !== "") - writer.tag(2, WireType.LengthDelimited).string(message.key); - /* repeated string restore_keys = 3; */ - for (let i = 0; i < message.restoreKeys.length; i++) - writer.tag(3, WireType.LengthDelimited).string(message.restoreKeys[i]); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message github.actions.results.api.v1.ListCacheEntriesRequest - */ -export const ListCacheEntriesRequest = new ListCacheEntriesRequest$Type(); -// @generated message type with reflection information, may provide speed optimized methods -class ListCacheEntriesResponse$Type extends MessageType { - constructor() { - super("github.actions.results.api.v1.ListCacheEntriesResponse", [ - { no: 1, name: "entries", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => CacheEntry } - ]); - } - create(value?: PartialMessage): ListCacheEntriesResponse { - const message = { entries: [] }; - globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ListCacheEntriesResponse): ListCacheEntriesResponse { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* repeated github.actions.results.entities.v1.CacheEntry entries */ 1: - message.entries.push(CacheEntry.internalBinaryRead(reader, reader.uint32(), options)); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: ListCacheEntriesResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* repeated github.actions.results.entities.v1.CacheEntry entries = 1; */ - for (let i = 0; i < message.entries.length; i++) - CacheEntry.internalBinaryWrite(message.entries[i], writer.tag(1, WireType.LengthDelimited).fork(), options).join(); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message github.actions.results.api.v1.ListCacheEntriesResponse - */ -export const ListCacheEntriesResponse = new ListCacheEntriesResponse$Type(); /** * @generated ServiceType for protobuf service github.actions.results.api.v1.CacheService */ export const CacheService = new ServiceType("github.actions.results.api.v1.CacheService", [ { name: "CreateCacheEntry", options: {}, I: CreateCacheEntryRequest, O: CreateCacheEntryResponse }, { name: "FinalizeCacheEntryUpload", options: {}, I: FinalizeCacheEntryUploadRequest, O: FinalizeCacheEntryUploadResponse }, - { name: "GetCacheEntryDownloadURL", options: {}, I: GetCacheEntryDownloadURLRequest, O: GetCacheEntryDownloadURLResponse }, - { name: "DeleteCacheEntry", options: {}, I: DeleteCacheEntryRequest, O: DeleteCacheEntryResponse }, - { name: "ListCacheEntries", options: {}, I: ListCacheEntriesRequest, O: ListCacheEntriesResponse } + { name: "GetCacheEntryDownloadURL", options: {}, I: GetCacheEntryDownloadURLRequest, O: GetCacheEntryDownloadURLResponse } ]); diff --git a/packages/cache/src/generated/results/api/v1/cache.twirp.ts b/packages/cache/src/generated/results/api/v1/cache.twirp.ts index 3dd73707..8c14c31d 100644 --- a/packages/cache/src/generated/results/api/v1/cache.twirp.ts +++ b/packages/cache/src/generated/results/api/v1/cache.twirp.ts @@ -15,10 +15,6 @@ import { FinalizeCacheEntryUploadResponse, GetCacheEntryDownloadURLRequest, GetCacheEntryDownloadURLResponse, - DeleteCacheEntryRequest, - DeleteCacheEntryResponse, - ListCacheEntriesRequest, - ListCacheEntriesResponse, } from "./cache"; //==================================// @@ -44,12 +40,6 @@ export interface CacheServiceClient { GetCacheEntryDownloadURL( request: GetCacheEntryDownloadURLRequest ): Promise; - DeleteCacheEntry( - request: DeleteCacheEntryRequest - ): Promise; - ListCacheEntries( - request: ListCacheEntriesRequest - ): Promise; } export class CacheServiceClientJSON implements CacheServiceClient { @@ -59,8 +49,6 @@ export class CacheServiceClientJSON implements CacheServiceClient { this.CreateCacheEntry.bind(this); this.FinalizeCacheEntryUpload.bind(this); this.GetCacheEntryDownloadURL.bind(this); - this.DeleteCacheEntry.bind(this); - this.ListCacheEntries.bind(this); } CreateCacheEntry( request: CreateCacheEntryRequest @@ -121,46 +109,6 @@ export class CacheServiceClientJSON implements CacheServiceClient { }) ); } - - DeleteCacheEntry( - request: DeleteCacheEntryRequest - ): Promise { - const data = DeleteCacheEntryRequest.toJson(request, { - useProtoFieldName: true, - emitDefaultValues: false, - }); - const promise = this.rpc.request( - "github.actions.results.api.v1.CacheService", - "DeleteCacheEntry", - "application/json", - data as object - ); - return promise.then((data) => - DeleteCacheEntryResponse.fromJson(data as any, { - ignoreUnknownFields: true, - }) - ); - } - - ListCacheEntries( - request: ListCacheEntriesRequest - ): Promise { - const data = ListCacheEntriesRequest.toJson(request, { - useProtoFieldName: true, - emitDefaultValues: false, - }); - const promise = this.rpc.request( - "github.actions.results.api.v1.CacheService", - "ListCacheEntries", - "application/json", - data as object - ); - return promise.then((data) => - ListCacheEntriesResponse.fromJson(data as any, { - ignoreUnknownFields: true, - }) - ); - } } export class CacheServiceClientProtobuf implements CacheServiceClient { @@ -170,8 +118,6 @@ export class CacheServiceClientProtobuf implements CacheServiceClient { this.CreateCacheEntry.bind(this); this.FinalizeCacheEntryUpload.bind(this); this.GetCacheEntryDownloadURL.bind(this); - this.DeleteCacheEntry.bind(this); - this.ListCacheEntries.bind(this); } CreateCacheEntry( request: CreateCacheEntryRequest @@ -217,36 +163,6 @@ export class CacheServiceClientProtobuf implements CacheServiceClient { GetCacheEntryDownloadURLResponse.fromBinary(data as Uint8Array) ); } - - DeleteCacheEntry( - request: DeleteCacheEntryRequest - ): Promise { - const data = DeleteCacheEntryRequest.toBinary(request); - const promise = this.rpc.request( - "github.actions.results.api.v1.CacheService", - "DeleteCacheEntry", - "application/protobuf", - data - ); - return promise.then((data) => - DeleteCacheEntryResponse.fromBinary(data as Uint8Array) - ); - } - - ListCacheEntries( - request: ListCacheEntriesRequest - ): Promise { - const data = ListCacheEntriesRequest.toBinary(request); - const promise = this.rpc.request( - "github.actions.results.api.v1.CacheService", - "ListCacheEntries", - "application/protobuf", - data - ); - return promise.then((data) => - ListCacheEntriesResponse.fromBinary(data as Uint8Array) - ); - } } //==================================// @@ -266,30 +182,18 @@ export interface CacheServiceTwirp { ctx: T, request: GetCacheEntryDownloadURLRequest ): Promise; - DeleteCacheEntry( - ctx: T, - request: DeleteCacheEntryRequest - ): Promise; - ListCacheEntries( - ctx: T, - request: ListCacheEntriesRequest - ): Promise; } export enum CacheServiceMethod { CreateCacheEntry = "CreateCacheEntry", FinalizeCacheEntryUpload = "FinalizeCacheEntryUpload", GetCacheEntryDownloadURL = "GetCacheEntryDownloadURL", - DeleteCacheEntry = "DeleteCacheEntry", - ListCacheEntries = "ListCacheEntries", } export const CacheServiceMethodList = [ CacheServiceMethod.CreateCacheEntry, CacheServiceMethod.FinalizeCacheEntryUpload, CacheServiceMethod.GetCacheEntryDownloadURL, - CacheServiceMethod.DeleteCacheEntry, - CacheServiceMethod.ListCacheEntries, ]; export function createCacheServiceServer( @@ -369,46 +273,6 @@ function matchCacheServiceRoute( interceptors ); }; - case "DeleteCacheEntry": - return async ( - ctx: T, - service: CacheServiceTwirp, - data: Buffer, - interceptors?: Interceptor< - T, - DeleteCacheEntryRequest, - DeleteCacheEntryResponse - >[] - ) => { - ctx = { ...ctx, methodName: "DeleteCacheEntry" }; - await events.onMatch(ctx); - return handleCacheServiceDeleteCacheEntryRequest( - ctx, - service, - data, - interceptors - ); - }; - case "ListCacheEntries": - return async ( - ctx: T, - service: CacheServiceTwirp, - data: Buffer, - interceptors?: Interceptor< - T, - ListCacheEntriesRequest, - ListCacheEntriesResponse - >[] - ) => { - ctx = { ...ctx, methodName: "ListCacheEntries" }; - await events.onMatch(ctx); - return handleCacheServiceListCacheEntriesRequest( - ctx, - service, - data, - interceptors - ); - }; default: events.onNotFound(); const msg = `no handler found`; @@ -514,72 +378,6 @@ function handleCacheServiceGetCacheEntryDownloadURLRequest< throw new TwirpError(TwirpErrorCode.BadRoute, msg); } } - -function handleCacheServiceDeleteCacheEntryRequest< - T extends TwirpContext = TwirpContext ->( - ctx: T, - service: CacheServiceTwirp, - data: Buffer, - interceptors?: Interceptor< - T, - DeleteCacheEntryRequest, - DeleteCacheEntryResponse - >[] -): Promise { - switch (ctx.contentType) { - case TwirpContentType.JSON: - return handleCacheServiceDeleteCacheEntryJSON( - ctx, - service, - data, - interceptors - ); - case TwirpContentType.Protobuf: - return handleCacheServiceDeleteCacheEntryProtobuf( - ctx, - service, - data, - interceptors - ); - default: - const msg = "unexpected Content-Type"; - throw new TwirpError(TwirpErrorCode.BadRoute, msg); - } -} - -function handleCacheServiceListCacheEntriesRequest< - T extends TwirpContext = TwirpContext ->( - ctx: T, - service: CacheServiceTwirp, - data: Buffer, - interceptors?: Interceptor< - T, - ListCacheEntriesRequest, - ListCacheEntriesResponse - >[] -): Promise { - switch (ctx.contentType) { - case TwirpContentType.JSON: - return handleCacheServiceListCacheEntriesJSON( - ctx, - service, - data, - interceptors - ); - case TwirpContentType.Protobuf: - return handleCacheServiceListCacheEntriesProtobuf( - ctx, - service, - data, - interceptors - ); - default: - const msg = "unexpected Content-Type"; - throw new TwirpError(TwirpErrorCode.BadRoute, msg); - } -} async function handleCacheServiceCreateCacheEntryJSON< T extends TwirpContext = TwirpContext >( @@ -723,102 +521,6 @@ async function handleCacheServiceGetCacheEntryDownloadURLJSON< }) as string ); } - -async function handleCacheServiceDeleteCacheEntryJSON< - T extends TwirpContext = TwirpContext ->( - ctx: T, - service: CacheServiceTwirp, - data: Buffer, - interceptors?: Interceptor< - T, - DeleteCacheEntryRequest, - DeleteCacheEntryResponse - >[] -) { - let request: DeleteCacheEntryRequest; - let response: DeleteCacheEntryResponse; - - try { - const body = JSON.parse(data.toString() || "{}"); - request = DeleteCacheEntryRequest.fromJson(body, { - ignoreUnknownFields: true, - }); - } catch (e) { - if (e instanceof Error) { - const msg = "the json request could not be decoded"; - throw new TwirpError(TwirpErrorCode.Malformed, msg).withCause(e, true); - } - } - - if (interceptors && interceptors.length > 0) { - const interceptor = chainInterceptors(...interceptors) as Interceptor< - T, - DeleteCacheEntryRequest, - DeleteCacheEntryResponse - >; - response = await interceptor(ctx, request!, (ctx, inputReq) => { - return service.DeleteCacheEntry(ctx, inputReq); - }); - } else { - response = await service.DeleteCacheEntry(ctx, request!); - } - - return JSON.stringify( - DeleteCacheEntryResponse.toJson(response, { - useProtoFieldName: true, - emitDefaultValues: false, - }) as string - ); -} - -async function handleCacheServiceListCacheEntriesJSON< - T extends TwirpContext = TwirpContext ->( - ctx: T, - service: CacheServiceTwirp, - data: Buffer, - interceptors?: Interceptor< - T, - ListCacheEntriesRequest, - ListCacheEntriesResponse - >[] -) { - let request: ListCacheEntriesRequest; - let response: ListCacheEntriesResponse; - - try { - const body = JSON.parse(data.toString() || "{}"); - request = ListCacheEntriesRequest.fromJson(body, { - ignoreUnknownFields: true, - }); - } catch (e) { - if (e instanceof Error) { - const msg = "the json request could not be decoded"; - throw new TwirpError(TwirpErrorCode.Malformed, msg).withCause(e, true); - } - } - - if (interceptors && interceptors.length > 0) { - const interceptor = chainInterceptors(...interceptors) as Interceptor< - T, - ListCacheEntriesRequest, - ListCacheEntriesResponse - >; - response = await interceptor(ctx, request!, (ctx, inputReq) => { - return service.ListCacheEntries(ctx, inputReq); - }); - } else { - response = await service.ListCacheEntries(ctx, request!); - } - - return JSON.stringify( - ListCacheEntriesResponse.toJson(response, { - useProtoFieldName: true, - emitDefaultValues: false, - }) as string - ); -} async function handleCacheServiceCreateCacheEntryProtobuf< T extends TwirpContext = TwirpContext >( @@ -938,83 +640,3 @@ async function handleCacheServiceGetCacheEntryDownloadURLProtobuf< return Buffer.from(GetCacheEntryDownloadURLResponse.toBinary(response)); } - -async function handleCacheServiceDeleteCacheEntryProtobuf< - T extends TwirpContext = TwirpContext ->( - ctx: T, - service: CacheServiceTwirp, - data: Buffer, - interceptors?: Interceptor< - T, - DeleteCacheEntryRequest, - DeleteCacheEntryResponse - >[] -) { - let request: DeleteCacheEntryRequest; - let response: DeleteCacheEntryResponse; - - try { - request = DeleteCacheEntryRequest.fromBinary(data); - } catch (e) { - if (e instanceof Error) { - const msg = "the protobuf request could not be decoded"; - throw new TwirpError(TwirpErrorCode.Malformed, msg).withCause(e, true); - } - } - - if (interceptors && interceptors.length > 0) { - const interceptor = chainInterceptors(...interceptors) as Interceptor< - T, - DeleteCacheEntryRequest, - DeleteCacheEntryResponse - >; - response = await interceptor(ctx, request!, (ctx, inputReq) => { - return service.DeleteCacheEntry(ctx, inputReq); - }); - } else { - response = await service.DeleteCacheEntry(ctx, request!); - } - - return Buffer.from(DeleteCacheEntryResponse.toBinary(response)); -} - -async function handleCacheServiceListCacheEntriesProtobuf< - T extends TwirpContext = TwirpContext ->( - ctx: T, - service: CacheServiceTwirp, - data: Buffer, - interceptors?: Interceptor< - T, - ListCacheEntriesRequest, - ListCacheEntriesResponse - >[] -) { - let request: ListCacheEntriesRequest; - let response: ListCacheEntriesResponse; - - try { - request = ListCacheEntriesRequest.fromBinary(data); - } catch (e) { - if (e instanceof Error) { - const msg = "the protobuf request could not be decoded"; - throw new TwirpError(TwirpErrorCode.Malformed, msg).withCause(e, true); - } - } - - if (interceptors && interceptors.length > 0) { - const interceptor = chainInterceptors(...interceptors) as Interceptor< - T, - ListCacheEntriesRequest, - ListCacheEntriesResponse - >; - response = await interceptor(ctx, request!, (ctx, inputReq) => { - return service.ListCacheEntries(ctx, inputReq); - }); - } else { - response = await service.ListCacheEntries(ctx, request!); - } - - return Buffer.from(ListCacheEntriesResponse.toBinary(response)); -} diff --git a/packages/cache/src/generated/results/entities/v1/cacheentry.ts b/packages/cache/src/generated/results/entities/v1/cacheentry.ts deleted file mode 100644 index b55b4afa..00000000 --- a/packages/cache/src/generated/results/entities/v1/cacheentry.ts +++ /dev/null @@ -1,163 +0,0 @@ -// @generated by protobuf-ts 2.9.1 with parameter long_type_string,client_none,generate_dependencies -// @generated from protobuf file "results/entities/v1/cacheentry.proto" (package "github.actions.results.entities.v1", syntax proto3) -// tslint:disable -import type { BinaryWriteOptions } from "@protobuf-ts/runtime"; -import type { IBinaryWriter } from "@protobuf-ts/runtime"; -import { WireType } from "@protobuf-ts/runtime"; -import type { BinaryReadOptions } from "@protobuf-ts/runtime"; -import type { IBinaryReader } from "@protobuf-ts/runtime"; -import { UnknownFieldHandler } from "@protobuf-ts/runtime"; -import type { PartialMessage } from "@protobuf-ts/runtime"; -import { reflectionMergePartial } from "@protobuf-ts/runtime"; -import { MESSAGE_TYPE } from "@protobuf-ts/runtime"; -import { MessageType } from "@protobuf-ts/runtime"; -import { Timestamp } from "../../../google/protobuf/timestamp"; -/** - * @generated from protobuf message github.actions.results.entities.v1.CacheEntry - */ -export interface CacheEntry { - /** - * An explicit key for a cache entry - * - * @generated from protobuf field: string key = 1; - */ - key: string; - /** - * SHA256 hex digest of the cache archive - * - * @generated from protobuf field: string hash = 2; - */ - hash: string; - /** - * Cache entry size in bytes - * - * @generated from protobuf field: int64 size_bytes = 3; - */ - sizeBytes: string; - /** - * Access scope - * - * @generated from protobuf field: string scope = 4; - */ - scope: string; - /** - * Version SHA256 hex digest - * - * @generated from protobuf field: string version = 5; - */ - version: string; - /** - * When the cache entry was created - * - * @generated from protobuf field: google.protobuf.Timestamp created_at = 6; - */ - createdAt?: Timestamp; - /** - * When the cache entry was last accessed - * - * @generated from protobuf field: google.protobuf.Timestamp last_accessed_at = 7; - */ - lastAccessedAt?: Timestamp; - /** - * When the cache entry is set to expire - * - * @generated from protobuf field: google.protobuf.Timestamp expires_at = 8; - */ - expiresAt?: Timestamp; -} -// @generated message type with reflection information, may provide speed optimized methods -class CacheEntry$Type extends MessageType { - constructor() { - super("github.actions.results.entities.v1.CacheEntry", [ - { no: 1, name: "key", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 2, name: "hash", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 3, name: "size_bytes", kind: "scalar", T: 3 /*ScalarType.INT64*/ }, - { no: 4, name: "scope", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 5, name: "version", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, - { no: 6, name: "created_at", kind: "message", T: () => Timestamp }, - { no: 7, name: "last_accessed_at", kind: "message", T: () => Timestamp }, - { no: 8, name: "expires_at", kind: "message", T: () => Timestamp } - ]); - } - create(value?: PartialMessage): CacheEntry { - const message = { key: "", hash: "", sizeBytes: "0", scope: "", version: "" }; - globalThis.Object.defineProperty(message, MESSAGE_TYPE, { enumerable: false, value: this }); - if (value !== undefined) - reflectionMergePartial(this, message, value); - return message; - } - internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: CacheEntry): CacheEntry { - let message = target ?? this.create(), end = reader.pos + length; - while (reader.pos < end) { - let [fieldNo, wireType] = reader.tag(); - switch (fieldNo) { - case /* string key */ 1: - message.key = reader.string(); - break; - case /* string hash */ 2: - message.hash = reader.string(); - break; - case /* int64 size_bytes */ 3: - message.sizeBytes = reader.int64().toString(); - break; - case /* string scope */ 4: - message.scope = reader.string(); - break; - case /* string version */ 5: - message.version = reader.string(); - break; - case /* google.protobuf.Timestamp created_at */ 6: - message.createdAt = Timestamp.internalBinaryRead(reader, reader.uint32(), options, message.createdAt); - break; - case /* google.protobuf.Timestamp last_accessed_at */ 7: - message.lastAccessedAt = Timestamp.internalBinaryRead(reader, reader.uint32(), options, message.lastAccessedAt); - break; - case /* google.protobuf.Timestamp expires_at */ 8: - message.expiresAt = Timestamp.internalBinaryRead(reader, reader.uint32(), options, message.expiresAt); - break; - default: - let u = options.readUnknownField; - if (u === "throw") - throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); - let d = reader.skip(wireType); - if (u !== false) - (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); - } - } - return message; - } - internalBinaryWrite(message: CacheEntry, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { - /* string key = 1; */ - if (message.key !== "") - writer.tag(1, WireType.LengthDelimited).string(message.key); - /* string hash = 2; */ - if (message.hash !== "") - writer.tag(2, WireType.LengthDelimited).string(message.hash); - /* int64 size_bytes = 3; */ - if (message.sizeBytes !== "0") - writer.tag(3, WireType.Varint).int64(message.sizeBytes); - /* string scope = 4; */ - if (message.scope !== "") - writer.tag(4, WireType.LengthDelimited).string(message.scope); - /* string version = 5; */ - if (message.version !== "") - writer.tag(5, WireType.LengthDelimited).string(message.version); - /* google.protobuf.Timestamp created_at = 6; */ - if (message.createdAt) - Timestamp.internalBinaryWrite(message.createdAt, writer.tag(6, WireType.LengthDelimited).fork(), options).join(); - /* google.protobuf.Timestamp last_accessed_at = 7; */ - if (message.lastAccessedAt) - Timestamp.internalBinaryWrite(message.lastAccessedAt, writer.tag(7, WireType.LengthDelimited).fork(), options).join(); - /* google.protobuf.Timestamp expires_at = 8; */ - if (message.expiresAt) - Timestamp.internalBinaryWrite(message.expiresAt, writer.tag(8, WireType.LengthDelimited).fork(), options).join(); - let u = options.writeUnknownFields; - if (u !== false) - (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); - return writer; - } -} -/** - * @generated MessageType for protobuf message github.actions.results.entities.v1.CacheEntry - */ -export const CacheEntry = new CacheEntry$Type();