cmx-sdk 0.1.14 → 0.1.16
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/cli.js +0 -40
- package/dist/index.d.ts +3 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -757,45 +757,6 @@ async function syncComponents(args, apiUrl, apiKey) {
|
|
|
757
757
|
if (result.updated) console.log(` Updated: ${result.updated}`);
|
|
758
758
|
}
|
|
759
759
|
|
|
760
|
-
// src/commands/import-schema.ts
|
|
761
|
-
async function importSchema(args, apiUrl, apiKey) {
|
|
762
|
-
const input = readJsonInput(args);
|
|
763
|
-
const collections = input.collections ?? [];
|
|
764
|
-
const dataTypes = input.dataTypes ?? [];
|
|
765
|
-
if (collections.length === 0 && dataTypes.length === 0) {
|
|
766
|
-
console.error("Error: JSON must include at least one collection or dataType");
|
|
767
|
-
process.exit(1);
|
|
768
|
-
}
|
|
769
|
-
console.log(`Importing schema: ${collections.length} collections, ${dataTypes.length} data types`);
|
|
770
|
-
let created = 0;
|
|
771
|
-
let failed = 0;
|
|
772
|
-
for (const collection of collections) {
|
|
773
|
-
try {
|
|
774
|
-
await postManageCollections(collection);
|
|
775
|
-
console.log(` [OK] Collection: ${collection.slug}`);
|
|
776
|
-
created++;
|
|
777
|
-
} catch (err) {
|
|
778
|
-
console.error(` [FAIL] Collection: ${collection.slug} \u2014 ${err instanceof Error ? err.message : err}`);
|
|
779
|
-
failed++;
|
|
780
|
-
}
|
|
781
|
-
}
|
|
782
|
-
for (const dataType of dataTypes) {
|
|
783
|
-
try {
|
|
784
|
-
await postManageDataTypes(dataType);
|
|
785
|
-
console.log(` [OK] Data type: ${dataType.slug}`);
|
|
786
|
-
created++;
|
|
787
|
-
} catch (err) {
|
|
788
|
-
console.error(` [FAIL] Data type: ${dataType.slug} \u2014 ${err instanceof Error ? err.message : err}`);
|
|
789
|
-
failed++;
|
|
790
|
-
}
|
|
791
|
-
}
|
|
792
|
-
console.log(`
|
|
793
|
-
Done: ${created} created, ${failed} failed`);
|
|
794
|
-
if (failed > 0) {
|
|
795
|
-
process.exit(1);
|
|
796
|
-
}
|
|
797
|
-
}
|
|
798
|
-
|
|
799
760
|
// src/commands/generate.ts
|
|
800
761
|
import * as fs from "fs";
|
|
801
762
|
import * as path from "path";
|
|
@@ -962,7 +923,6 @@ program.command("create-collection").description("Create a new collection").opti
|
|
|
962
923
|
program.command("create-data-type").description("Create a new data type").option("--json <json>", "JSON string with data type data (recommended)").option("--slug <slug>", "Data type slug").option("--name <name>", "Data type name").option("--description <description>", "Data type description").action(createDataType);
|
|
963
924
|
program.command("create-form").description("Create a new form definition").option("--json <json>", "JSON string with form data (recommended)").option("--slug <slug>", "Form slug").option("--name <name>", "Form name").option("--description <description>", "Form description").action(createForm);
|
|
964
925
|
program.command("sync-components").description("Sync custom components").option("--file <file>", "Path to JSON file with components").option("--json <json>", "JSON string with components data").action(syncComponents);
|
|
965
|
-
program.command("import-schema").description("Import collections, data types, and forms from a schema file").requiredOption("--file <file>", "Path to schema JSON file").action(importSchema);
|
|
966
926
|
program.command("generate").description("Generate TypeScript types and functions from CMX schema").option("--output <dir>", "Output directory (default: cmx/generated)").action(generate);
|
|
967
927
|
program.command("update-collection").description("Update an existing collection").requiredOption("--slug <slug>", "Current slug of the collection").option("--json <json>", "JSON string with update data").option("--new-slug <slug>", "New slug").option("--name <name>", "New name").option("--description <description>", "New description").action(updateCollection);
|
|
968
928
|
program.command("delete-collection").description("Delete a collection").requiredOption("--slug <slug>", "Collection slug").option("--force", "Skip confirmation prompt").option("--cascade", "Also delete associated content").action(deleteCollection);
|
package/dist/index.d.ts
CHANGED
|
@@ -762,7 +762,7 @@ type GetManageDataTypeSlugParams = {
|
|
|
762
762
|
* CMX SDK API(コンテンツ配信+管理)
|
|
763
763
|
* OpenAPI spec version: 1.0.0
|
|
764
764
|
*/
|
|
765
|
-
type
|
|
765
|
+
type GetPreviewToken200Content = {
|
|
766
766
|
id: string;
|
|
767
767
|
slug: string;
|
|
768
768
|
title: string;
|
|
@@ -866,7 +866,7 @@ type GetPreviewToken200References = {
|
|
|
866
866
|
*/
|
|
867
867
|
|
|
868
868
|
type GetPreviewToken200 = {
|
|
869
|
-
|
|
869
|
+
content: GetPreviewToken200Content;
|
|
870
870
|
/** @nullable */
|
|
871
871
|
collection: GetPreviewToken200Collection;
|
|
872
872
|
references: GetPreviewToken200References;
|
|
@@ -2027,4 +2027,4 @@ declare function renderMdx(mdx: string, references?: References, options?: Rende
|
|
|
2027
2027
|
*/
|
|
2028
2028
|
declare function renderMdxPreview(mdx: string, additionalComponents?: Record<string, React.ComponentType<any>>): Promise<React.ReactElement>;
|
|
2029
2029
|
|
|
2030
|
-
export { type ApiResponse, type AssetReference, type AssetReferenceVariants, BlogCard, Button, CACHE_TAGS, Callout, type CollectionConfig, type CollectionConfigDefaults, type CollectionContentDetailResponse, type CollectionContentsResponse, type CollectionListResponse, type CollectionResponse, CollectionType, type ComponentDefinition, type ComponentName, type ContentReference, type CreateCollectionRequest, type CreateDataTypeRequest, type CreateFormDefinitionRequest, type DataEntryItem, type DataListResponse, type DataTypeConfig, type DataTypeResponse, Embed, type ErrorResponse, type ErrorResponseDetails, type FieldDefinition, type FieldOptions, type FieldOptionsChoicesItem, FieldType, type FormDefinitionResponse, type FormDefinitionResponseConfigJson, type GetDataTypeSlugParams, GetDataTypeSlugSortBy, GetDataTypeSlugSortOrder, type GetManageDataTypeSlugParams, GetManageDataTypeSlugSortBy, GetManageDataTypeSlugSortOrder, GetManageDataTypeSlugStatus, type GetPreviewToken200, type GetPreviewToken200Collection, type
|
|
2030
|
+
export { type ApiResponse, type AssetReference, type AssetReferenceVariants, BlogCard, Button, CACHE_TAGS, Callout, type CollectionConfig, type CollectionConfigDefaults, type CollectionContentDetailResponse, type CollectionContentsResponse, type CollectionListResponse, type CollectionResponse, CollectionType, type ComponentDefinition, type ComponentName, type ContentReference, type CreateCollectionRequest, type CreateDataTypeRequest, type CreateFormDefinitionRequest, type DataEntryItem, type DataListResponse, type DataTypeConfig, type DataTypeResponse, Embed, type ErrorResponse, type ErrorResponseDetails, type FieldDefinition, type FieldOptions, type FieldOptionsChoicesItem, FieldType, type FormDefinitionResponse, type FormDefinitionResponseConfigJson, type GetDataTypeSlugParams, GetDataTypeSlugSortBy, GetDataTypeSlugSortOrder, type GetManageDataTypeSlugParams, GetManageDataTypeSlugSortBy, GetManageDataTypeSlugSortOrder, GetManageDataTypeSlugStatus, type GetPreviewToken200, type GetPreviewToken200Collection, type GetPreviewToken200Content, type GetPreviewToken200References, type GetPreviewToken200ReferencesAssets, type GetPreviewToken200ReferencesAssetsVariants, type GetPreviewToken200ReferencesContents, Image, type PreviewResponse, type PublicCollectionInfo, type PublicContentDetail, type PublicContentListItem, type PublicContentParent, type PublicFetcherOptions, type PublicSubmissionRequest, type PublicSubmissionRequestData, type PublicSubmissionResponse, type References, type ReferencesAssets, type ReferencesContents, type RenderOptions, type RenderResult, type ResolvedReferences, type RevalidationConfig, type SchemaCollection, type SchemaDataType, type SchemaFieldDefinition, type SchemaFieldOption, type SchemaFieldOptionChoicesItem, type SchemaFormDefinition, type SchemaResponse, type SdkComponentDefinition, type SdkComponentDefinitionPropsSchema, type SdkComponentProp, type SdkComponentPropDefault, type SdkComponentSuccessResponse, type SdkComponentSyncRequest, type SdkCreateEntryRequest, type SdkCreateEntryRequestDataJson, SdkCreateEntryRequestStatus, type SdkCustomComponentResponse, type SdkCustomComponentResponsePropsSchema, type SdkCustomComponentsListResponse, type SdkDataEntriesListResponse, type SdkDataEntryDetailResponse, type SdkDataEntryResponse, type SdkDataEntryResponseCreatedAt, type SdkDataEntryResponseDataJson, SdkDataEntryResponseStatus, type SdkDataEntryResponseUpdatedAt, type SdkDataTypeInfo, type SdkDeleteCollectionResponse, type SdkDeleteDataEntryResponse, type SdkDeleteDataTypeResponse, type SdkDeleteFormDefinitionResponse, type SdkUpdateEntryRequest, type SdkUpdateEntryRequestDataJson, SdkUpdateEntryRequestStatus, type UpdateCollectionRequest, type UpdateDataTypeRequest, type UpdateFormDefinitionRequest, type UpdateFormDefinitionRequestConfigJson, type ValidationError, type ValidationResult, basicComponents, componentCatalog, componentSchemas, customComponents, getCatalogForAI, getCollectionContentDetail, getCollectionContentDetailOrThrow, getCollectionContents, getCollectionContentsOrThrow, getCollectionsSlugContents, getCollectionsSlugContentsContentSlug, getComponentsByCategory, getComponentsWithReferences, getDataEntries, getDataEntriesOrThrow, getDataEntry, getDataEntryOrThrow, getDataTypeSlug, getGetCollectionsSlugContentsContentSlugUrl, getGetCollectionsSlugContentsUrl, getGetDataTypeSlugUrl, getGetPreviewTokenUrl, getPreviewByToken, getPreviewToken, getSdkApiBaseUrl, getSdkApiToken, isValidComponent, markdownComponents, mdxComponents, quickValidateMdx, renderMdx, renderMdxPreview, sdkCustomInstance, sdkFetchWithTags, sdkFetcher, sdkPostFetcher, submitFormData, validateComponentProps, validateMdx };
|