@distilled.cloud/turso 0.30.3 → 1.0.0-rc.10

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 (320) hide show
  1. package/LICENSE +201 -0
  2. package/lib/credentials.d.ts.map +1 -1
  3. package/lib/credentials.js +9 -1
  4. package/lib/credentials.js.map +1 -1
  5. package/lib/errors.d.ts +24 -3
  6. package/lib/errors.d.ts.map +1 -1
  7. package/lib/errors.js +15 -6
  8. package/lib/errors.js.map +1 -1
  9. package/lib/index.d.ts +8 -6
  10. package/lib/index.d.ts.map +1 -1
  11. package/lib/index.js +8 -6
  12. package/lib/index.js.map +1 -1
  13. package/lib/protocol.d.ts +18 -0
  14. package/lib/protocol.d.ts.map +1 -0
  15. package/lib/protocol.js +46 -0
  16. package/lib/protocol.js.map +1 -0
  17. package/lib/retry.d.ts +4 -4
  18. package/lib/retry.js +4 -4
  19. package/lib/services/index.d.ts +2 -0
  20. package/lib/services/index.d.ts.map +1 -0
  21. package/lib/services/index.js +3 -0
  22. package/lib/services/index.js.map +1 -0
  23. package/lib/services/turso.d.ts +1296 -0
  24. package/lib/services/turso.d.ts.map +1 -0
  25. package/lib/services/turso.js +1462 -0
  26. package/lib/services/turso.js.map +1 -0
  27. package/lib/traits.d.ts +10 -2
  28. package/lib/traits.d.ts.map +1 -1
  29. package/lib/traits.js +10 -2
  30. package/lib/traits.js.map +1 -1
  31. package/package.json +37 -41
  32. package/src/credentials.ts +9 -1
  33. package/src/errors.ts +44 -7
  34. package/src/index.ts +12 -6
  35. package/src/protocol.ts +68 -0
  36. package/src/retry.ts +4 -4
  37. package/src/services/index.ts +2 -0
  38. package/src/services/turso.ts +3425 -0
  39. package/src/traits.ts +44 -2
  40. package/README.md +0 -36
  41. package/lib/category.d.ts +0 -5
  42. package/lib/category.d.ts.map +0 -1
  43. package/lib/category.js +0 -5
  44. package/lib/category.js.map +0 -1
  45. package/lib/client.d.ts +0 -11
  46. package/lib/client.d.ts.map +0 -1
  47. package/lib/client.js +0 -59
  48. package/lib/client.js.map +0 -1
  49. package/lib/operations/addLocationToGroup.d.ts +0 -30
  50. package/lib/operations/addLocationToGroup.d.ts.map +0 -1
  51. package/lib/operations/addLocationToGroup.js +0 -40
  52. package/lib/operations/addLocationToGroup.js.map +0 -1
  53. package/lib/operations/addOrganizationMember.d.ts +0 -22
  54. package/lib/operations/addOrganizationMember.d.ts.map +0 -1
  55. package/lib/operations/addOrganizationMember.js +0 -32
  56. package/lib/operations/addOrganizationMember.js.map +0 -1
  57. package/lib/operations/createAPIToken.d.ts +0 -28
  58. package/lib/operations/createAPIToken.d.ts.map +0 -1
  59. package/lib/operations/createAPIToken.js +0 -44
  60. package/lib/operations/createAPIToken.js.map +0 -1
  61. package/lib/operations/createDatabase.d.ts +0 -35
  62. package/lib/operations/createDatabase.d.ts.map +0 -1
  63. package/lib/operations/createDatabase.js +0 -53
  64. package/lib/operations/createDatabase.js.map +0 -1
  65. package/lib/operations/createDatabaseToken.d.ts +0 -30
  66. package/lib/operations/createDatabaseToken.d.ts.map +0 -1
  67. package/lib/operations/createDatabaseToken.js +0 -40
  68. package/lib/operations/createDatabaseToken.js.map +0 -1
  69. package/lib/operations/createGroup.d.ts +0 -29
  70. package/lib/operations/createGroup.d.ts.map +0 -1
  71. package/lib/operations/createGroup.js +0 -51
  72. package/lib/operations/createGroup.js.map +0 -1
  73. package/lib/operations/createGroupToken.d.ts +0 -30
  74. package/lib/operations/createGroupToken.d.ts.map +0 -1
  75. package/lib/operations/createGroupToken.js +0 -38
  76. package/lib/operations/createGroupToken.js.map +0 -1
  77. package/lib/operations/deleteDatabase.d.ts +0 -21
  78. package/lib/operations/deleteDatabase.d.ts.map +0 -1
  79. package/lib/operations/deleteDatabase.js +0 -29
  80. package/lib/operations/deleteDatabase.js.map +0 -1
  81. package/lib/operations/deleteGroup.d.ts +0 -28
  82. package/lib/operations/deleteGroup.d.ts.map +0 -1
  83. package/lib/operations/deleteGroup.js +0 -36
  84. package/lib/operations/deleteGroup.js.map +0 -1
  85. package/lib/operations/deleteOrganizationInviteByEmail.d.ts +0 -21
  86. package/lib/operations/deleteOrganizationInviteByEmail.d.ts.map +0 -1
  87. package/lib/operations/deleteOrganizationInviteByEmail.js +0 -30
  88. package/lib/operations/deleteOrganizationInviteByEmail.js.map +0 -1
  89. package/lib/operations/deleteOrganizationInviteByEmailV2.d.ts +0 -18
  90. package/lib/operations/deleteOrganizationInviteByEmailV2.d.ts.map +0 -1
  91. package/lib/operations/deleteOrganizationInviteByEmailV2.js +0 -29
  92. package/lib/operations/deleteOrganizationInviteByEmailV2.js.map +0 -1
  93. package/lib/operations/getCurrentUser.d.ts +0 -23
  94. package/lib/operations/getCurrentUser.d.ts.map +0 -1
  95. package/lib/operations/getCurrentUser.js +0 -26
  96. package/lib/operations/getCurrentUser.js.map +0 -1
  97. package/lib/operations/getDatabase.d.ts +0 -36
  98. package/lib/operations/getDatabase.d.ts.map +0 -1
  99. package/lib/operations/getDatabase.js +0 -44
  100. package/lib/operations/getDatabase.js.map +0 -1
  101. package/lib/operations/getDatabaseConfiguration.d.ts +0 -27
  102. package/lib/operations/getDatabaseConfiguration.d.ts.map +0 -1
  103. package/lib/operations/getDatabaseConfiguration.js +0 -37
  104. package/lib/operations/getDatabaseConfiguration.js.map +0 -1
  105. package/lib/operations/getDatabaseInstance.d.ts +0 -29
  106. package/lib/operations/getDatabaseInstance.d.ts.map +0 -1
  107. package/lib/operations/getDatabaseInstance.js +0 -39
  108. package/lib/operations/getDatabaseInstance.js.map +0 -1
  109. package/lib/operations/getDatabaseStats.d.ts +0 -25
  110. package/lib/operations/getDatabaseStats.d.ts.map +0 -1
  111. package/lib/operations/getDatabaseStats.js +0 -33
  112. package/lib/operations/getDatabaseStats.js.map +0 -1
  113. package/lib/operations/getDatabaseUsage.d.ts +0 -42
  114. package/lib/operations/getDatabaseUsage.d.ts.map +0 -1
  115. package/lib/operations/getDatabaseUsage.js +0 -50
  116. package/lib/operations/getDatabaseUsage.js.map +0 -1
  117. package/lib/operations/getGroup.d.ts +0 -28
  118. package/lib/operations/getGroup.d.ts.map +0 -1
  119. package/lib/operations/getGroup.js +0 -36
  120. package/lib/operations/getGroup.js.map +0 -1
  121. package/lib/operations/getGroupConfiguration.d.ts +0 -21
  122. package/lib/operations/getGroupConfiguration.d.ts.map +0 -1
  123. package/lib/operations/getGroupConfiguration.js +0 -31
  124. package/lib/operations/getGroupConfiguration.js.map +0 -1
  125. package/lib/operations/getOrganization.d.ts +0 -30
  126. package/lib/operations/getOrganization.d.ts.map +0 -1
  127. package/lib/operations/getOrganization.js +0 -35
  128. package/lib/operations/getOrganization.js.map +0 -1
  129. package/lib/operations/getOrganizationMember.d.ts +0 -25
  130. package/lib/operations/getOrganizationMember.d.ts.map +0 -1
  131. package/lib/operations/getOrganizationMember.js +0 -35
  132. package/lib/operations/getOrganizationMember.js.map +0 -1
  133. package/lib/operations/getOrganizationSubscription.d.ts +0 -23
  134. package/lib/operations/getOrganizationSubscription.d.ts.map +0 -1
  135. package/lib/operations/getOrganizationSubscription.js +0 -32
  136. package/lib/operations/getOrganizationSubscription.js.map +0 -1
  137. package/lib/operations/getOrganizationUsage.d.ts +0 -47
  138. package/lib/operations/getOrganizationUsage.d.ts.map +0 -1
  139. package/lib/operations/getOrganizationUsage.js +0 -56
  140. package/lib/operations/getOrganizationUsage.js.map +0 -1
  141. package/lib/operations/index.d.ts +0 -50
  142. package/lib/operations/index.d.ts.map +0 -1
  143. package/lib/operations/index.js +0 -50
  144. package/lib/operations/index.js.map +0 -1
  145. package/lib/operations/invalidateDatabaseTokens.d.ts +0 -19
  146. package/lib/operations/invalidateDatabaseTokens.d.ts.map +0 -1
  147. package/lib/operations/invalidateDatabaseTokens.js +0 -29
  148. package/lib/operations/invalidateDatabaseTokens.js.map +0 -1
  149. package/lib/operations/invalidateGroupTokens.d.ts +0 -19
  150. package/lib/operations/invalidateGroupTokens.d.ts.map +0 -1
  151. package/lib/operations/invalidateGroupTokens.js +0 -29
  152. package/lib/operations/invalidateGroupTokens.js.map +0 -1
  153. package/lib/operations/inviteOrganizationMember.d.ts +0 -69
  154. package/lib/operations/inviteOrganizationMember.d.ts.map +0 -1
  155. package/lib/operations/inviteOrganizationMember.js +0 -54
  156. package/lib/operations/inviteOrganizationMember.js.map +0 -1
  157. package/lib/operations/inviteOrganizationMemberV2.d.ts +0 -25
  158. package/lib/operations/inviteOrganizationMemberV2.d.ts.map +0 -1
  159. package/lib/operations/inviteOrganizationMemberV2.js +0 -34
  160. package/lib/operations/inviteOrganizationMemberV2.js.map +0 -1
  161. package/lib/operations/listAPITokens.d.ts +0 -22
  162. package/lib/operations/listAPITokens.d.ts.map +0 -1
  163. package/lib/operations/listAPITokens.js +0 -25
  164. package/lib/operations/listAPITokens.js.map +0 -1
  165. package/lib/operations/listDatabaseInstances.d.ts +0 -27
  166. package/lib/operations/listDatabaseInstances.d.ts.map +0 -1
  167. package/lib/operations/listDatabaseInstances.js +0 -37
  168. package/lib/operations/listDatabaseInstances.js.map +0 -1
  169. package/lib/operations/listDatabases.d.ts +0 -39
  170. package/lib/operations/listDatabases.d.ts.map +0 -1
  171. package/lib/operations/listDatabases.js +0 -46
  172. package/lib/operations/listDatabases.js.map +0 -1
  173. package/lib/operations/listGroups.d.ts +0 -25
  174. package/lib/operations/listGroups.d.ts.map +0 -1
  175. package/lib/operations/listGroups.js +0 -32
  176. package/lib/operations/listGroups.js.map +0 -1
  177. package/lib/operations/listLocations.d.ts +0 -15
  178. package/lib/operations/listLocations.d.ts.map +0 -1
  179. package/lib/operations/listLocations.js +0 -18
  180. package/lib/operations/listLocations.js.map +0 -1
  181. package/lib/operations/listOrganizationAPITokens.d.ts +0 -33
  182. package/lib/operations/listOrganizationAPITokens.d.ts.map +0 -1
  183. package/lib/operations/listOrganizationAPITokens.js +0 -42
  184. package/lib/operations/listOrganizationAPITokens.js.map +0 -1
  185. package/lib/operations/listOrganizationAuditLogs.d.ts +0 -35
  186. package/lib/operations/listOrganizationAuditLogs.d.ts.map +0 -1
  187. package/lib/operations/listOrganizationAuditLogs.js +0 -69
  188. package/lib/operations/listOrganizationAuditLogs.js.map +0 -1
  189. package/lib/operations/listOrganizationInvites.d.ts +0 -64
  190. package/lib/operations/listOrganizationInvites.d.ts.map +0 -1
  191. package/lib/operations/listOrganizationInvites.js +0 -50
  192. package/lib/operations/listOrganizationInvites.js.map +0 -1
  193. package/lib/operations/listOrganizationInvitesV2.d.ts +0 -23
  194. package/lib/operations/listOrganizationInvitesV2.d.ts.map +0 -1
  195. package/lib/operations/listOrganizationInvitesV2.js +0 -32
  196. package/lib/operations/listOrganizationInvitesV2.js.map +0 -1
  197. package/lib/operations/listOrganizationInvoices.d.ts +0 -27
  198. package/lib/operations/listOrganizationInvoices.d.ts.map +0 -1
  199. package/lib/operations/listOrganizationInvoices.js +0 -36
  200. package/lib/operations/listOrganizationInvoices.js.map +0 -1
  201. package/lib/operations/listOrganizationMembers.d.ts +0 -22
  202. package/lib/operations/listOrganizationMembers.d.ts.map +0 -1
  203. package/lib/operations/listOrganizationMembers.js +0 -31
  204. package/lib/operations/listOrganizationMembers.js.map +0 -1
  205. package/lib/operations/listOrganizationPlans.d.ts +0 -34
  206. package/lib/operations/listOrganizationPlans.d.ts.map +0 -1
  207. package/lib/operations/listOrganizationPlans.js +0 -43
  208. package/lib/operations/listOrganizationPlans.js.map +0 -1
  209. package/lib/operations/listOrganizations.d.ts +0 -24
  210. package/lib/operations/listOrganizations.d.ts.map +0 -1
  211. package/lib/operations/listOrganizations.js +0 -27
  212. package/lib/operations/listOrganizations.js.map +0 -1
  213. package/lib/operations/removeLocationFromGroup.d.ts +0 -30
  214. package/lib/operations/removeLocationFromGroup.d.ts.map +0 -1
  215. package/lib/operations/removeLocationFromGroup.js +0 -40
  216. package/lib/operations/removeLocationFromGroup.js.map +0 -1
  217. package/lib/operations/removeOrganizationMember.d.ts +0 -21
  218. package/lib/operations/removeOrganizationMember.d.ts.map +0 -1
  219. package/lib/operations/removeOrganizationMember.js +0 -31
  220. package/lib/operations/removeOrganizationMember.js.map +0 -1
  221. package/lib/operations/revokeAPIToken.d.ts +0 -19
  222. package/lib/operations/revokeAPIToken.d.ts.map +0 -1
  223. package/lib/operations/revokeAPIToken.js +0 -24
  224. package/lib/operations/revokeAPIToken.js.map +0 -1
  225. package/lib/operations/revokeOrganizationAPIToken.d.ts +0 -25
  226. package/lib/operations/revokeOrganizationAPIToken.d.ts.map +0 -1
  227. package/lib/operations/revokeOrganizationAPIToken.js +0 -34
  228. package/lib/operations/revokeOrganizationAPIToken.js.map +0 -1
  229. package/lib/operations/transferGroup.d.ts +0 -27
  230. package/lib/operations/transferGroup.d.ts.map +0 -1
  231. package/lib/operations/transferGroup.js +0 -35
  232. package/lib/operations/transferGroup.js.map +0 -1
  233. package/lib/operations/unarchiveGroup.d.ts +0 -28
  234. package/lib/operations/unarchiveGroup.d.ts.map +0 -1
  235. package/lib/operations/unarchiveGroup.js +0 -36
  236. package/lib/operations/unarchiveGroup.js.map +0 -1
  237. package/lib/operations/updateDatabaseConfiguration.d.ts +0 -34
  238. package/lib/operations/updateDatabaseConfiguration.d.ts.map +0 -1
  239. package/lib/operations/updateDatabaseConfiguration.js +0 -44
  240. package/lib/operations/updateDatabaseConfiguration.js.map +0 -1
  241. package/lib/operations/updateGroupConfiguration.d.ts +0 -22
  242. package/lib/operations/updateGroupConfiguration.d.ts.map +0 -1
  243. package/lib/operations/updateGroupConfiguration.js +0 -32
  244. package/lib/operations/updateGroupConfiguration.js.map +0 -1
  245. package/lib/operations/updateGroupDatabases.d.ts +0 -19
  246. package/lib/operations/updateGroupDatabases.d.ts.map +0 -1
  247. package/lib/operations/updateGroupDatabases.js +0 -29
  248. package/lib/operations/updateGroupDatabases.js.map +0 -1
  249. package/lib/operations/updateMemberRole.d.ts +0 -26
  250. package/lib/operations/updateMemberRole.d.ts.map +0 -1
  251. package/lib/operations/updateMemberRole.js +0 -34
  252. package/lib/operations/updateMemberRole.js.map +0 -1
  253. package/lib/operations/updateOrganization.d.ts +0 -31
  254. package/lib/operations/updateOrganization.d.ts.map +0 -1
  255. package/lib/operations/updateOrganization.js +0 -37
  256. package/lib/operations/updateOrganization.js.map +0 -1
  257. package/lib/operations/validateAPIToken.d.ts +0 -15
  258. package/lib/operations/validateAPIToken.d.ts.map +0 -1
  259. package/lib/operations/validateAPIToken.js +0 -18
  260. package/lib/operations/validateAPIToken.js.map +0 -1
  261. package/lib/sensitive.d.ts +0 -5
  262. package/lib/sensitive.d.ts.map +0 -1
  263. package/lib/sensitive.js +0 -5
  264. package/lib/sensitive.js.map +0 -1
  265. package/src/category.ts +0 -4
  266. package/src/client.ts +0 -74
  267. package/src/operations/addLocationToGroup.ts +0 -63
  268. package/src/operations/addOrganizationMember.ts +0 -49
  269. package/src/operations/createAPIToken.ts +0 -77
  270. package/src/operations/createDatabase.ts +0 -94
  271. package/src/operations/createDatabaseToken.ts +0 -62
  272. package/src/operations/createGroup.ts +0 -92
  273. package/src/operations/createGroupToken.ts +0 -58
  274. package/src/operations/deleteDatabase.ts +0 -42
  275. package/src/operations/deleteGroup.ts +0 -58
  276. package/src/operations/deleteOrganizationInviteByEmail.ts +0 -38
  277. package/src/operations/deleteOrganizationInviteByEmailV2.ts +0 -40
  278. package/src/operations/getCurrentUser.ts +0 -46
  279. package/src/operations/getDatabase.ts +0 -74
  280. package/src/operations/getDatabaseConfiguration.ts +0 -56
  281. package/src/operations/getDatabaseInstance.ts +0 -61
  282. package/src/operations/getDatabaseStats.ts +0 -54
  283. package/src/operations/getDatabaseUsage.ts +0 -92
  284. package/src/operations/getGroup.ts +0 -58
  285. package/src/operations/getGroupConfiguration.ts +0 -44
  286. package/src/operations/getOrganization.ts +0 -60
  287. package/src/operations/getOrganizationMember.ts +0 -56
  288. package/src/operations/getOrganizationSubscription.ts +0 -51
  289. package/src/operations/getOrganizationUsage.ts +0 -113
  290. package/src/operations/index.ts +0 -49
  291. package/src/operations/invalidateDatabaseTokens.ts +0 -40
  292. package/src/operations/invalidateGroupTokens.ts +0 -40
  293. package/src/operations/inviteOrganizationMember.ts +0 -66
  294. package/src/operations/inviteOrganizationMemberV2.ts +0 -55
  295. package/src/operations/listAPITokens.ts +0 -46
  296. package/src/operations/listDatabaseInstances.ts +0 -60
  297. package/src/operations/listDatabases.ts +0 -80
  298. package/src/operations/listGroups.ts +0 -55
  299. package/src/operations/listLocations.ts +0 -28
  300. package/src/operations/listOrganizationAPITokens.ts +0 -68
  301. package/src/operations/listOrganizationAuditLogs.ts +0 -128
  302. package/src/operations/listOrganizationInvites.ts +0 -64
  303. package/src/operations/listOrganizationInvitesV2.ts +0 -53
  304. package/src/operations/listOrganizationInvoices.ts +0 -60
  305. package/src/operations/listOrganizationMembers.ts +0 -53
  306. package/src/operations/listOrganizationPlans.ts +0 -78
  307. package/src/operations/listOrganizations.ts +0 -48
  308. package/src/operations/removeLocationFromGroup.ts +0 -63
  309. package/src/operations/removeOrganizationMember.ts +0 -44
  310. package/src/operations/revokeAPIToken.ts +0 -36
  311. package/src/operations/revokeOrganizationAPIToken.ts +0 -47
  312. package/src/operations/transferGroup.ts +0 -54
  313. package/src/operations/unarchiveGroup.ts +0 -58
  314. package/src/operations/updateDatabaseConfiguration.ts +0 -70
  315. package/src/operations/updateGroupConfiguration.ts +0 -46
  316. package/src/operations/updateGroupDatabases.ts +0 -40
  317. package/src/operations/updateMemberRole.ts +0 -54
  318. package/src/operations/updateOrganization.ts +0 -64
  319. package/src/operations/validateAPIToken.ts +0 -28
  320. package/src/sensitive.ts +0 -4
package/src/client.ts DELETED
@@ -1,74 +0,0 @@
1
- /**
2
- * Turso API Client.
3
- *
4
- * Wraps the shared REST client from sdk-core with Turso-specific
5
- * error matching and credential handling.
6
- */
7
- import * as Effect from "effect/Effect";
8
- import * as Redacted from "effect/Redacted";
9
- import * as Schema from "effect/Schema";
10
- import { makeAPI } from "@distilled.cloud/core/client";
11
- import { parseRetryAfterForStatus } from "@distilled.cloud/core/retry-after";
12
- import { Retry } from "./retry.ts";
13
- import {
14
- HTTP_STATUS_MAP,
15
- UnknownTursoError,
16
- TursoParseError,
17
- } from "./errors.ts";
18
-
19
- // Re-export for backwards compatibility
20
- export { UnknownTursoError } from "./errors.ts";
21
- import { Credentials } from "./credentials.ts";
22
-
23
- // API Error Response Schema
24
- // Turso returns { error: string, code?: string }
25
- const ApiErrorResponse = Schema.Struct({
26
- error: Schema.String,
27
- code: Schema.optional(Schema.String),
28
- });
29
-
30
- /**
31
- * Match a Turso API error response to the appropriate error class based on HTTP status.
32
- */
33
- const matchError = (
34
- status: number,
35
- errorBody: unknown,
36
- _errors?: readonly unknown[],
37
- headers?: Record<string, string | undefined>,
38
- ): Effect.Effect<never, unknown> => {
39
- try {
40
- const parsed = Schema.decodeUnknownSync(ApiErrorResponse)(errorBody);
41
- const ErrorClass = (HTTP_STATUS_MAP as any)[status];
42
- if (ErrorClass) {
43
- return Effect.fail(
44
- new ErrorClass({
45
- message: parsed.error,
46
- retryAfter: parseRetryAfterForStatus(status, headers),
47
- }),
48
- );
49
- }
50
- return Effect.fail(
51
- new UnknownTursoError({
52
- code: parsed.code,
53
- message: parsed.error,
54
- body: errorBody,
55
- }),
56
- );
57
- } catch {
58
- return Effect.fail(new UnknownTursoError({ body: errorBody }));
59
- }
60
- };
61
-
62
- /**
63
- * Turso API client.
64
- */
65
- export const API = makeAPI<Credentials>({
66
- credentials: Credentials as any,
67
- getBaseUrl: (creds: any) => creds.apiBaseUrl,
68
- getAuthHeaders: (creds: any) => ({
69
- Authorization: `Bearer ${Redacted.value(creds.apiKey)}`,
70
- }),
71
- matchError,
72
- ParseError: TursoParseError as any,
73
- retry: Retry as any,
74
- });
@@ -1,63 +0,0 @@
1
- import * as Schema from "effect/Schema";
2
- import { API } from "../client.ts";
3
- import * as T from "../traits.ts";
4
- import { BadRequest, NotFound } from "../errors.ts";
5
-
6
- // Input Schema
7
- export interface AddLocationToGroupInput {
8
- organizationSlug: string;
9
- groupName: string;
10
- location: string;
11
- }
12
- export const AddLocationToGroupInput =
13
- /*@__PURE__*/ Schema.Struct({
14
- organizationSlug: Schema.String.pipe(T.PathParam()),
15
- groupName: Schema.String.pipe(T.PathParam()),
16
- location: Schema.String.pipe(T.PathParam()),
17
- }).pipe(
18
- T.Http({
19
- method: "POST",
20
- path: "/v1/organizations/{organizationSlug}/groups/{groupName}/locations/{location}",
21
- }),
22
- ) as unknown as Schema.Codec<AddLocationToGroupInput>;
23
-
24
- // Output Schema
25
- export interface AddLocationToGroupOutput {
26
- group?: {
27
- name?: string;
28
- version?: string;
29
- uuid?: string;
30
- locations?: string[];
31
- primary?: string;
32
- delete_protection?: boolean;
33
- };
34
- }
35
- export const AddLocationToGroupOutput =
36
- /*@__PURE__*/ Schema.Struct({
37
- group: Schema.optional(
38
- Schema.Struct({
39
- name: Schema.optional(Schema.String),
40
- version: Schema.optional(Schema.String),
41
- uuid: Schema.optional(Schema.String),
42
- locations: Schema.optional(Schema.Array(Schema.String)),
43
- primary: Schema.optional(Schema.String),
44
- delete_protection: Schema.optional(Schema.Boolean),
45
- }),
46
- ),
47
- }) as unknown as Schema.Codec<AddLocationToGroupOutput>;
48
-
49
- // The operation
50
- /**
51
- * Add Location to Group
52
- *
53
- * Adds a location to the specified group.
54
- *
55
- * @param organizationSlug - The slug of the organization or user account.
56
- * @param groupName - The name of the group.
57
- * @param location - The location code to add to the group.
58
- */
59
- export const addLocationToGroup = /*@__PURE__*/ API.make(() => ({
60
- inputSchema: AddLocationToGroupInput,
61
- outputSchema: AddLocationToGroupOutput,
62
- errors: [BadRequest, NotFound] as const,
63
- }));
@@ -1,49 +0,0 @@
1
- import * as Schema from "effect/Schema";
2
- import { API } from "../client.ts";
3
- import * as T from "../traits.ts";
4
- import { BadRequest, NotFound, Conflict } from "../errors.ts";
5
-
6
- // Input Schema
7
- export interface AddOrganizationMemberInput {
8
- organizationSlug: string;
9
- username?: string;
10
- role?: "admin" | "member" | "viewer";
11
- }
12
- export const AddOrganizationMemberInput =
13
- /*@__PURE__*/ Schema.Struct({
14
- organizationSlug: Schema.String.pipe(T.PathParam()),
15
- username: Schema.optional(Schema.String),
16
- role: Schema.optional(Schema.Literals(["admin", "member", "viewer"])),
17
- }).pipe(
18
- T.Http({
19
- method: "POST",
20
- path: "/v1/organizations/{organizationSlug}/members",
21
- }),
22
- ) as unknown as Schema.Codec<AddOrganizationMemberInput>;
23
-
24
- // Output Schema
25
- export interface AddOrganizationMemberOutput {
26
- member?: string;
27
- role?: "owner" | "admin" | "member" | "viewer";
28
- }
29
- export const AddOrganizationMemberOutput =
30
- /*@__PURE__*/ Schema.Struct({
31
- member: Schema.optional(Schema.String),
32
- role: Schema.optional(
33
- Schema.Literals(["owner", "admin", "member", "viewer"]),
34
- ),
35
- }) as unknown as Schema.Codec<AddOrganizationMemberOutput>;
36
-
37
- // The operation
38
- /**
39
- * Add Member
40
- *
41
- * Add an existing Turso user to an organization.
42
- *
43
- * @param organizationSlug - The slug of the organization or user account.
44
- */
45
- export const addOrganizationMember = /*@__PURE__*/ API.make(() => ({
46
- inputSchema: AddOrganizationMemberInput,
47
- outputSchema: AddOrganizationMemberOutput,
48
- errors: [BadRequest, NotFound, Conflict] as const,
49
- }));
@@ -1,77 +0,0 @@
1
- import * as Schema from "effect/Schema";
2
- import { API } from "../client.ts";
3
- import * as T from "../traits.ts";
4
-
5
- // Input Schema
6
- export interface CreateAPITokenInput {
7
- tokenName: string;
8
- organization?: string;
9
- group?: string;
10
- scopes?: (
11
- | "read"
12
- | "db:create"
13
- | "db:delete"
14
- | "db:configure"
15
- | "db:mint-token"
16
- | "db:rotate-creds"
17
- | "group:configure"
18
- | "group:mint-token"
19
- | "group:rotate-creds"
20
- | "read-only"
21
- | "full-access"
22
- )[];
23
- }
24
- export const CreateAPITokenInput = /*@__PURE__*/ Schema.Struct({
25
- tokenName: Schema.String.pipe(T.PathParam()),
26
- organization: Schema.optional(Schema.String),
27
- group: Schema.optional(Schema.String),
28
- scopes: Schema.optional(
29
- Schema.Array(
30
- Schema.Literals([
31
- "read",
32
- "db:create",
33
- "db:delete",
34
- "db:configure",
35
- "db:mint-token",
36
- "db:rotate-creds",
37
- "group:configure",
38
- "group:mint-token",
39
- "group:rotate-creds",
40
- "read-only",
41
- "full-access",
42
- ]),
43
- ),
44
- ),
45
- }).pipe(
46
- T.Http({ method: "POST", path: "/v1/auth/api-tokens/{tokenName}" }),
47
- ) as unknown as Schema.Codec<CreateAPITokenInput>;
48
-
49
- // Output Schema
50
- export interface CreateAPITokenOutput {
51
- name?: string;
52
- id?: string;
53
- token?: string;
54
- }
55
- export const CreateAPITokenOutput = /*@__PURE__*/ Schema.Struct({
56
- name: Schema.optional(Schema.String),
57
- id: Schema.optional(Schema.String),
58
- token: Schema.optional(Schema.String),
59
- }) as unknown as Schema.Codec<CreateAPITokenOutput>;
60
-
61
- // The operation
62
- /**
63
- * Create API Token
64
- *
65
- * Returns a new API token belonging to a user.
66
- * The token can be minted at three levels of restriction, in increasing order of narrowness:
67
- * - **Organization-scoped** — pass `organization`. The token can only act on resources inside that organization.
68
- * - **Group-scoped** — pass `organization`, `group`, and `scopes`. The token is pinned to a single group inside the organization and only the operations listed in `scopes` are allowed. The caller must be an admin or owner of the organization.
69
- * - **Unrestricted** *(deprecated)* — no request body. The token can act on every organization the caller belongs to. **Unrestricted tokens are deprecated and will be removed in a future release.** Always pass `organization` for new tokens and rotate existing unrestricted tokens to scoped tokens.
70
- * Group-scoped tokens are designed for automations that should be able to provision and manage databases inside a single group without being able to touch the rest of the organization.
71
- *
72
- * @param tokenName - The name of the api token.
73
- */
74
- export const createAPIToken = /*@__PURE__*/ API.make(() => ({
75
- inputSchema: CreateAPITokenInput,
76
- outputSchema: CreateAPITokenOutput,
77
- }));
@@ -1,94 +0,0 @@
1
- import * as Schema from "effect/Schema";
2
- import { API } from "../client.ts";
3
- import * as T from "../traits.ts";
4
- import { BadRequest, Conflict } from "../errors.ts";
5
-
6
- // Input Schema
7
- export interface CreateDatabaseInput {
8
- organizationSlug: string;
9
- name: string;
10
- group: string;
11
- seed?: {
12
- type?: "database" | "database_upload";
13
- name?: string;
14
- timestamp?: string;
15
- };
16
- size_limit?: string;
17
- remote_encryption?: {
18
- encryption_key?: string;
19
- encryption_cipher?:
20
- | "aes256gcm"
21
- | "aes128gcm"
22
- | "chacha20poly1305"
23
- | "aegis128l"
24
- | "aegis128x2"
25
- | "aegis128x4"
26
- | "aegis256"
27
- | "aegis256x2"
28
- | "aegis256x4";
29
- };
30
- }
31
- export const CreateDatabaseInput = /*@__PURE__*/ Schema.Struct({
32
- organizationSlug: Schema.String.pipe(T.PathParam()),
33
- name: Schema.String,
34
- group: Schema.String,
35
- seed: Schema.optional(
36
- Schema.Struct({
37
- type: Schema.optional(Schema.Literals(["database", "database_upload"])),
38
- name: Schema.optional(Schema.String),
39
- timestamp: Schema.optional(Schema.String),
40
- }),
41
- ),
42
- size_limit: Schema.optional(Schema.String),
43
- remote_encryption: Schema.optional(
44
- Schema.Struct({
45
- encryption_key: Schema.optional(Schema.String),
46
- encryption_cipher: Schema.optional(
47
- Schema.Literals([
48
- "aes256gcm",
49
- "aes128gcm",
50
- "chacha20poly1305",
51
- "aegis128l",
52
- "aegis128x2",
53
- "aegis128x4",
54
- "aegis256",
55
- "aegis256x2",
56
- "aegis256x4",
57
- ]),
58
- ),
59
- }),
60
- ),
61
- }).pipe(
62
- T.Http({
63
- method: "POST",
64
- path: "/v1/organizations/{organizationSlug}/databases",
65
- }),
66
- ) as unknown as Schema.Codec<CreateDatabaseInput>;
67
-
68
- // Output Schema
69
- export interface CreateDatabaseOutput {
70
- database?: { DbId?: string; Hostname?: string; Name?: string };
71
- }
72
- export const CreateDatabaseOutput = /*@__PURE__*/ Schema.Struct({
73
- database: Schema.optional(
74
- Schema.Struct({
75
- DbId: Schema.optional(Schema.String),
76
- Hostname: Schema.optional(Schema.String),
77
- Name: Schema.optional(Schema.String),
78
- }),
79
- ),
80
- }) as unknown as Schema.Codec<CreateDatabaseOutput>;
81
-
82
- // The operation
83
- /**
84
- * Create Database
85
- *
86
- * Creates a new database in a group for the organization or user.
87
- *
88
- * @param organizationSlug - The slug of the organization or user account.
89
- */
90
- export const createDatabase = /*@__PURE__*/ API.make(() => ({
91
- inputSchema: CreateDatabaseInput,
92
- outputSchema: CreateDatabaseOutput,
93
- errors: [BadRequest, Conflict] as const,
94
- }));
@@ -1,62 +0,0 @@
1
- import * as Schema from "effect/Schema";
2
- import { API } from "../client.ts";
3
- import * as T from "../traits.ts";
4
- import { BadRequest, NotFound } from "../errors.ts";
5
-
6
- // Input Schema
7
- export interface CreateDatabaseTokenInput {
8
- organizationSlug: string;
9
- databaseName: string;
10
- expiration?: string;
11
- authorization?: "full-access" | "read-only";
12
- permissions?: { read_attach?: { databases?: string[] } };
13
- }
14
- export const CreateDatabaseTokenInput =
15
- /*@__PURE__*/ Schema.Struct({
16
- organizationSlug: Schema.String.pipe(T.PathParam()),
17
- databaseName: Schema.String.pipe(T.PathParam()),
18
- expiration: Schema.optional(Schema.String),
19
- authorization: Schema.optional(
20
- Schema.Literals(["full-access", "read-only"]),
21
- ),
22
- permissions: Schema.optional(
23
- Schema.Struct({
24
- read_attach: Schema.optional(
25
- Schema.Struct({
26
- databases: Schema.optional(Schema.Array(Schema.String)),
27
- }),
28
- ),
29
- }),
30
- ),
31
- }).pipe(
32
- T.Http({
33
- method: "POST",
34
- path: "/v1/organizations/{organizationSlug}/databases/{databaseName}/auth/tokens",
35
- }),
36
- ) as unknown as Schema.Codec<CreateDatabaseTokenInput>;
37
-
38
- // Output Schema
39
- export interface CreateDatabaseTokenOutput {
40
- jwt?: string;
41
- }
42
- export const CreateDatabaseTokenOutput =
43
- /*@__PURE__*/ Schema.Struct({
44
- jwt: Schema.optional(Schema.String),
45
- }) as unknown as Schema.Codec<CreateDatabaseTokenOutput>;
46
-
47
- // The operation
48
- /**
49
- * Generate Database Auth Token
50
- *
51
- * Generates an authorization token for the specified database.
52
- *
53
- * @param organizationSlug - The slug of the organization or user account.
54
- * @param databaseName - The name of the database.
55
- * @param expiration - Expiration time for the token (e.g., 2w1d30m).
56
- * @param authorization - Authorization level for the token (full-access or read-only).
57
- */
58
- export const createDatabaseToken = /*@__PURE__*/ API.make(() => ({
59
- inputSchema: CreateDatabaseTokenInput,
60
- outputSchema: CreateDatabaseTokenOutput,
61
- errors: [BadRequest, NotFound] as const,
62
- }));
@@ -1,92 +0,0 @@
1
- import * as Schema from "effect/Schema";
2
- import { API } from "../client.ts";
3
- import * as T from "../traits.ts";
4
- import { BadRequest, Conflict } from "../errors.ts";
5
-
6
- // Input Schema
7
- export interface CreateGroupInput {
8
- organizationSlug: string;
9
- name: string;
10
- location: string;
11
- extensions?:
12
- | "all"
13
- | (
14
- | "vector"
15
- | "crypto"
16
- | "fuzzy"
17
- | "math"
18
- | "stats"
19
- | "text"
20
- | "unicode"
21
- | "uuid"
22
- | "regexp"
23
- | "vec"
24
- )[];
25
- }
26
- export const CreateGroupInput = /*@__PURE__*/ Schema.Struct({
27
- organizationSlug: Schema.String.pipe(T.PathParam()),
28
- name: Schema.String,
29
- location: Schema.String,
30
- extensions: Schema.optional(
31
- Schema.Union([
32
- Schema.Literals(["all"]),
33
- Schema.Array(
34
- Schema.Literals([
35
- "vector",
36
- "crypto",
37
- "fuzzy",
38
- "math",
39
- "stats",
40
- "text",
41
- "unicode",
42
- "uuid",
43
- "regexp",
44
- "vec",
45
- ]),
46
- ),
47
- ]),
48
- ),
49
- }).pipe(
50
- T.Http({
51
- method: "POST",
52
- path: "/v1/organizations/{organizationSlug}/groups",
53
- }),
54
- ) as unknown as Schema.Codec<CreateGroupInput>;
55
-
56
- // Output Schema
57
- export interface CreateGroupOutput {
58
- group?: {
59
- name?: string;
60
- version?: string;
61
- uuid?: string;
62
- locations?: string[];
63
- primary?: string;
64
- delete_protection?: boolean;
65
- };
66
- }
67
- export const CreateGroupOutput = /*@__PURE__*/ Schema.Struct({
68
- group: Schema.optional(
69
- Schema.Struct({
70
- name: Schema.optional(Schema.String),
71
- version: Schema.optional(Schema.String),
72
- uuid: Schema.optional(Schema.String),
73
- locations: Schema.optional(Schema.Array(Schema.String)),
74
- primary: Schema.optional(Schema.String),
75
- delete_protection: Schema.optional(Schema.Boolean),
76
- }),
77
- ),
78
- }) as unknown as Schema.Codec<CreateGroupOutput>;
79
-
80
- // The operation
81
- /**
82
- * Create Group
83
- *
84
- * Creates a new group for the organization or user.
85
- *
86
- * @param organizationSlug - The slug of the organization or user account.
87
- */
88
- export const createGroup = /*@__PURE__*/ API.make(() => ({
89
- inputSchema: CreateGroupInput,
90
- outputSchema: CreateGroupOutput,
91
- errors: [BadRequest, Conflict] as const,
92
- }));
@@ -1,58 +0,0 @@
1
- import * as Schema from "effect/Schema";
2
- import { API } from "../client.ts";
3
- import * as T from "../traits.ts";
4
- import { BadRequest, NotFound } from "../errors.ts";
5
-
6
- // Input Schema
7
- export interface CreateGroupTokenInput {
8
- organizationSlug: string;
9
- groupName: string;
10
- expiration?: string;
11
- authorization?: "full-access" | "read-only";
12
- permissions?: { read_attach?: { databases?: string[] } };
13
- }
14
- export const CreateGroupTokenInput = /*@__PURE__*/ Schema.Struct({
15
- organizationSlug: Schema.String.pipe(T.PathParam()),
16
- groupName: Schema.String.pipe(T.PathParam()),
17
- expiration: Schema.optional(Schema.String),
18
- authorization: Schema.optional(Schema.Literals(["full-access", "read-only"])),
19
- permissions: Schema.optional(
20
- Schema.Struct({
21
- read_attach: Schema.optional(
22
- Schema.Struct({
23
- databases: Schema.optional(Schema.Array(Schema.String)),
24
- }),
25
- ),
26
- }),
27
- ),
28
- }).pipe(
29
- T.Http({
30
- method: "POST",
31
- path: "/v1/organizations/{organizationSlug}/groups/{groupName}/auth/tokens",
32
- }),
33
- ) as unknown as Schema.Codec<CreateGroupTokenInput>;
34
-
35
- // Output Schema
36
- export interface CreateGroupTokenOutput {
37
- jwt?: string;
38
- }
39
- export const CreateGroupTokenOutput = /*@__PURE__*/ Schema.Struct({
40
- jwt: Schema.optional(Schema.String),
41
- }) as unknown as Schema.Codec<CreateGroupTokenOutput>;
42
-
43
- // The operation
44
- /**
45
- * Create Group Auth Token
46
- *
47
- * Generates an authorization token for the specified group.
48
- *
49
- * @param organizationSlug - The slug of the organization or user account.
50
- * @param groupName - The name of the group.
51
- * @param expiration - Expiration time for the token (e.g., 2w1d30m).
52
- * @param authorization - Authorization level for the token (full-access or read-only).
53
- */
54
- export const createGroupToken = /*@__PURE__*/ API.make(() => ({
55
- inputSchema: CreateGroupTokenInput,
56
- outputSchema: CreateGroupTokenOutput,
57
- errors: [BadRequest, NotFound] as const,
58
- }));
@@ -1,42 +0,0 @@
1
- import * as Schema from "effect/Schema";
2
- import { API } from "../client.ts";
3
- import * as T from "../traits.ts";
4
- import { NotFound } from "../errors.ts";
5
-
6
- // Input Schema
7
- export interface DeleteDatabaseInput {
8
- organizationSlug: string;
9
- databaseName: string;
10
- }
11
- export const DeleteDatabaseInput = /*@__PURE__*/ Schema.Struct({
12
- organizationSlug: Schema.String.pipe(T.PathParam()),
13
- databaseName: Schema.String.pipe(T.PathParam()),
14
- }).pipe(
15
- T.Http({
16
- method: "DELETE",
17
- path: "/v1/organizations/{organizationSlug}/databases/{databaseName}",
18
- }),
19
- ) as unknown as Schema.Codec<DeleteDatabaseInput>;
20
-
21
- // Output Schema
22
- export interface DeleteDatabaseOutput {
23
- database?: string;
24
- }
25
- export const DeleteDatabaseOutput = /*@__PURE__*/ Schema.Struct({
26
- database: Schema.optional(Schema.String),
27
- }) as unknown as Schema.Codec<DeleteDatabaseOutput>;
28
-
29
- // The operation
30
- /**
31
- * Delete Database
32
- *
33
- * Delete a database belonging to the organization or user.
34
- *
35
- * @param organizationSlug - The slug of the organization or user account.
36
- * @param databaseName - The name of the database.
37
- */
38
- export const deleteDatabase = /*@__PURE__*/ API.make(() => ({
39
- inputSchema: DeleteDatabaseInput,
40
- outputSchema: DeleteDatabaseOutput,
41
- errors: [NotFound] as const,
42
- }));
@@ -1,58 +0,0 @@
1
- import * as Schema from "effect/Schema";
2
- import { API } from "../client.ts";
3
- import * as T from "../traits.ts";
4
- import { NotFound } from "../errors.ts";
5
-
6
- // Input Schema
7
- export interface DeleteGroupInput {
8
- organizationSlug: string;
9
- groupName: string;
10
- }
11
- export const DeleteGroupInput = /*@__PURE__*/ Schema.Struct({
12
- organizationSlug: Schema.String.pipe(T.PathParam()),
13
- groupName: Schema.String.pipe(T.PathParam()),
14
- }).pipe(
15
- T.Http({
16
- method: "DELETE",
17
- path: "/v1/organizations/{organizationSlug}/groups/{groupName}",
18
- }),
19
- ) as unknown as Schema.Codec<DeleteGroupInput>;
20
-
21
- // Output Schema
22
- export interface DeleteGroupOutput {
23
- group?: {
24
- name?: string;
25
- version?: string;
26
- uuid?: string;
27
- locations?: string[];
28
- primary?: string;
29
- delete_protection?: boolean;
30
- };
31
- }
32
- export const DeleteGroupOutput = /*@__PURE__*/ Schema.Struct({
33
- group: Schema.optional(
34
- Schema.Struct({
35
- name: Schema.optional(Schema.String),
36
- version: Schema.optional(Schema.String),
37
- uuid: Schema.optional(Schema.String),
38
- locations: Schema.optional(Schema.Array(Schema.String)),
39
- primary: Schema.optional(Schema.String),
40
- delete_protection: Schema.optional(Schema.Boolean),
41
- }),
42
- ),
43
- }) as unknown as Schema.Codec<DeleteGroupOutput>;
44
-
45
- // The operation
46
- /**
47
- * Delete Group
48
- *
49
- * Delete a group belonging to the organization or user.
50
- *
51
- * @param organizationSlug - The slug of the organization or user account.
52
- * @param groupName - The name of the group.
53
- */
54
- export const deleteGroup = /*@__PURE__*/ API.make(() => ({
55
- inputSchema: DeleteGroupInput,
56
- outputSchema: DeleteGroupOutput,
57
- errors: [NotFound] as const,
58
- }));