@fabrika/auth-core 0.8.1 → 0.9.0-dev.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 +4 -3
- package/src/dev-environment.ts +39 -0
- package/src/framework-variables.ts +5 -2
- package/src/index.ts +1 -0
- package/types/src/app-environment.d.ts +24 -0
- package/types/src/canonical-path.d.ts +20 -0
- package/types/src/contract-canonical.d.ts +19 -0
- package/types/src/contract.d.ts +794 -0
- package/types/src/dev-environment.d.ts +32 -0
- package/types/src/device.d.ts +144 -0
- package/types/src/endpoint-digest.d.ts +58 -0
- package/types/src/endpoints.d.ts +65 -0
- package/types/src/environment.d.ts +58 -0
- package/types/src/framework-variables.d.ts +80 -0
- package/types/src/index.d.ts +24 -0
- package/types/src/installation-endpoint.d.ts +46 -0
- package/types/src/json.d.ts +13 -0
- package/types/src/locale.d.ts +14 -0
- package/types/src/mail.d.ts +67 -0
- package/types/src/membership.d.ts +318 -0
- package/types/src/oauth.d.ts +7 -0
- package/types/src/path-segment.d.ts +5 -0
- package/types/src/permissions.d.ts +50 -0
- package/types/src/requirement.d.ts +24 -0
- package/types/src/rpc.d.ts +283 -0
- package/types/src/sha256.d.ts +2 -0
- package/types/src/token.d.ts +215 -0
- package/types/src/types.d.ts +191 -0
- package/types/src/wire.d.ts +60 -0
- package/types/src/workloads.d.ts +25 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fabrika/auth-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0-dev.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -12,12 +12,13 @@
|
|
|
12
12
|
},
|
|
13
13
|
"files": [
|
|
14
14
|
"src",
|
|
15
|
-
"!src/**/__tests__/**"
|
|
15
|
+
"!src/**/__tests__/**",
|
|
16
|
+
"types"
|
|
16
17
|
],
|
|
17
18
|
"exports": {
|
|
18
19
|
".": {
|
|
19
20
|
"bun": "./src/index.ts",
|
|
20
|
-
"types": "./src/index.ts",
|
|
21
|
+
"types": "./types/src/index.d.ts",
|
|
21
22
|
"default": "./src/index.ts"
|
|
22
23
|
}
|
|
23
24
|
},
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// What the platform's build hands the launcher of a `dev` environment: a generated file beside the generated entrypoint.
|
|
2
|
+
// The provider writes it, the application's own framework release reads it (ADR-0062: protocol, changed additively).
|
|
3
|
+
|
|
4
|
+
/** Relative to the application root. The build writes it after the checks, so no authored file can stand in for it. */
|
|
5
|
+
export const DEV_LAUNCHER_CONFIG_FILE = 'fabrika/dev.generated.json'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The module whose `runDevLauncher(process.env)` a `dev` environment's `run.start` calls instead of the serving entry.
|
|
9
|
+
* No file is generated for it: the checker allows `process.env` in the generated serving entry only.
|
|
10
|
+
*/
|
|
11
|
+
export const DEV_LAUNCHER_MODULE = '@fabrika/app/dev'
|
|
12
|
+
|
|
13
|
+
/** Where the launcher records what it holds, so a restart of the same container resumes it. A new container has none. */
|
|
14
|
+
export const DEV_LAUNCHER_STATE_FILE = 'fabrika/dev-state.json'
|
|
15
|
+
|
|
16
|
+
/** One command of the build's check chain, run by the shell in the application root. */
|
|
17
|
+
export interface DevLauncherCheck {
|
|
18
|
+
readonly name: string
|
|
19
|
+
readonly command: string
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface DevLauncherConfig {
|
|
23
|
+
readonly format: 1
|
|
24
|
+
readonly appId: string
|
|
25
|
+
/** The commit the bootstrap run built: what a new container holds before its first sync. */
|
|
26
|
+
readonly head: string
|
|
27
|
+
/** The port the serving entry listens on (`PORT`). */
|
|
28
|
+
readonly port: number
|
|
29
|
+
/** The contract's health endpoint, which says when a respawned application serves. */
|
|
30
|
+
readonly healthPath: string
|
|
31
|
+
/** The serving entry, as an argument vector run in the application root. */
|
|
32
|
+
readonly serve: readonly string[]
|
|
33
|
+
/** `fabrika db migrate`, as an argument vector; it runs only with the provisioning credential. */
|
|
34
|
+
readonly migrate: readonly string[]
|
|
35
|
+
/** The authored SPA commands of the build, each run by the shell when a web source changed. */
|
|
36
|
+
readonly spaBuild: readonly string[]
|
|
37
|
+
/** The build's check chain, which `run_checks` asks for. */
|
|
38
|
+
readonly checks: readonly DevLauncherCheck[]
|
|
39
|
+
}
|
|
@@ -159,8 +159,11 @@ export function frameworkVariableReference(text: string): string | null {
|
|
|
159
159
|
return null
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
/**
|
|
163
|
-
|
|
162
|
+
/**
|
|
163
|
+
* The platform's receivers an application reaches over the platform transport: `mail`, the relay of its jobs' mail, and
|
|
164
|
+
* `source`, which hands the launcher of a `dev` environment the files of the workspace bound to it (ADR-0064).
|
|
165
|
+
*/
|
|
166
|
+
export const PLATFORM_RECEIVERS = ['mail', 'source'] as const
|
|
164
167
|
|
|
165
168
|
export type PlatformReceiver = (typeof PLATFORM_RECEIVERS)[number]
|
|
166
169
|
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The IAM application id of one environment of an application: `<app>@<env>`, for example `notes@prod`
|
|
3
|
+
* ([ADR-0022](../../../docs/decisions/0022-the-proxy-is-the-only-enforcement-point.md) rule 6). Schemas,
|
|
4
|
+
* roles, grants, keys and return origins are registered under it, so a staging key is refused at production.
|
|
5
|
+
* The installation's own services keep a plain id without `@` — the platform audiences IAM registers.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* The one name the IAM application id travels under, from the control plane to the application that
|
|
9
|
+
* verifies a token's `aud` against it. Platform-owned like `FABRIKA_IAM_ISSUER`: every deploy writes it,
|
|
10
|
+
* and an application that declares it for itself is refused.
|
|
11
|
+
*/
|
|
12
|
+
export declare const FABRIKA_IAM_APP_ID = "FABRIKA_IAM_APP_ID";
|
|
13
|
+
/** Separates the application from the environment. Reserved: neither part may contain it. */
|
|
14
|
+
export declare const APP_ENVIRONMENT_SEPARATOR = "@";
|
|
15
|
+
export interface AppEnvironment {
|
|
16
|
+
readonly app: string;
|
|
17
|
+
readonly env: string;
|
|
18
|
+
}
|
|
19
|
+
/** True when `value` can be one part of an application id: non-empty and without the separator. */
|
|
20
|
+
export declare function isAppEnvironmentPart(value: string): boolean;
|
|
21
|
+
/** Build `<app>@<env>`. Throws when either part is empty or contains `@`, because the id would not parse back. */
|
|
22
|
+
export declare function appEnvironmentId(app: string, env: string): string;
|
|
23
|
+
/** The parts of `<app>@<env>`, or null for any other string — a platform audience or a malformed id. */
|
|
24
|
+
export declare function parseAppEnvironmentId(id: string): AppEnvironment | null;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** A request target split into its raw pathname and its query (with the leading `?`, or empty). */
|
|
2
|
+
export interface RequestTarget {
|
|
3
|
+
readonly pathname: string;
|
|
4
|
+
readonly search: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* A raw pathname is canonical when it starts with `/` and has no empty segment, no `.` or `..` (also
|
|
8
|
+
* encoded), no encoded `/` or `\`, no literal `\` and no malformed percent escape. Each refused form is one
|
|
9
|
+
* some hop rewrites or rejects, so the gate matcher and the application would otherwise read different
|
|
10
|
+
* paths. A trailing `/` is allowed and significant: every matcher compares it literally, so `/a/` and `/a`
|
|
11
|
+
* are different paths.
|
|
12
|
+
*/
|
|
13
|
+
export declare function isCanonicalPath(pathname: string): boolean;
|
|
14
|
+
/** Split an origin-form request target (`/path?query`) at its first `?`. */
|
|
15
|
+
export declare function splitRequestTarget(target: string): RequestTarget;
|
|
16
|
+
/**
|
|
17
|
+
* The path and query of an absolute URL string exactly as written, without the fragment. Read it from
|
|
18
|
+
* the string because `new URL()` resolves dot segments and so hides the very paths that must be refused.
|
|
19
|
+
*/
|
|
20
|
+
export declare function rawRequestTarget(url: string): RequestTarget;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { BodyAdmission, ContractArtifact, OutputShape, SchemaShape, TableActionArtifact } from './contract';
|
|
2
|
+
/**
|
|
3
|
+
* The artifact with every array whose order carries no meaning sorted: endpoints by id, and every list of names.
|
|
4
|
+
* Tuple items and union options keep their order, because it changes what a schema admits. Object keys are left
|
|
5
|
+
* as they are; `canonicalArtifactJson` sorts them.
|
|
6
|
+
*/
|
|
7
|
+
export declare function canonicalizeArtifact(artifact: ContractArtifact): ContractArtifact;
|
|
8
|
+
/** The canonical artifact as JSON with every object's keys sorted: the bytes a digest of the artifact is taken over. */
|
|
9
|
+
export declare function canonicalArtifactJson(artifact: ContractArtifact): string;
|
|
10
|
+
/** JSON with every object's keys sorted. Arrays keep their order; canonicalize them first. */
|
|
11
|
+
export declare function canonicalJson(value: unknown): string;
|
|
12
|
+
/** Each action of one table operation, `[]` for none: how a reader of the artifact reads `actions.read` and the others. */
|
|
13
|
+
export declare function tableActions(actions: TableActionArtifact | null): readonly string[];
|
|
14
|
+
/** A body admission with its content types sorted. */
|
|
15
|
+
export declare function canonicalAdmission(admission: BodyAdmission): BodyAdmission;
|
|
16
|
+
/** An output shape: an attachment keeps its column order, which is the file's; each column's shape is canonical. */
|
|
17
|
+
export declare function canonicalOutput(shape: OutputShape): OutputShape;
|
|
18
|
+
/** A schema shape with its enum values sorted; tuple items and union options keep their order. */
|
|
19
|
+
export declare function canonicalShape(shape: SchemaShape): SchemaShape;
|