@effect-app/infra 0.167.0 → 0.169.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/_cjs/RequestContext.cjs +3 -4
- package/_cjs/RequestContext.cjs.map +1 -1
- package/_cjs/api/codec.cjs.map +1 -1
- package/_cjs/api/express/schema/jwt.cjs.map +1 -1
- package/_cjs/api/routing/base.cjs.map +1 -1
- package/_cjs/api/routing/defaultErrorHandler.cjs +2 -2
- package/_cjs/api/routing/defaultErrorHandler.cjs.map +1 -1
- package/_cjs/api/routing/makeRequestHandler.cjs.map +1 -1
- package/_cjs/api/routing/match.cjs +1 -1
- package/_cjs/api/routing/match.cjs.map +1 -1
- package/_cjs/logger/logFmtLogger.cjs.map +1 -1
- package/_cjs/services/Emailer/Sendgrid.cjs.map +1 -1
- package/_cjs/services/QueueMaker/errors.cjs.map +1 -1
- package/_cjs/services/QueueMaker/memQueue.cjs.map +1 -1
- package/_cjs/services/QueueMaker/sbqueue.cjs.map +1 -1
- package/_cjs/services/Repository.cjs.map +1 -1
- package/_cjs/services/RepositoryBase.cjs.map +1 -1
- package/_cjs/services/RequestContextContainer.cjs +1 -1
- package/_cjs/services/RequestContextContainer.cjs.map +1 -1
- package/_cjs/services/Store/ContextMapContainer.cjs +1 -1
- package/_cjs/services/Store/ContextMapContainer.cjs.map +1 -1
- package/_cjs/services/Store/utils.cjs.map +1 -1
- package/_cjs/services/simpledb/cosmosdb.cjs +2 -2
- package/_cjs/services/simpledb/cosmosdb.cjs.map +1 -1
- package/_cjs/services/simpledb/redisdb.cjs.map +1 -1
- package/_cjs/services/simpledb/shared.cjs +5 -4
- package/_cjs/services/simpledb/shared.cjs.map +1 -1
- package/_cjs/services/simpledb/simpledb.cjs +1 -1
- package/_cjs/services/simpledb/simpledb.cjs.map +1 -1
- package/_src/RequestContext.ts +3 -3
- package/_src/api/codec.ts +1 -1
- package/_src/api/defaultErrorHandler.ts +2 -2
- package/_src/api/express/schema/jwt.ts +3 -3
- package/_src/api/express/schema/routing.ts +7 -7
- package/_src/api/reportError.ts +2 -2
- package/_src/api/routing/base.ts +19 -22
- package/_src/api/routing/defaultErrorHandler.ts +3 -3
- package/_src/api/routing/makeRequestHandler.ts +20 -28
- package/_src/api/routing/match.ts +4 -4
- package/_src/api/setupRequest.ts +3 -3
- package/_src/logger/logFmtLogger.ts +1 -1
- package/_src/rateLimit.ts +9 -9
- package/_src/services/Emailer/Sendgrid.ts +3 -7
- package/_src/services/Emailer/service.ts +1 -1
- package/_src/services/Operations/service.ts +9 -9
- package/_src/services/QueueMaker/errors.ts +5 -5
- package/_src/services/QueueMaker/memQueue.ts +5 -5
- package/_src/services/QueueMaker/sbqueue.ts +5 -5
- package/_src/services/QueueMaker/service.ts +3 -3
- package/_src/services/Repository.ts +90 -110
- package/_src/services/RepositoryBase.ts +29 -45
- package/_src/services/RequestContextContainer.ts +7 -9
- package/_src/services/Store/ContextMapContainer.ts +4 -4
- package/_src/services/Store/Cosmos.ts +3 -3
- package/_src/services/Store/Disk.ts +4 -4
- package/_src/services/Store/Memory.ts +2 -2
- package/_src/services/Store/Redis.ts +3 -3
- package/_src/services/Store/service.ts +10 -10
- package/_src/services/Store/utils.ts +2 -2
- package/_src/services/simpledb/cosmosdb.ts +3 -3
- package/_src/services/simpledb/diskdb.ts +3 -3
- package/_src/services/simpledb/memdb.ts +3 -3
- package/_src/services/simpledb/mongodb.ts +3 -3
- package/_src/services/simpledb/redisdb.ts +5 -5
- package/_src/services/simpledb/shared.ts +4 -3
- package/_src/services/simpledb/simpledb.ts +8 -8
- package/dist/RequestContext.d.ts +48 -48
- package/dist/RequestContext.js +4 -5
- package/dist/_ext/Array.d.ts +1 -1
- package/dist/api/codec.d.ts +1 -1
- package/dist/api/codec.d.ts.map +1 -1
- package/dist/api/codec.js +1 -1
- package/dist/api/defaultErrorHandler.d.ts +2 -2
- package/dist/api/defaultErrorHandler.d.ts.map +1 -1
- package/dist/api/express/schema/jwt.d.ts +1 -1
- package/dist/api/express/schema/jwt.js +1 -1
- package/dist/api/express/schema/routing.d.ts +6 -6
- package/dist/api/express/schema/routing.d.ts.map +1 -1
- package/dist/api/reportError.d.ts +2 -2
- package/dist/api/routing/base.d.ts +11 -10
- package/dist/api/routing/base.d.ts.map +1 -1
- package/dist/api/routing/base.js +1 -1
- package/dist/api/routing/defaultErrorHandler.d.ts +5 -5
- package/dist/api/routing/defaultErrorHandler.d.ts.map +1 -1
- package/dist/api/routing/defaultErrorHandler.js +3 -3
- package/dist/api/routing/makeRequestHandler.d.ts +2 -2
- package/dist/api/routing/makeRequestHandler.d.ts.map +1 -1
- package/dist/api/routing/makeRequestHandler.js +11 -15
- package/dist/api/routing/match.d.ts +1 -1
- package/dist/api/routing/match.d.ts.map +1 -1
- package/dist/api/routing/match.js +2 -2
- package/dist/api/setupRequest.d.ts +2 -2
- package/dist/errorReporter.d.ts +3 -3
- package/dist/logger/logFmtLogger.js +2 -2
- package/dist/rateLimit.d.ts +4 -4
- package/dist/rateLimit.js +1 -1
- package/dist/services/Emailer/Sendgrid.d.ts +1 -1
- package/dist/services/Emailer/Sendgrid.d.ts.map +1 -1
- package/dist/services/Emailer/Sendgrid.js +1 -1
- package/dist/services/Emailer/fake.d.ts +1 -1
- package/dist/services/Emailer/service.d.ts +2 -2
- package/dist/services/Emailer/service.d.ts.map +1 -1
- package/dist/services/Operations/live.d.ts +1 -1
- package/dist/services/Operations/service.d.ts +12 -12
- package/dist/services/Operations/service.d.ts.map +1 -1
- package/dist/services/QueueMaker/errors.d.ts +5 -5
- package/dist/services/QueueMaker/errors.d.ts.map +1 -1
- package/dist/services/QueueMaker/errors.js +1 -1
- package/dist/services/QueueMaker/memQueue.d.ts +4 -4
- package/dist/services/QueueMaker/memQueue.d.ts.map +1 -1
- package/dist/services/QueueMaker/memQueue.js +1 -1
- package/dist/services/QueueMaker/sbqueue.d.ts +5 -5
- package/dist/services/QueueMaker/sbqueue.d.ts.map +1 -1
- package/dist/services/QueueMaker/sbqueue.js +1 -1
- package/dist/services/QueueMaker/service.d.ts +11 -11
- package/dist/services/QueueMaker/service.d.ts.map +1 -1
- package/dist/services/Repository.d.ts +67 -67
- package/dist/services/Repository.d.ts.map +1 -1
- package/dist/services/Repository.js +1 -1
- package/dist/services/RepositoryBase.d.ts +30 -30
- package/dist/services/RepositoryBase.d.ts.map +1 -1
- package/dist/services/RepositoryBase.js +1 -1
- package/dist/services/RequestContextContainer.d.ts +9 -9
- package/dist/services/RequestContextContainer.d.ts.map +1 -1
- package/dist/services/RequestContextContainer.js +11 -13
- package/dist/services/Store/ContextMapContainer.d.ts +7 -7
- package/dist/services/Store/ContextMapContainer.d.ts.map +1 -1
- package/dist/services/Store/ContextMapContainer.js +2 -2
- package/dist/services/Store/Cosmos/query.d.ts +1 -1
- package/dist/services/Store/Cosmos.d.ts +1 -1
- package/dist/services/Store/Cosmos.js +1 -1
- package/dist/services/Store/Disk.d.ts +4 -4
- package/dist/services/Store/Disk.d.ts.map +1 -1
- package/dist/services/Store/Disk.js +1 -1
- package/dist/services/Store/Memory.d.ts +4 -4
- package/dist/services/Store/Memory.d.ts.map +1 -1
- package/dist/services/Store/Redis.d.ts +1 -1
- package/dist/services/Store/Redis.js +1 -1
- package/dist/services/Store/index.d.ts +1 -1
- package/dist/services/Store/service.d.ts +14 -14
- package/dist/services/Store/service.d.ts.map +1 -1
- package/dist/services/Store/utils.d.ts +1 -1
- package/dist/services/Store/utils.d.ts.map +1 -1
- package/dist/services/Store/utils.js +1 -1
- package/dist/services/simpledb/cosmosdb.d.ts +6 -6
- package/dist/services/simpledb/cosmosdb.d.ts.map +1 -1
- package/dist/services/simpledb/cosmosdb.js +3 -3
- package/dist/services/simpledb/diskdb.d.ts +4 -4
- package/dist/services/simpledb/diskdb.d.ts.map +1 -1
- package/dist/services/simpledb/diskdb.js +1 -1
- package/dist/services/simpledb/memdb.d.ts +4 -4
- package/dist/services/simpledb/memdb.d.ts.map +1 -1
- package/dist/services/simpledb/memdb.js +1 -1
- package/dist/services/simpledb/mongodb.d.ts +5 -5
- package/dist/services/simpledb/mongodb.d.ts.map +1 -1
- package/dist/services/simpledb/mongodb.js +1 -1
- package/dist/services/simpledb/redisdb.d.ts +13 -13
- package/dist/services/simpledb/redisdb.d.ts.map +1 -1
- package/dist/services/simpledb/redisdb.js +1 -1
- package/dist/services/simpledb/shared.d.ts +19 -19
- package/dist/services/simpledb/shared.d.ts.map +1 -1
- package/dist/services/simpledb/shared.js +6 -5
- package/dist/services/simpledb/simpledb.d.ts +5 -5
- package/dist/services/simpledb/simpledb.d.ts.map +1 -1
- package/dist/services/simpledb/simpledb.js +2 -2
- package/package.json +12 -12
|
@@ -6,11 +6,11 @@ import { RequestContext } from "../RequestContext.js"
|
|
|
6
6
|
* @tsplus companion RequestContextContainer.Ops
|
|
7
7
|
*/
|
|
8
8
|
export class RequestContextContainer extends TagClass<RequestContextContainer, {
|
|
9
|
-
requestContext: Effect<
|
|
10
|
-
update: (f: (rc: RequestContext) => RequestContext) => Effect<
|
|
11
|
-
start: (f: RequestContext) => Effect<
|
|
9
|
+
requestContext: Effect<RequestContext>
|
|
10
|
+
update: (f: (rc: RequestContext) => RequestContext) => Effect<RequestContext>
|
|
11
|
+
start: (f: RequestContext) => Effect<void>
|
|
12
12
|
}>() {
|
|
13
|
-
static get get(): Effect<
|
|
13
|
+
static get get(): Effect<RequestContext, never, RequestContextContainer> {
|
|
14
14
|
return RequestContextContainer.flatMap((_) => _.requestContext)
|
|
15
15
|
}
|
|
16
16
|
static get getOption() {
|
|
@@ -39,7 +39,7 @@ export const live = Effect
|
|
|
39
39
|
.toLayerScoped(RequestContextContainer)
|
|
40
40
|
|
|
41
41
|
/** @tsplus static RequestContext.Ops Tag */
|
|
42
|
-
export const RCTag =
|
|
42
|
+
export const RCTag = GenericTag<RequestContext>("@services/RCTag")
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
45
|
* @tsplus getter RequestContext spanAttributes
|
|
@@ -49,8 +49,7 @@ export const spanAttributes = (ctx: RequestContext) => ({
|
|
|
49
49
|
"request.name": ctx.name,
|
|
50
50
|
"request.locale": ctx.locale,
|
|
51
51
|
"request.namespace": ctx.namespace,
|
|
52
|
-
...ctx.userProfile?.sub
|
|
53
|
-
? {
|
|
52
|
+
...(ctx.userProfile?.sub ? {
|
|
54
53
|
"request.user.sub": ctx
|
|
55
54
|
.userProfile
|
|
56
55
|
.sub,
|
|
@@ -58,6 +57,5 @@ export const spanAttributes = (ctx: RequestContext) => ({
|
|
|
58
57
|
.userProfile
|
|
59
58
|
? ctx.userProfile.roles
|
|
60
59
|
: undefined
|
|
61
|
-
}
|
|
62
|
-
: {}
|
|
60
|
+
} : {})
|
|
63
61
|
})
|
|
@@ -10,10 +10,10 @@ import { ContextMap, makeContextMap } from "./service.js"
|
|
|
10
10
|
* @tsplus companion ContextMapContainer.Ops
|
|
11
11
|
*/
|
|
12
12
|
export class ContextMapContainer extends TagClass<ContextMapContainer, {
|
|
13
|
-
get: Effect<
|
|
14
|
-
start: Effect<
|
|
13
|
+
get: Effect<ContextMap>
|
|
14
|
+
start: Effect<void>
|
|
15
15
|
}>() {
|
|
16
|
-
static get get(): Effect<
|
|
16
|
+
static get get(): Effect<ContextMap, never, ContextMapContainer> {
|
|
17
17
|
return ContextMapContainer.flatMap((_) => _.get)
|
|
18
18
|
}
|
|
19
19
|
static get getOption() {
|
|
@@ -37,4 +37,4 @@ export const live = Effect
|
|
|
37
37
|
.toLayerScoped(ContextMapContainer)
|
|
38
38
|
|
|
39
39
|
/** @tsplus static ContextMap.Ops Tag */
|
|
40
|
-
export const RCTag =
|
|
40
|
+
export const RCTag = GenericTag<ContextMap>("@services/RCTag")
|
|
@@ -30,7 +30,7 @@ function makeCosmosStore({ prefix }: StorageConfig) {
|
|
|
30
30
|
return {
|
|
31
31
|
make: <Id extends string, PM extends PersistenceModelType<Id>, R = never, E = never>(
|
|
32
32
|
name: string,
|
|
33
|
-
seed?: Effect<
|
|
33
|
+
seed?: Effect<Iterable<PM>, E, R>,
|
|
34
34
|
config?: StoreConfig<PM>
|
|
35
35
|
) =>
|
|
36
36
|
Effect.gen(function*($) {
|
|
@@ -433,8 +433,8 @@ function makeCosmosStore({ prefix }: StorageConfig) {
|
|
|
433
433
|
}
|
|
434
434
|
return s
|
|
435
435
|
})
|
|
436
|
-
}
|
|
437
|
-
})
|
|
436
|
+
};
|
|
437
|
+
});
|
|
438
438
|
}
|
|
439
439
|
|
|
440
440
|
export function CosmosStoreLayer(cfg: StorageConfig) {
|
|
@@ -12,7 +12,7 @@ function makeDiskStoreInt<Id extends string, PM extends PersistenceModelType<Id>
|
|
|
12
12
|
namespace: string,
|
|
13
13
|
dir: string,
|
|
14
14
|
name: string,
|
|
15
|
-
seed?: Effect<
|
|
15
|
+
seed?: Effect<Iterable<PM>, E, R>,
|
|
16
16
|
defaultValues?: Partial<PM>
|
|
17
17
|
) {
|
|
18
18
|
return Effect.gen(function*($) {
|
|
@@ -102,7 +102,7 @@ export function makeDiskStore({ prefix }: StorageConfig, dir: string) {
|
|
|
102
102
|
return {
|
|
103
103
|
make: <Id extends string, PM extends PersistenceModelType<Id>, R, E>(
|
|
104
104
|
name: string,
|
|
105
|
-
seed?: Effect<
|
|
105
|
+
seed?: Effect<Iterable<PM>, E, R>,
|
|
106
106
|
config?: StoreConfig<PM>
|
|
107
107
|
) =>
|
|
108
108
|
Effect.gen(function*($) {
|
|
@@ -142,8 +142,8 @@ export function makeDiskStore({ prefix }: StorageConfig, dir: string) {
|
|
|
142
142
|
}
|
|
143
143
|
return s
|
|
144
144
|
})
|
|
145
|
-
}
|
|
146
|
-
})
|
|
145
|
+
};
|
|
146
|
+
});
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
export function DiskStoreLayer(config: StorageConfig, dir: string) {
|
|
@@ -57,7 +57,7 @@ function logQuery(f: FilterArgs<any, any>, defaultValues?: any) {
|
|
|
57
57
|
export function makeMemoryStoreInt<Id extends string, PM extends PersistenceModelType<Id>, R = never, E = never>(
|
|
58
58
|
modelName: string,
|
|
59
59
|
namespace: string,
|
|
60
|
-
seed?: Effect<
|
|
60
|
+
seed?: Effect<Iterable<PM>, E, R>,
|
|
61
61
|
_defaultValues?: Partial<PM>
|
|
62
62
|
) {
|
|
63
63
|
return Effect.gen(function*($) {
|
|
@@ -166,7 +166,7 @@ export function makeMemoryStoreInt<Id extends string, PM extends PersistenceMode
|
|
|
166
166
|
export const makeMemoryStore = () => ({
|
|
167
167
|
make: <Id extends string, PM extends PersistenceModelType<Id>, R = never, E = never>(
|
|
168
168
|
modelName: string,
|
|
169
|
-
seed?: Effect<
|
|
169
|
+
seed?: Effect<Iterable<PM>, E, R>,
|
|
170
170
|
config?: StoreConfig<PM>
|
|
171
171
|
) =>
|
|
172
172
|
Effect.gen(function*($) {
|
|
@@ -12,7 +12,7 @@ function makeRedisStore({ prefix }: StorageConfig) {
|
|
|
12
12
|
return {
|
|
13
13
|
make: <Id extends string, PM extends PersistenceModelType<Id>, R = never, E = never>(
|
|
14
14
|
name: string,
|
|
15
|
-
seed?: Effect<
|
|
15
|
+
seed?: Effect<Iterable<PM>, E, R>,
|
|
16
16
|
_config?: StoreConfig<PM>
|
|
17
17
|
) =>
|
|
18
18
|
Effect.gen(function*($) {
|
|
@@ -78,8 +78,8 @@ function makeRedisStore({ prefix }: StorageConfig) {
|
|
|
78
78
|
}
|
|
79
79
|
return s
|
|
80
80
|
})
|
|
81
|
-
}
|
|
82
|
-
})
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
83
|
}
|
|
84
84
|
export function RedisStoreLayer(cfg: StorageConfig) {
|
|
85
85
|
return makeRedisStore(cfg)
|
|
@@ -72,27 +72,27 @@ export interface FilterArgs<PM extends PersistenceModelType<unknown>, U extends
|
|
|
72
72
|
|
|
73
73
|
export type FilterFunc<PM extends PersistenceModelType<unknown>> = <U extends keyof PM = never>(
|
|
74
74
|
args: FilterArgs<PM, U>
|
|
75
|
-
) => Effect<
|
|
75
|
+
) => Effect<(U extends undefined ? PM : Pick<PM, U>)[]>
|
|
76
76
|
|
|
77
77
|
export interface Store<PM extends PersistenceModelType<Id>, Id> {
|
|
78
|
-
all: Effect<
|
|
78
|
+
all: Effect<PM[]>
|
|
79
79
|
filter: FilterFunc<PM>
|
|
80
80
|
/** @deprecated */
|
|
81
81
|
filterJoinSelect: <T extends object>(
|
|
82
82
|
filter: FilterJoinSelect
|
|
83
|
-
) => Effect<
|
|
84
|
-
find: (id: Id) => Effect<
|
|
85
|
-
set: (e: PM) => Effect<
|
|
83
|
+
) => Effect<(T & { _rootId: string })[]>
|
|
84
|
+
find: (id: Id) => Effect<Option<PM>>
|
|
85
|
+
set: (e: PM) => Effect<PM, OptimisticConcurrencyException>
|
|
86
86
|
batchSet: (
|
|
87
87
|
items: NonEmptyReadonlyArray<PM>
|
|
88
|
-
) => Effect<
|
|
88
|
+
) => Effect<NonEmptyReadonlyArray<PM>, OptimisticConcurrencyException>
|
|
89
89
|
bulkSet: (
|
|
90
90
|
items: NonEmptyReadonlyArray<PM>
|
|
91
|
-
) => Effect<
|
|
91
|
+
) => Effect<NonEmptyReadonlyArray<PM>, OptimisticConcurrencyException>
|
|
92
92
|
/**
|
|
93
93
|
* Requires the PM type, not Id, because various stores may need to calculate e.g partition keys.
|
|
94
94
|
*/
|
|
95
|
-
remove: (e: PM) => Effect<
|
|
95
|
+
remove: (e: PM) => Effect<void>
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
/**
|
|
@@ -102,9 +102,9 @@ export interface Store<PM extends PersistenceModelType<Id>, Id> {
|
|
|
102
102
|
export class StoreMaker extends TagClass<StoreMaker, {
|
|
103
103
|
make: <PM extends PersistenceModelType<Id>, Id extends string, R = never, E = never>(
|
|
104
104
|
name: string,
|
|
105
|
-
seed?: Effect<
|
|
105
|
+
seed?: Effect<Iterable<PM>, E, R>,
|
|
106
106
|
config?: StoreConfig<PM>
|
|
107
|
-
) => Effect<
|
|
107
|
+
) => Effect<Store<PM, Id>, E, R>
|
|
108
108
|
}>() {
|
|
109
109
|
}
|
|
110
110
|
|
|
@@ -10,10 +10,10 @@ import { codeFilter3_ } from "./codeFilter.js"
|
|
|
10
10
|
export const makeETag = <E extends PersistenceModelType<Id>, Id extends string>(
|
|
11
11
|
{ _etag, ...e }: E
|
|
12
12
|
): E =>
|
|
13
|
-
({
|
|
13
|
+
(({
|
|
14
14
|
...e,
|
|
15
15
|
_etag: objectHash(e)
|
|
16
|
-
}) as any
|
|
16
|
+
}) as any)
|
|
17
17
|
export const makeUpdateETag =
|
|
18
18
|
(type: string) => <E extends PersistenceModelType<Id>, Id extends string>(e: E, current: Option<E>) =>
|
|
19
19
|
Effect.gen(function*($) {
|
|
@@ -27,8 +27,8 @@ const setup = (type: string, indexingPolicy: IndexingPolicy) =>
|
|
|
27
27
|
export function createContext<TKey extends string, EA, A extends DBRecord<TKey>>() {
|
|
28
28
|
return <REncode, RDecode, EDecode>(
|
|
29
29
|
type: string,
|
|
30
|
-
encode: (record: A) => Effect<
|
|
31
|
-
decode: (d: EA) => Effect<
|
|
30
|
+
encode: (record: A) => Effect<EA, never, REncode>,
|
|
31
|
+
decode: (d: EA) => Effect<A, EDecode, RDecode>,
|
|
32
32
|
// schemaVersion: string,
|
|
33
33
|
indexes: IndexingPolicy
|
|
34
34
|
) => {
|
|
@@ -144,5 +144,5 @@ WHERE (
|
|
|
144
144
|
return { version, data: record } as CachedRecord<A>
|
|
145
145
|
})
|
|
146
146
|
}
|
|
147
|
-
}
|
|
147
|
+
};
|
|
148
148
|
}
|
|
@@ -12,8 +12,8 @@ import type { Version } from "./simpledb.js"
|
|
|
12
12
|
export function createContext<TKey extends string, EA, A extends DBRecord<TKey>>() {
|
|
13
13
|
return <REncode, RDecode, EDecode>(
|
|
14
14
|
type: string,
|
|
15
|
-
encode: (record: A) => Effect<
|
|
16
|
-
decode: (d: EA) => Effect<
|
|
15
|
+
encode: (record: A) => Effect<EA, never, REncode>,
|
|
16
|
+
decode: (d: EA) => Effect<A, EDecode, RDecode>,
|
|
17
17
|
schemaVersion: string,
|
|
18
18
|
makeIndexKey: (r: A) => Index,
|
|
19
19
|
dir = "./data.js"
|
|
@@ -143,7 +143,7 @@ export function createContext<TKey extends string, EA, A extends DBRecord<TKey>>
|
|
|
143
143
|
function getIdxName(type: string, id: string) {
|
|
144
144
|
return `${dir}/v${schemaVersion}.${getIndexName(type, id)}.json`
|
|
145
145
|
}
|
|
146
|
-
}
|
|
146
|
+
};
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
function lockFile(fileName: string) {
|
|
@@ -14,8 +14,8 @@ const parseSDB = SerializedDBRecord.decodeUnknown
|
|
|
14
14
|
export function createContext<TKey extends string, EA, A extends DBRecord<TKey>>() {
|
|
15
15
|
return <REncode, RDecode, EDecode>(
|
|
16
16
|
type: string,
|
|
17
|
-
encode: (record: A) => Effect<
|
|
18
|
-
decode: (d: EA) => Effect<
|
|
17
|
+
encode: (record: A) => Effect<EA, never, REncode>,
|
|
18
|
+
decode: (d: EA) => Effect<A, EDecode, RDecode>
|
|
19
19
|
) => {
|
|
20
20
|
return {
|
|
21
21
|
find: simpledb.find(find, decode, type),
|
|
@@ -69,7 +69,7 @@ export function createContext<TKey extends string, EA, A extends DBRecord<TKey>>
|
|
|
69
69
|
.flatMap((serialised) => storage.set(getRecordName(type, record.id), serialised))
|
|
70
70
|
.map(() => ({ version, data: record } as CachedRecord<A>))
|
|
71
71
|
}
|
|
72
|
-
}
|
|
72
|
+
};
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
function bogusLock() {
|
|
@@ -18,8 +18,8 @@ const setup = (type: string, indexes: IndexDescription[]) =>
|
|
|
18
18
|
export function createContext<TKey extends string, EA, A extends DBRecord<TKey>>() {
|
|
19
19
|
return <REncode, RDecode, EDecode>(
|
|
20
20
|
type: string,
|
|
21
|
-
encode: (record: A) => Effect<
|
|
22
|
-
decode: (d: EA) => Effect<
|
|
21
|
+
encode: (record: A) => Effect<EA, never, REncode>,
|
|
22
|
+
decode: (d: EA) => Effect<A, EDecode, RDecode>,
|
|
23
23
|
// schemaVersion: string,
|
|
24
24
|
indexes: IndexDescription[]
|
|
25
25
|
) => {
|
|
@@ -102,5 +102,5 @@ export function createContext<TKey extends string, EA, A extends DBRecord<TKey>>
|
|
|
102
102
|
return { version, data: record } as CachedRecord<A>
|
|
103
103
|
})
|
|
104
104
|
}
|
|
105
|
-
}
|
|
105
|
+
};
|
|
106
106
|
}
|
|
@@ -13,8 +13,8 @@ const ttl = 10 * 1000
|
|
|
13
13
|
export function createContext<TKey extends string, EA, A extends DBRecord<TKey>>() {
|
|
14
14
|
return <REncode, RDecode, EDecode>(
|
|
15
15
|
type: string,
|
|
16
|
-
encode: (record: A) => Effect<
|
|
17
|
-
decode: (d: EA) => Effect<
|
|
16
|
+
encode: (record: A) => Effect<EA, never, REncode>,
|
|
17
|
+
decode: (d: EA) => Effect<A, EDecode, RDecode>,
|
|
18
18
|
schemaVersion: string,
|
|
19
19
|
makeIndexKey: (r: A) => Index
|
|
20
20
|
) => {
|
|
@@ -166,13 +166,13 @@ export function createContext<TKey extends string, EA, A extends DBRecord<TKey>>
|
|
|
166
166
|
function getIdxLockKey(index: Index) {
|
|
167
167
|
return `v${schemaVersion}.locks.${getIndexName(type, index.doc)}_${index.key}`
|
|
168
168
|
}
|
|
169
|
-
}
|
|
169
|
+
};
|
|
170
170
|
|
|
171
171
|
function hmSetRec(key: string, val: RedisSerializedDBRecord) {
|
|
172
172
|
const enc = RedisSerializedDBRecord.encodeSync(val)
|
|
173
173
|
return RedisClient.flatMap(({ client }) =>
|
|
174
174
|
Effect
|
|
175
|
-
.async<
|
|
175
|
+
.async<void, ConnectionException>((res) => {
|
|
176
176
|
client.hmset(
|
|
177
177
|
key,
|
|
178
178
|
"version",
|
|
@@ -188,7 +188,7 @@ export function createContext<TKey extends string, EA, A extends DBRecord<TKey>>
|
|
|
188
188
|
)
|
|
189
189
|
})
|
|
190
190
|
.uninterruptible
|
|
191
|
-
)
|
|
191
|
+
);
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
194
|
|
|
@@ -34,7 +34,8 @@ export class SerializedDBRecord extends S.Class<SerializedDBRecord>()({
|
|
|
34
34
|
}) {}
|
|
35
35
|
|
|
36
36
|
// unknown -> string -> SDB?
|
|
37
|
-
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
38
|
+
export function makeSerialisedDBRecord(s: Schema<any>) {
|
|
38
39
|
return S.struct({
|
|
39
40
|
version: S.number,
|
|
40
41
|
timestamp: S.Date,
|
|
@@ -74,8 +75,8 @@ export function makeMap<TKey, T>() {
|
|
|
74
75
|
|
|
75
76
|
export interface EffectMap<TKey, T> {
|
|
76
77
|
[Symbol.iterator](): IterableIterator<[TKey, T]>
|
|
77
|
-
find: (k: TKey) => Effect<
|
|
78
|
-
set: (k: TKey, v: T) => Effect<
|
|
78
|
+
find: (k: TKey) => Effect<Option<T>>
|
|
79
|
+
set: (k: TKey, v: T) => Effect<void>
|
|
79
80
|
}
|
|
80
81
|
|
|
81
82
|
// export function encodeOnlyWhenStrictMatch<A, E>(
|
|
@@ -26,19 +26,19 @@ export function makeLiveRecordCache() {
|
|
|
26
26
|
export interface RecordCache extends ReturnType<typeof makeLiveRecordCache> {}
|
|
27
27
|
|
|
28
28
|
// module tag
|
|
29
|
-
export const RecordCache =
|
|
29
|
+
export const RecordCache = GenericTag<RecordCache>("@services/RecordCache")
|
|
30
30
|
|
|
31
31
|
export const LiveRecordCache = Effect.sync(() => makeLiveRecordCache()).toLayer(RecordCache)
|
|
32
32
|
|
|
33
|
-
const getM = <T>(type: string) => <R, E, A>(eff: (m: EffectMap<string, CachedRecord<T>>) => Effect<
|
|
33
|
+
const getM = <T>(type: string) => <R, E, A>(eff: (m: EffectMap<string, CachedRecord<T>>) => Effect<A, E, R>) =>
|
|
34
34
|
Effect.gen(function*($) {
|
|
35
35
|
const { get } = yield* $(RecordCache)
|
|
36
36
|
return yield* $(get<T>(type).flatMap(eff))
|
|
37
37
|
})
|
|
38
38
|
|
|
39
39
|
export function find<R, RDecode, EDecode, E, EA, A>(
|
|
40
|
-
tryRead: (id: string) => Effect<
|
|
41
|
-
decode: (d: EA) => Effect<
|
|
40
|
+
tryRead: (id: string) => Effect<Option<CachedRecord<EA>>, E, R>,
|
|
41
|
+
decode: (d: EA) => Effect<A, EDecode, RDecode>,
|
|
42
42
|
type: string
|
|
43
43
|
) {
|
|
44
44
|
const getCache = getM<A>(type)
|
|
@@ -63,7 +63,7 @@ export function find<R, RDecode, EDecode, E, EA, A>(
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
export function storeDirectly<R, E, TKey extends string, A extends DBRecord<TKey>>(
|
|
66
|
-
save: (r: A, version: Option<Version>) => Effect<
|
|
66
|
+
save: (r: A, version: Option<Version>) => Effect<CachedRecord<A>, E, R>,
|
|
67
67
|
type: string
|
|
68
68
|
) {
|
|
69
69
|
const getCache = getM<A>(type)
|
|
@@ -79,9 +79,9 @@ export function storeDirectly<R, E, TKey extends string, A extends DBRecord<TKey
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
export function store<R, E, R2, E2, TKey extends string, EA, A extends DBRecord<TKey>>(
|
|
82
|
-
tryRead: (id: string) => Effect<
|
|
83
|
-
save: (r: A, version: Option<Version>) => Effect<
|
|
84
|
-
lock: (id: string) => Effect<R2 | Scope
|
|
82
|
+
tryRead: (id: string) => Effect<Option<CachedRecord<EA>>, E, R>,
|
|
83
|
+
save: (r: A, version: Option<Version>) => Effect<CachedRecord<A>, E, R>,
|
|
84
|
+
lock: (id: string) => Effect<unknown, E2, R2 | Scope>,
|
|
85
85
|
type: string
|
|
86
86
|
) {
|
|
87
87
|
const getCache = getM<A>(type)
|
package/dist/RequestContext.d.ts
CHANGED
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
import { useClassFeaturesForSchema, TaggedClass, NonEmptyString255, struct, literal } from "@effect-app/prelude/schema";
|
|
2
2
|
import { S } from "@effect-app/prelude";
|
|
3
|
-
declare const RequestContextParent_base: S.EnhancedClass<
|
|
4
|
-
readonly _tag: "RequestContext";
|
|
5
|
-
readonly id: string;
|
|
6
|
-
readonly name: string;
|
|
7
|
-
readonly locale: "en" | "de";
|
|
8
|
-
readonly createdAt: string;
|
|
9
|
-
readonly userProfile?: {
|
|
10
|
-
readonly sub: string;
|
|
11
|
-
} | undefined;
|
|
12
|
-
}, {
|
|
3
|
+
declare const RequestContextParent_base: S.EnhancedClass<{
|
|
13
4
|
readonly _tag: "RequestContext";
|
|
14
5
|
readonly id: S.NonEmptyString255;
|
|
15
6
|
readonly name: string & S.NonEmptyString255Brand;
|
|
@@ -19,6 +10,15 @@ declare const RequestContextParent_base: S.EnhancedClass<never, {
|
|
|
19
10
|
readonly sub: string & import("@effect-app/prelude/ids").UserProfileIdBrand;
|
|
20
11
|
} | undefined;
|
|
21
12
|
}, {
|
|
13
|
+
readonly _tag: "RequestContext";
|
|
14
|
+
readonly id: string;
|
|
15
|
+
readonly name: string;
|
|
16
|
+
readonly locale: "en" | "de";
|
|
17
|
+
readonly createdAt: string;
|
|
18
|
+
readonly userProfile?: {
|
|
19
|
+
readonly sub: string;
|
|
20
|
+
} | undefined;
|
|
21
|
+
}, never, {
|
|
22
22
|
readonly name: string & S.NonEmptyString255Brand;
|
|
23
23
|
readonly locale: "en" | "de";
|
|
24
24
|
readonly userProfile?: {
|
|
@@ -27,27 +27,39 @@ declare const RequestContextParent_base: S.EnhancedClass<never, {
|
|
|
27
27
|
readonly id?: S.NonEmptyString255;
|
|
28
28
|
readonly createdAt?: Date;
|
|
29
29
|
}, RequestContextParent, {
|
|
30
|
-
id: S.WithDefaults<S.Schema<
|
|
30
|
+
id: S.WithDefaults<S.Schema<S.NonEmptyString255, string, never> & {
|
|
31
31
|
make: () => S.NonEmptyString255;
|
|
32
|
-
withDefault: S.Schema<
|
|
33
|
-
}> & S.Schema<
|
|
32
|
+
withDefault: S.Schema<S.NonEmptyString255, string, never> & S.ConstructorPropertyDescriptor<S.NonEmptyString255, string, never>;
|
|
33
|
+
}> & S.Schema<S.NonEmptyString255, string, never> & {
|
|
34
34
|
make: () => S.NonEmptyString255;
|
|
35
|
-
withDefault: S.Schema<
|
|
35
|
+
withDefault: S.Schema<S.NonEmptyString255, string, never> & S.ConstructorPropertyDescriptor<S.NonEmptyString255, string, never>;
|
|
36
36
|
};
|
|
37
|
-
name: S.WithDefaults<S.Schema<
|
|
38
|
-
userProfile: S.PropertySignature<
|
|
37
|
+
name: S.WithDefaults<S.Schema<string & S.NonEmptyString255Brand, string, never>> & S.Schema<string & S.NonEmptyString255Brand, string, never>;
|
|
38
|
+
userProfile: S.PropertySignature<{
|
|
39
39
|
readonly sub: string;
|
|
40
40
|
} | undefined, true, {
|
|
41
41
|
readonly sub: string & import("@effect-app/prelude/ids").UserProfileIdBrand;
|
|
42
|
-
} | undefined, true>;
|
|
43
|
-
locale: S.Schema<
|
|
42
|
+
} | undefined, true, never>;
|
|
43
|
+
locale: S.Schema<"en" | "de", "en" | "de", never> & {
|
|
44
44
|
literals: ["en", "de"];
|
|
45
45
|
};
|
|
46
|
-
createdAt: S.Schema<
|
|
47
|
-
}, {}>;
|
|
46
|
+
createdAt: S.Schema<Date, string, never> & S.ConstructorPropertyDescriptor<Date, string, never>;
|
|
47
|
+
}, {}, {}>;
|
|
48
48
|
export declare class RequestContextParent extends RequestContextParent_base {
|
|
49
49
|
}
|
|
50
|
-
declare const RequestContext_base: S.EnhancedClass<
|
|
50
|
+
declare const RequestContext_base: S.EnhancedClass<{
|
|
51
|
+
readonly _tag: "RequestContext";
|
|
52
|
+
readonly id: S.NonEmptyString255;
|
|
53
|
+
readonly name: string & S.NonEmptyString255Brand;
|
|
54
|
+
readonly locale: "en" | "de";
|
|
55
|
+
readonly createdAt: Date;
|
|
56
|
+
readonly rootId: S.NonEmptyString255;
|
|
57
|
+
readonly userProfile?: {
|
|
58
|
+
readonly sub: string & import("@effect-app/prelude/ids").UserProfileIdBrand;
|
|
59
|
+
} | undefined;
|
|
60
|
+
readonly parent?: RequestContextParent | undefined;
|
|
61
|
+
readonly namespace?: (string & S.NonEmptyString255Brand) | undefined;
|
|
62
|
+
}, {
|
|
51
63
|
readonly _tag: "RequestContext";
|
|
52
64
|
readonly id: string;
|
|
53
65
|
readonly name: string;
|
|
@@ -68,19 +80,7 @@ declare const RequestContext_base: S.EnhancedClass<never, {
|
|
|
68
80
|
} | undefined;
|
|
69
81
|
} | undefined;
|
|
70
82
|
readonly namespace?: string | undefined;
|
|
71
|
-
}, {
|
|
72
|
-
readonly _tag: "RequestContext";
|
|
73
|
-
readonly id: S.NonEmptyString255;
|
|
74
|
-
readonly name: string & S.NonEmptyString255Brand;
|
|
75
|
-
readonly locale: "en" | "de";
|
|
76
|
-
readonly createdAt: Date;
|
|
77
|
-
readonly rootId: S.NonEmptyString255;
|
|
78
|
-
readonly userProfile?: {
|
|
79
|
-
readonly sub: string & import("@effect-app/prelude/ids").UserProfileIdBrand;
|
|
80
|
-
} | undefined;
|
|
81
|
-
readonly parent?: RequestContextParent | undefined;
|
|
82
|
-
readonly namespace?: (string & S.NonEmptyString255Brand) | undefined;
|
|
83
|
-
}, {
|
|
83
|
+
}, never, {
|
|
84
84
|
readonly name: string & S.NonEmptyString255Brand;
|
|
85
85
|
readonly locale: "en" | "de";
|
|
86
86
|
readonly userProfile?: {
|
|
@@ -92,15 +92,15 @@ declare const RequestContext_base: S.EnhancedClass<never, {
|
|
|
92
92
|
readonly createdAt?: Date;
|
|
93
93
|
readonly rootId?: S.NonEmptyString255;
|
|
94
94
|
}, RequestContext, {
|
|
95
|
-
id: S.Schema<
|
|
96
|
-
rootId: S.WithDefaults<S.Schema<
|
|
95
|
+
id: S.Schema<S.NonEmptyString255, string, never> & S.ConstructorPropertyDescriptor<S.NonEmptyString255, string, never>;
|
|
96
|
+
rootId: S.WithDefaults<S.Schema<S.NonEmptyString255, string, never> & {
|
|
97
97
|
make: () => S.NonEmptyString255;
|
|
98
|
-
withDefault: S.Schema<
|
|
99
|
-
}> & S.Schema<
|
|
98
|
+
withDefault: S.Schema<S.NonEmptyString255, string, never> & S.ConstructorPropertyDescriptor<S.NonEmptyString255, string, never>;
|
|
99
|
+
}> & S.Schema<S.NonEmptyString255, string, never> & {
|
|
100
100
|
make: () => S.NonEmptyString255;
|
|
101
|
-
withDefault: S.Schema<
|
|
101
|
+
withDefault: S.Schema<S.NonEmptyString255, string, never> & S.ConstructorPropertyDescriptor<S.NonEmptyString255, string, never>;
|
|
102
102
|
};
|
|
103
|
-
parent: S.PropertySignature<
|
|
103
|
+
parent: S.PropertySignature<{
|
|
104
104
|
readonly _tag: "RequestContext";
|
|
105
105
|
readonly id: string;
|
|
106
106
|
readonly name: string;
|
|
@@ -109,19 +109,19 @@ declare const RequestContext_base: S.EnhancedClass<never, {
|
|
|
109
109
|
readonly userProfile?: {
|
|
110
110
|
readonly sub: string;
|
|
111
111
|
} | undefined;
|
|
112
|
-
} | undefined, true, RequestContextParent | undefined, true>;
|
|
113
|
-
namespace: S.PropertySignature<
|
|
114
|
-
name: S.WithDefaults<S.Schema<
|
|
115
|
-
userProfile: S.PropertySignature<
|
|
112
|
+
} | undefined, true, RequestContextParent | undefined, true, never>;
|
|
113
|
+
namespace: S.PropertySignature<string | undefined, true, (string & S.NonEmptyString255Brand) | undefined, true, never>;
|
|
114
|
+
name: S.WithDefaults<S.Schema<string & S.NonEmptyString255Brand, string, never>> & S.Schema<string & S.NonEmptyString255Brand, string, never>;
|
|
115
|
+
userProfile: S.PropertySignature<{
|
|
116
116
|
readonly sub: string;
|
|
117
117
|
} | undefined, true, {
|
|
118
118
|
readonly sub: string & import("@effect-app/prelude/ids").UserProfileIdBrand;
|
|
119
|
-
} | undefined, true>;
|
|
120
|
-
locale: S.Schema<
|
|
119
|
+
} | undefined, true, never>;
|
|
120
|
+
locale: S.Schema<"en" | "de", "en" | "de", never> & {
|
|
121
121
|
literals: ["en", "de"];
|
|
122
122
|
};
|
|
123
|
-
createdAt: S.Schema<
|
|
124
|
-
}, {}>;
|
|
123
|
+
createdAt: S.Schema<Date, string, never> & S.ConstructorPropertyDescriptor<Date, string, never>;
|
|
124
|
+
}, {}, {}>;
|
|
125
125
|
/**
|
|
126
126
|
* @tsplus type RequestContext
|
|
127
127
|
* @tsplus companion RequestContext.Ops
|
package/dist/RequestContext.js
CHANGED
|
@@ -6,13 +6,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
var RequestContext_1;
|
|
8
8
|
import * as tsplus_module_1 from "@effect-app/prelude/schema";
|
|
9
|
-
import * as tsplus_module_2 from "@effect/schema/Schema";
|
|
10
9
|
import { S } from "@effect-app/prelude";
|
|
11
10
|
import { RequestId, UserProfileId } from "@effect-app/prelude/ids";
|
|
12
11
|
let RequestContextParent = class RequestContextParent extends tsplus_module_1.TaggedClass()("RequestContext", {
|
|
13
12
|
id: RequestId,
|
|
14
13
|
name: tsplus_module_1.NonEmptyString255,
|
|
15
|
-
userProfile:
|
|
14
|
+
userProfile: S.optional(tsplus_module_1.struct({ sub: UserProfileId })),
|
|
16
15
|
locale: tsplus_module_1.literal("en", "de"),
|
|
17
16
|
createdAt: S.Date.withDefault
|
|
18
17
|
}) {
|
|
@@ -29,8 +28,8 @@ let RequestContext = RequestContext_1 = class RequestContext extends tsplus_modu
|
|
|
29
28
|
...RequestContextParent.omit("id"),
|
|
30
29
|
id: RequestId.withDefault,
|
|
31
30
|
rootId: RequestId,
|
|
32
|
-
parent:
|
|
33
|
-
namespace:
|
|
31
|
+
parent: S.optional(RequestContextParent),
|
|
32
|
+
namespace: S.optional(tsplus_module_1.NonEmptyString255)
|
|
34
33
|
// ...RequestContextParent.omit("id").extend({
|
|
35
34
|
// id: RequestId.withDefault,
|
|
36
35
|
// rootId: RequestId,
|
|
@@ -61,4 +60,4 @@ RequestContext = RequestContext_1 = __decorate([
|
|
|
61
60
|
tsplus_module_1.useClassFeaturesForSchema
|
|
62
61
|
], RequestContext);
|
|
63
62
|
export { RequestContext };
|
|
64
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
63
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiUmVxdWVzdENvbnRleHQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9fc3JjL1JlcXVlc3RDb250ZXh0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7O0FBQUEsT0FBTyxFQUFFLENBQUMsRUFBRSxNQUFNLHFCQUFxQixDQUFBO0FBQ3ZDLE9BQU8sRUFBRSxTQUFTLEVBQUUsYUFBYSxFQUFFLE1BQU0seUJBQXlCLENBQUE7QUFHM0QsSUFBTSxvQkFBb0IsR0FBMUIsTUFBTSxvQkFBcUIsU0FBUSxnQkFBQSxXQUFXLEVBRWxELENBQUMsZ0JBQWdCLEVBQUU7SUFDcEIsRUFBRSxFQUFFLFNBQVM7SUFDYixJQUFJLGtCQUFFLGlCQUFpQjtJQUN2QixXQUFXLEVBQUUsQ0FBQyxDQUFDLFFBQVEsQ0FBQyxnQkFBQSxNQUFNLENBQUMsRUFBRSxHQUFHLEVBQUUsYUFBYSxFQUFFLENBQUMsQ0FBQztJQUN2RCxNQUFNLEVBQUUsZ0JBQUEsT0FBTyxDQUFDLElBQUksRUFBRSxJQUFJLENBQUM7SUFDM0IsU0FBUyxFQUFFLENBQUMsQ0FBQyxJQUFJLENBQUMsV0FBVztDQUM5QixDQUFDO0NBQUcsQ0FBQTtBQVJRLG9CQUFvQjtvQkFEaEMseUJBQXlCO0dBQ2Isb0JBQW9CLENBUTVCOztBQUVMOzs7R0FHRztBQUVJLElBQU0sY0FBYyxzQkFBcEIsTUFBTSxjQUFlLFNBQVEsZ0JBQUEsV0FBVyxFQUU1QyxDQUFDLGdCQUFnQixFQUFFO0lBQ3BCLEdBQUcsb0JBQW9CLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQztJQUNsQyxFQUFFLEVBQUUsU0FBUyxDQUFDLFdBQVc7SUFDekIsTUFBTSxFQUFFLFNBQVM7SUFDakIsTUFBTSxFQUFFLENBQUMsQ0FBQyxRQUFRLENBQUMsb0JBQW9CLENBQUM7SUFDeEMsU0FBUyxFQUFFLENBQUMsQ0FBQyxRQUFRLGlCQUFDLGlCQUFpQixDQUFDO0lBQ3hDLDhDQUE4QztJQUM5QywrQkFBK0I7SUFDL0IsdUJBQXVCO0lBQ3ZCLDZDQUE2QztJQUM3Qyw0Q0FBNEM7SUFDNUMsS0FBSztDQUNOLENBQUM7SUFDQSw2Q0FBNkM7SUFDN0MsTUFBTSxDQUFDLE9BQU8sQ0FFWixNQUFzQixFQUN0QixPQUE4RDtRQUU5RCxPQUFPLElBQUksZ0JBQWMsQ0FBQztZQUN4QixTQUFTLEVBQUUsTUFBTSxFQUFFLFNBQVM7WUFDNUIsR0FBRyxPQUFPO1lBQ1YsTUFBTSxFQUFFLE1BQU0sQ0FBQyxNQUFNO1lBQ3JCLE1BQU07U0FDUCxDQUFDLENBQUE7SUFDSixDQUFDO0lBRUQsTUFBTSxDQUFDLFlBQVksQ0FBYSxJQUFvQjtRQUNsRCxPQUFPO1lBQ0wsYUFBYSxFQUFFLElBQUksQ0FBQyxJQUFJO1lBQ3hCLE1BQU0sRUFBRSxJQUFJLENBQUMsTUFBTTtZQUNuQixHQUFHLENBQUMsSUFBSSxDQUFDLE1BQU07Z0JBQ2IsQ0FBQyxDQUFDLEVBQUUsbUJBQW1CLEVBQUUsSUFBSSxDQUFDLE1BQU0sQ0FBQyxJQUFJLEVBQUUsWUFBWSxFQUFFLElBQUksQ0FBQyxNQUFNLENBQUMsTUFBTSxFQUFFO2dCQUM3RSxDQUFDLENBQUMsRUFBRSxDQUFDO1NBQ1IsQ0FBQTtJQUNILENBQUM7Q0FDRixDQUFBO0FBdENZLGNBQWM7b0JBRDFCLHlCQUF5QjtHQUNiLGNBQWMsQ0FzQzFCIn0=
|
package/dist/_ext/Array.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { NotFoundError } from "../errors.js";
|
|
|
10
10
|
*/
|
|
11
11
|
export declare function getFirstById_<A extends {
|
|
12
12
|
id: unknown;
|
|
13
|
-
}, Type extends string>(a: Iterable<A>, id: A["id"], type: Type): import("effect/Effect").Effect<
|
|
13
|
+
}, Type extends string>(a: Iterable<A>, id: A["id"], type: Type): import("effect/Effect").Effect<A, NotFoundError<Type>, never>;
|
|
14
14
|
/**
|
|
15
15
|
* @tsplus fluent Object.Ops inspect
|
|
16
16
|
* @tsplus location "@effect-app/infra/_ext/Array"
|
package/dist/api/codec.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as S from "@effect-app/prelude/schema";
|
|
2
2
|
export declare function makeCodec<From, To extends {
|
|
3
3
|
id: Id;
|
|
4
|
-
}, Id>(self: S.Schema<
|
|
4
|
+
}, Id>(self: S.Schema<To, From>): readonly [(i: From, overrideOptions?: S.AST.ParseOptions | undefined) => To, (a: To, overrideOptions?: S.AST.ParseOptions | undefined) => From];
|
|
5
5
|
//# sourceMappingURL=codec.d.ts.map
|
package/dist/api/codec.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../_src/api/codec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,4BAA4B,CAAA;AAE/C,wBAAgB,SAAS,CACvB,IAAI,EACJ,EAAE,SAAS;IAAE,EAAE,EAAE,EAAE,CAAA;CAAE,EACrB,EAAE,EACF,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../_src/api/codec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,4BAA4B,CAAA;AAE/C,wBAAgB,SAAS,CACvB,IAAI,EACJ,EAAE,SAAS;IAAE,EAAE,EAAE,EAAE,CAAA;CAAE,EACrB,EAAE,EACF,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,mJAEzB"}
|
package/dist/api/codec.js
CHANGED
|
@@ -2,4 +2,4 @@ import * as S from "@effect-app/prelude/schema";
|
|
|
2
2
|
export function makeCodec(self) {
|
|
3
3
|
return [S.decodeSync(self), S.encodeSync(self)];
|
|
4
4
|
}
|
|
5
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29kZWMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9fc3JjL2FwaS9jb2RlYy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssQ0FBQyxNQUFNLDRCQUE0QixDQUFBO0FBRS9DLE1BQU0sVUFBVSxTQUFTLENBSXZCLElBQXdCO0lBQ3hCLE9BQU8sQ0FBQyxDQUFDLENBQUMsVUFBVSxDQUFDLElBQUksQ0FBQyxFQUFFLENBQUMsQ0FBQyxVQUFVLENBQUMsSUFBSSxDQUFDLENBQVUsQ0FBQTtBQUMxRCxDQUFDIn0=
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Effect } from "effect/Effect";
|
|
2
2
|
import type { SupportedErrors, ValidationError } from "@effect-app/prelude/client/errors";
|
|
3
3
|
import type express from "express";
|
|
4
|
-
export declare function defaultBasicErrorHandler<R>(_req: express.Request, res: express.Response, r2: Effect<
|
|
5
|
-
export declare function defaultErrorHandler<R>(req: express.Request, res: express.Response, r2: Effect<
|
|
4
|
+
export declare function defaultBasicErrorHandler<R>(_req: express.Request, res: express.Response, r2: Effect<void, ValidationError, R>): import("effect/Effect").Effect<void | express.Response<any, Record<string, any>>, never, R>;
|
|
5
|
+
export declare function defaultErrorHandler<R>(req: express.Request, res: express.Response, r2: Effect<void, SupportedErrors, R>): import("effect/Effect").Effect<void | express.Response<any, Record<string, any>>, never, R>;
|
|
6
6
|
//# sourceMappingURL=defaultErrorHandler.d.ts.map
|