@executor-js/plugin-onepassword 0.0.2 → 0.2.1
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/dist/OnePasswordSettings-NUPVIEGH.js +392 -0
- package/dist/OnePasswordSettings-NUPVIEGH.js.map +1 -0
- package/dist/api/group.d.ts +16 -6
- package/dist/api/handlers.d.ts +9 -3
- package/dist/api/index.d.ts +35 -0
- package/dist/chunk-NRYSRUWU.js +68 -0
- package/dist/chunk-NRYSRUWU.js.map +1 -0
- package/dist/{chunk-HWMHIFQL.js → chunk-ULLNZ6JH.js} +131 -171
- package/dist/chunk-ULLNZ6JH.js.map +1 -0
- package/dist/client.js +20 -0
- package/dist/client.js.map +1 -0
- package/dist/core.js +10 -8
- package/dist/index.js +5 -3
- package/dist/react/atoms.d.ts +16 -6
- package/dist/react/client.d.ts +13 -336
- package/dist/react/plugin-client.d.ts +2 -0
- package/dist/react/secret-provider-plugin.d.ts +1 -1
- package/dist/sdk/plugin.d.ts +18 -26
- package/dist/sdk/types.d.ts +43 -1
- package/package.json +8 -2
- package/dist/chunk-HWMHIFQL.js.map +0 -1
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ConnectionStatus,
|
|
3
|
+
OnePasswordConfig,
|
|
4
|
+
OnePasswordConfigSchema,
|
|
5
|
+
OnePasswordError,
|
|
6
|
+
Vault
|
|
7
|
+
} from "./chunk-NRYSRUWU.js";
|
|
8
|
+
|
|
9
|
+
// src/react/OnePasswordSettings.tsx
|
|
10
|
+
import { useState } from "react";
|
|
11
|
+
import { useAtomSet, useAtomValue } from "@effect/atom-react";
|
|
12
|
+
import * as Exit from "effect/Exit";
|
|
13
|
+
import * as AsyncResult from "effect/unstable/reactivity/AsyncResult";
|
|
14
|
+
import { ReactivityKey as ReactivityKey2 } from "@executor-js/react/api/reactivity-keys";
|
|
15
|
+
import { useScope } from "@executor-js/react/api/scope-context";
|
|
16
|
+
import { Button } from "@executor-js/react/components/button";
|
|
17
|
+
import { Input } from "@executor-js/react/components/input";
|
|
18
|
+
import { Label } from "@executor-js/react/components/label";
|
|
19
|
+
import {
|
|
20
|
+
Select,
|
|
21
|
+
SelectContent,
|
|
22
|
+
SelectItem,
|
|
23
|
+
SelectTrigger,
|
|
24
|
+
SelectValue
|
|
25
|
+
} from "@executor-js/react/components/select";
|
|
26
|
+
import {
|
|
27
|
+
Dialog,
|
|
28
|
+
DialogContent,
|
|
29
|
+
DialogHeader,
|
|
30
|
+
DialogTitle,
|
|
31
|
+
DialogDescription,
|
|
32
|
+
DialogFooter,
|
|
33
|
+
DialogClose
|
|
34
|
+
} from "@executor-js/react/components/dialog";
|
|
35
|
+
import {
|
|
36
|
+
CardStackEntry,
|
|
37
|
+
CardStackEntryActions,
|
|
38
|
+
CardStackEntryContent,
|
|
39
|
+
CardStackEntryDescription
|
|
40
|
+
} from "@executor-js/react/components/card-stack";
|
|
41
|
+
|
|
42
|
+
// src/react/atoms.ts
|
|
43
|
+
import { ReactivityKey } from "@executor-js/react/api/reactivity-keys";
|
|
44
|
+
|
|
45
|
+
// src/react/client.ts
|
|
46
|
+
import { createPluginAtomClient } from "@executor-js/sdk/client";
|
|
47
|
+
import { getBaseUrl } from "@executor-js/react/api/base-url";
|
|
48
|
+
|
|
49
|
+
// src/api/group.ts
|
|
50
|
+
import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi";
|
|
51
|
+
import { Schema } from "effect";
|
|
52
|
+
import { InternalError, ScopeId } from "@executor-js/sdk/core";
|
|
53
|
+
var ScopeParams = { scopeId: ScopeId };
|
|
54
|
+
var ConfigurePayload = OnePasswordConfigSchema;
|
|
55
|
+
var ListVaultsParams = Schema.Struct({
|
|
56
|
+
authKind: Schema.Literals(["desktop-app", "service-account"]),
|
|
57
|
+
account: Schema.String
|
|
58
|
+
});
|
|
59
|
+
var ListVaultsResponse = Schema.Struct({
|
|
60
|
+
vaults: Schema.Array(Vault)
|
|
61
|
+
});
|
|
62
|
+
var GetConfigResponse = Schema.NullOr(OnePasswordConfig);
|
|
63
|
+
var OnePasswordGroup = HttpApiGroup.make("onepassword").add(
|
|
64
|
+
HttpApiEndpoint.get("getConfig", "/scopes/:scopeId/onepassword/config", {
|
|
65
|
+
params: ScopeParams,
|
|
66
|
+
success: GetConfigResponse,
|
|
67
|
+
error: [InternalError, OnePasswordError]
|
|
68
|
+
})
|
|
69
|
+
).add(
|
|
70
|
+
HttpApiEndpoint.put("configure", "/scopes/:scopeId/onepassword/config", {
|
|
71
|
+
params: ScopeParams,
|
|
72
|
+
payload: ConfigurePayload,
|
|
73
|
+
success: Schema.Void,
|
|
74
|
+
error: [InternalError, OnePasswordError]
|
|
75
|
+
})
|
|
76
|
+
).add(
|
|
77
|
+
HttpApiEndpoint.delete("removeConfig", "/scopes/:scopeId/onepassword/config", {
|
|
78
|
+
params: ScopeParams,
|
|
79
|
+
success: Schema.Void,
|
|
80
|
+
error: [InternalError, OnePasswordError]
|
|
81
|
+
})
|
|
82
|
+
).add(
|
|
83
|
+
HttpApiEndpoint.get("status", "/scopes/:scopeId/onepassword/status", {
|
|
84
|
+
params: ScopeParams,
|
|
85
|
+
success: ConnectionStatus,
|
|
86
|
+
error: [InternalError, OnePasswordError]
|
|
87
|
+
})
|
|
88
|
+
).add(
|
|
89
|
+
HttpApiEndpoint.get("listVaults", "/scopes/:scopeId/onepassword/vaults", {
|
|
90
|
+
params: ScopeParams,
|
|
91
|
+
query: ListVaultsParams,
|
|
92
|
+
success: ListVaultsResponse,
|
|
93
|
+
error: [InternalError, OnePasswordError]
|
|
94
|
+
})
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
// src/react/client.ts
|
|
98
|
+
var OnePasswordClient = createPluginAtomClient(OnePasswordGroup, {
|
|
99
|
+
baseUrl: getBaseUrl
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
// src/react/atoms.ts
|
|
103
|
+
var onepasswordWriteKeys = [ReactivityKey.secrets];
|
|
104
|
+
var onepasswordConfigAtom = (scopeId) => OnePasswordClient.query("onepassword", "getConfig", {
|
|
105
|
+
params: { scopeId },
|
|
106
|
+
timeToLive: "30 seconds",
|
|
107
|
+
reactivityKeys: [ReactivityKey.secrets]
|
|
108
|
+
});
|
|
109
|
+
var onepasswordVaultsAtom = (authKind, account, scopeId) => OnePasswordClient.query("onepassword", "listVaults", {
|
|
110
|
+
params: { scopeId },
|
|
111
|
+
query: { authKind, account },
|
|
112
|
+
timeToLive: "30 seconds",
|
|
113
|
+
reactivityKeys: [ReactivityKey.secrets]
|
|
114
|
+
});
|
|
115
|
+
var configureOnePassword = OnePasswordClient.mutation("onepassword", "configure");
|
|
116
|
+
var removeOnePasswordConfig = OnePasswordClient.mutation("onepassword", "removeConfig");
|
|
117
|
+
|
|
118
|
+
// src/react/OnePasswordSettings.tsx
|
|
119
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
120
|
+
function VaultPicker(props) {
|
|
121
|
+
const account = props.accountName.trim();
|
|
122
|
+
const scopeId = useScope();
|
|
123
|
+
const vaultsResult = useAtomValue(onepasswordVaultsAtom(props.authKind, account, scopeId));
|
|
124
|
+
const { vaults, isLoading, error } = AsyncResult.matchWithError(
|
|
125
|
+
vaultsResult,
|
|
126
|
+
{
|
|
127
|
+
onInitial: () => ({
|
|
128
|
+
vaults: [],
|
|
129
|
+
isLoading: true,
|
|
130
|
+
error: null
|
|
131
|
+
}),
|
|
132
|
+
onError: () => ({
|
|
133
|
+
vaults: [],
|
|
134
|
+
isLoading: false,
|
|
135
|
+
error: "Failed to list vaults"
|
|
136
|
+
}),
|
|
137
|
+
onDefect: () => ({
|
|
138
|
+
vaults: [],
|
|
139
|
+
isLoading: false,
|
|
140
|
+
error: "Failed to list vaults"
|
|
141
|
+
}),
|
|
142
|
+
onSuccess: ({ value }) => {
|
|
143
|
+
const v = value.vaults;
|
|
144
|
+
if (v.length > 0 && !props.vaultId) {
|
|
145
|
+
queueMicrotask(() => props.onVaultSelect(v[0].id, v[0].name));
|
|
146
|
+
}
|
|
147
|
+
return { vaults: [...v], isLoading: false, error: null };
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
);
|
|
151
|
+
if (!account) {
|
|
152
|
+
return /* @__PURE__ */ jsx("p", { className: "text-[11px] text-muted-foreground/50 py-1", children: "Enter account details to load vaults." });
|
|
153
|
+
}
|
|
154
|
+
return /* @__PURE__ */ jsxs("div", { className: "grid gap-2", children: [
|
|
155
|
+
/* @__PURE__ */ jsxs(
|
|
156
|
+
Select,
|
|
157
|
+
{
|
|
158
|
+
disabled: isLoading || vaults.length === 0,
|
|
159
|
+
value: props.vaultId,
|
|
160
|
+
onValueChange: (id) => {
|
|
161
|
+
const v = vaults.find((vault) => vault.id === id);
|
|
162
|
+
if (v) props.onVaultSelect(v.id, v.name);
|
|
163
|
+
},
|
|
164
|
+
children: [
|
|
165
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "h-9 text-[13px]", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: isLoading ? "Loading\u2026" : "Select a vault" }) }),
|
|
166
|
+
/* @__PURE__ */ jsx(SelectContent, { children: vaults.map((v) => /* @__PURE__ */ jsx(SelectItem, { value: v.id, children: v.name }, v.id)) })
|
|
167
|
+
]
|
|
168
|
+
}
|
|
169
|
+
),
|
|
170
|
+
error && /* @__PURE__ */ jsx("div", { className: "rounded-md border border-destructive/20 bg-destructive/5 px-2.5 py-1.5", children: /* @__PURE__ */ jsx("p", { className: "text-[11px] text-destructive leading-relaxed whitespace-pre-line", children: error }) })
|
|
171
|
+
] });
|
|
172
|
+
}
|
|
173
|
+
function ConfigDialog(props) {
|
|
174
|
+
const isEdit = !!props.initial;
|
|
175
|
+
const [authKind, setAuthKind] = useState(
|
|
176
|
+
props.initial?.authKind ?? "desktop-app"
|
|
177
|
+
);
|
|
178
|
+
const [accountName, setAccountName] = useState(props.initial?.accountName ?? "my.1password.com");
|
|
179
|
+
const [vaultId, setVaultId] = useState(props.initial?.vaultId ?? "");
|
|
180
|
+
const [vaultName, setVaultName] = useState(props.initial?.name ?? "");
|
|
181
|
+
const [saving, setSaving] = useState(false);
|
|
182
|
+
const [error, setError] = useState(null);
|
|
183
|
+
const scopeId = useScope();
|
|
184
|
+
const doConfigure = useAtomSet(configureOnePassword, { mode: "promiseExit" });
|
|
185
|
+
const reset = () => {
|
|
186
|
+
if (!isEdit) {
|
|
187
|
+
setAuthKind("desktop-app");
|
|
188
|
+
setAccountName("my.1password.com");
|
|
189
|
+
setVaultId("");
|
|
190
|
+
setVaultName("");
|
|
191
|
+
}
|
|
192
|
+
setError(null);
|
|
193
|
+
setSaving(false);
|
|
194
|
+
};
|
|
195
|
+
const handleSave = async () => {
|
|
196
|
+
if (!accountName.trim() || !vaultId.trim()) return;
|
|
197
|
+
setSaving(true);
|
|
198
|
+
setError(null);
|
|
199
|
+
const auth = authKind === "desktop-app" ? { kind: "desktop-app", accountName: accountName.trim() } : { kind: "service-account", tokenSecretId: accountName.trim() };
|
|
200
|
+
const exit = await doConfigure({
|
|
201
|
+
params: { scopeId },
|
|
202
|
+
payload: { auth, vaultId: vaultId.trim(), name: vaultName.trim() || "1Password" },
|
|
203
|
+
reactivityKeys: [ReactivityKey2.secrets]
|
|
204
|
+
});
|
|
205
|
+
if (Exit.isFailure(exit)) {
|
|
206
|
+
setError("Failed to save configuration");
|
|
207
|
+
setSaving(false);
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
props.onOpenChange(false);
|
|
211
|
+
reset();
|
|
212
|
+
};
|
|
213
|
+
return /* @__PURE__ */ jsx(
|
|
214
|
+
Dialog,
|
|
215
|
+
{
|
|
216
|
+
open: props.open,
|
|
217
|
+
onOpenChange: (v) => {
|
|
218
|
+
if (!v) reset();
|
|
219
|
+
props.onOpenChange(v);
|
|
220
|
+
},
|
|
221
|
+
children: /* @__PURE__ */ jsxs(DialogContent, { className: "sm:max-w-[420px]", children: [
|
|
222
|
+
/* @__PURE__ */ jsxs(DialogHeader, { children: [
|
|
223
|
+
/* @__PURE__ */ jsx(DialogTitle, { className: "font-display text-xl", children: isEdit ? "Edit 1Password" : "Connect 1Password" }),
|
|
224
|
+
/* @__PURE__ */ jsx(DialogDescription, { className: "text-[13px] leading-relaxed", children: "Link a vault to resolve secrets via the 1Password desktop app or a service account." })
|
|
225
|
+
] }),
|
|
226
|
+
/* @__PURE__ */ jsxs("div", { className: "grid gap-5 py-3", children: [
|
|
227
|
+
/* @__PURE__ */ jsxs("div", { className: "grid gap-1.5", children: [
|
|
228
|
+
/* @__PURE__ */ jsx(Label, { className: "text-[11px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Auth method" }),
|
|
229
|
+
/* @__PURE__ */ jsxs(
|
|
230
|
+
Select,
|
|
231
|
+
{
|
|
232
|
+
value: authKind,
|
|
233
|
+
onValueChange: (v) => setAuthKind(v),
|
|
234
|
+
children: [
|
|
235
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "h-9 text-[13px]", children: /* @__PURE__ */ jsx(SelectValue, {}) }),
|
|
236
|
+
/* @__PURE__ */ jsxs(SelectContent, { children: [
|
|
237
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "desktop-app", children: "Desktop App (biometric)" }),
|
|
238
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "service-account", children: "Service Account" })
|
|
239
|
+
] })
|
|
240
|
+
]
|
|
241
|
+
}
|
|
242
|
+
)
|
|
243
|
+
] }),
|
|
244
|
+
/* @__PURE__ */ jsxs("div", { className: "grid gap-1.5", children: [
|
|
245
|
+
/* @__PURE__ */ jsx(Label, { className: "text-[11px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: authKind === "desktop-app" ? "Account domain" : "Token secret ID" }),
|
|
246
|
+
/* @__PURE__ */ jsx(
|
|
247
|
+
Input,
|
|
248
|
+
{
|
|
249
|
+
placeholder: authKind === "desktop-app" ? "my.1password.com" : "op-service-token",
|
|
250
|
+
value: accountName,
|
|
251
|
+
onChange: (e) => setAccountName(e.target.value),
|
|
252
|
+
className: "font-mono text-[13px] h-9"
|
|
253
|
+
}
|
|
254
|
+
),
|
|
255
|
+
/* @__PURE__ */ jsx("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed", children: authKind === "desktop-app" ? "Requires the 1Password desktop app with biometric unlock." : "Reference an executor secret that holds the service account token." })
|
|
256
|
+
] }),
|
|
257
|
+
/* @__PURE__ */ jsxs("div", { className: "grid gap-1.5", children: [
|
|
258
|
+
/* @__PURE__ */ jsx(Label, { className: "text-[11px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Vault" }),
|
|
259
|
+
/* @__PURE__ */ jsx(
|
|
260
|
+
VaultPicker,
|
|
261
|
+
{
|
|
262
|
+
authKind,
|
|
263
|
+
accountName,
|
|
264
|
+
vaultId,
|
|
265
|
+
onVaultSelect: (id, name) => {
|
|
266
|
+
setVaultId(id);
|
|
267
|
+
setVaultName(name);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
),
|
|
271
|
+
vaultId && /* @__PURE__ */ jsx("p", { className: "font-mono text-[10px] text-muted-foreground/50", children: vaultId })
|
|
272
|
+
] }),
|
|
273
|
+
/* @__PURE__ */ jsxs("div", { className: "grid gap-1.5", children: [
|
|
274
|
+
/* @__PURE__ */ jsx(Label, { className: "text-[11px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Display name" }),
|
|
275
|
+
/* @__PURE__ */ jsx(
|
|
276
|
+
Input,
|
|
277
|
+
{
|
|
278
|
+
placeholder: "1Password",
|
|
279
|
+
value: vaultName,
|
|
280
|
+
onChange: (e) => setVaultName(e.target.value),
|
|
281
|
+
className: "text-[13px] h-9"
|
|
282
|
+
}
|
|
283
|
+
)
|
|
284
|
+
] }),
|
|
285
|
+
error && /* @__PURE__ */ jsx("div", { className: "rounded-md border border-destructive/20 bg-destructive/5 px-3 py-2", children: /* @__PURE__ */ jsx("p", { className: "text-[12px] text-destructive whitespace-pre-line", children: error }) })
|
|
286
|
+
] }),
|
|
287
|
+
/* @__PURE__ */ jsxs(DialogFooter, { children: [
|
|
288
|
+
/* @__PURE__ */ jsx(DialogClose, { asChild: true, children: /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "sm", children: "Cancel" }) }),
|
|
289
|
+
/* @__PURE__ */ jsx(
|
|
290
|
+
Button,
|
|
291
|
+
{
|
|
292
|
+
size: "sm",
|
|
293
|
+
onClick: handleSave,
|
|
294
|
+
disabled: !accountName.trim() || !vaultId.trim() || saving,
|
|
295
|
+
children: saving ? "Saving\u2026" : isEdit ? "Update" : "Connect"
|
|
296
|
+
}
|
|
297
|
+
)
|
|
298
|
+
] })
|
|
299
|
+
] })
|
|
300
|
+
}
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
function OnePasswordSettings() {
|
|
304
|
+
const [configOpen, setConfigOpen] = useState(false);
|
|
305
|
+
const scopeId = useScope();
|
|
306
|
+
const configResult = useAtomValue(onepasswordConfigAtom(scopeId));
|
|
307
|
+
const doRemove = useAtomSet(removeOnePasswordConfig, { mode: "promiseExit" });
|
|
308
|
+
const handleRemove = async () => {
|
|
309
|
+
await doRemove({ params: { scopeId }, reactivityKeys: [ReactivityKey2.secrets] });
|
|
310
|
+
};
|
|
311
|
+
const config = AsyncResult.match(
|
|
312
|
+
configResult,
|
|
313
|
+
{ onInitial: () => null, onFailure: () => null, onSuccess: ({ value }) => value }
|
|
314
|
+
);
|
|
315
|
+
const isLoading = AsyncResult.match(
|
|
316
|
+
configResult,
|
|
317
|
+
{
|
|
318
|
+
onInitial: () => true,
|
|
319
|
+
onFailure: () => false,
|
|
320
|
+
onSuccess: () => false
|
|
321
|
+
}
|
|
322
|
+
);
|
|
323
|
+
const isError = AsyncResult.match(
|
|
324
|
+
configResult,
|
|
325
|
+
{
|
|
326
|
+
onInitial: () => false,
|
|
327
|
+
onFailure: () => true,
|
|
328
|
+
onSuccess: () => false
|
|
329
|
+
}
|
|
330
|
+
);
|
|
331
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
332
|
+
/* @__PURE__ */ jsxs(CardStackEntry, { children: [
|
|
333
|
+
/* @__PURE__ */ jsx(CardStackEntryContent, { children: isLoading ? /* @__PURE__ */ jsx(CardStackEntryDescription, { children: "Loading\u2026" }) : isError ? /* @__PURE__ */ jsx(CardStackEntryDescription, { className: "text-destructive", children: "Failed to load configuration" }) : config ? /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-[auto_1fr] gap-x-6 gap-y-1 text-[12px]", children: [
|
|
334
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground/60", children: "Auth" }),
|
|
335
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono text-foreground/80 truncate", children: config.auth.kind === "desktop-app" ? config.auth.accountName : "service-account" }),
|
|
336
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground/60", children: "Vault" }),
|
|
337
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 min-w-0", children: [
|
|
338
|
+
/* @__PURE__ */ jsx("span", { className: "text-foreground/80 truncate", children: config.name }),
|
|
339
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono text-[10px] text-muted-foreground/40 truncate", children: config.vaultId })
|
|
340
|
+
] })
|
|
341
|
+
] }) : /* @__PURE__ */ jsx(CardStackEntryDescription, { children: "Resolve secrets from your 1Password vault." }) }),
|
|
342
|
+
/* @__PURE__ */ jsx(CardStackEntryActions, { children: config ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
343
|
+
/* @__PURE__ */ jsx(
|
|
344
|
+
Button,
|
|
345
|
+
{
|
|
346
|
+
variant: "ghost",
|
|
347
|
+
size: "sm",
|
|
348
|
+
className: "h-7 px-2.5 text-[12px]",
|
|
349
|
+
onClick: () => setConfigOpen(true),
|
|
350
|
+
children: "Edit"
|
|
351
|
+
}
|
|
352
|
+
),
|
|
353
|
+
/* @__PURE__ */ jsx(
|
|
354
|
+
Button,
|
|
355
|
+
{
|
|
356
|
+
variant: "ghost",
|
|
357
|
+
size: "sm",
|
|
358
|
+
className: "h-7 px-2.5 text-[12px] text-destructive/70 hover:text-destructive",
|
|
359
|
+
onClick: handleRemove,
|
|
360
|
+
children: "Disconnect"
|
|
361
|
+
}
|
|
362
|
+
)
|
|
363
|
+
] }) : !isLoading && !isError && /* @__PURE__ */ jsx(
|
|
364
|
+
Button,
|
|
365
|
+
{
|
|
366
|
+
variant: "link",
|
|
367
|
+
size: "sm",
|
|
368
|
+
className: "h-7 px-0 text-[12px] shrink-0",
|
|
369
|
+
onClick: () => setConfigOpen(true),
|
|
370
|
+
children: "Add 1Password"
|
|
371
|
+
}
|
|
372
|
+
) })
|
|
373
|
+
] }),
|
|
374
|
+
configOpen && /* @__PURE__ */ jsx(
|
|
375
|
+
ConfigDialog,
|
|
376
|
+
{
|
|
377
|
+
open: configOpen,
|
|
378
|
+
onOpenChange: setConfigOpen,
|
|
379
|
+
initial: config ? {
|
|
380
|
+
authKind: config.auth.kind,
|
|
381
|
+
accountName: config.auth.kind === "desktop-app" ? config.auth.accountName : config.auth.tokenSecretId,
|
|
382
|
+
vaultId: config.vaultId,
|
|
383
|
+
name: config.name
|
|
384
|
+
} : void 0
|
|
385
|
+
}
|
|
386
|
+
)
|
|
387
|
+
] });
|
|
388
|
+
}
|
|
389
|
+
export {
|
|
390
|
+
OnePasswordSettings as default
|
|
391
|
+
};
|
|
392
|
+
//# sourceMappingURL=OnePasswordSettings-NUPVIEGH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/react/OnePasswordSettings.tsx","../src/react/atoms.ts","../src/react/client.ts","../src/api/group.ts"],"sourcesContent":["import { useState } from \"react\";\nimport { useAtomSet, useAtomValue } from \"@effect/atom-react\";\nimport * as Exit from \"effect/Exit\";\nimport * as AsyncResult from \"effect/unstable/reactivity/AsyncResult\";\nimport { ReactivityKey } from \"@executor-js/react/api/reactivity-keys\";\nimport { useScope } from \"@executor-js/react/api/scope-context\";\nimport { Button } from \"@executor-js/react/components/button\";\nimport { Input } from \"@executor-js/react/components/input\";\nimport { Label } from \"@executor-js/react/components/label\";\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from \"@executor-js/react/components/select\";\nimport {\n Dialog,\n DialogContent,\n DialogHeader,\n DialogTitle,\n DialogDescription,\n DialogFooter,\n DialogClose,\n} from \"@executor-js/react/components/dialog\";\nimport {\n CardStackEntry,\n CardStackEntryActions,\n CardStackEntryContent,\n CardStackEntryDescription,\n} from \"@executor-js/react/components/card-stack\";\n\nimport {\n onepasswordConfigAtom,\n onepasswordVaultsAtom,\n configureOnePassword,\n removeOnePasswordConfig,\n} from \"./atoms\";\nimport type { OnePasswordConfig } from \"../sdk/types\";\n\n// ---------------------------------------------------------------------------\n// Vault picker\n// ---------------------------------------------------------------------------\n\nfunction VaultPicker(props: {\n authKind: \"desktop-app\" | \"service-account\";\n accountName: string;\n vaultId: string;\n onVaultSelect: (id: string, name: string) => void;\n}) {\n const account = props.accountName.trim();\n const scopeId = useScope();\n const vaultsResult = useAtomValue(onepasswordVaultsAtom(props.authKind, account, scopeId));\n\n const { vaults, isLoading, error } = AsyncResult.matchWithError(\n vaultsResult as AsyncResult.AsyncResult<\n { vaults: ReadonlyArray<{ id: string; name: string }> },\n Error\n >,\n {\n onInitial: () => ({\n vaults: [] as { id: string; name: string }[],\n isLoading: true,\n error: null,\n }),\n onError: () => ({\n vaults: [] as { id: string; name: string }[],\n isLoading: false,\n error: \"Failed to list vaults\",\n }),\n onDefect: () => ({\n vaults: [] as { id: string; name: string }[],\n isLoading: false,\n error: \"Failed to list vaults\",\n }),\n onSuccess: ({ value }) => {\n const v = value.vaults;\n if (v.length > 0 && !props.vaultId) {\n queueMicrotask(() => props.onVaultSelect(v[0].id, v[0].name));\n }\n return { vaults: [...v], isLoading: false, error: null };\n },\n },\n );\n\n if (!account) {\n return (\n <p className=\"text-[11px] text-muted-foreground/50 py-1\">\n Enter account details to load vaults.\n </p>\n );\n }\n\n return (\n <div className=\"grid gap-2\">\n <Select\n disabled={isLoading || vaults.length === 0}\n value={props.vaultId}\n onValueChange={(id) => {\n const v = vaults.find((vault) => vault.id === id);\n if (v) props.onVaultSelect(v.id, v.name);\n }}\n >\n <SelectTrigger className=\"h-9 text-[13px]\">\n <SelectValue placeholder={isLoading ? \"Loading…\" : \"Select a vault\"} />\n </SelectTrigger>\n <SelectContent>\n {vaults.map((v) => (\n <SelectItem key={v.id} value={v.id}>\n {v.name}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n {error && (\n <div className=\"rounded-md border border-destructive/20 bg-destructive/5 px-2.5 py-1.5\">\n <p className=\"text-[11px] text-destructive leading-relaxed whitespace-pre-line\">\n {error}\n </p>\n </div>\n )}\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Config dialog\n// ---------------------------------------------------------------------------\n\nfunction ConfigDialog(props: {\n open: boolean;\n onOpenChange: (v: boolean) => void;\n initial?: { authKind: string; accountName: string; vaultId: string; name: string };\n}) {\n const isEdit = !!props.initial;\n const [authKind, setAuthKind] = useState<\"desktop-app\" | \"service-account\">(\n (props.initial?.authKind as \"desktop-app\" | \"service-account\") ?? \"desktop-app\",\n );\n const [accountName, setAccountName] = useState(props.initial?.accountName ?? \"my.1password.com\");\n const [vaultId, setVaultId] = useState(props.initial?.vaultId ?? \"\");\n const [vaultName, setVaultName] = useState(props.initial?.name ?? \"\");\n const [saving, setSaving] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n const scopeId = useScope();\n const doConfigure = useAtomSet(configureOnePassword, { mode: \"promiseExit\" });\n\n const reset = () => {\n if (!isEdit) {\n setAuthKind(\"desktop-app\");\n setAccountName(\"my.1password.com\");\n setVaultId(\"\");\n setVaultName(\"\");\n }\n setError(null);\n setSaving(false);\n };\n\n const handleSave = async () => {\n if (!accountName.trim() || !vaultId.trim()) return;\n setSaving(true);\n setError(null);\n\n const auth =\n authKind === \"desktop-app\"\n ? { kind: \"desktop-app\" as const, accountName: accountName.trim() }\n : { kind: \"service-account\" as const, tokenSecretId: accountName.trim() };\n\n const exit = await doConfigure({\n params: { scopeId },\n payload: { auth, vaultId: vaultId.trim(), name: vaultName.trim() || \"1Password\" },\n reactivityKeys: [ReactivityKey.secrets],\n });\n if (Exit.isFailure(exit)) {\n setError(\"Failed to save configuration\");\n setSaving(false);\n return;\n }\n\n props.onOpenChange(false);\n reset();\n };\n\n return (\n <Dialog\n open={props.open}\n onOpenChange={(v) => {\n if (!v) reset();\n props.onOpenChange(v);\n }}\n >\n <DialogContent className=\"sm:max-w-[420px]\">\n <DialogHeader>\n <DialogTitle className=\"font-display text-xl\">\n {isEdit ? \"Edit 1Password\" : \"Connect 1Password\"}\n </DialogTitle>\n <DialogDescription className=\"text-[13px] leading-relaxed\">\n Link a vault to resolve secrets via the 1Password desktop app or a service account.\n </DialogDescription>\n </DialogHeader>\n\n <div className=\"grid gap-5 py-3\">\n {/* Auth method */}\n <div className=\"grid gap-1.5\">\n <Label className=\"text-[11px] font-medium uppercase tracking-[0.08em] text-muted-foreground\">\n Auth method\n </Label>\n <Select\n value={authKind}\n onValueChange={(v) => setAuthKind(v as \"desktop-app\" | \"service-account\")}\n >\n <SelectTrigger className=\"h-9 text-[13px]\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n <SelectItem value=\"desktop-app\">Desktop App (biometric)</SelectItem>\n <SelectItem value=\"service-account\">Service Account</SelectItem>\n </SelectContent>\n </Select>\n </div>\n\n {/* Account / token */}\n <div className=\"grid gap-1.5\">\n <Label className=\"text-[11px] font-medium uppercase tracking-[0.08em] text-muted-foreground\">\n {authKind === \"desktop-app\" ? \"Account domain\" : \"Token secret ID\"}\n </Label>\n <Input\n placeholder={authKind === \"desktop-app\" ? \"my.1password.com\" : \"op-service-token\"}\n value={accountName}\n onChange={(e) => setAccountName((e.target as HTMLInputElement).value)}\n className=\"font-mono text-[13px] h-9\"\n />\n <p className=\"text-[11px] text-muted-foreground/60 leading-relaxed\">\n {authKind === \"desktop-app\"\n ? \"Requires the 1Password desktop app with biometric unlock.\"\n : \"Reference an executor secret that holds the service account token.\"}\n </p>\n </div>\n\n {/* Vault */}\n <div className=\"grid gap-1.5\">\n <Label className=\"text-[11px] font-medium uppercase tracking-[0.08em] text-muted-foreground\">\n Vault\n </Label>\n <VaultPicker\n authKind={authKind}\n accountName={accountName}\n vaultId={vaultId}\n onVaultSelect={(id, name) => {\n setVaultId(id);\n setVaultName(name);\n }}\n />\n {vaultId && <p className=\"font-mono text-[10px] text-muted-foreground/50\">{vaultId}</p>}\n </div>\n\n {/* Display name */}\n <div className=\"grid gap-1.5\">\n <Label className=\"text-[11px] font-medium uppercase tracking-[0.08em] text-muted-foreground\">\n Display name\n </Label>\n <Input\n placeholder=\"1Password\"\n value={vaultName}\n onChange={(e) => setVaultName((e.target as HTMLInputElement).value)}\n className=\"text-[13px] h-9\"\n />\n </div>\n\n {error && (\n <div className=\"rounded-md border border-destructive/20 bg-destructive/5 px-3 py-2\">\n <p className=\"text-[12px] text-destructive whitespace-pre-line\">{error}</p>\n </div>\n )}\n </div>\n\n <DialogFooter>\n <DialogClose asChild>\n <Button variant=\"ghost\" size=\"sm\">\n Cancel\n </Button>\n </DialogClose>\n <Button\n size=\"sm\"\n onClick={handleSave}\n disabled={!accountName.trim() || !vaultId.trim() || saving}\n >\n {saving ? \"Saving…\" : isEdit ? \"Update\" : \"Connect\"}\n </Button>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Settings card\n// ---------------------------------------------------------------------------\n\nexport default function OnePasswordSettings() {\n const [configOpen, setConfigOpen] = useState(false);\n const scopeId = useScope();\n const configResult = useAtomValue(onepasswordConfigAtom(scopeId));\n const doRemove = useAtomSet(removeOnePasswordConfig, { mode: \"promiseExit\" });\n\n const handleRemove = async () => {\n await doRemove({ params: { scopeId }, reactivityKeys: [ReactivityKey.secrets] });\n };\n\n const config: OnePasswordConfig | null = AsyncResult.match(\n configResult as AsyncResult.AsyncResult<OnePasswordConfig | null, unknown>,\n { onInitial: () => null, onFailure: () => null, onSuccess: ({ value }) => value },\n );\n const isLoading = AsyncResult.match(\n configResult as AsyncResult.AsyncResult<OnePasswordConfig | null, unknown>,\n {\n onInitial: () => true,\n onFailure: () => false,\n onSuccess: () => false,\n },\n );\n const isError = AsyncResult.match(\n configResult as AsyncResult.AsyncResult<OnePasswordConfig | null, unknown>,\n {\n onInitial: () => false,\n onFailure: () => true,\n onSuccess: () => false,\n },\n );\n\n return (\n <>\n <CardStackEntry>\n <CardStackEntryContent>\n {isLoading ? (\n <CardStackEntryDescription>Loading…</CardStackEntryDescription>\n ) : isError ? (\n <CardStackEntryDescription className=\"text-destructive\">\n Failed to load configuration\n </CardStackEntryDescription>\n ) : config ? (\n <div className=\"grid grid-cols-[auto_1fr] gap-x-6 gap-y-1 text-[12px]\">\n <span className=\"text-muted-foreground/60\">Auth</span>\n <span className=\"font-mono text-foreground/80 truncate\">\n {config.auth.kind === \"desktop-app\" ? config.auth.accountName : \"service-account\"}\n </span>\n <span className=\"text-muted-foreground/60\">Vault</span>\n <div className=\"flex items-center gap-2 min-w-0\">\n <span className=\"text-foreground/80 truncate\">{config.name}</span>\n <span className=\"font-mono text-[10px] text-muted-foreground/40 truncate\">\n {config.vaultId}\n </span>\n </div>\n </div>\n ) : (\n <CardStackEntryDescription>\n Resolve secrets from your 1Password vault.\n </CardStackEntryDescription>\n )}\n </CardStackEntryContent>\n <CardStackEntryActions>\n {config ? (\n <>\n <Button\n variant=\"ghost\"\n size=\"sm\"\n className=\"h-7 px-2.5 text-[12px]\"\n onClick={() => setConfigOpen(true)}\n >\n Edit\n </Button>\n <Button\n variant=\"ghost\"\n size=\"sm\"\n className=\"h-7 px-2.5 text-[12px] text-destructive/70 hover:text-destructive\"\n onClick={handleRemove}\n >\n Disconnect\n </Button>\n </>\n ) : (\n !isLoading &&\n !isError && (\n <Button\n variant=\"link\"\n size=\"sm\"\n className=\"h-7 px-0 text-[12px] shrink-0\"\n onClick={() => setConfigOpen(true)}\n >\n Add 1Password\n </Button>\n )\n )}\n </CardStackEntryActions>\n </CardStackEntry>\n\n {configOpen && (\n <ConfigDialog\n open={configOpen}\n onOpenChange={setConfigOpen}\n initial={\n config\n ? {\n authKind: config.auth.kind,\n accountName:\n config.auth.kind === \"desktop-app\"\n ? config.auth.accountName\n : config.auth.tokenSecretId,\n vaultId: config.vaultId,\n name: config.name,\n }\n : undefined\n }\n />\n )}\n </>\n );\n}\n","import type { ScopeId } from \"@executor-js/sdk/core\";\nimport { ReactivityKey } from \"@executor-js/react/api/reactivity-keys\";\nimport { OnePasswordClient } from \"./client\";\n\nexport const onepasswordWriteKeys = [ReactivityKey.secrets] as const;\n\n// ---------------------------------------------------------------------------\n// Query atoms\n// ---------------------------------------------------------------------------\n\nexport const onepasswordConfigAtom = (scopeId: ScopeId) =>\n OnePasswordClient.query(\"onepassword\", \"getConfig\", {\n params: { scopeId },\n timeToLive: \"30 seconds\",\n reactivityKeys: [ReactivityKey.secrets],\n });\n\nexport const onepasswordStatusAtom = (scopeId: ScopeId) =>\n OnePasswordClient.query(\"onepassword\", \"status\", {\n params: { scopeId },\n timeToLive: \"15 seconds\",\n reactivityKeys: [ReactivityKey.secrets],\n });\n\n// ---------------------------------------------------------------------------\n// Query atoms — vaults\n// ---------------------------------------------------------------------------\n\nexport const onepasswordVaultsAtom = (\n authKind: \"desktop-app\" | \"service-account\",\n account: string,\n scopeId: ScopeId,\n) =>\n OnePasswordClient.query(\"onepassword\", \"listVaults\", {\n params: { scopeId },\n query: { authKind, account },\n timeToLive: \"30 seconds\",\n reactivityKeys: [ReactivityKey.secrets],\n });\n\n// ---------------------------------------------------------------------------\n// Mutation atoms\n// ---------------------------------------------------------------------------\n\nexport const configureOnePassword = OnePasswordClient.mutation(\"onepassword\", \"configure\");\n\nexport const removeOnePasswordConfig = OnePasswordClient.mutation(\"onepassword\", \"removeConfig\");\n","import { createPluginAtomClient } from \"@executor-js/sdk/client\";\nimport { getBaseUrl } from \"@executor-js/react/api/base-url\";\nimport { OnePasswordGroup } from \"../api/group\";\n\nexport const OnePasswordClient = createPluginAtomClient(OnePasswordGroup, {\n baseUrl: getBaseUrl,\n});\n","import { HttpApiEndpoint, HttpApiGroup } from \"effect/unstable/httpapi\";\nimport { Schema } from \"effect\";\nimport { InternalError, ScopeId } from \"@executor-js/sdk/core\";\n\nimport { OnePasswordError } from \"../sdk/errors\";\nimport { OnePasswordConfig, OnePasswordConfigSchema, Vault, ConnectionStatus } from \"../sdk/types\";\n\n// ---------------------------------------------------------------------------\n// Params\n// ---------------------------------------------------------------------------\n\nconst ScopeParams = { scopeId: ScopeId };\n\n// ---------------------------------------------------------------------------\n// Payloads\n// ---------------------------------------------------------------------------\n\nconst ConfigurePayload = OnePasswordConfigSchema;\n\nconst ListVaultsParams = Schema.Struct({\n authKind: Schema.Literals([\"desktop-app\", \"service-account\"]),\n account: Schema.String,\n});\n\n// ---------------------------------------------------------------------------\n// Responses\n// ---------------------------------------------------------------------------\n\nconst ListVaultsResponse = Schema.Struct({\n vaults: Schema.Array(Vault),\n});\n\nconst GetConfigResponse = Schema.NullOr(OnePasswordConfig);\n\n// ---------------------------------------------------------------------------\n// Group\n//\n// Plugin SDK errors (OnePasswordError) are declared once at the group level\n// via `.addError(...)` — every endpoint inherits. The error carries its own\n// 502 status via `HttpApiSchema.annotations` in errors.ts.\n//\n// `InternalError` is the shared opaque 500 schema translated at the HTTP\n// edge by `withCapture` (see observability.ts). Storage failures on\n// `ctx.storage`/`ctx.secrets` flow through as `StorageFailure` in the\n// typed channel and are captured + downgraded to `InternalError({ traceId })`\n// at Layer composition. No per-handler translation.\n// ---------------------------------------------------------------------------\n\nexport const OnePasswordGroup = HttpApiGroup.make(\"onepassword\")\n .add(\n HttpApiEndpoint.get(\"getConfig\", \"/scopes/:scopeId/onepassword/config\", {\n params: ScopeParams,\n success: GetConfigResponse,\n error: [InternalError, OnePasswordError],\n }),\n )\n .add(\n HttpApiEndpoint.put(\"configure\", \"/scopes/:scopeId/onepassword/config\", {\n params: ScopeParams,\n payload: ConfigurePayload,\n success: Schema.Void,\n error: [InternalError, OnePasswordError],\n }),\n )\n .add(\n HttpApiEndpoint.delete(\"removeConfig\", \"/scopes/:scopeId/onepassword/config\", {\n params: ScopeParams,\n success: Schema.Void,\n error: [InternalError, OnePasswordError],\n }),\n )\n .add(\n HttpApiEndpoint.get(\"status\", \"/scopes/:scopeId/onepassword/status\", {\n params: ScopeParams,\n success: ConnectionStatus,\n error: [InternalError, OnePasswordError],\n }),\n )\n .add(\n HttpApiEndpoint.get(\"listVaults\", \"/scopes/:scopeId/onepassword/vaults\", {\n params: ScopeParams,\n query: ListVaultsParams,\n success: ListVaultsResponse,\n error: [InternalError, OnePasswordError],\n }),\n );\n"],"mappings":";;;;;;;;;AAAA,SAAS,gBAAgB;AACzB,SAAS,YAAY,oBAAoB;AACzC,YAAY,UAAU;AACtB,YAAY,iBAAiB;AAC7B,SAAS,iBAAAA,sBAAqB;AAC9B,SAAS,gBAAgB;AACzB,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,aAAa;AACtB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;AC7BP,SAAS,qBAAqB;;;ACD9B,SAAS,8BAA8B;AACvC,SAAS,kBAAkB;;;ACD3B,SAAS,iBAAiB,oBAAoB;AAC9C,SAAS,cAAc;AACvB,SAAS,eAAe,eAAe;AASvC,IAAM,cAAc,EAAE,SAAS,QAAQ;AAMvC,IAAM,mBAAmB;AAEzB,IAAM,mBAAmB,OAAO,OAAO;AAAA,EACrC,UAAU,OAAO,SAAS,CAAC,eAAe,iBAAiB,CAAC;AAAA,EAC5D,SAAS,OAAO;AAClB,CAAC;AAMD,IAAM,qBAAqB,O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,KAAK,SAAS,gBAAgB,OAAO,KAAK,cAAc,mBAClE;AAAA,QACA,oBAAC,UAAK,WAAU,4BAA2B,mBAAK;AAAA,QAChD,qBAAC,SAAI,WAAU,mCACb;AAAA,8BAAC,UAAK,WAAU,+BAA+B,iBAAO,MAAK;AAAA,UAC3D,oBAAC,UAAK,WAAU,2DACb,iBAAO,SACV;AAAA,WACF;AAAA,SACF,IAEA,oBAAC,6BAA0B,wDAE3B,GAEJ;AAAA,MACA,oBAAC,yBACE,mBACC,iCACE;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,SAAQ;AAAA,YACR,MAAK;AAAA,YACL,WAAU;AAAA,YACV,SAAS,MAAM,cAAc,IAAI;AAAA,YAClC;AAAA;AAAA,QAED;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,SAAQ;AAAA,YACR,MAAK;AAAA,YACL,WAAU;AAAA,YACV,SAAS;AAAA,YACV;AAAA;AAAA,QAED;AAAA,SACF,IAEA,CAAC,aACD,CAAC,WACC;AAAA,QAAC;AAAA;AAAA,UACC,SAAQ;AAAA,UACR,MAAK;AAAA,UACL,WAAU;AAAA,UACV,SAAS,MAAM,cAAc,IAAI;AAAA,UAClC;AAAA;AAAA,MAED,GAGN;AAAA,OACF;AAAA,IAEC,cACC;AAAA,MAAC;AAAA;AAAA,QACC,MAAM;AAAA,QACN,cAAc;AAAA,QACd,SACE,SACI;AAAA,UACE,UAAU,OAAO,KAAK;AAAA,UACtB,aACE,OAAO,KAAK,SAAS,gBACjB,OAAO,KAAK,cACZ,OAAO,KAAK;AAAA,UAClB,SAAS,OAAO;AAAA,UAChB,MAAM,OAAO;AAAA,QACf,IACA;AAAA;AAAA,IAER;AAAA,KAEJ;AAEJ;","names":["ReactivityKey","ReactivityKey"]}
|
package/dist/api/group.d.ts
CHANGED
|
@@ -1,21 +1,31 @@
|
|
|
1
1
|
import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi";
|
|
2
2
|
import { Schema } from "effect";
|
|
3
|
-
import { InternalError } from "@executor-js/
|
|
3
|
+
import { InternalError } from "@executor-js/sdk/core";
|
|
4
4
|
import { OnePasswordError } from "../sdk/errors";
|
|
5
5
|
import { OnePasswordConfig, Vault, ConnectionStatus } from "../sdk/types";
|
|
6
6
|
export declare const OnePasswordGroup: HttpApiGroup.HttpApiGroup<"onepassword", HttpApiEndpoint.HttpApiEndpoint<"getConfig", "GET", "/scopes/:scopeId/onepassword/config", HttpApiEndpoint.StringTree<Schema.Struct<{
|
|
7
7
|
scopeId: Schema.brand<Schema.String, "ScopeId">;
|
|
8
|
-
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.NullOr<typeof OnePasswordConfig>>, HttpApiEndpoint.Json<typeof
|
|
8
|
+
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.NullOr<typeof OnePasswordConfig>>, HttpApiEndpoint.Json<typeof InternalError | typeof OnePasswordError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"configure", "PUT", "/scopes/:scopeId/onepassword/config", HttpApiEndpoint.StringTree<Schema.Struct<{
|
|
9
9
|
scopeId: Schema.brand<Schema.String, "ScopeId">;
|
|
10
|
-
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<
|
|
10
|
+
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
|
|
11
|
+
readonly auth: Schema.Union<readonly [Schema.Struct<{
|
|
12
|
+
readonly kind: Schema.Literal<"desktop-app">;
|
|
13
|
+
readonly accountName: Schema.String;
|
|
14
|
+
}>, Schema.Struct<{
|
|
15
|
+
readonly kind: Schema.Literal<"service-account">;
|
|
16
|
+
readonly tokenSecretId: Schema.String;
|
|
17
|
+
}>]>;
|
|
18
|
+
readonly vaultId: Schema.String;
|
|
19
|
+
readonly name: Schema.String;
|
|
20
|
+
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Void>, HttpApiEndpoint.Json<typeof InternalError | typeof OnePasswordError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"removeConfig", "DELETE", "/scopes/:scopeId/onepassword/config", HttpApiEndpoint.StringTree<Schema.Struct<{
|
|
11
21
|
scopeId: Schema.brand<Schema.String, "ScopeId">;
|
|
12
|
-
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Void>, HttpApiEndpoint.Json<typeof
|
|
22
|
+
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Void>, HttpApiEndpoint.Json<typeof InternalError | typeof OnePasswordError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"status", "GET", "/scopes/:scopeId/onepassword/status", HttpApiEndpoint.StringTree<Schema.Struct<{
|
|
13
23
|
scopeId: Schema.brand<Schema.String, "ScopeId">;
|
|
14
|
-
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<typeof ConnectionStatus>, HttpApiEndpoint.Json<typeof
|
|
24
|
+
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<typeof ConnectionStatus>, HttpApiEndpoint.Json<typeof InternalError | typeof OnePasswordError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"listVaults", "GET", "/scopes/:scopeId/onepassword/vaults", HttpApiEndpoint.StringTree<Schema.Struct<{
|
|
15
25
|
scopeId: Schema.brand<Schema.String, "ScopeId">;
|
|
16
26
|
}>>, HttpApiEndpoint.StringTree<Schema.Struct<{
|
|
17
27
|
readonly authKind: Schema.Literals<readonly ["desktop-app", "service-account"]>;
|
|
18
28
|
readonly account: Schema.String;
|
|
19
29
|
}>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
|
|
20
30
|
readonly vaults: Schema.$Array<typeof Vault>;
|
|
21
|
-
}>>, HttpApiEndpoint.Json<typeof
|
|
31
|
+
}>>, HttpApiEndpoint.Json<typeof InternalError | typeof OnePasswordError>, never, never>, false>;
|
package/dist/api/handlers.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import { Context } from "effect";
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { Context, Effect } from "effect";
|
|
2
|
+
declare const OnePasswordExtensionService_base: Context.ServiceClass<OnePasswordExtensionService, "OnePasswordExtensionService", {
|
|
3
|
+
configure: (config: import("../promise").OnePasswordConfig, targetScope: string) => Effect.Effect<void, import("@executor-js/storage-core").StorageError, never>;
|
|
4
|
+
getConfig: () => Effect.Effect<import("../promise").OnePasswordConfig | null, import("@executor-js/storage-core").StorageError | import("../promise").OnePasswordError, never>;
|
|
5
|
+
removeConfig: (targetScope: string) => Effect.Effect<void, import("@executor-js/storage-core").StorageError, never>;
|
|
6
|
+
status: () => Effect.Effect<import("../promise").ConnectionStatus, import("@executor-js/storage-core").StorageFailure | import("../promise").OnePasswordError, never>;
|
|
7
|
+
listVaults: (auth: import("../promise").OnePasswordAuth) => Effect.Effect<import("../promise").Vault[], import("@executor-js/storage-core").StorageFailure | import("../promise").OnePasswordError, never>;
|
|
8
|
+
resolve: (uri: string) => Effect.Effect<string, import("@executor-js/storage-core").StorageFailure | import("../promise").OnePasswordError, never>;
|
|
9
|
+
}>;
|
|
4
10
|
export declare class OnePasswordExtensionService extends OnePasswordExtensionService_base {
|
|
5
11
|
}
|
|
6
12
|
export declare const OnePasswordHandlers: import("effect/Layer").Layer<import("effect/unstable/httpapi/HttpApiGroup").ApiGroup<"executor", "onepassword">, never, import("effect/unstable/http/HttpRouter").Request<"Requires", OnePasswordExtensionService>>;
|
package/dist/api/index.d.ts
CHANGED
|
@@ -1,2 +1,37 @@
|
|
|
1
|
+
import { type OnePasswordPluginOptions } from "../sdk/plugin";
|
|
2
|
+
import { OnePasswordExtensionService } from "./handlers";
|
|
1
3
|
export { OnePasswordGroup } from "./group";
|
|
2
4
|
export { OnePasswordHandlers, OnePasswordExtensionService } from "./handlers";
|
|
5
|
+
export declare const onepasswordHttpPlugin: import("@executor-js/sdk/core").ConfiguredPlugin<"onepassword", {
|
|
6
|
+
configure: (config: import("../promise").OnePasswordConfig, targetScope: string) => import("effect/Effect").Effect<void, import("@executor-js/storage-core").StorageError, never>;
|
|
7
|
+
getConfig: () => import("effect/Effect").Effect<import("../promise").OnePasswordConfig | null, import("@executor-js/storage-core").StorageError | import("../promise").OnePasswordError, never>;
|
|
8
|
+
removeConfig: (targetScope: string) => import("effect/Effect").Effect<void, import("@executor-js/storage-core").StorageError, never>;
|
|
9
|
+
status: () => import("effect/Effect").Effect<import("../promise").ConnectionStatus, import("@executor-js/storage-core").StorageFailure | import("../promise").OnePasswordError, never>;
|
|
10
|
+
listVaults: (auth: import("../promise").OnePasswordAuth) => import("effect/Effect").Effect<import("../promise").Vault[], import("@executor-js/storage-core").StorageFailure | import("../promise").OnePasswordError, never>;
|
|
11
|
+
resolve: (uri: string) => import("effect/Effect").Effect<string, import("@executor-js/storage-core").StorageFailure | import("../promise").OnePasswordError, never>;
|
|
12
|
+
}, import("../sdk").OnePasswordStore, OnePasswordPluginOptions, undefined, typeof OnePasswordExtensionService, import("effect/Layer").Layer<import("effect/unstable/httpapi/HttpApiGroup").ApiGroup<"executor", "onepassword">, never, import("effect/unstable/http/HttpRouter").Request<"Requires", OnePasswordExtensionService>>, import("effect/unstable/httpapi/HttpApiGroup").HttpApiGroup<"onepassword", import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"getConfig", "GET", "/scopes/:scopeId/onepassword/config", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<import("effect/Schema").Struct<{
|
|
13
|
+
scopeId: import("effect/Schema").brand<import("effect/Schema").String, "ScopeId">;
|
|
14
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").NullOr<typeof import("../promise").OnePasswordConfig>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("@executor-js/api").InternalError | typeof import("../promise").OnePasswordError>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"configure", "PUT", "/scopes/:scopeId/onepassword/config", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<import("effect/Schema").Struct<{
|
|
15
|
+
scopeId: import("effect/Schema").brand<import("effect/Schema").String, "ScopeId">;
|
|
16
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
17
|
+
readonly auth: import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
|
|
18
|
+
readonly kind: import("effect/Schema").Literal<"desktop-app">;
|
|
19
|
+
readonly accountName: import("effect/Schema").String;
|
|
20
|
+
}>, import("effect/Schema").Struct<{
|
|
21
|
+
readonly kind: import("effect/Schema").Literal<"service-account">;
|
|
22
|
+
readonly tokenSecretId: import("effect/Schema").String;
|
|
23
|
+
}>]>;
|
|
24
|
+
readonly vaultId: import("effect/Schema").String;
|
|
25
|
+
readonly name: import("effect/Schema").String;
|
|
26
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Void>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("@executor-js/api").InternalError | typeof import("../promise").OnePasswordError>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"removeConfig", "DELETE", "/scopes/:scopeId/onepassword/config", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<import("effect/Schema").Struct<{
|
|
27
|
+
scopeId: import("effect/Schema").brand<import("effect/Schema").String, "ScopeId">;
|
|
28
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Void>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("@executor-js/api").InternalError | typeof import("../promise").OnePasswordError>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"status", "GET", "/scopes/:scopeId/onepassword/status", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<import("effect/Schema").Struct<{
|
|
29
|
+
scopeId: import("effect/Schema").brand<import("effect/Schema").String, "ScopeId">;
|
|
30
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("../promise").ConnectionStatus>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("@executor-js/api").InternalError | typeof import("../promise").OnePasswordError>, never, never> | import("effect/unstable/httpapi/HttpApiEndpoint").HttpApiEndpoint<"listVaults", "GET", "/scopes/:scopeId/onepassword/vaults", import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<import("effect/Schema").Struct<{
|
|
31
|
+
scopeId: import("effect/Schema").brand<import("effect/Schema").String, "ScopeId">;
|
|
32
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<import("effect/Schema").Struct<{
|
|
33
|
+
readonly authKind: import("effect/Schema").Literals<readonly ["desktop-app", "service-account"]>;
|
|
34
|
+
readonly account: import("effect/Schema").String;
|
|
35
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").StringTree<never>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<import("effect/Schema").Struct<{
|
|
36
|
+
readonly vaults: import("effect/Schema").$Array<typeof import("../promise").Vault>;
|
|
37
|
+
}>>, import("effect/unstable/httpapi/HttpApiEndpoint").Json<typeof import("@executor-js/api").InternalError | typeof import("../promise").OnePasswordError>, never, never>, false>>;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// src/sdk/types.ts
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
var DesktopAppAuthSchema = Schema.Struct({
|
|
4
|
+
kind: Schema.Literal("desktop-app"),
|
|
5
|
+
/** 1Password account domain, e.g. "my.1password.com" */
|
|
6
|
+
accountName: Schema.String
|
|
7
|
+
});
|
|
8
|
+
var DesktopAppAuth = class extends Schema.Class("DesktopAppAuth")(
|
|
9
|
+
DesktopAppAuthSchema.fields
|
|
10
|
+
) {
|
|
11
|
+
};
|
|
12
|
+
var ServiceAccountAuthSchema = Schema.Struct({
|
|
13
|
+
kind: Schema.Literal("service-account"),
|
|
14
|
+
/** The service account token (stored as a secret) */
|
|
15
|
+
tokenSecretId: Schema.String
|
|
16
|
+
});
|
|
17
|
+
var ServiceAccountAuth = class extends Schema.Class("ServiceAccountAuth")(
|
|
18
|
+
ServiceAccountAuthSchema.fields
|
|
19
|
+
) {
|
|
20
|
+
};
|
|
21
|
+
var OnePasswordAuthSchema = Schema.Union([DesktopAppAuthSchema, ServiceAccountAuthSchema]);
|
|
22
|
+
var OnePasswordAuth = Schema.Union([DesktopAppAuth, ServiceAccountAuth]);
|
|
23
|
+
var OnePasswordConfigSchema = Schema.Struct({
|
|
24
|
+
auth: OnePasswordAuthSchema,
|
|
25
|
+
/** Vault to scope operations to */
|
|
26
|
+
vaultId: Schema.String,
|
|
27
|
+
/** Human label */
|
|
28
|
+
name: Schema.String
|
|
29
|
+
});
|
|
30
|
+
var OnePasswordConfig = class extends Schema.Class("OnePasswordConfig")(
|
|
31
|
+
OnePasswordConfigSchema.fields
|
|
32
|
+
) {
|
|
33
|
+
};
|
|
34
|
+
var Vault = class extends Schema.Class("Vault")({
|
|
35
|
+
id: Schema.String,
|
|
36
|
+
name: Schema.String
|
|
37
|
+
}) {
|
|
38
|
+
};
|
|
39
|
+
var ConnectionStatus = class extends Schema.Class("ConnectionStatus")({
|
|
40
|
+
connected: Schema.Boolean,
|
|
41
|
+
vaultName: Schema.optional(Schema.String),
|
|
42
|
+
error: Schema.optional(Schema.String)
|
|
43
|
+
}) {
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
// src/sdk/errors.ts
|
|
47
|
+
import { Schema as Schema2 } from "effect";
|
|
48
|
+
var OnePasswordError = class extends Schema2.TaggedErrorClass()(
|
|
49
|
+
"OnePasswordError",
|
|
50
|
+
{
|
|
51
|
+
operation: Schema2.String,
|
|
52
|
+
message: Schema2.String
|
|
53
|
+
},
|
|
54
|
+
{ httpApiStatus: 502 }
|
|
55
|
+
) {
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export {
|
|
59
|
+
DesktopAppAuth,
|
|
60
|
+
ServiceAccountAuth,
|
|
61
|
+
OnePasswordAuth,
|
|
62
|
+
OnePasswordConfigSchema,
|
|
63
|
+
OnePasswordConfig,
|
|
64
|
+
Vault,
|
|
65
|
+
ConnectionStatus,
|
|
66
|
+
OnePasswordError
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=chunk-NRYSRUWU.js.map
|