@appsemble/utils 0.26.0 → 0.27.1

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.26.0/config/assets/logo.svg) Appsemble Utilities
1
+ # ![](https://gitlab.com/appsemble/appsemble/-/raw/0.27.1/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.26.0/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.26.0)
6
+ [![GitLab CI](https://gitlab.com/appsemble/appsemble/badges/0.27.1/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.27.1)
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.26.0/LICENSE.md) ©
29
+ [LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.27.1/LICENSE.md) ©
30
30
  [Appsemble](https://appsemble.com)
@@ -72,10 +72,6 @@ This doesn’t affect whether or not the app can be accessed on its own domain.
72
72
  type: 'boolean',
73
73
  description: 'Determines whether this app should be used in demo mode.',
74
74
  },
75
- seed: {
76
- type: 'boolean',
77
- description: 'Determines whether this app should be seeded in demo mode.',
78
- },
79
75
  longDescription: {
80
76
  type: 'string',
81
77
  description: `
@@ -67,10 +67,6 @@ Example: 1d 8h 30m
67
67
  type: 'boolean',
68
68
  description: 'Whether the resource should be able to be transferred when cloning the app it belongs to',
69
69
  },
70
- ephemeral: {
71
- type: 'boolean',
72
- description: 'Whether the resource should be cleaned up regularly.',
73
- },
74
70
  schema: {
75
71
  $ref: '#/components/schemas/JSONSchemaRoot',
76
72
  description: 'JSON schema definitions that may be used by the app.',
@@ -349,7 +349,7 @@ export const paths = {
349
349
  description: 'The app was added to the app collection',
350
350
  },
351
351
  },
352
- security: [{ studio: [] }],
352
+ security: [{ studio: [] }, { cli: ['apps:write'] }],
353
353
  },
354
354
  },
355
355
  '/api/appCollections/{appCollectionId}/apps/{appId}': {
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
- seed: {
39
- $ref: '#/components/schemas/App/properties/seed',
40
- },
41
38
  longDescription: {
42
39
  $ref: '#/components/schemas/App/properties/longDescription',
43
40
  },
@@ -187,9 +184,6 @@ export const paths = {
187
184
  demoMode: {
188
185
  $ref: '#/components/schemas/App/properties/demoMode',
189
186
  },
190
- seed: {
191
- $ref: '#/components/schemas/App/properties/seed',
192
- },
193
187
  longDescription: {
194
188
  $ref: '#/components/schemas/App/properties/longDescription',
195
189
  },
@@ -1,5 +1,65 @@
1
1
  import { normalized } from '../../constants/index.js';
2
2
  export const paths = {
3
+ '/api/apps/{appId}/seed-assets': {
4
+ parameters: [{ $ref: '#/components/parameters/appId' }],
5
+ post: {
6
+ tags: ['asset'],
7
+ description: 'Upload a new seed asset.',
8
+ operationId: 'seedAsset',
9
+ requestBody: {
10
+ description: 'The asset to upload.',
11
+ content: {
12
+ 'multipart/form-data': {
13
+ schema: {
14
+ type: 'object',
15
+ description: 'The request body for creating an asset.',
16
+ additionalProperties: false,
17
+ required: ['file'],
18
+ properties: {
19
+ file: {
20
+ type: 'string',
21
+ format: 'binary',
22
+ writeOnly: true,
23
+ description: 'The binary data of the asset. This may include a filename.',
24
+ },
25
+ name: {
26
+ type: 'string',
27
+ pattern: normalized.source,
28
+ description: 'The given name of the asset. Assets may be referenced by their name or ID in the API.',
29
+ },
30
+ clonable: {
31
+ type: 'boolean',
32
+ description: 'Whether the asset should be transferable when cloning the app they are in.',
33
+ },
34
+ },
35
+ },
36
+ },
37
+ },
38
+ },
39
+ responses: {
40
+ 201: {
41
+ description: 'The asset that was created.',
42
+ content: {
43
+ 'application/json': {
44
+ schema: { $ref: '#/components/schemas/Asset' },
45
+ },
46
+ },
47
+ },
48
+ },
49
+ security: [{ studio: [] }, {}, { cli: ['assets:write'] }],
50
+ },
51
+ delete: {
52
+ tags: ['asset'],
53
+ description: 'Delete all app seed assets.',
54
+ operationId: 'deleteSeedAssets',
55
+ responses: {
56
+ 204: {
57
+ description: 'The app assets have been deleted successfully.',
58
+ },
59
+ },
60
+ security: [{ studio: [] }, { app: ['resources:manage'] }, { cli: ['resources:write'] }, {}],
61
+ },
62
+ },
3
63
  '/api/apps/{appId}/assets': {
4
64
  parameters: [{ $ref: '#/components/parameters/appId' }],
5
65
  get: {
@@ -1,4 +1,78 @@
1
1
  export const paths = {
2
+ '/api/apps/{appId}/seed-resources/{resourceType}': {
3
+ parameters: [
4
+ { $ref: '#/components/parameters/appId' },
5
+ { $ref: '#/components/parameters/resourceType' },
6
+ ],
7
+ post: {
8
+ tags: ['resource'],
9
+ description: 'Create a new seed resource for this app.',
10
+ operationId: 'seedResource',
11
+ requestBody: {
12
+ required: true,
13
+ description: 'The resource to create',
14
+ content: {
15
+ 'application/json': {
16
+ schema: {
17
+ anyOf: [
18
+ { $ref: '#/components/schemas/Resource' },
19
+ { type: 'array', items: { $ref: '#/components/schemas/Resource' } },
20
+ ],
21
+ },
22
+ },
23
+ 'multipart/form-data': {
24
+ schema: {
25
+ type: 'object',
26
+ required: ['resource'],
27
+ description: 'A `multipart/form-data` representation of a resource.',
28
+ additionalProperties: false,
29
+ properties: {
30
+ resource: {
31
+ type: 'array',
32
+ items: { $ref: '#/components/schemas/Resource' },
33
+ },
34
+ assets: {
35
+ type: 'array',
36
+ description: 'A list of assets that should be linked to the resource.',
37
+ items: {
38
+ type: 'string',
39
+ format: 'binary',
40
+ },
41
+ },
42
+ },
43
+ },
44
+ },
45
+ 'text/csv': {
46
+ schema: {
47
+ type: 'array',
48
+ items: { type: 'object', additionalProperties: { type: 'string' } },
49
+ },
50
+ },
51
+ },
52
+ },
53
+ responses: {
54
+ 201: {
55
+ description: 'The resource that was created.',
56
+ $ref: '#/components/responses/resource',
57
+ },
58
+ },
59
+ security: [{ studio: [] }, { app: ['resources:manage'] }, { cli: ['resources:write'] }, {}],
60
+ },
61
+ },
62
+ '/api/apps/{appId}/seed-resources': {
63
+ parameters: [{ $ref: '#/components/parameters/appId' }],
64
+ delete: {
65
+ tags: ['resource'],
66
+ description: 'Delete all app seed resources.',
67
+ operationId: 'deleteSeedResources',
68
+ responses: {
69
+ 204: {
70
+ description: 'The app seed resources have been deleted successfully.',
71
+ },
72
+ },
73
+ security: [{ cli: ['resources:write'] }, {}],
74
+ },
75
+ },
2
76
  '/api/apps/{appId}/resources/{resourceType}': {
3
77
  parameters: [
4
78
  { $ref: '#/components/parameters/appId' },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appsemble/utils",
3
- "version": "0.26.0",
3
+ "version": "0.27.1",
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.26.0",
40
+ "@appsemble/types": "0.27.1",
41
41
  "axios": "^1.0.0",
42
42
  "cron-parser": "^4.0.0",
43
43
  "date-fns": "^2.0.0",