@tinybirdco/sdk 0.0.47 → 0.0.48
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/dist/cli/commands/migrate.test.js +187 -7
- package/dist/cli/commands/migrate.test.js.map +1 -1
- package/dist/generator/connection.d.ts.map +1 -1
- package/dist/generator/connection.js +3 -0
- package/dist/generator/connection.js.map +1 -1
- package/dist/generator/connection.test.js +8 -0
- package/dist/generator/connection.test.js.map +1 -1
- package/dist/generator/datasource.d.ts.map +1 -1
- package/dist/generator/datasource.js +3 -0
- package/dist/generator/datasource.js.map +1 -1
- package/dist/generator/datasource.test.js +50 -0
- package/dist/generator/datasource.test.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/index.test.js +3 -0
- package/dist/index.test.js.map +1 -1
- package/dist/migrate/emit-ts.d.ts.map +1 -1
- package/dist/migrate/emit-ts.js +109 -32
- package/dist/migrate/emit-ts.js.map +1 -1
- package/dist/migrate/parse-connection.d.ts.map +1 -1
- package/dist/migrate/parse-connection.js +13 -2
- package/dist/migrate/parse-connection.js.map +1 -1
- package/dist/migrate/parse-datasource.d.ts.map +1 -1
- package/dist/migrate/parse-datasource.js +39 -4
- package/dist/migrate/parse-datasource.js.map +1 -1
- package/dist/migrate/parse-pipe.d.ts.map +1 -1
- package/dist/migrate/parse-pipe.js +3 -2
- package/dist/migrate/parse-pipe.js.map +1 -1
- package/dist/migrate/types.d.ts +3 -0
- package/dist/migrate/types.d.ts.map +1 -1
- package/dist/schema/connection.d.ts +2 -0
- package/dist/schema/connection.d.ts.map +1 -1
- package/dist/schema/connection.js.map +1 -1
- package/dist/schema/datasource.d.ts +3 -1
- package/dist/schema/datasource.d.ts.map +1 -1
- package/dist/schema/datasource.js +8 -1
- package/dist/schema/datasource.js.map +1 -1
- package/dist/schema/datasource.test.js +12 -0
- package/dist/schema/datasource.test.js.map +1 -1
- package/dist/schema/engines.d.ts.map +1 -1
- package/dist/schema/engines.js +3 -0
- package/dist/schema/engines.js.map +1 -1
- package/dist/schema/engines.test.js +16 -0
- package/dist/schema/engines.test.js.map +1 -1
- package/dist/schema/secret.d.ts +6 -0
- package/dist/schema/secret.d.ts.map +1 -0
- package/dist/schema/secret.js +14 -0
- package/dist/schema/secret.js.map +1 -0
- package/dist/schema/secret.test.d.ts +2 -0
- package/dist/schema/secret.test.d.ts.map +1 -0
- package/dist/schema/secret.test.js +14 -0
- package/dist/schema/secret.test.js.map +1 -0
- package/dist/schema/types.d.ts +5 -0
- package/dist/schema/types.d.ts.map +1 -1
- package/dist/schema/types.js +6 -0
- package/dist/schema/types.js.map +1 -1
- package/dist/schema/types.test.js +12 -0
- package/dist/schema/types.test.js.map +1 -1
- package/package.json +1 -1
- package/src/cli/commands/migrate.test.ts +279 -7
- package/src/generator/connection.test.ts +13 -0
- package/src/generator/connection.ts +4 -0
- package/src/generator/datasource.test.ts +60 -0
- package/src/generator/datasource.ts +3 -0
- package/src/index.test.ts +4 -0
- package/src/index.ts +3 -0
- package/src/migrate/emit-ts.ts +109 -38
- package/src/migrate/parse-connection.ts +15 -2
- package/src/migrate/parse-datasource.ts +53 -4
- package/src/migrate/parse-pipe.ts +5 -3
- package/src/migrate/types.ts +3 -0
- package/src/schema/connection.ts +2 -0
- package/src/schema/datasource.test.ts +16 -0
- package/src/schema/datasource.ts +13 -2
- package/src/schema/engines.test.ts +18 -0
- package/src/schema/engines.ts +3 -0
- package/src/schema/secret.test.ts +19 -0
- package/src/schema/secret.ts +16 -0
- package/src/schema/types.test.ts +14 -0
- package/src/schema/types.ts +10 -0
package/src/schema/types.ts
CHANGED
|
@@ -32,6 +32,8 @@ export interface TypeValidator<
|
|
|
32
32
|
default(value: TType): TypeValidator<TType, TTinybirdType, TModifiers & { hasDefault: true; defaultValue: TType }>;
|
|
33
33
|
/** Set a codec for compression */
|
|
34
34
|
codec(codec: string): TypeValidator<TType, TTinybirdType, TModifiers & { codec: string }>;
|
|
35
|
+
/** Set an explicit JSON path for extraction (overrides autogenerated path) */
|
|
36
|
+
jsonPath(path: string): TypeValidator<TType, TTinybirdType, TModifiers & { jsonPath: string }>;
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
export interface TypeModifiers {
|
|
@@ -40,6 +42,7 @@ export interface TypeModifiers {
|
|
|
40
42
|
hasDefault?: boolean;
|
|
41
43
|
defaultValue?: unknown;
|
|
42
44
|
codec?: string;
|
|
45
|
+
jsonPath?: string;
|
|
43
46
|
}
|
|
44
47
|
|
|
45
48
|
// Internal implementation
|
|
@@ -110,6 +113,13 @@ function createValidator<TType, TTinybirdType extends string>(
|
|
|
110
113
|
codec,
|
|
111
114
|
}) as TypeValidator<TType, TTinybirdType, TypeModifiers & { codec: string }>;
|
|
112
115
|
},
|
|
116
|
+
|
|
117
|
+
jsonPath(path: string) {
|
|
118
|
+
return createValidator<TType, TTinybirdType>(tinybirdType, {
|
|
119
|
+
...modifiers,
|
|
120
|
+
jsonPath: path,
|
|
121
|
+
}) as TypeValidator<TType, TTinybirdType, TypeModifiers & { jsonPath: string }>;
|
|
122
|
+
},
|
|
113
123
|
};
|
|
114
124
|
|
|
115
125
|
return validator;
|