@encore.dev/sdk 2.0.0-beta.15 → 2.0.0-beta.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +111 -101
- package/app_meta.ts +56 -54
- package/config/config.ts +60 -57
- package/config/secrets.ts +45 -52
- package/config/value.ts +23 -26
- package/cron/mod.ts +28 -29
- package/dist/app_meta.d.ts +52 -50
- package/dist/app_meta.d.ts.map +1 -1
- package/dist/app_meta.js +2 -2
- package/dist/app_meta.js.map +1 -1
- package/dist/config/config.d.ts +58 -55
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/config.js +8 -9
- package/dist/config/config.js.map +1 -1
- package/dist/config/secrets.d.ts +45 -52
- package/dist/config/secrets.d.ts.map +1 -1
- package/dist/config/secrets.js +8 -9
- package/dist/config/secrets.js.map +1 -1
- package/dist/config/value.d.ts +20 -23
- package/dist/config/value.d.ts.map +1 -1
- package/dist/config/value.js +20 -23
- package/dist/config/value.js.map +1 -1
- package/dist/cron/mod.d.ts +26 -27
- package/dist/cron/mod.d.ts.map +1 -1
- package/dist/cron/mod.js +13 -14
- package/dist/cron/mod.js.map +1 -1
- package/dist/frontends/mod.d.ts +20 -19
- package/dist/frontends/mod.d.ts.map +1 -1
- package/dist/frontends/mod.js +20 -19
- package/dist/frontends/mod.js.map +1 -1
- package/dist/gateway/errors.d.ts +28 -30
- package/dist/gateway/errors.d.ts.map +1 -1
- package/dist/gateway/errors.js +29 -31
- package/dist/gateway/errors.js.map +1 -1
- package/dist/gateway/match.d.ts +54 -54
- package/dist/gateway/match.d.ts.map +1 -1
- package/dist/gateway/match.js +56 -56
- package/dist/gateway/match.js.map +1 -1
- package/dist/gateway/middleware.d.ts +62 -64
- package/dist/gateway/middleware.d.ts.map +1 -1
- package/dist/gateway/middleware.js +1 -1
- package/dist/gateway/middleware.js.map +1 -1
- package/dist/gateway/mod.d.ts +64 -67
- package/dist/gateway/mod.d.ts.map +1 -1
- package/dist/gateway/mod.js +72 -76
- package/dist/gateway/mod.js.map +1 -1
- package/dist/gateway/request.d.ts +138 -134
- package/dist/gateway/request.d.ts.map +1 -1
- package/dist/gateway/request.js +117 -108
- package/dist/gateway/request.js.map +1 -1
- package/dist/gateway/serve.d.ts +29 -34
- package/dist/gateway/serve.d.ts.map +1 -1
- package/dist/gateway/serve.js +51 -56
- package/dist/gateway/serve.js.map +1 -1
- package/dist/gateways/mod.d.ts +23 -21
- package/dist/gateways/mod.d.ts.map +1 -1
- package/dist/gateways/mod.js +25 -23
- package/dist/gateways/mod.js.map +1 -1
- package/dist/internal/runtime/napi/napi.cjs +1 -1
- package/dist/internal/runtime/napi/napi.d.cts +10 -3
- package/dist/internal/runtime/shutdown.d.ts +75 -57
- package/dist/internal/runtime/shutdown.d.ts.map +1 -1
- package/dist/internal/runtime/shutdown.js +88 -84
- package/dist/internal/runtime/shutdown.js.map +1 -1
- package/dist/log/logger.d.ts +43 -37
- package/dist/log/logger.d.ts.map +1 -1
- package/dist/log/logger.js +26 -25
- package/dist/log/logger.js.map +1 -1
- package/dist/metrics/mod.d.ts +133 -114
- package/dist/metrics/mod.d.ts.map +1 -1
- package/dist/metrics/mod.js +109 -101
- package/dist/metrics/mod.js.map +1 -1
- package/dist/otel.d.ts +6 -3
- package/dist/otel.d.ts.map +1 -1
- package/dist/otel.js +6 -3
- package/dist/otel.js.map +1 -1
- package/dist/pubsub/subscription.d.ts +88 -116
- package/dist/pubsub/subscription.d.ts.map +1 -1
- package/dist/pubsub/subscription.js +14 -17
- package/dist/pubsub/subscription.js.map +1 -1
- package/dist/pubsub/topic.d.ts +86 -113
- package/dist/pubsub/topic.d.ts.map +1 -1
- package/dist/pubsub/topic.js +68 -82
- package/dist/pubsub/topic.js.map +1 -1
- package/dist/reqctx/mod.d.ts +83 -86
- package/dist/reqctx/mod.d.ts.map +1 -1
- package/dist/reqctx/mod.js +39 -41
- package/dist/reqctx/mod.js.map +1 -1
- package/dist/services/index.d.ts +76 -75
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +73 -71
- package/dist/services/index.js.map +1 -1
- package/dist/shutdown/mod.d.ts +26 -25
- package/dist/shutdown/mod.d.ts.map +1 -1
- package/dist/shutdown/mod.js +26 -25
- package/dist/shutdown/mod.js.map +1 -1
- package/dist/storage/clickhouse/database.d.ts +113 -115
- package/dist/storage/clickhouse/database.d.ts.map +1 -1
- package/dist/storage/clickhouse/database.js +65 -79
- package/dist/storage/clickhouse/database.js.map +1 -1
- package/dist/storage/clickhouse/errors.d.ts +25 -26
- package/dist/storage/clickhouse/errors.d.ts.map +1 -1
- package/dist/storage/clickhouse/errors.js +15 -17
- package/dist/storage/clickhouse/errors.js.map +1 -1
- package/dist/storage/clickhouse/mod.d.ts +10 -10
- package/dist/storage/clickhouse/mod.js +10 -10
- package/dist/storage/objects/bucket.d.ts +196 -225
- package/dist/storage/objects/bucket.d.ts.map +1 -1
- package/dist/storage/objects/bucket.js +71 -84
- package/dist/storage/objects/bucket.js.map +1 -1
- package/dist/storage/objects/error.d.ts +4 -4
- package/dist/storage/objects/error.js +4 -4
- package/dist/storage/postgres/database.d.ts +124 -149
- package/dist/storage/postgres/database.d.ts.map +1 -1
- package/dist/storage/postgres/database.js +98 -135
- package/dist/storage/postgres/database.js.map +1 -1
- package/dist/storage/postgres/errors.d.ts +42 -48
- package/dist/storage/postgres/errors.d.ts.map +1 -1
- package/dist/storage/postgres/errors.js +44 -51
- package/dist/storage/postgres/errors.js.map +1 -1
- package/dist/storage/postgres/interval.d.ts +19 -19
- package/dist/storage/postgres/interval.d.ts.map +1 -1
- package/dist/storage/postgres/interval.js +21 -21
- package/dist/storage/postgres/interval.js.map +1 -1
- package/dist/storage/redis/bitfield.d.ts +48 -23
- package/dist/storage/redis/bitfield.d.ts.map +1 -1
- package/dist/storage/redis/bitfield.js +38 -19
- package/dist/storage/redis/bitfield.js.map +1 -1
- package/dist/storage/redis/command.d.ts +16 -12
- package/dist/storage/redis/command.d.ts.map +1 -1
- package/dist/storage/redis/command.js +16 -12
- package/dist/storage/redis/command.js.map +1 -1
- package/dist/storage/redis/commands.d.ts +99 -100
- package/dist/storage/redis/commands.d.ts.map +1 -1
- package/dist/storage/redis/commands.js +84 -85
- package/dist/storage/redis/commands.js.map +1 -1
- package/dist/storage/redis/database.d.ts +138 -122
- package/dist/storage/redis/database.d.ts.map +1 -1
- package/dist/storage/redis/database.js +120 -101
- package/dist/storage/redis/database.js.map +1 -1
- package/dist/storage/redis/mod.d.ts +52 -48
- package/dist/storage/redis/mod.d.ts.map +1 -1
- package/dist/storage/redis/mod.js +52 -48
- package/dist/storage/redis/mod.js.map +1 -1
- package/dist/storage/redis/options.d.ts +26 -24
- package/dist/storage/redis/options.d.ts.map +1 -1
- package/dist/storage/redis/options.js.map +1 -1
- package/dist/storage/redis/pubsub.d.ts +16 -16
- package/dist/storage/redis/pubsub.d.ts.map +1 -1
- package/dist/storage/redis/pubsub.js +14 -14
- package/dist/storage/redis/pubsub.js.map +1 -1
- package/dist/storage/redis/reply.d.ts +80 -72
- package/dist/storage/redis/reply.d.ts.map +1 -1
- package/dist/storage/redis/reply.js +53 -46
- package/dist/storage/redis/reply.js.map +1 -1
- package/dist/storage/redis/scan.d.ts +4 -4
- package/dist/storage/redis/scan.d.ts.map +1 -1
- package/dist/storage/redis/scan.js +6 -6
- package/dist/storage/redis/scan.js.map +1 -1
- package/dist/storage/redis/script.d.ts +28 -21
- package/dist/storage/redis/script.d.ts.map +1 -1
- package/dist/storage/redis/script.js +29 -22
- package/dist/storage/redis/script.js.map +1 -1
- package/dist/storage/redis/target.d.ts +17 -1
- package/dist/storage/redis/target.d.ts.map +1 -1
- package/dist/storage/redis/target.js +30 -1
- package/dist/storage/redis/target.js.map +1 -1
- package/dist/storage/redis/wire.d.ts +6 -6
- package/dist/storage/redis/wire.d.ts.map +1 -1
- package/dist/storage/redis/wire.js +6 -6
- package/dist/storage/redis/wire.js.map +1 -1
- package/dist/testing/mod.d.ts +83 -88
- package/dist/testing/mod.d.ts.map +1 -1
- package/dist/testing/mod.js +75 -81
- package/dist/testing/mod.js.map +1 -1
- package/dist/testing/playwright.d.ts +28 -32
- package/dist/testing/playwright.d.ts.map +1 -1
- package/dist/testing/playwright.js +22 -27
- package/dist/testing/playwright.js.map +1 -1
- package/dist/testing/puppeteer.d.ts +11 -12
- package/dist/testing/puppeteer.d.ts.map +1 -1
- package/dist/testing/puppeteer.js +17 -18
- package/dist/testing/puppeteer.js.map +1 -1
- package/dist/testing/system.d.ts +72 -90
- package/dist/testing/system.d.ts.map +1 -1
- package/dist/testing/system.js +90 -107
- package/dist/testing/system.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/frontends/mod.test.ts +6 -2
- package/frontends/mod.ts +20 -19
- package/gateway/errors.ts +30 -32
- package/gateway/match.ts +61 -57
- package/gateway/middleware.ts +62 -64
- package/gateway/mod.ts +73 -76
- package/gateway/request.ts +143 -140
- package/gateway/serve.ts +58 -63
- package/gateways/mod.ts +25 -23
- package/internal/runtime/napi/napi.cjs +1 -1
- package/internal/runtime/napi/napi.d.cts +10 -3
- package/internal/runtime/shutdown.ts +113 -101
- package/log/logger.test.ts +8 -0
- package/log/logger.ts +48 -45
- package/metrics/mod.ts +138 -122
- package/otel.ts +6 -3
- package/package.json +1 -1
- package/pubsub/subscription.ts +93 -123
- package/pubsub/topic.ts +96 -130
- package/reqctx/mod.ts +83 -86
- package/services/index.ts +78 -78
- package/shutdown/mod.ts +26 -25
- package/storage/clickhouse/database.ts +115 -129
- package/storage/clickhouse/errors.ts +27 -29
- package/storage/clickhouse/mod.ts +10 -10
- package/storage/objects/bucket.ts +209 -239
- package/storage/objects/error.ts +4 -4
- package/storage/postgres/database.ts +131 -164
- package/storage/postgres/errors.ts +45 -52
- package/storage/postgres/interval.ts +21 -21
- package/storage/redis/bitfield.ts +51 -26
- package/storage/redis/command.ts +16 -12
- package/storage/redis/commands.ts +99 -100
- package/storage/redis/database.ts +145 -123
- package/storage/redis/mod.ts +52 -48
- package/storage/redis/options.ts +26 -24
- package/storage/redis/pubsub.ts +14 -14
- package/storage/redis/redis.test.ts +17 -2
- package/storage/redis/reply.ts +85 -77
- package/storage/redis/scan.ts +6 -6
- package/storage/redis/script.ts +29 -22
- package/storage/redis/target.ts +34 -1
- package/storage/redis/wire.ts +8 -8
- package/testing/mod.ts +99 -105
- package/testing/playwright.ts +32 -37
- package/testing/puppeteer.ts +22 -23
- package/testing/system.ts +117 -133
|
@@ -5,143 +5,139 @@ import * as runtime from '../../internal/runtime/mod.js';
|
|
|
5
5
|
import { StringLiteral } from '../../internal/utils/constraints.js';
|
|
6
6
|
import { BucketPerms, Uploader, SignedUploader, Downloader, SignedDownloader, Attrser, Lister, Remover, PublicUrler, AttrsUpdater, IfMatchUploader, IfMatchRemover } from './refs.js';
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* Storage tier indicating how frequently an object is accessed, used by cloud
|
|
9
|
+
* providers to price storage and retrieval:
|
|
10
10
|
*
|
|
11
|
-
* - `standard`:
|
|
12
|
-
* - `infrequent`:
|
|
13
|
-
* Standard-IA)
|
|
14
|
-
* - `cold`:
|
|
15
|
-
* Instant Retrieval; Standard-IA on Cloudflare R2)
|
|
16
|
-
*
|
|
11
|
+
* - `standard`: frequent access; no minimum storage duration or retrieval fee.
|
|
12
|
+
* - `infrequent`: accessed roughly once a month or less (GCS Nearline, S3
|
|
13
|
+
* Standard-IA); billed for at least 30 days with a per-read retrieval fee.
|
|
14
|
+
* - `cold`: accessed roughly once a quarter or less (GCS Coldline, S3 Glacier
|
|
15
|
+
* Instant Retrieval; Standard-IA on Cloudflare R2); billed for at least 90
|
|
16
|
+
* days with a higher per-read retrieval fee.
|
|
17
17
|
*
|
|
18
|
-
*
|
|
18
|
+
* Objects in every class remain immediately readable.
|
|
19
19
|
*/
|
|
20
20
|
export type StorageClass = 'standard' | 'infrequent' | 'cold';
|
|
21
21
|
/**
|
|
22
|
-
* Configuration options for declaring a Bucket.
|
|
23
|
-
*
|
|
24
|
-
* Encore reads the configuration when it builds the app, so its values must
|
|
25
|
-
* be literals.
|
|
22
|
+
* Configuration options for declaring a {@link Bucket}. Values must be
|
|
23
|
+
* literals so Encore can inspect them at build time.
|
|
26
24
|
*/
|
|
27
25
|
export interface BucketConfig {
|
|
28
26
|
/**
|
|
29
|
-
* Whether
|
|
30
|
-
*
|
|
27
|
+
* Whether objects in the bucket are publicly accessible via CDN.
|
|
28
|
+
* Defaults to `false`.
|
|
31
29
|
*/
|
|
32
30
|
public?: boolean;
|
|
33
31
|
/**
|
|
34
|
-
* Whether
|
|
35
|
-
* Defaults to false
|
|
32
|
+
* Whether object versioning is enabled on the bucket.
|
|
33
|
+
* Defaults to `false`.
|
|
36
34
|
*/
|
|
37
35
|
versioned?: boolean;
|
|
38
36
|
/**
|
|
39
|
-
*
|
|
40
|
-
* Defaults to `"standard"`.
|
|
37
|
+
* Default storage class for newly uploaded objects. Defaults to `"standard"`.
|
|
41
38
|
*
|
|
42
|
-
* `"auto"`
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
39
|
+
* Setting `"auto"` delegates class transitions to the provider based on
|
|
40
|
+
* access patterns (GCS Autoclass, S3 Intelligent-Tiering). When `"auto"` is
|
|
41
|
+
* set, individual uploads cannot override `storageClass` and lifecycle rules
|
|
42
|
+
* cannot transition storage classes.
|
|
46
43
|
*/
|
|
47
44
|
storageClass?: StorageClass | 'auto';
|
|
48
45
|
/**
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
46
|
+
* Lifecycle rules that automatically transition objects to colder storage
|
|
47
|
+
* classes or delete them as they age. Providers evaluate rules
|
|
48
|
+
* asynchronously (typically within a day), including for existing objects.
|
|
52
49
|
*/
|
|
53
50
|
lifecycle?: LifecycleRule[];
|
|
54
51
|
/**
|
|
55
|
-
*
|
|
56
|
-
*
|
|
52
|
+
* Minimum retention period applied to every object in the bucket; objects
|
|
53
|
+
* cannot be deleted or overwritten before this period elapses.
|
|
57
54
|
*/
|
|
58
55
|
retention?: Retention;
|
|
59
56
|
/**
|
|
60
|
-
* Whether objects can
|
|
61
|
-
*
|
|
62
|
-
* Defaults to false if unset.
|
|
57
|
+
* Whether individual objects can specify their own `retainUntil` timestamp
|
|
58
|
+
* via upload options and {@link Bucket.extendRetention}. Defaults to `false`.
|
|
63
59
|
*/
|
|
64
60
|
objectRetention?: boolean;
|
|
65
61
|
/**
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
62
|
+
* Static string-literal tags that classify the bucket for policy checks
|
|
63
|
+
* (e.g. `{data: "pci"}`). Keys and values may contain lowercase letters,
|
|
64
|
+
* digits, `_`, and `-`, up to 63 characters. Keys must start with a letter
|
|
65
|
+
* and cannot start with the reserved prefix `encore`. At most 32 tags.
|
|
70
66
|
*/
|
|
71
67
|
tags?: Record<string, string>;
|
|
72
68
|
}
|
|
73
69
|
/**
|
|
74
|
-
* A lifecycle rule
|
|
75
|
-
* whole numbers from 1 to 36500
|
|
76
|
-
*
|
|
70
|
+
* A lifecycle rule with an optional key prefix and at least one action. Day
|
|
71
|
+
* counts are whole numbers from 1 to 36500 measured from creation time (or
|
|
72
|
+
* from replacement/deletion time for noncurrent version rules).
|
|
77
73
|
*/
|
|
78
74
|
export interface LifecycleRule {
|
|
79
|
-
/**
|
|
75
|
+
/** Restrict the rule to objects whose names start with this prefix. Defaults to all objects. */
|
|
80
76
|
prefix?: string;
|
|
81
77
|
/**
|
|
82
|
-
*
|
|
83
|
-
*
|
|
78
|
+
* Transition objects to `infrequent` storage this many days after creation.
|
|
79
|
+
* Must be at least 30.
|
|
84
80
|
*/
|
|
85
81
|
moveToInfrequentAfterDays?: number;
|
|
86
82
|
/**
|
|
87
|
-
*
|
|
88
|
-
* `moveToInfrequentAfterDays`, at least 30 days
|
|
83
|
+
* Transition objects to `cold` storage this many days after creation. When
|
|
84
|
+
* combined with `moveToInfrequentAfterDays`, must be at least 30 days later.
|
|
89
85
|
*/
|
|
90
86
|
moveToColdAfterDays?: number;
|
|
91
87
|
/**
|
|
92
|
-
* Delete
|
|
93
|
-
*
|
|
88
|
+
* Delete objects this many days after creation. In versioned buckets, the
|
|
89
|
+
* object becomes a noncurrent version (just like {@link Bucket.remove}).
|
|
94
90
|
*/
|
|
95
91
|
deleteAfterDays?: number;
|
|
96
92
|
/**
|
|
97
|
-
* Versioned buckets: delete
|
|
98
|
-
*
|
|
93
|
+
* Versioned buckets only: delete noncurrent versions this many days after
|
|
94
|
+
* they were replaced or removed.
|
|
99
95
|
*/
|
|
100
96
|
deleteNoncurrentAfterDays?: number;
|
|
101
97
|
/**
|
|
102
|
-
* Versioned buckets:
|
|
103
|
-
* versions
|
|
98
|
+
* Versioned buckets only: retain at least this many of the newest noncurrent
|
|
99
|
+
* versions (deleting older noncurrent versions beyond this count when used
|
|
100
|
+
* on its own).
|
|
104
101
|
*/
|
|
105
102
|
keepNoncurrentVersions?: number;
|
|
106
103
|
}
|
|
107
104
|
/**
|
|
108
|
-
*
|
|
105
|
+
* Bucket-level retention period.
|
|
109
106
|
*/
|
|
110
107
|
export interface Retention {
|
|
111
|
-
/**
|
|
108
|
+
/** Number of days (1 to 36500) to retain each object after creation. */
|
|
112
109
|
days: number;
|
|
113
110
|
}
|
|
114
111
|
/**
|
|
115
|
-
*
|
|
112
|
+
* Declares an Object Storage bucket infrastructure resource.
|
|
116
113
|
*/
|
|
117
114
|
export declare class Bucket extends BucketPerms implements Uploader, SignedUploader, Downloader, SignedDownloader, Attrser, Lister, Remover, PublicUrler, AttrsUpdater, IfMatchUploader, IfMatchRemover {
|
|
118
115
|
private readonly bucketName;
|
|
119
|
-
/**
|
|
116
|
+
/** Native runtime bucket, initialized lazily in test mode. */
|
|
120
117
|
private own?;
|
|
121
118
|
/**
|
|
122
|
-
*
|
|
119
|
+
* Declares a new bucket with the given name and configuration.
|
|
123
120
|
*/
|
|
124
121
|
constructor(name: string, cfg?: BucketConfig);
|
|
125
|
-
/**
|
|
126
|
-
* @internal */
|
|
122
|
+
/** Native bucket handle (resolves to the current test's instance in test mode). @internal */
|
|
127
123
|
get impl(): runtime.Bucket;
|
|
128
124
|
/**
|
|
129
|
-
*
|
|
130
|
-
* To
|
|
125
|
+
* References an existing bucket by name.
|
|
126
|
+
* To declare a new bucket, use `new Bucket(...)` instead.
|
|
131
127
|
*/
|
|
132
128
|
static named<name extends string>(name: StringLiteral<name>): Bucket;
|
|
133
129
|
/**
|
|
134
|
-
* Lists
|
|
130
|
+
* Lists objects in the bucket in lexicographical order by name.
|
|
135
131
|
*
|
|
136
|
-
*
|
|
137
|
-
* delimiter are grouped into
|
|
138
|
-
*
|
|
132
|
+
* When `delimiter` is set, keys sharing a common prefix past `options.prefix`
|
|
133
|
+
* up to the delimiter are grouped into a single entry with `isPrefix: true`
|
|
134
|
+
* (similar to a directory listing).
|
|
139
135
|
*/
|
|
140
136
|
list(options?: ListOptions): AsyncGenerator<ListEntry>;
|
|
141
137
|
/**
|
|
142
|
-
* Lists
|
|
143
|
-
*
|
|
144
|
-
*
|
|
138
|
+
* Lists all stored object versions in the bucket, sorted by name and then
|
|
139
|
+
* newest first. Deleted objects have no `latest` version. In unversioned
|
|
140
|
+
* buckets, yields one `latest` version per object.
|
|
145
141
|
*/
|
|
146
142
|
listVersions(options?: ListVersionsOptions): AsyncGenerator<ObjectVersion>;
|
|
147
143
|
/**
|
|
@@ -151,7 +147,7 @@ export declare class Bucket extends BucketPerms implements Uploader, SignedUploa
|
|
|
151
147
|
exists(name: string, options?: ExistsOptions): Promise<boolean>;
|
|
152
148
|
/**
|
|
153
149
|
* Returns the object's attributes.
|
|
154
|
-
* Throws
|
|
150
|
+
* Throws `ObjectNotFound` if the object does not exist.
|
|
155
151
|
*/
|
|
156
152
|
attrs(name: string, options?: AttrsOptions): Promise<ObjectAttrs>;
|
|
157
153
|
/**
|
|
@@ -159,76 +155,68 @@ export declare class Bucket extends BucketPerms implements Uploader, SignedUploa
|
|
|
159
155
|
*/
|
|
160
156
|
upload(name: string, data: Uint8Array, options?: UploadOptions): Promise<ObjectAttrs>;
|
|
161
157
|
/**
|
|
162
|
-
* Uploads an object
|
|
163
|
-
* `
|
|
164
|
-
*
|
|
165
|
-
* its bytes.
|
|
158
|
+
* Uploads an object from a byte stream — a Web `ReadableStream`, Node.js
|
|
159
|
+
* `Readable`, or any async iterable of `Uint8Array` chunks — pulling chunks
|
|
160
|
+
* as the upload consumes them.
|
|
166
161
|
*
|
|
167
162
|
* If the stream errors, the upload is aborted and nothing is stored.
|
|
168
163
|
*/
|
|
169
164
|
uploadStream(name: string, data: AsyncIterable<Uint8Array> | ReadableStream<Uint8Array>, options?: UploadOptions): Promise<ObjectAttrs>;
|
|
170
165
|
/**
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
* concurrent writers. A missing revision throws `InvalidArgument`.
|
|
176
|
-
*
|
|
177
|
-
* `data` is bytes or a stream, as `upload` and `uploadStream` take.
|
|
166
|
+
* Conditionally uploads an object only if the bucket still holds `revision`
|
|
167
|
+
* (returned by `download`, `attrs`, `upload`, `updateAttrs`, or `list`),
|
|
168
|
+
* throwing `PreconditionFailed` if the object changed or was deleted. Throws
|
|
169
|
+
* `InvalidArgument` if `revision` is missing.
|
|
178
170
|
*
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
* `InvalidArgument`
|
|
171
|
+
* `data` may be a `Uint8Array` or a stream (as in {@link upload} and
|
|
172
|
+
* {@link uploadStream}). Comparisons check object contents rather than
|
|
173
|
+
* metadata, so {@link updateAttrs} does not invalidate a match. GCS matches
|
|
174
|
+
* on `revision.version` (throwing `InvalidArgument` if absent), while S3 and
|
|
175
|
+
* Cloudflare R2 match on `revision.etag`.
|
|
183
176
|
*
|
|
184
|
-
* On
|
|
185
|
-
*
|
|
177
|
+
* On AWS S3, conditional writes also require read permission, which Encore
|
|
178
|
+
* grants automatically to calling services.
|
|
186
179
|
*/
|
|
187
180
|
uploadIfMatch(name: string, data: Uint8Array | AsyncIterable<Uint8Array> | ReadableStream<Uint8Array>, revision: Revision, options?: UploadIfMatchOptions): Promise<ObjectAttrs>;
|
|
188
181
|
/**
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
* `metadata`
|
|
182
|
+
* Updates the specified attributes of an object while leaving omitted
|
|
183
|
+
* attributes unchanged. Pass an empty string to clear an attribute (clearing
|
|
184
|
+
* `contentType` resets it to `application/octet-stream`), and pass a new
|
|
185
|
+
* `metadata` object to replace the entire metadata map (`{}` clears it).
|
|
193
186
|
*
|
|
194
|
-
* On S3
|
|
195
|
-
*
|
|
187
|
+
* On AWS S3, updating attributes rewrites the object, creating a new version
|
|
188
|
+
* in versioned buckets and resetting the object's lifecycle age.
|
|
196
189
|
*/
|
|
197
190
|
updateAttrs(name: string, attrs: UpdateAttrs, options?: UpdateAttrsOptions): Promise<ObjectAttrs>;
|
|
198
191
|
/**
|
|
199
|
-
*
|
|
200
|
-
* extended
|
|
201
|
-
* `InvalidArgument`.
|
|
192
|
+
* Extends the object's retention until at least `until`. Retention can only
|
|
193
|
+
* be extended — passing a time earlier than the current retention throws
|
|
194
|
+
* `InvalidArgument`. Requires `objectRetention: true` on the bucket.
|
|
202
195
|
*/
|
|
203
196
|
extendRetention(name: string, until: Date, options?: ExtendRetentionOptions): Promise<ObjectAttrs>;
|
|
204
197
|
/**
|
|
205
|
-
*
|
|
198
|
+
* Generates a pre-signed URL allowing anyone with the URL to upload to
|
|
199
|
+
* `name` without additional authentication.
|
|
206
200
|
*
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
* The URL doesn't carry the bucket's storage class: an object uploaded
|
|
211
|
-
* through it gets the provider's default class for the bucket.
|
|
201
|
+
* Note: Pre-signed upload URLs do not enforce the bucket's configured
|
|
202
|
+
* `storageClass`; uploaded objects receive the provider's default class.
|
|
212
203
|
*/
|
|
213
204
|
signedUploadUrl(name: string, options?: UploadUrlOptions): Promise<SignedUploadUrl>;
|
|
214
205
|
/**
|
|
215
|
-
*
|
|
216
|
-
*
|
|
217
|
-
* Anyone with possession of the URL can download the given object without
|
|
218
|
-
* any additional auth.
|
|
206
|
+
* Generates a pre-signed URL allowing anyone with the URL to download `name`
|
|
207
|
+
* without additional authentication.
|
|
219
208
|
*/
|
|
220
209
|
signedDownloadUrl(name: string, options?: DownloadUrlOptions): Promise<SignedDownloadUrl>;
|
|
221
210
|
/**
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
* range
|
|
225
|
-
*
|
|
226
|
-
* arrive (`stream`).
|
|
211
|
+
* Starts downloading an object from the bucket. Resolves as soon as the
|
|
212
|
+
* provider responds (throwing immediately if the object is missing or the
|
|
213
|
+
* byte range is invalid), returning a {@link Download} with response
|
|
214
|
+
* metadata and one-shot `bytes()` / `stream()` readers.
|
|
227
215
|
*
|
|
228
216
|
* ```ts
|
|
229
217
|
* const d = await uploads.download("state.json");
|
|
230
218
|
* const state = JSON.parse((await d.bytes()).toString());
|
|
231
|
-
* //
|
|
219
|
+
* // Write only if nobody else updated the object since we read it.
|
|
232
220
|
* await uploads.uploadIfMatch("state.json", next(state), d.revision);
|
|
233
221
|
* ```
|
|
234
222
|
*/
|
|
@@ -239,24 +227,21 @@ export declare class Bucket extends BucketPerms implements Uploader, SignedUploa
|
|
|
239
227
|
*/
|
|
240
228
|
remove(name: string, options?: DeleteOptions): Promise<void>;
|
|
241
229
|
/**
|
|
242
|
-
*
|
|
243
|
-
*
|
|
244
|
-
*
|
|
245
|
-
*
|
|
246
|
-
* `version` to remove. A missing revision throws `InvalidArgument`.
|
|
230
|
+
* Conditionally removes an object only if its latest version still matches
|
|
231
|
+
* `revision` (returned by `download`, `attrs`, `upload`, `updateAttrs`, or
|
|
232
|
+
* `list`), throwing `PreconditionFailed` if it changed or no longer exists.
|
|
233
|
+
* Throws `InvalidArgument` if `revision` is missing.
|
|
247
234
|
*
|
|
248
|
-
*
|
|
249
|
-
*
|
|
250
|
-
*
|
|
251
|
-
*
|
|
252
|
-
* bucket, which Encore grants to the services that call this. Cloudflare
|
|
253
|
-
* R2 doesn't support conditional deletes: there it throws
|
|
235
|
+
* Comparisons check object contents rather than metadata, so
|
|
236
|
+
* {@link updateAttrs} does not invalidate a match. On AWS S3, conditional
|
|
237
|
+
* deletes require read permission (granted automatically by Encore).
|
|
238
|
+
* Cloudflare R2 does not support conditional deletes and throws
|
|
254
239
|
* `InvalidArgument`.
|
|
255
240
|
*/
|
|
256
241
|
removeIfMatch(name: string, revision: Revision): Promise<void>;
|
|
257
242
|
/**
|
|
258
|
-
* Returns the public URL for accessing the object
|
|
259
|
-
* Throws an error if the bucket is not public
|
|
243
|
+
* Returns the public CDN URL for accessing the object.
|
|
244
|
+
* Throws an error if the bucket is not declared with `public: true`.
|
|
260
245
|
*/
|
|
261
246
|
publicUrl(name: string): string;
|
|
262
247
|
ref<P extends BucketPerms>(): P;
|
|
@@ -266,18 +251,18 @@ export declare class Bucket extends BucketPerms implements Uploader, SignedUploa
|
|
|
266
251
|
*/
|
|
267
252
|
export interface ListOptions {
|
|
268
253
|
/**
|
|
269
|
-
* Only include objects with this prefix
|
|
270
|
-
*
|
|
254
|
+
* Only include objects whose names start with this prefix.
|
|
255
|
+
* Defaults to all objects.
|
|
271
256
|
*/
|
|
272
257
|
prefix?: string;
|
|
273
258
|
/**
|
|
274
|
-
* Maximum number of entries to return
|
|
275
|
-
*
|
|
259
|
+
* Maximum number of entries to return (including common prefixes).
|
|
260
|
+
* Unlimited when unset.
|
|
276
261
|
*/
|
|
277
262
|
limit?: number;
|
|
278
263
|
/**
|
|
279
|
-
*
|
|
280
|
-
*
|
|
264
|
+
* Delimiter (typically `"/"`) used to group object names past `prefix` into
|
|
265
|
+
* single common-prefix entries.
|
|
281
266
|
*/
|
|
282
267
|
delimiter?: string;
|
|
283
268
|
}
|
|
@@ -286,34 +271,30 @@ export interface ListOptions {
|
|
|
286
271
|
*/
|
|
287
272
|
export interface ListVersionsOptions {
|
|
288
273
|
/**
|
|
289
|
-
* Only include objects with this prefix
|
|
290
|
-
*
|
|
274
|
+
* Only include objects whose names start with this prefix.
|
|
275
|
+
* Defaults to all objects.
|
|
291
276
|
*/
|
|
292
277
|
prefix?: string;
|
|
293
|
-
/** Maximum number of versions to return.
|
|
278
|
+
/** Maximum number of versions to return. Unlimited when unset. */
|
|
294
279
|
limit?: number;
|
|
295
280
|
}
|
|
296
281
|
/**
|
|
297
|
-
* Options for retrieving
|
|
282
|
+
* Options for retrieving an object's attributes.
|
|
298
283
|
*/
|
|
299
284
|
export interface AttrsOptions {
|
|
300
285
|
/**
|
|
301
|
-
*
|
|
302
|
-
*
|
|
303
|
-
*
|
|
304
|
-
* If bucket versioning is not enabled, this option is ignored.
|
|
286
|
+
* Object version to inspect. Defaults to the latest version.
|
|
287
|
+
* Ignored if bucket versioning is disabled.
|
|
305
288
|
*/
|
|
306
289
|
version?: string;
|
|
307
290
|
}
|
|
308
291
|
/**
|
|
309
|
-
* Options for checking
|
|
292
|
+
* Options for checking whether an object exists.
|
|
310
293
|
*/
|
|
311
294
|
export interface ExistsOptions {
|
|
312
295
|
/**
|
|
313
|
-
*
|
|
314
|
-
*
|
|
315
|
-
*
|
|
316
|
-
* If bucket versioning is not enabled, this option is ignored.
|
|
296
|
+
* Object version to check. Defaults to the latest version.
|
|
297
|
+
* Ignored if bucket versioning is disabled.
|
|
317
298
|
*/
|
|
318
299
|
version?: string;
|
|
319
300
|
}
|
|
@@ -322,31 +303,28 @@ export interface ExistsOptions {
|
|
|
322
303
|
*/
|
|
323
304
|
export interface DeleteOptions {
|
|
324
305
|
/**
|
|
325
|
-
*
|
|
326
|
-
*
|
|
327
|
-
*
|
|
328
|
-
* If bucket versioning is not enabled, this option is ignored.
|
|
306
|
+
* Object version to delete. Defaults to the latest version.
|
|
307
|
+
* Ignored if bucket versioning is disabled.
|
|
329
308
|
*/
|
|
330
309
|
version?: string;
|
|
331
310
|
}
|
|
332
311
|
/**
|
|
333
|
-
* A contiguous byte range within an object: `length` bytes
|
|
334
|
-
* or the
|
|
312
|
+
* A contiguous byte range within an object: either `length` bytes starting at
|
|
313
|
+
* `offset`, or the final `last` bytes of the object.
|
|
335
314
|
*/
|
|
336
315
|
export type ByteRange = {
|
|
337
|
-
/**
|
|
316
|
+
/** Zero-based index of the first byte to read. */
|
|
338
317
|
offset: number;
|
|
339
318
|
/**
|
|
340
|
-
*
|
|
341
|
-
*
|
|
319
|
+
* Number of bytes to read. Reads through the end of the object when
|
|
320
|
+
* omitted.
|
|
342
321
|
*/
|
|
343
322
|
length?: number;
|
|
344
323
|
last?: never;
|
|
345
324
|
} | {
|
|
346
325
|
/**
|
|
347
|
-
* Read the
|
|
348
|
-
*
|
|
349
|
-
* is, and so where in it the bytes are.
|
|
326
|
+
* Read the final `last` bytes of the object (or the entire object if it
|
|
327
|
+
* is shorter). Check {@link Download.size} for the object's full length.
|
|
350
328
|
*/
|
|
351
329
|
last: number;
|
|
352
330
|
offset?: never;
|
|
@@ -357,130 +335,122 @@ export type ByteRange = {
|
|
|
357
335
|
*/
|
|
358
336
|
export interface DownloadOptions {
|
|
359
337
|
/**
|
|
360
|
-
*
|
|
361
|
-
*
|
|
362
|
-
*
|
|
363
|
-
* If bucket versioning is not enabled, this option is ignored.
|
|
338
|
+
* Object version to download. Defaults to the latest version.
|
|
339
|
+
* Ignored if bucket versioning is disabled.
|
|
364
340
|
*/
|
|
365
341
|
version?: string;
|
|
366
342
|
/**
|
|
367
|
-
*
|
|
368
|
-
*
|
|
369
|
-
*
|
|
343
|
+
* Optional byte range to download instead of the full object. The body
|
|
344
|
+
* contains only the requested slice while {@link Download.size} still
|
|
345
|
+
* reports the full object size.
|
|
370
346
|
*
|
|
371
|
-
* Throws InvalidArgument if the range is empty or
|
|
372
|
-
*
|
|
347
|
+
* Throws `InvalidArgument` if the range is empty or starts past the end of
|
|
348
|
+
* the object.
|
|
373
349
|
*/
|
|
374
350
|
range?: ByteRange;
|
|
375
351
|
}
|
|
376
352
|
/**
|
|
377
|
-
*
|
|
378
|
-
*
|
|
379
|
-
* once, whole or as they arrive.
|
|
353
|
+
* An in-progress download returned by {@link Bucket.download}, exposing basic
|
|
354
|
+
* response metadata and one-shot body readers (`bytes()` or `stream()`).
|
|
380
355
|
*
|
|
381
|
-
*
|
|
382
|
-
*
|
|
383
|
-
*
|
|
384
|
-
*
|
|
385
|
-
* it is garbage collected. To give one up, cancel its stream:
|
|
386
|
-
* `await d.stream().cancel()`.
|
|
356
|
+
* Includes only the metadata providers send alongside download responses (use
|
|
357
|
+
* {@link Bucket.attrs} for full metadata). An unread download holds its
|
|
358
|
+
* connection open until garbage collected; call `await d.stream().cancel()` to
|
|
359
|
+
* release it early.
|
|
387
360
|
*/
|
|
388
361
|
export interface Download {
|
|
389
362
|
/**
|
|
390
|
-
*
|
|
391
|
-
*
|
|
392
|
-
* was read.
|
|
363
|
+
* Revision of the downloaded contents. Pass to {@link Bucket.uploadIfMatch}
|
|
364
|
+
* or {@link Bucket.removeIfMatch} for optimistic concurrency control.
|
|
393
365
|
*/
|
|
394
366
|
readonly revision: Revision;
|
|
395
|
-
/**
|
|
367
|
+
/** Full object size in bytes, even when downloading a byte range. */
|
|
396
368
|
readonly size: number;
|
|
397
369
|
readonly contentType?: string;
|
|
398
|
-
/**
|
|
370
|
+
/** Last modification timestamp, if reported by the provider. */
|
|
399
371
|
readonly lastModified?: Date;
|
|
400
372
|
/**
|
|
401
|
-
*
|
|
402
|
-
* already
|
|
373
|
+
* Buffers and returns the entire download body. Throws `InvalidArgument` if
|
|
374
|
+
* the body has already been consumed.
|
|
403
375
|
*/
|
|
404
376
|
bytes(): Promise<Buffer>;
|
|
405
377
|
/**
|
|
406
|
-
*
|
|
407
|
-
*
|
|
408
|
-
*
|
|
378
|
+
* Streams the download body as a Web `ReadableStream`. Canceling the stream
|
|
379
|
+
* aborts the download. Throws `InvalidArgument` if the body has already been
|
|
380
|
+
* consumed.
|
|
409
381
|
*
|
|
410
|
-
* In Node.js, `Readable.fromWeb`
|
|
382
|
+
* In Node.js, use `Readable.fromWeb` to convert this into a Node stream.
|
|
411
383
|
*/
|
|
412
384
|
stream(): ReadableStream<Uint8Array>;
|
|
413
385
|
}
|
|
414
386
|
/**
|
|
415
|
-
*
|
|
416
|
-
* `
|
|
417
|
-
*
|
|
418
|
-
* download's `revision` is one, of the contents it reads.
|
|
387
|
+
* Identifies a specific content revision of an object for conditional
|
|
388
|
+
* operations (`uploadIfMatch`, `removeIfMatch`, and `updateAttrs` `ifMatch`).
|
|
389
|
+
* Both {@link ObjectAttrs} and {@link Download.revision} satisfy `Revision`.
|
|
419
390
|
*/
|
|
420
391
|
export interface Revision {
|
|
421
392
|
etag: string;
|
|
422
393
|
version?: string;
|
|
423
394
|
}
|
|
424
395
|
/**
|
|
425
|
-
*
|
|
396
|
+
* Preconditions for an upload.
|
|
426
397
|
*/
|
|
427
398
|
export interface Preconditions {
|
|
428
399
|
/**
|
|
429
|
-
* Only write the object if it does not exist
|
|
430
|
-
*
|
|
400
|
+
* Only write the object if it does not already exist; throws
|
|
401
|
+
* `PreconditionFailed` otherwise.
|
|
431
402
|
*/
|
|
432
403
|
notExists?: boolean;
|
|
433
404
|
}
|
|
434
405
|
/**
|
|
435
|
-
*
|
|
406
|
+
* Attributes of an object stored in a bucket.
|
|
436
407
|
*/
|
|
437
408
|
export interface ObjectAttrs {
|
|
438
409
|
name: string;
|
|
439
410
|
size: number;
|
|
440
|
-
/**
|
|
411
|
+
/** Object version identifier, if bucket versioning is enabled. */
|
|
441
412
|
version?: string;
|
|
442
413
|
etag: string;
|
|
443
414
|
contentType?: string;
|
|
444
415
|
cacheControl?: string;
|
|
445
416
|
contentDisposition?: string;
|
|
446
|
-
/** Custom metadata
|
|
417
|
+
/** Custom metadata map (empty object if none). */
|
|
447
418
|
metadata: Record<string, string>;
|
|
448
|
-
/**
|
|
419
|
+
/** Timestamp when this object version was written. */
|
|
449
420
|
lastModified?: Date;
|
|
450
421
|
/**
|
|
451
|
-
*
|
|
452
|
-
* `
|
|
453
|
-
* set outside Encore.
|
|
422
|
+
* Object storage class (`"auto"` for buckets with `storageClass: "auto"`,
|
|
423
|
+
* or `undefined` if a provider-specific class was set outside Encore).
|
|
454
424
|
*/
|
|
455
425
|
storageClass?: StorageClass | 'auto';
|
|
456
|
-
/**
|
|
426
|
+
/** Per-object retain-until timestamp, if set. */
|
|
457
427
|
retainUntil?: Date;
|
|
458
428
|
}
|
|
459
429
|
/**
|
|
460
|
-
* A single entry
|
|
430
|
+
* A single entry yielded by {@link Bucket.list}.
|
|
461
431
|
*/
|
|
462
432
|
export interface ListEntry {
|
|
463
|
-
/**
|
|
433
|
+
/** Object key, or common prefix ending with the delimiter. */
|
|
464
434
|
name: string;
|
|
465
435
|
size: number;
|
|
466
436
|
etag: string;
|
|
467
|
-
/**
|
|
437
|
+
/** Timestamp when the object was written (unset for common prefixes). */
|
|
468
438
|
lastModified?: Date;
|
|
469
439
|
/**
|
|
470
|
-
*
|
|
471
|
-
*
|
|
440
|
+
* `true` when this entry represents a common prefix grouped by a delimiter
|
|
441
|
+
* (with `size: 0` and empty `etag`), rather than an object.
|
|
472
442
|
*/
|
|
473
443
|
isPrefix: boolean;
|
|
474
444
|
}
|
|
475
445
|
/**
|
|
476
|
-
*
|
|
446
|
+
* A single stored object version yielded by {@link Bucket.listVersions}.
|
|
477
447
|
*/
|
|
478
448
|
export interface ObjectVersion {
|
|
479
449
|
name: string;
|
|
480
450
|
version?: string;
|
|
481
451
|
size: number;
|
|
482
452
|
etag: string;
|
|
483
|
-
/** Whether this is the object's current version. */
|
|
453
|
+
/** Whether this is the object's current (latest) version. */
|
|
484
454
|
latest: boolean;
|
|
485
455
|
lastModified?: Date;
|
|
486
456
|
}
|
|
@@ -489,34 +459,35 @@ export interface ObjectVersion {
|
|
|
489
459
|
*/
|
|
490
460
|
export interface UploadOptions {
|
|
491
461
|
contentType?: string;
|
|
492
|
-
/**
|
|
462
|
+
/** `Cache-Control` header returned when downloading the object. */
|
|
493
463
|
cacheControl?: string;
|
|
494
|
-
/**
|
|
464
|
+
/** `Content-Disposition` header returned when downloading the object. */
|
|
495
465
|
contentDisposition?: string;
|
|
496
466
|
/**
|
|
497
|
-
* Custom metadata. Keys match `[a-z0-9][a-z0-9_-]*` and
|
|
498
|
-
* printable ASCII.
|
|
467
|
+
* Custom key-value metadata. Keys must match `[a-z0-9][a-z0-9_-]*` and
|
|
468
|
+
* values must be printable ASCII. Total size is limited to 8 KiB on GCS and
|
|
499
469
|
* 2 KiB on S3.
|
|
500
470
|
*/
|
|
501
471
|
metadata?: Record<string, string>;
|
|
502
|
-
/**
|
|
472
|
+
/** Object storage class. Defaults to the bucket's configured storage class. */
|
|
503
473
|
storageClass?: StorageClass;
|
|
504
474
|
/**
|
|
505
|
-
*
|
|
506
|
-
*
|
|
475
|
+
* Prevents the object from being deleted or overwritten until this time.
|
|
476
|
+
* Requires `objectRetention: true` on the bucket.
|
|
507
477
|
*/
|
|
508
478
|
retainUntil?: Date;
|
|
509
479
|
preconditions?: Preconditions;
|
|
510
480
|
}
|
|
511
481
|
/**
|
|
512
|
-
* Options for
|
|
482
|
+
* Options for {@link Bucket.uploadIfMatch} (all {@link UploadOptions} except
|
|
483
|
+
* `preconditions`).
|
|
513
484
|
*/
|
|
514
485
|
export type UploadIfMatchOptions = Omit<UploadOptions, 'preconditions'>;
|
|
515
486
|
/**
|
|
516
|
-
*
|
|
517
|
-
*
|
|
518
|
-
* `application/octet-stream
|
|
519
|
-
* clears it.
|
|
487
|
+
* Attributes to update via {@link Bucket.updateAttrs}. Omitted fields remain
|
|
488
|
+
* unchanged; an empty string clears a field (clearing `contentType` resets it
|
|
489
|
+
* to `application/octet-stream`). `metadata` replaces the entire map (`{}`
|
|
490
|
+
* clears it).
|
|
520
491
|
*/
|
|
521
492
|
export interface UpdateAttrs {
|
|
522
493
|
contentType?: string;
|
|
@@ -528,12 +499,12 @@ export interface UpdateAttrs {
|
|
|
528
499
|
* Options for updating an object's attributes.
|
|
529
500
|
*/
|
|
530
501
|
export interface UpdateAttrsOptions {
|
|
531
|
-
/**
|
|
502
|
+
/** Object version to update. Defaults to the latest version. */
|
|
532
503
|
version?: string;
|
|
533
504
|
preconditions?: {
|
|
534
505
|
/**
|
|
535
|
-
* Only update the object if it
|
|
536
|
-
*
|
|
506
|
+
* Only update the object if it still matches this revision; throws
|
|
507
|
+
* `PreconditionFailed` otherwise.
|
|
537
508
|
*/
|
|
538
509
|
ifMatch?: Revision;
|
|
539
510
|
};
|
|
@@ -542,16 +513,16 @@ export interface UpdateAttrsOptions {
|
|
|
542
513
|
* Options for extending an object's retention.
|
|
543
514
|
*/
|
|
544
515
|
export interface ExtendRetentionOptions {
|
|
545
|
-
/**
|
|
516
|
+
/** Object version to retain. Defaults to the latest version. */
|
|
546
517
|
version?: string;
|
|
547
518
|
}
|
|
548
519
|
/**
|
|
549
520
|
* Options for generating a signed upload URL.
|
|
550
521
|
*/
|
|
551
522
|
export interface UploadUrlOptions {
|
|
552
|
-
/**
|
|
553
|
-
*
|
|
554
|
-
|
|
523
|
+
/**
|
|
524
|
+
* URL lifetime in seconds from creation (maximum 7 days; defaults to 1 hour).
|
|
525
|
+
*/
|
|
555
526
|
ttl?: number;
|
|
556
527
|
}
|
|
557
528
|
/**
|
|
@@ -564,9 +535,9 @@ export interface SignedUploadUrl {
|
|
|
564
535
|
* Options for generating a signed download URL.
|
|
565
536
|
*/
|
|
566
537
|
export interface DownloadUrlOptions {
|
|
567
|
-
/**
|
|
568
|
-
*
|
|
569
|
-
|
|
538
|
+
/**
|
|
539
|
+
* URL lifetime in seconds from creation (maximum 7 days; defaults to 1 hour).
|
|
540
|
+
*/
|
|
570
541
|
ttl?: number;
|
|
571
542
|
}
|
|
572
543
|
/**
|