@3sln/create-trove 0.0.18 → 0.0.20
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/package.json +1 -1
- package/src/render.js +20 -3
package/package.json
CHANGED
package/src/render.js
CHANGED
|
@@ -184,11 +184,15 @@ function renderWorkers(plan, files, steps, secrets) {
|
|
|
184
184
|
path: 'src/worker.js',
|
|
185
185
|
contents: `// The Worker entry.
|
|
186
186
|
//
|
|
187
|
+
// Three exports matter: the default is the fetch handler, TroveTasks owns scans and
|
|
188
|
+
// reindexes, and TrovePluginStore gives each plugin scope its own SQLite database. Each
|
|
189
|
+
// Durable Object class must be exported HERE and declared in wrangler.toml, or the
|
|
190
|
+
// binding fails to resolve at deploy time.
|
|
187
191
|
// Both exports matter: the default export is the fetch handler, and TroveTasks is the
|
|
188
192
|
// Durable Object class that owns scans and reindexes. Wrangler looks the DO class up by
|
|
189
193
|
// name in this module, so re-exporting it here is what makes the binding resolve —
|
|
190
194
|
// declaring it in wrangler.toml without this is a deploy-time error.
|
|
191
|
-
export { default, TroveTasks } from '@3sln/trove/server/adapters/worker.js';
|
|
195
|
+
export { default, TroveTasks, TrovePluginStore } from '@3sln/trove/server/adapters/worker.js';
|
|
192
196
|
`,
|
|
193
197
|
});
|
|
194
198
|
|
|
@@ -493,17 +497,30 @@ function wranglerToml(plan) {
|
|
|
493
497
|
L.push('name = "TASKS"');
|
|
494
498
|
L.push('class_name = "TroveTasks"');
|
|
495
499
|
L.push('');
|
|
500
|
+
// One SQLite database per plugin scope, addressed by name. This is what makes plugin
|
|
501
|
+
// storage isolated on Workers: a scope key embeds the user and the plugin, so it can
|
|
502
|
+
// never be pre-bound, and D1 cannot create a database on demand. Without this a drive
|
|
503
|
+
// falls back to one shared D1 table holding every plugin's data side by side.
|
|
504
|
+
L.push('# One SQLite database per plugin scope. Without it every plugin\'s data shares');
|
|
505
|
+
L.push('# a single D1 binding — see "Plugin storage" in the README.');
|
|
506
|
+
L.push('[[durable_objects.bindings]]');
|
|
507
|
+
L.push('name = "PLUGIN_STORE"');
|
|
508
|
+
L.push('class_name = "TrovePluginStore"');
|
|
509
|
+
L.push('');
|
|
496
510
|
L.push('[[migrations]]');
|
|
497
511
|
L.push('tag = "v1"');
|
|
498
|
-
L.push('new_sqlite_classes = ["TroveTasks"]');
|
|
512
|
+
L.push('new_sqlite_classes = ["TroveTasks", "TrovePluginStore"]');
|
|
499
513
|
L.push('');
|
|
500
514
|
} else {
|
|
501
515
|
L.push('# [[durable_objects.bindings]] # optional: owns scans and reindexes');
|
|
502
516
|
L.push('# name = "TASKS"');
|
|
503
517
|
L.push('# class_name = "TroveTasks"');
|
|
518
|
+
L.push('# [[durable_objects.bindings]] # one SQLite database per plugin scope');
|
|
519
|
+
L.push('# name = "PLUGIN_STORE"');
|
|
520
|
+
L.push('# class_name = "TrovePluginStore"');
|
|
504
521
|
L.push('# [[migrations]]');
|
|
505
522
|
L.push('# tag = "v1"');
|
|
506
|
-
L.push('# new_sqlite_classes = ["TroveTasks"]');
|
|
523
|
+
L.push('# new_sqlite_classes = ["TroveTasks", "TrovePluginStore"]');
|
|
507
524
|
L.push('');
|
|
508
525
|
}
|
|
509
526
|
|