@walkeros/server-destination-aws 2.0.0 → 2.1.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/dist/dev.d.mts +14 -2
- package/dist/dev.d.ts +14 -2
- package/dist/dev.js +1 -1
- package/dist/dev.js.map +1 -1
- package/dist/dev.mjs +1 -1
- package/dist/dev.mjs.map +1 -1
- package/dist/examples/index.d.mts +13 -2
- package/dist/examples/index.d.ts +13 -2
- package/dist/examples/index.js +84 -3
- package/dist/examples/index.mjs +82 -2
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/schemas.js +1 -1
- package/dist/schemas.js.map +1 -1
- package/dist/schemas.mjs +1 -1
- package/dist/schemas.mjs.map +1 -1
- package/dist/walkerOS.json +349 -1
- package/package.json +2 -2
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DestinationServer } from '@walkeros/server-core';
|
|
2
2
|
import { FirehoseClient, PutRecordBatchCommand } from '@aws-sdk/client-firehose';
|
|
3
|
+
import { Flow } from '@walkeros/core';
|
|
3
4
|
|
|
4
5
|
interface Env extends DestinationServer.Env {
|
|
5
6
|
AWS: {
|
|
@@ -17,9 +18,19 @@ declare namespace env {
|
|
|
17
18
|
export { env_push as push, env_simulation as simulation };
|
|
18
19
|
}
|
|
19
20
|
|
|
21
|
+
declare const firehoseRecord: Flow.StepExample;
|
|
22
|
+
declare const orderEvent: Flow.StepExample;
|
|
23
|
+
|
|
24
|
+
declare const step_firehoseRecord: typeof firehoseRecord;
|
|
25
|
+
declare const step_orderEvent: typeof orderEvent;
|
|
26
|
+
declare namespace step {
|
|
27
|
+
export { step_firehoseRecord as firehoseRecord, step_orderEvent as orderEvent };
|
|
28
|
+
}
|
|
29
|
+
|
|
20
30
|
declare const index_env: typeof env;
|
|
31
|
+
declare const index_step: typeof step;
|
|
21
32
|
declare namespace index {
|
|
22
|
-
export { index_env as env };
|
|
33
|
+
export { index_env as env, index_step as step };
|
|
23
34
|
}
|
|
24
35
|
|
|
25
|
-
export { env, index as firehose };
|
|
36
|
+
export { env, index as firehose, step };
|
package/dist/examples/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DestinationServer } from '@walkeros/server-core';
|
|
2
2
|
import { FirehoseClient, PutRecordBatchCommand } from '@aws-sdk/client-firehose';
|
|
3
|
+
import { Flow } from '@walkeros/core';
|
|
3
4
|
|
|
4
5
|
interface Env extends DestinationServer.Env {
|
|
5
6
|
AWS: {
|
|
@@ -17,9 +18,19 @@ declare namespace env {
|
|
|
17
18
|
export { env_push as push, env_simulation as simulation };
|
|
18
19
|
}
|
|
19
20
|
|
|
21
|
+
declare const firehoseRecord: Flow.StepExample;
|
|
22
|
+
declare const orderEvent: Flow.StepExample;
|
|
23
|
+
|
|
24
|
+
declare const step_firehoseRecord: typeof firehoseRecord;
|
|
25
|
+
declare const step_orderEvent: typeof orderEvent;
|
|
26
|
+
declare namespace step {
|
|
27
|
+
export { step_firehoseRecord as firehoseRecord, step_orderEvent as orderEvent };
|
|
28
|
+
}
|
|
29
|
+
|
|
20
30
|
declare const index_env: typeof env;
|
|
31
|
+
declare const index_step: typeof step;
|
|
21
32
|
declare namespace index {
|
|
22
|
-
export { index_env as env };
|
|
33
|
+
export { index_env as env, index_step as step };
|
|
23
34
|
}
|
|
24
35
|
|
|
25
|
-
export { env, index as firehose };
|
|
36
|
+
export { env, index as firehose, step };
|
package/dist/examples/index.js
CHANGED
|
@@ -21,14 +21,16 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var examples_exports2 = {};
|
|
22
22
|
__export(examples_exports2, {
|
|
23
23
|
env: () => env_exports,
|
|
24
|
-
firehose: () => examples_exports
|
|
24
|
+
firehose: () => examples_exports,
|
|
25
|
+
step: () => step_exports
|
|
25
26
|
});
|
|
26
27
|
module.exports = __toCommonJS(examples_exports2);
|
|
27
28
|
|
|
28
29
|
// src/firehose/examples/index.ts
|
|
29
30
|
var examples_exports = {};
|
|
30
31
|
__export(examples_exports, {
|
|
31
|
-
env: () => env_exports
|
|
32
|
+
env: () => env_exports,
|
|
33
|
+
step: () => step_exports
|
|
32
34
|
});
|
|
33
35
|
|
|
34
36
|
// src/firehose/examples/env.ts
|
|
@@ -63,8 +65,87 @@ var push = {
|
|
|
63
65
|
}
|
|
64
66
|
};
|
|
65
67
|
var simulation = ["AWS.FirehoseClient"];
|
|
68
|
+
|
|
69
|
+
// src/firehose/examples/step.ts
|
|
70
|
+
var step_exports = {};
|
|
71
|
+
__export(step_exports, {
|
|
72
|
+
firehoseRecord: () => firehoseRecord,
|
|
73
|
+
orderEvent: () => orderEvent
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
// ../../../core/dist/index.mjs
|
|
77
|
+
var t = Object.defineProperty;
|
|
78
|
+
var a = {};
|
|
79
|
+
((e, n) => {
|
|
80
|
+
for (var o in n) t(e, o, { get: n[o], enumerable: true });
|
|
81
|
+
})(a, { Level: () => u });
|
|
82
|
+
var u = ((t2) => (t2[t2.ERROR = 0] = "ERROR", t2[t2.WARN = 1] = "WARN", t2[t2.INFO = 2] = "INFO", t2[t2.DEBUG = 3] = "DEBUG", t2))(u || {});
|
|
83
|
+
var D = { merge: true, shallow: true, extend: true };
|
|
84
|
+
function H(t2, e = {}, n = {}) {
|
|
85
|
+
n = { ...D, ...n };
|
|
86
|
+
const o = Object.entries(e).reduce((e2, [o2, r]) => {
|
|
87
|
+
const i = t2[o2];
|
|
88
|
+
return n.merge && Array.isArray(i) && Array.isArray(r) ? e2[o2] = r.reduce((t3, e3) => t3.includes(e3) ? t3 : [...t3, e3], [...i]) : (n.extend || o2 in t2) && (e2[o2] = r), e2;
|
|
89
|
+
}, {});
|
|
90
|
+
return n.shallow ? { ...t2, ...o } : (Object.assign(t2, o), t2);
|
|
91
|
+
}
|
|
92
|
+
function nt(t2 = {}) {
|
|
93
|
+
var _a;
|
|
94
|
+
const e = t2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n = t2.group || "gr0up", o = t2.count || 1, r = H({ name: "entity action", data: { string: "foo", number: 1, boolean: true, array: [0, "text", false], not: void 0 }, context: { dev: ["test", 1] }, globals: { lang: "elb" }, custom: { completely: "random" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n" }, nested: [{ entity: "child", data: { is: "subordinated" }, nested: [], context: { element: ["child", 0] } }], consent: { functional: true }, id: `${e}-${n}-${o}`, trigger: "test", entity: "entity", action: "action", timestamp: e, timing: 3.14, group: n, count: o, version: { source: "2.0.1", tagging: 1 }, source: { type: "web", id: "https://localhost:80", previous_id: "http://remotehost:9001" } }, t2, { merge: false });
|
|
95
|
+
if (t2.name) {
|
|
96
|
+
const [e2, n2] = (_a = t2.name.split(" ")) != null ? _a : [];
|
|
97
|
+
e2 && n2 && (r.entity = e2, r.action = n2);
|
|
98
|
+
}
|
|
99
|
+
return r;
|
|
100
|
+
}
|
|
101
|
+
function ot(t2 = "entity action", e = {}) {
|
|
102
|
+
const n = e.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), o = { data: { id: "ers", name: "Everyday Ruck Snack", color: "black", size: "l", price: 420 } }, r = { data: { id: "cc", name: "Cool Cap", size: "one size", price: 42 } };
|
|
103
|
+
return nt({ ...{ "cart view": { data: { currency: "EUR", value: 2 * o.data.price }, context: { shopping: ["cart", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", data: { ...o.data, quantity: 2 }, context: { shopping: ["cart", 0] }, nested: [] }], trigger: "load" }, "checkout view": { data: { step: "payment", currency: "EUR", value: o.data.price + r.data.price }, context: { shopping: ["checkout", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...o, context: { shopping: ["checkout", 0] }, nested: [] }, { entity: "product", ...r, context: { shopping: ["checkout", 0] }, nested: [] }], trigger: "load" }, "order complete": { data: { id: "0rd3r1d", currency: "EUR", shipping: 5.22, taxes: 73.76, total: 555 }, context: { shopping: ["complete", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...o, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "product", ...r, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "gift", data: { name: "Surprise" }, context: { shopping: ["complete", 0] }, nested: [] }], trigger: "load" }, "page view": { data: { domain: "www.example.com", title: "walkerOS documentation", referrer: "https://www.walkeros.io/", search: "?foo=bar", hash: "#hash", id: "/docs/" }, globals: { pagegroup: "docs" }, trigger: "load" }, "product add": { ...o, context: { shopping: ["intent", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "click" }, "product view": { ...o, context: { shopping: ["detail", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "product visible": { data: { ...o.data, position: 3, promo: true }, context: { shopping: ["discover", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "promotion visible": { data: { name: "Setting up tracking easily", position: "hero" }, context: { ab_test: ["engagement", 0] }, globals: { pagegroup: "homepage" }, trigger: "visible" }, "session start": { data: { id: "s3ss10n", start: n, isNew: true, count: 1, runs: 1, isStart: true, storage: true, referrer: "", device: "c00k13" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n", hash: "h4sh", address: "street number", email: "user@example.com", phone: "+49 123 456 789", userAgent: "Mozilla...", browser: "Chrome", browserVersion: "90", deviceType: "desktop", language: "de-DE", country: "DE", region: "HH", city: "Hamburg", zip: "20354", timezone: "Berlin", os: "walkerOS", osVersion: "1.0", screenSize: "1337x420", ip: "127.0.0.0", internal: true, custom: "value" } } }[t2], ...e, name: t2 });
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// src/firehose/examples/step.ts
|
|
107
|
+
var firehoseRecord = {
|
|
108
|
+
in: ot("page view", {
|
|
109
|
+
timestamp: 1700001e3,
|
|
110
|
+
data: { title: "Home", url: "https://example.com/" },
|
|
111
|
+
source: { type: "server", id: "", previous_id: "" }
|
|
112
|
+
}),
|
|
113
|
+
mapping: void 0,
|
|
114
|
+
out: {
|
|
115
|
+
DeliveryStreamName: "walkeros-events",
|
|
116
|
+
Records: [
|
|
117
|
+
{
|
|
118
|
+
Data: JSON.stringify({
|
|
119
|
+
title: "Home",
|
|
120
|
+
url: "https://example.com/"
|
|
121
|
+
})
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
var orderEvent = {
|
|
127
|
+
in: ot("order complete", {
|
|
128
|
+
timestamp: 1700001001,
|
|
129
|
+
data: { id: "ORD-400", total: 99.99, currency: "EUR" },
|
|
130
|
+
source: { type: "server", id: "", previous_id: "" }
|
|
131
|
+
}),
|
|
132
|
+
mapping: void 0,
|
|
133
|
+
out: {
|
|
134
|
+
DeliveryStreamName: "walkeros-events",
|
|
135
|
+
Records: [
|
|
136
|
+
{
|
|
137
|
+
Data: JSON.stringify({
|
|
138
|
+
id: "ORD-400",
|
|
139
|
+
total: 99.99,
|
|
140
|
+
currency: "EUR"
|
|
141
|
+
})
|
|
142
|
+
}
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
};
|
|
66
146
|
// Annotate the CommonJS export names for ESM import in node:
|
|
67
147
|
0 && (module.exports = {
|
|
68
148
|
env,
|
|
69
|
-
firehose
|
|
149
|
+
firehose,
|
|
150
|
+
step
|
|
70
151
|
});
|
package/dist/examples/index.mjs
CHANGED
|
@@ -7,7 +7,8 @@ var __export = (target, all) => {
|
|
|
7
7
|
// src/firehose/examples/index.ts
|
|
8
8
|
var examples_exports = {};
|
|
9
9
|
__export(examples_exports, {
|
|
10
|
-
env: () => env_exports
|
|
10
|
+
env: () => env_exports,
|
|
11
|
+
step: () => step_exports
|
|
11
12
|
});
|
|
12
13
|
|
|
13
14
|
// src/firehose/examples/env.ts
|
|
@@ -42,7 +43,86 @@ var push = {
|
|
|
42
43
|
}
|
|
43
44
|
};
|
|
44
45
|
var simulation = ["AWS.FirehoseClient"];
|
|
46
|
+
|
|
47
|
+
// src/firehose/examples/step.ts
|
|
48
|
+
var step_exports = {};
|
|
49
|
+
__export(step_exports, {
|
|
50
|
+
firehoseRecord: () => firehoseRecord,
|
|
51
|
+
orderEvent: () => orderEvent
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// ../../../core/dist/index.mjs
|
|
55
|
+
var t = Object.defineProperty;
|
|
56
|
+
var a = {};
|
|
57
|
+
((e, n) => {
|
|
58
|
+
for (var o in n) t(e, o, { get: n[o], enumerable: true });
|
|
59
|
+
})(a, { Level: () => u });
|
|
60
|
+
var u = ((t2) => (t2[t2.ERROR = 0] = "ERROR", t2[t2.WARN = 1] = "WARN", t2[t2.INFO = 2] = "INFO", t2[t2.DEBUG = 3] = "DEBUG", t2))(u || {});
|
|
61
|
+
var D = { merge: true, shallow: true, extend: true };
|
|
62
|
+
function H(t2, e = {}, n = {}) {
|
|
63
|
+
n = { ...D, ...n };
|
|
64
|
+
const o = Object.entries(e).reduce((e2, [o2, r]) => {
|
|
65
|
+
const i = t2[o2];
|
|
66
|
+
return n.merge && Array.isArray(i) && Array.isArray(r) ? e2[o2] = r.reduce((t3, e3) => t3.includes(e3) ? t3 : [...t3, e3], [...i]) : (n.extend || o2 in t2) && (e2[o2] = r), e2;
|
|
67
|
+
}, {});
|
|
68
|
+
return n.shallow ? { ...t2, ...o } : (Object.assign(t2, o), t2);
|
|
69
|
+
}
|
|
70
|
+
function nt(t2 = {}) {
|
|
71
|
+
var _a;
|
|
72
|
+
const e = t2.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), n = t2.group || "gr0up", o = t2.count || 1, r = H({ name: "entity action", data: { string: "foo", number: 1, boolean: true, array: [0, "text", false], not: void 0 }, context: { dev: ["test", 1] }, globals: { lang: "elb" }, custom: { completely: "random" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n" }, nested: [{ entity: "child", data: { is: "subordinated" }, nested: [], context: { element: ["child", 0] } }], consent: { functional: true }, id: `${e}-${n}-${o}`, trigger: "test", entity: "entity", action: "action", timestamp: e, timing: 3.14, group: n, count: o, version: { source: "2.0.1", tagging: 1 }, source: { type: "web", id: "https://localhost:80", previous_id: "http://remotehost:9001" } }, t2, { merge: false });
|
|
73
|
+
if (t2.name) {
|
|
74
|
+
const [e2, n2] = (_a = t2.name.split(" ")) != null ? _a : [];
|
|
75
|
+
e2 && n2 && (r.entity = e2, r.action = n2);
|
|
76
|
+
}
|
|
77
|
+
return r;
|
|
78
|
+
}
|
|
79
|
+
function ot(t2 = "entity action", e = {}) {
|
|
80
|
+
const n = e.timestamp || (/* @__PURE__ */ new Date()).setHours(0, 13, 37, 0), o = { data: { id: "ers", name: "Everyday Ruck Snack", color: "black", size: "l", price: 420 } }, r = { data: { id: "cc", name: "Cool Cap", size: "one size", price: 42 } };
|
|
81
|
+
return nt({ ...{ "cart view": { data: { currency: "EUR", value: 2 * o.data.price }, context: { shopping: ["cart", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", data: { ...o.data, quantity: 2 }, context: { shopping: ["cart", 0] }, nested: [] }], trigger: "load" }, "checkout view": { data: { step: "payment", currency: "EUR", value: o.data.price + r.data.price }, context: { shopping: ["checkout", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...o, context: { shopping: ["checkout", 0] }, nested: [] }, { entity: "product", ...r, context: { shopping: ["checkout", 0] }, nested: [] }], trigger: "load" }, "order complete": { data: { id: "0rd3r1d", currency: "EUR", shipping: 5.22, taxes: 73.76, total: 555 }, context: { shopping: ["complete", 0] }, globals: { pagegroup: "shop" }, nested: [{ entity: "product", ...o, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "product", ...r, context: { shopping: ["complete", 0] }, nested: [] }, { entity: "gift", data: { name: "Surprise" }, context: { shopping: ["complete", 0] }, nested: [] }], trigger: "load" }, "page view": { data: { domain: "www.example.com", title: "walkerOS documentation", referrer: "https://www.walkeros.io/", search: "?foo=bar", hash: "#hash", id: "/docs/" }, globals: { pagegroup: "docs" }, trigger: "load" }, "product add": { ...o, context: { shopping: ["intent", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "click" }, "product view": { ...o, context: { shopping: ["detail", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "product visible": { data: { ...o.data, position: 3, promo: true }, context: { shopping: ["discover", 0] }, globals: { pagegroup: "shop" }, nested: [], trigger: "load" }, "promotion visible": { data: { name: "Setting up tracking easily", position: "hero" }, context: { ab_test: ["engagement", 0] }, globals: { pagegroup: "homepage" }, trigger: "visible" }, "session start": { data: { id: "s3ss10n", start: n, isNew: true, count: 1, runs: 1, isStart: true, storage: true, referrer: "", device: "c00k13" }, user: { id: "us3r", device: "c00k13", session: "s3ss10n", hash: "h4sh", address: "street number", email: "user@example.com", phone: "+49 123 456 789", userAgent: "Mozilla...", browser: "Chrome", browserVersion: "90", deviceType: "desktop", language: "de-DE", country: "DE", region: "HH", city: "Hamburg", zip: "20354", timezone: "Berlin", os: "walkerOS", osVersion: "1.0", screenSize: "1337x420", ip: "127.0.0.0", internal: true, custom: "value" } } }[t2], ...e, name: t2 });
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// src/firehose/examples/step.ts
|
|
85
|
+
var firehoseRecord = {
|
|
86
|
+
in: ot("page view", {
|
|
87
|
+
timestamp: 1700001e3,
|
|
88
|
+
data: { title: "Home", url: "https://example.com/" },
|
|
89
|
+
source: { type: "server", id: "", previous_id: "" }
|
|
90
|
+
}),
|
|
91
|
+
mapping: void 0,
|
|
92
|
+
out: {
|
|
93
|
+
DeliveryStreamName: "walkeros-events",
|
|
94
|
+
Records: [
|
|
95
|
+
{
|
|
96
|
+
Data: JSON.stringify({
|
|
97
|
+
title: "Home",
|
|
98
|
+
url: "https://example.com/"
|
|
99
|
+
})
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
var orderEvent = {
|
|
105
|
+
in: ot("order complete", {
|
|
106
|
+
timestamp: 1700001001,
|
|
107
|
+
data: { id: "ORD-400", total: 99.99, currency: "EUR" },
|
|
108
|
+
source: { type: "server", id: "", previous_id: "" }
|
|
109
|
+
}),
|
|
110
|
+
mapping: void 0,
|
|
111
|
+
out: {
|
|
112
|
+
DeliveryStreamName: "walkeros-events",
|
|
113
|
+
Records: [
|
|
114
|
+
{
|
|
115
|
+
Data: JSON.stringify({
|
|
116
|
+
id: "ORD-400",
|
|
117
|
+
total: 99.99,
|
|
118
|
+
currency: "EUR"
|
|
119
|
+
})
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
};
|
|
45
124
|
export {
|
|
46
125
|
env_exports as env,
|
|
47
|
-
examples_exports as firehose
|
|
126
|
+
examples_exports as firehose,
|
|
127
|
+
step_exports as step
|
|
48
128
|
};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.create;var mod,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=(Object.getPrototypeOf,Object.prototype.hasOwnProperty),__copyProps=(to,from,except,desc)=>{if(from&&"object"==typeof from||"function"==typeof from)for(let key of __getOwnPropNames(from))__hasOwnProp.call(to,key)||key===except||__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},index_exports={};((target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})})(index_exports,{DestinationFirehose:()=>types_exports,default:()=>destinationFirehose,destinationFirehose:()=>destinationFirehose}),module.exports=(mod=index_exports,__copyProps(__defProp({},"__esModule",{value:!0}),mod));var
|
|
1
|
+
"use strict";Object.create;var mod,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=(Object.getPrototypeOf,Object.prototype.hasOwnProperty),__copyProps=(to,from,except,desc)=>{if(from&&"object"==typeof from||"function"==typeof from)for(let key of __getOwnPropNames(from))__hasOwnProp.call(to,key)||key===except||__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},index_exports={};((target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})})(index_exports,{DestinationFirehose:()=>types_exports,default:()=>destinationFirehose,destinationFirehose:()=>destinationFirehose}),module.exports=(mod=index_exports,__copyProps(__defProp({},"__esModule",{value:!0}),mod));var t=Object.defineProperty;((e,n)=>{for(var o in n)t(e,o,{get:n[o],enumerable:!0})})({},{Level:()=>u});var t2,u=((t2=u||{})[t2.ERROR=0]="ERROR",t2[t2.WARN=1]="WARN",t2[t2.INFO=2]="INFO",t2[t2.DEBUG=3]="DEBUG",t2);function isAWSEnvironment(env){var _a;return Boolean(env&&"object"==typeof env&&"AWS"in env&&(null==(_a=env.AWS)?void 0:_a.FirehoseClient))}function getConfigFirehose(firehoseConfig,env){const{streamName:streamName,region:region="eu-central-1",config:config={}}=firehoseConfig;streamName||function(t2){throw new Error(String(t2))}("Firehose: Config custom streamName missing"),config.region||(config.region=region);let client=firehoseConfig.client;return!client&&isAWSEnvironment(env)&&(client=new env.AWS.FirehoseClient(config)),{streamName:streamName,client:client,region:region}}var push=async function(event,context){const{firehose:firehose}=context.config.settings||{};firehose&&async function(pushEvents,config,context){const{client:client,streamName:streamName}=config,{env:env,logger:logger}=context;if(!client)return{queue:pushEvents};const records=pushEvents.map(({event:event})=>({Data:Buffer.from(JSON.stringify(event))}));if(logger.debug("Calling AWS Firehose API",{stream:streamName,recordCount:records.length}),isAWSEnvironment(env))await client.send(new env.AWS.PutRecordBatchCommand({DeliveryStreamName:streamName,Records:records}));else{const{PutRecordBatchCommand:PutRecordBatchCommand}=await import("@aws-sdk/client-firehose");await client.send(new PutRecordBatchCommand({DeliveryStreamName:streamName,Records:records}))}null==logger||logger.debug("AWS Firehose API response",{ok:!0})}([{event:event}],firehose,context)},types_exports={},destinationFirehose={type:"aws-firehose",config:{},async init({config:partialConfig,env:env,logger:logger}){const config=function(partialConfig={},env){const settings=partialConfig.settings||{};return settings.firehose&&(settings.firehose=getConfigFirehose(settings.firehose,env)),{settings:settings}}(partialConfig,env);return function(t2,e){return typeof t2==typeof e}(config.settings,{})||logger.throw("Config settings invalid"),config},push:async(event,context)=>await push(event,context)};//# sourceMappingURL=index.js.map
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var t=Object.defineProperty;((e,n)=>{for(var o in n)t(e,o,{get:n[o],enumerable:!0})})({},{Level:()=>u});var t2,u=((t2=u||{})[t2.ERROR=0]="ERROR",t2[t2.WARN=1]="WARN",t2[t2.INFO=2]="INFO",t2[t2.DEBUG=3]="DEBUG",t2);function isAWSEnvironment(env){var _a;return Boolean(env&&"object"==typeof env&&"AWS"in env&&(null==(_a=env.AWS)?void 0:_a.FirehoseClient))}function getConfigFirehose(firehoseConfig,env){const{streamName:streamName,region:region="eu-central-1",config:config={}}=firehoseConfig;streamName||function(t2){throw new Error(String(t2))}("Firehose: Config custom streamName missing"),config.region||(config.region=region);let client=firehoseConfig.client;return!client&&isAWSEnvironment(env)&&(client=new env.AWS.FirehoseClient(config)),{streamName:streamName,client:client,region:region}}var push=async function(event,context){const{firehose:firehose}=context.config.settings||{};firehose&&async function(pushEvents,config,context){const{client:client,streamName:streamName}=config,{env:env,logger:logger}=context;if(!client)return{queue:pushEvents};const records=pushEvents.map(({event:event})=>({Data:Buffer.from(JSON.stringify(event))}));if(logger.debug("Calling AWS Firehose API",{stream:streamName,recordCount:records.length}),isAWSEnvironment(env))await client.send(new env.AWS.PutRecordBatchCommand({DeliveryStreamName:streamName,Records:records}));else{const{PutRecordBatchCommand:PutRecordBatchCommand}=await import("@aws-sdk/client-firehose");await client.send(new PutRecordBatchCommand({DeliveryStreamName:streamName,Records:records}))}null==logger||logger.debug("AWS Firehose API response",{ok:!0})}([{event:event}],firehose,context)},types_exports={},destinationFirehose={type:"aws-firehose",config:{},async init({config:partialConfig,env:env,logger:logger}){const config=function(partialConfig={},env){const settings=partialConfig.settings||{};return settings.firehose&&(settings.firehose=getConfigFirehose(settings.firehose,env)),{settings:settings}}(partialConfig,env);return function(t2,e){return typeof t2==typeof e}(config.settings,{})||logger.throw("Config settings invalid"),config},push:async(event,context)=>await push(event,context)};export{types_exports as DestinationFirehose,destinationFirehose as default,destinationFirehose};//# sourceMappingURL=index.mjs.map
|