@gadgetinc/dateilager 0.6.0 → 0.7.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.
@@ -5,7 +5,7 @@ export interface DateiLagerBinaryClientOptions {
5
5
  /**
6
6
  * The address of the dateilager server.
7
7
  */
8
- server: string | {
8
+ server: {
9
9
  /**
10
10
  * The host of the dateilager server.
11
11
  */
@@ -13,7 +13,11 @@ export interface DateiLagerBinaryClientOptions {
13
13
  /**
14
14
  * The port of the dateilager server.
15
15
  */
16
- port: number;
16
+ port?: number;
17
+ /**
18
+ * The GRPC headless service hostname, used for load balancing across multiple servers.
19
+ */
20
+ headlessHost?: string;
17
21
  };
18
22
  /**
19
23
  * The token that will be sent as authorization metadata to the dateilager server.
@@ -27,7 +27,9 @@ class DateiLagerBinaryClient {
27
27
  value: void 0
28
28
  });
29
29
  this._options = {
30
- server: typeof options.server === "string" ? options.server : `${options.server.host}:${options.server.port}`,
30
+ host: options.server.host,
31
+ port: options.server.port ?? 5051,
32
+ headlessHost: options.server.headlessHost,
31
33
  token: typeof options.token === "string" ? () => Promise.resolve(options.token) : options.token,
32
34
  command: options.command ?? "dateilager-client",
33
35
  timeout: typeof options.timeout === "number"
@@ -186,10 +188,13 @@ class DateiLagerBinaryClient {
186
188
  }
187
189
  /** @internal */
188
190
  async _call(method, args, cwd, options) {
189
- const baseArgs = [method, "--server", this._options.server, "--log-encoding", "json"];
191
+ const baseArgs = [method, "--host", this._options.host, "--port", String(this._options.port), "--log-encoding", "json"];
190
192
  if (this._options.logger) {
191
193
  baseArgs.push("--log-level", this._options.logger.level);
192
194
  }
195
+ if (this._options.headlessHost) {
196
+ baseArgs.push("--headless-host", this._options.headlessHost);
197
+ }
193
198
  if (this._options.tracing) {
194
199
  const carrier = {};
195
200
  api_1.propagation.inject(api_1.context.active(), carrier);
@@ -1 +1 @@
1
- {"version":3,"file":"binary-client.js","sourceRoot":"","sources":["../../src/binary-client.ts"],"names":[],"mappings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ry/api\";\nimport type { ExecaReturnValue } from \"execa\";\nimport execa from \"execa\";\nimport fs from \"fs/promises\";\nimport readline from \"readline\";\nimport { trace } from \"./internal/telemetry\";\n\n/**\n * Options for {@link DateiLagerBinaryClient}.\n */\nexport interface DateiLagerBinaryClientOptions {\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 * The path to the dateilager-client executable.\n *\n * @default \"dateilager-client\"\n */\n command?: string;\n\n /**\n * The default number of milliseconds to wait before terminating any command.\n *\n * @default 0 No timeout.\n */\n timeout?:\n | number\n | {\n /**\n * The default number of milliseconds to wait before terminating the update command.\n *\n * @default 0 No timeout.\n */\n update?: number;\n\n /**\n * The default number of milliseconds to wait before terminating the rebuild command.\n *\n * @default 0 No timeout.\n */\n rebuild?: number;\n\n /**\n * The default number of milliseconds to wait before terminating the gc command.\n *\n * @default 0 No timeout.\n */\n gc?: number;\n };\n\n /**\n * Whether the dateilager binary client should enable tracing.\n *\n * @default false\n */\n tracing?: boolean;\n\n /**\n * Logging configuration.\n */\n logger?: {\n /**\n * The log level to pass to the dateilager binary client.\n */\n level: \"debug\" | \"info\" | \"warn\" | \"error\";\n\n /**\n * The function that will be called when the dateilager binary client logs something.\n */\n log: (level: \"debug\" | \"info\" | \"warn\" | \"error\", msg: string, fields: Record<string, unknown>) => void;\n };\n}\n\n/**\n * The version of the filesystem after the call to rebuild.\n *\n * If a file pattern was included then patternDetected can be used to know if that filepattern was seen while rebuilding.\n */\nexport interface RebuildResult {\n /**\n * Filesystem version.\n */\n version: bigint;\n /**\n * Files updated by the rebuild operation.\n */\n count: number;\n /**\n * Whether or not the file match was detected.\n */\n fileMatch: boolean;\n}\n\n/**\n * The Result from calling the Dateilager Garbage Compiler\n */\nexport interface GCResult {\n /**\n * The number of records garbage collected\n */\n count: number;\n}\n\n/**\n * A version of the DateiLager client that uses the compiled binary client instead of the Javascript one.\n *\n * Useful for working directly with a real filesystem instead of in memory objects.\n */\nexport class DateiLagerBinaryClient {\n /** @internal */\n private readonly _options;\n\n /**\n * @param options An object with {@link DateiLagerBinaryClientOptions options}.\n */\n public constructor(options: DateiLagerBinaryClientOptions) {\n this._options = {\n server: typeof options.server === \"string\" ? options.server : `${options.server.host}:${options.server.port}`,\n token: typeof options.token === \"string\" ? () => Promise.resolve(options.token as string) : options.token,\n command: options.command ?? \"dateilager-client\",\n timeout:\n typeof options.timeout === \"number\"\n ? {\n update: options.timeout,\n rebuild: options.timeout,\n }\n : {\n update: 0,\n rebuild: 0,\n ...options.timeout,\n },\n tracing: options.tracing ?? false,\n logger: options.logger,\n };\n }\n\n /**\n * Update objects in a project based on the differences in a local directory.\n *\n * @param project The id of the project.\n * @param directory The path of the directory to send updates from.\n * @param options Object of options.\n * @param options.timeout Number of milliseconds to wait before terminating the process.\n * @returns The latest project version or `null` if something went wrong.\n */\n public async update(project: bigint, directory: string, options?: { timeout?: number }): Promise<bigint | null> {\n return await trace(\n \"dateilager-binary-client.update\",\n {\n attributes: {\n \"dl.project\": String(project),\n \"dl.directory\": directory,\n },\n },\n async () => {\n const args = [\"--dir\", String(directory), \"--project\", String(project)];\n const result = await this._call(\"update\", args, directory, options);\n\n if (result.stdout == \"-1\") {\n return null;\n }\n\n return BigInt(result.stdout);\n }\n );\n }\n\n /**\n * Rebuild the local filesystem.\n *\n * @param project The id of the project.\n * @param to The version of the project to rebuild the filesystem to.\n * @param directory The path of the directory to rebuild the filesystem at.\n * @param options Object of options.\n * @param options.timeout Number of milliseconds to wait before terminating the process.\n * @param options.ignores The paths to ignore when rebuilding the FS.\n * @param options.summarize Should produce the summary file after rebuilding.\n * @param options.cacheDir Path where the cache directory is mounted.\n * @param options.matchInclude Set fileMatch to true if the written files are matched by this glob pattern\n * @param options.matchExclude Set fileMatch to false if the written files are matched by this glob pattern\n * @returns The latest project version or `null` if something went wrong.\n */\n public async rebuild(\n project: bigint,\n to: bigint | null,\n directory: string,\n options?: {\n timeout?: number;\n ignores?: string[];\n summarize?: boolean;\n cacheDir?: string;\n matchInclude?: string;\n matchExclude?: string;\n }\n ): Promise<RebuildResult> {\n return await trace(\n \"dateilager-binary-client.rebuild\",\n {\n attributes: {\n \"dl.project\": String(project),\n \"dl.to\": String(to),\n \"dl.directory\": directory,\n },\n },\n async () => {\n await fs.mkdir(directory, { recursive: true });\n\n const args = [\"--dir\", directory];\n if (to) {\n args.push(\"--to\", String(to));\n }\n\n if (options?.ignores) {\n args.push(\"--ignores\", options.ignores.join(\",\"));\n }\n\n if (options?.summarize === false) {\n args.push(\"--summarize=false\");\n }\n\n if (options?.cacheDir) {\n args.push(`--cachedir=${options.cacheDir}`);\n }\n\n if (options?.matchInclude) {\n args.push(`--matchinclude=${options.matchInclude}`);\n }\n\n if (options?.matchExclude) {\n args.push(`--matchexclude=${options.matchExclude}`);\n }\n\n args.push(\"--project\", String(project), \"--dir\", directory);\n const result = await this._call(\"rebuild\", args, directory, options);\n const parsed = JSON.parse(result.stdout) as { version: number; count: number; fileMatch: boolean };\n return { version: BigInt(parsed.version), count: parsed.count, fileMatch: parsed.fileMatch };\n }\n );\n }\n\n /**\n * @param sample sample size of cleanup\n * @param keep The amount of records to keep\n * @param from Where to start cleanup\n * @param options dict options passed\n * @param options.timeout timeout limit for the request\n */\n public async gcRandomProjects(sample: number, keep: number, from?: number, options?: { timeout?: number }): Promise<GCResult> {\n return await trace(\n \"dateilager-binary-client.gc\",\n {\n attributes: {\n \"db.mode\": \"random-projects\",\n \"dl.keep\": String(keep),\n \"dl.from\": String(from),\n \"dl.sample\": String(sample),\n },\n },\n async () => {\n const args = [\"--mode\", \"random-projects\", \"--keep\", String(keep), \"--sample\", String(sample)];\n\n if (from) args.push(\"--from\", String(from));\n\n const result = await this._call(\"gc\", args, undefined, options);\n const parsed = JSON.parse(result.stdout) as { count: number };\n return { count: parsed.count };\n }\n );\n }\n\n /**\n *\n * @param project The selected project to cleanup\n * @param keep The amount of records to keep\n * @param from Where to start cleanup\n * @param options dict options passed\n * @param options.timeout timeout limit for the request\n */\n public async gcProject(project: number, keep: number, from?: number, options?: { timeout?: number }): Promise<GCResult> {\n return await trace(\n \"dateilager-binary-client.gc\",\n {\n attributes: {\n \"db.mode\": \"project\",\n \"dl.keep\": String(keep),\n \"dl.from\": String(from),\n },\n },\n async () => {\n const args = [\"--mode\", \"project\", \"--keep\", String(keep), \"--project\", String(project)];\n\n if (from) args.push(\"--from\", String(from));\n\n const result = await this._call(\"gc\", args, undefined, options);\n const parsed = JSON.parse(result.stdout) as { count: number };\n return { count: parsed.count };\n }\n );\n }\n\n /**\n *\n * @param sample sample size of cleanup\n * @param options dict options passed\n * @param options.timeout timeout limit for the request\n */\n public async gcContents(sample: number, options?: { timeout?: number }): Promise<GCResult> {\n return await trace(\n \"dateilager-binary-client.gc\",\n {\n attributes: {\n \"db.mode\": \"contents\",\n \"dl.sample\": String(sample),\n },\n },\n async () => {\n const args = [\"--mode\", \"contents\", \"--sample\", String(sample)];\n\n const result = await this._call(\"gc\", args, undefined, options);\n const parsed = JSON.parse(result.stdout) as { count: number };\n return { count: parsed.count };\n }\n );\n }\n\n /** @internal */\n private async _call(\n method: \"update\" | \"rebuild\" | \"gc\",\n args: string[],\n cwd?: string,\n options?: { timeout?: number }\n ): Promise<ExecaReturnValue> {\n const baseArgs = [method, \"--server\", this._options.server, \"--log-encoding\", \"json\"];\n\n if (this._options.logger) {\n baseArgs.push(\"--log-level\", this._options.logger.level);\n }\n\n if (this._options.tracing) {\n const carrier = {};\n propagation.inject(context.active(), carrier);\n const otelContext = JSON.stringify(carrier);\n\n baseArgs.push(\"--tracing\", \"--otel-context\", otelContext);\n }\n const subprocess = execa(this._options.command, baseArgs.concat(args), {\n cwd,\n timeout: options?.timeout ?? this._options.timeout[method],\n env: { DL_TOKEN: await this._options.token() },\n });\n\n if (this._options.logger && subprocess.stderr) {\n readline.createInterface(subprocess.stderr).on(\"line\", (line) => {\n try {\n // we purposefully extract and ignore the `ts` field\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { level, msg, ts, ...fields } = JSON.parse(line) as {\n [key: string]: unknown;\n level: \"debug\" | \"info\" | \"warn\" | \"error\";\n msg: string;\n ts: string | number;\n };\n\n this._options.logger?.log(level, msg, fields);\n } catch (error) {\n this._options.logger?.log(\"warn\", \"failed to log line\", { error, line });\n }\n });\n }\n\n return subprocess;\n }\n}\n"]}
1
+ {"version":3,"file":"binary-client.js","sourceRoot":"","sources":["../../src/binary-client.ts"],"names":[],"mappings":";;;;;;AAAA,4CAA0D;AAE1D,kDAA0B;AAC1B,2DAA6B;AAC7B,wDAAgC;AAChC,oDAA6C;AAyH7C;;;;GAIG;AACH,MAAa,sBAAsB;IAIjC;;OAEG;IACH,YAAmB,OAAsC;QANzD,gBAAgB;QAChB;;;;;WAA0B;QAMxB,IAAI,CAAC,QAAQ,GAAG;YACd,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI;YACzB,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,IAAI,IAAI;YACjC,YAAY,EAAE,OAAO,CAAC,MAAM,CAAC,YAAY;YACzC,KAAK,EAAE,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;YACzG,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,mBAAmB;YAC/C,OAAO,EACL,OAAO,OAAO,CAAC,OAAO,KAAK,QAAQ;gBACjC,CAAC,CAAC;oBACE,MAAM,EAAE,OAAO,CAAC,OAAO;oBACvB,OAAO,EAAE,OAAO,CAAC,OAAO;iBACzB;gBACH,CAAC,CAAC;oBACE,MAAM,EAAE,CAAC;oBACT,OAAO,EAAE,CAAC;oBACV,GAAG,OAAO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E,CAAC,IAAI,EAAE,EAAE;gBAC9D,IAAI;oBACF,oDAAoD;oBACpD,6DAA6D;oBAC7D,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAKpD,CAAC;oBAEF,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;iBAC/C;gBAAC,OAAO,KAAK,EAAE;oBACd,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,oBAAoB,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;iBAC1E;YACH,CAAC,CAAC,CAAC;SACJ;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;CACF;AA9QD,wDA8QC","sourcesContent":["import { context, propagation } from \"@opentelemetry/api\";\nimport type { ExecaReturnValue } from \"execa\";\nimport execa from \"execa\";\nimport fs from \"fs/promises\";\nimport readline from \"readline\";\nimport { trace } from \"./internal/telemetry\";\n\n/**\n * Options for {@link DateiLagerBinaryClient}.\n */\nexport interface DateiLagerBinaryClientOptions {\n /**\n * The address of the dateilager server.\n */\n server: {\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 * The GRPC headless service hostname, used for load balancing across multiple servers.\n */\n headlessHost?: string;\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 * The path to the dateilager-client executable.\n *\n * @default \"dateilager-client\"\n */\n command?: string;\n\n /**\n * The default number of milliseconds to wait before terminating any command.\n *\n * @default 0 No timeout.\n */\n timeout?:\n | number\n | {\n /**\n * The default number of milliseconds to wait before terminating the update command.\n *\n * @default 0 No timeout.\n */\n update?: number;\n\n /**\n * The default number of milliseconds to wait before terminating the rebuild command.\n *\n * @default 0 No timeout.\n */\n rebuild?: number;\n\n /**\n * The default number of milliseconds to wait before terminating the gc command.\n *\n * @default 0 No timeout.\n */\n gc?: number;\n };\n\n /**\n * Whether the dateilager binary client should enable tracing.\n *\n * @default false\n */\n tracing?: boolean;\n\n /**\n * Logging configuration.\n */\n logger?: {\n /**\n * The log level to pass to the dateilager binary client.\n */\n level: \"debug\" | \"info\" | \"warn\" | \"error\";\n\n /**\n * The function that will be called when the dateilager binary client logs something.\n */\n log: (level: \"debug\" | \"info\" | \"warn\" | \"error\", msg: string, fields: Record<string, unknown>) => void;\n };\n}\n\n/**\n * The version of the filesystem after the call to rebuild.\n *\n * If a file pattern was included then patternDetected can be used to know if that filepattern was seen while rebuilding.\n */\nexport interface RebuildResult {\n /**\n * Filesystem version.\n */\n version: bigint;\n /**\n * Files updated by the rebuild operation.\n */\n count: number;\n /**\n * Whether or not the file match was detected.\n */\n fileMatch: boolean;\n}\n\n/**\n * The Result from calling the Dateilager Garbage Compiler\n */\nexport interface GCResult {\n /**\n * The number of records garbage collected\n */\n count: number;\n}\n\n/**\n * A version of the DateiLager client that uses the compiled binary client instead of the Javascript one.\n *\n * Useful for working directly with a real filesystem instead of in memory objects.\n */\nexport class DateiLagerBinaryClient {\n /** @internal */\n private readonly _options;\n\n /**\n * @param options An object with {@link DateiLagerBinaryClientOptions options}.\n */\n public constructor(options: DateiLagerBinaryClientOptions) {\n this._options = {\n host: options.server.host,\n port: options.server.port ?? 5051,\n headlessHost: options.server.headlessHost,\n token: typeof options.token === \"string\" ? () => Promise.resolve(options.token as string) : options.token,\n command: options.command ?? \"dateilager-client\",\n timeout:\n typeof options.timeout === \"number\"\n ? {\n update: options.timeout,\n rebuild: options.timeout,\n }\n : {\n update: 0,\n rebuild: 0,\n ...options.timeout,\n },\n tracing: options.tracing ?? false,\n logger: options.logger,\n };\n }\n\n /**\n * Update objects in a project based on the differences in a local directory.\n *\n * @param project The id of the project.\n * @param directory The path of the directory to send updates from.\n * @param options Object of options.\n * @param options.timeout Number of milliseconds to wait before terminating the process.\n * @returns The latest project version or `null` if something went wrong.\n */\n public async update(project: bigint, directory: string, options?: { timeout?: number }): Promise<bigint | null> {\n return await trace(\n \"dateilager-binary-client.update\",\n {\n attributes: {\n \"dl.project\": String(project),\n \"dl.directory\": directory,\n },\n },\n async () => {\n const args = [\"--dir\", String(directory), \"--project\", String(project)];\n const result = await this._call(\"update\", args, directory, options);\n\n if (result.stdout == \"-1\") {\n return null;\n }\n\n return BigInt(result.stdout);\n }\n );\n }\n\n /**\n * Rebuild the local filesystem.\n *\n * @param project The id of the project.\n * @param to The version of the project to rebuild the filesystem to.\n * @param directory The path of the directory to rebuild the filesystem at.\n * @param options Object of options.\n * @param options.timeout Number of milliseconds to wait before terminating the process.\n * @param options.ignores The paths to ignore when rebuilding the FS.\n * @param options.summarize Should produce the summary file after rebuilding.\n * @param options.cacheDir Path where the cache directory is mounted.\n * @param options.matchInclude Set fileMatch to true if the written files are matched by this glob pattern\n * @param options.matchExclude Set fileMatch to false if the written files are matched by this glob pattern\n * @returns The latest project version or `null` if something went wrong.\n */\n public async rebuild(\n project: bigint,\n to: bigint | null,\n directory: string,\n options?: {\n timeout?: number;\n ignores?: string[];\n summarize?: boolean;\n cacheDir?: string;\n matchInclude?: string;\n matchExclude?: string;\n }\n ): Promise<RebuildResult> {\n return await trace(\n \"dateilager-binary-client.rebuild\",\n {\n attributes: {\n \"dl.project\": String(project),\n \"dl.to\": String(to),\n \"dl.directory\": directory,\n },\n },\n async () => {\n await fs.mkdir(directory, { recursive: true });\n\n const args = [\"--dir\", directory];\n if (to) {\n args.push(\"--to\", String(to));\n }\n\n if (options?.ignores) {\n args.push(\"--ignores\", options.ignores.join(\",\"));\n }\n\n if (options?.summarize === false) {\n args.push(\"--summarize=false\");\n }\n\n if (options?.cacheDir) {\n args.push(`--cachedir=${options.cacheDir}`);\n }\n\n if (options?.matchInclude) {\n args.push(`--matchinclude=${options.matchInclude}`);\n }\n\n if (options?.matchExclude) {\n args.push(`--matchexclude=${options.matchExclude}`);\n }\n\n args.push(\"--project\", String(project), \"--dir\", directory);\n const result = await this._call(\"rebuild\", args, directory, options);\n const parsed = JSON.parse(result.stdout) as { version: number; count: number; fileMatch: boolean };\n return { version: BigInt(parsed.version), count: parsed.count, fileMatch: parsed.fileMatch };\n }\n );\n }\n\n /**\n * @param sample sample size of cleanup\n * @param keep The amount of records to keep\n * @param from Where to start cleanup\n * @param options dict options passed\n * @param options.timeout timeout limit for the request\n */\n public async gcRandomProjects(sample: number, keep: number, from?: number, options?: { timeout?: number }): Promise<GCResult> {\n return await trace(\n \"dateilager-binary-client.gc\",\n {\n attributes: {\n \"db.mode\": \"random-projects\",\n \"dl.keep\": String(keep),\n \"dl.from\": String(from),\n \"dl.sample\": String(sample),\n },\n },\n async () => {\n const args = [\"--mode\", \"random-projects\", \"--keep\", String(keep), \"--sample\", String(sample)];\n\n if (from) args.push(\"--from\", String(from));\n\n const result = await this._call(\"gc\", args, undefined, options);\n const parsed = JSON.parse(result.stdout) as { count: number };\n return { count: parsed.count };\n }\n );\n }\n\n /**\n *\n * @param project The selected project to cleanup\n * @param keep The amount of records to keep\n * @param from Where to start cleanup\n * @param options dict options passed\n * @param options.timeout timeout limit for the request\n */\n public async gcProject(project: number, keep: number, from?: number, options?: { timeout?: number }): Promise<GCResult> {\n return await trace(\n \"dateilager-binary-client.gc\",\n {\n attributes: {\n \"db.mode\": \"project\",\n \"dl.keep\": String(keep),\n \"dl.from\": String(from),\n },\n },\n async () => {\n const args = [\"--mode\", \"project\", \"--keep\", String(keep), \"--project\", String(project)];\n\n if (from) args.push(\"--from\", String(from));\n\n const result = await this._call(\"gc\", args, undefined, options);\n const parsed = JSON.parse(result.stdout) as { count: number };\n return { count: parsed.count };\n }\n );\n }\n\n /**\n *\n * @param sample sample size of cleanup\n * @param options dict options passed\n * @param options.timeout timeout limit for the request\n */\n public async gcContents(sample: number, options?: { timeout?: number }): Promise<GCResult> {\n return await trace(\n \"dateilager-binary-client.gc\",\n {\n attributes: {\n \"db.mode\": \"contents\",\n \"dl.sample\": String(sample),\n },\n },\n async () => {\n const args = [\"--mode\", \"contents\", \"--sample\", String(sample)];\n\n const result = await this._call(\"gc\", args, undefined, options);\n const parsed = JSON.parse(result.stdout) as { count: number };\n return { count: parsed.count };\n }\n );\n }\n\n /** @internal */\n private async _call(\n method: \"update\" | \"rebuild\" | \"gc\",\n args: string[],\n cwd?: string,\n options?: { timeout?: number }\n ): Promise<ExecaReturnValue> {\n const baseArgs = [method, \"--host\", this._options.host, \"--port\", String(this._options.port), \"--log-encoding\", \"json\"];\n\n if (this._options.logger) {\n baseArgs.push(\"--log-level\", this._options.logger.level);\n }\n\n if (this._options.headlessHost) {\n baseArgs.push(\"--headless-host\", this._options.headlessHost);\n }\n\n if (this._options.tracing) {\n const carrier = {};\n propagation.inject(context.active(), carrier);\n const otelContext = JSON.stringify(carrier);\n\n baseArgs.push(\"--tracing\", \"--otel-context\", otelContext);\n }\n const subprocess = execa(this._options.command, baseArgs.concat(args), {\n cwd,\n timeout: options?.timeout ?? this._options.timeout[method],\n env: { DL_TOKEN: await this._options.token() },\n });\n\n if (this._options.logger && subprocess.stderr) {\n readline.createInterface(subprocess.stderr).on(\"line\", (line) => {\n try {\n // we purposefully extract and ignore the `ts` field\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { level, msg, ts, ...fields } = JSON.parse(line) as {\n [key: string]: unknown;\n level: \"debug\" | \"info\" | \"warn\" | \"error\";\n msg: string;\n ts: string | number;\n };\n\n this._options.logger?.log(level, msg, fields);\n } catch (error) {\n this._options.logger?.log(\"warn\", \"failed to log line\", { error, line });\n }\n });\n }\n\n return subprocess;\n }\n}\n"]}
@@ -108,9 +108,11 @@ export declare class DateiLagerGrpcClient {
108
108
  *
109
109
  * @param project The id of the project.
110
110
  * @param path The path of the object.
111
+ * @param from The project version to start from.
112
+ * @param to The project version to end at.
111
113
  * @returns The object at the given path or undefined if it does not exist.
112
114
  */
113
- getObject(project: bigint, path: string): Promise<Objekt | undefined>;
115
+ getObject(project: bigint, path: string, from?: bigint, to?: bigint): Promise<Objekt | undefined>;
114
116
  /**
115
117
  * Update objects.
116
118
  *
@@ -184,17 +184,23 @@ class DateiLagerGrpcClient {
184
184
  *
185
185
  * @param project The id of the project.
186
186
  * @param path The path of the object.
187
+ * @param from The project version to start from.
188
+ * @param to The project version to end at.
187
189
  * @returns The object at the given path or undefined if it does not exist.
188
190
  */
189
- async getObject(project, path) {
191
+ async getObject(project, path, from, to) {
190
192
  return await (0, telemetry_1.trace)("dateilager-grpc-client.get-object", {
191
193
  attributes: {
192
194
  "dl.project": String(project),
193
195
  "dl.path": path,
196
+ "dl.from_version": String(from),
197
+ "dl.to_version": String(to),
194
198
  },
195
199
  }, async () => {
196
200
  const call = this._client.get({
197
201
  project,
202
+ fromVersion: from,
203
+ toVersion: to,
198
204
  queries: [
199
205
  {
200
206
  path,
@@ -1 +1 @@
1
- {"version":3,"file":"grpc-client.js","sourceRoot":"","sources":["../../src/grpc-client.ts"],"names":[],"mappings":";;;AACA,2CAA0E;AAE1E,4CAA8E;AAC9E,gEAA4D;AAE5D,+BAAgD;AAChD,oDAAqD;AAErD,oDAA6C;AA6C7C;;;;;GAKG;AACH,MAAa,oBAAoB;IAU/B;;;;;OAKG;IACH,YAAmB,OAAoC;QAfvD,gBAAgB;QAChB;;;;;WAAmC;QAEnC,gBAAgB;QAChB;;;;;WAA2C;QAE3C,gBAAgB;QAChB;;;;;WAA2D;QASzD,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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;IAED;;;;OAIG;IACI,KAAK,CAAC,IAAI,CAAC,GAAW;QAC3B,IAAI;YACF,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;gBAC7B,OAAO,EAAE,IAAI,CAAC,QAAQ;gBACtB,MAAM,EAAE,GAAG;aACZ,CAAC,CAAC;SACJ;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;YACjB,MAAM,GAAG,CAAC;SACX;IACH,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,QAAQ;QACnB,IAAI;YACF,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;SAC1D;gBAAS;YACR,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;SAClB;IACH,CAAC;CACF;AAED,MAAM,OAAO,GAAG,IAAI,kBAAW,EAAE,CAAC;AAElC;;;;;GAKG;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;;;;;GAKG;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 type { ClientStreamingCall, 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\";\n\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 *\n * @see ClientOptions\n */\n grpcClientOptions?: ClientOptions;\n\n /**\n * Options that will be passed to every remote procedure call.\n *\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 *\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 *\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 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 }\n\n /**\n * Delete a project.\n *\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 *\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 },\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 *\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 }] },\n this._rpcOptions()\n );\n return await call.response;\n }\n );\n }\n\n /**\n * Get an object.\n *\n * @param project The id of the project.\n * @param path The path of the object.\n * @returns The object at the given path or undefined if it does not exist.\n */\n public async getObject(project: bigint, path: string): 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 },\n },\n async () => {\n const call = this._client.get(\n {\n project,\n queries: [\n {\n path,\n isPrefix: false,\n ignores: [],\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 *\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 *\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 *\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 *\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 *\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 *\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 *\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 *\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 *\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 *\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 *\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 *\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 *\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 *\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;AAE5D,+BAAgD;AAChD,oDAAqD;AAErD,oDAA6C;AA6C7C;;;;;GAKG;AACH,MAAa,oBAAoB;IAU/B;;;;;OAKG;IACH,YAAmB,OAAoC;QAfvD,gBAAgB;QAChB;;;;;WAAmC;QAEnC,gBAAgB;QAChB;;;;;WAA2C;QAE3C,gBAAgB;QAChB;;;;;WAA2D;QASzD,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,CAAC,CAAC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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 type { ClientStreamingCall, 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\";\n\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 *\n * @see ClientOptions\n */\n grpcClientOptions?: ClientOptions;\n\n /**\n * Options that will be passed to every remote procedure call.\n *\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 *\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 *\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 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 }\n\n /**\n * Delete a project.\n *\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 *\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 },\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 *\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 }] },\n this._rpcOptions()\n );\n return await call.response;\n }\n );\n }\n\n /**\n * Get an object.\n *\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 },\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 *\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 *\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 *\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 *\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 *\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 *\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 *\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 *\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 *\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 *\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 *\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 *\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 *\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 *\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 +1 @@
1
- {"version":3,"file":"fs_pb.client.js","sourceRoot":"","sources":["../../../src/pb/fs_pb.client.ts"],"names":[],"mappings":";;;AAOA,mCAA6B;AAiC7B,0DAA0D;AA0E1D;;GAEG;AACH,MAAa,QAAQ;IAIjB,YAA6B,UAAwB;;;;;mBAAxB;;QAH7B;;;;mBAAW,UAAE,CAAC,QAAQ;WAAC;QACvB;;;;mBAAU,UAAE,CAAC,OAAO;WAAC;QACrB;;;;mBAAU,UAAE,CAAC,OAAO;WAAC;IAErB,CAAC;IACD;;OAEG;IACH,UAAU,CAAC,KAAwB,EAAE,OAAoB;QACrD,MAAM,MAAM,GAAG,IAAI,CAAC,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ated from protobuf file \"fs.proto\" (package \"pb\", syntax proto3)\n// tslint:disable\n// @ts-nocheck\nimport type { RpcTransport } from \"@protobuf-ts/runtime-rpc\";\nimport type { ServiceInfo } from \"@protobuf-ts/runtime-rpc\";\nimport { Fs } from \"./fs_pb\";\nimport type { GetCacheResponse } from \"./fs_pb\";\nimport type { GetCacheRequest } from \"./fs_pb\";\nimport type { CloneToProjectResponse } from \"./fs_pb\";\nimport type { CloneToProjectRequest } from \"./fs_pb\";\nimport type { GcContentsResponse } from \"./fs_pb\";\nimport type { GcContentsRequest } from \"./fs_pb\";\nimport type { GcRandomProjectsResponse } from \"./fs_pb\";\nimport type { GcRandomProjectsRequest } from \"./fs_pb\";\nimport type { GcProjectResponse } from \"./fs_pb\";\nimport type { GcProjectRequest } from \"./fs_pb\";\nimport type { ResetResponse } from \"./fs_pb\";\nimport type { ResetRequest } from \"./fs_pb\";\nimport type { SnapshotResponse } from \"./fs_pb\";\nimport type { SnapshotRequest } from \"./fs_pb\";\nimport type { InspectResponse } from \"./fs_pb\";\nimport type { InspectRequest } from \"./fs_pb\";\nimport type { RollbackResponse } from \"./fs_pb\";\nimport type { RollbackRequest } from \"./fs_pb\";\nimport type { UpdateResponse } from \"./fs_pb\";\nimport type { UpdateRequest } from \"./fs_pb\";\nimport type { ClientStreamingCall } from \"@protobuf-ts/runtime-rpc\";\nimport type { GetUnaryResponse } from \"./fs_pb\";\nimport type { GetUnaryRequest } from \"./fs_pb\";\nimport type { GetCompressResponse } from \"./fs_pb\";\nimport type { GetCompressRequest } from \"./fs_pb\";\nimport type { GetResponse } from \"./fs_pb\";\nimport type { GetRequest } from \"./fs_pb\";\nimport type { ServerStreamingCall } from \"@protobuf-ts/runtime-rpc\";\nimport type { ListProjectsResponse } from \"./fs_pb\";\nimport type { ListProjectsRequest } from \"./fs_pb\";\nimport type { DeleteProjectResponse } from \"./fs_pb\";\nimport type { DeleteProjectRequest } from \"./fs_pb\";\nimport { stackIntercept } from \"@protobuf-ts/runtime-rpc\";\nimport type { NewProjectResponse } from \"./fs_pb\";\nimport type { NewProjectRequest } from \"./fs_pb\";\nimport type { UnaryCall } from \"@protobuf-ts/runtime-rpc\";\nimport type { RpcOptions } from \"@protobuf-ts/runtime-rpc\";\n/**\n * @generated from protobuf service pb.Fs\n */\nexport interface IFsClient {\n /**\n * @generated from protobuf rpc: NewProject(pb.NewProjectRequest) returns (pb.NewProjectResponse);\n */\n newProject(input: NewProjectRequest, options?: RpcOptions): UnaryCall<NewProjectRequest, NewProjectResponse>;\n /**\n * @generated from protobuf rpc: DeleteProject(pb.DeleteProjectRequest) returns (pb.DeleteProjectResponse);\n */\n deleteProject(input: DeleteProjectRequest, options?: RpcOptions): UnaryCall<DeleteProjectRequest, DeleteProjectResponse>;\n /**\n * @generated from protobuf rpc: ListProjects(pb.ListProjectsRequest) returns (pb.ListProjectsResponse);\n */\n listProjects(input: ListProjectsRequest, options?: RpcOptions): UnaryCall<ListProjectsRequest, ListProjectsResponse>;\n /**\n * @generated from protobuf rpc: Get(pb.GetRequest) returns (stream pb.GetResponse);\n */\n get(input: GetRequest, options?: RpcOptions): ServerStreamingCall<GetRequest, GetResponse>;\n /**\n * @generated from protobuf rpc: GetCompress(pb.GetCompressRequest) returns (stream pb.GetCompressResponse);\n */\n getCompress(input: GetCompressRequest, options?: RpcOptions): ServerStreamingCall<GetCompressRequest, GetCompressResponse>;\n /**\n * @generated from protobuf rpc: GetUnary(pb.GetUnaryRequest) returns (pb.GetUnaryResponse);\n */\n getUnary(input: GetUnaryRequest, options?: RpcOptions): UnaryCall<GetUnaryRequest, GetUnaryResponse>;\n /**\n * @generated from protobuf rpc: Update(stream pb.UpdateRequest) returns (pb.UpdateResponse);\n */\n update(options?: RpcOptions): ClientStreamingCall<UpdateRequest, UpdateResponse>;\n /**\n * @generated from protobuf rpc: Rollback(pb.RollbackRequest) returns (pb.RollbackResponse);\n */\n rollback(input: RollbackRequest, options?: RpcOptions): UnaryCall<RollbackRequest, RollbackResponse>;\n /**\n * @generated from protobuf rpc: Inspect(pb.InspectRequest) returns (pb.InspectResponse);\n */\n inspect(input: InspectRequest, options?: RpcOptions): UnaryCall<InspectRequest, InspectResponse>;\n /**\n * @generated from protobuf rpc: Snapshot(pb.SnapshotRequest) returns (pb.SnapshotResponse);\n */\n snapshot(input: SnapshotRequest, options?: RpcOptions): UnaryCall<SnapshotRequest, SnapshotResponse>;\n /**\n * @generated from protobuf rpc: Reset(pb.ResetRequest) returns (pb.ResetResponse);\n */\n reset(input: ResetRequest, options?: RpcOptions): UnaryCall<ResetRequest, ResetResponse>;\n /**\n * @generated from protobuf rpc: GcProject(pb.GcProjectRequest) returns (pb.GcProjectResponse);\n */\n gcProject(input: GcProjectRequest, options?: RpcOptions): UnaryCall<GcProjectRequest, GcProjectResponse>;\n /**\n * @generated from protobuf rpc: GcRandomProjects(pb.GcRandomProjectsRequest) returns (pb.GcRandomProjectsResponse);\n */\n gcRandomProjects(input: GcRandomProjectsRequest, options?: RpcOptions): UnaryCall<GcRandomProjectsRequest, GcRandomProjectsResponse>;\n /**\n * @generated from protobuf rpc: GcContents(pb.GcContentsRequest) returns (pb.GcContentsResponse);\n */\n gcContents(input: GcContentsRequest, options?: RpcOptions): UnaryCall<GcContentsRequest, GcContentsResponse>;\n /**\n * @generated from protobuf rpc: CloneToProject(pb.CloneToProjectRequest) returns (pb.CloneToProjectResponse);\n */\n cloneToProject(input: CloneToProjectRequest, options?: RpcOptions): UnaryCall<CloneToProjectRequest, CloneToProjectResponse>;\n /**\n * @generated from protobuf rpc: GetCache(pb.GetCacheRequest) returns (stream pb.GetCacheResponse);\n */\n getCache(input: GetCacheRequest, options?: RpcOptions): ServerStreamingCall<GetCacheRequest, GetCacheResponse>;\n}\n/**\n * @generated from protobuf service pb.Fs\n */\nexport class FsClient implements IFsClient, ServiceInfo {\n typeName = Fs.typeName;\n methods = Fs.methods;\n options = Fs.options;\n constructor(private readonly _transport: RpcTransport) {\n }\n /**\n * @generated from protobuf rpc: NewProject(pb.NewProjectRequest) returns (pb.NewProjectResponse);\n */\n newProject(input: NewProjectRequest, options?: RpcOptions): UnaryCall<NewProjectRequest, NewProjectResponse> {\n const method = this.methods[0], opt = this._transport.mergeOptions(options);\n return stackIntercept<NewProjectRequest, NewProjectResponse>(\"unary\", this._transport, method, opt, input);\n }\n /**\n * @generated from protobuf rpc: DeleteProject(pb.DeleteProjectRequest) returns (pb.DeleteProjectResponse);\n */\n deleteProject(input: DeleteProjectRequest, options?: RpcOptions): UnaryCall<DeleteProjectRequest, DeleteProjectResponse> {\n const method = this.methods[1], opt = this._transport.mergeOptions(options);\n return stackIntercept<DeleteProjectRequest, DeleteProjectResponse>(\"unary\", this._transport, method, opt, input);\n }\n /**\n * @generated from protobuf rpc: ListProjects(pb.ListProjectsRequest) returns (pb.ListProjectsResponse);\n */\n listProjects(input: ListProjectsRequest, options?: RpcOptions): UnaryCall<ListProjectsRequest, ListProjectsResponse> {\n const method = this.methods[2], opt = this._transport.mergeOptions(options);\n return stackIntercept<ListProjectsRequest, ListProjectsResponse>(\"unary\", this._transport, method, opt, input);\n }\n /**\n * @generated from protobuf rpc: Get(pb.GetRequest) returns (stream pb.GetResponse);\n */\n get(input: GetRequest, options?: RpcOptions): ServerStreamingCall<GetRequest, GetResponse> {\n const method = this.methods[3], opt = this._transport.mergeOptions(options);\n return stackIntercept<GetRequest, GetResponse>(\"serverStreaming\", this._transport, method, opt, input);\n }\n /**\n * @generated from protobuf rpc: GetCompress(pb.GetCompressRequest) returns (stream pb.GetCompressResponse);\n */\n getCompress(input: GetCompressRequest, options?: RpcOptions): ServerStreamingCall<GetCompressRequest, GetCompressResponse> {\n const method = this.methods[4], opt = this._transport.mergeOptions(options);\n return stackIntercept<GetCompressRequest, GetCompressResponse>(\"serverStreaming\", this._transport, method, opt, input);\n }\n /**\n * @generated from protobuf rpc: GetUnary(pb.GetUnaryRequest) returns (pb.GetUnaryResponse);\n */\n getUnary(input: GetUnaryRequest, options?: RpcOptions): UnaryCall<GetUnaryRequest, GetUnaryResponse> {\n const method = this.methods[5], opt = this._transport.mergeOptions(options);\n return stackIntercept<GetUnaryRequest, GetUnaryResponse>(\"unary\", this._transport, method, opt, input);\n }\n /**\n * @generated from protobuf rpc: Update(stream pb.UpdateRequest) returns (pb.UpdateResponse);\n */\n update(options?: RpcOptions): ClientStreamingCall<UpdateRequest, UpdateResponse> {\n const method = this.methods[6], opt = this._transport.mergeOptions(options);\n return stackIntercept<UpdateRequest, UpdateResponse>(\"clientStreaming\", this._transport, method, opt);\n }\n /**\n * @generated from protobuf rpc: Rollback(pb.RollbackRequest) returns (pb.RollbackResponse);\n */\n rollback(input: RollbackRequest, options?: RpcOptions): UnaryCall<RollbackRequest, RollbackResponse> {\n const method = this.methods[7], opt = this._transport.mergeOptions(options);\n return stackIntercept<RollbackRequest, RollbackResponse>(\"unary\", this._transport, method, opt, input);\n }\n /**\n * @generated from protobuf rpc: Inspect(pb.InspectRequest) returns (pb.InspectResponse);\n */\n inspect(input: InspectRequest, options?: RpcOptions): UnaryCall<InspectRequest, InspectResponse> {\n const method = this.methods[8], opt = this._transport.mergeOptions(options);\n return stackIntercept<InspectRequest, InspectResponse>(\"unary\", this._transport, method, opt, input);\n }\n /**\n * @generated from protobuf rpc: Snapshot(pb.SnapshotRequest) returns (pb.SnapshotResponse);\n */\n snapshot(input: SnapshotRequest, options?: RpcOptions): UnaryCall<SnapshotRequest, SnapshotResponse> {\n const method = this.methods[9], opt = this._transport.mergeOptions(options);\n return stackIntercept<SnapshotRequest, SnapshotResponse>(\"unary\", this._transport, method, opt, input);\n }\n /**\n * @generated from protobuf rpc: Reset(pb.ResetRequest) returns (pb.ResetResponse);\n */\n reset(input: ResetRequest, options?: RpcOptions): UnaryCall<ResetRequest, ResetResponse> {\n const method = this.methods[10], opt = this._transport.mergeOptions(options);\n return stackIntercept<ResetRequest, ResetResponse>(\"unary\", this._transport, method, opt, input);\n }\n /**\n * @generated from protobuf rpc: GcProject(pb.GcProjectRequest) returns (pb.GcProjectResponse);\n */\n gcProject(input: GcProjectRequest, options?: RpcOptions): UnaryCall<GcProjectRequest, GcProjectResponse> {\n const method = this.methods[11], opt = this._transport.mergeOptions(options);\n return stackIntercept<GcProjectRequest, GcProjectResponse>(\"unary\", this._transport, method, opt, input);\n }\n /**\n * @generated from protobuf rpc: GcRandomProjects(pb.GcRandomProjectsRequest) returns (pb.GcRandomProjectsResponse);\n */\n gcRandomProjects(input: GcRandomProjectsRequest, options?: RpcOptions): UnaryCall<GcRandomProjectsRequest, GcRandomProjectsResponse> {\n const method = this.methods[12], opt = this._transport.mergeOptions(options);\n return stackIntercept<GcRandomProjectsRequest, GcRandomProjectsResponse>(\"unary\", this._transport, method, opt, input);\n }\n /**\n * @generated from protobuf rpc: GcContents(pb.GcContentsRequest) returns (pb.GcContentsResponse);\n */\n gcContents(input: GcContentsRequest, options?: RpcOptions): UnaryCall<GcContentsRequest, GcContentsResponse> {\n const method = this.methods[13], opt = this._transport.mergeOptions(options);\n return stackIntercept<GcContentsRequest, GcContentsResponse>(\"unary\", this._transport, method, opt, input);\n }\n /**\n * @generated from protobuf rpc: CloneToProject(pb.CloneToProjectRequest) returns (pb.CloneToProjectResponse);\n */\n cloneToProject(input: CloneToProjectRequest, options?: RpcOptions): UnaryCall<CloneToProjectRequest, CloneToProjectResponse> {\n const method = this.methods[14], opt = this._transport.mergeOptions(options);\n return stackIntercept<CloneToProjectRequest, CloneToProjectResponse>(\"unary\", this._transport, method, opt, input);\n }\n /**\n * @generated from protobuf rpc: GetCache(pb.GetCacheRequest) returns (stream pb.GetCacheResponse);\n */\n getCache(input: GetCacheRequest, options?: RpcOptions): ServerStreamingCall<GetCacheRequest, GetCacheResponse> {\n const method = this.methods[15], opt = this._transport.mergeOptions(options);\n return stackIntercept<GetCacheRequest, GetCacheResponse>(\"serverStreaming\", this._transport, method, opt, input);\n }\n}\n"]}
1
+ {"version":3,"file":"fs_pb.client.js","sourceRoot":"","sources":["../../../src/pb/fs_pb.client.ts"],"names":[],"mapp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AC,EAAE,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAC7E,OAAO,IAAA,4BAAc,EAAoC,iBAAiB,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IACrH,CAAC;CACJ;AAtHD,4BAsHC","sourcesContent":["/* eslint-disable */\n// @generated by protobuf-ts 2.9.2 with parameter long_type_bigint,ts_nocheck,eslint_disable,add_pb_suffix\n// @generated from protobuf file \"fs.proto\" (package \"pb\", syntax proto3)\n// tslint:disable\n// @ts-nocheck\nimport type { RpcTransport } from \"@protobuf-ts/runtime-rpc\";\nimport type { ServiceInfo } from \"@protobuf-ts/runtime-rpc\";\nimport { Fs } from \"./fs_pb\";\nimport type { GetCacheResponse } from \"./fs_pb\";\nimport type { GetCacheRequest } from \"./fs_pb\";\nimport type { CloneToProjectResponse } from \"./fs_pb\";\nimport type { CloneToProjectRequest } from \"./fs_pb\";\nimport type { GcContentsResponse } from \"./fs_pb\";\nimport type { GcContentsRequest } from \"./fs_pb\";\nimport type { GcRandomProjectsResponse } from \"./fs_pb\";\nimport type { GcRandomProjectsRequest } from \"./fs_pb\";\nimport type { GcProjectResponse } from \"./fs_pb\";\nimport type { GcProjectRequest } from \"./fs_pb\";\nimport type { ResetResponse } from \"./fs_pb\";\nimport type { ResetRequest } from \"./fs_pb\";\nimport type { SnapshotResponse } from \"./fs_pb\";\nimport type { SnapshotRequest } from \"./fs_pb\";\nimport type { InspectResponse } from \"./fs_pb\";\nimport type { InspectRequest } from \"./fs_pb\";\nimport type { RollbackResponse } from \"./fs_pb\";\nimport type { RollbackRequest } from \"./fs_pb\";\nimport type { UpdateResponse } from \"./fs_pb\";\nimport type { UpdateRequest } from \"./fs_pb\";\nimport type { ClientStreamingCall } from \"@protobuf-ts/runtime-rpc\";\nimport type { GetUnaryResponse } from \"./fs_pb\";\nimport type { GetUnaryRequest } from \"./fs_pb\";\nimport type { GetCompressResponse } from \"./fs_pb\";\nimport type { GetCompressRequest } from \"./fs_pb\";\nimport type { GetResponse } from \"./fs_pb\";\nimport type { GetRequest } from \"./fs_pb\";\nimport type { ServerStreamingCall } from \"@protobuf-ts/runtime-rpc\";\nimport type { ListProjectsResponse } from \"./fs_pb\";\nimport type { ListProjectsRequest } from \"./fs_pb\";\nimport type { DeleteProjectResponse } from \"./fs_pb\";\nimport type { DeleteProjectRequest } from \"./fs_pb\";\nimport { stackIntercept } from \"@protobuf-ts/runtime-rpc\";\nimport type { NewProjectResponse } from \"./fs_pb\";\nimport type { NewProjectRequest } from \"./fs_pb\";\nimport type { UnaryCall } from \"@protobuf-ts/runtime-rpc\";\nimport type { RpcOptions } from \"@protobuf-ts/runtime-rpc\";\n/**\n * @generated from protobuf service pb.Fs\n */\nexport interface IFsClient {\n /**\n * @generated from protobuf rpc: NewProject(pb.NewProjectRequest) returns (pb.NewProjectResponse);\n */\n newProject(input: NewProjectRequest, options?: RpcOptions): UnaryCall<NewProjectRequest, NewProjectResponse>;\n /**\n * @generated from protobuf rpc: DeleteProject(pb.DeleteProjectRequest) returns (pb.DeleteProjectResponse);\n */\n deleteProject(input: DeleteProjectRequest, options?: RpcOptions): UnaryCall<DeleteProjectRequest, DeleteProjectResponse>;\n /**\n * @generated from protobuf rpc: ListProjects(pb.ListProjectsRequest) returns (pb.ListProjectsResponse);\n */\n listProjects(input: ListProjectsRequest, options?: RpcOptions): UnaryCall<ListProjectsRequest, ListProjectsResponse>;\n /**\n * @generated from protobuf rpc: Get(pb.GetRequest) returns (stream pb.GetResponse);\n */\n get(input: GetRequest, options?: RpcOptions): ServerStreamingCall<GetRequest, GetResponse>;\n /**\n * @generated from protobuf rpc: GetCompress(pb.GetCompressRequest) returns (stream pb.GetCompressResponse);\n */\n getCompress(input: GetCompressRequest, options?: RpcOptions): ServerStreamingCall<GetCompressRequest, GetCompressResponse>;\n /**\n * @generated from protobuf rpc: GetUnary(pb.GetUnaryRequest) returns (pb.GetUnaryResponse);\n */\n getUnary(input: GetUnaryRequest, options?: RpcOptions): UnaryCall<GetUnaryRequest, GetUnaryResponse>;\n /**\n * @generated from protobuf rpc: Update(stream pb.UpdateRequest) returns (pb.UpdateResponse);\n */\n update(options?: RpcOptions): ClientStreamingCall<UpdateRequest, UpdateResponse>;\n /**\n * @generated from protobuf rpc: Rollback(pb.RollbackRequest) returns (pb.RollbackResponse);\n */\n rollback(input: RollbackRequest, options?: RpcOptions): UnaryCall<RollbackRequest, RollbackResponse>;\n /**\n * @generated from protobuf rpc: Inspect(pb.InspectRequest) returns (pb.InspectResponse);\n */\n inspect(input: InspectRequest, options?: RpcOptions): UnaryCall<InspectRequest, InspectResponse>;\n /**\n * @generated from protobuf rpc: Snapshot(pb.SnapshotRequest) returns (pb.SnapshotResponse);\n */\n snapshot(input: SnapshotRequest, options?: RpcOptions): UnaryCall<SnapshotRequest, SnapshotResponse>;\n /**\n * @generated from protobuf rpc: Reset(pb.ResetRequest) returns (pb.ResetResponse);\n */\n reset(input: ResetRequest, options?: RpcOptions): UnaryCall<ResetRequest, ResetResponse>;\n /**\n * @generated from protobuf rpc: GcProject(pb.GcProjectRequest) returns (pb.GcProjectResponse);\n */\n gcProject(input: GcProjectRequest, options?: RpcOptions): UnaryCall<GcProjectRequest, GcProjectResponse>;\n /**\n * @generated from protobuf rpc: GcRandomProjects(pb.GcRandomProjectsRequest) returns (pb.GcRandomProjectsResponse);\n */\n gcRandomProjects(input: GcRandomProjectsRequest, options?: RpcOptions): UnaryCall<GcRandomProjectsRequest, GcRandomProjectsResponse>;\n /**\n * @generated from protobuf rpc: GcContents(pb.GcContentsRequest) returns (pb.GcContentsResponse);\n */\n gcContents(input: GcContentsRequest, options?: RpcOptions): UnaryCall<GcContentsRequest, GcContentsResponse>;\n /**\n * @generated from protobuf rpc: CloneToProject(pb.CloneToProjectRequest) returns (pb.CloneToProjectResponse);\n */\n cloneToProject(input: CloneToProjectRequest, options?: RpcOptions): UnaryCall<CloneToProjectRequest, CloneToProjectResponse>;\n /**\n * @generated from protobuf rpc: GetCache(pb.GetCacheRequest) returns (stream pb.GetCacheResponse);\n */\n getCache(input: GetCacheRequest, options?: RpcOptions): ServerStreamingCall<GetCacheRequest, GetCacheResponse>;\n}\n/**\n * @generated from protobuf service pb.Fs\n */\nexport class FsClient implements IFsClient, ServiceInfo {\n typeName = Fs.typeName;\n methods = Fs.methods;\n options = Fs.options;\n constructor(private readonly _transport: RpcTransport) {\n }\n /**\n * @generated from protobuf rpc: NewProject(pb.NewProjectRequest) returns (pb.NewProjectResponse);\n */\n newProject(input: NewProjectRequest, options?: RpcOptions): UnaryCall<NewProjectRequest, NewProjectResponse> {\n const method = this.methods[0], opt = this._transport.mergeOptions(options);\n return stackIntercept<NewProjectRequest, NewProjectResponse>(\"unary\", this._transport, method, opt, input);\n }\n /**\n * @generated from protobuf rpc: DeleteProject(pb.DeleteProjectRequest) returns (pb.DeleteProjectResponse);\n */\n deleteProject(input: DeleteProjectRequest, options?: RpcOptions): UnaryCall<DeleteProjectRequest, DeleteProjectResponse> {\n const method = this.methods[1], opt = this._transport.mergeOptions(options);\n return stackIntercept<DeleteProjectRequest, DeleteProjectResponse>(\"unary\", this._transport, method, opt, input);\n }\n /**\n * @generated from protobuf rpc: ListProjects(pb.ListProjectsRequest) returns (pb.ListProjectsResponse);\n */\n listProjects(input: ListProjectsRequest, options?: RpcOptions): UnaryCall<ListProjectsRequest, ListProjectsResponse> {\n const method = this.methods[2], opt = this._transport.mergeOptions(options);\n return stackIntercept<ListProjectsRequest, ListProjectsResponse>(\"unary\", this._transport, method, opt, input);\n }\n /**\n * @generated from protobuf rpc: Get(pb.GetRequest) returns (stream pb.GetResponse);\n */\n get(input: GetRequest, options?: RpcOptions): ServerStreamingCall<GetRequest, GetResponse> {\n const method = this.methods[3], opt = this._transport.mergeOptions(options);\n return stackIntercept<GetRequest, GetResponse>(\"serverStreaming\", this._transport, method, opt, input);\n }\n /**\n * @generated from protobuf rpc: GetCompress(pb.GetCompressRequest) returns (stream pb.GetCompressResponse);\n */\n getCompress(input: GetCompressRequest, options?: RpcOptions): ServerStreamingCall<GetCompressRequest, GetCompressResponse> {\n const method = this.methods[4], opt = this._transport.mergeOptions(options);\n return stackIntercept<GetCompressRequest, GetCompressResponse>(\"serverStreaming\", this._transport, method, opt, input);\n }\n /**\n * @generated from protobuf rpc: GetUnary(pb.GetUnaryRequest) returns (pb.GetUnaryResponse);\n */\n getUnary(input: GetUnaryRequest, options?: RpcOptions): UnaryCall<GetUnaryRequest, GetUnaryResponse> {\n const method = this.methods[5], opt = this._transport.mergeOptions(options);\n return stackIntercept<GetUnaryRequest, GetUnaryResponse>(\"unary\", this._transport, method, opt, input);\n }\n /**\n * @generated from protobuf rpc: Update(stream pb.UpdateRequest) returns (pb.UpdateResponse);\n */\n update(options?: RpcOptions): ClientStreamingCall<UpdateRequest, UpdateResponse> {\n const method = this.methods[6], opt = this._transport.mergeOptions(options);\n return stackIntercept<UpdateRequest, UpdateResponse>(\"clientStreaming\", this._transport, method, opt);\n }\n /**\n * @generated from protobuf rpc: Rollback(pb.RollbackRequest) returns (pb.RollbackResponse);\n */\n rollback(input: RollbackRequest, options?: RpcOptions): UnaryCall<RollbackRequest, RollbackResponse> {\n const method = this.methods[7], opt = this._transport.mergeOptions(options);\n return stackIntercept<RollbackRequest, RollbackResponse>(\"unary\", this._transport, method, opt, input);\n }\n /**\n * @generated from protobuf rpc: Inspect(pb.InspectRequest) returns (pb.InspectResponse);\n */\n inspect(input: InspectRequest, options?: RpcOptions): UnaryCall<InspectRequest, InspectResponse> {\n const method = this.methods[8], opt = this._transport.mergeOptions(options);\n return stackIntercept<InspectRequest, InspectResponse>(\"unary\", this._transport, method, opt, input);\n }\n /**\n * @generated from protobuf rpc: Snapshot(pb.SnapshotRequest) returns (pb.SnapshotResponse);\n */\n snapshot(input: SnapshotRequest, options?: RpcOptions): UnaryCall<SnapshotRequest, SnapshotResponse> {\n const method = this.methods[9], opt = this._transport.mergeOptions(options);\n return stackIntercept<SnapshotRequest, SnapshotResponse>(\"unary\", this._transport, method, opt, input);\n }\n /**\n * @generated from protobuf rpc: Reset(pb.ResetRequest) returns (pb.ResetResponse);\n */\n reset(input: ResetRequest, options?: RpcOptions): UnaryCall<ResetRequest, ResetResponse> {\n const method = this.methods[10], opt = this._transport.mergeOptions(options);\n return stackIntercept<ResetRequest, ResetResponse>(\"unary\", this._transport, method, opt, input);\n }\n /**\n * @generated from protobuf rpc: GcProject(pb.GcProjectRequest) returns (pb.GcProjectResponse);\n */\n gcProject(input: GcProjectRequest, options?: RpcOptions): UnaryCall<GcProjectRequest, GcProjectResponse> {\n const method = this.methods[11], opt = this._transport.mergeOptions(options);\n return stackIntercept<GcProjectRequest, GcProjectResponse>(\"unary\", this._transport, method, opt, input);\n }\n /**\n * @generated from protobuf rpc: GcRandomProjects(pb.GcRandomProjectsRequest) returns (pb.GcRandomProjectsResponse);\n */\n gcRandomProjects(input: GcRandomProjectsRequest, options?: RpcOptions): UnaryCall<GcRandomProjectsRequest, GcRandomProjectsResponse> {\n const method = this.methods[12], opt = this._transport.mergeOptions(options);\n return stackIntercept<GcRandomProjectsRequest, GcRandomProjectsResponse>(\"unary\", this._transport, method, opt, input);\n }\n /**\n * @generated from protobuf rpc: GcContents(pb.GcContentsRequest) returns (pb.GcContentsResponse);\n */\n gcContents(input: GcContentsRequest, options?: RpcOptions): UnaryCall<GcContentsRequest, GcContentsResponse> {\n const method = this.methods[13], opt = this._transport.mergeOptions(options);\n return stackIntercept<GcContentsRequest, GcContentsResponse>(\"unary\", this._transport, method, opt, input);\n }\n /**\n * @generated from protobuf rpc: CloneToProject(pb.CloneToProjectRequest) returns (pb.CloneToProjectResponse);\n */\n cloneToProject(input: CloneToProjectRequest, options?: RpcOptions): UnaryCall<CloneToProjectRequest, CloneToProjectResponse> {\n const method = this.methods[14], opt = this._transport.mergeOptions(options);\n return stackIntercept<CloneToProjectRequest, CloneToProjectResponse>(\"unary\", this._transport, method, opt, input);\n }\n /**\n * @generated from protobuf rpc: GetCache(pb.GetCacheRequest) returns (stream pb.GetCacheResponse);\n */\n getCache(input: GetCacheRequest, options?: RpcOptions): ServerStreamingCall<GetCacheRequest, GetCacheResponse> {\n const method = this.methods[15], opt = this._transport.mergeOptions(options);\n return stackIntercept<GetCacheRequest, GetCacheResponse>(\"serverStreaming\", this._transport, method, opt, input);\n }\n}\n"]}