instant-cli 0.22.96-experimental.drewh-ts-target.20761590091.1 → 0.22.96-experimental.surgical.20765817844.1
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.
- package/.turbo/turbo-build.log +1 -1
- package/__tests__/__snapshots__/updateSchemaFile.test.ts.snap +248 -0
- package/__tests__/updateSchemaFile.test.ts +557 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1152 -1044
- package/dist/index.js.map +1 -1
- package/dist/rename.js +69 -58
- package/dist/rename.js.map +1 -1
- package/dist/renderSchemaPlan.js +22 -10
- package/dist/renderSchemaPlan.js.map +1 -1
- package/dist/ui/index.js +102 -115
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/lib.js +30 -29
- package/dist/ui/lib.js.map +1 -1
- package/dist/util/fs.js +30 -17
- package/dist/util/fs.js.map +1 -1
- package/dist/util/isHeadlessEnvironment.js +1 -1
- package/dist/util/isHeadlessEnvironment.js.map +1 -1
- package/dist/util/loadConfig.js +32 -32
- package/dist/util/loadConfig.js.map +1 -1
- package/dist/util/packageManager.js +37 -26
- package/dist/util/packageManager.js.map +1 -1
- package/dist/util/projectDir.js +27 -16
- package/dist/util/projectDir.js.map +1 -1
- package/dist/util/promptOk.js +21 -14
- package/dist/util/promptOk.js.map +1 -1
- package/dist/util/renamePrompt.js +2 -4
- package/dist/util/renamePrompt.js.map +1 -1
- package/dist/util/updateSchemaFile.d.ts +3 -0
- package/dist/util/updateSchemaFile.d.ts.map +1 -0
- package/dist/util/updateSchemaFile.js +610 -0
- package/dist/util/updateSchemaFile.js.map +1 -0
- package/package.json +4 -4
- package/src/index.js +19 -10
- package/src/util/updateSchemaFile.ts +760 -0
- package/__tests__/mergeSchema.test.ts +0 -197
- package/dist/util/mergeSchema.d.ts +0 -2
- package/dist/util/mergeSchema.d.ts.map +0 -1
- package/dist/util/mergeSchema.js +0 -334
- package/dist/util/mergeSchema.js.map +0 -1
- package/src/util/mergeSchema.js +0 -364
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
> instant-cli@0.22.96-experimental.
|
|
2
|
+
> instant-cli@0.22.96-experimental.surgical.20765817844.1 build /home/runner/work/instant/instant/client/packages/cli
|
|
3
3
|
> rm -rf dist; tsc -p tsconfig.json
|
|
4
4
|
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`adds a link when links object is empty 1`] = `
|
|
4
|
+
"
|
|
5
|
+
import { i } from '@instantdb/core';
|
|
6
|
+
|
|
7
|
+
const _schema = i.schema({
|
|
8
|
+
entities: {
|
|
9
|
+
todos: i.entity({
|
|
10
|
+
title: i.string(),
|
|
11
|
+
}),
|
|
12
|
+
users: i.entity({
|
|
13
|
+
email: i.string(),
|
|
14
|
+
}),
|
|
15
|
+
},
|
|
16
|
+
links: {
|
|
17
|
+
todoOwner: {
|
|
18
|
+
forward: {
|
|
19
|
+
on: 'todos',
|
|
20
|
+
has: 'one',
|
|
21
|
+
label: 'owner',
|
|
22
|
+
},
|
|
23
|
+
reverse: {
|
|
24
|
+
on: 'users',
|
|
25
|
+
has: 'many',
|
|
26
|
+
label: 'todos',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
rooms: {},
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export default _schema;
|
|
34
|
+
"
|
|
35
|
+
`;
|
|
36
|
+
|
|
37
|
+
exports[`drops constraints removed by server 1`] = `
|
|
38
|
+
"
|
|
39
|
+
import { i } from '@instantdb/core';
|
|
40
|
+
|
|
41
|
+
const _schema = i.schema({
|
|
42
|
+
entities: {
|
|
43
|
+
todos: i.entity({
|
|
44
|
+
title: i.string(),
|
|
45
|
+
done: i.boolean().optional(),
|
|
46
|
+
}),
|
|
47
|
+
},
|
|
48
|
+
links: {},
|
|
49
|
+
rooms: {},
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
export default _schema;
|
|
53
|
+
"
|
|
54
|
+
`;
|
|
55
|
+
|
|
56
|
+
exports[`handles quoted keys for entities, attrs, and links 1`] = `
|
|
57
|
+
"
|
|
58
|
+
import { i } from '@instantdb/core';
|
|
59
|
+
|
|
60
|
+
const _schema = i.schema({
|
|
61
|
+
entities: {
|
|
62
|
+
todos: i.entity({
|
|
63
|
+
title: i.string(),
|
|
64
|
+
}),
|
|
65
|
+
users: i.entity({
|
|
66
|
+
email: i.string(),
|
|
67
|
+
}),
|
|
68
|
+
'user-profiles': i.entity({
|
|
69
|
+
'display-name': i.string(),
|
|
70
|
+
'avatar-url': i.string(),
|
|
71
|
+
}),
|
|
72
|
+
},
|
|
73
|
+
links: {
|
|
74
|
+
'todo-owner': {
|
|
75
|
+
forward: {
|
|
76
|
+
on: 'todos',
|
|
77
|
+
has: 'one',
|
|
78
|
+
label: 'owner',
|
|
79
|
+
},
|
|
80
|
+
reverse: {
|
|
81
|
+
on: 'users',
|
|
82
|
+
has: 'many',
|
|
83
|
+
label: 'todos',
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
rooms: {},
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
export default _schema;
|
|
91
|
+
"
|
|
92
|
+
`;
|
|
93
|
+
|
|
94
|
+
exports[`inserts attrs into multi-line entities with indentation 1`] = `
|
|
95
|
+
"
|
|
96
|
+
import { i } from '@instantdb/core';
|
|
97
|
+
|
|
98
|
+
const _schema = i.schema({
|
|
99
|
+
entities: {
|
|
100
|
+
todos: i.entity({
|
|
101
|
+
title: i.string(),
|
|
102
|
+
done: i.boolean().optional(),
|
|
103
|
+
priority: i.number(),
|
|
104
|
+
}),
|
|
105
|
+
},
|
|
106
|
+
links: {},
|
|
107
|
+
rooms: {},
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
export default _schema;
|
|
111
|
+
"
|
|
112
|
+
`;
|
|
113
|
+
|
|
114
|
+
exports[`preserves type params across chained calls 1`] = `
|
|
115
|
+
"
|
|
116
|
+
import { i } from '@instantdb/core';
|
|
117
|
+
import { Label } from './types';
|
|
118
|
+
|
|
119
|
+
const _schema = i.schema({
|
|
120
|
+
entities: {
|
|
121
|
+
todos: i.entity({
|
|
122
|
+
title: i.string(),
|
|
123
|
+
status: i.string<'todo' | 'done'>().unique().indexed(),
|
|
124
|
+
labels: i.json<Label[]>(),
|
|
125
|
+
metadata: i.json(),
|
|
126
|
+
}),
|
|
127
|
+
users: i.entity({
|
|
128
|
+
email: i.string().unique(),
|
|
129
|
+
}),
|
|
130
|
+
},
|
|
131
|
+
links: {},
|
|
132
|
+
rooms: {},
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
export default _schema;
|
|
136
|
+
"
|
|
137
|
+
`;
|
|
138
|
+
|
|
139
|
+
exports[`removes a link with surrounding comments and commas 1`] = `
|
|
140
|
+
"
|
|
141
|
+
import { i } from '@instantdb/core';
|
|
142
|
+
|
|
143
|
+
const _schema = i.schema({
|
|
144
|
+
entities: {
|
|
145
|
+
todos: i.entity({
|
|
146
|
+
title: i.string(),
|
|
147
|
+
}),
|
|
148
|
+
users: i.entity({
|
|
149
|
+
email: i.string(),
|
|
150
|
+
}),
|
|
151
|
+
projects: i.entity({
|
|
152
|
+
name: i.string(),
|
|
153
|
+
}),
|
|
154
|
+
},
|
|
155
|
+
links: {
|
|
156
|
+
// owner link
|
|
157
|
+
/* project link */
|
|
158
|
+
projectTodos: {
|
|
159
|
+
forward: { on: 'projects', has: 'many', label: 'todos' },
|
|
160
|
+
reverse: { on: 'todos', has: 'one', label: 'project' },
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
rooms: {},
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
export default _schema;
|
|
167
|
+
"
|
|
168
|
+
`;
|
|
169
|
+
|
|
170
|
+
exports[`removes the last link cleanly 1`] = `
|
|
171
|
+
"
|
|
172
|
+
import { i } from '@instantdb/core';
|
|
173
|
+
|
|
174
|
+
const _schema = i.schema({
|
|
175
|
+
entities: {
|
|
176
|
+
todos: i.entity({
|
|
177
|
+
title: i.string(),
|
|
178
|
+
}),
|
|
179
|
+
users: i.entity({
|
|
180
|
+
email: i.string(),
|
|
181
|
+
}),
|
|
182
|
+
},
|
|
183
|
+
links: {},
|
|
184
|
+
rooms: {},
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
export default _schema;
|
|
188
|
+
"
|
|
189
|
+
`;
|
|
190
|
+
|
|
191
|
+
exports[`updates link details 1`] = `
|
|
192
|
+
"
|
|
193
|
+
import { i } from '@instantdb/core';
|
|
194
|
+
|
|
195
|
+
const _schema = i.schema({
|
|
196
|
+
entities: {
|
|
197
|
+
todos: i.entity({
|
|
198
|
+
title: i.string(),
|
|
199
|
+
}),
|
|
200
|
+
users: i.entity({
|
|
201
|
+
email: i.string(),
|
|
202
|
+
}),
|
|
203
|
+
},
|
|
204
|
+
links: {
|
|
205
|
+
todoOwner: {
|
|
206
|
+
forward: {
|
|
207
|
+
on: 'todos',
|
|
208
|
+
has: 'one',
|
|
209
|
+
label: 'owner',
|
|
210
|
+
required: true,
|
|
211
|
+
onDelete: 'cascade',
|
|
212
|
+
},
|
|
213
|
+
reverse: {
|
|
214
|
+
on: 'users',
|
|
215
|
+
has: 'many',
|
|
216
|
+
label: 'todos',
|
|
217
|
+
onDelete: 'cascade',
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
rooms: {},
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
export default _schema;
|
|
225
|
+
"
|
|
226
|
+
`;
|
|
227
|
+
|
|
228
|
+
exports[`updates single-line entity in place 1`] = `
|
|
229
|
+
"
|
|
230
|
+
import { i } from '@instantdb/core';
|
|
231
|
+
|
|
232
|
+
const _schema = i.schema({
|
|
233
|
+
entities: {
|
|
234
|
+
projects: i.entity({
|
|
235
|
+
name: i.string(),
|
|
236
|
+
status: i.string(),
|
|
237
|
+
}),
|
|
238
|
+
todos: i.entity({
|
|
239
|
+
title: i.string(),
|
|
240
|
+
}),
|
|
241
|
+
},
|
|
242
|
+
links: {},
|
|
243
|
+
rooms: {},
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
export default _schema;
|
|
247
|
+
"
|
|
248
|
+
`;
|