@tiddlywiki/mws 0.1.9 → 0.1.12
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 +22 -22
- package/dist/metafile-esm.json +1 -1
- package/dist/mws.js +43 -50
- package/dist/mws.js.map +1 -1
- package/editions/mws-docs/tiddlers/$__StoryList.tid +5 -2
- package/editions/mws-docs/tiddlers/$__config_RelinkOnRename.tid +6 -0
- package/editions/mws-docs/tiddlers/2025-05-06 - syncer design.md +5 -1
- package/editions/mws-docs/tiddlers/2025-05-06 - syncer design.md.meta +1 -1
- package/editions/mws-docs/tiddlers/Bag.md +1 -0
- package/editions/mws-docs/tiddlers/Bag.md.meta +4 -0
- package/editions/mws-docs/tiddlers/Bags and Recipes Complex Example.md +11 -0
- package/editions/mws-docs/tiddlers/Bags and Recipes Complex Example.md.meta +4 -0
- package/editions/mws-docs/tiddlers/Bags and Recipes Model.md +14 -0
- package/editions/mws-docs/tiddlers/Bags and Recipes Model.md.meta +4 -0
- package/editions/mws-docs/tiddlers/Bags and Recipes Simple Example.md +13 -0
- package/editions/mws-docs/tiddlers/Bags and Recipes Simple Example.md.meta +4 -0
- package/editions/mws-docs/tiddlers/Code Layout.md +94 -0
- package/editions/mws-docs/tiddlers/Code Layout.md.meta +5 -0
- package/editions/mws-docs/tiddlers/Entity Access Control.md +1 -0
- package/editions/mws-docs/tiddlers/Entity Access Control.md.meta +5 -0
- package/editions/mws-docs/tiddlers/Entity Owner.md +3 -0
- package/editions/mws-docs/tiddlers/Entity Owner.md.meta +4 -0
- package/editions/mws-docs/tiddlers/Entity Permissions.md +7 -0
- package/editions/mws-docs/tiddlers/Entity Permissions.md.meta +4 -0
- package/editions/mws-docs/tiddlers/Entity.md +3 -0
- package/editions/mws-docs/tiddlers/Entity.md.meta +5 -0
- package/editions/mws-docs/tiddlers/HelloThere.tid +2 -2
- package/editions/mws-docs/tiddlers/Installation.md +31 -0
- package/editions/mws-docs/tiddlers/Installation.md.meta +5 -0
- package/editions/mws-docs/tiddlers/MWS Architecture_1.md +2 -0
- package/editions/mws-docs/tiddlers/{MWS Architecture.tid → MWS Architecture_1.md.meta } +2 -4
- package/editions/mws-docs/tiddlers/Recipe Bag Priority.md +5 -0
- package/editions/mws-docs/tiddlers/Recipe Bag Priority.md.meta +4 -0
- package/editions/mws-docs/tiddlers/Recipe.tid +6 -0
- package/editions/mws-docs/tiddlers/Security.md +7 -7
- package/editions/mws-docs/tiddlers/Security.md.meta +1 -1
- package/editions/mws-docs/tiddlers/Server Routes.md +54 -0
- package/editions/mws-docs/tiddlers/Server Routes.md.meta +5 -0
- package/editions/mws-docs/tiddlers/Site Admin.md +3 -0
- package/editions/mws-docs/tiddlers/Site Admin.md.meta +4 -0
- package/editions/mws-docs/tiddlers/Wiki.md +2 -0
- package/editions/mws-docs/tiddlers/Wiki.md.meta +4 -0
- package/editions/mws-docs/tiddlers/system/$__palettes_MUI_styles.css +1 -1
- package/editions/mws-docs/tiddlers/system/$__palettes_MUI_styles.css.meta +1 -1
- package/mws.run.mjs +2 -2
- package/package.json +1 -1
- package/plugins/client/src/multiwikiclientadaptor.ts +16 -9
- package/plugins/client/tiddlers/syncer/multiwikiclientadaptor.js +9 -10
- package/plugins/client/tiddlers/syncer/syncer.js +3 -3
- package/public/react-admin/main.js +10 -10
- package/public/react-admin/main.js.map +3 -3
- package/public/react-admin/stats.json +1 -1
- package/scripts.mjs +4 -5
- package/editions/mws-docs/tiddlers/Bags and Recipes.tid +0 -41
- package/editions/mws-docs/tiddlers/Installation.tid +0 -32
- package/prisma/test.sqlite +0 -0
- package/prisma/test.sqlite-journal +0 -0
package/dist/mws.js
CHANGED
|
@@ -16346,17 +16346,6 @@ var serverEvents = new ServerEvents();
|
|
|
16346
16346
|
// packages/commander/src/index.ts
|
|
16347
16347
|
init_esm_shims();
|
|
16348
16348
|
|
|
16349
|
-
// packages/commander/src/BaseCommand.ts
|
|
16350
|
-
init_esm_shims();
|
|
16351
|
-
var _BaseCommand = class _BaseCommand {
|
|
16352
|
-
constructor(params, options) {
|
|
16353
|
-
this.params = params;
|
|
16354
|
-
this.options = options;
|
|
16355
|
-
}
|
|
16356
|
-
};
|
|
16357
|
-
__name(_BaseCommand, "BaseCommand");
|
|
16358
|
-
var BaseCommand = _BaseCommand;
|
|
16359
|
-
|
|
16360
16349
|
// packages/commander/src/runCLI.ts
|
|
16361
16350
|
init_esm_shims();
|
|
16362
16351
|
|
|
@@ -17024,6 +17013,20 @@ function getCLI(commands2) {
|
|
|
17024
17013
|
}
|
|
17025
17014
|
__name(getCLI, "getCLI");
|
|
17026
17015
|
|
|
17016
|
+
// packages/commander/src/BaseCommand.ts
|
|
17017
|
+
init_esm_shims();
|
|
17018
|
+
var _BaseCommand = class _BaseCommand {
|
|
17019
|
+
constructor(params, options) {
|
|
17020
|
+
this.params = params;
|
|
17021
|
+
this.options = options;
|
|
17022
|
+
}
|
|
17023
|
+
};
|
|
17024
|
+
__name(_BaseCommand, "BaseCommand");
|
|
17025
|
+
var BaseCommand = _BaseCommand;
|
|
17026
|
+
|
|
17027
|
+
// packages/commander/src/index.ts
|
|
17028
|
+
var src_default = runCLI;
|
|
17029
|
+
|
|
17027
17030
|
// packages/server/src/index.ts
|
|
17028
17031
|
init_esm_shims();
|
|
17029
17032
|
|
|
@@ -29787,17 +29790,11 @@ var registerZodRoutes = /* @__PURE__ */ __name((parent, router, keys) => {
|
|
|
29787
29790
|
method,
|
|
29788
29791
|
path: path6,
|
|
29789
29792
|
bodyFormat,
|
|
29793
|
+
registerError,
|
|
29790
29794
|
zodPathParams,
|
|
29791
29795
|
zodQueryParams = /* @__PURE__ */ __name((z) => ({}), "zodQueryParams"),
|
|
29792
29796
|
zodRequestBody = ["string", "json", "www-form-urlencoded"].includes(bodyFormat) ? (z) => z.undefined() : (z) => z.any(),
|
|
29793
29797
|
inner,
|
|
29794
|
-
corsRequest = /* @__PURE__ */ __name(async (state) => {
|
|
29795
|
-
state.pathParams;
|
|
29796
|
-
const headers = state.headers["access-control-request-headers"];
|
|
29797
|
-
const method2 = state.headers["access-control-request-method"];
|
|
29798
|
-
debugCORS("OPTIONS default %s %s %s", state.urlInfo.pathname, method2, headers);
|
|
29799
|
-
throw state.sendEmpty(204, {});
|
|
29800
|
-
}, "corsRequest"),
|
|
29801
29798
|
securityChecks
|
|
29802
29799
|
} = route;
|
|
29803
29800
|
if (method.includes("OPTIONS"))
|
|
@@ -29808,28 +29805,17 @@ var registerZodRoutes = /* @__PURE__ */ __name((parent, router, keys) => {
|
|
|
29808
29805
|
const pathregex = "^" + path6.split("/").map(
|
|
29809
29806
|
(e) => e === "$key" ? key : e.startsWith(":") ? "([^/]+)" : e
|
|
29810
29807
|
).join("\\/") + "$";
|
|
29811
|
-
parent.defineRoute({
|
|
29812
|
-
method: ["OPTIONS"],
|
|
29813
|
-
path: new RegExp(pathregex),
|
|
29814
|
-
pathParams,
|
|
29815
|
-
bodyFormat: "ignore",
|
|
29816
|
-
denyFinal: false,
|
|
29817
|
-
securityChecks
|
|
29818
|
-
}, async (state) => {
|
|
29819
|
-
checkPath(state, zodPathParams);
|
|
29820
|
-
checkQuery(state, zodQueryParams);
|
|
29821
|
-
await corsRequest(state);
|
|
29822
|
-
});
|
|
29823
29808
|
parent.defineRoute({
|
|
29824
29809
|
method,
|
|
29825
29810
|
path: new RegExp(pathregex),
|
|
29826
29811
|
pathParams,
|
|
29827
29812
|
bodyFormat,
|
|
29828
|
-
denyFinal: false
|
|
29813
|
+
denyFinal: false,
|
|
29814
|
+
securityChecks
|
|
29829
29815
|
}, async (state) => {
|
|
29830
|
-
checkPath(state, zodPathParams);
|
|
29831
|
-
checkQuery(state, zodQueryParams);
|
|
29832
|
-
checkData(state, zodRequestBody);
|
|
29816
|
+
checkPath(state, zodPathParams, registerError);
|
|
29817
|
+
checkQuery(state, zodQueryParams, registerError);
|
|
29818
|
+
checkData(state, zodRequestBody, registerError);
|
|
29833
29819
|
const timekey = `handler ${state.bodyFormat} ${state.method} ${state.urlInfo.pathname}`;
|
|
29834
29820
|
if (import_debug3.default.enabled("server:handler:timing")) console.time(timekey);
|
|
29835
29821
|
const [good, error39, res] = await inner(state).then((e) => [true, void 0, e], (e) => [false, e, void 0]);
|
|
@@ -29849,10 +29835,12 @@ var registerZodRoutes = /* @__PURE__ */ __name((parent, router, keys) => {
|
|
|
29849
29835
|
});
|
|
29850
29836
|
});
|
|
29851
29837
|
}, "registerZodRoutes");
|
|
29852
|
-
function checkData(state, zodRequestBody) {
|
|
29838
|
+
function checkData(state, zodRequestBody, registerError) {
|
|
29853
29839
|
const inputCheck = Z2.any().pipe(zodRequestBody(Z2)).safeParse(state.data);
|
|
29854
29840
|
if (!inputCheck.success) {
|
|
29855
|
-
console.log(inputCheck.error
|
|
29841
|
+
console.log(`${inputCheck.error}
|
|
29842
|
+
for
|
|
29843
|
+
${registerError.stack?.split("\n").slice(1).join("\n")}`);
|
|
29856
29844
|
throw state.sendString(
|
|
29857
29845
|
400,
|
|
29858
29846
|
{ "x-reason": "zod-request" },
|
|
@@ -29863,10 +29851,12 @@ function checkData(state, zodRequestBody) {
|
|
|
29863
29851
|
state.data = inputCheck.data;
|
|
29864
29852
|
}
|
|
29865
29853
|
__name(checkData, "checkData");
|
|
29866
|
-
function checkQuery(state, zodQueryParams) {
|
|
29854
|
+
function checkQuery(state, zodQueryParams, registerError) {
|
|
29867
29855
|
const queryCheck = Z2.strictObject(zodQueryParams(Z2)).safeParse(state.queryParams);
|
|
29868
29856
|
if (!queryCheck.success) {
|
|
29869
|
-
console.log(queryCheck.error
|
|
29857
|
+
console.log(`${queryCheck.error}
|
|
29858
|
+
for
|
|
29859
|
+
${registerError.stack?.split("\n").slice(1).join("\n")}`);
|
|
29870
29860
|
throw state.sendString(
|
|
29871
29861
|
400,
|
|
29872
29862
|
{ "x-reason": "zod-query" },
|
|
@@ -29877,10 +29867,12 @@ function checkQuery(state, zodQueryParams) {
|
|
|
29877
29867
|
state.queryParams = queryCheck.data;
|
|
29878
29868
|
}
|
|
29879
29869
|
__name(checkQuery, "checkQuery");
|
|
29880
|
-
function checkPath(state, zodPathParams) {
|
|
29870
|
+
function checkPath(state, zodPathParams, registerError) {
|
|
29881
29871
|
const pathCheck = Z2.strictObject(zodPathParams(Z2)).safeParse(state.pathParams);
|
|
29882
29872
|
if (!pathCheck.success) {
|
|
29883
|
-
console.log(pathCheck.error
|
|
29873
|
+
console.log(`${pathCheck.error}
|
|
29874
|
+
for
|
|
29875
|
+
${registerError.stack?.split("\n").slice(1).join("\n")}`);
|
|
29884
29876
|
throw state.sendString(
|
|
29885
29877
|
404,
|
|
29886
29878
|
{ "x-reason": "zod-path" },
|
|
@@ -29895,6 +29887,7 @@ __name(checkPath, "checkPath");
|
|
|
29895
29887
|
// packages/server/src/zodRoute.ts
|
|
29896
29888
|
init_esm_shims();
|
|
29897
29889
|
function zodRoute(route) {
|
|
29890
|
+
route.registerError = new Error();
|
|
29898
29891
|
return route;
|
|
29899
29892
|
}
|
|
29900
29893
|
__name(zodRoute, "zodRoute");
|
|
@@ -31139,7 +31132,7 @@ var package_default = {
|
|
|
31139
31132
|
name: "@tiddlywiki/mws",
|
|
31140
31133
|
description: "TiddlyWiki Multiple Wiki Server",
|
|
31141
31134
|
private: false,
|
|
31142
|
-
version: "0.1.
|
|
31135
|
+
version: "0.1.10",
|
|
31143
31136
|
bin: {
|
|
31144
31137
|
mws: "./mws.run.mjs"
|
|
31145
31138
|
},
|
|
@@ -31350,7 +31343,7 @@ serverEvents.on("mws.routes", (root, config2) => {
|
|
|
31350
31343
|
bodyFormat: "ignore",
|
|
31351
31344
|
pathParams: ["plugin"]
|
|
31352
31345
|
}, async (state) => {
|
|
31353
|
-
checkPath(state, (z) => ({ plugin: z.string() }));
|
|
31346
|
+
checkPath(state, (z) => ({ plugin: z.string() }), new Error());
|
|
31354
31347
|
const plugin = state.pluginCache.filePlugins.get(state.pathParams.plugin);
|
|
31355
31348
|
if (!plugin) throw state.sendEmpty(404, { "x-reason": "Plugin not found" });
|
|
31356
31349
|
state.setHeader("Content-Type", "application/javascript");
|
|
@@ -31565,9 +31558,9 @@ serverEvents.on("cli.execute.before", async (name, params, options, instance) =>
|
|
|
31565
31558
|
const passwordService = await createPasswordService(readPasswordMasterKey(wikiPath));
|
|
31566
31559
|
const cachePath = path4.resolve(wikiPath, "cache");
|
|
31567
31560
|
mkdirSync2(cachePath, { recursive: true });
|
|
31568
|
-
serverEvents.emitAsync("mws.cache.init.before", cachePath, $tw);
|
|
31561
|
+
await serverEvents.emitAsync("mws.cache.init.before", cachePath, $tw);
|
|
31569
31562
|
const cache = await startupCache($tw, cachePath);
|
|
31570
|
-
serverEvents.emitAsync("mws.cache.init.after", cache, $tw);
|
|
31563
|
+
await serverEvents.emitAsync("mws.cache.init.after", cache, $tw);
|
|
31571
31564
|
const storePath = path4.resolve(wikiPath, "store");
|
|
31572
31565
|
mkdirSync2(storePath, { recursive: true });
|
|
31573
31566
|
const databasePath = path4.resolve(storePath, "database.sqlite");
|
|
@@ -31578,9 +31571,9 @@ serverEvents.on("cli.execute.before", async (name, params, options, instance) =>
|
|
|
31578
31571
|
"They are not temporary files, they are part of the database."
|
|
31579
31572
|
].join("\n"));
|
|
31580
31573
|
const adapter = new SqliteAdapter(databasePath, !!process.env.ENABLE_DEV_SERVER);
|
|
31581
|
-
serverEvents.emitAsync("mws.adapter.init.before", adapter);
|
|
31574
|
+
await serverEvents.emitAsync("mws.adapter.init.before", adapter);
|
|
31582
31575
|
await adapter.init();
|
|
31583
|
-
serverEvents.emitAsync("mws.adapter.init.after", adapter);
|
|
31576
|
+
await serverEvents.emitAsync("mws.adapter.init.after", adapter);
|
|
31584
31577
|
const engine = new PrismaClient({
|
|
31585
31578
|
log: [
|
|
31586
31579
|
...import_debug4.default.enabled("prisma:query") ? ["query"] : [],
|
|
@@ -31590,9 +31583,9 @@ serverEvents.on("cli.execute.before", async (name, params, options, instance) =>
|
|
|
31590
31583
|
adapter: adapter.adapter
|
|
31591
31584
|
});
|
|
31592
31585
|
const config2 = new ServerState({ wikiPath, cachePath, storePath }, $tw, engine, passwordService, cache);
|
|
31593
|
-
serverEvents.emitAsync("mws.init.before", config2, $tw);
|
|
31586
|
+
await serverEvents.emitAsync("mws.config.init.before", config2, $tw);
|
|
31594
31587
|
await config2.init();
|
|
31595
|
-
serverEvents.emitAsync("mws.init.after", config2, $tw);
|
|
31588
|
+
await serverEvents.emitAsync("mws.config.init.after", config2, $tw);
|
|
31596
31589
|
instance.config = config2;
|
|
31597
31590
|
instance.$tw = $tw;
|
|
31598
31591
|
});
|
|
@@ -34131,7 +34124,7 @@ serverEvents.on("mws.routes", (root, config2) => {
|
|
|
34131
34124
|
throw state.sendEmpty(404, { "x-reason": "recipe name not found" });
|
|
34132
34125
|
checkPath(state, (z) => ({
|
|
34133
34126
|
recipe_name: z.prismaField("Recipes", "recipe_name", "string")
|
|
34134
|
-
}));
|
|
34127
|
+
}), new Error());
|
|
34135
34128
|
await state.assertRecipeAccess(state.pathParams.recipe_name, false);
|
|
34136
34129
|
await state.$transaction(async (prisma) => {
|
|
34137
34130
|
const server3 = new WikiStateStore(state, prisma);
|
|
@@ -34530,7 +34523,7 @@ async function runMWS(oldOptions) {
|
|
|
34530
34523
|
}
|
|
34531
34524
|
await opaque3.ready;
|
|
34532
34525
|
await startup();
|
|
34533
|
-
await
|
|
34526
|
+
await src_default();
|
|
34534
34527
|
}
|
|
34535
34528
|
__name(runMWS, "runMWS");
|
|
34536
34529
|
serverEvents.on("cli.commander", (program2) => {
|