@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
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Request Context in its wire form, as the OpenTelemetry context holds it.
|
|
3
|
+
*
|
|
4
|
+
* A request's fields (ADR 0014) travel with the context of the code handling
|
|
5
|
+
* it: each field's name, and its value as it travels, base64url (without
|
|
6
|
+
* padding) of its JSON. They are kept in that form, so moving them costs
|
|
7
|
+
* nothing; only reading one decodes it. Every field a request carries is kept
|
|
8
|
+
* and sent on, those this process declares nothing about included, so a
|
|
9
|
+
* service passes on the fields of the services it sits between.
|
|
10
|
+
*
|
|
11
|
+
* `@encore.dev/sdk/reqctx` reads and sets fields and takes them from and puts
|
|
12
|
+
* them on requests; `pubsub` hands the runtime every field a message is
|
|
13
|
+
* published with, and the runtime carries those declared with `pubsub`.
|
|
14
|
+
*
|
|
15
|
+
* How a field travels is its declaration's, wherever it is: the runtime
|
|
16
|
+
* config lists every field the app declares ({@link configOf}).
|
|
17
|
+
*/
|
|
18
|
+
import { createContextKey, } from '@opentelemetry/api';
|
|
19
|
+
import { activeContext } from './otel/context.js';
|
|
20
|
+
/** The header a field travels in on a request, before its name. */
|
|
21
|
+
export const HEADER_PREFIX = 'x-encore-meta-ctx-';
|
|
22
|
+
/** The attribute a field travels in on a Pub/Sub message, before its name. */
|
|
23
|
+
export const ATTRIBUTE_PREFIX = 'encore-ctx-';
|
|
24
|
+
/** The span attribute a field declared with `trace` is, before its name. */
|
|
25
|
+
export const SPAN_ATTRIBUTE_PREFIX = 'encore.ctx.';
|
|
26
|
+
/** Encore's own field under test: the id of the test a request is made for. */
|
|
27
|
+
export const TEST_FIELD = 'encore-test';
|
|
28
|
+
/** The span attribute the test's id is, on every span of what it caused. */
|
|
29
|
+
export const TEST_ID_ATTRIBUTE = 'encore.test.id';
|
|
30
|
+
/** The most one field encodes to, in bytes. */
|
|
31
|
+
export const MAX_VALUE_SIZE = 4096;
|
|
32
|
+
/** The most a field declared with `pubsub` encodes to, in bytes: GCP
|
|
33
|
+
* Pub/Sub's limit on an attribute's value. */
|
|
34
|
+
export const MAX_PUBSUB_VALUE_SIZE = 1024;
|
|
35
|
+
/** The most all of a request's fields encode to, in bytes. */
|
|
36
|
+
export const MAX_SIZE = 8192;
|
|
37
|
+
const KEY = createContextKey('encore-request-context');
|
|
38
|
+
const NAME = /^[a-z](?:[a-z0-9-]{0,61}[a-z0-9])?$/;
|
|
39
|
+
const BASE64URL = /^[A-Za-z0-9_-]*$/;
|
|
40
|
+
const NONE = { pubsub: false, trace: false };
|
|
41
|
+
/** The configs of the fields this process declares. */
|
|
42
|
+
const configs = new Map();
|
|
43
|
+
/** The configs the runtime config lists, memoised by name. */
|
|
44
|
+
const declared = new Map();
|
|
45
|
+
let lookup;
|
|
46
|
+
/** Whether `name` can be a field's: what the parser lets a declaration
|
|
47
|
+
* have, kebab-case, 1 to 63 lowercase letters, digits and hyphens, starting
|
|
48
|
+
* with a letter and ending with a letter or digit. The parser checks the
|
|
49
|
+
* declarations; this only keeps what a request or message carries to names a
|
|
50
|
+
* field could have. */
|
|
51
|
+
export function validName(name) {
|
|
52
|
+
return typeof name === 'string' && NAME.test(name);
|
|
53
|
+
}
|
|
54
|
+
/** Records the config of the field `name`, declared in this process. */
|
|
55
|
+
export function declare(name, config) {
|
|
56
|
+
configs.set(name, config);
|
|
57
|
+
}
|
|
58
|
+
/** Where {@link configOf} reads the runtime config's fields: set by the
|
|
59
|
+
* runtime as it loads, so this module needs no native code. */
|
|
60
|
+
export function setDeclaredLookup(fn) {
|
|
61
|
+
lookup = fn;
|
|
62
|
+
declared.clear();
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The config of the field `name`, as the app declares it.
|
|
66
|
+
*
|
|
67
|
+
* The runtime config lists every field the app declares, so a field this
|
|
68
|
+
* process only binds by name travels as declared. A field it does not list,
|
|
69
|
+
* as without Encore's tooling, has the config this process declares it with,
|
|
70
|
+
* or none.
|
|
71
|
+
*/
|
|
72
|
+
export function configOf(name) {
|
|
73
|
+
if (lookup !== undefined) {
|
|
74
|
+
let config = declared.get(name);
|
|
75
|
+
if (config === undefined) {
|
|
76
|
+
config = lookup(name);
|
|
77
|
+
declared.set(name, config);
|
|
78
|
+
}
|
|
79
|
+
if (config !== null)
|
|
80
|
+
return config;
|
|
81
|
+
}
|
|
82
|
+
return configs.get(name) ?? NONE;
|
|
83
|
+
}
|
|
84
|
+
/** The wire form of a JSON value. Throws a `TypeError` when it has none. */
|
|
85
|
+
export function encode(value) {
|
|
86
|
+
const json = JSON.stringify(value);
|
|
87
|
+
if (json === undefined) {
|
|
88
|
+
throw new TypeError(`a ${typeOf(value)} has no JSON form`);
|
|
89
|
+
}
|
|
90
|
+
return Buffer.from(json, 'utf8').toString('base64url');
|
|
91
|
+
}
|
|
92
|
+
function typeOf(value) {
|
|
93
|
+
return value === null ? 'null' : typeof value;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* The JSON value of a field's wire form. Throws when it is not base64url
|
|
97
|
+
* without padding, or what that holds is not JSON. Says where it is wrong,
|
|
98
|
+
* never what it holds: a field may hold who a request is made for.
|
|
99
|
+
*/
|
|
100
|
+
export function decode(value) {
|
|
101
|
+
if (!BASE64URL.test(value) || value.length % 4 === 1) {
|
|
102
|
+
throw new Error('it is not base64url without padding');
|
|
103
|
+
}
|
|
104
|
+
let text;
|
|
105
|
+
try {
|
|
106
|
+
text = new TextDecoder('utf-8', { fatal: true }).decode(Buffer.from(value, 'base64url'));
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
throw new Error('it is not UTF-8');
|
|
110
|
+
}
|
|
111
|
+
try {
|
|
112
|
+
return JSON.parse(text);
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
throw new Error('it is not valid JSON');
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/** The fields of `ctx`, or of the active context: name to wire form. */
|
|
119
|
+
export function current(ctx = activeContext()) {
|
|
120
|
+
const fields = ctx.getValue(KEY);
|
|
121
|
+
return isFields(fields) ? fields : {};
|
|
122
|
+
}
|
|
123
|
+
function isFields(value) {
|
|
124
|
+
return typeof value === 'object' && value !== null;
|
|
125
|
+
}
|
|
126
|
+
/** A copy of `ctx` holding exactly `fields`. */
|
|
127
|
+
export function withFields(fields, ctx = activeContext()) {
|
|
128
|
+
return ctx.setValue(KEY, Object.freeze({ ...fields }));
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* A copy of `ctx` holding `fields` itself, not a copy of them: a field set
|
|
132
|
+
* in `fields` later shows in the context, and in every context made from
|
|
133
|
+
* it, until one of those sets a field of its own. A gateway Middleware's
|
|
134
|
+
* hook runs in one, so its calls carry what it has set on its request so
|
|
135
|
+
* far.
|
|
136
|
+
*/
|
|
137
|
+
export function withLiveFields(fields, ctx = activeContext()) {
|
|
138
|
+
return ctx.setValue(KEY, fields);
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* A copy of `ctx` with the field `name` set to `value`, a wire form.
|
|
142
|
+
*
|
|
143
|
+
* Throws a `RangeError`, saying what the value does, when it is bigger than
|
|
144
|
+
* the field may be, or makes the fields bigger than a request's may be.
|
|
145
|
+
*/
|
|
146
|
+
export function withValue(name, value, ctx = activeContext()) {
|
|
147
|
+
if (value.length > MAX_VALUE_SIZE) {
|
|
148
|
+
throw new RangeError(`encodes to ${value.length} bytes, more than the ${MAX_VALUE_SIZE} a field may`);
|
|
149
|
+
}
|
|
150
|
+
if (configOf(name).pubsub && value.length > MAX_PUBSUB_VALUE_SIZE) {
|
|
151
|
+
throw new RangeError(`encodes to ${value.length} bytes, more than the ${MAX_PUBSUB_VALUE_SIZE} ` +
|
|
152
|
+
'a field carried on Pub/Sub messages may');
|
|
153
|
+
}
|
|
154
|
+
const fields = { ...current(ctx), [name]: value };
|
|
155
|
+
const size = Object.values(fields).reduce((n, v) => n + v.length, 0);
|
|
156
|
+
if (size > MAX_SIZE) {
|
|
157
|
+
throw new RangeError(`makes the request's fields encode to ${size} bytes, more than the ${MAX_SIZE} they may`);
|
|
158
|
+
}
|
|
159
|
+
return withFields(fields, ctx);
|
|
160
|
+
}
|
|
161
|
+
/** A copy of `ctx` without the field `name`. */
|
|
162
|
+
export function without(name, ctx = activeContext()) {
|
|
163
|
+
const fields = current(ctx);
|
|
164
|
+
if (!Object.hasOwn(fields, name))
|
|
165
|
+
return ctx;
|
|
166
|
+
const rest = { ...fields };
|
|
167
|
+
delete rest[name];
|
|
168
|
+
return withFields(rest, ctx);
|
|
169
|
+
}
|
|
170
|
+
/** The field the header `name` carries, if it carries one. */
|
|
171
|
+
export function headerField(name) {
|
|
172
|
+
const lowered = name.toLowerCase();
|
|
173
|
+
if (!lowered.startsWith(HEADER_PREFIX))
|
|
174
|
+
return undefined;
|
|
175
|
+
const field = lowered.slice(HEADER_PREFIX.length);
|
|
176
|
+
return validName(field) ? field : undefined;
|
|
177
|
+
}
|
|
178
|
+
function isHeadersLike(headers) {
|
|
179
|
+
return (typeof headers.forEach === 'function' &&
|
|
180
|
+
typeof headers.get === 'function');
|
|
181
|
+
}
|
|
182
|
+
/** The fields a request's headers carry: the first value of each, under a
|
|
183
|
+
* name in any case. */
|
|
184
|
+
export function fromHeaders(headers) {
|
|
185
|
+
const fields = {};
|
|
186
|
+
const take = (name, value) => {
|
|
187
|
+
const field = headerField(name);
|
|
188
|
+
if (field === undefined || Object.hasOwn(fields, field))
|
|
189
|
+
return;
|
|
190
|
+
// Fetch joins a repeated header's values with ", ".
|
|
191
|
+
const first = typeof value === 'string' ? value.split(',')[0] : value?.[0];
|
|
192
|
+
if (first !== undefined)
|
|
193
|
+
fields[field] = first.trim();
|
|
194
|
+
};
|
|
195
|
+
if (isHeadersLike(headers)) {
|
|
196
|
+
headers.forEach((value, name) => take(name, value));
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
for (const [name, value] of Object.entries(headers))
|
|
200
|
+
take(name, value);
|
|
201
|
+
}
|
|
202
|
+
return fields;
|
|
203
|
+
}
|
|
204
|
+
/** Sets the fields of `ctx` on a request's headers, in place of any it
|
|
205
|
+
* carried. */
|
|
206
|
+
export function toHeaders(headers, ctx) {
|
|
207
|
+
const fields = current(ctx);
|
|
208
|
+
if (isHeadersLike(headers)) {
|
|
209
|
+
const stale = [];
|
|
210
|
+
headers.forEach((_, name) => {
|
|
211
|
+
if (name.toLowerCase().startsWith(HEADER_PREFIX))
|
|
212
|
+
stale.push(name);
|
|
213
|
+
});
|
|
214
|
+
for (const name of stale)
|
|
215
|
+
headers.delete(name);
|
|
216
|
+
for (const [name, value] of Object.entries(fields)) {
|
|
217
|
+
headers.set(HEADER_PREFIX + name, value);
|
|
218
|
+
}
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
for (const name of Object.keys(headers)) {
|
|
222
|
+
if (name.toLowerCase().startsWith(HEADER_PREFIX))
|
|
223
|
+
delete headers[name];
|
|
224
|
+
}
|
|
225
|
+
for (const [name, value] of Object.entries(fields)) {
|
|
226
|
+
headers[HEADER_PREFIX + name] = value;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
/** Whether the message attribute `key` carries a field. */
|
|
230
|
+
export function isAttribute(key) {
|
|
231
|
+
return key.startsWith(ATTRIBUTE_PREFIX);
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* `attributes`, with the fields of `ctx` in place of any field attributes
|
|
235
|
+
* they had: every field `ctx` holds. The runtime publishes the message with
|
|
236
|
+
* those the app declares with `pubsub`, and leaves the rest off it.
|
|
237
|
+
*/
|
|
238
|
+
export function messageAttributes(attributes, ctx = activeContext()) {
|
|
239
|
+
const fields = current(ctx);
|
|
240
|
+
const names = Object.keys(fields);
|
|
241
|
+
if (names.length === 0 && attributes === undefined)
|
|
242
|
+
return undefined;
|
|
243
|
+
const out = {};
|
|
244
|
+
for (const [key, value] of Object.entries(attributes ?? {})) {
|
|
245
|
+
if (!isAttribute(key))
|
|
246
|
+
out[key] = value;
|
|
247
|
+
}
|
|
248
|
+
for (const name of names)
|
|
249
|
+
out[ATTRIBUTE_PREFIX + name] = fields[name];
|
|
250
|
+
return out;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* The fields a delivered message carries, and its other attributes.
|
|
254
|
+
*
|
|
255
|
+
* A message's attributes are its publisher's to write, and nothing signs
|
|
256
|
+
* them: the runtime hands a handler only those of fields the app declares
|
|
257
|
+
* with `pubsub`, and of those only ones under a valid name and within their
|
|
258
|
+
* limit are taken, so a forged attribute can at most claim a field the app
|
|
259
|
+
* chose to carry on messages.
|
|
260
|
+
*/
|
|
261
|
+
export function fromMessageAttributes(attributes) {
|
|
262
|
+
const fields = {};
|
|
263
|
+
const rest = {};
|
|
264
|
+
for (const [key, value] of Object.entries(attributes)) {
|
|
265
|
+
if (!isAttribute(key)) {
|
|
266
|
+
rest[key] = value;
|
|
267
|
+
continue;
|
|
268
|
+
}
|
|
269
|
+
const name = key.slice(ATTRIBUTE_PREFIX.length);
|
|
270
|
+
if (validName(name) && value.length <= MAX_PUBSUB_VALUE_SIZE) {
|
|
271
|
+
fields[name] = value;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
return { fields, rest };
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* The span attributes of the fields of `ctx` declared with `trace`: each
|
|
278
|
+
* `encore.ctx.<name>`, the value's JSON, as a string. Encore's own field
|
|
279
|
+
* under test is `encore.test.id`, the test's id as it is: one name and one
|
|
280
|
+
* form, whichever SDK's process records the span, is what a test's spans are
|
|
281
|
+
* found by.
|
|
282
|
+
*/
|
|
283
|
+
export function spanAttributes(ctx) {
|
|
284
|
+
const out = {};
|
|
285
|
+
for (const [name, value] of Object.entries(current(ctx))) {
|
|
286
|
+
if (!configOf(name).trace || !BASE64URL.test(value))
|
|
287
|
+
continue;
|
|
288
|
+
const json = Buffer.from(value, 'base64url').toString('utf8');
|
|
289
|
+
if (name === TEST_FIELD) {
|
|
290
|
+
const id = testId(json);
|
|
291
|
+
if (id !== undefined)
|
|
292
|
+
out[TEST_ID_ATTRIBUTE] = id;
|
|
293
|
+
continue;
|
|
294
|
+
}
|
|
295
|
+
out[SPAN_ATTRIBUTE_PREFIX + name] = json;
|
|
296
|
+
}
|
|
297
|
+
return out;
|
|
298
|
+
}
|
|
299
|
+
/** The test's id the field under test holds: its JSON is a string's. */
|
|
300
|
+
function testId(json) {
|
|
301
|
+
try {
|
|
302
|
+
const id = JSON.parse(json);
|
|
303
|
+
return typeof id === 'string' ? id : undefined;
|
|
304
|
+
}
|
|
305
|
+
catch {
|
|
306
|
+
return undefined;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* An OpenTelemetry propagator that extracts the fields a request carries into
|
|
311
|
+
* its context, and injects none. Compose it into the app's global propagator,
|
|
312
|
+
* so a server instrumented for tracing has them:
|
|
313
|
+
*
|
|
314
|
+
* ```ts
|
|
315
|
+
* propagation.setGlobalPropagator(
|
|
316
|
+
* new CompositePropagator({
|
|
317
|
+
* propagators: [new W3CTraceContextPropagator(), new reqctx.Propagator()],
|
|
318
|
+
* }),
|
|
319
|
+
* );
|
|
320
|
+
* ```
|
|
321
|
+
*
|
|
322
|
+
* It never injects: an instrumented client sends whatever the global
|
|
323
|
+
* propagator injects to whatever it calls, the app's own services or not, so
|
|
324
|
+
* fields are sent only where the app asks. Send them to the app's services
|
|
325
|
+
* with `reqctx.inject`.
|
|
326
|
+
*/
|
|
327
|
+
export class Propagator {
|
|
328
|
+
/** `ctx` with the fields `carrier` carries, in place of its own. */
|
|
329
|
+
extract(ctx, carrier, getter) {
|
|
330
|
+
const fields = {};
|
|
331
|
+
for (const key of getter.keys(carrier)) {
|
|
332
|
+
const name = headerField(key);
|
|
333
|
+
if (name === undefined || Object.hasOwn(fields, name))
|
|
334
|
+
continue;
|
|
335
|
+
const value = getter.get(carrier, key);
|
|
336
|
+
const first = Array.isArray(value) ? value[0] : value;
|
|
337
|
+
if (typeof first === 'string')
|
|
338
|
+
fields[name] = first;
|
|
339
|
+
}
|
|
340
|
+
return Object.keys(fields).length === 0 ? ctx : withFields(fields, ctx);
|
|
341
|
+
}
|
|
342
|
+
/** Injects nothing: see the class's documentation. */
|
|
343
|
+
inject() { }
|
|
344
|
+
/** None: {@link inject} sets nothing. */
|
|
345
|
+
fields() {
|
|
346
|
+
return [];
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
//# sourceMappingURL=reqfields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reqfields.js","sourceRoot":"","sources":["../../internal/reqfields.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EACL,gBAAgB,GAIjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAC,aAAa,EAAC,MAAM,gBAAgB,CAAC;AAE7C,mEAAmE;AACnE,MAAM,CAAC,MAAM,aAAa,GAAG,oBAAoB,CAAC;AAClD,8EAA8E;AAC9E,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAAC;AAC9C,4EAA4E;AAC5E,MAAM,CAAC,MAAM,qBAAqB,GAAG,aAAa,CAAC;AACnD,+EAA+E;AAC/E,MAAM,CAAC,M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AACvC,wBAAgB,aAAa,IAAI,aAAa,CAG7C;AAED;4CAC4C;AAC5C,wBAAgB,KAAK,IAAI,KAAK,CAG7B;AAED,0DAA0D;AAC1D,wBAAgB,aAAa,IAAI,MAAM,GAAG,SAAS,CAElD"}
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import { Runtime } from './napi/napi.cjs';
|
|
2
2
|
export * from './napi/napi.cjs';
|
|
3
3
|
export declare const RT: Runtime;
|
|
4
|
+
/** Each test's infrastructure: null outside test mode. */
|
|
5
|
+
export declare const TEST_SCOPES: import("./napi/napi.cjs").TestScopes | null;
|
|
4
6
|
export { runUntilShutdown } from './shutdown.js';
|
|
5
7
|
export interface RuntimeConfig {
|
|
6
8
|
/** The service hosted by this process, if any. */
|
|
7
9
|
currentService?: string;
|
|
10
|
+
/** The Worker of that service this process runs, if any: none for the
|
|
11
|
+
* service's main process. */
|
|
12
|
+
currentWorker?: string;
|
|
8
13
|
/** Base URLs of the services this process can reach, keyed by service
|
|
9
14
|
* name. */
|
|
10
15
|
services: Record<string, string>;
|
|
11
16
|
}
|
|
12
17
|
export declare function runtimeConfig(): RuntimeConfig;
|
|
18
|
+
//# sourceMappingURL=mod.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../internal/runtime/mod.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,OAAO,EAAuB,MAAM,iBAAiB,CAAC;AAG9D,cAAc,iBAAiB,CAAC;AA0BhC,eAAO,MAAM,EAAE,SAMb,CAAC;AAEH,0DAA0D;AAC1D,eAAO,MAAM,WAAW,6CAAkB,CAAC;AAe3C,OAAO,EAAC,gBAAgB,EAAC,MAAM,YAAY,CAAC;AAE5C,MAAM,WAAW,aAAa;IAC5B,kDAAkD;IAClD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;iCAC6B;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;eACW;IACX,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAGD,wBAAgB,aAAa,IAAI,aAAa,CAU7C"}
|
|
@@ -2,17 +2,46 @@ import { Decimal } from '../../types/mod.js';
|
|
|
2
2
|
import { printRuntimeLine } from '../../log/runtime.js';
|
|
3
3
|
import { setShutdownRuntime, watchShutdownSignals } from './shutdown.js';
|
|
4
4
|
import { Runtime, setRuntimeLogHandler } from './napi/napi.cjs';
|
|
5
|
+
import { setDeclaredLookup } from '../reqfields.js';
|
|
5
6
|
export * from './napi/napi.cjs';
|
|
6
|
-
|
|
7
|
+
/** `ENCORE_TEST=0` (or `false`, `off`): the process is not run as a test. */
|
|
8
|
+
const optedOut = ['0', 'false', 'off'].includes(process.env.ENCORE_TEST?.trim() ?? '');
|
|
9
|
+
const testMode = process.env.NODE_ENV === 'test' && !optedOut;
|
|
10
|
+
/**
|
|
11
|
+
* Whether a test runner runs the process: vitest, jest and bun set
|
|
12
|
+
* `NODE_ENV=test`, vitest `VITEST` too, and `node --test` starts each file's
|
|
13
|
+
* process with `NODE_TEST_CONTEXT`. A runner adapter of
|
|
14
|
+
* `@encore.dev/sdk/testing` says so for a runner that sets none of them. The
|
|
15
|
+
* core then runs the process as a test, unless its environment says
|
|
16
|
+
* otherwise (`ENCORE_TEST=0`, a runtime config).
|
|
17
|
+
*/
|
|
18
|
+
const testRunner = testMode ||
|
|
19
|
+
!!process.env.VITEST ||
|
|
20
|
+
!!process.env.NODE_TEST_CONTEXT ||
|
|
21
|
+
globalThis[Symbol.for('encore.testRunner')] ===
|
|
22
|
+
true;
|
|
7
23
|
setRuntimeLogHandler(printRuntimeLine);
|
|
8
24
|
export const RT = new Runtime({
|
|
9
25
|
testMode,
|
|
26
|
+
testRunner,
|
|
10
27
|
typeConstructors: {
|
|
11
28
|
decimal: (val) => new Decimal(val),
|
|
12
29
|
},
|
|
13
30
|
});
|
|
31
|
+
/** Each test's infrastructure: null outside test mode. */
|
|
32
|
+
export const TEST_SCOPES = RT.testScopes();
|
|
33
|
+
if (TEST_SCOPES !== null) {
|
|
34
|
+
// What the app's .env files set, which `encore test` would have started
|
|
35
|
+
// the process with: the variables it lacks.
|
|
36
|
+
for (const [name, value] of Object.entries(RT.testDotenv())) {
|
|
37
|
+
if (process.env[name] === undefined)
|
|
38
|
+
process.env[name] = value;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
14
41
|
setShutdownRuntime(RT);
|
|
15
|
-
|
|
42
|
+
// How each Request Context field travels, as the app declares it.
|
|
43
|
+
setDeclaredLookup(name => RT.reqctxField(name));
|
|
44
|
+
if (!testMode && TEST_SCOPES === null)
|
|
16
45
|
watchShutdownSignals();
|
|
17
46
|
export { runUntilShutdown } from './shutdown.js';
|
|
18
47
|
let cached = null;
|
|
@@ -21,6 +50,7 @@ export function runtimeConfig() {
|
|
|
21
50
|
const cfg = RT.runtimeConfig();
|
|
22
51
|
cached = {
|
|
23
52
|
currentService: cfg.currentService,
|
|
53
|
+
currentWorker: cfg.currentWorker ?? undefined,
|
|
24
54
|
services: cfg.services ?? {},
|
|
25
55
|
};
|
|
26
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.js","sourceRoot":"","sources":["../../../internal/runtime/mod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAC,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAC,kBAAkB,EAAE,oBAAoB,EAAC,MAAM,YAAY,CAAC;AACpE,OAAO,EAAC,OAAO,EAAE,oBAAoB,EAAC,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"mod.js","sourceRoot":"","sources":["../../../internal/runtime/mod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAC,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAC,kB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