@effect-app/infra 0.212.0 → 0.213.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.
Files changed (63) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/_cjs/services/Emailer/Sendgrid.cjs +1 -1
  3. package/_cjs/services/Emailer/Sendgrid.cjs.map +1 -1
  4. package/_cjs/services/Emailer/fake.cjs +2 -2
  5. package/_cjs/services/Emailer/fake.cjs.map +1 -1
  6. package/_cjs/services/Operations/live.cjs +1 -1
  7. package/_cjs/services/Operations/live.cjs.map +1 -1
  8. package/_cjs/services/RepositoryBase.cjs +2 -2
  9. package/_cjs/services/RepositoryBase.cjs.map +1 -1
  10. package/_cjs/services/RequestContextContainer.cjs +1 -1
  11. package/_cjs/services/RequestContextContainer.cjs.map +1 -1
  12. package/_cjs/services/Store/ContextMapContainer.cjs +1 -1
  13. package/_cjs/services/Store/ContextMapContainer.cjs.map +1 -1
  14. package/dist/api/routing/match.d.ts +1 -1
  15. package/dist/api/routing/match.d.ts.map +1 -1
  16. package/dist/logger/shared.d.ts +1 -1
  17. package/dist/logger/shared.d.ts.map +1 -1
  18. package/dist/services/Emailer/Sendgrid.js +2 -2
  19. package/dist/services/Emailer/fake.d.ts +1 -2
  20. package/dist/services/Emailer/fake.d.ts.map +1 -1
  21. package/dist/services/Emailer/fake.js +4 -4
  22. package/dist/services/Emailer/service.d.ts +10 -17
  23. package/dist/services/Emailer/service.d.ts.map +1 -1
  24. package/dist/services/Operations/live.js +2 -2
  25. package/dist/services/Operations/service.d.ts +19 -35
  26. package/dist/services/Operations/service.d.ts.map +1 -1
  27. package/dist/services/QueueMaker/memQueue.d.ts +1 -1
  28. package/dist/services/QueueMaker/sbqueue.d.ts +1 -1
  29. package/dist/services/Repository/ext.d.ts +11 -11
  30. package/dist/services/Repository/ext.d.ts.map +1 -1
  31. package/dist/services/RepositoryBase.d.ts +1 -1
  32. package/dist/services/RepositoryBase.d.ts.map +1 -1
  33. package/dist/services/RepositoryBase.js +2 -2
  34. package/dist/services/RequestContextContainer.d.ts +17 -30
  35. package/dist/services/RequestContextContainer.d.ts.map +1 -1
  36. package/dist/services/RequestContextContainer.js +2 -2
  37. package/dist/services/Store/ContextMapContainer.d.ts +14 -24
  38. package/dist/services/Store/ContextMapContainer.d.ts.map +1 -1
  39. package/dist/services/Store/ContextMapContainer.js +2 -2
  40. package/dist/services/Store/service.d.ts +23 -40
  41. package/dist/services/Store/service.d.ts.map +1 -1
  42. package/package.json +7 -8
  43. package/src/services/Emailer/Sendgrid.ts +1 -1
  44. package/src/services/Emailer/fake.ts +3 -3
  45. package/src/services/Operations/live.ts +1 -1
  46. package/src/services/RepositoryBase.ts +2 -3
  47. package/src/services/RequestContextContainer.ts +8 -6
  48. package/src/services/Store/ContextMapContainer.ts +2 -2
  49. package/test/dist/filterApi.test.d.ts.map +1 -0
  50. package/test/dist/query.test.d.ts.map +1 -0
  51. package/{src/services/Store → test}/filterApi.test.ts +4 -3
  52. package/{src/services → test}/query.test.ts +4 -3
  53. package/tsconfig.json +5 -18
  54. package/tsconfig.json.bak +9 -38
  55. package/tsconfig.src.json +56 -0
  56. package/tsconfig.test.json +32 -0
  57. package/.prettierignore +0 -6
  58. package/_cjs/services/Store/filterApi.test.cjs +0 -171
  59. package/_cjs/services/Store/filterApi.test.cjs.map +0 -1
  60. package/_cjs/services/query.test.cjs +0 -71
  61. package/_cjs/services/query.test.cjs.map +0 -1
  62. package/dist/services/Store/filterApi.test.d.ts.map +0 -1
  63. package/dist/services/query.test.d.ts.map +0 -1
@@ -59,23 +59,16 @@ export interface Store<PM extends PersistenceModelType<Id>, Id> {
59
59
  */
60
60
  remove: (e: PM) => Effect<void>;
61
61
  }
62
- declare const StoreMaker_base: {
63
- new (service: {
64
- make: <PM extends PersistenceModelType<Id>, Id extends string, R = never, E = never>(name: string, seed?: Effect<Iterable<PM>, E, R>, config?: StoreConfig<PM>) => Effect<Store<PM, Id>, E, R>;
65
- }): Readonly<{
66
- make: <PM extends PersistenceModelType<Id>, Id extends string, R = never, E = never>(name: string, seed?: Effect<Iterable<PM>, E, R>, config?: StoreConfig<PM>) => Effect<Store<PM, Id>, E, R>;
67
- }> & import("effect/Context").TagClassShape<"effect-app/StoreMaker", {
68
- make: <PM extends PersistenceModelType<Id>, Id extends string, R = never, E = never>(name: string, seed?: Effect<Iterable<PM>, E, R>, config?: StoreConfig<PM>) => Effect<Store<PM, Id>, E, R>;
69
- }>;
70
- toLayer: <E_1, R_1>(eff: Effect<{
71
- make: <PM extends PersistenceModelType<Id>, Id extends string, R = never, E = never>(name: string, seed?: Effect<Iterable<PM>, E, R> | undefined, config?: StoreConfig<PM> | undefined) => Effect<Store<PM, Id>, E, R>;
72
- }, E_1, R_1>) => import("effect-app").Layer<StoreMaker, E_1, R_1>;
73
- toLayerScoped: <E_1_1, R_1_1>(eff: Effect<{
74
- make: <PM extends PersistenceModelType<Id>, Id extends string, R = never, E = never>(name: string, seed?: Effect<Iterable<PM>, E, R> | undefined, config?: StoreConfig<PM> | undefined) => Effect<Store<PM, Id>, E, R>;
75
- }, E_1_1, R_1_1>) => import("effect-app").Layer<StoreMaker, E_1_1, Exclude<R_1_1, import("effect/Scope").Scope>>;
76
- wrap: (service: {
77
- make: <PM extends PersistenceModelType<Id>, Id extends string, R = never, E = never>(name: string, seed?: Effect<Iterable<PM>, E, R>, config?: StoreConfig<PM>) => Effect<Store<PM, Id>, E, R>;
78
- }) => StoreMaker;
62
+ declare const StoreMaker_base: (abstract new (service: {
63
+ make: <PM extends PersistenceModelType<Id>, Id extends string, R = never, E = never>(name: string, seed?: Effect<Iterable<PM>, E, R>, config?: StoreConfig<PM>) => Effect<Store<PM, Id>, E, R>;
64
+ }) => Readonly<{
65
+ make: <PM extends PersistenceModelType<Id>, Id extends string, R = never, E = never>(name: string, seed?: Effect<Iterable<PM>, E, R>, config?: StoreConfig<PM>) => Effect<Store<PM, Id>, E, R>;
66
+ }> & import("effect/Context").TagClassShape<"effect-app/StoreMaker", {
67
+ make: <PM extends PersistenceModelType<Id>, Id extends string, R = never, E = never>(name: string, seed?: Effect<Iterable<PM>, E, R>, config?: StoreConfig<PM>) => Effect<Store<PM, Id>, E, R>;
68
+ }>) & {
69
+ toLayer: <E_1, R_1>(eff: Effect<Omit<StoreMaker, keyof import("effect/Context").TagClassShape<any, any>>, E_1, R_1>) => import("effect-app").Layer<StoreMaker, E_1, R_1>;
70
+ toLayerScoped: <E_1_1, R_1_1>(eff: Effect<Omit<StoreMaker, keyof import("effect/Context").TagClassShape<any, any>>, E_1_1, R_1_1>) => import("effect-app").Layer<StoreMaker, E_1_1, Exclude<R_1_1, import("effect/Scope").Scope>>;
71
+ of: (service: Omit<StoreMaker, keyof import("effect/Context").TagClassShape<any, any>>) => StoreMaker;
79
72
  } & import("effect/Context").Tag<StoreMaker, StoreMaker> & {} & {
80
73
  use: <X>(body: (_: {
81
74
  make: <PM extends PersistenceModelType<Id>, Id extends string, R = never, E = never>(name: string, seed?: Effect<Iterable<PM>, E, R> | undefined, config?: StoreConfig<PM> | undefined) => Effect<Store<PM, Id>, E, R>;
@@ -91,35 +84,25 @@ export declare const makeContextMap: () => {
91
84
  get: (id: string) => string | undefined;
92
85
  set: (id: string, eTag: string | undefined) => void;
93
86
  };
94
- declare const ContextMap_base: {
95
- new (service: {
96
- get: (id: string) => string | undefined;
97
- set: (id: string, eTag: string | undefined) => void;
98
- }): Readonly<{
99
- get: (id: string) => string | undefined;
100
- set: (id: string, eTag: string | undefined) => void;
101
- }> & import("effect/Context").TagClassShape<"effect-app/ContextMap", {
102
- get: (id: string) => string | undefined;
103
- set: (id: string, eTag: string | undefined) => void;
104
- }>;
87
+ declare const ContextMap_base: (abstract new (service: {
88
+ get: (id: string) => string | undefined;
89
+ set: (id: string, eTag: string | undefined) => void;
90
+ }) => Readonly<{
91
+ get: (id: string) => string | undefined;
92
+ set: (id: string, eTag: string | undefined) => void;
93
+ }> & import("effect/Context").TagClassShape<"effect-app/ContextMap", {
94
+ get: (id: string) => string | undefined;
95
+ set: (id: string, eTag: string | undefined) => void;
96
+ }>) & {
105
97
  toLayer: {
106
98
  (): import("effect-app").Layer<ContextMap, never, never>;
107
- <E_1, R_1>(eff: Effect<{
108
- get: (id: string) => string | undefined;
109
- set: (id: string, eTag: string | undefined) => void;
110
- }, E_1, R_1>): import("effect-app").Layer<ContextMap, E_1, R_1>;
99
+ <E_1, R_1>(eff: Effect<Omit<ContextMap, keyof import("effect/Context").TagClassShape<any, any>>, E_1, R_1>): import("effect-app").Layer<ContextMap, E_1, R_1>;
111
100
  };
112
101
  toLayerScoped: {
113
102
  (): import("effect-app").Layer<ContextMap, never, never>;
114
- <E_2, R_2>(eff: Effect<{
115
- get: (id: string) => string | undefined;
116
- set: (id: string, eTag: string | undefined) => void;
117
- }, E_2, R_2>): import("effect-app").Layer<ContextMap, E_2, Exclude<R_2, import("effect/Scope").Scope>>;
103
+ <E_2, R_2>(eff: Effect<import("effect/Context").TagClassShape<any, any>, E_2, R_2>): import("effect-app").Layer<ContextMap, E_2, Exclude<R_2, import("effect/Scope").Scope>>;
118
104
  };
119
- wrap: (service: {
120
- get: (id: string) => string | undefined;
121
- set: (id: string, eTag: string | undefined) => void;
122
- }) => ContextMap;
105
+ of: (service: import("effect/Context").TagClassShape<any, any>) => ContextMap;
123
106
  make: Effect<ContextMap, never, never>;
124
107
  } & import("effect/Context").Tag<ContextMap, ContextMap> & {
125
108
  get: (id: string) => Effect<string | undefined, never, ContextMap>;
@@ -1 +1 @@
1
- {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/services/Store/service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAEvE,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAA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AAE,MAAM,CAAA;CACf"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effect-app/infra",
3
- "version": "0.212.0",
3
+ "version": "0.213.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "dependencies": {
@@ -20,15 +20,15 @@
20
20
  "redlock": "^4.2.0",
21
21
  "@effect-app/core": "0.151.0",
22
22
  "@effect-app/fluent-extensions": "0.144.0",
23
- "@effect-app/infra-adapters": "0.138.0",
24
- "effect-app": "0.182.0",
25
- "@effect-app/schema": "0.204.0"
23
+ "@effect-app/infra-adapters": "0.138.2",
24
+ "@effect-app/schema": "0.204.0",
25
+ "effect-app": "0.183.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@babel/cli": "^7.23.9",
29
29
  "@sentry/node": "^7.105.0",
30
30
  "@types/express": "^4.17.21",
31
- "@types/node": "~20.11.24",
31
+ "@types/node": "~20.11.25",
32
32
  "@types/proper-lockfile": "^4.1.4",
33
33
  "@types/redis": "^2.8.32",
34
34
  "@types/redlock": "^4.0.7",
@@ -38,9 +38,8 @@
38
38
  "mongodb": "6.4.0",
39
39
  "redis": "^3.1.2",
40
40
  "ts-node": "^10.9.2",
41
- "typescript": "^5.4.1-rc",
42
- "vitest": "^1.3.1",
43
- "@effect-app/compiler": "0.72.0"
41
+ "typescript": "^5.4.2",
42
+ "vitest": "^1.3.1"
44
43
  },
45
44
  "peerDependencies": {
46
45
  "express": "^4.18.3",
@@ -10,7 +10,7 @@ const makeSendgrid = ({ apiKey, defaultFrom, defaultReplyTo, realMail, subjectPr
10
10
  Effect.sync(() => {
11
11
  sgMail.setApiKey(Secret.value(apiKey))
12
12
 
13
- return new Emailer({
13
+ return Emailer.of({
14
14
  sendMail(msg_: EmailMsgOptionalFrom) {
15
15
  return Effect.gen(function*($) {
16
16
  const msg: EmailMsg = dropUndefinedT({
@@ -1,11 +1,11 @@
1
- import { Effect, Layer } from "effect-app"
1
+ import { Effect } from "effect-app"
2
2
  import { pretty } from "effect-app/utils"
3
3
  import { Emailer } from "./service.js"
4
4
 
5
5
  const makeFake = Effect
6
6
  .logDebug("FAKE Emailer Service enabled")
7
7
  .pipe(Effect.map(() =>
8
- new Emailer({
8
+ Emailer.of({
9
9
  sendMail(msg) {
10
10
  return Effect
11
11
  .logDebug(`Fake send mail`)
@@ -17,4 +17,4 @@ const makeFake = Effect
17
17
  /**
18
18
  * @tsplus static Emailer.Ops Fake
19
19
  */
20
- export const FakeSendgrid = Layer.effect(Emailer, makeFake)
20
+ export const FakeSendgrid = Emailer.toLayer(makeFake)
@@ -76,7 +76,7 @@ const make = Effect.sync(() => {
76
76
  ops.set(id, copy(_.value, { updatedAt: new Date(), progress }))
77
77
  }))
78
78
  }
79
- return new Operations({
79
+ return Operations.of({
80
80
  cleanup,
81
81
  register: Effect.tap(
82
82
  makeOp,
@@ -557,9 +557,8 @@ export function makeRepo<
557
557
  ? Effect.andThen(
558
558
  eff,
559
559
  flow(
560
- toNonEmptyArray,
561
- Effect.mapError(() => new NotFoundError({ id: "query", /* TODO */ type: name })),
562
- Effect.map((_) => _[0])
560
+ ReadonlyArray.head,
561
+ Effect.mapError(() => new NotFoundError({ id: "query", /* TODO */ type: name }))
563
562
  )
564
563
  )
565
564
  : a.ttype === "count"
@@ -9,11 +9,13 @@ import { restoreFromRequestContext } from "./Store/Memory.js"
9
9
  * @tsplus type RequestContextContainer
10
10
  * @tsplus companion RequestContextContainer.Ops
11
11
  */
12
- export class RequestContextContainer extends TagClassId("effect-app/RequestContextContainer")<RequestContextContainer, {
13
- requestContext: Effect<RequestContext>
14
- update: (f: (rc: RequestContext) => RequestContext) => Effect<RequestContext>
15
- start: (f: RequestContext) => Effect<void>
16
- }>() {
12
+ export abstract class RequestContextContainer
13
+ extends TagClassId("effect-app/RequestContextContainer")<RequestContextContainer, {
14
+ requestContext: Effect<RequestContext>
15
+ update: (f: (rc: RequestContext) => RequestContext) => Effect<RequestContext>
16
+ start: (f: RequestContext) => Effect<void>
17
+ }>()
18
+ {
17
19
  static get get(): Effect<RequestContext, never, RequestContextContainer> {
18
20
  return Effect.flatMap(RequestContextContainer, (_) => _.requestContext)
19
21
  }
@@ -37,7 +39,7 @@ export class RequestContextContainer extends TagClassId("effect-app/RequestConte
37
39
  )
38
40
  .pipe(
39
41
  Effect.map((ref) =>
40
- new RequestContextContainer({
42
+ RequestContextContainer.of({
41
43
  requestContext: FiberRef.get(ref),
42
44
  update: (f: (a: RequestContext) => RequestContext) =>
43
45
  Effect.tap(FiberRef.getAndUpdate(ref, f), (rc) => Effect.annotateCurrentSpan(spanAttributes(rc))),
@@ -11,7 +11,7 @@ import { ContextMap } from "./service.js"
11
11
  /**
12
12
  * @tsplus companion ContextMapContainer.Ops
13
13
  */
14
- export class ContextMapContainer extends TagClassId("effect-app/ContextMapContainer")<ContextMapContainer, {
14
+ export abstract class ContextMapContainer extends TagClassId("effect-app/ContextMapContainer")<ContextMapContainer, {
15
15
  get: Effect<ContextMap>
16
16
  start: Effect<void>
17
17
  }>() {
@@ -34,7 +34,7 @@ export class ContextMapContainer extends TagClassId("effect-app/ContextMapContai
34
34
  .pipe(
35
35
  Effect
36
36
  .map((ref) =>
37
- new ContextMapContainer({
37
+ ContextMapContainer.of({
38
38
  get: FiberRef.get(ref),
39
39
  start: Effect.flatMap(ContextMap.make, (_) => FiberRef.set(ref, _))
40
40
  })
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filterApi.test.d.ts","sourceRoot":"","sources":["../filterApi.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.test.d.ts","sourceRoot":"","sources":["../query.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAc,CAAC,EAAE,MAAM,YAAY,CAAA;;;;;;;;;;;;;;;;;;AASlD,qBAAa,CACX,SAAQ,MAAqG;CAC7G;AACF,MAAM,CAAC,OAAO,WAAW,CAAC,CAAC;IACzB,KAAY,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAA;CAC3C;;;;;;;;;;;;;;;;;;;;;;;;;AAGD,qBAAa,WAAY,SAAQ,gBAA6D;CAAG"}
@@ -1,6 +1,7 @@
1
- import { codeFilter3 } from "./codeFilter.js"
2
- import { buildWhereCosmosQuery3 } from "./Cosmos/query.js"
3
- import { print, QueryBuilder } from "./filterApi/query.js"
1
+ import { describe, expect, it } from "vitest"
2
+ import { codeFilter3 } from "../src/services/Store/codeFilter.js"
3
+ import { buildWhereCosmosQuery3 } from "../src/services/Store/Cosmos/query.js"
4
+ import { print, QueryBuilder } from "../src/services/Store/filterApi/query.js"
4
5
 
5
6
  const MyEntity = {
6
7
  query: QueryBuilder
@@ -2,9 +2,10 @@ import { Effect, flow, pipe, S } from "effect-app"
2
2
  import { TagClassMakeId } from "effect-app/service"
3
3
  import { pick } from "effect-app/utils"
4
4
  import { inspect } from "util"
5
- import { and, make, or, order, page, project, toFilter, where } from "./query.js"
6
- import { RepositoryDefaultImpl } from "./RepositoryBase.js"
7
- import { memFilter } from "./Store/Memory.js"
5
+ import { expect, it } from "vitest"
6
+ import { and, make, or, order, page, project, toFilter, where } from "../src/services/query.js"
7
+ import { RepositoryDefaultImpl } from "../src/services/RepositoryBase.js"
8
+ import { memFilter } from "../src/services/Store/Memory.js"
8
9
 
9
10
  export class s
10
11
  extends S.Class<s>()({ id: S.StringId.withDefault, displayName: S.NonEmptyString255, n: S.Date.withDefault })
package/tsconfig.json CHANGED
@@ -18,7 +18,7 @@
18
18
  "forceConsistentCasingInFileNames": true,
19
19
  "module": "Node16",
20
20
  "lib": [
21
- "esnext"
21
+ "ES2023"
22
22
  ],
23
23
  "baseUrl": "./",
24
24
  "target": "es2022",
@@ -31,17 +31,14 @@
31
31
  "noImplicitAny": true,
32
32
  "useUnknownInCatchVariables": true,
33
33
  "noImplicitThis": true,
34
- "outDir": "./dist",
34
+ "outDir": "build/dist",
35
35
  "resolveJsonModule": true,
36
36
  "moduleResolution": "Node16",
37
37
  "downlevelIteration": true,
38
38
  "noErrorTruncation": true,
39
39
  "types": [
40
- "vitest/globals",
41
- "./types/modules"
42
- ],
43
- "rootDir": "./src",
44
- "tsBuildInfoFile": "./dist/.tsbuildinfo"
40
+ "vitest/globals"
41
+ ]
45
42
  },
46
43
  "$schema": "https://json.schemastore.org/tsconfig",
47
44
  "display": "Strictest",
@@ -65,22 +62,12 @@
65
62
  "*.json"
66
63
  ]
67
64
  },
68
- "include": [
69
- "./src/**/*.ts"
70
- ],
65
+ "include": [],
71
66
  "exclude": [
72
67
  "**/node_modules",
73
68
  "**/build",
74
69
  "**/dist",
75
70
  "**/.*"
76
71
  ],
77
- "ts-node": {
78
- "require": [
79
- "tsconfig-paths/register"
80
- ],
81
- "compilerOptions": {
82
- "module": "CommonJS"
83
- }
84
- },
85
72
  "references": []
86
73
  }
package/tsconfig.json.bak CHANGED
@@ -1,41 +1,12 @@
1
1
  {
2
- "extends": "../../tsconfig.base.json",
3
- "compilerOptions": {
4
- "lib": [
5
- "esnext"
6
- ],
7
- "moduleResolution": "Node16",
8
- "outDir": "./dist",
9
- "rootDir": "./src",
10
- "tsBuildInfoFile": "./dist/.tsbuildinfo",
11
- "types": [
12
- "vitest/globals",
13
- "./types/modules"
14
- ]
2
+ "compilerOptions": {},
3
+ "extends": "../../tsconfig.base.json",
4
+ "references": [
5
+ {
6
+ "path": "./tsconfig.src.json"
15
7
  },
16
- "include": [
17
- "./src/**/*.ts"
18
- ],
19
- "ts-node": {
20
- "require": [
21
- "tsconfig-paths/register"
22
- ],
23
- "compilerOptions": {
24
- "module": "CommonJS"
25
- }
26
- },
27
- "references": [
28
- {
29
- "path": "../prelude"
30
- },
31
- {
32
- "path": "../infra-adapters"
33
- },
34
- {
35
- "path": "../schema"
36
- },
37
- {
38
- "path": "../core"
39
- },
40
- ]
8
+ {
9
+ "path": "./tsconfig.test.json"
10
+ }
11
+ ],
41
12
  }
@@ -0,0 +1,56 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "lib": [
5
+ "esnext"
6
+ ],
7
+ "tsBuildInfoFile": "./dist/.tsbuildinfo",
8
+ "esModuleInterop": true,
9
+ "baseUrl": "./",
10
+ "rootDir": "./src",
11
+ // keep in here, cause madge can't detect it from extended tsconfig
12
+ "moduleResolution": "Node16",
13
+ "types": [
14
+ "./types/modules"
15
+ ],
16
+ "outDir": "./dist"
17
+ },
18
+ "include": [
19
+ "./src/**/*.ts"
20
+ ],
21
+ "exclude": [
22
+ "./dist",
23
+ "*.test.ts",
24
+ "node_modules",
25
+ "build",
26
+ "lib",
27
+ "dist",
28
+ "**/*.d.ts.map",
29
+ ".git",
30
+ ".data",
31
+ "**/.*",
32
+ "**/*.tmp"
33
+ ],
34
+ "ts-node": {
35
+ "require": [
36
+ "tsconfig-paths/register"
37
+ ],
38
+ "compilerOptions": {
39
+ "module": "CommonJS"
40
+ }
41
+ },
42
+ "references": [
43
+ {
44
+ "path": "../prelude"
45
+ },
46
+ {
47
+ "path": "../infra-adapters"
48
+ },
49
+ {
50
+ "path": "../schema"
51
+ },
52
+ {
53
+ "path": "../core"
54
+ },
55
+ ]
56
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "extends": "./tsconfig.src.json",
3
+ "compilerOptions": {
4
+ "rootDir": "./test",
5
+ "outDir": "./test/dist",
6
+ "tsBuildInfoFile": "./test/dist/.tsbuildinfo",
7
+ // "types": [
8
+ // "vitest/globals"
9
+ // ]
10
+ },
11
+ "include": [
12
+ "./test/**/*.ts"
13
+ ],
14
+ "exclude": [
15
+ "./dist",
16
+ "./test/dist",
17
+ "node_modules",
18
+ "build",
19
+ "lib",
20
+ "dist",
21
+ "**/*.d.ts.map",
22
+ ".git",
23
+ ".data",
24
+ "**/.*",
25
+ "**/*.tmp"
26
+ ],
27
+ "references": [
28
+ {
29
+ "path": "./tsconfig.src.json"
30
+ },
31
+ ]
32
+ }
package/.prettierignore DELETED
@@ -1,6 +0,0 @@
1
- **/node_modules/
2
-
3
- **/dist/
4
- **/*.js
5
- **/*.jsx
6
- **/*.d.ts
@@ -1,171 +0,0 @@
1
- "use strict";
2
-
3
- var _codeFilter = require("./codeFilter.cjs");
4
- var _query = require("./Cosmos/query.cjs");
5
- var _query2 = require("./filterApi/query.cjs");
6
- const MyEntity = {
7
- query: _query2.QueryBuilder.make()
8
- };
9
- const removeWhitespace = a => a.replaceAll(/\s+/g, " ").replaceAll(/^\s+/g, "").replaceAll(/\s+$/g, "");
10
- describe("works", () => {
11
- const f = MyEntity.query((where, f) => where(f.something.id.eq(1)).and(() => where(f.something.name.startsWith("a")) // or would we do "like", "a%"?
12
- .or(f.tag.in("a", "b")).or(() => where(f.name.neq("Alfredo")).and(f.tag("c"))))
13
- // .and(f.state._tag("a"))
14
- .and("state._tag", "a").and(f.isActive(true)).and(f.age.gte(12)));
15
- const s = f.build();
16
- console.log(JSON.stringify(s, undefined, 2));
17
- it("print", () => expect((0, _query2.print)(s)).toBe(`something.id eq 1 AND (
18
- something.name startsWith a OR tag in a OR (
19
- name neq Alfredo AND tag eq c
20
- )
21
- ) AND state._tag eq a AND isActive eq true AND age gte 12`));
22
- const values = [{
23
- id: "1",
24
- name: "Patrick",
25
- bio: "something",
26
- age: 13,
27
- isActive: true,
28
- state: {
29
- _tag: "a",
30
- val: 1
31
- },
32
- roles: ["admin"],
33
- tag: "c",
34
- something: {
35
- id: 1,
36
- name: "abc"
37
- }
38
- }, {
39
- id: "1",
40
- name: "Patrick",
41
- bio: "something",
42
- age: 11,
43
- isActive: true,
44
- state: {
45
- _tag: "b",
46
- val: "2"
47
- },
48
- roles: ["admin"],
49
- tag: "a",
50
- something: {
51
- id: 1,
52
- name: "abc"
53
- }
54
- }];
55
- it("print codef", () => {
56
- expect(values.filter((0, _codeFilter.codeFilter3)(s))).toStrictEqual([values[0]]);
57
- });
58
- it("codeFilter1", () => {
59
- expect(values.filter((0, _codeFilter.codeFilter3)(s))).toStrictEqual([values[0]]);
60
- });
61
- it("codeFilter2", () => {
62
- expect(values.filter((0, _codeFilter.codeFilter3)(MyEntity.query((where, f) => where(f.something.id.eq(0)).and(() => where(f.something.name.startsWith("a")).or(f.tag.in("a", "b")))).build()))).toStrictEqual([]);
63
- expect(values.filter((0, _codeFilter.codeFilter3)(MyEntity.query((where, f) => where(f.something.id.eq(0))).build()))).toStrictEqual([]);
64
- expect(values.filter((0, _codeFilter.codeFilter3)(MyEntity.query((where, f) => where(f.something.id.eq(1))).build()))).toStrictEqual(values);
65
- expect(values.filter((0, _codeFilter.codeFilter3)(MyEntity.query((where, f) => where(f.age.eq(11))).build()))).toStrictEqual([values[1]]);
66
- });
67
- it("cosmos", () => {
68
- const r = (0, _query.buildWhereCosmosQuery3)(s, "MyEntity", "marker", {
69
- tag: "some"
70
- });
71
- expect(removeWhitespace(r.query)).toBe(removeWhitespace(`
72
- SELECT f
73
- FROM MyEntity f
74
- WHERE f.id != @id AND f.something.id = @v0 AND (
75
- STARTSWITH(f.something.name, @v1, true) OR ARRAY_CONTAINS(@v2, (f.tag ?? "some")) OR (
76
- f.name <> @v3 AND (f.tag ?? "some") = @v4
77
- )
78
- ) AND f.state._tag = @v5 AND f.isActive = @v6 AND f.age >= @v7`));
79
- expect(r.parameters).toEqual([{
80
- "name": "@id",
81
- "value": "marker"
82
- }, {
83
- "name": "@v0",
84
- "value": 1
85
- }, {
86
- "name": "@v1",
87
- "value": "a"
88
- }, {
89
- "name": "@v2",
90
- "value": "a"
91
- }, {
92
- "name": "@v3",
93
- "value": "Alfredo"
94
- }, {
95
- "name": "@v4",
96
- "value": "c"
97
- }, {
98
- "name": "@v5",
99
- "value": "a"
100
- }, {
101
- "name": "@v6",
102
- "value": true
103
- }, {
104
- "name": "@v7",
105
- "value": 12
106
- }]);
107
- });
108
- });
109
- // ref https://stackoverflow.com/questions/1241142/sql-logic-operator-precedence-and-and-or
110
- describe("root-or", () => {
111
- const f = MyEntity.query((where, f) => where(() => where(f.something.id(1)).and(() => where(f.something.name.startsWith("a")) // or would we do "like", "a%"?
112
- .or(f.tag.in("a", "b")).or(() => where(f.name.neq("Alfredo")).and(f.tag("c")))).and(f.bio.contains("abc")).and(f.isActive(true)).and(f.age.gte(12))).or(f.name.startsWith("C")));
113
- const s = f.build();
114
- console.log(JSON.stringify(s, undefined, 2));
115
- it("print", () => {
116
- expect((0, _query2.print)(s)).toBe(`(
117
- something.id eq 1 AND (
118
- something.name startsWith a OR tag in a OR (
119
- name neq Alfredo AND tag eq c
120
- )
121
- ) AND bio contains abc AND isActive eq true AND age gte 12
122
- ) OR name startsWith C`);
123
- });
124
- it("cosmos", () => {
125
- const r = (0, _query.buildWhereCosmosQuery3)(s, "MyEntity", "marker", {
126
- tag: "some"
127
- });
128
- expect(removeWhitespace(r.query)).toBe(removeWhitespace(` SELECT f
129
- FROM MyEntity f
130
-
131
- WHERE f.id != @id AND (
132
- f.something.id = @v0 AND (
133
- STARTSWITH(f.something.name, @v1, true) OR ARRAY_CONTAINS(@v2, (f.tag ?? "some")) OR (
134
- f.name <> @v3 AND (f.tag ?? "some") = @v4
135
- )
136
- ) AND CONTAINS(f.bio, @v5, true) AND f.isActive = @v6 AND f.age >= @v7
137
- ) OR STARTSWITH(f.name, @v8, true) `));
138
- expect(r.parameters).toEqual([{
139
- "name": "@id",
140
- "value": "marker"
141
- }, {
142
- "name": "@v0",
143
- "value": 1
144
- }, {
145
- "name": "@v1",
146
- "value": "a"
147
- }, {
148
- "name": "@v2",
149
- "value": "a"
150
- }, {
151
- "name": "@v3",
152
- "value": "Alfredo"
153
- }, {
154
- "name": "@v4",
155
- "value": "c"
156
- }, {
157
- "name": "@v5",
158
- "value": "abc"
159
- }, {
160
- "name": "@v6",
161
- "value": true
162
- }, {
163
- "name": "@v7",
164
- "value": 12
165
- }, {
166
- "name": "@v8",
167
- "value": "C"
168
- }]);
169
- });
170
- });
171
- //# sourceMappingURL=filterApi.test.cjs.map