@balena/pinejs 19.7.2-build-esm-36f468424324d7ef7578ae401fc681c9f8f63e03-3 → 19.7.2

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 (168) hide show
  1. package/.versionbot/CHANGELOG.yml +3 -3
  2. package/CHANGELOG.md +1 -1
  3. package/{Gruntfile.cts → Gruntfile.ts} +22 -9
  4. package/bin/abstract-sql-compiler.js +1 -1
  5. package/bin/odata-compiler.js +1 -1
  6. package/bin/sbvr-compiler.js +1 -1
  7. package/build/{browser.cts → browser.ts} +1 -1
  8. package/build/{config.cts → config.ts} +1 -5
  9. package/build/{module.cts → module.ts} +1 -1
  10. package/build/{server.cts → server.ts} +1 -1
  11. package/out/bin/abstract-sql-compiler.js +19 -17
  12. package/out/bin/abstract-sql-compiler.js.map +1 -1
  13. package/out/bin/odata-compiler.js +21 -19
  14. package/out/bin/odata-compiler.js.map +1 -1
  15. package/out/bin/sbvr-compiler.js +54 -19
  16. package/out/bin/sbvr-compiler.js.map +1 -1
  17. package/out/bin/utils.d.ts +3 -3
  18. package/out/bin/utils.js +53 -21
  19. package/out/bin/utils.js.map +1 -1
  20. package/out/config-loader/config-loader.d.ts +7 -7
  21. package/out/config-loader/config-loader.js +63 -23
  22. package/out/config-loader/config-loader.js.map +1 -1
  23. package/out/config-loader/env.d.ts +1 -1
  24. package/out/config-loader/env.js +66 -24
  25. package/out/config-loader/env.js.map +1 -1
  26. package/out/data-server/sbvr-server.d.ts +3 -3
  27. package/out/data-server/sbvr-server.js +42 -5
  28. package/out/data-server/sbvr-server.js.map +1 -1
  29. package/out/database-layer/db.d.ts +3 -3
  30. package/out/database-layer/db.js +83 -37
  31. package/out/database-layer/db.js.map +1 -1
  32. package/out/express-emulator/express.js.map +1 -1
  33. package/out/extended-sbvr-parser/extended-sbvr-parser.js +11 -8
  34. package/out/extended-sbvr-parser/extended-sbvr-parser.js.map +1 -1
  35. package/out/http-transactions/transactions.d.ts +2 -2
  36. package/out/http-transactions/transactions.js +4 -4
  37. package/out/http-transactions/transactions.js.map +1 -1
  38. package/out/migrator/async.d.ts +2 -2
  39. package/out/migrator/async.js +60 -20
  40. package/out/migrator/async.js.map +1 -1
  41. package/out/migrator/migrations.js +2 -1
  42. package/out/migrator/sync.d.ts +6 -6
  43. package/out/migrator/sync.js +61 -20
  44. package/out/migrator/sync.js.map +1 -1
  45. package/out/migrator/utils.d.ts +4 -4
  46. package/out/migrator/utils.js +97 -42
  47. package/out/migrator/utils.js.map +1 -1
  48. package/out/odata-metadata/odata-metadata-generator.js +14 -7
  49. package/out/odata-metadata/odata-metadata-generator.js.map +1 -1
  50. package/out/passport-pinejs/mount-login-router.d.ts +1 -1
  51. package/out/passport-pinejs/mount-login-router.js +41 -4
  52. package/out/passport-pinejs/mount-login-router.js.map +1 -1
  53. package/out/passport-pinejs/passport-pinejs.d.ts +3 -3
  54. package/out/passport-pinejs/passport-pinejs.js +46 -11
  55. package/out/passport-pinejs/passport-pinejs.js.map +1 -1
  56. package/out/pinejs-session-store/pinejs-session-store.d.ts +1 -1
  57. package/out/pinejs-session-store/pinejs-session-store.js +48 -11
  58. package/out/pinejs-session-store/pinejs-session-store.js.map +1 -1
  59. package/out/sbvr-api/abstract-sql.d.ts +3 -3
  60. package/out/sbvr-api/abstract-sql.js +65 -22
  61. package/out/sbvr-api/abstract-sql.js.map +1 -1
  62. package/out/sbvr-api/cached-compile.js +15 -8
  63. package/out/sbvr-api/cached-compile.js.map +1 -1
  64. package/out/sbvr-api/common-types.js +2 -1
  65. package/out/sbvr-api/control-flow.d.ts +1 -1
  66. package/out/sbvr-api/control-flow.js +25 -12
  67. package/out/sbvr-api/control-flow.js.map +1 -1
  68. package/out/sbvr-api/dev.js +2 -1
  69. package/out/sbvr-api/errors.d.ts +1 -1
  70. package/out/sbvr-api/errors.js +95 -47
  71. package/out/sbvr-api/errors.js.map +1 -1
  72. package/out/sbvr-api/express-extension.d.ts +2 -2
  73. package/out/sbvr-api/express-extension.js +2 -1
  74. package/out/sbvr-api/hooks.d.ts +4 -4
  75. package/out/sbvr-api/hooks.js +35 -23
  76. package/out/sbvr-api/hooks.js.map +1 -1
  77. package/out/sbvr-api/odata-response.d.ts +2 -2
  78. package/out/sbvr-api/odata-response.js +29 -19
  79. package/out/sbvr-api/odata-response.js.map +1 -1
  80. package/out/sbvr-api/permissions.d.ts +9 -9
  81. package/out/sbvr-api/permissions.js +159 -106
  82. package/out/sbvr-api/permissions.js.map +1 -1
  83. package/out/sbvr-api/sbvr-utils.d.ts +18 -40
  84. package/out/sbvr-api/sbvr-utils.js +285 -222
  85. package/out/sbvr-api/sbvr-utils.js.map +1 -1
  86. package/out/sbvr-api/translations.d.ts +1 -1
  87. package/out/sbvr-api/translations.js +17 -10
  88. package/out/sbvr-api/translations.js.map +1 -1
  89. package/out/sbvr-api/uri-parser.d.ts +7 -7
  90. package/out/sbvr-api/uri-parser.js +84 -39
  91. package/out/sbvr-api/uri-parser.js.map +1 -1
  92. package/out/sbvr-api/user.js +2 -1
  93. package/out/server-glue/global-ext.d.ts +3 -0
  94. package/out/server-glue/module.d.ts +16 -16
  95. package/out/server-glue/module.js +59 -20
  96. package/out/server-glue/module.js.map +1 -1
  97. package/out/server-glue/sbvr-loader.d.ts +1 -2
  98. package/out/server-glue/sbvr-loader.js +11 -4
  99. package/out/server-glue/sbvr-loader.js.map +1 -1
  100. package/out/server-glue/server.d.ts +2 -2
  101. package/out/server-glue/server.js +59 -17
  102. package/out/server-glue/server.js.map +1 -1
  103. package/out/tasks/common.d.ts +1 -1
  104. package/out/tasks/common.js +9 -3
  105. package/out/tasks/common.js.map +1 -1
  106. package/out/tasks/index.d.ts +8 -8
  107. package/out/tasks/index.js +63 -25
  108. package/out/tasks/index.js.map +1 -1
  109. package/out/tasks/tasks.js +2 -1
  110. package/out/tasks/worker.d.ts +3 -3
  111. package/out/tasks/worker.js +51 -14
  112. package/out/tasks/worker.js.map +1 -1
  113. package/out/webresource-handler/handlers/NoopHandler.d.ts +1 -1
  114. package/out/webresource-handler/handlers/NoopHandler.js +5 -1
  115. package/out/webresource-handler/handlers/NoopHandler.js.map +1 -1
  116. package/out/webresource-handler/handlers/S3Handler.d.ts +1 -1
  117. package/out/webresource-handler/handlers/S3Handler.js +24 -17
  118. package/out/webresource-handler/handlers/S3Handler.js.map +1 -1
  119. package/out/webresource-handler/handlers/index.d.ts +2 -2
  120. package/out/webresource-handler/handlers/index.js +18 -2
  121. package/out/webresource-handler/handlers/index.js.map +1 -1
  122. package/out/webresource-handler/index.d.ts +3 -3
  123. package/out/webresource-handler/index.js +85 -35
  124. package/out/webresource-handler/index.js.map +1 -1
  125. package/package.json +33 -33
  126. package/src/bin/abstract-sql-compiler.ts +3 -3
  127. package/src/bin/odata-compiler.ts +3 -3
  128. package/src/bin/sbvr-compiler.ts +2 -2
  129. package/src/bin/utils.ts +15 -23
  130. package/src/config-loader/config-loader.ts +12 -12
  131. package/src/config-loader/env.ts +3 -3
  132. package/src/data-server/sbvr-server.ts +4 -4
  133. package/src/database-layer/db.ts +11 -18
  134. package/src/extended-sbvr-parser/extended-sbvr-parser.ts +5 -5
  135. package/src/http-transactions/transactions.js +4 -4
  136. package/src/migrator/async.ts +5 -5
  137. package/src/migrator/sync.ts +8 -8
  138. package/src/migrator/utils.ts +7 -7
  139. package/src/odata-metadata/odata-metadata-generator.ts +2 -3
  140. package/src/passport-pinejs/mount-login-router.ts +3 -3
  141. package/src/passport-pinejs/passport-pinejs.ts +6 -6
  142. package/src/pinejs-session-store/pinejs-session-store.ts +4 -4
  143. package/src/sbvr-api/abstract-sql.ts +6 -6
  144. package/src/sbvr-api/cached-compile.ts +2 -2
  145. package/src/sbvr-api/control-flow.ts +1 -1
  146. package/src/sbvr-api/errors.ts +1 -1
  147. package/src/sbvr-api/express-extension.ts +2 -2
  148. package/src/sbvr-api/hooks.ts +5 -5
  149. package/src/sbvr-api/odata-response.ts +4 -8
  150. package/src/sbvr-api/permissions.ts +19 -19
  151. package/src/sbvr-api/sbvr-utils.ts +33 -39
  152. package/src/sbvr-api/translations.ts +1 -1
  153. package/src/sbvr-api/uri-parser.ts +10 -10
  154. package/src/server-glue/global-ext.d.ts +3 -0
  155. package/src/server-glue/module.ts +20 -20
  156. package/src/server-glue/sbvr-loader.ts +27 -15
  157. package/src/server-glue/server.ts +24 -13
  158. package/src/tasks/common.ts +1 -1
  159. package/src/tasks/index.ts +14 -14
  160. package/src/tasks/worker.ts +8 -8
  161. package/src/webresource-handler/handlers/NoopHandler.ts +1 -5
  162. package/src/webresource-handler/handlers/S3Handler.ts +1 -1
  163. package/src/webresource-handler/handlers/index.ts +2 -2
  164. package/src/webresource-handler/index.ts +10 -10
  165. package/tsconfig.dev.json +2 -4
  166. package/tsconfig.json +1 -1
  167. package/typings/lf-to-abstract-sql.d.ts +2 -2
  168. package/typings/memoizee.d.ts +2 -2
@@ -1,20 +1,20 @@
1
1
  import type { Schema } from 'ajv';
2
- import cronParser from 'cron-parser';
3
- import { tasks as tasksEnv } from '../config-loader/env.js';
4
- import { addPureHook } from '../sbvr-api/hooks.js';
5
- import * as sbvrUtils from '../sbvr-api/sbvr-utils.js';
6
- import type { ConfigLoader } from '../server-glue/module.js';
7
- import { ajv, apiRoot } from './common.js';
8
- import type { TaskHandler } from './worker.js';
9
- import { Worker } from './worker.js';
10
- import type TasksModel from './tasks.js';
11
- import type { Task } from './tasks.js';
2
+ import * as cronParser from 'cron-parser';
3
+ import { tasks as tasksEnv } from '../config-loader/env';
4
+ import { addPureHook } from '../sbvr-api/hooks';
5
+ import * as sbvrUtils from '../sbvr-api/sbvr-utils';
6
+ import type { ConfigLoader } from '../server-glue/module';
7
+ import { ajv, apiRoot } from './common';
8
+ import type { TaskHandler } from './worker';
9
+ import { Worker } from './worker';
10
+ import type TasksModel from './tasks';
11
+ import type { Task } from './tasks';
12
12
  import type { FromSchema } from 'json-schema-to-ts';
13
- import { importSBVR } from '../server-glue/sbvr-loader.js';
13
+ import { requireSBVR } from '../server-glue/sbvr-loader';
14
14
 
15
- export type * from './tasks.js';
15
+ export type * from './tasks';
16
16
 
17
- const modelText = await importSBVR('./tasks.sbvr', import.meta);
17
+ const modelText = requireSBVR('./tasks.sbvr', require);
18
18
 
19
19
  // Create index for polling tasks table
20
20
  const initSql = `
@@ -25,7 +25,7 @@ CREATE INDEX IF NOT EXISTS idx_task_poll ON task USING btree (
25
25
  ) WHERE status = 'queued';
26
26
  `;
27
27
 
28
- declare module '../sbvr-api/sbvr-utils.js' {
28
+ declare module '../sbvr-api/sbvr-utils' {
29
29
  export interface API {
30
30
  [apiRoot]: PinejsClient<TasksModel>;
31
31
  }
@@ -1,14 +1,14 @@
1
1
  import type { ValidateFunction } from 'ajv';
2
2
  import { setTimeout } from 'node:timers/promises';
3
3
  import type { AnyObject } from 'pinejs-client-core';
4
- import { tasks as tasksEnv } from '../config-loader/env.js';
5
- import type * as Db from '../database-layer/db.js';
6
- import * as permissions from '../sbvr-api/permissions.js';
7
- import { PinejsClient } from '../sbvr-api/sbvr-utils.js';
8
- import { sbvrUtils } from '../server-glue/module.js';
9
- import { ajv } from './common.js';
10
- import type { Task } from './tasks.js';
11
- import type TasksModel from './tasks.js';
4
+ import { tasks as tasksEnv } from '../config-loader/env';
5
+ import type * as Db from '../database-layer/db';
6
+ import * as permissions from '../sbvr-api/permissions';
7
+ import { PinejsClient } from '../sbvr-api/sbvr-utils';
8
+ import { sbvrUtils } from '../server-glue/module';
9
+ import { ajv } from './common';
10
+ import type { Task } from './tasks';
11
+ import type TasksModel from './tasks';
12
12
 
13
13
  interface TaskArgs<T = AnyObject> {
14
14
  api: PinejsClient;
@@ -1,9 +1,5 @@
1
1
  import type { WebResourceType as WebResource } from '@balena/sbvr-types';
2
- import type {
3
- IncomingFile,
4
- UploadResponse,
5
- WebResourceHandler,
6
- } from '../index.js';
2
+ import type { IncomingFile, UploadResponse, WebResourceHandler } from '..';
7
3
 
8
4
  export class NoopHandler implements WebResourceHandler {
9
5
  public async handleFile(resource: IncomingFile): Promise<UploadResponse> {
@@ -5,7 +5,7 @@ import {
5
5
  type UploadResponse,
6
6
  WebResourceError,
7
7
  type WebResourceHandler,
8
- } from '../index.js';
8
+ } from '..';
9
9
  import {
10
10
  S3Client,
11
11
  type S3ClientConfig,
@@ -1,2 +1,2 @@
1
- export * from './NoopHandler.js';
2
- export * from './S3Handler.js';
1
+ export * from './NoopHandler';
2
+ export * from './S3Handler';
@@ -1,21 +1,21 @@
1
- import type Express from 'express';
1
+ import type * as Express from 'express';
2
2
  import busboy from 'busboy';
3
- import type stream from 'node:stream';
4
- import * as uriParser from '../sbvr-api/uri-parser.js';
5
- import * as sbvrUtils from '../sbvr-api/sbvr-utils.js';
6
- import type { HookArgs } from '../sbvr-api/hooks.js';
7
- import { getApiRoot, getModel } from '../sbvr-api/sbvr-utils.js';
8
- import { checkPermissions } from '../sbvr-api/permissions.js';
9
- import { NoopHandler } from './handlers/NoopHandler.js';
3
+ import type * as stream from 'node:stream';
4
+ import * as uriParser from '../sbvr-api/uri-parser';
5
+ import * as sbvrUtils from '../sbvr-api/sbvr-utils';
6
+ import type { HookArgs } from '../sbvr-api/hooks';
7
+ import { getApiRoot, getModel } from '../sbvr-api/sbvr-utils';
8
+ import { checkPermissions } from '../sbvr-api/permissions';
9
+ import { NoopHandler } from './handlers/NoopHandler';
10
10
  import {
11
11
  odataNameToSqlName,
12
12
  sqlNameToODataName,
13
13
  } from '@balena/odata-to-abstract-sql';
14
- import { errors, permissions } from '../server-glue/module.js';
14
+ import { errors, permissions } from '../server-glue/module';
15
15
  import type { WebResourceType as WebResource } from '@balena/sbvr-types';
16
16
  import { TypedError } from 'typed-error';
17
17
 
18
- export * from './handlers/index.js';
18
+ export * from './handlers';
19
19
 
20
20
  export interface IncomingFile {
21
21
  fieldname: string;
package/tsconfig.dev.json CHANGED
@@ -1,15 +1,13 @@
1
1
  {
2
2
  "extends": "./tsconfig.json",
3
3
  "compilerOptions": {
4
- "rootDir": ".",
5
- "allowImportingTsExtensions": true
4
+ "rootDir": "."
6
5
  },
7
6
  "include": [
8
7
  "build/**/*",
9
- "bin/**/*",
10
8
  "src/**/*",
11
9
  "test/**/*",
12
10
  "typings/**/*.d.ts",
13
- "Gruntfile.cts"
11
+ "Gruntfile.ts"
14
12
  ]
15
13
  }
package/tsconfig.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "module": "NodeNext",
3
+ "module": "Node16",
4
4
  "strict": true,
5
5
  "strictFunctionTypes": false,
6
6
  "noImplicitThis": false,
@@ -5,7 +5,7 @@ declare module '@balena/lf-to-abstract-sql' {
5
5
  export const LF2AbstractSQL: {
6
6
  createInstance: () => {
7
7
  match: (lfModel: LFModel, rule: 'Process') => AbstractSqlModel;
8
- addTypes: (types: typeof sbvrTypes.default) => void;
8
+ addTypes: (types: typeof sbvrTypes) => void;
9
9
  reset: () => void;
10
10
  };
11
11
  };
@@ -14,6 +14,6 @@ declare module '@balena/lf-to-abstract-sql' {
14
14
  _extend(obj: object): typeof LF2AbstractSQLPrep;
15
15
  };
16
16
  export const createTranslator: (
17
- types: typeof sbvrTypes.default,
17
+ types: typeof sbvrTypes,
18
18
  ) => (lfModel: LFModel, rule: 'Process') => AbstractSqlModel;
19
19
  }
@@ -1,5 +1,5 @@
1
- declare module 'memoizee/weak.js' {
2
- import type Memoize from 'memoizee';
1
+ declare module 'memoizee/weak' {
2
+ import type * as Memoize from 'memoizee';
3
3
 
4
4
  type FirstArg<T> = T extends (arg1: infer U) => any ? U : any;
5
5
  type RestArgs<T> = T extends (arg1: any, ...args: infer U) => any ? U : any[];