@appsemble/utils 0.27.9 → 0.27.10
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 +3 -3
- package/api/components/parameters/index.d.ts +1 -0
- package/api/components/parameters/index.js +1 -0
- package/api/components/parameters/readmeId.d.ts +2 -0
- package/api/components/parameters/readmeId.js +8 -0
- package/api/components/parameters/screenshotId.js +1 -1
- package/api/paths/appCollections.js +8 -0
- package/api/paths/apps.js +44 -6
- package/package.json +2 -2
- package/validation.test.js +52 -0
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#  Appsemble Utilities
|
|
2
2
|
|
|
3
3
|
> Internal utility functions used across multiple Appsemble projects.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@appsemble/utils)
|
|
6
|
-
[](https://gitlab.com/appsemble/appsemble/-/releases/0.27.10)
|
|
7
7
|
[](https://prettier.io)
|
|
8
8
|
|
|
9
9
|
## Table of Contents
|
|
@@ -26,5 +26,5 @@ not guaranteed.
|
|
|
26
26
|
|
|
27
27
|
## License
|
|
28
28
|
|
|
29
|
-
[LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.27.
|
|
29
|
+
[LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.27.10/LICENSE.md) ©
|
|
30
30
|
[Appsemble](https://appsemble.com)
|
|
@@ -15,6 +15,7 @@ export * from './organizationId.js';
|
|
|
15
15
|
export * from './resourceId.js';
|
|
16
16
|
export * from './resourceType.js';
|
|
17
17
|
export * from './screenshotId.js';
|
|
18
|
+
export * from './readmeId.js';
|
|
18
19
|
export * from './appServiceId.js';
|
|
19
20
|
export * from './view.js';
|
|
20
21
|
export * from './trainingId.js';
|
|
@@ -15,6 +15,7 @@ export * from './organizationId.js';
|
|
|
15
15
|
export * from './resourceId.js';
|
|
16
16
|
export * from './resourceType.js';
|
|
17
17
|
export * from './screenshotId.js';
|
|
18
|
+
export * from './readmeId.js';
|
|
18
19
|
export * from './appServiceId.js';
|
|
19
20
|
export * from './view.js';
|
|
20
21
|
export * from './trainingId.js';
|
|
@@ -283,6 +283,14 @@ export const paths = {
|
|
|
283
283
|
$ref: '#/components/schemas/AppCollection/properties/id',
|
|
284
284
|
},
|
|
285
285
|
},
|
|
286
|
+
{
|
|
287
|
+
name: 'language',
|
|
288
|
+
in: 'query',
|
|
289
|
+
description: 'The language to include the translations of, if available',
|
|
290
|
+
schema: {
|
|
291
|
+
type: 'string',
|
|
292
|
+
},
|
|
293
|
+
},
|
|
286
294
|
],
|
|
287
295
|
responses: {
|
|
288
296
|
200: {
|
package/api/paths/apps.js
CHANGED
|
@@ -35,9 +35,6 @@ export const paths = {
|
|
|
35
35
|
demoMode: {
|
|
36
36
|
$ref: '#/components/schemas/App/properties/demoMode',
|
|
37
37
|
},
|
|
38
|
-
longDescription: {
|
|
39
|
-
$ref: '#/components/schemas/App/properties/longDescription',
|
|
40
|
-
},
|
|
41
38
|
yaml: {
|
|
42
39
|
type: 'string',
|
|
43
40
|
description: 'The original YAML definition used to define the app.',
|
|
@@ -76,6 +73,14 @@ export const paths = {
|
|
|
76
73
|
format: 'binary',
|
|
77
74
|
},
|
|
78
75
|
},
|
|
76
|
+
readmes: {
|
|
77
|
+
type: 'array',
|
|
78
|
+
description: 'Readmes to showcase in the store',
|
|
79
|
+
items: {
|
|
80
|
+
type: 'string',
|
|
81
|
+
format: 'binary',
|
|
82
|
+
},
|
|
83
|
+
},
|
|
79
84
|
controllerCode: {
|
|
80
85
|
type: 'string',
|
|
81
86
|
description: 'Custom app logic as a JavaScript string',
|
|
@@ -184,9 +189,6 @@ export const paths = {
|
|
|
184
189
|
demoMode: {
|
|
185
190
|
$ref: '#/components/schemas/App/properties/demoMode',
|
|
186
191
|
},
|
|
187
|
-
longDescription: {
|
|
188
|
-
$ref: '#/components/schemas/App/properties/longDescription',
|
|
189
|
-
},
|
|
190
192
|
force: {
|
|
191
193
|
type: 'boolean',
|
|
192
194
|
description: 'Whether the locked property should be ignored.',
|
|
@@ -225,6 +227,14 @@ export const paths = {
|
|
|
225
227
|
format: 'binary',
|
|
226
228
|
},
|
|
227
229
|
},
|
|
230
|
+
readmes: {
|
|
231
|
+
type: 'array',
|
|
232
|
+
description: 'Readmes to showcase in the store',
|
|
233
|
+
items: {
|
|
234
|
+
type: 'string',
|
|
235
|
+
format: 'binary',
|
|
236
|
+
},
|
|
237
|
+
},
|
|
228
238
|
controllerCode: {
|
|
229
239
|
type: 'string',
|
|
230
240
|
description: 'Custom app logic as a JavaScript string',
|
|
@@ -345,6 +355,18 @@ export const paths = {
|
|
|
345
355
|
description: 'Whether to include assets in the export file',
|
|
346
356
|
in: 'query',
|
|
347
357
|
},
|
|
358
|
+
{
|
|
359
|
+
name: 'screenshots',
|
|
360
|
+
schema: { type: 'boolean' },
|
|
361
|
+
description: 'Whether to include screenshots in the export file',
|
|
362
|
+
in: 'query',
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
name: 'readmes',
|
|
366
|
+
schema: { type: 'boolean' },
|
|
367
|
+
description: 'Whether to include readmes in the export file',
|
|
368
|
+
in: 'query',
|
|
369
|
+
},
|
|
348
370
|
],
|
|
349
371
|
responses: {
|
|
350
372
|
200: {
|
|
@@ -984,6 +1006,22 @@ This will return a 404 if the user has not uploaded one.`,
|
|
|
984
1006
|
security: [{ studio: [] }, { cli: ['apps:write'] }],
|
|
985
1007
|
},
|
|
986
1008
|
},
|
|
1009
|
+
'/api/apps/{appId}/readmes/{readmeId}': {
|
|
1010
|
+
parameters: [
|
|
1011
|
+
{ $ref: '#/components/parameters/appId' },
|
|
1012
|
+
{ $ref: '#/components/parameters/readmeId' },
|
|
1013
|
+
],
|
|
1014
|
+
get: {
|
|
1015
|
+
tags: ['app'],
|
|
1016
|
+
description: 'Get a readme of an app.',
|
|
1017
|
+
operationId: 'getAppReadme',
|
|
1018
|
+
responses: {
|
|
1019
|
+
200: {
|
|
1020
|
+
description: 'The app readme',
|
|
1021
|
+
},
|
|
1022
|
+
},
|
|
1023
|
+
},
|
|
1024
|
+
},
|
|
987
1025
|
'/api/apps/{appId}/style/core': {
|
|
988
1026
|
parameters: [{ $ref: '#/components/parameters/appId' }],
|
|
989
1027
|
get: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appsemble/utils",
|
|
3
|
-
"version": "0.27.
|
|
3
|
+
"version": "0.27.10",
|
|
4
4
|
"description": "Utility functions used in Appsemble internally",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"app",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"test": "vitest"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@appsemble/types": "0.27.
|
|
40
|
+
"@appsemble/types": "0.27.10",
|
|
41
41
|
"axios": "^1.0.0",
|
|
42
42
|
"cron-parser": "^4.0.0",
|
|
43
43
|
"date-fns": "^2.0.0",
|
package/validation.test.js
CHANGED
|
@@ -1581,6 +1581,58 @@ describe('validateAppDefinition', () => {
|
|
|
1581
1581
|
]),
|
|
1582
1582
|
]);
|
|
1583
1583
|
});
|
|
1584
|
+
it('should be valid if to is (remapper) object; considered as dynamic link', async () => {
|
|
1585
|
+
const app = createTestApp();
|
|
1586
|
+
app.pages[0].blocks.push({
|
|
1587
|
+
type: 'test',
|
|
1588
|
+
version: '1.2.3',
|
|
1589
|
+
actions: {
|
|
1590
|
+
onWhatever: {
|
|
1591
|
+
type: 'link',
|
|
1592
|
+
to: { static: 'test' },
|
|
1593
|
+
},
|
|
1594
|
+
},
|
|
1595
|
+
});
|
|
1596
|
+
const result = await validateAppDefinition(app, () => [
|
|
1597
|
+
{
|
|
1598
|
+
name: '@appsemble/test',
|
|
1599
|
+
version: '1.2.3',
|
|
1600
|
+
files: [],
|
|
1601
|
+
languages: [],
|
|
1602
|
+
actions: {
|
|
1603
|
+
onWhatever: {},
|
|
1604
|
+
},
|
|
1605
|
+
},
|
|
1606
|
+
]);
|
|
1607
|
+
expect(result.valid).toBe(true);
|
|
1608
|
+
expect(result.errors).toStrictEqual([]);
|
|
1609
|
+
});
|
|
1610
|
+
it('should be valid if to is array of (remapper) objects; considered as dynamic link', async () => {
|
|
1611
|
+
const app = createTestApp();
|
|
1612
|
+
app.pages[0].blocks.push({
|
|
1613
|
+
type: 'test',
|
|
1614
|
+
version: '1.2.3',
|
|
1615
|
+
actions: {
|
|
1616
|
+
onWhatever: {
|
|
1617
|
+
type: 'link',
|
|
1618
|
+
to: [{ static: 'test' }],
|
|
1619
|
+
},
|
|
1620
|
+
},
|
|
1621
|
+
});
|
|
1622
|
+
const result = await validateAppDefinition(app, () => [
|
|
1623
|
+
{
|
|
1624
|
+
name: '@appsemble/test',
|
|
1625
|
+
version: '1.2.3',
|
|
1626
|
+
files: [],
|
|
1627
|
+
languages: [],
|
|
1628
|
+
actions: {
|
|
1629
|
+
onWhatever: {},
|
|
1630
|
+
},
|
|
1631
|
+
},
|
|
1632
|
+
]);
|
|
1633
|
+
expect(result.valid).toBe(true);
|
|
1634
|
+
expect(result.errors).toStrictEqual([]);
|
|
1635
|
+
});
|
|
1584
1636
|
it('should report an error if user actions are used without a security definition', async () => {
|
|
1585
1637
|
const { security, ...app } = createTestApp();
|
|
1586
1638
|
app.pages[0].blocks.push({
|