@lobehub/market-sdk 0.38.0-beta.0 → 0.38.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/index.d.mts +67 -0
- package/dist/index.mjs +66 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -8020,6 +8020,37 @@ interface UpdateStatusResponse {
|
|
|
8020
8020
|
status: string;
|
|
8021
8021
|
success: boolean;
|
|
8022
8022
|
}
|
|
8023
|
+
/** Owner-provided localization for a single locale. */
|
|
8024
|
+
interface PluginLocalizationInput {
|
|
8025
|
+
description?: string;
|
|
8026
|
+
/** Locale code, e.g. "zh-CN", "ja-JP", "en-US" */
|
|
8027
|
+
locale: string;
|
|
8028
|
+
name?: string;
|
|
8029
|
+
summary?: string;
|
|
8030
|
+
tags?: string[];
|
|
8031
|
+
}
|
|
8032
|
+
interface PluginLocalizationItem {
|
|
8033
|
+
description: string;
|
|
8034
|
+
locale: string;
|
|
8035
|
+
name: string;
|
|
8036
|
+
summary: string | null;
|
|
8037
|
+
tags: string[];
|
|
8038
|
+
}
|
|
8039
|
+
interface PluginLocalizationsResponse {
|
|
8040
|
+
identifier: string;
|
|
8041
|
+
localizations: PluginLocalizationItem[];
|
|
8042
|
+
version: string;
|
|
8043
|
+
}
|
|
8044
|
+
interface UpsertPluginLocalizationsResponse {
|
|
8045
|
+
identifier: string;
|
|
8046
|
+
locales: string[];
|
|
8047
|
+
message: string;
|
|
8048
|
+
version: string;
|
|
8049
|
+
}
|
|
8050
|
+
interface DeletePluginLocalizationResponse {
|
|
8051
|
+
locale: string;
|
|
8052
|
+
success: boolean;
|
|
8053
|
+
}
|
|
8023
8054
|
interface PluginPublishData {
|
|
8024
8055
|
author?: string;
|
|
8025
8056
|
authorUrl?: string;
|
|
@@ -8028,6 +8059,8 @@ interface PluginPublishData {
|
|
|
8028
8059
|
description?: string;
|
|
8029
8060
|
homepage?: string;
|
|
8030
8061
|
icon?: string;
|
|
8062
|
+
/** Owner-provided per-locale translations (en-US also updates the version row) */
|
|
8063
|
+
localizations?: PluginLocalizationInput[];
|
|
8031
8064
|
name: string;
|
|
8032
8065
|
prompts?: Record<string, unknown>[];
|
|
8033
8066
|
resources?: Record<string, unknown>[];
|
|
@@ -8141,6 +8174,40 @@ declare class UserPublishService extends BaseSDK {
|
|
|
8141
8174
|
* @returns Promise resolving to the publish result
|
|
8142
8175
|
*/
|
|
8143
8176
|
publishPluginVersion(identifier: string, data: PluginPublishData, options?: globalThis.RequestInit): Promise<PublishVersionResponse>;
|
|
8177
|
+
/**
|
|
8178
|
+
* Lists the localizations of an owned plugin version
|
|
8179
|
+
*
|
|
8180
|
+
* @param identifier - The plugin identifier
|
|
8181
|
+
* @param version - Optional version (defaults to the latest version)
|
|
8182
|
+
* @param options - Optional request options (must include authentication)
|
|
8183
|
+
* @returns Promise resolving to the plugin's localizations
|
|
8184
|
+
*/
|
|
8185
|
+
getPluginLocalizations(identifier: string, version?: string, options?: globalThis.RequestInit): Promise<PluginLocalizationsResponse>;
|
|
8186
|
+
/**
|
|
8187
|
+
* Creates or updates owner-provided localizations for a plugin version.
|
|
8188
|
+
*
|
|
8189
|
+
* Merge semantics per locale: only supplied fields overwrite. Creating a brand
|
|
8190
|
+
* new locale requires both name and description. Editing en-US also updates
|
|
8191
|
+
* the version row (source of truth).
|
|
8192
|
+
*
|
|
8193
|
+
* @param identifier - The plugin identifier
|
|
8194
|
+
* @param localizations - Per-locale content to upsert
|
|
8195
|
+
* @param version - Optional version (defaults to the latest version)
|
|
8196
|
+
* @param options - Optional request options (must include authentication)
|
|
8197
|
+
* @returns Promise resolving to the upsert result
|
|
8198
|
+
*/
|
|
8199
|
+
updatePluginLocalizations(identifier: string, localizations: PluginLocalizationInput[], version?: string, options?: globalThis.RequestInit): Promise<UpsertPluginLocalizationsResponse>;
|
|
8200
|
+
/**
|
|
8201
|
+
* Deletes a single localization of a plugin version. The source locale (en-US)
|
|
8202
|
+
* cannot be deleted.
|
|
8203
|
+
*
|
|
8204
|
+
* @param identifier - The plugin identifier
|
|
8205
|
+
* @param locale - The locale to remove
|
|
8206
|
+
* @param version - Optional version (defaults to the latest version)
|
|
8207
|
+
* @param options - Optional request options (must include authentication)
|
|
8208
|
+
* @returns Promise resolving to the delete result
|
|
8209
|
+
*/
|
|
8210
|
+
deletePluginLocalization(identifier: string, locale: string, version?: string, options?: globalThis.RequestInit): Promise<DeletePluginLocalizationResponse>;
|
|
8144
8211
|
}
|
|
8145
8212
|
|
|
8146
8213
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -6186,6 +6186,72 @@ var UserPublishService = class extends BaseSDK {
|
|
|
6186
6186
|
log31("Published plugin version: %s@%s", identifier, result.version);
|
|
6187
6187
|
return result;
|
|
6188
6188
|
}
|
|
6189
|
+
/**
|
|
6190
|
+
* Lists the localizations of an owned plugin version
|
|
6191
|
+
*
|
|
6192
|
+
* @param identifier - The plugin identifier
|
|
6193
|
+
* @param version - Optional version (defaults to the latest version)
|
|
6194
|
+
* @param options - Optional request options (must include authentication)
|
|
6195
|
+
* @returns Promise resolving to the plugin's localizations
|
|
6196
|
+
*/
|
|
6197
|
+
async getPluginLocalizations(identifier, version, options) {
|
|
6198
|
+
var _a;
|
|
6199
|
+
log31("Listing localizations for plugin: %s", identifier);
|
|
6200
|
+
const query = version ? `?version=${encodeURIComponent(version)}` : "";
|
|
6201
|
+
const result = await this.request(
|
|
6202
|
+
`/v1/user/plugins/${encodeURIComponent(identifier)}/localizations${query}`,
|
|
6203
|
+
options
|
|
6204
|
+
);
|
|
6205
|
+
log31("Found %d localizations for %s", ((_a = result.localizations) == null ? void 0 : _a.length) || 0, identifier);
|
|
6206
|
+
return result;
|
|
6207
|
+
}
|
|
6208
|
+
/**
|
|
6209
|
+
* Creates or updates owner-provided localizations for a plugin version.
|
|
6210
|
+
*
|
|
6211
|
+
* Merge semantics per locale: only supplied fields overwrite. Creating a brand
|
|
6212
|
+
* new locale requires both name and description. Editing en-US also updates
|
|
6213
|
+
* the version row (source of truth).
|
|
6214
|
+
*
|
|
6215
|
+
* @param identifier - The plugin identifier
|
|
6216
|
+
* @param localizations - Per-locale content to upsert
|
|
6217
|
+
* @param version - Optional version (defaults to the latest version)
|
|
6218
|
+
* @param options - Optional request options (must include authentication)
|
|
6219
|
+
* @returns Promise resolving to the upsert result
|
|
6220
|
+
*/
|
|
6221
|
+
async updatePluginLocalizations(identifier, localizations, version, options) {
|
|
6222
|
+
log31("Upserting %d localization(s) for plugin: %s", localizations.length, identifier);
|
|
6223
|
+
const result = await this.request(
|
|
6224
|
+
`/v1/user/plugins/${encodeURIComponent(identifier)}/localizations`,
|
|
6225
|
+
{
|
|
6226
|
+
body: JSON.stringify({ localizations, version }),
|
|
6227
|
+
headers: { "Content-Type": "application/json" },
|
|
6228
|
+
method: "PUT",
|
|
6229
|
+
...options
|
|
6230
|
+
}
|
|
6231
|
+
);
|
|
6232
|
+
log31("Upserted localizations for %s@%s", identifier, result.version);
|
|
6233
|
+
return result;
|
|
6234
|
+
}
|
|
6235
|
+
/**
|
|
6236
|
+
* Deletes a single localization of a plugin version. The source locale (en-US)
|
|
6237
|
+
* cannot be deleted.
|
|
6238
|
+
*
|
|
6239
|
+
* @param identifier - The plugin identifier
|
|
6240
|
+
* @param locale - The locale to remove
|
|
6241
|
+
* @param version - Optional version (defaults to the latest version)
|
|
6242
|
+
* @param options - Optional request options (must include authentication)
|
|
6243
|
+
* @returns Promise resolving to the delete result
|
|
6244
|
+
*/
|
|
6245
|
+
async deletePluginLocalization(identifier, locale, version, options) {
|
|
6246
|
+
log31("Deleting localization %s for plugin: %s", locale, identifier);
|
|
6247
|
+
const query = version ? `?version=${encodeURIComponent(version)}` : "";
|
|
6248
|
+
const result = await this.request(
|
|
6249
|
+
`/v1/user/plugins/${encodeURIComponent(identifier)}/localizations/${encodeURIComponent(locale)}${query}`,
|
|
6250
|
+
{ method: "DELETE", ...options }
|
|
6251
|
+
);
|
|
6252
|
+
log31("Deleted localization %s for %s", locale, identifier);
|
|
6253
|
+
return result;
|
|
6254
|
+
}
|
|
6189
6255
|
};
|
|
6190
6256
|
|
|
6191
6257
|
// src/market/market-sdk.ts
|