koishi-plugin-wordpress-notifier 2.9.1 → 2.9.3

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.
@@ -1,24 +1,38 @@
1
1
  import { Context } from 'koishi';
2
2
  import { Config } from './index';
3
- export interface WordPressAuthor {
3
+ export declare class AuthCooldownError extends Error {
4
+ constructor(message: string);
5
+ }
6
+ interface WordPressAuthor {
4
7
  id: number;
5
8
  name: string;
6
- url?: string;
7
- description?: string;
8
- avatar_urls?: {
9
- '24'?: string;
10
- '48'?: string;
11
- '96'?: string;
9
+ url: string;
10
+ description: string;
11
+ link: string;
12
+ slug: string;
13
+ avatar_urls: {
14
+ [key: string]: string;
12
15
  };
16
+ meta: any;
13
17
  }
14
- export interface WordPressMedia {
18
+ interface WordPressMedia {
15
19
  id: number;
16
- source_url: string;
17
- media_type: string;
18
- mime_type: string;
19
- title?: {
20
+ date: string;
21
+ slug: string;
22
+ type: string;
23
+ link: string;
24
+ title: {
20
25
  rendered: string;
21
26
  };
27
+ author: number;
28
+ source_url: string;
29
+ media_details: any;
30
+ post: number;
31
+ }
32
+ interface WordPressEmbedded {
33
+ author?: WordPressAuthor[];
34
+ 'wp:featuredmedia'?: WordPressMedia[];
35
+ [key: string]: any;
22
36
  }
23
37
  export interface WordPressPost {
24
38
  id: number;
@@ -41,37 +55,10 @@ export interface WordPressPost {
41
55
  author: number;
42
56
  featured_media: number;
43
57
  link: string;
44
- _embedded?: {
45
- author?: WordPressAuthor[];
46
- 'wp:featuredmedia'?: WordPressMedia[];
47
- };
58
+ _embedded?: WordPressEmbedded;
48
59
  author_name?: string;
49
60
  featured_image?: string;
50
61
  }
51
- export interface WordPressUser {
52
- id: number;
53
- name: string;
54
- username: string;
55
- email: string;
56
- registered_date: string;
57
- updated_date?: string;
58
- display_name?: string;
59
- }
60
- export interface WordPressCategory {
61
- id: number;
62
- name: string;
63
- slug: string;
64
- parent: number;
65
- count: number;
66
- link: string;
67
- }
68
- export interface WordPressTag {
69
- id: number;
70
- name: string;
71
- slug: string;
72
- count: number;
73
- link: string;
74
- }
75
62
  export declare class WordPressService {
76
63
  private ctx;
77
64
  private client;
@@ -79,27 +66,63 @@ export declare class WordPressService {
79
66
  private isAuthenticated;
80
67
  private authFailureTime;
81
68
  private readonly AUTH_FAILURE_COOLDOWN;
82
- private interceptorRegistered;
69
+ private interceptorId;
83
70
  private readonly MAX_RETRIES;
84
- private retryCounts;
71
+ private readonly MAX_CONCURRENT_REQUESTS;
72
+ private limit;
73
+ private activeRequests;
74
+ private requestQueue;
75
+ private cache;
76
+ private readonly CACHE_DURATION;
77
+ private cacheCleanupInterval;
78
+ private stats;
85
79
  constructor(ctx: Context, config: Config);
86
80
  private createClient;
87
81
  private setupResponseInterceptor;
82
+ removeResponseInterceptor(): void;
88
83
  private checkAuthStatus;
84
+ private executeWithConcurrencyControl;
85
+ private executeWithRetry;
86
+ private processNextRequest;
87
+ private isNetworkError;
88
+ private getCache;
89
+ private setCache;
90
+ private setupCacheCleanup;
91
+ private cleanupCache;
89
92
  getLatestPosts(perPage?: number, page?: number): Promise<WordPressPost[]>;
90
93
  getPostById(id: number): Promise<WordPressPost>;
91
- getUsers(): Promise<WordPressUser[]>;
92
- getUser(userId: number): Promise<WordPressUser | null>;
93
- searchPosts(query: string, perPage?: number): Promise<WordPressPost[]>;
94
- getCategories(): Promise<WordPressCategory[]>;
95
- getTags(): Promise<WordPressTag[]>;
94
+ getStatus(): {
95
+ wordpressUrl: string;
96
+ apiEndpoint: string;
97
+ isAuthenticated: boolean;
98
+ inCooldown: boolean;
99
+ cooldownTimeRemaining: number;
100
+ stats: {
101
+ totalRequests: number;
102
+ successfulRequests: number;
103
+ failedRequests: number;
104
+ successRate: string;
105
+ averageResponseTime: string;
106
+ commandCount: number;
107
+ };
108
+ cache: {
109
+ size: number;
110
+ duration: number;
111
+ cleanupInterval: number;
112
+ };
113
+ concurrency: {
114
+ max: number;
115
+ };
116
+ features: {
117
+ retryEnabled: boolean;
118
+ retryLimit: number;
119
+ cacheEnabled: boolean;
120
+ concurrencyControl: boolean;
121
+ };
122
+ };
123
+ cleanup(): void;
124
+ resetStats(): void;
96
125
  private logError;
97
126
  private sanitizeError;
98
- resetAuthStatus(): void;
99
- getAuthStatus(): boolean;
100
- checkConnection(): Promise<{
101
- success: boolean;
102
- message: string;
103
- details?: any;
104
- }>;
105
127
  }
128
+ export {};