@balena/pinejs 16.0.0-build--batch-f2ffc3d6bcb9f3294fd4fc9de3c21bfe167e100d-1 → 16.0.0-build-fisehara-update-sbvr-types-b58e72aca3193964afac96c955fde178fe39d077-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 (141) hide show
  1. package/.pinejs-cache.json +1 -1
  2. package/.versionbot/CHANGELOG.yml +2168 -11
  3. package/CHANGELOG.md +815 -2
  4. package/Gruntfile.ts +9 -6
  5. package/README.md +10 -0
  6. package/build/browser.ts +2 -2
  7. package/build/config.ts +1 -1
  8. package/build/module.ts +2 -2
  9. package/build/server.ts +2 -2
  10. package/docker-compose.npm-test.yml +21 -3
  11. package/out/bin/abstract-sql-compiler.js +5 -5
  12. package/out/bin/abstract-sql-compiler.js.map +1 -1
  13. package/out/bin/odata-compiler.js +10 -10
  14. package/out/bin/odata-compiler.js.map +1 -1
  15. package/out/bin/sbvr-compiler.js +34 -11
  16. package/out/bin/sbvr-compiler.js.map +1 -1
  17. package/out/bin/utils.js +25 -2
  18. package/out/bin/utils.js.map +1 -1
  19. package/out/config-loader/config-loader.d.ts +4 -2
  20. package/out/config-loader/config-loader.js +54 -13
  21. package/out/config-loader/config-loader.js.map +1 -1
  22. package/out/config-loader/env.d.ts +2 -1
  23. package/out/config-loader/env.js +5 -2
  24. package/out/config-loader/env.js.map +1 -1
  25. package/out/data-server/sbvr-server.d.ts +1 -1
  26. package/out/data-server/sbvr-server.js +3 -1
  27. package/out/data-server/sbvr-server.js.map +1 -1
  28. package/out/database-layer/db.js +40 -14
  29. package/out/database-layer/db.js.map +1 -1
  30. package/out/express-emulator/express.js +5 -3
  31. package/out/express-emulator/express.js.map +1 -1
  32. package/out/http-transactions/transactions.d.ts +1 -1
  33. package/out/http-transactions/transactions.js +10 -5
  34. package/out/http-transactions/transactions.js.map +1 -1
  35. package/out/migrator/async.js +32 -5
  36. package/out/migrator/async.js.map +1 -1
  37. package/out/migrator/sync.d.ts +2 -1
  38. package/out/migrator/sync.js +29 -3
  39. package/out/migrator/sync.js.map +1 -1
  40. package/out/migrator/utils.d.ts +6 -3
  41. package/out/migrator/utils.js +30 -4
  42. package/out/migrator/utils.js.map +1 -1
  43. package/out/odata-metadata/odata-metadata-generator.js +4 -1
  44. package/out/odata-metadata/odata-metadata-generator.js.map +1 -1
  45. package/out/passport-pinejs/mount-login-router.d.ts +3 -0
  46. package/out/passport-pinejs/mount-login-router.js +65 -0
  47. package/out/passport-pinejs/mount-login-router.js.map +1 -0
  48. package/out/passport-pinejs/passport-pinejs.d.ts +2 -1
  49. package/out/passport-pinejs/passport-pinejs.js +28 -2
  50. package/out/passport-pinejs/passport-pinejs.js.map +1 -1
  51. package/out/pinejs-session-store/pinejs-session-store.js +30 -7
  52. package/out/pinejs-session-store/pinejs-session-store.js.map +1 -1
  53. package/out/sbvr-api/abstract-sql.d.ts +2 -2
  54. package/out/sbvr-api/abstract-sql.js +35 -9
  55. package/out/sbvr-api/abstract-sql.js.map +1 -1
  56. package/out/sbvr-api/cached-compile.js +9 -6
  57. package/out/sbvr-api/cached-compile.js.map +1 -1
  58. package/out/sbvr-api/common-types.d.ts +1 -1
  59. package/out/sbvr-api/control-flow.js +5 -2
  60. package/out/sbvr-api/control-flow.js.map +1 -1
  61. package/out/sbvr-api/express-extension.d.ts +10 -7
  62. package/out/sbvr-api/express-extension.js +1 -0
  63. package/out/sbvr-api/hooks.d.ts +5 -1
  64. package/out/sbvr-api/hooks.js +12 -10
  65. package/out/sbvr-api/hooks.js.map +1 -1
  66. package/out/sbvr-api/odata-response.d.ts +5 -2
  67. package/out/sbvr-api/odata-response.js +36 -6
  68. package/out/sbvr-api/odata-response.js.map +1 -1
  69. package/out/sbvr-api/permissions.d.ts +6 -7
  70. package/out/sbvr-api/permissions.js +69 -38
  71. package/out/sbvr-api/permissions.js.map +1 -1
  72. package/out/sbvr-api/sbvr-utils.d.ts +20 -9
  73. package/out/sbvr-api/sbvr-utils.js +134 -136
  74. package/out/sbvr-api/sbvr-utils.js.map +1 -1
  75. package/out/sbvr-api/translations.d.ts +2 -2
  76. package/out/sbvr-api/translations.js +17 -10
  77. package/out/sbvr-api/translations.js.map +1 -1
  78. package/out/sbvr-api/uri-parser.d.ts +7 -10
  79. package/out/sbvr-api/uri-parser.js +46 -19
  80. package/out/sbvr-api/uri-parser.js.map +1 -1
  81. package/out/server-glue/global-ext.d.ts +2 -1
  82. package/out/server-glue/module.d.ts +3 -1
  83. package/out/server-glue/module.js +40 -13
  84. package/out/server-glue/module.js.map +1 -1
  85. package/out/server-glue/sbvr-loader.js.map +1 -1
  86. package/out/server-glue/server.js +31 -39
  87. package/out/server-glue/server.js.map +1 -1
  88. package/out/webresource-handler/handlers/NoopHandler.d.ts +7 -0
  89. package/out/webresource-handler/handlers/NoopHandler.js +20 -0
  90. package/out/webresource-handler/handlers/NoopHandler.js.map +1 -0
  91. package/out/webresource-handler/handlers/S3Handler.d.ts +28 -0
  92. package/out/webresource-handler/handlers/S3Handler.js +97 -0
  93. package/out/webresource-handler/handlers/S3Handler.js.map +1 -0
  94. package/out/webresource-handler/handlers/index.d.ts +2 -0
  95. package/out/webresource-handler/handlers/index.js +19 -0
  96. package/out/webresource-handler/handlers/index.js.map +1 -0
  97. package/out/webresource-handler/index.d.ts +34 -0
  98. package/out/webresource-handler/index.js +307 -0
  99. package/out/webresource-handler/index.js.map +1 -0
  100. package/package.json +68 -62
  101. package/src/bin/abstract-sql-compiler.ts +7 -9
  102. package/src/bin/odata-compiler.ts +12 -15
  103. package/src/bin/sbvr-compiler.ts +14 -18
  104. package/src/bin/utils.ts +1 -1
  105. package/src/config-loader/config-loader.ts +44 -10
  106. package/src/config-loader/env.ts +1 -1
  107. package/src/data-server/sbvr-server.js +3 -1
  108. package/src/database-layer/db.ts +23 -19
  109. package/src/express-emulator/express.js +5 -3
  110. package/src/extended-sbvr-parser/extended-sbvr-parser.ts +1 -1
  111. package/src/http-transactions/transactions.js +10 -5
  112. package/src/migrator/async.ts +7 -6
  113. package/src/migrator/sync.ts +10 -7
  114. package/src/migrator/utils.ts +11 -5
  115. package/src/odata-metadata/odata-metadata-generator.ts +2 -2
  116. package/src/passport-pinejs/mount-login-router.ts +46 -0
  117. package/src/passport-pinejs/passport-pinejs.ts +7 -3
  118. package/src/pinejs-session-store/pinejs-session-store.ts +6 -6
  119. package/src/sbvr-api/abstract-sql.ts +5 -5
  120. package/src/sbvr-api/cached-compile.ts +1 -2
  121. package/src/sbvr-api/common-types.ts +1 -1
  122. package/src/sbvr-api/control-flow.ts +1 -1
  123. package/src/sbvr-api/express-extension.ts +12 -8
  124. package/src/sbvr-api/hooks.ts +11 -11
  125. package/src/sbvr-api/odata-response.ts +56 -9
  126. package/src/sbvr-api/permissions.ts +44 -35
  127. package/src/sbvr-api/sbvr-utils.ts +118 -172
  128. package/src/sbvr-api/translations.ts +9 -6
  129. package/src/sbvr-api/uri-parser.ts +22 -28
  130. package/src/server-glue/global-ext.d.ts +2 -1
  131. package/src/server-glue/module.ts +8 -2
  132. package/src/server-glue/sbvr-loader.ts +1 -1
  133. package/src/server-glue/server.ts +11 -49
  134. package/src/webresource-handler/handlers/NoopHandler.ts +21 -0
  135. package/src/webresource-handler/handlers/S3Handler.ts +143 -0
  136. package/src/webresource-handler/handlers/index.ts +2 -0
  137. package/src/webresource-handler/index.ts +450 -0
  138. package/tsconfig.dev.json +2 -1
  139. package/tsconfig.json +1 -1
  140. package/typings/lf-to-abstract-sql.d.ts +1 -1
  141. package/typings/memoizee.d.ts +3 -4
@@ -0,0 +1,307 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
+ };
28
+ var __importDefault = (this && this.__importDefault) || function (mod) {
29
+ return (mod && mod.__esModule) ? mod : { "default": mod };
30
+ };
31
+ Object.defineProperty(exports, "__esModule", { value: true });
32
+ exports.setupUploadHooks = exports.getDefaultHandler = exports.normalizeHref = exports.getUploaderMiddlware = exports.getWebresourceHandler = exports.setupWebresourceHandler = exports.FileSizeExceededError = exports.WebResourceError = void 0;
33
+ const busboy_1 = __importDefault(require("busboy"));
34
+ const uriParser = __importStar(require("../sbvr-api/uri-parser"));
35
+ const sbvrUtils = __importStar(require("../sbvr-api/sbvr-utils"));
36
+ const sbvr_utils_1 = require("../sbvr-api/sbvr-utils");
37
+ const permissions_1 = require("../sbvr-api/permissions");
38
+ const NoopHandler_1 = require("./handlers/NoopHandler");
39
+ const odata_to_abstract_sql_1 = require("@balena/odata-to-abstract-sql");
40
+ const module_1 = require("../server-glue/module");
41
+ const typed_error_1 = require("typed-error");
42
+ __exportStar(require("./handlers"), exports);
43
+ class WebResourceError extends typed_error_1.TypedError {
44
+ }
45
+ exports.WebResourceError = WebResourceError;
46
+ class FileSizeExceededError extends WebResourceError {
47
+ constructor(maxSize) {
48
+ super(`File size exceeded the limit of ${maxSize} bytes.`);
49
+ this.name = 'FileSizeExceededError';
50
+ }
51
+ }
52
+ exports.FileSizeExceededError = FileSizeExceededError;
53
+ const getLogger = (vocab) => {
54
+ if (vocab) {
55
+ return sbvrUtils.api[vocab]?.logger ?? console;
56
+ }
57
+ return console;
58
+ };
59
+ let configuredWebResourceHandler;
60
+ const setupWebresourceHandler = (handler) => {
61
+ configuredWebResourceHandler = handler;
62
+ };
63
+ exports.setupWebresourceHandler = setupWebresourceHandler;
64
+ const getWebresourceHandler = () => {
65
+ return configuredWebResourceHandler;
66
+ };
67
+ exports.getWebresourceHandler = getWebresourceHandler;
68
+ const isFileInValidPath = async (fieldname, req) => {
69
+ if (req.method !== 'POST' && req.method !== 'PATCH') {
70
+ return false;
71
+ }
72
+ const apiRoot = (0, sbvr_utils_1.getApiRoot)(req);
73
+ if (apiRoot == null) {
74
+ return false;
75
+ }
76
+ const model = (0, sbvr_utils_1.getModel)(apiRoot);
77
+ const odataRequest = uriParser.parseOData({
78
+ url: req.url,
79
+ method: req.method,
80
+ });
81
+ const sqlResourceName = sbvrUtils.resolveSynonym(odataRequest);
82
+ const table = model.abstractSql.tables[sqlResourceName];
83
+ if (table == null) {
84
+ return false;
85
+ }
86
+ const permission = req.method === 'POST' ? 'create' : 'update';
87
+ const vocab = model.versions[model.versions.length - 1];
88
+ const hasPermissions = await (0, permissions_1.checkPermissions)(req, permission, odataRequest.resourceName, vocab);
89
+ if (!hasPermissions) {
90
+ return false;
91
+ }
92
+ const dbFieldName = (0, odata_to_abstract_sql_1.odataNameToSqlName)(fieldname);
93
+ return table.fields.some((field) => field.fieldName === dbFieldName && field.dataType === 'WebResource');
94
+ };
95
+ const getUploaderMiddlware = (handler) => {
96
+ return async (req, res, next) => {
97
+ if (!req.is('multipart')) {
98
+ return next();
99
+ }
100
+ const uploadedFilePaths = [];
101
+ const completeUploads = [];
102
+ const bb = (0, busboy_1.default)({ headers: req.headers });
103
+ let isAborting = false;
104
+ const finishFileUpload = () => {
105
+ req.unpipe(bb);
106
+ req.on('readable', req.read.bind(req));
107
+ bb.removeAllListeners();
108
+ };
109
+ const clearFiles = async () => {
110
+ isAborting = true;
111
+ const deletions = uploadedFilePaths.map((file) => handler.removeFile(file));
112
+ try {
113
+ return await Promise.all(deletions);
114
+ }
115
+ catch (err) {
116
+ getLogger((0, sbvr_utils_1.getApiRoot)(req)).error('Error deleting file', err);
117
+ }
118
+ };
119
+ bb.on('file', (fieldname, filestream, info) => {
120
+ if (isAborting) {
121
+ filestream.resume();
122
+ return;
123
+ }
124
+ completeUploads.push((async () => {
125
+ try {
126
+ if (!(await isFileInValidPath(fieldname, req))) {
127
+ filestream.resume();
128
+ return;
129
+ }
130
+ const file = {
131
+ originalname: info.filename,
132
+ encoding: info.encoding,
133
+ mimetype: info.mimeType,
134
+ stream: filestream,
135
+ fieldname,
136
+ };
137
+ const result = await handler.handleFile(file);
138
+ req.body[fieldname] = {
139
+ filename: info.filename,
140
+ content_type: info.mimeType,
141
+ content_disposition: undefined,
142
+ size: result.size,
143
+ href: result.filename,
144
+ };
145
+ uploadedFilePaths.push(result.filename);
146
+ }
147
+ catch (err) {
148
+ filestream.resume();
149
+ throw err;
150
+ }
151
+ })());
152
+ });
153
+ bb.on('field', (name, val) => {
154
+ req.body[name] = val;
155
+ });
156
+ bb.on('finish', async () => {
157
+ try {
158
+ await Promise.all(completeUploads);
159
+ finishFileUpload();
160
+ next();
161
+ }
162
+ catch (err) {
163
+ await clearFiles();
164
+ if (err instanceof FileSizeExceededError) {
165
+ return sbvrUtils.handleHttpErrors(req, res, new module_1.errors.BadRequestError(err.message));
166
+ }
167
+ getLogger((0, sbvr_utils_1.getApiRoot)(req)).error('Error uploading file', err);
168
+ next(err);
169
+ }
170
+ });
171
+ bb.on('error', async (err) => {
172
+ await clearFiles();
173
+ finishFileUpload();
174
+ next(err);
175
+ });
176
+ req.pipe(bb);
177
+ };
178
+ };
179
+ exports.getUploaderMiddlware = getUploaderMiddlware;
180
+ const getWebResourceFields = (request, useTranslations = true) => {
181
+ const resourceName = sbvrUtils.resolveSynonym(request);
182
+ const sqlResourceName = (0, odata_to_abstract_sql_1.odataNameToSqlName)(resourceName);
183
+ const model = sbvrUtils.getAbstractSqlModel(request).tables[sqlResourceName];
184
+ const fields = useTranslations
185
+ ? model.modifyFields ?? model.fields
186
+ : model.fields;
187
+ return fields
188
+ .filter((f) => f.dataType === 'WebResource')
189
+ .map((f) => (0, odata_to_abstract_sql_1.sqlNameToODataName)(f.fieldName));
190
+ };
191
+ const deleteFiles = async (keysToDelete, webResourceHandler) => {
192
+ const promises = keysToDelete.map((r) => webResourceHandler.removeFile(r));
193
+ await Promise.all(promises);
194
+ };
195
+ const throwIfWebresourceNotInMultipart = (webResourceFields, { req, request }) => {
196
+ if (!req.is?.('multipart') &&
197
+ webResourceFields.some((field) => request.values[field] != null)) {
198
+ throw new module_1.errors.BadRequestError('Use multipart requests to upload a file.');
199
+ }
200
+ };
201
+ const getCreateWebResourceHooks = (webResourceHandler) => {
202
+ return {
203
+ PRERUN: (hookArgs) => {
204
+ const webResourceFields = getWebResourceFields(hookArgs.request);
205
+ throwIfWebresourceNotInMultipart(webResourceFields, hookArgs);
206
+ },
207
+ 'POSTRUN-ERROR': async ({ tx, request }) => {
208
+ tx.on('rollback', () => {
209
+ void deleteRollbackPendingFields(request, webResourceHandler);
210
+ });
211
+ },
212
+ };
213
+ };
214
+ const isDefined = (x) => x != null;
215
+ const getWebResourcesHrefs = (webResources) => {
216
+ const hrefs = (webResources ?? []).flatMap((resource) => Object.values(resource ?? {})
217
+ .filter(isDefined)
218
+ .map((resourceKey) => (0, exports.normalizeHref)(resourceKey.href)));
219
+ return hrefs;
220
+ };
221
+ const normalizeHref = (href) => {
222
+ return href.split('?')[0];
223
+ };
224
+ exports.normalizeHref = normalizeHref;
225
+ const getWebResourcesKeysFromRequest = (webResourceFields, { values }) => {
226
+ return webResourceFields
227
+ .map((field) => values[field]?.href)
228
+ .filter(isDefined);
229
+ };
230
+ const getRemoveWebResourceHooks = (webResourceHandler) => {
231
+ return {
232
+ PRERUN: async (args) => {
233
+ const { api, request, tx } = args;
234
+ let webResourceFields = getWebResourceFields(request);
235
+ throwIfWebresourceNotInMultipart(webResourceFields, args);
236
+ tx.on('rollback', () => {
237
+ void deleteRollbackPendingFields(request, webResourceHandler);
238
+ });
239
+ if (request.method === 'PATCH') {
240
+ webResourceFields = Object.entries(request.values)
241
+ .filter(([key, value]) => value !== undefined && webResourceFields.includes(key))
242
+ .map(([key]) => key);
243
+ }
244
+ if (webResourceFields.length === 0) {
245
+ return;
246
+ }
247
+ if (request.method === 'PATCH' && request.odataQuery?.key == null) {
248
+ const keysToDelete = getWebResourcesKeysFromRequest(webResourceFields, request);
249
+ tx.on('end', () => {
250
+ deletePendingFiles(keysToDelete, request, webResourceHandler);
251
+ });
252
+ throw new module_1.errors.BadRequestError('WebResources can only be updated when providing a resource key.');
253
+ }
254
+ const ids = await sbvrUtils.getAffectedIds(args);
255
+ if (ids.length === 0) {
256
+ const keysToDelete = getWebResourcesKeysFromRequest(webResourceFields, request);
257
+ deletePendingFiles(keysToDelete, request, webResourceHandler);
258
+ return;
259
+ }
260
+ const webResources = (await api.get({
261
+ resource: request.resourceName,
262
+ passthrough: {
263
+ tx: args.tx,
264
+ req: module_1.permissions.root,
265
+ },
266
+ options: {
267
+ $select: webResourceFields,
268
+ $filter: {
269
+ id: {
270
+ $in: ids,
271
+ },
272
+ },
273
+ },
274
+ }));
275
+ tx.on('end', () => {
276
+ deletePendingFiles(getWebResourcesHrefs(webResources), request, webResourceHandler);
277
+ });
278
+ },
279
+ };
280
+ };
281
+ const deleteRollbackPendingFields = async (request, webResourceHandler) => {
282
+ const fields = getWebResourceFields(request);
283
+ if (fields.length === 0) {
284
+ return;
285
+ }
286
+ const keysToDelete = getWebResourcesKeysFromRequest(fields, request);
287
+ await deleteFiles(keysToDelete, webResourceHandler);
288
+ };
289
+ const deletePendingFiles = (keysToDelete, request, webResourceHandler) => {
290
+ try {
291
+ void deleteFiles(keysToDelete, webResourceHandler);
292
+ }
293
+ catch (err) {
294
+ getLogger(request.vocabulary).error(`Failed to delete pending files`, err);
295
+ }
296
+ };
297
+ const getDefaultHandler = () => {
298
+ return new NoopHandler_1.NoopHandler();
299
+ };
300
+ exports.getDefaultHandler = getDefaultHandler;
301
+ const setupUploadHooks = (handler, apiRoot, resourceName) => {
302
+ sbvrUtils.addPureHook('DELETE', apiRoot, resourceName, getRemoveWebResourceHooks(handler));
303
+ sbvrUtils.addPureHook('PATCH', apiRoot, resourceName, getRemoveWebResourceHooks(handler));
304
+ sbvrUtils.addPureHook('POST', apiRoot, resourceName, getCreateWebResourceHooks(handler));
305
+ };
306
+ exports.setupUploadHooks = setupUploadHooks;
307
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/webresource-handler/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,oDAA4B;AAE5B,kEAAoD;AACpD,kEAAoD;AAEpD,uDAA8D;AAC9D,yDAA2D;AAC3D,wDAAqD;AACrD,yEAGuC;AACvC,kDAA4D;AAE5D,6CAAyC;AAEzC,6CAA2B;AAqB3B,MAAa,gBAAiB,SAAQ,wBAAU;CAAG;AAAnD,4CAAmD;AAEnD,MAAa,qBAAsB,SAAQ,gBAAgB;IAE1D,YAAY,OAAe;QAC1B,KAAK,CAAC,mCAAmC,OAAO,SAAS,CAAC,CAAC;QAF5D,SAAI,GAAG,uBAAuB,CAAC;IAG/B,CAAC;CACD;AALD,sDAKC;AAMD,MAAM,SAAS,GAAG,CAAC,KAAc,EAAW,EAAE;IAC7C,IAAI,KAAK,EAAE,CAAC;QACX,OAAO,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,MAAM,IAAI,OAAO,CAAC;IAChD,CAAC;IACD,OAAO,OAAO,CAAC;AAChB,CAAC,CAAC;AAEF,IAAI,4BAA4D,CAAC;AAC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@@
1
1
  {
2
2
  "name": "@balena/pinejs",
3
- "version": "16.0.0-build--batch-f2ffc3d6bcb9f3294fd4fc9de3c21bfe167e100d-1",
3
+ "version": "16.0.0-build-fisehara-update-sbvr-types-b58e72aca3193964afac96c955fde178fe39d077-1",
4
4
  "main": "out/server-glue/module",
5
+ "type": "commonjs",
5
6
  "repository": "git@github.com:balena-io/pinejs.git",
6
7
  "license": "Apache-2.0",
7
8
  "bin": {
@@ -17,62 +18,65 @@
17
18
  "webpack-module": "grunt module",
18
19
  "webpack-server": "grunt server",
19
20
  "webpack-build": "npm run webpack-browser && npm run webpack-module && npm run webpack-server",
20
- "lint": "balena-lint -e js -e ts src build typings Gruntfile.ts && npx tsc --project tsconfig.dev.json --noEmit",
21
+ "lint": "balena-lint -t tsconfig.dev.json -e js -e ts src build typings Gruntfile.ts && npx tsc --project tsconfig.dev.json --noEmit",
21
22
  "test": "npm run lint && npm run build && npm run webpack-build && npm run test:compose",
22
- "test:compose": "trap 'docker-compose -f docker-compose.npm-test.yml down ; echo Stopped ; exit 0' SIGINT; docker-compose -f docker-compose.npm-test.yml up -d && sleep 2 && DATABASE_URL=postgres://docker:docker@localhost:5431/postgres npm run mocha",
23
+ "test:compose": "trap 'docker-compose -f docker-compose.npm-test.yml down ; echo Stopped ; exit 0' SIGINT; 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",
23
24
  "mocha": "TS_NODE_FILES=true mocha",
24
- "prettify": "balena-lint -e js -e ts --fix src build typings Gruntfile.ts"
25
+ "prettify": "balena-lint -t tsconfig.dev.json -e js -e ts --fix src test build typings Gruntfile.ts"
25
26
  },
26
27
  "dependencies": {
27
- "@balena/abstract-sql-compiler": "^9.0.2",
28
- "@balena/abstract-sql-to-typescript": "^2.0.0",
29
- "@balena/env-parsing": "^1.1.5",
30
- "@balena/lf-to-abstract-sql": "^5.0.0",
31
- "@balena/odata-parser": "^3.0.0",
32
- "@balena/odata-to-abstract-sql": "^6.0.1",
28
+ "@balena/abstract-sql-compiler": "^9.0.4",
29
+ "@balena/abstract-sql-to-typescript": "^2.1.3",
30
+ "@balena/env-parsing": "^1.1.10",
31
+ "@balena/lf-to-abstract-sql": "^5.0.1",
32
+ "@balena/odata-parser": "^3.0.3",
33
+ "@balena/odata-to-abstract-sql": "^6.2.3",
33
34
  "@balena/sbvr-parser": "^1.4.3",
34
- "@balena/sbvr-types": "^5.0.0",
35
- "@types/body-parser": "^1.19.2",
36
- "@types/compression": "^1.7.2",
37
- "@types/cookie-parser": "^1.4.3",
38
- "@types/deep-freeze": "^0.1.2",
39
- "@types/express": "^4.17.17",
40
- "@types/express-session": "^1.17.7",
41
- "@types/lodash": "^4.14.194",
42
- "@types/memoizee": "^0.4.8",
43
- "@types/method-override": "^0.0.32",
44
- "@types/multer": "^1.4.7",
45
- "@types/mysql": "^2.15.21",
46
- "@types/node": "^18.16.1",
47
- "@types/passport": "^1.0.12",
48
- "@types/passport-local": "^1.0.35",
49
- "@types/passport-strategy": "^0.2.35",
50
- "@types/pg": "^8.6.6",
51
- "@types/randomstring": "^1.1.8",
52
- "@types/websql": "^0.0.27",
53
- "commander": "^10.0.1",
35
+ "@balena/sbvr-types": "^7.0.1",
36
+ "@types/body-parser": "^1.19.5",
37
+ "@types/compression": "^1.7.5",
38
+ "@types/cookie-parser": "^1.4.6",
39
+ "@types/deep-freeze": "^0.1.5",
40
+ "@types/express": "^4.17.21",
41
+ "@types/express-session": "^1.17.10",
42
+ "@types/lodash": "^4.14.202",
43
+ "@types/memoizee": "^0.4.11",
44
+ "@types/method-override": "^0.0.35",
45
+ "@types/multer": "^1.4.11",
46
+ "@types/mysql": "^2.15.25",
47
+ "@types/node": "^20.11.2",
48
+ "@types/passport": "^1.0.16",
49
+ "@types/passport-local": "^1.0.38",
50
+ "@types/passport-strategy": "^0.2.38",
51
+ "@types/pg": "^8.10.9",
52
+ "@types/randomstring": "^1.1.11",
53
+ "@types/websql": "^0.0.30",
54
+ "busboy": "^1.6.0",
55
+ "commander": "^11.1.0",
54
56
  "deep-freeze": "^0.0.1",
55
- "eventemitter3": "^5.0.0",
57
+ "eventemitter3": "^5.0.1",
56
58
  "express-session": "^1.17.3",
57
59
  "lodash": "^4.17.21",
58
60
  "memoizee": "^0.4.15",
59
- "pinejs-client-core": "^6.13.0",
60
- "randomstring": "^1.2.3",
61
+ "pinejs-client-core": "^6.14.0",
62
+ "randomstring": "^1.3.0",
61
63
  "typed-error": "^3.2.2"
62
64
  },
63
65
  "devDependencies": {
64
- "@balena/lint": "^6.2.2",
65
- "@faker-js/faker": "^7.6.0",
66
- "@types/chai": "^4.3.4",
67
- "@types/chai-as-promised": "^7.1.5",
68
- "@types/grunt": "^0.4.27",
69
- "@types/mocha": "^10.0.1",
70
- "@types/on-finished": "^2.3.1",
71
- "@types/request": "^2.48.8",
72
- "@types/supertest": "^2.0.12",
66
+ "@balena/lint": "^7.2.4",
67
+ "@faker-js/faker": "^8.3.1",
68
+ "@types/busboy": "^1.5.3",
69
+ "@types/chai": "^4.3.11",
70
+ "@types/chai-as-promised": "^7.1.8",
71
+ "@types/grunt": "^0.4.31",
72
+ "@types/mocha": "^10.0.6",
73
+ "@types/on-finished": "^2.3.4",
74
+ "@types/request": "^2.48.12",
75
+ "@types/supertest": "^6.0.2",
73
76
  "@types/terser-webpack-plugin": "^5.2.0",
74
- "@types/webpack": "^5.28.1",
75
- "chai": "^4.3.7",
77
+ "@types/type-is": "^1.6.6",
78
+ "@types/webpack": "^5.28.5",
79
+ "chai": "^4.4.1",
76
80
  "grunt": "^1.6.1",
77
81
  "grunt-check-dependencies": "^1.0.0",
78
82
  "grunt-cli": "^1.4.3",
@@ -83,37 +87,39 @@
83
87
  "grunt-gitinfo": "^0.1.9",
84
88
  "grunt-text-replace": "^0.4.0",
85
89
  "grunt-ts": "^6.0.0-beta.22",
86
- "grunt-webpack": "^5.0.0",
90
+ "grunt-webpack": "^6.0.0",
87
91
  "husky": "^8.0.3",
88
- "lint-staged": "^13.2.2",
92
+ "lint-staged": "^15.2.0",
89
93
  "load-grunt-tasks": "^5.1.0",
90
94
  "mocha": "^10.2.0",
91
95
  "on-finished": "^2.4.1",
92
- "pinejs-client-supertest": "^1.4.0",
96
+ "pinejs-client-supertest": "^2.0.2",
93
97
  "raw-loader": "^4.0.2",
94
98
  "request": "^2.88.2",
95
99
  "require-npm4-to-publish": "^1.0.0",
96
- "supertest": "^6.3.3",
97
- "terser-webpack-plugin": "^5.3.7",
98
- "ts-loader": "^9.4.2",
99
- "ts-node": "^10.9.1",
100
- "typescript": "^5.1.3",
101
- "webpack": "^5.81.0",
102
- "webpack-dev-server": "^4.13.3"
100
+ "supertest": "^6.3.4",
101
+ "terser-webpack-plugin": "^5.3.10",
102
+ "ts-loader": "^9.5.1",
103
+ "ts-node": "^10.9.2",
104
+ "typescript": "^5.3.3",
105
+ "webpack": "^5.89.0",
106
+ "webpack-dev-server": "^4.15.1"
103
107
  },
104
108
  "optionalDependencies": {
105
- "bcrypt": "^5.1.0",
109
+ "@aws-sdk/client-s3": "^3.490.0",
110
+ "@aws-sdk/lib-storage": "^3.490.0",
111
+ "@aws-sdk/s3-request-presigner": "^3.490.0",
112
+ "bcrypt": "^5.1.1",
106
113
  "body-parser": "^1.20.2",
107
114
  "compression": "^1.7.4",
108
115
  "cookie-parser": "^1.4.6",
109
116
  "express": "^4.18.2",
110
117
  "method-override": "^3.0.0",
111
- "multer": "1.4.5-lts.1",
112
118
  "mysql": "^2.18.1",
113
- "passport": "^0.6.0",
119
+ "passport": "^0.7.0",
114
120
  "passport-local": "^1.0.0",
115
- "pg": "^8.10.0",
116
- "pg-connection-string": "^2.5.0",
121
+ "pg": "^8.11.3",
122
+ "pg-connection-string": "^2.6.2",
117
123
  "serve-static": "^1.15.0"
118
124
  },
119
125
  "engines": {
@@ -122,10 +128,10 @@
122
128
  },
123
129
  "lint-staged": {
124
130
  "*.js": [
125
- "balena-lint --fix"
131
+ "balena-lint -t tsconfig.dev.json --fix"
126
132
  ],
127
133
  "*.ts": [
128
- "balena-lint --fix"
134
+ "balena-lint -t tsconfig.dev.json --fix"
129
135
  ]
130
136
  },
131
137
  "mocha": {
@@ -138,6 +144,6 @@
138
144
  "recursive": true
139
145
  },
140
146
  "versionist": {
141
- "publishedAt": "2023-08-14T13:58:20.458Z"
147
+ "publishedAt": "2024-03-05T20:13:08.529Z"
142
148
  }
143
149
  }
@@ -5,22 +5,20 @@ import {
5
5
  writeSqlModel,
6
6
  } from './utils';
7
7
 
8
- import type * as SbvrUtils from '../sbvr-api/sbvr-utils';
9
-
10
8
  import { program } from 'commander';
11
9
 
12
- const runCompile = (inputFile: string, outputFile?: string) => {
13
- const { generateSqlModel } =
14
- require('../sbvr-api/sbvr-utils') as typeof SbvrUtils;
10
+ const runCompile = async (inputFile: string, outputFile?: string) => {
11
+ const { generateSqlModel } = await import('../sbvr-api/sbvr-utils.js');
15
12
  const abstractSql = getAbstractSqlModelFromFile(inputFile);
16
13
  const sqlModel = generateSqlModel(abstractSql, program.opts().engine);
17
14
 
18
15
  writeSqlModel(sqlModel, outputFile);
19
16
  };
20
17
 
21
- const generateTypes = (inputFile: string, outputFile?: string) => {
22
- const { abstractSqlToTypescriptTypes } =
23
- require('@balena/abstract-sql-to-typescript') as typeof import('@balena/abstract-sql-to-typescript');
18
+ const generateTypes = async (inputFile: string, outputFile?: string) => {
19
+ const { abstractSqlToTypescriptTypes } = await import(
20
+ '@balena/abstract-sql-to-typescript'
21
+ );
24
22
  const abstractSql = getAbstractSqlModelFromFile(inputFile);
25
23
  const types = abstractSqlToTypescriptTypes(abstractSql);
26
24
 
@@ -62,4 +60,4 @@ if (process.argv.length === 2) {
62
60
  program.help();
63
61
  }
64
62
 
65
- program.parse(process.argv);
63
+ void program.parseAsync(process.argv);
@@ -1,13 +1,12 @@
1
1
  import { getAbstractSqlModelFromFile, version, writeAll } from './utils';
2
- import type * as AbstractSql from '../sbvr-api/abstract-sql';
3
- import type * as UriParser from '../sbvr-api/uri-parser';
4
2
  import type { SqlResult } from '@balena/abstract-sql-compiler';
5
3
 
6
4
  import { program } from 'commander';
7
5
 
8
- const generateAbstractSqlQuery = (modelFile: string, odata: string) => {
9
- const { memoizedParseOdata, translateUri } =
10
- require('../sbvr-api/uri-parser') as typeof UriParser;
6
+ const generateAbstractSqlQuery = async (modelFile: string, odata: string) => {
7
+ const { memoizedParseOdata, translateUri } = await import(
8
+ '../sbvr-api/uri-parser.js'
9
+ );
11
10
  const odataAST = memoizedParseOdata(odata);
12
11
  const vocabulary = '';
13
12
  return translateUri({
@@ -26,20 +25,19 @@ const generateAbstractSqlQuery = (modelFile: string, odata: string) => {
26
25
  });
27
26
  };
28
27
 
29
- const parseOData = (odata: string, outputFile?: string) => {
30
- const { memoizedParseOdata } =
31
- require('../sbvr-api/uri-parser') as typeof UriParser;
28
+ const parseOData = async (odata: string, outputFile?: string) => {
29
+ const { memoizedParseOdata } = await import('../sbvr-api/uri-parser.js');
32
30
  const result = memoizedParseOdata(odata);
33
31
  const json = JSON.stringify(result, null, 2);
34
32
  writeAll(json, outputFile);
35
33
  };
36
34
 
37
- const translateOData = (
35
+ const translateOData = async (
38
36
  modelFile: string,
39
37
  odata: string,
40
38
  outputFile?: string,
41
39
  ) => {
42
- const request = generateAbstractSqlQuery(modelFile, odata);
40
+ const request = await generateAbstractSqlQuery(modelFile, odata);
43
41
  const json = JSON.stringify(request.abstractSqlQuery, null, 2);
44
42
  writeAll(json, outputFile);
45
43
  };
@@ -55,14 +53,13 @@ Bindings: ${JSON.stringify(sqlQuery.bindings, null, 2)}
55
53
  }
56
54
  };
57
55
 
58
- const compileOData = (
56
+ const compileOData = async (
59
57
  modelFile: string,
60
58
  odata: string,
61
59
  outputFile?: string,
62
60
  ) => {
63
- const translatedRequest = generateAbstractSqlQuery(modelFile, odata);
64
- const { compileRequest } =
65
- require('../sbvr-api/abstract-sql') as typeof AbstractSql;
61
+ const translatedRequest = await generateAbstractSqlQuery(modelFile, odata);
62
+ const { compileRequest } = await import('../sbvr-api/abstract-sql.js');
66
63
  const compiledRequest = compileRequest(translatedRequest);
67
64
  let output;
68
65
  if (program.opts().json) {
@@ -109,4 +106,4 @@ if (process.argv.length === 2) {
109
106
  program.help();
110
107
  }
111
108
 
112
- program.parse(process.argv);
109
+ void program.parseAsync(process.argv);