@tinybirdco/sdk 0.0.41 → 0.0.42
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 +26 -0
- package/dist/api/resources.d.ts +72 -1
- package/dist/api/resources.d.ts.map +1 -1
- package/dist/api/resources.js +197 -1
- package/dist/api/resources.js.map +1 -1
- package/dist/api/resources.test.js +82 -1
- package/dist/api/resources.test.js.map +1 -1
- package/dist/cli/commands/migrate.d.ts +11 -0
- package/dist/cli/commands/migrate.d.ts.map +1 -0
- package/dist/cli/commands/migrate.js +196 -0
- package/dist/cli/commands/migrate.js.map +1 -0
- package/dist/cli/commands/migrate.test.d.ts +2 -0
- package/dist/cli/commands/migrate.test.d.ts.map +1 -0
- package/dist/cli/commands/migrate.test.js +473 -0
- package/dist/cli/commands/migrate.test.js.map +1 -0
- package/dist/cli/commands/pull.d.ts +59 -0
- package/dist/cli/commands/pull.d.ts.map +1 -0
- package/dist/cli/commands/pull.js +104 -0
- package/dist/cli/commands/pull.js.map +1 -0
- package/dist/cli/commands/pull.test.d.ts +2 -0
- package/dist/cli/commands/pull.test.d.ts.map +1 -0
- package/dist/cli/commands/pull.test.js +140 -0
- package/dist/cli/commands/pull.test.js.map +1 -0
- package/dist/cli/index.js +77 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/migrate/discovery.d.ts +7 -0
- package/dist/migrate/discovery.d.ts.map +1 -0
- package/dist/migrate/discovery.js +125 -0
- package/dist/migrate/discovery.js.map +1 -0
- package/dist/migrate/emit-ts.d.ts +4 -0
- package/dist/migrate/emit-ts.d.ts.map +1 -0
- package/dist/migrate/emit-ts.js +387 -0
- package/dist/migrate/emit-ts.js.map +1 -0
- package/dist/migrate/parse-connection.d.ts +3 -0
- package/dist/migrate/parse-connection.d.ts.map +1 -0
- package/dist/migrate/parse-connection.js +74 -0
- package/dist/migrate/parse-connection.js.map +1 -0
- package/dist/migrate/parse-datasource.d.ts +3 -0
- package/dist/migrate/parse-datasource.d.ts.map +1 -0
- package/dist/migrate/parse-datasource.js +324 -0
- package/dist/migrate/parse-datasource.js.map +1 -0
- package/dist/migrate/parse-pipe.d.ts +3 -0
- package/dist/migrate/parse-pipe.d.ts.map +1 -0
- package/dist/migrate/parse-pipe.js +332 -0
- package/dist/migrate/parse-pipe.js.map +1 -0
- package/dist/migrate/parse.d.ts +3 -0
- package/dist/migrate/parse.d.ts.map +1 -0
- package/dist/migrate/parse.js +18 -0
- package/dist/migrate/parse.js.map +1 -0
- package/dist/migrate/parser-utils.d.ts +20 -0
- package/dist/migrate/parser-utils.d.ts.map +1 -0
- package/dist/migrate/parser-utils.js +130 -0
- package/dist/migrate/parser-utils.js.map +1 -0
- package/dist/migrate/types.d.ts +110 -0
- package/dist/migrate/types.d.ts.map +1 -0
- package/dist/migrate/types.js +2 -0
- package/dist/migrate/types.js.map +1 -0
- package/package.json +1 -1
- package/src/api/resources.test.ts +121 -0
- package/src/api/resources.ts +292 -1
- package/src/cli/commands/migrate.test.ts +564 -0
- package/src/cli/commands/migrate.ts +240 -0
- package/src/cli/commands/pull.test.ts +173 -0
- package/src/cli/commands/pull.ts +177 -0
- package/src/cli/index.ts +112 -0
- package/src/migrate/discovery.ts +151 -0
- package/src/migrate/emit-ts.ts +469 -0
- package/src/migrate/parse-connection.ts +128 -0
- package/src/migrate/parse-datasource.ts +453 -0
- package/src/migrate/parse-pipe.ts +518 -0
- package/src/migrate/parse.ts +20 -0
- package/src/migrate/parser-utils.ts +160 -0
- package/src/migrate/types.ts +125 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
export type ResourceKind = "datasource" | "pipe" | "connection";
|
|
2
|
+
|
|
3
|
+
export interface ResourceFile {
|
|
4
|
+
kind: ResourceKind;
|
|
5
|
+
filePath: string;
|
|
6
|
+
absolutePath: string;
|
|
7
|
+
name: string;
|
|
8
|
+
content: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface MigrationError {
|
|
12
|
+
filePath: string;
|
|
13
|
+
resourceName: string;
|
|
14
|
+
resourceKind: ResourceKind;
|
|
15
|
+
message: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface DatasourceColumnModel {
|
|
19
|
+
name: string;
|
|
20
|
+
type: string;
|
|
21
|
+
jsonPath?: string;
|
|
22
|
+
defaultExpression?: string;
|
|
23
|
+
codec?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface DatasourceEngineModel {
|
|
27
|
+
type: string;
|
|
28
|
+
sortingKey: string[];
|
|
29
|
+
partitionKey?: string;
|
|
30
|
+
primaryKey?: string[];
|
|
31
|
+
ttl?: string;
|
|
32
|
+
ver?: string;
|
|
33
|
+
sign?: string;
|
|
34
|
+
version?: string;
|
|
35
|
+
summingColumns?: string[];
|
|
36
|
+
settings?: Record<string, string | number | boolean>;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface DatasourceKafkaModel {
|
|
40
|
+
connectionName: string;
|
|
41
|
+
topic: string;
|
|
42
|
+
groupId?: string;
|
|
43
|
+
autoOffsetReset?: "earliest" | "latest";
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface DatasourceTokenModel {
|
|
47
|
+
name: string;
|
|
48
|
+
scope: "READ" | "APPEND";
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface DatasourceModel {
|
|
52
|
+
kind: "datasource";
|
|
53
|
+
name: string;
|
|
54
|
+
filePath: string;
|
|
55
|
+
description?: string;
|
|
56
|
+
columns: DatasourceColumnModel[];
|
|
57
|
+
engine: DatasourceEngineModel;
|
|
58
|
+
kafka?: DatasourceKafkaModel;
|
|
59
|
+
forwardQuery?: string;
|
|
60
|
+
tokens: DatasourceTokenModel[];
|
|
61
|
+
sharedWith: string[];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface PipeNodeModel {
|
|
65
|
+
name: string;
|
|
66
|
+
description?: string;
|
|
67
|
+
sql: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface PipeTokenModel {
|
|
71
|
+
name: string;
|
|
72
|
+
scope: "READ";
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export type PipeTypeModel = "pipe" | "endpoint" | "materialized" | "copy";
|
|
76
|
+
|
|
77
|
+
export interface PipeParamModel {
|
|
78
|
+
name: string;
|
|
79
|
+
type: string;
|
|
80
|
+
required: boolean;
|
|
81
|
+
defaultValue?: string | number;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface PipeModel {
|
|
85
|
+
kind: "pipe";
|
|
86
|
+
name: string;
|
|
87
|
+
filePath: string;
|
|
88
|
+
description?: string;
|
|
89
|
+
type: PipeTypeModel;
|
|
90
|
+
nodes: PipeNodeModel[];
|
|
91
|
+
cacheTtl?: number;
|
|
92
|
+
materializedDatasource?: string;
|
|
93
|
+
deploymentMethod?: "alter";
|
|
94
|
+
copyTargetDatasource?: string;
|
|
95
|
+
copySchedule?: string;
|
|
96
|
+
copyMode?: "append" | "replace";
|
|
97
|
+
tokens: PipeTokenModel[];
|
|
98
|
+
params: PipeParamModel[];
|
|
99
|
+
inferredOutputColumns: string[];
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export interface KafkaConnectionModel {
|
|
103
|
+
kind: "connection";
|
|
104
|
+
name: string;
|
|
105
|
+
filePath: string;
|
|
106
|
+
connectionType: "kafka";
|
|
107
|
+
bootstrapServers: string;
|
|
108
|
+
securityProtocol?: "SASL_SSL" | "PLAINTEXT" | "SASL_PLAINTEXT";
|
|
109
|
+
saslMechanism?: "PLAIN" | "SCRAM-SHA-256" | "SCRAM-SHA-512" | "OAUTHBEARER";
|
|
110
|
+
key?: string;
|
|
111
|
+
secret?: string;
|
|
112
|
+
sslCaPem?: string;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export type ParsedResource = DatasourceModel | PipeModel | KafkaConnectionModel;
|
|
116
|
+
|
|
117
|
+
export interface MigrationResult {
|
|
118
|
+
success: boolean;
|
|
119
|
+
outputPath: string;
|
|
120
|
+
migrated: ParsedResource[];
|
|
121
|
+
errors: MigrationError[];
|
|
122
|
+
dryRun: boolean;
|
|
123
|
+
outputContent?: string;
|
|
124
|
+
}
|
|
125
|
+
|