@alchemy.run/e2b 0.0.0 → 2.0.0-beta.86
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 +56 -4
- package/lib/ApiKey.d.ts +53 -0
- package/lib/ApiKey.d.ts.map +1 -0
- package/lib/ApiKey.js +107 -0
- package/lib/ApiKey.js.map +1 -0
- package/lib/AuthProvider.d.ts +60 -0
- package/lib/AuthProvider.d.ts.map +1 -0
- package/lib/AuthProvider.js +293 -0
- package/lib/AuthProvider.js.map +1 -0
- package/lib/Bootstrap.d.ts +7 -0
- package/lib/Bootstrap.d.ts.map +1 -0
- package/lib/Bootstrap.js +25 -0
- package/lib/Bootstrap.js.map +1 -0
- package/lib/ConnectSandbox.d.ts +67 -0
- package/lib/ConnectSandbox.d.ts.map +1 -0
- package/lib/ConnectSandbox.js +3 -0
- package/lib/ConnectSandbox.js.map +1 -0
- package/lib/ConnectSandboxHttp.d.ts +22 -0
- package/lib/ConnectSandboxHttp.d.ts.map +1 -0
- package/lib/ConnectSandboxHttp.js +30 -0
- package/lib/ConnectSandboxHttp.js.map +1 -0
- package/lib/Contributions.d.ts +7 -0
- package/lib/Contributions.d.ts.map +1 -0
- package/lib/Contributions.js +6 -0
- package/lib/Contributions.js.map +1 -0
- package/lib/CreateSandbox.d.ts +139 -0
- package/lib/CreateSandbox.d.ts.map +1 -0
- package/lib/CreateSandbox.js +3 -0
- package/lib/CreateSandbox.js.map +1 -0
- package/lib/CreateSandboxHttp.d.ts +22 -0
- package/lib/CreateSandboxHttp.d.ts.map +1 -0
- package/lib/CreateSandboxHttp.js +99 -0
- package/lib/CreateSandboxHttp.js.map +1 -0
- package/lib/CreateSecret.d.ts +57 -0
- package/lib/CreateSecret.d.ts.map +1 -0
- package/lib/CreateSecret.js +3 -0
- package/lib/CreateSecret.js.map +1 -0
- package/lib/CreateSecretHttp.d.ts +20 -0
- package/lib/CreateSecretHttp.d.ts.map +1 -0
- package/lib/CreateSecretHttp.js +64 -0
- package/lib/CreateSecretHttp.js.map +1 -0
- package/lib/CreateSnapshot.d.ts +53 -0
- package/lib/CreateSnapshot.d.ts.map +1 -0
- package/lib/CreateSnapshot.js +3 -0
- package/lib/CreateSnapshot.js.map +1 -0
- package/lib/CreateSnapshotHttp.d.ts +20 -0
- package/lib/CreateSnapshotHttp.d.ts.map +1 -0
- package/lib/CreateSnapshotHttp.js +41 -0
- package/lib/CreateSnapshotHttp.js.map +1 -0
- package/lib/CreateTemplate.d.ts +96 -0
- package/lib/CreateTemplate.d.ts.map +1 -0
- package/lib/CreateTemplate.js +3 -0
- package/lib/CreateTemplate.js.map +1 -0
- package/lib/CreateTemplateHttp.d.ts +20 -0
- package/lib/CreateTemplateHttp.d.ts.map +1 -0
- package/lib/CreateTemplateHttp.js +99 -0
- package/lib/CreateTemplateHttp.js.map +1 -0
- package/lib/CreateVolume.d.ts +58 -0
- package/lib/CreateVolume.d.ts.map +1 -0
- package/lib/CreateVolume.js +3 -0
- package/lib/CreateVolume.js.map +1 -0
- package/lib/CreateVolumeHttp.d.ts +20 -0
- package/lib/CreateVolumeHttp.d.ts.map +1 -0
- package/lib/CreateVolumeHttp.js +51 -0
- package/lib/CreateVolumeHttp.js.map +1 -0
- package/lib/Credentials.d.ts +18 -0
- package/lib/Credentials.d.ts.map +1 -0
- package/lib/Credentials.js +55 -0
- package/lib/Credentials.js.map +1 -0
- package/lib/E2BBindings.d.ts +35 -0
- package/lib/E2BBindings.d.ts.map +1 -0
- package/lib/E2BBindings.js +127 -0
- package/lib/E2BBindings.js.map +1 -0
- package/lib/Errors.d.ts +61 -0
- package/lib/Errors.d.ts.map +1 -0
- package/lib/Errors.js +23 -0
- package/lib/Errors.js.map +1 -0
- package/lib/InferEnv.d.ts +26 -0
- package/lib/InferEnv.d.ts.map +1 -0
- package/lib/InferEnv.js +1 -0
- package/lib/InferEnv.js.map +1 -0
- package/lib/MountVolume.d.ts +86 -0
- package/lib/MountVolume.d.ts.map +1 -0
- package/lib/MountVolume.js +3 -0
- package/lib/MountVolume.js.map +1 -0
- package/lib/MountVolumeLive.d.ts +23 -0
- package/lib/MountVolumeLive.d.ts.map +1 -0
- package/lib/MountVolumeLive.js +41 -0
- package/lib/MountVolumeLive.js.map +1 -0
- package/lib/Providers.d.ts +14 -0
- package/lib/Providers.d.ts.map +1 -0
- package/lib/Providers.js +23 -0
- package/lib/Providers.js.map +1 -0
- package/lib/ReadTeam.d.ts +41 -0
- package/lib/ReadTeam.d.ts.map +1 -0
- package/lib/ReadTeam.js +3 -0
- package/lib/ReadTeam.js.map +1 -0
- package/lib/ReadTeamHttp.d.ts +20 -0
- package/lib/ReadTeamHttp.d.ts.map +1 -0
- package/lib/ReadTeamHttp.js +40 -0
- package/lib/ReadTeamHttp.js.map +1 -0
- package/lib/ReadVolume.d.ts +25 -0
- package/lib/ReadVolume.d.ts.map +1 -0
- package/lib/ReadVolume.js +3 -0
- package/lib/ReadVolume.js.map +1 -0
- package/lib/ReadVolumeHttp.d.ts +20 -0
- package/lib/ReadVolumeHttp.d.ts.map +1 -0
- package/lib/ReadVolumeHttp.js +27 -0
- package/lib/ReadVolumeHttp.js.map +1 -0
- package/lib/ReadWebhook.d.ts +32 -0
- package/lib/ReadWebhook.d.ts.map +1 -0
- package/lib/ReadWebhook.js +3 -0
- package/lib/ReadWebhook.js.map +1 -0
- package/lib/ReadWebhookHttp.d.ts +20 -0
- package/lib/ReadWebhookHttp.d.ts.map +1 -0
- package/lib/ReadWebhookHttp.js +31 -0
- package/lib/ReadWebhookHttp.js.map +1 -0
- package/lib/ReadWriteVolume.d.ts +26 -0
- package/lib/ReadWriteVolume.d.ts.map +1 -0
- package/lib/ReadWriteVolume.js +3 -0
- package/lib/ReadWriteVolume.js.map +1 -0
- package/lib/ReadWriteVolumeHttp.d.ts +20 -0
- package/lib/ReadWriteVolumeHttp.d.ts.map +1 -0
- package/lib/ReadWriteVolumeHttp.js +27 -0
- package/lib/ReadWriteVolumeHttp.js.map +1 -0
- package/lib/Sandbox.d.ts +295 -0
- package/lib/Sandbox.d.ts.map +1 -0
- package/lib/Sandbox.js +351 -0
- package/lib/Sandbox.js.map +1 -0
- package/lib/SandboxClient.d.ts +226 -0
- package/lib/SandboxClient.d.ts.map +1 -0
- package/lib/SandboxClient.js +1 -0
- package/lib/SandboxClient.js.map +1 -0
- package/lib/SandboxEvents.d.ts +87 -0
- package/lib/SandboxEvents.d.ts.map +1 -0
- package/lib/SandboxEvents.js +39 -0
- package/lib/SandboxEvents.js.map +1 -0
- package/lib/SandboxEventsLive.d.ts +13 -0
- package/lib/SandboxEventsLive.d.ts.map +1 -0
- package/lib/SandboxEventsLive.js +80 -0
- package/lib/SandboxEventsLive.js.map +1 -0
- package/lib/Secret.d.ts +105 -0
- package/lib/Secret.d.ts.map +1 -0
- package/lib/Secret.js +161 -0
- package/lib/Secret.js.map +1 -0
- package/lib/Snapshot.d.ts +118 -0
- package/lib/Snapshot.d.ts.map +1 -0
- package/lib/Snapshot.js +158 -0
- package/lib/Snapshot.js.map +1 -0
- package/lib/Template.d.ts +313 -0
- package/lib/Template.d.ts.map +1 -0
- package/lib/Template.js +421 -0
- package/lib/Template.js.map +1 -0
- package/lib/Volume.d.ts +88 -0
- package/lib/Volume.d.ts.map +1 -0
- package/lib/Volume.js +136 -0
- package/lib/Volume.js.map +1 -0
- package/lib/VolumeFiles.d.ts +39 -0
- package/lib/VolumeFiles.d.ts.map +1 -0
- package/lib/VolumeFiles.js +1 -0
- package/lib/VolumeFiles.js.map +1 -0
- package/lib/Webhook.d.ts +83 -0
- package/lib/Webhook.d.ts.map +1 -0
- package/lib/Webhook.js +138 -0
- package/lib/Webhook.js.map +1 -0
- package/lib/WriteSecret.d.ts +34 -0
- package/lib/WriteSecret.d.ts.map +1 -0
- package/lib/WriteSecret.js +3 -0
- package/lib/WriteSecret.js.map +1 -0
- package/lib/WriteSecretHttp.d.ts +20 -0
- package/lib/WriteSecretHttp.d.ts.map +1 -0
- package/lib/WriteSecretHttp.js +37 -0
- package/lib/WriteSecretHttp.js.map +1 -0
- package/lib/WriteVolume.d.ts +25 -0
- package/lib/WriteVolume.d.ts.map +1 -0
- package/lib/WriteVolume.js +3 -0
- package/lib/WriteVolume.js.map +1 -0
- package/lib/WriteVolumeHttp.d.ts +20 -0
- package/lib/WriteVolumeHttp.d.ts.map +1 -0
- package/lib/WriteVolumeHttp.js +27 -0
- package/lib/WriteVolumeHttp.js.map +1 -0
- package/lib/index.d.ts +43 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +43 -0
- package/lib/index.js.map +1 -0
- package/lib/internal/Declared.d.ts +29 -0
- package/lib/internal/Declared.d.ts.map +1 -0
- package/lib/internal/Declared.js +31 -0
- package/lib/internal/Declared.js.map +1 -0
- package/lib/internal/Login.d.ts +45 -0
- package/lib/internal/Login.d.ts.map +1 -0
- package/lib/internal/Login.js +157 -0
- package/lib/internal/Login.js.map +1 -0
- package/lib/internal/Ownership.d.ts +29 -0
- package/lib/internal/Ownership.d.ts.map +1 -0
- package/lib/internal/Ownership.js +49 -0
- package/lib/internal/Ownership.js.map +1 -0
- package/lib/internal/Program.d.ts +31 -0
- package/lib/internal/Program.d.ts.map +1 -0
- package/lib/internal/Program.js +60 -0
- package/lib/internal/Program.js.map +1 -0
- package/lib/internal/SandboxHandle.d.ts +25 -0
- package/lib/internal/SandboxHandle.d.ts.map +1 -0
- package/lib/internal/SandboxHandle.js +316 -0
- package/lib/internal/SandboxHandle.js.map +1 -0
- package/lib/internal/SnapshotBuild.d.ts +19 -0
- package/lib/internal/SnapshotBuild.d.ts.map +1 -0
- package/lib/internal/SnapshotBuild.js +49 -0
- package/lib/internal/SnapshotBuild.js.map +1 -0
- package/lib/internal/Tar.d.ts +10 -0
- package/lib/internal/Tar.d.ts.map +1 -0
- package/lib/internal/Tar.js +61 -0
- package/lib/internal/Tar.js.map +1 -0
- package/lib/internal/TemplateBuild.d.ts +142 -0
- package/lib/internal/TemplateBuild.d.ts.map +1 -0
- package/lib/internal/TemplateBuild.js +220 -0
- package/lib/internal/TemplateBuild.js.map +1 -0
- package/lib/internal/TemplatePlan.d.ts +57 -0
- package/lib/internal/TemplatePlan.d.ts.map +1 -0
- package/lib/internal/TemplatePlan.js +185 -0
- package/lib/internal/TemplatePlan.js.map +1 -0
- package/lib/internal/VolumeHttp.d.ts +5 -0
- package/lib/internal/VolumeHttp.d.ts.map +1 -0
- package/lib/internal/VolumeHttp.js +46 -0
- package/lib/internal/VolumeHttp.js.map +1 -0
- package/package.json +62 -3
- package/src/ApiKey.ts +148 -0
- package/src/AuthProvider.ts +437 -0
- package/src/Bootstrap.ts +51 -0
- package/src/ConnectSandbox.ts +71 -0
- package/src/ConnectSandboxHttp.ts +38 -0
- package/src/Contributions.ts +9 -0
- package/src/CreateSandbox.ts +157 -0
- package/src/CreateSandboxHttp.ts +131 -0
- package/src/CreateSecret.ts +65 -0
- package/src/CreateSecretHttp.ts +94 -0
- package/src/CreateSnapshot.ts +64 -0
- package/src/CreateSnapshotHttp.ts +55 -0
- package/src/CreateTemplate.ts +135 -0
- package/src/CreateTemplateHttp.ts +152 -0
- package/src/CreateVolume.ts +65 -0
- package/src/CreateVolumeHttp.ts +80 -0
- package/src/Credentials.ts +81 -0
- package/src/E2BBindings.ts +160 -0
- package/src/Errors.ts +47 -0
- package/src/InferEnv.ts +27 -0
- package/src/MountVolume.ts +92 -0
- package/src/MountVolumeLive.ts +49 -0
- package/src/Providers.ts +48 -0
- package/src/ReadTeam.ts +55 -0
- package/src/ReadTeamHttp.ts +44 -0
- package/src/ReadVolume.ts +29 -0
- package/src/ReadVolumeHttp.ts +32 -0
- package/src/ReadWebhook.ts +41 -0
- package/src/ReadWebhookHttp.ts +42 -0
- package/src/ReadWriteVolume.ts +30 -0
- package/src/ReadWriteVolumeHttp.ts +32 -0
- package/src/Sandbox.ts +581 -0
- package/src/SandboxClient.ts +268 -0
- package/src/SandboxEvents.ts +101 -0
- package/src/SandboxEventsLive.ts +118 -0
- package/src/Secret.ts +229 -0
- package/src/Snapshot.ts +234 -0
- package/src/Template.ts +636 -0
- package/src/Volume.ts +173 -0
- package/src/VolumeFiles.ts +53 -0
- package/src/Webhook.ts +215 -0
- package/src/WriteSecret.ts +39 -0
- package/src/WriteSecretHttp.ts +43 -0
- package/src/WriteVolume.ts +29 -0
- package/src/WriteVolumeHttp.ts +32 -0
- package/src/globals.d.ts +2 -0
- package/src/index.ts +42 -0
- package/src/internal/Declared.ts +80 -0
- package/src/internal/Login.ts +210 -0
- package/src/internal/Ownership.ts +67 -0
- package/src/internal/Program.ts +75 -0
- package/src/internal/SandboxHandle.ts +534 -0
- package/src/internal/SnapshotBuild.ts +74 -0
- package/src/internal/Tar.ts +74 -0
- package/src/internal/TemplateBuild.ts +383 -0
- package/src/internal/TemplatePlan.ts +230 -0
- package/src/internal/VolumeHttp.ts +88 -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,61 @@
|
|
|
1
1
|
# @alchemy.run/e2b
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[E2B](https://e2b.dev) for [Alchemy](https://alchemy.run). Declare the templates, snapshots and sandboxes your app uses, run Effect programs in sandboxes, and create, run, pause, fork and kill sandboxes from any Worker or Lambda.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
```sh
|
|
6
|
+
npm install alchemy @alchemy.run/e2b effect
|
|
7
|
+
```
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
A template with a program in it. E2B snapshots the template once the program answers, so every sandbox boots with it already serving:
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
```typescript
|
|
12
|
+
// src/Program.ts
|
|
13
|
+
import * as E2B from "@alchemy.run/e2b";
|
|
14
|
+
import * as Effect from "effect/Effect";
|
|
15
|
+
import * as HttpServerResponse from "effect/http/HttpServerResponse";
|
|
16
|
+
|
|
17
|
+
export default class Program extends E2B.Template<Program>()(
|
|
18
|
+
"Program",
|
|
19
|
+
{ main: import.meta.url, port: 3000 },
|
|
20
|
+
Effect.gen(function* () {
|
|
21
|
+
return {
|
|
22
|
+
fetch: Effect.succeed(HttpServerResponse.text("hello from a sandbox")),
|
|
23
|
+
};
|
|
24
|
+
}),
|
|
25
|
+
) {}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
And a Stack with one long-lived sandbox serving it. E2B pauses the sandbox when it's idle, and a request to its URL resumes it:
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
// alchemy.run.ts
|
|
32
|
+
import * as E2B from "@alchemy.run/e2b";
|
|
33
|
+
import * as Alchemy from "alchemy";
|
|
34
|
+
import * as Output from "alchemy/Output";
|
|
35
|
+
import * as Effect from "effect/Effect";
|
|
36
|
+
import Program from "./src/Program.ts";
|
|
37
|
+
|
|
38
|
+
export default Alchemy.Stack(
|
|
39
|
+
"Sandboxes",
|
|
40
|
+
{ providers: E2B.providers(), state: Alchemy.localState() },
|
|
41
|
+
Effect.gen(function* () {
|
|
42
|
+
const sandbox = yield* E2B.Sandbox("Api", { template: Program });
|
|
43
|
+
return { url: Output.interpolate`https://3000-${sandbox.sandboxId}.${sandbox.domain}` };
|
|
44
|
+
}),
|
|
45
|
+
);
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
For a sandbox per request or per task, bind `E2B.CreateSandbox(Program)` in a Worker or Lambda:
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
const sandboxes = yield* E2B.CreateSandbox(Program);
|
|
52
|
+
|
|
53
|
+
// per request
|
|
54
|
+
const sandbox = yield* Effect.acquireRelease(
|
|
55
|
+
sandboxes.create({ timeout: 120, network: { allowOut: [] } }),
|
|
56
|
+
(sandbox) => Effect.ignore(sandbox.kill()),
|
|
57
|
+
);
|
|
58
|
+
const result = yield* sandbox.exec("bun --version");
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Docs: [alchemy.run/e2b](https://alchemy.run/e2b). Reference: [alchemy.run/providers](https://alchemy.run/providers).
|
package/lib/ApiKey.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as apiKeys from "@distilled.cloud/e2b/api_keys";
|
|
2
|
+
import * as Provider from "alchemy/Provider";
|
|
3
|
+
import { Resource } from "alchemy/Resource";
|
|
4
|
+
import * as Redacted from "effect/Redacted";
|
|
5
|
+
import type { Providers } from "./Providers.ts";
|
|
6
|
+
export interface ApiKeyProps {
|
|
7
|
+
/**
|
|
8
|
+
* Key name. If omitted, a unique name is generated from the stack, stage
|
|
9
|
+
* and logical ID. Renamed in place.
|
|
10
|
+
*/
|
|
11
|
+
name?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface ApiKeyAttributes {
|
|
14
|
+
/** E2B's API key id. */
|
|
15
|
+
apiKeyId: string;
|
|
16
|
+
name: string;
|
|
17
|
+
/** The key, sent as `X-API-Key`. Only shown once by E2B; Alchemy keeps it in state. */
|
|
18
|
+
key: Redacted.Redacted<string>;
|
|
19
|
+
/** The key's masked form, as the dashboard shows it. */
|
|
20
|
+
mask: string;
|
|
21
|
+
}
|
|
22
|
+
export interface ApiKey extends Resource<"E2B.ApiKey", ApiKeyProps, ApiKeyAttributes, never, Providers> {
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* An E2B team API key.
|
|
26
|
+
*
|
|
27
|
+
* E2B keys are not scoped: every key reaches every sandbox, template, volume
|
|
28
|
+
* and secret in the team. Mint a separate key per app or CI system so you
|
|
29
|
+
* can revoke one without the others.
|
|
30
|
+
*
|
|
31
|
+
* E2B mints API keys only with a personal access token: set `accessToken`
|
|
32
|
+
* in the E2B profile, or `E2B_ACCESS_TOKEN` in CI. The team defaults to the
|
|
33
|
+
* token's default team. E2B shows the key once, at creation; Alchemy keeps it
|
|
34
|
+
* in state as a `Redacted` value. A key whose value was lost is replaced.
|
|
35
|
+
*
|
|
36
|
+
* ### Creating an API key
|
|
37
|
+
* **Example:** A key for CI
|
|
38
|
+
* ```typescript
|
|
39
|
+
* export const Ci = E2B.ApiKey("Ci", {});
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* **Example:** Pass the key to a Worker as a secret
|
|
43
|
+
* ```typescript
|
|
44
|
+
* const ci = yield* Ci;
|
|
45
|
+
* yield* GitHub.Secret("E2B_API_KEY", { repository: "my-org/app", value: ci.key });
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @resource
|
|
49
|
+
* @product API key
|
|
50
|
+
*/
|
|
51
|
+
export declare const ApiKey: import("alchemy/Resource").ResourceClass<ApiKey>;
|
|
52
|
+
export declare const ApiKeyProvider: () => import("effect/Layer").Layer<Provider.Provider<ApiKey>, never, import("alchemy/Stack").Stack | import("alchemy/Stage").Stage | apiKeys.E2BOpContext>;
|
|
53
|
+
//# sourceMappingURL=ApiKey.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApiKey.d.ts","sources":["../src/ApiKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,+BAA+B,CAAC;AAEzD,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAG5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,MAAM,WAAW,WAAW;IAC1B;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,gBAAgB;IAC/B,wBAAwB;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,uFAAuF;IACvF,GAAG,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC/B,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,MAAO,SAAQ,QAAQ,CACtC,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,KAAK,EACL,SAAS,CACV;CAAG;AAEJ;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,MAAM,kDAAiC,CAAC;AAWrD,eAAO,MAAM,cAAc,4JAyExB,CAAC"}
|
package/lib/ApiKey.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import * as apiKeys from "@distilled.cloud/e2b/api_keys";
|
|
2
|
+
import { Unowned } from "alchemy/AdoptPolicy";
|
|
3
|
+
import * as Provider from "alchemy/Provider";
|
|
4
|
+
import { Resource } from "alchemy/Resource";
|
|
5
|
+
import * as Effect from "effect/Effect";
|
|
6
|
+
import * as Redacted from "effect/Redacted";
|
|
7
|
+
import { E2BUnexpectedResponse } from "./Errors.js";
|
|
8
|
+
import { e2bName, isGeneratedName } from "./internal/Ownership.js";
|
|
9
|
+
/**
|
|
10
|
+
* An E2B team API key.
|
|
11
|
+
*
|
|
12
|
+
* E2B keys are not scoped: every key reaches every sandbox, template, volume
|
|
13
|
+
* and secret in the team. Mint a separate key per app or CI system so you
|
|
14
|
+
* can revoke one without the others.
|
|
15
|
+
*
|
|
16
|
+
* E2B mints API keys only with a personal access token: set `accessToken`
|
|
17
|
+
* in the E2B profile, or `E2B_ACCESS_TOKEN` in CI. The team defaults to the
|
|
18
|
+
* token's default team. E2B shows the key once, at creation; Alchemy keeps it
|
|
19
|
+
* in state as a `Redacted` value. A key whose value was lost is replaced.
|
|
20
|
+
*
|
|
21
|
+
* ### Creating an API key
|
|
22
|
+
* **Example:** A key for CI
|
|
23
|
+
* ```typescript
|
|
24
|
+
* export const Ci = E2B.ApiKey("Ci", {});
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* **Example:** Pass the key to a Worker as a secret
|
|
28
|
+
* ```typescript
|
|
29
|
+
* const ci = yield* Ci;
|
|
30
|
+
* yield* GitHub.Secret("E2B_API_KEY", { repository: "my-org/app", value: ci.key });
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @resource
|
|
34
|
+
* @product API key
|
|
35
|
+
*/
|
|
36
|
+
export const ApiKey = Resource("E2B.ApiKey");
|
|
37
|
+
const maskOf = (mask) => `${mask.prefix}${mask.maskedValuePrefix}…${mask.maskedValueSuffix}`;
|
|
38
|
+
const findById = (apiKeyId) => apiKeys.listApiKeys({}).pipe(Effect.map((all) => all.find((key) => key.id === apiKeyId)));
|
|
39
|
+
const redact = (value) => Redacted.isRedacted(value) ? value : Redacted.make(value);
|
|
40
|
+
export const ApiKeyProvider = () => Provider.effect(ApiKey, Effect.gen(function* () {
|
|
41
|
+
return {
|
|
42
|
+
stables: ["apiKeyId", "key"],
|
|
43
|
+
read: Effect.fn(function* ({ olds, output }) {
|
|
44
|
+
// E2B never returns a key's value after creation: without the
|
|
45
|
+
// stored value there is nothing to adopt, so a key is only ours
|
|
46
|
+
// through state.
|
|
47
|
+
if (output === undefined)
|
|
48
|
+
return undefined;
|
|
49
|
+
const key = yield* findById(output.apiKeyId);
|
|
50
|
+
if (key === undefined)
|
|
51
|
+
return undefined;
|
|
52
|
+
const attrs = { ...output, name: key.name, mask: maskOf(key.mask) };
|
|
53
|
+
return olds !== undefined || isGeneratedName(key.name) ? attrs : Unowned(attrs);
|
|
54
|
+
}),
|
|
55
|
+
reconcile: Effect.fn(function* ({ id, news, output, session }) {
|
|
56
|
+
const name = news.name ?? output?.name ?? (yield* e2bName(id, undefined));
|
|
57
|
+
// Observe — E2B shows a key's value only at creation, so the only
|
|
58
|
+
// usable key is one whose value is in state.
|
|
59
|
+
const held = output === undefined
|
|
60
|
+
? undefined
|
|
61
|
+
: { stored: output, observed: yield* findById(output.apiKeyId) };
|
|
62
|
+
// Ensure
|
|
63
|
+
if (held?.observed === undefined) {
|
|
64
|
+
yield* session.note(`Creating API key ${name}...`);
|
|
65
|
+
const created = yield* apiKeys.createApiKey({ name });
|
|
66
|
+
return {
|
|
67
|
+
apiKeyId: created.id,
|
|
68
|
+
name: created.name,
|
|
69
|
+
key: redact(created.key),
|
|
70
|
+
mask: maskOf(created.mask),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
const { stored, observed } = held;
|
|
74
|
+
// Sync — the name is the only mutable aspect.
|
|
75
|
+
if (observed.name !== name) {
|
|
76
|
+
yield* apiKeys.updateApiKey({ apiKeyID: observed.id, name });
|
|
77
|
+
const renamed = yield* findById(observed.id);
|
|
78
|
+
if (renamed === undefined) {
|
|
79
|
+
return yield* new E2BUnexpectedResponse({
|
|
80
|
+
message: `E2B API key ${name} vanished after rename`,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
return { ...stored, name: renamed.name, mask: maskOf(renamed.mask) };
|
|
84
|
+
}
|
|
85
|
+
return { ...stored, name: observed.name, mask: maskOf(observed.mask) };
|
|
86
|
+
}),
|
|
87
|
+
delete: Effect.fn(function* ({ output }) {
|
|
88
|
+
yield* apiKeys
|
|
89
|
+
.deleteApiKey({ apiKeyID: output.apiKeyId })
|
|
90
|
+
.pipe(Effect.catchTag("NotFound", () => Effect.void));
|
|
91
|
+
}),
|
|
92
|
+
// For nuke. E2B never returns a key's value, so listed keys carry an
|
|
93
|
+
// empty one; delete needs only the id.
|
|
94
|
+
list: Effect.fn(function* () {
|
|
95
|
+
const all = yield* apiKeys.listApiKeys({});
|
|
96
|
+
return all
|
|
97
|
+
.filter((key) => isGeneratedName(key.name))
|
|
98
|
+
.map((key) => ({
|
|
99
|
+
apiKeyId: key.id,
|
|
100
|
+
name: key.name,
|
|
101
|
+
key: Redacted.make(""),
|
|
102
|
+
mask: maskOf(key.mask),
|
|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|
+
export declare const E2B_AUTH_PROVIDER_NAME = "E2B";
|
|
5
|
+
/**
|
|
6
|
+
* A profile's E2B values: an OAuth grant from the browser login (`oauth`),
|
|
7
|
+
* or a pasted access token or API key (`stored`).
|
|
8
|
+
*/
|
|
9
|
+
export declare const E2BAuthConfigSchema: Schema.Union<readonly [Schema.Struct<{
|
|
10
|
+
readonly method: Schema.Literal<"oauth">;
|
|
11
|
+
readonly email: Schema.String;
|
|
12
|
+
readonly teamId: Schema.String;
|
|
13
|
+
readonly teamName: Schema.String;
|
|
14
|
+
readonly clientId: Schema.String;
|
|
15
|
+
readonly tokenEndpoint: Schema.String;
|
|
16
|
+
readonly revokeEndpoint: Schema.String;
|
|
17
|
+
readonly access: Schema.String;
|
|
18
|
+
readonly refresh: Schema.String;
|
|
19
|
+
readonly expires: Schema.Number;
|
|
20
|
+
readonly domain: Schema.optional<Schema.String>;
|
|
21
|
+
}>, Schema.Struct<{
|
|
22
|
+
readonly method: Schema.Literal<"stored">;
|
|
23
|
+
readonly accessToken: Schema.optional<Schema.String>;
|
|
24
|
+
readonly teamId: Schema.optional<Schema.String>;
|
|
25
|
+
readonly apiKey: Schema.optional<Schema.String>;
|
|
26
|
+
readonly domain: Schema.optional<Schema.String>;
|
|
27
|
+
}>]>;
|
|
28
|
+
export type E2BAuthConfig = typeof E2BAuthConfigSchema.Type;
|
|
29
|
+
/**
|
|
30
|
+
* Resolved E2B credentials.
|
|
31
|
+
*
|
|
32
|
+
* `accessToken` reaches every control-plane endpoint, and it is the only
|
|
33
|
+
* credential that can mint API keys, which bindings and `E2B.ApiKey` need.
|
|
34
|
+
* `teamId` is looked up from the token when unset. `apiKey` is a team API
|
|
35
|
+
* key: enough for resources, not for bindings. `expires` is set for an
|
|
36
|
+
* OAuth access token, so it is refreshed before it lapses.
|
|
37
|
+
*/
|
|
38
|
+
export interface E2BResolvedCredentials {
|
|
39
|
+
readonly apiKey: Redacted.Redacted<string> | undefined;
|
|
40
|
+
readonly accessToken: Redacted.Redacted<string> | undefined;
|
|
41
|
+
readonly teamId: string | undefined;
|
|
42
|
+
readonly domain: string;
|
|
43
|
+
readonly expires?: number;
|
|
44
|
+
readonly source: {
|
|
45
|
+
readonly type: E2BAuthConfig["method"] | "env";
|
|
46
|
+
readonly details?: string;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Layer that registers the E2B {@link AuthProvider} into the
|
|
51
|
+
* {@link AuthProviders} registry when built. Included in `E2B.providers()`
|
|
52
|
+
* so `alchemy profile edit --add E2B` can configure it.
|
|
53
|
+
*
|
|
54
|
+
* Methods:
|
|
55
|
+
* - `oauth`: E2B's browser login, the one `e2b auth login` runs; the access
|
|
56
|
+
* token refreshes itself.
|
|
57
|
+
* - `stored`: a pasted access token or API key.
|
|
58
|
+
*/
|
|
59
|
+
export declare const E2BAuth: Layer.Layer<never, never, import("alchemy/Auth/Registry").AuthProviders | import("effect/process/ChildProcessSpawner").ChildProcessSpawner | import("effect/FileSystem").FileSystem | import("effect/Path").Path | import("effect/crypto/SecureRandom").SecureRandom>;
|
|
60
|
+
//# sourceMappingURL=AuthProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthProvider.d.ts","sources":["../src/AuthProvider.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AASxC,eAAO,MAAM,sBAAsB,QAAQ,CAAC;AAE5C;;;GAGG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;IAqB9B,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,mBAAmB,CAAC,IAAI,CAAC;AAG5D;;;;;;;;GAQG;AACH,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IACvD,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IAC5D,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC;QAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAChG;AAqFD;;;;;;;;;GASG;AACH,eAAO,MAAM,OAAO,uQA+PnB,CAAC"}
|