@encore.dev/sdk 2.0.0-beta.10 → 2.0.0-beta.13
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/app_meta.test.ts +4 -4
- package/app_meta.ts +3 -3
- package/dist/app_meta.d.ts +3 -3
- package/dist/gateway/mod.d.ts +2 -2
- package/dist/gateway/mod.js +2 -2
- package/dist/internal/fetch.d.ts +5 -5
- package/dist/internal/fetch.d.ts.map +1 -1
- package/dist/internal/fetch.js +15 -8
- package/dist/internal/fetch.js.map +1 -1
- package/dist/internal/runtime/napi/napi.cjs +1 -1
- package/dist/internal/runtime/napi/napi.d.cts +17 -4
- package/dist/internal/runtime/shutdown.d.ts +5 -3
- package/dist/internal/runtime/shutdown.d.ts.map +1 -1
- package/dist/internal/runtime/shutdown.js +15 -5
- package/dist/internal/runtime/shutdown.js.map +1 -1
- package/dist/services/index.d.ts +2 -2
- package/dist/services/index.js +2 -2
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/gateway/mod.ts +2 -2
- package/internal/fetch.ts +22 -7
- package/internal/runtime/napi/napi.cjs +1 -1
- package/internal/runtime/napi/napi.d.cts +17 -4
- package/internal/runtime/shutdown.test.ts +260 -69
- package/internal/runtime/shutdown.ts +16 -5
- package/metrics/export.test.ts +9 -5
- package/otel.test.ts +11 -4
- package/package.json +2 -2
- package/pubsub/topic.test.ts +1 -1
- package/services/index.test.ts +24 -1
- package/services/index.ts +2 -2
- package/tracing/native.test.ts +8 -4
package/app_meta.test.ts
CHANGED
|
@@ -120,17 +120,17 @@ function runtimeConfig(): string {
|
|
|
120
120
|
...enumField(5, 1), // TYPE_DEVELOPMENT
|
|
121
121
|
...enumField(6, 4), // CLOUD_GCP
|
|
122
122
|
];
|
|
123
|
-
// Gateway{rid=1, encore_name=2, origins=
|
|
123
|
+
// Gateway{rid=1, encore_name=2, origins=7}
|
|
124
124
|
const api = [
|
|
125
125
|
...str(1, 'gw:api'),
|
|
126
126
|
...str(2, 'api'),
|
|
127
|
-
...str(
|
|
128
|
-
...str(
|
|
127
|
+
...str(7, 'https://api.example.com'),
|
|
128
|
+
...str(7, '*'),
|
|
129
129
|
];
|
|
130
130
|
const admin = [
|
|
131
131
|
...str(1, 'gw:admin'),
|
|
132
132
|
...str(2, 'admin'),
|
|
133
|
-
...str(
|
|
133
|
+
...str(7, 'https://admin.example.com'),
|
|
134
134
|
];
|
|
135
135
|
// Frontend{rid=1, encore_name=2, origins=3}
|
|
136
136
|
const web = [
|
package/app_meta.ts
CHANGED
|
@@ -4,7 +4,7 @@ import * as runtime from './internal/runtime/mod';
|
|
|
4
4
|
export interface AppMeta {
|
|
5
5
|
/**
|
|
6
6
|
* The Encore application ID. If the application is not linked to the Encore platform this will be an empty string.
|
|
7
|
-
* To link to the Encore platform run `encore
|
|
7
|
+
* To link to the Encore platform run `encore cloud link` from your terminal in the root directory of the Encore app.
|
|
8
8
|
*/
|
|
9
9
|
appId: string;
|
|
10
10
|
|
|
@@ -25,8 +25,8 @@ export interface AppMeta {
|
|
|
25
25
|
* An application can declare several gateways, so there is no single base URL for
|
|
26
26
|
* the API — look up the gateway you mean by name. A service's processes, its
|
|
27
27
|
* Workers' included, list the gateways its code names (`url("api")` from
|
|
28
|
-
* `@encore.dev/sdk/gateways`) and the one it hosts, and no other
|
|
29
|
-
*
|
|
28
|
+
* `@encore.dev/sdk/gateways`) and the one it hosts, and no other; one told of
|
|
29
|
+
* none, as under `encore test`, reports an empty object.
|
|
30
30
|
*/
|
|
31
31
|
gateways: Record<string, GatewayMeta>;
|
|
32
32
|
|
package/dist/app_meta.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export interface AppMeta {
|
|
3
3
|
/**
|
|
4
4
|
* The Encore application ID. If the application is not linked to the Encore platform this will be an empty string.
|
|
5
|
-
* To link to the Encore platform run `encore
|
|
5
|
+
* To link to the Encore platform run `encore cloud link` from your terminal in the root directory of the Encore app.
|
|
6
6
|
*/
|
|
7
7
|
appId: string;
|
|
8
8
|
/**
|
|
@@ -21,8 +21,8 @@ export interface AppMeta {
|
|
|
21
21
|
* An application can declare several gateways, so there is no single base URL for
|
|
22
22
|
* the API — look up the gateway you mean by name. A service's processes, its
|
|
23
23
|
* Workers' included, list the gateways its code names (`url("api")` from
|
|
24
|
-
* `@encore.dev/sdk/gateways`) and the one it hosts, and no other
|
|
25
|
-
*
|
|
24
|
+
* `@encore.dev/sdk/gateways`) and the one it hosts, and no other; one told of
|
|
25
|
+
* none, as under `encore test`, reports an empty object.
|
|
26
26
|
*/
|
|
27
27
|
gateways: Record<string, GatewayMeta>;
|
|
28
28
|
/**
|
package/dist/gateway/mod.d.ts
CHANGED
package/dist/gateway/mod.js
CHANGED
package/dist/internal/fetch.d.ts
CHANGED
|
@@ -31,11 +31,11 @@ import { type Context } from '@opentelemetry/api';
|
|
|
31
31
|
* A request made in a context with a trace or Request Context follows its
|
|
32
32
|
* redirects here, rather than in the global `fetch`, so that each is sent
|
|
33
33
|
* what its own URL is due: a redirect away from the app's services carries
|
|
34
|
-
* no Request Context,
|
|
35
|
-
* by fetch's own rules for each status, and
|
|
36
|
-
* `redirected` say where it ended. A `Request`'s
|
|
37
|
-
* first, so a 307 or 308 that would send it again
|
|
38
|
-
* a streamed body.
|
|
34
|
+
* no Request Context, nor the trace set for them, and one to them carries
|
|
35
|
+
* the context's. It follows them by fetch's own rules for each status, and
|
|
36
|
+
* its response's `url` and `redirected` say where it ended. A `Request`'s
|
|
37
|
+
* body is streamed, not read first, so a 307 or 308 that would send it again
|
|
38
|
+
* fails, as fetch's does for a streamed body.
|
|
39
39
|
*
|
|
40
40
|
* @example
|
|
41
41
|
* import {fetch} from "@encore.dev/sdk/services";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../internal/fetch.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;;AAEH,OAAO,EAA4B,KAAK,OAAO,EAAC,MAAM,oBAAoB,CAAC;AAM3E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,
|
|
1
|
+
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../internal/fetch.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;;AAEH,OAAO,EAA4B,KAAK,OAAO,EAAC,MAAM,oBAAoB,CAAC;AAM3E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,CA+BzB;AA4BD;;sBAEsB;AACtB,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAG/C;AAkBD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,OAAO,GACX,IAAI,CAMN"}
|
package/dist/internal/fetch.js
CHANGED
|
@@ -34,11 +34,11 @@ import { outgoingContext, outgoingContextIfKnown } from './testing/carry.js';
|
|
|
34
34
|
* A request made in a context with a trace or Request Context follows its
|
|
35
35
|
* redirects here, rather than in the global `fetch`, so that each is sent
|
|
36
36
|
* what its own URL is due: a redirect away from the app's services carries
|
|
37
|
-
* no Request Context,
|
|
38
|
-
* by fetch's own rules for each status, and
|
|
39
|
-
* `redirected` say where it ended. A `Request`'s
|
|
40
|
-
* first, so a 307 or 308 that would send it again
|
|
41
|
-
* a streamed body.
|
|
37
|
+
* no Request Context, nor the trace set for them, and one to them carries
|
|
38
|
+
* the context's. It follows them by fetch's own rules for each status, and
|
|
39
|
+
* its response's `url` and `redirected` say where it ended. A `Request`'s
|
|
40
|
+
* body is streamed, not read first, so a 307 or 308 that would send it again
|
|
41
|
+
* fails, as fetch's does for a streamed body.
|
|
42
42
|
*
|
|
43
43
|
* @example
|
|
44
44
|
* import {fetch} from "@encore.dev/sdk/services";
|
|
@@ -61,6 +61,7 @@ export function wrapFetch(base) {
|
|
|
61
61
|
const request = input instanceof Request ? input : undefined;
|
|
62
62
|
const url = request?.url ?? String(input);
|
|
63
63
|
const headers = new Headers(init?.headers ?? request?.headers);
|
|
64
|
+
const ownTrace = headers.has('traceparent');
|
|
64
65
|
// In a system test, the context with the test added: its calls carry
|
|
65
66
|
// the test's id, and continue its span where they have none. A call
|
|
66
67
|
// to a service whose test cannot be told is refused; one to anything
|
|
@@ -73,7 +74,7 @@ export function wrapFetch(base) {
|
|
|
73
74
|
if (!hasContext(ctx) || redirect !== 'follow') {
|
|
74
75
|
return send(input, { ...init, headers });
|
|
75
76
|
}
|
|
76
|
-
return followRedirects(send, url, initOf(request, init), headers, ctx);
|
|
77
|
+
return followRedirects(send, url, initOf(request, init), headers, ctx, ownTrace);
|
|
77
78
|
}, base ?? globalThis.fetch);
|
|
78
79
|
}
|
|
79
80
|
/** `fn` with the members `base` has besides its call, as Bun's global
|
|
@@ -217,9 +218,11 @@ function redirected(res, url) {
|
|
|
217
218
|
/**
|
|
218
219
|
* Sends a request and follows the redirects it is answered with, as fetch's
|
|
219
220
|
* `redirect: "follow"` does, preparing the headers of each for its own URL
|
|
220
|
-
* in `ctx`, the context the call was made in.
|
|
221
|
+
* in `ctx`, the context the call was made in. Unless `ownTrace`, the request
|
|
222
|
+
* carried a `traceparent` of its own, the trace set for the app's services
|
|
223
|
+
* is not sent on to anything else.
|
|
221
224
|
*/
|
|
222
|
-
async function followRedirects(send, url, init, headers, ctx) {
|
|
225
|
+
async function followRedirects(send, url, init, headers, ctx, ownTrace) {
|
|
223
226
|
let method = (init.method ?? 'GET').toUpperCase();
|
|
224
227
|
let body = init.body ?? null;
|
|
225
228
|
for (let redirects = 0;; redirects++) {
|
|
@@ -258,6 +261,10 @@ async function followRedirects(send, url, init, headers, ctx) {
|
|
|
258
261
|
}
|
|
259
262
|
await res.body?.cancel();
|
|
260
263
|
url = next;
|
|
264
|
+
if (!ownTrace && !origins.has(originOf(url) ?? '')) {
|
|
265
|
+
headers.delete('traceparent');
|
|
266
|
+
headers.delete('tracestate');
|
|
267
|
+
}
|
|
261
268
|
prepare(url, headers, ctx);
|
|
262
269
|
}
|
|
263
270
|
}
|
|
@@ -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,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,EAAC,eAAe,EAAE,sBAAsB,EAAC,MAAM,iBAAiB,CAAC;AAExE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,CAAC,MAAM,KAAK,GAA4B,SAAS,EAAE,CAAC;AAE1D;;;;;;;;;GASG;AACH,MAAM,UAAU,SAAS,CACvB,IAA8B;IAE9B,MAAM,IAAI,GAAS,IAAI,IAAI,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;IAC5E,OAAO,wBAAwB,CAC7B,KAAK,EAAE,KAA6B,EAAE,IAAkB,EAAE,EAAE;QAC1D,MAAM,OAAO,GAAG,KAAK,YAAY,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,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.0-beta.13";
|
|
3
3
|
|
|
4
4
|
// Load the native module. ENCORE_RUNTIME_LIB overrides the location; by
|
|
5
5
|
// default the library is found by walking up from this file (which the
|
|
@@ -664,9 +664,12 @@ export class Runtime {
|
|
|
664
664
|
* `cooperative` shutdown cleans up once the app has drained its own work
|
|
665
665
|
* too ([`Runtime::mark_application_drained`]), or the deadline passed.
|
|
666
666
|
* The JS caller exits the process from Node's main thread with the
|
|
667
|
-
* returned code.
|
|
667
|
+
* returned code. `on_begin` is called on the event loop once the
|
|
668
|
+
* shutdown begins on a signal, so the app's shutdown work begins too: the
|
|
669
|
+
* app may not hear the signal itself, as it doesn't the console closing
|
|
670
|
+
* on Windows. The promise resolves only once it has returned.
|
|
668
671
|
*/
|
|
669
|
-
runForever(cooperative?: boolean
|
|
672
|
+
runForever(cooperative?: boolean, onBegin?: () => void): Promise<number>
|
|
670
673
|
/**
|
|
671
674
|
* Starts the shutdown once; the first call chooses the mode. A
|
|
672
675
|
* cooperative shutdown waits for [`Runtime::mark_application_drained`]
|
|
@@ -683,6 +686,18 @@ export class Runtime {
|
|
|
683
686
|
* watching holds no handle open on the event loop.
|
|
684
687
|
*/
|
|
685
688
|
watchShutdown(handler: (phase: string, result?: string) => void): void
|
|
689
|
+
/**
|
|
690
|
+
* Calls `handler` on the event loop once the daemon asks this process to
|
|
691
|
+
* stop through the event it gave it, as it does on Windows, which has no
|
|
692
|
+
* SIGTERM, instead of sending Ctrl-Break. Returns false, and calls
|
|
693
|
+
* nothing, when there is no such request to wait for: on Unix, or when
|
|
694
|
+
* the process was not given an event. Waiting holds no handle open on
|
|
695
|
+
* the event loop.
|
|
696
|
+
*
|
|
697
|
+
* Waiting tells the daemon not to send Ctrl-Break: watch only where the
|
|
698
|
+
* request begins the shutdown, as SIGTERM does.
|
|
699
|
+
*/
|
|
700
|
+
watchStopRequest(handler: () => void): boolean
|
|
686
701
|
/**
|
|
687
702
|
* The shutdown's phase: `"not-started"`, `"started"`, `"cleanup"` or
|
|
688
703
|
* `"completed"`.
|
|
@@ -747,8 +762,6 @@ export class Runtime {
|
|
|
747
762
|
meters(): Meters
|
|
748
763
|
/** Returns the version of the Encore runtime being used */
|
|
749
764
|
static version(): string
|
|
750
|
-
/** Returns the git commit hash used to build the Encore runtime */
|
|
751
|
-
static buildCommit(): string
|
|
752
765
|
appMeta(): AppMeta
|
|
753
766
|
runtimeConfig(): RuntimeConfig
|
|
754
767
|
}
|
|
@@ -73,7 +73,8 @@ export declare function completed(): Promise<ShutdownResult>;
|
|
|
73
73
|
/** Begins cleanup without waiting for the app's holds or the Pub/Sub
|
|
74
74
|
* handlers in flight. Work still running may find its resources closed. */
|
|
75
75
|
export declare function forceCleanup(): void;
|
|
76
|
-
/** Begins the shutdown on SIGTERM or SIGINT,
|
|
76
|
+
/** Begins the shutdown on SIGTERM or SIGINT, or on Windows when the daemon
|
|
77
|
+
* asks the process to stop, and exits once it completes:
|
|
77
78
|
* with `process.exitCode` (0 unless the app set it) if cleanup finished
|
|
78
79
|
* within the shutdown deadline, else 1. A second SIGINT, a second Ctrl-C,
|
|
79
80
|
* forces cleanup.
|
|
@@ -83,8 +84,9 @@ export declare function forceCleanup(): void;
|
|
|
83
84
|
* open. */
|
|
84
85
|
export declare function watchShutdownSignals(): void;
|
|
85
86
|
/** Runs `rt` until its shutdown completes, returning the exit code. The
|
|
86
|
-
* runtime handles SIGTERM and SIGINT
|
|
87
|
-
* and cleanup waits for the app's
|
|
87
|
+
* runtime handles SIGTERM and SIGINT, and on Windows the console closing;
|
|
88
|
+
* on them the shutdown begins here too, and cleanup waits for the app's
|
|
89
|
+
* holds. */
|
|
88
90
|
export declare function runUntilShutdown(r: Runtime): Promise<number>;
|
|
89
91
|
/** Has `sig` force cleanup when it comes again, as a second SIGINT does. */
|
|
90
92
|
export declare function forceCleanupOnRepeat(sig: NodeJS.Signals): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shutdown.d.ts","sourceRoot":"","sources":["../../../internal/runtime/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AM,CAAC,OAAO,GAAG,IAAI,CAE9D"}
|
|
@@ -2,7 +2,12 @@
|
|
|
2
2
|
export class ShutdownError extends Error {
|
|
3
3
|
name = 'ShutdownError';
|
|
4
4
|
}
|
|
5
|
-
|
|
5
|
+
/** The signals that begin the shutdown. Under Node on Windows Ctrl-Break
|
|
6
|
+
* too, which the daemon sends a process that doesn't listen for its stop
|
|
7
|
+
* request; Bun dies of it, whatever it listens for. */
|
|
8
|
+
const SIGNALS = process.platform === 'win32' && !process.versions.bun
|
|
9
|
+
? ['SIGTERM', 'SIGINT', 'SIGBREAK']
|
|
10
|
+
: ['SIGTERM', 'SIGINT'];
|
|
6
11
|
/** How long after the first signal the same one again is a new one, not the
|
|
7
12
|
* first delivered twice: a process group's runner may forward the signal its
|
|
8
13
|
* members already received. */
|
|
@@ -154,7 +159,8 @@ export function forceCleanup() {
|
|
|
154
159
|
throw new ShutdownError('shutdown has not begun');
|
|
155
160
|
rt().forceShutdownCleanup();
|
|
156
161
|
}
|
|
157
|
-
/** Begins the shutdown on SIGTERM or SIGINT,
|
|
162
|
+
/** Begins the shutdown on SIGTERM or SIGINT, or on Windows when the daemon
|
|
163
|
+
* asks the process to stop, and exits once it completes:
|
|
158
164
|
* with `process.exitCode` (0 unless the app set it) if cleanup finished
|
|
159
165
|
* within the shutdown deadline, else 1. A second SIGINT, a second Ctrl-C,
|
|
160
166
|
* forces cleanup.
|
|
@@ -165,14 +171,18 @@ export function forceCleanup() {
|
|
|
165
171
|
export function watchShutdownSignals() {
|
|
166
172
|
for (const s of SIGNALS)
|
|
167
173
|
process.on(s, onSignal);
|
|
174
|
+
// Windows has no SIGTERM: the daemon sets an event instead, which comes
|
|
175
|
+
// as SIGTERM, to the app's own listeners too.
|
|
176
|
+
rt().watchStopRequest(() => void process.emit('SIGTERM', 'SIGTERM'));
|
|
168
177
|
}
|
|
169
178
|
/** Runs `rt` until its shutdown completes, returning the exit code. The
|
|
170
|
-
* runtime handles SIGTERM and SIGINT
|
|
171
|
-
* and cleanup waits for the app's
|
|
179
|
+
* runtime handles SIGTERM and SIGINT, and on Windows the console closing;
|
|
180
|
+
* on them the shutdown begins here too, and cleanup waits for the app's
|
|
181
|
+
* holds. */
|
|
172
182
|
export function runUntilShutdown(r) {
|
|
173
183
|
runtime = r;
|
|
174
184
|
hosted = true;
|
|
175
|
-
return r.runForever(true);
|
|
185
|
+
return r.runForever(true, begin);
|
|
176
186
|
}
|
|
177
187
|
/** Has `sig` force cleanup when it comes again, as a second SIGINT does. */
|
|
178
188
|
export function forceCleanupOnRepeat(sig) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shutdown.js","sourceRoot":"","sources":["../../../internal/runtime/shutdown.ts"],"names":[],"mappings":"AAgBA,yEAAyE;AACzE,MAAM,OAAO,aAAc,SAAQ,KAAK;IAC7B,IAAI,GAAG,eAAe,CAAC;CACjC;AAsBD,MAAM,OAAO,GAAG,CAAC,SAAS,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"shutdown.js","sourceRoot":"","sources":["../../../internal/runtime/shutdown.ts"],"names":[],"mappings":"AAgBA,yEAAyE;AACzE,MAAM,OAAO,aAAc,SAAQ,KAAK;IAC7B,IAAI,GAAG,eAAe,CAAC;CACjC;AAsBD;;uDAEuD;AACvD,MAAM,OAAO,GACX,OAAO,CAAC,QAAQ,KAAK,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG;IACnD,CAAC,CAAC,CAAC,SAAS,EAAE,QAAQ,EAAE,UAAU,CAAC;IACnC,CAAC,CAAC,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;AAC5B;;+BAE+B;AAC/B,MAAM,SAAS,GAAG,IAAI,CAAC;AAEvB,IAAI,OAA4B,CAAC;AACjC;yDACyD;AACzD,IAAI,MAAM,GAAG,KAAK,CAAC;AACnB,MAAM,SAAS,GAAG,IAAI,GAAG,EAAoB,CAAC;AAC9C;gEACgE;AAChE,MAAM,YAAY,GAAG,IAAI,OA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9D,OAAO,CAAC,WAAW,CAAC,CAAC;IACrB,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC1C,IAAI,QAAQ,EAAE,CAAC;QACb,KAAK,MAAM,CAAC,IAAI,OAAO;YAAE,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;QAClD,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QACpC,OAAO;IACT,CAAC;IACD,OAAO,CAAC,IAAI,EAAE,CAAC;AACjB,CAAC;AAED;6EAC6E;AAC7E,SAAS,YAAY;IACnB,IAAI,QAAQ;QAAE,OAAO;IACrB,QAAQ,GAAG,IAAI,CAAC;IAChB,MAAM,IAAI,GAAG,EAAE,EAAE,CAAC,kBAAkB,EAAE,CAAC;IACvC,IAAI,IAAI,KAAK,CAAC;QAAE,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;AAC1C,CAAC;AAED,SAAS,GAAG,CAAC,QAA0B;IACrC,MAAM,GAAG,GAAG,EAAC,MAAM,EAAE,YAAY,CAAC,MAAM,EAAE,QAAQ,EAAC,CAAC;IACpD,SAAS,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;AAC3C,CAAC"}
|
package/dist/services/index.d.ts
CHANGED
|
@@ -57,13 +57,13 @@
|
|
|
57
57
|
* A generated call that fails throws a {@link CallError}, whatever kind of
|
|
58
58
|
* API it calls, which `instanceof CallError` tells from any other error. Its
|
|
59
59
|
* code is the service's answer to the caller, not the caller's to its own
|
|
60
|
-
* clients: one an `@encore.dev/
|
|
60
|
+
* clients: one an `@encore.dev/framework` handler lets escape answers internal, as
|
|
61
61
|
* any error but an APIError does. A handler answers with a code of its own
|
|
62
62
|
* where it means one, and {@link unlessNotFound} makes a `not_found` failure
|
|
63
63
|
* `undefined`, for a call for something that may not be there:
|
|
64
64
|
*
|
|
65
65
|
* ```ts
|
|
66
|
-
* import {APIError} from "@encore.dev/
|
|
66
|
+
* import {APIError} from "@encore.dev/framework";
|
|
67
67
|
* import {CallError, unlessNotFound} from "@encore.dev/sdk/services";
|
|
68
68
|
*
|
|
69
69
|
* try {
|
package/dist/services/index.js
CHANGED
|
@@ -57,13 +57,13 @@
|
|
|
57
57
|
* A generated call that fails throws a {@link CallError}, whatever kind of
|
|
58
58
|
* API it calls, which `instanceof CallError` tells from any other error. Its
|
|
59
59
|
* code is the service's answer to the caller, not the caller's to its own
|
|
60
|
-
* clients: one an `@encore.dev/
|
|
60
|
+
* clients: one an `@encore.dev/framework` handler lets escape answers internal, as
|
|
61
61
|
* any error but an APIError does. A handler answers with a code of its own
|
|
62
62
|
* where it means one, and {@link unlessNotFound} makes a `not_found` failure
|
|
63
63
|
* `undefined`, for a call for something that may not be there:
|
|
64
64
|
*
|
|
65
65
|
* ```ts
|
|
66
|
-
* import {APIError} from "@encore.dev/
|
|
66
|
+
* import {APIError} from "@encore.dev/framework";
|
|
67
67
|
* import {CallError, unlessNotFound} from "@encore.dev/sdk/services";
|
|
68
68
|
*
|
|
69
69
|
* try {
|