@astram/frontend-core 0.1.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/LICENSE +21 -0
- package/dist/auth/accountService.d.ts +112 -0
- package/dist/auth/accountService.d.ts.map +1 -0
- package/dist/auth/accountService.js +210 -0
- package/dist/auth/accountService.js.map +1 -0
- package/dist/auth/auditService.d.ts +45 -0
- package/dist/auth/auditService.d.ts.map +1 -0
- package/dist/auth/auditService.js +58 -0
- package/dist/auth/auditService.js.map +1 -0
- package/dist/auth/authService.d.ts +96 -0
- package/dist/auth/authService.d.ts.map +1 -0
- package/dist/auth/authService.js +121 -0
- package/dist/auth/authService.js.map +1 -0
- package/dist/auth/identityService.d.ts +199 -0
- package/dist/auth/identityService.d.ts.map +1 -0
- package/dist/auth/identityService.js +374 -0
- package/dist/auth/identityService.js.map +1 -0
- package/dist/auth/index.d.ts +13 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +13 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/returnPath.d.ts +23 -0
- package/dist/auth/returnPath.d.ts.map +1 -0
- package/dist/auth/returnPath.js +95 -0
- package/dist/auth/returnPath.js.map +1 -0
- package/dist/auth/session.d.ts +38 -0
- package/dist/auth/session.d.ts.map +1 -0
- package/dist/auth/session.js +23 -0
- package/dist/auth/session.js.map +1 -0
- package/dist/http/types.d.ts +33 -0
- package/dist/http/types.d.ts.map +1 -0
- package/dist/http/types.js +10 -0
- package/dist/http/types.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/package.json +33 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The HTTP client CONTRACT the frontend logic depends on. Each platform provides an
|
|
3
|
+
* implementation (web: fetch; mobile: fetch/axios) and INJECTS it — the logic never
|
|
4
|
+
* imports fetch or any platform HTTP API. Both methods resolve to a uniform
|
|
5
|
+
* {@link HttpResponse} and NEVER throw for an HTTP error status (a 401/500 is a normal
|
|
6
|
+
* resolved response); they resolve with `{ ok: false, status: 0 }` only for a true
|
|
7
|
+
* transport failure (no connection).
|
|
8
|
+
*/
|
|
9
|
+
/** A uniform HTTP response. `status: 0` means transport failure / no response. */
|
|
10
|
+
export interface HttpResponse {
|
|
11
|
+
/** res.ok (2xx). */
|
|
12
|
+
readonly ok: boolean;
|
|
13
|
+
/** HTTP status (0 = transport failure / no response). */
|
|
14
|
+
readonly status: number;
|
|
15
|
+
/** Parsed JSON body, or null (e.g. 204 / non-JSON). */
|
|
16
|
+
readonly data: unknown;
|
|
17
|
+
}
|
|
18
|
+
/** Per-request options. */
|
|
19
|
+
export interface RequestOpts {
|
|
20
|
+
/** Sent as `Authorization: Bearer <token>` when present. */
|
|
21
|
+
readonly bearerToken?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The injected HTTP client. The consuming app implements this (web: fetch-based).
|
|
25
|
+
*/
|
|
26
|
+
export interface HttpClient {
|
|
27
|
+
post(path: string, body: unknown, opts?: RequestOpts): Promise<HttpResponse>;
|
|
28
|
+
patch(path: string, body: unknown, opts?: RequestOpts): Promise<HttpResponse>;
|
|
29
|
+
put(path: string, body: unknown, opts?: RequestOpts): Promise<HttpResponse>;
|
|
30
|
+
delete(path: string, body: unknown, opts?: RequestOpts): Promise<HttpResponse>;
|
|
31
|
+
get(path: string, opts?: RequestOpts): Promise<HttpResponse>;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/http/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,kFAAkF;AAClF,MAAM,WAAW,YAAY;IAC3B,oBAAoB;IACpB,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IACrB,yDAAyD;IACzD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,uDAAuD;IACvD,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;CACxB;AAED,2BAA2B;AAC3B,MAAM,WAAW,WAAW;IAC1B,4DAA4D;IAC5D,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAC7E,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAC9E,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAC5E,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAC/E,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CAC9D"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The HTTP client CONTRACT the frontend logic depends on. Each platform provides an
|
|
3
|
+
* implementation (web: fetch; mobile: fetch/axios) and INJECTS it — the logic never
|
|
4
|
+
* imports fetch or any platform HTTP API. Both methods resolve to a uniform
|
|
5
|
+
* {@link HttpResponse} and NEVER throw for an HTTP error status (a 401/500 is a normal
|
|
6
|
+
* resolved response); they resolve with `{ ok: false, status: 0 }` only for a true
|
|
7
|
+
* transport failure (no connection).
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/http/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC7E,cAAc,iBAAiB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,cAAc,iBAAiB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@astram/frontend-core",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"description": "Astram framework — the frontend logic core. Platform-agnostic auth + identity SERVICES over an injected HTTP client (no React/DOM/fetch/storage baked in): login, MFA, profile, companies/users/roles/membership CRUD, audit. The frontend half of the framework's identity contract; consumed by the scaffolded identity UI.",
|
|
9
|
+
"type": "module",
|
|
10
|
+
"main": "./dist/index.js",
|
|
11
|
+
"module": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.js"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist"
|
|
21
|
+
],
|
|
22
|
+
"dependencies": {},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"typescript": "^5.7.0",
|
|
25
|
+
"vitest": "^2.1.0"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "tsc -p tsconfig.json",
|
|
29
|
+
"lint": "eslint .",
|
|
30
|
+
"test": "vitest run",
|
|
31
|
+
"test:watch": "vitest"
|
|
32
|
+
}
|
|
33
|
+
}
|