55 * ObjectStack specification for plugin lifecycle and context.
66 */
77
8- import type { PluginDefinition , PluginContextData , ObjectStackManifest } from '@objectstack/spec/kernel ' ;
8+ import type { PluginDefinition , PluginContextData , ObjectStackManifest } from '@objectstack/spec/system ' ;
99
1010/**
1111 * Plugin Manifest
12- * Conforms to @objectstack/spec/kernel /ManifestSchema
12+ * Conforms to @objectstack/spec/system /ManifestSchema
1313 *
1414 * This is typically stored in a package.json or manifest.json file
1515 * and loaded by the kernel. For this example, we define it inline.
@@ -24,74 +24,31 @@ export const ExampleCRMManifest: ObjectStackManifest = {
2424 'system.user.read' ,
2525 'system.data.write' ,
2626 ] ,
27- // Object files can be specified as glob patterns
27+ // In v0.4.1, objects are defined via glob patterns pointing to object definition files
28+ // Object files should be YAML or TypeScript files following the object schema
2829 objects : [ './objects/*.object.yml' ] ,
29- // Or provided inline as compiled definitions
30- definitions : {
31- objects : {
32- 'crm_lead' : {
33- name : 'crm_lead' ,
34- label : 'Lead' ,
35- pluralLabel : 'Leads' ,
36- description : 'Sales lead tracking' ,
37- icon : 'user-plus' ,
38- active : true ,
39- isSystem : false ,
40- abstract : false ,
41- datasource : 'default' ,
42- fields : {
43- name : {
44- type : 'text' ,
45- label : 'Lead Name' ,
46- required : true ,
47- searchable : true ,
48- multiple : false ,
49- unique : false ,
50- deleteBehavior : 'set_null' ,
51- hidden : false ,
52- readonly : false ,
53- encryption : false ,
54- index : false ,
55- externalId : false ,
56- } ,
57- email : {
58- type : 'email' ,
59- label : 'Email' ,
60- required : true ,
61- searchable : true ,
62- unique : true ,
63- multiple : false ,
64- deleteBehavior : 'set_null' ,
65- hidden : false ,
66- readonly : false ,
67- encryption : false ,
68- index : true ,
69- externalId : false ,
70- } ,
71- status : {
72- type : 'select' ,
73- label : 'Status' ,
74- required : true ,
75- searchable : true ,
76- multiple : false ,
77- unique : false ,
78- deleteBehavior : 'set_null' ,
79- hidden : false ,
80- readonly : false ,
81- encryption : false ,
82- index : false ,
83- externalId : false ,
84- options : [
85- { label : 'New' , value : 'new' , default : true } ,
86- { label : 'Contacted' , value : 'contacted' } ,
87- { label : 'Qualified' , value : 'qualified' } ,
88- { label : 'Converted' , value : 'converted' } ,
89- { label : 'Lost' , value : 'lost' } ,
90- ] ,
91- } ,
92- } ,
93- } ,
94- } ,
30+
31+ // Contribution points for extending the platform
32+ contributes : {
33+ // Register custom actions that can be invoked by flows or API
34+ actions : [
35+ {
36+ name : 'convertLead' ,
37+ label : 'Convert Lead to Account' ,
38+ description : 'Converts a lead to an account and contact' ,
39+ }
40+ ] ,
41+ // Register custom events that this plugin listens to
42+ events : [ 'crm_lead.created' , 'crm_lead.converted' ] ,
43+
44+ // Register custom field types
45+ fieldTypes : [
46+ {
47+ name : 'lead_status' ,
48+ label : 'Lead Status' ,
49+ description : 'Special field type for lead status with workflow integration' ,
50+ }
51+ ] ,
9552 } ,
9653} ;
9754
@@ -103,7 +60,7 @@ export const ExampleCRMManifest: ObjectStackManifest = {
10360 * - Using the plugin context (ql, os, logger, storage, etc.)
10461 * - Registering routes and scheduled jobs
10562 *
106- * Conforms to @objectstack/spec/kernel /PluginLifecycleSchema
63+ * Conforms to @objectstack/spec/system /PluginLifecycleSchema
10764 */
10865export const ExampleCRMPlugin : PluginDefinition = {
10966
@@ -125,7 +82,7 @@ export const ExampleCRMPlugin: PluginDefinition = {
12582 async onEnable ( context : PluginContextData ) {
12683 context . logger . info ( 'CRM Plugin: Enabling...' ) ;
12784
128- // The metadata from ExampleCRMManifest.definitions is loaded by the kernel
85+ // The metadata from object files (specified in manifest.objects) is loaded by the kernel
12986 // before this hook is called
13087
13188 // Register custom routes
@@ -226,20 +183,22 @@ export const ExampleCRMPlugin: PluginDefinition = {
226183 * await os.init();
227184 * ```
228185 *
229- * ## Plugin Architecture Notes
186+ * ## Plugin Architecture Notes (v0.4.1)
230187 *
231- * In the ObjectStack spec, plugins are separated into two parts:
188+ * In the ObjectStack spec v0.4.1 , plugins are separated into two parts:
232189 *
233- * 1. **Manifest** (@objectstack/spec/kernel /ManifestSchema)
190+ * 1. **Manifest** (@objectstack/spec/system /ManifestSchema)
234191 * - Static configuration (id, version, name, permissions)
235- * - Object definitions and metadata
192+ * - Object file glob patterns (objects are defined in separate files)
193+ * - Contribution points (actions, events, field types, etc.)
236194 * - Typically stored in package.json or manifest.json
237195 *
238- * 2. **Lifecycle Hooks** (@objectstack/spec/kernel /PluginLifecycleSchema)
196+ * 2. **Lifecycle Hooks** (@objectstack/spec/system /PluginLifecycleSchema)
239197 * - Runtime behavior (onInstall, onEnable, onLoad, etc.)
240198 * - Executable code
241199 * - Typically exported from index.ts or main.js
242200 *
243201 * The kernel loads manifests first to understand what plugins are available,
244- * then executes lifecycle hooks at appropriate times.
202+ * then loads object definitions from the files specified in manifest.objects,
203+ * and finally executes lifecycle hooks at appropriate times.
245204 */
0 commit comments