From c8abe2380f8839c84ddadd717555f4c0fe6d323a Mon Sep 17 00:00:00 2001 From: KernelDeimos Date: Sat, 6 Jul 2024 13:20:17 -0400 Subject: [PATCH] dev: small changes --- packages/backend/src/CoreModule.js | 12 ++++++++---- packages/backend/src/libraries/ArrayUtil.js | 4 +--- packages/backend/src/libraries/LibTypeTagged.js | 3 +-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/packages/backend/src/CoreModule.js b/packages/backend/src/CoreModule.js index 489938ed..0a28490a 100644 --- a/packages/backend/src/CoreModule.js +++ b/packages/backend/src/CoreModule.js @@ -17,6 +17,7 @@ * along with this program. If not, see . */ const { AdvancedBase } = require("@heyputer/puter-js-common"); +const Library = require("./definitions/Library"); const { NotificationES } = require("./om/entitystorage/NotificationES"); const { ProtectedAppES } = require("./om/entitystorage/ProtectedAppES"); const { Context } = require('./util/context'); @@ -49,16 +50,19 @@ const install = async ({ services, app, useapi }) => { useapi.withuse(() => { def('Service', require('./services/BaseService')); def('Module', AdvancedBase); + def('Library', Library); def('puter.middlewares.auth', require('./middleware/auth2')); }); // === LIBRARIES === - const ArrayUtil = require('./libraries/ArrayUtil'); - services.registerService('util-array', ArrayUtil); + useapi.withuse(() => { + const ArrayUtil = require('./libraries/ArrayUtil'); + services.registerService('util-array', ArrayUtil); - const LibTypeTagged = require('./libraries/LibTypeTagged'); - services.registerService('lib-type-tagged', LibTypeTagged); + const LibTypeTagged = require('./libraries/LibTypeTagged'); + services.registerService('lib-type-tagged', LibTypeTagged); + }); // === SERVICES === diff --git a/packages/backend/src/libraries/ArrayUtil.js b/packages/backend/src/libraries/ArrayUtil.js index 20da4c73..950e6093 100644 --- a/packages/backend/src/libraries/ArrayUtil.js +++ b/packages/backend/src/libraries/ArrayUtil.js @@ -1,6 +1,4 @@ -const Library = require("../definitions/Library"); - -class ArrayUtil extends Library { +class ArrayUtil extends use.Library { /** * * @param {*} marked_map diff --git a/packages/backend/src/libraries/LibTypeTagged.js b/packages/backend/src/libraries/LibTypeTagged.js index f1da0006..fbe80c72 100644 --- a/packages/backend/src/libraries/LibTypeTagged.js +++ b/packages/backend/src/libraries/LibTypeTagged.js @@ -1,7 +1,6 @@ -const Library = require("../definitions/Library"); const { whatis } = require("../util/langutil"); -class LibTypeTagged extends Library { +class LibTypeTagged extends use.Library { process (o) { const could_be = whatis(o) === 'object' || Array.isArray(o); if ( ! could_be ) return {