@@ -41,15 +41,15 @@ await appCache.setRootPayload(payload);
4141
4242## API
4343
44- ### ` updateConfig(config) `
44+ ### ` updateConfig(config: AppConfig): Promise<void> `
4545
4646Stores a new configuration object in the cache.
4747
48- ### ` getConfig() `
48+ ### ` getConfig(): Promise<AppConfig> `
4949
5050Retrieves the current configuration object from the cache.
5151
52- ### ` updatePayload(pkg , payload) `
52+ ### ` updatePayload(packageName: string , payload: Payload): void `
5353
5454Saves an analysis payload for a given package.
5555
@@ -60,18 +60,18 @@ Saves an analysis payload for a given package.
6060> [ !NOTE]
6161> Payloads are stored in the user's home directory under ` ~/.nsecure/payloads/ `
6262
63- ### ` getPayload(pkg) `
63+ ### ` getPayload(packageName: string): Payload `
6464
6565Loads an analysis payload for a given package.
6666
6767** Parameters** :
6868` pkg ` (` string ` ): Package name.
6969
70- ### ` availablePayloads() `
70+ ### ` availablePayloads(): string[] `
7171
7272Lists all available payloads (package names) in the cache.
7373
74- ### ` getPayloadOrNull(pkg) `
74+ ### ` getPayloadOrNull(packageName: string): Payload | null `
7575
7676Loads an analysis payload for a given package, or returns ` null ` if not found.
7777
@@ -81,19 +81,19 @@ Loads an analysis payload for a given package, or returns `null` if not found.
8181
8282Returns ` null ` if not found.
8383
84- ### ` updatePayloadsList(payloadsList) `
84+ ### ` updatePayloadsList(payloadsList: PayloadsList): Promise<void> `
8585
8686Updates the internal MRU/LRU and available payloads list.
8787
8888** Parameters** :
8989
9090- ` payloadsList ` (` object ` ): The new payloads list object.
9191
92- ### ` payloadsList() `
92+ ### ` payloadsList(): Promise<PayloadsList> `
9393
9494Retrieves the current MRU/LRU and available payloads list.
9595
96- ### ` initPayloadsList(options = {}) `
96+ ### ` initPayloadsList(options: InitPayloadListOptions = {}): Promise<void> `
9797
9898Initializes the payloads list, optionally resetting the cache.
9999
@@ -103,18 +103,18 @@ Initializes the payloads list, optionally resetting the cache.
103103 - ` logging ` (` boolean ` , default: ` true ` ): Enable logging.
104104 - ` reset ` (` boolean ` , default: ` false ` ): If ` true ` , reset the cache before initializing.
105105
106- ### ` removePayload(pkg) `
106+ ### ` removePayload(packageName: string): void `
107107
108108Removes a payload for a given package from the cache.
109109
110110** Parameters** :
111111- ` pkg ` (` string ` ): Package name.
112112
113- ### ` removeLastMRU() `
113+ ### ` removeLastMRU(): Promise<PayloadsList> `
114114
115115Removes the least recently used payload if the MRU exceeds the maximum allowed.
116116
117- ### ` setRootPayload(payload, options) `
117+ ### ` setRootPayload(payload: Payload , options: SetRootPayloadOptions = {}): Promise<void> `
118118
119119Sets a new root payload, updates MRU/LRU, and manages cache state.
120120
@@ -124,3 +124,38 @@ Sets a new root payload, updates MRU/LRU, and manages cache state.
124124- ` options ` (` object ` ):
125125 - ` logging ` (` boolean ` , default: ` true ` ): Enable logging.
126126 - ` local ` (` boolean ` , default: ` false ` ): Mark the payload as local.
127+
128+ ## Interfaces
129+
130+ ``` ts
131+ interface AppConfig {
132+ defaultPackageMenu: string ;
133+ ignore: {
134+ flags: Flag [];
135+ warnings: WarningName [];
136+ };
137+ theme? : " light" | " dark" ;
138+ disableExternalRequests: boolean ;
139+ }
140+
141+ interface PayloadsList {
142+ mru: string [];
143+ lru: string [];
144+ current: string ;
145+ availables: string [];
146+ lastUsed: Record <string , number >;
147+ root: string | null ;
148+ }
149+
150+ interface LoggingOption {
151+ logging? : boolean ;
152+ }
153+
154+ interface InitPayloadListOptions extends LoggingOption {
155+ reset? : boolean ;
156+ }
157+
158+ interface SetRootPayloadOptions extends LoggingOption {
159+ local? : boolean ;
160+ }
161+ ```
0 commit comments