@fabrika/provider-contract 0.9.0-dev.1 → 0.9.0-dev.11
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 +17 -5
- package/src/app-cli.ts +81 -0
- package/src/conformance.ts +221 -0
- package/src/control.ts +176 -22
- package/src/index.ts +1 -0
- package/src/plain-credentials.ts +278 -0
- package/types/src/app-cli.d.ts +46 -0
- package/types/src/authoring.d.ts +27 -0
- package/types/src/conformance.d.ts +22 -0
- package/types/src/control.d.ts +628 -0
- package/types/src/index.d.ts +6 -0
- package/types/src/installation.d.ts +37 -0
- package/types/src/json.d.ts +17 -0
- package/types/src/plain-credentials.d.ts +16 -0
- package/types/src/schema.d.ts +17 -0
- package/types/src/steps.d.ts +23 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** A value that can cross the provider persistence boundary without provider-specific types. */
|
|
2
|
+
export type JsonValue = null | boolean | number | string | JsonValue[] | {
|
|
3
|
+
[key: string]: JsonValue;
|
|
4
|
+
};
|
|
5
|
+
/** Persisted provider data. The provider owns the payload schema and its version. */
|
|
6
|
+
export interface ProviderEnvelope {
|
|
7
|
+
readonly provider: string;
|
|
8
|
+
readonly version: number;
|
|
9
|
+
readonly payload: JsonValue;
|
|
10
|
+
}
|
|
11
|
+
/** Converts one provider-owned value to and from its versioned JSON payload. */
|
|
12
|
+
export interface ProviderCodec<T> {
|
|
13
|
+
readonly version: number;
|
|
14
|
+
encode(value: T): JsonValue;
|
|
15
|
+
decode(payload: JsonValue): T;
|
|
16
|
+
}
|
|
17
|
+
export declare const decodeEnvelope: <T>(kind: string, provider: string, envelope: ProviderEnvelope, codec: ProviderCodec<T>) => T;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Why a name and value look like a credential. `because` completes "… looks like a credential: <because>". */
|
|
2
|
+
export interface PlainCredentialFinding {
|
|
3
|
+
readonly basis: 'name' | 'value';
|
|
4
|
+
readonly because: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Whether a plain `name = value` looks like a credential, and why; null when it does not.
|
|
8
|
+
*
|
|
9
|
+
* The name matches on a credential word (`TOKEN`, `SECRET`, `PASSWORD`, `PASS`, `BASIC_AUTH`, a `KEY` or `KEYS` that is
|
|
10
|
+
* not an id, a public key or a cache key), unless its last word makes it describe one (`TOKEN_URL`,
|
|
11
|
+
* `PASSWORD_MIN_LENGTH`). A name match needs a literal that could be a credential: an empty value, one made only of
|
|
12
|
+
* references or a boolean is not, nor a short number or duration under a name that says it is a quantity. The value matches on its own: a private key, an
|
|
13
|
+
* Authorization header, a URL with a password, an issuer's token prefix, or a long random string unless the name says
|
|
14
|
+
* the value is public (a publishable or site key, an id).
|
|
15
|
+
*/
|
|
16
|
+
export declare function plainCredentialFinding(name: string, value: string): PlainCredentialFinding | null;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AppSchema } from '@fabrika/auth-core';
|
|
2
|
+
/** Inputs needed to reconcile one app's authorization vocabulary into IAM. */
|
|
3
|
+
export interface SchemaReconcileInput {
|
|
4
|
+
url: string;
|
|
5
|
+
app: string;
|
|
6
|
+
schema: AppSchema;
|
|
7
|
+
/**
|
|
8
|
+
* Every origin IAM may hand this app a session at, as known by the control plane. Omitted leaves
|
|
9
|
+
* IAM's registry alone; a supplied set replaces it. It travels beside the schema and never inside
|
|
10
|
+
* it — an app declares its vocabulary, the control plane declares where the app lives.
|
|
11
|
+
*/
|
|
12
|
+
returnOrigins?: readonly string[];
|
|
13
|
+
adminKey?: string;
|
|
14
|
+
signal: AbortSignal;
|
|
15
|
+
}
|
|
16
|
+
/** Provider-neutral port for authorization schema reconciliation. */
|
|
17
|
+
export type SchemaReconciler = (input: SchemaReconcileInput) => Promise<void>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** What happened to one provider deploy step. */
|
|
2
|
+
export interface DeployStepResult {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
readonly status: 'succeeded' | 'failed' | 'skipped';
|
|
5
|
+
readonly error?: string;
|
|
6
|
+
readonly startedAt?: number;
|
|
7
|
+
readonly finishedAt?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface RunStepsOptions {
|
|
10
|
+
readonly appId: string;
|
|
11
|
+
readonly env: string;
|
|
12
|
+
readonly dryRun: boolean;
|
|
13
|
+
readonly signal: AbortSignal;
|
|
14
|
+
readonly log: (line: string) => void;
|
|
15
|
+
}
|
|
16
|
+
/** Run a provider's steps in order. The first failure or a cancellation skips every later step. */
|
|
17
|
+
export declare const runSteps: <TStep extends {
|
|
18
|
+
readonly id: string;
|
|
19
|
+
readonly description: string;
|
|
20
|
+
}>(steps: readonly TStep[], options: RunStepsOptions, runOne: (step: TStep) => Promise<void>) => Promise<{
|
|
21
|
+
readonly status: "succeeded" | "failed";
|
|
22
|
+
readonly steps: readonly DeployStepResult[];
|
|
23
|
+
}>;
|