@objectstack/spec 0.8.0 → 0.8.2

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.
@@ -1 +0,0 @@
1
- {"version":3,"file":"view-storage.zod.d.ts","sourceRoot":"","sources":["../../src/api/view-storage.zod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;;;;;;;;;GAaG;AAMH;;;GAGG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;EASnB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEhD;;;GAGG;AACH,eAAO,MAAM,cAAc;;;;;EAKzB,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAE5D;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;iBAU3B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAoB3B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAM1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAgC1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAMx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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BnC,CAAC"}
@@ -1,243 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ViewStorageApiContracts = exports.ListViewsResponseSchema = exports.ViewResponseSchema = exports.ListViewsRequestSchema = exports.UpdateViewRequestSchema = exports.CreateViewRequestSchema = exports.SavedViewSchema = exports.ViewLayoutSchema = exports.ViewColumnSchema = exports.ViewVisibility = exports.ViewType = void 0;
4
- const zod_1 = require("zod");
5
- const query_zod_1 = require("../data/query.zod");
6
- /**
7
- * View Definition Storage Protocol
8
- *
9
- * Implements P2 requirement for ObjectStack kernel.
10
- * Allows persisting UI view configurations (list views, filters, layouts).
11
- *
12
- * Features:
13
- * - Save custom views with filters and columns
14
- * - Share views with users/teams
15
- * - Set default views per user/profile
16
- * - View templates and presets
17
- *
18
- * Industry alignment: Salesforce List Views, Microsoft Dynamics Saved Views
19
- */
20
- // ==========================================
21
- // View Configuration Types
22
- // ==========================================
23
- /**
24
- * View Type Enum
25
- * Types of views that can be stored
26
- */
27
- exports.ViewType = zod_1.z.enum([
28
- 'list', // List/table view
29
- 'kanban', // Kanban board view
30
- 'calendar', // Calendar view
31
- 'gantt', // Gantt chart view
32
- 'timeline', // Timeline view
33
- 'chart', // Chart/graph view
34
- 'pivot', // Pivot table view
35
- 'custom', // Custom view type
36
- ]);
37
- /**
38
- * View Visibility Enum
39
- * Who can see and use this view
40
- */
41
- exports.ViewVisibility = zod_1.z.enum([
42
- 'private', // Only the creator can see it
43
- 'shared', // Shared with specific users/teams
44
- 'public', // All users can see it
45
- 'organization', // All org users can see it
46
- ]);
47
- /**
48
- * Column Configuration Schema
49
- * Defines which columns to display and how
50
- */
51
- exports.ViewColumnSchema = zod_1.z.object({
52
- field: zod_1.z.string().describe('Field name'),
53
- label: zod_1.z.string().optional().describe('Custom column label'),
54
- width: zod_1.z.number().optional().describe('Column width in pixels'),
55
- sortable: zod_1.z.boolean().optional().default(true).describe('Whether column is sortable'),
56
- filterable: zod_1.z.boolean().optional().default(true).describe('Whether column is filterable'),
57
- visible: zod_1.z.boolean().optional().default(true).describe('Whether column is visible'),
58
- pinned: zod_1.z.enum(['left', 'right']).optional().describe('Pin column to left or right'),
59
- formatter: zod_1.z.string().optional().describe('Custom formatter name'),
60
- aggregation: zod_1.z.string().optional().describe('Aggregation function for column (sum, avg, etc.)'),
61
- });
62
- /**
63
- * View Layout Configuration
64
- * Layout-specific settings for different view types
65
- */
66
- exports.ViewLayoutSchema = zod_1.z.object({
67
- // List view settings
68
- columns: zod_1.z.array(exports.ViewColumnSchema).optional().describe('Column configuration for list views'),
69
- rowHeight: zod_1.z.number().optional().describe('Row height in pixels'),
70
- // Kanban view settings
71
- groupByField: zod_1.z.string().optional().describe('Field to group by (for kanban)'),
72
- cardFields: zod_1.z.array(zod_1.z.string()).optional().describe('Fields to display on cards'),
73
- // Calendar view settings
74
- dateField: zod_1.z.string().optional().describe('Date field for calendar view'),
75
- startDateField: zod_1.z.string().optional().describe('Start date field for event ranges'),
76
- endDateField: zod_1.z.string().optional().describe('End date field for event ranges'),
77
- titleField: zod_1.z.string().optional().describe('Field to use as event title'),
78
- // Chart view settings
79
- chartType: zod_1.z.enum(['bar', 'line', 'pie', 'scatter', 'area']).optional().describe('Chart type'),
80
- xAxis: zod_1.z.string().optional().describe('X-axis field'),
81
- yAxis: zod_1.z.string().optional().describe('Y-axis field'),
82
- series: zod_1.z.array(zod_1.z.string()).optional().describe('Series fields for multi-series charts'),
83
- });
84
- // ==========================================
85
- // View Definition Schema
86
- // ==========================================
87
- /**
88
- * Saved View Schema
89
- * Complete view configuration that can be persisted
90
- *
91
- * @example
92
- * {
93
- * "id": "view_123",
94
- * "name": "active_contacts",
95
- * "label": "Active Contacts",
96
- * "object": "contact",
97
- * "type": "list",
98
- * "visibility": "public",
99
- * "query": {
100
- * "object": "contact",
101
- * "where": { "status": "active" },
102
- * "orderBy": [{ "field": "last_name", "order": "asc" }],
103
- * "limit": 50
104
- * },
105
- * "layout": {
106
- * "columns": [
107
- * { "field": "first_name", "label": "First Name", "width": 150 },
108
- * { "field": "last_name", "label": "Last Name", "width": 150 },
109
- * { "field": "email", "label": "Email", "width": 200 }
110
- * ]
111
- * },
112
- * "isDefault": false,
113
- * "createdBy": "user_456",
114
- * "createdAt": "2026-01-29T12:00:00Z"
115
- * }
116
- */
117
- exports.SavedViewSchema = zod_1.z.object({
118
- id: zod_1.z.string().describe('Unique view identifier'),
119
- name: zod_1.z.string().regex(/^[a-z_][a-z0-9_]*$/).describe('View machine name (snake_case)'),
120
- label: zod_1.z.string().describe('Display label'),
121
- description: zod_1.z.string().optional().describe('View description'),
122
- // View configuration
123
- object: zod_1.z.string().describe('Object/table this view is for'),
124
- type: exports.ViewType.describe('View type'),
125
- visibility: exports.ViewVisibility.describe('Who can access this view'),
126
- // Query configuration
127
- query: query_zod_1.QuerySchema.describe('Query configuration (filters, sorting, etc.)'),
128
- // Layout configuration
129
- layout: exports.ViewLayoutSchema.optional().describe('Layout configuration'),
130
- // Sharing
131
- sharedWith: zod_1.z.array(zod_1.z.string()).optional().describe('User/team IDs this view is shared with'),
132
- // Defaults
133
- isDefault: zod_1.z.boolean().optional().default(false).describe('Is this the default view for this object?'),
134
- isSystem: zod_1.z.boolean().optional().default(false).describe('Is this a system-defined view?'),
135
- // Metadata
136
- createdBy: zod_1.z.string().describe('User ID who created this view'),
137
- createdAt: zod_1.z.string().datetime().describe('When the view was created'),
138
- updatedBy: zod_1.z.string().optional().describe('User ID who last updated this view'),
139
- updatedAt: zod_1.z.string().datetime().optional().describe('When the view was last updated'),
140
- // Settings
141
- settings: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional().describe('Additional view-specific settings'),
142
- });
143
- // ==========================================
144
- // View CRUD Operations
145
- // ==========================================
146
- /**
147
- * Create View Request Schema
148
- */
149
- exports.CreateViewRequestSchema = zod_1.z.object({
150
- name: zod_1.z.string().regex(/^[a-z_][a-z0-9_]*$/).describe('View machine name'),
151
- label: zod_1.z.string().describe('Display label'),
152
- description: zod_1.z.string().optional(),
153
- object: zod_1.z.string().describe('Object name'),
154
- type: exports.ViewType.describe('View type'),
155
- visibility: exports.ViewVisibility.describe('View visibility'),
156
- query: query_zod_1.QuerySchema.describe('Query configuration'),
157
- layout: exports.ViewLayoutSchema.optional().describe('Layout configuration'),
158
- sharedWith: zod_1.z.array(zod_1.z.string()).optional().describe('Users/teams to share with'),
159
- isDefault: zod_1.z.boolean().optional().default(false).describe('Set as default view'),
160
- settings: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional(),
161
- });
162
- /**
163
- * Update View Request Schema
164
- */
165
- exports.UpdateViewRequestSchema = exports.CreateViewRequestSchema.partial().extend({
166
- id: zod_1.z.string().describe('View ID to update'),
167
- });
168
- /**
169
- * List Views Request Schema
170
- */
171
- exports.ListViewsRequestSchema = zod_1.z.object({
172
- object: zod_1.z.string().optional().describe('Filter by object name'),
173
- type: exports.ViewType.optional().describe('Filter by view type'),
174
- visibility: exports.ViewVisibility.optional().describe('Filter by visibility'),
175
- createdBy: zod_1.z.string().optional().describe('Filter by creator user ID'),
176
- isDefault: zod_1.z.boolean().optional().describe('Filter for default views'),
177
- limit: zod_1.z.number().optional().default(50).describe('Max results'),
178
- offset: zod_1.z.number().optional().default(0).describe('Offset for pagination'),
179
- });
180
- /**
181
- * View Response Schema
182
- */
183
- exports.ViewResponseSchema = zod_1.z.object({
184
- success: zod_1.z.boolean(),
185
- data: exports.SavedViewSchema.optional().describe('The saved view'),
186
- error: zod_1.z.object({
187
- code: zod_1.z.string(),
188
- message: zod_1.z.string(),
189
- }).optional(),
190
- });
191
- /**
192
- * List Views Response Schema
193
- */
194
- exports.ListViewsResponseSchema = zod_1.z.object({
195
- success: zod_1.z.boolean(),
196
- data: zod_1.z.array(exports.SavedViewSchema).describe('Array of saved views'),
197
- pagination: zod_1.z.object({
198
- total: zod_1.z.number(),
199
- limit: zod_1.z.number(),
200
- offset: zod_1.z.number(),
201
- hasMore: zod_1.z.boolean(),
202
- }),
203
- error: zod_1.z.object({
204
- code: zod_1.z.string(),
205
- message: zod_1.z.string(),
206
- }).optional(),
207
- });
208
- // ==========================================
209
- // View Storage API
210
- // ==========================================
211
- /**
212
- * View Storage API Contracts
213
- */
214
- exports.ViewStorageApiContracts = {
215
- createView: {
216
- input: exports.CreateViewRequestSchema,
217
- output: exports.ViewResponseSchema,
218
- },
219
- updateView: {
220
- input: exports.UpdateViewRequestSchema,
221
- output: exports.ViewResponseSchema,
222
- },
223
- getView: {
224
- input: zod_1.z.object({ id: zod_1.z.string() }),
225
- output: exports.ViewResponseSchema,
226
- },
227
- listViews: {
228
- input: exports.ListViewsRequestSchema,
229
- output: exports.ListViewsResponseSchema,
230
- },
231
- deleteView: {
232
- input: zod_1.z.object({ id: zod_1.z.string() }),
233
- output: zod_1.z.object({ success: zod_1.z.boolean() }),
234
- },
235
- setDefaultView: {
236
- input: zod_1.z.object({
237
- viewId: zod_1.z.string(),
238
- object: zod_1.z.string(),
239
- userId: zod_1.z.string().optional().describe('User to set default for (defaults to current user)'),
240
- }),
241
- output: exports.ViewResponseSchema,
242
- },
243
- };
@@ -1,7 +0,0 @@
1
- {
2
- "$ref": "#/definitions/CreateViewRequest",
3
- "definitions": {
4
- "CreateViewRequest": {}
5
- },
6
- "$schema": "http://json-schema.org/draft-07/schema#"
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "$ref": "#/definitions/DeleteViewRequest",
3
- "definitions": {
4
- "DeleteViewRequest": {}
5
- },
6
- "$schema": "http://json-schema.org/draft-07/schema#"
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "$ref": "#/definitions/DeleteViewResponse",
3
- "definitions": {
4
- "DeleteViewResponse": {}
5
- },
6
- "$schema": "http://json-schema.org/draft-07/schema#"
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "$ref": "#/definitions/GetViewRequest",
3
- "definitions": {
4
- "GetViewRequest": {}
5
- },
6
- "$schema": "http://json-schema.org/draft-07/schema#"
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "$ref": "#/definitions/GetViewResponse",
3
- "definitions": {
4
- "GetViewResponse": {}
5
- },
6
- "$schema": "http://json-schema.org/draft-07/schema#"
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "$ref": "#/definitions/ListViewsRequest",
3
- "definitions": {
4
- "ListViewsRequest": {}
5
- },
6
- "$schema": "http://json-schema.org/draft-07/schema#"
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "$ref": "#/definitions/ListViewsResponse",
3
- "definitions": {
4
- "ListViewsResponse": {}
5
- },
6
- "$schema": "http://json-schema.org/draft-07/schema#"
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "$ref": "#/definitions/SavedView",
3
- "definitions": {
4
- "SavedView": {}
5
- },
6
- "$schema": "http://json-schema.org/draft-07/schema#"
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "$ref": "#/definitions/UpdateViewRequest",
3
- "definitions": {
4
- "UpdateViewRequest": {}
5
- },
6
- "$schema": "http://json-schema.org/draft-07/schema#"
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "$ref": "#/definitions/ViewColumn",
3
- "definitions": {
4
- "ViewColumn": {}
5
- },
6
- "$schema": "http://json-schema.org/draft-07/schema#"
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "$ref": "#/definitions/ViewLayout",
3
- "definitions": {
4
- "ViewLayout": {}
5
- },
6
- "$schema": "http://json-schema.org/draft-07/schema#"
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "$ref": "#/definitions/ViewResponse",
3
- "definitions": {
4
- "ViewResponse": {}
5
- },
6
- "$schema": "http://json-schema.org/draft-07/schema#"
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "$ref": "#/definitions/ViewType",
3
- "definitions": {
4
- "ViewType": {}
5
- },
6
- "$schema": "http://json-schema.org/draft-07/schema#"
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "$ref": "#/definitions/ViewVisibility",
3
- "definitions": {
4
- "ViewVisibility": {}
5
- },
6
- "$schema": "http://json-schema.org/draft-07/schema#"
7
- }