@cmssy/core 19.4.0 → 19.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{content-client-DhcHP8ln.d.cts → content-client-BSNwo1SM.d.cts} +13 -1
- package/dist/{content-client-DhcHP8ln.d.ts → content-client-BSNwo1SM.d.ts} +13 -1
- package/dist/{csp-eQsMxVsg.d.cts → csp-CkxY33mW.d.cts} +1 -1
- package/dist/{csp-AofUvsVZ.d.ts → csp-vR6v-WmE.d.ts} +1 -1
- package/dist/index.cjs +36 -3
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +28 -5
- package/dist/internal/locale.cjs +16 -3
- 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 +16 -3
- package/dist/internal.d.cts +5 -5
- package/dist/internal.d.ts +5 -5
- package/dist/internal.js +16 -3
- package/dist/{locale-BHRDFyNF.d.ts → locale-By_6K3p0.d.ts} +1 -1
- package/dist/{locale-DmMO2Cwk.d.cts → locale-D1ZCb7eA.d.cts} +1 -1
- package/dist/preflight.cjs +1 -1
- package/dist/preflight.d.cts +1 -1
- package/dist/preflight.d.ts +1 -1
- package/dist/preflight.js +1 -1
- package/package.json +2 -2
|
@@ -21,6 +21,18 @@ declare const CMSSY_RATE_LIMIT_WINDOW_MS = 60000;
|
|
|
21
21
|
type ResolvedRetryPolicy = Readonly<Required<RetryPolicy>>;
|
|
22
22
|
declare const CMSSY_RETRY_MODES: Record<CmssyRetryMode, ResolvedRetryPolicy>;
|
|
23
23
|
declare function isTransientRequestError(error: unknown): error is CmssyRequestError;
|
|
24
|
+
declare function createRetryingFetch<F extends FetchLike = FetchLike>(retry: RetryOption, doFetch?: F, label?: string): F;
|
|
25
|
+
interface CmssyGraphqlErrorEntry {
|
|
26
|
+
message?: string;
|
|
27
|
+
extensions?: {
|
|
28
|
+
code?: string;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
declare class CmssyGraphqlError extends Error {
|
|
32
|
+
readonly errors: ReadonlyArray<CmssyGraphqlErrorEntry>;
|
|
33
|
+
readonly code: string | undefined;
|
|
34
|
+
constructor(message: string, errors: ReadonlyArray<CmssyGraphqlErrorEntry>);
|
|
35
|
+
}
|
|
24
36
|
|
|
25
37
|
declare const DEFAULT_CMSSY_API_URL = "https://api.cmssy.io/graphql";
|
|
26
38
|
declare function resolveApiUrl(apiUrl: string | undefined): string;
|
|
@@ -53,4 +65,4 @@ declare function fetchPages(config: CmssyClientConfig, options?: Pick<FetchPageO
|
|
|
53
65
|
declare function fetchPageMeta(config: CmssyClientConfig, path: string | string[] | undefined, options?: Pick<FetchPageOptions, "fetch" | "signal" | "retry">): Promise<CmssyPageMeta | null>;
|
|
54
66
|
declare function fetchLayouts(config: CmssyClientConfig, path: string | string[] | undefined, options?: FetchPageOptions): Promise<CmssyLayoutGroup[]>;
|
|
55
67
|
|
|
56
|
-
export { CMSSY_RATE_LIMIT_WINDOW_MS as C, DEFAULT_CMSSY_API_URL as D, type FetchLike as F, type RetryOption as R, CMSSY_RETRY_MODES as a,
|
|
68
|
+
export { CMSSY_RATE_LIMIT_WINDOW_MS as C, DEFAULT_CMSSY_API_URL as D, type FetchLike as F, type RetryOption as R, CMSSY_RETRY_MODES as a, CmssyGraphqlError as b, type CmssyGraphqlErrorEntry as c, CmssyRequestError as d, type CmssyRetryMode as e, type FetchLikeResponse as f, type FetchPageOptions as g, type RetryPolicy as h, createRetryingFetch as i, isTransientRequestError as j, fetchLayouts as k, fetchPage as l, fetchPageById as m, fetchPageMeta as n, fetchPages as o, resolveApiUrl as r };
|
|
@@ -21,6 +21,18 @@ declare const CMSSY_RATE_LIMIT_WINDOW_MS = 60000;
|
|
|
21
21
|
type ResolvedRetryPolicy = Readonly<Required<RetryPolicy>>;
|
|
22
22
|
declare const CMSSY_RETRY_MODES: Record<CmssyRetryMode, ResolvedRetryPolicy>;
|
|
23
23
|
declare function isTransientRequestError(error: unknown): error is CmssyRequestError;
|
|
24
|
+
declare function createRetryingFetch<F extends FetchLike = FetchLike>(retry: RetryOption, doFetch?: F, label?: string): F;
|
|
25
|
+
interface CmssyGraphqlErrorEntry {
|
|
26
|
+
message?: string;
|
|
27
|
+
extensions?: {
|
|
28
|
+
code?: string;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
declare class CmssyGraphqlError extends Error {
|
|
32
|
+
readonly errors: ReadonlyArray<CmssyGraphqlErrorEntry>;
|
|
33
|
+
readonly code: string | undefined;
|
|
34
|
+
constructor(message: string, errors: ReadonlyArray<CmssyGraphqlErrorEntry>);
|
|
35
|
+
}
|
|
24
36
|
|
|
25
37
|
declare const DEFAULT_CMSSY_API_URL = "https://api.cmssy.io/graphql";
|
|
26
38
|
declare function resolveApiUrl(apiUrl: string | undefined): string;
|
|
@@ -53,4 +65,4 @@ declare function fetchPages(config: CmssyClientConfig, options?: Pick<FetchPageO
|
|
|
53
65
|
declare function fetchPageMeta(config: CmssyClientConfig, path: string | string[] | undefined, options?: Pick<FetchPageOptions, "fetch" | "signal" | "retry">): Promise<CmssyPageMeta | null>;
|
|
54
66
|
declare function fetchLayouts(config: CmssyClientConfig, path: string | string[] | undefined, options?: FetchPageOptions): Promise<CmssyLayoutGroup[]>;
|
|
55
67
|
|
|
56
|
-
export { CMSSY_RATE_LIMIT_WINDOW_MS as C, DEFAULT_CMSSY_API_URL as D, type FetchLike as F, type RetryOption as R, CMSSY_RETRY_MODES as a,
|
|
68
|
+
export { CMSSY_RATE_LIMIT_WINDOW_MS as C, DEFAULT_CMSSY_API_URL as D, type FetchLike as F, type RetryOption as R, CMSSY_RETRY_MODES as a, CmssyGraphqlError as b, type CmssyGraphqlErrorEntry as c, CmssyRequestError as d, type CmssyRetryMode as e, type FetchLikeResponse as f, type FetchPageOptions as g, type RetryPolicy as h, createRetryingFetch as i, isTransientRequestError as j, fetchLayouts as k, fetchPage as l, fetchPageById as m, fetchPageMeta as n, fetchPages as o, resolveApiUrl as r };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LayoutRegion, BlockPropsSchema, InferBlockContent, CmssyClientConfig, BlockRect, BlockSchema, BlockMeta } from '@cmssy/types';
|
|
2
|
-
import { C as CmssyOperationInput, G as GraphqlRequestOptions } from './locale-
|
|
2
|
+
import { C as CmssyOperationInput, G as GraphqlRequestOptions } from './locale-D1ZCb7eA.cjs';
|
|
3
3
|
|
|
4
4
|
interface CmssyLayout<R extends readonly LayoutRegion[] = readonly LayoutRegion[]> {
|
|
5
5
|
readonly regions: R;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LayoutRegion, BlockPropsSchema, InferBlockContent, CmssyClientConfig, BlockRect, BlockSchema, BlockMeta } from '@cmssy/types';
|
|
2
|
-
import { C as CmssyOperationInput, G as GraphqlRequestOptions } from './locale-
|
|
2
|
+
import { C as CmssyOperationInput, G as GraphqlRequestOptions } from './locale-By_6K3p0.js';
|
|
3
3
|
|
|
4
4
|
interface CmssyLayout<R extends readonly LayoutRegion[] = readonly LayoutRegion[]> {
|
|
5
5
|
readonly regions: R;
|
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.6.0" ;
|
|
229
229
|
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
230
230
|
|
|
231
231
|
// src/data/http.ts
|
|
@@ -348,12 +348,32 @@ async function fetchWithRetry(doFetch, url, init, retry, label) {
|
|
|
348
348
|
console.warn(
|
|
349
349
|
`[cmssy] ${label} got ${response.status}, retrying in ${wait}ms (attempt ${attempt + 1}/${policy.maxRetries})`
|
|
350
350
|
);
|
|
351
|
-
await sleep(wait, init
|
|
351
|
+
await sleep(wait, init?.signal);
|
|
352
352
|
waitedMs += wait;
|
|
353
353
|
response = await doFetch(url, init);
|
|
354
354
|
}
|
|
355
355
|
return { response, waitedMs };
|
|
356
356
|
}
|
|
357
|
+
function createRetryingFetch(retry, doFetch, label = "request") {
|
|
358
|
+
const wrapped = async (url, init) => {
|
|
359
|
+
const impl = doFetch ?? globalThis.fetch;
|
|
360
|
+
if (typeof impl !== "function") {
|
|
361
|
+
throw new Error("cmssy: no fetch implementation available - pass one");
|
|
362
|
+
}
|
|
363
|
+
return (await fetchWithRetry(impl, url, init, retry, label)).response;
|
|
364
|
+
};
|
|
365
|
+
return wrapped;
|
|
366
|
+
}
|
|
367
|
+
var CmssyGraphqlError = class extends Error {
|
|
368
|
+
errors;
|
|
369
|
+
code;
|
|
370
|
+
constructor(message, errors) {
|
|
371
|
+
super(message);
|
|
372
|
+
this.name = "CmssyGraphqlError";
|
|
373
|
+
this.errors = errors;
|
|
374
|
+
this.code = errors[0]?.extensions?.code;
|
|
375
|
+
}
|
|
376
|
+
};
|
|
357
377
|
async function postGraphql(url, query, variables, options) {
|
|
358
378
|
const doFetch = options.fetch ?? globalThis.fetch;
|
|
359
379
|
if (typeof doFetch !== "function") {
|
|
@@ -405,7 +425,10 @@ async function postGraphql(url, query, variables, options) {
|
|
|
405
425
|
}
|
|
406
426
|
if (json.errors && json.errors.length > 0) {
|
|
407
427
|
const message = json.errors.map((error) => error.message ?? "GraphQL error").join("; ");
|
|
408
|
-
throw new
|
|
428
|
+
throw new CmssyGraphqlError(
|
|
429
|
+
`cmssy: ${options.label} error - ${message}`,
|
|
430
|
+
json.errors
|
|
431
|
+
);
|
|
409
432
|
}
|
|
410
433
|
return json.data;
|
|
411
434
|
}
|
|
@@ -1126,6 +1149,14 @@ async function verifyCmssyWebhook(options) {
|
|
|
1126
1149
|
return parsed;
|
|
1127
1150
|
}
|
|
1128
1151
|
|
|
1152
|
+
Object.defineProperty(exports, "API_TOKEN_HEADER_NAME", {
|
|
1153
|
+
enumerable: true,
|
|
1154
|
+
get: function () { return types.API_TOKEN_HEADER_NAME; }
|
|
1155
|
+
});
|
|
1156
|
+
Object.defineProperty(exports, "CLIENT_IP_HEADER_NAME", {
|
|
1157
|
+
enumerable: true,
|
|
1158
|
+
get: function () { return types.CLIENT_IP_HEADER_NAME; }
|
|
1159
|
+
});
|
|
1129
1160
|
Object.defineProperty(exports, "MediaType", {
|
|
1130
1161
|
enumerable: true,
|
|
1131
1162
|
get: function () { return types.MediaType; }
|
|
@@ -1145,6 +1176,7 @@ exports.CMSSY_LOCALE_HEADER = CMSSY_LOCALE_HEADER;
|
|
|
1145
1176
|
exports.CMSSY_RATE_LIMIT_WINDOW_MS = CMSSY_RATE_LIMIT_WINDOW_MS;
|
|
1146
1177
|
exports.CMSSY_RETRY_MODES = CMSSY_RETRY_MODES;
|
|
1147
1178
|
exports.CMSSY_SECRET_QUERY_PARAM = CMSSY_SECRET_QUERY_PARAM;
|
|
1179
|
+
exports.CmssyGraphqlError = CmssyGraphqlError;
|
|
1148
1180
|
exports.CmssyRequestError = CmssyRequestError;
|
|
1149
1181
|
exports.CmssyWebhookError = CmssyWebhookError;
|
|
1150
1182
|
exports.DEFAULT_CMSSY_API_URL = DEFAULT_CMSSY_API_URL;
|
|
@@ -1156,6 +1188,7 @@ exports.blocksToMeta = blocksToMeta;
|
|
|
1156
1188
|
exports.blocksToSchemas = blocksToSchemas;
|
|
1157
1189
|
exports.buildBlockManifest = buildBlockManifest;
|
|
1158
1190
|
exports.createCmssyClient = createCmssyClient;
|
|
1191
|
+
exports.createRetryingFetch = createRetryingFetch;
|
|
1159
1192
|
exports.defineCmssyConfig = defineCmssyConfig;
|
|
1160
1193
|
exports.defineCmssyLayout = defineCmssyLayout;
|
|
1161
1194
|
exports.fields = fields;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { A as AppToEditorMessage, B as BoundsMessage, C as ClickMessage, a as CmssyClient, b as CmssyConfig, c as CmssyCspOptions, d as CmssyEnvConfig, e as CmssyLayout, f as CmssyRegion, g as CmssyRegionOf, h as CmssyRegionSettings, i as CmssyRegionSettingsOf, D as DEFAULT_CMSSY_EDITOR_ORIGINS, E as EditorToAppMessage, I as InvisibleBlock, j as InvisibleBlocksMessage, P as PROTOCOL_VERSION, k as ParentReadyMessage, l as PatchMessage, m as PostTarget, Q as QueryScopedOptions, R as ReadyMessage, S as SHORTCUT_ACTIONS, n as ScopedVariables, o as SelectMessage, p as ShortcutAction, q as ShortcutMessage, V as VariablesParameter, r as ViewportMessage, s as applyCmssyCsp, t as createCmssyClient, u as defineCmssyConfig, v as defineCmssyLayout, w as isProtocolCompatible, x as normalizeOrigin, y as parseEditorMessage, z as postToEditor, F as resolveEditorOrigin } from './csp-
|
|
2
|
-
export { a as CMSSY_LOCALE_HEADER, b as CmssyOperation, C as CmssyOperationInput, c as CmssyTypedDocument, G as GraphqlRequestOptions, g as graphqlRequest, l as localizeHref, r as resolveCmssyLocale, t as typedOperation } from './locale-
|
|
3
|
-
export { C as CMSSY_RATE_LIMIT_WINDOW_MS, a as CMSSY_RETRY_MODES, b as
|
|
1
|
+
export { A as AppToEditorMessage, B as BoundsMessage, C as ClickMessage, a as CmssyClient, b as CmssyConfig, c as CmssyCspOptions, d as CmssyEnvConfig, e as CmssyLayout, f as CmssyRegion, g as CmssyRegionOf, h as CmssyRegionSettings, i as CmssyRegionSettingsOf, D as DEFAULT_CMSSY_EDITOR_ORIGINS, E as EditorToAppMessage, I as InvisibleBlock, j as InvisibleBlocksMessage, P as PROTOCOL_VERSION, k as ParentReadyMessage, l as PatchMessage, m as PostTarget, Q as QueryScopedOptions, R as ReadyMessage, S as SHORTCUT_ACTIONS, n as ScopedVariables, o as SelectMessage, p as ShortcutAction, q as ShortcutMessage, V as VariablesParameter, r as ViewportMessage, s as applyCmssyCsp, t as createCmssyClient, u as defineCmssyConfig, v as defineCmssyLayout, w as isProtocolCompatible, x as normalizeOrigin, y as parseEditorMessage, z as postToEditor, F as resolveEditorOrigin } from './csp-CkxY33mW.cjs';
|
|
2
|
+
export { a as CMSSY_LOCALE_HEADER, b as CmssyOperation, C as CmssyOperationInput, c as CmssyTypedDocument, G as GraphqlRequestOptions, g as graphqlRequest, l as localizeHref, r as resolveCmssyLocale, t as typedOperation } from './locale-D1ZCb7eA.cjs';
|
|
3
|
+
export { C as CMSSY_RATE_LIMIT_WINDOW_MS, a as CMSSY_RETRY_MODES, b as CmssyGraphqlError, c as CmssyGraphqlErrorEntry, d as CmssyRequestError, e as CmssyRetryMode, D as DEFAULT_CMSSY_API_URL, F as FetchLike, f as FetchLikeResponse, g as FetchPageOptions, R as RetryOption, h as RetryPolicy, i as createRetryingFetch, j as isTransientRequestError } from './content-client-BSNwo1SM.cjs';
|
|
4
4
|
import * as _cmssy_types from '@cmssy/types';
|
|
5
5
|
import { FieldOptions, TypedField, FieldTypeValueMap, ResolvedMediaValue, PageRef, BlockPropsSchema, InferBlockContent, RelationMode, CmssyModelRecord, ResolvedMedia, MediaType, BlockSchema, LayoutRegion, FieldDefinition, BlockMeta, CmssyFormField, VerifyCmssyWebhookOptions, CmssyWebhookEvent } from '@cmssy/types';
|
|
6
|
-
export { BlockMeta, BlockPropsSchema, BlockRect, BlockSchema, BuildBlockContextExtra, CmssyBlockAuthContext, CmssyBlockContext, CmssyBlockMember, CmssyBlockPage, CmssyBlockWorkspace, CmssyBranding, CmssyClientConfig, CmssyFormDefinition, CmssyFormField, CmssyFormSettings, CmssyFormSubmitResponse, CmssyLayoutGroup, CmssyLocaleContext, CmssyLocalizedValue, CmssyModelDefinition, CmssyModelRecord, CmssyPageData, CmssyPageMeta, CmssyPageSummary, CmssyRecordList, CmssySiteConfig, CmssyWebhookEvent, CmssyWebhookOrder, FieldCondition, FieldConditionGroup, FieldConditionLogic, FieldControl, FieldDefinition, FieldOptions, FieldType, FileFieldValue, InferBlockContent, LayoutRegion, LayoutRegionId, MediaTransform, MediaType, RawBlock, RawLayoutBlock, ResolvedMedia, SubmitFormInput, TypedField, VerifyCmssyWebhookOptions, evaluateFieldConditionGroup, mediaTypeValues } from '@cmssy/types';
|
|
6
|
+
export { API_TOKEN_HEADER_NAME, BlockMeta, BlockPropsSchema, BlockRect, BlockSchema, BuildBlockContextExtra, CLIENT_IP_HEADER_NAME, CmssyBlockAuthContext, CmssyBlockContext, CmssyBlockMember, CmssyBlockPage, CmssyBlockWorkspace, CmssyBranding, CmssyClientConfig, CmssyFormDefinition, CmssyFormField, CmssyFormSettings, CmssyFormSubmitResponse, CmssyLayoutGroup, CmssyLocaleContext, CmssyLocalizedValue, CmssyModelDefinition, CmssyModelRecord, CmssyPageData, CmssyPageMeta, CmssyPageSummary, CmssyRecordList, CmssySiteConfig, CmssyWebhookEvent, CmssyWebhookOrder, FieldCondition, FieldConditionGroup, FieldConditionLogic, FieldControl, FieldDefinition, FieldOptions, FieldType, FileFieldValue, InferBlockContent, LayoutRegion, LayoutRegionId, MediaTransform, MediaType, RawBlock, RawLayoutBlock, ResolvedMedia, SubmitFormInput, TypedField, VerifyCmssyWebhookOptions, evaluateFieldConditionGroup, mediaTypeValues } from '@cmssy/types';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Whether the content is guaranteed to carry the field. Only `required` says
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { A as AppToEditorMessage, B as BoundsMessage, C as ClickMessage, a as CmssyClient, b as CmssyConfig, c as CmssyCspOptions, d as CmssyEnvConfig, e as CmssyLayout, f as CmssyRegion, g as CmssyRegionOf, h as CmssyRegionSettings, i as CmssyRegionSettingsOf, D as DEFAULT_CMSSY_EDITOR_ORIGINS, E as EditorToAppMessage, I as InvisibleBlock, j as InvisibleBlocksMessage, P as PROTOCOL_VERSION, k as ParentReadyMessage, l as PatchMessage, m as PostTarget, Q as QueryScopedOptions, R as ReadyMessage, S as SHORTCUT_ACTIONS, n as ScopedVariables, o as SelectMessage, p as ShortcutAction, q as ShortcutMessage, V as VariablesParameter, r as ViewportMessage, s as applyCmssyCsp, t as createCmssyClient, u as defineCmssyConfig, v as defineCmssyLayout, w as isProtocolCompatible, x as normalizeOrigin, y as parseEditorMessage, z as postToEditor, F as resolveEditorOrigin } from './csp-
|
|
2
|
-
export { a as CMSSY_LOCALE_HEADER, b as CmssyOperation, C as CmssyOperationInput, c as CmssyTypedDocument, G as GraphqlRequestOptions, g as graphqlRequest, l as localizeHref, r as resolveCmssyLocale, t as typedOperation } from './locale-
|
|
3
|
-
export { C as CMSSY_RATE_LIMIT_WINDOW_MS, a as CMSSY_RETRY_MODES, b as
|
|
1
|
+
export { A as AppToEditorMessage, B as BoundsMessage, C as ClickMessage, a as CmssyClient, b as CmssyConfig, c as CmssyCspOptions, d as CmssyEnvConfig, e as CmssyLayout, f as CmssyRegion, g as CmssyRegionOf, h as CmssyRegionSettings, i as CmssyRegionSettingsOf, D as DEFAULT_CMSSY_EDITOR_ORIGINS, E as EditorToAppMessage, I as InvisibleBlock, j as InvisibleBlocksMessage, P as PROTOCOL_VERSION, k as ParentReadyMessage, l as PatchMessage, m as PostTarget, Q as QueryScopedOptions, R as ReadyMessage, S as SHORTCUT_ACTIONS, n as ScopedVariables, o as SelectMessage, p as ShortcutAction, q as ShortcutMessage, V as VariablesParameter, r as ViewportMessage, s as applyCmssyCsp, t as createCmssyClient, u as defineCmssyConfig, v as defineCmssyLayout, w as isProtocolCompatible, x as normalizeOrigin, y as parseEditorMessage, z as postToEditor, F as resolveEditorOrigin } from './csp-vR6v-WmE.js';
|
|
2
|
+
export { a as CMSSY_LOCALE_HEADER, b as CmssyOperation, C as CmssyOperationInput, c as CmssyTypedDocument, G as GraphqlRequestOptions, g as graphqlRequest, l as localizeHref, r as resolveCmssyLocale, t as typedOperation } from './locale-By_6K3p0.js';
|
|
3
|
+
export { C as CMSSY_RATE_LIMIT_WINDOW_MS, a as CMSSY_RETRY_MODES, b as CmssyGraphqlError, c as CmssyGraphqlErrorEntry, d as CmssyRequestError, e as CmssyRetryMode, D as DEFAULT_CMSSY_API_URL, F as FetchLike, f as FetchLikeResponse, g as FetchPageOptions, R as RetryOption, h as RetryPolicy, i as createRetryingFetch, j as isTransientRequestError } from './content-client-BSNwo1SM.js';
|
|
4
4
|
import * as _cmssy_types from '@cmssy/types';
|
|
5
5
|
import { FieldOptions, TypedField, FieldTypeValueMap, ResolvedMediaValue, PageRef, BlockPropsSchema, InferBlockContent, RelationMode, CmssyModelRecord, ResolvedMedia, MediaType, BlockSchema, LayoutRegion, FieldDefinition, BlockMeta, CmssyFormField, VerifyCmssyWebhookOptions, CmssyWebhookEvent } from '@cmssy/types';
|
|
6
|
-
export { BlockMeta, BlockPropsSchema, BlockRect, BlockSchema, BuildBlockContextExtra, CmssyBlockAuthContext, CmssyBlockContext, CmssyBlockMember, CmssyBlockPage, CmssyBlockWorkspace, CmssyBranding, CmssyClientConfig, CmssyFormDefinition, CmssyFormField, CmssyFormSettings, CmssyFormSubmitResponse, CmssyLayoutGroup, CmssyLocaleContext, CmssyLocalizedValue, CmssyModelDefinition, CmssyModelRecord, CmssyPageData, CmssyPageMeta, CmssyPageSummary, CmssyRecordList, CmssySiteConfig, CmssyWebhookEvent, CmssyWebhookOrder, FieldCondition, FieldConditionGroup, FieldConditionLogic, FieldControl, FieldDefinition, FieldOptions, FieldType, FileFieldValue, InferBlockContent, LayoutRegion, LayoutRegionId, MediaTransform, MediaType, RawBlock, RawLayoutBlock, ResolvedMedia, SubmitFormInput, TypedField, VerifyCmssyWebhookOptions, evaluateFieldConditionGroup, mediaTypeValues } from '@cmssy/types';
|
|
6
|
+
export { API_TOKEN_HEADER_NAME, BlockMeta, BlockPropsSchema, BlockRect, BlockSchema, BuildBlockContextExtra, CLIENT_IP_HEADER_NAME, CmssyBlockAuthContext, CmssyBlockContext, CmssyBlockMember, CmssyBlockPage, CmssyBlockWorkspace, CmssyBranding, CmssyClientConfig, CmssyFormDefinition, CmssyFormField, CmssyFormSettings, CmssyFormSubmitResponse, CmssyLayoutGroup, CmssyLocaleContext, CmssyLocalizedValue, CmssyModelDefinition, CmssyModelRecord, CmssyPageData, CmssyPageMeta, CmssyPageSummary, CmssyRecordList, CmssySiteConfig, CmssyWebhookEvent, CmssyWebhookOrder, FieldCondition, FieldConditionGroup, FieldConditionLogic, FieldControl, FieldDefinition, FieldOptions, FieldType, FileFieldValue, InferBlockContent, LayoutRegion, LayoutRegionId, MediaTransform, MediaType, RawBlock, RawLayoutBlock, ResolvedMedia, SubmitFormInput, TypedField, VerifyCmssyWebhookOptions, evaluateFieldConditionGroup, mediaTypeValues } from '@cmssy/types';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Whether the content is guaranteed to carry the field. Only `required` says
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { brandingFieldNames, mediaTypeValues, LAYOUT_REGIONS_MAX, LAYOUT_REGION_ID_PATTERN, LAYOUT_REGION_LABEL_MAX, evaluateFieldConditionGroup } from '@cmssy/types';
|
|
2
|
-
export { MediaType, evaluateFieldConditionGroup, mediaTypeValues } from '@cmssy/types';
|
|
2
|
+
export { API_TOKEN_HEADER_NAME, CLIENT_IP_HEADER_NAME, MediaType, evaluateFieldConditionGroup, mediaTypeValues } from '@cmssy/types';
|
|
3
3
|
|
|
4
4
|
// src/config.ts
|
|
5
5
|
var DEFAULT_CMSSY_EDITOR_ORIGINS = [
|
|
@@ -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.6.0" ;
|
|
228
228
|
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
229
229
|
|
|
230
230
|
// src/data/http.ts
|
|
@@ -347,12 +347,32 @@ async function fetchWithRetry(doFetch, url, init, retry, label) {
|
|
|
347
347
|
console.warn(
|
|
348
348
|
`[cmssy] ${label} got ${response.status}, retrying in ${wait}ms (attempt ${attempt + 1}/${policy.maxRetries})`
|
|
349
349
|
);
|
|
350
|
-
await sleep(wait, init
|
|
350
|
+
await sleep(wait, init?.signal);
|
|
351
351
|
waitedMs += wait;
|
|
352
352
|
response = await doFetch(url, init);
|
|
353
353
|
}
|
|
354
354
|
return { response, waitedMs };
|
|
355
355
|
}
|
|
356
|
+
function createRetryingFetch(retry, doFetch, label = "request") {
|
|
357
|
+
const wrapped = async (url, init) => {
|
|
358
|
+
const impl = doFetch ?? globalThis.fetch;
|
|
359
|
+
if (typeof impl !== "function") {
|
|
360
|
+
throw new Error("cmssy: no fetch implementation available - pass one");
|
|
361
|
+
}
|
|
362
|
+
return (await fetchWithRetry(impl, url, init, retry, label)).response;
|
|
363
|
+
};
|
|
364
|
+
return wrapped;
|
|
365
|
+
}
|
|
366
|
+
var CmssyGraphqlError = class extends Error {
|
|
367
|
+
errors;
|
|
368
|
+
code;
|
|
369
|
+
constructor(message, errors) {
|
|
370
|
+
super(message);
|
|
371
|
+
this.name = "CmssyGraphqlError";
|
|
372
|
+
this.errors = errors;
|
|
373
|
+
this.code = errors[0]?.extensions?.code;
|
|
374
|
+
}
|
|
375
|
+
};
|
|
356
376
|
async function postGraphql(url, query, variables, options) {
|
|
357
377
|
const doFetch = options.fetch ?? globalThis.fetch;
|
|
358
378
|
if (typeof doFetch !== "function") {
|
|
@@ -404,7 +424,10 @@ async function postGraphql(url, query, variables, options) {
|
|
|
404
424
|
}
|
|
405
425
|
if (json.errors && json.errors.length > 0) {
|
|
406
426
|
const message = json.errors.map((error) => error.message ?? "GraphQL error").join("; ");
|
|
407
|
-
throw new
|
|
427
|
+
throw new CmssyGraphqlError(
|
|
428
|
+
`cmssy: ${options.label} error - ${message}`,
|
|
429
|
+
json.errors
|
|
430
|
+
);
|
|
408
431
|
}
|
|
409
432
|
return json.data;
|
|
410
433
|
}
|
|
@@ -1125,4 +1148,4 @@ async function verifyCmssyWebhook(options) {
|
|
|
1125
1148
|
return parsed;
|
|
1126
1149
|
}
|
|
1127
1150
|
|
|
1128
|
-
export { CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_EDIT_TOKEN_HEADER, CMSSY_LOCALE_HEADER, CMSSY_RATE_LIMIT_WINDOW_MS, CMSSY_RETRY_MODES, CMSSY_SECRET_QUERY_PARAM, CmssyRequestError, CmssyWebhookError, DEFAULT_CMSSY_API_URL, DEFAULT_CMSSY_EDITOR_ORIGINS, PROTOCOL_VERSION, SHORTCUT_ACTIONS, applyCmssyCsp, blocksToMeta, blocksToSchemas, buildBlockManifest, createCmssyClient, defineCmssyConfig, defineCmssyLayout, fields, graphqlRequest, isFormFieldRequired, isFormFieldVisible, isProtocolCompatible, isTransientRequestError, isVerifiedEditUrl, layoutRegionsToBridge, localizeHref, mediaAlt, mediaDuration, mediaType, mediaUrl, mediaUrls, mintCmssyEditToken, normalizeOrigin, parseEditorMessage, postToEditor, propsToSchema, registryToManifestBlocks, resolveCmssyLocale, resolveEditorOrigin, typedOperation, verifyCmssyEditToken, verifyCmssyWebhook, visibleFormFields };
|
|
1151
|
+
export { CMSSY_EDIT_HEADER, CMSSY_EDIT_QUERY_PARAM, CMSSY_EDIT_TOKEN_HEADER, CMSSY_LOCALE_HEADER, CMSSY_RATE_LIMIT_WINDOW_MS, CMSSY_RETRY_MODES, CMSSY_SECRET_QUERY_PARAM, CmssyGraphqlError, CmssyRequestError, CmssyWebhookError, DEFAULT_CMSSY_API_URL, DEFAULT_CMSSY_EDITOR_ORIGINS, PROTOCOL_VERSION, SHORTCUT_ACTIONS, applyCmssyCsp, blocksToMeta, blocksToSchemas, buildBlockManifest, createCmssyClient, createRetryingFetch, defineCmssyConfig, defineCmssyLayout, fields, graphqlRequest, isFormFieldRequired, isFormFieldVisible, isProtocolCompatible, isTransientRequestError, isVerifiedEditUrl, layoutRegionsToBridge, localizeHref, mediaAlt, mediaDuration, mediaType, mediaUrl, mediaUrls, mintCmssyEditToken, normalizeOrigin, parseEditorMessage, postToEditor, propsToSchema, registryToManifestBlocks, resolveCmssyLocale, resolveEditorOrigin, typedOperation, verifyCmssyEditToken, verifyCmssyWebhook, visibleFormFields };
|
package/dist/internal/locale.cjs
CHANGED
|
@@ -154,7 +154,7 @@ function documentText(document) {
|
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
// src/version.ts
|
|
157
|
-
var CMSSY_CORE_VERSION = "19.
|
|
157
|
+
var CMSSY_CORE_VERSION = "19.6.0" ;
|
|
158
158
|
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
159
159
|
|
|
160
160
|
// src/data/http.ts
|
|
@@ -274,12 +274,22 @@ async function fetchWithRetry(doFetch, url, init, retry, label) {
|
|
|
274
274
|
console.warn(
|
|
275
275
|
`[cmssy] ${label} got ${response.status}, retrying in ${wait}ms (attempt ${attempt + 1}/${policy.maxRetries})`
|
|
276
276
|
);
|
|
277
|
-
await sleep(wait, init
|
|
277
|
+
await sleep(wait, init?.signal);
|
|
278
278
|
waitedMs += wait;
|
|
279
279
|
response = await doFetch(url, init);
|
|
280
280
|
}
|
|
281
281
|
return { response, waitedMs };
|
|
282
282
|
}
|
|
283
|
+
var CmssyGraphqlError = class extends Error {
|
|
284
|
+
errors;
|
|
285
|
+
code;
|
|
286
|
+
constructor(message, errors) {
|
|
287
|
+
super(message);
|
|
288
|
+
this.name = "CmssyGraphqlError";
|
|
289
|
+
this.errors = errors;
|
|
290
|
+
this.code = errors[0]?.extensions?.code;
|
|
291
|
+
}
|
|
292
|
+
};
|
|
283
293
|
async function postGraphql(url, query, variables, options) {
|
|
284
294
|
const doFetch = options.fetch ?? globalThis.fetch;
|
|
285
295
|
if (typeof doFetch !== "function") {
|
|
@@ -331,7 +341,10 @@ async function postGraphql(url, query, variables, options) {
|
|
|
331
341
|
}
|
|
332
342
|
if (json.errors && json.errors.length > 0) {
|
|
333
343
|
const message = json.errors.map((error) => error.message ?? "GraphQL error").join("; ");
|
|
334
|
-
throw new
|
|
344
|
+
throw new CmssyGraphqlError(
|
|
345
|
+
`cmssy: ${options.label} error - ${message}`,
|
|
346
|
+
json.errors
|
|
347
|
+
);
|
|
335
348
|
}
|
|
336
349
|
return json.data;
|
|
337
350
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { a as CMSSY_LOCALE_HEADER, d as localeForPath, e as localeForPathname, l as localizeHref, f as resolveSiteLocales, s as splitCmssyLocale, h as splitLocaleFromPath } from '../locale-
|
|
1
|
+
export { a as CMSSY_LOCALE_HEADER, d as localeForPath, e as localeForPathname, l as localizeHref, f as resolveSiteLocales, s as splitCmssyLocale, h as splitLocaleFromPath } from '../locale-D1ZCb7eA.cjs';
|
|
2
2
|
export { CmssySiteLocales } from '@cmssy/types';
|
|
3
|
-
import '../content-client-
|
|
3
|
+
import '../content-client-BSNwo1SM.cjs';
|
|
4
4
|
|
|
5
5
|
declare function localizedPath(slug: string, locale: string, defaultLocale: string): string;
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { a as CMSSY_LOCALE_HEADER, d as localeForPath, e as localeForPathname, l as localizeHref, f as resolveSiteLocales, s as splitCmssyLocale, h as splitLocaleFromPath } from '../locale-
|
|
1
|
+
export { a as CMSSY_LOCALE_HEADER, d as localeForPath, e as localeForPathname, l as localizeHref, f as resolveSiteLocales, s as splitCmssyLocale, h as splitLocaleFromPath } from '../locale-By_6K3p0.js';
|
|
2
2
|
export { CmssySiteLocales } from '@cmssy/types';
|
|
3
|
-
import '../content-client-
|
|
3
|
+
import '../content-client-BSNwo1SM.js';
|
|
4
4
|
|
|
5
5
|
declare function localizedPath(slug: string, locale: string, defaultLocale: string): string;
|
|
6
6
|
|
package/dist/internal/locale.js
CHANGED
|
@@ -152,7 +152,7 @@ function documentText(document) {
|
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
// src/version.ts
|
|
155
|
-
var CMSSY_CORE_VERSION = "19.
|
|
155
|
+
var CMSSY_CORE_VERSION = "19.6.0" ;
|
|
156
156
|
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
157
157
|
|
|
158
158
|
// src/data/http.ts
|
|
@@ -272,12 +272,22 @@ async function fetchWithRetry(doFetch, url, init, retry, label) {
|
|
|
272
272
|
console.warn(
|
|
273
273
|
`[cmssy] ${label} got ${response.status}, retrying in ${wait}ms (attempt ${attempt + 1}/${policy.maxRetries})`
|
|
274
274
|
);
|
|
275
|
-
await sleep(wait, init
|
|
275
|
+
await sleep(wait, init?.signal);
|
|
276
276
|
waitedMs += wait;
|
|
277
277
|
response = await doFetch(url, init);
|
|
278
278
|
}
|
|
279
279
|
return { response, waitedMs };
|
|
280
280
|
}
|
|
281
|
+
var CmssyGraphqlError = class extends Error {
|
|
282
|
+
errors;
|
|
283
|
+
code;
|
|
284
|
+
constructor(message, errors) {
|
|
285
|
+
super(message);
|
|
286
|
+
this.name = "CmssyGraphqlError";
|
|
287
|
+
this.errors = errors;
|
|
288
|
+
this.code = errors[0]?.extensions?.code;
|
|
289
|
+
}
|
|
290
|
+
};
|
|
281
291
|
async function postGraphql(url, query, variables, options) {
|
|
282
292
|
const doFetch = options.fetch ?? globalThis.fetch;
|
|
283
293
|
if (typeof doFetch !== "function") {
|
|
@@ -329,7 +339,10 @@ async function postGraphql(url, query, variables, options) {
|
|
|
329
339
|
}
|
|
330
340
|
if (json.errors && json.errors.length > 0) {
|
|
331
341
|
const message = json.errors.map((error) => error.message ?? "GraphQL error").join("; ");
|
|
332
|
-
throw new
|
|
342
|
+
throw new CmssyGraphqlError(
|
|
343
|
+
`cmssy: ${options.label} error - ${message}`,
|
|
344
|
+
json.errors
|
|
345
|
+
);
|
|
333
346
|
}
|
|
334
347
|
return json.data;
|
|
335
348
|
}
|
package/dist/internal.cjs
CHANGED
|
@@ -154,7 +154,7 @@ function documentText(document2) {
|
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
// src/version.ts
|
|
157
|
-
var CMSSY_CORE_VERSION = "19.
|
|
157
|
+
var CMSSY_CORE_VERSION = "19.6.0" ;
|
|
158
158
|
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
159
159
|
|
|
160
160
|
// src/data/http.ts
|
|
@@ -274,12 +274,22 @@ async function fetchWithRetry(doFetch, url, init, retry, label) {
|
|
|
274
274
|
console.warn(
|
|
275
275
|
`[cmssy] ${label} got ${response.status}, retrying in ${wait}ms (attempt ${attempt + 1}/${policy.maxRetries})`
|
|
276
276
|
);
|
|
277
|
-
await sleep(wait, init
|
|
277
|
+
await sleep(wait, init?.signal);
|
|
278
278
|
waitedMs += wait;
|
|
279
279
|
response = await doFetch(url, init);
|
|
280
280
|
}
|
|
281
281
|
return { response, waitedMs };
|
|
282
282
|
}
|
|
283
|
+
var CmssyGraphqlError = class extends Error {
|
|
284
|
+
errors;
|
|
285
|
+
code;
|
|
286
|
+
constructor(message, errors) {
|
|
287
|
+
super(message);
|
|
288
|
+
this.name = "CmssyGraphqlError";
|
|
289
|
+
this.errors = errors;
|
|
290
|
+
this.code = errors[0]?.extensions?.code;
|
|
291
|
+
}
|
|
292
|
+
};
|
|
283
293
|
async function postGraphql(url, query, variables, options) {
|
|
284
294
|
const doFetch = options.fetch ?? globalThis.fetch;
|
|
285
295
|
if (typeof doFetch !== "function") {
|
|
@@ -331,7 +341,10 @@ async function postGraphql(url, query, variables, options) {
|
|
|
331
341
|
}
|
|
332
342
|
if (json.errors && json.errors.length > 0) {
|
|
333
343
|
const message = json.errors.map((error) => error.message ?? "GraphQL error").join("; ");
|
|
334
|
-
throw new
|
|
344
|
+
throw new CmssyGraphqlError(
|
|
345
|
+
`cmssy: ${options.label} error - ${message}`,
|
|
346
|
+
json.errors
|
|
347
|
+
);
|
|
335
348
|
}
|
|
336
349
|
return json.data;
|
|
337
350
|
}
|
package/dist/internal.d.cts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { k as fetchLayouts, l as fetchPage, m as fetchPageById, n as fetchPageMeta, o as fetchPages, r as resolveApiUrl } from './content-client-BSNwo1SM.cjs';
|
|
2
2
|
import { CmssyFormDefinition, CmssyModelDefinition, CmssyRecordList, CmssySiteConfig, CmssyFormSubmitResponse, SubmitFormInput, BuildBlockContextExtra, CmssyBlockContext, CmssyClientConfig, FieldDefinition, RawBlock, CmssyLayoutGroup } from '@cmssy/types';
|
|
3
3
|
export { CmssySiteLocales } from '@cmssy/types';
|
|
4
|
-
import { b as CmssyOperation, G as GraphqlRequestOptions } from './locale-
|
|
5
|
-
export { a as CMSSY_LOCALE_HEADER, d as localeForPath, e as localeForPathname, l as localizeHref, f as resolveSiteLocales, s as splitCmssyLocale, h as splitLocaleFromPath } from './locale-
|
|
6
|
-
import { Q as QueryScopedOptions } from './csp-
|
|
7
|
-
export { G as cmssyCspHeaders, H as isDevelopment, J as layoutRegionIds, K as resolveInitialTarget, L as toCspOrigin } from './csp-
|
|
4
|
+
import { b as CmssyOperation, G as GraphqlRequestOptions } from './locale-D1ZCb7eA.cjs';
|
|
5
|
+
export { a as CMSSY_LOCALE_HEADER, d as localeForPath, e as localeForPathname, l as localizeHref, f as resolveSiteLocales, s as splitCmssyLocale, h as splitLocaleFromPath } from './locale-D1ZCb7eA.cjs';
|
|
6
|
+
import { Q as QueryScopedOptions } from './csp-CkxY33mW.cjs';
|
|
7
|
+
export { G as cmssyCspHeaders, H as isDevelopment, J as layoutRegionIds, K as resolveInitialTarget, L as toCspOrigin } from './csp-CkxY33mW.cjs';
|
|
8
8
|
export { localizedPath } from './internal/locale.cjs';
|
|
9
9
|
|
|
10
10
|
interface SiteConfigVariables {
|
package/dist/internal.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { k as fetchLayouts, l as fetchPage, m as fetchPageById, n as fetchPageMeta, o as fetchPages, r as resolveApiUrl } from './content-client-BSNwo1SM.js';
|
|
2
2
|
import { CmssyFormDefinition, CmssyModelDefinition, CmssyRecordList, CmssySiteConfig, CmssyFormSubmitResponse, SubmitFormInput, BuildBlockContextExtra, CmssyBlockContext, CmssyClientConfig, FieldDefinition, RawBlock, CmssyLayoutGroup } from '@cmssy/types';
|
|
3
3
|
export { CmssySiteLocales } from '@cmssy/types';
|
|
4
|
-
import { b as CmssyOperation, G as GraphqlRequestOptions } from './locale-
|
|
5
|
-
export { a as CMSSY_LOCALE_HEADER, d as localeForPath, e as localeForPathname, l as localizeHref, f as resolveSiteLocales, s as splitCmssyLocale, h as splitLocaleFromPath } from './locale-
|
|
6
|
-
import { Q as QueryScopedOptions } from './csp-
|
|
7
|
-
export { G as cmssyCspHeaders, H as isDevelopment, J as layoutRegionIds, K as resolveInitialTarget, L as toCspOrigin } from './csp-
|
|
4
|
+
import { b as CmssyOperation, G as GraphqlRequestOptions } from './locale-By_6K3p0.js';
|
|
5
|
+
export { a as CMSSY_LOCALE_HEADER, d as localeForPath, e as localeForPathname, l as localizeHref, f as resolveSiteLocales, s as splitCmssyLocale, h as splitLocaleFromPath } from './locale-By_6K3p0.js';
|
|
6
|
+
import { Q as QueryScopedOptions } from './csp-vR6v-WmE.js';
|
|
7
|
+
export { G as cmssyCspHeaders, H as isDevelopment, J as layoutRegionIds, K as resolveInitialTarget, L as toCspOrigin } from './csp-vR6v-WmE.js';
|
|
8
8
|
export { localizedPath } from './internal/locale.js';
|
|
9
9
|
|
|
10
10
|
interface SiteConfigVariables {
|
package/dist/internal.js
CHANGED
|
@@ -152,7 +152,7 @@ function documentText(document2) {
|
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
// src/version.ts
|
|
155
|
-
var CMSSY_CORE_VERSION = "19.
|
|
155
|
+
var CMSSY_CORE_VERSION = "19.6.0" ;
|
|
156
156
|
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
157
157
|
|
|
158
158
|
// src/data/http.ts
|
|
@@ -272,12 +272,22 @@ async function fetchWithRetry(doFetch, url, init, retry, label) {
|
|
|
272
272
|
console.warn(
|
|
273
273
|
`[cmssy] ${label} got ${response.status}, retrying in ${wait}ms (attempt ${attempt + 1}/${policy.maxRetries})`
|
|
274
274
|
);
|
|
275
|
-
await sleep(wait, init
|
|
275
|
+
await sleep(wait, init?.signal);
|
|
276
276
|
waitedMs += wait;
|
|
277
277
|
response = await doFetch(url, init);
|
|
278
278
|
}
|
|
279
279
|
return { response, waitedMs };
|
|
280
280
|
}
|
|
281
|
+
var CmssyGraphqlError = class extends Error {
|
|
282
|
+
errors;
|
|
283
|
+
code;
|
|
284
|
+
constructor(message, errors) {
|
|
285
|
+
super(message);
|
|
286
|
+
this.name = "CmssyGraphqlError";
|
|
287
|
+
this.errors = errors;
|
|
288
|
+
this.code = errors[0]?.extensions?.code;
|
|
289
|
+
}
|
|
290
|
+
};
|
|
281
291
|
async function postGraphql(url, query, variables, options) {
|
|
282
292
|
const doFetch = options.fetch ?? globalThis.fetch;
|
|
283
293
|
if (typeof doFetch !== "function") {
|
|
@@ -329,7 +339,10 @@ async function postGraphql(url, query, variables, options) {
|
|
|
329
339
|
}
|
|
330
340
|
if (json.errors && json.errors.length > 0) {
|
|
331
341
|
const message = json.errors.map((error) => error.message ?? "GraphQL error").join("; ");
|
|
332
|
-
throw new
|
|
342
|
+
throw new CmssyGraphqlError(
|
|
343
|
+
`cmssy: ${options.label} error - ${message}`,
|
|
344
|
+
json.errors
|
|
345
|
+
);
|
|
333
346
|
}
|
|
334
347
|
return json.data;
|
|
335
348
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CmssyClientConfig, CmssyLocaleContext, CmssySiteLocales } from '@cmssy/types';
|
|
2
|
-
import { F as FetchLike, R as RetryOption } from './content-client-
|
|
2
|
+
import { F as FetchLike, R as RetryOption } from './content-client-BSNwo1SM.js';
|
|
3
3
|
|
|
4
4
|
interface CmssyTypedDocument<Result, Variables> {
|
|
5
5
|
__apiType?: (variables: Variables) => Result;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CmssyClientConfig, CmssyLocaleContext, CmssySiteLocales } from '@cmssy/types';
|
|
2
|
-
import { F as FetchLike, R as RetryOption } from './content-client-
|
|
2
|
+
import { F as FetchLike, R as RetryOption } from './content-client-BSNwo1SM.cjs';
|
|
3
3
|
|
|
4
4
|
interface CmssyTypedDocument<Result, Variables> {
|
|
5
5
|
__apiType?: (variables: Variables) => Result;
|
package/dist/preflight.cjs
CHANGED
package/dist/preflight.d.cts
CHANGED
package/dist/preflight.d.ts
CHANGED
package/dist/preflight.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cmssy/core",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.6.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",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"vitest": "^2.1.0"
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
|
-
"@cmssy/types": "0.
|
|
90
|
+
"@cmssy/types": "0.60.0",
|
|
91
91
|
"jose": "^6.2.3"
|
|
92
92
|
},
|
|
93
93
|
"scripts": {
|