@appsemble/node-utils 0.34.20 → 0.35.3-test.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.34.20/config/assets/logo.svg) Appsemble Node Utilities
1
+ # ![](https://gitlab.com/appsemble/appsemble/-/raw/0.35.3-test.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.34.20/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.34.20)
6
+ [![GitLab CI](https://gitlab.com/appsemble/appsemble/badges/0.35.3-test.0/pipeline.svg)](https://gitlab.com/appsemble/appsemble/-/releases/0.35.3-test.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.34.20/LICENSE.md) ©
29
+ [LGPL-3.0-only](https://gitlab.com/appsemble/appsemble/-/blob/0.35.3-test.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
@@ -95,7 +95,7 @@ export async function deleteCompanionContainers(serviceName) {
95
95
  }
96
96
  export async function updateCompanionContainers(definitions, appName, appId, registry) {
97
97
  // If testing, don't create Kubernetes resources
98
- if (process.env.TEST) {
98
+ if (process.env.NODE_ENV !== 'production') {
99
99
  return;
100
100
  }
101
101
  const { appsApi, coreApi } = getKubeConfig();
package/koa.js CHANGED
@@ -14,6 +14,7 @@ function serializer() {
14
14
  }
15
15
  function bodyParser() {
16
16
  return koaBodyParser({
17
+ ignore: ['acceptPayment', 'acceptAppPayment'],
17
18
  parsers: {
18
19
  'application/scim+json': jsonParser,
19
20
  'application/x-www-form-urlencoded': xWwwFormUrlencodedParser,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appsemble/node-utils",
3
- "version": "0.34.20",
3
+ "version": "0.35.3-test.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.34.20",
44
- "@appsemble/utils": "0.34.20",
45
- "@appsemble/lang-sdk": "0.34.20",
43
+ "@appsemble/types": "0.35.3-test.0",
44
+ "@appsemble/utils": "0.35.3-test.0",
45
+ "@appsemble/lang-sdk": "0.35.3-test.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
@@ -23,7 +23,6 @@ export function createCountAppResourcesController(options) {
23
23
  where || {},
24
24
  {
25
25
  type: resourceType,
26
- AppId: appId,
27
26
  GroupId: selectedGroupId ?? null,
28
27
  expires: { or: [{ gt: new Date() }, null] },
29
28
  ...(app.demoMode ? { seed: false, ephemeral: true } : {}),
@@ -11,7 +11,6 @@ export function createDeleteAppResourceController(options) {
11
11
  where: {
12
12
  id: resourceId,
13
13
  type: resourceType,
14
- AppId: appId,
15
14
  GroupId: selectedGroupId ?? null,
16
15
  expires: { or: [{ gt: new Date() }, { eq: null }] },
17
16
  ...(app.demoMode ? { seed: false, ephemeral: true } : {}),
@@ -12,7 +12,6 @@ export function createGetAppResourceByIdController(options) {
12
12
  where: {
13
13
  id: resourceId,
14
14
  type: resourceType,
15
- AppId: appId,
16
15
  GroupId: selectedGroupId ?? null,
17
16
  expires: { or: [{ gt: new Date() }, null] },
18
17
  ...(app.demoMode ? { seed: false, ephemeral: true } : {}),
@@ -7,7 +7,7 @@ export function createQueryAppResourcesController(options) {
7
7
  const { checkAppPermissions, getApp, getAppResources } = options;
8
8
  const app = await getApp({
9
9
  context: ctx,
10
- query: { attributes: ['definition', 'demoMode', 'id'], where: { id: appId } },
10
+ query: { attributes: ['definition', 'demoMode', 'id', 'template'], where: { id: appId } },
11
11
  });
12
12
  const resourceDefinition = getResourceDefinition(app.definition, resourceType, ctx, view);
13
13
  const { order, where } = generateResourceQuery(ctx, options, resourceDefinition);
@@ -33,7 +33,6 @@ export function createQueryAppResourcesController(options) {
33
33
  where,
34
34
  {
35
35
  type: resourceType,
36
- AppId: appId,
37
36
  GroupId: selectedGroupId ?? null,
38
37
  expires: { or: [{ gt: new Date() }, null] },
39
38
  ...(app.demoMode && !isSameOrigin ? { seed: false, ephemeral: true } : {}),
@@ -5,13 +5,12 @@ export function createUpdateAppResourceController(options) {
5
5
  const { checkAppPermissions, getApp, getAppAssets, getAppResource, updateAppResource } = options;
6
6
  const app = await getApp({
7
7
  context: ctx,
8
- query: { attributes: ['id', 'demoMode', 'definition'], where: { id: appId } },
8
+ query: { attributes: ['id', 'demoMode', 'definition', 'template'], where: { id: appId } },
9
9
  });
10
10
  const findOptions = {
11
11
  where: {
12
12
  id: resourceId,
13
13
  type: resourceType,
14
- AppId: appId,
15
14
  GroupId: selectedGroupId ?? null,
16
15
  expires: { or: [{ gt: new Date() }, null] },
17
16
  ...(app.demoMode ? { seed: false, ephemeral: true } : {}),
package/server/types.d.ts CHANGED
@@ -65,6 +65,7 @@ declare module 'koas-parameters' {
65
65
  groupMemberId: string;
66
66
  appMemberId: string;
67
67
  organizationId: string;
68
+ organizationSubscriptionId: number;
68
69
  path: string;
69
70
  resourceId: number;
70
71
  resourceType: string;
@@ -91,14 +92,21 @@ declare module 'koas-parameters' {
91
92
  filter: string;
92
93
  $orderby?: string;
93
94
  $select: string;
95
+ organizationId: string;
94
96
  $top: number;
95
97
  $skip: number;
96
98
  code: string;
97
99
  count: number;
100
+ period: string;
101
+ subscriptionType: string;
102
+ price: string;
103
+ locale: string;
104
+ couponCode: string;
98
105
  startIndex: number;
99
106
  view: string;
100
107
  resources: boolean;
101
108
  assets: boolean;
109
+ organizationSubscriptionExpiresWithin: number;
102
110
  screenshots: boolean;
103
111
  readmes: boolean;
104
112
  roles?: string;
@@ -206,6 +214,7 @@ export interface GetCspParams {
206
214
  }
207
215
  export interface GetCurrentAppMemberParams {
208
216
  context: ParameterizedContext<DefaultState, DefaultContextInterface, any>;
217
+ app: App;
209
218
  }
210
219
  export interface GetCurrentAppMemberGroupsParams {
211
220
  context: ParameterizedContext<DefaultState, DefaultContextInterface, any>;
@@ -244,6 +253,7 @@ export interface ReloadUserParams {
244
253
  context: ParameterizedContext<DefaultState, DefaultContextInterface, any>;
245
254
  }
246
255
  export interface ParseQueryParams {
256
+ tableName: string;
247
257
  $filter: string;
248
258
  $orderby: string;
249
259
  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
  };