@effect-app/infra 0.17.0 → 0.17.2

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.
Files changed (41) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/_cjs/api/routing.cjs +70 -64
  3. package/_cjs/api/routing.cjs.map +1 -1
  4. package/_cjs/api/setupRequest.cjs +22 -4
  5. package/_cjs/api/setupRequest.cjs.map +1 -1
  6. package/_cjs/services/QueueMaker/errors.cjs +54 -0
  7. package/_cjs/services/QueueMaker/errors.cjs.map +1 -0
  8. package/_cjs/services/QueueMaker/memQueue.cjs +79 -0
  9. package/_cjs/services/QueueMaker/memQueue.cjs.map +1 -0
  10. package/_cjs/services/QueueMaker/sbqueue.cjs +80 -0
  11. package/_cjs/services/QueueMaker/sbqueue.cjs.map +1 -0
  12. package/_cjs/services/QueueMaker/service.cjs +9 -0
  13. package/_cjs/services/QueueMaker/service.cjs.map +1 -0
  14. package/_src/_global.ext.ts +4 -0
  15. package/_src/api/routing.ts +36 -29
  16. package/_src/api/setupRequest.ts +19 -0
  17. package/_src/services/QueueMaker/errors.ts +48 -0
  18. package/_src/services/QueueMaker/memQueue.ts +102 -0
  19. package/_src/services/QueueMaker/sbqueue.ts +118 -0
  20. package/_src/services/QueueMaker/service.ts +14 -0
  21. package/dist/_global.ext.d.ts +4 -0
  22. package/dist/_global.ext.d.ts.map +1 -1
  23. package/dist/api/routing.d.ts +4 -1
  24. package/dist/api/routing.d.ts.map +1 -1
  25. package/dist/api/routing.js +73 -71
  26. package/dist/api/setupRequest.d.ts +5 -0
  27. package/dist/api/setupRequest.d.ts.map +1 -1
  28. package/dist/api/setupRequest.js +20 -3
  29. package/dist/services/QueueMaker/errors.d.ts +24 -0
  30. package/dist/services/QueueMaker/errors.d.ts.map +1 -0
  31. package/dist/services/QueueMaker/errors.js +37 -0
  32. package/dist/services/QueueMaker/memQueue.d.ts +25 -0
  33. package/dist/services/QueueMaker/memQueue.d.ts.map +1 -0
  34. package/dist/services/QueueMaker/memQueue.js +60 -0
  35. package/dist/services/QueueMaker/sbqueue.d.ts +31 -0
  36. package/dist/services/QueueMaker/sbqueue.d.ts.map +1 -0
  37. package/dist/services/QueueMaker/sbqueue.js +61 -0
  38. package/dist/services/QueueMaker/service.d.ts +15 -0
  39. package/dist/services/QueueMaker/service.d.ts.map +1 -0
  40. package/dist/services/QueueMaker/service.js +2 -0
  41. package/package.json +43 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @effect-app/infra
2
2
 
3
+ ## 0.17.2
4
+
5
+ ### Patch Changes
6
+
7
+ - e5e7a7c9: Reduce log-noise of express routing by default
8
+
9
+ ## 0.17.1
10
+
11
+ ### Patch Changes
12
+
13
+ - e5c6a5fb: Add QueueMaker
14
+
3
15
  ## 0.17.0
4
16
 
5
17
  ### Minor Changes
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.RequestSettings = void 0;
6
7
  exports.handle = handle;
7
8
  exports.makeRequestHandler = makeRequestHandler;
8
9
  exports.makeRequestParsers = makeRequestParsers;
@@ -11,15 +12,16 @@ exports.matchAll = matchAll;
11
12
  exports.matchAllAlt = matchAllAlt;
12
13
  exports.matchResource = matchResource;
13
14
  exports.respondSuccess = respondSuccess;
14
- var tsplus_module_1 = _interopRequireWildcard(require("@fp-ts/core/Option"));
15
- var tsplus_module_2 = _interopRequireWildcard(require("@effect/io/Effect"));
16
- var tsplus_module_3 = _interopRequireWildcard(require("@effect-app/core/Effect"));
17
- var tsplus_module_4 = _interopRequireWildcard(require("@effect-app/prelude/_ext/Schema.ext"));
18
- var tsplus_module_5 = _interopRequireWildcard(require("@effect-app/infra/RequestContext"));
19
- var tsplus_module_6 = _interopRequireWildcard(require("@effect-app/prelude/utils"));
20
- var tsplus_module_7 = _interopRequireWildcard(require("@effect-app/prelude/_ext/misc"));
21
- var tsplus_module_8 = _interopRequireWildcard(require("@effect-app/core/Option"));
22
- var tsplus_module_9 = _interopRequireWildcard(require("@effect-app/infra/api/setupRequest"));
15
+ var tsplus_module_1 = _interopRequireWildcard(require("@effect/io/FiberRef"));
16
+ var tsplus_module_2 = _interopRequireWildcard(require("@fp-ts/core/Option"));
17
+ var tsplus_module_3 = _interopRequireWildcard(require("@effect/io/Effect"));
18
+ var tsplus_module_4 = _interopRequireWildcard(require("@effect-app/core/Effect"));
19
+ var tsplus_module_5 = _interopRequireWildcard(require("@effect-app/prelude/_ext/Schema.ext"));
20
+ var tsplus_module_6 = _interopRequireWildcard(require("@effect-app/infra/RequestContext"));
21
+ var tsplus_module_7 = _interopRequireWildcard(require("@effect-app/prelude/utils"));
22
+ var tsplus_module_8 = _interopRequireWildcard(require("@effect-app/prelude/_ext/misc"));
23
+ var tsplus_module_9 = _interopRequireWildcard(require("@effect-app/core/Option"));
24
+ var tsplus_module_10 = _interopRequireWildcard(require("@effect-app/infra/api/setupRequest"));
23
25
  var Ex = _interopRequireWildcard(require("@effect-app/infra-adapters/express"));
24
26
  var MO = _interopRequireWildcard(require("@effect-app/prelude/schema"));
25
27
  var _RequestContext2 = require("../RequestContext.cjs");
@@ -32,17 +34,21 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
32
34
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
33
35
  /* eslint-disable @typescript-eslint/no-explicit-any */
34
36
 
37
+ const RequestSettings = tsplus_module_1.unsafeMake({
38
+ verbose: false
39
+ });
40
+ exports.RequestSettings = RequestSettings;
35
41
  function makeRequestParsers(Request) {
36
- const ph = tsplus_module_2.sync(() => tsplus_module_1.map(MO.condemnFail)(tsplus_module_1.map(MO.Parser.for)(tsplus_module_1.map(s => s)(tsplus_module_1.fromNullable(Request.Headers)))));
37
- const parseHeaders = u => tsplus_module_3.flatMapOption(ph, d => d(u));
38
- const pq = tsplus_module_2.sync(() => tsplus_module_1.map(MO.condemnFail)(tsplus_module_1.map(MO.Parser.for)(tsplus_module_1.map(s => s)(tsplus_module_1.fromNullable(Request.Query)))));
39
- const parseQuery = u => tsplus_module_3.flatMapOption(pq, d => d(u));
40
- const pb = tsplus_module_2.sync(() => tsplus_module_1.map(MO.condemnFail)(tsplus_module_1.map(MO.Parser.for)(tsplus_module_1.map(s => s)(tsplus_module_1.fromNullable(Request.Body)))));
41
- const parseBody = u => tsplus_module_3.flatMapOption(pb, d => d(u));
42
- const pp = tsplus_module_2.sync(() => tsplus_module_1.map(MO.condemnFail)(tsplus_module_1.map(MO.Parser.for)(tsplus_module_1.map(s => s)(tsplus_module_1.fromNullable(Request.Path)))));
43
- const parsePath = u => tsplus_module_3.flatMapOption(pp, d => d(u));
44
- const pc = tsplus_module_2.sync(() => tsplus_module_1.map(MO.condemnFail)(tsplus_module_1.map(MO.Parser.for)(tsplus_module_1.map(s => s)(tsplus_module_1.fromNullable(Request.Cookie)))));
45
- const parseCookie = u => tsplus_module_3.flatMapOption(pc, d => d(u));
42
+ const ph = tsplus_module_3.sync(() => tsplus_module_2.map(MO.condemnFail)(tsplus_module_2.map(MO.Parser.for)(tsplus_module_2.map(s => s)(tsplus_module_2.fromNullable(Request.Headers)))));
43
+ const parseHeaders = u => tsplus_module_4.flatMapOption(ph, d => d(u));
44
+ const pq = tsplus_module_3.sync(() => tsplus_module_2.map(MO.condemnFail)(tsplus_module_2.map(MO.Parser.for)(tsplus_module_2.map(s => s)(tsplus_module_2.fromNullable(Request.Query)))));
45
+ const parseQuery = u => tsplus_module_4.flatMapOption(pq, d => d(u));
46
+ const pb = tsplus_module_3.sync(() => tsplus_module_2.map(MO.condemnFail)(tsplus_module_2.map(MO.Parser.for)(tsplus_module_2.map(s => s)(tsplus_module_2.fromNullable(Request.Body)))));
47
+ const parseBody = u => tsplus_module_4.flatMapOption(pb, d => d(u));
48
+ const pp = tsplus_module_3.sync(() => tsplus_module_2.map(MO.condemnFail)(tsplus_module_2.map(MO.Parser.for)(tsplus_module_2.map(s => s)(tsplus_module_2.fromNullable(Request.Path)))));
49
+ const parsePath = u => tsplus_module_4.flatMapOption(pp, d => d(u));
50
+ const pc = tsplus_module_3.sync(() => tsplus_module_2.map(MO.condemnFail)(tsplus_module_2.map(MO.Parser.for)(tsplus_module_2.map(s => s)(tsplus_module_2.fromNullable(Request.Cookie)))));
51
+ const parseCookie = u => tsplus_module_4.flatMapOption(pc, d => d(u));
46
52
  return {
47
53
  parseBody,
48
54
  parseCookie,
@@ -61,10 +67,10 @@ function match(requestHandler, errorHandler, middleware) {
61
67
  requestHandler = handler;
62
68
  makeMiddlewareContext = makeContext;
63
69
  }
64
- return tsplus_module_2.zipRight(Ex.match(requestHandler.Request.method.toLowerCase())(requestHandler.Request.path.split("?")[0], makeRequestHandler(requestHandler, errorHandler, makeMiddlewareContext)), tsplus_module_2.sync(() => (0, _routing.makeRouteDescriptor)(requestHandler.Request.path, requestHandler.Request.method, requestHandler)));
70
+ return tsplus_module_3.zipRight(Ex.match(requestHandler.Request.method.toLowerCase())(requestHandler.Request.path.split("?")[0], makeRequestHandler(requestHandler, errorHandler, makeMiddlewareContext)), tsplus_module_3.sync(() => (0, _routing.makeRouteDescriptor)(requestHandler.Request.path, requestHandler.Request.method, requestHandler)));
65
71
  }
66
72
  function respondSuccess(encodeResponse) {
67
- return (req, res, a) => tsplus_module_2.flatMap(tsplus_module_2.sync(() => encodeResponse(req)(a)), r => tsplus_module_2.sync(() => {
73
+ return (req, res, a) => tsplus_module_3.flatMap(tsplus_module_3.sync(() => encodeResponse(req)(a)), r => tsplus_module_3.sync(() => {
68
74
  r === undefined ? res.status(204).send() : res.status(200).send(JSON.stringify(r));
69
75
  }));
70
76
  }
@@ -82,18 +88,12 @@ function makeRequestHandler(handler, errorHandler, makeMiddlewareContext) {
82
88
  const parseRequest = (0, _requestHandler.parseRequestParams)(requestParsers);
83
89
  const respond = respondSuccess(encodeResponse);
84
90
  function getParams(req) {
85
- return tsplus_module_2.sync(() => ({
91
+ return tsplus_module_3.sync(() => ({
86
92
  path: req.params,
87
93
  query: req.query,
88
94
  body: req.body,
89
- headers: req.headers ? Object.entries(req.headers).reduce((prev, [key, value]) => {
90
- prev[key] = (0, _util.snipValue)(value);
91
- return prev;
92
- }, {}) : req.headers,
93
- cookies: req.cookies ? Object.entries(req.cookies).reduce((prev, [key, value]) => {
94
- prev[key] = typeof value === "string" || Array.isArray(value) ? (0, _util.snipValue)(value) : value;
95
- return prev;
96
- }, {}) : req.cookies
95
+ headers: req.headers,
96
+ cookies: req.cookies
97
97
  }));
98
98
  }
99
99
  function makeContext(req) {
@@ -106,7 +106,7 @@ function makeRequestHandler(handler, errorHandler, makeMiddlewareContext) {
106
106
  // throw new Error("AI Context missing")
107
107
  // }
108
108
  const requestId = req.headers["request-id"];
109
- const rootId = requestId ? tsplus_module_4.parseUnsafe(_RequestContext2.RequestId)(requestId) : _RequestContext2.RequestId.make();
109
+ const rootId = requestId ? tsplus_module_5.parseUnsafe(_RequestContext2.RequestId)(requestId) : _RequestContext2.RequestId.make();
110
110
  const requestContext = new _RequestContext2.RequestContext({
111
111
  rootId,
112
112
  name: MO.ReasonableString(Request.Model instanceof MO.SchemaNamed ? Request.Model.name : Request.name),
@@ -126,8 +126,8 @@ function makeRequestHandler(handler, errorHandler, makeMiddlewareContext) {
126
126
  return requestContext;
127
127
  }
128
128
  return (req, res) => {
129
- return tsplus_module_2.flatMap(tsplus_module_2.struct({
130
- requestContext: tsplus_module_2.sync(() => {
129
+ return tsplus_module_3.flatMap(tsplus_module_3.struct({
130
+ requestContext: tsplus_module_3.sync(() => {
131
131
  const requestContext = makeContext(req);
132
132
  if (req.method === "GET") {
133
133
  res.setHeader("Cache-Control", "no-store");
@@ -139,64 +139,70 @@ function makeRequestHandler(handler, errorHandler, makeMiddlewareContext) {
139
139
  }), ({
140
140
  pars,
141
141
  requestContext
142
- }) => tsplus_module_9.setupRequest(tsplus_module_2.provideService(tsplus_module_2.tap(tsplus_module_2.tapErrorCause(tsplus_module_2.zipRight(tsplus_module_7.logAnnotates({
142
+ }) => tsplus_module_10.setupRequest(tsplus_module_3.provideService(tsplus_module_3.tap(tsplus_module_3.tapErrorCause(tsplus_module_3.zipRight(tsplus_module_3.flatMap(tsplus_module_1.get(RequestSettings), s => tsplus_module_8.logAnnotates({
143
143
  method: req.method,
144
144
  path: req.originalUrl,
145
- reqPath: tsplus_module_6.RecordPretty(tsplus_module_6.object$(pars.path)),
146
- reqQuery: tsplus_module_6.RecordPretty(tsplus_module_6.object$(pars.query)),
147
- reqBody: (0, tsplus_module_6.pretty)(pars.body),
148
- reqCookies: (0, tsplus_module_6.pretty)(pars.cookies),
149
- reqHeaders: tsplus_module_6.RecordPretty(tsplus_module_6.object$(pars.headers))
150
- })(tsplus_module_2.logInfo("Processing request")), tsplus_module_2.suspendSucceed(() => {
151
- const handleRequest = tsplus_module_2.flatMap(tsplus_module_2.map(parseRequest(req), ({
145
+ ...(s.verbose ? {
146
+ reqPath: tsplus_module_7.RecordPretty(tsplus_module_7.object$(pars.path)),
147
+ reqQuery: tsplus_module_7.RecordPretty(tsplus_module_7.object$(pars.query)),
148
+ reqBody: (0, tsplus_module_7.pretty)(pars.body),
149
+ reqCookies: (0, tsplus_module_7.pretty)(pars.cookies),
150
+ reqHeaders: tsplus_module_7.RecordPretty(tsplus_module_7.object$(pars.headers))
151
+ } : undefined)
152
+ })(tsplus_module_3.logInfo("Processing request"))), tsplus_module_3.suspendSucceed(() => {
153
+ const handleRequest = tsplus_module_3.flatMap(tsplus_module_3.map(parseRequest(req), ({
152
154
  body,
153
155
  path,
154
156
  query
155
157
  }) => {
156
158
  const hn = {
157
- ...tsplus_module_8.getOrUndefined(body),
158
- ...tsplus_module_8.getOrUndefined(query),
159
- ...tsplus_module_8.getOrUndefined(path)
159
+ ...tsplus_module_9.getOrUndefined(body),
160
+ ...tsplus_module_9.getOrUndefined(query),
161
+ ...tsplus_module_9.getOrUndefined(path)
160
162
  };
161
163
  return hn;
162
- }), parsedReq => tsplus_module_2.flatMap(handle(parsedReq), r => respond(parsedReq, res, r)));
164
+ }), parsedReq => tsplus_module_3.flatMap(handle(parsedReq), r => respond(parsedReq, res, r)));
163
165
  // Commands should not be interruptable.
164
- const r = req.method !== "GET" ? tsplus_module_2.uninterruptible(handleRequest) : handleRequest; // .instrument("Performance.RequestResponse")
166
+ const r = req.method !== "GET" ? tsplus_module_3.uninterruptible(handleRequest) : handleRequest; // .instrument("Performance.RequestResponse")
165
167
  // the first log entry should be of the request start.
166
- const r2 = makeMiddlewareContext ? tsplus_module_3.provideSomeContextEffect(makeMiddlewareContext(req, res, requestContext))(r)
168
+ const r2 = makeMiddlewareContext ? tsplus_module_4.provideSomeContextEffect(makeMiddlewareContext(req, res, requestContext))(r)
167
169
  // PR is not relevant here
168
170
  : r;
169
171
  return errorHandler(req, res, requestContext, r2);
170
- })), cause => tsplus_module_2.tapErrorCause(tsplus_module_2.zipRight(tsplus_module_2.suspendSucceed(() => {
172
+ })), cause => tsplus_module_3.tapErrorCause(tsplus_module_3.zipRight(tsplus_module_3.suspendSucceed(() => {
171
173
  res.status(500).send();
172
174
  return (0, _reportError.reportRequestError)(cause, {
173
175
  requestContext,
174
176
  path: req.originalUrl,
175
177
  method: req.method
176
178
  });
177
- }), tsplus_module_2.suspendSucceed(() => {
179
+ }), tsplus_module_3.suspendSucceed(() => {
178
180
  const headers = res.getHeaders();
179
- return tsplus_module_7.logAnnotates({
181
+ return tsplus_module_8.logAnnotates({
180
182
  method: req.method,
181
183
  path: req.originalUrl,
182
184
  statusCode: res.statusCode.toString(),
183
- resHeaders: tsplus_module_6.RecordPretty(tsplus_module_6.object$(Object.entries(headers).reduce((prev, [key, value]) => {
185
+ reqPath: tsplus_module_7.RecordPretty(tsplus_module_7.object$(pars.path)),
186
+ reqQuery: tsplus_module_7.RecordPretty(tsplus_module_7.object$(pars.query)),
187
+ reqBody: (0, tsplus_module_7.pretty)(pars.body),
188
+ reqCookies: (0, tsplus_module_7.pretty)(pars.cookies),
189
+ reqHeaders: tsplus_module_7.RecordPretty(tsplus_module_7.object$(pars.headers)),
190
+ resHeaders: tsplus_module_7.RecordPretty(tsplus_module_7.object$(Object.entries(headers).reduce((prev, [key, value]) => {
184
191
  prev[key] = value && typeof value === "string" ? (0, _util.snipString)(value) : value;
185
192
  return prev;
186
193
  }, {})))
187
- })(tsplus_module_2.logErrorCauseMessage("Processed request", cause));
188
- })), cause => tsplus_module_2.sync(() => console.error("Error occurred while reporting error", cause)))), () => tsplus_module_2.suspendSucceed(() => {
194
+ })(tsplus_module_3.logErrorCauseMessage("Processed request", cause));
195
+ })), cause => tsplus_module_3.sync(() => console.error("Error occurred while reporting error", cause)))), () => tsplus_module_3.map(tsplus_module_1.get(RequestSettings), s => {
189
196
  const headers = res.getHeaders();
190
- return tsplus_module_7.logAnnotates({
197
+ return tsplus_module_8.logAnnotates({
191
198
  method: req.method,
192
199
  path: req.originalUrl,
193
200
  statusCode: res.statusCode.toString(),
194
- resHeaders: tsplus_module_6.RecordPretty(tsplus_module_6.object$(Object.entries(headers).reduce((prev, [key, value]) => {
195
- prev[key] = value && typeof value === "string" ? (0, _util.snipString)(value) : value;
196
- return prev;
197
- }, {})))
198
- })(tsplus_module_2.logInfo("Processed request"));
199
- })), tsplus_module_5.tag, requestContext) // otherwise external error reporter breaks.
201
+ ...(s.verbose ? {
202
+ resHeaders: tsplus_module_7.RecordPretty(tsplus_module_7.object$(headers))
203
+ } : undefined)
204
+ })(tsplus_module_3.logInfo("Processed request"));
205
+ })), tsplus_module_6.tag, requestContext) // otherwise external error reporter breaks.
200
206
  , requestContext));
201
207
  };
202
208
  }
@@ -205,7 +211,7 @@ function makeRequestHandler(handler, errorHandler, makeMiddlewareContext) {
205
211
  * Requires no login.
206
212
  */
207
213
  function matchAll(handlers) {
208
- const mapped = tsplus_module_6.RecordKeys(tsplus_module_6.object$(handlers)).reduce((prev, cur) => {
214
+ const mapped = tsplus_module_7.RecordKeys(tsplus_module_7.object$(handlers)).reduce((prev, cur) => {
209
215
  prev[cur] = match(handlers[cur], _defaultErrorHandler.defaultBasicErrorHandler);
210
216
  return prev;
211
217
  }, {});
@@ -216,9 +222,9 @@ function matchAll(handlers) {
216
222
  * Requires no login.
217
223
  */
218
224
  function matchAllAlt(handlers) {
219
- const mapped = tsplus_module_6.RecordKeys(tsplus_module_6.object$(handlers)).reduce((prev, cur) => {
225
+ const mapped = tsplus_module_7.RecordKeys(tsplus_module_7.object$(handlers)).reduce((prev, cur) => {
220
226
  const matches = matchAll(handlers[cur]);
221
- tsplus_module_6.RecordKeys(tsplus_module_6.object$(matches)).forEach(key => prev[`${cur}.${key}`] = matches[key]);
227
+ tsplus_module_7.RecordKeys(tsplus_module_7.object$(matches)).forEach(key => prev[`${cur}.${key}`] = matches[key]);
222
228
  return prev;
223
229
  }, {});
224
230
  return mapped;
@@ -252,7 +258,7 @@ function handle(_, adaptResponse) {
252
258
  */
253
259
  function matchResource(mod) {
254
260
  return handlers => {
255
- const handler = tsplus_module_6.RecordKeys(tsplus_module_6.object$(mod)).reduce((prev, cur) => {
261
+ const handler = tsplus_module_7.RecordKeys(tsplus_module_7.object$(mod)).reduce((prev, cur) => {
256
262
  prev[cur] = handle(mod[cur])(handlers[cur]);
257
263
  return prev;
258
264
  }, {});
@@ -1 +1 @@
1
- {"version":3,"file":"routing.cjs","mappings":";;;;;;;;;;;;;;;;;;;;;;AACA;AAGA;AAKA;AAEA;AAEA;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,GAAG,CAAQ,CAAC;MAClD,OAAOjD,IAAI;IACb,CAAC,EAAE,EAAS,CAAC;IAEb,OAAOpC,OASN;EACH,CAAC;AACH","names":["makeRequestParsers","Request","ph","tsplus_module_2","tsplus_module_1","MO","condemnFail","Parser","for","s","Headers","parseHeaders","u","tsplus_module_3","d","pq","Query","parseQuery","pb","Body","parseBody","pp","Path","parsePath","pc","Cookie","parseCookie","match","requestHandler","errorHandler","middleware","makeMiddlewareContext","undefined","handler","makeContext","method","toLowerCase","path","split","makeRequestHandler","respondSuccess","encodeResponse","req","res","a","r","status","send","JSON","stringify","Response","adaptResponse","h","handle","response","Void","encoder","Encoder","requestParsers","parseRequest","respond","getParams","params","query","body","headers","Object","entries","reduce","prev","key","value","cookies","Array","isArray","start","Date","supported","desiredLocale","locale","includes","requestId","rootId","tsplus_module_4","RequestId","make","requestContext","RequestContext","name","ReasonableString","Model","SchemaNamed","createdAt","setHeader","pars","tsplus_module_9","tsplus_module_7","originalUrl","reqPath","reqQuery","reqBody","reqCookies","reqHeaders","handleRequest","hn","parsedReq","r2","cause","getHeaders","statusCode","toString","resHeaders","console","error","matchAll","handlers","mapped","tsplus_module_6","cur","defaultBasicErrorHandler","matchAllAlt","matches","forEach","_","extractRequest","extractResponse","ResponseOpenApi","matchResource","mod"],"sourceRoot":"","sources":["../../_src/api/routing.ts"],"sourcesContent":[null]}
1
+ {"version":3,"file":"routing.cjs","mappings":";;;;;;;;;;;;;;;;;;;;;;;;AACA;AAGA;AAKA;AAEA;AAEA;AAEA;AACA;AACA;AAAsC;AAAA;AAjBtC;;AAmBO,MAAMA,eAAe,GAAGC,2BAAoB;EACjDC,OAAO,EAAE;CACV,CAAC;AAAA;AAEI,SAAUC,kBAAkB,CAWhCC,OAUY;EAEZ,MAAMC,EAAE,GAAGC,2BACTC,oBAGOC,EAAE,CAACC,WAAW,EAHrBF,oBAEOC,EA5CG,CA4CHE,MAAM,CAACC,GAAG,EAFjBJ,oBACOK,CAAC,IAAIA,CAA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,cAAc,CAACD,CAAC,CAAC;EACpC,MAAMvE,QAAQ,GAAG7C,EAAE,CAACsH,eAAe,CAACF,CAAC,CAAC;EAUtC,OACErE,CAAgC,KAC5B;IACJD,aAAa;IACbC,CAAC;IACDnD,OAAO;IACPiD,QAAQ;IACR0E,eAAe,EAAEH,CAAC,CAACG,eAAe,IAAI1E;GAQtC;AACJ;AAqBA;;;;;;;;;;;;;;;AAeM,SAAU2E,aAAa,CAAuDC,GAAa;EAE/F,OAOEb,QAAmB,IACjB;IACF,MAAMhF,OAAO,GAAGkF,sDAAG,GAAST,MAAM,CAAC,CAACC,IAAI,EAAES,GAAG,KAAI;MAC/CT,IAAI,CAACS,GAAG,CAAC,GAAG/D,MAAM,CAACyE,GAAG,CAACV,GAAG,CAAC,CAAC,CAACH,QAAQ,CAACG,GAAG,CAAQ,CAAC;MAClD,OAAOT,IAAI;IACb,CAAC,EAAE,EAAS,CAAC;IAEb,OAAO1E,OASN;EACH,CAAC;AACH","names":["RequestSettings","tsplus_module_1","verbose","makeRequestParsers","Request","ph","tsplus_module_3","tsplus_module_2","MO","condemnFail","Parser","for","s","Headers","parseHeaders","u","tsplus_module_4","d","pq","Query","parseQuery","pb","Body","parseBody","pp","Path","parsePath","pc","Cookie","parseCookie","match","requestHandler","errorHandler","middleware","makeMiddlewareContext","undefined","handler","makeContext","method","toLowerCase","path","split","makeRequestHandler","respondSuccess","encodeResponse","req","res","a","r","status","send","JSON","stringify","Response","adaptResponse","h","handle","response","Void","encoder","Encoder","requestParsers","parseRequest","respond","getParams","params","query","body","headers","cookies","start","Date","supported","desiredLocale","locale","includes","requestId","rootId","tsplus_module_5","RequestId","make","requestContext","RequestContext","name","ReasonableString","Model","SchemaNamed","createdAt","setHeader","pars","tsplus_module_10","tsplus_module_8","originalUrl","reqPath","reqQuery","reqBody","reqCookies","reqHeaders","handleRequest","hn","parsedReq","r2","cause","getHeaders","statusCode","toString","resHeaders","Object","entries","reduce","prev","key","value","console","error","matchAll","handlers","mapped","tsplus_module_7","cur","defaultBasicErrorHandler","matchAllAlt","matches","forEach","_","extractRequest","extractResponse","ResponseOpenApi","matchResource","mod"],"sourceRoot":"","sources":["../../_src/api/routing.ts"],"sourcesContent":[null]}
@@ -3,17 +3,20 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.setupRequest = void 0;
7
- exports.setupRequestFrom = setupRequestFrom;
6
+ exports.setupReq3 = setupReq3;
7
+ exports.setupRequestFrom = exports.setupRequest = void 0;
8
8
  var tsplus_module_1 = _interopRequireWildcard(require("@effect/io/Effect"));
9
9
  var tsplus_module_2 = _interopRequireWildcard(require("@effect-app/prelude/_ext/misc"));
10
10
  var tsplus_module_3 = _interopRequireWildcard(require("@effect-app/core/Function"));
11
11
  var tsplus_module_4 = _interopRequireWildcard(require("@effect-app/infra/RequestContext"));
12
- require("../RequestContext.cjs");
12
+ var tsplus_module_5 = _interopRequireWildcard(require("@effect-app/prelude/schema"));
13
+ var _RequestContext2 = require("../RequestContext.cjs");
13
14
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
14
15
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
16
  const setupRequest = setupRequest_1;
16
17
  exports.setupRequest = setupRequest;
18
+ const setupRequestFrom = setupRequestFrom_1;
19
+ exports.setupRequestFrom = setupRequestFrom;
17
20
  /**
18
21
  * @tsplus fluent effect/io/Effect setupRequest
19
22
  */
@@ -27,7 +30,22 @@ function setupRequest_1(self, requestContext) {
27
30
  /**
28
31
  * @tsplus getter effect/io/Effect setupRequestFrom
29
32
  */
30
- function setupRequestFrom(self) {
33
+ function setupRequestFrom_1(self) {
31
34
  return tsplus_module_1.serviceWithEffect(tsplus_module_4.tag, requestContext => setupRequest_1(self, requestContext));
32
35
  }
36
+ /**
37
+ * @tsplus fluent effect/io/Effect setupRequestFromWith
38
+ */
39
+ function setupReq3(self, name) {
40
+ return tsplus_module_1.provideService(setupRequestFrom_1(self), tsplus_module_4.tag, makeInternalRequestContext(name));
41
+ }
42
+ function makeInternalRequestContext(name) {
43
+ const id = tsplus_module_5.StringId.make();
44
+ return new _RequestContext2.RequestContext({
45
+ id,
46
+ rootId: id,
47
+ locale: "en",
48
+ name: tsplus_module_5.ReasonableString(name)
49
+ });
50
+ }
33
51
  //# sourceMappingURL=setupRequest.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"setupRequest.cjs","mappings":";;;;;;;;;;;AAAA;AAAqD;AAAA;MAKrCA,YAAY;AAAA;AAH5B;;;AAGA,wBAAsCC,IAAqB,EAAEC,cAA8B;EACzF,OAAOC,oBAAI,CACTC,4BAAI,EAAS,SAAS,CAAC,EACvBC,6BAAoB;IAClBC,aAAa,EAAEJ,cAAc,CAACK,MAAM;IACpCC,SAAS,EAAEN,cAAc,CAACO,EAAE;IAC5BC,WAAW,EAAER,cAAc,CAACS;GAC7B,CAAC,CACH;AACH;AAEA;;;AAGM,SAAUC,gBAAgB,CAAUX,IAAqB;EAC7D,OAAOG,uDAAoCF,cAAc,IAAIW,mBAAI,EAAcX,cAAc,CAAC,CAAC;AACjG","names":["setupRequest","self","requestContext","tsplus_module_3","tsplus_module_1","tsplus_module_2","requestRootId","rootId","requestId","id","requestName","name","setupRequestFrom","setupRequest_1"],"sourceRoot":"","sources":["../../_src/api/setupRequest.ts"],"sourcesContent":[null]}
1
+ {"version":3,"file":"setupRequest.cjs","mappings":";;;;;;;;;;;;AAAA;AAAqD;AAAA;MAKrCA,YAAY;AAAA;MAcZC,gBAAgB;AAAA;AAjBhC;;;AAGA,wBAAsCC,IAAqB,EAAEC,cAA8B;EACzF,OAAOC,oBAAI,CACTC,4BAAI,EAAS,SAAS,CAAC,EACvBC,6BAAoB;IAClBC,aAAa,EAAEJ,cAAc,CAACK,MAAM;IACpCC,SAAS,EAAEN,cAAc,CAACO,EAAE;IAC5BC,WAAW,EAAER,cAAc,CAACS;GAC7B,CAAC,CACH;AACH;AAEA;;;AAGA,4BAA0CV,IAAqB;EAC7D,OAAOG,uDAAoCF,cAAc,IAAIU,mBAAI,EAAcV,cAAc,CAAC,CAAC;AACjG;AAEA;;;AAGM,SAAUW,SAAS,CAAUZ,IAAqB,EAAEU,IAAY;EACpE,OAAOP,sDAAI,wBAE2BU,0BAA0B,CAACH,IAAI,CAAC,CAAC;AACzE;AAEA,SAASG,0BAA0B,CAACH,IAAY;EAC9C,MAAMF,EAAE,GAAGM,wBAAQ,CAACC,IAAI,EAAE;EAC1B,OAAO,IAAIC,+BAAc,CAAC;IACxBR,EAAE;IACFF,MAAM,EAAEE,EAAE;IACVS,MAAM,EAAE,IAAI;IACZP,IAAI,EAAEI,gCAAgB,CAACJ,IAAI;GAC5B,CAAC;AACJ","names":["setupRequest","setupRequestFrom","self","requestContext","tsplus_module_3","tsplus_module_1","tsplus_module_2","requestRootId","rootId","requestId","id","requestName","name","setupRequest_1","setupReq3","makeInternalRequestContext","tsplus_module_5","make","RequestContext","locale"],"sourceRoot":"","sources":["../../_src/api/setupRequest.ts"],"sourcesContent":[null]}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.MessageException = exports.FatalQueueException = void 0;
7
+ exports.forkDaemonReportQueue = forkDaemonReportQueue;
8
+ exports.reportFailure = reportFailure;
9
+ exports.reportQueueError = exports.reportFatalQueueError = void 0;
10
+ var tsplus_module_1 = _interopRequireWildcard(require("@effect/io/Effect"));
11
+ var tsplus_module_2 = _interopRequireWildcard(require("@effect-app/infra/RequestContext"));
12
+ var tsplus_module_3 = _interopRequireWildcard(require("@effect-app/core/Effect"));
13
+ var _errorReporter = require("@effect-app/infra/errorReporter");
14
+ var _errors = require("@effect-app/infra/errors");
15
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
16
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
+ class MessageException extends _errors.CauseException {
18
+ constructor(cause) {
19
+ super(cause, "Message");
20
+ }
21
+ }
22
+ exports.MessageException = MessageException;
23
+ class FatalQueueException extends _errors.CauseException {
24
+ constructor(cause) {
25
+ super(cause, "Message");
26
+ }
27
+ }
28
+ exports.FatalQueueException = FatalQueueException;
29
+ const reportQueueError_ = (0, _errorReporter.reportError)(cause => new MessageException(cause));
30
+ const reportQueueError = (cause, context) => tsplus_module_1.serviceWithEffect(tsplus_module_2.tag, requestContext => tsplus_module_1.sync(() => reportQueueError_(cause, {
31
+ requestContext,
32
+ ...context
33
+ })));
34
+ /**
35
+ * Forks the effect into a new fiber attached to the global scope. Because the
36
+ * new fiber is attached to the global scope, when the fiber executing the
37
+ * returned effect terminates, the forked fiber will continue running.
38
+ *
39
+ * Reports errors.
40
+ *
41
+ * @tsplus getter effect/io/Effect forkDaemonReportQueue
42
+ */
43
+ exports.reportQueueError = reportQueueError;
44
+ function forkDaemonReportQueue(self) {
45
+ return tsplus_module_1.daemonChildren(tsplus_module_1.fork(tsplus_module_1.tapErrorCause(self, reportQueueError)));
46
+ }
47
+ const reportFatalQueueError = (0, _errorReporter.reportError)(cause => new FatalQueueException(cause));
48
+ exports.reportFatalQueueError = reportFatalQueueError;
49
+ function reportFailure(name) {
50
+ return self => tsplus_module_1.tap(tsplus_module_1.exit(self), exit => exit._tag === "Failure" ? reportFatalQueueError(exit.cause, {
51
+ name
52
+ }) : tsplus_module_3.unit);
53
+ }
54
+ //# sourceMappingURL=errors.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.cjs","mappings":";;;;;;;;;;;;AAAA;AACA;AAAyD;AAAA;AAGnD,MAAOA,gBAAoB,SAAQC,sBAAiB;EACxDC,YAAYC,KAAe;IACzB,KAAK,CAACA,KAAK,EAAE,SAAS,CAAC;EACzB;;AACD;AAEK,MAAOC,mBAAuB,SAAQH,sBAAiB;EAC3DC,YAAYC,KAAe;IACzB,KAAK,CAACA,KAAK,EAAE,SAAS,CAAC;EACzB;;AACD;AAED,MAAME,iBAAiB,GAAG,8BAAW,EAACF,KAAK,IAAI,IAAIH,gBAAgB,CAACG,KAAK,CAAC,CAAC;AAEpE,MAAMG,gBAAgB,GAAG,CAACH,KAAqB,EAAEI,OAA6C,KACnGC,uDAAoCC,cAAc,IAChDD,2BAAOH,iBAAiB,CAACF,KAAK,EAAE;EAAEM,cAAc;EAAE,GAAGF;AAAO,CAAE,CAAC,CAAC,CACjE;AAEH;;;;;;;;;AAAA;AASM,SAAUG,qBAAqB,CAAUC,IAAqB;EAClE,2DAAOH,kCAAI,EAAeF,gBAAgB,CAAC;AAC7C;AAEO,MAAMM,qBAAqB,GAAG,8BAAW,EAC9CT,KAAK,IAAI,IAAIC,mBAAmB,CAACD,KAAK,CAAC,CACxC;AAAA;AAEK,SAAUU,aAAa,CAACC,IAAY;EACxC,OAAiBH,IAAqB,IACpCH,6CAAI,GAAUO,IAAI,IAChBA,IAAI,CAACC,IAAI,KAAK,SAAS,GACnBJ,qBAAqB,CAACG,IAAI,CAACZ,KAAK,EAAE;IAAEW;EAAI,CAAE,CAAC,GAC5CG,oBAAY,CAChB;AACL","names":["MessageException","CauseException","constructor","cause","FatalQueueException","reportQueueError_","reportQueueError","context","tsplus_module_1","requestContext","forkDaemonReportQueue","self","reportFatalQueueError","reportFailure","name","exit","_tag","tsplus_module_3"],"sourceRoot":"","sources":["../../../_src/services/QueueMaker/errors.ts"],"sourcesContent":[null]}
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.makeMemQueue = makeMemQueue;
7
+ exports.silence = silence;
8
+ var tsplus_module_1 = _interopRequireWildcard(require("@effect/io/Effect"));
9
+ var tsplus_module_2 = _interopRequireWildcard(require("@effect-app/infra/RequestContext"));
10
+ var tsplus_module_3 = _interopRequireWildcard(require("@effect-app/core/_ext/Iterable"));
11
+ var tsplus_module_4 = _interopRequireWildcard(require("@effect-app/infra/services/QueueMaker/errors"));
12
+ var tsplus_module_5 = _interopRequireWildcard(require("@effect-app/prelude/utils"));
13
+ var tsplus_module_6 = _interopRequireWildcard(require("@effect-app/prelude/_ext/misc"));
14
+ var tsplus_module_7 = _interopRequireWildcard(require("@effect-app/prelude/schema"));
15
+ var tsplus_module_8 = _interopRequireWildcard(require("@effect-app/infra/api/setupRequest"));
16
+ var tsplus_module_9 = _interopRequireWildcard(require("@effect/io/Cause"));
17
+ var tsplus_module_10 = _interopRequireWildcard(require("@effect-app/core/Effect"));
18
+ var tsplus_module_11 = _interopRequireWildcard(require("@effect/io/Exit"));
19
+ var _memQueue = require("@effect-app/infra-adapters/memQueue");
20
+ var _errors2 = require("./errors.cjs");
21
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
22
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
+ /**
24
+ * @tsplus static QueueMaker.Ops makeMem
25
+ */
26
+ function makeMemQueue(queueName, queueDrainName, encoder, makeHandleEvent, provideContext, parseDrain) {
27
+ return tsplus_module_1.gen(function* ($) {
28
+ const mem = yield* $(tsplus_module_1.service(_memQueue.MemQueue));
29
+ const q = yield* $(mem.getOrCreateQueue(queueName));
30
+ const qReply = yield* $(mem.getOrCreateQueue(queueDrainName));
31
+ return {
32
+ publish: (...messages) => tsplus_module_1.gen(function* ($) {
33
+ const requestContext = yield* $(tsplus_module_1.service(tsplus_module_2.tag));
34
+ return yield* $(tsplus_module_4.forkDaemonReportQueue(tsplus_module_3.ext_forEach(messages, m => tsplus_module_1.asUnit(
35
+ // we JSON encode, because that is what the wire also does, and it reveals holes in e.g unknown encoders (Date->String)
36
+ tsplus_module_1.flatMap(tsplus_module_1.sync(() => JSON.stringify(encoder({
37
+ body: m,
38
+ meta: requestContext
39
+ })))
40
+ // .tap((msg) => info("Publishing Mem Message: " + utils.inspect(msg)))
41
+ , _ => q.offer(_))))));
42
+ }),
43
+ drain: tsplus_module_1.gen(function* ($) {
44
+ const handleEvent = yield* $(makeHandleEvent);
45
+ const processMessage = msg =>
46
+ // we JSON parse, because that is what the wire also does, and it reveals holes in e.g unknown encoders (Date->String)
47
+ tsplus_module_1.flatMap(tsplus_module_1.orDie(tsplus_module_1.flatMap(tsplus_module_1.sync(() => JSON.parse(msg)), parseDrain)), ({
48
+ body,
49
+ meta
50
+ }) => provideContext(tsplus_module_2.RequestContext.inherit(meta, {
51
+ id: body.id,
52
+ locale: "en",
53
+ name: tsplus_module_7.ReasonableString(body._tag)
54
+ }))(tsplus_module_1.zipRight(tsplus_module_6.logAnnotates({
55
+ body: tsplus_module_5.RecordPretty(tsplus_module_5.object$(body)),
56
+ meta: tsplus_module_5.RecordPretty(tsplus_module_5.object$(meta))
57
+ })(tsplus_module_1.logDebug(`$$ [${queueDrainName}] Processing incoming message`)), silence(handleEvent(body)))));
58
+ return yield* $(tsplus_module_1.forkScoped(tsplus_module_8.setupReq3((0, _errors2.reportFailure)("drain")(tsplus_module_1.forever(tsplus_module_1.flatMap(qReply.take(), x => tsplus_module_1.uninterruptible(processMessage(x))))), "Queue.ReceiveMessage")));
59
+ })
60
+ };
61
+ });
62
+ }
63
+ // We want the Queue to continue processing even on errors per messages
64
+ // must make sure that the errors are processed/handled beforehand.
65
+ function silence(inp) {
66
+ return tsplus_module_1.flatMap(tsplus_module_1.exit(inp), result => tsplus_module_1.gen(function* ($) {
67
+ const requestContext = yield* $(tsplus_module_1.service(tsplus_module_2.tag));
68
+ return yield* $(tsplus_module_11.match(result, cause => {
69
+ if (tsplus_module_9.isInterrupted(cause)) {
70
+ return tsplus_module_1.failCause(cause);
71
+ }
72
+ (0, _errors2.reportQueueError)(cause, {
73
+ requestContext
74
+ });
75
+ return tsplus_module_10.unit;
76
+ }, () => tsplus_module_10.unit));
77
+ }));
78
+ }
79
+ //# sourceMappingURL=memQueue.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memQueue.cjs","mappings":";;;;;;;;;;;;;;;;;;AAAA;AAGA;AAA6D;AAAA;AAG7D;;;AAGM,SAAUA,YAAY,CAC1BC,SAAiB,EACjBC,cAAsB,EACtBC,OAAyD,EACzDC,eAAwF,EACxFC,cAEuC,EACvCC,UAGmF;EAEnF,OAAOC,oBAAW,WAAUC,CAAC;IAC3B,MAAMC,GAAG,GAAG,OAAOD,CAAC,yBAACE,kBAAQ,EAAQ;IACrC,MAAMC,CAAC,GAAG,OAAOH,CAAC,CAACC,GAAG,CAACG,gBAAgB,CAACX,SAAS,CAAC,CAAC;IACnD,MAAMY,MAAM,GAAG,OAAOL,CAAC,CAACC,GAAG,CAACG,gBAAgB,CAACV,cAAc,CAAC,CAAC;IAE7D,OAAO;MACLY,OAAO,EAAE,CAAC,GAAGC,QAAQ,KACnBR,oBAAW,WAAUC,CAAC;QACpB,MAAMQ,cAAc,GAAG,OAAOR,CAAC,8CAA2B;QAC1D,OAAO,OAAOA,CAAC,uCACbS,oCAAQ,EAAeC,CAAC,IAAGX;QACzB;QACAA,6CAAO,MACLY,IAAI,CAACC,SAAS,CACZjB,OAAO,CAAC;UAAEkB,IAAI,EAAEH,CAAC;UAAEI,IAAI,EAAEN;QAAc,CAAE,CAAC,CAC3C;QAED;QAAA,EACSO,CAAC,IAAIZ,CAAC,CAACa,KAAK,CAACD,CAAC,CAAC,CAAC,CAClB,CACV,EAEF;MACH,CAAC,CAAC;MACJE,KAAK,EAAElB,oBAAW,WAAUC,CAAC;QAC3B,MAAMkB,WAAW,GAAG,OAAOlB,CAAC,CAACJ,eAAe,CAAC;QAC7C,MAAMuB,cAAc,GAAIC,GAAW;QACj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ideContext","parseDrain","tsplus_module_1","$","mem","MemQueue","q","getOrCreateQueue","qReply","publish","messages","requestContext","tsplus_module_3","m","JSON","stringify","body","meta","_","offer","drain","handleEvent","processMessage","msg","parse","RequestContext","inherit","id","locale","name","tsplus_module_7","_tag","tsplus_module_6","silence","tsplus_module_8","take","x","inp","result","tsplus_module_11","cause","tsplus_module_9","tsplus_module_10"],"sourceRoot":"","sources":["../../../_src/services/QueueMaker/memQueue.ts"],"sourcesContent":[null]}
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.makeServiceBusLayers = makeServiceBusLayers;
7
+ exports.makeServiceBusQueue = makeServiceBusQueue;
8
+ var tsplus_module_1 = _interopRequireWildcard(require("@effect/io/Effect"));
9
+ var tsplus_module_2 = _interopRequireWildcard(require("@effect-app/core/Tag"));
10
+ var tsplus_module_3 = _interopRequireWildcard(require("@effect-app/prelude/utils"));
11
+ var tsplus_module_4 = _interopRequireWildcard(require("@effect-app/prelude/_ext/misc"));
12
+ var tsplus_module_5 = _interopRequireWildcard(require("@effect-app/prelude/schema"));
13
+ var tsplus_module_6 = _interopRequireWildcard(require("@effect-app/infra/api/setupRequest"));
14
+ var tsplus_module_7 = _interopRequireWildcard(require("@effect-app/infra/RequestContext"));
15
+ var tsplus_module_8 = _interopRequireWildcard(require("@effect-app/infra/services/QueueMaker/errors"));
16
+ var tsplus_module_9 = _interopRequireWildcard(require("@effect/io/Layer"));
17
+ var _ServiceBus = require("@effect-app/infra-adapters/ServiceBus");
18
+ var _errorReporter = require("@effect-app/infra/errorReporter");
19
+ var _errors2 = require("./errors.cjs");
20
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
21
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
22
+ /**
23
+ * @tsplus static QueueMaker.Ops makeServiceBus
24
+ */
25
+ function makeServiceBusQueue(_queueName, queueDrainName, encoder, makeHandleEvent, provideContext, parseDrain) {
26
+ return tsplus_module_1.gen(function* ($) {
27
+ const s = yield* $(tsplus_module_1.service(_ServiceBus.Sender));
28
+ const receiver = yield* $(tsplus_module_1.service(_ServiceBus.Receiver));
29
+ const receiverLayer = tsplus_module_2.makeLayer(_ServiceBus.Receiver, receiver);
30
+ return {
31
+ drain: tsplus_module_1.gen(function* ($) {
32
+ const handleEvent = yield* $(makeHandleEvent);
33
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
34
+ function processMessage(messageBody) {
35
+ return tsplus_module_1.asUnit(tsplus_module_1.orDie(tsplus_module_6.setupReq3(tsplus_module_1.flatMap(tsplus_module_1.tapErrorCause(tsplus_module_1.orDie(tsplus_module_1.flatMap(tsplus_module_1.sync(() => JSON.parse(messageBody)), x => parseDrain(x))), report), ({
36
+ body,
37
+ meta
38
+ }) => provideContext(tsplus_module_7.RequestContext.inherit(meta, {
39
+ id: body.id,
40
+ locale: "en",
41
+ name: tsplus_module_5.ReasonableString(body._tag)
42
+ }))(tsplus_module_1.tapErrorCause(tsplus_module_1.zipRight(tsplus_module_4.logAnnotates({
43
+ body: tsplus_module_3.RecordPretty(tsplus_module_3.object$(body)),
44
+ meta: tsplus_module_3.RecordPretty(tsplus_module_3.object$(meta))
45
+ })(tsplus_module_1.logDebug(`$$ [${queueDrainName}] Processing incoming message`)), handleEvent(body)), report))), "Queue.ReceiveMessage")));
46
+ }
47
+ return yield* $(tsplus_module_1.provideSomeLayer((0, _ServiceBus.subscribe)({
48
+ processMessage: x => tsplus_module_1.uninterruptible(processMessage(x.body)),
49
+ processError: err => tsplus_module_1.sync(() => (0, _errorReporter.captureException)(err.error))
50
+ }), receiverLayer));
51
+ }),
52
+ publish: (...messages) => tsplus_module_1.gen(function* ($) {
53
+ const requestContext = yield* $(tsplus_module_1.service(tsplus_module_7.tag));
54
+ return yield* $(tsplus_module_8.forkDaemonReportQueue(tsplus_module_1.promise(() => s.sendMessages(messages.map(x => ({
55
+ body: JSON.stringify(encoder({
56
+ body: x,
57
+ meta: requestContext
58
+ })),
59
+ messageId: x.id,
60
+ contentType: "application/json"
61
+ }))))));
62
+ })
63
+ };
64
+ });
65
+ }
66
+ /**
67
+ * @tsplus static QueueMaker.Ops makeServiceBusLayers
68
+ */
69
+ function makeServiceBusLayers(url, queueName, queueDrainName) {
70
+ return tsplus_module_9.provide(tsplus_module_9.merge((0, _ServiceBus.LiveSender)(queueName))((0, _ServiceBus.LiveReceiver)(queueDrainName)))((0, _ServiceBus.LiveServiceBusClient)(url));
71
+ }
72
+ function report(cause) {
73
+ return tsplus_module_1.gen(function* ($) {
74
+ const requestContext = yield* $(tsplus_module_1.service(tsplus_module_7.tag));
75
+ return (0, _errors2.reportQueueError)(cause, {
76
+ requestContext
77
+ });
78
+ });
79
+ }
80
+ //# sourceMappingURL=sbqueue.cjs.map