@cmssy/core 9.9.0 → 10.0.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/csp-DDVG6VAm.d.cts +189 -0
- package/dist/csp-DpssAFJC.d.ts +189 -0
- package/dist/graphql-request-CDh6IRok.d.ts +23 -0
- package/dist/graphql-request-NQxSMt6v.d.cts +23 -0
- package/dist/index.cjs +21 -1410
- package/dist/index.d.cts +7 -400
- package/dist/index.d.ts +7 -400
- package/dist/index.js +22 -1331
- package/dist/internal/locale.cjs +279 -0
- package/dist/internal/locale.d.cts +56 -0
- package/dist/internal/locale.d.ts +56 -0
- package/dist/internal/locale.js +267 -0
- package/dist/internal.cjs +939 -0
- package/dist/internal.d.cts +62 -0
- package/dist/internal.d.ts +62 -0
- package/dist/internal.js +898 -0
- package/package.json +12 -2
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export { f as fetchLayouts, c as fetchPage, d as fetchPageById, e as fetchPageMeta, g as fetchPages, n as normalizeSlug, r as resolveApiUrl, h as resolvePublicUrl } from './content-client-D0EdiqbQ.cjs';
|
|
2
|
+
import { CmssyClientConfig, CmssySiteConfig, RawBlock, CmssyFormDefinition, FieldDefinition } from '@cmssy/types';
|
|
3
|
+
export { CmssySiteLocales } from '@cmssy/types';
|
|
4
|
+
import { G as GraphqlRequestOptions } from './graphql-request-NQxSMt6v.cjs';
|
|
5
|
+
import { Q as QueryScopedOptions } from './csp-DDVG6VAm.cjs';
|
|
6
|
+
export { m as cmssyCspHeaders, o as isDevelopment, q as resolveInitialTarget, t as toCspOrigin } from './csp-DDVG6VAm.cjs';
|
|
7
|
+
export { CMSSY_LOCALE_HEADER, buildLocaleSwitchHref, localeForPath, localeForPathname, localesFromSiteConfig, localizeHref, localizeHtmlLinks, localizedPath, resolveSiteLocales, splitCmssyLocale, splitLocaleFromPath } from './internal/locale.cjs';
|
|
8
|
+
|
|
9
|
+
declare const SITE_CONFIG_QUERY = "query PublicSiteConfig($workspaceSlug: String!) {\n public {\n siteConfig(workspaceSlug: $workspaceSlug) {\n id\n workspaceId\n siteName\n defaultLanguage\n enabledLanguages\n enabledFeatures\n notFoundPageId\n previewUrl\n branding {\n brandName\n logoUrl\n faviconUrl\n ogImageUrl\n }\n }\n }\n}";
|
|
10
|
+
declare const MODEL_DEFINITIONS_QUERY = "query PublicModelDefinitions($workspaceId: String!) {\n public {\n model {\n definitions(workspaceId: $workspaceId) {\n id name slug description icon color displayField recordCount\n }\n }\n }\n}";
|
|
11
|
+
declare const MODEL_RECORDS_QUERY = "query PublicModelRecords($workspaceId: String!, $modelSlug: String!, $filter: JSON, $sort: String, $locale: String, $limit: Int, $offset: Int, $populate: [String!]) {\n public {\n model {\n records(workspaceId: $workspaceId, modelSlug: $modelSlug, filter: $filter, sort: $sort, locale: $locale, limit: $limit, offset: $offset, populate: $populate) {\n items { id modelId data status createdAt updatedAt }\n total\n hasMore\n }\n }\n }\n}";
|
|
12
|
+
declare const FORM_QUERY = "query PublicForm($formId: ID!) {\n public {\n form {\n get(formId: $formId) {\n id\n name\n slug\n description\n fields {\n id name fieldType label placeholder helpText\n defaultValue width order showWhen requiredWhen\n options { value label disabled }\n validation { required minLength maxLength minValue maxValue pattern customMessage }\n }\n settings {\n actionType submitButtonLabel successMessage errorMessage\n redirectUrl requireLogin enableCaptcha\n }\n }\n }\n }\n}";
|
|
13
|
+
declare const SUBMIT_FORM_MUTATION = "mutation SubmitForm($formId: ID!, $input: SubmitFormInput!) {\n public {\n form {\n submit(formId: $formId, input: $input) {\n success message submissionId redirectUrl accessToken customer\n }\n }\n }\n}";
|
|
14
|
+
|
|
15
|
+
declare function getBlockContentForLanguage(content: unknown, locale: string, defaultLocale?: string, availableLocales?: string[]): Record<string, unknown>;
|
|
16
|
+
/**
|
|
17
|
+
* Coerce a block bucket (`style` / `advanced`) to a plain object. These buckets
|
|
18
|
+
* are flat (not locale-keyed) and free-form; a missing/invalid bucket becomes
|
|
19
|
+
* an empty object so components can destructure it safely.
|
|
20
|
+
*/
|
|
21
|
+
declare function asBucket(value: unknown): Record<string, unknown>;
|
|
22
|
+
|
|
23
|
+
declare function fetchSiteConfig(config: CmssyClientConfig, options?: GraphqlRequestOptions): Promise<CmssySiteConfig | null>;
|
|
24
|
+
declare function resolveWorkspaceId(config: CmssyClientConfig, options?: GraphqlRequestOptions): Promise<string>;
|
|
25
|
+
/**
|
|
26
|
+
* Every authenticated operation needs the workspace id, and it never changes for
|
|
27
|
+
* a given (endpoint, workspace) pair - so it is resolved once and shared. A
|
|
28
|
+
* failed lookup is evicted, otherwise one bad request would be cached forever.
|
|
29
|
+
*/
|
|
30
|
+
declare function cachedWorkspaceId(config: CmssyClientConfig): Promise<string>;
|
|
31
|
+
declare function clearWorkspaceIdCache(): void;
|
|
32
|
+
|
|
33
|
+
declare function collectFormIds(blocks: RawBlock[], locale: string, defaultLocale: string): string[];
|
|
34
|
+
declare function resolveForms(config: CmssyClientConfig, blocks: RawBlock[], locale: string, defaultLocale: string, options?: QueryScopedOptions): Promise<Record<string, CmssyFormDefinition>>;
|
|
35
|
+
|
|
36
|
+
declare const RECORDS_BY_IDS_QUERY = "query PublicRecordsByIds($workspaceId: String!, $ids: [String!]!, $locale: String) {\n public {\n model {\n recordsByIds(workspaceId: $workspaceId, ids: $ids, locale: $locale) {\n id modelId data status createdAt updatedAt\n }\n }\n }\n}";
|
|
37
|
+
interface RelationContentEntry {
|
|
38
|
+
type: string;
|
|
39
|
+
content: Record<string, unknown>;
|
|
40
|
+
}
|
|
41
|
+
type BlockSchemaMap = Record<string, Record<string, FieldDefinition>>;
|
|
42
|
+
/**
|
|
43
|
+
* The editor canvas renders stored content without the server-side resolve, so
|
|
44
|
+
* a relation field there holds raw ids - or the "" a freshly inserted block is
|
|
45
|
+
* seeded with. A component is typed against resolved records, so anything that
|
|
46
|
+
* is not one falls back to the server-resolved value for that key (the admin
|
|
47
|
+
* hydrates the canvas with raw stored content, clobbering it), and only then
|
|
48
|
+
* to the safe empty shape.
|
|
49
|
+
*/
|
|
50
|
+
declare function normalizeRelationContent(content: Record<string, unknown>, schema: Record<string, FieldDefinition>, resolved?: Record<string, unknown>): void;
|
|
51
|
+
/**
|
|
52
|
+
* Resolves every `fields.relation` value on the given block contents in place:
|
|
53
|
+
* stored record ids become full records (one batched read for the whole page),
|
|
54
|
+
* and a `mode: "all"` field becomes the model's record list. A dangling id and
|
|
55
|
+
* a failed fetch both degrade to "no value" - a relation must never break a
|
|
56
|
+
* render.
|
|
57
|
+
*/
|
|
58
|
+
declare function resolveRelationContent(config: CmssyClientConfig, entries: RelationContentEntry[], schemas: BlockSchemaMap, locale?: string, requestOptions?: QueryScopedOptions): Promise<void>;
|
|
59
|
+
|
|
60
|
+
declare function cmssySecretsMatch(a: string, b: string): Promise<boolean>;
|
|
61
|
+
|
|
62
|
+
export { type BlockSchemaMap, FORM_QUERY, MODEL_DEFINITIONS_QUERY, MODEL_RECORDS_QUERY, RECORDS_BY_IDS_QUERY, type RelationContentEntry, SITE_CONFIG_QUERY, SUBMIT_FORM_MUTATION, asBucket, cachedWorkspaceId, clearWorkspaceIdCache, cmssySecretsMatch, collectFormIds, fetchSiteConfig, getBlockContentForLanguage, normalizeRelationContent, resolveForms, resolveRelationContent, resolveWorkspaceId };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export { f as fetchLayouts, c as fetchPage, d as fetchPageById, e as fetchPageMeta, g as fetchPages, n as normalizeSlug, r as resolveApiUrl, h as resolvePublicUrl } from './content-client-D0EdiqbQ.js';
|
|
2
|
+
import { CmssyClientConfig, CmssySiteConfig, RawBlock, CmssyFormDefinition, FieldDefinition } from '@cmssy/types';
|
|
3
|
+
export { CmssySiteLocales } from '@cmssy/types';
|
|
4
|
+
import { G as GraphqlRequestOptions } from './graphql-request-CDh6IRok.js';
|
|
5
|
+
import { Q as QueryScopedOptions } from './csp-DpssAFJC.js';
|
|
6
|
+
export { m as cmssyCspHeaders, o as isDevelopment, q as resolveInitialTarget, t as toCspOrigin } from './csp-DpssAFJC.js';
|
|
7
|
+
export { CMSSY_LOCALE_HEADER, buildLocaleSwitchHref, localeForPath, localeForPathname, localesFromSiteConfig, localizeHref, localizeHtmlLinks, localizedPath, resolveSiteLocales, splitCmssyLocale, splitLocaleFromPath } from './internal/locale.js';
|
|
8
|
+
|
|
9
|
+
declare const SITE_CONFIG_QUERY = "query PublicSiteConfig($workspaceSlug: String!) {\n public {\n siteConfig(workspaceSlug: $workspaceSlug) {\n id\n workspaceId\n siteName\n defaultLanguage\n enabledLanguages\n enabledFeatures\n notFoundPageId\n previewUrl\n branding {\n brandName\n logoUrl\n faviconUrl\n ogImageUrl\n }\n }\n }\n}";
|
|
10
|
+
declare const MODEL_DEFINITIONS_QUERY = "query PublicModelDefinitions($workspaceId: String!) {\n public {\n model {\n definitions(workspaceId: $workspaceId) {\n id name slug description icon color displayField recordCount\n }\n }\n }\n}";
|
|
11
|
+
declare const MODEL_RECORDS_QUERY = "query PublicModelRecords($workspaceId: String!, $modelSlug: String!, $filter: JSON, $sort: String, $locale: String, $limit: Int, $offset: Int, $populate: [String!]) {\n public {\n model {\n records(workspaceId: $workspaceId, modelSlug: $modelSlug, filter: $filter, sort: $sort, locale: $locale, limit: $limit, offset: $offset, populate: $populate) {\n items { id modelId data status createdAt updatedAt }\n total\n hasMore\n }\n }\n }\n}";
|
|
12
|
+
declare const FORM_QUERY = "query PublicForm($formId: ID!) {\n public {\n form {\n get(formId: $formId) {\n id\n name\n slug\n description\n fields {\n id name fieldType label placeholder helpText\n defaultValue width order showWhen requiredWhen\n options { value label disabled }\n validation { required minLength maxLength minValue maxValue pattern customMessage }\n }\n settings {\n actionType submitButtonLabel successMessage errorMessage\n redirectUrl requireLogin enableCaptcha\n }\n }\n }\n }\n}";
|
|
13
|
+
declare const SUBMIT_FORM_MUTATION = "mutation SubmitForm($formId: ID!, $input: SubmitFormInput!) {\n public {\n form {\n submit(formId: $formId, input: $input) {\n success message submissionId redirectUrl accessToken customer\n }\n }\n }\n}";
|
|
14
|
+
|
|
15
|
+
declare function getBlockContentForLanguage(content: unknown, locale: string, defaultLocale?: string, availableLocales?: string[]): Record<string, unknown>;
|
|
16
|
+
/**
|
|
17
|
+
* Coerce a block bucket (`style` / `advanced`) to a plain object. These buckets
|
|
18
|
+
* are flat (not locale-keyed) and free-form; a missing/invalid bucket becomes
|
|
19
|
+
* an empty object so components can destructure it safely.
|
|
20
|
+
*/
|
|
21
|
+
declare function asBucket(value: unknown): Record<string, unknown>;
|
|
22
|
+
|
|
23
|
+
declare function fetchSiteConfig(config: CmssyClientConfig, options?: GraphqlRequestOptions): Promise<CmssySiteConfig | null>;
|
|
24
|
+
declare function resolveWorkspaceId(config: CmssyClientConfig, options?: GraphqlRequestOptions): Promise<string>;
|
|
25
|
+
/**
|
|
26
|
+
* Every authenticated operation needs the workspace id, and it never changes for
|
|
27
|
+
* a given (endpoint, workspace) pair - so it is resolved once and shared. A
|
|
28
|
+
* failed lookup is evicted, otherwise one bad request would be cached forever.
|
|
29
|
+
*/
|
|
30
|
+
declare function cachedWorkspaceId(config: CmssyClientConfig): Promise<string>;
|
|
31
|
+
declare function clearWorkspaceIdCache(): void;
|
|
32
|
+
|
|
33
|
+
declare function collectFormIds(blocks: RawBlock[], locale: string, defaultLocale: string): string[];
|
|
34
|
+
declare function resolveForms(config: CmssyClientConfig, blocks: RawBlock[], locale: string, defaultLocale: string, options?: QueryScopedOptions): Promise<Record<string, CmssyFormDefinition>>;
|
|
35
|
+
|
|
36
|
+
declare const RECORDS_BY_IDS_QUERY = "query PublicRecordsByIds($workspaceId: String!, $ids: [String!]!, $locale: String) {\n public {\n model {\n recordsByIds(workspaceId: $workspaceId, ids: $ids, locale: $locale) {\n id modelId data status createdAt updatedAt\n }\n }\n }\n}";
|
|
37
|
+
interface RelationContentEntry {
|
|
38
|
+
type: string;
|
|
39
|
+
content: Record<string, unknown>;
|
|
40
|
+
}
|
|
41
|
+
type BlockSchemaMap = Record<string, Record<string, FieldDefinition>>;
|
|
42
|
+
/**
|
|
43
|
+
* The editor canvas renders stored content without the server-side resolve, so
|
|
44
|
+
* a relation field there holds raw ids - or the "" a freshly inserted block is
|
|
45
|
+
* seeded with. A component is typed against resolved records, so anything that
|
|
46
|
+
* is not one falls back to the server-resolved value for that key (the admin
|
|
47
|
+
* hydrates the canvas with raw stored content, clobbering it), and only then
|
|
48
|
+
* to the safe empty shape.
|
|
49
|
+
*/
|
|
50
|
+
declare function normalizeRelationContent(content: Record<string, unknown>, schema: Record<string, FieldDefinition>, resolved?: Record<string, unknown>): void;
|
|
51
|
+
/**
|
|
52
|
+
* Resolves every `fields.relation` value on the given block contents in place:
|
|
53
|
+
* stored record ids become full records (one batched read for the whole page),
|
|
54
|
+
* and a `mode: "all"` field becomes the model's record list. A dangling id and
|
|
55
|
+
* a failed fetch both degrade to "no value" - a relation must never break a
|
|
56
|
+
* render.
|
|
57
|
+
*/
|
|
58
|
+
declare function resolveRelationContent(config: CmssyClientConfig, entries: RelationContentEntry[], schemas: BlockSchemaMap, locale?: string, requestOptions?: QueryScopedOptions): Promise<void>;
|
|
59
|
+
|
|
60
|
+
declare function cmssySecretsMatch(a: string, b: string): Promise<boolean>;
|
|
61
|
+
|
|
62
|
+
export { type BlockSchemaMap, FORM_QUERY, MODEL_DEFINITIONS_QUERY, MODEL_RECORDS_QUERY, RECORDS_BY_IDS_QUERY, type RelationContentEntry, SITE_CONFIG_QUERY, SUBMIT_FORM_MUTATION, asBucket, cachedWorkspaceId, clearWorkspaceIdCache, cmssySecretsMatch, collectFormIds, fetchSiteConfig, getBlockContentForLanguage, normalizeRelationContent, resolveForms, resolveRelationContent, resolveWorkspaceId };
|