@squiz/render-runtime-lib 1.73.0 → 1.75.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/PreviewComponentService.js +43 -0
- package/lib/PreviewComponentService.js.map +1 -0
- package/lib/PreviewComponentService.spec.js +64 -0
- package/lib/PreviewComponentService.spec.js.map +1 -0
- package/lib/RenderInputService.js +286 -0
- package/lib/RenderInputService.js.map +1 -0
- package/lib/RenderInputService.spec.js +645 -0
- package/lib/RenderInputService.spec.js.map +1 -0
- package/lib/component-runner/ComponentRootUrlResolver.js +3 -0
- package/lib/component-runner/ComponentRootUrlResolver.js.map +1 -0
- package/lib/component-runner/ComponentRunnerServiceWithWorkers.js +91 -0
- package/lib/component-runner/ComponentRunnerServiceWithWorkers.js.map +1 -0
- package/lib/component-runner/ComponentRunnerServiceWithWorkers.spec.js +104 -0
- package/lib/component-runner/ComponentRunnerServiceWithWorkers.spec.js.map +1 -0
- package/lib/component-runner/ComponentRuntimeContext.d.ts +1 -8
- package/lib/component-runner/ComponentRuntimeContext.js +3 -0
- package/lib/component-runner/ComponentRuntimeContext.js.map +1 -0
- package/lib/component-runner/ContentRuntimeService.d.ts +1 -1
- package/lib/component-runner/ContentRuntimeService.js +31 -0
- package/lib/component-runner/ContentRuntimeService.js.map +1 -0
- package/lib/component-runner/ExecuteComponentTask.d.ts +1 -9
- package/lib/component-runner/ExecuteComponentTask.js +8 -0
- package/lib/component-runner/ExecuteComponentTask.js.map +1 -0
- package/lib/component-runner/FunctionReturnTypes.js +3 -0
- package/lib/component-runner/FunctionReturnTypes.js.map +1 -0
- package/lib/component-runner/index.js +23 -0
- package/lib/component-runner/index.js.map +1 -0
- package/lib/component-runner/worker/component-bootstrapper.js +63 -0
- package/lib/component-runner/worker/component-bootstrapper.js.map +1 -0
- package/lib/health-check-service.js +3 -0
- package/lib/health-check-service.js.map +1 -0
- package/lib/index.d.ts +0 -16
- package/lib/index.js +23 -4590
- package/lib/index.js.map +1 -7
- package/lib/ioc.js +37 -0
- package/lib/ioc.js.map +1 -0
- package/lib/test/helpers/fixtures.js +152 -0
- package/lib/test/helpers/fixtures.js.map +1 -0
- package/lib/test/helpers/stack.js +121 -0
- package/lib/test/helpers/stack.js.map +1 -0
- package/lib/test/index.js +21 -0
- package/lib/test/index.js.map +1 -0
- package/lib/test/mock-services/MockedComponentSetService.js +413 -0
- package/lib/test/mock-services/MockedComponentSetService.js.map +1 -0
- package/lib/test/mock-services/MockedContentItemService.js +37 -0
- package/lib/test/mock-services/MockedContentItemService.js.map +1 -0
- package/lib/test-helpers.d.ts +16 -0
- package/lib/test-helpers.js +44 -0
- package/lib/test-helpers.js.map +1 -0
- package/lib/utils/getContentItemIdFromInput.js +13 -0
- package/lib/utils/getContentItemIdFromInput.js.map +1 -0
- package/lib/utils/getContentItemIdFromInput.spec.js +18 -0
- package/lib/utils/getContentItemIdFromInput.spec.js.map +1 -0
- package/lib/utils/resolvePreviewOutput.js +71 -0
- package/lib/utils/resolvePreviewOutput.js.map +1 -0
- package/lib/utils/resolvePreviewOutput.spec.js +168 -0
- package/lib/utils/resolvePreviewOutput.spec.js.map +1 -0
- package/lib/utils/setHeadersOnExpressResponse.js +15 -0
- package/lib/utils/setHeadersOnExpressResponse.js.map +1 -0
- package/lib/utils/setHeadersOnExpressResponse.sepc.js +21 -0
- package/lib/utils/setHeadersOnExpressResponse.sepc.js.map +1 -0
- package/lib/webserver/app.js +78 -0
- package/lib/webserver/app.js.map +1 -0
- package/lib/webserver/controllers/CoreController.js +116 -0
- package/lib/webserver/controllers/CoreController.js.map +1 -0
- package/lib/webserver/controllers/CoreController.spec.js +132 -0
- package/lib/webserver/controllers/CoreController.spec.js.map +1 -0
- package/lib/webserver/controllers/DefinitionController.js +162 -0
- package/lib/webserver/controllers/DefinitionController.js.map +1 -0
- package/lib/webserver/controllers/DefinitionController.spec.js +16 -0
- package/lib/webserver/controllers/DefinitionController.spec.js.map +1 -0
- package/lib/webserver/controllers/DevelopmentController.js +149 -0
- package/lib/webserver/controllers/DevelopmentController.js.map +1 -0
- package/lib/webserver/controllers/DevelopmentController.spec.js +29 -0
- package/lib/webserver/controllers/DevelopmentController.spec.js.map +1 -0
- package/lib/webserver/controllers/PreviewController.spec.js +124 -0
- package/lib/webserver/controllers/PreviewController.spec.js.map +1 -0
- package/lib/webserver/controllers/RenderController.d.ts +3 -2
- package/lib/webserver/controllers/RenderController.js +221 -0
- package/lib/webserver/controllers/RenderController.js.map +1 -0
- package/lib/webserver/controllers/RenderController.spec.js +441 -0
- package/lib/webserver/controllers/RenderController.spec.js.map +1 -0
- package/lib/webserver/controllers/StaticController.js +149 -0
- package/lib/webserver/controllers/StaticController.js.map +1 -0
- package/lib/webserver/controllers/StaticController.spec.js +28 -0
- package/lib/webserver/controllers/StaticController.spec.js.map +1 -0
- package/lib/webserver/controllers/test/definition-route-tests.js +627 -0
- package/lib/webserver/controllers/test/definition-route-tests.js.map +1 -0
- package/lib/webserver/controllers/test/development-route-tests.js +110 -0
- package/lib/webserver/controllers/test/development-route-tests.js.map +1 -0
- package/lib/webserver/controllers/test/preview-route-tests.js +122 -0
- package/lib/webserver/controllers/test/preview-route-tests.js.map +1 -0
- package/lib/webserver/controllers/test/render-route-sandbox-tests.js +194 -0
- package/lib/webserver/controllers/test/render-route-sandbox-tests.js.map +1 -0
- package/lib/webserver/controllers/test/render-route-tests.js +422 -0
- package/lib/webserver/controllers/test/render-route-tests.js.map +1 -0
- package/lib/webserver/controllers/test/static-route-tests.js +96 -0
- package/lib/webserver/controllers/test/static-route-tests.js.map +1 -0
- package/lib/webserver/index.js +6 -0
- package/lib/webserver/index.js.map +1 -0
- package/lib/webserver/routes/routes.js +902 -0
- package/lib/webserver/routes/routes.js.map +1 -0
- package/package.json +13 -6
- package/lib/migrations/20220704054051_initial.sql +0 -19
- package/lib/migrations/20220718172237_adding_component_sets.sql +0 -23
- package/lib/migrations/20220728113941_add_env_vars_field.sql +0 -1
- package/lib/migrations/20220817113300_removing_null_props_from_jsonb.sql +0 -41
- package/lib/migrations/20221027151225_dummy.sql +0 -2
- package/lib/migrations/20221117151200_add_detail_columns_to_component_version.js +0 -40
- package/lib/migrations/20221220151200_add_required_to_manifests.js +0 -7794
- package/lib/migrations/20221222151200_add_required_to_manifests.js +0 -7856
- package/lib/migrations/20223525103556_component_set_rule.sql +0 -19
- package/lib/migrations/20230111095522_update_environment_property.js +0 -7802
- package/lib/migrations/20230203084900_ensure_static_root_exists.js +0 -47
- package/lib/migrations/20230210143300_lowercase_all_uri_names.js +0 -88
- package/lib/migrations/20230217151212_component_set_component_version_updates.sql +0 -38
- package/lib/migrations/20230218121212_add_component_set_rules.js +0 -24
- package/lib/migrations/202406061447_edge_component_type.sql +0 -1
- package/lib/migrations/202407111308_component_version_type.sql +0 -1
- package/lib/migrations/202408061132_update_type_to_server.sql +0 -1
- package/lib/public/docs.json +0 -5509
- package/lib/worker/component-bootstrapper.js +0 -185979
- package/lib/worker/component-bootstrapper.js.map +0 -7
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MockedComponentSetServiceForProduction = void 0;
|
|
4
|
+
const component_lib_1 = require("@squiz/component-lib");
|
|
5
|
+
const test_helpers_1 = require("../../test-helpers");
|
|
6
|
+
class MockedComponentSetServiceForProduction extends component_lib_1.ComponentSetServiceForProduction {
|
|
7
|
+
constructor() {
|
|
8
|
+
super({
|
|
9
|
+
repositories: {
|
|
10
|
+
componentSet: {
|
|
11
|
+
findOne: async (query) => {
|
|
12
|
+
const set = await this.getComponentSetWebModel(query.webPath);
|
|
13
|
+
return {
|
|
14
|
+
webPath: set.webPath,
|
|
15
|
+
displayName: set.displayName,
|
|
16
|
+
description: set.description,
|
|
17
|
+
environmentVariables: set.environmentVariables,
|
|
18
|
+
headers: set.headers,
|
|
19
|
+
};
|
|
20
|
+
},
|
|
21
|
+
getComponentSetByWebPath: async (webPath) => {
|
|
22
|
+
const set = await this.getComponentSetWebModel(webPath.toLowerCase());
|
|
23
|
+
return {
|
|
24
|
+
webPath: set.webPath,
|
|
25
|
+
displayName: set.displayName,
|
|
26
|
+
description: set.description,
|
|
27
|
+
environmentVariables: set.environmentVariables,
|
|
28
|
+
headers: set.headers,
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
componentSetComponentVersion: {
|
|
33
|
+
findOne: async (query) => {
|
|
34
|
+
var _a;
|
|
35
|
+
const set = await this.getComponentSetWebModel(query.componentSetWebPath);
|
|
36
|
+
const setMembership = set.components[query.componentName].find((a) => a.version == query.componentVersion);
|
|
37
|
+
return { environmentVariables: (_a = setMembership === null || setMembership === void 0 ? void 0 : setMembership.environmentVariables) !== null && _a !== void 0 ? _a : {} };
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
}, test_helpers_1.TestHelpers.testLogger, new component_lib_1.ManifestServiceForProduction(process.env.DATA_MOUNT_POINT, test_helpers_1.TestHelpers.testLogger), {});
|
|
42
|
+
}
|
|
43
|
+
async getComponentSetWebModel(setName) {
|
|
44
|
+
const mockedCompSet = {
|
|
45
|
+
webPath: setName,
|
|
46
|
+
displayName: setName,
|
|
47
|
+
description: 'some-description',
|
|
48
|
+
environmentVariables: {
|
|
49
|
+
'some-var': 'some default value',
|
|
50
|
+
},
|
|
51
|
+
headers: {
|
|
52
|
+
'some-header-name-1': 'mocked-component-set-header-val-1',
|
|
53
|
+
'some-header-name-2': 'mocked-component-set-header-val-2',
|
|
54
|
+
},
|
|
55
|
+
components: {
|
|
56
|
+
'unit-test-components/test-environment-variables': [
|
|
57
|
+
{
|
|
58
|
+
version: '1.0.0',
|
|
59
|
+
environmentVariables: {},
|
|
60
|
+
displayName: setName,
|
|
61
|
+
description: 'some-description',
|
|
62
|
+
icon: undefined,
|
|
63
|
+
editable: true,
|
|
64
|
+
type: 'server',
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
'unit-test-components/test-malicious-code': [
|
|
68
|
+
{
|
|
69
|
+
version: '1.0.0',
|
|
70
|
+
environmentVariables: {},
|
|
71
|
+
displayName: setName,
|
|
72
|
+
description: 'some-description',
|
|
73
|
+
icon: undefined,
|
|
74
|
+
editable: true,
|
|
75
|
+
type: 'server',
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
version: '1.1.0',
|
|
79
|
+
environmentVariables: {},
|
|
80
|
+
displayName: setName,
|
|
81
|
+
description: 'some-description',
|
|
82
|
+
icon: undefined,
|
|
83
|
+
editable: true,
|
|
84
|
+
type: 'server',
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
version: '1.2.0',
|
|
88
|
+
environmentVariables: {},
|
|
89
|
+
displayName: setName,
|
|
90
|
+
description: 'some-description',
|
|
91
|
+
icon: undefined,
|
|
92
|
+
editable: true,
|
|
93
|
+
type: 'server',
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
version: '1.3.0',
|
|
97
|
+
environmentVariables: {},
|
|
98
|
+
displayName: setName,
|
|
99
|
+
description: 'some-description',
|
|
100
|
+
icon: undefined,
|
|
101
|
+
editable: true,
|
|
102
|
+
type: 'server',
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
'unit-test-components/test-static-files': [
|
|
106
|
+
{
|
|
107
|
+
version: '1.0.0',
|
|
108
|
+
environmentVariables: {},
|
|
109
|
+
displayName: setName,
|
|
110
|
+
description: 'some-description',
|
|
111
|
+
icon: undefined,
|
|
112
|
+
editable: true,
|
|
113
|
+
type: 'server',
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
version: '1.0.1',
|
|
117
|
+
environmentVariables: {},
|
|
118
|
+
displayName: setName,
|
|
119
|
+
description: 'some-description',
|
|
120
|
+
icon: undefined,
|
|
121
|
+
editable: true,
|
|
122
|
+
type: 'server',
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
version: '1.0.2',
|
|
126
|
+
environmentVariables: {},
|
|
127
|
+
displayName: setName,
|
|
128
|
+
description: 'some-description',
|
|
129
|
+
icon: undefined,
|
|
130
|
+
editable: true,
|
|
131
|
+
type: 'server',
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
version: '1.0.3',
|
|
135
|
+
environmentVariables: {},
|
|
136
|
+
displayName: setName,
|
|
137
|
+
description: 'some-description',
|
|
138
|
+
icon: undefined,
|
|
139
|
+
editable: true,
|
|
140
|
+
type: 'server',
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
version: '1.0.4',
|
|
144
|
+
environmentVariables: {},
|
|
145
|
+
displayName: setName,
|
|
146
|
+
description: 'some-description',
|
|
147
|
+
icon: undefined,
|
|
148
|
+
editable: true,
|
|
149
|
+
type: 'server',
|
|
150
|
+
},
|
|
151
|
+
],
|
|
152
|
+
'unit-test-components/test-component': [
|
|
153
|
+
{
|
|
154
|
+
version: '1.0.0',
|
|
155
|
+
environmentVariables: { 'some-var': 'test-component v1.0.0 value' },
|
|
156
|
+
displayName: setName,
|
|
157
|
+
description: 'some-description',
|
|
158
|
+
icon: undefined,
|
|
159
|
+
editable: true,
|
|
160
|
+
type: 'server',
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
version: '1.0.1',
|
|
164
|
+
environmentVariables: {},
|
|
165
|
+
displayName: setName,
|
|
166
|
+
description: 'some-description',
|
|
167
|
+
icon: undefined,
|
|
168
|
+
editable: true,
|
|
169
|
+
type: 'server',
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
version: '1.0.2',
|
|
173
|
+
environmentVariables: {},
|
|
174
|
+
displayName: setName,
|
|
175
|
+
description: 'some-description',
|
|
176
|
+
icon: undefined,
|
|
177
|
+
editable: true,
|
|
178
|
+
type: 'server',
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
version: '1.0.3',
|
|
182
|
+
environmentVariables: {},
|
|
183
|
+
displayName: setName,
|
|
184
|
+
description: 'some-description',
|
|
185
|
+
icon: undefined,
|
|
186
|
+
editable: true,
|
|
187
|
+
type: 'server',
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
version: '1.0.4',
|
|
191
|
+
environmentVariables: {},
|
|
192
|
+
displayName: setName,
|
|
193
|
+
description: 'some-description',
|
|
194
|
+
icon: undefined,
|
|
195
|
+
editable: true,
|
|
196
|
+
type: 'server',
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
version: '1.0.5',
|
|
200
|
+
environmentVariables: {},
|
|
201
|
+
displayName: setName,
|
|
202
|
+
description: 'some-description',
|
|
203
|
+
icon: undefined,
|
|
204
|
+
editable: true,
|
|
205
|
+
type: 'server',
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
version: '1.0.6',
|
|
209
|
+
environmentVariables: {},
|
|
210
|
+
displayName: setName,
|
|
211
|
+
description: 'some-description',
|
|
212
|
+
icon: undefined,
|
|
213
|
+
editable: true,
|
|
214
|
+
type: 'server',
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
version: '1.0.7',
|
|
218
|
+
environmentVariables: {},
|
|
219
|
+
displayName: setName,
|
|
220
|
+
description: 'some-description',
|
|
221
|
+
icon: undefined,
|
|
222
|
+
editable: true,
|
|
223
|
+
type: 'server',
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
version: '1.0.8',
|
|
227
|
+
environmentVariables: {},
|
|
228
|
+
displayName: setName,
|
|
229
|
+
description: 'some-description',
|
|
230
|
+
icon: undefined,
|
|
231
|
+
editable: true,
|
|
232
|
+
type: 'server',
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
version: '1.0.9',
|
|
236
|
+
environmentVariables: {},
|
|
237
|
+
displayName: setName,
|
|
238
|
+
description: 'some-description',
|
|
239
|
+
icon: undefined,
|
|
240
|
+
editable: true,
|
|
241
|
+
type: 'server',
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
version: '1.1.0',
|
|
245
|
+
environmentVariables: {},
|
|
246
|
+
displayName: setName,
|
|
247
|
+
description: 'some-description',
|
|
248
|
+
icon: undefined,
|
|
249
|
+
editable: true,
|
|
250
|
+
type: 'server',
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
version: '1.1.1',
|
|
254
|
+
environmentVariables: {},
|
|
255
|
+
displayName: setName,
|
|
256
|
+
description: 'some-description',
|
|
257
|
+
icon: undefined,
|
|
258
|
+
editable: true,
|
|
259
|
+
type: 'server',
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
version: '1.1.2',
|
|
263
|
+
environmentVariables: {},
|
|
264
|
+
displayName: setName,
|
|
265
|
+
description: 'some-description',
|
|
266
|
+
icon: undefined,
|
|
267
|
+
editable: true,
|
|
268
|
+
type: 'server',
|
|
269
|
+
},
|
|
270
|
+
],
|
|
271
|
+
'unit-test-components/test-component-query-parameters': [
|
|
272
|
+
{
|
|
273
|
+
version: '1.0.0',
|
|
274
|
+
environmentVariables: { 'some-var': 'test-component-query-parameters v1.0.0 value' },
|
|
275
|
+
displayName: setName,
|
|
276
|
+
description: 'some-description',
|
|
277
|
+
icon: undefined,
|
|
278
|
+
editable: true,
|
|
279
|
+
type: 'server',
|
|
280
|
+
},
|
|
281
|
+
],
|
|
282
|
+
'unit-test-components/test-npm-modules': [
|
|
283
|
+
{
|
|
284
|
+
version: '1.0.0',
|
|
285
|
+
environmentVariables: {},
|
|
286
|
+
displayName: setName,
|
|
287
|
+
description: 'some-description',
|
|
288
|
+
icon: undefined,
|
|
289
|
+
editable: true,
|
|
290
|
+
type: 'server',
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
version: '2.0.0',
|
|
294
|
+
environmentVariables: {},
|
|
295
|
+
displayName: setName,
|
|
296
|
+
description: 'some-description',
|
|
297
|
+
icon: undefined,
|
|
298
|
+
editable: true,
|
|
299
|
+
type: 'server',
|
|
300
|
+
},
|
|
301
|
+
],
|
|
302
|
+
'unit-test-components/test-headers': [
|
|
303
|
+
{
|
|
304
|
+
version: '1.0.0',
|
|
305
|
+
environmentVariables: {},
|
|
306
|
+
displayName: setName,
|
|
307
|
+
description: 'some-description',
|
|
308
|
+
icon: undefined,
|
|
309
|
+
editable: true,
|
|
310
|
+
type: 'server',
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
version: '1.0.1',
|
|
314
|
+
environmentVariables: {},
|
|
315
|
+
displayName: setName,
|
|
316
|
+
description: 'some-description',
|
|
317
|
+
icon: undefined,
|
|
318
|
+
editable: true,
|
|
319
|
+
type: 'server',
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
version: '1.0.2',
|
|
323
|
+
environmentVariables: {},
|
|
324
|
+
displayName: setName,
|
|
325
|
+
description: 'some-description',
|
|
326
|
+
icon: undefined,
|
|
327
|
+
editable: true,
|
|
328
|
+
type: 'server',
|
|
329
|
+
},
|
|
330
|
+
],
|
|
331
|
+
'unit-test-components/test-preview-component': [
|
|
332
|
+
{
|
|
333
|
+
version: '1.1.0',
|
|
334
|
+
environmentVariables: {},
|
|
335
|
+
displayName: setName,
|
|
336
|
+
description: 'some-description',
|
|
337
|
+
icon: undefined,
|
|
338
|
+
editable: true,
|
|
339
|
+
type: 'server',
|
|
340
|
+
},
|
|
341
|
+
],
|
|
342
|
+
'unit-test-components/test-formatted-text': [
|
|
343
|
+
{
|
|
344
|
+
version: '2.0.0',
|
|
345
|
+
environmentVariables: {},
|
|
346
|
+
displayName: setName,
|
|
347
|
+
description: 'some-description',
|
|
348
|
+
icon: undefined,
|
|
349
|
+
editable: true,
|
|
350
|
+
type: 'server',
|
|
351
|
+
},
|
|
352
|
+
],
|
|
353
|
+
},
|
|
354
|
+
componentVersionRules: {},
|
|
355
|
+
};
|
|
356
|
+
if (setName === 'component-overrides-env-var') {
|
|
357
|
+
mockedCompSet.environmentVariables['TEST_VARIABLE'] = 'top level';
|
|
358
|
+
mockedCompSet.components = {
|
|
359
|
+
'unit-test-components/test-environment-variables': [
|
|
360
|
+
{
|
|
361
|
+
version: '1.0.0',
|
|
362
|
+
environmentVariables: { TEST_VARIABLE: 'TEST_VARIABLE overriding' },
|
|
363
|
+
displayName: setName,
|
|
364
|
+
description: 'some-description',
|
|
365
|
+
icon: undefined,
|
|
366
|
+
editable: true,
|
|
367
|
+
type: 'server',
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
version: '1.0.2',
|
|
371
|
+
environmentVariables: { TEST_VARIABLE: 'a different value' },
|
|
372
|
+
displayName: setName,
|
|
373
|
+
description: 'some-description',
|
|
374
|
+
icon: undefined,
|
|
375
|
+
editable: true,
|
|
376
|
+
type: 'server',
|
|
377
|
+
},
|
|
378
|
+
],
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
else if (setName === 'only-toplevel-environment-variables') {
|
|
382
|
+
mockedCompSet.environmentVariables['TEST_VARIABLE'] = 'top level';
|
|
383
|
+
mockedCompSet.components = {
|
|
384
|
+
'unit-test-components/test-environment-variables': [
|
|
385
|
+
{
|
|
386
|
+
version: '1.0.0',
|
|
387
|
+
environmentVariables: {},
|
|
388
|
+
displayName: setName,
|
|
389
|
+
description: 'some-description',
|
|
390
|
+
icon: undefined,
|
|
391
|
+
editable: true,
|
|
392
|
+
type: 'server',
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
version: '1.0.1',
|
|
396
|
+
environmentVariables: {},
|
|
397
|
+
displayName: setName,
|
|
398
|
+
description: 'some-description',
|
|
399
|
+
icon: undefined,
|
|
400
|
+
editable: true,
|
|
401
|
+
type: 'server',
|
|
402
|
+
},
|
|
403
|
+
],
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
return mockedCompSet;
|
|
407
|
+
}
|
|
408
|
+
async componentVersionInSet(_, __) {
|
|
409
|
+
return true;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
exports.MockedComponentSetServiceForProduction = MockedComponentSetServiceForProduction;
|
|
413
|
+
//# sourceMappingURL=MockedComponentSetService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":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f;oBAED;wBACE,OAAO,EAAE,OAAO;wBAChB,oBAAoB,EAAE,EAAE,aAAa,EAAE,mBAAmB,EAAE;wBAC5D,WAAW,EAAE,OAAO;wBACpB,WAAW,EAAE,kBAAkB;wBAC/B,IAAI,EAAE,SAAS;wBACf,QAAQ,EAAE,IAAI;wBACd,IAAI,EAAE,QAAQ;qBACf;iBACF;aACF,CAAC;SACH;aAAM,IAAI,OAAO,KAAK,qCAAqC,EAAE;YAC5D,aAAa,CAAC,oBAAqB,CAAC,eAAe,CAAC,GAAG,WAAW,CAAC;YACnE,aAAa,CAAC,UAAU,GAAG;gBACzB,iDAAiD,EAAE;oBACjD;wBACE,OAAO,EAAE,OAAO;wBAChB,oBAAoB,EAAE,EAAE;wBACxB,WAAW,EAAE,OAAO;wBACpB,WAAW,EAAE,kBAAkB;wBAC/B,IAAI,EAAE,SAAS;wBACf,QAAQ,EAAE,IAAI;wBACd,IAAI,EAAE,QAAQ;qBACf;oBACD;wBACE,OAAO,EAAE,OAAO;wBAChB,oBAAoB,EAAE,EAAE;wBACxB,WAAW,EAAE,OAAO;wBACpB,WAAW,EAAE,kBAAkB;wBAC/B,IAAI,EAAE,SAAS;wBACf,QAAQ,EAAE,IAAI;wBACd,IAAI,EAAE,QAAQ;qBACf;iBACF;aACF,CAAC;SACH;QAED,OAAO,aAAa,CAAC;IACvB,CAAC;IAEM,KAAK,CAAC,qBAAqB,CAAC,CAAW,EAAE,EAAU;QACxD,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAvaD,wFAuaC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MockedContentItemService = void 0;
|
|
4
|
+
const component_lib_1 = require("@squiz/component-lib");
|
|
5
|
+
class MockedContentItemService extends component_lib_1.ContentItemService {
|
|
6
|
+
async getContentItem(contentItemId) {
|
|
7
|
+
// emulate different scenarios based on contentItemId value
|
|
8
|
+
switch (contentItemId) {
|
|
9
|
+
case 'valid-id':
|
|
10
|
+
return { something: 'input-from-content-item-service' };
|
|
11
|
+
case 'invalid-id':
|
|
12
|
+
return { somethingElse: 'this-will-fail-schema-validation' };
|
|
13
|
+
case 'formatted-text-content-item':
|
|
14
|
+
return {
|
|
15
|
+
formattedText: [
|
|
16
|
+
{
|
|
17
|
+
type: 'tag',
|
|
18
|
+
tag: 'p',
|
|
19
|
+
children: [
|
|
20
|
+
{
|
|
21
|
+
type: 'text',
|
|
22
|
+
value: 'This is a paragraph',
|
|
23
|
+
},
|
|
24
|
+
{ type: 'tag', tag: 'span', children: [{ type: 'text', value: ' with a span' }] },
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
};
|
|
29
|
+
case 'call-fails-id':
|
|
30
|
+
throw Error('Call failed!!!');
|
|
31
|
+
case 'non-existent-id':
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.MockedContentItemService = MockedContentItemService;
|
|
37
|
+
//# sourceMappingURL=MockedContentItemService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MockedContentItemService.js","sourceRoot":"","sources":["../../../src/test/mock-services/MockedContentItemService.ts"],"names":[],"mappings":";;;AAAA,wDAA0D;AAC1D,MAAa,wBAAyB,SAAQ,kCAAkB;IAC9D,KAAK,CAAC,cAAc,CAAC,aAAqB;QACxC,2DAA2D;QAC3D,QAAQ,aAAa,EAAE;YACrB,KAAK,UAAU;gBACb,OAAO,EAAE,SAAS,EAAE,iCAAiC,EAAE,CAAC;YAC1D,KAAK,YAAY;gBACf,OAAO,EAAE,aAAa,EAAE,kCAAkC,EAAE,CAAC;YAC/D,KAAK,6BAA6B;gBAChC,OAAO;oBACL,aAAa,EAAE;wBACb;4BACE,IAAI,EAAE,KAAK;4BACX,GAAG,EAAE,GAAG;4BACR,QAAQ,EAAE;gCACR;oCACE,IAAI,EAAE,MAAM;oCACZ,KAAK,EAAE,qBAAqB;iCAC7B;gCACD,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC,EAAE;6BAClF;yBACF;qBACF;iBACF,CAAC;YACJ,KAAK,eAAe;gBAClB,MAAM,KAAK,CAAC,gBAAgB,CAAC,CAAC;YAChC,KAAK,iBAAiB;gBACpB,OAAO,IAAI,CAAC;SACf;IACH,CAAC;CACF;AA9BD,4DA8BC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as TestHelpers from './test';
|
|
2
|
+
import { definitionRouteTests } from './webserver/controllers/test/definition-route-tests';
|
|
3
|
+
import { developmentRouteTests } from './webserver/controllers/test/development-route-tests';
|
|
4
|
+
import { staticRouteTests } from './webserver/controllers/test/static-route-tests';
|
|
5
|
+
import { renderRouteTests } from './webserver/controllers/test/render-route-tests';
|
|
6
|
+
import { renderRouteSandboxTests } from './webserver/controllers/test/render-route-sandbox-tests';
|
|
7
|
+
import { previewRouteTests } from './webserver/controllers/test/preview-route-tests';
|
|
8
|
+
declare const routeTests: {
|
|
9
|
+
definition: typeof definitionRouteTests;
|
|
10
|
+
static: typeof staticRouteTests;
|
|
11
|
+
render: typeof renderRouteTests;
|
|
12
|
+
renderSandbox: typeof renderRouteSandboxTests;
|
|
13
|
+
preview: typeof previewRouteTests;
|
|
14
|
+
development: typeof developmentRouteTests;
|
|
15
|
+
};
|
|
16
|
+
export { TestHelpers, routeTests };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.routeTests = exports.TestHelpers = void 0;
|
|
27
|
+
const TestHelpers = __importStar(require("./test"));
|
|
28
|
+
exports.TestHelpers = TestHelpers;
|
|
29
|
+
const definition_route_tests_1 = require("./webserver/controllers/test/definition-route-tests");
|
|
30
|
+
const development_route_tests_1 = require("./webserver/controllers/test/development-route-tests");
|
|
31
|
+
const static_route_tests_1 = require("./webserver/controllers/test/static-route-tests");
|
|
32
|
+
const render_route_tests_1 = require("./webserver/controllers/test/render-route-tests");
|
|
33
|
+
const render_route_sandbox_tests_1 = require("./webserver/controllers/test/render-route-sandbox-tests");
|
|
34
|
+
const preview_route_tests_1 = require("./webserver/controllers/test/preview-route-tests");
|
|
35
|
+
const routeTests = {
|
|
36
|
+
definition: definition_route_tests_1.definitionRouteTests,
|
|
37
|
+
static: static_route_tests_1.staticRouteTests,
|
|
38
|
+
render: render_route_tests_1.renderRouteTests,
|
|
39
|
+
renderSandbox: render_route_sandbox_tests_1.renderRouteSandboxTests,
|
|
40
|
+
preview: preview_route_tests_1.previewRouteTests,
|
|
41
|
+
development: development_route_tests_1.developmentRouteTests,
|
|
42
|
+
};
|
|
43
|
+
exports.routeTests = routeTests;
|
|
44
|
+
//# sourceMappingURL=test-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-helpers.js","sourceRoot":"","sources":["../src/test-helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAgB7B,kCAAW;AAfpB,gGAA2F;AAC3F,kGAA6F;AAC7F,wFAAmF;AACnF,wFAAmF;AACnF,wGAAkG;AAClG,0FAAqF;AACrF,MAAM,UAAU,GAAG;IACjB,UAAU,EAAE,6CAAoB;IAChC,MAAM,EAAE,qCAAgB;IACxB,MAAM,EAAE,qCAAgB;IACxB,aAAa,EAAE,oDAAuB;IACtC,OAAO,EAAE,uCAAiB;IAC1B,WAAW,EAAE,+CAAqB;CACnC,CAAC;AAEoB,gCAAU"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getContentItemIdFromInput = exports.QUERY_PARAM_CONTENT_ITEM_ID = void 0;
|
|
4
|
+
exports.QUERY_PARAM_CONTENT_ITEM_ID = '_contentItemId';
|
|
5
|
+
function getContentItemIdFromInput(input) {
|
|
6
|
+
const queryParams = input;
|
|
7
|
+
if (exports.QUERY_PARAM_CONTENT_ITEM_ID in queryParams) {
|
|
8
|
+
return queryParams[exports.QUERY_PARAM_CONTENT_ITEM_ID];
|
|
9
|
+
}
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
exports.getContentItemIdFromInput = getContentItemIdFromInput;
|
|
13
|
+
//# sourceMappingURL=getContentItemIdFromInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getContentItemIdFromInput.js","sourceRoot":"","sources":["../../src/utils/getContentItemIdFromInput.ts"],"names":[],"mappings":";;;AACa,QAAA,2BAA2B,GAAG,gBAAgB,CAAC;AAE5D,SAAgB,yBAAyB,CAAC,KAAc;IACtD,MAAM,WAAW,GAAG,KAAgC,CAAC;IACrD,IAAI,mCAA2B,IAAI,WAAW,EAAE;QAC9C,OAAO,WAAW,CAAC,mCAA2B,CAAkB,CAAC;KAClE;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAND,8DAMC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const getContentItemIdFromInput_1 = require("./getContentItemIdFromInput");
|
|
4
|
+
describe('getContentItemIdFromInput', () => {
|
|
5
|
+
it('should return content item ID if present in the input ', () => {
|
|
6
|
+
const input = {
|
|
7
|
+
_contentItemId: 'some-id',
|
|
8
|
+
};
|
|
9
|
+
expect((0, getContentItemIdFromInput_1.getContentItemIdFromInput)(input)).toEqual('some-id');
|
|
10
|
+
});
|
|
11
|
+
it('should return null if content item ID not present in the input', () => {
|
|
12
|
+
const input = {
|
|
13
|
+
_someThingElse: 'some-id',
|
|
14
|
+
};
|
|
15
|
+
expect((0, getContentItemIdFromInput_1.getContentItemIdFromInput)(input)).toEqual(null);
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
//# sourceMappingURL=getContentItemIdFromInput.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getContentItemIdFromInput.spec.js","sourceRoot":"","sources":["../../src/utils/getContentItemIdFromInput.spec.ts"],"names":[],"mappings":";;AAAA,2EAAwE;AAExE,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACzC,EAAE,CAAC,wDAAwD,EAAE,GAAG,EAAE;QAChE,MAAM,KAAK,GAAG;YACZ,cAAc,EAAE,SAAS;SAC1B,CAAC;QACF,MAAM,CAAC,IAAA,qDAAyB,EAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gEAAgE,EAAE,GAAG,EAAE;QACxE,MAAM,KAAK,GAAG;YACZ,cAAc,EAAE,SAAS;SAC1B,CAAC;QACF,MAAM,CAAC,IAAA,qDAAyB,EAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolvePreviewOutput = void 0;
|
|
4
|
+
function resolvePreviewOutput(html, componentOutput, files = []) {
|
|
5
|
+
// component output keyword - [component://output]
|
|
6
|
+
const reComponentOutput = new RegExp('\\[component:\\/\\/output\\]', 'g');
|
|
7
|
+
// component header includes keyword - [component://static-header]
|
|
8
|
+
const reComponentHeader = new RegExp('\\[component:\\/\\/static\\-header\\]', 'g');
|
|
9
|
+
// component header includes keyword - [component://static-footer]
|
|
10
|
+
const reComponentFooter = new RegExp('\\[component:\\/\\/static\\-footer\\]', 'g');
|
|
11
|
+
return html
|
|
12
|
+
.replace(reComponentHeader, escapeReplacementChars(getLibFileTagsHtml(files, 'header')))
|
|
13
|
+
.replace(reComponentFooter, escapeReplacementChars(getLibFileTagsHtml(files, 'footer')))
|
|
14
|
+
.replace(reComponentOutput, escapeReplacementChars(componentOutput));
|
|
15
|
+
}
|
|
16
|
+
exports.resolvePreviewOutput = resolvePreviewOutput;
|
|
17
|
+
function escapeReplacementChars(str) {
|
|
18
|
+
// "$" char has special meaning in the replacement
|
|
19
|
+
return str.replace(new RegExp('\\$', 'g'), '$$$$');
|
|
20
|
+
}
|
|
21
|
+
function getLibFileTagsHtml(files, type) {
|
|
22
|
+
const jsIncludes = [];
|
|
23
|
+
const cssIncludes = [];
|
|
24
|
+
files.forEach((info) => {
|
|
25
|
+
if (info.location === type) {
|
|
26
|
+
const file = info.file;
|
|
27
|
+
if (file.type === 'js') {
|
|
28
|
+
jsIncludes.push(jsIncludeTagHtml(file));
|
|
29
|
+
}
|
|
30
|
+
else if (file.type === 'css') {
|
|
31
|
+
cssIncludes.push(cssIncludeTagHtml(file));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
return [...cssIncludes, ...jsIncludes].join('\n');
|
|
36
|
+
}
|
|
37
|
+
function jsIncludeTagHtml(file) {
|
|
38
|
+
const tagParts = [];
|
|
39
|
+
tagParts.push(`src="${file.filepath}"`);
|
|
40
|
+
if (file.async) {
|
|
41
|
+
tagParts.push(`async`);
|
|
42
|
+
}
|
|
43
|
+
if (file.defer) {
|
|
44
|
+
tagParts.push(`defer`);
|
|
45
|
+
}
|
|
46
|
+
if (file.module !== undefined) {
|
|
47
|
+
tagParts.push(`type="${file.module}"`);
|
|
48
|
+
}
|
|
49
|
+
if (file.integrity !== undefined) {
|
|
50
|
+
tagParts.push(`integrity="${file.integrity}"`);
|
|
51
|
+
}
|
|
52
|
+
if (file.referrerpolicy !== undefined) {
|
|
53
|
+
tagParts.push(`referrerpolicy="${file.referrerpolicy}"`);
|
|
54
|
+
}
|
|
55
|
+
if (file.crossorigin !== undefined) {
|
|
56
|
+
tagParts.push(`crossorigin="${file.crossorigin}"`);
|
|
57
|
+
}
|
|
58
|
+
return `<script ${tagParts.join(' ')}></script>`;
|
|
59
|
+
}
|
|
60
|
+
function cssIncludeTagHtml(file) {
|
|
61
|
+
const tagParts = [];
|
|
62
|
+
tagParts.push(`href="${file.filepath}"`);
|
|
63
|
+
if (file.referrerpolicy !== undefined) {
|
|
64
|
+
tagParts.push(`referrerpolicy="${file.referrerpolicy}"`);
|
|
65
|
+
}
|
|
66
|
+
if (file.crossorigin !== undefined) {
|
|
67
|
+
tagParts.push(`crossorigin="${file.crossorigin}"`);
|
|
68
|
+
}
|
|
69
|
+
return `<link rel="stylesheet" ${tagParts.join(' ')}>`;
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=resolvePreviewOutput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolvePreviewOutput.js","sourceRoot":"","sources":["../../src/utils/resolvePreviewOutput.ts"],"names":[],"mappings":";;;AAMA,SAAgB,oBAAoB,CAAC,IAAY,EAAE,eAAuB,EAAE,QAA0B,EAAE;IACtG,kDAAkD;IAClD,MAAM,iBAAiB,GAAG,IAAI,MAAM,CAAC,8BAA8B,EAAE,GAAG,CAAC,CAAC;IAC1E,kEAAkE;IAClE,MAAM,iBAAiB,GAAG,IAAI,MAAM,CAAC,uCAAuC,EAAE,GAAG,CAAC,CAAC;IACnF,kEAAkE;IAClE,MAAM,iBAAiB,GAAG,IAAI,MAAM,CAAC,uCAAuC,EAAE,GAAG,CAAC,CAAC;IAEnF,OAAO,IAAI;SACR,OAAO,CAAC,iBAAiB,EAAE,sBAAsB,CAAC,kBAAkB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;SACvF,OAAO,CAAC,iBAAiB,EAAE,sBAAsB,CAAC,kBAAkB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;SACvF,OAAO,CAAC,iBAAiB,EAAE,sBAAsB,CAAC,eAAe,CAAC,CAAC,CAAC;AACzE,CAAC;AAZD,oDAYC;AAED,SAAS,sBAAsB,CAAC,GAAW;IACzC,kDAAkD;IAClD,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;AACrD,CAAC;AAED,SAAS,kBAAkB,CAAC,KAAuB,EAAE,IAAgC;IACnF,MAAM,UAAU,GAAa,EAAE,CAAC;IAChC,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACrB,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,EAAE;YAC1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