@walkeros/server-destination-aws 0.1.1 → 0.1.2

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.
@@ -20,16 +20,13 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/examples/index.ts
21
21
  var examples_exports2 = {};
22
22
  __export(examples_exports2, {
23
- destinationFirehoseExamples: () => destinationFirehoseExamples
23
+ firehose: () => examples_exports
24
24
  });
25
25
  module.exports = __toCommonJS(examples_exports2);
26
26
 
27
27
  // src/firehose/examples/index.ts
28
28
  var examples_exports = {};
29
-
30
- // src/examples/index.ts
31
- var destinationFirehoseExamples = examples_exports;
32
29
  // Annotate the CommonJS export names for ESM import in node:
33
30
  0 && (module.exports = {
34
- destinationFirehoseExamples
31
+ firehose
35
32
  });
@@ -1,8 +1,5 @@
1
1
  // src/firehose/examples/index.ts
2
2
  var examples_exports = {};
3
-
4
- // src/examples/index.ts
5
- var destinationFirehoseExamples = examples_exports;
6
3
  export {
7
- destinationFirehoseExamples
4
+ examples_exports as firehose
8
5
  };
package/dist/index.d.mts CHANGED
@@ -2,12 +2,6 @@ import { DestinationServer } from '@walkeros/server-core';
2
2
  import { Mapping as Mapping$1 } from '@walkeros/core';
3
3
  import { FirehoseClient, FirehoseClientConfig } from '@aws-sdk/client-firehose';
4
4
 
5
- declare global {
6
- namespace WalkerOS {
7
- interface Elb extends Elb.RegisterDestination<Destination, Config> {
8
- }
9
- }
10
- }
11
5
  interface Destination extends DestinationServer.Destination<Settings, Mapping> {
12
6
  init: DestinationServer.InitFn<Settings, Mapping>;
13
7
  }
@@ -32,25 +26,29 @@ interface FirehoseConfig {
32
26
  config?: FirehoseClientConfig;
33
27
  }
34
28
 
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 };
29
+ type index$2_Config = Config;
30
+ type index$2_Destination = Destination;
31
+ type index$2_FirehoseConfig = FirehoseConfig;
32
+ type index$2_InitFn = InitFn;
33
+ type index$2_Mapping = Mapping;
34
+ type index$2_PartialConfig = PartialConfig;
35
+ type index$2_PushEvents = PushEvents;
36
+ type index$2_PushFn = PushFn;
37
+ type index$2_Rule = Rule;
38
+ type index$2_Rules = Rules;
39
+ type index$2_Settings = Settings;
40
+ declare namespace index$2 {
41
+ export type { index$2_Config as Config, index$2_Destination as Destination, index$2_FirehoseConfig as FirehoseConfig, index$2_InitFn as InitFn, index$2_Mapping as Mapping, index$2_PartialConfig as PartialConfig, index$2_PushEvents as PushEvents, index$2_PushFn as PushFn, index$2_Rule as Rule, index$2_Rules as Rules, index$2_Settings as Settings };
48
42
  }
49
43
 
50
44
  declare const destinationFirehose: Destination;
51
45
 
52
- declare namespace index {
46
+ declare namespace index$1 {
53
47
  export { };
54
48
  }
55
49
 
56
- export { index$1 as DestinationFirehose, destinationFirehose, index as destinationFirehoseExamples };
50
+ declare namespace index {
51
+ export { index$1 as firehose };
52
+ }
53
+
54
+ export { index$2 as DestinationFirehose, destinationFirehose, index as examples };
package/dist/index.d.ts CHANGED
@@ -2,12 +2,6 @@ import { DestinationServer } from '@walkeros/server-core';
2
2
  import { Mapping as Mapping$1 } from '@walkeros/core';
3
3
  import { FirehoseClient, FirehoseClientConfig } from '@aws-sdk/client-firehose';
4
4
 
5
- declare global {
6
- namespace WalkerOS {
7
- interface Elb extends Elb.RegisterDestination<Destination, Config> {
8
- }
9
- }
10
- }
11
5
  interface Destination extends DestinationServer.Destination<Settings, Mapping> {
12
6
  init: DestinationServer.InitFn<Settings, Mapping>;
13
7
  }
@@ -32,25 +26,29 @@ interface FirehoseConfig {
32
26
  config?: FirehoseClientConfig;
33
27
  }
34
28
 
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 };
29
+ type index$2_Config = Config;
30
+ type index$2_Destination = Destination;
31
+ type index$2_FirehoseConfig = FirehoseConfig;
32
+ type index$2_InitFn = InitFn;
33
+ type index$2_Mapping = Mapping;
34
+ type index$2_PartialConfig = PartialConfig;
35
+ type index$2_PushEvents = PushEvents;
36
+ type index$2_PushFn = PushFn;
37
+ type index$2_Rule = Rule;
38
+ type index$2_Rules = Rules;
39
+ type index$2_Settings = Settings;
40
+ declare namespace index$2 {
41
+ export type { index$2_Config as Config, index$2_Destination as Destination, index$2_FirehoseConfig as FirehoseConfig, index$2_InitFn as InitFn, index$2_Mapping as Mapping, index$2_PartialConfig as PartialConfig, index$2_PushEvents as PushEvents, index$2_PushFn as PushFn, index$2_Rule as Rule, index$2_Rules as Rules, index$2_Settings as Settings };
48
42
  }
49
43
 
50
44
  declare const destinationFirehose: Destination;
51
45
 
52
- declare namespace index {
46
+ declare namespace index$1 {
53
47
  export { };
54
48
  }
55
49
 
56
- export { index$1 as DestinationFirehose, destinationFirehose, index as destinationFirehoseExamples };
50
+ declare namespace index {
51
+ export { index$1 as firehose };
52
+ }
53
+
54
+ export { index$2 as DestinationFirehose, destinationFirehose, index as examples };
package/dist/index.js CHANGED
@@ -1 +1 @@
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.1",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
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})},c={};a(c,{DestinationFirehose:()=>g,destinationFirehose:()=>y,examples:()=>h}),module.exports=(e=c,((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 l=Object.getOwnPropertyNames,u=(t={"package.json"(e,t){t.exports={name:"@walkeros/core",description:"Core types and platform-agnostic utilities for walkerOS",version:"0.1.2",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[l(t)[0]])((r={exports:{}}).exports,r),r.exports});var{version:p}=u();var f=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 f.FirehoseClient(s),region:r}}var d=async function(e,{config:t,collector:r,env: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 f.PutRecordBatchCommand({DeliveryStreamName:s,Records:n}))}([{event:e}],n)},g={},y={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:s})=>await d(e,{config:t,collector:r,env:s})},h={};a(h,{firehose:()=>w});var w={};//# 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 (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":[]}
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/examples/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 examples from './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 } from '@walkeros/core';\nimport type {\n FirehoseClient,\n FirehoseClientConfig,\n} from '@aws-sdk/client-firehose';\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 * as firehose from '../firehose/examples';\n","export {};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAAA;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,IAAAC,oBAAA;AAAA,SAAAA,mBAAA;AAAA;AAAA;;;ACAA;","names":["examples_exports","examples_exports"]}
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.1.1",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
+ var e,t,r=Object.defineProperty,s=Object.getOwnPropertyNames,n=(e={"package.json"(e,t){t.exports={name:"@walkeros/core",description:"Core types and platform-agnostic utilities for walkerOS",version:"0.1.2",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:i}=n();import{FirehoseClient as o,PutRecordBatchCommand as a}from"@aws-sdk/client-firehose";function c(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 o(s),region:r}}var l=async function(e,{config:t,collector:r,env: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 a({DeliveryStreamName:s,Records:n}))}([{event:e}],n)},p={},u={type:"aws-firehose",config:{},async init({config:e}){const t=function(e={}){const t=e.settings||{};return t.firehose&&(t.firehose=c(t.firehose)),{settings:t}}(e);return typeof t.settings==typeof{}&&t},push:async(e,{config:t,collector:r,env:s})=>await l(e,{config:t,collector:r,env:s})},m={};((e,t)=>{for(var s in t)r(e,s,{get:t[s],enumerable:!0})})(m,{firehose:()=>f});var f={};export{p as DestinationFirehose,u as destinationFirehose,m as examples};//# 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 (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":[]}
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/examples/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 } from '@walkeros/core';\nimport type {\n FirehoseClient,\n FirehoseClientConfig,\n} from '@aws-sdk/client-firehose';\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 * as firehose from '../firehose/examples';\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,IAAAA,oBAAA;AAAA,SAAAA,mBAAA;AAAA;AAAA;;;ACAA;","names":["examples_exports"]}
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.1.1",
4
+ "version": "0.1.2",
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.1.1"
34
+ "@walkeros/server-core": "0.1.2"
35
35
  },
36
36
  "devDependencies": {},
37
37
  "repository": {