@effect-app/infra 0.13.0 → 0.14.1

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 (121) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/_cjs/api/codec.cjs +2 -4
  3. package/_cjs/api/codec.cjs.map +1 -1
  4. package/_cjs/api/defaultErrorHandler.cjs +18 -21
  5. package/_cjs/api/defaultErrorHandler.cjs.map +1 -1
  6. package/_cjs/api/express/makeJsonSchema.cjs +4 -4
  7. package/_cjs/api/express/makeJsonSchema.cjs.map +1 -1
  8. package/_cjs/api/express/makeOpenApiSpecs.cjs +5 -7
  9. package/_cjs/api/express/makeOpenApiSpecs.cjs.map +1 -1
  10. package/_cjs/api/express/schema/requestHandler.cjs +57 -56
  11. package/_cjs/api/express/schema/requestHandler.cjs.map +1 -1
  12. package/_cjs/api/express/schema/routing.cjs +22 -22
  13. package/_cjs/api/express/schema/routing.cjs.map +1 -1
  14. package/_cjs/api/reportError.cjs +6 -17
  15. package/_cjs/api/reportError.cjs.map +1 -1
  16. package/_cjs/api/routing.cjs +70 -70
  17. package/_cjs/api/routing.cjs.map +1 -1
  18. package/_cjs/api/setupRequest.cjs +2 -4
  19. package/_cjs/api/setupRequest.cjs.map +1 -1
  20. package/_cjs/api/writeDocs.cjs +6 -8
  21. package/_cjs/api/writeDocs.cjs.map +1 -1
  22. package/_cjs/errorReporter.cjs +11 -13
  23. package/_cjs/errorReporter.cjs.map +1 -1
  24. package/_cjs/errors.cjs +1 -1
  25. package/_cjs/errors.cjs.map +1 -1
  26. package/_cjs/instrument.cjs +1 -3
  27. package/_cjs/instrument.cjs.map +1 -1
  28. package/_cjs/rateLimit.cjs +6 -8
  29. package/_cjs/rateLimit.cjs.map +1 -1
  30. package/_cjs/services/Emailer/Sendgrid.cjs +12 -18
  31. package/_cjs/services/Emailer/Sendgrid.cjs.map +1 -1
  32. package/_cjs/services/Emailer/fake.cjs +4 -7
  33. package/_cjs/services/Emailer/fake.cjs.map +1 -1
  34. package/_cjs/services/Operations/live.cjs +23 -26
  35. package/_cjs/services/Operations/live.cjs.map +1 -1
  36. package/_cjs/services/Operations/service.cjs +3 -5
  37. package/_cjs/services/Operations/service.cjs.map +1 -1
  38. package/_cjs/services/Repository.cjs +28 -30
  39. package/_cjs/services/Repository.cjs.map +1 -1
  40. package/_cjs/services/Store/Cosmos.cjs +58 -58
  41. package/_cjs/services/Store/Cosmos.cjs.map +1 -1
  42. package/_cjs/services/Store/Disk.cjs +15 -16
  43. package/_cjs/services/Store/Disk.cjs.map +1 -1
  44. package/_cjs/services/Store/Memory.cjs +14 -16
  45. package/_cjs/services/Store/Memory.cjs.map +1 -1
  46. package/_cjs/services/Store/Redis.cjs +22 -23
  47. package/_cjs/services/Store/Redis.cjs.map +1 -1
  48. package/_cjs/services/Store/codeFilter.test.cjs +1 -1
  49. package/_cjs/services/Store/index.cjs +7 -7
  50. package/_cjs/services/Store/index.cjs.map +1 -1
  51. package/_cjs/services/Store/service.cjs +2 -4
  52. package/_cjs/services/Store/service.cjs.map +1 -1
  53. package/_cjs/services/Store/utils.cjs +16 -17
  54. package/_cjs/services/Store/utils.cjs.map +1 -1
  55. package/_cjs/services/simpledb/cosmosdb.cjs +23 -25
  56. package/_cjs/services/simpledb/cosmosdb.cjs.map +1 -1
  57. package/_cjs/services/simpledb/diskdb.cjs +20 -21
  58. package/_cjs/services/simpledb/diskdb.cjs.map +1 -1
  59. package/_cjs/services/simpledb/memdb.cjs +11 -13
  60. package/_cjs/services/simpledb/memdb.cjs.map +1 -1
  61. package/_cjs/services/simpledb/mongodb.cjs +20 -22
  62. package/_cjs/services/simpledb/mongodb.cjs.map +1 -1
  63. package/_cjs/services/simpledb/redisdb.cjs +25 -25
  64. package/_cjs/services/simpledb/redisdb.cjs.map +1 -1
  65. package/_cjs/services/simpledb/shared.cjs +4 -6
  66. package/_cjs/services/simpledb/shared.cjs.map +1 -1
  67. package/_cjs/services/simpledb/simpledb.cjs +16 -17
  68. package/_cjs/services/simpledb/simpledb.cjs.map +1 -1
  69. package/_src/errors.ts +1 -1
  70. package/_src/services/simpledb/memdb.ts +1 -1
  71. package/dist/RequestContext.d.ts +12 -12
  72. package/dist/api/codec.js +3 -5
  73. package/dist/api/defaultErrorHandler.js +20 -21
  74. package/dist/api/express/makeJsonSchema.js +3 -5
  75. package/dist/api/express/makeOpenApiSpecs.js +5 -7
  76. package/dist/api/express/schema/requestHandler.d.ts +5 -5
  77. package/dist/api/express/schema/requestHandler.js +50 -52
  78. package/dist/api/express/schema/routing.js +21 -23
  79. package/dist/api/reportError.js +6 -18
  80. package/dist/api/routing.js +65 -67
  81. package/dist/api/setupRequest.js +3 -5
  82. package/dist/api/writeDocs.js +7 -9
  83. package/dist/errorReporter.js +10 -12
  84. package/dist/errors.js +2 -2
  85. package/dist/instrument.js +2 -4
  86. package/dist/rateLimit.js +7 -9
  87. package/dist/services/Emailer/Sendgrid.js +15 -22
  88. package/dist/services/Emailer/fake.js +5 -8
  89. package/dist/services/Emailer/service.d.ts +1 -1
  90. package/dist/services/Operations/live.js +24 -27
  91. package/dist/services/Operations/service.js +4 -6
  92. package/dist/services/Repository.d.ts +4 -4
  93. package/dist/services/Repository.js +22 -24
  94. package/dist/services/Store/Cosmos.d.ts +1 -1
  95. package/dist/services/Store/Cosmos.js +61 -63
  96. package/dist/services/Store/Disk.js +16 -19
  97. package/dist/services/Store/Memory.d.ts +1 -1
  98. package/dist/services/Store/Memory.js +16 -18
  99. package/dist/services/Store/Redis.d.ts +1 -1
  100. package/dist/services/Store/Redis.js +21 -24
  101. package/dist/services/Store/index.js +6 -8
  102. package/dist/services/Store/service.d.ts +1 -1
  103. package/dist/services/Store/service.js +3 -5
  104. package/dist/services/Store/utils.d.ts +2 -2
  105. package/dist/services/Store/utils.js +18 -19
  106. package/dist/services/simpledb/cosmosdb.d.ts +2 -2
  107. package/dist/services/simpledb/cosmosdb.js +23 -25
  108. package/dist/services/simpledb/diskdb.d.ts +2 -2
  109. package/dist/services/simpledb/diskdb.js +18 -18
  110. package/dist/services/simpledb/memdb.d.ts +3 -3
  111. package/dist/services/simpledb/memdb.js +13 -14
  112. package/dist/services/simpledb/mongodb.d.ts +2 -2
  113. package/dist/services/simpledb/mongodb.js +18 -20
  114. package/dist/services/simpledb/redisdb.d.ts +8 -8
  115. package/dist/services/simpledb/redisdb.js +21 -23
  116. package/dist/services/simpledb/shared.d.ts +9 -9
  117. package/dist/services/simpledb/shared.js +5 -7
  118. package/dist/services/simpledb/simpledb.d.ts +1 -1
  119. package/dist/services/simpledb/simpledb.js +19 -19
  120. package/package.json +12 -12
  121. package/tsconfig.json +5 -1
@@ -7,13 +7,11 @@ exports.SEM_withPermitsDuration = SEM_withPermitsDuration;
7
7
  exports.batch = batch;
8
8
  exports.batchNPar = batchNPar;
9
9
  exports.naiveRateLimit = naiveRateLimit;
10
- var tracer_1 = _interopRequireWildcard(require("@effect/io/Debug"));
11
10
  var tsplus_module_1 = _interopRequireWildcard(require("@effect/io/Effect"));
12
- var tsplus_module_2 = _interopRequireWildcard(require("@effect-app/core/Array"));
13
- var tsplus_module_3 = _interopRequireWildcard(require("@effect-app/core/Effect"));
11
+ var tsplus_module_2 = _interopRequireWildcard(require("@effect-app/core/Effect"));
12
+ var tsplus_module_3 = _interopRequireWildcard(require("@effect-app/core/Array"));
14
13
  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); }
15
14
  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; }
16
- const fileName_1 = "packages/infra/_src/rateLimit.ts";
17
15
  // /**
18
16
  // * Executes the specified effect, acquiring the specified number of permits
19
17
  // * immediately before the effect begins execution and releasing them
@@ -49,7 +47,7 @@ const fileName_1 = "packages/infra/_src/rateLimit.ts";
49
47
  */
50
48
  function SEM_withPermitsDuration(permits, duration) {
51
49
  return self => {
52
- return effect => tracer_1.withCallTrace(fileName_1 + ":38:14")(tsplus_module_1.uninterruptibleMask(restore => tsplus_module_1.zipRight(tracer_1.withCallTrace(fileName_1 + ":42:16")(tsplus_module_1.ensuring(tracer_1.withCallTrace(fileName_1 + ":44:20")(tsplus_module_1.delay(duration))(self.release(permits))))(restore(effect)))(restore(self.take(permits)))));
50
+ return effect => tsplus_module_1.uninterruptibleMask(restore => tsplus_module_2.EffectZipRight(tsplus_module_1.ensuring(restore(effect), tsplus_module_1.delay(self.release(permits), duration)))(restore(self.take(permits))));
53
51
  };
54
52
  }
55
53
  /**
@@ -57,14 +55,14 @@ function SEM_withPermitsDuration(permits, duration) {
57
55
  * @tsplus static Collection.Aspects batchNPar
58
56
  */
59
57
  function batchNPar(n, forEachItem, forEachBatch) {
60
- return items => tsplus_module_2.ext_forEachParWithIndex(tsplus_module_2.chunk_(items, n), (_, i) => tracer_1.withCallTrace(fileName_1 + ":63:12")(tsplus_module_1.flatMap(_ => forEachBatch(_, i)))(tracer_1.withCallTrace(fileName_1 + ":62:11")(tsplus_module_1.forEachParWithIndex((_, j) => forEachItem(_, j, i)))(_)));
58
+ return items => tsplus_module_3.ext_forEachParWithIndex(tsplus_module_3.chunk_(items, n), (_, i) => tsplus_module_1.flatMap(tsplus_module_1.forEachParWithIndex(_, (_, j) => forEachItem(_, j, i)), _ => forEachBatch(_, i)));
61
59
  }
62
60
  /**
63
61
  * @tsplus pipeable Iterable batch
64
62
  * @tsplus static Collection.Aspects batch
65
63
  */
66
64
  function batch(n, forEachItem, forEachBatch) {
67
- return items => tsplus_module_2.ext_forEachWithIndex(tsplus_module_2.chunk_(items, n), (_, i) => tracer_1.withCallTrace(fileName_1 + ":80:12")(tsplus_module_1.flatMap(_ => forEachBatch(_, i)))(tracer_1.withCallTrace(fileName_1 + ":79:11")(tsplus_module_1.forEachParWithIndex((_, j) => forEachItem(_, j, i)))(_)));
65
+ return items => tsplus_module_3.ext_forEachWithIndex(tsplus_module_3.chunk_(items, n), (_, i) => tsplus_module_1.flatMap(tsplus_module_1.forEachParWithIndex(_, (_, j) => forEachItem(_, j, i)), _ => forEachBatch(_, i)));
68
66
  }
69
67
  // /**
70
68
  // * @tsplus pipeable Iterable rateLimit
@@ -90,6 +88,6 @@ function batch(n, forEachItem, forEachBatch) {
90
88
  * @tsplus static Collection.Aspects naiveRateLimit
91
89
  */
92
90
  function naiveRateLimit(n, d) {
93
- return items => (forEachItem, forEachBatch) => tsplus_module_2.ext_forEachWithIndex(tsplus_module_2.chunk_(items, n), (batch, i) => tracer_1.withCallTrace(fileName_1 + ":120:12")(tsplus_module_1.zipRight(tracer_1.withCallTrace(fileName_1 + ":123:16")(tsplus_module_1.flatMap(forEachBatch))(tracer_1.withCallTrace(fileName_1 + ":122:16")(tsplus_module_1.withParallelism(n))(tsplus_module_2.ext_forEachEffectPar(batch, forEachItem)))))(i === 0 ? tsplus_module_3.unit : tracer_1.withCallTrace(fileName_1 + ":119:48")(tsplus_module_1.delay(d))(tsplus_module_3.unit)));
91
+ return items => (forEachItem, forEachBatch) => tsplus_module_3.ext_forEachWithIndex(tsplus_module_3.chunk_(items, n), (batch, i) => tsplus_module_1.zipRight(i === 0 ? tsplus_module_2.unit : tsplus_module_1.delay(tsplus_module_2.unit, d), tsplus_module_1.flatMap(tsplus_module_1.withParallelism(tsplus_module_3.ext_forEachEffectPar(batch, forEachItem), n), forEachBatch)));
94
92
  }
95
93
  //# sourceMappingURL=rateLimit.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"rateLimit.cjs","mappings":";;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;;;;;;;;AASM,SAAUA,uBAAuB,CAACC,OAAe,EAAEC,QAAa;EACpE,OAAQC,IAAe,IAA2D;IAChF,OAAOC,MAAM,IAAGC,8CACdC,oCACEC,OAAO,IAAGD,yBAEJD,uEAEEA,oEACSH,QAAQ,GADjBC,IAAI,CAACK,OAAO,CAACP,OAAO,CAAC,CACH,GAHpBM,OAAO,CAACH,MAAM,CAAC,CAId,EALLG,OAAO,CAACJ,IAAI,CAACM,IAAI,CAACR,OAAO,CAAC,CAAC,CAKtB,CACR;EACL,CAAC;AACH;AAEA;;;;AAIM,SAAUS,SAAS,CACvBC,CAAS,EACTC,WAA0E,EAC1EC,YAA4D;EAE5D,OAAQC,KAAkB,IACxBC,oEAAK,EAAOJ,CAAC,CAAC,EACe,CAACK,CAAC,EAAEC,CAAC,KAC9BZ,sEACWW,CAAC,IAAIH,YAAY,CAACG,CAAC,EAAEC,CAAC,CAAC,GADlCZ,kFAAsB,CAACW,CAAC,EAAEE,CAAC,KAAKN,WAAW,CAACI,CAAC,EAAEE,CAAC,EAAED,CAAC,CAAC,GAApDD,CAAC,CAAoD,CAClB,CACpC;AACP;AAEA;;;;AAIM,SAAUG,KAAK,CACnBR,CAAS,EACTC,WAA+E,EAC/EC,YAA4D;EAE5D,OAAQC,KAAkB,IACxBC,iEAAK,EAAOJ,CAAC,CAAC,EACY,CAACK,CAAC,EAAEC,CAAC,KAC3BZ,sEACWW,CAAC,IAAIH,YAAY,CAACG,CAAC,EAAEC,CAAC,CAAC,GADlCZ,kFAAsB,CAACW,CAAC,EAAEE,CAAC,KAAKN,WAAW,CAACI,CAAC,EAAEE,CAAC,EAAED,CAAC,CAAC,GAApDD,CAAC,CAAoD,CAClB,CACpC;AACP;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;;;AAKM,SAAUI,cAAc,CAC5BT,CAAS,EACTU,CAAM;EAEN,OAAWP,KAAkB,IAAM,CACjCF,WAAsC,EACtCC,YAAiD,KAEjDE,iEAAK,EAAOJ,CAAC,CAAC,EACY,CAACQ,KAAK,EAAEF,CAAC,KAC/BZ,wEAEIA,uEAEWQ,YAAY,GAFvBR,+EACmBM,CAAC,GADpBI,0CAAK,EAAkBH,WAAW,CAAC,CACd,CACG,GAJ1BK,CAAC,KAAK,CAAC,GAAGK,uBAAejB,qEAAkBgB,CAAC,wBAAC,CAK5C,CACH;AACR","names":["SEM_withPermitsDuration","permits","duration","self","effect","tracer_1","tsplus_module_1","restore","release","take","batchNPar","n","forEachItem","forEachBatch","items","tsplus_module_2","_","i","j","batch","naiveRateLimit","d","tsplus_module_3"],"sourceRoot":"","sources":["../_src/rateLimit.ts"],"sourcesContent":[null]}
1
+ {"version":3,"file":"rateLimit.cjs","mappings":";;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;;;;;;;;AASM,SAAUA,uBAAuB,CAACC,OAAe,EAAEC,QAAa;EACpE,OAAQC,IAAe,IAA2D;IAChF,OAAOC,MAAM,IACXC,oCACEC,OAAO,IAAGC,+BAEJF,gCAAO,CAACD,MAAM,CAAC,EAEbC,0BAAI,CAACG,OAAO,CAACP,OAAO,CAAC,EACZC,QAAQ,CAAC,CACnB,EALLI,OAAO,CAACH,IAAI,CAACM,IAAI,CAACR,OAAO,CAAC,CAAC,CAKtB,CACR;EACL,CAAC;AACH;AAEA;;;;AAIM,SAAUS,SAAS,CACvBC,CAAS,EACTC,WAA0E,EAC1EC,YAA4D;EAE5D,OAAQC,KAAkB,IACxBC,oEAAK,EAAOJ,CAAC,CAAC,EACe,CAACK,CAAC,EAAEC,CAAC,KAC9BZ,6DAAC,EAAqB,CAACW,CAAC,EAAEE,CAAC,KAAKN,WAAW,CAACI,CAAC,EAAEE,CAAC,EAAED,CAAC,CAAC,CAAC,EAC1CD,CAAC,IAAIH,YAAY,CAACG,CAAC,EAAEC,CAAC,CAAC,CAAC,CACpC;AACP;AAEA;;;;AAIM,SAAUE,KAAK,CACnBR,CAAS,EACTC,WAA+E,EAC/EC,YAA4D;EAE5D,OAAQC,KAAkB,IACxBC,iEAAK,EAAOJ,CAAC,CAAC,EACY,CAACK,CAAC,EAAEC,CAAC,KAC3BZ,6DAAC,EAAqB,CAACW,CAAC,EAAEE,CAAC,KAAKN,WAAW,CAACI,CAAC,EAAEE,CAAC,EAAED,CAAC,CAAC,CAAC,EAC1CD,CAAC,IAAIH,YAAY,CAACG,CAAC,EAAEC,CAAC,CAAC,CAAC,CACpC;AACP;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;;;AAKM,SAAUG,cAAc,CAC5BT,CAAS,EACTU,CAAM;EAEN,OAAWP,KAAkB,IAAM,CACjCF,WAAsC,EACtCC,YAAiD,KAEjDE,iEAAK,EAAOJ,CAAC,CAAC,EACY,CAACQ,KAAK,EAAEF,CAAC,KAC/BZ,yBAAEY,CAAC,KAAK,CAAC,GAAGV,uBAAeF,4CAAkBgB,CAAC,CAAC,EAE3ChB,kGAAK,EAAkBO,WAAW,CAAC,EAChBD,CAAC,CAAC,EACVE,YAAY,CAAC,CACzB,CACH;AACR","names":["SEM_withPermitsDuration","permits","duration","self","effect","tsplus_module_1","restore","tsplus_module_2","release","take","batchNPar","n","forEachItem","forEachBatch","items","tsplus_module_3","_","i","j","batch","naiveRateLimit","d"],"sourceRoot":"","sources":["../_src/rateLimit.ts"],"sourcesContent":[null]}
@@ -6,30 +6,27 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.LiveSendgrid = LiveSendgrid;
7
7
  exports.isTestAddress = isTestAddress;
8
8
  exports.renderMessage = renderMessage;
9
- var tracer_1 = _interopRequireWildcard(require("@effect/io/Debug"));
10
9
  var tsplus_module_1 = _interopRequireWildcard(require("@effect/io/Config/Secret"));
11
10
  var tsplus_module_2 = _interopRequireWildcard(require("@effect/io/Effect"));
12
- var tsplus_module_3 = _interopRequireWildcard(require("@effect-app/core/Effect"));
13
- var tsplus_module_4 = _interopRequireWildcard(require("@fp-ts/data/Equivalence"));
14
- var tsplus_module_5 = _interopRequireWildcard(require("@effect-app/core/_ext/ord.ext"));
15
- var tsplus_module_6 = _interopRequireWildcard(require("@effect-app/core/Array"));
11
+ var tsplus_module_3 = _interopRequireWildcard(require("@fp-ts/core/typeclass/Equivalence"));
12
+ var tsplus_module_4 = _interopRequireWildcard(require("@effect-app/core/_ext/ord.ext"));
13
+ var tsplus_module_5 = _interopRequireWildcard(require("@effect-app/core/Array"));
16
14
  var _mail = _interopRequireDefault(require("@sendgrid/mail"));
17
15
  var _util = require("util");
18
16
  var _service = require("./service.cjs");
19
17
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
18
  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
19
  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
- const fileName_1 = "packages/infra/_src/services/Emailer/Sendgrid.ts";
23
20
  const makeLiveSendgrid = ({
24
21
  apiKey,
25
22
  defaultFrom,
26
23
  realMail,
27
24
  subjectPrefix
28
- }) => tracer_1.withCallTrace(fileName_1 + ":8:3")(tsplus_module_2.sync(() => {
25
+ }) => tsplus_module_2.sync(() => {
29
26
  _mail.default.setApiKey(tsplus_module_1.value(apiKey));
30
27
  return {
31
28
  sendMail(msg_) {
32
- return tracer_1.withCallTrace(fileName_1 + ":13:23")(tsplus_module_2.gen(function* ($) {
29
+ return tsplus_module_2.gen(function* ($) {
33
30
  const msg = {
34
31
  ...msg_,
35
32
  from: msg_.from ?? defaultFrom
@@ -40,8 +37,8 @@ const makeLiveSendgrid = ({
40
37
  ...renderedMsg_,
41
38
  subject: `${subjectPrefix}${renderedMsg_.subject}`
42
39
  };
43
- yield* $(tracer_1.withCallTrace(fileName_1 + ":19:53")(tsplus_module_2.logAnnotate("msg", (0, _util.inspect)(renderedMsg, false, 5)))(tracer_1.withCallTrace(fileName_1 + ":19:27")(tsplus_module_2.logDebug("Sending email"))));
44
- const ret = yield* $(tracer_1.withCallTrace(fileName_1 + ":22:20")(tsplus_module_2.async(cb => void _mail.default.send(renderedMsg, false, (err, result) => err ? cb(tracer_1.withCallTrace(fileName_1 + ":30:31")(tsplus_module_2.fail(err))) : cb(tracer_1.withCallTrace(fileName_1 + ":31:24")(tsplus_module_2.sync(() => result)))))));
40
+ yield* $(tsplus_module_2.logAnnotate(tsplus_module_2.logDebug("Sending email"), "msg", (0, _util.inspect)(renderedMsg, false, 5)));
41
+ const ret = yield* $(tsplus_module_2.async(cb => void _mail.default.send(renderedMsg, false, (err, result) => err ? cb(tsplus_module_2.fail(err)) : cb(tsplus_module_2.sync(() => result)))));
45
42
  // const event = {
46
43
  // name: "EmailSent",
47
44
  // properties: {
@@ -52,18 +49,15 @@ const makeLiveSendgrid = ({
52
49
  // const { trackEvent } = yield* $(AiContextService.access)
53
50
  // trackEvent(event)
54
51
  return ret;
55
- }));
52
+ });
56
53
  }
57
54
  };
58
- })
59
- /**
60
- * @tsplus static Emailer.Ops LiveSendgrid
61
- */);
55
+ });
62
56
  /**
63
57
  * @tsplus static Emailer.Ops LiveSendgrid
64
58
  */
65
59
  function LiveSendgrid(config) {
66
- return tsplus_module_3.toLayer(tracer_1.withCallTrace(fileName_1 + ":55:6")(tsplus_module_2.flatMap(makeLiveSendgrid))(tsplus_module_2.config(config)), _service.Emailer);
60
+ return tsplus_module_2.toLayer(tsplus_module_2.flatMap(tsplus_module_2.config(config), makeLiveSendgrid), _service.Emailer);
67
61
  }
68
62
  /**
69
63
  * @hidden
@@ -95,11 +89,11 @@ function renderFake(addr, makeId) {
95
89
  email: `test+${makeId()}@nomizz.com`
96
90
  };
97
91
  }
98
- const eq = tsplus_module_4.contramap(to => typeof to === "string" ? to.toLowerCase() : to.email.toLowerCase())(tsplus_module_4.string);
92
+ const eq = tsplus_module_3.contramap(to => typeof to === "string" ? to.toLowerCase() : to.email.toLowerCase())(tsplus_module_3.string);
99
93
  // TODO: should just not add any already added email address
100
94
  // https://stackoverflow.com/a/53603076/11595834
101
95
  function renderFakeIfTest(addr, makeId) {
102
- return Array.isArray(addr) ? tsplus_module_6.iterableToArray(tsplus_module_5.uniqArray(eq)(addr.map(x => isTestAddress(x) ? renderFake(x, makeId) : x))) : isTestAddress(addr) ? renderFake(addr, makeId) : addr;
96
+ return Array.isArray(addr) ? tsplus_module_5.iterableToArray(tsplus_module_4.uniqArray(eq)(addr.map(x => isTestAddress(x) ? renderFake(x, makeId) : x))) : isTestAddress(addr) ? renderFake(addr, makeId) : addr;
103
97
  }
104
98
  function renderMailData(md) {
105
99
  if (Array.isArray(md)) {
@@ -1 +1 @@
1
- {"version":3,"file":"Sendgrid.cjs","mappings":";;;;;;;;;;;;;;;AACA;AACA;AACA;AAAsC;AAAA;AAAA;;AAGtC,MAAMA,gBAAgB,GAAG,CAAC;EAAEC,MAAM;EAAEC,WAAW;EAAEC,QAAQ;EAAEC;AAAa,CAAkB,KAAIC,4CAC5FC,qBAAO,MAAK;EACVC,aAAM,CAACC,SAAS,uBAACP,MAAM,EAAO;EAE9B,OAAO;IACLQ,QAAQ,CAACC,IAA0B;MACjC,qDAAOJ,oBAAW,WAAUK,CAAC;QAC3B,MAAMC,GAAG,GAAG;UAAE,GAAGF,IAAI;UAAEG,IAAI,EAAEH,IAAI,CAACG,IAAI,IAAIX;QAAW,CAAE;QACvD,MAAMY,MAAM,GAAGC,aAAa,CAAC,CAACZ,QAAQ,CAAC;QAEvC,MAAMa,YAAY,GAAGF,MAAM,CAACF,GAAG,CAAC;QAChC,MAAMK,WAAW,GAAG;UAAE,GAAGD,YAAY;UAAEE,OAAO,EAAE,GAAGd,aAAa,GAAGY,YAAY,CAACE,OAAO;QAAE,CAAE;QAC3F,OAAOP,CAAC,CAACN,0EAA6C,KAAK,EAAE,iBAAO,EAACY,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC,iDAAlFX,yBAAgB,eAAe,CAAC,EAAmD,CAAC;QAE7F,MAAMa,GAAG,GAAG,OAAOR,CAAC,+CAClBL,sBAKEc,EAAE,IACA,KAAKb,aAAM,CAACc,IAAI,CAACJ,WAAW,EAAE,KAAK,EAAE,CAACK,GAAG,EAAEC,MAAM,KAC/CD,GAAG,GACDF,EAAE,+CAACd,qBAAYgB,GAAG,CAAC,EAAC,GACpBF,EAAE,+CAACd,2BAAOiB,MAAM,CAAC,EAAC,CAAC,CAC1B,EACF;QAED;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,OAAOJ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AACQ,KAAK,CAACF,WAAW,EAAE,CAACC,QAAQ,CAAC,OAAO,CAAE;AAE/C;AAEA,SAASN,UAAU,CAACQ,IAA6B,EAAEV,MAAoB;EACrE,OAAO;IACLW,IAAI,EAAEC,cAAc,CAACF,IAAI,CAAC;IAC1BD,KAAK,EAAE,QAAQT,MAAM,EAAE;GACxB;AACH;AACA,MAAMa,EAAE,GAAGC,0BAA8Bb,EAA6C,IACpF,OAAOA,EAAE,KAAK,QAAQ,GAAGA,EAAE,CAACM,WAAW,EAAE,GAAGN,EAAE,CAACQ,KAAK,CAACF,WAAW,EAAE,yBACnE;AAED;AACA;AACA,SAASF,gBAAgB,CAACK,IAA6B,EAAEV,MAAoB;EAC3E,OAAOe,KAAK,CAACC,OAAO,CAACN,IAAI,CAAC,GACvBO,gCAACC,0BAEML,EAAE,EAFRH,IAAI,CACHS,GAAG,CAACC,CAAC,IAAKd,aAAa,CAACc,CAAC,CAAC,GAAGlB,UAAU,CAACkB,CAAC,EAAEpB,MAAM,CAAC,GAAGoB,CAAE,CAAC,CAChD,IAETd,aAAa,CAACI,IAAI,CAAC,GACnBR,UAAU,CAACQ,IAAI,EAAEV,MAAM,CAAC,GACxBU,IAAI;AACV;AAEA,SAASE,cAAc,CAACS,EAA+B;EACrD,IAAIN,KAAK,CAACC,OAAO,CAACK,EAAE,CAAC,EAAE;IACrB,OAAOA,EAAE,CAACF,GAAG,CAACP,cAAc,CAAC,CAACU,IAAI,CAAC,IAAI,CAAC;;EAE1C,IAAI,OAAOD,EAAE,KAAK,QAAQ,EAAE;IAC1B,OAAOA,EAAE;;EAEX,OAAOA,EAAE,CAACZ,KAAK;AACjB","names":["makeLiveSendgrid","apiKey","defaultFrom","realMail","subjectPrefix","tracer_1","tsplus_module_2","sgMail","setApiKey","sendMail","msg_","$","msg","from","render","renderMessage","renderedMsg_","renderedMsg","subject","ret","cb","send","err","result","LiveSendgrid","config","tsplus_module_3","Emailer","forceFake","i","makeId","to","renderFake","cc","bcc","renderFakeIfTest","isTestAddress","toLowerCase","endsWith","email","addr","name","renderMailData","eq","tsplus_module_4","Array","isArray","tsplus_module_6","tsplus_module_5","map","x","md","join"],"sourceRoot":"","sources":["../../../_src/services/Emailer/Sendgrid.ts"],"sourcesContent":[null]}
1
+ {"version":3,"file":"Sendgrid.cjs","mappings":";;;;;;;;;;;;;AACA;AACA;AACA;AAAsC;AAAA;AAAA;AAGtC,MAAMA,gBAAgB,GAAG,CAAC;EAAEC,MAAM;EAAEC,WAAW;EAAEC,QAAQ;EAAEC;AAAa,CAAkB,KACxFC,qBAAO,MAAK;EACVC,aAAM,CAACC,SAAS,uBAACN,MAAM,EAAO;EAE9B,OAAO;IACLO,QAAQ,CAACC,IAA0B;MACjC,OAAOJ,oBAAW,WAAUK,CAAC;QAC3B,MAAMC,GAAG,GAAG;UAAE,GAAGF,IAAI;UAAEG,IAAI,EAAEH,IAAI,CAACG,IAAI,IAAIV;QAAW,CAAE;QACvD,MAAMW,MAAM,GAAGC,aAAa,CAAC,CAACX,QAAQ,CAAC;QAEvC,MAAMY,YAAY,GAAGF,MAAM,CAACF,GAAG,CAAC;QAChC,MAAMK,WAAW,GAAG;UAAE,GAAGD,YAAY;UAAEE,OAAO,EAAE,GAAGb,aAAa,GAAGW,YAAY,CAACE,OAAO;QAAE,CAAE;QAC3F,OAAOP,CAAC,CAACL,qDAAgB,eAAe,CAAC,EAAa,KAAK,EAAE,iBAAO,EAACW,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;QAE7F,MAAME,GAAG,GAAG,OAAOR,CAAC,CAClBL,sBAKEc,EAAE,IACA,KAAKb,aAAM,CAACc,IAAI,CAACJ,WAAW,EAAE,KAAK,EAAE,CAACK,GAAG,EAAEC,MAAM,KAC/CD,GAAG,GACDF,EAAE,CAACd,qBAAYgB,GAAG,CAAC,CAAC,GACpBF,EAAE,CAACd,2BAAOiB,MAAM,CAAC,CAAC,CAAC,CAC1B,CACF;QAED;QACA;QACA;QACA;QACA;Q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AE,CAACQ,KAAK,CAACF,WAAW,EAAE,CAACC,QAAQ,CAAC,OAAO,CAAE;AAE/C;AAEA,SAASN,UAAU,CAACQ,IAA6B,EAAEV,MAAoB;EACrE,OAAO;IACLW,IAAI,EAAEC,cAAc,CAACF,IAAI,CAAC;IAC1BD,KAAK,EAAE,QAAQT,MAAM,EAAE;GACxB;AACH;AACA,MAAMa,EAAE,GAAGC,0BAA8Bb,EAA6C,IACpF,OAAOA,EAAE,KAAK,QAAQ,GAAGA,EAAE,CAACM,WAAW,EAAE,GAAGN,EAAE,CAACQ,KAAK,CAACF,WAAW,EAAE,yBACnE;AAED;AACA;AACA,SAASF,gBAAgB,CAACK,IAA6B,EAAEV,MAAoB;EAC3E,OAAOe,KAAK,CAACC,OAAO,CAACN,IAAI,CAAC,GACvBO,gCAACC,0BAEML,EAAE,EAFRH,IAAI,CACHS,GAAG,CAACC,CAAC,IAAKd,aAAa,CAACc,CAAC,CAAC,GAAGlB,UAAU,CAACkB,CAAC,EAAEpB,MAAM,CAAC,GAAGoB,CAAE,CAAC,CAChD,IAETd,aAAa,CAACI,IAAI,CAAC,GACnBR,UAAU,CAACQ,IAAI,EAAEV,MAAM,CAAC,GACxBU,IAAI;AACV;AAEA,SAASE,cAAc,CAACS,EAA+B;EACrD,IAAIN,KAAK,CAACC,OAAO,CAACK,EAAE,CAAC,EAAE;IACrB,OAAOA,EAAE,CAACF,GAAG,CAACP,cAAc,CAAC,CAACU,IAAI,CAAC,IAAI,CAAC;;EAE1C,IAAI,OAAOD,EAAE,KAAK,QAAQ,EAAE;IAC1B,OAAOA,EAAE;;EAEX,OAAOA,EAAE,CAACZ,KAAK;AACjB","names":["makeLiveSendgrid","apiKey","defaultFrom","realMail","subjectPrefix","tsplus_module_2","sgMail","setApiKey","sendMail","msg_","$","msg","from","render","renderMessage","renderedMsg_","renderedMsg","subject","ret","cb","send","err","result","LiveSendgrid","config","Emailer","forceFake","i","makeId","to","renderFake","cc","bcc","renderFakeIfTest","isTestAddress","toLowerCase","endsWith","email","addr","name","renderMailData","eq","tsplus_module_3","Array","isArray","tsplus_module_5","tsplus_module_4","map","x","md","join"],"sourceRoot":"","sources":["../../../_src/services/Emailer/Sendgrid.ts"],"sourcesContent":[null]}
@@ -4,22 +4,19 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.FakeSendgrid = void 0;
7
- var tracer_1 = _interopRequireWildcard(require("@effect/io/Debug"));
8
7
  var tsplus_module_1 = _interopRequireWildcard(require("@effect/io/Effect"));
9
- var tsplus_module_2 = _interopRequireWildcard(require("@effect-app/core/Effect"));
10
8
  var _utils = require("@effect-app/prelude/utils");
11
9
  var _service = require("./service.cjs");
12
10
  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); }
13
11
  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; }
14
- const fileName_1 = "packages/infra/_src/services/Emailer/fake.ts";
15
- const makeFake = tracer_1.withCallTrace(fileName_1 + ":5:4")(tsplus_module_1.map(() => ({
12
+ const makeFake = tsplus_module_1.map(tsplus_module_1.logDebug("FAKE Emailer Service enabled"), () => ({
16
13
  sendMail(msg) {
17
- return tracer_1.withCallTrace(fileName_1 + ":7:48")(tsplus_module_1.logAnnotate("msg", (0, _utils.pretty)(msg)))(tracer_1.withCallTrace(fileName_1 + ":7:21")(tsplus_module_1.logDebug(`Fake send mail`)));
14
+ return tsplus_module_1.logAnnotate(tsplus_module_1.logDebug(`Fake send mail`), "msg", (0, _utils.pretty)(msg));
18
15
  }
19
- })))(tracer_1.withCallTrace(fileName_1 + ":4:25")(tsplus_module_1.logDebug("FAKE Emailer Service enabled")));
16
+ }));
20
17
  /**
21
18
  * @tsplus static Emailer.Ops Fake
22
19
  */
23
- const FakeSendgrid = tsplus_module_2.toLayer(makeFake, _service.Emailer);
20
+ const FakeSendgrid = tsplus_module_1.toLayer(makeFake, _service.Emailer);
24
21
  exports.FakeSendgrid = FakeSendgrid;
25
22
  //# sourceMappingURL=fake.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"fake.cjs","mappings":";;;;;;;;;AAAA;AACA;AAAsC;AAAA;;AAEtC,MAAMA,QAAQ,GAAGC,gEACV,OAAgB;EACnBC,QAAQ,CAACC,GAAG;IACV,OAAOF,yEAA8C,KAAK,EAAE,iBAAM,EAACE,GAAG,CAAC,gDAAhEC,yBAAgB,gBAAgB,CAAC,EAAgC;EAC1E;CACD,CAAC,gDALaA,yBAAgB,8BAA8B,CAAC,EAK3D;AAEL;;;AAGO,MAAMC,YAAY,GAAGC,gCAAQ,EAASC,gBAAO,CAAC;AAAA","names":["makeFake","tracer_1","sendMail","msg","tsplus_module_1","FakeSendgrid","tsplus_module_2","Emailer"],"sourceRoot":"","sources":["../../../_src/services/Emailer/fake.ts"],"sourcesContent":[null]}
1
+ {"version":3,"file":"fake.cjs","mappings":";;;;;;;AAAA;AACA;AAAsC;AAAA;AAEtC,MAAMA,QAAQ,GAAGC,6CAAgB,8BAA8B,CAAC,EACzD,OAAgB;EACnBC,QAAQ,CAACC,GAAG;IACV,OAAOF,qDAAgB,gBAAgB,CAAC,EAAa,KAAK,EAAE,iBAAM,EAACE,GAAG,CAAC,CAAC;EAC1E;CACD,CAAC,CAAC;AAEL;;;AAGO,MAAMC,YAAY,GAAGH,gCAAQ,EAASI,gBAAO,CAAC;AAAA","names":["makeFake","tsplus_module_1","sendMail","msg","FakeSendgrid","Emailer"],"sourceRoot":"","sources":["../../../_src/services/Emailer/fake.ts"],"sourcesContent":[null]}
@@ -4,32 +4,29 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.Live = void 0;
7
- var tracer_1 = _interopRequireWildcard(require("@effect/io/Debug"));
8
7
  var tsplus_module_1 = _interopRequireWildcard(require("@effect/io/Effect"));
9
8
  var tsplus_module_2 = _interopRequireWildcard(require("@effect-app/prelude/_ext/date"));
10
- var tsplus_module_3 = _interopRequireWildcard(require("@fp-ts/data/Option"));
9
+ var tsplus_module_3 = _interopRequireWildcard(require("@fp-ts/core/Option"));
11
10
  var tsplus_module_4 = _interopRequireWildcard(require("@effect-app/core/Array"));
12
11
  var tsplus_module_5 = _interopRequireWildcard(require("@effect/io/Exit"));
13
12
  var tsplus_module_6 = _interopRequireWildcard(require("@effect/io/Cause"));
14
13
  var tsplus_module_7 = _interopRequireWildcard(require("@effect-app/prelude/schema"));
15
14
  var tsplus_module_8 = _interopRequireWildcard(require("@effect-app/core/Option"));
16
15
  var tsplus_module_9 = _interopRequireWildcard(require("@effect-app/prelude/_ext/Prelude.ext"));
17
- var tsplus_module_10 = _interopRequireWildcard(require("@effect-app/prelude/service"));
18
- var tsplus_module_11 = _interopRequireWildcard(require("@fp-ts/data/Duration"));
19
- var tsplus_module_12 = _interopRequireWildcard(require("@effect-app/core/Effect"));
20
- var tsplus_module_13 = _interopRequireWildcard(require("@effect/io/Layer"));
16
+ var tsplus_module_10 = _interopRequireWildcard(require("@effect-app/core/Effect"));
17
+ var tsplus_module_11 = _interopRequireWildcard(require("@effect-app/prelude/service"));
18
+ var tsplus_module_12 = _interopRequireWildcard(require("@fp-ts/data/Duration"));
21
19
  var _reportError = require("@effect-app/infra/api/reportError");
22
20
  var _errorReporter = require("@effect-app/infra/errorReporter");
23
21
  var _Operations = require("@effect-app/prelude/Operations");
24
22
  var _service2 = require("./service.cjs");
25
23
  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); }
26
24
  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; }
27
- const fileName_1 = "packages/infra/_src/services/Operations/live.ts";
28
25
  const reportAppError = (0, _errorReporter.reportError)(cause => new _reportError.RequestException(cause));
29
- const make = tracer_1.withCallTrace(fileName_1 + ":9:14")(tsplus_module_1.sync(() => {
26
+ const make = tsplus_module_1.sync(() => {
30
27
  const ops = new Map();
31
- const makeOp = tracer_1.withCallTrace(fileName_1 + ":11:18")(tsplus_module_1.sync(() => _Operations.OperationId.make()));
32
- const cleanup = tracer_1.withCallTrace(fileName_1 + ":13:19")(tsplus_module_1.sync(() => {
28
+ const makeOp = tsplus_module_1.sync(() => _Operations.OperationId.make());
29
+ const cleanup = tsplus_module_1.sync(() => {
33
30
  const before = tsplus_module_2.DateSubHours(new Date(), 1);
34
31
  tsplus_module_4.ext_itToChunk(ops.entries()).forEach(([id, op]) => {
35
32
  const lastChanged = tsplus_module_3.getOrElse(() => op.createdAt)(tsplus_module_3.fromNullable(op.updatedAt));
@@ -37,19 +34,19 @@ const make = tracer_1.withCallTrace(fileName_1 + ":9:14")(tsplus_module_1.sync((
37
34
  ops.delete(id);
38
35
  }
39
36
  });
40
- }));
37
+ });
41
38
  function addOp(id) {
42
- return tracer_1.withCallTrace(fileName_1 + ":26:12")(tsplus_module_1.sync(() => {
39
+ return tsplus_module_1.sync(() => {
43
40
  ops.set(id, new _Operations.Operation({
44
41
  id
45
42
  }));
46
- }));
43
+ });
47
44
  }
48
45
  function findOp(id) {
49
- return tracer_1.withCallTrace(fileName_1 + ":31:12")(tsplus_module_1.sync(() => tsplus_module_3.fromNullable(ops.get(id))));
46
+ return tsplus_module_1.sync(() => tsplus_module_3.fromNullable(ops.get(id)));
50
47
  }
51
48
  function finishOp(id, exit) {
52
- return tracer_1.withCallTrace(fileName_1 + ":34:23")(tsplus_module_1.flatMap(_ => tracer_1.withCallTrace(fileName_1 + ":35:7")(tsplus_module_1.sync(() => {
49
+ return tsplus_module_1.flatMap(findOp(id), _ => tsplus_module_1.sync(() => {
53
50
  if (tsplus_module_3.isNone(_)) {
54
51
  throw new Error("Not found");
55
52
  }
@@ -57,13 +54,13 @@ const make = tracer_1.withCallTrace(fileName_1 + ":9:14")(tsplus_module_1.sync((
57
54
  ..._.value,
58
55
  updatedAt: new Date(),
59
56
  result: tsplus_module_5.isSuccess(exit) ? new _Operations.Success({}) : new _Operations.Failure({
60
- message: tsplus_module_6.isInterrupted(exit.cause) ? tsplus_module_7.LongString("Interrupted") : tsplus_module_6.isDie(exit.cause) ? tsplus_module_7.LongString("Unknown error") : tsplus_module_8.getOrUndefined(tsplus_module_3.flatMap(_ => typeof _ === "object" && _ !== null && "message" in _ && tsplus_module_7.LongString.Guard(_.message) ? tsplus_module_3.some(_.message) : tsplus_module_3.none)(tsplus_module_6.failureOption(exit.cause))) ?? null
57
+ message: tsplus_module_6.isInterrupted(exit.cause) ? tsplus_module_7.LongString("Interrupted") : tsplus_module_6.isDie(exit.cause) ? tsplus_module_7.LongString("Unknown error") : tsplus_module_8.getOrUndefined(tsplus_module_3.flatMap(_ => typeof _ === "object" && _ !== null && "message" in _ && tsplus_module_7.LongString.Guard(_.message) ? tsplus_module_3.some(_.message) : tsplus_module_8.none)(tsplus_module_6.failureOption(exit.cause))) ?? null
61
58
  })
62
59
  });
63
- }))))(findOp(id));
60
+ }));
64
61
  }
65
62
  function update(id, progress) {
66
- return tracer_1.withCallTrace(fileName_1 + ":60:23")(tsplus_module_1.flatMap(_ => tracer_1.withCallTrace(fileName_1 + ":61:7")(tsplus_module_1.sync(() => {
63
+ return tsplus_module_1.flatMap(findOp(id), _ => tsplus_module_1.sync(() => {
67
64
  if (tsplus_module_3.isNone(_)) {
68
65
  throw new Error("Not found");
69
66
  }
@@ -72,25 +69,25 @@ const make = tracer_1.withCallTrace(fileName_1 + ":9:14")(tsplus_module_1.sync((
72
69
  updatedAt: new Date(),
73
70
  progress
74
71
  });
75
- }))))(findOp(id));
72
+ }));
76
73
  }
77
- return tsplus_module_10.make(_service2.Operations, {
74
+ return tsplus_module_11.make(_service2.Operations, {
78
75
  cleanup,
79
- register: tracer_1.withCallTrace(fileName_1 + ":72:8")(tsplus_module_1.tap(id => tsplus_module_1.zipRight(tracer_1.withCallTrace(fileName_1 + ":74:23")(tsplus_module_1.acquireRelease(addOp(id), (_, exit) => finishOp(id, exit))))(tsplus_module_9.logAnnotateScoped("operationId", id))))(makeOp),
76
+ register: tsplus_module_1.tap(makeOp, id => tsplus_module_10.EffectZipRight(tsplus_module_1.acquireRelease(addOp(id), (_, exit) => finishOp(id, exit)))(tsplus_module_9.logAnnotateScoped("operationId", id))),
80
77
  find: findOp,
81
78
  update
82
79
  });
83
- }));
84
- const cleanupLoop = tsplus_module_1.forkScoped(tsplus_module_1.forever(tracer_1.withCallTrace(fileName_1 + ":93:4")(tsplus_module_1.delay(tsplus_module_11.minutes(1)))(tracer_1.withCallTrace(fileName_1 + ":86:4")(tsplus_module_1.flatMap(_ => {
80
+ });
81
+ const cleanupLoop = tsplus_module_1.forkScoped(tsplus_module_1.forever(tsplus_module_1.delay(tsplus_module_1.flatMap(tsplus_module_1.exit(tsplus_module_1.serviceWithEffect(_service2.Operations, _ => _.cleanup)), _ => {
85
82
  if (tsplus_module_5.isSuccess(_)) {
86
- return tsplus_module_12.unit;
83
+ return tsplus_module_10.unit;
87
84
  } else {
88
85
  return reportAppError(_.cause);
89
86
  }
90
- }))(tsplus_module_1.exit(tracer_1.withCallTrace(fileName_1 + ":84:32")(tsplus_module_1.serviceWithEffect(_service2.Operations, _ => _.cleanup)))))));
87
+ }), tsplus_module_12.minutes(1))));
91
88
  /**
92
89
  * @tsplus static Operations.Ops Live
93
90
  */
94
- const Live = tsplus_module_13.provideMerge(tsplus_module_12.toScopedDiscardLayer(cleanupLoop))(tsplus_module_12.toLayer(make, _service2.Operations));
91
+ const Live = tsplus_module_10.LayerProvideMerge(tsplus_module_10.toScopedDiscardLayer(cleanupLoop))(tsplus_module_1.toLayer(make, _service2.Operations));
95
92
  exports.Live = Live;
96
93
  //# sourceMappingURL=live.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"live.cjs","mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAEA;AACA;AAAyC;AAAA;;AAEzC,MAAMA,cAAc,GAAG,8BAAW,EAACC,KAAK,IAAI,IAAIC,6BAAgB,CAACD,KAAK,CAAC,CAAC;AAExE,MAAME,IAAI,gDAAGC,qBAAO,MAAK;EACvB,MAAMC,GAAG,GAAG,IAAIC,GAAG,EAA0B;EAC7C,MAAMC,MAAM,iDAAGH,qBAAO,MAAMI,uBAAW,CAACL,IAAI,EAAE,CAAC;EAE/C,MAAMM,OAAO,iDAAGL,qBAAO,MAAK;IAC1B,MAAMM,MAAM,GAAGC,iCAAIC,IAAI,EAAE,EAAU,CAAC,CAAC;IACrCC,iCAAG,CAACC,OAAO,EAAE,EAEVC,OAAO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Q3D,CACoB,EAEX;AAEb;;;AAGO,MAAM0C,IAAI,uEACbF,WAAW,GADKG,6BAAI,EAASC,oBAAU,CAAC,CAEnB;AAAA","names":["reportAppError","cause","RequestException","make","tsplus_module_1","ops","Map","makeOp","OperationId","cleanup","before","tsplus_module_2","Date","tsplus_module_4","entries","forEach","id","op","lastChanged","tsplus_module_3","createdAt","updatedAt","delete","addOp","set","Operation","findOp","get","finishOp","exit","tracer_1","_","Error","value","result","tsplus_module_5","Success","Failure","message","tsplus_module_6","tsplus_module_7","tsplus_module_8","Guard","update","progress","tsplus_module_10","register","tsplus_module_9","find","cleanupLoop","tsplus_module_11","Live","tsplus_module_12","Operations"],"sourceRoot":"","sources":["../../../_src/services/Operations/live.ts"],"sourcesContent":[null]}
1
+ {"version":3,"file":"live.cjs","mappings":";;;;;;;;;;;;;;;;;;AAAA;AACA;AAEA;AACA;AAAyC;AAAA;AAEzC,MAAMA,cAAc,GAAG,8BAAW,EAACC,KAAK,IAAI,IAAIC,6BAAgB,CAACD,KAAK,CAAC,CAAC;AAExE,MAAME,IAAI,GAAGC,qBAAO,MAAK;EACvB,MAAMC,GAAG,GAAG,IAAIC,GAAG,EAA0B;EAC7C,MAAMC,MAAM,GAAGH,qBAAO,MAAMI,uBAAW,CAACL,IAAI,EAAE,CAAC;EAE/C,MAAMM,OAAO,GAAGL,qBAAO,MAAK;IAC1B,MAAMM,MAAM,GAAGC,iCAAIC,IAAI,EAAE,EAAU,CAAC,CAAC;IACrCC,iCAAG,CAACC,OAAO,EAAE,EAEVC,OAAO,CAAC,CAAC,CAACC,EAAE,EAAEC,EAAE,CAAC,KAAI;MACpB,MAAMC,WAAW,GAAGC,0BAAyC,MAAMF,EAAE,CAACG,SAAS,EAA3DD,6BAAiBF,EAAE,CAACI,SAAS,CAAC,CAA8B;MAChF,IAAIH,WAAW,GAAGR,MAAM,EAAE;QACxBL,GAAG,CAACiB,MAAM,CAACN,EAAE,CAAC;;IAElB,CAAC,CAAC;EACN,CAAC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C,8BAAM,CAACY,EAAE,CAAC,EAASc,CAAC,IACzB1B,qBAAO,MAAK;MACV,IAAIe,wBAAC,CAAS,EAAE;QACd,MAAM,IAAIY,KAAK,CAAC,WAAW,CAAC;;MAE9B1B,GAAG,CAACmB,GAAG,CAACR,EAAE,EAAE;QAAE,GAAGc,CAAC,CAACE,KAAK;QAAEX,SAAS,EAAE,IAAIT,IAAI,EAAE;QAAE+B;MAAQ,CAAE,CAAC;IAC9D,CAAC,CAAC,CACH;EACH;EACA,OAAOC,0CAAU,EAAM;IACrBnC,OAAO;IACPoC,QAAQ,EAAEzC,0BAAM,EACTY,EAAE,IAAG8B,gCAEJ1C,oCAAK,CAACY,EAAE,CAAC,EACT,CAACc,CAAC,EAAED,IAAI,KAAKD,QAAQ,CAACZ,EAAE,EAAEa,IAAI,CAAC,CAChC,EAHHkB,kCAAyB,aAAa,EAAE/B,EAAE,CAAC,CAGxC,CACJ;IAEHgC,IAAI,EAAEtB,MAAM;IACZgB;GACD,CAAC;AACJ,CAAC,CAAC;AAEF,MAAMO,WAAW,sDAAG7C,yHAAU,EAAkB0B,CAAC,IAAIA,CAAC,CAACrB,OAAO,CAAC,GAEpDqB,CAAC,IAAG;EACX,IAAII,2BAAC,CAAY,EAAE;IACjB;GACD,MAAM;IACL,OAAOlC,cAAc,CAAC8B,CAAC,CAAC7B,KAAK,CAAC;;AAElC,CAAC,CAAC,EACKiD,yBAAY,CAAC,CAAC,CAAC,EAEX;AAEb;;;AAGO,MAAMC,IAAI,4EACbF,WAAW,GADK7C,4BAAI,EAASgD,oBAAU,CAAC,CAEnB;AAAA","names":["reportAppError","cause","RequestException","make","tsplus_module_1","ops","Map","makeOp","OperationId","cleanup","before","tsplus_module_2","Date","tsplus_module_4","entries","forEach","id","op","lastChanged","tsplus_module_3","createdAt","updatedAt","delete","addOp","set","Operation","findOp","get","finishOp","exit","_","Error","value","result","tsplus_module_5","Success","Failure","message","tsplus_module_6","tsplus_module_7","tsplus_module_8","Guard","update","progress","tsplus_module_11","register","tsplus_module_10","tsplus_module_9","find","cleanupLoop","tsplus_module_12","Live","Operations"],"sourceRoot":"","sources":["../../../_src/services/Operations/live.ts"],"sourcesContent":[null]}
@@ -7,14 +7,12 @@ exports.forkOperation = exports.OperationsId = exports.Operations = void 0;
7
7
  exports.forkOperation2 = forkOperation2;
8
8
  exports.forkOperationFunction = forkOperationFunction;
9
9
  exports.forkOperationWithEffect = forkOperationWithEffect;
10
- var tracer_1 = _interopRequireWildcard(require("@effect/io/Debug"));
11
10
  var tsplus_module_1 = _interopRequireWildcard(require("@fp-ts/data/Context"));
12
11
  var tsplus_module_2 = _interopRequireWildcard(require("@effect/io/Scope"));
13
12
  var tsplus_module_3 = _interopRequireWildcard(require("@effect-app/infra/api/reportError"));
14
13
  var tsplus_module_4 = _interopRequireWildcard(require("@effect/io/Effect"));
15
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); }
16
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; }
17
- const fileName_1 = "packages/infra/_src/services/Operations/service.ts";
18
16
  const forkOperation = forkOperation_1;
19
17
  exports.forkOperation = forkOperation;
20
18
  const OperationsId = Symbol("OperationsId");
@@ -25,7 +23,7 @@ const Operations = tsplus_module_1.Tag();
25
23
  */
26
24
  exports.Operations = Operations;
27
25
  function forkOperation_1(self) {
28
- return tracer_1.withCallTrace(fileName_1 + ":22:21")(tsplus_module_4.serviceWithEffect(Operations, Operations => tracer_1.withCallTrace(fileName_1 + ":25:10")(tsplus_module_4.flatMap(scope => tracer_1.withCallTrace(fileName_1 + ":27:14")(tsplus_module_4.tap(() => tsplus_module_3.forkDaemonReportRequestUnexpected(tracer_1.withCallTrace(fileName_1 + ":27:29")(tsplus_module_2.use(scope))(self))))(tracer_1.withCallTrace(fileName_1 + ":26:31")(tsplus_module_2.extend(scope))(Operations.register))))(tracer_1.withCallTrace(fileName_1 + ":24:13")(tsplus_module_2.make()))));
26
+ return tsplus_module_4.serviceWithEffect(Operations, Operations => tsplus_module_4.flatMap(tsplus_module_2.make(), scope => tsplus_module_4.tap(tsplus_module_2.extend(Operations.register, scope), () => tsplus_module_3.forkDaemonReportRequestUnexpected(tsplus_module_2.use(self, scope)))));
29
27
  }
30
28
  /**
31
29
  * @tsplus getter function forkOperation
@@ -37,12 +35,12 @@ function forkOperationFunction(fnc) {
37
35
  * @tsplus static effect/io/Effect.Ops forkOperation
38
36
  */
39
37
  function forkOperation2(self) {
40
- return tracer_1.withCallTrace(fileName_1 + ":43:21")(tsplus_module_4.serviceWithEffect(Operations, Operations => tracer_1.withCallTrace(fileName_1 + ":46:10")(tsplus_module_4.flatMap(scope => tracer_1.withCallTrace(fileName_1 + ":48:14")(tsplus_module_4.tap(id => tsplus_module_3.forkDaemonReportRequestUnexpected(tracer_1.withCallTrace(fileName_1 + ":48:33")(tsplus_module_2.use(scope))(self(id)))))(tracer_1.withCallTrace(fileName_1 + ":47:31")(tsplus_module_2.extend(scope))(Operations.register))))(tracer_1.withCallTrace(fileName_1 + ":45:13")(tsplus_module_2.make()))));
38
+ return tsplus_module_4.serviceWithEffect(Operations, Operations => tsplus_module_4.flatMap(tsplus_module_2.make(), scope => tsplus_module_4.tap(tsplus_module_2.extend(Operations.register, scope), id => tsplus_module_3.forkDaemonReportRequestUnexpected(tsplus_module_2.use(self(id), scope)))));
41
39
  }
42
40
  /**
43
41
  * @tsplus static effect/io/Effect.Ops forkOperationWithEffect
44
42
  */
45
43
  function forkOperationWithEffect(self, fnc) {
46
- return tracer_1.withCallTrace(fileName_1 + ":60:21")(tsplus_module_4.serviceWithEffect(Operations, Operations => tracer_1.withCallTrace(fileName_1 + ":63:10")(tsplus_module_4.flatMap(scope => tracer_1.withCallTrace(fileName_1 + ":66:14")(tsplus_module_4.tap(opId => tracer_1.withCallTrace(fileName_1 + ":66:61")(tsplus_module_2.extend(scope))(tsplus_module_4.forkScoped(tsplus_module_4.interruptible(fnc(opId))))))(tracer_1.withCallTrace(fileName_1 + ":65:14")(tsplus_module_4.tap(opId => tsplus_module_3.forkDaemonReportRequestUnexpected(tracer_1.withCallTrace(fileName_1 + ":65:37")(tsplus_module_2.use(scope))(self(opId)))))(tracer_1.withCallTrace(fileName_1 + ":64:31")(tsplus_module_2.extend(scope))(Operations.register)))))(tracer_1.withCallTrace(fileName_1 + ":62:13")(tsplus_module_2.make()))));
44
+ return tsplus_module_4.serviceWithEffect(Operations, Operations => tsplus_module_4.flatMap(tsplus_module_2.make(), scope => tsplus_module_4.tap(tsplus_module_4.tap(tsplus_module_2.extend(Operations.register, scope), opId => tsplus_module_3.forkDaemonReportRequestUnexpected(tsplus_module_2.use(self(opId), scope))), opId => tsplus_module_2.extend(tsplus_module_4.forkScoped(tsplus_module_4.interruptible(fnc(opId))), scope))));
47
45
  }
48
46
  //# sourceMappingURL=service.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"service.cjs","mappings":";;;;;;;;;;;;;;;;;MAoBgBA,aAAa;AAAA;AAlBtB,MAAMC,YAAY,GAAGC,MAAM,CAAC,cAAc,CAAC;AAAA;AAa3C,MAAMC,UAAU,GAAkBC,mBAAG,EAAc;AAE1D;;;AAAA;AAGA,yBAAuCC,IAAqB;EAC1D,qDAAOC,4CAAU,EACfH,UAAU,IACRI,sEACWC,KAAK,IACZD,kEACO,MAAKE,kDAACF,kEAASC,KAAK,GAAdH,IAAI,CAAW,CAAkC,GAD9DE,qEAA2BC,KAAK,GAAhCL,UAAU,CAACO,QAAQ,CAAc,CAC8B,iDAHnEC,sBAAY,EAIT,CACN;AACH;AAEA;;;AAGM,SAAUC,qBAAqB,CAAeC,GAAkC;EACpF,OAAQC,GAAQ,IAAIC,gBAACF,GAAG,CAACC,GAAG,CAAC,CAAc;AAC7C;AAEA;;;AAGM,SAAUE,cAAc,CAAUX,IAA4C;EAClF,qDAAOC,4CAAU,EACfH,UAAU,IACRI,sEACWC,KAAK,IACZD,kEACOU,EAAE,IAAGR,kDAACF,kEAAaC,KAAK,GAAlBH,IAAI,CAACY,EAAE,CAAC,CAAW,CAAkC,GADlEV,qEAA2BC,KAAK,GAAhCL,UAAU,CAACO,QAAQ,CAAc,CACkC,iDAHvEC,sBAAY,EAIT,CACN;AACH;AAEA;;;AAGM,SAAUO,uBAAuB,CACrCb,IAA0C,EAC1CQ,GAA4C;EAE5C,qDAAOP,4CAAU,EACfH,UAAU,IACRI,sEACWC,KAAK,IACZD,kEAEOY,IAAI,IAAIZ,qEAA0CC,KAAK,4DAA/CK,GAAG,CAACM,IAAI,CAAC,GAAuC,GAF/DZ,kEACOY,IAAI,IAAGV,kDAACF,kEAAeC,KAAK,GAApBH,IAAI,CAACc,IAAI,CAAC,CAAW,CAAkC,GADtEZ,qEAA2BC,KAAK,GAAhCL,UAAU,CAACO,QAAQ,CAAc,CACsC,CACP,iDAJpEC,sBAAY,EAKT,CACN;AACH","names":["forkOperation","OperationsId","Symbol","Operations","tsplus_module_1","self","tsplus_module_4","tracer_1","scope","tsplus_module_3","register","tsplus_module_2","forkOperationFunction","fnc","inp","forkOperation_1","forkOperation2","id","forkOperationWithEffect","opId"],"sourceRoot":"","sources":["../../../_src/services/Operations/service.ts"],"sourcesContent":[null]}
1
+ {"version":3,"file":"service.cjs","mappings":";;;;;;;;;;;;;;;MAoBgBA,aAAa;AAAA;AAlBtB,MAAMC,YAAY,GAAGC,MAAM,CAAC,cAAc,CAAC;AAAA;AAa3C,MAAMC,UAAU,GAAkBC,mBAAG,EAAc;AAE1D;;;AAAA;AAGA,yBAAuCC,IAAqB;EAC1D,OAAOC,4CAAU,EACfH,UAAU,IACRG,8CAAY,EACDC,KAAK,IACZD,qDAAU,CAACE,QAAQ,EAAQD,KAAK,CAAC,EAC1B,MAAKE,kDAACC,wBAAI,EAAKH,KAAK,CAAC,CAAkC,CAAC,CAChE,CACN;AACH;AAEA;;;AAGM,SAAUI,qBAAqB,CAAeC,GAAkC;EACpF,OAAQC,GAAQ,IAAIC,gBAACF,GAAG,CAACC,GAAG,CAAC,CAAc;AAC7C;AAEA;;;AAGM,SAAUE,cAAc,CAAUV,IAA4C;EAClF,OAAOC,4CAAU,EACfH,UAAU,IACRG,8CAAY,EACDC,KAAK,IACZD,qDAAU,CAACE,QAAQ,EAAQD,KAAK,CAAC,EAC1BS,EAAE,IAAGP,kDAACC,wBAAI,CAACM,EAAE,CAAC,EAAKT,KAAK,CAAC,CAAkC,CAAC,CACpE,CACN;AACH;AAEA;;;AAGM,SAAUU,uBAAuB,CACrCZ,IAA0C,EAC1CO,GAA4C;EAE5C,OAAON,4CAAU,EACfH,UAAU,IACRG,8CAAY,EACDC,KAAK,IACZD,yEAAU,CAACE,QAAQ,EAAQD,KAAK,CAAC,EAC1BW,IAAI,IAAGT,kDAACC,wBAAI,CAACQ,IAAI,CAAC,EAAKX,KAAK,CAAC,CAAkC,CAAC,EAChEW,IAAI,IAAIR,mFAAG,CAACQ,IAAI,CAAC,IAAiCX,KAAK,CAAC,CAAC,CACjE,CACN;AACH","names":["forkOperation","OperationsId","Symbol","Operations","tsplus_module_1","self","tsplus_module_4","scope","register","tsplus_module_3","tsplus_module_2","forkOperationFunction","fnc","inp","forkOperation_1","forkOperation2","id","forkOperationWithEffect","opId"],"sourceRoot":"","sources":["../../../_src/services/Operations/service.ts"],"sourcesContent":[null]}