@effect-app/infra 4.0.0-beta.20 → 4.0.0-beta.201
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 +1410 -0
- package/_check.sh +1 -1
- package/dist/CUPS.d.ts +15 -7
- package/dist/CUPS.d.ts.map +1 -1
- package/dist/CUPS.js +10 -12
- package/dist/Emailer/Sendgrid.d.ts +14 -14
- package/dist/Emailer/Sendgrid.d.ts.map +1 -1
- package/dist/Emailer/Sendgrid.js +16 -15
- package/dist/Emailer/fake.d.ts +1 -1
- package/dist/Emailer/service.d.ts +10 -4
- package/dist/Emailer/service.d.ts.map +1 -1
- package/dist/Emailer/service.js +3 -3
- package/dist/Emailer.d.ts +1 -1
- package/dist/MainFiberSet.d.ts +9 -9
- package/dist/MainFiberSet.d.ts.map +1 -1
- package/dist/MainFiberSet.js +3 -3
- package/dist/Model/Repository/Registry.d.ts +20 -0
- package/dist/Model/Repository/Registry.d.ts.map +1 -0
- package/dist/Model/Repository/Registry.js +17 -0
- package/dist/Model/Repository/ext.d.ts +33 -15
- package/dist/Model/Repository/ext.d.ts.map +1 -1
- package/dist/Model/Repository/ext.js +54 -2
- package/dist/Model/Repository/internal/internal.d.ts +6 -6
- package/dist/Model/Repository/internal/internal.d.ts.map +1 -1
- package/dist/Model/Repository/internal/internal.js +43 -32
- package/dist/Model/Repository/legacy.d.ts +1 -1
- package/dist/Model/Repository/makeRepo.d.ts +7 -6
- package/dist/Model/Repository/makeRepo.d.ts.map +1 -1
- package/dist/Model/Repository/makeRepo.js +5 -1
- package/dist/Model/Repository/service.d.ts +28 -23
- package/dist/Model/Repository/service.d.ts.map +1 -1
- package/dist/Model/Repository/validation.d.ts +142 -17
- package/dist/Model/Repository/validation.d.ts.map +1 -1
- package/dist/Model/Repository/validation.js +5 -5
- package/dist/Model/Repository.d.ts +2 -1
- package/dist/Model/Repository.d.ts.map +1 -1
- package/dist/Model/Repository.js +2 -1
- package/dist/Model/dsl.d.ts +4 -4
- package/dist/Model/dsl.d.ts.map +1 -1
- package/dist/Model/filter/filterApi.d.ts +5 -5
- package/dist/Model/filter/filterApi.d.ts.map +1 -1
- package/dist/Model/filter/types/errors.d.ts +1 -1
- package/dist/Model/filter/types/fields.d.ts +1 -1
- package/dist/Model/filter/types/path/common.d.ts +1 -1
- package/dist/Model/filter/types/path/eager.d.ts +1 -1
- package/dist/Model/filter/types/path/eager.d.ts.map +1 -1
- package/dist/Model/filter/types/path/eager.js +1 -1
- package/dist/Model/filter/types/path/index.d.ts +1 -1
- package/dist/Model/filter/types/utils.d.ts +1 -1
- package/dist/Model/filter/types/validator.d.ts +1 -1
- package/dist/Model/filter/types.d.ts +1 -1
- package/dist/Model/query/dsl.d.ts +16 -16
- package/dist/Model/query/dsl.d.ts.map +1 -1
- package/dist/Model/query/new-kid-interpreter.d.ts +6 -6
- package/dist/Model/query/new-kid-interpreter.d.ts.map +1 -1
- package/dist/Model/query/new-kid-interpreter.js +3 -3
- package/dist/Model/query.d.ts +1 -1
- package/dist/Model.d.ts +2 -1
- package/dist/Model.d.ts.map +1 -1
- package/dist/Model.js +2 -1
- package/dist/QueueMaker/SQLQueue.d.ts +5 -7
- package/dist/QueueMaker/SQLQueue.d.ts.map +1 -1
- package/dist/QueueMaker/SQLQueue.js +105 -114
- package/dist/QueueMaker/errors.d.ts +2 -2
- package/dist/QueueMaker/errors.d.ts.map +1 -1
- package/dist/QueueMaker/memQueue.d.ts +7 -4
- package/dist/QueueMaker/memQueue.d.ts.map +1 -1
- package/dist/QueueMaker/memQueue.js +51 -62
- package/dist/QueueMaker/sbqueue.d.ts +6 -3
- package/dist/QueueMaker/sbqueue.d.ts.map +1 -1
- package/dist/QueueMaker/sbqueue.js +37 -53
- package/dist/QueueMaker/service.d.ts +1 -1
- package/dist/RequestContext.d.ts +112 -26
- package/dist/RequestContext.d.ts.map +1 -1
- package/dist/RequestContext.js +7 -8
- package/dist/RequestFiberSet.d.ts +7 -7
- package/dist/RequestFiberSet.d.ts.map +1 -1
- package/dist/RequestFiberSet.js +5 -5
- package/dist/Store/ContextMapContainer.d.ts +19 -3
- package/dist/Store/ContextMapContainer.d.ts.map +1 -1
- package/dist/Store/ContextMapContainer.js +13 -3
- package/dist/Store/Cosmos/query.d.ts +1 -1
- package/dist/Store/Cosmos/query.d.ts.map +1 -1
- package/dist/Store/Cosmos/query.js +10 -12
- package/dist/Store/Cosmos.d.ts +1 -1
- package/dist/Store/Cosmos.d.ts.map +1 -1
- package/dist/Store/Cosmos.js +318 -240
- package/dist/Store/Disk.d.ts +2 -2
- package/dist/Store/Disk.d.ts.map +1 -1
- package/dist/Store/Disk.js +25 -22
- package/dist/Store/Memory.d.ts +4 -4
- package/dist/Store/Memory.d.ts.map +1 -1
- package/dist/Store/Memory.js +27 -22
- package/dist/Store/SQL/Pg.d.ts +4 -0
- package/dist/Store/SQL/Pg.d.ts.map +1 -0
- package/dist/Store/SQL/Pg.js +189 -0
- package/dist/Store/SQL/query.d.ts +38 -0
- package/dist/Store/SQL/query.d.ts.map +1 -0
- package/dist/Store/SQL/query.js +367 -0
- package/dist/Store/SQL.d.ts +20 -0
- package/dist/Store/SQL.d.ts.map +1 -0
- package/dist/Store/SQL.js +381 -0
- package/dist/Store/codeFilter.d.ts +1 -1
- package/dist/Store/codeFilter.d.ts.map +1 -1
- package/dist/Store/codeFilter.js +2 -1
- package/dist/Store/index.d.ts +5 -2
- package/dist/Store/index.d.ts.map +1 -1
- package/dist/Store/index.js +15 -3
- package/dist/Store/service.d.ts +18 -7
- package/dist/Store/service.d.ts.map +1 -1
- package/dist/Store/service.js +24 -6
- package/dist/Store/utils.d.ts +1 -1
- package/dist/Store/utils.d.ts.map +1 -1
- package/dist/Store/utils.js +3 -4
- package/dist/Store.d.ts +1 -1
- package/dist/adapters/SQL/Model.d.ts +28 -42
- package/dist/adapters/SQL/Model.d.ts.map +1 -1
- package/dist/adapters/SQL/Model.js +2 -2
- package/dist/adapters/SQL.d.ts +1 -1
- package/dist/adapters/ServiceBus.d.ts +11 -11
- package/dist/adapters/ServiceBus.d.ts.map +1 -1
- package/dist/adapters/ServiceBus.js +13 -15
- package/dist/adapters/cosmos-client.d.ts +3 -3
- package/dist/adapters/cosmos-client.d.ts.map +1 -1
- package/dist/adapters/cosmos-client.js +3 -3
- package/dist/adapters/index.d.ts +8 -2
- package/dist/adapters/index.d.ts.map +1 -1
- package/dist/adapters/index.js +8 -2
- package/dist/adapters/logger.d.ts +2 -2
- package/dist/adapters/logger.d.ts.map +1 -1
- package/dist/adapters/memQueue.d.ts +3 -3
- package/dist/adapters/memQueue.d.ts.map +1 -1
- package/dist/adapters/memQueue.js +3 -3
- package/dist/adapters/mongo-client.d.ts +3 -3
- package/dist/adapters/mongo-client.d.ts.map +1 -1
- package/dist/adapters/mongo-client.js +3 -3
- package/dist/adapters/redis-client.d.ts +3 -3
- package/dist/adapters/redis-client.d.ts.map +1 -1
- package/dist/adapters/redis-client.js +3 -3
- package/dist/api/ContextProvider.d.ts +8 -8
- package/dist/api/ContextProvider.d.ts.map +1 -1
- package/dist/api/ContextProvider.js +6 -6
- package/dist/api/codec.d.ts +1 -1
- package/dist/api/internal/RequestContextMiddleware.d.ts +2 -2
- package/dist/api/internal/RequestContextMiddleware.d.ts.map +1 -1
- package/dist/api/internal/RequestContextMiddleware.js +2 -2
- package/dist/api/internal/auth.d.ts +44 -6
- package/dist/api/internal/auth.d.ts.map +1 -1
- package/dist/api/internal/auth.js +160 -29
- package/dist/api/internal/events.d.ts +3 -3
- package/dist/api/internal/events.d.ts.map +1 -1
- package/dist/api/internal/events.js +9 -7
- package/dist/api/internal/health.d.ts +1 -1
- package/dist/api/layerUtils.d.ts +6 -6
- package/dist/api/layerUtils.d.ts.map +1 -1
- package/dist/api/layerUtils.js +5 -5
- package/dist/api/middlewares.d.ts +1 -1
- package/dist/api/reportError.d.ts +1 -1
- package/dist/api/routing/middleware/RouterMiddleware.d.ts +4 -4
- package/dist/api/routing/middleware/RouterMiddleware.d.ts.map +1 -1
- package/dist/api/routing/middleware/middleware.d.ts +39 -3
- package/dist/api/routing/middleware/middleware.d.ts.map +1 -1
- package/dist/api/routing/middleware/middleware.js +46 -14
- package/dist/api/routing/middleware.d.ts +1 -2
- package/dist/api/routing/middleware.d.ts.map +1 -1
- package/dist/api/routing/middleware.js +1 -2
- package/dist/api/routing/schema/jwt.d.ts +1 -1
- package/dist/api/routing/schema/jwt.d.ts.map +1 -1
- package/dist/api/routing/tsort.d.ts +1 -1
- package/dist/api/routing/tsort.d.ts.map +1 -1
- package/dist/api/routing/utils.d.ts +3 -3
- package/dist/api/routing/utils.d.ts.map +1 -1
- package/dist/api/routing.d.ts +25 -26
- package/dist/api/routing.d.ts.map +1 -1
- package/dist/api/routing.js +99 -35
- package/dist/api/setupRequest.d.ts +8 -5
- package/dist/api/setupRequest.d.ts.map +1 -1
- package/dist/api/setupRequest.js +12 -7
- package/dist/api/util.d.ts +1 -1
- package/dist/arbs.d.ts +1 -1
- package/dist/arbs.d.ts.map +1 -1
- package/dist/arbs.js +5 -3
- package/dist/errorReporter.d.ts +4 -4
- package/dist/errorReporter.d.ts.map +1 -1
- package/dist/errorReporter.js +20 -25
- package/dist/errors.d.ts +1 -1
- package/dist/fileUtil.d.ts +1 -1
- package/dist/fileUtil.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/logger/jsonLogger.d.ts +1 -1
- package/dist/logger/logFmtLogger.d.ts +1 -1
- package/dist/logger/shared.d.ts +1 -1
- package/dist/logger/shared.js +2 -2
- package/dist/logger.d.ts +1 -1
- package/dist/logger.d.ts.map +1 -1
- package/dist/rateLimit.d.ts +9 -3
- package/dist/rateLimit.d.ts.map +1 -1
- package/dist/rateLimit.js +5 -11
- package/dist/test.d.ts +2 -2
- package/dist/test.d.ts.map +1 -1
- package/dist/test.js +1 -1
- package/dist/vitest.d.ts +1 -1
- package/examples/query.ts +39 -35
- package/package.json +41 -37
- package/src/CUPS.ts +9 -11
- package/src/Emailer/Sendgrid.ts +17 -14
- package/src/Emailer/service.ts +9 -3
- package/src/MainFiberSet.ts +5 -6
- package/src/Model/Repository/Registry.ts +33 -0
- package/src/Model/Repository/ext.ts +96 -10
- package/src/Model/Repository/internal/internal.ts +97 -88
- package/src/Model/Repository/makeRepo.ts +12 -10
- package/src/Model/Repository/service.ts +31 -22
- package/src/Model/Repository/validation.ts +4 -4
- package/src/Model/Repository.ts +1 -0
- package/src/Model/dsl.ts +3 -3
- package/src/Model/filter/types/path/eager.ts +1 -2
- package/src/Model/query/dsl.ts +18 -18
- package/src/Model/query/new-kid-interpreter.ts +2 -2
- package/src/Model.ts +1 -0
- package/src/QueueMaker/SQLQueue.ts +121 -151
- package/src/QueueMaker/memQueue.ts +82 -103
- package/src/QueueMaker/sbqueue.ts +56 -86
- package/src/RequestContext.ts +8 -10
- package/src/RequestFiberSet.ts +4 -4
- package/src/Store/ContextMapContainer.ts +41 -2
- package/src/Store/Cosmos/query.ts +16 -20
- package/src/Store/Cosmos.ts +452 -342
- package/src/Store/Disk.ts +52 -49
- package/src/Store/Memory.ts +54 -48
- package/src/Store/SQL/Pg.ts +318 -0
- package/src/Store/SQL/query.ts +409 -0
- package/src/Store/SQL.ts +668 -0
- package/src/Store/codeFilter.ts +1 -0
- package/src/Store/index.ts +17 -2
- package/src/Store/service.ts +32 -8
- package/src/Store/utils.ts +23 -22
- package/src/adapters/SQL/Model.ts +10 -4
- package/src/adapters/ServiceBus.ts +112 -116
- package/src/adapters/cosmos-client.ts +2 -2
- package/src/adapters/index.ts +7 -0
- package/src/adapters/memQueue.ts +2 -2
- package/src/adapters/mongo-client.ts +2 -2
- package/src/adapters/redis-client.ts +2 -2
- package/src/api/ContextProvider.ts +12 -13
- package/src/api/internal/RequestContextMiddleware.ts +1 -1
- package/src/api/internal/auth.ts +246 -44
- package/src/api/internal/events.ts +12 -8
- package/src/api/layerUtils.ts +8 -8
- package/src/api/routing/middleware/RouterMiddleware.ts +4 -4
- package/src/api/routing/middleware/middleware.ts +53 -12
- package/src/api/routing/middleware.ts +0 -2
- package/src/api/routing.ts +173 -63
- package/src/api/setupRequest.ts +28 -8
- package/src/arbs.ts +4 -2
- package/src/errorReporter.ts +62 -74
- package/src/logger/shared.ts +1 -1
- package/src/rateLimit.ts +30 -22
- package/src/test.ts +1 -1
- package/test/auth.test.ts +101 -0
- package/test/contextProvider.test.ts +11 -11
- package/test/controller.test.ts +19 -17
- package/test/dist/auth.test.d.ts.map +1 -0
- package/test/dist/contextProvider.test.d.ts.map +1 -1
- package/test/dist/controller.test.d.ts.map +1 -1
- package/test/dist/date-query.test.d.ts.map +1 -0
- package/test/dist/fixtures.d.ts +26 -12
- package/test/dist/fixtures.d.ts.map +1 -1
- package/test/dist/fixtures.js +12 -10
- package/test/dist/query.test.d.ts.map +1 -1
- package/test/dist/rawQuery.test.d.ts.map +1 -1
- package/test/dist/repository-ext.test.d.ts.map +1 -0
- package/test/dist/requires.test.d.ts.map +1 -1
- package/test/dist/router-generator.test.d.ts.map +1 -0
- package/test/dist/routing-interruptibility.test.d.ts.map +1 -0
- package/test/dist/rpc-e2e-invalidation.test.d.ts.map +1 -0
- package/test/dist/rpc-multi-middleware.test.d.ts.map +1 -1
- package/test/dist/rpc-stream-fullstack.test.d.ts.map +1 -0
- package/test/dist/sql-store.test.d.ts.map +1 -0
- package/test/fixtures.ts +11 -9
- package/test/query.test.ts +216 -34
- package/test/rawQuery.test.ts +23 -19
- package/test/repository-ext.test.ts +60 -0
- package/test/requires.test.ts +6 -6
- package/test/router-generator.test.ts +183 -0
- package/test/routing-interruptibility.test.ts +63 -0
- package/test/rpc-e2e-invalidation.test.ts +249 -0
- package/test/rpc-multi-middleware.test.ts +78 -9
- package/test/rpc-stream-fullstack.test.ts +325 -0
- package/test/sql-store.test.ts +1064 -0
- package/test/validateSample.test.ts +15 -12
- package/tsconfig.examples.json +1 -1
- package/tsconfig.json +0 -1
- package/tsconfig.json.bak +2 -2
- package/tsconfig.src.json +35 -35
- package/tsconfig.test.json +2 -2
- package/dist/Operations.d.ts +0 -55
- package/dist/Operations.d.ts.map +0 -1
- package/dist/Operations.js +0 -102
- package/dist/OperationsRepo.d.ts +0 -41
- package/dist/OperationsRepo.d.ts.map +0 -1
- package/dist/OperationsRepo.js +0 -14
- package/eslint.config.mjs +0 -24
- package/src/Operations.ts +0 -235
- package/src/OperationsRepo.ts +0 -16
package/dist/rateLimit.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rateLimit.d.ts","sourceRoot":"","sources":["../src/rateLimit.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAS,KAAK,QAAQ,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"rateLimit.d.ts","sourceRoot":"","sources":["../src/rateLimit.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAS,KAAK,QAAQ,EAAE,MAAM,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAA;AAE7E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE/C;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ,UACpE,SAAS,KAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAa9F;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,WAAW,CAAC,EAAE,WAAW,GAAG,SAAS,CAAA;CAC/C;AAED,eAAO,MAAM,KAAK,EAAE;IAClB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EA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,CAAC,QAAQ,IAEZ,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC,MAAO,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,eACxC,CAAC,CAAC,EAAE,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,gBAC/B,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,yCActD"}
|
package/dist/rateLimit.js
CHANGED
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
// }
|
|
21
21
|
// }
|
|
22
22
|
import { Array, Effect } from "effect-app";
|
|
23
|
+
import { dual } from "effect-app/Function";
|
|
23
24
|
/**
|
|
24
25
|
* Executes the specified effect, acquiring the specified number of permits
|
|
25
26
|
* immediately before the effect begins execution and releasing them
|
|
@@ -33,16 +34,9 @@ export function SEM_withPermitsDuration(permits, duration) {
|
|
|
33
34
|
.pipe(Effect.ensuring(Effect.delay(self.release(permits), duration))))));
|
|
34
35
|
};
|
|
35
36
|
}
|
|
36
|
-
export
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
.pipe(Effect.flatMap((_) => forEachBatch(_, i))), { concurrency: "inherit" });
|
|
40
|
-
}
|
|
41
|
-
export function batch(n, forEachItem, forEachBatch) {
|
|
42
|
-
return (items) => Effect.forEach(Array.chunksOf(items, n), (_, i) => Effect
|
|
43
|
-
.forEach(_, (_, j) => forEachItem(_, j, i), { concurrency: "inherit" })
|
|
44
|
-
.pipe(Effect.flatMap((_) => forEachBatch(_, i))));
|
|
45
|
-
}
|
|
37
|
+
export const batch = dual((args) => typeof args[0] !== "number", (items, n, forEachItem, forEachBatch, options) => Effect.forEach(Array.chunksOf(items, n), (_, i) => Effect
|
|
38
|
+
.forEach(_, (_, j) => forEachItem(_, j, i), { concurrency: "inherit" })
|
|
39
|
+
.pipe(Effect.flatMap((_) => forEachBatch(_, i))), { concurrency: options?.concurrency }));
|
|
46
40
|
// export function rateLimit(
|
|
47
41
|
// n: number,
|
|
48
42
|
// d: DUR
|
|
@@ -66,4 +60,4 @@ export function naiveRateLimit(n, d) {
|
|
|
66
60
|
.forEach(batch, forEachItem, { concurrency: n })
|
|
67
61
|
.pipe(Effect.flatMap(forEachBatch))))));
|
|
68
62
|
}
|
|
69
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
63
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmF0ZUxpbWl0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL3JhdGVMaW1pdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxNQUFNO0FBQ04sOEVBQThFO0FBQzlFLHVFQUF1RTtBQUN2RSxtRkFBbUY7QUFDbkYsK0JBQStCO0FBQy9CLE1BQU07QUFDTiw2RUFBNkU7QUFDN0Usd0dBQXdHO0FBQ3hHLHVCQUF1QjtBQUN2QixvQ0FBb0M7QUFDcEMscUJBQXFCO0FBQ3JCLG1EQUFtRDtBQUNuRCxnQ0FBZ0M7QUFDaEMsMkJBQTJCO0FBQzNCLHlDQUF5QztBQUN6Qyw0QkFBNEI7QUFDNUIscUNBQXFDO0FBQ3JDLGtCQUFrQjtBQUNsQixVQUFVO0FBQ1YsTUFBTTtBQUNOLElBQUk7QUFFSixPQUFPLEVBQUUsS0FBSyxFQUFpQixNQUFNLEVBQXNCLE1BQU0sWUFBWSxDQUFBO0FBQzdFLE9BQU8sRUFBRSxJQUFJLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQTtBQUkxQzs7Ozs7R0FLRztBQUNILE1BQU0sVUFBVSx1QkFBdUIsQ0FBQyxPQUFlLEVBQUUsUUFBMkI7SUFDbEYsT0FBTyxDQUFDLElBQWUsRUFBdUUsRUFBRTtRQUM5RixPQUFPLENBQVUsTUFBOEIsRUFBRSxFQU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BTSxDQUFDLE9BQU8sQ0FBQyxZQUFZLENBQUMsQ0FBQyxDQUN0QyxDQUFDLENBQ1AsQ0FBQyxDQUFBO0FBQ04sQ0FBQyJ9
|
package/dist/test.d.ts
CHANGED
|
@@ -8,8 +8,8 @@ export declare const createRandomInstance: <A extends object, I, R>(s: S.Codec<A
|
|
|
8
8
|
/**
|
|
9
9
|
* Like `createRandomInstance`, but takes encoded values rather than decoded ones.
|
|
10
10
|
*/
|
|
11
|
-
export declare const createRandomInstanceI: <A extends object, I>(s: S.Codec<A, I
|
|
11
|
+
export declare const createRandomInstanceI: <A extends object, I>(s: S.Codec<A, I> & {
|
|
12
12
|
fields: S.Struct.Fields;
|
|
13
13
|
}) => (overrides?: Partial<I>) => A;
|
|
14
14
|
export * from "./arbs.js";
|
|
15
|
-
//# sourceMappingURL=
|
|
15
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL3Rlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLENBQUMsRUFBRSxNQUFNLFlBQVksQ0FBQTtBQUk5Qjs7R0FFRztBQUNILGVBQU8sTUFBTSxvQkFBb0IsR0FBSSxDQUFDLFNBQVMsTUFBTSxFQUFFLENBQUMsRUFBRSxDQUFDLEtBQUssQ0FBQyxDQUFDLEtBQUssQ0FBQyxDQUFDLEVBQUUsQ0FBQyxFQUFFLENBQUMsQ0FBQyxHQUFHO0lBQUUsTUFBTSxFQUFFLENBQUMsQ0FBQyxNQUFNLENBQUMsTUFBTSxDQUFBO0NBQUUsa0JBRXhGLE9BQU8sQ0FBQyxDQUFDLENBQUMsTUFJL0IsQ0FBQTtBQUVEOztHQUVHO0FBQ0gsZUFBTyxNQUFNLHFCQUFxQixHQUFJLENBQUMsU0FBUyxNQUFNLEVBQUUsQ0FBQyxLQUFLLENBQUMsQ0FBQyxLQUFLLENBQUMsQ0FBQyxFQUFFLENBQUMsQ0FBQyxHQUFHO0lBQUUsTUFBTSxFQUFFLENBQUMsQ0FBQyxNQUFNLENBQUMsTUFBTSxDQUFBO0NBQUUsa0JBSW5GLE9BQU8sQ0FBQyxDQUFDLENBQUMsTUFLL0IsQ0FBQTtBQUVELGNBQWMsV0FBVyxDQUFBIn0=
|
package/dist/test.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../src/test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,YAAY,CAAA;AAI9B;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAAI,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../src/test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,YAAY,CAAA;AAI9B;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAAI,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG;IAAE,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAA;CAAE,kBAExF,OAAO,CAAC,CAAC,CAAC,MAI/B,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,qBAAqB,GAAI,CAAC,SAAS,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;IAAE,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAA;CAAE,kBAInF,OAAO,CAAC,CAAC,CAAC,MAK/B,CAAA;AAED,cAAc,WAAW,CAAA"}
|
package/dist/test.js
CHANGED
|
@@ -26,4 +26,4 @@ export const createRandomInstanceI = (s) => {
|
|
|
26
26
|
};
|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BQUMsQ0FBQyxVQUFVLENBQUMsQ0FBQyxDQUFDLENBQUE7SUFDOUIsTUFBTSxNQUFNLEdBQUcsQ0FBQyxDQUFDLFVBQVUsQ0FBQyxDQUFDLENBQUMsQ0FBQTtJQUM5QixPQUFPLENBQUMsU0FBc0IsRUFBRSxFQUFFO1FBQ2hDLE1BQU0sQ0FBQyxHQUFHLEdBQUcsQ0FBQyxLQUFLLENBQUE7UUFDbkIsSUFBSSxDQUFDLFNBQVM7WUFBRSxPQUFPLENBQUMsQ0FBQTtRQUN4QixPQUFPLE1BQU0sQ0FBQyxFQUFFLEdBQUcsTUFBTSxDQUFDLENBQUMsQ0FBQyxFQUFFLEdBQUcsU0FBUyxFQUFFLENBQUMsQ0FBQTtJQUMvQyxDQUFDLENBQUE7QUFDSCxDQUFDLENBQUE7QUFFRCxjQUFjLFdBQVcsQ0FBQSJ9
|
package/dist/vitest.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export * from "@effect/vitest";
|
|
2
2
|
export * from "./test.js";
|
|
3
|
-
//# sourceMappingURL=
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidml0ZXN0LmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvdml0ZXN0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsZ0JBQWdCLENBQUE7QUFDOUIsY0FBYyxXQUFXLENBQUEifQ==
|
package/examples/query.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { expectTypeOf } from "@effect/vitest"
|
|
2
|
+
import { Effect, Layer, ManagedRuntime, S, Struct } from "effect-app"
|
|
2
3
|
import { makeRepo } from "../src/Model.js"
|
|
3
|
-
import { and, make, one, or, order, page, project, QueryWhere, where } from "../src/Model/query.js"
|
|
4
|
+
import { and, make, one, or, order, page, project, type QueryWhere, where } from "../src/Model/query.js"
|
|
4
5
|
import { MemoryStoreLive } from "../src/Store/Memory.js"
|
|
5
|
-
import { expectTypeOf } from "@effect/vitest"
|
|
6
6
|
|
|
7
7
|
const str = S.Struct({ _tag: S.Literal("string"), value: S.String })
|
|
8
|
-
const num = S.Struct({ _tag: S.Literal("number"), value: S.
|
|
8
|
+
const num = S.Struct({ _tag: S.Literal("number"), value: S.Finite })
|
|
9
9
|
const someUnion = S.Union(str, num)
|
|
10
10
|
|
|
11
|
-
export class Something extends S.
|
|
11
|
+
export class Something extends S.Opaque<Something>()(S.TaggedStruct("Something", {
|
|
12
12
|
id: S.StringId.withDefault,
|
|
13
13
|
displayName: S.NonEmptyString255,
|
|
14
14
|
n: S.Date.withDefault,
|
|
15
|
-
union: someUnion.pipe(S.
|
|
16
|
-
}) {}
|
|
15
|
+
union: someUnion.pipe(S.withConstructorDefault(Effect.succeed({ _tag: "string" as const, value: "hi" })))
|
|
16
|
+
})) {}
|
|
17
17
|
|
|
18
|
-
export class SomethingElse extends S.
|
|
18
|
+
export class SomethingElse extends S.Opaque<SomethingElse>()(S.TaggedStruct("SomethingElse", {
|
|
19
19
|
id: S.StringId.withDefault,
|
|
20
20
|
banana: S.NonEmptyString255
|
|
21
|
-
}) {}
|
|
21
|
+
})) {}
|
|
22
22
|
|
|
23
23
|
const Union = S.Union(Something, SomethingElse)
|
|
24
24
|
|
|
@@ -38,15 +38,15 @@ export declare namespace SomethingElse {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
const items = [
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
Something.make({ displayName: S.NonEmptyString255("Verona"), n: new Date("2020-01-01T00:00:00Z") }),
|
|
42
|
+
Something.make({ displayName: S.NonEmptyString255("Riley") }),
|
|
43
|
+
Something.make({
|
|
44
44
|
displayName: S.NonEmptyString255("Riley"),
|
|
45
45
|
n: new Date("2020-01-01T00:00:00Z"),
|
|
46
46
|
union: { _tag: "number", value: 1 }
|
|
47
47
|
}),
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
SomethingElse.make({ banana: S.NonEmptyString255("Banana") }),
|
|
49
|
+
SomethingElse.make({ banana: S.NonEmptyString255("Banana2") })
|
|
50
50
|
]
|
|
51
51
|
|
|
52
52
|
class SomethingRepo extends Effect.Service<SomethingRepo>()("SomethingRepo", {
|
|
@@ -78,7 +78,7 @@ const program = Effect.gen(function*() {
|
|
|
78
78
|
order("displayName"),
|
|
79
79
|
page({ take: 1 }),
|
|
80
80
|
one,
|
|
81
|
-
project(
|
|
81
|
+
project(Something.mapFields(Struct.pick(["id", "displayName"])))
|
|
82
82
|
)
|
|
83
83
|
|
|
84
84
|
const r2 = yield* somethingRepo.query(
|
|
@@ -100,31 +100,35 @@ const rt = ManagedRuntime.make(SomethingRepo.Test)
|
|
|
100
100
|
rt.runFork(program)
|
|
101
101
|
|
|
102
102
|
const test1 = make<Union.Encoded>().pipe(
|
|
103
|
-
where("union._tag", "string")
|
|
103
|
+
where("union._tag", "string")
|
|
104
104
|
)
|
|
105
105
|
|
|
106
|
-
expectTypeOf(test1).toEqualTypeOf<
|
|
107
|
-
|
|
108
|
-
readonly
|
|
109
|
-
readonly
|
|
110
|
-
readonly
|
|
106
|
+
expectTypeOf(test1).toEqualTypeOf<
|
|
107
|
+
QueryWhere<Union.Encoded, {
|
|
108
|
+
readonly _tag: "Something"
|
|
109
|
+
readonly id: string
|
|
110
|
+
readonly displayName: string
|
|
111
|
+
readonly n: string
|
|
111
112
|
readonly union: {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
}
|
|
113
|
+
readonly _tag: "string"
|
|
114
|
+
readonly value: string
|
|
115
|
+
}
|
|
116
|
+
}>
|
|
117
|
+
>()
|
|
116
118
|
|
|
117
119
|
const testneq1 = make<Union.Encoded>().pipe(
|
|
118
|
-
where("union._tag", "neq", "string")
|
|
120
|
+
where("union._tag", "neq", "string")
|
|
119
121
|
)
|
|
120
122
|
|
|
121
|
-
expectTypeOf(testneq1).toEqualTypeOf<
|
|
122
|
-
|
|
123
|
-
readonly
|
|
124
|
-
readonly
|
|
125
|
-
readonly
|
|
123
|
+
expectTypeOf(testneq1).toEqualTypeOf<
|
|
124
|
+
QueryWhere<Union.Encoded, {
|
|
125
|
+
readonly _tag: "Something"
|
|
126
|
+
readonly id: string
|
|
127
|
+
readonly displayName: string
|
|
128
|
+
readonly n: string
|
|
126
129
|
readonly union: {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}
|
|
130
|
-
}
|
|
130
|
+
readonly _tag: "number"
|
|
131
|
+
readonly value: number
|
|
132
|
+
}
|
|
133
|
+
}>
|
|
134
|
+
>()
|
package/package.json
CHANGED
|
@@ -1,54 +1,51 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effect-app/infra",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.201",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@faker-js/faker": "^8.4.1",
|
|
8
8
|
"change-case": "^5.4.4",
|
|
9
9
|
"cross-fetch": "^4.1.0",
|
|
10
|
-
"
|
|
11
|
-
"
|
|
10
|
+
"fast-check": "~4.7.0",
|
|
11
|
+
"jose": "^6.2.3",
|
|
12
12
|
"path-parser": "^6.1.0",
|
|
13
13
|
"proper-lockfile": "^4.1.2",
|
|
14
|
-
"pure-rand": "
|
|
14
|
+
"pure-rand": "8.4.0",
|
|
15
15
|
"query-string": "^9.3.1",
|
|
16
|
-
"effect-app": "4.0.0-beta.
|
|
16
|
+
"effect-app": "4.0.0-beta.201"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@azure/cosmos": "^4.9.
|
|
19
|
+
"@azure/cosmos": "^4.9.3",
|
|
20
20
|
"@azure/service-bus": "^7.9.5",
|
|
21
|
-
"@sentry/node": "10.
|
|
22
|
-
"@sentry/opentelemetry": "10.
|
|
23
|
-
"@types/
|
|
24
|
-
"@types/node": "25.
|
|
21
|
+
"@sentry/node": "10.51.0",
|
|
22
|
+
"@sentry/opentelemetry": "10.51.0",
|
|
23
|
+
"@types/better-sqlite3": "^7.6.13",
|
|
24
|
+
"@types/node": "25.6.0",
|
|
25
25
|
"@types/proper-lockfile": "^4.1.4",
|
|
26
26
|
"@types/redis": "^2.8.32",
|
|
27
27
|
"@types/redlock": "^4.0.8",
|
|
28
|
-
"
|
|
29
|
-
"jwks-rsa": "2.1.4",
|
|
28
|
+
"better-sqlite3": "^12.9.0",
|
|
30
29
|
"jwt-decode": "^4.0.0",
|
|
31
|
-
"mongodb": "7.
|
|
30
|
+
"mongodb": "7.2.0",
|
|
32
31
|
"redis": "^3.1.2",
|
|
33
32
|
"redlock": "^4.2.0",
|
|
34
33
|
"strip-ansi": "^7.2.0",
|
|
35
|
-
"typescript": "~
|
|
36
|
-
"vitest": "^4.
|
|
37
|
-
"@effect-app/eslint-shared-config": "0.5.7-beta.2"
|
|
34
|
+
"typescript": "~6.0.3",
|
|
35
|
+
"vitest": "^4.1.5"
|
|
38
36
|
},
|
|
39
37
|
"peerDependencies": {
|
|
40
|
-
"@azure/cosmos": "^4.9.
|
|
38
|
+
"@azure/cosmos": "^4.9.3",
|
|
41
39
|
"@azure/service-bus": "^7.9.5",
|
|
42
|
-
"@effect/vitest": "^4.0.0-beta.
|
|
40
|
+
"@effect/vitest": "^4.0.0-beta.59",
|
|
43
41
|
"@sendgrid/helpers": "^8.0.0",
|
|
44
42
|
"@sendgrid/mail": "^8.1.6",
|
|
45
|
-
"@sentry/node": "10.
|
|
46
|
-
"@sentry/opentelemetry": "10.
|
|
43
|
+
"@sentry/node": "10.51.0",
|
|
44
|
+
"@sentry/opentelemetry": "10.51.0",
|
|
45
|
+
"effect": "^4.0.0-beta.60",
|
|
47
46
|
"jwt-decode": "^4.0.0",
|
|
48
47
|
"redis": "^3.1.2",
|
|
49
|
-
"redlock": "^4.2.0"
|
|
50
|
-
"effect": "^4.0.0-beta.31",
|
|
51
|
-
"express": "^5.2.1"
|
|
48
|
+
"redlock": "^4.2.0"
|
|
52
49
|
},
|
|
53
50
|
"typesVersions": {
|
|
54
51
|
"*": {
|
|
@@ -94,6 +91,10 @@
|
|
|
94
91
|
"types": "./dist/Model/Repository.d.ts",
|
|
95
92
|
"default": "./dist/Model/Repository.js"
|
|
96
93
|
},
|
|
94
|
+
"./Model/Repository/Registry": {
|
|
95
|
+
"types": "./dist/Model/Repository/Registry.d.ts",
|
|
96
|
+
"default": "./dist/Model/Repository/Registry.js"
|
|
97
|
+
},
|
|
97
98
|
"./Model/Repository/ext": {
|
|
98
99
|
"types": "./dist/Model/Repository/ext.d.ts",
|
|
99
100
|
"default": "./dist/Model/Repository/ext.js"
|
|
@@ -166,14 +167,6 @@
|
|
|
166
167
|
"types": "./dist/Model/query/new-kid-interpreter.d.ts",
|
|
167
168
|
"default": "./dist/Model/query/new-kid-interpreter.js"
|
|
168
169
|
},
|
|
169
|
-
"./Operations": {
|
|
170
|
-
"types": "./dist/Operations.d.ts",
|
|
171
|
-
"default": "./dist/Operations.js"
|
|
172
|
-
},
|
|
173
|
-
"./OperationsRepo": {
|
|
174
|
-
"types": "./dist/OperationsRepo.d.ts",
|
|
175
|
-
"default": "./dist/OperationsRepo.js"
|
|
176
|
-
},
|
|
177
170
|
"./QueueMaker/SQLQueue": {
|
|
178
171
|
"types": "./dist/QueueMaker/SQLQueue.d.ts",
|
|
179
172
|
"default": "./dist/QueueMaker/SQLQueue.js"
|
|
@@ -226,6 +219,18 @@
|
|
|
226
219
|
"types": "./dist/Store/Memory.d.ts",
|
|
227
220
|
"default": "./dist/Store/Memory.js"
|
|
228
221
|
},
|
|
222
|
+
"./Store/SQL": {
|
|
223
|
+
"types": "./dist/Store/SQL.d.ts",
|
|
224
|
+
"default": "./dist/Store/SQL.js"
|
|
225
|
+
},
|
|
226
|
+
"./Store/SQL/Pg": {
|
|
227
|
+
"types": "./dist/Store/SQL/Pg.d.ts",
|
|
228
|
+
"default": "./dist/Store/SQL/Pg.js"
|
|
229
|
+
},
|
|
230
|
+
"./Store/SQL/query": {
|
|
231
|
+
"types": "./dist/Store/SQL/query.d.ts",
|
|
232
|
+
"default": "./dist/Store/SQL/query.js"
|
|
233
|
+
},
|
|
229
234
|
"./Store/codeFilter": {
|
|
230
235
|
"types": "./dist/Store/codeFilter.d.ts",
|
|
231
236
|
"default": "./dist/Store/codeFilter.js"
|
|
@@ -384,18 +389,17 @@
|
|
|
384
389
|
"scripts": {
|
|
385
390
|
"watch": "pnpm build:tsc -w",
|
|
386
391
|
"build:tsc": "pnpm clean-dist && effect-app-cli packagejson pnpm check",
|
|
387
|
-
"check": "
|
|
392
|
+
"check": "tsgo --build",
|
|
388
393
|
"build": "pnpm build:tsc",
|
|
389
|
-
"watch2": "pnpm clean-dist && NODE_OPTIONS=--max-old-space-size=6144
|
|
394
|
+
"watch2": "pnpm clean-dist && NODE_OPTIONS=--max-old-space-size=6144 tsgo -w",
|
|
390
395
|
"clean": "rm -rf dist",
|
|
391
396
|
"clean-dist": "sh ../../scripts/clean-dist.sh",
|
|
392
397
|
"circular": "pnpm circular:src && pnpm circular:dist",
|
|
393
398
|
"circular:src": "madge --circular --ts-config ./tsconfig.json --extensions ts ./src",
|
|
394
399
|
"circular:dist": "madge --circular --extensions js ./dist",
|
|
395
|
-
"compile": "NODE_OPTIONS=--max-old-space-size=6144
|
|
396
|
-
"lint": "
|
|
397
|
-
"lint
|
|
398
|
-
"lint-fix": "pnpm lint --fix",
|
|
400
|
+
"compile": "NODE_OPTIONS=--max-old-space-size=6144 tsgo --noEmit",
|
|
401
|
+
"lint": "oxlint --quiet --type-aware ./src && pnpm exec dprint check --config ../../dprint.jsonc .",
|
|
402
|
+
"lint-fix": "oxlint --quiet --type-aware --fix ./src && pnpm exec dprint fmt --config ../../dprint.jsonc .",
|
|
399
403
|
"test": "vitest",
|
|
400
404
|
"test:run": "pnpm run test run --passWithNoTests",
|
|
401
405
|
"testsuite": "pnpm lint && pnpm circular && pnpm run test:run",
|
package/src/CUPS.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type FileOptions, tempFile } from "@effect-app/infra/fileUtil"
|
|
2
2
|
import cp from "child_process"
|
|
3
|
-
import { Config, Effect, Layer, Option, Predicate, S
|
|
3
|
+
import { Config, Context, Effect, Layer, Option, Predicate, S } from "effect-app"
|
|
4
4
|
import { pretty } from "effect-app/utils"
|
|
5
5
|
import fs from "fs"
|
|
6
6
|
import os from "os"
|
|
@@ -74,15 +74,13 @@ function printBuffer(printer: PrinterConfig, options: string[]) {
|
|
|
74
74
|
)
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
})
|
|
85
|
-
}
|
|
77
|
+
const getAvailablePrinters = Effect.fnUntraced(function*(host?: string) {
|
|
78
|
+
const { stdout } = yield* exec(["lpstat", ...buildListArgs({ host }), "-s"].join(" "))
|
|
79
|
+
return [...stdout.matchAll(/device for (\w+):/g)]
|
|
80
|
+
.map((_) => _[1])
|
|
81
|
+
.filter(Predicate.isNotNullish)
|
|
82
|
+
.map((_) => S.NonEmptyString255(_))
|
|
83
|
+
})
|
|
86
84
|
|
|
87
85
|
function* buildListArgs(config?: { host?: string | undefined }) {
|
|
88
86
|
if (config?.host) {
|
|
@@ -100,7 +98,7 @@ export const CUPSConfig = Config.all({
|
|
|
100
98
|
)
|
|
101
99
|
})
|
|
102
100
|
|
|
103
|
-
export class CUPS extends
|
|
101
|
+
export class CUPS extends Context.Service<CUPS>()("effect-app/CUPS", {
|
|
104
102
|
make: Effect.gen(function*() {
|
|
105
103
|
const config = yield* CUPSConfig
|
|
106
104
|
const serverUrl = Option.getOrUndefined(config.server)
|
package/src/Emailer/Sendgrid.ts
CHANGED
|
@@ -7,7 +7,9 @@ import { inspect } from "util"
|
|
|
7
7
|
import { InfraLogger } from "../logger.js"
|
|
8
8
|
import { Emailer, type EmailMsg, type EmailMsgOptionalFrom, type SendgridConfig, SendMailError } from "./service.js"
|
|
9
9
|
|
|
10
|
-
const makeSendgrid = (
|
|
10
|
+
const makeSendgrid = (
|
|
11
|
+
{ apiKey, defaultFrom, defaultReplyTo, fakeMailAddress, realMail, subjectPrefix }: SendgridConfig
|
|
12
|
+
) =>
|
|
11
13
|
Effect.sync(() => {
|
|
12
14
|
sgMail.setApiKey(Redacted.value(apiKey))
|
|
13
15
|
|
|
@@ -18,7 +20,7 @@ const makeSendgrid = ({ apiKey, defaultFrom, defaultReplyTo, realMail, subjectPr
|
|
|
18
20
|
from: msg_.from ?? defaultFrom,
|
|
19
21
|
replyTo: msg_.replyTo ?? (msg_.from ? undefined : defaultReplyTo)
|
|
20
22
|
})
|
|
21
|
-
const render = renderMessage(!realMail)
|
|
23
|
+
const render = renderMessage(!realMail, fakeMailAddress)
|
|
22
24
|
|
|
23
25
|
const renderedMsg_ = render(msg)
|
|
24
26
|
const renderedMsg = {
|
|
@@ -68,23 +70,24 @@ export function Sendgrid(config: SendgridConfig) {
|
|
|
68
70
|
/**
|
|
69
71
|
* @hidden
|
|
70
72
|
*/
|
|
71
|
-
export function renderMessage(forceFake: boolean) {
|
|
73
|
+
export function renderMessage(forceFake: boolean, fakeMailAddress: string) {
|
|
72
74
|
let i = 0
|
|
73
75
|
const makeId = () => i++
|
|
76
|
+
const makeFakeEmail = () => fakeMailAddress.replace("{i}", String(makeId()))
|
|
74
77
|
return forceFake
|
|
75
78
|
? (msg: EmailMsg) =>
|
|
76
79
|
dropUndefinedT({
|
|
77
80
|
...msg,
|
|
78
|
-
to: msg.to && renderFake(msg.to,
|
|
79
|
-
cc: msg.cc && renderFake(msg.cc,
|
|
80
|
-
bcc: msg.bcc && renderFake(msg.bcc,
|
|
81
|
+
to: msg.to && renderFake(msg.to, makeFakeEmail),
|
|
82
|
+
cc: msg.cc && renderFake(msg.cc, makeFakeEmail),
|
|
83
|
+
bcc: msg.bcc && renderFake(msg.bcc, makeFakeEmail)
|
|
81
84
|
})
|
|
82
85
|
: (msg: EmailMsg) =>
|
|
83
86
|
dropUndefinedT({
|
|
84
87
|
...msg,
|
|
85
|
-
to: msg.to && renderFakeIfTest(msg.to,
|
|
86
|
-
cc: msg.cc && renderFakeIfTest(msg.cc,
|
|
87
|
-
bcc: msg.bcc && renderFakeIfTest(msg.bcc,
|
|
88
|
+
to: msg.to && renderFakeIfTest(msg.to, makeFakeEmail),
|
|
89
|
+
cc: msg.cc && renderFakeIfTest(msg.cc, makeFakeEmail),
|
|
90
|
+
bcc: msg.bcc && renderFakeIfTest(msg.bcc, makeFakeEmail)
|
|
88
91
|
})
|
|
89
92
|
}
|
|
90
93
|
|
|
@@ -100,10 +103,10 @@ export function isTestAddress(to: EmailData) {
|
|
|
100
103
|
)
|
|
101
104
|
}
|
|
102
105
|
|
|
103
|
-
function renderFake(addr: EmailData | readonly EmailData[],
|
|
106
|
+
function renderFake(addr: EmailData | readonly EmailData[], makeEmail: () => string) {
|
|
104
107
|
return {
|
|
105
108
|
name: renderMailData(addr),
|
|
106
|
-
email:
|
|
109
|
+
email: makeEmail()
|
|
107
110
|
}
|
|
108
111
|
}
|
|
109
112
|
const eq = Equivalence.mapInput(
|
|
@@ -117,14 +120,14 @@ function isEmailDataArray(md: EmailData | readonly EmailData[]): md is readonly
|
|
|
117
120
|
|
|
118
121
|
// TODO: should just not add any already added email address
|
|
119
122
|
// https://stackoverflow.com/a/53603076/11595834
|
|
120
|
-
function renderFakeIfTest(addr: EmailData | readonly EmailData[],
|
|
123
|
+
function renderFakeIfTest(addr: EmailData | readonly EmailData[], makeEmail: () => string) {
|
|
121
124
|
if (isEmailDataArray(addr)) {
|
|
122
125
|
return Array.dedupeWith(
|
|
123
|
-
addr.map((x) => (isTestAddress(x) ? renderFake(x,
|
|
126
|
+
addr.map((x) => (isTestAddress(x) ? renderFake(x, makeEmail) : x)),
|
|
124
127
|
eq
|
|
125
128
|
)
|
|
126
129
|
}
|
|
127
|
-
return isTestAddress(addr) ? renderFake(addr,
|
|
130
|
+
return isTestAddress(addr) ? renderFake(addr, makeEmail) : addr
|
|
128
131
|
}
|
|
129
132
|
|
|
130
133
|
function renderMailData(md: EmailData | readonly EmailData[]): string {
|
package/src/Emailer/service.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { MailContent, MailData } from "@sendgrid/helpers/classes/mail.js"
|
|
2
2
|
import type { ResponseError } from "@sendgrid/mail"
|
|
3
|
-
import { Data, type Effect, type NonEmptyReadonlyArray, type Redacted
|
|
3
|
+
import { Context, Data, type Effect, type NonEmptyReadonlyArray, type Redacted } from "effect-app"
|
|
4
4
|
import type { Email } from "effect-app/Schema"
|
|
5
5
|
|
|
6
6
|
export class SendMailError extends Data.TaggedError("SendMailError")<{
|
|
7
7
|
readonly raw: Error | ResponseError
|
|
8
8
|
}> {}
|
|
9
9
|
|
|
10
|
-
export class Emailer extends
|
|
10
|
+
export class Emailer extends Context.Opaque<Emailer, {
|
|
11
11
|
sendMail: (msg: EmailMsgOptionalFrom) => Effect.Effect<void, SendMailError>
|
|
12
12
|
}>()("effect-app/Emailer") {}
|
|
13
13
|
|
|
@@ -21,7 +21,13 @@ export interface SendgridConfig {
|
|
|
21
21
|
subjectPrefix: string
|
|
22
22
|
realMail: boolean
|
|
23
23
|
defaultFrom: EmailData
|
|
24
|
-
apiKey: Redacted.Redacted
|
|
24
|
+
apiKey: Redacted.Redacted
|
|
25
|
+
/**
|
|
26
|
+
* Email address used for fake/test recipients. Use `{i}` as a placeholder for an auto-incrementing index to ensure uniqueness.
|
|
27
|
+
*
|
|
28
|
+
* @example "test+{i}@example.com"
|
|
29
|
+
*/
|
|
30
|
+
fakeMailAddress: string
|
|
25
31
|
}
|
|
26
32
|
export type EmailTemplateMsg = MailData & { templateId: string }
|
|
27
33
|
|
package/src/MainFiberSet.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { Effect, Fiber, FiberSet, Layer
|
|
2
|
-
|
|
1
|
+
import { Context, Effect, Fiber, FiberSet, Layer } from "effect-app"
|
|
2
|
+
|
|
3
3
|
import { InfraLogger } from "./logger.js"
|
|
4
4
|
import { reportNonInterruptedFailureCause } from "./QueueMaker/errors.js"
|
|
5
5
|
import { setRootParentSpan } from "./RequestFiberSet.js"
|
|
6
6
|
|
|
7
7
|
const make = Effect.gen(function*() {
|
|
8
8
|
const set = yield* FiberSet.make<unknown, never>()
|
|
9
|
-
const add = (...fibers: Fiber.Fiber<never
|
|
10
|
-
|
|
11
|
-
const addAll = (fibers: readonly Fiber.Fiber<never, never>[]) =>
|
|
9
|
+
const add = (...fibers: Fiber.Fiber<never>[]) => Effect.sync(() => fibers.forEach((_) => FiberSet.addUnsafe(set, _)))
|
|
10
|
+
const addAll = (fibers: readonly Fiber.Fiber<never>[]) =>
|
|
12
11
|
Effect.sync(() => fibers.forEach((_) => FiberSet.addUnsafe(set, _)))
|
|
13
12
|
const join = FiberSet.size(set).pipe(
|
|
14
13
|
Effect.andThen((count) => InfraLogger.logDebug(`Joining ${count} current fibers on the MainFiberSet`)),
|
|
@@ -62,7 +61,7 @@ const make = Effect.gen(function*() {
|
|
|
62
61
|
* you should register these long running fibers in a FiberSet, and join them at the end of your main program.
|
|
63
62
|
* This way any errors will blow up the main program instead of fibers dying unknowingly.
|
|
64
63
|
*/
|
|
65
|
-
export class MainFiberSet extends
|
|
64
|
+
export class MainFiberSet extends Context.Service<MainFiberSet>()("MainFiberSet", { make }) {
|
|
66
65
|
static readonly Live = Layer.effect(this, this.make)
|
|
67
66
|
static readonly JoinLive = this.asEffect().pipe(
|
|
68
67
|
Effect.andThen((_) => _.join),
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Context, Effect } from "effect-app"
|
|
2
|
+
|
|
3
|
+
export interface RegisteredRepository {
|
|
4
|
+
readonly seedNamespace: (namespace: string) => Effect.Effect<void>
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
const make = Effect.sync(() => {
|
|
8
|
+
const repos = new Map<string, RegisteredRepository>()
|
|
9
|
+
return {
|
|
10
|
+
register(modelName: string, repo: RegisteredRepository) {
|
|
11
|
+
repos.set(modelName, repo)
|
|
12
|
+
},
|
|
13
|
+
seedNamespace: (namespace: string) =>
|
|
14
|
+
Effect.suspend(() =>
|
|
15
|
+
Effect.forEach(
|
|
16
|
+
repos.values(),
|
|
17
|
+
(r) => r.seedNamespace(namespace),
|
|
18
|
+
{ concurrency: "unbounded", discard: true }
|
|
19
|
+
)
|
|
20
|
+
),
|
|
21
|
+
get entries(): ReadonlyMap<string, RegisteredRepository> {
|
|
22
|
+
return repos
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
export class RepositoryRegistry extends Context.Opaque<RepositoryRegistry, {
|
|
28
|
+
readonly register: (modelName: string, repo: RegisteredRepository) => void
|
|
29
|
+
readonly seedNamespace: (namespace: string) => Effect.Effect<void>
|
|
30
|
+
readonly entries: ReadonlyMap<string, RegisteredRepository>
|
|
31
|
+
}>()("effect-app/RepositoryRegistry", { make }) {}
|
|
32
|
+
|
|
33
|
+
export const RepositoryRegistryLive = RepositoryRegistry.toLayer(RepositoryRegistry.make)
|