@appsemble/node-utils 0.33.10 → 0.34.0

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.33.10/config/assets/logo.svg) Appsemble Node Utilities
1
+ # ![](https://gitlab.com/appsemble/appsemble/-/raw/0.34.0/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.33.10/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.33.10)
6
+ [![GitLab CI](https://gitlab.com/appsemble/appsemble/badges/0.34.0/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.34.0)
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.33.10/LICENSE.md) ©
29
+ [LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.34.0/LICENSE.md) ©
30
30
  [Appsemble](https://appsemble.com)
package/app.js CHANGED
@@ -34,7 +34,7 @@ export async function getRemapperContext(app, language, options, context) {
34
34
  language,
35
35
  });
36
36
  const appVariables = await getAppVariables({ context, app });
37
- const appMemberInfo = await getCurrentAppMember({ context });
37
+ const appMemberInfo = await getCurrentAppMember({ context, app });
38
38
  const cache = objectCache((message) => new IntlMessageFormat(message, language, undefined, {
39
39
  formatters: {
40
40
  // XXX: idk
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appsemble/node-utils",
3
- "version": "0.33.10",
3
+ "version": "0.34.0",
4
4
  "description": "NodeJS utilities used by Appsemble internally.",
5
5
  "keywords": [
6
6
  "app",
@@ -40,9 +40,9 @@
40
40
  "test": "vitest"
41
41
  },
42
42
  "dependencies": {
43
- "@appsemble/types": "0.33.10",
44
- "@appsemble/utils": "0.33.10",
45
- "@appsemble/lang-sdk": "0.33.10",
43
+ "@appsemble/types": "0.34.0",
44
+ "@appsemble/utils": "0.34.0",
45
+ "@appsemble/lang-sdk": "0.34.0",
46
46
  "@formatjs/fast-memoize": "^2.0.0",
47
47
  "@fortawesome/fontawesome-free": "^6.0.0",
48
48
  "@kubernetes/client-node": "^0.22.2",
@@ -1,3 +1,3 @@
1
1
  import { type Middleware } from 'koa';
2
2
  import { type Options } from '../../../../types.js';
3
- export declare function createGetCurrentAppMemberController({ getCurrentAppMember }: Options): Middleware;
3
+ export declare function createGetCurrentAppMemberController({ getApp, getCurrentAppMember, }: Options): Middleware;
@@ -1,6 +1,11 @@
1
- export function createGetCurrentAppMemberController({ getCurrentAppMember }) {
1
+ export function createGetCurrentAppMemberController({ getApp, getCurrentAppMember, }) {
2
2
  return async (ctx) => {
3
- ctx.body = await getCurrentAppMember({ context: ctx });
3
+ const { appId } = ctx.pathParams;
4
+ const app = await getApp({
5
+ context: ctx,
6
+ query: { where: { id: appId }, attributes: ['id'] },
7
+ });
8
+ ctx.body = await getCurrentAppMember({ context: ctx, app });
4
9
  };
5
10
  }
6
11
  //# sourceMappingURL=createGetCurrentAppMemberController.js.map
@@ -20,7 +20,6 @@ export function createCountAppResourcesController(options) {
20
20
  where || {},
21
21
  {
22
22
  type: resourceType,
23
- AppId: appId,
24
23
  GroupId: selectedGroupId ?? null,
25
24
  expires: { or: [{ gt: new Date() }, null] },
26
25
  ...(app.demoMode ? { seed: false, ephemeral: true } : {}),
@@ -8,7 +8,6 @@ export function createDeleteAppResourceController(options) {
8
8
  where: {
9
9
  id: resourceId,
10
10
  type: resourceType,
11
- AppId: appId,
12
11
  GroupId: selectedGroupId ?? null,
13
12
  expires: { or: [{ gt: new Date() }, { eq: null }] },
14
13
  ...(app.demoMode ? { seed: false, ephemeral: true } : {}),
@@ -9,7 +9,6 @@ export function createGetAppResourceByIdController(options) {
9
9
  where: {
10
10
  id: resourceId,
11
11
  type: resourceType,
12
- AppId: appId,
13
12
  GroupId: selectedGroupId ?? null,
14
13
  expires: { or: [{ gt: new Date() }, null] },
15
14
  ...(app.demoMode ? { seed: false, ephemeral: true } : {}),
@@ -30,7 +30,6 @@ export function createQueryAppResourcesController(options) {
30
30
  where,
31
31
  {
32
32
  type: resourceType,
33
- AppId: appId,
34
33
  GroupId: selectedGroupId ?? null,
35
34
  expires: { or: [{ gt: new Date() }, null] },
36
35
  ...(app.demoMode && !isSameOrigin ? { seed: false, ephemeral: true } : {}),
@@ -8,7 +8,6 @@ export function createUpdateAppResourceController(options) {
8
8
  where: {
9
9
  id: resourceId,
10
10
  type: resourceType,
11
- AppId: appId,
12
11
  GroupId: selectedGroupId ?? null,
13
12
  expires: { or: [{ gt: new Date() }, null] },
14
13
  ...(app.demoMode ? { seed: false, ephemeral: true } : {}),
@@ -12,7 +12,7 @@ export function createServiceWorkerHandler({ getApp, getBlocksAssetsPaths }) {
12
12
  assertKoaCondition(app != null, ctx, 404, 'App does not exist.');
13
13
  const identifiableBlocks = getAppBlocks(app.definition);
14
14
  const blocksAssetsPaths = await getBlocksAssetsPaths({ identifiableBlocks, context: ctx });
15
- ctx.body = `const blockAssets=${JSON.stringify(blocksAssetsPaths)};${serviceWorker}`;
15
+ ctx.body = `const appVersion = ${app.version};const blockAssets=${JSON.stringify(blocksAssetsPaths)};${serviceWorker}`;
16
16
  ctx.type = 'application/javascript';
17
17
  };
18
18
  }
package/server/types.d.ts CHANGED
@@ -206,6 +206,7 @@ export interface GetCspParams {
206
206
  }
207
207
  export interface GetCurrentAppMemberParams {
208
208
  context: ParameterizedContext<DefaultState, DefaultContextInterface, any>;
209
+ app: App;
209
210
  }
210
211
  export interface GetCurrentAppMemberGroupsParams {
211
212
  context: ParameterizedContext<DefaultState, DefaultContextInterface, any>;
@@ -244,6 +245,7 @@ export interface ReloadUserParams {
244
245
  context: ParameterizedContext<DefaultState, DefaultContextInterface, any>;
245
246
  }
246
247
  export interface ParseQueryParams {
248
+ tableName: string;
247
249
  $filter: string;
248
250
  $orderby: string;
249
251
  resourceDefinition: ResourceDefinition;
@@ -9,6 +9,7 @@ export function generateResourceQuery(ctx, { parseQuery }, resourceDefinition) {
9
9
  $orderby: ctx.queryParams.$orderby,
10
10
  // @ts-expect-error 2322 null is not assignable to type (strictNullChecks)
11
11
  resourceDefinition,
12
+ tableName: 'Resource',
12
13
  });
13
14
  }
14
15
  catch (error) {
@@ -29,7 +30,6 @@ export async function deleteResourcesRecursively(type, app, options, context) {
29
30
  attributes: ['id'],
30
31
  where: {
31
32
  type,
32
- AppId: app.id,
33
33
  or: [{ seed: true }, { ephemeral: true }],
34
34
  },
35
35
  };