@distilled.cloud/cloudflare 0.12.3 → 0.12.4

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 (41) hide show
  1. package/lib/services/accounts.d.ts +52 -52
  2. package/lib/services/accounts.d.ts.map +1 -1
  3. package/lib/services/accounts.js +1533 -569
  4. package/lib/services/accounts.js.map +1 -1
  5. package/lib/services/d1.d.ts +7 -1
  6. package/lib/services/d1.d.ts.map +1 -1
  7. package/lib/services/d1.js +4 -1
  8. package/lib/services/d1.js.map +1 -1
  9. package/lib/services/pipelines.d.ts +35 -5
  10. package/lib/services/pipelines.d.ts.map +1 -1
  11. package/lib/services/pipelines.js +25 -6
  12. package/lib/services/pipelines.js.map +1 -1
  13. package/lib/services/queues.d.ts +14 -14
  14. package/lib/services/queues.d.ts.map +1 -1
  15. package/lib/services/queues.js +1192 -413
  16. package/lib/services/queues.js.map +1 -1
  17. package/lib/services/r2.d.ts +32 -32
  18. package/lib/services/r2.d.ts.map +1 -1
  19. package/lib/services/r2.js +873 -391
  20. package/lib/services/r2.js.map +1 -1
  21. package/lib/services/user.d.ts +36 -5
  22. package/lib/services/user.d.ts.map +1 -1
  23. package/lib/services/user.js +32 -5
  24. package/lib/services/user.js.map +1 -1
  25. package/lib/services/workers.d.ts +7 -1
  26. package/lib/services/workers.d.ts.map +1 -1
  27. package/lib/services/workers.js +4 -1
  28. package/lib/services/workers.js.map +1 -1
  29. package/lib/services/workflows.d.ts +8 -2
  30. package/lib/services/workflows.d.ts.map +1 -1
  31. package/lib/services/workflows.js +5 -2
  32. package/lib/services/workflows.js.map +1 -1
  33. package/package.json +2 -2
  34. package/src/services/accounts.ts +3546 -1036
  35. package/src/services/d1.ts +9 -2
  36. package/src/services/pipelines.ts +56 -11
  37. package/src/services/queues.ts +2978 -829
  38. package/src/services/r2.ts +2232 -848
  39. package/src/services/user.ts +66 -10
  40. package/src/services/workers.ts +11 -2
  41. package/src/services/workflows.ts +10 -2
@@ -12,6 +12,44 @@ import * as T from "../traits.ts";
12
12
  import type { Credentials } from "../credentials.ts";
13
13
  import { type DefaultErrors } from "../errors.ts";
14
14
 
15
+ // =============================================================================
16
+ // Errors
17
+ // =============================================================================
18
+
19
+ export class InvalidRoute extends Schema.TaggedErrorClass<InvalidRoute>()(
20
+ "InvalidRoute",
21
+ { code: Schema.Number, message: Schema.String },
22
+ ) {}
23
+ T.applyErrorMatchers(InvalidRoute, [{ code: 7003 }]);
24
+
25
+ export class InvalidTokenName extends Schema.TaggedErrorClass<InvalidTokenName>()(
26
+ "InvalidTokenName",
27
+ { code: Schema.Number, message: Schema.String },
28
+ ) {}
29
+ T.applyErrorMatchers(InvalidTokenName, [
30
+ { code: 400, message: { includes: "name must have a length" } },
31
+ ]);
32
+
33
+ export class MethodNotAllowed extends Schema.TaggedErrorClass<MethodNotAllowed>()(
34
+ "MethodNotAllowed",
35
+ { code: Schema.Number, message: Schema.String },
36
+ ) {}
37
+ T.applyErrorMatchers(MethodNotAllowed, [{ code: 7001 }]);
38
+
39
+ export class PermissionGroupNotFound extends Schema.TaggedErrorClass<PermissionGroupNotFound>()(
40
+ "PermissionGroupNotFound",
41
+ { code: Schema.Number, message: Schema.String },
42
+ ) {}
43
+ T.applyErrorMatchers(PermissionGroupNotFound, [
44
+ { code: 1001, message: { includes: "Permission group" } },
45
+ ]);
46
+
47
+ export class TokenNotFound extends Schema.TaggedErrorClass<TokenNotFound>()(
48
+ "TokenNotFound",
49
+ { code: Schema.Number, message: Schema.String },
50
+ ) {}
51
+ T.applyErrorMatchers(TokenNotFound, [{ code: 1003 }]);
52
+
15
53
  // =============================================================================
16
54
  // AuditLog
17
55
  // =============================================================================
@@ -1260,7 +1298,7 @@ export const GetTokenResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
1260
1298
  )
1261
1299
  .pipe(T.ResponsePath("result")) as unknown as Schema.Schema<GetTokenResponse>;
1262
1300
 
1263
- export type GetTokenError = DefaultErrors;
1301
+ export type GetTokenError = DefaultErrors | InvalidRoute | TokenNotFound;
1264
1302
 
1265
1303
  export const getToken: API.OperationMethod<
1266
1304
  GetTokenRequest,
@@ -1270,7 +1308,7 @@ export const getToken: API.OperationMethod<
1270
1308
  > = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
1271
1309
  input: GetTokenRequest,
1272
1310
  output: GetTokenResponse,
1273
- errors: [],
1311
+ errors: [InvalidRoute, TokenNotFound],
1274
1312
  }));
1275
1313
 
1276
1314
  export interface ListTokensRequest {}
@@ -1637,7 +1675,11 @@ export const CreateTokenResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
1637
1675
  T.ResponsePath("result"),
1638
1676
  ) as unknown as Schema.Schema<CreateTokenResponse>;
1639
1677
 
1640
- export type CreateTokenError = DefaultErrors;
1678
+ export type CreateTokenError =
1679
+ | DefaultErrors
1680
+ | InvalidRoute
1681
+ | InvalidTokenName
1682
+ | PermissionGroupNotFound;
1641
1683
 
1642
1684
  export const createToken: API.OperationMethod<
1643
1685
  CreateTokenRequest,
@@ -1647,7 +1689,7 @@ export const createToken: API.OperationMethod<
1647
1689
  > = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
1648
1690
  input: CreateTokenRequest,
1649
1691
  output: CreateTokenResponse,
1650
- errors: [],
1692
+ errors: [InvalidRoute, InvalidTokenName, PermissionGroupNotFound],
1651
1693
  }));
1652
1694
 
1653
1695
  export interface UpdateTokenRequest {
@@ -1846,7 +1888,12 @@ export const UpdateTokenResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
1846
1888
  T.ResponsePath("result"),
1847
1889
  ) as unknown as Schema.Schema<UpdateTokenResponse>;
1848
1890
 
1849
- export type UpdateTokenError = DefaultErrors;
1891
+ export type UpdateTokenError =
1892
+ | DefaultErrors
1893
+ | InvalidRoute
1894
+ | MethodNotAllowed
1895
+ | TokenNotFound
1896
+ | PermissionGroupNotFound;
1850
1897
 
1851
1898
  export const updateToken: API.OperationMethod<
1852
1899
  UpdateTokenRequest,
@@ -1856,7 +1903,12 @@ export const updateToken: API.OperationMethod<
1856
1903
  > = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
1857
1904
  input: UpdateTokenRequest,
1858
1905
  output: UpdateTokenResponse,
1859
- errors: [],
1906
+ errors: [
1907
+ InvalidRoute,
1908
+ MethodNotAllowed,
1909
+ TokenNotFound,
1910
+ PermissionGroupNotFound,
1911
+ ],
1860
1912
  }));
1861
1913
 
1862
1914
  export interface DeleteTokenRequest {
@@ -1880,7 +1932,11 @@ export const DeleteTokenResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
1880
1932
  T.ResponsePath("result"),
1881
1933
  ) as unknown as Schema.Schema<DeleteTokenResponse>;
1882
1934
 
1883
- export type DeleteTokenError = DefaultErrors;
1935
+ export type DeleteTokenError =
1936
+ | DefaultErrors
1937
+ | InvalidRoute
1938
+ | MethodNotAllowed
1939
+ | TokenNotFound;
1884
1940
 
1885
1941
  export const deleteToken: API.OperationMethod<
1886
1942
  DeleteTokenRequest,
@@ -1890,7 +1946,7 @@ export const deleteToken: API.OperationMethod<
1890
1946
  > = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
1891
1947
  input: DeleteTokenRequest,
1892
1948
  output: DeleteTokenResponse,
1893
- errors: [],
1949
+ errors: [InvalidRoute, MethodNotAllowed, TokenNotFound],
1894
1950
  }));
1895
1951
 
1896
1952
  export interface VerifyTokenRequest {}
@@ -2030,7 +2086,7 @@ export const PutTokenValueResponse =
2030
2086
  T.ResponsePath("result"),
2031
2087
  ) as unknown as Schema.Schema<PutTokenValueResponse>;
2032
2088
 
2033
- export type PutTokenValueError = DefaultErrors;
2089
+ export type PutTokenValueError = DefaultErrors | InvalidRoute | TokenNotFound;
2034
2090
 
2035
2091
  export const putTokenValue: API.OperationMethod<
2036
2092
  PutTokenValueRequest,
@@ -2040,7 +2096,7 @@ export const putTokenValue: API.OperationMethod<
2040
2096
  > = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
2041
2097
  input: PutTokenValueRequest,
2042
2098
  output: PutTokenValueResponse,
2043
- errors: [],
2099
+ errors: [InvalidRoute, TokenNotFound],
2044
2100
  }));
2045
2101
 
2046
2102
  // =============================================================================
@@ -99,6 +99,12 @@ export class ServiceBindingConflict extends Schema.TaggedErrorClass<ServiceBindi
99
99
  ) {}
100
100
  T.applyErrorMatchers(ServiceBindingConflict, [{ code: 10142 }]);
101
101
 
102
+ export class SubdomainAlreadyExists extends Schema.TaggedErrorClass<SubdomainAlreadyExists>()(
103
+ "SubdomainAlreadyExists",
104
+ { code: Schema.Number, message: Schema.String },
105
+ ) {}
106
+ T.applyErrorMatchers(SubdomainAlreadyExists, [{ code: 10036 }]);
107
+
102
108
  export class VersionNotFound extends Schema.TaggedErrorClass<VersionNotFound>()(
103
109
  "VersionNotFound",
104
110
  { code: Schema.Number, message: Schema.String },
@@ -14834,7 +14840,10 @@ export const PutSubdomainResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
14834
14840
  T.ResponsePath("result"),
14835
14841
  ) as unknown as Schema.Schema<PutSubdomainResponse>;
14836
14842
 
14837
- export type PutSubdomainError = DefaultErrors | InvalidRoute;
14843
+ export type PutSubdomainError =
14844
+ | DefaultErrors
14845
+ | SubdomainAlreadyExists
14846
+ | InvalidRoute;
14838
14847
 
14839
14848
  export const putSubdomain: API.OperationMethod<
14840
14849
  PutSubdomainRequest,
@@ -14844,7 +14853,7 @@ export const putSubdomain: API.OperationMethod<
14844
14853
  > = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
14845
14854
  input: PutSubdomainRequest,
14846
14855
  output: PutSubdomainResponse,
14847
- errors: [InvalidRoute],
14856
+ errors: [SubdomainAlreadyExists, InvalidRoute],
14848
14857
  }));
14849
14858
 
14850
14859
  export interface DeleteSubdomainRequest {
@@ -16,6 +16,12 @@ import { type DefaultErrors } from "../errors.ts";
16
16
  // Errors
17
17
  // =============================================================================
18
18
 
19
+ export class InstanceAlreadyExists extends Schema.TaggedErrorClass<InstanceAlreadyExists>()(
20
+ "InstanceAlreadyExists",
21
+ { code: Schema.Number, message: Schema.String },
22
+ ) {}
23
+ T.applyErrorMatchers(InstanceAlreadyExists, [{ code: 10405 }]);
24
+
19
25
  export class InstanceCannotTerminate extends Schema.TaggedErrorClass<InstanceCannotTerminate>()(
20
26
  "InstanceCannotTerminate",
21
27
  { code: Schema.Number, message: Schema.String },
@@ -513,6 +519,7 @@ export const CreateInstanceResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct(
513
519
  export type CreateInstanceError =
514
520
  | DefaultErrors
515
521
  | WorkflowNotFound
522
+ | InstanceAlreadyExists
516
523
  | InvalidRoute
517
524
  | InvalidBody;
518
525
 
@@ -524,7 +531,7 @@ export const createInstance: API.OperationMethod<
524
531
  > = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
525
532
  input: CreateInstanceRequest,
526
533
  output: CreateInstanceResponse,
527
- errors: [WorkflowNotFound, InvalidRoute, InvalidBody],
534
+ errors: [WorkflowNotFound, InstanceAlreadyExists, InvalidRoute, InvalidBody],
528
535
  }));
529
536
 
530
537
  export interface BulkInstanceRequest {
@@ -628,6 +635,7 @@ export const BulkInstanceResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
628
635
  export type BulkInstanceError =
629
636
  | DefaultErrors
630
637
  | WorkflowNotFound
638
+ | InstanceAlreadyExists
631
639
  | InvalidRoute
632
640
  | InvalidBody;
633
641
 
@@ -639,7 +647,7 @@ export const bulkInstance: API.PaginatedOperationMethod<
639
647
  > = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
640
648
  input: BulkInstanceRequest,
641
649
  output: BulkInstanceResponse,
642
- errors: [WorkflowNotFound, InvalidRoute, InvalidBody],
650
+ errors: [WorkflowNotFound, InstanceAlreadyExists, InvalidRoute, InvalidBody],
643
651
  pagination: {
644
652
  mode: "single",
645
653
  items: "result",