@distilled.cloud/namespacelabs 0.0.0 → 1.0.0-rc.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +130 -4
- package/lib/.lazy.json +1 -0
- package/lib/_bundle/lazy.js +4 -0
- package/lib/_bundle/sdk.js +2 -0
- package/lib/_bundle/sdk.js.map +1 -0
- package/lib/credentials.d.ts +73 -0
- package/lib/credentials.d.ts.map +1 -0
- package/lib/credentials.js +1 -0
- package/lib/errors.d.ts +59 -0
- package/lib/errors.d.ts.map +1 -0
- package/lib/errors.js +1 -0
- package/lib/index.d.ts +44 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +6 -0
- package/lib/pagination.d.ts +2 -0
- package/lib/pagination.d.ts.map +1 -0
- package/lib/pagination.js +1 -0
- package/lib/protocol.d.ts +19 -0
- package/lib/protocol.d.ts.map +1 -0
- package/lib/protocol.js +1 -0
- package/lib/retry.d.ts +12 -0
- package/lib/retry.d.ts.map +1 -0
- package/lib/retry.js +1 -0
- package/lib/services/buildkite_jobs.d.ts +129 -0
- package/lib/services/buildkite_jobs.d.ts.map +1 -0
- package/lib/services/buildkite_jobs.js +2 -0
- package/lib/services/buildkite_jobs.js.map +1 -0
- package/lib/services/buildkite_queue.d.ts +186 -0
- package/lib/services/buildkite_queue.d.ts.map +1 -0
- package/lib/services/buildkite_queue.js +2 -0
- package/lib/services/buildkite_queue.js.map +1 -0
- package/lib/services/index.d.ts +3 -0
- package/lib/services/index.d.ts.map +1 -0
- package/lib/services/index.js +2 -0
- package/lib/services.lazy/buildkite_jobs.js +1 -0
- package/lib/services.lazy/buildkite_queue.js +1 -0
- package/lib/services.lazy/index.js +3 -0
- package/lib/traits.d.ts +3 -0
- package/lib/traits.d.ts.map +1 -0
- package/lib/traits.js +1 -0
- package/lib/unstable-services/artifacts.d.ts +268 -0
- package/lib/unstable-services/artifacts.d.ts.map +1 -0
- package/lib/unstable-services/artifacts.js +2 -0
- package/lib/unstable-services/artifacts.js.map +1 -0
- package/lib/unstable-services/audit.d.ts +157 -0
- package/lib/unstable-services/audit.d.ts.map +1 -0
- package/lib/unstable-services/audit.js +2 -0
- package/lib/unstable-services/audit.js.map +1 -0
- package/lib/unstable-services/bazel.d.ts +181 -0
- package/lib/unstable-services/bazel.d.ts.map +1 -0
- package/lib/unstable-services/bazel.js +2 -0
- package/lib/unstable-services/bazel.js.map +1 -0
- package/lib/unstable-services/bazel_cache.d.ts +126 -0
- package/lib/unstable-services/bazel_cache.d.ts.map +1 -0
- package/lib/unstable-services/bazel_cache.js +2 -0
- package/lib/unstable-services/bazel_cache.js.map +1 -0
- package/lib/unstable-services/builder.d.ts +242 -0
- package/lib/unstable-services/builder.d.ts.map +1 -0
- package/lib/unstable-services/builder.js +2 -0
- package/lib/unstable-services/builder.js.map +1 -0
- package/lib/unstable-services/compute.d.ts +1124 -0
- package/lib/unstable-services/compute.d.ts.map +1 -0
- package/lib/unstable-services/compute.js +47 -0
- package/lib/unstable-services/compute.js.map +1 -0
- package/lib/unstable-services/compute_command.d.ts +120 -0
- package/lib/unstable-services/compute_command.d.ts.map +1 -0
- package/lib/unstable-services/compute_command.js +2 -0
- package/lib/unstable-services/compute_command.js.map +1 -0
- package/lib/unstable-services/compute_observability.d.ts +165 -0
- package/lib/unstable-services/compute_observability.d.ts.map +1 -0
- package/lib/unstable-services/compute_observability.js +2 -0
- package/lib/unstable-services/compute_observability.js.map +1 -0
- package/lib/unstable-services/compute_storage.d.ts +379 -0
- package/lib/unstable-services/compute_storage.d.ts.map +1 -0
- package/lib/unstable-services/compute_storage.js +33 -0
- package/lib/unstable-services/compute_storage.js.map +1 -0
- package/lib/unstable-services/compute_usage.d.ts +283 -0
- package/lib/unstable-services/compute_usage.d.ts.map +1 -0
- package/lib/unstable-services/compute_usage.js +2 -0
- package/lib/unstable-services/compute_usage.js.map +1 -0
- package/lib/unstable-services/egress.d.ts +191 -0
- package/lib/unstable-services/egress.d.ts.map +1 -0
- package/lib/unstable-services/egress.js +2 -0
- package/lib/unstable-services/egress.js.map +1 -0
- package/lib/unstable-services/experimental_compute_reservation.d.ts +672 -0
- package/lib/unstable-services/experimental_compute_reservation.d.ts.map +1 -0
- package/lib/unstable-services/experimental_compute_reservation.js +23 -0
- package/lib/unstable-services/experimental_compute_reservation.js.map +1 -0
- package/lib/unstable-services/experimental_remote_results.d.ts +496 -0
- package/lib/unstable-services/experimental_remote_results.d.ts.map +1 -0
- package/lib/unstable-services/experimental_remote_results.js +2 -0
- package/lib/unstable-services/experimental_remote_results.js.map +1 -0
- package/lib/unstable-services/github_image.d.ts +162 -0
- package/lib/unstable-services/github_image.d.ts.map +1 -0
- package/lib/unstable-services/github_image.js +2 -0
- package/lib/unstable-services/github_image.js.map +1 -0
- package/lib/unstable-services/github_jobs.d.ts +183 -0
- package/lib/unstable-services/github_jobs.d.ts.map +1 -0
- package/lib/unstable-services/github_jobs.js +2 -0
- package/lib/unstable-services/github_jobs.js.map +1 -0
- package/lib/unstable-services/github_profile.d.ts +296 -0
- package/lib/unstable-services/github_profile.d.ts.map +1 -0
- package/lib/unstable-services/github_profile.js +2 -0
- package/lib/unstable-services/github_profile.js.map +1 -0
- package/lib/unstable-services/gradle_cache.d.ts +125 -0
- package/lib/unstable-services/gradle_cache.d.ts.map +1 -0
- package/lib/unstable-services/gradle_cache.js +2 -0
- package/lib/unstable-services/gradle_cache.js.map +1 -0
- package/lib/unstable-services/httpcache.d.ts +125 -0
- package/lib/unstable-services/httpcache.d.ts.map +1 -0
- package/lib/unstable-services/httpcache.js +2 -0
- package/lib/unstable-services/httpcache.js.map +1 -0
- package/lib/unstable-services/iam_tenant.d.ts +457 -0
- package/lib/unstable-services/iam_tenant.d.ts.map +1 -0
- package/lib/unstable-services/iam_tenant.js +45 -0
- package/lib/unstable-services/iam_tenant.js.map +1 -0
- package/lib/unstable-services/iam_tenant_membership.d.ts +114 -0
- package/lib/unstable-services/iam_tenant_membership.d.ts.map +1 -0
- package/lib/unstable-services/iam_tenant_membership.js +2 -0
- package/lib/unstable-services/iam_tenant_membership.js.map +1 -0
- package/lib/unstable-services/iam_token.d.ts +257 -0
- package/lib/unstable-services/iam_token.d.ts.map +1 -0
- package/lib/unstable-services/iam_token.js +2 -0
- package/lib/unstable-services/iam_token.js.map +1 -0
- package/lib/unstable-services/image.d.ts +222 -0
- package/lib/unstable-services/image.d.ts.map +1 -0
- package/lib/unstable-services/image.js +2 -0
- package/lib/unstable-services/image.js.map +1 -0
- package/lib/unstable-services/index.d.ts +28 -0
- package/lib/unstable-services/index.d.ts.map +1 -0
- package/lib/unstable-services/index.js +27 -0
- package/lib/unstable-services/private_devbox.d.ts +1180 -0
- package/lib/unstable-services/private_devbox.d.ts.map +1 -0
- package/lib/unstable-services/private_devbox.js +81 -0
- package/lib/unstable-services/private_devbox.js.map +1 -0
- package/lib/unstable-services/private_user_sessions.d.ts +145 -0
- package/lib/unstable-services/private_user_sessions.d.ts.map +1 -0
- package/lib/unstable-services/private_user_sessions.js +2 -0
- package/lib/unstable-services/private_user_sessions.js.map +1 -0
- package/lib/unstable-services/registry.d.ts +373 -0
- package/lib/unstable-services/registry.d.ts.map +1 -0
- package/lib/unstable-services/registry.js +34 -0
- package/lib/unstable-services/registry.js.map +1 -0
- package/lib/unstable-services/testing.d.ts +160 -0
- package/lib/unstable-services/testing.d.ts.map +1 -0
- package/lib/unstable-services/testing.js +2 -0
- package/lib/unstable-services/testing.js.map +1 -0
- package/lib/unstable-services/vault.d.ts +203 -0
- package/lib/unstable-services/vault.d.ts.map +1 -0
- package/lib/unstable-services/vault.js +2 -0
- package/lib/unstable-services/vault.js.map +1 -0
- package/lib/unstable-services.lazy/artifacts.js +1 -0
- package/lib/unstable-services.lazy/audit.js +1 -0
- package/lib/unstable-services.lazy/bazel.js +1 -0
- package/lib/unstable-services.lazy/bazel_cache.js +1 -0
- package/lib/unstable-services.lazy/builder.js +1 -0
- package/lib/unstable-services.lazy/compute.js +4 -0
- package/lib/unstable-services.lazy/compute_command.js +1 -0
- package/lib/unstable-services.lazy/compute_observability.js +1 -0
- package/lib/unstable-services.lazy/compute_storage.js +4 -0
- package/lib/unstable-services.lazy/compute_usage.js +1 -0
- package/lib/unstable-services.lazy/egress.js +1 -0
- package/lib/unstable-services.lazy/experimental_compute_reservation.js +4 -0
- package/lib/unstable-services.lazy/experimental_remote_results.js +1 -0
- package/lib/unstable-services.lazy/github_image.js +1 -0
- package/lib/unstable-services.lazy/github_jobs.js +1 -0
- package/lib/unstable-services.lazy/github_profile.js +1 -0
- package/lib/unstable-services.lazy/gradle_cache.js +1 -0
- package/lib/unstable-services.lazy/httpcache.js +1 -0
- package/lib/unstable-services.lazy/iam_tenant.js +4 -0
- package/lib/unstable-services.lazy/iam_tenant_membership.js +1 -0
- package/lib/unstable-services.lazy/iam_token.js +1 -0
- package/lib/unstable-services.lazy/image.js +1 -0
- package/lib/unstable-services.lazy/index.js +3 -0
- package/lib/unstable-services.lazy/private_devbox.js +4 -0
- package/lib/unstable-services.lazy/private_user_sessions.js +1 -0
- package/lib/unstable-services.lazy/registry.js +4 -0
- package/lib/unstable-services.lazy/testing.js +1 -0
- package/lib/unstable-services.lazy/vault.js +1 -0
- package/package.json +89 -2
- package/src/credentials.ts +208 -0
- package/src/errors.ts +71 -0
- package/src/index.ts +50 -0
- package/src/pagination.ts +1 -0
- package/src/protocol.ts +83 -0
- package/src/retry.ts +28 -0
- package/src/services/buildkite_jobs.ts +230 -0
- package/src/services/buildkite_queue.ts +453 -0
- package/src/services/index.ts +3 -0
- package/src/traits.ts +36 -0
- package/src/unstable-services/artifacts.ts +769 -0
- package/src/unstable-services/audit.ts +323 -0
- package/src/unstable-services/bazel.ts +423 -0
- package/src/unstable-services/bazel_cache.ts +219 -0
- package/src/unstable-services/builder.ts +576 -0
- package/src/unstable-services/compute.ts +2991 -0
- package/src/unstable-services/compute_command.ts +220 -0
- package/src/unstable-services/compute_observability.ts +436 -0
- package/src/unstable-services/compute_storage.ts +1167 -0
- package/src/unstable-services/compute_usage.ts +738 -0
- package/src/unstable-services/egress.ts +516 -0
- package/src/unstable-services/experimental_compute_reservation.ts +1499 -0
- package/src/unstable-services/experimental_remote_results.ts +1165 -0
- package/src/unstable-services/github_image.ts +301 -0
- package/src/unstable-services/github_jobs.ts +389 -0
- package/src/unstable-services/github_profile.ts +729 -0
- package/src/unstable-services/gradle_cache.ts +271 -0
- package/src/unstable-services/httpcache.ts +271 -0
- package/src/unstable-services/iam_tenant.ts +1720 -0
- package/src/unstable-services/iam_tenant_membership.ts +253 -0
- package/src/unstable-services/iam_token.ts +788 -0
- package/src/unstable-services/image.ts +602 -0
- package/src/unstable-services/index.ts +28 -0
- package/src/unstable-services/private_devbox.ts +4256 -0
- package/src/unstable-services/private_user_sessions.ts +410 -0
- package/src/unstable-services/registry.ts +1242 -0
- package/src/unstable-services/testing.ts +394 -0
- package/src/unstable-services/vault.ts +522 -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,135 @@
|
|
|
1
1
|
# @distilled.cloud/namespacelabs
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Effect-native [Namespace](https://namespace.so) SDK, generated from the
|
|
4
|
+
protobuf API Namespace publishes at
|
|
5
|
+
[buf.build/namespace/cloud](https://buf.build/namespace/cloud).
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
## Spec source
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
Namespace does not publish OpenAPI. Its API is defined in protobuf and served
|
|
10
|
+
over gRPC and Connect, and the Buf Schema Registry module is what the `nsc`
|
|
11
|
+
CLI, the Go SDK and the official TypeScript SDK are generated from. The module's
|
|
12
|
+
own files (`proto/namespace/**`) are mirrored; its one dependency, Bazel's
|
|
13
|
+
build-event protos, is not read by anything the generator converts.
|
|
8
14
|
|
|
9
|
-
|
|
15
|
+
Convert writes one Smithy model per proto service and maps each unary RPC to
|
|
16
|
+
`POST /<package>.<Service>/<Method>` with a proto3 JSON body (camelCase
|
|
17
|
+
fields, 64-bit integers as strings, `bytes` as base64). Streaming RPCs are
|
|
18
|
+
skipped; most have a polling or `*Sync` counterpart. Five services in the
|
|
19
|
+
module answer 404 on every `namespaceapis.com` host (`ManagementService`,
|
|
20
|
+
the devbox `AgentService` and `DevBoxExtraService`, `private.instance` and
|
|
21
|
+
`experimental.remote.ExecutionService`) and are not generated.
|
|
22
|
+
|
|
23
|
+
The package is `namespacelabs` (Namespace's GitHub org and npm scope) rather
|
|
24
|
+
than `namespace`, so it does not shadow Alchemy's own `Namespace` export when
|
|
25
|
+
both are imported.
|
|
26
|
+
|
|
27
|
+
## Services
|
|
28
|
+
|
|
29
|
+
The module name is the proto package plus the service, so `ComputeService`
|
|
30
|
+
is `compute`, `CommandService` is `compute_command`, `TokenService` is
|
|
31
|
+
`iam_token` and the devbox API is `private_devbox`; the barrel exports them
|
|
32
|
+
in camelCase (`computeCommand`, `iamToken`, `privateDevbox`).
|
|
33
|
+
|
|
34
|
+
A service in a `v1beta` or `namespace.experimental.*` proto package is not
|
|
35
|
+
GA, so it is under `unstable/`:
|
|
36
|
+
`@distilled.cloud/namespacelabs/unstable/compute`. That is every service
|
|
37
|
+
except `buildkiteJobs` and `buildkiteQueue` (package `namespace.cloud.buildkite`),
|
|
38
|
+
which are `@distilled.cloud/namespacelabs/buildkite_jobs` and
|
|
39
|
+
`@distilled.cloud/namespacelabs/buildkite_queue`.
|
|
40
|
+
|
|
41
|
+
| Host | Services |
|
|
42
|
+
| --- | --- |
|
|
43
|
+
| `https://<region>.compute.namespaceapis.com` | `compute`, `computeCommand`, `computeStorage`, `computeUsage`, `computeObservability`, `builder`, `experimentalComputeReservation` |
|
|
44
|
+
| `https://<region>.storage.namespaceapis.com` | `artifacts` |
|
|
45
|
+
| `https://global.namespaceapis.com` | `iamTenant`, `iamTenantMembership`, `iamToken`, `registry`, `vault`, `image`, `egress`, `bazel`, `bazelCache`, `gradleCache`, `httpcache`, `buildkiteJobs`, `buildkiteQueue`, `testing`, `audit`, `experimentalRemoteResults` |
|
|
46
|
+
| `https://private-api.global.namespaceapis.com` | `privateDevbox`, `privateUserSessions`, `githubProfile`, `githubJobs`, `githubImage` |
|
|
47
|
+
|
|
48
|
+
The protocol picks the host from the operation's proto package. The
|
|
49
|
+
`namespace.private.*` services are in the public module and used by the
|
|
50
|
+
official SDKs, but Namespace lists them under no stability promise.
|
|
51
|
+
|
|
52
|
+
## Installation
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
npm install @distilled.cloud/namespacelabs effect
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Quick start
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
import { Effect, Layer } from "effect";
|
|
62
|
+
import * as FetchHttpClient from "effect/http/FetchHttpClient";
|
|
63
|
+
import * as NamespaceLabs from "@distilled.cloud/namespacelabs";
|
|
64
|
+
import * as Compute from "@distilled.cloud/namespacelabs/unstable/compute";
|
|
65
|
+
|
|
66
|
+
const program = Effect.gen(function* () {
|
|
67
|
+
const created = yield* Compute.createInstance({
|
|
68
|
+
shape: { virtualCpu: 2, memoryMegabytes: 4096, os: "linux", machineArch: "amd64" },
|
|
69
|
+
deadline: new Date(Date.now() + 10 * 60 * 1000).toISOString(),
|
|
70
|
+
});
|
|
71
|
+
const instanceId = created.metadata?.instanceId;
|
|
72
|
+
if (instanceId === undefined) return undefined;
|
|
73
|
+
const instance = yield* Compute.describeInstance({ instanceId });
|
|
74
|
+
yield* Compute.destroyInstance({ instanceId });
|
|
75
|
+
return instance.metadata?.status;
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
const Live = Layer.mergeAll(
|
|
79
|
+
FetchHttpClient.layer,
|
|
80
|
+
NamespaceLabs.CredentialsFromEnv,
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
program.pipe(Effect.provide(Live), Effect.runPromise);
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Auth
|
|
87
|
+
|
|
88
|
+
`CredentialsFromEnv` sends `NSC_TOKEN` as `Authorization: Bearer`. Mint one
|
|
89
|
+
with `nsc auth generate-dev-token`, `nsc token create --grant ...`, or
|
|
90
|
+
`iamToken.issueTenantTokenWithOIDC` from a CI identity token.
|
|
91
|
+
|
|
92
|
+
Inside a Namespace instance, devbox or GitHub runner the workload token is a
|
|
93
|
+
file instead: `CredentialsFromTokenFile` reads `bearer_token` from
|
|
94
|
+
`NSC_TOKEN_FILE` (default `/var/run/nsc/token.json`) on every call, because
|
|
95
|
+
Namespace refreshes it. The layer needs a `FileSystem`, for example
|
|
96
|
+
`NodeFileSystem.layer` from `@effect/platform-node`. A session token from
|
|
97
|
+
`nsc login` is not a bearer token; exchange it with
|
|
98
|
+
`privateUserSessions.issueTenantTokenFromSession`.
|
|
99
|
+
|
|
100
|
+
Both layers read `NSC_REGION` (default `us`) for the compute and storage hosts
|
|
101
|
+
and `NSC_COMPUTE_URL` (or `NSC_ENDPOINT`, which Namespace sets inside an
|
|
102
|
+
instance), `NSC_STORAGE_URL`, `NSC_GLOBAL_URL` and `NSC_PRIVATE_API_URL` to
|
|
103
|
+
override a host. They read these variables once, when the layer is built. `credentials({ token, region })`, `fromToken(token)` and
|
|
104
|
+
`fromTokenFile(path)` build the same layers in code.
|
|
105
|
+
|
|
106
|
+
## Errors
|
|
107
|
+
|
|
108
|
+
Every operation declares the Connect error codes as typed errors, matched on
|
|
109
|
+
the HTTP status and, where one status covers several codes, on the body's
|
|
110
|
+
`code`: `InvalidArgument`, `FailedPrecondition`, `Unauthenticated`,
|
|
111
|
+
`PermissionDenied`, `NotFound`, `AlreadyExists` and `ResourceExhausted`. Each
|
|
112
|
+
carries `message` and the Connect `body` (`code`, `message`, `details` with the
|
|
113
|
+
request id).
|
|
114
|
+
A response none of them match is one of core's status errors (`BadRequest`,
|
|
115
|
+
`Conflict`, `InternalServerError`, ...). A status core does not map is
|
|
116
|
+
`UnknownNamespaceLabsError` with `code` and `details`.
|
|
117
|
+
|
|
118
|
+
```ts
|
|
119
|
+
import * as Compute from "@distilled.cloud/namespacelabs/unstable/compute";
|
|
120
|
+
|
|
121
|
+
Compute.describeInstance({ instanceId }).pipe(
|
|
122
|
+
Effect.catchTag("NotFound", () => Effect.succeed(undefined)),
|
|
123
|
+
);
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Pagination
|
|
127
|
+
|
|
128
|
+
List operations whose request and response carry a cursor (`listInstances`,
|
|
129
|
+
`privateDevbox.list`, `githubJobs.listJobs`, `audit.listEntries`, the registry
|
|
130
|
+
lists, ...) expose `.pages(input)` and `.items(input)` streams that follow
|
|
131
|
+
`paginationCursor` until the last page.
|
|
132
|
+
|
|
133
|
+
Tokens, vault values, issued private keys and the third-party API keys a
|
|
134
|
+
devbox template carries are `Redacted` in responses and accepted as
|
|
135
|
+
`string | Redacted<string>` in requests.
|
package/lib/.lazy.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"serviceDirs":["unstable-services","services"],"twins":[]}
|
|
@@ -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 s,category$withConflictError as c,category$withParseError as te,category$withServerError as ne,category$withThrottlingError as re,config$Redacted as ie,config$String as l,config$all as u,config$map as d,config$option as f,config$orElse as ae,config$withDefault as p,pagination$paginateCursor as m,retry$capped as oe,retry$jittered as se,retry$makeDefault as ce,retry$throttlingFactory as h,retry$throttlingOptions as le,retry$transientFactory as g,retry$transientOptions as ue,schema_lite_typed$String as _,schema_lite_typed$TaggedError as v,schema_lite_typed$Unknown as y,schema_lite_typed$optional as b,trait$Body as x,trait$FormDataFile as S,trait$Header as C,trait$Http as w,trait$HttpBody as T,trait$KeyDictionary as E,trait$Label as D,trait$Query as O,trait$ResponseCode as k,trait$UnionCases as A,trait$applyErrorMatchers as j,trait$bodySymbol as M,trait$errorMatchersSymbol as N,trait$formDataFileSymbol as P,trait$getErrorMatchers as F,trait$headerSymbol as I,trait$httpBodySymbol as L,trait$httpSymbol as R,trait$keyDictionarySymbol as z,trait$labelSymbol as B,trait$querySymbol as V,trait$responseCodeSymbol as H,trait$unionCasesSymbol as U}from"@distilled.cloud/core/_bundle/base";import{errors$API_ERRORS as W,errors$BadGateway as de,errors$BadRequest as fe,errors$ConfigError as G,errors$Conflict as pe,errors$DEFAULT_ERRORS as me,errors$Forbidden as he,errors$GatewayTimeout as ge,errors$HTTP_STATUS_MAP as _e,errors$InternalServerError as ve,errors$Locked as ye,errors$NotFound as be,errors$ServiceUnavailable as xe,errors$TooManyRequests as Se,errors$Unauthorized as Ce,errors$UnprocessableEntity as we,protocol_http$invalidHostLabelConfig as Te,protocol_rest$RawResponse as Ee,protocol_rest$RawResponseRoot as De,protocol_rest$SensitiveValue as Oe,protocol_rest$rawResponseRootSymbol as ke,protocol_rest$rawResponseSymbol as Ae,protocol_rest$restProtocol as je,protocol_rest$sensitiveValueSymbol as Me,schema_lite$Array as Ne,schema_lite$Boolean as Pe,schema_lite$Duration as Fe,schema_lite$Number as Ie,schema_lite$Record as Le,schema_lite$String as Re,schema_lite$Struct as ze,schema_lite$TaggedError as Be,schema_lite$Unknown as Ve,schema_lite$at as He,schema_lite$optional as Ue,schema_lite$suspend as We}from"@distilled.cloud/core/_bundle/rest";import*as K from"effect/Context";import*as q from"effect/Effect";import*as Ge from"effect/FileSystem";import*as J from"effect/Layer";import*as Y from"effect/Option";import*as X from"effect/Redacted";var UnknownNamespaceLabsError=class extends (/*@__PURE__*/ v()(`UnknownNamespaceLabsError`,{code:/*@__PURE__*/ b(_),message:/*@__PURE__*/ b(_),details:/*@__PURE__*/ b(y),body:y}).pipe(ne)){};var NamespaceLabsParseError=class extends (/*@__PURE__*/ v()(`NamespaceLabsParseError`,{body:y,cause:y}).pipe(te)){};var TokenFileUnreadable=class extends (/*@__PURE__*/ v()(`TokenFileUnreadable`,{message:_,path:_}).pipe(o)){};const Ke=W;const qe=`us`;const Je=`https://global.namespaceapis.com`;const Ye=`https://private-api.global.namespaceapis.com`;const Z=`/var/run/nsc/token.json`;const computeBaseUrlFor=e=>`https://${e}.compute.namespaceapis.com`;const storageBaseUrlFor=e=>`https://${e}.storage.namespaceapis.com`;const resolveConfig=e=>{const t=e.region??`us`;return{token:e.token,region:t,computeBaseUrl:e.computeBaseUrl??computeBaseUrlFor(t),storageBaseUrl:e.storageBaseUrl??storageBaseUrlFor(t),globalBaseUrl:e.globalBaseUrl??`https://global.namespaceapis.com`,privateApiBaseUrl:e.privateApiBaseUrl??`https://private-api.global.namespaceapis.com`}};const checkHosts=e=>{const t=e.region===void 0?void 0:Te(`Namespace region`,e.region);return t===void 0?q.succeed(e):q.fail(t)};var Credentials=class extends (/*@__PURE__*/ K.Service()(`NamespaceLabsCredentials`)){};const optionalString=e=>f(l(e)).pipe(d(Y.getOrUndefined));const Q=/*@__PURE__*/ u({region:/*@__PURE__*/ l(`NSC_REGION`).pipe(/*@__PURE__*/ p(`us`)),computeBaseUrl:/*@__PURE__*/ l(`NSC_COMPUTE_URL`).pipe(/*@__PURE__*/ ae(()=>l(`NSC_ENDPOINT`)),f,/*@__PURE__*/ d(Y.getOrUndefined)),storageBaseUrl:/*@__PURE__*/ optionalString(`NSC_STORAGE_URL`),globalBaseUrl:/*@__PURE__*/ optionalString(`NSC_GLOBAL_URL`),privateApiBaseUrl:/*@__PURE__*/ optionalString(`NSC_PRIVATE_API_URL`)});const configError=e=>()=>new G({message:e});const $=/*@__PURE__*/ J.effect(Credentials,/*@__PURE__*/ u({token:/*@__PURE__*/ ie(`NSC_TOKEN`),hosts:Q}).pipe(/*@__PURE__*/ q.mapError(configError(`NSC_TOKEN environment variable is required`)),/*@__PURE__*/ q.flatMap(({token:e,hosts:t})=>checkHosts({token:e,...t})),/*@__PURE__*/ q.map(e=>q.succeed(resolveConfig(e)))));const readTokenFile=(e,t)=>{const unreadable=e=>()=>new TokenFileUnreadable({message:e,path:t});return e.readFileString(t).pipe(q.mapError(unreadable(`Namespace token file ${t} could not be read`)),q.flatMap(e=>{const n=q.try({try:()=>JSON.parse(e),catch:unreadable(`Namespace token file ${t} is not JSON`)});return q.flatMap(n,({bearer_token:e})=>typeof e===`string`&&e.length>0?q.succeed(X.make(e)):q.fail(unreadable(`Namespace token file ${t} has no bearer_token; exchange a session token with privateUserSessions.issueTenantTokenFromSession`)()))}))};const tokenFileLayer=e=>J.effect(Credentials,q.gen(function*(){const t=yield*Ge.FileSystem;const{path:n,hosts:r}=yield*e;const i=yield*checkHosts(r);return q.map(readTokenFile(t,n),e=>resolveConfig({token:e,...i}))}));const Xe=/*@__PURE__*/ tokenFileLayer(/*@__PURE__*/ u({path:/*@__PURE__*/ l(`NSC_TOKEN_FILE`).pipe(/*@__PURE__*/ p(Z)),hosts:Q}).pipe(/*@__PURE__*/ q.mapError(configError(`Namespace host configuration could not be read`))));const credentials=e=>J.effect(Credentials,q.map(checkHosts(e),e=>q.succeed(resolveConfig(e))));const fromToken=e=>J.succeed(Credentials,q.succeed(resolveConfig({token:e})));const fromTokenFile=(e,t={})=>tokenFileLayer(q.succeed({path:e,hosts:t}));const Ze=[[`namespace.cloud.compute.`,`compute`],[`namespace.cloud.builder.`,`compute`],[`namespace.experimental.compute.`,`compute`],[`namespace.cloud.storage.`,`storage`],[`namespace.cloud.github.`,`privateApi`],[`namespace.private.`,`privateApi`]];const hostFor=e=>{const t=e.replace(/^\//,``).split(`/`)[0]??``;return Ze.find(([e])=>t.startsWith(e))?.[1]??`global`};const baseUrlFor=(e,t)=>{switch(hostFor(t)){case`compute`:return e.computeBaseUrl;case`storage`:return e.storageBaseUrl;case`privateApi`:return e.privateApiBaseUrl;case`global`:return e.globalBaseUrl}};const errorEnvelope=e=>{if(e===null||typeof e!==`object`)return void 0;const t=e;return{code:typeof t.code===`string`?t.code:void 0,message:typeof t.message===`string`?t.message:void 0}};const errorDetails=e=>e!==null&&typeof e===`object`?e.details:void 0;const Qe=/*@__PURE__*/ je({credentials:/*@__PURE__*/ q.flatten(Credentials),baseUrl:(e,t)=>baseUrlFor(e,t.uri),headers:e=>({Authorization:`Bearer ${X.value(e.token)}`}),emptyJsonBody:true,errorEnvelope,unknownError:({code:e,message:t,body:n})=>new UnknownNamespaceLabsError({code:typeof e===`string`?e:e!==void 0?String(e):void 0,message:t,details:errorDetails(n),body:n}),parseError:({body:e,cause:t})=>new NamespaceLabsParseError({body:e,cause:t})});var Retry=class extends K.Service()(`NamespaceLabsRetry`){};const policy=e=>q.provide(J.succeed(Retry,e));const $e=q.provide(J.succeed(Retry,{while:()=>false}));const et=policy(h);const tt=policy(g);export{c as Ca,re as Ma,Ne as Xc,Pe as Yc,Fe as _c,e as a,t as b,Credentials as credentials$Credentials,$ as credentials$CredentialsFromEnv,Xe as credentials$CredentialsFromTokenFile,Je as credentials$DEFAULT_GLOBAL_BASE_URL,Ye as credentials$DEFAULT_PRIVATE_API_BASE_URL,qe as credentials$DEFAULT_REGION,Z as credentials$DEFAULT_TOKEN_FILE,computeBaseUrlFor as credentials$computeBaseUrlFor,credentials as credentials$credentials,fromToken as credentials$fromToken,fromTokenFile as credentials$fromTokenFile,resolveConfig as credentials$resolveConfig,storageBaseUrlFor as credentials$storageBaseUrlFor,W as errors$API_ERRORS,de as errors$BadGateway,fe as errors$BadRequest,G as errors$ConfigError,pe as errors$Conflict,me as errors$DEFAULT_ERRORS,he as errors$Forbidden,ge as errors$GatewayTimeout,_e as errors$HTTP_STATUS_MAP,ve as errors$InternalServerError,ye as errors$Locked,NamespaceLabsParseError as errors$NamespaceLabsParseError,Ke as errors$NamespaceLabsServiceErrors,be as errors$NotFound,xe as errors$ServiceUnavailable,TokenFileUnreadable as errors$TokenFileUnreadable,Se as errors$TooManyRequests,Ce as errors$Unauthorized,UnknownNamespaceLabsError as errors$UnknownNamespaceLabsError,we as errors$UnprocessableEntity,n as f,Ie as gd,Le as hd,Re as jd,ze as kd,r as l,i as m,Be as md,ee as n,a as o,m as pagination$paginateCursor,Ve as pd,Qe as protocol$NamespaceLabsProtocol,baseUrlFor as protocol$baseUrlFor,hostFor as protocol$hostFor,He as rd,Retry as retry$Retry,oe as retry$capped,se as retry$jittered,ce as retry$makeDefault,$e as retry$none,policy as retry$policy,et as retry$throttling,h as retry$throttlingFactory,le as retry$throttlingOptions,tt as retry$transient,g as retry$transientFactory,ue as retry$transientOptions,x as traits$Body,S as traits$FormDataFile,C as traits$Header,w as traits$Http,T as traits$HttpBody,E as traits$KeyDictionary,D as traits$Label,O as traits$Query,Ee as traits$RawResponse,De as traits$RawResponseRoot,k as traits$ResponseCode,Oe as traits$SensitiveValue,A as traits$UnionCases,j as traits$applyErrorMatchers,M as traits$bodySymbol,N as traits$errorMatchersSymbol,P as traits$formDataFileSymbol,F as traits$getErrorMatchers,I as traits$headerSymbol,L as traits$httpBodySymbol,R as traits$httpSymbol,z as traits$keyDictionarySymbol,B as traits$labelSymbol,V as traits$querySymbol,ke as traits$rawResponseRootSymbol,Ae as traits$rawResponseSymbol,H as traits$responseCodeSymbol,Me as traits$sensitiveValueSymbol,U as traits$unionCasesSymbol,Ue as wd,We as xd,o as ya,s as za};
|
|
2
|
+
//# sourceMappingURL=sdk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk.js","names":["Schema.String","Schema.Unknown","Category.withServerError","Category.withParseError","Category.withAuthError","EffectConfig.option","EffectConfig.String","EffectConfig.map","D","call","error","named","newError","op","opPaginated","withAuthError","withBadRequestError","withConflictError","withParseError","withServerError","withThrottlingError","Redacted$3","String$3","all$1","map","option","orElse","withDefault","paginateCursor","capped","jittered","makeDefault","throttlingFactory","throttlingOptions","transientFactory","transientOptions","String$2","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","UnprocessableEntity","invalidHostLabelConfig","RawResponse","RawResponseRoot","SensitiveValue","rawResponseRootSymbol","rawResponseSymbol","restProtocol","sensitiveValueSymbol","Array","Boolean","Duration","Number","Record","String$1","Struct","TaggedError","Unknown","at","optional","suspend","Context","Effect","FileSystem","Layer","Option","Redacted","NamespaceLabsServiceErrors","DEFAULT_REGION","DEFAULT_GLOBAL_BASE_URL","DEFAULT_PRIVATE_API_BASE_URL","DEFAULT_TOKEN_FILE","region","options","invalid","hosts","name","hostsConfig","CredentialsFromEnv","fs","path","parsed","text","bearer_token","unchecked","settings","CredentialsFromTokenFile","checked","HOST_BY_PACKAGE_PREFIX","service","uri","prefix","creds","body","b","NamespaceLabsProtocol","target","code","optionsOrFactory","none","throttling","transient"],"sources":["../../src/errors.ts","../../src/credentials.ts","../../src/protocol.ts","../../src/retry.ts"],"mappings":"ilFA4BA,IAAa,0BAAb,eACwB,gBAA8C,CAAC,CACnE,4BACA,CACE,KAAoB,gBAAgBA,CAAa,EACjD,QAAuB,gBAAgBA,CAAa,EACpD,QAAuB,gBAAgBC,CAAc,EACrD,KAAMA,CACR,CACF,CAAC,CAAC,KAAKC,EAAwB,EAAA,AAAE,CAAC,EAEpC,IAAa,wBAAb,eACwB,gBAA4C,CAAC,CAAC,0BAA2B,CAC7F,KAAMD,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ect";
|
|
4
|
+
import * as FileSystem from "effect/FileSystem";
|
|
5
|
+
import * as Layer from "effect/Layer";
|
|
6
|
+
import * as Redacted from "effect/Redacted";
|
|
7
|
+
import { TokenFileUnreadable } from "./errors.ts";
|
|
8
|
+
export declare const DEFAULT_REGION = "us";
|
|
9
|
+
export declare const DEFAULT_GLOBAL_BASE_URL = "https://global.namespaceapis.com";
|
|
10
|
+
export declare const DEFAULT_PRIVATE_API_BASE_URL = "https://private-api.global.namespaceapis.com";
|
|
11
|
+
/** Where a Namespace instance or runner mounts its workload token. */
|
|
12
|
+
export declare const DEFAULT_TOKEN_FILE = "/var/run/nsc/token.json";
|
|
13
|
+
export declare const computeBaseUrlFor: (region: string) => string;
|
|
14
|
+
export declare const storageBaseUrlFor: (region: string) => string;
|
|
15
|
+
export interface Config {
|
|
16
|
+
readonly token: Redacted.Redacted<string>;
|
|
17
|
+
readonly region: string;
|
|
18
|
+
/** `namespace.cloud.compute.*`, `builder`, `experimental.compute`: `https://<region>.compute.namespaceapis.com`. */
|
|
19
|
+
readonly computeBaseUrl: string;
|
|
20
|
+
/** `namespace.cloud.storage.*` (artifacts): `https://<region>.storage.namespaceapis.com`. */
|
|
21
|
+
readonly storageBaseUrl: string;
|
|
22
|
+
/** IAM, registry, vault, images, caches, egress and everything else global. */
|
|
23
|
+
readonly globalBaseUrl: string;
|
|
24
|
+
/** `namespace.private.*` (devboxes, sessions) and `namespace.cloud.github.*`. */
|
|
25
|
+
readonly privateApiBaseUrl: string;
|
|
26
|
+
}
|
|
27
|
+
export interface Hosts {
|
|
28
|
+
readonly region?: string;
|
|
29
|
+
readonly computeBaseUrl?: string;
|
|
30
|
+
readonly storageBaseUrl?: string;
|
|
31
|
+
readonly globalBaseUrl?: string;
|
|
32
|
+
readonly privateApiBaseUrl?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface Options extends Hosts {
|
|
35
|
+
readonly token: Redacted.Redacted<string>;
|
|
36
|
+
}
|
|
37
|
+
export declare const resolveConfig: (options: Options) => Config;
|
|
38
|
+
declare const Credentials_base: Context.ServiceClass<Credentials, "NamespaceLabsCredentials", Effect.Effect<Config, TokenFileUnreadable, never>>;
|
|
39
|
+
/**
|
|
40
|
+
* Resolves the current credentials on every request. A layer here reads and
|
|
41
|
+
* checks the region and host settings when it is built, so the effect fails
|
|
42
|
+
* only for what it does at run time: the token-file layers read the file
|
|
43
|
+
* again on every resolution, and fail with {@link TokenFileUnreadable}.
|
|
44
|
+
*/
|
|
45
|
+
export declare class Credentials extends /*@__PURE__*/ Credentials_base {
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Credentials from the environment: `NSC_TOKEN` (required) plus the host
|
|
49
|
+
* variables. The environment is read, and the region checked, once: when
|
|
50
|
+
* the layer is built.
|
|
51
|
+
*/
|
|
52
|
+
export declare const CredentialsFromEnv: Layer.Layer<Credentials, ConfigError>;
|
|
53
|
+
/**
|
|
54
|
+
* Credentials from the token file a Namespace workload is given: `NSC_TOKEN_FILE`,
|
|
55
|
+
* else `/var/run/nsc/token.json`. The file is re-read on every resolution because
|
|
56
|
+
* Namespace refreshes it; host variables as in {@link CredentialsFromEnv}. The
|
|
57
|
+
* variables are read, and the region checked, once: when the layer is built.
|
|
58
|
+
*/
|
|
59
|
+
export declare const CredentialsFromTokenFile: Layer.Layer<Credentials, ConfigError, FileSystem.FileSystem>;
|
|
60
|
+
/**
|
|
61
|
+
* Convenience layer from a tenant token, an optional region and host
|
|
62
|
+
* overrides. The region is checked when the layer is built.
|
|
63
|
+
*/
|
|
64
|
+
export declare const credentials: (options: Options) => Layer.Layer<Credentials, ConfigError>;
|
|
65
|
+
/** Convenience layer from a tenant token alone. */
|
|
66
|
+
export declare const fromToken: (token: Redacted.Redacted<string>) => Layer.Layer<Credentials>;
|
|
67
|
+
/**
|
|
68
|
+
* Convenience layer reading `bearer_token` from a token file on every
|
|
69
|
+
* resolution. The region is checked when the layer is built.
|
|
70
|
+
*/
|
|
71
|
+
export declare const fromTokenFile: (path: string, hosts?: Hosts) => Layer.Layer<Credentials, ConfigError, FileSystem.FileSystem>;
|
|
72
|
+
export {};
|
|
73
|
+
//# 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;AAE3D,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD,eAAO,MAAM,cAAc,OAAO,CAAC;AACnC,eAAO,MAAM,uBAAuB,qCAAqC,CAAC;AAC1E,eAAO,MAAM,4BAA4B,iDAAiD,CAAC;AAC3F,sEAAsE;AACtE,eAAO,MAAM,kBAAkB,4BAA4B,CAAC;AAE5D,eAAO,MAAM,iBAAiB,WAAY,MAAM,KAAG,MACJ,CAAC;AAChD,eAAO,MAAM,iBAAiB,WAAY,MAAM,KAAG,MACJ,CAAC;AAEhD,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC1C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,oHAAoH;IACpH,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,6FAA6F;IAC7F,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,+EAA+E;IAC/E,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,iFAAiF;IACjF,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;CACpC;AAED,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;CACrC;AAED,MAAM,WAAW,OAAQ,SAAQ,KAAK;IACpC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;CAC3C;AAED,eAAO,MAAM,aAAa,YAAa,OAAO,KAAG,MAUhD,CAAC;;AAeF;;;;;GAKG;AACH,qBAAa,WACX,SAAQ,aAAa,CAAC,gBAErB;CAAG;AA2BN;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,EAAE,WAAW,CAUpE,CAAC;AAyCF;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,EAAE,KAAK,CAAC,KAAK,CAChD,WAAW,EACX,WAAW,EACX,UAAU,CAAC,UAAU,CAUtB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW,YAAa,OAAO,KAAG,KAAK,CAAC,KAAK,CAAC,WAAW,EAAE,WAAW,CAIhF,CAAC;AAEJ,mDAAmD;AACnD,eAAO,MAAM,SAAS,UAAW,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAG,KAAK,CAAC,KAAK,CAAC,WAAW,CACd,CAAC;AAEvE;;;GAGG;AACH,eAAO,MAAM,aAAa,SAClB,MAAM,UACL,KAAK,KACX,KAAK,CAAC,KAAK,CAAC,WAAW,EAAE,WAAW,EAAE,UAAU,CAAC,UAAU,CACb,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { credentials$Credentials as Credentials, credentials$CredentialsFromEnv as CredentialsFromEnv, credentials$CredentialsFromTokenFile as CredentialsFromTokenFile, credentials$DEFAULT_GLOBAL_BASE_URL as DEFAULT_GLOBAL_BASE_URL, credentials$DEFAULT_PRIVATE_API_BASE_URL as DEFAULT_PRIVATE_API_BASE_URL, credentials$DEFAULT_REGION as DEFAULT_REGION, credentials$DEFAULT_TOKEN_FILE as DEFAULT_TOKEN_FILE, credentials$computeBaseUrlFor as computeBaseUrlFor, credentials$credentials as credentials, credentials$fromToken as fromToken, credentials$fromTokenFile as fromTokenFile, credentials$resolveConfig as resolveConfig, credentials$storageBaseUrlFor as storageBaseUrlFor } from "./_bundle/sdk.js";
|
package/lib/errors.d.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export { API_ERRORS, BadGateway, BadRequest, Conflict, ConfigError, DEFAULT_ERRORS, Forbidden, GatewayTimeout, HTTP_STATUS_MAP, InternalServerError, Locked, NotFound, ServiceUnavailable, TooManyRequests, Unauthorized, UnprocessableEntity, } from "@distilled.cloud/core/errors";
|
|
2
|
+
import type { DefaultErrors as CoreDefaultErrors } from "@distilled.cloud/core/errors";
|
|
3
|
+
import * as Schema from "@distilled.cloud/core/schema-lite-typed";
|
|
4
|
+
declare const UnknownNamespaceLabsError_base: Schema.TaggedErrorClass<"UnknownNamespaceLabsError", {
|
|
5
|
+
readonly code: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
6
|
+
readonly message: import("effect/Schema").optional<import("effect/Schema").String>;
|
|
7
|
+
readonly details: import("effect/Schema").optional<import("effect/Schema").Unknown>;
|
|
8
|
+
readonly body: import("effect/Schema").Unknown;
|
|
9
|
+
}> & (new (...args: any[]) => {
|
|
10
|
+
"@distilled.cloud/error/categories": {
|
|
11
|
+
ServerError: true;
|
|
12
|
+
};
|
|
13
|
+
});
|
|
14
|
+
/**
|
|
15
|
+
* A failed response no declared error class matches. `code` is the Connect
|
|
16
|
+
* error code (`unknown`, `data_loss`, ...) and `details` the Connect error
|
|
17
|
+
* details, which carry the request id.
|
|
18
|
+
*/
|
|
19
|
+
export declare class UnknownNamespaceLabsError extends /*@__PURE__*/ UnknownNamespaceLabsError_base {
|
|
20
|
+
}
|
|
21
|
+
declare const NamespaceLabsParseError_base: Schema.TaggedErrorClass<"NamespaceLabsParseError", {
|
|
22
|
+
readonly body: import("effect/Schema").Unknown;
|
|
23
|
+
readonly cause: import("effect/Schema").Unknown;
|
|
24
|
+
}> & (new (...args: any[]) => {
|
|
25
|
+
"@distilled.cloud/error/categories": {
|
|
26
|
+
ParseError: true;
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
export declare class NamespaceLabsParseError extends /*@__PURE__*/ NamespaceLabsParseError_base {
|
|
30
|
+
}
|
|
31
|
+
declare const TokenFileUnreadable_base: Schema.TaggedErrorClass<"TokenFileUnreadable", {
|
|
32
|
+
readonly message: import("effect/Schema").String;
|
|
33
|
+
/** The path of the token file. */
|
|
34
|
+
readonly path: import("effect/Schema").String;
|
|
35
|
+
}> & (new (...args: any[]) => {
|
|
36
|
+
"@distilled.cloud/error/categories": {
|
|
37
|
+
AuthError: true;
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
/**
|
|
41
|
+
* The token file the credentials read on every request could not be used:
|
|
42
|
+
* it could not be read, is not JSON, or holds no `bearer_token`. It is a
|
|
43
|
+
* failure at run time (Namespace rewrites the file), so it is not a
|
|
44
|
+
* `ConfigError`.
|
|
45
|
+
*/
|
|
46
|
+
export declare class TokenFileUnreadable extends /*@__PURE__*/ TokenFileUnreadable_base {
|
|
47
|
+
}
|
|
48
|
+
export type ClientErrors = UnknownNamespaceLabsError | NamespaceLabsParseError;
|
|
49
|
+
export type DefaultErrors = CoreDefaultErrors | ClientErrors;
|
|
50
|
+
/**
|
|
51
|
+
* The errors declared on the Namespace service: any operation can return
|
|
52
|
+
* them, and every generated operation lists them as its `serviceErrors`.
|
|
53
|
+
* Today that is each of core's status classes (401, 403, 404, 429, the
|
|
54
|
+
* 5xx ...), for a failed response whose status and Connect code match none
|
|
55
|
+
* of the operation's own errors.
|
|
56
|
+
*/
|
|
57
|
+
export declare const NamespaceLabsServiceErrors: 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];
|
|
58
|
+
export type NamespaceLabsServiceError = InstanceType<(typeof NamespaceLabsServiceErrors)[number]>;
|
|
59
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,UAAU,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACX,cAAc,EACd,SAAS,EACT,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,MAAM,EACN,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,mBAAmB,GACpB,MAAM,8BAA8B,CAAC;AAGtC,OAAO,KAAK,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACvF,OAAO,KAAK,MAAM,MAAM,yCAAyC,CAAC;;;;;;;;;;;AAElE;;;;GAIG;AACH,qBAAa,yBACX,SAAQ,aAAa,CAAC,8BAQU;CAAG;;;;;;;;;AAErC,qBAAa,uBACX,SAAQ,aAAa,CAAC,4BAGU;CAAG;;;IAWjC,kCAAkC;;;;;;;AATtC;;;;;GAKG;AACH,qBAAa,mBACX,SAAQ,aAAa,CAAC,wBAIS;CAAG;AAEpC,MAAM,MAAM,YAAY,GAAG,yBAAyB,GAAG,uBAAuB,CAAC;AAE/E,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAAG,YAAY,CAAC;AAE7D;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,+tBAAa,CAAC;AACrD,MAAM,MAAM,yBAAyB,GAAG,YAAY,CAAC,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAC,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$NamespaceLabsParseError as NamespaceLabsParseError, errors$NamespaceLabsServiceErrors as NamespaceLabsServiceErrors, errors$NotFound as NotFound, errors$ServiceUnavailable as ServiceUnavailable, errors$TokenFileUnreadable as TokenFileUnreadable, errors$TooManyRequests as TooManyRequests, errors$Unauthorized as Unauthorized, errors$UnknownNamespaceLabsError as UnknownNamespaceLabsError, errors$UnprocessableEntity as UnprocessableEntity } from "./_bundle/sdk.js";
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @distilled.cloud/namespacelabs -- Namespace (namespace.so) SDK for Effect.
|
|
3
|
+
*
|
|
4
|
+
* `./services` and `./unstable-services` are generated by
|
|
5
|
+
* `scripts/generate.ts` from the Smithy models that `scripts/convert.ts`
|
|
6
|
+
* converts from Namespace's public protobuf API (`buf.build/namespace/cloud`).
|
|
7
|
+
* Services in `v1beta` and `namespace.experimental.*` packages are under
|
|
8
|
+
* `@distilled.cloud/namespacelabs/unstable/<name>`. Everything else in this
|
|
9
|
+
* folder is hand-written.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { Effect, Layer } from "effect";
|
|
14
|
+
* import * as FetchHttpClient from "effect/http/FetchHttpClient";
|
|
15
|
+
* import * as NamespaceLabs from "@distilled.cloud/namespacelabs";
|
|
16
|
+
* import * as Compute from "@distilled.cloud/namespacelabs/unstable/compute";
|
|
17
|
+
*
|
|
18
|
+
* const program = Effect.gen(function* () {
|
|
19
|
+
* const created = yield* Compute.createInstance({
|
|
20
|
+
* shape: { virtualCpu: 2, memoryMegabytes: 4096, os: "linux", machineArch: "amd64" },
|
|
21
|
+
* deadline: new Date(Date.now() + 10 * 60 * 1000).toISOString(),
|
|
22
|
+
* });
|
|
23
|
+
* const instanceId = created.metadata?.instanceId;
|
|
24
|
+
* if (instanceId === undefined) return undefined;
|
|
25
|
+
* const instance = yield* Compute.describeInstance({ instanceId });
|
|
26
|
+
* yield* Compute.destroyInstance({ instanceId });
|
|
27
|
+
* return instance.metadata?.status;
|
|
28
|
+
* });
|
|
29
|
+
*
|
|
30
|
+
* const Live = Layer.mergeAll(
|
|
31
|
+
* FetchHttpClient.layer,
|
|
32
|
+
* NamespaceLabs.CredentialsFromEnv,
|
|
33
|
+
* );
|
|
34
|
+
*
|
|
35
|
+
* program.pipe(Effect.provide(Live), Effect.runPromise);
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export * from "./credentials.ts";
|
|
39
|
+
export * from "./errors.ts";
|
|
40
|
+
export * as T from "./traits.ts";
|
|
41
|
+
export { NamespaceLabsProtocol, baseUrlFor, hostFor, type Host, type NamespaceLabsOpError, type NamespaceLabsOpContext, } from "./protocol.ts";
|
|
42
|
+
export { paginateCursor } from "./pagination.ts";
|
|
43
|
+
export * as Retry from "./retry.ts";
|
|
44
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,OAAO,KAAK,CAAC,MAAM,aAAa,CAAC;AACjC,OAAO,EACL,qBAAqB,EACrB,UAAU,EACV,OAAO,EACP,KAAK,IAAI,EACT,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,GAC5B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC"}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.d.ts","sources":["../src/pagination.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { pagination$paginateCursor as paginateCursor } from "./_bundle/sdk.js";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ErrorOf } from "@distilled.cloud/core/protocol";
|
|
2
|
+
import type * as HttpClient from "effect/http/HttpClient";
|
|
3
|
+
import { Credentials, type Config } from "./credentials.ts";
|
|
4
|
+
import { UnknownNamespaceLabsError, NamespaceLabsParseError, type NamespaceLabsServiceError } from "./errors.ts";
|
|
5
|
+
/**
|
|
6
|
+
* What every generated Namespace operation fails with besides its own
|
|
7
|
+
* errors: the service's errors, the protocol's, and what resolving the
|
|
8
|
+
* credentials fails with. Generated service files annotate operations with
|
|
9
|
+
* `API.OperationMethod<I, O, NamespaceLabsOpError, NamespaceLabsOpContext>`
|
|
10
|
+
* explicitly.
|
|
11
|
+
*/
|
|
12
|
+
export type NamespaceLabsOpError = NamespaceLabsServiceError | ErrorOf<typeof NamespaceLabsProtocol>;
|
|
13
|
+
export type NamespaceLabsOpContext = Credentials | HttpClient.HttpClient;
|
|
14
|
+
export type Host = "compute" | "storage" | "global" | "privateApi";
|
|
15
|
+
/** The host serving `uri` (`/<package>.<Service>/<Method>`), by proto package. */
|
|
16
|
+
export declare const hostFor: (uri: string) => Host;
|
|
17
|
+
export declare const baseUrlFor: (creds: Config, uri: string) => string;
|
|
18
|
+
export declare const NamespaceLabsProtocol: import("@distilled.cloud/core/protocol").Protocol<NamespaceLabsParseError | import("./errors.ts").TokenFileUnreadable | UnknownNamespaceLabsError | import("@distilled.cloud/core/protocol-rest").RestProtocolError, Credentials>;
|
|
19
|
+
//# sourceMappingURL=protocol.d.ts.map
|