@effect-app/infra 0.85.0-next.4 → 0.85.0
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/CHANGELOG.md +3 -36
- package/_cjs/_ext/Array.cjs +2 -3
- package/_cjs/_ext/Array.cjs.map +1 -1
- package/_cjs/api/defaultErrorHandler.cjs +10 -11
- package/_cjs/api/defaultErrorHandler.cjs.map +1 -1
- package/_cjs/api/express/makeJsonSchema.cjs +2 -3
- package/_cjs/api/express/makeJsonSchema.cjs.map +1 -1
- package/_cjs/api/express/makeJsonSchema.test.cjs +2 -2
- package/_cjs/api/express/makeJsonSchema.test.cjs.map +1 -1
- package/_cjs/api/express/makeOpenApiSpecs.cjs +4 -6
- package/_cjs/api/express/makeOpenApiSpecs.cjs.map +1 -1
- package/_cjs/api/express/schema/routing.cjs +22 -23
- package/_cjs/api/express/schema/routing.cjs.map +1 -1
- package/_cjs/api/reportError.cjs +2 -2
- package/_cjs/api/setupRequest.cjs +4 -5
- package/_cjs/api/setupRequest.cjs.map +1 -1
- package/_cjs/api/writeDocs.cjs +4 -6
- package/_cjs/api/writeDocs.cjs.map +1 -1
- package/_cjs/errorReporter.cjs +11 -12
- package/_cjs/errorReporter.cjs.map +1 -1
- package/_cjs/errors.cjs +8 -8
- package/_cjs/errors.cjs.map +1 -1
- package/_cjs/instrument.cjs +1 -2
- package/_cjs/instrument.cjs.map +1 -1
- package/_cjs/logger/jsonLogger.cjs +10 -11
- package/_cjs/logger/jsonLogger.cjs.map +1 -1
- package/_cjs/logger/logFmtLogger.cjs +5 -5
- package/_cjs/logger/logFmtLogger.cjs.map +1 -1
- package/_cjs/logger/shared.cjs +4 -4
- package/_cjs/logger/shared.cjs.map +1 -1
- package/_cjs/rateLimit.cjs +7 -8
- package/_cjs/rateLimit.cjs.map +1 -1
- package/_cjs/services/Emailer/Sendgrid.cjs +12 -14
- package/_cjs/services/Emailer/Sendgrid.cjs.map +1 -1
- package/_cjs/services/Emailer/fake.cjs +4 -5
- package/_cjs/services/Emailer/fake.cjs.map +1 -1
- package/_cjs/services/Operations/live.cjs +29 -31
- package/_cjs/services/Operations/live.cjs.map +1 -1
- package/_cjs/services/Operations/service.cjs +5 -6
- package/_cjs/services/Operations/service.cjs.map +1 -1
- package/_cjs/services/QueueMaker/errors.cjs +6 -7
- package/_cjs/services/QueueMaker/errors.cjs.map +1 -1
- package/_cjs/services/QueueMaker/memQueue.cjs +17 -18
- package/_cjs/services/QueueMaker/memQueue.cjs.map +1 -1
- package/_cjs/services/QueueMaker/sbqueue.cjs +15 -16
- package/_cjs/services/QueueMaker/sbqueue.cjs.map +1 -1
- package/_cjs/services/Repository.cjs +16 -17
- package/_cjs/services/Repository.cjs.map +1 -1
- package/_cjs/services/RepositoryBase.cjs +33 -35
- package/_cjs/services/RepositoryBase.cjs.map +1 -1
- package/_cjs/services/RequestContextContainer.cjs +20 -15
- package/_cjs/services/RequestContextContainer.cjs.map +1 -1
- package/_cjs/services/Store/Cosmos.cjs +46 -49
- package/_cjs/services/Store/Cosmos.cjs.map +1 -1
- package/_cjs/services/Store/Disk.cjs +18 -19
- package/_cjs/services/Store/Disk.cjs.map +1 -1
- package/_cjs/services/Store/Memory.cjs +39 -43
- package/_cjs/services/Store/Memory.cjs.map +1 -1
- package/_cjs/services/Store/Redis.cjs +14 -16
- package/_cjs/services/Store/Redis.cjs.map +1 -1
- package/_cjs/services/Store/codeFilter.test.cjs +1 -1
- package/_cjs/services/Store/index.cjs +6 -7
- package/_cjs/services/Store/index.cjs.map +1 -1
- package/_cjs/services/Store/service.cjs +1 -1
- package/_cjs/services/Store/service.cjs.map +1 -1
- package/_cjs/services/Store/utils.cjs +13 -13
- package/_cjs/services/Store/utils.cjs.map +1 -1
- package/_cjs/services/simpledb/cosmosdb.cjs +17 -19
- package/_cjs/services/simpledb/cosmosdb.cjs.map +1 -1
- package/_cjs/services/simpledb/diskdb.cjs +8 -9
- package/_cjs/services/simpledb/diskdb.cjs.map +1 -1
- package/_cjs/services/simpledb/memdb.cjs +9 -11
- package/_cjs/services/simpledb/memdb.cjs.map +1 -1
- package/_cjs/services/simpledb/mongodb.cjs +18 -20
- package/_cjs/services/simpledb/mongodb.cjs.map +1 -1
- package/_cjs/services/simpledb/redisdb.cjs +10 -11
- package/_cjs/services/simpledb/redisdb.cjs.map +1 -1
- package/_cjs/services/simpledb/shared.cjs +5 -5
- package/_cjs/services/simpledb/shared.cjs.map +1 -1
- package/_cjs/services/simpledb/simpledb.cjs +17 -18
- package/_cjs/services/simpledb/simpledb.cjs.map +1 -1
- package/_src/api/authorization.jwt.ts +1 -1
- package/_src/api/defaultErrorHandler.ts +2 -2
- package/_src/api/express/routing.ts.bak +8 -8
- package/_src/api/express/schema/routing.ts +59 -37
- package/_src/api/setupRequest.ts +11 -10
- package/_src/errorReporter.ts +1 -1
- package/_src/services/Emailer/Sendgrid.ts +1 -1
- package/_src/services/Operations/live.ts +5 -5
- package/_src/services/QueueMaker/errors.ts +1 -1
- package/_src/services/QueueMaker/memQueue.ts +2 -2
- package/_src/services/QueueMaker/sbqueue.ts +1 -1
- package/_src/services/Repository.ts +9 -9
- package/_src/services/RepositoryBase.ts +6 -8
- package/_src/services/RequestContextContainer.ts +12 -7
- package/_src/services/Store/Cosmos.ts +12 -17
- package/_src/services/Store/Disk.ts +4 -4
- package/_src/services/Store/Memory.ts +4 -4
- package/_src/services/Store/Redis.ts +1 -1
- package/_src/services/Store/index.test.ts.bak +5 -5
- package/_src/services/Store/index.ts +1 -1
- package/_src/services/Store/utils.ts +16 -16
- package/_src/services/simpledb/diskdb.ts +1 -1
- package/_src/services/simpledb/memdb.ts +1 -1
- package/_src/services/simpledb/redisdb.ts +1 -1
- package/_src/services/simpledb/shared.ts +1 -1
- package/_src/services/simpledb/simpledb.ts +3 -3
- package/dist/RequestContext.d.ts +4 -4
- package/dist/_ext/Array.d.ts +1 -1
- package/dist/_ext/Array.d.ts.map +1 -1
- package/dist/_ext/Array.js +3 -4
- package/dist/api/codec.d.ts +1 -1
- package/dist/api/codec.d.ts.map +1 -1
- package/dist/api/defaultErrorHandler.d.ts +2 -2
- package/dist/api/defaultErrorHandler.d.ts.map +1 -1
- package/dist/api/defaultErrorHandler.js +11 -13
- package/dist/api/express/makeJsonSchema.d.ts +2 -2
- package/dist/api/express/makeJsonSchema.d.ts.map +1 -1
- package/dist/api/express/makeJsonSchema.js +3 -4
- package/dist/api/express/makeOpenApiSpecs.d.ts +1 -1
- package/dist/api/express/makeOpenApiSpecs.js +5 -7
- package/dist/api/express/schema/routing.d.ts +22 -7
- package/dist/api/express/schema/routing.d.ts.map +1 -1
- package/dist/api/express/schema/routing.js +23 -24
- package/dist/api/reportError.d.ts +5 -5
- package/dist/api/reportError.d.ts.map +1 -1
- package/dist/api/reportError.js +2 -2
- package/dist/api/setupRequest.d.ts +2 -2
- package/dist/api/setupRequest.d.ts.map +1 -1
- package/dist/api/setupRequest.js +7 -7
- package/dist/api/writeDocs.d.ts +1 -1
- package/dist/api/writeDocs.d.ts.map +1 -1
- package/dist/api/writeDocs.js +5 -7
- package/dist/errorReporter.d.ts +3 -3
- package/dist/errorReporter.d.ts.map +1 -1
- package/dist/errorReporter.js +12 -13
- package/dist/errors.d.ts +7 -7
- package/dist/errors.js +9 -9
- package/dist/instrument.d.ts +1 -1
- package/dist/instrument.d.ts.map +1 -1
- package/dist/instrument.js +2 -3
- package/dist/logger/jsonLogger.d.ts +2 -2
- package/dist/logger/jsonLogger.d.ts.map +1 -1
- package/dist/logger/jsonLogger.js +11 -12
- package/dist/logger/logFmtLogger.d.ts +2 -2
- package/dist/logger/logFmtLogger.d.ts.map +1 -1
- package/dist/logger/logFmtLogger.js +6 -6
- package/dist/logger/shared.d.ts +1 -1
- package/dist/logger/shared.d.ts.map +1 -1
- package/dist/logger/shared.js +5 -5
- package/dist/rateLimit.d.ts +3 -3
- package/dist/rateLimit.d.ts.map +1 -1
- package/dist/rateLimit.js +8 -9
- package/dist/services/Emailer/Sendgrid.d.ts +1 -1
- package/dist/services/Emailer/Sendgrid.d.ts.map +1 -1
- package/dist/services/Emailer/Sendgrid.js +15 -17
- package/dist/services/Emailer/fake.d.ts +1 -1
- package/dist/services/Emailer/fake.d.ts.map +1 -1
- package/dist/services/Emailer/fake.js +5 -6
- package/dist/services/Emailer/service.d.ts +3 -3
- package/dist/services/Operations/live.d.ts +1 -1
- package/dist/services/Operations/live.d.ts.map +1 -1
- package/dist/services/Operations/live.js +37 -39
- package/dist/services/Operations/service.d.ts +8 -8
- package/dist/services/Operations/service.d.ts.map +1 -1
- package/dist/services/Operations/service.js +12 -13
- package/dist/services/QueueMaker/errors.d.ts +3 -3
- package/dist/services/QueueMaker/errors.d.ts.map +1 -1
- package/dist/services/QueueMaker/errors.js +6 -7
- package/dist/services/QueueMaker/memQueue.d.ts +3 -3
- package/dist/services/QueueMaker/memQueue.js +16 -17
- package/dist/services/QueueMaker/sbqueue.d.ts +4 -4
- package/dist/services/QueueMaker/sbqueue.d.ts.map +1 -1
- package/dist/services/QueueMaker/sbqueue.js +15 -16
- package/dist/services/Repository.d.ts +42 -42
- package/dist/services/Repository.d.ts.map +1 -1
- package/dist/services/Repository.js +17 -18
- package/dist/services/RepositoryBase.d.ts +12 -11
- package/dist/services/RepositoryBase.d.ts.map +1 -1
- package/dist/services/RepositoryBase.js +35 -37
- package/dist/services/RequestContextContainer.d.ts +14 -11
- package/dist/services/RequestContextContainer.d.ts.map +1 -1
- package/dist/services/RequestContextContainer.js +19 -18
- package/dist/services/Store/Cosmos.d.ts +3 -3
- package/dist/services/Store/Cosmos.d.ts.map +1 -1
- package/dist/services/Store/Cosmos.js +51 -54
- package/dist/services/Store/Disk.d.ts +3 -3
- package/dist/services/Store/Disk.d.ts.map +1 -1
- package/dist/services/Store/Disk.js +19 -20
- package/dist/services/Store/Memory.d.ts +5 -5
- package/dist/services/Store/Memory.d.ts.map +1 -1
- package/dist/services/Store/Memory.js +41 -45
- package/dist/services/Store/Redis.d.ts +3 -3
- package/dist/services/Store/Redis.d.ts.map +1 -1
- package/dist/services/Store/Redis.js +15 -17
- package/dist/services/Store/index.d.ts +1 -1
- package/dist/services/Store/index.d.ts.map +1 -1
- package/dist/services/Store/index.js +7 -8
- package/dist/services/Store/service.d.ts +8 -8
- package/dist/services/Store/service.d.ts.map +1 -1
- package/dist/services/Store/service.js +2 -2
- package/dist/services/Store/utils.d.ts +2 -2
- package/dist/services/Store/utils.d.ts.map +1 -1
- package/dist/services/Store/utils.js +21 -21
- package/dist/services/simpledb/cosmosdb.d.ts +5 -5
- package/dist/services/simpledb/cosmosdb.js +17 -19
- package/dist/services/simpledb/diskdb.d.ts +4 -4
- package/dist/services/simpledb/diskdb.js +9 -10
- package/dist/services/simpledb/memdb.d.ts +4 -4
- package/dist/services/simpledb/memdb.js +11 -13
- package/dist/services/simpledb/mongodb.d.ts +5 -5
- package/dist/services/simpledb/mongodb.js +14 -16
- package/dist/services/simpledb/redisdb.d.ts +4 -4
- package/dist/services/simpledb/redisdb.js +11 -12
- package/dist/services/simpledb/shared.d.ts +4 -4
- package/dist/services/simpledb/shared.js +6 -6
- package/dist/services/simpledb/simpledb.d.ts +6 -6
- package/dist/services/simpledb/simpledb.d.ts.map +1 -1
- package/dist/services/simpledb/simpledb.js +15 -16
- package/package.json +5 -25
- package/_cjs/api/express/schema/requestHandler.cjs +0 -172
- package/_cjs/api/express/schema/requestHandler.cjs.map +0 -1
- package/_cjs/api/routing.cjs +0 -278
- package/_cjs/api/routing.cjs.map +0 -1
- package/_src/api/express/schema/requestHandler.ts +0 -372
- package/_src/api/routing.ts +0 -660
- package/dist/api/express/schema/requestHandler.d.ts +0 -71
- package/dist/api/express/schema/requestHandler.d.ts.map +0 -1
- package/dist/api/express/schema/requestHandler.js +0 -140
- package/dist/api/routing.d.ts +0 -103
- package/dist/api/routing.d.ts.map +0 -1
- package/dist/api/routing.js +0 -265
|
@@ -7,18 +7,16 @@ exports.Live = void 0;
|
|
|
7
7
|
var tsplus_module_1 = _interopRequireWildcard(require("effect/Effect"));
|
|
8
8
|
var tsplus_module_2 = _interopRequireWildcard(require("@effect-app/prelude/_ext/date"));
|
|
9
9
|
var tsplus_module_3 = _interopRequireWildcard(require("effect/Option"));
|
|
10
|
-
var tsplus_module_4 = _interopRequireWildcard(require("effect/
|
|
11
|
-
var tsplus_module_5 = _interopRequireWildcard(require("
|
|
12
|
-
var tsplus_module_6 = _interopRequireWildcard(require("effect/
|
|
13
|
-
var tsplus_module_7 = _interopRequireWildcard(require("effect/
|
|
14
|
-
var tsplus_module_8 = _interopRequireWildcard(require("effect/
|
|
15
|
-
var tsplus_module_9 = _interopRequireWildcard(require("@effect-app/
|
|
16
|
-
var tsplus_module_10 = _interopRequireWildcard(require("@effect-app/
|
|
17
|
-
var tsplus_module_11 = _interopRequireWildcard(require("effect/
|
|
18
|
-
var tsplus_module_12 = _interopRequireWildcard(require("
|
|
19
|
-
var tsplus_module_13 = _interopRequireWildcard(require("effect/
|
|
20
|
-
var tsplus_module_14 = _interopRequireWildcard(require("effect/Schedule"));
|
|
21
|
-
var tsplus_module_15 = _interopRequireWildcard(require("effect/impl/Layer"));
|
|
10
|
+
var tsplus_module_4 = _interopRequireWildcard(require("@effect-app/core/Array"));
|
|
11
|
+
var tsplus_module_5 = _interopRequireWildcard(require("effect/Chunk"));
|
|
12
|
+
var tsplus_module_6 = _interopRequireWildcard(require("effect/Exit"));
|
|
13
|
+
var tsplus_module_7 = _interopRequireWildcard(require("effect/Cause"));
|
|
14
|
+
var tsplus_module_8 = _interopRequireWildcard(require("@effect-app/prelude/schema"));
|
|
15
|
+
var tsplus_module_9 = _interopRequireWildcard(require("@effect-app/core/Option"));
|
|
16
|
+
var tsplus_module_10 = _interopRequireWildcard(require("@effect-app/prelude/_ext/misc"));
|
|
17
|
+
var tsplus_module_11 = _interopRequireWildcard(require("effect/Duration"));
|
|
18
|
+
var tsplus_module_12 = _interopRequireWildcard(require("effect/Schedule"));
|
|
19
|
+
var tsplus_module_13 = _interopRequireWildcard(require("effect/Layer"));
|
|
22
20
|
var _reportError = require("@effect-app/infra/api/reportError");
|
|
23
21
|
var _errorReporter = require("@effect-app/infra/errorReporter");
|
|
24
22
|
var _Operations = require("@effect-app/prelude/Operations");
|
|
@@ -26,45 +24,45 @@ var _service = require("./service.cjs");
|
|
|
26
24
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
27
25
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
28
26
|
const reportAppError = (0, _errorReporter.reportError)(cause => new _reportError.RequestException(cause));
|
|
29
|
-
const make = tsplus_module_1.
|
|
27
|
+
const make = tsplus_module_1.sync(() => {
|
|
30
28
|
const ops = new Map();
|
|
31
|
-
const makeOp = tsplus_module_1.
|
|
32
|
-
const cleanup = tsplus_module_1.
|
|
29
|
+
const makeOp = tsplus_module_1.sync(() => _Operations.OperationId.make());
|
|
30
|
+
const cleanup = tsplus_module_1.sync(() => {
|
|
33
31
|
const before = tsplus_module_2.DateSubHours(new Date(), 1);
|
|
34
|
-
|
|
35
|
-
const lastChanged =
|
|
32
|
+
tsplus_module_5.forEach(tsplus_module_4.ext_itToChunk(ops.entries()), ([id, op]) => {
|
|
33
|
+
const lastChanged = tsplus_module_3.getOrElse(tsplus_module_3.fromNullable(op.updatedAt), () => op.createdAt);
|
|
36
34
|
if (lastChanged < before) {
|
|
37
35
|
ops.delete(id);
|
|
38
36
|
}
|
|
39
37
|
});
|
|
40
38
|
});
|
|
41
39
|
function addOp(id) {
|
|
42
|
-
return tsplus_module_1.
|
|
40
|
+
return tsplus_module_1.sync(() => {
|
|
43
41
|
ops.set(id, new _Operations.Operation({
|
|
44
42
|
id
|
|
45
43
|
}));
|
|
46
44
|
});
|
|
47
45
|
}
|
|
48
46
|
function findOp(id) {
|
|
49
|
-
return tsplus_module_1.
|
|
47
|
+
return tsplus_module_1.sync(() => tsplus_module_3.fromNullable(ops.get(id)));
|
|
50
48
|
}
|
|
51
49
|
function finishOp(id, exit) {
|
|
52
|
-
return
|
|
53
|
-
if (
|
|
50
|
+
return tsplus_module_1.flatMap(findOp(id), _ => tsplus_module_1.sync(() => {
|
|
51
|
+
if (tsplus_module_3.isNone(_)) {
|
|
54
52
|
throw new Error("Not found");
|
|
55
53
|
}
|
|
56
54
|
ops.set(id, {
|
|
57
55
|
..._.value,
|
|
58
56
|
updatedAt: new Date(),
|
|
59
|
-
result:
|
|
60
|
-
message:
|
|
57
|
+
result: tsplus_module_6.isSuccess(exit) ? new _Operations.Success() : new _Operations.Failure({
|
|
58
|
+
message: tsplus_module_7.isInterrupted(exit.cause) ? tsplus_module_8.LongString("Interrupted") : tsplus_module_7.isDie(exit.cause) ? tsplus_module_8.LongString("Unknown error") : tsplus_module_9.getOrUndefined(tsplus_module_3.flatMap(tsplus_module_7.failureOption(exit.cause), _ => typeof _ === "object" && _ !== null && "message" in _ && tsplus_module_8.LongString.Guard(_.message) ? tsplus_module_3.some(_.message) : tsplus_module_9.none)) ?? null
|
|
61
59
|
})
|
|
62
60
|
});
|
|
63
61
|
}));
|
|
64
62
|
}
|
|
65
63
|
function update(id, progress) {
|
|
66
|
-
return
|
|
67
|
-
if (
|
|
64
|
+
return tsplus_module_1.flatMap(findOp(id), _ => tsplus_module_1.sync(() => {
|
|
65
|
+
if (tsplus_module_3.isNone(_)) {
|
|
68
66
|
throw new Error("Not found");
|
|
69
67
|
}
|
|
70
68
|
ops.set(id, {
|
|
@@ -76,20 +74,20 @@ const make = tsplus_module_1.Effect.sync(() => {
|
|
|
76
74
|
}
|
|
77
75
|
return {
|
|
78
76
|
cleanup,
|
|
79
|
-
register:
|
|
77
|
+
register: tsplus_module_1.tap(makeOp, id => tsplus_module_1.zipRight(tsplus_module_1.acquireRelease(addOp(id), (_, exit) => finishOp(id, exit)))(tsplus_module_10.annotateLogscoped("operationId", id))),
|
|
80
78
|
find: findOp,
|
|
81
79
|
update
|
|
82
80
|
};
|
|
83
81
|
});
|
|
84
|
-
const cleanupLoop =
|
|
85
|
-
if (
|
|
86
|
-
return tsplus_module_1.
|
|
82
|
+
const cleanupLoop = tsplus_module_1.forkScoped(tsplus_module_1.schedule(tsplus_module_1.flatMap(tsplus_module_1.exit(_service.Operations.flatMap(_ => _.cleanup)), _ => {
|
|
83
|
+
if (tsplus_module_6.isSuccess(_)) {
|
|
84
|
+
return tsplus_module_1.unit;
|
|
87
85
|
} else {
|
|
88
86
|
return reportAppError(_.cause);
|
|
89
87
|
}
|
|
90
|
-
}),
|
|
88
|
+
}), tsplus_module_12.fixed(tsplus_module_11.minutes(1))));
|
|
91
89
|
/**
|
|
92
90
|
* @tsplus static Operations.Ops Live
|
|
93
91
|
*/
|
|
94
|
-
const Live = exports.Live =
|
|
92
|
+
const Live = exports.Live = tsplus_module_13.provideMerge(tsplus_module_13.scopedDiscard(cleanupLoop))(tsplus_module_13.effect(_service.Operations)(make));
|
|
95
93
|
//# sourceMappingURL=live.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"live.cjs","names":["_reportError","require","_errorReporter","_Operations","_service","_getRequireWildcardCache","e","WeakMap","r","t","_interopRequireWildcard","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","reportAppError","reportError","cause","RequestException","make","tsplus_module_1","
|
|
1
|
+
{"version":3,"file":"live.cjs","names":["_reportError","require","_errorReporter","_Operations","_service","_getRequireWildcardCache","e","WeakMap","r","t","_interopRequireWildcard","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","reportAppError","reportError","cause","RequestException","make","tsplus_module_1","sync","ops","Map","makeOp","OperationId","cleanup","before","tsplus_module_2","DateSubHours","Date","tsplus_module_5","forEach","tsplus_module_4","ext_itToChunk","entries","id","op","lastChanged","tsplus_module_3","getOrElse","fromNullable","updatedAt","createdAt","delete","addOp","Operation","findOp","finishOp","exit","flatMap","_","isNone","Error","value","result","tsplus_module_6","isSuccess","Success","Failure","message","tsplus_module_7","isInterrupted","tsplus_module_8","LongString","isDie","tsplus_module_9","getOrUndefined","failureOption","Guard","some","none","update","progress","register","tap","zipRight","acquireRelease","tsplus_module_10","annotateLogscoped","find","cleanupLoop","forkScoped","schedule","Operations","unit","tsplus_module_12","fixed","tsplus_module_11","minutes","Live","exports","tsplus_module_13","provideMerge","scopedDiscard","effect"],"sources":["../../../_src/services/Operations/live.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAEA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAAyC,SAAAI,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAI,wBAAAJ,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAM,OAAA,EAAAN,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAI,GAAA,CAAAP,CAAA,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6B,gBAAA,CAAAC,iBAAA,CAAyB,aAAa,EAAE3C,EAAE,CAAC,CAGxC,CACJ;IAEH4C,IAAI,EAAEjC,MAAM;IACZyB;GACD;AACH,CAAC,CAAC;AAEF,MAAMS,WAAW,GAAA7D,eAAA,CAAA8D,UAAA,CAAG9D,eAAA,CAAA+D,QAAA,CAAA/D,eAAA,CAAA8B,OAAA,CAAA9B,eAAA,CAAA6B,IAAA,CAAAmC,mBAAU,CAC3BlC,OAAO,CAAEC,CAAC,IAAKA,CAAC,CAACzB,OAAO,CAAC,GAEhByB,CAAC,IAAI;EACb,IAAIK,eAAA,CAAAC,SAAA,CAAAN,CAAC,CAAY,EAAE;IACjB,OAAA/B,eAAA,CAAAiE,IAAA;EACF,CAAC,MAAM;IACL,OAAOtE,cAAc,CAACoC,CAAC,CAAClC,KAAK,CAAC;EAChC;AACF,CAAC,CAAC,EACQqE,gBAAA,CAAAC,KAAA,CAAeC,gBAAA,CAAAC,OAAA,CAAiB,CAAC,CAAC,CAAC,CAAC,CACnC;AAEb;;;AAGO,MAAMC,IAAI,GAAAC,OAAA,CAAAD,IAAA,GAAAE,gBAAA,CAAAC,YAAA,CAAAD,gBAAA,CAAAE,aAAA,CACbb,WAAW,GADKW,gBAAA,CAAAG,MAAA,CAAaX,mBAAU,EAAvBjE,IAAI,CAAoB,CAEnB"}
|
|
@@ -8,9 +8,8 @@ exports.forkOperation2 = forkOperation2;
|
|
|
8
8
|
exports.forkOperationFunction = forkOperationFunction;
|
|
9
9
|
exports.forkOperationWithEffect = forkOperationWithEffect;
|
|
10
10
|
var tsplus_module_1 = _interopRequireWildcard(require("@effect-app/prelude/service"));
|
|
11
|
-
var tsplus_module_2 = _interopRequireWildcard(require("effect/
|
|
12
|
-
var tsplus_module_3 = _interopRequireWildcard(require("
|
|
13
|
-
var tsplus_module_4 = _interopRequireWildcard(require("effect/impl/Effect"));
|
|
11
|
+
var tsplus_module_2 = _interopRequireWildcard(require("@effect-app/infra/api/reportError"));
|
|
12
|
+
var tsplus_module_3 = _interopRequireWildcard(require("effect/Effect"));
|
|
14
13
|
var Scope = _interopRequireWildcard(require("effect/Scope"));
|
|
15
14
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
16
15
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -25,7 +24,7 @@ class Operations extends tsplus_module_1.TagClass() {}
|
|
|
25
24
|
*/
|
|
26
25
|
exports.Operations = Operations;
|
|
27
26
|
function forkOperation_1(self) {
|
|
28
|
-
return Operations.flatMap(Operations =>
|
|
27
|
+
return Operations.flatMap(Operations => tsplus_module_3.flatMap(Scope.make(), scope => tsplus_module_3.tap(Scope.extend(Operations.register, scope), () => tsplus_module_2.forkDaemonReportRequestUnexpected(Scope.use(self, scope)))));
|
|
29
28
|
}
|
|
30
29
|
/**
|
|
31
30
|
* @tsplus getter function forkOperation
|
|
@@ -37,12 +36,12 @@ function forkOperationFunction(fnc) {
|
|
|
37
36
|
* @tsplus static effect/io/Effect.Ops forkOperation
|
|
38
37
|
*/
|
|
39
38
|
function forkOperation2(self) {
|
|
40
|
-
return Operations.flatMap(Operations =>
|
|
39
|
+
return Operations.flatMap(Operations => tsplus_module_3.flatMap(Scope.make(), scope => tsplus_module_3.tap(Scope.extend(Operations.register, scope), id => tsplus_module_2.forkDaemonReportRequestUnexpected(Scope.use(self(id), scope)))));
|
|
41
40
|
}
|
|
42
41
|
/**
|
|
43
42
|
* @tsplus static effect/io/Effect.Ops forkOperationWithEffect
|
|
44
43
|
*/
|
|
45
44
|
function forkOperationWithEffect(self, fnc) {
|
|
46
|
-
return Operations.flatMap(Operations =>
|
|
45
|
+
return Operations.flatMap(Operations => tsplus_module_3.flatMap(Scope.make(), scope => tsplus_module_3.tap(tsplus_module_3.tap(Scope.extend(Operations.register, scope), opId => tsplus_module_2.forkDaemonReportRequestUnexpected(Scope.use(self(opId), scope))), opId => Scope.extend(tsplus_module_3.forkScoped(tsplus_module_3.interruptible(fnc(opId))), scope))));
|
|
47
46
|
}
|
|
48
47
|
//# sourceMappingURL=service.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.cjs","names":["Scope","_interopRequireWildcard","require","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","forkOperation","exports","forkOperation_1","Operations","tsplus_module_1","TagClass","self","flatMap","
|
|
1
|
+
{"version":3,"file":"service.cjs","names":["Scope","_interopRequireWildcard","require","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","forkOperation","exports","forkOperation_1","Operations","tsplus_module_1","TagClass","self","flatMap","tsplus_module_3","make","scope","tap","extend","register","tsplus_module_2","forkDaemonReportRequestUnexpected","use","forkOperationFunction","fnc","inp","forkOperation2","id","forkOperationWithEffect","opId","forkScoped","interruptible"],"sources":["../../../_src/services/Operations/service.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAqC,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GA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AAkC,CAAC,EACjEa,IAAI,IAAK/C,KA1EV,CAAAoC,MAAA,CAAAJ,eAAA,CAAAgB,UAAA,CAAAhB,eAAA,CAAAiB,aAAA,CA0EUP,GAAG,CAACK,IAAI,CAAC,IAAiCb,KAAK,CAAC,CAAC,CACnE,CACN;AACH"}
|
|
@@ -9,10 +9,9 @@ exports.reportFatalQueueError = void 0;
|
|
|
9
9
|
exports.reportNonInterruptedFailure = reportNonInterruptedFailure;
|
|
10
10
|
exports.reportNonInterruptedFailureCause = reportNonInterruptedFailureCause;
|
|
11
11
|
exports.reportQueueError = void 0;
|
|
12
|
-
var tsplus_module_1 = _interopRequireWildcard(require("effect/
|
|
13
|
-
var tsplus_module_2 = _interopRequireWildcard(require("effect/
|
|
14
|
-
var tsplus_module_3 = _interopRequireWildcard(require("effect/
|
|
15
|
-
var tsplus_module_4 = _interopRequireWildcard(require("effect/impl/Cause"));
|
|
12
|
+
var tsplus_module_1 = _interopRequireWildcard(require("effect/Effect"));
|
|
13
|
+
var tsplus_module_2 = _interopRequireWildcard(require("effect/Exit"));
|
|
14
|
+
var tsplus_module_3 = _interopRequireWildcard(require("effect/Cause"));
|
|
16
15
|
var _errorReporter = require("@effect-app/infra/errorReporter");
|
|
17
16
|
var _errors = require("@effect-app/infra/errors");
|
|
18
17
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
@@ -47,14 +46,14 @@ function forkDaemonReportQueue(self) {
|
|
|
47
46
|
const reportFatalQueueError = exports.reportFatalQueueError = (0, _errorReporter.reportError)(cause => new FatalQueueException(cause));
|
|
48
47
|
function reportNonInterruptedFailure(context) {
|
|
49
48
|
const report = reportNonInterruptedFailureCause(context);
|
|
50
|
-
return inp => tsplus_module_1.flatMap(tsplus_module_1.exit(inp), result =>
|
|
49
|
+
return inp => tsplus_module_1.flatMap(tsplus_module_1.exit(inp), result => tsplus_module_2.match(result, {
|
|
51
50
|
onFailure: cause => tsplus_module_1.map(report(cause), () => result),
|
|
52
|
-
onSuccess: () =>
|
|
51
|
+
onSuccess: () => tsplus_module_1.sync(() => result)
|
|
53
52
|
}));
|
|
54
53
|
}
|
|
55
54
|
function reportNonInterruptedFailureCause(context) {
|
|
56
55
|
return cause => {
|
|
57
|
-
if (
|
|
56
|
+
if (tsplus_module_3.isInterrupted(cause)) {
|
|
58
57
|
return tsplus_module_1.failCause(cause);
|
|
59
58
|
}
|
|
60
59
|
return reportQueueError(cause, context);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.cjs","names":["_errorReporter","require","_errors","_getRequireWildcardCache","e","WeakMap","r","t","_interopRequireWildcard","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","MessageException","CauseException","constructor","cause","exports","FatalQueueException","reportQueueError_","reportError","reportQueueError","extras","forkDaemonReportQueue","self","tsplus_module_1","daemonChildren","fork","tapErrorCause","reportNonInterruptedFailureCause","reportFatalQueueError","reportNonInterruptedFailure","context","report","inp","flatMap","exit","result","
|
|
1
|
+
{"version":3,"file":"errors.cjs","names":["_errorReporter","require","_errors","_getRequireWildcardCache","e","WeakMap","r","t","_interopRequireWildcard","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","MessageException","CauseException","constructor","cause","exports","FatalQueueException","reportQueueError_","reportError","reportQueueError","extras","forkDaemonReportQueue","self","tsplus_module_1","daemonChildren","fork","tapErrorCause","reportNonInterruptedFailureCause","reportFatalQueueError","reportNonInterruptedFailure","context","report","inp","flatMap","exit","result","tsplus_module_2","match","onFailure","map","onSuccess","sync","tsplus_module_3","isInterrupted","failCause"],"sources":["../../../_src/services/QueueMaker/errors.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,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AACG,OAAiC;EAChF,OAAWhB,KAAe,IAAgC;IACxD,IAAI4B,eAAA,CAAAC,aAAA,CAAA7B,KAAK,CAAgB,EAAE;MACzB,OAAAS,eAAA,CAAAqB,SAAA,CAAQ9B,KAAsB;IAChC;IACA,OAAOK,gBAAgB,CAACL,KAAK,EAAEgB,OAAO,CAAC;EACzC,CAAC;AACH"}
|
|
@@ -5,12 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.makeMemQueue = makeMemQueue;
|
|
7
7
|
var tsplus_module_1 = _interopRequireWildcard(require("effect/Effect"));
|
|
8
|
-
var tsplus_module_2 = _interopRequireWildcard(require("effect/
|
|
9
|
-
var tsplus_module_3 = _interopRequireWildcard(require("@effect-app/
|
|
10
|
-
var tsplus_module_4 = _interopRequireWildcard(require("@effect-app/
|
|
11
|
-
var tsplus_module_5 = _interopRequireWildcard(require("@effect-app/prelude/
|
|
12
|
-
var tsplus_module_6 = _interopRequireWildcard(require("
|
|
13
|
-
var tsplus_module_7 = _interopRequireWildcard(require("effect/impl/Fiber"));
|
|
8
|
+
var tsplus_module_2 = _interopRequireWildcard(require("@effect-app/core/_ext/Iterable"));
|
|
9
|
+
var tsplus_module_3 = _interopRequireWildcard(require("@effect-app/infra/services/QueueMaker/errors"));
|
|
10
|
+
var tsplus_module_4 = _interopRequireWildcard(require("@effect-app/prelude/utils"));
|
|
11
|
+
var tsplus_module_5 = _interopRequireWildcard(require("@effect-app/prelude/schema"));
|
|
12
|
+
var tsplus_module_6 = _interopRequireWildcard(require("effect/Fiber"));
|
|
14
13
|
var _memQueue = require("@effect-app/infra-adapters/memQueue");
|
|
15
14
|
var _RequestContext = require("@effect-app/infra/RequestContext");
|
|
16
15
|
var _ids = require("@effect-app/prelude/ids");
|
|
@@ -23,41 +22,41 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
23
22
|
* @tsplus static QueueMaker.Ops makeMem
|
|
24
23
|
*/
|
|
25
24
|
function makeMemQueue(queueName, queueDrainName, encoder, makeHandleEvent, provideContext, parseDrain) {
|
|
26
|
-
return tsplus_module_1.
|
|
25
|
+
return tsplus_module_1.gen(function* ($) {
|
|
27
26
|
const mem = yield* $(_memQueue.MemQueue);
|
|
28
27
|
const q = yield* $(mem.getOrCreateQueue(queueName));
|
|
29
28
|
const qDrain = yield* $(mem.getOrCreateQueue(queueDrainName));
|
|
30
29
|
return {
|
|
31
|
-
publish: (...messages) => tsplus_module_1.
|
|
30
|
+
publish: (...messages) => tsplus_module_1.gen(function* ($) {
|
|
32
31
|
const requestContext = yield* $(_RequestContextContainer.RequestContextContainer.get);
|
|
33
|
-
return yield* $(
|
|
32
|
+
return yield* $(tsplus_module_3.forkDaemonReportQueue(tsplus_module_2.ext_forEach(messages, m => tsplus_module_1.asUnit(
|
|
34
33
|
// we JSON encode, because that is what the wire also does, and it reveals holes in e.g unknown encoders (Date->String)
|
|
35
|
-
|
|
34
|
+
tsplus_module_1.flatMap(tsplus_module_1.sync(() => JSON.stringify(encoder({
|
|
36
35
|
body: m,
|
|
37
36
|
meta: requestContext
|
|
38
37
|
})))
|
|
39
38
|
// .tap((msg) => info("Publishing Mem Message: " + utils.inspect(msg)))
|
|
40
39
|
, _ => q.offer(_))))));
|
|
41
40
|
}),
|
|
42
|
-
drain: tsplus_module_1.
|
|
41
|
+
drain: tsplus_module_1.gen(function* ($) {
|
|
43
42
|
const handleEvent = yield* $(makeHandleEvent);
|
|
44
43
|
const silenceAndReportError = (0, _errors2.reportNonInterruptedFailure)({
|
|
45
44
|
name: "MemQueue.drain." + queueDrainName
|
|
46
45
|
});
|
|
47
46
|
const processMessage = msg =>
|
|
48
47
|
// we JSON parse, because that is what the wire also does, and it reveals holes in e.g unknown encoders (Date->String)
|
|
49
|
-
|
|
48
|
+
tsplus_module_1.flatMap(tsplus_module_1.orDie(tsplus_module_1.flatMap(tsplus_module_1.sync(() => JSON.parse(msg)), parseDrain)), ({
|
|
50
49
|
body,
|
|
51
50
|
meta
|
|
52
51
|
}) => provideContext(_RequestContext.RequestContext.inherit(meta, {
|
|
53
52
|
id: (0, _ids.RequestId)(body.id),
|
|
54
53
|
locale: "en",
|
|
55
|
-
name:
|
|
56
|
-
}))(silenceAndReportError(
|
|
57
|
-
body:
|
|
58
|
-
meta:
|
|
59
|
-
})(tsplus_module_1.
|
|
60
|
-
return yield* $(
|
|
54
|
+
name: tsplus_module_5.ReasonableString(body._tag)
|
|
55
|
+
}))(silenceAndReportError(tsplus_module_1.zipRight(tsplus_module_1.tap(tsplus_module_1.annotateLogs({
|
|
56
|
+
body: tsplus_module_4.RecordPretty(tsplus_module_4.object$(body)),
|
|
57
|
+
meta: tsplus_module_4.RecordPretty(tsplus_module_4.object$(meta))
|
|
58
|
+
})(tsplus_module_1.logDebug(`$$ [${queueDrainName}] Processing incoming message`)), () => _Memory.restoreFromRequestContext), handleEvent(body)))));
|
|
59
|
+
return yield* $(tsplus_module_1.forkScoped(tsplus_module_1.forever(silenceAndReportError(tsplus_module_1.flatMap(qDrain.take(), x => tsplus_module_1.flatMap(tsplus_module_1.fork(tsplus_module_1.uninterruptible(processMessage(x))), _ => tsplus_module_6.join(_)))
|
|
61
60
|
// TODO: normally a failed item would be returned to the queue and retried up to X times.
|
|
62
61
|
// .flatMap(_ => _._tag === "Failure" && !isInterrupted ? qDrain.offer(x) : Effect.unit) // TODO: retry count tracking and max retries.
|
|
63
62
|
))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memQueue.cjs","names":["_memQueue","require","_RequestContext","_ids","_RequestContextContainer","_Memory","_errors2","_getRequireWildcardCache","e","WeakMap","r","t","_interopRequireWildcard","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","makeMemQueue","queueName","queueDrainName","encoder","makeHandleEvent","provideContext","parseDrain","tsplus_module_1","
|
|
1
|
+
{"version":3,"file":"memQueue.cjs","names":["_memQueue","require","_RequestContext","_ids","_RequestContextContainer","_Memory","_errors2","_getRequireWildcardCache","e","WeakMap","r","t","_interopRequireWildcard","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","makeMemQueue","queueName","queueDrainName","encoder","makeHandleEvent","provideContext","parseDrain","tsplus_module_1","gen","$","mem","MemQueue","q","getOrCreateQueue","qDrain","publish","messages","requestContext","RequestContextContainer","tsplus_module_3","forkDaemonReportQueue","tsplus_module_2","ext_forEach","m","asUnit","flatMap","sync","JSON","stringify","body","meta","_","offer","drain","handleEvent","silenceAndReportError","reportNonInterruptedFailure","name","processMessage","msg","orDie","parse","RequestContext","inherit","id","RequestId","locale","tsplus_module_5","ReasonableString","_tag","zipRight","tap","annotateLogs","tsplus_module_4","RecordPretty","object$","logDebug","restoreFromRequestContext","forkScoped","forever","take","x","fork","uninterruptible","tsplus_module_6","join"],"sources":["../../../_src/services/QueueMaker/memQueue.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AAEA,IAAAG,wBAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAAyD,SAAAM,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAI,wBAAAJ,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAM,OAAA,EAAAN,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAA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AA,CAAA2C,QAAA,CAAA3C,eAAA,CAAA4C,GAAA,CAES5C,eAAA,CAAA6C,YAAA,CAAoB;UAAEvB,IAAI,EAAAwB,eAAA,CAAAC,YAAA,CAAAD,eAAA,CAAAE,OAAA,CAAE1B,IAAI,EAAU;UAAEC,IAAI,EAAAuB,eAAA,CAAAC,YAAA,CAAAD,eAAA,CAAAE,OAAA,CAAEzB,IAAI;QAAU,CAAE,CAAC,CAF5EvB,eAAA,CAAAiD,QAAA,CACY,OAAOtD,cAAc,+BAA+B,CAAC,GAE1D,MAAMuD,iCAAyB,CAAC,EAC3BvB,WAAW,CAACL,IAAI,CAAC,CAAC,EAU3B,CACJ;QACL,OAAO,OAAOpB,CAAC,CAAAF,eAAA,CAAAmD,UAAA,CAAAnD,eAAA,CAAAoD,OAAA,CAMJxB,qBAAqB,CAL9B5B,eAAA,CAAAkB,OAAA,CAAAX,MAAM,CACH8C,IAAI,EAAE,EACGC,CAAC,IAAKtD,eAAA,CAAAkB,OAAA,CAAAlB,eAAA,CAAAuD,IAAA,CAAAvD,eAAA,CAAAwD,eAAA,CAAAzB,cAAc,CAACuB,CAAC,CAAC,IAA+B9B,CAAC,IAAIiC,eAAA,CAAAC,IAAA,CAAClC,CAAC,CAAK,CAAC;QAC7E;QACA;YAIH;MACH,CAAC;KAC+B;EACpC,CAAC,CAAC;AACJ"}
|
|
@@ -8,10 +8,9 @@ exports.makeServiceBusQueue = makeServiceBusQueue;
|
|
|
8
8
|
var tsplus_module_1 = _interopRequireWildcard(require("@effect-app/core/Tag"));
|
|
9
9
|
var tsplus_module_2 = _interopRequireWildcard(require("effect/Effect"));
|
|
10
10
|
var tsplus_module_3 = _interopRequireWildcard(require("@effect-app/prelude/utils"));
|
|
11
|
-
var tsplus_module_4 = _interopRequireWildcard(require("effect/
|
|
12
|
-
var tsplus_module_5 = _interopRequireWildcard(require("@effect-app/
|
|
13
|
-
var tsplus_module_6 = _interopRequireWildcard(require("
|
|
14
|
-
var tsplus_module_7 = _interopRequireWildcard(require("effect/impl/Layer"));
|
|
11
|
+
var tsplus_module_4 = _interopRequireWildcard(require("@effect-app/prelude/schema"));
|
|
12
|
+
var tsplus_module_5 = _interopRequireWildcard(require("@effect-app/infra/services/QueueMaker/errors"));
|
|
13
|
+
var tsplus_module_6 = _interopRequireWildcard(require("effect/Layer"));
|
|
15
14
|
var _ServiceBus = require("@effect-app/infra-adapters/ServiceBus");
|
|
16
15
|
var _errorReporter = require("@effect-app/infra/errorReporter");
|
|
17
16
|
var _RequestContext = require("@effect-app/infra/RequestContext");
|
|
@@ -25,7 +24,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
25
24
|
* @tsplus static QueueMaker.Ops makeServiceBus
|
|
26
25
|
*/
|
|
27
26
|
function makeServiceBusQueue(_queueName, queueDrainName, encoder, makeHandleEvent, provideContext, parseDrain) {
|
|
28
|
-
return tsplus_module_2.
|
|
27
|
+
return tsplus_module_2.gen(function* ($) {
|
|
29
28
|
const s = yield* $(_ServiceBus.Sender);
|
|
30
29
|
const receiver = yield* $(_ServiceBus.Receiver);
|
|
31
30
|
const receiverLayer = tsplus_module_1.makeLayer(_ServiceBus.Receiver, receiver);
|
|
@@ -36,32 +35,32 @@ function makeServiceBusQueue(_queueName, queueDrainName, encoder, makeHandleEven
|
|
|
36
35
|
name: "ServiceBusQueue.drain." + queueDrainName
|
|
37
36
|
});
|
|
38
37
|
return {
|
|
39
|
-
drain: tsplus_module_2.
|
|
38
|
+
drain: tsplus_module_2.gen(function* ($) {
|
|
40
39
|
const handleEvent = yield* $(makeHandleEvent);
|
|
41
40
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
42
41
|
function processMessage(messageBody) {
|
|
43
|
-
return
|
|
42
|
+
return tsplus_module_2.tapErrorCause(tsplus_module_2.flatMap(tsplus_module_2.orDie(tsplus_module_2.flatMap(tsplus_module_2.sync(() => JSON.parse(messageBody)), x => parseDrain(x))), ({
|
|
44
43
|
body,
|
|
45
44
|
meta
|
|
46
45
|
}) => provideContext(_RequestContext.RequestContext.inherit(meta, {
|
|
47
46
|
id: (0, _ids.RequestId)(body.id),
|
|
48
47
|
locale: "en",
|
|
49
|
-
name:
|
|
50
|
-
}))(silenceAndReportError(
|
|
48
|
+
name: tsplus_module_4.ReasonableString(body._tag)
|
|
49
|
+
}))(silenceAndReportError(tsplus_module_2.orDie(tsplus_module_2.zipRight(tsplus_module_2.tap(tsplus_module_2.annotateLogs({
|
|
51
50
|
body: tsplus_module_3.RecordPretty(tsplus_module_3.object$(body)),
|
|
52
51
|
meta: tsplus_module_3.RecordPretty(tsplus_module_3.object$(meta))
|
|
53
|
-
})(tsplus_module_2.
|
|
52
|
+
})(tsplus_module_2.logDebug(`$$ [${queueDrainName}] Processing incoming message`)), () => _Memory.restoreFromRequestContext), handleEvent(body))))))
|
|
54
53
|
// we reportError here, so that we report the error only, and keep flowing
|
|
55
54
|
, reportError);
|
|
56
55
|
}
|
|
57
|
-
return yield* $(
|
|
58
|
-
processMessage: x =>
|
|
59
|
-
processError: err => tsplus_module_2.
|
|
56
|
+
return yield* $(tsplus_module_2.provide((0, _ServiceBus.subscribe)({
|
|
57
|
+
processMessage: x => tsplus_module_2.uninterruptible(processMessage(x.body)),
|
|
58
|
+
processError: err => tsplus_module_2.sync(() => (0, _errorReporter.captureException)(err.error))
|
|
60
59
|
}), receiverLayer));
|
|
61
60
|
}),
|
|
62
|
-
publish: (...messages) => tsplus_module_2.
|
|
61
|
+
publish: (...messages) => tsplus_module_2.gen(function* ($) {
|
|
63
62
|
const requestContext = yield* $(_RequestContextContainer.RequestContextContainer.get);
|
|
64
|
-
return yield* $(
|
|
63
|
+
return yield* $(tsplus_module_5.forkDaemonReportQueue(tsplus_module_2.promise(() => s.sendMessages(messages.map(x => ({
|
|
65
64
|
body: JSON.stringify(encoder({
|
|
66
65
|
body: x,
|
|
67
66
|
meta: requestContext
|
|
@@ -78,6 +77,6 @@ function makeServiceBusQueue(_queueName, queueDrainName, encoder, makeHandleEven
|
|
|
78
77
|
* @tsplus static QueueMaker.Ops makeServiceBusLayers
|
|
79
78
|
*/
|
|
80
79
|
function makeServiceBusLayers(url, queueName, queueDrainName) {
|
|
81
|
-
return
|
|
80
|
+
return tsplus_module_6.provide(tsplus_module_6.merge((0, _ServiceBus.LiveSender)(queueName))((0, _ServiceBus.LiveReceiver)(queueDrainName)))((0, _ServiceBus.LiveServiceBusClient)(url));
|
|
82
81
|
}
|
|
83
82
|
//# sourceMappingURL=sbqueue.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sbqueue.cjs","names":["_ServiceBus","require","_errorReporter","_RequestContext","_ids","_RequestContextContainer","_Memory","_errors2","_getRequireWildcardCache","e","WeakMap","r","t","_interopRequireWildcard","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","makeServiceBusQueue","_queueName","queueDrainName","encoder","makeHandleEvent","provideContext","parseDrain","tsplus_module_2","
|
|
1
|
+
{"version":3,"file":"sbqueue.cjs","names":["_ServiceBus","require","_errorReporter","_RequestContext","_ids","_RequestContextContainer","_Memory","_errors2","_getRequireWildcardCache","e","WeakMap","r","t","_interopRequireWildcard","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","makeServiceBusQueue","_queueName","queueDrainName","encoder","makeHandleEvent","provideContext","parseDrain","tsplus_module_2","gen","$","s","Sender","receiver","Receiver","receiverLayer","tsplus_module_1","makeLayer","silenceAndReportError","reportNonInterruptedFailure","name","reportError","reportNonInterruptedFailureCause","drain","handleEvent","processMessage","messageBody","tapErrorCause","flatMap","orDie","sync","JSON","parse","x","body","meta","RequestContext","inherit","id","RequestId","locale","tsplus_module_4","ReasonableString","_tag","zipRight","tap","annotateLogs","tsplus_module_3","RecordPretty","object$","logDebug","restoreFromRequestContext","provide","subscribe","uninterruptible","processError","err","captureException","error","publish","messages","requestContext","RequestContextContainer","tsplus_module_5","forkDaemonReportQueue","promise","sendMessages","map","stringify","messageId","contentType","makeServiceBusLayers","url","queueName","tsplus_module_6","merge","LiveSender","LiveReceiver","LiveServiceBusClient"],"sources":["../../../_src/services/QueueMaker/sbqueue.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AASA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAF,OAAA;AACA,IAAAG,IAAA,GAAAH,OAAA;AAEA,IAAAI,wBAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AAA2F,SAAAO,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAI,wBAAAJ,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAM,OAAA,EAAAN,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAI,GAAA,CAAAP,CAAA,UAAAG,CAAA,CAAAK,GAAA,CAAAR,CAAA,OAAAS,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAf,CAAA,oBAAAe,CAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAlB,CAAA,EAAAe,CAAA,SAAAI,CAAA,GAAAR,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAd,CAAA,EAAAe,CAAA,UAAAI,CAAA,K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