@condor-labs/ec-events-gateway

中文文档
2.0.0发布于 2023/07/07ISCCommonJS近 30 天下载 3004

Client to send events to events gateway API

原始使用文档
文档目录6 节
  1. How to use it
  2. Enviroment variable
  3. Required data
  4. Client Schema
  5. Headers:
  6. Payload max size

Events Gateway Client

Library to send messages through the events gateway service.

How to use it

To use the library you just need to follow the following steps Install the library with npm

npm install @condor-labs/ec-events-gateway

Import the library

const { events } = require('@condor-labs/ec-events-gateway');

with ES6:

import { events } from '@condor-labs/ec-events-gateway':

Enviroment variable

Define a variable in you .env file with the events gateway api URL with the following name:

EVENTS_GATEWAY_URL

That's all you need to start to send data to the events gateway api.

As an alternative you can pass a events gateway api url as parameter:

events.save({payload, type, topic, schema, headers, url: 'http://localhost'});

Required data

To send events through the events gateway client you must send some required fields:

  • type: string,
  • topic: string,
  • payload: object

Client Schema

@hapi/joi is not valid any more use Joi instead

You could define a valid Joi (Joi >= 17.9.2) schema to validate the events data you are sending to the events gateway service.

Example

const schema = {
    firstName: Joi.number().required()
};

You can see more examples on the Joi API Documentation Website.

And then send this schema through the save function as parameter.

events.save({payload, type, topic, schema, headers, url: 'http://localhost'});

Headers:

You should define headers to pass the apikey to the amazon services:

headers: {
    'x-api-key': 'value'
}

Payload max size

Please, be sure the payload data is less than 250kb

版本与发布记录

@condor-labs/ec-events-gateway 共发布 4 个版本,首次发布于 2019/06/26;过去 12 个月发布了 0 个版本。

版本发布日期距今
2.0.0latest2023/07/073 年前
1.2.02019/07/047 年前
1.1.02019/07/037 年前
1.0.02019/06/267 年前

关于 @condor-labs/ec-events-gateway 的常见问题

@condor-labs/ec-events-gateway 是什么?

Client to send events to events gateway API

如何安装 @condor-labs/ec-events-gateway?

在项目目录运行 npm install @condor-labs/ec-events-gateway,或使用 pnpm add / yarn add / bun add。

@condor-labs/ec-events-gateway 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/condor-labs__ec-events-gateway 是否存在。

@condor-labs/ec-events-gateway 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@condor-labs/ec-events-gateway 可以商用吗?

@condor-labs/ec-events-gateway 使用 ISC 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@condor-labs/ec-events-gateway 的下载量有多少?

根据 npm 官方下载统计,@condor-labs/ec-events-gateway 在 2026/10/11 – 2026/11/09 这 30 天内被下载 3,004 次,日均约 100 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@condor-labs/ec-events-gateway 还在维护吗?

最新版本 2.0.0 发布于 2023/07/07(3 年前);至今共发布 4 个版本,其中过去 12 个月发布了 0 个;首次发布于 2019/06/26。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。