@strapi/admin 4.10.0-beta.0 → 4.10.0-beta.1
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/.eslintignore +4 -0
- package/.eslintrc.js +14 -0
- package/admin/src/components/LanguageProvider/index.js +1 -1
- package/admin/src/components/LocalesProvider/__mocks__/useLocalesProvider.js +7 -0
- package/admin/src/components/LocalesProvider/index.js +2 -3
- package/admin/src/content-manager/components/CollectionTypeFormWrapper/index.js +3 -6
- package/admin/src/content-manager/components/DynamicTable/CellContent/ReviewWorkflowsStage/getTableColumn.js +2 -0
- package/admin/src/content-manager/components/DynamicTable/index.js +11 -29
- package/admin/src/content-manager/components/EditViewDataManagerProvider/reducer.js +12 -6
- package/admin/src/content-manager/components/EditViewDataManagerProvider/utils/findAllAndReplace.js +10 -3
- package/admin/src/content-manager/components/InputUID/endActionStyle.js +4 -13
- package/admin/src/content-manager/components/InputUID/index.js +95 -72
- package/admin/src/content-manager/components/SingleTypeFormWrapper/index.js +4 -8
- package/admin/src/content-manager/pages/App/LeftMenu/index.js +56 -35
- package/admin/src/content-manager/pages/App/actions.js +19 -7
- package/admin/src/content-manager/pages/App/constants.js +3 -3
- package/admin/src/content-manager/pages/App/index.js +5 -4
- package/admin/src/content-manager/pages/App/reducer.js +7 -6
- package/admin/src/content-manager/pages/App/selectors.js +3 -0
- package/admin/src/content-manager/pages/App/{useModels.js → useContentManagerInitData.js} +29 -28
- package/admin/src/content-manager/pages/App/utils/generateModelsLinks.js +2 -2
- package/admin/src/content-manager/pages/App/utils/getContentTypeLinks.js +17 -15
- package/admin/src/content-manager/pages/EditSettingsView/components/ModalForm.js +4 -5
- package/admin/src/content-manager/pages/EditSettingsView/index.js +4 -0
- package/admin/src/content-manager/pages/EditSettingsView/reducer.js +6 -7
- package/admin/src/content-manager/pages/EditSettingsView/utils/layout.js +1 -30
- package/admin/src/content-manager/pages/EditView/DeleteLink/index.js +5 -11
- package/admin/src/content-manager/pages/EditView/index.js +2 -7
- package/admin/src/content-manager/pages/ListSettingsView/index.js +1 -0
- package/admin/src/content-manager/sharedReducers/crudReducer/actions.js +6 -0
- package/admin/src/content-manager/sharedReducers/crudReducer/constants.js +1 -0
- package/admin/src/content-manager/sharedReducers/crudReducer/reducer.js +5 -0
- package/admin/src/hooks/useConfigurations/__mocks__/index.js +7 -0
- package/admin/src/hooks/useFetchMarketplacePlugins/utils/api.js +7 -8
- package/admin/src/hooks/useFetchMarketplaceProviders/utils/api.js +5 -0
- package/admin/src/hooks/useRegenerate/index.js +12 -7
- package/admin/src/pages/AuthPage/components/Register/index.js +46 -38
- package/admin/src/pages/HomePage/SocialLinks.js +1 -1
- package/admin/src/pages/MarketplacePage/components/EmptyNpmPackageSearch/index.js +3 -3
- package/admin/src/pages/MarketplacePage/components/NpmPackagesGrid/index.js +42 -9
- package/admin/src/pages/MarketplacePage/components/NpmPackagesPagination/index.js +26 -0
- package/admin/src/pages/MarketplacePage/components/OfflineLayout/index.js +45 -0
- package/admin/src/pages/MarketplacePage/index.js +80 -175
- package/admin/src/pages/MarketplacePage/utils/useMarketplaceData.js +85 -0
- package/admin/src/pages/SettingsPage/components/Tokens/FormHead/index.js +4 -0
- package/admin/src/pages/SettingsPage/components/Tokens/Regenerate/index.js +5 -3
- package/admin/src/pages/SettingsPage/components/Tokens/TokenTypeSelect/index.js +7 -5
- package/admin/src/pages/SettingsPage/pages/Roles/ListPage/components/RoleRow/index.js +12 -4
- package/admin/src/pages/SettingsPage/pages/Roles/ListPage/index.js +21 -2
- package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/components/FormTransferTokenContainer/index.js +41 -0
- package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/index.js +53 -9
- package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/utils/schema.js +1 -0
- package/admin/src/pages/SettingsPage/pages/TransferTokens/ListView/index.js +27 -5
- package/admin/src/translations/en.json +51 -49
- package/admin/src/translations/ru.json +51 -19
- package/build/1387.84b454d3.chunk.js +1 -0
- package/build/1657.45231968.chunk.js +168 -0
- package/build/3081.bcf9a12f.chunk.js +108 -0
- package/build/462.8fff7f3b.chunk.js +71 -0
- package/build/4628.20631dd1.chunk.js +1 -0
- package/build/5542.b8240e3f.chunk.js +70 -0
- package/build/5563.905daa13.chunk.js +79 -0
- package/build/6404.68405699.chunk.js +100 -0
- package/build/7259.b7d00cea.chunk.js +1 -0
- package/build/8694.6522968d.chunk.js +247 -0
- package/build/Admin-authenticatedApp.52c88751.chunk.js +79 -0
- package/build/Admin_InternalErrorPage.15c6bf07.chunk.js +1 -0
- package/build/Admin_homePage.f9309c6d.chunk.js +73 -0
- package/build/Admin_marketplace.56bc1008.chunk.js +31 -0
- package/build/Admin_pluginsPage.f6b52ee9.chunk.js +6 -0
- package/build/Admin_profilePage.9112cffc.chunk.js +15 -0
- package/build/Admin_settingsPage.257b3477.chunk.js +79 -0
- package/build/Upload_ConfigureTheView.eaaec495.chunk.js +1 -0
- package/build/admin-app.dfaeea5d.chunk.js +110 -0
- package/build/admin-edit-roles-page.4f1858e9.chunk.js +280 -0
- package/build/admin-edit-users.7e14d85f.chunk.js +10 -0
- package/build/admin-roles-list.329c1f63.chunk.js +31 -0
- package/build/admin-users.d02de059.chunk.js +34 -0
- package/build/api-tokens-create-page.97595e12.chunk.js +1 -0
- package/build/api-tokens-edit-page.cd36e30e.chunk.js +1 -0
- package/build/api-tokens-list-page.6757c7b9.chunk.js +16 -0
- package/build/audit-logs-settings-page.19d90bda.chunk.js +76 -0
- package/build/content-manager.def692c2.chunk.js +1130 -0
- package/build/content-type-builder-list-view.9c2c020c.chunk.js +214 -0
- package/build/content-type-builder-translation-en-json.510e88ca.chunk.js +1 -0
- package/build/content-type-builder.5e1f4afc.chunk.js +126 -0
- package/build/email-settings-page.1095e1ab.chunk.js +10 -0
- package/build/en-json.08303b37.chunk.js +1 -0
- package/build/{highlight.js.26ef649f.chunk.js → highlight.js.28a1547e.chunk.js} +2 -2
- package/build/i18n-settings-page.7d80aae0.chunk.js +60 -0
- package/build/index.html +1 -1
- package/build/main.120be100.js +2280 -0
- package/build/review-workflows-settings.9092ed72.chunk.js +106 -0
- package/build/ru-json.e0662702.chunk.js +1 -0
- package/build/{runtime~main.5a95bee6.js → runtime~main.112b3101.js} +2 -2
- package/build/sso-settings-page.1dd4886e.chunk.js +1 -0
- package/build/transfer-tokens-create-page.ec2ca215.chunk.js +1 -0
- package/build/transfer-tokens-edit-page.22bf28e5.chunk.js +1 -0
- package/build/transfer-tokens-list-page.cf8c77f2.chunk.js +16 -0
- package/build/upload-settings.945fdcfa.chunk.js +13 -0
- package/build/{upload-translation-th-json.3847dae0.chunk.js → upload-translation-th-json.98d35574.chunk.js} +1 -1
- package/build/upload.a86b1054.chunk.js +33 -0
- package/build/users-advanced-settings-page.5b5a9baa.chunk.js +8 -0
- package/build/users-email-settings-page.e5506eb4.chunk.js +23 -0
- package/build/users-providers-settings-page.e32089c2.chunk.js +28 -0
- package/build/users-roles-settings-page.2f85dcec.chunk.js +30 -0
- package/build/webhook-edit-page.213f0075.chunk.js +75 -0
- package/build/webhook-list-page.5beb2a5c.chunk.js +71 -0
- package/{admin/src/content-manager/components/DynamicTable/CellContent/ReviewWorkflowsStage/ReviewWorkflowsStage.js → ee/admin/content-manager/components/DynamicTable/CellContent/ReviewWorkflowsStage/ReviewWorkflowsStageEE.js} +2 -2
- package/ee/admin/content-manager/components/DynamicTable/CellContent/ReviewWorkflowsStage/getTableColumn.js +45 -0
- package/ee/admin/content-manager/components/DynamicTable/CellContent/ReviewWorkflowsStage/index.js +3 -0
- package/ee/admin/content-manager/pages/EditView/InformationBox/InformationBoxEE.js +61 -18
- package/ee/admin/hooks/useLicenseLimitNotification/index.js +1 -1
- package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/hooks/useAuditLogsData.js +6 -3
- package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/index.js +15 -5
- package/ee/admin/pages/SettingsPage/pages/AuditLogs/ListView/utils/getDisplayedFilters.js +52 -45
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/ReviewWorkflows.js +8 -4
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/Stage/Stage.js +2 -2
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/hooks/useReviewWorkflows.js +2 -2
- package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/reducer/index.js +2 -1
- package/ee/server/content-types/workflow/index.js +0 -3
- package/ee/server/content-types/workflow-stage/index.js +0 -5
- package/ee/server/controllers/workflows/stages/index.js +8 -1
- package/ee/server/register.js +3 -1
- package/ee/server/services/audit-logs.js +75 -16
- package/ee/server/services/review-workflows/entity-service-decorator.js +17 -5
- package/ee/server/services/review-workflows/review-workflows.js +27 -91
- package/ee/server/services/review-workflows/stages.js +108 -7
- package/ee/server/utils/persisted-tables.js +114 -22
- package/ee/server/utils/review-workflows.js +9 -0
- package/jest.config.front.js +1 -6
- package/package.json +24 -22
- package/server/controllers/transfer/runner.js +4 -2
- package/server/middlewares/data-transfer.js +4 -1
- package/server/routes/transfer.js +13 -4
- package/server/services/constants.js +4 -0
- package/server/services/transfer/permission.js +1 -1
- package/server/services/transfer/token.js +33 -31
- package/server/validation/transfer/token.js +10 -2
- package/webpack.config.js +6 -2
- package/admin/src/content-manager/components/DynamicTable/CellContent/ReviewWorkflowsStage/index.js +0 -1
- package/admin/src/content-manager/pages/App/LeftMenu/utils/index.js +0 -1
- package/admin/src/content-manager/pages/App/LeftMenu/utils/matchByTitle.js +0 -24
- package/build/2263.4c5916f9.chunk.js +0 -98
- package/build/4049.64715f20.chunk.js +0 -1
- package/build/4649.213b8a3b.chunk.js +0 -30
- package/build/6985.66cca29c.chunk.js +0 -1
- package/build/7259.aefb51e8.chunk.js +0 -1
- package/build/8469.853c822b.chunk.js +0 -1
- package/build/9505.dbe702ab.chunk.js +0 -14
- package/build/9816.01ee964f.chunk.js +0 -2
- package/build/Admin-authenticatedApp.f50ad423.chunk.js +0 -79
- package/build/Admin_InternalErrorPage.4ad8b0df.chunk.js +0 -1
- package/build/Admin_homePage.1411fb7c.chunk.js +0 -68
- package/build/Admin_marketplace.02608d56.chunk.js +0 -22
- package/build/Admin_pluginsPage.15e3b0fd.chunk.js +0 -1
- package/build/Admin_profilePage.76afeca0.chunk.js +0 -15
- package/build/Admin_settingsPage.147755cd.chunk.js +0 -9
- package/build/Upload_ConfigureTheView.34dde278.chunk.js +0 -1
- package/build/admin-app.55dd7921.chunk.js +0 -112
- package/build/admin-edit-roles-page.cf543488.chunk.js +0 -216
- package/build/admin-edit-users.31c20712.chunk.js +0 -10
- package/build/admin-roles-list.489c501f.chunk.js +0 -2
- package/build/admin-users.3e111a7d.chunk.js +0 -11
- package/build/api-tokens-create-page.4328b852.chunk.js +0 -1
- package/build/api-tokens-edit-page.bce5050f.chunk.js +0 -1
- package/build/api-tokens-list-page.93f24348.chunk.js +0 -16
- package/build/audit-logs-settings-page.7be97e82.chunk.js +0 -1
- package/build/content-manager.4480ae88.chunk.js +0 -1137
- package/build/content-type-builder-list-view.cf38fe2f.chunk.js +0 -191
- package/build/content-type-builder-translation-en-json.7961593e.chunk.js +0 -1
- package/build/content-type-builder.af9abf1e.chunk.js +0 -126
- package/build/email-settings-page.4bdbef9a.chunk.js +0 -3
- package/build/en-json.697b4bcf.chunk.js +0 -1
- package/build/i18n-settings-page.2bb5be96.chunk.js +0 -1
- package/build/main.af8c0f31.js +0 -3790
- package/build/review-workflows-settings.7a7dc773.chunk.js +0 -57
- package/build/ru-json.6a01cea6.chunk.js +0 -1
- package/build/sso-settings-page.272b87c8.chunk.js +0 -1
- package/build/transfer-tokens-create-page.a1f14bb1.chunk.js +0 -1
- package/build/transfer-tokens-edit-page.00ee1c74.chunk.js +0 -1
- package/build/transfer-tokens-list-page.ce37354b.chunk.js +0 -16
- package/build/upload-settings.0875e973.chunk.js +0 -1
- package/build/upload.c7da1611.chunk.js +0 -13
- package/build/users-advanced-settings-page.1d3c14c7.chunk.js +0 -1
- package/build/users-email-settings-page.e8db68c4.chunk.js +0 -1
- package/build/users-providers-settings-page.14cac425.chunk.js +0 -1
- package/build/users-roles-settings-page.2ea4de84.chunk.js +0 -30
- package/build/webhook-edit-page.329141a5.chunk.js +0 -23
- package/build/webhook-list-page.029957a4.chunk.js +0 -1
- package/ee/server/migrations/review-workflows.js +0 -39
- package/ee/server/utils/test.js +0 -11
- /package/admin/src/{content-manager/components/InputUID/useDebounce.js → hooks/useDebounce/index.js} +0 -0
|
@@ -1,49 +1,141 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const { differenceWith, isEqual } = require('lodash/fp');
|
|
4
|
+
|
|
3
5
|
/**
|
|
4
|
-
*
|
|
5
|
-
* @param {string}
|
|
6
|
-
* @returns {Array}
|
|
6
|
+
* Transform table name to the object format
|
|
7
|
+
* @param {Array<string|{ table: string; dependsOn?: Array<{ table: string;}> }>} table
|
|
8
|
+
* @returns Array<{ table: string; dependsOn?: Array<{ table: string;}> }>
|
|
7
9
|
*/
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
const transformTableName = (table) => {
|
|
11
|
+
if (typeof table === 'string') {
|
|
12
|
+
return { name: table };
|
|
13
|
+
}
|
|
14
|
+
return table;
|
|
11
15
|
};
|
|
12
16
|
|
|
13
17
|
/**
|
|
14
|
-
*
|
|
15
|
-
* @
|
|
18
|
+
* Finds all tables in the database matching the regular expression
|
|
19
|
+
* @param {Object} ctx
|
|
20
|
+
* @param {Strapi} ctx.strapi
|
|
21
|
+
* @param {RegExp} regex
|
|
22
|
+
* @returns {Promise<string[]>}
|
|
16
23
|
*/
|
|
17
|
-
|
|
18
|
-
|
|
24
|
+
async function findTables({ strapi }, regex) {
|
|
25
|
+
const tables = await strapi.db.dialect.schemaInspector.getTables();
|
|
26
|
+
return tables.filter((tableName) => regex.test(tableName));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Add tables name to the reserved tables in core store
|
|
31
|
+
* @param {Object} ctx
|
|
32
|
+
* @param {Strapi} ctx.strapi
|
|
33
|
+
* @param {Array<string|{ table: string; dependsOn?: Array<{ table: string;}> }>} tableNames
|
|
34
|
+
* @return {Promise<void>}
|
|
35
|
+
*/
|
|
36
|
+
async function addPersistTables({ strapi }, tableNames) {
|
|
37
|
+
const persistedTables = await getPersistedTables({ strapi });
|
|
38
|
+
const tables = tableNames.map(transformTableName);
|
|
39
|
+
|
|
40
|
+
// Get new tables to be persisted, remove tables if they already were persisted
|
|
41
|
+
const notPersistedTableNames = differenceWith(isEqual, tables, persistedTables);
|
|
42
|
+
// Remove tables that are going to be changed
|
|
43
|
+
const tablesToPersist = differenceWith(
|
|
44
|
+
(t1, t2) => t1.name === t2.name,
|
|
45
|
+
persistedTables,
|
|
46
|
+
notPersistedTableNames
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
if (!notPersistedTableNames.length) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
tablesToPersist.push(...notPersistedTableNames);
|
|
54
|
+
await strapi.store.set({
|
|
19
55
|
type: 'core',
|
|
20
56
|
key: 'persisted_tables',
|
|
21
|
-
|
|
57
|
+
value: tablesToPersist,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
22
60
|
|
|
23
61
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* @param {
|
|
62
|
+
* Remove tables name from the reserved tables in core store
|
|
63
|
+
* @param {Object} ctx
|
|
64
|
+
* @param {Strapi} ctx.strapi
|
|
65
|
+
* @param {Array<string>} tableNames
|
|
66
|
+
* @return {Promise<void>}
|
|
27
67
|
*/
|
|
68
|
+
async function removePersistedTables({ strapi }, tableNames) {
|
|
69
|
+
const persistedTables = await getPersistedTables({ strapi });
|
|
28
70
|
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
71
|
+
// Get new tables to be persisted, remove tables if they already were persisted
|
|
72
|
+
const newPersistedTables = differenceWith(
|
|
73
|
+
(t1, t2) => t1.name === t2,
|
|
74
|
+
persistedTables,
|
|
75
|
+
tableNames
|
|
76
|
+
);
|
|
33
77
|
|
|
34
|
-
if (
|
|
78
|
+
if (newPersistedTables.length === persistedTables.length) {
|
|
35
79
|
return;
|
|
36
80
|
}
|
|
37
81
|
|
|
38
|
-
persistedTables.push(...notReservedTableNames);
|
|
39
82
|
await strapi.store.set({
|
|
40
83
|
type: 'core',
|
|
41
84
|
key: 'persisted_tables',
|
|
42
|
-
value:
|
|
85
|
+
value: newPersistedTables,
|
|
43
86
|
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Get all reserved table names from the core store
|
|
91
|
+
* @param {Object} ctx
|
|
92
|
+
* @param {Strapi} ctx.strapi
|
|
93
|
+
* @returns {Promise<string[]>}
|
|
94
|
+
*/
|
|
95
|
+
|
|
96
|
+
async function getPersistedTables({ strapi }) {
|
|
97
|
+
const persistedTables = await strapi.store.get({
|
|
98
|
+
type: 'core',
|
|
99
|
+
key: 'persisted_tables',
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
return (persistedTables || []).map(transformTableName);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Add all table names that start with a prefix to the reserved tables in
|
|
107
|
+
* core store
|
|
108
|
+
* @param {string} tableNamePrefix
|
|
109
|
+
* @return {Promise<void>}
|
|
110
|
+
*/
|
|
111
|
+
|
|
112
|
+
const persistTablesWithPrefix = async (tableNamePrefix) => {
|
|
113
|
+
const tableNameRegex = new RegExp(`^${tableNamePrefix}.*`);
|
|
114
|
+
const tableNames = await findTables({ strapi }, tableNameRegex);
|
|
115
|
+
|
|
116
|
+
await addPersistTables({ strapi }, tableNames);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Remove all table names that end with a suffix from the reserved tables in core store
|
|
121
|
+
* @param {string} tableNameSuffix
|
|
122
|
+
* @return {Promise<void>}
|
|
123
|
+
*/
|
|
124
|
+
const removePersistedTablesWithSuffix = async (tableNameSuffix) => {
|
|
125
|
+
const tableNameRegex = new RegExp(`.*${tableNameSuffix}$`);
|
|
126
|
+
const tableNames = await findTables({ strapi }, tableNameRegex);
|
|
127
|
+
await removePersistedTables({ strapi }, tableNames);
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
const persistTable = async (tableName, dependsOn) => {
|
|
131
|
+
await addPersistTables({ strapi }, [
|
|
132
|
+
{ name: tableName, dependsOn: dependsOn?.map((depTableName) => ({ name: depTableName })) },
|
|
133
|
+
]);
|
|
44
134
|
};
|
|
45
135
|
|
|
46
136
|
module.exports = {
|
|
47
137
|
persistTablesWithPrefix,
|
|
48
|
-
|
|
138
|
+
removePersistedTablesWithSuffix,
|
|
139
|
+
persistTable,
|
|
140
|
+
findTables,
|
|
49
141
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const { get, keys, pickBy, pipe } = require('lodash/fp');
|
|
3
4
|
const { WORKFLOW_MODEL_UID } = require('../constants/workflows');
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -19,7 +20,15 @@ function hasReviewWorkflow({ strapi }, contentType) {
|
|
|
19
20
|
const getDefaultWorkflow = async ({ strapi }) =>
|
|
20
21
|
strapi.query(WORKFLOW_MODEL_UID).findOne({ populate: ['stages'] });
|
|
21
22
|
|
|
23
|
+
const getContentTypeUIDsWithActivatedReviewWorkflows = pipe([
|
|
24
|
+
// Pick only content-types with reviewWorkflows options set to true
|
|
25
|
+
pickBy(get('options.reviewWorkflows')),
|
|
26
|
+
// Get UIDs
|
|
27
|
+
keys,
|
|
28
|
+
]);
|
|
29
|
+
|
|
22
30
|
module.exports = {
|
|
23
31
|
hasReviewWorkflow,
|
|
24
32
|
getDefaultWorkflow,
|
|
33
|
+
getContentTypeUIDsWithActivatedReviewWorkflows,
|
|
25
34
|
};
|
package/jest.config.front.js
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const baseConfig = require('../../../jest.base-config.front');
|
|
4
|
-
const pkg = require('./package.json');
|
|
5
|
-
|
|
6
3
|
module.exports = {
|
|
7
|
-
|
|
8
|
-
displayName: (pkg.strapi && pkg.strapi.name) || pkg.name,
|
|
9
|
-
roots: [__dirname],
|
|
4
|
+
preset: '../../../jest-preset.front.js',
|
|
10
5
|
collectCoverageFrom: ['<rootDir>/packages/core/admin/admin/**/*.js'],
|
|
11
6
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/admin",
|
|
3
|
-
"version": "4.10.0-beta.
|
|
3
|
+
"version": "4.10.0-beta.1",
|
|
4
4
|
"description": "Strapi Admin",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,14 +28,16 @@
|
|
|
28
28
|
"develop:webpack": "cross-env NODE_ENV=development webpack serve --config webpack.config.dev.js --progress profile",
|
|
29
29
|
"prepublishOnly": "yarn build",
|
|
30
30
|
"build": "rimraf build && node ./scripts/build.js",
|
|
31
|
-
"build:
|
|
31
|
+
"build:measure": "rimraf build && cross-env MEASURE_BUILD_SPEED=true node ./scripts/build.js",
|
|
32
32
|
"test": "echo \"no tests yet\"",
|
|
33
|
-
"test:unit": "jest
|
|
34
|
-
"test:
|
|
35
|
-
"test:front
|
|
36
|
-
"test:front:
|
|
37
|
-
"test:front:
|
|
38
|
-
"test:front:ce
|
|
33
|
+
"test:unit": "run -T jest",
|
|
34
|
+
"test:unit:watch": "run -T jest --watch",
|
|
35
|
+
"test:front": "run -T cross-env IS_EE=true jest --config ./jest.config.front.js",
|
|
36
|
+
"test:front:watch": "run -T cross-env IS_EE=true jest --config ./jest.config.front.js --watchAll",
|
|
37
|
+
"test:front:ce": "run -T cross-env IS_EE=false jest --config ./jest.config.front.js",
|
|
38
|
+
"test:front:watch:ce": "run -T cross-env IS_EE=false jest --config ./jest.config.front.js --watchAll",
|
|
39
|
+
"test:front:ce:cov": "run -T cross-env IS_EE=false jest --config ./jest.config.front.js --coverage",
|
|
40
|
+
"lint": "run -T eslint ."
|
|
39
41
|
},
|
|
40
42
|
"dependencies": {
|
|
41
43
|
"@babel/core": "^7.20.12",
|
|
@@ -46,19 +48,20 @@
|
|
|
46
48
|
"@casl/ability": "^5.4.3",
|
|
47
49
|
"@fingerprintjs/fingerprintjs": "3.3.6",
|
|
48
50
|
"@pmmmwh/react-refresh-webpack-plugin": "0.5.10",
|
|
49
|
-
"@strapi/babel-plugin-switch-ee-ce": "4.10.0-beta.
|
|
50
|
-
"@strapi/data-transfer": "4.10.0-beta.
|
|
51
|
+
"@strapi/babel-plugin-switch-ee-ce": "4.10.0-beta.1",
|
|
52
|
+
"@strapi/data-transfer": "4.10.0-beta.1",
|
|
51
53
|
"@strapi/design-system": "1.6.6",
|
|
52
|
-
"@strapi/helper-plugin": "4.10.0-beta.
|
|
54
|
+
"@strapi/helper-plugin": "4.10.0-beta.1",
|
|
53
55
|
"@strapi/icons": "1.6.6",
|
|
54
|
-
"@strapi/permissions": "4.10.0-beta.
|
|
55
|
-
"@strapi/provider-audit-logs-local": "4.10.0-beta.
|
|
56
|
-
"@strapi/typescript-utils": "4.10.0-beta.
|
|
57
|
-
"@strapi/utils": "4.10.0-beta.
|
|
56
|
+
"@strapi/permissions": "4.10.0-beta.1",
|
|
57
|
+
"@strapi/provider-audit-logs-local": "4.10.0-beta.1",
|
|
58
|
+
"@strapi/typescript-utils": "4.10.0-beta.1",
|
|
59
|
+
"@strapi/utils": "4.10.0-beta.1",
|
|
58
60
|
"axios": "1.3.4",
|
|
59
61
|
"babel-loader": "^9.1.2",
|
|
60
62
|
"babel-plugin-styled-components": "2.0.2",
|
|
61
63
|
"bcryptjs": "2.4.3",
|
|
64
|
+
"browserslist": "^4.17.3",
|
|
62
65
|
"browserslist-to-esbuild": "1.2.0",
|
|
63
66
|
"chalk": "^4.1.2",
|
|
64
67
|
"chokidar": "^3.5.1",
|
|
@@ -99,18 +102,17 @@
|
|
|
99
102
|
"markdown-it-mark": "^3.0.1",
|
|
100
103
|
"markdown-it-sub": "^1.0.0",
|
|
101
104
|
"markdown-it-sup": "1.0.0",
|
|
102
|
-
"match-sorter": "^4.0.2",
|
|
103
105
|
"mini-css-extract-plugin": "2.7.2",
|
|
104
106
|
"node-schedule": "2.1.0",
|
|
105
107
|
"p-map": "4.0.0",
|
|
106
108
|
"passport-local": "1.0.0",
|
|
107
109
|
"pluralize": "8.0.0",
|
|
108
110
|
"prop-types": "^15.7.2",
|
|
109
|
-
"qs": "6.11.
|
|
111
|
+
"qs": "6.11.1",
|
|
110
112
|
"react": "^17.0.2",
|
|
111
113
|
"react-copy-to-clipboard": "^5.1.0",
|
|
112
114
|
"react-dnd": "15.1.2",
|
|
113
|
-
"react-dnd-html5-backend": "15.1.
|
|
115
|
+
"react-dnd-html5-backend": "15.1.3",
|
|
114
116
|
"react-dom": "^17.0.2",
|
|
115
117
|
"react-error-boundary": "3.1.4",
|
|
116
118
|
"react-fast-compare": "^3.2.0",
|
|
@@ -122,13 +124,13 @@
|
|
|
122
124
|
"react-refresh": "0.14.0",
|
|
123
125
|
"react-router-dom": "5.3.4",
|
|
124
126
|
"react-select": "5.7.0",
|
|
125
|
-
"react-window": "1.8.
|
|
127
|
+
"react-window": "1.8.8",
|
|
126
128
|
"redux": "^4.2.1",
|
|
127
129
|
"reselect": "^4.1.7",
|
|
128
130
|
"rimraf": "3.0.2",
|
|
129
|
-
"sanitize-html": "2.
|
|
131
|
+
"sanitize-html": "2.10.0",
|
|
130
132
|
"semver": "7.3.8",
|
|
131
|
-
"sift": "16.0.
|
|
133
|
+
"sift": "16.0.1",
|
|
132
134
|
"style-loader": "3.3.1",
|
|
133
135
|
"styled-components": "5.3.3",
|
|
134
136
|
"typescript": "4.6.2",
|
|
@@ -166,5 +168,5 @@
|
|
|
166
168
|
}
|
|
167
169
|
}
|
|
168
170
|
},
|
|
169
|
-
"gitHead": "
|
|
171
|
+
"gitHead": "95d581b31bee464af42e5d8db408fa578d8532c7"
|
|
170
172
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const {
|
|
3
|
+
const { createPushController, createPullController } =
|
|
4
|
+
require('@strapi/data-transfer').strapi.remote.handlers;
|
|
4
5
|
const {
|
|
5
6
|
errors: { UnauthorizedError },
|
|
6
7
|
} = require('@strapi/utils');
|
|
@@ -22,5 +23,6 @@ const verify = async (ctx, scope) => {
|
|
|
22
23
|
};
|
|
23
24
|
|
|
24
25
|
module.exports = {
|
|
25
|
-
|
|
26
|
+
push: createPushController({ verify }),
|
|
27
|
+
pull: createPullController({ verify }),
|
|
26
28
|
};
|
|
@@ -13,7 +13,10 @@ module.exports = () => async (ctx, next) => {
|
|
|
13
13
|
|
|
14
14
|
if (!hasValidTokenSalt()) {
|
|
15
15
|
return ctx.notImplemented(
|
|
16
|
-
'The server configuration for data transfer is invalid. Please contact your server administrator.'
|
|
16
|
+
'The server configuration for data transfer is invalid. Please contact your server administrator.',
|
|
17
|
+
{
|
|
18
|
+
code: 'INVALID_TOKEN_SALT',
|
|
19
|
+
}
|
|
17
20
|
);
|
|
18
21
|
}
|
|
19
22
|
|
|
@@ -3,17 +3,26 @@
|
|
|
3
3
|
const dataTransferAuthStrategy = require('../strategies/data-transfer');
|
|
4
4
|
|
|
5
5
|
module.exports = [
|
|
6
|
-
// Transfer
|
|
6
|
+
// Transfer Push
|
|
7
7
|
{
|
|
8
8
|
method: 'GET',
|
|
9
|
-
path: '/transfer/runner/
|
|
10
|
-
handler: 'transfer.runner-
|
|
9
|
+
path: '/transfer/runner/push',
|
|
10
|
+
handler: 'transfer.runner-push',
|
|
11
11
|
config: {
|
|
12
12
|
middlewares: ['admin::data-transfer'],
|
|
13
|
-
// TODO: Allow not passing any scope <> Add a way to prevent assigning one by default
|
|
14
13
|
auth: { strategies: [dataTransferAuthStrategy], scope: ['push'] },
|
|
15
14
|
},
|
|
16
15
|
},
|
|
16
|
+
// Transfer Pull
|
|
17
|
+
{
|
|
18
|
+
method: 'GET',
|
|
19
|
+
path: '/transfer/runner/pull',
|
|
20
|
+
handler: 'transfer.runner-pull',
|
|
21
|
+
config: {
|
|
22
|
+
middlewares: ['admin::data-transfer'],
|
|
23
|
+
auth: { strategies: [dataTransferAuthStrategy], scope: ['pull'] },
|
|
24
|
+
},
|
|
25
|
+
},
|
|
17
26
|
// Transfer Tokens
|
|
18
27
|
{
|
|
19
28
|
method: 'POST',
|
|
@@ -149,37 +149,39 @@ const update = async (id, attributes) => {
|
|
|
149
149
|
},
|
|
150
150
|
});
|
|
151
151
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
152
|
+
if (attributes.permissions) {
|
|
153
|
+
const currentPermissionsResult = await strapi.entityService.load(
|
|
154
|
+
TRANSFER_TOKEN_UID,
|
|
155
|
+
updatedToken,
|
|
156
|
+
'permissions'
|
|
157
|
+
);
|
|
158
|
+
|
|
159
|
+
const currentPermissions = map('action', currentPermissionsResult || []);
|
|
160
|
+
const newPermissions = uniq(attributes.permissions);
|
|
161
|
+
|
|
162
|
+
const actionsToDelete = difference(currentPermissions, newPermissions);
|
|
163
|
+
const actionsToAdd = difference(newPermissions, currentPermissions);
|
|
164
|
+
|
|
165
|
+
// TODO: improve efficiency here
|
|
166
|
+
// method using a loop -- works but very inefficient
|
|
167
|
+
await Promise.all(
|
|
168
|
+
actionsToDelete.map((action) =>
|
|
169
|
+
strapi.query(TRANSFER_TOKEN_PERMISSION_UID).delete({
|
|
170
|
+
where: { action, token: id },
|
|
171
|
+
})
|
|
172
|
+
)
|
|
173
|
+
);
|
|
174
|
+
|
|
175
|
+
// TODO: improve efficiency here
|
|
176
|
+
// using a loop -- works but very inefficient
|
|
177
|
+
await Promise.all(
|
|
178
|
+
actionsToAdd.map((action) =>
|
|
179
|
+
strapi.query(TRANSFER_TOKEN_PERMISSION_UID).create({
|
|
180
|
+
data: { action, token: id },
|
|
181
|
+
})
|
|
182
|
+
)
|
|
183
|
+
);
|
|
184
|
+
}
|
|
183
185
|
|
|
184
186
|
// retrieve permissions
|
|
185
187
|
const permissionsFromDb = await strapi.entityService.load(
|
|
@@ -8,7 +8,11 @@ const transferTokenCreationSchema = yup
|
|
|
8
8
|
.shape({
|
|
9
9
|
name: yup.string().min(1).required(),
|
|
10
10
|
description: yup.string().optional(),
|
|
11
|
-
permissions: yup
|
|
11
|
+
permissions: yup
|
|
12
|
+
.array()
|
|
13
|
+
.min(1)
|
|
14
|
+
.of(yup.string().oneOf(Object.values(constants.TRANSFER_TOKEN_TYPE)))
|
|
15
|
+
.required(),
|
|
12
16
|
lifespan: yup
|
|
13
17
|
.number()
|
|
14
18
|
.min(1)
|
|
@@ -23,7 +27,11 @@ const transferTokenUpdateSchema = yup
|
|
|
23
27
|
.shape({
|
|
24
28
|
name: yup.string().min(1).notNull(),
|
|
25
29
|
description: yup.string().nullable(),
|
|
26
|
-
permissions: yup
|
|
30
|
+
permissions: yup
|
|
31
|
+
.array()
|
|
32
|
+
.min(1)
|
|
33
|
+
.of(yup.string().oneOf(Object.values(constants.TRANSFER_TOKEN_TYPE)))
|
|
34
|
+
.nullable(),
|
|
27
35
|
})
|
|
28
36
|
.noUnknown()
|
|
29
37
|
.strict();
|
package/webpack.config.js
CHANGED
|
@@ -9,6 +9,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
|
9
9
|
const { ESBuildMinifyPlugin } = require('esbuild-loader');
|
|
10
10
|
const WebpackBar = require('webpackbar');
|
|
11
11
|
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
|
|
12
|
+
const browserslist = require('browserslist');
|
|
12
13
|
const browserslistToEsbuild = require('browserslist-to-esbuild');
|
|
13
14
|
|
|
14
15
|
const alias = require('./webpack.alias');
|
|
@@ -52,7 +53,10 @@ module.exports = ({
|
|
|
52
53
|
|
|
53
54
|
const excludeRegex = createPluginsExcludePath(pluginsPath);
|
|
54
55
|
|
|
55
|
-
|
|
56
|
+
// Ensure we use the config in this directory, even if run with a different
|
|
57
|
+
// working directory
|
|
58
|
+
const browserslistConfig = browserslist.loadConfig({ path: __dirname });
|
|
59
|
+
const buildTarget = browserslistToEsbuild(browserslistConfig);
|
|
56
60
|
|
|
57
61
|
return {
|
|
58
62
|
mode: isProduction ? 'production' : 'development',
|
|
@@ -221,7 +225,7 @@ module.exports = ({
|
|
|
221
225
|
alias,
|
|
222
226
|
symlinks: false,
|
|
223
227
|
extensions: ['.js', '.jsx', '.react.js', '.ts', '.tsx'],
|
|
224
|
-
mainFields: ['browser', 'jsnext:main', 'main'],
|
|
228
|
+
mainFields: ['browser', 'module', 'jsnext:main', 'main'],
|
|
225
229
|
modules: ['node_modules', path.resolve(__dirname, 'node_modules')],
|
|
226
230
|
},
|
|
227
231
|
plugins: [
|
package/admin/src/content-manager/components/DynamicTable/CellContent/ReviewWorkflowsStage/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './ReviewWorkflowsStage';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as matchByTitle } from './matchByTitle';
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import matchSorter from 'match-sorter';
|
|
2
|
-
import camelCase from 'lodash/camelCase';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @type {(links: array, search? : string) => array }
|
|
6
|
-
*/
|
|
7
|
-
const matchByTitle = (links, search) =>
|
|
8
|
-
search
|
|
9
|
-
? matchSorter(links, search.toLowerCase(), { keys: [(item) => item.title.toLowerCase()] })
|
|
10
|
-
: links.sort((link, nextLink) => {
|
|
11
|
-
const title = camelCase(link.title);
|
|
12
|
-
const nextTitle = camelCase(nextLink.title);
|
|
13
|
-
|
|
14
|
-
if (title < nextTitle) {
|
|
15
|
-
return -1;
|
|
16
|
-
}
|
|
17
|
-
if (title > nextTitle) {
|
|
18
|
-
return 1;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return 0;
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
export default matchByTitle;
|