@walkeros/server-destination-aws 0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 elbWalker GmbH
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,66 @@
1
+ <p align="left">
2
+ <a href="https://elbwalker.com">
3
+ <img title="elbwalker" src='https://www.elbwalker.com/img/elbwalker_logo.png' width="256px"/>
4
+ </a>
5
+ </p>
6
+
7
+ # AWS Destination for walkerOS
8
+
9
+ This package provides an AWS destination for walkerOS. It allows you to send
10
+ events to various AWS services. Currently, it supports AWS Firehose.
11
+
12
+ [View documentation](https://www.elbwalker.com/docs/destinations/server/aws/)
13
+
14
+ ## Role in walkerOS Ecosystem
15
+
16
+ walkerOS follows a **source → collector → destination** architecture:
17
+
18
+ - **Sources**: Capture events from various environments (browser DOM, dataLayer,
19
+ server requests)
20
+ - **Collector**: Processes, validates, and routes events with consent awareness
21
+ - **Destinations**: Send processed events to analytics platforms (GA4, Meta,
22
+ custom APIs)
23
+
24
+ This AWS destination receives processed events from the walkerOS collector and
25
+ streams them to AWS services like Firehose, enabling real-time data ingestion
26
+ into AWS data lakes, warehouses, and analytics services for large-scale event
27
+ processing and analysis.
28
+
29
+ ## Installation
30
+
31
+ ```sh
32
+ npm install @walkeros/server-destination-aws
33
+ ```
34
+
35
+ ## Usage
36
+
37
+ Here's a basic example of how to use the AWS destination:
38
+
39
+ ```typescript
40
+ import { elb } from '@walkeros/collector';
41
+ import { destinationFirehose } from '@walkeros/server-destination-aws';
42
+
43
+ elb('walker destination', destinationFirehose, {
44
+ custom: {
45
+ firehose: {
46
+ streamName: 'your-firehose-stream-name',
47
+ region: 'eu-central-1',
48
+ credentials: {
49
+ accessKeyId: 'your-access-key-id',
50
+ secretAccessKey: 'your-secret-access-key',
51
+ },
52
+ },
53
+ },
54
+ });
55
+ ```
56
+
57
+ ## Contribute
58
+
59
+ Feel free to contribute by submitting an
60
+ [issue](https://github.com/elbwalker/walkerOS/issues), starting a
61
+ [discussion](https://github.com/elbwalker/walkerOS/discussions), or getting in
62
+ [contact](https://calendly.com/elb-alexander/30min).
63
+
64
+ ## License
65
+
66
+ This project is licensed under the MIT License.
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/examples/index.ts
21
+ var examples_exports2 = {};
22
+ __export(examples_exports2, {
23
+ destinationFirehoseExamples: () => destinationFirehoseExamples
24
+ });
25
+ module.exports = __toCommonJS(examples_exports2);
26
+
27
+ // src/firehose/examples/index.ts
28
+ var examples_exports = {};
29
+
30
+ // src/examples/index.ts
31
+ var destinationFirehoseExamples = examples_exports;
32
+ // Annotate the CommonJS export names for ESM import in node:
33
+ 0 && (module.exports = {
34
+ destinationFirehoseExamples
35
+ });
@@ -0,0 +1,8 @@
1
+ // src/firehose/examples/index.ts
2
+ var examples_exports = {};
3
+
4
+ // src/examples/index.ts
5
+ var destinationFirehoseExamples = examples_exports;
6
+ export {
7
+ destinationFirehoseExamples
8
+ };
@@ -0,0 +1,56 @@
1
+ import { DestinationServer } from '@walkeros/server-core';
2
+ import { Mapping as Mapping$1 } from '@walkeros/core';
3
+ import { FirehoseClient, FirehoseClientConfig } from '@aws-sdk/client-firehose';
4
+
5
+ declare global {
6
+ namespace WalkerOS {
7
+ interface Elb extends Elb.RegisterDestination<Destination, Config> {
8
+ }
9
+ }
10
+ }
11
+ interface Destination extends DestinationServer.Destination<Settings, Mapping> {
12
+ init: DestinationServer.InitFn<Settings, Mapping>;
13
+ }
14
+ type Config = {
15
+ settings: Settings;
16
+ } & DestinationServer.Config<Settings, Mapping>;
17
+ interface Settings {
18
+ firehose?: FirehoseConfig;
19
+ }
20
+ interface Mapping {
21
+ }
22
+ type InitFn = DestinationServer.InitFn<Settings, Mapping>;
23
+ type PushFn = DestinationServer.PushFn<Settings, Mapping>;
24
+ type PartialConfig = DestinationServer.PartialConfig<Settings, Mapping>;
25
+ type PushEvents = DestinationServer.PushEvents<Mapping>;
26
+ type Rule = Mapping$1.Rule<Mapping>;
27
+ type Rules = Mapping$1.Rules<Rule>;
28
+ interface FirehoseConfig {
29
+ streamName: string;
30
+ client?: FirehoseClient;
31
+ region?: string;
32
+ config?: FirehoseClientConfig;
33
+ }
34
+
35
+ type index$1_Config = Config;
36
+ type index$1_Destination = Destination;
37
+ type index$1_FirehoseConfig = FirehoseConfig;
38
+ type index$1_InitFn = InitFn;
39
+ type index$1_Mapping = Mapping;
40
+ type index$1_PartialConfig = PartialConfig;
41
+ type index$1_PushEvents = PushEvents;
42
+ type index$1_PushFn = PushFn;
43
+ type index$1_Rule = Rule;
44
+ type index$1_Rules = Rules;
45
+ type index$1_Settings = Settings;
46
+ declare namespace index$1 {
47
+ export type { index$1_Config as Config, index$1_Destination as Destination, index$1_FirehoseConfig as FirehoseConfig, index$1_InitFn as InitFn, index$1_Mapping as Mapping, index$1_PartialConfig as PartialConfig, index$1_PushEvents as PushEvents, index$1_PushFn as PushFn, index$1_Rule as Rule, index$1_Rules as Rules, index$1_Settings as Settings };
48
+ }
49
+
50
+ declare const destinationFirehose: Destination;
51
+
52
+ declare namespace index {
53
+ export { };
54
+ }
55
+
56
+ export { index$1 as DestinationFirehose, destinationFirehose, index as destinationFirehoseExamples };
@@ -0,0 +1,56 @@
1
+ import { DestinationServer } from '@walkeros/server-core';
2
+ import { Mapping as Mapping$1 } from '@walkeros/core';
3
+ import { FirehoseClient, FirehoseClientConfig } from '@aws-sdk/client-firehose';
4
+
5
+ declare global {
6
+ namespace WalkerOS {
7
+ interface Elb extends Elb.RegisterDestination<Destination, Config> {
8
+ }
9
+ }
10
+ }
11
+ interface Destination extends DestinationServer.Destination<Settings, Mapping> {
12
+ init: DestinationServer.InitFn<Settings, Mapping>;
13
+ }
14
+ type Config = {
15
+ settings: Settings;
16
+ } & DestinationServer.Config<Settings, Mapping>;
17
+ interface Settings {
18
+ firehose?: FirehoseConfig;
19
+ }
20
+ interface Mapping {
21
+ }
22
+ type InitFn = DestinationServer.InitFn<Settings, Mapping>;
23
+ type PushFn = DestinationServer.PushFn<Settings, Mapping>;
24
+ type PartialConfig = DestinationServer.PartialConfig<Settings, Mapping>;
25
+ type PushEvents = DestinationServer.PushEvents<Mapping>;
26
+ type Rule = Mapping$1.Rule<Mapping>;
27
+ type Rules = Mapping$1.Rules<Rule>;
28
+ interface FirehoseConfig {
29
+ streamName: string;
30
+ client?: FirehoseClient;
31
+ region?: string;
32
+ config?: FirehoseClientConfig;
33
+ }
34
+
35
+ type index$1_Config = Config;
36
+ type index$1_Destination = Destination;
37
+ type index$1_FirehoseConfig = FirehoseConfig;
38
+ type index$1_InitFn = InitFn;
39
+ type index$1_Mapping = Mapping;
40
+ type index$1_PartialConfig = PartialConfig;
41
+ type index$1_PushEvents = PushEvents;
42
+ type index$1_PushFn = PushFn;
43
+ type index$1_Rule = Rule;
44
+ type index$1_Rules = Rules;
45
+ type index$1_Settings = Settings;
46
+ declare namespace index$1 {
47
+ export type { index$1_Config as Config, index$1_Destination as Destination, index$1_FirehoseConfig as FirehoseConfig, index$1_InitFn as InitFn, index$1_Mapping as Mapping, index$1_PartialConfig as PartialConfig, index$1_PushEvents as PushEvents, index$1_PushFn as PushFn, index$1_Rule as Rule, index$1_Rules as Rules, index$1_Settings as Settings };
48
+ }
49
+
50
+ declare const destinationFirehose: Destination;
51
+
52
+ declare namespace index {
53
+ export { };
54
+ }
55
+
56
+ export { index$1 as DestinationFirehose, destinationFirehose, index as destinationFirehoseExamples };
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";var e,t,r,s=Object.defineProperty,n=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,a={};((e,t)=>{for(var r in t)s(e,r,{get:t[r],enumerable:!0})})(a,{DestinationFirehose:()=>d,destinationFirehose:()=>g,destinationFirehoseExamples:()=>w}),module.exports=(e=a,((e,t,r,a)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let c of o(t))i.call(e,c)||c===r||s(e,c,{get:()=>t[c],enumerable:!(a=n(t,c))||a.enumerable});return e})(s({},"__esModule",{value:!0}),e));var c=Object.getOwnPropertyNames,l=(t={"package.json"(e,t){t.exports={name:"@walkeros/core",description:"Core types and platform-agnostic utilities for walkerOS",version:"0.0.7",main:"./dist/index.js",module:"./dist/index.mjs",types:"./dist/index.d.ts",license:"MIT",files:["dist/**"],scripts:{build:"tsup --silent",clean:"rm -rf .turbo && rm -rf node_modules && rm -rf dist",dev:"jest --watchAll --colors",lint:'tsc && eslint "**/*.ts*"',test:"jest",update:"npx npm-check-updates -u && npm update"},dependencies:{},devDependencies:{},repository:{url:"git+https://github.com/elbwalker/walkerOS.git",directory:"packages/core"},author:"elbwalker <hello@elbwalker.com>",homepage:"https://github.com/elbwalker/walkerOS#readme",bugs:{url:"https://github.com/elbwalker/walkerOS/issues"},keywords:["walker","walkerOS","analytics","tracking","data collection","measurement","data privacy","privacy friendly","web analytics","product analytics","core","types","utils"],funding:[{type:"GitHub Sponsors",url:"https://github.com/sponsors/elbwalker"}]}}},function(){return r||(0,t[c(t)[0]])((r={exports:{}}).exports,r),r.exports});var{version:p}=l();var u=require("@aws-sdk/client-firehose");function m(e){const{streamName:t,region:r="eu-central-1",config:s={}}=e;t||function(e){throw new Error(String(e))}("Firehose: Config custom streamName missing"),s.region||(s.region=r);return{streamName:t,client:e.client||new u.FirehoseClient(s),region:r}}var f=async function(e,{config:t,collector:r,wrap:s}){const{firehose:n}=t.settings||{};n&&async function(e,t){const{client:r,streamName:s}=t;if(!r)return{queue:e};const n=e.map(({event:e})=>({Data:Buffer.from(JSON.stringify(e))}));await r.send(new u.PutRecordBatchCommand({DeliveryStreamName:s,Records:n}))}([{event:e}],n)},d={},g={type:"aws-firehose",config:{},async init({config:e}){const t=function(e={}){const t=e.settings||{};return t.firehose&&(t.firehose=m(t.firehose)),{settings:t}}(e);return typeof t.settings==typeof{}&&t},push:async(e,{config:t,collector:r,wrap:s})=>await f(e,{config:t,collector:r,wrap:s})},w={};//# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/firehose/lib/firehose.ts","../src/firehose/config.ts","../src/firehose/push.ts","../src/firehose/types/index.ts","../src/firehose/index.ts","../src/firehose/examples/index.ts"],"sourcesContent":["// AWS Firehose\nexport { destinationFirehose } from './firehose';\nexport * as DestinationFirehose from './firehose/types';\n\n// Examples\nexport * as destinationFirehoseExamples from './firehose/examples';\n","import type { Destination } from '@walkeros/core';\nimport type { FirehoseConfig } from '../types';\nimport { throwError } from '@walkeros/core';\nimport {\n FirehoseClient,\n PutRecordBatchCommand,\n} from '@aws-sdk/client-firehose';\n\nexport function getConfigFirehose(\n firehoseConfig: Partial<FirehoseConfig>,\n): FirehoseConfig {\n const { streamName, region = 'eu-central-1', config = {} } = firehoseConfig;\n\n if (!streamName) throwError('Firehose: Config custom streamName missing');\n\n if (!config.region) config.region = region;\n\n const client = firehoseConfig.client || new FirehoseClient(config);\n\n return {\n streamName,\n client,\n region,\n };\n}\n\nexport async function pushFirehose(\n pushEvents: Destination.PushEvents,\n config: FirehoseConfig,\n) {\n const { client, streamName } = config;\n\n if (!client) return { queue: pushEvents };\n\n // Up to 500 records per batch\n const records = pushEvents.map(({ event }) => ({\n Data: Buffer.from(JSON.stringify(event)),\n }));\n\n await client.send(\n new PutRecordBatchCommand({\n DeliveryStreamName: streamName,\n Records: records,\n }),\n );\n}\n","import type { Config, Settings, PartialConfig } from './types';\nimport { getConfigFirehose } from './lib/firehose';\n\nexport function getConfig(partialConfig: PartialConfig = {}): Config {\n const settings = partialConfig.settings || ({} as Settings);\n\n if (settings.firehose)\n settings.firehose = getConfigFirehose(settings.firehose);\n\n return { settings };\n}\n","import type { PushFn } from './types';\nimport { pushFirehose } from './lib/firehose';\n\nexport const push: PushFn = async function (\n event,\n { config, collector, wrap },\n) {\n const { firehose } = config.settings || {};\n\n if (firehose) pushFirehose([{ event }], firehose);\n\n return;\n};\n","import type { DestinationServer } from '@walkeros/server-core';\nimport type { Mapping as WalkerOSMapping, Elb } from '@walkeros/core';\nimport type {\n FirehoseClient,\n FirehoseClientConfig,\n} from '@aws-sdk/client-firehose';\n\ndeclare global {\n // Augment the global WalkerOS namespace with destination-specific types\n namespace WalkerOS {\n interface Elb extends Elb.RegisterDestination<Destination, Config> {}\n }\n}\n\nexport interface Destination\n extends DestinationServer.Destination<Settings, Mapping> {\n init: DestinationServer.InitFn<Settings, Mapping>;\n}\n\nexport type Config = {\n settings: Settings;\n} & DestinationServer.Config<Settings, Mapping>;\n\nexport interface Settings {\n firehose?: FirehoseConfig;\n}\n\nexport interface Mapping {\n // Custom destination event mapping properties\n}\n\nexport type InitFn = DestinationServer.InitFn<Settings, Mapping>;\nexport type PushFn = DestinationServer.PushFn<Settings, Mapping>;\n\nexport type PartialConfig = DestinationServer.PartialConfig<Settings, Mapping>;\n\nexport type PushEvents = DestinationServer.PushEvents<Mapping>;\n\nexport type Rule = WalkerOSMapping.Rule<Mapping>;\nexport type Rules = WalkerOSMapping.Rules<Rule>;\n\nexport interface FirehoseConfig {\n streamName: string;\n client?: FirehoseClient;\n region?: string;\n config?: FirehoseClientConfig;\n}\n","import type { Settings, Destination } from './types';\nimport { isSameType } from '@walkeros/core';\nimport { getConfig } from './config';\nimport { push } from './push';\n\n// Types\nexport * as DestinationFirehose from './types';\n\nexport const destinationFirehose: Destination = {\n type: 'aws-firehose',\n\n config: {},\n\n async init({ config: partialConfig }) {\n const config = getConfig(partialConfig);\n\n if (!isSameType(config.settings, {} as Settings)) return false;\n\n return config;\n },\n\n async push(event, { config, collector, wrap }) {\n return await push(event, { config, collector, wrap });\n },\n};\n\nexport default destinationFirehose;\n","export {};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A;;;;;;;;;;;;;;;;;;;ACGA,6BAGO;AAEA,SAAS,kBACd,gBACgB;AAChB,QAAM,EAAE,YAAY,SAAS,gBAAgB,SAAS,CAAC,EAAE,IAAI;AAE7D,MAAI,CAAC,WAAY,IAAW,4CAA4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;AAAA,EACtD;AACF;;;ACxBA;","names":[]}
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ var e,t,s=Object.getOwnPropertyNames,r=(e={"package.json"(e,t){t.exports={name:"@walkeros/core",description:"Core types and platform-agnostic utilities for walkerOS",version:"0.0.7",main:"./dist/index.js",module:"./dist/index.mjs",types:"./dist/index.d.ts",license:"MIT",files:["dist/**"],scripts:{build:"tsup --silent",clean:"rm -rf .turbo && rm -rf node_modules && rm -rf dist",dev:"jest --watchAll --colors",lint:'tsc && eslint "**/*.ts*"',test:"jest",update:"npx npm-check-updates -u && npm update"},dependencies:{},devDependencies:{},repository:{url:"git+https://github.com/elbwalker/walkerOS.git",directory:"packages/core"},author:"elbwalker <hello@elbwalker.com>",homepage:"https://github.com/elbwalker/walkerOS#readme",bugs:{url:"https://github.com/elbwalker/walkerOS/issues"},keywords:["walker","walkerOS","analytics","tracking","data collection","measurement","data privacy","privacy friendly","web analytics","product analytics","core","types","utils"],funding:[{type:"GitHub Sponsors",url:"https://github.com/sponsors/elbwalker"}]}}},function(){return t||(0,e[s(e)[0]])((t={exports:{}}).exports,t),t.exports});var{version:n}=r();import{FirehoseClient as i,PutRecordBatchCommand as o}from"@aws-sdk/client-firehose";function a(e){const{streamName:t,region:s="eu-central-1",config:r={}}=e;t||function(e){throw new Error(String(e))}("Firehose: Config custom streamName missing"),r.region||(r.region=s);return{streamName:t,client:e.client||new i(r),region:s}}var c=async function(e,{config:t,collector:s,wrap:r}){const{firehose:n}=t.settings||{};n&&async function(e,t){const{client:s,streamName:r}=t;if(!s)return{queue:e};const n=e.map(({event:e})=>({Data:Buffer.from(JSON.stringify(e))}));await s.send(new o({DeliveryStreamName:r,Records:n}))}([{event:e}],n)},l={},p={type:"aws-firehose",config:{},async init({config:e}){const t=function(e={}){const t=e.settings||{};return t.firehose&&(t.firehose=a(t.firehose)),{settings:t}}(e);return typeof t.settings==typeof{}&&t},push:async(e,{config:t,collector:s,wrap:r})=>await c(e,{config:t,collector:s,wrap:r})},u={};export{l as DestinationFirehose,p as destinationFirehose,u as destinationFirehoseExamples};//# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/firehose/lib/firehose.ts","../src/firehose/config.ts","../src/firehose/push.ts","../src/firehose/types/index.ts","../src/firehose/index.ts","../src/firehose/examples/index.ts"],"sourcesContent":["import type { Destination } from '@walkeros/core';\nimport type { FirehoseConfig } from '../types';\nimport { throwError } from '@walkeros/core';\nimport {\n FirehoseClient,\n PutRecordBatchCommand,\n} from '@aws-sdk/client-firehose';\n\nexport function getConfigFirehose(\n firehoseConfig: Partial<FirehoseConfig>,\n): FirehoseConfig {\n const { streamName, region = 'eu-central-1', config = {} } = firehoseConfig;\n\n if (!streamName) throwError('Firehose: Config custom streamName missing');\n\n if (!config.region) config.region = region;\n\n const client = firehoseConfig.client || new FirehoseClient(config);\n\n return {\n streamName,\n client,\n region,\n };\n}\n\nexport async function pushFirehose(\n pushEvents: Destination.PushEvents,\n config: FirehoseConfig,\n) {\n const { client, streamName } = config;\n\n if (!client) return { queue: pushEvents };\n\n // Up to 500 records per batch\n const records = pushEvents.map(({ event }) => ({\n Data: Buffer.from(JSON.stringify(event)),\n }));\n\n await client.send(\n new PutRecordBatchCommand({\n DeliveryStreamName: streamName,\n Records: records,\n }),\n );\n}\n","import type { Config, Settings, PartialConfig } from './types';\nimport { getConfigFirehose } from './lib/firehose';\n\nexport function getConfig(partialConfig: PartialConfig = {}): Config {\n const settings = partialConfig.settings || ({} as Settings);\n\n if (settings.firehose)\n settings.firehose = getConfigFirehose(settings.firehose);\n\n return { settings };\n}\n","import type { PushFn } from './types';\nimport { pushFirehose } from './lib/firehose';\n\nexport const push: PushFn = async function (\n event,\n { config, collector, wrap },\n) {\n const { firehose } = config.settings || {};\n\n if (firehose) pushFirehose([{ event }], firehose);\n\n return;\n};\n","import type { DestinationServer } from '@walkeros/server-core';\nimport type { Mapping as WalkerOSMapping, Elb } from '@walkeros/core';\nimport type {\n FirehoseClient,\n FirehoseClientConfig,\n} from '@aws-sdk/client-firehose';\n\ndeclare global {\n // Augment the global WalkerOS namespace with destination-specific types\n namespace WalkerOS {\n interface Elb extends Elb.RegisterDestination<Destination, Config> {}\n }\n}\n\nexport interface Destination\n extends DestinationServer.Destination<Settings, Mapping> {\n init: DestinationServer.InitFn<Settings, Mapping>;\n}\n\nexport type Config = {\n settings: Settings;\n} & DestinationServer.Config<Settings, Mapping>;\n\nexport interface Settings {\n firehose?: FirehoseConfig;\n}\n\nexport interface Mapping {\n // Custom destination event mapping properties\n}\n\nexport type InitFn = DestinationServer.InitFn<Settings, Mapping>;\nexport type PushFn = DestinationServer.PushFn<Settings, Mapping>;\n\nexport type PartialConfig = DestinationServer.PartialConfig<Settings, Mapping>;\n\nexport type PushEvents = DestinationServer.PushEvents<Mapping>;\n\nexport type Rule = WalkerOSMapping.Rule<Mapping>;\nexport type Rules = WalkerOSMapping.Rules<Rule>;\n\nexport interface FirehoseConfig {\n streamName: string;\n client?: FirehoseClient;\n region?: string;\n config?: FirehoseClientConfig;\n}\n","import type { Settings, Destination } from './types';\nimport { isSameType } from '@walkeros/core';\nimport { getConfig } from './config';\nimport { push } from './push';\n\n// Types\nexport * as DestinationFirehose from './types';\n\nexport const destinationFirehose: Destination = {\n type: 'aws-firehose',\n\n config: {},\n\n async init({ config: partialConfig }) {\n const config = getConfig(partialConfig);\n\n if (!isSameType(config.settings, {} as Settings)) return false;\n\n return config;\n },\n\n async push(event, { config, collector, wrap }) {\n return await push(event, { config, collector, wrap });\n },\n};\n\nexport default destinationFirehose;\n","export {};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAGA;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAEA,SAAS,kBACd,gBACgB;AAChB,QAAM,EAAE,YAAY,SAAS,gBAAgB,SAAS,CAAC,EAAE,IAAI;AAE7D,MAAI,CAAC,WAAY,IAAW,4CAA4C;AAExE,MAAI,CAAC,OAAO,OAAQ,QAAO,SAAS;AAEp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-0,0 +1,60 @@
1
+ {
2
+ "name": "@walkeros/server-destination-aws",
3
+ "description": "AWS server destination for walkerOS",
4
+ "version": "0.0.7",
5
+ "license": "MIT",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.mjs",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.mjs",
13
+ "require": "./dist/index.js"
14
+ },
15
+ "./examples": {
16
+ "types": "./dist/examples/index.d.ts",
17
+ "import": "./dist/examples/index.mjs",
18
+ "require": "./dist/examples/index.js"
19
+ }
20
+ },
21
+ "files": [
22
+ "dist/**"
23
+ ],
24
+ "scripts": {
25
+ "build": "tsup --silent",
26
+ "clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
27
+ "dev": "jest --watchAll --colors",
28
+ "lint": "tsc && eslint \"**/*.ts*\"",
29
+ "test": "jest",
30
+ "update": "npx npm-check-updates -u && npm update"
31
+ },
32
+ "dependencies": {
33
+ "@aws-sdk/client-firehose": "^3.606.0",
34
+ "@walkeros/server-core": "0.0.7"
35
+ },
36
+ "devDependencies": {},
37
+ "repository": {
38
+ "url": "git+https://github.com/elbwalker/walkerOS.git",
39
+ "directory": "packages/server/destinations/aws"
40
+ },
41
+ "author": "elbwalker <hello@elbwalker.com>",
42
+ "homepage": "https://github.com/elbwalker/walkerOS#readme",
43
+ "bugs": {
44
+ "url": "https://github.com/elbwalker/walkerOS/issues"
45
+ },
46
+ "keywords": [
47
+ "walker",
48
+ "walkerOS",
49
+ "destination",
50
+ "server",
51
+ "aws",
52
+ "firehose"
53
+ ],
54
+ "funding": [
55
+ {
56
+ "type": "GitHub Sponsors",
57
+ "url": "https://github.com/sponsors/elbwalker"
58
+ }
59
+ ]
60
+ }