@passflow/core 0.19.0 → 0.20.1

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.
Files changed (128) hide show
  1. package/dist/index.cjs +2 -2
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +5944 -0
  4. package/dist/index.d.ts +5944 -0
  5. package/dist/index.mjs +4618 -7244
  6. package/dist/index.mjs.map +1 -1
  7. package/package.json +38 -27
  8. package/dist/lib/api/app.d.ts +0 -11
  9. package/dist/lib/api/app.d.ts.map +0 -1
  10. package/dist/lib/api/auth.d.ts +0 -42
  11. package/dist/lib/api/auth.d.ts.map +0 -1
  12. package/dist/lib/api/axios-client.d.ts +0 -109
  13. package/dist/lib/api/axios-client.d.ts.map +0 -1
  14. package/dist/lib/api/cli-auth.d.ts +0 -12
  15. package/dist/lib/api/cli-auth.d.ts.map +0 -1
  16. package/dist/lib/api/index.d.ts +0 -11
  17. package/dist/lib/api/index.d.ts.map +0 -1
  18. package/dist/lib/api/invitation.d.ts +0 -80
  19. package/dist/lib/api/invitation.d.ts.map +0 -1
  20. package/dist/lib/api/model.d.ts +0 -844
  21. package/dist/lib/api/model.d.ts.map +0 -1
  22. package/dist/lib/api/setting.d.ts +0 -13
  23. package/dist/lib/api/setting.d.ts.map +0 -1
  24. package/dist/lib/api/tenant.d.ts +0 -216
  25. package/dist/lib/api/tenant.d.ts.map +0 -1
  26. package/dist/lib/api/two-factor.d.ts +0 -137
  27. package/dist/lib/api/two-factor.d.ts.map +0 -1
  28. package/dist/lib/api/upgrade.d.ts +0 -39
  29. package/dist/lib/api/upgrade.d.ts.map +0 -1
  30. package/dist/lib/api/user.d.ts +0 -22
  31. package/dist/lib/api/user.d.ts.map +0 -1
  32. package/dist/lib/constants/index.d.ts +0 -33
  33. package/dist/lib/constants/index.d.ts.map +0 -1
  34. package/dist/lib/device/index.d.ts +0 -17
  35. package/dist/lib/device/index.d.ts.map +0 -1
  36. package/dist/lib/index.d.ts +0 -23
  37. package/dist/lib/index.d.ts.map +0 -1
  38. package/dist/lib/interceptors/fetch-registry.d.ts +0 -96
  39. package/dist/lib/interceptors/fetch-registry.d.ts.map +0 -1
  40. package/dist/lib/m2m/client.d.ts +0 -196
  41. package/dist/lib/m2m/client.d.ts.map +0 -1
  42. package/dist/lib/m2m/errors.d.ts +0 -107
  43. package/dist/lib/m2m/errors.d.ts.map +0 -1
  44. package/dist/lib/m2m/index.d.ts +0 -27
  45. package/dist/lib/m2m/index.d.ts.map +0 -1
  46. package/dist/lib/m2m/types.d.ts +0 -217
  47. package/dist/lib/m2m/types.d.ts.map +0 -1
  48. package/dist/lib/passflow.d.ts +0 -1224
  49. package/dist/lib/passflow.d.ts.map +0 -1
  50. package/dist/lib/pkce.d.ts +0 -13
  51. package/dist/lib/pkce.d.ts.map +0 -1
  52. package/dist/lib/platform/index.d.ts +0 -4
  53. package/dist/lib/platform/index.d.ts.map +0 -1
  54. package/dist/lib/platform/types.d.ts +0 -206
  55. package/dist/lib/platform/types.d.ts.map +0 -1
  56. package/dist/lib/platform/web-adapter.d.ts +0 -104
  57. package/dist/lib/platform/web-adapter.d.ts.map +0 -1
  58. package/dist/lib/services/auth-service.d.ts +0 -197
  59. package/dist/lib/services/auth-service.d.ts.map +0 -1
  60. package/dist/lib/services/index.d.ts +0 -8
  61. package/dist/lib/services/index.d.ts.map +0 -1
  62. package/dist/lib/services/invitation-service.d.ts +0 -44
  63. package/dist/lib/services/invitation-service.d.ts.map +0 -1
  64. package/dist/lib/services/logger.d.ts +0 -24
  65. package/dist/lib/services/logger.d.ts.map +0 -1
  66. package/dist/lib/services/tenant-service.d.ts +0 -200
  67. package/dist/lib/services/tenant-service.d.ts.map +0 -1
  68. package/dist/lib/services/tenant-user-membership.d.ts +0 -76
  69. package/dist/lib/services/tenant-user-membership.d.ts.map +0 -1
  70. package/dist/lib/services/token-cache-service.d.ts +0 -36
  71. package/dist/lib/services/token-cache-service.d.ts.map +0 -1
  72. package/dist/lib/services/two-factor-service.d.ts +0 -193
  73. package/dist/lib/services/two-factor-service.d.ts.map +0 -1
  74. package/dist/lib/services/user-service.d.ts +0 -41
  75. package/dist/lib/services/user-service.d.ts.map +0 -1
  76. package/dist/lib/storage/index.d.ts +0 -106
  77. package/dist/lib/storage/index.d.ts.map +0 -1
  78. package/dist/lib/store.d.ts +0 -175
  79. package/dist/lib/store.d.ts.map +0 -1
  80. package/dist/lib/token/delivery-manager.d.ts +0 -121
  81. package/dist/lib/token/delivery-manager.d.ts.map +0 -1
  82. package/dist/lib/token/index.d.ts +0 -4
  83. package/dist/lib/token/index.d.ts.map +0 -1
  84. package/dist/lib/token/membership.d.ts +0 -37
  85. package/dist/lib/token/membership.d.ts.map +0 -1
  86. package/dist/lib/token/service.d.ts +0 -47
  87. package/dist/lib/token/service.d.ts.map +0 -1
  88. package/dist/lib/token/token.d.ts +0 -55
  89. package/dist/lib/token/token.d.ts.map +0 -1
  90. package/dist/lib/types/index.d.ts +0 -24
  91. package/dist/lib/types/index.d.ts.map +0 -1
  92. package/dist/lib/upgrade/acr.d.ts +0 -85
  93. package/dist/lib/upgrade/acr.d.ts.map +0 -1
  94. package/dist/lib/upgrade/axios-adapter.d.ts +0 -81
  95. package/dist/lib/upgrade/axios-adapter.d.ts.map +0 -1
  96. package/dist/lib/upgrade/challenge.d.ts +0 -217
  97. package/dist/lib/upgrade/challenge.d.ts.map +0 -1
  98. package/dist/lib/upgrade/client.d.ts +0 -29
  99. package/dist/lib/upgrade/client.d.ts.map +0 -1
  100. package/dist/lib/upgrade/controller.d.ts +0 -435
  101. package/dist/lib/upgrade/controller.d.ts.map +0 -1
  102. package/dist/lib/upgrade/core.d.ts +0 -353
  103. package/dist/lib/upgrade/core.d.ts.map +0 -1
  104. package/dist/lib/upgrade/errors.d.ts +0 -208
  105. package/dist/lib/upgrade/errors.d.ts.map +0 -1
  106. package/dist/lib/upgrade/facade.d.ts +0 -188
  107. package/dist/lib/upgrade/facade.d.ts.map +0 -1
  108. package/dist/lib/upgrade/factors.d.ts +0 -97
  109. package/dist/lib/upgrade/factors.d.ts.map +0 -1
  110. package/dist/lib/upgrade/fetch-adapter.d.ts +0 -30
  111. package/dist/lib/upgrade/fetch-adapter.d.ts.map +0 -1
  112. package/dist/lib/upgrade/index.d.ts +0 -20
  113. package/dist/lib/upgrade/index.d.ts.map +0 -1
  114. package/dist/lib/upgrade/markers.d.ts +0 -64
  115. package/dist/lib/upgrade/markers.d.ts.map +0 -1
  116. package/dist/lib/upgrade/replay.d.ts +0 -132
  117. package/dist/lib/upgrade/replay.d.ts.map +0 -1
  118. package/dist/lib/upgrade/select.d.ts +0 -48
  119. package/dist/lib/upgrade/select.d.ts.map +0 -1
  120. package/dist/lib/upgrade/session.d.ts +0 -72
  121. package/dist/lib/upgrade/session.d.ts.map +0 -1
  122. package/dist/lib/upgrade/snapshot.d.ts +0 -196
  123. package/dist/lib/upgrade/snapshot.d.ts.map +0 -1
  124. package/dist/lib/upgrade/transport.d.ts +0 -69
  125. package/dist/lib/upgrade/transport.d.ts.map +0 -1
  126. package/dist/lib/utils/validation.d.ts +0 -54
  127. package/dist/lib/utils/validation.d.ts.map +0 -1
  128. package/dist/tsconfig.build.tsbuildinfo +0 -1
package/package.json CHANGED
@@ -1,62 +1,69 @@
1
1
  {
2
2
  "name": "@passflow/core",
3
3
  "description": "Passflow JS SDK",
4
- "version": "0.19.0",
4
+ "version": "0.20.1",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
7
7
  "module": "./dist/index.mjs",
8
- "types": "./dist/lib/index.d.ts",
8
+ "types": "./dist/index.d.ts",
9
9
  "exports": {
10
10
  ".": {
11
11
  "import": {
12
- "types": "./dist/lib/index.d.ts",
12
+ "types": "./dist/index.d.ts",
13
13
  "default": "./dist/index.mjs"
14
14
  },
15
15
  "require": {
16
- "types": "./dist/lib/index.d.ts",
16
+ "types": "./dist/index.d.cts",
17
17
  "default": "./dist/index.cjs"
18
18
  }
19
19
  }
20
20
  },
21
- "files": ["dist"],
21
+ "files": [
22
+ "dist/index.mjs",
23
+ "dist/index.mjs.map",
24
+ "dist/index.cjs",
25
+ "dist/index.cjs.map",
26
+ "dist/index.d.ts",
27
+ "dist/index.d.cts"
28
+ ],
29
+ "engines": {
30
+ "node": "^22.12.0 || ^24.0.0 || >=26.0.0"
31
+ },
22
32
  "scripts": {
23
33
  "dev": "pnpm vite",
24
34
  "watch": "vite build --watch",
25
35
  "clean": "rm -rf dist tsconfig.tsbuildinfo",
26
- "build:dts": "tsc --build tsconfig.build.json",
36
+ "build:dts": "tsc -p tsconfig.build.json && rolldown -c rolldown.dts.config.mjs && rm -rf dist/.tsc",
27
37
  "build": "pnpm clean && pnpm vite build && pnpm build:dts",
28
38
  "test": "vitest run --reporter=default",
29
39
  "test:services": "vitest run tests/services",
30
40
  "test:coverage": "vitest run --coverage",
31
41
  "test:ui": "vitest --ui",
32
42
  "corpus:check": "node scripts/check-corpus.mjs",
43
+ "check:types-consumer": "node scripts/check-types-consumer.mjs",
33
44
  "lint": "biome check .",
34
- "lint:fix": "biome check . --apply",
45
+ "lint:fix": "biome check . --write",
35
46
  "format": "biome format . --write",
36
- "lint:format:fix": "biome check . --apply && biome format . --write",
47
+ "lint:format:fix": "biome check . --write && biome format . --write",
37
48
  "ci": "biome ci ."
38
49
  },
39
50
  "devDependencies": {
40
- "@babel/core": "^7.28.6",
41
- "@biomejs/biome": "1.9.4",
42
- "@types/node": "^25.0.9",
43
- "@types/sinon": "^17.0.4",
44
- "@types/uuid": "^10.0.0",
45
- "@vitejs/plugin-vue": "^5.2.4",
46
- "@vitest/coverage-v8": "^3.2.4",
47
- "@vitest/ui": "^3.2.4",
48
- "sinon": "^19.0.5",
49
- "typescript": "^5.9.3",
50
- "vite": "^6.4.1",
51
- "vite-tsconfig-paths": "^5.1.4",
52
- "vitest": "^3.2.4"
51
+ "@biomejs/biome": "2.6.4",
52
+ "@types/node": "^26.6.6",
53
+ "@vitest/coverage-v8": "^5.0.5",
54
+ "@vitest/ui": "^5.0.5",
55
+ "jsdom": "^30.1.3",
56
+ "rolldown": "~1.2.16",
57
+ "rolldown-plugin-dts": "~0.29.0",
58
+ "typescript": "^7.0.2",
59
+ "uuid": "^14.0.3",
60
+ "vite": "^8.3.5",
61
+ "vite-tsconfig-paths": "^6.1.1",
62
+ "vitest": "^5.0.5"
53
63
  },
54
64
  "dependencies": {
55
- "@simplewebauthn/browser": "^13.2.2",
56
- "@simplewebauthn/types": "^12.0.0",
57
- "axios": "^1.13.2",
58
- "dayjs": "^1.11.19",
59
- "uuid": "^11.1.0"
65
+ "@simplewebauthn/browser": "^14.0.0",
66
+ "axios": "^1.21.0"
60
67
  },
61
68
  "authors": [
62
69
  {
@@ -66,6 +73,10 @@
66
73
  {
67
74
  "name": "Nikita Kysil",
68
75
  "url": "https://github.com/mag-nikita-ks"
76
+ },
77
+ {
78
+ "name": "Jack Rudenko",
79
+ "email": "i@madappgang.com"
69
80
  }
70
81
  ],
71
82
  "license": "MIT",
@@ -76,5 +87,5 @@
76
87
  "type": "git",
77
88
  "url": "git+https://github.com/MadAppGang/passflow-js-sdk.git"
78
89
  },
79
- "packageManager": "pnpm@10.8.0"
90
+ "packageManager": "pnpm@12.16.1"
80
91
  }
@@ -1,11 +0,0 @@
1
- import { DeviceService } from '../device';
2
- import { StorageManager } from '../storage';
3
- import { AxiosClient } from './axios-client';
4
- import { type AppSettings, type PassflowConfig } from './model';
5
- export declare class AppAPI {
6
- protected axiosClient: AxiosClient;
7
- constructor(config: PassflowConfig, storageManager?: StorageManager, deviceService?: DeviceService);
8
- setAppId(appId: string): void;
9
- getAppSettings(): Promise<AppSettings>;
10
- }
11
- //# sourceMappingURL=app.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../lib/api/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,cAAc,EAAyB,MAAM,SAAS,CAAC;AAEvF,qBAAa,MAAM;IACjB,SAAS,CAAC,WAAW,EAAE,WAAW,CAAC;gBAEvB,MAAM,EAAE,cAAc,EAAE,cAAc,CAAC,EAAE,cAAc,EAAE,aAAa,CAAC,EAAE,aAAa;IAIlG,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAI7B,cAAc,IAAI,OAAO,CAAC,WAAW,CAAC;CAGvC"}
@@ -1,42 +0,0 @@
1
- import { AuthenticationResponseJSON, RegistrationResponseJSON } from '@simplewebauthn/types';
2
- import { DeviceService } from '../device';
3
- import { StorageManager } from '../storage';
4
- import { AxiosClient } from './axios-client';
5
- import { OS, PassflowAuthorizationResponse, PassflowConfig, PassflowLogoutResponse, PassflowPasskeyAuthenticateStartPayload, PassflowPasskeyRegisterStartPayload, PassflowPasskeyStart, PassflowPasswordlessResponse, PassflowPasswordlessSignInCompletePayload, PassflowPasswordlessSignInPayload, PassflowSendPasswordResetEmailPayload, PassflowSessionValidationResponse, PassflowSignInPayload, PassflowSignUpPayload, PassflowSuccessResponse, PassflowValidationResponse, UpgradeRefreshField } from './model';
6
- export declare class AuthAPI {
7
- protected axiosClient: AxiosClient;
8
- constructor(config: PassflowConfig, storageManager?: StorageManager, deviceService?: DeviceService);
9
- setAppId(appId: string): void;
10
- /**
11
- * Refreshes the session, optionally committing an assurance upgrade.
12
- *
13
- * `upgrade` carries `{type, assertion}` — the proof the user just produced.
14
- * The server scores the new `acr` from the durable session record plus the
15
- * verified factor and rotates the tokens, so this one endpoint is both the
16
- * refresh and the elevation.
17
- *
18
- * When `upgrade` is present the request is MARKED as part of the upgrade
19
- * transaction. The server answers a wrong code, a spent challenge, a foreign
20
- * session and an exhausted budget with a bare 401 carrying no RFC 9470
21
- * vocabulary, which is indistinguishable from an expired session on the
22
- * response alone; the marker is what tells the response interceptor not to
23
- * invalidate the session over a mistyped digit.
24
- */
25
- refreshToken(refreshToken: string, scopes: string[], accessToken?: string, upgrade?: UpgradeRefreshField): Promise<PassflowAuthorizationResponse>;
26
- signIn(payload: PassflowSignInPayload, deviceId: string, os: OS): Promise<PassflowAuthorizationResponse>;
27
- signUp(payload: PassflowSignUpPayload): Promise<PassflowAuthorizationResponse>;
28
- /** Redeems the code a PKCE sign-in answered with for the tokens it stands for. */
29
- pkceExchange(code: string, verifier: string): Promise<PassflowAuthorizationResponse>;
30
- passwordlessSignIn(payload: PassflowPasswordlessSignInPayload, deviceId: string, os: OS): Promise<PassflowPasswordlessResponse>;
31
- passwordlessSignInComplete(payload: PassflowPasswordlessSignInCompletePayload): Promise<PassflowValidationResponse>;
32
- logOut(deviceId?: string, refreshToken?: string, isAdmin?: boolean): Promise<PassflowLogoutResponse>;
33
- validateSession(): Promise<PassflowSessionValidationResponse>;
34
- sendPasswordResetEmail(payload: PassflowSendPasswordResetEmailPayload): Promise<PassflowSuccessResponse>;
35
- resetPassword(newPassword: string, scopes: string[], resetToken?: string, codeChallenge?: string): Promise<PassflowAuthorizationResponse>;
36
- passkeyRegisterStart(payload: PassflowPasskeyRegisterStartPayload, deviceId: string, os: OS, isAdmin?: boolean): Promise<PassflowPasskeyStart>;
37
- passkeyRegisterComplete(passkeyData: RegistrationResponseJSON, deviceId: string, challengeId: string, isAdmin?: boolean): Promise<PassflowAuthorizationResponse>;
38
- passkeyAuthenticateStart(payload: PassflowPasskeyAuthenticateStartPayload, deviceId: string, os: OS, isAdmin?: boolean): Promise<PassflowPasskeyStart>;
39
- passkeyAuthenticateComplete(passkeyData: AuthenticationResponseJSON, deviceId: string, challengeId: string, isAdmin?: boolean): Promise<PassflowAuthorizationResponse>;
40
- passkeyValidate(otp: string, deviceId: string, challengeId: string, isAdmin?: boolean, appId?: string): Promise<PassflowValidationResponse>;
41
- }
42
- //# sourceMappingURL=auth.d.ts.map
@@ -1 +0,0 @@
1
- {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E,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,OAAO,UAAQ,EACf,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,0BAA0B,CAAC;CAiBvC"}
@@ -1,109 +0,0 @@
1
- import { AxiosError, AxiosRequestConfig, AxiosResponse } from 'axios';
2
- import { DeviceService } from '../device';
3
- import { StorageManager } from '../storage';
4
- import { TokenService } from '../token';
5
- import { TokenDeliveryManager } from '../token/delivery-manager';
6
- import type { UpgradeChallenge } from '../upgrade/challenge';
7
- import { PassflowConfig, type UpgradeDomain } from './model';
8
- export declare enum HttpStatuses {
9
- badRequest = 400,
10
- unauthorized = 401,
11
- tooManyRequests = 429,
12
- internalServerError = 500,
13
- success = 200,
14
- created = 201
15
- }
16
- /**
17
- * Handles a challenge the Passflow instance itself received, resolving with a
18
- * replayed response once the session has been elevated.
19
- *
20
- * Consulted INSIDE the existing error interceptor rather than registered as a
21
- * later one: axios runs response interceptors FIFO and the handler below
22
- * converts the `AxiosError` into a `PassflowError`, which has no headers and no
23
- * config, so anything registered afterwards is structurally too late.
24
- */
25
- export type AxiosUpgradeHandler = (error: AxiosError, challenge: UpgradeChallenge) => Promise<AxiosResponse>;
26
- export declare class AxiosClient {
27
- private instance;
28
- protected storageManager: StorageManager;
29
- protected deviceService: DeviceService;
30
- protected tokenDeliveryManager: TokenDeliveryManager;
31
- private refreshPromise;
32
- private isRefreshing;
33
- private _platform;
34
- tokenService: TokenService;
35
- get origin(): string;
36
- url: string;
37
- appId?: string;
38
- protected defaultHeaders: Record<string, string>;
39
- private readonly nonAccessTokenEndpoints;
40
- /**
41
- * Endpoints under `/auth/` that DO need credentials.
42
- *
43
- * `'upgrade'` is here because `/auth/upgrade/start` is access-token-gated.
44
- * Without it the path matches `isNonAuthEndpoint()` and the request
45
- * interceptor returns before either the cookie-mode branch or the JSON-mode
46
- * token branch runs: no `Authorization`, no `withCredentials`, no CSRF token,
47
- * and a prepare round that 401s in every delivery mode.
48
- */
49
- private readonly protectedEndpoints;
50
- /** Set when a consumer wires the upgrade feature. Absent by default. */
51
- private upgradeHandler?;
52
- /**
53
- * Passflow's own API as an interception scope, resolved ONCE here from
54
- * `PassflowConfig.url` so no wrapper or adapter ever derives it. `null` when
55
- * no `url` was configured — see `resolveUpgradeDomain`.
56
- */
57
- readonly upgradeDomain: UpgradeDomain | null;
58
- constructor(config: PassflowConfig, storageManager?: StorageManager, deviceService?: DeviceService);
59
- /**
60
- * The `setSessionInvalid()` suppression predicate, keyed on the request that
61
- * failed and on the response that came back — never on "this response does not
62
- * speak upgrade vocabulary", which is unsound in both directions.
63
- */
64
- private isUpgradeTransactionError;
65
- /**
66
- * Installs (or clears) the handler consulted when a response carries an
67
- * upgrade challenge. Passing `undefined` detaches it.
68
- */
69
- setUpgradeInterceptor(handler: AxiosUpgradeHandler | undefined): void;
70
- /**
71
- * Re-issues a request after an elevation. Exposed for the upgrade handler,
72
- * which owns the replay-once decision; the marker preventing a second
73
- * elevation travels on the config the caller passes in.
74
- */
75
- replay<T = unknown>(config: AxiosRequestConfig): Promise<AxiosResponse<T>>;
76
- private isProtectedEndpoint;
77
- private isNonAuthEndpoint;
78
- /**
79
- * Detect if cookies are supported/enabled in the browser.
80
- * If cookie mode is already active (restored from storage) and cookies are not
81
- * supported, throws immediately to prevent silent misconfiguration.
82
- *
83
- * Note: If cookie mode is set later (e.g., server responds with token_delivery=cookie
84
- * on a non-cookie platform), this check will not catch it. The server should not
85
- * configure cookie mode for platforms where cookiesSupported() returns false.
86
- */
87
- private detectCookieSupport;
88
- /**
89
- * Refresh tokens using single-flight pattern to prevent race conditions
90
- * Supports both cookie mode and JSON mode
91
- */
92
- private refreshTokens;
93
- private handleRateLimitError;
94
- private handleAxiosError;
95
- private send;
96
- get<T>(path: string, config?: AxiosRequestConfig): Promise<T>;
97
- post<T, D>(path: string, data?: D, config?: AxiosRequestConfig): Promise<T>;
98
- put<T, D>(path: string, data?: D, config?: AxiosRequestConfig): Promise<T>;
99
- patch<T, D>(path: string, data?: D, config?: AxiosRequestConfig): Promise<T>;
100
- delete<T>(path: string, config?: AxiosRequestConfig): Promise<T>;
101
- /**
102
- * Update the appId and propagate it to axios headers.
103
- * This ensures that the APP_ID_HEADER_KEY is updated in all future requests.
104
- *
105
- * @param appId - The new application ID to set
106
- */
107
- setAppId(appId: string): void;
108
- }
109
- //# sourceMappingURL=axios-client.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"axios-client.d.ts","sourceRoot":"","sources":["../../../lib/api/axios-client.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,UAAU,EAAiB,kBAAkB,EAAE,aAAa,EAA8B,MAAM,OAAO,CAAC;AAUxH,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAG1C,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,YAAY,EAA8B,MAAM,UAAU,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAI7D,OAAO,EAEL,cAAc,EAMd,KAAK,aAAa,EAEnB,MAAM,SAAS,CAAC;AAEjB,oBAAY,YAAY;IACtB,UAAU,MAAM;IAChB,YAAY,MAAM;IAClB,eAAe,MAAM;IACrB,mBAAmB,MAAM;IACzB,OAAO,MAAM;IACb,OAAO,MAAM;CACd;AAuBD;;;;;;;;GAQG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,gBAAgB,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;AAE7G,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAgB;IAChC,SAAS,CAAC,cAAc,EAAE,cAAc,CAAC;IACzC,SAAS,CAAC,aAAa,EAAE,aAAa,CAAC;IACvC,SAAS,CAAC,oBAAoB,EAAE,oBAAoB,CAAC;IACrD,OAAO,C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E,CAAC,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,CAAC,CAAC;IAI3E,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,CAAC,CAAC;IAI1E,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,CAAC,CAAC;IAI5E,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,CAAC,CAAC;IAIhE;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;CAY9B"}
@@ -1,12 +0,0 @@
1
- import { DeviceService } from '../device';
2
- import { StorageManager } from '../storage';
3
- import { AxiosClient } from './axios-client';
4
- import { CLIAuthCompleteRequest, CLIAuthStatusResponse, PassflowConfig } from './model';
5
- export declare class CLIAuthAPI {
6
- protected axiosClient: AxiosClient;
7
- constructor(config: PassflowConfig, storageManager?: StorageManager, deviceService?: DeviceService);
8
- setAppId(appId: string): void;
9
- getCLIAuthStatus(sessionId: string): Promise<CLIAuthStatusResponse>;
10
- completeCLIAuth(request: CLIAuthCompleteRequest): Promise<void>;
11
- }
12
- //# sourceMappingURL=cli-auth.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cli-auth.d.ts","sourceRoot":"","sources":["../../../lib/api/cli-auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,cAAc,EAAyC,MAAM,SAAS,CAAC;AAE/H,qBAAa,UAAU;IACrB,SAAS,CAAC,WAAW,EAAE,WAAW,CAAC;gBAEvB,MAAM,EAAE,cAAc,EAAE,cAAc,CAAC,EAAE,cAAc,EAAE,aAAa,CAAC,EAAE,aAAa;IAIlG,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAI7B,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAKnE,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;CAGhE"}
@@ -1,11 +0,0 @@
1
- export * from './app';
2
- export * from './auth';
3
- export * from './cli-auth';
4
- export * from './invitation';
5
- export * from './model';
6
- export * from './setting';
7
- export * from './tenant';
8
- export * from './two-factor';
9
- export * from './upgrade';
10
- export * from './user';
11
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC"}
@@ -1,80 +0,0 @@
1
- import { DeviceService } from '../device';
2
- import { StorageManager } from '../storage';
3
- import { AxiosClient } from './axios-client';
4
- import { type PassflowConfig, type PassflowSuccessResponse } from './model';
5
- export interface RequestInviteLinkPayload {
6
- email?: string;
7
- tenant?: string;
8
- group?: string;
9
- role?: string;
10
- callback?: string;
11
- send_to_email?: boolean;
12
- data?: Record<string, unknown>;
13
- }
14
- export interface InviteLinkResponse {
15
- link: string;
16
- token?: string;
17
- }
18
- export interface Invitation {
19
- id: string;
20
- archived?: boolean;
21
- app_id: string;
22
- inviter_id: string;
23
- inviter_name: string;
24
- token: string;
25
- email?: string;
26
- role?: string;
27
- tenant?: string;
28
- tenant_name?: string;
29
- group?: string;
30
- created_by?: string;
31
- created_at: string;
32
- expires_at: string;
33
- callback?: string;
34
- data?: Record<string, unknown>;
35
- }
36
- export interface InvitationsPaginatedList {
37
- invites: Invitation[];
38
- nextPageSkip?: string;
39
- }
40
- export declare class InvitationAPI {
41
- protected axiosClient: AxiosClient;
42
- constructor(config: PassflowConfig, storageManager?: StorageManager, deviceService?: DeviceService);
43
- setAppId(appId: string): void;
44
- /**
45
- * Requests an invitation link that can be used to invite users
46
- * @param payload Request invitation payload
47
- * @returns Promise with invitation link and token
48
- */
49
- requestInviteLink(payload: RequestInviteLinkPayload): Promise<InviteLinkResponse>;
50
- /**
51
- * Gets a list of active invitations
52
- * @param options Optional parameters for filtering and pagination
53
- * @returns Promise with paginated list of invitations
54
- */
55
- getInvitations(options: {
56
- tenantID: string;
57
- groupID?: string;
58
- skip?: number | string;
59
- limit?: number | string;
60
- }): Promise<InvitationsPaginatedList>;
61
- /**
62
- * Deletes an invitation by token
63
- * @param invitationID The invitation ID to delete
64
- * @returns Promise with success response
65
- */
66
- deleteInvitation(invitationID: string): Promise<PassflowSuccessResponse>;
67
- /**
68
- * Resend an invitation by token
69
- * @param invitationID The invitation ID to resend
70
- * @returns Promise with success response
71
- */
72
- resendInvitation(invitationID: string): Promise<PassflowSuccessResponse>;
73
- /**
74
- * Get a link to an invitation by id
75
- * @param invitationID The invitation ID to get link
76
- * @returns Promise with the link
77
- */
78
- getInvitationLink(invitationID: string): Promise<InviteLinkResponse>;
79
- }
80
- //# sourceMappingURL=invitation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"invitation.d.ts","sourceRoot":"","sources":["../../../lib/api/invitation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EA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