@distilled.cloud/turso 1.0.0-rc.1 → 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.
- package/LICENSE +201 -0
- package/lib/credentials.js +1 -1
- package/lib/errors.js +2 -2
- package/lib/errors.js.map +1 -1
- package/lib/services/turso.d.ts +21 -5
- package/lib/services/turso.d.ts.map +1 -1
- package/lib/services/turso.js +30 -31
- package/lib/services/turso.js.map +1 -1
- package/package.json +15 -13
- package/src/credentials.ts +1 -1
- package/src/errors.ts +2 -2
- package/src/services/turso.ts +31 -32
package/src/services/turso.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// AUTO-GENERATED by scripts/generate.ts from .generated-specs. Do not edit.
|
|
2
2
|
import * as S from "@distilled.cloud/core/schema";
|
|
3
3
|
import * as API from "@distilled.cloud/core/api";
|
|
4
|
+
import * as C from "@distilled.cloud/core/category";
|
|
4
5
|
import * as T from "../traits.ts";
|
|
5
6
|
import {
|
|
6
7
|
TursoProtocol,
|
|
@@ -13,37 +14,37 @@ export type { TursoOpError, TursoOpContext };
|
|
|
13
14
|
|
|
14
15
|
export class BadRequest
|
|
15
16
|
extends /*@__PURE__*/ T.applyErrorMatchers(
|
|
16
|
-
/*@__PURE__*/ S.
|
|
17
|
+
/*@__PURE__*/ S.TaggedError<BadRequest>()("BadRequest", {
|
|
17
18
|
code: S.Number,
|
|
18
19
|
message: S.String,
|
|
19
|
-
}),
|
|
20
|
+
}).pipe(C.withBadRequestError),
|
|
20
21
|
[{ status: 400 }],
|
|
21
22
|
) {}
|
|
22
23
|
|
|
23
24
|
export class Conflict
|
|
24
25
|
extends /*@__PURE__*/ T.applyErrorMatchers(
|
|
25
|
-
/*@__PURE__*/ S.
|
|
26
|
+
/*@__PURE__*/ S.TaggedError<Conflict>()("Conflict", {
|
|
26
27
|
code: S.Number,
|
|
27
28
|
message: S.String,
|
|
28
|
-
}),
|
|
29
|
+
}).pipe(C.withConflictError),
|
|
29
30
|
[{ status: 409 }],
|
|
30
31
|
) {}
|
|
31
32
|
|
|
32
33
|
export class Forbidden
|
|
33
34
|
extends /*@__PURE__*/ T.applyErrorMatchers(
|
|
34
|
-
/*@__PURE__*/ S.
|
|
35
|
+
/*@__PURE__*/ S.TaggedError<Forbidden>()("Forbidden", {
|
|
35
36
|
code: S.Number,
|
|
36
37
|
message: S.String,
|
|
37
|
-
}),
|
|
38
|
+
}).pipe(C.withAuthError),
|
|
38
39
|
[{ status: 403 }],
|
|
39
40
|
) {}
|
|
40
41
|
|
|
41
42
|
export class NotFound
|
|
42
43
|
extends /*@__PURE__*/ T.applyErrorMatchers(
|
|
43
|
-
/*@__PURE__*/ S.
|
|
44
|
+
/*@__PURE__*/ S.TaggedError<NotFound>()("NotFound", {
|
|
44
45
|
code: S.Number,
|
|
45
46
|
message: S.String,
|
|
46
|
-
}),
|
|
47
|
+
}).pipe(C.withBadRequestError),
|
|
47
48
|
[{ status: 404 }],
|
|
48
49
|
) {}
|
|
49
50
|
|
|
@@ -116,7 +117,7 @@ export const AddLocationToGroupResponse = /*@__PURE__*/ S.suspend(() =>
|
|
|
116
117
|
|
|
117
118
|
/** The role given to the user. */
|
|
118
119
|
export type AddOrganizationMemberRequestRole = "admin" | "member" | "viewer";
|
|
119
|
-
export const AddOrganizationMemberRequestRole =
|
|
120
|
+
export const AddOrganizationMemberRequestRole = S.String;
|
|
120
121
|
|
|
121
122
|
export interface AddOrganizationMemberRequest {
|
|
122
123
|
/** The slug of the organization or user account. */
|
|
@@ -144,7 +145,7 @@ export const AddOrganizationMemberRequest = /*@__PURE__*/ S.suspend(() =>
|
|
|
144
145
|
|
|
145
146
|
/** The role assigned to the member. */
|
|
146
147
|
export type Role = "owner" | "admin" | "member" | "viewer";
|
|
147
|
-
export const Role =
|
|
148
|
+
export const Role = S.String;
|
|
148
149
|
|
|
149
150
|
export interface AddOrganizationMemberResponse {
|
|
150
151
|
member?: string;
|
|
@@ -171,7 +172,7 @@ export type CreateAPITokenRequestScopesItem =
|
|
|
171
172
|
| "group:rotate-creds"
|
|
172
173
|
| "read-only"
|
|
173
174
|
| "full-access";
|
|
174
|
-
export const CreateAPITokenRequestScopesItem =
|
|
175
|
+
export const CreateAPITokenRequestScopesItem = S.String;
|
|
175
176
|
|
|
176
177
|
/** Permissions to grant a group-scoped token. Each entry is either an individual scope or one of the presets `read-only` (expands to `read`) and `full-access` (expands to every scope). Required and must be non-empty when `group` is set. `db:mint-token` lets the token issue new SQL credentials; `db:rotate-creds` invalidates every existing SQL token for the database — they are deliberately separate because rotation is destructive. */
|
|
177
178
|
export type CreateAPITokenRequestScopesList = Array<
|
|
@@ -226,7 +227,7 @@ export const CreateAPITokenResponse = /*@__PURE__*/ S.suspend(() =>
|
|
|
226
227
|
|
|
227
228
|
/** The type of seed to be used to create a new database. Use `database` to copy from an existing database, or `database_upload` to [upload a SQLite database file](/api-reference/databases/upload). */
|
|
228
229
|
export type CreateDatabaseRequestSeedType = "database" | "database_upload";
|
|
229
|
-
export const CreateDatabaseRequestSeedType =
|
|
230
|
+
export const CreateDatabaseRequestSeedType = S.String;
|
|
230
231
|
|
|
231
232
|
export interface CreateDatabaseRequestSeed {
|
|
232
233
|
/** The type of seed to be used to create a new database. Use `database` to copy from an existing database, or `database_upload` to [upload a SQLite database file](/api-reference/databases/upload). */
|
|
@@ -257,8 +258,7 @@ export type CreateDatabaseRequestRemoteEncryptionEncryptionCipher =
|
|
|
257
258
|
| "aegis256"
|
|
258
259
|
| "aegis256x2"
|
|
259
260
|
| "aegis256x4";
|
|
260
|
-
export const CreateDatabaseRequestRemoteEncryptionEncryptionCipher =
|
|
261
|
-
/*@__PURE__*/ S.String;
|
|
261
|
+
export const CreateDatabaseRequestRemoteEncryptionEncryptionCipher = S.String;
|
|
262
262
|
|
|
263
263
|
/** Encryption configuration for the database. Can be used when creating a new encrypted database, creating a encrypted database from upload (`seed.type = "database_upload"`), or forking from an encrypted database (required when the source database is encrypted). */
|
|
264
264
|
export interface CreateDatabaseRequestRemoteEncryption {
|
|
@@ -343,7 +343,7 @@ export const CreateDatabaseResponse = /*@__PURE__*/ S.suspend(() =>
|
|
|
343
343
|
export type CreateDatabaseTokenRequestAuthorization =
|
|
344
344
|
| "full-access"
|
|
345
345
|
| "read-only";
|
|
346
|
-
export const CreateDatabaseTokenRequestAuthorization =
|
|
346
|
+
export const CreateDatabaseTokenRequestAuthorization = S.String;
|
|
347
347
|
|
|
348
348
|
export type CreateDatabaseTokenRequestPermissionsReadAttachDatabasesList =
|
|
349
349
|
Array<string>;
|
|
@@ -427,7 +427,7 @@ export const CreateDatabaseTokenResponse = /*@__PURE__*/ S.suspend(() =>
|
|
|
427
427
|
|
|
428
428
|
/** Set to `all` to enable all extensions. */
|
|
429
429
|
export type ExtensionsCase0 = "all";
|
|
430
|
-
export const ExtensionsCase0 =
|
|
430
|
+
export const ExtensionsCase0 = S.String;
|
|
431
431
|
|
|
432
432
|
export type ExtensionsCase1Item =
|
|
433
433
|
| "vector"
|
|
@@ -440,7 +440,7 @@ export type ExtensionsCase1Item =
|
|
|
440
440
|
| "uuid"
|
|
441
441
|
| "regexp"
|
|
442
442
|
| "vec";
|
|
443
|
-
export const ExtensionsCase1Item =
|
|
443
|
+
export const ExtensionsCase1Item = S.String;
|
|
444
444
|
|
|
445
445
|
/** Array of extensions to enable. */
|
|
446
446
|
export type ExtensionsCase1List = Array<ExtensionsCase1Item | (string & {})>;
|
|
@@ -450,8 +450,7 @@ export const ExtensionsCase1List = /*@__PURE__*/ S.Array(
|
|
|
450
450
|
|
|
451
451
|
/** The extensions to enable for new databases created in this group. Users looking to enable vector extensions should instead use the native [libSQL vector datatype](/features/ai-and-embeddings). */
|
|
452
452
|
export type Extensions = ExtensionsCase0 | ExtensionsCase1List;
|
|
453
|
-
export const Extensions =
|
|
454
|
-
/*@__PURE__*/ S.Unknown as any as S.Schema<Extensions>;
|
|
453
|
+
export const Extensions = S.Unknown as any as S.Schema<Extensions>;
|
|
455
454
|
|
|
456
455
|
export interface CreateGroupRequest {
|
|
457
456
|
/** The slug of the organization or user account. */
|
|
@@ -492,7 +491,7 @@ export const CreateGroupResponse = /*@__PURE__*/ S.suspend(() =>
|
|
|
492
491
|
}) as any as S.Schema<CreateGroupResponse>;
|
|
493
492
|
|
|
494
493
|
export type CreateGroupTokenRequestAuthorization = "full-access" | "read-only";
|
|
495
|
-
export const CreateGroupTokenRequestAuthorization =
|
|
494
|
+
export const CreateGroupTokenRequestAuthorization = S.String;
|
|
496
495
|
|
|
497
496
|
export type CreateGroupTokenRequestPermissionsReadAttachDatabasesList =
|
|
498
497
|
Array<string>;
|
|
@@ -896,7 +895,7 @@ export const GetDatabaseInstanceRequest = /*@__PURE__*/ S.suspend(() =>
|
|
|
896
895
|
|
|
897
896
|
/** The type of database instance this, will be `primary` or `replica`. */
|
|
898
897
|
export type InstanceType = "primary" | "replica";
|
|
899
|
-
export const InstanceType =
|
|
898
|
+
export const InstanceType = S.String;
|
|
900
899
|
|
|
901
900
|
export interface Instance {
|
|
902
901
|
/** The instance universal unique identifier (UUID). */
|
|
@@ -1172,7 +1171,7 @@ export const GetOrganizationRequest = /*@__PURE__*/ S.suspend(() =>
|
|
|
1172
1171
|
|
|
1173
1172
|
/** The type of account this organization is. Will always be `personal` or `team`. */
|
|
1174
1173
|
export type OrganizationType = "personal" | "team";
|
|
1175
|
-
export const OrganizationType =
|
|
1174
|
+
export const OrganizationType = S.String;
|
|
1176
1175
|
|
|
1177
1176
|
export interface Organization {
|
|
1178
1177
|
/** The organization name. Every user has a `personal` organization for their own account. */
|
|
@@ -1245,7 +1244,7 @@ export const GetOrganizationMemberRequest = /*@__PURE__*/ S.suspend(() =>
|
|
|
1245
1244
|
|
|
1246
1245
|
/** The role assigned to the member. */
|
|
1247
1246
|
export type MemberRole = "owner" | "admin" | "member" | "viewer";
|
|
1248
|
-
export const MemberRole =
|
|
1247
|
+
export const MemberRole = S.String;
|
|
1249
1248
|
|
|
1250
1249
|
export interface Member {
|
|
1251
1250
|
/** The username for the member. */
|
|
@@ -1478,7 +1477,7 @@ export type InviteOrganizationMemberV2RequestRole =
|
|
|
1478
1477
|
| "admin"
|
|
1479
1478
|
| "member"
|
|
1480
1479
|
| "viewer";
|
|
1481
|
-
export const InviteOrganizationMemberV2RequestRole =
|
|
1480
|
+
export const InviteOrganizationMemberV2RequestRole = S.String;
|
|
1482
1481
|
|
|
1483
1482
|
export interface InviteOrganizationMemberV2Request {
|
|
1484
1483
|
/** The slug of the organization or user account. */
|
|
@@ -1509,7 +1508,7 @@ export const InviteOrganizationMemberV2Request = /*@__PURE__*/ S.suspend(() =>
|
|
|
1509
1508
|
|
|
1510
1509
|
/** The assigned role for the invited user. */
|
|
1511
1510
|
export type InviteCreatedV2Role = "admin" | "member" | "viewer";
|
|
1512
|
-
export const InviteCreatedV2Role =
|
|
1511
|
+
export const InviteCreatedV2Role = S.String;
|
|
1513
1512
|
|
|
1514
1513
|
export interface InviteCreatedV2 {
|
|
1515
1514
|
/** The email of the person invited. */
|
|
@@ -1878,7 +1877,7 @@ export type AuditLogCode =
|
|
|
1878
1877
|
| "group-unprotect"
|
|
1879
1878
|
| "db-aunrchive"
|
|
1880
1879
|
| "user-delete";
|
|
1881
|
-
export const AuditLogCode =
|
|
1880
|
+
export const AuditLogCode = S.String;
|
|
1882
1881
|
|
|
1883
1882
|
export interface AuditLog {
|
|
1884
1883
|
/** The code associated to the action taken. */
|
|
@@ -1966,7 +1965,7 @@ export const ListOrganizationInvitesV2Request = /*@__PURE__*/ S.suspend(() =>
|
|
|
1966
1965
|
|
|
1967
1966
|
/** The assigned role for the invited user. */
|
|
1968
1967
|
export type InviteV2Role = "admin" | "member" | "viewer";
|
|
1969
|
-
export const InviteV2Role =
|
|
1968
|
+
export const InviteV2Role = S.String;
|
|
1970
1969
|
|
|
1971
1970
|
export interface InviteV2 {
|
|
1972
1971
|
/** The unique ID for the invite. */
|
|
@@ -2005,7 +2004,7 @@ export const ListOrganizationInvitesV2Response = /*@__PURE__*/ S.suspend(() =>
|
|
|
2005
2004
|
}) as any as S.Schema<ListOrganizationInvitesV2Response>;
|
|
2006
2005
|
|
|
2007
2006
|
export type ListOrganizationInvoicesRequestType = "all" | "upcoming" | "issued";
|
|
2008
|
-
export const ListOrganizationInvoicesRequestType =
|
|
2007
|
+
export const ListOrganizationInvoicesRequestType = S.String;
|
|
2009
2008
|
|
|
2010
2009
|
export interface ListOrganizationInvoicesRequest {
|
|
2011
2010
|
/** The slug of the organization or user account. */
|
|
@@ -2566,7 +2565,7 @@ export const UpdateGroupDatabasesResponse = /*@__PURE__*/ S.suspend(() =>
|
|
|
2566
2565
|
|
|
2567
2566
|
/** The new role to assign to the member. */
|
|
2568
2567
|
export type UpdateMemberRoleRequestRole = "admin" | "member" | "viewer";
|
|
2569
|
-
export const UpdateMemberRoleRequestRole =
|
|
2568
|
+
export const UpdateMemberRoleRequestRole = S.String;
|
|
2570
2569
|
|
|
2571
2570
|
export interface UpdateMemberRoleRequest {
|
|
2572
2571
|
/** The slug of the organization or user account. */
|
|
@@ -2594,7 +2593,7 @@ export const UpdateMemberRoleRequest = /*@__PURE__*/ S.suspend(() =>
|
|
|
2594
2593
|
|
|
2595
2594
|
/** The new role of the updated member. */
|
|
2596
2595
|
export type UpdateMemberRoleResponseMemberRole = "admin" | "member" | "viewer";
|
|
2597
|
-
export const UpdateMemberRoleResponseMemberRole =
|
|
2596
|
+
export const UpdateMemberRoleResponseMemberRole = S.String;
|
|
2598
2597
|
|
|
2599
2598
|
export interface UpdateMemberRoleResponseMember {
|
|
2600
2599
|
/** The username of the updated member. */
|
|
@@ -3046,7 +3045,7 @@ export const invalidateGroupTokens: API.OperationMethod<
|
|
|
3046
3045
|
retry: Retry.Retry,
|
|
3047
3046
|
}));
|
|
3048
3047
|
|
|
3049
|
-
export type InviteOrganizationMemberV2Error = TursoOpError;
|
|
3048
|
+
export type InviteOrganizationMemberV2Error = BadRequest | TursoOpError;
|
|
3050
3049
|
/** Invite Organization Member Invite a user to an organization. If the user isn't already registered with Turso, they will receive a signup link. If an existing pending invite exists for the same email, it will be replaced. */
|
|
3051
3050
|
export const inviteOrganizationMemberV2: API.OperationMethod<
|
|
3052
3051
|
InviteOrganizationMemberV2Request,
|
|
@@ -3056,7 +3055,7 @@ export const inviteOrganizationMemberV2: API.OperationMethod<
|
|
|
3056
3055
|
> = /*@__PURE__*/ API.make(() => ({
|
|
3057
3056
|
input: InviteOrganizationMemberV2Request,
|
|
3058
3057
|
output: InviteOrganizationMemberV2Response,
|
|
3059
|
-
errors: [],
|
|
3058
|
+
errors: [BadRequest],
|
|
3060
3059
|
protocol: TursoProtocol,
|
|
3061
3060
|
retry: Retry.Retry,
|
|
3062
3061
|
}));
|