@tinybirdco/sdk 0.0.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/README.md +518 -0
- package/bin/tinybird.js +7 -0
- package/dist/api/branches.d.ts +98 -0
- package/dist/api/branches.d.ts.map +1 -0
- package/dist/api/branches.js +203 -0
- package/dist/api/branches.js.map +1 -0
- package/dist/api/branches.test.d.ts +2 -0
- package/dist/api/branches.test.d.ts.map +1 -0
- package/dist/api/branches.test.js +286 -0
- package/dist/api/branches.test.js.map +1 -0
- package/dist/api/build.d.ts +130 -0
- package/dist/api/build.d.ts.map +1 -0
- package/dist/api/build.js +143 -0
- package/dist/api/build.js.map +1 -0
- package/dist/api/build.test.d.ts +2 -0
- package/dist/api/build.test.d.ts.map +1 -0
- package/dist/api/build.test.js +138 -0
- package/dist/api/build.test.js.map +1 -0
- package/dist/api/deploy.d.ts +39 -0
- package/dist/api/deploy.d.ts.map +1 -0
- package/dist/api/deploy.js +135 -0
- package/dist/api/deploy.js.map +1 -0
- package/dist/api/deploy.test.d.ts +2 -0
- package/dist/api/deploy.test.d.ts.map +1 -0
- package/dist/api/deploy.test.js +118 -0
- package/dist/api/deploy.test.js.map +1 -0
- package/dist/api/workspaces.d.ts +46 -0
- package/dist/api/workspaces.d.ts.map +1 -0
- package/dist/api/workspaces.js +39 -0
- package/dist/api/workspaces.js.map +1 -0
- package/dist/api/workspaces.test.d.ts +2 -0
- package/dist/api/workspaces.test.d.ts.map +1 -0
- package/dist/api/workspaces.test.js +65 -0
- package/dist/api/workspaces.test.js.map +1 -0
- package/dist/cli/auth.d.ts +86 -0
- package/dist/cli/auth.d.ts.map +1 -0
- package/dist/cli/auth.js +284 -0
- package/dist/cli/auth.js.map +1 -0
- package/dist/cli/branch-store.d.ts +53 -0
- package/dist/cli/branch-store.d.ts.map +1 -0
- package/dist/cli/branch-store.js +91 -0
- package/dist/cli/branch-store.js.map +1 -0
- package/dist/cli/branch-store.test.d.ts +2 -0
- package/dist/cli/branch-store.test.d.ts.map +1 -0
- package/dist/cli/branch-store.test.js +115 -0
- package/dist/cli/branch-store.test.js.map +1 -0
- package/dist/cli/commands/branch.d.ts +82 -0
- package/dist/cli/commands/branch.d.ts.map +1 -0
- package/dist/cli/commands/branch.js +215 -0
- package/dist/cli/commands/branch.js.map +1 -0
- package/dist/cli/commands/build.d.ts +43 -0
- package/dist/cli/commands/build.d.ts.map +1 -0
- package/dist/cli/commands/build.js +138 -0
- package/dist/cli/commands/build.js.map +1 -0
- package/dist/cli/commands/dev.d.ts +78 -0
- package/dist/cli/commands/dev.d.ts.map +1 -0
- package/dist/cli/commands/dev.js +226 -0
- package/dist/cli/commands/dev.js.map +1 -0
- package/dist/cli/commands/init.d.ts +45 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +277 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/init.test.d.ts +2 -0
- package/dist/cli/commands/init.test.d.ts.map +1 -0
- package/dist/cli/commands/init.test.js +158 -0
- package/dist/cli/commands/init.test.js.map +1 -0
- package/dist/cli/commands/login.d.ts +37 -0
- package/dist/cli/commands/login.d.ts.map +1 -0
- package/dist/cli/commands/login.js +64 -0
- package/dist/cli/commands/login.js.map +1 -0
- package/dist/cli/config.d.ts +114 -0
- package/dist/cli/config.d.ts.map +1 -0
- package/dist/cli/config.js +258 -0
- package/dist/cli/config.js.map +1 -0
- package/dist/cli/config.test.d.ts +2 -0
- package/dist/cli/config.test.d.ts.map +1 -0
- package/dist/cli/config.test.js +243 -0
- package/dist/cli/config.test.js.map +1 -0
- package/dist/cli/env.d.ts +29 -0
- package/dist/cli/env.d.ts.map +1 -0
- package/dist/cli/env.js +66 -0
- package/dist/cli/env.js.map +1 -0
- package/dist/cli/git.d.ts +29 -0
- package/dist/cli/git.d.ts.map +1 -0
- package/dist/cli/git.js +114 -0
- package/dist/cli/git.js.map +1 -0
- package/dist/cli/git.test.d.ts +2 -0
- package/dist/cli/git.test.d.ts.map +1 -0
- package/dist/cli/git.test.js +125 -0
- package/dist/cli/git.test.js.map +1 -0
- package/dist/cli/index.d.ts +7 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +337 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/utils/schema-validation.d.ts +95 -0
- package/dist/cli/utils/schema-validation.d.ts.map +1 -0
- package/dist/cli/utils/schema-validation.js +175 -0
- package/dist/cli/utils/schema-validation.js.map +1 -0
- package/dist/cli/utils/schema-validation.test.d.ts +5 -0
- package/dist/cli/utils/schema-validation.test.d.ts.map +1 -0
- package/dist/cli/utils/schema-validation.test.js +173 -0
- package/dist/cli/utils/schema-validation.test.js.map +1 -0
- package/dist/client/base.d.ts +116 -0
- package/dist/client/base.d.ts.map +1 -0
- package/dist/client/base.js +328 -0
- package/dist/client/base.js.map +1 -0
- package/dist/client/types.d.ts +137 -0
- package/dist/client/types.d.ts.map +1 -0
- package/dist/client/types.js +43 -0
- package/dist/client/types.js.map +1 -0
- package/dist/generator/client.d.ts +44 -0
- package/dist/generator/client.d.ts.map +1 -0
- package/dist/generator/client.js +144 -0
- package/dist/generator/client.js.map +1 -0
- package/dist/generator/datasource.d.ts +57 -0
- package/dist/generator/datasource.d.ts.map +1 -0
- package/dist/generator/datasource.js +169 -0
- package/dist/generator/datasource.js.map +1 -0
- package/dist/generator/datasource.test.d.ts +2 -0
- package/dist/generator/datasource.test.d.ts.map +1 -0
- package/dist/generator/datasource.test.js +254 -0
- package/dist/generator/datasource.test.js.map +1 -0
- package/dist/generator/index.d.ts +131 -0
- package/dist/generator/index.d.ts.map +1 -0
- package/dist/generator/index.js +121 -0
- package/dist/generator/index.js.map +1 -0
- package/dist/generator/index.test.d.ts +2 -0
- package/dist/generator/index.test.d.ts.map +1 -0
- package/dist/generator/index.test.js +175 -0
- package/dist/generator/index.test.js.map +1 -0
- package/dist/generator/loader.d.ts +156 -0
- package/dist/generator/loader.d.ts.map +1 -0
- package/dist/generator/loader.js +295 -0
- package/dist/generator/loader.js.map +1 -0
- package/dist/generator/pipe.d.ts +72 -0
- package/dist/generator/pipe.d.ts.map +1 -0
- package/dist/generator/pipe.js +174 -0
- package/dist/generator/pipe.js.map +1 -0
- package/dist/generator/pipe.test.d.ts +2 -0
- package/dist/generator/pipe.test.d.ts.map +1 -0
- package/dist/generator/pipe.test.js +393 -0
- package/dist/generator/pipe.test.js.map +1 -0
- package/dist/index.d.ts +74 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +73 -0
- package/dist/index.js.map +1 -0
- package/dist/infer/index.d.ts +202 -0
- package/dist/infer/index.d.ts.map +1 -0
- package/dist/infer/index.js +5 -0
- package/dist/infer/index.js.map +1 -0
- package/dist/schema/datasource.d.ts +135 -0
- package/dist/schema/datasource.d.ts.map +1 -0
- package/dist/schema/datasource.js +105 -0
- package/dist/schema/datasource.js.map +1 -0
- package/dist/schema/datasource.test.d.ts +2 -0
- package/dist/schema/datasource.test.d.ts.map +1 -0
- package/dist/schema/datasource.test.js +142 -0
- package/dist/schema/datasource.test.js.map +1 -0
- package/dist/schema/engines.d.ts +157 -0
- package/dist/schema/engines.d.ts.map +1 -0
- package/dist/schema/engines.js +155 -0
- package/dist/schema/engines.js.map +1 -0
- package/dist/schema/engines.test.d.ts +2 -0
- package/dist/schema/engines.test.d.ts.map +1 -0
- package/dist/schema/engines.test.js +221 -0
- package/dist/schema/engines.test.js.map +1 -0
- package/dist/schema/params.d.ts +106 -0
- package/dist/schema/params.d.ts.map +1 -0
- package/dist/schema/params.js +138 -0
- package/dist/schema/params.js.map +1 -0
- package/dist/schema/params.test.d.ts +2 -0
- package/dist/schema/params.test.d.ts.map +1 -0
- package/dist/schema/params.test.js +175 -0
- package/dist/schema/params.test.js.map +1 -0
- package/dist/schema/pipe.d.ts +436 -0
- package/dist/schema/pipe.d.ts.map +1 -0
- package/dist/schema/pipe.js +484 -0
- package/dist/schema/pipe.js.map +1 -0
- package/dist/schema/pipe.test.d.ts +2 -0
- package/dist/schema/pipe.test.d.ts.map +1 -0
- package/dist/schema/pipe.test.js +488 -0
- package/dist/schema/pipe.test.js.map +1 -0
- package/dist/schema/project.d.ts +202 -0
- package/dist/schema/project.d.ts.map +1 -0
- package/dist/schema/project.js +188 -0
- package/dist/schema/project.js.map +1 -0
- package/dist/schema/project.test.d.ts +2 -0
- package/dist/schema/project.test.d.ts.map +1 -0
- package/dist/schema/project.test.js +180 -0
- package/dist/schema/project.test.js.map +1 -0
- package/dist/schema/types.d.ts +140 -0
- package/dist/schema/types.d.ts.map +1 -0
- package/dist/schema/types.js +174 -0
- package/dist/schema/types.js.map +1 -0
- package/dist/schema/types.test.d.ts +2 -0
- package/dist/schema/types.test.d.ts.map +1 -0
- package/dist/schema/types.test.js +176 -0
- package/dist/schema/types.test.js.map +1 -0
- package/dist/test/handlers.d.ts +58 -0
- package/dist/test/handlers.d.ts.map +1 -0
- package/dist/test/handlers.js +62 -0
- package/dist/test/handlers.js.map +1 -0
- package/dist/test/setup.d.ts +5 -0
- package/dist/test/setup.d.ts.map +1 -0
- package/dist/test/setup.js +11 -0
- package/dist/test/setup.js.map +1 -0
- package/package.json +57 -0
- package/src/api/branches.test.ts +377 -0
- package/src/api/branches.ts +334 -0
- package/src/api/build.test.ts +216 -0
- package/src/api/build.ts +266 -0
- package/src/api/deploy.test.ts +193 -0
- package/src/api/deploy.ts +163 -0
- package/src/api/workspaces.test.ts +81 -0
- package/src/api/workspaces.ts +77 -0
- package/src/cli/auth.ts +358 -0
- package/src/cli/branch-store.test.ts +139 -0
- package/src/cli/branch-store.ts +137 -0
- package/src/cli/commands/branch.ts +306 -0
- package/src/cli/commands/build.ts +183 -0
- package/src/cli/commands/dev.ts +334 -0
- package/src/cli/commands/init.test.ts +249 -0
- package/src/cli/commands/init.ts +323 -0
- package/src/cli/commands/login.ts +98 -0
- package/src/cli/config.test.ts +359 -0
- package/src/cli/config.ts +335 -0
- package/src/cli/env.ts +86 -0
- package/src/cli/git.test.ts +147 -0
- package/src/cli/git.ts +125 -0
- package/src/cli/index.ts +382 -0
- package/src/cli/utils/schema-validation.test.ts +222 -0
- package/src/cli/utils/schema-validation.ts +272 -0
- package/src/client/base.ts +414 -0
- package/src/client/types.ts +165 -0
- package/src/generator/client.ts +194 -0
- package/src/generator/datasource.test.ts +297 -0
- package/src/generator/datasource.ts +217 -0
- package/src/generator/index.test.ts +209 -0
- package/src/generator/index.ts +203 -0
- package/src/generator/loader.ts +406 -0
- package/src/generator/pipe.test.ts +441 -0
- package/src/generator/pipe.ts +220 -0
- package/src/index.ts +191 -0
- package/src/infer/index.ts +247 -0
- package/src/schema/datasource.test.ts +187 -0
- package/src/schema/datasource.ts +195 -0
- package/src/schema/engines.test.ts +247 -0
- package/src/schema/engines.ts +271 -0
- package/src/schema/params.test.ts +208 -0
- package/src/schema/params.ts +249 -0
- package/src/schema/pipe.test.ts +588 -0
- package/src/schema/pipe.ts +832 -0
- package/src/schema/project.test.ts +236 -0
- package/src/schema/project.ts +394 -0
- package/src/schema/types.test.ts +212 -0
- package/src/schema/types.ts +366 -0
- package/src/test/handlers.ts +79 -0
- package/src/test/setup.ts +13 -0
|
@@ -0,0 +1,484 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pipe definition for Tinybird
|
|
3
|
+
* Define SQL transformations and endpoints as TypeScript with full type safety
|
|
4
|
+
*/
|
|
5
|
+
import { getColumnType } from "./datasource.js";
|
|
6
|
+
import { getTinybirdType } from "./types.js";
|
|
7
|
+
/** Symbol for brand typing pipes */
|
|
8
|
+
export const PIPE_BRAND = Symbol("tinybird.pipe");
|
|
9
|
+
/** Symbol for brand typing nodes */
|
|
10
|
+
export const NODE_BRAND = Symbol("tinybird.node");
|
|
11
|
+
/**
|
|
12
|
+
* Create a node within a pipe
|
|
13
|
+
*
|
|
14
|
+
* @param options - Node configuration
|
|
15
|
+
* @returns A node definition
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* import { node } from '@tinybirdco/sdk';
|
|
20
|
+
*
|
|
21
|
+
* const filteredNode = node({
|
|
22
|
+
* name: 'filtered',
|
|
23
|
+
* sql: `
|
|
24
|
+
* SELECT *
|
|
25
|
+
* FROM events
|
|
26
|
+
* WHERE timestamp >= {{DateTime(start_date)}}
|
|
27
|
+
* `,
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export function node(options) {
|
|
32
|
+
// Validate name is a valid identifier
|
|
33
|
+
if (!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(options.name)) {
|
|
34
|
+
throw new Error(`Invalid node name: "${options.name}". Must start with a letter or underscore and contain only alphanumeric characters and underscores.`);
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
[NODE_BRAND]: true,
|
|
38
|
+
_name: options.name,
|
|
39
|
+
_type: "node",
|
|
40
|
+
sql: options.sql,
|
|
41
|
+
description: options.description,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Check if a value is a node definition
|
|
46
|
+
*/
|
|
47
|
+
export function isNodeDefinition(value) {
|
|
48
|
+
return (typeof value === "object" &&
|
|
49
|
+
value !== null &&
|
|
50
|
+
NODE_BRAND in value &&
|
|
51
|
+
value[NODE_BRAND] === true);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Define a Tinybird pipe
|
|
55
|
+
*
|
|
56
|
+
* @param name - The pipe name (must be valid identifier)
|
|
57
|
+
* @param options - Pipe configuration including params, nodes, and output schema
|
|
58
|
+
* @returns A pipe definition that can be used in a project
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```ts
|
|
62
|
+
* import { definePipe, node, p, t } from '@tinybirdco/sdk';
|
|
63
|
+
*
|
|
64
|
+
* export const topEvents = definePipe('top_events', {
|
|
65
|
+
* description: 'Get top events by count',
|
|
66
|
+
* params: {
|
|
67
|
+
* start_date: p.dateTime(),
|
|
68
|
+
* end_date: p.dateTime(),
|
|
69
|
+
* limit: p.int32().optional(10),
|
|
70
|
+
* },
|
|
71
|
+
* nodes: [
|
|
72
|
+
* node({
|
|
73
|
+
* name: 'filtered',
|
|
74
|
+
* sql: `
|
|
75
|
+
* SELECT *
|
|
76
|
+
* FROM events
|
|
77
|
+
* WHERE timestamp BETWEEN {{DateTime(start_date)}} AND {{DateTime(end_date)}}
|
|
78
|
+
* `,
|
|
79
|
+
* }),
|
|
80
|
+
* node({
|
|
81
|
+
* name: 'aggregated',
|
|
82
|
+
* sql: `
|
|
83
|
+
* SELECT
|
|
84
|
+
* event_type,
|
|
85
|
+
* count() as event_count,
|
|
86
|
+
* uniqExact(user_id) as unique_users
|
|
87
|
+
* FROM filtered
|
|
88
|
+
* GROUP BY event_type
|
|
89
|
+
* ORDER BY event_count DESC
|
|
90
|
+
* LIMIT {{Int32(limit, 10)}}
|
|
91
|
+
* `,
|
|
92
|
+
* }),
|
|
93
|
+
* ],
|
|
94
|
+
* output: {
|
|
95
|
+
* event_type: t.string(),
|
|
96
|
+
* event_count: t.uint64(),
|
|
97
|
+
* unique_users: t.uint64(),
|
|
98
|
+
* },
|
|
99
|
+
* endpoint: true,
|
|
100
|
+
* });
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
/**
|
|
104
|
+
* Normalize a Tinybird type for comparison by removing wrappers that don't affect compatibility
|
|
105
|
+
*/
|
|
106
|
+
function normalizeTypeForComparison(type) {
|
|
107
|
+
// Remove Nullable wrapper for comparison
|
|
108
|
+
let normalized = type.replace(/^Nullable\((.+)\)$/, "$1");
|
|
109
|
+
// Remove LowCardinality wrapper
|
|
110
|
+
normalized = normalized.replace(/^LowCardinality\((.+)\)$/, "$1");
|
|
111
|
+
// Handle LowCardinality(Nullable(...))
|
|
112
|
+
normalized = normalized.replace(/^LowCardinality\(Nullable\((.+)\)\)$/, "$1");
|
|
113
|
+
// Remove timezone from DateTime types
|
|
114
|
+
normalized = normalized.replace(/^DateTime\('[^']+'\)$/, "DateTime");
|
|
115
|
+
normalized = normalized.replace(/^DateTime64\((\d+),\s*'[^']+'\)$/, "DateTime64($1)");
|
|
116
|
+
return normalized;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Check if two Tinybird types are compatible
|
|
120
|
+
*/
|
|
121
|
+
function typesAreCompatible(outputType, datasourceType) {
|
|
122
|
+
const normalizedOutput = normalizeTypeForComparison(outputType);
|
|
123
|
+
const normalizedDatasource = normalizeTypeForComparison(datasourceType);
|
|
124
|
+
// Direct match
|
|
125
|
+
if (normalizedOutput === normalizedDatasource) {
|
|
126
|
+
return true;
|
|
127
|
+
}
|
|
128
|
+
// SimpleAggregateFunction compatibility: output can be the base type
|
|
129
|
+
// e.g., output UInt64 -> datasource SimpleAggregateFunction(sum, UInt64)
|
|
130
|
+
const simpleAggMatch = normalizedDatasource.match(/^SimpleAggregateFunction\([^,]+,\s*(.+)\)$/);
|
|
131
|
+
if (simpleAggMatch && normalizedOutput === simpleAggMatch[1]) {
|
|
132
|
+
return true;
|
|
133
|
+
}
|
|
134
|
+
// AggregateFunction compatibility
|
|
135
|
+
const aggMatch = normalizedDatasource.match(/^AggregateFunction\([^,]+,\s*(.+)\)$/);
|
|
136
|
+
if (aggMatch && normalizedOutput === aggMatch[1]) {
|
|
137
|
+
return true;
|
|
138
|
+
}
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Validate that the pipe output schema matches the target datasource schema
|
|
143
|
+
*/
|
|
144
|
+
function validateMaterializedSchema(pipeName, output, datasource) {
|
|
145
|
+
const outputColumns = Object.keys(output);
|
|
146
|
+
const datasourceSchema = datasource._schema;
|
|
147
|
+
const datasourceColumns = Object.keys(datasourceSchema);
|
|
148
|
+
// Check for missing columns in output
|
|
149
|
+
const missingInOutput = datasourceColumns.filter((col) => !outputColumns.includes(col));
|
|
150
|
+
if (missingInOutput.length > 0) {
|
|
151
|
+
throw new Error(`Materialized view "${pipeName}" output schema is missing columns from target datasource "${datasource._name}": ${missingInOutput.join(", ")}`);
|
|
152
|
+
}
|
|
153
|
+
// Check for extra columns in output
|
|
154
|
+
const extraInOutput = outputColumns.filter((col) => !datasourceColumns.includes(col));
|
|
155
|
+
if (extraInOutput.length > 0) {
|
|
156
|
+
throw new Error(`Materialized view "${pipeName}" output schema has columns not in target datasource "${datasource._name}": ${extraInOutput.join(", ")}`);
|
|
157
|
+
}
|
|
158
|
+
// Check type compatibility for each column
|
|
159
|
+
for (const columnName of outputColumns) {
|
|
160
|
+
const outputValidator = output[columnName];
|
|
161
|
+
const datasourceColumn = datasourceSchema[columnName];
|
|
162
|
+
const outputType = getTinybirdType(outputValidator);
|
|
163
|
+
const datasourceValidator = getColumnType(datasourceColumn);
|
|
164
|
+
const datasourceType = getTinybirdType(datasourceValidator);
|
|
165
|
+
if (!typesAreCompatible(outputType, datasourceType)) {
|
|
166
|
+
throw new Error(`Materialized view "${pipeName}" column "${columnName}" type mismatch: ` +
|
|
167
|
+
`output has "${outputType}" but target datasource "${datasource._name}" expects "${datasourceType}"`);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
export function definePipe(name, options) {
|
|
172
|
+
// Validate name is a valid identifier
|
|
173
|
+
if (!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(name)) {
|
|
174
|
+
throw new Error(`Invalid pipe name: "${name}". Must start with a letter or underscore and contain only alphanumeric characters and underscores.`);
|
|
175
|
+
}
|
|
176
|
+
// Validate at least one node
|
|
177
|
+
if (!options.nodes || options.nodes.length === 0) {
|
|
178
|
+
throw new Error(`Pipe "${name}" must have at least one node.`);
|
|
179
|
+
}
|
|
180
|
+
// Validate output is provided for endpoints and materialized views
|
|
181
|
+
if ((options.endpoint || options.materialized) && (!options.output || Object.keys(options.output).length === 0)) {
|
|
182
|
+
throw new Error(`Pipe "${name}" must have an output schema defined when used as an endpoint or materialized view.`);
|
|
183
|
+
}
|
|
184
|
+
// Count how many types are configured
|
|
185
|
+
const typeCount = [options.endpoint, options.materialized, options.copy].filter(Boolean).length;
|
|
186
|
+
if (typeCount > 1) {
|
|
187
|
+
throw new Error(`Pipe "${name}" can only have one of: endpoint, materialized, or copy configuration. ` +
|
|
188
|
+
`A pipe must be at most one type.`);
|
|
189
|
+
}
|
|
190
|
+
// Validate materialized view schema compatibility
|
|
191
|
+
if (options.materialized) {
|
|
192
|
+
// output is guaranteed to be defined here because of the earlier validation
|
|
193
|
+
validateMaterializedSchema(name, options.output, options.materialized.datasource);
|
|
194
|
+
}
|
|
195
|
+
const params = (options.params ?? {});
|
|
196
|
+
return {
|
|
197
|
+
[PIPE_BRAND]: true,
|
|
198
|
+
_name: name,
|
|
199
|
+
_type: "pipe",
|
|
200
|
+
_params: params,
|
|
201
|
+
_output: options.output,
|
|
202
|
+
options: {
|
|
203
|
+
...options,
|
|
204
|
+
params,
|
|
205
|
+
},
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Define a Tinybird materialized view
|
|
210
|
+
*
|
|
211
|
+
* This is a convenience function that simplifies creating materialized views.
|
|
212
|
+
* The output schema is automatically derived from the target datasource, ensuring
|
|
213
|
+
* type safety between the pipe output and the target.
|
|
214
|
+
*
|
|
215
|
+
* @param name - The pipe name (must be valid identifier)
|
|
216
|
+
* @param options - Materialized view configuration
|
|
217
|
+
* @returns A pipe definition configured as a materialized view
|
|
218
|
+
*
|
|
219
|
+
* @example
|
|
220
|
+
* ```ts
|
|
221
|
+
* import { defineDatasource, defineMaterializedView, node, t, engine } from '@tinybirdco/sdk';
|
|
222
|
+
*
|
|
223
|
+
* // Target datasource for aggregated data
|
|
224
|
+
* const salesByHour = defineDatasource('sales_by_hour', {
|
|
225
|
+
* schema: {
|
|
226
|
+
* day: t.date(),
|
|
227
|
+
* country: t.string().lowCardinality(),
|
|
228
|
+
* total_sales: t.simpleAggregateFunction('sum', t.uint64()),
|
|
229
|
+
* },
|
|
230
|
+
* engine: engine.aggregatingMergeTree({
|
|
231
|
+
* sortingKey: ['day', 'country'],
|
|
232
|
+
* }),
|
|
233
|
+
* });
|
|
234
|
+
*
|
|
235
|
+
* // Materialized view - output schema is inferred from datasource
|
|
236
|
+
* export const salesByHourMv = defineMaterializedView('sales_by_hour_mv', {
|
|
237
|
+
* description: 'Aggregate sales per hour',
|
|
238
|
+
* datasource: salesByHour,
|
|
239
|
+
* nodes: [
|
|
240
|
+
* node({
|
|
241
|
+
* name: 'daily_sales',
|
|
242
|
+
* sql: `
|
|
243
|
+
* SELECT
|
|
244
|
+
* toStartOfDay(starting_date) as day,
|
|
245
|
+
* country,
|
|
246
|
+
* sum(sales) as total_sales
|
|
247
|
+
* FROM teams
|
|
248
|
+
* GROUP BY day, country
|
|
249
|
+
* `,
|
|
250
|
+
* }),
|
|
251
|
+
* ],
|
|
252
|
+
* deploymentMethod: 'alter', // optional
|
|
253
|
+
* });
|
|
254
|
+
* ```
|
|
255
|
+
*/
|
|
256
|
+
export function defineMaterializedView(name, options) {
|
|
257
|
+
// Extract the schema from the datasource to build the output
|
|
258
|
+
const datasourceSchema = options.datasource._schema;
|
|
259
|
+
const output = {};
|
|
260
|
+
for (const [columnName, column] of Object.entries(datasourceSchema)) {
|
|
261
|
+
output[columnName] = getColumnType(column);
|
|
262
|
+
}
|
|
263
|
+
return definePipe(name, {
|
|
264
|
+
description: options.description,
|
|
265
|
+
nodes: options.nodes,
|
|
266
|
+
output: output,
|
|
267
|
+
materialized: {
|
|
268
|
+
datasource: options.datasource,
|
|
269
|
+
deploymentMethod: options.deploymentMethod,
|
|
270
|
+
},
|
|
271
|
+
tokens: options.tokens,
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Define a Tinybird endpoint
|
|
276
|
+
*
|
|
277
|
+
* This is a convenience function for creating API endpoints.
|
|
278
|
+
* Endpoints are pipes that are exposed as HTTP API endpoints.
|
|
279
|
+
*
|
|
280
|
+
* @param name - The endpoint name (must be valid identifier)
|
|
281
|
+
* @param options - Endpoint configuration including params, nodes, and output schema
|
|
282
|
+
* @returns A pipe definition configured as an endpoint
|
|
283
|
+
*
|
|
284
|
+
* @example
|
|
285
|
+
* ```ts
|
|
286
|
+
* import { defineEndpoint, node, p, t } from '@tinybirdco/sdk';
|
|
287
|
+
*
|
|
288
|
+
* export const topEvents = defineEndpoint('top_events', {
|
|
289
|
+
* description: 'Get top events by count',
|
|
290
|
+
* params: {
|
|
291
|
+
* start_date: p.dateTime(),
|
|
292
|
+
* end_date: p.dateTime(),
|
|
293
|
+
* limit: p.int32().optional(10),
|
|
294
|
+
* },
|
|
295
|
+
* nodes: [
|
|
296
|
+
* node({
|
|
297
|
+
* name: 'aggregated',
|
|
298
|
+
* sql: `
|
|
299
|
+
* SELECT
|
|
300
|
+
* event_type,
|
|
301
|
+
* count() as event_count
|
|
302
|
+
* FROM events
|
|
303
|
+
* WHERE timestamp BETWEEN {{DateTime(start_date)}} AND {{DateTime(end_date)}}
|
|
304
|
+
* GROUP BY event_type
|
|
305
|
+
* ORDER BY event_count DESC
|
|
306
|
+
* LIMIT {{Int32(limit, 10)}}
|
|
307
|
+
* `,
|
|
308
|
+
* }),
|
|
309
|
+
* ],
|
|
310
|
+
* output: {
|
|
311
|
+
* event_type: t.string(),
|
|
312
|
+
* event_count: t.uint64(),
|
|
313
|
+
* },
|
|
314
|
+
* });
|
|
315
|
+
* ```
|
|
316
|
+
*/
|
|
317
|
+
export function defineEndpoint(name, options) {
|
|
318
|
+
return definePipe(name, {
|
|
319
|
+
description: options.description,
|
|
320
|
+
params: options.params,
|
|
321
|
+
nodes: options.nodes,
|
|
322
|
+
output: options.output,
|
|
323
|
+
endpoint: options.cache ? { enabled: true, cache: options.cache } : true,
|
|
324
|
+
tokens: options.tokens,
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Define a Tinybird copy pipe
|
|
329
|
+
*
|
|
330
|
+
* Copy pipes capture the result of a pipe at a moment in time and write
|
|
331
|
+
* the result into a target data source. They can be run on a schedule,
|
|
332
|
+
* or executed on demand.
|
|
333
|
+
*
|
|
334
|
+
* Unlike materialized views which continuously update as new events are inserted,
|
|
335
|
+
* copy pipes generate a single snapshot at a specific point in time.
|
|
336
|
+
*
|
|
337
|
+
* @param name - The copy pipe name (must be valid identifier)
|
|
338
|
+
* @param options - Copy pipe configuration
|
|
339
|
+
* @returns A pipe definition configured as a copy pipe
|
|
340
|
+
*
|
|
341
|
+
* @example
|
|
342
|
+
* ```ts
|
|
343
|
+
* import { defineCopyPipe, defineDatasource, node, t, engine } from '@tinybirdco/sdk';
|
|
344
|
+
*
|
|
345
|
+
* // Target datasource for daily snapshots
|
|
346
|
+
* const dailySalesSnapshot = defineDatasource('daily_sales_snapshot', {
|
|
347
|
+
* schema: {
|
|
348
|
+
* snapshot_date: t.date(),
|
|
349
|
+
* country: t.string(),
|
|
350
|
+
* total_sales: t.uint64(),
|
|
351
|
+
* },
|
|
352
|
+
* engine: engine.mergeTree({
|
|
353
|
+
* sortingKey: ['snapshot_date', 'country'],
|
|
354
|
+
* }),
|
|
355
|
+
* });
|
|
356
|
+
*
|
|
357
|
+
* // Copy pipe that runs daily at midnight
|
|
358
|
+
* export const dailySalesCopy = defineCopyPipe('daily_sales_copy', {
|
|
359
|
+
* description: 'Daily snapshot of sales by country',
|
|
360
|
+
* datasource: dailySalesSnapshot,
|
|
361
|
+
* copy_schedule: '0 0 * * *', // Daily at midnight UTC
|
|
362
|
+
* copy_mode: 'append',
|
|
363
|
+
* nodes: [
|
|
364
|
+
* node({
|
|
365
|
+
* name: 'snapshot',
|
|
366
|
+
* sql: `
|
|
367
|
+
* SELECT
|
|
368
|
+
* today() AS snapshot_date,
|
|
369
|
+
* country,
|
|
370
|
+
* sum(sales) AS total_sales
|
|
371
|
+
* FROM sales
|
|
372
|
+
* WHERE date = today() - 1
|
|
373
|
+
* GROUP BY country
|
|
374
|
+
* `,
|
|
375
|
+
* }),
|
|
376
|
+
* ],
|
|
377
|
+
* });
|
|
378
|
+
* ```
|
|
379
|
+
*/
|
|
380
|
+
export function defineCopyPipe(name, options) {
|
|
381
|
+
// Extract the schema from the datasource to build the output
|
|
382
|
+
const datasourceSchema = options.datasource._schema;
|
|
383
|
+
const output = {};
|
|
384
|
+
for (const [columnName, column] of Object.entries(datasourceSchema)) {
|
|
385
|
+
output[columnName] = getColumnType(column);
|
|
386
|
+
}
|
|
387
|
+
return definePipe(name, {
|
|
388
|
+
description: options.description,
|
|
389
|
+
nodes: options.nodes,
|
|
390
|
+
output: output,
|
|
391
|
+
copy: {
|
|
392
|
+
datasource: options.datasource,
|
|
393
|
+
copy_mode: options.copy_mode,
|
|
394
|
+
copy_schedule: options.copy_schedule,
|
|
395
|
+
},
|
|
396
|
+
tokens: options.tokens,
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Check if a value is a pipe definition
|
|
401
|
+
*/
|
|
402
|
+
export function isPipeDefinition(value) {
|
|
403
|
+
return (typeof value === "object" &&
|
|
404
|
+
value !== null &&
|
|
405
|
+
PIPE_BRAND in value &&
|
|
406
|
+
value[PIPE_BRAND] === true);
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Get the endpoint configuration from a pipe
|
|
410
|
+
*/
|
|
411
|
+
export function getEndpointConfig(pipe) {
|
|
412
|
+
const { endpoint } = pipe.options;
|
|
413
|
+
if (!endpoint) {
|
|
414
|
+
return null;
|
|
415
|
+
}
|
|
416
|
+
if (typeof endpoint === "boolean") {
|
|
417
|
+
return endpoint ? { enabled: true } : null;
|
|
418
|
+
}
|
|
419
|
+
return endpoint.enabled ? endpoint : null;
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Get the materialized view configuration from a pipe
|
|
423
|
+
*/
|
|
424
|
+
export function getMaterializedConfig(pipe) {
|
|
425
|
+
return pipe.options.materialized ?? null;
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Check if a pipe is a materialized view
|
|
429
|
+
*/
|
|
430
|
+
export function isMaterializedView(pipe) {
|
|
431
|
+
return pipe.options.materialized !== undefined;
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* Get the copy pipe configuration from a pipe
|
|
435
|
+
*/
|
|
436
|
+
export function getCopyConfig(pipe) {
|
|
437
|
+
return pipe.options.copy ?? null;
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Check if a pipe is a copy pipe
|
|
441
|
+
*/
|
|
442
|
+
export function isCopyPipe(pipe) {
|
|
443
|
+
return pipe.options.copy !== undefined;
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Get all node names from a pipe
|
|
447
|
+
*/
|
|
448
|
+
export function getNodeNames(pipe) {
|
|
449
|
+
return pipe.options.nodes.map((n) => n._name);
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Get a specific node by name
|
|
453
|
+
*/
|
|
454
|
+
export function getNode(pipe, name) {
|
|
455
|
+
return pipe.options.nodes.find((n) => n._name === name);
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* SQL template helper for referencing datasources and other nodes
|
|
459
|
+
* This is a simple helper - for complex templating, use raw strings
|
|
460
|
+
*
|
|
461
|
+
* @example
|
|
462
|
+
* ```ts
|
|
463
|
+
* import { sql, events } from './datasources/events';
|
|
464
|
+
*
|
|
465
|
+
* const query = sql`SELECT * FROM ${events} WHERE id = 1`;
|
|
466
|
+
* // Results in: "SELECT * FROM events WHERE id = 1"
|
|
467
|
+
* ```
|
|
468
|
+
*/
|
|
469
|
+
export function sql(strings, ...values) {
|
|
470
|
+
return strings.reduce((result, str, i) => {
|
|
471
|
+
const value = values[i];
|
|
472
|
+
if (value === undefined) {
|
|
473
|
+
return result + str;
|
|
474
|
+
}
|
|
475
|
+
if (typeof value === "string" || typeof value === "number") {
|
|
476
|
+
return result + str + String(value);
|
|
477
|
+
}
|
|
478
|
+
if ("_name" in value) {
|
|
479
|
+
return result + str + value._name;
|
|
480
|
+
}
|
|
481
|
+
return result + str;
|
|
482
|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