@geekmidas/constructs 10.0.0-alpha.21 → 10.0.0-alpha.22
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 +29 -23
- package/dist/{Endpoint-BxkRWQ8G.d.mts → Endpoint-Bmi2-PBN.d.mts} +2 -2
- package/dist/{Endpoint-BxkRWQ8G.d.mts.map → Endpoint-Bmi2-PBN.d.mts.map} +1 -1
- package/dist/{Endpoint-DbYQJgb-.d.cts → Endpoint-CjvraSfp.d.cts} +2 -2
- package/dist/{Endpoint-DbYQJgb-.d.cts.map → Endpoint-CjvraSfp.d.cts.map} +1 -1
- package/dist/{EndpointFactory-T06kTFHg.d.mts → EndpointFactory-BFfvgko6.d.mts} +2 -2
- package/dist/{EndpointFactory-DE6nKtFZ.d.cts.map → EndpointFactory-BFfvgko6.d.mts.map} +1 -1
- package/dist/{EndpointFactory-DE6nKtFZ.d.cts → EndpointFactory-vfC3NiJi.d.cts} +2 -2
- package/dist/{EndpointFactory-T06kTFHg.d.mts.map → EndpointFactory-vfC3NiJi.d.cts.map} +1 -1
- package/dist/Queue-BB2-DgqJ.cjs +123 -0
- package/dist/Queue-BB2-DgqJ.cjs.map +1 -0
- package/dist/Queue-Dfumm1WR.mjs +118 -0
- package/dist/Queue-Dfumm1WR.mjs.map +1 -0
- package/dist/Topic-BaNCgP61.cjs +107 -0
- package/dist/Topic-BaNCgP61.cjs.map +1 -0
- package/dist/Topic-QqnO_6Dl.mjs +102 -0
- package/dist/Topic-QqnO_6Dl.mjs.map +1 -0
- package/dist/adaptors/aws.d.cts +1 -1
- package/dist/adaptors/aws.d.mts +1 -1
- package/dist/adaptors/hono.d.cts +1 -1
- package/dist/adaptors/hono.d.mts +1 -1
- package/dist/adaptors/testing.cjs +136 -32
- package/dist/adaptors/testing.cjs.map +1 -1
- package/dist/adaptors/testing.d.cts +94 -13
- package/dist/adaptors/testing.d.cts.map +1 -1
- package/dist/adaptors/testing.d.mts +94 -13
- package/dist/adaptors/testing.d.mts.map +1 -1
- package/dist/adaptors/testing.mjs +133 -33
- package/dist/adaptors/testing.mjs.map +1 -1
- package/dist/{auth-BlO8MUkR.d.cts → auth-C_fHD1We.d.cts} +9 -1
- package/dist/{auth-BlO8MUkR.d.cts.map → auth-C_fHD1We.d.cts.map} +1 -1
- package/dist/{auth-CHWIdcQO.d.mts → auth-D_Ntp1Nj.d.mts} +9 -1
- package/dist/{auth-CHWIdcQO.d.mts.map → auth-D_Ntp1Nj.d.mts.map} +1 -1
- package/dist/auth.cjs +15 -2
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +1 -1
- package/dist/auth.d.mts +1 -1
- package/dist/auth.mjs +15 -2
- package/dist/auth.mjs.map +1 -1
- package/dist/endpoints/index.d.cts +2 -2
- package/dist/endpoints/index.d.mts +2 -2
- package/dist/queue/index.cjs +3 -116
- package/dist/queue/index.cjs.map +1 -1
- package/dist/queue/index.mjs +1 -114
- package/dist/queue/index.mjs.map +1 -1
- package/dist/rest-api.d.cts +2 -2
- package/dist/rest-api.d.mts +2 -2
- package/dist/topic/index.cjs +3 -100
- package/dist/topic/index.cjs.map +1 -1
- package/dist/topic/index.mjs +1 -98
- package/dist/topic/index.mjs.map +1 -1
- package/package.json +31 -31
package/README.md
CHANGED
|
@@ -910,28 +910,30 @@ export const sendMessage = api
|
|
|
910
910
|
|
|
911
911
|
## Feature Tests
|
|
912
912
|
|
|
913
|
-
|
|
913
|
+
A feature test drives an app the way it runs deployed: a browser signs in and
|
|
914
914
|
calls the API, the API asks the auth server who is calling, each over its URL,
|
|
915
915
|
and every database is in its own transaction, rolled back after the test.
|
|
916
916
|
Nothing runs as a server — each URL an app's constructs answer on is served
|
|
917
917
|
in-process through MSW, from the real handler, for the test that made the
|
|
918
|
-
request. Postgres and
|
|
918
|
+
request. Postgres, Mailpit and MinIO are the real local ones `gkm test` starts.
|
|
919
|
+
|
|
920
|
+
Nothing is declared in test code. `gkm test` writes `.gkm/test/` into each app:
|
|
921
|
+
|
|
922
|
+
- `manifest.json` — which construct and endpoint is exported where, and the
|
|
923
|
+
test stage's environment, keyed as the constructs derive their keys;
|
|
924
|
+
- `clients/<surface>.ts` — each surface's typed client, from the same generator
|
|
925
|
+
`gkm build` uses;
|
|
926
|
+
- `index.ts` — a `Browser` with a client per surface (`Api` → `browser.api`)
|
|
927
|
+
and per auth server (`browser.auth`, its better-auth plugins paired with
|
|
928
|
+
their client plugins), and the configured `it`.
|
|
929
|
+
|
|
930
|
+
Map it once in the app's `package.json` — `"imports": { "#test":
|
|
931
|
+
"./.gkm/test/index.ts" }` — and a test is:
|
|
919
932
|
|
|
920
933
|
```typescript
|
|
921
|
-
|
|
922
|
-
import { featureTest } from '@geekmidas/constructs/testing';
|
|
923
|
-
|
|
924
|
-
export const it = featureTest({
|
|
925
|
-
modules: import.meta.glob(
|
|
926
|
-
['../../../constructs/*.ts', '../src/endpoints/**/*.ts'],
|
|
927
|
-
{ eager: true },
|
|
928
|
-
),
|
|
929
|
-
database, // what a test receives as `db`
|
|
930
|
-
browser: Browser, // your subclass of @geekmidas/testkit/browser, with your clients
|
|
931
|
-
});
|
|
934
|
+
import { it } from '#test';
|
|
932
935
|
|
|
933
|
-
|
|
934
|
-
it('shows the signed-in user their profile', async ({ browser, mailbox, db }) => {
|
|
936
|
+
it('shows the signed-in user their profile', async ({ browser, mailbox }) => {
|
|
935
937
|
await browser.auth.signIn.magicLink({ email: 'ada@shop.test' });
|
|
936
938
|
await browser.visit((await mailbox('ada@shop.test').last()).link!);
|
|
937
939
|
|
|
@@ -939,16 +941,20 @@ it('shows the signed-in user their profile', async ({ browser, mailbox, db }) =>
|
|
|
939
941
|
});
|
|
940
942
|
```
|
|
941
943
|
|
|
942
|
-
- **`browser`** — already the global `fetch
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
- **`db`** — the
|
|
946
|
-
|
|
944
|
+
- **`browser`** — already the global `fetch`; its cookie jar follows the
|
|
945
|
+
browser's rules, so a session cookie set for the wrong domain never reaches
|
|
946
|
+
the API.
|
|
947
|
+
- **`db`** — the transaction of the database the endpoints name, typed by its
|
|
948
|
+
schema.
|
|
947
949
|
- **`mailbox(address)`** — the mail actually sent, read from Mailpit.
|
|
948
|
-
-
|
|
949
|
-
|
|
950
|
+
- **`published(topic | queue)`** — what the test published or enqueued.
|
|
951
|
+
Nothing is delivered: a subscriber or a worker is run on its own with
|
|
952
|
+
**`subscriber(s).invoke({ events })`** / **`queue(q).invoke({ messages })`**,
|
|
953
|
+
on the test's services and transactions.
|
|
954
|
+
- Each database construct — the app's and each schema tenant — gets its own
|
|
955
|
+
transaction on its own connection, as deployed.
|
|
950
956
|
- A request that belongs to no running test is refused with
|
|
951
|
-
`UnknownTestContext` rather than reaching
|
|
957
|
+
`UnknownTestContext` rather than reaching another test's data.
|
|
952
958
|
|
|
953
959
|
## AWS Lambda Adapters
|
|
954
960
|
|
|
@@ -2,7 +2,7 @@ import { t as StandardSchemaV1 } from "./index-CeEtxDmK.mjs";
|
|
|
2
2
|
import { a as FunctionHandler, r as Function } from "./index-DU3Twmwh.mjs";
|
|
3
3
|
import { t as Authenticator } from "./construct-interface-Clz7_BwB.mjs";
|
|
4
4
|
import { n as LowerHttpMethod, t as HttpMethod } from "./types-DMuSQeLL.mjs";
|
|
5
|
-
import { n as AuthSession } from "./auth-
|
|
5
|
+
import { n as AuthSession } from "./auth-D_Ntp1Nj.mjs";
|
|
6
6
|
import { ComponentCollector, OpenApiSchemaOptions } from "@geekmidas/schema/openapi";
|
|
7
7
|
import { EnvironmentParser } from "@geekmidas/envkit";
|
|
8
8
|
import { EventPublisher, ExtractPublisherMessage, MappedEvent } from "@geekmidas/events";
|
|
@@ -872,4 +872,4 @@ declare enum SuccessStatus {
|
|
|
872
872
|
type EndpointOutput<T> = T extends Endpoint<any, any, any, infer OutSchema, any, any, any, any> ? InferStandardSchema<OutSchema> : never;
|
|
873
873
|
//#endregion
|
|
874
874
|
export { getSecurityScheme as A, Authorizer as C, OAuthFlows as D, OAuthFlow as E, SecurityScheme as O, MappedAudit as S, BuiltInSecuritySchemeId as T, RlsBypass as _, EndpointContext as a, RlsContextExtractor as b, EndpointSchemas as c, ResponseBuilder as d, SessionFn as f, RLS_BYPASS as g, SessionAuth as h, Endpoint as i, isBuiltInSecurityScheme as j, createAuthorizer as k, EndpointSurface as l, NoAuthenticator as m, ConvertRouteParams as n, EndpointHandler as o, SuccessStatus as p, CookieFn as r, EndpointOutput as s, AuthorizeFn as t, HeaderFn as u, RlsConfig as v, BUILT_IN_SECURITY_SCHEMES as w, ActorExtractor as x, RlsContext as y };
|
|
875
|
-
//# sourceMappingURL=Endpoint-
|
|
875
|
+
//# sourceMappingURL=Endpoint-Bmi2-PBN.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Endpoint-
|
|
1
|
+
{"version":3,"file":"Endpoint-Bmi2-PBN.d.mts","names":[],"sources":["../src/endpoints/Authorizer.ts","../src/endpoints/audit.ts","../src/endpoints/rls.ts","../src/endpoints/sessionAuth.ts","../src/endpoints/Endpoint.ts"],"mappings":";;;;;;;;;;;;;;;;;;;UAIiB;;EAEhB;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA,QAAQ;;EAER;;GAEC;;;;;UAMe;EAChB,WAAW;EACX,WAAW;EACX,oBAAoB;EACpB,oBAAoB;;UAGJ;EAChB;EACA;EACA;EACA,QAAQ;;;;;;cAOI;;aAEX;aACA;aACA;aACA;;;aAGA;aACA;aACA;;;aAGA;aACA;aACA;aACA;;;aAGA;aACA;aACA;;;aAGA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;;;;KAKU,uCAAuC;;;;UAKlC;;;;EAIhB;;;;EAIA,iBAAiB;;;;;EAKjB;;;;;EAKA;;;;;EAKA,WAAW;;;;;iBAMI,iBACf,cACA,UAAU,KAAK,sBACb;;;;iBAUa,wBACf,eACE,QAAQ;;;;iBAOK,kBACf,cACA,gBAAgB,eAAe,kBAC7B;;;;;;;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,6BACG;;;;;;;EASD,SAAS,QAAQ;;;;;KAMf,gBAAgB,yBAAyB;;;;;;;EAS3C,IAAI;;;;;;;;;;;;;;KAeK,gBACX,cAAc,yCACd,kBAAkB,gBAClB,gBAAgB,SAAS,QACzB,oBACA,qBAAqB,mCAAmC,kCAIxD,uBACA,6BACG,oBAAoB,WAAW,SAAS,YAC3C,8BAA8B,SAC9B,eAAe,cAAc,iBAC7B,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA+BL,gBACX,eAAe,yCACf,kBAAkB,gBAClB,gBAAgB,SAAS,QACzB,kBAAkB,0CAClB,oBACA,uBACA,2BACA,qBAAqB,mCAAmC,qCAKxD,KAAK,gBACJ,QACA,WACA,SACA,UACA,cACA,WACA,gBAED,UAAU,oBACN,kBAAkB,mBAMlB,yBAAyB,aACzB,qBAAqB,yBAAyB,cAC9C,QAAQ,yBAAyB,cACjC,QAAQ,qBAAqB,yBAAyB,yBAGtD,gCACA,mBACA,QAAQ;;;;aAKD;;EAEX;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;KAGW,eAAe,KAC1B,UAAU,8BAA8B,iCACrC,oBAAoB"}
|
|
@@ -2,7 +2,7 @@ import { t as StandardSchemaV1 } from "./index-CeEtxDmK.cjs";
|
|
|
2
2
|
import { a as FunctionHandler, r as Function } from "./index-nBQT1tAh.cjs";
|
|
3
3
|
import { t as Authenticator } from "./construct-interface-DIaTNKax.cjs";
|
|
4
4
|
import { n as LowerHttpMethod, t as HttpMethod } from "./types-DMuSQeLL.cjs";
|
|
5
|
-
import { n as AuthSession } from "./auth-
|
|
5
|
+
import { n as AuthSession } from "./auth-C_fHD1We.cjs";
|
|
6
6
|
import { EnvironmentParser } from "@geekmidas/envkit";
|
|
7
7
|
import { EventPublisher, ExtractPublisherMessage, MappedEvent } from "@geekmidas/events";
|
|
8
8
|
import { Logger } from "@geekmidas/logger";
|
|
@@ -872,4 +872,4 @@ declare enum SuccessStatus {
|
|
|
872
872
|
type EndpointOutput<T> = T extends Endpoint<any, any, any, infer OutSchema, any, any, any, any> ? InferStandardSchema<OutSchema> : never;
|
|
873
873
|
//#endregion
|
|
874
874
|
export { getSecurityScheme as A, Authorizer as C, OAuthFlows as D, OAuthFlow as E, SecurityScheme as O, MappedAudit as S, BuiltInSecuritySchemeId as T, RlsBypass as _, EndpointContext as a, RlsContextExtractor as b, EndpointSchemas as c, ResponseBuilder as d, SessionFn as f, RLS_BYPASS as g, SessionAuth as h, Endpoint as i, isBuiltInSecurityScheme as j, createAuthorizer as k, EndpointSurface as l, NoAuthenticator as m, ConvertRouteParams as n, EndpointHandler as o, SuccessStatus as p, CookieFn as r, EndpointOutput as s, AuthorizeFn as t, HeaderFn as u, RlsConfig as v, BUILT_IN_SECURITY_SCHEMES as w, ActorExtractor as x, RlsContext as y };
|
|
875
|
-
//# sourceMappingURL=Endpoint-
|
|
875
|
+
//# sourceMappingURL=Endpoint-CjvraSfp.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Endpoint-
|
|
1
|
+
{"version":3,"file":"Endpoint-CjvraSfp.d.cts","names":[],"sources":["../src/endpoints/Authorizer.ts","../src/endpoints/audit.ts","../src/endpoints/rls.ts","../src/endpoints/sessionAuth.ts","../src/endpoints/Endpoint.ts"],"mappings":";;;;;;;;;;;;;;;;;;;UAIiB;;EAEhB;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA,QAAQ;;EAER;;GAEC;;;;;UAMe;EAChB,WAAW;EACX,WAAW;EACX,oBAAoB;EACpB,oBAAoB;;UAGJ;EAChB;EACA;EACA;EACA,QAAQ;;;;;;cAOI;;aAEX;aACA;aACA;aACA;;;aAGA;aACA;aACA;;;aAGA;aACA;aACA;aACA;;;aAGA;aACA;aACA;;;aAGA;aACA;aACA;;;aAGA;aACA;aACA;aACA;aACA;;;;KAKU,uCAAuC;;;;UAKlC;;;;EAIhB;;;;EAIA,iBAAiB;;;;;EAKjB;;;;;EAKA;;;;;EA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BAAgB,SAAS,QACzB;;EAGA,UAAU,cAAc;;EAExB,QAAQ;;EAER,QAAQ;;EAER,QAAQ;;EAER,SAAS;;;;;KAML,eACJ,qBAAqB,mCAAmC,kCAIxD,6BACG;;;;;;;EASD,SAAS,QAAQ;;;;;KAMf,gBAAgB,yBAAyB;;;;;;;EAS3C,IAAI;;;;;;;;;;;;;;KAeK,gBACX,cAAc,yCACd,kBAAkB,gBAClB,gBAAgB,SAAS,QACzB,oBACA,qBAAqB,mCAAmC,kCAIxD,uBACA,6BACG,oBAAoB,WAAW,SAAS,YAC3C,8BAA8B,SAC9B,eAAe,cAAc,iBAC7B,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA+BL,gBACX,eAAe,yCACf,kBAAkB,gBAClB,gBAAgB,SAAS,QACzB,kBAAkB,0CAClB,oBACA,uBACA,2BACA,qBAAqB,mCAAmC,qCAKxD,KAAK,gBACJ,QACA,WACA,SACA,UACA,cACA,WACA,gBAED,UAAU,oBACN,kBAAkB,mBAMlB,yBAAyB,aACzB,qBAAqB,yBAAyB,cAC9C,QAAQ,yBAAyB,cACjC,QAAQ,qBAAqB,yBAAyB,yBAGtD,gCACA,mBACA,QAAQ;;;;aAKD;;EAEX;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;KAGW,eAAe,KAC1B,UAAU,8BAA8B,iCACrC,oBAAoB"}
|
|
@@ -2,7 +2,7 @@ import { t as StandardSchemaV1 } from "./index-CeEtxDmK.mjs";
|
|
|
2
2
|
import { n as BaseFunctionBuilder } from "./index-DU3Twmwh.mjs";
|
|
3
3
|
import { c as ServicesOf, r as Consumable } from "./construct-interface-Clz7_BwB.mjs";
|
|
4
4
|
import { t as HttpMethod } from "./types-DMuSQeLL.mjs";
|
|
5
|
-
import { C as Authorizer, O as SecurityScheme, S as MappedAudit, T as BuiltInSecuritySchemeId, _ as RlsBypass, c as EndpointSchemas, f as SessionFn, i as Endpoint, l as EndpointSurface, o as EndpointHandler, p as SuccessStatus, t as AuthorizeFn, v as RlsConfig, x as ActorExtractor } from "./Endpoint-
|
|
5
|
+
import { C as Authorizer, O as SecurityScheme, S as MappedAudit, T as BuiltInSecuritySchemeId, _ as RlsBypass, c as EndpointSchemas, f as SessionFn, i as Endpoint, l as EndpointSurface, o as EndpointHandler, p as SuccessStatus, t as AuthorizeFn, v as RlsConfig, x as ActorExtractor } from "./Endpoint-Bmi2-PBN.mjs";
|
|
6
6
|
import { EventPublisher, MappedEvent } from "@geekmidas/events";
|
|
7
7
|
import { RateLimitConfig } from "@geekmidas/rate-limit";
|
|
8
8
|
import { Service } from "@geekmidas/services";
|
|
@@ -336,4 +336,4 @@ interface EndpointFactoryOptions<TServices extends Service[] = [], TBasePath ext
|
|
|
336
336
|
}
|
|
337
337
|
//#endregion
|
|
338
338
|
export { EndpointBuilder as n, EndpointFactory as t };
|
|
339
|
-
//# sourceMappingURL=EndpointFactory-
|
|
339
|
+
//# sourceMappingURL=EndpointFactory-BFfvgko6.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EndpointFactory-
|
|
1
|
+
{"version":3,"file":"EndpointFactory-BFfvgko6.d.mts","names":[],"sources":["../src/endpoints/EndpointBuilder.ts","../src/endpoints/EndpointFactory.ts"],"mappings":";;;;;;;;;;;cAuCa,gBACZ,uBACA,gBAAgB,YAChB,eAAe,sBACf,kBAAkB,gBAClB,gBAAgB,SAAS,QACzB,kBAAkB,0CAClB,oBACA,wBAAwB,6CACxB,oDACA,4DACA,sBAAsB,sCACtB,kDACA,qBAAqB,mCAAmC,kCAIxD,uBACA,sDACS,oBACT,QACA,WACA,WACA,SACA,iBACA,4BACA,eACA,0BACA,WACA;WA6BU,OAAO;WACP,QAAQ;YA5BR,SAAS;YACT;YACA,UAAU;YACV;YACA;YACA;EACV,aAAa,UAAU,WAAW,SAAS,UAAU;EAErD,YAAY,YAAY,WAAW,SAAS,UAAU,QAAQ;EAE9D,aAAa;EACb,uBAAuB;EACvB,kBAAkB;E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ACA,0BACA,cACA,WACA;;;;;;;;;;;;EAkCD,gBAAgB,mBAAmB,cAClC,YAAY,IACV,gBACF,QACA,SACA,YACI,cAAc,WAAW,KAC7B,SACA,WACA,UACA,iBACA,4BACA,cACA,eACA,0BACA,cACA,WACA;EAoCD,SAAS,UAAU,WAClB,UAAU,IACR,gBACF,QACA,SACA,YACI,cAAc,IAClB,SACA,WACA,UACA,iBACA,4BACA,cACA,eACA,0BACA,cACA,WACA;EA0BD,OAAO,UAAU,QAChB,QAAQ,IACN,gBACF,QACA,SACA,QACA,WACA,GACA,WACA,UACA,iBACA,4BACA,cACA,eACA,0BACA,cACA,WACA;EAuBD,OAAO,UAAU,kBAChB,QAAQ,IACN,gBACF,QACA,SACA,QACA,WACA,SACA,GACA,UACA,iBACA,4BACA,cACA,eACA,0BACA,cACA,WACA;;;;;;EA4BQ,QAAQ,UAAU,mBAAmB,sBAC7C,SAAS,QAAQ,OAAO,KACtB,gBACF,QACA,SACA,QACA,WACA,SACA,WACA,UACA,iBACA,4BACA,cACA,GACA,OACA,0BAA0B,IAC1B,WACA;;;;;EA8BD,MACC,WAAW,eAAe,WAAW,UAAU,WAC7C,gBACF,QACA,SACA,QACA,WACA,SACA,WACA,UACA,iBACA,4BACA,cACA,eACA,0BACA,cACA,WACA;;;;;;;;;;;;;;;;;;EAsBD,MAAM,QAAQ,YAAY,cAAc;;;;;;;;;;;;;;;;EAmB/B,SAAS,GAAG,sBACpB,QAAQ,WAAW,OAAO,KAAK,QAAQ,OAAO,KAC5C,gBACF,QACA,SACA,QACA,WACA,SACA,WACA,UACA,iBACA,4BACA,cACA,eACA,0BACA,cACA,GACA;;;;;;;;;;;;;;;;;;;;EA+CD,IACC,QAAQ,UAAU,WAAW,UAAU,mBAAmB;;;;;;;;;;;;;;EAyB3D;EAKA,MAAM;EAMN,OACC,IAAI,gBACH,QACA,WACA,SACA,WACA,UACA,WACA,eACA,gBAEC,SACF,QACA,SACA,QACA,WACA,WACA,SACA,UACA,iBACA,4BACA,eACA,0BACA,cACA,WACA;;;;cC3uBW,gBACZ,kBAAkB,gBAClB,+BACA,gBAAgB,SAAS,QACzB,oBACA,wBAAwB,6CACxB,oDACA,4DACA,sBAAsB,2CACtB,kDACA,qBAAqB,mCAGjB,0BAA0B,YAAY,iBAC1C,uBACA,8CACA,yBAAyB,eAAe,kBAAkB,eAEzD,iBAED,mBACG,UAAU,WAAW,UAAU;UAG1B;;;;;;;;;;;UAWA;UACA;UACA;UAOA;UAGA;UAMA;;;;;;;;UAQA;UACA;UACA;UACA;UAGA;UAGA;UACA;UACA;EAER,cACC,UACA,oBACA,eACA,yBAEA,iBACA,mBACA,uBACA,sBACA,uBACA,uBACA,wBACA,uBACA,uBACA,kBACA,WACE,uBACF,WACA,WACA,SACA,UACA,iBACA,4BACA,cACA,eACA,0BACA,WACA,sBACA,kBACA;SAwBM,UAAU,0BAA0B,kBAC1C,MAAM,GACN,WAAU,YACR,UAAU,WAAW;EAmCxB,kBAAkB,6BACjB,aAAa,IACX,gBACF,WACA,WACA,SACA,UACA,iBACA,4BACA,GACA,eACA,0BACA,cACA,WACA,sBACA,kBACA;;;;;;;;;;;;;;;;;EAwDD,gBAAgB,UAAU,eAAe,iBACxC,SAAS,IACP,gBACF,WACA,WACA,SACA,UACA,iBACA,4BACA,cACA,eACA,0BACA,cACA,WACA,sBACA,mBAAmB,GACnB;;;;;;;;;;;EAiDD,WACC,MACG,gCACM,mBACN,gCAED,gBACF,WACA,WACA,SACA,UACA,iBACA,4BACA,cACA,eACA,0BACA,cACA,WACA,sBACA,kBACA;EAqDD,MAAM,sBACL,MAAM,QACJ,gBACF,WACA,UAAU,WAAW,QACrB,SACA,UACA,iBACA,4BACA,cACA,eACA,0BACA,cACA,WACA,sBACA,kBACA;EAsCD,UACC,IAAI,YAAY,WAAW,SAAS,qBAAqB,aACvD,gBACF,WACA,WACA,SACA,UACA,iBACA,4BACA,cACA,eACA,0BACA,cACA,WACA,sBACA,kBACA;;;;;;;;;;;;EAgDD,gBAAgB,mBAAmB,cAClC,YAAY,IACV,oBACE,WAAW,OAAO,YACtB,WACA,SACA,UACA,iBACA,4BACA,cACA,eACA,0BACA,cACA,WACA,sBACA,kBACA,cAAc,WAAW,OAAO,YAAY,UAAU;EA+BvD,SAAS,UAAU,WAClB,UAAU,IACR,oBACE,MAAM,YACV,WACA,SACA,UACA,iBACA,4BACA,cACA,eACA,0BACA,cACA,WACA,sBACA,kBACA,cAAc,MAAM,YAAY,UAAU;EA8C3C,OAAO,UAAU,QAChB,QAAQ,IACN,gBACF,WACA,WACA,GACA,UACA,iBACA,4BACA,cACA,eACA,0BACA,cACA,WACA,sBACA,kBACA,UAAU,WAAW,UAAU;EAoDhC,UACC,UAAU,qBACV,sCAEA,WAAW,QAAQ,cAAc,KAC/B,gBACF,WACA,WACA,SACA,UACA,GACA,cACA,cACA,eACA,0BACA,cACA,WACA,sBACA,kBACA;EAoCD,QAAQ,GACP,SAAS,UAAU,WAAW,SAAS,GAAG,aACxC,gBACF,WACA,WACA,SACA,GACA,iBACA,4BACA,cACA,eACA,0BACA,cACA,WACA,sBACA,kBACA,UAAU,WAAW,GAAG;;;;;EAmDzB,SAAS,GAAG,sBACX,QAAQ,WAAW,OAAO,KAAK,QAAQ,OAAO,KAC5C,gBACF,WACA,WACA,SACA,UACA,iBACA,4BACA,cACA,eACA,0BACA,cACA,GACA,OACA,kBACA;;;;;;EAgDD,QAAQ,UAAU,mBAAmB,sBACpC,SAAS,QAAQ,OAAO,KACtB,gBACF,WACA,WACA,SACA,UACA,iBACA,4BACA,cACA,GACA,OACA,0BAA0B,IAC1B,WACA,sBACA,kBACA;;;;;EA6CD,MACC,WAAW,eAAe,WAAW,UAAU,WAC7C,gBACF,WACA,WACA,SACA,UACA,iBACA,4BACA,cACA,eACA,0BACA,cACA,WACA,sBACA,kBACA;;;;;;;;;;;;;;;;;;;EAsDD,IAAI,gBAAgB,UAAU,WAAW,UAAU,UAClD,QAAQ,UACN,gBACF,WACA,WACA,SACA,UACA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|
|
3
3
|
import { c as ServicesOf, r as Consumable } from "./construct-interface-DIaTNKax.cjs";
|
|
4
4
|
import { t as HttpMethod } from "./types-DMuSQeLL.cjs";
|
|
5
|
-
import { C as Authorizer, O as SecurityScheme, S as MappedAudit, T as BuiltInSecuritySchemeId, _ as RlsBypass, c as EndpointSchemas, f as SessionFn, i as Endpoint, l as EndpointSurface, o as EndpointHandler, p as SuccessStatus, t as AuthorizeFn, v as RlsConfig, x as ActorExtractor } from "./Endpoint-
|
|
5
|
+
import { C as Authorizer, O as SecurityScheme, S as MappedAudit, T as BuiltInSecuritySchemeId, _ as RlsBypass, c as EndpointSchemas, f as SessionFn, i as Endpoint, l as EndpointSurface, o as EndpointHandler, p as SuccessStatus, t as AuthorizeFn, v as RlsConfig, x as ActorExtractor } from "./Endpoint-CjvraSfp.cjs";
|
|
6
6
|
import { EventPublisher, MappedEvent } from "@geekmidas/events";
|
|
7
7
|
import { Logger } from "@geekmidas/logger";
|
|
8
8
|
import { Service } from "@geekmidas/services";
|
|
@@ -336,4 +336,4 @@ interface EndpointFactoryOptions<TServices extends Service[] = [], TBasePath ext
|
|
|
336
336
|
}
|
|
337
337
|
//#endregion
|
|
338
338
|
export { EndpointBuilder as n, EndpointFactory as t };
|
|
339
|
-
//# sourceMappingURL=EndpointFactory-
|
|
339
|
+
//# sourceMappingURL=EndpointFactory-vfC3NiJi.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EndpointFactory-
|
|
1
|
+
{"version":3,"file":"EndpointFactory-vfC3NiJi.d.cts","names":[],"sources":["../src/endpoints/EndpointBuilder.ts","../src/endpoints/EndpointFactory.ts"],"mappings":";;;;;;;;;;;cAuCa,gBACZ,uBACA,gBAAgB,YAChB,eAAe,sBACf,kBAAkB,gBAClB,gBAAgB,SAAS,QACzB,kBAAkB,0CAClB,oBACA,wBAAwB,6CACxB,oDACA,4DACA,sBAAsB,sCACtB,kDACA,qBAAqB,mCAAmC,kCAIxD,uBACA,s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F,QACA,SACA,KAAK;IAAsB,QAAQ;KACnC,WACA,SACA,WACA,UACA,iBACA,4BACA,cACA,eACA,0BACA,cACA,WACA;EAOD,UACC,IAAI,YAAY,WAAW,SAAS,UAAU,QAAQ;EAKvD,UAAU,QAAQ;EAIlB,WACC,MAAM,gCACJ,gBACF,QACA,SACA,QACA,WACA,SACA,WACA,UACA,iBACA,4BACA,cACA,eACA,0BACA,cACA,WACA;;;;;;;;;;;;EAkCD,gBAAgB,mBAAmB,cAClC,YAAY,IACV,gBACF,QACA,SACA,YACI,cAAc,WAAW,KAC7B,SACA,WACA,UACA,iBACA,4BACA,cACA,eACA,0BACA,cACA,WACA;EAoCD,SAAS,UAAU,WAClB,UAAU,IACR,gBACF,QACA,SACA,YACI,cAAc,IAClB,SACA,WACA,UACA,iBACA,4BACA,cACA,eACA,0BACA,cACA,WACA;EA0BD,OAAO,UAAU,QAChB,QAAQ,IACN,gBACF,QACA,SACA,QACA,WACA,GACA,WACA,UACA,iBACA,4BACA,cACA,eACA,0BACA,cACA,WACA;EAuBD,OAAO,UAAU,kBAChB,QAAQ,IACN,gBACF,QACA,SACA,QACA,WACA,SACA,GACA,UACA,iBACA,4BACA,cACA,eACA,0BACA,cACA,WACA;;;;;;EA4BQ,QAAQ,UAAU,mBAAmB,sBAC7C,SAAS,QAAQ,OAAO,KACtB,gBACF,QACA,SACA,QACA,WACA,SACA,WACA,UACA,iBACA,4BACA,cACA,GACA,OACA,0BAA0B,IAC1B,WACA;;;;;EA8BD,MACC,WAAW,eAAe,WAAW,UAAU,WAC7C,gBACF,QACA,SACA,QACA,WACA,SACA,WACA,UACA,iBACA,4BACA,cACA,eACA,0BACA,cACA,WACA;;;;;;;;;;;;;;;;;;EAsBD,MAAM,QAAQ,YAAY,cAAc;;;;;;;;;;;;;;;;EAmB/B,SAAS,GAAG,sBACpB,QAAQ,WAAW,OAAO,KAAK,QAAQ,OAAO,KAC5C,gBACF,QACA,SACA,QACA,WACA,SACA,WACA,UACA,iBACA,4BACA,cACA,eACA,0BACA,cACA,GACA;;;;;;;;;;;;;;;;;;;;EA+CD,IACC,QAAQ,UAAU,WAAW,UAAU,mBAAmB;;;;;;;;;;;;;;EAyB3D;EAKA,MAAM;EAMN,OACC,IAAI,gBACH,QACA,WACA,SACA,WACA,UACA,WACA,eACA,gBAEC,SACF,QACA,SACA,QACA,WACA,WACA,SACA,UACA,iBACA,4BACA,eACA,0BACA,cACA,WACA;;;;cC3uBW,gBACZ,kBAAkB,gBAClB,+BACA,gBAAgB,SAAS,QACzB,oBACA,wBAAwB,6CACxB,oDACA,4DACA,sBAAsB,2CACtB,kDACA,qBAAqB,mCAGjB,0BAA0B,YAAY,iBAC1C,uBACA,8CACA,yBAAyB,eAAe,kBAAkB,eAEzD,iBAED,mBACG,UAAU,WAAW,UAAU;UAG1B;;;;;;;;;;;UAWA;UACA;UACA;UAOA;UAGA;UAMA;;;;;;;;UAQA;UACA;UACA;UACA;UAGA;UAGA;UACA;UACA;EAER,cACC,UACA,oBACA,eACA,yBAEA,iBACA,mBACA,uBACA,sBACA,uBACA,uBACA,wBACA,uBACA,uBACA,kBACA,WACE,uBACF,WACA,WACA,SACA,UACA,iBACA,4BACA,cACA,eACA,0BACA,WACA,sBACA,kBACA;SAwBM,UAAU,0BAA0B,kBAC1C,MAAM,GACN,WAAU,YACR,UAAU,WAAW;EAmCxB,kBAAkB,6BACjB,aAAa,IACX,gBACF,WACA,WACA,SACA,UACA,iBACA,4BACA,GACA,eACA,0BACA,cACA,WACA,sBACA,kBACA;;;;;;;;;;;;;;;;;EAwDD,gBAAgB,UAAU,eAAe,iBACxC,SAAS,IACP,gBACF,WACA,WACA,SACA,UACA,iBACA,4BACA,cACA,eACA,0BACA,cACA,WACA,sBACA,mBAAmB,GACnB;;;;;;;;;;;EAiDD,WACC,MACG,gCACM,mBACN,gCAED,gBACF,WACA,WACA,SACA,UACA,iBACA,4BACA,cACA,eACA,0BACA,cACA,WACA,sBACA,kBACA;EAqDD,MAAM,sBACL,MAAM,QACJ,gBACF,WACA,UAAU,WAAW,QACrB,SACA,UACA,iBACA,4BACA,cACA,eACA,0BACA,cACA,WACA,sBACA,kBACA;EAsCD,UACC,IAAI,YAAY,WAAW,SAAS,qBAAqB,aACvD,gBACF,WACA,WACA,SACA,UACA,iBACA,4BACA,cACA,eACA,0BACA,cACA,WACA,sBACA,kBACA;;;;;;;;;;;;EAgDD,gBAAgB,mBAAmB,cAClC,YAAY,IACV,oBACE,WAAW,OAAO,YACtB,WACA,SACA,UACA,iBACA,4BACA,cACA,eACA,0BACA,cACA,WACA,sBACA,kBACA,cAAc,WAAW,OAAO,YAAY,UAAU;EA+BvD,SAAS,UAAU,WAClB,UAAU,IACR,oBACE,MAAM,YACV,WACA,SACA,UACA,iBACA,4BACA,cACA,eACA,0BACA,cACA,WACA,sBACA,kBACA,cAAc,MAAM,YAAY,UAAU;EA8C3C,OAAO,UAAU,QAChB,QAAQ,IACN,gBACF,WACA,WACA,GACA,UACA,iBACA,4BACA,cACA,eACA,0BACA,cACA,WACA,sBACA,kBACA,UAAU,WAAW,UAAU;EAoDhC,UACC,UAAU,qBACV,sCAEA,WAAW,QAAQ,cAAc,KAC/B,gBACF,WACA,WACA,SACA,UACA,GACA,cACA,cACA,eACA,0BACA,cACA,WACA,sBACA,kBACA;EAoCD,QAAQ,GACP,SAAS,UAAU,WAAW,SAAS,GAAG,aACxC,gBACF,WACA,WACA,SACA,GACA,iBACA,4BACA,cACA,eACA,0BACA,cACA,WACA,sBACA,kBACA,UAAU,WAAW,GAAG;;;;;EAmDzB,SAAS,GAAG,sBACX,QAAQ,WAAW,OAAO,KAAK,QAAQ,OAAO,KAC5C,gBACF,WACA,WACA,SACA,UACA,iBACA,4BACA,cACA,eACA,0BACA,cACA,GACA,OACA,kBACA;;;;;;EAgDD,QAAQ,UAAU,mBAAmB,sBACpC,SAAS,QAAQ,OAAO,KACtB,gBACF,WACA,WACA,SACA,UACA,iBACA,4BACA,cACA,GACA,OACA,0BAA0B,IAC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0B;EAC1D,yBAAyB,QAAQ,sBAAsB;EACvD,wBAAwB,eAAe,WAAW,UAAU;EAC5D,wBAAwB;EACxB,mBAAmB;;;;;;;;;;;EAWnB,SAAS"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
const require_Construct = require("./Construct-yG9Sw-5p.cjs");
|
|
2
|
+
let _geekmidas_manifest = require("@geekmidas/manifest");
|
|
3
|
+
let _geekmidas_logger_console = require("@geekmidas/logger/console");
|
|
4
|
+
let _geekmidas_events = require("@geekmidas/events");
|
|
5
|
+
//#region src/queue/Queue.ts
|
|
6
|
+
/**
|
|
7
|
+
* A queue worker — a point-to-point SQS-style queue and its single consumer.
|
|
8
|
+
* Unlike a `Subscriber` (topic fan-out, filtered by `subscribedEvents`), a queue
|
|
9
|
+
* drains every message of its one `message` type. Build one with `q` (see
|
|
10
|
+
* `QueueBuilder`); `gkm build` discovers it into the manifest's `queues` field.
|
|
11
|
+
*
|
|
12
|
+
* The producer side is {@link Queue.publisher} — a ready-to-inject `Service`
|
|
13
|
+
* that any endpoint/function drops into `.services([...])` to send messages.
|
|
14
|
+
*/
|
|
15
|
+
var Queue = class extends require_Construct.Construct {
|
|
16
|
+
name;
|
|
17
|
+
handler;
|
|
18
|
+
messageSchema;
|
|
19
|
+
timeout;
|
|
20
|
+
services;
|
|
21
|
+
logger;
|
|
22
|
+
batchSize;
|
|
23
|
+
fifo;
|
|
24
|
+
__IS_QUEUE__ = true;
|
|
25
|
+
static isQueue(obj) {
|
|
26
|
+
return Boolean(obj && obj.__IS_QUEUE__ === true && obj.type === "dev.geekmidas.function.queue");
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The canonical id this queue is declared under.
|
|
30
|
+
*
|
|
31
|
+
* Derived from the name rather than given separately, so `emails` and
|
|
32
|
+
* `Emails` are one queue. The name stays what it was: it is the wire `type`
|
|
33
|
+
* a producer sends and the worker subscribes to, and changing that would
|
|
34
|
+
* silently orphan in-flight messages.
|
|
35
|
+
*/
|
|
36
|
+
id;
|
|
37
|
+
/**
|
|
38
|
+
* The producer's env key. Read by both {@link declare} and
|
|
39
|
+
* {@link publisher}, so what the target publishes and what the producer
|
|
40
|
+
* looks up cannot drift.
|
|
41
|
+
*/
|
|
42
|
+
connectionKey;
|
|
43
|
+
constructor(name, handler, messageSchema, timeout = 3e4, services = [], logger = _geekmidas_logger_console.DEFAULT_LOGGER, batchSize, fifo, constructs = []) {
|
|
44
|
+
super("dev.geekmidas.function.queue", logger, services, [], void 0, void 0, timeout, void 0, void 0, constructs);
|
|
45
|
+
this.name = name;
|
|
46
|
+
this.handler = handler;
|
|
47
|
+
this.messageSchema = messageSchema;
|
|
48
|
+
this.timeout = timeout;
|
|
49
|
+
this.services = services;
|
|
50
|
+
this.logger = logger;
|
|
51
|
+
this.batchSize = batchSize;
|
|
52
|
+
this.fifo = fifo;
|
|
53
|
+
this.id = (0, _geekmidas_manifest.canonicalId)(name);
|
|
54
|
+
this.connectionKey = (0, _geekmidas_manifest.provideKey)(this.id, "publisherConnectionString");
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* What this queue is in the manifest.
|
|
58
|
+
*
|
|
59
|
+
* A queue is a resource, not a handler: the worker is reached *through* it,
|
|
60
|
+
* so the declaration carries the producer's key and nothing about the code
|
|
61
|
+
* that drains it. The local target reads this to know which broker has to be
|
|
62
|
+
* running and what connection string to inject.
|
|
63
|
+
*/
|
|
64
|
+
declare() {
|
|
65
|
+
return [{
|
|
66
|
+
kind: "queue",
|
|
67
|
+
id: this.id,
|
|
68
|
+
provides: [this.connectionKey],
|
|
69
|
+
...this.fifo ? { fifo: true } : {},
|
|
70
|
+
worker: {
|
|
71
|
+
id: `${this.id}Worker`,
|
|
72
|
+
handler: `${this.id}.handler`,
|
|
73
|
+
dependencies: []
|
|
74
|
+
}
|
|
75
|
+
}];
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The producer side — a `Service` exposing an `EventPublisher` typed to this
|
|
79
|
+
* queue's message. Inject it via `.services([queue.publisher])`; the handler
|
|
80
|
+
* then calls `services.<name>Publisher.publish([{ type, payload }])`.
|
|
81
|
+
*
|
|
82
|
+
* It reads `<NAME>_PUBLISHER_CONNECTION_STRING` and builds the transport from
|
|
83
|
+
* the URL protocol — `pgboss://` locally, `sqs://` deployed — so the same
|
|
84
|
+
* code publishes to Postgres in dev and SQS in prod. Because it's a `Service`,
|
|
85
|
+
* `Construct.getEnvironment()` sniffs it, so the env requirement flows into
|
|
86
|
+
* the manifest and infra links exactly this queue with least privilege.
|
|
87
|
+
*/
|
|
88
|
+
/**
|
|
89
|
+
* The queue as a dependency — what `.dependsOn([emailsQueue])` dissolves
|
|
90
|
+
* into, reachable as `services.emails`.
|
|
91
|
+
*
|
|
92
|
+
* It is the producer: a consumer is the worker written right here, so the
|
|
93
|
+
* only thing another construct can want from a queue is the ability to send
|
|
94
|
+
* to it. {@link publisher} is the same service under its older
|
|
95
|
+
* `<name>Publisher` key, kept for `.services([queue.publisher])`.
|
|
96
|
+
*/
|
|
97
|
+
get service() {
|
|
98
|
+
const { register } = this.publisher;
|
|
99
|
+
return {
|
|
100
|
+
serviceName: (0, _geekmidas_manifest.serviceKey)(this.id),
|
|
101
|
+
register
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
get publisher() {
|
|
105
|
+
const envVar = this.connectionKey;
|
|
106
|
+
return {
|
|
107
|
+
serviceName: `${this.name}Publisher`,
|
|
108
|
+
async register({ envParser }) {
|
|
109
|
+
const { connectionString } = envParser.create((get) => ({ connectionString: get(envVar).string() })).parse();
|
|
110
|
+
return _geekmidas_events.Publisher.fromConnectionString(connectionString);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
//#endregion
|
|
116
|
+
Object.defineProperty(exports, "Queue", {
|
|
117
|
+
enumerable: true,
|
|
118
|
+
get: function() {
|
|
119
|
+
return Queue;
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
//# sourceMappingURL=Queue-BB2-DgqJ.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Queue-BB2-DgqJ.cjs","names":["Construct","DEFAULT_LOGGER","canonicalId","provideKey","serviceKey","Publisher"],"sources":["../src/queue/Queue.ts"],"sourcesContent":["import {\n\ttype EventPublisher,\n\ttype EventPublisherConnectionString,\n\ttype PublishableMessage,\n\tPublisher,\n} from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport { DEFAULT_LOGGER } from '@geekmidas/logger/console';\nimport {\n\tcanonicalId,\n\ttype Declaration,\n\tprovideKey,\n\tserviceKey,\n} from '@geekmidas/manifest';\nimport type { InferStandardSchema } from '@geekmidas/schema';\nimport type { Service, ServiceRecord } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport { Construct, ConstructType } from '../Construct';\n\n/**\n * The wire message a queue carries: `{ type: <queue name>, payload: <message> }`.\n * The producer publishes this shape and the worker receives the `payload`s as\n * its `messages`. Typing `type` to the queue name keeps the publisher fully\n * typed and lets pg-boss (local) / SQS (deployed) route by name.\n */\nexport type QueueMessage<\n\tTName extends string,\n\tTMessage extends StandardSchemaV1,\n> = PublishableMessage<TName, InferStandardSchema<TMessage>>;\n\n/**\n * A queue worker — a point-to-point SQS-style queue and its single consumer.\n * Unlike a `Subscriber` (topic fan-out, filtered by `subscribedEvents`), a queue\n * drains every message of its one `message` type. Build one with `q` (see\n * `QueueBuilder`); `gkm build` discovers it into the manifest's `queues` field.\n *\n * The producer side is {@link Queue.publisher} — a ready-to-inject `Service`\n * that any endpoint/function drops into `.services([...])` to send messages.\n */\nexport class Queue<\n\tTName extends string = string,\n\tTMessage extends StandardSchemaV1 = StandardSchemaV1,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n> extends Construct<TLogger, string, undefined, undefined, TServices> {\n\t__IS_QUEUE__ = true;\n\n\tstatic isQueue(\n\t\tobj: unknown,\n\t): obj is Queue<string, StandardSchemaV1, Service[], Logger> {\n\t\treturn Boolean(\n\t\t\tobj &&\n\t\t\t\t(obj as { __IS_QUEUE__?: boolean }).__IS_QUEUE__ === true &&\n\t\t\t\t(obj as Construct).type === ConstructType.Queue,\n\t\t);\n\t}\n\n\t/**\n\t * The canonical id this queue is declared under.\n\t *\n\t * Derived from the name rather than given separately, so `emails` and\n\t * `Emails` are one queue. The name stays what it was: it is the wire `type`\n\t * a producer sends and the worker subscribes to, and changing that would\n\t * silently orphan in-flight messages.\n\t */\n\treadonly id: string;\n\n\t/**\n\t * The producer's env key. Read by both {@link declare} and\n\t * {@link publisher}, so what the target publishes and what the producer\n\t * looks up cannot drift.\n\t */\n\tprivate readonly connectionKey: string;\n\n\tconstructor(\n\t\tpublic readonly name: TName,\n\t\tpublic readonly handler: QueueHandler<TMessage, TServices, TLogger>,\n\t\tpublic readonly messageSchema: TMessage,\n\t\tpublic override readonly timeout: number = 30000,\n\t\tpublic override readonly services: TServices = [] as unknown as TServices,\n\t\tpublic override readonly logger: TLogger = DEFAULT_LOGGER as TLogger,\n\t\t/** SQS event-source batch size (deployed). */\n\t\tpublic readonly batchSize?: number,\n\t\t/** Whether the queue is FIFO (deployed). */\n\t\tpublic readonly fifo?: boolean,\n\t\t/**\n\t\t * The construct ids the *worker* `.dependsOn()` named — last, so no\n\t\t * existing positional argument moves.\n\t\t */\n\t\tconstructs: string[] = [],\n\t) {\n\t\tsuper(\n\t\t\tConstructType.Queue,\n\t\t\tlogger,\n\t\t\tservices,\n\t\t\t[],\n\t\t\tundefined,\n\t\t\tundefined,\n\t\t\ttimeout,\n\t\t\tundefined, // memorySize\n\t\t\tundefined, // auditorStorageService\n\t\t\tconstructs,\n\t\t);\n\n\t\tthis.id = canonicalId(name);\n\t\tthis.connectionKey = provideKey(this.id, 'publisherConnectionString');\n\t}\n\n\t/**\n\t * What this queue is in the manifest.\n\t *\n\t * A queue is a resource, not a handler: the worker is reached *through* it,\n\t * so the declaration carries the producer's key and nothing about the code\n\t * that drains it. The local target reads this to know which broker has to be\n\t * running and what connection string to inject.\n\t */\n\tdeclare(): Declaration[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkind: 'queue',\n\t\t\t\tid: this.id,\n\t\t\t\tprovides: [this.connectionKey],\n\t\t\t\t...(this.fifo ? { fifo: true } : {}),\n\t\t\t\t// Nested rather than a sibling node, because position carries the\n\t\t\t\t// trigger: this handler is reached by messages on this queue and\n\t\t\t\t// by nothing else, so there is no `trigger` field to keep in step.\n\t\t\t\t//\n\t\t\t\t// `handler` is the export name; which directory the build wrote it\n\t\t\t\t// to is the target's business, and a path with a cloud in it does\n\t\t\t\t// not belong in a neutral declaration.\n\t\t\t\tworker: {\n\t\t\t\t\tid: `${this.id}Worker`,\n\t\t\t\t\thandler: `${this.id}.handler`,\n\t\t\t\t\t// Filled by the build from what the worker declared. Empty is a\n\t\t\t\t\t// stated gap, not a claim that it reaches nothing.\n\t\t\t\t\tdependencies: [],\n\t\t\t\t},\n\t\t\t},\n\t\t];\n\t}\n\n\t/**\n\t * The producer side — a `Service` exposing an `EventPublisher` typed to this\n\t * queue's message. Inject it via `.services([queue.publisher])`; the handler\n\t * then calls `services.<name>Publisher.publish([{ type, payload }])`.\n\t *\n\t * It reads `<NAME>_PUBLISHER_CONNECTION_STRING` and builds the transport from\n\t * the URL protocol — `pgboss://` locally, `sqs://` deployed — so the same\n\t * code publishes to Postgres in dev and SQS in prod. Because it's a `Service`,\n\t * `Construct.getEnvironment()` sniffs it, so the env requirement flows into\n\t * the manifest and infra links exactly this queue with least privilege.\n\t */\n\t/**\n\t * The queue as a dependency — what `.dependsOn([emailsQueue])` dissolves\n\t * into, reachable as `services.emails`.\n\t *\n\t * It is the producer: a consumer is the worker written right here, so the\n\t * only thing another construct can want from a queue is the ability to send\n\t * to it. {@link publisher} is the same service under its older\n\t * `<name>Publisher` key, kept for `.services([queue.publisher])`.\n\t */\n\tget service(): Service<\n\t\tUncapitalize<TName>,\n\t\tEventPublisher<QueueMessage<TName, TMessage>>\n\t> {\n\t\tconst { register } = this.publisher;\n\n\t\treturn {\n\t\t\tserviceName: serviceKey(this.id) as Uncapitalize<TName>,\n\t\t\tregister,\n\t\t};\n\t}\n\n\tget publisher(): Service<\n\t\t`${TName}Publisher`,\n\t\tEventPublisher<QueueMessage<TName, TMessage>>\n\t> {\n\t\tconst envVar = this.connectionKey;\n\t\treturn {\n\t\t\tserviceName: `${this.name}Publisher`,\n\t\t\tasync register({ envParser }) {\n\t\t\t\tconst { connectionString } = envParser\n\t\t\t\t\t.create((get) => ({\n\t\t\t\t\t\tconnectionString: get(envVar).string(),\n\t\t\t\t\t}))\n\t\t\t\t\t.parse();\n\n\t\t\t\treturn Publisher.fromConnectionString<QueueMessage<TName, TMessage>>(\n\t\t\t\t\tconnectionString as EventPublisherConnectionString,\n\t\t\t\t);\n\t\t\t},\n\t\t};\n\t}\n}\n\n/** The context a queue handler receives — a batch of typed messages. */\nexport type QueueContext<\n\tTMessage extends StandardSchemaV1,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n> = {\n\tmessages: InferStandardSchema<TMessage>[];\n\tservices: ServiceRecord<TServices>;\n\tlogger: TLogger;\n};\n\nexport type QueueHandler<\n\tTMessage extends StandardSchemaV1,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n> = (\n\tctx: QueueContext<TMessage, TServices, TLogger>,\n) => unknown | Promise<unknown>;\n"],"mappings":";;;;;;;;;;;;;;AAuCA,IAAa,QAAb,cAKUA,kBAAAA,UAA4D;CA+BpD;CACA;CACA;CACS;CACA;CACA;CAET;CAEA;CAvCjB,eAAe;CAEf,OAAO,QACN,KAC4D;EAC5D,OAAO,QACN,OACE,IAAmC,iBAAiB,QACpD,IAAkB,SAAA,8BACrB;CACD;;;;;;;;;CAUA;;;;;;CAOA;CAEA,YACC,MACA,SACA,eACA,UAA2C,KAC3C,WAA+C,CAAC,GAChD,SAA2CC,0BAAAA,gBAE3C,WAEA,MAKA,aAAuB,CAAC,GACvB;EACD,MAAA,gCAEC,QACA,UACA,CAAC,GACD,KAAA,GACA,KAAA,GACA,SACA,KAAA,GACA,KAAA,GACA,UACD;EA3BgB,KAAA,OAAA;EACA,KAAA,UAAA;EACA,KAAA,gBAAA;EACS,KAAA,UAAA;EACA,KAAA,WAAA;EACA,KAAA,SAAA;EAET,KAAA,YAAA;EAEA,KAAA,OAAA;EAoBhB,KAAK,MAAA,GAAKC,oBAAAA,YAAAA,CAAY,IAAI;EAC1B,KAAK,iBAAA,GAAgBC,oBAAAA,WAAAA,CAAW,KAAK,IAAI,2BAA2B;CACrE;;;;;;;;;CAUA,UAAyB;EACxB,OAAO,CACN;GACC,MAAM;GACN,IAAI,KAAK;GACT,UAAU,CAAC,KAAK,aAAa;GAC7B,GAAI,KAAK,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;GAQlC,QAAQ;IACP,IAAI,GAAG,KAAK,GAAG;IACf,SAAS,GAAG,KAAK,GAAG;IAGpB,cAAc,CAAC;GAChB;EACD,CACD;CACD;;;;;;;;;;;;;;;;;;;;;CAsBA,IAAI,UAGF;EACD,MAAM,EAAE,aAAa,KAAK;EAE1B,OAAO;GACN,cAAA,GAAaC,oBAAAA,WAAAA,CAAW,KAAK,EAAE;GAC/B;EACD;CACD;CAEA,IAAI,YAGF;EACD,MAAM,SAAS,KAAK;EACpB,OAAO;GACN,aAAa,GAAG,KAAK,KAAK;GAC1B,MAAM,SAAS,EAAE,aAAa;IAC7B,MAAM,EAAE,qBAAqB,UAC3B,QAAQ,SAAS,EACjB,kBAAkB,IAAI,MAAM,CAAC,CAAC,OAAO,EACtC,EAAE,CAAC,CACF,MAAM;IAER,OAAOC,kBAAAA,UAAU,qBAChB,gBACD;GACD;EACD;CACD;AACD"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { t as Construct } from "./Construct-Detz65RA.mjs";
|
|
2
|
+
import { canonicalId, provideKey, serviceKey } from "@geekmidas/manifest";
|
|
3
|
+
import { DEFAULT_LOGGER } from "@geekmidas/logger/console";
|
|
4
|
+
import { Publisher } from "@geekmidas/events";
|
|
5
|
+
//#region src/queue/Queue.ts
|
|
6
|
+
/**
|
|
7
|
+
* A queue worker — a point-to-point SQS-style queue and its single consumer.
|
|
8
|
+
* Unlike a `Subscriber` (topic fan-out, filtered by `subscribedEvents`), a queue
|
|
9
|
+
* drains every message of its one `message` type. Build one with `q` (see
|
|
10
|
+
* `QueueBuilder`); `gkm build` discovers it into the manifest's `queues` field.
|
|
11
|
+
*
|
|
12
|
+
* The producer side is {@link Queue.publisher} — a ready-to-inject `Service`
|
|
13
|
+
* that any endpoint/function drops into `.services([...])` to send messages.
|
|
14
|
+
*/
|
|
15
|
+
var Queue = class extends Construct {
|
|
16
|
+
name;
|
|
17
|
+
handler;
|
|
18
|
+
messageSchema;
|
|
19
|
+
timeout;
|
|
20
|
+
services;
|
|
21
|
+
logger;
|
|
22
|
+
batchSize;
|
|
23
|
+
fifo;
|
|
24
|
+
__IS_QUEUE__ = true;
|
|
25
|
+
static isQueue(obj) {
|
|
26
|
+
return Boolean(obj && obj.__IS_QUEUE__ === true && obj.type === "dev.geekmidas.function.queue");
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The canonical id this queue is declared under.
|
|
30
|
+
*
|
|
31
|
+
* Derived from the name rather than given separately, so `emails` and
|
|
32
|
+
* `Emails` are one queue. The name stays what it was: it is the wire `type`
|
|
33
|
+
* a producer sends and the worker subscribes to, and changing that would
|
|
34
|
+
* silently orphan in-flight messages.
|
|
35
|
+
*/
|
|
36
|
+
id;
|
|
37
|
+
/**
|
|
38
|
+
* The producer's env key. Read by both {@link declare} and
|
|
39
|
+
* {@link publisher}, so what the target publishes and what the producer
|
|
40
|
+
* looks up cannot drift.
|
|
41
|
+
*/
|
|
42
|
+
connectionKey;
|
|
43
|
+
constructor(name, handler, messageSchema, timeout = 3e4, services = [], logger = DEFAULT_LOGGER, batchSize, fifo, constructs = []) {
|
|
44
|
+
super("dev.geekmidas.function.queue", logger, services, [], void 0, void 0, timeout, void 0, void 0, constructs);
|
|
45
|
+
this.name = name;
|
|
46
|
+
this.handler = handler;
|
|
47
|
+
this.messageSchema = messageSchema;
|
|
48
|
+
this.timeout = timeout;
|
|
49
|
+
this.services = services;
|
|
50
|
+
this.logger = logger;
|
|
51
|
+
this.batchSize = batchSize;
|
|
52
|
+
this.fifo = fifo;
|
|
53
|
+
this.id = canonicalId(name);
|
|
54
|
+
this.connectionKey = provideKey(this.id, "publisherConnectionString");
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* What this queue is in the manifest.
|
|
58
|
+
*
|
|
59
|
+
* A queue is a resource, not a handler: the worker is reached *through* it,
|
|
60
|
+
* so the declaration carries the producer's key and nothing about the code
|
|
61
|
+
* that drains it. The local target reads this to know which broker has to be
|
|
62
|
+
* running and what connection string to inject.
|
|
63
|
+
*/
|
|
64
|
+
declare() {
|
|
65
|
+
return [{
|
|
66
|
+
kind: "queue",
|
|
67
|
+
id: this.id,
|
|
68
|
+
provides: [this.connectionKey],
|
|
69
|
+
...this.fifo ? { fifo: true } : {},
|
|
70
|
+
worker: {
|
|
71
|
+
id: `${this.id}Worker`,
|
|
72
|
+
handler: `${this.id}.handler`,
|
|
73
|
+
dependencies: []
|
|
74
|
+
}
|
|
75
|
+
}];
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The producer side — a `Service` exposing an `EventPublisher` typed to this
|
|
79
|
+
* queue's message. Inject it via `.services([queue.publisher])`; the handler
|
|
80
|
+
* then calls `services.<name>Publisher.publish([{ type, payload }])`.
|
|
81
|
+
*
|
|
82
|
+
* It reads `<NAME>_PUBLISHER_CONNECTION_STRING` and builds the transport from
|
|
83
|
+
* the URL protocol — `pgboss://` locally, `sqs://` deployed — so the same
|
|
84
|
+
* code publishes to Postgres in dev and SQS in prod. Because it's a `Service`,
|
|
85
|
+
* `Construct.getEnvironment()` sniffs it, so the env requirement flows into
|
|
86
|
+
* the manifest and infra links exactly this queue with least privilege.
|
|
87
|
+
*/
|
|
88
|
+
/**
|
|
89
|
+
* The queue as a dependency — what `.dependsOn([emailsQueue])` dissolves
|
|
90
|
+
* into, reachable as `services.emails`.
|
|
91
|
+
*
|
|
92
|
+
* It is the producer: a consumer is the worker written right here, so the
|
|
93
|
+
* only thing another construct can want from a queue is the ability to send
|
|
94
|
+
* to it. {@link publisher} is the same service under its older
|
|
95
|
+
* `<name>Publisher` key, kept for `.services([queue.publisher])`.
|
|
96
|
+
*/
|
|
97
|
+
get service() {
|
|
98
|
+
const { register } = this.publisher;
|
|
99
|
+
return {
|
|
100
|
+
serviceName: serviceKey(this.id),
|
|
101
|
+
register
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
get publisher() {
|
|
105
|
+
const envVar = this.connectionKey;
|
|
106
|
+
return {
|
|
107
|
+
serviceName: `${this.name}Publisher`,
|
|
108
|
+
async register({ envParser }) {
|
|
109
|
+
const { connectionString } = envParser.create((get) => ({ connectionString: get(envVar).string() })).parse();
|
|
110
|
+
return Publisher.fromConnectionString(connectionString);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
//#endregion
|
|
116
|
+
export { Queue as t };
|
|
117
|
+
|
|
118
|
+
//# sourceMappingURL=Queue-Dfumm1WR.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Queue-Dfumm1WR.mjs","names":[],"sources":["../src/queue/Queue.ts"],"sourcesContent":["import {\n\ttype EventPublisher,\n\ttype EventPublisherConnectionString,\n\ttype PublishableMessage,\n\tPublisher,\n} from '@geekmidas/events';\nimport type { Logger } from '@geekmidas/logger';\nimport { DEFAULT_LOGGER } from '@geekmidas/logger/console';\nimport {\n\tcanonicalId,\n\ttype Declaration,\n\tprovideKey,\n\tserviceKey,\n} from '@geekmidas/manifest';\nimport type { InferStandardSchema } from '@geekmidas/schema';\nimport type { Service, ServiceRecord } from '@geekmidas/services';\nimport type { StandardSchemaV1 } from '@standard-schema/spec';\nimport { Construct, ConstructType } from '../Construct';\n\n/**\n * The wire message a queue carries: `{ type: <queue name>, payload: <message> }`.\n * The producer publishes this shape and the worker receives the `payload`s as\n * its `messages`. Typing `type` to the queue name keeps the publisher fully\n * typed and lets pg-boss (local) / SQS (deployed) route by name.\n */\nexport type QueueMessage<\n\tTName extends string,\n\tTMessage extends StandardSchemaV1,\n> = PublishableMessage<TName, InferStandardSchema<TMessage>>;\n\n/**\n * A queue worker — a point-to-point SQS-style queue and its single consumer.\n * Unlike a `Subscriber` (topic fan-out, filtered by `subscribedEvents`), a queue\n * drains every message of its one `message` type. Build one with `q` (see\n * `QueueBuilder`); `gkm build` discovers it into the manifest's `queues` field.\n *\n * The producer side is {@link Queue.publisher} — a ready-to-inject `Service`\n * that any endpoint/function drops into `.services([...])` to send messages.\n */\nexport class Queue<\n\tTName extends string = string,\n\tTMessage extends StandardSchemaV1 = StandardSchemaV1,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n> extends Construct<TLogger, string, undefined, undefined, TServices> {\n\t__IS_QUEUE__ = true;\n\n\tstatic isQueue(\n\t\tobj: unknown,\n\t): obj is Queue<string, StandardSchemaV1, Service[], Logger> {\n\t\treturn Boolean(\n\t\t\tobj &&\n\t\t\t\t(obj as { __IS_QUEUE__?: boolean }).__IS_QUEUE__ === true &&\n\t\t\t\t(obj as Construct).type === ConstructType.Queue,\n\t\t);\n\t}\n\n\t/**\n\t * The canonical id this queue is declared under.\n\t *\n\t * Derived from the name rather than given separately, so `emails` and\n\t * `Emails` are one queue. The name stays what it was: it is the wire `type`\n\t * a producer sends and the worker subscribes to, and changing that would\n\t * silently orphan in-flight messages.\n\t */\n\treadonly id: string;\n\n\t/**\n\t * The producer's env key. Read by both {@link declare} and\n\t * {@link publisher}, so what the target publishes and what the producer\n\t * looks up cannot drift.\n\t */\n\tprivate readonly connectionKey: string;\n\n\tconstructor(\n\t\tpublic readonly name: TName,\n\t\tpublic readonly handler: QueueHandler<TMessage, TServices, TLogger>,\n\t\tpublic readonly messageSchema: TMessage,\n\t\tpublic override readonly timeout: number = 30000,\n\t\tpublic override readonly services: TServices = [] as unknown as TServices,\n\t\tpublic override readonly logger: TLogger = DEFAULT_LOGGER as TLogger,\n\t\t/** SQS event-source batch size (deployed). */\n\t\tpublic readonly batchSize?: number,\n\t\t/** Whether the queue is FIFO (deployed). */\n\t\tpublic readonly fifo?: boolean,\n\t\t/**\n\t\t * The construct ids the *worker* `.dependsOn()` named — last, so no\n\t\t * existing positional argument moves.\n\t\t */\n\t\tconstructs: string[] = [],\n\t) {\n\t\tsuper(\n\t\t\tConstructType.Queue,\n\t\t\tlogger,\n\t\t\tservices,\n\t\t\t[],\n\t\t\tundefined,\n\t\t\tundefined,\n\t\t\ttimeout,\n\t\t\tundefined, // memorySize\n\t\t\tundefined, // auditorStorageService\n\t\t\tconstructs,\n\t\t);\n\n\t\tthis.id = canonicalId(name);\n\t\tthis.connectionKey = provideKey(this.id, 'publisherConnectionString');\n\t}\n\n\t/**\n\t * What this queue is in the manifest.\n\t *\n\t * A queue is a resource, not a handler: the worker is reached *through* it,\n\t * so the declaration carries the producer's key and nothing about the code\n\t * that drains it. The local target reads this to know which broker has to be\n\t * running and what connection string to inject.\n\t */\n\tdeclare(): Declaration[] {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkind: 'queue',\n\t\t\t\tid: this.id,\n\t\t\t\tprovides: [this.connectionKey],\n\t\t\t\t...(this.fifo ? { fifo: true } : {}),\n\t\t\t\t// Nested rather than a sibling node, because position carries the\n\t\t\t\t// trigger: this handler is reached by messages on this queue and\n\t\t\t\t// by nothing else, so there is no `trigger` field to keep in step.\n\t\t\t\t//\n\t\t\t\t// `handler` is the export name; which directory the build wrote it\n\t\t\t\t// to is the target's business, and a path with a cloud in it does\n\t\t\t\t// not belong in a neutral declaration.\n\t\t\t\tworker: {\n\t\t\t\t\tid: `${this.id}Worker`,\n\t\t\t\t\thandler: `${this.id}.handler`,\n\t\t\t\t\t// Filled by the build from what the worker declared. Empty is a\n\t\t\t\t\t// stated gap, not a claim that it reaches nothing.\n\t\t\t\t\tdependencies: [],\n\t\t\t\t},\n\t\t\t},\n\t\t];\n\t}\n\n\t/**\n\t * The producer side — a `Service` exposing an `EventPublisher` typed to this\n\t * queue's message. Inject it via `.services([queue.publisher])`; the handler\n\t * then calls `services.<name>Publisher.publish([{ type, payload }])`.\n\t *\n\t * It reads `<NAME>_PUBLISHER_CONNECTION_STRING` and builds the transport from\n\t * the URL protocol — `pgboss://` locally, `sqs://` deployed — so the same\n\t * code publishes to Postgres in dev and SQS in prod. Because it's a `Service`,\n\t * `Construct.getEnvironment()` sniffs it, so the env requirement flows into\n\t * the manifest and infra links exactly this queue with least privilege.\n\t */\n\t/**\n\t * The queue as a dependency — what `.dependsOn([emailsQueue])` dissolves\n\t * into, reachable as `services.emails`.\n\t *\n\t * It is the producer: a consumer is the worker written right here, so the\n\t * only thing another construct can want from a queue is the ability to send\n\t * to it. {@link publisher} is the same service under its older\n\t * `<name>Publisher` key, kept for `.services([queue.publisher])`.\n\t */\n\tget service(): Service<\n\t\tUncapitalize<TName>,\n\t\tEventPublisher<QueueMessage<TName, TMessage>>\n\t> {\n\t\tconst { register } = this.publisher;\n\n\t\treturn {\n\t\t\tserviceName: serviceKey(this.id) as Uncapitalize<TName>,\n\t\t\tregister,\n\t\t};\n\t}\n\n\tget publisher(): Service<\n\t\t`${TName}Publisher`,\n\t\tEventPublisher<QueueMessage<TName, TMessage>>\n\t> {\n\t\tconst envVar = this.connectionKey;\n\t\treturn {\n\t\t\tserviceName: `${this.name}Publisher`,\n\t\t\tasync register({ envParser }) {\n\t\t\t\tconst { connectionString } = envParser\n\t\t\t\t\t.create((get) => ({\n\t\t\t\t\t\tconnectionString: get(envVar).string(),\n\t\t\t\t\t}))\n\t\t\t\t\t.parse();\n\n\t\t\t\treturn Publisher.fromConnectionString<QueueMessage<TName, TMessage>>(\n\t\t\t\t\tconnectionString as EventPublisherConnectionString,\n\t\t\t\t);\n\t\t\t},\n\t\t};\n\t}\n}\n\n/** The context a queue handler receives — a batch of typed messages. */\nexport type QueueContext<\n\tTMessage extends StandardSchemaV1,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n> = {\n\tmessages: InferStandardSchema<TMessage>[];\n\tservices: ServiceRecord<TServices>;\n\tlogger: TLogger;\n};\n\nexport type QueueHandler<\n\tTMessage extends StandardSchemaV1,\n\tTServices extends Service[] = [],\n\tTLogger extends Logger = Logger,\n> = (\n\tctx: QueueContext<TMessage, TServices, TLogger>,\n) => unknown | Promise<unknown>;\n"],"mappings":";;;;;;;;;;;;;;AAuCA,IAAa,QAAb,cAKU,UAA4D;CA+BpD;CACA;CACA;CACS;CACA;CACA;CAET;CAEA;CAvCjB,eAAe;CAEf,OAAO,QACN,KAC4D;EAC5D,OAAO,QACN,OACE,IAAmC,iBAAiB,QACpD,IAAkB,SAAA,8BACrB;CACD;;;;;;;;;CAUA;;;;;;CAOA;CAEA,YACC,MACA,SACA,eACA,UAA2C,KAC3C,WAA+C,CAAC,GAChD,SAA2C,gBAE3C,WAEA,MAKA,aAAuB,CAAC,GACvB;EACD,MAAA,gCAEC,QACA,UACA,CAAC,GACD,KAAA,GACA,KAAA,GACA,SACA,KAAA,GACA,KAAA,GACA,UACD;EA3BgB,KAAA,OAAA;EACA,KAAA,UAAA;EACA,KAAA,gBAAA;EACS,KAAA,UAAA;EACA,KAAA,WAAA;EACA,KAAA,SAAA;EAET,KAAA,YAAA;EAEA,KAAA,OAAA;EAoBhB,KAAK,KAAK,YAAY,IAAI;EAC1B,KAAK,gBAAgB,WAAW,KAAK,IAAI,2BAA2B;CACrE;;;;;;;;;CAUA,UAAyB;EACxB,OAAO,CACN;GACC,MAAM;GACN,IAAI,KAAK;GACT,UAAU,CAAC,KAAK,aAAa;GAC7B,GAAI,KAAK,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;GAQlC,QAAQ;IACP,IAAI,G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