@tutti-os/auth-bridge 0.0.211 → 0.0.213

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 CHANGED
@@ -2,6 +2,21 @@
2
2
 
3
3
  High-level Tutti auth helpers for browser apps and Node/Electron clients.
4
4
 
5
+ ## Shared contract
6
+
7
+ Clients that implement their own platform-specific account UI can reuse the
8
+ canonical account defaults without importing Browser or Node runtime behavior:
9
+
10
+ ```ts
11
+ import {
12
+ DEFAULT_ACCOUNT_BASE_URL,
13
+ DEFAULT_APP_ID
14
+ } from "@tutti-os/auth-bridge/shared";
15
+ ```
16
+
17
+ Keep compatibility identifiers in this shared contract rather than copying
18
+ their literal values into product clients.
19
+
5
20
  ## Browser
6
21
 
7
22
  ```ts
package/dist/browser.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as TuttiUserInfo } from './shared-CPA5wTKA.js';
1
+ import { TuttiUserInfo } from './shared.js';
2
2
 
3
3
  interface TuttiBrowserAuthClientOptions {
4
4
  openUrl?: (url: string) => void;
package/dist/browser.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  buildAccountUrl,
6
6
  mapUserInfo,
7
7
  readEnvelopeError
8
- } from "./chunk-HC77YJ7C.js";
8
+ } from "./chunk-IJEP6SBI.js";
9
9
 
10
10
  // src/browser.ts
11
11
  function defaultOpenUrl(url) {
@@ -56,6 +56,7 @@ export {
56
56
  DEFAULT_LOGIN_MAX_TIMEOUT_MS,
57
57
  trimString,
58
58
  buildSessionCookie,
59
+ normalizeBaseUrl,
59
60
  buildAccountUrl,
60
61
  readEnvelopeError,
61
62
  mapUserInfo
package/dist/node.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { T as TuttiAuthSession, a as TuttiUserInfo } from './shared-CPA5wTKA.js';
1
+ import { TuttiAuthSession, TuttiUserInfo } from './shared.js';
2
2
 
3
3
  type TuttiAuthErrorCode = "user_cancelled";
4
4
  declare class TuttiAuthError extends Error {
package/dist/node.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  mapUserInfo,
14
14
  readEnvelopeError,
15
15
  trimString
16
- } from "./chunk-HC77YJ7C.js";
16
+ } from "./chunk-IJEP6SBI.js";
17
17
 
18
18
  // src/node.ts
19
19
  import { spawn } from "child_process";
@@ -0,0 +1,37 @@
1
+ declare const DEFAULT_APP_ID = "nextop";
2
+ declare const DEFAULT_ACCOUNT_BASE_URL = "https://tutti.sh/api/account";
3
+ declare const DEFAULT_AUTH_LOGIN_URL = "https://tutti.sh/auth/login";
4
+ declare const AUTH_SERVER_HOST = "127.0.0.1";
5
+ declare const AUTH_SERVER_BASE_PORT = 38473;
6
+ declare const AUTH_SERVER_MAX_PORT = 38492;
7
+ declare const DEFAULT_LOGIN_IDLE_TIMEOUT_MS = 90000;
8
+ declare const DEFAULT_LOGIN_MAX_TIMEOUT_MS: number;
9
+ interface TuttiUserInfo {
10
+ userId: string;
11
+ name?: string;
12
+ email?: string;
13
+ avatar?: string;
14
+ }
15
+ interface TuttiAuthSession {
16
+ sessionId: string;
17
+ cookie: string;
18
+ userId: string;
19
+ name: string;
20
+ avatar: string;
21
+ email: string;
22
+ updatedAt: number;
23
+ }
24
+ interface AccountEnvelope<T> {
25
+ code?: number;
26
+ errmsg?: string;
27
+ message?: string;
28
+ data?: T;
29
+ }
30
+ declare function trimString(value: unknown): string;
31
+ declare function buildSessionCookie(sessionId: string): string;
32
+ declare function normalizeBaseUrl(value: string): string;
33
+ declare function buildAccountUrl(accountBaseUrl: string, path: string): string;
34
+ declare function readEnvelopeError<T>(response: Response, payload: AccountEnvelope<T> | null): Error;
35
+ declare function mapUserInfo(data: Record<string, unknown> | undefined): TuttiUserInfo | null;
36
+
37
+ export { AUTH_SERVER_BASE_PORT, AUTH_SERVER_HOST, AUTH_SERVER_MAX_PORT, type AccountEnvelope, DEFAULT_ACCOUNT_BASE_URL, DEFAULT_APP_ID, DEFAULT_AUTH_LOGIN_URL, DEFAULT_LOGIN_IDLE_TIMEOUT_MS, DEFAULT_LOGIN_MAX_TIMEOUT_MS, type TuttiAuthSession, type TuttiUserInfo, buildAccountUrl, buildSessionCookie, mapUserInfo, normalizeBaseUrl, readEnvelopeError, trimString };
package/dist/shared.js ADDED
@@ -0,0 +1,32 @@
1
+ import {
2
+ AUTH_SERVER_BASE_PORT,
3
+ AUTH_SERVER_HOST,
4
+ AUTH_SERVER_MAX_PORT,
5
+ DEFAULT_ACCOUNT_BASE_URL,
6
+ DEFAULT_APP_ID,
7
+ DEFAULT_AUTH_LOGIN_URL,
8
+ DEFAULT_LOGIN_IDLE_TIMEOUT_MS,
9
+ DEFAULT_LOGIN_MAX_TIMEOUT_MS,
10
+ buildAccountUrl,
11
+ buildSessionCookie,
12
+ mapUserInfo,
13
+ normalizeBaseUrl,
14
+ readEnvelopeError,
15
+ trimString
16
+ } from "./chunk-IJEP6SBI.js";
17
+ export {
18
+ AUTH_SERVER_BASE_PORT,
19
+ AUTH_SERVER_HOST,
20
+ AUTH_SERVER_MAX_PORT,
21
+ DEFAULT_ACCOUNT_BASE_URL,
22
+ DEFAULT_APP_ID,
23
+ DEFAULT_AUTH_LOGIN_URL,
24
+ DEFAULT_LOGIN_IDLE_TIMEOUT_MS,
25
+ DEFAULT_LOGIN_MAX_TIMEOUT_MS,
26
+ buildAccountUrl,
27
+ buildSessionCookie,
28
+ mapUserInfo,
29
+ normalizeBaseUrl,
30
+ readEnvelopeError,
31
+ trimString
32
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tutti-os/auth-bridge",
3
- "version": "0.0.211",
3
+ "version": "0.0.213",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -17,6 +17,10 @@
17
17
  "./node": {
18
18
  "types": "./dist/node.d.ts",
19
19
  "import": "./dist/node.js"
20
+ },
21
+ "./shared": {
22
+ "types": "./dist/shared.d.ts",
23
+ "import": "./dist/shared.js"
20
24
  }
21
25
  },
22
26
  "files": [
@@ -1,17 +0,0 @@
1
- interface TuttiUserInfo {
2
- userId: string;
3
- name?: string;
4
- email?: string;
5
- avatar?: string;
6
- }
7
- interface TuttiAuthSession {
8
- sessionId: string;
9
- cookie: string;
10
- userId: string;
11
- name: string;
12
- avatar: string;
13
- email: string;
14
- updatedAt: number;
15
- }
16
-
17
- export type { TuttiAuthSession as T, TuttiUserInfo as a };