@tiddlywiki/mws 0.1.14 → 0.2.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.
Files changed (117) hide show
  1. package/README.md +41 -20
  2. package/dist/metafile-esm.json +1 -1
  3. package/dist/mws.js +40121 -20116
  4. package/dist/mws.js.map +1 -1
  5. package/mws.run.mjs +28 -8
  6. package/package.json +20 -33
  7. package/plugins/client/plugin.info +1 -1
  8. package/plugins/client/src/multiwikiclientadaptor.ts +6 -34
  9. package/plugins/client/src/mws.d.ts +2 -1
  10. package/plugins/client/src/new-multiwikiclientadaptor.ts +634 -0
  11. package/plugins/client/src/types.d.ts +2531 -1036
  12. package/plugins/client/tiddlers/managetiddleraction.js +0 -5
  13. package/plugins/client/tiddlers/syncer/new-multiwikiclientadaptor.js +432 -0
  14. package/plugins/client/tiddlers/syncer/syncer.js +123 -241
  15. package/plugins/client/tsconfig.json +5 -1
  16. package/prisma/browser.ts +2 -0
  17. package/prisma/client/browser.ts +84 -0
  18. package/prisma/client/client.ts +108 -0
  19. package/prisma/client/commonInputTypes.ts +598 -0
  20. package/prisma/client/enums.ts +42 -0
  21. package/prisma/client/internal/class.ts +326 -0
  22. package/prisma/client/internal/prismaNamespace.ts +1870 -0
  23. package/prisma/client/internal/prismaNamespaceBrowser.ts +259 -0
  24. package/prisma/client/models/Bag.ts +1701 -0
  25. package/prisma/client/models/BagPermission.ts +1284 -0
  26. package/prisma/client/models/Recipe.ts +1722 -0
  27. package/prisma/client/models/RecipeBag.ts +1518 -0
  28. package/prisma/client/models/RecipePermission.ts +1284 -0
  29. package/prisma/client/models/Roles.ts +1316 -0
  30. package/prisma/client/models/Sessions.ts +1344 -0
  31. package/prisma/client/models/Settings.ts +1093 -0
  32. package/prisma/client/models/Template.ts +1477 -0
  33. package/prisma/client/models/TemplatePermission.ts +1284 -0
  34. package/prisma/client/models/Tiddler.ts +1434 -0
  35. package/prisma/client/models/TiddlerEvent.ts +1360 -0
  36. package/prisma/client/models/Users.ts +1579 -0
  37. package/prisma/client/models.ts +24 -0
  38. package/prisma/client/pjtg.ts +183 -0
  39. package/prisma/index.ts +74 -0
  40. package/prisma/migrations/20260708160259_init/migration.sql +172 -0
  41. package/prisma/migrations-v1/migration_lock.toml +3 -0
  42. package/prisma/package.json +12 -0
  43. package/prisma/schema.prisma +147 -89
  44. package/prisma/types.ts +9 -0
  45. package/public/.default.html +1 -0
  46. package/public/admin-vanilla/fish.svg +399 -0
  47. package/public/admin-vanilla/fish2.svg +389 -0
  48. package/public/admin-vanilla/main-LYDE4NDJ.css +1 -0
  49. package/public/admin-vanilla/main-Y4GDO4MD.js +1797 -0
  50. package/public/admin-vanilla/main-Y4GDO4MD.js.map +7 -0
  51. package/public/admin-vanilla/normalize.css +349 -0
  52. package/public/admin-vanilla/polyfill-ADOI2A4V.js +2 -0
  53. package/public/admin-vanilla/polyfill-ADOI2A4V.js.map +7 -0
  54. package/public/{react-admin → admin-vanilla}/site.webmanifest +1 -1
  55. package/public/admin-vanilla.html +62 -0
  56. package/public/admin-vanilla.json +1 -0
  57. package/public/{react-admin → stats}/stats.html +5 -2
  58. package/public/{react-admin → stats}/stats.js +2 -1
  59. package/scripts/build-docs.sh +30 -0
  60. package/scripts/helpers.mjs +107 -0
  61. package/scripts/json.js +8 -0
  62. package/scripts/scripts.mjs +114 -0
  63. package/prisma/client/client.d.ts +0 -1
  64. package/prisma/client/client.js +0 -3
  65. package/prisma/client/default.d.ts +0 -1
  66. package/prisma/client/default.js +0 -3
  67. package/prisma/client/edge.d.ts +0 -1
  68. package/prisma/client/edge.js +0 -297
  69. package/prisma/client/index-browser.js +0 -275
  70. package/prisma/client/index.d.ts +0 -17770
  71. package/prisma/client/index.js +0 -324
  72. package/prisma/client/package.json +0 -173
  73. package/prisma/client/query_engine_bg.js +0 -811
  74. package/prisma/client/query_engine_bg.wasm +0 -0
  75. package/prisma/client/runtime/edge-esm.js +0 -10000
  76. package/prisma/client/runtime/edge.js +0 -10036
  77. package/prisma/client/runtime/index-browser.d.ts +0 -370
  78. package/prisma/client/runtime/index-browser.js +0 -2300
  79. package/prisma/client/runtime/library.d.ts +0 -3681
  80. package/prisma/client/runtime/library.js +0 -10604
  81. package/prisma/client/runtime/react-native.js +0 -10629
  82. package/prisma/client/runtime/wasm-compiler-edge.js +0 -11238
  83. package/prisma/client/runtime/wasm-engine-edge.js +0 -7801
  84. package/prisma/client/schema.prisma +0 -156
  85. package/prisma/client/wasm-edge-light-loader.mjs +0 -4
  86. package/prisma/client/wasm-worker-loader.mjs +0 -4
  87. package/prisma/client/wasm.d.ts +0 -1
  88. package/prisma/client/wasm.js +0 -304
  89. package/prisma/global.ts +0 -53
  90. package/public/react-admin/chunk-YALWN5OT.js +0 -2
  91. package/public/react-admin/esm-L4WLVWJN.js +0 -3
  92. package/public/react-admin/esm-L4WLVWJN.js.map +0 -7
  93. package/public/react-admin/esm-QMNGI3LF.js +0 -3
  94. package/public/react-admin/esm-QMNGI3LF.js.map +0 -7
  95. package/public/react-admin/index.html +0 -36
  96. package/public/react-admin/main.js +0 -268
  97. package/public/react-admin/main.js.map +0 -7
  98. package/public/react-admin/stats.json +0 -1
  99. package/scripts.mjs +0 -142
  100. /package/prisma/{migrations → migrations-v1}/20250606001949_init/migration.sql +0 -0
  101. /package/prisma/{migrations → migrations-v1}/20250613000526_remove_group/migration.sql +0 -0
  102. /package/prisma/{migrations → migrations-v1}/20250620014502_settings/migration.sql +0 -0
  103. /package/prisma/{migrations → migrations-v1}/20250707205229_recipes/migration.sql +0 -0
  104. /package/public/{react-admin → admin-vanilla}/android-chrome-192x192.png +0 -0
  105. /package/public/{react-admin → admin-vanilla}/android-chrome-512x512.png +0 -0
  106. /package/public/{react-admin → admin-vanilla}/apple-touch-icon.png +0 -0
  107. /package/public/{react-admin → admin-vanilla}/favicon-16x16.png +0 -0
  108. /package/public/{react-admin → admin-vanilla}/favicon-32x32.png +0 -0
  109. /package/public/{react-admin → admin-vanilla}/favicon.ico +0 -0
  110. /package/public/{react-admin → admin-vanilla}/favicon.png +0 -0
  111. /package/public/{react-admin/chunk-YALWN5OT.js.map → admin-vanilla/main-LYDE4NDJ.css.map} +0 -0
  112. /package/public/{react-admin → admin-vanilla}/missing-favicon.png +0 -0
  113. /package/public/{react-admin → admin-vanilla}/motovun-jack.jpg +0 -0
  114. /package/public/{react-admin → admin-vanilla}/mws-icon.png +0 -0
  115. /package/public/{react-admin → admin-vanilla}/vite.svg +0 -0
  116. /package/public/{react-admin → stats}/stats.css +0 -0
  117. /package/public/{react-admin → stats}/stats.svg +0 -0
@@ -0,0 +1,24 @@
1
+
2
+ /* !!! This is code generated by Prisma. Do not edit directly. !!! */
3
+ /* eslint-disable */
4
+ // biome-ignore-all lint: generated file
5
+ // @ts-nocheck
6
+ /*
7
+ * This is a barrel export file for all models and their related types.
8
+ *
9
+ * 🟢 You can import this file directly.
10
+ */
11
+ export type * from './models/Bag.ts'
12
+ export type * from './models/BagPermission.ts'
13
+ export type * from './models/Tiddler.ts'
14
+ export type * from './models/TiddlerEvent.ts'
15
+ export type * from './models/Template.ts'
16
+ export type * from './models/TemplatePermission.ts'
17
+ export type * from './models/Recipe.ts'
18
+ export type * from './models/RecipePermission.ts'
19
+ export type * from './models/RecipeBag.ts'
20
+ export type * from './models/Settings.ts'
21
+ export type * from './models/Roles.ts'
22
+ export type * from './models/Users.ts'
23
+ export type * from './models/Sessions.ts'
24
+ export type * from './commonInputTypes.ts'
@@ -0,0 +1,183 @@
1
+ import * as Prisma from './internal/prismaNamespace';
2
+ declare global {
3
+ namespace PrismaJson {
4
+ // This namespace will always be empty. Definitions should be done by
5
+ // you manually, and merged automatically by typescript. Make sure that
6
+ // your declaration merging file is included in your tsconfig.json
7
+ //
8
+ // Learn more: https://github.com/arthurfiorette/prisma-json-types-generator/issues/143
9
+ // Declaration Merging: https://www.typescriptlang.org/docs/handbook/declaration-merging.html
10
+ }
11
+ }
12
+
13
+ /** A filter to be used against nullable List types. */
14
+ export type NullableListFilter<T> = {
15
+ equals?: T | T[] | null;
16
+ has?: T | null;
17
+ hasEvery?: T[];
18
+ hasSome?: T[];
19
+ isEmpty?: boolean;
20
+ };
21
+
22
+ /** A type to determine how to update a json field */
23
+ export type UpdateInput<T> = T extends object ? { [P in keyof T]?: UpdateInput<T[P]> } : T;
24
+
25
+ /** A type to determine how to update a json[] field */
26
+ export type UpdateManyInput<T> = T | T[] | { set?: T[]; push?: T | T[] };
27
+
28
+ /** A type to determine how to create a json[] input */
29
+ export type CreateManyInput<T> = T | T[] | { set?: T[] };
30
+
31
+ /**
32
+ * A typed version of NestedStringFilter, allowing narrowing of string types to
33
+ * discriminated unions.
34
+ */
35
+ export type TypedNestedStringFilter<S extends string> =
36
+ //@ts-ignore - When Prisma.StringFilter is not present, this type is not used
37
+ Prisma.StringFilter & {
38
+ equals?: S;
39
+ in?: S[];
40
+ notIn?: S[];
41
+ not?: TypedNestedStringFilter<S> | S;
42
+ };
43
+
44
+ /**
45
+ * A typed version of StringFilter, allowing narrowing of string types to discriminated
46
+ * unions.
47
+ */
48
+ export type TypedStringFilter<S extends string> =
49
+ //@ts-ignore - When Prisma.StringFilter is not present, this type is not used
50
+ Prisma.StringFilter & {
51
+ equals?: S;
52
+ in?: S[];
53
+ notIn?: S[];
54
+ not?: TypedNestedStringFilter<S> | S;
55
+ };
56
+
57
+ /**
58
+ * A typed version of NestedStringNullableFilter, allowing narrowing of string types to
59
+ * discriminated unions.
60
+ */
61
+ export type TypedNestedStringNullableFilter<S extends string> =
62
+ //@ts-ignore - When Prisma.StringNullableFilter is not present, this type is not used
63
+ Prisma.StringNullableFilter & {
64
+ equals?: S | null;
65
+ in?: S[] | null;
66
+ notIn?: S[] | null;
67
+ not?: TypedNestedStringNullableFilter<S> | S | null;
68
+ };
69
+
70
+ /**
71
+ * A typed version of StringNullableFilter, allowing narrowing of string types to
72
+ * discriminated unions.
73
+ */
74
+ export type TypedStringNullableFilter<S extends string> =
75
+ //@ts-ignore - When Prisma.StringNullableFilter is not present, this type is not used
76
+ Prisma.StringNullableFilter & {
77
+ equals?: S | null;
78
+ in?: S[] | null;
79
+ notIn?: S[] | null;
80
+ not?: TypedNestedStringNullableFilter<S> | S | null;
81
+ };
82
+
83
+ /**
84
+ * A typed version of NestedStringWithAggregatesFilter, allowing narrowing of string types
85
+ * to discriminated unions.
86
+ */
87
+ export type TypedNestedStringWithAggregatesFilter<S extends string> =
88
+ //@ts-ignore - When Prisma.NestedStringWithAggregatesFilter is not present, this type is not used
89
+ Prisma.NestedStringWithAggregatesFilter & {
90
+ equals?: S;
91
+ in?: S[];
92
+ notIn?: S[];
93
+ not?: TypedNestedStringWithAggregatesFilter<S> | S;
94
+ };
95
+
96
+ /**
97
+ * A typed version of StringWithAggregatesFilter, allowing narrowing of string types to
98
+ * discriminated unions.
99
+ */
100
+ export type TypedStringWithAggregatesFilter<S extends string> =
101
+ //@ts-ignore - When Prisma.StringWithAggregatesFilter is not present, this type is not used
102
+ Prisma.StringWithAggregatesFilter & {
103
+ equals?: S;
104
+ in?: S[];
105
+ notIn?: S[];
106
+ not?: TypedNestedStringWithAggregatesFilter<S> | S;
107
+ };
108
+
109
+ /**
110
+ * A typed version of NestedStringNullableWithAggregatesFilter, allowing narrowing of
111
+ * string types to discriminated unions.
112
+ */
113
+ export type TypedNestedStringNullableWithAggregatesFilter<S extends string> =
114
+ //@ts-ignore - When Prisma.NestedStringNullableWithAggregatesFilter is not present, this type is not used
115
+ Prisma.NestedStringNullableWithAggregatesFilter & {
116
+ equals?: S | null;
117
+ in?: S[] | null;
118
+ notIn?: S[] | null;
119
+ not?: TypedNestedStringNullableWithAggregatesFilter<S> | S | null;
120
+ };
121
+
122
+ /**
123
+ * A typed version of StringNullableWithAggregatesFilter, allowing narrowing of string
124
+ * types to discriminated unions.
125
+ */
126
+ export type TypedStringNullableWithAggregatesFilter<S extends string> =
127
+ //@ts-ignore - When Prisma.StringNullableWithAggregatesFilter is not present, this type is not used
128
+ Prisma.StringNullableWithAggregatesFilter & {
129
+ equals?: S | null;
130
+ in?: S[] | null;
131
+ notIn?: S[] | null;
132
+ not?: TypedNestedStringNullableWithAggregatesFilter<S> | S | null;
133
+ };
134
+
135
+ /**
136
+ * A typed version of StringFieldUpdateOperationsInput, allowing narrowing of string types
137
+ * to discriminated unions.
138
+ */
139
+ export type TypedStringFieldUpdateOperationsInput<S extends string> =
140
+ //@ts-ignore - When Prisma.StringFieldUpdateOperationsInput is not present, this type is not used
141
+ Prisma.StringFieldUpdateOperationsInput & {
142
+ set?: S;
143
+ };
144
+
145
+ /**
146
+ * A typed version of NullableStringFieldUpdateOperationsInput, allowing narrowing of
147
+ * string types to discriminated unions.
148
+ */
149
+ export type TypedNullableStringFieldUpdateOperationsInput<S extends string> =
150
+ //@ts-ignore - When Prisma.NullableStringFieldUpdateOperationsInput is not present, this type is not used
151
+ Prisma.NullableStringFieldUpdateOperationsInput & {
152
+ set?: S | null;
153
+ };
154
+
155
+ /**
156
+ * A typed version of StringNullableListFilter, allowing narrowing of string types to
157
+ * discriminated unions.
158
+ */
159
+ export type TypedStringNullableListFilter<S extends string> =
160
+ //@ts-ignore - When Prisma.StringNullableListFilter is not present, this type is not used
161
+ Prisma.StringNullableListFilter & {
162
+ equals?: S[] | null;
163
+ has?: S | null;
164
+ hasEvery?: S[];
165
+ hasSome?: S[];
166
+ };
167
+
168
+ /**
169
+ * A typed version of the input type to update a string[] field, allowing narrowing of
170
+ * string types to discriminated unions.
171
+ */
172
+ export type UpdateStringArrayInput<S extends string> = {
173
+ set?: S[];
174
+ push?: S | S[];
175
+ };
176
+
177
+ /**
178
+ * A typed version of the input type to create a string[] field, allowing narrowing of
179
+ * string types to discriminated unions.
180
+ */
181
+ export type CreateStringArrayInput<S extends string> = {
182
+ set?: S[];
183
+ };
@@ -0,0 +1,74 @@
1
+ import type { Prisma } from "./client/client.ts";
2
+ export * from "./client/client.ts";
3
+ export * from "./types.ts";
4
+
5
+ declare global {
6
+ namespace PrismaJson {
7
+
8
+ /** A tiddler's fields and body, stored as a single JSON column. */
9
+ type Tiddler_fields = Record<string, string>;
10
+
11
+ /** A single bound parameter value. Bag/plugin params are ids; string params are strings. */
12
+ type ParameterValue = string | string[];
13
+
14
+ /** Bound parameter values on a template (the parameter set is fixed at creation). */
15
+ type Template_parameters = Record<string, ParameterValue>;
16
+
17
+ /** Wiki-level parameter values supplying what the template left open. */
18
+ type Recipe_parameters = Record<string, ParameterValue>;
19
+
20
+ type RecipeBag_info = {};
21
+ type Template_type = "simpleV1";
22
+
23
+
24
+
25
+ }
26
+ }
27
+
28
+ declare global {
29
+
30
+
31
+ /**
32
+ * This primarily makes sure that positional arguments are used correctly
33
+ * (so you can't switch a title and bag_name around).
34
+ *
35
+ * If you assign the wrong value (like `5 as PrismaField<"Bags", "bag_name">`),
36
+ * this will result in a type error on the as keyword, allowing you to catch incorrect types quickly.
37
+ */
38
+ type PrismaField<T extends Prisma.ModelName, K extends keyof PrismaPayloadScalars<T>> =
39
+ // manually map foriegn keys to their corresponding primary key so comparisons work
40
+ // this should remove the need for any global helper functions to convert between types.
41
+
42
+ // I've tried to prevent this from being flattened, but I can't figure out how.
43
+ // It doesn't really matter, just annoying.
44
+ (
45
+ [T, K] extends ["Tiddler", "bag_id"] ? PrismaField<"Bag", "id"> :
46
+ [T, K] extends ["TiddlerEvent", "bag_id"] ? PrismaField<"Bag", "id"> :
47
+ [T, K] extends ["BagPermission", "bag_id"] ? PrismaField<"Bag", "id"> :
48
+ [T, K] extends ["BagPermission", "role_id"] ? PrismaField<"Roles", "role_id"> :
49
+ [T, K] extends ["Recipe", "template_id"] ? PrismaField<"Template", "id"> :
50
+ [T, K] extends ["RecipePermission", "recipe_id"] ? PrismaField<"Recipe", "id"> :
51
+ [T, K] extends ["RecipePermission", "role_id"] ? PrismaField<"Roles", "role_id"> :
52
+ [T, K] extends ["RecipeBag", "recipe_id"] ? PrismaField<"Recipe", "id"> :
53
+ [T, K] extends ["RecipeBag", "bag_id"] ? PrismaField<"Bag", "id"> :
54
+ [T, K] extends ["RecipePlugin", "recipe_id"] ? PrismaField<"Recipe", "id"> :
55
+ [T, K] extends ["Session", "user_id"] ? PrismaField<"Users", "user_id"> :
56
+ IsEnum<PrismaPayloadScalars<T>[K], true, false> extends true ? PrismaPayloadScalars<T>[K] :
57
+ (PrismaPayloadScalars<T>[K] & { __prisma_table?: T, __prisma_field?: K })
58
+ ) | (null extends PrismaPayloadScalars<T>[K] ? null : never);
59
+
60
+
61
+ type IsEnum<T, A, B> = T extends string ? string extends T ? B : A : B
62
+ type PrismaPayloadScalars<T extends Prisma.ModelName>
63
+ = Prisma.TypeMap["model"][T]["payload"]["scalars"];
64
+
65
+ function castPrismaField<T extends Prisma.ModelName, K extends keyof PrismaPayloadScalars<T>, V>(a: Map<PrismaField<T, K>, V>): Map<PrismaPayloadScalars<T>[K], V>;
66
+ function castPrismaField<T extends Prisma.ModelName, K extends keyof PrismaPayloadScalars<T>, V>(a: Map<V, PrismaField<T, K>>): Map<V, PrismaPayloadScalars<T>[K]>;
67
+ function castPrismaField<T extends Prisma.ModelName, K extends keyof PrismaPayloadScalars<T>>(a: PrismaField<T, K>[]): PrismaPayloadScalars<T>[K][];
68
+ function castPrismaField<T extends Prisma.ModelName, K extends keyof PrismaPayloadScalars<T>>(a: PrismaField<T, K>[]): PrismaPayloadScalars<T>[K][];
69
+ function castPrismaField<T extends Prisma.ModelName, K extends keyof PrismaPayloadScalars<T>>(a: PrismaField<T, K>): PrismaPayloadScalars<T>[K];
70
+
71
+ }
72
+ export { };
73
+
74
+ global.castPrismaField = (e: any) => e;
@@ -0,0 +1,172 @@
1
+ -- CreateTable
2
+ CREATE TABLE "bag" (
3
+ "id" TEXT NOT NULL PRIMARY KEY,
4
+ "name" TEXT NOT NULL,
5
+ "created" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
6
+ "updated" DATETIME NOT NULL,
7
+ "description" TEXT NOT NULL
8
+ );
9
+
10
+ -- CreateTable
11
+ CREATE TABLE "bag_permission" (
12
+ "bag_id" TEXT NOT NULL,
13
+ "role_id" TEXT NOT NULL,
14
+ "level" TEXT NOT NULL,
15
+
16
+ PRIMARY KEY ("bag_id", "role_id"),
17
+ CONSTRAINT "bag_permission_bag_id_fkey" FOREIGN KEY ("bag_id") REFERENCES "bag" ("id") ON DELETE CASCADE ON UPDATE CASCADE
18
+ );
19
+
20
+ -- CreateTable
21
+ CREATE TABLE "tiddler" (
22
+ "bag_id" TEXT NOT NULL,
23
+ "title" TEXT NOT NULL,
24
+ "created" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
25
+ "updated" DATETIME NOT NULL,
26
+ "revision" BIGINT NOT NULL DEFAULT 0,
27
+ "fields" JSONB NOT NULL,
28
+
29
+ PRIMARY KEY ("bag_id", "title"),
30
+ CONSTRAINT "tiddler_bag_id_fkey" FOREIGN KEY ("bag_id") REFERENCES "bag" ("id") ON DELETE CASCADE ON UPDATE CASCADE
31
+ );
32
+
33
+ -- CreateTable
34
+ CREATE TABLE "tiddler_event" (
35
+ "seq" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
36
+ "bag_id" TEXT NOT NULL,
37
+ "title" TEXT NOT NULL,
38
+ "type" TEXT NOT NULL,
39
+ CONSTRAINT "tiddler_event_bag_id_fkey" FOREIGN KEY ("bag_id") REFERENCES "bag" ("id") ON DELETE CASCADE ON UPDATE CASCADE
40
+ );
41
+
42
+ -- CreateTable
43
+ CREATE TABLE "template" (
44
+ "id" TEXT NOT NULL PRIMARY KEY,
45
+ "name" TEXT NOT NULL,
46
+ "created" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
47
+ "updated" DATETIME NOT NULL,
48
+ "type" TEXT NOT NULL,
49
+ "definition" JSONB NOT NULL
50
+ );
51
+
52
+ -- CreateTable
53
+ CREATE TABLE "template_permission" (
54
+ "template_id" TEXT NOT NULL,
55
+ "role_id" TEXT NOT NULL,
56
+ "level" TEXT NOT NULL,
57
+
58
+ PRIMARY KEY ("template_id", "role_id"),
59
+ CONSTRAINT "template_permission_template_id_fkey" FOREIGN KEY ("template_id") REFERENCES "template" ("id") ON DELETE CASCADE ON UPDATE CASCADE
60
+ );
61
+
62
+ -- CreateTable
63
+ CREATE TABLE "recipe" (
64
+ "id" TEXT NOT NULL PRIMARY KEY,
65
+ "slug" TEXT NOT NULL,
66
+ "created" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
67
+ "updated" DATETIME NOT NULL,
68
+ "template_id" TEXT NOT NULL,
69
+ "definition" JSONB NOT NULL,
70
+ "plugins" JSONB NOT NULL,
71
+ "compiledAt" DATETIME NOT NULL,
72
+ CONSTRAINT "recipe_template_id_fkey" FOREIGN KEY ("template_id") REFERENCES "template" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
73
+ );
74
+
75
+ -- CreateTable
76
+ CREATE TABLE "recipe_permission" (
77
+ "recipe_id" TEXT NOT NULL,
78
+ "role_id" TEXT NOT NULL,
79
+ "level" TEXT NOT NULL,
80
+
81
+ PRIMARY KEY ("recipe_id", "role_id"),
82
+ CONSTRAINT "recipe_permission_recipe_id_fkey" FOREIGN KEY ("recipe_id") REFERENCES "recipe" ("id") ON DELETE CASCADE ON UPDATE CASCADE
83
+ );
84
+
85
+ -- CreateTable
86
+ CREATE TABLE "recipe_bag" (
87
+ "recipe_id" TEXT NOT NULL,
88
+ "bag_id" TEXT NOT NULL,
89
+ "priority" INTEGER NOT NULL,
90
+ "is_writable" BOOLEAN NOT NULL,
91
+ "prefix" TEXT NOT NULL,
92
+
93
+ PRIMARY KEY ("recipe_id", "bag_id", "prefix"),
94
+ CONSTRAINT "recipe_bag_recipe_id_fkey" FOREIGN KEY ("recipe_id") REFERENCES "recipe" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
95
+ CONSTRAINT "recipe_bag_bag_id_fkey" FOREIGN KEY ("bag_id") REFERENCES "bag" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
96
+ );
97
+
98
+ -- CreateTable
99
+ CREATE TABLE "settings" (
100
+ "key" TEXT NOT NULL PRIMARY KEY,
101
+ "value" TEXT NOT NULL,
102
+ "updated" DATETIME NOT NULL
103
+ );
104
+
105
+ -- CreateTable
106
+ CREATE TABLE "roles" (
107
+ "role_id" TEXT NOT NULL PRIMARY KEY,
108
+ "role_name" TEXT NOT NULL,
109
+ "description" TEXT
110
+ );
111
+
112
+ -- CreateTable
113
+ CREATE TABLE "users" (
114
+ "user_id" TEXT NOT NULL PRIMARY KEY,
115
+ "username" TEXT NOT NULL,
116
+ "email" TEXT NOT NULL,
117
+ "password" TEXT NOT NULL,
118
+ "resetCode" TEXT,
119
+ "created_at" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
120
+ "last_login" DATETIME
121
+ );
122
+
123
+ -- CreateTable
124
+ CREATE TABLE "sessions" (
125
+ "session_id" TEXT NOT NULL PRIMARY KEY,
126
+ "created_at" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
127
+ "last_accessed" DATETIME NOT NULL,
128
+ "session_key" TEXT,
129
+ "user_id" TEXT NOT NULL,
130
+ CONSTRAINT "sessions_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "users" ("user_id") ON DELETE NO ACTION ON UPDATE NO ACTION
131
+ );
132
+
133
+ -- CreateTable
134
+ CREATE TABLE "_RolesToUsers" (
135
+ "A" TEXT NOT NULL,
136
+ "B" TEXT NOT NULL,
137
+ CONSTRAINT "_RolesToUsers_A_fkey" FOREIGN KEY ("A") REFERENCES "roles" ("role_id") ON DELETE CASCADE ON UPDATE CASCADE,
138
+ CONSTRAINT "_RolesToUsers_B_fkey" FOREIGN KEY ("B") REFERENCES "users" ("user_id") ON DELETE CASCADE ON UPDATE CASCADE
139
+ );
140
+
141
+ -- CreateIndex
142
+ CREATE UNIQUE INDEX "bag_name_key" ON "bag"("name");
143
+
144
+ -- CreateIndex
145
+ CREATE INDEX "tiddler_title_idx" ON "tiddler"("title");
146
+
147
+ -- CreateIndex
148
+ CREATE INDEX "tiddler_event_bag_id_seq_idx" ON "tiddler_event"("bag_id", "seq");
149
+
150
+ -- CreateIndex
151
+ CREATE UNIQUE INDEX "template_name_key" ON "template"("name");
152
+
153
+ -- CreateIndex
154
+ CREATE UNIQUE INDEX "recipe_slug_key" ON "recipe"("slug");
155
+
156
+ -- CreateIndex
157
+ CREATE UNIQUE INDEX "roles_role_name_key" ON "roles"("role_name");
158
+
159
+ -- CreateIndex
160
+ CREATE UNIQUE INDEX "users_username_key" ON "users"("username");
161
+
162
+ -- CreateIndex
163
+ CREATE UNIQUE INDEX "users_email_key" ON "users"("email");
164
+
165
+ -- CreateIndex
166
+ CREATE UNIQUE INDEX "users_resetCode_key" ON "users"("resetCode") WHERE "resetCode" IS NOT NULL;
167
+
168
+ -- CreateIndex
169
+ CREATE UNIQUE INDEX "_RolesToUsers_AB_unique" ON "_RolesToUsers"("A", "B");
170
+
171
+ -- CreateIndex
172
+ CREATE INDEX "_RolesToUsers_B_index" ON "_RolesToUsers"("B");
@@ -0,0 +1,3 @@
1
+ # Please do not edit this file manually
2
+ # It should be added in your version-control system (e.g., Git)
3
+ provider = "sqlite"
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "@tiddlywiki/mws-prisma",
3
+ "private": true,
4
+ "version": "1.0.0",
5
+ "main": "index.ts",
6
+ "types": "index.ts",
7
+ "browser": "browser.ts",
8
+ "dependencies": {},
9
+ "devDependencies": {
10
+ "@types/node": "^24.6.0"
11
+ }
12
+ }