@alpacakit/integrations 0.1.0-beta.37 → 0.2.0-beta.2
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alpacakit/integrations",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0-beta.2",
|
|
4
4
|
"description": "Provider-neutral development-management integrations for issues, pull requests, and repositories.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"zod": "^4.3.6",
|
|
36
|
-
"@alpacakit/core": "0.
|
|
36
|
+
"@alpacakit/core": "0.2.0-beta.2"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"typescript": "^5.9.3",
|
package/dist/keyring/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/keyring/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EACvB,eAAe,EACf,kBAAkB,GACnB,MAAM,eAAe,CAAC"}
|
package/dist/keyring/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { keyringResolver, keyringSecretStore, } from "./resolver.js";
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { SecretResolver } from "../ports.js";
|
|
2
|
-
export interface KeyringSecretStore {
|
|
3
|
-
get(id: string): Promise<string | null>;
|
|
4
|
-
set(id: string, value: string): Promise<void>;
|
|
5
|
-
delete(id: string): Promise<void>;
|
|
6
|
-
}
|
|
7
|
-
export declare function keyringResolver(service: string): SecretResolver;
|
|
8
|
-
export declare function keyringSecretStore(service: string): KeyringSecretStore;
|
|
9
|
-
//# sourceMappingURL=resolver.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../src/keyring/resolver.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAkBlD,MAAM,WAAW,kBAAkB;IACjC,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACxC,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACnC;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,cAAc,CAS/D;AAeD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,kBAAkB,CAyBtE"}
|
package/dist/keyring/resolver.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { INTEGRATION_ERROR_CODE, IntegrationError, NOT_AVAILABLE_CAUSE, } from "../error.js";
|
|
2
|
-
const KEYRING_PEER_PACKAGE = "@napi-rs/keyring";
|
|
3
|
-
const KEYRING_ENTRY_EXPORT = "Entry";
|
|
4
|
-
export function keyringResolver(service) {
|
|
5
|
-
let modulePromise = null;
|
|
6
|
-
const load = () => {
|
|
7
|
-
modulePromise ??= loadKeyringModule();
|
|
8
|
-
return modulePromise;
|
|
9
|
-
};
|
|
10
|
-
return {
|
|
11
|
-
resolve: async (id) => await readKeyringEntry(await load(), service, id),
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
async function readKeyringEntry(module, service, id) {
|
|
15
|
-
try {
|
|
16
|
-
const value = await new module.entryConstructor(service, id).getPassword();
|
|
17
|
-
return value === "" ? null : value;
|
|
18
|
-
}
|
|
19
|
-
catch (error) {
|
|
20
|
-
throw keyringOperationError(id, "read", error);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
export function keyringSecretStore(service) {
|
|
24
|
-
let modulePromise = null;
|
|
25
|
-
const load = () => {
|
|
26
|
-
modulePromise ??= loadKeyringModule();
|
|
27
|
-
return modulePromise;
|
|
28
|
-
};
|
|
29
|
-
return {
|
|
30
|
-
get: async (id) => await readKeyringEntry(await load(), service, id),
|
|
31
|
-
set: async (id, value) => {
|
|
32
|
-
const module = await load();
|
|
33
|
-
try {
|
|
34
|
-
await new module.entryConstructor(service, id).setPassword(value);
|
|
35
|
-
}
|
|
36
|
-
catch (error) {
|
|
37
|
-
throw keyringOperationError(id, "written", error);
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
delete: async (id) => {
|
|
41
|
-
const module = await load();
|
|
42
|
-
try {
|
|
43
|
-
await new module.entryConstructor(service, id).deletePassword();
|
|
44
|
-
}
|
|
45
|
-
catch (error) {
|
|
46
|
-
throw keyringOperationError(id, "deleted", error);
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
function keyringOperationError(id, operation, cause) {
|
|
52
|
-
return new IntegrationError({
|
|
53
|
-
code: INTEGRATION_ERROR_CODE.failed,
|
|
54
|
-
message: operation === "read"
|
|
55
|
-
? `Keyring secret "${id}" could not be read`
|
|
56
|
-
: `Keyring secret "${id}" could not be ${operation}`,
|
|
57
|
-
data: { status: null, bodyTail: null },
|
|
58
|
-
integrationId: null,
|
|
59
|
-
connectionId: null,
|
|
60
|
-
cause,
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
async function loadKeyringModule() {
|
|
64
|
-
let loaded;
|
|
65
|
-
try {
|
|
66
|
-
loaded = await import(KEYRING_PEER_PACKAGE);
|
|
67
|
-
}
|
|
68
|
-
catch (error) {
|
|
69
|
-
throw peerMissing(error);
|
|
70
|
-
}
|
|
71
|
-
const entry = typeof loaded === "object" && loaded !== null
|
|
72
|
-
? Reflect.get(loaded, KEYRING_ENTRY_EXPORT)
|
|
73
|
-
: null;
|
|
74
|
-
if (typeof entry !== "function") {
|
|
75
|
-
throw peerMissing(null);
|
|
76
|
-
}
|
|
77
|
-
return {
|
|
78
|
-
entryConstructor: entry,
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
function peerMissing(cause) {
|
|
82
|
-
return new IntegrationError({
|
|
83
|
-
code: INTEGRATION_ERROR_CODE.notAvailable,
|
|
84
|
-
message: "Keyring peer is not installed",
|
|
85
|
-
data: { cause: NOT_AVAILABLE_CAUSE.peerMissing },
|
|
86
|
-
integrationId: null,
|
|
87
|
-
connectionId: null,
|
|
88
|
-
cause,
|
|
89
|
-
});
|
|
90
|
-
}
|