@appsemble/utils 0.32.1-test.14 → 0.32.1-test.16

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.32.1-test.14/config/assets/logo.svg) Appsemble Utilities
1
+ # ![](https://gitlab.com/appsemble/appsemble/-/raw/0.32.1-test.16/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.32.1-test.14/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.32.1-test.14)
6
+ [![GitLab CI](https://gitlab.com/appsemble/appsemble/badges/0.32.1-test.16/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.32.1-test.16)
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.32.1-test.14/LICENSE.md) ©
29
+ [LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.32.1-test.16/LICENSE.md) ©
30
30
  [Appsemble](https://appsemble.com)
@@ -87,6 +87,15 @@ name of the resource and how it should behave.
87
87
  default: false,
88
88
  description: 'Whether to enable position column for the instances of this resource. This is used for keeping an ordered list to enable custom sorting of the data using drag and drop features.',
89
89
  },
90
+ enforceOrderingGroupByFields: {
91
+ type: 'array',
92
+ pattern: '^[a-zA-Z0-9]*$',
93
+ description: 'Group resources by fields when handling resource positions',
94
+ items: {
95
+ type: 'string',
96
+ },
97
+ minItems: 1,
98
+ },
90
99
  url: {
91
100
  type: 'string',
92
101
  default: '/api/apps/{appId}/{resource}',
@@ -3,6 +3,8 @@ export const pathItems = {
3
3
  { $ref: '#/components/parameters/appId' },
4
4
  { $ref: '#/components/parameters/resourceType' },
5
5
  { $ref: '#/components/parameters/resourceId' },
6
+ { $ref: '#/components/parameters/selectedGroupId' },
7
+ { $ref: '#/components/parameters/$filter' },
6
8
  ],
7
9
  put: {
8
10
  tags: ['app', 'resource', 'positioning', 'custom-sort'],
package/objectCache.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Create a function for memoizing values.
3
3
  *
4
- * The cache accepts a favtory function which is used for creating a value. If cache is called with
4
+ * The cache accepts a factory function which is used for creating a value. If cache is called with
5
5
  * the value, the factory is called and the returned value is memoized. If the cache is called with
6
6
  * the same value again, the memoized value is returned.
7
7
  *
package/objectCache.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Create a function for memoizing values.
3
3
  *
4
- * The cache accepts a favtory function which is used for creating a value. If cache is called with
4
+ * The cache accepts a factory function which is used for creating a value. If cache is called with
5
5
  * the value, the factory is called and the returned value is memoized. If the cache is called with
6
6
  * the same value again, the memoized value is returned.
7
7
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appsemble/utils",
3
- "version": "0.32.1-test.14",
3
+ "version": "0.32.1-test.16",
4
4
  "description": "Utility functions used in Appsemble internally",
5
5
  "keywords": [
6
6
  "app",
@@ -39,7 +39,7 @@
39
39
  "test": "vitest"
40
40
  },
41
41
  "dependencies": {
42
- "@appsemble/types": "0.32.1-test.14",
42
+ "@appsemble/types": "0.32.1-test.16",
43
43
  "@odata/parser": "^0.2.14",
44
44
  "axios": "^1.0.0",
45
45
  "cron-parser": "^4.0.0",
package/validation.js CHANGED
@@ -111,8 +111,22 @@ function validateResourceSchemas(definition, report) {
111
111
  if (!resource?.schema) {
112
112
  continue;
113
113
  }
114
- const { schema } = resource;
114
+ const { enforceOrderingGroupByFields, positioning, schema } = resource;
115
115
  const prefix = ['resources', resourceName, 'schema'];
116
+ if (!positioning && enforceOrderingGroupByFields?.length) {
117
+ report(enforceOrderingGroupByFields, 'must set positioning to true', [
118
+ 'resources',
119
+ resourceName,
120
+ 'enforceOrderingGroupByFields',
121
+ ]);
122
+ }
123
+ if (enforceOrderingGroupByFields?.some((item) => !item.match('^[a-zA-Z0-9]*$'))) {
124
+ report(enforceOrderingGroupByFields, 'must be alphanumeric', [
125
+ 'resources',
126
+ resourceName,
127
+ 'enforceOrderingGroupByFields',
128
+ ]);
129
+ }
116
130
  const reservedKeywords = new Set([
117
131
  'created',
118
132
  'updated',