@fc3/mmcadi 0.1.22 → 0.1.23

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 (194) hide show
  1. package/dist/.last-compile-time +1 -1
  2. package/dist/.last-publish-time +1 -1
  3. package/dist/client.js +254 -47
  4. package/dist/src/client/enum/page-type.d.ts +3 -0
  5. package/dist/src/client/enum/page-type.js +3 -0
  6. package/dist/src/client/enum/page-type.js.map +1 -1
  7. package/dist/src/client/factory/page.js +6 -0
  8. package/dist/src/client/factory/page.js.map +1 -1
  9. package/dist/src/client/page/confirm-hide-block.d.ts +7 -0
  10. package/dist/src/client/page/confirm-hide-block.js +28 -0
  11. package/dist/src/client/page/confirm-hide-block.js.map +1 -0
  12. package/dist/src/client/page/history.d.ts +16 -0
  13. package/dist/src/client/page/history.js +126 -0
  14. package/dist/src/client/page/history.js.map +1 -0
  15. package/dist/src/client/page/select-block-destination.d.ts +5 -0
  16. package/dist/src/client/page/select-block-destination.js +12 -0
  17. package/dist/src/client/page/select-block-destination.js.map +1 -0
  18. package/dist/src/client/page/view-custom.d.ts +3 -1
  19. package/dist/src/client/page/view-custom.js +60 -26
  20. package/dist/src/client/page/view-custom.js.map +1 -1
  21. package/dist/src/client/utility/get-block-activation-href.d.ts +2 -0
  22. package/dist/src/client/utility/get-block-activation-href.js +25 -0
  23. package/dist/src/client/utility/get-block-activation-href.js.map +1 -0
  24. package/dist/src/enum/action-type.d.ts +2 -0
  25. package/dist/src/enum/action-type.js +2 -0
  26. package/dist/src/enum/action-type.js.map +1 -1
  27. package/dist/src/enum/emoji.d.ts +1 -0
  28. package/dist/src/enum/emoji.js +1 -0
  29. package/dist/src/enum/emoji.js.map +1 -1
  30. package/dist/src/enum/tool-type.d.ts +1 -0
  31. package/dist/src/enum/tool-type.js +1 -0
  32. package/dist/src/enum/tool-type.js.map +1 -1
  33. package/dist/src/lib/server/http/endpoint.js +1 -1
  34. package/dist/src/lib/server/http/endpoint.js.map +1 -1
  35. package/dist/src/server/endpoint/abstract-page.d.ts +1 -1
  36. package/dist/src/server/endpoint/abstract-page.js +21 -3
  37. package/dist/src/server/endpoint/abstract-page.js.map +1 -1
  38. package/dist/src/server/endpoint/action/create.d.ts +3 -1
  39. package/dist/src/server/endpoint/action/create.js +61 -25
  40. package/dist/src/server/endpoint/action/create.js.map +1 -1
  41. package/dist/src/server/endpoint/action/get.d.ts +3 -1
  42. package/dist/src/server/endpoint/action/get.js +47 -1
  43. package/dist/src/server/endpoint/action/get.js.map +1 -1
  44. package/dist/src/server/endpoint/history.d.ts +13 -0
  45. package/dist/src/server/endpoint/history.js +61 -0
  46. package/dist/src/server/endpoint/history.js.map +1 -0
  47. package/dist/src/server/endpoint/login.d.ts +1 -1
  48. package/dist/src/server/endpoint/login.js +1 -1
  49. package/dist/src/server/endpoint/login.js.map +1 -1
  50. package/dist/src/server/endpoint/logout.js +7 -2
  51. package/dist/src/server/endpoint/logout.js.map +1 -1
  52. package/dist/src/server/endpoint/month.d.ts +1 -1
  53. package/dist/src/server/endpoint/month.js +1 -1
  54. package/dist/src/server/endpoint/month.js.map +1 -1
  55. package/dist/src/server/endpoint/settings/get.d.ts +1 -1
  56. package/dist/src/server/endpoint/settings/get.js +1 -1
  57. package/dist/src/server/endpoint/settings/get.js.map +1 -1
  58. package/dist/src/server/endpoint/week.d.ts +1 -1
  59. package/dist/src/server/endpoint/week.js +1 -1
  60. package/dist/src/server/endpoint/week.js.map +1 -1
  61. package/dist/src/server/endpoint/year.d.ts +1 -1
  62. package/dist/src/server/endpoint/year.js +1 -1
  63. package/dist/src/server/endpoint/year.js.map +1 -1
  64. package/dist/src/server/factory/block-result-serializer.d.ts +1 -1
  65. package/dist/src/server/factory/block-result-serializer.js +14 -14
  66. package/dist/src/server/factory/block-result-serializer.js.map +1 -1
  67. package/dist/src/server/factory/block-serializer.d.ts +15 -0
  68. package/dist/src/server/factory/block-serializer.js +80 -0
  69. package/dist/src/server/factory/block-serializer.js.map +1 -0
  70. package/dist/src/server/middleware/error-handler.js +14 -4
  71. package/dist/src/server/middleware/error-handler.js.map +1 -1
  72. package/dist/src/server/operation/add-block.js +1 -0
  73. package/dist/src/server/operation/add-block.js.map +1 -1
  74. package/dist/src/server/operation/delete-block.d.ts +5 -3
  75. package/dist/src/server/operation/delete-block.js +30 -9
  76. package/dist/src/server/operation/delete-block.js.map +1 -1
  77. package/dist/src/server/operation/destroy-session.js +13 -1
  78. package/dist/src/server/operation/destroy-session.js.map +1 -1
  79. package/dist/src/server/operation/find-account.js +3 -2
  80. package/dist/src/server/operation/find-account.js.map +1 -1
  81. package/dist/src/server/operation/hide-block.d.ts +14 -0
  82. package/dist/src/server/operation/hide-block.js +55 -0
  83. package/dist/src/server/operation/hide-block.js.map +1 -0
  84. package/dist/src/server/operation/load-page.d.ts +3 -1
  85. package/dist/src/server/operation/load-page.js +99 -39
  86. package/dist/src/server/operation/load-page.js.map +1 -1
  87. package/dist/src/server/operation/move-block.d.ts +16 -0
  88. package/dist/src/server/operation/move-block.js +101 -0
  89. package/dist/src/server/operation/move-block.js.map +1 -0
  90. package/dist/src/server/operation/store-file.d.ts +14 -0
  91. package/dist/src/server/operation/store-file.js +83 -0
  92. package/dist/src/server/operation/store-file.js.map +1 -0
  93. package/dist/src/server/operation/update-block.js +4 -4
  94. package/dist/src/server/operation/update-block.js.map +1 -1
  95. package/dist/src/server/serializer/action.d.ts +40 -0
  96. package/dist/src/server/serializer/action.js +940 -0
  97. package/dist/src/server/serializer/action.js.map +1 -0
  98. package/dist/src/server/serializer/base.d.ts +31 -0
  99. package/dist/src/server/serializer/base.js +1222 -0
  100. package/dist/src/server/serializer/base.js.map +1 -0
  101. package/dist/src/server/serializer/block/audio.d.ts +6 -0
  102. package/dist/src/server/serializer/block/audio.js +26 -0
  103. package/dist/src/server/serializer/block/audio.js.map +1 -0
  104. package/dist/src/server/serializer/block/background.d.ts +6 -0
  105. package/dist/src/server/serializer/block/background.js +22 -0
  106. package/dist/src/server/serializer/block/background.js.map +1 -0
  107. package/dist/src/server/serializer/block/calendar.d.ts +7 -0
  108. package/dist/src/server/serializer/block/calendar.js +140 -0
  109. package/dist/src/server/serializer/block/calendar.js.map +1 -0
  110. package/dist/src/server/serializer/block/directory.d.ts +7 -0
  111. package/dist/src/server/serializer/block/directory.js +53 -0
  112. package/dist/src/server/serializer/block/directory.js.map +1 -0
  113. package/dist/src/server/serializer/block/ephemeral.d.ts +6 -0
  114. package/dist/src/server/serializer/block/ephemeral.js +16 -0
  115. package/dist/src/server/serializer/block/ephemeral.js.map +1 -0
  116. package/dist/src/server/serializer/block/folder.d.ts +14 -0
  117. package/dist/src/server/serializer/block/folder.js +145 -0
  118. package/dist/src/server/serializer/block/folder.js.map +1 -0
  119. package/dist/src/server/serializer/block/header.d.ts +6 -0
  120. package/dist/src/server/serializer/block/header.js +35 -0
  121. package/dist/src/server/serializer/block/header.js.map +1 -0
  122. package/dist/src/server/serializer/block/image.d.ts +6 -0
  123. package/dist/src/server/serializer/block/image.js +45 -0
  124. package/dist/src/server/serializer/block/image.js.map +1 -0
  125. package/dist/src/server/serializer/block/link.d.ts +6 -0
  126. package/dist/src/server/serializer/block/link.js +39 -0
  127. package/dist/src/server/serializer/block/link.js.map +1 -0
  128. package/dist/src/server/serializer/block/list.d.ts +13 -0
  129. package/dist/src/server/serializer/block/list.js +113 -0
  130. package/dist/src/server/serializer/block/list.js.map +1 -0
  131. package/dist/src/server/serializer/block/multi-column.d.ts +6 -0
  132. package/dist/src/server/serializer/block/multi-column.js +78 -0
  133. package/dist/src/server/serializer/block/multi-column.js.map +1 -0
  134. package/dist/src/server/serializer/block/note.d.ts +6 -0
  135. package/dist/src/server/serializer/block/note.js +40 -0
  136. package/dist/src/server/serializer/block/note.js.map +1 -0
  137. package/dist/src/server/serializer/block/parameter.d.ts +6 -0
  138. package/dist/src/server/serializer/block/parameter.js +13 -0
  139. package/dist/src/server/serializer/block/parameter.js.map +1 -0
  140. package/dist/src/server/serializer/block/todo.d.ts +6 -0
  141. package/dist/src/server/serializer/block/todo.js +76 -0
  142. package/dist/src/server/serializer/block/todo.js.map +1 -0
  143. package/dist/src/server/serializer/block/whitespace.d.ts +6 -0
  144. package/dist/src/server/serializer/block/whitespace.js +17 -0
  145. package/dist/src/server/serializer/block/whitespace.js.map +1 -0
  146. package/dist/src/server/serializer/block.d.ts +27 -0
  147. package/dist/src/server/serializer/block.js +226 -0
  148. package/dist/src/server/serializer/block.js.map +1 -0
  149. package/dist/src/server/serializer/common/time-place-options.d.ts +2 -0
  150. package/dist/src/server/serializer/common/time-place-options.js +34 -0
  151. package/dist/src/server/serializer/common/time-place-options.js.map +1 -0
  152. package/dist/src/server/serializer/history.d.ts +19 -0
  153. package/dist/src/server/serializer/history.js +77 -0
  154. package/dist/src/server/serializer/history.js.map +1 -0
  155. package/dist/src/server/serializer/login.d.ts +12 -0
  156. package/dist/src/server/serializer/login.js +54 -0
  157. package/dist/src/server/serializer/login.js.map +1 -0
  158. package/dist/src/server/serializer/month.d.ts +10 -0
  159. package/dist/src/server/serializer/month.js +160 -0
  160. package/dist/src/server/serializer/month.js.map +1 -0
  161. package/dist/src/server/serializer/page.d.ts +47 -0
  162. package/dist/src/server/serializer/page.js +454 -0
  163. package/dist/src/server/serializer/page.js.map +1 -0
  164. package/dist/src/server/serializer/settings.d.ts +9 -0
  165. package/dist/src/server/serializer/settings.js +80 -0
  166. package/dist/src/server/serializer/settings.js.map +1 -0
  167. package/dist/src/server/serializer/week.d.ts +10 -0
  168. package/dist/src/server/serializer/week.js +175 -0
  169. package/dist/src/server/serializer/week.js.map +1 -0
  170. package/dist/src/server/serializer/year.d.ts +10 -0
  171. package/dist/src/server/serializer/year.js +142 -0
  172. package/dist/src/server/serializer/year.js.map +1 -0
  173. package/dist/src/server/utility/get-emoji-for-tool-type.js +1 -0
  174. package/dist/src/server/utility/get-emoji-for-tool-type.js.map +1 -1
  175. package/dist/src/server.js +2 -0
  176. package/dist/src/server.js.map +1 -1
  177. package/dist/src/type/account-settings.d.ts +3 -2
  178. package/dist/src/type/action/hide-block.d.ts +9 -0
  179. package/dist/src/type/action/hide-block.js +3 -0
  180. package/dist/src/type/action/hide-block.js.map +1 -0
  181. package/dist/src/type/action/move-block.d.ts +10 -0
  182. package/dist/src/type/action/move-block.js +3 -0
  183. package/dist/src/type/action/move-block.js.map +1 -0
  184. package/dist/src/type/block/audio.d.ts +2 -0
  185. package/dist/src/type/block/image.d.ts +2 -0
  186. package/dist/src/type/block.d.ts +2 -2
  187. package/dist/src/type/history-item.d.ts +5 -0
  188. package/dist/src/type/history-item.js +3 -0
  189. package/dist/src/type/history-item.js.map +1 -0
  190. package/dist/src/type/page.d.ts +2 -0
  191. package/dist/test/unit/server/operation/promote-block.js +11 -0
  192. package/dist/test/unit/server/operation/promote-block.js.map +1 -1
  193. package/dist/tsconfig.tsbuildinfo +1 -1
  194. package/package.json +1 -1
@@ -0,0 +1,940 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const errors_1 = require("./../../lib/errors/index.js");
7
+ const base_1 = __importDefault(require("./base.js"));
8
+ const custom_page_type_1 = __importDefault(require("./../enum/custom-page-type.js"));
9
+ const unknown_1 = __importDefault(require("./../../constant/role/unknown.js"));
10
+ const permission_type_1 = __importDefault(require("./../../enum/permission-type.js"));
11
+ const extract_role_1 = __importDefault(require("./../utility/extract-role.js"));
12
+ const page_type_1 = __importDefault(require("./../../client/enum/page-type.js"));
13
+ const role_matches_1 = __importDefault(require("./../utility/role-matches.js"));
14
+ const get_block_permissions_1 = __importDefault(require("./../utility/get-block-permissions.js"));
15
+ const get_key_for_role_1 = __importDefault(require("./../utility/get-key-for-role.js"));
16
+ const get_path_for_folder_block_1 = __importDefault(require("./../utility/get-path-for-folder-block.js"));
17
+ const validate_path_1 = __importDefault(require("./../utility/validate-path.js"));
18
+ const color_1 = __importDefault(require("./../../enum/color.js"));
19
+ const get_hex_for_color_1 = __importDefault(require("./../utility/get-hex-for-color.js"));
20
+ const create_date_1 = __importDefault(require("./../utility/create-date.js"));
21
+ const default_role_1 = __importDefault(require("./../../enum/default-role.js"));
22
+ const emoji_1 = __importDefault(require("./../../enum/emoji.js"));
23
+ const time_place_options_1 = __importDefault(require("./common/time-place-options.js"));
24
+ const get_label_for_time_place_visibility_1 = __importDefault(require("./../utility/get-label-for-time-place-visibility.js"));
25
+ const time_place_visibility_1 = __importDefault(require("./../../enum/time-place-visibility.js"));
26
+ const get_element_id_for_block_1 = __importDefault(require("./../utility/get-element-id-for-block.js"));
27
+ const get_emoji_for_block_type_1 = __importDefault(require("./../utility/get-emoji-for-block-type.js"));
28
+ const block_type_1 = __importDefault(require("./../../enum/block-type.js"));
29
+ const action_type_1 = __importDefault(require("./../../enum/action-type.js"));
30
+ const block_serializer_1 = __importDefault(require("./../factory/block-serializer.js"));
31
+ function getBlockIdForAction(action, action_metadata) {
32
+ const { block, metadata } = buildBlockAndMetadataForAction(action, action_metadata);
33
+ return (0, get_element_id_for_block_1.default)(block, metadata);
34
+ }
35
+ function serializeColorInputs(attribute, selected_color) {
36
+ const colors = Object.values(color_1.default);
37
+ const serialized_colors = colors.map((color) => {
38
+ const hex = (0, get_hex_for_color_1.default)(color);
39
+ const checked_attribute = color === selected_color ? 'checked' : '';
40
+ return `
41
+ <input autocomplete="off" class="color-option" type="radio" ${checked_attribute} id="${attribute}-${color}" name="${attribute}" value="${color}" />
42
+ <label class="mb-0" for="${attribute}-${color}" style="background-color:${hex}">
43
+ ${color}
44
+ </label>
45
+ `;
46
+ });
47
+ return serialized_colors.join('\n');
48
+ }
49
+ function buildBlockForAction(action, metadata) {
50
+ const { action_type } = action;
51
+ if (action_type === action_type_1.default.EDIT_BLOCK) {
52
+ const { block } = action;
53
+ if (block === undefined) {
54
+ throw new errors_1.InvariantViolation(`
55
+ Received an EditBlockAction with no block specified
56
+ `);
57
+ }
58
+ return block;
59
+ }
60
+ const { block_type, create_role, read_role, update_role, delete_role } = action;
61
+ const permissions = {
62
+ [permission_type_1.default.CREATE]: create_role,
63
+ [permission_type_1.default.READ]: read_role,
64
+ [permission_type_1.default.UPDATE]: update_role,
65
+ [permission_type_1.default.DELETE]: delete_role
66
+ };
67
+ const { account } = metadata;
68
+ const { id: creator_id, settings } = account;
69
+ const { default_time_place_visibility: visibility } = settings;
70
+ const created_at = Date.now();
71
+ const time = time_place_visibility_1.default.TIME;
72
+ const place = time_place_visibility_1.default.PLACE;
73
+ const both = time_place_visibility_1.default.BOTH;
74
+ const show_place = visibility === place || visibility === both;
75
+ const show_time = visibility === time || visibility === both;
76
+ switch (block_type) {
77
+ case block_type_1.default.AUDIO:
78
+ return {
79
+ block_type: block_type_1.default.AUDIO,
80
+ show_place,
81
+ show_time,
82
+ created_at,
83
+ creator_id,
84
+ file: null,
85
+ permissions
86
+ };
87
+ case block_type_1.default.IMAGE:
88
+ return {
89
+ block_type: block_type_1.default.IMAGE,
90
+ show_place,
91
+ show_time,
92
+ created_at,
93
+ creator_id,
94
+ file: null,
95
+ permissions
96
+ };
97
+ case block_type_1.default.NOTE:
98
+ return {
99
+ block_type: block_type_1.default.NOTE,
100
+ show_place,
101
+ show_time,
102
+ created_at,
103
+ creator_id,
104
+ text: '',
105
+ permissions
106
+ };
107
+ case block_type_1.default.TODO:
108
+ return {
109
+ block_type: block_type_1.default.TODO,
110
+ show_place,
111
+ show_time,
112
+ created_at,
113
+ creator_id,
114
+ completed_at: null,
115
+ title: '',
116
+ permissions
117
+ };
118
+ case block_type_1.default.HEADER:
119
+ return {
120
+ block_type: block_type_1.default.HEADER,
121
+ show_place,
122
+ show_time,
123
+ created_at,
124
+ creator_id,
125
+ title: '',
126
+ permissions
127
+ };
128
+ case block_type_1.default.FOLDER:
129
+ return {
130
+ block_type: block_type_1.default.FOLDER,
131
+ show_place,
132
+ show_time,
133
+ created_at,
134
+ creator_id,
135
+ title: '',
136
+ subtitle: '',
137
+ emoji: emoji_1.default.FOLDER,
138
+ color: color_1.default.GREY,
139
+ permissions
140
+ };
141
+ case block_type_1.default.LINK:
142
+ return {
143
+ block_type: block_type_1.default.LINK,
144
+ show_place,
145
+ show_time,
146
+ created_at,
147
+ creator_id,
148
+ href: '',
149
+ label: '',
150
+ color: color_1.default.GREY,
151
+ permissions
152
+ };
153
+ case block_type_1.default.MULTI_COLUMN:
154
+ return {
155
+ block_type: block_type_1.default.MULTI_COLUMN,
156
+ show_place,
157
+ show_time,
158
+ created_at,
159
+ creator_id,
160
+ children: [],
161
+ max_columns: 3,
162
+ permissions
163
+ };
164
+ default:
165
+ throw new errors_1.InvariantViolation(`Unsupported block type: ${block_type}`);
166
+ }
167
+ }
168
+ function buildMetadataForAction(action, action_metadata) {
169
+ const { path, editing, index_path } = action;
170
+ const { roles, account, creator_username } = action_metadata;
171
+ (0, validate_path_1.default)(path);
172
+ return {
173
+ page_path: path,
174
+ editing,
175
+ // TODO: Investigate whether there's a way to preserve this
176
+ referrer_url: null,
177
+ index_path,
178
+ target_index_path: null,
179
+ roles,
180
+ account,
181
+ creator_username
182
+ };
183
+ }
184
+ function buildBlockAndMetadataForAction(action, action_metadata) {
185
+ const block = buildBlockForAction(action, action_metadata);
186
+ const metadata = buildMetadataForAction(action, action_metadata);
187
+ return {
188
+ block,
189
+ metadata
190
+ };
191
+ }
192
+ class ActionResultSerializer extends base_1.default {
193
+ constructor(result, metadata, path, referrer_url, session) {
194
+ super(result, path, referrer_url, session);
195
+ this.metadata = metadata;
196
+ }
197
+ getTitle() {
198
+ const { action_type, path } = this.getResult();
199
+ return `applying action ${action_type} to page ${path}`;
200
+ }
201
+ getPageType() {
202
+ const { action_type } = this.getResult();
203
+ switch (action_type) {
204
+ case action_type_1.default.ADD_BLOCK:
205
+ return page_type_1.default.SELECT_BLOCK_TYPE;
206
+ case action_type_1.default.MOVE_BLOCK:
207
+ return page_type_1.default.SELECT_BLOCK_DESTINATION;
208
+ case action_type_1.default.DELETE_BLOCK:
209
+ return page_type_1.default.CONFIRM_DELETE_BLOCK;
210
+ case action_type_1.default.HIDE_BLOCK:
211
+ return page_type_1.default.CONFIRM_HIDE_BLOCK;
212
+ case action_type_1.default.EDIT_BLOCK:
213
+ return page_type_1.default.EDIT_BLOCK;
214
+ default:
215
+ throw new errors_1.InvariantViolation(`
216
+ Unsupported action type when mapping to page type: ${action_type}
217
+ `);
218
+ }
219
+ }
220
+ serializeSections() {
221
+ const action = this.getResult();
222
+ const { action_type } = action;
223
+ switch (action_type) {
224
+ case action_type_1.default.ADD_BLOCK:
225
+ return this.serializeAddBlock(action);
226
+ case action_type_1.default.MOVE_BLOCK:
227
+ return this.serializeMoveBlock(action);
228
+ case action_type_1.default.DELETE_BLOCK:
229
+ return this.serializeDeleteBlock(action);
230
+ case action_type_1.default.HIDE_BLOCK:
231
+ return this.serializeHideBlock(action);
232
+ case action_type_1.default.EDIT_BLOCK:
233
+ return this.serializeModifiableBlock(action);
234
+ default:
235
+ throw new errors_1.InvariantViolation(`
236
+ Invalid action type: ${action_type}
237
+ `);
238
+ }
239
+ }
240
+ serializeAddBlock(action) {
241
+ const { block_type } = action;
242
+ if (block_type === undefined) {
243
+ return this.serializeUnselectedBlockType(action);
244
+ }
245
+ return this.serializeModifiableBlock(action);
246
+ }
247
+ serializeModifiableBlock(action) {
248
+ const metadata = this.getMetadata();
249
+ const { block_type } = buildBlockForAction(action, metadata);
250
+ switch (block_type) {
251
+ case block_type_1.default.NOTE:
252
+ return this.serializeModifiableNoteBlock(action);
253
+ case block_type_1.default.TODO:
254
+ return this.serializeModifiableTodoBlock(action);
255
+ case block_type_1.default.IMAGE:
256
+ return this.serializeModifiableImageBlock(action);
257
+ case block_type_1.default.AUDIO:
258
+ return this.serializeModifiableAudioBlock(action);
259
+ case block_type_1.default.HEADER:
260
+ return this.serializeModifiableHeaderBlock(action);
261
+ case block_type_1.default.FOLDER:
262
+ return this.serializeModifiableFolderBlock(action);
263
+ case block_type_1.default.MULTI_COLUMN:
264
+ return this.serializeModifiableMultiColumnBlock(action);
265
+ case block_type_1.default.LINK:
266
+ return this.serializeModifiableLinkBlock(action);
267
+ default:
268
+ throw new errors_1.InvariantViolation(`
269
+ Invalid block type: ${block_type}
270
+ `);
271
+ }
272
+ }
273
+ serializeUnselectedBlockType(action) {
274
+ const { path, editing, index_path } = action;
275
+ function serializeBlockLink(block_type, last = false) {
276
+ const offset_class = last ? '' : 'mb-8';
277
+ const emoji = (0, get_emoji_for_block_type_1.default)(block_type);
278
+ const block_type_label = block_type.replace(/_/g, '-');
279
+ const first_letter = block_type[0];
280
+ return `
281
+ <li class="${offset_class}">
282
+ <a id="add-block-${block_type}" href="/actions?action_type=${action_type_1.default.ADD_BLOCK}&editing=${editing}&path=${path}&index_path=${index_path}&block_type=${block_type}" class="biglink yellow align-left">
283
+ ${emoji} ${block_type_label} <span class="half-opacity">[${first_letter}]</span>
284
+ </a>
285
+ </li>
286
+ `;
287
+ }
288
+ return `
289
+ <section>
290
+ <h2>${emoji_1.default.BOOKS} add block:</h2>
291
+ <ul>
292
+ ${serializeBlockLink(block_type_1.default.NOTE)}
293
+ ${serializeBlockLink(block_type_1.default.IMAGE)}
294
+ ${serializeBlockLink(block_type_1.default.AUDIO)}
295
+ ${serializeBlockLink(block_type_1.default.TODO)}
296
+ ${serializeBlockLink(block_type_1.default.HEADER)}
297
+ ${serializeBlockLink(block_type_1.default.LINK)}
298
+ ${serializeBlockLink(block_type_1.default.FOLDER)}
299
+ ${serializeBlockLink(block_type_1.default.MULTI_COLUMN)}
300
+ </ul>
301
+ </section>
302
+
303
+ <!--
304
+ <section>
305
+ <h2>create page:</h2>
306
+ <ul>
307
+ <li>
308
+ <a href="/actions?action_type=${action_type_1.default.CREATE_PAGE}&custom_page_type=${custom_page_type_1.default.BLANK}" class="biglink align-left">
309
+ ${emoji_1.default.DOCUMENT} blank
310
+ </a>
311
+ </li>
312
+ <li class="mt-8">
313
+ <a href="/actions?action_type=${action_type_1.default.CREATE_PAGE}&custom_page_type=${custom_page_type_1.default.FORM}" class="biglink align-left">
314
+ ${emoji_1.default.RECEIPT} form
315
+ </a>
316
+ <li class="mt-8">
317
+ </li>
318
+ <a href="/actions?action_type=${action_type_1.default.CREATE_PAGE}&custom_page_type=${custom_page_type_1.default.PRODUCT}" class="biglink align-left">
319
+ ${emoji_1.default.SHOPPING_BAGS} product
320
+ </a>
321
+ </li>
322
+ </ul>
323
+ </section>
324
+ -->
325
+ `;
326
+ }
327
+ serializeModifiableImageBlock(action) {
328
+ const { path } = action;
329
+ return this.wrapModifyBlockAction(action, `
330
+ <fieldset>
331
+ <legend>${emoji_1.default.CAMERA} adding image(s) to page: [${path}]</legend>
332
+ <div class="file-wrapper">
333
+ <input id="file-input" type="file" name="files" accept="image/*" />
334
+ <label class="biglink" for="files">select images</label>
335
+ </div>
336
+ </fieldset>
337
+ `);
338
+ }
339
+ serializeModifiableAudioBlock(action) {
340
+ const { path } = action;
341
+ return this.wrapModifyBlockAction(action, `
342
+ <fieldset>
343
+ <legend>${emoji_1.default.MICROPHONE} adding audio to page: [${path}]</legend>
344
+ <div class="file-wrapper">
345
+ <input type="file" name="files" accept="audio/*" capture />
346
+ <label class="biglink" for="files">upload audio</label>
347
+ </div>
348
+ </fieldset>
349
+ `);
350
+ }
351
+ serializeModifiableTodoBlock(action) {
352
+ const { path, action_type } = action;
353
+ const is_adding = action_type === action_type_1.default.ADD_BLOCK;
354
+ const verb = is_adding ? 'adding' : 'updating';
355
+ const metadata = this.getMetadata();
356
+ const block = buildBlockForAction(action, metadata);
357
+ const todo_block = block;
358
+ const title = todo_block.title || '';
359
+ const placeholder = title || 'enter todo';
360
+ const { completed_at } = todo_block;
361
+ const completed = completed_at !== null;
362
+ const checked_attribute = completed ? 'checked' : '';
363
+ return this.wrapModifyBlockAction(action, `
364
+ <fieldset>
365
+ <legend>${emoji_1.default.COMPLETED_CHECKMARK} ${verb} todo on page: [${path}]</legend>
366
+ <input id="text-input" name="title" placeholder="${placeholder}" autofocus autocomplete="off" value="${title}" />
367
+ </fieldset>
368
+
369
+ <fieldset>
370
+ <legend>completed?</legend>
371
+ <input type="checkbox" name="completed" ${checked_attribute} />
372
+ <label for="completed">immediately mark this task as complete</label>
373
+ </fieldset>
374
+ `);
375
+ }
376
+ serializeModifiableNoteBlock(action) {
377
+ const { path, action_type } = action;
378
+ const is_adding = action_type === action_type_1.default.ADD_BLOCK;
379
+ const verb = is_adding ? 'adding' : 'updating';
380
+ const metadata = this.getMetadata();
381
+ const block = buildBlockForAction(action, metadata);
382
+ const { text } = block;
383
+ return this.wrapModifyBlockAction(action, `
384
+ <fieldset>
385
+ <legend>${emoji_1.default.NOTEPAD} ${verb} text on page: [${path}]</legend>
386
+ <textarea id="text-input" name="text" placeholder="${text}" autofocus autocomplete="off">${text}</textarea>
387
+ </fieldset>
388
+ `);
389
+ }
390
+ serializeModifiableHeaderBlock(action) {
391
+ const { path } = action;
392
+ return this.wrapModifyBlockAction(action, `
393
+ <fieldset>
394
+ <legend>${emoji_1.default.PLACARD} adding title to page: [${path}]</legend>
395
+ <input name="title" type="text" placeholder="your title here" autofocus autocomplete="off" />
396
+ </fieldset>
397
+ `);
398
+ }
399
+ serializeModifiableLinkBlock(action) {
400
+ const metadata = this.getMetadata();
401
+ const block = buildBlockForAction(action, metadata);
402
+ const link_block = block;
403
+ const { label, href, color } = link_block;
404
+ const color_inputs = serializeColorInputs('color', color);
405
+ return this.wrapModifyBlockAction(action, `
406
+ <fieldset>
407
+ <legend>${emoji_1.default.LINK} link target</legend>
408
+ <p class="text-smaller half-opacity">
409
+ the URL where your link should point
410
+ </p>
411
+ <input id="href-text-input" name="href" type="text" placeholder="${href}" value="${href}" autofocus autocomplete="off" />
412
+ </fieldset>
413
+
414
+ <fieldset>
415
+ <legend>${emoji_1.default.SIGN} link label</legend>
416
+ <p class="text-smaller half-opacity">
417
+ the text label for your link
418
+ </p>
419
+ <input id="label-text-input" name="label" type="text" placeholder="${label}" value="${label}" autocomplete="off" />
420
+ </fieldset>
421
+
422
+ <fieldset>
423
+ <legend>${emoji_1.default.PALETTE} link color</legend>
424
+ <div class="pt-8">
425
+ ${color_inputs}
426
+ </div>
427
+ </fieldset>
428
+ `);
429
+ }
430
+ serializeModifiableMultiColumnBlock(action) {
431
+ const { path } = action;
432
+ const metadata = this.getMetadata();
433
+ const { block } = buildBlockAndMetadataForAction(action, metadata);
434
+ const { max_columns } = block;
435
+ return this.wrapModifyBlockAction(action, `
436
+ <fieldset>
437
+ <legend>${emoji_1.default.BAR_CHART} adding multi-column block to page: [${path}]</legend>
438
+
439
+ <p>max columns:</p>
440
+
441
+ <div class="p-16">
442
+ <input type="range" min="1" max="8" value="${max_columns}" id="max-columns" name="max_columns" list="column_values" />
443
+
444
+ <datalist id="column_values">
445
+ <option value="1" label="1"></option>
446
+ <option value="2" label="2"></option>
447
+ <option value="3" label="3"></option>
448
+ <option value="4" label="4"></option>
449
+ <option value="5" label="5"></option>
450
+ <option value="6" label="6"></option>
451
+ <option value="7" label="7"></option>
452
+ <option value="8" label="8"></option>
453
+ </datalist>
454
+ </div>
455
+ </fieldset>
456
+ `);
457
+ }
458
+ serializeModifiableFolderBlock(action) {
459
+ const { action_type, path } = action;
460
+ const is_adding = action_type === action_type_1.default.ADD_BLOCK;
461
+ const adjective = is_adding ? 'new' : 'updated';
462
+ const metadata = this.getMetadata();
463
+ const block = buildBlockForAction(action, metadata);
464
+ const folder_block = block;
465
+ const { title, subtitle, emoji, color } = folder_block;
466
+ const block_id = getBlockIdForAction(action, metadata);
467
+ const folder_path = (0, get_path_for_folder_block_1.default)({
468
+ base_path: path,
469
+ block: folder_block
470
+ });
471
+ const color_inputs = serializeColorInputs('color', color);
472
+ return this.wrapModifyBlockAction(action, `
473
+ <fieldset>
474
+ <legend>${emoji_1.default.FOLDER} folder title</legend>
475
+ <p class="text-smaller half-opacity">
476
+ your ${adjective} page will live at:
477
+ </p>
478
+ <p class="text-smaller">
479
+ <code class="text-yellow" id="${block_id}-folder-path-target">${folder_path}</code>
480
+ </p>
481
+ <input id="title-text-input" name="title" type="text" placeholder="${title}" value="${title}" autofocus autocomplete="off" />
482
+ </fieldset>
483
+
484
+ <fieldset>
485
+ <legend>${emoji_1.default.SUN_WITH_FACE} preview emoji</legend>
486
+ <p class="text-smaller half-opacity">
487
+ <span class="text-bold">[optional]</span> appears inside the folder button on its parent page
488
+ </p>
489
+ <input id="emoji-text-input" name="emoji" type="text" placeholder="${emoji}" value="${emoji}" autocomplete="off" />
490
+ </fieldset>
491
+
492
+ <fieldset>
493
+ <legend>${emoji_1.default.NOTEPAD} folder subtitle</legend>
494
+ <p class="text-smaller half-opacity">
495
+ <span class="text-bold">[optional]</span> appears below the folder name
496
+ </p>
497
+ <input id="subtitle-text-input" name="subtitle" type="text" placeholder="${subtitle}" value="${subtitle}" autocomplete="off" />
498
+ </fieldset>
499
+
500
+ <fieldset>
501
+ <legend>${emoji_1.default.PALETTE} link color</legend>
502
+ <div class="pt-8">
503
+ ${color_inputs}
504
+ </div>
505
+ </fieldset>
506
+ `);
507
+ }
508
+ wrapModifyBlockAction(action, block_specific_markup) {
509
+ const { path, editing, action_type, index_path } = action;
510
+ const action_metadata = this.getMetadata();
511
+ const { block, metadata } = buildBlockAndMetadataForAction(action, action_metadata);
512
+ const { block_type } = block;
513
+ const session = this.getSession();
514
+ const updated_metadata = {
515
+ ...metadata,
516
+ editing: false
517
+ };
518
+ const factory = new block_serializer_1.default(block, updated_metadata, session);
519
+ const serializer = factory.create();
520
+ const block_preview = serializer.serializeContent();
521
+ const selected_color = block.color || color_1.default.GREY;
522
+ const color_inputs = serializeColorInputs('border_color', selected_color);
523
+ const time_place_section = this.renderTimePlaceSection(block);
524
+ const permissions_section = this.renderPermissionsSection(block);
525
+ return `
526
+ <section class="grey">
527
+ <fieldset>
528
+ <legend>${emoji_1.default.MAGNIFYING_GLASS} preview</legend>
529
+ ${block_preview}
530
+ </fieldset>
531
+
532
+ <form class="mt-64" enctype="multipart/form-data" method="post" action="/actions?editing=${editing}">
533
+ <input type="hidden" name="action_type" value="${action_type}" />
534
+ <input type="hidden" name="path" value="${path}" />
535
+ <input type="hidden" name="index_path" value="${index_path}" />
536
+ <input type="hidden" name="block_type" value="${block_type}" />
537
+
538
+ ${block_specific_markup}
539
+
540
+ <fieldset class="mt-64">
541
+ <legend>${emoji_1.default.GEAR} additional settings</legend>
542
+
543
+ <details class="mb-8 clearfix">
544
+ <summary>
545
+ <span>border color</span>
546
+ <span class="summary-label">
547
+ <span class="icon" style="background-color: ${selected_color}"></span>
548
+ ${selected_color}
549
+ </span>
550
+ </summary>
551
+
552
+ <p class="mb-32 clearfix">
553
+ ${color_inputs}
554
+ </p>
555
+
556
+ <aside>
557
+ colors are defined in your <a href="/settings">account settings</a>.
558
+ </aside>
559
+ </details>
560
+
561
+ ${permissions_section}
562
+ ${time_place_section}
563
+
564
+ </fieldset>
565
+
566
+ <table class="button-row fixed mt-32">
567
+ <tbody>
568
+ <tr>
569
+ <td>
570
+ <a class="biglink grey" href="${path}?editing=true">
571
+ ${emoji_1.default.LEFT_ARROW_UNICODE} cancel
572
+ </a>
573
+ </td>
574
+
575
+ <td>
576
+ <button class="biglink green" type="submit">
577
+ submit ${emoji_1.default.RIGHT_ARROW_UNICODE}
578
+ </button>
579
+ </td>
580
+ </tr>
581
+ </tbody>
582
+ </table>
583
+ </form>
584
+ </section>
585
+ `;
586
+ }
587
+ renderPermissionsSection(block) {
588
+ const permissions = (0, get_block_permissions_1.default)(block);
589
+ const permission_types = Object.keys(permissions);
590
+ const { roles } = this.getMetadata();
591
+ const permission_rows = [];
592
+ const summary_emojis = [];
593
+ function renderPermissionOptions(selected_role) {
594
+ const serialized_options = roles.map((role) => {
595
+ const selected = (0, role_matches_1.default)(role, selected_role);
596
+ const is_unknown = (0, role_matches_1.default)(role, unknown_1.default);
597
+ const selected_attribute = selected ? 'selected' : '';
598
+ const role_key = (0, get_key_for_role_1.default)(role);
599
+ const hidden_class = is_unknown && !selected ? 'hidden' : '';
600
+ return `
601
+ <option class="${hidden_class}" ${selected_attribute} value="${role_key}">
602
+ [${role.emoji} ${role.name}]
603
+ </option>
604
+ `;
605
+ });
606
+ return serialized_options.join('\n');
607
+ }
608
+ Object.entries(permissions).forEach(([permission_type, role_key]) => {
609
+ const emoji = (() => {
610
+ switch (role_key) {
611
+ case default_role_1.default.PUBLIC:
612
+ return emoji_1.default.GRID_GLOBE;
613
+ case default_role_1.default.CREATOR:
614
+ return emoji_1.default.LOCKED;
615
+ default:
616
+ return emoji_1.default.WINDOW;
617
+ }
618
+ })();
619
+ const role = (0, extract_role_1.default)(roles, role_key);
620
+ const options = renderPermissionOptions(role);
621
+ const row = `
622
+ <tr>
623
+ <td>
624
+ ${permission_type}
625
+ </td>
626
+ <td>
627
+ <select name="${permission_type}_role" autocomplete="off">
628
+ ${options}
629
+ </select>
630
+ </td>
631
+ </tr>
632
+ `;
633
+ permission_rows.push(row);
634
+ summary_emojis.push(emoji);
635
+ });
636
+ const summary_label = (() => {
637
+ let role_index = 0;
638
+ while (role_index < roles.length) {
639
+ const role = roles[role_index++];
640
+ const actual_role_key = (0, get_key_for_role_1.default)(role);
641
+ let permission_index = 0;
642
+ while (permission_index < permission_types.length) {
643
+ const permission_type = permission_types[permission_index++];
644
+ const assigned_role_key = permissions[permission_type];
645
+ if (assigned_role_key === actual_role_key) {
646
+ return `${role.name} ${permission_type}`;
647
+ }
648
+ }
649
+ }
650
+ throw new errors_1.InvariantViolation(`
651
+ Unable to determine minimum role permission
652
+ `);
653
+ })();
654
+ return `
655
+ <details class="mb-8">
656
+ <summary>
657
+ permissions
658
+ <span class="summary-label">
659
+ ${summary_emojis.join('')} ${summary_label}
660
+ </span>
661
+ </summary>
662
+ <table>
663
+ <thead>
664
+ <tr>
665
+ <th>
666
+ operation
667
+ </th>
668
+ <th>
669
+ minimum required role
670
+ </th>
671
+ </tr>
672
+ </thead>
673
+ <tbody>
674
+ ${permission_rows.join('\n')}
675
+ </tbody>
676
+ </table>
677
+ </details>
678
+ `;
679
+ }
680
+ renderTimePlaceSection(block) {
681
+ const current_visibility = (() => {
682
+ if (block.show_time && block.show_place) {
683
+ return time_place_visibility_1.default.BOTH;
684
+ }
685
+ if (block.show_time) {
686
+ return time_place_visibility_1.default.TIME;
687
+ }
688
+ if (block.show_place) {
689
+ return time_place_visibility_1.default.PLACE;
690
+ }
691
+ return time_place_visibility_1.default.NONE;
692
+ })();
693
+ const label = (0, get_label_for_time_place_visibility_1.default)(current_visibility);
694
+ const options = (0, time_place_options_1.default)(current_visibility);
695
+ return `
696
+ <details>
697
+ <summary>time and place
698
+ <span class="summary-label">
699
+ ${label}
700
+ </span>
701
+ </summary>
702
+
703
+ ${options}
704
+ </details>
705
+ `;
706
+ }
707
+ serializeMoveBlock(action) {
708
+ const { path, block, editing, index_path, target_path } = action;
709
+ const session = this.getSession();
710
+ const roles = this.getRoles();
711
+ const account = this.getAccount();
712
+ const { creator_username } = this.getMetadata();
713
+ const block_metadata = {
714
+ editing,
715
+ page_path: path,
716
+ // We are just displaying the single block;
717
+ // there's no reason to highlight it.
718
+ target_index: null,
719
+ referrer_url: null,
720
+ roles,
721
+ account,
722
+ index_path,
723
+ target_index_path: null,
724
+ creator_username
725
+ };
726
+ const factory = new block_serializer_1.default(block, block_metadata, session);
727
+ const serializer = factory.create();
728
+ const serialized_block = serializer.serializeContent();
729
+ return `
730
+ <section>
731
+ <h2>move this block where?</h2>
732
+
733
+ ${serialized_block}
734
+
735
+ <form id="move-form" method="post" action="/actions?editing=${editing}">
736
+ <input type="hidden" name="action_type" value="${action_type_1.default.MOVE_BLOCK}" />
737
+ <input type="hidden" name="path" value="${path}" />
738
+ <input type="hidden" name="index_path" value="${index_path}" />
739
+
740
+ <input type="text" name="target_path" autofocus value="${target_path}" />
741
+
742
+ <table class="fixed mt-32">
743
+ <tbody>
744
+ <tr>
745
+ <td>
746
+ <a class="biglink grey" href="${path}?editing=${editing}">
747
+ ${emoji_1.default.LEFT_ARROW_UNICODE} cancel
748
+ </a>
749
+ </td>
750
+
751
+ <td>
752
+ <button class="biglink orange" type="submit">
753
+ move ${emoji_1.default.RIGHT_ARROW_UNICODE}
754
+ </button>
755
+ </td>
756
+ </tr>
757
+ </tbody>
758
+ </table>
759
+ </form>
760
+ </section>
761
+ `;
762
+ }
763
+ serializeHideBlock(action) {
764
+ const { path, block, editing, index_path } = action;
765
+ const session = this.getSession();
766
+ const roles = this.getRoles();
767
+ const account = this.getAccount();
768
+ const { creator_username } = this.getMetadata();
769
+ const block_metadata = {
770
+ editing,
771
+ page_path: path,
772
+ // We are just displaying the single block;
773
+ // there's no reason to highlight it.
774
+ target_index: null,
775
+ referrer_url: null,
776
+ roles,
777
+ account,
778
+ index_path,
779
+ target_index_path: null,
780
+ creator_username
781
+ };
782
+ const factory = new block_serializer_1.default(block, block_metadata, session);
783
+ const serializer = factory.create();
784
+ const serialized_block = serializer.serializeContent();
785
+ const { block_type } = block;
786
+ const created_date = (0, create_date_1.default)(block.created_at);
787
+ const created_timestamp = created_date.toString();
788
+ return `
789
+ <section>
790
+ <h2>really delete this block?</h2>
791
+
792
+ ${serialized_block}
793
+
794
+ <section class="align-left mt-32">
795
+ <h4 class="mb-8">block metadata</h4>
796
+ <table style="font-size:75%">
797
+ <tbody>
798
+ <tr>
799
+ <th>
800
+ type
801
+ </th>
802
+ <td class="align-left">
803
+ ${block_type}
804
+ </td>
805
+ </tr>
806
+
807
+ <tr>
808
+ <th>
809
+ created on
810
+ </th>
811
+ <td class="align-left">
812
+ ${created_timestamp}
813
+ </td>
814
+ </tr>
815
+ </tbody>
816
+ </table>
817
+ </section>
818
+
819
+ <form id="hide-form" method="post" action="/actions?editing=${editing}">
820
+ <input type="hidden" name="action_type" value="${action_type_1.default.HIDE_BLOCK}" />
821
+ <input type="hidden" name="path" value="${path}" />
822
+ <input type="hidden" name="index_path" value="${index_path}" />
823
+
824
+ <table class="fixed mt-32">
825
+ <tbody>
826
+ <tr>
827
+ <td>
828
+ <a class="biglink grey" href="${path}?editing=${editing}">
829
+ ${emoji_1.default.LEFT_ARROW_UNICODE} cancel
830
+ </a>
831
+ </td>
832
+
833
+ <td>
834
+ <button class="biglink purple" type="submit">
835
+ hide ${emoji_1.default.RIGHT_ARROW_UNICODE}
836
+ </button>
837
+ </td>
838
+ </tr>
839
+ </tbody>
840
+ </table>
841
+ </form>
842
+ </section>
843
+ `;
844
+ }
845
+ serializeDeleteBlock(action) {
846
+ const { path, block, editing, index_path } = action;
847
+ const session = this.getSession();
848
+ const roles = this.getRoles();
849
+ const account = this.getAccount();
850
+ const { creator_username } = this.getMetadata();
851
+ const block_metadata = {
852
+ editing,
853
+ page_path: path,
854
+ // We are just displaying the single block;
855
+ // there's no reason to highlight it.
856
+ target_index: null,
857
+ referrer_url: null,
858
+ roles,
859
+ account,
860
+ index_path,
861
+ target_index_path: null,
862
+ creator_username
863
+ };
864
+ const factory = new block_serializer_1.default(block, block_metadata, session);
865
+ const serializer = factory.create();
866
+ const serialized_block = serializer.serializeContent();
867
+ const { block_type } = block;
868
+ const created_date = (0, create_date_1.default)(block.created_at);
869
+ const created_timestamp = created_date.toString();
870
+ return `
871
+ <section>
872
+ <h2>really delete this block?</h2>
873
+
874
+ ${serialized_block}
875
+
876
+ <section class="align-left mt-32">
877
+ <h4 class="mb-8">block metadata</h4>
878
+ <table style="font-size:75%">
879
+ <tbody>
880
+ <tr>
881
+ <th>
882
+ type
883
+ </th>
884
+ <td class="align-left">
885
+ ${block_type}
886
+ </td>
887
+ </tr>
888
+
889
+ <tr>
890
+ <th>
891
+ created on
892
+ </th>
893
+ <td class="align-left">
894
+ ${created_timestamp}
895
+ </td>
896
+ </tr>
897
+ </tbody>
898
+ </table>
899
+ </section>
900
+
901
+ <form id="deletion-form" method="post" action="/actions?editing=${editing}">
902
+ <input type="hidden" name="action_type" value="${action_type_1.default.DELETE_BLOCK}" />
903
+ <input type="hidden" name="path" value="${path}" />
904
+ <input type="hidden" name="index_path" value="${index_path}" />
905
+
906
+ <table class="fixed mt-32">
907
+ <tbody>
908
+ <tr>
909
+ <td>
910
+ <a class="biglink grey" href="${path}?editing=${editing}">
911
+ ${emoji_1.default.LEFT_ARROW_UNICODE} cancel
912
+ </a>
913
+ </td>
914
+
915
+ <td>
916
+ <button class="biglink red" type="submit">
917
+ delete ${emoji_1.default.RIGHT_ARROW_UNICODE}
918
+ </button>
919
+ </td>
920
+ </tr>
921
+ </tbody>
922
+ </table>
923
+ </form>
924
+ </section>
925
+ `;
926
+ }
927
+ getRoles() {
928
+ const { roles } = this.getMetadata();
929
+ return roles;
930
+ }
931
+ getAccount() {
932
+ const { account } = this.getMetadata();
933
+ return account;
934
+ }
935
+ getMetadata() {
936
+ return this.metadata;
937
+ }
938
+ }
939
+ exports.default = ActionResultSerializer;
940
+ //# sourceMappingURL=action.js.map