@opengis/cms 0.0.26 → 0.0.28
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/README.md +98 -98
- package/dist/index-W-qQIppj-DunG40EG.js +2452 -0
- package/dist/index.html +28 -28
- package/dist/index.js +12683 -6702
- package/dist/index.umd.cjs +87 -41
- package/dist/style.css +1 -0
- package/package.json +68 -68
- package/plugin.js +76 -76
- package/server/app.js +35 -35
- package/server/config.js +4 -4
- package/server/functions/getDraftKey.js +22 -22
- package/server/index.js +22 -22
- package/server/migrations/fixes.sql +123 -123
- package/server/migrations/site.sql +545 -545
- package/server/plugins/adminHook.js +78 -78
- package/server/plugins/hook.js +59 -59
- package/server/plugins/vite.js +84 -84
- package/server/routes/category/controllers/cms.category.delete.js +21 -21
- package/server/routes/category/controllers/cms.category.get.js +17 -17
- package/server/routes/category/controllers/cms.category.list.js +16 -16
- package/server/routes/category/controllers/cms.category.post.js +21 -21
- package/server/routes/category/controllers/cms.category.put.js +23 -23
- package/server/routes/category/index.mjs +22 -22
- package/server/routes/cms/controllers/cmsStat.js +55 -55
- package/server/routes/cms/controllers/cmsSuggest.js +57 -57
- package/server/routes/cms/controllers/deleteContent.js +114 -114
- package/server/routes/cms/controllers/deleteMedia.js +75 -75
- package/server/routes/cms/controllers/downloadMedia.js +48 -48
- package/server/routes/cms/controllers/getContent.js +110 -110
- package/server/routes/cms/controllers/getContentBySlug.js +95 -95
- package/server/routes/cms/controllers/getPermissions.js +15 -15
- package/server/routes/cms/controllers/insertContent.js +218 -218
- package/server/routes/cms/controllers/listMedia.js +93 -93
- package/server/routes/cms/controllers/metadataMedia.js +38 -38
- package/server/routes/cms/controllers/properties.get.js +53 -53
- package/server/routes/cms/controllers/properties.post.js +99 -99
- package/server/routes/cms/controllers/searchContent.js +205 -205
- package/server/routes/cms/controllers/setPermissions.js +49 -49
- package/server/routes/cms/controllers/translate.js +89 -89
- package/server/routes/cms/controllers/updateContent.js +238 -238
- package/server/routes/cms/controllers/uploadMedia.js +78 -78
- package/server/routes/cms/index.mjs +114 -114
- package/server/routes/cms/utils/additionalData.js +35 -35
- package/server/routes/cms/utils/getCollection.js +81 -81
- package/server/routes/cms/utils/getSingle.js +187 -187
- package/server/routes/cms/utils/insertContentLocalization.js +86 -86
- package/server/routes/cms/utils/requestTranslation.js +85 -85
- package/server/routes/cms/utils/updateLocalization.js +47 -47
- package/server/routes/cmsSpace/controllers/deleteSpace.js +25 -25
- package/server/routes/cmsSpace/controllers/getSpaces.js +27 -27
- package/server/routes/cmsSpace/controllers/insertSpace.js +21 -21
- package/server/routes/cmsSpace/controllers/updateSpace.js +23 -23
- package/server/routes/cmsSpace/index.mjs +20 -20
- package/server/routes/contentType/controllers/addContentType.js +162 -162
- package/server/routes/contentType/controllers/contentTypeList.js +54 -54
- package/server/routes/contentType/controllers/delContentType.js +75 -75
- package/server/routes/contentType/controllers/editContentType.js +61 -61
- package/server/routes/contentType/controllers/getContentType.js +37 -37
- package/server/routes/contentType/index.mjs +35 -35
- package/server/routes/contentType/utils/updateContents.js +28 -28
- package/server/routes/contentType/utils/updateCustomContentTable.js +55 -55
- package/server/routes/feedback/controllers/email.list.js +24 -24
- package/server/routes/feedback/controllers/feedback.js +48 -48
- package/server/routes/feedback/controllers/feedback.list.js +37 -37
- package/server/routes/feedback/controllers/news.subscriptions.js +44 -44
- package/server/routes/feedback/index.mjs +71 -71
- package/server/routes/logs/controllers/export.user.logs.js +77 -77
- package/server/routes/logs/controllers/user.logs.js +44 -44
- package/server/routes/logs/index.mjs +9 -9
- package/server/routes/menu/controllers/addMenu.js +37 -37
- package/server/routes/menu/controllers/delMenu.js +31 -31
- package/server/routes/menu/controllers/editMenu.js +41 -41
- package/server/routes/menu/controllers/getMenu.js +42 -42
- package/server/routes/menu/index.mjs +13 -13
- package/server/routes/migration/controllers/collectionToCustom.js +137 -137
- package/server/routes/migration/index.mjs +8 -8
- package/server/routes/root.mjs +8 -8
- package/server/routes/tags/controllers/add.tags.js +24 -24
- package/server/routes/tags/controllers/del.tags.js +19 -19
- package/server/routes/tags/controllers/edit.tags.js +25 -25
- package/server/routes/tags/controllers/get.tags.js +15 -15
- package/server/routes/tags/index.mjs +14 -14
- package/server/templates/cls/cms.category_type.json +9 -9
- package/server/templates/cls/cms.content_review_status.json +9 -9
- package/server/templates/cls/cms.content_status.json +9 -9
- package/server/templates/cls/cms.content_type.json +9 -9
- package/server/templates/cls/cms.lang.json +9 -9
- package/server/templates/page/login.html +126 -126
- package/server/templates/select/core.user_mentioned.sql +1 -1
- package/dist/index-W-qQIppj-DRzFSjU1.js +0 -2452
|
@@ -1,124 +1,124 @@
|
|
|
1
|
-
create schema if not exists site;
|
|
2
|
-
|
|
3
|
-
ALTER TABLE if exists site.spaces add column if not exists locales text[];
|
|
4
|
-
ALTER TABLE IF exists site.spaces add column if not exists default_locale text;
|
|
5
|
-
ALTER TABLE if exists site.spaces alter column default_locale set default 'ua';
|
|
6
|
-
update site.spaces set default_locale = 'ua' where default_locale is null;
|
|
7
|
-
ALTER TABLE if exists site.spaces alter column default_locale set not null;
|
|
8
|
-
|
|
9
|
-
ALTER TABLE if exists site.media ADD COLUMN IF NOT EXISTS subdir TEXT;
|
|
10
|
-
COMMENT ON COLUMN site.media.subdir is 'Піддиректорія';
|
|
11
|
-
|
|
12
|
-
-- deprecated tables
|
|
13
|
-
-- drop table if exists site.articles cascade;
|
|
14
|
-
drop table if exists site.article_media cascade;
|
|
15
|
-
drop table if exists site.content_attributes cascade;
|
|
16
|
-
drop table if exists site.article_translations cascade;
|
|
17
|
-
drop table if exists site.menu_items cascade;
|
|
18
|
-
|
|
19
|
-
-- redundant columns / constraints
|
|
20
|
-
ALTER TABLE if exists site.content_types DROP CONSTRAINT if exists content_types_slug_key;
|
|
21
|
-
ALTER TABLE if exists site.content_types drop column if exists slug;
|
|
22
|
-
ALTER TABLE if exists site.content_types drop column if exists display_name;
|
|
23
|
-
ALTER TABLE if exists site.contents drop column if exists fields;
|
|
24
|
-
|
|
25
|
-
DROP FUNCTION if exists site.getmenu(text);
|
|
26
|
-
|
|
27
|
-
-- seamless migration start
|
|
28
|
-
/*
|
|
29
|
-
insert into site.contents(content_id, space_id, content_type_id, slug)
|
|
30
|
-
select content_type_id, 'default', content_type_id, min(type_name) from site.single_type_values a
|
|
31
|
-
left join lateral (select content_type_id from site.content_types b where a.type_name=b.name limit 1)b on 1=1
|
|
32
|
-
where content_type_id not in (select content_id from site.contents) and content_type_id is not null
|
|
33
|
-
group by content_type_id;
|
|
34
|
-
insert into site.content_data(field_id, content_id, object_id, field_key, field_type, field_value)
|
|
35
|
-
select distinct single_type_value_id, content_type_id, type_name, key,
|
|
36
|
-
coalesce(value_type,case when substring(value from 1 for 1) = '[' then 'datalist' else 'text' end), value from site.single_type_values a
|
|
37
|
-
left join lateral (select content_type_id from site.content_types b where a.type_name=b.name limit 1)b on 1=1
|
|
38
|
-
where single_type_value_id not in (select field_id from site.content_data) and content_type_id is not null
|
|
39
|
-
and case when key = 'slug' then value not in ( select field_value from site.content_data where field_key='slug') else true end;
|
|
40
|
-
-- drop table if exists site.single_type_values cascade;
|
|
41
|
-
*/
|
|
42
|
-
-- seamless migration finish
|
|
43
|
-
|
|
44
|
-
--- insert default content types start
|
|
45
|
-
insert into site.content_types(content_type_id,name,title,type,columns)
|
|
46
|
-
values('pages','pages','Сторінки','collection',
|
|
47
|
-
'[{"name":"slug","label":"Slug","type":"slug","parent":"title","required":true},{"name":"title","label":"Title","type":"text","required":true},{"name":"status","label":"Status","type":"select","options":[{"id":"draft","text":"Draft"},{"id":"published","text":"Published"},{"id":"archived","text":"Archived"},{"id":"delayPublished","text":"Delay Published"}],"required":true},{"name":"published_at","label":"Publish at","type":"datetime","required":true}]'::json
|
|
48
|
-
) on conflict(content_type_id) do update set columns=excluded.columns, type = excluded.type;
|
|
49
|
-
insert into site.contents(content_id,content_type_id,space_id)
|
|
50
|
-
values('pages','pages','default') on conflict(content_id) do nothing;
|
|
51
|
-
--- insert default content types finish
|
|
52
|
-
|
|
53
|
-
alter table site.contents add column if not exists meta json;
|
|
54
|
-
alter table site.contents add column if not exists main_image text;
|
|
55
|
-
/*
|
|
56
|
-
ALTER TABLE if exists site.contents drop column if exists publish_at;
|
|
57
|
-
ALTER TABLE if exists site.contents add column if not exists published_at timestamp without time zone;
|
|
58
|
-
update site.contents set published_at=now() where published_at is null;
|
|
59
|
-
ALTER TABLE if exists site.contents alter column published_at set not null;
|
|
60
|
-
ALTER TABLE if exists site.contents alter column published_at set default now();
|
|
61
|
-
*/
|
|
62
|
-
|
|
63
|
-
alter table site.content_data add column if not exists created_by text;
|
|
64
|
-
alter table site.content_data add column if not exists updated_by text;
|
|
65
|
-
alter table site.content_data add column if not exists field_value_object json;
|
|
66
|
-
|
|
67
|
-
--- seamless migration for content_data start
|
|
68
|
-
update site.content_data
|
|
69
|
-
set field_value_object=field_value::json
|
|
70
|
-
where field_value_object is null
|
|
71
|
-
and field_value is not null
|
|
72
|
-
and field_type in ('reference-list', 'reference', 'datalist', 'filelist', 'array');
|
|
73
|
-
--- seamless migration for content_data finish
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
-- delete accidental dupes
|
|
77
|
-
delete from site.content_data where object_id in ( select min(object_id) from site.content_data where field_key= 'slug' group by field_value having count(*) > 1 );
|
|
78
|
-
|
|
79
|
-
alter table site.content_types ADD COLUMN if not exists preview_path text;
|
|
80
|
-
|
|
81
|
-
-- get rid of naming inconsistency
|
|
82
|
-
update site.content_types
|
|
83
|
-
set columns=replace(columns::text,'publish_at', 'published_at')::json
|
|
84
|
-
where columns::text like '%publish_at%';
|
|
85
|
-
|
|
86
|
-
ALTER TABLE site.contents DROP CONSTRAINT contents_status_check;
|
|
87
|
-
ALTER TABLE site.contents ADD CONSTRAINT contents_status_check CHECK (status = ANY (ARRAY['draft'::text, 'published'::text, 'archived'::text, 'delayPublished'::text]));
|
|
88
|
-
|
|
89
|
-
UPDATE site.content_types
|
|
90
|
-
SET columns = (
|
|
91
|
-
SELECT jsonb_agg(elem)
|
|
92
|
-
FROM jsonb_array_elements(columns::jsonb) elem
|
|
93
|
-
WHERE elem->>'name' <> 'status'
|
|
94
|
-
)
|
|
95
|
-
WHERE columns IS NOT NULL;
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
UPDATE site.content_types
|
|
99
|
-
SET columns = columns::jsonb || '{"name": "status", "type": "select", "label": "Status", "options": [{"id": "draft", "text": "Draft"}, {"id": "published", "text": "Published"}, {"id": "archived", "text": "Archived"}, {"id": "delayPublished", "text": "Delay Published"}], "required": true}
|
|
100
|
-
'::jsonb
|
|
101
|
-
WHERE columns is not null;
|
|
102
|
-
|
|
103
|
-
-- remove dupes, make slug unique
|
|
104
|
-
update site.content_data set content_id='pages' where content_id<>'pages' and content_id in (
|
|
105
|
-
select content_id from site.contents where content_id<>'pages' and slug='pages'
|
|
106
|
-
);
|
|
107
|
-
|
|
108
|
-
delete from site.contents where content_id<>'pages' and slug='pages';
|
|
109
|
-
|
|
110
|
-
delete from site.contents a
|
|
111
|
-
where slug in (select slug from site.contents group by slug having count(*) > 1)
|
|
112
|
-
and (select count(*) from site.content_data where content_id=a.content_id) = 0;
|
|
113
|
-
|
|
114
|
-
alter table site.contents drop constraint if exists site_contents_slug_unique;
|
|
115
|
-
alter table site.contents add constraint site_contents_slug_unique UNIQUE (slug);
|
|
116
|
-
|
|
117
|
-
alter table site.contents add column if not exists space_id text;
|
|
118
|
-
alter table site.contents alter column space_id drop not null;
|
|
119
|
-
update site.spaces set locales='{ua,en,de}'::text[] where space_id='default';
|
|
120
|
-
|
|
121
|
-
alter table site.content_data drop constraint if exists content_data_content_id_fkey;
|
|
122
|
-
alter table site.content_data add constraint content_data_content_id_fkey foreign key (content_id) references site.contents(content_id) on delete cascade;
|
|
123
|
-
|
|
1
|
+
create schema if not exists site;
|
|
2
|
+
|
|
3
|
+
ALTER TABLE if exists site.spaces add column if not exists locales text[];
|
|
4
|
+
ALTER TABLE IF exists site.spaces add column if not exists default_locale text;
|
|
5
|
+
ALTER TABLE if exists site.spaces alter column default_locale set default 'ua';
|
|
6
|
+
update site.spaces set default_locale = 'ua' where default_locale is null;
|
|
7
|
+
ALTER TABLE if exists site.spaces alter column default_locale set not null;
|
|
8
|
+
|
|
9
|
+
ALTER TABLE if exists site.media ADD COLUMN IF NOT EXISTS subdir TEXT;
|
|
10
|
+
COMMENT ON COLUMN site.media.subdir is 'Піддиректорія';
|
|
11
|
+
|
|
12
|
+
-- deprecated tables
|
|
13
|
+
-- drop table if exists site.articles cascade;
|
|
14
|
+
drop table if exists site.article_media cascade;
|
|
15
|
+
drop table if exists site.content_attributes cascade;
|
|
16
|
+
drop table if exists site.article_translations cascade;
|
|
17
|
+
drop table if exists site.menu_items cascade;
|
|
18
|
+
|
|
19
|
+
-- redundant columns / constraints
|
|
20
|
+
ALTER TABLE if exists site.content_types DROP CONSTRAINT if exists content_types_slug_key;
|
|
21
|
+
ALTER TABLE if exists site.content_types drop column if exists slug;
|
|
22
|
+
ALTER TABLE if exists site.content_types drop column if exists display_name;
|
|
23
|
+
ALTER TABLE if exists site.contents drop column if exists fields;
|
|
24
|
+
|
|
25
|
+
DROP FUNCTION if exists site.getmenu(text);
|
|
26
|
+
|
|
27
|
+
-- seamless migration start
|
|
28
|
+
/*
|
|
29
|
+
insert into site.contents(content_id, space_id, content_type_id, slug)
|
|
30
|
+
select content_type_id, 'default', content_type_id, min(type_name) from site.single_type_values a
|
|
31
|
+
left join lateral (select content_type_id from site.content_types b where a.type_name=b.name limit 1)b on 1=1
|
|
32
|
+
where content_type_id not in (select content_id from site.contents) and content_type_id is not null
|
|
33
|
+
group by content_type_id;
|
|
34
|
+
insert into site.content_data(field_id, content_id, object_id, field_key, field_type, field_value)
|
|
35
|
+
select distinct single_type_value_id, content_type_id, type_name, key,
|
|
36
|
+
coalesce(value_type,case when substring(value from 1 for 1) = '[' then 'datalist' else 'text' end), value from site.single_type_values a
|
|
37
|
+
left join lateral (select content_type_id from site.content_types b where a.type_name=b.name limit 1)b on 1=1
|
|
38
|
+
where single_type_value_id not in (select field_id from site.content_data) and content_type_id is not null
|
|
39
|
+
and case when key = 'slug' then value not in ( select field_value from site.content_data where field_key='slug') else true end;
|
|
40
|
+
-- drop table if exists site.single_type_values cascade;
|
|
41
|
+
*/
|
|
42
|
+
-- seamless migration finish
|
|
43
|
+
|
|
44
|
+
--- insert default content types start
|
|
45
|
+
insert into site.content_types(content_type_id,name,title,type,columns)
|
|
46
|
+
values('pages','pages','Сторінки','collection',
|
|
47
|
+
'[{"name":"slug","label":"Slug","type":"slug","parent":"title","required":true},{"name":"title","label":"Title","type":"text","required":true},{"name":"status","label":"Status","type":"select","options":[{"id":"draft","text":"Draft"},{"id":"published","text":"Published"},{"id":"archived","text":"Archived"},{"id":"delayPublished","text":"Delay Published"}],"required":true},{"name":"published_at","label":"Publish at","type":"datetime","required":true}]'::json
|
|
48
|
+
) on conflict(content_type_id) do update set columns=excluded.columns, type = excluded.type;
|
|
49
|
+
insert into site.contents(content_id,content_type_id,space_id)
|
|
50
|
+
values('pages','pages','default') on conflict(content_id) do nothing;
|
|
51
|
+
--- insert default content types finish
|
|
52
|
+
|
|
53
|
+
alter table site.contents add column if not exists meta json;
|
|
54
|
+
alter table site.contents add column if not exists main_image text;
|
|
55
|
+
/*
|
|
56
|
+
ALTER TABLE if exists site.contents drop column if exists publish_at;
|
|
57
|
+
ALTER TABLE if exists site.contents add column if not exists published_at timestamp without time zone;
|
|
58
|
+
update site.contents set published_at=now() where published_at is null;
|
|
59
|
+
ALTER TABLE if exists site.contents alter column published_at set not null;
|
|
60
|
+
ALTER TABLE if exists site.contents alter column published_at set default now();
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
alter table site.content_data add column if not exists created_by text;
|
|
64
|
+
alter table site.content_data add column if not exists updated_by text;
|
|
65
|
+
alter table site.content_data add column if not exists field_value_object json;
|
|
66
|
+
|
|
67
|
+
--- seamless migration for content_data start
|
|
68
|
+
update site.content_data
|
|
69
|
+
set field_value_object=field_value::json
|
|
70
|
+
where field_value_object is null
|
|
71
|
+
and field_value is not null
|
|
72
|
+
and field_type in ('reference-list', 'reference', 'datalist', 'filelist', 'array');
|
|
73
|
+
--- seamless migration for content_data finish
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
-- delete accidental dupes
|
|
77
|
+
delete from site.content_data where object_id in ( select min(object_id) from site.content_data where field_key= 'slug' group by field_value having count(*) > 1 );
|
|
78
|
+
|
|
79
|
+
alter table site.content_types ADD COLUMN if not exists preview_path text;
|
|
80
|
+
|
|
81
|
+
-- get rid of naming inconsistency
|
|
82
|
+
update site.content_types
|
|
83
|
+
set columns=replace(columns::text,'publish_at', 'published_at')::json
|
|
84
|
+
where columns::text like '%publish_at%';
|
|
85
|
+
|
|
86
|
+
ALTER TABLE site.contents DROP CONSTRAINT contents_status_check;
|
|
87
|
+
ALTER TABLE site.contents ADD CONSTRAINT contents_status_check CHECK (status = ANY (ARRAY['draft'::text, 'published'::text, 'archived'::text, 'delayPublished'::text]));
|
|
88
|
+
|
|
89
|
+
UPDATE site.content_types
|
|
90
|
+
SET columns = (
|
|
91
|
+
SELECT jsonb_agg(elem)
|
|
92
|
+
FROM jsonb_array_elements(columns::jsonb) elem
|
|
93
|
+
WHERE elem->>'name' <> 'status'
|
|
94
|
+
)
|
|
95
|
+
WHERE columns IS NOT NULL;
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
UPDATE site.content_types
|
|
99
|
+
SET columns = columns::jsonb || '{"name": "status", "type": "select", "label": "Status", "options": [{"id": "draft", "text": "Draft"}, {"id": "published", "text": "Published"}, {"id": "archived", "text": "Archived"}, {"id": "delayPublished", "text": "Delay Published"}], "required": true}
|
|
100
|
+
'::jsonb
|
|
101
|
+
WHERE columns is not null;
|
|
102
|
+
|
|
103
|
+
-- remove dupes, make slug unique
|
|
104
|
+
update site.content_data set content_id='pages' where content_id<>'pages' and content_id in (
|
|
105
|
+
select content_id from site.contents where content_id<>'pages' and slug='pages'
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
delete from site.contents where content_id<>'pages' and slug='pages';
|
|
109
|
+
|
|
110
|
+
delete from site.contents a
|
|
111
|
+
where slug in (select slug from site.contents group by slug having count(*) > 1)
|
|
112
|
+
and (select count(*) from site.content_data where content_id=a.content_id) = 0;
|
|
113
|
+
|
|
114
|
+
alter table site.contents drop constraint if exists site_contents_slug_unique;
|
|
115
|
+
alter table site.contents add constraint site_contents_slug_unique UNIQUE (slug);
|
|
116
|
+
|
|
117
|
+
alter table site.contents add column if not exists space_id text;
|
|
118
|
+
alter table site.contents alter column space_id drop not null;
|
|
119
|
+
update site.spaces set locales='{ua,en,de}'::text[] where space_id='default';
|
|
120
|
+
|
|
121
|
+
alter table site.content_data drop constraint if exists content_data_content_id_fkey;
|
|
122
|
+
alter table site.content_data add constraint content_data_content_id_fkey foreign key (content_id) references site.contents(content_id) on delete cascade;
|
|
123
|
+
|
|
124
124
|
alter table site.tags add column if not exists locale jsonb;
|