@appsemble/node-utils 0.28.8 → 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 CHANGED
@@ -1,9 +1,9 @@
1
- # ![](https://gitlab.com/appsemble/appsemble/-/raw/0.28.8/config/assets/logo.svg) Appsemble Node Utilities
1
+ # ![](https://gitlab.com/appsemble/appsemble/-/raw/0.28.9/config/assets/logo.svg) Appsemble Node Utilities
2
2
 
3
3
  > NodeJS utilities used by Appsemble internally.
4
4
 
5
5
  [![npm](https://img.shields.io/npm/v/@appsemble/node-utils)](https://www.npmjs.com/package/@appsemble/node-utils)
6
- [![GitLab CI](https://gitlab.com/appsemble/appsemble/badges/0.28.8/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.28.8)
6
+ [![GitLab CI](https://gitlab.com/appsemble/appsemble/badges/0.28.9/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.28.9)
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 @@ compatibility is not guaranteed.
26
26
 
27
27
  ## License
28
28
 
29
- [LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.28.8/LICENSE.md) ©
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.8",
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.8",
42
- "@appsemble/utils": "0.28.8",
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,3 @@
1
+ import { type Middleware } from 'koa';
2
+ import { type Options } from '../types.js';
3
+ export declare function createGetAppVariables({ getApp, getAppVariables }: Options): Middleware;
@@ -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,5 +3,6 @@ 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';
@@ -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
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: GetAppSubEntityParams) => Promise<AppConfigEntry[]>;
391
+ getAppVariables: (params: GetAppVariablesParams) => Promise<AppConfigEntry[]>;
390
392
  }
391
393
  export {};