@blinkk/root-cms 2.5.16 → 3.0.1-alpha.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/dist/app.js +6 -8
- package/dist/{chunk-JGLMVZE4.js → chunk-BBOESYH7.js} +10 -14
- package/dist/{chunk-HDIPAT3C.js → chunk-R4LKO3EZ.js} +25 -25
- package/dist/{chunk-JUCNU5AP.js → chunk-SNZ4S4IC.js} +23 -83
- package/dist/chunk-UTSL2E2P.js +921 -0
- package/dist/cli.js +1 -1
- package/dist/{client-B_oDIGeJ.d.ts → client-DdB4xpM6.d.ts} +127 -35
- package/dist/client.d.ts +2 -2
- package/dist/client.js +1 -1
- package/dist/core.d.ts +3 -3
- package/dist/core.js +7 -1
- package/dist/functions.js +2 -2
- package/dist/plugin.d.ts +2 -2
- package/dist/plugin.js +88 -4
- package/dist/project.d.ts +3 -16
- package/dist/project.js +1 -3
- package/dist/{schema-D7MOj-YC.d.ts → schema-rjBOZk-j.d.ts} +61 -1
- package/dist/ui/signin.css +1 -1
- package/dist/ui/signin.js +3 -3
- package/dist/ui/ui.css +1 -1
- package/dist/ui/ui.js +166 -160
- package/dist/ui/ui.js.LEGAL.txt +14 -3
- package/package.json +11 -15
- package/dist/chunk-DKM5LHW3.js +0 -157
package/dist/ui/ui.js.LEGAL.txt
CHANGED
|
@@ -473,33 +473,37 @@ react-is/cjs/react-is.production.min.js:
|
|
|
473
473
|
@tabler/icons-preact/dist/esm/icons/IconAlarmOff.mjs:
|
|
474
474
|
@tabler/icons-preact/dist/esm/icons/IconAlertTriangle.mjs:
|
|
475
475
|
@tabler/icons-preact/dist/esm/icons/IconAlignJustified.mjs:
|
|
476
|
-
@tabler/icons-preact/dist/esm/icons/IconArchiveOff.mjs:
|
|
477
476
|
@tabler/icons-preact/dist/esm/icons/IconArchive.mjs:
|
|
478
477
|
@tabler/icons-preact/dist/esm/icons/IconArrowBackUp.mjs:
|
|
479
478
|
@tabler/icons-preact/dist/esm/icons/IconArrowBack.mjs:
|
|
480
479
|
@tabler/icons-preact/dist/esm/icons/IconArrowLeft.mjs:
|
|
481
|
-
@tabler/icons-preact/dist/esm/icons/
|
|
480
|
+
@tabler/icons-preact/dist/esm/icons/IconArrowRight.mjs:
|
|
482
481
|
@tabler/icons-preact/dist/esm/icons/IconArrowUpRight.mjs:
|
|
483
482
|
@tabler/icons-preact/dist/esm/icons/IconArrowsHorizontal.mjs:
|
|
484
483
|
@tabler/icons-preact/dist/esm/icons/IconArrowsVertical.mjs:
|
|
485
484
|
@tabler/icons-preact/dist/esm/icons/IconBold.mjs:
|
|
486
|
-
@tabler/icons-preact/dist/esm/icons/IconBox.mjs:
|
|
487
485
|
@tabler/icons-preact/dist/esm/icons/IconBraces.mjs:
|
|
488
486
|
@tabler/icons-preact/dist/esm/icons/IconBracketsAngle.mjs:
|
|
487
|
+
@tabler/icons-preact/dist/esm/icons/IconCalendar.mjs:
|
|
489
488
|
@tabler/icons-preact/dist/esm/icons/IconCapsuleHorizontal.mjs:
|
|
490
489
|
@tabler/icons-preact/dist/esm/icons/IconCarrot.mjs:
|
|
491
490
|
@tabler/icons-preact/dist/esm/icons/IconCheck.mjs:
|
|
492
491
|
@tabler/icons-preact/dist/esm/icons/IconChevronDown.mjs:
|
|
492
|
+
@tabler/icons-preact/dist/esm/icons/IconChevronRight.mjs:
|
|
493
493
|
@tabler/icons-preact/dist/esm/icons/IconCircleArrowDown.mjs:
|
|
494
494
|
@tabler/icons-preact/dist/esm/icons/IconCircleArrowUp.mjs:
|
|
495
495
|
@tabler/icons-preact/dist/esm/icons/IconCirclePlus.mjs:
|
|
496
496
|
@tabler/icons-preact/dist/esm/icons/IconClearFormatting.mjs:
|
|
497
497
|
@tabler/icons-preact/dist/esm/icons/IconClipboardCheck.mjs:
|
|
498
498
|
@tabler/icons-preact/dist/esm/icons/IconClipboardCopy.mjs:
|
|
499
|
+
@tabler/icons-preact/dist/esm/icons/IconClipboardList.mjs:
|
|
499
500
|
@tabler/icons-preact/dist/esm/icons/IconClipboard.mjs:
|
|
501
|
+
@tabler/icons-preact/dist/esm/icons/IconClock.mjs:
|
|
500
502
|
@tabler/icons-preact/dist/esm/icons/IconCloudOff.mjs:
|
|
501
503
|
@tabler/icons-preact/dist/esm/icons/IconCode.mjs:
|
|
504
|
+
@tabler/icons-preact/dist/esm/icons/IconColumns3.mjs:
|
|
502
505
|
@tabler/icons-preact/dist/esm/icons/IconCopy.mjs:
|
|
506
|
+
@tabler/icons-preact/dist/esm/icons/IconCornerDownRight.mjs:
|
|
503
507
|
@tabler/icons-preact/dist/esm/icons/IconCrop.mjs:
|
|
504
508
|
@tabler/icons-preact/dist/esm/icons/IconDatabase.mjs:
|
|
505
509
|
@tabler/icons-preact/dist/esm/icons/IconDeviceDesktop.mjs:
|
|
@@ -513,7 +517,9 @@ react-is/cjs/react-is.production.min.js:
|
|
|
513
517
|
@tabler/icons-preact/dist/esm/icons/IconFileDiff.mjs:
|
|
514
518
|
@tabler/icons-preact/dist/esm/icons/IconFileDownload.mjs:
|
|
515
519
|
@tabler/icons-preact/dist/esm/icons/IconFileUpload.mjs:
|
|
520
|
+
@tabler/icons-preact/dist/esm/icons/IconFile.mjs:
|
|
516
521
|
@tabler/icons-preact/dist/esm/icons/IconFilter.mjs:
|
|
522
|
+
@tabler/icons-preact/dist/esm/icons/IconFlag.mjs:
|
|
517
523
|
@tabler/icons-preact/dist/esm/icons/IconFolder.mjs:
|
|
518
524
|
@tabler/icons-preact/dist/esm/icons/IconGitCompare.mjs:
|
|
519
525
|
@tabler/icons-preact/dist/esm/icons/IconGripVertical.mjs:
|
|
@@ -529,6 +535,8 @@ react-is/cjs/react-is.production.min.js:
|
|
|
529
535
|
@tabler/icons-preact/dist/esm/icons/IconJson.mjs:
|
|
530
536
|
@tabler/icons-preact/dist/esm/icons/IconLanguageOff.mjs:
|
|
531
537
|
@tabler/icons-preact/dist/esm/icons/IconLanguage.mjs:
|
|
538
|
+
@tabler/icons-preact/dist/esm/icons/IconLayoutGrid.mjs:
|
|
539
|
+
@tabler/icons-preact/dist/esm/icons/IconLayoutList.mjs:
|
|
532
540
|
@tabler/icons-preact/dist/esm/icons/IconLayoutSidebarRightCollapse.mjs:
|
|
533
541
|
@tabler/icons-preact/dist/esm/icons/IconLayoutSidebarRightExpand.mjs:
|
|
534
542
|
@tabler/icons-preact/dist/esm/icons/IconLink.mjs:
|
|
@@ -540,6 +548,7 @@ react-is/cjs/react-is.production.min.js:
|
|
|
540
548
|
@tabler/icons-preact/dist/esm/icons/IconLock.mjs:
|
|
541
549
|
@tabler/icons-preact/dist/esm/icons/IconLogout.mjs:
|
|
542
550
|
@tabler/icons-preact/dist/esm/icons/IconMapPin.mjs:
|
|
551
|
+
@tabler/icons-preact/dist/esm/icons/IconMessageCircle.mjs:
|
|
543
552
|
@tabler/icons-preact/dist/esm/icons/IconMessage.mjs:
|
|
544
553
|
@tabler/icons-preact/dist/esm/icons/IconMoodLookDown.mjs:
|
|
545
554
|
@tabler/icons-preact/dist/esm/icons/IconPackage.mjs:
|
|
@@ -577,6 +586,8 @@ react-is/cjs/react-is.production.min.js:
|
|
|
577
586
|
@tabler/icons-preact/dist/esm/icons/IconTool.mjs:
|
|
578
587
|
@tabler/icons-preact/dist/esm/icons/IconTrash.mjs:
|
|
579
588
|
@tabler/icons-preact/dist/esm/icons/IconUnderline.mjs:
|
|
589
|
+
@tabler/icons-preact/dist/esm/icons/IconUserPlus.mjs:
|
|
590
|
+
@tabler/icons-preact/dist/esm/icons/IconUser.mjs:
|
|
580
591
|
@tabler/icons-preact/dist/esm/icons/IconWorld.mjs:
|
|
581
592
|
@tabler/icons-preact/dist/esm/icons/IconX.mjs:
|
|
582
593
|
@tabler/icons-preact/dist/esm/icons/IconCircleCheckFilled.mjs:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blinkk/root-cms",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.1-alpha.1",
|
|
4
4
|
"author": "s@blinkk.com",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -11,9 +11,6 @@
|
|
|
11
11
|
"url": "git+https://github.com/blinkk/rootjs.git",
|
|
12
12
|
"directory": "packages/root-cms"
|
|
13
13
|
},
|
|
14
|
-
"publishConfig": {
|
|
15
|
-
"provenance": true
|
|
16
|
-
},
|
|
17
14
|
"files": [
|
|
18
15
|
"dist/**/*"
|
|
19
16
|
],
|
|
@@ -73,10 +70,12 @@
|
|
|
73
70
|
"date-fns-tz": "3.2.0",
|
|
74
71
|
"diff": "8.0.2",
|
|
75
72
|
"dts-dom": "3.7.0",
|
|
73
|
+
"@mantine/spotlight": "4.2.12",
|
|
76
74
|
"fnv-plus": "1.3.1",
|
|
77
75
|
"genkit": "1.26.0",
|
|
78
76
|
"jsonwebtoken": "9.0.2",
|
|
79
77
|
"kleur": "4.1.5",
|
|
78
|
+
"minisearch": "7.2.0",
|
|
80
79
|
"sirv": "2.0.3",
|
|
81
80
|
"tiny-glob": "0.2.9"
|
|
82
81
|
},
|
|
@@ -109,7 +108,6 @@
|
|
|
109
108
|
"@mantine/hooks": "4.2.12",
|
|
110
109
|
"@mantine/modals": "4.2.12",
|
|
111
110
|
"@mantine/notifications": "4.2.12",
|
|
112
|
-
"@mantine/spotlight": "4.2.12",
|
|
113
111
|
"@preact/compat": "18.3.1",
|
|
114
112
|
"@tabler/icons-preact": "3.35.0",
|
|
115
113
|
"@testing-library/preact": "3.2.4",
|
|
@@ -122,8 +120,8 @@
|
|
|
122
120
|
"@types/google.accounts": "0.0.14",
|
|
123
121
|
"@types/jsonwebtoken": "9.0.1",
|
|
124
122
|
"@types/node": "24.3.1",
|
|
125
|
-
"@vitest/browser": "4.
|
|
126
|
-
"@vitest/browser-playwright": "4.
|
|
123
|
+
"@vitest/browser": "4.1.2",
|
|
124
|
+
"@vitest/browser-playwright": "4.1.2",
|
|
127
125
|
"concurrently": "7.6.0",
|
|
128
126
|
"esbuild": "0.25.9",
|
|
129
127
|
"firebase": "12.2.1",
|
|
@@ -141,24 +139,22 @@
|
|
|
141
139
|
"playwright": "1.56.1",
|
|
142
140
|
"preact": "10.27.1",
|
|
143
141
|
"preact-iso": "2.11.1",
|
|
144
|
-
"preact-render-to-string": "6.6.
|
|
142
|
+
"preact-render-to-string": "6.6.7",
|
|
145
143
|
"react": "npm:@preact/compat@18.3.1",
|
|
146
144
|
"react-dom": "npm:@preact/compat@18.3.1",
|
|
147
145
|
"react-easy-crop": "5.5.6",
|
|
148
146
|
"react-json-view-compare": "2.0.2",
|
|
149
147
|
"tsup": "8.5.0",
|
|
150
148
|
"typescript": "5.9.2",
|
|
151
|
-
"vite": "
|
|
152
|
-
"vitest": "4.
|
|
149
|
+
"vite": "8.0.3",
|
|
150
|
+
"vitest": "4.1.2",
|
|
153
151
|
"yjs": "13.6.27",
|
|
154
|
-
"@blinkk/root": "
|
|
152
|
+
"@blinkk/root": "3.0.1-alpha.1"
|
|
155
153
|
},
|
|
156
154
|
"peerDependencies": {
|
|
157
|
-
"@blinkk/root": "
|
|
155
|
+
"@blinkk/root": "3.0.1-alpha.1",
|
|
158
156
|
"firebase-admin": ">=11",
|
|
159
|
-
"firebase-functions": ">=4"
|
|
160
|
-
"preact": ">=10",
|
|
161
|
-
"preact-render-to-string": ">=5"
|
|
157
|
+
"firebase-functions": ">=4"
|
|
162
158
|
},
|
|
163
159
|
"peerDependenciesMeta": {
|
|
164
160
|
"firebase-functions": {
|
package/dist/chunk-DKM5LHW3.js
DELETED
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
RootCMSClient,
|
|
3
|
-
getCmsPlugin
|
|
4
|
-
} from "./chunk-JUCNU5AP.js";
|
|
5
|
-
|
|
6
|
-
// core/versions.ts
|
|
7
|
-
import fs from "fs";
|
|
8
|
-
import path from "path";
|
|
9
|
-
import { Timestamp } from "firebase-admin/firestore";
|
|
10
|
-
import glob from "tiny-glob";
|
|
11
|
-
var DOCUMENT_SAVE_OFFSET = 5 * 60 * 1e3;
|
|
12
|
-
var VersionsService = class {
|
|
13
|
-
constructor(rootConfig) {
|
|
14
|
-
this.rootConfig = rootConfig;
|
|
15
|
-
const cmsPlugin = getCmsPlugin(rootConfig);
|
|
16
|
-
const cmsPluginOptions = cmsPlugin.getConfig();
|
|
17
|
-
const projectId = cmsPluginOptions.id || "default";
|
|
18
|
-
this.projectId = projectId;
|
|
19
|
-
this.db = cmsPlugin.getFirestore();
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Saves a version of all documents that have been edited since the last run.
|
|
23
|
-
*/
|
|
24
|
-
async saveVersions() {
|
|
25
|
-
const lastRun = await this.getLastRun();
|
|
26
|
-
const lastRunWithOffset = lastRun === 0 ? lastRun : lastRun - DOCUMENT_SAVE_OFFSET;
|
|
27
|
-
const changedDocs = await this.getDocsModifiedAfter(lastRunWithOffset);
|
|
28
|
-
const now = Timestamp.now().toMillis();
|
|
29
|
-
const versions = changedDocs.filter((doc) => {
|
|
30
|
-
const modifiedAt = doc.sys.modifiedAt.toMillis();
|
|
31
|
-
if (modifiedAt > now - DOCUMENT_SAVE_OFFSET) {
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
const publishedAt = doc.sys.publishedAt?.toMillis?.();
|
|
35
|
-
if (publishedAt && Math.abs(publishedAt - modifiedAt) < 5e3) {
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
return true;
|
|
39
|
-
});
|
|
40
|
-
if (versions.length > 0) {
|
|
41
|
-
this.saveVersionsToFirestore(versions);
|
|
42
|
-
}
|
|
43
|
-
this.saveLastRun(now);
|
|
44
|
-
}
|
|
45
|
-
async saveVersionsToFirestore(versions) {
|
|
46
|
-
const batch = this.db.batch();
|
|
47
|
-
versions.forEach((version) => {
|
|
48
|
-
if (!version.collection || !version.slug || !version.sys?.modifiedAt) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
const modifiedAtMillis = version.sys.modifiedAt.toMillis();
|
|
52
|
-
const versionPath = `Projects/${this.projectId}/Collections/${version.collection}/Drafts/${version.slug}/Versions/${modifiedAtMillis}`;
|
|
53
|
-
console.log(versionPath);
|
|
54
|
-
const versionRef = this.db.doc(versionPath);
|
|
55
|
-
batch.set(versionRef, version);
|
|
56
|
-
});
|
|
57
|
-
await batch.commit();
|
|
58
|
-
console.log(`versions: saved ${versions.length} versions`);
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Returns the last time (in millis) saveVersions() was run, or 0 if has
|
|
62
|
-
* never been run.
|
|
63
|
-
*/
|
|
64
|
-
async getLastRun() {
|
|
65
|
-
const projectDocRef = this.db.collection("Projects").doc(this.projectId);
|
|
66
|
-
const projectDoc = await projectDocRef.get();
|
|
67
|
-
if (projectDoc.exists) {
|
|
68
|
-
const data = projectDoc.data() || {};
|
|
69
|
-
const ts = data.versionsLastRun;
|
|
70
|
-
if (ts) {
|
|
71
|
-
return ts.toMillis();
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return 0;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Saves {versionLastRun: <timestamp>} to the Projects/<projectId> doc.
|
|
78
|
-
*/
|
|
79
|
-
async saveLastRun(millis) {
|
|
80
|
-
const ts = Timestamp.fromMillis(millis);
|
|
81
|
-
const projectDocRef = this.db.collection("Projects").doc(this.projectId);
|
|
82
|
-
await projectDocRef.set({ versionsLastRun: ts }, { merge: true });
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Returns a list of all docs that were edited after a certain time.
|
|
86
|
-
*/
|
|
87
|
-
async getDocsModifiedAfter(millis) {
|
|
88
|
-
const ts = Timestamp.fromMillis(millis);
|
|
89
|
-
const results = [];
|
|
90
|
-
const collectionIds = await this.listCollections();
|
|
91
|
-
for (const collectionId of collectionIds) {
|
|
92
|
-
const collectionPath = `Projects/${this.projectId}/Collections/${collectionId}/Drafts`;
|
|
93
|
-
const query = this.db.collection(collectionPath).where("sys.modifiedAt", ">=", ts);
|
|
94
|
-
const querySnapshot = await query.get();
|
|
95
|
-
querySnapshot.forEach((doc) => {
|
|
96
|
-
results.push(doc.data());
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
return results;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Returns a list of collection ids for the Root project.
|
|
103
|
-
*/
|
|
104
|
-
async listCollections() {
|
|
105
|
-
const collectionsDir = path.join(this.rootConfig.rootDir, "collections");
|
|
106
|
-
if (!fs.existsSync(collectionsDir)) {
|
|
107
|
-
return [];
|
|
108
|
-
}
|
|
109
|
-
const collectionIds = [];
|
|
110
|
-
const collectionFileNames = await glob("*.schema.ts", {
|
|
111
|
-
cwd: collectionsDir
|
|
112
|
-
});
|
|
113
|
-
collectionFileNames.forEach((filename) => {
|
|
114
|
-
collectionIds.push(filename.slice(0, -10));
|
|
115
|
-
});
|
|
116
|
-
return collectionIds;
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
// core/cron.ts
|
|
121
|
-
async function runCronJobs(rootConfig) {
|
|
122
|
-
await Promise.all([
|
|
123
|
-
runCronJob("publishScheduledDocs", runPublishScheduledDocs, rootConfig),
|
|
124
|
-
runCronJob(
|
|
125
|
-
"syncScheduledDataSources",
|
|
126
|
-
runSyncScheduledDataSources,
|
|
127
|
-
rootConfig
|
|
128
|
-
),
|
|
129
|
-
runCronJob("saveVersions", runSaveVersions, rootConfig)
|
|
130
|
-
]);
|
|
131
|
-
}
|
|
132
|
-
async function runCronJob(name, fn, ...args) {
|
|
133
|
-
try {
|
|
134
|
-
await fn(...args);
|
|
135
|
-
} catch (err) {
|
|
136
|
-
console.log(`cron failed: ${name}`);
|
|
137
|
-
console.error(String(err.stack || err));
|
|
138
|
-
throw err;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
async function runPublishScheduledDocs(rootConfig) {
|
|
142
|
-
const cmsClient = new RootCMSClient(rootConfig);
|
|
143
|
-
await cmsClient.publishScheduledDocs();
|
|
144
|
-
await cmsClient.publishScheduledReleases();
|
|
145
|
-
}
|
|
146
|
-
async function runSyncScheduledDataSources(rootConfig) {
|
|
147
|
-
const cmsClient = new RootCMSClient(rootConfig);
|
|
148
|
-
await cmsClient.syncScheduledDataSources();
|
|
149
|
-
}
|
|
150
|
-
async function runSaveVersions(rootConfig) {
|
|
151
|
-
const service = new VersionsService(rootConfig);
|
|
152
|
-
await service.saveVersions();
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
export {
|
|
156
|
-
runCronJobs
|
|
157
|
-
};
|