@walkeros/server-destination-gcp 4.9.0-next-1793116456867 → 4.9.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/CHANGELOG.md +9 -3
- package/dist/dev.js +1 -1
- package/dist/dev.js.map +1 -1
- package/dist/dev.mjs +1 -1
- package/dist/dev.mjs.map +1 -1
- package/dist/walkerOS.json +21 -116
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @walkeros/server-destination-gcp
|
|
2
2
|
|
|
3
|
-
## 4.9.0
|
|
3
|
+
## 4.9.0
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
@@ -15,16 +15,22 @@
|
|
|
15
15
|
credentials taken from the Google environment. The docs page renders the
|
|
16
16
|
install line, the integrated code and the flow from it, and the package test
|
|
17
17
|
runs the same settings.
|
|
18
|
+
- Updated dependencies [a67546d]
|
|
19
|
+
- Updated dependencies [1306d8a]
|
|
18
20
|
- Updated dependencies [34fd225]
|
|
19
21
|
- Updated dependencies [5313635]
|
|
22
|
+
- Updated dependencies [1306d8a]
|
|
23
|
+
- Updated dependencies [fa46337]
|
|
20
24
|
- Updated dependencies [5313635]
|
|
21
25
|
- Updated dependencies [5313635]
|
|
22
26
|
- Updated dependencies [5313635]
|
|
23
27
|
- Updated dependencies [5313635]
|
|
24
28
|
- Updated dependencies [34fd225]
|
|
29
|
+
- Updated dependencies [fa46337]
|
|
30
|
+
- Updated dependencies [1306d8a]
|
|
25
31
|
- Updated dependencies [5313635]
|
|
26
|
-
- @walkeros/core@4.9.0
|
|
27
|
-
- @walkeros/server-core@4.9.0
|
|
32
|
+
- @walkeros/core@4.9.0
|
|
33
|
+
- @walkeros/server-core@4.9.0
|
|
28
34
|
|
|
29
35
|
## 4.8.2
|
|
30
36
|
|
package/dist/dev.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,a=(e,r)=>{for(var s in r)t(e,s,{get:r[s],enumerable:!0})},o={};a(o,{examples:()=>n,exportExamples:()=>be,exportSchemas:()=>ye,hints:()=>he,pubsubExamples:()=>N,schemas:()=>me}),module.exports=(e=o,((e,a,o,n)=>{if(a&&"object"==typeof a||"function"==typeof a)for(let l of s(a))i.call(e,l)||l===o||t(e,l,{get:()=>a[l],enumerable:!(n=r(a,l))||n.enumerable});return e})(t({},"__esModule",{value:!0}),e));var n={};a(n,{env:()=>l,minimal:()=>D,step:()=>O});var l={};a(l,{push:()=>S,simulation:()=>k});var c=require("events"),u=[],p=null,d=null,g=null,m=null,h=null,b=class extends c.EventEmitter{streamId;constructor(e){super(),this.streamId=e}getStreamId(){return this.streamId}onConnectionError(e){return u.push({method:"onConnectionError",args:[]}),this.on("error",e),{off:()=>{this.off("error",e)}}}__emitConnectionError(e){this.emit("error",e)}},y=[],v={convertStorageSchemaToProto2Descriptor:(e,t)=>(u.push({method:"adapt.convertStorageSchemaToProto2Descriptor",args:[e,t]}),{name:"root",field:[]})},f=class{constructor(e){u.push({method:"WriterClient.ctor",args:[e]})}async createStreamConnection(e,t){if("DEFAULT"!==e.streamId)throw new Error(`mock createStreamConnection: expected streamId='DEFAULT', got ${JSON.stringify(e)}`);u.push({method:"createStreamConnection",args:[e,t]});const r=h;if(null!==r)throw h=null,r;const s=new b(`${e.destinationTable}/streams/_default`);return y.push(s),s}async getWriteStream(e,t){return u.push({method:"getWriteStream",args:[e,t]}),{tableSchema:{fields:[]}}}close(){u.push({method:"WriterClient.close",args:[]})}},w=class{constructor(e){u.push({method:"JSONWriter.ctor",args:[e]})}appendRows(e,t){u.push({method:"appendRows",args:[e,t]});const r=d;if(null!==r)throw d=null,r;const s=p;p=null;const i=g;g=null;const a=m;return m=null,{getResult:async()=>{if(null!==i)throw i;return null!==a?{error:a,writeStream:"projects/p/datasets/d/tables/t/streams/_default"}:{appendResult:{offset:{value:"0"}},rowErrors:s??[],writeStream:"projects/p/datasets/d/tables/t/streams/_default"}}}}close(){u.push({method:"JSONWriter.close",args:[]})}};var S={get BigQuery(){return class{calls;options;constructor(e){this.options=e,this.calls=[]}dataset(e){return this.calls.push({method:"dataset",args:[e]}),this}table(e){return this.calls.push({method:"table",args:[e]}),this}async exists(){return this.calls.push({method:"exists",args:[]}),[!0]}async create(e){this.calls.push({method:"create",args:[e]})}async getMetadata(){return this.calls.push({method:"getMetadata",args:[]}),[{}]}}},get WriterClient(){return f},get JSONWriter(){return w},get adapt(){return v}},k=["call:JSONWriter.appendRows"],O={};a(O,{appendFailed:()=>C,pageView:()=>z,purchase:()=>T,silentRule:()=>I});var j=require("@walkeros/core");function E(e){return null==e?null:"object"==typeof e?Array.isArray(e)&&0===e.length?null:Array.isArray(e)||0!==Object.keys(e).length?JSON.stringify(e):null:JSON.stringify(e)}function P(e){return function(e){return{name:e.name,data:E(e.data),context:E(e.context),globals:E(e.globals),custom:E(e.custom),user:E(e.user),nested:E(e.nested),consent:E(e.consent),id:e.id,trigger:e.trigger,entity:e.entity,action:e.action,timestamp:1e3*new Date(e.timestamp).getTime(),timing:e.timing,source:E(e.source)}}(e)}var A=(0,j.getEvent)("page view",{timestamp:17000011e5,data:{title:"Documentation",url:"https://example.com/docs"},source:{type:"express",platform:"server"}}),z={title:"Page view",description:"A page view is appended as one row through the BigQuery Storage Write API JSONWriter. Nested objects/arrays in data, source, etc. are JSON-stringified by eventToRow.",in:A,mapping:void 0,out:[["appendRows",[P(A)]]]},R=(0,j.getEvent)("order complete",{timestamp:1700001101e3,data:{id:"ORD-500",value:199.99,items:[{sku:"SKU-1",qty:2}]},source:{type:"express",platform:"server"}}),T={title:"Purchase",description:"An order event is appended as a single row through JSONWriter.appendRows. The entire nested data object (including arrays like items) is JSON-stringified into the data column via eventToRow().",in:R,mapping:void 0,out:[["appendRows",[P(R)]]]},I={public:!1,description:"A rule with silent: true appends no row.",in:(0,j.getEvent)("page view",{timestamp:1700000000500}),mapping:{silent:!0},out:[]},C={public:!1,description:"A failed Storage Write append fails the push, retryable, instead of counting as delivered.",in:(0,j.getEvent)("page view",{timestamp:1700001102e3}),respond:{error:"network"},out:[["appendRows",[P((0,j.getEvent)("page view",{timestamp:1700001102e3}))]]],outcome:{status:"failed",code:"transport",retryable:!0}},D={settings:{projectId:"YOUR_PROJECT_ID"}},N={};a(N,{env:()=>x,minimal:()=>X,step:()=>q});var x={};a(x,{push:()=>_,simulation:()=>J});var M=class{constructor(e){this.name=e}name;publishMessage(e){return Promise.resolve("mock-message-id")}resumePublishing(e){}},_={PubSub:class{constructor(e){this.options=e}options;topic(e){return new M(e)}close(){return Promise.resolve()}}},J=["call:PubSub.topic.publishMessage"],q={};a(q,{defaultPush:()=>K,mappedAttributes:()=>L,mappedData:()=>$,mappedOrderingKey:()=>G,mappedTopic:()=>F,pageView:()=>Y,silentRule:()=>V});var B=require("@walkeros/core"),U=(0,B.getEvent)("order complete",{timestamp:17000011e5,data:{id:"ORD-500",value:199.99,currency:"EUR"},user:{id:"usr-789"},source:{type:"express",platform:"server",trace:"1a2b3c4d5e6f70819a2b3c4d5e6f7081",count:1}}),W=(0,B.getEvent)("page view",{timestamp:1700001101e3,data:{title:"Documentation",url:"https://example.com/docs"},source:{type:"express",platform:"server",trace:"9f8e7d6c5b4a39281706f5e4d3c2b1a0",count:1}});function Q(e){const t=e.source.platform??"default",r={...e,source:{...e.source,release:{[t]:"4.9.0-next-1793116456867"}}};return Buffer.from(JSON.stringify(r))}var K={title:"Default publish",description:"An event is published to the configured Pub/Sub topic with the full JSON event as the message body and no ordering key.",in:U,out:[["topic","events",{messageOrdering:!1}],["publishMessage","events",{data:Q(U)}]]},F={title:"Topic override",description:"A mapping rule overrides the destination default topic so order events are published to a dedicated topic.",in:U,mapping:{settings:{topic:"orders"}},out:[["topic","orders",{messageOrdering:!1}],["publishMessage","orders",{data:Q(U)}]]},G={title:"Ordering key from user",description:"A mapping resolves the ordering key from event.user.id, enabling per-user ordering for this publish.",in:U,mapping:{settings:{orderingKey:"user.id"}},out:[["topic","events",{messageOrdering:!0}],["publishMessage","events",{data:Q(U),orderingKey:"usr-789"}]]},L={title:"Mapped attributes",description:"A mapping resolves a per-event attribute map, here exposing entity and action as Pub/Sub attributes for routing in subscribers.",in:U,mapping:{settings:{attributes:{entity:"entity",action:"action"}}},out:[["topic","events",{messageOrdering:!1}],["publishMessage","events",{data:Q(U),attributes:{entity:"order",action:"complete"}}]]},$={title:"Mapped payload",description:"A data mapping transforms the event payload before publish. The rewritten object becomes the Pub/Sub message body.",in:U,mapping:{data:{map:{order_id:"data.id",revenue:"data.value",currency:"data.currency"}}},out:[["topic","events",{messageOrdering:!1}],["publishMessage","events",{data:Buffer.from(JSON.stringify({order_id:"ORD-500",revenue:199.99,currency:"EUR"}))}]]},Y={title:"Page view",description:"A page view is published to the default topic with no ordering key, demonstrating the simplest publish path.",in:W,out:[["topic","events",{messageOrdering:!1}],["publishMessage","events",{data:Q(W)}]]},V={public:!1,description:"A rule with silent: true publishes no message.",in:(0,B.getEvent)("page view",{timestamp:1700000000500}),mapping:{silent:!0},out:[]},X={settings:{projectId:"YOUR_PROJECT_ID",topic:"events"}},H=require("@walkeros/core/dev"),Z=require("@walkeros/core/dev"),ee=Z.z.object({client:Z.z.any().describe("Google Cloud BigQuery client instance (like new BigQuery({ projectId, keyFilename })). Used by walkeros setup only; event writes authenticate with config.credentials, settings.bigquery or the default credentials.").optional(),projectId:Z.z.string().min(1).describe("Google Cloud Project ID (like my-gcp-project)"),datasetId:Z.z.string().min(1).default("walkerOS").describe("BigQuery dataset ID where events will be stored (like walker_events)"),tableId:Z.z.string().min(1).default("events").describe("BigQuery table ID for event storage (like events)"),location:Z.z.string().default("EU").describe("Not read by the destination. walkeros setup creates the dataset in config.setup.location (like US), default EU."),bigquery:Z.z.any().describe('Additional BigQuery client configuration options (like { keyFilename: "path/to/key.json" })').optional()}).strict(),te=require("@walkeros/core/dev").z.object({}),re=(0,H.zodToSchema)(ee),se=(0,H.zodToSchema)(te),ie=require("@walkeros/core/dev"),ae=require("@walkeros/core/dev"),oe=ae.z.object({client:ae.z.any().describe("Google Cloud Pub/Sub client instance (like new PubSub({ projectId, keyFilename }))").optional(),projectId:ae.z.string().min(1).describe("Google Cloud Project ID (like my-gcp-project)"),topic:ae.z.string().min(1).describe("Pub/Sub topic short name (like events). The full resource name projects/<projectId>/topics/<topic> is built by the SDK."),credentials:ae.z.any().describe("Service account credentials as a JSON string or an object with client_email and private_key. Default: Application Default Credentials (ADC). (deprecated: use config.credentials)").optional(),apiEndpoint:ae.z.string().describe("Override Pub/Sub API endpoint. Useful for the local emulator (like localhost:8085).").optional(),orderingKey:ae.z.any().describe("Mapping value resolved per-event. Truthy enables per-key ordering for the publish.").optional(),attributes:ae.z.any().describe("Default per-event attribute map merged into every published message. Mapping.Map shape.").optional()}).strict(),ne=require("@walkeros/core/dev"),le=ne.z.object({topic:ne.z.string().describe("Per-rule topic override. Falls back to settings.topic if absent.").optional(),orderingKey:ne.z.any().describe("Per-rule ordering-key Mapping.Value. Overrides settings.orderingKey when set.").optional(),attributes:ne.z.any().describe("Per-rule attribute Mapping.Map merged on top of settings.attributes.").optional()}),ce=require("@walkeros/core/dev"),ue=ce.z.object({messageStoragePolicy:ce.z.object({allowedPersistenceRegions:ce.z.array(ce.z.string()).describe("Geographic regions for at-rest message storage (like europe-west1). Default: europe-west1, europe-west3 and europe-west4.")}).describe("Topic-level message storage policy.").optional(),messageRetentionDuration:ce.z.object({seconds:ce.z.number().describe("Retention window in seconds. Default: project default.")}).describe("Topic-level retention configuration.").optional(),kmsKeyName:ce.z.string().describe("Customer-managed encryption key (CMEK) resource name. Optional.").optional(),labels:ce.z.record(ce.z.string(),ce.z.string()).describe("Topic labels for organization and billing.").optional()}),pe=(0,ie.zodToSchema)(oe),de=(0,ie.zodToSchema)(le),ge=(0,ie.zodToSchema)(ue),me={};a(me,{mapping:()=>se,pubsubMapping:()=>de,pubsubSettings:()=>pe,pubsubSetup:()=>ge,settings:()=>re});var he={"auth-methods":{text:'BigQuery authenticates three ways. config.credentials: a service account key as a JSON string or object, backed by $secret, used by walkeros setup and by event writes. settings.bigquery: raw client options such as { keyFilename: "./sa.json" }, passed to both clients. Neither set: Application Default Credentials (the attached service account on GCP compute, GOOGLE_APPLICATION_CREDENTIALS elsewhere). A pre-built settings.client is used by walkeros setup only, never for event writes.',code:[{lang:"json",code:'{ "settings": { "projectId": "my-project" }, "credentials": "$secret.BIGQUERY_SA_KEY" }'},{lang:"json",code:'{ "settings": { "projectId": "my-project" } }'}]},"storage-format":{text:'All events go to one table, by default dataset "walkerOS" and table "events" (settings.datasetId, settings.tableId). Each event is one row of 15 columns: name, id, trigger, entity and action as strings, timestamp as a TIMESTAMP, timing as a number, and the object fields (data, context, globals, custom, user, nested, consent, source) as JSON. walkeros setup creates the dataset in config.setup.location (default EU) and the table, partitioned by day on timestamp.'},"query-json-columns":{text:"The object fields (data, context, globals, user and the others) are JSON columns in the default table. Query them with BigQuery JSON functions such as JSON_EXTRACT_SCALAR; paths follow the walkerOS event structure.",code:[{lang:"sql",code:"SELECT JSON_EXTRACT_SCALAR(data, '$.value') AS value FROM `project.walkerOS.events` WHERE entity = 'order'"}]},"troubleshoot-empty-table":{text:"Events not appearing? The collector logs the first failed write of each cause as an ERROR line and counts repeats within a minute in status.destinations.<id>.failed. Common causes: the dataset or table does not exist (set config.setup: true and run walkeros setup destination.<id> once; without config.setup the command skips), projectId names another project, or the service account lacks roles/bigquery.dataEditor. projectId is checked when the destination starts; the table is opened at the first event."}},be={destinationBigQuery:n,destinationPubSub:N},ye={destinationBigQuery:{settings:re,mapping:se},destinationPubSub:{settings:pe,mapping:de,setup:ge}};//# sourceMappingURL=dev.js.map
|
|
1
|
+
"use strict";var e,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,a=(e,r)=>{for(var s in r)t(e,s,{get:r[s],enumerable:!0})},o={};a(o,{examples:()=>n,exportExamples:()=>be,exportSchemas:()=>ye,hints:()=>he,pubsubExamples:()=>N,schemas:()=>me}),module.exports=(e=o,((e,a,o,n)=>{if(a&&"object"==typeof a||"function"==typeof a)for(let l of s(a))i.call(e,l)||l===o||t(e,l,{get:()=>a[l],enumerable:!(n=r(a,l))||n.enumerable});return e})(t({},"__esModule",{value:!0}),e));var n={};a(n,{env:()=>l,minimal:()=>D,step:()=>O});var l={};a(l,{push:()=>S,simulation:()=>k});var c=require("events"),u=[],p=null,d=null,g=null,m=null,h=null,b=class extends c.EventEmitter{streamId;constructor(e){super(),this.streamId=e}getStreamId(){return this.streamId}onConnectionError(e){return u.push({method:"onConnectionError",args:[]}),this.on("error",e),{off:()=>{this.off("error",e)}}}__emitConnectionError(e){this.emit("error",e)}},y=[],v={convertStorageSchemaToProto2Descriptor:(e,t)=>(u.push({method:"adapt.convertStorageSchemaToProto2Descriptor",args:[e,t]}),{name:"root",field:[]})},f=class{constructor(e){u.push({method:"WriterClient.ctor",args:[e]})}async createStreamConnection(e,t){if("DEFAULT"!==e.streamId)throw new Error(`mock createStreamConnection: expected streamId='DEFAULT', got ${JSON.stringify(e)}`);u.push({method:"createStreamConnection",args:[e,t]});const r=h;if(null!==r)throw h=null,r;const s=new b(`${e.destinationTable}/streams/_default`);return y.push(s),s}async getWriteStream(e,t){return u.push({method:"getWriteStream",args:[e,t]}),{tableSchema:{fields:[]}}}close(){u.push({method:"WriterClient.close",args:[]})}},w=class{constructor(e){u.push({method:"JSONWriter.ctor",args:[e]})}appendRows(e,t){u.push({method:"appendRows",args:[e,t]});const r=d;if(null!==r)throw d=null,r;const s=p;p=null;const i=g;g=null;const a=m;return m=null,{getResult:async()=>{if(null!==i)throw i;return null!==a?{error:a,writeStream:"projects/p/datasets/d/tables/t/streams/_default"}:{appendResult:{offset:{value:"0"}},rowErrors:s??[],writeStream:"projects/p/datasets/d/tables/t/streams/_default"}}}}close(){u.push({method:"JSONWriter.close",args:[]})}};var S={get BigQuery(){return class{calls;options;constructor(e){this.options=e,this.calls=[]}dataset(e){return this.calls.push({method:"dataset",args:[e]}),this}table(e){return this.calls.push({method:"table",args:[e]}),this}async exists(){return this.calls.push({method:"exists",args:[]}),[!0]}async create(e){this.calls.push({method:"create",args:[e]})}async getMetadata(){return this.calls.push({method:"getMetadata",args:[]}),[{}]}}},get WriterClient(){return f},get JSONWriter(){return w},get adapt(){return v}},k=["call:JSONWriter.appendRows"],O={};a(O,{appendFailed:()=>C,pageView:()=>z,purchase:()=>T,silentRule:()=>I});var j=require("@walkeros/core");function E(e){return null==e?null:"object"==typeof e?Array.isArray(e)&&0===e.length?null:Array.isArray(e)||0!==Object.keys(e).length?JSON.stringify(e):null:JSON.stringify(e)}function P(e){return function(e){return{name:e.name,data:E(e.data),context:E(e.context),globals:E(e.globals),custom:E(e.custom),user:E(e.user),nested:E(e.nested),consent:E(e.consent),id:e.id,trigger:e.trigger,entity:e.entity,action:e.action,timestamp:1e3*new Date(e.timestamp).getTime(),timing:e.timing,source:E(e.source)}}(e)}var A=(0,j.getEvent)("page view",{timestamp:17000011e5,data:{title:"Documentation",url:"https://example.com/docs"},source:{type:"express",platform:"server"}}),z={title:"Page view",description:"A page view is appended as one row through the BigQuery Storage Write API JSONWriter. Nested objects/arrays in data, source, etc. are JSON-stringified by eventToRow.",in:A,mapping:void 0,out:[["appendRows",[P(A)]]]},R=(0,j.getEvent)("order complete",{timestamp:1700001101e3,data:{id:"ORD-500",value:199.99,items:[{sku:"SKU-1",qty:2}]},source:{type:"express",platform:"server"}}),T={title:"Purchase",description:"An order event is appended as a single row through JSONWriter.appendRows. The entire nested data object (including arrays like items) is JSON-stringified into the data column via eventToRow().",in:R,mapping:void 0,out:[["appendRows",[P(R)]]]},I={public:!1,description:"A rule with silent: true appends no row.",in:(0,j.getEvent)("page view",{timestamp:1700000000500}),mapping:{silent:!0},out:[]},C={public:!1,description:"A failed Storage Write append fails the push, retryable, instead of counting as delivered.",in:(0,j.getEvent)("page view",{timestamp:1700001102e3}),respond:{error:"network"},out:[["appendRows",[P((0,j.getEvent)("page view",{timestamp:1700001102e3}))]]],outcome:{status:"failed",code:"transport",retryable:!0}},D={settings:{projectId:"YOUR_PROJECT_ID"}},N={};a(N,{env:()=>x,minimal:()=>X,step:()=>q});var x={};a(x,{push:()=>_,simulation:()=>J});var M=class{constructor(e){this.name=e}name;publishMessage(e){return Promise.resolve("mock-message-id")}resumePublishing(e){}},_={PubSub:class{constructor(e){this.options=e}options;topic(e){return new M(e)}close(){return Promise.resolve()}}},J=["call:PubSub.topic.publishMessage"],q={};a(q,{defaultPush:()=>K,mappedAttributes:()=>L,mappedData:()=>$,mappedOrderingKey:()=>G,mappedTopic:()=>F,pageView:()=>Y,silentRule:()=>V});var B=require("@walkeros/core"),U=(0,B.getEvent)("order complete",{timestamp:17000011e5,data:{id:"ORD-500",value:199.99,currency:"EUR"},user:{id:"usr-789"},source:{type:"express",platform:"server",trace:"1a2b3c4d5e6f70819a2b3c4d5e6f7081",count:1}}),W=(0,B.getEvent)("page view",{timestamp:1700001101e3,data:{title:"Documentation",url:"https://example.com/docs"},source:{type:"express",platform:"server",trace:"9f8e7d6c5b4a39281706f5e4d3c2b1a0",count:1}});function Q(e){const t=e.source.platform??"default",r={...e,source:{...e.source,release:{[t]:"4.9.0"}}};return Buffer.from(JSON.stringify(r))}var K={title:"Default publish",description:"An event is published to the configured Pub/Sub topic with the full JSON event as the message body and no ordering key.",in:U,out:[["topic","events",{messageOrdering:!1}],["publishMessage","events",{data:Q(U)}]]},F={title:"Topic override",description:"A mapping rule overrides the destination default topic so order events are published to a dedicated topic.",in:U,mapping:{settings:{topic:"orders"}},out:[["topic","orders",{messageOrdering:!1}],["publishMessage","orders",{data:Q(U)}]]},G={title:"Ordering key from user",description:"A mapping resolves the ordering key from event.user.id, enabling per-user ordering for this publish.",in:U,mapping:{settings:{orderingKey:"user.id"}},out:[["topic","events",{messageOrdering:!0}],["publishMessage","events",{data:Q(U),orderingKey:"usr-789"}]]},L={title:"Mapped attributes",description:"A mapping resolves a per-event attribute map, here exposing entity and action as Pub/Sub attributes for routing in subscribers.",in:U,mapping:{settings:{attributes:{entity:"entity",action:"action"}}},out:[["topic","events",{messageOrdering:!1}],["publishMessage","events",{data:Q(U),attributes:{entity:"order",action:"complete"}}]]},$={title:"Mapped payload",description:"A data mapping transforms the event payload before publish. The rewritten object becomes the Pub/Sub message body.",in:U,mapping:{data:{map:{order_id:"data.id",revenue:"data.value",currency:"data.currency"}}},out:[["topic","events",{messageOrdering:!1}],["publishMessage","events",{data:Buffer.from(JSON.stringify({order_id:"ORD-500",revenue:199.99,currency:"EUR"}))}]]},Y={title:"Page view",description:"A page view is published to the default topic with no ordering key, demonstrating the simplest publish path.",in:W,out:[["topic","events",{messageOrdering:!1}],["publishMessage","events",{data:Q(W)}]]},V={public:!1,description:"A rule with silent: true publishes no message.",in:(0,B.getEvent)("page view",{timestamp:1700000000500}),mapping:{silent:!0},out:[]},X={settings:{projectId:"YOUR_PROJECT_ID",topic:"events"}},H=require("@walkeros/core/dev"),Z=require("@walkeros/core/dev"),ee=Z.z.object({client:Z.z.any().describe("Google Cloud BigQuery client instance (like new BigQuery({ projectId, keyFilename })). Used by walkeros setup only; event writes authenticate with config.credentials, settings.bigquery or the default credentials.").optional(),projectId:Z.z.string().min(1).describe("Google Cloud Project ID (like my-gcp-project)"),datasetId:Z.z.string().min(1).default("walkerOS").describe("BigQuery dataset ID where events will be stored (like walker_events)"),tableId:Z.z.string().min(1).default("events").describe("BigQuery table ID for event storage (like events)"),location:Z.z.string().default("EU").describe("Not read by the destination. walkeros setup creates the dataset in config.setup.location (like US), default EU."),bigquery:Z.z.any().describe('Additional BigQuery client configuration options (like { keyFilename: "path/to/key.json" })').optional()}).strict(),te=require("@walkeros/core/dev").z.object({}),re=(0,H.zodToSchema)(ee),se=(0,H.zodToSchema)(te),ie=require("@walkeros/core/dev"),ae=require("@walkeros/core/dev"),oe=ae.z.object({client:ae.z.any().describe("Google Cloud Pub/Sub client instance (like new PubSub({ projectId, keyFilename }))").optional(),projectId:ae.z.string().min(1).describe("Google Cloud Project ID (like my-gcp-project)"),topic:ae.z.string().min(1).describe("Pub/Sub topic short name (like events). The full resource name projects/<projectId>/topics/<topic> is built by the SDK."),credentials:ae.z.any().describe("Service account credentials as a JSON string or an object with client_email and private_key. Default: Application Default Credentials (ADC). (deprecated: use config.credentials)").optional(),apiEndpoint:ae.z.string().describe("Override Pub/Sub API endpoint. Useful for the local emulator (like localhost:8085).").optional(),orderingKey:ae.z.any().describe("Mapping value resolved per-event. Truthy enables per-key ordering for the publish.").optional(),attributes:ae.z.any().describe("Default per-event attribute map merged into every published message. Mapping.Map shape.").optional()}).strict(),ne=require("@walkeros/core/dev"),le=ne.z.object({topic:ne.z.string().describe("Per-rule topic override. Falls back to settings.topic if absent.").optional(),orderingKey:ne.z.any().describe("Per-rule ordering-key Mapping.Value. Overrides settings.orderingKey when set.").optional(),attributes:ne.z.any().describe("Per-rule attribute Mapping.Map merged on top of settings.attributes.").optional()}),ce=require("@walkeros/core/dev"),ue=ce.z.object({messageStoragePolicy:ce.z.object({allowedPersistenceRegions:ce.z.array(ce.z.string()).describe("Geographic regions for at-rest message storage (like europe-west1). Default: europe-west1, europe-west3 and europe-west4.")}).describe("Topic-level message storage policy.").optional(),messageRetentionDuration:ce.z.object({seconds:ce.z.number().describe("Retention window in seconds. Default: project default.")}).describe("Topic-level retention configuration.").optional(),kmsKeyName:ce.z.string().describe("Customer-managed encryption key (CMEK) resource name. Optional.").optional(),labels:ce.z.record(ce.z.string(),ce.z.string()).describe("Topic labels for organization and billing.").optional()}),pe=(0,ie.zodToSchema)(oe),de=(0,ie.zodToSchema)(le),ge=(0,ie.zodToSchema)(ue),me={};a(me,{mapping:()=>se,pubsubMapping:()=>de,pubsubSettings:()=>pe,pubsubSetup:()=>ge,settings:()=>re});var he={"auth-methods":{text:'BigQuery authenticates three ways. config.credentials: a service account key as a JSON string or object, backed by $secret, used by walkeros setup and by event writes. settings.bigquery: raw client options such as { keyFilename: "./sa.json" }, passed to both clients. Neither set: Application Default Credentials (the attached service account on GCP compute, GOOGLE_APPLICATION_CREDENTIALS elsewhere). A pre-built settings.client is used by walkeros setup only, never for event writes.',code:[{lang:"json",code:'{ "settings": { "projectId": "my-project" }, "credentials": "$secret.BIGQUERY_SA_KEY" }'},{lang:"json",code:'{ "settings": { "projectId": "my-project" } }'}]},"storage-format":{text:'All events go to one table, by default dataset "walkerOS" and table "events" (settings.datasetId, settings.tableId). Each event is one row of 15 columns: name, id, trigger, entity and action as strings, timestamp as a TIMESTAMP, timing as a number, and the object fields (data, context, globals, custom, user, nested, consent, source) as JSON. walkeros setup creates the dataset in config.setup.location (default EU) and the table, partitioned by day on timestamp.'},"query-json-columns":{text:"The object fields (data, context, globals, user and the others) are JSON columns in the default table. Query them with BigQuery JSON functions such as JSON_EXTRACT_SCALAR; paths follow the walkerOS event structure.",code:[{lang:"sql",code:"SELECT JSON_EXTRACT_SCALAR(data, '$.value') AS value FROM `project.walkerOS.events` WHERE entity = 'order'"}]},"troubleshoot-empty-table":{text:"Events not appearing? The collector logs the first failed write of each cause as an ERROR line and counts repeats within a minute in status.destinations.<id>.failed. Common causes: the dataset or table does not exist (set config.setup: true and run walkeros setup destination.<id> once; without config.setup the command skips), projectId names another project, or the service account lacks roles/bigquery.dataEditor. projectId is checked when the destination starts; the table is opened at the first event."}},be={destinationBigQuery:n,destinationPubSub:N},ye={destinationBigQuery:{settings:re,mapping:se},destinationPubSub:{settings:pe,mapping:de,setup:ge}};//# sourceMappingURL=dev.js.map
|
package/dist/dev.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/dev.ts","../src/bigquery/examples/index.ts","../src/bigquery/examples/env.ts","../src/bigquery/__mocks__/@google-cloud/bigquery-storage.ts","../src/bigquery/examples/step.ts","../src/bigquery/eventToRow.ts","../src/bigquery/examples/minimal.ts","../src/pubsub/examples/index.ts","../src/pubsub/examples/env.ts","../src/pubsub/examples/step.ts","../src/pubsub/examples/minimal.ts","../src/bigquery/schemas/index.ts","../src/bigquery/schemas/settings.ts","../src/bigquery/schemas/mapping.ts","../src/pubsub/schemas/index.ts","../src/pubsub/schemas/settings.ts","../src/pubsub/schemas/mapping.ts","../src/pubsub/schemas/setup.ts","../src/schemas.ts","../src/hints.ts"],"sourcesContent":["import * as bigqueryExamplesNs from './bigquery/examples';\nimport * as pubsubExamplesNs from './pubsub/examples';\nimport * as bigquerySchemasNs from './bigquery/schemas';\nimport * as pubsubSchemasNs from './pubsub/schemas';\n\nexport * as schemas from './schemas';\nexport * as examples from './bigquery/examples';\nexport * as pubsubExamples from './pubsub/examples';\nexport { hints } from './hints';\n\n/** Dev examples per export, keyed by the export names in package.json. */\nexport const exportExamples = {\n destinationBigQuery: bigqueryExamplesNs,\n destinationPubSub: pubsubExamplesNs,\n};\n\n/** Schemas per export, keyed by the export names in package.json. */\nexport const exportSchemas = {\n destinationBigQuery: {\n settings: bigquerySchemasNs.settings,\n mapping: bigquerySchemasNs.mapping,\n },\n destinationPubSub: {\n settings: pubsubSchemasNs.settings,\n mapping: pubsubSchemasNs.mapping,\n setup: pubsubSchemasNs.setup,\n },\n};\n","export * as env from './env';\nexport * as step from './step';\nexport { minimal } from './minimal';\n","import type { Env, QueryClient, TableMetadataShape } from '../types';\nimport {\n managedwriter as mockManagedwriter,\n adapt as mockAdapt,\n} from '../__mocks__/@google-cloud/bigquery-storage';\n\n/**\n * Example environment configurations for GCP BigQuery destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring actual BigQuery SDK dependencies.\n *\n * The Storage Write API mocks (WriterClient, JSONWriter, adapt) are\n * re-exported from the package-local __mocks__ folder so example/test\n * code shares a single source of truth with the jest auto-mock.\n */\n\n/**\n * Mock BigQuery query client: dataset and table provisioning calls resolve as\n * if both already exist.\n */\nfunction createMockBigQuery() {\n return class MockBigQuery implements QueryClient {\n calls: Array<{ method: string; args: unknown[] }>;\n options: unknown;\n\n constructor(options?: unknown) {\n this.options = options;\n this.calls = [];\n }\n\n dataset(datasetId: string) {\n this.calls.push({ method: 'dataset', args: [datasetId] });\n return this;\n }\n\n table(tableId: string) {\n this.calls.push({ method: 'table', args: [tableId] });\n return this;\n }\n\n async exists(): Promise<[boolean]> {\n this.calls.push({ method: 'exists', args: [] });\n return [true];\n }\n\n async create(options: unknown): Promise<void> {\n this.calls.push({ method: 'create', args: [options] });\n }\n\n async getMetadata(): Promise<[TableMetadataShape]> {\n this.calls.push({ method: 'getMetadata', args: [] });\n return [{}];\n }\n };\n}\n\n/**\n * Standard mock environment for push operations\n *\n * Use this for testing BigQuery Storage Write appends without connecting\n * to actual GCP infrastructure.\n */\nexport const push: Env = {\n get BigQuery() {\n return createMockBigQuery();\n },\n get WriterClient() {\n return mockManagedwriter.WriterClient;\n },\n get JSONWriter() {\n return mockManagedwriter.JSONWriter;\n },\n get adapt() {\n return mockAdapt;\n },\n};\n\n/**\n * Every row goes through the writer's `appendRows`; the writer is built from\n * `JSONWriter` in init, so the path continues on the constructed instance.\n * Constructors are not recorded: their arguments carry credentials.\n */\nexport const simulation = ['call:JSONWriter.appendRows'];\n","import { EventEmitter } from 'events';\n\nconst calls: Array<{ method: string; args: unknown[] }> = [];\n\ninterface MockRowError {\n index: number;\n code: number;\n message: string;\n}\n\nlet nextAppendRowErrors: MockRowError[] | null = null;\nlet nextAppendThrow: unknown = null;\nlet nextGetResultReject: unknown = null;\nlet nextAppendStatus: { code: number; message: string } | null = null;\nlet nextCreateStreamConnectionError: unknown = null;\n\n/**\n * Honest stand-in for the SDK's StreamConnection: a REAL Node EventEmitter so\n * `emit('error', …)` with no listener throws exactly like the real one (Node's\n * special-cased `'error'` event). `onConnectionError` mirrors the SDK surface:\n * it registers an `'error'` listener and returns an `{ off }` disposable.\n */\nclass MockStreamConnection extends EventEmitter {\n private readonly streamId: string;\n constructor(streamId: string) {\n super();\n this.streamId = streamId;\n }\n getStreamId(): string {\n return this.streamId;\n }\n onConnectionError(listener: (err: unknown) => void): { off: () => void } {\n calls.push({ method: 'onConnectionError', args: [] });\n this.on('error', listener);\n return {\n off: () => {\n this.off('error', listener);\n },\n };\n }\n /**\n * Test-only: literally `this.emit('error', err)` with NO internal\n * listener-count guard, so before a listener is attached this reproduces\n * Node's real \"throw if no 'error' listener\" behavior. A fake that silently\n * swallowed would mask the very crash this listener exists to contain.\n */\n __emitConnectionError(err: unknown): void {\n this.emit('error', err);\n }\n}\n\n// The most recently created connection, so tests can emit on it and assert the\n// listener was registered.\nlet lastConnection: MockStreamConnection | null = null;\n\n// Every connection ever created (this reset cycle), so tests can assert that a\n// concurrent re-open did not orphan a connection still carrying an 'error'\n// listener.\nconst allConnections: MockStreamConnection[] = [];\n\nclass MockJSONWriter {\n constructor(_args: { connection: unknown; protoDescriptor: unknown }) {\n calls.push({ method: 'JSONWriter.ctor', args: [_args] });\n }\n appendRows(rows: unknown[], offsetValue?: unknown) {\n calls.push({ method: 'appendRows', args: [rows, offsetValue] });\n const queuedThrow = nextAppendThrow;\n if (queuedThrow !== null) {\n nextAppendThrow = null;\n throw queuedThrow;\n }\n const queuedErrors = nextAppendRowErrors;\n nextAppendRowErrors = null;\n const queuedReject = nextGetResultReject;\n nextGetResultReject = null;\n const queuedStatus = nextAppendStatus;\n nextAppendStatus = null;\n return {\n getResult: async () => {\n // Models a gRPC deadline-exceeded (or any stream error): the append is\n // accepted but getResult() rejects when the stream's deadline fires.\n if (queuedReject !== null) throw queuedReject;\n // An error status the SDK does not retry resolves with `error` set\n // and no rowErrors.\n if (queuedStatus !== null)\n return {\n error: queuedStatus,\n writeStream: 'projects/p/datasets/d/tables/t/streams/_default',\n };\n return {\n appendResult: { offset: { value: '0' } },\n rowErrors: queuedErrors ?? [],\n writeStream: 'projects/p/datasets/d/tables/t/streams/_default',\n };\n },\n };\n }\n close(): void {\n calls.push({ method: 'JSONWriter.close', args: [] });\n }\n}\n\nclass MockWriterClient {\n constructor(args: {\n projectId?: string;\n keyFilename?: string;\n credentials?: unknown;\n scopes?: string | string[];\n }) {\n calls.push({ method: 'WriterClient.ctor', args: [args] });\n }\n async createStreamConnection(\n args: {\n destinationTable: string;\n streamId: string;\n },\n options?: unknown,\n ) {\n // Match the real SDK: callers must pass streamId=DefaultStream (not streamType)\n // for default-stream use. Passing streamType triggers a CreateWriteStream\n // call with type='DEFAULT', which BQ rejects as TYPE_UNSPECIFIED.\n if (args.streamId !== 'DEFAULT') {\n throw new Error(\n `mock createStreamConnection: expected streamId='DEFAULT', got ${JSON.stringify(args)}`,\n );\n }\n // args[1] captures the gax CallOptions (e.g. { timeout }) so tests can\n // assert the request deadline is forwarded to the appendRows stream.\n calls.push({ method: 'createStreamConnection', args: [args, options] });\n const queuedError = nextCreateStreamConnectionError;\n if (queuedError !== null) {\n nextCreateStreamConnectionError = null;\n throw queuedError;\n }\n const connection = new MockStreamConnection(\n `${args.destinationTable}/streams/_default`,\n );\n lastConnection = connection;\n allConnections.push(connection);\n return connection;\n }\n async getWriteStream(\n args: { streamId: string; view?: number },\n options?: unknown,\n ) {\n // args[1] captures the gax CallOptions so tests can assert the deadline\n // is forwarded to the unary schema fetch.\n calls.push({ method: 'getWriteStream', args: [args, options] });\n // Minimal tableSchema shape consumed by adapt.convertStorageSchemaToProto2Descriptor\n return {\n tableSchema: { fields: [] },\n };\n }\n close(): void {\n calls.push({ method: 'WriterClient.close', args: [] });\n }\n}\n\nconst adapt = {\n convertStorageSchemaToProto2Descriptor: (_schema: unknown, _root: string) => {\n calls.push({\n method: 'adapt.convertStorageSchemaToProto2Descriptor',\n args: [_schema, _root],\n });\n return { name: 'root', field: [] };\n },\n};\n\nconst managedwriter = {\n WriterClient: MockWriterClient,\n JSONWriter: MockJSONWriter,\n DefaultStream: 'DEFAULT',\n};\n\nconst protos = {\n google: {\n cloud: {\n bigquery: {\n storage: {\n v1: {\n WriteStreamView: {\n WRITE_STREAM_VIEW_UNSPECIFIED: 0,\n BASIC: 1,\n FULL: 2,\n },\n },\n },\n },\n },\n },\n};\n\n// Test-only helper. Not part of the real SDK.\nfunction __getMockCalls() {\n return calls;\n}\n\nfunction __resetMockCalls() {\n calls.length = 0;\n nextAppendRowErrors = null;\n nextAppendThrow = null;\n nextGetResultReject = null;\n nextAppendStatus = null;\n nextCreateStreamConnectionError = null;\n lastConnection = null;\n allConnections.length = 0;\n}\n\n/**\n * Test-only: the most recently created StreamConnection, so a test can emit an\n * out-of-band `'error'` on it (via `__emitConnectionError`) and assert the\n * destination attached a listener.\n */\nfunction __getLastConnection(): MockStreamConnection {\n if (!lastConnection) throw new Error('mock: no StreamConnection created yet');\n return lastConnection;\n}\n\n/**\n * Test-only: every StreamConnection created since the last reset, so a test can\n * assert that a concurrent re-open did not orphan a connection that still\n * carries an 'error' listener (a leak).\n */\nfunction __getAllConnections(): MockStreamConnection[] {\n return allConnections.slice();\n}\n\n/**\n * Test-only: queue rowErrors for the next appendRows().getResult() call.\n * Auto-resets after one use.\n */\nfunction __setNextAppendRowErrors(errors: MockRowError[]): void {\n nextAppendRowErrors = errors;\n}\n\n/**\n * Test-only: make the next appendRows() throw synchronously, simulating a\n * Storage Write API call failure. Auto-resets after one use.\n */\nfunction __setNextAppendThrow(err: unknown): void {\n nextAppendThrow = err;\n}\n\n/**\n * Test-only: make the next appendRows().getResult() reject, simulating a gRPC\n * deadline-exceeded (or any stream error) surfacing through the pending write.\n * Auto-resets after one use.\n */\nfunction __setNextGetResultReject(err: unknown): void {\n nextGetResultReject = err;\n}\n\n/**\n * Test-only: make the next appendRows().getResult() resolve with an error\n * status (a quota, a dropped table), as the SDK does for a status it does not\n * retry. Auto-resets after one use.\n */\nfunction __setNextAppendStatus(status: {\n code: number;\n message: string;\n}): void {\n nextAppendStatus = status;\n}\n\n/**\n * Test-only: queue an error for the next createStreamConnection() call so\n * tests can simulate openWriter failures (NotFound, INVALID_ARGUMENT, etc.).\n * Auto-resets after one use.\n */\nfunction __setNextOpenWriterError(err: unknown): void {\n nextCreateStreamConnectionError = err;\n}\n\nexport {\n managedwriter,\n adapt,\n protos,\n MockStreamConnection,\n __getMockCalls,\n __resetMockCalls,\n __getLastConnection,\n __getAllConnections,\n __setNextAppendRowErrors,\n __setNextAppendThrow,\n __setNextGetResultReject,\n __setNextAppendStatus,\n __setNextOpenWriterError,\n};\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\nimport { eventToRow } from '../eventToRow';\n\n/**\n * Mirror of push.ts via eventToRow() -- produces a flat 15-column row\n * with nested object/array values JSON-stringified. Imported directly\n * from the runtime helper so the step examples stay in sync with what\n * push.ts actually emits to JSONWriter.appendRows.\n */\nfunction expectedRow(event: WalkerOS.Event) {\n return eventToRow(event);\n}\n\n/**\n * Page view -- one row appended through JSONWriter.appendRows([row]).\n * Captured as a single intent-level call: ['appendRows', [row]].\n */\nconst pageViewEvent = getEvent('page view', {\n timestamp: 1700001100000,\n data: { title: 'Documentation', url: 'https://example.com/docs' },\n source: { type: 'express', platform: 'server' },\n});\n\nexport const pageView: Flow.StepExample = {\n title: 'Page view',\n description:\n 'A page view is appended as one row through the BigQuery Storage Write API JSONWriter. Nested objects/arrays in data, source, etc. are JSON-stringified by eventToRow.',\n in: pageViewEvent,\n mapping: undefined,\n out: [['appendRows', [expectedRow(pageViewEvent)]]],\n};\n\n/**\n * Purchase -- nested array in data.items is JSON.stringified into the\n * data column of the appended row.\n */\nconst purchaseEvent = getEvent('order complete', {\n timestamp: 1700001101000,\n data: {\n id: 'ORD-500',\n value: 199.99,\n items: [{ sku: 'SKU-1', qty: 2 }],\n },\n source: { type: 'express', platform: 'server' },\n});\n\nexport const purchase: Flow.StepExample = {\n title: 'Purchase',\n description:\n 'An order event is appended as a single row through JSONWriter.appendRows. The entire nested data object (including arrays like items) is JSON-stringified into the data column via eventToRow().',\n in: purchaseEvent,\n mapping: undefined,\n out: [['appendRows', [expectedRow(purchaseEvent)]]],\n};\n\n/** A silent rule appends no row. */\nexport const silentRule: Flow.StepExample = {\n public: false,\n description: 'A rule with silent: true appends no row.',\n in: getEvent('page view', { timestamp: 1700000000500 }),\n mapping: { silent: true },\n out: [],\n};\n\n/**\n * A failed append: the Storage Write call fails, so the row is not written\n * and the push fails, retryable, instead of counting as delivered. An append\n * the server answers with an error status (a quota, a dropped table) fails\n * the same way, retryable only for the statuses the SDK retries itself.\n */\nexport const appendFailed: Flow.StepExample = {\n public: false,\n description:\n 'A failed Storage Write append fails the push, retryable, instead of counting as delivered.',\n in: getEvent('page view', { timestamp: 1700001102000 }),\n respond: { error: 'network' },\n out: [\n [\n 'appendRows',\n [expectedRow(getEvent('page view', { timestamp: 1700001102000 }))],\n ],\n ],\n outcome: { status: 'failed', code: 'transport', retryable: true },\n};\n","import type { WalkerOS } from '@walkeros/core';\n\n/** Row shape passed to JSONWriter.appendRows. Values are JSON-serializable scalars or strings. */\nexport interface BigQueryRow {\n [key: string]: string | number | null;\n name: string;\n data: string | null;\n context: string | null;\n globals: string | null;\n custom: string | null;\n user: string | null;\n nested: string | null;\n consent: string | null;\n id: string;\n trigger: string;\n entity: string;\n action: string;\n timestamp: number;\n timing: number;\n source: string | null;\n}\n\nfunction jsonOrNull(value: unknown): string | null {\n if (value === undefined || value === null) return null;\n if (typeof value === 'object') {\n if (Array.isArray(value) && value.length === 0) return null;\n if (!Array.isArray(value) && Object.keys(value).length === 0) return null;\n return JSON.stringify(value);\n }\n return JSON.stringify(value);\n}\n\n/** Convert a walkerOS Event v4 into a 15-column BigQuery row in canonical order.\n *\n * Note: BQ Storage Write API encodes TIMESTAMP fields as INT64 microseconds\n * since epoch (the SDK calls Long.fromString on the value). ISO strings fail\n * with \"interior hyphen\" because Long.fromString sees the date hyphens as\n * non-numeric. Pass microseconds directly.\n */\nexport function eventToRow(event: WalkerOS.Event): BigQueryRow {\n return {\n name: event.name,\n data: jsonOrNull(event.data),\n context: jsonOrNull(event.context),\n globals: jsonOrNull(event.globals),\n custom: jsonOrNull(event.custom),\n user: jsonOrNull(event.user),\n nested: jsonOrNull(event.nested),\n consent: jsonOrNull(event.consent),\n id: event.id,\n trigger: event.trigger,\n entity: event.entity,\n action: event.action,\n timestamp: new Date(event.timestamp).getTime() * 1000, // microseconds since epoch\n timing: event.timing,\n source: jsonOrNull(event.source),\n };\n}\n","import type { Flow } from '@walkeros/core';\n\n/**\n * The setting BigQuery needs to deliver: the project ID. The credentials come\n * from the Google environment.\n */\nexport const minimal: Flow.MinimalExample = {\n settings: { projectId: 'YOUR_PROJECT_ID' },\n};\n","export * as env from './env';\nexport * as step from './step';\nexport { minimal } from './minimal';\n","import type {\n Env,\n PubSubPublisher,\n PublishMessage,\n TopicPublisher,\n} from '../types';\n\n/**\n * Example environment for the GCP Pub/Sub destination.\n *\n * `push` is the mock env simulate injects: `PubSub` builds a client whose\n * topics answer `publishMessage` locally, so nothing reaches GCP. Unit tests\n * still substitute the SDK module-wide via `jest.mock('@google-cloud/pubsub')`.\n */\n\nclass MockTopic implements TopicPublisher {\n constructor(public name: string) {}\n publishMessage(_message: PublishMessage): Promise<string> {\n return Promise.resolve('mock-message-id');\n }\n resumePublishing(_orderingKey: string): void {}\n}\n\nclass MockPubSub implements PubSubPublisher {\n constructor(public options?: object) {}\n topic(name: string): TopicPublisher {\n return new MockTopic(name);\n }\n close(): Promise<void> {\n return Promise.resolve();\n }\n}\n\nexport const push: Env = {\n PubSub: MockPubSub,\n};\n\n/** The publish carries the request; `args[0]` is the message. */\nexport const simulation = ['call:PubSub.topic.publishMessage'];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\n// Build-time version define. The upstream collector stamps source.release with\n// this on push, so the expected payload must mirror it rather than a literal,\n// else it breaks whenever the fixed version group is bumped (release).\ndeclare const __VERSION__: string;\n\n/**\n * Pub/Sub step examples. Each example's `out` is the array of recorded mock\n * calls produced by `push()`. The recording shape is:\n * ['topic', topicName, topicOptions] // implicit topic-handle creation\n * ['publishMessage', topicName, messageOptions]\n * ['resumePublishing', topicName, orderingKey] // only on publish failure\n */\n\n// Events reaching a server destination arrive already enriched by the upstream\n// collector, so they carry the run trace and per-run count. The collector\n// preserves these (stamp-if-absent), keeping the example deterministic.\nconst orderEvent = getEvent('order complete', {\n timestamp: 1700001100000,\n data: { id: 'ORD-500', value: 199.99, currency: 'EUR' },\n user: { id: 'usr-789' },\n source: {\n type: 'express',\n platform: 'server',\n trace: '1a2b3c4d5e6f70819a2b3c4d5e6f7081',\n count: 1,\n },\n});\n\nconst pageEvent = getEvent('page view', {\n timestamp: 1700001101000,\n data: { title: 'Documentation', url: 'https://example.com/docs' },\n source: {\n type: 'express',\n platform: 'server',\n trace: '9f8e7d6c5b4a39281706f5e4d3c2b1a0',\n count: 1,\n },\n});\n\nfunction expectedPayload(event: WalkerOS.Event): Buffer {\n // The harness pushes the event through an unconfigured collector, which stamps\n // source.release = { [name ?? platform ?? 'default']: __VERSION__ }. With no\n // collector name, the key is the event's platform. Mirror that here so the\n // expected message body matches the published (post-collector) event.\n const releaseKey = event.source.platform ?? 'default';\n const stamped = {\n ...event,\n source: { ...event.source, release: { [releaseKey]: __VERSION__ } },\n };\n return Buffer.from(JSON.stringify(stamped));\n}\n\n/**\n * Default publish, no mapping. Settings.topic = 'events'. The destination\n * constructs a topic handle inline with messageOrdering=false (no ordering\n * key resolved) and publishes the full event JSON as the message body.\n */\nexport const defaultPush: Flow.StepExample = {\n title: 'Default publish',\n description:\n 'An event is published to the configured Pub/Sub topic with the full JSON event as the message body and no ordering key.',\n in: orderEvent,\n out: [\n ['topic', 'events', { messageOrdering: false }],\n ['publishMessage', 'events', { data: expectedPayload(orderEvent) }],\n ],\n};\n\n/**\n * Per-rule topic override. Mapping carries `settings.topic = 'orders'`\n * which routes this rule to a dedicated topic.\n */\nexport const mappedTopic: Flow.StepExample = {\n title: 'Topic override',\n description:\n 'A mapping rule overrides the destination default topic so order events are published to a dedicated topic.',\n in: orderEvent,\n mapping: {\n settings: {\n topic: 'orders',\n },\n },\n out: [\n ['topic', 'orders', { messageOrdering: false }],\n ['publishMessage', 'orders', { data: expectedPayload(orderEvent) }],\n ],\n};\n\n/**\n * Per-rule ordering key resolved from the event. `mapping.orderingKey =\n * 'user.id'` is a Mapping.Value that resolves to the event's user.id. The\n * topic handle is constructed with messageOrdering=true and the publish\n * carries the resolved orderingKey.\n */\nexport const mappedOrderingKey: Flow.StepExample = {\n title: 'Ordering key from user',\n description:\n 'A mapping resolves the ordering key from event.user.id, enabling per-user ordering for this publish.',\n in: orderEvent,\n mapping: {\n settings: {\n orderingKey: 'user.id',\n },\n },\n out: [\n ['topic', 'events', { messageOrdering: true }],\n [\n 'publishMessage',\n 'events',\n {\n data: expectedPayload(orderEvent),\n orderingKey: 'usr-789',\n },\n ],\n ],\n};\n\n/**\n * Per-rule attributes. `mapping.attributes = { entity: 'entity', action:\n * 'action' }` is a Mapping.Map resolved per event. Each value is a path\n * resolved against the event.\n */\nexport const mappedAttributes: Flow.StepExample = {\n title: 'Mapped attributes',\n description:\n 'A mapping resolves a per-event attribute map, here exposing entity and action as Pub/Sub attributes for routing in subscribers.',\n in: orderEvent,\n mapping: {\n settings: {\n attributes: {\n entity: 'entity',\n action: 'action',\n },\n },\n },\n out: [\n ['topic', 'events', { messageOrdering: false }],\n [\n 'publishMessage',\n 'events',\n {\n data: expectedPayload(orderEvent),\n attributes: { entity: 'order', action: 'complete' },\n },\n ],\n ],\n};\n\n/**\n * Mapped data. `mapping.data` rewrites the publish body. The rewritten\n * object replaces the event as the message data.\n */\nexport const mappedData: Flow.StepExample = {\n title: 'Mapped payload',\n description:\n 'A data mapping transforms the event payload before publish. The rewritten object becomes the Pub/Sub message body.',\n in: orderEvent,\n mapping: {\n data: {\n map: {\n order_id: 'data.id',\n revenue: 'data.value',\n currency: 'data.currency',\n },\n },\n },\n out: [\n ['topic', 'events', { messageOrdering: false }],\n [\n 'publishMessage',\n 'events',\n {\n // Mapped-data publish: the body is the mapping result (no event\n // envelope, so no source.release), emitted verbatim.\n data: Buffer.from(\n JSON.stringify({\n order_id: 'ORD-500',\n revenue: 199.99,\n currency: 'EUR',\n }),\n ),\n },\n ],\n ],\n};\n\n/**\n * Page view, no rule. Verifies free-form publish on a non-ordered topic\n * for an event with no special mapping.\n */\nexport const pageView: Flow.StepExample = {\n title: 'Page view',\n description:\n 'A page view is published to the default topic with no ordering key, demonstrating the simplest publish path.',\n in: pageEvent,\n out: [\n ['topic', 'events', { messageOrdering: false }],\n ['publishMessage', 'events', { data: expectedPayload(pageEvent) }],\n ],\n};\n\n/** A silent rule publishes no message. */\nexport const silentRule: Flow.StepExample = {\n public: false,\n description: 'A rule with silent: true publishes no message.',\n in: getEvent('page view', { timestamp: 1700000000500 }),\n mapping: { silent: true },\n out: [],\n};\n","import type { Flow } from '@walkeros/core';\n\n/**\n * The settings Pub/Sub needs to deliver: the project ID and the topic. The\n * credentials come from the Google environment.\n */\nexport const minimal: Flow.MinimalExample = {\n settings: { projectId: 'YOUR_PROJECT_ID', topic: 'events' },\n};\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z\n .object({\n client: z\n .any()\n .describe(\n 'Google Cloud BigQuery client instance (like new BigQuery({ projectId, keyFilename })). Used by walkeros setup only; event writes authenticate with config.credentials, settings.bigquery or the default credentials.',\n )\n .optional(),\n projectId: z\n .string()\n .min(1)\n .describe('Google Cloud Project ID (like my-gcp-project)'),\n datasetId: z\n .string()\n .min(1)\n .default('walkerOS')\n .describe(\n 'BigQuery dataset ID where events will be stored (like walker_events)',\n ),\n tableId: z\n .string()\n .min(1)\n .default('events')\n .describe('BigQuery table ID for event storage (like events)'),\n location: z\n .string()\n .default('EU')\n .describe(\n 'Not read by the destination. walkeros setup creates the dataset in config.setup.location (like US), default EU.',\n ),\n bigquery: z\n .any()\n .describe(\n 'Additional BigQuery client configuration options (like { keyFilename: \"path/to/key.json\" })',\n )\n .optional(),\n })\n .strict();\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * GCP BigQuery Mapping Schema\n * BigQuery has no event-level mapping configuration\n */\nexport const MappingSchema = z.object({});\n\n/**\n * Type inference from MappingSchema\n */\nexport type Mapping = z.infer<typeof MappingSchema>;\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\nimport { SetupSchema } from './setup';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\nexport { SetupSchema, type Setup } from './setup';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\nexport const setup = zodToSchema(SetupSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z\n .object({\n client: z\n .any()\n .describe(\n 'Google Cloud Pub/Sub client instance (like new PubSub({ projectId, keyFilename }))',\n )\n .optional(),\n projectId: z\n .string()\n .min(1)\n .describe('Google Cloud Project ID (like my-gcp-project)'),\n topic: z\n .string()\n .min(1)\n .describe(\n 'Pub/Sub topic short name (like events). The full resource name projects/<projectId>/topics/<topic> is built by the SDK.',\n ),\n credentials: z\n .any()\n .describe(\n 'Service account credentials as a JSON string or an object with client_email and private_key. Default: Application Default Credentials (ADC). (deprecated: use config.credentials)',\n )\n .optional(),\n apiEndpoint: z\n .string()\n .describe(\n 'Override Pub/Sub API endpoint. Useful for the local emulator (like localhost:8085).',\n )\n .optional(),\n orderingKey: z\n .any()\n .describe(\n 'Mapping value resolved per-event. Truthy enables per-key ordering for the publish.',\n )\n .optional(),\n attributes: z\n .any()\n .describe(\n 'Default per-event attribute map merged into every published message. Mapping.Map shape.',\n )\n .optional(),\n })\n .strict();\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * GCP Pub/Sub Mapping Schema\n *\n * Per-rule overrides for topic, orderingKey, and attributes.\n */\nexport const MappingSchema = z.object({\n topic: z\n .string()\n .describe(\n 'Per-rule topic override. Falls back to settings.topic if absent.',\n )\n .optional(),\n orderingKey: z\n .any()\n .describe(\n 'Per-rule ordering-key Mapping.Value. Overrides settings.orderingKey when set.',\n )\n .optional(),\n attributes: z\n .any()\n .describe(\n 'Per-rule attribute Mapping.Map merged on top of settings.attributes.',\n )\n .optional(),\n});\n\n/**\n * Type inference from MappingSchema\n */\nexport type Mapping = z.infer<typeof MappingSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * GCP Pub/Sub Setup Schema\n *\n * Provisioning options for `walkeros setup destination.<id>`. Idempotent topic\n * creation. Subscription provisioning is owned by the source side.\n */\nexport const SetupSchema = z.object({\n messageStoragePolicy: z\n .object({\n allowedPersistenceRegions: z\n .array(z.string())\n .describe(\n 'Geographic regions for at-rest message storage (like europe-west1). Default: europe-west1, europe-west3 and europe-west4.',\n ),\n })\n .describe('Topic-level message storage policy.')\n .optional(),\n messageRetentionDuration: z\n .object({\n seconds: z\n .number()\n .describe('Retention window in seconds. Default: project default.'),\n })\n .describe('Topic-level retention configuration.')\n .optional(),\n kmsKeyName: z\n .string()\n .describe('Customer-managed encryption key (CMEK) resource name. Optional.')\n .optional(),\n labels: z\n .record(z.string(), z.string())\n .describe('Topic labels for organization and billing.')\n .optional(),\n});\n\nexport type Setup = z.infer<typeof SetupSchema>;\n","// Browser-safe schema-only exports\n// This file exports ONLY schemas without any Node.js dependencies\nexport { settings, mapping } from './bigquery/schemas';\nexport {\n settings as pubsubSettings,\n mapping as pubsubMapping,\n setup as pubsubSetup,\n} from './pubsub/schemas';\n","import type { Hint } from '@walkeros/core';\n\nexport const hints: Hint.Hints = {\n 'auth-methods': {\n text: 'BigQuery authenticates three ways. config.credentials: a service account key as a JSON string or object, backed by $secret, used by walkeros setup and by event writes. settings.bigquery: raw client options such as { keyFilename: \"./sa.json\" }, passed to both clients. Neither set: Application Default Credentials (the attached service account on GCP compute, GOOGLE_APPLICATION_CREDENTIALS elsewhere). A pre-built settings.client is used by walkeros setup only, never for event writes.',\n code: [\n {\n lang: 'json',\n code: '{ \"settings\": { \"projectId\": \"my-project\" }, \"credentials\": \"$secret.BIGQUERY_SA_KEY\" }',\n },\n {\n lang: 'json',\n code: '{ \"settings\": { \"projectId\": \"my-project\" } }',\n },\n ],\n },\n 'storage-format': {\n text: 'All events go to one table, by default dataset \"walkerOS\" and table \"events\" (settings.datasetId, settings.tableId). Each event is one row of 15 columns: name, id, trigger, entity and action as strings, timestamp as a TIMESTAMP, timing as a number, and the object fields (data, context, globals, custom, user, nested, consent, source) as JSON. walkeros setup creates the dataset in config.setup.location (default EU) and the table, partitioned by day on timestamp.',\n },\n 'query-json-columns': {\n text: 'The object fields (data, context, globals, user and the others) are JSON columns in the default table. Query them with BigQuery JSON functions such as JSON_EXTRACT_SCALAR; paths follow the walkerOS event structure.',\n code: [\n {\n lang: 'sql',\n code: \"SELECT JSON_EXTRACT_SCALAR(data, '$.value') AS value FROM `project.walkerOS.events` WHERE entity = 'order'\",\n },\n ],\n },\n 'troubleshoot-empty-table': {\n text: 'Events not appearing? The collector logs the first failed write of each cause as an ERROR line and counts repeats within a minute in status.destinations.<id>.failed. Common causes: the dataset or table does not exist (set config.setup: true and run walkeros setup destination.<id> once; without config.setup the command skips), projectId names another project, or the service account lacks roles/bigquery.dataEditor. projectId is checked when the destination starts; the table is opened at the first event.',\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAAA;AAAA,EAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,oBAA6B;AAE7B,IAAM,QAAoD,CAAC;AAQ3D,IAAI,sBAA6C;AACjD,IAAI,kBA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AA,EACR;AAAA,EACA,sBAAsB;AAAA,IACpB,MAAM;AAAA,IACN,MAAM;AAAA,MACJ;AAAA,QACE,MAAM;AAAA,QACN,MAAM;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAAA,EACA,4BAA4B;AAAA,IAC1B,MAAM;AAAA,EACR;AACF;;;AnBpBO,IAAM,iBAAiB;AAAA,EAC5B,qBAAqB;AAAA,EACrB,mBAAmBC;AACrB;AAGO,IAAM,gBAAgB;AAAA,EAC3B,qBAAqB;AAAA,IACnB;AAAA,IACA;AAAA,EACF;AAAA,EACA,mBAAmB;AAAA,IACjB,UAA0BC;AAAA,IAC1B,SAAyBC;AAAA,IACzB;AAAA,EACF;AACF;","names":["examples_exports","examples_exports","env_exports","minimal","step_exports","env_exports","push","simulation","step_exports","pageView","silentRule","import_core","minimal","import_dev","import_dev","import_dev","import_dev","SettingsSchema","import_dev","MappingSchema","import_dev","settings","SettingsSchema","mapping","MappingSchema","mapping","settings","examples_exports","settings","mapping"]}
|
|
1
|
+
{"version":3,"sources":["../src/dev.ts","../src/bigquery/examples/index.ts","../src/bigquery/examples/env.ts","../src/bigquery/__mocks__/@google-cloud/bigquery-storage.ts","../src/bigquery/examples/step.ts","../src/bigquery/eventToRow.ts","../src/bigquery/examples/minimal.ts","../src/pubsub/examples/index.ts","../src/pubsub/examples/env.ts","../src/pubsub/examples/step.ts","../src/pubsub/examples/minimal.ts","../src/bigquery/schemas/index.ts","../src/bigquery/schemas/settings.ts","../src/bigquery/schemas/mapping.ts","../src/pubsub/schemas/index.ts","../src/pubsub/schemas/settings.ts","../src/pubsub/schemas/mapping.ts","../src/pubsub/schemas/setup.ts","../src/schemas.ts","../src/hints.ts"],"sourcesContent":["import * as bigqueryExamplesNs from './bigquery/examples';\nimport * as pubsubExamplesNs from './pubsub/examples';\nimport * as bigquerySchemasNs from './bigquery/schemas';\nimport * as pubsubSchemasNs from './pubsub/schemas';\n\nexport * as schemas from './schemas';\nexport * as examples from './bigquery/examples';\nexport * as pubsubExamples from './pubsub/examples';\nexport { hints } from './hints';\n\n/** Dev examples per export, keyed by the export names in package.json. */\nexport const exportExamples = {\n destinationBigQuery: bigqueryExamplesNs,\n destinationPubSub: pubsubExamplesNs,\n};\n\n/** Schemas per export, keyed by the export names in package.json. */\nexport const exportSchemas = {\n destinationBigQuery: {\n settings: bigquerySchemasNs.settings,\n mapping: bigquerySchemasNs.mapping,\n },\n destinationPubSub: {\n settings: pubsubSchemasNs.settings,\n mapping: pubsubSchemasNs.mapping,\n setup: pubsubSchemasNs.setup,\n },\n};\n","export * as env from './env';\nexport * as step from './step';\nexport { minimal } from './minimal';\n","import type { Env, QueryClient, TableMetadataShape } from '../types';\nimport {\n managedwriter as mockManagedwriter,\n adapt as mockAdapt,\n} from '../__mocks__/@google-cloud/bigquery-storage';\n\n/**\n * Example environment configurations for GCP BigQuery destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring actual BigQuery SDK dependencies.\n *\n * The Storage Write API mocks (WriterClient, JSONWriter, adapt) are\n * re-exported from the package-local __mocks__ folder so example/test\n * code shares a single source of truth with the jest auto-mock.\n */\n\n/**\n * Mock BigQuery query client: dataset and table provisioning calls resolve as\n * if both already exist.\n */\nfunction createMockBigQuery() {\n return class MockBigQuery implements QueryClient {\n calls: Array<{ method: string; args: unknown[] }>;\n options: unknown;\n\n constructor(options?: unknown) {\n this.options = options;\n this.calls = [];\n }\n\n dataset(datasetId: string) {\n this.calls.push({ method: 'dataset', args: [datasetId] });\n return this;\n }\n\n table(tableId: string) {\n this.calls.push({ method: 'table', args: [tableId] });\n return this;\n }\n\n async exists(): Promise<[boolean]> {\n this.calls.push({ method: 'exists', args: [] });\n return [true];\n }\n\n async create(options: unknown): Promise<void> {\n this.calls.push({ method: 'create', args: [options] });\n }\n\n async getMetadata(): Promise<[TableMetadataShape]> {\n this.calls.push({ method: 'getMetadata', args: [] });\n return [{}];\n }\n };\n}\n\n/**\n * Standard mock environment for push operations\n *\n * Use this for testing BigQuery Storage Write appends without connecting\n * to actual GCP infrastructure.\n */\nexport const push: Env = {\n get BigQuery() {\n return createMockBigQuery();\n },\n get WriterClient() {\n return mockManagedwriter.WriterClient;\n },\n get JSONWriter() {\n return mockManagedwriter.JSONWriter;\n },\n get adapt() {\n return mockAdapt;\n },\n};\n\n/**\n * Every row goes through the writer's `appendRows`; the writer is built from\n * `JSONWriter` in init, so the path continues on the constructed instance.\n * Constructors are not recorded: their arguments carry credentials.\n */\nexport const simulation = ['call:JSONWriter.appendRows'];\n","import { EventEmitter } from 'events';\n\nconst calls: Array<{ method: string; args: unknown[] }> = [];\n\ninterface MockRowError {\n index: number;\n code: number;\n message: string;\n}\n\nlet nextAppendRowErrors: MockRowError[] | null = null;\nlet nextAppendThrow: unknown = null;\nlet nextGetResultReject: unknown = null;\nlet nextAppendStatus: { code: number; message: string } | null = null;\nlet nextCreateStreamConnectionError: unknown = null;\n\n/**\n * Honest stand-in for the SDK's StreamConnection: a REAL Node EventEmitter so\n * `emit('error', …)` with no listener throws exactly like the real one (Node's\n * special-cased `'error'` event). `onConnectionError` mirrors the SDK surface:\n * it registers an `'error'` listener and returns an `{ off }` disposable.\n */\nclass MockStreamConnection extends EventEmitter {\n private readonly streamId: string;\n constructor(streamId: string) {\n super();\n this.streamId = streamId;\n }\n getStreamId(): string {\n return this.streamId;\n }\n onConnectionError(listener: (err: unknown) => void): { off: () => void } {\n calls.push({ method: 'onConnectionError', args: [] });\n this.on('error', listener);\n return {\n off: () => {\n this.off('error', listener);\n },\n };\n }\n /**\n * Test-only: literally `this.emit('error', err)` with NO internal\n * listener-count guard, so before a listener is attached this reproduces\n * Node's real \"throw if no 'error' listener\" behavior. A fake that silently\n * swallowed would mask the very crash this listener exists to contain.\n */\n __emitConnectionError(err: unknown): void {\n this.emit('error', err);\n }\n}\n\n// The most recently created connection, so tests can emit on it and assert the\n// listener was registered.\nlet lastConnection: MockStreamConnection | null = null;\n\n// Every connection ever created (this reset cycle), so tests can assert that a\n// concurrent re-open did not orphan a connection still carrying an 'error'\n// listener.\nconst allConnections: MockStreamConnection[] = [];\n\nclass MockJSONWriter {\n constructor(_args: { connection: unknown; protoDescriptor: unknown }) {\n calls.push({ method: 'JSONWriter.ctor', args: [_args] });\n }\n appendRows(rows: unknown[], offsetValue?: unknown) {\n calls.push({ method: 'appendRows', args: [rows, offsetValue] });\n const queuedThrow = nextAppendThrow;\n if (queuedThrow !== null) {\n nextAppendThrow = null;\n throw queuedThrow;\n }\n const queuedErrors = nextAppendRowErrors;\n nextAppendRowErrors = null;\n const queuedReject = nextGetResultReject;\n nextGetResultReject = null;\n const queuedStatus = nextAppendStatus;\n nextAppendStatus = null;\n return {\n getResult: async () => {\n // Models a gRPC deadline-exceeded (or any stream error): the append is\n // accepted but getResult() rejects when the stream's deadline fires.\n if (queuedReject !== null) throw queuedReject;\n // An error status the SDK does not retry resolves with `error` set\n // and no rowErrors.\n if (queuedStatus !== null)\n return {\n error: queuedStatus,\n writeStream: 'projects/p/datasets/d/tables/t/streams/_default',\n };\n return {\n appendResult: { offset: { value: '0' } },\n rowErrors: queuedErrors ?? [],\n writeStream: 'projects/p/datasets/d/tables/t/streams/_default',\n };\n },\n };\n }\n close(): void {\n calls.push({ method: 'JSONWriter.close', args: [] });\n }\n}\n\nclass MockWriterClient {\n constructor(args: {\n projectId?: string;\n keyFilename?: string;\n credentials?: unknown;\n scopes?: string | string[];\n }) {\n calls.push({ method: 'WriterClient.ctor', args: [args] });\n }\n async createStreamConnection(\n args: {\n destinationTable: string;\n streamId: string;\n },\n options?: unknown,\n ) {\n // Match the real SDK: callers must pass streamId=DefaultStream (not streamType)\n // for default-stream use. Passing streamType triggers a CreateWriteStream\n // call with type='DEFAULT', which BQ rejects as TYPE_UNSPECIFIED.\n if (args.streamId !== 'DEFAULT') {\n throw new Error(\n `mock createStreamConnection: expected streamId='DEFAULT', got ${JSON.stringify(args)}`,\n );\n }\n // args[1] captures the gax CallOptions (e.g. { timeout }) so tests can\n // assert the request deadline is forwarded to the appendRows stream.\n calls.push({ method: 'createStreamConnection', args: [args, options] });\n const queuedError = nextCreateStreamConnectionError;\n if (queuedError !== null) {\n nextCreateStreamConnectionError = null;\n throw queuedError;\n }\n const connection = new MockStreamConnection(\n `${args.destinationTable}/streams/_default`,\n );\n lastConnection = connection;\n allConnections.push(connection);\n return connection;\n }\n async getWriteStream(\n args: { streamId: string; view?: number },\n options?: unknown,\n ) {\n // args[1] captures the gax CallOptions so tests can assert the deadline\n // is forwarded to the unary schema fetch.\n calls.push({ method: 'getWriteStream', args: [args, options] });\n // Minimal tableSchema shape consumed by adapt.convertStorageSchemaToProto2Descriptor\n return {\n tableSchema: { fields: [] },\n };\n }\n close(): void {\n calls.push({ method: 'WriterClient.close', args: [] });\n }\n}\n\nconst adapt = {\n convertStorageSchemaToProto2Descriptor: (_schema: unknown, _root: string) => {\n calls.push({\n method: 'adapt.convertStorageSchemaToProto2Descriptor',\n args: [_schema, _root],\n });\n return { name: 'root', field: [] };\n },\n};\n\nconst managedwriter = {\n WriterClient: MockWriterClient,\n JSONWriter: MockJSONWriter,\n DefaultStream: 'DEFAULT',\n};\n\nconst protos = {\n google: {\n cloud: {\n bigquery: {\n storage: {\n v1: {\n WriteStreamView: {\n WRITE_STREAM_VIEW_UNSPECIFIED: 0,\n BASIC: 1,\n FULL: 2,\n },\n },\n },\n },\n },\n },\n};\n\n// Test-only helper. Not part of the real SDK.\nfunction __getMockCalls() {\n return calls;\n}\n\nfunction __resetMockCalls() {\n calls.length = 0;\n nextAppendRowErrors = null;\n nextAppendThrow = null;\n nextGetResultReject = null;\n nextAppendStatus = null;\n nextCreateStreamConnectionError = null;\n lastConnection = null;\n allConnections.length = 0;\n}\n\n/**\n * Test-only: the most recently created StreamConnection, so a test can emit an\n * out-of-band `'error'` on it (via `__emitConnectionError`) and assert the\n * destination attached a listener.\n */\nfunction __getLastConnection(): MockStreamConnection {\n if (!lastConnection) throw new Error('mock: no StreamConnection created yet');\n return lastConnection;\n}\n\n/**\n * Test-only: every StreamConnection created since the last reset, so a test can\n * assert that a concurrent re-open did not orphan a connection that still\n * carries an 'error' listener (a leak).\n */\nfunction __getAllConnections(): MockStreamConnection[] {\n return allConnections.slice();\n}\n\n/**\n * Test-only: queue rowErrors for the next appendRows().getResult() call.\n * Auto-resets after one use.\n */\nfunction __setNextAppendRowErrors(errors: MockRowError[]): void {\n nextAppendRowErrors = errors;\n}\n\n/**\n * Test-only: make the next appendRows() throw synchronously, simulating a\n * Storage Write API call failure. Auto-resets after one use.\n */\nfunction __setNextAppendThrow(err: unknown): void {\n nextAppendThrow = err;\n}\n\n/**\n * Test-only: make the next appendRows().getResult() reject, simulating a gRPC\n * deadline-exceeded (or any stream error) surfacing through the pending write.\n * Auto-resets after one use.\n */\nfunction __setNextGetResultReject(err: unknown): void {\n nextGetResultReject = err;\n}\n\n/**\n * Test-only: make the next appendRows().getResult() resolve with an error\n * status (a quota, a dropped table), as the SDK does for a status it does not\n * retry. Auto-resets after one use.\n */\nfunction __setNextAppendStatus(status: {\n code: number;\n message: string;\n}): void {\n nextAppendStatus = status;\n}\n\n/**\n * Test-only: queue an error for the next createStreamConnection() call so\n * tests can simulate openWriter failures (NotFound, INVALID_ARGUMENT, etc.).\n * Auto-resets after one use.\n */\nfunction __setNextOpenWriterError(err: unknown): void {\n nextCreateStreamConnectionError = err;\n}\n\nexport {\n managedwriter,\n adapt,\n protos,\n MockStreamConnection,\n __getMockCalls,\n __resetMockCalls,\n __getLastConnection,\n __getAllConnections,\n __setNextAppendRowErrors,\n __setNextAppendThrow,\n __setNextGetResultReject,\n __setNextAppendStatus,\n __setNextOpenWriterError,\n};\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\nimport { eventToRow } from '../eventToRow';\n\n/**\n * Mirror of push.ts via eventToRow() -- produces a flat 15-column row\n * with nested object/array values JSON-stringified. Imported directly\n * from the runtime helper so the step examples stay in sync with what\n * push.ts actually emits to JSONWriter.appendRows.\n */\nfunction expectedRow(event: WalkerOS.Event) {\n return eventToRow(event);\n}\n\n/**\n * Page view -- one row appended through JSONWriter.appendRows([row]).\n * Captured as a single intent-level call: ['appendRows', [row]].\n */\nconst pageViewEvent = getEvent('page view', {\n timestamp: 1700001100000,\n data: { title: 'Documentation', url: 'https://example.com/docs' },\n source: { type: 'express', platform: 'server' },\n});\n\nexport const pageView: Flow.StepExample = {\n title: 'Page view',\n description:\n 'A page view is appended as one row through the BigQuery Storage Write API JSONWriter. Nested objects/arrays in data, source, etc. are JSON-stringified by eventToRow.',\n in: pageViewEvent,\n mapping: undefined,\n out: [['appendRows', [expectedRow(pageViewEvent)]]],\n};\n\n/**\n * Purchase -- nested array in data.items is JSON.stringified into the\n * data column of the appended row.\n */\nconst purchaseEvent = getEvent('order complete', {\n timestamp: 1700001101000,\n data: {\n id: 'ORD-500',\n value: 199.99,\n items: [{ sku: 'SKU-1', qty: 2 }],\n },\n source: { type: 'express', platform: 'server' },\n});\n\nexport const purchase: Flow.StepExample = {\n title: 'Purchase',\n description:\n 'An order event is appended as a single row through JSONWriter.appendRows. The entire nested data object (including arrays like items) is JSON-stringified into the data column via eventToRow().',\n in: purchaseEvent,\n mapping: undefined,\n out: [['appendRows', [expectedRow(purchaseEvent)]]],\n};\n\n/** A silent rule appends no row. */\nexport const silentRule: Flow.StepExample = {\n public: false,\n description: 'A rule with silent: true appends no row.',\n in: getEvent('page view', { timestamp: 1700000000500 }),\n mapping: { silent: true },\n out: [],\n};\n\n/**\n * A failed append: the Storage Write call fails, so the row is not written\n * and the push fails, retryable, instead of counting as delivered. An append\n * the server answers with an error status (a quota, a dropped table) fails\n * the same way, retryable only for the statuses the SDK retries itself.\n */\nexport const appendFailed: Flow.StepExample = {\n public: false,\n description:\n 'A failed Storage Write append fails the push, retryable, instead of counting as delivered.',\n in: getEvent('page view', { timestamp: 1700001102000 }),\n respond: { error: 'network' },\n out: [\n [\n 'appendRows',\n [expectedRow(getEvent('page view', { timestamp: 1700001102000 }))],\n ],\n ],\n outcome: { status: 'failed', code: 'transport', retryable: true },\n};\n","import type { WalkerOS } from '@walkeros/core';\n\n/** Row shape passed to JSONWriter.appendRows. Values are JSON-serializable scalars or strings. */\nexport interface BigQueryRow {\n [key: string]: string | number | null;\n name: string;\n data: string | null;\n context: string | null;\n globals: string | null;\n custom: string | null;\n user: string | null;\n nested: string | null;\n consent: string | null;\n id: string;\n trigger: string;\n entity: string;\n action: string;\n timestamp: number;\n timing: number;\n source: string | null;\n}\n\nfunction jsonOrNull(value: unknown): string | null {\n if (value === undefined || value === null) return null;\n if (typeof value === 'object') {\n if (Array.isArray(value) && value.length === 0) return null;\n if (!Array.isArray(value) && Object.keys(value).length === 0) return null;\n return JSON.stringify(value);\n }\n return JSON.stringify(value);\n}\n\n/** Convert a walkerOS Event v4 into a 15-column BigQuery row in canonical order.\n *\n * Note: BQ Storage Write API encodes TIMESTAMP fields as INT64 microseconds\n * since epoch (the SDK calls Long.fromString on the value). ISO strings fail\n * with \"interior hyphen\" because Long.fromString sees the date hyphens as\n * non-numeric. Pass microseconds directly.\n */\nexport function eventToRow(event: WalkerOS.Event): BigQueryRow {\n return {\n name: event.name,\n data: jsonOrNull(event.data),\n context: jsonOrNull(event.context),\n globals: jsonOrNull(event.globals),\n custom: jsonOrNull(event.custom),\n user: jsonOrNull(event.user),\n nested: jsonOrNull(event.nested),\n consent: jsonOrNull(event.consent),\n id: event.id,\n trigger: event.trigger,\n entity: event.entity,\n action: event.action,\n timestamp: new Date(event.timestamp).getTime() * 1000, // microseconds since epoch\n timing: event.timing,\n source: jsonOrNull(event.source),\n };\n}\n","import type { Flow } from '@walkeros/core';\n\n/**\n * The setting BigQuery needs to deliver: the project ID. The credentials come\n * from the Google environment.\n */\nexport const minimal: Flow.MinimalExample = {\n settings: { projectId: 'YOUR_PROJECT_ID' },\n};\n","export * as env from './env';\nexport * as step from './step';\nexport { minimal } from './minimal';\n","import type {\n Env,\n PubSubPublisher,\n PublishMessage,\n TopicPublisher,\n} from '../types';\n\n/**\n * Example environment for the GCP Pub/Sub destination.\n *\n * `push` is the mock env simulate injects: `PubSub` builds a client whose\n * topics answer `publishMessage` locally, so nothing reaches GCP. Unit tests\n * still substitute the SDK module-wide via `jest.mock('@google-cloud/pubsub')`.\n */\n\nclass MockTopic implements TopicPublisher {\n constructor(public name: string) {}\n publishMessage(_message: PublishMessage): Promise<string> {\n return Promise.resolve('mock-message-id');\n }\n resumePublishing(_orderingKey: string): void {}\n}\n\nclass MockPubSub implements PubSubPublisher {\n constructor(public options?: object) {}\n topic(name: string): TopicPublisher {\n return new MockTopic(name);\n }\n close(): Promise<void> {\n return Promise.resolve();\n }\n}\n\nexport const push: Env = {\n PubSub: MockPubSub,\n};\n\n/** The publish carries the request; `args[0]` is the message. */\nexport const simulation = ['call:PubSub.topic.publishMessage'];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\n// Build-time version define. The upstream collector stamps source.release with\n// this on push, so the expected payload must mirror it rather than a literal,\n// else it breaks whenever the fixed version group is bumped (release).\ndeclare const __VERSION__: string;\n\n/**\n * Pub/Sub step examples. Each example's `out` is the array of recorded mock\n * calls produced by `push()`. The recording shape is:\n * ['topic', topicName, topicOptions] // implicit topic-handle creation\n * ['publishMessage', topicName, messageOptions]\n * ['resumePublishing', topicName, orderingKey] // only on publish failure\n */\n\n// Events reaching a server destination arrive already enriched by the upstream\n// collector, so they carry the run trace and per-run count. The collector\n// preserves these (stamp-if-absent), keeping the example deterministic.\nconst orderEvent = getEvent('order complete', {\n timestamp: 1700001100000,\n data: { id: 'ORD-500', value: 199.99, currency: 'EUR' },\n user: { id: 'usr-789' },\n source: {\n type: 'express',\n platform: 'server',\n trace: '1a2b3c4d5e6f70819a2b3c4d5e6f7081',\n count: 1,\n },\n});\n\nconst pageEvent = getEvent('page view', {\n timestamp: 1700001101000,\n data: { title: 'Documentation', url: 'https://example.com/docs' },\n source: {\n type: 'express',\n platform: 'server',\n trace: '9f8e7d6c5b4a39281706f5e4d3c2b1a0',\n count: 1,\n },\n});\n\nfunction expectedPayload(event: WalkerOS.Event): Buffer {\n // The harness pushes the event through an unconfigured collector, which stamps\n // source.release = { [name ?? platform ?? 'default']: __VERSION__ }. With no\n // collector name, the key is the event's platform. Mirror that here so the\n // expected message body matches the published (post-collector) event.\n const releaseKey = event.source.platform ?? 'default';\n const stamped = {\n ...event,\n source: { ...event.source, release: { [releaseKey]: __VERSION__ } },\n };\n return Buffer.from(JSON.stringify(stamped));\n}\n\n/**\n * Default publish, no mapping. Settings.topic = 'events'. The destination\n * constructs a topic handle inline with messageOrdering=false (no ordering\n * key resolved) and publishes the full event JSON as the message body.\n */\nexport const defaultPush: Flow.StepExample = {\n title: 'Default publish',\n description:\n 'An event is published to the configured Pub/Sub topic with the full JSON event as the message body and no ordering key.',\n in: orderEvent,\n out: [\n ['topic', 'events', { messageOrdering: false }],\n ['publishMessage', 'events', { data: expectedPayload(orderEvent) }],\n ],\n};\n\n/**\n * Per-rule topic override. Mapping carries `settings.topic = 'orders'`\n * which routes this rule to a dedicated topic.\n */\nexport const mappedTopic: Flow.StepExample = {\n title: 'Topic override',\n description:\n 'A mapping rule overrides the destination default topic so order events are published to a dedicated topic.',\n in: orderEvent,\n mapping: {\n settings: {\n topic: 'orders',\n },\n },\n out: [\n ['topic', 'orders', { messageOrdering: false }],\n ['publishMessage', 'orders', { data: expectedPayload(orderEvent) }],\n ],\n};\n\n/**\n * Per-rule ordering key resolved from the event. `mapping.orderingKey =\n * 'user.id'` is a Mapping.Value that resolves to the event's user.id. The\n * topic handle is constructed with messageOrdering=true and the publish\n * carries the resolved orderingKey.\n */\nexport const mappedOrderingKey: Flow.StepExample = {\n title: 'Ordering key from user',\n description:\n 'A mapping resolves the ordering key from event.user.id, enabling per-user ordering for this publish.',\n in: orderEvent,\n mapping: {\n settings: {\n orderingKey: 'user.id',\n },\n },\n out: [\n ['topic', 'events', { messageOrdering: true }],\n [\n 'publishMessage',\n 'events',\n {\n data: expectedPayload(orderEvent),\n orderingKey: 'usr-789',\n },\n ],\n ],\n};\n\n/**\n * Per-rule attributes. `mapping.attributes = { entity: 'entity', action:\n * 'action' }` is a Mapping.Map resolved per event. Each value is a path\n * resolved against the event.\n */\nexport const mappedAttributes: Flow.StepExample = {\n title: 'Mapped attributes',\n description:\n 'A mapping resolves a per-event attribute map, here exposing entity and action as Pub/Sub attributes for routing in subscribers.',\n in: orderEvent,\n mapping: {\n settings: {\n attributes: {\n entity: 'entity',\n action: 'action',\n },\n },\n },\n out: [\n ['topic', 'events', { messageOrdering: false }],\n [\n 'publishMessage',\n 'events',\n {\n data: expectedPayload(orderEvent),\n attributes: { entity: 'order', action: 'complete' },\n },\n ],\n ],\n};\n\n/**\n * Mapped data. `mapping.data` rewrites the publish body. The rewritten\n * object replaces the event as the message data.\n */\nexport const mappedData: Flow.StepExample = {\n title: 'Mapped payload',\n description:\n 'A data mapping transforms the event payload before publish. The rewritten object becomes the Pub/Sub message body.',\n in: orderEvent,\n mapping: {\n data: {\n map: {\n order_id: 'data.id',\n revenue: 'data.value',\n currency: 'data.currency',\n },\n },\n },\n out: [\n ['topic', 'events', { messageOrdering: false }],\n [\n 'publishMessage',\n 'events',\n {\n // Mapped-data publish: the body is the mapping result (no event\n // envelope, so no source.release), emitted verbatim.\n data: Buffer.from(\n JSON.stringify({\n order_id: 'ORD-500',\n revenue: 199.99,\n currency: 'EUR',\n }),\n ),\n },\n ],\n ],\n};\n\n/**\n * Page view, no rule. Verifies free-form publish on a non-ordered topic\n * for an event with no special mapping.\n */\nexport const pageView: Flow.StepExample = {\n title: 'Page view',\n description:\n 'A page view is published to the default topic with no ordering key, demonstrating the simplest publish path.',\n in: pageEvent,\n out: [\n ['topic', 'events', { messageOrdering: false }],\n ['publishMessage', 'events', { data: expectedPayload(pageEvent) }],\n ],\n};\n\n/** A silent rule publishes no message. */\nexport const silentRule: Flow.StepExample = {\n public: false,\n description: 'A rule with silent: true publishes no message.',\n in: getEvent('page view', { timestamp: 1700000000500 }),\n mapping: { silent: true },\n out: [],\n};\n","import type { Flow } from '@walkeros/core';\n\n/**\n * The settings Pub/Sub needs to deliver: the project ID and the topic. The\n * credentials come from the Google environment.\n */\nexport const minimal: Flow.MinimalExample = {\n settings: { projectId: 'YOUR_PROJECT_ID', topic: 'events' },\n};\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z\n .object({\n client: z\n .any()\n .describe(\n 'Google Cloud BigQuery client instance (like new BigQuery({ projectId, keyFilename })). Used by walkeros setup only; event writes authenticate with config.credentials, settings.bigquery or the default credentials.',\n )\n .optional(),\n projectId: z\n .string()\n .min(1)\n .describe('Google Cloud Project ID (like my-gcp-project)'),\n datasetId: z\n .string()\n .min(1)\n .default('walkerOS')\n .describe(\n 'BigQuery dataset ID where events will be stored (like walker_events)',\n ),\n tableId: z\n .string()\n .min(1)\n .default('events')\n .describe('BigQuery table ID for event storage (like events)'),\n location: z\n .string()\n .default('EU')\n .describe(\n 'Not read by the destination. walkeros setup creates the dataset in config.setup.location (like US), default EU.',\n ),\n bigquery: z\n .any()\n .describe(\n 'Additional BigQuery client configuration options (like { keyFilename: \"path/to/key.json\" })',\n )\n .optional(),\n })\n .strict();\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * GCP BigQuery Mapping Schema\n * BigQuery has no event-level mapping configuration\n */\nexport const MappingSchema = z.object({});\n\n/**\n * Type inference from MappingSchema\n */\nexport type Mapping = z.infer<typeof MappingSchema>;\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\nimport { SetupSchema } from './setup';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\nexport { SetupSchema, type Setup } from './setup';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\nexport const setup = zodToSchema(SetupSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z\n .object({\n client: z\n .any()\n .describe(\n 'Google Cloud Pub/Sub client instance (like new PubSub({ projectId, keyFilename }))',\n )\n .optional(),\n projectId: z\n .string()\n .min(1)\n .describe('Google Cloud Project ID (like my-gcp-project)'),\n topic: z\n .string()\n .min(1)\n .describe(\n 'Pub/Sub topic short name (like events). The full resource name projects/<projectId>/topics/<topic> is built by the SDK.',\n ),\n credentials: z\n .any()\n .describe(\n 'Service account credentials as a JSON string or an object with client_email and private_key. Default: Application Default Credentials (ADC). (deprecated: use config.credentials)',\n )\n .optional(),\n apiEndpoint: z\n .string()\n .describe(\n 'Override Pub/Sub API endpoint. Useful for the local emulator (like localhost:8085).',\n )\n .optional(),\n orderingKey: z\n .any()\n .describe(\n 'Mapping value resolved per-event. Truthy enables per-key ordering for the publish.',\n )\n .optional(),\n attributes: z\n .any()\n .describe(\n 'Default per-event attribute map merged into every published message. Mapping.Map shape.',\n )\n .optional(),\n })\n .strict();\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * GCP Pub/Sub Mapping Schema\n *\n * Per-rule overrides for topic, orderingKey, and attributes.\n */\nexport const MappingSchema = z.object({\n topic: z\n .string()\n .describe(\n 'Per-rule topic override. Falls back to settings.topic if absent.',\n )\n .optional(),\n orderingKey: z\n .any()\n .describe(\n 'Per-rule ordering-key Mapping.Value. Overrides settings.orderingKey when set.',\n )\n .optional(),\n attributes: z\n .any()\n .describe(\n 'Per-rule attribute Mapping.Map merged on top of settings.attributes.',\n )\n .optional(),\n});\n\n/**\n * Type inference from MappingSchema\n */\nexport type Mapping = z.infer<typeof MappingSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * GCP Pub/Sub Setup Schema\n *\n * Provisioning options for `walkeros setup destination.<id>`. Idempotent topic\n * creation. Subscription provisioning is owned by the source side.\n */\nexport const SetupSchema = z.object({\n messageStoragePolicy: z\n .object({\n allowedPersistenceRegions: z\n .array(z.string())\n .describe(\n 'Geographic regions for at-rest message storage (like europe-west1). Default: europe-west1, europe-west3 and europe-west4.',\n ),\n })\n .describe('Topic-level message storage policy.')\n .optional(),\n messageRetentionDuration: z\n .object({\n seconds: z\n .number()\n .describe('Retention window in seconds. Default: project default.'),\n })\n .describe('Topic-level retention configuration.')\n .optional(),\n kmsKeyName: z\n .string()\n .describe('Customer-managed encryption key (CMEK) resource name. Optional.')\n .optional(),\n labels: z\n .record(z.string(), z.string())\n .describe('Topic labels for organization and billing.')\n .optional(),\n});\n\nexport type Setup = z.infer<typeof SetupSchema>;\n","// Browser-safe schema-only exports\n// This file exports ONLY schemas without any Node.js dependencies\nexport { settings, mapping } from './bigquery/schemas';\nexport {\n settings as pubsubSettings,\n mapping as pubsubMapping,\n setup as pubsubSetup,\n} from './pubsub/schemas';\n","import type { Hint } from '@walkeros/core';\n\nexport const hints: Hint.Hints = {\n 'auth-methods': {\n text: 'BigQuery authenticates three ways. config.credentials: a service account key as a JSON string or object, backed by $secret, used by walkeros setup and by event writes. settings.bigquery: raw client options such as { keyFilename: \"./sa.json\" }, passed to both clients. Neither set: Application Default Credentials (the attached service account on GCP compute, GOOGLE_APPLICATION_CREDENTIALS elsewhere). A pre-built settings.client is used by walkeros setup only, never for event writes.',\n code: [\n {\n lang: 'json',\n code: '{ \"settings\": { \"projectId\": \"my-project\" }, \"credentials\": \"$secret.BIGQUERY_SA_KEY\" }',\n },\n {\n lang: 'json',\n code: '{ \"settings\": { \"projectId\": \"my-project\" } }',\n },\n ],\n },\n 'storage-format': {\n text: 'All events go to one table, by default dataset \"walkerOS\" and table \"events\" (settings.datasetId, settings.tableId). Each event is one row of 15 columns: name, id, trigger, entity and action as strings, timestamp as a TIMESTAMP, timing as a number, and the object fields (data, context, globals, custom, user, nested, consent, source) as JSON. walkeros setup creates the dataset in config.setup.location (default EU) and the table, partitioned by day on timestamp.',\n },\n 'query-json-columns': {\n text: 'The object fields (data, context, globals, user and the others) are JSON columns in the default table. Query them with BigQuery JSON functions such as JSON_EXTRACT_SCALAR; paths follow the walkerOS event structure.',\n code: [\n {\n lang: 'sql',\n code: \"SELECT JSON_EXTRACT_SCALAR(data, '$.value') AS value FROM `project.walkerOS.events` WHERE entity = 'order'\",\n },\n ],\n },\n 'troubleshoot-empty-table': {\n text: 'Events not appearing? The collector logs the first failed write of each cause as an ERROR line and counts repeats within a minute in status.destinations.<id>.failed. Common causes: the dataset or table does not exist (set config.setup: true and run walkeros setup destination.<id> once; without config.setup the command skips), projectId names another project, or the service account lacks roles/bigquery.dataEditor. projectId is checked when the destination starts; the table is opened at the first event.',\n },\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAAAA;AAAA,EAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,oBAA6B;AAE7B,IAAM,QAAoD,CAAC;AAQ3D,IAAI,sBAA6C;AACjD,IAAI,kBAA2B;AAC/B,IAAI,sBAA+B;AACnC,IAAI,mBAA6D;AACjE,IAAI,kCAA2C;AAQ/C,IAAM,uBAAN,cAAmC,2BAAa;AAAA,EAC7B;AAAA,EACjB,YAAY,UAAkB;AAC5B,UAAM;AACN,SAAK,WAAW;AAAA,EAClB;AAAA,EACA,cAAsB;AACpB,WAAO,KAAK;AAAA,EACd;AAAA,EACA,kBAAkB,UAAuD;AACvE,UAAM,KAAK,EAAE,QAAQ,qBAAqB,MAAM,CAAC,EAAE,CAAC;AACpD,SAAK,GAAG,SAAS,QAAQ;AACzB,WAAO;AAAA,MACL,KAAK,MAAM;AACT,aAAK,IAAI,SAAS,QAAQ;AAA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A,EACF;AACF;","names":["examples_exports","examples_exports","env_exports","minimal","step_exports","env_exports","push","simulation","step_exports","pageView","silentRule","import_core","minimal","import_dev","import_dev","import_dev","import_dev","SettingsSchema","import_dev","MappingSchema","import_dev","settings","SettingsSchema","mapping","MappingSchema","mapping","settings","examples_exports","settings","mapping"]}
|
package/dist/dev.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createRequire as e}from"module";e(import.meta.url);var t=Object.defineProperty,r=(e,r)=>{for(var s in r)t(e,s,{get:r[s],enumerable:!0})},s={};r(s,{env:()=>i,minimal:()=>I,step:()=>v});var i={};r(i,{push:()=>f,simulation:()=>y});import{EventEmitter as a}from"events";var o=[],n=null,l=null,c=null,p=null,u=null,d=class extends a{streamId;constructor(e){super(),this.streamId=e}getStreamId(){return this.streamId}onConnectionError(e){return o.push({method:"onConnectionError",args:[]}),this.on("error",e),{off:()=>{this.off("error",e)}}}__emitConnectionError(e){this.emit("error",e)}},g=[],m={convertStorageSchemaToProto2Descriptor:(e,t)=>(o.push({method:"adapt.convertStorageSchemaToProto2Descriptor",args:[e,t]}),{name:"root",field:[]})},b=class{constructor(e){o.push({method:"WriterClient.ctor",args:[e]})}async createStreamConnection(e,t){if("DEFAULT"!==e.streamId)throw new Error(`mock createStreamConnection: expected streamId='DEFAULT', got ${JSON.stringify(e)}`);o.push({method:"createStreamConnection",args:[e,t]});const r=u;if(null!==r)throw u=null,r;const s=new d(`${e.destinationTable}/streams/_default`);return g.push(s),s}async getWriteStream(e,t){return o.push({method:"getWriteStream",args:[e,t]}),{tableSchema:{fields:[]}}}close(){o.push({method:"WriterClient.close",args:[]})}},h=class{constructor(e){o.push({method:"JSONWriter.ctor",args:[e]})}appendRows(e,t){o.push({method:"appendRows",args:[e,t]});const r=l;if(null!==r)throw l=null,r;const s=n;n=null;const i=c;c=null;const a=p;return p=null,{getResult:async()=>{if(null!==i)throw i;return null!==a?{error:a,writeStream:"projects/p/datasets/d/tables/t/streams/_default"}:{appendResult:{offset:{value:"0"}},rowErrors:s??[],writeStream:"projects/p/datasets/d/tables/t/streams/_default"}}}}close(){o.push({method:"JSONWriter.close",args:[]})}};var f={get BigQuery(){return class{calls;options;constructor(e){this.options=e,this.calls=[]}dataset(e){return this.calls.push({method:"dataset",args:[e]}),this}table(e){return this.calls.push({method:"table",args:[e]}),this}async exists(){return this.calls.push({method:"exists",args:[]}),[!0]}async create(e){this.calls.push({method:"create",args:[e]})}async getMetadata(){return this.calls.push({method:"getMetadata",args:[]}),[{}]}}},get WriterClient(){return b},get JSONWriter(){return h},get adapt(){return m}},y=["call:JSONWriter.appendRows"],v={};r(v,{appendFailed:()=>E,pageView:()=>j,purchase:()=>P,silentRule:()=>R});import{getEvent as w}from"@walkeros/core";function S(e){return null==e?null:"object"==typeof e?Array.isArray(e)&&0===e.length?null:Array.isArray(e)||0!==Object.keys(e).length?JSON.stringify(e):null:JSON.stringify(e)}function k(e){return function(e){return{name:e.name,data:S(e.data),context:S(e.context),globals:S(e.globals),custom:S(e.custom),user:S(e.user),nested:S(e.nested),consent:S(e.consent),id:e.id,trigger:e.trigger,entity:e.entity,action:e.action,timestamp:1e3*new Date(e.timestamp).getTime(),timing:e.timing,source:S(e.source)}}(e)}var O=w("page view",{timestamp:17000011e5,data:{title:"Documentation",url:"https://example.com/docs"},source:{type:"express",platform:"server"}}),j={title:"Page view",description:"A page view is appended as one row through the BigQuery Storage Write API JSONWriter. Nested objects/arrays in data, source, etc. are JSON-stringified by eventToRow.",in:O,mapping:void 0,out:[["appendRows",[k(O)]]]},A=w("order complete",{timestamp:1700001101e3,data:{id:"ORD-500",value:199.99,items:[{sku:"SKU-1",qty:2}]},source:{type:"express",platform:"server"}}),P={title:"Purchase",description:"An order event is appended as a single row through JSONWriter.appendRows. The entire nested data object (including arrays like items) is JSON-stringified into the data column via eventToRow().",in:A,mapping:void 0,out:[["appendRows",[k(A)]]]},R={public:!1,description:"A rule with silent: true appends no row.",in:w("page view",{timestamp:1700000000500}),mapping:{silent:!0},out:[]},E={public:!1,description:"A failed Storage Write append fails the push, retryable, instead of counting as delivered.",in:w("page view",{timestamp:1700001102e3}),respond:{error:"network"},out:[["appendRows",[k(w("page view",{timestamp:1700001102e3}))]]],outcome:{status:"failed",code:"transport",retryable:!0}},I={settings:{projectId:"YOUR_PROJECT_ID"}},T={};r(T,{env:()=>C,minimal:()=>z,step:()=>J});var C={};r(C,{push:()=>N,simulation:()=>x});var D=class{constructor(e){this.name=e}name;publishMessage(e){return Promise.resolve("mock-message-id")}resumePublishing(e){}},N={PubSub:class{constructor(e){this.options=e}options;topic(e){return new D(e)}close(){return Promise.resolve()}}},x=["call:PubSub.topic.publishMessage"],J={};r(J,{defaultPush:()=>W,mappedAttributes:()=>F,mappedData:()=>G,mappedOrderingKey:()=>K,mappedTopic:()=>Q,pageView:()=>L,silentRule:()=>q});import{getEvent as M}from"@walkeros/core";var _=M("order complete",{timestamp:17000011e5,data:{id:"ORD-500",value:199.99,currency:"EUR"},user:{id:"usr-789"},source:{type:"express",platform:"server",trace:"1a2b3c4d5e6f70819a2b3c4d5e6f7081",count:1}}),B=M("page view",{timestamp:1700001101e3,data:{title:"Documentation",url:"https://example.com/docs"},source:{type:"express",platform:"server",trace:"9f8e7d6c5b4a39281706f5e4d3c2b1a0",count:1}});function U(e){const t=e.source.platform??"default",r={...e,source:{...e.source,release:{[t]:"4.9.0-next-1793116456867"}}};return Buffer.from(JSON.stringify(r))}var W={title:"Default publish",description:"An event is published to the configured Pub/Sub topic with the full JSON event as the message body and no ordering key.",in:_,out:[["topic","events",{messageOrdering:!1}],["publishMessage","events",{data:U(_)}]]},Q={title:"Topic override",description:"A mapping rule overrides the destination default topic so order events are published to a dedicated topic.",in:_,mapping:{settings:{topic:"orders"}},out:[["topic","orders",{messageOrdering:!1}],["publishMessage","orders",{data:U(_)}]]},K={title:"Ordering key from user",description:"A mapping resolves the ordering key from event.user.id, enabling per-user ordering for this publish.",in:_,mapping:{settings:{orderingKey:"user.id"}},out:[["topic","events",{messageOrdering:!0}],["publishMessage","events",{data:U(_),orderingKey:"usr-789"}]]},F={title:"Mapped attributes",description:"A mapping resolves a per-event attribute map, here exposing entity and action as Pub/Sub attributes for routing in subscribers.",in:_,mapping:{settings:{attributes:{entity:"entity",action:"action"}}},out:[["topic","events",{messageOrdering:!1}],["publishMessage","events",{data:U(_),attributes:{entity:"order",action:"complete"}}]]},G={title:"Mapped payload",description:"A data mapping transforms the event payload before publish. The rewritten object becomes the Pub/Sub message body.",in:_,mapping:{data:{map:{order_id:"data.id",revenue:"data.value",currency:"data.currency"}}},out:[["topic","events",{messageOrdering:!1}],["publishMessage","events",{data:Buffer.from(JSON.stringify({order_id:"ORD-500",revenue:199.99,currency:"EUR"}))}]]},L={title:"Page view",description:"A page view is published to the default topic with no ordering key, demonstrating the simplest publish path.",in:B,out:[["topic","events",{messageOrdering:!1}],["publishMessage","events",{data:U(B)}]]},q={public:!1,description:"A rule with silent: true publishes no message.",in:M("page view",{timestamp:1700000000500}),mapping:{silent:!0},out:[]},z={settings:{projectId:"YOUR_PROJECT_ID",topic:"events"}};import{zodToSchema as $}from"@walkeros/core/dev";import{z as Y}from"@walkeros/core/dev";var V=Y.object({client:Y.any().describe("Google Cloud BigQuery client instance (like new BigQuery({ projectId, keyFilename })). Used by walkeros setup only; event writes authenticate with config.credentials, settings.bigquery or the default credentials.").optional(),projectId:Y.string().min(1).describe("Google Cloud Project ID (like my-gcp-project)"),datasetId:Y.string().min(1).default("walkerOS").describe("BigQuery dataset ID where events will be stored (like walker_events)"),tableId:Y.string().min(1).default("events").describe("BigQuery table ID for event storage (like events)"),location:Y.string().default("EU").describe("Not read by the destination. walkeros setup creates the dataset in config.setup.location (like US), default EU."),bigquery:Y.any().describe('Additional BigQuery client configuration options (like { keyFilename: "path/to/key.json" })').optional()}).strict();import{z as X}from"@walkeros/core/dev";var H=X.object({}),Z=$(V),ee=$(H);import{zodToSchema as te}from"@walkeros/core/dev";import{z as re}from"@walkeros/core/dev";var se=re.object({client:re.any().describe("Google Cloud Pub/Sub client instance (like new PubSub({ projectId, keyFilename }))").optional(),projectId:re.string().min(1).describe("Google Cloud Project ID (like my-gcp-project)"),topic:re.string().min(1).describe("Pub/Sub topic short name (like events). The full resource name projects/<projectId>/topics/<topic> is built by the SDK."),credentials:re.any().describe("Service account credentials as a JSON string or an object with client_email and private_key. Default: Application Default Credentials (ADC). (deprecated: use config.credentials)").optional(),apiEndpoint:re.string().describe("Override Pub/Sub API endpoint. Useful for the local emulator (like localhost:8085).").optional(),orderingKey:re.any().describe("Mapping value resolved per-event. Truthy enables per-key ordering for the publish.").optional(),attributes:re.any().describe("Default per-event attribute map merged into every published message. Mapping.Map shape.").optional()}).strict();import{z as ie}from"@walkeros/core/dev";var ae=ie.object({topic:ie.string().describe("Per-rule topic override. Falls back to settings.topic if absent.").optional(),orderingKey:ie.any().describe("Per-rule ordering-key Mapping.Value. Overrides settings.orderingKey when set.").optional(),attributes:ie.any().describe("Per-rule attribute Mapping.Map merged on top of settings.attributes.").optional()});import{z as oe}from"@walkeros/core/dev";var ne=oe.object({messageStoragePolicy:oe.object({allowedPersistenceRegions:oe.array(oe.string()).describe("Geographic regions for at-rest message storage (like europe-west1). Default: europe-west1, europe-west3 and europe-west4.")}).describe("Topic-level message storage policy.").optional(),messageRetentionDuration:oe.object({seconds:oe.number().describe("Retention window in seconds. Default: project default.")}).describe("Topic-level retention configuration.").optional(),kmsKeyName:oe.string().describe("Customer-managed encryption key (CMEK) resource name. Optional.").optional(),labels:oe.record(oe.string(),oe.string()).describe("Topic labels for organization and billing.").optional()}),le=te(se),ce=te(ae),pe=te(ne),ue={};r(ue,{mapping:()=>ee,pubsubMapping:()=>ce,pubsubSettings:()=>le,pubsubSetup:()=>pe,settings:()=>Z});var de={"auth-methods":{text:'BigQuery authenticates three ways. config.credentials: a service account key as a JSON string or object, backed by $secret, used by walkeros setup and by event writes. settings.bigquery: raw client options such as { keyFilename: "./sa.json" }, passed to both clients. Neither set: Application Default Credentials (the attached service account on GCP compute, GOOGLE_APPLICATION_CREDENTIALS elsewhere). A pre-built settings.client is used by walkeros setup only, never for event writes.',code:[{lang:"json",code:'{ "settings": { "projectId": "my-project" }, "credentials": "$secret.BIGQUERY_SA_KEY" }'},{lang:"json",code:'{ "settings": { "projectId": "my-project" } }'}]},"storage-format":{text:'All events go to one table, by default dataset "walkerOS" and table "events" (settings.datasetId, settings.tableId). Each event is one row of 15 columns: name, id, trigger, entity and action as strings, timestamp as a TIMESTAMP, timing as a number, and the object fields (data, context, globals, custom, user, nested, consent, source) as JSON. walkeros setup creates the dataset in config.setup.location (default EU) and the table, partitioned by day on timestamp.'},"query-json-columns":{text:"The object fields (data, context, globals, user and the others) are JSON columns in the default table. Query them with BigQuery JSON functions such as JSON_EXTRACT_SCALAR; paths follow the walkerOS event structure.",code:[{lang:"sql",code:"SELECT JSON_EXTRACT_SCALAR(data, '$.value') AS value FROM `project.walkerOS.events` WHERE entity = 'order'"}]},"troubleshoot-empty-table":{text:"Events not appearing? The collector logs the first failed write of each cause as an ERROR line and counts repeats within a minute in status.destinations.<id>.failed. Common causes: the dataset or table does not exist (set config.setup: true and run walkeros setup destination.<id> once; without config.setup the command skips), projectId names another project, or the service account lacks roles/bigquery.dataEditor. projectId is checked when the destination starts; the table is opened at the first event."}},ge={destinationBigQuery:s,destinationPubSub:T},me={destinationBigQuery:{settings:Z,mapping:ee},destinationPubSub:{settings:le,mapping:ce,setup:pe}};export{s as examples,ge as exportExamples,me as exportSchemas,de as hints,T as pubsubExamples,ue as schemas};//# sourceMappingURL=dev.mjs.map
|
|
1
|
+
import{createRequire as e}from"module";e(import.meta.url);var t=Object.defineProperty,r=(e,r)=>{for(var s in r)t(e,s,{get:r[s],enumerable:!0})},s={};r(s,{env:()=>i,minimal:()=>I,step:()=>v});var i={};r(i,{push:()=>f,simulation:()=>y});import{EventEmitter as a}from"events";var o=[],n=null,l=null,c=null,p=null,u=null,d=class extends a{streamId;constructor(e){super(),this.streamId=e}getStreamId(){return this.streamId}onConnectionError(e){return o.push({method:"onConnectionError",args:[]}),this.on("error",e),{off:()=>{this.off("error",e)}}}__emitConnectionError(e){this.emit("error",e)}},g=[],m={convertStorageSchemaToProto2Descriptor:(e,t)=>(o.push({method:"adapt.convertStorageSchemaToProto2Descriptor",args:[e,t]}),{name:"root",field:[]})},b=class{constructor(e){o.push({method:"WriterClient.ctor",args:[e]})}async createStreamConnection(e,t){if("DEFAULT"!==e.streamId)throw new Error(`mock createStreamConnection: expected streamId='DEFAULT', got ${JSON.stringify(e)}`);o.push({method:"createStreamConnection",args:[e,t]});const r=u;if(null!==r)throw u=null,r;const s=new d(`${e.destinationTable}/streams/_default`);return g.push(s),s}async getWriteStream(e,t){return o.push({method:"getWriteStream",args:[e,t]}),{tableSchema:{fields:[]}}}close(){o.push({method:"WriterClient.close",args:[]})}},h=class{constructor(e){o.push({method:"JSONWriter.ctor",args:[e]})}appendRows(e,t){o.push({method:"appendRows",args:[e,t]});const r=l;if(null!==r)throw l=null,r;const s=n;n=null;const i=c;c=null;const a=p;return p=null,{getResult:async()=>{if(null!==i)throw i;return null!==a?{error:a,writeStream:"projects/p/datasets/d/tables/t/streams/_default"}:{appendResult:{offset:{value:"0"}},rowErrors:s??[],writeStream:"projects/p/datasets/d/tables/t/streams/_default"}}}}close(){o.push({method:"JSONWriter.close",args:[]})}};var f={get BigQuery(){return class{calls;options;constructor(e){this.options=e,this.calls=[]}dataset(e){return this.calls.push({method:"dataset",args:[e]}),this}table(e){return this.calls.push({method:"table",args:[e]}),this}async exists(){return this.calls.push({method:"exists",args:[]}),[!0]}async create(e){this.calls.push({method:"create",args:[e]})}async getMetadata(){return this.calls.push({method:"getMetadata",args:[]}),[{}]}}},get WriterClient(){return b},get JSONWriter(){return h},get adapt(){return m}},y=["call:JSONWriter.appendRows"],v={};r(v,{appendFailed:()=>E,pageView:()=>j,purchase:()=>P,silentRule:()=>R});import{getEvent as w}from"@walkeros/core";function S(e){return null==e?null:"object"==typeof e?Array.isArray(e)&&0===e.length?null:Array.isArray(e)||0!==Object.keys(e).length?JSON.stringify(e):null:JSON.stringify(e)}function k(e){return function(e){return{name:e.name,data:S(e.data),context:S(e.context),globals:S(e.globals),custom:S(e.custom),user:S(e.user),nested:S(e.nested),consent:S(e.consent),id:e.id,trigger:e.trigger,entity:e.entity,action:e.action,timestamp:1e3*new Date(e.timestamp).getTime(),timing:e.timing,source:S(e.source)}}(e)}var O=w("page view",{timestamp:17000011e5,data:{title:"Documentation",url:"https://example.com/docs"},source:{type:"express",platform:"server"}}),j={title:"Page view",description:"A page view is appended as one row through the BigQuery Storage Write API JSONWriter. Nested objects/arrays in data, source, etc. are JSON-stringified by eventToRow.",in:O,mapping:void 0,out:[["appendRows",[k(O)]]]},A=w("order complete",{timestamp:1700001101e3,data:{id:"ORD-500",value:199.99,items:[{sku:"SKU-1",qty:2}]},source:{type:"express",platform:"server"}}),P={title:"Purchase",description:"An order event is appended as a single row through JSONWriter.appendRows. The entire nested data object (including arrays like items) is JSON-stringified into the data column via eventToRow().",in:A,mapping:void 0,out:[["appendRows",[k(A)]]]},R={public:!1,description:"A rule with silent: true appends no row.",in:w("page view",{timestamp:1700000000500}),mapping:{silent:!0},out:[]},E={public:!1,description:"A failed Storage Write append fails the push, retryable, instead of counting as delivered.",in:w("page view",{timestamp:1700001102e3}),respond:{error:"network"},out:[["appendRows",[k(w("page view",{timestamp:1700001102e3}))]]],outcome:{status:"failed",code:"transport",retryable:!0}},I={settings:{projectId:"YOUR_PROJECT_ID"}},T={};r(T,{env:()=>C,minimal:()=>z,step:()=>J});var C={};r(C,{push:()=>N,simulation:()=>x});var D=class{constructor(e){this.name=e}name;publishMessage(e){return Promise.resolve("mock-message-id")}resumePublishing(e){}},N={PubSub:class{constructor(e){this.options=e}options;topic(e){return new D(e)}close(){return Promise.resolve()}}},x=["call:PubSub.topic.publishMessage"],J={};r(J,{defaultPush:()=>W,mappedAttributes:()=>F,mappedData:()=>G,mappedOrderingKey:()=>K,mappedTopic:()=>Q,pageView:()=>L,silentRule:()=>q});import{getEvent as M}from"@walkeros/core";var _=M("order complete",{timestamp:17000011e5,data:{id:"ORD-500",value:199.99,currency:"EUR"},user:{id:"usr-789"},source:{type:"express",platform:"server",trace:"1a2b3c4d5e6f70819a2b3c4d5e6f7081",count:1}}),B=M("page view",{timestamp:1700001101e3,data:{title:"Documentation",url:"https://example.com/docs"},source:{type:"express",platform:"server",trace:"9f8e7d6c5b4a39281706f5e4d3c2b1a0",count:1}});function U(e){const t=e.source.platform??"default",r={...e,source:{...e.source,release:{[t]:"4.9.0"}}};return Buffer.from(JSON.stringify(r))}var W={title:"Default publish",description:"An event is published to the configured Pub/Sub topic with the full JSON event as the message body and no ordering key.",in:_,out:[["topic","events",{messageOrdering:!1}],["publishMessage","events",{data:U(_)}]]},Q={title:"Topic override",description:"A mapping rule overrides the destination default topic so order events are published to a dedicated topic.",in:_,mapping:{settings:{topic:"orders"}},out:[["topic","orders",{messageOrdering:!1}],["publishMessage","orders",{data:U(_)}]]},K={title:"Ordering key from user",description:"A mapping resolves the ordering key from event.user.id, enabling per-user ordering for this publish.",in:_,mapping:{settings:{orderingKey:"user.id"}},out:[["topic","events",{messageOrdering:!0}],["publishMessage","events",{data:U(_),orderingKey:"usr-789"}]]},F={title:"Mapped attributes",description:"A mapping resolves a per-event attribute map, here exposing entity and action as Pub/Sub attributes for routing in subscribers.",in:_,mapping:{settings:{attributes:{entity:"entity",action:"action"}}},out:[["topic","events",{messageOrdering:!1}],["publishMessage","events",{data:U(_),attributes:{entity:"order",action:"complete"}}]]},G={title:"Mapped payload",description:"A data mapping transforms the event payload before publish. The rewritten object becomes the Pub/Sub message body.",in:_,mapping:{data:{map:{order_id:"data.id",revenue:"data.value",currency:"data.currency"}}},out:[["topic","events",{messageOrdering:!1}],["publishMessage","events",{data:Buffer.from(JSON.stringify({order_id:"ORD-500",revenue:199.99,currency:"EUR"}))}]]},L={title:"Page view",description:"A page view is published to the default topic with no ordering key, demonstrating the simplest publish path.",in:B,out:[["topic","events",{messageOrdering:!1}],["publishMessage","events",{data:U(B)}]]},q={public:!1,description:"A rule with silent: true publishes no message.",in:M("page view",{timestamp:1700000000500}),mapping:{silent:!0},out:[]},z={settings:{projectId:"YOUR_PROJECT_ID",topic:"events"}};import{zodToSchema as $}from"@walkeros/core/dev";import{z as Y}from"@walkeros/core/dev";var V=Y.object({client:Y.any().describe("Google Cloud BigQuery client instance (like new BigQuery({ projectId, keyFilename })). Used by walkeros setup only; event writes authenticate with config.credentials, settings.bigquery or the default credentials.").optional(),projectId:Y.string().min(1).describe("Google Cloud Project ID (like my-gcp-project)"),datasetId:Y.string().min(1).default("walkerOS").describe("BigQuery dataset ID where events will be stored (like walker_events)"),tableId:Y.string().min(1).default("events").describe("BigQuery table ID for event storage (like events)"),location:Y.string().default("EU").describe("Not read by the destination. walkeros setup creates the dataset in config.setup.location (like US), default EU."),bigquery:Y.any().describe('Additional BigQuery client configuration options (like { keyFilename: "path/to/key.json" })').optional()}).strict();import{z as X}from"@walkeros/core/dev";var H=X.object({}),Z=$(V),ee=$(H);import{zodToSchema as te}from"@walkeros/core/dev";import{z as re}from"@walkeros/core/dev";var se=re.object({client:re.any().describe("Google Cloud Pub/Sub client instance (like new PubSub({ projectId, keyFilename }))").optional(),projectId:re.string().min(1).describe("Google Cloud Project ID (like my-gcp-project)"),topic:re.string().min(1).describe("Pub/Sub topic short name (like events). The full resource name projects/<projectId>/topics/<topic> is built by the SDK."),credentials:re.any().describe("Service account credentials as a JSON string or an object with client_email and private_key. Default: Application Default Credentials (ADC). (deprecated: use config.credentials)").optional(),apiEndpoint:re.string().describe("Override Pub/Sub API endpoint. Useful for the local emulator (like localhost:8085).").optional(),orderingKey:re.any().describe("Mapping value resolved per-event. Truthy enables per-key ordering for the publish.").optional(),attributes:re.any().describe("Default per-event attribute map merged into every published message. Mapping.Map shape.").optional()}).strict();import{z as ie}from"@walkeros/core/dev";var ae=ie.object({topic:ie.string().describe("Per-rule topic override. Falls back to settings.topic if absent.").optional(),orderingKey:ie.any().describe("Per-rule ordering-key Mapping.Value. Overrides settings.orderingKey when set.").optional(),attributes:ie.any().describe("Per-rule attribute Mapping.Map merged on top of settings.attributes.").optional()});import{z as oe}from"@walkeros/core/dev";var ne=oe.object({messageStoragePolicy:oe.object({allowedPersistenceRegions:oe.array(oe.string()).describe("Geographic regions for at-rest message storage (like europe-west1). Default: europe-west1, europe-west3 and europe-west4.")}).describe("Topic-level message storage policy.").optional(),messageRetentionDuration:oe.object({seconds:oe.number().describe("Retention window in seconds. Default: project default.")}).describe("Topic-level retention configuration.").optional(),kmsKeyName:oe.string().describe("Customer-managed encryption key (CMEK) resource name. Optional.").optional(),labels:oe.record(oe.string(),oe.string()).describe("Topic labels for organization and billing.").optional()}),le=te(se),ce=te(ae),pe=te(ne),ue={};r(ue,{mapping:()=>ee,pubsubMapping:()=>ce,pubsubSettings:()=>le,pubsubSetup:()=>pe,settings:()=>Z});var de={"auth-methods":{text:'BigQuery authenticates three ways. config.credentials: a service account key as a JSON string or object, backed by $secret, used by walkeros setup and by event writes. settings.bigquery: raw client options such as { keyFilename: "./sa.json" }, passed to both clients. Neither set: Application Default Credentials (the attached service account on GCP compute, GOOGLE_APPLICATION_CREDENTIALS elsewhere). A pre-built settings.client is used by walkeros setup only, never for event writes.',code:[{lang:"json",code:'{ "settings": { "projectId": "my-project" }, "credentials": "$secret.BIGQUERY_SA_KEY" }'},{lang:"json",code:'{ "settings": { "projectId": "my-project" } }'}]},"storage-format":{text:'All events go to one table, by default dataset "walkerOS" and table "events" (settings.datasetId, settings.tableId). Each event is one row of 15 columns: name, id, trigger, entity and action as strings, timestamp as a TIMESTAMP, timing as a number, and the object fields (data, context, globals, custom, user, nested, consent, source) as JSON. walkeros setup creates the dataset in config.setup.location (default EU) and the table, partitioned by day on timestamp.'},"query-json-columns":{text:"The object fields (data, context, globals, user and the others) are JSON columns in the default table. Query them with BigQuery JSON functions such as JSON_EXTRACT_SCALAR; paths follow the walkerOS event structure.",code:[{lang:"sql",code:"SELECT JSON_EXTRACT_SCALAR(data, '$.value') AS value FROM `project.walkerOS.events` WHERE entity = 'order'"}]},"troubleshoot-empty-table":{text:"Events not appearing? The collector logs the first failed write of each cause as an ERROR line and counts repeats within a minute in status.destinations.<id>.failed. Common causes: the dataset or table does not exist (set config.setup: true and run walkeros setup destination.<id> once; without config.setup the command skips), projectId names another project, or the service account lacks roles/bigquery.dataEditor. projectId is checked when the destination starts; the table is opened at the first event."}},ge={destinationBigQuery:s,destinationPubSub:T},me={destinationBigQuery:{settings:Z,mapping:ee},destinationPubSub:{settings:le,mapping:ce,setup:pe}};export{s as examples,ge as exportExamples,me as exportSchemas,de as hints,T as pubsubExamples,ue as schemas};//# sourceMappingURL=dev.mjs.map
|
package/dist/dev.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/bigquery/examples/index.ts","../src/bigquery/examples/env.ts","../src/bigquery/__mocks__/@google-cloud/bigquery-storage.ts","../src/bigquery/examples/step.ts","../src/bigquery/eventToRow.ts","../src/bigquery/examples/minimal.ts","../src/pubsub/examples/index.ts","../src/pubsub/examples/env.ts","../src/pubsub/examples/step.ts","../src/pubsub/examples/minimal.ts","../src/bigquery/schemas/index.ts","../src/bigquery/schemas/settings.ts","../src/bigquery/schemas/mapping.ts","../src/pubsub/schemas/index.ts","../src/pubsub/schemas/settings.ts","../src/pubsub/schemas/mapping.ts","../src/pubsub/schemas/setup.ts","../src/schemas.ts","../src/hints.ts","../src/dev.ts"],"sourcesContent":["export * as env from './env';\nexport * as step from './step';\nexport { minimal } from './minimal';\n","import type { Env, QueryClient, TableMetadataShape } from '../types';\nimport {\n managedwriter as mockManagedwriter,\n adapt as mockAdapt,\n} from '../__mocks__/@google-cloud/bigquery-storage';\n\n/**\n * Example environment configurations for GCP BigQuery destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring actual BigQuery SDK dependencies.\n *\n * The Storage Write API mocks (WriterClient, JSONWriter, adapt) are\n * re-exported from the package-local __mocks__ folder so example/test\n * code shares a single source of truth with the jest auto-mock.\n */\n\n/**\n * Mock BigQuery query client: dataset and table provisioning calls resolve as\n * if both already exist.\n */\nfunction createMockBigQuery() {\n return class MockBigQuery implements QueryClient {\n calls: Array<{ method: string; args: unknown[] }>;\n options: unknown;\n\n constructor(options?: unknown) {\n this.options = options;\n this.calls = [];\n }\n\n dataset(datasetId: string) {\n this.calls.push({ method: 'dataset', args: [datasetId] });\n return this;\n }\n\n table(tableId: string) {\n this.calls.push({ method: 'table', args: [tableId] });\n return this;\n }\n\n async exists(): Promise<[boolean]> {\n this.calls.push({ method: 'exists', args: [] });\n return [true];\n }\n\n async create(options: unknown): Promise<void> {\n this.calls.push({ method: 'create', args: [options] });\n }\n\n async getMetadata(): Promise<[TableMetadataShape]> {\n this.calls.push({ method: 'getMetadata', args: [] });\n return [{}];\n }\n };\n}\n\n/**\n * Standard mock environment for push operations\n *\n * Use this for testing BigQuery Storage Write appends without connecting\n * to actual GCP infrastructure.\n */\nexport const push: Env = {\n get BigQuery() {\n return createMockBigQuery();\n },\n get WriterClient() {\n return mockManagedwriter.WriterClient;\n },\n get JSONWriter() {\n return mockManagedwriter.JSONWriter;\n },\n get adapt() {\n return mockAdapt;\n },\n};\n\n/**\n * Every row goes through the writer's `appendRows`; the writer is built from\n * `JSONWriter` in init, so the path continues on the constructed instance.\n * Constructors are not recorded: their arguments carry credentials.\n */\nexport const simulation = ['call:JSONWriter.appendRows'];\n","import { EventEmitter } from 'events';\n\nconst calls: Array<{ method: string; args: unknown[] }> = [];\n\ninterface MockRowError {\n index: number;\n code: number;\n message: string;\n}\n\nlet nextAppendRowErrors: MockRowError[] | null = null;\nlet nextAppendThrow: unknown = null;\nlet nextGetResultReject: unknown = null;\nlet nextAppendStatus: { code: number; message: string } | null = null;\nlet nextCreateStreamConnectionError: unknown = null;\n\n/**\n * Honest stand-in for the SDK's StreamConnection: a REAL Node EventEmitter so\n * `emit('error', …)` with no listener throws exactly like the real one (Node's\n * special-cased `'error'` event). `onConnectionError` mirrors the SDK surface:\n * it registers an `'error'` listener and returns an `{ off }` disposable.\n */\nclass MockStreamConnection extends EventEmitter {\n private readonly streamId: string;\n constructor(streamId: string) {\n super();\n this.streamId = streamId;\n }\n getStreamId(): string {\n return this.streamId;\n }\n onConnectionError(listener: (err: unknown) => void): { off: () => void } {\n calls.push({ method: 'onConnectionError', args: [] });\n this.on('error', listener);\n return {\n off: () => {\n this.off('error', listener);\n },\n };\n }\n /**\n * Test-only: literally `this.emit('error', err)` with NO internal\n * listener-count guard, so before a listener is attached this reproduces\n * Node's real \"throw if no 'error' listener\" behavior. A fake that silently\n * swallowed would mask the very crash this listener exists to contain.\n */\n __emitConnectionError(err: unknown): void {\n this.emit('error', err);\n }\n}\n\n// The most recently created connection, so tests can emit on it and assert the\n// listener was registered.\nlet lastConnection: MockStreamConnection | null = null;\n\n// Every connection ever created (this reset cycle), so tests can assert that a\n// concurrent re-open did not orphan a connection still carrying an 'error'\n// listener.\nconst allConnections: MockStreamConnection[] = [];\n\nclass MockJSONWriter {\n constructor(_args: { connection: unknown; protoDescriptor: unknown }) {\n calls.push({ method: 'JSONWriter.ctor', args: [_args] });\n }\n appendRows(rows: unknown[], offsetValue?: unknown) {\n calls.push({ method: 'appendRows', args: [rows, offsetValue] });\n const queuedThrow = nextAppendThrow;\n if (queuedThrow !== null) {\n nextAppendThrow = null;\n throw queuedThrow;\n }\n const queuedErrors = nextAppendRowErrors;\n nextAppendRowErrors = null;\n const queuedReject = nextGetResultReject;\n nextGetResultReject = null;\n const queuedStatus = nextAppendStatus;\n nextAppendStatus = null;\n return {\n getResult: async () => {\n // Models a gRPC deadline-exceeded (or any stream error): the append is\n // accepted but getResult() rejects when the stream's deadline fires.\n if (queuedReject !== null) throw queuedReject;\n // An error status the SDK does not retry resolves with `error` set\n // and no rowErrors.\n if (queuedStatus !== null)\n return {\n error: queuedStatus,\n writeStream: 'projects/p/datasets/d/tables/t/streams/_default',\n };\n return {\n appendResult: { offset: { value: '0' } },\n rowErrors: queuedErrors ?? [],\n writeStream: 'projects/p/datasets/d/tables/t/streams/_default',\n };\n },\n };\n }\n close(): void {\n calls.push({ method: 'JSONWriter.close', args: [] });\n }\n}\n\nclass MockWriterClient {\n constructor(args: {\n projectId?: string;\n keyFilename?: string;\n credentials?: unknown;\n scopes?: string | string[];\n }) {\n calls.push({ method: 'WriterClient.ctor', args: [args] });\n }\n async createStreamConnection(\n args: {\n destinationTable: string;\n streamId: string;\n },\n options?: unknown,\n ) {\n // Match the real SDK: callers must pass streamId=DefaultStream (not streamType)\n // for default-stream use. Passing streamType triggers a CreateWriteStream\n // call with type='DEFAULT', which BQ rejects as TYPE_UNSPECIFIED.\n if (args.streamId !== 'DEFAULT') {\n throw new Error(\n `mock createStreamConnection: expected streamId='DEFAULT', got ${JSON.stringify(args)}`,\n );\n }\n // args[1] captures the gax CallOptions (e.g. { timeout }) so tests can\n // assert the request deadline is forwarded to the appendRows stream.\n calls.push({ method: 'createStreamConnection', args: [args, options] });\n const queuedError = nextCreateStreamConnectionError;\n if (queuedError !== null) {\n nextCreateStreamConnectionError = null;\n throw queuedError;\n }\n const connection = new MockStreamConnection(\n `${args.destinationTable}/streams/_default`,\n );\n lastConnection = connection;\n allConnections.push(connection);\n return connection;\n }\n async getWriteStream(\n args: { streamId: string; view?: number },\n options?: unknown,\n ) {\n // args[1] captures the gax CallOptions so tests can assert the deadline\n // is forwarded to the unary schema fetch.\n calls.push({ method: 'getWriteStream', args: [args, options] });\n // Minimal tableSchema shape consumed by adapt.convertStorageSchemaToProto2Descriptor\n return {\n tableSchema: { fields: [] },\n };\n }\n close(): void {\n calls.push({ method: 'WriterClient.close', args: [] });\n }\n}\n\nconst adapt = {\n convertStorageSchemaToProto2Descriptor: (_schema: unknown, _root: string) => {\n calls.push({\n method: 'adapt.convertStorageSchemaToProto2Descriptor',\n args: [_schema, _root],\n });\n return { name: 'root', field: [] };\n },\n};\n\nconst managedwriter = {\n WriterClient: MockWriterClient,\n JSONWriter: MockJSONWriter,\n DefaultStream: 'DEFAULT',\n};\n\nconst protos = {\n google: {\n cloud: {\n bigquery: {\n storage: {\n v1: {\n WriteStreamView: {\n WRITE_STREAM_VIEW_UNSPECIFIED: 0,\n BASIC: 1,\n FULL: 2,\n },\n },\n },\n },\n },\n },\n};\n\n// Test-only helper. Not part of the real SDK.\nfunction __getMockCalls() {\n return calls;\n}\n\nfunction __resetMockCalls() {\n calls.length = 0;\n nextAppendRowErrors = null;\n nextAppendThrow = null;\n nextGetResultReject = null;\n nextAppendStatus = null;\n nextCreateStreamConnectionError = null;\n lastConnection = null;\n allConnections.length = 0;\n}\n\n/**\n * Test-only: the most recently created StreamConnection, so a test can emit an\n * out-of-band `'error'` on it (via `__emitConnectionError`) and assert the\n * destination attached a listener.\n */\nfunction __getLastConnection(): MockStreamConnection {\n if (!lastConnection) throw new Error('mock: no StreamConnection created yet');\n return lastConnection;\n}\n\n/**\n * Test-only: every StreamConnection created since the last reset, so a test can\n * assert that a concurrent re-open did not orphan a connection that still\n * carries an 'error' listener (a leak).\n */\nfunction __getAllConnections(): MockStreamConnection[] {\n return allConnections.slice();\n}\n\n/**\n * Test-only: queue rowErrors for the next appendRows().getResult() call.\n * Auto-resets after one use.\n */\nfunction __setNextAppendRowErrors(errors: MockRowError[]): void {\n nextAppendRowErrors = errors;\n}\n\n/**\n * Test-only: make the next appendRows() throw synchronously, simulating a\n * Storage Write API call failure. Auto-resets after one use.\n */\nfunction __setNextAppendThrow(err: unknown): void {\n nextAppendThrow = err;\n}\n\n/**\n * Test-only: make the next appendRows().getResult() reject, simulating a gRPC\n * deadline-exceeded (or any stream error) surfacing through the pending write.\n * Auto-resets after one use.\n */\nfunction __setNextGetResultReject(err: unknown): void {\n nextGetResultReject = err;\n}\n\n/**\n * Test-only: make the next appendRows().getResult() resolve with an error\n * status (a quota, a dropped table), as the SDK does for a status it does not\n * retry. Auto-resets after one use.\n */\nfunction __setNextAppendStatus(status: {\n code: number;\n message: string;\n}): void {\n nextAppendStatus = status;\n}\n\n/**\n * Test-only: queue an error for the next createStreamConnection() call so\n * tests can simulate openWriter failures (NotFound, INVALID_ARGUMENT, etc.).\n * Auto-resets after one use.\n */\nfunction __setNextOpenWriterError(err: unknown): void {\n nextCreateStreamConnectionError = err;\n}\n\nexport {\n managedwriter,\n adapt,\n protos,\n MockStreamConnection,\n __getMockCalls,\n __resetMockCalls,\n __getLastConnection,\n __getAllConnections,\n __setNextAppendRowErrors,\n __setNextAppendThrow,\n __setNextGetResultReject,\n __setNextAppendStatus,\n __setNextOpenWriterError,\n};\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\nimport { eventToRow } from '../eventToRow';\n\n/**\n * Mirror of push.ts via eventToRow() -- produces a flat 15-column row\n * with nested object/array values JSON-stringified. Imported directly\n * from the runtime helper so the step examples stay in sync with what\n * push.ts actually emits to JSONWriter.appendRows.\n */\nfunction expectedRow(event: WalkerOS.Event) {\n return eventToRow(event);\n}\n\n/**\n * Page view -- one row appended through JSONWriter.appendRows([row]).\n * Captured as a single intent-level call: ['appendRows', [row]].\n */\nconst pageViewEvent = getEvent('page view', {\n timestamp: 1700001100000,\n data: { title: 'Documentation', url: 'https://example.com/docs' },\n source: { type: 'express', platform: 'server' },\n});\n\nexport const pageView: Flow.StepExample = {\n title: 'Page view',\n description:\n 'A page view is appended as one row through the BigQuery Storage Write API JSONWriter. Nested objects/arrays in data, source, etc. are JSON-stringified by eventToRow.',\n in: pageViewEvent,\n mapping: undefined,\n out: [['appendRows', [expectedRow(pageViewEvent)]]],\n};\n\n/**\n * Purchase -- nested array in data.items is JSON.stringified into the\n * data column of the appended row.\n */\nconst purchaseEvent = getEvent('order complete', {\n timestamp: 1700001101000,\n data: {\n id: 'ORD-500',\n value: 199.99,\n items: [{ sku: 'SKU-1', qty: 2 }],\n },\n source: { type: 'express', platform: 'server' },\n});\n\nexport const purchase: Flow.StepExample = {\n title: 'Purchase',\n description:\n 'An order event is appended as a single row through JSONWriter.appendRows. The entire nested data object (including arrays like items) is JSON-stringified into the data column via eventToRow().',\n in: purchaseEvent,\n mapping: undefined,\n out: [['appendRows', [expectedRow(purchaseEvent)]]],\n};\n\n/** A silent rule appends no row. */\nexport const silentRule: Flow.StepExample = {\n public: false,\n description: 'A rule with silent: true appends no row.',\n in: getEvent('page view', { timestamp: 1700000000500 }),\n mapping: { silent: true },\n out: [],\n};\n\n/**\n * A failed append: the Storage Write call fails, so the row is not written\n * and the push fails, retryable, instead of counting as delivered. An append\n * the server answers with an error status (a quota, a dropped table) fails\n * the same way, retryable only for the statuses the SDK retries itself.\n */\nexport const appendFailed: Flow.StepExample = {\n public: false,\n description:\n 'A failed Storage Write append fails the push, retryable, instead of counting as delivered.',\n in: getEvent('page view', { timestamp: 1700001102000 }),\n respond: { error: 'network' },\n out: [\n [\n 'appendRows',\n [expectedRow(getEvent('page view', { timestamp: 1700001102000 }))],\n ],\n ],\n outcome: { status: 'failed', code: 'transport', retryable: true },\n};\n","import type { WalkerOS } from '@walkeros/core';\n\n/** Row shape passed to JSONWriter.appendRows. Values are JSON-serializable scalars or strings. */\nexport interface BigQueryRow {\n [key: string]: string | number | null;\n name: string;\n data: string | null;\n context: string | null;\n globals: string | null;\n custom: string | null;\n user: string | null;\n nested: string | null;\n consent: string | null;\n id: string;\n trigger: string;\n entity: string;\n action: string;\n timestamp: number;\n timing: number;\n source: string | null;\n}\n\nfunction jsonOrNull(value: unknown): string | null {\n if (value === undefined || value === null) return null;\n if (typeof value === 'object') {\n if (Array.isArray(value) && value.length === 0) return null;\n if (!Array.isArray(value) && Object.keys(value).length === 0) return null;\n return JSON.stringify(value);\n }\n return JSON.stringify(value);\n}\n\n/** Convert a walkerOS Event v4 into a 15-column BigQuery row in canonical order.\n *\n * Note: BQ Storage Write API encodes TIMESTAMP fields as INT64 microseconds\n * since epoch (the SDK calls Long.fromString on the value). ISO strings fail\n * with \"interior hyphen\" because Long.fromString sees the date hyphens as\n * non-numeric. Pass microseconds directly.\n */\nexport function eventToRow(event: WalkerOS.Event): BigQueryRow {\n return {\n name: event.name,\n data: jsonOrNull(event.data),\n context: jsonOrNull(event.context),\n globals: jsonOrNull(event.globals),\n custom: jsonOrNull(event.custom),\n user: jsonOrNull(event.user),\n nested: jsonOrNull(event.nested),\n consent: jsonOrNull(event.consent),\n id: event.id,\n trigger: event.trigger,\n entity: event.entity,\n action: event.action,\n timestamp: new Date(event.timestamp).getTime() * 1000, // microseconds since epoch\n timing: event.timing,\n source: jsonOrNull(event.source),\n };\n}\n","import type { Flow } from '@walkeros/core';\n\n/**\n * The setting BigQuery needs to deliver: the project ID. The credentials come\n * from the Google environment.\n */\nexport const minimal: Flow.MinimalExample = {\n settings: { projectId: 'YOUR_PROJECT_ID' },\n};\n","export * as env from './env';\nexport * as step from './step';\nexport { minimal } from './minimal';\n","import type {\n Env,\n PubSubPublisher,\n PublishMessage,\n TopicPublisher,\n} from '../types';\n\n/**\n * Example environment for the GCP Pub/Sub destination.\n *\n * `push` is the mock env simulate injects: `PubSub` builds a client whose\n * topics answer `publishMessage` locally, so nothing reaches GCP. Unit tests\n * still substitute the SDK module-wide via `jest.mock('@google-cloud/pubsub')`.\n */\n\nclass MockTopic implements TopicPublisher {\n constructor(public name: string) {}\n publishMessage(_message: PublishMessage): Promise<string> {\n return Promise.resolve('mock-message-id');\n }\n resumePublishing(_orderingKey: string): void {}\n}\n\nclass MockPubSub implements PubSubPublisher {\n constructor(public options?: object) {}\n topic(name: string): TopicPublisher {\n return new MockTopic(name);\n }\n close(): Promise<void> {\n return Promise.resolve();\n }\n}\n\nexport const push: Env = {\n PubSub: MockPubSub,\n};\n\n/** The publish carries the request; `args[0]` is the message. */\nexport const simulation = ['call:PubSub.topic.publishMessage'];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\n// Build-time version define. The upstream collector stamps source.release with\n// this on push, so the expected payload must mirror it rather than a literal,\n// else it breaks whenever the fixed version group is bumped (release).\ndeclare const __VERSION__: string;\n\n/**\n * Pub/Sub step examples. Each example's `out` is the array of recorded mock\n * calls produced by `push()`. The recording shape is:\n * ['topic', topicName, topicOptions] // implicit topic-handle creation\n * ['publishMessage', topicName, messageOptions]\n * ['resumePublishing', topicName, orderingKey] // only on publish failure\n */\n\n// Events reaching a server destination arrive already enriched by the upstream\n// collector, so they carry the run trace and per-run count. The collector\n// preserves these (stamp-if-absent), keeping the example deterministic.\nconst orderEvent = getEvent('order complete', {\n timestamp: 1700001100000,\n data: { id: 'ORD-500', value: 199.99, currency: 'EUR' },\n user: { id: 'usr-789' },\n source: {\n type: 'express',\n platform: 'server',\n trace: '1a2b3c4d5e6f70819a2b3c4d5e6f7081',\n count: 1,\n },\n});\n\nconst pageEvent = getEvent('page view', {\n timestamp: 1700001101000,\n data: { title: 'Documentation', url: 'https://example.com/docs' },\n source: {\n type: 'express',\n platform: 'server',\n trace: '9f8e7d6c5b4a39281706f5e4d3c2b1a0',\n count: 1,\n },\n});\n\nfunction expectedPayload(event: WalkerOS.Event): Buffer {\n // The harness pushes the event through an unconfigured collector, which stamps\n // source.release = { [name ?? platform ?? 'default']: __VERSION__ }. With no\n // collector name, the key is the event's platform. Mirror that here so the\n // expected message body matches the published (post-collector) event.\n const releaseKey = event.source.platform ?? 'default';\n const stamped = {\n ...event,\n source: { ...event.source, release: { [releaseKey]: __VERSION__ } },\n };\n return Buffer.from(JSON.stringify(stamped));\n}\n\n/**\n * Default publish, no mapping. Settings.topic = 'events'. The destination\n * constructs a topic handle inline with messageOrdering=false (no ordering\n * key resolved) and publishes the full event JSON as the message body.\n */\nexport const defaultPush: Flow.StepExample = {\n title: 'Default publish',\n description:\n 'An event is published to the configured Pub/Sub topic with the full JSON event as the message body and no ordering key.',\n in: orderEvent,\n out: [\n ['topic', 'events', { messageOrdering: false }],\n ['publishMessage', 'events', { data: expectedPayload(orderEvent) }],\n ],\n};\n\n/**\n * Per-rule topic override. Mapping carries `settings.topic = 'orders'`\n * which routes this rule to a dedicated topic.\n */\nexport const mappedTopic: Flow.StepExample = {\n title: 'Topic override',\n description:\n 'A mapping rule overrides the destination default topic so order events are published to a dedicated topic.',\n in: orderEvent,\n mapping: {\n settings: {\n topic: 'orders',\n },\n },\n out: [\n ['topic', 'orders', { messageOrdering: false }],\n ['publishMessage', 'orders', { data: expectedPayload(orderEvent) }],\n ],\n};\n\n/**\n * Per-rule ordering key resolved from the event. `mapping.orderingKey =\n * 'user.id'` is a Mapping.Value that resolves to the event's user.id. The\n * topic handle is constructed with messageOrdering=true and the publish\n * carries the resolved orderingKey.\n */\nexport const mappedOrderingKey: Flow.StepExample = {\n title: 'Ordering key from user',\n description:\n 'A mapping resolves the ordering key from event.user.id, enabling per-user ordering for this publish.',\n in: orderEvent,\n mapping: {\n settings: {\n orderingKey: 'user.id',\n },\n },\n out: [\n ['topic', 'events', { messageOrdering: true }],\n [\n 'publishMessage',\n 'events',\n {\n data: expectedPayload(orderEvent),\n orderingKey: 'usr-789',\n },\n ],\n ],\n};\n\n/**\n * Per-rule attributes. `mapping.attributes = { entity: 'entity', action:\n * 'action' }` is a Mapping.Map resolved per event. Each value is a path\n * resolved against the event.\n */\nexport const mappedAttributes: Flow.StepExample = {\n title: 'Mapped attributes',\n description:\n 'A mapping resolves a per-event attribute map, here exposing entity and action as Pub/Sub attributes for routing in subscribers.',\n in: orderEvent,\n mapping: {\n settings: {\n attributes: {\n entity: 'entity',\n action: 'action',\n },\n },\n },\n out: [\n ['topic', 'events', { messageOrdering: false }],\n [\n 'publishMessage',\n 'events',\n {\n data: expectedPayload(orderEvent),\n attributes: { entity: 'order', action: 'complete' },\n },\n ],\n ],\n};\n\n/**\n * Mapped data. `mapping.data` rewrites the publish body. The rewritten\n * object replaces the event as the message data.\n */\nexport const mappedData: Flow.StepExample = {\n title: 'Mapped payload',\n description:\n 'A data mapping transforms the event payload before publish. The rewritten object becomes the Pub/Sub message body.',\n in: orderEvent,\n mapping: {\n data: {\n map: {\n order_id: 'data.id',\n revenue: 'data.value',\n currency: 'data.currency',\n },\n },\n },\n out: [\n ['topic', 'events', { messageOrdering: false }],\n [\n 'publishMessage',\n 'events',\n {\n // Mapped-data publish: the body is the mapping result (no event\n // envelope, so no source.release), emitted verbatim.\n data: Buffer.from(\n JSON.stringify({\n order_id: 'ORD-500',\n revenue: 199.99,\n currency: 'EUR',\n }),\n ),\n },\n ],\n ],\n};\n\n/**\n * Page view, no rule. Verifies free-form publish on a non-ordered topic\n * for an event with no special mapping.\n */\nexport const pageView: Flow.StepExample = {\n title: 'Page view',\n description:\n 'A page view is published to the default topic with no ordering key, demonstrating the simplest publish path.',\n in: pageEvent,\n out: [\n ['topic', 'events', { messageOrdering: false }],\n ['publishMessage', 'events', { data: expectedPayload(pageEvent) }],\n ],\n};\n\n/** A silent rule publishes no message. */\nexport const silentRule: Flow.StepExample = {\n public: false,\n description: 'A rule with silent: true publishes no message.',\n in: getEvent('page view', { timestamp: 1700000000500 }),\n mapping: { silent: true },\n out: [],\n};\n","import type { Flow } from '@walkeros/core';\n\n/**\n * The settings Pub/Sub needs to deliver: the project ID and the topic. The\n * credentials come from the Google environment.\n */\nexport const minimal: Flow.MinimalExample = {\n settings: { projectId: 'YOUR_PROJECT_ID', topic: 'events' },\n};\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z\n .object({\n client: z\n .any()\n .describe(\n 'Google Cloud BigQuery client instance (like new BigQuery({ projectId, keyFilename })). Used by walkeros setup only; event writes authenticate with config.credentials, settings.bigquery or the default credentials.',\n )\n .optional(),\n projectId: z\n .string()\n .min(1)\n .describe('Google Cloud Project ID (like my-gcp-project)'),\n datasetId: z\n .string()\n .min(1)\n .default('walkerOS')\n .describe(\n 'BigQuery dataset ID where events will be stored (like walker_events)',\n ),\n tableId: z\n .string()\n .min(1)\n .default('events')\n .describe('BigQuery table ID for event storage (like events)'),\n location: z\n .string()\n .default('EU')\n .describe(\n 'Not read by the destination. walkeros setup creates the dataset in config.setup.location (like US), default EU.',\n ),\n bigquery: z\n .any()\n .describe(\n 'Additional BigQuery client configuration options (like { keyFilename: \"path/to/key.json\" })',\n )\n .optional(),\n })\n .strict();\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * GCP BigQuery Mapping Schema\n * BigQuery has no event-level mapping configuration\n */\nexport const MappingSchema = z.object({});\n\n/**\n * Type inference from MappingSchema\n */\nexport type Mapping = z.infer<typeof MappingSchema>;\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\nimport { SetupSchema } from './setup';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\nexport { SetupSchema, type Setup } from './setup';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\nexport const setup = zodToSchema(SetupSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z\n .object({\n client: z\n .any()\n .describe(\n 'Google Cloud Pub/Sub client instance (like new PubSub({ projectId, keyFilename }))',\n )\n .optional(),\n projectId: z\n .string()\n .min(1)\n .describe('Google Cloud Project ID (like my-gcp-project)'),\n topic: z\n .string()\n .min(1)\n .describe(\n 'Pub/Sub topic short name (like events). The full resource name projects/<projectId>/topics/<topic> is built by the SDK.',\n ),\n credentials: z\n .any()\n .describe(\n 'Service account credentials as a JSON string or an object with client_email and private_key. Default: Application Default Credentials (ADC). (deprecated: use config.credentials)',\n )\n .optional(),\n apiEndpoint: z\n .string()\n .describe(\n 'Override Pub/Sub API endpoint. Useful for the local emulator (like localhost:8085).',\n )\n .optional(),\n orderingKey: z\n .any()\n .describe(\n 'Mapping value resolved per-event. Truthy enables per-key ordering for the publish.',\n )\n .optional(),\n attributes: z\n .any()\n .describe(\n 'Default per-event attribute map merged into every published message. Mapping.Map shape.',\n )\n .optional(),\n })\n .strict();\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * GCP Pub/Sub Mapping Schema\n *\n * Per-rule overrides for topic, orderingKey, and attributes.\n */\nexport const MappingSchema = z.object({\n topic: z\n .string()\n .describe(\n 'Per-rule topic override. Falls back to settings.topic if absent.',\n )\n .optional(),\n orderingKey: z\n .any()\n .describe(\n 'Per-rule ordering-key Mapping.Value. Overrides settings.orderingKey when set.',\n )\n .optional(),\n attributes: z\n .any()\n .describe(\n 'Per-rule attribute Mapping.Map merged on top of settings.attributes.',\n )\n .optional(),\n});\n\n/**\n * Type inference from MappingSchema\n */\nexport type Mapping = z.infer<typeof MappingSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * GCP Pub/Sub Setup Schema\n *\n * Provisioning options for `walkeros setup destination.<id>`. Idempotent topic\n * creation. Subscription provisioning is owned by the source side.\n */\nexport const SetupSchema = z.object({\n messageStoragePolicy: z\n .object({\n allowedPersistenceRegions: z\n .array(z.string())\n .describe(\n 'Geographic regions for at-rest message storage (like europe-west1). Default: europe-west1, europe-west3 and europe-west4.',\n ),\n })\n .describe('Topic-level message storage policy.')\n .optional(),\n messageRetentionDuration: z\n .object({\n seconds: z\n .number()\n .describe('Retention window in seconds. Default: project default.'),\n })\n .describe('Topic-level retention configuration.')\n .optional(),\n kmsKeyName: z\n .string()\n .describe('Customer-managed encryption key (CMEK) resource name. Optional.')\n .optional(),\n labels: z\n .record(z.string(), z.string())\n .describe('Topic labels for organization and billing.')\n .optional(),\n});\n\nexport type Setup = z.infer<typeof SetupSchema>;\n","// Browser-safe schema-only exports\n// This file exports ONLY schemas without any Node.js dependencies\nexport { settings, mapping } from './bigquery/schemas';\nexport {\n settings as pubsubSettings,\n mapping as pubsubMapping,\n setup as pubsubSetup,\n} from './pubsub/schemas';\n","import type { Hint } from '@walkeros/core';\n\nexport const hints: Hint.Hints = {\n 'auth-methods': {\n text: 'BigQuery authenticates three ways. config.credentials: a service account key as a JSON string or object, backed by $secret, used by walkeros setup and by event writes. settings.bigquery: raw client options such as { keyFilename: \"./sa.json\" }, passed to both clients. Neither set: Application Default Credentials (the attached service account on GCP compute, GOOGLE_APPLICATION_CREDENTIALS elsewhere). A pre-built settings.client is used by walkeros setup only, never for event writes.',\n code: [\n {\n lang: 'json',\n code: '{ \"settings\": { \"projectId\": \"my-project\" }, \"credentials\": \"$secret.BIGQUERY_SA_KEY\" }',\n },\n {\n lang: 'json',\n code: '{ \"settings\": { \"projectId\": \"my-project\" } }',\n },\n ],\n },\n 'storage-format': {\n text: 'All events go to one table, by default dataset \"walkerOS\" and table \"events\" (settings.datasetId, settings.tableId). Each event is one row of 15 columns: name, id, trigger, entity and action as strings, timestamp as a TIMESTAMP, timing as a number, and the object fields (data, context, globals, custom, user, nested, consent, source) as JSON. walkeros setup creates the dataset in config.setup.location (default EU) and the table, partitioned by day on timestamp.',\n },\n 'query-json-columns': {\n text: 'The object fields (data, context, globals, user and the others) are JSON columns in the default table. Query them with BigQuery JSON functions such as JSON_EXTRACT_SCALAR; paths follow the walkerOS event structure.',\n code: [\n {\n lang: 'sql',\n code: \"SELECT JSON_EXTRACT_SCALAR(data, '$.value') AS value FROM `project.walkerOS.events` WHERE entity = 'order'\",\n },\n ],\n },\n 'troubleshoot-empty-table': {\n text: 'Events not appearing? The collector logs the first failed write of each cause as an ERROR line and counts repeats within a minute in status.destinations.<id>.failed. Common causes: the dataset or table does not exist (set config.setup: true and run walkeros setup destination.<id> once; without config.setup the command skips), projectId names another project, or the service account lacks roles/bigquery.dataEditor. projectId is checked when the destination starts; the table is opened at the first event.',\n },\n};\n","import * as bigqueryExamplesNs from './bigquery/examples';\nimport * as pubsubExamplesNs from './pubsub/examples';\nimport * as bigquerySchemasNs from './bigquery/schemas';\nimport * as pubsubSchemasNs from './pubsub/schemas';\n\nexport * as schemas from './schemas';\nexport * as examples from './bigquery/examples';\nexport * as pubsubExamples from './pubsub/examples';\nexport { hints } from './hints';\n\n/** Dev examples per export, keyed by the export names in package.json. */\nexport const exportExamples = {\n destinationBigQuery: bigqueryExamplesNs,\n destinationPubSub: pubsubExamplesNs,\n};\n\n/** Schemas per export, keyed by the export names in package.json. */\nexport const exportSchemas = {\n destinationBigQuery: {\n settings: bigquerySchemasNs.settings,\n mapping: bigquerySchemasNs.mapping,\n },\n destinationPubSub: {\n settings: pubsubSchemasNs.settings,\n mapping: pubsubSchemasNs.mapping,\n setup: pubsubSchemasNs.setup,\n },\n};\n"],"mappings":";;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,SAAS,oBAAoB;AAE7B,IAAM,QAAoD,CAAC;AAQ3D,IAAI,sBAA6C;AACjD,IAAI,kBAA2B;AAC/B,IAAI,sBAA+B;AACnC,IAAI,mBAA6D;AACjE,IAAI,kCAA2C;AAQ/C,IAAM,uBAAN,cAAmC,aAAa;AAAA,EAC7B;AAAA,EACjB,YAAY,UAAkB;AAC5B,UAAM;AACN,SAAK,WAAW;AAAA,EAClB;AAAA,EACA,cAAsB;AACpB,WAAO,KAAK;AAAA,EACd;AAAA,EACA,kBAAkB,UAAuD;AACvE,UAAM,KAAK,EAAE,QAAQ,qBAAqB,MAAM,CAAC,EAAE,CAAC;AACpD,SAAK,GAAG,SAAS,QAAQ;AACzB,WAAO;AAAA,MACL,KAAK,MAAM;AACT,aAAK,IAAI,SAAS,QAAQ;AAAA,MAC5B;AAAA,IACF;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,sBAAsB,KAAoB;AACxC,SAAK,KAAK,SAAS,GAAG;AAAA,EACxB;AACF;AAIA,IAAI,iBAA8C;AAKlD,IAAM,iBAAyC,CAAC;AAEhD,IAAM,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AAAA,EACtE,CAAC,EACA,SAAS,sCAAsC,EAC/C,SAAS;AAAA,EACZ,YAAYA,GACT,OAAO,EACP,SAAS,iEAAiE,EAC1E,SAAS;AAAA,EACZ,QAAQA,GACL,OAAOA,GAAE,OAAO,GAAGA,GAAE,OAAO,CAAC,EAC7B,SAAS,4CAA4C,EACrD,SAAS;AACd,CAAC;;;AHzBM,IAAMC,YAAWC,aAAYC,eAAc;AAC3C,IAAMC,WAAUF,aAAYG,cAAa;AACzC,IAAM,QAAQH,aAAY,WAAW;;;AIZ5C;AAAA;AAAA;AAAA,uBAAAI;AAAA,EAAA,sBAAAC;AAAA,EAAA;AAAA;AAAA;;;ACEO,IAAM,QAAoB;AAAA,EAC/B,gBAAgB;AAAA,IACd,MAAM;AAAA,IACN,MAAM;AAAA,MACJ;AAAA,QACE,MAAM;AAAA,QACN,MAAM;AAAA,MACR;AAAA,MACA;AAAA,QACE,MAAM;AAAA,QACN,MAAM;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAAA,EACA,kBAAkB;AAAA,IAChB,MAAM;AAAA,EACR;AAAA,EACA,sBAAsB;AAAA,IACpB,MAAM;AAAA,IACN,MAAM;AAAA,MACJ;AAAA,QACE,MAAM;AAAA,QACN,MAAM;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAAA,EACA,4BAA4B;AAAA,IAC1B,MAAM;AAAA,EACR;AACF;;;ACpBO,IAAM,iBAAiB;AAAA,EAC5B,qBAAqB;AAAA,EACrB,mBAAmBC;AACrB;AAGO,IAAM,gBAAgB;AAAA,EAC3B,qBAAqB;AAAA,IACnB;AAAA,IACA;AAAA,EACF;AAAA,EACA,mBAAmB;AAAA,IACjB,UAA0BC;AAAA,IAC1B,SAAyBC;AAAA,IACzB;AAAA,EACF;AACF;","names":["examples_exports","env_exports","minimal","step_exports","env_exports","push","simulation","step_exports","pageView","silentRule","getEvent","minimal","z","zodToSchema","z","SettingsSchema","z","MappingSchema","z","settings","zodToSchema","SettingsSchema","mapping","MappingSchema","mapping","settings","examples_exports","settings","mapping"]}
|
|
1
|
+
{"version":3,"sources":["../src/bigquery/examples/index.ts","../src/bigquery/examples/env.ts","../src/bigquery/__mocks__/@google-cloud/bigquery-storage.ts","../src/bigquery/examples/step.ts","../src/bigquery/eventToRow.ts","../src/bigquery/examples/minimal.ts","../src/pubsub/examples/index.ts","../src/pubsub/examples/env.ts","../src/pubsub/examples/step.ts","../src/pubsub/examples/minimal.ts","../src/bigquery/schemas/index.ts","../src/bigquery/schemas/settings.ts","../src/bigquery/schemas/mapping.ts","../src/pubsub/schemas/index.ts","../src/pubsub/schemas/settings.ts","../src/pubsub/schemas/mapping.ts","../src/pubsub/schemas/setup.ts","../src/schemas.ts","../src/hints.ts","../src/dev.ts"],"sourcesContent":["export * as env from './env';\nexport * as step from './step';\nexport { minimal } from './minimal';\n","import type { Env, QueryClient, TableMetadataShape } from '../types';\nimport {\n managedwriter as mockManagedwriter,\n adapt as mockAdapt,\n} from '../__mocks__/@google-cloud/bigquery-storage';\n\n/**\n * Example environment configurations for GCP BigQuery destination\n *\n * These environments provide standardized mock structures for testing\n * and development without requiring actual BigQuery SDK dependencies.\n *\n * The Storage Write API mocks (WriterClient, JSONWriter, adapt) are\n * re-exported from the package-local __mocks__ folder so example/test\n * code shares a single source of truth with the jest auto-mock.\n */\n\n/**\n * Mock BigQuery query client: dataset and table provisioning calls resolve as\n * if both already exist.\n */\nfunction createMockBigQuery() {\n return class MockBigQuery implements QueryClient {\n calls: Array<{ method: string; args: unknown[] }>;\n options: unknown;\n\n constructor(options?: unknown) {\n this.options = options;\n this.calls = [];\n }\n\n dataset(datasetId: string) {\n this.calls.push({ method: 'dataset', args: [datasetId] });\n return this;\n }\n\n table(tableId: string) {\n this.calls.push({ method: 'table', args: [tableId] });\n return this;\n }\n\n async exists(): Promise<[boolean]> {\n this.calls.push({ method: 'exists', args: [] });\n return [true];\n }\n\n async create(options: unknown): Promise<void> {\n this.calls.push({ method: 'create', args: [options] });\n }\n\n async getMetadata(): Promise<[TableMetadataShape]> {\n this.calls.push({ method: 'getMetadata', args: [] });\n return [{}];\n }\n };\n}\n\n/**\n * Standard mock environment for push operations\n *\n * Use this for testing BigQuery Storage Write appends without connecting\n * to actual GCP infrastructure.\n */\nexport const push: Env = {\n get BigQuery() {\n return createMockBigQuery();\n },\n get WriterClient() {\n return mockManagedwriter.WriterClient;\n },\n get JSONWriter() {\n return mockManagedwriter.JSONWriter;\n },\n get adapt() {\n return mockAdapt;\n },\n};\n\n/**\n * Every row goes through the writer's `appendRows`; the writer is built from\n * `JSONWriter` in init, so the path continues on the constructed instance.\n * Constructors are not recorded: their arguments carry credentials.\n */\nexport const simulation = ['call:JSONWriter.appendRows'];\n","import { EventEmitter } from 'events';\n\nconst calls: Array<{ method: string; args: unknown[] }> = [];\n\ninterface MockRowError {\n index: number;\n code: number;\n message: string;\n}\n\nlet nextAppendRowErrors: MockRowError[] | null = null;\nlet nextAppendThrow: unknown = null;\nlet nextGetResultReject: unknown = null;\nlet nextAppendStatus: { code: number; message: string } | null = null;\nlet nextCreateStreamConnectionError: unknown = null;\n\n/**\n * Honest stand-in for the SDK's StreamConnection: a REAL Node EventEmitter so\n * `emit('error', …)` with no listener throws exactly like the real one (Node's\n * special-cased `'error'` event). `onConnectionError` mirrors the SDK surface:\n * it registers an `'error'` listener and returns an `{ off }` disposable.\n */\nclass MockStreamConnection extends EventEmitter {\n private readonly streamId: string;\n constructor(streamId: string) {\n super();\n this.streamId = streamId;\n }\n getStreamId(): string {\n return this.streamId;\n }\n onConnectionError(listener: (err: unknown) => void): { off: () => void } {\n calls.push({ method: 'onConnectionError', args: [] });\n this.on('error', listener);\n return {\n off: () => {\n this.off('error', listener);\n },\n };\n }\n /**\n * Test-only: literally `this.emit('error', err)` with NO internal\n * listener-count guard, so before a listener is attached this reproduces\n * Node's real \"throw if no 'error' listener\" behavior. A fake that silently\n * swallowed would mask the very crash this listener exists to contain.\n */\n __emitConnectionError(err: unknown): void {\n this.emit('error', err);\n }\n}\n\n// The most recently created connection, so tests can emit on it and assert the\n// listener was registered.\nlet lastConnection: MockStreamConnection | null = null;\n\n// Every connection ever created (this reset cycle), so tests can assert that a\n// concurrent re-open did not orphan a connection still carrying an 'error'\n// listener.\nconst allConnections: MockStreamConnection[] = [];\n\nclass MockJSONWriter {\n constructor(_args: { connection: unknown; protoDescriptor: unknown }) {\n calls.push({ method: 'JSONWriter.ctor', args: [_args] });\n }\n appendRows(rows: unknown[], offsetValue?: unknown) {\n calls.push({ method: 'appendRows', args: [rows, offsetValue] });\n const queuedThrow = nextAppendThrow;\n if (queuedThrow !== null) {\n nextAppendThrow = null;\n throw queuedThrow;\n }\n const queuedErrors = nextAppendRowErrors;\n nextAppendRowErrors = null;\n const queuedReject = nextGetResultReject;\n nextGetResultReject = null;\n const queuedStatus = nextAppendStatus;\n nextAppendStatus = null;\n return {\n getResult: async () => {\n // Models a gRPC deadline-exceeded (or any stream error): the append is\n // accepted but getResult() rejects when the stream's deadline fires.\n if (queuedReject !== null) throw queuedReject;\n // An error status the SDK does not retry resolves with `error` set\n // and no rowErrors.\n if (queuedStatus !== null)\n return {\n error: queuedStatus,\n writeStream: 'projects/p/datasets/d/tables/t/streams/_default',\n };\n return {\n appendResult: { offset: { value: '0' } },\n rowErrors: queuedErrors ?? [],\n writeStream: 'projects/p/datasets/d/tables/t/streams/_default',\n };\n },\n };\n }\n close(): void {\n calls.push({ method: 'JSONWriter.close', args: [] });\n }\n}\n\nclass MockWriterClient {\n constructor(args: {\n projectId?: string;\n keyFilename?: string;\n credentials?: unknown;\n scopes?: string | string[];\n }) {\n calls.push({ method: 'WriterClient.ctor', args: [args] });\n }\n async createStreamConnection(\n args: {\n destinationTable: string;\n streamId: string;\n },\n options?: unknown,\n ) {\n // Match the real SDK: callers must pass streamId=DefaultStream (not streamType)\n // for default-stream use. Passing streamType triggers a CreateWriteStream\n // call with type='DEFAULT', which BQ rejects as TYPE_UNSPECIFIED.\n if (args.streamId !== 'DEFAULT') {\n throw new Error(\n `mock createStreamConnection: expected streamId='DEFAULT', got ${JSON.stringify(args)}`,\n );\n }\n // args[1] captures the gax CallOptions (e.g. { timeout }) so tests can\n // assert the request deadline is forwarded to the appendRows stream.\n calls.push({ method: 'createStreamConnection', args: [args, options] });\n const queuedError = nextCreateStreamConnectionError;\n if (queuedError !== null) {\n nextCreateStreamConnectionError = null;\n throw queuedError;\n }\n const connection = new MockStreamConnection(\n `${args.destinationTable}/streams/_default`,\n );\n lastConnection = connection;\n allConnections.push(connection);\n return connection;\n }\n async getWriteStream(\n args: { streamId: string; view?: number },\n options?: unknown,\n ) {\n // args[1] captures the gax CallOptions so tests can assert the deadline\n // is forwarded to the unary schema fetch.\n calls.push({ method: 'getWriteStream', args: [args, options] });\n // Minimal tableSchema shape consumed by adapt.convertStorageSchemaToProto2Descriptor\n return {\n tableSchema: { fields: [] },\n };\n }\n close(): void {\n calls.push({ method: 'WriterClient.close', args: [] });\n }\n}\n\nconst adapt = {\n convertStorageSchemaToProto2Descriptor: (_schema: unknown, _root: string) => {\n calls.push({\n method: 'adapt.convertStorageSchemaToProto2Descriptor',\n args: [_schema, _root],\n });\n return { name: 'root', field: [] };\n },\n};\n\nconst managedwriter = {\n WriterClient: MockWriterClient,\n JSONWriter: MockJSONWriter,\n DefaultStream: 'DEFAULT',\n};\n\nconst protos = {\n google: {\n cloud: {\n bigquery: {\n storage: {\n v1: {\n WriteStreamView: {\n WRITE_STREAM_VIEW_UNSPECIFIED: 0,\n BASIC: 1,\n FULL: 2,\n },\n },\n },\n },\n },\n },\n};\n\n// Test-only helper. Not part of the real SDK.\nfunction __getMockCalls() {\n return calls;\n}\n\nfunction __resetMockCalls() {\n calls.length = 0;\n nextAppendRowErrors = null;\n nextAppendThrow = null;\n nextGetResultReject = null;\n nextAppendStatus = null;\n nextCreateStreamConnectionError = null;\n lastConnection = null;\n allConnections.length = 0;\n}\n\n/**\n * Test-only: the most recently created StreamConnection, so a test can emit an\n * out-of-band `'error'` on it (via `__emitConnectionError`) and assert the\n * destination attached a listener.\n */\nfunction __getLastConnection(): MockStreamConnection {\n if (!lastConnection) throw new Error('mock: no StreamConnection created yet');\n return lastConnection;\n}\n\n/**\n * Test-only: every StreamConnection created since the last reset, so a test can\n * assert that a concurrent re-open did not orphan a connection that still\n * carries an 'error' listener (a leak).\n */\nfunction __getAllConnections(): MockStreamConnection[] {\n return allConnections.slice();\n}\n\n/**\n * Test-only: queue rowErrors for the next appendRows().getResult() call.\n * Auto-resets after one use.\n */\nfunction __setNextAppendRowErrors(errors: MockRowError[]): void {\n nextAppendRowErrors = errors;\n}\n\n/**\n * Test-only: make the next appendRows() throw synchronously, simulating a\n * Storage Write API call failure. Auto-resets after one use.\n */\nfunction __setNextAppendThrow(err: unknown): void {\n nextAppendThrow = err;\n}\n\n/**\n * Test-only: make the next appendRows().getResult() reject, simulating a gRPC\n * deadline-exceeded (or any stream error) surfacing through the pending write.\n * Auto-resets after one use.\n */\nfunction __setNextGetResultReject(err: unknown): void {\n nextGetResultReject = err;\n}\n\n/**\n * Test-only: make the next appendRows().getResult() resolve with an error\n * status (a quota, a dropped table), as the SDK does for a status it does not\n * retry. Auto-resets after one use.\n */\nfunction __setNextAppendStatus(status: {\n code: number;\n message: string;\n}): void {\n nextAppendStatus = status;\n}\n\n/**\n * Test-only: queue an error for the next createStreamConnection() call so\n * tests can simulate openWriter failures (NotFound, INVALID_ARGUMENT, etc.).\n * Auto-resets after one use.\n */\nfunction __setNextOpenWriterError(err: unknown): void {\n nextCreateStreamConnectionError = err;\n}\n\nexport {\n managedwriter,\n adapt,\n protos,\n MockStreamConnection,\n __getMockCalls,\n __resetMockCalls,\n __getLastConnection,\n __getAllConnections,\n __setNextAppendRowErrors,\n __setNextAppendThrow,\n __setNextGetResultReject,\n __setNextAppendStatus,\n __setNextOpenWriterError,\n};\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\nimport { eventToRow } from '../eventToRow';\n\n/**\n * Mirror of push.ts via eventToRow() -- produces a flat 15-column row\n * with nested object/array values JSON-stringified. Imported directly\n * from the runtime helper so the step examples stay in sync with what\n * push.ts actually emits to JSONWriter.appendRows.\n */\nfunction expectedRow(event: WalkerOS.Event) {\n return eventToRow(event);\n}\n\n/**\n * Page view -- one row appended through JSONWriter.appendRows([row]).\n * Captured as a single intent-level call: ['appendRows', [row]].\n */\nconst pageViewEvent = getEvent('page view', {\n timestamp: 1700001100000,\n data: { title: 'Documentation', url: 'https://example.com/docs' },\n source: { type: 'express', platform: 'server' },\n});\n\nexport const pageView: Flow.StepExample = {\n title: 'Page view',\n description:\n 'A page view is appended as one row through the BigQuery Storage Write API JSONWriter. Nested objects/arrays in data, source, etc. are JSON-stringified by eventToRow.',\n in: pageViewEvent,\n mapping: undefined,\n out: [['appendRows', [expectedRow(pageViewEvent)]]],\n};\n\n/**\n * Purchase -- nested array in data.items is JSON.stringified into the\n * data column of the appended row.\n */\nconst purchaseEvent = getEvent('order complete', {\n timestamp: 1700001101000,\n data: {\n id: 'ORD-500',\n value: 199.99,\n items: [{ sku: 'SKU-1', qty: 2 }],\n },\n source: { type: 'express', platform: 'server' },\n});\n\nexport const purchase: Flow.StepExample = {\n title: 'Purchase',\n description:\n 'An order event is appended as a single row through JSONWriter.appendRows. The entire nested data object (including arrays like items) is JSON-stringified into the data column via eventToRow().',\n in: purchaseEvent,\n mapping: undefined,\n out: [['appendRows', [expectedRow(purchaseEvent)]]],\n};\n\n/** A silent rule appends no row. */\nexport const silentRule: Flow.StepExample = {\n public: false,\n description: 'A rule with silent: true appends no row.',\n in: getEvent('page view', { timestamp: 1700000000500 }),\n mapping: { silent: true },\n out: [],\n};\n\n/**\n * A failed append: the Storage Write call fails, so the row is not written\n * and the push fails, retryable, instead of counting as delivered. An append\n * the server answers with an error status (a quota, a dropped table) fails\n * the same way, retryable only for the statuses the SDK retries itself.\n */\nexport const appendFailed: Flow.StepExample = {\n public: false,\n description:\n 'A failed Storage Write append fails the push, retryable, instead of counting as delivered.',\n in: getEvent('page view', { timestamp: 1700001102000 }),\n respond: { error: 'network' },\n out: [\n [\n 'appendRows',\n [expectedRow(getEvent('page view', { timestamp: 1700001102000 }))],\n ],\n ],\n outcome: { status: 'failed', code: 'transport', retryable: true },\n};\n","import type { WalkerOS } from '@walkeros/core';\n\n/** Row shape passed to JSONWriter.appendRows. Values are JSON-serializable scalars or strings. */\nexport interface BigQueryRow {\n [key: string]: string | number | null;\n name: string;\n data: string | null;\n context: string | null;\n globals: string | null;\n custom: string | null;\n user: string | null;\n nested: string | null;\n consent: string | null;\n id: string;\n trigger: string;\n entity: string;\n action: string;\n timestamp: number;\n timing: number;\n source: string | null;\n}\n\nfunction jsonOrNull(value: unknown): string | null {\n if (value === undefined || value === null) return null;\n if (typeof value === 'object') {\n if (Array.isArray(value) && value.length === 0) return null;\n if (!Array.isArray(value) && Object.keys(value).length === 0) return null;\n return JSON.stringify(value);\n }\n return JSON.stringify(value);\n}\n\n/** Convert a walkerOS Event v4 into a 15-column BigQuery row in canonical order.\n *\n * Note: BQ Storage Write API encodes TIMESTAMP fields as INT64 microseconds\n * since epoch (the SDK calls Long.fromString on the value). ISO strings fail\n * with \"interior hyphen\" because Long.fromString sees the date hyphens as\n * non-numeric. Pass microseconds directly.\n */\nexport function eventToRow(event: WalkerOS.Event): BigQueryRow {\n return {\n name: event.name,\n data: jsonOrNull(event.data),\n context: jsonOrNull(event.context),\n globals: jsonOrNull(event.globals),\n custom: jsonOrNull(event.custom),\n user: jsonOrNull(event.user),\n nested: jsonOrNull(event.nested),\n consent: jsonOrNull(event.consent),\n id: event.id,\n trigger: event.trigger,\n entity: event.entity,\n action: event.action,\n timestamp: new Date(event.timestamp).getTime() * 1000, // microseconds since epoch\n timing: event.timing,\n source: jsonOrNull(event.source),\n };\n}\n","import type { Flow } from '@walkeros/core';\n\n/**\n * The setting BigQuery needs to deliver: the project ID. The credentials come\n * from the Google environment.\n */\nexport const minimal: Flow.MinimalExample = {\n settings: { projectId: 'YOUR_PROJECT_ID' },\n};\n","export * as env from './env';\nexport * as step from './step';\nexport { minimal } from './minimal';\n","import type {\n Env,\n PubSubPublisher,\n PublishMessage,\n TopicPublisher,\n} from '../types';\n\n/**\n * Example environment for the GCP Pub/Sub destination.\n *\n * `push` is the mock env simulate injects: `PubSub` builds a client whose\n * topics answer `publishMessage` locally, so nothing reaches GCP. Unit tests\n * still substitute the SDK module-wide via `jest.mock('@google-cloud/pubsub')`.\n */\n\nclass MockTopic implements TopicPublisher {\n constructor(public name: string) {}\n publishMessage(_message: PublishMessage): Promise<string> {\n return Promise.resolve('mock-message-id');\n }\n resumePublishing(_orderingKey: string): void {}\n}\n\nclass MockPubSub implements PubSubPublisher {\n constructor(public options?: object) {}\n topic(name: string): TopicPublisher {\n return new MockTopic(name);\n }\n close(): Promise<void> {\n return Promise.resolve();\n }\n}\n\nexport const push: Env = {\n PubSub: MockPubSub,\n};\n\n/** The publish carries the request; `args[0]` is the message. */\nexport const simulation = ['call:PubSub.topic.publishMessage'];\n","import type { Flow, WalkerOS } from '@walkeros/core';\nimport { getEvent } from '@walkeros/core';\n\n// Build-time version define. The upstream collector stamps source.release with\n// this on push, so the expected payload must mirror it rather than a literal,\n// else it breaks whenever the fixed version group is bumped (release).\ndeclare const __VERSION__: string;\n\n/**\n * Pub/Sub step examples. Each example's `out` is the array of recorded mock\n * calls produced by `push()`. The recording shape is:\n * ['topic', topicName, topicOptions] // implicit topic-handle creation\n * ['publishMessage', topicName, messageOptions]\n * ['resumePublishing', topicName, orderingKey] // only on publish failure\n */\n\n// Events reaching a server destination arrive already enriched by the upstream\n// collector, so they carry the run trace and per-run count. The collector\n// preserves these (stamp-if-absent), keeping the example deterministic.\nconst orderEvent = getEvent('order complete', {\n timestamp: 1700001100000,\n data: { id: 'ORD-500', value: 199.99, currency: 'EUR' },\n user: { id: 'usr-789' },\n source: {\n type: 'express',\n platform: 'server',\n trace: '1a2b3c4d5e6f70819a2b3c4d5e6f7081',\n count: 1,\n },\n});\n\nconst pageEvent = getEvent('page view', {\n timestamp: 1700001101000,\n data: { title: 'Documentation', url: 'https://example.com/docs' },\n source: {\n type: 'express',\n platform: 'server',\n trace: '9f8e7d6c5b4a39281706f5e4d3c2b1a0',\n count: 1,\n },\n});\n\nfunction expectedPayload(event: WalkerOS.Event): Buffer {\n // The harness pushes the event through an unconfigured collector, which stamps\n // source.release = { [name ?? platform ?? 'default']: __VERSION__ }. With no\n // collector name, the key is the event's platform. Mirror that here so the\n // expected message body matches the published (post-collector) event.\n const releaseKey = event.source.platform ?? 'default';\n const stamped = {\n ...event,\n source: { ...event.source, release: { [releaseKey]: __VERSION__ } },\n };\n return Buffer.from(JSON.stringify(stamped));\n}\n\n/**\n * Default publish, no mapping. Settings.topic = 'events'. The destination\n * constructs a topic handle inline with messageOrdering=false (no ordering\n * key resolved) and publishes the full event JSON as the message body.\n */\nexport const defaultPush: Flow.StepExample = {\n title: 'Default publish',\n description:\n 'An event is published to the configured Pub/Sub topic with the full JSON event as the message body and no ordering key.',\n in: orderEvent,\n out: [\n ['topic', 'events', { messageOrdering: false }],\n ['publishMessage', 'events', { data: expectedPayload(orderEvent) }],\n ],\n};\n\n/**\n * Per-rule topic override. Mapping carries `settings.topic = 'orders'`\n * which routes this rule to a dedicated topic.\n */\nexport const mappedTopic: Flow.StepExample = {\n title: 'Topic override',\n description:\n 'A mapping rule overrides the destination default topic so order events are published to a dedicated topic.',\n in: orderEvent,\n mapping: {\n settings: {\n topic: 'orders',\n },\n },\n out: [\n ['topic', 'orders', { messageOrdering: false }],\n ['publishMessage', 'orders', { data: expectedPayload(orderEvent) }],\n ],\n};\n\n/**\n * Per-rule ordering key resolved from the event. `mapping.orderingKey =\n * 'user.id'` is a Mapping.Value that resolves to the event's user.id. The\n * topic handle is constructed with messageOrdering=true and the publish\n * carries the resolved orderingKey.\n */\nexport const mappedOrderingKey: Flow.StepExample = {\n title: 'Ordering key from user',\n description:\n 'A mapping resolves the ordering key from event.user.id, enabling per-user ordering for this publish.',\n in: orderEvent,\n mapping: {\n settings: {\n orderingKey: 'user.id',\n },\n },\n out: [\n ['topic', 'events', { messageOrdering: true }],\n [\n 'publishMessage',\n 'events',\n {\n data: expectedPayload(orderEvent),\n orderingKey: 'usr-789',\n },\n ],\n ],\n};\n\n/**\n * Per-rule attributes. `mapping.attributes = { entity: 'entity', action:\n * 'action' }` is a Mapping.Map resolved per event. Each value is a path\n * resolved against the event.\n */\nexport const mappedAttributes: Flow.StepExample = {\n title: 'Mapped attributes',\n description:\n 'A mapping resolves a per-event attribute map, here exposing entity and action as Pub/Sub attributes for routing in subscribers.',\n in: orderEvent,\n mapping: {\n settings: {\n attributes: {\n entity: 'entity',\n action: 'action',\n },\n },\n },\n out: [\n ['topic', 'events', { messageOrdering: false }],\n [\n 'publishMessage',\n 'events',\n {\n data: expectedPayload(orderEvent),\n attributes: { entity: 'order', action: 'complete' },\n },\n ],\n ],\n};\n\n/**\n * Mapped data. `mapping.data` rewrites the publish body. The rewritten\n * object replaces the event as the message data.\n */\nexport const mappedData: Flow.StepExample = {\n title: 'Mapped payload',\n description:\n 'A data mapping transforms the event payload before publish. The rewritten object becomes the Pub/Sub message body.',\n in: orderEvent,\n mapping: {\n data: {\n map: {\n order_id: 'data.id',\n revenue: 'data.value',\n currency: 'data.currency',\n },\n },\n },\n out: [\n ['topic', 'events', { messageOrdering: false }],\n [\n 'publishMessage',\n 'events',\n {\n // Mapped-data publish: the body is the mapping result (no event\n // envelope, so no source.release), emitted verbatim.\n data: Buffer.from(\n JSON.stringify({\n order_id: 'ORD-500',\n revenue: 199.99,\n currency: 'EUR',\n }),\n ),\n },\n ],\n ],\n};\n\n/**\n * Page view, no rule. Verifies free-form publish on a non-ordered topic\n * for an event with no special mapping.\n */\nexport const pageView: Flow.StepExample = {\n title: 'Page view',\n description:\n 'A page view is published to the default topic with no ordering key, demonstrating the simplest publish path.',\n in: pageEvent,\n out: [\n ['topic', 'events', { messageOrdering: false }],\n ['publishMessage', 'events', { data: expectedPayload(pageEvent) }],\n ],\n};\n\n/** A silent rule publishes no message. */\nexport const silentRule: Flow.StepExample = {\n public: false,\n description: 'A rule with silent: true publishes no message.',\n in: getEvent('page view', { timestamp: 1700000000500 }),\n mapping: { silent: true },\n out: [],\n};\n","import type { Flow } from '@walkeros/core';\n\n/**\n * The settings Pub/Sub needs to deliver: the project ID and the topic. The\n * credentials come from the Google environment.\n */\nexport const minimal: Flow.MinimalExample = {\n settings: { projectId: 'YOUR_PROJECT_ID', topic: 'events' },\n};\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z\n .object({\n client: z\n .any()\n .describe(\n 'Google Cloud BigQuery client instance (like new BigQuery({ projectId, keyFilename })). Used by walkeros setup only; event writes authenticate with config.credentials, settings.bigquery or the default credentials.',\n )\n .optional(),\n projectId: z\n .string()\n .min(1)\n .describe('Google Cloud Project ID (like my-gcp-project)'),\n datasetId: z\n .string()\n .min(1)\n .default('walkerOS')\n .describe(\n 'BigQuery dataset ID where events will be stored (like walker_events)',\n ),\n tableId: z\n .string()\n .min(1)\n .default('events')\n .describe('BigQuery table ID for event storage (like events)'),\n location: z\n .string()\n .default('EU')\n .describe(\n 'Not read by the destination. walkeros setup creates the dataset in config.setup.location (like US), default EU.',\n ),\n bigquery: z\n .any()\n .describe(\n 'Additional BigQuery client configuration options (like { keyFilename: \"path/to/key.json\" })',\n )\n .optional(),\n })\n .strict();\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * GCP BigQuery Mapping Schema\n * BigQuery has no event-level mapping configuration\n */\nexport const MappingSchema = z.object({});\n\n/**\n * Type inference from MappingSchema\n */\nexport type Mapping = z.infer<typeof MappingSchema>;\n","import { zodToSchema } from '@walkeros/core/dev';\nimport { SettingsSchema } from './settings';\nimport { MappingSchema } from './mapping';\nimport { SetupSchema } from './setup';\n\nexport { SettingsSchema, type Settings } from './settings';\nexport { MappingSchema, type Mapping } from './mapping';\nexport { SetupSchema, type Setup } from './setup';\n\n// JSON Schema\nexport const settings = zodToSchema(SettingsSchema);\nexport const mapping = zodToSchema(MappingSchema);\nexport const setup = zodToSchema(SetupSchema);\n","import { z } from '@walkeros/core/dev';\n\nexport const SettingsSchema = z\n .object({\n client: z\n .any()\n .describe(\n 'Google Cloud Pub/Sub client instance (like new PubSub({ projectId, keyFilename }))',\n )\n .optional(),\n projectId: z\n .string()\n .min(1)\n .describe('Google Cloud Project ID (like my-gcp-project)'),\n topic: z\n .string()\n .min(1)\n .describe(\n 'Pub/Sub topic short name (like events). The full resource name projects/<projectId>/topics/<topic> is built by the SDK.',\n ),\n credentials: z\n .any()\n .describe(\n 'Service account credentials as a JSON string or an object with client_email and private_key. Default: Application Default Credentials (ADC). (deprecated: use config.credentials)',\n )\n .optional(),\n apiEndpoint: z\n .string()\n .describe(\n 'Override Pub/Sub API endpoint. Useful for the local emulator (like localhost:8085).',\n )\n .optional(),\n orderingKey: z\n .any()\n .describe(\n 'Mapping value resolved per-event. Truthy enables per-key ordering for the publish.',\n )\n .optional(),\n attributes: z\n .any()\n .describe(\n 'Default per-event attribute map merged into every published message. Mapping.Map shape.',\n )\n .optional(),\n })\n .strict();\n\nexport type Settings = z.infer<typeof SettingsSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * GCP Pub/Sub Mapping Schema\n *\n * Per-rule overrides for topic, orderingKey, and attributes.\n */\nexport const MappingSchema = z.object({\n topic: z\n .string()\n .describe(\n 'Per-rule topic override. Falls back to settings.topic if absent.',\n )\n .optional(),\n orderingKey: z\n .any()\n .describe(\n 'Per-rule ordering-key Mapping.Value. Overrides settings.orderingKey when set.',\n )\n .optional(),\n attributes: z\n .any()\n .describe(\n 'Per-rule attribute Mapping.Map merged on top of settings.attributes.',\n )\n .optional(),\n});\n\n/**\n * Type inference from MappingSchema\n */\nexport type Mapping = z.infer<typeof MappingSchema>;\n","import { z } from '@walkeros/core/dev';\n\n/**\n * GCP Pub/Sub Setup Schema\n *\n * Provisioning options for `walkeros setup destination.<id>`. Idempotent topic\n * creation. Subscription provisioning is owned by the source side.\n */\nexport const SetupSchema = z.object({\n messageStoragePolicy: z\n .object({\n allowedPersistenceRegions: z\n .array(z.string())\n .describe(\n 'Geographic regions for at-rest message storage (like europe-west1). Default: europe-west1, europe-west3 and europe-west4.',\n ),\n })\n .describe('Topic-level message storage policy.')\n .optional(),\n messageRetentionDuration: z\n .object({\n seconds: z\n .number()\n .describe('Retention window in seconds. Default: project default.'),\n })\n .describe('Topic-level retention configuration.')\n .optional(),\n kmsKeyName: z\n .string()\n .describe('Customer-managed encryption key (CMEK) resource name. Optional.')\n .optional(),\n labels: z\n .record(z.string(), z.string())\n .describe('Topic labels for organization and billing.')\n .optional(),\n});\n\nexport type Setup = z.infer<typeof SetupSchema>;\n","// Browser-safe schema-only exports\n// This file exports ONLY schemas without any Node.js dependencies\nexport { settings, mapping } from './bigquery/schemas';\nexport {\n settings as pubsubSettings,\n mapping as pubsubMapping,\n setup as pubsubSetup,\n} from './pubsub/schemas';\n","import type { Hint } from '@walkeros/core';\n\nexport const hints: Hint.Hints = {\n 'auth-methods': {\n text: 'BigQuery authenticates three ways. config.credentials: a service account key as a JSON string or object, backed by $secret, used by walkeros setup and by event writes. settings.bigquery: raw client options such as { keyFilename: \"./sa.json\" }, passed to both clients. Neither set: Application Default Credentials (the attached service account on GCP compute, GOOGLE_APPLICATION_CREDENTIALS elsewhere). A pre-built settings.client is used by walkeros setup only, never for event writes.',\n code: [\n {\n lang: 'json',\n code: '{ \"settings\": { \"projectId\": \"my-project\" }, \"credentials\": \"$secret.BIGQUERY_SA_KEY\" }',\n },\n {\n lang: 'json',\n code: '{ \"settings\": { \"projectId\": \"my-project\" } }',\n },\n ],\n },\n 'storage-format': {\n text: 'All events go to one table, by default dataset \"walkerOS\" and table \"events\" (settings.datasetId, settings.tableId). Each event is one row of 15 columns: name, id, trigger, entity and action as strings, timestamp as a TIMESTAMP, timing as a number, and the object fields (data, context, globals, custom, user, nested, consent, source) as JSON. walkeros setup creates the dataset in config.setup.location (default EU) and the table, partitioned by day on timestamp.',\n },\n 'query-json-columns': {\n text: 'The object fields (data, context, globals, user and the others) are JSON columns in the default table. Query them with BigQuery JSON functions such as JSON_EXTRACT_SCALAR; paths follow the walkerOS event structure.',\n code: [\n {\n lang: 'sql',\n code: \"SELECT JSON_EXTRACT_SCALAR(data, '$.value') AS value FROM `project.walkerOS.events` WHERE entity = 'order'\",\n },\n ],\n },\n 'troubleshoot-empty-table': {\n text: 'Events not appearing? The collector logs the first failed write of each cause as an ERROR line and counts repeats within a minute in status.destinations.<id>.failed. Common causes: the dataset or table does not exist (set config.setup: true and run walkeros setup destination.<id> once; without config.setup the command skips), projectId names another project, or the service account lacks roles/bigquery.dataEditor. projectId is checked when the destination starts; the table is opened at the first event.',\n },\n};\n","import * as bigqueryExamplesNs from './bigquery/examples';\nimport * as pubsubExamplesNs from './pubsub/examples';\nimport * as bigquerySchemasNs from './bigquery/schemas';\nimport * as pubsubSchemasNs from './pubsub/schemas';\n\nexport * as schemas from './schemas';\nexport * as examples from './bigquery/examples';\nexport * as pubsubExamples from './pubsub/examples';\nexport { hints } from './hints';\n\n/** Dev examples per export, keyed by the export names in package.json. */\nexport const exportExamples = {\n destinationBigQuery: bigqueryExamplesNs,\n destinationPubSub: pubsubExamplesNs,\n};\n\n/** Schemas per export, keyed by the export names in package.json. */\nexport const exportSchemas = {\n destinationBigQuery: {\n settings: bigquerySchemasNs.settings,\n mapping: bigquerySchemasNs.mapping,\n },\n destinationPubSub: {\n settings: pubsubSchemasNs.settings,\n mapping: pubsubSchemasNs.mapping,\n setup: pubsubSchemasNs.setup,\n },\n};\n"],"mappings":";;;;;;;;AAAA;AAAA;AAAA;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AAAA,IACN,MAAM;AAAA,MACJ;AAAA,QACE,MAAM;AAAA,QACN,MAAM;AAAA,MACR;AAAA,MACA;AAAA,QACE,MAAM;AAAA,QACN,MAAM;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAAA,EACA,kBAAkB;AAAA,IAChB,MAAM;AAAA,EACR;AAAA,EACA,sBAAsB;AAAA,IACpB,MAAM;AAAA,IACN,MAAM;AAAA,MACJ;AAAA,QACE,MAAM;AAAA,QACN,MAAM;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAAA,EACA,4BAA4B;AAAA,IAC1B,MAAM;AAAA,EACR;AACF;;;ACpBO,IAAM,iBAAiB;AAAA,EAC5B,qBAAqB;AAAA,EACrB,mBAAmBC;AACrB;AAGO,IAAM,gBAAgB;AAAA,EAC3B,qBAAqB;AAAA,IACnB;AAAA,IACA;AAAA,EACF;AAAA,EACA,mBAAmB;AAAA,IACjB,UAA0BC;AAAA,IAC1B,SAAyBC;AAAA,IACzB;AAAA,EACF;AACF;","names":["examples_exports","env_exports","minimal","step_exports","env_exports","push","simulation","step_exports","pageView","silentRule","getEvent","minimal","z","zodToSchema","z","SettingsSchema","z","MappingSchema","z","settings","zodToSchema","SettingsSchema","mapping","MappingSchema","mapping","settings","examples_exports","settings","mapping"]}
|
package/dist/walkerOS.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$meta": {
|
|
3
3
|
"package": "@walkeros/server-destination-gcp",
|
|
4
|
-
"version": "4.9.0
|
|
4
|
+
"version": "4.9.0",
|
|
5
5
|
"type": "destination",
|
|
6
6
|
"platform": [
|
|
7
7
|
"server"
|
|
@@ -1915,29 +1915,10 @@
|
|
|
1915
1915
|
"880": 57,
|
|
1916
1916
|
"881": 46,
|
|
1917
1917
|
"882": 48,
|
|
1918
|
-
"883":
|
|
1919
|
-
"884":
|
|
1920
|
-
"885":
|
|
1921
|
-
"886":
|
|
1922
|
-
"887": 116,
|
|
1923
|
-
"888": 45,
|
|
1924
|
-
"889": 49,
|
|
1925
|
-
"890": 55,
|
|
1926
|
-
"891": 57,
|
|
1927
|
-
"892": 51,
|
|
1928
|
-
"893": 49,
|
|
1929
|
-
"894": 49,
|
|
1930
|
-
"895": 54,
|
|
1931
|
-
"896": 52,
|
|
1932
|
-
"897": 53,
|
|
1933
|
-
"898": 54,
|
|
1934
|
-
"899": 56,
|
|
1935
|
-
"900": 54,
|
|
1936
|
-
"901": 55,
|
|
1937
|
-
"902": 34,
|
|
1938
|
-
"903": 125,
|
|
1939
|
-
"904": 125,
|
|
1940
|
-
"905": 125
|
|
1918
|
+
"883": 34,
|
|
1919
|
+
"884": 125,
|
|
1920
|
+
"885": 125,
|
|
1921
|
+
"886": 125
|
|
1941
1922
|
}
|
|
1942
1923
|
}
|
|
1943
1924
|
]
|
|
@@ -2936,29 +2917,10 @@
|
|
|
2936
2917
|
"880": 57,
|
|
2937
2918
|
"881": 46,
|
|
2938
2919
|
"882": 48,
|
|
2939
|
-
"883":
|
|
2940
|
-
"884":
|
|
2941
|
-
"885":
|
|
2942
|
-
"886":
|
|
2943
|
-
"887": 116,
|
|
2944
|
-
"888": 45,
|
|
2945
|
-
"889": 49,
|
|
2946
|
-
"890": 55,
|
|
2947
|
-
"891": 57,
|
|
2948
|
-
"892": 51,
|
|
2949
|
-
"893": 49,
|
|
2950
|
-
"894": 49,
|
|
2951
|
-
"895": 54,
|
|
2952
|
-
"896": 52,
|
|
2953
|
-
"897": 53,
|
|
2954
|
-
"898": 54,
|
|
2955
|
-
"899": 56,
|
|
2956
|
-
"900": 54,
|
|
2957
|
-
"901": 55,
|
|
2958
|
-
"902": 34,
|
|
2959
|
-
"903": 125,
|
|
2960
|
-
"904": 125,
|
|
2961
|
-
"905": 125
|
|
2920
|
+
"883": 34,
|
|
2921
|
+
"884": 125,
|
|
2922
|
+
"885": 125,
|
|
2923
|
+
"886": 125
|
|
2962
2924
|
},
|
|
2963
2925
|
"attributes": {
|
|
2964
2926
|
"entity": "order",
|
|
@@ -4130,29 +4092,10 @@
|
|
|
4130
4092
|
"880": 57,
|
|
4131
4093
|
"881": 46,
|
|
4132
4094
|
"882": 48,
|
|
4133
|
-
"883":
|
|
4134
|
-
"884":
|
|
4135
|
-
"885":
|
|
4136
|
-
"886":
|
|
4137
|
-
"887": 116,
|
|
4138
|
-
"888": 45,
|
|
4139
|
-
"889": 49,
|
|
4140
|
-
"890": 55,
|
|
4141
|
-
"891": 57,
|
|
4142
|
-
"892": 51,
|
|
4143
|
-
"893": 49,
|
|
4144
|
-
"894": 49,
|
|
4145
|
-
"895": 54,
|
|
4146
|
-
"896": 52,
|
|
4147
|
-
"897": 53,
|
|
4148
|
-
"898": 54,
|
|
4149
|
-
"899": 56,
|
|
4150
|
-
"900": 54,
|
|
4151
|
-
"901": 55,
|
|
4152
|
-
"902": 34,
|
|
4153
|
-
"903": 125,
|
|
4154
|
-
"904": 125,
|
|
4155
|
-
"905": 125
|
|
4095
|
+
"883": 34,
|
|
4096
|
+
"884": 125,
|
|
4097
|
+
"885": 125,
|
|
4098
|
+
"886": 125
|
|
4156
4099
|
},
|
|
4157
4100
|
"orderingKey": "usr-789"
|
|
4158
4101
|
}
|
|
@@ -5149,29 +5092,10 @@
|
|
|
5149
5092
|
"880": 57,
|
|
5150
5093
|
"881": 46,
|
|
5151
5094
|
"882": 48,
|
|
5152
|
-
"883":
|
|
5153
|
-
"884":
|
|
5154
|
-
"885":
|
|
5155
|
-
"886":
|
|
5156
|
-
"887": 116,
|
|
5157
|
-
"888": 45,
|
|
5158
|
-
"889": 49,
|
|
5159
|
-
"890": 55,
|
|
5160
|
-
"891": 57,
|
|
5161
|
-
"892": 51,
|
|
5162
|
-
"893": 49,
|
|
5163
|
-
"894": 49,
|
|
5164
|
-
"895": 54,
|
|
5165
|
-
"896": 52,
|
|
5166
|
-
"897": 53,
|
|
5167
|
-
"898": 54,
|
|
5168
|
-
"899": 56,
|
|
5169
|
-
"900": 54,
|
|
5170
|
-
"901": 55,
|
|
5171
|
-
"902": 34,
|
|
5172
|
-
"903": 125,
|
|
5173
|
-
"904": 125,
|
|
5174
|
-
"905": 125
|
|
5095
|
+
"883": 34,
|
|
5096
|
+
"884": 125,
|
|
5097
|
+
"885": 125,
|
|
5098
|
+
"886": 125
|
|
5175
5099
|
}
|
|
5176
5100
|
}
|
|
5177
5101
|
]
|
|
@@ -5806,29 +5730,10 @@
|
|
|
5806
5730
|
"563": 57,
|
|
5807
5731
|
"564": 46,
|
|
5808
5732
|
"565": 48,
|
|
5809
|
-
"566":
|
|
5810
|
-
"567":
|
|
5811
|
-
"568":
|
|
5812
|
-
"569":
|
|
5813
|
-
"570": 116,
|
|
5814
|
-
"571": 45,
|
|
5815
|
-
"572": 49,
|
|
5816
|
-
"573": 55,
|
|
5817
|
-
"574": 57,
|
|
5818
|
-
"575": 51,
|
|
5819
|
-
"576": 49,
|
|
5820
|
-
"577": 49,
|
|
5821
|
-
"578": 54,
|
|
5822
|
-
"579": 52,
|
|
5823
|
-
"580": 53,
|
|
5824
|
-
"581": 54,
|
|
5825
|
-
"582": 56,
|
|
5826
|
-
"583": 54,
|
|
5827
|
-
"584": 55,
|
|
5828
|
-
"585": 34,
|
|
5829
|
-
"586": 125,
|
|
5830
|
-
"587": 125,
|
|
5831
|
-
"588": 125
|
|
5733
|
+
"566": 34,
|
|
5734
|
+
"567": 125,
|
|
5735
|
+
"568": 125,
|
|
5736
|
+
"569": 125
|
|
5832
5737
|
}
|
|
5833
5738
|
}
|
|
5834
5739
|
]
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@walkeros/server-destination-gcp",
|
|
3
3
|
"description": "Google Cloud Platform server destinations for walkerOS (BigQuery, Pub/Sub)",
|
|
4
|
-
"version": "4.9.0
|
|
4
|
+
"version": "4.9.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
"@google-cloud/bigquery": "^8.1.1",
|
|
34
34
|
"@google-cloud/bigquery-storage": "^5.1.0",
|
|
35
35
|
"@google-cloud/pubsub": "^5.3.0",
|
|
36
|
-
"@walkeros/core": "4.9.0
|
|
37
|
-
"@walkeros/server-core": "4.9.0
|
|
36
|
+
"@walkeros/core": "4.9.0",
|
|
37
|
+
"@walkeros/server-core": "4.9.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@walkeros/collector": "4.9.0
|
|
40
|
+
"@walkeros/collector": "4.9.0"
|
|
41
41
|
},
|
|
42
42
|
"repository": {
|
|
43
43
|
"url": "git+https://github.com/elbwalker/walkerOS.git",
|