@cmssy/mcp-server 0.4.0 → 0.6.0
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 +82 -0
- package/dist/queries.d.ts +21 -5
- package/dist/queries.d.ts.map +1 -1
- package/dist/queries.js +220 -0
- package/dist/queries.js.map +1 -1
- package/dist/responses.d.ts +70 -0
- package/dist/responses.d.ts.map +1 -0
- package/dist/responses.js +75 -0
- package/dist/responses.js.map +1 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +679 -137
- package/dist/server.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -43,6 +43,32 @@ Instead of CLI args, you can set:
|
|
|
43
43
|
- `CMSSY_WORKSPACE_ID` — Workspace ID
|
|
44
44
|
- `CMSSY_API_URL` — API URL (required, e.g. `https://api.your-cmssy.com`)
|
|
45
45
|
|
|
46
|
+
## Response shape (write tools)
|
|
47
|
+
|
|
48
|
+
As of 0.6.0, most write tools accept an optional `response` arg:
|
|
49
|
+
|
|
50
|
+
- `response: "minimal"` (default) - returns a small ack (~200 bytes):
|
|
51
|
+
`{id, slug, hasUnpublishedChanges, updatedAt}` for page tools,
|
|
52
|
+
`{pageId, blockId, hasUnpublishedChanges, updatedAt}` for block tools,
|
|
53
|
+
`{id, slug, status, updatedAt}` for form tools,
|
|
54
|
+
`{id, slug, updatedAt}` for model tools,
|
|
55
|
+
`{id, status, updatedAt}` for record tools.
|
|
56
|
+
- `response: "full"` - returns the full mutation response (pre-0.6 behavior).
|
|
57
|
+
|
|
58
|
+
Use `"full"` only if you need the post-write state inline; otherwise issue a
|
|
59
|
+
follow-up `get_page`/`get_form`/`get_model`/`get_record`. This keeps agent
|
|
60
|
+
context windows from being eaten by echoed content.
|
|
61
|
+
|
|
62
|
+
Tools that accept `response`: `create_page`, `update_page_blocks`,
|
|
63
|
+
`update_page_settings`, `publish_page`, `unpublish_page`, `revert_to_published`,
|
|
64
|
+
`update_page_layout`, `add_block_to_page`, `update_block_content`,
|
|
65
|
+
`remove_block_from_page`, `create_form`, `update_form`, `create_model`,
|
|
66
|
+
`update_model`, `create_record`, `update_record`.
|
|
67
|
+
|
|
68
|
+
`patch_block_content` and the various `delete_*` / status-only tools
|
|
69
|
+
(`update_form_submission_status`, `import_records`, `create_model_from_template`)
|
|
70
|
+
already returned a compact ack and don't take `response`.
|
|
71
|
+
|
|
46
72
|
## Available Tools
|
|
47
73
|
|
|
48
74
|
### Read Tools
|
|
@@ -75,9 +101,65 @@ Instead of CLI args, you can set:
|
|
|
75
101
|
| ------------------------ | --------------------------------------------------------------- |
|
|
76
102
|
| `add_block_to_page` | Insert a block at position (auto-generates UUID + translations) |
|
|
77
103
|
| `update_block_content` | Merge content into an existing block |
|
|
104
|
+
| `patch_block_content` | Surgical HTML patch (insert/replace around unique markers) |
|
|
78
105
|
| `remove_block_from_page` | Remove a block by ID |
|
|
79
106
|
| `update_page_layout` | Update layout blocks and overrides |
|
|
80
107
|
|
|
108
|
+
#### `patch_block_content`
|
|
109
|
+
|
|
110
|
+
For small edits on long HTML content strings (e.g. a `docs-article` body),
|
|
111
|
+
`patch_block_content` is ~10x cheaper in tokens than `update_block_content`
|
|
112
|
+
and catches marker mistakes before anything writes to the DB.
|
|
113
|
+
|
|
114
|
+
```jsonc
|
|
115
|
+
{
|
|
116
|
+
"pageId": "...",
|
|
117
|
+
"blockId": "...",
|
|
118
|
+
"locale": "en",
|
|
119
|
+
"operations": [
|
|
120
|
+
{
|
|
121
|
+
"op": "insert_before",
|
|
122
|
+
"marker": "<h2>Environment Variables</h2>",
|
|
123
|
+
"html": "<hr><h2>cmssy skills install</h2><p>...</p>",
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Three ops: `insert_before`, `insert_after`, `replace_section`. Every
|
|
130
|
+
marker must match **exactly once** - 0 or 2+ matches error out with the
|
|
131
|
+
actual count (no silent half-applied state). For `replace_section`,
|
|
132
|
+
`startMarker` is inclusive and `endMarker` is exclusive.
|
|
133
|
+
|
|
134
|
+
Requires `@cmssy/cli`-registered workspace with `PAGES_EDIT` permission.
|
|
135
|
+
Default `fieldPath` is `"content"` (the HTML body on docs-article); override
|
|
136
|
+
if patching a different string field.
|
|
137
|
+
|
|
138
|
+
### Model Tools (Custom Data Models)
|
|
139
|
+
|
|
140
|
+
AI agents can define ModelDefinitions and CRUD their records. Schema/fields
|
|
141
|
+
follow `PropertyField` from `@cmssy/types`; records are validated against the
|
|
142
|
+
model on every write.
|
|
143
|
+
|
|
144
|
+
| Tool | Description |
|
|
145
|
+
| ---------------------------- | -------------------------------------------------------------------------- |
|
|
146
|
+
| `list_models` | List all ModelDefinitions in the workspace |
|
|
147
|
+
| `get_model` | Get a model by id (ObjectId) or slug |
|
|
148
|
+
| `create_model` | Create a model (name, slug, fields, optional statusField) |
|
|
149
|
+
| `update_model` | Update any field of a model (fields change triggers schema migrate) |
|
|
150
|
+
| `delete_model` | Delete a model — **cascades to all its records** |
|
|
151
|
+
| `list_records` | List records with filter (JSON), sort, pagination, optional populate |
|
|
152
|
+
| `get_record` | Get a record by id |
|
|
153
|
+
| `create_record` | Create a record; `data` keyed by model field keys |
|
|
154
|
+
| `update_record` | Update a record's data and/or transition its status |
|
|
155
|
+
| `delete_record` | Delete a record |
|
|
156
|
+
| `import_records` | Bulk import up to 1000 records; returns `{ importedCount, errors }` |
|
|
157
|
+
| `list_model_templates` | List available templates (E-commerce, Blog, etc.) |
|
|
158
|
+
| `create_model_from_template` | Install a template; returns `{ templateId, installedCount, skippedSlugs }` |
|
|
159
|
+
|
|
160
|
+
Requires workspace permissions `MODELS_VIEW` (read) / `MODELS_CREATE` /
|
|
161
|
+
`MODELS_EDIT` / `MODELS_DELETE` depending on the operation.
|
|
162
|
+
|
|
81
163
|
## Resources
|
|
82
164
|
|
|
83
165
|
| URI | Description |
|
package/dist/queries.d.ts
CHANGED
|
@@ -6,12 +6,13 @@ export declare const SITE_CONFIG_QUERY = "\n query SiteConfig {\n siteConfig
|
|
|
6
6
|
export declare const CURRENT_WORKSPACE_QUERY = "\n query CurrentWorkspace {\n currentWorkspace {\n id\n name\n slug\n plan\n limits {\n maxPages\n maxUsers\n maxStorageMb\n maxAiTokensMonth\n maxWorkspacesOwned\n canUseCustomDomain\n canRemoveBranding\n canUseCustomScripts\n maxCustomBlocks\n maxCustomBlocksStorageMb\n }\n }\n }\n";
|
|
7
7
|
export declare const MEDIA_ASSETS_QUERY = "\n query MediaAssets($limit: Int, $offset: Int) {\n mediaAssets(limit: $limit, offset: $offset) {\n items {\n id\n url\n filename\n type\n mimeType\n size\n width\n height\n alt\n tags\n }\n total\n hasMore\n }\n }\n";
|
|
8
8
|
export declare const SAVE_PAGE_MUTATION = "\n mutation SavePage($input: SavePageInput!) {\n savePage(input: $input) {\n id\n name\n slug\n description\n displayName\n seoTitle\n seoDescription\n seoKeywords\n published\n hasUnpublishedChanges\n pageType\n parentId\n blocks {\n id\n type\n content\n settings\n style\n advanced\n translations\n defaultLanguage\n metadata {\n createdAt\n updatedAt\n createdBy\n version\n }\n blockVersion\n }\n createdAt\n updatedAt\n }\n }\n";
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
12
|
-
export declare const
|
|
9
|
+
export declare const PATCH_BLOCK_CONTENT_MUTATION = "\n mutation PatchBlockContent($input: PatchBlockContentInput!) {\n patchBlockContent(input: $input) {\n id\n slug\n hasUnpublishedChanges\n updatedAt\n }\n }\n";
|
|
10
|
+
export declare const UPDATE_PAGE_SETTINGS_MUTATION = "\n mutation UpdatePageSettings($input: UpdatePageSettingsInput!) {\n updatePageSettings(input: $input) {\n id\n name\n slug\n description\n displayName\n seoTitle\n seoDescription\n seoKeywords\n pageType\n parentId\n hasUnpublishedChanges\n updatedAt\n }\n }\n";
|
|
11
|
+
export declare const TOGGLE_PUBLISH_MUTATION = "\n mutation TogglePublish($id: ID!) {\n togglePublish(id: $id) {\n id\n slug\n published\n publishedAt\n hasUnpublishedChanges\n updatedAt\n }\n }\n";
|
|
12
|
+
export declare const PUBLISH_PAGE_MUTATION = "\n mutation PublishPage($id: ID!, $blocks: [BlockDataInput!]!) {\n publishPage(id: $id, blocks: $blocks) {\n id\n slug\n published\n publishedAt\n hasUnpublishedChanges\n updatedAt\n blocks {\n id\n type\n content\n settings\n style\n advanced\n translations\n defaultLanguage\n metadata {\n createdAt\n updatedAt\n createdBy\n version\n }\n blockVersion\n }\n }\n }\n";
|
|
13
|
+
export declare const REVERT_TO_PUBLISHED_MUTATION = "\n mutation RevertToPublished($id: ID!) {\n revertToPublished(id: $id) {\n id\n name\n slug\n hasUnpublishedChanges\n updatedAt\n blocks {\n id type content settings style advanced\n translations defaultLanguage blockVersion\n }\n }\n }\n";
|
|
13
14
|
export declare const REMOVE_PAGE_MUTATION = "\n mutation RemovePage($id: ID!) {\n removePage(id: $id)\n }\n";
|
|
14
|
-
export declare const UPDATE_PAGE_LAYOUT_MUTATION = "\n mutation UpdatePageLayout($input: UpdatePageLayoutInput!) {\n updatePageLayout(input: $input) {\n id\n layoutBlocks {\n id type position order isActive\n content settings style advanced\n translations defaultLanguage\n metadata { createdAt updatedAt createdBy version }\n blockVersion\n }\n layoutOverrides { position action blockId }\n inheritsLayout\n }\n }\n";
|
|
15
|
+
export declare const UPDATE_PAGE_LAYOUT_MUTATION = "\n mutation UpdatePageLayout($input: UpdatePageLayoutInput!) {\n updatePageLayout(input: $input) {\n id\n slug\n hasUnpublishedChanges\n updatedAt\n layoutBlocks {\n id type position order isActive\n content settings style advanced\n translations defaultLanguage\n metadata { createdAt updatedAt createdBy version }\n blockVersion\n }\n layoutOverrides { position action blockId }\n inheritsLayout\n }\n }\n";
|
|
15
16
|
export declare const FORMS_QUERY = "\n query Forms($status: String, $skip: Int, $limit: Int) {\n forms(status: $status, skip: $skip, limit: $limit) {\n forms { \n id\n name\n slug\n description\n status\n fields {\n id name fieldType\n label placeholder helpText\n defaultValue\n validation { required minLength maxLength minValue maxValue pattern customMessage }\n options { value label disabled }\n width order showIf\n }\n settings {\n actionType webhookUrl emailRecipients newsletterListId\n submitButtonLabel successMessage errorMessage\n redirectUrl enableCaptcha requireLogin\n saveSubmissions sendEmailNotification emailConfigurationId\n }\n submissionCount\n createdAt updatedAt createdBy updatedBy\n }\n total\n hasMore\n }\n }\n";
|
|
16
17
|
export declare const FORM_BY_ID_QUERY = "\n query Form($formId: ID!) {\n form(formId: $formId) {\n \n id\n name\n slug\n description\n status\n fields {\n id name fieldType\n label placeholder helpText\n defaultValue\n validation { required minLength maxLength minValue maxValue pattern customMessage }\n options { value label disabled }\n width order showIf\n }\n settings {\n actionType webhookUrl emailRecipients newsletterListId\n submitButtonLabel successMessage errorMessage\n redirectUrl enableCaptcha requireLogin\n saveSubmissions sendEmailNotification emailConfigurationId\n }\n submissionCount\n createdAt updatedAt createdBy updatedBy\n\n }\n }\n";
|
|
17
18
|
export declare const FORM_SUBMISSIONS_QUERY = "\n query FormSubmissions($formId: ID, $status: String, $skip: Int, $limit: Int) {\n formSubmissions(formId: $formId, status: $status, skip: $skip, limit: $limit) {\n submissions {\n id formId formSlug data status\n ipAddress userAgent referrer customerId\n processedAt emailSent webhookSent createdAt\n }\n total\n hasMore\n }\n }\n";
|
|
@@ -21,4 +22,19 @@ export declare const UPDATE_FORM_MUTATION = "\n mutation UpdateForm($formId: ID
|
|
|
21
22
|
export declare const DELETE_FORM_MUTATION = "\n mutation DeleteForm($formId: ID!) {\n deleteForm(formId: $formId)\n }\n";
|
|
22
23
|
export declare const UPDATE_FORM_SUBMISSION_STATUS_MUTATION = "\n mutation UpdateFormSubmissionStatus($submissionId: ID!, $status: String!) {\n updateFormSubmissionStatus(submissionId: $submissionId, status: $status)\n }\n";
|
|
23
24
|
export declare const DELETE_FORM_SUBMISSION_MUTATION = "\n mutation DeleteFormSubmission($submissionId: ID!) {\n deleteFormSubmission(submissionId: $submissionId)\n }\n";
|
|
25
|
+
export declare const MODEL_DEFINITIONS_QUERY = "\n query ModelDefinitions {\n modelDefinitions {\n \n id\n workspaceId\n name\n slug\n description\n icon\n color\n displayField\n defaultSort { field direction }\n fields { \n key\n label\n type\n required\n description\n defaultValue\n options\n fields\n itemType\n itemFields\n relationTo\n relationType\n acceptedTypes\n multiple\n schemaProperty\n minLength\n maxLength\n minValue\n maxValue\n pattern\n }\n statusField {\n enabled\n values\n defaultValue\n transitions { from to }\n }\n createdAt\n updatedAt\n createdBy\n recordCount\n\n }\n }\n";
|
|
26
|
+
export declare const MODEL_DEFINITIONS_BY_SLUG_INDEX_QUERY = "\n query ModelDefinitionsSlugIndex {\n modelDefinitions {\n id\n slug\n }\n }\n";
|
|
27
|
+
export declare const MODEL_DEFINITION_BY_ID_QUERY = "\n query ModelDefinition($id: ID!) {\n modelDefinition(id: $id) {\n \n id\n workspaceId\n name\n slug\n description\n icon\n color\n displayField\n defaultSort { field direction }\n fields { \n key\n label\n type\n required\n description\n defaultValue\n options\n fields\n itemType\n itemFields\n relationTo\n relationType\n acceptedTypes\n multiple\n schemaProperty\n minLength\n maxLength\n minValue\n maxValue\n pattern\n }\n statusField {\n enabled\n values\n defaultValue\n transitions { from to }\n }\n createdAt\n updatedAt\n createdBy\n recordCount\n\n }\n }\n";
|
|
28
|
+
export declare const MODEL_RECORDS_QUERY = "\n query ModelRecords(\n $modelId: ID!\n $filter: JSON\n $limit: Int\n $offset: Int\n $sort: String\n $populate: [String!]\n ) {\n modelRecords(\n modelId: $modelId\n filter: $filter\n limit: $limit\n offset: $offset\n sort: $sort\n populate: $populate\n ) {\n items { \n id\n workspaceId\n modelId\n data\n status\n createdAt\n updatedAt\n createdBy\n updatedBy\n }\n total\n hasMore\n }\n }\n";
|
|
29
|
+
export declare const MODEL_RECORD_BY_ID_QUERY = "\n query ModelRecord($id: ID!) {\n modelRecord(id: $id) {\n \n id\n workspaceId\n modelId\n data\n status\n createdAt\n updatedAt\n createdBy\n updatedBy\n\n }\n }\n";
|
|
30
|
+
export declare const MODEL_TEMPLATES_QUERY = "\n query ModelTemplates {\n modelTemplates {\n id\n name\n description\n icon\n category\n models {\n name\n slug\n description\n icon\n fieldCount\n hasStatus\n }\n }\n }\n";
|
|
31
|
+
export declare const CREATE_MODEL_DEFINITION_MUTATION = "\n mutation CreateModelDefinition($input: CreateModelDefinitionInput!) {\n createModelDefinition(input: $input) {\n \n id\n workspaceId\n name\n slug\n description\n icon\n color\n displayField\n defaultSort { field direction }\n fields { \n key\n label\n type\n required\n description\n defaultValue\n options\n fields\n itemType\n itemFields\n relationTo\n relationType\n acceptedTypes\n multiple\n schemaProperty\n minLength\n maxLength\n minValue\n maxValue\n pattern\n }\n statusField {\n enabled\n values\n defaultValue\n transitions { from to }\n }\n createdAt\n updatedAt\n createdBy\n recordCount\n\n }\n }\n";
|
|
32
|
+
export declare const UPDATE_MODEL_DEFINITION_MUTATION = "\n mutation UpdateModelDefinition($input: UpdateModelDefinitionInput!) {\n updateModelDefinition(input: $input) {\n \n id\n workspaceId\n name\n slug\n description\n icon\n color\n displayField\n defaultSort { field direction }\n fields { \n key\n label\n type\n required\n description\n defaultValue\n options\n fields\n itemType\n itemFields\n relationTo\n relationType\n acceptedTypes\n multiple\n schemaProperty\n minLength\n maxLength\n minValue\n maxValue\n pattern\n }\n statusField {\n enabled\n values\n defaultValue\n transitions { from to }\n }\n createdAt\n updatedAt\n createdBy\n recordCount\n\n }\n }\n";
|
|
33
|
+
export declare const DELETE_MODEL_DEFINITION_MUTATION = "\n mutation DeleteModelDefinition($id: ID!) {\n deleteModelDefinition(id: $id)\n }\n";
|
|
34
|
+
export declare const CREATE_MODEL_RECORD_MUTATION = "\n mutation CreateModelRecord($input: CreateModelRecordInput!) {\n createModelRecord(input: $input) {\n \n id\n workspaceId\n modelId\n data\n status\n createdAt\n updatedAt\n createdBy\n updatedBy\n\n }\n }\n";
|
|
35
|
+
export declare const UPDATE_MODEL_RECORD_MUTATION = "\n mutation UpdateModelRecord($input: UpdateModelRecordInput!) {\n updateModelRecord(input: $input) {\n \n id\n workspaceId\n modelId\n data\n status\n createdAt\n updatedAt\n createdBy\n updatedBy\n\n }\n }\n";
|
|
36
|
+
export declare const UPDATE_MODEL_RECORD_STATUS_MUTATION = "\n mutation UpdateModelRecordStatus($input: UpdateModelRecordStatusInput!) {\n updateModelRecordStatus(input: $input) {\n \n id\n workspaceId\n modelId\n data\n status\n createdAt\n updatedAt\n createdBy\n updatedBy\n\n }\n }\n";
|
|
37
|
+
export declare const DELETE_MODEL_RECORD_MUTATION = "\n mutation DeleteModelRecord($id: ID!) {\n deleteModelRecord(id: $id)\n }\n";
|
|
38
|
+
export declare const IMPORT_MODEL_RECORDS_MUTATION = "\n mutation ImportModelRecords($input: ImportModelRecordsInput!) {\n importModelRecords(input: $input) {\n importedCount\n errors { row message }\n }\n }\n";
|
|
39
|
+
export declare const INSTALL_MODEL_TEMPLATE_MUTATION = "\n mutation InstallModelTemplate($templateId: String!) {\n installModelTemplate(templateId: $templateId) {\n templateId\n installedCount\n skippedSlugs\n }\n }\n";
|
|
24
40
|
//# sourceMappingURL=queries.d.ts.map
|
package/dist/queries.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../src/queries.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,WAAW,2SAkBvB,CAAC;AAEF,eAAO,MAAM,gBAAgB,0+CAuE5B,CAAC;AAIF,eAAO,MAAM,sBAAsB,QAkBlC,CAAC;AAEF,eAAO,MAAM,6BAA6B,QAkBzC,CAAC;AAIF,eAAO,MAAM,iBAAiB,2JAU7B,CAAC;AAIF,eAAO,MAAM,uBAAuB,6YAqBnC,CAAC;AAIF,eAAO,MAAM,kBAAkB,+TAmB9B,CAAC;AAIF,eAAO,MAAM,kBAAkB,+nBAoC9B,CAAC;AAEF,eAAO,MAAM,6BAA6B,
|
|
1
|
+
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../src/queries.ts"],"names":[],"mappings":"AAMA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CAAC;AAIF,eAAO,MAAM,gCAAgC,2qBAM5C,CAAC;AAEF,eAAO,MAAM,gCAAgC,2qBAM5C,CAAC;AAEF,eAAO,MAAM,gCAAgC,8FAI5C,CAAC;AAEF,eAAO,MAAM,4BAA4B,4OAMxC,CAAC;AAEF,eAAO,MAAM,4BAA4B,4OAMxC,CAAC;AAEF,eAAO,MAAM,mCAAmC,8PAM/C,CAAC;AAEF,eAAO,MAAM,4BAA4B,sFAIxC,CAAC;AAEF,eAAO,MAAM,6BAA6B,kLAOzC,CAAC;AAEF,eAAO,MAAM,+BAA+B,6LAQ3C,CAAC"}
|
package/dist/queries.js
CHANGED
|
@@ -225,6 +225,21 @@ export const SAVE_PAGE_MUTATION = `
|
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
227
|
`;
|
|
228
|
+
// Minimal selection set on purpose - patch_block_content exists to avoid
|
|
229
|
+
// round-tripping multi-KB HTML content, so we only confirm the mutation
|
|
230
|
+
// landed (id, draft state, timestamp) instead of pulling every block's
|
|
231
|
+
// content back. Callers who need the full page can fetch it with
|
|
232
|
+
// PAGE_BY_ID_QUERY afterwards.
|
|
233
|
+
export const PATCH_BLOCK_CONTENT_MUTATION = `
|
|
234
|
+
mutation PatchBlockContent($input: PatchBlockContentInput!) {
|
|
235
|
+
patchBlockContent(input: $input) {
|
|
236
|
+
id
|
|
237
|
+
slug
|
|
238
|
+
hasUnpublishedChanges
|
|
239
|
+
updatedAt
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
`;
|
|
228
243
|
export const UPDATE_PAGE_SETTINGS_MUTATION = `
|
|
229
244
|
mutation UpdatePageSettings($input: UpdatePageSettingsInput!) {
|
|
230
245
|
updatePageSettings(input: $input) {
|
|
@@ -238,6 +253,7 @@ export const UPDATE_PAGE_SETTINGS_MUTATION = `
|
|
|
238
253
|
seoKeywords
|
|
239
254
|
pageType
|
|
240
255
|
parentId
|
|
256
|
+
hasUnpublishedChanges
|
|
241
257
|
updatedAt
|
|
242
258
|
}
|
|
243
259
|
}
|
|
@@ -246,9 +262,11 @@ export const TOGGLE_PUBLISH_MUTATION = `
|
|
|
246
262
|
mutation TogglePublish($id: ID!) {
|
|
247
263
|
togglePublish(id: $id) {
|
|
248
264
|
id
|
|
265
|
+
slug
|
|
249
266
|
published
|
|
250
267
|
publishedAt
|
|
251
268
|
hasUnpublishedChanges
|
|
269
|
+
updatedAt
|
|
252
270
|
}
|
|
253
271
|
}
|
|
254
272
|
`;
|
|
@@ -256,9 +274,11 @@ export const PUBLISH_PAGE_MUTATION = `
|
|
|
256
274
|
mutation PublishPage($id: ID!, $blocks: [BlockDataInput!]!) {
|
|
257
275
|
publishPage(id: $id, blocks: $blocks) {
|
|
258
276
|
id
|
|
277
|
+
slug
|
|
259
278
|
published
|
|
260
279
|
publishedAt
|
|
261
280
|
hasUnpublishedChanges
|
|
281
|
+
updatedAt
|
|
262
282
|
blocks {
|
|
263
283
|
id
|
|
264
284
|
type
|
|
@@ -286,6 +306,7 @@ export const REVERT_TO_PUBLISHED_MUTATION = `
|
|
|
286
306
|
name
|
|
287
307
|
slug
|
|
288
308
|
hasUnpublishedChanges
|
|
309
|
+
updatedAt
|
|
289
310
|
blocks {
|
|
290
311
|
id type content settings style advanced
|
|
291
312
|
translations defaultLanguage blockVersion
|
|
@@ -302,6 +323,9 @@ export const UPDATE_PAGE_LAYOUT_MUTATION = `
|
|
|
302
323
|
mutation UpdatePageLayout($input: UpdatePageLayoutInput!) {
|
|
303
324
|
updatePageLayout(input: $input) {
|
|
304
325
|
id
|
|
326
|
+
slug
|
|
327
|
+
hasUnpublishedChanges
|
|
328
|
+
updatedAt
|
|
305
329
|
layoutBlocks {
|
|
306
330
|
id type position order isActive
|
|
307
331
|
content settings style advanced
|
|
@@ -406,4 +430,200 @@ export const DELETE_FORM_SUBMISSION_MUTATION = `
|
|
|
406
430
|
deleteFormSubmission(submissionId: $submissionId)
|
|
407
431
|
}
|
|
408
432
|
`;
|
|
433
|
+
// ─── Model Queries ───────────────────────────────────────────
|
|
434
|
+
// PropertyField is self-recursive (fields/itemFields are JSON on the wire
|
|
435
|
+
// to avoid infinite schema recursion). Keep this in sync with page-type.ts
|
|
436
|
+
// resolver's PropertyField object type.
|
|
437
|
+
const PROPERTY_FIELD_FRAGMENT = `
|
|
438
|
+
key
|
|
439
|
+
label
|
|
440
|
+
type
|
|
441
|
+
required
|
|
442
|
+
description
|
|
443
|
+
defaultValue
|
|
444
|
+
options
|
|
445
|
+
fields
|
|
446
|
+
itemType
|
|
447
|
+
itemFields
|
|
448
|
+
relationTo
|
|
449
|
+
relationType
|
|
450
|
+
acceptedTypes
|
|
451
|
+
multiple
|
|
452
|
+
schemaProperty
|
|
453
|
+
minLength
|
|
454
|
+
maxLength
|
|
455
|
+
minValue
|
|
456
|
+
maxValue
|
|
457
|
+
pattern
|
|
458
|
+
`;
|
|
459
|
+
const MODEL_DEFINITION_FRAGMENT = `
|
|
460
|
+
id
|
|
461
|
+
workspaceId
|
|
462
|
+
name
|
|
463
|
+
slug
|
|
464
|
+
description
|
|
465
|
+
icon
|
|
466
|
+
color
|
|
467
|
+
displayField
|
|
468
|
+
defaultSort { field direction }
|
|
469
|
+
fields { ${PROPERTY_FIELD_FRAGMENT} }
|
|
470
|
+
statusField {
|
|
471
|
+
enabled
|
|
472
|
+
values
|
|
473
|
+
defaultValue
|
|
474
|
+
transitions { from to }
|
|
475
|
+
}
|
|
476
|
+
createdAt
|
|
477
|
+
updatedAt
|
|
478
|
+
createdBy
|
|
479
|
+
recordCount
|
|
480
|
+
`;
|
|
481
|
+
const MODEL_RECORD_FRAGMENT = `
|
|
482
|
+
id
|
|
483
|
+
workspaceId
|
|
484
|
+
modelId
|
|
485
|
+
data
|
|
486
|
+
status
|
|
487
|
+
createdAt
|
|
488
|
+
updatedAt
|
|
489
|
+
createdBy
|
|
490
|
+
updatedBy
|
|
491
|
+
`;
|
|
492
|
+
export const MODEL_DEFINITIONS_QUERY = `
|
|
493
|
+
query ModelDefinitions {
|
|
494
|
+
modelDefinitions {
|
|
495
|
+
${MODEL_DEFINITION_FRAGMENT}
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
`;
|
|
499
|
+
// Lightweight companion to MODEL_DEFINITIONS_QUERY: used by get_model's
|
|
500
|
+
// slug fallback to avoid pulling full field schemas for every model when
|
|
501
|
+
// all we need is the id for a follow-up lookup.
|
|
502
|
+
export const MODEL_DEFINITIONS_BY_SLUG_INDEX_QUERY = `
|
|
503
|
+
query ModelDefinitionsSlugIndex {
|
|
504
|
+
modelDefinitions {
|
|
505
|
+
id
|
|
506
|
+
slug
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
`;
|
|
510
|
+
export const MODEL_DEFINITION_BY_ID_QUERY = `
|
|
511
|
+
query ModelDefinition($id: ID!) {
|
|
512
|
+
modelDefinition(id: $id) {
|
|
513
|
+
${MODEL_DEFINITION_FRAGMENT}
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
`;
|
|
517
|
+
export const MODEL_RECORDS_QUERY = `
|
|
518
|
+
query ModelRecords(
|
|
519
|
+
$modelId: ID!
|
|
520
|
+
$filter: JSON
|
|
521
|
+
$limit: Int
|
|
522
|
+
$offset: Int
|
|
523
|
+
$sort: String
|
|
524
|
+
$populate: [String!]
|
|
525
|
+
) {
|
|
526
|
+
modelRecords(
|
|
527
|
+
modelId: $modelId
|
|
528
|
+
filter: $filter
|
|
529
|
+
limit: $limit
|
|
530
|
+
offset: $offset
|
|
531
|
+
sort: $sort
|
|
532
|
+
populate: $populate
|
|
533
|
+
) {
|
|
534
|
+
items { ${MODEL_RECORD_FRAGMENT} }
|
|
535
|
+
total
|
|
536
|
+
hasMore
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
`;
|
|
540
|
+
export const MODEL_RECORD_BY_ID_QUERY = `
|
|
541
|
+
query ModelRecord($id: ID!) {
|
|
542
|
+
modelRecord(id: $id) {
|
|
543
|
+
${MODEL_RECORD_FRAGMENT}
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
`;
|
|
547
|
+
export const MODEL_TEMPLATES_QUERY = `
|
|
548
|
+
query ModelTemplates {
|
|
549
|
+
modelTemplates {
|
|
550
|
+
id
|
|
551
|
+
name
|
|
552
|
+
description
|
|
553
|
+
icon
|
|
554
|
+
category
|
|
555
|
+
models {
|
|
556
|
+
name
|
|
557
|
+
slug
|
|
558
|
+
description
|
|
559
|
+
icon
|
|
560
|
+
fieldCount
|
|
561
|
+
hasStatus
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
`;
|
|
566
|
+
// ─── Model Mutations ─────────────────────────────────────────
|
|
567
|
+
export const CREATE_MODEL_DEFINITION_MUTATION = `
|
|
568
|
+
mutation CreateModelDefinition($input: CreateModelDefinitionInput!) {
|
|
569
|
+
createModelDefinition(input: $input) {
|
|
570
|
+
${MODEL_DEFINITION_FRAGMENT}
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
`;
|
|
574
|
+
export const UPDATE_MODEL_DEFINITION_MUTATION = `
|
|
575
|
+
mutation UpdateModelDefinition($input: UpdateModelDefinitionInput!) {
|
|
576
|
+
updateModelDefinition(input: $input) {
|
|
577
|
+
${MODEL_DEFINITION_FRAGMENT}
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
`;
|
|
581
|
+
export const DELETE_MODEL_DEFINITION_MUTATION = `
|
|
582
|
+
mutation DeleteModelDefinition($id: ID!) {
|
|
583
|
+
deleteModelDefinition(id: $id)
|
|
584
|
+
}
|
|
585
|
+
`;
|
|
586
|
+
export const CREATE_MODEL_RECORD_MUTATION = `
|
|
587
|
+
mutation CreateModelRecord($input: CreateModelRecordInput!) {
|
|
588
|
+
createModelRecord(input: $input) {
|
|
589
|
+
${MODEL_RECORD_FRAGMENT}
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
`;
|
|
593
|
+
export const UPDATE_MODEL_RECORD_MUTATION = `
|
|
594
|
+
mutation UpdateModelRecord($input: UpdateModelRecordInput!) {
|
|
595
|
+
updateModelRecord(input: $input) {
|
|
596
|
+
${MODEL_RECORD_FRAGMENT}
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
`;
|
|
600
|
+
export const UPDATE_MODEL_RECORD_STATUS_MUTATION = `
|
|
601
|
+
mutation UpdateModelRecordStatus($input: UpdateModelRecordStatusInput!) {
|
|
602
|
+
updateModelRecordStatus(input: $input) {
|
|
603
|
+
${MODEL_RECORD_FRAGMENT}
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
`;
|
|
607
|
+
export const DELETE_MODEL_RECORD_MUTATION = `
|
|
608
|
+
mutation DeleteModelRecord($id: ID!) {
|
|
609
|
+
deleteModelRecord(id: $id)
|
|
610
|
+
}
|
|
611
|
+
`;
|
|
612
|
+
export const IMPORT_MODEL_RECORDS_MUTATION = `
|
|
613
|
+
mutation ImportModelRecords($input: ImportModelRecordsInput!) {
|
|
614
|
+
importModelRecords(input: $input) {
|
|
615
|
+
importedCount
|
|
616
|
+
errors { row message }
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
`;
|
|
620
|
+
export const INSTALL_MODEL_TEMPLATE_MUTATION = `
|
|
621
|
+
mutation InstallModelTemplate($templateId: String!) {
|
|
622
|
+
installModelTemplate(templateId: $templateId) {
|
|
623
|
+
templateId
|
|
624
|
+
installedCount
|
|
625
|
+
skippedSlugs
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
`;
|
|
409
629
|
//# sourceMappingURL=queries.js.map
|
package/dist/queries.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.js","sourceRoot":"","sources":["../src/queries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAE1D,MAAM,sBAAsB,GAAG,0BAA0B,EAAE,CAAC;AAE5D,gEAAgE;AAEhE,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;;;;;;;;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;AAEhE,MAAM,CAAC,MAAM,gCAAgC,GAAG;;;QAGxC,yBAAyB;;;CAGhC,CAAC;AAEF,MAAM,CAAC,MAAM,gCAAgC,GAAG;;;QAGxC,yBAAyB;;;CAGhC,CAAC;AAEF,MAAM,CAAC,MAAM,gCAAgC,GAAG;;;;CAI/C,CAAC;AAEF,MAAM,CAAC,MAAM,4BAA4B,GAAG;;;QAGpC,qBAAqB;;;CAG5B,CAAC;AAEF,MAAM,CAAC,MAAM,4BAA4B,GAAG;;;QAGpC,qBAAqB;;;CAG5B,CAAC;AAEF,MAAM,CAAC,MAAM,mCAAmC,GAAG;;;QAG3C,qBAAqB;;;CAG5B,CAAC;AAEF,MAAM,CAAC,MAAM,4BAA4B,GAAG;;;;CAI3C,CAAC;AAEF,MAAM,CAAC,MAAM,6BAA6B,GAAG;;;;;;;CAO5C,CAAC;AAEF,MAAM,CAAC,MAAM,+BAA+B,GAAG;;;;;;;;CAQ9C,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const responseModeSchema: z.ZodDefault<z.ZodOptional<z.ZodEnum<["minimal", "full"]>>>;
|
|
3
|
+
export type ResponseMode = "minimal" | "full";
|
|
4
|
+
interface PageLike {
|
|
5
|
+
id: string;
|
|
6
|
+
slug?: string | null;
|
|
7
|
+
hasUnpublishedChanges?: boolean | null;
|
|
8
|
+
updatedAt?: string | null;
|
|
9
|
+
published?: boolean | null;
|
|
10
|
+
}
|
|
11
|
+
export interface PageMinimal {
|
|
12
|
+
id: string;
|
|
13
|
+
slug?: string;
|
|
14
|
+
hasUnpublishedChanges?: boolean;
|
|
15
|
+
updatedAt?: string;
|
|
16
|
+
published?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare function pageMinimal(page: PageLike, extras?: {
|
|
19
|
+
published?: boolean;
|
|
20
|
+
}): PageMinimal;
|
|
21
|
+
export interface PageBlockMinimal {
|
|
22
|
+
pageId: string;
|
|
23
|
+
blockId: string;
|
|
24
|
+
hasUnpublishedChanges?: boolean;
|
|
25
|
+
updatedAt?: string;
|
|
26
|
+
}
|
|
27
|
+
export declare function pageBlockMinimal(page: PageLike, blockId: string): PageBlockMinimal;
|
|
28
|
+
interface FormLike {
|
|
29
|
+
id: string;
|
|
30
|
+
slug?: string | null;
|
|
31
|
+
status?: string | null;
|
|
32
|
+
updatedAt?: string | null;
|
|
33
|
+
}
|
|
34
|
+
export interface FormMinimal {
|
|
35
|
+
id: string;
|
|
36
|
+
slug?: string;
|
|
37
|
+
status?: string;
|
|
38
|
+
updatedAt?: string;
|
|
39
|
+
}
|
|
40
|
+
export declare function formMinimal(form: FormLike): FormMinimal;
|
|
41
|
+
interface ModelLike {
|
|
42
|
+
id: string;
|
|
43
|
+
slug?: string | null;
|
|
44
|
+
updatedAt?: string | null;
|
|
45
|
+
}
|
|
46
|
+
export interface ModelMinimal {
|
|
47
|
+
id: string;
|
|
48
|
+
slug?: string;
|
|
49
|
+
updatedAt?: string;
|
|
50
|
+
}
|
|
51
|
+
export declare function modelMinimal(model: ModelLike): ModelMinimal;
|
|
52
|
+
interface RecordLike {
|
|
53
|
+
id: string;
|
|
54
|
+
status?: string | null;
|
|
55
|
+
updatedAt?: string | null;
|
|
56
|
+
}
|
|
57
|
+
export interface RecordMinimal {
|
|
58
|
+
id: string;
|
|
59
|
+
status?: string;
|
|
60
|
+
updatedAt?: string;
|
|
61
|
+
}
|
|
62
|
+
export declare function recordMinimal(record: RecordLike): RecordMinimal;
|
|
63
|
+
export declare function jsonText<T>(mode: ResponseMode, full: T, toMinimal: (full: T) => unknown): {
|
|
64
|
+
content: Array<{
|
|
65
|
+
type: "text";
|
|
66
|
+
text: string;
|
|
67
|
+
}>;
|
|
68
|
+
};
|
|
69
|
+
export {};
|
|
70
|
+
//# sourceMappingURL=responses.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../src/responses.ts"],"names":[],"mappings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ent
|
|
3
|
+
// context windows from being eaten by echoed page/block content.
|
|
4
|
+
// Pass "full" only when the caller actually needs the post-write state
|
|
5
|
+
// inline; otherwise issue a follow-up read tool call.
|
|
6
|
+
export const responseModeSchema = z
|
|
7
|
+
.enum(["minimal", "full"])
|
|
8
|
+
.optional()
|
|
9
|
+
.default("minimal")
|
|
10
|
+
.describe("Response shape. 'minimal' (default) returns a small ack (~200 bytes). 'full' returns the full mutation response.");
|
|
11
|
+
export function pageMinimal(page, extras) {
|
|
12
|
+
const out = { id: page.id };
|
|
13
|
+
if (page.slug != null)
|
|
14
|
+
out.slug = page.slug;
|
|
15
|
+
if (page.hasUnpublishedChanges != null)
|
|
16
|
+
out.hasUnpublishedChanges = page.hasUnpublishedChanges;
|
|
17
|
+
if (page.updatedAt != null)
|
|
18
|
+
out.updatedAt = page.updatedAt;
|
|
19
|
+
// `published` is only emitted when the caller explicitly requests it —
|
|
20
|
+
// i.e. publish_page / unpublish_page. Other mutations (savePage etc.)
|
|
21
|
+
// may echo `published` as part of their selection set, but including it
|
|
22
|
+
// in the minimal ack would make the shape depend on which mutation
|
|
23
|
+
// served the request. Keeping it opt-in keeps the minimal schema stable.
|
|
24
|
+
if (extras?.published !== undefined)
|
|
25
|
+
out.published = extras.published;
|
|
26
|
+
return out;
|
|
27
|
+
}
|
|
28
|
+
export function pageBlockMinimal(page, blockId) {
|
|
29
|
+
const out = { pageId: page.id, blockId };
|
|
30
|
+
if (page.hasUnpublishedChanges != null)
|
|
31
|
+
out.hasUnpublishedChanges = page.hasUnpublishedChanges;
|
|
32
|
+
if (page.updatedAt != null)
|
|
33
|
+
out.updatedAt = page.updatedAt;
|
|
34
|
+
return out;
|
|
35
|
+
}
|
|
36
|
+
export function formMinimal(form) {
|
|
37
|
+
const out = { id: form.id };
|
|
38
|
+
if (form.slug != null)
|
|
39
|
+
out.slug = form.slug;
|
|
40
|
+
if (form.status != null)
|
|
41
|
+
out.status = form.status;
|
|
42
|
+
if (form.updatedAt != null)
|
|
43
|
+
out.updatedAt = form.updatedAt;
|
|
44
|
+
return out;
|
|
45
|
+
}
|
|
46
|
+
export function modelMinimal(model) {
|
|
47
|
+
const out = { id: model.id };
|
|
48
|
+
if (model.slug != null)
|
|
49
|
+
out.slug = model.slug;
|
|
50
|
+
if (model.updatedAt != null)
|
|
51
|
+
out.updatedAt = model.updatedAt;
|
|
52
|
+
return out;
|
|
53
|
+
}
|
|
54
|
+
export function recordMinimal(record) {
|
|
55
|
+
const out = { id: record.id };
|
|
56
|
+
if (record.status != null)
|
|
57
|
+
out.status = record.status;
|
|
58
|
+
if (record.updatedAt != null)
|
|
59
|
+
out.updatedAt = record.updatedAt;
|
|
60
|
+
return out;
|
|
61
|
+
}
|
|
62
|
+
// Tiny wrapper so call sites stay one-liners instead of repeating
|
|
63
|
+
// `JSON.stringify(mode === "full" ? data : minimal(data), ...)`.
|
|
64
|
+
// Minimal mode emits compact JSON - the whole point is keeping the ack
|
|
65
|
+
// small, and pretty-print whitespace was eating ~25-40% of the payload.
|
|
66
|
+
// Full mode keeps pretty-print for human-readable debugging.
|
|
67
|
+
export function jsonText(mode, full, toMinimal) {
|
|
68
|
+
const text = mode === "full"
|
|
69
|
+
? JSON.stringify(full, null, 2)
|
|
70
|
+
: JSON.stringify(toMinimal(full));
|
|
71
|
+
return {
|
|
72
|
+
content: [{ type: "text", text }],
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=responses.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"responses.js","sourceRoot":"","sources":["../src/responses.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,uEAAuE;AACvE,iEAAiE;AACjE,uEAAuE;AACvE,sDAAsD;AACtD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC;KAChC,IAAI,CAAC,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;KACzB,QAAQ,EAAE;KACV,OAAO,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AS,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IACtC,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,CAAC;KAC3C,CAAC;AACJ,CAAC"}
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAMpE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AA2FlD,wBAAgB,YAAY,CAAC,MAAM,EAAE,WAAW,aAu3E/C"}
|