@distilled.cloud/tinybird 0.0.0 → 1.0.0-rc.21
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/LICENSE +201 -0
- package/README.md +128 -4
- package/lib/.lazy.json +1 -0
- package/lib/_bundle/sdk.js +2 -0
- package/lib/_bundle/sdk.js.map +1 -0
- package/lib/credentials.d.ts +29 -0
- package/lib/credentials.d.ts.map +1 -0
- package/lib/credentials.js +1 -0
- package/lib/errors.d.ts +52 -0
- package/lib/errors.d.ts.map +1 -0
- package/lib/errors.js +1 -0
- package/lib/index.d.ts +48 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +5 -0
- package/lib/protocol.d.ts +19 -0
- package/lib/protocol.d.ts.map +1 -0
- package/lib/protocol.js +1 -0
- package/lib/retry.d.ts +50 -0
- package/lib/retry.d.ts.map +1 -0
- package/lib/retry.js +1 -0
- package/lib/services/analyze.d.ts +17 -0
- package/lib/services/analyze.d.ts.map +1 -0
- package/lib/services/analyze.js +2 -0
- package/lib/services/analyze.js.map +1 -0
- package/lib/services/api_endpoints.d.ts +26 -0
- package/lib/services/api_endpoints.d.ts.map +1 -0
- package/lib/services/api_endpoints.js +2 -0
- package/lib/services/api_endpoints.js.map +1 -0
- package/lib/services/copy_pipes.d.ts +102 -0
- package/lib/services/copy_pipes.d.ts.map +1 -0
- package/lib/services/copy_pipes.js +2 -0
- package/lib/services/copy_pipes.js.map +1 -0
- package/lib/services/datasource.d.ts +171 -0
- package/lib/services/datasource.d.ts.map +1 -0
- package/lib/services/datasource.js +2 -0
- package/lib/services/datasource.js.map +1 -0
- package/lib/services/environment_variables.d.ts +61 -0
- package/lib/services/environment_variables.d.ts.map +1 -0
- package/lib/services/environment_variables.js +2 -0
- package/lib/services/environment_variables.js.map +1 -0
- package/lib/services/events.d.ts +21 -0
- package/lib/services/events.d.ts.map +1 -0
- package/lib/services/events.js +2 -0
- package/lib/services/events.js.map +1 -0
- package/lib/services/index.d.ts +14 -0
- package/lib/services/index.d.ts.map +1 -0
- package/lib/services/index.js +13 -0
- package/lib/services/jobs.d.ts +45 -0
- package/lib/services/jobs.d.ts.map +1 -0
- package/lib/services/jobs.js +2 -0
- package/lib/services/jobs.js.map +1 -0
- package/lib/services/materialized_views.d.ts +64 -0
- package/lib/services/materialized_views.d.ts.map +1 -0
- package/lib/services/materialized_views.js +2 -0
- package/lib/services/materialized_views.js.map +1 -0
- package/lib/services/organizations.d.ts +214 -0
- package/lib/services/organizations.d.ts.map +1 -0
- package/lib/services/organizations.js +2 -0
- package/lib/services/organizations.js.map +1 -0
- package/lib/services/pipe.d.ts +243 -0
- package/lib/services/pipe.d.ts.map +1 -0
- package/lib/services/pipe.js +2 -0
- package/lib/services/pipe.js.map +1 -0
- package/lib/services/query.d.ts +50 -0
- package/lib/services/query.d.ts.map +1 -0
- package/lib/services/query.js +2 -0
- package/lib/services/query.js.map +1 -0
- package/lib/services/sink_pipes.d.ts +95 -0
- package/lib/services/sink_pipes.d.ts.map +1 -0
- package/lib/services/sink_pipes.js +2 -0
- package/lib/services/sink_pipes.js.map +1 -0
- package/lib/services/token.d.ts +107 -0
- package/lib/services/token.d.ts.map +1 -0
- package/lib/services/token.js +2 -0
- package/lib/services/token.js.map +1 -0
- package/lib/services.lazy/analyze.js +1 -0
- package/lib/services.lazy/api_endpoints.js +1 -0
- package/lib/services.lazy/copy_pipes.js +1 -0
- package/lib/services.lazy/datasource.js +1 -0
- package/lib/services.lazy/environment_variables.js +1 -0
- package/lib/services.lazy/events.js +1 -0
- package/lib/services.lazy/index.js +3 -0
- package/lib/services.lazy/jobs.js +1 -0
- package/lib/services.lazy/materialized_views.js +1 -0
- package/lib/services.lazy/organizations.js +1 -0
- package/lib/services.lazy/pipe.js +1 -0
- package/lib/services.lazy/query.js +1 -0
- package/lib/services.lazy/sink_pipes.js +1 -0
- package/lib/services.lazy/token.js +1 -0
- package/lib/traits.d.ts +10 -0
- package/lib/traits.d.ts.map +1 -0
- package/lib/traits.js +1 -0
- package/package.json +76 -2
- package/src/credentials.ts +76 -0
- package/src/errors.ts +83 -0
- package/src/index.ts +47 -0
- package/src/protocol.ts +48 -0
- package/src/retry.ts +69 -0
- package/src/services/analyze.ts +75 -0
- package/src/services/api_endpoints.ts +115 -0
- package/src/services/copy_pipes.ts +315 -0
- package/src/services/datasource.ts +438 -0
- package/src/services/environment_variables.ts +213 -0
- package/src/services/events.ts +86 -0
- package/src/services/index.ts +14 -0
- package/src/services/jobs.ts +156 -0
- package/src/services/materialized_views.ts +200 -0
- package/src/services/organizations.ts +552 -0
- package/src/services/pipe.ts +700 -0
- package/src/services/query.ts +150 -0
- package/src/services/sink_pipes.ts +295 -0
- package/src/services/token.ts +359 -0
- package/src/traits.ts +47 -0
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
import * as API from "@distilled.cloud/core/api";
|
|
2
|
+
// AUTO-GENERATED by scripts/generate.ts from .generated-specs (specs/spec-mirror-tinybird/specs/api-reference). Do not edit.
|
|
3
|
+
import * as S from "@distilled.cloud/core/schema-lite";
|
|
4
|
+
import * as __L from "@distilled.cloud/core/schema-lite";
|
|
5
|
+
import type * as Redacted from "effect/Redacted";
|
|
6
|
+
import { TinybirdServiceErrors } from "../errors.ts";
|
|
7
|
+
import { TinybirdProtocol, type TinybirdOpError, type TinybirdOpContext } from "../protocol.ts";
|
|
8
|
+
import * as Retry from "../retry.ts";
|
|
9
|
+
import * as T from "../traits.ts";
|
|
10
|
+
// Schema table, filled on first reach (see __S at the end).
|
|
11
|
+
const __s: any[] = [];
|
|
12
|
+
|
|
13
|
+
export type { TinybirdOpError, TinybirdOpContext };
|
|
14
|
+
|
|
15
|
+
/** Span facts shared by every operation (com.distilled.telemetry#service). */
|
|
16
|
+
const TELEMETRY = {
|
|
17
|
+
system: "tinybird-api",
|
|
18
|
+
responseHeaders: [
|
|
19
|
+
{ header: "x-request-id", name: "http.response.header.x-request-id", transform: "list" },
|
|
20
|
+
{ header: "request-id", name: "http.response.header.request-id", transform: "list" },
|
|
21
|
+
],
|
|
22
|
+
prefix: "Tinybird",
|
|
23
|
+
service: "token",
|
|
24
|
+
propagate: "w3c",
|
|
25
|
+
} as const;
|
|
26
|
+
|
|
27
|
+
export type ScopeList = Array<string>;
|
|
28
|
+
export type JwtFixedParams = { [key: string]: unknown | undefined };
|
|
29
|
+
export interface JwtScope {
|
|
30
|
+
/** Scope type, e.g. `PIPES:READ` or `DATASOURCES:READ`. */
|
|
31
|
+
type: string;
|
|
32
|
+
/** The Pipe or Data Source the scope grants. */
|
|
33
|
+
resource: string;
|
|
34
|
+
/** Template parameters pinned into the token: every query made with it uses these values, whatever the caller sends. */
|
|
35
|
+
fixed_params?: JwtFixedParams | undefined;
|
|
36
|
+
}
|
|
37
|
+
export type JwtScopeList = Array<JwtScope>;
|
|
38
|
+
export interface CreateTokenRequest {
|
|
39
|
+
/** Name of the token */
|
|
40
|
+
name?: string | undefined;
|
|
41
|
+
/** Optional. Markdown text with a description of the token. */
|
|
42
|
+
description?: string | undefined;
|
|
43
|
+
/** Scope(s) to set. Format is [SCOPE:TYPE[:arg][:filter]](#id2). This is only used for the Static Tokens */
|
|
44
|
+
scope?: ScopeList | undefined;
|
|
45
|
+
/** Optional. Expiry as a Unix timestamp in seconds. When set, the token is created as a JWT with the `scopes` of the body. */
|
|
46
|
+
expiration_time?: number | undefined;
|
|
47
|
+
/** JWT scopes, sent as the JSON body. Only used with `expiration_time`; static tokens take `scope`. */
|
|
48
|
+
scopes?: JwtScopeList | undefined;
|
|
49
|
+
}
|
|
50
|
+
export interface TokenScope {
|
|
51
|
+
/** Scope type, e.g. `ADMIN`, `PIPES:READ`, `DATASOURCES:APPEND`. */
|
|
52
|
+
type?: string | undefined;
|
|
53
|
+
/** The resource the scope applies to, when it is resource-scoped. */
|
|
54
|
+
resource?: string | undefined;
|
|
55
|
+
/** SQL filter of a resource-scoped read scope. */
|
|
56
|
+
filter?: string | undefined;
|
|
57
|
+
/** Template parameters pinned into a JWT scope. */
|
|
58
|
+
fixed_params?: JwtFixedParams | undefined;
|
|
59
|
+
}
|
|
60
|
+
export type TokenScopeList = Array<TokenScope>;
|
|
61
|
+
export interface Token {
|
|
62
|
+
id?: string | undefined;
|
|
63
|
+
/** The token value. */
|
|
64
|
+
token?: string | Redacted.Redacted<string> | undefined;
|
|
65
|
+
scopes?: TokenScopeList | undefined;
|
|
66
|
+
name?: string | undefined;
|
|
67
|
+
description?: string | undefined;
|
|
68
|
+
origin?: unknown | undefined;
|
|
69
|
+
host?: string | undefined;
|
|
70
|
+
is_internal?: boolean | undefined;
|
|
71
|
+
/** JWT expiry as a Unix timestamp in seconds. Only on JWTs. */
|
|
72
|
+
exp?: number | undefined;
|
|
73
|
+
}
|
|
74
|
+
export type CreateTokenResponse = Token;
|
|
75
|
+
export interface DeleteTokenRequest {
|
|
76
|
+
token: string | Redacted.Redacted<string>;
|
|
77
|
+
}
|
|
78
|
+
export type DeleteTokenResponseBodyMap = { [key: string]: unknown | undefined };
|
|
79
|
+
export type DeleteTokenResponse = DeleteTokenResponseBodyMap;
|
|
80
|
+
export interface GetTokenRequest {
|
|
81
|
+
token: string | Redacted.Redacted<string>;
|
|
82
|
+
}
|
|
83
|
+
export type GetTokenResponse = Token;
|
|
84
|
+
export interface ListTokensRequest {}
|
|
85
|
+
export type TokenList = Array<Token>;
|
|
86
|
+
export interface Tokens {
|
|
87
|
+
tokens?: TokenList | undefined;
|
|
88
|
+
}
|
|
89
|
+
export type ListTokensResponse = Tokens;
|
|
90
|
+
export interface RefreshTokenRequest {
|
|
91
|
+
token: string | Redacted.Redacted<string>;
|
|
92
|
+
/** Token. Ensure it has the `TOKENS` scope on it */
|
|
93
|
+
auth_token?: string | Redacted.Redacted<string> | undefined;
|
|
94
|
+
}
|
|
95
|
+
export type RefreshTokenResponse = Token;
|
|
96
|
+
export interface UpdateTokenRequest {
|
|
97
|
+
token: string | Redacted.Redacted<string>;
|
|
98
|
+
/** Optional. Name of the token. */
|
|
99
|
+
name?: string | undefined;
|
|
100
|
+
/** Optional. Markdown text with a description of the token. */
|
|
101
|
+
description?: string | undefined;
|
|
102
|
+
/** Optional. Scope(s) to set. Format is [SCOPE:TYPE[:arg][:filter]](#id2). New scope(s) will override existing ones. */
|
|
103
|
+
scope?: ScopeList | undefined;
|
|
104
|
+
}
|
|
105
|
+
export type UpdateTokenResponse = Token;
|
|
106
|
+
export type CreateTokenError = TinybirdOpError;
|
|
107
|
+
/** Creates a new Token: Static or JWT When creating a token with `filter` whenever you use the token to read the table, it will be filtered. For example, if table is `events_table` and `filter` is `date > '2018-01-01' and type == 'foo'` a query like `select count(1) from events_table` will become `select count(1) from events_table where date > '2018-01-01' and type == 'foo'` If we provide an `expiration_time` in the URL, the token will be created as a JWT Token. In multi-tenant applications, you can use this endpoint to create a JWT token for a specific tenant where each user has their own token with a fixed set of scopes and parameters Reference: https://www.tinybird.co/docs/api-reference/token-api */
|
|
108
|
+
export const createToken: API.OperationMethod<
|
|
109
|
+
CreateTokenRequest,
|
|
110
|
+
CreateTokenResponse,
|
|
111
|
+
CreateTokenError,
|
|
112
|
+
TinybirdOpContext
|
|
113
|
+
> = /*@__PURE__*/ API.make(() => ({
|
|
114
|
+
input: __S(2, __c0, 2) as any as S.Schema<CreateTokenRequest>,
|
|
115
|
+
output: __S(12, __c3, 0) as any as S.Schema<CreateTokenResponse>,
|
|
116
|
+
errors: [],
|
|
117
|
+
serviceErrors: TinybirdServiceErrors,
|
|
118
|
+
protocol: TinybirdProtocol,
|
|
119
|
+
retry: Retry.Retry,
|
|
120
|
+
telemetry: TELEMETRY,
|
|
121
|
+
span: "CreateToken",
|
|
122
|
+
}));
|
|
123
|
+
|
|
124
|
+
export type DeleteTokenError = TinybirdOpError;
|
|
125
|
+
/** Deletes a Static Token . Reference: https://www.tinybird.co/docs/api-reference/token-api */
|
|
126
|
+
export const deleteToken: API.OperationMethod<
|
|
127
|
+
DeleteTokenRequest,
|
|
128
|
+
DeleteTokenResponse,
|
|
129
|
+
DeleteTokenError,
|
|
130
|
+
TinybirdOpContext
|
|
131
|
+
> = /*@__PURE__*/ API.make(() => ({
|
|
132
|
+
input: __S(20, __c5, 0) as any as S.Schema<DeleteTokenRequest>,
|
|
133
|
+
output: __S(21, __c5, 1) as any as S.Schema<DeleteTokenResponse>,
|
|
134
|
+
errors: [],
|
|
135
|
+
serviceErrors: TinybirdServiceErrors,
|
|
136
|
+
protocol: TinybirdProtocol,
|
|
137
|
+
retry: Retry.Retry,
|
|
138
|
+
telemetry: TELEMETRY,
|
|
139
|
+
span: "DeleteToken",
|
|
140
|
+
}));
|
|
141
|
+
|
|
142
|
+
export type GetTokenError = TinybirdOpError;
|
|
143
|
+
/** Fetches information about a particular Static Token. Returns a json with name and scopes. Reference: https://www.tinybird.co/docs/api-reference/token-api */
|
|
144
|
+
export const getToken: API.OperationMethod<
|
|
145
|
+
GetTokenRequest,
|
|
146
|
+
GetTokenResponse,
|
|
147
|
+
GetTokenError,
|
|
148
|
+
TinybirdOpContext
|
|
149
|
+
> = /*@__PURE__*/ API.make(() => ({
|
|
150
|
+
input: __S(24, __c6, 0) as any as S.Schema<GetTokenRequest>,
|
|
151
|
+
output: __S(12, __c3, 0) as any as S.Schema<GetTokenResponse>,
|
|
152
|
+
errors: [],
|
|
153
|
+
serviceErrors: TinybirdServiceErrors,
|
|
154
|
+
protocol: TinybirdProtocol,
|
|
155
|
+
retry: Retry.Retry,
|
|
156
|
+
telemetry: TELEMETRY,
|
|
157
|
+
span: "GetToken",
|
|
158
|
+
}));
|
|
159
|
+
|
|
160
|
+
export type ListTokensError = TinybirdOpError;
|
|
161
|
+
/** Retrieves all workspace Static Tokens. A list of your Static Tokens and their scopes will be sent in the response. Reference: https://www.tinybird.co/docs/api-reference/token-api */
|
|
162
|
+
export const listTokens: API.OperationMethod<
|
|
163
|
+
ListTokensRequest,
|
|
164
|
+
ListTokensResponse,
|
|
165
|
+
ListTokensError,
|
|
166
|
+
TinybirdOpContext
|
|
167
|
+
> = /*@__PURE__*/ API.make(() => ({
|
|
168
|
+
input: __S(28, __c7, 0) as any as S.Schema<ListTokensRequest>,
|
|
169
|
+
output: __S(31, __c7, 3) as any as S.Schema<ListTokensResponse>,
|
|
170
|
+
errors: [],
|
|
171
|
+
serviceErrors: TinybirdServiceErrors,
|
|
172
|
+
protocol: TinybirdProtocol,
|
|
173
|
+
retry: Retry.Retry,
|
|
174
|
+
telemetry: TELEMETRY,
|
|
175
|
+
span: "ListTokens",
|
|
176
|
+
}));
|
|
177
|
+
|
|
178
|
+
export type RefreshTokenError = TinybirdOpError;
|
|
179
|
+
/** Refresh the Static Token without modifying name, scopes or any other attribute. Specially useful when a Token is leaked, or when you need to rotate a Token. A member token can always refresh itself, even with the Viewer role. When successfully refreshing a token, new information will be sent in the response Reference: https://www.tinybird.co/docs/api-reference/token-api */
|
|
180
|
+
export const refreshToken: API.OperationMethod<
|
|
181
|
+
RefreshTokenRequest,
|
|
182
|
+
RefreshTokenResponse,
|
|
183
|
+
RefreshTokenError,
|
|
184
|
+
TinybirdOpContext
|
|
185
|
+
> = /*@__PURE__*/ API.make(() => ({
|
|
186
|
+
input: __S(32, __c8, 0) as any as S.Schema<RefreshTokenRequest>,
|
|
187
|
+
output: __S(12, __c3, 0) as any as S.Schema<RefreshTokenResponse>,
|
|
188
|
+
errors: [],
|
|
189
|
+
serviceErrors: TinybirdServiceErrors,
|
|
190
|
+
protocol: TinybirdProtocol,
|
|
191
|
+
retry: Retry.Retry,
|
|
192
|
+
telemetry: TELEMETRY,
|
|
193
|
+
span: "RefreshToken",
|
|
194
|
+
}));
|
|
195
|
+
|
|
196
|
+
export type UpdateTokenError = TinybirdOpError;
|
|
197
|
+
/** Modifies a Static Token. More than one scope can be sent per request, all of them will be added as Token scopes. Every time a Token scope is modified, it overrides the existing one(s). Reference: https://www.tinybird.co/docs/api-reference/token-api */
|
|
198
|
+
export const updateToken: API.OperationMethod<
|
|
199
|
+
UpdateTokenRequest,
|
|
200
|
+
UpdateTokenResponse,
|
|
201
|
+
UpdateTokenError,
|
|
202
|
+
TinybirdOpContext
|
|
203
|
+
> = /*@__PURE__*/ API.make(() => ({
|
|
204
|
+
input: __S(36, __c9, 0) as any as S.Schema<UpdateTokenRequest>,
|
|
205
|
+
output: __S(12, __c3, 0) as any as S.Schema<UpdateTokenResponse>,
|
|
206
|
+
errors: [],
|
|
207
|
+
serviceErrors: TinybirdServiceErrors,
|
|
208
|
+
protocol: TinybirdProtocol,
|
|
209
|
+
retry: Retry.Retry,
|
|
210
|
+
telemetry: TELEMETRY,
|
|
211
|
+
span: "UpdateToken",
|
|
212
|
+
}));
|
|
213
|
+
|
|
214
|
+
// Schema builders: each runs one schema initializer, on that schema's first use.
|
|
215
|
+
function __c0(j: number): any {
|
|
216
|
+
switch (j) {
|
|
217
|
+
case 0:
|
|
218
|
+
return S.suspend(() =>
|
|
219
|
+
S.Struct({
|
|
220
|
+
type: S.String,
|
|
221
|
+
resource: S.String,
|
|
222
|
+
fixed_params: S.optional(__S(4, __c1, 0)),
|
|
223
|
+
}),
|
|
224
|
+
).annotate({ identifier: "JwtScope" });
|
|
225
|
+
case 1:
|
|
226
|
+
return S.Array(__S(0, __c0, 0));
|
|
227
|
+
case 2:
|
|
228
|
+
return S.suspend(() =>
|
|
229
|
+
S.Struct({
|
|
230
|
+
name: S.optional(S.String.pipe(T.Query())),
|
|
231
|
+
description: S.optional(S.String.pipe(T.Query())),
|
|
232
|
+
scope: S.optional(__S(16, __c4, 0).pipe(T.Query())),
|
|
233
|
+
expiration_time: S.optional(S.Number.pipe(T.Query())),
|
|
234
|
+
scopes: S.optional(__S(1, __c0, 1)),
|
|
235
|
+
}).pipe(T.Http({ method: "POST", uri: "/v0/tokens", code: 200 })),
|
|
236
|
+
).annotate({ identifier: "CreateTokenRequest" });
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
function __c1(j: number): any {
|
|
240
|
+
switch (j) {
|
|
241
|
+
case 0:
|
|
242
|
+
return S.Record(S.String, S.Unknown);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
function __c2(j: number): any {
|
|
246
|
+
switch (j) {
|
|
247
|
+
case 0:
|
|
248
|
+
return S.suspend(() =>
|
|
249
|
+
S.Struct({
|
|
250
|
+
type: S.optional(S.String),
|
|
251
|
+
resource: S.optional(S.String),
|
|
252
|
+
filter: S.optional(S.String),
|
|
253
|
+
fixed_params: S.optional(__S(4, __c1, 0)),
|
|
254
|
+
}),
|
|
255
|
+
).annotate({ identifier: "TokenScope" });
|
|
256
|
+
case 1:
|
|
257
|
+
return S.Array(__S(8, __c2, 0));
|
|
258
|
+
case 2:
|
|
259
|
+
return S.suspend(() =>
|
|
260
|
+
S.Struct({
|
|
261
|
+
id: S.optional(S.String),
|
|
262
|
+
token: S.optional(S.String.pipe(T.SensitiveValue({}))),
|
|
263
|
+
scopes: S.optional(__S(9, __c2, 1)),
|
|
264
|
+
name: S.optional(S.String),
|
|
265
|
+
description: S.optional(S.String),
|
|
266
|
+
origin: S.optional(S.Unknown),
|
|
267
|
+
host: S.optional(S.String),
|
|
268
|
+
is_internal: S.optional(S.Boolean),
|
|
269
|
+
exp: S.optional(S.Number),
|
|
270
|
+
}),
|
|
271
|
+
).annotate({ identifier: "Token" });
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
function __c3(j: number): any {
|
|
275
|
+
switch (j) {
|
|
276
|
+
case 0:
|
|
277
|
+
return S.suspend(() => __S(10, __c2, 2).pipe(T.RawResponseRoot())).annotate({
|
|
278
|
+
identifier: "CreateTokenResponse",
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
function __c4(j: number): any {
|
|
283
|
+
switch (j) {
|
|
284
|
+
case 0:
|
|
285
|
+
return S.Array(S.String);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
function __c5(j: number): any {
|
|
289
|
+
switch (j) {
|
|
290
|
+
case 0:
|
|
291
|
+
return S.suspend(() =>
|
|
292
|
+
S.Struct({
|
|
293
|
+
token: S.String.pipe(T.Label(), T.SensitiveValue({})),
|
|
294
|
+
}).pipe(T.Http({ method: "DELETE", uri: "/v0/tokens/{token}", code: 200 })),
|
|
295
|
+
).annotate({ identifier: "DeleteTokenRequest" });
|
|
296
|
+
case 1:
|
|
297
|
+
return S.suspend(() => __S(4, __c1, 0).pipe(T.RawResponseRoot())).annotate({
|
|
298
|
+
identifier: "DeleteTokenResponse",
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
function __c6(j: number): any {
|
|
303
|
+
switch (j) {
|
|
304
|
+
case 0:
|
|
305
|
+
return S.suspend(() =>
|
|
306
|
+
S.Struct({
|
|
307
|
+
token: S.String.pipe(T.Label(), T.SensitiveValue({})),
|
|
308
|
+
}).pipe(T.Http({ method: "GET", uri: "/v0/tokens/{token}", code: 200 })),
|
|
309
|
+
).annotate({ identifier: "GetTokenRequest" });
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
function __c7(j: number): any {
|
|
313
|
+
switch (j) {
|
|
314
|
+
case 0:
|
|
315
|
+
return S.suspend(() =>
|
|
316
|
+
S.Struct({}).pipe(T.Http({ method: "GET", uri: "/v0/tokens", code: 200 })),
|
|
317
|
+
).annotate({ identifier: "ListTokensRequest" });
|
|
318
|
+
case 1:
|
|
319
|
+
return S.Array(__S(10, __c2, 2));
|
|
320
|
+
case 2:
|
|
321
|
+
return S.suspend(() =>
|
|
322
|
+
S.Struct({
|
|
323
|
+
tokens: S.optional(__S(29, __c7, 1)),
|
|
324
|
+
}),
|
|
325
|
+
).annotate({ identifier: "Tokens" });
|
|
326
|
+
case 3:
|
|
327
|
+
return S.suspend(() => __S(30, __c7, 2).pipe(T.RawResponseRoot())).annotate({
|
|
328
|
+
identifier: "ListTokensResponse",
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
function __c8(j: number): any {
|
|
333
|
+
switch (j) {
|
|
334
|
+
case 0:
|
|
335
|
+
return S.suspend(() =>
|
|
336
|
+
S.Struct({
|
|
337
|
+
token: S.String.pipe(T.Label(), T.SensitiveValue({})),
|
|
338
|
+
auth_token: S.optional(S.String.pipe(T.Query(), T.SensitiveValue({}))),
|
|
339
|
+
}).pipe(T.Http({ method: "POST", uri: "/v0/tokens/{token}/refresh", code: 200 })),
|
|
340
|
+
).annotate({ identifier: "RefreshTokenRequest" });
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
function __c9(j: number): any {
|
|
344
|
+
switch (j) {
|
|
345
|
+
case 0:
|
|
346
|
+
return S.suspend(() =>
|
|
347
|
+
S.Struct({
|
|
348
|
+
token: S.String.pipe(T.Label(), T.SensitiveValue({})),
|
|
349
|
+
name: S.optional(S.String.pipe(T.Query())),
|
|
350
|
+
description: S.optional(S.String.pipe(T.Query())),
|
|
351
|
+
scope: S.optional(__S(16, __c4, 0).pipe(T.Query())),
|
|
352
|
+
}).pipe(T.Http({ method: "PUT", uri: "/v0/tokens/{token}", code: 200 })),
|
|
353
|
+
).annotate({ identifier: "UpdateTokenRequest" });
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
// Schema table: entry i is schema j of builder f, made on first reach.
|
|
357
|
+
function __S(i: number, f: (j: number) => unknown, j: number): any {
|
|
358
|
+
return (__s[i] ??= __L.at(f, j));
|
|
359
|
+
}
|
package/src/traits.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tinybird SDK trait surface -- hand-written.
|
|
3
|
+
*
|
|
4
|
+
* Re-exports the generic protocol traits from core so generated operations
|
|
5
|
+
* import everything from one place. Tinybird speaks plain bearer-REST JSON with no
|
|
6
|
+
* success envelope, so there are no provider-specific traits.
|
|
7
|
+
*/
|
|
8
|
+
export {
|
|
9
|
+
Body,
|
|
10
|
+
Header,
|
|
11
|
+
Query,
|
|
12
|
+
Label,
|
|
13
|
+
Http,
|
|
14
|
+
ResponseCode,
|
|
15
|
+
HttpBody,
|
|
16
|
+
FormDataFile,
|
|
17
|
+
KeyDictionary,
|
|
18
|
+
UnionCases,
|
|
19
|
+
applyErrorMatchers,
|
|
20
|
+
getErrorMatchers,
|
|
21
|
+
type HttpTrait,
|
|
22
|
+
type ErrorMatcher,
|
|
23
|
+
bodySymbol,
|
|
24
|
+
headerSymbol,
|
|
25
|
+
querySymbol,
|
|
26
|
+
labelSymbol,
|
|
27
|
+
httpSymbol,
|
|
28
|
+
responseCodeSymbol,
|
|
29
|
+
httpBodySymbol,
|
|
30
|
+
formDataFileSymbol,
|
|
31
|
+
keyDictionarySymbol,
|
|
32
|
+
unionCasesSymbol,
|
|
33
|
+
errorMatchersSymbol,
|
|
34
|
+
} from "@distilled.cloud/core/trait";
|
|
35
|
+
|
|
36
|
+
// Bearer-REST protocol traits (sensitive strings, bare-payload and binary
|
|
37
|
+
// responses).
|
|
38
|
+
export {
|
|
39
|
+
BinaryResponse,
|
|
40
|
+
SensitiveValue,
|
|
41
|
+
RawResponse,
|
|
42
|
+
RawResponseRoot,
|
|
43
|
+
binaryResponseSymbol,
|
|
44
|
+
sensitiveValueSymbol,
|
|
45
|
+
rawResponseSymbol,
|
|
46
|
+
rawResponseRootSymbol,
|
|
47
|
+
} from "@distilled.cloud/core/protocol-rest";
|