@tinybirdco/sdk 0.0.20 → 0.0.22
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/api/dashboard.d.ts +74 -0
- package/dist/api/dashboard.d.ts.map +1 -0
- package/dist/api/dashboard.js +102 -0
- package/dist/api/dashboard.js.map +1 -0
- package/dist/api/dashboard.test.d.ts +2 -0
- package/dist/api/dashboard.test.d.ts.map +1 -0
- package/dist/api/dashboard.test.js +91 -0
- package/dist/api/dashboard.test.js.map +1 -0
- package/dist/cli/commands/branch.d.ts +2 -0
- package/dist/cli/commands/branch.d.ts.map +1 -1
- package/dist/cli/commands/branch.js +12 -1
- package/dist/cli/commands/branch.js.map +1 -1
- package/dist/cli/commands/build.d.ts +17 -0
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/build.js +25 -0
- package/dist/cli/commands/build.js.map +1 -1
- package/dist/cli/commands/dev.d.ts +2 -0
- package/dist/cli/commands/dev.d.ts.map +1 -1
- package/dist/cli/commands/dev.js +19 -3
- package/dist/cli/commands/dev.js.map +1 -1
- package/dist/cli/index.js +23 -24
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/output.d.ts +20 -0
- package/dist/cli/output.d.ts.map +1 -1
- package/dist/cli/output.js +37 -0
- package/dist/cli/output.js.map +1 -1
- package/dist/client/base.d.ts +36 -5
- package/dist/client/base.d.ts.map +1 -1
- package/dist/client/base.js +64 -18
- package/dist/client/base.js.map +1 -1
- package/dist/client/base.test.d.ts +2 -0
- package/dist/client/base.test.d.ts.map +1 -0
- package/dist/client/base.test.js +104 -0
- package/dist/client/base.test.js.map +1 -0
- package/dist/client/types.d.ts +16 -0
- package/dist/client/types.d.ts.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/api/dashboard.test.ts +115 -0
- package/src/api/dashboard.ts +121 -0
- package/src/cli/commands/branch.ts +15 -1
- package/src/cli/commands/build.ts +46 -0
- package/src/cli/commands/dev.ts +47 -7
- package/src/cli/index.ts +25 -27
- package/src/cli/output.ts +54 -0
- package/src/client/base.test.ts +129 -0
- package/src/client/base.ts +68 -18
- package/src/client/types.ts +17 -0
- package/src/index.ts +10 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { TinybirdClient, createClient } from "./base.js";
|
|
3
|
+
describe("TinybirdClient", () => {
|
|
4
|
+
describe("constructor", () => {
|
|
5
|
+
it("throws error when baseUrl is missing", () => {
|
|
6
|
+
expect(() => new TinybirdClient({ baseUrl: "", token: "test-token" })).toThrow("baseUrl is required");
|
|
7
|
+
});
|
|
8
|
+
it("throws error when token is missing", () => {
|
|
9
|
+
expect(() => new TinybirdClient({ baseUrl: "https://api.tinybird.co", token: "" })).toThrow("token is required");
|
|
10
|
+
});
|
|
11
|
+
it("creates client with valid config", () => {
|
|
12
|
+
const client = new TinybirdClient({
|
|
13
|
+
baseUrl: "https://api.tinybird.co",
|
|
14
|
+
token: "test-token",
|
|
15
|
+
});
|
|
16
|
+
expect(client).toBeInstanceOf(TinybirdClient);
|
|
17
|
+
});
|
|
18
|
+
it("normalizes baseUrl by removing trailing slash", async () => {
|
|
19
|
+
const client = new TinybirdClient({
|
|
20
|
+
baseUrl: "https://api.tinybird.co/",
|
|
21
|
+
token: "test-token",
|
|
22
|
+
});
|
|
23
|
+
const context = await client.getContext();
|
|
24
|
+
expect(context.baseUrl).toBe("https://api.tinybird.co");
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
describe("getContext", () => {
|
|
28
|
+
it("returns correct context in non-devMode", async () => {
|
|
29
|
+
const client = new TinybirdClient({
|
|
30
|
+
baseUrl: "https://api.tinybird.co",
|
|
31
|
+
token: "test-token",
|
|
32
|
+
});
|
|
33
|
+
const context = await client.getContext();
|
|
34
|
+
expect(context).toEqual({
|
|
35
|
+
token: "test-token",
|
|
36
|
+
baseUrl: "https://api.tinybird.co",
|
|
37
|
+
devMode: false,
|
|
38
|
+
isBranchToken: false,
|
|
39
|
+
branchName: null,
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
it("returns devMode: false when devMode is not set", async () => {
|
|
43
|
+
const client = new TinybirdClient({
|
|
44
|
+
baseUrl: "https://api.tinybird.co",
|
|
45
|
+
token: "test-token",
|
|
46
|
+
});
|
|
47
|
+
const context = await client.getContext();
|
|
48
|
+
expect(context.devMode).toBe(false);
|
|
49
|
+
});
|
|
50
|
+
it("returns isBranchToken: false when not in devMode", async () => {
|
|
51
|
+
const client = new TinybirdClient({
|
|
52
|
+
baseUrl: "https://api.tinybird.co",
|
|
53
|
+
token: "test-token",
|
|
54
|
+
});
|
|
55
|
+
const context = await client.getContext();
|
|
56
|
+
expect(context.isBranchToken).toBe(false);
|
|
57
|
+
});
|
|
58
|
+
it("returns branchName: null when not in devMode", async () => {
|
|
59
|
+
const client = new TinybirdClient({
|
|
60
|
+
baseUrl: "https://api.tinybird.co",
|
|
61
|
+
token: "test-token",
|
|
62
|
+
});
|
|
63
|
+
const context = await client.getContext();
|
|
64
|
+
expect(context.branchName).toBeNull();
|
|
65
|
+
});
|
|
66
|
+
it("caches the resolved context", async () => {
|
|
67
|
+
const client = new TinybirdClient({
|
|
68
|
+
baseUrl: "https://api.tinybird.co",
|
|
69
|
+
token: "test-token",
|
|
70
|
+
});
|
|
71
|
+
const context1 = await client.getContext();
|
|
72
|
+
const context2 = await client.getContext();
|
|
73
|
+
expect(context1).toBe(context2);
|
|
74
|
+
});
|
|
75
|
+
it("works with different baseUrl regions", async () => {
|
|
76
|
+
const client = new TinybirdClient({
|
|
77
|
+
baseUrl: "https://api.us-east.tinybird.co",
|
|
78
|
+
token: "us-token",
|
|
79
|
+
});
|
|
80
|
+
const context = await client.getContext();
|
|
81
|
+
expect(context.baseUrl).toBe("https://api.us-east.tinybird.co");
|
|
82
|
+
expect(context.token).toBe("us-token");
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
describe("createClient", () => {
|
|
86
|
+
it("creates a TinybirdClient instance", () => {
|
|
87
|
+
const client = createClient({
|
|
88
|
+
baseUrl: "https://api.tinybird.co",
|
|
89
|
+
token: "test-token",
|
|
90
|
+
});
|
|
91
|
+
expect(client).toBeInstanceOf(TinybirdClient);
|
|
92
|
+
});
|
|
93
|
+
it("passes config to the client correctly", async () => {
|
|
94
|
+
const client = createClient({
|
|
95
|
+
baseUrl: "https://api.tinybird.co",
|
|
96
|
+
token: "my-token",
|
|
97
|
+
});
|
|
98
|
+
const context = await client.getContext();
|
|
99
|
+
expect(context.token).toBe("my-token");
|
|
100
|
+
expect(context.baseUrl).toBe("https://api.tinybird.co");
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
//# sourceMappingURL=base.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.test.js","sourceRoot":"","sources":["../../src/client/base.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzD,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;QAC3B,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;YAC9C,MAAM,CAAC,GAAG,EAAE,CAAC,IAAI,cAAc,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,OAAO,CAC5E,qBAAqB,CACtB,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;YAC5C,MAAM,CACJ,GAAG,EAAE,CAAC,IAAI,cAAc,CAAC,EAAE,OAAO,EAAE,yBAAyB,E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;AACL,CAAC,CAAC,CAAC"}
|
package/dist/client/types.d.ts
CHANGED
|
@@ -119,6 +119,22 @@ export interface IngestOptions {
|
|
|
119
119
|
/** Wait for the ingestion to complete before returning */
|
|
120
120
|
wait?: boolean;
|
|
121
121
|
}
|
|
122
|
+
/**
|
|
123
|
+
* Client context information
|
|
124
|
+
* Contains the resolved configuration and state of the client
|
|
125
|
+
*/
|
|
126
|
+
export interface ClientContext {
|
|
127
|
+
/** The resolved token being used for requests (workspace or branch token) */
|
|
128
|
+
token: string;
|
|
129
|
+
/** Tinybird API base URL */
|
|
130
|
+
baseUrl: string;
|
|
131
|
+
/** Whether dev mode is enabled */
|
|
132
|
+
devMode: boolean;
|
|
133
|
+
/** Whether the resolved token is a branch token (vs workspace token) */
|
|
134
|
+
isBranchToken: boolean;
|
|
135
|
+
/** The branch name if using a branch token */
|
|
136
|
+
branchName: string | null;
|
|
137
|
+
}
|
|
122
138
|
/**
|
|
123
139
|
* Base interface for typed pipe endpoints
|
|
124
140
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/client/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,mGAAmG;IACnG,OAAO,EAAE,MAAM,CAAC;IAChB,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;IACrB,iDAAiD;IACjD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,kBAAkB;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,8BAA8B;IAC9B,OAAO,EAAE,MAAM,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EAAE,WAAW,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,sCAAsC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8CAA8C;IAC9C,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,0DAA0D;IAC1D,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,6EAA6E;IAC7E,KAAK,EAAE,MAAM,CAAC;IACd,4BAA4B;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,kCAAkC;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,wEAAwE;IACxE,aAAa,EAAE,OAAO,CAAC;IACvB,8CAA8C;IAC9C,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB,CAAC,OAAO,EAAE,OAAO;IACjD,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC;CAC1E;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB,CAAC,IAAI;IACzC,0BAA0B;IAC1B,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAClE,sCAAsC;IACtC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CAC3E"}
|
package/dist/index.d.ts
CHANGED
|
@@ -74,8 +74,10 @@ export type { ProjectDefinition, ProjectConfig, ProjectClient, TinybirdClientCon
|
|
|
74
74
|
export type { Infer, InferRow, InferParams, InferOutput, InferOutputRow, InferEvent, PartialRow, InferSchema, InferTinybirdTypes, InferMaterializedTarget, InferMaterializedTargetRow, IsMaterializedPipe, } from "./infer/index.js";
|
|
75
75
|
export { TinybirdClient, createClient } from "./client/base.js";
|
|
76
76
|
export { TinybirdError } from "./client/types.js";
|
|
77
|
-
export type { ClientConfig, QueryResult, IngestResult, QueryOptions, IngestOptions, ColumnMeta, QueryStatistics, TinybirdErrorResponse, TypedPipeEndpoint, TypedDatasourceIngest, } from "./client/types.js";
|
|
77
|
+
export type { ClientConfig, ClientContext, QueryResult, IngestResult, QueryOptions, IngestOptions, ColumnMeta, QueryStatistics, TinybirdErrorResponse, TypedPipeEndpoint, TypedDatasourceIngest, } from "./client/types.js";
|
|
78
78
|
export { TinybirdApi, TinybirdApiError, createTinybirdApi, createTinybirdApiWrapper, } from "./api/api.js";
|
|
79
79
|
export type { TinybirdApiConfig, TinybirdApiQueryOptions, TinybirdApiIngestOptions, TinybirdApiRequestInit, } from "./api/api.js";
|
|
80
80
|
export { isPreviewEnvironment, getPreviewBranchName, resolveToken, clearTokenCache, } from "./client/preview.js";
|
|
81
|
+
export { parseApiUrl, getDashboardUrl, getBranchDashboardUrl, getLocalDashboardUrl, } from "./api/dashboard.js";
|
|
82
|
+
export type { RegionInfo } from "./api/dashboard.js";
|
|
81
83
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AACtC,YAAY,EACV,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,SAAS,EACT,YAAY,GACb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,eAAe,EACf,eAAe,EACf,YAAY,GACb,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,CAAC,EAAE,MAAM,oBAAoB,CAAC;AACvC,YAAY,EACV,cAAc,EACd,iBAAiB,EACjB,cA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Ac,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,YAAY,EACV,YAAY,EACZ,aAAa,EACb,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,UAAU,EACV,eAAe,EACf,qBAAqB,EACrB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,wBAAwB,GACzB,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,iBAAiB,EACjB,uBAAuB,EACvB,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,YAAY,EACZ,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,WAAW,EACX,eAAe,EACf,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -78,4 +78,6 @@ export { TinybirdError } from "./client/types.js";
|
|
|
78
78
|
export { TinybirdApi, TinybirdApiError, createTinybirdApi, createTinybirdApiWrapper, } from "./api/api.js";
|
|
79
79
|
// ============ Preview Environment ============
|
|
80
80
|
export { isPreviewEnvironment, getPreviewBranchName, resolveToken, clearTokenCache, } from "./client/preview.js";
|
|
81
|
+
// ============ Dashboard URL Utilities ============
|
|
82
|
+
export { parseApiUrl, getDashboardUrl, getBranchDashboardUrl, getLocalDashboardUrl, } from "./api/dashboard.js";
|
|
81
83
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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kB,EAAE,YAAY,EAAE,aAAa,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AA8BzJ,mCAAmC;AACnC,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAelD,gDAAgD;AAChD,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,wBAAwB,GACzB,MAAM,cAAc,CAAC;AAQtB,gDAAgD;AAChD,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,YAAY,EACZ,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAE7B,oDAAoD;AACpD,OAAO,EACL,WAAW,EACX,eAAe,EACf,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,oBAAoB,CAAC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import {
|
|
3
|
+
parseApiUrl,
|
|
4
|
+
getDashboardUrl,
|
|
5
|
+
getBranchDashboardUrl,
|
|
6
|
+
getLocalDashboardUrl,
|
|
7
|
+
} from "./dashboard.js";
|
|
8
|
+
|
|
9
|
+
describe("parseApiUrl", () => {
|
|
10
|
+
it("parses EU GCP region", () => {
|
|
11
|
+
const result = parseApiUrl("https://api.tinybird.co");
|
|
12
|
+
expect(result).toEqual({ provider: "gcp", region: "europe-west3" });
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it("parses US East GCP region", () => {
|
|
16
|
+
const result = parseApiUrl("https://api.us-east.tinybird.co");
|
|
17
|
+
expect(result).toEqual({ provider: "gcp", region: "us-east4" });
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it("parses EU Central AWS region", () => {
|
|
21
|
+
const result = parseApiUrl("https://api.eu-central-1.aws.tinybird.co");
|
|
22
|
+
expect(result).toEqual({ provider: "aws", region: "eu-central-1" });
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("parses US East AWS region", () => {
|
|
26
|
+
const result = parseApiUrl("https://api.us-east-1.aws.tinybird.co");
|
|
27
|
+
expect(result).toEqual({ provider: "aws", region: "us-east-1" });
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it("parses US West AWS region", () => {
|
|
31
|
+
const result = parseApiUrl("https://api.us-west-2.aws.tinybird.co");
|
|
32
|
+
expect(result).toEqual({ provider: "aws", region: "us-west-2" });
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it("returns null for unknown regions", () => {
|
|
36
|
+
const result = parseApiUrl("https://api.unknown.tinybird.co");
|
|
37
|
+
expect(result).toBeNull();
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it("returns null for invalid URLs", () => {
|
|
41
|
+
const result = parseApiUrl("not-a-url");
|
|
42
|
+
expect(result).toBeNull();
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it("returns null for localhost", () => {
|
|
46
|
+
const result = parseApiUrl("http://localhost:7181");
|
|
47
|
+
expect(result).toBeNull();
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
describe("getDashboardUrl", () => {
|
|
52
|
+
it("generates EU GCP workspace URL", () => {
|
|
53
|
+
const result = getDashboardUrl("https://api.tinybird.co", "my_workspace");
|
|
54
|
+
expect(result).toBe("https://cloud.tinybird.co/gcp/europe-west3/my_workspace");
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it("generates US East GCP workspace URL", () => {
|
|
58
|
+
const result = getDashboardUrl("https://api.us-east.tinybird.co", "my_workspace");
|
|
59
|
+
expect(result).toBe("https://cloud.tinybird.co/gcp/us-east4/my_workspace");
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it("generates AWS workspace URL", () => {
|
|
63
|
+
const result = getDashboardUrl("https://api.us-west-2.aws.tinybird.co", "my_workspace");
|
|
64
|
+
expect(result).toBe("https://cloud.tinybird.co/aws/us-west-2/my_workspace");
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it("returns null for unknown regions", () => {
|
|
68
|
+
const result = getDashboardUrl("https://api.unknown.tinybird.co", "my_workspace");
|
|
69
|
+
expect(result).toBeNull();
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
describe("getBranchDashboardUrl", () => {
|
|
74
|
+
it("generates EU GCP branch URL", () => {
|
|
75
|
+
const result = getBranchDashboardUrl("https://api.tinybird.co", "my_workspace", "feature_branch");
|
|
76
|
+
expect(result).toBe("https://cloud.tinybird.co/gcp/europe-west3/my_workspace~feature_branch");
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it("generates US East GCP branch URL", () => {
|
|
80
|
+
const result = getBranchDashboardUrl("https://api.us-east.tinybird.co", "my_workspace", "feature_branch");
|
|
81
|
+
expect(result).toBe("https://cloud.tinybird.co/gcp/us-east4/my_workspace~feature_branch");
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it("generates AWS branch URL", () => {
|
|
85
|
+
const result = getBranchDashboardUrl("https://api.us-west-2.aws.tinybird.co", "my_workspace", "my_feature");
|
|
86
|
+
expect(result).toBe("https://cloud.tinybird.co/aws/us-west-2/my_workspace~my_feature");
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it("returns null for unknown regions", () => {
|
|
90
|
+
const result = getBranchDashboardUrl("https://api.unknown.tinybird.co", "my_workspace", "branch");
|
|
91
|
+
expect(result).toBeNull();
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it("handles branch names with underscores", () => {
|
|
95
|
+
const result = getBranchDashboardUrl("https://api.tinybird.co", "my_workspace", "feature_with_underscores");
|
|
96
|
+
expect(result).toBe("https://cloud.tinybird.co/gcp/europe-west3/my_workspace~feature_with_underscores");
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
describe("getLocalDashboardUrl", () => {
|
|
101
|
+
it("generates local dashboard URL with default port", () => {
|
|
102
|
+
const result = getLocalDashboardUrl("my_local_workspace");
|
|
103
|
+
expect(result).toBe("https://cloud.tinybird.co/local/7181/my_local_workspace");
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it("generates local dashboard URL with custom port", () => {
|
|
107
|
+
const result = getLocalDashboardUrl("my_local_workspace", 8080);
|
|
108
|
+
expect(result).toBe("https://cloud.tinybird.co/local/8080/my_local_workspace");
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it("handles workspace names with underscores", () => {
|
|
112
|
+
const result = getLocalDashboardUrl("dublin_feature_branch");
|
|
113
|
+
expect(result).toBe("https://cloud.tinybird.co/local/7181/dublin_feature_branch");
|
|
114
|
+
});
|
|
115
|
+
});
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tinybird Dashboard URL utilities
|
|
3
|
+
*
|
|
4
|
+
* Generates dashboard links for workspaces and branches
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Region information extracted from API URL
|
|
9
|
+
*/
|
|
10
|
+
export interface RegionInfo {
|
|
11
|
+
/** Cloud provider: "gcp" or "aws" */
|
|
12
|
+
provider: string;
|
|
13
|
+
/** Region identifier (e.g., "europe-west3", "us-east4", "us-west-2") */
|
|
14
|
+
region: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Mapping of API hostnames to region information
|
|
19
|
+
*
|
|
20
|
+
* Based on https://www.tinybird.co/docs/api-reference#current-tinybird-regions
|
|
21
|
+
*/
|
|
22
|
+
const API_REGION_MAP: Record<string, RegionInfo> = {
|
|
23
|
+
// GCP Regions
|
|
24
|
+
"api.tinybird.co": { provider: "gcp", region: "europe-west3" },
|
|
25
|
+
"api.us-east.tinybird.co": { provider: "gcp", region: "us-east4" },
|
|
26
|
+
// AWS Regions
|
|
27
|
+
"api.eu-central-1.aws.tinybird.co": { provider: "aws", region: "eu-central-1" },
|
|
28
|
+
"api.us-east-1.aws.tinybird.co": { provider: "aws", region: "us-east-1" },
|
|
29
|
+
"api.us-west-2.aws.tinybird.co": { provider: "aws", region: "us-west-2" },
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Parse an API URL to extract region information
|
|
34
|
+
*
|
|
35
|
+
* @param apiUrl - The Tinybird API base URL (e.g., "https://api.tinybird.co")
|
|
36
|
+
* @returns Region info or null if the URL doesn't match a known region
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* parseApiUrl("https://api.tinybird.co")
|
|
41
|
+
* // => { provider: "gcp", region: "europe-west3" }
|
|
42
|
+
*
|
|
43
|
+
* parseApiUrl("https://api.us-west-2.aws.tinybird.co")
|
|
44
|
+
* // => { provider: "aws", region: "us-west-2" }
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export function parseApiUrl(apiUrl: string): RegionInfo | null {
|
|
48
|
+
try {
|
|
49
|
+
const url = new URL(apiUrl);
|
|
50
|
+
const hostname = url.hostname;
|
|
51
|
+
return API_REGION_MAP[hostname] ?? null;
|
|
52
|
+
} catch {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Generate a Tinybird dashboard URL for a workspace
|
|
59
|
+
*
|
|
60
|
+
* @param apiUrl - The Tinybird API base URL
|
|
61
|
+
* @param workspaceName - The workspace name
|
|
62
|
+
* @returns Dashboard URL or null if the API URL is not recognized
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```ts
|
|
66
|
+
* getDashboardUrl("https://api.tinybird.co", "my_workspace")
|
|
67
|
+
* // => "https://cloud.tinybird.co/gcp/europe-west3/my_workspace"
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export function getDashboardUrl(apiUrl: string, workspaceName: string): string | null {
|
|
71
|
+
const regionInfo = parseApiUrl(apiUrl);
|
|
72
|
+
if (!regionInfo) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return `https://cloud.tinybird.co/${regionInfo.provider}/${regionInfo.region}/${workspaceName}`;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Generate a Tinybird dashboard URL for a branch
|
|
81
|
+
*
|
|
82
|
+
* @param apiUrl - The Tinybird API base URL
|
|
83
|
+
* @param workspaceName - The workspace name
|
|
84
|
+
* @param branchName - The branch name
|
|
85
|
+
* @returns Dashboard URL or null if the API URL is not recognized
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```ts
|
|
89
|
+
* getBranchDashboardUrl("https://api.tinybird.co", "my_workspace", "feature_branch")
|
|
90
|
+
* // => "https://cloud.tinybird.co/gcp/europe-west3/my_workspace~feature_branch"
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
export function getBranchDashboardUrl(
|
|
94
|
+
apiUrl: string,
|
|
95
|
+
workspaceName: string,
|
|
96
|
+
branchName: string
|
|
97
|
+
): string | null {
|
|
98
|
+
const regionInfo = parseApiUrl(apiUrl);
|
|
99
|
+
if (!regionInfo) {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return `https://cloud.tinybird.co/${regionInfo.provider}/${regionInfo.region}/${workspaceName}~${branchName}`;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Generate a local Tinybird dashboard URL
|
|
108
|
+
*
|
|
109
|
+
* @param workspaceName - The local workspace name
|
|
110
|
+
* @param port - The local Tinybird port (default: 7181)
|
|
111
|
+
* @returns Local dashboard URL
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```ts
|
|
115
|
+
* getLocalDashboardUrl("my_local_workspace")
|
|
116
|
+
* // => "https://cloud.tinybird.co/local/7181/my_local_workspace"
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
export function getLocalDashboardUrl(workspaceName: string, port = 7181): string {
|
|
120
|
+
return `https://cloud.tinybird.co/local/${port}/${workspaceName}`;
|
|
121
|
+
}
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
removeBranch as removeCachedBranch,
|
|
17
17
|
listCachedBranches,
|
|
18
18
|
} from "../branch-store.js";
|
|
19
|
+
import { getBranchDashboardUrl } from "../../api/dashboard.js";
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* Branch command options
|
|
@@ -53,6 +54,8 @@ export interface BranchStatusResult {
|
|
|
53
54
|
tinybirdBranch?: TinybirdBranch;
|
|
54
55
|
/** Whether a cached token exists */
|
|
55
56
|
hasCachedToken: boolean;
|
|
57
|
+
/** Dashboard URL for the branch */
|
|
58
|
+
dashboardUrl?: string;
|
|
56
59
|
/** Error message if failed */
|
|
57
60
|
error?: string;
|
|
58
61
|
}
|
|
@@ -135,14 +138,16 @@ export async function runBranchStatus(
|
|
|
135
138
|
const tinybirdBranchName = config.tinybirdBranch; // Sanitized name
|
|
136
139
|
const isMainBranch = config.isMainBranch;
|
|
137
140
|
|
|
138
|
-
// Fetch the workspace
|
|
141
|
+
// Fetch the workspace from the API
|
|
139
142
|
let workspaceId: string;
|
|
143
|
+
let workspaceName: string;
|
|
140
144
|
try {
|
|
141
145
|
const workspace = await getWorkspace({
|
|
142
146
|
baseUrl: config.baseUrl,
|
|
143
147
|
token: config.token,
|
|
144
148
|
});
|
|
145
149
|
workspaceId = workspace.id;
|
|
150
|
+
workspaceName = workspace.name;
|
|
146
151
|
} catch (error) {
|
|
147
152
|
return {
|
|
148
153
|
success: false,
|
|
@@ -154,6 +159,11 @@ export async function runBranchStatus(
|
|
|
154
159
|
};
|
|
155
160
|
}
|
|
156
161
|
|
|
162
|
+
// Generate dashboard URL for the branch
|
|
163
|
+
const dashboardUrl = tinybirdBranchName
|
|
164
|
+
? getBranchDashboardUrl(config.baseUrl, workspaceName, tinybirdBranchName) ?? undefined
|
|
165
|
+
: undefined;
|
|
166
|
+
|
|
157
167
|
// Check for cached token (use sanitized name)
|
|
158
168
|
const cachedBranch = tinybirdBranchName ? getBranchToken(workspaceId, tinybirdBranchName) : null;
|
|
159
169
|
const hasCachedToken = cachedBranch !== null;
|
|
@@ -166,6 +176,7 @@ export async function runBranchStatus(
|
|
|
166
176
|
tinybirdBranchName,
|
|
167
177
|
isMainBranch,
|
|
168
178
|
hasCachedToken,
|
|
179
|
+
dashboardUrl,
|
|
169
180
|
};
|
|
170
181
|
}
|
|
171
182
|
|
|
@@ -186,6 +197,7 @@ export async function runBranchStatus(
|
|
|
186
197
|
isMainBranch,
|
|
187
198
|
tinybirdBranch,
|
|
188
199
|
hasCachedToken,
|
|
200
|
+
dashboardUrl,
|
|
189
201
|
};
|
|
190
202
|
} catch (error) {
|
|
191
203
|
// If 404, branch doesn't exist yet
|
|
@@ -196,6 +208,7 @@ export async function runBranchStatus(
|
|
|
196
208
|
tinybirdBranchName,
|
|
197
209
|
isMainBranch,
|
|
198
210
|
hasCachedToken,
|
|
211
|
+
dashboardUrl,
|
|
199
212
|
};
|
|
200
213
|
}
|
|
201
214
|
|
|
@@ -205,6 +218,7 @@ export async function runBranchStatus(
|
|
|
205
218
|
tinybirdBranchName,
|
|
206
219
|
isMainBranch,
|
|
207
220
|
hasCachedToken,
|
|
221
|
+
dashboardUrl,
|
|
208
222
|
error: (error as Error).message,
|
|
209
223
|
};
|
|
210
224
|
}
|
|
@@ -12,6 +12,8 @@ import {
|
|
|
12
12
|
getLocalWorkspaceName,
|
|
13
13
|
LocalNotRunningError,
|
|
14
14
|
} from "../../api/local.js";
|
|
15
|
+
import { getWorkspace } from "../../api/workspaces.js";
|
|
16
|
+
import { getBranchDashboardUrl, getLocalDashboardUrl } from "../../api/dashboard.js";
|
|
15
17
|
|
|
16
18
|
/**
|
|
17
19
|
* Build command options
|
|
@@ -27,6 +29,22 @@ export interface BuildCommandOptions {
|
|
|
27
29
|
devModeOverride?: DevMode;
|
|
28
30
|
}
|
|
29
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Branch info included in build result
|
|
34
|
+
*/
|
|
35
|
+
export interface BuildBranchInfo {
|
|
36
|
+
/** Git branch name */
|
|
37
|
+
gitBranch: string | null;
|
|
38
|
+
/** Tinybird branch name */
|
|
39
|
+
tinybirdBranch: string | null;
|
|
40
|
+
/** Whether the branch was newly created */
|
|
41
|
+
wasCreated: boolean;
|
|
42
|
+
/** Dashboard URL for the branch */
|
|
43
|
+
dashboardUrl?: string;
|
|
44
|
+
/** Whether using local mode */
|
|
45
|
+
isLocal: boolean;
|
|
46
|
+
}
|
|
47
|
+
|
|
30
48
|
/**
|
|
31
49
|
* Build command result
|
|
32
50
|
*/
|
|
@@ -37,6 +55,8 @@ export interface BuildCommandResult {
|
|
|
37
55
|
build?: BuildFromIncludeResult;
|
|
38
56
|
/** Build API result (if not dry run) */
|
|
39
57
|
deploy?: BuildApiResult;
|
|
58
|
+
/** Branch info (when building to a branch) */
|
|
59
|
+
branchInfo?: BuildBranchInfo;
|
|
40
60
|
/** Error message if failed */
|
|
41
61
|
error?: string;
|
|
42
62
|
/** Duration in milliseconds */
|
|
@@ -101,6 +121,7 @@ export async function runBuild(options: BuildCommandOptions = {}): Promise<Build
|
|
|
101
121
|
}
|
|
102
122
|
|
|
103
123
|
let deployResult: BuildApiResult;
|
|
124
|
+
let branchInfo: BuildBranchInfo | undefined;
|
|
104
125
|
|
|
105
126
|
// Handle local mode
|
|
106
127
|
if (devMode === "local") {
|
|
@@ -123,6 +144,14 @@ export async function runBuild(options: BuildCommandOptions = {}): Promise<Build
|
|
|
123
144
|
console.log(`[debug] Workspace ${wasCreated ? "created" : "found"}: ${workspace.name}`);
|
|
124
145
|
}
|
|
125
146
|
|
|
147
|
+
branchInfo = {
|
|
148
|
+
gitBranch: config.gitBranch,
|
|
149
|
+
tinybirdBranch: workspaceName,
|
|
150
|
+
wasCreated,
|
|
151
|
+
dashboardUrl: getLocalDashboardUrl(workspaceName),
|
|
152
|
+
isLocal: true,
|
|
153
|
+
};
|
|
154
|
+
|
|
126
155
|
// Always use /v1/build for local (no deploy endpoint)
|
|
127
156
|
deployResult = await buildToTinybird(
|
|
128
157
|
{
|
|
@@ -197,6 +226,21 @@ export async function runBuild(options: BuildCommandOptions = {}): Promise<Build
|
|
|
197
226
|
if (debug) {
|
|
198
227
|
console.log(`[debug] Using branch token for branch: ${config.tinybirdBranch}`);
|
|
199
228
|
}
|
|
229
|
+
|
|
230
|
+
// Get workspace name for dashboard URL
|
|
231
|
+
const workspace = await getWorkspace({
|
|
232
|
+
baseUrl: config.baseUrl,
|
|
233
|
+
token: config.token,
|
|
234
|
+
});
|
|
235
|
+
const dashboardUrl = getBranchDashboardUrl(config.baseUrl, workspace.name, config.tinybirdBranch!) ?? undefined;
|
|
236
|
+
|
|
237
|
+
branchInfo = {
|
|
238
|
+
gitBranch: config.gitBranch,
|
|
239
|
+
tinybirdBranch: config.tinybirdBranch,
|
|
240
|
+
wasCreated: tinybirdBranch.wasCreated ?? false,
|
|
241
|
+
dashboardUrl,
|
|
242
|
+
isLocal: false,
|
|
243
|
+
};
|
|
200
244
|
} catch (error) {
|
|
201
245
|
return {
|
|
202
246
|
success: false,
|
|
@@ -231,6 +275,7 @@ export async function runBuild(options: BuildCommandOptions = {}): Promise<Build
|
|
|
231
275
|
success: false,
|
|
232
276
|
build: buildResult,
|
|
233
277
|
deploy: deployResult,
|
|
278
|
+
branchInfo,
|
|
234
279
|
error: deployResult.error,
|
|
235
280
|
durationMs: Date.now() - startTime,
|
|
236
281
|
};
|
|
@@ -240,6 +285,7 @@ export async function runBuild(options: BuildCommandOptions = {}): Promise<Build
|
|
|
240
285
|
success: true,
|
|
241
286
|
build: buildResult,
|
|
242
287
|
deploy: deployResult,
|
|
288
|
+
branchInfo,
|
|
243
289
|
durationMs: Date.now() - startTime,
|
|
244
290
|
};
|
|
245
291
|
}
|