@cmssy/core 19.35.0 → 19.36.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/{content-client-PGHzdYQn.d.cts → content-client-nqEVPiBe.d.cts} +1 -0
- package/dist/{content-client-PGHzdYQn.d.ts → content-client-nqEVPiBe.d.ts} +1 -0
- package/dist/{csp-BluOdkER.d.ts → csp-C-aqRQ1T.d.ts} +3 -2
- package/dist/{csp-os_zXaDL.d.cts → csp-CyEN5oH8.d.cts} +3 -2
- package/dist/index.cjs +13 -2
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +14 -3
- package/dist/internal/locale.cjs +15 -2
- package/dist/internal/locale.d.cts +2 -2
- package/dist/internal/locale.d.ts +2 -2
- package/dist/internal/locale.js +16 -3
- package/dist/internal.cjs +22 -3
- package/dist/internal.d.cts +6 -6
- package/dist/internal.d.ts +6 -6
- package/dist/internal.js +23 -4
- package/dist/{locale-Dvjh-aD8.d.ts → locale-Br9RRVb_.d.ts} +1 -1
- package/dist/{locale-CjVdpRSB.d.cts → locale-DgWB2_Zb.d.cts} +1 -1
- package/dist/preflight.cjs +13 -2
- package/dist/preflight.d.cts +2 -1
- package/dist/preflight.d.ts +2 -1
- package/dist/preflight.js +13 -2
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LayoutRegion, BlockPropsSchema, InferBlockContent, CmssyFormDefinition, CmssyModelDefinition, CmssyRecordList, CmssySiteConfig, CmssyFormSubmitResponse, SubmitFormInput, BlockRect, BlockSchema, BlockMeta } from '@cmssy/types';
|
|
2
|
-
import { C as CmssyClientConfig } from './content-client-
|
|
3
|
-
import { C as CmssyOperationInput, G as GraphqlRequestOptions, a as CmssyOperation } from './locale-
|
|
2
|
+
import { C as CmssyClientConfig } from './content-client-nqEVPiBe.js';
|
|
3
|
+
import { C as CmssyOperationInput, G as GraphqlRequestOptions, a as CmssyOperation } from './locale-Br9RRVb_.js';
|
|
4
4
|
|
|
5
5
|
interface CmssyLayout<R extends readonly LayoutRegion[] = readonly LayoutRegion[]> {
|
|
6
6
|
readonly regions: R;
|
|
@@ -30,6 +30,7 @@ interface CmssyConfig<L extends CmssyLayout = CmssyLayout> {
|
|
|
30
30
|
channel?: string;
|
|
31
31
|
draftSecret: string;
|
|
32
32
|
devToken?: string;
|
|
33
|
+
apiToken?: string;
|
|
33
34
|
editorOrigin?: string | string[];
|
|
34
35
|
siteUrl?: string;
|
|
35
36
|
resolveLocale?: () => string | Promise<string>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LayoutRegion, BlockPropsSchema, InferBlockContent, CmssyFormDefinition, CmssyModelDefinition, CmssyRecordList, CmssySiteConfig, CmssyFormSubmitResponse, SubmitFormInput, BlockRect, BlockSchema, BlockMeta } from '@cmssy/types';
|
|
2
|
-
import { C as CmssyClientConfig } from './content-client-
|
|
3
|
-
import { C as CmssyOperationInput, G as GraphqlRequestOptions, a as CmssyOperation } from './locale-
|
|
2
|
+
import { C as CmssyClientConfig } from './content-client-nqEVPiBe.cjs';
|
|
3
|
+
import { C as CmssyOperationInput, G as GraphqlRequestOptions, a as CmssyOperation } from './locale-DgWB2_Zb.cjs';
|
|
4
4
|
|
|
5
5
|
interface CmssyLayout<R extends readonly LayoutRegion[] = readonly LayoutRegion[]> {
|
|
6
6
|
readonly regions: R;
|
|
@@ -30,6 +30,7 @@ interface CmssyConfig<L extends CmssyLayout = CmssyLayout> {
|
|
|
30
30
|
channel?: string;
|
|
31
31
|
draftSecret: string;
|
|
32
32
|
devToken?: string;
|
|
33
|
+
apiToken?: string;
|
|
33
34
|
editorOrigin?: string | string[];
|
|
34
35
|
siteUrl?: string;
|
|
35
36
|
resolveLocale?: () => string | Promise<string>;
|
package/dist/index.cjs
CHANGED
|
@@ -225,7 +225,7 @@ function documentText(document2) {
|
|
|
225
225
|
}
|
|
226
226
|
|
|
227
227
|
// src/version.ts
|
|
228
|
-
var CMSSY_CORE_VERSION = "19.
|
|
228
|
+
var CMSSY_CORE_VERSION = "19.36.0" ;
|
|
229
229
|
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
230
230
|
|
|
231
231
|
// src/data/http.ts
|
|
@@ -511,6 +511,17 @@ function resolvePublicUrl(config) {
|
|
|
511
511
|
const base = resolveApiUrl(config.apiUrl).replace(/\/graphql\/?$/, "");
|
|
512
512
|
return `${base}/public/${config.org}/${config.workspaceSlug}/graphql`;
|
|
513
513
|
}
|
|
514
|
+
function deliveryTokenHeaders(config) {
|
|
515
|
+
const token = config.apiToken?.trim();
|
|
516
|
+
if (!token || typeof window !== "undefined") return {};
|
|
517
|
+
return { [types.API_TOKEN_HEADER_NAME]: token };
|
|
518
|
+
}
|
|
519
|
+
function withDeliveryToken(config, headers = {}) {
|
|
520
|
+
const own = Object.keys(headers).some(
|
|
521
|
+
(name2) => name2.toLowerCase() === types.API_TOKEN_HEADER_NAME
|
|
522
|
+
);
|
|
523
|
+
return own ? headers : { ...deliveryTokenHeaders(config), ...headers };
|
|
524
|
+
}
|
|
514
525
|
|
|
515
526
|
// src/data/graphql-request.ts
|
|
516
527
|
async function graphqlRequest(config, query, variables, options = {}, label = "request") {
|
|
@@ -523,7 +534,7 @@ async function graphqlRequest(config, query, variables, options = {}, label = "r
|
|
|
523
534
|
{
|
|
524
535
|
fetch: options.fetch,
|
|
525
536
|
signal: options.signal,
|
|
526
|
-
headers: options.headers,
|
|
537
|
+
headers: options.public ? withDeliveryToken(config, options.headers) : options.headers,
|
|
527
538
|
retry: options.retry,
|
|
528
539
|
label
|
|
529
540
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { C as CmssyRecordSort } from './csp-
|
|
2
|
-
export { A as AppToEditorMessage, B as BoundsMessage, d as ClickMessage, e as CmssyClient, f as CmssyConfig, g as CmssyCspOptions, h as CmssyEnvConfig, j as CmssyLayout, k as CmssyRegion, m as CmssyRegionOf, n as CmssyRegionSettings, o as CmssyRegionSettingsOf, D as DEFAULT_CMSSY_EDITOR_ORIGINS, E as EditorToAppMessage, I as InvisibleBlock, p as InvisibleBlocksMessage, q as InvisibleReason, P as PROTOCOL_VERSION, s as ParentReadyMessage, u as PatchMessage, v as PostTarget, Q as QueryScopedOptions, R as ReadyMessage, w as SHORTCUT_ACTIONS, x as ScopedVariables, y as SelectMessage, z as ShortcutAction, G as ShortcutMessage, V as VariablesParameter, H as ViewportMessage, J as applyCmssyCsp, K as createCmssyClient, L as defineCmssyConfig, N as defineCmssyLayout, O as isProtocolCompatible, T as normalizeOrigin, U as parseEditorMessage, W as postToEditor, X as resolveEditorOrigin } from './csp-
|
|
3
|
-
import { a as CmssyOperation, G as GraphqlRequestOptions } from './locale-
|
|
4
|
-
export { b as CMSSY_LOCALE_HEADER, C as CmssyOperationInput, f as CmssyTypedDocument, g as graphqlRequest, d as localizeHref, h as resolveCmssyLocale, t as typedOperation } from './locale-
|
|
5
|
-
import { F as FetchLike, R as RetryOption, C as CmssyClientConfig } from './content-client-
|
|
6
|
-
export { h as CMSSY_RATE_LIMIT_WINDOW_MS, i as CMSSY_RETRY_MODES, j as CmssyGraphqlError, k as CmssyGraphqlErrorEntry, l as CmssyRequestError, m as CmssyRetryMode, D as DEFAULT_CMSSY_API_URL, n as FetchLikeResponse, o as FetchPageOptions, p as RetryPolicy, q as createRetryingFetch, s as isTransientRequestError } from './content-client-
|
|
1
|
+
import { C as CmssyRecordSort } from './csp-CyEN5oH8.cjs';
|
|
2
|
+
export { A as AppToEditorMessage, B as BoundsMessage, d as ClickMessage, e as CmssyClient, f as CmssyConfig, g as CmssyCspOptions, h as CmssyEnvConfig, j as CmssyLayout, k as CmssyRegion, m as CmssyRegionOf, n as CmssyRegionSettings, o as CmssyRegionSettingsOf, D as DEFAULT_CMSSY_EDITOR_ORIGINS, E as EditorToAppMessage, I as InvisibleBlock, p as InvisibleBlocksMessage, q as InvisibleReason, P as PROTOCOL_VERSION, s as ParentReadyMessage, u as PatchMessage, v as PostTarget, Q as QueryScopedOptions, R as ReadyMessage, w as SHORTCUT_ACTIONS, x as ScopedVariables, y as SelectMessage, z as ShortcutAction, G as ShortcutMessage, V as VariablesParameter, H as ViewportMessage, J as applyCmssyCsp, K as createCmssyClient, L as defineCmssyConfig, N as defineCmssyLayout, O as isProtocolCompatible, T as normalizeOrigin, U as parseEditorMessage, W as postToEditor, X as resolveEditorOrigin } from './csp-CyEN5oH8.cjs';
|
|
3
|
+
import { a as CmssyOperation, G as GraphqlRequestOptions } from './locale-DgWB2_Zb.cjs';
|
|
4
|
+
export { b as CMSSY_LOCALE_HEADER, C as CmssyOperationInput, f as CmssyTypedDocument, g as graphqlRequest, d as localizeHref, h as resolveCmssyLocale, t as typedOperation } from './locale-DgWB2_Zb.cjs';
|
|
5
|
+
import { F as FetchLike, R as RetryOption, C as CmssyClientConfig } from './content-client-nqEVPiBe.cjs';
|
|
6
|
+
export { h as CMSSY_RATE_LIMIT_WINDOW_MS, i as CMSSY_RETRY_MODES, j as CmssyGraphqlError, k as CmssyGraphqlErrorEntry, l as CmssyRequestError, m as CmssyRetryMode, D as DEFAULT_CMSSY_API_URL, n as FetchLikeResponse, o as FetchPageOptions, p as RetryPolicy, q as createRetryingFetch, s as isTransientRequestError } from './content-client-nqEVPiBe.cjs';
|
|
7
7
|
import * as _cmssy_types from '@cmssy/types';
|
|
8
8
|
import { CmssyPriceSource, CmssyTaxTreatmentKind, FieldOptions, FieldValidation, TypedField, FieldTypeValueMap, ResolvedMediaValue, PageRef, BlockPropsSchema, InferBlockContent, RelationMode, CmssyModelRecord, ResolvedMedia, MediaType, BlockSchema, LayoutRegion, FieldDefinition, BlockMeta, CmssyFormField, VerifyCmssyWebhookOptions, CmssyWebhookEvent } from '@cmssy/types';
|
|
9
9
|
export { API_TOKEN_HEADER_NAME, BlockMeta, BlockPropsSchema, BlockRect, BlockSchema, BuildBlockContextExtra, CLIENT_IP_HEADER_NAME, CmssyBlockAuthContext, CmssyBlockContext, CmssyBlockMember, CmssyBlockPage, CmssyBlockWorkspace, CmssyBranding, CmssyFormDefinition, CmssyFormField, CmssyFormSettings, CmssyFormSubmitResponse, CmssyLayoutGroup, CmssyLocaleContext, CmssyLocalizedValue, CmssyModelDefinition, CmssyModelRecord, CmssyPageData, CmssyPageMeta, CmssyPageSummary, CmssyRecordList, CmssySiteConfig, CmssyTaxTreatmentKind, CmssyWebhookAccountEvent, CmssyWebhookAccountRequest, CmssyWebhookAuthoringEvent, CmssyWebhookContentChange, CmssyWebhookContentEvent, CmssyWebhookEvent, CmssyWebhookEventName, CmssyWebhookOrder, CmssyWebhookOrderEvent, CmssyWebhookOrderPayload, CmssyWebhookPricingEvent, CmssyWebhookReturn, CmssyWebhookReturnEvent, CmssyWebhookReturnPayload, CmssyWebhookShipment, CmssyWebhookShipmentEvent, CmssyWebhookShipmentPayload, CmssyWebhookSubject, CmssyWebhookTaxTreatment, FieldCondition, FieldConditionGroup, FieldConditionLogic, FieldControl, FieldDefinition, FieldOptions, FieldType, FileFieldValue, InferBlockContent, LayoutRegion, LayoutRegionId, MediaTransform, MediaType, RawBlock, RawLayoutBlock, ResolvedMedia, SubmitFormInput, TypedField, VerifyCmssyWebhookOptions, evaluateFieldConditionGroup, mediaTypeValues, taxTreatmentKindValues } from '@cmssy/types';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { C as CmssyRecordSort } from './csp-
|
|
2
|
-
export { A as AppToEditorMessage, B as BoundsMessage, d as ClickMessage, e as CmssyClient, f as CmssyConfig, g as CmssyCspOptions, h as CmssyEnvConfig, j as CmssyLayout, k as CmssyRegion, m as CmssyRegionOf, n as CmssyRegionSettings, o as CmssyRegionSettingsOf, D as DEFAULT_CMSSY_EDITOR_ORIGINS, E as EditorToAppMessage, I as InvisibleBlock, p as InvisibleBlocksMessage, q as InvisibleReason, P as PROTOCOL_VERSION, s as ParentReadyMessage, u as PatchMessage, v as PostTarget, Q as QueryScopedOptions, R as ReadyMessage, w as SHORTCUT_ACTIONS, x as ScopedVariables, y as SelectMessage, z as ShortcutAction, G as ShortcutMessage, V as VariablesParameter, H as ViewportMessage, J as applyCmssyCsp, K as createCmssyClient, L as defineCmssyConfig, N as defineCmssyLayout, O as isProtocolCompatible, T as normalizeOrigin, U as parseEditorMessage, W as postToEditor, X as resolveEditorOrigin } from './csp-
|
|
3
|
-
import { a as CmssyOperation, G as GraphqlRequestOptions } from './locale-
|
|
4
|
-
export { b as CMSSY_LOCALE_HEADER, C as CmssyOperationInput, f as CmssyTypedDocument, g as graphqlRequest, d as localizeHref, h as resolveCmssyLocale, t as typedOperation } from './locale-
|
|
5
|
-
import { F as FetchLike, R as RetryOption, C as CmssyClientConfig } from './content-client-
|
|
6
|
-
export { h as CMSSY_RATE_LIMIT_WINDOW_MS, i as CMSSY_RETRY_MODES, j as CmssyGraphqlError, k as CmssyGraphqlErrorEntry, l as CmssyRequestError, m as CmssyRetryMode, D as DEFAULT_CMSSY_API_URL, n as FetchLikeResponse, o as FetchPageOptions, p as RetryPolicy, q as createRetryingFetch, s as isTransientRequestError } from './content-client-
|
|
1
|
+
import { C as CmssyRecordSort } from './csp-C-aqRQ1T.js';
|
|
2
|
+
export { A as AppToEditorMessage, B as BoundsMessage, d as ClickMessage, e as CmssyClient, f as CmssyConfig, g as CmssyCspOptions, h as CmssyEnvConfig, j as CmssyLayout, k as CmssyRegion, m as CmssyRegionOf, n as CmssyRegionSettings, o as CmssyRegionSettingsOf, D as DEFAULT_CMSSY_EDITOR_ORIGINS, E as EditorToAppMessage, I as InvisibleBlock, p as InvisibleBlocksMessage, q as InvisibleReason, P as PROTOCOL_VERSION, s as ParentReadyMessage, u as PatchMessage, v as PostTarget, Q as QueryScopedOptions, R as ReadyMessage, w as SHORTCUT_ACTIONS, x as ScopedVariables, y as SelectMessage, z as ShortcutAction, G as ShortcutMessage, V as VariablesParameter, H as ViewportMessage, J as applyCmssyCsp, K as createCmssyClient, L as defineCmssyConfig, N as defineCmssyLayout, O as isProtocolCompatible, T as normalizeOrigin, U as parseEditorMessage, W as postToEditor, X as resolveEditorOrigin } from './csp-C-aqRQ1T.js';
|
|
3
|
+
import { a as CmssyOperation, G as GraphqlRequestOptions } from './locale-Br9RRVb_.js';
|
|
4
|
+
export { b as CMSSY_LOCALE_HEADER, C as CmssyOperationInput, f as CmssyTypedDocument, g as graphqlRequest, d as localizeHref, h as resolveCmssyLocale, t as typedOperation } from './locale-Br9RRVb_.js';
|
|
5
|
+
import { F as FetchLike, R as RetryOption, C as CmssyClientConfig } from './content-client-nqEVPiBe.js';
|
|
6
|
+
export { h as CMSSY_RATE_LIMIT_WINDOW_MS, i as CMSSY_RETRY_MODES, j as CmssyGraphqlError, k as CmssyGraphqlErrorEntry, l as CmssyRequestError, m as CmssyRetryMode, D as DEFAULT_CMSSY_API_URL, n as FetchLikeResponse, o as FetchPageOptions, p as RetryPolicy, q as createRetryingFetch, s as isTransientRequestError } from './content-client-nqEVPiBe.js';
|
|
7
7
|
import * as _cmssy_types from '@cmssy/types';
|
|
8
8
|
import { CmssyPriceSource, CmssyTaxTreatmentKind, FieldOptions, FieldValidation, TypedField, FieldTypeValueMap, ResolvedMediaValue, PageRef, BlockPropsSchema, InferBlockContent, RelationMode, CmssyModelRecord, ResolvedMedia, MediaType, BlockSchema, LayoutRegion, FieldDefinition, BlockMeta, CmssyFormField, VerifyCmssyWebhookOptions, CmssyWebhookEvent } from '@cmssy/types';
|
|
9
9
|
export { API_TOKEN_HEADER_NAME, BlockMeta, BlockPropsSchema, BlockRect, BlockSchema, BuildBlockContextExtra, CLIENT_IP_HEADER_NAME, CmssyBlockAuthContext, CmssyBlockContext, CmssyBlockMember, CmssyBlockPage, CmssyBlockWorkspace, CmssyBranding, CmssyFormDefinition, CmssyFormField, CmssyFormSettings, CmssyFormSubmitResponse, CmssyLayoutGroup, CmssyLocaleContext, CmssyLocalizedValue, CmssyModelDefinition, CmssyModelRecord, CmssyPageData, CmssyPageMeta, CmssyPageSummary, CmssyRecordList, CmssySiteConfig, CmssyTaxTreatmentKind, CmssyWebhookAccountEvent, CmssyWebhookAccountRequest, CmssyWebhookAuthoringEvent, CmssyWebhookContentChange, CmssyWebhookContentEvent, CmssyWebhookEvent, CmssyWebhookEventName, CmssyWebhookOrder, CmssyWebhookOrderEvent, CmssyWebhookOrderPayload, CmssyWebhookPricingEvent, CmssyWebhookReturn, CmssyWebhookReturnEvent, CmssyWebhookReturnPayload, CmssyWebhookShipment, CmssyWebhookShipmentEvent, CmssyWebhookShipmentPayload, CmssyWebhookSubject, CmssyWebhookTaxTreatment, FieldCondition, FieldConditionGroup, FieldConditionLogic, FieldControl, FieldDefinition, FieldOptions, FieldType, FileFieldValue, InferBlockContent, LayoutRegion, LayoutRegionId, MediaTransform, MediaType, RawBlock, RawLayoutBlock, ResolvedMedia, SubmitFormInput, TypedField, VerifyCmssyWebhookOptions, evaluateFieldConditionGroup, mediaTypeValues, taxTreatmentKindValues } from '@cmssy/types';
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { brandingFieldNames, cartCurrencyReasonValues, mediaTypeValues, LAYOUT_REGIONS_MAX, LAYOUT_REGION_ID_PATTERN, LAYOUT_REGION_LABEL_MAX, evaluateFieldConditionGroup } from '@cmssy/types';
|
|
1
|
+
import { brandingFieldNames, cartCurrencyReasonValues, mediaTypeValues, LAYOUT_REGIONS_MAX, LAYOUT_REGION_ID_PATTERN, LAYOUT_REGION_LABEL_MAX, evaluateFieldConditionGroup, API_TOKEN_HEADER_NAME } from '@cmssy/types';
|
|
2
2
|
export { API_TOKEN_HEADER_NAME, CLIENT_IP_HEADER_NAME, FieldType, MediaType, evaluateFieldConditionGroup, mediaTypeValues, taxTreatmentKindValues } from '@cmssy/types';
|
|
3
3
|
|
|
4
4
|
// src/config.ts
|
|
@@ -224,7 +224,7 @@ function documentText(document2) {
|
|
|
224
224
|
}
|
|
225
225
|
|
|
226
226
|
// src/version.ts
|
|
227
|
-
var CMSSY_CORE_VERSION = "19.
|
|
227
|
+
var CMSSY_CORE_VERSION = "19.36.0" ;
|
|
228
228
|
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
229
229
|
|
|
230
230
|
// src/data/http.ts
|
|
@@ -510,6 +510,17 @@ function resolvePublicUrl(config) {
|
|
|
510
510
|
const base = resolveApiUrl(config.apiUrl).replace(/\/graphql\/?$/, "");
|
|
511
511
|
return `${base}/public/${config.org}/${config.workspaceSlug}/graphql`;
|
|
512
512
|
}
|
|
513
|
+
function deliveryTokenHeaders(config) {
|
|
514
|
+
const token = config.apiToken?.trim();
|
|
515
|
+
if (!token || typeof window !== "undefined") return {};
|
|
516
|
+
return { [API_TOKEN_HEADER_NAME]: token };
|
|
517
|
+
}
|
|
518
|
+
function withDeliveryToken(config, headers = {}) {
|
|
519
|
+
const own = Object.keys(headers).some(
|
|
520
|
+
(name2) => name2.toLowerCase() === API_TOKEN_HEADER_NAME
|
|
521
|
+
);
|
|
522
|
+
return own ? headers : { ...deliveryTokenHeaders(config), ...headers };
|
|
523
|
+
}
|
|
513
524
|
|
|
514
525
|
// src/data/graphql-request.ts
|
|
515
526
|
async function graphqlRequest(config, query, variables, options = {}, label = "request") {
|
|
@@ -522,7 +533,7 @@ async function graphqlRequest(config, query, variables, options = {}, label = "r
|
|
|
522
533
|
{
|
|
523
534
|
fetch: options.fetch,
|
|
524
535
|
signal: options.signal,
|
|
525
|
-
headers: options.headers,
|
|
536
|
+
headers: options.public ? withDeliveryToken(config, options.headers) : options.headers,
|
|
526
537
|
retry: options.retry,
|
|
527
538
|
label
|
|
528
539
|
}
|
package/dist/internal/locale.cjs
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var types = require('@cmssy/types');
|
|
4
4
|
|
|
5
|
+
// src/content/content-client.ts
|
|
6
|
+
|
|
5
7
|
// src/data/document.ts
|
|
6
8
|
function typedOperation(text) {
|
|
7
9
|
return text;
|
|
@@ -154,7 +156,7 @@ function documentText(document) {
|
|
|
154
156
|
}
|
|
155
157
|
|
|
156
158
|
// src/version.ts
|
|
157
|
-
var CMSSY_CORE_VERSION = "19.
|
|
159
|
+
var CMSSY_CORE_VERSION = "19.36.0" ;
|
|
158
160
|
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
159
161
|
|
|
160
162
|
// src/data/http.ts
|
|
@@ -427,6 +429,17 @@ function resolvePublicUrl(config) {
|
|
|
427
429
|
const base = resolveApiUrl(config.apiUrl).replace(/\/graphql\/?$/, "");
|
|
428
430
|
return `${base}/public/${config.org}/${config.workspaceSlug}/graphql`;
|
|
429
431
|
}
|
|
432
|
+
function deliveryTokenHeaders(config) {
|
|
433
|
+
const token = config.apiToken?.trim();
|
|
434
|
+
if (!token || typeof window !== "undefined") return {};
|
|
435
|
+
return { [types.API_TOKEN_HEADER_NAME]: token };
|
|
436
|
+
}
|
|
437
|
+
function withDeliveryToken(config, headers = {}) {
|
|
438
|
+
const own = Object.keys(headers).some(
|
|
439
|
+
(name2) => name2.toLowerCase() === types.API_TOKEN_HEADER_NAME
|
|
440
|
+
);
|
|
441
|
+
return own ? headers : { ...deliveryTokenHeaders(config), ...headers };
|
|
442
|
+
}
|
|
430
443
|
|
|
431
444
|
// src/data/graphql-request.ts
|
|
432
445
|
async function graphqlRequest(config, query, variables, options = {}, label = "request") {
|
|
@@ -439,7 +452,7 @@ async function graphqlRequest(config, query, variables, options = {}, label = "r
|
|
|
439
452
|
{
|
|
440
453
|
fetch: options.fetch,
|
|
441
454
|
signal: options.signal,
|
|
442
|
-
headers: options.headers,
|
|
455
|
+
headers: options.public ? withDeliveryToken(config, options.headers) : options.headers,
|
|
443
456
|
retry: options.retry,
|
|
444
457
|
label
|
|
445
458
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { b as CMSSY_LOCALE_HEADER, l as localeForPath, c as localeForPathname, d as localizeHref, r as resolveSiteLocales, s as splitCmssyLocale, e as splitLocaleFromPath } from '../locale-
|
|
1
|
+
export { b as CMSSY_LOCALE_HEADER, l as localeForPath, c as localeForPathname, d as localizeHref, r as resolveSiteLocales, s as splitCmssyLocale, e as splitLocaleFromPath } from '../locale-DgWB2_Zb.cjs';
|
|
2
2
|
export { CmssySiteLocales } from '@cmssy/types';
|
|
3
|
-
import '../content-client-
|
|
3
|
+
import '../content-client-nqEVPiBe.cjs';
|
|
4
4
|
|
|
5
5
|
declare function localizedPath(slug: string, locale: string, defaultLocale: string): string;
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { b as CMSSY_LOCALE_HEADER, l as localeForPath, c as localeForPathname, d as localizeHref, r as resolveSiteLocales, s as splitCmssyLocale, e as splitLocaleFromPath } from '../locale-
|
|
1
|
+
export { b as CMSSY_LOCALE_HEADER, l as localeForPath, c as localeForPathname, d as localizeHref, r as resolveSiteLocales, s as splitCmssyLocale, e as splitLocaleFromPath } from '../locale-Br9RRVb_.js';
|
|
2
2
|
export { CmssySiteLocales } from '@cmssy/types';
|
|
3
|
-
import '../content-client-
|
|
3
|
+
import '../content-client-nqEVPiBe.js';
|
|
4
4
|
|
|
5
5
|
declare function localizedPath(slug: string, locale: string, defaultLocale: string): string;
|
|
6
6
|
|
package/dist/internal/locale.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { brandingFieldNames } from '@cmssy/types';
|
|
1
|
+
import { brandingFieldNames, API_TOKEN_HEADER_NAME } from '@cmssy/types';
|
|
2
|
+
|
|
3
|
+
// src/content/content-client.ts
|
|
2
4
|
|
|
3
5
|
// src/data/document.ts
|
|
4
6
|
function typedOperation(text) {
|
|
@@ -152,7 +154,7 @@ function documentText(document) {
|
|
|
152
154
|
}
|
|
153
155
|
|
|
154
156
|
// src/version.ts
|
|
155
|
-
var CMSSY_CORE_VERSION = "19.
|
|
157
|
+
var CMSSY_CORE_VERSION = "19.36.0" ;
|
|
156
158
|
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
157
159
|
|
|
158
160
|
// src/data/http.ts
|
|
@@ -425,6 +427,17 @@ function resolvePublicUrl(config) {
|
|
|
425
427
|
const base = resolveApiUrl(config.apiUrl).replace(/\/graphql\/?$/, "");
|
|
426
428
|
return `${base}/public/${config.org}/${config.workspaceSlug}/graphql`;
|
|
427
429
|
}
|
|
430
|
+
function deliveryTokenHeaders(config) {
|
|
431
|
+
const token = config.apiToken?.trim();
|
|
432
|
+
if (!token || typeof window !== "undefined") return {};
|
|
433
|
+
return { [API_TOKEN_HEADER_NAME]: token };
|
|
434
|
+
}
|
|
435
|
+
function withDeliveryToken(config, headers = {}) {
|
|
436
|
+
const own = Object.keys(headers).some(
|
|
437
|
+
(name2) => name2.toLowerCase() === API_TOKEN_HEADER_NAME
|
|
438
|
+
);
|
|
439
|
+
return own ? headers : { ...deliveryTokenHeaders(config), ...headers };
|
|
440
|
+
}
|
|
428
441
|
|
|
429
442
|
// src/data/graphql-request.ts
|
|
430
443
|
async function graphqlRequest(config, query, variables, options = {}, label = "request") {
|
|
@@ -437,7 +450,7 @@ async function graphqlRequest(config, query, variables, options = {}, label = "r
|
|
|
437
450
|
{
|
|
438
451
|
fetch: options.fetch,
|
|
439
452
|
signal: options.signal,
|
|
440
|
-
headers: options.headers,
|
|
453
|
+
headers: options.public ? withDeliveryToken(config, options.headers) : options.headers,
|
|
441
454
|
retry: options.retry,
|
|
442
455
|
label
|
|
443
456
|
}
|
package/dist/internal.cjs
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var types = require('@cmssy/types');
|
|
4
4
|
|
|
5
|
+
// src/content/content-client.ts
|
|
6
|
+
|
|
5
7
|
// src/data/document.ts
|
|
6
8
|
function typedOperation(text) {
|
|
7
9
|
return text;
|
|
@@ -154,7 +156,7 @@ function documentText(document2) {
|
|
|
154
156
|
}
|
|
155
157
|
|
|
156
158
|
// src/version.ts
|
|
157
|
-
var CMSSY_CORE_VERSION = "19.
|
|
159
|
+
var CMSSY_CORE_VERSION = "19.36.0" ;
|
|
158
160
|
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
159
161
|
|
|
160
162
|
// src/data/http.ts
|
|
@@ -427,6 +429,17 @@ function resolvePublicUrl(config) {
|
|
|
427
429
|
const base = resolveApiUrl(config.apiUrl).replace(/\/graphql\/?$/, "");
|
|
428
430
|
return `${base}/public/${config.org}/${config.workspaceSlug}/graphql`;
|
|
429
431
|
}
|
|
432
|
+
function deliveryTokenHeaders(config) {
|
|
433
|
+
const token = config.apiToken?.trim();
|
|
434
|
+
if (!token || typeof window !== "undefined") return {};
|
|
435
|
+
return { [types.API_TOKEN_HEADER_NAME]: token };
|
|
436
|
+
}
|
|
437
|
+
function withDeliveryToken(config, headers = {}) {
|
|
438
|
+
const own = Object.keys(headers).some(
|
|
439
|
+
(name2) => name2.toLowerCase() === types.API_TOKEN_HEADER_NAME
|
|
440
|
+
);
|
|
441
|
+
return own ? headers : { ...deliveryTokenHeaders(config), ...headers };
|
|
442
|
+
}
|
|
430
443
|
var PUBLIC_PAGE_QUERY = typedOperation(`query PublicPage($workspaceSlug: String!, $slug: String!, $previewSecret: String) {
|
|
431
444
|
public {
|
|
432
445
|
page {
|
|
@@ -543,7 +556,7 @@ async function fetchPage(config, path, options = {}) {
|
|
|
543
556
|
const previewSecret = trimmedSecret ? trimmedSecret : null;
|
|
544
557
|
const devToken = options.devToken?.trim();
|
|
545
558
|
const devPreview = Boolean(options.devPreview && devToken);
|
|
546
|
-
const headers =
|
|
559
|
+
const headers = deliveryTokenHeaders(config);
|
|
547
560
|
if (devPreview && devToken) {
|
|
548
561
|
headers["authorization"] = `Bearer ${devToken}`;
|
|
549
562
|
if (options.workspaceId) {
|
|
@@ -595,6 +608,7 @@ async function fetchPageById(config, pageId, options = {}) {
|
|
|
595
608
|
{
|
|
596
609
|
fetch: options.fetch,
|
|
597
610
|
signal: options.signal,
|
|
611
|
+
headers: deliveryTokenHeaders(config),
|
|
598
612
|
retry: options.retry ?? "build",
|
|
599
613
|
label: "page-by-id fetch"
|
|
600
614
|
}
|
|
@@ -616,6 +630,7 @@ async function fetchPages(config, options = {}) {
|
|
|
616
630
|
{
|
|
617
631
|
fetch: options.fetch,
|
|
618
632
|
signal: options.signal,
|
|
633
|
+
headers: deliveryTokenHeaders(config),
|
|
619
634
|
retry: options.retry ?? "build",
|
|
620
635
|
label: "pages fetch"
|
|
621
636
|
}
|
|
@@ -631,6 +646,7 @@ async function fetchPageMeta(config, path, options = {}) {
|
|
|
631
646
|
{
|
|
632
647
|
fetch: options.fetch,
|
|
633
648
|
signal: options.signal,
|
|
649
|
+
headers: deliveryTokenHeaders(config),
|
|
634
650
|
retry: options.retry ?? "build",
|
|
635
651
|
label: "page meta fetch"
|
|
636
652
|
}
|
|
@@ -648,6 +664,7 @@ async function fetchLayouts(config, path, options = {}) {
|
|
|
648
664
|
{
|
|
649
665
|
fetch: options.fetch,
|
|
650
666
|
signal: options.signal,
|
|
667
|
+
headers: deliveryTokenHeaders(config),
|
|
651
668
|
retry: options.retry ?? "build",
|
|
652
669
|
label: "layouts fetch"
|
|
653
670
|
}
|
|
@@ -662,6 +679,7 @@ async function fetchLayoutKey(config, path, options = {}) {
|
|
|
662
679
|
{
|
|
663
680
|
fetch: options.fetch,
|
|
664
681
|
signal: options.signal,
|
|
682
|
+
headers: deliveryTokenHeaders(config),
|
|
665
683
|
retry: options.retry ?? "build",
|
|
666
684
|
label: "layout key fetch"
|
|
667
685
|
}
|
|
@@ -676,6 +694,7 @@ async function fetchLayoutsByKey(config, layoutKey, options = {}) {
|
|
|
676
694
|
{
|
|
677
695
|
fetch: options.fetch,
|
|
678
696
|
signal: options.signal,
|
|
697
|
+
headers: deliveryTokenHeaders(config),
|
|
679
698
|
retry: options.retry ?? "build",
|
|
680
699
|
label: "layouts by key fetch"
|
|
681
700
|
}
|
|
@@ -722,7 +741,7 @@ async function graphqlRequest(config, query, variables, options = {}, label = "r
|
|
|
722
741
|
{
|
|
723
742
|
fetch: options.fetch,
|
|
724
743
|
signal: options.signal,
|
|
725
|
-
headers: options.headers,
|
|
744
|
+
headers: options.public ? withDeliveryToken(config, options.headers) : options.headers,
|
|
726
745
|
retry: options.retry,
|
|
727
746
|
label
|
|
728
747
|
}
|
package/dist/internal.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { C as CmssyClientConfig } from './content-client-
|
|
2
|
-
export { f as fetchLayoutKey, a as fetchLayouts, b as fetchLayoutsByKey, c as fetchPage, d as fetchPageById, e as fetchPageMeta, g as fetchPages, r as resolveApiUrl } from './content-client-
|
|
3
|
-
import { G as GraphqlRequestOptions } from './locale-
|
|
4
|
-
export { b as CMSSY_LOCALE_HEADER, l as localeForPath, c as localeForPathname, d as localizeHref, r as resolveSiteLocales, s as splitCmssyLocale, e as splitLocaleFromPath } from './locale-
|
|
1
|
+
import { C as CmssyClientConfig } from './content-client-nqEVPiBe.cjs';
|
|
2
|
+
export { f as fetchLayoutKey, a as fetchLayouts, b as fetchLayoutsByKey, c as fetchPage, d as fetchPageById, e as fetchPageMeta, g as fetchPages, r as resolveApiUrl } from './content-client-nqEVPiBe.cjs';
|
|
3
|
+
import { G as GraphqlRequestOptions } from './locale-DgWB2_Zb.cjs';
|
|
4
|
+
export { b as CMSSY_LOCALE_HEADER, l as localeForPath, c as localeForPathname, d as localizeHref, r as resolveSiteLocales, s as splitCmssyLocale, e as splitLocaleFromPath } from './locale-DgWB2_Zb.cjs';
|
|
5
5
|
import { CmssyFormDefinition, BuildBlockContextExtra, CmssyBlockContext, CmssySiteConfig, FieldDefinition, RawBlock, CmssyLayoutGroup } from '@cmssy/types';
|
|
6
6
|
export { CmssySiteLocales } from '@cmssy/types';
|
|
7
|
-
import { Q as QueryScopedOptions } from './csp-
|
|
8
|
-
export { F as FORM_QUERY, M as MODEL_DEFINITIONS_QUERY, a as MODEL_RECORDS_QUERY, S as SITE_CONFIG_QUERY, b as SUBMIT_FORM_MUTATION, c as cmssyCspHeaders, i as isDevelopment, l as layoutRegionIds, r as resolveInitialTarget, t as toCspOrigin } from './csp-
|
|
7
|
+
import { Q as QueryScopedOptions } from './csp-CyEN5oH8.cjs';
|
|
8
|
+
export { F as FORM_QUERY, M as MODEL_DEFINITIONS_QUERY, a as MODEL_RECORDS_QUERY, S as SITE_CONFIG_QUERY, b as SUBMIT_FORM_MUTATION, c as cmssyCspHeaders, i as isDevelopment, l as layoutRegionIds, r as resolveInitialTarget, t as toCspOrigin } from './csp-CyEN5oH8.cjs';
|
|
9
9
|
export { localizedPath } from './internal/locale.cjs';
|
|
10
10
|
|
|
11
11
|
declare function buildBlockContext(locale: string, defaultLocale: string, enabledLocales?: string[], isPreview?: boolean, forms?: Record<string, CmssyFormDefinition>, extra?: BuildBlockContextExtra): CmssyBlockContext;
|
package/dist/internal.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { C as CmssyClientConfig } from './content-client-
|
|
2
|
-
export { f as fetchLayoutKey, a as fetchLayouts, b as fetchLayoutsByKey, c as fetchPage, d as fetchPageById, e as fetchPageMeta, g as fetchPages, r as resolveApiUrl } from './content-client-
|
|
3
|
-
import { G as GraphqlRequestOptions } from './locale-
|
|
4
|
-
export { b as CMSSY_LOCALE_HEADER, l as localeForPath, c as localeForPathname, d as localizeHref, r as resolveSiteLocales, s as splitCmssyLocale, e as splitLocaleFromPath } from './locale-
|
|
1
|
+
import { C as CmssyClientConfig } from './content-client-nqEVPiBe.js';
|
|
2
|
+
export { f as fetchLayoutKey, a as fetchLayouts, b as fetchLayoutsByKey, c as fetchPage, d as fetchPageById, e as fetchPageMeta, g as fetchPages, r as resolveApiUrl } from './content-client-nqEVPiBe.js';
|
|
3
|
+
import { G as GraphqlRequestOptions } from './locale-Br9RRVb_.js';
|
|
4
|
+
export { b as CMSSY_LOCALE_HEADER, l as localeForPath, c as localeForPathname, d as localizeHref, r as resolveSiteLocales, s as splitCmssyLocale, e as splitLocaleFromPath } from './locale-Br9RRVb_.js';
|
|
5
5
|
import { CmssyFormDefinition, BuildBlockContextExtra, CmssyBlockContext, CmssySiteConfig, FieldDefinition, RawBlock, CmssyLayoutGroup } from '@cmssy/types';
|
|
6
6
|
export { CmssySiteLocales } from '@cmssy/types';
|
|
7
|
-
import { Q as QueryScopedOptions } from './csp-
|
|
8
|
-
export { F as FORM_QUERY, M as MODEL_DEFINITIONS_QUERY, a as MODEL_RECORDS_QUERY, S as SITE_CONFIG_QUERY, b as SUBMIT_FORM_MUTATION, c as cmssyCspHeaders, i as isDevelopment, l as layoutRegionIds, r as resolveInitialTarget, t as toCspOrigin } from './csp-
|
|
7
|
+
import { Q as QueryScopedOptions } from './csp-C-aqRQ1T.js';
|
|
8
|
+
export { F as FORM_QUERY, M as MODEL_DEFINITIONS_QUERY, a as MODEL_RECORDS_QUERY, S as SITE_CONFIG_QUERY, b as SUBMIT_FORM_MUTATION, c as cmssyCspHeaders, i as isDevelopment, l as layoutRegionIds, r as resolveInitialTarget, t as toCspOrigin } from './csp-C-aqRQ1T.js';
|
|
9
9
|
export { localizedPath } from './internal/locale.js';
|
|
10
10
|
|
|
11
11
|
declare function buildBlockContext(locale: string, defaultLocale: string, enabledLocales?: string[], isPreview?: boolean, forms?: Record<string, CmssyFormDefinition>, extra?: BuildBlockContextExtra): CmssyBlockContext;
|
package/dist/internal.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { brandingFieldNames, DEFAULT_LAYOUT_REGIONS } from '@cmssy/types';
|
|
1
|
+
import { brandingFieldNames, DEFAULT_LAYOUT_REGIONS, API_TOKEN_HEADER_NAME } from '@cmssy/types';
|
|
2
|
+
|
|
3
|
+
// src/content/content-client.ts
|
|
2
4
|
|
|
3
5
|
// src/data/document.ts
|
|
4
6
|
function typedOperation(text) {
|
|
@@ -152,7 +154,7 @@ function documentText(document2) {
|
|
|
152
154
|
}
|
|
153
155
|
|
|
154
156
|
// src/version.ts
|
|
155
|
-
var CMSSY_CORE_VERSION = "19.
|
|
157
|
+
var CMSSY_CORE_VERSION = "19.36.0" ;
|
|
156
158
|
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
157
159
|
|
|
158
160
|
// src/data/http.ts
|
|
@@ -425,6 +427,17 @@ function resolvePublicUrl(config) {
|
|
|
425
427
|
const base = resolveApiUrl(config.apiUrl).replace(/\/graphql\/?$/, "");
|
|
426
428
|
return `${base}/public/${config.org}/${config.workspaceSlug}/graphql`;
|
|
427
429
|
}
|
|
430
|
+
function deliveryTokenHeaders(config) {
|
|
431
|
+
const token = config.apiToken?.trim();
|
|
432
|
+
if (!token || typeof window !== "undefined") return {};
|
|
433
|
+
return { [API_TOKEN_HEADER_NAME]: token };
|
|
434
|
+
}
|
|
435
|
+
function withDeliveryToken(config, headers = {}) {
|
|
436
|
+
const own = Object.keys(headers).some(
|
|
437
|
+
(name2) => name2.toLowerCase() === API_TOKEN_HEADER_NAME
|
|
438
|
+
);
|
|
439
|
+
return own ? headers : { ...deliveryTokenHeaders(config), ...headers };
|
|
440
|
+
}
|
|
428
441
|
var PUBLIC_PAGE_QUERY = typedOperation(`query PublicPage($workspaceSlug: String!, $slug: String!, $previewSecret: String) {
|
|
429
442
|
public {
|
|
430
443
|
page {
|
|
@@ -541,7 +554,7 @@ async function fetchPage(config, path, options = {}) {
|
|
|
541
554
|
const previewSecret = trimmedSecret ? trimmedSecret : null;
|
|
542
555
|
const devToken = options.devToken?.trim();
|
|
543
556
|
const devPreview = Boolean(options.devPreview && devToken);
|
|
544
|
-
const headers =
|
|
557
|
+
const headers = deliveryTokenHeaders(config);
|
|
545
558
|
if (devPreview && devToken) {
|
|
546
559
|
headers["authorization"] = `Bearer ${devToken}`;
|
|
547
560
|
if (options.workspaceId) {
|
|
@@ -593,6 +606,7 @@ async function fetchPageById(config, pageId, options = {}) {
|
|
|
593
606
|
{
|
|
594
607
|
fetch: options.fetch,
|
|
595
608
|
signal: options.signal,
|
|
609
|
+
headers: deliveryTokenHeaders(config),
|
|
596
610
|
retry: options.retry ?? "build",
|
|
597
611
|
label: "page-by-id fetch"
|
|
598
612
|
}
|
|
@@ -614,6 +628,7 @@ async function fetchPages(config, options = {}) {
|
|
|
614
628
|
{
|
|
615
629
|
fetch: options.fetch,
|
|
616
630
|
signal: options.signal,
|
|
631
|
+
headers: deliveryTokenHeaders(config),
|
|
617
632
|
retry: options.retry ?? "build",
|
|
618
633
|
label: "pages fetch"
|
|
619
634
|
}
|
|
@@ -629,6 +644,7 @@ async function fetchPageMeta(config, path, options = {}) {
|
|
|
629
644
|
{
|
|
630
645
|
fetch: options.fetch,
|
|
631
646
|
signal: options.signal,
|
|
647
|
+
headers: deliveryTokenHeaders(config),
|
|
632
648
|
retry: options.retry ?? "build",
|
|
633
649
|
label: "page meta fetch"
|
|
634
650
|
}
|
|
@@ -646,6 +662,7 @@ async function fetchLayouts(config, path, options = {}) {
|
|
|
646
662
|
{
|
|
647
663
|
fetch: options.fetch,
|
|
648
664
|
signal: options.signal,
|
|
665
|
+
headers: deliveryTokenHeaders(config),
|
|
649
666
|
retry: options.retry ?? "build",
|
|
650
667
|
label: "layouts fetch"
|
|
651
668
|
}
|
|
@@ -660,6 +677,7 @@ async function fetchLayoutKey(config, path, options = {}) {
|
|
|
660
677
|
{
|
|
661
678
|
fetch: options.fetch,
|
|
662
679
|
signal: options.signal,
|
|
680
|
+
headers: deliveryTokenHeaders(config),
|
|
663
681
|
retry: options.retry ?? "build",
|
|
664
682
|
label: "layout key fetch"
|
|
665
683
|
}
|
|
@@ -674,6 +692,7 @@ async function fetchLayoutsByKey(config, layoutKey, options = {}) {
|
|
|
674
692
|
{
|
|
675
693
|
fetch: options.fetch,
|
|
676
694
|
signal: options.signal,
|
|
695
|
+
headers: deliveryTokenHeaders(config),
|
|
677
696
|
retry: options.retry ?? "build",
|
|
678
697
|
label: "layouts by key fetch"
|
|
679
698
|
}
|
|
@@ -720,7 +739,7 @@ async function graphqlRequest(config, query, variables, options = {}, label = "r
|
|
|
720
739
|
{
|
|
721
740
|
fetch: options.fetch,
|
|
722
741
|
signal: options.signal,
|
|
723
|
-
headers: options.headers,
|
|
742
|
+
headers: options.public ? withDeliveryToken(config, options.headers) : options.headers,
|
|
724
743
|
retry: options.retry,
|
|
725
744
|
label
|
|
726
745
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CmssyLocaleContext, CmssySiteLocales } from '@cmssy/types';
|
|
2
|
-
import { F as FetchLike, R as RetryOption, C as CmssyClientConfig } from './content-client-
|
|
2
|
+
import { F as FetchLike, R as RetryOption, C as CmssyClientConfig } from './content-client-nqEVPiBe.js';
|
|
3
3
|
|
|
4
4
|
interface CmssyTypedDocument<Result, Variables> {
|
|
5
5
|
__apiType?: (variables: Variables) => Result;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CmssyLocaleContext, CmssySiteLocales } from '@cmssy/types';
|
|
2
|
-
import { F as FetchLike, R as RetryOption, C as CmssyClientConfig } from './content-client-
|
|
2
|
+
import { F as FetchLike, R as RetryOption, C as CmssyClientConfig } from './content-client-nqEVPiBe.cjs';
|
|
3
3
|
|
|
4
4
|
interface CmssyTypedDocument<Result, Variables> {
|
|
5
5
|
__apiType?: (variables: Variables) => Result;
|
package/dist/preflight.cjs
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var types = require('@cmssy/types');
|
|
4
|
+
|
|
5
|
+
// src/content/content-client.ts
|
|
6
|
+
|
|
3
7
|
// src/data/document.ts
|
|
4
8
|
function typedOperation(text) {
|
|
5
9
|
return text;
|
|
@@ -152,7 +156,7 @@ function documentText(document) {
|
|
|
152
156
|
}
|
|
153
157
|
|
|
154
158
|
// src/version.ts
|
|
155
|
-
var CMSSY_CORE_VERSION = "19.
|
|
159
|
+
var CMSSY_CORE_VERSION = "19.36.0" ;
|
|
156
160
|
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
157
161
|
|
|
158
162
|
// src/content/content-client.ts
|
|
@@ -168,6 +172,11 @@ function resolvePublicUrl(config) {
|
|
|
168
172
|
const base = resolveApiUrl(config.apiUrl).replace(/\/graphql\/?$/, "");
|
|
169
173
|
return `${base}/public/${config.org}/${config.workspaceSlug}/graphql`;
|
|
170
174
|
}
|
|
175
|
+
function deliveryTokenHeaders(config) {
|
|
176
|
+
const token = config.apiToken?.trim();
|
|
177
|
+
if (!token || typeof window !== "undefined") return {};
|
|
178
|
+
return { [types.API_TOKEN_HEADER_NAME]: token };
|
|
179
|
+
}
|
|
171
180
|
|
|
172
181
|
// src/config.ts
|
|
173
182
|
var DEFAULT_CMSSY_EDITOR_ORIGINS = [
|
|
@@ -212,6 +221,7 @@ async function collectEditDiagnostics(input) {
|
|
|
212
221
|
apiUrl: config.apiUrl,
|
|
213
222
|
org,
|
|
214
223
|
workspaceSlug,
|
|
224
|
+
apiToken: config.apiToken,
|
|
215
225
|
...input.fetch ? { fetch: input.fetch } : {}
|
|
216
226
|
};
|
|
217
227
|
const reachable = await checkWorkspaceReachable(preflight);
|
|
@@ -354,7 +364,8 @@ async function postPreflightQuery(config, query, variables) {
|
|
|
354
364
|
method: "POST",
|
|
355
365
|
headers: {
|
|
356
366
|
"content-type": "application/json",
|
|
357
|
-
"user-agent": CMSSY_USER_AGENT
|
|
367
|
+
"user-agent": CMSSY_USER_AGENT,
|
|
368
|
+
...deliveryTokenHeaders(config)
|
|
358
369
|
},
|
|
359
370
|
body: JSON.stringify({ query: documentText(query), variables })
|
|
360
371
|
});
|
package/dist/preflight.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as FetchLike, C as CmssyClientConfig } from './content-client-
|
|
1
|
+
import { F as FetchLike, C as CmssyClientConfig } from './content-client-nqEVPiBe.cjs';
|
|
2
2
|
import '@cmssy/types';
|
|
3
3
|
|
|
4
4
|
interface EditDiagnosticsConfig {
|
|
@@ -6,6 +6,7 @@ interface EditDiagnosticsConfig {
|
|
|
6
6
|
org?: string;
|
|
7
7
|
workspaceSlug?: string;
|
|
8
8
|
draftSecret?: string;
|
|
9
|
+
apiToken?: string;
|
|
9
10
|
}
|
|
10
11
|
interface EditDiagnosticsInput {
|
|
11
12
|
config: EditDiagnosticsConfig;
|
package/dist/preflight.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as FetchLike, C as CmssyClientConfig } from './content-client-
|
|
1
|
+
import { F as FetchLike, C as CmssyClientConfig } from './content-client-nqEVPiBe.js';
|
|
2
2
|
import '@cmssy/types';
|
|
3
3
|
|
|
4
4
|
interface EditDiagnosticsConfig {
|
|
@@ -6,6 +6,7 @@ interface EditDiagnosticsConfig {
|
|
|
6
6
|
org?: string;
|
|
7
7
|
workspaceSlug?: string;
|
|
8
8
|
draftSecret?: string;
|
|
9
|
+
apiToken?: string;
|
|
9
10
|
}
|
|
10
11
|
interface EditDiagnosticsInput {
|
|
11
12
|
config: EditDiagnosticsConfig;
|
package/dist/preflight.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { API_TOKEN_HEADER_NAME } from '@cmssy/types';
|
|
2
|
+
|
|
3
|
+
// src/content/content-client.ts
|
|
4
|
+
|
|
1
5
|
// src/data/document.ts
|
|
2
6
|
function typedOperation(text) {
|
|
3
7
|
return text;
|
|
@@ -150,7 +154,7 @@ function documentText(document) {
|
|
|
150
154
|
}
|
|
151
155
|
|
|
152
156
|
// src/version.ts
|
|
153
|
-
var CMSSY_CORE_VERSION = "19.
|
|
157
|
+
var CMSSY_CORE_VERSION = "19.36.0" ;
|
|
154
158
|
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
155
159
|
|
|
156
160
|
// src/content/content-client.ts
|
|
@@ -166,6 +170,11 @@ function resolvePublicUrl(config) {
|
|
|
166
170
|
const base = resolveApiUrl(config.apiUrl).replace(/\/graphql\/?$/, "");
|
|
167
171
|
return `${base}/public/${config.org}/${config.workspaceSlug}/graphql`;
|
|
168
172
|
}
|
|
173
|
+
function deliveryTokenHeaders(config) {
|
|
174
|
+
const token = config.apiToken?.trim();
|
|
175
|
+
if (!token || typeof window !== "undefined") return {};
|
|
176
|
+
return { [API_TOKEN_HEADER_NAME]: token };
|
|
177
|
+
}
|
|
169
178
|
|
|
170
179
|
// src/config.ts
|
|
171
180
|
var DEFAULT_CMSSY_EDITOR_ORIGINS = [
|
|
@@ -210,6 +219,7 @@ async function collectEditDiagnostics(input) {
|
|
|
210
219
|
apiUrl: config.apiUrl,
|
|
211
220
|
org,
|
|
212
221
|
workspaceSlug,
|
|
222
|
+
apiToken: config.apiToken,
|
|
213
223
|
...input.fetch ? { fetch: input.fetch } : {}
|
|
214
224
|
};
|
|
215
225
|
const reachable = await checkWorkspaceReachable(preflight);
|
|
@@ -352,7 +362,8 @@ async function postPreflightQuery(config, query, variables) {
|
|
|
352
362
|
method: "POST",
|
|
353
363
|
headers: {
|
|
354
364
|
"content-type": "application/json",
|
|
355
|
-
"user-agent": CMSSY_USER_AGENT
|
|
365
|
+
"user-agent": CMSSY_USER_AGENT,
|
|
366
|
+
...deliveryTokenHeaders(config)
|
|
356
367
|
},
|
|
357
368
|
body: JSON.stringify({ query: documentText(query), variables })
|
|
358
369
|
});
|