@effect-app/infra 4.0.0-beta.247 → 4.0.0-beta.249
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 +24 -0
- package/dist/ContextProvider.d.ts +34 -0
- package/dist/ContextProvider.d.ts.map +1 -0
- package/dist/ContextProvider.js +40 -0
- package/dist/Emailer/Sendgrid.d.ts +109 -145
- package/dist/Emailer/Sendgrid.d.ts.map +1 -1
- package/dist/Emailer/Sendgrid.js +4 -3
- package/dist/Emailer/fake.d.ts +2 -2
- package/dist/Emailer/fake.d.ts.map +1 -1
- package/dist/Emailer/fake.js +2 -2
- package/dist/QueueMaker/SQLQueue.d.ts +2 -2
- package/dist/QueueMaker/SQLQueue.d.ts.map +1 -1
- package/dist/QueueMaker/SQLQueue.js +4 -4
- package/dist/QueueMaker/memQueue.d.ts +2 -2
- package/dist/QueueMaker/memQueue.d.ts.map +1 -1
- package/dist/QueueMaker/memQueue.js +4 -4
- package/dist/QueueMaker/sbqueue.d.ts +2 -2
- package/dist/QueueMaker/sbqueue.d.ts.map +1 -1
- package/dist/QueueMaker/sbqueue.js +4 -4
- package/dist/RequestFiberSet.js +2 -2
- package/dist/{adapters/SQL → SQL}/Model.d.ts +2 -2
- package/dist/SQL/Model.d.ts.map +1 -0
- package/dist/SQL/Model.js +469 -0
- package/dist/{adapters/SQL.d.ts → SQL.d.ts} +1 -1
- package/dist/SQL.d.ts.map +1 -0
- package/dist/{adapters/SQL.js → SQL.js} +1 -1
- package/dist/{adapters/ServiceBus.d.ts → ServiceBus.d.ts} +1 -1
- package/dist/ServiceBus.d.ts.map +1 -0
- package/dist/ServiceBus.js +108 -0
- package/dist/Store/ContextMapContainer.d.ts +2 -2
- package/dist/Store/ContextMapContainer.d.ts.map +1 -1
- package/dist/Store/ContextMapContainer.js +2 -2
- package/dist/Store/Cosmos/query.d.ts +4 -4
- package/dist/Store/Cosmos/query.d.ts.map +1 -1
- package/dist/Store/Cosmos/query.js +1 -1
- package/dist/Store/Cosmos.d.ts +2 -2
- package/dist/Store/Cosmos.d.ts.map +1 -1
- package/dist/Store/Cosmos.js +3 -3
- package/dist/Store/Disk.d.ts +3 -3
- package/dist/Store/Disk.d.ts.map +1 -1
- package/dist/Store/Disk.js +2 -2
- package/dist/Store/Memory.d.ts +3 -3
- package/dist/Store/Memory.d.ts.map +1 -1
- package/dist/Store/Memory.js +2 -2
- package/dist/Store/SQL/Pg.d.ts +2 -2
- package/dist/Store/SQL/Pg.d.ts.map +1 -1
- package/dist/Store/SQL/Pg.js +2 -2
- package/dist/Store/SQL/query.d.ts +3 -3
- package/dist/Store/SQL/query.d.ts.map +1 -1
- package/dist/Store/SQL/query.js +1 -1
- package/dist/Store/SQL.d.ts +3 -3
- package/dist/Store/SQL.d.ts.map +1 -1
- package/dist/Store/SQL.js +2 -2
- package/dist/Store/codeFilter.d.ts +4 -4
- package/dist/Store/codeFilter.d.ts.map +1 -1
- package/dist/Store/codeFilter.js +1 -1
- package/dist/Store/index.d.ts +3 -4
- package/dist/Store/index.d.ts.map +1 -1
- package/dist/Store/index.js +2 -3
- package/dist/Store/utils.d.ts +2 -2
- package/dist/Store/utils.d.ts.map +1 -1
- package/dist/Store/utils.js +1 -1
- package/dist/{api/codec.d.ts → codec.d.ts} +1 -1
- package/dist/codec.d.ts.map +1 -0
- package/dist/codec.js +5 -0
- package/dist/{adapters/cosmos-client.d.ts → cosmos-client.d.ts} +1 -1
- package/dist/cosmos-client.d.ts.map +1 -0
- package/dist/cosmos-client.js +11 -0
- package/dist/errorReporter.d.ts +1 -1
- package/dist/errorReporter.d.ts.map +1 -1
- package/dist/errorReporter.js +2 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/{api/internal → internal}/RequestContextMiddleware.d.ts +2 -2
- package/dist/internal/RequestContextMiddleware.d.ts.map +1 -0
- package/dist/internal/RequestContextMiddleware.js +46 -0
- package/dist/{api/internal → internal}/auth.d.ts +1 -1
- package/dist/internal/auth.d.ts.map +1 -0
- package/dist/internal/auth.js +180 -0
- package/dist/{api/internal → internal}/events.d.ts +1 -1
- package/dist/internal/events.d.ts.map +1 -0
- package/dist/internal/events.js +49 -0
- package/dist/{api/internal → internal}/health.d.ts +1 -1
- package/dist/internal/health.d.ts.map +1 -0
- package/dist/internal/health.js +5 -0
- package/dist/layerUtils.d.ts +32 -0
- package/dist/layerUtils.d.ts.map +1 -0
- package/dist/layerUtils.js +17 -0
- package/dist/logger/jsonLogger.d.ts +1 -1
- package/dist/logger/jsonLogger.d.ts.map +1 -1
- package/dist/logger/jsonLogger.js +2 -2
- package/dist/logger/logFmtLogger.d.ts +1 -1
- package/dist/logger/logFmtLogger.d.ts.map +1 -1
- package/dist/logger/logFmtLogger.js +2 -2
- package/dist/logger/shared.d.ts +2 -2
- package/dist/logger/shared.d.ts.map +1 -1
- package/dist/logger/shared.js +2 -2
- package/dist/logger.d.ts +1 -1
- package/dist/{adapters/memQueue.d.ts → memQueue.d.ts} +1 -1
- package/dist/memQueue.d.ts.map +1 -0
- package/dist/memQueue.js +21 -0
- package/dist/{api/middlewares.d.ts → middlewares.d.ts} +1 -1
- package/dist/middlewares.d.ts.map +1 -0
- package/dist/{api/middlewares.js → middlewares.js} +1 -1
- package/dist/{adapters/mongo-client.d.ts → mongo-client.d.ts} +1 -1
- package/dist/mongo-client.d.ts.map +1 -0
- package/dist/mongo-client.js +15 -0
- package/dist/{adapters/redis-client.d.ts → redis-client.d.ts} +1 -1
- package/dist/redis-client.d.ts.map +1 -0
- package/dist/redis-client.js +98 -0
- package/dist/reportError.d.ts +4 -0
- package/dist/reportError.d.ts.map +1 -0
- package/dist/reportError.js +28 -0
- package/dist/{api/routing → routing}/middleware/RouterMiddleware.d.ts +1 -1
- package/dist/routing/middleware/RouterMiddleware.d.ts.map +1 -0
- package/dist/{api/routing → routing}/middleware/RouterMiddleware.js +1 -1
- package/dist/{api/routing → routing}/middleware/middleware.d.ts +2 -2
- package/dist/routing/middleware/middleware.d.ts.map +1 -0
- package/dist/routing/middleware/middleware.js +128 -0
- package/dist/{api/routing → routing}/middleware.d.ts +1 -1
- package/dist/routing/middleware.d.ts.map +1 -0
- package/dist/{api/routing → routing}/middleware.js +1 -1
- package/dist/{api/routing → routing}/schema/jwt.d.ts +1 -1
- package/dist/routing/schema/jwt.d.ts.map +1 -0
- package/dist/routing/schema/jwt.js +13 -0
- package/dist/routing/tsort.d.ts +8 -0
- package/dist/routing/tsort.d.ts.map +1 -0
- package/dist/routing/tsort.js +51 -0
- package/dist/{api/routing → routing}/utils.d.ts +1 -1
- package/dist/routing/utils.d.ts.map +1 -0
- package/dist/routing/utils.js +45 -0
- package/dist/routing.d.ts +184 -0
- package/dist/routing.d.ts.map +1 -0
- package/dist/{api/routing.js → routing.js} +1 -1
- package/dist/{api/setupRequest.d.ts → setupRequest.d.ts} +2 -2
- package/dist/setupRequest.d.ts.map +1 -0
- package/dist/setupRequest.js +70 -0
- package/dist/{api/util.d.ts → util.d.ts} +1 -1
- package/dist/util.d.ts.map +1 -0
- package/dist/util.js +14 -0
- package/examples/query.ts +2 -2
- package/package.json +84 -200
- package/src/Emailer/Sendgrid.ts +20 -5
- package/src/Emailer/fake.ts +1 -1
- package/src/QueueMaker/SQLQueue.ts +3 -3
- package/src/QueueMaker/memQueue.ts +3 -3
- package/src/QueueMaker/sbqueue.ts +3 -3
- package/src/RequestFiberSet.ts +1 -1
- package/src/{adapters/SQL → SQL}/Model.ts +1 -1
- package/src/{adapters/ServiceBus.ts → ServiceBus.ts} +1 -1
- package/src/Store/ContextMapContainer.ts +1 -1
- package/src/Store/Cosmos/query.ts +3 -3
- package/src/Store/Cosmos.ts +4 -4
- package/src/Store/Disk.ts +2 -2
- package/src/Store/Memory.ts +4 -4
- package/src/Store/SQL/Pg.ts +3 -3
- package/src/Store/SQL/query.ts +2 -2
- package/src/Store/SQL.ts +3 -3
- package/src/Store/codeFilter.ts +3 -3
- package/src/Store/index.ts +2 -4
- package/src/Store/utils.ts +1 -1
- package/src/errorReporter.ts +1 -1
- package/src/index.ts +2 -1
- package/src/{api/internal → internal}/RequestContextMiddleware.ts +3 -3
- package/src/{api/internal → internal}/events.ts +2 -2
- package/src/{api/layerUtils.ts → layerUtils.ts} +1 -1
- package/src/logger/jsonLogger.ts +1 -1
- package/src/logger/logFmtLogger.ts +1 -1
- package/src/logger/shared.ts +1 -1
- package/src/{adapters/redis-client.ts → redis-client.ts} +1 -1
- package/src/{api/reportError.ts → reportError.ts} +1 -1
- package/src/{api/routing → routing}/middleware/middleware.ts +4 -4
- package/src/{api/routing.ts → routing.ts} +13 -13
- package/src/{api/setupRequest.ts → setupRequest.ts} +3 -3
- package/test/auth.test.ts +1 -1
- package/test/contextProvider.test.ts +1 -1
- package/test/controller.test.ts +3 -3
- package/test/cosmos-query.test.ts +1 -1
- package/test/dist/controller.test.d.ts.map +1 -1
- package/test/dist/query.test.d.ts.map +1 -1
- package/test/dist/rawQuery.test.d.ts.map +1 -1
- package/test/layerUtils.test.ts +1 -1
- package/test/query.test.ts +4 -4
- package/test/rawQuery.test.ts +4 -4
- package/test/repository-ext.test.ts +3 -3
- package/test/router-generator.test.ts +3 -3
- package/test/routing-interruptibility.test.ts +2 -2
- package/test/rpc-context-map-streaming.test.ts +3 -3
- package/test/rpc-e2e-invalidation.test.ts +2 -2
- package/test/rpc-multi-middleware.test.ts +1 -1
- package/test/rpc-stream-fullstack.test.ts +2 -2
- package/test/validateSample.test.ts +3 -3
- package/dist/Emailer/service.d.ts +0 -64
- package/dist/Emailer/service.d.ts.map +0 -1
- package/dist/Emailer/service.js +0 -7
- package/dist/Emailer.d.ts +0 -2
- package/dist/Emailer.d.ts.map +0 -1
- package/dist/Emailer.js +0 -2
- package/dist/Model/Repository/Registry.d.ts +0 -21
- package/dist/Model/Repository/Registry.d.ts.map +0 -1
- package/dist/Model/Repository/Registry.js +0 -18
- package/dist/Model/Repository/ext.d.ts +0 -60
- package/dist/Model/Repository/ext.d.ts.map +0 -1
- package/dist/Model/Repository/ext.js +0 -122
- package/dist/Model/Repository/internal/internal.d.ts +0 -62
- package/dist/Model/Repository/internal/internal.d.ts.map +0 -1
- package/dist/Model/Repository/internal/internal.js +0 -398
- package/dist/Model/Repository/legacy.d.ts +0 -21
- package/dist/Model/Repository/legacy.d.ts.map +0 -1
- package/dist/Model/Repository/legacy.js +0 -2
- package/dist/Model/Repository/makeRepo.d.ts +0 -53
- package/dist/Model/Repository/makeRepo.d.ts.map +0 -1
- package/dist/Model/Repository/makeRepo.js +0 -27
- package/dist/Model/Repository/service.d.ts +0 -97
- package/dist/Model/Repository/service.d.ts.map +0 -1
- package/dist/Model/Repository/service.js +0 -2
- package/dist/Model/Repository/validation.d.ts +0 -71
- package/dist/Model/Repository/validation.d.ts.map +0 -1
- package/dist/Model/Repository/validation.js +0 -32
- package/dist/Model/Repository.d.ts +0 -7
- package/dist/Model/Repository.d.ts.map +0 -1
- package/dist/Model/Repository.js +0 -7
- package/dist/Model/dsl.d.ts +0 -33
- package/dist/Model/dsl.d.ts.map +0 -1
- package/dist/Model/dsl.js +0 -43
- package/dist/Model/filter/filterApi.d.ts +0 -30
- package/dist/Model/filter/filterApi.d.ts.map +0 -1
- package/dist/Model/filter/filterApi.js +0 -2
- package/dist/Model/filter/types/errors.d.ts +0 -29
- package/dist/Model/filter/types/errors.d.ts.map +0 -1
- package/dist/Model/filter/types/errors.js +0 -2
- package/dist/Model/filter/types/fields.d.ts +0 -15
- package/dist/Model/filter/types/fields.d.ts.map +0 -1
- package/dist/Model/filter/types/fields.js +0 -2
- package/dist/Model/filter/types/path/common.d.ts +0 -316
- package/dist/Model/filter/types/path/common.d.ts.map +0 -1
- package/dist/Model/filter/types/path/common.js +0 -2
- package/dist/Model/filter/types/path/eager.d.ts +0 -95
- package/dist/Model/filter/types/path/eager.d.ts.map +0 -1
- package/dist/Model/filter/types/path/eager.js +0 -31
- package/dist/Model/filter/types/path/index.d.ts +0 -4
- package/dist/Model/filter/types/path/index.d.ts.map +0 -1
- package/dist/Model/filter/types/path/index.js +0 -3
- package/dist/Model/filter/types/utils.d.ts +0 -79
- package/dist/Model/filter/types/utils.d.ts.map +0 -1
- package/dist/Model/filter/types/utils.js +0 -2
- package/dist/Model/filter/types/validator.d.ts +0 -30
- package/dist/Model/filter/types/validator.d.ts.map +0 -1
- package/dist/Model/filter/types/validator.js +0 -2
- package/dist/Model/filter/types.d.ts +0 -5
- package/dist/Model/filter/types.d.ts.map +0 -1
- package/dist/Model/filter/types.js +0 -7
- package/dist/Model/query/dsl.d.ts +0 -446
- package/dist/Model/query/dsl.d.ts.map +0 -1
- package/dist/Model/query/dsl.js +0 -339
- package/dist/Model/query/new-kid-interpreter.d.ts +0 -136
- package/dist/Model/query/new-kid-interpreter.d.ts.map +0 -1
- package/dist/Model/query/new-kid-interpreter.js +0 -336
- package/dist/Model/query.d.ts +0 -15
- package/dist/Model/query.d.ts.map +0 -1
- package/dist/Model/query.js +0 -3
- package/dist/Model.d.ts +0 -5
- package/dist/Model.d.ts.map +0 -1
- package/dist/Model.js +0 -5
- package/dist/QueueMaker/service.d.ts +0 -13
- package/dist/QueueMaker/service.d.ts.map +0 -1
- package/dist/QueueMaker/service.js +0 -4
- package/dist/RequestContext.d.ts +0 -103
- package/dist/RequestContext.d.ts.map +0 -1
- package/dist/RequestContext.js +0 -49
- package/dist/Store/service.d.ts +0 -138
- package/dist/Store/service.d.ts.map +0 -1
- package/dist/Store/service.js +0 -95
- package/dist/Store.d.ts +0 -2
- package/dist/Store.d.ts.map +0 -1
- package/dist/Store.js +0 -2
- package/dist/adapters/SQL/Model.d.ts.map +0 -1
- package/dist/adapters/SQL/Model.js +0 -469
- package/dist/adapters/SQL.d.ts.map +0 -1
- package/dist/adapters/ServiceBus.d.ts.map +0 -1
- package/dist/adapters/ServiceBus.js +0 -108
- package/dist/adapters/cosmos-client.d.ts.map +0 -1
- package/dist/adapters/cosmos-client.js +0 -11
- package/dist/adapters/index.d.ts +0 -8
- package/dist/adapters/index.d.ts.map +0 -1
- package/dist/adapters/index.js +0 -8
- package/dist/adapters/logger.d.ts +0 -9
- package/dist/adapters/logger.d.ts.map +0 -1
- package/dist/adapters/logger.js +0 -3
- package/dist/adapters/memQueue.d.ts.map +0 -1
- package/dist/adapters/memQueue.js +0 -21
- package/dist/adapters/mongo-client.d.ts.map +0 -1
- package/dist/adapters/mongo-client.js +0 -15
- package/dist/adapters/redis-client.d.ts.map +0 -1
- package/dist/adapters/redis-client.js +0 -98
- package/dist/api/ContextProvider.d.ts +0 -34
- package/dist/api/ContextProvider.d.ts.map +0 -1
- package/dist/api/ContextProvider.js +0 -40
- package/dist/api/codec.d.ts.map +0 -1
- package/dist/api/codec.js +0 -5
- package/dist/api/internal/RequestContextMiddleware.d.ts.map +0 -1
- package/dist/api/internal/RequestContextMiddleware.js +0 -46
- package/dist/api/internal/auth.d.ts.map +0 -1
- package/dist/api/internal/auth.js +0 -180
- package/dist/api/internal/events.d.ts.map +0 -1
- package/dist/api/internal/events.js +0 -49
- package/dist/api/internal/health.d.ts.map +0 -1
- package/dist/api/internal/health.js +0 -5
- package/dist/api/layerUtils.d.ts +0 -32
- package/dist/api/layerUtils.d.ts.map +0 -1
- package/dist/api/layerUtils.js +0 -17
- package/dist/api/middlewares.d.ts.map +0 -1
- package/dist/api/reportError.d.ts +0 -4
- package/dist/api/reportError.d.ts.map +0 -1
- package/dist/api/reportError.js +0 -28
- package/dist/api/routing/middleware/RouterMiddleware.d.ts.map +0 -1
- package/dist/api/routing/middleware/middleware.d.ts.map +0 -1
- package/dist/api/routing/middleware/middleware.js +0 -128
- package/dist/api/routing/middleware.d.ts.map +0 -1
- package/dist/api/routing/schema/jwt.d.ts.map +0 -1
- package/dist/api/routing/schema/jwt.js +0 -13
- package/dist/api/routing/tsort.d.ts +0 -8
- package/dist/api/routing/tsort.d.ts.map +0 -1
- package/dist/api/routing/tsort.js +0 -51
- package/dist/api/routing/utils.d.ts.map +0 -1
- package/dist/api/routing/utils.js +0 -45
- package/dist/api/routing.d.ts +0 -184
- package/dist/api/routing.d.ts.map +0 -1
- package/dist/api/setupRequest.d.ts.map +0 -1
- package/dist/api/setupRequest.js +0 -70
- package/dist/api/util.d.ts.map +0 -1
- package/dist/api/util.js +0 -14
- package/src/Emailer/service.ts +0 -62
- package/src/Emailer.ts +0 -1
- package/src/Model/Repository/Registry.ts +0 -34
- package/src/Model/Repository/ext.ts +0 -375
- package/src/Model/Repository/internal/internal.ts +0 -692
- package/src/Model/Repository/legacy.ts +0 -29
- package/src/Model/Repository/makeRepo.ts +0 -144
- package/src/Model/Repository/service.ts +0 -639
- package/src/Model/Repository/validation.ts +0 -31
- package/src/Model/Repository.ts +0 -6
- package/src/Model/dsl.ts +0 -129
- package/src/Model/filter/filterApi.ts +0 -60
- package/src/Model/filter/types/errors.ts +0 -47
- package/src/Model/filter/types/fields.ts +0 -50
- package/src/Model/filter/types/path/common.ts +0 -404
- package/src/Model/filter/types/path/eager.ts +0 -297
- package/src/Model/filter/types/path/index.ts +0 -4
- package/src/Model/filter/types/utils.ts +0 -128
- package/src/Model/filter/types/validator.ts +0 -46
- package/src/Model/filter/types.ts +0 -6
- package/src/Model/query/dsl.ts +0 -2546
- package/src/Model/query/new-kid-interpreter.ts +0 -484
- package/src/Model/query.ts +0 -13
- package/src/Model.ts +0 -4
- package/src/QueueMaker/service.ts +0 -19
- package/src/RequestContext.ts +0 -62
- package/src/Store/service.ts +0 -233
- package/src/Store.ts +0 -1
- package/src/adapters/index.ts +0 -7
- package/src/adapters/logger.ts +0 -3
- /package/src/{api/ContextProvider.ts → ContextProvider.ts} +0 -0
- /package/src/{adapters/SQL.ts → SQL.ts} +0 -0
- /package/src/{api/codec.ts → codec.ts} +0 -0
- /package/src/{adapters/cosmos-client.ts → cosmos-client.ts} +0 -0
- /package/src/{api/internal → internal}/auth.ts +0 -0
- /package/src/{api/internal → internal}/health.ts +0 -0
- /package/src/{adapters/memQueue.ts → memQueue.ts} +0 -0
- /package/src/{api/middlewares.ts → middlewares.ts} +0 -0
- /package/src/{adapters/mongo-client.ts → mongo-client.ts} +0 -0
- /package/src/{api/routing → routing}/middleware/RouterMiddleware.ts +0 -0
- /package/src/{api/routing → routing}/middleware.ts +0 -0
- /package/src/{api/routing → routing}/schema/jwt.ts +0 -0
- /package/src/{api/routing → routing}/tsort.ts +0 -0
- /package/src/{api/routing → routing}/utils.ts +0 -0
- /package/src/{api/util.ts → util.ts} +0 -0
package/src/Store/SQL.ts
CHANGED
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
import type { NonEmptyReadonlyArray } from "effect-app/Array"
|
|
4
4
|
import { toNonEmptyArray } from "effect-app/Array"
|
|
5
5
|
import * as Effect from "effect-app/Effect"
|
|
6
|
+
import type { FieldValues } from "effect-app/Model/filter/types"
|
|
7
|
+
import type { ComputedProjectionIrExpression } from "effect-app/Model/query"
|
|
6
8
|
import * as Option from "effect-app/Option"
|
|
9
|
+
import { type FilterArgs, type PersistenceModelType, type StorageConfig, type Store, type StoreConfig, StoreMaker } from "effect-app/Store"
|
|
7
10
|
import * as Context from "effect/Context"
|
|
8
11
|
import * as Layer from "effect/Layer"
|
|
9
12
|
import * as LayerMap from "effect/LayerMap"
|
|
@@ -11,11 +14,8 @@ import * as Struct from "effect/Struct"
|
|
|
11
14
|
import { SqlClient } from "effect/unstable/sql"
|
|
12
15
|
import { OptimisticConcurrencyException } from "../errors.js"
|
|
13
16
|
import { InfraLogger } from "../logger.js"
|
|
14
|
-
import type { FieldValues } from "../Model/filter/types.js"
|
|
15
|
-
import type { ComputedProjectionIrExpression } from "../Model/query.js"
|
|
16
17
|
import { annotateDb, type DbSystem } from "../otel.js"
|
|
17
18
|
import { storeId } from "./Memory.js"
|
|
18
|
-
import { type FilterArgs, type PersistenceModelType, type StorageConfig, type Store, type StoreConfig, StoreMaker } from "./service.js"
|
|
19
19
|
import { buildWhereSQLQuery, logQuery, type SQLDialect, sqliteDialect } from "./SQL/query.js"
|
|
20
20
|
import { makeETag } from "./utils.js"
|
|
21
21
|
|
package/src/Store/codeFilter.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
|
3
3
|
import * as Array from "effect-app/Array"
|
|
4
|
+
import type { FilterR, FilterResult } from "effect-app/Model/filter/filterApi"
|
|
5
|
+
import type { FieldValues } from "effect-app/Model/filter/types"
|
|
4
6
|
import * as Option from "effect-app/Option"
|
|
7
|
+
import type { Filter } from "effect-app/Store"
|
|
5
8
|
import { assertUnreachable } from "effect-app/utils"
|
|
6
|
-
import type { FilterR, FilterResult } from "../Model/filter/filterApi.js"
|
|
7
|
-
import type { FieldValues } from "../Model/filter/types.js"
|
|
8
9
|
import { get } from "./Memory.js"
|
|
9
|
-
import type { Filter } from "./service.js"
|
|
10
10
|
import { compare, greaterThan, greaterThanExclusive, lowerThan, lowerThanExclusive } from "./utils.js"
|
|
11
11
|
|
|
12
12
|
const vAsArr = (v: string) => v as unknown as any[]
|
package/src/Store/index.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
2
|
import * as Effect from "effect-app/Effect"
|
|
3
3
|
import * as Layer from "effect-app/Layer"
|
|
4
|
+
import { RepositoryRegistryLive } from "effect-app/Model"
|
|
5
|
+
import type { StorageConfig } from "effect-app/Store"
|
|
4
6
|
import * as Redacted from "effect/Redacted"
|
|
5
7
|
import type { SqlClient } from "effect/unstable/sql"
|
|
6
8
|
import { CosmosStoreLayer } from "./Cosmos.js"
|
|
7
9
|
import { DiskStoreLayer } from "./Disk.js"
|
|
8
10
|
import { MemoryStoreLive } from "./Memory.js"
|
|
9
11
|
// import { RedisStoreLayer } from "./Redis.js"
|
|
10
|
-
import { RepositoryRegistryLive } from "../Model.js"
|
|
11
|
-
import type { StorageConfig } from "./service.js"
|
|
12
12
|
import { SQLiteStoreLayer } from "./SQL.js"
|
|
13
13
|
import { PgStoreLayer } from "./SQL/Pg.js"
|
|
14
14
|
|
|
@@ -46,5 +46,3 @@ export function StoreMakerLayer(
|
|
|
46
46
|
})
|
|
47
47
|
.pipe(Layer.unwrap, Layer.merge(RepositoryRegistryLive))
|
|
48
48
|
}
|
|
49
|
-
|
|
50
|
-
export * from "./service.js"
|
package/src/Store/utils.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import crypto from "crypto"
|
|
2
2
|
import * as Effect from "effect-app/Effect"
|
|
3
3
|
import * as Option from "effect-app/Option"
|
|
4
|
+
import type { PersistenceModelType, SupportedValues2 } from "effect-app/Store"
|
|
4
5
|
import { OptimisticConcurrencyException } from "../errors.js"
|
|
5
|
-
import type { PersistenceModelType, SupportedValues2 } from "./service.js"
|
|
6
6
|
|
|
7
7
|
export const makeETag = <E extends PersistenceModelType<{}>>(
|
|
8
8
|
{ _etag, ...e }: E
|
package/src/errorReporter.ts
CHANGED
|
@@ -3,9 +3,9 @@ import * as Effect from "effect-app/Effect"
|
|
|
3
3
|
import { dropUndefined, LogLevelToSentry } from "effect-app/utils"
|
|
4
4
|
import * as Cause from "effect/Cause"
|
|
5
5
|
import type * as LogLevel from "effect/LogLevel"
|
|
6
|
-
import { getRC } from "./api/setupRequest.js"
|
|
7
6
|
import { CauseException, tryToJson, tryToReport } from "./errors.js"
|
|
8
7
|
import { InfraLogger } from "./logger.js"
|
|
8
|
+
import { getRC } from "./setupRequest.js"
|
|
9
9
|
|
|
10
10
|
const tryCauseException = <E>(cause: Cause.Cause<E>, name: string): CauseException<E> => {
|
|
11
11
|
try {
|
package/src/index.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export *
|
|
1
|
+
export * from "./logger.js"
|
|
2
|
+
export * from "./Store/index.js"
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as Effect from "effect-app/Effect"
|
|
2
2
|
import { HttpMiddleware, HttpServerRequest, HttpServerResponse } from "effect-app/http"
|
|
3
3
|
import * as Layer from "effect-app/Layer"
|
|
4
|
+
import { Locale, LocaleRef, RequestContext, spanAttributes } from "effect-app/RequestContext"
|
|
4
5
|
import { NonEmptyString255 } from "effect-app/Schema"
|
|
5
|
-
import { Locale, LocaleRef, RequestContext, spanAttributes } from "../../RequestContext.js"
|
|
6
|
-
import { ContextMapContainer } from "../../Store/ContextMapContainer.js"
|
|
7
|
-
import { storeId } from "../../Store/Memory.js"
|
|
8
6
|
import { provideOnRequestScope } from "../setupRequest.js"
|
|
7
|
+
import { ContextMapContainer } from "../Store/ContextMapContainer.js"
|
|
8
|
+
import { storeId } from "../Store/Memory.js"
|
|
9
9
|
|
|
10
10
|
export const RequestContextMiddleware = (defaultLocale: Locale = "en") =>
|
|
11
11
|
HttpMiddleware.make((app) =>
|
|
@@ -5,9 +5,9 @@ import * as Duration from "effect/Duration"
|
|
|
5
5
|
import { pipe } from "effect/Function"
|
|
6
6
|
import * as Schedule from "effect/Schedule"
|
|
7
7
|
import * as Stream from "effect/Stream"
|
|
8
|
-
import { reportError } from "
|
|
9
|
-
import { storeId } from "../../Store/Memory.js"
|
|
8
|
+
import { reportError } from "../errorReporter.js"
|
|
10
9
|
import { setupStreamingRequestContextFromCurrent } from "../setupRequest.js"
|
|
10
|
+
import { storeId } from "../Store/Memory.js"
|
|
11
11
|
|
|
12
12
|
// Tell the client to retry every 10 seconds if connectivity is lost
|
|
13
13
|
const setRetry = Stream.succeed("retry: 10000")
|
|
@@ -4,7 +4,7 @@ import * as Context from "effect-app/Context"
|
|
|
4
4
|
import * as Effect from "effect-app/Effect"
|
|
5
5
|
import type * as Layer from "effect-app/Layer"
|
|
6
6
|
import * as Option from "effect-app/Option"
|
|
7
|
-
import { InfraLogger } from "
|
|
7
|
+
import { InfraLogger } from "./logger.js"
|
|
8
8
|
|
|
9
9
|
// TODO: These LayerUtils are flaky, like in dependencies as a readonly array, it breaks when there are two entries
|
|
10
10
|
// we should look at Service.MakeDeps[E/RIn/ROut] etc.
|
package/src/logger/jsonLogger.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as Array from "effect-app/Array"
|
|
2
|
+
import { spanAttributes } from "effect-app/RequestContext"
|
|
2
3
|
import * as Cause from "effect/Cause"
|
|
3
4
|
import * as Logger from "effect/Logger"
|
|
4
5
|
import { CurrentLogAnnotations, CurrentLogSpans } from "effect/References"
|
|
5
|
-
import { spanAttributes } from "../RequestContext.js"
|
|
6
6
|
import { getRequestContextFromFiber } from "./shared.js"
|
|
7
7
|
|
|
8
8
|
export const jsonLogger = Logger.make<unknown, void>(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { spanAttributes } from "effect-app/RequestContext"
|
|
1
2
|
import * as Logger from "effect/Logger"
|
|
2
|
-
import { spanAttributes } from "../RequestContext.js"
|
|
3
3
|
import { getRequestContextFromFiber } from "./shared.js"
|
|
4
4
|
|
|
5
5
|
export const logfmtLogger = Logger.make<unknown, void>(
|
package/src/logger/shared.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as Option from "effect-app/Option"
|
|
2
|
+
import { LocaleRef, RequestContext } from "effect-app/RequestContext"
|
|
2
3
|
import { NonEmptyString255 } from "effect-app/Schema"
|
|
3
4
|
import type * as Fiber from "effect/Fiber"
|
|
4
|
-
import { LocaleRef, RequestContext } from "../RequestContext.js"
|
|
5
5
|
import { storeId } from "../Store/Memory.js"
|
|
6
6
|
|
|
7
7
|
export function getRequestContextFromFiber(fiber: Fiber.Fiber<unknown, unknown>) {
|
|
@@ -8,7 +8,7 @@ import Redlock from "redlock"
|
|
|
8
8
|
|
|
9
9
|
export class ConnectionException extends Data.TaggedError("ConnectionException")<{ cause: Error; message: string }> {
|
|
10
10
|
constructor(cause: Error) {
|
|
11
|
-
super({ message: "A connection error
|
|
11
|
+
super({ message: "A connection error occurred", cause })
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Effect from "effect-app/Effect"
|
|
2
2
|
import * as Cause from "effect/Cause"
|
|
3
|
-
import { logError, reportError } from "
|
|
3
|
+
import { logError, reportError } from "./errorReporter.js"
|
|
4
4
|
|
|
5
5
|
// const onExitReportError = (name: string, unknownOnly?: boolean) => {
|
|
6
6
|
// const report = reportError(name)
|
|
@@ -10,9 +10,9 @@ import * as Effect from "effect/Effect"
|
|
|
10
10
|
import * as Layer from "effect/Layer"
|
|
11
11
|
import * as Schema from "effect/Schema"
|
|
12
12
|
import { type Rpc } from "effect/unstable/rpc"
|
|
13
|
-
import { logError, reportError } from "
|
|
14
|
-
import { InfraLogger } from "
|
|
15
|
-
import { WithNsTransaction } from "
|
|
13
|
+
import { logError, reportError } from "../../errorReporter.js"
|
|
14
|
+
import { InfraLogger } from "../../logger.js"
|
|
15
|
+
import { WithNsTransaction } from "../../Store/SQL.js"
|
|
16
16
|
|
|
17
17
|
const logRequestError = logError("Request")
|
|
18
18
|
const reportRequestError = reportError("Request")
|
|
@@ -35,7 +35,7 @@ const isOptimisticConcurrencyException = (input: unknown) =>
|
|
|
35
35
|
typeof input === "object" && input !== null && "_tag" in input && input._tag === "OptimisticConcurrencyException"
|
|
36
36
|
|
|
37
37
|
export const RequestType = Context.Reference<"command" | "query">(
|
|
38
|
-
"@effect-app/infra/
|
|
38
|
+
"@effect-app/infra/routing/RequestType",
|
|
39
39
|
{ defaultValue: () => "query" }
|
|
40
40
|
)
|
|
41
41
|
|
|
@@ -73,8 +73,8 @@ type GetSuccess<T> = T extends { success: S.Top } ? T["success"] : typeof S.Void
|
|
|
73
73
|
type GetFailure<T extends { error?: S.Top }> = T["error"] extends never ? typeof S.Never : T["error"]
|
|
74
74
|
|
|
75
75
|
type GetSuccessShape<Action extends { success?: S.Top }, RT extends RequestType> = {
|
|
76
|
-
d:
|
|
77
|
-
raw:
|
|
76
|
+
d: GetSuccess<Action>["Type"]
|
|
77
|
+
raw: GetSuccess<Action>["Encoded"]
|
|
78
78
|
}[RT]
|
|
79
79
|
|
|
80
80
|
interface HandlerBase<Action extends AnyRequestModule, RT extends RequestType, A, E, R> {
|
|
@@ -82,7 +82,7 @@ interface HandlerBase<Action extends AnyRequestModule, RT extends RequestType, A
|
|
|
82
82
|
_tag: RT
|
|
83
83
|
stack: string
|
|
84
84
|
handler: (
|
|
85
|
-
req:
|
|
85
|
+
req: Action["Type"],
|
|
86
86
|
headers: HttpHeaders.Headers
|
|
87
87
|
) => Effect.Effect<A, E, R> | Stream.Stream<A, E, R>
|
|
88
88
|
}
|
|
@@ -92,7 +92,7 @@ export interface Handler<Action extends AnyRequestModule, RT extends RequestType
|
|
|
92
92
|
Action,
|
|
93
93
|
RT,
|
|
94
94
|
GetSuccessShape<Action, RT>,
|
|
95
|
-
|
|
95
|
+
GetFailure<Action>["Type"] | S.SchemaError,
|
|
96
96
|
R
|
|
97
97
|
>
|
|
98
98
|
{}
|
|
@@ -123,7 +123,7 @@ type EffectMatch<
|
|
|
123
123
|
RT extends RequestType,
|
|
124
124
|
Key extends keyof Resource
|
|
125
125
|
> = <A extends GetSuccessShape<Resource[Key], RT>, R2 = never, E = never>(
|
|
126
|
-
f: (req:
|
|
126
|
+
f: (req: Resource[Key]["Type"]) => Effect.Effect<A, E, R2>
|
|
127
127
|
) => Handler<
|
|
128
128
|
Resource[Key],
|
|
129
129
|
RT,
|
|
@@ -139,7 +139,7 @@ type StreamMatch<
|
|
|
139
139
|
RT extends RequestType,
|
|
140
140
|
Key extends keyof Resource
|
|
141
141
|
> = <A extends GetSuccessShape<Resource[Key], RT>, R2 = never, E = never>(
|
|
142
|
-
f: (req:
|
|
142
|
+
f: (req: Resource[Key]["Type"]) => Stream.Stream<A, E, R2>
|
|
143
143
|
) => Handler<
|
|
144
144
|
Resource[Key],
|
|
145
145
|
RT,
|
|
@@ -171,7 +171,7 @@ export type RouteMatcher<
|
|
|
171
171
|
& Match<Resource, RequestContextMap, RequestTypes.DECODED, Key>
|
|
172
172
|
& {
|
|
173
173
|
success: Resource[Key]["success"]
|
|
174
|
-
successRaw: S.Codec<
|
|
174
|
+
successRaw: S.Codec<Resource[Key]["success"]["Encoded"]>
|
|
175
175
|
error: Resource[Key]["error"]
|
|
176
176
|
/**
|
|
177
177
|
* Requires the Encoded shape (e.g directly undecoded from DB, so that we don't do multiple Decode/Encode)
|
|
@@ -266,11 +266,11 @@ export const makeRouter = <Live extends Layer.Layer<any, any, any> = Layer.Layer
|
|
|
266
266
|
Action extends AnyRequestModule,
|
|
267
267
|
RT extends RequestType
|
|
268
268
|
> = (
|
|
269
|
-
req:
|
|
269
|
+
req: Action["Type"]
|
|
270
270
|
) => Generator<
|
|
271
271
|
Effect.Effect<
|
|
272
272
|
any,
|
|
273
|
-
|
|
273
|
+
GetFailure<Action>["Type"] | S.SchemaError,
|
|
274
274
|
// the actual implementation of the handler may just require the dynamic context provided by the middleware
|
|
275
275
|
// and the per request context provided by the context provider
|
|
276
276
|
HandlerContext<Action>
|
|
@@ -283,10 +283,10 @@ export const makeRouter = <Live extends Layer.Layer<any, any, any> = Layer.Layer
|
|
|
283
283
|
Action extends AnyRequestModule,
|
|
284
284
|
RT extends RequestType
|
|
285
285
|
> = (
|
|
286
|
-
req:
|
|
286
|
+
req: Action["Type"]
|
|
287
287
|
) => Effect.Effect<
|
|
288
288
|
GetSuccessShape<Action, RT>,
|
|
289
|
-
|
|
289
|
+
GetFailure<Action>["Type"] | S.SchemaError,
|
|
290
290
|
// the actual implementation of the handler may just require the dynamic context provided by the middleware
|
|
291
291
|
// and the per request context provided by the context provider
|
|
292
292
|
HandlerContext<Action>
|
|
@@ -296,10 +296,10 @@ export const makeRouter = <Live extends Layer.Layer<any, any, any> = Layer.Layer
|
|
|
296
296
|
Action extends AnyRequestModule,
|
|
297
297
|
RT extends RequestType
|
|
298
298
|
> = (
|
|
299
|
-
req:
|
|
299
|
+
req: Action["Type"]
|
|
300
300
|
) => Stream.Stream<
|
|
301
301
|
GetSuccessShape<Action, RT>,
|
|
302
|
-
|
|
302
|
+
GetFailure<Action>["Type"] | S.SchemaError,
|
|
303
303
|
HandlerContext<Action>
|
|
304
304
|
>
|
|
305
305
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as Effect from "effect-app/Effect"
|
|
2
2
|
import * as Layer from "effect-app/Layer"
|
|
3
3
|
import * as Option from "effect-app/Option"
|
|
4
|
+
import { LocaleRef, RequestContext, spanAttributes } from "effect-app/RequestContext"
|
|
4
5
|
import { NonEmptyString255 } from "effect-app/Schema"
|
|
5
6
|
import * as Tracer from "effect/Tracer"
|
|
6
7
|
import { SqlClient } from "effect/unstable/sql"
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { storeId } from "../Store/Memory.js"
|
|
8
|
+
import { ContextMapContainer } from "./Store/ContextMapContainer.js"
|
|
9
|
+
import { storeId } from "./Store/Memory.js"
|
|
10
10
|
|
|
11
11
|
const withSqlTransaction = <R, E, A>(self: Effect.Effect<A, E, R>): Effect.Effect<A, E, R> =>
|
|
12
12
|
Effect.serviceOption(SqlClient.SqlClient).pipe(
|
package/test/auth.test.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { describe, expect, it } from "@effect/vitest"
|
|
|
2
2
|
import * as Effect from "effect-app/Effect"
|
|
3
3
|
import { HttpHeaders } from "effect-app/http"
|
|
4
4
|
import { SignJWT } from "jose"
|
|
5
|
-
import { checkJWTI, InvalidRequestError, InvalidTokenError, UnauthorizedError } from "../src/
|
|
5
|
+
import { checkJWTI, InvalidRequestError, InvalidTokenError, UnauthorizedError } from "../src/internal/auth.js"
|
|
6
6
|
|
|
7
7
|
const issuer = "https://issuer.example.com/"
|
|
8
8
|
const audience = "effect-app"
|
|
@@ -5,7 +5,7 @@ import * as Context from "effect-app/Context"
|
|
|
5
5
|
import * as Effect from "effect-app/Effect"
|
|
6
6
|
import * as Layer from "effect-app/Layer"
|
|
7
7
|
import * as Scope from "effect/Scope"
|
|
8
|
-
import { ContextProvider, mergeContextProviders, MergedContextProvider } from "../src/
|
|
8
|
+
import { ContextProvider, mergeContextProviders, MergedContextProvider } from "../src/ContextProvider.js"
|
|
9
9
|
import { CustomError1, Some, SomeElse, SomeService } from "./fixtures.js"
|
|
10
10
|
|
|
11
11
|
// @effect-diagnostics-next-line missingEffectServiceDependency:off
|
package/test/controller.test.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
3
|
-
import { type MakeContext, type MakeErrors, makeRouter } from "@effect-app/infra/
|
|
3
|
+
import { type MakeContext, type MakeErrors, makeRouter } from "@effect-app/infra/routing"
|
|
4
4
|
import { expect, expectTypeOf, it } from "@effect/vitest"
|
|
5
5
|
import { InvalidStateError, makeRpcClient, UnauthorizedError } from "effect-app/client"
|
|
6
6
|
import * as Context from "effect-app/Context"
|
|
@@ -13,8 +13,8 @@ import * as S from "effect-app/Schema"
|
|
|
13
13
|
import { TypeTestId } from "effect-app/TypeTest"
|
|
14
14
|
import * as Scope from "effect/Scope"
|
|
15
15
|
import { type RpcSerialization } from "effect/unstable/rpc"
|
|
16
|
-
import { DefaultGenericMiddlewaresLive, DevModeMiddlewareLive } from "../src/
|
|
17
|
-
import { sort } from "../src/
|
|
16
|
+
import { DefaultGenericMiddlewaresLive, DevModeMiddlewareLive } from "../src/routing/middleware.js"
|
|
17
|
+
import { sort } from "../src/routing/tsort.js"
|
|
18
18
|
import { AllowAnonymous, AllowAnonymousLive, CustomError1, RequestContextMap, RequireRoles, RequireRolesLive, Some, SomeElse, SomeService, Test, TestLive } from "./fixtures.js"
|
|
19
19
|
|
|
20
20
|
class MyContextProvider extends RpcX.RpcMiddleware.Tag<MyContextProvider, {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { and, computed, make, projectComputed, relation, toFilter, where } from "effect-app/Model/query"
|
|
2
3
|
import * as S from "effect-app/Schema"
|
|
3
4
|
import { describe, expect, it } from "vitest"
|
|
4
|
-
import { and, computed, make, projectComputed, relation, toFilter, where } from "../src/Model/query.js"
|
|
5
5
|
import { buildWhereCosmosQuery3 } from "../src/Store/Cosmos/query.js"
|
|
6
6
|
|
|
7
7
|
class Order extends S.Class<Order>("Order")({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.test.d.ts","sourceRoot":"","sources":["../controller.test.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EAAc,MAAM
|
|
1
|
+
{"version":3,"file":"controller.test.d.ts","sourceRoot":"","sources":["../controller.test.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EAAc,MAAM,2BAA2B,CAAA;AAEzF,OAAO,EAAoC,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AACvF,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAA;AAC7C,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAA;AAC3C,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAA;AAEzC,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAA;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,KAAK,CAAC,MAAM,mBAAmB,CAAA;AAEtC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAG3D,OAAO,EAAE,cAAc,EAAsB,YAAY,EAAqB,YAAY,EAAoB,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,EAAY,MAAM,eAAe,CAAA;;cAGpK,IAAI;cACJ,QAAQ;;AAFpB,cAAM,iBAAkB,SAAQ,sBAGP;IACvB,MAAM,CAAC,OAAO,4DAuBZ;IACF,MAAM,CAAC,OAAO,SAAQ;CACvB;;cAwCgE,QAAQ;;AADzE,cAAM,kBACJ,SAAQ,uBAA0F;IAElG,MAAM,CAAC,OAAO,uDAUZ;CACH;;AAID,cAAM,GAAI,SAAQ,QAAoC;CAAG;;;;;AAEzD,qBAAa,eAAgB,SAAQ,oBAA4D;IAC/F,MAAM,CAAC,OAAO,2CAUZ;CACH;;;;;;;;;;;;AAuBD,cAAM,UAAW,SAAQ,eASW;IAElC,MAAM,CAAC,OAAO,iGAAuD;CAEtE;AAuCD,eAAO,MAAM,WAAW;;;;;;;;;;YAKM,CAAA;AAE9B,eAAO,MAAQ,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAA8B,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAK7D,qBAAa,GAAI,SAAQ,QAA8C;CAAG;;;;;;;;;;;;;;;;;;AAC1E,qBAAa,GAAI,SAAQ,QAAyB;CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIrD,qBAAa,WAAY,SAAQ,gBAEV;CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgB1B,qBAAa,YAAa,SAAQ,iBAEiB;CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtD,qBAAa,aAAc,SAAQ,kBAEA;CAAG;;;;;;;;AAOtC,qBAAa,gBAAiB,SAAQ,qBASrC;IACC,MAAM,CAAC,OAAO,8CAAgC;CAC/C;;;;;;;;AASD,qBAAa,aAAc,SAAQ,kBASlC;IACC,MAAM,CAAC,OAAO,2CAA8E;CAC7F;;;;;;;;AAED,qBAAa,iBAAkB,SAAQ,sBAOtC;IACC,MAAM,CAAC,OAAO,+CAAgC;CAC/C;AAED,eAAO,MAAQ,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAE,QAAQ;;0FAAmC,CAAA;AAElE,eAAO,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAiC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.test.d.ts","sourceRoot":"","sources":["../query.test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"query.test.d.ts","sourceRoot":"","sources":["../query.test.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,CAAC,MAAM,mBAAmB,CAAA;;;;;;;;;;;;;;;;;AAgBtC,qBAAa,SAAU,SAAQ,cAM7B;CAAG;AACL,MAAM,CAAC,OAAO,WAAW,SAAS,CAAC,CAAC;IAElC,UAAiB,OAAQ,SAAQ,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,SAAS,CAAC;KAAG;CACtE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rawQuery.test.d.ts","sourceRoot":"","sources":["../rawQuery.test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rawQuery.test.d.ts","sourceRoot":"","sources":["../rawQuery.test.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,cAAc,MAAM,uBAAuB,CAAA;AAUvD,eAAO,MAAM,EAAE,6CAWb,CAAA"}
|
package/test/layerUtils.test.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { expectTypeOf, it } from "@effect/vitest"
|
|
2
2
|
import type * as Layer from "effect/Layer"
|
|
3
|
-
import { type LayerUtils } from "../src/
|
|
3
|
+
import { type LayerUtils } from "../src/layerUtils.js"
|
|
4
4
|
|
|
5
5
|
it("works", () => {
|
|
6
6
|
// not supported atm, resolves to unknown!
|
package/test/query.test.ts
CHANGED
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
import * as Context from "effect-app/Context"
|
|
5
5
|
import * as Effect from "effect-app/Effect"
|
|
6
6
|
import * as Layer from "effect-app/Layer"
|
|
7
|
+
import { and, computed, count, expr, make, one, or, order, page, project, projectComputed, type QueryEnd, type QueryProjection, type QueryWhere, relation, toFilter, where } from "effect-app/Model/query"
|
|
8
|
+
import { makeRepo } from "effect-app/Model/Repository"
|
|
9
|
+
import { RepositoryRegistryLive } from "effect-app/Model/Repository/Registry"
|
|
7
10
|
import * as Option from "effect-app/Option"
|
|
8
11
|
import * as S from "effect-app/Schema"
|
|
9
12
|
import { flow, pipe } from "effect/Function"
|
|
@@ -11,10 +14,7 @@ import * as SchemaTransformation from "effect/SchemaTransformation"
|
|
|
11
14
|
import * as Struct from "effect/Struct"
|
|
12
15
|
import { inspect } from "util"
|
|
13
16
|
import { expect, expectTypeOf, it } from "vitest"
|
|
14
|
-
import { setupRequestContextFromCurrent } from "../src/
|
|
15
|
-
import { and, computed, count, expr, make, one, or, order, page, project, projectComputed, type QueryEnd, type QueryProjection, type QueryWhere, relation, toFilter, where } from "../src/Model/query.js"
|
|
16
|
-
import { makeRepo } from "../src/Model/Repository.js"
|
|
17
|
-
import { RepositoryRegistryLive } from "../src/Model/Repository/Registry.js"
|
|
17
|
+
import { setupRequestContextFromCurrent } from "../src/setupRequest.js"
|
|
18
18
|
import { memFilter, MemoryStoreLive } from "../src/Store/Memory.js"
|
|
19
19
|
import { SomeService } from "./fixtures.js"
|
|
20
20
|
|
package/test/rawQuery.test.ts
CHANGED
|
@@ -5,6 +5,9 @@ import * as Config from "effect-app/Config"
|
|
|
5
5
|
import * as Context from "effect-app/Context"
|
|
6
6
|
import * as Effect from "effect-app/Effect"
|
|
7
7
|
import * as Layer from "effect-app/Layer"
|
|
8
|
+
import { and, computed, or, project, projectComputed, relation, where, whereEvery, whereSome } from "effect-app/Model/query"
|
|
9
|
+
import { makeRepo } from "effect-app/Model/Repository/makeRepo"
|
|
10
|
+
import { RepositoryRegistryLive } from "effect-app/Model/Repository/Registry"
|
|
8
11
|
import * as S from "effect-app/Schema"
|
|
9
12
|
import { LogLevels } from "effect-app/utils"
|
|
10
13
|
import { flow } from "effect/Function"
|
|
@@ -13,10 +16,7 @@ import * as Redacted from "effect/Redacted"
|
|
|
13
16
|
import * as References from "effect/References"
|
|
14
17
|
import * as Result from "effect/Result"
|
|
15
18
|
import * as Struct from "effect/Struct"
|
|
16
|
-
import { setupRequestContextFromCurrent } from "../src/
|
|
17
|
-
import { and, computed, or, project, projectComputed, relation, where, whereEvery, whereSome } from "../src/Model/query.js"
|
|
18
|
-
import { makeRepo } from "../src/Model/Repository/makeRepo.js"
|
|
19
|
-
import { RepositoryRegistryLive } from "../src/Model/Repository/Registry.js"
|
|
19
|
+
import { setupRequestContextFromCurrent } from "../src/setupRequest.js"
|
|
20
20
|
import { CosmosStoreLayer } from "../src/Store/Cosmos.js"
|
|
21
21
|
import { MemoryStoreLive } from "../src/Store/Memory.js"
|
|
22
22
|
import { SQLiteStoreLayer } from "../src/Store/SQL.js"
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { describe, expect, it } from "@effect/vitest"
|
|
2
2
|
import * as Effect from "effect-app/Effect"
|
|
3
3
|
import * as Layer from "effect-app/Layer"
|
|
4
|
+
import { makeRepo } from "effect-app/Model/Repository"
|
|
5
|
+
import { RepositoryRegistryLive } from "effect-app/Model/Repository/Registry"
|
|
4
6
|
import * as S from "effect-app/Schema"
|
|
5
|
-
import { setupRequestContextFromCurrent } from "../src/
|
|
6
|
-
import { makeRepo } from "../src/Model/Repository.js"
|
|
7
|
-
import { RepositoryRegistryLive } from "../src/Model/Repository/Registry.js"
|
|
7
|
+
import { setupRequestContextFromCurrent } from "../src/setupRequest.js"
|
|
8
8
|
import { MemoryStoreLive } from "../src/Store/Memory.js"
|
|
9
9
|
|
|
10
10
|
class BatchItem extends S.Class<BatchItem>("BatchItem")({
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { type MakeContext, type MakeErrors, makeRouter } from "@effect-app/infra/
|
|
2
|
-
import { makeAllDSL, makeOneDSL } from "@effect-app/infra/Model"
|
|
1
|
+
import { type MakeContext, type MakeErrors, makeRouter } from "@effect-app/infra/routing"
|
|
3
2
|
import { expectTypeOf, it } from "@effect/vitest"
|
|
4
3
|
import { InvalidStateError, makeRpcClient, UnauthorizedError } from "effect-app/client"
|
|
5
4
|
import * as Context from "effect-app/Context"
|
|
6
5
|
import * as Effect from "effect-app/Effect"
|
|
7
6
|
import * as Layer from "effect-app/Layer"
|
|
8
7
|
import { DefaultGenericMiddlewares } from "effect-app/middleware"
|
|
8
|
+
import { makeAllDSL, makeOneDSL } from "effect-app/Model"
|
|
9
9
|
import { type FixEnv } from "effect-app/Pure"
|
|
10
10
|
import * as RpcX from "effect-app/rpc"
|
|
11
11
|
import { MiddlewareMaker } from "effect-app/rpc"
|
|
@@ -13,7 +13,7 @@ import * as S from "effect-app/Schema"
|
|
|
13
13
|
import { type TypeTestId } from "effect-app/TypeTest"
|
|
14
14
|
import { type ConfigError } from "effect/Config"
|
|
15
15
|
import { type RpcSerialization } from "effect/unstable/rpc/RpcSerialization"
|
|
16
|
-
import { DefaultGenericMiddlewaresLive, DevModeMiddlewareLive } from "../src/
|
|
16
|
+
import { DefaultGenericMiddlewaresLive, DevModeMiddlewareLive } from "../src/routing/middleware.js"
|
|
17
17
|
import { AllowAnonymous, AllowAnonymousLive, RequestContextMap, RequireRoles, RequireRolesLive, Some, SomeElse, SomeService, Test, TestLive } from "./fixtures.js"
|
|
18
18
|
|
|
19
19
|
// Inline minimal context provider (provides `Some`)
|
|
@@ -6,8 +6,8 @@ import * as Fiber from "effect/Fiber"
|
|
|
6
6
|
import * as Layer from "effect/Layer"
|
|
7
7
|
import * as Ref from "effect/Ref"
|
|
8
8
|
import { Rpc, RpcGroup, RpcTest } from "effect/unstable/rpc"
|
|
9
|
-
import { applyRequestTypeInterruptibility } from "../src/
|
|
10
|
-
import { ConfigureInterruptibilityMiddlewareLive, RequestType } from "../src/
|
|
9
|
+
import { applyRequestTypeInterruptibility } from "../src/routing.js"
|
|
10
|
+
import { ConfigureInterruptibilityMiddlewareLive, RequestType } from "../src/routing/middleware.js"
|
|
11
11
|
|
|
12
12
|
const InterruptibilityRpcs = RpcGroup.make(
|
|
13
13
|
Rpc
|
|
@@ -49,9 +49,9 @@ import * as Stream from "effect/Stream"
|
|
|
49
49
|
import { FetchHttpClient } from "effect/unstable/http"
|
|
50
50
|
import { RpcSerialization } from "effect/unstable/rpc"
|
|
51
51
|
import { createServer } from "http"
|
|
52
|
-
import { RequestContextMiddleware } from "../src/
|
|
53
|
-
import { makeRouter } from "../src/
|
|
54
|
-
import { DefaultGenericMiddlewaresLive } from "../src/
|
|
52
|
+
import { RequestContextMiddleware } from "../src/internal/RequestContextMiddleware.js"
|
|
53
|
+
import { makeRouter } from "../src/routing.js"
|
|
54
|
+
import { DefaultGenericMiddlewaresLive } from "../src/routing/middleware.js"
|
|
55
55
|
import { getContextMap } from "../src/Store/ContextMapContainer.js"
|
|
56
56
|
import { AllowAnonymous, AllowAnonymousLive, RequestContextMap, RequireRoles, RequireRolesLive, SomeElseMiddleware, SomeElseMiddlewareLive, SomeService, Test, TestLive } from "./fixtures.js"
|
|
57
57
|
|
|
@@ -29,8 +29,8 @@ import * as Stream from "effect/Stream"
|
|
|
29
29
|
import { FetchHttpClient } from "effect/unstable/http"
|
|
30
30
|
import { RpcSerialization } from "effect/unstable/rpc"
|
|
31
31
|
import { createServer } from "http"
|
|
32
|
-
import { makeRouter } from "../src/
|
|
33
|
-
import { DefaultGenericMiddlewaresLive } from "../src/
|
|
32
|
+
import { makeRouter } from "../src/routing.js"
|
|
33
|
+
import { DefaultGenericMiddlewaresLive } from "../src/routing/middleware.js"
|
|
34
34
|
import { AllowAnonymous, AllowAnonymousLive, RequestContextMap, RequireRoles, RequireRolesLive, SomeElseMiddleware, SomeElseMiddlewareLive, SomeService, Test, TestLive } from "./fixtures.js"
|
|
35
35
|
|
|
36
36
|
// ---------------------------------------------------------------------------
|
|
@@ -14,7 +14,7 @@ import * as Result from "effect/Result"
|
|
|
14
14
|
import { FetchHttpClient } from "effect/unstable/http"
|
|
15
15
|
import { Rpc, RpcClient, RpcGroup, RpcSerialization, RpcServer, RpcTest } from "effect/unstable/rpc"
|
|
16
16
|
import { createServer } from "http"
|
|
17
|
-
import { DefaultGenericMiddlewaresLive } from "../src/
|
|
17
|
+
import { DefaultGenericMiddlewaresLive } from "../src/routing.js"
|
|
18
18
|
import { AllowAnonymous, AllowAnonymousLive, RequestContextMap, RequireRoles, RequireRolesLive, Some, SomeElseMiddleware, SomeElseMiddlewareLive, SomeMiddleware, SomeMiddlewareLive, SomeService, Test, TestLive, UserProfile } from "./fixtures.js"
|
|
19
19
|
|
|
20
20
|
const incomplete = RpcX
|
|
@@ -25,8 +25,8 @@ import * as Stream from "effect/Stream"
|
|
|
25
25
|
import { FetchHttpClient } from "effect/unstable/http"
|
|
26
26
|
import { RpcSerialization } from "effect/unstable/rpc"
|
|
27
27
|
import { createServer } from "http"
|
|
28
|
-
import { makeRouter } from "../src/
|
|
29
|
-
import { DefaultGenericMiddlewaresLive } from "../src/
|
|
28
|
+
import { makeRouter } from "../src/routing.js"
|
|
29
|
+
import { DefaultGenericMiddlewaresLive } from "../src/routing/middleware.js"
|
|
30
30
|
import { AllowAnonymous, AllowAnonymousLive, RequestContextMap, RequireRoles, RequireRolesLive, SomeElseMiddleware, SomeElseMiddlewareLive, SomeService, Test, TestLive } from "./fixtures.js"
|
|
31
31
|
|
|
32
32
|
// ---------------------------------------------------------------------------
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as Effect from "effect-app/Effect"
|
|
2
2
|
import * as Layer from "effect-app/Layer"
|
|
3
|
+
import { makeRepo, ValidationError, ValidationResult } from "effect-app/Model/Repository"
|
|
4
|
+
import { RepositoryRegistryLive } from "effect-app/Model/Repository/Registry"
|
|
3
5
|
import * as S from "effect-app/Schema"
|
|
4
6
|
import { describe, expect, it } from "vitest"
|
|
5
|
-
import { setupRequestContextFromCurrent } from "../src/
|
|
6
|
-
import { makeRepo, ValidationError, ValidationResult } from "../src/Model/Repository.js"
|
|
7
|
-
import { RepositoryRegistryLive } from "../src/Model/Repository/Registry.js"
|
|
7
|
+
import { setupRequestContextFromCurrent } from "../src/setupRequest.js"
|
|
8
8
|
import { MemoryStoreLive } from "../src/Store/Memory.js"
|
|
9
9
|
|
|
10
10
|
const TestStoreLive = Layer.merge(MemoryStoreLive, RepositoryRegistryLive)
|