@freema/drobek-modules 0.3.3

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 (33) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +53 -0
  3. package/dist/chunk-WHKPW5MP.js +6611 -0
  4. package/dist/index.d.ts +1604 -0
  5. package/dist/index.js +373 -0
  6. package/dist/mail-guard.d-BKJhsVA2.d.ts +2097 -0
  7. package/dist/migrations/core/0000_dusty_scarecrow.sql +84 -0
  8. package/dist/migrations/core/0001_busy_orphan.sql +69 -0
  9. package/dist/migrations/core/0002_odd_alex_power.sql +17 -0
  10. package/dist/migrations/core/0003_nosy_shatterstar.sql +26 -0
  11. package/dist/migrations/core/0004_nice_ben_parker.sql +27 -0
  12. package/dist/migrations/core/0005_panoramic_bill_hollister.sql +4 -0
  13. package/dist/migrations/core/0006_outgoing_ricochet.sql +29 -0
  14. package/dist/migrations/core/0007_app_versions.sql +95 -0
  15. package/dist/migrations/core/0008_user_bound_tokens.sql +42 -0
  16. package/dist/migrations/core/0009_app_name.sql +1 -0
  17. package/dist/migrations/core/0010_apps_origin.sql +12 -0
  18. package/dist/migrations/core/0011_modules.sql +32 -0
  19. package/dist/migrations/core/0012_data_module_tables.sql +9 -0
  20. package/dist/migrations/core/0014_get_logs.sql +26 -0
  21. package/dist/migrations/core/0016_apps_slug_release.sql +8 -0
  22. package/dist/migrations/core/0018_custom_domains.sql +22 -0
  23. package/dist/migrations/core/0021_abuse_reports.sql +23 -0
  24. package/dist/migrations/core/0022_gallery.sql +20 -0
  25. package/dist/migrations/core/0023_workspace_modules.sql +13 -0
  26. package/dist/migrations/core/0024_app_assets.sql +18 -0
  27. package/dist/migrations/core/0025_app_asset_snapshots.sql +28 -0
  28. package/dist/migrations/core/0026_publish_approval.sql +13 -0
  29. package/dist/migrations/core/0027_publish_block.sql +6 -0
  30. package/dist/migrations/core/meta/_journal.json +167 -0
  31. package/dist/testing.d.ts +269 -0
  32. package/dist/testing.js +1569 -0
  33. package/package.json +63 -0
package/README.md ADDED
@@ -0,0 +1,53 @@
1
+ # @drobek/modules
2
+
3
+ The platform module contract of [drobek](https://github.com/freema/drobek) —
4
+ the cloud workspace where an agent builds, previews and publishes web apps.
5
+ A platform module is the server half of an app backend: routes under
6
+ `/__drobek/v1/<module>/…`, a slice of the browser SDK (`drobek.<module>`),
7
+ a per-app config the agent sets with `configure_module` and a skill the
8
+ agent reads with `skill_info`.
9
+
10
+ Published on npm as `@freema/drobek-modules`; a module installs it under the
11
+ name its code imports, with an npm alias, and declares it as a peer (the
12
+ server provides its own copy):
13
+
14
+ ```sh
15
+ npm install --save-dev @drobek/modules@npm:@freema/drobek-modules@^X.Y.Z
16
+ ```
17
+
18
+ ```json
19
+ {
20
+ "peerDependencies": { "@drobek/modules": ">=X.Y.Z" },
21
+ "devDependencies": { "@drobek/modules": "npm:@freema/drobek-modules@^X.Y.Z" }
22
+ }
23
+ ```
24
+
25
+ ```ts
26
+ import { defineModule, z } from '@drobek/modules';
27
+
28
+ export default defineModule({
29
+ name: 'erp',
30
+ version: '1.0.0',
31
+ contract: '^1.1',
32
+ skill: { useWhen: 'the app reads orders from the company ERP', markdown: '# erp — …' },
33
+ configSchema: z.object({}),
34
+ configDefaults: {},
35
+ routes(r) {
36
+ r.get('/', { rule: 'public' }, () => ({ ok: true }));
37
+ },
38
+ });
39
+ ```
40
+
41
+ - `@drobek/modules` — `defineModule`, `z`, `respond`, `ModuleError` and the
42
+ types a module needs (`ModuleContext`, `DB`, `Logger`, `SdkCore`, …).
43
+ - `@drobek/modules/testing` — `createModuleTestContext` (a route through
44
+ the production pipeline, without a server), `coreMigrationsDir` +
45
+ `createTestApp` (a PGlite database with the core schema) and
46
+ `checkSkill` (the SKILL.md gate the built-in modules pass).
47
+
48
+ Start a module with `npm create drobek-module@latest <name>`. The guide —
49
+ contract, testing, publishing, installing on a server — is
50
+ [Writing a module](https://github.com/freema/drobek/blob/main/docs/MODULES.md#writing-a-module).
51
+
52
+ `zod` and `drizzle-orm` are peer dependencies: on a drobek server an
53
+ external module uses the server's own instances. Licence: AGPL-3.0-only.