@tiddlywiki/mws 0.1.13 → 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.
Files changed (118) hide show
  1. package/README.md +41 -20
  2. package/dist/metafile-esm.json +1 -1
  3. package/dist/mws.js +40249 -20249
  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 +11 -39
  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/multiwikiclientadaptor.js +1 -1
  14. package/plugins/client/tiddlers/syncer/new-multiwikiclientadaptor.js +432 -0
  15. package/plugins/client/tiddlers/syncer/syncer.js +123 -241
  16. package/plugins/client/tsconfig.json +5 -1
  17. package/prisma/browser.ts +2 -0
  18. package/prisma/client/browser.ts +84 -0
  19. package/prisma/client/client.ts +108 -0
  20. package/prisma/client/commonInputTypes.ts +598 -0
  21. package/prisma/client/enums.ts +42 -0
  22. package/prisma/client/internal/class.ts +326 -0
  23. package/prisma/client/internal/prismaNamespace.ts +1870 -0
  24. package/prisma/client/internal/prismaNamespaceBrowser.ts +259 -0
  25. package/prisma/client/models/Bag.ts +1701 -0
  26. package/prisma/client/models/BagPermission.ts +1284 -0
  27. package/prisma/client/models/Recipe.ts +1722 -0
  28. package/prisma/client/models/RecipeBag.ts +1518 -0
  29. package/prisma/client/models/RecipePermission.ts +1284 -0
  30. package/prisma/client/models/Roles.ts +1316 -0
  31. package/prisma/client/models/Sessions.ts +1344 -0
  32. package/prisma/client/models/Settings.ts +1093 -0
  33. package/prisma/client/models/Template.ts +1477 -0
  34. package/prisma/client/models/TemplatePermission.ts +1284 -0
  35. package/prisma/client/models/Tiddler.ts +1434 -0
  36. package/prisma/client/models/TiddlerEvent.ts +1360 -0
  37. package/prisma/client/models/Users.ts +1579 -0
  38. package/prisma/client/models.ts +24 -0
  39. package/prisma/client/pjtg.ts +183 -0
  40. package/prisma/index.ts +74 -0
  41. package/prisma/migrations/20260708160259_init/migration.sql +172 -0
  42. package/prisma/migrations-v1/migration_lock.toml +3 -0
  43. package/prisma/package.json +12 -0
  44. package/prisma/schema.prisma +147 -89
  45. package/prisma/types.ts +9 -0
  46. package/public/.default.html +1 -0
  47. package/public/admin-vanilla/fish.svg +399 -0
  48. package/public/admin-vanilla/fish2.svg +389 -0
  49. package/public/admin-vanilla/main-64WYHWYI.js +1791 -0
  50. package/public/admin-vanilla/main-64WYHWYI.js.map +7 -0
  51. package/public/admin-vanilla/main-LYDE4NDJ.css +1 -0
  52. package/public/admin-vanilla/normalize.css +349 -0
  53. package/public/admin-vanilla/polyfill-ADOI2A4V.js +2 -0
  54. package/public/admin-vanilla/polyfill-ADOI2A4V.js.map +7 -0
  55. package/public/{react-admin → admin-vanilla}/site.webmanifest +1 -1
  56. package/public/admin-vanilla.html +62 -0
  57. package/public/admin-vanilla.json +1 -0
  58. package/public/{react-admin → stats}/stats.html +5 -2
  59. package/public/{react-admin → stats}/stats.js +2 -1
  60. package/scripts/build-docs.sh +30 -0
  61. package/scripts/helpers.mjs +107 -0
  62. package/scripts/json.js +8 -0
  63. package/scripts/scripts.mjs +114 -0
  64. package/prisma/client/client.d.ts +0 -1
  65. package/prisma/client/client.js +0 -3
  66. package/prisma/client/default.d.ts +0 -1
  67. package/prisma/client/default.js +0 -3
  68. package/prisma/client/edge.d.ts +0 -1
  69. package/prisma/client/edge.js +0 -297
  70. package/prisma/client/index-browser.js +0 -275
  71. package/prisma/client/index.d.ts +0 -17770
  72. package/prisma/client/index.js +0 -324
  73. package/prisma/client/package.json +0 -173
  74. package/prisma/client/query_engine_bg.js +0 -811
  75. package/prisma/client/query_engine_bg.wasm +0 -0
  76. package/prisma/client/runtime/edge-esm.js +0 -10000
  77. package/prisma/client/runtime/edge.js +0 -10036
  78. package/prisma/client/runtime/index-browser.d.ts +0 -370
  79. package/prisma/client/runtime/index-browser.js +0 -2300
  80. package/prisma/client/runtime/library.d.ts +0 -3681
  81. package/prisma/client/runtime/library.js +0 -10604
  82. package/prisma/client/runtime/react-native.js +0 -10629
  83. package/prisma/client/runtime/wasm-compiler-edge.js +0 -11238
  84. package/prisma/client/runtime/wasm-engine-edge.js +0 -7801
  85. package/prisma/client/schema.prisma +0 -156
  86. package/prisma/client/wasm-edge-light-loader.mjs +0 -4
  87. package/prisma/client/wasm-worker-loader.mjs +0 -4
  88. package/prisma/client/wasm.d.ts +0 -1
  89. package/prisma/client/wasm.js +0 -304
  90. package/prisma/global.ts +0 -53
  91. package/public/react-admin/chunk-YALWN5OT.js +0 -2
  92. package/public/react-admin/esm-L4WLVWJN.js +0 -3
  93. package/public/react-admin/esm-L4WLVWJN.js.map +0 -7
  94. package/public/react-admin/esm-QMNGI3LF.js +0 -3
  95. package/public/react-admin/esm-QMNGI3LF.js.map +0 -7
  96. package/public/react-admin/index.html +0 -36
  97. package/public/react-admin/main.js +0 -268
  98. package/public/react-admin/main.js.map +0 -7
  99. package/public/react-admin/stats.json +0 -1
  100. package/scripts.mjs +0 -142
  101. /package/prisma/{migrations → migrations-v1}/20250606001949_init/migration.sql +0 -0
  102. /package/prisma/{migrations → migrations-v1}/20250613000526_remove_group/migration.sql +0 -0
  103. /package/prisma/{migrations → migrations-v1}/20250620014502_settings/migration.sql +0 -0
  104. /package/prisma/{migrations → migrations-v1}/20250707205229_recipes/migration.sql +0 -0
  105. /package/public/{react-admin → admin-vanilla}/android-chrome-192x192.png +0 -0
  106. /package/public/{react-admin → admin-vanilla}/android-chrome-512x512.png +0 -0
  107. /package/public/{react-admin → admin-vanilla}/apple-touch-icon.png +0 -0
  108. /package/public/{react-admin → admin-vanilla}/favicon-16x16.png +0 -0
  109. /package/public/{react-admin → admin-vanilla}/favicon-32x32.png +0 -0
  110. /package/public/{react-admin → admin-vanilla}/favicon.ico +0 -0
  111. /package/public/{react-admin → admin-vanilla}/favicon.png +0 -0
  112. /package/public/{react-admin/chunk-YALWN5OT.js.map → admin-vanilla/main-LYDE4NDJ.css.map} +0 -0
  113. /package/public/{react-admin → admin-vanilla}/missing-favicon.png +0 -0
  114. /package/public/{react-admin → admin-vanilla}/motovun-jack.jpg +0 -0
  115. /package/public/{react-admin → admin-vanilla}/mws-icon.png +0 -0
  116. /package/public/{react-admin → admin-vanilla}/vite.svg +0 -0
  117. /package/public/{react-admin → stats}/stats.css +0 -0
  118. /package/public/{react-admin → stats}/stats.svg +0 -0
@@ -1,127 +1,160 @@
1
1
  datasource db {
2
2
  provider = "sqlite"
3
- url = env("DATABASE_URL")
4
3
  }
5
4
 
6
5
  generator client {
7
- // prisma 7 will remove the need for native node files, everything will be js and wasm
8
- provider = "prisma-client-js"
9
- previewFeatures = ["relationJoins", "driverAdapters"]
10
- binaryTargets = []
11
- output = "client"
6
+ provider = "prisma-client"
7
+ output = "client"
8
+ previewFeatures = ["partialIndexes"]
12
9
  }
13
10
 
14
11
  generator json {
15
- provider = "prisma-json-types-generator"
12
+ provider = "prisma-json-types-generator"
13
+ namespace = "PrismaJson"
16
14
  }
17
15
 
18
- enum Permission {
19
- READ
20
- WRITE
21
- ADMIN
16
+ // ---------------------------------------------------------------------------
17
+ // Tiddler storage
18
+ // ---------------------------------------------------------------------------
19
+
20
+ model Bag {
21
+ id String @id @default(uuid(7))
22
+ name String @unique
23
+ created DateTime @default(now())
24
+ updated DateTime @updatedAt
25
+ description String
26
+ permissions BagPermission[]
27
+ tiddlers Tiddler[]
28
+ recipe_bags RecipeBag[]
29
+ tiddler_events TiddlerEvent[]
30
+
31
+ @@map("bag")
22
32
  }
23
33
 
24
- // The `packages/mws/src/managers/` folder is the primary place this schema is used.
25
- // SQLite initialization is done in `packages/mws/src/db/sqlite-adapter.ts`.
34
+ // role_id references the auth module's roles table; no FK declared here —
35
+ // permission and auth tables are owned by separate modules.
36
+ model BagPermission {
37
+ bag_id String
38
+ role_id String
39
+ level BagPermissionLevel
40
+ bag Bag @relation(fields: [bag_id], references: [id], onDelete: Cascade)
26
41
 
27
- model Settings {
28
- key String @id
29
- value String
42
+ @@id([bag_id, role_id])
43
+ @@map("bag_permission")
44
+ }
30
45
 
31
- @@map("settings")
46
+ model Tiddler {
47
+ bag_id String
48
+ title String
49
+ created DateTime @default(now())
50
+ updated DateTime @updatedAt
51
+ revision BigInt @default(0)
52
+ // partition_key String @default("")
53
+ /// [Tiddler_fields]
54
+ fields Json
55
+ bag Bag @relation(fields: [bag_id], references: [id], onDelete: Cascade)
56
+
57
+ @@id([bag_id, title])
58
+ @@index([title])
59
+ @@map("tiddler")
32
60
  }
33
61
 
34
- model Recipes {
35
- recipe_id String @id @default(uuid(7))
36
- recipe_name String @unique
37
- description String
38
- owner_id String?
39
- /// [Recipes_plugin_names]
40
- plugin_names Json
41
- skip_required_plugins Boolean @default(false)
42
- skip_core Boolean @default(false)
43
- preload_store Boolean @default(false)
44
- custom_wiki String?
45
- recipe_bags Recipe_bags[]
46
- acl RecipeAcl[]
62
+ model TiddlerEvent {
63
+ seq Int @id @default(autoincrement())
64
+ bag_id String
65
+ title String
66
+ type TiddlerEventType
47
67
 
48
- @@map("recipes")
49
- }
68
+ bag Bag @relation(fields: [bag_id], references: [id], onDelete: Cascade)
50
69
 
51
- model RecipeAcl {
52
- acl_id Int @id @default(autoincrement())
53
- role_id String
54
- permission Permission
55
- recipe Recipes @relation(fields: [recipe_id], references: [recipe_id], onDelete: Cascade)
56
- recipe_id String
70
+ @@index([bag_id, seq])
71
+ @@map("tiddler_event")
72
+ }
57
73
 
58
- @@map("recipe_acl")
74
+ enum TiddlerEventType {
75
+ save
76
+ delete
59
77
  }
60
78
 
61
- model Recipe_bags {
62
- recipe_id String
63
- bag_id String
64
- position Int
65
- with_acl Boolean @default(false)
66
- load_modules Boolean @default(false)
79
+ model Template {
80
+ id String @id @default(uuid(7))
81
+ name String @unique
82
+ created DateTime @default(now())
83
+ updated DateTime @updatedAt
84
+ /// [Template_type]
85
+ type String
86
+ /// [Template_definition]
87
+ definition Json
88
+ recipes Recipe[]
89
+ permissions TemplatePermission[]
90
+
91
+ @@map("template")
92
+ }
67
93
 
68
- bag Bags @relation(fields: [bag_id], references: [bag_id], onDelete: Cascade)
69
- recipe Recipes @relation(fields: [recipe_id], references: [recipe_id], onDelete: Cascade)
94
+ model TemplatePermission {
95
+ template_id String
96
+ role_id String
97
+ level TemplatePermissionLevel
98
+ template Template @relation(fields: [template_id], references: [id], onDelete: Cascade)
70
99
 
71
- @@unique([recipe_id, bag_id])
72
- @@index([recipe_id])
73
- @@map("recipe_bags")
100
+ @@id([template_id, role_id])
101
+ @@map("template_permission")
74
102
  }
75
103
 
76
- model Bags {
77
- bag_id String @id @default(uuid(7))
78
- bag_name String @unique
79
- description String
80
- owner_id String?
81
- recipe_bags Recipe_bags[]
82
- tiddlers Tiddlers[]
83
- acl BagAcl[]
84
-
85
- @@map("bags")
104
+ model Recipe {
105
+ id String @id @default(uuid(7))
106
+ slug String @unique
107
+ created DateTime @default(now())
108
+ updated DateTime @updatedAt
109
+ template_id String
110
+ /// [Recipe_definition]
111
+ definition Json
112
+ template Template @relation(fields: [template_id], references: [id], onDelete: Restrict)
113
+ recipe_bags RecipeBag[]
114
+ permissions RecipePermission[]
115
+ /// [Recipe_plugins]
116
+ plugins Json
117
+ compiledAt DateTime
118
+
119
+ @@map("recipe")
86
120
  }
87
121
 
88
- model BagAcl {
89
- acl_id Int @id @default(autoincrement())
90
- bag_id String
91
- bag Bags @relation(fields: [bag_id], references: [bag_id], onDelete: Cascade)
92
- role_id String
93
- permission Permission
122
+ model RecipePermission {
123
+ recipe_id String
124
+ role_id String
125
+ level RecipePermissionLevel
126
+ recipe Recipe @relation(fields: [recipe_id], references: [id], onDelete: Cascade)
94
127
 
95
- @@map("bag_acl")
128
+ @@id([recipe_id, role_id])
129
+ @@map("recipe_permission")
96
130
  }
97
131
 
98
- model Tiddlers {
99
- revision_id String @id @default(uuid(7))
100
- bag_id String
101
- title String
102
- is_deleted Boolean
103
- attachment_hash String?
104
- fields Fields[]
105
- // Deleting a referenced record (bag) will trigger the deletion of referencing record (tiddler).
106
- bag Bags @relation(fields: [bag_id], references: [bag_id], onDelete: Cascade)
107
-
108
- @@unique([bag_id, title])
109
- @@index([bag_id])
110
- @@map("tiddlers")
132
+ model RecipeBag {
133
+ recipe_id String
134
+ bag_id String
135
+ priority Int
136
+ is_writable Boolean
137
+ prefix String
138
+ recipe Recipe @relation(fields: [recipe_id], references: [id], onDelete: Cascade)
139
+ bag Bag @relation(fields: [bag_id], references: [id], onDelete: Restrict)
140
+
141
+ @@id([recipe_id, bag_id, prefix])
142
+ @@map("recipe_bag")
111
143
  }
112
144
 
113
- model Fields {
114
- revision_id String
115
- field_name String
116
- field_value String
117
- // Deleting a referenced record (tiddler) will trigger the deletion of referencing record (field).
118
- tiddler Tiddlers @relation(fields: [revision_id], references: [revision_id], onDelete: Cascade)
145
+ model Settings {
146
+ key String @id
147
+ value String
148
+ updated DateTime @updatedAt
119
149
 
120
- @@id([revision_id, field_name])
121
- @@index([revision_id])
122
- @@map("fields")
150
+ @@map("settings")
123
151
  }
124
152
 
153
+ // ---------------------------------------------------------------------------
154
+ // Auth — managed by the auth module, separate from tiddler storage.
155
+ // No FK references cross from auth into tiddler/recipe/bag tables.
156
+ // ---------------------------------------------------------------------------
157
+
125
158
  model Roles {
126
159
  role_id String @id @default(uuid(7))
127
160
  role_name String @unique()
@@ -136,6 +169,11 @@ model Users {
136
169
  username String @unique
137
170
  email String @unique
138
171
  password String
172
+
173
+ // MySQL: multiple NULLs are allowed in unique columns and there is no way to make a partial index.
174
+ // SQL Server: the `where` clause is required to get the "multiple NULLs allowed" behavior.
175
+ // Everything else: multiple nulls are allowed in unique columns and partial indexes also work
176
+ resetCode String? @unique(where: { resetCode: { not: null } })
139
177
  created_at DateTime @default(now())
140
178
  last_login DateTime?
141
179
  sessions Sessions[]
@@ -154,3 +192,23 @@ model Sessions {
154
192
 
155
193
  @@map("sessions")
156
194
  }
195
+
196
+ // ---------------------------------------------------------------------------
197
+ // Enums
198
+ // ---------------------------------------------------------------------------
199
+
200
+ enum BagPermissionLevel {
201
+ A_read
202
+ B_write
203
+ C_admin
204
+ }
205
+
206
+ enum RecipePermissionLevel {
207
+ A_read
208
+ B_write
209
+ }
210
+
211
+ enum TemplatePermissionLevel {
212
+ A_read
213
+ B_write
214
+ }
@@ -0,0 +1,9 @@
1
+ import type { Prisma } from "./client/browser";
2
+ export type { PrismaClient } from "./client/client";
3
+ export type PrismaPromise<T> = Prisma.PrismaPromise<T>;
4
+ export type {
5
+ GetResult,
6
+ DefaultArgs,
7
+ Types,
8
+ ITXClientDenyList
9
+ } from "@prisma/client/runtime/client";
@@ -0,0 +1 @@
1
+ <!-- esbuild dev fallback -->