alinea 0.6.2 → 0.6.4
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/dist/backend/Database.js +36 -17
- package/dist/backend/Handler.d.ts +1 -1
- package/dist/backend/Handler.js +3 -3
- package/dist/backend/Previews.d.ts +3 -7
- package/dist/backend/util/JWTPreviews.d.ts +4 -3
- package/dist/chunks/{chunk-FO7WYIGB.js → chunk-TFVRT7UJ.js} +1 -12
- package/dist/chunks/chunk-UJJSVROY.js +3967 -0
- package/dist/cli/Init.js +1 -1
- package/dist/cli/Serve.js +17 -3
- package/dist/cli/bin.js +1 -1
- package/dist/cli/generate/GenerateDashboard.js +1 -1
- package/dist/cli/serve/CreateLocalServer.d.ts +2 -1
- package/dist/cli/serve/CreateLocalServer.js +2 -2
- package/dist/cli/serve/GitHistory.d.ts +2 -2
- package/dist/cli/serve/GitHistory.js +3 -3968
- package/dist/cloud/server/CloudAuthServer.js +1 -1
- package/dist/cloud/server/CloudDebugHandler.js +4 -1
- package/dist/core/Auth.js +2 -1
- package/dist/core/Entry.d.ts +1 -1
- package/dist/core/EntryRecord.d.ts +2 -2
- package/dist/core/EntryRecord.js +1 -2
- package/dist/core/EntryRow.d.ts +1 -1
- package/dist/core/EntryRow.js +1 -1
- package/dist/core/User.d.ts +4 -0
- package/dist/core/User.js +10 -0
- package/dist/core/driver/NextDriver.d.ts +8 -1
- package/dist/core/driver/NextDriver.server.js +44 -6
- package/dist/core/driver/NextPreviews.d.ts +9 -1
- package/dist/core/driver/NextPreviews.js +238 -3
- package/dist/dashboard/Routes.d.ts +20 -18
- package/dist/dashboard/Routes.js +46 -1
- package/dist/dashboard/atoms/DashboardAtoms.js +7 -2
- package/dist/dashboard/atoms/LocationAtoms.d.ts +1 -0
- package/dist/dashboard/atoms/LocationAtoms.js +6 -1
- package/dist/dashboard/atoms/RouterAtoms.d.ts +1 -1
- package/dist/dashboard/atoms/RouterAtoms.js +2 -1
- package/dist/dashboard/hook/UseUploads.js +1 -1
- package/dist/dashboard/view/entry/NewEntry.js +1 -1
- package/dist/ui/icons/IcRoundExitToApp.d.ts +2 -0
- package/dist/ui/icons/IcRoundExitToApp.js +26 -0
- package/package.json +1 -12
package/dist/backend/Database.js
CHANGED
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
Type,
|
|
21
21
|
Workspace,
|
|
22
22
|
createId,
|
|
23
|
+
slugify,
|
|
23
24
|
unreachable
|
|
24
25
|
} from "alinea/core";
|
|
25
26
|
import { entryInfo, entryUrl } from "alinea/core/EntryFilenames";
|
|
@@ -444,7 +445,7 @@ ${JSON.stringify(mutation)}`
|
|
|
444
445
|
workspace: meta.workspace,
|
|
445
446
|
root: meta.root,
|
|
446
447
|
filePath: meta.filePath,
|
|
447
|
-
seeded:
|
|
448
|
+
seeded: seed?.filePath ?? null,
|
|
448
449
|
modifiedAt: Date.now(),
|
|
449
450
|
// file.modifiedAt,
|
|
450
451
|
active: false,
|
|
@@ -478,10 +479,11 @@ ${JSON.stringify(mutation)}`
|
|
|
478
479
|
const target = locale ? `/${locale}` : "/";
|
|
479
480
|
while (pages.length > 0) {
|
|
480
481
|
const [pagePath, page] = pages.shift();
|
|
482
|
+
const path = pagePath.split("/").map(slugify).join("/");
|
|
481
483
|
if (!PageSeed.isPageSeed(page))
|
|
482
484
|
continue;
|
|
483
485
|
const { type } = PageSeed.data(page);
|
|
484
|
-
const filePath = paths.join(target,
|
|
486
|
+
const filePath = paths.join(target, path) + ".json";
|
|
485
487
|
const typeName = typeNames.get(type);
|
|
486
488
|
if (!typeName)
|
|
487
489
|
continue;
|
|
@@ -493,7 +495,7 @@ ${JSON.stringify(mutation)}`
|
|
|
493
495
|
page
|
|
494
496
|
});
|
|
495
497
|
const children = entries(page).map(
|
|
496
|
-
([childPath, child]) => [paths.join(
|
|
498
|
+
([childPath, child]) => [paths.join(path, childPath), child]
|
|
497
499
|
);
|
|
498
500
|
pages.push(...children);
|
|
499
501
|
}
|
|
@@ -511,7 +513,6 @@ ${JSON.stringify(mutation)}`
|
|
|
511
513
|
const seenSeeds = /* @__PURE__ */ new Set();
|
|
512
514
|
const inserted = [];
|
|
513
515
|
for await (const file of source.entries()) {
|
|
514
|
-
const seed = this.seed.get(file.filePath);
|
|
515
516
|
const fileHash = await createFileHash(file.contents);
|
|
516
517
|
const exists2 = await query(
|
|
517
518
|
EntryRow({
|
|
@@ -519,20 +520,29 @@ ${JSON.stringify(mutation)}`
|
|
|
519
520
|
filePath: file.filePath,
|
|
520
521
|
workspace: file.workspace,
|
|
521
522
|
root: file.root
|
|
522
|
-
}).select(
|
|
523
|
+
}).select({
|
|
524
|
+
versionId: EntryRow.versionId,
|
|
525
|
+
seeded: EntryRow.seeded
|
|
526
|
+
}).maybeFirst()
|
|
523
527
|
);
|
|
524
|
-
if (seed) {
|
|
525
|
-
seenSeeds.add(seed.filePath);
|
|
526
|
-
}
|
|
527
528
|
if (exists2) {
|
|
528
|
-
seenVersions.push(exists2);
|
|
529
|
+
seenVersions.push(exists2.versionId);
|
|
530
|
+
if (exists2.seeded)
|
|
531
|
+
seenSeeds.add(exists2.seeded);
|
|
532
|
+
else
|
|
533
|
+
seenSeeds.add(file.filePath);
|
|
529
534
|
continue;
|
|
530
535
|
}
|
|
531
536
|
try {
|
|
532
537
|
const raw = JsonLoader.parse(this.config.schema, file.contents);
|
|
533
|
-
const
|
|
534
|
-
|
|
535
|
-
|
|
538
|
+
const record = EntryRecord(raw);
|
|
539
|
+
const seeded = record[META_KEY]?.seeded;
|
|
540
|
+
const seed = typeof seeded === "string" ? this.seed.get(seeded) : void 0;
|
|
541
|
+
const entry = this.computeEntry(record, file, seed);
|
|
542
|
+
if (seed)
|
|
543
|
+
seenSeeds.add(seed.filePath);
|
|
544
|
+
else
|
|
545
|
+
seenSeeds.add(file.filePath);
|
|
536
546
|
await query(
|
|
537
547
|
EntryRow({ entryId: entry.entryId, phase: entry.phase }).delete()
|
|
538
548
|
);
|
|
@@ -547,22 +557,32 @@ ${JSON.stringify(mutation)}`
|
|
|
547
557
|
console.log(`> skipped ${file.filePath} \u2014 ${e2.message}`);
|
|
548
558
|
}
|
|
549
559
|
}
|
|
550
|
-
const
|
|
551
|
-
for (const seedPath of
|
|
560
|
+
const stableI18nIds = /* @__PURE__ */ new Map();
|
|
561
|
+
for (const [seedPath, seed] of this.seed.entries()) {
|
|
552
562
|
if (seenSeeds.has(seedPath))
|
|
553
563
|
continue;
|
|
554
|
-
const seed = this.seed.get(seedPath);
|
|
555
564
|
const { type, partial } = PageSeed.data(seed.page);
|
|
556
565
|
const typeName = typeNames.get(type);
|
|
557
566
|
if (!typeName)
|
|
558
567
|
continue;
|
|
568
|
+
const root = this.config.workspaces[seed.workspace][seed.root];
|
|
569
|
+
const { i18n } = Root.data(root);
|
|
570
|
+
let i18nId = createId();
|
|
571
|
+
if (i18n) {
|
|
572
|
+
const [, locale, ...rest] = seed.filePath.split("/");
|
|
573
|
+
const path = rest.join("/");
|
|
574
|
+
i18nId = stableI18nIds.get(path) ?? createId();
|
|
575
|
+
stableI18nIds.set(path, i18nId);
|
|
576
|
+
}
|
|
559
577
|
const entry = this.computeEntry(
|
|
560
578
|
{
|
|
561
579
|
title: partial.title ?? "",
|
|
562
580
|
[META_KEY]: {
|
|
563
581
|
entryId: createId(),
|
|
582
|
+
i18nId,
|
|
564
583
|
type: typeName,
|
|
565
|
-
index: "a0"
|
|
584
|
+
index: "a0",
|
|
585
|
+
seeded: seed.filePath
|
|
566
586
|
}
|
|
567
587
|
},
|
|
568
588
|
seed,
|
|
@@ -578,7 +598,6 @@ ${JSON.stringify(mutation)}`
|
|
|
578
598
|
inserted.push(`${entry.entryId}.${entry.phase}`);
|
|
579
599
|
publishSeed.push({
|
|
580
600
|
...withHash,
|
|
581
|
-
seeded: true,
|
|
582
601
|
title: void 0,
|
|
583
602
|
data: {}
|
|
584
603
|
});
|
package/dist/backend/Handler.js
CHANGED
|
@@ -43,7 +43,7 @@ var Handler = class {
|
|
|
43
43
|
this.parsePreview.bind(this)
|
|
44
44
|
);
|
|
45
45
|
this.changes = new ChangeSetCreator(options.config);
|
|
46
|
-
const auth = options.auth
|
|
46
|
+
const auth = options.auth ?? Auth.anonymous();
|
|
47
47
|
this.connect = (ctx) => new HandlerConnection(this, ctx);
|
|
48
48
|
this.router = createRouter(auth, this.connect);
|
|
49
49
|
}
|
|
@@ -169,8 +169,8 @@ var HandlerConnection = class {
|
|
|
169
169
|
const { previews } = this.handler.options;
|
|
170
170
|
const user = this.ctx.user;
|
|
171
171
|
if (!user)
|
|
172
|
-
|
|
173
|
-
return previews.sign(
|
|
172
|
+
throw new Error("Unauthorized, user not available");
|
|
173
|
+
return previews.sign(user);
|
|
174
174
|
}
|
|
175
175
|
// Media
|
|
176
176
|
prepareUpload(file) {
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
sub: string;
|
|
3
|
-
} | {
|
|
4
|
-
anonymous: true;
|
|
5
|
-
};
|
|
1
|
+
import { User } from 'alinea/core';
|
|
6
2
|
export interface Previews {
|
|
7
|
-
sign(data:
|
|
8
|
-
verify(token: string): Promise<
|
|
3
|
+
sign(data: User): Promise<string>;
|
|
4
|
+
verify(token: string): Promise<User>;
|
|
9
5
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { User } from 'alinea/core';
|
|
2
|
+
import { Previews } from '../Previews.js';
|
|
2
3
|
export declare class JWTPreviews implements Previews {
|
|
3
4
|
private secret;
|
|
4
5
|
constructor(secret: string);
|
|
5
|
-
sign(data:
|
|
6
|
-
verify(token: string): Promise<
|
|
6
|
+
sign(data: User): Promise<string>;
|
|
7
|
+
verify(token: string): Promise<User>;
|
|
7
8
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
var package_default = {
|
|
3
3
|
bin: "./dist/cli.js",
|
|
4
4
|
name: "alinea",
|
|
5
|
-
version: "0.6.
|
|
5
|
+
version: "0.6.4",
|
|
6
6
|
license: "MIT",
|
|
7
7
|
type: "module",
|
|
8
8
|
scripts: {
|
|
@@ -39,17 +39,6 @@ var package_default = {
|
|
|
39
39
|
files: [
|
|
40
40
|
"dist"
|
|
41
41
|
],
|
|
42
|
-
workspaces: [
|
|
43
|
-
"apps/web",
|
|
44
|
-
"apps/dev",
|
|
45
|
-
"src/backend",
|
|
46
|
-
"src/cli",
|
|
47
|
-
"src/core",
|
|
48
|
-
"src/dashboard",
|
|
49
|
-
"src/ui",
|
|
50
|
-
"src/auth/passwordless",
|
|
51
|
-
"src/input/richtext"
|
|
52
|
-
],
|
|
53
42
|
dependencies: {
|
|
54
43
|
"@alinea/iso": "^0.3.1",
|
|
55
44
|
"@alinea/sqlite-wasm": "^0.1.14",
|