@siyahbeyaz/strapi-plugin-soft-delete-custom 1.1.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/LICENSE +21 -0
- package/README.md +167 -0
- package/dist/admin/src/index.d.ts +5 -0
- package/dist/admin/src/index.js +30 -0
- package/dist/admin/src/index.js.map +1 -0
- package/dist/admin/src/pages/Explorer/index.d.ts +1 -0
- package/dist/admin/src/pages/Explorer/index.js +82 -0
- package/dist/admin/src/pages/Explorer/index.js.map +1 -0
- package/dist/admin/src/pluginId.d.ts +1 -0
- package/dist/admin/src/pluginId.js +2 -0
- package/dist/admin/src/pluginId.js.map +1 -0
- package/dist/server/bootstrap.d.ts +5 -0
- package/dist/server/bootstrap.js +48 -0
- package/dist/server/bootstrap.js.map +1 -0
- package/dist/server/controllers/index.d.ts +10 -0
- package/dist/server/controllers/index.js +5 -0
- package/dist/server/controllers/index.js.map +1 -0
- package/dist/server/controllers/soft-delete-controller.d.ts +9 -0
- package/dist/server/controllers/soft-delete-controller.js +58 -0
- package/dist/server/controllers/soft-delete-controller.js.map +1 -0
- package/dist/server/destroy.d.ts +5 -0
- package/dist/server/destroy.js +6 -0
- package/dist/server/destroy.js.map +1 -0
- package/dist/server/index.d.ts +66 -0
- package/dist/server/index.js +22 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/migrations/add-soft-delete-fields.d.ts +5 -0
- package/dist/server/migrations/add-soft-delete-fields.js +9 -0
- package/dist/server/migrations/add-soft-delete-fields.js.map +1 -0
- package/dist/server/register.d.ts +5 -0
- package/dist/server/register.js +27 -0
- package/dist/server/register.js.map +1 -0
- package/dist/server/routes/index.d.ts +14 -0
- package/dist/server/routes/index.js +32 -0
- package/dist/server/routes/index.js.map +1 -0
- package/dist/server/services/index.d.ts +26 -0
- package/dist/server/services/index.js +9 -0
- package/dist/server/services/index.js.map +1 -0
- package/dist/server/services/permanent-delete-service.d.ts +8 -0
- package/dist/server/services/permanent-delete-service.js +62 -0
- package/dist/server/services/permanent-delete-service.js.map +1 -0
- package/dist/server/services/restore-service.d.ts +11 -0
- package/dist/server/services/restore-service.js +87 -0
- package/dist/server/services/restore-service.js.map +1 -0
- package/dist/server/services/soft-delete-service.d.ts +22 -0
- package/dist/server/services/soft-delete-service.js +269 -0
- package/dist/server/services/soft-delete-service.js.map +1 -0
- package/dist/strapi-admin.d.ts +2 -0
- package/dist/strapi-admin.js +3 -0
- package/dist/strapi-admin.js.map +1 -0
- package/dist/strapi-server.d.ts +2 -0
- package/dist/strapi-server.js +3 -0
- package/dist/strapi-server.js.map +1 -0
- package/package.json +64 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Soft Delete Plugin Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
# Strapi Soft Delete Plugin
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/strapi-plugin-soft-delete-custom)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
[](https://strapi.io)
|
|
6
|
+
|
|
7
|
+
> A professional soft delete plugin for Strapi v5. Safely delete content with the ability to restore, while maintaining data integrity.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- **Soft Delete**: Delete items without permanently removing them from the database
|
|
12
|
+
- **Restore Functionality**: Easily restore accidentally deleted items via Admin UI
|
|
13
|
+
- **Strapi v5 Compatible**: Fully compatible with Strapi v5.35.0 and higher
|
|
14
|
+
- **DocumentId Support**: Properly handles Strapi v5's documentId system
|
|
15
|
+
- **Admin UI Explorer**: Dedicated page to view and restore soft-deleted items
|
|
16
|
+
- **TypeScript Support**: Full TypeScript definitions included
|
|
17
|
+
- **Zero Configuration**: Works out of the box with sensible defaults
|
|
18
|
+
|
|
19
|
+
## Requirements
|
|
20
|
+
|
|
21
|
+
- Strapi v5.35.0 or higher
|
|
22
|
+
- Node.js 18.0.0 or higher
|
|
23
|
+
- npm 6.0.0 or higher
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
### From npm (recommended)
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install strapi-plugin-soft-delete-custom
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### From GitHub
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm install https://github.com/yourusername/strapi-plugin-soft-delete-custom/releases/download/v1.1.0/strapi-plugin-soft-delete-custom-1.1.0.tgz
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Local tarball
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npm install ./strapi-plugin-soft-delete-custom-1.1.0.tgz
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Configuration
|
|
46
|
+
|
|
47
|
+
Enable the plugin in `config/plugins.ts`:
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
export default {
|
|
51
|
+
'soft-delete': {
|
|
52
|
+
enabled: true,
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Then rebuild and restart:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
npm run build
|
|
61
|
+
npm run develop
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Usage
|
|
65
|
+
|
|
66
|
+
### Soft Delete
|
|
67
|
+
|
|
68
|
+
When you delete an item via the Content Manager or API, it's **not** permanently deleted. Instead:
|
|
69
|
+
|
|
70
|
+
- `softDeletedAt` field is set to the current timestamp
|
|
71
|
+
- `softDeletedById` field records who deleted it
|
|
72
|
+
- `softDeletedByType` field records the user type (admin/api)
|
|
73
|
+
|
|
74
|
+
The item becomes invisible in normal queries but can be restored.
|
|
75
|
+
|
|
76
|
+
### Restore Deleted Items
|
|
77
|
+
|
|
78
|
+
1. Go to **Plugins** → **Soft Delete** in the Admin sidebar
|
|
79
|
+
2. Select the content type from the dropdown
|
|
80
|
+
3. Find your deleted item in the list
|
|
81
|
+
4. Click **Restore** button
|
|
82
|
+
|
|
83
|
+
The item will be immediately restored and visible again in normal queries.
|
|
84
|
+
|
|
85
|
+
### Programmatic Usage
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
// Restore a soft-deleted entity
|
|
89
|
+
const restored = await strapi
|
|
90
|
+
.plugin('soft-delete')
|
|
91
|
+
.service('restore')
|
|
92
|
+
.restore('api::article.article', documentId);
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## How It Works
|
|
96
|
+
|
|
97
|
+
### Automatic Field Injection
|
|
98
|
+
|
|
99
|
+
The plugin automatically adds these fields to all content types:
|
|
100
|
+
|
|
101
|
+
- `softDeletedAt` (datetime) - When the item was soft deleted
|
|
102
|
+
- `softDeletedById` (string) - ID of the user who deleted it
|
|
103
|
+
- `softDeletedByType` (string) - Type of user (admin/api)
|
|
104
|
+
|
|
105
|
+
### Query Filtering
|
|
106
|
+
|
|
107
|
+
Soft-deleted items are automatically excluded from:
|
|
108
|
+
- `find` and `findMany` operations
|
|
109
|
+
- Content Manager list views
|
|
110
|
+
- API responses
|
|
111
|
+
|
|
112
|
+
They only appear in the Soft Delete Explorer.
|
|
113
|
+
|
|
114
|
+
## API Endpoints
|
|
115
|
+
|
|
116
|
+
All endpoints are prefixed with `/admin` and require authentication.
|
|
117
|
+
|
|
118
|
+
### List Soft Deleted Items
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
GET /admin/soft-delete/items?modelUid=api::article.article
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Restore Item
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
POST /admin/soft-delete/restore/:uid/:id
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Permissions
|
|
131
|
+
|
|
132
|
+
- `plugin::soft-delete.read` - View soft deleted items
|
|
133
|
+
- `plugin::soft-delete.restore` - Restore soft deleted items
|
|
134
|
+
|
|
135
|
+
## Troubleshooting
|
|
136
|
+
|
|
137
|
+
### Plugin not appearing in Admin
|
|
138
|
+
|
|
139
|
+
1. Ensure you've run `npm run build`
|
|
140
|
+
2. Check that `enabled: true` is set in `config/plugins.ts`
|
|
141
|
+
3. Restart the Strapi server
|
|
142
|
+
|
|
143
|
+
### Items not showing in Soft Delete Explorer
|
|
144
|
+
|
|
145
|
+
1. Check the browser console for errors
|
|
146
|
+
2. Ensure the content type has the `softDeletedAt` field
|
|
147
|
+
3. Try refreshing the page
|
|
148
|
+
|
|
149
|
+
### Migration from Strapi v4
|
|
150
|
+
|
|
151
|
+
If upgrading from v4, you may need to manually add the soft delete fields to your existing content types or run the migration script.
|
|
152
|
+
|
|
153
|
+
## Contributing
|
|
154
|
+
|
|
155
|
+
Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
156
|
+
|
|
157
|
+
## License
|
|
158
|
+
|
|
159
|
+
[MIT](LICENSE) © 2026
|
|
160
|
+
|
|
161
|
+
## Support
|
|
162
|
+
|
|
163
|
+
For issues and feature requests, please use the [GitHub issue tracker](https://github.com/yourusername/strapi-plugin-soft-delete-custom/issues).
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
**Note**: This plugin is designed for Strapi v5. For Strapi v4, please use a different version.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { PLUGIN_ID } from './pluginId.js';
|
|
2
|
+
import { Trash } from '@strapi/icons';
|
|
3
|
+
export default {
|
|
4
|
+
register(app) {
|
|
5
|
+
app.registerPlugin({
|
|
6
|
+
id: PLUGIN_ID,
|
|
7
|
+
name: 'soft-delete',
|
|
8
|
+
});
|
|
9
|
+
app.addMenuLink({
|
|
10
|
+
to: `/plugins/${PLUGIN_ID}`,
|
|
11
|
+
icon: Trash,
|
|
12
|
+
intlLabel: {
|
|
13
|
+
id: `${PLUGIN_ID}.plugin.name`,
|
|
14
|
+
defaultMessage: 'Soft Deleted',
|
|
15
|
+
},
|
|
16
|
+
Component: async () => {
|
|
17
|
+
const { Explorer } = await import('./pages/Explorer/index.js');
|
|
18
|
+
return Explorer;
|
|
19
|
+
},
|
|
20
|
+
permissions: [
|
|
21
|
+
{
|
|
22
|
+
action: 'plugin::soft-delete.read',
|
|
23
|
+
subject: null,
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
});
|
|
27
|
+
},
|
|
28
|
+
async bootstrap(app) { },
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/admin/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtC,eAAe;IACb,QAAQ,CAAC,GAAQ;QACf,GAAG,CAAC,cAAc,CAAC;YACjB,EAAE,EAAE,SAAS;YACb,IAAI,EAAE,aAAa;SACpB,CAAC,CAAC;QAEH,GAAG,CAAC,WAAW,CAAC;YACd,EAAE,EAAE,YAAY,SAAS,EAAE;YAC3B,IAAI,EAAE,KAAK;YACX,SAAS,EAAE;gBACT,EAAE,EAAE,GAAG,SAAS,cAAc;gBAC9B,cAAc,EAAE,cAAc;aAC/B;YACD,SAAS,EAAE,KAAK,IAAI,EAAE;gBACpB,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,2BAA2B,CAAC,CAAC;gBAC/D,OAAO,QAAQ,CAAC;YAClB,CAAC;YACD,WAAW,EAAE;gBACX;oBACE,MAAM,EAAE,0BAA0B;oBAClC,OAAO,EAAE,IAAI;iBACd;aACF;SACF,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,GAAQ,IAAG,CAAC;CAC7B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Explorer: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
3
|
+
import { Box, Typography, Button, Table, Thead, Tbody, Tr, Th, Td, Flex, SingleSelect, SingleSelectOption, Loader, Alert } from '@strapi/design-system';
|
|
4
|
+
import { ArrowClockwise, ArrowsCounterClockwise } from '@strapi/icons';
|
|
5
|
+
import { useFetchClient, useNotification } from '@strapi/strapi/admin';
|
|
6
|
+
export const Explorer = () => {
|
|
7
|
+
const [contentTypes, setContentTypes] = useState([]);
|
|
8
|
+
const [selectedModel, setSelectedModel] = useState('');
|
|
9
|
+
const [items, setItems] = useState([]);
|
|
10
|
+
const [loading, setLoading] = useState(false);
|
|
11
|
+
const [error, setError] = useState(null);
|
|
12
|
+
const { get, post } = useFetchClient();
|
|
13
|
+
const { toggleNotification } = useNotification();
|
|
14
|
+
// Fetch available content types on mount
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
fetchContentTypes();
|
|
17
|
+
}, []);
|
|
18
|
+
// Fetch soft deleted items when model changes
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (selectedModel) {
|
|
21
|
+
fetchSoftDeletedItems();
|
|
22
|
+
}
|
|
23
|
+
}, [selectedModel]);
|
|
24
|
+
const fetchContentTypes = async () => {
|
|
25
|
+
try {
|
|
26
|
+
const response = await get('/content-type-builder/content-types');
|
|
27
|
+
const types = response.data.data.filter((ct) => ct.uid.startsWith('api::'));
|
|
28
|
+
setContentTypes(types);
|
|
29
|
+
if (types.length > 0) {
|
|
30
|
+
setSelectedModel(types[0].uid);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
catch (err) {
|
|
34
|
+
console.error('Failed to fetch content types:', err);
|
|
35
|
+
setError('Failed to load content types');
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
const fetchSoftDeletedItems = async () => {
|
|
39
|
+
if (!selectedModel)
|
|
40
|
+
return;
|
|
41
|
+
setLoading(true);
|
|
42
|
+
setError(null);
|
|
43
|
+
try {
|
|
44
|
+
const response = await get(`/soft-delete/items?modelUid=${selectedModel}`);
|
|
45
|
+
setItems(response.data.data || []);
|
|
46
|
+
}
|
|
47
|
+
catch (err) {
|
|
48
|
+
console.error('Failed to fetch soft deleted items:', err);
|
|
49
|
+
setError(err.response?.data?.error?.message || 'Failed to fetch items');
|
|
50
|
+
setItems([]);
|
|
51
|
+
}
|
|
52
|
+
finally {
|
|
53
|
+
setLoading(false);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
const handleRestore = async (id) => {
|
|
57
|
+
try {
|
|
58
|
+
await post(`/soft-delete/restore/${selectedModel}/${id}`);
|
|
59
|
+
toggleNotification({
|
|
60
|
+
type: 'success',
|
|
61
|
+
message: 'Item restored successfully'
|
|
62
|
+
});
|
|
63
|
+
fetchSoftDeletedItems();
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
toggleNotification({
|
|
67
|
+
type: 'warning',
|
|
68
|
+
message: err.response?.data?.error?.message || 'Failed to restore item'
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
const getItemName = (item) => {
|
|
73
|
+
return item.name || item.title || item.documentId || item.id || 'Unknown';
|
|
74
|
+
};
|
|
75
|
+
const formatDate = (dateString) => {
|
|
76
|
+
if (!dateString)
|
|
77
|
+
return '-';
|
|
78
|
+
return new Date(dateString).toLocaleString();
|
|
79
|
+
};
|
|
80
|
+
return (_jsxs(Box, { padding: 8, children: [_jsxs(Flex, { justifyContent: "space-between", alignItems: "center", marginBottom: 4, children: [_jsx(Typography, { variant: "beta", children: "Soft Delete Explorer" }), _jsx(Button, { startIcon: _jsx(ArrowClockwise, {}), onClick: fetchSoftDeletedItems, loading: loading, children: "Refresh" })] }), error && (_jsx(Box, { paddingBottom: 4, children: _jsx(Alert, { closeLabel: "Close", variant: "danger", title: "Error", children: error }) })), _jsxs(Box, { paddingBottom: 4, children: [_jsx(Typography, { variant: "pi", fontWeight: "bold", paddingBottom: 2, children: "Content Type" }), _jsx(SingleSelect, { value: selectedModel, onChange: (value) => setSelectedModel(String(value)), children: contentTypes.map((ct) => (_jsx(SingleSelectOption, { value: ct.uid, children: ct.info?.displayName || ct.uid }, ct.uid))) })] }), _jsx(Box, { padding: 4, background: "neutral0", hasRadius: true, shadow: "filterShadow", children: loading ? (_jsx(Flex, { justifyContent: "center", padding: 8, children: _jsx(Loader, { children: "Loading..." }) })) : (_jsxs(Table, { colCount: 4, rowCount: items.length || 1, children: [_jsx(Thead, { children: _jsxs(Tr, { children: [_jsx(Th, { children: _jsx(Typography, { variant: "sigma", children: "Name/ID" }) }), _jsx(Th, { children: _jsx(Typography, { variant: "sigma", children: "Deleted At" }) }), _jsx(Th, { children: _jsx(Typography, { variant: "sigma", children: "Deleted By" }) }), _jsx(Th, { children: _jsx(Typography, { variant: "sigma", children: "Actions" }) })] }) }), _jsx(Tbody, { children: items.length === 0 ? (_jsx(Tr, { children: _jsx(Td, { colSpan: 4, children: _jsx(Box, { padding: 4, textAlign: "center", children: _jsx(Typography, { children: "No soft-deleted items found." }) }) }) })) : (items.map((item) => (_jsxs(Tr, { children: [_jsx(Td, { children: _jsx(Typography, { children: getItemName(item) }) }), _jsx(Td, { children: _jsx(Typography, { children: formatDate(item.softDeletedAt) }) }), _jsx(Td, { children: _jsxs(Typography, { children: [item.softDeletedByType === 'admin' ? 'Admin' : 'API', item.softDeletedById ? ` (ID: ${item.softDeletedById})` : ''] }) }), _jsx(Td, { children: _jsx(Button, { size: "S", variant: "secondary", onClick: () => handleRestore(item.documentId || item.id), startIcon: _jsx(ArrowsCounterClockwise, {}), children: "Restore" }) })] }, item.id || item.documentId)))) })] })) })] }));
|
|
81
|
+
};
|
|
82
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/admin/src/pages/Explorer/index.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EACL,GAAG,EACH,UAAU,EACV,MAAM,EACN,KAAK,EACL,KAAK,EACL,KAAK,EACL,EAAE,EACF,EAAE,EACF,EAAE,EACF,IAAI,EACJ,YAAY,EACZ,kBAAkB,EAClB,MAAM,EACN,KAAK,EACN,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAevE,MAAM,CAAC,MAAM,QAAQ,GAAG,GA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,CAAC,IAAI,EAAE,EAAE,CAAC,CAClB,MAAC,EAAE,eACD,KAAC,EAAE,cACD,KAAC,UAAU,cAAE,WAAW,CAAC,IAAI,CAAC,GAAc,GACzC,EACL,KAAC,EAAE,cACD,KAAC,UAAU,cAAE,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,GAAc,GACtD,EACL,KAAC,EAAE,cACD,MAAC,UAAU,eACR,IAAI,CAAC,iBAAiB,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,EACpD,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,SAAS,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC,CAAC,EAAE,IAClD,GACV,EACL,KAAC,EAAE,cACD,KAAC,MAAM,IACL,IAAI,EAAC,GAAG,EACR,OAAO,EAAC,WAAW,EACnB,OAAO,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,EAAE,CAAC,EACxD,SAAS,EAAE,KAAC,sBAAsB,KAAG,wBAG9B,GACN,KAtBE,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,UAAU,CAuB9B,CACN,CAAC,CACH,GACK,IACF,CACT,GACG,IACF,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PLUGIN_ID = "soft-delete";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pluginId.js","sourceRoot":"","sources":["../../../src/admin/src/pluginId.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,SAAS,GAAG,aAAa,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export default async ({ strapi }) => {
|
|
2
|
+
// 1. Decorate DB Query (lowest level - catches everything)
|
|
3
|
+
strapi.plugin('soft-delete').service('softDelete').decorateDbQuery();
|
|
4
|
+
// 2. Decorate Entity Service
|
|
5
|
+
strapi.plugin('soft-delete').service('softDelete').decorateEntityService();
|
|
6
|
+
// 3. Register Lifecycle Hooks
|
|
7
|
+
strapi.plugin('soft-delete').service('softDelete').registerLifecycleHooks();
|
|
8
|
+
// 4. Field Injection
|
|
9
|
+
const contentTypes = strapi.contentTypes;
|
|
10
|
+
for (const uid of Object.keys(contentTypes)) {
|
|
11
|
+
if (!uid.startsWith('api::')) {
|
|
12
|
+
continue;
|
|
13
|
+
}
|
|
14
|
+
const model = contentTypes[uid];
|
|
15
|
+
const attributes = model.attributes;
|
|
16
|
+
if (!attributes.softDeletedAt) {
|
|
17
|
+
attributes.softDeletedAt = {
|
|
18
|
+
type: 'datetime',
|
|
19
|
+
columnName: 'soft_deleted_at',
|
|
20
|
+
configurable: false,
|
|
21
|
+
visible: false,
|
|
22
|
+
writable: true,
|
|
23
|
+
private: true,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
if (!attributes.softDeletedById) {
|
|
27
|
+
attributes.softDeletedById = {
|
|
28
|
+
type: 'integer',
|
|
29
|
+
columnName: 'soft_deleted_by_id',
|
|
30
|
+
configurable: false,
|
|
31
|
+
visible: false,
|
|
32
|
+
writable: true,
|
|
33
|
+
private: true,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
if (!attributes.softDeletedByType) {
|
|
37
|
+
attributes.softDeletedByType = {
|
|
38
|
+
type: 'string',
|
|
39
|
+
columnName: 'soft_deleted_by_type',
|
|
40
|
+
configurable: false,
|
|
41
|
+
visible: false,
|
|
42
|
+
writable: true,
|
|
43
|
+
private: true,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=bootstrap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../src/server/bootstrap.ts"],"names":[],"mappings":"AAEA,eAAe,KAAK,EAAE,EAAE,MAAM,EAA2B,EAAE,EAAE;IAC3D,2DAA2D;IAC3D,MAAM,CAAC,MA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G;gBAC7B,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE,sBAAsB;gBAClC,YAAY,EAAE,KAAK;gBACnB,OAAO,EAAE,KAAK;gBACd,QAAQ,EAAE,IAAI;gBACd,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
softDelete: ({ strapi }: {
|
|
3
|
+
strapi: import("@strapi/types/dist/core/strapi.js").Strapi;
|
|
4
|
+
}) => {
|
|
5
|
+
getSoftDeletedItems(ctx: any): Promise<any>;
|
|
6
|
+
restore(ctx: any): Promise<any>;
|
|
7
|
+
permanentDelete(ctx: any): Promise<any>;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/server/controllers/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,6BAA6B,CAAC;AAErD,eAAe;IACb,UAAU;CACX,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Core } from '@strapi/strapi';
|
|
2
|
+
declare const _default: ({ strapi }: {
|
|
3
|
+
strapi: Core.Strapi;
|
|
4
|
+
}) => {
|
|
5
|
+
getSoftDeletedItems(ctx: any): Promise<any>;
|
|
6
|
+
restore(ctx: any): Promise<any>;
|
|
7
|
+
permanentDelete(ctx: any): Promise<any>;
|
|
8
|
+
};
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export default ({ strapi }) => ({
|
|
2
|
+
async getSoftDeletedItems(ctx) {
|
|
3
|
+
const { modelUid, _q, _limit, _start } = ctx.query;
|
|
4
|
+
strapi.log.info(`[Soft Delete] getSoftDeletedItems called with modelUid: ${modelUid}`);
|
|
5
|
+
if (!modelUid) {
|
|
6
|
+
strapi.log.warn('[Soft Delete] modelUid is required but not provided');
|
|
7
|
+
return ctx.badRequest('modelUid is required');
|
|
8
|
+
}
|
|
9
|
+
const filters = {
|
|
10
|
+
softDeletedAt: { $notNull: true },
|
|
11
|
+
};
|
|
12
|
+
if (_q) {
|
|
13
|
+
// Basic search implementation if needed
|
|
14
|
+
}
|
|
15
|
+
strapi.log.info(`[Soft Delete] Querying with filters: ${JSON.stringify(filters)}`);
|
|
16
|
+
try {
|
|
17
|
+
const results = await strapi.entityService.findMany(modelUid, {
|
|
18
|
+
filters,
|
|
19
|
+
limit: _limit ? parseInt(_limit) : 10,
|
|
20
|
+
start: _start ? parseInt(_start) : 0,
|
|
21
|
+
});
|
|
22
|
+
strapi.log.info(`[Soft Delete] Found ${results?.length || 0} items`);
|
|
23
|
+
const count = await strapi.entityService.count(modelUid, {
|
|
24
|
+
filters,
|
|
25
|
+
});
|
|
26
|
+
strapi.log.info(`[Soft Delete] Total count: ${count}`);
|
|
27
|
+
return { data: results, pagination: { total: count } };
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
strapi.log.error(`[Soft Delete] Error fetching items: ${error.message}`);
|
|
31
|
+
return ctx.badRequest(`Error fetching soft deleted items: ${error.message}`);
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
async restore(ctx) {
|
|
35
|
+
const { uid, id } = ctx.params;
|
|
36
|
+
try {
|
|
37
|
+
const result = await strapi.plugin('soft-delete').service('restore').restore(uid, id);
|
|
38
|
+
return result;
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
return ctx.badRequest(error.message);
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
async permanentDelete(ctx) {
|
|
45
|
+
const { uid, id } = ctx.params;
|
|
46
|
+
const { confirm } = ctx.request.body;
|
|
47
|
+
strapi.log.info(`[Soft Delete] permanentDelete - uid: ${uid}, id: ${id}, confirm: ${confirm}`);
|
|
48
|
+
try {
|
|
49
|
+
const result = await strapi.plugin('soft-delete').service('permanentDelete').delete(uid, id, { confirm });
|
|
50
|
+
return result;
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
strapi.log.error(`[Soft Delete] permanentDelete error: ${error.message}`);
|
|
54
|
+
return ctx.badRequest(error.message);
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
//# sourceMappingURL=soft-delete-controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"soft-delete-controller.js","sourceRoot":"","sources":["../../../src/server/controllers/soft-delete-controller.ts"],"names":[],"mappings":"AAEA,eAAe,CAAC,EAAE,MAAM,EAA2B,EAAE,EAAE,CAAC,CAAC;IACvD,KAAK,CAAC,mBAAmB,CAAC,GAAQ;QAChC,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC;QAEnD,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,2DAA2D,QAAQ,EAAE,CAAC,CAAC;QAEvF,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,qDAAqD,CAAC,CAAC;YACvE,OAAO,GAAG,CAAC,UAAU,CAAC,sBAAsB,CAAC,CAAC;QAChD,CAAC;QAED,MAAM,OAAO,GAAQ;YACnB,aAAa,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;SAClC,CAAC;QAEF,IAAI,EAAE,EAAE,CAAC;YACP,wCAAwC;QAC1C,CAAC;QAED,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,wCAAwC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAEnF,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,QAAe,EAAE;gBACnE,OAAO;gBACP,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAA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E,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC;QAC/B,MAAM,EAAE,OAAO,EAAE,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC;QAErC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,wCAAwC,GAAG,SAAS,EAAE,cAAc,OAAO,EAAE,CAAC,CAAC;QAE/F,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;YAC1G,OAAO,MAAM,CAAC;QAChB,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,wCAAwC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YAC1E,OAAO,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACvC,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"destroy.js","sourceRoot":"","sources":["../../src/server/destroy.ts"],"names":[],"mappings":"AAEA,eAAe,KAAK,EAAE,EAAE,MAAM,EAA2B,EAAE,EAAE;IAC3D,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,oCAAoC,CAAC,CAAC;IACtD,2DAA2D;IAC3D,8CAA8C;AAChD,CAAC,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
services: {
|
|
3
|
+
softDelete: ({ strapi }: {
|
|
4
|
+
strapi: import("@strapi/types/dist/core/strapi.js").Strapi;
|
|
5
|
+
}) => {
|
|
6
|
+
decorateDbQuery(): void;
|
|
7
|
+
decorateEntityService(): void;
|
|
8
|
+
decorateDocumentService(): void;
|
|
9
|
+
registerLifecycleHooks(): void;
|
|
10
|
+
};
|
|
11
|
+
restore: ({ strapi }: {
|
|
12
|
+
strapi: import("@strapi/types/dist/core/strapi.js").Strapi;
|
|
13
|
+
}) => {
|
|
14
|
+
restore(uid: string, id: string | number): Promise<{
|
|
15
|
+
data: any;
|
|
16
|
+
warnings: never[];
|
|
17
|
+
}>;
|
|
18
|
+
bulkRestore(uid: string, ids: (string | number)[]): Promise<import("@strapi/database/dist/types/index.js").CountResult>;
|
|
19
|
+
};
|
|
20
|
+
permanentDelete: ({ strapi }: {
|
|
21
|
+
strapi: import("@strapi/types/dist/core/strapi.js").Strapi;
|
|
22
|
+
}) => {
|
|
23
|
+
delete(uid: string, id: string | number, params?: any): Promise<any>;
|
|
24
|
+
bulkDelete(uid: string, ids: (string | number)[], params?: any): Promise<any>;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
bootstrap: ({ strapi }: {
|
|
28
|
+
strapi: import("@strapi/types/dist/core/strapi.js").Strapi;
|
|
29
|
+
}) => Promise<void>;
|
|
30
|
+
register: ({ strapi }: {
|
|
31
|
+
strapi: import("@strapi/types/dist/core/strapi.js").Strapi;
|
|
32
|
+
}) => Promise<void>;
|
|
33
|
+
controllers: {
|
|
34
|
+
softDelete: ({ strapi }: {
|
|
35
|
+
strapi: import("@strapi/types/dist/core/strapi.js").Strapi;
|
|
36
|
+
}) => {
|
|
37
|
+
getSoftDeletedItems(ctx: any): Promise<any>;
|
|
38
|
+
restore(ctx: any): Promise<any>;
|
|
39
|
+
permanentDelete(ctx: any): Promise<any>;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
routes: {
|
|
43
|
+
admin: {
|
|
44
|
+
type: string;
|
|
45
|
+
routes: {
|
|
46
|
+
method: string;
|
|
47
|
+
path: string;
|
|
48
|
+
handler: string;
|
|
49
|
+
config: {
|
|
50
|
+
permissions: string[];
|
|
51
|
+
};
|
|
52
|
+
}[];
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
destroy: ({ strapi }: {
|
|
56
|
+
strapi: import("@strapi/types/dist/core/strapi.js").Strapi;
|
|
57
|
+
}) => Promise<void>;
|
|
58
|
+
config: {
|
|
59
|
+
default: {};
|
|
60
|
+
validator(): void;
|
|
61
|
+
};
|
|
62
|
+
contentTypes: {};
|
|
63
|
+
policies: {};
|
|
64
|
+
middlewares: {};
|
|
65
|
+
};
|
|
66
|
+
export default _default;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import services from './services/index.js';
|
|
2
|
+
import bootstrap from './bootstrap.js';
|
|
3
|
+
import register from './register.js';
|
|
4
|
+
import destroy from './destroy.js';
|
|
5
|
+
import controllers from './controllers/index.js';
|
|
6
|
+
import routes from './routes/index.js';
|
|
7
|
+
export default {
|
|
8
|
+
services,
|
|
9
|
+
bootstrap,
|
|
10
|
+
register,
|
|
11
|
+
controllers,
|
|
12
|
+
routes,
|
|
13
|
+
destroy,
|
|
14
|
+
config: {
|
|
15
|
+
default: {},
|
|
16
|
+
validator() { },
|
|
17
|
+
},
|
|
18
|
+
contentTypes: {},
|
|
19
|
+
policies: {},
|
|
20
|
+
middlewares: {},
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,qBAAqB,CAAC;AAC3C,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,QAAQ,MAAM,eAAe,CAAC;AACrC,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,WAAW,MAAM,wBAAwB,CAAC;AACjD,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,eAAe;IACb,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,WAAW;IACX,MAAM;IACN,OAAO;IACP,MAAM,EAAE;QACN,OAAO,EAAE,EAAE;QACX,SAAS,KAAI,CAAC;KACf;IACD,YAAY,EAAE,EAAE;IAChB,QAAQ,EAAE,EAAE;IACZ,WAAW,EAAE,EAAE;CAChB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export default async ({ strapi }) => {
|
|
2
|
+
const db = strapi.db.connection;
|
|
3
|
+
strapi.log.info('Soft Delete: Running migration to ensure columns exist...');
|
|
4
|
+
// This is a placeholder for the actual migration logic.
|
|
5
|
+
// In a real implementation, we would iterate over content types,
|
|
6
|
+
// check if columns exist in the database, and add them if missing.
|
|
7
|
+
// This requires robust handling of different SQL dialects (Postgres, MySQL, SQLite).
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=add-soft-delete-fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-soft-delete-fields.js","sourceRoot":"","sources":["../../../src/server/migrations/add-soft-delete-fields.ts"],"names":[],"mappings":"AAEA,eAAe,KAAK,EAAE,EAAE,MAAM,EAA2B,EAAE,EAAE;IAC3D,MAAM,EAAE,GAAG,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC;IAEhC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,2DAA2D,CAAC,CAAC;IAE7E,wDAAwD;IACxD,iEAAiE;IACjE,mEAAmE;IACnE,qFAAqF;AACvF,CAAC,CAAC"}
|