@gadgetinc/dateilager 0.5.21 → 0.6.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.
@@ -85,9 +85,9 @@ export interface RebuildResult {
85
85
  */
86
86
  count: number;
87
87
  /**
88
- * Wether or not the file pattern was detected.
88
+ * Whether or not the file match was detected.
89
89
  */
90
- patternMatch: boolean;
90
+ fileMatch: boolean;
91
91
  }
92
92
  /**
93
93
  * The Result from calling the Dateilager Garbage Compiler
@@ -123,25 +123,25 @@ export declare class DateiLagerBinaryClient {
123
123
  /**
124
124
  * Rebuild the local filesystem.
125
125
  *
126
- * @param project The id of the project.
127
- * @param to The version of the project to rebuild the filesystem to.
128
- * @param directory The path of the directory to rebuild the filesystem at.
129
- * @param options Object of options.
130
- * @param options.timeout Number of milliseconds to wait before terminating the process.
131
- * @param options.ignores The paths to ignore when rebuilding the FS.
132
- * @param options.summarize Should produce the summary file after rebuilding.
133
- * @param options.cacheDir Path where the cache directory is mounted.
134
- * @param options.filePattern A glob file pattern which drives the patternDetected output boolean
135
- * @param options.filePatternIff Should the file pattern detection trigger if and only if those files have changed
136
- * @returns The latest project version or `null` if something went wrong.
126
+ * @param project The id of the project.
127
+ * @param to The version of the project to rebuild the filesystem to.
128
+ * @param directory The path of the directory to rebuild the filesystem at.
129
+ * @param options Object of options.
130
+ * @param options.timeout Number of milliseconds to wait before terminating the process.
131
+ * @param options.ignores The paths to ignore when rebuilding the FS.
132
+ * @param options.summarize Should produce the summary file after rebuilding.
133
+ * @param options.cacheDir Path where the cache directory is mounted.
134
+ * @param options.matchInclude Set fileMatch to true if the written files are matched by this glob pattern
135
+ * @param options.matchExclude Set fileMatch to false if the written files are matched by this glob pattern
136
+ * @returns The latest project version or `null` if something went wrong.
137
137
  */
138
138
  rebuild(project: bigint, to: bigint | null, directory: string, options?: {
139
139
  timeout?: number;
140
140
  ignores?: string[];
141
141
  summarize?: boolean;
142
142
  cacheDir?: string;
143
- filePattern?: string;
144
- filePatternIff?: boolean;
143
+ matchInclude?: string;
144
+ matchExclude?: string;
145
145
  }): Promise<RebuildResult>;
146
146
  /**
147
147
  * @param sample sample size of cleanup
@@ -65,17 +65,17 @@ export class DateiLagerBinaryClient {
65
65
  /**
66
66
  * Rebuild the local filesystem.
67
67
  *
68
- * @param project The id of the project.
69
- * @param to The version of the project to rebuild the filesystem to.
70
- * @param directory The path of the directory to rebuild the filesystem at.
71
- * @param options Object of options.
72
- * @param options.timeout Number of milliseconds to wait before terminating the process.
73
- * @param options.ignores The paths to ignore when rebuilding the FS.
74
- * @param options.summarize Should produce the summary file after rebuilding.
75
- * @param options.cacheDir Path where the cache directory is mounted.
76
- * @param options.filePattern A glob file pattern which drives the patternDetected output boolean
77
- * @param options.filePatternIff Should the file pattern detection trigger if and only if those files have changed
78
- * @returns The latest project version or `null` if something went wrong.
68
+ * @param project The id of the project.
69
+ * @param to The version of the project to rebuild the filesystem to.
70
+ * @param directory The path of the directory to rebuild the filesystem at.
71
+ * @param options Object of options.
72
+ * @param options.timeout Number of milliseconds to wait before terminating the process.
73
+ * @param options.ignores The paths to ignore when rebuilding the FS.
74
+ * @param options.summarize Should produce the summary file after rebuilding.
75
+ * @param options.cacheDir Path where the cache directory is mounted.
76
+ * @param options.matchInclude Set fileMatch to true if the written files are matched by this glob pattern
77
+ * @param options.matchExclude Set fileMatch to false if the written files are matched by this glob pattern
78
+ * @returns The latest project version or `null` if something went wrong.
79
79
  */
80
80
  async rebuild(project, to, directory, options) {
81
81
  return await trace("dateilager-binary-client.rebuild", {
@@ -99,16 +99,16 @@ export class DateiLagerBinaryClient {
99
99
  if (options?.cacheDir) {
100
100
  args.push(`--cachedir=${options.cacheDir}`);
101
101
  }
102
- if (options?.filePattern) {
103
- args.push(`--filepattern=${options.filePattern}`);
104
- if (options.filePatternIff) {
105
- args.push(`--iff=true`);
106
- }
102
+ if (options?.matchInclude) {
103
+ args.push(`--matchinclude=${options.matchInclude}`);
104
+ }
105
+ if (options?.matchExclude) {
106
+ args.push(`--matchexclude=${options.matchExclude}`);
107
107
  }
108
108
  args.push("--project", String(project), "--dir", directory);
109
109
  const result = await this._call("rebuild", args, directory, options);
110
110
  const parsed = JSON.parse(result.stdout);
111
- return { version: BigInt(parsed.version), count: parsed.count, patternMatch: parsed.patternMatch };
111
+ return { version: BigInt(parsed.version), count: parsed.count, fileMatch: parsed.fileMatch };
112
112
  });
113
113
  }
114
114
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"binary-client.js","sourceRoot":"","sources":["../../src/binary-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAE1D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAsH7C;;;;GAIG;AACH,MAAM,OAAO,sBAAsB;IAIjC;;OAEG;IACH,YAAmB,OAAsC;QANzD,gBAAgB;QAChB;;;;;WAA0B;QAMxB,IAAI,CAAC,QAAQ,GAAG;YACd,MAAM,EAAE,OAAO,OAAO,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE;YAC7G,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,O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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","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 | 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 * Wether or not the file pattern was detected.\n */\n patternMatch: 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.filePattern A glob file pattern which drives the patternDetected output boolean\n * @param options.filePatternIff Should the file pattern detection trigger if and only if those files have changed\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 filePattern?: string;\n filePatternIff?: boolean;\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?.filePattern) {\n args.push(`--filepattern=${options.filePattern}`);\n\n if (options.filePatternIff) {\n args.push(`--iff=true`);\n }\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; patternMatch: boolean };\n return { version: BigInt(parsed.version), count: parsed.count, patternMatch: parsed.patternMatch };\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,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAE1D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAsH7C;;;;GAIG;AACH,MAAM,OAAO,sBAAsB;IAIjC;;OAEG;IACH,YAAmB,OAAsC;QANzD,gBAAgB;QAChB;;;;;WAA0B;QAMxB,IAAI,CAAC,QAAQ,GAAG;YACd,MAAM,EAAE,OAAO,OAAO,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CA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AO,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC;YAC1D,GAAG,EAAE,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE;SAC/C,CAAC,CAAC;QAEH,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,IAAI,UAAU,CAAC,MAAM,EAAE;YAC7C,QAAQ,CAAC,eAAe,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,MAAM,EAAE,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","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 | 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"]}
@@ -126,6 +126,13 @@ export declare class DateiLagerGrpcClient {
126
126
  * @returns The latest project version or `null` if something went wrong.
127
127
  */
128
128
  updateObject(project: bigint, obj: Objekt): Promise<bigint | null>;
129
+ /**
130
+ * Rollback a project.
131
+ *
132
+ * @param project The id of the project.
133
+ * @param version The version to rollback to.
134
+ */
135
+ rollbackProject(project: bigint, version: bigint): Promise<void>;
129
136
  /**
130
137
  * Snapshot the current state of the dateilager server.
131
138
  *
@@ -236,6 +236,15 @@ export class DateiLagerGrpcClient {
236
236
  await stream.send(obj);
237
237
  return await stream.complete();
238
238
  }
239
+ /**
240
+ * Rollback a project.
241
+ *
242
+ * @param project The id of the project.
243
+ * @param version The version to rollback to.
244
+ */
245
+ async rollbackProject(project, version) {
246
+ await this._client.rollback({ project, version }, this._rpcOptions());
247
+ }
239
248
  /**
240
249
  * Snapshot the current state of the dateilager server.
241
250
  *
@@ -1 +1 @@
1
- {"version":3,"file":"grpc-client.js","sourceRoot":"","sources":["../../src/grpc-client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE1E,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,KAAK,IAAI,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AA6C7C;;;;;GAKG;AACH,MAAM,OAAO,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,KAA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AK,GAAG,IAAI,CAAC;IACpB,CAAC;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,WAAW,EAAE,CAAC;AAElC;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,OAAe;IAC3C,OAAO,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;AAElC;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,KAA6B;IACzD,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC","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 * 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,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE1E,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,KAAK,IAAI,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AA6C7C;;;;;GAKG;AACH,MAAM,OAAO,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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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"]}
@@ -16,6 +16,8 @@ import type { SnapshotResponse } from "./fs_pb";
16
16
  import type { SnapshotRequest } from "./fs_pb";
17
17
  import type { InspectResponse } from "./fs_pb";
18
18
  import type { InspectRequest } from "./fs_pb";
19
+ import type { RollbackResponse } from "./fs_pb";
20
+ import type { RollbackRequest } from "./fs_pb";
19
21
  import type { UpdateResponse } from "./fs_pb";
20
22
  import type { UpdateRequest } from "./fs_pb";
21
23
  import type { ClientStreamingCall } from "@protobuf-ts/runtime-rpc";
@@ -66,6 +68,10 @@ export interface IFsClient {
66
68
  * @generated from protobuf rpc: Update(stream pb.UpdateRequest) returns (pb.UpdateResponse);
67
69
  */
68
70
  update(options?: RpcOptions): ClientStreamingCall<UpdateRequest, UpdateResponse>;
71
+ /**
72
+ * @generated from protobuf rpc: Rollback(pb.RollbackRequest) returns (pb.RollbackResponse);
73
+ */
74
+ rollback(input: RollbackRequest, options?: RpcOptions): UnaryCall<RollbackRequest, RollbackResponse>;
69
75
  /**
70
76
  * @generated from protobuf rpc: Inspect(pb.InspectRequest) returns (pb.InspectResponse);
71
77
  */
@@ -138,6 +144,10 @@ export declare class FsClient implements IFsClient, ServiceInfo {
138
144
  * @generated from protobuf rpc: Update(stream pb.UpdateRequest) returns (pb.UpdateResponse);
139
145
  */
140
146
  update(options?: RpcOptions): ClientStreamingCall<UpdateRequest, UpdateResponse>;
147
+ /**
148
+ * @generated from protobuf rpc: Rollback(pb.RollbackRequest) returns (pb.RollbackResponse);
149
+ */
150
+ rollback(input: RollbackRequest, options?: RpcOptions): UnaryCall<RollbackRequest, RollbackResponse>;
141
151
  /**
142
152
  * @generated from protobuf rpc: Inspect(pb.InspectRequest) returns (pb.InspectResponse);
143
153
  */
@@ -79,60 +79,67 @@ export class FsClient {
79
79
  const method = this.methods[6], opt = this._transport.mergeOptions(options);
80
80
  return stackIntercept("clientStreaming", this._transport, method, opt);
81
81
  }
82
+ /**
83
+ * @generated from protobuf rpc: Rollback(pb.RollbackRequest) returns (pb.RollbackResponse);
84
+ */
85
+ rollback(input, options) {
86
+ const method = this.methods[7], opt = this._transport.mergeOptions(options);
87
+ return stackIntercept("unary", this._transport, method, opt, input);
88
+ }
82
89
  /**
83
90
  * @generated from protobuf rpc: Inspect(pb.InspectRequest) returns (pb.InspectResponse);
84
91
  */
85
92
  inspect(input, options) {
86
- const method = this.methods[7], opt = this._transport.mergeOptions(options);
93
+ const method = this.methods[8], opt = this._transport.mergeOptions(options);
87
94
  return stackIntercept("unary", this._transport, method, opt, input);
88
95
  }
89
96
  /**
90
97
  * @generated from protobuf rpc: Snapshot(pb.SnapshotRequest) returns (pb.SnapshotResponse);
91
98
  */
92
99
  snapshot(input, options) {
93
- const method = this.methods[8], opt = this._transport.mergeOptions(options);
100
+ const method = this.methods[9], opt = this._transport.mergeOptions(options);
94
101
  return stackIntercept("unary", this._transport, method, opt, input);
95
102
  }
96
103
  /**
97
104
  * @generated from protobuf rpc: Reset(pb.ResetRequest) returns (pb.ResetResponse);
98
105
  */
99
106
  reset(input, options) {
100
- const method = this.methods[9], opt = this._transport.mergeOptions(options);
107
+ const method = this.methods[10], opt = this._transport.mergeOptions(options);
101
108
  return stackIntercept("unary", this._transport, method, opt, input);
102
109
  }
103
110
  /**
104
111
  * @generated from protobuf rpc: GcProject(pb.GcProjectRequest) returns (pb.GcProjectResponse);
105
112
  */
106
113
  gcProject(input, options) {
107
- const method = this.methods[10], opt = this._transport.mergeOptions(options);
114
+ const method = this.methods[11], opt = this._transport.mergeOptions(options);
108
115
  return stackIntercept("unary", this._transport, method, opt, input);
109
116
  }
110
117
  /**
111
118
  * @generated from protobuf rpc: GcRandomProjects(pb.GcRandomProjectsRequest) returns (pb.GcRandomProjectsResponse);
112
119
  */
113
120
  gcRandomProjects(input, options) {
114
- const method = this.methods[11], opt = this._transport.mergeOptions(options);
121
+ const method = this.methods[12], opt = this._transport.mergeOptions(options);
115
122
  return stackIntercept("unary", this._transport, method, opt, input);
116
123
  }
117
124
  /**
118
125
  * @generated from protobuf rpc: GcContents(pb.GcContentsRequest) returns (pb.GcContentsResponse);
119
126
  */
120
127
  gcContents(input, options) {
121
- const method = this.methods[12], opt = this._transport.mergeOptions(options);
128
+ const method = this.methods[13], opt = this._transport.mergeOptions(options);
122
129
  return stackIntercept("unary", this._transport, method, opt, input);
123
130
  }
124
131
  /**
125
132
  * @generated from protobuf rpc: CloneToProject(pb.CloneToProjectRequest) returns (pb.CloneToProjectResponse);
126
133
  */
127
134
  cloneToProject(input, options) {
128
- const method = this.methods[13], opt = this._transport.mergeOptions(options);
135
+ const method = this.methods[14], opt = this._transport.mergeOptions(options);
129
136
  return stackIntercept("unary", this._transport, method, opt, input);
130
137
  }
131
138
  /**
132
139
  * @generated from protobuf rpc: GetCache(pb.GetCacheRequest) returns (stream pb.GetCacheResponse);
133
140
  */
134
141
  getCache(input, options) {
135
- const method = this.methods[14], opt = this._transport.mergeOptions(options);
142
+ const method = this.methods[15], opt = this._transport.mergeOptions(options);
136
143
  return stackIntercept("serverStreaming", this._transport, method, opt, input);
137
144
  }
138
145
  }
@@ -1 +1 @@
1
- {"version":3,"file":"fs_pb.client.js","sourceRoot":"","sources":["../../../src/pb/fs_pb.client.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AA+B7B,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAsE1D;;GAEG;AACH,MAAM,OAAO,QAAQ;IAIjB,YAA6B,UAAwB;;;;;mBAAxB;;QAH7B;;;;mBAAW,EAAE,CAAC,QAAQ;WAAC;QACvB;;;;mBAAU,EAAE,CAAC,OAAO;WAAC;QACrB;;;;mBAAU,EAAE,CAAC,OAAO;WAAC;IAErB,CAAC;IACD;;OAEG;IACH,UAAU,CAAC,KAAwB,EAAE,OAAoB;QACrD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAC5E,OAAO,cAAc,CAAwC,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IAC/G,CAAC;IACD;;OAEG;IACH,aAAa,CAAC,KAA2B,EAAE,OAAoB;QAC3D,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAC5E,OAAO,cAAc,CAA8C,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IACrH,CAAC;IACD;;OAEG;IACH,YAAY,CAAC,KAA0B,EAAE,OAAoB;QACzD,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,O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AC,CAAC;IACrH,CAAC;CACJ","sourcesContent":["/* eslint-disable */\n// @generated by protobuf-ts 2.9.0 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 { 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: 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: Inspect(pb.InspectRequest) returns (pb.InspectResponse);\n */\n inspect(input: InspectRequest, options?: RpcOptions): UnaryCall<InspectRequest, InspectResponse> {\n const method = this.methods[7], 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[8], 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[9], 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[10], 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[11], 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[12], 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[13], 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[14], 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":[],"mappings":"AAOA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAiC7B,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AA0E1D;;GAEG;AACH,MAAM,OAAO,QAAQ;IAIjB,YAA6B,UAAwB;;;;;mBAAxB;;QAH7B;;;;mBAAW,EAAE,CAAC,QAAQ;WAAC;QACvB;;;;mBAAU,EAAE,CAAC,OAAO;WAAC;QACrB;;;;mB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uf 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"]}
@@ -257,6 +257,24 @@ export interface UpdateResponse {
257
257
  */
258
258
  version: bigint;
259
259
  }
260
+ /**
261
+ * @generated from protobuf message pb.RollbackRequest
262
+ */
263
+ export interface RollbackRequest {
264
+ /**
265
+ * @generated from protobuf field: int64 project = 1;
266
+ */
267
+ project: bigint;
268
+ /**
269
+ * @generated from protobuf field: int64 version = 2;
270
+ */
271
+ version: bigint;
272
+ }
273
+ /**
274
+ * @generated from protobuf message pb.RollbackResponse
275
+ */
276
+ export interface RollbackResponse {
277
+ }
260
278
  /**
261
279
  * @generated from protobuf message pb.InspectRequest
262
280
  */
@@ -624,6 +642,26 @@ declare class UpdateResponse$Type extends MessageType<UpdateResponse> {
624
642
  * @generated MessageType for protobuf message pb.UpdateResponse
625
643
  */
626
644
  export declare const UpdateResponse: UpdateResponse$Type;
645
+ declare class RollbackRequest$Type extends MessageType<RollbackRequest> {
646
+ constructor();
647
+ create(value?: PartialMessage<RollbackRequest>): RollbackRequest;
648
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: RollbackRequest): RollbackRequest;
649
+ internalBinaryWrite(message: RollbackRequest, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
650
+ }
651
+ /**
652
+ * @generated MessageType for protobuf message pb.RollbackRequest
653
+ */
654
+ export declare const RollbackRequest: RollbackRequest$Type;
655
+ declare class RollbackResponse$Type extends MessageType<RollbackResponse> {
656
+ constructor();
657
+ create(value?: PartialMessage<RollbackResponse>): RollbackResponse;
658
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: RollbackResponse): RollbackResponse;
659
+ internalBinaryWrite(message: RollbackResponse, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
660
+ }
661
+ /**
662
+ * @generated MessageType for protobuf message pb.RollbackResponse
663
+ */
664
+ export declare const RollbackResponse: RollbackResponse$Type;
627
665
  declare class InspectRequest$Type extends MessageType<InspectRequest> {
628
666
  constructor();
629
667
  create(value?: PartialMessage<InspectRequest>): InspectRequest;