cmx-sdk 0.2.22 → 0.2.23
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/add-studio-2COHXK65.js +0 -0
- package/dist/chunk-2WLUAJR2.js +0 -0
- package/dist/chunk-7TDMLYBI.js +0 -0
- package/dist/chunk-EDXXR5BE.js +0 -0
- package/dist/chunk-IIQLQIDP.js +0 -0
- package/dist/chunk-NZQ6SBFS.js +0 -0
- package/dist/chunk-WJ5REY5E.js +0 -0
- package/dist/chunk-Y3S3K6M3.js +0 -0
- package/dist/chunk-YYDYSBN7.js +0 -0
- package/dist/index.d.ts +69 -1
- package/dist/index.js +53 -1
- package/dist/index.js.map +1 -1
- package/dist/init-FPFDEEXW.js +0 -0
- package/dist/interactive-menu-R3TJZOMK.js +0 -0
- package/dist/report-bug-WSGGML4H.js +0 -0
- package/dist/studio-HAS6DYLO.js +0 -0
- package/dist/update-sdk-ZXMWQF3I.js +0 -0
- package/dist/update-studio-QSBDG7ZI.js +0 -0
- package/package.json +15 -16
|
File without changes
|
package/dist/chunk-2WLUAJR2.js
CHANGED
|
File without changes
|
package/dist/chunk-7TDMLYBI.js
CHANGED
|
File without changes
|
package/dist/chunk-EDXXR5BE.js
CHANGED
|
File without changes
|
package/dist/chunk-IIQLQIDP.js
CHANGED
|
File without changes
|
package/dist/chunk-NZQ6SBFS.js
CHANGED
|
File without changes
|
package/dist/chunk-WJ5REY5E.js
CHANGED
|
File without changes
|
package/dist/chunk-Y3S3K6M3.js
CHANGED
|
File without changes
|
package/dist/chunk-YYDYSBN7.js
CHANGED
|
File without changes
|
package/dist/index.d.ts
CHANGED
|
@@ -69,6 +69,16 @@ declare function sdkCustomInstance<T>(url: string, options?: RequestInit): Promi
|
|
|
69
69
|
* Next.js ISR/on-demand revalidation対応
|
|
70
70
|
*/
|
|
71
71
|
declare function sdkFetchWithTags<T>(path: string, tags?: string[], revalidate?: number | false): Promise<T>;
|
|
72
|
+
/**
|
|
73
|
+
* MCP APIのベースURL取得
|
|
74
|
+
*/
|
|
75
|
+
declare function getMcpApiBaseUrl(): string;
|
|
76
|
+
/**
|
|
77
|
+
* キャッシュタグ付きのMCP APIリクエスト用ラッパー
|
|
78
|
+
* Next.js ISR/on-demand revalidation対応
|
|
79
|
+
* アセット取得など、MCP APIエンドポイントへのアクセスに使用
|
|
80
|
+
*/
|
|
81
|
+
declare function mcpFetchWithTags<T>(path: string, tags?: string[], revalidate?: number | false): Promise<T>;
|
|
72
82
|
/**
|
|
73
83
|
* SDK API用のPOSTリクエストfetcher
|
|
74
84
|
* サーバーサイド(Server Action等)から使用
|
|
@@ -90,6 +100,10 @@ declare const CACHE_TAGS: {
|
|
|
90
100
|
readonly data: "data";
|
|
91
101
|
/** 特定データタイプ */
|
|
92
102
|
readonly dataType: (slug: string) => string;
|
|
103
|
+
/** 全アセット共通 */
|
|
104
|
+
readonly assets: "assets";
|
|
105
|
+
/** 特定グループのアセット */
|
|
106
|
+
readonly assetGroup: (group: string) => string;
|
|
93
107
|
};
|
|
94
108
|
|
|
95
109
|
/**
|
|
@@ -3413,6 +3427,60 @@ declare function fetchRuntimeSettings(): Promise<SdkRuntimeSettingsResponse>;
|
|
|
3413
3427
|
* Get daily analytics metrics collected by CMX.
|
|
3414
3428
|
*/
|
|
3415
3429
|
declare function fetchAnalyticsDailyMetrics(params?: GetAnalyticsDailyParams): Promise<SdkAnalyticsDailyListResponse>;
|
|
3430
|
+
/**
|
|
3431
|
+
* Asset item returned from the assets search API
|
|
3432
|
+
*/
|
|
3433
|
+
interface AssetItem {
|
|
3434
|
+
id: string;
|
|
3435
|
+
url: string;
|
|
3436
|
+
alt: string | null;
|
|
3437
|
+
description: string | null;
|
|
3438
|
+
aiSummary: string | null;
|
|
3439
|
+
width: number | null;
|
|
3440
|
+
height: number | null;
|
|
3441
|
+
mime: string;
|
|
3442
|
+
size: number;
|
|
3443
|
+
variants: Record<string, string>;
|
|
3444
|
+
groupId: string | null;
|
|
3445
|
+
createdAt: string;
|
|
3446
|
+
tags: Array<{
|
|
3447
|
+
name: string;
|
|
3448
|
+
}>;
|
|
3449
|
+
group: {
|
|
3450
|
+
slug: string;
|
|
3451
|
+
name: string;
|
|
3452
|
+
} | null;
|
|
3453
|
+
}
|
|
3454
|
+
/**
|
|
3455
|
+
* Response from the assets search API
|
|
3456
|
+
*/
|
|
3457
|
+
interface AssetsResponse {
|
|
3458
|
+
assets: AssetItem[];
|
|
3459
|
+
pagination: {
|
|
3460
|
+
total: number;
|
|
3461
|
+
limit: number;
|
|
3462
|
+
offset: number;
|
|
3463
|
+
};
|
|
3464
|
+
}
|
|
3465
|
+
/**
|
|
3466
|
+
* Options for fetching assets
|
|
3467
|
+
*/
|
|
3468
|
+
interface AssetsOptions extends FetchOptions {
|
|
3469
|
+
group?: string;
|
|
3470
|
+
tags?: string;
|
|
3471
|
+
query?: string;
|
|
3472
|
+
mime?: string;
|
|
3473
|
+
limit?: number;
|
|
3474
|
+
offset?: number;
|
|
3475
|
+
}
|
|
3476
|
+
/**
|
|
3477
|
+
* Get assets from the MCP assets search API
|
|
3478
|
+
*/
|
|
3479
|
+
declare function getAssets(options?: AssetsOptions): Promise<AssetsResponse>;
|
|
3480
|
+
/**
|
|
3481
|
+
* Get assets filtered by group slug
|
|
3482
|
+
*/
|
|
3483
|
+
declare function getAssetsByGroup(group: string, options?: Omit<AssetsOptions, "group">): Promise<AssetsResponse>;
|
|
3416
3484
|
|
|
3417
3485
|
interface CalloutProps {
|
|
3418
3486
|
type?: "info" | "warning" | "error" | "success" | "tip";
|
|
@@ -4052,4 +4120,4 @@ declare function renderMdx(mdx: string, references?: References, options?: Rende
|
|
|
4052
4120
|
*/
|
|
4053
4121
|
declare function renderMdxPreview(mdx: string, additionalComponents?: Record<string, React.ComponentType<any>>): Promise<React.ReactElement>;
|
|
4054
4122
|
|
|
4055
|
-
export { type ApiResponse, type AssetReference, type AssetReferenceVariants, BlogCard, Button, CACHE_TAGS, Callout, CmxApiError, type CollectionConfig, type CollectionConfigDefaults, type CollectionContentDetailResponse, type CollectionContentsOptions, type CollectionContentsResponse, type CollectionListResponse, type CollectionResponse, CollectionType, type ComponentDefinition, type ComponentName, type ContentReference, ContentStatus, type CreateCollectionRequest, type CreateContentRequest, type CreateDataTypeRequest, type CreateFormDefinitionRequest, type CreateSocialPostRequest, CreateSocialPostRequestStatus, type CreateSocialPostRequestTargetsItem, type CreateSocialPostRequestTargetsItemPlatformMeta, type DataEntriesOptions, type DataEntryDetailResponse, type DataEntryItem, type DataListResponse, type DataTypeConfig, type DataTypeResponse, type DeleteManageContentsIdParams, type DeleteManageDataTypeSlugIdParams, Embed, type ErrorResponse, type ErrorResponseDetails, type FetchOptions, type FieldDefinition, type FieldOptions, type FieldOptionsChoicesItem, FieldType, type FormDefinitionResponse, type FormDefinitionResponseConfigJson, type GetAnalyticsDailyParams, type GetCollectionsSlugContentsParams, GetCollectionsSlugContentsSortBy, GetCollectionsSlugContentsSortOrder, type GetDataTypeSlugParams, GetDataTypeSlugSortBy, GetDataTypeSlugSortOrder, type GetManageCollectionPresets200, type GetManageCollectionPresetsParams, GetManageCollectionPresetsType, type GetManageContentsIdParams, type GetManageContentsParams, type GetManageDataTypeSlugIdParams, type GetManageDataTypeSlugParams, GetManageDataTypeSlugSortBy, GetManageDataTypeSlugSortOrder, GetManageDataTypeSlugStatus, type GetManageSocialPostsParams, GetManageSocialPostsStatus, 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 ReferenceField, ReferenceFieldReferenceType, 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 SdkAddCollectionDataTypeRequest, SdkAddCollectionDataTypeRequestReferenceType, type SdkAnalyticsDailyListResponse, type SdkAnalyticsDailyMetric, type SdkAnalyticsDailyMetricRawJson, type SdkBugReportResponse, SdkBugSeverity, type SdkCollectionDataTypeResponse, type SdkComponentDefinition, type SdkComponentDefinitionPropsSchema, type SdkComponentProp, type SdkComponentSuccessResponse, type SdkComponentSyncRequest, type SdkContentDetail, type SdkContentDetailFrontmatterJson, type SdkContentDetailSeoJson, type SdkContentDetailSeoJsonStructuredData, type SdkContentItem, type SdkContentListResponse, type SdkContentReferencesResponse, type SdkContentReferencesResponseReferencesItem, type SdkContentReferencesResponseReferencesItemDataEntriesItem, type SdkContentReferencesResponseReferencesItemDataEntriesItemData, type SdkCreateBugReportBody, type SdkCreateBugReportBodyEnvironmentInfo, type SdkCreateContentResponse, type SdkCreateContentResponseWarningsItem, SdkCreateContentResponseWarningsItemIssueType, SdkCreateContentResponseWarningsItemTargetType, type SdkCreateEntryRequest, type SdkCreateEntryRequestDataJson, SdkCreateEntryRequestStatus, type SdkCustomComponentResponse, type SdkCustomComponentResponsePropsSchema, SdkCustomComponentResponseStatus, type SdkCustomComponentsListResponse, type SdkDataEntriesListResponse, type SdkDataEntryDeletionImpactItem, type SdkDataEntryDeletionImpactResponse, type SdkDataEntryDetailResponse, type SdkDataEntryResponse, type SdkDataEntryResponseDataJson, SdkDataEntryResponseStatus, type SdkDataTypeInfo, type SdkDeleteCollectionDataTypeResponse, type SdkDeleteCollectionResponse, type SdkDeleteContentResponse, type SdkDeleteDataEntryResponse, type SdkDeleteDataTypeResponse, type SdkDeleteFormDefinitionResponse, type SdkDeleteSocialPostResponse, type SdkDocResponse, SdkDocType, type SdkLinkExistingDataTypeRequest, SdkLinkExistingDataTypeRequestReferenceType, type SdkPreset, SdkPresetReferenceType, type SdkPublishContentResponse, type SdkRequestReviewResponse, type SdkRuntimeSettingsResponse, type SdkRuntimeSettingsResponseSettings, type SdkRuntimeSettingsResponseSettingsAnalytics, SdkRuntimeSettingsResponseSettingsAnalyticsProvider, type SdkRuntimeSettingsResponseSettingsAnalyticsTracking, type SdkRuntimeSettingsResponseSettingsRevalidation, type SdkSetContentReferencesRequest, type SdkSetContentReferencesRequestReferencesItem, type SdkSetContentReferencesResponse, type SdkUpdateContentResponse, type SdkUpdateContentResponseWarningsItem, SdkUpdateContentResponseWarningsItemIssueType, SdkUpdateContentResponseWarningsItemTargetType, type SdkUpdateEntryRequest, type SdkUpdateEntryRequestDataJson, SdkUpdateEntryRequestStatus, type SdkUpsertDocBody, type SdkValidateContentResponse, type SdkValidateContentResponseIssuesItem, SdkValidateContentResponseIssuesItemIssueType, SdkValidateContentResponseIssuesItemTargetType, type SocialAccountListResponse, type SocialAccountResponse, SocialAccountResponsePlatform, SocialAccountResponseStatus, type SocialPostListItem, SocialPostListItemStatus, type SocialPostListItemTargetSummary, SocialPostListItemTargetSummaryPlatformsItem, type SocialPostListItemTargetSummaryStatusCounts, type SocialPostListResponse, type SocialPostResponse, SocialPostResponseStatus, type SocialPostResponseTargetSummary, SocialPostResponseTargetSummaryPlatformsItem, type SocialPostResponseTargetSummaryStatusCounts, type SocialPostResponseTargetsItem, SocialPostResponseTargetsItemPlatform, type SocialPostResponseTargetsItemPlatformMeta, SocialPostResponseTargetsItemStatus, type UpdateCollectionRequest, type UpdateContentRequest, type UpdateDataTypeRequest, type UpdateFormDefinitionRequest, type UpdateFormDefinitionRequestConfigJson, type UpdateSocialPostRequest, UpdateSocialPostRequestStatus, type ValidationError, type ValidationResult, basicComponents, componentCatalog, componentSchemas, customComponents, fetchAnalyticsDailyMetrics, fetchRuntimeSettings, getAnalyticsDaily, getCatalogForAI, getCollectionContentDetail, getCollectionContentDetailOrThrow, getCollectionContents, getCollectionContentsOrThrow, getCollections, getCollectionsSlugContents, getCollectionsSlugContentsContentSlug, getComponentsByCategory, getComponentsWithReferences, getDataEntries, getDataEntriesOrThrow, getDataEntry, getDataEntryOrThrow, getDataTypeSlug, getGetAnalyticsDailyUrl, getGetCollectionsSlugContentsContentSlugUrl, getGetCollectionsSlugContentsUrl, getGetDataTypeSlugUrl, getGetPreviewTokenUrl, getGetRuntimeSettingsUrl, getPreviewByToken, getPreviewToken, getRuntimeSettings, getSchema, getSdkApiBaseUrl, getSdkApiToken, isValidComponent, markdownComponents, mdxComponents, quickValidateMdx, renderMdx, renderMdxPreview, sdkCustomInstance, sdkFetchWithTags, sdkFetcher, sdkPostFetcher, submitFormData, validateComponentProps, validateMdx };
|
|
4123
|
+
export { type ApiResponse, type AssetItem, type AssetReference, type AssetReferenceVariants, type AssetsOptions, type AssetsResponse, BlogCard, Button, CACHE_TAGS, Callout, CmxApiError, type CollectionConfig, type CollectionConfigDefaults, type CollectionContentDetailResponse, type CollectionContentsOptions, type CollectionContentsResponse, type CollectionListResponse, type CollectionResponse, CollectionType, type ComponentDefinition, type ComponentName, type ContentReference, ContentStatus, type CreateCollectionRequest, type CreateContentRequest, type CreateDataTypeRequest, type CreateFormDefinitionRequest, type CreateSocialPostRequest, CreateSocialPostRequestStatus, type CreateSocialPostRequestTargetsItem, type CreateSocialPostRequestTargetsItemPlatformMeta, type DataEntriesOptions, type DataEntryDetailResponse, type DataEntryItem, type DataListResponse, type DataTypeConfig, type DataTypeResponse, type DeleteManageContentsIdParams, type DeleteManageDataTypeSlugIdParams, Embed, type ErrorResponse, type ErrorResponseDetails, type FetchOptions, type FieldDefinition, type FieldOptions, type FieldOptionsChoicesItem, FieldType, type FormDefinitionResponse, type FormDefinitionResponseConfigJson, type GetAnalyticsDailyParams, type GetCollectionsSlugContentsParams, GetCollectionsSlugContentsSortBy, GetCollectionsSlugContentsSortOrder, type GetDataTypeSlugParams, GetDataTypeSlugSortBy, GetDataTypeSlugSortOrder, type GetManageCollectionPresets200, type GetManageCollectionPresetsParams, GetManageCollectionPresetsType, type GetManageContentsIdParams, type GetManageContentsParams, type GetManageDataTypeSlugIdParams, type GetManageDataTypeSlugParams, GetManageDataTypeSlugSortBy, GetManageDataTypeSlugSortOrder, GetManageDataTypeSlugStatus, type GetManageSocialPostsParams, GetManageSocialPostsStatus, 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 ReferenceField, ReferenceFieldReferenceType, 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 SdkAddCollectionDataTypeRequest, SdkAddCollectionDataTypeRequestReferenceType, type SdkAnalyticsDailyListResponse, type SdkAnalyticsDailyMetric, type SdkAnalyticsDailyMetricRawJson, type SdkBugReportResponse, SdkBugSeverity, type SdkCollectionDataTypeResponse, type SdkComponentDefinition, type SdkComponentDefinitionPropsSchema, type SdkComponentProp, type SdkComponentSuccessResponse, type SdkComponentSyncRequest, type SdkContentDetail, type SdkContentDetailFrontmatterJson, type SdkContentDetailSeoJson, type SdkContentDetailSeoJsonStructuredData, type SdkContentItem, type SdkContentListResponse, type SdkContentReferencesResponse, type SdkContentReferencesResponseReferencesItem, type SdkContentReferencesResponseReferencesItemDataEntriesItem, type SdkContentReferencesResponseReferencesItemDataEntriesItemData, type SdkCreateBugReportBody, type SdkCreateBugReportBodyEnvironmentInfo, type SdkCreateContentResponse, type SdkCreateContentResponseWarningsItem, SdkCreateContentResponseWarningsItemIssueType, SdkCreateContentResponseWarningsItemTargetType, type SdkCreateEntryRequest, type SdkCreateEntryRequestDataJson, SdkCreateEntryRequestStatus, type SdkCustomComponentResponse, type SdkCustomComponentResponsePropsSchema, SdkCustomComponentResponseStatus, type SdkCustomComponentsListResponse, type SdkDataEntriesListResponse, type SdkDataEntryDeletionImpactItem, type SdkDataEntryDeletionImpactResponse, type SdkDataEntryDetailResponse, type SdkDataEntryResponse, type SdkDataEntryResponseDataJson, SdkDataEntryResponseStatus, type SdkDataTypeInfo, type SdkDeleteCollectionDataTypeResponse, type SdkDeleteCollectionResponse, type SdkDeleteContentResponse, type SdkDeleteDataEntryResponse, type SdkDeleteDataTypeResponse, type SdkDeleteFormDefinitionResponse, type SdkDeleteSocialPostResponse, type SdkDocResponse, SdkDocType, type SdkLinkExistingDataTypeRequest, SdkLinkExistingDataTypeRequestReferenceType, type SdkPreset, SdkPresetReferenceType, type SdkPublishContentResponse, type SdkRequestReviewResponse, type SdkRuntimeSettingsResponse, type SdkRuntimeSettingsResponseSettings, type SdkRuntimeSettingsResponseSettingsAnalytics, SdkRuntimeSettingsResponseSettingsAnalyticsProvider, type SdkRuntimeSettingsResponseSettingsAnalyticsTracking, type SdkRuntimeSettingsResponseSettingsRevalidation, type SdkSetContentReferencesRequest, type SdkSetContentReferencesRequestReferencesItem, type SdkSetContentReferencesResponse, type SdkUpdateContentResponse, type SdkUpdateContentResponseWarningsItem, SdkUpdateContentResponseWarningsItemIssueType, SdkUpdateContentResponseWarningsItemTargetType, type SdkUpdateEntryRequest, type SdkUpdateEntryRequestDataJson, SdkUpdateEntryRequestStatus, type SdkUpsertDocBody, type SdkValidateContentResponse, type SdkValidateContentResponseIssuesItem, SdkValidateContentResponseIssuesItemIssueType, SdkValidateContentResponseIssuesItemTargetType, type SocialAccountListResponse, type SocialAccountResponse, SocialAccountResponsePlatform, SocialAccountResponseStatus, type SocialPostListItem, SocialPostListItemStatus, type SocialPostListItemTargetSummary, SocialPostListItemTargetSummaryPlatformsItem, type SocialPostListItemTargetSummaryStatusCounts, type SocialPostListResponse, type SocialPostResponse, SocialPostResponseStatus, type SocialPostResponseTargetSummary, SocialPostResponseTargetSummaryPlatformsItem, type SocialPostResponseTargetSummaryStatusCounts, type SocialPostResponseTargetsItem, SocialPostResponseTargetsItemPlatform, type SocialPostResponseTargetsItemPlatformMeta, SocialPostResponseTargetsItemStatus, type UpdateCollectionRequest, type UpdateContentRequest, type UpdateDataTypeRequest, type UpdateFormDefinitionRequest, type UpdateFormDefinitionRequestConfigJson, type UpdateSocialPostRequest, UpdateSocialPostRequestStatus, type ValidationError, type ValidationResult, basicComponents, componentCatalog, componentSchemas, customComponents, fetchAnalyticsDailyMetrics, fetchRuntimeSettings, getAnalyticsDaily, getAssets, getAssetsByGroup, getCatalogForAI, getCollectionContentDetail, getCollectionContentDetailOrThrow, getCollectionContents, getCollectionContentsOrThrow, getCollections, getCollectionsSlugContents, getCollectionsSlugContentsContentSlug, getComponentsByCategory, getComponentsWithReferences, getDataEntries, getDataEntriesOrThrow, getDataEntry, getDataEntryOrThrow, getDataTypeSlug, getGetAnalyticsDailyUrl, getGetCollectionsSlugContentsContentSlugUrl, getGetCollectionsSlugContentsUrl, getGetDataTypeSlugUrl, getGetPreviewTokenUrl, getGetRuntimeSettingsUrl, getMcpApiBaseUrl, getPreviewByToken, getPreviewToken, getRuntimeSettings, getSchema, getSdkApiBaseUrl, getSdkApiToken, isValidComponent, markdownComponents, mcpFetchWithTags, mdxComponents, quickValidateMdx, renderMdx, renderMdxPreview, sdkCustomInstance, sdkFetchWithTags, sdkFetcher, sdkPostFetcher, submitFormData, validateComponentProps, validateMdx };
|
package/dist/index.js
CHANGED
|
@@ -132,6 +132,31 @@ async function sdkFetchWithTags(path, tags, revalidate) {
|
|
|
132
132
|
}
|
|
133
133
|
return response.json();
|
|
134
134
|
}
|
|
135
|
+
function getMcpApiBaseUrl() {
|
|
136
|
+
const apiUrl = process.env.CMX_API_URL || DEFAULT_API_URL;
|
|
137
|
+
return `${apiUrl}/api/mcp`;
|
|
138
|
+
}
|
|
139
|
+
async function mcpFetchWithTags(path, tags, revalidate) {
|
|
140
|
+
const token = getSdkApiToken();
|
|
141
|
+
const baseUrl = getMcpApiBaseUrl();
|
|
142
|
+
const url = `${baseUrl}${path}`;
|
|
143
|
+
const fetchOptions = {
|
|
144
|
+
method: "GET",
|
|
145
|
+
headers: {
|
|
146
|
+
"Content-Type": "application/json",
|
|
147
|
+
Authorization: `Bearer ${token}`
|
|
148
|
+
},
|
|
149
|
+
next: {
|
|
150
|
+
tags: tags || [],
|
|
151
|
+
...revalidate !== void 0 && { revalidate }
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
const response = await fetch(url, fetchOptions);
|
|
155
|
+
if (!response.ok) {
|
|
156
|
+
throw await toCmxApiError(response);
|
|
157
|
+
}
|
|
158
|
+
return response.json();
|
|
159
|
+
}
|
|
135
160
|
async function sdkPostFetcher(path, body) {
|
|
136
161
|
const token = getSdkApiToken();
|
|
137
162
|
const baseUrl = getSdkApiBaseUrl();
|
|
@@ -162,7 +187,11 @@ var CACHE_TAGS = {
|
|
|
162
187
|
/** 全データタイプ共通 */
|
|
163
188
|
data: "data",
|
|
164
189
|
/** 特定データタイプ */
|
|
165
|
-
dataType: (slug) => `data:${slug}
|
|
190
|
+
dataType: (slug) => `data:${slug}`,
|
|
191
|
+
/** 全アセット共通 */
|
|
192
|
+
assets: "assets",
|
|
193
|
+
/** 特定グループのアセット */
|
|
194
|
+
assetGroup: (group) => `assets:${group}`
|
|
166
195
|
};
|
|
167
196
|
|
|
168
197
|
// src/core/date-reviver.ts
|
|
@@ -404,6 +433,25 @@ async function fetchAnalyticsDailyMetrics(params) {
|
|
|
404
433
|
}
|
|
405
434
|
return response.data;
|
|
406
435
|
}
|
|
436
|
+
async function getAssets(options) {
|
|
437
|
+
const params = new URLSearchParams();
|
|
438
|
+
if (options?.group) params.set("group", options.group);
|
|
439
|
+
if (options?.tags) params.set("tags", options.tags);
|
|
440
|
+
if (options?.query) params.set("q", options.query);
|
|
441
|
+
if (options?.mime) params.set("mime", options.mime);
|
|
442
|
+
if (options?.limit !== void 0) params.set("limit", String(options.limit));
|
|
443
|
+
if (options?.offset !== void 0) params.set("offset", String(options.offset));
|
|
444
|
+
const query = params.toString();
|
|
445
|
+
const tags = options?.group ? [CACHE_TAGS.assets, CACHE_TAGS.assetGroup(options.group)] : [CACHE_TAGS.assets];
|
|
446
|
+
return mcpFetchWithTags(
|
|
447
|
+
`/assets/search${query ? `?${query}` : ""}`,
|
|
448
|
+
tags,
|
|
449
|
+
options?.revalidate
|
|
450
|
+
);
|
|
451
|
+
}
|
|
452
|
+
async function getAssetsByGroup(group, options) {
|
|
453
|
+
return getAssets({ ...options, group });
|
|
454
|
+
}
|
|
407
455
|
|
|
408
456
|
// src/mdx/components/basic/Callout.tsx
|
|
409
457
|
import { AlertCircle, AlertTriangle, CheckCircle, Info, Lightbulb } from "lucide-react";
|
|
@@ -2211,6 +2259,8 @@ export {
|
|
|
2211
2259
|
fetchAnalyticsDailyMetrics,
|
|
2212
2260
|
fetchRuntimeSettings,
|
|
2213
2261
|
getAnalyticsDaily,
|
|
2262
|
+
getAssets,
|
|
2263
|
+
getAssetsByGroup,
|
|
2214
2264
|
getCatalogForAI,
|
|
2215
2265
|
getCollectionContentDetail,
|
|
2216
2266
|
getCollectionContentDetailOrThrow,
|
|
@@ -2232,6 +2282,7 @@ export {
|
|
|
2232
2282
|
getGetDataTypeSlugUrl,
|
|
2233
2283
|
getGetPreviewTokenUrl,
|
|
2234
2284
|
getGetRuntimeSettingsUrl,
|
|
2285
|
+
getMcpApiBaseUrl,
|
|
2235
2286
|
getPreviewByToken,
|
|
2236
2287
|
getPreviewToken,
|
|
2237
2288
|
getRuntimeSettings,
|
|
@@ -2240,6 +2291,7 @@ export {
|
|
|
2240
2291
|
getSdkApiToken,
|
|
2241
2292
|
isValidComponent,
|
|
2242
2293
|
markdownComponents,
|
|
2294
|
+
mcpFetchWithTags,
|
|
2243
2295
|
mdxComponents,
|
|
2244
2296
|
quickValidateMdx,
|
|
2245
2297
|
renderMdx,
|