@distilled.cloud/starburst-galaxy 0.0.0 → 1.0.0-rc.22

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 (190) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +110 -4
  3. package/lib/.lazy.json +1 -0
  4. package/lib/_bundle/lazy.js +4 -0
  5. package/lib/_bundle/sdk.js +2 -0
  6. package/lib/_bundle/sdk.js.map +1 -0
  7. package/lib/credentials.d.ts +84 -0
  8. package/lib/credentials.d.ts.map +1 -0
  9. package/lib/credentials.js +1 -0
  10. package/lib/errors.d.ts +83 -0
  11. package/lib/errors.d.ts.map +1 -0
  12. package/lib/errors.js +1 -0
  13. package/lib/index.d.ts +42 -0
  14. package/lib/index.d.ts.map +1 -0
  15. package/lib/index.js +6 -0
  16. package/lib/pagination.d.ts +10 -0
  17. package/lib/pagination.d.ts.map +1 -0
  18. package/lib/pagination.js +1 -0
  19. package/lib/protocol.d.ts +29 -0
  20. package/lib/protocol.d.ts.map +1 -0
  21. package/lib/protocol.js +1 -0
  22. package/lib/retry.d.ts +32 -0
  23. package/lib/retry.d.ts.map +1 -0
  24. package/lib/retry.js +1 -0
  25. package/lib/services/catalog.d.ts +2791 -0
  26. package/lib/services/catalog.d.ts.map +1 -0
  27. package/lib/services/catalog.js +101 -0
  28. package/lib/services/catalog.js.map +1 -0
  29. package/lib/services/cluster.d.ts +248 -0
  30. package/lib/services/cluster.d.ts.map +1 -0
  31. package/lib/services/cluster.js +2 -0
  32. package/lib/services/cluster.js.map +1 -0
  33. package/lib/services/column_mask.d.ts +162 -0
  34. package/lib/services/column_mask.d.ts.map +1 -0
  35. package/lib/services/column_mask.js +2 -0
  36. package/lib/services/column_mask.js.map +1 -0
  37. package/lib/services/cross_account_iam_role.d.ts +133 -0
  38. package/lib/services/cross_account_iam_role.d.ts.map +1 -0
  39. package/lib/services/cross_account_iam_role.js +2 -0
  40. package/lib/services/cross_account_iam_role.js.map +1 -0
  41. package/lib/services/data_domain.d.ts +223 -0
  42. package/lib/services/data_domain.d.ts.map +1 -0
  43. package/lib/services/data_domain.js +2 -0
  44. package/lib/services/data_domain.js.map +1 -0
  45. package/lib/services/data_product.d.ts +290 -0
  46. package/lib/services/data_product.d.ts.map +1 -0
  47. package/lib/services/data_product.js +2 -0
  48. package/lib/services/data_product.js.map +1 -0
  49. package/lib/services/data_product_usage_example.d.ts +158 -0
  50. package/lib/services/data_product_usage_example.d.ts.map +1 -0
  51. package/lib/services/data_product_usage_example.js +2 -0
  52. package/lib/services/data_product_usage_example.js.map +1 -0
  53. package/lib/services/data_quality.d.ts +344 -0
  54. package/lib/services/data_quality.d.ts.map +1 -0
  55. package/lib/services/data_quality.js +2 -0
  56. package/lib/services/data_quality.js.map +1 -0
  57. package/lib/services/data_quality_metrics.d.ts +282 -0
  58. package/lib/services/data_quality_metrics.d.ts.map +1 -0
  59. package/lib/services/data_quality_metrics.js +2 -0
  60. package/lib/services/data_quality_metrics.js.map +1 -0
  61. package/lib/services/data_quality_schedule.d.ts +220 -0
  62. package/lib/services/data_quality_schedule.d.ts.map +1 -0
  63. package/lib/services/data_quality_schedule.js +2 -0
  64. package/lib/services/data_quality_schedule.js.map +1 -0
  65. package/lib/services/discovery.d.ts +439 -0
  66. package/lib/services/discovery.d.ts.map +1 -0
  67. package/lib/services/discovery.js +36 -0
  68. package/lib/services/discovery.js.map +1 -0
  69. package/lib/services/file_ingest_source.d.ts +205 -0
  70. package/lib/services/file_ingest_source.d.ts.map +1 -0
  71. package/lib/services/file_ingest_source.js +2 -0
  72. package/lib/services/file_ingest_source.js.map +1 -0
  73. package/lib/services/group.d.ts +140 -0
  74. package/lib/services/group.d.ts.map +1 -0
  75. package/lib/services/group.js +2 -0
  76. package/lib/services/group.js.map +1 -0
  77. package/lib/services/index.d.ts +26 -0
  78. package/lib/services/index.d.ts.map +1 -0
  79. package/lib/services/index.js +25 -0
  80. package/lib/services/kafka_ingest_source.d.ts +236 -0
  81. package/lib/services/kafka_ingest_source.d.ts.map +1 -0
  82. package/lib/services/kafka_ingest_source.js +2 -0
  83. package/lib/services/kafka_ingest_source.js.map +1 -0
  84. package/lib/services/live_table.d.ts +851 -0
  85. package/lib/services/live_table.d.ts.map +1 -0
  86. package/lib/services/live_table.js +20 -0
  87. package/lib/services/live_table.js.map +1 -0
  88. package/lib/services/policy.d.ts +213 -0
  89. package/lib/services/policy.d.ts.map +1 -0
  90. package/lib/services/policy.js +2 -0
  91. package/lib/services/policy.js.map +1 -0
  92. package/lib/services/privatelink.d.ts +95 -0
  93. package/lib/services/privatelink.d.ts.map +1 -0
  94. package/lib/services/privatelink.js +2 -0
  95. package/lib/services/privatelink.js.map +1 -0
  96. package/lib/services/privilege.d.ts +167 -0
  97. package/lib/services/privilege.d.ts.map +1 -0
  98. package/lib/services/privilege.js +2 -0
  99. package/lib/services/privilege.js.map +1 -0
  100. package/lib/services/role.d.ts +222 -0
  101. package/lib/services/role.d.ts.map +1 -0
  102. package/lib/services/role.js +2 -0
  103. package/lib/services/role.js.map +1 -0
  104. package/lib/services/row_filter.d.ts +155 -0
  105. package/lib/services/row_filter.d.ts.map +1 -0
  106. package/lib/services/row_filter.js +2 -0
  107. package/lib/services/row_filter.js.map +1 -0
  108. package/lib/services/schema_discovery.d.ts +236 -0
  109. package/lib/services/schema_discovery.d.ts.map +1 -0
  110. package/lib/services/schema_discovery.js +2 -0
  111. package/lib/services/schema_discovery.js.map +1 -0
  112. package/lib/services/service_account.d.ts +206 -0
  113. package/lib/services/service_account.d.ts.map +1 -0
  114. package/lib/services/service_account.js +2 -0
  115. package/lib/services/service_account.js.map +1 -0
  116. package/lib/services/sql_jobs.d.ts +264 -0
  117. package/lib/services/sql_jobs.d.ts.map +1 -0
  118. package/lib/services/sql_jobs.js +2 -0
  119. package/lib/services/sql_jobs.js.map +1 -0
  120. package/lib/services/tag.d.ts +287 -0
  121. package/lib/services/tag.d.ts.map +1 -0
  122. package/lib/services/tag.js +2 -0
  123. package/lib/services/tag.js.map +1 -0
  124. package/lib/services/user.d.ts +175 -0
  125. package/lib/services/user.d.ts.map +1 -0
  126. package/lib/services/user.js +2 -0
  127. package/lib/services/user.js.map +1 -0
  128. package/lib/services.lazy/catalog.js +4 -0
  129. package/lib/services.lazy/cluster.js +1 -0
  130. package/lib/services.lazy/column_mask.js +1 -0
  131. package/lib/services.lazy/cross_account_iam_role.js +1 -0
  132. package/lib/services.lazy/data_domain.js +1 -0
  133. package/lib/services.lazy/data_product.js +1 -0
  134. package/lib/services.lazy/data_product_usage_example.js +1 -0
  135. package/lib/services.lazy/data_quality.js +1 -0
  136. package/lib/services.lazy/data_quality_metrics.js +1 -0
  137. package/lib/services.lazy/data_quality_schedule.js +1 -0
  138. package/lib/services.lazy/discovery.js +4 -0
  139. package/lib/services.lazy/file_ingest_source.js +1 -0
  140. package/lib/services.lazy/group.js +1 -0
  141. package/lib/services.lazy/index.js +3 -0
  142. package/lib/services.lazy/kafka_ingest_source.js +1 -0
  143. package/lib/services.lazy/live_table.js +4 -0
  144. package/lib/services.lazy/policy.js +1 -0
  145. package/lib/services.lazy/privatelink.js +1 -0
  146. package/lib/services.lazy/privilege.js +1 -0
  147. package/lib/services.lazy/role.js +1 -0
  148. package/lib/services.lazy/row_filter.js +1 -0
  149. package/lib/services.lazy/schema_discovery.js +1 -0
  150. package/lib/services.lazy/service_account.js +1 -0
  151. package/lib/services.lazy/sql_jobs.js +1 -0
  152. package/lib/services.lazy/tag.js +1 -0
  153. package/lib/services.lazy/user.js +1 -0
  154. package/lib/traits.d.ts +11 -0
  155. package/lib/traits.d.ts.map +1 -0
  156. package/lib/traits.js +1 -0
  157. package/package.json +82 -2
  158. package/src/credentials.ts +205 -0
  159. package/src/errors.ts +102 -0
  160. package/src/index.ts +45 -0
  161. package/src/pagination.ts +9 -0
  162. package/src/protocol.ts +94 -0
  163. package/src/retry.ts +50 -0
  164. package/src/services/catalog.ts +6636 -0
  165. package/src/services/cluster.ts +492 -0
  166. package/src/services/column_mask.ts +388 -0
  167. package/src/services/cross_account_iam_role.ts +328 -0
  168. package/src/services/data_domain.ts +509 -0
  169. package/src/services/data_product.ts +641 -0
  170. package/src/services/data_product_usage_example.ts +380 -0
  171. package/src/services/data_quality.ts +771 -0
  172. package/src/services/data_quality_metrics.ts +580 -0
  173. package/src/services/data_quality_schedule.ts +454 -0
  174. package/src/services/discovery.ts +1257 -0
  175. package/src/services/file_ingest_source.ts +480 -0
  176. package/src/services/group.ts +282 -0
  177. package/src/services/index.ts +26 -0
  178. package/src/services/kafka_ingest_source.ts +545 -0
  179. package/src/services/live_table.ts +1537 -0
  180. package/src/services/policy.ts +527 -0
  181. package/src/services/privatelink.ts +209 -0
  182. package/src/services/privilege.ts +424 -0
  183. package/src/services/role.ts +501 -0
  184. package/src/services/row_filter.ts +365 -0
  185. package/src/services/schema_discovery.ts +516 -0
  186. package/src/services/service_account.ts +525 -0
  187. package/src/services/sql_jobs.ts +621 -0
  188. package/src/services/tag.ts +785 -0
  189. package/src/services/user.ts +375 -0
  190. package/src/traits.ts +44 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md CHANGED
@@ -1,9 +1,115 @@
1
1
  # @distilled.cloud/starburst-galaxy
2
2
 
3
- 🐣 This package name has been claimed with [fledgling](https://github.com/dmno-dev/fledgling) for [https://github.com/alchemy-run/distilled](https://github.com/alchemy-run/distilled), and a real release will land here soon.
3
+ Effect-native Starburst Galaxy SDK, generated from the Galaxy public OpenAPI documents
4
+ [v1](https://galaxy.starburst.io/public/openapi/v1/json) and
5
+ [v2](https://galaxy.starburst.io/public/openapi/v2/json).
4
6
 
5
- This is a placeholder — there is nothing to install yet.
7
+ ## Installation
6
8
 
7
- ---
9
+ ```bash
10
+ npm install @distilled.cloud/starburst-galaxy effect
11
+ ```
8
12
 
9
- Want to claim a name of your own? Run `npx fledgling add <name> --new --yes` — it reserves the name on npm and can set up token-less (OIDC trusted) publishing for when you are ready.
13
+ ## Quick start
14
+
15
+ ```ts
16
+ import { Effect, Layer } from "effect";
17
+ import * as FetchHttpClient from "effect/http/FetchHttpClient";
18
+ import * as StarburstGalaxy from "@distilled.cloud/starburst-galaxy";
19
+ import * as Cluster from "@distilled.cloud/starburst-galaxy/cluster";
20
+
21
+ const program = Effect.gen(function* () {
22
+ const { result } = yield* Cluster.listClusters({});
23
+ const [first] = result;
24
+ if (first === undefined) return undefined;
25
+
26
+ const cluster = yield* Cluster.getCluster({ clusterId: first.clusterId });
27
+ yield* Effect.log(`${cluster.name}: ${cluster.clusterState} at ${cluster.trinoUri}`);
28
+ return cluster;
29
+ });
30
+
31
+ const Live = Layer.mergeAll(
32
+ StarburstGalaxy.CredentialsFromEnv,
33
+ ).pipe(Layer.provideMerge(FetchHttpClient.layer));
34
+
35
+ program.pipe(Effect.provide(Live), Effect.runPromise);
36
+ ```
37
+
38
+ The credentials layer takes the same `HttpClient` the operations use, so the
39
+ token exchange is traced and testable like every other request.
40
+
41
+ List operations stream every page with `.items()` (or `.pages()`):
42
+
43
+ ```ts
44
+ import { Effect, Stream } from "effect";
45
+ import * as Catalog from "@distilled.cloud/starburst-galaxy/catalog";
46
+
47
+ const catalogs = Effect.gen(function* () {
48
+ return yield* Catalog.listCatalogs.items({}).pipe(Stream.runCollect);
49
+ });
50
+ ```
51
+
52
+ Galaxy's polymorphic payloads are unions discriminated by one member: a
53
+ catalog's connection or metastore type (`connectionType`, `metastoreType`,
54
+ `authType`, `deploymentType`), a Kafka source's `authType`, a file source's
55
+ `credentialsType`, a live table's `typeKey`. Each arm carries its own
56
+ members, and a request whose whole body is such a union takes it as `body`:
57
+
58
+ ```ts
59
+ import { Effect, Redacted } from "effect";
60
+ import * as Catalog from "@distilled.cloud/starburst-galaxy/catalog";
61
+
62
+ const mysql = Effect.gen(function* () {
63
+ return yield* Catalog.createMySQLCatalog({
64
+ body: {
65
+ connectionType: "direct",
66
+ name: "orders",
67
+ readOnly: true,
68
+ host: "orders.example.com",
69
+ username: "galaxy",
70
+ password: Redacted.make("…"),
71
+ },
72
+ });
73
+ });
74
+ ```
75
+
76
+ ## Auth
77
+
78
+ Galaxy serves the API from each account's own host and authenticates with
79
+ OAuth 2.0 client credentials from a service account.
80
+
81
+ | Variable | |
82
+ | --- | --- |
83
+ | `STARBURST_GALAXY_DOMAIN` | the account domain, e.g. `yourco.galaxy.starburst.io` |
84
+ | `STARBURST_GALAXY_CLIENT_ID` | the service account's client ID |
85
+ | `STARBURST_GALAXY_CLIENT_SECRET` | the service account's client secret |
86
+
87
+ `CredentialsFromEnv` reads them through the current `ConfigProvider` once,
88
+ when the layer is built. It
89
+ exchanges the client ID and secret at `POST https://<domain>/oauth/v2/token`
90
+ (HTTP Basic, `grant_type=client_credentials`) on first use, sends the token as
91
+ `Authorization: Bearer`, and exchanges again a minute before the token's
92
+ 10-minute lifetime ends. Concurrent requests on a cold or expiring token share
93
+ one exchange. A failed exchange fails the call with `TokenRequestFailed`, which
94
+ carries the token endpoint's `status`.
95
+ `fromClientCredentials({ domain, clientId, clientSecret })` does the same from
96
+ values in code (`clientSecret` is a `Redacted`); both need an `HttpClient`.
97
+ `fromAccessToken({ domain, accessToken })` uses a token already held. The
98
+ domain must be HTTPS (plain `http://` only on the loopback interface), since
99
+ the client secret and every token are sent to it. Any other domain fails the
100
+ layer with `ConfigError`, before a request is made.
101
+
102
+ Secrets in catalog and ingest-source payloads (passwords, AWS secret keys, the
103
+ AstraDB token, BigQuery/GCS `credentialsKey`, the Snowflake private key and
104
+ passphrase) are `Redacted` wherever a response carries them and accept
105
+ `string | Redacted` in requests. Identifiers such as an AWS access key ID stay
106
+ plain strings.
107
+
108
+ ## Errors
109
+
110
+ Statuses the spec documents per operation (400, 403, 404, 409, 412) are typed on
111
+ each operation and keep the response body as `body` (`fields` on a 400, `detail`
112
+ on a 412); any other failure maps through core's HTTP status classes, 412 to
113
+ `PreconditionFailed`, and the rest to `UnknownStarburstGalaxyError`. With
114
+ `ResponseValidation.strict` or `.additionalProperties`, a 2xx body that does not
115
+ match its schema fails with `StarburstGalaxyParseError`.
package/lib/.lazy.json ADDED
@@ -0,0 +1 @@
1
+ {"serviceDirs":["services"],"twins":[]}
@@ -0,0 +1,4 @@
1
+ import*as $0 from"./sdk.js";
2
+ import{api$lazyService as L}from"@distilled.cloud/core/_bundle/base";
3
+ const u=import.meta.url,N=[$0];
4
+ export const $L=(s,k,a,l,x)=>L(u,s,k,a===void 0?void 0:x?N.concat(x):N,a,l);
@@ -0,0 +1,2 @@
1
+ import{api$D as e,api$call as t,api$error as n,api$named as r,api$newError as i,api$op as ee,api$opPaginated as a,category$withAuthError as o,category$withBadRequestError as te,category$withConflictError as ne,category$withParseError as re,config$Redacted as s,config$String as c,config$all as l,pagination$paginateToken as u,retry$capped as ie,retry$jittered as ae,retry$makeDefault as oe,retry$throttlingFactory as d,retry$throttlingOptions as se,retry$transientFactory as f,retry$transientOptions as ce,schema_lite_typed$Number as le,schema_lite_typed$String as p,schema_lite_typed$TaggedError as m,schema_lite_typed$Unknown as h,schema_lite_typed$optional as g,trait$Body as _,trait$FormDataFile as v,trait$Header as y,trait$Http as b,trait$HttpBody as x,trait$KeyDictionary as S,trait$Label as C,trait$Query as w,trait$ResponseCode as T,trait$UnionCases as E,trait$applyErrorMatchers as D,trait$bodySymbol as O,trait$errorMatchersSymbol as k,trait$formDataFileSymbol as A,trait$getErrorMatchers as j,trait$headerSymbol as M,trait$httpBodySymbol as N,trait$httpSymbol as P,trait$keyDictionarySymbol as F,trait$labelSymbol as I,trait$querySymbol as L,trait$responseCodeSymbol as R,trait$unionCasesSymbol as z}from"@distilled.cloud/core/_bundle/base";import{errors$API_ERRORS as B,errors$BadGateway as V,errors$BadRequest as H,errors$ConfigError as U,errors$Conflict as W,errors$DEFAULT_ERRORS as ue,errors$Forbidden as de,errors$GatewayTimeout as fe,errors$HTTP_STATUS_MAP as pe,errors$InternalServerError as me,errors$Locked as he,errors$NotFound as ge,errors$ServiceUnavailable as _e,errors$TooManyRequests as G,errors$Unauthorized as ve,errors$UnknownErrorFields as ye,errors$UnprocessableEntity as be,protocol_http$originFromConfig as xe,protocol_rest$RawResponse as Se,protocol_rest$RawResponseRoot as Ce,protocol_rest$SensitiveValue as we,protocol_rest$rawResponseRootSymbol as Te,protocol_rest$rawResponseSymbol as Ee,protocol_rest$restProtocol as De,protocol_rest$sensitiveValueSymbol as Oe,protocol_rest$unknownErrorProps as ke,retry_after$parseRetryAfter as Ae,schema_lite$Array as je,schema_lite$Boolean as Me,schema_lite$NullOr as Ne,schema_lite$Number as Pe,schema_lite$Record as Fe,schema_lite$String as Ie,schema_lite$Struct as Le,schema_lite$TaggedError as Re,schema_lite$Union as ze,schema_lite$Unknown as Be,schema_lite$at as Ve,schema_lite$optional as He,schema_lite$suspend as Ue}from"@distilled.cloud/core/_bundle/rest";import{refreshing as We}from"@distilled.cloud/core/token-cache";import*as K from"effect/Context";import*as q from"effect/Effect";import*as Ge from"effect/http/HttpClient";import*as J from"effect/http/HttpClientRequest";import*as Y from"effect/http/HttpClientResponse";import*as X from"effect/Layer";import*as Z from"effect/Schema";import*as Q from"effect/Duration";import*as Ke from"effect/Redacted";var PreconditionFailed=class extends (/*@__PURE__*/ D(/*@__PURE__*/ m()(`PreconditionFailed`,{message:p}),[{status:412}])){};var UnknownStarburstGalaxyError=class extends (/*@__PURE__*/ m()(`UnknownStarburstGalaxyError`,ye)){};var StarburstGalaxyParseError=class extends (/*@__PURE__*/ m()(`StarburstGalaxyParseError`,{body:h,cause:h}).pipe(re)){};var TokenRequestFailed=class extends (/*@__PURE__*/ m()(`TokenRequestFailed`,{message:p,status:/*@__PURE__*/ g(le)}).pipe(o)){};const qe=[...B,PreconditionFailed];const Je=`/oauth/v2/token`;const Ye=6e4;var Credentials=class extends (/*@__PURE__*/ K.Service()(`StarburstGalaxyCredentials`)){};const Xe=/* @__PURE__ */ new Set([`127.0.0.1`,`localhost`,`[::1]`]);const apiBaseUrlFor=e=>{const t=xe(`Starburst Galaxy domain`,e);if(typeof t!==`string`)return q.fail(t);const n=new URL(t);if(n.protocol!==`https:`&&!(n.protocol===`http:`&&Xe.has(n.hostname)))return q.fail(new U({message:`Starburst Galaxy domain must use HTTPS`}));return q.succeed(t)};const Ze=Z.Struct({access_token:Z.Redacted(Z.String),expires_in:Z.Number});const reuseFor=e=>{const t=e*1e3;return Math.max(t-Ye,t/2)};const makeClientCredentials=e=>q.gen(function*(){const t=yield*Ge.HttpClient;const n=yield*apiBaseUrlFor(e.domain);const r=`${n}${Je}`;const requestFailed=(e,t)=>new TokenRequestFailed({message:`Starburst Galaxy token request to ${r} failed: ${e}`,status:t});const i=q.gen(function*(){const i=yield*t.execute(J.post(r).pipe(J.acceptJson,J.basicAuth(e.clientId,e.clientSecret),J.bodyUrlParams({grant_type:`client_credentials`}))).pipe(q.flatMap(Y.filterStatusOk),q.mapError(e=>requestFailed(e.message,e.response?.status)),q.flatMap(e=>Y.schemaBodyJson(Ze)(e).pipe(q.mapError(t=>requestFailed(t.message,e.status)))));return{config:{accessToken:i.access_token,apiBaseUrl:n},refreshAt:Date.now()+reuseFor(i.expires_in)}});return We(i,e=>e.refreshAt,{onTimeout:e=>new TokenRequestFailed({message:`Starburst Galaxy token exchange timed out after ${e/1e3} s`})}).pipe(q.map(e=>e.config))});const fromClientCredentials=e=>X.effect(Credentials,makeClientCredentials(e));const fromAccessToken=e=>X.effect(Credentials,q.map(apiBaseUrlFor(e.domain),t=>q.succeed({accessToken:e.accessToken,apiBaseUrl:t})));const $=/*@__PURE__*/ l({domain:/*@__PURE__*/ c(`STARBURST_GALAXY_DOMAIN`),clientId:/*@__PURE__*/ c(`STARBURST_GALAXY_CLIENT_ID`),clientSecret:/*@__PURE__*/ s(`STARBURST_GALAXY_CLIENT_SECRET`)}).pipe(/*@__PURE__*/ q.mapError(()=>new U({message:`STARBURST_GALAXY_DOMAIN, STARBURST_GALAXY_CLIENT_ID and STARBURST_GALAXY_CLIENT_SECRET environment variables are required`})));const Qe=/*@__PURE__*/ X.effect(Credentials,/*@__PURE__*/ q.flatMap($,makeClientCredentials));const $e=/try again in (\d+) seconds?/i;const rateLimited=e=>{if(e.status!==429)return void 0;const t=$e.exec(e.message)?.[1];const n=t===void 0?Ae(e.headers):Q.seconds(Number(t));return new G({message:e.message,retryAfter:n!==void 0&&Q.toMillis(n)>0?n:void 0})};const et=/*@__PURE__*/ De({credentials:/*@__PURE__*/ q.flatten(Credentials),baseUrl:e=>e.apiBaseUrl,headers:e=>({Authorization:`Bearer ${Ke.value(e.accessToken)}`}),classifyError:rateLimited,unknownError:e=>new UnknownStarburstGalaxyError(ke(e)),parseError:({body:e,cause:t})=>new StarburstGalaxyParseError({body:e,cause:t})});var Retry=class extends (/*@__PURE__*/ K.Service()(`StarburstGalaxyRetry`)){};const policy=e=>q.provide(X.succeed(Retry,e));const tt=/*@__PURE__*/ q.provide(/*@__PURE__*/ X.succeed(Retry,{while:()=>false}));const nt=/*@__PURE__*/ policy(d);const rt=/*@__PURE__*/ policy(f);export{He as Ad,Ue as Bd,ne as Ca,e as a,je as ad,t as b,Me as bd,Credentials as credentials$Credentials,Qe as credentials$CredentialsFromEnv,fromAccessToken as credentials$fromAccessToken,fromClientCredentials as credentials$fromClientCredentials,makeClientCredentials as credentials$makeClientCredentials,B as errors$API_ERRORS,V as errors$BadGateway,H as errors$BadRequest,U as errors$ConfigError,W as errors$Conflict,ue as errors$DEFAULT_ERRORS,de as errors$Forbidden,fe as errors$GatewayTimeout,pe as errors$HTTP_STATUS_MAP,me as errors$InternalServerError,he as errors$Locked,ge as errors$NotFound,PreconditionFailed as errors$PreconditionFailed,_e as errors$ServiceUnavailable,StarburstGalaxyParseError as errors$StarburstGalaxyParseError,qe as errors$StarburstGalaxyServiceErrors,TokenRequestFailed as errors$TokenRequestFailed,G as errors$TooManyRequests,ve as errors$Unauthorized,UnknownStarburstGalaxyError as errors$UnknownStarburstGalaxyError,be as errors$UnprocessableEntity,n as f,Ne as jd,Pe as kd,r as l,Fe as ld,i as m,ee as n,Ie as nd,a as o,Le as od,u as pagination$paginateToken,et as protocol$StarburstGalaxyProtocol,rateLimited as protocol$rateLimited,Re as qd,Retry as retry$Retry,ie as retry$capped,ae as retry$jittered,oe as retry$makeDefault,tt as retry$none,policy as retry$policy,nt as retry$throttling,d as retry$throttlingFactory,se as retry$throttlingOptions,rt as retry$transient,f as retry$transientFactory,ce as retry$transientOptions,ze as sd,Be as td,_ as traits$Body,v as traits$FormDataFile,y as traits$Header,b as traits$Http,x as traits$HttpBody,S as traits$KeyDictionary,C as traits$Label,w as traits$Query,Se as traits$RawResponse,Ce as traits$RawResponseRoot,T as traits$ResponseCode,we as traits$SensitiveValue,E as traits$UnionCases,D as traits$applyErrorMatchers,O as traits$bodySymbol,k as traits$errorMatchersSymbol,A as traits$formDataFileSymbol,j as traits$getErrorMatchers,M as traits$headerSymbol,N as traits$httpBodySymbol,P as traits$httpSymbol,F as traits$keyDictionarySymbol,I as traits$labelSymbol,L as traits$querySymbol,Te as traits$rawResponseRootSymbol,Ee as traits$rawResponseSymbol,R as traits$responseCodeSymbol,Oe as traits$sensitiveValueSymbol,z as traits$unionCasesSymbol,Ve as vd,o as ya,te as za};
2
+ //# sourceMappingURL=sdk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sdk.js","names":["Schema.String","Schema.Unknown","Category.withParseError","Schema.Number","Category.withAuthError","D","call","error","named","newError","op","opPaginated","withAuthError","withBadRequestError","withConflictError","withParseError","Redacted$3","String$2","all$1","paginateToken","capped","jittered","makeDefault","throttlingFactory","throttlingOptions","transientFactory","transientOptions","Number$2","String$1","TaggedError$1","Unknown$1","optional$1","Body","FormDataFile","Header","Http","HttpBody","KeyDictionary","Label","Query","ResponseCode","UnionCases","applyErrorMatchers","bodySymbol","errorMatchersSymbol","formDataFileSymbol","getErrorMatchers","headerSymbol","httpBodySymbol","httpSymbol","keyDictionarySymbol","labelSymbol","querySymbol","responseCodeSymbol","unionCasesSymbol","API_ERRORS","BadGateway","BadRequest","ConfigError","Conflict","DEFAULT_ERRORS","Forbidden","GatewayTimeout","HTTP_STATUS_MAP","InternalServerError","Locked","NotFound","ServiceUnavailable","TooManyRequests","Unauthorized","UnknownErrorFields","UnprocessableEntity","originFromConfig","RawResponse","RawResponseRoot","SensitiveValue","rawResponseRootSymbol","rawResponseSymbol","restProtocol","sensitiveValueSymbol","unknownErrorProps","parseRetryAfter","Array","Boolean","NullOr","Number$1","Record","String","Struct","TaggedError","Union","Unknown","at","optional","suspend","Context","Effect","HttpClient","HttpClientRequest","HttpClientResponse","Layer","Schema","Duration","Redacted","StarburstGalaxyServiceErrors","TOKEN_PATH","TOKEN_REFRESH_WINDOW_MS","LOOPBACK","origin","domain","url","TokenResponse","lifetimeMs","expiresInSeconds","client","apiBaseUrl","config","reason","exchange","token","cause","response","refreshing","timeoutMs","envConfig","CredentialsFromEnv","TRY_AGAIN_IN","info","stated","wait","StarburstGalaxyProtocol","creds","optionsOrFactory","none","throttling","transient"],"sources":["../../src/errors.ts","../../src/credentials.ts","../../src/protocol.ts","../../src/retry.ts"],"mappings":"4xFAkDA,IAAa,mBAAb,eACwB,gBACN,gBAAuC,CAAC,CAAC,qBAAsB,CAC3E,QAASA,CACX,CAAC,EACD,CAAC,CAAE,OAAQ,GAAI,CAAC,CAClB,EAAA,AAAE,CAAC,EAOL,IAAa,4BAAb,eACwB,gBAAgD,CAAC,CACrE,8BACAsE,EACF,EAAA,AAAE,CAAC,EAGL,IAAa,0BAAb,eACwB,gBAA8C,CAAC,CACnE,4BACA,CACE,KAAMrE,EACN,MAAOA,CACT,CACF,CAAC,CAAC,KAAKC,EAAuB,EAAA,AAAE,CAAC,EASnC,IAAa,mBAAb,eACwB,gBAAuC,CAAC,CAAC,qBAAsB,CACnF,QAASF,EACT,OAAsB,gBAAgBG,EAAa,CACrD,CAAC,CAAC,CAAC,KAAKC,CAAsB,EAAA,AAAE,CAAC,EAQnC,MAAaoG,GAA+B,CAAC,GAAGjD,EAAY,k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O,IAAA,GAChC,MAAMC,EAASF,GAAa,KAAKC,EAAK,OAAO,CAAC,GAAG,GACjD,MAAME,EACJD,IAAW,IAAA,GAAY/C,GAAgB8C,EAAK,OAAO,EAAIzB,EAAS,QAAQ,OAAO0B,CAAM,CAAC,EACxF,OAAO,IAAI5D,EAAgB,CACzB,QAAS2D,EAAK,QACd,WAAYE,IAAS,IAAA,IAAa3B,EAAS,SAAS2B,CAAI,EAAI,EAAIA,EAAO,IAAA,EACzE,CAAC,CACH,EAEA,MAAaC,GAAwC,iBAAa,CAGhE,YAA2B,gBAAO,QAAQ,WAAW,EACrD,QAAU,GAAUC,EAAM,WAC1B,QAAU,IAAW,CACnB,cAAe,UAAU5B,GAAS,MAAM4B,EAAM,WAAW,GAC3D,GAKA,cAAe,YAGf,aAAe,GAAS,IAAI,4BAA4BnD,GAAkB+C,CAAI,CAAC,EAC/E,YAAa,CAAE,OAAM,WAAY,IAAI,0BAA0B,CAAE,OAAM,OAAM,CAAC,CAChF,CAAC,EC3DD,IAAa,MAAb,eAAyC,gBAAQ,QAAuB,CAAC,CAAC,sBAAsB,EAAA,AAAE,CAAC,EAGnG,MAAa,OAAU,GACrB/B,EAAO,QAAQI,EAAM,QAAQ,MAAOgC,CAAgB,CAAC,EAGvD,MAAaC,GAAqB,gBAAO,QACzB,gBAAM,QAAQ,MAAO,CAAE,UAAa,KAAM,CAAC,CAC3D,EAGA,MAAaC,GAA2B,qBAAO/G,CAAiB,EAGhE,MAAagH,GAA0B,qBAAO9G,CAAgB"}
@@ -0,0 +1,84 @@
1
+ import { ConfigError } from "@distilled.cloud/core/errors";
2
+ /**
3
+ * Starburst Galaxy credentials -- hand-written.
4
+ *
5
+ * Galaxy's public API is served from each account's own host
6
+ * (`https://<account>.galaxy.starburst.io`) and authenticates with OAuth 2.0
7
+ * client credentials: a service account's client ID and secret are
8
+ * exchanged at `POST https://<account-domain>/oauth/v2/token` (HTTP Basic
9
+ * auth, `grant_type=client_credentials`) for an access token sent as
10
+ * `Authorization: Bearer <token>`. Access tokens last 10 minutes
11
+ * (https://docs.starburst.io/starburst-galaxy/developer-tools/api/api-auth-token.html).
12
+ *
13
+ * The `Credentials` service holds an *effect* that resolves the current
14
+ * credentials; the protocol resolves it per request on the calling
15
+ * fiber. The client-credentials layers exchange through the provided
16
+ * `HttpClient` on first use, reuse the token, and exchange again shortly
17
+ * before it expires, so long-running programs keep working past the token
18
+ * lifetime. Each layer owns its cache, and concurrent resolutions of a cold
19
+ * or stale cache share one exchange.
20
+ *
21
+ * A layer here reads and checks its configuration when it is built: a
22
+ * missing variable or a domain that is not an HTTPS host is a `ConfigError`
23
+ * at setup, and no call fails for it. The service's effect can still fail
24
+ * with {@link TokenRequestFailed} when the token request it makes at run
25
+ * time fails.
26
+ */
27
+ import * as Context from "effect/Context";
28
+ import * as Effect from "effect/Effect";
29
+ import * as HttpClient from "effect/http/HttpClient";
30
+ import * as Layer from "effect/Layer";
31
+ import type * as Redacted from "effect/Redacted";
32
+ import { TokenRequestFailed } from "./errors.ts";
33
+ /** What every request is built from. */
34
+ export interface Config {
35
+ readonly accessToken: Redacted.Redacted<string>;
36
+ /** `https://<account-domain>`, no trailing slash. */
37
+ readonly apiBaseUrl: string;
38
+ }
39
+ declare const Credentials_base: Context.ServiceClass<Credentials, "StarburstGalaxyCredentials", Effect.Effect<Config, TokenRequestFailed, never>>;
40
+ export declare class Credentials extends /*@__PURE__*/ Credentials_base {
41
+ }
42
+ /** A Galaxy service account's OAuth client credentials. */
43
+ export interface ClientCredentials {
44
+ /** The account domain (`yourco.galaxy.starburst.io`) or its `https://` origin. */
45
+ readonly domain: string;
46
+ readonly clientId: string;
47
+ readonly clientSecret: Redacted.Redacted<string>;
48
+ }
49
+ /**
50
+ * Builds the OAuth client-credentials token cache. The returned effect posts
51
+ * the exchange through the captured `HttpClient` and reuses the token for
52
+ * {@link reuseFor} its `expires_in`. Concurrent resolutions of a cold or
53
+ * stale cache share one exchange (core `refreshing`); a failed exchange is
54
+ * not cached. The domain is checked here, once, before any exchange: a
55
+ * malformed one fails this effect and no request is made.
56
+ * Exchange errors carry the status, never the secret or a token.
57
+ */
58
+ export declare const makeClientCredentials: (config: ClientCredentials) => Effect.Effect<Effect.Effect<Config, TokenRequestFailed>, ConfigError, HttpClient.HttpClient>;
59
+ /**
60
+ * Layer from a service account's client credentials. The domain is checked
61
+ * when the layer is built. The access token is requested through the
62
+ * provided `HttpClient` on first use and refreshed shortly before it
63
+ * expires.
64
+ */
65
+ export declare const fromClientCredentials: (config: ClientCredentials) => Layer.Layer<Credentials, ConfigError, HttpClient.HttpClient>;
66
+ /**
67
+ * Layer from an access token already held (no refresh). The domain is
68
+ * checked when the layer is built.
69
+ */
70
+ export declare const fromAccessToken: (config: {
71
+ readonly domain: string;
72
+ readonly accessToken: Redacted.Redacted<string>;
73
+ }) => Layer.Layer<Credentials, ConfigError>;
74
+ /**
75
+ * Reads STARBURST_GALAXY_DOMAIN, STARBURST_GALAXY_CLIENT_ID and
76
+ * STARBURST_GALAXY_CLIENT_SECRET through `@distilled.cloud/core/config`, so
77
+ * a provided `ConfigProvider` supplies them, and exchanges them for a cached
78
+ * access token on first use. The variables are read, and the domain
79
+ * checked, once: when the layer is built. The token cache belongs to the
80
+ * built layer.
81
+ */
82
+ export declare const CredentialsFromEnv: Layer.Layer<Credentials, ConfigError, HttpClient.HttpClient>;
83
+ export {};
84
+ //# sourceMappingURL=credentials.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credentials.d.ts","sources":["../src/credentials.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAG3D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,UAAU,MAAM,wBAAwB,CAAC;AAGrD,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OA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AAU,CAIzF,CAAC"}
@@ -0,0 +1 @@
1
+ export { credentials$Credentials as Credentials, credentials$CredentialsFromEnv as CredentialsFromEnv, credentials$fromAccessToken as fromAccessToken, credentials$fromClientCredentials as fromClientCredentials, credentials$makeClientCredentials as makeClientCredentials } from "./_bundle/sdk.js";
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Starburst Galaxy error types.
3
+ *
4
+ * Re-exports the common HTTP errors from core and adds the one status Galaxy
5
+ * documents that core's shared map has no entry for (412), plus the
6
+ * unknown-error and parse-error wrappers.
7
+ *
8
+ * Galaxy failures carry `{ message, ... }` bodies. Operations that declare a
9
+ * status get the generated per-status class for it, which keeps `message`
10
+ * and the whole `body` (where `BadRequest`'s `fields` and
11
+ * `FailedPrecondition`'s `detail` are read). Every other failure is
12
+ * dispatched on its status by `StarburstGalaxyProtocol` to the classes
13
+ * here, which carry `message`. Both share their `_tag`s, so `catchTag`
14
+ * works against either.
15
+ */
16
+ export { BadGateway, BadRequest, Conflict, ConfigError, Forbidden, GatewayTimeout, InternalServerError, Locked, NotFound, ServiceUnavailable, TooManyRequests, Unauthorized, UnprocessableEntity, HTTP_STATUS_MAP, DEFAULT_ERRORS, API_ERRORS, } from "@distilled.cloud/core/errors";
17
+ export type { DefaultErrors } from "@distilled.cloud/core/errors";
18
+ import * as Schema from "@distilled.cloud/core/schema-lite-typed";
19
+ declare const PreconditionFailed_base: Schema.TaggedErrorClass<"PreconditionFailed", {
20
+ readonly message: import("effect/Schema").String;
21
+ }>;
22
+ /**
23
+ * HTTP 412 -- `FailedPrecondition`: the request cannot run in the
24
+ * resource's current state (for example deleting a data domain that still
25
+ * holds data products, or creating a cluster the account cannot host yet).
26
+ * Retrying unchanged keeps failing until that state changes, so it is not
27
+ * retryable. Like the generated per-operation `PreconditionFailed` (core
28
+ * derives categories from the status, and 412 has none), it carries no
29
+ * category, so handling by `_tag` or by category does not depend on
30
+ * whether an operation declares 412.
31
+ */
32
+ export declare class PreconditionFailed extends /*@__PURE__*/ PreconditionFailed_base {
33
+ }
34
+ declare const UnknownStarburstGalaxyError_base: Schema.TaggedErrorClass<"UnknownStarburstGalaxyError", {
35
+ status: import("effect/Schema").Number;
36
+ code: import("effect/Schema").optional<import("effect/Schema").String>;
37
+ message: import("effect/Schema").optional<import("effect/Schema").String>;
38
+ body: import("effect/Schema").Unknown;
39
+ }>;
40
+ /**
41
+ * Unknown Starburst Galaxy error -- returned when a failed response's HTTP
42
+ * status has no mapped error class. Carries that `status`, Galaxy's
43
+ * `message` and the whole `body`.
44
+ */
45
+ export declare class UnknownStarburstGalaxyError extends /*@__PURE__*/ UnknownStarburstGalaxyError_base {
46
+ }
47
+ declare const StarburstGalaxyParseError_base: Schema.TaggedErrorClass<"StarburstGalaxyParseError", {
48
+ readonly body: import("effect/Schema").Unknown;
49
+ readonly cause: import("effect/Schema").Unknown;
50
+ }> & (new (...args: any[]) => {
51
+ "@distilled.cloud/error/categories": {
52
+ ParseError: true;
53
+ };
54
+ });
55
+ /** A 2xx body that does not match the output schema (strict response validation). */
56
+ export declare class StarburstGalaxyParseError extends /*@__PURE__*/ StarburstGalaxyParseError_base {
57
+ }
58
+ declare const TokenRequestFailed_base: Schema.TaggedErrorClass<"TokenRequestFailed", {
59
+ readonly message: import("effect/Schema").String;
60
+ readonly status: import("effect/Schema").optional<import("effect/Schema").Number>;
61
+ }> & (new (...args: any[]) => {
62
+ "@distilled.cloud/error/categories": {
63
+ AuthError: true;
64
+ };
65
+ });
66
+ /**
67
+ * The OAuth token request the credentials make failed: Galaxy could not
68
+ * be reached, refused the client credentials, answered with something that
69
+ * is not a token, or did not answer in time.
70
+ * `status` is the token endpoint's HTTP status, when it answered. It is a
71
+ * failure of a request at run time, so it is not a `ConfigError`.
72
+ */
73
+ export declare class TokenRequestFailed extends /*@__PURE__*/ TokenRequestFailed_base {
74
+ }
75
+ /**
76
+ * The errors declared on the Galaxy service: any operation can return them,
77
+ * and every generated operation lists them as its `serviceErrors`. Each of
78
+ * core's status classes, and {@link PreconditionFailed} for 412, matched by
79
+ * its status like an operation's own errors.
80
+ */
81
+ export declare const StarburstGalaxyServiceErrors: readonly [typeof import("@distilled.cloud/core/errors").Unauthorized, typeof import("@distilled.cloud/core/errors").Forbidden, typeof import("@distilled.cloud/core/errors").NotFound, typeof import("@distilled.cloud/core/errors").BadRequest, typeof import("@distilled.cloud/core/errors").Conflict, typeof import("@distilled.cloud/core/errors").UnprocessableEntity, typeof import("@distilled.cloud/core/errors").TooManyRequests, typeof import("@distilled.cloud/core/errors").Locked, typeof import("@distilled.cloud/core/errors").InternalServerError, typeof import("@distilled.cloud/core/errors").BadGateway, typeof import("@distilled.cloud/core/errors").ServiceUnavailable, typeof import("@distilled.cloud/core/errors").GatewayTimeout, typeof PreconditionFailed];
82
+ export type StarburstGalaxyServiceError = InstanceType<(typeof StarburstGalaxyServiceErrors)[number]>;
83
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EACL,UAAU,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACX,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,MAAM,EACN,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,UAAU,GACX,MAAM,8BAA8B,CAAC;AACtC,YAAY,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAIlE,OAAO,KAAK,MAAM,MAAM,yCAAyC,CAAC;;;;AAGlE;;;;;;;;;GASG;AACH,qBAAa,kBACX,SAAQ,aAAa,CAAC,uBAKrB;CAAG;;;;;;;AAEN;;;;GAIG;AACH,qBAAa,2BACX,SAAQ,aAAa,CAAC,gCAGrB;CAAG;;;;;;;;;AAEN,qFAAqF;AACrF,qBAAa,yBACX,SAAQ,aAAa,CAAC,8BAMS;CAAG;;;;;;;;;AAEpC;;;;;;GAMG;AACH,qBAAa,kBACX,SAAQ,aAAa,CAAC,uBAGS;CAAG;AAEpC;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,0vBAA+C,CAAC;AACzF,MAAM,MAAM,2BAA2B,GAAG,YAAY,CACpD,CAAC,OAAO,4BAA4B,CAAC,CAAC,MAAM,CAAC,CAC9C,CAAC"}
package/lib/errors.js ADDED
@@ -0,0 +1 @@
1
+ export { errors$API_ERRORS as API_ERRORS, errors$BadGateway as BadGateway, errors$BadRequest as BadRequest, errors$ConfigError as ConfigError, errors$Conflict as Conflict, errors$DEFAULT_ERRORS as DEFAULT_ERRORS, errors$Forbidden as Forbidden, errors$GatewayTimeout as GatewayTimeout, errors$HTTP_STATUS_MAP as HTTP_STATUS_MAP, errors$InternalServerError as InternalServerError, errors$Locked as Locked, errors$NotFound as NotFound, errors$PreconditionFailed as PreconditionFailed, errors$ServiceUnavailable as ServiceUnavailable, errors$StarburstGalaxyParseError as StarburstGalaxyParseError, errors$StarburstGalaxyServiceErrors as StarburstGalaxyServiceErrors, errors$TokenRequestFailed as TokenRequestFailed, errors$TooManyRequests as TooManyRequests, errors$Unauthorized as Unauthorized, errors$UnknownStarburstGalaxyError as UnknownStarburstGalaxyError, errors$UnprocessableEntity as UnprocessableEntity } from "./_bundle/sdk.js";
package/lib/index.d.ts ADDED
@@ -0,0 +1,42 @@
1
+ /**
2
+ * @distilled.cloud/starburst-galaxy -- Starburst Galaxy SDK for Effect.
3
+ *
4
+ * `./services` is generated by `scripts/generate.ts` from the Smithy models
5
+ * that `scripts/convert.ts` converts from Galaxy's public OpenAPI documents,
6
+ * mirrored at `specs/spec-mirror-starburst-galaxy/specs/`. Everything else in
7
+ * this folder is hand-written.
8
+ *
9
+ * One module per Galaxy API service: `cluster`, `catalog`, `role`,
10
+ * `privilege`, `serviceAccount`, `dataProduct`, `tag`, ....
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * import { Effect, Layer } from "effect";
15
+ * import * as FetchHttpClient from "effect/http/FetchHttpClient";
16
+ * import * as StarburstGalaxy from "@distilled.cloud/starburst-galaxy";
17
+ * import * as Cluster from "@distilled.cloud/starburst-galaxy/cluster";
18
+ *
19
+ * const program = Effect.gen(function* () {
20
+ * const { result } = yield* Cluster.listClusters({});
21
+ * const [first] = result;
22
+ * if (first === undefined) return undefined;
23
+ *
24
+ * const cluster = yield* Cluster.getCluster({ clusterId: first.clusterId });
25
+ * yield* Effect.log(`${cluster.name}: ${cluster.clusterState} at ${cluster.trinoUri}`);
26
+ * return cluster;
27
+ * });
28
+ *
29
+ * const Live = Layer.mergeAll(
30
+ * StarburstGalaxy.CredentialsFromEnv,
31
+ * ).pipe(Layer.provideMerge(FetchHttpClient.layer));
32
+ *
33
+ * program.pipe(Effect.provide(Live), Effect.runPromise);
34
+ * ```
35
+ */
36
+ export * from "./credentials.ts";
37
+ export * from "./errors.ts";
38
+ export * as T from "./traits.ts";
39
+ export { StarburstGalaxyProtocol, type StarburstGalaxyOpError, type StarburstGalaxyOpContext, } from "./protocol.ts";
40
+ export { paginateToken } from "./pagination.ts";
41
+ export * as Retry from "./retry.ts";
42
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,OAAO,KAAK,CAAC,MAAM,aAAa,CAAC;AACjC,OAAO,EACL,uBAAuB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,GAC9B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC"}
package/lib/index.js ADDED
@@ -0,0 +1,6 @@
1
+ export * from "./credentials.js";
2
+ export * from "./errors.js";
3
+ export * as T from "./traits.js";
4
+ export { StarburstGalaxyProtocol } from "./protocol.js";
5
+ export { paginateToken } from "./pagination.js";
6
+ export * as Retry from "./retry.js";
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Starburst Galaxy pagination -- hand-written.
3
+ *
4
+ * List operations page by token: `pageToken` in, `nextPageToken` out (`""`
5
+ * on the last page), items under `result`. `scripts/convert.ts` stamps
6
+ * `smithy.api#paginated` on them; generated operations pass core's
7
+ * {@link paginateToken} strategy to `API.makePaginated`.
8
+ */
9
+ export { paginateToken } from "@distilled.cloud/core/pagination";
10
+ //# sourceMappingURL=pagination.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pagination.d.ts","sources":["../src/pagination.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC"}
@@ -0,0 +1 @@
1
+ export { pagination$paginateToken as paginateToken } from "./_bundle/sdk.js";