@lobehub/market-sdk 0.36.0 → 0.37.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 +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -7956,6 +7956,37 @@ interface UpdateStatusResponse {
|
|
|
7956
7956
|
status: string;
|
|
7957
7957
|
success: boolean;
|
|
7958
7958
|
}
|
|
7959
|
+
/** Owner-provided localization for a single locale. */
|
|
7960
|
+
interface PluginLocalizationInput {
|
|
7961
|
+
description?: string;
|
|
7962
|
+
/** Locale code, e.g. "zh-CN", "ja-JP", "en-US" */
|
|
7963
|
+
locale: string;
|
|
7964
|
+
name?: string;
|
|
7965
|
+
summary?: string;
|
|
7966
|
+
tags?: string[];
|
|
7967
|
+
}
|
|
7968
|
+
interface PluginLocalizationItem {
|
|
7969
|
+
description: string;
|
|
7970
|
+
locale: string;
|
|
7971
|
+
name: string;
|
|
7972
|
+
summary: string | null;
|
|
7973
|
+
tags: string[];
|
|
7974
|
+
}
|
|
7975
|
+
interface PluginLocalizationsResponse {
|
|
7976
|
+
identifier: string;
|
|
7977
|
+
localizations: PluginLocalizationItem[];
|
|
7978
|
+
version: string;
|
|
7979
|
+
}
|
|
7980
|
+
interface UpsertPluginLocalizationsResponse {
|
|
7981
|
+
identifier: string;
|
|
7982
|
+
locales: string[];
|
|
7983
|
+
message: string;
|
|
7984
|
+
version: string;
|
|
7985
|
+
}
|
|
7986
|
+
interface DeletePluginLocalizationResponse {
|
|
7987
|
+
locale: string;
|
|
7988
|
+
success: boolean;
|
|
7989
|
+
}
|
|
7959
7990
|
interface PluginPublishData {
|
|
7960
7991
|
author?: string;
|
|
7961
7992
|
authorUrl?: string;
|
|
@@ -7964,6 +7995,8 @@ interface PluginPublishData {
|
|
|
7964
7995
|
description?: string;
|
|
7965
7996
|
homepage?: string;
|
|
7966
7997
|
icon?: string;
|
|
7998
|
+
/** Owner-provided per-locale translations (en-US also updates the version row) */
|
|
7999
|
+
localizations?: PluginLocalizationInput[];
|
|
7967
8000
|
name: string;
|
|
7968
8001
|
prompts?: Record<string, unknown>[];
|
|
7969
8002
|
resources?: Record<string, unknown>[];
|
|
@@ -8077,6 +8110,40 @@ declare class UserPublishService extends BaseSDK {
|
|
|
8077
8110
|
* @returns Promise resolving to the publish result
|
|
8078
8111
|
*/
|
|
8079
8112
|
publishPluginVersion(identifier: string, data: PluginPublishData, options?: globalThis.RequestInit): Promise<PublishVersionResponse>;
|
|
8113
|
+
/**
|
|
8114
|
+
* Lists the localizations of an owned plugin version
|
|
8115
|
+
*
|
|
8116
|
+
* @param identifier - The plugin identifier
|
|
8117
|
+
* @param version - Optional version (defaults to the latest version)
|
|
8118
|
+
* @param options - Optional request options (must include authentication)
|
|
8119
|
+
* @returns Promise resolving to the plugin's localizations
|
|
8120
|
+
*/
|
|
8121
|
+
getPluginLocalizations(identifier: string, version?: string, options?: globalThis.RequestInit): Promise<PluginLocalizationsResponse>;
|
|
8122
|
+
/**
|
|
8123
|
+
* Creates or updates owner-provided localizations for a plugin version.
|
|
8124
|
+
*
|
|
8125
|
+
* Merge semantics per locale: only supplied fields overwrite. Creating a brand
|
|
8126
|
+
* new locale requires both name and description. Editing en-US also updates
|
|
8127
|
+
* the version row (source of truth).
|
|
8128
|
+
*
|
|
8129
|
+
* @param identifier - The plugin identifier
|
|
8130
|
+
* @param localizations - Per-locale content to upsert
|
|
8131
|
+
* @param version - Optional version (defaults to the latest version)
|
|
8132
|
+
* @param options - Optional request options (must include authentication)
|
|
8133
|
+
* @returns Promise resolving to the upsert result
|
|
8134
|
+
*/
|
|
8135
|
+
updatePluginLocalizations(identifier: string, localizations: PluginLocalizationInput[], version?: string, options?: globalThis.RequestInit): Promise<UpsertPluginLocalizationsResponse>;
|
|
8136
|
+
/**
|
|
8137
|
+
* Deletes a single localization of a plugin version. The source locale (en-US)
|
|
8138
|
+
* cannot be deleted.
|
|
8139
|
+
*
|
|
8140
|
+
* @param identifier - The plugin identifier
|
|
8141
|
+
* @param locale - The locale to remove
|
|
8142
|
+
* @param version - Optional version (defaults to the latest version)
|
|
8143
|
+
* @param options - Optional request options (must include authentication)
|
|
8144
|
+
* @returns Promise resolving to the delete result
|
|
8145
|
+
*/
|
|
8146
|
+
deletePluginLocalization(identifier: string, locale: string, version?: string, options?: globalThis.RequestInit): Promise<DeletePluginLocalizationResponse>;
|
|
8080
8147
|
}
|
|
8081
8148
|
|
|
8082
8149
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -6148,6 +6148,72 @@ var UserPublishService = class extends BaseSDK {
|
|
|
6148
6148
|
log30("Published plugin version: %s@%s", identifier, result.version);
|
|
6149
6149
|
return result;
|
|
6150
6150
|
}
|
|
6151
|
+
/**
|
|
6152
|
+
* Lists the localizations of an owned plugin version
|
|
6153
|
+
*
|
|
6154
|
+
* @param identifier - The plugin identifier
|
|
6155
|
+
* @param version - Optional version (defaults to the latest version)
|
|
6156
|
+
* @param options - Optional request options (must include authentication)
|
|
6157
|
+
* @returns Promise resolving to the plugin's localizations
|
|
6158
|
+
*/
|
|
6159
|
+
async getPluginLocalizations(identifier, version, options) {
|
|
6160
|
+
var _a;
|
|
6161
|
+
log30("Listing localizations for plugin: %s", identifier);
|
|
6162
|
+
const query = version ? `?version=${encodeURIComponent(version)}` : "";
|
|
6163
|
+
const result = await this.request(
|
|
6164
|
+
`/v1/user/plugins/${encodeURIComponent(identifier)}/localizations${query}`,
|
|
6165
|
+
options
|
|
6166
|
+
);
|
|
6167
|
+
log30("Found %d localizations for %s", ((_a = result.localizations) == null ? void 0 : _a.length) || 0, identifier);
|
|
6168
|
+
return result;
|
|
6169
|
+
}
|
|
6170
|
+
/**
|
|
6171
|
+
* Creates or updates owner-provided localizations for a plugin version.
|
|
6172
|
+
*
|
|
6173
|
+
* Merge semantics per locale: only supplied fields overwrite. Creating a brand
|
|
6174
|
+
* new locale requires both name and description. Editing en-US also updates
|
|
6175
|
+
* the version row (source of truth).
|
|
6176
|
+
*
|
|
6177
|
+
* @param identifier - The plugin identifier
|
|
6178
|
+
* @param localizations - Per-locale content to upsert
|
|
6179
|
+
* @param version - Optional version (defaults to the latest version)
|
|
6180
|
+
* @param options - Optional request options (must include authentication)
|
|
6181
|
+
* @returns Promise resolving to the upsert result
|
|
6182
|
+
*/
|
|
6183
|
+
async updatePluginLocalizations(identifier, localizations, version, options) {
|
|
6184
|
+
log30("Upserting %d localization(s) for plugin: %s", localizations.length, identifier);
|
|
6185
|
+
const result = await this.request(
|
|
6186
|
+
`/v1/user/plugins/${encodeURIComponent(identifier)}/localizations`,
|
|
6187
|
+
{
|
|
6188
|
+
body: JSON.stringify({ localizations, version }),
|
|
6189
|
+
headers: { "Content-Type": "application/json" },
|
|
6190
|
+
method: "PUT",
|
|
6191
|
+
...options
|
|
6192
|
+
}
|
|
6193
|
+
);
|
|
6194
|
+
log30("Upserted localizations for %s@%s", identifier, result.version);
|
|
6195
|
+
return result;
|
|
6196
|
+
}
|
|
6197
|
+
/**
|
|
6198
|
+
* Deletes a single localization of a plugin version. The source locale (en-US)
|
|
6199
|
+
* cannot be deleted.
|
|
6200
|
+
*
|
|
6201
|
+
* @param identifier - The plugin identifier
|
|
6202
|
+
* @param locale - The locale to remove
|
|
6203
|
+
* @param version - Optional version (defaults to the latest version)
|
|
6204
|
+
* @param options - Optional request options (must include authentication)
|
|
6205
|
+
* @returns Promise resolving to the delete result
|
|
6206
|
+
*/
|
|
6207
|
+
async deletePluginLocalization(identifier, locale, version, options) {
|
|
6208
|
+
log30("Deleting localization %s for plugin: %s", locale, identifier);
|
|
6209
|
+
const query = version ? `?version=${encodeURIComponent(version)}` : "";
|
|
6210
|
+
const result = await this.request(
|
|
6211
|
+
`/v1/user/plugins/${encodeURIComponent(identifier)}/localizations/${encodeURIComponent(locale)}${query}`,
|
|
6212
|
+
{ method: "DELETE", ...options }
|
|
6213
|
+
);
|
|
6214
|
+
log30("Deleted localization %s for %s", locale, identifier);
|
|
6215
|
+
return result;
|
|
6216
|
+
}
|
|
6151
6217
|
};
|
|
6152
6218
|
|
|
6153
6219
|
// src/market/market-sdk.ts
|