@appsemble/utils 0.27.9 → 0.27.11

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 CHANGED
@@ -1,9 +1,9 @@
1
- # ![](https://gitlab.com/appsemble/appsemble/-/raw/0.27.9/config/assets/logo.svg) Appsemble Utilities
1
+ # ![](https://gitlab.com/appsemble/appsemble/-/raw/0.27.11/config/assets/logo.svg) Appsemble Utilities
2
2
 
3
3
  > Internal utility functions used across multiple Appsemble projects.
4
4
 
5
5
  [![npm](https://img.shields.io/npm/v/@appsemble/utils)](https://www.npmjs.com/package/@appsemble/utils)
6
- [![GitLab CI](https://gitlab.com/appsemble/appsemble/badges/0.27.9/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.27.9)
6
+ [![GitLab CI](https://gitlab.com/appsemble/appsemble/badges/0.27.11/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.27.11)
7
7
  [![Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](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.9/LICENSE.md) ©
29
+ [LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.27.11/LICENSE.md) ©
30
30
  [Appsemble](https://appsemble.com)
@@ -0,0 +1,2 @@
1
+ import { type OpenAPIV3 } from 'openapi-types';
2
+ export declare const $skip: OpenAPIV3.ParameterObject;
@@ -0,0 +1,7 @@
1
+ export const $skip = {
2
+ name: '$skip',
3
+ in: 'query',
4
+ description: 'Start the query from an offset.',
5
+ schema: { type: 'integer', minimum: 0 },
6
+ };
7
+ //# sourceMappingURL=$skip.js.map
@@ -2,7 +2,6 @@ export const $top = {
2
2
  name: '$top',
3
3
  in: 'query',
4
4
  description: 'Limit the number of entities returned.',
5
- // XXX The type should be integer. This doesn’t work due to an upstream bug in Koas.
6
- schema: { type: 'string' },
5
+ schema: { type: 'integer', minimum: 0 },
7
6
  };
8
7
  //# sourceMappingURL=$top.js.map
@@ -3,6 +3,7 @@ export * from './$orderby.js';
3
3
  export * from './$select.js';
4
4
  export * from './$team.js';
5
5
  export * from './$top.js';
6
+ export * from './$skip.js';
6
7
  export * from './appId.js';
7
8
  export * from './appOAuth2SecretId.js';
8
9
  export * from './appSamlSecretId.js';
@@ -15,6 +16,7 @@ export * from './organizationId.js';
15
16
  export * from './resourceId.js';
16
17
  export * from './resourceType.js';
17
18
  export * from './screenshotId.js';
19
+ export * from './readmeId.js';
18
20
  export * from './appServiceId.js';
19
21
  export * from './view.js';
20
22
  export * from './trainingId.js';
@@ -3,6 +3,7 @@ export * from './$orderby.js';
3
3
  export * from './$select.js';
4
4
  export * from './$team.js';
5
5
  export * from './$top.js';
6
+ export * from './$skip.js';
6
7
  export * from './appId.js';
7
8
  export * from './appOAuth2SecretId.js';
8
9
  export * from './appSamlSecretId.js';
@@ -15,6 +16,7 @@ export * from './organizationId.js';
15
16
  export * from './resourceId.js';
16
17
  export * from './resourceType.js';
17
18
  export * from './screenshotId.js';
19
+ export * from './readmeId.js';
18
20
  export * from './appServiceId.js';
19
21
  export * from './view.js';
20
22
  export * from './trainingId.js';
@@ -0,0 +1,2 @@
1
+ import { type OpenAPIV3 } from 'openapi-types';
2
+ export declare const readmeId: OpenAPIV3.ParameterObject;
@@ -0,0 +1,8 @@
1
+ export const readmeId = {
2
+ name: 'readmeId',
3
+ in: 'path',
4
+ description: 'The id of an app readme',
5
+ required: true,
6
+ schema: { type: 'number' },
7
+ };
8
+ //# sourceMappingURL=readmeId.js.map
@@ -1,7 +1,7 @@
1
1
  export const screenshotId = {
2
2
  name: 'screenshotId',
3
3
  in: 'path',
4
- description: 'The ID of the app an app screenshot',
4
+ description: 'The id of an app screenshot',
5
5
  required: true,
6
6
  schema: { type: 'number' },
7
7
  };
@@ -77,7 +77,7 @@ This doesn’t affect whether or not the app can be accessed on its own domain.
77
77
  description: `
78
78
  A long description for the app.
79
79
 
80
- The long desciption will be rendered on the app details page. Markdown content is supported.
80
+ The long description will be rendered on the app details page. Markdown content is supported.
81
81
  `,
82
82
  },
83
83
  definition: { $ref: '#/components/schemas/AppDefinition' },
@@ -32,7 +32,13 @@ will remain the same until it is manually updated.
32
32
  `,
33
33
  },
34
34
  layout: {
35
- description: 'An override of the block’s default.',
35
+ description: `An override of the block’s default layout.
36
+
37
+ \`float\` sets the block position to float on the page and does not collide with other blocks.
38
+ Layout float can be combined with the \`position\` property to place the block on the desired location.
39
+ \`grow\` adds space between blocks so the page is filled.
40
+ \`static\` on the contrary, does not add extra space between blocks.
41
+ `,
36
42
  enum: ['float', 'grow', 'static'],
37
43
  },
38
44
  header: {
@@ -50,7 +56,7 @@ If a user does not have the right role, the block is not rendered.
50
56
  },
51
57
  },
52
58
  position: {
53
- description: 'For floating blocks this propert defines where the block should float.',
59
+ description: 'For floating blocks this property defines where the block should float.',
54
60
  default: 'bottom right',
55
61
  enum: [
56
62
  'top left',
@@ -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: {
@@ -66,7 +66,10 @@ export const paths = {
66
66
  tags: ['asset'],
67
67
  description: 'Get all of the app’s assets.',
68
68
  operationId: 'getAssets',
69
- parameters: [{ $ref: '#/components/parameters/$top' }],
69
+ parameters: [
70
+ { $ref: '#/components/parameters/$skip' },
71
+ { $ref: '#/components/parameters/$top' },
72
+ ],
70
73
  responses: {
71
74
  200: {
72
75
  description: 'The assets associated with the app.',
@@ -87,6 +87,7 @@ export const paths = {
87
87
  { $ref: '#/components/parameters/$filter' },
88
88
  { $ref: '#/components/parameters/$orderby' },
89
89
  { $ref: '#/components/parameters/$select' },
90
+ { $ref: '#/components/parameters/$skip' },
90
91
  { $ref: '#/components/parameters/$top' },
91
92
  { $ref: '#/components/parameters/$team' },
92
93
  ],
@@ -35,3 +35,7 @@ export declare const uuid4Pattern: RegExp;
35
35
  * A pattern which matches a JSON web token.
36
36
  */
37
37
  export declare const jwtPattern: RegExp;
38
+ /**
39
+ * A pattern which matches an ISO 8601 datetime string.
40
+ */
41
+ export declare const ISODateTimePattern: RegExp;
@@ -35,4 +35,8 @@ export const uuid4Pattern = /^[\d[a-f]{8}-[\da-f]{4}-4[\da-f]{3}-[\da-f]{4}-[\d[
35
35
  * A pattern which matches a JSON web token.
36
36
  */
37
37
  export const jwtPattern = /^[\w-]+(?:\.[\w-]+){2}$/;
38
+ /**
39
+ * A pattern which matches an ISO 8601 datetime string.
40
+ */
41
+ export const ISODateTimePattern = /\d{4}(.\d{2}){2}(\s|T)(\d{2}.){2}\d{2}/;
38
42
  //# sourceMappingURL=patterns.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appsemble/utils",
3
- "version": "0.27.9",
3
+ "version": "0.27.11",
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.9",
40
+ "@appsemble/types": "0.27.11",
41
41
  "axios": "^1.0.0",
42
42
  "cron-parser": "^4.0.0",
43
43
  "date-fns": "^2.0.0",
@@ -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({