@walkeros/server-destination-aws 0.0.7 → 0.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/README.md CHANGED
@@ -1,30 +1,20 @@
1
1
  <p align="left">
2
2
  <a href="https://elbwalker.com">
3
- <img title="elbwalker" src='https://www.elbwalker.com/img/elbwalker_logo.png' width="256px"/>
3
+ <img title="elbwalker" src="https://www.elbwalker.com/img/elbwalker_logo.png" width="256px"/>
4
4
  </a>
5
5
  </p>
6
6
 
7
- # AWS Destination for walkerOS
7
+ # AWS (Firehose) Destination for walkerOS
8
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.
9
+ [Source Code](https://github.com/elbwalker/walkerOS/tree/main/packages/server/destinations/aws)
10
+ &bull;
11
+ [NPM Package](https://www.npmjs.com/package/@walkeros/server-destination-aws)
11
12
 
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.
13
+ walkerOS follows a **source → collector → destination** architecture. This AWS
14
+ destination receives processed events from the walkerOS collector and streams
15
+ them to AWS services like Firehose, enabling real-time data ingestion into AWS
16
+ data lakes, warehouses, and analytics services for large-scale event processing
17
+ and analysis.
28
18
 
29
19
  ## Installation
30
20
 
@@ -34,26 +24,45 @@ npm install @walkeros/server-destination-aws
34
24
 
35
25
  ## Usage
36
26
 
37
- Here's a basic example of how to use the AWS destination:
27
+ Here's a basic example of how to use the AWS Firehose destination:
38
28
 
39
29
  ```typescript
40
30
  import { elb } from '@walkeros/collector';
41
31
  import { destinationFirehose } from '@walkeros/server-destination-aws';
42
32
 
43
33
  elb('walker destination', destinationFirehose, {
44
- custom: {
34
+ settings: {
45
35
  firehose: {
46
36
  streamName: 'your-firehose-stream-name',
47
37
  region: 'eu-central-1',
48
- credentials: {
49
- accessKeyId: 'your-access-key-id',
50
- secretAccessKey: 'your-secret-access-key',
38
+ config: {
39
+ credentials: {
40
+ accessKeyId: 'your-access-key-id',
41
+ secretAccessKey: 'your-secret-access-key',
42
+ },
51
43
  },
52
44
  },
53
45
  },
54
46
  });
55
47
  ```
56
48
 
49
+ ## Configuration
50
+
51
+ | Name | Type | Description | Required | Example |
52
+ | ---------- | ---------------- | ----------------------------------- | -------- | ------------------------------------------------------ |
53
+ | `firehose` | `FirehoseConfig` | AWS Firehose configuration settings | No | `{ streamName: 'walker-events', region: 'us-east-1' }` |
54
+
55
+ ### Firehose Configuration
56
+
57
+ The `firehose` object has the following properties:
58
+
59
+ | Name | Type | Description | Required | Example |
60
+ | ------------ | ---------------------- | ------------------------------------------------- | -------- | --------------------------------- |
61
+ | `streamName` | `string` | Name of the Kinesis Data Firehose delivery stream | Yes | `'walker-events'` |
62
+ | `client` | `FirehoseClient` | Pre-configured AWS Firehose client instance | No | `new FirehoseClient(config)` |
63
+ | `region` | `string` | AWS region for the Firehose service | No | `'us-east-1'` |
64
+ | `config` | `FirehoseClientConfig` | AWS SDK client configuration options | No | `{ credentials: awsCredentials }` |
65
+
57
66
  ## Contribute
58
67
 
59
68
  Feel free to contribute by submitting an
package/dist/index.js CHANGED
@@ -1 +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
1
+ "use strict";var e,t,r,n=Object.defineProperty,s=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,a={};((e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})})(a,{DestinationFirehose:()=>d,destinationFirehose:()=>g,destinationFirehoseExamples:()=>y}),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||n(e,c,{get:()=>t[c],enumerable:!(a=s(t,c))||a.enumerable});return e})(n({},"__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.1.0",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:u}=l();var p=require("@aws-sdk/client-firehose");function m(e){const{streamName:t,region:r="eu-central-1",config:n={}}=e;t||function(e){throw new Error(String(e))}("Firehose: Config custom streamName missing"),n.region||(n.region=r);return{streamName:t,client:e.client||new p.FirehoseClient(n),region:r}}var f=async function(e,{config:t,collector:r,env:n}){const{firehose:s}=t.settings||{};s&&async function(e,t){const{client:r,streamName:n}=t;if(!r)return{queue:e};const s=e.map(({event:e})=>({Data:Buffer.from(JSON.stringify(e))}));await r.send(new p.PutRecordBatchCommand({DeliveryStreamName:n,Records:s}))}([{event:e}],s)},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,env:n})=>await f(e,{config:t,collector:r,env:n})},y={};//# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +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,4CAA4C;AAExE,MAAI,CAAC,OAAO,OAAQ,QAAO,SAAS;AAEpC,QAAM,SAAS,eAAe,UAAU,IAAI,sCAAe,MAAM;AAEjE,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAEA,eAAsB,aACpB,YACA,QACA;AACA,QAAM,EAAE,QAAQ,WAAW,IAAI;AAE/B,MAAI,CAAC,OAAQ,QAAO,EAAE,OAAO,WAAW;AAGxC,QAAM,UAAU,WAAW,IAAI,CAAC,EAAE,MAAM,OAAO;AAAA,IAC7C,MAAM,OAAO,KAAK,KAAK,UAAU,KAAK,CAAC;AAAA,EACzC,EAAE;AAEF,QAAM,OAAO;AAAA,IACX,IAAI,6CAAsB;AAAA,MACxB,oBAAoB;AAAA,MACpB,SAAS;AAAA,IACX,CAAC;AAAA,EACH;AACF;;;AC1CO,SAAS,UAAU,gBAA+B,CAAC,GAAW;AACnE,QAAM,WAAW,cAAc,YAAa,CAAC;AAE7C,MAAI,SAAS;AACX,aAAS,WAAW,kBAAkB,SAAS,QAAQ;AAEzD,SAAO,EAAE,SAAS;AACpB;;;ACPO,IAAM,OAAe,eAC1B,OACA,EAAE,QAAQ,WAAW,KAAK,GAC1B;AACA,QAAM,EAAE,SAAS,IAAI,OAAO,YAAY,CAAC;AAEzC,MAAI,SAAU,cAAa,CAAC,EAAE,MAAM,CAAC,GAAG,QAAQ;AAEhD;AACF;;;ACZA;;;ACQO,IAAM,sBAAmC;AAAA,EAC9C,MAAM;AAAA,EAEN,QAAQ,CAAC;AAAA,EAET,MAAM,KAAK,EAAE,QAAQ,cAAc,GAAG;AACpC,UAAM,SAAS,UAAU,aAAa;AAEtC,QAAI,CAAC,EAAW,OAAO,UAAU,CAAC,CAAa,EAAG,QAAO;AAEzD,WAAO;AAAA,EACT;AAAA,EAEA,MAAM,KAAK,OAAO,EAAE,QAAQ,WAAW,KAAK,GAAG;AAC7C,WAAO,MAAM,KAAK,OAAO,EAAE,QAAQ,WAAW,KAAK,CAAC;AAAA,EACtD;AACF;;;ACxBA;","names":[]}
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 (event, { config, collector, env }) {\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, env }) {\n return await push(event, { config, collector, env });\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,4CAA4C;AAExE,MAAI,CAAC,OAAO,OAAQ,QAAO,SAAS;AAEpC,QAAM,SAAS,eAAe,UAAU,IAAI,sCAAe,MAAM;AAEjE,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAEA,eAAsB,aACpB,YACA,QACA;AACA,QAAM,EAAE,QAAQ,WAAW,IAAI;AAE/B,MAAI,CAAC,OAAQ,QAAO,EAAE,OAAO,WAAW;AAGxC,QAAM,UAAU,WAAW,IAAI,CAAC,EAAE,MAAM,OAAO;AAAA,IAC7C,MAAM,OAAO,KAAK,KAAK,UAAU,KAAK,CAAC;AAAA,EACzC,EAAE;AAEF,QAAM,OAAO;AAAA,IACX,IAAI,6CAAsB;AAAA,MACxB,oBAAoB;AAAA,MACpB,SAAS;AAAA,IACX,CAAC;AAAA,EACH;AACF;;;AC1CO,SAAS,UAAU,gBAA+B,CAAC,GAAW;AACnE,QAAM,WAAW,cAAc,YAAa,CAAC;AAE7C,MAAI,SAAS;AACX,aAAS,WAAW,kBAAkB,SAAS,QAAQ;AAEzD,SAAO,EAAE,SAAS;AACpB;;;ACPO,IAAM,OAAe,eAAgB,OAAO,EAAE,QAAQ,WAAW,IAAI,GAAG;AAC7E,QAAM,EAAE,SAAS,IAAI,OAAO,YAAY,CAAC;AAEzC,MAAI,SAAU,cAAa,CAAC,EAAE,MAAM,CAAC,GAAG,QAAQ;AAEhD;AACF;;;ACTA;;;ACQO,IAAM,sBAAmC;AAAA,EAC9C,MAAM;AAAA,EAEN,QAAQ,CAAC;AAAA,EAET,MAAM,KAAK,EAAE,QAAQ,cAAc,GAAG;AACpC,UAAM,SAAS,UAAU,aAAa;AAEtC,QAAI,CAAC,EAAW,OAAO,UAAU,CAAC,CAAa,EAAG,QAAO;AAEzD,WAAO;AAAA,EACT;AAAA,EAEA,MAAM,KAAK,OAAO,EAAE,QAAQ,WAAW,IAAI,GAAG;AAC5C,WAAO,MAAM,KAAK,OAAO,EAAE,QAAQ,WAAW,IAAI,CAAC;AAAA,EACrD;AACF;;;ACxBA;","names":[]}
package/dist/index.mjs CHANGED
@@ -1 +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
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.1.0",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,env: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,env:r})=>await c(e,{config:t,collector:s,env:r})},u={};export{l as DestinationFirehose,p as destinationFirehose,u as destinationFirehoseExamples};//# sourceMappingURL=index.mjs.map
@@ -1 +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;AAEpC,QAAM,SAAS,eAAe,UAAU,IAAI,eAAe,MAAM;AAEjE,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAEA,eAAsB,aACpB,YACA,QACA;AACA,QAAM,EAAE,QAAQ,WAAW,IAAI;AAE/B,MAAI,CAAC,OAAQ,QAAO,EAAE,OAAO,WAAW;AAGxC,QAAM,UAAU,WAAW,IAAI,CAAC,EAAE,MAAM,OAAO;AAAA,IAC7C,MAAM,OAAO,KAAK,KAAK,UAAU,KAAK,CAAC;AAAA,EACzC,EAAE;AAEF,QAAM,OAAO;AAAA,IACX,IAAI,sBAAsB;AAAA,MACxB,oBAAoB;AAAA,MACpB,SAAS;AAAA,IACX,CAAC;AAAA,EACH;AACF;;;AC1CO,SAAS,UAAU,gBAA+B,CAAC,GAAW;AACnE,QAAM,WAAW,cAAc,YAAa,CAAC;AAE7C,MAAI,SAAS;AACX,aAAS,WAAW,kBAAkB,SAAS,QAAQ;AAEzD,SAAO,EAAE,SAAS;AACpB;;;ACPO,IAAM,OAAe,eAC1B,OACA,EAAE,QAAQ,WAAW,KAAK,GAC1B;AACA,QAAM,EAAE,SAAS,IAAI,OAAO,YAAY,CAAC;AAEzC,MAAI,SAAU,cAAa,CAAC,EAAE,MAAM,CAAC,GAAG,QAAQ;AAEhD;AACF;;;ACZA;;;ACQO,IAAM,sBAAmC;AAAA,EAC9C,MAAM;AAAA,EAEN,QAAQ,CAAC;AAAA,EAET,MAAM,KAAK,EAAE,QAAQ,cAAc,GAAG;AACpC,UAAM,SAAS,UAAU,aAAa;AAEtC,QAAI,CAAC,EAAW,OAAO,UAAU,CAAC,CAAa,EAAG,QAAO;AAEzD,WAAO;AAAA,EACT;AAAA,EAEA,MAAM,KAAK,OAAO,EAAE,QAAQ,WAAW,KAAK,GAAG;AAC7C,WAAO,MAAM,KAAK,OAAO,EAAE,QAAQ,WAAW,KAAK,CAAC;AAAA,EACtD;AACF;;;ACxBA;","names":[]}
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 (event, { config, collector, env }) {\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, env }) {\n return await push(event, { config, collector, env });\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;AAEpC,QAAM,SAAS,eAAe,UAAU,IAAI,eAAe,MAAM;AAEjE,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAEA,eAAsB,aACpB,YACA,QACA;AACA,QAAM,EAAE,QAAQ,WAAW,IAAI;AAE/B,MAAI,CAAC,OAAQ,QAAO,EAAE,OAAO,WAAW;AAGxC,QAAM,UAAU,WAAW,IAAI,CAAC,EAAE,MAAM,OAAO;AAAA,IAC7C,MAAM,OAAO,KAAK,KAAK,UAAU,KAAK,CAAC;AAAA,EACzC,EAAE;AAEF,QAAM,OAAO;AAAA,IACX,IAAI,sBAAsB;AAAA,MACxB,oBAAoB;AAAA,MACpB,SAAS;AAAA,IACX,CAAC;AAAA,EACH;AACF;;;AC1CO,SAAS,UAAU,gBAA+B,CAAC,GAAW;AACnE,QAAM,WAAW,cAAc,YAAa,CAAC;AAE7C,MAAI,SAAS;AACX,aAAS,WAAW,kBAAkB,SAAS,QAAQ;AAEzD,SAAO,EAAE,SAAS;AACpB;;;ACPO,IAAM,OAAe,eAAgB,OAAO,EAAE,QAAQ,WAAW,IAAI,GAAG;AAC7E,QAAM,EAAE,SAAS,IAAI,OAAO,YAAY,CAAC;AAEzC,MAAI,SAAU,cAAa,CAAC,EAAE,MAAM,CAAC,GAAG,QAAQ;AAEhD;AACF;;;ACTA;;;ACQO,IAAM,sBAAmC;AAAA,EAC9C,MAAM;AAAA,EAEN,QAAQ,CAAC;AAAA,EAET,MAAM,KAAK,EAAE,QAAQ,cAAc,GAAG;AACpC,UAAM,SAAS,UAAU,aAAa;AAEtC,QAAI,CAAC,EAAW,OAAO,UAAU,CAAC,CAAa,EAAG,QAAO;AAEzD,WAAO;AAAA,EACT;AAAA,EAEA,MAAM,KAAK,OAAO,EAAE,QAAQ,WAAW,IAAI,GAAG;AAC5C,WAAO,MAAM,KAAK,OAAO,EAAE,QAAQ,WAAW,IAAI,CAAC;AAAA,EACrD;AACF;;;ACxBA;","names":[]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@walkeros/server-destination-aws",
3
3
  "description": "AWS server destination for walkerOS",
4
- "version": "0.0.7",
4
+ "version": "0.1.0",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.mjs",
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@aws-sdk/client-firehose": "^3.606.0",
34
- "@walkeros/server-core": "0.0.7"
34
+ "@walkeros/server-core": "0.1.0"
35
35
  },
36
36
  "devDependencies": {},
37
37
  "repository": {