@distilled.cloud/slack 0.0.0 → 1.0.0-rc.9
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/lib/credentials.d.ts +27 -0
- package/lib/credentials.d.ts.map +1 -0
- package/lib/credentials.js +53 -0
- package/lib/credentials.js.map +1 -0
- package/lib/errors.d.ts +83 -0
- package/lib/errors.d.ts.map +1 -0
- package/lib/errors.js +59 -0
- package/lib/errors.js.map +1 -0
- package/lib/index.d.ts +17 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +17 -0
- package/lib/index.js.map +1 -0
- package/lib/pagination.d.ts +31 -0
- package/lib/pagination.d.ts.map +1 -0
- package/lib/pagination.js +31 -0
- package/lib/pagination.js.map +1 -0
- package/lib/protocol.d.ts +18 -0
- package/lib/protocol.d.ts.map +1 -0
- package/lib/protocol.js +230 -0
- package/lib/protocol.js.map +1 -0
- package/lib/retry.d.ts +52 -0
- package/lib/retry.d.ts.map +1 -0
- package/lib/retry.js +45 -0
- package/lib/retry.js.map +1 -0
- package/lib/services/admin.d.ts +2796 -0
- package/lib/services/admin.d.ts.map +1 -0
- package/lib/services/admin.js +3225 -0
- package/lib/services/admin.js.map +1 -0
- package/lib/services/api.d.ts +23 -0
- package/lib/services/api.d.ts.map +1 -0
- package/lib/services/api.js +26 -0
- package/lib/services/api.js.map +1 -0
- package/lib/services/apps.d.ts +568 -0
- package/lib/services/apps.d.ts.map +1 -0
- package/lib/services/apps.js +584 -0
- package/lib/services/apps.js.map +1 -0
- package/lib/services/assistant.d.ts +290 -0
- package/lib/services/assistant.d.ts.map +1 -0
- package/lib/services/assistant.js +232 -0
- package/lib/services/assistant.js.map +1 -0
- package/lib/services/auth.d.ts +90 -0
- package/lib/services/auth.d.ts.map +1 -0
- package/lib/services/auth.js +114 -0
- package/lib/services/auth.js.map +1 -0
- package/lib/services/blocks.d.ts +31 -0
- package/lib/services/blocks.d.ts.map +1 -0
- package/lib/services/blocks.js +31 -0
- package/lib/services/blocks.js.map +1 -0
- package/lib/services/bookmarks.d.ts +91 -0
- package/lib/services/bookmarks.d.ts.map +1 -0
- package/lib/services/bookmarks.js +98 -0
- package/lib/services/bookmarks.js.map +1 -0
- package/lib/services/bots.d.ts +60 -0
- package/lib/services/bots.d.ts.map +1 -0
- package/lib/services/bots.js +68 -0
- package/lib/services/bots.js.map +1 -0
- package/lib/services/calls.d.ts +124 -0
- package/lib/services/calls.d.ts.map +1 -0
- package/lib/services/calls.js +136 -0
- package/lib/services/calls.js.map +1 -0
- package/lib/services/canvases.d.ts +152 -0
- package/lib/services/canvases.d.ts.map +1 -0
- package/lib/services/canvases.js +152 -0
- package/lib/services/canvases.js.map +1 -0
- package/lib/services/chat.d.ts +525 -0
- package/lib/services/chat.d.ts.map +1 -0
- package/lib/services/chat.js +436 -0
- package/lib/services/chat.js.map +1 -0
- package/lib/services/conversations.d.ts +642 -0
- package/lib/services/conversations.d.ts.map +1 -0
- package/lib/services/conversations.js +769 -0
- package/lib/services/conversations.js.map +1 -0
- package/lib/services/dialog.d.ts +20 -0
- package/lib/services/dialog.d.ts.map +1 -0
- package/lib/services/dialog.js +27 -0
- package/lib/services/dialog.js.map +1 -0
- package/lib/services/dnd.d.ts +94 -0
- package/lib/services/dnd.d.ts.map +1 -0
- package/lib/services/dnd.js +111 -0
- package/lib/services/dnd.js.map +1 -0
- package/lib/services/emoji.d.ts +35 -0
- package/lib/services/emoji.d.ts.map +1 -0
- package/lib/services/emoji.js +40 -0
- package/lib/services/emoji.js.map +1 -0
- package/lib/services/entity.d.ts +93 -0
- package/lib/services/entity.d.ts.map +1 -0
- package/lib/services/entity.js +89 -0
- package/lib/services/entity.js.map +1 -0
- package/lib/services/files.d.ts +473 -0
- package/lib/services/files.d.ts.map +1 -0
- package/lib/services/files.js +510 -0
- package/lib/services/files.js.map +1 -0
- package/lib/services/functions.d.ts +235 -0
- package/lib/services/functions.d.ts.map +1 -0
- package/lib/services/functions.js +261 -0
- package/lib/services/functions.js.map +1 -0
- package/lib/services/index.d.ts +35 -0
- package/lib/services/index.d.ts.map +1 -0
- package/lib/services/index.js +36 -0
- package/lib/services/index.js.map +1 -0
- package/lib/services/lists.d.ts +300 -0
- package/lib/services/lists.d.ts.map +1 -0
- package/lib/services/lists.js +366 -0
- package/lib/services/lists.js.map +1 -0
- package/lib/services/migration.d.ts +34 -0
- package/lib/services/migration.d.ts.map +1 -0
- package/lib/services/migration.js +36 -0
- package/lib/services/migration.js.map +1 -0
- package/lib/services/oauth.d.ts +307 -0
- package/lib/services/oauth.d.ts.map +1 -0
- package/lib/services/oauth.js +278 -0
- package/lib/services/oauth.js.map +1 -0
- package/lib/services/openid.d.ts +86 -0
- package/lib/services/openid.d.ts.map +1 -0
- package/lib/services/openid.js +93 -0
- package/lib/services/openid.js.map +1 -0
- package/lib/services/pins.d.ts +64 -0
- package/lib/services/pins.d.ts.map +1 -0
- package/lib/services/pins.js +75 -0
- package/lib/services/pins.js.map +1 -0
- package/lib/services/reactions.d.ts +108 -0
- package/lib/services/reactions.d.ts.map +1 -0
- package/lib/services/reactions.js +119 -0
- package/lib/services/reactions.js.map +1 -0
- package/lib/services/reminders.d.ts +89 -0
- package/lib/services/reminders.d.ts.map +1 -0
- package/lib/services/reminders.js +109 -0
- package/lib/services/reminders.js.map +1 -0
- package/lib/services/rtm.d.ts +68 -0
- package/lib/services/rtm.d.ts.map +1 -0
- package/lib/services/rtm.js +74 -0
- package/lib/services/rtm.js.map +1 -0
- package/lib/services/search.d.ts +239 -0
- package/lib/services/search.d.ts.map +1 -0
- package/lib/services/search.js +190 -0
- package/lib/services/search.js.map +1 -0
- package/lib/services/stars.d.ts +126 -0
- package/lib/services/stars.d.ts.map +1 -0
- package/lib/services/stars.js +145 -0
- package/lib/services/stars.js.map +1 -0
- package/lib/services/team.d.ts +309 -0
- package/lib/services/team.d.ts.map +1 -0
- package/lib/services/team.js +336 -0
- package/lib/services/team.js.map +1 -0
- package/lib/services/tooling.d.ts +31 -0
- package/lib/services/tooling.d.ts.map +1 -0
- package/lib/services/tooling.js +38 -0
- package/lib/services/tooling.js.map +1 -0
- package/lib/services/usergroups.d.ts +183 -0
- package/lib/services/usergroups.d.ts.map +1 -0
- package/lib/services/usergroups.js +180 -0
- package/lib/services/usergroups.js.map +1 -0
- package/lib/services/users.d.ts +246 -0
- package/lib/services/users.d.ts.map +1 -0
- package/lib/services/users.js +309 -0
- package/lib/services/users.js.map +1 -0
- package/lib/services/views.d.ts +84 -0
- package/lib/services/views.d.ts.map +1 -0
- package/lib/services/views.js +95 -0
- package/lib/services/views.js.map +1 -0
- package/lib/services/workflows.d.ts +231 -0
- package/lib/services/workflows.d.ts.map +1 -0
- package/lib/services/workflows.js +240 -0
- package/lib/services/workflows.js.map +1 -0
- package/lib/traits.d.ts +11 -0
- package/lib/traits.d.ts.map +1 -0
- package/lib/traits.js +12 -0
- package/lib/traits.js.map +1 -0
- package/package.json +82 -4
- package/src/credentials.ts +86 -0
- package/src/errors.ts +101 -0
- package/src/index.ts +20 -0
- package/src/pagination.ts +35 -0
- package/src/protocol.ts +326 -0
- package/src/retry.ts +76 -0
- package/src/services/admin.ts +7729 -0
- package/src/services/api.ts +58 -0
- package/src/services/apps.ts +1441 -0
- package/src/services/assistant.ts +639 -0
- package/src/services/auth.ts +241 -0
- package/src/services/blocks.ts +80 -0
- package/src/services/bookmarks.ts +223 -0
- package/src/services/bots.ts +144 -0
- package/src/services/calls.ts +318 -0
- package/src/services/canvases.ts +392 -0
- package/src/services/chat.ts +1191 -0
- package/src/services/conversations.ts +1754 -0
- package/src/services/dialog.ts +55 -0
- package/src/services/dnd.ts +246 -0
- package/src/services/emoji.ts +91 -0
- package/src/services/entity.ts +225 -0
- package/src/services/files.ts +1192 -0
- package/src/services/functions.ts +647 -0
- package/src/services/index.ts +35 -0
- package/src/services/lists.ts +832 -0
- package/src/services/migration.ts +85 -0
- package/src/services/oauth.ts +658 -0
- package/src/services/openid.ts +243 -0
- package/src/services/pins.ts +167 -0
- package/src/services/reactions.ts +272 -0
- package/src/services/reminders.ts +240 -0
- package/src/services/rtm.ts +162 -0
- package/src/services/search.ts +507 -0
- package/src/services/stars.ts +323 -0
- package/src/services/team.ts +836 -0
- package/src/services/tooling.ts +78 -0
- package/src/services/usergroups.ts +441 -0
- package/src/services/users.ts +685 -0
- package/src/services/views.ts +212 -0
- package/src/services/workflows.ts +607 -0
- package/src/traits.ts +45 -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.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as Context from "effect/Context";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as Layer from "effect/Layer";
|
|
4
|
+
import * as Redacted from "effect/Redacted";
|
|
5
|
+
/**
|
|
6
|
+
* Slack Web API base URL. Every method is `POST/GET <base>/<method>`.
|
|
7
|
+
* Override via `SLACK_API_URL` only to point at a proxy or a mock.
|
|
8
|
+
*/
|
|
9
|
+
export declare const DEFAULT_API_BASE_URL = "https://slack.com/api";
|
|
10
|
+
export interface Config {
|
|
11
|
+
readonly token: Redacted.Redacted<string>;
|
|
12
|
+
readonly apiBaseUrl: string;
|
|
13
|
+
}
|
|
14
|
+
declare const Credentials_base: Context.ServiceClass<Credentials, "SlackCredentials", Effect.Effect<Config, never, never>>;
|
|
15
|
+
export declare class Credentials extends Credentials_base {
|
|
16
|
+
}
|
|
17
|
+
export declare const CredentialsFromEnv: Layer.Layer<Credentials, never, never>;
|
|
18
|
+
/**
|
|
19
|
+
* Convenience layer from a plain token + optional base URL. Pass an empty
|
|
20
|
+
* token (`""`) for the credential-less OAuth exchange methods.
|
|
21
|
+
*/
|
|
22
|
+
export declare const credentials: (config: {
|
|
23
|
+
readonly token: string;
|
|
24
|
+
readonly apiBaseUrl?: string;
|
|
25
|
+
}) => Layer.Layer<Credentials>;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=credentials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAG5C;;;GAGG;AACH,eAAO,MAAM,oBAAoB,0BAA0B,CAAC;AAE5D,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC1C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;;AAED,qBAAa,WAAY,SAAQ,gBAGV;CAAG;AAa1B,eAAO,MAAM,kBAAkB,wCAgB9B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW,WAAY;IAClC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B,KAAG,KAAK,CAAC,KAAK,CAAC,WAAW,CAOxB,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slack credentials — hand-written.
|
|
3
|
+
*
|
|
4
|
+
* The `Credentials` service resolves `{ token, apiBaseUrl }` per request; the
|
|
5
|
+
* protocol layer formats the `Authorization: Bearer <token>` header from it.
|
|
6
|
+
*
|
|
7
|
+
* Slack authorizes Web API calls with one bearer token, and the token's
|
|
8
|
+
* PREFIX carries its kind (https://docs.slack.dev/authentication/tokens):
|
|
9
|
+
* • `xoxb-…` — a bot token (what almost every integration uses)
|
|
10
|
+
* • `xoxp-…` — a user token, for calls made on behalf of a user
|
|
11
|
+
* • `xoxe.xoxb-…` / `xoxe.xoxp-…` — rotating (expiring) variants
|
|
12
|
+
* • `xapp-…` — an app-level token (Socket Mode / `apps.connections.open`)
|
|
13
|
+
* The header is the same for all of them, so there is no token-type knob.
|
|
14
|
+
*
|
|
15
|
+
* The OAuth exchange methods (`oauth.v2.access`, `openid.connect.token`, …)
|
|
16
|
+
* authenticate with `client_id`/`client_secret` args instead of a token — for
|
|
17
|
+
* those, an empty-string token is allowed and the protocol simply omits the
|
|
18
|
+
* Authorization header.
|
|
19
|
+
*/
|
|
20
|
+
import * as EffectConfig from "effect/Config";
|
|
21
|
+
import * as Context from "effect/Context";
|
|
22
|
+
import * as Effect from "effect/Effect";
|
|
23
|
+
import * as Layer from "effect/Layer";
|
|
24
|
+
import * as Redacted from "effect/Redacted";
|
|
25
|
+
import { ConfigError } from "@distilled.cloud/core/errors";
|
|
26
|
+
/**
|
|
27
|
+
* Slack Web API base URL. Every method is `POST/GET <base>/<method>`.
|
|
28
|
+
* Override via `SLACK_API_URL` only to point at a proxy or a mock.
|
|
29
|
+
*/
|
|
30
|
+
export const DEFAULT_API_BASE_URL = "https://slack.com/api";
|
|
31
|
+
export class Credentials extends Context.Service()("SlackCredentials") {
|
|
32
|
+
}
|
|
33
|
+
const envConfig = EffectConfig.all({
|
|
34
|
+
// SLACK_BOT_TOKEN is the spelling Bolt and most hosting platforms use;
|
|
35
|
+
// SLACK_TOKEN is the fallback (the node SDK's CLI convention).
|
|
36
|
+
token: EffectConfig.string("SLACK_BOT_TOKEN").pipe(EffectConfig.orElse(() => EffectConfig.string("SLACK_TOKEN"))),
|
|
37
|
+
apiBaseUrl: EffectConfig.string("SLACK_API_URL").pipe(EffectConfig.withDefault(DEFAULT_API_BASE_URL)),
|
|
38
|
+
});
|
|
39
|
+
export const CredentialsFromEnv = Layer.succeed(Credentials, envConfig.pipe(Effect.mapError(() => new ConfigError({
|
|
40
|
+
message: "SLACK_BOT_TOKEN (or SLACK_TOKEN) environment variable is required",
|
|
41
|
+
})), Effect.map(({ token, apiBaseUrl }) => ({
|
|
42
|
+
token: Redacted.make(token),
|
|
43
|
+
apiBaseUrl,
|
|
44
|
+
})), Effect.orDie));
|
|
45
|
+
/**
|
|
46
|
+
* Convenience layer from a plain token + optional base URL. Pass an empty
|
|
47
|
+
* token (`""`) for the credential-less OAuth exchange methods.
|
|
48
|
+
*/
|
|
49
|
+
export const credentials = (config) => Layer.succeed(Credentials, Effect.succeed({
|
|
50
|
+
token: Redacted.make(config.token),
|
|
51
|
+
apiBaseUrl: config.apiBaseUrl ?? DEFAULT_API_BASE_URL,
|
|
52
|
+
}));
|
|
53
|
+
//# sourceMappingURL=credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credentials.js","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,YAAY,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,uBAAuB,CAAC;AAO5D,MAAM,OAAO,WAAY,SAAQ,OAAO,CAAC,OAAO,EAG7C,CAAC,kBAAkB,CAAC;CAAG;AAE1B,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,CAAC;IACjC,uEAAuE;IACvE,+DAA+D;IAC/D,KAAK,EAAE,YAAY,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,IAAI,CAChD,YAAY,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAC9D;IACD,UAAU,EAAE,YAAY,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,IAAI,CACnD,YAAY,CAAC,WAAW,CAAC,oBAAoB,CAAC,CAC/C;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAC,OAAO,CAC7C,WAAW,EACX,SAAS,CAAC,IAAI,CACZ,MAAM,CAAC,QAAQ,CACb,GAAG,EAAE,CACH,IAAI,WAAW,CAAC;IACd,OAAO,EACL,mEAAmE;CACtE,CAAC,CACL,EACD,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC;IACrC,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC;IAC3B,UAAU;CACX,CAAC,CAAC,EACH,MAAM,CAAC,KAAK,CACb,CACF,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,MAG3B,EAA4B,EAAE,CAC7B,KAAK,CAAC,OAAO,CACX,WAAW,EACX,MAAM,CAAC,OAAO,CAAC;IACb,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;IAClC,UAAU,EAAE,MAAM,CAAC,UAAU,IAAI,oBAAoB;CACtD,CAAC,CACH,CAAC"}
|
package/lib/errors.d.ts
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slack-specific error types.
|
|
3
|
+
*
|
|
4
|
+
* Slack reports failures as `{ "ok": false, "error": "<slug>" }` — usually
|
|
5
|
+
* with HTTP 200 — so the interesting field is the machine-readable `error`
|
|
6
|
+
* slug, not the status. The protocol maps the well-known infrastructure
|
|
7
|
+
* slugs (auth, throttling, server hiccups) onto core's shared HTTP error
|
|
8
|
+
* classes and surfaces everything else as {@link SlackError} with the slug
|
|
9
|
+
* preserved for branching. Each generated operation's doc comment lists the
|
|
10
|
+
* slugs that method can produce.
|
|
11
|
+
*/
|
|
12
|
+
export { BadGateway, BadRequest, Conflict, ConfigError, Forbidden, GatewayTimeout, InternalServerError, NotFound, ServiceUnavailable, TooManyRequests, Unauthorized, UnprocessableEntity, HTTP_STATUS_MAP, DEFAULT_ERRORS, API_ERRORS, } from "@distilled.cloud/core/errors";
|
|
13
|
+
import type { DefaultErrors as CoreDefaultErrors } from "@distilled.cloud/core/errors";
|
|
14
|
+
import * as Schema from "effect/Schema";
|
|
15
|
+
declare const SlackError_base: Schema.Class<SlackError, Schema.TaggedStruct<"SlackError", {
|
|
16
|
+
readonly code: Schema.String;
|
|
17
|
+
readonly message: Schema.optional<Schema.String>;
|
|
18
|
+
readonly needed: Schema.optional<Schema.String>;
|
|
19
|
+
readonly provided: Schema.optional<Schema.String>;
|
|
20
|
+
readonly messages: Schema.optional<Schema.$Array<Schema.String>>;
|
|
21
|
+
}>, import("effect/Cause").YieldableError>;
|
|
22
|
+
/**
|
|
23
|
+
* A Slack API error envelope: `ok: false` with a machine-readable slug.
|
|
24
|
+
* `code` is the slug (`channel_not_found`, `invalid_blocks`, …) — the field
|
|
25
|
+
* to branch on; the per-method slugs are listed in each operation's doc
|
|
26
|
+
* comment. `needed`/`provided` carry scope detail on `missing_scope`;
|
|
27
|
+
* `messages` carries the envelope's `response_metadata.messages` (per-field
|
|
28
|
+
* validation detail on `invalid_arguments`).
|
|
29
|
+
*/
|
|
30
|
+
export declare class SlackError extends SlackError_base {
|
|
31
|
+
}
|
|
32
|
+
declare const SlackRateLimited_base: Schema.Class<SlackRateLimited, Schema.TaggedStruct<"SlackRateLimited", {
|
|
33
|
+
readonly code: Schema.String;
|
|
34
|
+
readonly message: Schema.optional<Schema.String>;
|
|
35
|
+
readonly retryAfter: Schema.optional<Schema.declare<import("effect/Duration").Duration, import("effect/Duration").Duration>>;
|
|
36
|
+
}>, import("effect/Cause").YieldableError> & (new (...args: any[]) => {
|
|
37
|
+
"@distilled/meta/error-categories": {
|
|
38
|
+
"@distilled/errors/retryable": true;
|
|
39
|
+
};
|
|
40
|
+
}) & (new (...args: any[]) => {
|
|
41
|
+
"@distilled.cloud/error/categories": {
|
|
42
|
+
ThrottlingError: true;
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
/**
|
|
46
|
+
* Slack rate limit — a 429 or the `rate_limited`/`ratelimited` slug. Slack
|
|
47
|
+
* answers with a `Retry-After` header the default retry policy honors.
|
|
48
|
+
*/
|
|
49
|
+
export declare class SlackRateLimited extends SlackRateLimited_base {
|
|
50
|
+
}
|
|
51
|
+
declare const SlackHttpError_base: Schema.Class<SlackHttpError, Schema.TaggedStruct<"SlackHttpError", {
|
|
52
|
+
readonly status: Schema.Number;
|
|
53
|
+
readonly message: Schema.String;
|
|
54
|
+
readonly body: Schema.optional<Schema.String>;
|
|
55
|
+
}>, import("effect/Cause").YieldableError>;
|
|
56
|
+
/**
|
|
57
|
+
* HTTP error — a non-2xx response without a parseable Slack error envelope
|
|
58
|
+
* (proxy pages, HTML 5xx bodies).
|
|
59
|
+
*/
|
|
60
|
+
export declare class SlackHttpError extends SlackHttpError_base {
|
|
61
|
+
}
|
|
62
|
+
declare const SlackParseError_base: Schema.Class<SlackParseError, Schema.TaggedStruct<"SlackParseError", {
|
|
63
|
+
readonly body: Schema.Unknown;
|
|
64
|
+
readonly cause: Schema.Unknown;
|
|
65
|
+
}>, import("effect/Cause").YieldableError> & (new (...args: any[]) => {
|
|
66
|
+
"@distilled.cloud/error/categories": {
|
|
67
|
+
ParseError: true;
|
|
68
|
+
};
|
|
69
|
+
});
|
|
70
|
+
/** Schema parse error wrapper. */
|
|
71
|
+
export declare class SlackParseError extends SlackParseError_base {
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Errors any Slack operation may surface in addition to the shared HTTP
|
|
75
|
+
* status errors.
|
|
76
|
+
*/
|
|
77
|
+
export type ClientErrors = SlackError | SlackRateLimited | SlackHttpError | SlackParseError;
|
|
78
|
+
/**
|
|
79
|
+
* Default Slack operation errors: the shared HTTP status errors from core
|
|
80
|
+
* plus the client-level envelope/decode errors.
|
|
81
|
+
*/
|
|
82
|
+
export type DefaultErrors = CoreDefaultErrors | ClientErrors;
|
|
83
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EACL,UAAU,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACX,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,UAAU,GACX,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEvF,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;;;;;;;;AAKxC;;;;;;;GAOG;AACH,qBAAa,UAAW,SAAQ,eAM9B;CAAG;;;;;;;;;;;;;;AAEL;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,qBAOuB;CAAG;;;;;;AAEhE;;;GAGG;AACH,qBAAa,cAAe,SAAQ,mBAOnC;CAAG;;;;;;;;;AAEJ,kCAAkC;AAClC,qBAAa,eAAgB,SAAQ,oBAMN;CAAG;AAElC;;;GAGG;AACH,MAAM,MAAM,YAAY,GACpB,UAAU,GACV,gBAAgB,GAChB,cAAc,GACd,eAAe,CAAC;AAEpB;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAAG,YAAY,CAAC"}
|
package/lib/errors.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slack-specific error types.
|
|
3
|
+
*
|
|
4
|
+
* Slack reports failures as `{ "ok": false, "error": "<slug>" }` — usually
|
|
5
|
+
* with HTTP 200 — so the interesting field is the machine-readable `error`
|
|
6
|
+
* slug, not the status. The protocol maps the well-known infrastructure
|
|
7
|
+
* slugs (auth, throttling, server hiccups) onto core's shared HTTP error
|
|
8
|
+
* classes and surfaces everything else as {@link SlackError} with the slug
|
|
9
|
+
* preserved for branching. Each generated operation's doc comment lists the
|
|
10
|
+
* slugs that method can produce.
|
|
11
|
+
*/
|
|
12
|
+
export { BadGateway, BadRequest, Conflict, ConfigError, Forbidden, GatewayTimeout, InternalServerError, NotFound, ServiceUnavailable, TooManyRequests, Unauthorized, UnprocessableEntity, HTTP_STATUS_MAP, DEFAULT_ERRORS, API_ERRORS, } from "@distilled.cloud/core/errors";
|
|
13
|
+
import * as Schema from "effect/Schema";
|
|
14
|
+
import * as Category from "@distilled.cloud/core/category";
|
|
15
|
+
import { withCategory } from "@distilled.cloud/core/error-category";
|
|
16
|
+
import { DurationSchema, RETRYABLE } from "@distilled.cloud/core/errors";
|
|
17
|
+
/**
|
|
18
|
+
* A Slack API error envelope: `ok: false` with a machine-readable slug.
|
|
19
|
+
* `code` is the slug (`channel_not_found`, `invalid_blocks`, …) — the field
|
|
20
|
+
* to branch on; the per-method slugs are listed in each operation's doc
|
|
21
|
+
* comment. `needed`/`provided` carry scope detail on `missing_scope`;
|
|
22
|
+
* `messages` carries the envelope's `response_metadata.messages` (per-field
|
|
23
|
+
* validation detail on `invalid_arguments`).
|
|
24
|
+
*/
|
|
25
|
+
export class SlackError extends Schema.TaggedError()("SlackError", {
|
|
26
|
+
code: Schema.String,
|
|
27
|
+
message: Schema.optional(Schema.String),
|
|
28
|
+
needed: Schema.optional(Schema.String),
|
|
29
|
+
provided: Schema.optional(Schema.String),
|
|
30
|
+
messages: Schema.optional(Schema.Array(Schema.String)),
|
|
31
|
+
}) {
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Slack rate limit — a 429 or the `rate_limited`/`ratelimited` slug. Slack
|
|
35
|
+
* answers with a `Retry-After` header the default retry policy honors.
|
|
36
|
+
*/
|
|
37
|
+
export class SlackRateLimited extends Schema.TaggedError()("SlackRateLimited", {
|
|
38
|
+
code: Schema.String,
|
|
39
|
+
message: Schema.optional(Schema.String),
|
|
40
|
+
retryAfter: Schema.optional(DurationSchema),
|
|
41
|
+
}).pipe(withCategory(RETRYABLE), Category.withThrottlingError) {
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* HTTP error — a non-2xx response without a parseable Slack error envelope
|
|
45
|
+
* (proxy pages, HTML 5xx bodies).
|
|
46
|
+
*/
|
|
47
|
+
export class SlackHttpError extends Schema.TaggedError()("SlackHttpError", {
|
|
48
|
+
status: Schema.Number,
|
|
49
|
+
message: Schema.String,
|
|
50
|
+
body: Schema.optional(Schema.String),
|
|
51
|
+
}) {
|
|
52
|
+
}
|
|
53
|
+
/** Schema parse error wrapper. */
|
|
54
|
+
export class SlackParseError extends Schema.TaggedError()("SlackParseError", {
|
|
55
|
+
body: Schema.Unknown,
|
|
56
|
+
cause: Schema.Unknown,
|
|
57
|
+
}).pipe(Category.withParseError) {
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EACL,UAAU,EACV,UAAU,EACV,QAAQ,EACR,WAAW,EACX,SAAS,EACT,cAAc,EACd,mBAAmB,EACnB,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,UAAU,GACX,MAAM,8BAA8B,CAAC;AAGtC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,QAAQ,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzE;;;;;;;GAOG;AACH,MAAM,OAAO,UAAW,SAAQ,MAAM,CAAC,WAAW,EAAc,CAAC,YAAY,EAAE;IAC7E,IAAI,EAAE,MAAM,CAAC,MAAM;IACnB,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACvC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACtC,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACxC,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;CACvD,CAAC;CAAG;AAEL;;;GAGG;AACH,MAAM,OAAO,gBAAiB,SAAQ,MAAM,CAAC,WAAW,EAAoB,CAC1E,kBAAkB,EAClB;IACE,IAAI,EAAE,MAAM,CAAC,MAAM;IACnB,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACvC,UAAU,EAAE,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC;CAC5C,CACF,CAAC,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE,QAAQ,CAAC,mBAAmB,CAAC;CAAG;AAEhE;;;GAGG;AACH,MAAM,OAAO,cAAe,SAAQ,MAAM,CAAC,WAAW,EAAkB,CACtE,gBAAgB,EAChB;IACE,MAAM,EAAE,MAAM,CAAC,MAAM;IACrB,OAAO,EAAE,MAAM,CAAC,MAAM;IACtB,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;CACrC,CACF;CAAG;AAEJ,kCAAkC;AAClC,MAAM,OAAO,eAAgB,SAAQ,MAAM,CAAC,WAAW,EAAmB,CACxE,iBAAiB,EACjB;IACE,IAAI,EAAE,MAAM,CAAC,OAAO;IACpB,KAAK,EAAE,MAAM,CAAC,OAAO;CACtB,CACF,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC;CAAG"}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @distilled.cloud/slack — Slack Web API SDK for Effect.
|
|
3
|
+
*
|
|
4
|
+
* `./services` is generated by `scripts/generate.ts` from the Smithy models
|
|
5
|
+
* in `.generated-specs` (written by `scripts/convert.ts` from the JSON twins
|
|
6
|
+
* of the docs.slack.dev method reference, downloaded by
|
|
7
|
+
* `scripts/download-docs.ts`). Everything else in this folder is
|
|
8
|
+
* hand-written.
|
|
9
|
+
*/
|
|
10
|
+
export * from "./credentials.ts";
|
|
11
|
+
export * from "./errors.ts";
|
|
12
|
+
export * as T from "./traits.ts";
|
|
13
|
+
export { SlackProtocol, type SlackOpError, type SlackOpContext, } from "./protocol.ts";
|
|
14
|
+
export * as Retry from "./retry.ts";
|
|
15
|
+
export * as Pagination from "./pagination.ts";
|
|
16
|
+
export * as Services from "./services/index.ts";
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,OAAO,KAAK,CAAC,MAAM,aAAa,CAAC;AACjC,OAAO,EACL,aAAa,EACb,KAAK,YAAY,EACjB,KAAK,cAAc,GACpB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC"}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @distilled.cloud/slack — Slack Web API SDK for Effect.
|
|
3
|
+
*
|
|
4
|
+
* `./services` is generated by `scripts/generate.ts` from the Smithy models
|
|
5
|
+
* in `.generated-specs` (written by `scripts/convert.ts` from the JSON twins
|
|
6
|
+
* of the docs.slack.dev method reference, downloaded by
|
|
7
|
+
* `scripts/download-docs.ts`). Everything else in this folder is
|
|
8
|
+
* hand-written.
|
|
9
|
+
*/
|
|
10
|
+
export * from "./credentials.js";
|
|
11
|
+
export * from "./errors.js";
|
|
12
|
+
export * as T from "./traits.js";
|
|
13
|
+
export { SlackProtocol, } from "./protocol.js";
|
|
14
|
+
export * as Retry from "./retry.js";
|
|
15
|
+
export * as Pagination from "./pagination.js";
|
|
16
|
+
export * as Services from "./services/index.js";
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,OAAO,KAAK,CAAC,MAAM,aAAa,CAAC;AACjC,OAAO,EACL,aAAa,GAGd,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slack pagination — hand-written.
|
|
3
|
+
*
|
|
4
|
+
* Slack's cursor convention: pass `cursor` (from the previous response's
|
|
5
|
+
* `response_metadata.next_cursor`), and an EMPTY `next_cursor` means the
|
|
6
|
+
* last page — which is exactly core's cursor traversal (`isTerminalToken`
|
|
7
|
+
* treats `""` as terminal). Paginated operations are compiled with this
|
|
8
|
+
* strategy by scripts/generate.ts from the `smithy.api#paginated` traits the
|
|
9
|
+
* converter stamps.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* import * as Effect from "effect/Effect";
|
|
14
|
+
* import * as Stream from "effect/Stream";
|
|
15
|
+
* import * as Users from "@distilled.cloud/slack/users";
|
|
16
|
+
*
|
|
17
|
+
* // Every member, cursors followed automatically:
|
|
18
|
+
* const members = Users.list.items({ limit: 200 }).pipe(
|
|
19
|
+
* Stream.runCollect,
|
|
20
|
+
* );
|
|
21
|
+
* // Or page by page:
|
|
22
|
+
* const pages = Users.list.pages({ limit: 200 });
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
import * as Pagination from "@distilled.cloud/core/pagination";
|
|
26
|
+
/**
|
|
27
|
+
* Cursor traversal for Slack: follow `response_metadata.next_cursor` until
|
|
28
|
+
* it comes back empty/absent.
|
|
29
|
+
*/
|
|
30
|
+
export declare const slackPaginate: Pagination.PaginationStrategy;
|
|
31
|
+
//# sourceMappingURL=pagination.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../src/pagination.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,KAAK,UAAU,MAAM,kCAAkC,CAAC;AAE/D;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,UAAU,CAAC,kBAIqB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slack pagination — hand-written.
|
|
3
|
+
*
|
|
4
|
+
* Slack's cursor convention: pass `cursor` (from the previous response's
|
|
5
|
+
* `response_metadata.next_cursor`), and an EMPTY `next_cursor` means the
|
|
6
|
+
* last page — which is exactly core's cursor traversal (`isTerminalToken`
|
|
7
|
+
* treats `""` as terminal). Paginated operations are compiled with this
|
|
8
|
+
* strategy by scripts/generate.ts from the `smithy.api#paginated` traits the
|
|
9
|
+
* converter stamps.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* import * as Effect from "effect/Effect";
|
|
14
|
+
* import * as Stream from "effect/Stream";
|
|
15
|
+
* import * as Users from "@distilled.cloud/slack/users";
|
|
16
|
+
*
|
|
17
|
+
* // Every member, cursors followed automatically:
|
|
18
|
+
* const members = Users.list.items({ limit: 200 }).pipe(
|
|
19
|
+
* Stream.runCollect,
|
|
20
|
+
* );
|
|
21
|
+
* // Or page by page:
|
|
22
|
+
* const pages = Users.list.pages({ limit: 200 });
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
import * as Pagination from "@distilled.cloud/core/pagination";
|
|
26
|
+
/**
|
|
27
|
+
* Cursor traversal for Slack: follow `response_metadata.next_cursor` until
|
|
28
|
+
* it comes back empty/absent.
|
|
29
|
+
*/
|
|
30
|
+
export const slackPaginate = (operation, input, pagination) => Pagination.paginateCursor(operation, input, pagination);
|
|
31
|
+
//# sourceMappingURL=pagination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../src/pagination.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,KAAK,UAAU,MAAM,kCAAkC,CAAC;AAE/D;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAkC,CAC1D,SAAS,EACT,KAAK,EACL,UAAU,EACV,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC,SAAS,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as Layer from "effect/Layer";
|
|
2
|
+
import type * as HttpClient from "effect/unstable/http/HttpClient";
|
|
3
|
+
import type * as HttpClientError from "effect/unstable/http/HttpClientError";
|
|
4
|
+
import * as API from "@distilled.cloud/core/api";
|
|
5
|
+
import { ConfigError } from "@distilled.cloud/core/errors";
|
|
6
|
+
import { Credentials } from "./credentials.ts";
|
|
7
|
+
import { type DefaultErrors } from "./errors.ts";
|
|
8
|
+
/**
|
|
9
|
+
* Error channel shared by every generated Slack operation. Generated service
|
|
10
|
+
* files annotate operations with `API.OperationMethod<I, O, SlackOpError,
|
|
11
|
+
* SlackOpContext>` explicitly so the compiler never infers these back out of
|
|
12
|
+
* the schema generics.
|
|
13
|
+
*/
|
|
14
|
+
export type SlackOpError = DefaultErrors | ConfigError | HttpClientError.HttpClientError;
|
|
15
|
+
/** Context (requirements) shared by every generated Slack operation. */
|
|
16
|
+
export type SlackOpContext = Credentials | HttpClient.HttpClient;
|
|
17
|
+
export declare const SlackProtocol: Layer.Layer<API.Protocol>;
|
|
18
|
+
//# sourceMappingURL=protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,OAAO,KAAK,KAAK,UAAU,MAAM,iCAAiC,CAAC;AACnE,OAAO,KAAK,KAAK,eAAe,MAAM,sCAAsC,CAAC;AAI7E,OAAO,KAAK,GAAG,MAAM,2BAA2B,CAAC;AAkBjD,OAAO,EACL,WAAW,EAMZ,MAAM,8BAA8B,CAAC;AAKtC,OAAO,EAAE,WAAW,EAAe,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EACL,KAAK,aAAa,EAInB,MAAM,aAAa,CAAC;AAErB;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GACpB,aAAa,GACb,WAAW,GACX,eAAe,CAAC,eAAe,CAAC;AAEpC,wEAAwE;AACxE,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,UAAU,CAAC,UAAU,CAAC;AAyOjE,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAQnD,CAAC"}
|