@micro-cms/types 1.0.20 → 1.0.22
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/README.md +46 -0
- package/package.json +11 -2
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.
|
|
3
|
+
"version": "1.0.22",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -22,5 +22,14 @@
|
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"typescript": "^5.0.0",
|
|
24
24
|
"tsup": "^8.0.2"
|
|
25
|
-
}
|
|
25
|
+
},
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "git+https://github.com/teamoremi/micro-cms.git",
|
|
29
|
+
"directory": "packages/types"
|
|
30
|
+
},
|
|
31
|
+
"bugs": {
|
|
32
|
+
"url": "https://github.com/teamoremi/micro-cms/issues"
|
|
33
|
+
},
|
|
34
|
+
"homepage": "https://github.com/teamoremi/micro-cms/tree/master/packages/types#readme"
|
|
26
35
|
}
|