@yadsh/dsh-qa-integrations 0.5.0 → 0.7.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/README.md +636 -202
- package/compatibility.json +1 -1
- package/lib/broker.js +468 -9
- package/lib/broker.js.map +1 -1
- package/lib/client/bitrix24.js +67 -5
- package/lib/client/bitrix24.js.map +1 -1
- package/lib/client/card.js +8 -1
- package/lib/client/card.js.map +1 -1
- package/lib/client/confluence.js +98 -129
- package/lib/client/confluence.js.map +1 -1
- package/lib/client/gitlab.js +41 -5
- package/lib/client/gitlab.js.map +1 -1
- package/lib/client/index.js +33 -11
- package/lib/client/index.js.map +1 -1
- package/lib/client/integrations.js +40 -3
- package/lib/client/integrations.js.map +1 -1
- package/lib/client/jira.js +96 -127
- package/lib/client/jira.js.map +1 -1
- package/lib/client/operator-card.js +537 -0
- package/lib/client/operator-card.js.map +1 -0
- package/lib/client/operator-controls.js +232 -0
- package/lib/client/operator-controls.js.map +1 -0
- package/lib/client/provider-card.js +138 -4
- package/lib/client/provider-card.js.map +1 -1
- package/lib/client/styles.js +68 -5
- package/lib/client/styles.js.map +1 -1
- package/lib/client/teamcity.js +31 -4
- package/lib/client/teamcity.js.map +1 -1
- package/lib/client/testit.js +101 -0
- package/lib/client/testit.js.map +1 -0
- package/lib/client/weblate.js +105 -0
- package/lib/client/weblate.js.map +1 -0
- package/lib/client.js +5214 -1054
- package/lib/client.js.map +1 -1
- package/lib/coerce.js +16 -7
- package/lib/coerce.js.map +1 -1
- package/lib/config.js +12 -0
- package/lib/config.js.map +1 -1
- package/lib/errors.js.map +1 -1
- package/lib/index.js +444 -57
- package/lib/index.js.map +1 -1
- package/lib/providers/bitrix24/catalog.js +151 -8
- package/lib/providers/bitrix24/catalog.js.map +1 -1
- package/lib/providers/bitrix24/config.js +87 -13
- package/lib/providers/bitrix24/config.js.map +1 -1
- package/lib/providers/bitrix24/credential-help.js +24 -0
- package/lib/providers/bitrix24/credential-help.js.map +1 -0
- package/lib/providers/bitrix24/index.js +122 -0
- package/lib/providers/bitrix24/index.js.map +1 -1
- package/lib/providers/bitrix24/operations.js +60 -1
- package/lib/providers/bitrix24/operations.js.map +1 -1
- package/lib/providers/bitrix24/tools.js +95 -3
- package/lib/providers/bitrix24/tools.js.map +1 -1
- package/lib/providers/confluence/catalog.js +51 -3
- package/lib/providers/confluence/catalog.js.map +1 -1
- package/lib/providers/confluence/credential-help.js +29 -0
- package/lib/providers/confluence/credential-help.js.map +1 -0
- package/lib/providers/confluence/index.js +302 -35
- package/lib/providers/confluence/index.js.map +1 -1
- package/lib/providers/confluence/operations.js +1 -1
- package/lib/providers/confluence/operations.js.map +1 -1
- package/lib/providers/gitlab/catalog.js +108 -15
- package/lib/providers/gitlab/catalog.js.map +1 -1
- package/lib/providers/gitlab/config.js +11 -3
- package/lib/providers/gitlab/config.js.map +1 -1
- package/lib/providers/gitlab/credential-help.js +33 -0
- package/lib/providers/gitlab/credential-help.js.map +1 -0
- package/lib/providers/gitlab/index.js +337 -6
- package/lib/providers/gitlab/index.js.map +1 -1
- package/lib/providers/jira/catalog.js +73 -3
- package/lib/providers/jira/catalog.js.map +1 -1
- package/lib/providers/jira/credential-help.js +31 -0
- package/lib/providers/jira/credential-help.js.map +1 -0
- package/lib/providers/jira/index.js +275 -12
- package/lib/providers/jira/index.js.map +1 -1
- package/lib/providers/registry.js +4 -0
- package/lib/providers/registry.js.map +1 -1
- package/lib/providers/shared/credential-help.js +29 -0
- package/lib/providers/shared/credential-help.js.map +1 -0
- package/lib/providers/shared/service-boundary.js +44 -0
- package/lib/providers/shared/service-boundary.js.map +1 -0
- package/lib/providers/teamcity/catalog.js +56 -2
- package/lib/providers/teamcity/catalog.js.map +1 -1
- package/lib/providers/teamcity/credential-help.js +25 -0
- package/lib/providers/teamcity/credential-help.js.map +1 -0
- package/lib/providers/teamcity/index.js +254 -2
- package/lib/providers/teamcity/index.js.map +1 -1
- package/lib/providers/testit/attachments.js +131 -0
- package/lib/providers/testit/attachments.js.map +1 -0
- package/lib/providers/testit/catalog.js +302 -0
- package/lib/providers/testit/catalog.js.map +1 -0
- package/lib/providers/testit/config.js +175 -0
- package/lib/providers/testit/config.js.map +1 -0
- package/lib/providers/testit/credential-help.js +29 -0
- package/lib/providers/testit/credential-help.js.map +1 -0
- package/lib/providers/testit/index.js +458 -0
- package/lib/providers/testit/index.js.map +1 -0
- package/lib/providers/testit/operations.js +1070 -0
- package/lib/providers/testit/operations.js.map +1 -0
- package/lib/providers/testit/tools.js +717 -0
- package/lib/providers/testit/tools.js.map +1 -0
- package/lib/providers/testit/transport.js +158 -0
- package/lib/providers/testit/transport.js.map +1 -0
- package/lib/providers/weblate/catalog.js +279 -0
- package/lib/providers/weblate/catalog.js.map +1 -0
- package/lib/providers/weblate/config.js +147 -0
- package/lib/providers/weblate/config.js.map +1 -0
- package/lib/providers/weblate/credential-help.js +26 -0
- package/lib/providers/weblate/credential-help.js.map +1 -0
- package/lib/providers/weblate/index.js +419 -0
- package/lib/providers/weblate/index.js.map +1 -0
- package/lib/providers/weblate/operations.js +703 -0
- package/lib/providers/weblate/operations.js.map +1 -0
- package/lib/providers/weblate/query.js +80 -0
- package/lib/providers/weblate/query.js.map +1 -0
- package/lib/providers/weblate/tools.js +408 -0
- package/lib/providers/weblate/tools.js.map +1 -0
- package/lib/providers/weblate/transport.js +179 -0
- package/lib/providers/weblate/transport.js.map +1 -0
- package/lib/repository.js +197 -13
- package/lib/repository.js.map +1 -1
- package/lib/service-credentials/config.js +179 -0
- package/lib/service-credentials/config.js.map +1 -0
- package/lib/service-credentials/policy.js +92 -0
- package/lib/service-credentials/policy.js.map +1 -0
- package/lib/service-credentials/registry.js +142 -0
- package/lib/service-credentials/registry.js.map +1 -0
- package/lib/service-credentials/state.js +30 -0
- package/lib/service-credentials/state.js.map +1 -0
- package/lib/service-credentials/types.js +20 -0
- package/lib/service-credentials/types.js.map +1 -0
- package/lib/shared/settings.js +8 -13
- package/lib/shared/settings.js.map +1 -1
- package/lib/tools.js +27 -2
- package/lib/tools.js.map +1 -1
- package/lib/typert.host.js +1340 -100
- package/lib/typert.remote-client.d.ts +45 -11
- package/lib/typert.remote-client.js +1101 -38
- package/lib/types/broker.d.ts +79 -5
- package/lib/types/client/bitrix24.d.ts +24 -2
- package/lib/types/client/card.d.ts +3 -1
- package/lib/types/client/confluence.d.ts +19 -3
- package/lib/types/client/gitlab.d.ts +15 -2
- package/lib/types/client/index.d.ts +7 -5
- package/lib/types/client/integrations.d.ts +12 -3
- package/lib/types/client/jira.d.ts +20 -3
- package/lib/types/client/operator-card.d.ts +22 -0
- package/lib/types/client/operator-controls.d.ts +135 -0
- package/lib/types/client/provider-card.d.ts +50 -8
- package/lib/types/client/styles.d.ts +4 -3
- package/lib/types/client/teamcity.d.ts +15 -2
- package/lib/types/client/testit.d.ts +28 -0
- package/lib/types/client/weblate.d.ts +28 -0
- package/lib/types/coerce.d.ts +2 -2
- package/lib/types/config.d.ts +21 -0
- package/lib/types/errors.d.ts +9 -1
- package/lib/types/index.d.ts +183 -18
- package/lib/types/providers/bitrix24/catalog.d.ts +9 -1
- package/lib/types/providers/bitrix24/config.d.ts +23 -22
- package/lib/types/providers/bitrix24/credential-help.d.ts +8 -0
- package/lib/types/providers/bitrix24/index.d.ts +41 -1
- package/lib/types/providers/bitrix24/tools.d.ts +4 -0
- package/lib/types/providers/confluence/catalog.d.ts +11 -3
- package/lib/types/providers/confluence/credential-help.d.ts +9 -0
- package/lib/types/providers/confluence/index.d.ts +66 -7
- package/lib/types/providers/confluence/operations.d.ts +2 -0
- package/lib/types/providers/contract.d.ts +62 -1
- package/lib/types/providers/gitlab/catalog.d.ts +20 -5
- package/lib/types/providers/gitlab/config.d.ts +14 -3
- package/lib/types/providers/gitlab/credential-help.d.ts +9 -0
- package/lib/types/providers/gitlab/index.d.ts +51 -1
- package/lib/types/providers/jira/catalog.d.ts +13 -0
- package/lib/types/providers/jira/credential-help.d.ts +8 -0
- package/lib/types/providers/jira/index.d.ts +53 -1
- package/lib/types/providers/registry.d.ts +2 -0
- package/lib/types/providers/shared/credential-help.d.ts +17 -0
- package/lib/types/providers/shared/service-boundary.d.ts +25 -0
- package/lib/types/providers/teamcity/catalog.d.ts +18 -2
- package/lib/types/providers/teamcity/credential-help.d.ts +8 -0
- package/lib/types/providers/teamcity/index.d.ts +53 -2
- package/lib/types/providers/testit/attachments.d.ts +20 -0
- package/lib/types/providers/testit/catalog.d.ts +87 -0
- package/lib/types/providers/testit/config.d.ts +61 -0
- package/lib/types/providers/testit/credential-help.d.ts +8 -0
- package/lib/types/providers/testit/index.d.ts +119 -0
- package/lib/types/providers/testit/operations.d.ts +95 -0
- package/lib/types/providers/testit/tools.d.ts +15 -0
- package/lib/types/providers/testit/transport.d.ts +67 -0
- package/lib/types/providers/weblate/catalog.d.ts +60 -0
- package/lib/types/providers/weblate/config.d.ts +57 -0
- package/lib/types/providers/weblate/credential-help.d.ts +9 -0
- package/lib/types/providers/weblate/index.d.ts +92 -0
- package/lib/types/providers/weblate/operations.d.ts +77 -0
- package/lib/types/providers/weblate/query.d.ts +37 -0
- package/lib/types/providers/weblate/tools.d.ts +15 -0
- package/lib/types/providers/weblate/transport.d.ts +60 -0
- package/lib/types/repository.d.ts +38 -3
- package/lib/types/service-credentials/config.d.ts +73 -0
- package/lib/types/service-credentials/policy.d.ts +44 -0
- package/lib/types/service-credentials/registry.d.ts +43 -0
- package/lib/types/service-credentials/state.d.ts +14 -0
- package/lib/types/service-credentials/types.d.ts +97 -0
- package/lib/types/shared/settings.d.ts +8 -13
- package/lib/types/tools.d.ts +10 -1
- package/lib/types/types.d.ts +114 -10
- package/package.json +7 -7
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { OperationSecurityMetadata } from "../../service-credentials/types.js";
|
|
2
|
+
import type { IntegrationCapability, IntegrationCapabilityInfo } from "../../types.js";
|
|
3
|
+
import type { WeblateFlags } from "./config.js";
|
|
4
|
+
/**
|
|
5
|
+
* Capabilities this provider offers, one per kind of data rather than one per
|
|
6
|
+
* endpoint: the operator decides what this deployment is willing to expose, and
|
|
7
|
+
* Weblate's own project, component and language permissions still decide what
|
|
8
|
+
* the connected token may read. There is no capability for a write, because the
|
|
9
|
+
* catalog carries no operation that could change Weblate state.
|
|
10
|
+
*/
|
|
11
|
+
export type WeblateCapability = "identity.read" | "projects.read" | "components.read" | "translations.read" | "units.read" | "checks.read" | "comments.read" | "suggestions.read" | "changes.read" | "statistics.read" | "screenshots.read";
|
|
12
|
+
export interface WeblateCapabilityDefinition {
|
|
13
|
+
readonly capability: WeblateCapability;
|
|
14
|
+
readonly flag: Exclude<keyof WeblateFlags, "instances" | "retries" | "enabled" | "allowInsecureHttp">;
|
|
15
|
+
readonly label: string;
|
|
16
|
+
readonly hint: string;
|
|
17
|
+
}
|
|
18
|
+
export declare const WEBLATE_CAPABILITIES: readonly WeblateCapabilityDefinition[];
|
|
19
|
+
export interface WeblateOperationDefinition {
|
|
20
|
+
readonly capability: WeblateCapability;
|
|
21
|
+
/**
|
|
22
|
+
* REST path under the instance's `/api` root. `:placeholders` are filled by
|
|
23
|
+
* the handler; the value is a fixed string, so the model can never pick an
|
|
24
|
+
* endpoint of its own.
|
|
25
|
+
*/
|
|
26
|
+
readonly path: string;
|
|
27
|
+
/** Set when the operation answers with one page of a collection. */
|
|
28
|
+
readonly list?: boolean;
|
|
29
|
+
/** What this operation does, how sensitive it is, who may reach it. */
|
|
30
|
+
readonly security: OperationSecurityMetadata;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The resource kind every project-scoped operation of this provider is bounded
|
|
34
|
+
* by. A boundary entry is a project slug exactly as the operations address one,
|
|
35
|
+
* so a boundary entry and a tool argument are compared as strings.
|
|
36
|
+
*/
|
|
37
|
+
export declare const WEBLATE_RESOURCE_KIND = "projects";
|
|
38
|
+
/**
|
|
39
|
+
* Every model-reachable operation. The provider refuses any operation that is
|
|
40
|
+
* not listed here, so this table — together with `capability` and `security` —
|
|
41
|
+
* is the permission surface. Only GET: localization writes (suggestions, comments,
|
|
42
|
+
* translations, approvals) and the repository, file and autotranslate
|
|
43
|
+
* operations stay out until the confirmation framework exists.
|
|
44
|
+
*
|
|
45
|
+
* No operation of this catalog carries a secret or another person's raw output —
|
|
46
|
+
* there is no repository status or commit text here, and the localization text
|
|
47
|
+
* every read returns is bounded by the deployment's character cap and marked as
|
|
48
|
+
* untrusted content — so none of them is classified sensitive; a shared
|
|
49
|
+
* read-only account answers every one of them inside a project boundary.
|
|
50
|
+
*/
|
|
51
|
+
export declare const WEBLATE_OPERATIONS: Readonly<Record<string, WeblateOperationDefinition>>;
|
|
52
|
+
/** Capabilities this deployment allows, in catalog order. */
|
|
53
|
+
export declare function enabledCapabilities(flags: WeblateFlags): readonly WeblateCapability[];
|
|
54
|
+
/** Label and hint per capability, for clients that render what we declare. */
|
|
55
|
+
export declare const WEBLATE_CAPABILITY_INFO: Readonly<Record<WeblateCapability, IntegrationCapabilityInfo>>;
|
|
56
|
+
/** Capability an operation needs, or undefined when the catalog has none. */
|
|
57
|
+
export declare function weblateOperationCapability(operation: string): IntegrationCapability | undefined;
|
|
58
|
+
/** Security classification of an operation, or undefined when it is unknown. */
|
|
59
|
+
export declare function weblateOperationMetadata(operation: string): OperationSecurityMetadata | undefined;
|
|
60
|
+
//# sourceMappingURL=catalog.d.ts.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import z from "@deepseek-ai/schemastery";
|
|
2
|
+
/**
|
|
3
|
+
* One Weblate deployment the operator allows. A user never types a host: the
|
|
4
|
+
* connect form only picks from this list, so the broker cannot be pointed at an
|
|
5
|
+
* arbitrary origin (the specification's SSRF rule). Weblate is usually
|
|
6
|
+
* self-hosted, which is exactly why "did the operator declare this address?"
|
|
7
|
+
* replaces "is this address public?".
|
|
8
|
+
*/
|
|
9
|
+
export interface WeblateInstance {
|
|
10
|
+
readonly id: string;
|
|
11
|
+
readonly label: string;
|
|
12
|
+
/** Canonical `<origin><path>`, without a trailing slash. */
|
|
13
|
+
readonly baseUrl: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Deployment switches for the Weblate provider. Every read capability is on by
|
|
17
|
+
* default: the switches bound what this deployment is willing to expose at all,
|
|
18
|
+
* while Weblate's own project and team permissions decide what the connected
|
|
19
|
+
* token may actually read. The provider can only narrow, never widen.
|
|
20
|
+
*/
|
|
21
|
+
export interface WeblateFlags {
|
|
22
|
+
readonly enabled: boolean;
|
|
23
|
+
/** Development escape hatch; production instances must answer over HTTPS. */
|
|
24
|
+
readonly allowInsecureHttp: boolean;
|
|
25
|
+
readonly instances: readonly WeblateInstance[];
|
|
26
|
+
readonly identityRead: boolean;
|
|
27
|
+
readonly projectsRead: boolean;
|
|
28
|
+
readonly componentsRead: boolean;
|
|
29
|
+
readonly translationsRead: boolean;
|
|
30
|
+
readonly unitsRead: boolean;
|
|
31
|
+
readonly checksRead: boolean;
|
|
32
|
+
readonly commentsRead: boolean;
|
|
33
|
+
readonly suggestionsRead: boolean;
|
|
34
|
+
readonly changesRead: boolean;
|
|
35
|
+
readonly statisticsRead: boolean;
|
|
36
|
+
readonly screenshotsRead: boolean;
|
|
37
|
+
/** Character cap for one source or target string handed to the model. */
|
|
38
|
+
readonly maxTextChars: number;
|
|
39
|
+
/**
|
|
40
|
+
* Rows per page this deployment hands the model, whatever Weblate allows: the
|
|
41
|
+
* provider's own default is 20 and this is the ceiling.
|
|
42
|
+
*/
|
|
43
|
+
readonly maxPageSize: number;
|
|
44
|
+
/** Extra attempts for a rate-limited or transient read; writes never retry. */
|
|
45
|
+
readonly retries: number;
|
|
46
|
+
}
|
|
47
|
+
export declare const WEBLATE_DEFAULTS: WeblateFlags;
|
|
48
|
+
/**
|
|
49
|
+
* Config slice of this provider, as it appears under `weblate:` in YAML. The
|
|
50
|
+
* instance list is validated and canonicalized by `resolveWeblateConfig`, which
|
|
51
|
+
* is where a deployment typo fails loudly.
|
|
52
|
+
*/
|
|
53
|
+
export declare const weblateConfigSchema: z<Partial<WeblateFlags>>;
|
|
54
|
+
export declare function resolveWeblateConfig(input?: Partial<WeblateFlags>): WeblateFlags;
|
|
55
|
+
/** The configured instance a stored credential names, or a fail-closed error. */
|
|
56
|
+
export declare function weblateInstance(flags: WeblateFlags, instanceId: string): WeblateInstance | undefined;
|
|
57
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CredentialHelp } from "@yadsh/dsh-plugin-kit";
|
|
2
|
+
/**
|
|
3
|
+
* Weblate issues the token inside the instance the user works with, so the
|
|
4
|
+
* declared help explains where in the instance it lives and what the two token
|
|
5
|
+
* prefixes mean; the address itself belongs to the deployment and is replaced
|
|
6
|
+
* through `credentialHelp.weblate`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const WEBLATE_CREDENTIAL_HELP: CredentialHelp;
|
|
9
|
+
//# sourceMappingURL=credential-help.d.ts.map
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { type CredentialHelp } from "@yadsh/dsh-plugin-kit";
|
|
2
|
+
import type { ResolvedQaIntegrationsConfig } from "../../config.js";
|
|
3
|
+
import type { OperationSecurityMetadata, ServiceCredentialHealth } from "../../service-credentials/types.js";
|
|
4
|
+
import type { CapabilityServiceState, IntegrationCapability, IntegrationCapabilityInfo, ProviderValidation } from "../../types.js";
|
|
5
|
+
import type { IntegrationProvider, ProviderContext } from "../contract.js";
|
|
6
|
+
export { credentialFromPlaintext, credentialInstance, resultsOf, type WeblateCredential, } from "./transport.js";
|
|
7
|
+
export type WeblateTokenKind = "personal" | "project" | "unknown";
|
|
8
|
+
/**
|
|
9
|
+
* Which of Weblate's token shapes a value looks like. Weblate decides what a
|
|
10
|
+
* token may do, so this only ever reaches the user as a label.
|
|
11
|
+
*/
|
|
12
|
+
export declare function tokenKind(token: string): WeblateTokenKind;
|
|
13
|
+
/**
|
|
14
|
+
* Weblate provider: operator-configured instances over a Weblate API token.
|
|
15
|
+
*
|
|
16
|
+
* Localization state is read-only here. Weblate's search grammar is composed
|
|
17
|
+
* from validated filters rather than accepted from the model, upstream URLs are
|
|
18
|
+
* echoed only when they point at the configured instance and never followed, and
|
|
19
|
+
* every answer that carries upstream-authored text is marked as untrusted
|
|
20
|
+
* content.
|
|
21
|
+
*/
|
|
22
|
+
export declare class WeblateProvider implements IntegrationProvider {
|
|
23
|
+
private readonly config;
|
|
24
|
+
readonly id = "weblate";
|
|
25
|
+
readonly displayName = "Weblate";
|
|
26
|
+
/** What this deployment allows; Weblate's own permissions still apply. */
|
|
27
|
+
readonly capabilities: readonly IntegrationCapability[];
|
|
28
|
+
readonly capabilityInfo: Readonly<Record<IntegrationCapability, IntegrationCapabilityInfo>>;
|
|
29
|
+
/** Where the settings card says this provider's credential comes from. */
|
|
30
|
+
readonly credentialHelp: CredentialHelp | null;
|
|
31
|
+
/** Overrides the deployment got wrong; reported once at startup, never fatal. */
|
|
32
|
+
readonly credentialHelpProblems: readonly string[];
|
|
33
|
+
private readonly transport;
|
|
34
|
+
constructor(config: ResolvedQaIntegrationsConfig, fetcher?: typeof fetch);
|
|
35
|
+
/**
|
|
36
|
+
* Keep only the token, tagged with the instance it was minted for. The
|
|
37
|
+
* instance comes from the connect form and from operator config, never from a
|
|
38
|
+
* tool argument, which is what keeps the broker from dialling any host the
|
|
39
|
+
* caller names.
|
|
40
|
+
*/
|
|
41
|
+
parseCredential(raw: string, options?: Readonly<Record<string, string>>): {
|
|
42
|
+
readonly credential: string;
|
|
43
|
+
readonly portal: string;
|
|
44
|
+
};
|
|
45
|
+
operationCapability(operation: string): IntegrationCapability | undefined;
|
|
46
|
+
operationMetadata(operation: string): OperationSecurityMetadata | undefined;
|
|
47
|
+
/** Every project-scoped read is held inside the profile's project boundary. */
|
|
48
|
+
resourceBoundaryKind(operation: string): string | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Portal of a configured instance. An empty id means "the only instance", the
|
|
51
|
+
* same rule `parseCredential` applies, so deployment configuration and the
|
|
52
|
+
* connect form name instances alike.
|
|
53
|
+
*/
|
|
54
|
+
instancePortal(instanceId: string): string | undefined;
|
|
55
|
+
capabilityServiceState(capability: IntegrationCapability): CapabilityServiceState | undefined;
|
|
56
|
+
validate(context: ProviderContext): Promise<ProviderValidation>;
|
|
57
|
+
/**
|
|
58
|
+
* Health of a deployment-managed token. The probe is the one read personal
|
|
59
|
+
* validation makes, so it cannot change upstream state; Weblate exposes no
|
|
60
|
+
* token-scope introspection, so there is nothing wider than read-only to
|
|
61
|
+
* detect here — the local service ceiling stays the only bound on what the
|
|
62
|
+
* credential may do, and the warning says so.
|
|
63
|
+
*/
|
|
64
|
+
validateServiceCredential(context: ProviderContext): Promise<ServiceCredentialHealth>;
|
|
65
|
+
execute(context: ProviderContext, operation: string, input: Readonly<Record<string, unknown>>): Promise<unknown>;
|
|
66
|
+
/**
|
|
67
|
+
* Hold one call inside the deployment's boundary. A service-safe operation
|
|
68
|
+
* either names its project in the arguments — a missing slug is refused, which
|
|
69
|
+
* is what keeps the global unit searches from answering with the shared
|
|
70
|
+
* account's whole view — or is addressed by the id of a string or a
|
|
71
|
+
* screenshot, which is resolved to its project upstream first.
|
|
72
|
+
*/
|
|
73
|
+
private assertInsideBoundary;
|
|
74
|
+
/**
|
|
75
|
+
* Resolve one id-addressed read to the project it answers for. The probe is
|
|
76
|
+
* the same read the operation itself makes — Weblate has no cheaper "which
|
|
77
|
+
* project is this id" endpoint — and the probed answer is discarded unless
|
|
78
|
+
* the project is inside the boundary, so a foreign id reveals nothing.
|
|
79
|
+
*/
|
|
80
|
+
private projectOfAddressedResource;
|
|
81
|
+
/**
|
|
82
|
+
* The bounded project listing. A service profile names the projects it covers,
|
|
83
|
+
* so the answer is built from that list instead of from whatever the shared
|
|
84
|
+
* account can reach; a project the service token cannot see is reported as
|
|
85
|
+
* unavailable rather than silently dropped. The whole allowlist is the answer
|
|
86
|
+
* — its size is bounded by the administrator, not by a cursor.
|
|
87
|
+
*/
|
|
88
|
+
private listBoundedProjects;
|
|
89
|
+
private resolveInstance;
|
|
90
|
+
}
|
|
91
|
+
export default WeblateProvider;
|
|
92
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { WeblateFlags } from "./config.js";
|
|
2
|
+
import { type WeblateQuery } from "./transport.js";
|
|
3
|
+
/** Rows per page when the agent does not ask for more. */
|
|
4
|
+
export declare const DEFAULT_PAGE_SIZE = 20;
|
|
5
|
+
/** Characters of one source/target string in a list answer. */
|
|
6
|
+
export declare const SUMMARY_TEXT_CHARS = 200;
|
|
7
|
+
/**
|
|
8
|
+
* A component reference: one slug, or a category path in front of it. Every
|
|
9
|
+
* segment is validated and encoded on its own, so the separator that joins them
|
|
10
|
+
* is the provider's and never a character the caller smuggled in.
|
|
11
|
+
*/
|
|
12
|
+
export declare function componentRef(value: unknown, field?: string): string;
|
|
13
|
+
export declare function projectRef(value: unknown, field?: string): string;
|
|
14
|
+
export declare function languageRef(value: unknown, field?: string): string;
|
|
15
|
+
export interface OperationContext {
|
|
16
|
+
readonly flags: WeblateFlags;
|
|
17
|
+
/** Canonical address of the instance this call is dialled at. */
|
|
18
|
+
readonly origin: string;
|
|
19
|
+
}
|
|
20
|
+
export interface WeblateRequest {
|
|
21
|
+
readonly path: string;
|
|
22
|
+
readonly query: WeblateQuery;
|
|
23
|
+
/** Present for the operations that answer with one page of a collection. */
|
|
24
|
+
readonly page?: {
|
|
25
|
+
readonly page: number;
|
|
26
|
+
readonly perPage: number;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export type WeblateOperationHandler = (input: Readonly<Record<string, unknown>>, context: OperationContext) => WeblateRequest;
|
|
30
|
+
export declare const WEBLATE_HANDLERS: Readonly<Record<string, WeblateOperationHandler>>;
|
|
31
|
+
/**
|
|
32
|
+
* Upstream URLs are echoed only when they point at the configured instance, and
|
|
33
|
+
* never followed: the provider answers with the address, it does not dial it.
|
|
34
|
+
*/
|
|
35
|
+
export declare function sameOriginUrl(value: unknown, origin: string): string | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Which project, component and language a unit belongs to, read out of the
|
|
38
|
+
* translation URL Weblate itself put in the answer. A category path keeps its
|
|
39
|
+
* place, so a component inside a category is reported and re-usable as the
|
|
40
|
+
* `component` argument of another call.
|
|
41
|
+
*/
|
|
42
|
+
export declare function translationRef(value: unknown, origin: string): Record<string, unknown> | undefined;
|
|
43
|
+
export declare function unitState(value: unknown): string;
|
|
44
|
+
/**
|
|
45
|
+
* The Weblate account a `GET /api/users/` answer belongs to. An unprivileged
|
|
46
|
+
* token sees only itself, which is how the connected account is identified; a
|
|
47
|
+
* token that may list users answers with many rows, and then the account is
|
|
48
|
+
* reported as unknown rather than guessed from the first row.
|
|
49
|
+
*/
|
|
50
|
+
export declare function accountFromUsers(data: unknown): {
|
|
51
|
+
readonly account: Record<string, unknown> | null;
|
|
52
|
+
readonly resolved: boolean;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* The name of the account as the Settings card shows it. An unresolved account
|
|
56
|
+
* falls back to whatever the caller names instead of a name picked at random.
|
|
57
|
+
*/
|
|
58
|
+
export declare function accountNameFrom(data: unknown, fallback: string): string;
|
|
59
|
+
/** External id the broker stores for this connection, when it is known. */
|
|
60
|
+
export declare function accountIdFrom(data: unknown): string;
|
|
61
|
+
export interface WeblateProjectionContext {
|
|
62
|
+
readonly flags: WeblateFlags;
|
|
63
|
+
readonly origin: string;
|
|
64
|
+
/** Character budget for one string in this answer. */
|
|
65
|
+
readonly textLimit: number;
|
|
66
|
+
}
|
|
67
|
+
export type WeblateProjection = (data: unknown, context: WeblateProjectionContext) => unknown;
|
|
68
|
+
export declare const WEBLATE_PROJECTIONS: Readonly<Record<string, WeblateProjection>>;
|
|
69
|
+
/**
|
|
70
|
+
* Operations whose answer carries upstream-authored localization text. The
|
|
71
|
+
* marker is what tells a reader of the raw JSON that the strings inside were
|
|
72
|
+
* written by people on the far side and are data to them, never instructions.
|
|
73
|
+
*/
|
|
74
|
+
export declare const WEBLATE_UNTRUSTED_OPERATIONS: readonly string[];
|
|
75
|
+
/** Character budget of one string in the answer of this operation. */
|
|
76
|
+
export declare function textLimitFor(operation: string, requested: unknown, flags: WeblateFlags): number;
|
|
77
|
+
//# sourceMappingURL=operations.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Values of Weblate's `is:` lookup this provider exposes. `needs-editing` and
|
|
3
|
+
* `fuzzy` are synonyms upstream, and `untranslated` is Weblate's own definition
|
|
4
|
+
* (everything below "translated"), which therefore includes the strings marked
|
|
5
|
+
* for editing.
|
|
6
|
+
*/
|
|
7
|
+
export declare const UNIT_STATE_FILTERS: readonly ["untranslated", "needs-editing", "translated", "approved", "read-only"];
|
|
8
|
+
export type UnitStateFilter = (typeof UNIT_STATE_FILTERS)[number];
|
|
9
|
+
/** Text fields of a unit the agent may search inside. */
|
|
10
|
+
export declare const UNIT_TEXT_FIELDS: readonly ["source", "target", "context", "note"];
|
|
11
|
+
export type UnitTextField = (typeof UNIT_TEXT_FIELDS)[number];
|
|
12
|
+
/** `has:` lookups this provider exposes; all are upstream-documented. */
|
|
13
|
+
export declare const FAILING_CHECK_CLAUSE = "has:check";
|
|
14
|
+
export declare const SUGGESTION_CLAUSE = "has:suggestion";
|
|
15
|
+
export declare const COMMENT_CLAUSE = "has:comment";
|
|
16
|
+
/**
|
|
17
|
+
* One grammar value, always double-quoted with `\` and `"` escaped: the parser
|
|
18
|
+
* accepts quoted strings for every field this provider uses, and a bare word
|
|
19
|
+
* may not contain a space. Line breaks are refused rather than escaped, because
|
|
20
|
+
* the grammar's whitespace escapes would silently turn them into something else.
|
|
21
|
+
*/
|
|
22
|
+
export declare function quoteQueryValue(value: string): string;
|
|
23
|
+
/** Exact match on a field whose value the agent named: a project, component or language. */
|
|
24
|
+
export declare function exactClause(field: "project" | "component" | "language", value: string): string;
|
|
25
|
+
/** Substring match inside one of the unit's own texts. */
|
|
26
|
+
export declare function textClause(field: UnitTextField, value: string): string;
|
|
27
|
+
/** Weblate's `is:` state lookup, so the vocabulary stays upstream's own. */
|
|
28
|
+
export declare function stateClause(state: UnitStateFilter): string;
|
|
29
|
+
export declare function isUnitStateFilter(value: unknown): value is UnitStateFilter;
|
|
30
|
+
export declare function isUnitTextField(value: unknown): value is UnitTextField;
|
|
31
|
+
/**
|
|
32
|
+
* Clauses joined the way Weblate reads them: `a AND b`, or nothing at all. A
|
|
33
|
+
* filter that is asked for twice is asked for once — the same clause repeated
|
|
34
|
+
* would narrow nothing and would only make the audit line harder to read.
|
|
35
|
+
*/
|
|
36
|
+
export declare function buildUnitQuery(clauses: readonly string[]): string;
|
|
37
|
+
//# sourceMappingURL=query.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ToolDefinition } from "@deepseek-ai/dsh-tools";
|
|
2
|
+
import type { IntegrationBroker } from "../../broker.js";
|
|
3
|
+
import type { IntegrationPrincipal } from "../../types.js";
|
|
4
|
+
export declare const WEBLATE_TOOL_NAMES: readonly ["weblate_connection_get", "weblate_projects_list", "weblate_project_get", "weblate_project_statistics_get", "weblate_components_list", "weblate_component_get", "weblate_component_statistics_get", "weblate_translations_list", "weblate_translation_get", "weblate_translation_statistics_get", "weblate_units_search", "weblate_units_find", "weblate_unit_get", "weblate_unit_comments_list", "weblate_unit_suggestions_list", "weblate_failing_units_list", "weblate_changes_list", "weblate_screenshots_list", "weblate_screenshot_get"];
|
|
5
|
+
/**
|
|
6
|
+
* Every tool reports what the *connected* Weblate account may read, never a
|
|
7
|
+
* caller-supplied identity: the account comes from the stored integration of the
|
|
8
|
+
* QA user who owns the DSH session, and the tool schemas carry no user,
|
|
9
|
+
* credential or instance selector.
|
|
10
|
+
*/
|
|
11
|
+
export declare function createWeblateTools(options: {
|
|
12
|
+
readonly broker: IntegrationBroker;
|
|
13
|
+
readonly principalForSession: (sessionId: string) => IntegrationPrincipal | undefined;
|
|
14
|
+
}): readonly ToolDefinition[];
|
|
15
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { ResolvedQaIntegrationsConfig } from "../../config.js";
|
|
2
|
+
import { type WeblateFlags, type WeblateInstance } from "./config.js";
|
|
3
|
+
/**
|
|
4
|
+
* Encrypted credential payload of one Weblate connection: which configured
|
|
5
|
+
* instance the token belongs to, and the token itself. The base URL is not
|
|
6
|
+
* stored — it is re-resolved from operator config on every call, so removing or
|
|
7
|
+
* repointing an instance takes effect at once instead of at the next connect.
|
|
8
|
+
*/
|
|
9
|
+
export interface WeblateCredential {
|
|
10
|
+
readonly instanceId: string;
|
|
11
|
+
readonly token: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function credentialFromPlaintext(plaintext: string): WeblateCredential;
|
|
14
|
+
/**
|
|
15
|
+
* The configured instance a credential belongs to. A credential minted for an
|
|
16
|
+
* instance the operator has since removed fails closed: it never falls back to
|
|
17
|
+
* another instance, however permissive that one is.
|
|
18
|
+
*/
|
|
19
|
+
export declare function credentialInstance(flags: WeblateFlags, credential: WeblateCredential): WeblateInstance;
|
|
20
|
+
export interface WeblateQuery {
|
|
21
|
+
readonly [key: string]: string | number | undefined;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* One page of a Weblate collection. Weblate paginates in the body
|
|
25
|
+
* (`count`/`next`/`previous`/`results`), not in headers, and its `next` is an
|
|
26
|
+
* absolute URL: only the page number is read out of it, and only when it points
|
|
27
|
+
* at the configured instance, so a hostile or misconfigured upstream cannot move
|
|
28
|
+
* a follow-up request to another origin.
|
|
29
|
+
*/
|
|
30
|
+
export interface WeblatePage {
|
|
31
|
+
readonly page: number;
|
|
32
|
+
readonly perPage: number;
|
|
33
|
+
readonly nextPage?: number;
|
|
34
|
+
readonly total?: number;
|
|
35
|
+
}
|
|
36
|
+
export interface WeblateJsonResponse<T> {
|
|
37
|
+
readonly data: T;
|
|
38
|
+
readonly page?: WeblatePage;
|
|
39
|
+
}
|
|
40
|
+
/** The `results` array of a paginated answer, or an empty list. */
|
|
41
|
+
export declare function resultsOf(value: unknown): readonly unknown[];
|
|
42
|
+
/**
|
|
43
|
+
* HTTP boundary of the provider: one documented Weblate REST call, bounded in
|
|
44
|
+
* time and size, with upstream failures folded into safe domain errors and
|
|
45
|
+
* bounded retries for the transient ones.
|
|
46
|
+
*/
|
|
47
|
+
export declare class WeblateTransport {
|
|
48
|
+
private readonly config;
|
|
49
|
+
private readonly flags;
|
|
50
|
+
private readonly fetcher;
|
|
51
|
+
constructor(config: ResolvedQaIntegrationsConfig, flags: WeblateFlags, fetcher?: typeof fetch);
|
|
52
|
+
getJson<T>(instance: WeblateInstance, token: string, path: string, query?: WeblateQuery, requested?: {
|
|
53
|
+
readonly page: number;
|
|
54
|
+
readonly perPage: number;
|
|
55
|
+
}): Promise<WeblateJsonResponse<T>>;
|
|
56
|
+
private url;
|
|
57
|
+
private request;
|
|
58
|
+
private failure;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EncryptedSecretRecord, IntegrationAuditEntry, IntegrationCapability, IntegrationFile, IntegrationPolicyMode, IntegrationPrincipal, IntegrationProviderId, StoredIntegration } from "./types.js";
|
|
1
|
+
import type { CredentialSource, EncryptedSecretRecord, IntegrationAuditEntry, IntegrationCapability, IntegrationFile, IntegrationPolicyMode, IntegrationPrincipal, IntegrationProviderId, IntegrationServiceBoundary, StoredIntegration } from "./types.js";
|
|
2
2
|
/**
|
|
3
3
|
* Durable plugin-owned store, as tables. Every lookup starts from principal +
|
|
4
4
|
* provider, which is the pair the unique index covers, so a lookup reads the
|
|
@@ -24,16 +24,51 @@ export declare class IntegrationRepository {
|
|
|
24
24
|
connect(options: {
|
|
25
25
|
principal: IntegrationPrincipal;
|
|
26
26
|
provider: IntegrationProviderId;
|
|
27
|
-
|
|
27
|
+
/**
|
|
28
|
+
* The personal credential, or null when this connection is created in
|
|
29
|
+
* service mode. A connection that runs on the managed credential keeps any
|
|
30
|
+
* personal credential it already had, inactive: it is never a fallback, but
|
|
31
|
+
* the user can switch back without minting a new token.
|
|
32
|
+
*/
|
|
33
|
+
secret: EncryptedSecretRecord | null;
|
|
28
34
|
tenantId: string;
|
|
29
35
|
externalUserId: string;
|
|
30
36
|
displayName: string;
|
|
31
37
|
capabilities: readonly IntegrationCapability[];
|
|
38
|
+
credentialSource?: CredentialSource;
|
|
39
|
+
serviceProfileId?: string | null;
|
|
32
40
|
}): StoredIntegration;
|
|
33
41
|
updateValidation(principal: IntegrationPrincipal, provider: IntegrationProviderId, success: boolean, errorCode: string | null, capabilities?: readonly IntegrationCapability[]): void;
|
|
42
|
+
/**
|
|
43
|
+
* Move a binding between credential sources without touching upstream. The
|
|
44
|
+
* binding revision is bumped, so everything derived from the previous identity
|
|
45
|
+
* — caches, cursors, prepared actions — is stale from this moment on; the
|
|
46
|
+
* personal credential, if there is one, stays stored but unused.
|
|
47
|
+
*/
|
|
48
|
+
setCredentialSource(options: {
|
|
49
|
+
principal: IntegrationPrincipal;
|
|
50
|
+
provider: IntegrationProviderId;
|
|
51
|
+
source: CredentialSource;
|
|
52
|
+
serviceProfileId: string | null;
|
|
53
|
+
capabilities: readonly IntegrationCapability[];
|
|
54
|
+
tenantId: string;
|
|
55
|
+
externalUserId: string;
|
|
56
|
+
displayName: string;
|
|
57
|
+
}): StoredIntegration | undefined;
|
|
58
|
+
/** Store what this binding narrows the profile's allowlist to. */
|
|
59
|
+
setServiceSelection(principal: IntegrationPrincipal, provider: IntegrationProviderId, selection: IntegrationServiceBoundary | null): void;
|
|
60
|
+
/** Record which profile revision the binding was last resolved against. */
|
|
61
|
+
setServicePolicyRevision(principal: IntegrationPrincipal, provider: IntegrationProviderId, revision: string): void;
|
|
34
62
|
setPolicy(principal: IntegrationPrincipal, provider: IntegrationProviderId, operation: IntegrationCapability, mode: IntegrationPolicyMode): void;
|
|
35
63
|
disconnect(principal: IntegrationPrincipal, provider: IntegrationProviderId): boolean;
|
|
36
|
-
audit(entry: Omit<IntegrationAuditEntry, "id" | "createdAt">): void;
|
|
64
|
+
audit(entry: Omit<IntegrationAuditEntry, "id" | "createdAt" | "credentialSource" | "serviceProfileId"> & Partial<Pick<IntegrationAuditEntry, "credentialSource" | "serviceProfileId">>): void;
|
|
65
|
+
/**
|
|
66
|
+
* Widen stored capability lists whose ids a provider has since split, copying
|
|
67
|
+
* each legacy policy onto every id that replaced it. A provider-agnostic
|
|
68
|
+
* repair driven by the composition root: it is idempotent, so running it on
|
|
69
|
+
* every start costs one scan and changes nothing once applied.
|
|
70
|
+
*/
|
|
71
|
+
expandCapabilities(renames: Readonly<Record<string, readonly string[]>>): void;
|
|
37
72
|
/**
|
|
38
73
|
* Import a pre-SQLite `qa-integrations.json` exactly once, then rename it
|
|
39
74
|
* aside. A database that already holds a connection is never overwritten by
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import z from "@deepseek-ai/schemastery";
|
|
2
|
+
/**
|
|
3
|
+
* One deployment-managed credential, as it appears under
|
|
4
|
+
* `managedServiceCredentials.profiles[]` in YAML. Everything here is operator
|
|
5
|
+
* input, so a typo fails loudly at load: a silently dropped profile would leave
|
|
6
|
+
* users with a provider they cannot use through the managed path and no
|
|
7
|
+
* explanation.
|
|
8
|
+
*/
|
|
9
|
+
export interface ManagedServiceCredentialProfileInput {
|
|
10
|
+
readonly id?: string;
|
|
11
|
+
readonly provider?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Operator-facing instance id of the provider slice this credential belongs
|
|
14
|
+
* to — the same id the connect form offers, such as a GitLab `instances[].id`.
|
|
15
|
+
*/
|
|
16
|
+
readonly instance?: string;
|
|
17
|
+
/** Safe alias shown to users, e.g. "QA GitLab Read-only". */
|
|
18
|
+
readonly label?: string;
|
|
19
|
+
/** Set to false to retire a profile without deleting its configuration. */
|
|
20
|
+
readonly enabled?: boolean;
|
|
21
|
+
readonly credential?: {
|
|
22
|
+
readonly type?: string;
|
|
23
|
+
readonly secretFile?: string;
|
|
24
|
+
readonly secretEnv?: string;
|
|
25
|
+
};
|
|
26
|
+
/** Administrator-defined resource boundary; at least one kind is required. */
|
|
27
|
+
readonly resources?: Readonly<Record<string, readonly (string | number)[] | undefined>>;
|
|
28
|
+
/** Administrator narrowing of the service ceiling. Only `deny` is accepted. */
|
|
29
|
+
readonly policy?: Readonly<Record<string, string | undefined>>;
|
|
30
|
+
}
|
|
31
|
+
export interface ManagedServiceCredentialsInput {
|
|
32
|
+
readonly enabled?: boolean;
|
|
33
|
+
/** Whether a new connection starts in service mode when a profile exists. */
|
|
34
|
+
readonly defaultForNewConnections?: boolean;
|
|
35
|
+
readonly profiles?: readonly ManagedServiceCredentialProfileInput[];
|
|
36
|
+
}
|
|
37
|
+
export interface ManagedServiceCredentialProfileConfig {
|
|
38
|
+
readonly id: string;
|
|
39
|
+
readonly provider: string;
|
|
40
|
+
readonly instance: string;
|
|
41
|
+
readonly label: string;
|
|
42
|
+
readonly enabled: boolean;
|
|
43
|
+
readonly authType: string;
|
|
44
|
+
readonly secretRef: string;
|
|
45
|
+
readonly resources: Readonly<Record<string, readonly string[]>>;
|
|
46
|
+
readonly policy: Readonly<Record<string, "deny">>;
|
|
47
|
+
}
|
|
48
|
+
export interface ManagedServiceCredentialsConfig {
|
|
49
|
+
readonly enabled: boolean;
|
|
50
|
+
readonly defaultForNewConnections: boolean;
|
|
51
|
+
readonly profiles: readonly ManagedServiceCredentialProfileConfig[];
|
|
52
|
+
}
|
|
53
|
+
export declare const MANAGED_SERVICE_CREDENTIALS_DEFAULTS: Readonly<{
|
|
54
|
+
enabled: false;
|
|
55
|
+
defaultForNewConnections: true;
|
|
56
|
+
}>;
|
|
57
|
+
/**
|
|
58
|
+
* Config schema of this slice. Profile entries stay opaque here on purpose:
|
|
59
|
+
* `resolveManagedServiceCredentials` validates them in one place, where it can
|
|
60
|
+
* fail loudly with the profile id in the message instead of an anonymous
|
|
61
|
+
* schema error.
|
|
62
|
+
*/
|
|
63
|
+
export declare const managedServiceCredentialsSchema: z<ManagedServiceCredentialsInput>;
|
|
64
|
+
export declare function resolveManagedServiceCredentials(input?: ManagedServiceCredentialsInput): ManagedServiceCredentialsConfig;
|
|
65
|
+
/**
|
|
66
|
+
* Revision of everything about a profile that policy decisions depend on. A
|
|
67
|
+
* change here means every cache, cursor and pending action that was produced
|
|
68
|
+
* under the previous revision has to be treated as stale.
|
|
69
|
+
*/
|
|
70
|
+
export declare function profilePolicyRevision(profile: ManagedServiceCredentialProfileConfig): string;
|
|
71
|
+
/** Short content digest; used for revisions and never as a secret fingerprint. */
|
|
72
|
+
export declare function digest(value: string | Buffer): string;
|
|
73
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { IntegrationErrorCode } from "../errors.js";
|
|
2
|
+
import type { IntegrationCapability } from "../types.js";
|
|
3
|
+
import type { OperationSecurityMetadata, ServiceCredentialProfile, ServiceResourceBoundary } from "./types.js";
|
|
4
|
+
/**
|
|
5
|
+
* The service ceiling: an operation reaches a managed credential only when it
|
|
6
|
+
* is a read, carries no more than normal sensitivity, and was classified as
|
|
7
|
+
* service-safe on purpose. Upstream permissions are never part of this test:
|
|
8
|
+
* a service token that happens to be able to trigger a build still cannot,
|
|
9
|
+
* because the operation is a write.
|
|
10
|
+
*/
|
|
11
|
+
export declare const SERVICE_CEILING: OperationSecurityMetadata;
|
|
12
|
+
export type ServicePolicyDecision = {
|
|
13
|
+
readonly allowed: true;
|
|
14
|
+
} | {
|
|
15
|
+
readonly allowed: false;
|
|
16
|
+
readonly code: IntegrationErrorCode;
|
|
17
|
+
readonly message: string;
|
|
18
|
+
};
|
|
19
|
+
export interface ServiceOperationQuery {
|
|
20
|
+
readonly metadata: OperationSecurityMetadata;
|
|
21
|
+
/** Capability the operation belongs to, when its provider declares one. */
|
|
22
|
+
readonly capability: IntegrationCapability | undefined;
|
|
23
|
+
readonly profile: ServiceCredentialProfile;
|
|
24
|
+
/** Resource kind the operation is scoped to, or undefined when it has none. */
|
|
25
|
+
readonly boundaryKind: string | undefined;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Decide one operation against the service ceiling and the administrator's
|
|
29
|
+
* narrowing of it. The order of the checks is the order of the guarantees: an
|
|
30
|
+
* operation is refused for being a write before it is refused for being
|
|
31
|
+
* sensitive, so a caller can never widen the ceiling by re-classifying an
|
|
32
|
+
* operation as sensitive.
|
|
33
|
+
*/
|
|
34
|
+
export declare function evaluateServiceOperation(query: ServiceOperationQuery): ServicePolicyDecision;
|
|
35
|
+
/** Exact membership of one identifier in one kind of a boundary. */
|
|
36
|
+
export declare function boundaryHas(boundary: ServiceResourceBoundary, kind: string, ref: string): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Narrow a profile boundary by a user's own selection. A user may only remove:
|
|
39
|
+
* anything not present in the profile boundary is dropped, so a forged
|
|
40
|
+
* selection that named a resource outside the administrator's list can never
|
|
41
|
+
* widen what the deployment allows.
|
|
42
|
+
*/
|
|
43
|
+
export declare function narrowBoundary(boundary: ServiceResourceBoundary, selection: ServiceResourceBoundary | undefined): ServiceResourceBoundary;
|
|
44
|
+
//# sourceMappingURL=policy.d.ts.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type ManagedServiceCredentialProfileConfig, type ManagedServiceCredentialsConfig } from "./config.js";
|
|
2
|
+
import type { ResolvedServiceCredential, ServiceCredentialProfile } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Deployment-owned service credentials. Profiles come from operator
|
|
5
|
+
* configuration, their secrets from a mounted file or the environment, and
|
|
6
|
+
* nothing here is reachable from a user: a user cannot create a profile, change
|
|
7
|
+
* a secret, move an upstream identity or choose a profile by id.
|
|
8
|
+
*
|
|
9
|
+
* Secrets are read lazily and cached by file stamp, so rotating a mounted
|
|
10
|
+
* secret takes effect on the next call without anyone reconnecting and without
|
|
11
|
+
* restarting the host.
|
|
12
|
+
*/
|
|
13
|
+
export declare class ServiceCredentialRegistry {
|
|
14
|
+
private readonly profiles;
|
|
15
|
+
private readonly byPortal;
|
|
16
|
+
private readonly secrets;
|
|
17
|
+
private readonly env;
|
|
18
|
+
constructor(config: ManagedServiceCredentialsConfig, resolvePortal: (provider: string, instance: string) => string | undefined, options?: {
|
|
19
|
+
readonly env?: NodeJS.ProcessEnv;
|
|
20
|
+
});
|
|
21
|
+
/** The profile a binding of this provider and portal resolves to, if any. */
|
|
22
|
+
find(provider: string, portal: string): ServiceCredentialProfile | undefined;
|
|
23
|
+
/** True when this provider/portal can offer service mode at all. */
|
|
24
|
+
available(provider: string, portal: string): boolean;
|
|
25
|
+
list(): readonly ServiceCredentialProfile[];
|
|
26
|
+
/**
|
|
27
|
+
* The secret of one profile plus the revision of its content. Throwing here
|
|
28
|
+
* is the fail-closed path: a profile whose secret is missing, empty or
|
|
29
|
+
* unreadable serves nothing, and the message names the reference, never the
|
|
30
|
+
* value.
|
|
31
|
+
*/
|
|
32
|
+
readSecret(profile: ServiceCredentialProfile): ResolvedServiceCredential;
|
|
33
|
+
/** Drop a cached secret; the next read re-reads it. Used by rotation tests. */
|
|
34
|
+
forget(profileId: string): void;
|
|
35
|
+
private load;
|
|
36
|
+
private loadEnv;
|
|
37
|
+
private loadFile;
|
|
38
|
+
}
|
|
39
|
+
/** Profiles are matched by provider and portal, never by a caller-chosen id. */
|
|
40
|
+
export declare function portalKey(provider: string, portal: string): string;
|
|
41
|
+
/** Config-shape of one profile, re-exported for the config composition root. */
|
|
42
|
+
export type { ManagedServiceCredentialProfileConfig };
|
|
43
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { OperationSecurityMetadata } from "./types.js";
|
|
2
|
+
import type { CapabilityServiceState } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* How one capability of a provider behaves under the managed credential,
|
|
5
|
+
* derived from the classifications of the operations that make it up. A
|
|
6
|
+
* capability with no classified operation — or one whose provider never listed
|
|
7
|
+
* it — is reported as unavailable, so a client never shows a switch that would
|
|
8
|
+
* do nothing.
|
|
9
|
+
*/
|
|
10
|
+
export declare function operationCapabilityServiceState(operations: Readonly<Record<string, {
|
|
11
|
+
readonly capability: string;
|
|
12
|
+
readonly security: OperationSecurityMetadata;
|
|
13
|
+
}>>, capability: string): CapabilityServiceState;
|
|
14
|
+
//# sourceMappingURL=state.d.ts.map
|