@kne/fastify-webhook 0.1.3 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -10
- package/index.js +55 -46
- package/libs/constants.js +81 -0
- package/libs/controllers/_helper.js +16 -0
- package/libs/controllers/application.js +73 -0
- package/libs/controllers/attempt.js +49 -0
- package/libs/controllers/domain.js +40 -0
- package/libs/controllers/endpoint.js +90 -0
- package/libs/controllers/eventType.js +84 -0
- package/libs/controllers/ingest.js +83 -0
- package/libs/controllers/mcp.js +41 -0
- package/libs/controllers/message.js +56 -0
- package/libs/controllers/misc.js +81 -0
- package/libs/controllers/operational.js +26 -0
- package/libs/controllers/play.js +33 -0
- package/libs/controllers/polling.js +48 -0
- package/libs/controllers/portal.js +32 -0
- package/libs/controllers/public.js +47 -0
- package/libs/controllers/stream.js +74 -0
- package/libs/helpers/context.js +50 -0
- package/libs/models/appPortalSession.js +18 -0
- package/libs/models/application.js +21 -0
- package/libs/models/attempt.js +36 -0
- package/libs/models/channel.js +12 -0
- package/libs/models/customDomain.js +15 -0
- package/libs/models/endpoint.js +37 -0
- package/libs/models/environment.js +13 -0
- package/libs/models/eventType.js +22 -0
- package/libs/models/idempotency.js +14 -0
- package/libs/models/inbox.js +17 -0
- package/libs/models/ingestSource.js +17 -0
- package/libs/models/ingestToken.js +15 -0
- package/libs/models/message.js +27 -0
- package/libs/models/operationalSubscription.js +13 -0
- package/libs/models/pollingConsumer.js +15 -0
- package/libs/models/pollingEndpoint.js +13 -0
- package/libs/models/sink.js +20 -0
- package/libs/models/stream.js +13 -0
- package/libs/models/streamEvent.js +14 -0
- package/libs/models/transformation.js +13 -0
- package/libs/schema/response.js +120 -0
- package/libs/services/appPortal.js +87 -0
- package/libs/services/application.js +94 -0
- package/libs/services/attempt.js +151 -0
- package/libs/services/customDomain.js +87 -0
- package/libs/services/delivery.js +297 -0
- package/libs/services/endpoint.js +236 -0
- package/libs/services/eventType.js +173 -0
- package/libs/services/fifo.js +34 -0
- package/libs/services/inbound.js +108 -0
- package/libs/services/ingest.js +294 -0
- package/libs/services/mcp.js +60 -0
- package/libs/services/message.js +200 -0
- package/libs/services/operational.js +70 -0
- package/libs/services/play.js +87 -0
- package/libs/services/polling.js +162 -0
- package/libs/services/retention.js +66 -0
- package/libs/services/scheduler.js +50 -0
- package/libs/services/sink.js +67 -0
- package/libs/services/stream.js +138 -0
- package/libs/services/throttle.js +63 -0
- package/libs/services/transform.js +102 -0
- package/libs/sinks/index.js +105 -0
- package/libs/utils/common.js +184 -0
- package/libs/utils/index.js +10 -0
- package/libs/utils/outbound.js +114 -0
- package/libs/utils/signature.js +160 -0
- package/package.json +21 -11
- package/libs/controllers/main.js +0 -168
- package/libs/models/client.js +0 -58
- package/libs/models/example._js +0 -18
- package/libs/models/invocation.js +0 -40
- package/libs/services/example._js +0 -10
- package/libs/services/main.js +0 -172
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fp = require('fastify-plugin');
|
|
4
|
+
const { any, str, success, empty } = require('../schema/response');
|
|
5
|
+
const { auth: buildAuth, getAuthenticate: buildAuthenticate } = require('./_helper');
|
|
6
|
+
|
|
7
|
+
const TAG = 'Webhook-Ingest';
|
|
8
|
+
|
|
9
|
+
module.exports = fp(async (fastify, options) => {
|
|
10
|
+
const { services } = fastify[options.name];
|
|
11
|
+
const auth = request => buildAuth(options, request);
|
|
12
|
+
const w = buildAuthenticate(options, 'write');
|
|
13
|
+
const r = buildAuthenticate(options, 'read');
|
|
14
|
+
const publicPrefix = options.publicPrefix || '/api/v1/webhook';
|
|
15
|
+
|
|
16
|
+
fastify.get(`${options.prefix}/ingest/providers`, {
|
|
17
|
+
onRequest: r,
|
|
18
|
+
schema: { tags: [TAG], summary: '支持的 Provider 列表', description: '列出全部可配置的 Ingest Provider 类型' }
|
|
19
|
+
}, async () => ({ providers: services.ingest.listProviders() }));
|
|
20
|
+
|
|
21
|
+
fastify.post(`${options.prefix}/ingest/source/create`, {
|
|
22
|
+
onRequest: w,
|
|
23
|
+
schema: { tags: [TAG], summary: '创建 Ingest Source', description: '创建 Source 并生成 ingestUrl 与初始 token',
|
|
24
|
+
body: { type: 'object', properties: { name: str('名称'), uid: str('外部 ID'), type: str('Provider 类型'), config: { type: 'object' }, destinations: { type: 'array', items: {} }, transformation: { type: 'object' } }, required: ['name', 'type'] },
|
|
25
|
+
response: success('创建成功', { type: 'object', additionalProperties: true }) }
|
|
26
|
+
}, async request => services.ingest.create(auth(request), request.body));
|
|
27
|
+
|
|
28
|
+
fastify.post(`${options.prefix}/ingest/source/save`, {
|
|
29
|
+
onRequest: w,
|
|
30
|
+
schema: { tags: [TAG], summary: '保存 Ingest Source', description: '更新 Source 配置',
|
|
31
|
+
body: { type: 'object', properties: { id: any('ID'), name: str('名称'), config: { type: 'object' }, destinations: { type: 'array', items: {} }, transformation: { type: 'object' }, status: str('状态') }, required: ['id'] },
|
|
32
|
+
response: success('保存成功', { type: 'object', additionalProperties: true }) }
|
|
33
|
+
}, async request => services.ingest.save(auth(request), request.body));
|
|
34
|
+
|
|
35
|
+
fastify.post(`${options.prefix}/ingest/source/remove`, {
|
|
36
|
+
onRequest: w,
|
|
37
|
+
schema: { tags: [TAG], summary: '删除 Ingest Source', description: '删除 Source 及全部 token',
|
|
38
|
+
body: { type: 'object', properties: { id: any('ID') }, required: ['id'] }, response: empty() }
|
|
39
|
+
}, async request => services.ingest.remove(auth(request), request.body));
|
|
40
|
+
|
|
41
|
+
fastify.get(`${options.prefix}/ingest/source/list`, {
|
|
42
|
+
onRequest: r,
|
|
43
|
+
schema: { tags: [TAG], summary: 'Ingest Source 列表', description: '分页查询 Source',
|
|
44
|
+
querystring: { type: 'object', properties: { type: str('Provider 类型'), currentPage: { type: 'number' }, perPage: { type: 'number' } } } }
|
|
45
|
+
}, async request => services.ingest.list(auth(request), request.query));
|
|
46
|
+
|
|
47
|
+
fastify.post(`${options.prefix}/ingest/token/rotate`, {
|
|
48
|
+
onRequest: w,
|
|
49
|
+
schema: { tags: [TAG], summary: '轮换 Ingest token', description: '旧 token 保留 24 小时,期间双 token 并存',
|
|
50
|
+
body: { type: 'object', properties: { sourceId: any('Source ID') }, required: ['sourceId'] }, response: success('轮换成功', { type: 'object', additionalProperties: true }) }
|
|
51
|
+
}, async request => services.ingest.rotateToken(auth(request), request.body));
|
|
52
|
+
|
|
53
|
+
fastify.post(`${options.prefix}/ingest/token/expire`, {
|
|
54
|
+
onRequest: w,
|
|
55
|
+
schema: { tags: [TAG], summary: '失效 Ingest token', description: '使指定版本 token 立即失效',
|
|
56
|
+
body: { type: 'object', properties: { sourceId: any('Source ID'), version: { type: 'number' } }, required: ['sourceId'] }, response: success('操作成功', { type: 'object', additionalProperties: true }) }
|
|
57
|
+
}, async request => services.ingest.expireToken(auth(request), request.body));
|
|
58
|
+
|
|
59
|
+
/** Provider 回调公共入口 */
|
|
60
|
+
fastify.all(`${publicPrefix}/ingest/api/v1/source/:sourceId/in/:token/*`, {
|
|
61
|
+
schema: { tags: [TAG], summary: '接收 Provider 回调', description: '校验 Provider 签名后转成标准 Message 进入投递链' }
|
|
62
|
+
}, async request => {
|
|
63
|
+
const pathSegments = request.params['*'] ? request.params['*'].split('/').filter(Boolean) : [];
|
|
64
|
+
const query = request.query || {};
|
|
65
|
+
return services.ingest.receive(request, request.reply, {
|
|
66
|
+
sourceId: request.params.sourceId,
|
|
67
|
+
token: request.params.token,
|
|
68
|
+
pathSegments,
|
|
69
|
+
query
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
fastify.all(`${publicPrefix}/ingest/api/v1/source/:sourceId/in/:token`, {
|
|
74
|
+
schema: { tags: [TAG], summary: '接收 Provider 回调(无 trailing path)', description: '无 trailing path 的 Provider 回调入口' }
|
|
75
|
+
}, async request => {
|
|
76
|
+
return services.ingest.receive(request, request.reply, {
|
|
77
|
+
sourceId: request.params.sourceId,
|
|
78
|
+
token: request.params.token,
|
|
79
|
+
pathSegments: [],
|
|
80
|
+
query: request.query || {}
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fp = require('fastify-plugin');
|
|
4
|
+
const { success } = require('../schema/response');
|
|
5
|
+
const { auth: buildAuth, getAuthenticate: buildAuthenticate } = require('./_helper');
|
|
6
|
+
|
|
7
|
+
const TAG = 'Webhook-MCP与AI';
|
|
8
|
+
|
|
9
|
+
module.exports = fp(async (fastify, options) => {
|
|
10
|
+
const { services } = fastify[options.name];
|
|
11
|
+
const auth = request => buildAuth(options, request);
|
|
12
|
+
const w = buildAuthenticate(options, 'write');
|
|
13
|
+
const r = buildAuthenticate(options, 'read');
|
|
14
|
+
const publicPrefix = options.publicPrefix || '/api/v1/webhook';
|
|
15
|
+
|
|
16
|
+
fastify.post(`${publicPrefix}/mcp/events`, {
|
|
17
|
+
schema: { tags: [TAG], summary: 'MCP Events 投递', description: '以标准签名向 AI Agent 订阅者推送事件',
|
|
18
|
+
body: { type: 'object', properties: { events: { type: 'array', items: { type: 'object' } } }, required: ['events'] } }
|
|
19
|
+
}, async request => services.mcp.emitEvents(auth(request), request.body.events));
|
|
20
|
+
|
|
21
|
+
fastify.get(`${options.prefix}/mcp/skills`, {
|
|
22
|
+
onRequest: r,
|
|
23
|
+
schema: { tags: [TAG], summary: 'Agent Skills 定义', description: '基于事件目录生成 AI Agent 可消费的 skills 描述' }
|
|
24
|
+
}, async request => services.mcp.getSkills(auth(request)));
|
|
25
|
+
|
|
26
|
+
fastify.get(`${options.prefix}/zapier/definition`, {
|
|
27
|
+
onRequest: r,
|
|
28
|
+
schema: { tags: [TAG], summary: 'Zapier 集成定义', description: '基于事件 Schema 与示例生成 Zapier 集成定义' }
|
|
29
|
+
}, async request => {
|
|
30
|
+
const catalog = await services.eventType.getCatalog(auth(request));
|
|
31
|
+
return {
|
|
32
|
+
version: '1.0.0',
|
|
33
|
+
triggers: catalog.map(event => ({
|
|
34
|
+
key: event.name,
|
|
35
|
+
noun: event.name,
|
|
36
|
+
display: { label: event.displayName || event.name, description: event.description || '' },
|
|
37
|
+
sample: event.examples?.[0] || {}
|
|
38
|
+
}))
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
});
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fp = require('fastify-plugin');
|
|
4
|
+
const { any, str, success, message, messageList } = require('../schema/response');
|
|
5
|
+
const { auth: buildAuth, getAuthenticate: buildAuthenticate } = require('./_helper');
|
|
6
|
+
|
|
7
|
+
const TAG = 'Webhook-消息管理';
|
|
8
|
+
|
|
9
|
+
module.exports = fp(async (fastify, options) => {
|
|
10
|
+
const { services } = fastify[options.name];
|
|
11
|
+
const auth = request => buildAuth(options, request);
|
|
12
|
+
const w = buildAuthenticate(options, 'write');
|
|
13
|
+
const r = buildAuthenticate(options, 'read');
|
|
14
|
+
|
|
15
|
+
fastify.post(`${options.prefix}/message/create`, {
|
|
16
|
+
onRequest: w,
|
|
17
|
+
schema: {
|
|
18
|
+
tags: [TAG], summary: '发送消息', description: '创建消息并按事件类型/channels 扇出到匹配端点;支持 Idempotency-Key 幂等',
|
|
19
|
+
headers: { type: 'object', properties: { 'idempotency-key': { type: 'string', description: '幂等键,12 小时内相同键与内容返回同一结果' } } },
|
|
20
|
+
body: { type: 'object', additionalProperties: true, properties: {
|
|
21
|
+
applicationId: any('应用 ID'), uid: str('外部消息 ID'), eventId: str('业务事件 ID'), type: str('事件类型'),
|
|
22
|
+
channels: { type: 'array', items: { type: 'string' }, description: 'channels' },
|
|
23
|
+
payload: { description: '消息 payload' }, payloadRetentionPeriod: { type: 'number', description: '保留天数' },
|
|
24
|
+
region: str('区域'), metadata: { type: 'object', description: '扩展元数据' }
|
|
25
|
+
}, required: ['applicationId', 'type'] },
|
|
26
|
+
response: success('发送成功', { type: 'object', additionalProperties: true, properties: { id: any('消息 ID'), status: str('状态'), endpoints: { type: 'number', description: '匹配端点数' } } })
|
|
27
|
+
}
|
|
28
|
+
}, async request => {
|
|
29
|
+
const key = request.headers['idempotency-key'] || request.headers['Idempotency-Key'];
|
|
30
|
+
return services.message.create(auth(request), request.body, {
|
|
31
|
+
idempotencyKey: key,
|
|
32
|
+
idempotencyEndpoint: 'message.create'
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
fastify.post(`${options.prefix}/message/create-batch`, {
|
|
37
|
+
onRequest: w,
|
|
38
|
+
schema: { tags: [TAG], summary: '批量发送消息', description: '一次请求创建多条消息',
|
|
39
|
+
body: { type: 'object', properties: { messages: { type: 'array', items: { type: 'object' }, description: '消息列表' } }, required: ['messages'] },
|
|
40
|
+
response: success('发送成功', { type: 'object', additionalProperties: true }) }
|
|
41
|
+
}, async request => services.message.createBatch(auth(request), request.body));
|
|
42
|
+
|
|
43
|
+
fastify.get(`${options.prefix}/message/list`, {
|
|
44
|
+
onRequest: r,
|
|
45
|
+
schema: { tags: [TAG], summary: '消息列表', description: '分页查询消息',
|
|
46
|
+
querystring: { type: 'object', properties: { applicationId: any('应用 ID'), type: str('事件类型'), status: str('状态'), eventId: str('事件 ID'), startTime: str('起始时间'), endTime: str('结束时间'), currentPage: { type: 'number' }, perPage: { type: 'number' } } },
|
|
47
|
+
response: success('查询成功', messageList) }
|
|
48
|
+
}, async request => services.message.list(auth(request), request.query));
|
|
49
|
+
|
|
50
|
+
fastify.get(`${options.prefix}/message/detail`, {
|
|
51
|
+
onRequest: r,
|
|
52
|
+
schema: { tags: [TAG], summary: '消息详情', description: '按 id / uid / eventId 查询消息',
|
|
53
|
+
querystring: { type: 'object', properties: { id: any('消息 ID'), uid: str('外部 ID'), eventId: str('事件 ID') } },
|
|
54
|
+
response: success('查询成功', message) }
|
|
55
|
+
}, async request => services.message.detail(auth(request), request.query));
|
|
56
|
+
});
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fp = require('fastify-plugin');
|
|
4
|
+
const { any, str, success, empty } = require('../schema/response');
|
|
5
|
+
const { auth: buildAuth, getAuthenticate: buildAuthenticate } = require('./_helper');
|
|
6
|
+
|
|
7
|
+
const TAG_TRANSFORM = 'Webhook-变换脚本';
|
|
8
|
+
const TAG_OPS = 'Webhook-运维';
|
|
9
|
+
|
|
10
|
+
module.exports = fp(async (fastify, options) => {
|
|
11
|
+
const { services, models } = fastify[options.name];
|
|
12
|
+
const auth = request => buildAuth(options, request);
|
|
13
|
+
const w = buildAuthenticate(options, 'write');
|
|
14
|
+
const r = buildAuthenticate(options, 'read');
|
|
15
|
+
|
|
16
|
+
// Transformation
|
|
17
|
+
fastify.post(`${options.prefix}/transformation/save`, {
|
|
18
|
+
onRequest: w,
|
|
19
|
+
schema: { tags: [TAG_TRANSFORM], summary: '保存变换脚本', description: '在沙箱中运行 JavaScript handler 修改请求',
|
|
20
|
+
body: { type: 'object', properties: { endpointId: any('端点 ID'), code: str('脚本代码'), enabled: { type: 'boolean' }, variables: { type: 'object' } }, required: ['endpointId'] },
|
|
21
|
+
response: success('保存成功', { type: 'object', additionalProperties: true }) }
|
|
22
|
+
}, async request => services.transform.save(auth(request), request.body));
|
|
23
|
+
|
|
24
|
+
fastify.get(`${options.prefix}/transformation/get`, {
|
|
25
|
+
onRequest: r,
|
|
26
|
+
schema: { tags: [TAG_TRANSFORM], summary: '获取变换脚本', description: '按端点获取变换脚本配置',
|
|
27
|
+
querystring: { type: 'object', properties: { endpointId: any('端点 ID') }, required: ['endpointId'] } }
|
|
28
|
+
}, async request => services.transform.get(auth(request), request.query));
|
|
29
|
+
|
|
30
|
+
fastify.post(`${options.prefix}/transformation/test`, {
|
|
31
|
+
onRequest: r,
|
|
32
|
+
schema: { tags: [TAG_TRANSFORM], summary: '测试变换脚本', description: '用示例输入在沙箱中执行脚本,返回变换结果',
|
|
33
|
+
body: { type: 'object', properties: { code: str('脚本代码'), input: { type: 'object' }, variables: { type: 'object' } }, required: ['code'] } }
|
|
34
|
+
}, async request => {
|
|
35
|
+
const result = await services.transform.run(request.body.code, request.body.input || {}, request.body.variables || {});
|
|
36
|
+
return { result };
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// 手动触发调度 tick
|
|
40
|
+
fastify.post(`${options.prefix}/scheduler/tick`, {
|
|
41
|
+
onRequest: w,
|
|
42
|
+
schema: { tags: [TAG_OPS], summary: '手动触发重试调度', description: '扫描并执行所有到期的重试任务',
|
|
43
|
+
response: success('执行完成', { type: 'object', additionalProperties: true }) }
|
|
44
|
+
}, async () => services.scheduler.tick());
|
|
45
|
+
|
|
46
|
+
// 保留清理
|
|
47
|
+
fastify.post(`${options.prefix}/retention/cleanup`, {
|
|
48
|
+
onRequest: w,
|
|
49
|
+
schema: { tags: [TAG_OPS], summary: '手动执行保留清理', description: '清理超出保留期的 payload、过期幂等键与会话',
|
|
50
|
+
response: success('清理完成', { type: 'object', additionalProperties: true }) }
|
|
51
|
+
}, async () => services.retention.cleanup());
|
|
52
|
+
|
|
53
|
+
// 环境管理
|
|
54
|
+
fastify.post(`${options.prefix}/environment/create`, {
|
|
55
|
+
onRequest: w,
|
|
56
|
+
schema: { tags: [TAG_OPS], summary: '创建环境', description: '创建顶层隔离环境',
|
|
57
|
+
body: { type: 'object', properties: { name: str('名称'), region: str('区域'), uid: str('外部 ID'), settings: { type: 'object' } }, required: ['name'] },
|
|
58
|
+
response: success('创建成功', { type: 'object', additionalProperties: true }) }
|
|
59
|
+
}, async request => models.environment.create(request.body));
|
|
60
|
+
|
|
61
|
+
fastify.get(`${options.prefix}/environment/list`, {
|
|
62
|
+
onRequest: r,
|
|
63
|
+
schema: { tags: [TAG_OPS], summary: '环境列表', description: '查询全部环境' }
|
|
64
|
+
}, async () => ({ list: await models.environment.findAll() }));
|
|
65
|
+
|
|
66
|
+
fastify.post(`${options.prefix}/environment/save`, {
|
|
67
|
+
onRequest: w,
|
|
68
|
+
schema: { tags: [TAG_OPS], summary: '保存环境设置', description: '更新环境的重试/变换/保留/自动禁用开关',
|
|
69
|
+
body: { type: 'object', properties: { id: any('ID'), name: str('名称'), settings: { type: 'object' } }, required: ['id'] },
|
|
70
|
+
response: success('保存成功', { type: 'object', additionalProperties: true }) }
|
|
71
|
+
}, async request => {
|
|
72
|
+
const record = await models.environment.findByPk(request.body.id);
|
|
73
|
+
if (!record) {
|
|
74
|
+
throw new Error('环境不存在');
|
|
75
|
+
}
|
|
76
|
+
if (request.body.name !== undefined) record.name = request.body.name;
|
|
77
|
+
if (request.body.settings !== undefined) record.settings = request.body.settings;
|
|
78
|
+
await record.save();
|
|
79
|
+
return record;
|
|
80
|
+
});
|
|
81
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fp = require('fastify-plugin');
|
|
4
|
+
const { any, str, success } = require('../schema/response');
|
|
5
|
+
const { auth: buildAuth, getAuthenticate: buildAuthenticate } = require('./_helper');
|
|
6
|
+
|
|
7
|
+
const TAG = 'Webhook-运营事件';
|
|
8
|
+
|
|
9
|
+
module.exports = fp(async (fastify, options) => {
|
|
10
|
+
const { services } = fastify[options.name];
|
|
11
|
+
const auth = request => buildAuth(options, request);
|
|
12
|
+
const w = buildAuthenticate(options, 'write');
|
|
13
|
+
const r = buildAuthenticate(options, 'read');
|
|
14
|
+
|
|
15
|
+
fastify.post(`${options.prefix}/operational-webhook/subscribe`, {
|
|
16
|
+
onRequest: w,
|
|
17
|
+
schema: { tags: [TAG], summary: '订阅运营 webhook', description: '订阅 endpoint.disabled / message.attempt.exhausted 等运营事件',
|
|
18
|
+
body: { type: 'object', properties: { url: str('接收 URL'), eventTypes: { type: 'array', items: { type: 'string' } }, secret: str('签名密钥') }, required: ['url'] },
|
|
19
|
+
response: success('订阅成功', { type: 'object', additionalProperties: true }) }
|
|
20
|
+
}, async request => services.operational.subscribe(auth(request), request.body));
|
|
21
|
+
|
|
22
|
+
fastify.get(`${options.prefix}/operational-webhook/list`, {
|
|
23
|
+
onRequest: r,
|
|
24
|
+
schema: { tags: [TAG], summary: '运营 webhook 订阅列表', description: '查询当前租户的运营事件订阅' }
|
|
25
|
+
}, async request => ({ list: await services.operational.list(auth(request)) }));
|
|
26
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fp = require('fastify-plugin');
|
|
4
|
+
const { str, success } = require('../schema/response');
|
|
5
|
+
|
|
6
|
+
const TAG = 'Webhook-调试器';
|
|
7
|
+
|
|
8
|
+
module.exports = fp(async (fastify, options) => {
|
|
9
|
+
const { services } = fastify[options.name];
|
|
10
|
+
const publicPrefix = options.publicPrefix || '/api/v1/webhook';
|
|
11
|
+
|
|
12
|
+
fastify.post(`${publicPrefix}/play/token/generate`, {
|
|
13
|
+
schema: { tags: [TAG], summary: '生成调试 token', description: '生成一个调试 URL token' }
|
|
14
|
+
}, async () => services.play.generate());
|
|
15
|
+
|
|
16
|
+
fastify.post(`${publicPrefix}/play/configure`, {
|
|
17
|
+
schema: { tags: [TAG], summary: '配置调试行为', description: '设置强制状态码、随机失败率、回显与签名密钥',
|
|
18
|
+
body: { type: 'object', properties: { token: str('token'), forceStatusCode: { type: 'number' }, randomFailureRate: { type: 'number' }, echoBody: { type: 'boolean' }, signingSecret: str('签名密钥') }, required: ['token'] } }
|
|
19
|
+
}, async request => services.play.configure(request.body.token, request.body));
|
|
20
|
+
|
|
21
|
+
fastify.all(`${publicPrefix}/play/in/:token`, {
|
|
22
|
+
schema: { tags: [TAG], summary: '调试接收端', description: '接收任意请求,按配置返回状态码并记录历史' }
|
|
23
|
+
}, async (request, reply) => services.play.inbound(request.params.token, request, reply));
|
|
24
|
+
|
|
25
|
+
fastify.get(`${publicPrefix}/play/history/:token`, {
|
|
26
|
+
schema: { tags: [TAG], summary: '查询调试历史', description: '按 iterator 分页查询接收到的请求历史',
|
|
27
|
+
querystring: { type: 'object', properties: { iterator: { type: 'number' }, limit: { type: 'number' } } } }
|
|
28
|
+
}, async request => services.play.history(request.params.token, request.query));
|
|
29
|
+
|
|
30
|
+
fastify.delete(`${publicPrefix}/play/history/:token`, {
|
|
31
|
+
schema: { tags: [TAG], summary: '清空调试历史', description: '清空指定 token 的请求历史' }
|
|
32
|
+
}, async request => services.play.clearHistory(request.params.token));
|
|
33
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fp = require('fastify-plugin');
|
|
4
|
+
const { any, str, success } = require('../schema/response');
|
|
5
|
+
const { auth: buildAuth, getAuthenticate: buildAuthenticate } = require('./_helper');
|
|
6
|
+
|
|
7
|
+
const TAG = 'Webhook-Polling';
|
|
8
|
+
|
|
9
|
+
module.exports = fp(async (fastify, options) => {
|
|
10
|
+
const { services } = fastify[options.name];
|
|
11
|
+
const auth = request => buildAuth(options, request);
|
|
12
|
+
const w = buildAuthenticate(options, 'write');
|
|
13
|
+
const r = buildAuthenticate(options, 'read');
|
|
14
|
+
const publicPrefix = options.publicPrefix || '/api/v1/webhook';
|
|
15
|
+
|
|
16
|
+
fastify.post(`${options.prefix}/polling-endpoint/credentials`, {
|
|
17
|
+
onRequest: w,
|
|
18
|
+
schema: { tags: [TAG], summary: '生成 Polling 凭证', description: '为 Polling 端点生成唯一 URL 与 API Key(仅此一次明文)',
|
|
19
|
+
body: { type: 'object', properties: { endpointId: any('端点 ID') }, required: ['endpointId'] },
|
|
20
|
+
response: success('生成成功', { type: 'object', properties: { url: str('拉取 URL'), apiKey: str('API Key') } }) }
|
|
21
|
+
}, async request => services.polling.createCredentials(auth(request), request.body.endpointId));
|
|
22
|
+
|
|
23
|
+
fastify.get(`${publicPrefix}/polling/:token`, {
|
|
24
|
+
schema: { tags: [TAG], summary: 'Polling 拉取', description: 'consumer 凭 token/apiKey/consumerId 拉取消息',
|
|
25
|
+
querystring: { type: 'object', properties: { consumerId: { type: 'string', description: '稳定 consumer ID' }, batchSize: { type: 'number' } }, required: ['consumerId'] } }
|
|
26
|
+
}, async request => {
|
|
27
|
+
const apiKey = request.headers['x-webhook-api-key'] || request.headers['authorization']?.replace(/^Bearer\s+/i, '');
|
|
28
|
+
return services.polling.consume({
|
|
29
|
+
token: request.params.token,
|
|
30
|
+
apiKey,
|
|
31
|
+
consumerId: request.query.consumerId,
|
|
32
|
+
batchSize: request.query.batchSize
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
fastify.post(`${publicPrefix}/polling/:token/commit`, {
|
|
37
|
+
schema: { tags: [TAG], summary: '提交 Polling offset', description: '确认消费成功并提交 offset',
|
|
38
|
+
body: { type: 'object', properties: { consumerId: { type: 'string' }, offset: { type: 'number' } }, required: ['consumerId', 'offset'] } }
|
|
39
|
+
}, async request => {
|
|
40
|
+
const apiKey = request.headers['x-webhook-api-key'] || request.headers['authorization']?.replace(/^Bearer\s+/i, '');
|
|
41
|
+
return services.polling.commit({
|
|
42
|
+
token: request.params.token,
|
|
43
|
+
apiKey,
|
|
44
|
+
consumerId: request.body.consumerId,
|
|
45
|
+
offset: request.body.offset
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fp = require('fastify-plugin');
|
|
4
|
+
const { any, str, success } = require('../schema/response');
|
|
5
|
+
const { auth: buildAuth, getAuthenticate: buildAuthenticate } = require('./_helper');
|
|
6
|
+
|
|
7
|
+
const TAG = 'Webhook-App Portal';
|
|
8
|
+
|
|
9
|
+
module.exports = fp(async (fastify, options) => {
|
|
10
|
+
const { services } = fastify[options.name];
|
|
11
|
+
const auth = request => buildAuth(options, request);
|
|
12
|
+
const w = buildAuthenticate(options, 'write');
|
|
13
|
+
|
|
14
|
+
fastify.post(`${options.prefix}/authentication/app-portal-access`, {
|
|
15
|
+
onRequest: w,
|
|
16
|
+
schema: { tags: [TAG], summary: '生成 Portal magic link', description: '生成一次性 magic link,客户无需账号即可管理端点',
|
|
17
|
+
body: { type: 'object', properties: { applicationId: any('应用 ID'), featureFlags: { type: 'array', items: { type: 'string' } }, sessionId: str('会话 ID'), next: str('落地页'), branding: { type: 'object', description: '白标参数' } }, required: ['applicationId'] },
|
|
18
|
+
response: success('生成成功', { type: 'object', properties: { token: str('token'), url: str('magic link'), expiresAt: str('过期时间') } }) }
|
|
19
|
+
}, async request => services.appPortal.appPortalAccess(auth(request), request.body));
|
|
20
|
+
|
|
21
|
+
fastify.post(`${options.prefix}/authentication/app-portal-expire-all`, {
|
|
22
|
+
onRequest: w,
|
|
23
|
+
schema: { tags: [TAG], summary: '失效 Portal 会话', description: '按 sessionId 或应用批量失效会话',
|
|
24
|
+
body: { type: 'object', properties: { sessionId: str('会话 ID'), applicationId: any('应用 ID') } },
|
|
25
|
+
response: success('操作成功', { type: 'object', additionalProperties: true }) }
|
|
26
|
+
}, async request => services.appPortal.expireAll(auth(request), request.body));
|
|
27
|
+
|
|
28
|
+
fastify.get(`${options.prefix}/authentication/portal-session`, {
|
|
29
|
+
schema: { tags: [TAG], summary: '校验 Portal 会话', description: '用 magic link token 换取会话上下文',
|
|
30
|
+
querystring: { type: 'object', properties: { token: { type: 'string', description: 'magic link token' } }, required: ['token'] } }
|
|
31
|
+
}, async request => services.appPortal.verifySession(request.query.token));
|
|
32
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fp = require('fastify-plugin');
|
|
4
|
+
const { auth: buildAuth, getAuthenticate: buildAuthenticate } = require('./_helper');
|
|
5
|
+
|
|
6
|
+
module.exports = fp(async (fastify, options) => {
|
|
7
|
+
const { services } = fastify[options.name];
|
|
8
|
+
const auth = request => buildAuth(options, request);
|
|
9
|
+
const r = buildAuthenticate(options, 'read');
|
|
10
|
+
const w = buildAuthenticate(options, 'write');
|
|
11
|
+
const publicPrefix = options.publicPrefix || '/api/v1/webhook';
|
|
12
|
+
|
|
13
|
+
// 原始请求体捕获:验签必须使用未经解析的 body。
|
|
14
|
+
// 在 preParsing 阶段拦截流,保存原始字节后再交回给 fastify 解析。
|
|
15
|
+
fastify.addHook('preParsing', async (request, reply, payload) => {
|
|
16
|
+
const pathname = request.url.split('?')[0];
|
|
17
|
+
if (pathname.includes('/webhook/invoke/') || pathname.includes('/ingest/') || pathname.includes('/play/in/')) {
|
|
18
|
+
const chunks = [];
|
|
19
|
+
for await (const chunk of payload) {
|
|
20
|
+
chunks.push(chunk);
|
|
21
|
+
}
|
|
22
|
+
const raw = Buffer.concat(chunks);
|
|
23
|
+
request.rawBody = raw;
|
|
24
|
+
const { Readable } = require('node:stream');
|
|
25
|
+
return Readable.from([raw]);
|
|
26
|
+
}
|
|
27
|
+
return payload;
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
/** Inbound 接收端点 */
|
|
31
|
+
fastify.post(`${publicPrefix}/webhook/invoke/:pathToken`, {
|
|
32
|
+
schema: {
|
|
33
|
+
tags: ['Webhook-公共入口'],
|
|
34
|
+
summary: '接收入站 Webhook',
|
|
35
|
+
description: '外部系统回调入口,验证 Standard Webhooks 签名、按 webhook-id 去重后交给业务 handler'
|
|
36
|
+
}
|
|
37
|
+
}, async (request, reply) => services.inbound.receive(request, reply, request.params.pathToken));
|
|
38
|
+
|
|
39
|
+
/** Inbox 记录查询 */
|
|
40
|
+
fastify.get(`${options.prefix}/inbox/list`, {
|
|
41
|
+
onRequest: r,
|
|
42
|
+
schema: {
|
|
43
|
+
tags: ['Webhook-入站'], summary: '入站记录列表', description: '查询入站 webhook 的接收记录',
|
|
44
|
+
querystring: { type: 'object', properties: { status: { type: 'string' }, currentPage: { type: 'number' }, perPage: { type: 'number' } } }
|
|
45
|
+
}
|
|
46
|
+
}, async request => services.inbound.listInbox(auth(request), request.query));
|
|
47
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fp = require('fastify-plugin');
|
|
4
|
+
const { any, str, success, empty } = require('../schema/response');
|
|
5
|
+
const { auth: buildAuth, getAuthenticate: buildAuthenticate } = require('./_helper');
|
|
6
|
+
|
|
7
|
+
const TAG = 'Webhook-Stream与Sink';
|
|
8
|
+
|
|
9
|
+
module.exports = fp(async (fastify, options) => {
|
|
10
|
+
const { services } = fastify[options.name];
|
|
11
|
+
const auth = request => buildAuth(options, request);
|
|
12
|
+
const w = buildAuthenticate(options, 'write');
|
|
13
|
+
const r = buildAuthenticate(options, 'read');
|
|
14
|
+
|
|
15
|
+
fastify.post(`${options.prefix}/stream/create`, {
|
|
16
|
+
onRequest: w,
|
|
17
|
+
schema: { tags: [TAG], summary: '创建 Stream', description: '创建事件流',
|
|
18
|
+
body: { type: 'object', properties: { name: str('名称'), uid: str('外部 ID'), description: str('描述') }, required: ['name'] },
|
|
19
|
+
response: success('创建成功', { type: 'object', additionalProperties: true }) }
|
|
20
|
+
}, async request => services.stream.createStream(auth(request), request.body));
|
|
21
|
+
|
|
22
|
+
fastify.post(`${options.prefix}/stream/save`, {
|
|
23
|
+
onRequest: w,
|
|
24
|
+
schema: { tags: [TAG], summary: '保存 Stream', description: '更新 Stream 配置',
|
|
25
|
+
body: { type: 'object', properties: { id: any('ID'), name: str('名称'), description: str('描述'), status: str('状态') }, required: ['id'] },
|
|
26
|
+
response: success('保存成功', { type: 'object', additionalProperties: true }) }
|
|
27
|
+
}, async request => services.stream.saveStream(auth(request), request.body));
|
|
28
|
+
|
|
29
|
+
fastify.post(`${options.prefix}/stream/remove`, {
|
|
30
|
+
onRequest: w,
|
|
31
|
+
schema: { tags: [TAG], summary: '删除 Stream', description: '删除 Stream 及其 Sink 与事件',
|
|
32
|
+
body: { type: 'object', properties: { id: any('ID') }, required: ['id'] }, response: empty() }
|
|
33
|
+
}, async request => services.stream.removeStream(auth(request), request.body));
|
|
34
|
+
|
|
35
|
+
fastify.get(`${options.prefix}/stream/list`, {
|
|
36
|
+
onRequest: r,
|
|
37
|
+
schema: { tags: [TAG], summary: 'Stream 列表', description: '分页查询 Stream',
|
|
38
|
+
querystring: { type: 'object', properties: { currentPage: { type: 'number' }, perPage: { type: 'number' } } } }
|
|
39
|
+
}, async request => services.stream.listStreams(auth(request), request.query));
|
|
40
|
+
|
|
41
|
+
fastify.post(`${options.prefix}/stream/:streamId/sink/create`, {
|
|
42
|
+
onRequest: w,
|
|
43
|
+
schema: { tags: [TAG], summary: '创建 Sink', description: '创建目标 Sink(S3/SQS/Snowflake/BigQuery/RabbitMQ/Datadog/ClickHouse/EventBridge/Azure Blob/GCS)',
|
|
44
|
+
body: { type: 'object', properties: { type: str('Sink 类型'), uid: str('外部 ID'), config: { type: 'object' }, batchSize: { type: 'number' }, maxWaitSecs: { type: 'number' }, eventTypes: { type: 'array', items: { type: 'string' } }, metadata: { type: 'object' }, transformation: { type: 'object' } }, required: ['type'] },
|
|
45
|
+
response: success('创建成功', { type: 'object', additionalProperties: true }) }
|
|
46
|
+
}, async request => services.stream.createSink(auth(request), request.params.streamId, request.body));
|
|
47
|
+
|
|
48
|
+
fastify.post(`${options.prefix}/stream/:streamId/sink/save`, {
|
|
49
|
+
onRequest: w,
|
|
50
|
+
schema: { tags: [TAG], summary: '保存 Sink', description: '更新 Sink 配置',
|
|
51
|
+
body: { type: 'object', properties: { id: any('ID'), config: { type: 'object' }, batchSize: { type: 'number' }, maxWaitSecs: { type: 'number' }, eventTypes: { type: 'array', items: { type: 'string' } }, status: str('状态') }, required: ['id'] },
|
|
52
|
+
response: success('保存成功', { type: 'object', additionalProperties: true }) }
|
|
53
|
+
}, async request => services.stream.saveSink(auth(request), request.body));
|
|
54
|
+
|
|
55
|
+
fastify.post(`${options.prefix}/stream/:streamId/sink/remove`, {
|
|
56
|
+
onRequest: w,
|
|
57
|
+
schema: { tags: [TAG], summary: '删除 Sink', description: '删除 Sink',
|
|
58
|
+
body: { type: 'object', properties: { id: any('ID') }, required: ['id'] }, response: empty() }
|
|
59
|
+
}, async request => services.stream.removeSink(auth(request), request.body));
|
|
60
|
+
|
|
61
|
+
fastify.get(`${options.prefix}/stream/:streamId/sink/list`, {
|
|
62
|
+
onRequest: r,
|
|
63
|
+
schema: { tags: [TAG], summary: 'Sink 列表', description: '查询 Stream 下的 Sink',
|
|
64
|
+
params: { type: 'object', properties: { streamId: any('Stream ID') } } }
|
|
65
|
+
}, async request => ({ list: await services.stream.listSinks(auth(request), request.params) }));
|
|
66
|
+
|
|
67
|
+
fastify.post(`${options.prefix}/stream/:streamId/events`, {
|
|
68
|
+
onRequest: w,
|
|
69
|
+
schema: { tags: [TAG], summary: '写入 Stream 事件', description: '批量写入事件并按 Sink 配置分发',
|
|
70
|
+
params: { type: 'object', properties: { streamId: any('Stream ID') } },
|
|
71
|
+
body: { type: 'object', properties: { events: { type: 'array', items: { type: 'object' }, description: '事件列表' } }, required: ['events'] },
|
|
72
|
+
response: success('写入成功', { type: 'object', additionalProperties: true }) }
|
|
73
|
+
}, async request => services.stream.publishEvents(auth(request), request.params.streamId, request.body.events));
|
|
74
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fp = require('fastify-plugin');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 所有 service 共享的上下文:从 fastify.webhook 命名空间取出 models、utils、options。
|
|
7
|
+
* 用 fastify-plugin 包装以避免 namespace encapsulation 导致重复实例。
|
|
8
|
+
*/
|
|
9
|
+
module.exports = fp(async (fastify, options) => {
|
|
10
|
+
const ns = fastify[options.name];
|
|
11
|
+
const { Op, Sequelize } = fastify.sequelize.Sequelize;
|
|
12
|
+
// 工具函数是纯函数,直接引入以避免依赖 autoload 注册顺序
|
|
13
|
+
const utils = Object.assign(
|
|
14
|
+
{},
|
|
15
|
+
require('../utils/signature'),
|
|
16
|
+
require('../utils/common'),
|
|
17
|
+
require('../utils/outbound')
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
const context = {
|
|
21
|
+
fastify,
|
|
22
|
+
options,
|
|
23
|
+
Op,
|
|
24
|
+
Sequelize,
|
|
25
|
+
utils,
|
|
26
|
+
get models() {
|
|
27
|
+
return ns.models;
|
|
28
|
+
},
|
|
29
|
+
get services() {
|
|
30
|
+
return ns.services;
|
|
31
|
+
},
|
|
32
|
+
/** 依据租户标识过滤 where 条件;缺省 tenantId 为空串,表示全局作用域 */
|
|
33
|
+
tenantWhere(authenticatePayload, extra = {}, { includeGlobal = false } = {}) {
|
|
34
|
+
const tenantId = context.utils.resolveTenantId(authenticatePayload);
|
|
35
|
+
if (includeGlobal && tenantId !== '') {
|
|
36
|
+
return Object.assign({}, extra, { tenantId: { [Op.in]: [tenantId, ''] } });
|
|
37
|
+
}
|
|
38
|
+
return Object.assign({}, extra, { tenantId });
|
|
39
|
+
},
|
|
40
|
+
/** 分页参数解析 */
|
|
41
|
+
pageParams(params = {}) {
|
|
42
|
+
const currentPage = Math.max(1, Number(params.currentPage) || 1);
|
|
43
|
+
const perPage = Math.min(500, Math.max(1, Number(params.perPage) || 10));
|
|
44
|
+
return { currentPage, perPage, offset: (currentPage - 1) * perPage, limit: perPage };
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// namespace 会预先把 context 置为 {},这里直接覆盖为真实上下文
|
|
49
|
+
ns.context = context;
|
|
50
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module.exports = ({ DataTypes, definePrimaryType, options }) => ({
|
|
2
|
+
model: {
|
|
3
|
+
applicationId: definePrimaryType('applicationId', { allowNull: false, comment: '应用 ID' }),
|
|
4
|
+
tenantId: { type: DataTypes.STRING, allowNull: false, defaultValue: '', comment: '租户 ID,空字符串表示全局' },
|
|
5
|
+
tokenHash: { type: DataTypes.STRING, allowNull: false, comment: 'magic link token 哈希' },
|
|
6
|
+
sessionId: { type: DataTypes.STRING, comment: '会话标识,用于批量失效' },
|
|
7
|
+
featureFlags: { type: DataTypes.JSON, defaultValue: [], comment: '可见事件 feature flags' },
|
|
8
|
+
next: { type: DataTypes.STRING, comment: '落地页' },
|
|
9
|
+
branding: { type: DataTypes.JSON, defaultValue: {}, comment: '白标参数' },
|
|
10
|
+
expiresAt: { type: DataTypes.DATE, allowNull: false, comment: '过期时间' },
|
|
11
|
+
usedAt: { type: DataTypes.DATE, comment: '首次使用时间' },
|
|
12
|
+
status: { type: DataTypes.ENUM('active', 'expired'), defaultValue: 'active', comment: '状态' }
|
|
13
|
+
},
|
|
14
|
+
options: {
|
|
15
|
+
comment: 'Webhook App Portal 会话',
|
|
16
|
+
indexes: [{ fields: ['tenant_id', 'token_hash'], unique: true }, { fields: ['tenant_id', 'application_id', 'session_id'] }, { fields: ['expires_at'] }]
|
|
17
|
+
}
|
|
18
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module.exports = ({ DataTypes, definePrimaryType, options }) => ({
|
|
2
|
+
model: {
|
|
3
|
+
tenantId: { type: DataTypes.STRING, allowNull: false, defaultValue: '', comment: '租户 ID,空字符串表示全局' },
|
|
4
|
+
environmentId: definePrimaryType('environmentId', { comment: '所属环境 ID' }),
|
|
5
|
+
uid: { type: DataTypes.STRING, comment: '外部消费者 ID,可直接替代应用 ID' },
|
|
6
|
+
name: { type: DataTypes.STRING, allowNull: false, comment: '应用名称' },
|
|
7
|
+
description: { type: DataTypes.STRING, comment: '应用描述' },
|
|
8
|
+
throttleRate: { type: DataTypes.INTEGER, comment: '应用级限流(messages/sec)' },
|
|
9
|
+
status: { type: DataTypes.ENUM('active', 'disabled'), defaultValue: 'active', comment: '应用状态' },
|
|
10
|
+
region: { type: DataTypes.STRING, comment: '数据驻留区域' },
|
|
11
|
+
metadata: { type: DataTypes.JSON, defaultValue: {}, comment: '扩展元数据' }
|
|
12
|
+
},
|
|
13
|
+
options: {
|
|
14
|
+
comment: 'Webhook 应用(消费者)',
|
|
15
|
+
indexes: [
|
|
16
|
+
{ fields: ['tenant_id', 'uid'], unique: true },
|
|
17
|
+
{ fields: ['tenant_id', 'status'] },
|
|
18
|
+
{ fields: ['environment_id'] }
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
});
|