@useairfoil/producer-google-analytics 0.0.0-stage → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +74 -2
- package/dist/index.d.mts +773 -0
- package/dist/index.mjs +3 -0
- package/dist/main.d.mts +1 -0
- package/dist/main.mjs +662 -0
- package/dist/main.mjs.map +1 -0
- package/dist/manifest.d.mts +45 -0
- package/dist/manifest.mjs +75 -0
- package/dist/manifest.mjs.map +1 -0
- package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
- package/dist/src-Cu0LuOTi.mjs +711 -0
- package/dist/src-Cu0LuOTi.mjs.map +1 -0
- package/package.json +48 -4
- package/src/client/auth.ts +133 -0
- package/src/client/client.ts +212 -0
- package/src/connector.ts +55 -0
- package/src/create-table.ts +5 -0
- package/src/demo/index.ts +44 -0
- package/src/demo/reports.ts +251 -0
- package/src/demo/shared.ts +98 -0
- package/src/index.ts +26 -0
- package/src/main.ts +22 -0
- package/src/manifest.ts +50 -0
- package/src/resources/reports/read.ts +104 -0
- package/src/resources/reports/resource.ts +31 -0
- package/src/resources/reports/sources.ts +169 -0
- package/src/resources/reports/spec.ts +15 -0
- package/src/resources/reports/specs.ts +173 -0
- package/src/sandbox.ts +37 -0
- package/src/schemas/api.ts +37 -0
- package/src/schemas/reports.ts +172 -0
- package/src/schemas/shared.ts +42 -0
- package/src/start.ts +49 -0
- package/src/tables.ts +25 -0
package/src/start.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { PgClient } from "@effect/sql-pg";
|
|
2
|
+
import {
|
|
3
|
+
ConnectorApp,
|
|
4
|
+
Ingestor,
|
|
5
|
+
RuntimeConfig,
|
|
6
|
+
StateStore,
|
|
7
|
+
Telemetry,
|
|
8
|
+
} from "@useairfoil/connector-kit";
|
|
9
|
+
import { Config, Effect, Layer, Logger, Schema } from "effect";
|
|
10
|
+
import { Command } from "effect/cli";
|
|
11
|
+
|
|
12
|
+
import { GoogleAnalyticsConnector } from "./index";
|
|
13
|
+
|
|
14
|
+
const ConnectorLayer = GoogleAnalyticsConnector.layerConfig(
|
|
15
|
+
GoogleAnalyticsConnector.GoogleAnalyticsConfigDef.config,
|
|
16
|
+
);
|
|
17
|
+
const TelemetryLayer = Telemetry.layerOtlp();
|
|
18
|
+
const PostgresLayer = PgClient.layerConfig({
|
|
19
|
+
url: Config.schema(
|
|
20
|
+
Schema.Redacted(Schema.NonEmptyString),
|
|
21
|
+
RuntimeConfig.PlatformRuntimeKey.postgresConnectionString,
|
|
22
|
+
),
|
|
23
|
+
maxConnections: Config.succeed(2),
|
|
24
|
+
connectTimeout: Config.succeed("5 seconds"),
|
|
25
|
+
applicationName: Config.succeed("airfoil-producer-google-analytics"),
|
|
26
|
+
});
|
|
27
|
+
const StateStoreLayer = StateStore.layerSql().pipe(Layer.provide(PostgresLayer));
|
|
28
|
+
|
|
29
|
+
export const startCommand = Command.make("start", {}, () =>
|
|
30
|
+
Effect.gen(function* () {
|
|
31
|
+
const port = yield* RuntimeConfig.httpPort;
|
|
32
|
+
const entrypoint = yield* GoogleAnalyticsConnector.GoogleAnalyticsConnector;
|
|
33
|
+
|
|
34
|
+
return yield* ConnectorApp.start(entrypoint, { port }).pipe(
|
|
35
|
+
Effect.provide(Ingestor.layerWingsConfig(entrypoint)),
|
|
36
|
+
);
|
|
37
|
+
}).pipe(
|
|
38
|
+
Effect.annotateLogs({ component: "google-analytics" }),
|
|
39
|
+
Effect.provide(
|
|
40
|
+
Layer.mergeAll(
|
|
41
|
+
StateStoreLayer,
|
|
42
|
+
ConnectorLayer,
|
|
43
|
+
Logger.layer([Logger.consolePretty()]),
|
|
44
|
+
TelemetryLayer,
|
|
45
|
+
),
|
|
46
|
+
),
|
|
47
|
+
Effect.provide(RuntimeConfig.layerHosted()),
|
|
48
|
+
),
|
|
49
|
+
).pipe(Command.withDescription("Run the production connector against Wings"));
|
package/src/tables.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Schema } from "effect";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
DailyOverviewSchema,
|
|
5
|
+
DeviceSchema,
|
|
6
|
+
EcommerceItemSchema,
|
|
7
|
+
EventSchema,
|
|
8
|
+
LandingPageSchema,
|
|
9
|
+
LocationSchema,
|
|
10
|
+
PageSchema,
|
|
11
|
+
TrafficSourceSchema,
|
|
12
|
+
UserAcquisitionSchema,
|
|
13
|
+
} from "./schemas/reports";
|
|
14
|
+
|
|
15
|
+
export const tableSchemas: Readonly<Record<string, Schema.Top>> = {
|
|
16
|
+
daily_overview: DailyOverviewSchema,
|
|
17
|
+
traffic_sources: TrafficSourceSchema,
|
|
18
|
+
user_acquisition: UserAcquisitionSchema,
|
|
19
|
+
pages: PageSchema,
|
|
20
|
+
landing_pages: LandingPageSchema,
|
|
21
|
+
events: EventSchema,
|
|
22
|
+
locations: LocationSchema,
|
|
23
|
+
devices: DeviceSchema,
|
|
24
|
+
ecommerce_items: EcommerceItemSchema,
|
|
25
|
+
};
|