@velastack/patterns 0.0.19 → 0.0.21
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/README.md +12 -0
- package/dist/chunks/collections-OI0LQoJt.js +67 -0
- package/dist/chunks/collections-OI0LQoJt.js.map +1 -0
- package/dist/chunks/{env.runtime-C3E02sUH.js → env.runtime-CSAfqDu4.js} +2 -2
- package/dist/chunks/{env.runtime-C3E02sUH.js.map → env.runtime-CSAfqDu4.js.map} +1 -1
- package/dist/chunks/generate.runtime-BQFcrwn8.js +334 -0
- package/dist/chunks/generate.runtime-BQFcrwn8.js.map +1 -0
- package/dist/chunks/generate.runtime-BQg5E0LV.js +172 -0
- package/dist/chunks/generate.runtime-BQg5E0LV.js.map +1 -0
- package/dist/chunks/generate.runtime-C7g-zL0o.js.map +1 -1
- package/dist/chunks/generate.runtime-CEFyA2-Y.js +610 -0
- package/dist/chunks/generate.runtime-CEFyA2-Y.js.map +1 -0
- package/dist/chunks/{generate.runtime-DgtB6hP4.js → generate.runtime-ZXBZUjeH.js} +33 -10
- package/dist/chunks/generate.runtime-ZXBZUjeH.js.map +1 -0
- package/dist/chunks/{index-E6LAzq1d.js → index-9TLCLhJv.js} +2542 -2246
- package/dist/chunks/index-9TLCLhJv.js.map +1 -0
- package/dist/chunks/{pocketbase-BCvqw1Cr.js → pocketbase-Vk0YzqnQ.js} +50 -45
- package/dist/chunks/pocketbase-Vk0YzqnQ.js.map +1 -0
- package/dist/chunks/ts-morph-helpers-BNCluWTs.js +166 -0
- package/dist/chunks/ts-morph-helpers-BNCluWTs.js.map +1 -0
- package/dist/chunks/{write-result-CbUTMeAc.js → write-result-DmD7kWlV.js} +81 -70
- package/dist/chunks/write-result-DmD7kWlV.js.map +1 -0
- package/dist/index.d.ts +85 -0
- package/dist/index.js +1 -1
- package/package.json +16 -1
- package/dist/chunks/collections-CAafgIoZ.js +0 -62
- package/dist/chunks/collections-CAafgIoZ.js.map +0 -1
- package/dist/chunks/generate.runtime-C7YhHvlr.js +0 -353
- package/dist/chunks/generate.runtime-C7YhHvlr.js.map +0 -1
- package/dist/chunks/generate.runtime-DBTOrhnc.js +0 -633
- package/dist/chunks/generate.runtime-DBTOrhnc.js.map +0 -1
- package/dist/chunks/generate.runtime-DgtB6hP4.js.map +0 -1
- package/dist/chunks/generate.runtime-DoQkjIdl.js +0 -227
- package/dist/chunks/generate.runtime-DoQkjIdl.js.map +0 -1
- package/dist/chunks/index-E6LAzq1d.js.map +0 -1
- package/dist/chunks/pocketbase-BCvqw1Cr.js.map +0 -1
- package/dist/chunks/write-result-CbUTMeAc.js.map +0 -1
|
@@ -1,633 +0,0 @@
|
|
|
1
|
-
import f from "node:fs";
|
|
2
|
-
import A from "node:path";
|
|
3
|
-
import { d as z, T as j, l as P } from "./index-E6LAzq1d.js";
|
|
4
|
-
import { applyCollectionRulePatches as _ } from "./collections-CAafgIoZ.js";
|
|
5
|
-
import { w as O, g as D } from "./pocketbase-BCvqw1Cr.js";
|
|
6
|
-
import { Project as F, SyntaxKind as s, QuoteKind as N } from "ts-morph";
|
|
7
|
-
function L(t) {
|
|
8
|
-
if (!f.existsSync(t))
|
|
9
|
-
return !1;
|
|
10
|
-
let n = f.readFileSync(t, "utf8");
|
|
11
|
-
if (n.includes("teams={data.teams"))
|
|
12
|
-
return !1;
|
|
13
|
-
const o = "<AppSidebar user={data.user} meta={data.meta} />", r = "<AppSidebar user={data.user} meta={data.meta} team={data.team} teams={data.teams ?? []} />";
|
|
14
|
-
return n.includes(o) ? (n = n.replace(o, r), f.writeFileSync(t, n, "utf8"), !0) : !1;
|
|
15
|
-
}
|
|
16
|
-
const I = /import NavUser from ['"]\.\/nav-user\.svelte['"];/, C = `import NavUser from './nav-user.svelte';
|
|
17
|
-
import TeamSwitcher from '$lib/components/team-switcher.svelte';
|
|
18
|
-
import ChevronsUpDownIcon from '@lucide/svelte/icons/chevrons-up-down';
|
|
19
|
-
import * as Avatar from '$lib/components/ui/avatar';`, U = `<Sidebar.Header>
|
|
20
|
-
<Sidebar.Menu>
|
|
21
|
-
<TeamSwitcher {teams}>
|
|
22
|
-
{#snippet children()}
|
|
23
|
-
{@const activeTeam = teams.find((t) => t.id === team)}
|
|
24
|
-
{#if activeTeam}
|
|
25
|
-
<Avatar.Root class="size-8 rounded-lg">
|
|
26
|
-
<Avatar.Fallback class="rounded-lg bg-primary text-primary-foreground font-medium">
|
|
27
|
-
{activeTeam.name?.charAt(0).toUpperCase()}
|
|
28
|
-
</Avatar.Fallback>
|
|
29
|
-
</Avatar.Root>
|
|
30
|
-
<div class="grid flex-1 text-left text-sm leading-tight">
|
|
31
|
-
<span class="truncate font-medium">
|
|
32
|
-
{activeTeam.name}
|
|
33
|
-
</span>
|
|
34
|
-
</div>
|
|
35
|
-
{:else}
|
|
36
|
-
<div
|
|
37
|
-
class="bg-sidebar-accent text-sidebar-primary-foreground flex aspect-square size-8 items-center justify-center rounded-lg"
|
|
38
|
-
>
|
|
39
|
-
<img src="/favicon.svg" alt="logo" class="size-6" />
|
|
40
|
-
</div>
|
|
41
|
-
<div class="grid flex-1 text-left text-sm leading-tight">
|
|
42
|
-
<span class="truncate font-medium">{meta.appName}</span>
|
|
43
|
-
</div>
|
|
44
|
-
{/if}
|
|
45
|
-
<ChevronsUpDownIcon class="ml-auto" />
|
|
46
|
-
{/snippet}
|
|
47
|
-
</TeamSwitcher>
|
|
48
|
-
</Sidebar.Menu>
|
|
49
|
-
</Sidebar.Header>`;
|
|
50
|
-
function q(t) {
|
|
51
|
-
if (!f.existsSync(t))
|
|
52
|
-
return !1;
|
|
53
|
-
let n = f.readFileSync(t, "utf8");
|
|
54
|
-
if (n.includes("TeamSwitcher") || !I.test(n))
|
|
55
|
-
return !1;
|
|
56
|
-
n = n.replace(I, C), n = n.replace(
|
|
57
|
-
/let \{[\s\S]*?\}: ComponentProps<typeof Sidebar\.Root> & \{ user: any; meta: any \} = \$props\(\);/,
|
|
58
|
-
`let {
|
|
59
|
-
user,
|
|
60
|
-
meta,
|
|
61
|
-
team,
|
|
62
|
-
teams = [],
|
|
63
|
-
ref = $bindable(null),
|
|
64
|
-
...restProps
|
|
65
|
-
}: ComponentProps<typeof Sidebar.Root> & {
|
|
66
|
-
user: any;
|
|
67
|
-
meta: any;
|
|
68
|
-
team?: string | undefined;
|
|
69
|
-
teams?: { id: string; name: string }[];
|
|
70
|
-
} = $props();`
|
|
71
|
-
);
|
|
72
|
-
const o = n.match(/<Sidebar\.Header>[\s\S]*?<\/Sidebar\.Header>/);
|
|
73
|
-
return o ? (n = n.replace(o[0], U), f.writeFileSync(t, n, "utf8"), !0) : !1;
|
|
74
|
-
}
|
|
75
|
-
function R(t) {
|
|
76
|
-
if (!f.existsSync(t)) {
|
|
77
|
-
const e = z`
|
|
78
|
-
export const load = async ({ locals, depends }) => {
|
|
79
|
-
const user = locals.pb.authStore.record!;
|
|
80
|
-
const team = locals.team;
|
|
81
|
-
const teams = await locals.pb.collection("teams").getFullList();
|
|
82
|
-
depends("app:team");
|
|
83
|
-
|
|
84
|
-
const breadcrumbs = [{ title: "Home", url: "/dashboard" }];
|
|
85
|
-
return { user, team, teams, breadcrumbs };
|
|
86
|
-
};
|
|
87
|
-
`;
|
|
88
|
-
f.writeFileSync(t, e);
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
const o = new F().addSourceFileAtPath(t), r = (e, a, c) => {
|
|
92
|
-
!!e.getProperty(a) || (a === c ? e.addShorthandPropertyAssignment({ name: a }) : e.addPropertyAssignment({ name: a, initializer: c }));
|
|
93
|
-
};
|
|
94
|
-
let p, m;
|
|
95
|
-
const g = o.getVariableDeclaration("load");
|
|
96
|
-
if (g) {
|
|
97
|
-
const e = g.getFirstAncestorByKind(s.VariableStatement);
|
|
98
|
-
if (!!(e != null && e.hasExportKeyword())) {
|
|
99
|
-
const c = g.getInitializerIfKind(s.ArrowFunction);
|
|
100
|
-
if (c)
|
|
101
|
-
p = c;
|
|
102
|
-
else {
|
|
103
|
-
const i = g.getInitializer();
|
|
104
|
-
if (i) {
|
|
105
|
-
const l = i.getFirstDescendantByKind(s.ArrowFunction);
|
|
106
|
-
if (l)
|
|
107
|
-
p = l;
|
|
108
|
-
else {
|
|
109
|
-
const u = i.getFirstDescendantByKind(s.FunctionExpression);
|
|
110
|
-
u && (m = u);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
if (!p) {
|
|
117
|
-
const e = o.getFunction("load");
|
|
118
|
-
e && e.isExported() && (m = e);
|
|
119
|
-
}
|
|
120
|
-
if (!p && !m) {
|
|
121
|
-
o.addFunction({
|
|
122
|
-
isExported: !0,
|
|
123
|
-
isAsync: !0,
|
|
124
|
-
name: "load",
|
|
125
|
-
parameters: [{ name: "{ locals, depends }" }],
|
|
126
|
-
statements: [
|
|
127
|
-
"const user = locals.pb.authStore.record!;",
|
|
128
|
-
"const team = locals.team;",
|
|
129
|
-
'const teams = await locals.pb.collection("teams").getFullList();',
|
|
130
|
-
'depends("app:team");',
|
|
131
|
-
"",
|
|
132
|
-
'const breadcrumbs = [{ title: "Home", url: "/dashboard" }];',
|
|
133
|
-
"return { user, team, teams, breadcrumbs };"
|
|
134
|
-
]
|
|
135
|
-
}), o.formatText(), o.saveSync();
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
const d = p ?? m, S = d.getParameters();
|
|
139
|
-
if (S.length === 0)
|
|
140
|
-
d.insertParameter(0, { name: "{ locals, depends }" });
|
|
141
|
-
else {
|
|
142
|
-
const e = S[0], a = e.getStructure(), c = e.getNameNode();
|
|
143
|
-
if (c.getKind() === s.ObjectBindingPattern) {
|
|
144
|
-
const i = c, l = i.getElements().some((x) => x.getName() === "depends"), u = i.getElements().some((x) => x.getName() === "locals");
|
|
145
|
-
if (!l) {
|
|
146
|
-
const x = i.getElements().map((w) => w.getText()).filter(Boolean), b = x.length > 0 ? ", " + x.join(", ") : "";
|
|
147
|
-
u ? e.set({
|
|
148
|
-
name: `{ depends${b} }`,
|
|
149
|
-
type: a.type,
|
|
150
|
-
initializer: a.initializer
|
|
151
|
-
}) : e.set({
|
|
152
|
-
name: `{ locals, depends${b} }`,
|
|
153
|
-
type: a.type,
|
|
154
|
-
initializer: a.initializer
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
} else {
|
|
158
|
-
const i = e.getName();
|
|
159
|
-
i !== "locals" ? e.set({
|
|
160
|
-
name: `{ locals, depends, ...${i} }`,
|
|
161
|
-
type: a.type,
|
|
162
|
-
initializer: a.initializer
|
|
163
|
-
}) : e.set({
|
|
164
|
-
name: "{ locals, depends }",
|
|
165
|
-
type: a.type,
|
|
166
|
-
initializer: a.initializer
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
p && !p.isAsync() ? p.setIsAsync(!0) : m && !m.isAsync() && m.setIsAsync(!0);
|
|
171
|
-
const y = d.getBody();
|
|
172
|
-
if (y && y.getKind() === s.Block) {
|
|
173
|
-
const e = y, a = e.getStatements(), c = a.some(
|
|
174
|
-
(u) => u.getKind() === s.VariableStatement && u.getDescendantsOfKind(s.Identifier).some((x) => x.getText() === "team")
|
|
175
|
-
), i = a.some(
|
|
176
|
-
(u) => u.getKind() === s.VariableStatement && u.getDescendantsOfKind(s.Identifier).some((x) => x.getText() === "teams")
|
|
177
|
-
), l = a.some(
|
|
178
|
-
(u) => u.getKind() === s.ExpressionStatement && u.getDescendantsOfKind(s.CallExpression).some((x) => {
|
|
179
|
-
var K;
|
|
180
|
-
if (x.getExpression().getText() !== "depends") return !1;
|
|
181
|
-
const w = x.getArguments(), h = ((K = w[0]) == null ? void 0 : K.getText()) ?? "";
|
|
182
|
-
return w.length === 1 && (h === "'app:team'" || h === '"app:team"');
|
|
183
|
-
})
|
|
184
|
-
);
|
|
185
|
-
c || e.insertStatements(1, "const team = locals.team;"), i || e.insertStatements(
|
|
186
|
-
2,
|
|
187
|
-
'const teams = await locals.pb.collection("teams").getFullList();'
|
|
188
|
-
), l || e.insertStatements(3, 'depends("app:team");');
|
|
189
|
-
}
|
|
190
|
-
if (p) {
|
|
191
|
-
const e = p.getBody();
|
|
192
|
-
if (e.getKind() === s.Block)
|
|
193
|
-
e.getDescendantsOfKind(s.ReturnStatement).forEach((c) => {
|
|
194
|
-
const i = c.getExpression();
|
|
195
|
-
if (i) {
|
|
196
|
-
if (i.getKind() === s.ObjectLiteralExpression) {
|
|
197
|
-
const l = i;
|
|
198
|
-
r(l, "team", "team"), r(l, "teams", "teams");
|
|
199
|
-
} else if (i.getKind() === s.ParenthesizedExpression) {
|
|
200
|
-
const l = i.getExpression();
|
|
201
|
-
if (l.getKind() === s.ObjectLiteralExpression) {
|
|
202
|
-
const u = l;
|
|
203
|
-
r(u, "team", "team"), r(u, "teams", "teams");
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
else {
|
|
209
|
-
const a = e;
|
|
210
|
-
if (a.getKind() === s.ParenthesizedExpression) {
|
|
211
|
-
const c = a.getExpression();
|
|
212
|
-
if (c.getKind() === s.ObjectLiteralExpression) {
|
|
213
|
-
const i = c;
|
|
214
|
-
r(i, "team", "team"), r(i, "teams", "teams");
|
|
215
|
-
}
|
|
216
|
-
} else if (a.getKind() === s.ObjectLiteralExpression) {
|
|
217
|
-
const c = a;
|
|
218
|
-
r(c, "team", "team"), r(c, "teams", "teams");
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
} else if (m) {
|
|
222
|
-
const e = m.getBody();
|
|
223
|
-
e && e.getDescendantsOfKind(s.ReturnStatement).forEach((c) => {
|
|
224
|
-
const i = c.getExpression();
|
|
225
|
-
if (i) {
|
|
226
|
-
if (i.getKind() === s.ObjectLiteralExpression) {
|
|
227
|
-
const l = i;
|
|
228
|
-
r(l, "team", "team"), r(l, "teams", "teams");
|
|
229
|
-
} else if (i.getKind() === s.ParenthesizedExpression) {
|
|
230
|
-
const l = i.getExpression();
|
|
231
|
-
if (l.getKind() === s.ObjectLiteralExpression) {
|
|
232
|
-
const u = l;
|
|
233
|
-
r(u, "team", "team"), r(u, "teams", "teams");
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
o.formatText(), o.saveSync();
|
|
240
|
-
}
|
|
241
|
-
function T(t, n, o, r, p) {
|
|
242
|
-
const m = `
|
|
243
|
-
{
|
|
244
|
-
title: '${n}',
|
|
245
|
-
url: '${o}',
|
|
246
|
-
icon: ${r}
|
|
247
|
-
}
|
|
248
|
-
`, d = new F({
|
|
249
|
-
useInMemoryFileSystem: !0,
|
|
250
|
-
skipFileDependencyResolution: !0,
|
|
251
|
-
manipulationSettings: { quoteKind: N.Single }
|
|
252
|
-
}).createSourceFile("module.ts", t, { overwrite: !0 });
|
|
253
|
-
d.getImportDeclarations().some((a) => a.getModuleSpecifierValue() === p) || d.addImportDeclaration({ defaultImport: r, moduleSpecifier: p });
|
|
254
|
-
const y = d.getVariableDeclarations().find((a) => a.getName() === "data"), e = y == null ? void 0 : y.getInitializer();
|
|
255
|
-
if (e && e.getKind() === s.ObjectLiteralExpression) {
|
|
256
|
-
const c = e.asKindOrThrow(s.ObjectLiteralExpression).getProperty("navUser");
|
|
257
|
-
if (c && c.getKind() === s.PropertyAssignment) {
|
|
258
|
-
const l = c.asKindOrThrow(s.PropertyAssignment).getInitializer();
|
|
259
|
-
if (l && l.getKind() === s.ArrayLiteralExpression) {
|
|
260
|
-
const u = l.asKindOrThrow(s.ArrayLiteralExpression);
|
|
261
|
-
if (!u.getElements().some((b) => {
|
|
262
|
-
if (b.getKind() !== s.ObjectLiteralExpression) return !1;
|
|
263
|
-
const h = b.asKindOrThrow(s.ObjectLiteralExpression).getProperty("title");
|
|
264
|
-
if (!h || h.getKind() !== s.PropertyAssignment) return !1;
|
|
265
|
-
const E = h.asKindOrThrow(s.PropertyAssignment).getInitializer();
|
|
266
|
-
return (E == null ? void 0 : E.getKind()) === s.StringLiteral && E.getLiteralText() === n;
|
|
267
|
-
}))
|
|
268
|
-
return u.addElement(m.trim()), d.formatText(), { newInner: d.getFullText(), wasAdded: !0 };
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
return { newInner: t, wasAdded: !1 };
|
|
273
|
-
}
|
|
274
|
-
function $(t, n, o, r, p) {
|
|
275
|
-
const m = /<script\b([^>]*)>([\s\S]*?)<\/script>/gi;
|
|
276
|
-
let g;
|
|
277
|
-
for (; (g = m.exec(t)) !== null; ) {
|
|
278
|
-
const d = g[1] ?? "";
|
|
279
|
-
if (!(/\bmodule\b/.test(d) || /context\s*=\s*"module"/.test(d)))
|
|
280
|
-
continue;
|
|
281
|
-
const y = `<script${d}>`, e = g[2] ?? "", a = g.index, c = m.lastIndex, { newInner: i, wasAdded: l } = T(
|
|
282
|
-
e,
|
|
283
|
-
n,
|
|
284
|
-
o,
|
|
285
|
-
r,
|
|
286
|
-
p
|
|
287
|
-
);
|
|
288
|
-
if (l)
|
|
289
|
-
return {
|
|
290
|
-
newNavUserSnippet: t.slice(0, a) + y + i + "<\/script>" + t.slice(c),
|
|
291
|
-
wasAdded: !0
|
|
292
|
-
};
|
|
293
|
-
}
|
|
294
|
-
for (m.lastIndex = 0; (g = m.exec(t)) !== null; ) {
|
|
295
|
-
const d = g[1] ?? "";
|
|
296
|
-
if (/\bmodule\b/.test(d) || /context\s*=\s*"module"/.test(d))
|
|
297
|
-
continue;
|
|
298
|
-
const y = g[2] ?? "";
|
|
299
|
-
if (!y.includes("navUser"))
|
|
300
|
-
continue;
|
|
301
|
-
const e = `<script${d}>`, a = g.index, c = m.lastIndex, { newInner: i, wasAdded: l } = T(
|
|
302
|
-
y,
|
|
303
|
-
n,
|
|
304
|
-
o,
|
|
305
|
-
r,
|
|
306
|
-
p
|
|
307
|
-
);
|
|
308
|
-
if (l)
|
|
309
|
-
return {
|
|
310
|
-
newNavUserSnippet: t.slice(0, a) + e + i + "<\/script>" + t.slice(c),
|
|
311
|
-
wasAdded: !0
|
|
312
|
-
};
|
|
313
|
-
}
|
|
314
|
-
return { newNavUserSnippet: t, wasAdded: !1 };
|
|
315
|
-
}
|
|
316
|
-
function M(t) {
|
|
317
|
-
if (!f.existsSync(t))
|
|
318
|
-
return !1;
|
|
319
|
-
const n = f.readFileSync(t, "utf8"), { newNavUserSnippet: o, wasAdded: r } = $(
|
|
320
|
-
n,
|
|
321
|
-
"Teams",
|
|
322
|
-
"/teams",
|
|
323
|
-
"UsersIcon",
|
|
324
|
-
"@lucide/svelte/icons/users"
|
|
325
|
-
);
|
|
326
|
-
return r && f.writeFileSync(t, o, "utf8"), r;
|
|
327
|
-
}
|
|
328
|
-
function v(t, n, o) {
|
|
329
|
-
const r = D(n, "created", o);
|
|
330
|
-
r && t.push({
|
|
331
|
-
path: r,
|
|
332
|
-
language: P(r),
|
|
333
|
-
content: f.readFileSync(r, "utf8")
|
|
334
|
-
});
|
|
335
|
-
}
|
|
336
|
-
async function X(t) {
|
|
337
|
-
const n = [];
|
|
338
|
-
await O(t.root, async (d) => {
|
|
339
|
-
const S = await d.collections.getOne("users"), y = await d.collections.create({
|
|
340
|
-
name: "teams",
|
|
341
|
-
type: "base",
|
|
342
|
-
fields: [
|
|
343
|
-
{
|
|
344
|
-
name: "id",
|
|
345
|
-
type: "text",
|
|
346
|
-
primaryKey: !0,
|
|
347
|
-
autogeneratePattern: "[a-z0-9]{15}",
|
|
348
|
-
max: 15,
|
|
349
|
-
min: 15,
|
|
350
|
-
pattern: "^[a-z0-9]+$",
|
|
351
|
-
required: !0
|
|
352
|
-
},
|
|
353
|
-
{
|
|
354
|
-
name: "name",
|
|
355
|
-
type: "text",
|
|
356
|
-
required: !0
|
|
357
|
-
},
|
|
358
|
-
{
|
|
359
|
-
name: "owner",
|
|
360
|
-
type: "relation",
|
|
361
|
-
cascadeDelete: !1,
|
|
362
|
-
collectionId: S.id,
|
|
363
|
-
maxSelect: 1,
|
|
364
|
-
minSelect: 0,
|
|
365
|
-
required: !0
|
|
366
|
-
},
|
|
367
|
-
{
|
|
368
|
-
name: "created",
|
|
369
|
-
type: "autodate",
|
|
370
|
-
onCreate: !0,
|
|
371
|
-
onUpdate: !1
|
|
372
|
-
},
|
|
373
|
-
{
|
|
374
|
-
name: "updated",
|
|
375
|
-
type: "autodate",
|
|
376
|
-
onCreate: !0,
|
|
377
|
-
onUpdate: !0
|
|
378
|
-
}
|
|
379
|
-
]
|
|
380
|
-
});
|
|
381
|
-
v(n, "teams", t);
|
|
382
|
-
const e = await d.collections.create({
|
|
383
|
-
name: "team_memberships",
|
|
384
|
-
type: "base",
|
|
385
|
-
fields: [
|
|
386
|
-
{
|
|
387
|
-
name: "id",
|
|
388
|
-
autogeneratePattern: "[a-z0-9]{15}",
|
|
389
|
-
max: 15,
|
|
390
|
-
min: 15,
|
|
391
|
-
pattern: "^[a-z0-9]+$",
|
|
392
|
-
primaryKey: !0,
|
|
393
|
-
required: !0,
|
|
394
|
-
type: "text"
|
|
395
|
-
},
|
|
396
|
-
{
|
|
397
|
-
name: "team",
|
|
398
|
-
cascadeDelete: !0,
|
|
399
|
-
collectionId: y.id,
|
|
400
|
-
maxSelect: 1,
|
|
401
|
-
minSelect: 0,
|
|
402
|
-
required: !0,
|
|
403
|
-
type: "relation"
|
|
404
|
-
},
|
|
405
|
-
{
|
|
406
|
-
name: "user",
|
|
407
|
-
cascadeDelete: !0,
|
|
408
|
-
collectionId: S.id,
|
|
409
|
-
maxSelect: 1,
|
|
410
|
-
minSelect: 0,
|
|
411
|
-
required: !0,
|
|
412
|
-
type: "relation"
|
|
413
|
-
},
|
|
414
|
-
{
|
|
415
|
-
name: "role",
|
|
416
|
-
maxSelect: 1,
|
|
417
|
-
required: !0,
|
|
418
|
-
type: "select",
|
|
419
|
-
values: ["owner", "admin", "member"]
|
|
420
|
-
},
|
|
421
|
-
{
|
|
422
|
-
name: "created",
|
|
423
|
-
onCreate: !0,
|
|
424
|
-
onUpdate: !1,
|
|
425
|
-
type: "autodate"
|
|
426
|
-
},
|
|
427
|
-
{
|
|
428
|
-
name: "updated",
|
|
429
|
-
onCreate: !0,
|
|
430
|
-
onUpdate: !0,
|
|
431
|
-
type: "autodate"
|
|
432
|
-
}
|
|
433
|
-
]
|
|
434
|
-
});
|
|
435
|
-
v(n, "team_memberships", t), await d.collections.create({
|
|
436
|
-
name: "team_users",
|
|
437
|
-
type: "view",
|
|
438
|
-
fields: [
|
|
439
|
-
{
|
|
440
|
-
name: "id",
|
|
441
|
-
pattern: "^[a-z0-9]+$",
|
|
442
|
-
primaryKey: !0,
|
|
443
|
-
required: !0,
|
|
444
|
-
type: "text"
|
|
445
|
-
},
|
|
446
|
-
{
|
|
447
|
-
name: "email",
|
|
448
|
-
exceptDomains: null,
|
|
449
|
-
onlyDomains: null,
|
|
450
|
-
required: !0,
|
|
451
|
-
type: "email"
|
|
452
|
-
},
|
|
453
|
-
{
|
|
454
|
-
name: "name",
|
|
455
|
-
max: 255,
|
|
456
|
-
required: !1,
|
|
457
|
-
type: "text"
|
|
458
|
-
},
|
|
459
|
-
{
|
|
460
|
-
name: "membership_id",
|
|
461
|
-
cascadeDelete: !1,
|
|
462
|
-
collectionId: e.id,
|
|
463
|
-
maxSelect: 1,
|
|
464
|
-
minSelect: 0,
|
|
465
|
-
required: !1,
|
|
466
|
-
type: "relation"
|
|
467
|
-
},
|
|
468
|
-
{
|
|
469
|
-
name: "team",
|
|
470
|
-
cascadeDelete: !0,
|
|
471
|
-
collectionId: y.id,
|
|
472
|
-
maxSelect: 1,
|
|
473
|
-
minSelect: 0,
|
|
474
|
-
required: !0,
|
|
475
|
-
type: "relation"
|
|
476
|
-
},
|
|
477
|
-
{
|
|
478
|
-
name: "role",
|
|
479
|
-
maxSelect: 1,
|
|
480
|
-
required: !0,
|
|
481
|
-
type: "select",
|
|
482
|
-
values: ["owner", "admin", "member"]
|
|
483
|
-
}
|
|
484
|
-
],
|
|
485
|
-
viewQuery: "select users.id, users.email, users.name, team_memberships.id as membership_id, team_memberships.team, team_memberships.role from users join team_memberships on team_memberships.user = users.id;"
|
|
486
|
-
}), v(n, "team_users", t), await d.collections.create({
|
|
487
|
-
name: "team_invites",
|
|
488
|
-
type: "base",
|
|
489
|
-
fields: [
|
|
490
|
-
{
|
|
491
|
-
name: "id",
|
|
492
|
-
type: "text",
|
|
493
|
-
primaryKey: !0,
|
|
494
|
-
autogeneratePattern: "[a-z0-9]{15}",
|
|
495
|
-
max: 15,
|
|
496
|
-
min: 15,
|
|
497
|
-
pattern: "^[a-z0-9]+$",
|
|
498
|
-
required: !0
|
|
499
|
-
},
|
|
500
|
-
{
|
|
501
|
-
name: "team",
|
|
502
|
-
type: "relation",
|
|
503
|
-
cascadeDelete: !0,
|
|
504
|
-
collectionId: y.id,
|
|
505
|
-
maxSelect: 1,
|
|
506
|
-
minSelect: 0,
|
|
507
|
-
required: !0
|
|
508
|
-
},
|
|
509
|
-
{
|
|
510
|
-
name: "email",
|
|
511
|
-
type: "email",
|
|
512
|
-
required: !0
|
|
513
|
-
},
|
|
514
|
-
{
|
|
515
|
-
name: "created",
|
|
516
|
-
onCreate: !0,
|
|
517
|
-
onUpdate: !1,
|
|
518
|
-
type: "autodate"
|
|
519
|
-
},
|
|
520
|
-
{
|
|
521
|
-
name: "updated",
|
|
522
|
-
onCreate: !0,
|
|
523
|
-
onUpdate: !0,
|
|
524
|
-
type: "autodate"
|
|
525
|
-
}
|
|
526
|
-
]
|
|
527
|
-
}), v(n, "team_invites", t), await d.collections.create({
|
|
528
|
-
name: "team_invite_links",
|
|
529
|
-
type: "base",
|
|
530
|
-
fields: [
|
|
531
|
-
{
|
|
532
|
-
name: "id",
|
|
533
|
-
autogeneratePattern: "[a-z0-9]{15}",
|
|
534
|
-
max: 15,
|
|
535
|
-
min: 15,
|
|
536
|
-
pattern: "^[a-z0-9]+$",
|
|
537
|
-
primaryKey: !0,
|
|
538
|
-
required: !0,
|
|
539
|
-
type: "text"
|
|
540
|
-
},
|
|
541
|
-
{
|
|
542
|
-
name: "team",
|
|
543
|
-
cascadeDelete: !0,
|
|
544
|
-
collectionId: y.id,
|
|
545
|
-
maxSelect: 1,
|
|
546
|
-
minSelect: 0,
|
|
547
|
-
required: !0,
|
|
548
|
-
type: "relation"
|
|
549
|
-
},
|
|
550
|
-
{
|
|
551
|
-
name: "created",
|
|
552
|
-
onCreate: !0,
|
|
553
|
-
onUpdate: !1,
|
|
554
|
-
type: "autodate"
|
|
555
|
-
},
|
|
556
|
-
{
|
|
557
|
-
name: "updated",
|
|
558
|
-
onCreate: !0,
|
|
559
|
-
onUpdate: !0,
|
|
560
|
-
type: "autodate"
|
|
561
|
-
}
|
|
562
|
-
],
|
|
563
|
-
indexes: [
|
|
564
|
-
"CREATE UNIQUE INDEX `idx_9y3Oz1KVzz` ON `team_invite_links` (`team`)"
|
|
565
|
-
]
|
|
566
|
-
}), v(n, "team_invite_links", t);
|
|
567
|
-
const a = await _(
|
|
568
|
-
d,
|
|
569
|
-
j,
|
|
570
|
-
t
|
|
571
|
-
);
|
|
572
|
-
n.push(...a);
|
|
573
|
-
});
|
|
574
|
-
const o = [], r = A.join(
|
|
575
|
-
t.root,
|
|
576
|
-
"src",
|
|
577
|
-
"routes",
|
|
578
|
-
"(app)",
|
|
579
|
-
"+layout.server.ts"
|
|
580
|
-
);
|
|
581
|
-
f.existsSync(r) && (R(r), o.push({
|
|
582
|
-
path: r,
|
|
583
|
-
language: "ts",
|
|
584
|
-
content: f.readFileSync(r, "utf8")
|
|
585
|
-
}));
|
|
586
|
-
const p = A.join(
|
|
587
|
-
t.root,
|
|
588
|
-
"src",
|
|
589
|
-
"routes",
|
|
590
|
-
"(app)",
|
|
591
|
-
"+layout.svelte"
|
|
592
|
-
);
|
|
593
|
-
f.existsSync(p) && L(p) && o.push({
|
|
594
|
-
path: p,
|
|
595
|
-
language: "svelte",
|
|
596
|
-
content: f.readFileSync(p, "utf8")
|
|
597
|
-
});
|
|
598
|
-
const m = A.join(
|
|
599
|
-
t.root,
|
|
600
|
-
"src",
|
|
601
|
-
"lib",
|
|
602
|
-
"components",
|
|
603
|
-
"app-sidebar.svelte"
|
|
604
|
-
);
|
|
605
|
-
f.existsSync(m) && q(m) && o.push({
|
|
606
|
-
path: m,
|
|
607
|
-
language: "svelte",
|
|
608
|
-
content: f.readFileSync(m, "utf8")
|
|
609
|
-
});
|
|
610
|
-
const g = A.join(
|
|
611
|
-
t.root,
|
|
612
|
-
"src",
|
|
613
|
-
"lib",
|
|
614
|
-
"components",
|
|
615
|
-
"nav-user.svelte"
|
|
616
|
-
);
|
|
617
|
-
return M(g) && o.push({
|
|
618
|
-
path: g,
|
|
619
|
-
language: "svelte",
|
|
620
|
-
content: f.readFileSync(g, "utf8")
|
|
621
|
-
}), {
|
|
622
|
-
creates: n,
|
|
623
|
-
modifies: o,
|
|
624
|
-
deletes: [],
|
|
625
|
-
components: [],
|
|
626
|
-
packages: [],
|
|
627
|
-
collections: []
|
|
628
|
-
};
|
|
629
|
-
}
|
|
630
|
-
export {
|
|
631
|
-
X as generate
|
|
632
|
-
};
|
|
633
|
-
//# sourceMappingURL=generate.runtime-DBTOrhnc.js.map
|