lemon-core 5.0.5 → 5.0.7
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 +168 -136
- package/dist/cores/lambda/lambda-alb-handler.js +5 -0
- package/dist/cores/lambda/lambda-alb-handler.js.map +1 -1
- package/dist/cores/lambda/lambda-sns-handler.d.ts +7 -1
- package/dist/cores/lambda/lambda-sns-handler.js +26 -3
- package/dist/cores/lambda/lambda-sns-handler.js.map +1 -1
- package/dist/cores/lambda/lambda-sqs-handler.d.ts +7 -1
- package/dist/cores/lambda/lambda-sqs-handler.js +26 -3
- package/dist/cores/lambda/lambda-sqs-handler.js.map +1 -1
- package/dist/cores/lambda/lambda-web-handler.js +47 -6
- package/dist/cores/lambda/lambda-web-handler.js.map +1 -1
- package/dist/cores/protocol/protocol-relay.d.ts +123 -0
- package/dist/cores/protocol/protocol-relay.js +339 -0
- package/dist/cores/protocol/protocol-relay.js.map +1 -0
- package/dist/cores/protocol/protocol-service.d.ts +8 -2
- package/dist/cores/protocol/protocol-service.js +110 -29
- package/dist/cores/protocol/protocol-service.js.map +1 -1
- package/dist/cores/protocol/protocol-sign.d.ts +10 -0
- package/dist/cores/protocol/protocol-sign.js +14 -3
- package/dist/cores/protocol/protocol-sign.js.map +1 -1
- package/dist/engine/engine.js +9 -2
- package/dist/engine/engine.js.map +1 -1
- package/dist/esm/index.mjs +1 -0
- package/dist/extended/cores/abstract-controllers.d.ts +18 -4
- package/dist/extended/cores/abstract-controllers.js +59 -19
- package/dist/extended/cores/abstract-controllers.js.map +1 -1
- package/dist/extended/cores/abstract-services.d.ts +54 -4
- package/dist/extended/cores/abstract-services.js +159 -14
- package/dist/extended/cores/abstract-services.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.accountOfArn = exports.logTrace = exports.traceLine = exports.warnJsonIdentity = exports.acceptLegacy = exports.nextHopContext = exports.entryTrace = exports.entryChannel = exports.asRelayContext = exports.decodeRelay = exports.encodeRelay = exports.buildRelay = exports.relayIdentityOf = exports.assertHop = exports.readMaxHop = exports.readLegacyAccept = exports.readLegacySend = exports.traceIdOf = exports.SAFE_TRACE_ID = exports.DEFAULT_MAX_HOP = exports.PROTOCOL_MAX_HOP = exports.PROTOCOL_LEGACY_ACCEPT = exports.PROTOCOL_LEGACY_CONTEXT = exports.RELAY_IDENTITY_FIELDS = exports.RELAY_MAX_BYTES = exports.RELAY_PREFIX = exports.RELAY_PARAM = exports.HEADER_LEMON_RELAY = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* `cores/protocol/protocol-relay.ts`
|
|
9
|
+
* - v5 B14: the relay envelope of an internal hop — a whitelisted identity and the trace, nothing else.
|
|
10
|
+
* - web: header `x-lemon-relay`. SNS/SQS: the `relay` field of the protocol param (no `context` field).
|
|
11
|
+
* - value `r1.<base64url(JSON)>`, JSON keys `idt tid hop src via pid iat`. signed by the existing signature
|
|
12
|
+
* (web: the relay string in the context slot of the canonical; SNS/SQS: the message signature).
|
|
13
|
+
* - the legacy `x-protocol-context` (full context) is deprecated: `PROTOCOL_LEGACY_CONTEXT` (send) and
|
|
14
|
+
* `PROTOCOL_LEGACY_ACCEPT` (receive) decide whether it is sent and accepted. removal in v6.
|
|
15
|
+
* - hop cap `PROTOCOL_MAX_HOP` (default 8): `508 LOOP DETECTED - protocol hop <n>` on send and on receive.
|
|
16
|
+
* - NOTE: deep module only (`./dist/cores/protocol/protocol-relay`). not re-exported by the root.
|
|
17
|
+
*
|
|
18
|
+
* @author Steve Jung <steve@lemoncloud.io>
|
|
19
|
+
* @date 2026-10-30 initial version (v5 B14)
|
|
20
|
+
* @date 2026-10-30 a safe trace id (`SAFE_TRACE_ID`), and `nextHopContext()` for an in-process (same-service) callback.
|
|
21
|
+
*
|
|
22
|
+
* @copyright (C) lemoncloud.io 2026 - All Rights Reserved.
|
|
23
|
+
*/
|
|
24
|
+
const crypto_1 = require("crypto");
|
|
25
|
+
const url_1 = __importDefault(require("url"));
|
|
26
|
+
const engine_1 = require("../../engine/");
|
|
27
|
+
const protocol_sign_1 = require("./protocol-sign");
|
|
28
|
+
Object.defineProperty(exports, "HEADER_LEMON_RELAY", { enumerable: true, get: function () { return protocol_sign_1.HEADER_LEMON_RELAY; } });
|
|
29
|
+
const NS = engine_1.$U.NS('PRTS', 'yellow'); // NAMESPACE TO BE PRINTED.
|
|
30
|
+
/** field name of the relay in the SNS/SQS protocol param */
|
|
31
|
+
exports.RELAY_PARAM = 'relay';
|
|
32
|
+
/** prefix (format version) of the relay value */
|
|
33
|
+
exports.RELAY_PREFIX = 'r1.';
|
|
34
|
+
/** max bytes of a relay value (the receiver rejects a larger one) */
|
|
35
|
+
exports.RELAY_MAX_BYTES = 4096;
|
|
36
|
+
/** identity fields that cross a hop (whitelist). nothing else of `NextIdentity` is relayed */
|
|
37
|
+
exports.RELAY_IDENTITY_FIELDS = ['sid', 'uid', 'gid', 'roles', 'identityId', 'lang'];
|
|
38
|
+
/** env name of the send mode of the legacy context (`off` | `send`) */
|
|
39
|
+
exports.PROTOCOL_LEGACY_CONTEXT = 'PROTOCOL_LEGACY_CONTEXT';
|
|
40
|
+
/** env name of the receive mode of the legacy context (`accept` | `warn` | `reject`) */
|
|
41
|
+
exports.PROTOCOL_LEGACY_ACCEPT = 'PROTOCOL_LEGACY_ACCEPT';
|
|
42
|
+
/** env name of the hop cap */
|
|
43
|
+
exports.PROTOCOL_MAX_HOP = 'PROTOCOL_MAX_HOP';
|
|
44
|
+
/** default hop cap */
|
|
45
|
+
exports.DEFAULT_MAX_HOP = 8;
|
|
46
|
+
/** a requestId used as a trace id as is (else a new uuid): the local express id `YYYY-MM-DD hh:mm:ss.SSS` is not */
|
|
47
|
+
exports.SAFE_TRACE_ID = /^[\w.:-]{1,128}$/;
|
|
48
|
+
/** the requestId as a trace id if it is a safe token, else a new uuid (unique, no whitespace) */
|
|
49
|
+
const traceIdOf = (requestId) => typeof requestId === 'string' && exports.SAFE_TRACE_ID.test(requestId) ? requestId : (0, crypto_1.randomUUID)();
|
|
50
|
+
exports.traceIdOf = traceIdOf;
|
|
51
|
+
//* the relay keys in the order they are written.
|
|
52
|
+
const RELAY_KEYS = ['idt', 'tid', 'hop', 'src', 'via', 'pid', 'iat'];
|
|
53
|
+
//* max length of a string field of the relay.
|
|
54
|
+
const MAX_TEXT = 2048;
|
|
55
|
+
/** read the send mode of the legacy context (default `off`) */
|
|
56
|
+
const readLegacySend = () => `${(0, protocol_sign_1.readConfig)(exports.PROTOCOL_LEGACY_CONTEXT) ?? ''}`.trim().toLowerCase() === 'send' ? 'send' : 'off';
|
|
57
|
+
exports.readLegacySend = readLegacySend;
|
|
58
|
+
/** read the receive mode of the legacy context (default `warn`) */
|
|
59
|
+
const readLegacyAccept = () => {
|
|
60
|
+
const mode = `${(0, protocol_sign_1.readConfig)(exports.PROTOCOL_LEGACY_ACCEPT) ?? ''}`.trim().toLowerCase();
|
|
61
|
+
return mode === 'accept' || mode === 'reject' ? mode : 'warn';
|
|
62
|
+
};
|
|
63
|
+
exports.readLegacyAccept = readLegacyAccept;
|
|
64
|
+
/** read the hop cap (a positive integer, default 8) */
|
|
65
|
+
const readMaxHop = () => {
|
|
66
|
+
const n = Number(`${(0, protocol_sign_1.readConfig)(exports.PROTOCOL_MAX_HOP) ?? ''}`.trim() || NaN);
|
|
67
|
+
return Number.isInteger(n) && n > 0 ? n : exports.DEFAULT_MAX_HOP;
|
|
68
|
+
};
|
|
69
|
+
exports.readMaxHop = readMaxHop;
|
|
70
|
+
/** throw `508 LOOP DETECTED` if the hop is over the cap */
|
|
71
|
+
const assertHop = (hop, max = (0, exports.readMaxHop)()) => {
|
|
72
|
+
if (hop > max)
|
|
73
|
+
throw new Error(`508 LOOP DETECTED - protocol hop ${hop}`);
|
|
74
|
+
};
|
|
75
|
+
exports.assertHop = assertHop;
|
|
76
|
+
/** the whitelisted identity of a context (`undefined` if nothing to relay) */
|
|
77
|
+
const relayIdentityOf = (identity) => {
|
|
78
|
+
if (!identity || typeof identity !== 'object')
|
|
79
|
+
return undefined;
|
|
80
|
+
const idt = {};
|
|
81
|
+
const src = identity;
|
|
82
|
+
//* copy only the whitelisted fields of the right type.
|
|
83
|
+
exports.RELAY_IDENTITY_FIELDS.forEach(k => {
|
|
84
|
+
const v = src[k];
|
|
85
|
+
if (k === 'roles') {
|
|
86
|
+
if (Array.isArray(v))
|
|
87
|
+
idt.roles = v.filter(r => typeof r === 'string');
|
|
88
|
+
}
|
|
89
|
+
else if (typeof v === 'string')
|
|
90
|
+
idt[k] = v;
|
|
91
|
+
});
|
|
92
|
+
return Object.keys(idt).length ? idt : undefined;
|
|
93
|
+
};
|
|
94
|
+
exports.relayIdentityOf = relayIdentityOf;
|
|
95
|
+
/**
|
|
96
|
+
* build the relay of the next hop from the caller context.
|
|
97
|
+
* - `tid` = caller `trace.tid`, else `requestId`, else a new id. `hop` = caller `trace.hop` + 1.
|
|
98
|
+
* - `src` = caller `trace.src`, else `source`. `pid` = caller `requestId`. `via` = the caller's service uri.
|
|
99
|
+
* - throws `508 LOOP DETECTED` if the next hop is over the cap (before any send).
|
|
100
|
+
*
|
|
101
|
+
* @param context the caller context
|
|
102
|
+
* @param options `via` (caller uri), `now` (ms, for tests), `max` (hop cap)
|
|
103
|
+
*/
|
|
104
|
+
const buildRelay = (context, options) => {
|
|
105
|
+
const trace = context?.trace;
|
|
106
|
+
const hop = (Number.isInteger(trace?.hop) && trace.hop >= 0 ? trace.hop : 0) + 1;
|
|
107
|
+
(0, exports.assertHop)(hop, options?.max);
|
|
108
|
+
const text = (v) => (typeof v === 'string' && v ? v : undefined);
|
|
109
|
+
const relay = {
|
|
110
|
+
idt: (0, exports.relayIdentityOf)(context?.identity),
|
|
111
|
+
tid: text(trace?.tid) ?? (0, exports.traceIdOf)(context?.requestId),
|
|
112
|
+
hop,
|
|
113
|
+
src: text(trace?.src) ?? text(context?.source),
|
|
114
|
+
via: text(options?.via),
|
|
115
|
+
pid: text(context?.requestId),
|
|
116
|
+
iat: Math.floor((options?.now ?? Date.now()) / 1000),
|
|
117
|
+
};
|
|
118
|
+
//* drop empty keys (smaller value, stable shape).
|
|
119
|
+
return RELAY_KEYS.reduce((R, k) => {
|
|
120
|
+
if (relay[k] !== undefined)
|
|
121
|
+
R[k] = relay[k];
|
|
122
|
+
return R;
|
|
123
|
+
}, {});
|
|
124
|
+
};
|
|
125
|
+
exports.buildRelay = buildRelay;
|
|
126
|
+
/** encode a relay as `r1.<base64url(JSON)>` */
|
|
127
|
+
const encodeRelay = (relay) => `${exports.RELAY_PREFIX}${Buffer.from(JSON.stringify(relay), 'utf8').toString('base64url')}`;
|
|
128
|
+
exports.encodeRelay = encodeRelay;
|
|
129
|
+
//* the error of a bad relay.
|
|
130
|
+
const invalid = (reason) => new Error(`400 INVALID CONTEXT - relay ${reason}`);
|
|
131
|
+
/**
|
|
132
|
+
* decode and validate a relay value (shape, types, size). unknown keys and non-whitelisted identity keys are dropped.
|
|
133
|
+
* - throws `400 INVALID CONTEXT - relay <reason>` (`format`, `size`, `json`, `shape`, or the bad key).
|
|
134
|
+
*/
|
|
135
|
+
const decodeRelay = (text) => {
|
|
136
|
+
if (typeof text !== 'string' || !text.startsWith(exports.RELAY_PREFIX))
|
|
137
|
+
throw invalid('format');
|
|
138
|
+
if (Buffer.byteLength(text, 'utf8') > exports.RELAY_MAX_BYTES)
|
|
139
|
+
throw invalid('size');
|
|
140
|
+
//* base64url → JSON.
|
|
141
|
+
const data = (() => {
|
|
142
|
+
try {
|
|
143
|
+
return JSON.parse(Buffer.from(text.substring(exports.RELAY_PREFIX.length), 'base64url').toString('utf8'));
|
|
144
|
+
}
|
|
145
|
+
catch (e) {
|
|
146
|
+
throw invalid('json');
|
|
147
|
+
}
|
|
148
|
+
})();
|
|
149
|
+
if (!data || typeof data !== 'object' || Array.isArray(data))
|
|
150
|
+
throw invalid('shape');
|
|
151
|
+
//* string fields: optional, bounded.
|
|
152
|
+
const str = (k, required) => {
|
|
153
|
+
const v = data[k];
|
|
154
|
+
if (v === undefined && !required)
|
|
155
|
+
return undefined;
|
|
156
|
+
if (typeof v !== 'string' || (required && !v) || v.length > MAX_TEXT)
|
|
157
|
+
throw invalid(k);
|
|
158
|
+
return v;
|
|
159
|
+
};
|
|
160
|
+
const relay = { tid: str('tid', true), hop: data.hop };
|
|
161
|
+
if (!Number.isInteger(data.hop) || data.hop < 0)
|
|
162
|
+
throw invalid('hop');
|
|
163
|
+
if (data.idt !== undefined)
|
|
164
|
+
relay.idt = decodeIdentity(data.idt);
|
|
165
|
+
['src', 'via', 'pid'].forEach(k => {
|
|
166
|
+
const v = str(k);
|
|
167
|
+
if (v !== undefined)
|
|
168
|
+
relay[k] = v;
|
|
169
|
+
});
|
|
170
|
+
if (data.iat !== undefined) {
|
|
171
|
+
if (typeof data.iat !== 'number' || !Number.isFinite(data.iat))
|
|
172
|
+
throw invalid('iat');
|
|
173
|
+
relay.iat = data.iat;
|
|
174
|
+
}
|
|
175
|
+
//* the key order of the encoder (so a decoded relay equals the built one).
|
|
176
|
+
return RELAY_KEYS.reduce((R, k) => {
|
|
177
|
+
if (relay[k] !== undefined)
|
|
178
|
+
R[k] = relay[k];
|
|
179
|
+
return R;
|
|
180
|
+
}, {});
|
|
181
|
+
};
|
|
182
|
+
exports.decodeRelay = decodeRelay;
|
|
183
|
+
//* validate the `idt` of a relay (whitelisted keys only, typed).
|
|
184
|
+
const decodeIdentity = (idt) => {
|
|
185
|
+
if (!idt || typeof idt !== 'object' || Array.isArray(idt))
|
|
186
|
+
throw invalid('idt');
|
|
187
|
+
const res = {};
|
|
188
|
+
exports.RELAY_IDENTITY_FIELDS.forEach(k => {
|
|
189
|
+
const v = idt[k];
|
|
190
|
+
if (v === undefined || v === null)
|
|
191
|
+
return;
|
|
192
|
+
if (k === 'roles') {
|
|
193
|
+
if (!Array.isArray(v) || v.some(r => typeof r !== 'string'))
|
|
194
|
+
throw invalid('idt.roles');
|
|
195
|
+
res.roles = [...v];
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
if (typeof v !== 'string' || v.length > MAX_TEXT)
|
|
199
|
+
throw invalid(`idt.${k}`);
|
|
200
|
+
res[k] = v;
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
return res;
|
|
204
|
+
};
|
|
205
|
+
/**
|
|
206
|
+
* the receiver context of a relay (B14 D2 table).
|
|
207
|
+
* - `identity` = `idt`, `channel` = `internal`, `depth` = `hop`, `source` = `src`, `trace` = `{ tid, hop, via, pid, src }`.
|
|
208
|
+
* - `requestId`, `accountId` = the receiver's own values (`own`). nothing else of the caller crosses the hop.
|
|
209
|
+
*/
|
|
210
|
+
const asRelayContext = (relay, own) => {
|
|
211
|
+
const trace = { tid: relay.tid, hop: relay.hop };
|
|
212
|
+
if (relay.via !== undefined)
|
|
213
|
+
trace.via = relay.via;
|
|
214
|
+
if (relay.pid !== undefined)
|
|
215
|
+
trace.pid = relay.pid;
|
|
216
|
+
if (relay.src !== undefined)
|
|
217
|
+
trace.src = relay.src;
|
|
218
|
+
const context = {
|
|
219
|
+
identity: { ...(relay.idt || {}) },
|
|
220
|
+
channel: 'internal',
|
|
221
|
+
depth: relay.hop,
|
|
222
|
+
source: relay.src,
|
|
223
|
+
trace,
|
|
224
|
+
requestId: own?.requestId,
|
|
225
|
+
accountId: own?.accountId,
|
|
226
|
+
};
|
|
227
|
+
//* drop the undefined keys.
|
|
228
|
+
return Object.entries(context).reduce((M, [k, v]) => {
|
|
229
|
+
if (v !== undefined)
|
|
230
|
+
M[k] = v;
|
|
231
|
+
return M;
|
|
232
|
+
}, {});
|
|
233
|
+
};
|
|
234
|
+
exports.asRelayContext = asRelayContext;
|
|
235
|
+
/** the channel of an entry without a protocol context: local mode wins, else `host` → `external`, else `internal` */
|
|
236
|
+
const entryChannel = (hasHost) => engine_1.$U.isLocalMode() ? 'local' : hasHost ? 'external' : 'internal';
|
|
237
|
+
exports.entryChannel = entryChannel;
|
|
238
|
+
/** the trace of an entry without a relay: `{ tid: requestId, hop: 0 }` (a new tid if the requestId is not a safe id) */
|
|
239
|
+
const entryTrace = (context) => ({
|
|
240
|
+
tid: (0, exports.traceIdOf)(context?.requestId),
|
|
241
|
+
hop: 0,
|
|
242
|
+
});
|
|
243
|
+
exports.entryTrace = entryTrace;
|
|
244
|
+
/**
|
|
245
|
+
* the context of an in-process next hop (a same-service callback): the same rules as a relay hop.
|
|
246
|
+
* - `trace.hop` + 1 (cap → `508 LOOP DETECTED`), the same `tid`/`src`, `via` = this service, `pid` = this requestId.
|
|
247
|
+
* - `depth` = the new hop (kept in sync for v4-style code). the other fields of the context are kept.
|
|
248
|
+
*
|
|
249
|
+
* @param context the current receiver context (copied, not changed)
|
|
250
|
+
* @param via this service's uri
|
|
251
|
+
*/
|
|
252
|
+
const nextHopContext = (context, via) => {
|
|
253
|
+
const trace = context?.trace;
|
|
254
|
+
const hop = (Number.isInteger(trace?.hop) && trace.hop >= 0 ? trace.hop : 0) + 1;
|
|
255
|
+
(0, exports.assertHop)(hop);
|
|
256
|
+
const next = { tid: trace?.tid || (0, exports.traceIdOf)(context?.requestId), hop };
|
|
257
|
+
if (via)
|
|
258
|
+
next.via = via;
|
|
259
|
+
if (context?.requestId)
|
|
260
|
+
next.pid = context.requestId;
|
|
261
|
+
const src = trace?.src ?? context?.source;
|
|
262
|
+
if (src)
|
|
263
|
+
next.src = src;
|
|
264
|
+
return { ...context, depth: hop, trace: next };
|
|
265
|
+
};
|
|
266
|
+
exports.nextHopContext = nextHopContext;
|
|
267
|
+
/**
|
|
268
|
+
* apply `PROTOCOL_LEGACY_ACCEPT` to a legacy context (`x-protocol-context` or the SNS/SQS `context` field).
|
|
269
|
+
* - `reject`: throws `400 INVALID CONTEXT - legacy context rejected`. `warn`: one line. `accept`: nothing.
|
|
270
|
+
*
|
|
271
|
+
* @param transport `web` | `sns` | `sqs` (for the log line)
|
|
272
|
+
* @param legacy the legacy context (for the log line: the service of its `source`)
|
|
273
|
+
*/
|
|
274
|
+
const acceptLegacy = (transport, legacy) => {
|
|
275
|
+
const mode = (0, exports.readLegacyAccept)();
|
|
276
|
+
if (mode === 'reject')
|
|
277
|
+
throw new Error(`400 INVALID CONTEXT - legacy context rejected`);
|
|
278
|
+
if (mode === 'warn')
|
|
279
|
+
(0, engine_1._inf)(NS, `PROTOCOL deprecated x-protocol-context ${hostOf(legacy?.source)} (${transport})`);
|
|
280
|
+
};
|
|
281
|
+
exports.acceptLegacy = acceptLegacy;
|
|
282
|
+
/** one `PROTOCOL deprecated json identity (<transport>)` line (not in `accept`). the behaviour is unchanged */
|
|
283
|
+
const warnJsonIdentity = (transport) => {
|
|
284
|
+
if ((0, exports.readLegacyAccept)() !== 'accept')
|
|
285
|
+
(0, engine_1._inf)(NS, `PROTOCOL deprecated json identity (${transport})`);
|
|
286
|
+
};
|
|
287
|
+
exports.warnJsonIdentity = warnJsonIdentity;
|
|
288
|
+
//* a log token: no whitespace, bounded (a relay value cannot break the line).
|
|
289
|
+
const token = (v) => {
|
|
290
|
+
const s = `${v ?? ''}`.replace(/\s/g, '_').substring(0, 128);
|
|
291
|
+
return s || '-';
|
|
292
|
+
};
|
|
293
|
+
//* the host (service) of a protocol uri, without the account and the version ('-' if none).
|
|
294
|
+
const hostOf = (uri) => {
|
|
295
|
+
try {
|
|
296
|
+
return token(uri ? url_1.default.parse(uri).hostname : '');
|
|
297
|
+
}
|
|
298
|
+
catch (e) {
|
|
299
|
+
return '-';
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
//* the path of a protocol uri ('-' if none).
|
|
303
|
+
const pathOf = (uri) => {
|
|
304
|
+
try {
|
|
305
|
+
const path = uri ? url_1.default.parse(uri).pathname : '';
|
|
306
|
+
return token(path && path !== '/' ? path : '');
|
|
307
|
+
}
|
|
308
|
+
catch (e) {
|
|
309
|
+
return '-';
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
/**
|
|
313
|
+
* the `TRACE` line of an entry: `TRACE tid=<tid> hop=<hop> ch=<channel> via=<service|-> src=<path|->`.
|
|
314
|
+
* - no identity value, no account (the via host and the src path only).
|
|
315
|
+
*/
|
|
316
|
+
const traceLine = (context) => {
|
|
317
|
+
const trace = context?.trace;
|
|
318
|
+
const src = trace?.src ?? context?.source;
|
|
319
|
+
return [
|
|
320
|
+
`TRACE tid=${token(trace?.tid)}`,
|
|
321
|
+
`hop=${token(trace?.hop)}`,
|
|
322
|
+
`ch=${token(context?.channel)}`,
|
|
323
|
+
`via=${hostOf(trace?.via)}`,
|
|
324
|
+
`src=${pathOf(src)}`,
|
|
325
|
+
].join(' ');
|
|
326
|
+
};
|
|
327
|
+
exports.traceLine = traceLine;
|
|
328
|
+
/** print the `TRACE` line of an entry (one per web entry and per protocol receive) */
|
|
329
|
+
const logTrace = (context) => {
|
|
330
|
+
(0, engine_1._inf)(NS, (0, exports.traceLine)(context));
|
|
331
|
+
};
|
|
332
|
+
exports.logTrace = logTrace;
|
|
333
|
+
/** the account id (12 digits) of an ARN, or '' */
|
|
334
|
+
const accountOfArn = (arn) => {
|
|
335
|
+
const id = `${arn || ''}`.split(':')[4] || '';
|
|
336
|
+
return /^\d{12}$/.test(id) ? id : '';
|
|
337
|
+
};
|
|
338
|
+
exports.accountOfArn = accountOfArn;
|
|
339
|
+
//# sourceMappingURL=protocol-relay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol-relay.js","sourceRoot":"","sources":["../../../src/cores/protocol/protocol-relay.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,mCAAoC;AACpC,8CAAsB;AAEtB,0CAAyC;AACzC,mDAAiE;AAIxD,mGAJY,kCAAkB,OAIZ;AAH3B,MAAM,EAAE,GAAG,WAAE,CAAC,EA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,EAAU,EAAE;IACtD,MAAM,KAAK,GAAG,OAAO,EAAE,KAAK,CAAC;IAC7B,MAAM,GAAG,GAAG,KAAK,EAAE,GAAG,IAAI,OAAO,EAAE,MAAM,CAAC;IAC1C,OAAO;QACH,aAAa,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE;QAChC,OAAO,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE;QAC1B,MAAM,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE;QAC/B,OAAO,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE;QAC3B,OAAO,MAAM,CAAC,GAAG,CAAC,EAAE;KACvB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAChB,CAAC,CAAC;AAVW,QAAA,SAAS,aAUpB;AAEF,sFAAsF;AAC/E,MAAM,QAAQ,GAAG,CAAC,OAAoB,EAAQ,EAAE;IACnD,IAAA,aAAI,EAAC,EAAE,EAAE,IAAA,iBAAS,EAAC,OAAO,CAAC,CAAC,CAAC;AACjC,CAAC,CAAC;AAFW,QAAA,QAAQ,YAEnB;AAEF,kDAAkD;AAC3C,MAAM,YAAY,GAAG,CAAC,GAAY,EAAU,EAAE;IACjD,MAAM,EAAE,GAAG,GAAG,GAAG,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC9C,OAAO,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AACzC,CAAC,CAAC;AAHW,QAAA,YAAY,gBAGvB"}
|
|
@@ -15,6 +15,7 @@ interface MyMessageAttributeValue {
|
|
|
15
15
|
* header name to exchange `next-context`
|
|
16
16
|
* ONLY for internal communication.
|
|
17
17
|
* - v5 B10-3: defined in `protocol-sign.ts`, re-exported here (same name, same value).
|
|
18
|
+
* - v5 B14: deprecated (see the definition) — the relay `x-lemon-relay` replaces it; removal in v6.
|
|
18
19
|
*/
|
|
19
20
|
export { HEADER_PROTOCOL_CONTEXT };
|
|
20
21
|
/**
|
|
@@ -165,6 +166,7 @@ export declare class MyProtocolService implements ProtocolService {
|
|
|
165
166
|
* - transformer for `WEB` Handler
|
|
166
167
|
*/
|
|
167
168
|
export declare class WEBProtocolTransformer implements ProtocolTransformer<APIGatewayProxyEvent, APIGatewayProxyEvent> {
|
|
169
|
+
private service;
|
|
168
170
|
constructor(service?: MyProtocolService);
|
|
169
171
|
/**
|
|
170
172
|
* transform param to event
|
|
@@ -191,9 +193,11 @@ export declare class SNSProtocolTransformer implements ProtocolTransformer<MySNS
|
|
|
191
193
|
transformToEvent(uri: string, param: ProtocolParam, callback?: string): MySNSEventParam;
|
|
192
194
|
/**
|
|
193
195
|
* transform event data to param
|
|
196
|
+
* - v5 B14: the context comes from the `relay` (wins) or the legacy `context` (see `receiveContext()`).
|
|
194
197
|
* @param event the lambda compartible event data.
|
|
198
|
+
* @param own (optional) the receiver's own `requestId`/`accountId` (for a relay)
|
|
195
199
|
*/
|
|
196
|
-
transformToParam(event: SNSMessage): MyProtocolParam;
|
|
200
|
+
transformToParam(event: SNSMessage, own?: NextContext): MyProtocolParam;
|
|
197
201
|
}
|
|
198
202
|
/**
|
|
199
203
|
* the SQS send input this service builds (local structural type, the fields it uses; v5 B2-c).
|
|
@@ -218,7 +222,9 @@ export declare class SQSProtocolTransformer implements ProtocolTransformer<SQSEv
|
|
|
218
222
|
transformToEvent(uri: string, param: ProtocolParam, callback?: string): SQSEventParam;
|
|
219
223
|
/**
|
|
220
224
|
* transform event data to param
|
|
225
|
+
* - v5 B14: the context comes from the `relay` (wins) or the legacy `context` (see `receiveContext()`).
|
|
221
226
|
* @param event the lambda compartible event data.
|
|
227
|
+
* @param own (optional) the receiver's own `requestId`/`accountId` (for a relay)
|
|
222
228
|
*/
|
|
223
|
-
transformToParam(event: SQSRecord): MyProtocolParam;
|
|
229
|
+
transformToParam(event: SQSRecord, own?: NextContext): MyProtocolParam;
|
|
224
230
|
}
|