@encore.dev/sdk 2.0.0-beta.7 → 2.0.0-beta.9
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 +109 -0
- package/app_meta.test.ts +25 -5
- package/app_meta.ts +51 -12
- package/config/config.test.ts +18 -15
- package/config/config.ts +89 -31
- package/config/mod.ts +4 -3
- package/config/secrets.ts +79 -53
- package/config/value.ts +13 -17
- package/cron/mod.test.ts +52 -0
- package/cron/mod.ts +41 -2
- package/dist/app_meta.d.ts +44 -12
- package/dist/app_meta.d.ts.map +1 -0
- package/dist/app_meta.js +2 -0
- package/dist/app_meta.js.map +1 -1
- package/dist/config/config.d.ts +58 -28
- package/dist/config/config.d.ts.map +1 -0
- package/dist/config/config.js +46 -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 +71 -39
- package/dist/config/secrets.d.ts.map +1 -0
- package/dist/config/secrets.js +31 -38
- package/dist/config/secrets.js.map +1 -1
- package/dist/config/value.d.ts +8 -5
- package/dist/config/value.d.ts.map +1 -0
- package/dist/config/value.js +10 -7
- package/dist/config/value.js.map +1 -1
- package/dist/cron/mod.d.ts +36 -1
- package/dist/cron/mod.d.ts.map +1 -0
- package/dist/cron/mod.js +31 -1
- package/dist/cron/mod.js.map +1 -1
- package/dist/frontends/mod.d.ts +39 -0
- package/dist/frontends/mod.d.ts.map +1 -0
- package/dist/frontends/mod.js +47 -0
- package/dist/frontends/mod.js.map +1 -0
- 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 +130 -0
- package/dist/gateway/mod.d.ts.map +1 -0
- package/dist/gateway/mod.js +188 -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/gateways/mod.d.ts +42 -0
- package/dist/gateways/mod.d.ts.map +1 -0
- package/dist/gateways/mod.js +55 -0
- package/dist/gateways/mod.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 +58 -0
- package/dist/internal/fetch.d.ts.map +1 -0
- package/dist/internal/fetch.js +251 -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/http.d.ts +11 -0
- package/dist/internal/otel/http.d.ts.map +1 -0
- package/dist/internal/otel/http.js +64 -0
- package/dist/internal/otel/http.js.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 +4 -0
- package/dist/internal/otel/provider.d.ts.map +1 -0
- package/dist/internal/otel/provider.js +3 -0
- package/dist/internal/otel/provider.js.map +1 -1
- package/dist/internal/otel/span.d.ts +15 -1
- package/dist/internal/otel/span.d.ts.map +1 -0
- package/dist/internal/otel/span.js +30 -2
- 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 +170 -0
- package/dist/internal/reqfields.d.ts.map +1 -0
- package/dist/internal/reqfields.js +349 -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 +192 -16
- package/dist/internal/runtime/napi/napi.d.cts +573 -33
- 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/carry.d.ts +49 -0
- package/dist/internal/testing/carry.d.ts.map +1 -0
- package/dist/internal/testing/carry.js +77 -0
- package/dist/internal/testing/carry.js.map +1 -0
- 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 +109 -0
- package/dist/internal/testing/scope.d.ts.map +1 -0
- package/dist/internal/testing/scope.js +335 -0
- package/dist/internal/testing/scope.js.map +1 -0
- package/dist/internal/testing/steps.d.ts +55 -0
- package/dist/internal/testing/steps.d.ts.map +1 -0
- package/dist/internal/testing/steps.js +295 -0
- package/dist/internal/testing/steps.js.map +1 -0
- package/dist/internal/testing/telemetry.d.ts +305 -0
- package/dist/internal/testing/telemetry.d.ts.map +1 -0
- package/dist/internal/testing/telemetry.js +188 -0
- package/dist/internal/testing/telemetry.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 +2 -3
- 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 +5 -4
- 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 +110 -15
- 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 +101 -31
- package/dist/pubsub/topic.d.ts.map +1 -0
- package/dist/pubsub/topic.js +168 -51
- package/dist/pubsub/topic.js.map +1 -1
- package/dist/reqctx/mod.d.ts +174 -0
- package/dist/reqctx/mod.d.ts.map +1 -0
- package/dist/reqctx/mod.js +144 -0
- package/dist/reqctx/mod.js.map +1 -0
- package/dist/services/index.d.ts +147 -5
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +157 -9
- 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 +313 -7
- package/dist/storage/objects/bucket.d.ts.map +1 -0
- package/dist/storage/objects/bucket.js +306 -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 +85 -25
- package/dist/storage/postgres/database.d.ts.map +1 -0
- package/dist/storage/postgres/database.js +129 -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 +183 -0
- package/dist/testing/mod.d.ts.map +1 -0
- package/dist/testing/mod.js +271 -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/playwright.d.ts +93 -0
- package/dist/testing/playwright.d.ts.map +1 -0
- package/dist/testing/playwright.js +164 -0
- package/dist/testing/playwright.js.map +1 -0
- package/dist/testing/puppeteer.d.ts +36 -0
- package/dist/testing/puppeteer.d.ts.map +1 -0
- package/dist/testing/puppeteer.js +70 -0
- package/dist/testing/puppeteer.js.map +1 -0
- package/dist/testing/system.d.ts +181 -0
- package/dist/testing/system.d.ts.map +1 -0
- package/dist/testing/system.js +255 -0
- package/dist/testing/system.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/http.d.ts +11 -0
- package/dist/tracing/http.d.ts.map +1 -0
- package/dist/tracing/http.js +34 -0
- package/dist/tracing/http.js.map +1 -0
- package/dist/tracing/mod.d.ts +20 -0
- package/dist/tracing/mod.d.ts.map +1 -0
- package/dist/tracing/mod.js +47 -0
- package/dist/tracing/mod.js.map +1 -0
- package/dist/tracing/node.d.ts +10 -0
- package/dist/tracing/node.d.ts.map +1 -0
- package/dist/tracing/node.js +142 -0
- package/dist/tracing/node.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/frontends/mod.test.ts +51 -0
- package/frontends/mod.ts +50 -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 +211 -0
- package/gateway/request.ts +578 -0
- package/gateway/serve.ts +738 -0
- package/gateways/mod.ts +60 -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 +287 -0
- package/internal/otel/http.ts +91 -0
- package/internal/otel/index.ts +1 -7
- package/internal/otel/provider.ts +3 -0
- package/internal/otel/span.ts +31 -2
- package/internal/otel/tracer.test.ts +43 -15
- package/internal/otel/tracer.ts +12 -5
- package/internal/reqfields.ts +423 -0
- package/internal/runtime/mod.ts +41 -2
- package/internal/runtime/napi/napi.cjs +192 -16
- package/internal/runtime/napi/napi.d.cts +573 -33
- package/internal/runtime/shutdown.ts +11 -1
- package/internal/testing/carry.test.ts +242 -0
- package/internal/testing/carry.ts +101 -0
- package/internal/testing/runner.ts +10 -0
- package/internal/testing/scope.ts +372 -0
- package/internal/testing/steps.test.ts +152 -0
- package/internal/testing/steps.ts +342 -0
- package/internal/testing/telemetry.test.ts +210 -0
- package/internal/testing/telemetry.ts +466 -0
- package/metrics/mod.test.ts +13 -16
- package/metrics/mod.ts +57 -226
- package/mod.ts +1 -8
- package/otel.test.ts +13 -6
- package/package.json +92 -15
- package/pubsub/encoding.ts +11 -1
- package/pubsub/mod.ts +16 -4
- package/pubsub/pubsub.test.ts +233 -14
- package/pubsub/refs.ts +16 -0
- package/pubsub/subscription.ts +200 -21
- package/pubsub/topic.test.ts +26 -0
- package/pubsub/topic.ts +255 -36
- package/reqctx/mod.ts +267 -0
- package/reqctx/reqctx.test.ts +216 -0
- package/scripts/postprocess-docs.test.ts +58 -0
- package/services/index.test.ts +341 -1
- package/services/index.ts +185 -9
- package/storage/objects/bucket.test.ts +573 -0
- package/storage/objects/bucket.ts +650 -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 +206 -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 +393 -0
- package/testing/node.ts +12 -0
- package/testing/playwright.ts +247 -0
- package/testing/puppeteer.ts +101 -0
- package/testing/system.test.ts +108 -0
- package/testing/system.ts +373 -0
- package/testing/vitest.ts +13 -0
- package/tracing/http.ts +49 -0
- package/tracing/mod.ts +83 -0
- package/tracing/native.test.ts +267 -0
- package/tracing/node.ts +176 -0
- package/tracing/tracing.test.ts +953 -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
|
@@ -5,8 +5,16 @@
|
|
|
5
5
|
export interface AppMeta {
|
|
6
6
|
appId: string
|
|
7
7
|
appSlug: string
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* The API gateways the service is given, keyed by gateway name: those
|
|
10
|
+
* its code names, and the one it hosts.
|
|
11
|
+
*/
|
|
9
12
|
gateways: Record<string, GatewayMeta>
|
|
13
|
+
/**
|
|
14
|
+
* The frontends the service is given, keyed by name: those its code
|
|
15
|
+
* names, and the one it hosts.
|
|
16
|
+
*/
|
|
17
|
+
frontends: Record<string, FrontendMeta>
|
|
10
18
|
environment: EnvironmentMeta
|
|
11
19
|
build: BuildMeta
|
|
12
20
|
deploy: DeployMeta
|
|
@@ -19,15 +27,27 @@ export interface AttrsOptions {
|
|
|
19
27
|
export class Bucket {
|
|
20
28
|
object(name: string): BucketObject
|
|
21
29
|
list(options?: ListOptions | undefined | null, source?: Buffer | undefined | null): Promise<ListIterator | TypedObjectError>
|
|
30
|
+
listVersions(options?: ListOptions | undefined | null, source?: Buffer | undefined | null): Promise<VersionIterator | TypedObjectError>
|
|
22
31
|
}
|
|
23
32
|
|
|
24
33
|
export class BucketObject {
|
|
25
34
|
attrs(options?: AttrsOptions | undefined | null, source?: Buffer | undefined | null): Promise<ObjectAttrs | TypedObjectError>
|
|
26
35
|
exists(options?: ExistsOptions | undefined | null, source?: Buffer | undefined | null): Promise<boolean | TypedObjectError>
|
|
27
|
-
|
|
36
|
+
/**
|
|
37
|
+
* Starts an upload whose bytes are written to the returned stream.
|
|
38
|
+
* Nothing is stored until it is finished: aborting it, or dropping it
|
|
39
|
+
* unfinished, stores nothing.
|
|
40
|
+
*/
|
|
41
|
+
uploadStream(options?: UploadOptions | undefined | null, source?: Buffer | undefined | null): UploadStream | TypedObjectError
|
|
42
|
+
/** Replaces the attributes given and leaves the others as they are. */
|
|
43
|
+
updateAttrs(attrs: UpdateAttrs, options?: UpdateAttrsOptions | undefined | null, source?: Buffer | undefined | null): Promise<ObjectAttrs | TypedObjectError>
|
|
44
|
+
/** Keeps the object until `until`, in milliseconds since the Unix epoch. */
|
|
45
|
+
extendRetention(until: number, options?: ExtendRetentionOptions | undefined | null, source?: Buffer | undefined | null): Promise<ObjectAttrs | TypedObjectError>
|
|
28
46
|
signedUploadUrl(options?: UploadUrlOptions | undefined | null, source?: Buffer | undefined | null): Promise<SignedUploadUrl | TypedObjectError>
|
|
29
47
|
signedDownloadUrl(options?: DownloadUrlOptions | undefined | null, source?: Buffer | undefined | null): Promise<SignedDownloadUrl | TypedObjectError>
|
|
30
48
|
downloadAll(options?: DownloadOptions | undefined | null, source?: Buffer | undefined | null): Promise<Buffer | TypedObjectError>
|
|
49
|
+
/** Opens a download. A missing object fails here, before any bytes. */
|
|
50
|
+
downloadStream(options?: DownloadOptions | undefined | null, source?: Buffer | undefined | null): Promise<DownloadStream | TypedObjectError>
|
|
31
51
|
delete(options?: DeleteOptions | undefined | null, source?: Buffer | undefined | null): Promise<TypedObjectError | null>
|
|
32
52
|
publicUrl(): string
|
|
33
53
|
}
|
|
@@ -91,7 +111,7 @@ export interface ConfigRevision {
|
|
|
91
111
|
number: number
|
|
92
112
|
/**
|
|
93
113
|
* The value, as JSON text, with a placeholder
|
|
94
|
-
* (`{"$encore_secret":
|
|
114
|
+
* (`{"$encore_secret": "<name>"}`) for each secret field.
|
|
95
115
|
*/
|
|
96
116
|
value: string
|
|
97
117
|
}
|
|
@@ -119,12 +139,15 @@ export class Decimal {
|
|
|
119
139
|
|
|
120
140
|
export interface DeleteOptions {
|
|
121
141
|
version?: string
|
|
142
|
+
ifMatch?: Revision
|
|
122
143
|
}
|
|
123
144
|
|
|
124
145
|
export interface DeployMeta {
|
|
125
146
|
id: string
|
|
126
147
|
deployTime: string
|
|
127
148
|
hostedServices: Record<string, HostedService>
|
|
149
|
+
/** The Worker of its service the process runs; none for its main process. */
|
|
150
|
+
worker?: string
|
|
128
151
|
}
|
|
129
152
|
|
|
130
153
|
export interface DownloadOptions {
|
|
@@ -132,6 +155,17 @@ export interface DownloadOptions {
|
|
|
132
155
|
range?: ByteRange
|
|
133
156
|
}
|
|
134
157
|
|
|
158
|
+
/** An open download, read one chunk at a time. */
|
|
159
|
+
export class DownloadStream {
|
|
160
|
+
/**
|
|
161
|
+
* The next chunk, or null at the end. The stream closes at the end and
|
|
162
|
+
* on an error.
|
|
163
|
+
*/
|
|
164
|
+
next(): Promise<Buffer | null | TypedObjectError>
|
|
165
|
+
/** Stops the download, which ends its span. */
|
|
166
|
+
close(): Promise<void>
|
|
167
|
+
}
|
|
168
|
+
|
|
135
169
|
export interface DownloadUrlOptions {
|
|
136
170
|
ttl?: number
|
|
137
171
|
}
|
|
@@ -153,9 +187,111 @@ export interface ExistsOptions {
|
|
|
153
187
|
version?: string
|
|
154
188
|
}
|
|
155
189
|
|
|
190
|
+
export interface ExtendRetentionOptions {
|
|
191
|
+
version?: string
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export interface FrontendMeta {
|
|
195
|
+
name: string
|
|
196
|
+
url: string
|
|
197
|
+
origins: Array<string>
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* An attribute of a request's edge span: an integer when `integer` is set
|
|
202
|
+
* and `value` a number.
|
|
203
|
+
*/
|
|
204
|
+
export interface GatewayAttribute {
|
|
205
|
+
key: string
|
|
206
|
+
value: string | boolean | number
|
|
207
|
+
integer?: boolean
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* A Request Context field, encoded as on the wire. A null `value` clears
|
|
212
|
+
* it, in what a hook answers.
|
|
213
|
+
*/
|
|
214
|
+
export interface GatewayField {
|
|
215
|
+
name: string
|
|
216
|
+
value?: string
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/** A header of a response a Middleware answers with. */
|
|
220
|
+
export interface GatewayHeader {
|
|
221
|
+
name: string
|
|
222
|
+
value: string
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* An edit to a request's or response's headers: `op` 0 sets, 1 adds, 2
|
|
227
|
+
* removes the header.
|
|
228
|
+
*/
|
|
229
|
+
export interface GatewayHeaderEdit {
|
|
230
|
+
op: number
|
|
231
|
+
name: string
|
|
232
|
+
value: string
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* A response's headers, of a `response` event, kept in Rust as a view's
|
|
237
|
+
* are.
|
|
238
|
+
*/
|
|
239
|
+
export class GatewayHeaders {
|
|
240
|
+
/**
|
|
241
|
+
* Every value of the header `name`, in order, as later Middleware left
|
|
242
|
+
* them. Any case.
|
|
243
|
+
*/
|
|
244
|
+
values(name: string): Array<string>
|
|
245
|
+
}
|
|
246
|
+
|
|
156
247
|
export interface GatewayMeta {
|
|
157
248
|
name: string
|
|
158
|
-
|
|
249
|
+
url: string
|
|
250
|
+
origins: Array<string>
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* A request, as a Middleware is shown it: all of its headers, query
|
|
255
|
+
* parameters and cookies, kept in Rust and handed to JavaScript only as a
|
|
256
|
+
* hook reads them, so what a hook does not read costs it nothing.
|
|
257
|
+
*/
|
|
258
|
+
export class GatewayView {
|
|
259
|
+
/** The gateway serving it. */
|
|
260
|
+
get gateway(): string
|
|
261
|
+
/** The service it is routed to. */
|
|
262
|
+
get service(): string
|
|
263
|
+
/** The template of the route it matched. */
|
|
264
|
+
get route(): string
|
|
265
|
+
get method(): string
|
|
266
|
+
/** As it arrived: not percent-decoded. */
|
|
267
|
+
get path(): string
|
|
268
|
+
get host(): string | null
|
|
269
|
+
get clientIp(): string | null
|
|
270
|
+
get traceparent(): string | null
|
|
271
|
+
get tracestate(): string | null
|
|
272
|
+
/**
|
|
273
|
+
* The Request Context fields earlier Middleware set, each encoded as on
|
|
274
|
+
* the wire: base64url of its JSON. For a `complete` event, those the
|
|
275
|
+
* request was forwarded with.
|
|
276
|
+
*/
|
|
277
|
+
get context(): Array<GatewayField>
|
|
278
|
+
/**
|
|
279
|
+
* The route's path parameter `name`, not percent-decoded; undefined when
|
|
280
|
+
* the route has none of that name.
|
|
281
|
+
*/
|
|
282
|
+
pathParam(name: string): string | null
|
|
283
|
+
/**
|
|
284
|
+
* Every value of the header `name`, in order, as earlier Middleware
|
|
285
|
+
* left them. Any case.
|
|
286
|
+
*/
|
|
287
|
+
headerValues(name: string): Array<string>
|
|
288
|
+
/** Every value of the query parameter `name`, percent-decoded, in order. */
|
|
289
|
+
queryValues(name: string): Array<string>
|
|
290
|
+
/**
|
|
291
|
+
* The value of the cookie `name`, from the `Cookie` headers as earlier
|
|
292
|
+
* Middleware left them; undefined when it is not sent.
|
|
293
|
+
*/
|
|
294
|
+
cookie(name: string): string | null
|
|
159
295
|
}
|
|
160
296
|
|
|
161
297
|
export interface HostedService {
|
|
@@ -193,20 +329,23 @@ export interface InstrumentOptions {
|
|
|
193
329
|
boundaries?: Array<number>
|
|
194
330
|
}
|
|
195
331
|
|
|
196
|
-
export
|
|
332
|
+
export interface ListEntry {
|
|
197
333
|
name: string
|
|
198
334
|
size: number
|
|
199
335
|
etag: string
|
|
336
|
+
/** A common prefix of a delimited listing rather than an object. */
|
|
337
|
+
isPrefix: boolean
|
|
200
338
|
}
|
|
201
339
|
|
|
202
340
|
export class ListIterator {
|
|
203
|
-
next(): Promise<ListEntry | null>
|
|
341
|
+
next(): Promise<ListEntry | null | TypedObjectError>
|
|
204
342
|
markDone(): void
|
|
205
343
|
}
|
|
206
344
|
|
|
207
345
|
export interface ListOptions {
|
|
208
346
|
prefix?: string
|
|
209
347
|
limit?: number
|
|
348
|
+
delimiter?: string
|
|
210
349
|
}
|
|
211
350
|
|
|
212
351
|
/** The meter provider, as JS registers instruments with it. */
|
|
@@ -226,12 +365,20 @@ export class Meters {
|
|
|
226
365
|
addCollector(collect: (reply: CollectReply) => void): void
|
|
227
366
|
}
|
|
228
367
|
|
|
229
|
-
export
|
|
368
|
+
export interface ObjectAttrs {
|
|
230
369
|
name: string
|
|
231
370
|
version?: string
|
|
232
371
|
size: number
|
|
233
372
|
contentType?: string
|
|
234
373
|
etag: string
|
|
374
|
+
cacheControl?: string
|
|
375
|
+
contentDisposition?: string
|
|
376
|
+
metadata: Record<string, string>
|
|
377
|
+
/** Milliseconds since the Unix epoch. */
|
|
378
|
+
lastModified?: number
|
|
379
|
+
storageClass?: 'standard' | 'infrequent' | 'cold' | 'auto'
|
|
380
|
+
/** Milliseconds since the Unix epoch. */
|
|
381
|
+
retainUntil?: number
|
|
235
382
|
}
|
|
236
383
|
|
|
237
384
|
export enum ObjectErrorKind {
|
|
@@ -239,7 +386,18 @@ export enum ObjectErrorKind {
|
|
|
239
386
|
PreconditionFailed = 1,
|
|
240
387
|
InvalidArgument = 2,
|
|
241
388
|
Other = 3,
|
|
242
|
-
Internal = 4
|
|
389
|
+
Internal = 4,
|
|
390
|
+
Retained = 5
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
export interface ObjectVersion {
|
|
394
|
+
name: string
|
|
395
|
+
version?: string
|
|
396
|
+
size: number
|
|
397
|
+
etag: string
|
|
398
|
+
latest: boolean
|
|
399
|
+
/** Milliseconds since the Unix epoch. */
|
|
400
|
+
lastModified?: number
|
|
243
401
|
}
|
|
244
402
|
|
|
245
403
|
/** Span lifecycle calls into the telemetry pipeline. */
|
|
@@ -255,6 +413,17 @@ export class Pipeline {
|
|
|
255
413
|
dropped(): bigint
|
|
256
414
|
}
|
|
257
415
|
|
|
416
|
+
/**
|
|
417
|
+
* One message of a batch to publish: its raw payload, its attributes, and
|
|
418
|
+
* its ordering key, which an ordered topic's message needs and an unordered
|
|
419
|
+
* topic's cannot have.
|
|
420
|
+
*/
|
|
421
|
+
export interface PubSubBatchEntry {
|
|
422
|
+
data: Buffer
|
|
423
|
+
attributes?: Record<string, string>
|
|
424
|
+
orderingKey?: string
|
|
425
|
+
}
|
|
426
|
+
|
|
258
427
|
/**
|
|
259
428
|
* A PubSub message delivered to a subscription handler.
|
|
260
429
|
*
|
|
@@ -274,14 +443,20 @@ export class PubSubMessage {
|
|
|
274
443
|
get deliveryAttempt(): number
|
|
275
444
|
/** The time the message was published. */
|
|
276
445
|
get publishTime(): Date
|
|
446
|
+
/**
|
|
447
|
+
* The context of the span its handler runs in, with the W3C tracestate
|
|
448
|
+
* carrying Encore's propagation mark; null when there is none.
|
|
449
|
+
*/
|
|
450
|
+
get spanContext(): SpanContextData | null
|
|
277
451
|
}
|
|
278
452
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
453
|
+
/**
|
|
454
|
+
* What became of one message of a batch: its `id` if it was published,
|
|
455
|
+
* otherwise the `error` saying why not.
|
|
456
|
+
*/
|
|
457
|
+
export interface PubSubPublishOutcome {
|
|
458
|
+
id?: string
|
|
459
|
+
error?: string
|
|
285
460
|
}
|
|
286
461
|
|
|
287
462
|
export class PubSubSubscription {
|
|
@@ -302,6 +477,15 @@ export class PubSubTopic {
|
|
|
302
477
|
* cannot have.
|
|
303
478
|
*/
|
|
304
479
|
publish(data: Buffer, attributes?: Record<string, string> | undefined | null, source?: Buffer | undefined | null, orderingKey?: string | undefined | null): Promise<string>
|
|
480
|
+
/**
|
|
481
|
+
* Publish up to 1000 messages, resolving to each one's outcome in the
|
|
482
|
+
* order given. It is not atomic: some messages can be published and
|
|
483
|
+
* others not. On an ordered topic the messages of one key are published
|
|
484
|
+
* in order, and none after one of them fails. It rejects, publishing
|
|
485
|
+
* nothing, only when the batch as a whole is refused, as one of more
|
|
486
|
+
* than 1000 messages is.
|
|
487
|
+
*/
|
|
488
|
+
publishBatch(entries: Array<PubSubBatchEntry>, source?: Buffer | undefined | null): Promise<Array<PubSubPublishOutcome>>
|
|
305
489
|
}
|
|
306
490
|
|
|
307
491
|
export class QueryArgs {
|
|
@@ -376,18 +560,25 @@ export class RedisSubscription {
|
|
|
376
560
|
close(): Promise<void>
|
|
377
561
|
}
|
|
378
562
|
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
/**
|
|
382
|
-
|
|
563
|
+
/** How a declared Request Context field travels. */
|
|
564
|
+
export interface ReqctxField {
|
|
565
|
+
/** Carried on the Pub/Sub messages published with it set. */
|
|
566
|
+
pubsub: boolean
|
|
567
|
+
/** Put on the spans started with it set. */
|
|
568
|
+
trace: boolean
|
|
383
569
|
}
|
|
384
570
|
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
571
|
+
/** One revision of an object, for an `ifMatch` precondition. */
|
|
572
|
+
export interface Revision {
|
|
573
|
+
etag: string
|
|
574
|
+
version?: string
|
|
388
575
|
}
|
|
389
576
|
|
|
390
577
|
export class Row {
|
|
578
|
+
/**
|
|
579
|
+
* The row's values by column name. An `int8` is a number, or a `bigint`
|
|
580
|
+
* outside the integers a JS number holds exactly, so it is never rounded.
|
|
581
|
+
*/
|
|
391
582
|
values(): Record<string, unknown>
|
|
392
583
|
}
|
|
393
584
|
|
|
@@ -451,14 +642,25 @@ export class Runtime {
|
|
|
451
642
|
bucket(encoreName: string): Bucket
|
|
452
643
|
redisDatabase(encoreName: string): RedisDatabase
|
|
453
644
|
pubsubSubscription(cfg: PubSubSubscriptionConfig): PubSubSubscription
|
|
645
|
+
/** Each test's infrastructure: null outside test mode. */
|
|
646
|
+
testScopes(): TestScopes | null
|
|
647
|
+
/**
|
|
648
|
+
* What the app's .env files set for a test process, for the SDK to set
|
|
649
|
+
* those `process.env` lacks: `encore test` started it with them, a test
|
|
650
|
+
* runner did not. Empty outside test mode.
|
|
651
|
+
*/
|
|
652
|
+
testDotenv(): Record<string, string>
|
|
653
|
+
/**
|
|
654
|
+
* How the Request Context field `name` travels, as the app declares it;
|
|
655
|
+
* null when the runtime config lists no such field.
|
|
656
|
+
*/
|
|
657
|
+
reqctxField(name: string): ReqctxField | null
|
|
454
658
|
/**
|
|
455
|
-
*
|
|
456
|
-
* config has one of the name
|
|
457
|
-
*
|
|
659
|
+
* The config given to the service this process hosts, whatever its
|
|
660
|
+
* scope, if the runtime config has one of the name: a config name has one
|
|
661
|
+
* scope across the app.
|
|
458
662
|
*/
|
|
459
663
|
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
664
|
/**
|
|
463
665
|
* The secret given to the service this process hosts, whatever its scope:
|
|
464
666
|
* a name has one scope across the app.
|
|
@@ -479,6 +681,11 @@ export class Runtime {
|
|
|
479
681
|
export interface RuntimeConfig {
|
|
480
682
|
/** The service hosted by this process, if any. */
|
|
481
683
|
currentService?: string
|
|
684
|
+
/**
|
|
685
|
+
* The Worker of that service this process runs; none for its main
|
|
686
|
+
* process.
|
|
687
|
+
*/
|
|
688
|
+
currentWorker?: string
|
|
482
689
|
/**
|
|
483
690
|
* Base URLs of the services this process can reach, keyed by service
|
|
484
691
|
* name.
|
|
@@ -501,6 +708,13 @@ export interface RuntimeLogLine {
|
|
|
501
708
|
|
|
502
709
|
export interface RuntimeOptions {
|
|
503
710
|
testMode?: boolean
|
|
711
|
+
/**
|
|
712
|
+
* Whether the process is a test runner's, as the SDK finds from its
|
|
713
|
+
* environment: it is then in test mode without `encore test`, unless the
|
|
714
|
+
* core finds otherwise (`ENCORE_TEST=0`, `ENCORE_EXEC`, a runtime config
|
|
715
|
+
* in the environment).
|
|
716
|
+
*/
|
|
717
|
+
testRunner?: boolean
|
|
504
718
|
typeConstructors: RuntimeTypeConstructors
|
|
505
719
|
}
|
|
506
720
|
|
|
@@ -521,6 +735,13 @@ export enum SQLAccess {
|
|
|
521
735
|
ReadPrimary = 2
|
|
522
736
|
}
|
|
523
737
|
|
|
738
|
+
/** The isolation level of a transaction. See [`postgres::IsolationLevel`]. */
|
|
739
|
+
export enum SQLIsolationLevel {
|
|
740
|
+
ReadCommitted = 0,
|
|
741
|
+
RepeatableRead = 1,
|
|
742
|
+
Serializable = 2
|
|
743
|
+
}
|
|
744
|
+
|
|
524
745
|
export class Secret {
|
|
525
746
|
/** Returns the cached value of the secret. */
|
|
526
747
|
cached(): string
|
|
@@ -550,7 +771,12 @@ export interface SpanStartResult {
|
|
|
550
771
|
|
|
551
772
|
export class SqlConn {
|
|
552
773
|
close(): Promise<void>
|
|
553
|
-
|
|
774
|
+
/**
|
|
775
|
+
* Whether the connection was acquired from a read handle: its
|
|
776
|
+
* transactions are read-only whatever their options say.
|
|
777
|
+
*/
|
|
778
|
+
isReadOnly(): boolean
|
|
779
|
+
begin(options?: SqlTransactionOptions | undefined | null, source?: Buffer | undefined | null): Promise<Transaction>
|
|
554
780
|
query(query: string, args: QueryArgs, source?: Buffer | undefined | null): Promise<Cursor>
|
|
555
781
|
}
|
|
556
782
|
export type SQLConn = SqlConn
|
|
@@ -570,16 +796,224 @@ export class SqlDatabase {
|
|
|
570
796
|
* session read-only: see [`postgres::Database::proxy_conn_string`].
|
|
571
797
|
*/
|
|
572
798
|
connString(): string
|
|
573
|
-
/**
|
|
574
|
-
|
|
799
|
+
/**
|
|
800
|
+
* Whether the handle runs on read-only connections, as a read handle
|
|
801
|
+
* does: its transactions are read-only whatever their options say.
|
|
802
|
+
*/
|
|
803
|
+
isReadOnly(): boolean
|
|
804
|
+
/** Begins a transaction, with `options` if given. */
|
|
805
|
+
begin(options?: SqlTransactionOptions | undefined | null, source?: Buffer | undefined | null): Promise<Transaction>
|
|
575
806
|
query(query: string, args: QueryArgs, source?: Buffer | undefined | null): Promise<Cursor>
|
|
576
|
-
|
|
807
|
+
/**
|
|
808
|
+
* Takes a connection out of the pool, in the context `source` names:
|
|
809
|
+
* the host's active span context, as a query is given it.
|
|
810
|
+
*/
|
|
811
|
+
acquire(source?: Buffer | undefined | null): Promise<SQLConn>
|
|
577
812
|
}
|
|
578
813
|
export type SQLDatabase = SqlDatabase
|
|
579
814
|
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
815
|
+
/**
|
|
816
|
+
* How a transaction runs; what isn't set is the database's default. See
|
|
817
|
+
* [`postgres::TransactionOptions`].
|
|
818
|
+
*/
|
|
819
|
+
export interface SqlTransactionOptions {
|
|
820
|
+
isolation?: SQLIsolationLevel
|
|
821
|
+
readOnly?: boolean
|
|
822
|
+
deferrable?: boolean
|
|
823
|
+
}
|
|
824
|
+
export type SQLTransactionOptions = SqlTransactionOptions
|
|
825
|
+
|
|
826
|
+
/** The test session a system test's process runs against. */
|
|
827
|
+
export class SystemTest {
|
|
828
|
+
/** The suite the process's tests are of. */
|
|
829
|
+
get suite(): string
|
|
830
|
+
/** The test session's id, as `encore run ls` lists it. */
|
|
831
|
+
get session(): string
|
|
832
|
+
/** The session's service proxy: `/<service>/…` there reaches the service. */
|
|
833
|
+
get proxyUrl(): string
|
|
834
|
+
/**
|
|
835
|
+
* The URL of the gateway or frontend `name` in the session, or null if
|
|
836
|
+
* the app has neither.
|
|
837
|
+
*/
|
|
838
|
+
url(name: string): string | null
|
|
839
|
+
/** The names of the session's gateways, sorted. */
|
|
840
|
+
gateways(): Array<string>
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
/**
|
|
844
|
+
* What a system test's calls and messages carry of the test, for those
|
|
845
|
+
* whose context does not already hold it.
|
|
846
|
+
*/
|
|
847
|
+
export interface TestCarried {
|
|
848
|
+
/** The name of the Request Context field that holds the test's id. */
|
|
849
|
+
fieldName: string
|
|
850
|
+
/** The field's value, in a field's wire form. */
|
|
851
|
+
field: string
|
|
852
|
+
/**
|
|
853
|
+
* The headers a call made for the test carries, by lowercase name: the
|
|
854
|
+
* field, and the test's span as `traceparent` and `tracestate`.
|
|
855
|
+
*/
|
|
856
|
+
headers: Record<string, string>
|
|
857
|
+
/** The test's span as a `traceparent`, where the process records spans. */
|
|
858
|
+
traceparent?: string
|
|
859
|
+
/** The `tracestate` that goes with it. */
|
|
860
|
+
tracestate?: string
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
/**
|
|
864
|
+
* A message to hand a subscription's handler, and which delivery of it this
|
|
865
|
+
* is: 1 the first time.
|
|
866
|
+
*/
|
|
867
|
+
export interface TestDelivery {
|
|
868
|
+
message: TestPublished
|
|
869
|
+
attempt: number
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
/** A message a test published. */
|
|
873
|
+
export interface TestPublished {
|
|
874
|
+
id: string
|
|
875
|
+
data: Buffer
|
|
876
|
+
attributes: Record<string, string>
|
|
877
|
+
orderingKey?: string
|
|
878
|
+
/** When it was published, in milliseconds since the Unix epoch. */
|
|
879
|
+
publishTime: number
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
/** One test's infrastructure and overrides, until it ends. */
|
|
883
|
+
export class TestScope {
|
|
884
|
+
/** The scope's id: what its resources are provisioned under. */
|
|
885
|
+
get id(): string
|
|
886
|
+
/**
|
|
887
|
+
* What the test's calls and messages carry of it, when it is a system
|
|
888
|
+
* test: null for a service's test.
|
|
889
|
+
*/
|
|
890
|
+
carried(): TestCarried | null
|
|
891
|
+
/**
|
|
892
|
+
* Resolves once nothing the tests set in motion is still running or
|
|
893
|
+
* queued in the test session, waiting for at most `timeoutMs`, or the
|
|
894
|
+
* core's 30 seconds. Rejects, saying what was still under way, if it did
|
|
895
|
+
* not settle in time, and for a test that is no system test.
|
|
896
|
+
*/
|
|
897
|
+
settled(timeoutMs?: number | undefined | null): Promise<void>
|
|
898
|
+
/**
|
|
899
|
+
* What the test session recorded for the test so far, as the JSON of
|
|
900
|
+
* the core's model (`Telemetry::to_json`): once the session has settled
|
|
901
|
+
* with `settle`, waiting as `settled` does. Rejects for a test that is no
|
|
902
|
+
* system test.
|
|
903
|
+
*/
|
|
904
|
+
telemetry(settle: boolean, timeoutMs?: number | undefined | null): Promise<string>
|
|
905
|
+
/**
|
|
906
|
+
* The test's browser, which the test session runs for it, as JSON
|
|
907
|
+
* (`wsEndpoint`, `urls`, `recording`, `stepsUrl`): started at the first ask, the
|
|
908
|
+
* same one after that. `record` says when what it records is kept
|
|
909
|
+
* (`"failed"`, `"all"` or `"off"`), `args` are more arguments for it,
|
|
910
|
+
* and `width` and `height` its window's size. Rejects for a test that
|
|
911
|
+
* is no system test.
|
|
912
|
+
*/
|
|
913
|
+
browser(record?: string | undefined | null, args?: Array<string> | undefined | null, width?: number | undefined | null, height?: number | undefined | null): Promise<string>
|
|
914
|
+
/**
|
|
915
|
+
* Says how the test ended, for the session to record when the test
|
|
916
|
+
* ends: `"passed"`, `"failed"` or `"skipped"`. Nothing for a test that is
|
|
917
|
+
* no system test.
|
|
918
|
+
*/
|
|
919
|
+
setOutcome(outcome: 'passed' | 'failed' | 'skipped'): void
|
|
920
|
+
/**
|
|
921
|
+
* Ends the test: its resources are released, unless they are a
|
|
922
|
+
* fixture's. Its handles fail from then on.
|
|
923
|
+
*/
|
|
924
|
+
end(): void
|
|
925
|
+
/**
|
|
926
|
+
* Makes the test's resources start from the fixture `name`, which must be
|
|
927
|
+
* built, or from their initial state for null. Fails once the test has
|
|
928
|
+
* used a resource, unless it is what they started from.
|
|
929
|
+
*/
|
|
930
|
+
useFixture(name?: string | undefined | null): void
|
|
931
|
+
/**
|
|
932
|
+
* Saves what the fixture's setup left in this scope's resources as the
|
|
933
|
+
* fixture `name`, ending the scope. Resolves once the daemon has saved
|
|
934
|
+
* them.
|
|
935
|
+
*/
|
|
936
|
+
saveFixture(name: string): Promise<void>
|
|
937
|
+
/**
|
|
938
|
+
* The test's instance of the database `name`, provisioned when first
|
|
939
|
+
* asked for.
|
|
940
|
+
*/
|
|
941
|
+
sqlDatabase(name: string): SqlDatabase
|
|
942
|
+
/**
|
|
943
|
+
* The test's instance of the bucket `name`, provisioned when first asked
|
|
944
|
+
* for.
|
|
945
|
+
*/
|
|
946
|
+
bucket(name: string): Bucket
|
|
947
|
+
/**
|
|
948
|
+
* The test's instance of the Redis database `name`, provisioned when
|
|
949
|
+
* first asked for.
|
|
950
|
+
*/
|
|
951
|
+
redisDatabase(name: string): RedisDatabase
|
|
952
|
+
/**
|
|
953
|
+
* Records a message the test published to the topic `topic`, returning
|
|
954
|
+
* its id. It is not sent: the test reads it back, or delivers it. Of the
|
|
955
|
+
* Request Context attributes it keeps those of fields declared with
|
|
956
|
+
* `pubsub`, as the runtime does when it publishes.
|
|
957
|
+
*/
|
|
958
|
+
recordPublished(topic: string, data: Buffer, attributes?: Record<string, string> | undefined | null, orderingKey?: string | undefined | null): string
|
|
959
|
+
/** What the test has published to the topic `topic`, in order. */
|
|
960
|
+
published(topic: string): Array<TestPublished>
|
|
961
|
+
/**
|
|
962
|
+
* The next message the test published to `topic` that `subscription`
|
|
963
|
+
* has not handled and its filter matches, or null. Settle it with
|
|
964
|
+
* `settleDelivery` before asking for the next.
|
|
965
|
+
*/
|
|
966
|
+
nextDelivery(topic: string, subscription: string): TestDelivery | null
|
|
967
|
+
/**
|
|
968
|
+
* Settles the message `nextDelivery` last handed `subscription`: past it
|
|
969
|
+
* if `handled`, or handed over again next time, as its next attempt.
|
|
970
|
+
*/
|
|
971
|
+
settleDelivery(topic: string, subscription: string, handled: boolean): void
|
|
972
|
+
/** Gives the secret `name` a value for this test. */
|
|
973
|
+
setSecret(name: string, value: Buffer): void
|
|
974
|
+
/** The value the test has given the secret `name`, if it has. */
|
|
975
|
+
secret(name: string): Buffer | null
|
|
976
|
+
/**
|
|
977
|
+
* Gives the config `name` a value for this test, once it satisfies the
|
|
978
|
+
* config's schema. A config name has one scope across the app, so it is
|
|
979
|
+
* the name alone. `value` and what it returns are JSON text: the value as
|
|
980
|
+
* the runtime holds it, with placeholders for its secret fields.
|
|
981
|
+
*/
|
|
982
|
+
setConfig(name: string, value: string): string
|
|
983
|
+
/** The value the test has given a config, as JSON text, if it has. */
|
|
984
|
+
config(name: string): string | null
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
/** The tests of a runtime in test mode. */
|
|
988
|
+
export class TestScopes {
|
|
989
|
+
/**
|
|
990
|
+
* Begins a test: a scope with no resources yet, each provisioned when the
|
|
991
|
+
* test first asks for it. `name` is for diagnostics only.
|
|
992
|
+
*/
|
|
993
|
+
begin(name?: string | undefined | null): TestScope
|
|
994
|
+
/**
|
|
995
|
+
* The most messages one `deliver` hands a subscription: more is a handler
|
|
996
|
+
* that publishes to its own topic for ever.
|
|
997
|
+
*/
|
|
998
|
+
get maxDeliveries(): number
|
|
999
|
+
/**
|
|
1000
|
+
* The test session the process's tests run against, when they are
|
|
1001
|
+
* system tests: null for the tests of a service.
|
|
1002
|
+
*/
|
|
1003
|
+
system(): SystemTest | null
|
|
1004
|
+
/**
|
|
1005
|
+
* Asks for the fixture `name`, which starts from the fixture `parent` if
|
|
1006
|
+
* there is one. Resolves to null once it is built — by this process or
|
|
1007
|
+
* another, which it waits for — or to a scope to build it in: run the
|
|
1008
|
+
* fixture's setup with its resources, then `saveFixture`, or
|
|
1009
|
+
* `failFixture` if the setup fails.
|
|
1010
|
+
*/
|
|
1011
|
+
acquireFixture(name: string, parent?: string | undefined | null): Promise<TestScope | null>
|
|
1012
|
+
/**
|
|
1013
|
+
* Gives up building the fixture `name`, with the reason to show whoever
|
|
1014
|
+
* is waiting for it.
|
|
1015
|
+
*/
|
|
1016
|
+
failFixture(name: string, message: string): void
|
|
583
1017
|
}
|
|
584
1018
|
|
|
585
1019
|
export class Transaction {
|
|
@@ -594,19 +1028,60 @@ export class TypedObjectError {
|
|
|
594
1028
|
message: string
|
|
595
1029
|
}
|
|
596
1030
|
|
|
1031
|
+
/**
|
|
1032
|
+
* Unset fields stay as they are, and `""` clears one (a cleared content type
|
|
1033
|
+
* is `application/octet-stream`). `metadata` replaces the whole map.
|
|
1034
|
+
*/
|
|
1035
|
+
export interface UpdateAttrs {
|
|
1036
|
+
contentType?: string
|
|
1037
|
+
cacheControl?: string
|
|
1038
|
+
contentDisposition?: string
|
|
1039
|
+
metadata?: Record<string, string>
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
export interface UpdateAttrsOptions {
|
|
1043
|
+
version?: string
|
|
1044
|
+
ifMatch?: Revision
|
|
1045
|
+
}
|
|
1046
|
+
|
|
597
1047
|
export interface UploadOptions {
|
|
598
1048
|
contentType?: string
|
|
1049
|
+
cacheControl?: string
|
|
1050
|
+
contentDisposition?: string
|
|
1051
|
+
metadata?: Record<string, string>
|
|
1052
|
+
storageClass?: string
|
|
1053
|
+
/** Milliseconds since the Unix epoch. */
|
|
1054
|
+
retainUntil?: number
|
|
599
1055
|
preconditions?: UploadPreconditions
|
|
600
1056
|
}
|
|
601
1057
|
|
|
602
1058
|
export interface UploadPreconditions {
|
|
603
1059
|
notExists?: boolean
|
|
1060
|
+
ifMatch?: Revision
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
/** An upload in progress, fed one chunk at a time. */
|
|
1064
|
+
export class UploadStream {
|
|
1065
|
+
/**
|
|
1066
|
+
* Writes a chunk, waiting while the upload's buffer is full. Returns the
|
|
1067
|
+
* upload's error if it has failed; the upload is then over.
|
|
1068
|
+
*/
|
|
1069
|
+
write(chunk: Buffer): Promise<TypedObjectError | null>
|
|
1070
|
+
/** Ends the data and waits for the object to be stored. */
|
|
1071
|
+
finish(): Promise<ObjectAttrs | TypedObjectError>
|
|
1072
|
+
/** Abandons the upload without storing anything. */
|
|
1073
|
+
abort(): Promise<void>
|
|
604
1074
|
}
|
|
605
1075
|
|
|
606
1076
|
export interface UploadUrlOptions {
|
|
607
1077
|
ttl?: number
|
|
608
1078
|
}
|
|
609
1079
|
|
|
1080
|
+
export class VersionIterator {
|
|
1081
|
+
next(): Promise<ObjectVersion | null | TypedObjectError>
|
|
1082
|
+
markDone(): void
|
|
1083
|
+
}
|
|
1084
|
+
|
|
610
1085
|
/**
|
|
611
1086
|
* One log record in the Encore log format, newline included, for the
|
|
612
1087
|
* logger to print. Absent, empty, and 0 are none. `level` is the
|
|
@@ -622,6 +1097,71 @@ export interface UploadUrlOptions {
|
|
|
622
1097
|
*/
|
|
623
1098
|
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
1099
|
|
|
1100
|
+
/**
|
|
1101
|
+
* Lets the request of the `request` event `eventId` through, with
|
|
1102
|
+
* `headerEdits`, the Request Context fields in `context` set (or cleared,
|
|
1103
|
+
* with a null value), `attributes` for its edge span, and the Middleware's
|
|
1104
|
+
* later hooks in `skip` (2 request body, 4 response, 8 response body, 16
|
|
1105
|
+
* complete) skipped. False when no hook waits for it any more.
|
|
1106
|
+
*/
|
|
1107
|
+
export declare function gatewayContinue(eventId: number, headerEdits: Array<GatewayHeaderEdit>, context: Array<GatewayField>, attributes: Array<GatewayAttribute>, skip: number): boolean
|
|
1108
|
+
|
|
1109
|
+
/**
|
|
1110
|
+
* How many body chunks and `complete` events were dropped, JavaScript not
|
|
1111
|
+
* keeping up.
|
|
1112
|
+
*/
|
|
1113
|
+
export declare function gatewayDropped(): number
|
|
1114
|
+
|
|
1115
|
+
/**
|
|
1116
|
+
* Fails the hook of the event `eventId`, a `"request"` or `"response"`
|
|
1117
|
+
* event as `hook` says, with `message`, `how` it failed: `"error"`, an
|
|
1118
|
+
* error it threw; `"panic"`, one it did not mean to; `"timeout"`, it ran
|
|
1119
|
+
* out of time, which a fail-closed Middleware answers with 503 as it does
|
|
1120
|
+
* the gateway's own timeout. The Middleware's `onError` decides what
|
|
1121
|
+
* becomes of the request. False when no hook waits for it any more.
|
|
1122
|
+
*/
|
|
1123
|
+
export declare function gatewayFail(eventId: number, hook: string, message: string, how: string): boolean
|
|
1124
|
+
|
|
1125
|
+
/**
|
|
1126
|
+
* Registers a Middleware, as its JSON spec states it, after those registered
|
|
1127
|
+
* before, and returns its id, which its events name. Names and interests
|
|
1128
|
+
* are checked when the gateway is served.
|
|
1129
|
+
*/
|
|
1130
|
+
export declare function gatewayRegister(specJson: string): number
|
|
1131
|
+
|
|
1132
|
+
/**
|
|
1133
|
+
* Answers the request of the `request` event `eventId` itself, with
|
|
1134
|
+
* `status`: an Encore error when `code` is given, with `message`, else
|
|
1135
|
+
* `body` as it is. False when no hook waits for it any more.
|
|
1136
|
+
*/
|
|
1137
|
+
export declare function gatewayRespond(eventId: number, status: number, code: string | undefined | null, message: string, headers: Array<GatewayHeader>, body?: Buffer | undefined | null): boolean
|
|
1138
|
+
|
|
1139
|
+
/**
|
|
1140
|
+
* Answers the `response` event `eventId` with `headerEdits` to the
|
|
1141
|
+
* response. False when no hook waits for it any more.
|
|
1142
|
+
*/
|
|
1143
|
+
export declare function gatewayResponseEdits(eventId: number, headerEdits: Array<GatewayHeaderEdit>): boolean
|
|
1144
|
+
|
|
1145
|
+
/**
|
|
1146
|
+
* Serves the gateway the runtime config hosts, where the environment says,
|
|
1147
|
+
* with the Middleware registered, until the runtime's shutdown stops it.
|
|
1148
|
+
* Returns once it is listening, with where.
|
|
1149
|
+
*
|
|
1150
|
+
* Each batch of hook events is handed to `onEvents` on the event loop, in
|
|
1151
|
+
* the order the host queued them, and null once the gateway has stopped
|
|
1152
|
+
* and every event was handed on. Until then the event loop is kept alive.
|
|
1153
|
+
*/
|
|
1154
|
+
export declare function gatewayServe(runtime: Runtime, onEvents: (events: Array<object> | null) => void): string
|
|
1155
|
+
|
|
1156
|
+
/**
|
|
1157
|
+
* How long, in milliseconds, the hook of the `request` or `response` event
|
|
1158
|
+
* `eventId` has waited for its answer; null once it waits no more, as when
|
|
1159
|
+
* its Middleware's timeout passed and the gateway went on without it. The
|
|
1160
|
+
* dispatcher runs a hook only while it is waited for, and for what is left
|
|
1161
|
+
* of its timeout.
|
|
1162
|
+
*/
|
|
1163
|
+
export declare function gatewayWaited(eventId: number): number | null
|
|
1164
|
+
|
|
625
1165
|
/**
|
|
626
1166
|
* Hands the runtime's own log lines to `handler` on the event loop, or
|
|
627
1167
|
* drops them for `null`. Lines logged before the first call are handed
|