les-revisions 1.0.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.
Files changed (41) hide show
  1. package/README.md +3 -0
  2. package/dist/_chunks/App-BkgPjE-W.js +726 -0
  3. package/dist/_chunks/App-CYbCF5EG.mjs +726 -0
  4. package/dist/_chunks/en-Cx-m8SNd.mjs +63 -0
  5. package/dist/_chunks/en-Edhi5HYx.js +63 -0
  6. package/dist/_chunks/fr-DXjiOCnX.js +63 -0
  7. package/dist/_chunks/fr-Dbv27Oj8.mjs +63 -0
  8. package/dist/_chunks/index-BYJMXObQ.mjs +70 -0
  9. package/dist/_chunks/index-C7ce1PfW.js +69 -0
  10. package/dist/admin/index.js +3 -0
  11. package/dist/admin/index.mjs +4 -0
  12. package/dist/admin/src/components/Initializer.d.ts +5 -0
  13. package/dist/admin/src/components/PluginIcon.d.ts +2 -0
  14. package/dist/admin/src/index.d.ts +10 -0
  15. package/dist/admin/src/pages/App.d.ts +2 -0
  16. package/dist/admin/src/pages/ComparePage.d.ts +2 -0
  17. package/dist/admin/src/pages/EntriesPage.d.ts +2 -0
  18. package/dist/admin/src/pages/HomePage.d.ts +2 -0
  19. package/dist/admin/src/pages/RevisionHistoryPage.d.ts +2 -0
  20. package/dist/admin/src/pluginId.d.ts +1 -0
  21. package/dist/admin/src/utils/api.d.ts +14 -0
  22. package/dist/admin/src/utils/getTranslation.d.ts +2 -0
  23. package/dist/server/index.js +900 -0
  24. package/dist/server/index.mjs +901 -0
  25. package/dist/server/src/bootstrap.d.ts +5 -0
  26. package/dist/server/src/config/index.d.ts +12 -0
  27. package/dist/server/src/content-types/index.d.ts +76 -0
  28. package/dist/server/src/content-types/revision/index.d.ts +74 -0
  29. package/dist/server/src/controllers/index.d.ts +15 -0
  30. package/dist/server/src/controllers/revision.d.ts +41 -0
  31. package/dist/server/src/destroy.d.ts +5 -0
  32. package/dist/server/src/index.d.ts +189 -0
  33. package/dist/server/src/middlewares/index.d.ts +2 -0
  34. package/dist/server/src/policies/index.d.ts +2 -0
  35. package/dist/server/src/register.d.ts +5 -0
  36. package/dist/server/src/routes/admin/index.d.ts +12 -0
  37. package/dist/server/src/routes/content-api/index.d.ts +5 -0
  38. package/dist/server/src/routes/index.d.ts +18 -0
  39. package/dist/server/src/services/index.d.ts +59 -0
  40. package/dist/server/src/services/revision.d.ts +84 -0
  41. package/package.json +69 -0
@@ -0,0 +1,5 @@
1
+ import type { Core } from '@strapi/strapi';
2
+ declare const bootstrap: ({ strapi }: {
3
+ strapi: Core.Strapi;
4
+ }) => void;
5
+ export default bootstrap;
@@ -0,0 +1,12 @@
1
+ declare const _default: {
2
+ default: {
3
+ maxVersions: number;
4
+ enabledContentTypes: string[] | "*";
5
+ excludeContentTypes: string[];
6
+ softDelete: boolean;
7
+ excludeFields: string[];
8
+ populateDepth: number;
9
+ };
10
+ validator(config: any): void;
11
+ };
12
+ export default _default;
@@ -0,0 +1,76 @@
1
+ declare const _default: {
2
+ revision: {
3
+ schema: {
4
+ kind: string;
5
+ collectionName: string;
6
+ info: {
7
+ singularName: string;
8
+ pluralName: string;
9
+ displayName: string;
10
+ description: string;
11
+ };
12
+ options: {
13
+ draftAndPublish: boolean;
14
+ };
15
+ pluginOptions: {
16
+ "content-manager": {
17
+ visible: boolean;
18
+ };
19
+ "content-type-builder": {
20
+ visible: boolean;
21
+ };
22
+ };
23
+ attributes: {
24
+ contentType: {
25
+ type: string;
26
+ required: boolean;
27
+ configurable: boolean;
28
+ };
29
+ entryDocumentId: {
30
+ type: string;
31
+ required: boolean;
32
+ configurable: boolean;
33
+ };
34
+ version: {
35
+ type: string;
36
+ required: boolean;
37
+ configurable: boolean;
38
+ default: number;
39
+ };
40
+ snapshot: {
41
+ type: string;
42
+ required: boolean;
43
+ configurable: boolean;
44
+ };
45
+ changeType: {
46
+ type: string;
47
+ enum: string[];
48
+ required: boolean;
49
+ configurable: boolean;
50
+ };
51
+ changedByName: {
52
+ type: string;
53
+ configurable: boolean;
54
+ };
55
+ changedByEmail: {
56
+ type: string;
57
+ configurable: boolean;
58
+ };
59
+ changedById: {
60
+ type: string;
61
+ configurable: boolean;
62
+ };
63
+ isDeleted: {
64
+ type: string;
65
+ default: boolean;
66
+ configurable: boolean;
67
+ };
68
+ metadata: {
69
+ type: string;
70
+ configurable: boolean;
71
+ };
72
+ };
73
+ };
74
+ };
75
+ };
76
+ export default _default;
@@ -0,0 +1,74 @@
1
+ declare const _default: {
2
+ schema: {
3
+ kind: string;
4
+ collectionName: string;
5
+ info: {
6
+ singularName: string;
7
+ pluralName: string;
8
+ displayName: string;
9
+ description: string;
10
+ };
11
+ options: {
12
+ draftAndPublish: boolean;
13
+ };
14
+ pluginOptions: {
15
+ "content-manager": {
16
+ visible: boolean;
17
+ };
18
+ "content-type-builder": {
19
+ visible: boolean;
20
+ };
21
+ };
22
+ attributes: {
23
+ contentType: {
24
+ type: string;
25
+ required: boolean;
26
+ configurable: boolean;
27
+ };
28
+ entryDocumentId: {
29
+ type: string;
30
+ required: boolean;
31
+ configurable: boolean;
32
+ };
33
+ version: {
34
+ type: string;
35
+ required: boolean;
36
+ configurable: boolean;
37
+ default: number;
38
+ };
39
+ snapshot: {
40
+ type: string;
41
+ required: boolean;
42
+ configurable: boolean;
43
+ };
44
+ changeType: {
45
+ type: string;
46
+ enum: string[];
47
+ required: boolean;
48
+ configurable: boolean;
49
+ };
50
+ changedByName: {
51
+ type: string;
52
+ configurable: boolean;
53
+ };
54
+ changedByEmail: {
55
+ type: string;
56
+ configurable: boolean;
57
+ };
58
+ changedById: {
59
+ type: string;
60
+ configurable: boolean;
61
+ };
62
+ isDeleted: {
63
+ type: string;
64
+ default: boolean;
65
+ configurable: boolean;
66
+ };
67
+ metadata: {
68
+ type: string;
69
+ configurable: boolean;
70
+ };
71
+ };
72
+ };
73
+ };
74
+ export default _default;
@@ -0,0 +1,15 @@
1
+ declare const _default: {
2
+ revision: ({ strapi }: {
3
+ strapi: import("@strapi/types/dist/core").Strapi;
4
+ }) => {
5
+ find(ctx: any): Promise<any>;
6
+ findOne(ctx: any): Promise<any>;
7
+ restore(ctx: any): Promise<any>;
8
+ delete(ctx: any): Promise<any>;
9
+ compare(ctx: any): Promise<any>;
10
+ getContentTypes(ctx: any): Promise<any>;
11
+ getEntries(ctx: any): Promise<any>;
12
+ getConfig(ctx: any): Promise<void>;
13
+ };
14
+ };
15
+ export default _default;
@@ -0,0 +1,41 @@
1
+ import type { Core } from '@strapi/strapi';
2
+ declare const revisionController: ({ strapi }: {
3
+ strapi: Core.Strapi;
4
+ }) => {
5
+ /**
6
+ * GET /revisions
7
+ * Query: contentType, documentId, page?, pageSize?, includeDeleted?
8
+ */
9
+ find(ctx: any): Promise<any>;
10
+ /**
11
+ * GET /revisions/:documentId
12
+ */
13
+ findOne(ctx: any): Promise<any>;
14
+ /**
15
+ * POST /revisions/:documentId/restore
16
+ */
17
+ restore(ctx: any): Promise<any>;
18
+ /**
19
+ * DELETE /revisions/:documentId
20
+ */
21
+ delete(ctx: any): Promise<any>;
22
+ /**
23
+ * GET /revisions/compare
24
+ * Query: rev1, rev2
25
+ */
26
+ compare(ctx: any): Promise<any>;
27
+ /**
28
+ * GET /content-types
29
+ */
30
+ getContentTypes(ctx: any): Promise<any>;
31
+ /**
32
+ * GET /entries
33
+ * Query: contentType, page?, pageSize?
34
+ */
35
+ getEntries(ctx: any): Promise<any>;
36
+ /**
37
+ * GET /config
38
+ */
39
+ getConfig(ctx: any): Promise<void>;
40
+ };
41
+ export default revisionController;
@@ -0,0 +1,5 @@
1
+ import type { Core } from '@strapi/strapi';
2
+ declare const destroy: ({ strapi }: {
3
+ strapi: Core.Strapi;
4
+ }) => void;
5
+ export default destroy;
@@ -0,0 +1,189 @@
1
+ declare const _default: {
2
+ register: ({ strapi }: {
3
+ strapi: import("@strapi/types/dist/core").Strapi;
4
+ }) => void;
5
+ bootstrap: ({ strapi }: {
6
+ strapi: import("@strapi/types/dist/core").Strapi;
7
+ }) => void;
8
+ destroy: ({ strapi }: {
9
+ strapi: import("@strapi/types/dist/core").Strapi;
10
+ }) => void;
11
+ config: {
12
+ default: {
13
+ maxVersions: number;
14
+ enabledContentTypes: string[] | "*";
15
+ excludeContentTypes: string[];
16
+ softDelete: boolean;
17
+ excludeFields: string[];
18
+ populateDepth: number;
19
+ };
20
+ validator(config: any): void;
21
+ };
22
+ controllers: {
23
+ revision: ({ strapi }: {
24
+ strapi: import("@strapi/types/dist/core").Strapi;
25
+ }) => {
26
+ find(ctx: any): Promise<any>;
27
+ findOne(ctx: any): Promise<any>;
28
+ restore(ctx: any): Promise<any>;
29
+ delete(ctx: any): Promise<any>;
30
+ compare(ctx: any): Promise<any>;
31
+ getContentTypes(ctx: any): Promise<any>;
32
+ getEntries(ctx: any): Promise<any>;
33
+ getConfig(ctx: any): Promise<void>;
34
+ };
35
+ };
36
+ routes: {
37
+ 'content-api': () => {
38
+ type: string;
39
+ routes: any[];
40
+ };
41
+ admin: () => {
42
+ type: string;
43
+ routes: {
44
+ method: string;
45
+ path: string;
46
+ handler: string;
47
+ config: {
48
+ policies: any[];
49
+ };
50
+ }[];
51
+ };
52
+ };
53
+ services: {
54
+ revision: ({ strapi }: {
55
+ strapi: import("@strapi/types/dist/core").Strapi;
56
+ }) => {
57
+ getConfig(): import("./services/revision").PluginConfig;
58
+ isEnabled(contentTypeUID: string): boolean;
59
+ getPopulate(contentTypeUID: string): true | Record<string, any>;
60
+ createRevision({ contentType, documentId, snapshot, changeType, userId }: import("./services/revision").RevisionInput): Promise<import("@strapi/types/dist/modules/documents").AnyDocument>;
61
+ findRevisions(contentType: string, documentId: string, params?: import("./services/revision").RevisionQueryParams): Promise<{
62
+ results: import("@strapi/types/dist/modules/documents").AnyDocument[];
63
+ pagination: {
64
+ page: number;
65
+ pageSize: number;
66
+ pageCount: number;
67
+ total: number;
68
+ };
69
+ }>;
70
+ findOne(revisionDocumentId: string): Promise<import("@strapi/types/dist/modules/documents").AnyDocument>;
71
+ restore(revisionDocumentId: string): Promise<import("@strapi/types/dist/modules/documents").AnyDocument>;
72
+ deleteRevision(revisionDocumentId: string): Promise<import("@strapi/types/dist/modules/documents").AnyDocument | {
73
+ documentId: import("@strapi/types/dist/modules/documents").ID;
74
+ entries: import("@strapi/types/dist/modules/documents").Result<TContentTypeUID, TParams>[];
75
+ }>;
76
+ compareRevisions(docId1: string, docId2: string): Promise<{
77
+ revision1: {
78
+ documentId: string;
79
+ id: number;
80
+ } & {
81
+ [key: string]: any;
82
+ };
83
+ revision2: {
84
+ documentId: string;
85
+ id: number;
86
+ } & {
87
+ [key: string]: any;
88
+ };
89
+ diff: {
90
+ path: string;
91
+ type: "added" | "removed" | "changed";
92
+ oldValue?: any;
93
+ newValue?: any;
94
+ }[];
95
+ }>;
96
+ pruneRevisions(contentType: string, documentId: string): Promise<void>;
97
+ getContentTypesWithRevisions(): Promise<any[]>;
98
+ getEntriesWithRevisions(contentType: string, params?: import("./services/revision").PaginationParams): Promise<{
99
+ results: any[];
100
+ pagination: {
101
+ page: number;
102
+ pageSize: number;
103
+ pageCount: number;
104
+ total: number;
105
+ };
106
+ }>;
107
+ deleteAllRevisionsForEntry(contentType: string, documentId: string): Promise<void>;
108
+ _filtersToWhere(filters: Record<string, any>): Record<string, any>;
109
+ };
110
+ };
111
+ contentTypes: {
112
+ revision: {
113
+ schema: {
114
+ kind: string;
115
+ collectionName: string;
116
+ info: {
117
+ singularName: string;
118
+ pluralName: string;
119
+ displayName: string;
120
+ description: string;
121
+ };
122
+ options: {
123
+ draftAndPublish: boolean;
124
+ };
125
+ pluginOptions: {
126
+ "content-manager": {
127
+ visible: boolean;
128
+ };
129
+ "content-type-builder": {
130
+ visible: boolean;
131
+ };
132
+ };
133
+ attributes: {
134
+ contentType: {
135
+ type: string;
136
+ required: boolean;
137
+ configurable: boolean;
138
+ };
139
+ entryDocumentId: {
140
+ type: string;
141
+ required: boolean;
142
+ configurable: boolean;
143
+ };
144
+ version: {
145
+ type: string;
146
+ required: boolean;
147
+ configurable: boolean;
148
+ default: number;
149
+ };
150
+ snapshot: {
151
+ type: string;
152
+ required: boolean;
153
+ configurable: boolean;
154
+ };
155
+ changeType: {
156
+ type: string;
157
+ enum: string[];
158
+ required: boolean;
159
+ configurable: boolean;
160
+ };
161
+ changedByName: {
162
+ type: string;
163
+ configurable: boolean;
164
+ };
165
+ changedByEmail: {
166
+ type: string;
167
+ configurable: boolean;
168
+ };
169
+ changedById: {
170
+ type: string;
171
+ configurable: boolean;
172
+ };
173
+ isDeleted: {
174
+ type: string;
175
+ default: boolean;
176
+ configurable: boolean;
177
+ };
178
+ metadata: {
179
+ type: string;
180
+ configurable: boolean;
181
+ };
182
+ };
183
+ };
184
+ };
185
+ };
186
+ policies: {};
187
+ middlewares: {};
188
+ };
189
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: {};
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: {};
2
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import type { Core } from '@strapi/strapi';
2
+ declare const register: ({ strapi }: {
3
+ strapi: Core.Strapi;
4
+ }) => void;
5
+ export default register;
@@ -0,0 +1,12 @@
1
+ declare const _default: () => {
2
+ type: string;
3
+ routes: {
4
+ method: string;
5
+ path: string;
6
+ handler: string;
7
+ config: {
8
+ policies: any[];
9
+ };
10
+ }[];
11
+ };
12
+ export default _default;
@@ -0,0 +1,5 @@
1
+ declare const _default: () => {
2
+ type: string;
3
+ routes: any[];
4
+ };
5
+ export default _default;
@@ -0,0 +1,18 @@
1
+ declare const routes: {
2
+ 'content-api': () => {
3
+ type: string;
4
+ routes: any[];
5
+ };
6
+ admin: () => {
7
+ type: string;
8
+ routes: {
9
+ method: string;
10
+ path: string;
11
+ handler: string;
12
+ config: {
13
+ policies: any[];
14
+ };
15
+ }[];
16
+ };
17
+ };
18
+ export default routes;
@@ -0,0 +1,59 @@
1
+ declare const _default: {
2
+ revision: ({ strapi }: {
3
+ strapi: import("@strapi/types/dist/core").Strapi;
4
+ }) => {
5
+ getConfig(): import("./revision").PluginConfig;
6
+ isEnabled(contentTypeUID: string): boolean;
7
+ getPopulate(contentTypeUID: string): true | Record<string, any>;
8
+ createRevision({ contentType, documentId, snapshot, changeType, userId }: import("./revision").RevisionInput): Promise<import("@strapi/types/dist/modules/documents").AnyDocument>;
9
+ findRevisions(contentType: string, documentId: string, params?: import("./revision").RevisionQueryParams): Promise<{
10
+ results: import("@strapi/types/dist/modules/documents").AnyDocument[];
11
+ pagination: {
12
+ page: number;
13
+ pageSize: number;
14
+ pageCount: number;
15
+ total: number;
16
+ };
17
+ }>;
18
+ findOne(revisionDocumentId: string): Promise<import("@strapi/types/dist/modules/documents").AnyDocument>;
19
+ restore(revisionDocumentId: string): Promise<import("@strapi/types/dist/modules/documents").AnyDocument>;
20
+ deleteRevision(revisionDocumentId: string): Promise<import("@strapi/types/dist/modules/documents").AnyDocument | {
21
+ documentId: import("@strapi/types/dist/modules/documents").ID;
22
+ entries: import("@strapi/types/dist/modules/documents").Result<TContentTypeUID, TParams>[];
23
+ }>;
24
+ compareRevisions(docId1: string, docId2: string): Promise<{
25
+ revision1: {
26
+ documentId: string;
27
+ id: number;
28
+ } & {
29
+ [key: string]: any;
30
+ };
31
+ revision2: {
32
+ documentId: string;
33
+ id: number;
34
+ } & {
35
+ [key: string]: any;
36
+ };
37
+ diff: {
38
+ path: string;
39
+ type: "added" | "removed" | "changed";
40
+ oldValue?: any;
41
+ newValue?: any;
42
+ }[];
43
+ }>;
44
+ pruneRevisions(contentType: string, documentId: string): Promise<void>;
45
+ getContentTypesWithRevisions(): Promise<any[]>;
46
+ getEntriesWithRevisions(contentType: string, params?: import("./revision").PaginationParams): Promise<{
47
+ results: any[];
48
+ pagination: {
49
+ page: number;
50
+ pageSize: number;
51
+ pageCount: number;
52
+ total: number;
53
+ };
54
+ }>;
55
+ deleteAllRevisionsForEntry(contentType: string, documentId: string): Promise<void>;
56
+ _filtersToWhere(filters: Record<string, any>): Record<string, any>;
57
+ };
58
+ };
59
+ export default _default;
@@ -0,0 +1,84 @@
1
+ import type { Core } from '@strapi/strapi';
2
+ export interface RevisionInput {
3
+ contentType: string;
4
+ documentId: string;
5
+ snapshot: Record<string, any>;
6
+ changeType: 'create' | 'update' | 'delete';
7
+ userId?: number | null;
8
+ }
9
+ export interface PaginationParams {
10
+ page?: number;
11
+ pageSize?: number;
12
+ }
13
+ export interface RevisionQueryParams extends PaginationParams {
14
+ includeDeleted?: boolean;
15
+ }
16
+ export interface PluginConfig {
17
+ maxVersions: number;
18
+ enabledContentTypes: string[] | '*';
19
+ excludeContentTypes: string[];
20
+ softDelete: boolean;
21
+ excludeFields: string[];
22
+ populateDepth: number;
23
+ }
24
+ declare const revisionService: ({ strapi }: {
25
+ strapi: Core.Strapi;
26
+ }) => {
27
+ getConfig(): PluginConfig;
28
+ isEnabled(contentTypeUID: string): boolean;
29
+ getPopulate(contentTypeUID: string): true | Record<string, any>;
30
+ createRevision({ contentType, documentId, snapshot, changeType, userId }: RevisionInput): Promise<import("@strapi/types/dist/modules/documents").AnyDocument>;
31
+ findRevisions(contentType: string, documentId: string, params?: RevisionQueryParams): Promise<{
32
+ results: import("@strapi/types/dist/modules/documents").AnyDocument[];
33
+ pagination: {
34
+ page: number;
35
+ pageSize: number;
36
+ pageCount: number;
37
+ total: number;
38
+ };
39
+ }>;
40
+ findOne(revisionDocumentId: string): Promise<import("@strapi/types/dist/modules/documents").AnyDocument>;
41
+ restore(revisionDocumentId: string): Promise<import("@strapi/types/dist/modules/documents").AnyDocument>;
42
+ deleteRevision(revisionDocumentId: string): Promise<import("@strapi/types/dist/modules/documents").AnyDocument | {
43
+ documentId: import("@strapi/types/dist/modules/documents").ID;
44
+ entries: import("@strapi/types/dist/modules/documents").Result<TContentTypeUID, TParams>[];
45
+ }>;
46
+ compareRevisions(docId1: string, docId2: string): Promise<{
47
+ revision1: {
48
+ documentId: string;
49
+ id: number;
50
+ } & {
51
+ [key: string]: any;
52
+ };
53
+ revision2: {
54
+ documentId: string;
55
+ id: number;
56
+ } & {
57
+ [key: string]: any;
58
+ };
59
+ diff: {
60
+ path: string;
61
+ type: "added" | "removed" | "changed";
62
+ oldValue?: any;
63
+ newValue?: any;
64
+ }[];
65
+ }>;
66
+ pruneRevisions(contentType: string, documentId: string): Promise<void>;
67
+ getContentTypesWithRevisions(): Promise<any[]>;
68
+ getEntriesWithRevisions(contentType: string, params?: PaginationParams): Promise<{
69
+ results: any[];
70
+ pagination: {
71
+ page: number;
72
+ pageSize: number;
73
+ pageCount: number;
74
+ total: number;
75
+ };
76
+ }>;
77
+ /**
78
+ * Soft-delete all revisions for an entry (called on entry hard-delete).
79
+ */
80
+ deleteAllRevisionsForEntry(contentType: string, documentId: string): Promise<void>;
81
+ /** Convert Document Service filters to query-engine where clause */
82
+ _filtersToWhere(filters: Record<string, any>): Record<string, any>;
83
+ };
84
+ export default revisionService;