2
2
3
3
exports [` Javascript visitor with connected models of custom pk hasMany/belongsTo relation should generate correct declaration for hasMany bi-connection model when custom pk support is enabled 1` ] = `
4
4
"import { ModelInit , MutableModel , __modelMeta__ , CompositeIdentifier } from \\ "@aws-amplify/datastore\\ ";
5
+ // @ts-ignore
6
+ import { LazyLoading , LazyLoadingDisabled , AsyncCollection , AsyncItem } from \\ "@aws-amplify/datastore\\ ";
5
7
6
8
7
9
8
10
9
11
10
- export declare class Post {
12
+ type EagerPost = {
11
13
readonly [__modelMeta__ ]: {
12
14
identifier: CompositeIdentifier < Post , ['customPostId', 'title']>;
13
15
readOnlyFields: ' createdAt' | ' updatedAt' ;
@@ -17,11 +19,27 @@ export declare class Post {
17
19
readonly comments ?: (Comment | null )[] | null ;
18
20
readonly createdAt ?: string | null ;
19
21
readonly updatedAt ?: string | null ;
20
- constructor (init : ModelInit <Post >);
21
- static copyOf(source: Post, mutator: (draft: MutableModel<Post >) => MutableModel<Post > | void): Post;
22
22
}
23
23
24
- export declare class Comment {
24
+ type LazyPost = {
25
+ readonly [__modelMeta__ ]: {
26
+ identifier: CompositeIdentifier < Post , ['customPostId', 'title']>;
27
+ readOnlyFields: ' createdAt' | ' updatedAt' ;
28
+ };
29
+ readonly customPostId : string ;
30
+ readonly title : string ;
31
+ readonly comments : AsyncCollection <Comment >;
32
+ readonly createdAt?: string | null;
33
+ readonly updatedAt?: string | null;
34
+ }
35
+
36
+ export declare type Post = LazyLoading extends LazyLoadingDisabled ? EagerPost : LazyPost
37
+
38
+ export declare const Post: (new (init: ModelInit<Post >) => Post) & {
39
+ copyOf (source : Post , mutator : (draft : MutableModel <Post >) => MutableModel <Post > | void): Post;
40
+ }
41
+
42
+ type EagerComment = {
25
43
readonly [__modelMeta__ ]: {
26
44
identifier: CompositeIdentifier < Comment , ['customPostId', 'content']>;
27
45
readOnlyFields: ' createdAt' | ' updatedAt' ;
@@ -33,19 +51,39 @@ export declare class Comment {
33
51
readonly updatedAt ?: string | null ;
34
52
readonly postCommentsCustomPostId ?: string | null ;
35
53
readonly postCommentsTitle ?: string | null ;
36
- constructor (init : ModelInit <Comment >);
37
- static copyOf(source: Comment, mutator: (draft: MutableModel<Comment >) => MutableModel<Comment > | void): Comment;
54
+ }
55
+
56
+ type LazyComment = {
57
+ readonly [__modelMeta__ ]: {
58
+ identifier: CompositeIdentifier < Comment , ['customPostId', 'content']>;
59
+ readOnlyFields: ' createdAt' | ' updatedAt' ;
60
+ };
61
+ readonly customPostId : string ;
62
+ readonly content : string ;
63
+ readonly post : AsyncItem < Post | undefined > ;
64
+ readonly createdAt ?: string | null ;
65
+ readonly updatedAt ?: string | null ;
66
+ readonly postCommentsCustomPostId ?: string | null ;
67
+ readonly postCommentsTitle ?: string | null ;
68
+ }
69
+
70
+ export declare type Comment = LazyLoading extends LazyLoadingDisabled ? EagerComment : LazyComment
71
+
72
+ export declare const Comment: (new (init: ModelInit<Comment >) => Comment) & {
73
+ copyOf (source : Comment , mutator : (draft : MutableModel <Comment >) => MutableModel <Comment > | void): Comment;
38
74
}"
39
75
`;
40
76
41
77
exports[`Javascript visitor with connected models of custom pk hasMany/belongsTo relation should generate correct declaration for hasMany uni-connection model when custom pk support is enabled 1`] = `
42
78
"import { ModelInit , MutableModel , __modelMeta__ , CompositeIdentifier } from \\"@aws-amplify/datastore\\";
79
+ // @ts-ignore
80
+ import { LazyLoading , LazyLoadingDisabled , AsyncCollection } from \\"@aws-amplify/datastore\\";
43
81
44
82
45
83
46
84
47
85
48
- export declare class Post {
86
+ type EagerPost = {
49
87
readonly [__modelMeta__ ]: {
50
88
identifier: CompositeIdentifier < Post , ['id', 'title']>;
51
89
readOnlyFields: ' createdAt' | ' updatedAt' ;
@@ -55,11 +93,40 @@ export declare class Post {
55
93
readonly comments ?: (Comment | null )[] | null ;
56
94
readonly createdAt ?: string | null ;
57
95
readonly updatedAt ?: string | null ;
58
- constructor (init : ModelInit <Post >);
59
- static copyOf(source: Post, mutator: (draft: MutableModel<Post >) => MutableModel<Post > | void): Post;
60
96
}
61
97
62
- export declare class Comment {
98
+ type LazyPost = {
99
+ readonly [__modelMeta__ ]: {
100
+ identifier: CompositeIdentifier < Post , ['id', 'title']>;
101
+ readOnlyFields: ' createdAt' | ' updatedAt' ;
102
+ };
103
+ readonly id : string ;
104
+ readonly title : string ;
105
+ readonly comments : AsyncCollection <Comment >;
106
+ readonly createdAt?: string | null;
107
+ readonly updatedAt?: string | null;
108
+ }
109
+
110
+ export declare type Post = LazyLoading extends LazyLoadingDisabled ? EagerPost : LazyPost
111
+
112
+ export declare const Post: (new (init: ModelInit<Post >) => Post) & {
113
+ copyOf (source : Post , mutator : (draft : MutableModel <Post >) => MutableModel <Post > | void): Post;
114
+ }
115
+
116
+ type EagerComment = {
117
+ readonly [__modelMeta__ ]: {
118
+ identifier: CompositeIdentifier < Comment , ['id', 'content']>;
119
+ readOnlyFields: ' createdAt' | ' updatedAt' ;
120
+ };
121
+ readonly id : string ;
122
+ readonly content : string ;
123
+ readonly createdAt ?: string | null ;
124
+ readonly updatedAt ?: string | null ;
125
+ readonly postCommentsId ?: string | null ;
126
+ readonly postCommentsTitle ?: string | null ;
127
+ }
128
+
129
+ type LazyComment = {
63
130
readonly [__modelMeta__ ]: {
64
131
identifier: CompositeIdentifier < Comment , ['id', 'content']>;
65
132
readOnlyFields: ' createdAt' | ' updatedAt' ;
@@ -70,19 +137,25 @@ export declare class Comment {
70
137
readonly updatedAt ?: string | null ;
71
138
readonly postCommentsId ?: string | null ;
72
139
readonly postCommentsTitle ?: string | null ;
73
- constructor (init : ModelInit <Comment >);
74
- static copyOf(source: Comment, mutator: (draft: MutableModel<Comment >) => MutableModel<Comment > | void): Comment;
140
+ }
141
+
142
+ export declare type Comment = LazyLoading extends LazyLoadingDisabled ? EagerComment : LazyComment
143
+
144
+ export declare const Comment: (new (init: ModelInit<Comment >) => Comment) & {
145
+ copyOf (source : Comment , mutator : (draft : MutableModel <Comment >) => MutableModel <Comment > | void): Comment;
75
146
}"
76
147
`;
77
148
78
149
exports[`Javascript visitor with connected models of custom pk hasOne/belongsTo relation should generate correct declaration when custom pk support is enabled 1`] = `
79
150
"import { ModelInit , MutableModel , __modelMeta__ , CompositeIdentifier } from \\"@aws-amplify/datastore\\";
151
+ // @ts-ignore
152
+ import { LazyLoading , LazyLoadingDisabled , AsyncItem } from \\"@aws-amplify/datastore\\";
80
153
81
154
82
155
83
156
84
157
85
- export declare class Project {
158
+ type EagerProject = {
86
159
readonly [__modelMeta__ ]: {
87
160
identifier: CompositeIdentifier < Project , ['id', 'name']>;
88
161
readOnlyFields: ' createdAt' | ' updatedAt' ;
@@ -94,11 +167,29 @@ export declare class Project {
94
167
readonly updatedAt ?: string | null ;
95
168
readonly projectTeamId ?: string | null ;
96
169
readonly projectTeamName ?: string | null ;
97
- constructor (init : ModelInit <Project >);
98
- static copyOf(source: Project, mutator: (draft: MutableModel<Project >) => MutableModel<Project > | void): Project;
99
170
}
100
171
101
- export declare class Team {
172
+ type LazyProject = {
173
+ readonly [__modelMeta__ ]: {
174
+ identifier: CompositeIdentifier < Project , ['id', 'name']>;
175
+ readOnlyFields: ' createdAt' | ' updatedAt' ;
176
+ };
177
+ readonly id : string ;
178
+ readonly name : string ;
179
+ readonly team : AsyncItem < Team | undefined > ;
180
+ readonly createdAt ?: string | null ;
181
+ readonly updatedAt ?: string | null ;
182
+ readonly projectTeamId ?: string | null ;
183
+ readonly projectTeamName ?: string | null ;
184
+ }
185
+
186
+ export declare type Project = LazyLoading extends LazyLoadingDisabled ? EagerProject : LazyProject
187
+
188
+ export declare const Project: (new (init: ModelInit<Project >) => Project) & {
189
+ copyOf (source : Project , mutator : (draft : MutableModel <Project >) => MutableModel <Project > | void): Project;
190
+ }
191
+
192
+ type EagerTeam = {
102
193
readonly [__modelMeta__ ]: {
103
194
identifier: CompositeIdentifier < Team , ['id', 'name']>;
104
195
readOnlyFields: ' createdAt' | ' updatedAt' ;
@@ -110,19 +201,39 @@ export declare class Team {
110
201
readonly updatedAt ?: string | null ;
111
202
readonly teamProjectId ?: string | null ;
112
203
readonly teamProjectName ?: string | null ;
113
- constructor (init : ModelInit <Team >);
114
- static copyOf(source: Team, mutator: (draft: MutableModel<Team >) => MutableModel<Team > | void): Team;
204
+ }
205
+
206
+ type LazyTeam = {
207
+ readonly [__modelMeta__ ]: {
208
+ identifier: CompositeIdentifier < Team , ['id', 'name']>;
209
+ readOnlyFields: ' createdAt' | ' updatedAt' ;
210
+ };
211
+ readonly id : string ;
212
+ readonly name : string ;
213
+ readonly project : AsyncItem < Project | undefined > ;
214
+ readonly createdAt ?: string | null ;
215
+ readonly updatedAt ?: string | null ;
216
+ readonly teamProjectId ?: string | null ;
217
+ readonly teamProjectName ?: string | null ;
218
+ }
219
+
220
+ export declare type Team = LazyLoading extends LazyLoadingDisabled ? EagerTeam : LazyTeam
221
+
222
+ export declare const Team: (new (init: ModelInit<Team >) => Team) & {
223
+ copyOf (source : Team , mutator : (draft : MutableModel <Team >) => MutableModel <Team > | void): Team;
115
224
}"
116
225
`;
117
226
118
227
exports[`Javascript visitor with connected models of custom pk manyToMany relation should generate correct declaration for manyToMany model when custom pk is enabled 1`] = `
119
228
"import { ModelInit , MutableModel , __modelMeta__ , CompositeIdentifier , ManagedIdentifier } from \\"@aws-amplify/datastore\\";
229
+ // @ts-ignore
230
+ import { LazyLoading , LazyLoadingDisabled , AsyncCollection , AsyncItem } from \\"@aws-amplify/datastore\\";
120
231
121
232
122
233
123
234
124
235
125
- export declare class Post {
236
+ type EagerPost = {
126
237
readonly [__modelMeta__ ]: {
127
238
identifier: CompositeIdentifier < Post , ['customPostId', 'title']>;
128
239
readOnlyFields: ' createdAt' | ' updatedAt' ;
@@ -133,11 +244,28 @@ export declare class Post {
133
244
readonly tags ?: (PostTags | null )[] | null ;
134
245
readonly createdAt ?: string | null ;
135
246
readonly updatedAt ?: string | null ;
136
- constructor (init : ModelInit <Post >);
137
- static copyOf(source: Post, mutator: (draft: MutableModel<Post >) => MutableModel<Post > | void): Post;
138
247
}
139
248
140
- export declare class Tag {
249
+ type LazyPost = {
250
+ readonly [__modelMeta__ ]: {
251
+ identifier: CompositeIdentifier < Post , ['customPostId', 'title']>;
252
+ readOnlyFields: ' createdAt' | ' updatedAt' ;
253
+ };
254
+ readonly customPostId : string ;
255
+ readonly title : string ;
256
+ readonly content ?: string | null ;
257
+ readonly tags : AsyncCollection <PostTags >;
258
+ readonly createdAt?: string | null;
259
+ readonly updatedAt?: string | null;
260
+ }
261
+
262
+ export declare type Post = LazyLoading extends LazyLoadingDisabled ? EagerPost : LazyPost
263
+
264
+ export declare const Post: (new (init: ModelInit<Post >) => Post) & {
265
+ copyOf (source : Post , mutator : (draft : MutableModel <Post >) => MutableModel <Post > | void): Post;
266
+ }
267
+
268
+ type EagerTag = {
141
269
readonly [__modelMeta__ ]: {
142
270
identifier: CompositeIdentifier < Tag , ['customTagId', 'label']>;
143
271
readOnlyFields: ' createdAt' | ' updatedAt' ;
@@ -147,11 +275,27 @@ export declare class Tag {
147
275
readonly posts ?: (PostTags | null )[] | null ;
148
276
readonly createdAt ?: string | null ;
149
277
readonly updatedAt ?: string | null ;
150
- constructor (init : ModelInit <Tag >);
151
- static copyOf(source: Tag, mutator: (draft: MutableModel<Tag >) => MutableModel<Tag > | void): Tag;
152
278
}
153
279
154
- export declare class PostTags {
280
+ type LazyTag = {
281
+ readonly [__modelMeta__ ]: {
282
+ identifier: CompositeIdentifier < Tag , ['customTagId', 'label']>;
283
+ readOnlyFields: ' createdAt' | ' updatedAt' ;
284
+ };
285
+ readonly customTagId : string ;
286
+ readonly label : string ;
287
+ readonly posts : AsyncCollection <PostTags >;
288
+ readonly createdAt?: string | null;
289
+ readonly updatedAt?: string | null;
290
+ }
291
+
292
+ export declare type Tag = LazyLoading extends LazyLoadingDisabled ? EagerTag : LazyTag
293
+
294
+ export declare const Tag: (new (init: ModelInit<Tag >) => Tag) & {
295
+ copyOf (source : Tag , mutator : (draft : MutableModel <Tag >) => MutableModel <Tag > | void): Tag;
296
+ }
297
+
298
+ type EagerPostTags = {
155
299
readonly [__modelMeta__ ]: {
156
300
identifier: ManagedIdentifier < PostTags , 'id'>;
157
301
readOnlyFields: ' createdAt' | ' updatedAt' ;
@@ -165,7 +309,27 @@ export declare class PostTags {
165
309
readonly tag : Tag ;
166
310
readonly createdAt ?: string | null ;
167
311
readonly updatedAt ?: string | null ;
168
- constructor (init : ModelInit <PostTags >);
169
- static copyOf(source: PostTags, mutator: (draft: MutableModel<PostTags >) => MutableModel<PostTags > | void): PostTags;
312
+ }
313
+
314
+ type LazyPostTags = {
315
+ readonly [__modelMeta__ ]: {
316
+ identifier: ManagedIdentifier < PostTags , 'id'>;
317
+ readOnlyFields: ' createdAt' | ' updatedAt' ;
318
+ };
319
+ readonly id : string ;
320
+ readonly postCustomPostId ?: string | null ;
321
+ readonly posttitle ?: string | null ;
322
+ readonly tagCustomTagId ?: string | null ;
323
+ readonly taglabel ?: string | null ;
324
+ readonly post : AsyncItem <Post >;
325
+ readonly tag: AsyncItem<Tag >;
326
+ readonly createdAt?: string | null;
327
+ readonly updatedAt?: string | null;
328
+ }
329
+
330
+ export declare type PostTags = LazyLoading extends LazyLoadingDisabled ? EagerPostTags : LazyPostTags
331
+
332
+ export declare const PostTags: (new (init: ModelInit<PostTags >) => PostTags) & {
333
+ copyOf (source : PostTags , mutator : (draft : MutableModel <PostTags >) => MutableModel <PostTags > | void): PostTags;
170
334
}"
171
335
`;
0 commit comments