@micro-cms/types 1.0.20 → 1.0.21

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 (2) hide show
  1. package/README.md +46 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,46 @@
1
+ # @micro-cms/types
2
+
3
+ Standardized TypeScript interfaces and type definitions for the Micro-CMS ecosystem. This package ensures strict contracts between modules, the runtime, and front-end components.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pnpm add @micro-cms/types
9
+ ```
10
+
11
+ ## Key Definitions
12
+
13
+ ### 1. Schema System
14
+ Defines the `Entity`, `Field`, and `Schema` structures used to drive the Admin UI and validation logic.
15
+
16
+ ### 2. Module System
17
+ - **`CmsModule`**: The interface every module must implement.
18
+ - **`ModuleManifest`**: Metadata about a module, including its capabilities (`provides`) and requirements (`requires`).
19
+ - **`CmsContext`**: The object passed to a module during load, containing access to the runtime, events, and shared state.
20
+
21
+ ### 3. Capabilities
22
+ Contracts for common system functionalities:
23
+ - **`DataProvider`**: For database adapters.
24
+ - **`RouteProvider`**: For contributing API endpoints.
25
+ - **`PaymentProvider`**: For blockchain payment integrations.
26
+
27
+ ### 4. Event System
28
+ Types for the staged event bus, including `EventStage` (`validation`, `processing`, `notification`) and `SubscriptionOptions`.
29
+
30
+ ## Usage
31
+
32
+ This package is typically used as a `devDependency` in other modules to ensure type safety:
33
+
34
+ ```typescript
35
+ import { CmsModule, CmsContext } from '@micro-cms/types';
36
+
37
+ export default {
38
+ manifest: {
39
+ name: 'my-module',
40
+ provides: ['custom-capability']
41
+ },
42
+ async load(context: CmsContext) {
43
+ // ...
44
+ }
45
+ } as CmsModule;
46
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micro-cms/types",
3
- "version": "1.0.20",
3
+ "version": "1.0.21",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",