@walkeros/server-destination-gcp 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,61 @@
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
+ # Google Cloud Platform (GCP) Destination for walkerOS
8
+
9
+ This package provides a Google Cloud Platform (GCP) destination for walkerOS. It
10
+ allows you to send events to Google BigQuery.
11
+
12
+ [View documentation](https://www.elbwalker.com/docs/destinations/server/gcp/)
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 GCP destination receives processed events from the walkerOS collector and
25
+ streams them to Google BigQuery, enabling real-time data warehousing and
26
+ analytics with Google Cloud's powerful data processing and machine learning
27
+ capabilities.
28
+
29
+ ## Installation
30
+
31
+ ```sh
32
+ npm install @walkeros/server-destination-gcp
33
+ ```
34
+
35
+ ## Usage
36
+
37
+ Here's a basic example of how to use the GCP destination:
38
+
39
+ ```typescript
40
+ import { elb } from '@walkeros/collector';
41
+ import { destinationBigQuery } from '@walkeros/server-destination-gcp';
42
+
43
+ elb('walker destination', destinationBigQuery, {
44
+ custom: {
45
+ projectId: 'YOUR_PROJECT_ID',
46
+ datasetId: 'YOUR_DATASET_ID',
47
+ tableId: 'YOUR_TABLE_ID',
48
+ },
49
+ });
50
+ ```
51
+
52
+ ## Contribute
53
+
54
+ Feel free to contribute by submitting an
55
+ [issue](https://github.com/elbwalker/walkerOS/issues), starting a
56
+ [discussion](https://github.com/elbwalker/walkerOS/discussions), or getting in
57
+ [contact](https://calendly.com/elb-alexander/30min).
58
+
59
+ ## License
60
+
61
+ This project is licensed under the MIT License.
@@ -0,0 +1,50 @@
1
+ import { DestinationServer } from '@walkeros/server-core';
2
+ import { Mapping as Mapping$1 } from '@walkeros/core';
3
+ import { BigQuery, BigQueryOptions } from '@google-cloud/bigquery';
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
+ client: BigQuery;
19
+ projectId: string;
20
+ datasetId: string;
21
+ tableId: string;
22
+ location?: string;
23
+ bigquery?: BigQueryOptions;
24
+ }
25
+ interface Mapping {
26
+ }
27
+ type InitFn = DestinationServer.InitFn<Settings, Mapping>;
28
+ type PushFn = DestinationServer.PushFn<Settings, Mapping>;
29
+ type PartialConfig = DestinationServer.PartialConfig<Settings, Mapping>;
30
+ type PushEvents = DestinationServer.PushEvents<Mapping>;
31
+ type Rule = Mapping$1.Rule<Mapping>;
32
+ type Rules = Mapping$1.Rules<Rule>;
33
+
34
+ type index_Config = Config;
35
+ type index_Destination = Destination;
36
+ type index_InitFn = InitFn;
37
+ type index_Mapping = Mapping;
38
+ type index_PartialConfig = PartialConfig;
39
+ type index_PushEvents = PushEvents;
40
+ type index_PushFn = PushFn;
41
+ type index_Rule = Rule;
42
+ type index_Rules = Rules;
43
+ type index_Settings = Settings;
44
+ declare namespace index {
45
+ export type { index_Config as Config, index_Destination as Destination, index_InitFn as InitFn, index_Mapping as Mapping, index_PartialConfig as PartialConfig, index_PushEvents as PushEvents, index_PushFn as PushFn, index_Rule as Rule, index_Rules as Rules, index_Settings as Settings };
46
+ }
47
+
48
+ declare const destinationBigQuery: Destination;
49
+
50
+ export { index as DestinationBigQuery, destinationBigQuery };
@@ -0,0 +1,50 @@
1
+ import { DestinationServer } from '@walkeros/server-core';
2
+ import { Mapping as Mapping$1 } from '@walkeros/core';
3
+ import { BigQuery, BigQueryOptions } from '@google-cloud/bigquery';
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
+ client: BigQuery;
19
+ projectId: string;
20
+ datasetId: string;
21
+ tableId: string;
22
+ location?: string;
23
+ bigquery?: BigQueryOptions;
24
+ }
25
+ interface Mapping {
26
+ }
27
+ type InitFn = DestinationServer.InitFn<Settings, Mapping>;
28
+ type PushFn = DestinationServer.PushFn<Settings, Mapping>;
29
+ type PartialConfig = DestinationServer.PartialConfig<Settings, Mapping>;
30
+ type PushEvents = DestinationServer.PushEvents<Mapping>;
31
+ type Rule = Mapping$1.Rule<Mapping>;
32
+ type Rules = Mapping$1.Rules<Rule>;
33
+
34
+ type index_Config = Config;
35
+ type index_Destination = Destination;
36
+ type index_InitFn = InitFn;
37
+ type index_Mapping = Mapping;
38
+ type index_PartialConfig = PartialConfig;
39
+ type index_PushEvents = PushEvents;
40
+ type index_PushFn = PushFn;
41
+ type index_Rule = Rule;
42
+ type index_Rules = Rules;
43
+ type index_Settings = Settings;
44
+ declare namespace index {
45
+ export type { index_Config as Config, index_Destination as Destination, index_InitFn as InitFn, index_Mapping as Mapping, index_PartialConfig as PartialConfig, index_PushEvents as PushEvents, index_PushFn as PushFn, index_Rule as Rule, index_Rules as Rules, index_Settings as Settings };
46
+ }
47
+
48
+ declare const destinationBigQuery: Destination;
49
+
50
+ export { index as DestinationBigQuery, destinationBigQuery };
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";var e,t,r,n=Object.defineProperty,o=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,s=Object.prototype.hasOwnProperty,a={};((e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})})(a,{DestinationBigQuery:()=>y,destinationBigQuery:()=>f}),module.exports=(e=a,((e,t,r,a)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let c of i(t))s.call(e,c)||c===r||n(e,c,{get:()=>t[c],enumerable:!(a=o(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.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});function p(e){return Array.isArray(e)}function d(e){return"object"==typeof e&&null!==e&&!p(e)&&"[object Object]"===Object.prototype.toString.call(e)}var{version:u}=l();var g=require("@google-cloud/bigquery");function b(e={}){const t=e.settings||{},{projectId:r,bigquery:n}=t;let{client:o,location:i,datasetId:s,tableId:a}=t;r||function(e){throw new Error(String(e))}("Config settings projectId missing"),i=i||"EU",s=s||"walkeros",a=a||"events";const c=n||{};c.projectId=r,o=o||new g.BigQuery(c);const l={...t,client:o,projectId:r,location:i,datasetId:s,tableId:a};return{...e,settings:l}}var m=e=>Object.entries(e).reduce((e,[t,r])=>(e[t]=d(r)||p(r)?JSON.stringify(r):r,e),{}),y={},f={type:"gcp-bigquery",config:{},init:async({config:e})=>b(e),push:async(e,{config:t,mapping:r,data:n,collector:o,wrap:i})=>await async function(e,{config:t,mapping:r,data:n,collector:o,wrap:i}){const{client:s,datasetId:a,tableId:c}=t.settings;let l;if(d(n))l=n;else{const t=new Date;l={...e,timestamp:e.timestamp?new Date(e.timestamp):t,createdAt:t}}const p=[m(l)];await s.dataset(a).table(c).insert(p)}(e,{config:t,mapping:r,data:n,collector:o,wrap:i})};//# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/bigquery/config.ts","../src/bigquery/push.ts","../src/bigquery/types/index.ts","../src/bigquery/index.ts"],"sourcesContent":["// Google BigQuery\nexport { destinationBigQuery } from './bigquery';\nexport * as DestinationBigQuery from './bigquery/types';\n","import type { Config, PartialConfig, Settings } from './types';\nimport type { BigQueryOptions } from '@google-cloud/bigquery';\nimport { throwError } from '@walkeros/core';\nimport { BigQuery } from '@google-cloud/bigquery';\n\nexport function getConfig(partialConfig: PartialConfig = {}): Config {\n const settings = partialConfig.settings || ({} as Settings);\n const { projectId, bigquery } = settings;\n let { client, location, datasetId, tableId } = settings;\n\n if (!projectId) throwError('Config settings projectId missing');\n\n location = location || 'EU';\n datasetId = datasetId || 'walkeros';\n tableId = tableId || 'events';\n\n const options: BigQueryOptions = bigquery || {};\n options.projectId = projectId;\n\n client = client || new BigQuery(options);\n\n const settingsConfig: Settings = {\n ...settings,\n client,\n projectId,\n location,\n datasetId,\n tableId,\n };\n\n return { ...partialConfig, settings: settingsConfig };\n}\n","import type { WalkerOS } from '@walkeros/core';\nimport type { PushFn } from './types';\nimport { isObject, isArray } from '@walkeros/core';\n\nexport const push: PushFn = async function (\n event,\n { config, mapping: _mapping, data, collector, wrap },\n) {\n const { client, datasetId, tableId } = config.settings!;\n\n let row: WalkerOS.AnyObject | undefined;\n\n if (isObject(data)) {\n row = data;\n } else {\n const now = new Date();\n row = {\n ...event,\n timestamp: event.timestamp ? new Date(event.timestamp) : now,\n createdAt: now,\n };\n }\n\n const rows = [mapEvent(row)];\n\n await client.dataset(datasetId).table(tableId).insert(rows);\n\n return;\n};\n\nexport const mapEvent = (event: WalkerOS.AnyObject) => {\n return Object.entries(event).reduce<WalkerOS.AnyObject>(\n (acc, [key, value]) => {\n acc[key] =\n isObject(value) || isArray(value) ? JSON.stringify(value) : value;\n return acc;\n },\n {},\n );\n};\n","import type { DestinationServer } from '@walkeros/server-core';\nimport type { Mapping as WalkerOSMapping, Elb } from '@walkeros/core';\nimport type { BigQuery, BigQueryOptions } from '@google-cloud/bigquery';\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 client: BigQuery;\n projectId: string;\n datasetId: string;\n tableId: string;\n location?: string;\n bigquery?: BigQueryOptions;\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","import type { Destination } from './types';\nimport { getConfig } from './config';\nimport { push } from './push';\n\n// Types\nexport * as DestinationBigQuery from './types';\n\nexport const destinationBigQuery: Destination = {\n type: 'gcp-bigquery',\n\n config: {},\n\n async init({ config: partialConfig }) {\n const config = getConfig(partialConfig);\n\n return config;\n },\n\n async push(event, { config, mapping, data, collector, wrap }) {\n return await push(event, { config, mapping, data, collector, wrap });\n },\n};\n\nexport default destinationBigQuery;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A;;;;;;;;;;;;;;;;;;;;;;ACGA,sBAAyB;AAElB,SAAS,UAAU,gBAA+B,CAAC,GAAW;AACnE,QAAM,WAAW,cAAc,YAAa,CAAC;AAC7C,QAAM,EAAE,WAAW,SAAS,IAAI;AAChC,MAAI,EAAE,QAAQ,UAAU,WAAW,QAAQ,IAAI;AAE/C,MAAI,CAAC,UAAW,IAAW,mCAAmC;AAE9D,aAAW,YAAY;AACvB,cAAY,aAAa;AACzB,Y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AM,WAAW,KAAK,GAAG;AAC5D,WAAO,MAAM,KAAK,OAAO,EAAE,QAAQ,SAAS,MAAM,WAAW,KAAK,CAAC;AAAA,EACrE;AACF;","names":[]}
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ var t,e,r=Object.getOwnPropertyNames,s=(t={"package.json"(t,e){e.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 e||(0,t[r(t)[0]])((e={exports:{}}).exports,e),e.exports});function i(t){return Array.isArray(t)}function n(t){return"object"==typeof t&&null!==t&&!i(t)&&"[object Object]"===Object.prototype.toString.call(t)}var{version:a}=s();import{BigQuery as o}from"@google-cloud/bigquery";function c(t={}){const e=t.settings||{},{projectId:r,bigquery:s}=e;let{client:i,location:n,datasetId:a,tableId:c}=e;r||function(t){throw new Error(String(t))}("Config settings projectId missing"),n=n||"EU",a=a||"walkeros",c=c||"events";const l=s||{};l.projectId=r,i=i||new o(l);const p={...e,client:i,projectId:r,location:n,datasetId:a,tableId:c};return{...t,settings:p}}var l=t=>Object.entries(t).reduce((t,[e,r])=>(t[e]=n(r)||i(r)?JSON.stringify(r):r,t),{}),p={},d={type:"gcp-bigquery",config:{},init:async({config:t})=>c(t),push:async(t,{config:e,mapping:r,data:s,collector:i,wrap:a})=>await async function(t,{config:e,mapping:r,data:s,collector:i,wrap:a}){const{client:o,datasetId:c,tableId:p}=e.settings;let d;if(n(s))d=s;else{const e=new Date;d={...t,timestamp:t.timestamp?new Date(t.timestamp):e,createdAt:e}}const u=[l(d)];await o.dataset(c).table(p).insert(u)}(t,{config:e,mapping:r,data:s,collector:i,wrap:a})};export{p as DestinationBigQuery,d as destinationBigQuery};//# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/bigquery/config.ts","../src/bigquery/push.ts","../src/bigquery/types/index.ts","../src/bigquery/index.ts"],"sourcesContent":["import type { Config, PartialConfig, Settings } from './types';\nimport type { BigQueryOptions } from '@google-cloud/bigquery';\nimport { throwError } from '@walkeros/core';\nimport { BigQuery } from '@google-cloud/bigquery';\n\nexport function getConfig(partialConfig: PartialConfig = {}): Config {\n const settings = partialConfig.settings || ({} as Settings);\n const { projectId, bigquery } = settings;\n let { client, location, datasetId, tableId } = settings;\n\n if (!projectId) throwError('Config settings projectId missing');\n\n location = location || 'EU';\n datasetId = datasetId || 'walkeros';\n tableId = tableId || 'events';\n\n const options: BigQueryOptions = bigquery || {};\n options.projectId = projectId;\n\n client = client || new BigQuery(options);\n\n const settingsConfig: Settings = {\n ...settings,\n client,\n projectId,\n location,\n datasetId,\n tableId,\n };\n\n return { ...partialConfig, settings: settingsConfig };\n}\n","import type { WalkerOS } from '@walkeros/core';\nimport type { PushFn } from './types';\nimport { isObject, isArray } from '@walkeros/core';\n\nexport const push: PushFn = async function (\n event,\n { config, mapping: _mapping, data, collector, wrap },\n) {\n const { client, datasetId, tableId } = config.settings!;\n\n let row: WalkerOS.AnyObject | undefined;\n\n if (isObject(data)) {\n row = data;\n } else {\n const now = new Date();\n row = {\n ...event,\n timestamp: event.timestamp ? new Date(event.timestamp) : now,\n createdAt: now,\n };\n }\n\n const rows = [mapEvent(row)];\n\n await client.dataset(datasetId).table(tableId).insert(rows);\n\n return;\n};\n\nexport const mapEvent = (event: WalkerOS.AnyObject) => {\n return Object.entries(event).reduce<WalkerOS.AnyObject>(\n (acc, [key, value]) => {\n acc[key] =\n isObject(value) || isArray(value) ? JSON.stringify(value) : value;\n return acc;\n },\n {},\n );\n};\n","import type { DestinationServer } from '@walkeros/server-core';\nimport type { Mapping as WalkerOSMapping, Elb } from '@walkeros/core';\nimport type { BigQuery, BigQueryOptions } from '@google-cloud/bigquery';\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 client: BigQuery;\n projectId: string;\n datasetId: string;\n tableId: string;\n location?: string;\n bigquery?: BigQueryOptions;\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","import type { Destination } from './types';\nimport { getConfig } from './config';\nimport { push } from './push';\n\n// Types\nexport * as DestinationBigQuery from './types';\n\nexport const destinationBigQuery: Destination = {\n type: 'gcp-bigquery',\n\n config: {},\n\n async init({ config: partialConfig }) {\n const config = getConfig(partialConfig);\n\n return config;\n },\n\n async push(event, { config, mapping, data, collector, wrap }) {\n return await push(event, { config, mapping, data, collector, wrap });\n },\n};\n\nexport default destinationBigQuery;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAGA,SAAS,gBAAgB;AAElB,SAAS,UAAU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ACvCA;;;ACOO,IAAM,sBAAmC;AAAA,EAC9C,MAAM;AAAA,EAEN,QAAQ,CAAC;AAAA,EAET,MAAM,KAAK,EAAE,QAAQ,cAAc,GAAG;AACpC,UAAM,SAAS,UAAU,aAAa;AAEtC,WAAO;AAAA,EACT;AAAA,EAEA,MAAM,KAAK,OAAO,EAAE,QAAQ,SAAS,MAAM,WAAW,KAAK,GAAG;AAC5D,WAAO,MAAM,KAAK,OAAO,EAAE,QAAQ,SAAS,MAAM,WAAW,KAAK,CAAC;AAAA,EACrE;AACF;","names":[]}
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@walkeros/server-destination-gcp",
3
+ "description": "Google Cloud Platform server destination for walkerOS (BigQuery)",
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
+ "files": [
10
+ "dist/**"
11
+ ],
12
+ "scripts": {
13
+ "build": "tsup --silent",
14
+ "clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
15
+ "dev": "jest --watchAll --colors",
16
+ "lint": "tsc && eslint \"**/*.ts*\"",
17
+ "test": "jest",
18
+ "update": "npx npm-check-updates -u && npm update"
19
+ },
20
+ "dependencies": {
21
+ "@google-cloud/bigquery": "^7.8.0",
22
+ "@walkeros/server-core": "0.0.7"
23
+ },
24
+ "devDependencies": {},
25
+ "repository": {
26
+ "url": "git+https://github.com/elbwalker/walkerOS.git",
27
+ "directory": "packages/server/destinations/gcp"
28
+ },
29
+ "author": "elbwalker <hello@elbwalker.com>",
30
+ "homepage": "https://github.com/elbwalker/walkerOS#readme",
31
+ "bugs": {
32
+ "url": "https://github.com/elbwalker/walkerOS/issues"
33
+ },
34
+ "keywords": [
35
+ "walker",
36
+ "walkerOS",
37
+ "destination",
38
+ "server",
39
+ "gcp",
40
+ "bigquery"
41
+ ],
42
+ "funding": [
43
+ {
44
+ "type": "GitHub Sponsors",
45
+ "url": "https://github.com/sponsors/elbwalker"
46
+ }
47
+ ]
48
+ }