1.0.20 • Published 2 years ago

inladajs v1.0.20

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Usage (todo)

const actionProcessor = actionProcessorFactory<ACTION_NAMES_TYPE, PLUGIN_NAMES_TYPE, IEventExtended>(pluginSet);
const errorThrower = errorThrowerFactory<ERROR_NAMES_TYPE, IEventExtended>(ERRORS);
const eventFactory = eventExtendedFactoryFactory(errorThrower, OBJECT_INFO, ENTITY_RELATIONS);
const eventAdapter = eventAdapterFactory<ACTION_NAMES_TYPE, ERROR_NAMES_TYPE, ENTITY_NAMES, OPTIONS_TYPE, PLUGIN_NAMES_TYPE
  >(allowedActions, allowedOptions, routingChanges, setLangAndUserId);
const contractProvider = contractProviderFactory<ACTION_NAMES_TYPE, ENTITY_NAMES, IEventExtended
  >(TRANSFORM_CONTRACTS, setCompanyId);
const eventProcessor = eventProcessorFactory<ACTION_NAMES_TYPE, ERROR_NAMES_TYPE, ENTITY_NAMES, OPTIONS_TYPE, PLUGIN_NAMES_TYPE, IEventExtended
  >(contractProvider, actionProcessor, eventFactory, eventAdapter);

const handler = async (req: Request, res: Response) => {
  try {
    const { objectname: objectName, actionname: actionName, actionnametype: actionNameType } = req.params;
    const { preEvent, preAction } = await eventAdapter.makePreEvent(req.body, objectName, actionName, actionNameType);
    const result = await eventProcessor.processRequest(preEvent, preAction);
    
    if (result.headers) {
      res.set(result.headers);
    }
    return res.status(result.statusCode).send(JSON.parse(lambdaRes.body));
  } catch (e: any) {
    return res.status(500).send(`Action failed, ${e}, ${e?.stack}`);
  }
};
1.0.20

2 years ago

1.0.19

3 years ago

1.0.18

3 years ago

1.0.17

3 years ago

1.0.16

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago