@btst/plugin-cms 1.0.0 → 1.2.0-beta.1
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/dist/api/getters.cjs +37 -25
- package/dist/api/getters.mjs +37 -25
- package/dist/api/index.cjs +1 -0
- package/dist/api/index.d.cts +17 -8
- package/dist/api/index.d.mts +17 -8
- package/dist/api/index.d.ts +17 -8
- package/dist/api/index.mjs +1 -1
- package/dist/api/mutations.cjs +46 -19
- package/dist/api/mutations.mjs +46 -20
- package/dist/api/operations.cjs +586 -177
- package/dist/api/operations.mjs +585 -178
- package/dist/api/plugin.cjs +56 -7
- package/dist/api/plugin.mjs +57 -8
- package/dist/api/publication.cjs +8 -0
- package/dist/api/publication.mjs +6 -0
- package/dist/client/components/forms/content-form.cjs +107 -1
- package/dist/client/components/forms/content-form.mjs +108 -2
- package/dist/client/components/pages/content-editor-page.internal.cjs +23 -5
- package/dist/client/components/pages/content-editor-page.internal.mjs +23 -5
- package/dist/client/components/pages/content-list-page.internal.cjs +3 -0
- package/dist/client/components/pages/content-list-page.internal.mjs +3 -0
- package/dist/client/components/pages/dashboard-page.internal.cjs +10 -30
- package/dist/client/components/pages/dashboard-page.internal.mjs +10 -30
- package/dist/client/components/revision-history.cjs +161 -0
- package/dist/client/components/revision-history.mjs +159 -0
- package/dist/client/components/shared/content-type-card.cjs +56 -0
- package/dist/client/components/shared/content-type-card.mjs +54 -0
- package/dist/client/components/shared/empty-state.cjs +18 -1
- package/dist/client/components/shared/empty-state.mjs +19 -2
- package/dist/client/hooks/cms-hooks.cjs +18 -2
- package/dist/client/hooks/cms-hooks.mjs +17 -3
- package/dist/client/hooks/index.cjs +2 -0
- package/dist/client/hooks/index.d.cts +306 -2
- package/dist/client/hooks/index.d.mts +306 -2
- package/dist/client/hooks/index.d.ts +306 -2
- package/dist/client/hooks/index.mjs +1 -1
- package/dist/client/index.d.cts +55 -2
- package/dist/client/index.d.mts +55 -2
- package/dist/client/index.d.ts +55 -2
- package/dist/db.cjs +25 -0
- package/dist/db.mjs +25 -0
- package/dist/permissions.cjs +2 -0
- package/dist/permissions.d.cts +1 -0
- package/dist/permissions.d.mts +1 -0
- package/dist/permissions.d.ts +1 -0
- package/dist/permissions.mjs +2 -0
- package/dist/query-keys.cjs +31 -1
- package/dist/query-keys.d.cts +1 -1
- package/dist/query-keys.d.mts +1 -1
- package/dist/query-keys.d.ts +1 -1
- package/dist/query-keys.mjs +31 -1
- package/dist/shared/{plugin-cms.W4Le8D91.d.mts → plugin-cms.DAAUZ41w.d.mts} +377 -144
- package/dist/shared/{plugin-cms.c-GeWvTf.d.cts → plugin-cms.DJ_293QU.d.cts} +377 -144
- package/dist/shared/{plugin-cms.DQLAoogy.d.ts → plugin-cms.DlUSv7wz.d.ts} +377 -144
- package/dist/types.d.cts +38 -2
- package/dist/types.d.mts +38 -2
- package/dist/types.d.ts +38 -2
- package/dist/ui/src/components/auto-form/config.cjs +2 -0
- package/dist/ui/src/components/auto-form/config.mjs +2 -0
- package/dist/ui/src/components/auto-form/fields/file.cjs +68 -0
- package/dist/ui/src/components/auto-form/fields/file.mjs +63 -0
- package/dist/ui/src/components/auto-form/fields/object.cjs +9 -2
- package/dist/ui/src/components/auto-form/fields/object.mjs +9 -2
- package/dist/ui/src/components/auto-form/helpers.cjs +9 -0
- package/dist/ui/src/components/auto-form/helpers.mjs +9 -0
- package/dist/ui/src/components/auto-form/index.cjs +29 -4
- package/dist/ui/src/components/auto-form/index.mjs +31 -6
- package/dist/ui/src/components/auto-form/stepped-auto-form.cjs +34 -29
- package/dist/ui/src/components/auto-form/stepped-auto-form.mjs +35 -30
- package/dist/ui/src/components/sheet.cjs +126 -0
- package/dist/ui/src/components/sheet.mjs +105 -0
- package/dist/ui/src/lib/form-visibility.cjs +20 -0
- package/dist/ui/src/lib/form-visibility.mjs +18 -0
- package/dist/ui/src/lib/schema-converter.cjs +101 -0
- package/dist/ui/src/lib/schema-converter.mjs +100 -1
- package/package.json +5 -4
package/dist/api/getters.cjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const publication = require('./publication.cjs');
|
|
3
4
|
const schemas = require('../schemas.cjs');
|
|
4
5
|
|
|
5
6
|
class CMSContentSelectionError extends Error {
|
|
@@ -68,6 +69,7 @@ function migrateToUnifiedSchema(jsonSchemaStr, fieldConfigStr) {
|
|
|
68
69
|
function serializeContentItem(item) {
|
|
69
70
|
return {
|
|
70
71
|
...item,
|
|
72
|
+
publishAt: item.publishAt?.toISOString() ?? null,
|
|
71
73
|
createdAt: item.createdAt.toISOString(),
|
|
72
74
|
updatedAt: item.updatedAt.toISOString()
|
|
73
75
|
};
|
|
@@ -99,7 +101,7 @@ function contentItemMatchesSearch(item, searchLower) {
|
|
|
99
101
|
return false;
|
|
100
102
|
});
|
|
101
103
|
}
|
|
102
|
-
async function getAllContentItems(adapter, contentTypeSlug, params) {
|
|
104
|
+
async function getAllContentItems(adapter, contentTypeSlug, params, publication$1) {
|
|
103
105
|
const contentType = await adapter.findOne({
|
|
104
106
|
model: "contentType",
|
|
105
107
|
where: [
|
|
@@ -134,24 +136,29 @@ async function getAllContentItems(adapter, contentTypeSlug, params) {
|
|
|
134
136
|
});
|
|
135
137
|
}
|
|
136
138
|
const search = params?.search?.trim();
|
|
137
|
-
const needsInMemoryFilter = !!search;
|
|
139
|
+
const needsInMemoryFilter = !!search || !!publication$1;
|
|
138
140
|
const dbTotal = !needsInMemoryFilter ? await adapter.count({
|
|
139
141
|
model: "contentItem",
|
|
140
142
|
where: whereConditions
|
|
141
143
|
}) : void 0;
|
|
142
|
-
const items =
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
144
|
+
const items = [];
|
|
145
|
+
for (let scanOffset = 0; ; scanOffset += schemas.DEFAULT_MAX_PAGE_SIZE) {
|
|
146
|
+
const batch = await adapter.findMany({
|
|
147
|
+
model: "contentItem",
|
|
148
|
+
where: whereConditions,
|
|
149
|
+
limit: !needsInMemoryFilter ? params?.limit : schemas.DEFAULT_MAX_PAGE_SIZE,
|
|
150
|
+
offset: needsInMemoryFilter ? scanOffset : params?.offset,
|
|
151
|
+
sortBy: { field: "createdAt", direction: "desc" },
|
|
152
|
+
join: { contentType: true }
|
|
153
|
+
});
|
|
154
|
+
items.push(...batch);
|
|
155
|
+
if (!publication$1 || batch.length < schemas.DEFAULT_MAX_PAGE_SIZE) break;
|
|
156
|
+
}
|
|
157
|
+
let result = items.filter((item) => !publication$1 || publication.isPublishedContent(item, publication$1)).map(serializeContentItemWithType);
|
|
151
158
|
if (needsInMemoryFilter) {
|
|
152
|
-
const searchLower = search
|
|
159
|
+
const searchLower = search?.toLowerCase();
|
|
153
160
|
result = result.filter(
|
|
154
|
-
(item) => contentItemMatchesSearch(item, searchLower)
|
|
161
|
+
(item) => !searchLower || contentItemMatchesSearch(item, searchLower)
|
|
155
162
|
);
|
|
156
163
|
const total = result.length;
|
|
157
164
|
const offset = params?.offset ?? 0;
|
|
@@ -174,17 +181,18 @@ async function getAllContentItems(adapter, contentTypeSlug, params) {
|
|
|
174
181
|
offset: params?.offset
|
|
175
182
|
};
|
|
176
183
|
}
|
|
177
|
-
async function getContentItemById(adapter, id, options) {
|
|
184
|
+
async function getContentItemById(adapter, id, options, publication$1) {
|
|
178
185
|
const item = await adapter.findOne({
|
|
179
186
|
model: "contentItem",
|
|
180
187
|
where: [{ field: "id", value: id, operator: "eq" }],
|
|
181
188
|
join: { contentType: true }
|
|
182
189
|
});
|
|
183
|
-
if (!item
|
|
190
|
+
if (!item || publication$1 && !publication.isPublishedContent(item, publication$1))
|
|
191
|
+
return null;
|
|
184
192
|
validateContentReadOptions(item.contentType, options);
|
|
185
193
|
return applyContentReadOptions(serializeContentItemWithType(item), options);
|
|
186
194
|
}
|
|
187
|
-
async function getContentItemBySlug(adapter, contentTypeSlug, slug, options) {
|
|
195
|
+
async function getContentItemBySlug(adapter, contentTypeSlug, slug, options, publication$1) {
|
|
188
196
|
const contentType = await adapter.findOne({
|
|
189
197
|
model: "contentType",
|
|
190
198
|
where: [
|
|
@@ -211,12 +219,12 @@ async function getContentItemBySlug(adapter, contentTypeSlug, slug, options) {
|
|
|
211
219
|
],
|
|
212
220
|
join: { contentType: true }
|
|
213
221
|
});
|
|
214
|
-
if (!item) {
|
|
222
|
+
if (!item || publication$1 && !publication.isPublishedContent(item, publication$1)) {
|
|
215
223
|
return null;
|
|
216
224
|
}
|
|
217
225
|
return applyContentReadOptions(serializeContentItemWithType(item), options);
|
|
218
226
|
}
|
|
219
|
-
async function getContentItemsByRelation(adapter, contentTypeSlug, params) {
|
|
227
|
+
async function getContentItemsByRelation(adapter, contentTypeSlug, params, publication) {
|
|
220
228
|
const contentType = await adapter.findOne({
|
|
221
229
|
model: "contentType",
|
|
222
230
|
where: [{ field: "slug", value: contentTypeSlug, operator: "eq" }]
|
|
@@ -233,14 +241,15 @@ async function getContentItemsByRelation(adapter, contentTypeSlug, params) {
|
|
|
233
241
|
const result = await getContentItemsByRelationForType(
|
|
234
242
|
adapter,
|
|
235
243
|
contentType,
|
|
236
|
-
params
|
|
244
|
+
params,
|
|
245
|
+
publication
|
|
237
246
|
);
|
|
238
247
|
return {
|
|
239
248
|
...result,
|
|
240
249
|
items: result.items.map((item) => applyContentReadOptions(item, params))
|
|
241
250
|
};
|
|
242
251
|
}
|
|
243
|
-
async function getContentItemsByRelationForType(adapter, contentType, params) {
|
|
252
|
+
async function getContentItemsByRelationForType(adapter, contentType, params, publication$1) {
|
|
244
253
|
const limit = params.limit ?? 20;
|
|
245
254
|
const offset = params.offset ?? 0;
|
|
246
255
|
const batchSize = 100;
|
|
@@ -276,15 +285,18 @@ async function getContentItemsByRelationForType(adapter, contentType, params) {
|
|
|
276
285
|
},
|
|
277
286
|
{ field: "contentTypeId", value: contentType.id, operator: "eq" }
|
|
278
287
|
],
|
|
279
|
-
select: ["id", "createdAt"],
|
|
288
|
+
select: publication$1 ? ["id", "createdAt", "data", "publishAt"] : ["id", "createdAt"],
|
|
280
289
|
limit: batchSize
|
|
281
290
|
})
|
|
282
291
|
);
|
|
283
292
|
}
|
|
284
|
-
metadata.
|
|
293
|
+
const visibleMetadata = metadata.filter(
|
|
294
|
+
(item) => !publication$1 || "data" in item && publication.isPublishedContent(item, publication$1)
|
|
295
|
+
);
|
|
296
|
+
visibleMetadata.sort(
|
|
285
297
|
(left, right) => right.createdAt.getTime() - left.createdAt.getTime() || (left.id < right.id ? 1 : left.id > right.id ? -1 : 0)
|
|
286
298
|
);
|
|
287
|
-
const pageIds =
|
|
299
|
+
const pageIds = visibleMetadata.slice(offset, offset + limit).map((item) => item.id);
|
|
288
300
|
const itemsById = /* @__PURE__ */ new Map();
|
|
289
301
|
for (let start = 0; start < pageIds.length; start += batchSize) {
|
|
290
302
|
const items = await adapter.findMany({
|
|
@@ -305,9 +317,9 @@ async function getContentItemsByRelationForType(adapter, contentType, params) {
|
|
|
305
317
|
return {
|
|
306
318
|
items: pageIds.flatMap((id) => {
|
|
307
319
|
const item = itemsById.get(id);
|
|
308
|
-
return item ? [serializeContentItemWithType(item)] : [];
|
|
320
|
+
return item && (!publication$1 || publication.isPublishedContent(item, publication$1)) ? [serializeContentItemWithType(item)] : [];
|
|
309
321
|
}),
|
|
310
|
-
total:
|
|
322
|
+
total: visibleMetadata.length,
|
|
311
323
|
limit,
|
|
312
324
|
offset
|
|
313
325
|
};
|
package/dist/api/getters.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isPublishedContent } from './publication.mjs';
|
|
1
2
|
import { DEFAULT_MAX_PAGE_SIZE, contentReadOptionsSchema, normalizeContentFields } from '../schemas.mjs';
|
|
2
3
|
|
|
3
4
|
class CMSContentSelectionError extends Error {
|
|
@@ -66,6 +67,7 @@ function migrateToUnifiedSchema(jsonSchemaStr, fieldConfigStr) {
|
|
|
66
67
|
function serializeContentItem(item) {
|
|
67
68
|
return {
|
|
68
69
|
...item,
|
|
70
|
+
publishAt: item.publishAt?.toISOString() ?? null,
|
|
69
71
|
createdAt: item.createdAt.toISOString(),
|
|
70
72
|
updatedAt: item.updatedAt.toISOString()
|
|
71
73
|
};
|
|
@@ -97,7 +99,7 @@ function contentItemMatchesSearch(item, searchLower) {
|
|
|
97
99
|
return false;
|
|
98
100
|
});
|
|
99
101
|
}
|
|
100
|
-
async function getAllContentItems(adapter, contentTypeSlug, params) {
|
|
102
|
+
async function getAllContentItems(adapter, contentTypeSlug, params, publication) {
|
|
101
103
|
const contentType = await adapter.findOne({
|
|
102
104
|
model: "contentType",
|
|
103
105
|
where: [
|
|
@@ -132,24 +134,29 @@ async function getAllContentItems(adapter, contentTypeSlug, params) {
|
|
|
132
134
|
});
|
|
133
135
|
}
|
|
134
136
|
const search = params?.search?.trim();
|
|
135
|
-
const needsInMemoryFilter = !!search;
|
|
137
|
+
const needsInMemoryFilter = !!search || !!publication;
|
|
136
138
|
const dbTotal = !needsInMemoryFilter ? await adapter.count({
|
|
137
139
|
model: "contentItem",
|
|
138
140
|
where: whereConditions
|
|
139
141
|
}) : void 0;
|
|
140
|
-
const items =
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
142
|
+
const items = [];
|
|
143
|
+
for (let scanOffset = 0; ; scanOffset += DEFAULT_MAX_PAGE_SIZE) {
|
|
144
|
+
const batch = await adapter.findMany({
|
|
145
|
+
model: "contentItem",
|
|
146
|
+
where: whereConditions,
|
|
147
|
+
limit: !needsInMemoryFilter ? params?.limit : DEFAULT_MAX_PAGE_SIZE,
|
|
148
|
+
offset: needsInMemoryFilter ? scanOffset : params?.offset,
|
|
149
|
+
sortBy: { field: "createdAt", direction: "desc" },
|
|
150
|
+
join: { contentType: true }
|
|
151
|
+
});
|
|
152
|
+
items.push(...batch);
|
|
153
|
+
if (!publication || batch.length < DEFAULT_MAX_PAGE_SIZE) break;
|
|
154
|
+
}
|
|
155
|
+
let result = items.filter((item) => !publication || isPublishedContent(item, publication)).map(serializeContentItemWithType);
|
|
149
156
|
if (needsInMemoryFilter) {
|
|
150
|
-
const searchLower = search
|
|
157
|
+
const searchLower = search?.toLowerCase();
|
|
151
158
|
result = result.filter(
|
|
152
|
-
(item) => contentItemMatchesSearch(item, searchLower)
|
|
159
|
+
(item) => !searchLower || contentItemMatchesSearch(item, searchLower)
|
|
153
160
|
);
|
|
154
161
|
const total = result.length;
|
|
155
162
|
const offset = params?.offset ?? 0;
|
|
@@ -172,17 +179,18 @@ async function getAllContentItems(adapter, contentTypeSlug, params) {
|
|
|
172
179
|
offset: params?.offset
|
|
173
180
|
};
|
|
174
181
|
}
|
|
175
|
-
async function getContentItemById(adapter, id, options) {
|
|
182
|
+
async function getContentItemById(adapter, id, options, publication) {
|
|
176
183
|
const item = await adapter.findOne({
|
|
177
184
|
model: "contentItem",
|
|
178
185
|
where: [{ field: "id", value: id, operator: "eq" }],
|
|
179
186
|
join: { contentType: true }
|
|
180
187
|
});
|
|
181
|
-
if (!item
|
|
188
|
+
if (!item || publication && !isPublishedContent(item, publication))
|
|
189
|
+
return null;
|
|
182
190
|
validateContentReadOptions(item.contentType, options);
|
|
183
191
|
return applyContentReadOptions(serializeContentItemWithType(item), options);
|
|
184
192
|
}
|
|
185
|
-
async function getContentItemBySlug(adapter, contentTypeSlug, slug, options) {
|
|
193
|
+
async function getContentItemBySlug(adapter, contentTypeSlug, slug, options, publication) {
|
|
186
194
|
const contentType = await adapter.findOne({
|
|
187
195
|
model: "contentType",
|
|
188
196
|
where: [
|
|
@@ -209,12 +217,12 @@ async function getContentItemBySlug(adapter, contentTypeSlug, slug, options) {
|
|
|
209
217
|
],
|
|
210
218
|
join: { contentType: true }
|
|
211
219
|
});
|
|
212
|
-
if (!item) {
|
|
220
|
+
if (!item || publication && !isPublishedContent(item, publication)) {
|
|
213
221
|
return null;
|
|
214
222
|
}
|
|
215
223
|
return applyContentReadOptions(serializeContentItemWithType(item), options);
|
|
216
224
|
}
|
|
217
|
-
async function getContentItemsByRelation(adapter, contentTypeSlug, params) {
|
|
225
|
+
async function getContentItemsByRelation(adapter, contentTypeSlug, params, publication) {
|
|
218
226
|
const contentType = await adapter.findOne({
|
|
219
227
|
model: "contentType",
|
|
220
228
|
where: [{ field: "slug", value: contentTypeSlug, operator: "eq" }]
|
|
@@ -231,14 +239,15 @@ async function getContentItemsByRelation(adapter, contentTypeSlug, params) {
|
|
|
231
239
|
const result = await getContentItemsByRelationForType(
|
|
232
240
|
adapter,
|
|
233
241
|
contentType,
|
|
234
|
-
params
|
|
242
|
+
params,
|
|
243
|
+
publication
|
|
235
244
|
);
|
|
236
245
|
return {
|
|
237
246
|
...result,
|
|
238
247
|
items: result.items.map((item) => applyContentReadOptions(item, params))
|
|
239
248
|
};
|
|
240
249
|
}
|
|
241
|
-
async function getContentItemsByRelationForType(adapter, contentType, params) {
|
|
250
|
+
async function getContentItemsByRelationForType(adapter, contentType, params, publication) {
|
|
242
251
|
const limit = params.limit ?? 20;
|
|
243
252
|
const offset = params.offset ?? 0;
|
|
244
253
|
const batchSize = 100;
|
|
@@ -274,15 +283,18 @@ async function getContentItemsByRelationForType(adapter, contentType, params) {
|
|
|
274
283
|
},
|
|
275
284
|
{ field: "contentTypeId", value: contentType.id, operator: "eq" }
|
|
276
285
|
],
|
|
277
|
-
select: ["id", "createdAt"],
|
|
286
|
+
select: publication ? ["id", "createdAt", "data", "publishAt"] : ["id", "createdAt"],
|
|
278
287
|
limit: batchSize
|
|
279
288
|
})
|
|
280
289
|
);
|
|
281
290
|
}
|
|
282
|
-
metadata.
|
|
291
|
+
const visibleMetadata = metadata.filter(
|
|
292
|
+
(item) => !publication || "data" in item && isPublishedContent(item, publication)
|
|
293
|
+
);
|
|
294
|
+
visibleMetadata.sort(
|
|
283
295
|
(left, right) => right.createdAt.getTime() - left.createdAt.getTime() || (left.id < right.id ? 1 : left.id > right.id ? -1 : 0)
|
|
284
296
|
);
|
|
285
|
-
const pageIds =
|
|
297
|
+
const pageIds = visibleMetadata.slice(offset, offset + limit).map((item) => item.id);
|
|
286
298
|
const itemsById = /* @__PURE__ */ new Map();
|
|
287
299
|
for (let start = 0; start < pageIds.length; start += batchSize) {
|
|
288
300
|
const items = await adapter.findMany({
|
|
@@ -303,9 +315,9 @@ async function getContentItemsByRelationForType(adapter, contentType, params) {
|
|
|
303
315
|
return {
|
|
304
316
|
items: pageIds.flatMap((id) => {
|
|
305
317
|
const item = itemsById.get(id);
|
|
306
|
-
return item ? [serializeContentItemWithType(item)] : [];
|
|
318
|
+
return item && (!publication || isPublishedContent(item, publication)) ? [serializeContentItemWithType(item)] : [];
|
|
307
319
|
}),
|
|
308
|
-
total:
|
|
320
|
+
total: visibleMetadata.length,
|
|
309
321
|
limit,
|
|
310
322
|
offset
|
|
311
323
|
};
|
package/dist/api/index.cjs
CHANGED
|
@@ -20,6 +20,7 @@ exports.serializeContentItem = getters.serializeContentItem;
|
|
|
20
20
|
exports.serializeContentItemWithType = getters.serializeContentItemWithType;
|
|
21
21
|
exports.serializeContentType = getters.serializeContentType;
|
|
22
22
|
exports.createCMSContentItem = mutations.createCMSContentItem;
|
|
23
|
+
exports.recordContentRevision = mutations.recordContentRevision;
|
|
23
24
|
exports.CMS_QUERY_KEYS = queryKeyDefs.CMS_QUERY_KEYS;
|
|
24
25
|
exports.createCMSQueryKeys = queryKeys.createCMSQueryKeys;
|
|
25
26
|
exports.CMSContentItemParamsSchema = operations.CMSContentItemParamsSchema;
|
package/dist/api/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { C as CMSApiRouter, a as CMSRouteKey, b as CMS_QUERY_KEYS, c as cmsBackendPlugin, d as createCMSQueryKeys } from '../shared/plugin-cms.
|
|
1
|
+
export { C as CMSApiRouter, a as CMSRouteKey, b as CMS_QUERY_KEYS, c as cmsBackendPlugin, d as createCMSQueryKeys } from '../shared/plugin-cms.DJ_293QU.cjs';
|
|
2
|
+
import { CMSReadView, CMSContentFields, CMSReadOptions, CMSContentItemResult, CMSPublicationPolicy, SerializedContentType, ContentItem, SerializedContentItem, ContentItemWithType, SerializedContentItemWithType, ContentType, ContentRevision } from '../types.cjs';
|
|
3
|
+
export { CMSBackendConfig, CMSBackendHooks, CMSCreateOperationContext, CMSCreateResultContext, CMSDeleteOperationContext, CMSDeleteResultContext, CMSOperationErrorContext, CMSOperationLifecycleContext, CMSSelectedData, CMSUpdateOperationContext, CMSUpdateResultContext, ContentTypeConfig, PaginatedContentItems, SerializedContentItemContent, SerializedContentRevision } from '../types.cjs';
|
|
2
4
|
import { DBAdapter } from '@btst/db';
|
|
3
|
-
import { CMSReadView, CMSContentFields, CMSReadOptions, CMSContentItemResult, SerializedContentType, ContentItem, SerializedContentItem, ContentItemWithType, SerializedContentItemWithType, ContentType } from '../types.cjs';
|
|
4
|
-
export { CMSBackendConfig, CMSBackendHooks, CMSCreateOperationContext, CMSCreateResultContext, CMSDeleteOperationContext, CMSDeleteResultContext, CMSOperationErrorContext, CMSOperationLifecycleContext, CMSSelectedData, CMSUpdateOperationContext, CMSUpdateResultContext, ContentTypeConfig, PaginatedContentItems, SerializedContentItemContent } from '../types.cjs';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import '@btst/stack/plugins/client';
|
|
7
7
|
import '@btst/stack/authorization';
|
|
@@ -69,7 +69,7 @@ declare function getAllContentItems<TView extends CMSReadView = undefined, const
|
|
|
69
69
|
limit?: number;
|
|
70
70
|
offset?: number;
|
|
71
71
|
search?: string;
|
|
72
|
-
} & CMSReadOptions<TView, TFields
|
|
72
|
+
} & CMSReadOptions<TView, TFields>, publication?: CMSPublicationPolicy): Promise<{
|
|
73
73
|
items: CMSContentItemResult<Record<string, unknown>, TView, TFields>[];
|
|
74
74
|
total: number;
|
|
75
75
|
limit?: number;
|
|
@@ -86,7 +86,7 @@ declare function getAllContentItems<TView extends CMSReadView = undefined, const
|
|
|
86
86
|
* @param adapter - The database adapter
|
|
87
87
|
* @param id - The content item ID (UUID)
|
|
88
88
|
*/
|
|
89
|
-
declare function getContentItemById<TView extends CMSReadView = undefined, const TFields extends CMSContentFields = undefined>(adapter: DBAdapter, id: string, options?: CMSReadOptions<TView, TFields
|
|
89
|
+
declare function getContentItemById<TView extends CMSReadView = undefined, const TFields extends CMSContentFields = undefined>(adapter: DBAdapter, id: string, options?: CMSReadOptions<TView, TFields>, publication?: CMSPublicationPolicy): Promise<CMSContentItemResult<Record<string, unknown>, TView, TFields> | null>;
|
|
90
90
|
/**
|
|
91
91
|
* Retrieve a single content item by its slug within a content type.
|
|
92
92
|
* Returns null if the content type or item is not found.
|
|
@@ -99,7 +99,7 @@ declare function getContentItemById<TView extends CMSReadView = undefined, const
|
|
|
99
99
|
* @param contentTypeSlug - The slug of the content type
|
|
100
100
|
* @param slug - The slug of the content item
|
|
101
101
|
*/
|
|
102
|
-
declare function getContentItemBySlug<TView extends CMSReadView = undefined, const TFields extends CMSContentFields = undefined>(adapter: DBAdapter, contentTypeSlug: string, slug: string, options?: CMSReadOptions<TView, TFields
|
|
102
|
+
declare function getContentItemBySlug<TView extends CMSReadView = undefined, const TFields extends CMSContentFields = undefined>(adapter: DBAdapter, contentTypeSlug: string, slug: string, options?: CMSReadOptions<TView, TFields>, publication?: CMSPublicationPolicy): Promise<CMSContentItemResult<Record<string, unknown>, TView, TFields> | null>;
|
|
103
103
|
/** Parameters for a page of items referencing one relation target. */
|
|
104
104
|
interface ContentItemsByRelationParams<TView extends CMSReadView = CMSReadView, TFields extends CMSContentFields = CMSContentFields> extends CMSReadOptions<TView, TFields> {
|
|
105
105
|
/** Declared top-level relation field on the source content type. */
|
|
@@ -131,7 +131,7 @@ interface ContentItemsByRelationResult<TView extends CMSReadView = undefined, TF
|
|
|
131
131
|
* checks and pagination validation. Use `forRequest(request).operations.cms` for
|
|
132
132
|
* request work or trusted operations for validated, lifecycle-aware server work.
|
|
133
133
|
*/
|
|
134
|
-
declare function getContentItemsByRelation<TView extends CMSReadView = undefined, const TFields extends CMSContentFields = undefined>(adapter: DBAdapter, contentTypeSlug: string, params: ContentItemsByRelationParams<TView, TFields
|
|
134
|
+
declare function getContentItemsByRelation<TView extends CMSReadView = undefined, const TFields extends CMSContentFields = undefined>(adapter: DBAdapter, contentTypeSlug: string, params: ContentItemsByRelationParams<TView, TFields>, publication?: CMSPublicationPolicy): Promise<ContentItemsByRelationResult<TView, TFields>>;
|
|
135
135
|
|
|
136
136
|
declare const CMSContentTypeParamsSchema: z.ZodObject<{
|
|
137
137
|
slug: z.ZodString;
|
|
@@ -143,10 +143,12 @@ declare const CMSContentItemParamsSchema: z.ZodObject<{
|
|
|
143
143
|
declare const CMSCreateContentItemBodySchema: z.ZodObject<{
|
|
144
144
|
slug: z.ZodString;
|
|
145
145
|
data: z.ZodType<Record<string, any>, unknown, z.core.$ZodTypeInternals<Record<string, any>, unknown>>;
|
|
146
|
+
publishAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
146
147
|
}, z.core.$strip>;
|
|
147
148
|
declare const CMSUpdateContentItemBodySchema: z.ZodObject<{
|
|
148
149
|
slug: z.ZodOptional<z.ZodString>;
|
|
149
150
|
data: z.ZodOptional<z.ZodType<Record<string, any>, unknown, z.core.$ZodTypeInternals<Record<string, any>, unknown>>>;
|
|
151
|
+
publishAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
150
152
|
}, z.core.$strip>;
|
|
151
153
|
|
|
152
154
|
/**
|
|
@@ -157,7 +159,14 @@ interface CreateCMSContentItemInput {
|
|
|
157
159
|
slug: string;
|
|
158
160
|
/** Arbitrary data payload — should match the content type schema */
|
|
159
161
|
data: Record<string, unknown>;
|
|
162
|
+
/** Optional scheduled publication timestamp. */
|
|
163
|
+
publishAt?: Date | null;
|
|
160
164
|
}
|
|
165
|
+
/**
|
|
166
|
+
* Append a snapshot; caller owns authorization, validation, lifecycle hooks, and
|
|
167
|
+
* the transaction containing the item write. Revision rows are never updated.
|
|
168
|
+
*/
|
|
169
|
+
declare function recordContentRevision(adapter: Omit<DBAdapter, "transaction">, item: ContentItem, authorId?: string): Promise<ContentRevision>;
|
|
161
170
|
/**
|
|
162
171
|
* Options for {@link createCMSContentItem}.
|
|
163
172
|
*/
|
|
@@ -205,5 +214,5 @@ interface CreateCMSContentItemOptions {
|
|
|
205
214
|
*/
|
|
206
215
|
declare function createCMSContentItem(adapter: DBAdapter, contentTypeSlug: string, input: CreateCMSContentItemInput, options?: CreateCMSContentItemOptions): Promise<SerializedContentItem>;
|
|
207
216
|
|
|
208
|
-
export { CMSContentFields, CMSContentItemParamsSchema, CMSContentItemResult, CMSContentTypeParamsSchema, CMSCreateContentItemBodySchema, CMSReadOptions, CMSReadView, CMSUpdateContentItemBodySchema, CMS_LIFECYCLE_HOOK_MIGRATIONS, createCMSContentItem, getAllContentItems, getAllContentTypes, getContentItemById, getContentItemBySlug, getContentItemsByRelation, serializeContentItem, serializeContentItemWithType, serializeContentType };
|
|
217
|
+
export { CMSContentFields, CMSContentItemParamsSchema, CMSContentItemResult, CMSContentTypeParamsSchema, CMSCreateContentItemBodySchema, CMSPublicationPolicy, CMSReadOptions, CMSReadView, CMSUpdateContentItemBodySchema, CMS_LIFECYCLE_HOOK_MIGRATIONS, ContentRevision, createCMSContentItem, getAllContentItems, getAllContentTypes, getContentItemById, getContentItemBySlug, getContentItemsByRelation, recordContentRevision, serializeContentItem, serializeContentItemWithType, serializeContentType };
|
|
209
218
|
export type { ContentItemsByRelationParams, ContentItemsByRelationResult, CreateCMSContentItemInput, CreateCMSContentItemOptions };
|
package/dist/api/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { C as CMSApiRouter, a as CMSRouteKey, b as CMS_QUERY_KEYS, c as cmsBackendPlugin, d as createCMSQueryKeys } from '../shared/plugin-cms.
|
|
1
|
+
export { C as CMSApiRouter, a as CMSRouteKey, b as CMS_QUERY_KEYS, c as cmsBackendPlugin, d as createCMSQueryKeys } from '../shared/plugin-cms.DAAUZ41w.mjs';
|
|
2
|
+
import { CMSReadView, CMSContentFields, CMSReadOptions, CMSContentItemResult, CMSPublicationPolicy, SerializedContentType, ContentItem, SerializedContentItem, ContentItemWithType, SerializedContentItemWithType, ContentType, ContentRevision } from '../types.mjs';
|
|
3
|
+
export { CMSBackendConfig, CMSBackendHooks, CMSCreateOperationContext, CMSCreateResultContext, CMSDeleteOperationContext, CMSDeleteResultContext, CMSOperationErrorContext, CMSOperationLifecycleContext, CMSSelectedData, CMSUpdateOperationContext, CMSUpdateResultContext, ContentTypeConfig, PaginatedContentItems, SerializedContentItemContent, SerializedContentRevision } from '../types.mjs';
|
|
2
4
|
import { DBAdapter } from '@btst/db';
|
|
3
|
-
import { CMSReadView, CMSContentFields, CMSReadOptions, CMSContentItemResult, SerializedContentType, ContentItem, SerializedContentItem, ContentItemWithType, SerializedContentItemWithType, ContentType } from '../types.mjs';
|
|
4
|
-
export { CMSBackendConfig, CMSBackendHooks, CMSCreateOperationContext, CMSCreateResultContext, CMSDeleteOperationContext, CMSDeleteResultContext, CMSOperationErrorContext, CMSOperationLifecycleContext, CMSSelectedData, CMSUpdateOperationContext, CMSUpdateResultContext, ContentTypeConfig, PaginatedContentItems, SerializedContentItemContent } from '../types.mjs';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import '@btst/stack/plugins/client';
|
|
7
7
|
import '@btst/stack/authorization';
|
|
@@ -69,7 +69,7 @@ declare function getAllContentItems<TView extends CMSReadView = undefined, const
|
|
|
69
69
|
limit?: number;
|
|
70
70
|
offset?: number;
|
|
71
71
|
search?: string;
|
|
72
|
-
} & CMSReadOptions<TView, TFields
|
|
72
|
+
} & CMSReadOptions<TView, TFields>, publication?: CMSPublicationPolicy): Promise<{
|
|
73
73
|
items: CMSContentItemResult<Record<string, unknown>, TView, TFields>[];
|
|
74
74
|
total: number;
|
|
75
75
|
limit?: number;
|
|
@@ -86,7 +86,7 @@ declare function getAllContentItems<TView extends CMSReadView = undefined, const
|
|
|
86
86
|
* @param adapter - The database adapter
|
|
87
87
|
* @param id - The content item ID (UUID)
|
|
88
88
|
*/
|
|
89
|
-
declare function getContentItemById<TView extends CMSReadView = undefined, const TFields extends CMSContentFields = undefined>(adapter: DBAdapter, id: string, options?: CMSReadOptions<TView, TFields
|
|
89
|
+
declare function getContentItemById<TView extends CMSReadView = undefined, const TFields extends CMSContentFields = undefined>(adapter: DBAdapter, id: string, options?: CMSReadOptions<TView, TFields>, publication?: CMSPublicationPolicy): Promise<CMSContentItemResult<Record<string, unknown>, TView, TFields> | null>;
|
|
90
90
|
/**
|
|
91
91
|
* Retrieve a single content item by its slug within a content type.
|
|
92
92
|
* Returns null if the content type or item is not found.
|
|
@@ -99,7 +99,7 @@ declare function getContentItemById<TView extends CMSReadView = undefined, const
|
|
|
99
99
|
* @param contentTypeSlug - The slug of the content type
|
|
100
100
|
* @param slug - The slug of the content item
|
|
101
101
|
*/
|
|
102
|
-
declare function getContentItemBySlug<TView extends CMSReadView = undefined, const TFields extends CMSContentFields = undefined>(adapter: DBAdapter, contentTypeSlug: string, slug: string, options?: CMSReadOptions<TView, TFields
|
|
102
|
+
declare function getContentItemBySlug<TView extends CMSReadView = undefined, const TFields extends CMSContentFields = undefined>(adapter: DBAdapter, contentTypeSlug: string, slug: string, options?: CMSReadOptions<TView, TFields>, publication?: CMSPublicationPolicy): Promise<CMSContentItemResult<Record<string, unknown>, TView, TFields> | null>;
|
|
103
103
|
/** Parameters for a page of items referencing one relation target. */
|
|
104
104
|
interface ContentItemsByRelationParams<TView extends CMSReadView = CMSReadView, TFields extends CMSContentFields = CMSContentFields> extends CMSReadOptions<TView, TFields> {
|
|
105
105
|
/** Declared top-level relation field on the source content type. */
|
|
@@ -131,7 +131,7 @@ interface ContentItemsByRelationResult<TView extends CMSReadView = undefined, TF
|
|
|
131
131
|
* checks and pagination validation. Use `forRequest(request).operations.cms` for
|
|
132
132
|
* request work or trusted operations for validated, lifecycle-aware server work.
|
|
133
133
|
*/
|
|
134
|
-
declare function getContentItemsByRelation<TView extends CMSReadView = undefined, const TFields extends CMSContentFields = undefined>(adapter: DBAdapter, contentTypeSlug: string, params: ContentItemsByRelationParams<TView, TFields
|
|
134
|
+
declare function getContentItemsByRelation<TView extends CMSReadView = undefined, const TFields extends CMSContentFields = undefined>(adapter: DBAdapter, contentTypeSlug: string, params: ContentItemsByRelationParams<TView, TFields>, publication?: CMSPublicationPolicy): Promise<ContentItemsByRelationResult<TView, TFields>>;
|
|
135
135
|
|
|
136
136
|
declare const CMSContentTypeParamsSchema: z.ZodObject<{
|
|
137
137
|
slug: z.ZodString;
|
|
@@ -143,10 +143,12 @@ declare const CMSContentItemParamsSchema: z.ZodObject<{
|
|
|
143
143
|
declare const CMSCreateContentItemBodySchema: z.ZodObject<{
|
|
144
144
|
slug: z.ZodString;
|
|
145
145
|
data: z.ZodType<Record<string, any>, unknown, z.core.$ZodTypeInternals<Record<string, any>, unknown>>;
|
|
146
|
+
publishAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
146
147
|
}, z.core.$strip>;
|
|
147
148
|
declare const CMSUpdateContentItemBodySchema: z.ZodObject<{
|
|
148
149
|
slug: z.ZodOptional<z.ZodString>;
|
|
149
150
|
data: z.ZodOptional<z.ZodType<Record<string, any>, unknown, z.core.$ZodTypeInternals<Record<string, any>, unknown>>>;
|
|
151
|
+
publishAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
150
152
|
}, z.core.$strip>;
|
|
151
153
|
|
|
152
154
|
/**
|
|
@@ -157,7 +159,14 @@ interface CreateCMSContentItemInput {
|
|
|
157
159
|
slug: string;
|
|
158
160
|
/** Arbitrary data payload — should match the content type schema */
|
|
159
161
|
data: Record<string, unknown>;
|
|
162
|
+
/** Optional scheduled publication timestamp. */
|
|
163
|
+
publishAt?: Date | null;
|
|
160
164
|
}
|
|
165
|
+
/**
|
|
166
|
+
* Append a snapshot; caller owns authorization, validation, lifecycle hooks, and
|
|
167
|
+
* the transaction containing the item write. Revision rows are never updated.
|
|
168
|
+
*/
|
|
169
|
+
declare function recordContentRevision(adapter: Omit<DBAdapter, "transaction">, item: ContentItem, authorId?: string): Promise<ContentRevision>;
|
|
161
170
|
/**
|
|
162
171
|
* Options for {@link createCMSContentItem}.
|
|
163
172
|
*/
|
|
@@ -205,5 +214,5 @@ interface CreateCMSContentItemOptions {
|
|
|
205
214
|
*/
|
|
206
215
|
declare function createCMSContentItem(adapter: DBAdapter, contentTypeSlug: string, input: CreateCMSContentItemInput, options?: CreateCMSContentItemOptions): Promise<SerializedContentItem>;
|
|
207
216
|
|
|
208
|
-
export { CMSContentFields, CMSContentItemParamsSchema, CMSContentItemResult, CMSContentTypeParamsSchema, CMSCreateContentItemBodySchema, CMSReadOptions, CMSReadView, CMSUpdateContentItemBodySchema, CMS_LIFECYCLE_HOOK_MIGRATIONS, createCMSContentItem, getAllContentItems, getAllContentTypes, getContentItemById, getContentItemBySlug, getContentItemsByRelation, serializeContentItem, serializeContentItemWithType, serializeContentType };
|
|
217
|
+
export { CMSContentFields, CMSContentItemParamsSchema, CMSContentItemResult, CMSContentTypeParamsSchema, CMSCreateContentItemBodySchema, CMSPublicationPolicy, CMSReadOptions, CMSReadView, CMSUpdateContentItemBodySchema, CMS_LIFECYCLE_HOOK_MIGRATIONS, ContentRevision, createCMSContentItem, getAllContentItems, getAllContentTypes, getContentItemById, getContentItemBySlug, getContentItemsByRelation, recordContentRevision, serializeContentItem, serializeContentItemWithType, serializeContentType };
|
|
209
218
|
export type { ContentItemsByRelationParams, ContentItemsByRelationResult, CreateCMSContentItemInput, CreateCMSContentItemOptions };
|
package/dist/api/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { C as CMSApiRouter, a as CMSRouteKey, b as CMS_QUERY_KEYS, c as cmsBackendPlugin, d as createCMSQueryKeys } from '../shared/plugin-cms.
|
|
1
|
+
export { C as CMSApiRouter, a as CMSRouteKey, b as CMS_QUERY_KEYS, c as cmsBackendPlugin, d as createCMSQueryKeys } from '../shared/plugin-cms.DlUSv7wz.js';
|
|
2
|
+
import { CMSReadView, CMSContentFields, CMSReadOptions, CMSContentItemResult, CMSPublicationPolicy, SerializedContentType, ContentItem, SerializedContentItem, ContentItemWithType, SerializedContentItemWithType, ContentType, ContentRevision } from '../types.js';
|
|
3
|
+
export { CMSBackendConfig, CMSBackendHooks, CMSCreateOperationContext, CMSCreateResultContext, CMSDeleteOperationContext, CMSDeleteResultContext, CMSOperationErrorContext, CMSOperationLifecycleContext, CMSSelectedData, CMSUpdateOperationContext, CMSUpdateResultContext, ContentTypeConfig, PaginatedContentItems, SerializedContentItemContent, SerializedContentRevision } from '../types.js';
|
|
2
4
|
import { DBAdapter } from '@btst/db';
|
|
3
|
-
import { CMSReadView, CMSContentFields, CMSReadOptions, CMSContentItemResult, SerializedContentType, ContentItem, SerializedContentItem, ContentItemWithType, SerializedContentItemWithType, ContentType } from '../types.js';
|
|
4
|
-
export { CMSBackendConfig, CMSBackendHooks, CMSCreateOperationContext, CMSCreateResultContext, CMSDeleteOperationContext, CMSDeleteResultContext, CMSOperationErrorContext, CMSOperationLifecycleContext, CMSSelectedData, CMSUpdateOperationContext, CMSUpdateResultContext, ContentTypeConfig, PaginatedContentItems, SerializedContentItemContent } from '../types.js';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import '@btst/stack/plugins/client';
|
|
7
7
|
import '@btst/stack/authorization';
|
|
@@ -69,7 +69,7 @@ declare function getAllContentItems<TView extends CMSReadView = undefined, const
|
|
|
69
69
|
limit?: number;
|
|
70
70
|
offset?: number;
|
|
71
71
|
search?: string;
|
|
72
|
-
} & CMSReadOptions<TView, TFields
|
|
72
|
+
} & CMSReadOptions<TView, TFields>, publication?: CMSPublicationPolicy): Promise<{
|
|
73
73
|
items: CMSContentItemResult<Record<string, unknown>, TView, TFields>[];
|
|
74
74
|
total: number;
|
|
75
75
|
limit?: number;
|
|
@@ -86,7 +86,7 @@ declare function getAllContentItems<TView extends CMSReadView = undefined, const
|
|
|
86
86
|
* @param adapter - The database adapter
|
|
87
87
|
* @param id - The content item ID (UUID)
|
|
88
88
|
*/
|
|
89
|
-
declare function getContentItemById<TView extends CMSReadView = undefined, const TFields extends CMSContentFields = undefined>(adapter: DBAdapter, id: string, options?: CMSReadOptions<TView, TFields
|
|
89
|
+
declare function getContentItemById<TView extends CMSReadView = undefined, const TFields extends CMSContentFields = undefined>(adapter: DBAdapter, id: string, options?: CMSReadOptions<TView, TFields>, publication?: CMSPublicationPolicy): Promise<CMSContentItemResult<Record<string, unknown>, TView, TFields> | null>;
|
|
90
90
|
/**
|
|
91
91
|
* Retrieve a single content item by its slug within a content type.
|
|
92
92
|
* Returns null if the content type or item is not found.
|
|
@@ -99,7 +99,7 @@ declare function getContentItemById<TView extends CMSReadView = undefined, const
|
|
|
99
99
|
* @param contentTypeSlug - The slug of the content type
|
|
100
100
|
* @param slug - The slug of the content item
|
|
101
101
|
*/
|
|
102
|
-
declare function getContentItemBySlug<TView extends CMSReadView = undefined, const TFields extends CMSContentFields = undefined>(adapter: DBAdapter, contentTypeSlug: string, slug: string, options?: CMSReadOptions<TView, TFields
|
|
102
|
+
declare function getContentItemBySlug<TView extends CMSReadView = undefined, const TFields extends CMSContentFields = undefined>(adapter: DBAdapter, contentTypeSlug: string, slug: string, options?: CMSReadOptions<TView, TFields>, publication?: CMSPublicationPolicy): Promise<CMSContentItemResult<Record<string, unknown>, TView, TFields> | null>;
|
|
103
103
|
/** Parameters for a page of items referencing one relation target. */
|
|
104
104
|
interface ContentItemsByRelationParams<TView extends CMSReadView = CMSReadView, TFields extends CMSContentFields = CMSContentFields> extends CMSReadOptions<TView, TFields> {
|
|
105
105
|
/** Declared top-level relation field on the source content type. */
|
|
@@ -131,7 +131,7 @@ interface ContentItemsByRelationResult<TView extends CMSReadView = undefined, TF
|
|
|
131
131
|
* checks and pagination validation. Use `forRequest(request).operations.cms` for
|
|
132
132
|
* request work or trusted operations for validated, lifecycle-aware server work.
|
|
133
133
|
*/
|
|
134
|
-
declare function getContentItemsByRelation<TView extends CMSReadView = undefined, const TFields extends CMSContentFields = undefined>(adapter: DBAdapter, contentTypeSlug: string, params: ContentItemsByRelationParams<TView, TFields
|
|
134
|
+
declare function getContentItemsByRelation<TView extends CMSReadView = undefined, const TFields extends CMSContentFields = undefined>(adapter: DBAdapter, contentTypeSlug: string, params: ContentItemsByRelationParams<TView, TFields>, publication?: CMSPublicationPolicy): Promise<ContentItemsByRelationResult<TView, TFields>>;
|
|
135
135
|
|
|
136
136
|
declare const CMSContentTypeParamsSchema: z.ZodObject<{
|
|
137
137
|
slug: z.ZodString;
|
|
@@ -143,10 +143,12 @@ declare const CMSContentItemParamsSchema: z.ZodObject<{
|
|
|
143
143
|
declare const CMSCreateContentItemBodySchema: z.ZodObject<{
|
|
144
144
|
slug: z.ZodString;
|
|
145
145
|
data: z.ZodType<Record<string, any>, unknown, z.core.$ZodTypeInternals<Record<string, any>, unknown>>;
|
|
146
|
+
publishAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
146
147
|
}, z.core.$strip>;
|
|
147
148
|
declare const CMSUpdateContentItemBodySchema: z.ZodObject<{
|
|
148
149
|
slug: z.ZodOptional<z.ZodString>;
|
|
149
150
|
data: z.ZodOptional<z.ZodType<Record<string, any>, unknown, z.core.$ZodTypeInternals<Record<string, any>, unknown>>>;
|
|
151
|
+
publishAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
150
152
|
}, z.core.$strip>;
|
|
151
153
|
|
|
152
154
|
/**
|
|
@@ -157,7 +159,14 @@ interface CreateCMSContentItemInput {
|
|
|
157
159
|
slug: string;
|
|
158
160
|
/** Arbitrary data payload — should match the content type schema */
|
|
159
161
|
data: Record<string, unknown>;
|
|
162
|
+
/** Optional scheduled publication timestamp. */
|
|
163
|
+
publishAt?: Date | null;
|
|
160
164
|
}
|
|
165
|
+
/**
|
|
166
|
+
* Append a snapshot; caller owns authorization, validation, lifecycle hooks, and
|
|
167
|
+
* the transaction containing the item write. Revision rows are never updated.
|
|
168
|
+
*/
|
|
169
|
+
declare function recordContentRevision(adapter: Omit<DBAdapter, "transaction">, item: ContentItem, authorId?: string): Promise<ContentRevision>;
|
|
161
170
|
/**
|
|
162
171
|
* Options for {@link createCMSContentItem}.
|
|
163
172
|
*/
|
|
@@ -205,5 +214,5 @@ interface CreateCMSContentItemOptions {
|
|
|
205
214
|
*/
|
|
206
215
|
declare function createCMSContentItem(adapter: DBAdapter, contentTypeSlug: string, input: CreateCMSContentItemInput, options?: CreateCMSContentItemOptions): Promise<SerializedContentItem>;
|
|
207
216
|
|
|
208
|
-
export { CMSContentFields, CMSContentItemParamsSchema, CMSContentItemResult, CMSContentTypeParamsSchema, CMSCreateContentItemBodySchema, CMSReadOptions, CMSReadView, CMSUpdateContentItemBodySchema, CMS_LIFECYCLE_HOOK_MIGRATIONS, createCMSContentItem, getAllContentItems, getAllContentTypes, getContentItemById, getContentItemBySlug, getContentItemsByRelation, serializeContentItem, serializeContentItemWithType, serializeContentType };
|
|
217
|
+
export { CMSContentFields, CMSContentItemParamsSchema, CMSContentItemResult, CMSContentTypeParamsSchema, CMSCreateContentItemBodySchema, CMSPublicationPolicy, CMSReadOptions, CMSReadView, CMSUpdateContentItemBodySchema, CMS_LIFECYCLE_HOOK_MIGRATIONS, ContentRevision, createCMSContentItem, getAllContentItems, getAllContentTypes, getContentItemById, getContentItemBySlug, getContentItemsByRelation, recordContentRevision, serializeContentItem, serializeContentItemWithType, serializeContentType };
|
|
209
218
|
export type { ContentItemsByRelationParams, ContentItemsByRelationResult, CreateCMSContentItemInput, CreateCMSContentItemOptions };
|
package/dist/api/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { cmsBackendPlugin } from './plugin.mjs';
|
|
2
2
|
export { getAllContentItems, getAllContentTypes, getContentItemById, getContentItemBySlug, getContentItemsByRelation, serializeContentItem, serializeContentItemWithType, serializeContentType } from './getters.mjs';
|
|
3
|
-
export { createCMSContentItem } from './mutations.mjs';
|
|
3
|
+
export { createCMSContentItem, recordContentRevision } from './mutations.mjs';
|
|
4
4
|
export { CMS_QUERY_KEYS } from './query-key-defs.mjs';
|
|
5
5
|
export { createCMSQueryKeys } from '../query-keys.mjs';
|
|
6
6
|
export { CMSContentItemParamsSchema, CMSContentTypeParamsSchema, CMSCreateContentItemBodySchema, CMSUpdateContentItemBodySchema } from './operations.mjs';
|