()
| 376 | } |
| 377 | |
| 378 | private resolveR2Prefix(): string { |
| 379 | if (this.r2Prefix !== undefined) return this.r2Prefix; |
| 380 | const name = this._name; |
| 381 | if (!name) { |
| 382 | throw new Error( |
| 383 | "[Workspace] R2 is configured but no r2Prefix was provided and no name is available. " + |
| 384 | "Either pass r2Prefix in WorkspaceOptions or provide a name." |
| 385 | ); |
| 386 | } |
| 387 | return name; |
| 388 | } |
| 389 | |
| 390 | private r2Key(filePath: string): string { |
| 391 | return `${this.resolveR2Prefix()}/${this.namespace}${filePath}`; |