@cmssy/core 10.1.0 → 10.3.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/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/internal.cjs +31 -3
- package/dist/internal.js +31 -3
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -3,7 +3,7 @@ export { C as CMSSY_LOCALE_HEADER, G as GraphqlRequestOptions, g as graphqlReque
|
|
|
3
3
|
export { C as CmssyRequestError, D as DEFAULT_CMSSY_API_URL, F as FetchLike, a as FetchLikeResponse, b as FetchPageOptions, R as RetryPolicy } from './content-client-D0EdiqbQ.cjs';
|
|
4
4
|
import * as _cmssy_types from '@cmssy/types';
|
|
5
5
|
import { FieldOptions, TypedField, BlockPropsSchema, InferBlockContent, RelationMode, CmssyModelRecord, VerifyCmssyWebhookOptions, CmssyWebhookEvent } from '@cmssy/types';
|
|
6
|
-
export { BlockMeta, BlockPropsSchema, BlockRect, BlockSchema, BuildBlockContextExtra, CmssyBlockAuthContext, CmssyBlockContext, CmssyBlockMember, CmssyBlockWorkspace, CmssyBranding, CmssyClientConfig, CmssyFormDefinition, CmssyFormField, CmssyFormSettings, CmssyFormSubmitResponse, CmssyLayoutGroup, CmssyLayoutSettings, CmssyLocaleContext, CmssyLocalizedValue, CmssyModelDefinition, CmssyModelRecord, CmssyPageData, CmssyPageMeta, CmssyPageSummary, CmssyRecordList, CmssySiteConfig, CmssyWebhookEvent, CmssyWebhookOrder, FieldCondition, FieldConditionGroup, FieldConditionLogic, FieldControl, FieldDefinition, FieldOptions, FieldType, InferBlockContent, RawBlock, RawLayoutBlock, SubmitFormInput, TypedField, VerifyCmssyWebhookOptions, evaluateFieldConditionGroup } from '@cmssy/types';
|
|
6
|
+
export { BlockMeta, BlockPropsSchema, BlockRect, BlockSchema, BuildBlockContextExtra, CmssyBlockAuthContext, CmssyBlockContext, CmssyBlockMember, CmssyBlockPage, CmssyBlockWorkspace, CmssyBranding, CmssyClientConfig, CmssyFormDefinition, CmssyFormField, CmssyFormSettings, CmssyFormSubmitResponse, CmssyLayoutGroup, CmssyLayoutSettings, CmssyLocaleContext, CmssyLocalizedValue, CmssyModelDefinition, CmssyModelRecord, CmssyPageData, CmssyPageMeta, CmssyPageSummary, CmssyRecordList, CmssySiteConfig, CmssyWebhookEvent, CmssyWebhookOrder, FieldCondition, FieldConditionGroup, FieldConditionLogic, FieldControl, FieldDefinition, FieldOptions, FieldType, InferBlockContent, RawBlock, RawLayoutBlock, SubmitFormInput, TypedField, VerifyCmssyWebhookOptions, evaluateFieldConditionGroup } from '@cmssy/types';
|
|
7
7
|
|
|
8
8
|
type Declared<O> = O extends {
|
|
9
9
|
required: true;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export { C as CMSSY_LOCALE_HEADER, G as GraphqlRequestOptions, g as graphqlReque
|
|
|
3
3
|
export { C as CmssyRequestError, D as DEFAULT_CMSSY_API_URL, F as FetchLike, a as FetchLikeResponse, b as FetchPageOptions, R as RetryPolicy } from './content-client-D0EdiqbQ.js';
|
|
4
4
|
import * as _cmssy_types from '@cmssy/types';
|
|
5
5
|
import { FieldOptions, TypedField, BlockPropsSchema, InferBlockContent, RelationMode, CmssyModelRecord, VerifyCmssyWebhookOptions, CmssyWebhookEvent } from '@cmssy/types';
|
|
6
|
-
export { BlockMeta, BlockPropsSchema, BlockRect, BlockSchema, BuildBlockContextExtra, CmssyBlockAuthContext, CmssyBlockContext, CmssyBlockMember, CmssyBlockWorkspace, CmssyBranding, CmssyClientConfig, CmssyFormDefinition, CmssyFormField, CmssyFormSettings, CmssyFormSubmitResponse, CmssyLayoutGroup, CmssyLayoutSettings, CmssyLocaleContext, CmssyLocalizedValue, CmssyModelDefinition, CmssyModelRecord, CmssyPageData, CmssyPageMeta, CmssyPageSummary, CmssyRecordList, CmssySiteConfig, CmssyWebhookEvent, CmssyWebhookOrder, FieldCondition, FieldConditionGroup, FieldConditionLogic, FieldControl, FieldDefinition, FieldOptions, FieldType, InferBlockContent, RawBlock, RawLayoutBlock, SubmitFormInput, TypedField, VerifyCmssyWebhookOptions, evaluateFieldConditionGroup } from '@cmssy/types';
|
|
6
|
+
export { BlockMeta, BlockPropsSchema, BlockRect, BlockSchema, BuildBlockContextExtra, CmssyBlockAuthContext, CmssyBlockContext, CmssyBlockMember, CmssyBlockPage, CmssyBlockWorkspace, CmssyBranding, CmssyClientConfig, CmssyFormDefinition, CmssyFormField, CmssyFormSettings, CmssyFormSubmitResponse, CmssyLayoutGroup, CmssyLayoutSettings, CmssyLocaleContext, CmssyLocalizedValue, CmssyModelDefinition, CmssyModelRecord, CmssyPageData, CmssyPageMeta, CmssyPageSummary, CmssyRecordList, CmssySiteConfig, CmssyWebhookEvent, CmssyWebhookOrder, FieldCondition, FieldConditionGroup, FieldConditionLogic, FieldControl, FieldDefinition, FieldOptions, FieldType, InferBlockContent, RawBlock, RawLayoutBlock, SubmitFormInput, TypedField, VerifyCmssyWebhookOptions, evaluateFieldConditionGroup } from '@cmssy/types';
|
|
7
7
|
|
|
8
8
|
type Declared<O> = O extends {
|
|
9
9
|
required: true;
|
package/dist/internal.cjs
CHANGED
|
@@ -120,6 +120,8 @@ var PUBLIC_PAGE_QUERY = `query PublicPage($workspaceSlug: String!, $slug: String
|
|
|
120
120
|
page {
|
|
121
121
|
get(workspaceSlug: $workspaceSlug, slug: $slug, previewSecret: $previewSecret) {
|
|
122
122
|
id
|
|
123
|
+
slug
|
|
124
|
+
pageType
|
|
123
125
|
blocks { id type content style advanced }
|
|
124
126
|
publishedBlocks { id type content style advanced }
|
|
125
127
|
}
|
|
@@ -131,6 +133,8 @@ var PUBLIC_PAGE_DEV_QUERY = `query PublicPage($workspaceSlug: String!, $slug: St
|
|
|
131
133
|
page {
|
|
132
134
|
get(workspaceSlug: $workspaceSlug, slug: $slug, previewSecret: $previewSecret, devPreview: $devPreview) {
|
|
133
135
|
id
|
|
136
|
+
slug
|
|
137
|
+
pageType
|
|
134
138
|
blocks { id type content style advanced }
|
|
135
139
|
publishedBlocks { id type content style advanced }
|
|
136
140
|
}
|
|
@@ -142,6 +146,8 @@ var PUBLIC_PAGE_BY_ID_QUERY = `query PublicPageById($workspaceSlug: String!, $pa
|
|
|
142
146
|
page {
|
|
143
147
|
getById(workspaceSlug: $workspaceSlug, pageId: $pageId) {
|
|
144
148
|
id
|
|
149
|
+
slug
|
|
150
|
+
pageType
|
|
145
151
|
publishedBlocks { id type content style advanced }
|
|
146
152
|
}
|
|
147
153
|
}
|
|
@@ -225,7 +231,12 @@ async function fetchPage(config, path, options = {}) {
|
|
|
225
231
|
if (!page) return null;
|
|
226
232
|
const draft = previewSecret !== null || devPreview;
|
|
227
233
|
const blocks = (draft ? page.blocks : page.publishedBlocks) ?? [];
|
|
228
|
-
return {
|
|
234
|
+
return {
|
|
235
|
+
id: page.id,
|
|
236
|
+
blocks,
|
|
237
|
+
slug: page.slug ?? slug,
|
|
238
|
+
pageType: page.pageType ?? null
|
|
239
|
+
};
|
|
229
240
|
}
|
|
230
241
|
async function fetchPageById(config, pageId, options = {}) {
|
|
231
242
|
const data = await postGraphql(
|
|
@@ -241,7 +252,12 @@ async function fetchPageById(config, pageId, options = {}) {
|
|
|
241
252
|
);
|
|
242
253
|
const page = data?.public?.page?.getById;
|
|
243
254
|
if (!page) return null;
|
|
244
|
-
return {
|
|
255
|
+
return {
|
|
256
|
+
id: page.id,
|
|
257
|
+
blocks: page.publishedBlocks ?? [],
|
|
258
|
+
...page.slug ? { slug: page.slug } : {},
|
|
259
|
+
pageType: page.pageType ?? null
|
|
260
|
+
};
|
|
245
261
|
}
|
|
246
262
|
async function fetchPages(config, options = {}) {
|
|
247
263
|
const data = await postGraphql(
|
|
@@ -813,7 +829,19 @@ function buildBlockContext(locale, defaultLocale, enabledLocales, isPreview, for
|
|
|
813
829
|
isPreview: isPreview ?? false,
|
|
814
830
|
forms,
|
|
815
831
|
...extra?.auth ? { auth: extra.auth } : {},
|
|
816
|
-
...extra?.workspace ? { workspace: extra.workspace } : {}
|
|
832
|
+
...extra?.workspace ? { workspace: extra.workspace } : {},
|
|
833
|
+
// Identity only, and only when the page has one. A page fetched by an older
|
|
834
|
+
// SDK has no slug, and then a block gets no `page` at all rather than one
|
|
835
|
+
// with a hole in it: "I don't know where I am" has to stay distinguishable
|
|
836
|
+
// from "I am at /".
|
|
837
|
+
...extra?.page?.slug ? {
|
|
838
|
+
page: {
|
|
839
|
+
id: extra.page.id,
|
|
840
|
+
slug: extra.page.slug,
|
|
841
|
+
pageType: extra.page.pageType ?? null
|
|
842
|
+
}
|
|
843
|
+
} : {},
|
|
844
|
+
...extra?.app ? { app: extra.app } : {}
|
|
817
845
|
};
|
|
818
846
|
}
|
|
819
847
|
|
package/dist/internal.js
CHANGED
|
@@ -118,6 +118,8 @@ var PUBLIC_PAGE_QUERY = `query PublicPage($workspaceSlug: String!, $slug: String
|
|
|
118
118
|
page {
|
|
119
119
|
get(workspaceSlug: $workspaceSlug, slug: $slug, previewSecret: $previewSecret) {
|
|
120
120
|
id
|
|
121
|
+
slug
|
|
122
|
+
pageType
|
|
121
123
|
blocks { id type content style advanced }
|
|
122
124
|
publishedBlocks { id type content style advanced }
|
|
123
125
|
}
|
|
@@ -129,6 +131,8 @@ var PUBLIC_PAGE_DEV_QUERY = `query PublicPage($workspaceSlug: String!, $slug: St
|
|
|
129
131
|
page {
|
|
130
132
|
get(workspaceSlug: $workspaceSlug, slug: $slug, previewSecret: $previewSecret, devPreview: $devPreview) {
|
|
131
133
|
id
|
|
134
|
+
slug
|
|
135
|
+
pageType
|
|
132
136
|
blocks { id type content style advanced }
|
|
133
137
|
publishedBlocks { id type content style advanced }
|
|
134
138
|
}
|
|
@@ -140,6 +144,8 @@ var PUBLIC_PAGE_BY_ID_QUERY = `query PublicPageById($workspaceSlug: String!, $pa
|
|
|
140
144
|
page {
|
|
141
145
|
getById(workspaceSlug: $workspaceSlug, pageId: $pageId) {
|
|
142
146
|
id
|
|
147
|
+
slug
|
|
148
|
+
pageType
|
|
143
149
|
publishedBlocks { id type content style advanced }
|
|
144
150
|
}
|
|
145
151
|
}
|
|
@@ -223,7 +229,12 @@ async function fetchPage(config, path, options = {}) {
|
|
|
223
229
|
if (!page) return null;
|
|
224
230
|
const draft = previewSecret !== null || devPreview;
|
|
225
231
|
const blocks = (draft ? page.blocks : page.publishedBlocks) ?? [];
|
|
226
|
-
return {
|
|
232
|
+
return {
|
|
233
|
+
id: page.id,
|
|
234
|
+
blocks,
|
|
235
|
+
slug: page.slug ?? slug,
|
|
236
|
+
pageType: page.pageType ?? null
|
|
237
|
+
};
|
|
227
238
|
}
|
|
228
239
|
async function fetchPageById(config, pageId, options = {}) {
|
|
229
240
|
const data = await postGraphql(
|
|
@@ -239,7 +250,12 @@ async function fetchPageById(config, pageId, options = {}) {
|
|
|
239
250
|
);
|
|
240
251
|
const page = data?.public?.page?.getById;
|
|
241
252
|
if (!page) return null;
|
|
242
|
-
return {
|
|
253
|
+
return {
|
|
254
|
+
id: page.id,
|
|
255
|
+
blocks: page.publishedBlocks ?? [],
|
|
256
|
+
...page.slug ? { slug: page.slug } : {},
|
|
257
|
+
pageType: page.pageType ?? null
|
|
258
|
+
};
|
|
243
259
|
}
|
|
244
260
|
async function fetchPages(config, options = {}) {
|
|
245
261
|
const data = await postGraphql(
|
|
@@ -811,7 +827,19 @@ function buildBlockContext(locale, defaultLocale, enabledLocales, isPreview, for
|
|
|
811
827
|
isPreview: isPreview ?? false,
|
|
812
828
|
forms,
|
|
813
829
|
...extra?.auth ? { auth: extra.auth } : {},
|
|
814
|
-
...extra?.workspace ? { workspace: extra.workspace } : {}
|
|
830
|
+
...extra?.workspace ? { workspace: extra.workspace } : {},
|
|
831
|
+
// Identity only, and only when the page has one. A page fetched by an older
|
|
832
|
+
// SDK has no slug, and then a block gets no `page` at all rather than one
|
|
833
|
+
// with a hole in it: "I don't know where I am" has to stay distinguishable
|
|
834
|
+
// from "I am at /".
|
|
835
|
+
...extra?.page?.slug ? {
|
|
836
|
+
page: {
|
|
837
|
+
id: extra.page.id,
|
|
838
|
+
slug: extra.page.slug,
|
|
839
|
+
pageType: extra.page.pageType ?? null
|
|
840
|
+
}
|
|
841
|
+
} : {},
|
|
842
|
+
...extra?.app ? { app: extra.app } : {}
|
|
815
843
|
};
|
|
816
844
|
}
|
|
817
845
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cmssy/core",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.3.0",
|
|
4
4
|
"description": "Framework-agnostic cmssy gateway: GraphQL client, block/field system, editor protocol. No React, no Next.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cmssy",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"vitest": "^2.1.0"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@cmssy/types": "0.
|
|
65
|
+
"@cmssy/types": "0.31.0",
|
|
66
66
|
"jose": "^6.2.3"
|
|
67
67
|
},
|
|
68
68
|
"scripts": {
|