@useairfoil/connector-kit 0.4.0 → 0.5.1
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/METRICS.md +78 -0
- package/README.md +450 -88
- package/dist/auth/index.d.ts +2 -0
- package/dist/auth/index.js +3 -0
- package/dist/auth-DvU_CZ7C.js +42 -0
- package/dist/auth-DvU_CZ7C.js.map +1 -0
- package/dist/chunk-Bp6m_JJh.js +13 -0
- package/dist/connector-app/index.d.ts +14 -0
- package/dist/connector-app/index.js +11 -0
- package/dist/connector-app-d7Z-SZLQ.js +64 -0
- package/dist/connector-app-d7Z-SZLQ.js.map +1 -0
- package/dist/constants-BRhIX_rz.js +27 -0
- package/dist/constants-BRhIX_rz.js.map +1 -0
- package/dist/errors/index.d.ts +2 -0
- package/dist/errors/index.js +3 -0
- package/dist/errors-DHWylqRZ.js +8 -0
- package/dist/errors-DHWylqRZ.js.map +1 -0
- package/dist/index-Byr0Lf0C.d.ts +25 -0
- package/dist/index-CBT-JX-T.d.ts +173 -0
- package/dist/index-CTHVudvQ.d.ts +41 -0
- package/dist/index-CTLYQ74P.d.ts +80 -0
- package/dist/index-Coh_SkBs.d.ts +95 -0
- package/dist/index-D54ySAKn.d.ts +14 -0
- package/dist/index-DtJX_tic.d.ts +153 -0
- package/dist/index-J42AZaXU.d.ts +38 -0
- package/dist/index-fIIBVAai.d.ts +25 -0
- package/dist/index-o1-Z3n7V.d.ts +55 -0
- package/dist/index.d.ts +14 -165
- package/dist/index.js +50 -228
- package/dist/index.js.map +1 -1
- package/dist/ingestion/index.d.ts +6 -0
- package/dist/ingestion/index.js +10 -0
- package/dist/ingestion-BQo4cbGw.js +200 -0
- package/dist/ingestion-BQo4cbGw.js.map +1 -0
- package/dist/manifest/index.d.ts +2 -0
- package/dist/manifest/index.js +4 -0
- package/dist/manifest-ByE6YPG0.js +221 -0
- package/dist/manifest-ByE6YPG0.js.map +1 -0
- package/dist/metrics-CVAk1ALR.d.ts +53 -0
- package/dist/metrics-CWPy2Aqc.js +96 -0
- package/dist/metrics-CWPy2Aqc.js.map +1 -0
- package/dist/metrics.d.ts +4 -0
- package/dist/metrics.js +3 -0
- package/dist/publisher/index.d.ts +5 -0
- package/dist/publisher/index.js +6 -0
- package/dist/publisher-BYT3RLVO.js +131 -0
- package/dist/publisher-BYT3RLVO.js.map +1 -0
- package/dist/runtime-config/index.d.ts +2 -0
- package/dist/runtime-config/index.js +4 -0
- package/dist/runtime-config-BpB-d_bF.js +51 -0
- package/dist/runtime-config-BpB-d_bF.js.map +1 -0
- package/dist/server-CXTQ7odl.js +183 -0
- package/dist/server-CXTQ7odl.js.map +1 -0
- package/dist/service-DuFiQwid.js +191 -0
- package/dist/service-DuFiQwid.js.map +1 -0
- package/dist/service-IE5qaf9x.d.ts +32 -0
- package/dist/state-store/index.d.ts +3 -0
- package/dist/state-store/index.js +5 -0
- package/dist/state-store-yl6LiTQ0.js +198 -0
- package/dist/state-store-yl6LiTQ0.js.map +1 -0
- package/dist/status/index.d.ts +5 -0
- package/dist/status/index.js +6 -0
- package/dist/status-B-oZBc33.js +84 -0
- package/dist/status-B-oZBc33.js.map +1 -0
- package/dist/types-B35J5YPu.d.ts +174 -0
- package/dist/webhook/index.d.ts +6 -0
- package/dist/webhook/index.js +8 -0
- package/dist/webhook-DI-Afxkg.js +13 -0
- package/dist/webhook-DI-Afxkg.js.map +1 -0
- package/package.json +66 -8
- package/src/auth/index.ts +1 -0
- package/src/auth/token-cache.ts +54 -0
- package/src/connector-app/check.ts +76 -0
- package/src/connector-app/index.ts +2 -0
- package/src/connector-app/start.ts +42 -0
- package/src/core/builder.ts +81 -9
- package/src/core/index.ts +22 -0
- package/src/core/types.ts +204 -76
- package/src/errors/index.ts +1 -0
- package/src/index.ts +13 -28
- package/src/ingestion/engine.ts +409 -174
- package/src/ingestion/index.ts +1 -0
- package/src/manifest/config.ts +232 -0
- package/src/manifest/index.ts +14 -0
- package/src/manifest/manifest.ts +31 -0
- package/src/manifest/number-schema.ts +17 -0
- package/src/manifest/schema.ts +160 -0
- package/src/metrics.ts +128 -0
- package/src/publisher/console.ts +18 -0
- package/src/publisher/index.ts +7 -0
- package/src/publisher/instrumented.ts +68 -0
- package/src/publisher/service.ts +30 -13
- package/src/publisher/wings.ts +159 -72
- package/src/runtime/context.ts +15 -0
- package/src/runtime-config/constants.ts +27 -0
- package/src/runtime-config/error.ts +13 -0
- package/src/runtime-config/index.ts +3 -0
- package/src/runtime-config/layer.ts +56 -0
- package/src/state-store/index.ts +3 -0
- package/src/state-store/keys.ts +22 -0
- package/src/state-store/layer-key-value-store.ts +132 -0
- package/src/state-store/layer-memory.ts +11 -0
- package/src/state-store/layer-sql.ts +50 -0
- package/src/state-store/schema.ts +57 -0
- package/src/state-store/service.ts +51 -0
- package/src/state-store/state.ts +17 -0
- package/src/status/index.ts +2 -0
- package/src/status/route.ts +77 -0
- package/src/status/types.ts +33 -0
- package/src/telemetry.ts +288 -0
- package/src/webhook/index.ts +8 -0
- package/src/webhook/server.ts +209 -39
- package/src/webhook/types.ts +6 -17
- package/src/ingestion/state-store.ts +0 -36
- package/src/streams/pull-stream.ts +0 -54
- package/src/streams/webhook-queue.ts +0 -14
- /package/src/{core/errors.ts → errors/connector-error.ts} +0 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as effect_Types0 from "effect/Types";
|
|
2
|
+
import * as effect_Cause0 from "effect/Cause";
|
|
3
|
+
|
|
4
|
+
//#region src/errors/connector-error.d.ts
|
|
5
|
+
declare const ConnectorError_base: new <A extends Record<string, any> = {}>(args: effect_Types0.VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => effect_Cause0.YieldableError & {
|
|
6
|
+
readonly _tag: "ConnectorError";
|
|
7
|
+
} & Readonly<A>;
|
|
8
|
+
declare class ConnectorError extends ConnectorError_base<{
|
|
9
|
+
readonly message: string;
|
|
10
|
+
readonly cause?: unknown;
|
|
11
|
+
}> {}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { ConnectorError as t };
|
|
14
|
+
//# sourceMappingURL=index-D54ySAKn.d.ts.map
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { t as ConnectorError } from "./index-D54ySAKn.js";
|
|
2
|
+
import { b as WebhookHandler, d as ResourceMutation, f as ResourceName, g as ResourceSchema, i as DeleteValue, l as ResourceDefinition, n as ConnectorDefinition, r as Cursor, s as PageFetch, t as ChangesFetch } from "./types-B35J5YPu.js";
|
|
3
|
+
import { i as Publisher } from "./service-IE5qaf9x.js";
|
|
4
|
+
import { i as StateStore } from "./index-Coh_SkBs.js";
|
|
5
|
+
import { Config, Context, Duration, Effect, Layer } from "effect";
|
|
6
|
+
import { HttpRouter } from "effect/unstable/http";
|
|
7
|
+
import * as effect_unstable_http_HttpClient0 from "effect/unstable/http/HttpClient";
|
|
8
|
+
import * as effect_unstable_http_HttpServerError0 from "effect/unstable/http/HttpServerError";
|
|
9
|
+
|
|
10
|
+
//#region src/connector-app/check.d.ts
|
|
11
|
+
type ResourceCheckResult = {
|
|
12
|
+
readonly _tag: "ok";
|
|
13
|
+
} | {
|
|
14
|
+
readonly _tag: "error";
|
|
15
|
+
readonly message: string;
|
|
16
|
+
};
|
|
17
|
+
type CheckOptions<Name extends string> = {
|
|
18
|
+
readonly resources: ReadonlyArray<Name>;
|
|
19
|
+
};
|
|
20
|
+
type ResourceCheckResults<Name extends PropertyKey> = { readonly [Key in Name]: ResourceCheckResult };
|
|
21
|
+
type CheckResult<Resources extends ReadonlyArray<ResourceDefinition>, Name extends ResourceName<Resources> = ResourceName<Resources>> = ResourceCheckResults<Name>;
|
|
22
|
+
type CheckFailure = {
|
|
23
|
+
readonly message: string;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Builds the connector service from its layer and validates only the selected
|
|
27
|
+
* resources. The layer remains open until every check finishes.
|
|
28
|
+
*/
|
|
29
|
+
declare function check<Identifier, const Resources extends ReadonlyArray<ResourceDefinition>, E extends CheckFailure, R, const Name extends ResourceName<Resources>>(service: Context.Key<Identifier, ConnectorDefinition<Resources>>, layer: Layer.Layer<Identifier, E, R>, options: CheckOptions<Name>): Effect.Effect<CheckResult<Resources, Name>, never, R>;
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/core/builder.d.ts
|
|
32
|
+
declare const Connector: {
|
|
33
|
+
define: <const Resources extends ReadonlyArray<ResourceDefinition>>(definition: ConnectorDefinition<Resources>) => ConnectorDefinition<Resources>;
|
|
34
|
+
};
|
|
35
|
+
declare const Resource: {
|
|
36
|
+
entity: <S extends ResourceSchema, Payload = never, R = never, const Name extends string = string>(definition: ResourceDefinition<S, Payload, R, Name>) => ResourceDefinition<S, Payload, R, Name>;
|
|
37
|
+
webhook: <Payload, Row extends object = never>(definition: WebhookHandler<Row, Payload>) => WebhookHandler<Row, Payload>;
|
|
38
|
+
upsert: <Row extends object>(row: Row) => ResourceMutation<Row>;
|
|
39
|
+
delete: (options: {
|
|
40
|
+
readonly key: DeleteValue;
|
|
41
|
+
readonly version: DeleteValue;
|
|
42
|
+
}) => ResourceMutation<never>;
|
|
43
|
+
};
|
|
44
|
+
declare const Fetch: {
|
|
45
|
+
page: <Row extends object = never, R = never>(definition: PageFetch<Row, R>) => PageFetch<Row, R>;
|
|
46
|
+
changes: <Row extends object = never, R = never>(definition: ChangesFetch<Row, R>) => ChangesFetch<Row, R>;
|
|
47
|
+
};
|
|
48
|
+
declare const Cursor$1: {
|
|
49
|
+
string: () => Cursor.Definition<string>;
|
|
50
|
+
number: () => Cursor.Definition<number>;
|
|
51
|
+
isoDateTime: () => Cursor.Definition<string>;
|
|
52
|
+
nowIsoDateTime: Effect.Effect<string, never, never>;
|
|
53
|
+
};
|
|
54
|
+
declare namespace telemetry_d_exports {
|
|
55
|
+
export { Attr, EventAttr, EventName, OtlpMetricsOptions, OtlpTracingConfig, OtlpTracingOptions, SpanName, addCurrentSpanEvent, annotateError, layer, layerConfig, layerMetricsConsoleDump, layerOtlp, layerOtlpMetrics, layerOtlpTracing };
|
|
56
|
+
}
|
|
57
|
+
/** Canonical span names emitted by connector-kit runtime instrumentation. */
|
|
58
|
+
declare const SpanName: {
|
|
59
|
+
readonly batchProcess: "connector.batch.process";
|
|
60
|
+
readonly webhookDecode: "connector.webhook.decode";
|
|
61
|
+
readonly webhookHandle: "connector.webhook.handle";
|
|
62
|
+
readonly publish: "connector.publish";
|
|
63
|
+
readonly stateSet: "connector.state.set";
|
|
64
|
+
readonly apiFetch: "connector.api.fetch";
|
|
65
|
+
};
|
|
66
|
+
/** Canonical span attribute names. Keep these stable for collector queries. */
|
|
67
|
+
declare const Attr: {
|
|
68
|
+
readonly connectorName: "airfoil.connector.name";
|
|
69
|
+
readonly connectorResourcesCount: "airfoil.connector.resources.count";
|
|
70
|
+
readonly resourceName: "airfoil.resource.name";
|
|
71
|
+
readonly resourceSource: "airfoil.resource.source";
|
|
72
|
+
readonly batchMutations: "airfoil.batch.mutations";
|
|
73
|
+
readonly webhookPath: "airfoil.webhook.path";
|
|
74
|
+
readonly publisherSuccess: "airfoil.publisher.success";
|
|
75
|
+
readonly stateKey: "airfoil.state.key";
|
|
76
|
+
readonly apiPath: "airfoil.api.path";
|
|
77
|
+
readonly errorPhase: "airfoil.error.phase";
|
|
78
|
+
readonly errorType: "airfoil.error.type";
|
|
79
|
+
readonly errorMessage: "airfoil.error.message";
|
|
80
|
+
readonly errorDetails: "airfoil.error.details";
|
|
81
|
+
};
|
|
82
|
+
/** Span event names for high-cardinality reproduction details. */
|
|
83
|
+
declare const EventName: {
|
|
84
|
+
readonly batchCheckpoint: "airfoil.batch.checkpoint";
|
|
85
|
+
};
|
|
86
|
+
/** Event-only attributes. These are intentionally not span attributes. */
|
|
87
|
+
declare const EventAttr: {
|
|
88
|
+
readonly batchCursor: "airfoil.batch.cursor";
|
|
89
|
+
};
|
|
90
|
+
/** Annotates the active span with phase-aware error metadata before re-failing. */
|
|
91
|
+
declare const annotateError: (phase: string, error: unknown) => Effect.Effect<void, never, never>;
|
|
92
|
+
/** Adds an event to the active span, or no-ops when no span is active. */
|
|
93
|
+
declare const addCurrentSpanEvent: (name: string, attributes?: Record<string, unknown>) => Effect.Effect<void, never, never>;
|
|
94
|
+
/** Transport configuration for OTLP trace export. All fields are direct values. */
|
|
95
|
+
type OtlpTracingConfig = {
|
|
96
|
+
readonly enabled?: boolean;
|
|
97
|
+
readonly endpoint?: string;
|
|
98
|
+
readonly headers?: Record<string, string>;
|
|
99
|
+
};
|
|
100
|
+
/** Runtime options — not config-wrappable since RegExp cannot live in Config. */
|
|
101
|
+
type OtlpTracingOptions = {
|
|
102
|
+
/** Additional connector-specific header names or regexes to redact from HTTP logs/traces. */
|
|
103
|
+
readonly redactedHeaders?: ReadonlyArray<string | RegExp>;
|
|
104
|
+
};
|
|
105
|
+
type OtlpMetricsOptions = {
|
|
106
|
+
readonly exportInterval?: Duration.Input;
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Trace-only OTLP export with sensitive HTTP header redaction.
|
|
110
|
+
* Takes direct config values — no `ConfigProvider` required.
|
|
111
|
+
*/
|
|
112
|
+
declare const layer: (config?: OtlpTracingConfig, options?: OtlpTracingOptions) => Layer.Layer<never, Error, effect_unstable_http_HttpClient0.HttpClient>;
|
|
113
|
+
/**
|
|
114
|
+
* Trace-only OTLP export with sensitive HTTP header redaction.
|
|
115
|
+
* Takes Effect Config-wrapped values — reads from `ConfigProvider`.
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* Telemetry.layerConfig({
|
|
119
|
+
* enabled: Config.boolean("MY_OTEL_ENABLED"),
|
|
120
|
+
* endpoint: Config.string("MY_COLLECTOR_URL"),
|
|
121
|
+
* })
|
|
122
|
+
*/
|
|
123
|
+
declare const layerConfig: (config: Config.Wrap<OtlpTracingConfig>, options?: OtlpTracingOptions) => Layer.Layer<never, Error | Config.ConfigError, effect_unstable_http_HttpClient0.HttpClient>;
|
|
124
|
+
/**
|
|
125
|
+
* Trace-only OTLP export with sensitive HTTP header redaction.
|
|
126
|
+
* Zero-config shortcut that reads the standard `OTEL_*` env var names.
|
|
127
|
+
*
|
|
128
|
+
* Reads `OTEL_ENABLED`, `OTEL_EXPORTER_OTLP_ENDPOINT`, and
|
|
129
|
+
* `OTEL_EXPORTER_OTLP_HEADERS`. Effect's OTLP resource handling reads
|
|
130
|
+
* `OTEL_SERVICE_NAME`, `OTEL_SERVICE_VERSION`, and `OTEL_RESOURCE_ATTRIBUTES`.
|
|
131
|
+
*/
|
|
132
|
+
declare const layerOtlpTracing: (options?: OtlpTracingOptions) => Layer.Layer<never, Error | Config.ConfigError, effect_unstable_http_HttpClient0.HttpClient>;
|
|
133
|
+
declare const layerOtlpMetrics: (options?: OtlpMetricsOptions) => Layer.Layer<never, Error | Config.ConfigError, effect_unstable_http_HttpClient0.HttpClient>;
|
|
134
|
+
declare const layerOtlp: (options?: OtlpTracingOptions & OtlpMetricsOptions) => Layer.Layer<never, Error | Config.ConfigError, effect_unstable_http_HttpClient0.HttpClient>;
|
|
135
|
+
declare const layerMetricsConsoleDump: (interval?: Duration.Input) => Layer.Layer<never, never, never>;
|
|
136
|
+
//#endregion
|
|
137
|
+
//#region src/connector-app/start.d.ts
|
|
138
|
+
type App = ConnectorDefinition;
|
|
139
|
+
type StartOptions = {
|
|
140
|
+
readonly port: number;
|
|
141
|
+
readonly initialCutoff?: Cursor.Value;
|
|
142
|
+
readonly healthPath?: HttpRouter.PathInput;
|
|
143
|
+
readonly metricsPath?: HttpRouter.PathInput | false;
|
|
144
|
+
readonly statusPath?: HttpRouter.PathInput | false;
|
|
145
|
+
readonly disableHttpLogger?: boolean;
|
|
146
|
+
};
|
|
147
|
+
declare const start: (app: App, options: StartOptions) => Effect.Effect<void, ConnectorError | effect_unstable_http_HttpServerError0.ServeError, StateStore | Publisher>;
|
|
148
|
+
declare namespace index_d_exports {
|
|
149
|
+
export { App, CheckOptions, CheckResult, ResourceCheckResult, StartOptions, check, start };
|
|
150
|
+
}
|
|
151
|
+
//#endregion
|
|
152
|
+
export { telemetry_d_exports as a, Fetch as c, CheckResult as d, ResourceCheckResult as f, start as i, Resource as l, App as n, Connector as o, check as p, StartOptions as r, Cursor$1 as s, index_d_exports as t, CheckOptions as u };
|
|
153
|
+
//# sourceMappingURL=index-DtJX_tic.d.ts.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { t as ConnectorError } from "./index-D54ySAKn.js";
|
|
2
|
+
import { l as ResourceDefinition, n as ConnectorDefinition, r as Cursor, x as WebhookRoute } from "./types-B35J5YPu.js";
|
|
3
|
+
import { i as Publisher } from "./service-IE5qaf9x.js";
|
|
4
|
+
import { i as StateStore } from "./index-Coh_SkBs.js";
|
|
5
|
+
import { Effect } from "effect";
|
|
6
|
+
import { HttpRouter, HttpServer } from "effect/unstable/http";
|
|
7
|
+
|
|
8
|
+
//#region src/ingestion/engine.d.ts
|
|
9
|
+
type RunBaseOptions = {
|
|
10
|
+
readonly initialCutoff?: Cursor.Value;
|
|
11
|
+
};
|
|
12
|
+
type RunOptions = RunBaseOptions & {
|
|
13
|
+
readonly webhook?: {
|
|
14
|
+
readonly routes: ReadonlyArray<WebhookRoute>;
|
|
15
|
+
readonly healthPath?: HttpRouter.PathInput;
|
|
16
|
+
readonly metricsPath?: HttpRouter.PathInput | false;
|
|
17
|
+
readonly statusPath?: HttpRouter.PathInput | false;
|
|
18
|
+
readonly disableHttpLogger?: boolean;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
type RunNoWebhookOptions = RunBaseOptions & {
|
|
22
|
+
readonly webhook?: undefined;
|
|
23
|
+
};
|
|
24
|
+
type RunWebhookOptions = RunOptions & {
|
|
25
|
+
readonly webhook: NonNullable<RunOptions["webhook"]>;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Runs all connector ingestion loops. Callers provide the Publisher and
|
|
29
|
+
* StateStore layers; webhook mode additionally requires an HttpServer layer.
|
|
30
|
+
*/
|
|
31
|
+
declare function run<const Resources extends ReadonlyArray<ResourceDefinition>>(connector: ConnectorDefinition<Resources>, options?: RunNoWebhookOptions): Effect.Effect<void, ConnectorError, StateStore | Publisher>;
|
|
32
|
+
declare function run<const Resources extends ReadonlyArray<ResourceDefinition>>(connector: ConnectorDefinition<Resources>, options: RunWebhookOptions): Effect.Effect<void, ConnectorError, StateStore | Publisher | HttpServer.HttpServer>;
|
|
33
|
+
declare namespace index_d_exports {
|
|
34
|
+
export { RunOptions, run };
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
export { RunOptions as n, run as r, index_d_exports as t };
|
|
38
|
+
//# sourceMappingURL=index-J42AZaXU.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { C as WebhookRouteInput, S as WebhookRouteContext, c as ResourceBatch, l as ResourceDefinition, x as WebhookRoute, y as WebhookAckMode } from "./types-B35J5YPu.js";
|
|
2
|
+
import { i as Publisher } from "./service-IE5qaf9x.js";
|
|
3
|
+
import { Context, Queue } from "effect";
|
|
4
|
+
import { HttpRouter } from "effect/unstable/http";
|
|
5
|
+
import * as effect_Layer0 from "effect/Layer";
|
|
6
|
+
|
|
7
|
+
//#region src/webhook/server.d.ts
|
|
8
|
+
type QueuedWebhookBatch = {
|
|
9
|
+
readonly resource: string;
|
|
10
|
+
readonly batch: ResourceBatch;
|
|
11
|
+
};
|
|
12
|
+
declare const WebhookQueue_base: Context.ServiceClass<WebhookQueue, "@useairfoil/connector-kit/WebhookQueue", {
|
|
13
|
+
readonly queue: Queue.Queue<QueuedWebhookBatch>;
|
|
14
|
+
}>;
|
|
15
|
+
declare class WebhookQueue extends WebhookQueue_base {}
|
|
16
|
+
declare const router: (routes: ReadonlyArray<WebhookRoute>, options: {
|
|
17
|
+
readonly connectorName: string;
|
|
18
|
+
}) => effect_Layer0.Layer<never, never, HttpRouter.HttpRouter | HttpRouter.Request<"Requires", WebhookQueue> | HttpRouter.Request<"Requires", Publisher>>;
|
|
19
|
+
declare namespace index_d_exports {
|
|
20
|
+
export { WebhookAckMode, WebhookRoute, WebhookRouteContext, WebhookRouteInput, route, router };
|
|
21
|
+
}
|
|
22
|
+
declare const route: <const Resources extends ReadonlyArray<ResourceDefinition>, Payload>(definition: WebhookRouteInput<Resources, Payload>) => WebhookRoute<Resources, Payload>;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { route as n, router as r, index_d_exports as t };
|
|
25
|
+
//# sourceMappingURL=index-fIIBVAai.d.ts.map
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { FileSystem } from "effect";
|
|
2
|
+
import * as effect_Types0 from "effect/Types";
|
|
3
|
+
import * as effect_Cause0 from "effect/Cause";
|
|
4
|
+
import * as effect_Layer0 from "effect/Layer";
|
|
5
|
+
|
|
6
|
+
//#region src/runtime-config/error.d.ts
|
|
7
|
+
type RuntimeConfigErrorCode = "CONFIG_PATH_MISSING" | "CONFIG_FILE_UNREADABLE" | "CONFIG_JSON_INVALID";
|
|
8
|
+
declare const RuntimeConfigError_base: new <A extends Record<string, any> = {}>(args: effect_Types0.VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => effect_Cause0.YieldableError & {
|
|
9
|
+
readonly _tag: "RuntimeConfigError";
|
|
10
|
+
} & Readonly<A>;
|
|
11
|
+
/** Expected hosted-config failure with a stable code and diagnostic cause. */
|
|
12
|
+
declare class RuntimeConfigError extends RuntimeConfigError_base<{
|
|
13
|
+
readonly code: RuntimeConfigErrorCode;
|
|
14
|
+
readonly message: string;
|
|
15
|
+
readonly cause: Error;
|
|
16
|
+
}> {}
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/runtime-config/constants.d.ts
|
|
19
|
+
/** Shared runtime keys owned by Airfoil rather than an individual connector. */
|
|
20
|
+
declare const PlatformRuntimeKey: {
|
|
21
|
+
readonly configPath: "AIRFOIL_CONFIG_PATH";
|
|
22
|
+
readonly connectorInstanceId: "AIRFOIL_CONNECTOR_INSTANCE_ID";
|
|
23
|
+
readonly stateTable: "AIRFOIL_STATE_TABLE";
|
|
24
|
+
readonly postgresConnectionString: "POSTGRES_CONNECTION_STRING";
|
|
25
|
+
readonly wingsHost: "WINGS_HOST";
|
|
26
|
+
readonly wingsNamespace: "WINGS_NAMESPACE";
|
|
27
|
+
readonly otelEnabled: "OTEL_ENABLED";
|
|
28
|
+
readonly otelExporterOtlpEndpoint: "OTEL_EXPORTER_OTLP_ENDPOINT";
|
|
29
|
+
readonly otelExporterOtlpHeaders: "OTEL_EXPORTER_OTLP_HEADERS";
|
|
30
|
+
readonly otelServiceName: "OTEL_SERVICE_NAME";
|
|
31
|
+
readonly otelServiceVersion: "OTEL_SERVICE_VERSION";
|
|
32
|
+
readonly otelResourceAttributes: "OTEL_RESOURCE_ATTRIBUTES";
|
|
33
|
+
};
|
|
34
|
+
/** Defaults for optional platform-owned runtime configuration. */
|
|
35
|
+
declare const PlatformRuntimeDefault: {
|
|
36
|
+
readonly stateTable: "_airfoil_connectors_state";
|
|
37
|
+
};
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region src/runtime-config/layer.d.ts
|
|
40
|
+
/**
|
|
41
|
+
* Loads the required JSON file and lets environment values override it per key.
|
|
42
|
+
* Connector field validation remains in the connector's Effect Config.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* program.pipe(Effect.provide(layerHosted()));
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
declare const layerHosted: () => effect_Layer0.Layer<never, RuntimeConfigError, FileSystem.FileSystem>;
|
|
50
|
+
declare namespace index_d_exports {
|
|
51
|
+
export { PlatformRuntimeDefault, PlatformRuntimeKey, RuntimeConfigError, RuntimeConfigErrorCode, layerHosted };
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
export { RuntimeConfigError as a, PlatformRuntimeKey as i, layerHosted as n, RuntimeConfigErrorCode as o, PlatformRuntimeDefault as r, index_d_exports as t };
|
|
55
|
+
//# sourceMappingURL=index-o1-Z3n7V.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,165 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
declare class ConnectorError extends ConnectorError_base<{
|
|
16
|
-
readonly message: string;
|
|
17
|
-
readonly cause?: unknown;
|
|
18
|
-
}> {}
|
|
19
|
-
//#endregion
|
|
20
|
-
//#region src/core/types.d.ts
|
|
21
|
-
type Cursor = string | number | bigint | Date;
|
|
22
|
-
type Batch<T> = {
|
|
23
|
-
readonly cursor: Cursor;
|
|
24
|
-
readonly rows: ReadonlyArray<T>;
|
|
25
|
-
};
|
|
26
|
-
type StreamState<C = Cursor> = {
|
|
27
|
-
readonly cutoff: C;
|
|
28
|
-
readonly current?: C;
|
|
29
|
-
};
|
|
30
|
-
type IngestionState<C = Cursor> = {
|
|
31
|
-
readonly backfill: StreamState<C>;
|
|
32
|
-
readonly live: StreamState<C>;
|
|
33
|
-
};
|
|
34
|
-
type Transform<T> = (row: T) => Effect.Effect<T, ConnectorError>;
|
|
35
|
-
type LiveStream<T> = Stream.Stream<Batch<T>, ConnectorError>;
|
|
36
|
-
type BackfillStream<T> = Stream.Stream<Batch<T>, ConnectorError>;
|
|
37
|
-
type WebhookStream<T> = {
|
|
38
|
-
/**
|
|
39
|
-
* The queue is used to store the batches that are received from the webhook.
|
|
40
|
-
*/
|
|
41
|
-
readonly queue: Queue.Queue<Batch<T>>;
|
|
42
|
-
/**
|
|
43
|
-
* The stream is used to process the batches that are received from the webhook.
|
|
44
|
-
*/
|
|
45
|
-
readonly stream: Stream.Stream<Batch<T>, ConnectorError>;
|
|
46
|
-
};
|
|
47
|
-
type LiveSource<T> = LiveStream<T> | WebhookStream<T>;
|
|
48
|
-
/** Schema type used by connector definitions. */
|
|
49
|
-
type EntitySchema = Schema.Schema<unknown>;
|
|
50
|
-
/** Decoded row type produced by a schema. */
|
|
51
|
-
type EntityType<S extends EntitySchema> = Schema.Schema.Type<S>;
|
|
52
|
-
/** Primary key type derived from the decoded schema shape. */
|
|
53
|
-
type EntityKey<S extends EntitySchema> = EntityType<S> extends Record<string, unknown> ? keyof EntityType<S> & string : never;
|
|
54
|
-
/** Row type constrained to object-like shapes for ingestion. */
|
|
55
|
-
type EntityRow<S extends EntitySchema> = EntityType<S> & Record<string, unknown>;
|
|
56
|
-
type EntityDefinition<S extends EntitySchema> = {
|
|
57
|
-
readonly name: string;
|
|
58
|
-
readonly schema: S;
|
|
59
|
-
/**
|
|
60
|
-
* The primary key is used to identify the rows in the database.
|
|
61
|
-
*/
|
|
62
|
-
readonly primaryKey: EntityKey<S>;
|
|
63
|
-
/**
|
|
64
|
-
* The live source is used to stream the live data from the database.
|
|
65
|
-
*/
|
|
66
|
-
readonly live: LiveSource<EntityRow<S>>;
|
|
67
|
-
/**
|
|
68
|
-
* The backfill stream is used to stream the backfill data from the database.
|
|
69
|
-
*/
|
|
70
|
-
readonly backfill: BackfillStream<EntityRow<S>>;
|
|
71
|
-
/**
|
|
72
|
-
* The transform is used to transform the rows before they are published.
|
|
73
|
-
*/
|
|
74
|
-
readonly transform?: Transform<EntityRow<S>>;
|
|
75
|
-
};
|
|
76
|
-
type EventDefinition<S extends EntitySchema> = {
|
|
77
|
-
readonly name: string;
|
|
78
|
-
readonly schema: S;
|
|
79
|
-
/**
|
|
80
|
-
* The live source is used to stream the live data from the database.
|
|
81
|
-
*/
|
|
82
|
-
readonly live: LiveSource<EntityRow<S>>;
|
|
83
|
-
/**
|
|
84
|
-
* The backfill stream is used to stream the backfill data from the database.
|
|
85
|
-
*/
|
|
86
|
-
readonly backfill?: BackfillStream<EntityRow<S>>;
|
|
87
|
-
/**
|
|
88
|
-
* The transform is used to transform the rows before they are published.
|
|
89
|
-
*/
|
|
90
|
-
readonly transform?: Transform<EntityRow<S>>;
|
|
91
|
-
};
|
|
92
|
-
type ConnectorDefinition<Entities extends ReadonlyArray<EntityDefinition<EntitySchema>> = ReadonlyArray<EntityDefinition<EntitySchema>>, Events extends ReadonlyArray<EventDefinition<EntitySchema>> = ReadonlyArray<EventDefinition<EntitySchema>>> = {
|
|
93
|
-
readonly name: string;
|
|
94
|
-
readonly entities: Entities;
|
|
95
|
-
readonly events: Events;
|
|
96
|
-
};
|
|
97
|
-
//#endregion
|
|
98
|
-
//#region src/core/builder.d.ts
|
|
99
|
-
declare const defineConnector: <const Entities extends ReadonlyArray<EntityDefinition<EntitySchema>>, const Events extends ReadonlyArray<EventDefinition<EntitySchema>>>(definition: ConnectorDefinition<Entities, Events>) => ConnectorDefinition<Entities, Events>;
|
|
100
|
-
declare const defineEntity: <S extends EntitySchema>(definition: EntityDefinition<S>) => EntityDefinition<S>;
|
|
101
|
-
declare const defineEvent: <S extends EntitySchema>(definition: EventDefinition<S>) => EventDefinition<S>;
|
|
102
|
-
//#endregion
|
|
103
|
-
//#region src/publisher/service.d.ts
|
|
104
|
-
type PublishAck = {
|
|
105
|
-
readonly success: boolean;
|
|
106
|
-
};
|
|
107
|
-
declare const Publisher_base: Context.ServiceClass<Publisher, "Publisher", {
|
|
108
|
-
readonly publish: (options: {
|
|
109
|
-
readonly name: string;
|
|
110
|
-
readonly batch: Batch<Record<string, unknown>>;
|
|
111
|
-
}) => Effect$1.Effect<PublishAck, ConnectorError>;
|
|
112
|
-
}>;
|
|
113
|
-
declare class Publisher extends Publisher_base {}
|
|
114
|
-
//#endregion
|
|
115
|
-
//#region src/ingestion/state-store.d.ts
|
|
116
|
-
declare const StateStore_base: Context.ServiceClass<StateStore, "StateStore", {
|
|
117
|
-
readonly getState: (key: string) => Effect.Effect<IngestionState<Cursor> | undefined, ConnectorError>;
|
|
118
|
-
readonly setState: (key: string, state: IngestionState<Cursor>) => Effect.Effect<void, ConnectorError>;
|
|
119
|
-
}>;
|
|
120
|
-
declare class StateStore extends StateStore_base {}
|
|
121
|
-
declare const StateStoreInMemory: Layer.Layer<StateStore, never, never>;
|
|
122
|
-
//#endregion
|
|
123
|
-
//#region src/ingestion/engine.d.ts
|
|
124
|
-
declare const runConnector: (connector: ConnectorDefinition, initialCutoff: Cursor) => Effect.Effect<void, ConnectorError, StateStore | Publisher>;
|
|
125
|
-
//#endregion
|
|
126
|
-
//#region src/publisher/wings.d.ts
|
|
127
|
-
type WingsPublisherConfig = {
|
|
128
|
-
readonly connector: ConnectorDefinition;
|
|
129
|
-
/** Map of entity/event name to Wings topic. */
|
|
130
|
-
readonly topics: Record<string, Wings.Cluster.Topic.Topic>;
|
|
131
|
-
/** per-stream partition value (key is entity/event name). */
|
|
132
|
-
readonly partitionValues?: Record<string, PartitionValue>;
|
|
133
|
-
};
|
|
134
|
-
declare const WingsPublisherLayer: (config: WingsPublisherConfig) => Layer.Layer<Publisher, ConnectorError, Wings.WingsClient.WingsClient>;
|
|
135
|
-
//#endregion
|
|
136
|
-
//#region src/streams/pull-stream.d.ts
|
|
137
|
-
type PullPage<T> = {
|
|
138
|
-
readonly cursor: Cursor;
|
|
139
|
-
readonly rows: ReadonlyArray<T>;
|
|
140
|
-
readonly hasMore: boolean;
|
|
141
|
-
};
|
|
142
|
-
type PullFetcher<T, R = never> = (cursor: Cursor | undefined) => Effect.Effect<PullPage<T>, ConnectorError, R>;
|
|
143
|
-
type PullStreamOptions<T, R = never> = {
|
|
144
|
-
readonly initialCursor?: Cursor;
|
|
145
|
-
readonly fetchPage: PullFetcher<T, R>;
|
|
146
|
-
};
|
|
147
|
-
declare const makePullStream: <T, R = never>(options: PullStreamOptions<T, R>) => Stream.Stream<Batch<T>, ConnectorError, R>;
|
|
148
|
-
//#endregion
|
|
149
|
-
//#region src/streams/webhook-queue.d.ts
|
|
150
|
-
declare const makeWebhookQueue: <T>(options?: {
|
|
151
|
-
readonly capacity?: number;
|
|
152
|
-
}) => Effect.Effect<WebhookStream<T>, never>;
|
|
153
|
-
//#endregion
|
|
154
|
-
//#region src/webhook/types.d.ts
|
|
155
|
-
type WebhookRoute<TPayload> = {
|
|
156
|
-
readonly path: HttpRouter.PathInput;
|
|
157
|
-
readonly schema: Schema$1.Schema<TPayload>;
|
|
158
|
-
readonly handle: (payload: TPayload, request: HttpServerRequest.HttpServerRequest, rawBody?: Uint8Array) => Effect.Effect<void, ConnectorError>;
|
|
159
|
-
};
|
|
160
|
-
//#endregion
|
|
161
|
-
//#region src/webhook/server.d.ts
|
|
162
|
-
declare const buildWebhookRouter: <TPayload>(routes: ReadonlyArray<WebhookRoute<TPayload>>) => effect_Layer0.Layer<never, never, HttpRouter.HttpRouter | HttpRouter.Request<"Requires", unknown>>;
|
|
163
|
-
//#endregion
|
|
164
|
-
export { type BackfillStream, type Batch, type ConnectorDefinition, ConnectorError, type Cursor, type EntityDefinition, type EntityKey, type EntityRow, type EntitySchema, type EntityType, type EventDefinition, type IngestionState, type LiveSource, type LiveStream, Publisher, StateStore, StateStoreInMemory, type StreamState, type Transform, type WebhookRoute, type WebhookStream, WingsPublisherLayer, buildWebhookRouter, defineConnector, defineEntity, defineEvent, makePullStream, makeWebhookQueue, runConnector };
|
|
165
|
-
//# sourceMappingURL=index.d.ts.map
|
|
1
|
+
import { t as index_d_exports } from "./index-CTHVudvQ.js";
|
|
2
|
+
import { t as ConnectorError } from "./index-D54ySAKn.js";
|
|
3
|
+
import { S as WebhookRouteContext, _ as ResourceState, a as FetchChangesResult, b as WebhookHandler, c as ResourceBatch, d as ResourceMutation, g as ResourceSchema, h as ResourceRows, l as ResourceDefinition, m as ResourceRow, n as ConnectorDefinition, o as FetchPageResult, p as ResourcePayload, r as Cursor$1, s as PageFetch, t as ChangesFetch, u as ResourceField, x as WebhookRoute, y as WebhookAckMode } from "./types-B35J5YPu.js";
|
|
4
|
+
import { a as telemetry_d_exports, c as Fetch, l as Resource, o as Connector, s as Cursor, t as index_d_exports$1 } from "./index-DtJX_tic.js";
|
|
5
|
+
import "./service-IE5qaf9x.js";
|
|
6
|
+
import { t as index_d_exports$6 } from "./index-Coh_SkBs.js";
|
|
7
|
+
import { t as index_d_exports$2 } from "./index-J42AZaXU.js";
|
|
8
|
+
import { t as index_d_exports$3 } from "./index-CBT-JX-T.js";
|
|
9
|
+
import { g as metrics_d_exports } from "./metrics-CVAk1ALR.js";
|
|
10
|
+
import { t as index_d_exports$4 } from "./index-Byr0Lf0C.js";
|
|
11
|
+
import { t as index_d_exports$5 } from "./index-o1-Z3n7V.js";
|
|
12
|
+
import { t as index_d_exports$7 } from "./index-CTLYQ74P.js";
|
|
13
|
+
import { t as index_d_exports$8 } from "./index-fIIBVAai.js";
|
|
14
|
+
export { index_d_exports as Auth, ChangesFetch, Connector, index_d_exports$1 as ConnectorApp, ConnectorDefinition, ConnectorError, Cursor, Cursor$1 as CursorTypes, Fetch, FetchChangesResult, FetchPageResult, index_d_exports$2 as Ingestion, index_d_exports$3 as Manifest, metrics_d_exports as Metrics, PageFetch, index_d_exports$4 as Publisher, Resource, ResourceBatch, ResourceDefinition, ResourceField, ResourceMutation, ResourcePayload, ResourceRow, ResourceRows, ResourceSchema, ResourceState, index_d_exports$5 as RuntimeConfig, index_d_exports$6 as StateStore, index_d_exports$7 as Status, telemetry_d_exports as Telemetry, index_d_exports$8 as Webhook, WebhookAckMode, WebhookHandler, WebhookRoute, WebhookRouteContext };
|