mocody 0.4.27 → 0.4.30

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.
@@ -6,37 +6,29 @@ type TypeFallBackStringOnly<T> = T extends string ? Extract<T, string> : never;
6
6
  type TypeFallBack<T> = undefined extends T ? Exclude<T, undefined> : T;
7
7
  type TypeFallBackArray<T> = number extends T ? number[] : string extends T ? string[] : T;
8
8
  type TypeFallBackArrayAdvanced<T> = number extends T ? number[] : string extends T ? string[] : Extract<T, string>[] | Extract<T, number>[];
9
- export type IMocodyKeyConditionParams<T extends string | number = string> = {
9
+ export type IMocodyKeyConditionParams<T = string> = {
10
10
  $eq?: TypeFallBack<T> | null;
11
11
  $gt?: TypeFallBack<T>;
12
12
  $gte?: TypeFallBack<T>;
13
13
  $lt?: TypeFallBack<T>;
14
14
  $lte?: TypeFallBack<T>;
15
15
  $between?: [TypeFallBack<T>, TypeFallBack<T>];
16
- } & (T extends string ? {
17
16
  $beginsWith?: TypeFallBackStringOnly<T>;
18
- } : never);
19
- export type IMocodyQueryConditionParams<T = any> = {
17
+ };
18
+ export type IMocodyQueryConditionParams<T = any> = IMocodyKeyConditionParams<T> & {
20
19
  $ne?: TypeFallBack<T> | null;
21
20
  $in?: TypeFallBackArrayAdvanced<T>;
22
21
  $nin?: TypeFallBackArrayAdvanced<T>;
23
22
  $exists?: boolean;
23
+ $not?: IMocodyKeyConditionParams<T>;
24
24
  $elemMatch?: {
25
25
  $in: TypeFallBackArray<T>;
26
26
  };
27
27
  $contains?: TypeFallBackStringOnly<T>;
28
28
  $notContains?: TypeFallBackStringOnly<T>;
29
29
  $nestedMatch?: IQueryNested<RequireAtLeastOne<T>>;
30
- } & (T extends string | number ? IMocodyKeyConditionParams<T> & {
31
- $not?: IMocodyKeyConditionParams<T>;
32
- } : never);
33
- export type IMocodyQueryNestedParams<T = any> = T extends string | number ? IMocodyKeyConditionParams<T> & {
34
- $contains?: TypeFallBackStringOnly<T>;
35
- $ne?: TypeFallBack<T> | null;
36
- $in?: TypeFallBackArrayAdvanced<T>;
37
- $nin?: TypeFallBackArrayAdvanced<T>;
38
- $exists?: boolean;
39
- } : {
30
+ };
31
+ export type IMocodyQueryNestedParams<T = any> = IMocodyKeyConditionParams<T> & {
40
32
  $contains?: TypeFallBackStringOnly<T>;
41
33
  $ne?: TypeFallBack<T> | null;
42
34
  $in?: TypeFallBackArrayAdvanced<T>;
@@ -64,7 +56,7 @@ type IQueryDefAnd<T> = {
64
56
  $and?: IQueryAll<RequireAtLeastOne<T>>[];
65
57
  };
66
58
  export type IMocodyQueryDefinition<T> = IQueryAll<RequireAtLeastOne<T & IQueryDefOr<T> & IQueryDefAnd<T>>>;
67
- export interface IMocodyQueryIndexOptions<T, TSortKeyField extends string | number = string> {
59
+ export interface IMocodyQueryIndexOptions<T, TSortKeyField = string> {
68
60
  indexName: string;
69
61
  partitionKeyValue: string | number;
70
62
  sortKeyQuery?: IMocodyKeyConditionParams<TSortKeyField>;
@@ -75,7 +67,7 @@ export interface IMocodyQueryIndexOptions<T, TSortKeyField extends string | numb
75
67
  limit?: number | undefined | null;
76
68
  sort?: "asc" | "desc" | undefined | null;
77
69
  }
78
- export type IMocodyQueryIndexOptionsNoPaging<T, TSortKeyField extends string | number = string> = Omit<IMocodyQueryIndexOptions<T, TSortKeyField>, "pagingParams">;
70
+ export type IMocodyQueryIndexOptionsNoPaging<T, TSortKeyField = string> = Omit<IMocodyQueryIndexOptions<T, TSortKeyField>, "pagingParams">;
79
71
  export interface IMocodyIndexDefinition<T> {
80
72
  indexName: string;
81
73
  partitionKeyFieldName: keyof T;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mocody",
3
- "version": "0.4.27",
3
+ "version": "0.4.30",
4
4
  "description": "Implementation of single table design, and unified query access for MongoDB, CouchDB, and dynamoDB",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -44,11 +44,14 @@
44
44
  "mongodb": "^4.12.0",
45
45
  "nano": "^10.1.2",
46
46
  "nanoid": "^3.3.4",
47
- "pouchdb": "^8.0.1",
48
- "pouchdb-find": "^8.0.1",
49
47
  "throat": "^6.0.2",
50
48
  "tslib": "^2.5.0"
51
49
  },
50
+ "optionalDependencies": {
51
+ "pouchdb": "^8.0.1",
52
+ "pouchdb-adapter-node-websql": "^7.0.0",
53
+ "pouchdb-find": "^8.0.1"
54
+ },
52
55
  "devDependencies": {
53
56
  "@faker-js/faker": "^7.6.0",
54
57
  "@types/lodash": "^4.14.191",
@@ -63,6 +66,8 @@
63
66
  "eslint-plugin-prettier": "^4.2.1",
64
67
  "eslint-plugin-promise": "^6.1.1",
65
68
  "pouchdb-adapter-node-websql": "^7.0.0",
69
+ "pouchdb": "^8.0.1",
70
+ "pouchdb-find": "^8.0.1",
66
71
  "prettier": "^2.8.4",
67
72
  "ts-node": "^10.9.1",
68
73
  "typescript": "^4.9.5"