@balena/pinejs 17.3.3 → 17.3.4-build-update-deps-04a59f892aeac34c8e1c44e9e9425e4294c65d92-1

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.
Files changed (44) hide show
  1. package/.pinejs-cache.json +1 -1
  2. package/.versionbot/CHANGELOG.yml +497 -1
  3. package/CHANGELOG.md +210 -1
  4. package/VERSION +1 -1
  5. package/out/bin/utils.js.map +1 -1
  6. package/out/database-layer/db.js +8 -4
  7. package/out/database-layer/db.js.map +1 -1
  8. package/out/express-emulator/express.js +2 -5
  9. package/out/express-emulator/express.js.map +1 -1
  10. package/out/passport-pinejs/mount-login-router.js +1 -3
  11. package/out/passport-pinejs/mount-login-router.js.map +1 -1
  12. package/out/passport-pinejs/passport-pinejs.js +11 -8
  13. package/out/passport-pinejs/passport-pinejs.js.map +1 -1
  14. package/out/pinejs-session-store/pinejs-session-store.js.map +1 -1
  15. package/out/sbvr-api/abstract-sql.js.map +1 -1
  16. package/out/sbvr-api/hooks.js +3 -1
  17. package/out/sbvr-api/hooks.js.map +1 -1
  18. package/out/sbvr-api/permissions.js +3 -1
  19. package/out/sbvr-api/permissions.js.map +1 -1
  20. package/out/sbvr-api/sbvr-utils.js +4 -2
  21. package/out/sbvr-api/sbvr-utils.js.map +1 -1
  22. package/out/sbvr-api/translations.js +1 -1
  23. package/out/sbvr-api/translations.js.map +1 -1
  24. package/out/sbvr-api/uri-parser.js +2 -2
  25. package/out/sbvr-api/uri-parser.js.map +1 -1
  26. package/out/webresource-handler/index.js +2 -1
  27. package/out/webresource-handler/index.js.map +1 -1
  28. package/package.json +19 -19
  29. package/src/bin/utils.ts +1 -1
  30. package/src/database-layer/db.ts +13 -9
  31. package/src/express-emulator/express.js +2 -5
  32. package/src/migrator/migrations.ts +1 -1
  33. package/src/passport-pinejs/mount-login-router.ts +1 -5
  34. package/src/passport-pinejs/passport-pinejs.ts +4 -2
  35. package/src/pinejs-session-store/pinejs-session-store.ts +1 -1
  36. package/src/sbvr-api/abstract-sql.ts +1 -1
  37. package/src/sbvr-api/dev.ts +1 -1
  38. package/src/sbvr-api/hooks.ts +5 -3
  39. package/src/sbvr-api/permissions.ts +5 -10
  40. package/src/sbvr-api/sbvr-utils.ts +8 -6
  41. package/src/sbvr-api/translations.ts +1 -1
  42. package/src/sbvr-api/uri-parser.ts +2 -2
  43. package/src/sbvr-api/user.ts +1 -1
  44. package/src/webresource-handler/index.ts +2 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@balena/pinejs",
3
- "version": "17.3.3",
3
+ "version": "17.3.4-build-update-deps-04a59f892aeac34c8e1c44e9e9425e4294c65d92-1",
4
4
  "main": "out/server-glue/module",
5
5
  "type": "commonjs",
6
6
  "repository": "git@github.com:balena-io/pinejs.git",
@@ -23,17 +23,17 @@
23
23
  "test:compose": "trap 'docker compose -f docker-compose.npm-test.yml down ; echo Stopped ; exit 0' INT; docker compose -f docker-compose.npm-test.yml up -d && sleep 2 && DATABASE_URL=postgres://docker:docker@localhost:5431/postgres PINEJS_WEBRESOURCE_MAXFILESIZE=1000000000 S3_ENDPOINT=http://localhost:43680 S3_ACCESS_KEY=USERNAME S3_SECRET_KEY=PASSWORD S3_STORAGE_ADAPTER_BUCKET=balena-pine-web-resources S3_REGION=us-east-1 npm run mocha",
24
24
  "test:generated-types": "npm run generate-types && git diff --exit-code ./src/sbvr-api/user.ts ./src/migrator/migrations.ts ./src/sbvr-api/dev.ts",
25
25
  "mocha": "TS_NODE_FILES=true mocha",
26
- "prettify": "balena-lint -t tsconfig.dev.json -e js -e ts --fix src test build typings Gruntfile.ts",
26
+ "lint-fix": "balena-lint -t tsconfig.dev.json -e js -e ts --fix src test build typings Gruntfile.ts",
27
27
  "generate-types": "node ./bin/sbvr-compiler.js generate-types ./src/sbvr-api/user.sbvr ./src/sbvr-api/user.ts && node ./bin/sbvr-compiler.js generate-types ./src/migrator/migrations.sbvr ./src/migrator/migrations.ts && node ./bin/sbvr-compiler.js generate-types ./src/sbvr-api/dev.sbvr ./src/sbvr-api/dev.ts && balena-lint -t tsconfig.dev.json --fix ./src/sbvr-api/user.ts ./src/migrator/migrations.ts ./src/sbvr-api/dev.ts"
28
28
  },
29
29
  "dependencies": {
30
30
  "@balena/abstract-sql-compiler": "^9.2.0",
31
- "@balena/abstract-sql-to-typescript": "^3.2.1",
31
+ "@balena/abstract-sql-to-typescript": "^3.3.1",
32
32
  "@balena/env-parsing": "^1.1.12",
33
33
  "@balena/lf-to-abstract-sql": "^5.0.2",
34
34
  "@balena/odata-parser": "^3.0.8",
35
35
  "@balena/odata-to-abstract-sql": "^6.2.7",
36
- "@balena/sbvr-parser": "^1.4.4",
36
+ "@balena/sbvr-parser": "^1.4.5",
37
37
  "@balena/sbvr-types": "^8.0.0",
38
38
  "@types/body-parser": "^1.19.5",
39
39
  "@types/compression": "^1.7.5",
@@ -41,12 +41,12 @@
41
41
  "@types/deep-freeze": "^0.1.5",
42
42
  "@types/express": "^4.17.21",
43
43
  "@types/express-session": "^1.18.0",
44
- "@types/lodash": "^4.17.5",
44
+ "@types/lodash": "^4.17.7",
45
45
  "@types/memoizee": "^0.4.11",
46
46
  "@types/method-override": "^0.0.35",
47
47
  "@types/multer": "^1.4.11",
48
48
  "@types/mysql": "^2.15.26",
49
- "@types/node": "^20.14.5",
49
+ "@types/node": "^20.14.11",
50
50
  "@types/passport": "^1.0.16",
51
51
  "@types/passport-local": "^1.0.38",
52
52
  "@types/passport-strategy": "^0.2.38",
@@ -60,18 +60,18 @@
60
60
  "express-session": "^1.18.0",
61
61
  "lodash": "^4.17.21",
62
62
  "memoizee": "^0.4.17",
63
- "pinejs-client-core": "^6.15.1",
63
+ "pinejs-client-core": "^6.15.10",
64
64
  "randomstring": "^1.3.0",
65
65
  "typed-error": "^3.2.2"
66
66
  },
67
67
  "devDependencies": {
68
- "@balena/lint": "^8.0.2",
68
+ "@balena/lint": "^8.2.7",
69
69
  "@faker-js/faker": "^8.4.1",
70
70
  "@types/busboy": "^1.5.4",
71
71
  "@types/chai": "^4.3.16",
72
72
  "@types/chai-as-promised": "^7.1.8",
73
73
  "@types/grunt": "^0.4.31",
74
- "@types/mocha": "^10.0.6",
74
+ "@types/mocha": "^10.0.7",
75
75
  "@types/on-finished": "^2.3.4",
76
76
  "@types/request": "^2.48.12",
77
77
  "@types/supertest": "^6.0.2",
@@ -81,7 +81,7 @@
81
81
  "chai": "^4.4.1",
82
82
  "grunt": "^1.6.1",
83
83
  "grunt-check-dependencies": "^1.0.0",
84
- "grunt-cli": "^1.4.3",
84
+ "grunt-cli": "^1.5.0",
85
85
  "grunt-contrib-clean": "^2.0.1",
86
86
  "grunt-contrib-concat": "^2.1.0",
87
87
  "grunt-contrib-copy": "^1.0.0",
@@ -90,12 +90,12 @@
90
90
  "grunt-text-replace": "^0.4.0",
91
91
  "grunt-ts": "^6.0.0-beta.22",
92
92
  "grunt-webpack": "^6.0.0",
93
- "husky": "^9.0.11",
93
+ "husky": "^9.1.1",
94
94
  "lint-staged": "^15.2.7",
95
95
  "load-grunt-tasks": "^5.1.0",
96
- "mocha": "^10.4.0",
96
+ "mocha": "^10.7.0",
97
97
  "on-finished": "^2.4.1",
98
- "pinejs-client-supertest": "^2.0.4",
98
+ "pinejs-client-supertest": "^2.1.1",
99
99
  "raw-loader": "^4.0.2",
100
100
  "request": "^2.88.2",
101
101
  "require-npm4-to-publish": "^1.0.0",
@@ -103,14 +103,14 @@
103
103
  "terser-webpack-plugin": "^5.3.10",
104
104
  "ts-loader": "^9.5.1",
105
105
  "ts-node": "^10.9.2",
106
- "typescript": "^5.5.2",
107
- "webpack": "^5.92.0",
106
+ "typescript": "^5.5.3",
107
+ "webpack": "^5.93.0",
108
108
  "webpack-dev-server": "^4.15.2"
109
109
  },
110
110
  "optionalDependencies": {
111
- "@aws-sdk/client-s3": "^3.598.0",
112
- "@aws-sdk/lib-storage": "^3.598.0",
113
- "@aws-sdk/s3-request-presigner": "^3.598.0",
111
+ "@aws-sdk/client-s3": "^3.614.0",
112
+ "@aws-sdk/lib-storage": "^3.616.0",
113
+ "@aws-sdk/s3-request-presigner": "^3.616.0",
114
114
  "bcrypt": "^5.1.1",
115
115
  "body-parser": "^1.20.2",
116
116
  "compression": "^1.7.4",
@@ -146,6 +146,6 @@
146
146
  "recursive": true
147
147
  },
148
148
  "versionist": {
149
- "publishedAt": "2024-07-25T13:01:58.899Z"
149
+ "publishedAt": "2024-07-30T11:31:08.392Z"
150
150
  }
151
151
  }
package/src/bin/utils.ts CHANGED
@@ -92,7 +92,7 @@ export const getAbstractSqlModelFromFile = (
92
92
  }
93
93
  const configModel = getConfigModel(fileContents, modelName);
94
94
  if ('abstractSql' in configModel && configModel.abstractSql != null) {
95
- return configModel.abstractSql as AbstractSqlModel;
95
+ return configModel.abstractSql;
96
96
  } else if ('modelText' in configModel && configModel.modelText != null) {
97
97
  seModel = configModel.modelText;
98
98
  } else if ('modelFile' in configModel && configModel.modelFile != null) {
@@ -423,7 +423,7 @@ export abstract class Tx {
423
423
  /* eslint-disable @typescript-eslint/no-unused-vars */
424
424
  _namespaceKey: string,
425
425
  _key: number,
426
- _blocking: boolean = true,
426
+ _blocking = true,
427
427
  /* eslint-enable @typescript-eslint/no-unused-vars */
428
428
  ): Promise<boolean> {
429
429
  throw new Error(
@@ -663,7 +663,7 @@ if (maybePg != null) {
663
663
  public override async getTxLevelLock(
664
664
  namespaceKey: string,
665
665
  key: number,
666
- blocking: boolean = true,
666
+ blocking = true,
667
667
  ) {
668
668
  validateTransactionLockParameter(key, 'key');
669
669
  const namespaceId = transactionLockNamespaceMap[namespaceKey];
@@ -693,7 +693,7 @@ if (maybePg != null) {
693
693
  }
694
694
  }
695
695
 
696
- public async tableList(extraWhereClause: string = '') {
696
+ public async tableList(extraWhereClause = '') {
697
697
  if (extraWhereClause !== '') {
698
698
  extraWhereClause = 'WHERE ' + extraWhereClause;
699
699
  }
@@ -811,7 +811,7 @@ if (maybeMysql != null) {
811
811
  await promise;
812
812
  }
813
813
 
814
- public async tableList(extraWhereClause: string = '') {
814
+ public async tableList(extraWhereClause = '') {
815
815
  if (extraWhereClause !== '') {
816
816
  extraWhereClause = ' WHERE ' + extraWhereClause;
817
817
  }
@@ -834,14 +834,18 @@ if (maybeMysql != null) {
834
834
  executeSql: atomicExecuteSql,
835
835
  transaction: createTransaction(async (stackTraceErr, timeoutMS) => {
836
836
  const client = await getConnectionAsync();
837
- const close = () => client.release();
837
+ const close = () => {
838
+ client.release();
839
+ };
838
840
  const tx = new MySqlTx(client, close, false, stackTraceErr, timeoutMS);
839
841
  void tx.executeSql('START TRANSACTION;');
840
842
  return tx;
841
843
  }),
842
844
  readTransaction: createTransaction(async (stackTraceErr, timeoutMS) => {
843
845
  const client = await getConnectionAsync();
844
- const close = () => client.release();
846
+ const close = () => {
847
+ client.release();
848
+ };
845
849
  const tx = new MySqlTx(client, close, false, stackTraceErr, timeoutMS);
846
850
  void tx.executeSql('START TRANSACTION READ ONLY;');
847
851
  return tx.asReadOnly();
@@ -926,14 +930,14 @@ if (typeof window !== 'undefined' && window.openDatabase != null) {
926
930
  }
927
931
 
928
932
  protected async _rollback(): Promise<void> {
929
- return await this.tx.rollback();
933
+ await this.tx.rollback();
930
934
  }
931
935
 
932
936
  protected async _commit() {
933
937
  this.tx.commit();
934
938
  }
935
939
 
936
- public async tableList(extraWhereClause: string = '') {
940
+ public async tableList(extraWhereClause = '') {
937
941
  if (extraWhereClause !== '') {
938
942
  extraWhereClause = ' AND ' + extraWhereClause;
939
943
  }
@@ -987,7 +991,7 @@ if (typeof window !== 'undefined' && window.openDatabase != null) {
987
991
  }
988
992
 
989
993
  public async rollback(): Promise<void> {
990
- return await new Promise((resolve) => {
994
+ await new Promise<void>((resolve) => {
991
995
  const successCallback: SQLStatementCallback = () => {
992
996
  resolve();
993
997
  throw new Error('Rollback');
@@ -80,7 +80,7 @@ const app = (function () {
80
80
  },
81
81
  };
82
82
  console.log(method, uri, body);
83
- if (uri.slice(-1) === '/') {
83
+ if (uri.endsWith('/')) {
84
84
  uri = uri.slice(0, uri.length - 1);
85
85
  }
86
86
  uri = uri.toLowerCase();
@@ -142,10 +142,7 @@ const app = (function () {
142
142
  const checkMethodHandlers = () => {
143
143
  i++;
144
144
  if (i < methodHandlers.length) {
145
- if (
146
- uri.slice(0, methodHandlers[i].match.length) ===
147
- methodHandlers[i].match
148
- ) {
145
+ if (uri.startsWith(methodHandlers[i].match)) {
149
146
  j = -1;
150
147
  // Reset params that may have been added on previous routes that failed in middleware
151
148
  req.params = {};
@@ -1,4 +1,4 @@
1
- // These types were generated by @balena/abstract-sql-to-typescript v3.3.0
1
+ // These types were generated by @balena/abstract-sql-to-typescript v3.3.1
2
2
 
3
3
  import type { Types } from '@balena/abstract-sql-to-typescript';
4
4
 
@@ -12,11 +12,7 @@ export const mountLoginRouter = async (
12
12
  configLoader.loadConfig(PinejsSessionStore.config),
13
13
  ]);
14
14
 
15
- if (
16
- typeof process === 'undefined' ||
17
- process == null ||
18
- !process.env.DISABLE_DEFAULT_AUTH
19
- ) {
15
+ if (typeof process === 'undefined' || !process?.env.DISABLE_DEFAULT_AUTH) {
20
16
  expressApp.post(
21
17
  '/login',
22
18
  passportPinejs.login((err, user, req, res) => {
@@ -68,7 +68,8 @@ const setup: ConfigLoader.SetupFunction = (app: Express.Application) => {
68
68
  logout = (req, _res, next) => {
69
69
  req.logout((error) => {
70
70
  if (error) {
71
- return next(error);
71
+ next(error);
72
+ return;
72
73
  }
73
74
  next();
74
75
  });
@@ -83,7 +84,7 @@ const setup: ConfigLoader.SetupFunction = (app: Express.Application) => {
83
84
  next();
84
85
  });
85
86
 
86
- login = (fn) => (req, res, next) =>
87
+ login = (fn) => (req, res, next) => {
87
88
  checkPassword(req.body.username, req.body.password, (err, user) => {
88
89
  if (user) {
89
90
  loggedIn = true;
@@ -91,6 +92,7 @@ const setup: ConfigLoader.SetupFunction = (app: Express.Application) => {
91
92
  }
92
93
  fn(err, user, req, res, next);
93
94
  });
95
+ };
94
96
 
95
97
  logout = (req, _res, next) => {
96
98
  delete req.user;
@@ -153,7 +153,7 @@ export class PinejsSessionStore extends Store {
153
153
  },
154
154
  },
155
155
  },
156
- }) as Promise<number>,
156
+ }),
157
157
  );
158
158
  }) as Store['length'];
159
159
 
@@ -77,7 +77,7 @@ export const getAndCheckBindValues = async (
77
77
  const sqlModelTables = sbvrUtils.getAbstractSqlModel(request).tables;
78
78
  return await Promise.all(
79
79
  bindings.map(async (binding) => {
80
- let fieldName: string = '';
80
+ let fieldName = '';
81
81
  let field: { dataType: string };
82
82
  let value: any;
83
83
  if (binding[0] === 'Bind') {
@@ -1,4 +1,4 @@
1
- // These types were generated by @balena/abstract-sql-to-typescript v3.3.0
1
+ // These types were generated by @balena/abstract-sql-to-typescript v3.3.1
2
2
 
3
3
  import type { Types } from '@balena/abstract-sql-to-typescript';
4
4
 
@@ -101,7 +101,7 @@ class Hook<T extends HookFn> {
101
101
 
102
102
  class SideEffectHook<T extends HookFn> extends Hook<T> {
103
103
  private rollbackFns: RollbackAction[] = [];
104
- private rolledBack: boolean = false;
104
+ private rolledBack = false;
105
105
 
106
106
  public registerRollback(fn: RollbackAction): void {
107
107
  if (this.rolledBack) {
@@ -243,7 +243,9 @@ export const getHooks = (
243
243
  ),
244
244
  );
245
245
  };
246
- getHooks.clear = () => getMethodHooks.clear();
246
+ getHooks.clear = () => {
247
+ getMethodHooks.clear();
248
+ };
247
249
 
248
250
  interface VocabHooks {
249
251
  [resourceName: string]: HookBlueprints;
@@ -339,7 +341,7 @@ export const addHook = <Vocab extends string>(
339
341
  const hook = hooks[hookType];
340
342
  resourceHooks[hookType] ??= [];
341
343
  if (hook != null) {
342
- resourceHooks[hookType]!.push(hook);
344
+ resourceHooks[hookType].push(hook);
343
345
  }
344
346
  }
345
347
 
@@ -334,12 +334,7 @@ const getPermissionsLookup = env.createCache(
334
334
  permissionsLookup[target] = true;
335
335
  } else if (permissionsLookup[target] !== true) {
336
336
  permissionsLookup[target] ??= [];
337
- (
338
- permissionsLookup[target] as Exclude<
339
- PermissionLookup[typeof target],
340
- true
341
- >
342
- ).push(condition);
337
+ permissionsLookup[target].push(condition);
343
338
  }
344
339
  }
345
340
  // Ensure there are no duplicate conditions as applying both would be wasteful
@@ -946,7 +941,7 @@ const rewriteRelationships = (
946
941
  );
947
942
 
948
943
  const newRelationships = _.cloneDeep(relationships);
949
- _.forOwn(newRelationships, (value, name) =>
944
+ _.forOwn(newRelationships, (value, name) => {
950
945
  rewriteRelationship(
951
946
  value,
952
947
  name,
@@ -954,8 +949,8 @@ const rewriteRelationships = (
954
949
  permissionsLookup,
955
950
  vocabulary,
956
951
  odata2AbstractSQL,
957
- ),
958
- );
952
+ );
953
+ });
959
954
 
960
955
  return newRelationships;
961
956
  };
@@ -1640,7 +1635,7 @@ const getReqPermissions = async (
1640
1635
  if (req.user?.permissions != null) {
1641
1636
  addActorPermissions(req.user.actor, req.user.permissions);
1642
1637
  } else if (req.apiKey?.permissions != null) {
1643
- addActorPermissions(req.apiKey.actor!, req.apiKey.permissions);
1638
+ addActorPermissions(req.apiKey.actor, req.apiKey.permissions);
1644
1639
  }
1645
1640
 
1646
1641
  return getPermissionsLookup(actorPermissions, guestPermissions);
@@ -209,7 +209,7 @@ const memoizedResolveNavigationResource = memoizeWeak(
209
209
  const mapping = _.get(
210
210
  abstractSqlModel.relationships[resolvedResourceName],
211
211
  navigation,
212
- ) as undefined | AbstractSQLCompiler.RelationshipMapping;
212
+ );
213
213
  if (mapping == null) {
214
214
  throw new Error(
215
215
  `Cannot navigate from '${resourceName}' to '${navigationName}'`,
@@ -701,7 +701,7 @@ export const executeModels = async (
701
701
  compiledModels.map(async (model: CompiledModel) => {
702
702
  const updateModel = async (modelType: keyof CompiledModel) => {
703
703
  if (model[modelType] == null) {
704
- return await api.dev.delete({
704
+ await api.dev.delete({
705
705
  resource: 'model',
706
706
  passthrough: {
707
707
  tx,
@@ -714,6 +714,7 @@ export const executeModels = async (
714
714
  },
715
715
  },
716
716
  });
717
+ return;
717
718
  }
718
719
  const result = await api.dev.get({
719
720
  resource: 'model',
@@ -1054,7 +1055,7 @@ export class PinejsClient<
1054
1055
  url: NonNullable<Params<T>['url']>;
1055
1056
  } & Params<T>,
1056
1057
  ): Promise<AnyObject>;
1057
- public post(params: Params<AnyResource>): Promise<AnyObject> {
1058
+ public post(params: Params): Promise<AnyObject> {
1058
1059
  return super.post(params as Parameters<PinejsClient['post']>[0]);
1059
1060
  }
1060
1061
  }
@@ -1458,7 +1459,8 @@ export const getApiRoot = (req: Express.Request): string | undefined => {
1458
1459
  export const handleODataRequest: Express.Handler = async (req, res, next) => {
1459
1460
  const apiRoot = getApiRoot(req);
1460
1461
  if (apiRoot == null || models[apiRoot] == null) {
1461
- return next('route');
1462
+ next('route');
1463
+ return;
1462
1464
  }
1463
1465
 
1464
1466
  try {
@@ -1521,7 +1523,7 @@ export const handleHttpErrors = (
1521
1523
  return false;
1522
1524
  };
1523
1525
  const handleResponse = (res: Express.Response, response: Response): void => {
1524
- const { body, headers, statusCode } = response as Response;
1526
+ const { body, headers, statusCode } = response;
1525
1527
  res.set(headers);
1526
1528
  res.status(statusCode);
1527
1529
  if (!body) {
@@ -1751,7 +1753,7 @@ const runQuery = async (
1751
1753
  tx: Db.Tx,
1752
1754
  request: uriParser.ODataRequest,
1753
1755
  queryIndex?: number,
1754
- addReturning: boolean = false,
1756
+ addReturning = false,
1755
1757
  ): Promise<Db.Result> => {
1756
1758
  const { vocabulary } = request;
1757
1759
  let { sqlQuery } = request;
@@ -208,7 +208,7 @@ export const translateAbstractSqlModel = (
208
208
  const { $toResource, ...definition } = translationDefinition;
209
209
  const hasToResource = typeof $toResource === 'string';
210
210
  if (hasToResource) {
211
- resourceRenames[key] = `${$toResource}`;
211
+ resourceRenames[key] = $toResource;
212
212
  }
213
213
  const toResource = hasToResource ? $toResource : `${key}$${toVersion}`;
214
214
  // TODO: Should this use the toAbstractSqlModel?
@@ -282,7 +282,7 @@ export function parseOData(
282
282
  // We sort the CS set once, we must assure that requests which reference
283
283
  // other requests in the changeset are placed last. Once they are sorted
284
284
  // Map will guarantee retrival of results in insertion order
285
- const sortedCS = _.sortBy(b.changeSet, (el) => el.url[0] !== '/');
285
+ const sortedCS = _.sortBy(b.changeSet, (el) => !el.url.startsWith('/'));
286
286
  const csReferences = new Map<
287
287
  ParsedODataRequest['id'],
288
288
  ParsedODataRequest
@@ -338,7 +338,7 @@ const parseODataChangeset = (
338
338
  let apiRoot: string;
339
339
  let url;
340
340
 
341
- if (b.url[0] === '/') {
341
+ if (b.url.startsWith('/')) {
342
342
  ({ url, apiRoot } = splitApiRoot(b.url));
343
343
  odata = memoizedParseOdata(url);
344
344
  defer = false;
@@ -1,4 +1,4 @@
1
- // These types were generated by @balena/abstract-sql-to-typescript v3.3.0
1
+ // These types were generated by @balena/abstract-sql-to-typescript v3.3.1
2
2
 
3
3
  import type { Types } from '@balena/abstract-sql-to-typescript';
4
4
 
@@ -116,7 +116,8 @@ export const getUploaderMiddlware = (
116
116
  ): Express.RequestHandler => {
117
117
  return (req, res, next) => {
118
118
  if (!req.is('multipart')) {
119
- return next();
119
+ next();
120
+ return;
120
121
  }
121
122
  const uploadedFilePaths: string[] = [];
122
123
  const completeUploads: Array<Promise<void>> = [];