@encore.dev/sdk 2.0.0-beta.14 → 2.0.0-beta.16
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 +144 -90
- package/app_meta.ts +56 -54
- package/config/config.test.ts +47 -13
- package/config/config.ts +60 -57
- package/config/secrets.ts +47 -50
- package/config/value.ts +23 -26
- package/cron/mod.test.ts +12 -0
- package/cron/mod.ts +37 -22
- 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 -50
- package/dist/config/secrets.d.ts.map +1 -1
- package/dist/config/secrets.js +11 -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 +34 -20
- package/dist/cron/mod.d.ts.map +1 -1
- package/dist/cron/mod.js +13 -13
- 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/otel/http.d.ts +4 -2
- package/dist/internal/otel/http.d.ts.map +1 -1
- package/dist/internal/otel/http.js +32 -5
- package/dist/internal/otel/http.js.map +1 -1
- package/dist/internal/runtime/napi/napi.cjs +6 -5
- package/dist/internal/runtime/napi/napi.d.cts +58 -16
- 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/redaction/mod.d.ts +62 -0
- package/dist/redaction/mod.d.ts.map +1 -0
- package/dist/redaction/mod.js +102 -0
- package/dist/redaction/mod.js.map +1 -0
- 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 +230 -203
- package/dist/storage/objects/bucket.d.ts.map +1 -1
- package/dist/storage/objects/bucket.js +146 -106
- 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/objects/mod.d.ts +1 -1
- package/dist/storage/objects/mod.d.ts.map +1 -1
- package/dist/storage/objects/mod.js.map +1 -1
- package/dist/storage/objects/refs.d.ts +2 -5
- package/dist/storage/objects/refs.d.ts.map +1 -1
- package/dist/storage/objects/refs.js.map +1 -1
- 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/tracing/http.d.ts +2 -1
- package/dist/tracing/http.d.ts.map +1 -1
- package/dist/tracing/http.js +2 -1
- package/dist/tracing/http.js.map +1 -1
- package/dist/tracing/node.d.ts.map +1 -1
- package/dist/tracing/node.js +1 -1
- package/dist/tracing/node.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/otel/http.test.ts +50 -0
- package/internal/otel/http.ts +40 -5
- package/internal/runtime/napi/napi.cjs +6 -5
- package/internal/runtime/napi/napi.d.cts +58 -16
- 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 +6 -1
- package/pubsub/subscription.ts +93 -123
- package/pubsub/topic.ts +96 -130
- package/redaction/bridge.test.ts +99 -0
- package/redaction/mod.test.ts +188 -0
- package/redaction/mod.ts +226 -0
- 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.test.ts +168 -16
- package/storage/objects/bucket.ts +336 -247
- package/storage/objects/error.ts +4 -4
- package/storage/objects/mod.ts +1 -0
- package/storage/objects/refs.ts +2 -5
- 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
- package/tracing/http.ts +2 -1
- package/tracing/native.test.ts +158 -8
- package/tracing/node.ts +1 -0
|
@@ -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,101 +155,93 @@ 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
|
-
* 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
|
-
|
|
225
|
-
|
|
226
|
-
* Downloads an object from the bucket as a Web `ReadableStream`, read
|
|
227
|
-
* from the provider as the consumer reads it. A missing object throws
|
|
228
|
-
* here, before any bytes. Cancelling the stream stops the download.
|
|
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.
|
|
229
215
|
*
|
|
230
|
-
*
|
|
216
|
+
* ```ts
|
|
217
|
+
* const d = await uploads.download("state.json");
|
|
218
|
+
* const state = JSON.parse((await d.bytes()).toString());
|
|
219
|
+
* // Write only if nobody else updated the object since we read it.
|
|
220
|
+
* await uploads.uploadIfMatch("state.json", next(state), d.revision);
|
|
221
|
+
* ```
|
|
231
222
|
*/
|
|
232
|
-
|
|
223
|
+
download(name: string, options?: DownloadOptions): Promise<Download>;
|
|
233
224
|
/**
|
|
234
225
|
* Removes an object from the bucket.
|
|
235
226
|
* Throws an error on network failure.
|
|
236
227
|
*/
|
|
237
228
|
remove(name: string, options?: DeleteOptions): Promise<void>;
|
|
238
229
|
/**
|
|
239
|
-
*
|
|
240
|
-
*
|
|
241
|
-
*
|
|
242
|
-
*
|
|
243
|
-
* 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.
|
|
244
234
|
*
|
|
245
|
-
*
|
|
246
|
-
*
|
|
247
|
-
*
|
|
248
|
-
*
|
|
249
|
-
* bucket, which Encore grants to the services that call this. Cloudflare
|
|
250
|
-
* 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
|
|
251
239
|
* `InvalidArgument`.
|
|
252
240
|
*/
|
|
253
241
|
removeIfMatch(name: string, revision: Revision): Promise<void>;
|
|
254
242
|
/**
|
|
255
|
-
* Returns the public URL for accessing the object
|
|
256
|
-
* 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`.
|
|
257
245
|
*/
|
|
258
246
|
publicUrl(name: string): string;
|
|
259
247
|
ref<P extends BucketPerms>(): P;
|
|
@@ -263,18 +251,18 @@ export declare class Bucket extends BucketPerms implements Uploader, SignedUploa
|
|
|
263
251
|
*/
|
|
264
252
|
export interface ListOptions {
|
|
265
253
|
/**
|
|
266
|
-
* Only include objects with this prefix
|
|
267
|
-
*
|
|
254
|
+
* Only include objects whose names start with this prefix.
|
|
255
|
+
* Defaults to all objects.
|
|
268
256
|
*/
|
|
269
257
|
prefix?: string;
|
|
270
258
|
/**
|
|
271
|
-
* Maximum number of entries to return
|
|
272
|
-
*
|
|
259
|
+
* Maximum number of entries to return (including common prefixes).
|
|
260
|
+
* Unlimited when unset.
|
|
273
261
|
*/
|
|
274
262
|
limit?: number;
|
|
275
263
|
/**
|
|
276
|
-
*
|
|
277
|
-
*
|
|
264
|
+
* Delimiter (typically `"/"`) used to group object names past `prefix` into
|
|
265
|
+
* single common-prefix entries.
|
|
278
266
|
*/
|
|
279
267
|
delimiter?: string;
|
|
280
268
|
}
|
|
@@ -283,34 +271,30 @@ export interface ListOptions {
|
|
|
283
271
|
*/
|
|
284
272
|
export interface ListVersionsOptions {
|
|
285
273
|
/**
|
|
286
|
-
* Only include objects with this prefix
|
|
287
|
-
*
|
|
274
|
+
* Only include objects whose names start with this prefix.
|
|
275
|
+
* Defaults to all objects.
|
|
288
276
|
*/
|
|
289
277
|
prefix?: string;
|
|
290
|
-
/** Maximum number of versions to return.
|
|
278
|
+
/** Maximum number of versions to return. Unlimited when unset. */
|
|
291
279
|
limit?: number;
|
|
292
280
|
}
|
|
293
281
|
/**
|
|
294
|
-
* Options for retrieving
|
|
282
|
+
* Options for retrieving an object's attributes.
|
|
295
283
|
*/
|
|
296
284
|
export interface AttrsOptions {
|
|
297
285
|
/**
|
|
298
|
-
*
|
|
299
|
-
*
|
|
300
|
-
*
|
|
301
|
-
* 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.
|
|
302
288
|
*/
|
|
303
289
|
version?: string;
|
|
304
290
|
}
|
|
305
291
|
/**
|
|
306
|
-
* Options for checking
|
|
292
|
+
* Options for checking whether an object exists.
|
|
307
293
|
*/
|
|
308
294
|
export interface ExistsOptions {
|
|
309
295
|
/**
|
|
310
|
-
*
|
|
311
|
-
*
|
|
312
|
-
*
|
|
313
|
-
* 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.
|
|
314
298
|
*/
|
|
315
299
|
version?: string;
|
|
316
300
|
}
|
|
@@ -319,112 +303,154 @@ export interface ExistsOptions {
|
|
|
319
303
|
*/
|
|
320
304
|
export interface DeleteOptions {
|
|
321
305
|
/**
|
|
322
|
-
*
|
|
323
|
-
*
|
|
324
|
-
*
|
|
325
|
-
* 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.
|
|
326
308
|
*/
|
|
327
309
|
version?: string;
|
|
328
310
|
}
|
|
329
311
|
/**
|
|
330
|
-
* A contiguous byte range within an object
|
|
312
|
+
* A contiguous byte range within an object: either `length` bytes starting at
|
|
313
|
+
* `offset`, or the final `last` bytes of the object.
|
|
331
314
|
*/
|
|
332
|
-
export
|
|
333
|
-
/**
|
|
315
|
+
export type ByteRange = {
|
|
316
|
+
/** Zero-based index of the first byte to read. */
|
|
334
317
|
offset: number;
|
|
335
318
|
/**
|
|
336
|
-
*
|
|
337
|
-
*
|
|
319
|
+
* Number of bytes to read. Reads through the end of the object when
|
|
320
|
+
* omitted.
|
|
338
321
|
*/
|
|
339
322
|
length?: number;
|
|
340
|
-
|
|
323
|
+
last?: never;
|
|
324
|
+
} | {
|
|
325
|
+
/**
|
|
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.
|
|
328
|
+
*/
|
|
329
|
+
last: number;
|
|
330
|
+
offset?: never;
|
|
331
|
+
length?: never;
|
|
332
|
+
};
|
|
341
333
|
/**
|
|
342
334
|
* Options for downloading an object from a bucket.
|
|
343
335
|
*/
|
|
344
336
|
export interface DownloadOptions {
|
|
345
337
|
/**
|
|
346
|
-
*
|
|
347
|
-
*
|
|
348
|
-
*
|
|
349
|
-
* 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.
|
|
350
340
|
*/
|
|
351
341
|
version?: string;
|
|
352
342
|
/**
|
|
353
|
-
*
|
|
354
|
-
*
|
|
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.
|
|
355
346
|
*
|
|
356
|
-
* Throws InvalidArgument if the range is empty or
|
|
357
|
-
*
|
|
347
|
+
* Throws `InvalidArgument` if the range is empty or starts past the end of
|
|
348
|
+
* the object.
|
|
358
349
|
*/
|
|
359
350
|
range?: ByteRange;
|
|
360
351
|
}
|
|
361
352
|
/**
|
|
362
|
-
*
|
|
363
|
-
*
|
|
364
|
-
*
|
|
353
|
+
* An in-progress download returned by {@link Bucket.download}, exposing basic
|
|
354
|
+
* response metadata and one-shot body readers (`bytes()` or `stream()`).
|
|
355
|
+
*
|
|
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.
|
|
360
|
+
*/
|
|
361
|
+
export interface Download {
|
|
362
|
+
/**
|
|
363
|
+
* Revision of the downloaded contents. Pass to {@link Bucket.uploadIfMatch}
|
|
364
|
+
* or {@link Bucket.removeIfMatch} for optimistic concurrency control.
|
|
365
|
+
*/
|
|
366
|
+
readonly revision: Revision;
|
|
367
|
+
/** Full object size in bytes, even when downloading a byte range. */
|
|
368
|
+
readonly size: number;
|
|
369
|
+
readonly contentType?: string;
|
|
370
|
+
/** Last modification timestamp, if reported by the provider. */
|
|
371
|
+
readonly lastModified?: Date;
|
|
372
|
+
/**
|
|
373
|
+
* Buffers and returns the entire download body. Throws `InvalidArgument` if
|
|
374
|
+
* the body has already been consumed.
|
|
375
|
+
*/
|
|
376
|
+
bytes(): Promise<Buffer>;
|
|
377
|
+
/**
|
|
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.
|
|
381
|
+
*
|
|
382
|
+
* In Node.js, use `Readable.fromWeb` to convert this into a Node stream.
|
|
383
|
+
*/
|
|
384
|
+
stream(): ReadableStream<Uint8Array>;
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
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`.
|
|
365
390
|
*/
|
|
366
391
|
export interface Revision {
|
|
367
392
|
etag: string;
|
|
368
393
|
version?: string;
|
|
369
394
|
}
|
|
370
395
|
/**
|
|
371
|
-
*
|
|
396
|
+
* Preconditions for an upload.
|
|
372
397
|
*/
|
|
373
398
|
export interface Preconditions {
|
|
374
399
|
/**
|
|
375
|
-
* Only write the object if it does not exist
|
|
376
|
-
*
|
|
400
|
+
* Only write the object if it does not already exist; throws
|
|
401
|
+
* `PreconditionFailed` otherwise.
|
|
377
402
|
*/
|
|
378
403
|
notExists?: boolean;
|
|
379
404
|
}
|
|
380
405
|
/**
|
|
381
|
-
*
|
|
406
|
+
* Attributes of an object stored in a bucket.
|
|
382
407
|
*/
|
|
383
408
|
export interface ObjectAttrs {
|
|
384
409
|
name: string;
|
|
385
410
|
size: number;
|
|
386
|
-
/**
|
|
411
|
+
/** Object version identifier, if bucket versioning is enabled. */
|
|
387
412
|
version?: string;
|
|
388
413
|
etag: string;
|
|
389
414
|
contentType?: string;
|
|
390
415
|
cacheControl?: string;
|
|
391
416
|
contentDisposition?: string;
|
|
392
|
-
/** Custom metadata
|
|
417
|
+
/** Custom metadata map (empty object if none). */
|
|
393
418
|
metadata: Record<string, string>;
|
|
394
|
-
/**
|
|
419
|
+
/** Timestamp when this object version was written. */
|
|
395
420
|
lastModified?: Date;
|
|
396
421
|
/**
|
|
397
|
-
*
|
|
398
|
-
* `
|
|
399
|
-
* 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).
|
|
400
424
|
*/
|
|
401
425
|
storageClass?: StorageClass | 'auto';
|
|
402
|
-
/**
|
|
426
|
+
/** Per-object retain-until timestamp, if set. */
|
|
403
427
|
retainUntil?: Date;
|
|
404
428
|
}
|
|
405
429
|
/**
|
|
406
|
-
* A single entry
|
|
430
|
+
* A single entry yielded by {@link Bucket.list}.
|
|
407
431
|
*/
|
|
408
432
|
export interface ListEntry {
|
|
409
|
-
/**
|
|
433
|
+
/** Object key, or common prefix ending with the delimiter. */
|
|
410
434
|
name: string;
|
|
411
435
|
size: number;
|
|
412
436
|
etag: string;
|
|
437
|
+
/** Timestamp when the object was written (unset for common prefixes). */
|
|
438
|
+
lastModified?: Date;
|
|
413
439
|
/**
|
|
414
|
-
*
|
|
415
|
-
*
|
|
440
|
+
* `true` when this entry represents a common prefix grouped by a delimiter
|
|
441
|
+
* (with `size: 0` and empty `etag`), rather than an object.
|
|
416
442
|
*/
|
|
417
443
|
isPrefix: boolean;
|
|
418
444
|
}
|
|
419
445
|
/**
|
|
420
|
-
*
|
|
446
|
+
* A single stored object version yielded by {@link Bucket.listVersions}.
|
|
421
447
|
*/
|
|
422
448
|
export interface ObjectVersion {
|
|
423
449
|
name: string;
|
|
424
450
|
version?: string;
|
|
425
451
|
size: number;
|
|
426
452
|
etag: string;
|
|
427
|
-
/** Whether this is the object's current version. */
|
|
453
|
+
/** Whether this is the object's current (latest) version. */
|
|
428
454
|
latest: boolean;
|
|
429
455
|
lastModified?: Date;
|
|
430
456
|
}
|
|
@@ -433,34 +459,35 @@ export interface ObjectVersion {
|
|
|
433
459
|
*/
|
|
434
460
|
export interface UploadOptions {
|
|
435
461
|
contentType?: string;
|
|
436
|
-
/**
|
|
462
|
+
/** `Cache-Control` header returned when downloading the object. */
|
|
437
463
|
cacheControl?: string;
|
|
438
|
-
/**
|
|
464
|
+
/** `Content-Disposition` header returned when downloading the object. */
|
|
439
465
|
contentDisposition?: string;
|
|
440
466
|
/**
|
|
441
|
-
* Custom metadata. Keys match `[a-z0-9][a-z0-9_-]*` and
|
|
442
|
-
* 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
|
|
443
469
|
* 2 KiB on S3.
|
|
444
470
|
*/
|
|
445
471
|
metadata?: Record<string, string>;
|
|
446
|
-
/**
|
|
472
|
+
/** Object storage class. Defaults to the bucket's configured storage class. */
|
|
447
473
|
storageClass?: StorageClass;
|
|
448
474
|
/**
|
|
449
|
-
*
|
|
450
|
-
*
|
|
475
|
+
* Prevents the object from being deleted or overwritten until this time.
|
|
476
|
+
* Requires `objectRetention: true` on the bucket.
|
|
451
477
|
*/
|
|
452
478
|
retainUntil?: Date;
|
|
453
479
|
preconditions?: Preconditions;
|
|
454
480
|
}
|
|
455
481
|
/**
|
|
456
|
-
* Options for
|
|
482
|
+
* Options for {@link Bucket.uploadIfMatch} (all {@link UploadOptions} except
|
|
483
|
+
* `preconditions`).
|
|
457
484
|
*/
|
|
458
485
|
export type UploadIfMatchOptions = Omit<UploadOptions, 'preconditions'>;
|
|
459
486
|
/**
|
|
460
|
-
*
|
|
461
|
-
*
|
|
462
|
-
* `application/octet-stream
|
|
463
|
-
* 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).
|
|
464
491
|
*/
|
|
465
492
|
export interface UpdateAttrs {
|
|
466
493
|
contentType?: string;
|
|
@@ -472,12 +499,12 @@ export interface UpdateAttrs {
|
|
|
472
499
|
* Options for updating an object's attributes.
|
|
473
500
|
*/
|
|
474
501
|
export interface UpdateAttrsOptions {
|
|
475
|
-
/**
|
|
502
|
+
/** Object version to update. Defaults to the latest version. */
|
|
476
503
|
version?: string;
|
|
477
504
|
preconditions?: {
|
|
478
505
|
/**
|
|
479
|
-
* Only update the object if it
|
|
480
|
-
*
|
|
506
|
+
* Only update the object if it still matches this revision; throws
|
|
507
|
+
* `PreconditionFailed` otherwise.
|
|
481
508
|
*/
|
|
482
509
|
ifMatch?: Revision;
|
|
483
510
|
};
|
|
@@ -486,16 +513,16 @@ export interface UpdateAttrsOptions {
|
|
|
486
513
|
* Options for extending an object's retention.
|
|
487
514
|
*/
|
|
488
515
|
export interface ExtendRetentionOptions {
|
|
489
|
-
/**
|
|
516
|
+
/** Object version to retain. Defaults to the latest version. */
|
|
490
517
|
version?: string;
|
|
491
518
|
}
|
|
492
519
|
/**
|
|
493
520
|
* Options for generating a signed upload URL.
|
|
494
521
|
*/
|
|
495
522
|
export interface UploadUrlOptions {
|
|
496
|
-
/**
|
|
497
|
-
*
|
|
498
|
-
|
|
523
|
+
/**
|
|
524
|
+
* URL lifetime in seconds from creation (maximum 7 days; defaults to 1 hour).
|
|
525
|
+
*/
|
|
499
526
|
ttl?: number;
|
|
500
527
|
}
|
|
501
528
|
/**
|
|
@@ -508,9 +535,9 @@ export interface SignedUploadUrl {
|
|
|
508
535
|
* Options for generating a signed download URL.
|
|
509
536
|
*/
|
|
510
537
|
export interface DownloadUrlOptions {
|
|
511
|
-
/**
|
|
512
|
-
*
|
|
513
|
-
|
|
538
|
+
/**
|
|
539
|
+
* URL lifetime in seconds from creation (maximum 7 days; defaults to 1 hour).
|
|
540
|
+
*/
|
|
514
541
|
ttl?: number;
|
|
515
542
|
}
|
|
516
543
|
/**
|