@tiddlywiki/mws 0.1.14 → 0.2.0
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 +41 -20
- package/dist/metafile-esm.json +1 -1
- package/dist/mws.js +40120 -20116
- package/dist/mws.js.map +1 -1
- package/mws.run.mjs +28 -8
- package/package.json +20 -33
- package/plugins/client/plugin.info +1 -1
- package/plugins/client/src/multiwikiclientadaptor.ts +6 -34
- package/plugins/client/src/mws.d.ts +2 -1
- package/plugins/client/src/new-multiwikiclientadaptor.ts +634 -0
- package/plugins/client/src/types.d.ts +2531 -1036
- package/plugins/client/tiddlers/managetiddleraction.js +0 -5
- package/plugins/client/tiddlers/syncer/new-multiwikiclientadaptor.js +432 -0
- package/plugins/client/tiddlers/syncer/syncer.js +123 -241
- package/plugins/client/tsconfig.json +5 -1
- package/prisma/browser.ts +2 -0
- package/prisma/client/browser.ts +84 -0
- package/prisma/client/client.ts +108 -0
- package/prisma/client/commonInputTypes.ts +598 -0
- package/prisma/client/enums.ts +42 -0
- package/prisma/client/internal/class.ts +326 -0
- package/prisma/client/internal/prismaNamespace.ts +1870 -0
- package/prisma/client/internal/prismaNamespaceBrowser.ts +259 -0
- package/prisma/client/models/Bag.ts +1701 -0
- package/prisma/client/models/BagPermission.ts +1284 -0
- package/prisma/client/models/Recipe.ts +1722 -0
- package/prisma/client/models/RecipeBag.ts +1518 -0
- package/prisma/client/models/RecipePermission.ts +1284 -0
- package/prisma/client/models/Roles.ts +1316 -0
- package/prisma/client/models/Sessions.ts +1344 -0
- package/prisma/client/models/Settings.ts +1093 -0
- package/prisma/client/models/Template.ts +1477 -0
- package/prisma/client/models/TemplatePermission.ts +1284 -0
- package/prisma/client/models/Tiddler.ts +1434 -0
- package/prisma/client/models/TiddlerEvent.ts +1360 -0
- package/prisma/client/models/Users.ts +1579 -0
- package/prisma/client/models.ts +24 -0
- package/prisma/client/pjtg.ts +183 -0
- package/prisma/index.ts +74 -0
- package/prisma/migrations/20260708160259_init/migration.sql +172 -0
- package/prisma/migrations-v1/migration_lock.toml +3 -0
- package/prisma/package.json +12 -0
- package/prisma/schema.prisma +147 -89
- package/prisma/types.ts +9 -0
- package/public/.default.html +1 -0
- package/public/admin-vanilla/fish.svg +399 -0
- package/public/admin-vanilla/fish2.svg +389 -0
- package/public/admin-vanilla/main-64WYHWYI.js +1791 -0
- package/public/admin-vanilla/main-64WYHWYI.js.map +7 -0
- package/public/admin-vanilla/main-LYDE4NDJ.css +1 -0
- package/public/admin-vanilla/normalize.css +349 -0
- package/public/admin-vanilla/polyfill-ADOI2A4V.js +2 -0
- package/public/admin-vanilla/polyfill-ADOI2A4V.js.map +7 -0
- package/public/{react-admin → admin-vanilla}/site.webmanifest +1 -1
- package/public/admin-vanilla.html +62 -0
- package/public/admin-vanilla.json +1 -0
- package/public/{react-admin → stats}/stats.html +5 -2
- package/public/{react-admin → stats}/stats.js +2 -1
- package/scripts/build-docs.sh +30 -0
- package/scripts/helpers.mjs +107 -0
- package/scripts/json.js +8 -0
- package/scripts/scripts.mjs +114 -0
- package/prisma/client/client.d.ts +0 -1
- package/prisma/client/client.js +0 -3
- package/prisma/client/default.d.ts +0 -1
- package/prisma/client/default.js +0 -3
- package/prisma/client/edge.d.ts +0 -1
- package/prisma/client/edge.js +0 -297
- package/prisma/client/index-browser.js +0 -275
- package/prisma/client/index.d.ts +0 -17770
- package/prisma/client/index.js +0 -324
- package/prisma/client/package.json +0 -173
- package/prisma/client/query_engine_bg.js +0 -811
- package/prisma/client/query_engine_bg.wasm +0 -0
- package/prisma/client/runtime/edge-esm.js +0 -10000
- package/prisma/client/runtime/edge.js +0 -10036
- package/prisma/client/runtime/index-browser.d.ts +0 -370
- package/prisma/client/runtime/index-browser.js +0 -2300
- package/prisma/client/runtime/library.d.ts +0 -3681
- package/prisma/client/runtime/library.js +0 -10604
- package/prisma/client/runtime/react-native.js +0 -10629
- package/prisma/client/runtime/wasm-compiler-edge.js +0 -11238
- package/prisma/client/runtime/wasm-engine-edge.js +0 -7801
- package/prisma/client/schema.prisma +0 -156
- package/prisma/client/wasm-edge-light-loader.mjs +0 -4
- package/prisma/client/wasm-worker-loader.mjs +0 -4
- package/prisma/client/wasm.d.ts +0 -1
- package/prisma/client/wasm.js +0 -304
- package/prisma/global.ts +0 -53
- package/public/react-admin/chunk-YALWN5OT.js +0 -2
- package/public/react-admin/esm-L4WLVWJN.js +0 -3
- package/public/react-admin/esm-L4WLVWJN.js.map +0 -7
- package/public/react-admin/esm-QMNGI3LF.js +0 -3
- package/public/react-admin/esm-QMNGI3LF.js.map +0 -7
- package/public/react-admin/index.html +0 -36
- package/public/react-admin/main.js +0 -268
- package/public/react-admin/main.js.map +0 -7
- package/public/react-admin/stats.json +0 -1
- package/scripts.mjs +0 -142
- /package/prisma/{migrations → migrations-v1}/20250606001949_init/migration.sql +0 -0
- /package/prisma/{migrations → migrations-v1}/20250613000526_remove_group/migration.sql +0 -0
- /package/prisma/{migrations → migrations-v1}/20250620014502_settings/migration.sql +0 -0
- /package/prisma/{migrations → migrations-v1}/20250707205229_recipes/migration.sql +0 -0
- /package/public/{react-admin → admin-vanilla}/android-chrome-192x192.png +0 -0
- /package/public/{react-admin → admin-vanilla}/android-chrome-512x512.png +0 -0
- /package/public/{react-admin → admin-vanilla}/apple-touch-icon.png +0 -0
- /package/public/{react-admin → admin-vanilla}/favicon-16x16.png +0 -0
- /package/public/{react-admin → admin-vanilla}/favicon-32x32.png +0 -0
- /package/public/{react-admin → admin-vanilla}/favicon.ico +0 -0
- /package/public/{react-admin → admin-vanilla}/favicon.png +0 -0
- /package/public/{react-admin/chunk-YALWN5OT.js.map → admin-vanilla/main-LYDE4NDJ.css.map} +0 -0
- /package/public/{react-admin → admin-vanilla}/missing-favicon.png +0 -0
- /package/public/{react-admin → admin-vanilla}/motovun-jack.jpg +0 -0
- /package/public/{react-admin → admin-vanilla}/mws-icon.png +0 -0
- /package/public/{react-admin → admin-vanilla}/vite.svg +0 -0
- /package/public/{react-admin → stats}/stats.css +0 -0
- /package/public/{react-admin → stats}/stats.svg +0 -0
package/mws.run.mjs
CHANGED
|
@@ -3,28 +3,48 @@
|
|
|
3
3
|
import { existsSync, readFileSync, } from "fs";
|
|
4
4
|
|
|
5
5
|
const cwd = process.cwd();
|
|
6
|
+
|
|
6
7
|
/** @type {import("./package.json") | null} */
|
|
7
|
-
const pkg = existsSync(`${cwd}/package.json`)
|
|
8
|
-
? tryParseJSON(readFileSync(`${cwd}/package.json`, "utf8"))
|
|
9
|
-
: null;
|
|
8
|
+
const pkg = existsSync(`${cwd}/package.json`) && tryParseJSON(readFileSync(`${cwd}/package.json`, "utf8")) || null;
|
|
10
9
|
|
|
11
|
-
if(pkg
|
|
10
|
+
if (pkg && pkg.name === "@tiddlywiki/mws" && existsSync(`${cwd}/mws.dev.mjs`)) {
|
|
12
11
|
console.error("This appears to be a development version of MWS.");
|
|
13
12
|
process.exit(1);
|
|
14
13
|
}
|
|
15
14
|
|
|
16
|
-
if(
|
|
15
|
+
if (pkg && pkg.name === "@tiddlywiki/mws-instance" && pkg.private) {
|
|
16
|
+
if (pkg.version !== "0.2.0") {
|
|
17
|
+
console.log([
|
|
18
|
+
"=======================================================================================",
|
|
19
|
+
"The data folder you are trying to open appears to be from a different version of MWS.",
|
|
20
|
+
"",
|
|
21
|
+
"Folder: " + process.cwd(),
|
|
22
|
+
"Version: " + pkg.version,
|
|
23
|
+
"",
|
|
24
|
+
"To prevent data loss the program will now exit.",
|
|
25
|
+
"=======================================================================================",
|
|
26
|
+
].join("\n"));
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
// need absolute path because of cwd
|
|
30
|
+
import(`file://${cwd}/node_modules/@tiddlywiki/mws/dist/mws.js`)
|
|
31
|
+
.then(mws => mws.default(pkg.version))
|
|
32
|
+
.catch(console.error);
|
|
33
|
+
} else {
|
|
17
34
|
console.error("This does not appear to be a valid MWS data folder.");
|
|
18
35
|
console.error("Please run this command in the root of your MWS data folder.");
|
|
19
36
|
process.exit(1);
|
|
20
37
|
}
|
|
21
38
|
|
|
22
|
-
|
|
23
|
-
|
|
39
|
+
/**
|
|
40
|
+
*
|
|
41
|
+
* @param {string} file
|
|
42
|
+
* @returns
|
|
43
|
+
*/
|
|
24
44
|
function tryParseJSON(file) {
|
|
25
45
|
try {
|
|
26
46
|
return JSON.parse(file);
|
|
27
|
-
} catch(e) {
|
|
47
|
+
} catch (e) {
|
|
28
48
|
return undefined;
|
|
29
49
|
}
|
|
30
50
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@tiddlywiki/mws",
|
|
3
3
|
"description": "TiddlyWiki Multiple Wiki Server",
|
|
4
4
|
"private": false,
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.2.0",
|
|
6
6
|
"bin": {
|
|
7
7
|
"mws": "./mws.run.mjs"
|
|
8
8
|
},
|
|
@@ -19,12 +19,8 @@
|
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
21
|
"workspaces": [
|
|
22
|
-
"packages
|
|
23
|
-
"
|
|
24
|
-
"packages/server",
|
|
25
|
-
"packages/mws",
|
|
26
|
-
"packages/react-admin",
|
|
27
|
-
"packages/tiddlywiki-types"
|
|
22
|
+
"packages/*",
|
|
23
|
+
"prisma"
|
|
28
24
|
],
|
|
29
25
|
"files": [
|
|
30
26
|
"dist",
|
|
@@ -32,7 +28,7 @@
|
|
|
32
28
|
"plugins",
|
|
33
29
|
"prisma",
|
|
34
30
|
"public",
|
|
35
|
-
"scripts
|
|
31
|
+
"scripts",
|
|
36
32
|
"mws.run.mjs"
|
|
37
33
|
],
|
|
38
34
|
"engines": {
|
|
@@ -40,37 +36,28 @@
|
|
|
40
36
|
},
|
|
41
37
|
"scripts": {
|
|
42
38
|
"install-android": "GYP_DEFINES=\"android_ndk_path=''\" npm install",
|
|
43
|
-
"docs": "node scripts.mjs docs",
|
|
44
|
-
"start": "node scripts.mjs start",
|
|
39
|
+
"docs": "node scripts/scripts.mjs docs",
|
|
40
|
+
"start": "node scripts/scripts.mjs start",
|
|
45
41
|
"certs": "(cd dev && bash localhost_certs.sh)",
|
|
46
42
|
"tsc": "TSCMWS=1 npx tsup",
|
|
47
|
-
"
|
|
48
|
-
"
|
|
43
|
+
"tsc2": "tsc -p tsconfig.json --noEmit",
|
|
44
|
+
"tsc-client": "cd packages/react-admin && npm run tsc",
|
|
45
|
+
"build": "node scripts/scripts.mjs build",
|
|
49
46
|
"build:client": "cd plugins/client && tsc",
|
|
50
|
-
"
|
|
47
|
+
"prisma:gen": "cd tools && npm run prisma:gen",
|
|
48
|
+
"prisma:mig": "cd tools && npm run prisma:mig",
|
|
49
|
+
"dev-quick-reset": "node scripts/scripts.mjs dev-quick-reset",
|
|
51
50
|
"env": "env",
|
|
52
|
-
"test": "node scripts.mjs test"
|
|
53
|
-
"prisma:format": "prettier --write prisma/client/*.js prisma/client/*/*.js",
|
|
54
|
-
"prisma:generate": "node scripts.mjs prisma:generate",
|
|
55
|
-
"prisma:migrate": "DATABASE_URL=file:test.sqlite npx prisma migrate dev --create-only --skip-generate --schema prisma/schema.prisma"
|
|
51
|
+
"test": "node scripts/scripts.mjs test"
|
|
56
52
|
},
|
|
57
53
|
"dependencies": {
|
|
58
|
-
"@prisma/adapter-better-sqlite3": "
|
|
59
|
-
"@
|
|
60
|
-
"
|
|
61
|
-
"source-map-support": "
|
|
62
|
-
"tiddlywiki": "^5.3.2"
|
|
54
|
+
"@prisma/adapter-better-sqlite3": "7.8.0",
|
|
55
|
+
"@prisma/client": "7.8.0",
|
|
56
|
+
"@serenity-kit/opaque": "1.1.0",
|
|
57
|
+
"source-map-support": "0.5.21"
|
|
63
58
|
},
|
|
64
59
|
"devDependencies": {
|
|
65
|
-
"@
|
|
66
|
-
"@types/
|
|
67
|
-
"prettier": "^3.6.1",
|
|
68
|
-
"prisma": "6.10.1",
|
|
69
|
-
"prisma-json-types-generator": "3.5.0",
|
|
70
|
-
"tsup": "^8.5.0",
|
|
71
|
-
"typescript": "^5.8.3"
|
|
72
|
-
},
|
|
73
|
-
"peerDependencies": {
|
|
74
|
-
"tiddlywiki": "^5.3.2"
|
|
60
|
+
"@types/node": "^24.6.0",
|
|
61
|
+
"@types/source-map-support": "0.5.10"
|
|
75
62
|
}
|
|
76
|
-
}
|
|
63
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"title": "$:/plugins/mws/client",
|
|
3
3
|
"name": "MultiWikiClient",
|
|
4
|
-
"description": "Synchronise changes from the browser to TiddlyWiki
|
|
4
|
+
"description": "Synchronise changes from the browser to TiddlyWiki MultiWikiServer",
|
|
5
5
|
"list": "readme",
|
|
6
6
|
"plugin-priority": 12,
|
|
7
7
|
"stability": "STABILITY_1_EXPERIMENTAL",
|
|
@@ -19,30 +19,15 @@ previous operation to complete before sending a new one.
|
|
|
19
19
|
// the blank line is important, and so is the following use strict
|
|
20
20
|
"use strict";
|
|
21
21
|
|
|
22
|
-
import type { ServerEventsMap } from '@tiddlywiki/events';
|
|
23
|
-
import type { ZodRoute, WikiStatusRoutes, WikiRecipeRoutes } from '@tiddlywiki/mws';
|
|
24
|
-
import type { zod } from '@tiddlywiki/server';
|
|
22
|
+
// import type { ServerEventsMap } from '@tiddlywiki/events';
|
|
23
|
+
// import type { ZodRoute, WikiStatusRoutes, WikiRecipeRoutes } from '@tiddlywiki/mws';
|
|
24
|
+
// import type { zod } from '@tiddlywiki/server';
|
|
25
25
|
import type { Syncer, Tiddler, TiddlerFields, Wiki } from 'tiddlywiki';
|
|
26
|
+
|
|
27
|
+
import {} from "@tiddlywiki/mws-prisma";
|
|
26
28
|
declare global { const fflate: typeof import("./fflate"); }
|
|
27
29
|
declare const self: never;
|
|
28
30
|
|
|
29
|
-
// registerZodRoutes(parent, new WikiStatusRoutes(), Object.keys({
|
|
30
|
-
// handleGetAllBagStates: true,
|
|
31
|
-
// handleGetBagState: true,
|
|
32
|
-
// handleGetRecipeStatus: true,
|
|
33
|
-
// handleGetRecipeEvents: true,
|
|
34
|
-
// handleGetBags: true,
|
|
35
|
-
// } satisfies RouterKeyMap<WikiStatusRoutes, true>));
|
|
36
|
-
|
|
37
|
-
// registerZodRoutes(parent, new WikiRecipeRoutes(), Object.keys({
|
|
38
|
-
// handleDeleteRecipeTiddler: true,
|
|
39
|
-
// handleLoadRecipeTiddler: true,
|
|
40
|
-
// handleSaveRecipeTiddler: true,
|
|
41
|
-
// rpcDeleteRecipeTiddlerList: true,
|
|
42
|
-
// rpcLoadRecipeTiddlerList: true,
|
|
43
|
-
// rpcSaveRecipeTiddlerList: true,
|
|
44
|
-
// } satisfies RouterKeyMap<WikiRecipeRoutes, true>));
|
|
45
|
-
|
|
46
31
|
declare class Logger {
|
|
47
32
|
constructor(componentName: any, options: any);
|
|
48
33
|
componentName: any;
|
|
@@ -61,19 +46,6 @@ declare class Logger {
|
|
|
61
46
|
clearAlerts(): void;
|
|
62
47
|
}
|
|
63
48
|
|
|
64
|
-
type WikiStatusTypes = {
|
|
65
|
-
[K in keyof WikiStatusRoutes]: WikiStatusRoutes[K] extends ZodRoute<infer M, infer B, infer P, infer Q, infer T, infer R>
|
|
66
|
-
? { M: M, B: B, P: P, Q: Q, T: T, R: R }
|
|
67
|
-
: never
|
|
68
|
-
}
|
|
69
|
-
type WikiRecipeTypes = {
|
|
70
|
-
[K in keyof WikiRecipeRoutes]: WikiRecipeRoutes[K] extends ZodRoute<infer M, infer B, infer P, infer Q, infer T, infer R>
|
|
71
|
-
? { M: M, B: B, P: P, Q: Q, T: T, R: R }
|
|
72
|
-
: never
|
|
73
|
-
}
|
|
74
|
-
interface RouteTypes extends WikiStatusTypes, WikiRecipeTypes {
|
|
75
|
-
}
|
|
76
|
-
|
|
77
49
|
declare module 'tiddlywiki' {
|
|
78
50
|
export interface Syncer<AD> {
|
|
79
51
|
wiki: Wiki;
|
|
@@ -402,7 +374,7 @@ class MultiWikiClientAdaptor implements SyncAdaptor<MWSAdaptorInfo> {
|
|
|
402
374
|
connectRecipeEvents() {
|
|
403
375
|
const event = new EventSource(this.host + "recipe/" + encodeURIComponent(this.recipe) + "/events?first-event-id=" + encodeURIComponent(this.last_known_revision_id));
|
|
404
376
|
this.setConnectionStatus(SERVER_CONNECTING_SSE);
|
|
405
|
-
let syncTimeout:
|
|
377
|
+
let syncTimeout: number | null = null;
|
|
406
378
|
const debounceSyncFromServer = () => {
|
|
407
379
|
if (syncTimeout) {
|
|
408
380
|
clearTimeout(syncTimeout);
|