Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
@tramvai/core
Advanced tools
Ядро tramvai. В основном требуется для разработки модулей трамвая.
createApp
- configuring, creating and running the application
modules
- array with used modules in the applicationbundles
- object with used bundles with data in the application. The key is the bundle identifier, the value is Promise
which returns the bundleproviders
- an array with application providers, which will be added last in the DI (after module providers) and thus it will be possible to overwrite the implementation of the tokensactions
- array with global actions, which will be registered for all bundles and pagesimport { createApp, provide } from '@tramvai/core';
import { RouterModule } from '@tramvai/module-router';
import { RenderModule } from '@tramvai/module-render';
import { ServerModule } from '@tramvai/module-server';
createApp({
name: 'my-awesome-app',
modules: [RouterModule, RenderModule, ServerModule],
providers: [
provide({
provide: 'options',
useValue: {},
}),
],
bundles: {
mainDefault: () => import(/* webpackChunkName: "mainDefault" */ './bundles/mainDefault'),
},
actions: [loadDepositConfig],
});
After calling createApp, СommandLineRunner is started which performs the chain of actions necessary to initialize the application.
declareAction
- Method for creating asynchronous actions. It is used both for building chains of sagas and for performing global actions when building a response to a client
name
- The name of the action, a unique identifier is expectedfn(...params)
- Implementation of the action, this function will be called when the action is used, maybe async
this
- action execution context that contains some helper functions and resolved depsparams
- data passed to actiondeps
- List of providers that are needed for the action to workconditions
- List of conditions for the execution of the actionconditionsFailResult
- seeAction execution context that contains some helper functions and resolved deps
Context has next fields:
deps
- resolved deps that were specified when declaring actionexecuteAction
- allows to execute another actions inside current onegetState
- quick access to STORE_TOKEN.getState
dispatch
- quick access to STORE_TOKEN.dispatch
abortSignal
- instance of signal related to the current execution treeabortController
- instance of AbortController
created exclusively for the current action executionSpecifies the output of the action in case its conditions
was not met during execution.
If
conditions
are not met for action, action'sfn
won't be executed in any way
Possible values for the conditionsFailResult
:
empty
- (default) execution will be resolved with undefined
as a resulterror
- execution will be rejected with ConditionFailErrorimport { declareAction } from '@tramvai/core';
declareAction({
name: 'action log error',
fn(payload) {
this.deps.logger.error('ERROR');
},
deps: {
logger: 'logger',
},
conditions: {
requiredCoreRoles: ['god'],
},
});
createBundle(options: BundleOptions)
- method to create a bundle.
name
- Name of the bundle. The value will be used as a bundle identifier.components: {}
- An object with registered components for the bundle, which you can use in application routespresets?: []
- A list of additional properties for the current bundle. This list is merged with the current properties. Needed to extract common parts, e.g. a set with actions and components for authorization. Reference - babel and eslint presetsactions?: []
- List of actions that will be registered globally for the bundlereducers?: []
- List of reducers, which must be registered with the loading of the bundleimport { createBundle } from '@tramvai/core';
import { lazy } from '@tramvai/react';
createBundle({
name: 'app/bundle',
presets: [commonPreset],
components: {
'app/pages/MainPage': lazy(() => import('../pages/MainPage')),
'app/pages/SecondPage': lazy(() => import('../pages/SecondPage')),
},
actions: [fooAction, barAction],
reducers: [bazReducer],
});
Dependency Injection container implementation
Information about running application
CommandLineRunner implementation
Commands for CommandLineRunner
FAQs
--- title: '@tramvai/core' sidebar_position: 1 ---
We found that @tramvai/core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.