|
3 | 3 | "prefix": "os-object", |
4 | 4 | "description": "Define a new ObjectStack business object", |
5 | 5 | "body": [ |
6 | | - "import { Data } from '@objectstack/spec';", |
| 6 | + "import { ObjectSchema } from '@objectstack/spec/data';", |
7 | 7 | "", |
8 | | - "const ${1:myObject}: Data.Object = {", |
| 8 | + "export const ${1:MyObject} = ObjectSchema.create({", |
9 | 9 | " name: '${2:my_object}',", |
10 | 10 | " label: '${3:My Object}',", |
11 | 11 | " pluralLabel: '${3:My Object}s',", |
|
18 | 18 | " },", |
19 | 19 | " $0", |
20 | 20 | " },", |
21 | | - "};", |
22 | | - "", |
23 | | - "export default ${1:myObject};" |
| 21 | + "});" |
24 | 22 | ] |
25 | 23 | }, |
26 | 24 | "ObjectStack: Text Field": { |
|
59 | 57 | " type: 'lookup',", |
60 | 58 | " label: '${2:Related Object}',", |
61 | 59 | " required: ${3|false,true|},", |
62 | | - " reference: {", |
63 | | - " object: '${4:target_object}',", |
64 | | - " labelField: '${5:name}',", |
65 | | - " },", |
| 60 | + " reference: '${4:target_object}',", |
| 61 | + " displayField: '${5:name}',", |
66 | 62 | "}," |
67 | 63 | ] |
68 | 64 | }, |
69 | 65 | "ObjectStack: Grid List View": { |
70 | 66 | "prefix": "os-view-grid", |
71 | 67 | "description": "Define a grid list view for an object", |
72 | 68 | "body": [ |
73 | | - "import { UI } from '@objectstack/spec';", |
| 69 | + "import { defineView } from '@objectstack/spec';", |
74 | 70 | "", |
75 | | - "const ${1:myObject}ListView: UI.View = {", |
76 | | - " name: '${2:my_object}_list',", |
77 | | - " label: '${3:My Object} List',", |
78 | | - " type: 'list',", |
79 | | - " objectName: '${2:my_object}',", |
| 71 | + "export const ${1:MyObject}Views = defineView({", |
| 72 | + " object: '${2:my_object}',", |
80 | 73 | " list: {", |
| 74 | + " label: '${3:My Object} List',", |
81 | 75 | " type: 'grid',", |
| 76 | + " data: { provider: 'object', object: '${2:my_object}' },", |
82 | 77 | " columns: [", |
83 | 78 | " { field: 'name', width: 200 },", |
84 | 79 | " $0", |
85 | 80 | " ],", |
86 | | - " defaultSort: { field: 'name', direction: 'asc' },", |
87 | | - " pageSize: 25,", |
| 81 | + " sort: [{ field: 'name', order: 'asc' }],", |
| 82 | + " pagination: { pageSize: 25 },", |
88 | 83 | " },", |
89 | | - "};", |
90 | | - "", |
91 | | - "export default ${1:myObject}ListView;" |
| 84 | + "});" |
92 | 85 | ] |
93 | 86 | }, |
94 | 87 | "ObjectStack: Automation Flow": { |
95 | 88 | "prefix": "os-flow", |
96 | | - "description": "Define an automation flow", |
| 89 | + "description": "Define a record-change automation flow", |
97 | 90 | "body": [ |
98 | | - "import { Automation } from '@objectstack/spec';", |
| 91 | + "import { defineFlow } from '@objectstack/spec';", |
99 | 92 | "", |
100 | | - "const ${1:myFlow}: Automation.Flow = {", |
| 93 | + "export const ${1:MyFlow} = defineFlow({", |
101 | 94 | " name: '${2:my_flow}',", |
102 | 95 | " label: '${3:My Flow}',", |
103 | | - " type: '${4|autolaunched,screen,schedule|}',", |
| 96 | + " type: 'record_change',", |
104 | 97 | " status: 'draft',", |
105 | | - " trigger: {", |
106 | | - " type: 'record_change',", |
107 | | - " object: '${5:my_object}',", |
108 | | - " events: ['after_insert', 'after_update'],", |
109 | | - " },", |
110 | 98 | " nodes: [", |
111 | 99 | " {", |
112 | 100 | " id: 'start',", |
113 | 101 | " type: 'start',", |
114 | | - " name: 'Start',", |
115 | | - " next: '${6:end}',", |
| 102 | + " label: 'Start',", |
| 103 | + " config: {", |
| 104 | + " objectName: '${4:my_object}',", |
| 105 | + " triggerType: '${5|record-after-write,record-after-insert,record-after-update,record-after-delete|}',", |
| 106 | + " },", |
116 | 107 | " },", |
117 | 108 | " $0", |
| 109 | + " {", |
| 110 | + " id: 'end',", |
| 111 | + " type: 'end',", |
| 112 | + " label: 'End',", |
| 113 | + " },", |
118 | 114 | " ],", |
119 | | - "};", |
120 | | - "", |
121 | | - "export default ${1:myFlow};" |
| 115 | + " edges: [", |
| 116 | + " { id: 'e1', source: 'start', target: 'end' },", |
| 117 | + " ],", |
| 118 | + "});" |
122 | 119 | ] |
123 | 120 | }, |
124 | 121 | "ObjectStack: defineStack Boilerplate": { |
|
129 | 126 | "", |
130 | 127 | "export default defineStack({", |
131 | 128 | " manifest: {", |
132 | | - " name: '${1:my_app}',", |
133 | | - " version: '${2:0.1.0}',", |
134 | | - " label: '${3:My Application}',", |
| 129 | + " id: '${1:com.example.my_app}',", |
| 130 | + " namespace: '${2:my_app}',", |
| 131 | + " version: '${3:0.1.0}',", |
| 132 | + " type: 'app',", |
| 133 | + " name: '${4:My Application}',", |
| 134 | + " engines: { protocol: '^17' },", |
135 | 135 | " },", |
136 | 136 | " objects: [", |
137 | 137 | " $0", |
|
145 | 145 | "prefix": "os-agent", |
146 | 146 | "description": "Define an AI agent", |
147 | 147 | "body": [ |
148 | | - "import { AI } from '@objectstack/spec';", |
| 148 | + "import { defineAgent } from '@objectstack/spec';", |
149 | 149 | "", |
150 | | - "const ${1:myAgent}: AI.Agent = {", |
| 150 | + "export const ${1:MyAgent} = defineAgent({", |
151 | 151 | " name: '${2:my_agent}',", |
152 | 152 | " label: '${3:My Agent}',", |
153 | 153 | " role: '${4:Assistant}',", |
|
156 | 156 | " provider: '${6|openai,anthropic,google|}',", |
157 | 157 | " model: '${7:gpt-4o}',", |
158 | 158 | " },", |
159 | | - " tools: [", |
| 159 | + " skills: [", |
160 | 160 | " $0", |
161 | 161 | " ],", |
162 | | - "};", |
163 | | - "", |
164 | | - "export default ${1:myAgent};" |
| 162 | + "});" |
165 | 163 | ] |
166 | 164 | } |
167 | 165 | } |
0 commit comments