diff --git a/src/backend/src/filesystem/batch/commands.js b/src/backend/src/filesystem/batch/commands.js
index ba282449..0385076a 100644
--- a/src/backend/src/filesystem/batch/commands.js
+++ b/src/backend/src/filesystem/batch/commands.js
@@ -17,7 +17,7 @@
* along with this program. If not, see .
*/
const { AdvancedBase } = require("@heyputer/puter-js-common");
-const { AsyncProviderTrait } = require("../../traits/AsyncProviderTrait");
+const { AsyncProviderFeature } = require("../../traits/AsyncProviderFeature");
const { HLMkdir, QuickMkdir } = require("../hl_operations/hl_mkdir");
const { Context } = require("../../util/context");
const { HLWrite } = require("../hl_operations/hl_write");
@@ -32,8 +32,8 @@ const { HLRemove } = require("../hl_operations/hl_remove");
class BatchCommand extends AdvancedBase {
- static TRAITS = [
- new AsyncProviderTrait(),
+ static FEATURES = [
+ new AsyncProviderFeature(),
]
static async run (executor, parameters) {
const instance = new this();
diff --git a/src/backend/src/filesystem/hl_operations/hl_mkdir.js b/src/backend/src/filesystem/hl_operations/hl_mkdir.js
index 7a369244..a4cbdb48 100644
--- a/src/backend/src/filesystem/hl_operations/hl_mkdir.js
+++ b/src/backend/src/filesystem/hl_operations/hl_mkdir.js
@@ -26,8 +26,8 @@ const StringParam = require('../../api/filesystem/StringParam');
const FlagParam = require("../../api/filesystem/FlagParam");
const UserParam = require('../../api/filesystem/UserParam');
const FSNodeContext = require('../FSNodeContext');
-const { ContextAwareTrait } = require('../../traits/ContextAwareTrait');
-const { OtelTrait } = require('../../traits/OtelTrait');
+const { ContextAwareFeature } = require('../../traits/ContextAwareFeature');
+const { OtelFeature } = require('../../traits/OtelFeature');
const { HLFilesystemOperation } = require('./definitions');
const { is_valid_path } = require('../validation');
const { HLRemove } = require('./hl_remove');
@@ -249,8 +249,8 @@ class HLMkdir extends HLFilesystemOperation {
parent_directories_created: () => [],
}
- static TRAITS = [
- new OtelTrait([
+ static FEATURES = [
+ new OtelFeature([
'_get_existing_parent',
'_create_parents',
]),
diff --git a/src/backend/src/filesystem/hl_operations/hl_write.js b/src/backend/src/filesystem/hl_operations/hl_write.js
index dfccef46..b6b439ac 100644
--- a/src/backend/src/filesystem/hl_operations/hl_write.js
+++ b/src/backend/src/filesystem/hl_operations/hl_write.js
@@ -33,7 +33,7 @@ const { HLFilesystemOperation } = require("./definitions");
const { MkTree } = require("./hl_mkdir");
const { Actor } = require("../../services/auth/Actor");
-class WriteCommonTrait {
+class WriteCommonFeature {
install_in_instance (instance) {
instance._verify_size = async function () {
if (
@@ -84,8 +84,8 @@ class HLWrite extends HLFilesystemOperation {
- create shortcuts
`
- static TRAITS = [
- new WriteCommonTrait(),
+ static FEATURES = [
+ new WriteCommonFeature(),
]
static PARAMETERS = {
diff --git a/src/backend/src/filesystem/storage/DatabaseFSEntryService.js b/src/backend/src/filesystem/storage/DatabaseFSEntryService.js
index b997ba2b..df84e69d 100644
--- a/src/backend/src/filesystem/storage/DatabaseFSEntryService.js
+++ b/src/backend/src/filesystem/storage/DatabaseFSEntryService.js
@@ -21,7 +21,7 @@ const { id2path } = require("../../helpers");
const { PuterPath } = require("../lib/PuterPath");
const { NodeUIDSelector } = require("../node/selectors");
-const { OtelTrait } = require("../../traits/OtelTrait");
+const { OtelFeature } = require("../../traits/OtelFeature");
const { Context } = require("../../util/context");
const { DB_WRITE } = require("../../services/database/consts");
@@ -195,8 +195,8 @@ class DatabaseFSEntryService extends AdvancedBase {
static STATUS_READY = {};
static STATUS_RUNNING_JOB = {};
- static TRAITS = [
- new OtelTrait([
+ static FEATURES = [
+ new OtelFeature([
'insert',
'update',
'delete',
diff --git a/src/backend/src/om/IdentifierUtil.js b/src/backend/src/om/IdentifierUtil.js
index 31376f91..f70245d1 100644
--- a/src/backend/src/om/IdentifierUtil.js
+++ b/src/backend/src/om/IdentifierUtil.js
@@ -17,13 +17,13 @@
* along with this program. If not, see .
*/
const { AdvancedBase } = require("@heyputer/puter-js-common");
-const { WeakConstructorTrait } = require("../traits/WeakConstructorTrait");
+const { WeakConstructorFeature } = require("../traits/WeakConstructorFeature");
const { Eq, And } = require("./query/query");
const { Entity } = require("./entitystorage/Entity");
class IdentifierUtil extends AdvancedBase {
- static TRAITS = [
- new WeakConstructorTrait(),
+ static FEATURES = [
+ new WeakConstructorFeature(),
]
async detect_identifier (object) {
diff --git a/src/backend/src/om/definitions/Mapping.js b/src/backend/src/om/definitions/Mapping.js
index d066c69c..1f6bc899 100644
--- a/src/backend/src/om/definitions/Mapping.js
+++ b/src/backend/src/om/definitions/Mapping.js
@@ -18,7 +18,7 @@
*/
const { AdvancedBase } = require("@heyputer/puter-js-common");
const { instance_ } = require("../../monitor/PerformanceMonitor");
-const { WeakConstructorTrait } = require("../../traits/WeakConstructorTrait");
+const { WeakConstructorFeature } = require("../../traits/WeakConstructorFeature");
const { Property } = require("./Property");
const { Entity } = require("../entitystorage/Entity");
const FSNodeContext = require("../../filesystem/FSNodeContext");
@@ -29,13 +29,13 @@ const FSNodeContext = require("../../filesystem/FSNodeContext");
* Both wrapping and registering are done by RegistrantService.
*/
class Mapping extends AdvancedBase {
- static TRAITS = [
+ static FEATURES = [
// Whenever you can override something, it's reasonable to want
// to pull the desired implementation from somewhere else to
// avoid repeating yourself. Class constructors are one of a few
// examples where this is typically not possible.
// However, javascript is magic, and we do what we want.
- new WeakConstructorTrait(),
+ new WeakConstructorFeature(),
]
static create (context, data) {
diff --git a/src/backend/src/om/definitions/PropType.js b/src/backend/src/om/definitions/PropType.js
index 94f9fed5..b4a964fd 100644
--- a/src/backend/src/om/definitions/PropType.js
+++ b/src/backend/src/om/definitions/PropType.js
@@ -17,11 +17,11 @@
* along with this program. If not, see .
*/
const { AdvancedBase } = require("@heyputer/puter-js-common");
-const { WeakConstructorTrait } = require("../../traits/WeakConstructorTrait");
+const { WeakConstructorFeature } = require("../../traits/WeakConstructorFeature");
class PropType extends AdvancedBase {
- static TRAITS = [
- new WeakConstructorTrait(),
+ static FEATURES = [
+ new WeakConstructorFeature(),
]
static create (context, data, k) {
diff --git a/src/backend/src/om/definitions/Property.js b/src/backend/src/om/definitions/Property.js
index 85e97216..76c11ea2 100644
--- a/src/backend/src/om/definitions/Property.js
+++ b/src/backend/src/om/definitions/Property.js
@@ -17,11 +17,11 @@
* along with this program. If not, see .
*/
const { AdvancedBase } = require("@heyputer/puter-js-common");
-const { WeakConstructorTrait } = require("../../traits/WeakConstructorTrait");
+const { WeakConstructorFeature } = require("../../traits/WeakConstructorFeature");
class Property extends AdvancedBase {
- static TRAITS = [
- new WeakConstructorTrait(),
+ static FEATURES = [
+ new WeakConstructorFeature(),
]
static create (context, name, descriptor) {
diff --git a/src/backend/src/om/entitystorage/BaseES.js b/src/backend/src/om/entitystorage/BaseES.js
index 41638652..a91d4e90 100644
--- a/src/backend/src/om/entitystorage/BaseES.js
+++ b/src/backend/src/om/entitystorage/BaseES.js
@@ -17,15 +17,15 @@
* along with this program. If not, see .
*/
const { AdvancedBase } = require("@heyputer/puter-js-common");
-const { WeakConstructorTrait } = require("../../traits/WeakConstructorTrait");
+const { WeakConstructorFeature } = require("../../traits/WeakConstructorFeature");
const { Context } = require("../../util/context");
/**
* BaseES is a base class for Entity Store classes.
*/
class BaseES extends AdvancedBase {
- static TRAITS = [
- new WeakConstructorTrait(),
+ static FEATURES = [
+ new WeakConstructorFeature(),
]
// Default implementations
diff --git a/src/backend/src/om/entitystorage/Entity.js b/src/backend/src/om/entitystorage/Entity.js
index 57d245b5..f02bba8c 100644
--- a/src/backend/src/om/entitystorage/Entity.js
+++ b/src/backend/src/om/entitystorage/Entity.js
@@ -17,11 +17,11 @@
* along with this program. If not, see .
*/
const { AdvancedBase } = require("@heyputer/puter-js-common");
-const { WeakConstructorTrait } = require("../../traits/WeakConstructorTrait");
+const { WeakConstructorFeature } = require("../../traits/WeakConstructorFeature");
class Entity extends AdvancedBase {
- static TRAITS = [
- new WeakConstructorTrait(),
+ static FEATURES = [
+ new WeakConstructorFeature(),
]
constructor (args) {
diff --git a/src/backend/src/om/entitystorage/SQLES.js b/src/backend/src/om/entitystorage/SQLES.js
index b7f58d1a..0a87f5e6 100644
--- a/src/backend/src/om/entitystorage/SQLES.js
+++ b/src/backend/src/om/entitystorage/SQLES.js
@@ -21,14 +21,14 @@ const { BaseES } = require("./BaseES");
const APIError = require("../../api/APIError");
const { Entity } = require("./Entity");
-const { WeakConstructorTrait } = require("../../traits/WeakConstructorTrait");
+const { WeakConstructorFeature } = require("../../traits/WeakConstructorFeature");
const { And, Or, Eq, Like, Null, Predicate, PredicateUtil, IsNotNull } = require("../query/query");
const { DB_WRITE } = require("../../services/database/consts");
class RawCondition extends AdvancedBase {
// properties: sql:string, values:any[]
- static TRAITS = [
- new WeakConstructorTrait(),
+ static FEATURES = [
+ new WeakConstructorFeature(),
]
}
diff --git a/src/backend/src/om/query/query.js b/src/backend/src/om/query/query.js
index 7cf62659..80d81b38 100644
--- a/src/backend/src/om/query/query.js
+++ b/src/backend/src/om/query/query.js
@@ -17,11 +17,11 @@
* along with this program. If not, see .
*/
const { AdvancedBase } = require("@heyputer/puter-js-common");
-const { WeakConstructorTrait } = require("../../traits/WeakConstructorTrait");
+const { WeakConstructorFeature } = require("../../traits/WeakConstructorFeature");
class Predicate extends AdvancedBase {
- static TRAITS = [
- new WeakConstructorTrait(),
+ static FEATURES = [
+ new WeakConstructorFeature(),
]
}
diff --git a/src/backend/src/services/EntityStoreService.js b/src/backend/src/services/EntityStoreService.js
index e546262c..8addef79 100644
--- a/src/backend/src/services/EntityStoreService.js
+++ b/src/backend/src/services/EntityStoreService.js
@@ -40,7 +40,7 @@ class EntityStoreService extends BaseService {
});
}
- // TODO: can replace these with MethodProxyTrait
+ // TODO: can replace these with MethodProxyFeature
async create (entity) {
return await this.upstream.upsert(entity, { old_entity: null });
}
diff --git a/src/backend/src/services/OperationTraceService.js b/src/backend/src/services/OperationTraceService.js
index d038f7f8..fd86c8f4 100644
--- a/src/backend/src/services/OperationTraceService.js
+++ b/src/backend/src/services/OperationTraceService.js
@@ -18,10 +18,10 @@
*/
const { AdvancedBase } = require("@heyputer/puter-js-common");
const { Context } = require("../util/context");
-const { ContextAwareTrait } = require("../traits/ContextAwareTrait");
-const { OtelTrait } = require("../traits/OtelTrait");
+const { ContextAwareFeature } = require("../traits/ContextAwareFeature");
+const { OtelFeature } = require("../traits/OtelFeature");
const APIError = require("../api/APIError");
-const { AssignableMethodsTrait } = require("../traits/AssignableMethodsTrait");
+const { AssignableMethodsFeature } = require("../traits/AssignableMethodsFeature");
const CONTEXT_KEY = Context.make_context_key('operation-trace');
@@ -220,10 +220,10 @@ class OperationTraceService {
}
class BaseOperation extends AdvancedBase {
- static TRAITS = [
- new ContextAwareTrait(),
- new OtelTrait(['run']),
- new AssignableMethodsTrait(),
+ static FEATURES = [
+ new ContextAwareFeature(),
+ new OtelFeature(['run']),
+ new AssignableMethodsFeature(),
]
async run (values) {
diff --git a/src/backend/src/services/auth/PermissionService.js b/src/backend/src/services/auth/PermissionService.js
index 694ceff3..b18d1a2a 100644
--- a/src/backend/src/services/auth/PermissionService.js
+++ b/src/backend/src/services/auth/PermissionService.js
@@ -17,7 +17,7 @@
* along with this program. If not, see .
*/
const { get_user, get_app } = require("../../helpers");
-const { AssignableMethodsTrait } = require("../../traits/AssignableMethodsTrait");
+const { AssignableMethodsFeature } = require("../../traits/AssignableMethodsFeature");
const { Context } = require("../../util/context");
const BaseService = require("../BaseService");
const { DB_WRITE } = require("../database/consts");
diff --git a/src/backend/src/services/sla/RateLimitService.js b/src/backend/src/services/sla/RateLimitService.js
index 632877f3..ecaf7a30 100644
--- a/src/backend/src/services/sla/RateLimitService.js
+++ b/src/backend/src/services/sla/RateLimitService.js
@@ -20,7 +20,7 @@ const { AdvancedBase } = require("@heyputer/puter-js-common");
const APIError = require("../../api/APIError");
const { Context } = require("../../util/context");
const BaseService = require("../BaseService");
-const { SyncTrait } = require("../../traits/SyncTrait");
+const { SyncFeature } = require("../../traits/SyncFeature");
const { DB_WRITE } = require("../database/consts");
const ts_to_sql = (ts) => Math.floor(ts / 1000);
@@ -31,8 +31,8 @@ class RateLimitService extends BaseService {
kv: globalThis.kv,
}
- static TRAITS = [
- new SyncTrait([
+ static FEATURES = [
+ new SyncFeature([
'check_and_increment',
]),
]
diff --git a/src/backend/src/traits/AssignableMethodsTrait.js b/src/backend/src/traits/AssignableMethodsFeature.js
similarity index 94%
rename from src/backend/src/traits/AssignableMethodsTrait.js
rename to src/backend/src/traits/AssignableMethodsFeature.js
index 0730be46..39801851 100644
--- a/src/backend/src/traits/AssignableMethodsTrait.js
+++ b/src/backend/src/traits/AssignableMethodsFeature.js
@@ -16,7 +16,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
-class AssignableMethodsTrait {
+class AssignableMethodsFeature {
install_in_instance (instance) {
const methods = instance._get_merged_static_object('METHODS');
@@ -27,5 +27,5 @@ class AssignableMethodsTrait {
}
module.exports = {
- AssignableMethodsTrait
+ AssignableMethodsFeature
};
diff --git a/src/backend/src/traits/AsyncProviderTrait.js b/src/backend/src/traits/AsyncProviderFeature.js
similarity index 88%
rename from src/backend/src/traits/AsyncProviderTrait.js
rename to src/backend/src/traits/AsyncProviderFeature.js
index 280ac6ca..28304320 100644
--- a/src/backend/src/traits/AsyncProviderTrait.js
+++ b/src/backend/src/traits/AsyncProviderFeature.js
@@ -16,18 +16,18 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
-class AsyncProviderTrait {
+class AsyncProviderFeature {
install_in_instance (instance) {
instance.valueListeners_ = {};
instance.valueFactories_ = {};
instance.values_ = {};
instance.rejections_ = {};
- instance.provideValue = AsyncProviderTrait.prototype.provideValue;
- instance.rejectValue = AsyncProviderTrait.prototype.rejectValue;
- instance.awaitValue = AsyncProviderTrait.prototype.awaitValue;
- instance.onValue = AsyncProviderTrait.prototype.onValue;
- instance.setFactory = AsyncProviderTrait.prototype.setFactory;
+ instance.provideValue = AsyncProviderFeature.prototype.provideValue;
+ instance.rejectValue = AsyncProviderFeature.prototype.rejectValue;
+ instance.awaitValue = AsyncProviderFeature.prototype.awaitValue;
+ instance.onValue = AsyncProviderFeature.prototype.onValue;
+ instance.setFactory = AsyncProviderFeature.prototype.setFactory;
}
provideValue (key, value) {
@@ -116,5 +116,5 @@ class AsyncProviderTrait {
}
module.exports = {
- AsyncProviderTrait
+ AsyncProviderFeature
};
\ No newline at end of file
diff --git a/src/backend/src/traits/ContextAwareTrait.js b/src/backend/src/traits/ContextAwareFeature.js
similarity index 94%
rename from src/backend/src/traits/ContextAwareTrait.js
rename to src/backend/src/traits/ContextAwareFeature.js
index e95cfc6e..ce5383f7 100644
--- a/src/backend/src/traits/ContextAwareTrait.js
+++ b/src/backend/src/traits/ContextAwareFeature.js
@@ -18,7 +18,7 @@
*/
const { Context } = require("../util/context");
-class ContextAwareTrait {
+class ContextAwareFeature {
install_in_instance (instance) {
instance.context = Context.get();
instance.x = instance.context;
@@ -26,5 +26,5 @@ class ContextAwareTrait {
}
module.exports = {
- ContextAwareTrait,
+ ContextAwareFeature,
};
diff --git a/src/backend/src/traits/OtelTrait.js b/src/backend/src/traits/OtelFeature.js
similarity index 97%
rename from src/backend/src/traits/OtelTrait.js
rename to src/backend/src/traits/OtelFeature.js
index 422281e2..ecebb908 100644
--- a/src/backend/src/traits/OtelTrait.js
+++ b/src/backend/src/traits/OtelFeature.js
@@ -18,7 +18,7 @@
*/
const { Context } = require("../util/context");
-class OtelTrait {
+class OtelFeature {
constructor (method_include_list) {
this.method_include_list = method_include_list;
}
@@ -44,7 +44,7 @@ class OtelTrait {
}
}
-class SyncOtelTrait {
+class SyncOtelFeature {
constructor (method_include_list) {
this.method_include_list = method_include_list;
}
@@ -72,5 +72,5 @@ class SyncOtelTrait {
}
module.exports = {
- OtelTrait
+ OtelFeature
};
diff --git a/src/backend/src/traits/SyncTrait.js b/src/backend/src/traits/SyncFeature.js
similarity index 97%
rename from src/backend/src/traits/SyncTrait.js
rename to src/backend/src/traits/SyncFeature.js
index 7257ef55..b88c5ca4 100644
--- a/src/backend/src/traits/SyncTrait.js
+++ b/src/backend/src/traits/SyncFeature.js
@@ -18,7 +18,7 @@
*/
const { Lock } = require("../util/promise");
-class SyncTrait {
+class SyncFeature {
constructor (method_include_list) {
this.method_include_list = method_include_list;
}
@@ -37,5 +37,5 @@ class SyncTrait {
}
module.exports = {
- SyncTrait,
+ SyncFeature,
};
diff --git a/src/backend/src/traits/WeakConstructorTrait.js b/src/backend/src/traits/WeakConstructorFeature.js
similarity index 94%
rename from src/backend/src/traits/WeakConstructorTrait.js
rename to src/backend/src/traits/WeakConstructorFeature.js
index 8b3b653d..6e2d4eb9 100644
--- a/src/backend/src/traits/WeakConstructorTrait.js
+++ b/src/backend/src/traits/WeakConstructorFeature.js
@@ -16,7 +16,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
-class WeakConstructorTrait {
+class WeakConstructorFeature {
install_in_instance(instance, { parameters }) {
for ( const key in parameters ) {
instance[key] = parameters[key];
@@ -25,5 +25,5 @@ class WeakConstructorTrait {
}
module.exports = {
- WeakConstructorTrait,
+ WeakConstructorFeature,
};
diff --git a/src/puter-js-common/src/AdvancedBase.js b/src/puter-js-common/src/AdvancedBase.js
index 069e474a..4732410a 100644
--- a/src/puter-js-common/src/AdvancedBase.js
+++ b/src/puter-js-common/src/AdvancedBase.js
@@ -19,12 +19,12 @@
// This doesn't go in ./bases because it logically depends on
// both ./bases and ./traits, and ./traits depends on ./bases.
-const { TraitBase } = require("./bases/TraitBase");
+const { FeatureBase } = require("./bases/FeatureBase");
-class AdvancedBase extends TraitBase {
- static TRAITS = [
- require('./traits/NodeModuleDITrait'),
- require('./traits/PropertiesTrait'),
+class AdvancedBase extends FeatureBase {
+ static FEATURES = [
+ require('./features/NodeModuleDIFeature'),
+ require('./features/PropertiesFeature'),
]
}
diff --git a/src/puter-js-common/src/bases/TraitBase.js b/src/puter-js-common/src/bases/FeatureBase.js
similarity index 82%
rename from src/puter-js-common/src/bases/TraitBase.js
rename to src/puter-js-common/src/bases/FeatureBase.js
index 62d3cc1e..ab7f4fb3 100644
--- a/src/puter-js-common/src/bases/TraitBase.js
+++ b/src/puter-js-common/src/bases/FeatureBase.js
@@ -18,11 +18,11 @@
*/
const { BasicBase } = require("./BasicBase");
-class TraitBase extends BasicBase {
+class FeatureBase extends BasicBase {
constructor (parameters, ...a) {
super(parameters, ...a);
- for ( const trait of this.traits ) {
- trait.install_in_instance(
+ for ( const feature of this.features ) {
+ feature.install_in_instance(
this,
{
parameters: parameters || {},
@@ -31,11 +31,11 @@ class TraitBase extends BasicBase {
}
}
- get traits () {
- return this._get_merged_static_array('TRAITS');
+ get features () {
+ return this._get_merged_static_array('FEATURES');
}
}
module.exports = {
- TraitBase,
+ FeatureBase,
};
diff --git a/src/puter-js-common/src/traits/NodeModuleDITrait.js b/src/puter-js-common/src/features/NodeModuleDIFeature.js
similarity index 99%
rename from src/puter-js-common/src/traits/NodeModuleDITrait.js
rename to src/puter-js-common/src/features/NodeModuleDIFeature.js
index d7952704..1888da77 100644
--- a/src/puter-js-common/src/traits/NodeModuleDITrait.js
+++ b/src/puter-js-common/src/features/NodeModuleDIFeature.js
@@ -45,7 +45,7 @@ module.exports = {
}
instance.modules = modules;
-
+
// This "require" function can shadow the real one so
// that editor tools are aware of the modules that
// are being used.
diff --git a/src/puter-js-common/src/traits/PropertiesTrait.js b/src/puter-js-common/src/features/PropertiesFeature.js
similarity index 100%
rename from src/puter-js-common/src/traits/PropertiesTrait.js
rename to src/puter-js-common/src/features/PropertiesFeature.js