electrodb 1.10.1 → 1.10.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.
@@ -1,3 +0,0 @@
1
- export * from './schema.test-d';
2
- export * from './types.test-d';
3
- export * from './where.test-d';
@@ -1,142 +0,0 @@
1
- import { expectType, expectError, expectAssignable, expectNotAssignable, expectNotType } from 'tsd';
2
- import { EntityItem } from './';
3
- import { Entity } from '../entity';
4
-
5
- export type Resolve<T> = T extends Function | string | number | boolean
6
- ? T : {[Key in keyof T]: Resolve<T[Key]>}
7
-
8
- const magnify = <T>(value: T): Resolve<T> => { return {} as Resolve<T> };
9
- const get = <T>() => { return {} as Resolve<T> };
10
- const troubleshoot = <T>(value: T) => Text;
11
-
12
- const entityWithSK = new Entity({
13
- model: {
14
- entity: "abc",
15
- service: "myservice",
16
- version: "myversion"
17
- },
18
- attributes: {
19
- attr1: {
20
- type: "string",
21
- default: "abc",
22
- get: (val) => val + 123,
23
- set: (val) => (val ?? "") + 456,
24
- validate: (val) => !!val,
25
- },
26
- attr2: {
27
- type: "string",
28
- // default: () => "sfg",
29
- // required: false,
30
- validate: (val) => val.length > 0
31
- },
32
- attr3: {
33
- type: ["123", "def", "ghi"] as const,
34
- default: "def"
35
- },
36
- attr4: {
37
- type: ["abc", "ghi"] as const,
38
- required: true
39
- },
40
- attr5: {
41
- type: "string"
42
- },
43
- attr6: {
44
- type: "number",
45
- default: () => 100,
46
- get: (val) => val + 5,
47
- set: (val) => (val ?? 0) + 5,
48
- validate: (val) => true,
49
- },
50
- attr7: {
51
- type: "any",
52
- default: () => false,
53
- get: (val) => ({key: "value"}),
54
- set: (val) => (val ?? 0) + 5,
55
- validate: (val) => true,
56
- },
57
- attr8: {
58
- type: "boolean",
59
- required: true,
60
- get: (val) => !!val,
61
- set: (val) => !!val,
62
- validate: (val) => !!val,
63
- },
64
- attr9: {
65
- type: "number"
66
- },
67
- attr10: {
68
- type: "boolean"
69
- }
70
- },
71
- indexes: {
72
- myIndex: {
73
- collection: "mycollection2",
74
- pk: {
75
- field: "pk",
76
- composite: ["attr1"]
77
- },
78
- sk: {
79
- field: "sk",
80
- composite: ["attr2"]
81
- }
82
- },
83
- myIndex2: {
84
- collection: "mycollection1",
85
- index: "gsi1",
86
- pk: {
87
- field: "gsipk1",
88
- composite: ["attr6", "attr9"]
89
- },
90
- sk: {
91
- field: "gsisk1",
92
- composite: ["attr4", "attr5"]
93
- }
94
- },
95
- myIndex3: {
96
- collection: "mycollection",
97
- index: "gsi2",
98
- pk: {
99
- field: "gsipk2",
100
- composite: ["attr5"]
101
- },
102
- sk: {
103
- field: "gsisk2",
104
- composite: ["attr4", "attr3", "attr9"]
105
- }
106
- }
107
- }
108
- });
109
-
110
- type EntityWithSK = ReturnType<typeof entityWithSK.parse>[0];
111
- type EntityWithSKEntityItem = EntityItem<typeof entityWithSK>;
112
- type EntitySchema = typeof entityWithSK extends Entity<infer A, infer F, infer C, infer S>
113
- ? { supposedly: 'can' }
114
- : { cannot: 'ever' };
115
-
116
- expectType<{
117
- attr1: string;
118
- attr2: string;
119
- attr3?: "123" | "def" | "ghi" | undefined;
120
- attr4: "abc" | "ghi";
121
- attr5?: string | undefined;
122
- attr6?: number | undefined;
123
- attr7?: any;
124
- attr8: boolean;
125
- attr9?: number | undefined;
126
- attr10?: boolean | undefined;
127
- }>(get<EntityWithSK>());
128
-
129
- expectType<{
130
- attr1: string;
131
- attr2: string;
132
- attr3?: "123" | "def" | "ghi" | undefined;
133
- attr4: "abc" | "ghi";
134
- attr5?: string | undefined;
135
- attr6?: number | undefined;
136
- attr7?: any;
137
- attr8: boolean;
138
- attr9?: number | undefined;
139
- attr10?: boolean | undefined;
140
- }>(get<EntityWithSKEntityItem>());
141
-
142
- expectType<{supposedly: 'can'}>(get<EntitySchema>());