@walkeros/server-destination-gcp 4.0.0 → 4.0.1-next-1778183328892
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +252 -35
- package/dist/dev.d.mts +81 -9
- package/dist/dev.d.ts +81 -9
- 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/index.d.mts +135 -14
- package/dist/index.d.ts +135 -14
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/schemas.d.mts +5 -1
- package/dist/schemas.d.ts +5 -1
- package/dist/schemas.js +1 -1
- package/dist/schemas.js.map +1 -1
- package/dist/schemas.mjs +1 -1
- package/dist/schemas.mjs.map +1 -1
- package/dist/walkerOS.json +147 -23
- package/package.json +11 -5
package/README.md
CHANGED
|
@@ -4,16 +4,21 @@
|
|
|
4
4
|
</a>
|
|
5
5
|
</p>
|
|
6
6
|
|
|
7
|
-
# GCP (BigQuery) Destination for walkerOS
|
|
7
|
+
# GCP (BigQuery, Pub/Sub) Destination for walkerOS
|
|
8
8
|
|
|
9
9
|
[Source Code](https://github.com/elbwalker/walkerOS/tree/main/packages/server/destinations/gcp)
|
|
10
10
|
•
|
|
11
11
|
[NPM Package](https://www.npmjs.com/package/@walkeros/server-destination-gcp)
|
|
12
12
|
|
|
13
13
|
walkerOS follows a **source → collector → destination** architecture. This GCP
|
|
14
|
-
destination
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
destination package ships two server-side sub-destinations:
|
|
15
|
+
|
|
16
|
+
- **BigQuery**, for streaming events into a managed data warehouse for analytics
|
|
17
|
+
and machine learning workloads.
|
|
18
|
+
- **Pub/Sub**, for publishing events to a topic for downstream fan-out, async
|
|
19
|
+
processing, or cross-region delivery.
|
|
20
|
+
|
|
21
|
+
One npm install covers both. Pick the export that matches your use case.
|
|
17
22
|
|
|
18
23
|
## Installation
|
|
19
24
|
|
|
@@ -76,43 +81,255 @@ const { elb } = await startFlow({
|
|
|
76
81
|
| ----------- | ----------------- | ------------------------------------------------ | -------- | ------------------------------------------ |
|
|
77
82
|
| `client` | `BigQuery` | Google Cloud BigQuery client instance | Yes | `new BigQuery({ projectId, keyFilename })` |
|
|
78
83
|
| `projectId` | `string` | Google Cloud Project ID | Yes | `'my-gcp-project'` |
|
|
79
|
-
| `datasetId` | `string` | BigQuery dataset ID where events will be stored |
|
|
80
|
-
| `tableId` | `string` | BigQuery table ID for event storage |
|
|
81
|
-
| `location` | `string` | Geographic location for the BigQuery dataset | No | `'
|
|
84
|
+
| `datasetId` | `string` | BigQuery dataset ID where events will be stored | No | `'walkerOS'` (default) |
|
|
85
|
+
| `tableId` | `string` | BigQuery table ID for event storage | No | `'events'` (default) |
|
|
86
|
+
| `location` | `string` | Geographic location for the BigQuery dataset | No | `'EU'` (default) |
|
|
82
87
|
| `bigquery` | `BigQueryOptions` | Additional BigQuery client configuration options | No | `{ keyFilename: "path/to/key.json" }` |
|
|
83
88
|
|
|
89
|
+
## Setup (one-time provisioning)
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
walkeros setup destination.bigquery
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Output: `setup: ok destination.bigquery` plus a JSON line with
|
|
96
|
+
`{ datasetCreated, tableCreated }`. Idempotent, safe to re-run.
|
|
97
|
+
|
|
98
|
+
IAM the operator service account needs:
|
|
99
|
+
|
|
100
|
+
- `bigquery.datasets.create`
|
|
101
|
+
- `bigquery.tables.create`
|
|
102
|
+
- `bigquery.datasets.get` (for drift detection)
|
|
103
|
+
- `bigquery.tables.get`
|
|
104
|
+
|
|
105
|
+
`config.setup`:
|
|
106
|
+
|
|
107
|
+
- `false` (default): no provisioning. Operator must run setup once explicitly.
|
|
108
|
+
- `true`: provision with defaults, `walkerOS` dataset, `events` table, `EU`
|
|
109
|
+
location, `PHYSICAL` storage billing, day partitioning on `timestamp`,
|
|
110
|
+
clustering on `(name, entity, action)`.
|
|
111
|
+
- `{ ...overrides }`: object form to override any default. See the `Setup`
|
|
112
|
+
interface in `src/bigquery/types/index.ts`.
|
|
113
|
+
|
|
114
|
+
If an existing table's partitioning, clustering, or schema differs from the
|
|
115
|
+
declared configuration, setup logs `WARN setup.drift {...}` and continues. No
|
|
116
|
+
auto-mutation.
|
|
117
|
+
|
|
118
|
+
## Storage Write API (data plane)
|
|
119
|
+
|
|
120
|
+
The destination uses BigQuery's Storage Write API for data ingestion.
|
|
121
|
+
|
|
122
|
+
Note: the upstream `@google-cloud/bigquery-storage` package self-marks as
|
|
123
|
+
`EXPERIMENTAL` (subject to change). Pinned at `^5.1.0`.
|
|
124
|
+
|
|
125
|
+
## Batching
|
|
126
|
+
|
|
127
|
+
`pushBatch` is implemented. Set the collector's `batch: <ms>` mapping setting to
|
|
128
|
+
enable batching:
|
|
129
|
+
|
|
130
|
+
```jsonc
|
|
131
|
+
{
|
|
132
|
+
"destinations": {
|
|
133
|
+
"bigquery": {
|
|
134
|
+
"package": "@walkeros/server-destination-gcp",
|
|
135
|
+
"config": {
|
|
136
|
+
"settings": { "projectId": "..." },
|
|
137
|
+
"setup": true,
|
|
138
|
+
"mapping": { "batch": 1000 },
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
`batch: 1000` (1 second) is a reasonable default for analytics workloads. All
|
|
146
|
+
events buffered within the window flush as a single `appendRows` call.
|
|
147
|
+
|
|
84
148
|
## Table Schema
|
|
85
149
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
150
|
+
The default 15-column schema (walkerOS Event v4 canonical order):
|
|
151
|
+
|
|
152
|
+
| Column | Type | Mode |
|
|
153
|
+
| ----------- | --------- | -------- |
|
|
154
|
+
| `name` | STRING | REQUIRED |
|
|
155
|
+
| `data` | JSON | NULLABLE |
|
|
156
|
+
| `context` | JSON | NULLABLE |
|
|
157
|
+
| `globals` | JSON | NULLABLE |
|
|
158
|
+
| `custom` | JSON | NULLABLE |
|
|
159
|
+
| `user` | JSON | NULLABLE |
|
|
160
|
+
| `nested` | JSON | NULLABLE |
|
|
161
|
+
| `consent` | JSON | NULLABLE |
|
|
162
|
+
| `id` | STRING | NULLABLE |
|
|
163
|
+
| `trigger` | STRING | NULLABLE |
|
|
164
|
+
| `entity` | STRING | NULLABLE |
|
|
165
|
+
| `action` | STRING | NULLABLE |
|
|
166
|
+
| `timestamp` | TIMESTAMP | NULLABLE |
|
|
167
|
+
| `timing` | INT64 | NULLABLE |
|
|
168
|
+
| `source` | JSON | NULLABLE |
|
|
169
|
+
|
|
170
|
+
For custom schemas, override `config.setup.schema`. See the
|
|
171
|
+
[full documentation](https://www.walkeros.io/docs/destinations/server/gcp) for
|
|
172
|
+
custom mapping examples.
|
|
173
|
+
|
|
174
|
+
## Pub/Sub
|
|
175
|
+
|
|
176
|
+
Publishes walkerOS events to a Google Cloud Pub/Sub topic. Supports per-key
|
|
177
|
+
ordering and dynamic attributes.
|
|
178
|
+
|
|
179
|
+
### Quick Start
|
|
180
|
+
|
|
181
|
+
```json
|
|
182
|
+
{
|
|
183
|
+
"version": 4,
|
|
184
|
+
"flows": {
|
|
185
|
+
"default": {
|
|
186
|
+
"server": {},
|
|
187
|
+
"destinations": {
|
|
188
|
+
"pubsub": {
|
|
189
|
+
"package": "@walkeros/server-destination-gcp",
|
|
190
|
+
"code": "destinationPubSub",
|
|
191
|
+
"config": {
|
|
192
|
+
"settings": {
|
|
193
|
+
"projectId": "YOUR_PROJECT_ID",
|
|
194
|
+
"topic": "events"
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
111
202
|
```
|
|
112
203
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
204
|
+
Or programmatically:
|
|
205
|
+
|
|
206
|
+
```typescript
|
|
207
|
+
import { startFlow } from '@walkeros/collector';
|
|
208
|
+
import { destinationPubSub } from '@walkeros/server-destination-gcp';
|
|
209
|
+
|
|
210
|
+
const { elb } = await startFlow({
|
|
211
|
+
destinations: [
|
|
212
|
+
{
|
|
213
|
+
destination: destinationPubSub,
|
|
214
|
+
config: {
|
|
215
|
+
settings: {
|
|
216
|
+
projectId: 'YOUR_PROJECT_ID',
|
|
217
|
+
topic: 'events',
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
],
|
|
222
|
+
});
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Authentication
|
|
226
|
+
|
|
227
|
+
Three modes (same chain as BigQuery):
|
|
228
|
+
|
|
229
|
+
1. **Application Default Credentials (ADC)**: nothing to configure beyond
|
|
230
|
+
`projectId`. Works on GCP-native runtimes (Cloud Run, GKE) and locally with
|
|
231
|
+
`gcloud auth application-default login`.
|
|
232
|
+
2. **Service account JSON**: pass the credentials object (or a JSON string) via
|
|
233
|
+
`settings.credentials`. The destination JSON-parses strings and forwards
|
|
234
|
+
`client_email` + `private_key` to the SDK.
|
|
235
|
+
3. **Pre-configured client**: pass an existing `PubSub` instance as
|
|
236
|
+
`settings.client`. Useful for shared connections across destinations.
|
|
237
|
+
|
|
238
|
+
When `settings.projectId` and `credentials.project_id` both resolve, the
|
|
239
|
+
top-level `settings.projectId` wins.
|
|
240
|
+
|
|
241
|
+
### Settings reference
|
|
242
|
+
|
|
243
|
+
| Name | Type | Description | Required |
|
|
244
|
+
| ------------- | ------------------------------- | ------------------------------------------------------- | -------- |
|
|
245
|
+
| `projectId` | `string` | Google Cloud Project ID | Yes |
|
|
246
|
+
| `topic` | `string` | Topic short name. SDK builds the full resource path. | Yes |
|
|
247
|
+
| `credentials` | `string \| ServiceAccountCreds` | Service account credentials, JSON string or object | No |
|
|
248
|
+
| `apiEndpoint` | `string` | Override Pub/Sub endpoint (use for the local emulator) | No |
|
|
249
|
+
| `orderingKey` | `Mapping.Value` | Default ordering-key mapping. Truthy enables ordering. | No |
|
|
250
|
+
| `attributes` | `Mapping.Map` | Default per-event attributes merged into every publish | No |
|
|
251
|
+
| `client` | `PubSub` | Pre-configured SDK instance, bypasses constructor build | No |
|
|
252
|
+
|
|
253
|
+
### Mapping reference
|
|
254
|
+
|
|
255
|
+
Per-rule overrides under `mapping.<entity>.<action>.settings`:
|
|
256
|
+
|
|
257
|
+
| Name | Type | Description |
|
|
258
|
+
| ------------- | --------------- | ---------------------------------------------------- |
|
|
259
|
+
| `topic` | `string` | Override the destination default topic for this rule |
|
|
260
|
+
| `orderingKey` | `Mapping.Value` | Per-rule ordering-key path, overrides settings |
|
|
261
|
+
| `attributes` | `Mapping.Map` | Per-rule attributes merged on top of settings |
|
|
262
|
+
|
|
263
|
+
### Ordering
|
|
264
|
+
|
|
265
|
+
`orderingKey` is a `Mapping.Value` resolved per event (for example `'user.id'`).
|
|
266
|
+
When the resolved key is truthy, the topic handle is built with
|
|
267
|
+
`messageOrdering: true` and the publish carries the resolved key. Pub/Sub
|
|
268
|
+
guarantees per-key ordering for messages published to the same region.
|
|
269
|
+
|
|
270
|
+
If a publish fails for an ordered key, Pub/Sub permanently halts subsequent
|
|
271
|
+
publishes on that key until `topic.resumePublishing(key)` is called. The
|
|
272
|
+
destination handles this automatically: on publish failure for an ordered key,
|
|
273
|
+
it calls `resumePublishing` immediately and re-throws so the operator sees the
|
|
274
|
+
error.
|
|
275
|
+
|
|
276
|
+
### Setup (one-time provisioning)
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
walkeros setup destination.<id>
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
Provisions the topic if it does not already exist. Idempotent, safe to re-run.
|
|
283
|
+
Defaults:
|
|
284
|
+
|
|
285
|
+
| Field | Value |
|
|
286
|
+
| ------------------------------------------------ | ------------------------------------------- |
|
|
287
|
+
| `messageStoragePolicy.allowedPersistenceRegions` | `['eu-west1', 'eu-west3', 'eu-west4']` (EU) |
|
|
288
|
+
| `messageRetentionDuration` | (unset, project default) |
|
|
289
|
+
| `kmsKeyName` | (unset) |
|
|
290
|
+
| `labels` | (unset) |
|
|
291
|
+
|
|
292
|
+
If your project has an org policy restricting regions, override
|
|
293
|
+
`messageStoragePolicy.allowedPersistenceRegions` accordingly.
|
|
294
|
+
|
|
295
|
+
IAM the operator service account needs:
|
|
296
|
+
|
|
297
|
+
- `pubsub.topics.create`
|
|
298
|
+
- `pubsub.topics.get` (for drift detection)
|
|
299
|
+
- `pubsub.topics.update` (only if you choose to mutate; the destination only
|
|
300
|
+
warns on drift, never auto-mutates)
|
|
301
|
+
|
|
302
|
+
The runtime service account that publishes events needs `roles/pubsub.publisher`
|
|
303
|
+
on the topic.
|
|
304
|
+
|
|
305
|
+
If the existing topic's storage policy, retention, KMS key, or labels differ
|
|
306
|
+
from the declared configuration, setup logs `WARN setup.drift {...}` and
|
|
307
|
+
continues. Migrations are an operator decision.
|
|
308
|
+
|
|
309
|
+
Subscription provisioning is owned by the Pub/Sub source, not the destination.
|
|
310
|
+
|
|
311
|
+
### Emulator
|
|
312
|
+
|
|
313
|
+
The official Pub/Sub emulator runs locally for development:
|
|
314
|
+
|
|
315
|
+
```bash
|
|
316
|
+
gcloud beta emulators pubsub start --host-port=localhost:8085
|
|
317
|
+
export PUBSUB_EMULATOR_HOST=localhost:8085
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
The SDK automatically picks up `PUBSUB_EMULATOR_HOST`. To override explicitly,
|
|
321
|
+
set `settings.apiEndpoint`.
|
|
322
|
+
|
|
323
|
+
### Troubleshooting
|
|
324
|
+
|
|
325
|
+
- **NOT_FOUND on publish**: the topic does not exist. The destination logs
|
|
326
|
+
`Pub/Sub topic "<topic>" not found in project "<projectId>". Run "walkeros setup destination.<id>" to create it.`
|
|
327
|
+
Run setup once.
|
|
328
|
+
- **PERMISSION_DENIED / UNAUTHENTICATED**: the runtime service account lacks
|
|
329
|
+
`roles/pubsub.publisher` on the topic, or ADC is not configured.
|
|
330
|
+
- **Ordering stuck**: a previous publish for an ordering key failed. The
|
|
331
|
+
destination calls `resumePublishing` automatically on failure; if you observe
|
|
332
|
+
sustained stalls, check publish-side error logs.
|
|
116
333
|
|
|
117
334
|
## Type Definitions
|
|
118
335
|
|
package/dist/dev.d.mts
CHANGED
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
import * as _walkeros_core_dev from '@walkeros/core/dev';
|
|
2
|
+
import * as _google_cloud_bigquery_storage from '@google-cloud/bigquery-storage';
|
|
3
|
+
import { managedwriter } from '@google-cloud/bigquery-storage';
|
|
2
4
|
import { DestinationServer } from '@walkeros/server-core';
|
|
3
5
|
import { BigQuery } from '@google-cloud/bigquery';
|
|
4
6
|
import { Flow, Hint } from '@walkeros/core';
|
|
5
7
|
|
|
8
|
+
declare const settings$1: _walkeros_core_dev.JSONSchema;
|
|
9
|
+
declare const mapping$1: _walkeros_core_dev.JSONSchema;
|
|
10
|
+
|
|
6
11
|
declare const settings: _walkeros_core_dev.JSONSchema;
|
|
7
12
|
declare const mapping: _walkeros_core_dev.JSONSchema;
|
|
13
|
+
declare const setup: _walkeros_core_dev.JSONSchema;
|
|
8
14
|
|
|
9
|
-
declare const schemas_mapping: typeof mapping;
|
|
10
|
-
declare const schemas_settings: typeof settings;
|
|
11
15
|
declare namespace schemas {
|
|
12
|
-
export {
|
|
16
|
+
export { mapping$1 as mapping, mapping as pubsubMapping, settings as pubsubSettings, setup as pubsubSetup, settings$1 as settings };
|
|
13
17
|
}
|
|
14
18
|
|
|
15
19
|
interface Env extends DestinationServer.Env {
|
|
16
20
|
BigQuery?: typeof BigQuery;
|
|
21
|
+
WriterClient?: typeof managedwriter.WriterClient;
|
|
22
|
+
JSONWriter?: typeof managedwriter.JSONWriter;
|
|
23
|
+
adapt?: typeof _google_cloud_bigquery_storage.adapt;
|
|
24
|
+
managedwriterModule?: typeof managedwriter;
|
|
17
25
|
}
|
|
18
26
|
|
|
19
27
|
/**
|
|
@@ -23,21 +31,85 @@ interface Env extends DestinationServer.Env {
|
|
|
23
31
|
* to actual GCP infrastructure.
|
|
24
32
|
*/
|
|
25
33
|
declare const push: Env;
|
|
34
|
+
declare const simulation$1: string[];
|
|
35
|
+
|
|
36
|
+
declare const env$1_push: typeof push;
|
|
37
|
+
declare namespace env$1 {
|
|
38
|
+
export { env$1_push as push, simulation$1 as simulation };
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
declare const pageView$1: Flow.StepExample;
|
|
42
|
+
declare const purchase: Flow.StepExample;
|
|
43
|
+
|
|
44
|
+
declare const step$1_purchase: typeof purchase;
|
|
45
|
+
declare namespace step$1 {
|
|
46
|
+
export { pageView$1 as pageView, step$1_purchase as purchase };
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
declare namespace index$1 {
|
|
50
|
+
export { env$1 as env, step$1 as step };
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Example environment metadata for GCP Pub/Sub destination.
|
|
55
|
+
*
|
|
56
|
+
* Tests substitute the real SDK via `jest.mock('@google-cloud/pubsub')`,
|
|
57
|
+
* which is the recommended pattern: imports of `@google-cloud/pubsub` get
|
|
58
|
+
* replaced module-wide, no env-injection plumbing required at the call site.
|
|
59
|
+
*
|
|
60
|
+
* The `simulation` list documents which globals the destination touches
|
|
61
|
+
* during a simulated run, used by the simulator to know what to stub.
|
|
62
|
+
*/
|
|
26
63
|
declare const simulation: string[];
|
|
27
64
|
|
|
28
|
-
declare const env_push: typeof push;
|
|
29
65
|
declare const env_simulation: typeof simulation;
|
|
30
66
|
declare namespace env {
|
|
31
|
-
export {
|
|
67
|
+
export { env_simulation as simulation };
|
|
32
68
|
}
|
|
33
69
|
|
|
70
|
+
/**
|
|
71
|
+
* Default publish, no mapping. Settings.topic = 'events'. The destination
|
|
72
|
+
* constructs a topic handle inline with messageOrdering=false (no ordering
|
|
73
|
+
* key resolved) and publishes the full event JSON as the message body.
|
|
74
|
+
*/
|
|
75
|
+
declare const defaultPush: Flow.StepExample;
|
|
76
|
+
/**
|
|
77
|
+
* Per-rule topic override. Mapping carries `settings.topic = 'orders'`
|
|
78
|
+
* which routes this rule to a dedicated topic.
|
|
79
|
+
*/
|
|
80
|
+
declare const mappedTopic: Flow.StepExample;
|
|
81
|
+
/**
|
|
82
|
+
* Per-rule ordering key resolved from the event. `mapping.orderingKey =
|
|
83
|
+
* 'user.id'` is a Mapping.Value that resolves to the event's user.id. The
|
|
84
|
+
* topic handle is constructed with messageOrdering=true and the publish
|
|
85
|
+
* carries the resolved orderingKey.
|
|
86
|
+
*/
|
|
87
|
+
declare const mappedOrderingKey: Flow.StepExample;
|
|
88
|
+
/**
|
|
89
|
+
* Per-rule attributes. `mapping.attributes = { entity: 'entity', action:
|
|
90
|
+
* 'action' }` is a Mapping.Map resolved per event. Each value is a path
|
|
91
|
+
* resolved against the event.
|
|
92
|
+
*/
|
|
93
|
+
declare const mappedAttributes: Flow.StepExample;
|
|
94
|
+
/**
|
|
95
|
+
* Mapped data. `mapping.data` rewrites the publish body. The rewritten
|
|
96
|
+
* object replaces the event as the message data.
|
|
97
|
+
*/
|
|
98
|
+
declare const mappedData: Flow.StepExample;
|
|
99
|
+
/**
|
|
100
|
+
* Page view, no rule. Verifies free-form publish on a non-ordered topic
|
|
101
|
+
* for an event with no special mapping.
|
|
102
|
+
*/
|
|
34
103
|
declare const pageView: Flow.StepExample;
|
|
35
|
-
declare const purchase: Flow.StepExample;
|
|
36
104
|
|
|
105
|
+
declare const step_defaultPush: typeof defaultPush;
|
|
106
|
+
declare const step_mappedAttributes: typeof mappedAttributes;
|
|
107
|
+
declare const step_mappedData: typeof mappedData;
|
|
108
|
+
declare const step_mappedOrderingKey: typeof mappedOrderingKey;
|
|
109
|
+
declare const step_mappedTopic: typeof mappedTopic;
|
|
37
110
|
declare const step_pageView: typeof pageView;
|
|
38
|
-
declare const step_purchase: typeof purchase;
|
|
39
111
|
declare namespace step {
|
|
40
|
-
export {
|
|
112
|
+
export { step_defaultPush as defaultPush, step_mappedAttributes as mappedAttributes, step_mappedData as mappedData, step_mappedOrderingKey as mappedOrderingKey, step_mappedTopic as mappedTopic, step_pageView as pageView };
|
|
41
113
|
}
|
|
42
114
|
|
|
43
115
|
declare const index_env: typeof env;
|
|
@@ -48,4 +120,4 @@ declare namespace index {
|
|
|
48
120
|
|
|
49
121
|
declare const hints: Hint.Hints;
|
|
50
122
|
|
|
51
|
-
export { index as examples, hints, schemas };
|
|
123
|
+
export { index$1 as examples, hints, index as pubsubExamples, schemas };
|
package/dist/dev.d.ts
CHANGED
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
import * as _walkeros_core_dev from '@walkeros/core/dev';
|
|
2
|
+
import * as _google_cloud_bigquery_storage from '@google-cloud/bigquery-storage';
|
|
3
|
+
import { managedwriter } from '@google-cloud/bigquery-storage';
|
|
2
4
|
import { DestinationServer } from '@walkeros/server-core';
|
|
3
5
|
import { BigQuery } from '@google-cloud/bigquery';
|
|
4
6
|
import { Flow, Hint } from '@walkeros/core';
|
|
5
7
|
|
|
8
|
+
declare const settings$1: _walkeros_core_dev.JSONSchema;
|
|
9
|
+
declare const mapping$1: _walkeros_core_dev.JSONSchema;
|
|
10
|
+
|
|
6
11
|
declare const settings: _walkeros_core_dev.JSONSchema;
|
|
7
12
|
declare const mapping: _walkeros_core_dev.JSONSchema;
|
|
13
|
+
declare const setup: _walkeros_core_dev.JSONSchema;
|
|
8
14
|
|
|
9
|
-
declare const schemas_mapping: typeof mapping;
|
|
10
|
-
declare const schemas_settings: typeof settings;
|
|
11
15
|
declare namespace schemas {
|
|
12
|
-
export {
|
|
16
|
+
export { mapping$1 as mapping, mapping as pubsubMapping, settings as pubsubSettings, setup as pubsubSetup, settings$1 as settings };
|
|
13
17
|
}
|
|
14
18
|
|
|
15
19
|
interface Env extends DestinationServer.Env {
|
|
16
20
|
BigQuery?: typeof BigQuery;
|
|
21
|
+
WriterClient?: typeof managedwriter.WriterClient;
|
|
22
|
+
JSONWriter?: typeof managedwriter.JSONWriter;
|
|
23
|
+
adapt?: typeof _google_cloud_bigquery_storage.adapt;
|
|
24
|
+
managedwriterModule?: typeof managedwriter;
|
|
17
25
|
}
|
|
18
26
|
|
|
19
27
|
/**
|
|
@@ -23,21 +31,85 @@ interface Env extends DestinationServer.Env {
|
|
|
23
31
|
* to actual GCP infrastructure.
|
|
24
32
|
*/
|
|
25
33
|
declare const push: Env;
|
|
34
|
+
declare const simulation$1: string[];
|
|
35
|
+
|
|
36
|
+
declare const env$1_push: typeof push;
|
|
37
|
+
declare namespace env$1 {
|
|
38
|
+
export { env$1_push as push, simulation$1 as simulation };
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
declare const pageView$1: Flow.StepExample;
|
|
42
|
+
declare const purchase: Flow.StepExample;
|
|
43
|
+
|
|
44
|
+
declare const step$1_purchase: typeof purchase;
|
|
45
|
+
declare namespace step$1 {
|
|
46
|
+
export { pageView$1 as pageView, step$1_purchase as purchase };
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
declare namespace index$1 {
|
|
50
|
+
export { env$1 as env, step$1 as step };
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Example environment metadata for GCP Pub/Sub destination.
|
|
55
|
+
*
|
|
56
|
+
* Tests substitute the real SDK via `jest.mock('@google-cloud/pubsub')`,
|
|
57
|
+
* which is the recommended pattern: imports of `@google-cloud/pubsub` get
|
|
58
|
+
* replaced module-wide, no env-injection plumbing required at the call site.
|
|
59
|
+
*
|
|
60
|
+
* The `simulation` list documents which globals the destination touches
|
|
61
|
+
* during a simulated run, used by the simulator to know what to stub.
|
|
62
|
+
*/
|
|
26
63
|
declare const simulation: string[];
|
|
27
64
|
|
|
28
|
-
declare const env_push: typeof push;
|
|
29
65
|
declare const env_simulation: typeof simulation;
|
|
30
66
|
declare namespace env {
|
|
31
|
-
export {
|
|
67
|
+
export { env_simulation as simulation };
|
|
32
68
|
}
|
|
33
69
|
|
|
70
|
+
/**
|
|
71
|
+
* Default publish, no mapping. Settings.topic = 'events'. The destination
|
|
72
|
+
* constructs a topic handle inline with messageOrdering=false (no ordering
|
|
73
|
+
* key resolved) and publishes the full event JSON as the message body.
|
|
74
|
+
*/
|
|
75
|
+
declare const defaultPush: Flow.StepExample;
|
|
76
|
+
/**
|
|
77
|
+
* Per-rule topic override. Mapping carries `settings.topic = 'orders'`
|
|
78
|
+
* which routes this rule to a dedicated topic.
|
|
79
|
+
*/
|
|
80
|
+
declare const mappedTopic: Flow.StepExample;
|
|
81
|
+
/**
|
|
82
|
+
* Per-rule ordering key resolved from the event. `mapping.orderingKey =
|
|
83
|
+
* 'user.id'` is a Mapping.Value that resolves to the event's user.id. The
|
|
84
|
+
* topic handle is constructed with messageOrdering=true and the publish
|
|
85
|
+
* carries the resolved orderingKey.
|
|
86
|
+
*/
|
|
87
|
+
declare const mappedOrderingKey: Flow.StepExample;
|
|
88
|
+
/**
|
|
89
|
+
* Per-rule attributes. `mapping.attributes = { entity: 'entity', action:
|
|
90
|
+
* 'action' }` is a Mapping.Map resolved per event. Each value is a path
|
|
91
|
+
* resolved against the event.
|
|
92
|
+
*/
|
|
93
|
+
declare const mappedAttributes: Flow.StepExample;
|
|
94
|
+
/**
|
|
95
|
+
* Mapped data. `mapping.data` rewrites the publish body. The rewritten
|
|
96
|
+
* object replaces the event as the message data.
|
|
97
|
+
*/
|
|
98
|
+
declare const mappedData: Flow.StepExample;
|
|
99
|
+
/**
|
|
100
|
+
* Page view, no rule. Verifies free-form publish on a non-ordered topic
|
|
101
|
+
* for an event with no special mapping.
|
|
102
|
+
*/
|
|
34
103
|
declare const pageView: Flow.StepExample;
|
|
35
|
-
declare const purchase: Flow.StepExample;
|
|
36
104
|
|
|
105
|
+
declare const step_defaultPush: typeof defaultPush;
|
|
106
|
+
declare const step_mappedAttributes: typeof mappedAttributes;
|
|
107
|
+
declare const step_mappedData: typeof mappedData;
|
|
108
|
+
declare const step_mappedOrderingKey: typeof mappedOrderingKey;
|
|
109
|
+
declare const step_mappedTopic: typeof mappedTopic;
|
|
37
110
|
declare const step_pageView: typeof pageView;
|
|
38
|
-
declare const step_purchase: typeof purchase;
|
|
39
111
|
declare namespace step {
|
|
40
|
-
export {
|
|
112
|
+
export { step_defaultPush as defaultPush, step_mappedAttributes as mappedAttributes, step_mappedData as mappedData, step_mappedOrderingKey as mappedOrderingKey, step_mappedTopic as mappedTopic, step_pageView as pageView };
|
|
41
113
|
}
|
|
42
114
|
|
|
43
115
|
declare const index_env: typeof env;
|
|
@@ -48,4 +120,4 @@ declare namespace index {
|
|
|
48
120
|
|
|
49
121
|
declare const hints: Hint.Hints;
|
|
50
122
|
|
|
51
|
-
export { index as examples, hints, schemas };
|
|
123
|
+
export { index$1 as examples, hints, index as pubsubExamples, schemas };
|