@btst/plugin-cms 0.0.0-stage → 1.0.0-beta.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/LICENSE.md +17 -0
- package/dist/api/getters.cjs +328 -0
- package/dist/api/getters.mjs +314 -0
- package/dist/api/index.cjs +29 -0
- package/dist/api/index.d.cts +209 -0
- package/dist/api/index.d.mts +209 -0
- package/dist/api/index.d.ts +209 -0
- package/dist/api/index.mjs +7 -0
- package/dist/api/lifecycle-migrations.cjs +13 -0
- package/dist/api/lifecycle-migrations.mjs +11 -0
- package/dist/api/mutations.cjs +59 -0
- package/dist/api/mutations.mjs +57 -0
- package/dist/api/operations.cjs +1769 -0
- package/dist/api/operations.mjs +1762 -0
- package/dist/api/plugin.cjs +337 -0
- package/dist/api/plugin.mjs +331 -0
- package/dist/api/query-key-defs.cjs +44 -0
- package/dist/api/query-key-defs.mjs +39 -0
- package/dist/api/relations.cjs +76 -0
- package/dist/api/relations.mjs +70 -0
- package/dist/client/components/forms/content-form.cjs +286 -0
- package/dist/client/components/forms/content-form.mjs +284 -0
- package/dist/client/components/forms/file-upload.cjs +160 -0
- package/dist/client/components/forms/file-upload.mjs +158 -0
- package/dist/client/components/forms/relation-field.cjs +237 -0
- package/dist/client/components/forms/relation-field.mjs +235 -0
- package/dist/client/components/index.cjs +14 -0
- package/dist/client/components/index.d.cts +20 -0
- package/dist/client/components/index.d.mts +20 -0
- package/dist/client/components/index.d.ts +20 -0
- package/dist/client/components/index.mjs +10 -0
- package/dist/client/components/inverse-relations-panel.cjs +272 -0
- package/dist/client/components/inverse-relations-panel.mjs +270 -0
- package/dist/client/components/loading/dashboard-skeleton.cjs +18 -0
- package/dist/client/components/loading/dashboard-skeleton.mjs +16 -0
- package/dist/client/components/loading/editor-skeleton.cjs +32 -0
- package/dist/client/components/loading/editor-skeleton.mjs +30 -0
- package/dist/client/components/loading/list-skeleton.cjs +32 -0
- package/dist/client/components/loading/list-skeleton.mjs +30 -0
- package/dist/client/components/pages/404-page.cjs +26 -0
- package/dist/client/components/pages/404-page.mjs +24 -0
- package/dist/client/components/pages/content-editor-page.cjs +84 -0
- package/dist/client/components/pages/content-editor-page.internal.cjs +170 -0
- package/dist/client/components/pages/content-editor-page.internal.mjs +168 -0
- package/dist/client/components/pages/content-editor-page.mjs +82 -0
- package/dist/client/components/pages/content-list-page.cjs +49 -0
- package/dist/client/components/pages/content-list-page.internal.cjs +334 -0
- package/dist/client/components/pages/content-list-page.internal.mjs +332 -0
- package/dist/client/components/pages/content-list-page.mjs +47 -0
- package/dist/client/components/pages/dashboard-page.cjs +42 -0
- package/dist/client/components/pages/dashboard-page.internal.cjs +102 -0
- package/dist/client/components/pages/dashboard-page.internal.mjs +100 -0
- package/dist/client/components/pages/dashboard-page.mjs +40 -0
- package/dist/client/components/shared/default-error.cjs +17 -0
- package/dist/client/components/shared/default-error.mjs +15 -0
- package/dist/client/components/shared/empty-state.cjs +16 -0
- package/dist/client/components/shared/empty-state.mjs +14 -0
- package/dist/client/components/shared/page-wrapper.cjs +29 -0
- package/dist/client/components/shared/page-wrapper.mjs +27 -0
- package/dist/client/constants.cjs +5 -0
- package/dist/client/constants.mjs +3 -0
- package/dist/client/hooks/cms-hooks.cjs +300 -0
- package/dist/client/hooks/cms-hooks.mjs +280 -0
- package/dist/client/hooks/cms-resource.cjs +13 -0
- package/dist/client/hooks/cms-resource.mjs +11 -0
- package/dist/client/hooks/index.cjs +25 -0
- package/dist/client/hooks/index.d.cts +693 -0
- package/dist/client/hooks/index.d.mts +693 -0
- package/dist/client/hooks/index.d.ts +693 -0
- package/dist/client/hooks/index.mjs +1 -0
- package/dist/client/index.cjs +15 -0
- package/dist/client/index.d.cts +654 -0
- package/dist/client/index.d.mts +654 -0
- package/dist/client/index.d.ts +654 -0
- package/dist/client/index.mjs +3 -0
- package/dist/client/overrides.cjs +26 -0
- package/dist/client/overrides.mjs +24 -0
- package/dist/client/plugin.cjs +316 -0
- package/dist/client/plugin.mjs +314 -0
- package/dist/client.css +3 -0
- package/dist/db.cjs +118 -0
- package/dist/db.mjs +116 -0
- package/dist/permissions.cjs +46 -0
- package/dist/permissions.d.cts +42 -0
- package/dist/permissions.d.mts +42 -0
- package/dist/permissions.d.ts +42 -0
- package/dist/permissions.mjs +44 -0
- package/dist/query-keys.cjs +229 -0
- package/dist/query-keys.d.cts +8 -0
- package/dist/query-keys.d.mts +8 -0
- package/dist/query-keys.d.ts +8 -0
- package/dist/query-keys.mjs +225 -0
- package/dist/schemas.cjs +81 -0
- package/dist/schemas.mjs +72 -0
- package/dist/shared/plugin-cms.BBshPRkb.d.cts +6 -0
- package/dist/shared/plugin-cms.BBshPRkb.d.mts +6 -0
- package/dist/shared/plugin-cms.BBshPRkb.d.ts +6 -0
- package/dist/shared/plugin-cms.Bptwe33B.d.cts +1749 -0
- package/dist/shared/plugin-cms.Csx7tNDO.d.mts +1749 -0
- package/dist/shared/plugin-cms.eNW9_FO5.d.ts +1749 -0
- package/dist/style.css +6 -0
- package/dist/types.cjs +2 -0
- package/dist/types.d.cts +406 -0
- package/dist/types.d.mts +406 -0
- package/dist/types.d.ts +406 -0
- package/dist/types.mjs +1 -0
- package/dist/ui/src/components/accordion.cjs +81 -0
- package/dist/ui/src/components/accordion.mjs +62 -0
- package/dist/ui/src/components/alert-dialog.cjs +157 -0
- package/dist/ui/src/components/alert-dialog.mjs +132 -0
- package/dist/ui/src/components/auto-form/common/label.cjs +18 -0
- package/dist/ui/src/components/auto-form/common/label.mjs +16 -0
- package/dist/ui/src/components/auto-form/common/tooltip.cjs +9 -0
- package/dist/ui/src/components/auto-form/common/tooltip.mjs +7 -0
- package/dist/ui/src/components/auto-form/config.cjs +40 -0
- package/dist/ui/src/components/auto-form/config.mjs +37 -0
- package/dist/ui/src/components/auto-form/dependencies.cjs +48 -0
- package/dist/ui/src/components/auto-form/dependencies.mjs +46 -0
- package/dist/ui/src/components/auto-form/fields/array.cjs +266 -0
- package/dist/ui/src/components/auto-form/fields/array.mjs +264 -0
- package/dist/ui/src/components/auto-form/fields/checkbox.cjs +38 -0
- package/dist/ui/src/components/auto-form/fields/checkbox.mjs +36 -0
- package/dist/ui/src/components/auto-form/fields/date.cjs +67 -0
- package/dist/ui/src/components/auto-form/fields/date.mjs +65 -0
- package/dist/ui/src/components/auto-form/fields/enum.cjs +73 -0
- package/dist/ui/src/components/auto-form/fields/enum.mjs +71 -0
- package/dist/ui/src/components/auto-form/fields/input.cjs +32 -0
- package/dist/ui/src/components/auto-form/fields/input.mjs +30 -0
- package/dist/ui/src/components/auto-form/fields/number.cjs +31 -0
- package/dist/ui/src/components/auto-form/fields/number.mjs +29 -0
- package/dist/ui/src/components/auto-form/fields/object.cjs +233 -0
- package/dist/ui/src/components/auto-form/fields/object.mjs +217 -0
- package/dist/ui/src/components/auto-form/fields/radio-group.cjs +67 -0
- package/dist/ui/src/components/auto-form/fields/radio-group.mjs +65 -0
- package/dist/ui/src/components/auto-form/fields/switch.cjs +38 -0
- package/dist/ui/src/components/auto-form/fields/switch.mjs +36 -0
- package/dist/ui/src/components/auto-form/fields/textarea.cjs +31 -0
- package/dist/ui/src/components/auto-form/fields/textarea.mjs +29 -0
- package/dist/ui/src/components/auto-form/helpers.cjs +270 -0
- package/dist/ui/src/components/auto-form/helpers.mjs +259 -0
- package/dist/ui/src/components/auto-form/index.cjs +92 -0
- package/dist/ui/src/components/auto-form/index.mjs +86 -0
- package/dist/ui/src/components/auto-form/stepped-auto-form.cjs +374 -0
- package/dist/ui/src/components/auto-form/stepped-auto-form.mjs +368 -0
- package/dist/ui/src/components/auto-form/types.cjs +11 -0
- package/dist/ui/src/components/auto-form/types.mjs +9 -0
- package/dist/ui/src/components/badge.cjs +42 -0
- package/dist/ui/src/components/badge.mjs +39 -0
- package/dist/ui/src/components/button.cjs +56 -0
- package/dist/ui/src/components/button.mjs +53 -0
- package/dist/ui/src/components/calendar.cjs +207 -0
- package/dist/ui/src/components/calendar.mjs +190 -0
- package/dist/ui/src/components/card.cjs +56 -0
- package/dist/ui/src/components/card.mjs +51 -0
- package/dist/ui/src/components/checkbox.cjs +48 -0
- package/dist/ui/src/components/checkbox.mjs +32 -0
- package/dist/ui/src/components/command.cjs +78 -0
- package/dist/ui/src/components/command.mjs +73 -0
- package/dist/ui/src/components/date-picker.cjs +41 -0
- package/dist/ui/src/components/date-picker.mjs +39 -0
- package/dist/ui/src/components/dialog.cjs +119 -0
- package/dist/ui/src/components/dialog.mjs +97 -0
- package/dist/ui/src/components/form.cjs +120 -0
- package/dist/ui/src/components/form.mjs +98 -0
- package/dist/ui/src/components/input.cjs +23 -0
- package/dist/ui/src/components/input.mjs +21 -0
- package/dist/ui/src/components/label.cjs +39 -0
- package/dist/ui/src/components/label.mjs +23 -0
- package/dist/ui/src/components/multi-select.cjs +555 -0
- package/dist/ui/src/components/multi-select.mjs +540 -0
- package/dist/ui/src/components/page-layout.cjs +25 -0
- package/dist/ui/src/components/page-layout.mjs +23 -0
- package/dist/ui/src/components/page-wrapper.cjs +20 -0
- package/dist/ui/src/components/page-wrapper.mjs +18 -0
- package/dist/ui/src/components/popover.cjs +60 -0
- package/dist/ui/src/components/popover.mjs +42 -0
- package/dist/ui/src/components/radio-group.cjs +62 -0
- package/dist/ui/src/components/radio-group.mjs +45 -0
- package/dist/ui/src/components/select.cjs +161 -0
- package/dist/ui/src/components/select.mjs +139 -0
- package/dist/ui/src/components/separator.cjs +43 -0
- package/dist/ui/src/components/separator.mjs +27 -0
- package/dist/ui/src/components/skeleton.cjs +17 -0
- package/dist/ui/src/components/skeleton.mjs +15 -0
- package/dist/ui/src/components/stack-attribution.cjs +24 -0
- package/dist/ui/src/components/stack-attribution.mjs +22 -0
- package/dist/ui/src/components/switch.cjs +48 -0
- package/dist/ui/src/components/switch.mjs +32 -0
- package/dist/ui/src/components/table.cjs +89 -0
- package/dist/ui/src/components/table.mjs +82 -0
- package/dist/ui/src/components/textarea.cjs +20 -0
- package/dist/ui/src/components/textarea.mjs +18 -0
- package/dist/ui/src/hooks/use-debounce.cjs +16 -0
- package/dist/ui/src/hooks/use-debounce.mjs +14 -0
- package/dist/ui/src/hooks/use-route-lifecycle.cjs +31 -0
- package/dist/ui/src/hooks/use-route-lifecycle.mjs +29 -0
- package/dist/ui/src/lib/schema-converter.cjs +133 -0
- package/dist/ui/src/lib/schema-converter.mjs +127 -0
- package/dist/ui/src/lib/utils.cjs +10 -0
- package/dist/ui/src/lib/utils.mjs +8 -0
- package/dist/utils.cjs +19 -0
- package/dist/utils.mjs +12 -0
- package/package.json +170 -3
- package/README.md +0 -3
package/LICENSE.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
Copyright (c) 2025 - present, olliethedev
|
|
3
|
+
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
|
5
|
+
and associated documentation files (the "Software"), to deal in the Software without restriction,
|
|
6
|
+
including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
|
7
|
+
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
|
|
8
|
+
is furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all copies or
|
|
11
|
+
substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
|
|
14
|
+
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
15
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
16
|
+
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
17
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const schemas = require('../schemas.cjs');
|
|
4
|
+
|
|
5
|
+
class CMSContentSelectionError extends Error {
|
|
6
|
+
}
|
|
7
|
+
function validateContentReadOptions(contentType, options) {
|
|
8
|
+
schemas.contentReadOptionsSchema.parse(options ?? {});
|
|
9
|
+
if (options?.fields === void 0) return;
|
|
10
|
+
if (options.view !== "content") {
|
|
11
|
+
throw new CMSContentSelectionError("fields requires view: content");
|
|
12
|
+
}
|
|
13
|
+
const properties = contentType ? JSON.parse(contentType.jsonSchema).properties : void 0;
|
|
14
|
+
for (const field of options.fields) {
|
|
15
|
+
if (!properties || !Object.hasOwn(properties, field)) {
|
|
16
|
+
throw new CMSContentSelectionError(
|
|
17
|
+
`Unknown top-level content field: ${field}`
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function applyContentReadOptions(item, options) {
|
|
23
|
+
const result = options?.view === "content" ? {
|
|
24
|
+
id: item.id,
|
|
25
|
+
slug: item.slug,
|
|
26
|
+
parsedData: options.fields ? Object.fromEntries(
|
|
27
|
+
schemas.normalizeContentFields(options.fields).filter((field) => Object.hasOwn(item.parsedData, field)).map((field) => [
|
|
28
|
+
field,
|
|
29
|
+
item.parsedData[field]
|
|
30
|
+
])
|
|
31
|
+
) : item.parsedData,
|
|
32
|
+
createdAt: item.createdAt,
|
|
33
|
+
updatedAt: item.updatedAt
|
|
34
|
+
} : item;
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
function serializeContentType(ct) {
|
|
38
|
+
const needsMigration = !ct.autoFormVersion || ct.autoFormVersion < 2;
|
|
39
|
+
const migratedJsonSchema = needsMigration ? migrateToUnifiedSchema(ct.jsonSchema, ct.fieldConfig) : ct.jsonSchema;
|
|
40
|
+
return {
|
|
41
|
+
id: ct.id,
|
|
42
|
+
name: ct.name,
|
|
43
|
+
slug: ct.slug,
|
|
44
|
+
description: ct.description,
|
|
45
|
+
jsonSchema: migratedJsonSchema,
|
|
46
|
+
createdAt: ct.createdAt.toISOString(),
|
|
47
|
+
updatedAt: ct.updatedAt.toISOString()
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function migrateToUnifiedSchema(jsonSchemaStr, fieldConfigStr) {
|
|
51
|
+
if (!fieldConfigStr) return jsonSchemaStr;
|
|
52
|
+
try {
|
|
53
|
+
const jsonSchema = JSON.parse(jsonSchemaStr);
|
|
54
|
+
const fieldConfig = JSON.parse(fieldConfigStr);
|
|
55
|
+
if (!jsonSchema.properties || typeof fieldConfig !== "object") {
|
|
56
|
+
return jsonSchemaStr;
|
|
57
|
+
}
|
|
58
|
+
for (const [key, config] of Object.entries(fieldConfig)) {
|
|
59
|
+
if (jsonSchema.properties[key] && typeof config === "object" && config !== null && "fieldType" in config) {
|
|
60
|
+
jsonSchema.properties[key].fieldType = config.fieldType;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return JSON.stringify(jsonSchema);
|
|
64
|
+
} catch {
|
|
65
|
+
return jsonSchemaStr;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function serializeContentItem(item) {
|
|
69
|
+
return {
|
|
70
|
+
...item,
|
|
71
|
+
createdAt: item.createdAt.toISOString(),
|
|
72
|
+
updatedAt: item.updatedAt.toISOString()
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function serializeContentItemWithType(item) {
|
|
76
|
+
const parsedData = JSON.parse(item.data);
|
|
77
|
+
return {
|
|
78
|
+
...serializeContentItem(item),
|
|
79
|
+
parsedData,
|
|
80
|
+
contentType: item.contentType ? serializeContentType(item.contentType) : void 0
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
async function getAllContentTypes(adapter) {
|
|
84
|
+
const contentTypes = await adapter.findMany({
|
|
85
|
+
model: "contentType",
|
|
86
|
+
sortBy: { field: "name", direction: "asc" }
|
|
87
|
+
});
|
|
88
|
+
return contentTypes.map(serializeContentType);
|
|
89
|
+
}
|
|
90
|
+
function contentItemMatchesSearch(item, searchLower) {
|
|
91
|
+
if (item.slug.toLowerCase().includes(searchLower)) return true;
|
|
92
|
+
const matchesValue = (value) => typeof value === "string" && value.toLowerCase().includes(searchLower);
|
|
93
|
+
return Object.values(item.parsedData).some((value) => {
|
|
94
|
+
if (matchesValue(value)) return true;
|
|
95
|
+
if (Array.isArray(value)) return value.some(matchesValue);
|
|
96
|
+
if (typeof value === "object" && value !== null) {
|
|
97
|
+
return Object.values(value).some(matchesValue);
|
|
98
|
+
}
|
|
99
|
+
return false;
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
async function getAllContentItems(adapter, contentTypeSlug, params) {
|
|
103
|
+
const contentType = await adapter.findOne({
|
|
104
|
+
model: "contentType",
|
|
105
|
+
where: [
|
|
106
|
+
{
|
|
107
|
+
field: "slug",
|
|
108
|
+
value: contentTypeSlug,
|
|
109
|
+
operator: "eq"
|
|
110
|
+
}
|
|
111
|
+
]
|
|
112
|
+
});
|
|
113
|
+
if (!contentType) {
|
|
114
|
+
return {
|
|
115
|
+
items: [],
|
|
116
|
+
total: 0,
|
|
117
|
+
limit: params?.limit,
|
|
118
|
+
offset: params?.offset
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
validateContentReadOptions(contentType, params);
|
|
122
|
+
const whereConditions = [
|
|
123
|
+
{
|
|
124
|
+
field: "contentTypeId",
|
|
125
|
+
value: contentType.id,
|
|
126
|
+
operator: "eq"
|
|
127
|
+
}
|
|
128
|
+
];
|
|
129
|
+
if (params?.slug) {
|
|
130
|
+
whereConditions.push({
|
|
131
|
+
field: "slug",
|
|
132
|
+
value: params.slug,
|
|
133
|
+
operator: "eq"
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
const search = params?.search?.trim();
|
|
137
|
+
const needsInMemoryFilter = !!search;
|
|
138
|
+
const dbTotal = !needsInMemoryFilter ? await adapter.count({
|
|
139
|
+
model: "contentItem",
|
|
140
|
+
where: whereConditions
|
|
141
|
+
}) : void 0;
|
|
142
|
+
const items = await adapter.findMany({
|
|
143
|
+
model: "contentItem",
|
|
144
|
+
where: whereConditions,
|
|
145
|
+
limit: !needsInMemoryFilter ? params?.limit : schemas.DEFAULT_MAX_PAGE_SIZE,
|
|
146
|
+
offset: !needsInMemoryFilter ? params?.offset : void 0,
|
|
147
|
+
sortBy: { field: "createdAt", direction: "desc" },
|
|
148
|
+
join: { contentType: true }
|
|
149
|
+
});
|
|
150
|
+
let result = items.map(serializeContentItemWithType);
|
|
151
|
+
if (needsInMemoryFilter) {
|
|
152
|
+
const searchLower = search.toLowerCase();
|
|
153
|
+
result = result.filter(
|
|
154
|
+
(item) => contentItemMatchesSearch(item, searchLower)
|
|
155
|
+
);
|
|
156
|
+
const total = result.length;
|
|
157
|
+
const offset = params?.offset ?? 0;
|
|
158
|
+
const limit = params?.limit;
|
|
159
|
+
result = result.slice(
|
|
160
|
+
offset,
|
|
161
|
+
limit !== void 0 ? offset + limit : void 0
|
|
162
|
+
);
|
|
163
|
+
return {
|
|
164
|
+
items: result.map((item) => applyContentReadOptions(item, params)),
|
|
165
|
+
total,
|
|
166
|
+
limit: params?.limit,
|
|
167
|
+
offset: params?.offset
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
return {
|
|
171
|
+
items: result.map((item) => applyContentReadOptions(item, params)),
|
|
172
|
+
total: dbTotal ?? result.length,
|
|
173
|
+
limit: params?.limit,
|
|
174
|
+
offset: params?.offset
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
async function getContentItemById(adapter, id, options) {
|
|
178
|
+
const item = await adapter.findOne({
|
|
179
|
+
model: "contentItem",
|
|
180
|
+
where: [{ field: "id", value: id, operator: "eq" }],
|
|
181
|
+
join: { contentType: true }
|
|
182
|
+
});
|
|
183
|
+
if (!item) return null;
|
|
184
|
+
validateContentReadOptions(item.contentType, options);
|
|
185
|
+
return applyContentReadOptions(serializeContentItemWithType(item), options);
|
|
186
|
+
}
|
|
187
|
+
async function getContentItemBySlug(adapter, contentTypeSlug, slug, options) {
|
|
188
|
+
const contentType = await adapter.findOne({
|
|
189
|
+
model: "contentType",
|
|
190
|
+
where: [
|
|
191
|
+
{
|
|
192
|
+
field: "slug",
|
|
193
|
+
value: contentTypeSlug,
|
|
194
|
+
operator: "eq"
|
|
195
|
+
}
|
|
196
|
+
]
|
|
197
|
+
});
|
|
198
|
+
if (!contentType) {
|
|
199
|
+
return null;
|
|
200
|
+
}
|
|
201
|
+
validateContentReadOptions(contentType, options);
|
|
202
|
+
const item = await adapter.findOne({
|
|
203
|
+
model: "contentItem",
|
|
204
|
+
where: [
|
|
205
|
+
{
|
|
206
|
+
field: "contentTypeId",
|
|
207
|
+
value: contentType.id,
|
|
208
|
+
operator: "eq"
|
|
209
|
+
},
|
|
210
|
+
{ field: "slug", value: slug, operator: "eq" }
|
|
211
|
+
],
|
|
212
|
+
join: { contentType: true }
|
|
213
|
+
});
|
|
214
|
+
if (!item) {
|
|
215
|
+
return null;
|
|
216
|
+
}
|
|
217
|
+
return applyContentReadOptions(serializeContentItemWithType(item), options);
|
|
218
|
+
}
|
|
219
|
+
async function getContentItemsByRelation(adapter, contentTypeSlug, params) {
|
|
220
|
+
const contentType = await adapter.findOne({
|
|
221
|
+
model: "contentType",
|
|
222
|
+
where: [{ field: "slug", value: contentTypeSlug, operator: "eq" }]
|
|
223
|
+
});
|
|
224
|
+
if (!contentType) {
|
|
225
|
+
return {
|
|
226
|
+
items: [],
|
|
227
|
+
total: 0,
|
|
228
|
+
limit: params.limit ?? 20,
|
|
229
|
+
offset: params.offset ?? 0
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
validateContentReadOptions(contentType, params);
|
|
233
|
+
const result = await getContentItemsByRelationForType(
|
|
234
|
+
adapter,
|
|
235
|
+
contentType,
|
|
236
|
+
params
|
|
237
|
+
);
|
|
238
|
+
return {
|
|
239
|
+
...result,
|
|
240
|
+
items: result.items.map((item) => applyContentReadOptions(item, params))
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
async function getContentItemsByRelationForType(adapter, contentType, params) {
|
|
244
|
+
const limit = params.limit ?? 20;
|
|
245
|
+
const offset = params.offset ?? 0;
|
|
246
|
+
const batchSize = 100;
|
|
247
|
+
const sourceIds = /* @__PURE__ */ new Set();
|
|
248
|
+
for (let relationOffset = 0; ; relationOffset += batchSize) {
|
|
249
|
+
const relations = await adapter.findMany(
|
|
250
|
+
{
|
|
251
|
+
model: "contentRelation",
|
|
252
|
+
where: [
|
|
253
|
+
{ field: "targetId", value: params.targetId, operator: "eq" },
|
|
254
|
+
{ field: "fieldName", value: params.field, operator: "eq" }
|
|
255
|
+
],
|
|
256
|
+
select: ["sourceId"],
|
|
257
|
+
limit: batchSize,
|
|
258
|
+
offset: relationOffset,
|
|
259
|
+
sortBy: { field: "id", direction: "asc" }
|
|
260
|
+
}
|
|
261
|
+
);
|
|
262
|
+
for (const relation of relations) sourceIds.add(relation.sourceId);
|
|
263
|
+
if (relations.length < batchSize) break;
|
|
264
|
+
}
|
|
265
|
+
const ids = [...sourceIds];
|
|
266
|
+
const metadata = [];
|
|
267
|
+
for (let start = 0; start < ids.length; start += batchSize) {
|
|
268
|
+
metadata.push(
|
|
269
|
+
...await adapter.findMany({
|
|
270
|
+
model: "contentItem",
|
|
271
|
+
where: [
|
|
272
|
+
{
|
|
273
|
+
field: "id",
|
|
274
|
+
value: ids.slice(start, start + batchSize),
|
|
275
|
+
operator: "in"
|
|
276
|
+
},
|
|
277
|
+
{ field: "contentTypeId", value: contentType.id, operator: "eq" }
|
|
278
|
+
],
|
|
279
|
+
select: ["id", "createdAt"],
|
|
280
|
+
limit: batchSize
|
|
281
|
+
})
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
metadata.sort(
|
|
285
|
+
(left, right) => right.createdAt.getTime() - left.createdAt.getTime() || (left.id < right.id ? 1 : left.id > right.id ? -1 : 0)
|
|
286
|
+
);
|
|
287
|
+
const pageIds = metadata.slice(offset, offset + limit).map((item) => item.id);
|
|
288
|
+
const itemsById = /* @__PURE__ */ new Map();
|
|
289
|
+
for (let start = 0; start < pageIds.length; start += batchSize) {
|
|
290
|
+
const items = await adapter.findMany({
|
|
291
|
+
model: "contentItem",
|
|
292
|
+
where: [
|
|
293
|
+
{
|
|
294
|
+
field: "id",
|
|
295
|
+
value: pageIds.slice(start, start + batchSize),
|
|
296
|
+
operator: "in"
|
|
297
|
+
},
|
|
298
|
+
{ field: "contentTypeId", value: contentType.id, operator: "eq" }
|
|
299
|
+
],
|
|
300
|
+
limit: batchSize,
|
|
301
|
+
join: { contentType: true }
|
|
302
|
+
});
|
|
303
|
+
for (const item of items) itemsById.set(item.id, item);
|
|
304
|
+
}
|
|
305
|
+
return {
|
|
306
|
+
items: pageIds.flatMap((id) => {
|
|
307
|
+
const item = itemsById.get(id);
|
|
308
|
+
return item ? [serializeContentItemWithType(item)] : [];
|
|
309
|
+
}),
|
|
310
|
+
total: metadata.length,
|
|
311
|
+
limit,
|
|
312
|
+
offset
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
exports.CMSContentSelectionError = CMSContentSelectionError;
|
|
317
|
+
exports.applyContentReadOptions = applyContentReadOptions;
|
|
318
|
+
exports.getAllContentItems = getAllContentItems;
|
|
319
|
+
exports.getAllContentTypes = getAllContentTypes;
|
|
320
|
+
exports.getContentItemById = getContentItemById;
|
|
321
|
+
exports.getContentItemBySlug = getContentItemBySlug;
|
|
322
|
+
exports.getContentItemsByRelation = getContentItemsByRelation;
|
|
323
|
+
exports.getContentItemsByRelationForType = getContentItemsByRelationForType;
|
|
324
|
+
exports.migrateToUnifiedSchema = migrateToUnifiedSchema;
|
|
325
|
+
exports.serializeContentItem = serializeContentItem;
|
|
326
|
+
exports.serializeContentItemWithType = serializeContentItemWithType;
|
|
327
|
+
exports.serializeContentType = serializeContentType;
|
|
328
|
+
exports.validateContentReadOptions = validateContentReadOptions;
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
import { DEFAULT_MAX_PAGE_SIZE, contentReadOptionsSchema, normalizeContentFields } from '../schemas.mjs';
|
|
2
|
+
|
|
3
|
+
class CMSContentSelectionError extends Error {
|
|
4
|
+
}
|
|
5
|
+
function validateContentReadOptions(contentType, options) {
|
|
6
|
+
contentReadOptionsSchema.parse(options ?? {});
|
|
7
|
+
if (options?.fields === void 0) return;
|
|
8
|
+
if (options.view !== "content") {
|
|
9
|
+
throw new CMSContentSelectionError("fields requires view: content");
|
|
10
|
+
}
|
|
11
|
+
const properties = contentType ? JSON.parse(contentType.jsonSchema).properties : void 0;
|
|
12
|
+
for (const field of options.fields) {
|
|
13
|
+
if (!properties || !Object.hasOwn(properties, field)) {
|
|
14
|
+
throw new CMSContentSelectionError(
|
|
15
|
+
`Unknown top-level content field: ${field}`
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function applyContentReadOptions(item, options) {
|
|
21
|
+
const result = options?.view === "content" ? {
|
|
22
|
+
id: item.id,
|
|
23
|
+
slug: item.slug,
|
|
24
|
+
parsedData: options.fields ? Object.fromEntries(
|
|
25
|
+
normalizeContentFields(options.fields).filter((field) => Object.hasOwn(item.parsedData, field)).map((field) => [
|
|
26
|
+
field,
|
|
27
|
+
item.parsedData[field]
|
|
28
|
+
])
|
|
29
|
+
) : item.parsedData,
|
|
30
|
+
createdAt: item.createdAt,
|
|
31
|
+
updatedAt: item.updatedAt
|
|
32
|
+
} : item;
|
|
33
|
+
return result;
|
|
34
|
+
}
|
|
35
|
+
function serializeContentType(ct) {
|
|
36
|
+
const needsMigration = !ct.autoFormVersion || ct.autoFormVersion < 2;
|
|
37
|
+
const migratedJsonSchema = needsMigration ? migrateToUnifiedSchema(ct.jsonSchema, ct.fieldConfig) : ct.jsonSchema;
|
|
38
|
+
return {
|
|
39
|
+
id: ct.id,
|
|
40
|
+
name: ct.name,
|
|
41
|
+
slug: ct.slug,
|
|
42
|
+
description: ct.description,
|
|
43
|
+
jsonSchema: migratedJsonSchema,
|
|
44
|
+
createdAt: ct.createdAt.toISOString(),
|
|
45
|
+
updatedAt: ct.updatedAt.toISOString()
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function migrateToUnifiedSchema(jsonSchemaStr, fieldConfigStr) {
|
|
49
|
+
if (!fieldConfigStr) return jsonSchemaStr;
|
|
50
|
+
try {
|
|
51
|
+
const jsonSchema = JSON.parse(jsonSchemaStr);
|
|
52
|
+
const fieldConfig = JSON.parse(fieldConfigStr);
|
|
53
|
+
if (!jsonSchema.properties || typeof fieldConfig !== "object") {
|
|
54
|
+
return jsonSchemaStr;
|
|
55
|
+
}
|
|
56
|
+
for (const [key, config] of Object.entries(fieldConfig)) {
|
|
57
|
+
if (jsonSchema.properties[key] && typeof config === "object" && config !== null && "fieldType" in config) {
|
|
58
|
+
jsonSchema.properties[key].fieldType = config.fieldType;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return JSON.stringify(jsonSchema);
|
|
62
|
+
} catch {
|
|
63
|
+
return jsonSchemaStr;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function serializeContentItem(item) {
|
|
67
|
+
return {
|
|
68
|
+
...item,
|
|
69
|
+
createdAt: item.createdAt.toISOString(),
|
|
70
|
+
updatedAt: item.updatedAt.toISOString()
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function serializeContentItemWithType(item) {
|
|
74
|
+
const parsedData = JSON.parse(item.data);
|
|
75
|
+
return {
|
|
76
|
+
...serializeContentItem(item),
|
|
77
|
+
parsedData,
|
|
78
|
+
contentType: item.contentType ? serializeContentType(item.contentType) : void 0
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
async function getAllContentTypes(adapter) {
|
|
82
|
+
const contentTypes = await adapter.findMany({
|
|
83
|
+
model: "contentType",
|
|
84
|
+
sortBy: { field: "name", direction: "asc" }
|
|
85
|
+
});
|
|
86
|
+
return contentTypes.map(serializeContentType);
|
|
87
|
+
}
|
|
88
|
+
function contentItemMatchesSearch(item, searchLower) {
|
|
89
|
+
if (item.slug.toLowerCase().includes(searchLower)) return true;
|
|
90
|
+
const matchesValue = (value) => typeof value === "string" && value.toLowerCase().includes(searchLower);
|
|
91
|
+
return Object.values(item.parsedData).some((value) => {
|
|
92
|
+
if (matchesValue(value)) return true;
|
|
93
|
+
if (Array.isArray(value)) return value.some(matchesValue);
|
|
94
|
+
if (typeof value === "object" && value !== null) {
|
|
95
|
+
return Object.values(value).some(matchesValue);
|
|
96
|
+
}
|
|
97
|
+
return false;
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
async function getAllContentItems(adapter, contentTypeSlug, params) {
|
|
101
|
+
const contentType = await adapter.findOne({
|
|
102
|
+
model: "contentType",
|
|
103
|
+
where: [
|
|
104
|
+
{
|
|
105
|
+
field: "slug",
|
|
106
|
+
value: contentTypeSlug,
|
|
107
|
+
operator: "eq"
|
|
108
|
+
}
|
|
109
|
+
]
|
|
110
|
+
});
|
|
111
|
+
if (!contentType) {
|
|
112
|
+
return {
|
|
113
|
+
items: [],
|
|
114
|
+
total: 0,
|
|
115
|
+
limit: params?.limit,
|
|
116
|
+
offset: params?.offset
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
validateContentReadOptions(contentType, params);
|
|
120
|
+
const whereConditions = [
|
|
121
|
+
{
|
|
122
|
+
field: "contentTypeId",
|
|
123
|
+
value: contentType.id,
|
|
124
|
+
operator: "eq"
|
|
125
|
+
}
|
|
126
|
+
];
|
|
127
|
+
if (params?.slug) {
|
|
128
|
+
whereConditions.push({
|
|
129
|
+
field: "slug",
|
|
130
|
+
value: params.slug,
|
|
131
|
+
operator: "eq"
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
const search = params?.search?.trim();
|
|
135
|
+
const needsInMemoryFilter = !!search;
|
|
136
|
+
const dbTotal = !needsInMemoryFilter ? await adapter.count({
|
|
137
|
+
model: "contentItem",
|
|
138
|
+
where: whereConditions
|
|
139
|
+
}) : void 0;
|
|
140
|
+
const items = await adapter.findMany({
|
|
141
|
+
model: "contentItem",
|
|
142
|
+
where: whereConditions,
|
|
143
|
+
limit: !needsInMemoryFilter ? params?.limit : DEFAULT_MAX_PAGE_SIZE,
|
|
144
|
+
offset: !needsInMemoryFilter ? params?.offset : void 0,
|
|
145
|
+
sortBy: { field: "createdAt", direction: "desc" },
|
|
146
|
+
join: { contentType: true }
|
|
147
|
+
});
|
|
148
|
+
let result = items.map(serializeContentItemWithType);
|
|
149
|
+
if (needsInMemoryFilter) {
|
|
150
|
+
const searchLower = search.toLowerCase();
|
|
151
|
+
result = result.filter(
|
|
152
|
+
(item) => contentItemMatchesSearch(item, searchLower)
|
|
153
|
+
);
|
|
154
|
+
const total = result.length;
|
|
155
|
+
const offset = params?.offset ?? 0;
|
|
156
|
+
const limit = params?.limit;
|
|
157
|
+
result = result.slice(
|
|
158
|
+
offset,
|
|
159
|
+
limit !== void 0 ? offset + limit : void 0
|
|
160
|
+
);
|
|
161
|
+
return {
|
|
162
|
+
items: result.map((item) => applyContentReadOptions(item, params)),
|
|
163
|
+
total,
|
|
164
|
+
limit: params?.limit,
|
|
165
|
+
offset: params?.offset
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
return {
|
|
169
|
+
items: result.map((item) => applyContentReadOptions(item, params)),
|
|
170
|
+
total: dbTotal ?? result.length,
|
|
171
|
+
limit: params?.limit,
|
|
172
|
+
offset: params?.offset
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
async function getContentItemById(adapter, id, options) {
|
|
176
|
+
const item = await adapter.findOne({
|
|
177
|
+
model: "contentItem",
|
|
178
|
+
where: [{ field: "id", value: id, operator: "eq" }],
|
|
179
|
+
join: { contentType: true }
|
|
180
|
+
});
|
|
181
|
+
if (!item) return null;
|
|
182
|
+
validateContentReadOptions(item.contentType, options);
|
|
183
|
+
return applyContentReadOptions(serializeContentItemWithType(item), options);
|
|
184
|
+
}
|
|
185
|
+
async function getContentItemBySlug(adapter, contentTypeSlug, slug, options) {
|
|
186
|
+
const contentType = await adapter.findOne({
|
|
187
|
+
model: "contentType",
|
|
188
|
+
where: [
|
|
189
|
+
{
|
|
190
|
+
field: "slug",
|
|
191
|
+
value: contentTypeSlug,
|
|
192
|
+
operator: "eq"
|
|
193
|
+
}
|
|
194
|
+
]
|
|
195
|
+
});
|
|
196
|
+
if (!contentType) {
|
|
197
|
+
return null;
|
|
198
|
+
}
|
|
199
|
+
validateContentReadOptions(contentType, options);
|
|
200
|
+
const item = await adapter.findOne({
|
|
201
|
+
model: "contentItem",
|
|
202
|
+
where: [
|
|
203
|
+
{
|
|
204
|
+
field: "contentTypeId",
|
|
205
|
+
value: contentType.id,
|
|
206
|
+
operator: "eq"
|
|
207
|
+
},
|
|
208
|
+
{ field: "slug", value: slug, operator: "eq" }
|
|
209
|
+
],
|
|
210
|
+
join: { contentType: true }
|
|
211
|
+
});
|
|
212
|
+
if (!item) {
|
|
213
|
+
return null;
|
|
214
|
+
}
|
|
215
|
+
return applyContentReadOptions(serializeContentItemWithType(item), options);
|
|
216
|
+
}
|
|
217
|
+
async function getContentItemsByRelation(adapter, contentTypeSlug, params) {
|
|
218
|
+
const contentType = await adapter.findOne({
|
|
219
|
+
model: "contentType",
|
|
220
|
+
where: [{ field: "slug", value: contentTypeSlug, operator: "eq" }]
|
|
221
|
+
});
|
|
222
|
+
if (!contentType) {
|
|
223
|
+
return {
|
|
224
|
+
items: [],
|
|
225
|
+
total: 0,
|
|
226
|
+
limit: params.limit ?? 20,
|
|
227
|
+
offset: params.offset ?? 0
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
validateContentReadOptions(contentType, params);
|
|
231
|
+
const result = await getContentItemsByRelationForType(
|
|
232
|
+
adapter,
|
|
233
|
+
contentType,
|
|
234
|
+
params
|
|
235
|
+
);
|
|
236
|
+
return {
|
|
237
|
+
...result,
|
|
238
|
+
items: result.items.map((item) => applyContentReadOptions(item, params))
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
async function getContentItemsByRelationForType(adapter, contentType, params) {
|
|
242
|
+
const limit = params.limit ?? 20;
|
|
243
|
+
const offset = params.offset ?? 0;
|
|
244
|
+
const batchSize = 100;
|
|
245
|
+
const sourceIds = /* @__PURE__ */ new Set();
|
|
246
|
+
for (let relationOffset = 0; ; relationOffset += batchSize) {
|
|
247
|
+
const relations = await adapter.findMany(
|
|
248
|
+
{
|
|
249
|
+
model: "contentRelation",
|
|
250
|
+
where: [
|
|
251
|
+
{ field: "targetId", value: params.targetId, operator: "eq" },
|
|
252
|
+
{ field: "fieldName", value: params.field, operator: "eq" }
|
|
253
|
+
],
|
|
254
|
+
select: ["sourceId"],
|
|
255
|
+
limit: batchSize,
|
|
256
|
+
offset: relationOffset,
|
|
257
|
+
sortBy: { field: "id", direction: "asc" }
|
|
258
|
+
}
|
|
259
|
+
);
|
|
260
|
+
for (const relation of relations) sourceIds.add(relation.sourceId);
|
|
261
|
+
if (relations.length < batchSize) break;
|
|
262
|
+
}
|
|
263
|
+
const ids = [...sourceIds];
|
|
264
|
+
const metadata = [];
|
|
265
|
+
for (let start = 0; start < ids.length; start += batchSize) {
|
|
266
|
+
metadata.push(
|
|
267
|
+
...await adapter.findMany({
|
|
268
|
+
model: "contentItem",
|
|
269
|
+
where: [
|
|
270
|
+
{
|
|
271
|
+
field: "id",
|
|
272
|
+
value: ids.slice(start, start + batchSize),
|
|
273
|
+
operator: "in"
|
|
274
|
+
},
|
|
275
|
+
{ field: "contentTypeId", value: contentType.id, operator: "eq" }
|
|
276
|
+
],
|
|
277
|
+
select: ["id", "createdAt"],
|
|
278
|
+
limit: batchSize
|
|
279
|
+
})
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
metadata.sort(
|
|
283
|
+
(left, right) => right.createdAt.getTime() - left.createdAt.getTime() || (left.id < right.id ? 1 : left.id > right.id ? -1 : 0)
|
|
284
|
+
);
|
|
285
|
+
const pageIds = metadata.slice(offset, offset + limit).map((item) => item.id);
|
|
286
|
+
const itemsById = /* @__PURE__ */ new Map();
|
|
287
|
+
for (let start = 0; start < pageIds.length; start += batchSize) {
|
|
288
|
+
const items = await adapter.findMany({
|
|
289
|
+
model: "contentItem",
|
|
290
|
+
where: [
|
|
291
|
+
{
|
|
292
|
+
field: "id",
|
|
293
|
+
value: pageIds.slice(start, start + batchSize),
|
|
294
|
+
operator: "in"
|
|
295
|
+
},
|
|
296
|
+
{ field: "contentTypeId", value: contentType.id, operator: "eq" }
|
|
297
|
+
],
|
|
298
|
+
limit: batchSize,
|
|
299
|
+
join: { contentType: true }
|
|
300
|
+
});
|
|
301
|
+
for (const item of items) itemsById.set(item.id, item);
|
|
302
|
+
}
|
|
303
|
+
return {
|
|
304
|
+
items: pageIds.flatMap((id) => {
|
|
305
|
+
const item = itemsById.get(id);
|
|
306
|
+
return item ? [serializeContentItemWithType(item)] : [];
|
|
307
|
+
}),
|
|
308
|
+
total: metadata.length,
|
|
309
|
+
limit,
|
|
310
|
+
offset
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
export { CMSContentSelectionError, applyContentReadOptions, getAllContentItems, getAllContentTypes, getContentItemById, getContentItemBySlug, getContentItemsByRelation, getContentItemsByRelationForType, migrateToUnifiedSchema, serializeContentItem, serializeContentItemWithType, serializeContentType, validateContentReadOptions };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const plugin = require('./plugin.cjs');
|
|
4
|
+
const getters = require('./getters.cjs');
|
|
5
|
+
const mutations = require('./mutations.cjs');
|
|
6
|
+
const queryKeyDefs = require('./query-key-defs.cjs');
|
|
7
|
+
const queryKeys = require('../query-keys.cjs');
|
|
8
|
+
const operations = require('./operations.cjs');
|
|
9
|
+
const lifecycleMigrations = require('./lifecycle-migrations.cjs');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
exports.cmsBackendPlugin = plugin.cmsBackendPlugin;
|
|
14
|
+
exports.getAllContentItems = getters.getAllContentItems;
|
|
15
|
+
exports.getAllContentTypes = getters.getAllContentTypes;
|
|
16
|
+
exports.getContentItemById = getters.getContentItemById;
|
|
17
|
+
exports.getContentItemBySlug = getters.getContentItemBySlug;
|
|
18
|
+
exports.getContentItemsByRelation = getters.getContentItemsByRelation;
|
|
19
|
+
exports.serializeContentItem = getters.serializeContentItem;
|
|
20
|
+
exports.serializeContentItemWithType = getters.serializeContentItemWithType;
|
|
21
|
+
exports.serializeContentType = getters.serializeContentType;
|
|
22
|
+
exports.createCMSContentItem = mutations.createCMSContentItem;
|
|
23
|
+
exports.CMS_QUERY_KEYS = queryKeyDefs.CMS_QUERY_KEYS;
|
|
24
|
+
exports.createCMSQueryKeys = queryKeys.createCMSQueryKeys;
|
|
25
|
+
exports.CMSContentItemParamsSchema = operations.CMSContentItemParamsSchema;
|
|
26
|
+
exports.CMSContentTypeParamsSchema = operations.CMSContentTypeParamsSchema;
|
|
27
|
+
exports.CMSCreateContentItemBodySchema = operations.CMSCreateContentItemBodySchema;
|
|
28
|
+
exports.CMSUpdateContentItemBodySchema = operations.CMSUpdateContentItemBodySchema;
|
|
29
|
+
exports.CMS_LIFECYCLE_HOOK_MIGRATIONS = lifecycleMigrations.CMS_LIFECYCLE_HOOK_MIGRATIONS;
|