@sponson/adapters 0.0.0-stage → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +4 -2
- package/dist/algolia.d.ts +6 -0
- package/dist/algolia.js +151 -0
- package/dist/algolia.js.map +1 -0
- package/dist/clerk.d.ts +8 -0
- package/dist/clerk.js +107 -0
- package/dist/clerk.js.map +1 -0
- package/dist/cloudflare.d.ts +25 -0
- package/dist/cloudflare.js +310 -0
- package/dist/cloudflare.js.map +1 -0
- package/dist/common.d.ts +73 -0
- package/dist/common.js +140 -0
- package/dist/common.js.map +1 -0
- package/dist/digest.d.ts +46 -0
- package/dist/digest.js +129 -0
- package/dist/digest.js.map +1 -0
- package/dist/digitalocean.d.ts +5 -0
- package/dist/digitalocean.js +243 -0
- package/dist/digitalocean.js.map +1 -0
- package/dist/http-adapter-action.d.ts +63 -0
- package/dist/http-adapter-action.js +369 -0
- package/dist/http-adapter-action.js.map +1 -0
- package/dist/http-adapter-auth.d.ts +88 -0
- package/dist/http-adapter-auth.js +437 -0
- package/dist/http-adapter-auth.js.map +1 -0
- package/dist/http-adapter-client.d.ts +51 -0
- package/dist/http-adapter-client.js +156 -0
- package/dist/http-adapter-client.js.map +1 -0
- package/dist/http-adapter-graphql.d.ts +39 -0
- package/dist/http-adapter-graphql.js +157 -0
- package/dist/http-adapter-graphql.js.map +1 -0
- package/dist/http-adapter-list.d.ts +33 -0
- package/dist/http-adapter-list.js +421 -0
- package/dist/http-adapter-list.js.map +1 -0
- package/dist/http-adapter-resource.d.ts +29 -0
- package/dist/http-adapter-resource.js +462 -0
- package/dist/http-adapter-resource.js.map +1 -0
- package/dist/http-adapter-spec.d.ts +216 -0
- package/dist/http-adapter-spec.js +660 -0
- package/dist/http-adapter-spec.js.map +1 -0
- package/dist/http-adapter.d.ts +16 -0
- package/dist/http-adapter.js +28 -0
- package/dist/http-adapter.js.map +1 -0
- package/dist/http.d.ts +179 -0
- package/dist/http.js +352 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +45 -0
- package/dist/index.js.map +1 -0
- package/dist/launchdarkly.d.ts +15 -0
- package/dist/launchdarkly.js +337 -0
- package/dist/launchdarkly.js.map +1 -0
- package/dist/manual.d.ts +13 -0
- package/dist/manual.js +201 -0
- package/dist/manual.js.map +1 -0
- package/dist/neon.d.ts +8 -0
- package/dist/neon.js +167 -0
- package/dist/neon.js.map +1 -0
- package/dist/netlify.d.ts +18 -0
- package/dist/netlify.js +436 -0
- package/dist/netlify.js.map +1 -0
- package/dist/planetscale.d.ts +10 -0
- package/dist/planetscale.js +311 -0
- package/dist/planetscale.js.map +1 -0
- package/dist/providers.d.ts +26 -0
- package/dist/providers.js +36 -0
- package/dist/providers.js.map +1 -0
- package/dist/recipes.d.ts +167 -0
- package/dist/recipes.js +246 -0
- package/dist/recipes.js.map +1 -0
- package/dist/secrets.d.ts +72 -0
- package/dist/secrets.js +476 -0
- package/dist/secrets.js.map +1 -0
- package/dist/sigv4.d.ts +56 -0
- package/dist/sigv4.js +118 -0
- package/dist/sigv4.js.map +1 -0
- package/dist/supabase.d.ts +9 -0
- package/dist/supabase.js +385 -0
- package/dist/supabase.js.map +1 -0
- package/dist/vercel.d.ts +8 -0
- package/dist/vercel.js +475 -0
- package/dist/vercel.js.map +1 -0
- package/dist/xata.d.ts +8 -0
- package/dist/xata.js +142 -0
- package/dist/xata.js.map +1 -0
- package/dist/xml.d.ts +25 -0
- package/dist/xml.js +211 -0
- package/dist/xml.js.map +1 -0
- package/package.json +58 -3
- package/recipes/amplify.yaml +147 -0
- package/recipes/auth0.yaml +178 -0
- package/recipes/azure_swa.yaml +116 -0
- package/recipes/cloud_run.yaml +97 -0
- package/recipes/cloudflare.yaml +108 -0
- package/recipes/cockroachdb.yaml +132 -0
- package/recipes/configcat.yaml +123 -0
- package/recipes/datadog.yaml +136 -0
- package/recipes/firebase.yaml +84 -0
- package/recipes/flagsmith.yaml +98 -0
- package/recipes/fly.yaml +97 -0
- package/recipes/fly_machines.yaml +67 -0
- package/recipes/gcs.yaml +102 -0
- package/recipes/github.yaml +123 -0
- package/recipes/growthbook.yaml +124 -0
- package/recipes/heroku.yaml +98 -0
- package/recipes/honeycomb.yaml +89 -0
- package/recipes/inngest.yaml +97 -0
- package/recipes/kinde.yaml +120 -0
- package/recipes/mongodb_atlas.yaml +119 -0
- package/recipes/okta.yaml +177 -0
- package/recipes/posthog.yaml +127 -0
- package/recipes/postmark.yaml +105 -0
- package/recipes/postmark_server.yaml +93 -0
- package/recipes/prisma.yaml +150 -0
- package/recipes/qstash.yaml +134 -0
- package/recipes/railway.yaml +130 -0
- package/recipes/render.yaml +103 -0
- package/recipes/resend.yaml +130 -0
- package/recipes/s3.yaml +108 -0
- package/recipes/sendgrid.yaml +165 -0
- package/recipes/sentry.yaml +158 -0
- package/recipes/split.yaml +121 -0
- package/recipes/statsig.yaml +124 -0
- package/recipes/stripe.yaml +310 -0
- package/recipes/stytch.yaml +113 -0
- package/recipes/svix.yaml +109 -0
- package/recipes/turso.yaml +98 -0
- package/recipes/unleash.yaml +149 -0
- package/recipes/upstash.yaml +130 -0
- package/recipes/vercel.yaml +116 -0
- package/recipes/workos.yaml +70 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @sponson/adapters
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The resource adapters and secret sources that ship with [Sponson](https://github.com/MishaBear94/Sponson#readme). `createRegistry()` returns all of them; the [built-in ops](https://github.com/MishaBear94/Sponson/blob/main/docs/plan-format.md#built-in-ops) and [secret schemes](https://github.com/MishaBear94/Sponson/blob/main/docs/plan-format.md#secret-schemes) are listed in the plan format reference. The package also ships the http adapter's [recipes](https://github.com/MishaBear94/Sponson/blob/main/docs/recipes.md) in `recipes/`.
|
|
4
|
+
|
|
5
|
+
Most users want the `sponson` CLI instead. Documentation: <https://sponson.mintlify.site>. Source and issues: [GitHub](https://github.com/MishaBear94/Sponson).
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ResourceAdapter } from "@sponson/core";
|
|
2
|
+
/**
|
|
3
|
+
* The Algolia adapter (`adapter: algolia` in a plan). Registered in `createRegistry()`; needs `ALGOLIA_API_KEY`
|
|
4
|
+
* (with the addObject, deleteIndex and settings ACLs) and `providers.algolia.application_id`.
|
|
5
|
+
*/
|
|
6
|
+
export declare const algoliaAdapter: ResourceAdapter;
|
package/dist/algolia.js
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Algolia adapter: an index per scope, copied from a template index. The copy is an asynchronous task, so `apply`
|
|
3
|
+
* waits for it to be published before the line counts as applied: that wait is why this is an adapter and not an
|
|
4
|
+
* `http` recipe (ADR 0017, "No polling"). The API assumptions it relies on are numbered AL1… at the top of
|
|
5
|
+
* packages/sim/src/routes/algolia.ts.
|
|
6
|
+
*
|
|
7
|
+
* - Key: `index:<name>`. Id: the index name (Algolia's own identity, AL1). The application is the provider block.
|
|
8
|
+
* - Hash: the name only. What was copied (`copy_from`, `scope`) is not something an index records, so it cannot be
|
|
9
|
+
* compared: changing it later does not copy again, and a console edit of the copy's records or settings is not
|
|
10
|
+
* drift. A deleted index is `missing`, and the next apply copies it again.
|
|
11
|
+
*/
|
|
12
|
+
import { setTimeout as sleep } from "node:timers/promises";
|
|
13
|
+
import { SponsonError, canonicalJson, markerKind, sha256 } from "@sponson/core";
|
|
14
|
+
// Only the stable authoring API exported from `@sponson/adapters` (listed in CONTRIBUTING.md).
|
|
15
|
+
import { assertNoPending, clientFor, deleteIgnoringNotFound, optionalEnv, paramError, requireEnv, requireProvider, stringParam } from "./common.js";
|
|
16
|
+
import { ShapeError, isObject, isProviderError } from "./http.js";
|
|
17
|
+
const ADAPTER = "algolia";
|
|
18
|
+
/** The environment Algolia reads; declared once, used by the code below and by the generated docs (`about`). */
|
|
19
|
+
const ABOUT = { credentialEnv: "ALGOLIA_API_KEY", baseUrlEnv: "ALGOLIA_API_URL", title: "Algolia", category: "search-payments", detect: { deps: ["algoliasearch", "@algolia/", "instantsearch.js", "react-instantsearch"], env: ["ALGOLIA_*"] } };
|
|
20
|
+
/** How often the copy task is polled, and for how long (milliseconds; overridable for tests). */
|
|
21
|
+
const POLL_MS = { env: "SPONSON_ALGOLIA_POLL_MS", fallback: 1000 };
|
|
22
|
+
const TASK_TIMEOUT_MS = { env: "SPONSON_ALGOLIA_TASK_TIMEOUT_MS", fallback: 5 * 60 * 1000 };
|
|
23
|
+
function msFromEnv(env, s) {
|
|
24
|
+
const raw = optionalEnv(env, s.env);
|
|
25
|
+
const n = Number(raw);
|
|
26
|
+
return raw !== undefined && Number.isFinite(n) && n >= 0 ? n : s.fallback;
|
|
27
|
+
}
|
|
28
|
+
/** The client for the application in `providers.algolia.application_id` (AL2: `https://<app id>.algolia.net`). */
|
|
29
|
+
function client(actx) {
|
|
30
|
+
const key = requireEnv(actx.env, ABOUT.credentialEnv, ADAPTER);
|
|
31
|
+
const appId = requireProvider(actx, "application_id", ADAPTER);
|
|
32
|
+
const baseUrl = optionalEnv(actx.env, ABOUT.baseUrlEnv) ?? `https://${appId}.algolia.net`;
|
|
33
|
+
return clientFor(actx, ADAPTER, { baseUrl, token: key, authHeader: "header:x-algolia-api-key", headers: { "X-Algolia-Application-Id": appId } });
|
|
34
|
+
}
|
|
35
|
+
function enc(s) {
|
|
36
|
+
return encodeURIComponent(s);
|
|
37
|
+
}
|
|
38
|
+
const PREFIX = "index:";
|
|
39
|
+
function indexRecord(name) {
|
|
40
|
+
return { key: `${PREFIX}${name}`, id: name, hash: sha256(canonicalJson({ name })), label: `Algolia index ${name}` };
|
|
41
|
+
}
|
|
42
|
+
function outputsOf(name) {
|
|
43
|
+
return { name };
|
|
44
|
+
}
|
|
45
|
+
/** Whether the index exists: its settings answer 200, or 404 (AL4). Reads only. */
|
|
46
|
+
async function exists(api, name) {
|
|
47
|
+
try {
|
|
48
|
+
await api.get(`/1/indexes/${enc(name)}/settings`);
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
catch (e) {
|
|
52
|
+
if (isProviderError(e, "PROVIDER_NOT_FOUND"))
|
|
53
|
+
return false;
|
|
54
|
+
throw e;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const SCOPES = ["settings", "synonyms", "rules"];
|
|
58
|
+
/** The copy's `scope`: absent (everything, records included), or a list of settings, synonyms and rules (AL3). */
|
|
59
|
+
function scopeParam(v) {
|
|
60
|
+
if (v === undefined || v === null)
|
|
61
|
+
return undefined;
|
|
62
|
+
if (!Array.isArray(v) || v.length === 0 || !v.every((s) => typeof s === "string" && SCOPES.includes(s))) {
|
|
63
|
+
throw paramError(ADAPTER, `param \`scope\` must be a non-empty list of ${SCOPES.join(", ")} (left out: records too)`, "scope");
|
|
64
|
+
}
|
|
65
|
+
return v;
|
|
66
|
+
}
|
|
67
|
+
/** The task id of a copy answer (AL3). */
|
|
68
|
+
function taskOf(body) {
|
|
69
|
+
if (!isObject(body) || typeof body.taskID !== "number")
|
|
70
|
+
throw new ShapeError("expected `{ taskID }`");
|
|
71
|
+
return body.taskID;
|
|
72
|
+
}
|
|
73
|
+
/** Poll the copy task until it is published (AL5); WAIT_TIMEOUT when it is not, which the next run resumes. */
|
|
74
|
+
async function waitPublished(actx, api, name, task) {
|
|
75
|
+
const deadline = Date.now() + msFromEnv(actx.env, TASK_TIMEOUT_MS);
|
|
76
|
+
for (;;) {
|
|
77
|
+
const status = await api.get(`/1/indexes/${enc(name)}/task/${task}`, (b) => {
|
|
78
|
+
if (!isObject(b) || typeof b.status !== "string")
|
|
79
|
+
throw new ShapeError("expected `{ status }`");
|
|
80
|
+
return b.status;
|
|
81
|
+
});
|
|
82
|
+
if (status === "published")
|
|
83
|
+
return;
|
|
84
|
+
if (Date.now() > deadline) {
|
|
85
|
+
throw new SponsonError("WAIT_TIMEOUT", `algolia: the copy into index ${name} (task ${task}) is not published after ${msFromEnv(actx.env, TASK_TIMEOUT_MS)}ms (${TASK_TIMEOUT_MS.env}); run again to keep waiting`, { adapter: ADAPTER, index: name });
|
|
86
|
+
}
|
|
87
|
+
actx.log(`copy into ${name} not published yet`);
|
|
88
|
+
await sleep(msFromEnv(actx.env, POLL_MS));
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function names(params) {
|
|
92
|
+
const name = stringParam(params, "name", ADAPTER);
|
|
93
|
+
const source = stringParam(params, "copy_from", ADAPTER);
|
|
94
|
+
if (name === source)
|
|
95
|
+
throw paramError(ADAPTER, "`name` and `copy_from` are the same index: the copy would overwrite its own template", "name");
|
|
96
|
+
return { name, source };
|
|
97
|
+
}
|
|
98
|
+
const index = {
|
|
99
|
+
outputs: { name: { available: "immediate" } },
|
|
100
|
+
async read(actx, params) {
|
|
101
|
+
if (markerKind(params.name) !== null)
|
|
102
|
+
return null;
|
|
103
|
+
const name = stringParam(params, "name", ADAPTER);
|
|
104
|
+
if (!(await exists(client(actx), name)))
|
|
105
|
+
return null;
|
|
106
|
+
return { resources: [indexRecord(name)], outputs: outputsOf(name) };
|
|
107
|
+
},
|
|
108
|
+
diff(live, params) {
|
|
109
|
+
const name = params.name;
|
|
110
|
+
const key = markerKind(name) !== null ? `${PREFIX}(pending)` : `${PREFIX}${String(name)}`;
|
|
111
|
+
const label = `Algolia index ${String(name)}`;
|
|
112
|
+
if (live?.resources.some((r) => r.key === key))
|
|
113
|
+
return [{ key, kind: "unchanged", label }];
|
|
114
|
+
const source = params.copy_from;
|
|
115
|
+
const after = markerKind(source) !== null ? { state: "pending", ref: String(source) } : { state: "literal", value: `copy of ${String(source)}` };
|
|
116
|
+
return [{ key, kind: "create", label, before: { state: "absent" }, after }];
|
|
117
|
+
},
|
|
118
|
+
async apply(actx, params, live) {
|
|
119
|
+
assertNoPending(params, ADAPTER);
|
|
120
|
+
const { name, source } = names(params);
|
|
121
|
+
const scope = scopeParam(params.scope);
|
|
122
|
+
const key = `${PREFIX}${name}`;
|
|
123
|
+
if (live?.resources.some((r) => r.key === key))
|
|
124
|
+
return { resources: live.resources, outputs: live.outputs, created: [] };
|
|
125
|
+
const api = client(actx);
|
|
126
|
+
// Copying an index that does not exist makes an empty one (AL3): refuse instead of handing out an empty index.
|
|
127
|
+
if (!(await exists(api, source)))
|
|
128
|
+
throw paramError(ADAPTER, `\`copy_from\` index ${source} does not exist in the application`, "copy_from");
|
|
129
|
+
// Announce the copy before sending it. A copy whose answer was lost is sent again by the next run, which
|
|
130
|
+
// overwrites the destination with the template once more (AL3): harmless before anyone wrote to it.
|
|
131
|
+
await actx.intend([key]);
|
|
132
|
+
actx.log(`copy ${source} to ${name}`);
|
|
133
|
+
const task = await api.post(`/1/indexes/${enc(source)}/operation`, { operation: "copy", destination: name, ...(scope ? { scope } : {}) }, taskOf, { idempotent: true });
|
|
134
|
+
await waitPublished(actx, api, name, task);
|
|
135
|
+
return { resources: [indexRecord(name)], outputs: outputsOf(name), created: [key] };
|
|
136
|
+
},
|
|
137
|
+
async destroy(actx, resources) {
|
|
138
|
+
const api = client(actx);
|
|
139
|
+
// Deleting an index that does not exist is ignored (AL6); a 404 is gone all the same.
|
|
140
|
+
// An intent the engine could not locate has no id: nothing is known to exist under it (the engine reports it).
|
|
141
|
+
for (const r of resources)
|
|
142
|
+
if (r.id !== "")
|
|
143
|
+
await deleteIgnoringNotFound(api, `/1/indexes/${enc(r.id)}`);
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* The Algolia adapter (`adapter: algolia` in a plan). Registered in `createRegistry()`; needs `ALGOLIA_API_KEY`
|
|
148
|
+
* (with the addObject, deleteIndex and settings ACLs) and `providers.algolia.application_id`.
|
|
149
|
+
*/
|
|
150
|
+
export const algoliaAdapter = { name: ADAPTER, ops: { index }, about: ABOUT };
|
|
151
|
+
//# sourceMappingURL=algolia.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"algolia.js","sourceRoot":"","sources":["../src/algolia.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,UAAU,IAAI,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,EAA6F,MAAM,eAAe,CAAC;AAC3K,+FAA+F;AAC/F,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,sBAAsB,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACpJ,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,eAAe,EAAkB,MAAM,WAAW,CAAC;AAElF,MAAM,OAAO,GAAG,SAAS,CAAC;AAC1B,gHAAgH;AAChH,MAAM,KAAK,GAAG,EAAE,aAAa,EAAE,iBAAiB,EAAE,UAAU,EAAE,iBAAiB,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,eAAe,EAAE,WAAW,EAAE,kBAAkB,EAAE,qBAAqB,CAAC,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,EAAE,EAAW,CAAC;AAE3P,iGAAiG;AACjG,MAAM,OAAO,GAAG,EAAE,GAAG,EAAE,yBAAyB,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AACnE,MAAM,eAAe,GAAG,EAAE,GAAG,EAAE,iCAAiC,EAAE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MAAM,cAAc,GAAoB,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC"}
|
package/dist/clerk.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ResourceAdapter } from "@sponson/core";
|
|
2
|
+
/** Clerk's API base URL; `CLERK_API_URL` overrides it (the sim and tests use that). */
|
|
3
|
+
export declare const CLERK_DEFAULT_API_URL = "https://api.clerk.com/v1";
|
|
4
|
+
/**
|
|
5
|
+
* Clerk: op `redirect_allow` keeps a redirect URL (e.g. a preview URL) on the allow-list. Needs
|
|
6
|
+
* `CLERK_SECRET_KEY`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const clerkAdapter: ResourceAdapter;
|
package/dist/clerk.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { isPendingMarker, sha256 } from "@sponson/core";
|
|
2
|
+
import { assertNoPending, clientFor, deleteIgnoringNotFound, diffValue, optionalEnv, requireEnv, stringParam } from "./common.js";
|
|
3
|
+
import { ShapeError, isObject, isProviderError, listAll, records } from "./http.js";
|
|
4
|
+
/** The environment clerk reads; declared once, used by the code below and by the generated docs. */
|
|
5
|
+
const ABOUT = { credentialEnv: "CLERK_SECRET_KEY", baseUrlEnv: "CLERK_API_URL", title: "Clerk", category: "auth", detect: { deps: ["@clerk/"], env: ["CLERK_*"] } };
|
|
6
|
+
/** Clerk's API base URL; `CLERK_API_URL` overrides it (the sim and tests use that). */
|
|
7
|
+
export const CLERK_DEFAULT_API_URL = "https://api.clerk.com/v1";
|
|
8
|
+
/** Page size asked for (the spec's `limit` allows 1–500, default 10). */
|
|
9
|
+
const CLERK_PAGE_LIMIT = 100;
|
|
10
|
+
function client(actx) {
|
|
11
|
+
const token = requireEnv(actx.env, ABOUT.credentialEnv, "clerk");
|
|
12
|
+
return clientFor(actx, "clerk", { baseUrl: optionalEnv(actx.env, ABOUT.baseUrlEnv) ?? CLERK_DEFAULT_API_URL, token });
|
|
13
|
+
}
|
|
14
|
+
const REDIRECT_PREFIX = "redirect:";
|
|
15
|
+
function redirectKey(url) {
|
|
16
|
+
return `${REDIRECT_PREFIX}${url}`;
|
|
17
|
+
}
|
|
18
|
+
function record(r) {
|
|
19
|
+
return { key: redirectKey(r.url), id: r.id, hash: sha256(r.url), label: `Clerk redirect ${r.url}` };
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* GET /redirect_urls?paginated=true answers `{ data, total_count }`, paged by `offset`/`limit` (Clerk's own SDKs ask
|
|
23
|
+
* for it the same way; without `paginated` the spec documents a bare array). A bare array is still accepted;
|
|
24
|
+
* anything else is a PROVIDER_RESPONSE naming the endpoint.
|
|
25
|
+
*/
|
|
26
|
+
function parseRedirects(body) {
|
|
27
|
+
if (Array.isArray(body))
|
|
28
|
+
return { items: records(body, "the redirect URL list", ["id", "url"]) };
|
|
29
|
+
if (!isObject(body))
|
|
30
|
+
throw new ShapeError(`expected a list of redirect URLs or { data, total_count }, got ${body === null ? "null" : typeof body}`);
|
|
31
|
+
const items = records(body.data, "`data`", ["id", "url"]);
|
|
32
|
+
if (typeof body.total_count !== "number")
|
|
33
|
+
throw new ShapeError("expected `total_count` to be a number");
|
|
34
|
+
return { items, total: body.total_count };
|
|
35
|
+
}
|
|
36
|
+
async function list(api) {
|
|
37
|
+
let seen = 0;
|
|
38
|
+
return listAll(api, `/redirect_urls?paginated=true&limit=${CLERK_PAGE_LIMIT}`, (body) => {
|
|
39
|
+
const p = parseRedirects(body);
|
|
40
|
+
seen += p.items.length;
|
|
41
|
+
const more = p.total !== undefined && seen < p.total;
|
|
42
|
+
return { items: p.items.map((r) => ({ id: r.id, url: r.url })), next: more ? { offset: String(seen) } : null };
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
const redirect_allow = {
|
|
46
|
+
outputs: { id: { available: "immediate" } },
|
|
47
|
+
async read(actx, params) {
|
|
48
|
+
if (isPendingMarker(params.url))
|
|
49
|
+
return null;
|
|
50
|
+
const url = stringParam(params, "url", "clerk");
|
|
51
|
+
const found = (await list(client(actx))).find((r) => r.url === url);
|
|
52
|
+
if (!found)
|
|
53
|
+
return null;
|
|
54
|
+
return { resources: [record(found)], outputs: { id: found.id } };
|
|
55
|
+
},
|
|
56
|
+
diff(live, params) {
|
|
57
|
+
const url = params.url;
|
|
58
|
+
const key = isPendingMarker(url) ? "redirect:(pending)" : redirectKey(String(url));
|
|
59
|
+
const current = live?.resources.find((r) => r.key === key);
|
|
60
|
+
return [diffValue({ key, label: "Clerk redirect", live: current, desired: url, sensitive: false, liveValue: String(url) })];
|
|
61
|
+
},
|
|
62
|
+
async apply(actx, params, live) {
|
|
63
|
+
assertNoPending(params, "clerk");
|
|
64
|
+
const url = stringParam(params, "url", "clerk");
|
|
65
|
+
const key = redirectKey(url);
|
|
66
|
+
if (live?.resources.some((r) => r.key === key))
|
|
67
|
+
return { resources: live.resources, outputs: live.outputs, created: [] };
|
|
68
|
+
const api = client(actx);
|
|
69
|
+
await actx.intend([key]);
|
|
70
|
+
actx.log(`allow redirect ${url}`);
|
|
71
|
+
try {
|
|
72
|
+
const r = await api.post("/redirect_urls", { url }, (b) => records([b], "the created redirect URL", ["id", "url"])[0]);
|
|
73
|
+
return { resources: [record(r)], outputs: { id: r.id }, created: [key] };
|
|
74
|
+
}
|
|
75
|
+
catch (e) {
|
|
76
|
+
// The spec documents 400 and 422 for a refused create without saying which a duplicate gets, so any refusal
|
|
77
|
+
// is checked against the list before it is reported.
|
|
78
|
+
const refused = isProviderError(e, "PROVIDER_INVALID") && (e.details.status === 400 || e.details.status === 422);
|
|
79
|
+
if (!isProviderError(e, "PROVIDER_CONFLICT") && !refused)
|
|
80
|
+
throw e;
|
|
81
|
+
// It exists already: registered by someone else, or by an earlier attempt of ours whose answer was lost.
|
|
82
|
+
// Either way it is not created by this call; the engine claims it if an earlier intent of ours named it.
|
|
83
|
+
const found = (await list(api)).find((r) => r.url === url);
|
|
84
|
+
if (!found)
|
|
85
|
+
throw e;
|
|
86
|
+
return { resources: [record(found)], outputs: { id: found.id }, created: [] };
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
async destroy(actx, resources) {
|
|
90
|
+
const api = client(actx);
|
|
91
|
+
for (const r of resources)
|
|
92
|
+
await deleteIgnoringNotFound(api, `/redirect_urls/${encodeURIComponent(r.id)}`);
|
|
93
|
+
},
|
|
94
|
+
async listScope(actx) {
|
|
95
|
+
return (await list(client(actx))).map(record);
|
|
96
|
+
},
|
|
97
|
+
/** One line per allowed URL. */
|
|
98
|
+
adopt(resources) {
|
|
99
|
+
return resources.map((r) => ({ id: "callback", params: { url: r.key.slice(REDIRECT_PREFIX.length) }, keys: [r.key] }));
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Clerk: op `redirect_allow` keeps a redirect URL (e.g. a preview URL) on the allow-list. Needs
|
|
104
|
+
* `CLERK_SECRET_KEY`.
|
|
105
|
+
*/
|
|
106
|
+
export const clerkAdapter = { name: "clerk", ops: { redirect_allow }, about: ABOUT };
|
|
107
|
+
//# sourceMappingURL=clerk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clerk.js","sourceRoot":"","sources":["../src/clerk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,EAA+E,MAAM,eAAe,CAAC;AACrI,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,sBAAsB,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAClI,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,eAAe,EAAE,OAAO,EAAE,OAAO,EAA6B,MAAM,WAAW,CAAC;AAE/G,oGAAoG;AACpG,MAAM,KAAK,GAAG,EAAE,aAAa,EAAE,kBAAkB,EAAE,UAAU,EAAE,eAAe,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EA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IACzH,CAAC;CACF,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAoB,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE,cAAc,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cloudflare adapter. One op, `pages_env`: the variables of a Cloudflare Pages project's `preview` or `production`
|
|
3
|
+
* deployment config (`deployment_configs.<env>.env_vars`), plain text (`vars`) and secret (`secrets`).
|
|
4
|
+
*
|
|
5
|
+
* The variables are a map on the project, not objects of their own, so `apply` is read-modify-write: it PATCHes only
|
|
6
|
+
* the keys this line manages (Cloudflare merges the map; `null` deletes a key), as an idempotent PATCH, then re-reads
|
|
7
|
+
* the project to check that what it sent landed and that no other key went missing. API facts and their sources are
|
|
8
|
+
* the numbered assumptions (CF1…) at the top of packages/sim/src/routes/cloudflare.ts.
|
|
9
|
+
*
|
|
10
|
+
* Pages has one set of preview variables shared by every preview deployment (CF8): there are no per-branch values.
|
|
11
|
+
* A key is therefore one resource per environment, `env:<target>:<NAME>`, whatever scope wrote it; a second scope
|
|
12
|
+
* (another pull request) that declares the same key with another value is refused with OWNED_BY_OTHER_SCOPE.
|
|
13
|
+
*
|
|
14
|
+
* Secret values are write-only (CF3): a `secret_text` variable is compared by presence and type, never by value.
|
|
15
|
+
* See `secretHash` and docs/plan-format.md (`cloudflare.pages_env`).
|
|
16
|
+
*/
|
|
17
|
+
import { type ResourceAdapter } from "@sponson/core";
|
|
18
|
+
/** Cloudflare's API base URL (CF1). `CLOUDFLARE_API_URL` overrides it; tests and scenarios point that at the sim. */
|
|
19
|
+
export declare const CLOUDFLARE_DEFAULT_API_URL = "https://api.cloudflare.com/client/v4";
|
|
20
|
+
/**
|
|
21
|
+
* The Cloudflare adapter (`adapter: cloudflare` in a plan): op `pages_env` manages a Pages project's preview or
|
|
22
|
+
* production variables. Needs `CLOUDFLARE_API_TOKEN` (account permission "Cloudflare Pages Edit") and
|
|
23
|
+
* `providers.cloudflare.{account,project}`.
|
|
24
|
+
*/
|
|
25
|
+
export declare const cloudflareAdapter: ResourceAdapter;
|