1.0.20 • Published 1 year ago

inladajs v1.0.20

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year 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

1 year ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago