@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.
Files changed (113) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +128 -4
  3. package/lib/.lazy.json +1 -0
  4. package/lib/_bundle/sdk.js +2 -0
  5. package/lib/_bundle/sdk.js.map +1 -0
  6. package/lib/credentials.d.ts +29 -0
  7. package/lib/credentials.d.ts.map +1 -0
  8. package/lib/credentials.js +1 -0
  9. package/lib/errors.d.ts +52 -0
  10. package/lib/errors.d.ts.map +1 -0
  11. package/lib/errors.js +1 -0
  12. package/lib/index.d.ts +48 -0
  13. package/lib/index.d.ts.map +1 -0
  14. package/lib/index.js +5 -0
  15. package/lib/protocol.d.ts +19 -0
  16. package/lib/protocol.d.ts.map +1 -0
  17. package/lib/protocol.js +1 -0
  18. package/lib/retry.d.ts +50 -0
  19. package/lib/retry.d.ts.map +1 -0
  20. package/lib/retry.js +1 -0
  21. package/lib/services/analyze.d.ts +17 -0
  22. package/lib/services/analyze.d.ts.map +1 -0
  23. package/lib/services/analyze.js +2 -0
  24. package/lib/services/analyze.js.map +1 -0
  25. package/lib/services/api_endpoints.d.ts +26 -0
  26. package/lib/services/api_endpoints.d.ts.map +1 -0
  27. package/lib/services/api_endpoints.js +2 -0
  28. package/lib/services/api_endpoints.js.map +1 -0
  29. package/lib/services/copy_pipes.d.ts +102 -0
  30. package/lib/services/copy_pipes.d.ts.map +1 -0
  31. package/lib/services/copy_pipes.js +2 -0
  32. package/lib/services/copy_pipes.js.map +1 -0
  33. package/lib/services/datasource.d.ts +171 -0
  34. package/lib/services/datasource.d.ts.map +1 -0
  35. package/lib/services/datasource.js +2 -0
  36. package/lib/services/datasource.js.map +1 -0
  37. package/lib/services/environment_variables.d.ts +61 -0
  38. package/lib/services/environment_variables.d.ts.map +1 -0
  39. package/lib/services/environment_variables.js +2 -0
  40. package/lib/services/environment_variables.js.map +1 -0
  41. package/lib/services/events.d.ts +21 -0
  42. package/lib/services/events.d.ts.map +1 -0
  43. package/lib/services/events.js +2 -0
  44. package/lib/services/events.js.map +1 -0
  45. package/lib/services/index.d.ts +14 -0
  46. package/lib/services/index.d.ts.map +1 -0
  47. package/lib/services/index.js +13 -0
  48. package/lib/services/jobs.d.ts +45 -0
  49. package/lib/services/jobs.d.ts.map +1 -0
  50. package/lib/services/jobs.js +2 -0
  51. package/lib/services/jobs.js.map +1 -0
  52. package/lib/services/materialized_views.d.ts +64 -0
  53. package/lib/services/materialized_views.d.ts.map +1 -0
  54. package/lib/services/materialized_views.js +2 -0
  55. package/lib/services/materialized_views.js.map +1 -0
  56. package/lib/services/organizations.d.ts +214 -0
  57. package/lib/services/organizations.d.ts.map +1 -0
  58. package/lib/services/organizations.js +2 -0
  59. package/lib/services/organizations.js.map +1 -0
  60. package/lib/services/pipe.d.ts +243 -0
  61. package/lib/services/pipe.d.ts.map +1 -0
  62. package/lib/services/pipe.js +2 -0
  63. package/lib/services/pipe.js.map +1 -0
  64. package/lib/services/query.d.ts +50 -0
  65. package/lib/services/query.d.ts.map +1 -0
  66. package/lib/services/query.js +2 -0
  67. package/lib/services/query.js.map +1 -0
  68. package/lib/services/sink_pipes.d.ts +95 -0
  69. package/lib/services/sink_pipes.d.ts.map +1 -0
  70. package/lib/services/sink_pipes.js +2 -0
  71. package/lib/services/sink_pipes.js.map +1 -0
  72. package/lib/services/token.d.ts +107 -0
  73. package/lib/services/token.d.ts.map +1 -0
  74. package/lib/services/token.js +2 -0
  75. package/lib/services/token.js.map +1 -0
  76. package/lib/services.lazy/analyze.js +1 -0
  77. package/lib/services.lazy/api_endpoints.js +1 -0
  78. package/lib/services.lazy/copy_pipes.js +1 -0
  79. package/lib/services.lazy/datasource.js +1 -0
  80. package/lib/services.lazy/environment_variables.js +1 -0
  81. package/lib/services.lazy/events.js +1 -0
  82. package/lib/services.lazy/index.js +3 -0
  83. package/lib/services.lazy/jobs.js +1 -0
  84. package/lib/services.lazy/materialized_views.js +1 -0
  85. package/lib/services.lazy/organizations.js +1 -0
  86. package/lib/services.lazy/pipe.js +1 -0
  87. package/lib/services.lazy/query.js +1 -0
  88. package/lib/services.lazy/sink_pipes.js +1 -0
  89. package/lib/services.lazy/token.js +1 -0
  90. package/lib/traits.d.ts +10 -0
  91. package/lib/traits.d.ts.map +1 -0
  92. package/lib/traits.js +1 -0
  93. package/package.json +76 -2
  94. package/src/credentials.ts +76 -0
  95. package/src/errors.ts +83 -0
  96. package/src/index.ts +47 -0
  97. package/src/protocol.ts +48 -0
  98. package/src/retry.ts +69 -0
  99. package/src/services/analyze.ts +75 -0
  100. package/src/services/api_endpoints.ts +115 -0
  101. package/src/services/copy_pipes.ts +315 -0
  102. package/src/services/datasource.ts +438 -0
  103. package/src/services/environment_variables.ts +213 -0
  104. package/src/services/events.ts +86 -0
  105. package/src/services/index.ts +14 -0
  106. package/src/services/jobs.ts +156 -0
  107. package/src/services/materialized_views.ts +200 -0
  108. package/src/services/organizations.ts +552 -0
  109. package/src/services/pipe.ts +700 -0
  110. package/src/services/query.ts +150 -0
  111. package/src/services/sink_pipes.ts +295 -0
  112. package/src/services/token.ts +359 -0
  113. package/src/traits.ts +47 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token.d.ts","sources":["../../src/services/token.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,2BAA2B,CAAC;AAIjD,OAAO,KAAK,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAoB,KAAK,eAAe,EAAE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAMhG,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,CAAC;AAcnD,MAAM,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;AACtC,MAAM,MAAM,cAAc,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAA;CAAE,CAAC;AACpE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C/C,+PAA+P;AAC/P,eAAO,MAAM,WAAW,EAAE,GAAG,CAAC,eAAe,CAC3C,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,CAUhB,CAAC"}
@@ -0,0 +1,2 @@
1
+ import{Bc as e,Gc as t,Hc as n,a as r,b as i,errors$TinybirdServiceErrors as a,gc as o,hc as s,l as c,n as l,protocol$TinybirdProtocol as u,qc as d,rc as f,retry$Retry as p,tc as m,traits$Http as h,traits$Label as g,traits$Query as _,traits$RawResponseRoot as v,traits$SensitiveValue as y,uc as b,zc as x}from"../_bundle/sdk.js";const S={system:`tinybird-api`,responseHeaders:[{header:`x-request-id`,name:`http.response.header.x-request-id`,transform:`list`},{header:`request-id`,name:`http.response.header.request-id`,transform:`list`}],prefix:`Tinybird`,service:`token`,propagate:`w3c`};const C=/*@__PURE__*/ l(s=>s===r?c(`CreateToken`,`{input:#3,output:#11:0,errors:[],serviceErrors:$12,protocol:$13,retry:$14,telemetry:$15,span:"%"};$5(>4)@"JwtScope";$6(#1);$5(>5)@"%Request";$4({type:$1,resource:$1,fixed_params:$3(#2:0)});$4({name:$3($1.pipe($8())),description:$3($1.pipe($8())),scope:$3(#9:0.pipe($8())),expiration_time:$3($10.pipe($8())),scopes:$3(#2)}).pipe($7({method:"POST",uri:"/v0/tokens",code:200}))`,[e,m,__d0,t,b,n,o,h,_,__d3,d,__d2,a,u,p,S]):i(C,s));const w=/*@__PURE__*/ l(t=>t===r?c(`DeleteToken`,`{input:#1,output:#2,errors:[],serviceErrors:$9,protocol:$10,retry:$11,telemetry:$12,span:"%"};$6(>3)@"%Request";$6(>4)@"%Response";$5({token:$4.pipe($2(),$3({}))}).pipe($1({method:"DELETE",uri:"/v0/tokens/{token}",code:200}));#8:0.pipe($7())`,[e,h,g,y,m,b,n,v,__d0,a,u,p,S]):i(w,t));const T=/*@__PURE__*/ l(t=>t===r?c(`GetToken`,`{input:#1,output:#7:0,errors:[],serviceErrors:$8,protocol:$9,retry:$10,telemetry:$11,span:"%"};$6(>2)@"%Request";$5({token:$4.pipe($2(),$3({}))}).pipe($1({method:"GET",uri:"/v0/tokens/{token}",code:200}))`,[e,h,g,y,m,b,n,__d2,a,u,p,S]):i(T,t));const E=/*@__PURE__*/ l(s=>s===r?c(`ListTokens`,`{input:#1,output:#4,errors:[],serviceErrors:$8,protocol:$9,retry:$10,telemetry:$11,span:"%"};$3(>5)@"%Request";$5(#4:2);$3(>6)@"Tokens";$3(>7)@"%Response";$2({}).pipe($1({method:"GET",uri:"/v0/tokens",code:200}));$2({tokens:$6(#2)});#3.pipe($7())`,[e,h,b,n,__d1,o,t,v,a,u,p,S]):i(E,s));const D=/*@__PURE__*/ l(o=>o===r?c(`RefreshToken`,`{input:#1,output:#9:0,errors:[],serviceErrors:$10,protocol:$11,retry:$12,telemetry:$13,span:"%"};$8(>2)@"%Request";$7({token:$4.pipe($2(),$3({})),auth_token:$6($4.pipe($5(),$3({})))}).pipe($1({method:"POST",uri:"/v0/tokens/{token}/refresh",code:200}))`,[e,h,g,y,m,_,t,b,n,__d2,a,u,p,S]):i(D,o));const O=/*@__PURE__*/ l(o=>o===r?c(`UpdateToken`,`{input:#1,output:#10:0,errors:[],serviceErrors:$11,protocol:$12,retry:$13,telemetry:$14,span:"%"};$9(>2)@"%Request";$8({token:$4.pipe($2(),$3({})),name:$6($4.pipe($5())),description:$6($4.pipe($5())),scope:$6(#7:0.pipe($5()))}).pipe($1({method:"PUT",uri:"/v0/tokens/{token}",code:200}))`,[e,h,g,y,m,_,t,__d3,b,n,__d2,a,u,p,S]):i(O,o));function __d0(){return[`$3($1,$2)`,[e,m,x,f]]}function __d1(){return[`$5(>3)@"TokenScope";$6(#0);$5(>4)@"Token";$4({type:$2($1),resource:$2($1),filter:$2($1),fixed_params:$2(#3:0)});$4({id:$2($1),token:$2($1.pipe($7({}))),scopes:$2(#1),name:$2($1),description:$2($1),origin:$2($8),host:$2($1),is_internal:$2($9),exp:$2($10)})`,[e,m,t,__d0,b,n,o,y,x,s,d]]}function __d2(){return[`$3(>1)@"CreateTokenResponse";#2:2.pipe($1())`,[e,v,__d1,n]]}function __d3(){return[`$2($1)`,[e,m,o]]}export{C as createToken,w as deleteToken,T as getToken,E as listTokens,D as refreshToken,O as updateToken};
2
+ //# sourceMappingURL=token.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token.js","names":["API.D","API.named","__L.at","S.String","S.optional","S.Struct","S.suspend","S.Array","T.Http","T.Query","S.Number","Retry.Retry","API.call","T.Label","T.SensitiveValue","T.RawResponseRoot","S.Unknown","S.Record","S.Boolean","at","optional","suspend","D","call","TinybirdServiceErrors","Array","Boolean","named","op","TinybirdProtocol","Number","Record","Retry","String","Http","Label","Query","RawResponseRoot","SensitiveValue","Struct","Unknown","TELEMETRY","createToken","i","deleteToken","getToken","listTokens","refreshToken","updateToken"],"sources":["../../src/services/token.ts"],"mappings":"yUAaA,MAAMyC,EAAY,CAChB,OAAQ,eACR,gBAAiB,CACf,CAAE,OAAQ,eAAgB,KAAM,oCAAqC,UAAW,MAAO,EACvF,CAAE,OAAQ,aAAc,KAAM,kCAAmC,UAAW,MAAO,CACrF,EACA,OAAQ,WACR,QAAS,QACT,UAAW,KACb,EAmFA,MAAaC,EAKK,gBAAQ,GAAgBC,IAAM3C,EAAQC,EAAU,cAAe,yXAA0X,CAACC,EAAQC,EAAU,KAAMC,EAAYC,EAAUC,EAAWC,EAASC,EAAQC,EAAS,KAAMC,EAAU,KAAMc,EAAuBK,EAAkBlB,EAAa8B,CAAS,CAAC,EAAI7B,EAAS8B,EAAaC,CAAC,CAAC,EAIjpB,MAAaC,EAKK,gBAAQ,GAAgBD,IAAM3C,EAAQC,EAAU,cAAe,oPAAqP,CAACC,EAAQM,EAAQK,EAASC,EAAkBX,EAAUE,EAAUC,EAAWS,EAAmB,KAAMS,EAAuBK,EAAkBlB,EAAa8B,CAAS,CAAC,EAAI7B,EAASgC,EAAaD,CAAC,CAAC,EAItgB,MAAaE,EAKK,gBAA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AAUI,CAAO,CAAC,CAC/C"}
@@ -0,0 +1 @@
1
+ export*from"../services/analyze.js";
@@ -0,0 +1 @@
1
+ export*from"../services/api_endpoints.js";
@@ -0,0 +1 @@
1
+ export*from"../services/copy_pipes.js";
@@ -0,0 +1 @@
1
+ export*from"../services/datasource.js";
@@ -0,0 +1 @@
1
+ export*from"../services/environment_variables.js";
@@ -0,0 +1 @@
1
+ export*from"../services/events.js";
@@ -0,0 +1,3 @@
1
+ import{api$lazyNamespace as $N}from"@distilled.cloud/core/_bundle/base";
2
+ const $u=import.meta.url,analyze=$N($u,"./analyze.js"),apiEndpoints=$N($u,"./api_endpoints.js"),copyPipes=$N($u,"./copy_pipes.js"),datasource=$N($u,"./datasource.js"),environmentVariables=$N($u,"./environment_variables.js"),events=$N($u,"./events.js"),jobs=$N($u,"./jobs.js"),materializedViews=$N($u,"./materialized_views.js"),organizations=$N($u,"./organizations.js"),pipe=$N($u,"./pipe.js"),query=$N($u,"./query.js"),sinkPipes=$N($u,"./sink_pipes.js"),token=$N($u,"./token.js");
3
+ export{analyze,apiEndpoints,copyPipes,datasource,environmentVariables,events,jobs,materializedViews,organizations,pipe,query,sinkPipes,token};
@@ -0,0 +1 @@
1
+ export*from"../services/jobs.js";
@@ -0,0 +1 @@
1
+ export*from"../services/materialized_views.js";
@@ -0,0 +1 @@
1
+ export*from"../services/organizations.js";
@@ -0,0 +1 @@
1
+ export*from"../services/pipe.js";
@@ -0,0 +1 @@
1
+ export*from"../services/query.js";
@@ -0,0 +1 @@
1
+ export*from"../services/sink_pipes.js";
@@ -0,0 +1 @@
1
+ export*from"../services/token.js";
@@ -0,0 +1,10 @@
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 { Body, Header, Query, Label, Http, ResponseCode, HttpBody, FormDataFile, KeyDictionary, UnionCases, applyErrorMatchers, getErrorMatchers, type HttpTrait, type ErrorMatcher, bodySymbol, headerSymbol, querySymbol, labelSymbol, httpSymbol, responseCodeSymbol, httpBodySymbol, formDataFileSymbol, keyDictionarySymbol, unionCasesSymbol, errorMatchersSymbol, } from "@distilled.cloud/core/trait";
9
+ export { BinaryResponse, SensitiveValue, RawResponse, RawResponseRoot, binaryResponseSymbol, sensitiveValueSymbol, rawResponseSymbol, rawResponseRootSymbol, } from "@distilled.cloud/core/protocol-rest";
10
+ //# sourceMappingURL=traits.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"traits.d.ts","sources":["../src/traits.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,IAAI,EACJ,MAAM,EACN,KAAK,EACL,KAAK,EACL,IAAI,EACJ,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,UAAU,EACV,kBAAkB,EAClB,gBAAgB,EAChB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,UAAU,EACV,YAAY,EACZ,WAAW,EACX,WAAW,EACX,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EACL,cAAc,EACd,cAAc,EACd,WAAW,EACX,eAAe,EACf,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,qCAAqC,CAAC"}
package/lib/traits.js ADDED
@@ -0,0 +1 @@
1
+ export { traits$BinaryResponse as BinaryResponse, traits$Body as Body, traits$FormDataFile as FormDataFile, traits$Header as Header, traits$Http as Http, traits$HttpBody as HttpBody, traits$KeyDictionary as KeyDictionary, traits$Label as Label, traits$Query as Query, traits$RawResponse as RawResponse, traits$RawResponseRoot as RawResponseRoot, traits$ResponseCode as ResponseCode, traits$SensitiveValue as SensitiveValue, traits$UnionCases as UnionCases, traits$applyErrorMatchers as applyErrorMatchers, traits$binaryResponseSymbol as binaryResponseSymbol, traits$bodySymbol as bodySymbol, traits$errorMatchersSymbol as errorMatchersSymbol, traits$formDataFileSymbol as formDataFileSymbol, traits$getErrorMatchers as getErrorMatchers, traits$headerSymbol as headerSymbol, traits$httpBodySymbol as httpBodySymbol, traits$httpSymbol as httpSymbol, traits$keyDictionarySymbol as keyDictionarySymbol, traits$labelSymbol as labelSymbol, traits$querySymbol as querySymbol, traits$rawResponseRootSymbol as rawResponseRootSymbol, traits$rawResponseSymbol as rawResponseSymbol, traits$responseCodeSymbol as responseCodeSymbol, traits$sensitiveValueSymbol as sensitiveValueSymbol, traits$unionCasesSymbol as unionCasesSymbol } from "./_bundle/sdk.js";
package/package.json CHANGED
@@ -1,11 +1,85 @@
1
1
  {
2
2
  "name": "@distilled.cloud/tinybird",
3
- "version": "0.0.0",
3
+ "version": "1.0.0-rc.21",
4
4
  "description": "Effect-native Tinybird API SDK generated from the official public API reference.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/alchemy-run/distilled",
9
9
  "directory": "packages/tinybird"
10
+ },
11
+ "files": [
12
+ "lib",
13
+ "src"
14
+ ],
15
+ "type": "module",
16
+ "sideEffects": false,
17
+ "module": "src/index.ts",
18
+ "exports": {
19
+ ".": {
20
+ "types": "./lib/index.d.ts",
21
+ "bun": "./src/index.ts",
22
+ "worker": "./src/index.ts",
23
+ "default": "./lib/index.js"
24
+ },
25
+ "./Credentials": {
26
+ "types": "./lib/credentials.d.ts",
27
+ "bun": "./src/credentials.ts",
28
+ "worker": "./src/credentials.ts",
29
+ "default": "./lib/credentials.js"
30
+ },
31
+ "./Errors": {
32
+ "types": "./lib/errors.d.ts",
33
+ "bun": "./src/errors.ts",
34
+ "worker": "./src/errors.ts",
35
+ "default": "./lib/errors.js"
36
+ },
37
+ "./Traits": {
38
+ "types": "./lib/traits.d.ts",
39
+ "bun": "./src/traits.ts",
40
+ "worker": "./src/traits.ts",
41
+ "default": "./lib/traits.js"
42
+ },
43
+ "./Protocol": {
44
+ "types": "./lib/protocol.d.ts",
45
+ "bun": "./src/protocol.ts",
46
+ "worker": "./src/protocol.ts",
47
+ "default": "./lib/protocol.js"
48
+ },
49
+ "./Retry": {
50
+ "types": "./lib/retry.d.ts",
51
+ "bun": "./src/retry.ts",
52
+ "worker": "./src/retry.ts",
53
+ "default": "./lib/retry.js"
54
+ },
55
+ "./*": {
56
+ "types": "./lib/services/*.d.ts",
57
+ "bun": "./src/services/*.ts",
58
+ "worker": "./src/services/*.ts",
59
+ "distilled-lazy": "./lib/services.lazy/*.js",
60
+ "default": "./lib/services/*.js"
61
+ }
62
+ },
63
+ "dependencies": {
64
+ "@distilled.cloud/core": "1.0.0-rc.21"
65
+ },
66
+ "devDependencies": {
67
+ "@distilled.cloud/dev": "0.0.0",
68
+ "@types/node": "26.6.5"
69
+ },
70
+ "peerDependencies": {
71
+ "effect": "~4.1.7"
72
+ },
73
+ "distilled": {
74
+ "generatedAt": "2026-11-27",
75
+ "specUpdatedAt": "2026-11-24"
76
+ },
77
+ "scripts": {
78
+ "build": "tsrs -b",
79
+ "convert": "node --conditions=bun scripts/convert.ts",
80
+ "generate": "node --conditions=bun scripts/generate.ts",
81
+ "typecheck": "tsrs -p tsconfig.json",
82
+ "specs:fetch": "git submodule update --force --init --depth=1 specs/spec-mirror-tinybird",
83
+ "specs:update": "git submodule update --remote --force --depth=1 specs/spec-mirror-tinybird"
10
84
  }
11
- }
85
+ }
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Tinybird credentials -- hand-written.
3
+ *
4
+ * The `Credentials` service resolves `{ token, apiBaseUrl }` per request; the
5
+ * protocol formats the `Authorization: Bearer <token>` header from it. The
6
+ * token is a Tinybird workspace token (static or JWT) with the scopes the
7
+ * call needs (`ADMIN`, `DATASOURCES:CREATE`, `PIPES:READ:<pipe>`, ...).
8
+ *
9
+ * Every Tinybird workspace lives in one region, and each region has its own
10
+ * API host (https://www.tinybird.co/docs/api-reference#regions-and-endpoints):
11
+ * `https://api.tinybird.co` (GCP europe-west3) is the default,
12
+ * `https://api.us-east.tinybird.co`, `https://api.eu-central-1.aws.tinybird.co`
13
+ * and the rest are set through `TINYBIRD_API_BASE_URL` or `apiBaseUrl`. A
14
+ * token sent to another region's host answers `404`.
15
+ */
16
+ import * as EffectConfig from "@distilled.cloud/core/config";
17
+ import { ConfigError } from "@distilled.cloud/core/errors";
18
+ import * as Context from "effect/Context";
19
+ import * as Effect from "effect/Effect";
20
+ import * as Layer from "effect/Layer";
21
+ import type * as Redacted from "effect/Redacted";
22
+
23
+ /** The API host of Tinybird's default region (GCP europe-west3). */
24
+ export const DEFAULT_API_BASE_URL = "https://api.tinybird.co";
25
+
26
+ export interface Config {
27
+ readonly token: Redacted.Redacted<string>;
28
+ /** The workspace region's API host, e.g. `https://api.us-east.tinybird.co`. */
29
+ readonly apiBaseUrl: string;
30
+ }
31
+
32
+ export class Credentials
33
+ extends /*@__PURE__*/ Context.Service<Credentials, Effect.Effect<Config>>()(
34
+ "TinybirdCredentials",
35
+ ) {}
36
+
37
+ const envConfig = /*@__PURE__*/ EffectConfig.all({
38
+ token: /*@__PURE__*/ EffectConfig.Redacted("TINYBIRD_TOKEN"),
39
+ apiBaseUrl: /*@__PURE__*/ EffectConfig.String("TINYBIRD_API_BASE_URL").pipe(
40
+ /*@__PURE__*/ EffectConfig.withDefault(DEFAULT_API_BASE_URL),
41
+ ),
42
+ });
43
+
44
+ /**
45
+ * Reads `TINYBIRD_TOKEN` and, optionally, `TINYBIRD_API_BASE_URL`.
46
+ *
47
+ * Its configuration is read and checked once, when the layer is built: a
48
+ * problem there fails the layer with `ConfigError`.
49
+ */
50
+ export const CredentialsFromEnv = /*@__PURE__*/ Layer.effect(
51
+ Credentials,
52
+ /*@__PURE__*/ Effect.map(
53
+ /*@__PURE__*/ envConfig.pipe(
54
+ /*@__PURE__*/ Effect.mapError(
55
+ () =>
56
+ new ConfigError({
57
+ message: "TINYBIRD_TOKEN environment variable is required",
58
+ }),
59
+ ),
60
+ ),
61
+ (config) => Effect.succeed(config),
62
+ ),
63
+ );
64
+
65
+ /** Credentials from a redacted token and, optionally, the region's API host. */
66
+ export const credentials = (config: {
67
+ readonly token: Redacted.Redacted<string>;
68
+ readonly apiBaseUrl?: string;
69
+ }): Layer.Layer<Credentials> =>
70
+ Layer.succeed(
71
+ Credentials,
72
+ Effect.succeed({
73
+ token: config.token,
74
+ apiBaseUrl: config.apiBaseUrl ?? DEFAULT_API_BASE_URL,
75
+ }),
76
+ );
package/src/errors.ts ADDED
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Tinybird error types.
3
+ *
4
+ * Tinybird answers a failure with `{ "error": "<message>" }` (some routes add
5
+ * `documentation` or other fields) under an HTTP status, and its reference
6
+ * types failures only as per-operation status tables (`400`, `403`, `404`,
7
+ * `409`, `413`, `422`, `429`, `5xx`). The SDK dispatches on the status with
8
+ * core's shared classes; a status nothing maps comes back as
9
+ * {@link UnknownTinybirdError} with the body.
10
+ */
11
+ export {
12
+ BadGateway,
13
+ BadRequest,
14
+ Conflict,
15
+ ConfigError,
16
+ Forbidden,
17
+ GatewayTimeout,
18
+ InternalServerError,
19
+ Locked,
20
+ NotFound,
21
+ ServiceUnavailable,
22
+ TooManyRequests,
23
+ Unauthorized,
24
+ UnprocessableEntity,
25
+ HTTP_STATUS_MAP,
26
+ DEFAULT_ERRORS,
27
+ API_ERRORS,
28
+ } from "@distilled.cloud/core/errors";
29
+ import * as Category from "@distilled.cloud/core/category";
30
+ import type {
31
+ BadRequest as CoreBadRequest,
32
+ Conflict as CoreConflict,
33
+ DefaultErrors as CoreDefaultErrors,
34
+ Forbidden as CoreForbidden,
35
+ Locked as CoreLocked,
36
+ NotFound as CoreNotFound,
37
+ UnprocessableEntity as CoreUnprocessableEntity,
38
+ } from "@distilled.cloud/core/errors";
39
+ import { API_ERRORS, UnknownErrorFields } from "@distilled.cloud/core/errors";
40
+ import * as Schema from "@distilled.cloud/core/schema-lite-typed";
41
+
42
+ /**
43
+ * Unknown Tinybird error -- a failed response whose status has no mapped
44
+ * class (`413` payload too large, for one). `message` is Tinybird's `error`.
45
+ */
46
+ export class UnknownTinybirdError
47
+ extends /*@__PURE__*/ Schema.TaggedError<UnknownTinybirdError>()(
48
+ "UnknownTinybirdError",
49
+ UnknownErrorFields,
50
+ ) {}
51
+
52
+ /** A 2xx body that did not match the operation's output (validating modes only). */
53
+ export class TinybirdParseError
54
+ extends /*@__PURE__*/ Schema.TaggedError<TinybirdParseError>()("TinybirdParseError", {
55
+ body: Schema.Unknown,
56
+ cause: Schema.Unknown,
57
+ }).pipe(Category.withParseError) {}
58
+
59
+ /** Errors any Tinybird operation may surface besides the shared HTTP status errors. */
60
+ export type ClientErrors = UnknownTinybirdError | TinybirdParseError;
61
+
62
+ /**
63
+ * Default Tinybird operation errors. Every operation carries the whole set:
64
+ * the reference lists statuses per operation inconsistently (many sections
65
+ * list none), so any of them can come back from any call.
66
+ */
67
+ export type DefaultErrors =
68
+ | CoreDefaultErrors
69
+ | CoreBadRequest
70
+ | CoreForbidden
71
+ | CoreNotFound
72
+ | CoreConflict
73
+ | CoreUnprocessableEntity
74
+ | CoreLocked
75
+ | ClientErrors;
76
+
77
+ /**
78
+ * The errors declared on the Tinybird service: any operation can return them,
79
+ * and every generated operation lists them as its `serviceErrors`. Today that
80
+ * is each of core's status classes (401, 403, 404, 429, the 5xx ...).
81
+ */
82
+ export const TinybirdServiceErrors = API_ERRORS;
83
+ export type TinybirdServiceError = InstanceType<(typeof TinybirdServiceErrors)[number]>;
package/src/index.ts ADDED
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @distilled.cloud/tinybird -- Tinybird SDK for Effect.
3
+ *
4
+ * `./services` is generated by `scripts/generate.ts` from the Smithy models
5
+ * that `scripts/convert.ts` reads out of Tinybird's API reference, mirrored
6
+ * as Markdown under `specs/spec-mirror-tinybird/specs/api-reference`.
7
+ * Everything else in this folder is hand-written.
8
+ *
9
+ * One module per reference page: `datasource`, `events`, `query`, `pipe`,
10
+ * `api_endpoints`, `copy_pipes`, `materialized_views`, `sink_pipes`, `token`,
11
+ * `environment_variables`, `jobs`, `analyze` and `organizations`. Import each
12
+ * from its subpath.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * import { Effect, Layer } from "effect";
17
+ * import * as FetchHttpClient from "effect/http/FetchHttpClient";
18
+ * import * as Tinybird from "@distilled.cloud/tinybird";
19
+ * import * as Events from "@distilled.cloud/tinybird/events";
20
+ * import * as Query from "@distilled.cloud/tinybird/query";
21
+ *
22
+ * const program = Effect.gen(function* () {
23
+ * const ingested = yield* Events.sendEvents({
24
+ * name: "events",
25
+ * wait: true,
26
+ * body: '{"timestamp":"2026-11-17 00:00:00","city":"Chicago","amount":3}\n',
27
+ * });
28
+ * const { body: bytes } = yield* Query.querySql({
29
+ * q: "SELECT city, sum(amount) AS total FROM events GROUP BY city FORMAT JSON",
30
+ * });
31
+ * const { data } = JSON.parse(new TextDecoder().decode(bytes));
32
+ * return { ingested, data };
33
+ * });
34
+ *
35
+ * const Live = Layer.mergeAll(
36
+ * FetchHttpClient.layer,
37
+ * Tinybird.CredentialsFromEnv,
38
+ * );
39
+ *
40
+ * program.pipe(Effect.provide(Live), Effect.runPromise).then(console.log);
41
+ * ```
42
+ */
43
+ export * from "./credentials.ts";
44
+ export * from "./errors.ts";
45
+ export * as T from "./traits.ts";
46
+ export { TinybirdProtocol, type TinybirdOpError, type TinybirdOpContext } from "./protocol.ts";
47
+ export * as Retry from "./retry.ts";
@@ -0,0 +1,48 @@
1
+ import type { ErrorOf } from "@distilled.cloud/core/protocol";
2
+ import { restProtocol, unknownErrorProps } from "@distilled.cloud/core/protocol-rest";
3
+ /**
4
+ * TinybirdProtocol -- the shared bearer-REST protocol instantiated for
5
+ * Tinybird.
6
+ *
7
+ * Tinybird speaks plain JSON with no success envelope; a failure is
8
+ * `{ "error": "<message>" }`, which the factory's default extractor reads.
9
+ * The API version is part of each route (`/v0/...`), and the host is the
10
+ * workspace region's (see credentials.ts).
11
+ *
12
+ * Non-JSON bodies follow the operation's model: the data endpoints
13
+ * (`queryPipe`, `querySql`, ...) answer in the format the caller picks and
14
+ * return the raw bytes, and a JSON body the reference does not type comes
15
+ * back as read.
16
+ */
17
+ import * as Effect from "effect/Effect";
18
+ import type * as HttpClient from "effect/http/HttpClient";
19
+ import * as Redacted from "effect/Redacted";
20
+ import { Credentials } from "./credentials.ts";
21
+ import { TinybirdParseError, UnknownTinybirdError, type TinybirdServiceError } from "./errors.ts";
22
+
23
+ /**
24
+ * What every generated Tinybird operation fails with besides its own errors:
25
+ * the errors declared on the service, and the errors declared on the protocol.
26
+ * Nobody lists the protocol's: its type carries what its code fails with (a
27
+ * response that does not match its schema, a failed response nothing declares,
28
+ * core's REST errors, and what resolving the credentials fails with).
29
+ * Generated service files annotate operations with `API.OperationMethod<I, O,
30
+ * TinybirdOpError, TinybirdOpContext>` explicitly so the compiler never infers
31
+ * these back out of the schema generics.
32
+ */
33
+ export type TinybirdOpError = TinybirdServiceError | ErrorOf<typeof TinybirdProtocol>;
34
+
35
+ /** Context (requirements) shared by every generated Tinybird operation. */
36
+ export type TinybirdOpContext = Credentials | HttpClient.HttpClient;
37
+
38
+ export const TinybirdProtocol = /*@__PURE__*/ restProtocol({
39
+ // Resolved on the calling fiber per request, so a rotated token is
40
+ // picked up without rebuilding the layer.
41
+ credentials: /*@__PURE__*/ Effect.flatten(Credentials),
42
+ baseUrl: (creds) => creds.apiBaseUrl.replace(/\/+$/, ""),
43
+ headers: (creds) => ({
44
+ Authorization: `Bearer ${Redacted.value(creds.token)}`,
45
+ }),
46
+ unknownError: (info) => new UnknownTinybirdError(unknownErrorProps(info)),
47
+ parseError: ({ body, cause }) => new TinybirdParseError({ body, cause }),
48
+ });
package/src/retry.ts ADDED
@@ -0,0 +1,69 @@
1
+ import * as Retries from "@distilled.cloud/core/retry";
2
+ /**
3
+ * Tinybird retry surface -- a veneer over `@distilled.cloud/core/retry`.
4
+ *
5
+ * The `Retry` service tag is threaded into every generated operation via
6
+ * `API.make({ retry: Retry })`, so a caller-installed policy applies to all
7
+ * Tinybird calls below it and core's `makeDefault` is the fallback when none is
8
+ * provided.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * import * as Tinybird from "@distilled.cloud/tinybird";
13
+ *
14
+ * myEffect.pipe(Tinybird.Retry.transient);
15
+ * ```
16
+ */
17
+ import * as Context from "effect/Context";
18
+ import * as Effect from "effect/Effect";
19
+ import * as Layer from "effect/Layer";
20
+
21
+ export type Options = Retries.Options;
22
+ export type Factory = Retries.Factory;
23
+ export type Policy = Retries.Policy;
24
+
25
+ /** Context tag for configuring retry behavior of Tinybird API calls. */
26
+ export class Retry extends /*@__PURE__*/ Context.Service<Retry, Policy>()("TinybirdRetry") {}
27
+
28
+ /** Provides a custom retry policy to every Tinybird API call below it. */
29
+ export const policy: {
30
+ (
31
+ options: Options,
32
+ ): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Retry>>;
33
+ (
34
+ factory: Factory,
35
+ ): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Retry>>;
36
+ } = (optionsOrFactory: Options | Factory) => Effect.provide(Layer.succeed(Retry, optionsOrFactory));
37
+
38
+ /** Disables all automatic retries. */
39
+ export const none: <A, E, R>(
40
+ effect: Effect.Effect<A, E, R>,
41
+ ) => Effect.Effect<A, E, Exclude<R, Retry>> = /*@__PURE__*/ Effect.provide(
42
+ /*@__PURE__*/ Layer.succeed(Retry, { while: () => false }),
43
+ );
44
+
45
+ /**
46
+ * The default retry policy (core's): transient/throttling/retryable errors,
47
+ * capped exponential backoff with jitter, server `retryAfter` hints honored
48
+ * with precedence.
49
+ */
50
+ export const makeDefault: Factory = Retries.makeDefault;
51
+
52
+ export const jittered = Retries.jittered;
53
+ export const capped = Retries.capped;
54
+
55
+ /** Retry options that retry all throttling errors indefinitely. */
56
+ export const throttlingOptions: Options = Retries.throttlingOptions;
57
+
58
+ /** Retries all throttling errors indefinitely (honoring server hints). */
59
+ export const throttling: <A, E, R>(
60
+ effect: Effect.Effect<A, E, R>,
61
+ ) => Effect.Effect<A, E, Exclude<R, Retry>> = /*@__PURE__*/ policy(Retries.throttlingFactory);
62
+
63
+ /** Retry options that retry all transient errors indefinitely. */
64
+ export const transientOptions: Options = Retries.transientOptions;
65
+
66
+ /** Retries all transient errors indefinitely. */
67
+ export const transient: <A, E, R>(
68
+ effect: Effect.Effect<A, E, R>,
69
+ ) => Effect.Effect<A, E, Exclude<R, Retry>> = /*@__PURE__*/ policy(Retries.transientFactory);
@@ -0,0 +1,75 @@
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 { TinybirdServiceErrors } from "../errors.ts";
6
+ import { TinybirdProtocol, type TinybirdOpError, type TinybirdOpContext } from "../protocol.ts";
7
+ import * as Retry from "../retry.ts";
8
+ import * as T from "../traits.ts";
9
+ // Schema table, filled on first reach (see __S at the end).
10
+ const __s: any[] = [];
11
+
12
+ export type { TinybirdOpError, TinybirdOpContext };
13
+
14
+ /** Span facts shared by every operation (com.distilled.telemetry#service). */
15
+ const TELEMETRY = {
16
+ system: "tinybird-api",
17
+ responseHeaders: [
18
+ { header: "x-request-id", name: "http.response.header.x-request-id", transform: "list" },
19
+ { header: "request-id", name: "http.response.header.request-id", transform: "list" },
20
+ ],
21
+ prefix: "Tinybird",
22
+ service: "Analyze",
23
+ propagate: "w3c",
24
+ } as const;
25
+
26
+ export interface PostV0AnalyzeRequest {
27
+ /** A sample of a local CSV, NDJSON or Parquet file (multipart part `file`). */
28
+ file?: Uint8Array | undefined;
29
+ /** URL of a remote file to analyze. */
30
+ url?: string | undefined;
31
+ }
32
+ export type AnalyzeDataResponseBodyMap = { [key: string]: unknown | undefined };
33
+ export type AnalyzeDataResponse = AnalyzeDataResponseBodyMap;
34
+ export type AnalyzeDataError = TinybirdOpError;
35
+ /** The Analyze API takes a sample of a supported file (`csv`, `ndjson`, `parquet`) and guesses the file format, schema, columns, types, nullables and JSONPaths (in the case of NDJSON paths). This is a helper endpoint to create Data Sources without having to write the schema manually. Take into account Tinybird's guessing algorithm is not deterministic since it takes a random portion of the file passed to the endpoint, that means it can guess different types or nullables depending on the sample analyzed. We recommend to double check the schema guessed in case you have to make some manual adjustments. The `columns` attribute contains the guessed columns and for each one: - `path`: The JSONPath syntax in the case of NDJSON/Parquet files - `recommended_type`: The guessed database type - `present_pct`: If the value is lower than 1 then there was nulls in the sample used for guessing - `name`: The recommended column name The `schema` attribute is ready to be used in the [Data Sources API](/docs/api-reference/datasource-api) The `preview` contains up to 10 rows of the content of the file. Reference: https://www.tinybird.co/docs/api-reference/analyze-api */
36
+ export const analyzeData: API.OperationMethod<
37
+ PostV0AnalyzeRequest,
38
+ AnalyzeDataResponse,
39
+ AnalyzeDataError,
40
+ TinybirdOpContext
41
+ > = /*@__PURE__*/ API.make(() => ({
42
+ input: __S(0, __c0, 0) as any as S.Schema<PostV0AnalyzeRequest>,
43
+ output: __S(2, __c0, 2) as any as S.Schema<AnalyzeDataResponse>,
44
+ errors: [],
45
+ serviceErrors: TinybirdServiceErrors,
46
+ protocol: TinybirdProtocol,
47
+ retry: Retry.Retry,
48
+ telemetry: TELEMETRY,
49
+ span: "AnalyzeData",
50
+ }));
51
+
52
+ // Schema builders: each runs one schema initializer, on that schema's first use.
53
+ function __c0(j: number): any {
54
+ switch (j) {
55
+ case 0:
56
+ return S.suspend(() =>
57
+ S.Struct({
58
+ file: S.optional(S.instanceOf(Uint8Array)),
59
+ url: S.optional(S.String.pipe(T.Query())),
60
+ }).pipe(
61
+ T.Http({ method: "POST", uri: "/v0/analyze", code: 200, contentType: "multipart" }),
62
+ ),
63
+ ).annotate({ identifier: "PostV0AnalyzeRequest" });
64
+ case 1:
65
+ return S.Record(S.String, S.Unknown);
66
+ case 2:
67
+ return S.suspend(() => __S(1, __c0, 1).pipe(T.RawResponseRoot())).annotate({
68
+ identifier: "AnalyzeDataResponse",
69
+ });
70
+ }
71
+ }
72
+ // Schema table: entry i is schema j of builder f, made on first reach.
73
+ function __S(i: number, f: (j: number) => unknown, j: number): any {
74
+ return (__s[i] ??= __L.at(f, j));
75
+ }