forked from encoredev/encore
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support bucket refs in Encore.ts (encoredev#1583)
- Loading branch information
Showing
14 changed files
with
310 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export { Bucket } from "./bucket"; | ||
export type { BucketConfig, ObjectAttrs, UploadOptions } from "./bucket"; | ||
export { ObjectsError, ObjectNotFound, PreconditionFailed } from "./error"; | ||
export type { BucketPerms, Uploader, Downloader, Attrser, Lister, ReadWriter } from "./refs"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import type { AttrsOptions, DeleteOptions, DownloadOptions, ExistsOptions, ListEntry, ListOptions, ObjectAttrs, UploadOptions } from "./bucket"; | ||
|
||
export abstract class BucketPerms { | ||
private bucketPerms(): void { }; | ||
} | ||
|
||
export abstract class Uploader extends BucketPerms { | ||
abstract upload(name: string, data: Buffer, options?: UploadOptions): Promise<ObjectAttrs>; | ||
} | ||
|
||
export abstract class Downloader extends BucketPerms { | ||
abstract download(name: string, options?: DownloadOptions): Promise<Buffer>; | ||
} | ||
|
||
export abstract class Attrser extends BucketPerms { | ||
abstract attrs(name: string, options?: AttrsOptions): Promise<ObjectAttrs>; | ||
abstract exists(name: string, options?: ExistsOptions): Promise<boolean>; | ||
} | ||
|
||
export abstract class Lister extends BucketPerms { | ||
abstract list(options: ListOptions): AsyncGenerator<ListEntry>; | ||
} | ||
|
||
export abstract class Remover extends BucketPerms { | ||
abstract remove(name: string, options?: DeleteOptions): Promise<void>; | ||
} | ||
|
||
export type ReadWriter = | ||
& Uploader | ||
& Downloader | ||
& Attrser | ||
& Lister | ||
& Remover; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.