@lafken/dynamo 0.14.1 → 0.14.2

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.
@@ -12,7 +12,8 @@ export type OperationExpression<E> = OnlyOne<{
12
12
  greaterOrEqualThan: E;
13
13
  between: [E, E];
14
14
  }>;
15
- export type InExpression<E extends string | number> = {
15
+ type UnwrapBigInt<T> = NonNullable<T> extends BigInt ? bigint : NonNullable<T>;
16
+ export type InExpression<E extends string | number | bigint> = {
16
17
  in: E[];
17
18
  };
18
19
  export type NullExpression = OnlyOne<{
@@ -30,7 +31,7 @@ export type CommonExpression<E> = OnlyOne<{
30
31
  notEqual: E;
31
32
  } & NullExpression>;
32
33
  export type Filter<E> = {
33
- [key in keyof E]?: NonNullable<E[key]> extends PrimaryPartition<number> ? NonNullable<E[key]> | OnlyOne<OperationExpression<number> & CommonExpression<number> & InExpression<number>> : NonNullable<E[key]> extends PrimaryPartition<string> ? NonNullable<E[key]> | OnlyOne<StringExpression & StringFilterExpression & CommonExpression<string> & InExpression<string>> : NonNullable<E[key]> extends string | number | boolean | Date | null ? NonNullable<E[key]> | (NonNullable<E[key]> extends number ? OnlyOne<OperationExpression<number> & CommonExpression<number> & InExpression<number>> : NonNullable<E[key]> extends boolean ? CommonExpression<boolean> : NonNullable<E[key]> extends null ? NullExpression : OnlyOne<StringExpression & StringFilterExpression & CommonExpression<string> & InExpression<string>>) : DeepPartial<Filter<E[key]>>;
34
+ [key in keyof E]?: NonNullable<E[key]> extends PrimaryPartition<number | bigint | BigInt> ? UnwrapBigInt<E[key]> | OnlyOne<OperationExpression<number | bigint> & CommonExpression<number | bigint> & InExpression<number | bigint>> : NonNullable<E[key]> extends PrimaryPartition<string> ? NonNullable<E[key]> | OnlyOne<StringExpression & StringFilterExpression & CommonExpression<string> & InExpression<string>> : NonNullable<E[key]> extends string | number | bigint | BigInt | boolean | Date | null ? UnwrapBigInt<E[key]> | (NonNullable<E[key]> extends number | bigint | BigInt ? OnlyOne<OperationExpression<number | bigint> & CommonExpression<number | bigint> & InExpression<number | bigint>> : NonNullable<E[key]> extends boolean ? CommonExpression<boolean> : NonNullable<E[key]> extends null ? NullExpression : OnlyOne<StringExpression & StringFilterExpression & CommonExpression<string> & InExpression<string>>) : DeepPartial<Filter<E[key]>>;
34
35
  };
35
36
  export type OrFilter<E> = {
36
37
  OR: Array<Filter<E> | AndFilter<E>>;
@@ -42,7 +43,7 @@ export type SortDirectionType = 'asc' | 'desc';
42
43
  export type KeyCondition<E> = {
43
44
  partition: Partial<OnlyNumberString<E>>;
44
45
  sort?: {
45
- [key in keyof E as E[key] extends number | string ? key : never]?: E[key] extends PrimaryPartition<number> ? E[key] | OperationExpression<E[key]> : E[key] extends PrimaryPartition<string> ? E[key] | OnlyOne<OperationExpression<E[key]> & StringExpression> : E[key] | (E[key] extends number ? OperationExpression<E[key]> : OnlyOne<OperationExpression<E[key]> | StringExpression>);
46
+ [key in keyof E as E[key] extends number | string | bigint | BigInt ? key : never]?: E[key] extends PrimaryPartition<number | bigint | BigInt> ? UnwrapBigInt<E[key]> | OperationExpression<UnwrapBigInt<E[key]>> : E[key] extends PrimaryPartition<string> ? UnwrapBigInt<E[key]> | OnlyOne<OperationExpression<UnwrapBigInt<E[key]>> & StringExpression> : UnwrapBigInt<E[key]> | (E[key] extends number | bigint | BigInt ? OperationExpression<UnwrapBigInt<E[key]>> : OnlyOne<OperationExpression<UnwrapBigInt<E[key]>> | StringExpression>);
46
47
  };
47
48
  };
48
49
  export type Item<E extends Function> = {
@@ -138,16 +139,16 @@ export interface QueryResponse<E extends Function> {
138
139
  cursor?: Cursor<E['prototype']>;
139
140
  }
140
141
  export type ObjectToBoolean<T> = {
141
- [K in keyof T]?: T[K] extends number | string | boolean | Array<any> | Date ? true : ObjectToBoolean<T[K]> | true;
142
+ [K in keyof T]?: T[K] extends number | string | bigint | BigInt | boolean | Array<any> | Date ? true : ObjectToBoolean<T[K]> | true;
142
143
  };
143
144
  interface ExistValue<T> {
144
145
  ifNotExistValue: T;
145
146
  }
146
147
  interface NumericValues<T> extends ExistValue<T> {
147
- incrementValue?: number;
148
- decrementValue?: number;
148
+ incrementValue?: number | bigint;
149
+ decrementValue?: number | bigint;
149
150
  }
150
- export type NumericOrExist<T> = T extends number ? number | OnlyOne<NumericValues<T>> : T extends string | boolean | Array<any> | Date ? T | ExistValue<T> : (T & {
151
+ export type NumericOrExist<T> = NonNullable<T> extends number | bigint | BigInt ? UnwrapBigInt<T> | OnlyOne<NumericValues<UnwrapBigInt<T>>> : T extends string | boolean | Array<any> | Date ? T | ExistValue<T> : (T & {
151
152
  ifNotExistValue?: never;
152
153
  }) | (ExistValue<T> & {
153
154
  [K in keyof T]?: never;
@@ -156,7 +157,7 @@ export type ReplaceValue<T> = {
156
157
  [K in keyof T]?: NumericOrExist<T[K]>;
157
158
  };
158
159
  export type DeepReplaceValue<T> = {
159
- [K in keyof T]?: T[K] extends number | string | boolean | Array<any> | Date ? NumericOrExist<T[K]> : ExistValue<T[K]> | DeepReplaceValue<T[K]>;
160
+ [K in keyof T]?: NonNullable<T[K]> extends number | string | bigint | BigInt | boolean | Array<any> | Date ? NumericOrExist<T[K]> : ExistValue<T[K]> | DeepReplaceValue<T[K]>;
160
161
  };
161
162
  export type ReturnValueOption = 'all_new' | 'updated_new' | 'all_old' | 'none';
162
163
  export type UpdateReturnType<E extends Function, R extends ReturnValueOption | undefined> = R extends 'all_new' | 'all_old' ? Item<E> : R extends 'updated_new' ? Partial<Item<E>> : undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lafken/dynamo",
3
- "version": "0.14.1",
3
+ "version": "0.14.2",
4
4
  "private": false,
5
5
  "description": "Define DynamoDB tables using TypeScript decorators - type-safe, declarative infrastructure with Lafken",
6
6
  "keywords": [
@@ -59,7 +59,7 @@
59
59
  "@aws-sdk/client-dynamodb": "^3.1106.0",
60
60
  "@aws-sdk/util-dynamodb": "^3.996.7",
61
61
  "reflect-metadata": "^0.2.2",
62
- "@lafken/resolver": "0.14.1"
62
+ "@lafken/resolver": "0.14.2"
63
63
  },
64
64
  "devDependencies": {
65
65
  "@cdktn/provider-aws": "^25.0.0",
@@ -73,13 +73,13 @@
73
73
  "typescript": "7.0.2",
74
74
  "unplugin-swc": "^1.5.10",
75
75
  "vitest": "^4.1.10",
76
- "@lafken/common": "0.14.1"
76
+ "@lafken/common": "0.14.2"
77
77
  },
78
78
  "peerDependencies": {
79
79
  "@cdktn/provider-aws": ">=23.0.0",
80
80
  "cdktn": ">=0.22.0",
81
81
  "constructs": ">=10.7.0",
82
- "@lafken/common": "0.14.1"
82
+ "@lafken/common": "0.14.2"
83
83
  },
84
84
  "engines": {
85
85
  "node": ">=20.19"