picgo 3.0.2 → 3.2.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/.node-version +1 -1
- package/README.md +126 -9
- package/dist/core/Lifecycle.d.ts +0 -2
- package/dist/i18n/zh-CN.d.ts +8 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/lib/Cloud/__mocks__/lifecycleScenarios.d.ts +3 -2
- package/dist/lib/UploadOption.d.ts +13 -0
- package/dist/types/index.d.ts +56 -1
- package/dist/types/internal.d.ts +4 -4
- package/dist/utils/createClipboardImagePath.d.ts +1 -0
- package/dist/utils/createContext.d.ts +2 -2
- package/dist/utils/getClipboardImage.d.ts +1 -2
- package/package.json +2 -1
- package/pnpm-workspace.yaml +3 -0
|
@@ -6,10 +6,11 @@ import type { CloudBillingOverview, CloudUsage, ICloudUserInfo } from '../../../
|
|
|
6
6
|
* 使用方式(PicGo desktop 主进程会读到 process.env):
|
|
7
7
|
* PICGO_MOCK_LIFECYCLE=grace pnpm dev
|
|
8
8
|
*
|
|
9
|
-
* 可选值:active-pro | active-pro-yearly | active-grant | grace | frozen | pending-cleanup
|
|
9
|
+
* 可选值:active-pro | active-pro-yearly | active-pro-cancel | active-grant | active-grant-lifetime | grace | frozen | pending-cleanup | redemption-stacked | redemption-stacked-long | subscription-with-redemption | subscription-ended-with-redemption | subscription-pending
|
|
10
10
|
* 取消 mock:unset PICGO_MOCK_LIFECYCLE
|
|
11
11
|
*/
|
|
12
|
-
export type MockLifecycleScenario = 'active-pro' | 'active-pro-yearly' | 'active-pro-cancel' | 'active-grant' | 'active-grant-lifetime' | 'grace' | 'frozen' | 'pending-cleanup';
|
|
12
|
+
export type MockLifecycleScenario = 'active-pro' | 'active-pro-yearly' | 'active-pro-cancel' | 'active-grant' | 'active-grant-lifetime' | 'grace' | 'frozen' | 'pending-cleanup' | 'redemption-stacked' | 'redemption-stacked-long' | 'subscription-with-redemption' | 'subscription-ended-with-redemption' | 'subscription-pending';
|
|
13
|
+
export declare const ALL_MOCK_SCENARIOS: readonly MockLifecycleScenario[];
|
|
13
14
|
export declare function getMockScenario(): MockLifecycleScenario | undefined;
|
|
14
15
|
export declare function buildMockOverview(scenario: MockLifecycleScenario): CloudBillingOverview;
|
|
15
16
|
export declare function buildMockUsage(scenario: MockLifecycleScenario, appType: 'gui' | 'cli'): CloudUsage;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IPicGo, ResolvedUploadOption, UploadOption } from '../types';
|
|
2
|
+
declare enum UploadOptionErrorCode {
|
|
3
|
+
InvalidOption = "INVALID_UPLOAD_OPTION",
|
|
4
|
+
UnknownUploader = "UNKNOWN_UPLOADER",
|
|
5
|
+
ConfigNotFound = "UPLOAD_CONFIG_NOT_FOUND",
|
|
6
|
+
AmbiguousConfig = "UPLOAD_CONFIG_AMBIGUOUS"
|
|
7
|
+
}
|
|
8
|
+
declare class UploadOptionError extends Error {
|
|
9
|
+
readonly code: UploadOptionErrorCode;
|
|
10
|
+
constructor(code: UploadOptionErrorCode, message: string);
|
|
11
|
+
}
|
|
12
|
+
declare const resolveUploadOptions: (ctx: IPicGo, option?: UploadOption) => ResolvedUploadOption | undefined;
|
|
13
|
+
export { resolveUploadOptions, UploadOptionError, UploadOptionErrorCode };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -108,6 +108,8 @@ export type CloudBillingPlanInfo = {
|
|
|
108
108
|
capability: string;
|
|
109
109
|
/** 订阅计费周期类型:'monthly' / 'yearly' / null(免费用户)。 */
|
|
110
110
|
billingPeriod: string | null;
|
|
111
|
+
/** 订阅来源的 plan code;与限时会员同时存在时,订阅那一行用它展示自己的档位。旧服务端不下发。 */
|
|
112
|
+
subscription?: string;
|
|
111
113
|
source: 'entitlement' | 'admin_grant' | 'both' | 'free';
|
|
112
114
|
};
|
|
113
115
|
export type CloudLifecyclePhase = 'active' | 'grace' | 'frozen' | 'pending_cleanup';
|
|
@@ -130,14 +132,54 @@ export type CloudLifecycleInfo = {
|
|
|
130
132
|
currentPhaseEndsAt: string | null;
|
|
131
133
|
flags: CloudLifecycleFlags;
|
|
132
134
|
};
|
|
135
|
+
/**
|
|
136
|
+
* 服务端由 raw status + 账期终点派生的订阅有效状态。客户端判断续费 / 取消 / 已结束只看它,
|
|
137
|
+
* raw `status` 仅用于展示与排错。
|
|
138
|
+
*/
|
|
139
|
+
export declare enum CloudSubscriptionStanding {
|
|
140
|
+
Live = "live",
|
|
141
|
+
Ending = "ending",
|
|
142
|
+
Ended = "ended",
|
|
143
|
+
None = "none"
|
|
144
|
+
}
|
|
133
145
|
export type CloudSubscriptionInfo = {
|
|
134
146
|
status: string;
|
|
147
|
+
/** 旧服务端不下发。 */
|
|
148
|
+
standing?: CloudSubscriptionStanding;
|
|
135
149
|
currentPeriodEnd: string | null;
|
|
136
150
|
};
|
|
151
|
+
export declare enum CloudFixedTermSource {
|
|
152
|
+
Redemption = "redemption",
|
|
153
|
+
Admin = "admin",
|
|
154
|
+
Purchase = "purchase"
|
|
155
|
+
}
|
|
156
|
+
/** 当前生效的一种限时会员来源(兑换 / 赠送 / 买断),不会自动续费,可与订阅同时计时。 */
|
|
157
|
+
export type CloudFixedTerm = {
|
|
158
|
+
source: CloudFixedTermSource;
|
|
159
|
+
/** 该来源当前生效的 plan code(多段兑换时即当前这一段)。 */
|
|
160
|
+
plan: string;
|
|
161
|
+
/** 该来源的结束时间;兑换来源为整条叠加时间线的终点。 */
|
|
162
|
+
endsAt: string;
|
|
163
|
+
daysRemaining: number;
|
|
164
|
+
};
|
|
165
|
+
/** 叠加兑换里排在当前这一段之后的一段,按消耗顺序排列。 */
|
|
166
|
+
export type CloudRedemptionSegment = {
|
|
167
|
+
plan: string;
|
|
168
|
+
startsAt: string;
|
|
169
|
+
endsAt: string;
|
|
170
|
+
};
|
|
137
171
|
export type CloudBillingOverview = {
|
|
138
172
|
plan: CloudBillingPlanInfo;
|
|
139
173
|
lifecycle: CloudLifecycleInfo;
|
|
140
174
|
subscription: CloudSubscriptionInfo | null;
|
|
175
|
+
/** 排在当前兑换段之后的兑换段;旧服务端不下发时为空数组。 */
|
|
176
|
+
redemptionQueue: CloudRedemptionSegment[];
|
|
177
|
+
/** 当前生效的限时会员,每种来源一条;旧服务端不下发时为空数组。 */
|
|
178
|
+
fixedTerms: CloudFixedTerm[];
|
|
179
|
+
/** 已付款但订阅记录尚未由 webhook 写入时,该订阅的 plan;否则为 null。 */
|
|
180
|
+
pendingSubscription: {
|
|
181
|
+
plan: string;
|
|
182
|
+
} | null;
|
|
141
183
|
};
|
|
142
184
|
export type ImportResult = {
|
|
143
185
|
total: number;
|
|
@@ -401,7 +443,20 @@ export declare enum OutputFormat {
|
|
|
401
443
|
PRETTY = "pretty",
|
|
402
444
|
JSON = "json"
|
|
403
445
|
}
|
|
404
|
-
export interface
|
|
446
|
+
export interface UploadOption {
|
|
447
|
+
/** Registered uploader type. Omit to search all registered types by configuration name or ID. */
|
|
448
|
+
uploader?: string;
|
|
449
|
+
/** Friendly configuration name, matched case-insensitively within the search scope. */
|
|
450
|
+
configName?: string;
|
|
451
|
+
/** Stable configuration ID. A unique match takes precedence over configName. */
|
|
452
|
+
configId?: string;
|
|
453
|
+
}
|
|
454
|
+
export interface ResolvedUploadOption {
|
|
455
|
+
uploader: string;
|
|
456
|
+
/** PicGo Cloud may use the current login without a saved uploader profile. */
|
|
457
|
+
config?: IUploaderConfigItem;
|
|
458
|
+
}
|
|
459
|
+
export interface UploadOptions extends UploadOption {
|
|
405
460
|
/** Output format for the success message. Defaults to 'pretty'. */
|
|
406
461
|
outputFormat?: OutputFormat;
|
|
407
462
|
}
|
package/dist/types/internal.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Env, Handler } from 'hono';
|
|
2
|
-
import { IImgInfo, IServerManager } from '.';
|
|
1
|
+
import type { Env, Handler } from 'hono';
|
|
2
|
+
import type { IImgInfo, IServerManager, UploadOptions } from '.';
|
|
3
3
|
export interface IServerUploadAdapter {
|
|
4
|
-
uploadClipboard: () => Promise<IImgInfo[] | Error>;
|
|
5
|
-
uploadPaths: (paths: string[]) => Promise<IImgInfo[] | Error>;
|
|
4
|
+
uploadClipboard: (options?: UploadOptions) => Promise<IImgInfo[] | Error>;
|
|
5
|
+
uploadPaths: (paths: string[], options?: UploadOptions) => Promise<IImgInfo[] | Error>;
|
|
6
6
|
getTempDir?: () => string;
|
|
7
7
|
}
|
|
8
8
|
export interface IInternalServerManager<E extends Env = any> extends IServerManager<E> {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const createClipboardImagePath: (baseDir: string) => string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { IPicGo } from '../types';
|
|
1
|
+
import { IPicGo, ResolvedUploadOption } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* create an unique context for each upload process
|
|
4
4
|
* @param ctx
|
|
5
5
|
*/
|
|
6
|
-
export declare const createContext: (ctx: IPicGo) => IPicGo;
|
|
6
|
+
export declare const createContext: (ctx: IPicGo, option?: ResolvedUploadOption) => IPicGo;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { IPicGo, IClipboardImage } from '../types';
|
|
2
2
|
export type Platform = 'darwin' | 'win32' | 'win10' | 'linux' | 'wsl';
|
|
3
|
-
declare const getClipboardImage: (ctx: IPicGo) => Promise<IClipboardImage>;
|
|
4
|
-
export default getClipboardImage;
|
|
3
|
+
export declare const getClipboardImage: (ctx: IPicGo) => Promise<IClipboardImage>;
|
package/package.json
CHANGED