@distilled.cloud/planetscale 0.8.0 → 0.10.0

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 (167) hide show
  1. package/lib/credentials.d.ts +2 -2
  2. package/lib/credentials.d.ts.map +1 -1
  3. package/lib/credentials.js +2 -2
  4. package/lib/credentials.js.map +1 -1
  5. package/lib/errors.d.ts +2 -2
  6. package/lib/operations/checkDeployRequestStorage.d.ts +32 -0
  7. package/lib/operations/checkDeployRequestStorage.d.ts.map +1 -0
  8. package/lib/operations/checkDeployRequestStorage.js +45 -0
  9. package/lib/operations/checkDeployRequestStorage.js.map +1 -0
  10. package/lib/operations/createBackup.d.ts +1 -0
  11. package/lib/operations/createBackup.d.ts.map +1 -1
  12. package/lib/operations/createBackup.js +1 -0
  13. package/lib/operations/createBackup.js.map +1 -1
  14. package/lib/operations/createBackupPolicy.d.ts +51 -0
  15. package/lib/operations/createBackupPolicy.d.ts.map +1 -0
  16. package/lib/operations/createBackupPolicy.js +64 -0
  17. package/lib/operations/createBackupPolicy.js.map +1 -0
  18. package/lib/operations/createBranch.d.ts +4 -0
  19. package/lib/operations/createBranch.d.ts.map +1 -1
  20. package/lib/operations/createBranch.js +4 -0
  21. package/lib/operations/createBranch.js.map +1 -1
  22. package/lib/operations/createDatabase.d.ts +4 -0
  23. package/lib/operations/createDatabase.d.ts.map +1 -1
  24. package/lib/operations/createDatabase.js +4 -0
  25. package/lib/operations/createDatabase.js.map +1 -1
  26. package/lib/operations/createTrafficBudget.d.ts +70 -0
  27. package/lib/operations/createTrafficBudget.d.ts.map +1 -0
  28. package/lib/operations/createTrafficBudget.js +83 -0
  29. package/lib/operations/createTrafficBudget.js.map +1 -0
  30. package/lib/operations/createTrafficRule.d.ts +47 -0
  31. package/lib/operations/createTrafficRule.d.ts.map +1 -0
  32. package/lib/operations/createTrafficRule.js +59 -0
  33. package/lib/operations/createTrafficRule.js.map +1 -0
  34. package/lib/operations/deleteBackupPolicy.d.ts +18 -0
  35. package/lib/operations/deleteBackupPolicy.d.ts.map +1 -0
  36. package/lib/operations/deleteBackupPolicy.js +30 -0
  37. package/lib/operations/deleteBackupPolicy.js.map +1 -0
  38. package/lib/operations/deleteBranch.d.ts +2 -0
  39. package/lib/operations/deleteBranch.d.ts.map +1 -1
  40. package/lib/operations/deleteBranch.js +2 -0
  41. package/lib/operations/deleteBranch.js.map +1 -1
  42. package/lib/operations/deleteTrafficBudget.d.ts +20 -0
  43. package/lib/operations/deleteTrafficBudget.d.ts.map +1 -0
  44. package/lib/operations/deleteTrafficBudget.js +33 -0
  45. package/lib/operations/deleteTrafficBudget.js.map +1 -0
  46. package/lib/operations/deleteTrafficRule.d.ts +22 -0
  47. package/lib/operations/deleteTrafficRule.d.ts.map +1 -0
  48. package/lib/operations/deleteTrafficRule.js +33 -0
  49. package/lib/operations/deleteTrafficRule.js.map +1 -0
  50. package/lib/operations/getBackup.d.ts +1 -0
  51. package/lib/operations/getBackup.d.ts.map +1 -1
  52. package/lib/operations/getBackup.js +1 -0
  53. package/lib/operations/getBackup.js.map +1 -1
  54. package/lib/operations/getBackupPolicy.d.ts +35 -0
  55. package/lib/operations/getBackupPolicy.d.ts.map +1 -0
  56. package/lib/operations/getBackupPolicy.js +46 -0
  57. package/lib/operations/getBackupPolicy.js.map +1 -0
  58. package/lib/operations/getDeployQueue.d.ts +4 -0
  59. package/lib/operations/getDeployQueue.d.ts.map +1 -1
  60. package/lib/operations/getDeployQueue.js +4 -0
  61. package/lib/operations/getDeployQueue.js.map +1 -1
  62. package/lib/operations/getMaintenanceSchedule.d.ts +37 -0
  63. package/lib/operations/getMaintenanceSchedule.d.ts.map +1 -0
  64. package/lib/operations/getMaintenanceSchedule.js +50 -0
  65. package/lib/operations/getMaintenanceSchedule.js.map +1 -0
  66. package/lib/operations/getTrafficBudget.d.ts +56 -0
  67. package/lib/operations/getTrafficBudget.d.ts.map +1 -0
  68. package/lib/operations/getTrafficBudget.js +67 -0
  69. package/lib/operations/getTrafficBudget.js.map +1 -0
  70. package/lib/operations/index.d.ts +16 -0
  71. package/lib/operations/index.d.ts.map +1 -1
  72. package/lib/operations/index.js +16 -0
  73. package/lib/operations/index.js.map +1 -1
  74. package/lib/operations/listAuditLogs.d.ts +6 -0
  75. package/lib/operations/listAuditLogs.d.ts.map +1 -1
  76. package/lib/operations/listAuditLogs.js +6 -0
  77. package/lib/operations/listAuditLogs.js.map +1 -1
  78. package/lib/operations/listBackupPolicies.d.ts +44 -0
  79. package/lib/operations/listBackupPolicies.d.ts.map +1 -0
  80. package/lib/operations/listBackupPolicies.js +57 -0
  81. package/lib/operations/listBackupPolicies.js.map +1 -0
  82. package/lib/operations/listBackups.d.ts +1 -0
  83. package/lib/operations/listBackups.d.ts.map +1 -1
  84. package/lib/operations/listBackups.js +1 -0
  85. package/lib/operations/listBackups.js.map +1 -1
  86. package/lib/operations/listDeployRequestReviews.d.ts +4 -0
  87. package/lib/operations/listDeployRequestReviews.d.ts.map +1 -1
  88. package/lib/operations/listDeployRequestReviews.js +4 -0
  89. package/lib/operations/listDeployRequestReviews.js.map +1 -1
  90. package/lib/operations/listGeneratedQueryPatternsReports.d.ts +6 -0
  91. package/lib/operations/listGeneratedQueryPatternsReports.d.ts.map +1 -1
  92. package/lib/operations/listGeneratedQueryPatternsReports.js +6 -0
  93. package/lib/operations/listGeneratedQueryPatternsReports.js.map +1 -1
  94. package/lib/operations/listMaintenanceSchedules.d.ts +46 -0
  95. package/lib/operations/listMaintenanceSchedules.d.ts.map +1 -0
  96. package/lib/operations/listMaintenanceSchedules.js +59 -0
  97. package/lib/operations/listMaintenanceSchedules.js.map +1 -0
  98. package/lib/operations/listMaintenanceWindows.d.ts +35 -0
  99. package/lib/operations/listMaintenanceWindows.d.ts.map +1 -0
  100. package/lib/operations/listMaintenanceWindows.js +48 -0
  101. package/lib/operations/listMaintenanceWindows.js.map +1 -0
  102. package/lib/operations/listOrganizationTeamMembers.d.ts +4 -0
  103. package/lib/operations/listOrganizationTeamMembers.d.ts.map +1 -1
  104. package/lib/operations/listOrganizationTeamMembers.js +4 -0
  105. package/lib/operations/listOrganizationTeamMembers.js.map +1 -1
  106. package/lib/operations/listOrganizationTeams.d.ts +4 -0
  107. package/lib/operations/listOrganizationTeams.d.ts.map +1 -1
  108. package/lib/operations/listOrganizationTeams.js +4 -0
  109. package/lib/operations/listOrganizationTeams.js.map +1 -1
  110. package/lib/operations/listSchemaRecommendations.d.ts +4 -0
  111. package/lib/operations/listSchemaRecommendations.d.ts.map +1 -1
  112. package/lib/operations/listSchemaRecommendations.js +4 -0
  113. package/lib/operations/listSchemaRecommendations.js.map +1 -1
  114. package/lib/operations/listTrafficBudgets.d.ts +71 -0
  115. package/lib/operations/listTrafficBudgets.d.ts.map +1 -0
  116. package/lib/operations/listTrafficBudgets.js +84 -0
  117. package/lib/operations/listTrafficBudgets.js.map +1 -0
  118. package/lib/operations/updateBackup.d.ts +1 -0
  119. package/lib/operations/updateBackup.d.ts.map +1 -1
  120. package/lib/operations/updateBackup.js +1 -0
  121. package/lib/operations/updateBackup.js.map +1 -1
  122. package/lib/operations/updateBackupPolicy.d.ts +53 -0
  123. package/lib/operations/updateBackupPolicy.d.ts.map +1 -0
  124. package/lib/operations/updateBackupPolicy.js +66 -0
  125. package/lib/operations/updateBackupPolicy.js.map +1 -0
  126. package/lib/operations/updateTrafficBudget.d.ts +72 -0
  127. package/lib/operations/updateTrafficBudget.d.ts.map +1 -0
  128. package/lib/operations/updateTrafficBudget.js +85 -0
  129. package/lib/operations/updateTrafficBudget.js.map +1 -0
  130. package/lib/retry.d.ts +2 -2
  131. package/lib/retry.d.ts.map +1 -1
  132. package/lib/retry.js +2 -2
  133. package/lib/retry.js.map +1 -1
  134. package/package.json +4 -4
  135. package/src/credentials.ts +2 -2
  136. package/src/operations/checkDeployRequestStorage.ts +61 -0
  137. package/src/operations/createBackup.ts +1 -0
  138. package/src/operations/createBackupPolicy.ts +74 -0
  139. package/src/operations/createBranch.ts +6 -0
  140. package/src/operations/createDatabase.ts +6 -0
  141. package/src/operations/createTrafficBudget.ts +93 -0
  142. package/src/operations/createTrafficRule.ts +69 -0
  143. package/src/operations/deleteBackupPolicy.ts +36 -0
  144. package/src/operations/deleteBranch.ts +2 -0
  145. package/src/operations/deleteTrafficBudget.ts +39 -0
  146. package/src/operations/deleteTrafficRule.ts +41 -0
  147. package/src/operations/getBackup.ts +1 -0
  148. package/src/operations/getBackupPolicy.ts +52 -0
  149. package/src/operations/getDeployQueue.ts +4 -0
  150. package/src/operations/getMaintenanceSchedule.ts +60 -0
  151. package/src/operations/getTrafficBudget.ts +79 -0
  152. package/src/operations/index.ts +16 -0
  153. package/src/operations/listAuditLogs.ts +6 -0
  154. package/src/operations/listBackupPolicies.ts +65 -0
  155. package/src/operations/listBackups.ts +1 -0
  156. package/src/operations/listDeployRequestReviews.ts +4 -0
  157. package/src/operations/listGeneratedQueryPatternsReports.ts +6 -0
  158. package/src/operations/listMaintenanceSchedules.ts +71 -0
  159. package/src/operations/listMaintenanceWindows.ts +60 -0
  160. package/src/operations/listOrganizationTeamMembers.ts +4 -0
  161. package/src/operations/listOrganizationTeams.ts +4 -0
  162. package/src/operations/listSchemaRecommendations.ts +4 -0
  163. package/src/operations/listTrafficBudgets.ts +96 -0
  164. package/src/operations/updateBackup.ts +1 -0
  165. package/src/operations/updateBackupPolicy.ts +76 -0
  166. package/src/operations/updateTrafficBudget.ts +95 -0
  167. package/src/retry.ts +2 -2
@@ -9,6 +9,9 @@ export const ListGeneratedQueryPatternsReportsInput =
9
9
  organization: Schema.String.pipe(T.PathParam()),
10
10
  database: Schema.String.pipe(T.PathParam()),
11
11
  branch: Schema.String.pipe(T.PathParam()),
12
+ starting_after: Schema.optional(Schema.String),
13
+ ending_before: Schema.optional(Schema.String),
14
+ limit: Schema.optional(Schema.Number),
12
15
  }).pipe(
13
16
  T.Http({
14
17
  method: "GET",
@@ -51,6 +54,9 @@ export type ListGeneratedQueryPatternsReportsOutput =
51
54
  * @param organization - The name of the organization the branch belongs to
52
55
  * @param database - The name of the database the branch belongs to
53
56
  * @param branch - The name of the branch
57
+ * @param starting_after - If provided, returns results after the specified cursor
58
+ * @param ending_before - If provided, returns results before the specified cursor
59
+ * @param limit - If provided, specifies the number of returned results (max 100)
54
60
  */
55
61
  export const listGeneratedQueryPatternsReports =
56
62
  /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
@@ -0,0 +1,71 @@
1
+ import * as Schema from "effect/Schema";
2
+ import { API } from "../client";
3
+ import * as T from "../traits";
4
+ import { Forbidden, NotFound } from "../errors";
5
+
6
+ // Input Schema
7
+ export const ListMaintenanceSchedulesInput =
8
+ /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
9
+ organization: Schema.String.pipe(T.PathParam()),
10
+ database: Schema.String.pipe(T.PathParam()),
11
+ page: Schema.optional(Schema.Number),
12
+ per_page: Schema.optional(Schema.Number),
13
+ }).pipe(
14
+ T.Http({
15
+ method: "GET",
16
+ path: "/organizations/{organization}/databases/{database}/maintenance-schedules",
17
+ }),
18
+ );
19
+ export type ListMaintenanceSchedulesInput =
20
+ typeof ListMaintenanceSchedulesInput.Type;
21
+
22
+ // Output Schema
23
+ export const ListMaintenanceSchedulesOutput =
24
+ /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
25
+ current_page: Schema.Number,
26
+ next_page: Schema.Number,
27
+ next_page_url: Schema.String,
28
+ prev_page: Schema.Number,
29
+ prev_page_url: Schema.String,
30
+ data: Schema.Array(
31
+ Schema.Struct({
32
+ id: Schema.String,
33
+ name: Schema.String,
34
+ created_at: Schema.String,
35
+ updated_at: Schema.String,
36
+ last_window_datetime: Schema.String,
37
+ next_window_datetime: Schema.String,
38
+ duration: Schema.Number,
39
+ day: Schema.Number,
40
+ hour: Schema.Number,
41
+ week: Schema.Number,
42
+ frequency_value: Schema.Number,
43
+ frequency_unit: Schema.Literals(["day", "week", "month", "once"]),
44
+ enabled: Schema.Boolean,
45
+ expires_at: Schema.String,
46
+ deadline_at: Schema.String,
47
+ required: Schema.Boolean,
48
+ pending_vitess_version_update: Schema.Boolean,
49
+ pending_vitess_version: Schema.String,
50
+ }),
51
+ ),
52
+ });
53
+ export type ListMaintenanceSchedulesOutput =
54
+ typeof ListMaintenanceSchedulesOutput.Type;
55
+
56
+ // The operation
57
+ /**
58
+ * List maintenance schedules
59
+ *
60
+ * @param organization - Organization name slug from `list_organizations`. Example: `acme`.
61
+ * @param database - Database name slug from `list_databases`. Example: `app-db`.
62
+ * @param page - If provided, specifies the page offset of returned results
63
+ * @param per_page - If provided, specifies the number of returned results
64
+ */
65
+ export const listMaintenanceSchedules = /*@__PURE__*/ /*#__PURE__*/ API.make(
66
+ () => ({
67
+ inputSchema: ListMaintenanceSchedulesInput,
68
+ outputSchema: ListMaintenanceSchedulesOutput,
69
+ errors: [Forbidden, NotFound] as const,
70
+ }),
71
+ );
@@ -0,0 +1,60 @@
1
+ import * as Schema from "effect/Schema";
2
+ import { API } from "../client";
3
+ import * as T from "../traits";
4
+ import { Forbidden, NotFound } from "../errors";
5
+
6
+ // Input Schema
7
+ export const ListMaintenanceWindowsInput =
8
+ /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
9
+ id: Schema.String.pipe(T.PathParam()),
10
+ organization: Schema.String.pipe(T.PathParam()),
11
+ database: Schema.String.pipe(T.PathParam()),
12
+ page: Schema.optional(Schema.Number),
13
+ per_page: Schema.optional(Schema.Number),
14
+ }).pipe(
15
+ T.Http({
16
+ method: "GET",
17
+ path: "/organizations/{organization}/databases/{database}/maintenance-schedules/{id}/windows",
18
+ }),
19
+ );
20
+ export type ListMaintenanceWindowsInput =
21
+ typeof ListMaintenanceWindowsInput.Type;
22
+
23
+ // Output Schema
24
+ export const ListMaintenanceWindowsOutput =
25
+ /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
26
+ current_page: Schema.Number,
27
+ next_page: Schema.Number,
28
+ next_page_url: Schema.String,
29
+ prev_page: Schema.Number,
30
+ prev_page_url: Schema.String,
31
+ data: Schema.Array(
32
+ Schema.Struct({
33
+ id: Schema.String,
34
+ created_at: Schema.String,
35
+ updated_at: Schema.String,
36
+ started_at: Schema.String,
37
+ finished_at: Schema.String,
38
+ }),
39
+ ),
40
+ });
41
+ export type ListMaintenanceWindowsOutput =
42
+ typeof ListMaintenanceWindowsOutput.Type;
43
+
44
+ // The operation
45
+ /**
46
+ * List maintenance windows
47
+ *
48
+ * @param id - The ID of the maintenance schedule
49
+ * @param organization - Organization name slug from `list_organizations`. Example: `acme`.
50
+ * @param database - Database name slug from `list_databases`. Example: `app-db`.
51
+ * @param page - If provided, specifies the page offset of returned results
52
+ * @param per_page - If provided, specifies the number of returned results
53
+ */
54
+ export const listMaintenanceWindows = /*@__PURE__*/ /*#__PURE__*/ API.make(
55
+ () => ({
56
+ inputSchema: ListMaintenanceWindowsInput,
57
+ outputSchema: ListMaintenanceWindowsOutput,
58
+ errors: [Forbidden, NotFound] as const,
59
+ }),
60
+ );
@@ -14,6 +14,8 @@ export const ListOrganizationTeamMembersInput =
14
14
  /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
15
15
  organization: Schema.String.pipe(T.PathParam()),
16
16
  team: Schema.String.pipe(T.PathParam()),
17
+ page: Schema.optional(Schema.Number),
18
+ per_page: Schema.optional(Schema.Number),
17
19
  }).pipe(
18
20
  T.Http({
19
21
  method: "GET",
@@ -119,6 +121,8 @@ export type ListOrganizationTeamMembersOutput =
119
121
  *
120
122
  * @param organization - The name of the organization
121
123
  * @param team - The slug of the team
124
+ * @param page - If provided, specifies the page offset of returned results
125
+ * @param per_page - If provided, specifies the number of returned results
122
126
  */
123
127
  export const listOrganizationTeamMembers = /*@__PURE__*/ /*#__PURE__*/ API.make(
124
128
  () => ({
@@ -13,6 +13,8 @@ export const ListOrganizationTeamsInput =
13
13
  /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
14
14
  organization: Schema.String.pipe(T.PathParam()),
15
15
  q: Schema.optional(Schema.String),
16
+ page: Schema.optional(Schema.Number),
17
+ per_page: Schema.optional(Schema.Number),
16
18
  }).pipe(
17
19
  T.Http({ method: "GET", path: "/organizations/{organization}/teams" }),
18
20
  );
@@ -84,6 +86,8 @@ export type ListOrganizationTeamsOutput =
84
86
  *
85
87
  * @param organization - The name of the organization
86
88
  * @param q - Search term to filter teams by name
89
+ * @param page - If provided, specifies the page offset of returned results
90
+ * @param per_page - If provided, specifies the number of returned results
87
91
  */
88
92
  export const listOrganizationTeams = /*@__PURE__*/ /*#__PURE__*/ API.make(
89
93
  () => ({
@@ -9,6 +9,8 @@ export const ListSchemaRecommendationsInput =
9
9
  organization: Schema.String.pipe(T.PathParam()),
10
10
  database: Schema.String.pipe(T.PathParam()),
11
11
  state: Schema.optional(Schema.Literals(["open", "closed"])),
12
+ page: Schema.optional(Schema.Number),
13
+ per_page: Schema.optional(Schema.Number),
12
14
  }).pipe(
13
15
  T.Http({
14
16
  method: "GET",
@@ -74,6 +76,8 @@ export type ListSchemaRecommendationsOutput =
74
76
  * @param organization - Organization name slug from `list_organizations`. Example: `acme`.
75
77
  * @param database - Database name slug from `list_databases`. Example: `app-db`.
76
78
  * @param state - Filter by recommendation state
79
+ * @param page - If provided, specifies the page offset of returned results
80
+ * @param per_page - If provided, specifies the number of returned results
77
81
  */
78
82
  export const listSchemaRecommendations = /*@__PURE__*/ /*#__PURE__*/ API.make(
79
83
  () => ({
@@ -0,0 +1,96 @@
1
+ import * as Schema from "effect/Schema";
2
+ import { API } from "../client";
3
+ import * as T from "../traits";
4
+ import { Forbidden, NotFound } from "../errors";
5
+
6
+ // Input Schema
7
+ export const ListTrafficBudgetsInput =
8
+ /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
9
+ organization: Schema.String.pipe(T.PathParam()),
10
+ database: Schema.String.pipe(T.PathParam()),
11
+ branch: Schema.String.pipe(T.PathParam()),
12
+ page: Schema.optional(Schema.Number),
13
+ per_page: Schema.optional(Schema.Number),
14
+ period: Schema.optional(Schema.String),
15
+ created_at: Schema.optional(Schema.String),
16
+ fingerprint: Schema.optional(Schema.String),
17
+ }).pipe(
18
+ T.Http({
19
+ method: "GET",
20
+ path: "/organizations/{organization}/databases/{database}/branches/{branch}/traffic/budgets",
21
+ }),
22
+ );
23
+ export type ListTrafficBudgetsInput = typeof ListTrafficBudgetsInput.Type;
24
+
25
+ // Output Schema
26
+ export const ListTrafficBudgetsOutput =
27
+ /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
28
+ current_page: Schema.Number,
29
+ next_page: Schema.Number,
30
+ next_page_url: Schema.String,
31
+ prev_page: Schema.Number,
32
+ prev_page_url: Schema.String,
33
+ data: Schema.Array(
34
+ Schema.Struct({
35
+ id: Schema.String,
36
+ name: Schema.String,
37
+ mode: Schema.Literals(["enforce", "warn", "off"]),
38
+ capacity: Schema.optional(Schema.Number),
39
+ rate: Schema.optional(Schema.Number),
40
+ burst: Schema.optional(Schema.Number),
41
+ concurrency: Schema.optional(Schema.Number),
42
+ warning_threshold: Schema.optional(Schema.Number),
43
+ actor: Schema.Struct({
44
+ id: Schema.String,
45
+ display_name: Schema.String,
46
+ avatar_url: Schema.String,
47
+ }),
48
+ rules: Schema.Array(
49
+ Schema.Struct({
50
+ id: Schema.String,
51
+ kind: Schema.Literals(["match"]),
52
+ tags: Schema.Array(
53
+ Schema.Struct({
54
+ key_id: Schema.String,
55
+ key: Schema.String,
56
+ value: Schema.String,
57
+ source: Schema.Literals(["sql", "system"]),
58
+ }),
59
+ ),
60
+ fingerprint: Schema.optional(Schema.String),
61
+ keyspace: Schema.optional(Schema.String),
62
+ actor: Schema.Struct({
63
+ id: Schema.String,
64
+ display_name: Schema.String,
65
+ avatar_url: Schema.String,
66
+ }),
67
+ syntax_highlighted_sql: Schema.String,
68
+ created_at: Schema.String,
69
+ updated_at: Schema.String,
70
+ }),
71
+ ),
72
+ created_at: Schema.String,
73
+ updated_at: Schema.String,
74
+ }),
75
+ ),
76
+ });
77
+ export type ListTrafficBudgetsOutput = typeof ListTrafficBudgetsOutput.Type;
78
+
79
+ // The operation
80
+ /**
81
+ * List traffic budgets
82
+ *
83
+ * @param organization - Organization name slug from `list_organizations`. Example: `acme`.
84
+ * @param database - Database name slug from `list_databases`. Example: `app-db`.
85
+ * @param branch - Branch name from `list_branches`. Example: `main`.
86
+ * @param page - If provided, specifies the page offset of returned results
87
+ * @param per_page - If provided, specifies the number of returned results
88
+ * @param period - Time period filter (e.g., '1h', '24h', '7d')
89
+ * @param created_at - Filter by creation date range (format: 'start..end')
90
+ * @param fingerprint - Filter budgets by query fingerprint
91
+ */
92
+ export const listTrafficBudgets = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
93
+ inputSchema: ListTrafficBudgetsInput,
94
+ outputSchema: ListTrafficBudgetsOutput,
95
+ errors: [Forbidden, NotFound] as const,
96
+ }));
@@ -58,6 +58,7 @@ export const UpdateBackupOutput = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
58
58
  backup_policy: Schema.NullOr(
59
59
  Schema.Struct({
60
60
  id: Schema.String,
61
+ display_name: Schema.String,
61
62
  name: Schema.String,
62
63
  target: Schema.Literals(["production", "development"]),
63
64
  retention_value: Schema.Number,
@@ -0,0 +1,76 @@
1
+ import * as Schema from "effect/Schema";
2
+ import { API } from "../client";
3
+ import * as T from "../traits";
4
+ import { Forbidden, NotFound } from "../errors";
5
+
6
+ // Input Schema
7
+ export const UpdateBackupPolicyInput =
8
+ /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
9
+ id: Schema.String.pipe(T.PathParam()),
10
+ organization: Schema.String.pipe(T.PathParam()),
11
+ database: Schema.String.pipe(T.PathParam()),
12
+ name: Schema.optional(Schema.String),
13
+ target: Schema.optional(Schema.Literals(["production", "development"])),
14
+ retention_value: Schema.optional(Schema.Number),
15
+ retention_unit: Schema.optional(
16
+ Schema.Literals(["hour", "day", "week", "month", "year"]),
17
+ ),
18
+ frequency_value: Schema.optional(Schema.Number),
19
+ frequency_unit: Schema.optional(
20
+ Schema.Literals(["hour", "day", "week", "month"]),
21
+ ),
22
+ schedule_time: Schema.optional(Schema.String),
23
+ schedule_day: Schema.optional(Schema.Number),
24
+ schedule_week: Schema.optional(Schema.Number),
25
+ }).pipe(
26
+ T.Http({
27
+ method: "PATCH",
28
+ path: "/organizations/{organization}/databases/{database}/backup-policies/{id}",
29
+ }),
30
+ );
31
+ export type UpdateBackupPolicyInput = typeof UpdateBackupPolicyInput.Type;
32
+
33
+ // Output Schema
34
+ export const UpdateBackupPolicyOutput =
35
+ /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
36
+ id: Schema.String,
37
+ display_name: Schema.String,
38
+ name: Schema.String,
39
+ target: Schema.Literals(["production", "development"]),
40
+ retention_value: Schema.Number,
41
+ retention_unit: Schema.String,
42
+ frequency_value: Schema.Number,
43
+ frequency_unit: Schema.String,
44
+ schedule_time: Schema.String,
45
+ schedule_day: Schema.Number,
46
+ schedule_week: Schema.Number,
47
+ created_at: Schema.String,
48
+ updated_at: Schema.String,
49
+ last_ran_at: Schema.String,
50
+ next_run_at: Schema.String,
51
+ required: Schema.Boolean,
52
+ });
53
+ export type UpdateBackupPolicyOutput = typeof UpdateBackupPolicyOutput.Type;
54
+
55
+ // The operation
56
+ /**
57
+ * Update a backup policy
58
+ *
59
+ * @param id - The ID of the backup policy
60
+ * @param organization - Organization name slug from `list_organizations`. Example: `acme`.
61
+ * @param database - Database name slug from `list_databases`. Example: `app-db`.
62
+ * @param name - The name of the backup policy
63
+ * @param target - Whether the policy is for production or development branches
64
+ * @param retention_value - A number value for the retention period of the backup policy
65
+ * @param retention_unit - The unit for the retention period of the backup policy
66
+ * @param frequency_value - A number value for the frequency of the backup policy
67
+ * @param frequency_unit - The unit for the frequency of the backup policy
68
+ * @param schedule_time - The time of day that the backup is scheduled, in HH:MM format
69
+ * @param schedule_day - Day of the week that the backup is scheduled. 0 is Sunday, 6 is Saturday
70
+ * @param schedule_week - Week of the month that the backup is scheduled. 0 is the first week, 3 is the fourth week
71
+ */
72
+ export const updateBackupPolicy = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
73
+ inputSchema: UpdateBackupPolicyInput,
74
+ outputSchema: UpdateBackupPolicyOutput,
75
+ errors: [Forbidden, NotFound] as const,
76
+ }));
@@ -0,0 +1,95 @@
1
+ import * as Schema from "effect/Schema";
2
+ import { API } from "../client";
3
+ import * as T from "../traits";
4
+ import { Forbidden, NotFound } from "../errors";
5
+
6
+ // Input Schema
7
+ export const UpdateTrafficBudgetInput =
8
+ /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
9
+ organization: Schema.String.pipe(T.PathParam()),
10
+ database: Schema.String.pipe(T.PathParam()),
11
+ branch: Schema.String.pipe(T.PathParam()),
12
+ id: Schema.String.pipe(T.PathParam()),
13
+ name: Schema.optional(Schema.String),
14
+ mode: Schema.optional(Schema.Literals(["enforce", "warn", "off"])),
15
+ capacity: Schema.optional(Schema.Number),
16
+ rate: Schema.optional(Schema.Number),
17
+ burst: Schema.optional(Schema.Number),
18
+ concurrency: Schema.optional(Schema.Number),
19
+ warning_threshold: Schema.optional(Schema.Number),
20
+ rules: Schema.optional(Schema.Array(Schema.String)),
21
+ }).pipe(
22
+ T.Http({
23
+ method: "PATCH",
24
+ path: "/organizations/{organization}/databases/{database}/branches/{branch}/traffic/budgets/{id}",
25
+ }),
26
+ );
27
+ export type UpdateTrafficBudgetInput = typeof UpdateTrafficBudgetInput.Type;
28
+
29
+ // Output Schema
30
+ export const UpdateTrafficBudgetOutput =
31
+ /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
32
+ id: Schema.String,
33
+ name: Schema.String,
34
+ mode: Schema.Literals(["enforce", "warn", "off"]),
35
+ capacity: Schema.optional(Schema.Number),
36
+ rate: Schema.optional(Schema.Number),
37
+ burst: Schema.optional(Schema.Number),
38
+ concurrency: Schema.optional(Schema.Number),
39
+ warning_threshold: Schema.optional(Schema.Number),
40
+ actor: Schema.Struct({
41
+ id: Schema.String,
42
+ display_name: Schema.String,
43
+ avatar_url: Schema.String,
44
+ }),
45
+ rules: Schema.Array(
46
+ Schema.Struct({
47
+ id: Schema.String,
48
+ kind: Schema.Literals(["match"]),
49
+ tags: Schema.Array(
50
+ Schema.Struct({
51
+ key_id: Schema.String,
52
+ key: Schema.String,
53
+ value: Schema.String,
54
+ source: Schema.Literals(["sql", "system"]),
55
+ }),
56
+ ),
57
+ fingerprint: Schema.optional(Schema.String),
58
+ keyspace: Schema.optional(Schema.String),
59
+ actor: Schema.Struct({
60
+ id: Schema.String,
61
+ display_name: Schema.String,
62
+ avatar_url: Schema.String,
63
+ }),
64
+ syntax_highlighted_sql: Schema.String,
65
+ created_at: Schema.String,
66
+ updated_at: Schema.String,
67
+ }),
68
+ ),
69
+ created_at: Schema.String,
70
+ updated_at: Schema.String,
71
+ });
72
+ export type UpdateTrafficBudgetOutput = typeof UpdateTrafficBudgetOutput.Type;
73
+
74
+ // The operation
75
+ /**
76
+ * Update a traffic budget
77
+ *
78
+ * @param organization - Organization name slug from `list_organizations`. Example: `acme`.
79
+ * @param database - Database name slug from `list_databases`. Example: `app-db`.
80
+ * @param branch - Branch name from `list_branches`. Example: `main`.
81
+ * @param id - The ID of the traffic budget
82
+ * @param name - Name of the traffic budget
83
+ * @param mode - The mode of the traffic budget
84
+ * @param capacity - The maximum capacity that can be banked, measured as a percentage of seconds of full server usage (0-6000). Unlimited when not set.
85
+ * @param rate - The rate at which capacity refills, as a percentage of server resources (0-100). Unlimited when not set.
86
+ * @param burst - The maximum capacity a single query can consume, measured as a percentage of seconds of full server usage (0-6000). Unlimited when not set.
87
+ * @param concurrency - The percentage of available worker processes this policy can use (0-100). Unlimited when not set.
88
+ * @param warning_threshold - A percentage of capacity, burst, or concurrency thresholds to emit warnings for enforced budgets (0-100).
89
+ * @param rules - Array of traffic rules to apply to the budget
90
+ */
91
+ export const updateTrafficBudget = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
92
+ inputSchema: UpdateTrafficBudgetInput,
93
+ outputSchema: UpdateTrafficBudgetOutput,
94
+ errors: [Forbidden, NotFound] as const,
95
+ }));
package/src/retry.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import * as Effect from "effect/Effect";
7
7
  import * as Layer from "effect/Layer";
8
- import * as ServiceMap from "effect/ServiceMap";
8
+ import * as Context from "effect/Context";
9
9
  export {
10
10
  type Options,
11
11
  type Factory,
@@ -21,7 +21,7 @@ import type { Policy } from "@distilled.cloud/core/retry";
21
21
  /**
22
22
  * Context tag for configuring retry behavior of PlanetScale API calls.
23
23
  */
24
- export class Retry extends ServiceMap.Service<Retry, Policy>()(
24
+ export class Retry extends Context.Service<Retry, Policy>()(
25
25
  "PlanetScaleRetry",
26
26
  ) {}
27
27