@appsemble/node-utils 0.24.10 → 0.24.13
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/package.json +3 -3
- package/resource.js +5 -0
- package/server/controllers/resources.js +12 -5
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
#  Appsemble Node Utilities
|
|
2
2
|
|
|
3
3
|
> NodeJS utilities used by Appsemble internally.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@appsemble/node-utils)
|
|
6
|
-
[](https://gitlab.com/appsemble/appsemble/-/releases/0.24.13)
|
|
7
7
|
[](https://prettier.io)
|
|
8
8
|
|
|
9
9
|
## Table of Contents
|
|
@@ -26,5 +26,5 @@ compatibility is not guaranteed.
|
|
|
26
26
|
|
|
27
27
|
## License
|
|
28
28
|
|
|
29
|
-
[LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.24.
|
|
29
|
+
[LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.24.13/LICENSE.md) ©
|
|
30
30
|
[Appsemble](https://appsemble.com)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appsemble/node-utils",
|
|
3
|
-
"version": "0.24.
|
|
3
|
+
"version": "0.24.13",
|
|
4
4
|
"description": "NodeJS utilities used by Appsemble internally.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"app",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"test": "vitest"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@appsemble/types": "0.24.
|
|
42
|
-
"@appsemble/utils": "0.24.
|
|
41
|
+
"@appsemble/types": "0.24.13",
|
|
42
|
+
"@appsemble/utils": "0.24.13",
|
|
43
43
|
"@formatjs/fast-memoize": "^2.0.0",
|
|
44
44
|
"@fortawesome/fontawesome-free": "^6.0.0",
|
|
45
45
|
"@koa/cors": "^4.0.0",
|
package/resource.js
CHANGED
|
@@ -98,6 +98,7 @@ export function extractResourceBody(ctx) {
|
|
|
98
98
|
* 3. Asset IDs from the `knownAssetIds` array which are no longer used.
|
|
99
99
|
*/
|
|
100
100
|
export function processResourceBody(ctx, definition, knownAssetIds = [], knownExpires, knownAssetNameIds = []) {
|
|
101
|
+
var _a;
|
|
101
102
|
const [resource, assets, preValidateProperty] = extractResourceBody(ctx);
|
|
102
103
|
const validator = new Validator();
|
|
103
104
|
const assetIdMap = new Map();
|
|
@@ -146,6 +147,10 @@ export function processResourceBody(ctx, definition, knownAssetIds = [], knownEx
|
|
|
146
147
|
},
|
|
147
148
|
$clonable: { type: 'boolean' },
|
|
148
149
|
$ephemeral: { type: 'boolean' },
|
|
150
|
+
...Object.fromEntries(Object.values((_a = definition.references) !== null && _a !== void 0 ? _a : {}).map((reference) => [
|
|
151
|
+
`$${reference.resource}`,
|
|
152
|
+
{ type: 'integer' },
|
|
153
|
+
])),
|
|
149
154
|
},
|
|
150
155
|
};
|
|
151
156
|
const customErrors = [];
|
|
@@ -182,11 +182,18 @@ export function createCreateResource(options) {
|
|
|
182
182
|
await createAppResourcesWithAssets({
|
|
183
183
|
app,
|
|
184
184
|
context: ctx,
|
|
185
|
-
resources: resources.map((resource) =>
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
185
|
+
resources: resources.map((resource) => {
|
|
186
|
+
var _a;
|
|
187
|
+
const cleanResource = { ...resource };
|
|
188
|
+
for (const referencedProperty of Object.keys((_a = resourceDefinition.references) !== null && _a !== void 0 ? _a : {})) {
|
|
189
|
+
delete cleanResource[referencedProperty];
|
|
190
|
+
}
|
|
191
|
+
return {
|
|
192
|
+
...cleanResource,
|
|
193
|
+
$seed: true,
|
|
194
|
+
$ephemeral: false,
|
|
195
|
+
};
|
|
196
|
+
}),
|
|
190
197
|
preparedAssets,
|
|
191
198
|
resourceType,
|
|
192
199
|
action,
|