@harperfast/harper-pro 5.0.0-beta.7 → 5.0.0-beta.8

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 (41) hide show
  1. package/core/bin/cliOperations.js +3 -3
  2. package/core/components/ApplicationScope.ts +1 -0
  3. package/core/components/componentLoader.ts +4 -1
  4. package/core/resources/DatabaseTransaction.ts +67 -32
  5. package/core/resources/Table.ts +29 -10
  6. package/core/security/jsLoader.ts +149 -101
  7. package/core/server/REST.ts +12 -2
  8. package/core/server/http.ts +4 -1
  9. package/dist/core/bin/cliOperations.js +3 -3
  10. package/dist/core/bin/cliOperations.js.map +1 -1
  11. package/dist/core/components/ApplicationScope.js +1 -0
  12. package/dist/core/components/ApplicationScope.js.map +1 -1
  13. package/dist/core/components/componentLoader.js +2 -1
  14. package/dist/core/components/componentLoader.js.map +1 -1
  15. package/dist/core/resources/DatabaseTransaction.js +71 -35
  16. package/dist/core/resources/DatabaseTransaction.js.map +1 -1
  17. package/dist/core/resources/Table.js +15 -10
  18. package/dist/core/resources/Table.js.map +1 -1
  19. package/dist/core/security/jsLoader.js +123 -90
  20. package/dist/core/security/jsLoader.js.map +1 -1
  21. package/dist/core/server/REST.js +13 -4
  22. package/dist/core/server/REST.js.map +1 -1
  23. package/dist/core/server/http.js +5 -0
  24. package/dist/core/server/http.js.map +1 -1
  25. package/dist/licensing/usageLicensing.js +16 -26
  26. package/dist/licensing/usageLicensing.js.map +1 -1
  27. package/dist/replication/replicationConnection.js +2 -2
  28. package/dist/replication/replicationConnection.js.map +1 -1
  29. package/licensing/usageLicensing.ts +22 -32
  30. package/npm-shrinkwrap.json +223 -223
  31. package/package.json +3 -3
  32. package/replication/replicationConnection.ts +2 -2
  33. package/studio/web/assets/{index-ClD_q6ya.js → index-CXQsBaYq.js} +5 -5
  34. package/studio/web/assets/{index-ClD_q6ya.js.map → index-CXQsBaYq.js.map} +1 -1
  35. package/studio/web/assets/{index.lazy-CXzU1gVu.js → index.lazy-C3Ejfvna.js} +2 -2
  36. package/studio/web/assets/{index.lazy-CXzU1gVu.js.map → index.lazy-C3Ejfvna.js.map} +1 -1
  37. package/studio/web/assets/{profile-DCNVg5yY.js → profile-BbbbWJCN.js} +2 -2
  38. package/studio/web/assets/{profile-DCNVg5yY.js.map → profile-BbbbWJCN.js.map} +1 -1
  39. package/studio/web/assets/{status-CoGlcjSB.js → status-CFe85l8C.js} +2 -2
  40. package/studio/web/assets/{status-CoGlcjSB.js.map → status-CFe85l8C.js.map} +1 -1
  41. package/studio/web/index.html +1 -1
@@ -12,6 +12,7 @@ import * as configUtils from '../core/config/configUtils.js';
12
12
  import * as terms from '../core/utility/hdbTerms.ts';
13
13
  import type { Server } from '../core/server/Server.ts';
14
14
  import type { Scope } from '../core/components/Scope.ts';
15
+ import { universalHeaders } from '../core/server/http.ts';
15
16
 
16
17
  // eslint-disable-next-line no-unused-vars
17
18
  export const suppressHandleApplicationWarning = true;
@@ -73,27 +74,6 @@ export function initUsageLicensing(params: UsageLicensingInitParams) {
73
74
 
74
75
  licenseRegion = params.license.region;
75
76
 
76
- const { server } = params;
77
-
78
- // TODO: This only injects this header on resource API requests.
79
- // It might be good to add a way for internal plugins to
80
- // add headers to operations API requests as well.
81
- server.http(async (request, nextHandler) => {
82
- const response = nextHandler(request);
83
- if (response) {
84
- if (!response.headers?.set) {
85
- (response as any).headers = new Headers(response.headers);
86
- }
87
- if (!(await isLicensed())) {
88
- response.headers.set(
89
- 'X-License-Info',
90
- 'Unlicensed Harper Pro, this should only be used for educational and development purposes'
91
- );
92
- }
93
- }
94
- return response;
95
- });
96
-
97
77
  onAnalyticsAggregate(recordUsage);
98
78
 
99
79
  server.registerOperation?.({
@@ -213,17 +193,27 @@ async function recordUsage(analytics: any) {
213
193
  }
214
194
  }
215
195
  });
216
- } else if (!process.env.DEV_MODE) {
217
- const msg =
218
- 'This server does not have valid usage licenses, this should only be used for educational and development purposes.';
219
- if (!licenseConsoleErrorPrinted) {
220
- console.error(msg);
221
- licenseConsoleErrorPrinted = true;
222
- }
223
- if (licenseWarningIntervalId === undefined) {
224
- licenseWarningIntervalId = setInterval(() => {
225
- logger.notify?.(msg);
226
- }, LICENSE_NAG_PERIOD).unref();
196
+ universalHeaders.splice(0, universalHeaders.length); // clear out any previous license nag headers
197
+ } else {
198
+ // assign license nag header
199
+ universalHeaders.splice(
200
+ 0,
201
+ universalHeaders.length,
202
+ 'X-License-Info',
203
+ 'Unlicensed Harper Pro, this should only be used for educational and development purposes'
204
+ );
205
+ if (!process.env.DEV_MODE) {
206
+ const msg =
207
+ 'This server does not have valid usage licenses, this should only be used for educational and development purposes.';
208
+ if (!licenseConsoleErrorPrinted) {
209
+ console.error(msg);
210
+ licenseConsoleErrorPrinted = true;
211
+ }
212
+ if (licenseWarningIntervalId === undefined) {
213
+ licenseWarningIntervalId = setInterval(() => {
214
+ logger.notify?.(msg);
215
+ }, LICENSE_NAG_PERIOD).unref();
216
+ }
227
217
  }
228
218
  }
229
219
  }