@appsemble/node-utils 0.28.7 → 0.28.9
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/server/controllers/appVariables.d.ts +3 -0
- package/server/controllers/appVariables.js +15 -0
- package/server/controllers/index.d.ts +1 -0
- package/server/controllers/index.js +1 -0
- package/server/controllers/resources.js +1 -1
- package/server/types.d.ts +4 -2
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.28.9)
|
|
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.28.
|
|
29
|
+
[LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.28.9/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.28.
|
|
3
|
+
"version": "0.28.9",
|
|
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.28.
|
|
42
|
-
"@appsemble/utils": "0.28.
|
|
41
|
+
"@appsemble/types": "0.28.9",
|
|
42
|
+
"@appsemble/utils": "0.28.9",
|
|
43
43
|
"@formatjs/fast-memoize": "^2.0.0",
|
|
44
44
|
"@fortawesome/fontawesome-free": "^6.0.0",
|
|
45
45
|
"@koa/cors": "^4.0.0",
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { assertKoaError } from '../../koa.js';
|
|
2
|
+
export function createGetAppVariables({ getApp, getAppVariables }) {
|
|
3
|
+
return async (ctx) => {
|
|
4
|
+
const { pathParams: { appId }, } = ctx;
|
|
5
|
+
const app = await getApp({ context: ctx, query: { where: { id: appId } } });
|
|
6
|
+
assertKoaError(!app, ctx, 404, 'App not found');
|
|
7
|
+
const variables = await getAppVariables({
|
|
8
|
+
context: ctx,
|
|
9
|
+
app,
|
|
10
|
+
query: { attributes: ['id', 'name', 'value'] },
|
|
11
|
+
});
|
|
12
|
+
ctx.body = variables;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=appVariables.js.map
|
|
@@ -3,6 +3,7 @@ export * from './appMessages.js';
|
|
|
3
3
|
export * from './assets.js';
|
|
4
4
|
export * from './resources.js';
|
|
5
5
|
export * from './appMembers.js';
|
|
6
|
+
export * from './appVariables.js';
|
|
6
7
|
export * from './teams.js';
|
|
7
8
|
export * from './oauth2Provider.js';
|
|
8
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -226,7 +226,7 @@ export function createUpdateResource(options) {
|
|
|
226
226
|
});
|
|
227
227
|
assertKoaError(!oldResource, ctx, 404, 'Resource not found');
|
|
228
228
|
const appAssets = await getAppAssets({ context: ctx, app });
|
|
229
|
-
const [processedBody, preparedAssets, deletedAssetIds] = processResourceBody(ctx, resourceDefinition, appAssets.filter((asset) => asset.resourceId === resourceId).map((asset) => asset.id), oldResource.expires);
|
|
229
|
+
const [processedBody, preparedAssets, deletedAssetIds] = processResourceBody(ctx, resourceDefinition, appAssets.filter((asset) => asset.resourceId === resourceId).map((asset) => asset.id), oldResource.expires, appAssets.map((asset) => ({ id: asset.id, name: asset.name })));
|
|
230
230
|
const resources = Array.isArray(processedBody) ? processedBody : [processedBody];
|
|
231
231
|
ctx.body = await updateAppResource({
|
|
232
232
|
app,
|
package/server/types.d.ts
CHANGED
|
@@ -58,7 +58,6 @@ declare module 'koas-security' {
|
|
|
58
58
|
declare module 'koas-parameters' {
|
|
59
59
|
interface PathParams {
|
|
60
60
|
appId: number;
|
|
61
|
-
appPath: string;
|
|
62
61
|
appCollectionId: number;
|
|
63
62
|
appOAuth2SecretId: number;
|
|
64
63
|
appSamlSecretId: number;
|
|
@@ -133,6 +132,9 @@ export interface GetAppSubEntityParams {
|
|
|
133
132
|
context: ParameterizedContext<DefaultState, DefaultContextInterface, any>;
|
|
134
133
|
app: App;
|
|
135
134
|
}
|
|
135
|
+
export interface GetAppVariablesParams extends GetAppSubEntityParams {
|
|
136
|
+
query?: Record<string, any>;
|
|
137
|
+
}
|
|
136
138
|
export interface GetAppMessagesParams extends GetAppSubEntityParams {
|
|
137
139
|
language?: string;
|
|
138
140
|
merge?: string[] | string;
|
|
@@ -386,6 +388,6 @@ export interface Options {
|
|
|
386
388
|
deleteAppAsset: (params: DeleteAppAssetParams) => Promise<number>;
|
|
387
389
|
email: (params: EmailParams) => Promise<void>;
|
|
388
390
|
sendNotifications: (params: SendNotificationsParams) => Promise<void>;
|
|
389
|
-
getAppVariables: (params:
|
|
391
|
+
getAppVariables: (params: GetAppVariablesParams) => Promise<AppConfigEntry[]>;
|
|
390
392
|
}
|
|
391
393
|
export {};
|