@encore.dev/sdk 2.0.0-beta.6 → 2.0.0-beta.8
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 +55 -0
- package/app_meta.ts +8 -0
- package/config/config.test.ts +10 -3
- package/config/config.ts +75 -21
- package/config/mod.ts +4 -3
- package/config/secrets.ts +72 -55
- package/cron/mod.ts +32 -0
- package/dist/app_meta.d.ts +7 -0
- package/dist/app_meta.d.ts.map +1 -0
- package/dist/app_meta.js +1 -0
- package/dist/app_meta.js.map +1 -1
- package/dist/config/config.d.ts +44 -18
- package/dist/config/config.d.ts.map +1 -0
- package/dist/config/config.js +43 -18
- package/dist/config/config.js.map +1 -1
- package/dist/config/mod.d.ts +5 -4
- package/dist/config/mod.d.ts.map +1 -0
- package/dist/config/mod.js +2 -2
- package/dist/config/mod.js.map +1 -1
- package/dist/config/secrets.d.ts +62 -39
- package/dist/config/secrets.d.ts.map +1 -0
- package/dist/config/secrets.js +21 -37
- package/dist/config/secrets.js.map +1 -1
- package/dist/config/value.d.ts +1 -0
- package/dist/config/value.d.ts.map +1 -0
- package/dist/cron/mod.d.ts +31 -0
- package/dist/cron/mod.d.ts.map +1 -0
- package/dist/cron/mod.js +23 -0
- package/dist/cron/mod.js.map +1 -1
- package/dist/gateway/errors.d.ts +101 -0
- package/dist/gateway/errors.d.ts.map +1 -0
- package/dist/gateway/errors.js +146 -0
- package/dist/gateway/errors.js.map +1 -0
- package/dist/gateway/match.d.ts +127 -0
- package/dist/gateway/match.d.ts.map +1 -0
- package/dist/gateway/match.js +206 -0
- package/dist/gateway/match.js.map +1 -0
- package/dist/gateway/middleware.d.ts +108 -0
- package/dist/gateway/middleware.d.ts.map +1 -0
- package/dist/gateway/middleware.js +9 -0
- package/dist/gateway/middleware.js.map +1 -0
- package/dist/gateway/mod.d.ts +129 -0
- package/dist/gateway/mod.d.ts.map +1 -0
- package/dist/gateway/mod.js +187 -0
- package/dist/gateway/mod.js.map +1 -0
- package/dist/gateway/request.d.ts +304 -0
- package/dist/gateway/request.d.ts.map +1 -0
- package/dist/gateway/request.js +403 -0
- package/dist/gateway/request.js.map +1 -0
- package/dist/gateway/serve.d.ts +114 -0
- package/dist/gateway/serve.d.ts.map +1 -0
- package/dist/gateway/serve.js +510 -0
- package/dist/gateway/serve.js.map +1 -0
- package/dist/internal/clients/call.d.ts +147 -0
- package/dist/internal/clients/call.d.ts.map +1 -0
- package/dist/internal/clients/call.js +274 -0
- package/dist/internal/clients/call.js.map +1 -0
- package/dist/internal/clients/grpc.d.ts +90 -0
- package/dist/internal/clients/grpc.d.ts.map +1 -0
- package/dist/internal/clients/grpc.js +355 -0
- package/dist/internal/clients/grpc.js.map +1 -0
- package/dist/internal/clients/mod.d.ts +81 -0
- package/dist/internal/clients/mod.d.ts.map +1 -0
- package/dist/internal/clients/mod.js +237 -0
- package/dist/internal/clients/mod.js.map +1 -0
- package/dist/internal/fetch.d.ts +54 -0
- package/dist/internal/fetch.d.ts.map +1 -0
- package/dist/internal/fetch.js +240 -0
- package/dist/internal/fetch.js.map +1 -0
- package/dist/internal/otel/backend.d.ts +2 -0
- package/dist/internal/otel/backend.d.ts.map +1 -0
- package/dist/internal/otel/context.d.ts +1 -0
- package/dist/internal/otel/context.d.ts.map +1 -0
- package/dist/internal/otel/context_manager.d.ts +1 -0
- package/dist/internal/otel/context_manager.d.ts.map +1 -0
- package/dist/internal/otel/encode.d.ts +2 -0
- package/dist/internal/otel/encode.d.ts.map +1 -0
- package/dist/internal/otel/index.d.ts +2 -2
- package/dist/internal/otel/index.d.ts.map +1 -0
- package/dist/internal/otel/index.js +1 -2
- package/dist/internal/otel/index.js.map +1 -1
- package/dist/internal/otel/meter.d.ts +1 -0
- package/dist/internal/otel/meter.d.ts.map +1 -0
- package/dist/internal/otel/propagator.d.ts +1 -0
- package/dist/internal/otel/propagator.d.ts.map +1 -0
- package/dist/internal/otel/provider.d.ts +1 -0
- package/dist/internal/otel/provider.d.ts.map +1 -0
- package/dist/internal/otel/span.d.ts +4 -0
- package/dist/internal/otel/span.d.ts.map +1 -0
- package/dist/internal/otel/span.js +5 -0
- package/dist/internal/otel/span.js.map +1 -1
- package/dist/internal/otel/tracer.d.ts +1 -0
- package/dist/internal/otel/tracer.d.ts.map +1 -0
- package/dist/internal/otel/tracer.js +11 -5
- package/dist/internal/otel/tracer.js.map +1 -1
- package/dist/internal/reqfields.d.ts +150 -0
- package/dist/internal/reqfields.d.ts.map +1 -0
- package/dist/internal/reqfields.js +312 -0
- package/dist/internal/reqfields.js.map +1 -0
- package/dist/internal/runtime/meter.d.ts +1 -0
- package/dist/internal/runtime/meter.d.ts.map +1 -0
- package/dist/internal/runtime/mod.d.ts +6 -0
- package/dist/internal/runtime/mod.d.ts.map +1 -0
- package/dist/internal/runtime/mod.js +32 -2
- package/dist/internal/runtime/mod.js.map +1 -1
- package/dist/internal/runtime/napi/napi.cjs +160 -16
- package/dist/internal/runtime/napi/napi.d.cts +474 -29
- package/dist/internal/runtime/shutdown.d.ts +5 -0
- package/dist/internal/runtime/shutdown.d.ts.map +1 -0
- package/dist/internal/runtime/shutdown.js +9 -1
- package/dist/internal/runtime/shutdown.js.map +1 -1
- package/dist/internal/testing/runner.d.ts +2 -0
- package/dist/internal/testing/runner.d.ts.map +1 -0
- package/dist/internal/testing/runner.js +10 -0
- package/dist/internal/testing/runner.js.map +1 -0
- package/dist/internal/testing/scope.d.ts +81 -0
- package/dist/internal/testing/scope.d.ts.map +1 -0
- package/dist/internal/testing/scope.js +237 -0
- package/dist/internal/testing/scope.js.map +1 -0
- package/dist/internal/utils/constraints.d.ts +1 -0
- package/dist/internal/utils/constraints.d.ts.map +1 -0
- package/dist/log/index.d.ts +1 -0
- package/dist/log/index.d.ts.map +1 -0
- package/dist/log/logger.d.ts +2 -0
- package/dist/log/logger.d.ts.map +1 -0
- package/dist/log/runtime.d.ts +2 -0
- package/dist/log/runtime.d.ts.map +1 -0
- package/dist/log/stderr.d.ts +1 -0
- package/dist/log/stderr.d.ts.map +1 -0
- package/dist/metrics/mod.d.ts +45 -118
- package/dist/metrics/mod.d.ts.map +1 -0
- package/dist/metrics/mod.js +44 -179
- package/dist/metrics/mod.js.map +1 -1
- package/dist/mod.d.ts +1 -2
- package/dist/mod.d.ts.map +1 -0
- package/dist/mod.js +0 -1
- package/dist/mod.js.map +1 -1
- package/dist/otel.d.ts +1 -0
- package/dist/otel.d.ts.map +1 -0
- package/dist/pubsub/encoding.d.ts +5 -0
- package/dist/pubsub/encoding.d.ts.map +1 -0
- package/dist/pubsub/encoding.js +10 -2
- package/dist/pubsub/encoding.js.map +1 -1
- package/dist/pubsub/mod.d.ts +4 -3
- package/dist/pubsub/mod.d.ts.map +1 -0
- package/dist/pubsub/mod.js +2 -2
- package/dist/pubsub/mod.js.map +1 -1
- package/dist/pubsub/refs.d.ts +8 -0
- package/dist/pubsub/refs.d.ts.map +1 -0
- package/dist/pubsub/refs.js.map +1 -1
- package/dist/pubsub/subscription.d.ts +104 -10
- package/dist/pubsub/subscription.d.ts.map +1 -0
- package/dist/pubsub/subscription.js +98 -16
- package/dist/pubsub/subscription.js.map +1 -1
- package/dist/pubsub/topic.d.ts +87 -23
- package/dist/pubsub/topic.d.ts.map +1 -0
- package/dist/pubsub/topic.js +143 -40
- package/dist/pubsub/topic.js.map +1 -1
- package/dist/reqctx/mod.d.ts +191 -0
- package/dist/reqctx/mod.d.ts.map +1 -0
- package/dist/reqctx/mod.js +160 -0
- package/dist/reqctx/mod.js.map +1 -0
- package/dist/services/index.d.ts +145 -4
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +155 -8
- package/dist/services/index.js.map +1 -1
- package/dist/shutdown/mod.d.ts +1 -0
- package/dist/shutdown/mod.d.ts.map +1 -0
- package/dist/storage/objects/bucket.d.ts +312 -7
- package/dist/storage/objects/bucket.d.ts.map +1 -0
- package/dist/storage/objects/bucket.js +305 -15
- package/dist/storage/objects/bucket.js.map +1 -1
- package/dist/storage/objects/error.d.ts +10 -0
- package/dist/storage/objects/error.d.ts.map +1 -0
- package/dist/storage/objects/error.js +25 -1
- package/dist/storage/objects/error.js.map +1 -1
- package/dist/storage/objects/mod.d.ts +4 -3
- package/dist/storage/objects/mod.d.ts.map +1 -0
- package/dist/storage/objects/mod.js +1 -1
- package/dist/storage/objects/mod.js.map +1 -1
- package/dist/storage/objects/refs.d.ts +20 -4
- package/dist/storage/objects/refs.d.ts.map +1 -0
- package/dist/storage/objects/refs.js +6 -0
- package/dist/storage/objects/refs.js.map +1 -1
- package/dist/storage/postgres/database.d.ts +81 -25
- package/dist/storage/postgres/database.d.ts.map +1 -0
- package/dist/storage/postgres/database.js +125 -37
- package/dist/storage/postgres/database.js.map +1 -1
- package/dist/storage/postgres/errors.d.ts +120 -0
- package/dist/storage/postgres/errors.d.ts.map +1 -0
- package/dist/storage/postgres/errors.js +162 -0
- package/dist/storage/postgres/errors.js.map +1 -0
- package/dist/storage/postgres/interval.d.ts +44 -0
- package/dist/storage/postgres/interval.d.ts.map +1 -0
- package/dist/storage/postgres/interval.js +153 -0
- package/dist/storage/postgres/interval.js.map +1 -0
- package/dist/storage/postgres/mod.d.ts +4 -1
- package/dist/storage/postgres/mod.d.ts.map +1 -0
- package/dist/storage/postgres/mod.js +2 -0
- package/dist/storage/postgres/mod.js.map +1 -1
- package/dist/storage/redis/bitfield.d.ts +67 -0
- package/dist/storage/redis/bitfield.d.ts.map +1 -0
- package/dist/storage/redis/bitfield.js +114 -0
- package/dist/storage/redis/bitfield.js.map +1 -0
- package/dist/storage/redis/command.d.ts +45 -0
- package/dist/storage/redis/command.d.ts.map +1 -0
- package/dist/storage/redis/command.js +78 -0
- package/dist/storage/redis/command.js.map +1 -0
- package/dist/storage/redis/commands.d.ts +223 -139
- package/dist/storage/redis/commands.d.ts.map +1 -0
- package/dist/storage/redis/commands.js +128 -6
- package/dist/storage/redis/commands.js.map +1 -1
- package/dist/storage/redis/database.d.ts +56 -22
- package/dist/storage/redis/database.d.ts.map +1 -0
- package/dist/storage/redis/database.js +62 -0
- package/dist/storage/redis/database.js.map +1 -1
- package/dist/storage/redis/mod.d.ts +31 -4
- package/dist/storage/redis/mod.d.ts.map +1 -0
- package/dist/storage/redis/mod.js +26 -1
- package/dist/storage/redis/mod.js.map +1 -1
- package/dist/storage/redis/native.d.ts +8 -0
- package/dist/storage/redis/native.d.ts.map +1 -0
- package/dist/storage/redis/native.js +10 -0
- package/dist/storage/redis/native.js.map +1 -1
- package/dist/storage/redis/options.d.ts +1 -0
- package/dist/storage/redis/options.d.ts.map +1 -0
- package/dist/storage/redis/pubsub.d.ts +2 -0
- package/dist/storage/redis/pubsub.d.ts.map +1 -0
- package/dist/storage/redis/reply.d.ts +34 -0
- package/dist/storage/redis/reply.d.ts.map +1 -0
- package/dist/storage/redis/reply.js +40 -1
- package/dist/storage/redis/reply.js.map +1 -1
- package/dist/storage/redis/scan.d.ts +1 -0
- package/dist/storage/redis/scan.d.ts.map +1 -0
- package/dist/storage/redis/script.d.ts +1 -0
- package/dist/storage/redis/script.d.ts.map +1 -0
- package/dist/storage/redis/target.d.ts +5 -3
- package/dist/storage/redis/target.d.ts.map +1 -0
- package/dist/storage/redis/target.js +39 -28
- package/dist/storage/redis/target.js.map +1 -1
- package/dist/storage/redis/wire.d.ts +7 -10
- package/dist/storage/redis/wire.d.ts.map +1 -0
- package/dist/storage/redis/wire.js +8 -32
- package/dist/storage/redis/wire.js.map +1 -1
- package/dist/testing/bun.d.ts +8 -0
- package/dist/testing/bun.d.ts.map +1 -0
- package/dist/testing/bun.js +13 -0
- package/dist/testing/bun.js.map +1 -0
- package/dist/testing/jest.d.ts +8 -0
- package/dist/testing/jest.d.ts.map +1 -0
- package/dist/testing/jest.js +11 -0
- package/dist/testing/jest.js.map +1 -0
- package/dist/testing/mod.d.ts +160 -0
- package/dist/testing/mod.d.ts.map +1 -0
- package/dist/testing/mod.js +227 -0
- package/dist/testing/mod.js.map +1 -0
- package/dist/testing/node.d.ts +9 -0
- package/dist/testing/node.d.ts.map +1 -0
- package/dist/testing/node.js +12 -0
- package/dist/testing/node.js.map +1 -0
- package/dist/testing/vitest.d.ts +8 -0
- package/dist/testing/vitest.d.ts.map +1 -0
- package/dist/testing/vitest.js +13 -0
- package/dist/testing/vitest.js.map +1 -0
- package/dist/tracing/mod.d.ts +19 -0
- package/dist/tracing/mod.d.ts.map +1 -0
- package/dist/tracing/mod.js +46 -0
- package/dist/tracing/mod.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/mod.d.ts +1 -0
- package/dist/types/mod.d.ts.map +1 -0
- package/gateway/errors.ts +172 -0
- package/gateway/gateway.e2e.test.ts +297 -0
- package/gateway/gateway.test.ts +891 -0
- package/gateway/match.ts +239 -0
- package/gateway/middleware.ts +134 -0
- package/gateway/mod.ts +210 -0
- package/gateway/request.ts +578 -0
- package/gateway/serve.ts +738 -0
- package/internal/clients/call.ts +389 -0
- package/internal/clients/grpc.test.ts +368 -0
- package/internal/clients/grpc.ts +485 -0
- package/internal/clients/mod.test.ts +464 -0
- package/internal/clients/mod.ts +337 -0
- package/internal/fetch.ts +276 -0
- package/internal/otel/index.ts +1 -7
- package/internal/otel/span.ts +6 -0
- package/internal/otel/tracer.test.ts +43 -15
- package/internal/otel/tracer.ts +12 -5
- package/internal/reqfields.ts +390 -0
- package/internal/runtime/mod.ts +41 -2
- package/internal/runtime/napi/napi.cjs +160 -16
- package/internal/runtime/napi/napi.d.cts +474 -29
- package/internal/runtime/shutdown.ts +11 -1
- package/internal/testing/runner.ts +10 -0
- package/internal/testing/scope.ts +273 -0
- package/metrics/mod.test.ts +13 -16
- package/metrics/mod.ts +57 -226
- package/mod.ts +0 -8
- package/otel.test.ts +13 -6
- package/package.json +67 -15
- package/pubsub/encoding.ts +11 -1
- package/pubsub/mod.ts +10 -3
- package/pubsub/pubsub.test.ts +232 -14
- package/pubsub/refs.ts +16 -0
- package/pubsub/subscription.ts +194 -16
- package/pubsub/topic.test.ts +26 -0
- package/pubsub/topic.ts +220 -25
- package/reqctx/mod.ts +284 -0
- package/reqctx/reqctx.test.ts +193 -0
- package/scripts/postprocess-docs.test.ts +48 -0
- package/services/index.test.ts +341 -1
- package/services/index.ts +183 -8
- package/storage/objects/bucket.test.ts +573 -0
- package/storage/objects/bucket.ts +649 -20
- package/storage/objects/error.ts +28 -1
- package/storage/objects/mod.ts +15 -0
- package/storage/objects/refs.ts +51 -3
- package/storage/postgres/database.integration.test.ts +275 -0
- package/storage/postgres/database.test.ts +193 -6
- package/storage/postgres/database.ts +202 -55
- package/storage/postgres/errors.ts +186 -0
- package/storage/postgres/interval.test.ts +72 -0
- package/storage/postgres/interval.ts +170 -0
- package/storage/postgres/mod.ts +4 -0
- package/storage/redis/bitfield.ts +162 -0
- package/storage/redis/command.ts +84 -0
- package/storage/redis/commands.ts +271 -21
- package/storage/redis/database.ts +77 -23
- package/storage/redis/mod.ts +38 -2
- package/storage/redis/native.ts +11 -0
- package/storage/redis/redis.test.ts +170 -10
- package/storage/redis/reply.ts +76 -1
- package/storage/redis/runtime.test.ts +15 -0
- package/storage/redis/target.ts +47 -44
- package/storage/redis/wire.ts +8 -32
- package/testing/bun.ts +13 -0
- package/testing/jest.ts +11 -0
- package/testing/mod.ts +337 -0
- package/testing/node.ts +12 -0
- package/testing/vitest.ts +13 -0
- package/tracing/mod.ts +82 -0
- package/tracing/native.test.ts +170 -0
- package/tracing/tracing.test.ts +317 -0
- package/dist/internal/otel/request_context.d.ts +0 -11
- package/dist/internal/otel/request_context.js +0 -20
- package/dist/internal/otel/request_context.js.map +0 -1
- package/dist/internal/reqtrack/mod.d.ts +0 -6
- package/dist/internal/reqtrack/mod.js +0 -28
- package/dist/internal/reqtrack/mod.js.map +0 -1
- package/dist/req_meta.d.ts +0 -47
- package/dist/req_meta.js +0 -26
- package/dist/req_meta.js.map +0 -1
- package/internal/otel/request_context.ts +0 -32
- package/internal/reqtrack/mod.ts +0 -39
- package/req_meta.ts +0 -75
|
@@ -19,15 +19,27 @@ export interface AttrsOptions {
|
|
|
19
19
|
export class Bucket {
|
|
20
20
|
object(name: string): BucketObject
|
|
21
21
|
list(options?: ListOptions | undefined | null, source?: Buffer | undefined | null): Promise<ListIterator | TypedObjectError>
|
|
22
|
+
listVersions(options?: ListOptions | undefined | null, source?: Buffer | undefined | null): Promise<VersionIterator | TypedObjectError>
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
export class BucketObject {
|
|
25
26
|
attrs(options?: AttrsOptions | undefined | null, source?: Buffer | undefined | null): Promise<ObjectAttrs | TypedObjectError>
|
|
26
27
|
exists(options?: ExistsOptions | undefined | null, source?: Buffer | undefined | null): Promise<boolean | TypedObjectError>
|
|
27
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Starts an upload whose bytes are written to the returned stream.
|
|
30
|
+
* Nothing is stored until it is finished: aborting it, or dropping it
|
|
31
|
+
* unfinished, stores nothing.
|
|
32
|
+
*/
|
|
33
|
+
uploadStream(options?: UploadOptions | undefined | null, source?: Buffer | undefined | null): UploadStream | TypedObjectError
|
|
34
|
+
/** Replaces the attributes given and leaves the others as they are. */
|
|
35
|
+
updateAttrs(attrs: UpdateAttrs, options?: UpdateAttrsOptions | undefined | null, source?: Buffer | undefined | null): Promise<ObjectAttrs | TypedObjectError>
|
|
36
|
+
/** Keeps the object until `until`, in milliseconds since the Unix epoch. */
|
|
37
|
+
extendRetention(until: number, options?: ExtendRetentionOptions | undefined | null, source?: Buffer | undefined | null): Promise<ObjectAttrs | TypedObjectError>
|
|
28
38
|
signedUploadUrl(options?: UploadUrlOptions | undefined | null, source?: Buffer | undefined | null): Promise<SignedUploadUrl | TypedObjectError>
|
|
29
39
|
signedDownloadUrl(options?: DownloadUrlOptions | undefined | null, source?: Buffer | undefined | null): Promise<SignedDownloadUrl | TypedObjectError>
|
|
30
40
|
downloadAll(options?: DownloadOptions | undefined | null, source?: Buffer | undefined | null): Promise<Buffer | TypedObjectError>
|
|
41
|
+
/** Opens a download. A missing object fails here, before any bytes. */
|
|
42
|
+
downloadStream(options?: DownloadOptions | undefined | null, source?: Buffer | undefined | null): Promise<DownloadStream | TypedObjectError>
|
|
31
43
|
delete(options?: DeleteOptions | undefined | null, source?: Buffer | undefined | null): Promise<TypedObjectError | null>
|
|
32
44
|
publicUrl(): string
|
|
33
45
|
}
|
|
@@ -119,12 +131,15 @@ export class Decimal {
|
|
|
119
131
|
|
|
120
132
|
export interface DeleteOptions {
|
|
121
133
|
version?: string
|
|
134
|
+
ifMatch?: Revision
|
|
122
135
|
}
|
|
123
136
|
|
|
124
137
|
export interface DeployMeta {
|
|
125
138
|
id: string
|
|
126
139
|
deployTime: string
|
|
127
140
|
hostedServices: Record<string, HostedService>
|
|
141
|
+
/** The Worker of its service the process runs; none for its main process. */
|
|
142
|
+
worker?: string
|
|
128
143
|
}
|
|
129
144
|
|
|
130
145
|
export interface DownloadOptions {
|
|
@@ -132,6 +147,17 @@ export interface DownloadOptions {
|
|
|
132
147
|
range?: ByteRange
|
|
133
148
|
}
|
|
134
149
|
|
|
150
|
+
/** An open download, read one chunk at a time. */
|
|
151
|
+
export class DownloadStream {
|
|
152
|
+
/**
|
|
153
|
+
* The next chunk, or null at the end. The stream closes at the end and
|
|
154
|
+
* on an error.
|
|
155
|
+
*/
|
|
156
|
+
next(): Promise<Buffer | null | TypedObjectError>
|
|
157
|
+
/** Stops the download, which ends its span. */
|
|
158
|
+
close(): Promise<void>
|
|
159
|
+
}
|
|
160
|
+
|
|
135
161
|
export interface DownloadUrlOptions {
|
|
136
162
|
ttl?: number
|
|
137
163
|
}
|
|
@@ -153,11 +179,106 @@ export interface ExistsOptions {
|
|
|
153
179
|
version?: string
|
|
154
180
|
}
|
|
155
181
|
|
|
182
|
+
export interface ExtendRetentionOptions {
|
|
183
|
+
version?: string
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* An attribute of a request's edge span: an integer when `integer` is set
|
|
188
|
+
* and `value` a number.
|
|
189
|
+
*/
|
|
190
|
+
export interface GatewayAttribute {
|
|
191
|
+
key: string
|
|
192
|
+
value: string | boolean | number
|
|
193
|
+
integer?: boolean
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* A Request Context field, encoded as on the wire. A null `value` clears
|
|
198
|
+
* it, in what a hook answers.
|
|
199
|
+
*/
|
|
200
|
+
export interface GatewayField {
|
|
201
|
+
name: string
|
|
202
|
+
value?: string
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/** A header of a response a Middleware answers with. */
|
|
206
|
+
export interface GatewayHeader {
|
|
207
|
+
name: string
|
|
208
|
+
value: string
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* An edit to a request's or response's headers: `op` 0 sets, 1 adds, 2
|
|
213
|
+
* removes the header.
|
|
214
|
+
*/
|
|
215
|
+
export interface GatewayHeaderEdit {
|
|
216
|
+
op: number
|
|
217
|
+
name: string
|
|
218
|
+
value: string
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* A response's headers, of a `response` event, kept in Rust as a view's
|
|
223
|
+
* are.
|
|
224
|
+
*/
|
|
225
|
+
export class GatewayHeaders {
|
|
226
|
+
/**
|
|
227
|
+
* Every value of the header `name`, in order, as later Middleware left
|
|
228
|
+
* them. Any case.
|
|
229
|
+
*/
|
|
230
|
+
values(name: string): Array<string>
|
|
231
|
+
}
|
|
232
|
+
|
|
156
233
|
export interface GatewayMeta {
|
|
157
234
|
name: string
|
|
158
235
|
baseUrl: string
|
|
159
236
|
}
|
|
160
237
|
|
|
238
|
+
/**
|
|
239
|
+
* A request, as a Middleware is shown it: all of its headers, query
|
|
240
|
+
* parameters and cookies, kept in Rust and handed to JavaScript only as a
|
|
241
|
+
* hook reads them, so what a hook does not read costs it nothing.
|
|
242
|
+
*/
|
|
243
|
+
export class GatewayView {
|
|
244
|
+
/** The gateway serving it. */
|
|
245
|
+
get gateway(): string
|
|
246
|
+
/** The service it is routed to. */
|
|
247
|
+
get service(): string
|
|
248
|
+
/** The template of the route it matched. */
|
|
249
|
+
get route(): string
|
|
250
|
+
get method(): string
|
|
251
|
+
/** As it arrived: not percent-decoded. */
|
|
252
|
+
get path(): string
|
|
253
|
+
get host(): string | null
|
|
254
|
+
get clientIp(): string | null
|
|
255
|
+
get traceparent(): string | null
|
|
256
|
+
get tracestate(): string | null
|
|
257
|
+
/**
|
|
258
|
+
* The Request Context fields earlier Middleware set, each encoded as on
|
|
259
|
+
* the wire: base64url of its JSON. For a `complete` event, those the
|
|
260
|
+
* request was forwarded with.
|
|
261
|
+
*/
|
|
262
|
+
get context(): Array<GatewayField>
|
|
263
|
+
/**
|
|
264
|
+
* The route's path parameter `name`, not percent-decoded; undefined when
|
|
265
|
+
* the route has none of that name.
|
|
266
|
+
*/
|
|
267
|
+
pathParam(name: string): string | null
|
|
268
|
+
/**
|
|
269
|
+
* Every value of the header `name`, in order, as earlier Middleware
|
|
270
|
+
* left them. Any case.
|
|
271
|
+
*/
|
|
272
|
+
headerValues(name: string): Array<string>
|
|
273
|
+
/** Every value of the query parameter `name`, percent-decoded, in order. */
|
|
274
|
+
queryValues(name: string): Array<string>
|
|
275
|
+
/**
|
|
276
|
+
* The value of the cookie `name`, from the `Cookie` headers as earlier
|
|
277
|
+
* Middleware left them; undefined when it is not sent.
|
|
278
|
+
*/
|
|
279
|
+
cookie(name: string): string | null
|
|
280
|
+
}
|
|
281
|
+
|
|
161
282
|
export interface HostedService {
|
|
162
283
|
name: string
|
|
163
284
|
}
|
|
@@ -193,20 +314,23 @@ export interface InstrumentOptions {
|
|
|
193
314
|
boundaries?: Array<number>
|
|
194
315
|
}
|
|
195
316
|
|
|
196
|
-
export
|
|
317
|
+
export interface ListEntry {
|
|
197
318
|
name: string
|
|
198
319
|
size: number
|
|
199
320
|
etag: string
|
|
321
|
+
/** A common prefix of a delimited listing rather than an object. */
|
|
322
|
+
isPrefix: boolean
|
|
200
323
|
}
|
|
201
324
|
|
|
202
325
|
export class ListIterator {
|
|
203
|
-
next(): Promise<ListEntry | null>
|
|
326
|
+
next(): Promise<ListEntry | null | TypedObjectError>
|
|
204
327
|
markDone(): void
|
|
205
328
|
}
|
|
206
329
|
|
|
207
330
|
export interface ListOptions {
|
|
208
331
|
prefix?: string
|
|
209
332
|
limit?: number
|
|
333
|
+
delimiter?: string
|
|
210
334
|
}
|
|
211
335
|
|
|
212
336
|
/** The meter provider, as JS registers instruments with it. */
|
|
@@ -226,12 +350,20 @@ export class Meters {
|
|
|
226
350
|
addCollector(collect: (reply: CollectReply) => void): void
|
|
227
351
|
}
|
|
228
352
|
|
|
229
|
-
export
|
|
353
|
+
export interface ObjectAttrs {
|
|
230
354
|
name: string
|
|
231
355
|
version?: string
|
|
232
356
|
size: number
|
|
233
357
|
contentType?: string
|
|
234
358
|
etag: string
|
|
359
|
+
cacheControl?: string
|
|
360
|
+
contentDisposition?: string
|
|
361
|
+
metadata: Record<string, string>
|
|
362
|
+
/** Milliseconds since the Unix epoch. */
|
|
363
|
+
lastModified?: number
|
|
364
|
+
storageClass?: 'standard' | 'infrequent' | 'cold' | 'auto'
|
|
365
|
+
/** Milliseconds since the Unix epoch. */
|
|
366
|
+
retainUntil?: number
|
|
235
367
|
}
|
|
236
368
|
|
|
237
369
|
export enum ObjectErrorKind {
|
|
@@ -239,7 +371,18 @@ export enum ObjectErrorKind {
|
|
|
239
371
|
PreconditionFailed = 1,
|
|
240
372
|
InvalidArgument = 2,
|
|
241
373
|
Other = 3,
|
|
242
|
-
Internal = 4
|
|
374
|
+
Internal = 4,
|
|
375
|
+
Retained = 5
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
export interface ObjectVersion {
|
|
379
|
+
name: string
|
|
380
|
+
version?: string
|
|
381
|
+
size: number
|
|
382
|
+
etag: string
|
|
383
|
+
latest: boolean
|
|
384
|
+
/** Milliseconds since the Unix epoch. */
|
|
385
|
+
lastModified?: number
|
|
243
386
|
}
|
|
244
387
|
|
|
245
388
|
/** Span lifecycle calls into the telemetry pipeline. */
|
|
@@ -255,6 +398,17 @@ export class Pipeline {
|
|
|
255
398
|
dropped(): bigint
|
|
256
399
|
}
|
|
257
400
|
|
|
401
|
+
/**
|
|
402
|
+
* One message of a batch to publish: its raw payload, its attributes, and
|
|
403
|
+
* its ordering key, which an ordered topic's message needs and an unordered
|
|
404
|
+
* topic's cannot have.
|
|
405
|
+
*/
|
|
406
|
+
export interface PubSubBatchEntry {
|
|
407
|
+
data: Buffer
|
|
408
|
+
attributes?: Record<string, string>
|
|
409
|
+
orderingKey?: string
|
|
410
|
+
}
|
|
411
|
+
|
|
258
412
|
/**
|
|
259
413
|
* A PubSub message delivered to a subscription handler.
|
|
260
414
|
*
|
|
@@ -274,14 +428,20 @@ export class PubSubMessage {
|
|
|
274
428
|
get deliveryAttempt(): number
|
|
275
429
|
/** The time the message was published. */
|
|
276
430
|
get publishTime(): Date
|
|
431
|
+
/**
|
|
432
|
+
* The context of the span its handler runs in, with the W3C tracestate
|
|
433
|
+
* carrying Encore's propagation mark; null when there is none.
|
|
434
|
+
*/
|
|
435
|
+
get spanContext(): SpanContextData | null
|
|
277
436
|
}
|
|
278
437
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
438
|
+
/**
|
|
439
|
+
* What became of one message of a batch: its `id` if it was published,
|
|
440
|
+
* otherwise the `error` saying why not.
|
|
441
|
+
*/
|
|
442
|
+
export interface PubSubPublishOutcome {
|
|
443
|
+
id?: string
|
|
444
|
+
error?: string
|
|
285
445
|
}
|
|
286
446
|
|
|
287
447
|
export class PubSubSubscription {
|
|
@@ -302,6 +462,15 @@ export class PubSubTopic {
|
|
|
302
462
|
* cannot have.
|
|
303
463
|
*/
|
|
304
464
|
publish(data: Buffer, attributes?: Record<string, string> | undefined | null, source?: Buffer | undefined | null, orderingKey?: string | undefined | null): Promise<string>
|
|
465
|
+
/**
|
|
466
|
+
* Publish up to 1000 messages, resolving to each one's outcome in the
|
|
467
|
+
* order given. It is not atomic: some messages can be published and
|
|
468
|
+
* others not. On an ordered topic the messages of one key are published
|
|
469
|
+
* in order, and none after one of them fails. It rejects, publishing
|
|
470
|
+
* nothing, only when the batch as a whole is refused, as one of more
|
|
471
|
+
* than 1000 messages is.
|
|
472
|
+
*/
|
|
473
|
+
publishBatch(entries: Array<PubSubBatchEntry>, source?: Buffer | undefined | null): Promise<Array<PubSubPublishOutcome>>
|
|
305
474
|
}
|
|
306
475
|
|
|
307
476
|
export class QueryArgs {
|
|
@@ -376,18 +545,25 @@ export class RedisSubscription {
|
|
|
376
545
|
close(): Promise<void>
|
|
377
546
|
}
|
|
378
547
|
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
/**
|
|
382
|
-
|
|
548
|
+
/** How a declared Request Context field travels. */
|
|
549
|
+
export interface ReqctxField {
|
|
550
|
+
/** Carried on the Pub/Sub messages published with it set. */
|
|
551
|
+
pubsub: boolean
|
|
552
|
+
/** Put on the spans started with it set. */
|
|
553
|
+
trace: boolean
|
|
383
554
|
}
|
|
384
555
|
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
556
|
+
/** One revision of an object, for an `ifMatch` precondition. */
|
|
557
|
+
export interface Revision {
|
|
558
|
+
etag: string
|
|
559
|
+
version?: string
|
|
388
560
|
}
|
|
389
561
|
|
|
390
562
|
export class Row {
|
|
563
|
+
/**
|
|
564
|
+
* The row's values by column name. An `int8` is a number, or a `bigint`
|
|
565
|
+
* outside the integers a JS number holds exactly, so it is never rounded.
|
|
566
|
+
*/
|
|
391
567
|
values(): Record<string, unknown>
|
|
392
568
|
}
|
|
393
569
|
|
|
@@ -451,14 +627,25 @@ export class Runtime {
|
|
|
451
627
|
bucket(encoreName: string): Bucket
|
|
452
628
|
redisDatabase(encoreName: string): RedisDatabase
|
|
453
629
|
pubsubSubscription(cfg: PubSubSubscriptionConfig): PubSubSubscription
|
|
630
|
+
/** Each test's infrastructure: null outside test mode. */
|
|
631
|
+
testScopes(): TestScopes | null
|
|
632
|
+
/**
|
|
633
|
+
* What the app's .env files set for a test process, for the SDK to set
|
|
634
|
+
* those `process.env` lacks: `encore test` started it with them, a test
|
|
635
|
+
* runner did not. Empty outside test mode.
|
|
636
|
+
*/
|
|
637
|
+
testDotenv(): Record<string, string>
|
|
638
|
+
/**
|
|
639
|
+
* How the Request Context field `name` travels, as the app declares it;
|
|
640
|
+
* null when the runtime config lists no such field.
|
|
641
|
+
*/
|
|
642
|
+
reqctxField(name: string): ReqctxField | null
|
|
454
643
|
/**
|
|
455
|
-
*
|
|
456
|
-
* config has one of the name
|
|
457
|
-
*
|
|
644
|
+
* The config given to the service this process hosts, whatever its
|
|
645
|
+
* scope, if the runtime config has one of the name: a config name has one
|
|
646
|
+
* scope across the app.
|
|
458
647
|
*/
|
|
459
648
|
config(encoreName: string): Config | null
|
|
460
|
-
/** A shared or global config, if the runtime config has one of the name. */
|
|
461
|
-
sharedConfig(encoreName: string): Config | null
|
|
462
649
|
/**
|
|
463
650
|
* The secret given to the service this process hosts, whatever its scope:
|
|
464
651
|
* a name has one scope across the app.
|
|
@@ -479,6 +666,11 @@ export class Runtime {
|
|
|
479
666
|
export interface RuntimeConfig {
|
|
480
667
|
/** The service hosted by this process, if any. */
|
|
481
668
|
currentService?: string
|
|
669
|
+
/**
|
|
670
|
+
* The Worker of that service this process runs; none for its main
|
|
671
|
+
* process.
|
|
672
|
+
*/
|
|
673
|
+
currentWorker?: string
|
|
482
674
|
/**
|
|
483
675
|
* Base URLs of the services this process can reach, keyed by service
|
|
484
676
|
* name.
|
|
@@ -501,6 +693,13 @@ export interface RuntimeLogLine {
|
|
|
501
693
|
|
|
502
694
|
export interface RuntimeOptions {
|
|
503
695
|
testMode?: boolean
|
|
696
|
+
/**
|
|
697
|
+
* Whether the process is a test runner's, as the SDK finds from its
|
|
698
|
+
* environment: it is then in test mode without `encore test`, unless the
|
|
699
|
+
* core finds otherwise (`ENCORE_TEST=0`, `ENCORE_EXEC`, a runtime config
|
|
700
|
+
* in the environment).
|
|
701
|
+
*/
|
|
702
|
+
testRunner?: boolean
|
|
504
703
|
typeConstructors: RuntimeTypeConstructors
|
|
505
704
|
}
|
|
506
705
|
|
|
@@ -521,6 +720,13 @@ export enum SQLAccess {
|
|
|
521
720
|
ReadPrimary = 2
|
|
522
721
|
}
|
|
523
722
|
|
|
723
|
+
/** The isolation level of a transaction. See [`postgres::IsolationLevel`]. */
|
|
724
|
+
export enum SQLIsolationLevel {
|
|
725
|
+
ReadCommitted = 0,
|
|
726
|
+
RepeatableRead = 1,
|
|
727
|
+
Serializable = 2
|
|
728
|
+
}
|
|
729
|
+
|
|
524
730
|
export class Secret {
|
|
525
731
|
/** Returns the cached value of the secret. */
|
|
526
732
|
cached(): string
|
|
@@ -550,7 +756,12 @@ export interface SpanStartResult {
|
|
|
550
756
|
|
|
551
757
|
export class SqlConn {
|
|
552
758
|
close(): Promise<void>
|
|
553
|
-
|
|
759
|
+
/**
|
|
760
|
+
* Whether the connection was acquired from a read handle: its
|
|
761
|
+
* transactions are read-only whatever their options say.
|
|
762
|
+
*/
|
|
763
|
+
isReadOnly(): boolean
|
|
764
|
+
begin(options?: SqlTransactionOptions | undefined | null, source?: Buffer | undefined | null): Promise<Transaction>
|
|
554
765
|
query(query: string, args: QueryArgs, source?: Buffer | undefined | null): Promise<Cursor>
|
|
555
766
|
}
|
|
556
767
|
export type SQLConn = SqlConn
|
|
@@ -570,16 +781,144 @@ export class SqlDatabase {
|
|
|
570
781
|
* session read-only: see [`postgres::Database::proxy_conn_string`].
|
|
571
782
|
*/
|
|
572
783
|
connString(): string
|
|
573
|
-
/**
|
|
574
|
-
|
|
784
|
+
/**
|
|
785
|
+
* Whether the handle runs on read-only connections, as a read handle
|
|
786
|
+
* does: its transactions are read-only whatever their options say.
|
|
787
|
+
*/
|
|
788
|
+
isReadOnly(): boolean
|
|
789
|
+
/** Begins a transaction, with `options` if given. */
|
|
790
|
+
begin(options?: SqlTransactionOptions | undefined | null, source?: Buffer | undefined | null): Promise<Transaction>
|
|
575
791
|
query(query: string, args: QueryArgs, source?: Buffer | undefined | null): Promise<Cursor>
|
|
576
792
|
acquire(): Promise<SQLConn>
|
|
577
793
|
}
|
|
578
794
|
export type SQLDatabase = SqlDatabase
|
|
579
795
|
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
796
|
+
/**
|
|
797
|
+
* How a transaction runs; what isn't set is the database's default. See
|
|
798
|
+
* [`postgres::TransactionOptions`].
|
|
799
|
+
*/
|
|
800
|
+
export interface SqlTransactionOptions {
|
|
801
|
+
isolation?: SQLIsolationLevel
|
|
802
|
+
readOnly?: boolean
|
|
803
|
+
deferrable?: boolean
|
|
804
|
+
}
|
|
805
|
+
export type SQLTransactionOptions = SqlTransactionOptions
|
|
806
|
+
|
|
807
|
+
/**
|
|
808
|
+
* A message to hand a subscription's handler, and which delivery of it this
|
|
809
|
+
* is: 1 the first time.
|
|
810
|
+
*/
|
|
811
|
+
export interface TestDelivery {
|
|
812
|
+
message: TestPublished
|
|
813
|
+
attempt: number
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
/** A message a test published. */
|
|
817
|
+
export interface TestPublished {
|
|
818
|
+
id: string
|
|
819
|
+
data: Buffer
|
|
820
|
+
attributes: Record<string, string>
|
|
821
|
+
orderingKey?: string
|
|
822
|
+
/** When it was published, in milliseconds since the Unix epoch. */
|
|
823
|
+
publishTime: number
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
/** One test's infrastructure and overrides, until it ends. */
|
|
827
|
+
export class TestScope {
|
|
828
|
+
/** The scope's id: what its resources are provisioned under. */
|
|
829
|
+
get id(): string
|
|
830
|
+
/**
|
|
831
|
+
* Ends the test: its resources are released, unless they are a
|
|
832
|
+
* fixture's. Its handles fail from then on.
|
|
833
|
+
*/
|
|
834
|
+
end(): void
|
|
835
|
+
/**
|
|
836
|
+
* Makes the test's resources start from the fixture `name`, which must be
|
|
837
|
+
* built, or from their initial state for null. Fails once the test has
|
|
838
|
+
* used a resource, unless it is what they started from.
|
|
839
|
+
*/
|
|
840
|
+
useFixture(name?: string | undefined | null): void
|
|
841
|
+
/**
|
|
842
|
+
* Saves what the fixture's setup left in this scope's resources as the
|
|
843
|
+
* fixture `name`, ending the scope. Resolves once the daemon has saved
|
|
844
|
+
* them.
|
|
845
|
+
*/
|
|
846
|
+
saveFixture(name: string): Promise<void>
|
|
847
|
+
/**
|
|
848
|
+
* The test's instance of the database `name`, provisioned when first
|
|
849
|
+
* asked for.
|
|
850
|
+
*/
|
|
851
|
+
sqlDatabase(name: string): SqlDatabase
|
|
852
|
+
/**
|
|
853
|
+
* The test's instance of the bucket `name`, provisioned when first asked
|
|
854
|
+
* for.
|
|
855
|
+
*/
|
|
856
|
+
bucket(name: string): Bucket
|
|
857
|
+
/**
|
|
858
|
+
* The test's instance of the Redis database `name`, provisioned when
|
|
859
|
+
* first asked for.
|
|
860
|
+
*/
|
|
861
|
+
redisDatabase(name: string): RedisDatabase
|
|
862
|
+
/**
|
|
863
|
+
* Records a message the test published to the topic `topic`, returning
|
|
864
|
+
* its id. It is not sent: the test reads it back, or delivers it. Of the
|
|
865
|
+
* Request Context attributes it keeps those of fields declared with
|
|
866
|
+
* `pubsub`, as the runtime does when it publishes.
|
|
867
|
+
*/
|
|
868
|
+
recordPublished(topic: string, data: Buffer, attributes?: Record<string, string> | undefined | null, orderingKey?: string | undefined | null): string
|
|
869
|
+
/** What the test has published to the topic `topic`, in order. */
|
|
870
|
+
published(topic: string): Array<TestPublished>
|
|
871
|
+
/**
|
|
872
|
+
* The next message the test published to `topic` that `subscription`
|
|
873
|
+
* has not handled and its filter matches, or null. Settle it with
|
|
874
|
+
* `settleDelivery` before asking for the next.
|
|
875
|
+
*/
|
|
876
|
+
nextDelivery(topic: string, subscription: string): TestDelivery | null
|
|
877
|
+
/**
|
|
878
|
+
* Settles the message `nextDelivery` last handed `subscription`: past it
|
|
879
|
+
* if `handled`, or handed over again next time, as its next attempt.
|
|
880
|
+
*/
|
|
881
|
+
settleDelivery(topic: string, subscription: string, handled: boolean): void
|
|
882
|
+
/** Gives the secret `name` a value for this test. */
|
|
883
|
+
setSecret(name: string, value: Buffer): void
|
|
884
|
+
/** The value the test has given the secret `name`, if it has. */
|
|
885
|
+
secret(name: string): Buffer | null
|
|
886
|
+
/**
|
|
887
|
+
* Gives the config `name` a value for this test, once it satisfies the
|
|
888
|
+
* config's schema. A config name has one scope across the app, so it is
|
|
889
|
+
* the name alone. `value` and what it returns are JSON text: the value as
|
|
890
|
+
* the runtime holds it, with placeholders for its secret fields.
|
|
891
|
+
*/
|
|
892
|
+
setConfig(name: string, value: string): string
|
|
893
|
+
/** The value the test has given a config, as JSON text, if it has. */
|
|
894
|
+
config(name: string): string | null
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
/** The tests of a runtime in test mode. */
|
|
898
|
+
export class TestScopes {
|
|
899
|
+
/**
|
|
900
|
+
* Begins a test: a scope with no resources yet, each provisioned when the
|
|
901
|
+
* test first asks for it. `name` is for diagnostics only.
|
|
902
|
+
*/
|
|
903
|
+
begin(name?: string | undefined | null): TestScope
|
|
904
|
+
/**
|
|
905
|
+
* The most messages one `deliver` hands a subscription: more is a handler
|
|
906
|
+
* that publishes to its own topic for ever.
|
|
907
|
+
*/
|
|
908
|
+
get maxDeliveries(): number
|
|
909
|
+
/**
|
|
910
|
+
* Asks for the fixture `name`, which starts from the fixture `parent` if
|
|
911
|
+
* there is one. Resolves to null once it is built — by this process or
|
|
912
|
+
* another, which it waits for — or to a scope to build it in: run the
|
|
913
|
+
* fixture's setup with its resources, then `saveFixture`, or
|
|
914
|
+
* `failFixture` if the setup fails.
|
|
915
|
+
*/
|
|
916
|
+
acquireFixture(name: string, parent?: string | undefined | null): Promise<TestScope | null>
|
|
917
|
+
/**
|
|
918
|
+
* Gives up building the fixture `name`, with the reason to show whoever
|
|
919
|
+
* is waiting for it.
|
|
920
|
+
*/
|
|
921
|
+
failFixture(name: string, message: string): void
|
|
583
922
|
}
|
|
584
923
|
|
|
585
924
|
export class Transaction {
|
|
@@ -594,19 +933,60 @@ export class TypedObjectError {
|
|
|
594
933
|
message: string
|
|
595
934
|
}
|
|
596
935
|
|
|
936
|
+
/**
|
|
937
|
+
* Unset fields stay as they are, and `""` clears one (a cleared content type
|
|
938
|
+
* is `application/octet-stream`). `metadata` replaces the whole map.
|
|
939
|
+
*/
|
|
940
|
+
export interface UpdateAttrs {
|
|
941
|
+
contentType?: string
|
|
942
|
+
cacheControl?: string
|
|
943
|
+
contentDisposition?: string
|
|
944
|
+
metadata?: Record<string, string>
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
export interface UpdateAttrsOptions {
|
|
948
|
+
version?: string
|
|
949
|
+
ifMatch?: Revision
|
|
950
|
+
}
|
|
951
|
+
|
|
597
952
|
export interface UploadOptions {
|
|
598
953
|
contentType?: string
|
|
954
|
+
cacheControl?: string
|
|
955
|
+
contentDisposition?: string
|
|
956
|
+
metadata?: Record<string, string>
|
|
957
|
+
storageClass?: string
|
|
958
|
+
/** Milliseconds since the Unix epoch. */
|
|
959
|
+
retainUntil?: number
|
|
599
960
|
preconditions?: UploadPreconditions
|
|
600
961
|
}
|
|
601
962
|
|
|
602
963
|
export interface UploadPreconditions {
|
|
603
964
|
notExists?: boolean
|
|
965
|
+
ifMatch?: Revision
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
/** An upload in progress, fed one chunk at a time. */
|
|
969
|
+
export class UploadStream {
|
|
970
|
+
/**
|
|
971
|
+
* Writes a chunk, waiting while the upload's buffer is full. Returns the
|
|
972
|
+
* upload's error if it has failed; the upload is then over.
|
|
973
|
+
*/
|
|
974
|
+
write(chunk: Buffer): Promise<TypedObjectError | null>
|
|
975
|
+
/** Ends the data and waits for the object to be stored. */
|
|
976
|
+
finish(): Promise<ObjectAttrs | TypedObjectError>
|
|
977
|
+
/** Abandons the upload without storing anything. */
|
|
978
|
+
abort(): Promise<void>
|
|
604
979
|
}
|
|
605
980
|
|
|
606
981
|
export interface UploadUrlOptions {
|
|
607
982
|
ttl?: number
|
|
608
983
|
}
|
|
609
984
|
|
|
985
|
+
export class VersionIterator {
|
|
986
|
+
next(): Promise<ObjectVersion | null | TypedObjectError>
|
|
987
|
+
markDone(): void
|
|
988
|
+
}
|
|
989
|
+
|
|
610
990
|
/**
|
|
611
991
|
* One log record in the Encore log format, newline included, for the
|
|
612
992
|
* logger to print. Absent, empty, and 0 are none. `level` is the
|
|
@@ -622,6 +1002,71 @@ export interface UploadUrlOptions {
|
|
|
622
1002
|
*/
|
|
623
1003
|
export declare function encodeLog(level: number, timeUnixMillis: number | undefined | null, message: string, logger?: string | undefined | null, spanCtx?: Buffer | undefined | null, exceptionType?: string | undefined | null, exceptionMessage?: string | undefined | null, exceptionStacktrace?: string | undefined | null, codeFunction?: string | undefined | null, codeFile?: string | undefined | null, codeLine?: number | undefined | null, codeColumn?: number | undefined | null, runtimeTarget?: string | undefined | null, attrsJson?: string | undefined | null): Buffer
|
|
624
1004
|
|
|
1005
|
+
/**
|
|
1006
|
+
* Lets the request of the `request` event `eventId` through, with
|
|
1007
|
+
* `headerEdits`, the Request Context fields in `context` set (or cleared,
|
|
1008
|
+
* with a null value), `attributes` for its edge span, and the Middleware's
|
|
1009
|
+
* later hooks in `skip` (2 request body, 4 response, 8 response body, 16
|
|
1010
|
+
* complete) skipped. False when no hook waits for it any more.
|
|
1011
|
+
*/
|
|
1012
|
+
export declare function gatewayContinue(eventId: number, headerEdits: Array<GatewayHeaderEdit>, context: Array<GatewayField>, attributes: Array<GatewayAttribute>, skip: number): boolean
|
|
1013
|
+
|
|
1014
|
+
/**
|
|
1015
|
+
* How many body chunks and `complete` events were dropped, JavaScript not
|
|
1016
|
+
* keeping up.
|
|
1017
|
+
*/
|
|
1018
|
+
export declare function gatewayDropped(): number
|
|
1019
|
+
|
|
1020
|
+
/**
|
|
1021
|
+
* Fails the hook of the event `eventId`, a `"request"` or `"response"`
|
|
1022
|
+
* event as `hook` says, with `message`, `how` it failed: `"error"`, an
|
|
1023
|
+
* error it threw; `"panic"`, one it did not mean to; `"timeout"`, it ran
|
|
1024
|
+
* out of time, which a fail-closed Middleware answers with 503 as it does
|
|
1025
|
+
* the gateway's own timeout. The Middleware's `onError` decides what
|
|
1026
|
+
* becomes of the request. False when no hook waits for it any more.
|
|
1027
|
+
*/
|
|
1028
|
+
export declare function gatewayFail(eventId: number, hook: string, message: string, how: string): boolean
|
|
1029
|
+
|
|
1030
|
+
/**
|
|
1031
|
+
* Registers a Middleware, as its JSON spec states it, after those registered
|
|
1032
|
+
* before, and returns its id, which its events name. Names and interests
|
|
1033
|
+
* are checked when the gateway is served.
|
|
1034
|
+
*/
|
|
1035
|
+
export declare function gatewayRegister(specJson: string): number
|
|
1036
|
+
|
|
1037
|
+
/**
|
|
1038
|
+
* Answers the request of the `request` event `eventId` itself, with
|
|
1039
|
+
* `status`: an Encore error when `code` is given, with `message`, else
|
|
1040
|
+
* `body` as it is. False when no hook waits for it any more.
|
|
1041
|
+
*/
|
|
1042
|
+
export declare function gatewayRespond(eventId: number, status: number, code: string | undefined | null, message: string, headers: Array<GatewayHeader>, body?: Buffer | undefined | null): boolean
|
|
1043
|
+
|
|
1044
|
+
/**
|
|
1045
|
+
* Answers the `response` event `eventId` with `headerEdits` to the
|
|
1046
|
+
* response. False when no hook waits for it any more.
|
|
1047
|
+
*/
|
|
1048
|
+
export declare function gatewayResponseEdits(eventId: number, headerEdits: Array<GatewayHeaderEdit>): boolean
|
|
1049
|
+
|
|
1050
|
+
/**
|
|
1051
|
+
* Serves the gateway the runtime config hosts, where the environment says,
|
|
1052
|
+
* with the Middleware registered, until the runtime's shutdown stops it.
|
|
1053
|
+
* Returns once it is listening, with where.
|
|
1054
|
+
*
|
|
1055
|
+
* Each batch of hook events is handed to `onEvents` on the event loop, in
|
|
1056
|
+
* the order the host queued them, and null once the gateway has stopped
|
|
1057
|
+
* and every event was handed on. Until then the event loop is kept alive.
|
|
1058
|
+
*/
|
|
1059
|
+
export declare function gatewayServe(runtime: Runtime, onEvents: (events: Array<object> | null) => void): string
|
|
1060
|
+
|
|
1061
|
+
/**
|
|
1062
|
+
* How long, in milliseconds, the hook of the `request` or `response` event
|
|
1063
|
+
* `eventId` has waited for its answer; null once it waits no more, as when
|
|
1064
|
+
* its Middleware's timeout passed and the gateway went on without it. The
|
|
1065
|
+
* dispatcher runs a hook only while it is waited for, and for what is left
|
|
1066
|
+
* of its timeout.
|
|
1067
|
+
*/
|
|
1068
|
+
export declare function gatewayWaited(eventId: number): number | null
|
|
1069
|
+
|
|
625
1070
|
/**
|
|
626
1071
|
* Hands the runtime's own log lines to `handler` on the event loop, or
|
|
627
1072
|
* drops them for `null`. Lines logged before the first call are handed
|