@encore.dev/sdk 2.0.0-beta.8 → 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 +54 -0
- package/app_meta.test.ts +25 -5
- package/app_meta.ts +43 -12
- package/config/config.test.ts +8 -12
- package/config/config.ts +16 -12
- package/config/secrets.ts +19 -10
- package/config/value.ts +13 -17
- package/cron/mod.test.ts +52 -0
- package/cron/mod.ts +9 -2
- package/dist/app_meta.d.ts +37 -12
- package/dist/app_meta.d.ts.map +1 -1
- package/dist/app_meta.js +1 -0
- package/dist/app_meta.js.map +1 -1
- package/dist/config/config.d.ts +16 -12
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/config.js +5 -2
- package/dist/config/config.js.map +1 -1
- package/dist/config/secrets.d.ts +19 -10
- package/dist/config/secrets.d.ts.map +1 -1
- package/dist/config/secrets.js +19 -10
- package/dist/config/secrets.js.map +1 -1
- package/dist/config/value.d.ts +7 -5
- package/dist/config/value.d.ts.map +1 -1
- package/dist/config/value.js +10 -7
- package/dist/config/value.js.map +1 -1
- package/dist/cron/mod.d.ts +5 -1
- package/dist/cron/mod.d.ts.map +1 -1
- package/dist/cron/mod.js +8 -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/mod.d.ts +3 -2
- package/dist/gateway/mod.d.ts.map +1 -1
- package/dist/gateway/mod.js +3 -2
- package/dist/gateway/mod.js.map +1 -1
- 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/fetch.d.ts +4 -0
- package/dist/internal/fetch.d.ts.map +1 -1
- package/dist/internal/fetch.js +12 -1
- package/dist/internal/fetch.js.map +1 -1
- 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 +1 -1
- package/dist/internal/otel/index.d.ts.map +1 -1
- package/dist/internal/otel/index.js +1 -1
- package/dist/internal/otel/index.js.map +1 -1
- package/dist/internal/otel/provider.d.ts +3 -0
- package/dist/internal/otel/provider.d.ts.map +1 -1
- package/dist/internal/otel/provider.js +3 -0
- package/dist/internal/otel/provider.js.map +1 -1
- package/dist/internal/otel/span.d.ts +11 -1
- package/dist/internal/otel/span.d.ts.map +1 -1
- package/dist/internal/otel/span.js +25 -2
- package/dist/internal/otel/span.js.map +1 -1
- package/dist/internal/reqfields.d.ts +26 -6
- package/dist/internal/reqfields.d.ts.map +1 -1
- package/dist/internal/reqfields.js +44 -7
- package/dist/internal/reqfields.js.map +1 -1
- package/dist/internal/runtime/napi/napi.cjs +36 -4
- package/dist/internal/runtime/napi/napi.d.cts +99 -4
- 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/scope.d.ts +34 -6
- package/dist/internal/testing/scope.d.ts.map +1 -1
- package/dist/internal/testing/scope.js +103 -5
- package/dist/internal/testing/scope.js.map +1 -1
- 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/mod.d.ts +1 -1
- package/dist/mod.d.ts.map +1 -1
- package/dist/mod.js.map +1 -1
- package/dist/pubsub/mod.d.ts +1 -1
- package/dist/pubsub/mod.d.ts.map +1 -1
- package/dist/pubsub/subscription.d.ts +6 -5
- package/dist/pubsub/subscription.d.ts.map +1 -1
- package/dist/pubsub/subscription.js.map +1 -1
- package/dist/pubsub/topic.d.ts +14 -8
- package/dist/pubsub/topic.d.ts.map +1 -1
- package/dist/pubsub/topic.js +36 -22
- package/dist/pubsub/topic.js.map +1 -1
- package/dist/reqctx/mod.d.ts +1 -18
- package/dist/reqctx/mod.d.ts.map +1 -1
- package/dist/reqctx/mod.js +1 -17
- package/dist/reqctx/mod.js.map +1 -1
- package/dist/services/index.d.ts +2 -1
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +2 -1
- package/dist/services/index.js.map +1 -1
- package/dist/storage/objects/bucket.d.ts +2 -1
- package/dist/storage/objects/bucket.d.ts.map +1 -1
- package/dist/storage/objects/bucket.js +2 -1
- package/dist/storage/objects/bucket.js.map +1 -1
- package/dist/storage/postgres/database.d.ts +5 -1
- package/dist/storage/postgres/database.d.ts.map +1 -1
- package/dist/storage/postgres/database.js +7 -3
- package/dist/storage/postgres/database.js.map +1 -1
- package/dist/storage/redis/commands.d.ts +5 -5
- package/dist/storage/redis/commands.d.ts.map +1 -1
- package/dist/storage/redis/commands.js +5 -5
- package/dist/storage/redis/commands.js.map +1 -1
- package/dist/testing/mod.d.ts +28 -5
- package/dist/testing/mod.d.ts.map +1 -1
- package/dist/testing/mod.js +52 -8
- package/dist/testing/mod.js.map +1 -1
- 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/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 +1 -0
- package/dist/tracing/mod.d.ts.map +1 -1
- package/dist/tracing/mod.js +1 -0
- package/dist/tracing/mod.js.map +1 -1
- 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/frontends/mod.test.ts +51 -0
- package/frontends/mod.ts +50 -0
- package/gateway/mod.ts +3 -2
- package/gateways/mod.ts +60 -0
- package/internal/fetch.ts +12 -1
- package/internal/otel/http.ts +91 -0
- package/internal/otel/index.ts +1 -1
- package/internal/otel/provider.ts +3 -0
- package/internal/otel/span.ts +25 -2
- package/internal/reqfields.ts +43 -10
- package/internal/runtime/napi/napi.cjs +36 -4
- package/internal/runtime/napi/napi.d.cts +99 -4
- package/internal/testing/carry.test.ts +242 -0
- package/internal/testing/carry.ts +101 -0
- package/internal/testing/scope.ts +106 -7
- 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/mod.ts +1 -0
- package/package.json +26 -1
- package/pubsub/mod.ts +6 -1
- package/pubsub/pubsub.test.ts +1 -0
- package/pubsub/subscription.ts +6 -5
- package/pubsub/topic.ts +45 -21
- package/reqctx/mod.ts +1 -18
- package/reqctx/reqctx.test.ts +23 -0
- package/scripts/postprocess-docs.test.ts +11 -1
- package/services/index.ts +2 -1
- package/storage/objects/bucket.ts +2 -1
- package/storage/postgres/database.ts +7 -3
- package/storage/redis/commands.ts +5 -5
- package/testing/mod.ts +63 -7
- 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/tracing/http.ts +49 -0
- package/tracing/mod.ts +1 -0
- package/tracing/native.test.ts +101 -4
- package/tracing/node.ts +176 -0
- package/tracing/tracing.test.ts +660 -24
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../config/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAC,WAAW,EAAE,QAAQ,EAAa,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAAC,aAAa,EAAC,MAAM,WAAW,CAAC;AACxC,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../config/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAC,WAAW,EAAE,QAAQ,EAAa,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAAC,aAAa,EAAC,MAAM,WAAW,CAAC;AACxC,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAC;AAmFjC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,MAAM,CACpB,IAAY;AACZ,sEAAsE;AACtE,8DAA8D;AAC9D,6DAA6D;AAC7D,IAAoB;IAEpB,MAAM,MAAM,GAAG,UAAU,CAAI,IAAI,EAAE,OAAO,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5D,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACxB,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,gDAAgD;AAChD,MAAM,KAAK,GAAG,IAAI,OAAO,EAAuB,CAAC;AAEjD;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAI,KAAY,EAAE,GAAc,EAAE,KAAQ;IACpE,MA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,KAAK,EAAE,IAAI,EAAC,CAAC,CAAC;IACrD,MAAM,CAAC,QAAQ,GAAG,CAAC,QAA4B,EAAE,EAAE;QACjD,IAAI,IAAI,KAAK,IAAI;YAAE,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;QACnC,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;YACrC,qEAAqE;YACrE,yBAAyB;YACzB,IAAI,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC,QAAQ,EAAE;gBAAE,OAAO;YAC9C,uEAAuE;YACvE,YAAY;YACZ,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;QACH,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACnB,OAAO,GAAG,EAAE;YACV,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;gBAAE,KAAK,CAAC,IAAI,EAAE,CAAC;QAC1C,CAAC,CAAC;IACJ,CAAC,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/config/secrets.d.ts
CHANGED
|
@@ -90,18 +90,27 @@ export interface SecretOptions {
|
|
|
90
90
|
* A doc comment on the declaration, or a `description` option, is shown
|
|
91
91
|
* wherever the secret's values are managed.
|
|
92
92
|
*
|
|
93
|
-
* @example
|
|
94
|
-
*
|
|
95
|
-
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```ts
|
|
95
|
+
* // Loading a single secret.
|
|
96
|
+
* import {secret} from "@encore.dev/sdk/config";
|
|
97
|
+
* const foo = secret("foo");
|
|
98
|
+
* ```
|
|
96
99
|
*
|
|
97
|
-
* @example
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```ts
|
|
102
|
+
* // A secret several services share.
|
|
103
|
+
* import {secret} from "@encore.dev/sdk/config";
|
|
104
|
+
* const signingKey = secret("SigningKey", {scope: "shared"});
|
|
105
|
+
* ```
|
|
100
106
|
*
|
|
101
|
-
* @example
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```ts
|
|
109
|
+
* // Documenting it.
|
|
110
|
+
* const apiKey = secret("ApiKey", {
|
|
111
|
+
* description: "Issued by Acme Pay. Rotate it in their portal under Settings → API.",
|
|
112
|
+
* });
|
|
113
|
+
* ```
|
|
105
114
|
*/
|
|
106
115
|
export declare function secret<Name extends string>(name: StringLiteral<Name>, opts?: SecretOptions): Secret<Name>;
|
|
107
116
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secrets.d.ts","sourceRoot":"","sources":["../../config/secrets.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,aAAa,EAAC,MAAM,+BAA+B,CAAC;AAE5D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,MAAM,CAAC,IAAI,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM;IACpE;;;;;;;;OAQG;IACH,IAAI,CAAC,CAAC;IAEN;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IAEpB;;;;;;;;OAQG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,IAAI,CAAC;CAClC;AAED;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;AAEvC;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;;;;;;;;;;;;;;OAiBG;IACH,KAAK,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAExC;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B;AAED
|
|
1
|
+
{"version":3,"file":"secrets.d.ts","sourceRoot":"","sources":["../../config/secrets.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,aAAa,EAAC,MAAM,+BAA+B,CAAC;AAE5D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,MAAM,CAAC,IAAI,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM;IACpE;;;;;;;;OAQG;IACH,IAAI,CAAC,CAAC;IAEN;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IAEpB;;;;;;;;OAQG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,IAAI,CAAC;CAClC;AAED;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;AAEvC;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;;;;;;;;;;;;;;OAiBG;IACH,KAAK,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAExC;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,MAAM,CAAC,IAAI,SAAS,MAAM,EACxC,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC,EAIzB,IAAI,CAAC,EAAE,aAAa,GACnB,MAAM,CAAC,IAAI,CAAC,CAEd;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAErD"}
|
package/dist/config/secrets.js
CHANGED
|
@@ -7,18 +7,27 @@ import { lookupScope, testMode } from '../internal/testing/scope.js';
|
|
|
7
7
|
* A doc comment on the declaration, or a `description` option, is shown
|
|
8
8
|
* wherever the secret's values are managed.
|
|
9
9
|
*
|
|
10
|
-
* @example
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* // Loading a single secret.
|
|
13
|
+
* import {secret} from "@encore.dev/sdk/config";
|
|
14
|
+
* const foo = secret("foo");
|
|
15
|
+
* ```
|
|
13
16
|
*
|
|
14
|
-
* @example
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* // A secret several services share.
|
|
20
|
+
* import {secret} from "@encore.dev/sdk/config";
|
|
21
|
+
* const signingKey = secret("SigningKey", {scope: "shared"});
|
|
22
|
+
* ```
|
|
17
23
|
*
|
|
18
|
-
* @example
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* // Documenting it.
|
|
27
|
+
* const apiKey = secret("ApiKey", {
|
|
28
|
+
* description: "Issued by Acme Pay. Rotate it in their portal under Settings → API.",
|
|
29
|
+
* });
|
|
30
|
+
* ```
|
|
22
31
|
*/
|
|
23
32
|
export function secret(name,
|
|
24
33
|
// The options are Encore's parser's to read: a secret is read by name
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secrets.js","sourceRoot":"","sources":["../../config/secrets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAC,WAAW,EAAE,QAAQ,EAAC,MAAM,2BAA2B,CAAC;AA8FhE
|
|
1
|
+
{"version":3,"file":"secrets.js","sourceRoot":"","sources":["../../config/secrets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAC,WAAW,EAAE,QAAQ,EAAC,MAAM,2BAA2B,CAAC;AA8FhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,UAAU,MAAM,CACpB,IAAyB;AACzB,sEAAsE;AACtE,8DAA8D;AAC9D,6DAA6D;AAC7D,IAAoB;IAEpB,OAAO,UAAU,CAAe,IAAI,EAAE,OAAO,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;AACjE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,OAAO,UAAU,CAAY,IAAI,EAAE,OAAO,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;AAC9D,CAAC;AAED;;;GAGG;AACH,SAAS,UAAU,CACjB,IAAY,EACZ,IAA0C;IAE1C,MAAM,SAAS,GAAG,GAAG,EAAE;QACrB,iDAAiD;QACjD,MAAM,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC,WAAW,EAAE,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACtE,IAAI,QAAQ,IAAI,IAAI;YAAE,OAAO,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACvD,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,UAAU,IAAI,aAAa,CAAC,CAAC;QAC/C,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;IACvB,CAAC,CAAC;IAEF,SAAS,CAAC,QAAQ,GAAG,GAAG,EAAE;QACxB,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;YAClB,OAAO,UAAU,IAAI,YAAY,CAAC;QACpC,CAAC;QACD,OAAO,UAAU,IAAI,cAAc,CAAC;IACtC,CAAC,CAAC;IACF,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,EAAC,KAAK,EAAE,IAAI,EAAC,CAAC,CAAC;IAExD,OAAO,SAAyB,CAAC;AACnC,CAAC"}
|
package/dist/config/value.d.ts
CHANGED
|
@@ -34,12 +34,14 @@ export declare class Duration {
|
|
|
34
34
|
toString(): string;
|
|
35
35
|
toJSON(): string;
|
|
36
36
|
}
|
|
37
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* The key of the runtime's placeholder for a secret field:
|
|
39
|
+
* `{"$encore_secret": "<name>"}`. The name alone says which secret it is: a
|
|
40
|
+
* secret's name has one scope across the app.
|
|
41
|
+
*/
|
|
38
42
|
export declare const PLACEHOLDER_KEY = "$encore_secret";
|
|
39
|
-
/**
|
|
40
|
-
export type
|
|
41
|
-
/** Builds the secret a placeholder stands for. */
|
|
42
|
-
export type SecretOf = (name: string, scope: SecretScope) => unknown;
|
|
43
|
+
/** Builds the secret a placeholder stands for, by its name. */
|
|
44
|
+
export type SecretOf = (name: string) => unknown;
|
|
43
45
|
type Schema = Record<string, any>;
|
|
44
46
|
/**
|
|
45
47
|
* `value`, as the declared type has it: the JSON the runtime hands over, with
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"value.d.ts","sourceRoot":"","sources":["../../config/value.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAcH;;;;;;;;GAQG;AACH,qBAAa,QAAQ;IACnB;;;OAGG;IACH,SAAiB,kBAAkB,CAAC,EAAE,IAAI,CAAC;IAE3C,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAS;IAE5B,OAAO;IAIP,wDAAwD;IACxD,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ;IAgBpC,uCAAuC;IACvC,MAAM,CAAC,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,QAAQ;IAO3C,6DAA6D;IAC7D,IAAI,YAAY,IAAI,MAAM,CAEzB;IAED,+BAA+B;IAC/B,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,gEAAgE;IAChE,QAAQ,IAAI,MAAM;IAsBlB,MAAM,IAAI,MAAM;CAGjB;AAED
|
|
1
|
+
{"version":3,"file":"value.d.ts","sourceRoot":"","sources":["../../config/value.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAcH;;;;;;;;GAQG;AACH,qBAAa,QAAQ;IACnB;;;OAGG;IACH,SAAiB,kBAAkB,CAAC,EAAE,IAAI,CAAC;IAE3C,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAS;IAE5B,OAAO;IAIP,wDAAwD;IACxD,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ;IAgBpC,uCAAuC;IACvC,MAAM,CAAC,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,QAAQ;IAO3C,6DAA6D;IAC7D,IAAI,YAAY,IAAI,MAAM,CAEzB;IAED,+BAA+B;IAC/B,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,gEAAgE;IAChE,QAAQ,IAAI,MAAM;IAsBlB,MAAM,IAAI,MAAM;CAGjB;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,mBAAmB,CAAC;AAEhD,+DAA+D;AAC/D,MAAM,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;AAEjD,KAAK,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAElC;;;;;GAKG;AACH,wBAAgB,KAAK,CACnB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,OAAO,EACd,QAAQ,EAAE,QAAQ,GACjB,OAAO,CAET"}
|
package/dist/config/value.js
CHANGED
|
@@ -84,7 +84,11 @@ export class Duration {
|
|
|
84
84
|
return this.toString();
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
/**
|
|
87
|
+
/**
|
|
88
|
+
* The key of the runtime's placeholder for a secret field:
|
|
89
|
+
* `{"$encore_secret": "<name>"}`. The name alone says which secret it is: a
|
|
90
|
+
* secret's name has one scope across the app.
|
|
91
|
+
*/
|
|
88
92
|
export const PLACEHOLDER_KEY = '$encore_secret';
|
|
89
93
|
/**
|
|
90
94
|
* `value`, as the declared type has it: the JSON the runtime hands over, with
|
|
@@ -114,15 +118,14 @@ function convert(root, schema, value, secretOf, depth) {
|
|
|
114
118
|
schema = resolve(root, schema);
|
|
115
119
|
// Only a field the schema says reads a secret is one: anywhere else, a
|
|
116
120
|
// value shaped like a placeholder is just data, and must not reach a secret.
|
|
121
|
+
// The keyword is the secret's name: its scope is the config's.
|
|
117
122
|
const secret = schema['x-encore-secret'];
|
|
118
|
-
if (secret) {
|
|
119
|
-
if (!isPlaceholder(value) ||
|
|
120
|
-
value[PLACEHOLDER_KEY].name !== secret.name ||
|
|
121
|
-
value[PLACEHOLDER_KEY].scope !== secret.scope) {
|
|
123
|
+
if (typeof secret === 'string') {
|
|
124
|
+
if (!isPlaceholder(value) || value[PLACEHOLDER_KEY] !== secret) {
|
|
122
125
|
// Never say what the value is: it may be a pasted secret.
|
|
123
|
-
throw new Error(`a secret field reads the secret ${secret
|
|
126
|
+
throw new Error(`a secret field reads the secret ${secret}, and is not set in config`);
|
|
124
127
|
}
|
|
125
|
-
return secretOf(secret
|
|
128
|
+
return secretOf(secret);
|
|
126
129
|
}
|
|
127
130
|
if (schema['x-encore-format'] === 'duration' && typeof value === 'string') {
|
|
128
131
|
return Duration.parse(value);
|
package/dist/config/value.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"value.js","sourceRoot":"","sources":["../../config/value.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,gFAAgF;AAChF,MAAM,QAAQ,GAAG,2CAA2C,CAAC;AAC7D,MAAM,OAAO,GAA2B;IACtC,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,CAAC;IACL,CAAC,EAAE,IAAI;IACP,CAAC,EAAE,KAAM;IACT,CAAC,EAAE,OAAS;CACb,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,OAAO,QAAQ;IAOF,EAAE,CAAS;IAE5B,YAAoB,EAAU;QAC5B,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,CAAC;IAED,wDAAwD;IACxD,MAAM,CAAC,KAAK,CAAC,IAAY;QACvB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CACb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AAe,CAAC;AAC1D,CAAC"}
|
package/dist/cron/mod.d.ts
CHANGED
|
@@ -24,7 +24,11 @@ export declare const IDEMPOTENCY_KEY_HEADER = "x-encore-cron-execution";
|
|
|
24
24
|
export declare const TRIGGER_HEADER = "x-encore-cron-trigger";
|
|
25
25
|
export declare class CronJob {
|
|
26
26
|
readonly name: string;
|
|
27
|
-
|
|
27
|
+
/**
|
|
28
|
+
* What the job was declared with. Read-only: Encore schedules the job from
|
|
29
|
+
* the declaration in the source, so a changed path would not be requested.
|
|
30
|
+
*/
|
|
31
|
+
readonly cfg: Readonly<CronJobConfig>;
|
|
28
32
|
constructor(name: string, cfg: CronJobConfig);
|
|
29
33
|
}
|
|
30
34
|
/**
|
package/dist/cron/mod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../cron/mod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,cAAc,CAAC;AAE5C;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,sBAAsB,4BAA4B,CAAC;AAEhE;;;GAGG;AACH,eAAO,MAAM,cAAc,0BAA0B,CAAC;AAEtD,qBAAa,OAAO;IAClB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../cron/mod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,cAAc,CAAC;AAE5C;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,sBAAsB,4BAA4B,CAAC;AAEhE;;;GAGG;AACH,eAAO,MAAM,cAAc,0BAA0B,CAAC;AAEtD,qBAAa,OAAO;IAClB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,QAAQ,CAAC,GAAG,EAAE,QAAQ,CAAC,aAAa,CAAC,CAAC;gBAC1B,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,aAAa;CAO7C;AAED;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,mEAAmE;IACnE,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B,GAAG,CAAC;IAAC,KAAK,EAAE,cAAc,CAAA;CAAC,GAAG;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAC,CAAC,CAAC"}
|
package/dist/cron/mod.js
CHANGED
|
@@ -23,10 +23,17 @@ export const IDEMPOTENCY_KEY_HEADER = 'x-encore-cron-execution';
|
|
|
23
23
|
export const TRIGGER_HEADER = 'x-encore-cron-trigger';
|
|
24
24
|
export class CronJob {
|
|
25
25
|
name;
|
|
26
|
+
/**
|
|
27
|
+
* What the job was declared with. Read-only: Encore schedules the job from
|
|
28
|
+
* the declaration in the source, so a changed path would not be requested.
|
|
29
|
+
*/
|
|
26
30
|
cfg;
|
|
27
31
|
constructor(name, cfg) {
|
|
28
32
|
this.name = name;
|
|
29
|
-
|
|
33
|
+
// Frozen as well as typed `readonly`, so a write throws in an app that
|
|
34
|
+
// runs without `tsc` checking it.
|
|
35
|
+
this.cfg = Object.freeze({ ...cfg });
|
|
36
|
+
Object.freeze(this);
|
|
30
37
|
}
|
|
31
38
|
}
|
|
32
39
|
//# sourceMappingURL=mod.js.map
|
package/dist/cron/mod.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.js","sourceRoot":"","sources":["../../cron/mod.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,yBAAyB,CAAC;AAEhE;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,uBAAuB,CAAC;AAEtD,MAAM,OAAO,OAAO;IACT,IAAI,CAAS;
|
|
1
|
+
{"version":3,"file":"mod.js","sourceRoot":"","sources":["../../cron/mod.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,yBAAyB,CAAC;AAEhE;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,uBAAuB,CAAC;AAEtD,MAAM,OAAO,OAAO;IACT,IAAI,CAAS;IACtB;;;OAGG;IACM,GAAG,CAA0B;IACtC,YAAY,IAAY,EAAE,GAAkB;QAC1C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,uEAAuE;QACvE,kCAAkC;QAClC,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,EAAC,GAAG,GAAG,EAAC,CAAC,CAAC;QACnC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC;CACF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the app's frontends are reached.
|
|
3
|
+
*
|
|
4
|
+
* {@link url} is a frontend's URL in the environment the code runs in, as to
|
|
5
|
+
* send a user there or to build a link to one of its pages:
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* import * as frontends from '@encore.dev/sdk/frontends';
|
|
9
|
+
*
|
|
10
|
+
* const reset = `${frontends.url('web')}/reset?token=${token}`;
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* Looking a frontend's URL up links the calling service to it. Encore reads
|
|
14
|
+
* the link from the code, as it reads which services a service depends on: so
|
|
15
|
+
* the name must be a string literal, written as the frontend declares it, the
|
|
16
|
+
* function must be called directly rather than passed around, and the call
|
|
17
|
+
* must be in a service.
|
|
18
|
+
*
|
|
19
|
+
* @module
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* The URL `frontend` is reached at in this environment, without a trailing
|
|
23
|
+
* slash: a path goes after it, `` `${url("web")}/reset` ``. It is the first of
|
|
24
|
+
* the frontend's origins, as {@link appMeta} lists them.
|
|
25
|
+
*
|
|
26
|
+
* The name is the one the frontend is declared with, in its
|
|
27
|
+
* `encore.frontend.json` or as the service hosting it: `web_app` does not find
|
|
28
|
+
* `web-app`.
|
|
29
|
+
*
|
|
30
|
+
* Throws if the runtime knows no URL for `frontend`: the app has no frontend of
|
|
31
|
+
* that name, which Encore's parser reports, or the environment gives it no
|
|
32
|
+
* origins.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* import {url} from "@encore.dev/sdk/frontends";
|
|
36
|
+
* const home = url("web");
|
|
37
|
+
*/
|
|
38
|
+
export declare function url(frontend: string): string;
|
|
39
|
+
//# sourceMappingURL=mod.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../frontends/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAS5C"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the app's frontends are reached.
|
|
3
|
+
*
|
|
4
|
+
* {@link url} is a frontend's URL in the environment the code runs in, as to
|
|
5
|
+
* send a user there or to build a link to one of its pages:
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* import * as frontends from '@encore.dev/sdk/frontends';
|
|
9
|
+
*
|
|
10
|
+
* const reset = `${frontends.url('web')}/reset?token=${token}`;
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* Looking a frontend's URL up links the calling service to it. Encore reads
|
|
14
|
+
* the link from the code, as it reads which services a service depends on: so
|
|
15
|
+
* the name must be a string literal, written as the frontend declares it, the
|
|
16
|
+
* function must be called directly rather than passed around, and the call
|
|
17
|
+
* must be in a service.
|
|
18
|
+
*
|
|
19
|
+
* @module
|
|
20
|
+
*/
|
|
21
|
+
import { appMeta } from '../app_meta.js';
|
|
22
|
+
/**
|
|
23
|
+
* The URL `frontend` is reached at in this environment, without a trailing
|
|
24
|
+
* slash: a path goes after it, `` `${url("web")}/reset` ``. It is the first of
|
|
25
|
+
* the frontend's origins, as {@link appMeta} lists them.
|
|
26
|
+
*
|
|
27
|
+
* The name is the one the frontend is declared with, in its
|
|
28
|
+
* `encore.frontend.json` or as the service hosting it: `web_app` does not find
|
|
29
|
+
* `web-app`.
|
|
30
|
+
*
|
|
31
|
+
* Throws if the runtime knows no URL for `frontend`: the app has no frontend of
|
|
32
|
+
* that name, which Encore's parser reports, or the environment gives it no
|
|
33
|
+
* origins.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* import {url} from "@encore.dev/sdk/frontends";
|
|
37
|
+
* const home = url("web");
|
|
38
|
+
*/
|
|
39
|
+
export function url(frontend) {
|
|
40
|
+
const found = appMeta().frontends[frontend]?.origins[0]?.replace(/\/+$/, '');
|
|
41
|
+
if (!found) {
|
|
42
|
+
throw new Error(`encore: no URL is known for frontend ${JSON.stringify(frontend)}: the app has no ` +
|
|
43
|
+
'frontend of that name, or the environment gives it no origins');
|
|
44
|
+
}
|
|
45
|
+
return found;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=mod.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.js","sourceRoot":"","sources":["../../frontends/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAC,OAAO,EAAC,MAAM,aAAa,CAAC;AAEpC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,GAAG,CAAC,QAAgB;IAClC,MAAM,KAAK,GAAG,OAAO,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC7E,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CACb,wCAAwC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,mBAAmB;YACjF,+DAA+D,CAClE,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/gateway/mod.d.ts
CHANGED
|
@@ -61,8 +61,9 @@
|
|
|
61
61
|
* only as the hook reads it.
|
|
62
62
|
*
|
|
63
63
|
* Middleware see only public requests the gateway routes: calls between
|
|
64
|
-
* services, Pub/Sub pushes
|
|
65
|
-
*
|
|
64
|
+
* services, Pub/Sub pushes and requests for paths the gateway does not
|
|
65
|
+
* expose are Encore's alone, and so are CORS preflights, but for a gateway
|
|
66
|
+
* whose CORS is off (`"cors": false`), which routes them as any request.
|
|
66
67
|
*
|
|
67
68
|
* ## Answering a request
|
|
68
69
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../gateway/mod.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../gateway/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyGG;AAOH,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AAS7C,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,YAAY,EAAC,IAAI,EAAE,OAAO,EAAC,MAAM,SAAS,CAAC;AAC3C,OAAO,EACL,OAAO,EACP,YAAY,EACZ,SAAS,EACT,UAAU,EACV,MAAM,EACN,OAAO,EACP,KAAK,OAAO,GACb,MAAM,UAAU,CAAC;AAClB,OAAO,EAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAC,MAAM,WAAW,CAAC;AAClD,YAAY,EAAC,cAAc,EAAE,SAAS,EAAE,KAAK,EAAC,MAAM,WAAW,CAAC;AAChE,YAAY,EAAC,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAC,MAAM,cAAc,CAAC;AAkBpE;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,KAAK,CAAC,GAAG,UAAU,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA2CtE"}
|
package/dist/gateway/mod.js
CHANGED
|
@@ -61,8 +61,9 @@
|
|
|
61
61
|
* only as the hook reads it.
|
|
62
62
|
*
|
|
63
63
|
* Middleware see only public requests the gateway routes: calls between
|
|
64
|
-
* services, Pub/Sub pushes
|
|
65
|
-
*
|
|
64
|
+
* services, Pub/Sub pushes and requests for paths the gateway does not
|
|
65
|
+
* expose are Encore's alone, and so are CORS preflights, but for a gateway
|
|
66
|
+
* whose CORS is off (`"cors": false`), which routes them as any request.
|
|
66
67
|
*
|
|
67
68
|
* ## Answering a request
|
|
68
69
|
*
|
package/dist/gateway/mod.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.js","sourceRoot":"","sources":["../../gateway/mod.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"mod.js","sourceRoot":"","sources":["../../gateway/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyGG;AAEH,OAAO,EAAC,EAAE,EAAC,MAAM,yBAAyB,CAAC;AAC3C,OAAO,KAAK,IAAI,MAAM,mCAAmC,CAAC;AAC1D,OAAO,EAAC,oBAAoB,EAAE,IAAI,EAAC,MAAM,8BAA8B,CAAC;AACxE,OAAO,GAAG,MAAM,QAAQ,CAAC;AACzB,OAAO,EAAC,YAAY,EAAC,MAAM,UAAU,CAAC;AAEtC,OAAO,EACL,KAAK,EAC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in the environment the code runs in, as to
|
|
5
|
+
* hand a client outside the app the address of its API:
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* import * as gateways from '@encore.dev/sdk/gateways';
|
|
9
|
+
*
|
|
10
|
+
* const callback = `${gateways.url('api')}/webhooks/stripe`;
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* A service calls the app's other services with `@encore.dev/sdk/services`,
|
|
14
|
+
* not through a gateway. A gateway's middleware is `@encore.dev/sdk/gateway`'s.
|
|
15
|
+
*
|
|
16
|
+
* Looking a gateway's URL up links the calling service to it. Encore reads the
|
|
17
|
+
* link from the code, as it reads which services a service depends on: so the
|
|
18
|
+
* name must be a string literal, written as the gateway declares it, the
|
|
19
|
+
* function must be called directly rather than passed around, and the call
|
|
20
|
+
* must be in a service.
|
|
21
|
+
*
|
|
22
|
+
* @module
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* The URL `gateway` is reached at in this environment, without a trailing
|
|
26
|
+
* slash: a path goes after it, `` `${url("api")}/webhooks/stripe` ``. It is the
|
|
27
|
+
* first of the gateway's origins, as {@link appMeta} lists them.
|
|
28
|
+
*
|
|
29
|
+
* The name is the one the gateway is declared with, in its
|
|
30
|
+
* `encore.gateway.json` or as the service hosting it: `public_api` does not
|
|
31
|
+
* find `public-api`.
|
|
32
|
+
*
|
|
33
|
+
* Throws if the runtime knows no URL for `gateway`: the app has no gateway of
|
|
34
|
+
* that name, which Encore's parser reports, or the environment gives it no
|
|
35
|
+
* origins.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* import {url} from "@encore.dev/sdk/gateways";
|
|
39
|
+
* const api = url("api");
|
|
40
|
+
*/
|
|
41
|
+
export declare function url(gateway: string): string;
|
|
42
|
+
//# sourceMappingURL=mod.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../gateways/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAIH;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAgB3C"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the app's gateways are reached.
|
|
3
|
+
*
|
|
4
|
+
* {@link url} is a gateway's URL in the environment the code runs in, as to
|
|
5
|
+
* hand a client outside the app the address of its API:
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* import * as gateways from '@encore.dev/sdk/gateways';
|
|
9
|
+
*
|
|
10
|
+
* const callback = `${gateways.url('api')}/webhooks/stripe`;
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* A service calls the app's other services with `@encore.dev/sdk/services`,
|
|
14
|
+
* not through a gateway. A gateway's middleware is `@encore.dev/sdk/gateway`'s.
|
|
15
|
+
*
|
|
16
|
+
* Looking a gateway's URL up links the calling service to it. Encore reads the
|
|
17
|
+
* link from the code, as it reads which services a service depends on: so the
|
|
18
|
+
* name must be a string literal, written as the gateway declares it, the
|
|
19
|
+
* function must be called directly rather than passed around, and the call
|
|
20
|
+
* must be in a service.
|
|
21
|
+
*
|
|
22
|
+
* @module
|
|
23
|
+
*/
|
|
24
|
+
import { appMeta } from '../app_meta.js';
|
|
25
|
+
/**
|
|
26
|
+
* The URL `gateway` is reached at in this environment, without a trailing
|
|
27
|
+
* slash: a path goes after it, `` `${url("api")}/webhooks/stripe` ``. It is the
|
|
28
|
+
* first of the gateway's origins, as {@link appMeta} lists them.
|
|
29
|
+
*
|
|
30
|
+
* The name is the one the gateway is declared with, in its
|
|
31
|
+
* `encore.gateway.json` or as the service hosting it: `public_api` does not
|
|
32
|
+
* find `public-api`.
|
|
33
|
+
*
|
|
34
|
+
* Throws if the runtime knows no URL for `gateway`: the app has no gateway of
|
|
35
|
+
* that name, which Encore's parser reports, or the environment gives it no
|
|
36
|
+
* origins.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* import {url} from "@encore.dev/sdk/gateways";
|
|
40
|
+
* const api = url("api");
|
|
41
|
+
*/
|
|
42
|
+
export function url(gateway) {
|
|
43
|
+
const gw = appMeta().gateways[gateway];
|
|
44
|
+
if (gw === undefined) {
|
|
45
|
+
throw new Error(`encore: no URL is known for gateway ${JSON.stringify(gateway)}: the app has no ` +
|
|
46
|
+
'gateway of that name');
|
|
47
|
+
}
|
|
48
|
+
const found = gw.origins[0]?.replace(/\/+$/, '');
|
|
49
|
+
if (!found) {
|
|
50
|
+
throw new Error(`encore: no URL is known for gateway ${JSON.stringify(gateway)}: the environment ` +
|
|
51
|
+
'gives it no origins');
|
|
52
|
+
}
|
|
53
|
+
return found;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=mod.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.js","sourceRoot":"","sources":["../../gateways/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAC,OAAO,EAAC,MAAM,aAAa,CAAC;AAEpC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,GAAG,CAAC,OAAe;IACjC,MAAM,EAAE,GAAG,OAAO,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IACvC,IAAI,EAAE,KAAK,SAAS,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CACb,uCAAuC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,mBAAmB;YAC/E,sBAAsB,CACzB,CAAC;IACJ,CAAC;IACD,MAAM,KAAK,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACjD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CACb,uCAAuC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,oBAAoB;YAChF,qBAAqB,CACxB,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/internal/fetch.d.ts
CHANGED
|
@@ -22,6 +22,10 @@
|
|
|
22
22
|
* base URL `baseUrl`, `serviceUrl` or `client` of `@encore.dev/sdk/services`
|
|
23
23
|
* returned in this process, as every service URL is made from one.
|
|
24
24
|
*
|
|
25
|
+
* In a system test (`system` of `@encore.dev/sdk/testing`) a request also
|
|
26
|
+
* carries the test it is made for: the test's id, as a Request Context
|
|
27
|
+
* field, and the test's span where the context has none.
|
|
28
|
+
*
|
|
25
29
|
* A request made in a context with a trace or Request Context follows its
|
|
26
30
|
* redirects here, rather than in the global `fetch`, so that each is sent
|
|
27
31
|
* what its own URL is due: a redirect away from the app's services carries
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../internal/fetch.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../internal/fetch.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAQH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,KAAK,EAAE,OAAO,UAAU,CAAC,KAAmB,CAAC;AAE1D;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CACvB,IAAI,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,GAC7B,OAAO,UAAU,CAAC,KAAK,CAuBzB;AA4BD;;sBAEsB;AACtB,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAG/C"}
|
package/dist/internal/fetch.js
CHANGED
|
@@ -10,6 +10,7 @@ import { isSpanContextValid, trace } from '@opentelemetry/api';
|
|
|
10
10
|
import { activeContext } from './otel/context.js';
|
|
11
11
|
import { W3CPropagator } from './otel/propagator.js';
|
|
12
12
|
import * as reqfields from './reqfields.js';
|
|
13
|
+
import { outgoingContext, outgoingContextIfKnown } from './testing/carry.js';
|
|
13
14
|
/**
|
|
14
15
|
* The global `fetch`, carrying the trace and Request Context of the active
|
|
15
16
|
* context to the app's services.
|
|
@@ -26,6 +27,10 @@ import * as reqfields from './reqfields.js';
|
|
|
26
27
|
* base URL `baseUrl`, `serviceUrl` or `client` of `@encore.dev/sdk/services`
|
|
27
28
|
* returned in this process, as every service URL is made from one.
|
|
28
29
|
*
|
|
30
|
+
* In a system test (`system` of `@encore.dev/sdk/testing`) a request also
|
|
31
|
+
* carries the test it is made for: the test's id, as a Request Context
|
|
32
|
+
* field, and the test's span where the context has none.
|
|
33
|
+
*
|
|
29
34
|
* A request made in a context with a trace or Request Context follows its
|
|
30
35
|
* redirects here, rather than in the global `fetch`, so that each is sent
|
|
31
36
|
* what its own URL is due: a redirect away from the app's services carries
|
|
@@ -56,7 +61,13 @@ export function wrapFetch(base) {
|
|
|
56
61
|
const request = input instanceof Request ? input : undefined;
|
|
57
62
|
const url = request?.url ?? String(input);
|
|
58
63
|
const headers = new Headers(init?.headers ?? request?.headers);
|
|
59
|
-
|
|
64
|
+
// In a system test, the context with the test added: its calls carry
|
|
65
|
+
// the test's id, and continue its span where they have none. A call
|
|
66
|
+
// to a service whose test cannot be told is refused; one to anything
|
|
67
|
+
// else carries no test anyway.
|
|
68
|
+
const ctx = origins.has(originOf(url) ?? '')
|
|
69
|
+
? outgoingContext(activeContext())
|
|
70
|
+
: outgoingContextIfKnown(activeContext());
|
|
60
71
|
prepare(url, headers, ctx);
|
|
61
72
|
const redirect = init?.redirect ?? request?.redirect ?? 'follow';
|
|
62
73
|
if (!hasContext(ctx) || redirect !== 'follow') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../internal/fetch.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAC,kBAAkB,EAAE,KAAK,EAAe,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAC,aAAa,EAAC,MA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QACD,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC;QACzC,IACE,CAAC,CAAC,GAAG,CAAC,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,CAAC,IAAI,MAAM,KAAK,MAAM,CAAC;YACjE,CAAC,GAAG,CAAC,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,KAAK,IAAI,MAAM,KAAK,MAAM,CAAC,EAC7D,CAAC;YACD,MAAM,GAAG,KAAK,CAAC;YACf,IAAI,GAAG,IAAI,CAAC;YACZ,KAAK,MAAM,IAAI,IAAI,YAAY;gBAAE,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACxD,CAAC;aAAM,IAAI,IAAI,YAAY,cAAc,EAAE,CAAC;YAC1C,MAAM,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC;YACzB,MAAM,IAAI,SAAS,CACjB,4DAA4D,CAC7D,CAAC;QACJ,CAAC;QACD,IAAI,QAAQ,CAAC,IAAI,CAAC,KAAK,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACrC,KAAK,MAAM,IAAI,IAAI,kBAAkB;gBAAE,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC9D,CAAC;QACD,MAAM,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC;QACzB,GAAG,GAAG,IAAI,CAAC;QACX,OAAO,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;IAC7B,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { type Span, type TextMapGetter } from '@opentelemetry/api';
|
|
3
|
+
import { type HeaderSource } from '../../reqctx/mod.js';
|
|
4
|
+
export declare function startHTTPSpan<Headers extends HeaderSource>(headers: Headers, getter: TextMapGetter<Headers>, requestMethod: string, url: URL): {
|
|
5
|
+
span: Span;
|
|
6
|
+
context: import("@opentelemetry/api").Context;
|
|
7
|
+
};
|
|
8
|
+
export declare function recordHTTPStatus(span: Span, status: number): void;
|
|
9
|
+
export declare function recordHTTPError(span: Span, error: unknown): void;
|
|
10
|
+
export declare function recordHTTPConnectionClosed(span: Span): void;
|
|
11
|
+
//# sourceMappingURL=http.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../../internal/otel/http.ts"],"names":[],"mappings":";AAAA,OAAO,EAML,KAAK,IAAI,EACT,KAAK,aAAa,EACnB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAU,KAAK,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAgB5D,wBAAgB,aAAa,CAAC,OAAO,SAAS,YAAY,EACxD,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,aAAa,CAAC,OAAO,CAAC,EAC9B,aAAa,EAAE,MAAM,EACrB,GAAG,EAAE,GAAG;;;EAiCT;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAMjE;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAYhE;AAED,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAG3D"}
|