Skip to content

Commit 4c9febf

Browse files
Copilothotlong
andcommitted
Add plugin capability manifests to existing plugins
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 163ebad commit 4c9febf

File tree

3 files changed

+714
-3
lines changed

3 files changed

+714
-3
lines changed

packages/plugins/driver-memory/objectstack.config.ts

Lines changed: 223 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
import { ObjectStackManifest } from '@objectstack/spec/system';
22

3+
/**
4+
* In-Memory Driver Plugin Manifest
5+
*
6+
* Reference implementation of a storage driver that stores data in memory.
7+
* Demonstrates the driver protocol implementation pattern.
8+
*/
39
const MemoryDriverPlugin: ObjectStackManifest = {
410
id: 'com.objectstack.driver.memory',
511
name: 'In-Memory Driver',
612
version: '1.0.0',
713
type: 'driver',
8-
description: 'A reference specificiation implementation of the DriverInterface using in-memory arrays.',
14+
description: 'A reference specification implementation of the DriverInterface using in-memory arrays. Suitable for testing and development.',
915

1016
configuration: {
1117
title: 'Memory Driver Settings',
@@ -18,9 +24,223 @@ const MemoryDriverPlugin: ObjectStackManifest = {
1824
}
1925
},
2026

27+
// Plugin Capability Declaration
28+
capabilities: {
29+
// Protocols This Driver Implements
30+
implements: [
31+
{
32+
protocol: {
33+
id: 'com.objectstack.protocol.storage.v1',
34+
label: 'Storage Protocol v1',
35+
version: { major: 1, minor: 0, patch: 0 },
36+
description: 'Standard data storage and retrieval operations',
37+
},
38+
conformance: 'partial',
39+
implementedFeatures: [
40+
'basic_crud',
41+
'pagination',
42+
],
43+
features: [
44+
{
45+
name: 'basic_crud',
46+
enabled: true,
47+
description: 'Create, read, update, delete operations',
48+
},
49+
{
50+
name: 'pagination',
51+
enabled: true,
52+
description: 'Basic pagination via limit/offset',
53+
},
54+
{
55+
name: 'query_filters',
56+
enabled: false,
57+
description: 'Advanced query filtering',
58+
},
59+
{
60+
name: 'aggregations',
61+
enabled: false,
62+
description: 'Count, sum, avg operations',
63+
},
64+
{
65+
name: 'sorting',
66+
enabled: false,
67+
description: 'Result set sorting',
68+
},
69+
{
70+
name: 'transactions',
71+
enabled: false,
72+
description: 'ACID transaction support',
73+
},
74+
{
75+
name: 'joins',
76+
enabled: false,
77+
description: 'Cross-object joins',
78+
},
79+
],
80+
certified: false,
81+
},
82+
],
83+
84+
// Interfaces This Driver Provides
85+
provides: [
86+
{
87+
id: 'com.objectstack.driver.interface.driver',
88+
name: 'DriverInterface',
89+
description: 'Standard ObjectStack driver interface for data operations',
90+
version: { major: 1, minor: 0, patch: 0 },
91+
stability: 'stable',
92+
methods: [
93+
{
94+
name: 'connect',
95+
description: 'Initialize driver connection',
96+
returnType: 'Promise<void>',
97+
async: true,
98+
},
99+
{
100+
name: 'disconnect',
101+
description: 'Close driver connection',
102+
returnType: 'Promise<void>',
103+
async: true,
104+
},
105+
{
106+
name: 'create',
107+
description: 'Create a new record',
108+
parameters: [
109+
{
110+
name: 'object',
111+
type: 'string',
112+
required: true,
113+
description: 'Object name',
114+
},
115+
{
116+
name: 'data',
117+
type: 'Record<string, any>',
118+
required: true,
119+
description: 'Record data',
120+
},
121+
],
122+
returnType: 'Promise<any>',
123+
async: true,
124+
},
125+
{
126+
name: 'find',
127+
description: 'Query records',
128+
parameters: [
129+
{
130+
name: 'object',
131+
type: 'string',
132+
required: true,
133+
description: 'Object name',
134+
},
135+
{
136+
name: 'query',
137+
type: 'QueryInput',
138+
required: false,
139+
description: 'Query parameters',
140+
},
141+
],
142+
returnType: 'Promise<any[]>',
143+
async: true,
144+
},
145+
{
146+
name: 'findOne',
147+
description: 'Find a single record by ID',
148+
parameters: [
149+
{
150+
name: 'object',
151+
type: 'string',
152+
required: true,
153+
},
154+
{
155+
name: 'id',
156+
type: 'string',
157+
required: true,
158+
},
159+
],
160+
returnType: 'Promise<any>',
161+
async: true,
162+
},
163+
{
164+
name: 'update',
165+
description: 'Update a record',
166+
parameters: [
167+
{
168+
name: 'object',
169+
type: 'string',
170+
required: true,
171+
},
172+
{
173+
name: 'id',
174+
type: 'string',
175+
required: true,
176+
},
177+
{
178+
name: 'data',
179+
type: 'Record<string, any>',
180+
required: true,
181+
},
182+
],
183+
returnType: 'Promise<any>',
184+
async: true,
185+
},
186+
{
187+
name: 'delete',
188+
description: 'Delete a record',
189+
parameters: [
190+
{
191+
name: 'object',
192+
type: 'string',
193+
required: true,
194+
},
195+
{
196+
name: 'id',
197+
type: 'string',
198+
required: true,
199+
},
200+
],
201+
returnType: 'Promise<boolean>',
202+
async: true,
203+
},
204+
{
205+
name: 'count',
206+
description: 'Count records',
207+
parameters: [
208+
{
209+
name: 'object',
210+
type: 'string',
211+
required: true,
212+
},
213+
{
214+
name: 'query',
215+
type: 'QueryInput',
216+
required: false,
217+
},
218+
],
219+
returnType: 'Promise<number>',
220+
async: true,
221+
},
222+
],
223+
},
224+
],
225+
226+
// No external plugin dependencies (this is a core driver)
227+
requires: [],
228+
229+
// No extension points defined
230+
extensionPoints: [],
231+
232+
// No extensions contributed
233+
extensions: [],
234+
},
235+
21236
contributes: {
22-
// If there was a 'drivers' definition here, we would use it.
23-
// For now, we register via code (src/index.ts)
237+
drivers: [
238+
{
239+
id: 'memory',
240+
label: 'In-Memory Storage',
241+
description: 'Stores data in memory (volatile, for testing/development)',
242+
},
243+
],
24244
}
25245
};
26246

0 commit comments

Comments
 (0)