@adminforth/auto-remove 1.0.10 → 1.0.12
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.ts +16 -0
- package/dist/types.d.ts +45 -0
- package/dist/utils/parseDuration.d.ts +1 -0
- package/dist/utils/parseNumber.d.ts +1 -0
- package/package.json +3 -3
- package/tsconfig.json +1 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AdminForthPlugin } from "adminforth";
|
|
2
|
+
import type { IAdminForth, IHttpServer, AdminForthResource } from "adminforth";
|
|
3
|
+
import type { PluginOptions } from './types.js';
|
|
4
|
+
export default class AutoRemovePlugin extends AdminForthPlugin {
|
|
5
|
+
options: PluginOptions;
|
|
6
|
+
resource?: AdminForthResource;
|
|
7
|
+
timer?: NodeJS.Timeout;
|
|
8
|
+
constructor(options: PluginOptions);
|
|
9
|
+
instanceUniqueRepresentation(pluginOptions: any): string;
|
|
10
|
+
modifyResourceConfig(adminforth: IAdminForth, resourceConfig: AdminForthResource): Promise<void>;
|
|
11
|
+
validateConfigAfterDiscover(adminforth: IAdminForth, resourceConfig: AdminForthResource): void;
|
|
12
|
+
private runCleanup;
|
|
13
|
+
private cleanupByCount;
|
|
14
|
+
private cleanupByTime;
|
|
15
|
+
setupEndpoints(server: IHttpServer): void;
|
|
16
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type PluginsCommonOptions } from "adminforth";
|
|
2
|
+
export type AutoRemoveMode = 'count-based' | 'time-based';
|
|
3
|
+
/**
|
|
4
|
+
* count-based 100, 1k, 1kk, 1m
|
|
5
|
+
*/
|
|
6
|
+
export type HumanNumber = string;
|
|
7
|
+
/**
|
|
8
|
+
* s
|
|
9
|
+
* min
|
|
10
|
+
* h
|
|
11
|
+
* d
|
|
12
|
+
* w
|
|
13
|
+
* mon
|
|
14
|
+
* y
|
|
15
|
+
*/
|
|
16
|
+
export type HumanDuration = string;
|
|
17
|
+
export interface PluginOptions extends PluginsCommonOptions {
|
|
18
|
+
createdAtField: string;
|
|
19
|
+
/**
|
|
20
|
+
* - count-based: Delete items > maxItems
|
|
21
|
+
* - time-based: Delete age > maxAge
|
|
22
|
+
*/
|
|
23
|
+
mode: AutoRemoveMode;
|
|
24
|
+
/**
|
|
25
|
+
* for count-based mode (100', '1k', '10k', '1m')
|
|
26
|
+
*/
|
|
27
|
+
keepAtLeast?: HumanNumber;
|
|
28
|
+
/**
|
|
29
|
+
* Minimum number of items to always keep in count-based mode.
|
|
30
|
+
* This acts as a safety threshold together with `keepAtLeast`.
|
|
31
|
+
* Example formats: '100', '1k', '10k', '1m'.
|
|
32
|
+
*
|
|
33
|
+
* Validation ensures that minItemsKeep <= keepAtLeast.
|
|
34
|
+
*/
|
|
35
|
+
minItemsKeep?: HumanNumber;
|
|
36
|
+
/**
|
|
37
|
+
* Max age of item for time-based mode ('1d', '7d', '1mo', '1y')
|
|
38
|
+
*/
|
|
39
|
+
deleteOlderThan?: HumanDuration;
|
|
40
|
+
/**
|
|
41
|
+
* Interval for running cleanup (e.g. '1h', '1d')
|
|
42
|
+
* Default '1d'
|
|
43
|
+
*/
|
|
44
|
+
interval?: HumanDuration;
|
|
45
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function parseDuration(value: string): number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function parseHumanNumber(value: string): number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adminforth/auto-remove",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -25,13 +25,13 @@
|
|
|
25
25
|
"description": "Automatic record cleanup plugin for AdminForth with age-based and count-based retention rules",
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/node": "latest",
|
|
28
|
-
"adminforth": "
|
|
28
|
+
"adminforth": "3.0.1",
|
|
29
29
|
"semantic-release": "^24.2.1",
|
|
30
30
|
"semantic-release-slack-bot": "^4.0.2",
|
|
31
31
|
"typescript": "^5.7.3"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"adminforth": "
|
|
34
|
+
"adminforth": "3.0.1"
|
|
35
35
|
},
|
|
36
36
|
"release": {
|
|
37
37
|
"plugins": [
|
package/tsconfig.json
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include*/
|
|
4
4
|
"module": "node16", /* Specify what module code is generated. */
|
|
5
|
+
"declaration": true,
|
|
5
6
|
"outDir": "./dist", /* Specify an output folder for all emitted files. */
|
|
6
7
|
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. */
|
|
7
8
|
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|