@fabrika/auth-core 0.9.0-dev.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/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.9.0-dev.
|
|
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,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;
|