@gadgetinc/dateilager 0.9.4 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/grpc-client.d.ts +2 -1
- package/dist/cjs/grpc-client.js +10 -2
- package/dist/cjs/grpc-client.js.map +1 -1
- package/dist/cjs/pb/fs_pb.d.ts +4 -0
- package/dist/cjs/pb/fs_pb.js +8 -1
- package/dist/cjs/pb/fs_pb.js.map +1 -1
- package/dist/esm/grpc-client.d.ts +2 -1
- package/dist/esm/grpc-client.js +10 -2
- package/dist/esm/grpc-client.js.map +1 -1
- package/dist/esm/pb/fs_pb.d.ts +4 -0
- package/dist/esm/pb/fs_pb.js +8 -1
- package/dist/esm/pb/fs_pb.js.map +1 -1
- package/package.json +1 -1
|
@@ -87,6 +87,7 @@ export declare class DateiLagerGrpcClient {
|
|
|
87
87
|
* @param ignores The paths under {@link path} to ignore.
|
|
88
88
|
* @param from The project version to start from.
|
|
89
89
|
* @param to The project version to end at.
|
|
90
|
+
* @param maxSize The maximum file size at which the content of the file is sent for.
|
|
90
91
|
* @returns All the objects under {@link path}.
|
|
91
92
|
* @example
|
|
92
93
|
* const response = await client.getObjects(1n, "");
|
|
@@ -95,7 +96,7 @@ export declare class DateiLagerGrpcClient {
|
|
|
95
96
|
* console.log("[getObjects] content:\n" + object.content);
|
|
96
97
|
* }
|
|
97
98
|
*/
|
|
98
|
-
getObjects(project: bigint, path: string, ignores?: string[], from?: bigint, to?: bigint): Promise<GetUnaryResponse>;
|
|
99
|
+
getObjects(project: bigint, path: string, ignores?: string[], from?: bigint, to?: bigint, maxSize?: bigint): Promise<GetUnaryResponse>;
|
|
99
100
|
/**
|
|
100
101
|
* Get an object.
|
|
101
102
|
* @param project The id of the project.
|
package/dist/cjs/grpc-client.js
CHANGED
|
@@ -163,6 +163,7 @@ class DateiLagerGrpcClient {
|
|
|
163
163
|
* @param ignores The paths under {@link path} to ignore.
|
|
164
164
|
* @param from The project version to start from.
|
|
165
165
|
* @param to The project version to end at.
|
|
166
|
+
* @param maxSize The maximum file size at which the content of the file is sent for.
|
|
166
167
|
* @returns All the objects under {@link path}.
|
|
167
168
|
* @example
|
|
168
169
|
* const response = await client.getObjects(1n, "");
|
|
@@ -171,7 +172,7 @@ class DateiLagerGrpcClient {
|
|
|
171
172
|
* console.log("[getObjects] content:\n" + object.content);
|
|
172
173
|
* }
|
|
173
174
|
*/
|
|
174
|
-
async getObjects(project, path, ignores = [], from, to) {
|
|
175
|
+
async getObjects(project, path, ignores = [], from, to, maxSize) {
|
|
175
176
|
return await (0, telemetry_1.trace)("dateilager-grpc-client.get-unary", {
|
|
176
177
|
attributes: {
|
|
177
178
|
"dl.project": String(project),
|
|
@@ -179,9 +180,16 @@ class DateiLagerGrpcClient {
|
|
|
179
180
|
"dl.ignores": ignores,
|
|
180
181
|
"dl.from_version": String(from),
|
|
181
182
|
"dl.to_version": String(to),
|
|
183
|
+
"dl.max_content_send_size": String(maxSize),
|
|
182
184
|
},
|
|
183
185
|
}, async () => {
|
|
184
|
-
const call = this._client.getUnary({
|
|
186
|
+
const call = this._client.getUnary({
|
|
187
|
+
project,
|
|
188
|
+
fromVersion: from,
|
|
189
|
+
toVersion: to,
|
|
190
|
+
queries: [{ path, ignores, isPrefix: true, subpaths: [] }],
|
|
191
|
+
maxContentSendSize: maxSize,
|
|
192
|
+
}, this._rpcOptions());
|
|
185
193
|
return await call.response;
|
|
186
194
|
});
|
|
187
195
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grpc-client.js","sourceRoot":"","sources":["../../src/grpc-client.ts"],"names":[],"mappings":";;;AACA,2CAA0E;AAE1E,4CAA8E;AAC9E,gEAA4D;AAC5D,0DAA+F;AAC/F,+BAAgD;AAChD,oDAAqD;AAErD,oDAA6C;AAC7C,2CAA2D;AA0C3D;;;;;GAKG;AACH,MAAa,oBAAoB;IAU/B;;;;OAIG;IACH,YAAmB,OAAoC;QAdvD,gBA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CAAC,GAAG,EAAE,CAAC;YACjB,MAAM,GAAG,CAAC;QACZ,CAAC;IACH,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,QAAQ;QACnB,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;YACrC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;YAC3C,OAAO,QAAQ,CAAC,OAAO,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;QAC3D,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;QACnB,CAAC;IACH,CAAC;CACF;AAED,MAAM,OAAO,GAAG,IAAI,kBAAW,EAAE,CAAC;AAElC;;;;GAIG;AACH,SAAgB,aAAa,CAAC,OAAe;IAC3C,OAAO,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC;AAFD,sCAEC;AAED,MAAM,OAAO,GAAG,IAAI,kBAAW,EAAE,CAAC;AAElC;;;;GAIG;AACH,SAAgB,aAAa,CAAC,KAA6B;IACzD,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC;AAFD,sCAEC","sourcesContent":["import type { ClientOptions } from \"@grpc/grpc-js\";\nimport { ChannelCredentials, credentials, Metadata } from \"@grpc/grpc-js\";\nimport type { Span } from \"@opentelemetry/api\";\nimport { context as contextAPI, trace as traceAPI } from \"@opentelemetry/api\";\nimport { GrpcTransport } from \"@protobuf-ts/grpc-transport\";\nimport { RpcError, type ClientStreamingCall, type RpcOptions } from \"@protobuf-ts/runtime-rpc\";\nimport { TextDecoder, TextEncoder } from \"util\";\nimport { trace, tracer } from \"./internal/telemetry\";\nimport type { CloneToProjectResponse, GetUnaryResponse, Objekt, Project, UpdateRequest, UpdateResponse } from \"./pb/fs_pb\";\nimport { FsClient } from \"./pb/fs_pb.client\";\nimport { ProjectAlreadyExistsError } from \"./utils/errors\";\nexport type { Objekt, Project };\n\n/**\n * Options for {@link DateiLagerGrpcClient}.\n */\nexport interface DateiLagerGrpcClientOptions {\n /**\n * The address of the dateilager server.\n */\n server:\n | string\n | {\n /**\n * The host of the dateilager server.\n */\n host: string;\n\n /**\n * The port of the dateilager server.\n */\n port: number;\n };\n\n /**\n * The token that will be sent as authorization metadata to the dateilager server.\n */\n token: string | (() => Promise<string>);\n\n /**\n * Options that will be passed to the underlying grpc client constructor.\n * @see ClientOptions\n */\n grpcClientOptions?: ClientOptions;\n\n /**\n * Options that will be passed to every remote procedure call.\n * @see RpcOptions\n */\n rpcOptions?: RpcOptions | (() => RpcOptions | undefined);\n}\n\n/**\n * A client class for interacting with DateiLager's GRPC API.\n *\n * The DateiLager API surface area is as minimal as possible;\n * convenience functions, such as getObject, should be implemented within the client.\n */\nexport class DateiLagerGrpcClient {\n /** @internal */\n private readonly _client: FsClient;\n\n /** @internal */\n private readonly _transport: GrpcTransport;\n\n /** @internal */\n private readonly _rpcOptions: () => RpcOptions | undefined;\n\n /**\n * The library used to interact with GRPC creates connections lazily, this constructor will not\n * raise an error even if there is no service running at {@link DateiLagerGrpcClientOptions.server server}.\n * @param options Grpc client options.\n */\n public constructor(options: DateiLagerGrpcClientOptions) {\n const tokenFn = typeof options.token === \"string\" ? () => Promise.resolve(options.token as string) : options.token;\n\n this._transport = new GrpcTransport({\n host: typeof options.server === \"string\" ? options.server : `${options.server.host}:${options.server.port}`,\n channelCredentials: credentials.combineChannelCredentials(\n ChannelCredentials.createSsl(),\n credentials.createFromMetadataGenerator((_, callback) => {\n tokenFn()\n .then((token) => {\n const meta = new Metadata();\n meta.add(\"authorization\", `Bearer ${token}`);\n callback(null, meta);\n })\n .catch(callback);\n })\n ),\n clientOptions: {\n \"grpc.keepalive_time_ms\": 5_000,\n \"grpc.keepalive_timeout_ms\": 1_000,\n \"grpc.keepalive_permit_without_calls\": 1,\n ...options.grpcClientOptions,\n },\n });\n\n this._client = new FsClient(this._transport);\n\n this._rpcOptions = options.rpcOptions instanceof Function ? options.rpcOptions : () => options.rpcOptions as RpcOptions | undefined;\n }\n\n /**\n * Close the underlying GRPC client.\n */\n public close(): void {\n this._transport.close();\n }\n\n /**\n * Create a new project.\n * @param project The id of the project.\n * @param packPatterns The paths to pack.\n * @param template The id of the project to start from.\n */\n public async newProject(project: bigint, packPatterns: string[], template?: bigint): Promise<void> {\n try {\n await trace(\n \"dateilager-grpc-client.new-project\",\n {\n attributes: {\n \"dl.project\": String(project),\n \"dl.pack_patterns\": packPatterns,\n \"dl.template\": String(template),\n },\n },\n () => this._client.newProject({ id: project, packPatterns, template }, this._rpcOptions())\n );\n } catch (error) {\n if (error instanceof RpcError && error.code == \"ALREADY_EXISTS\") {\n throw new ProjectAlreadyExistsError(`project id ${project} already exists`);\n }\n throw error;\n }\n }\n\n /**\n * Delete a project.\n * @param project The id of the project.\n */\n public async deleteProject(project: bigint): Promise<void> {\n await trace(\n \"dateilager-grpc-client.delete-project\",\n {\n attributes: {\n \"dl.project\": String(project),\n },\n },\n () => this._client.deleteProject({ project }, this._rpcOptions())\n );\n }\n\n /**\n * List objects.\n * @param project The id of the project.\n * @param path The path to list objects under.\n * @param ignores The paths under {@link path} to ignore.\n * @param from The project version to start from.\n * @param to The project version to end at.\n * @returns A stream of objects.\n * @yields An object from the stream.\n * @example\n * for await (const object of client.listObjects(1n, \"\")) {\n * console.log(\"[listObjects] path: \" + object.path);\n * console.log(\"[listObjects] content:\\n\" + object.content);\n * }\n */\n public async *listObjects(\n project: bigint,\n path: string,\n ignores: string[] = [],\n from?: bigint,\n to?: bigint\n ): AsyncGenerator<Objekt, void> {\n const parentContext = contextAPI.active();\n const span = tracer.startSpan(\n \"dateilager-grpc-client.list-objects\",\n {\n attributes: {\n \"dl.project\": String(project),\n \"dl.path\": path,\n \"dl.ignores\": ignores,\n \"dl.from_version\": String(from),\n \"dl.to_version\": String(to),\n },\n },\n parentContext\n );\n\n try {\n const call = contextAPI.with(traceAPI.setSpan(parentContext, span), () =>\n this._client.get(\n {\n project,\n fromVersion: from,\n toVersion: to,\n queries: [\n {\n path,\n ignores,\n isPrefix: true,\n subpaths: [],\n },\n ],\n },\n this._rpcOptions()\n )\n );\n\n for await (const response of call.responses) {\n if (response.object) {\n yield response.object;\n }\n }\n\n await call.status;\n } finally {\n span.end();\n }\n }\n\n /**\n * Get objects.\n * @param project The id of the project.\n * @param path The path to get objects under.\n * @param ignores The paths under {@link path} to ignore.\n * @param from The project version to start from.\n * @param to The project version to end at.\n * @returns All the objects under {@link path}.\n * @example\n * const response = await client.getObjects(1n, \"\");\n * for (const object of response.objects) {\n * console.log(\"[getObjects] path: \" + object.path);\n * console.log(\"[getObjects] content:\\n\" + object.content);\n * }\n */\n public async getObjects(project: bigint, path: string, ignores: string[] = [], from?: bigint, to?: bigint): Promise<GetUnaryResponse> {\n return await trace(\n \"dateilager-grpc-client.get-unary\",\n {\n attributes: {\n \"dl.project\": String(project),\n \"dl.path\": path,\n \"dl.ignores\": ignores,\n \"dl.from_version\": String(from),\n \"dl.to_version\": String(to),\n },\n },\n async () => {\n const call = this._client.getUnary(\n { project, fromVersion: from, toVersion: to, queries: [{ path, ignores, isPrefix: true, subpaths: [] }] },\n this._rpcOptions()\n );\n return await call.response;\n }\n );\n }\n\n /**\n * Get an object.\n * @param project The id of the project.\n * @param path The path of the object.\n * @param from The project version to start from.\n * @param to The project version to end at.\n * @returns The object at the given path or undefined if it does not exist.\n */\n public async getObject(project: bigint, path: string, from?: bigint, to?: bigint): Promise<Objekt | undefined> {\n return await trace(\n \"dateilager-grpc-client.get-object\",\n {\n attributes: {\n \"dl.project\": String(project),\n \"dl.path\": path,\n \"dl.from_version\": String(from),\n \"dl.to_version\": String(to),\n },\n },\n async () => {\n const call = this._client.get(\n {\n project,\n fromVersion: from,\n toVersion: to,\n queries: [\n {\n path,\n isPrefix: false,\n ignores: [],\n subpaths: [],\n },\n ],\n },\n this._rpcOptions()\n );\n\n let object: Objekt | undefined;\n for await (const response of call.responses) {\n object = response.object;\n }\n\n await call.status;\n\n return object;\n }\n );\n }\n\n /**\n * Update objects.\n * @param project The id of the project.\n * @returns An {@link UpdateInputStream} to send objects to update.\n */\n public updateObjects(project: bigint): UpdateInputStream {\n const parentContext = contextAPI.active();\n const span = tracer.startSpan(\n \"dateilager-grpc-client.update-objects\",\n {\n attributes: {\n \"dl.project\": String(project),\n },\n },\n parentContext\n );\n\n const call = contextAPI.with(traceAPI.setSpan(parentContext, span), () => this._client.update(this._rpcOptions()));\n\n return new UpdateInputStream(project, call, span);\n }\n\n /**\n * Update an object.\n * @param project The id of the project.\n * @param obj The object to update.\n * @returns The latest project version or `null` if something went wrong.\n */\n public async updateObject(project: bigint, obj: Objekt): Promise<bigint | null> {\n const stream = this.updateObjects(project);\n await stream.send(obj);\n return await stream.complete();\n }\n\n /**\n * Rollback a project.\n * @param project The id of the project.\n * @param version The version to rollback to.\n */\n public async rollbackProject(project: bigint, version: bigint): Promise<void> {\n await this._client.rollback({ project, version }, this._rpcOptions());\n }\n\n /**\n * Snapshot the current state of the dateilager server.\n * @returns All the projects on the dateilager server.\n * @throws If the dateilager server's DL_ENV environment variable is PROD.\n * @see DateiLagerGrpcClient.resetToSnapshotInDevOrTests\n */\n public async snapshotInDevOrTests(): Promise<Project[]> {\n const call = await this._client.snapshot({}, this._rpcOptions());\n return call.response.projects;\n }\n\n /**\n * Reset the given projects to their respective versions and delete any remaining projects.\n * If no projects are provided, delete all projects.\n * @param projects The projects to reset.\n * @throws If the dateilager server's DL_ENV environment variable is PROD.\n * @see DateiLagerGrpcClient.snapshotInDevOrTests\n */\n public async resetToSnapshotInDevOrTests(projects: Project[]): Promise<void> {\n await this._client.reset({ projects }, this._rpcOptions());\n }\n\n /**\n * Clones the `source` projects changes (from `fromVersion` up to `toVersion`) to the `target` project.\n * This method assumes that it is always a one way clone from source to target, it does not take into account\n * the changes that have occurred in the `target` project.\n * @param source The source project.\n * @param target The target project.\n * @param version The version of the source project to clone up to.\n * @returns The new version number of the target project.\n */\n public async cloneToProject(source: bigint, target: bigint, version: bigint): Promise<CloneToProjectResponse> {\n return await trace(\n \"dateilager-grpc-client.clone-to-project\",\n {\n attributes: {\n \"dl.source\": String(source),\n \"dl.target\": String(target),\n \"dl.version\": String(version),\n },\n },\n async () => {\n const call = await this._client.cloneToProject({ source, target, version }, this._rpcOptions());\n return call.response;\n }\n );\n }\n\n /**\n * GC project.\n * @param project The project to GC.\n * @param keep The amount of versions since the latest that should be kept.\n * @param from The starting version to GC from.\n * @returns The amount of objects that were GC'd.\n */\n public async gcProject(project: bigint, keep: bigint, from?: bigint): Promise<bigint> {\n const call = await this._client.gcProject({\n project: project,\n keepVersions: keep,\n fromVersion: from,\n });\n return call.response.count;\n }\n\n /**\n * GC random projects.\n * @param sample The percentage of projects to sample from.\n * @param keep The amount of versions since the latest that should be kept.\n * @param from The starting version to GC from.\n * @returns The amount of objects that were GC'd.\n */\n public async gcRandomProjects(sample: number, keep: bigint, from?: bigint): Promise<bigint> {\n const call = await this._client.gcRandomProjects({\n sample: sample,\n keepVersions: keep,\n fromVersion: from,\n });\n return call.response.count;\n }\n\n /**\n * GC contents.\n * @param sample The percentage of projects to sample from.\n * @returns The amount of objects that were GC'd.\n */\n public async gcContents(sample: number): Promise<bigint> {\n const call = await this._client.gcContents({\n sample: sample,\n });\n return call.response.count;\n }\n}\n\n/**\n * Used to send a stream of objects to update.\n * @see DateiLagerGrpcClient.updateObjects\n */\nclass UpdateInputStream {\n /** @internal */\n private readonly _project: bigint;\n\n /** @internal */\n private readonly _call: ClientStreamingCall<UpdateRequest, UpdateResponse>;\n\n /** @internal */\n private readonly _span: Span;\n\n public constructor(project: bigint, call: ClientStreamingCall<UpdateRequest, UpdateResponse>, span: Span) {\n this._project = project;\n this._call = call;\n this._span = span;\n }\n\n /**\n * Send an object to update.\n * @param obj The object to update.\n */\n public async send(obj: Objekt): Promise<void> {\n try {\n await this._call.requests.send({\n project: this._project,\n object: obj,\n });\n } catch (err) {\n this._span.end();\n throw err;\n }\n }\n\n /**\n * Complete the update request.\n * @returns The latest project version or `null` if something went wrong.\n */\n public async complete(): Promise<bigint | null> {\n try {\n await this._call.requests.complete();\n const response = await this._call.response;\n return response.version != -1n ? response.version : null;\n } finally {\n this._span.end();\n }\n }\n}\n\nconst encoder = new TextEncoder();\n\n/**\n * Encode string object contents as an array of bytes.\n * @param content The string to encode.\n * @returns The encoded content as an array of bytes.\n */\nexport function encodeContent(content: string): Uint8Array {\n return encoder.encode(content);\n}\n\nconst decoder = new TextDecoder();\n\n/**\n * Decode an array of bytes as an object's string contents.\n * @param bytes The array of bytes to decode.\n * @returns The bytes decoded into a string.\n */\nexport function decodeContent(bytes: Uint8Array | undefined): string {\n return decoder.decode(bytes);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"grpc-client.js","sourceRoot":"","sources":["../../src/grpc-client.ts"],"names":[],"mappings":";;;AACA,2CAA0E;AAE1E,4CAA8E;AAC9E,gEAA4D;AAC5D,0DAA+F;AAC/F,+BAAgD;AAChD,oDAAqD;AAErD,oDAA6C;AAC7C,2CAA2D;AA0C3D;;;;;GAKG;AACH,MAAa,oBAAoB;IAU/B;;;;OAIG;IACH,YAAmB,OAAoC;QAdvD,gBAAgB;QACC;;;;;WAAkB;QAEnC,gBAAgB;QACC;;;;;WAA0B;QAE3C,gBAAgB;QACC;;;;;WAA0C;QAQzD,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,KAAe,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;QAEnH,IAAI,CAAC,UAAU,GAAG,IAAI,8BAAa,CAAC;YAClC,IAAI,EAAE,OAAO,OAAO,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC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AQ,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;QAC3D,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;QACnB,CAAC;IACH,CAAC;CACF;AAED,MAAM,OAAO,GAAG,IAAI,kBAAW,EAAE,CAAC;AAElC;;;;GAIG;AACH,SAAgB,aAAa,CAAC,OAAe;IAC3C,OAAO,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC;AAFD,sCAEC;AAED,MAAM,OAAO,GAAG,IAAI,kBAAW,EAAE,CAAC;AAElC;;;;GAIG;AACH,SAAgB,aAAa,CAAC,KAA6B;IACzD,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC;AAFD,sCAEC","sourcesContent":["import type { ClientOptions } from \"@grpc/grpc-js\";\nimport { ChannelCredentials, credentials, Metadata } from \"@grpc/grpc-js\";\nimport type { Span } from \"@opentelemetry/api\";\nimport { context as contextAPI, trace as traceAPI } from \"@opentelemetry/api\";\nimport { GrpcTransport } from \"@protobuf-ts/grpc-transport\";\nimport { RpcError, type ClientStreamingCall, type RpcOptions } from \"@protobuf-ts/runtime-rpc\";\nimport { TextDecoder, TextEncoder } from \"util\";\nimport { trace, tracer } from \"./internal/telemetry\";\nimport type { CloneToProjectResponse, GetUnaryResponse, Objekt, Project, UpdateRequest, UpdateResponse } from \"./pb/fs_pb\";\nimport { FsClient } from \"./pb/fs_pb.client\";\nimport { ProjectAlreadyExistsError } from \"./utils/errors\";\nexport type { Objekt, Project };\n\n/**\n * Options for {@link DateiLagerGrpcClient}.\n */\nexport interface DateiLagerGrpcClientOptions {\n /**\n * The address of the dateilager server.\n */\n server:\n | string\n | {\n /**\n * The host of the dateilager server.\n */\n host: string;\n\n /**\n * The port of the dateilager server.\n */\n port: number;\n };\n\n /**\n * The token that will be sent as authorization metadata to the dateilager server.\n */\n token: string | (() => Promise<string>);\n\n /**\n * Options that will be passed to the underlying grpc client constructor.\n * @see ClientOptions\n */\n grpcClientOptions?: ClientOptions;\n\n /**\n * Options that will be passed to every remote procedure call.\n * @see RpcOptions\n */\n rpcOptions?: RpcOptions | (() => RpcOptions | undefined);\n}\n\n/**\n * A client class for interacting with DateiLager's GRPC API.\n *\n * The DateiLager API surface area is as minimal as possible;\n * convenience functions, such as getObject, should be implemented within the client.\n */\nexport class DateiLagerGrpcClient {\n /** @internal */\n private readonly _client: FsClient;\n\n /** @internal */\n private readonly _transport: GrpcTransport;\n\n /** @internal */\n private readonly _rpcOptions: () => RpcOptions | undefined;\n\n /**\n * The library used to interact with GRPC creates connections lazily, this constructor will not\n * raise an error even if there is no service running at {@link DateiLagerGrpcClientOptions.server server}.\n * @param options Grpc client options.\n */\n public constructor(options: DateiLagerGrpcClientOptions) {\n const tokenFn = typeof options.token === \"string\" ? () => Promise.resolve(options.token as string) : options.token;\n\n this._transport = new GrpcTransport({\n host: typeof options.server === \"string\" ? options.server : `${options.server.host}:${options.server.port}`,\n channelCredentials: credentials.combineChannelCredentials(\n ChannelCredentials.createSsl(),\n credentials.createFromMetadataGenerator((_, callback) => {\n tokenFn()\n .then((token) => {\n const meta = new Metadata();\n meta.add(\"authorization\", `Bearer ${token}`);\n callback(null, meta);\n })\n .catch(callback);\n })\n ),\n clientOptions: {\n \"grpc.keepalive_time_ms\": 5_000,\n \"grpc.keepalive_timeout_ms\": 1_000,\n \"grpc.keepalive_permit_without_calls\": 1,\n ...options.grpcClientOptions,\n },\n });\n\n this._client = new FsClient(this._transport);\n\n this._rpcOptions = options.rpcOptions instanceof Function ? options.rpcOptions : () => options.rpcOptions as RpcOptions | undefined;\n }\n\n /**\n * Close the underlying GRPC client.\n */\n public close(): void {\n this._transport.close();\n }\n\n /**\n * Create a new project.\n * @param project The id of the project.\n * @param packPatterns The paths to pack.\n * @param template The id of the project to start from.\n */\n public async newProject(project: bigint, packPatterns: string[], template?: bigint): Promise<void> {\n try {\n await trace(\n \"dateilager-grpc-client.new-project\",\n {\n attributes: {\n \"dl.project\": String(project),\n \"dl.pack_patterns\": packPatterns,\n \"dl.template\": String(template),\n },\n },\n () => this._client.newProject({ id: project, packPatterns, template }, this._rpcOptions())\n );\n } catch (error) {\n if (error instanceof RpcError && error.code == \"ALREADY_EXISTS\") {\n throw new ProjectAlreadyExistsError(`project id ${project} already exists`);\n }\n throw error;\n }\n }\n\n /**\n * Delete a project.\n * @param project The id of the project.\n */\n public async deleteProject(project: bigint): Promise<void> {\n await trace(\n \"dateilager-grpc-client.delete-project\",\n {\n attributes: {\n \"dl.project\": String(project),\n },\n },\n () => this._client.deleteProject({ project }, this._rpcOptions())\n );\n }\n\n /**\n * List objects.\n * @param project The id of the project.\n * @param path The path to list objects under.\n * @param ignores The paths under {@link path} to ignore.\n * @param from The project version to start from.\n * @param to The project version to end at.\n * @returns A stream of objects.\n * @yields An object from the stream.\n * @example\n * for await (const object of client.listObjects(1n, \"\")) {\n * console.log(\"[listObjects] path: \" + object.path);\n * console.log(\"[listObjects] content:\\n\" + object.content);\n * }\n */\n public async *listObjects(\n project: bigint,\n path: string,\n ignores: string[] = [],\n from?: bigint,\n to?: bigint\n ): AsyncGenerator<Objekt, void> {\n const parentContext = contextAPI.active();\n const span = tracer.startSpan(\n \"dateilager-grpc-client.list-objects\",\n {\n attributes: {\n \"dl.project\": String(project),\n \"dl.path\": path,\n \"dl.ignores\": ignores,\n \"dl.from_version\": String(from),\n \"dl.to_version\": String(to),\n },\n },\n parentContext\n );\n\n try {\n const call = contextAPI.with(traceAPI.setSpan(parentContext, span), () =>\n this._client.get(\n {\n project,\n fromVersion: from,\n toVersion: to,\n queries: [\n {\n path,\n ignores,\n isPrefix: true,\n subpaths: [],\n },\n ],\n },\n this._rpcOptions()\n )\n );\n\n for await (const response of call.responses) {\n if (response.object) {\n yield response.object;\n }\n }\n\n await call.status;\n } finally {\n span.end();\n }\n }\n\n /**\n * Get objects.\n * @param project The id of the project.\n * @param path The path to get objects under.\n * @param ignores The paths under {@link path} to ignore.\n * @param from The project version to start from.\n * @param to The project version to end at.\n * @param maxSize The maximum file size at which the content of the file is sent for.\n * @returns All the objects under {@link path}.\n * @example\n * const response = await client.getObjects(1n, \"\");\n * for (const object of response.objects) {\n * console.log(\"[getObjects] path: \" + object.path);\n * console.log(\"[getObjects] content:\\n\" + object.content);\n * }\n */\n public async getObjects(\n project: bigint,\n path: string,\n ignores: string[] = [],\n from?: bigint,\n to?: bigint,\n maxSize?: bigint\n ): Promise<GetUnaryResponse> {\n return await trace(\n \"dateilager-grpc-client.get-unary\",\n {\n attributes: {\n \"dl.project\": String(project),\n \"dl.path\": path,\n \"dl.ignores\": ignores,\n \"dl.from_version\": String(from),\n \"dl.to_version\": String(to),\n \"dl.max_content_send_size\": String(maxSize),\n },\n },\n async () => {\n const call = this._client.getUnary(\n {\n project,\n fromVersion: from,\n toVersion: to,\n queries: [{ path, ignores, isPrefix: true, subpaths: [] }],\n maxContentSendSize: maxSize,\n },\n this._rpcOptions()\n );\n return await call.response;\n }\n );\n }\n\n /**\n * Get an object.\n * @param project The id of the project.\n * @param path The path of the object.\n * @param from The project version to start from.\n * @param to The project version to end at.\n * @returns The object at the given path or undefined if it does not exist.\n */\n public async getObject(project: bigint, path: string, from?: bigint, to?: bigint): Promise<Objekt | undefined> {\n return await trace(\n \"dateilager-grpc-client.get-object\",\n {\n attributes: {\n \"dl.project\": String(project),\n \"dl.path\": path,\n \"dl.from_version\": String(from),\n \"dl.to_version\": String(to),\n },\n },\n async () => {\n const call = this._client.get(\n {\n project,\n fromVersion: from,\n toVersion: to,\n queries: [\n {\n path,\n isPrefix: false,\n ignores: [],\n subpaths: [],\n },\n ],\n },\n this._rpcOptions()\n );\n\n let object: Objekt | undefined;\n for await (const response of call.responses) {\n object = response.object;\n }\n\n await call.status;\n\n return object;\n }\n );\n }\n\n /**\n * Update objects.\n * @param project The id of the project.\n * @returns An {@link UpdateInputStream} to send objects to update.\n */\n public updateObjects(project: bigint): UpdateInputStream {\n const parentContext = contextAPI.active();\n const span = tracer.startSpan(\n \"dateilager-grpc-client.update-objects\",\n {\n attributes: {\n \"dl.project\": String(project),\n },\n },\n parentContext\n );\n\n const call = contextAPI.with(traceAPI.setSpan(parentContext, span), () => this._client.update(this._rpcOptions()));\n\n return new UpdateInputStream(project, call, span);\n }\n\n /**\n * Update an object.\n * @param project The id of the project.\n * @param obj The object to update.\n * @returns The latest project version or `null` if something went wrong.\n */\n public async updateObject(project: bigint, obj: Objekt): Promise<bigint | null> {\n const stream = this.updateObjects(project);\n await stream.send(obj);\n return await stream.complete();\n }\n\n /**\n * Rollback a project.\n * @param project The id of the project.\n * @param version The version to rollback to.\n */\n public async rollbackProject(project: bigint, version: bigint): Promise<void> {\n await this._client.rollback({ project, version }, this._rpcOptions());\n }\n\n /**\n * Snapshot the current state of the dateilager server.\n * @returns All the projects on the dateilager server.\n * @throws If the dateilager server's DL_ENV environment variable is PROD.\n * @see DateiLagerGrpcClient.resetToSnapshotInDevOrTests\n */\n public async snapshotInDevOrTests(): Promise<Project[]> {\n const call = await this._client.snapshot({}, this._rpcOptions());\n return call.response.projects;\n }\n\n /**\n * Reset the given projects to their respective versions and delete any remaining projects.\n * If no projects are provided, delete all projects.\n * @param projects The projects to reset.\n * @throws If the dateilager server's DL_ENV environment variable is PROD.\n * @see DateiLagerGrpcClient.snapshotInDevOrTests\n */\n public async resetToSnapshotInDevOrTests(projects: Project[]): Promise<void> {\n await this._client.reset({ projects }, this._rpcOptions());\n }\n\n /**\n * Clones the `source` projects changes (from `fromVersion` up to `toVersion`) to the `target` project.\n * This method assumes that it is always a one way clone from source to target, it does not take into account\n * the changes that have occurred in the `target` project.\n * @param source The source project.\n * @param target The target project.\n * @param version The version of the source project to clone up to.\n * @returns The new version number of the target project.\n */\n public async cloneToProject(source: bigint, target: bigint, version: bigint): Promise<CloneToProjectResponse> {\n return await trace(\n \"dateilager-grpc-client.clone-to-project\",\n {\n attributes: {\n \"dl.source\": String(source),\n \"dl.target\": String(target),\n \"dl.version\": String(version),\n },\n },\n async () => {\n const call = await this._client.cloneToProject({ source, target, version }, this._rpcOptions());\n return call.response;\n }\n );\n }\n\n /**\n * GC project.\n * @param project The project to GC.\n * @param keep The amount of versions since the latest that should be kept.\n * @param from The starting version to GC from.\n * @returns The amount of objects that were GC'd.\n */\n public async gcProject(project: bigint, keep: bigint, from?: bigint): Promise<bigint> {\n const call = await this._client.gcProject({\n project: project,\n keepVersions: keep,\n fromVersion: from,\n });\n return call.response.count;\n }\n\n /**\n * GC random projects.\n * @param sample The percentage of projects to sample from.\n * @param keep The amount of versions since the latest that should be kept.\n * @param from The starting version to GC from.\n * @returns The amount of objects that were GC'd.\n */\n public async gcRandomProjects(sample: number, keep: bigint, from?: bigint): Promise<bigint> {\n const call = await this._client.gcRandomProjects({\n sample: sample,\n keepVersions: keep,\n fromVersion: from,\n });\n return call.response.count;\n }\n\n /**\n * GC contents.\n * @param sample The percentage of projects to sample from.\n * @returns The amount of objects that were GC'd.\n */\n public async gcContents(sample: number): Promise<bigint> {\n const call = await this._client.gcContents({\n sample: sample,\n });\n return call.response.count;\n }\n}\n\n/**\n * Used to send a stream of objects to update.\n * @see DateiLagerGrpcClient.updateObjects\n */\nclass UpdateInputStream {\n /** @internal */\n private readonly _project: bigint;\n\n /** @internal */\n private readonly _call: ClientStreamingCall<UpdateRequest, UpdateResponse>;\n\n /** @internal */\n private readonly _span: Span;\n\n public constructor(project: bigint, call: ClientStreamingCall<UpdateRequest, UpdateResponse>, span: Span) {\n this._project = project;\n this._call = call;\n this._span = span;\n }\n\n /**\n * Send an object to update.\n * @param obj The object to update.\n */\n public async send(obj: Objekt): Promise<void> {\n try {\n await this._call.requests.send({\n project: this._project,\n object: obj,\n });\n } catch (err) {\n this._span.end();\n throw err;\n }\n }\n\n /**\n * Complete the update request.\n * @returns The latest project version or `null` if something went wrong.\n */\n public async complete(): Promise<bigint | null> {\n try {\n await this._call.requests.complete();\n const response = await this._call.response;\n return response.version != -1n ? response.version : null;\n } finally {\n this._span.end();\n }\n }\n}\n\nconst encoder = new TextEncoder();\n\n/**\n * Encode string object contents as an array of bytes.\n * @param content The string to encode.\n * @returns The encoded content as an array of bytes.\n */\nexport function encodeContent(content: string): Uint8Array {\n return encoder.encode(content);\n}\n\nconst decoder = new TextDecoder();\n\n/**\n * Decode an array of bytes as an object's string contents.\n * @param bytes The array of bytes to decode.\n * @returns The bytes decoded into a string.\n */\nexport function decodeContent(bytes: Uint8Array | undefined): string {\n return decoder.decode(bytes);\n}\n"]}
|
package/dist/cjs/pb/fs_pb.d.ts
CHANGED
|
@@ -225,6 +225,10 @@ export interface GetUnaryRequest {
|
|
|
225
225
|
* @generated from protobuf field: repeated pb.ObjectQuery queries = 4;
|
|
226
226
|
*/
|
|
227
227
|
queries: ObjectQuery[];
|
|
228
|
+
/**
|
|
229
|
+
* @generated from protobuf field: optional int64 max_content_send_size = 5;
|
|
230
|
+
*/
|
|
231
|
+
maxContentSendSize?: bigint;
|
|
228
232
|
}
|
|
229
233
|
/**
|
|
230
234
|
* @generated from protobuf message pb.GetUnaryResponse
|
package/dist/cjs/pb/fs_pb.js
CHANGED
|
@@ -751,7 +751,8 @@ class GetUnaryRequest$Type extends runtime_4.MessageType {
|
|
|
751
751
|
{ no: 1, name: "project", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
|
|
752
752
|
{ no: 2, name: "from_version", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
|
|
753
753
|
{ no: 3, name: "to_version", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
|
|
754
|
-
{ no: 4, name: "queries", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => exports.ObjectQuery }
|
|
754
|
+
{ no: 4, name: "queries", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => exports.ObjectQuery },
|
|
755
|
+
{ no: 5, name: "max_content_send_size", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }
|
|
755
756
|
]);
|
|
756
757
|
}
|
|
757
758
|
create(value) {
|
|
@@ -779,6 +780,9 @@ class GetUnaryRequest$Type extends runtime_4.MessageType {
|
|
|
779
780
|
case /* repeated pb.ObjectQuery queries */ 4:
|
|
780
781
|
message.queries.push(exports.ObjectQuery.internalBinaryRead(reader, reader.uint32(), options));
|
|
781
782
|
break;
|
|
783
|
+
case /* optional int64 max_content_send_size */ 5:
|
|
784
|
+
message.maxContentSendSize = reader.int64().toBigInt();
|
|
785
|
+
break;
|
|
782
786
|
default:
|
|
783
787
|
let u = options.readUnknownField;
|
|
784
788
|
if (u === "throw")
|
|
@@ -803,6 +807,9 @@ class GetUnaryRequest$Type extends runtime_4.MessageType {
|
|
|
803
807
|
/* repeated pb.ObjectQuery queries = 4; */
|
|
804
808
|
for (let i = 0; i < message.queries.length; i++)
|
|
805
809
|
exports.ObjectQuery.internalBinaryWrite(message.queries[i], writer.tag(4, runtime_1.WireType.LengthDelimited).fork(), options).join();
|
|
810
|
+
/* optional int64 max_content_send_size = 5; */
|
|
811
|
+
if (message.maxContentSendSize !== undefined)
|
|
812
|
+
writer.tag(5, runtime_1.WireType.Varint).int64(message.maxContentSendSize);
|
|
806
813
|
let u = options.writeUnknownFields;
|
|
807
814
|
if (u !== false)
|
|
808
815
|
(u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|