@epam/ai-dial-chat-hooks 1.2.5 → 1.3.0-dev.102
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/catalog/catalog-derivations.d.ts +1 -1
- package/catalog/catalog-derivations.d.ts.map +1 -1
- package/catalog/catalog-derivations.js +1 -1
- package/catalog/useCatalogEditNavigation/useCatalogEditNavigation.d.ts +8 -1
- package/catalog/useCatalogEditNavigation/useCatalogEditNavigation.d.ts.map +1 -1
- package/catalog/useCatalogEditNavigation/useCatalogEditNavigation.js +57 -38
- package/conversation/conversation-draft/conversation-draft-store.d.ts +21 -0
- package/conversation/conversation-draft/conversation-draft-store.d.ts.map +1 -0
- package/conversation/conversation-draft/conversation-draft-store.js +84 -0
- package/conversation/conversation-draft/conversation-draft.d.ts +48 -0
- package/conversation/conversation-draft/conversation-draft.d.ts.map +1 -0
- package/conversation/create-chat-stream-api.d.ts +6 -0
- package/conversation/create-chat-stream-api.d.ts.map +1 -1
- package/conversation/create-chat-stream-api.js +28 -23
- package/conversation/useConversationComposerDraft/useConversationComposerDraft.d.ts +39 -0
- package/conversation/useConversationComposerDraft/useConversationComposerDraft.d.ts.map +1 -0
- package/conversation/useConversationComposerDraft/useConversationComposerDraft.js +132 -0
- package/conversation/useConversationStream/useConversationStream.d.ts.map +1 -1
- package/conversation/useConversationStream/useConversationStream.js +233 -219
- package/conversation.js +34 -32
- package/entry-points/conversation.d.ts +3 -0
- package/entry-points/conversation.d.ts.map +1 -1
- package/entry-points/offline-credentials.d.ts +5 -0
- package/entry-points/offline-credentials.d.ts.map +1 -0
- package/entry-points/scheduled-tasks.d.ts +1 -0
- package/entry-points/scheduled-tasks.d.ts.map +1 -1
- package/file-manager.js +21 -21
- package/files/dial-file-manager-mapping.util.d.ts +17 -1
- package/files/dial-file-manager-mapping.util.d.ts.map +1 -1
- package/files/dial-file-manager-mapping.util.js +77 -62
- package/files/useDialFileListing/useDialFileListing.d.ts.map +1 -1
- package/files/useDialFileListing/useDialFileListing.js +56 -53
- package/files/useDialFileMutations/useDialFileMutations.d.ts.map +1 -1
- package/files/useDialFileMutations/useDialFileMutations.js +206 -204
- package/index.d.ts +8 -0
- package/index.d.ts.map +1 -1
- package/index.js +131 -124
- package/mcp-apps/mcp-apps-api-client.d.ts.map +1 -1
- package/mcp-apps/mcp-apps-api-client.js +18 -17
- package/mcp-apps/useMcpAppTools/useMcpAppTools.d.ts.map +1 -1
- package/mcp-apps/useMcpAppTools/useMcpAppTools.js +29 -29
- package/oauth/popup.d.ts.map +1 -1
- package/oauth/popup.js +19 -17
- package/oauth/useOAuthCallbackCompletion/useOAuthCallbackCompletion.d.ts.map +1 -1
- package/oauth/useOAuthCallbackCompletion/useOAuthCallbackCompletion.js +40 -38
- package/offline-credentials/map-offline-credentials-response.d.ts +17 -0
- package/offline-credentials/map-offline-credentials-response.d.ts.map +1 -0
- package/offline-credentials/map-offline-credentials-response.js +15 -0
- package/offline-credentials/useOfflineCredentialsAuth/useOfflineCredentialsAuth.d.ts +58 -0
- package/offline-credentials/useOfflineCredentialsAuth/useOfflineCredentialsAuth.d.ts.map +1 -0
- package/offline-credentials/useOfflineCredentialsAuth/useOfflineCredentialsAuth.js +37 -0
- package/offline-credentials/useOfflineCredentialsGate/useOfflineCredentialsGate.d.ts +57 -0
- package/offline-credentials/useOfflineCredentialsGate/useOfflineCredentialsGate.d.ts.map +1 -0
- package/offline-credentials/useOfflineCredentialsGate/useOfflineCredentialsGate.js +34 -0
- package/offline-credentials/useOfflineCredentialsLogin/useOfflineCredentialsLogin.d.ts +28 -0
- package/offline-credentials/useOfflineCredentialsLogin/useOfflineCredentialsLogin.d.ts.map +1 -0
- package/offline-credentials/useOfflineCredentialsLogin/useOfflineCredentialsLogin.js +29 -0
- package/offline-credentials.d.ts +2 -0
- package/offline-credentials.js +5 -0
- package/package.json +23 -18
- package/scheduled-task/check-scheduled-task-auth-session-error.d.ts +27 -0
- package/scheduled-task/check-scheduled-task-auth-session-error.d.ts.map +1 -0
- package/scheduled-task/check-scheduled-task-auth-session-error.js +17 -0
- package/scheduled-tasks.js +2 -1
- package/shared/application-schema.d.ts +0 -2
- package/shared/application-schema.d.ts.map +1 -1
- package/shared/application-schema.js +2 -2
- package/useShareLink/useShareLink.d.ts.map +1 -1
- package/useShareLink/useShareLink.js +1 -0
- package/utils.js +10 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOAuthCallbackCompletion.d.ts","sourceRoot":"","sources":["../../../src/oauth/useOAuthCallbackCompletion/useOAuthCallbackCompletion.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useOAuthCallbackCompletion.d.ts","sourceRoot":"","sources":["../../../src/oauth/useOAuthCallbackCompletion/useOAuthCallbackCompletion.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAGV,oBAAoB,EACrB,MAAM,WAAW,CAAC;AACnB,OAAO,EAEL,uBAAuB,EAGvB,yBAAyB,EAE1B,MAAM,UAAU,CAAC;AAIlB,wDAAwD;AACxD,MAAM,WAAW,mBAAmB;IAClC,yDAAyD;IACzD,IAAI,EAAE,MAAM,CAAC;IACb,kFAAkF;IAClF,WAAW,EAAE,MAAM,CAAC;IACpB,iEAAiE;IACjE,gBAAgB,EAAE,uBAAuB,CAAC;IAC1C,iFAAiF;IACjF,aAAa,EAAE,oBAAoB,CAAC;CACrC;AAED,yDAAyD;AACzD,MAAM,WAAW,gCAAgC;IAC/C;;;OAGG;IACH,YAAY,EAAE,eAAe,CAAC;IAC9B;;;;OAIG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,QAAQ,EAAE,CACR,MAAM,EAAE,mBAAmB,KACxB,OAAO,CAAC,yBAAyB,GAAG,IAAI,CAAC,CAAC;CAChD;AAED,oFAAoF;AACpF,MAAM,WAAW,gCAAgC;IAC/C,mDAAmD;IACnD,YAAY,EAAE,OAAO,CAAC;IACtB,yEAAyE;IACzE,aAAa,EAAE,yBAAyB,GAAG,IAAI,CAAC;CACjD;AAqFD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,0BAA0B,GAAI,2CAIxC,gCAAgC,KAAG,gCAqGrC,CAAC"}
|
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
import { TOOLSET_REDIRECT_STATE_KEY as e, ToolsetCredentialsLevel as t, ToolsetOAuthCallbackQuery as n, ToolsetOAuthChannelControlType as r, ToolsetOAuthFailureReason as i, ToolsetOAuthResultType as a } from "../types.js";
|
|
2
2
|
import { getToolsetOAuthChannelName as o } from "../handshake.js";
|
|
3
|
-
import {
|
|
3
|
+
import { decodeJsonFromBase64 as s } from "@epam/ai-dial-chat-shared";
|
|
4
|
+
import { useEffect as c, useRef as l, useState as u } from "react";
|
|
4
5
|
//#region src/oauth/useOAuthCallbackCompletion/useOAuthCallbackCompletion.ts
|
|
5
|
-
var
|
|
6
|
+
var d = 500, f = (e) => typeof e == "object" && !!e && "type" in e && e.type === r.ResultAcknowledged, p = () => {
|
|
6
7
|
let t = sessionStorage.getItem(e);
|
|
7
8
|
if (!t) return null;
|
|
8
9
|
try {
|
|
9
|
-
return
|
|
10
|
+
return s(t);
|
|
10
11
|
} catch {
|
|
11
|
-
|
|
12
|
+
try {
|
|
13
|
+
return JSON.parse(t);
|
|
14
|
+
} catch {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
12
17
|
}
|
|
13
|
-
},
|
|
18
|
+
}, m = (e) => {
|
|
14
19
|
try {
|
|
15
20
|
window.history.replaceState({}, document.title, `${e.pathname}${e.search}`);
|
|
16
21
|
} catch {}
|
|
17
|
-
},
|
|
22
|
+
}, h = (e, t) => {
|
|
18
23
|
let r = new URL(window.location.pathname, window.location.origin);
|
|
19
|
-
if (r.searchParams.set(n.Result, t.type), t.type === a.Failure && r.searchParams.set(n.FailureReason, t.reason),
|
|
24
|
+
if (r.searchParams.set(n.Result, t.type), t.type === a.Failure && r.searchParams.set(n.FailureReason, t.reason), m(r), !e) {
|
|
20
25
|
window.close();
|
|
21
26
|
return;
|
|
22
27
|
}
|
|
@@ -25,70 +30,67 @@ var u = 500, d = (e) => typeof e == "object" && !!e && "type" in e && e.type ===
|
|
|
25
30
|
n.postMessage(t);
|
|
26
31
|
let r = setInterval(() => {
|
|
27
32
|
n.postMessage(t);
|
|
28
|
-
},
|
|
33
|
+
}, d);
|
|
29
34
|
n.onmessage = (e) => {
|
|
30
|
-
|
|
35
|
+
f(e.data) && (clearInterval(r), n.close(), window.close());
|
|
31
36
|
};
|
|
32
37
|
} catch {}
|
|
33
|
-
},
|
|
34
|
-
let [
|
|
38
|
+
}, g = ({ searchParams: n, callbackPath: r, exchange: o }) => {
|
|
39
|
+
let [s, d] = u(!0), [f, g] = u(null), _ = l(!1), v = l(o);
|
|
35
40
|
v.current = o;
|
|
36
|
-
let y =
|
|
37
|
-
return y.current = r,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
let r = (e, t) => {
|
|
41
|
-
m(e, t), d(!1), g(t.type === a.Failure ? t.reason : null);
|
|
42
|
-
};
|
|
43
|
-
(async () => {
|
|
44
|
-
let o = n.get("code"), s = n.get("state"), c = f();
|
|
41
|
+
let y = l(r);
|
|
42
|
+
return y.current = r, c(() => {
|
|
43
|
+
_.current || (_.current = !0, (async () => {
|
|
44
|
+
let r = n.get("code"), o = n.get("state"), s = p();
|
|
45
45
|
sessionStorage.removeItem(e);
|
|
46
|
-
let
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
let c = s?.state ?? o ?? void 0, l = (e, t) => {
|
|
47
|
+
h(e, t), d(!1), g(t.type === a.Failure ? t.reason : null);
|
|
48
|
+
};
|
|
49
|
+
if (m(new URL(window.location.pathname, window.location.origin)), !r || !s?.toolsetId) {
|
|
50
|
+
l(c, {
|
|
49
51
|
type: a.Failure,
|
|
50
|
-
reason:
|
|
52
|
+
reason: s?.toolsetId ? i.MissingCode : i.MissingRedirectState
|
|
51
53
|
});
|
|
52
54
|
return;
|
|
53
55
|
}
|
|
54
|
-
if (
|
|
55
|
-
|
|
56
|
+
if (s.state != null && s.state !== o) {
|
|
57
|
+
l(c, {
|
|
56
58
|
type: a.Failure,
|
|
57
59
|
reason: i.StateMismatch
|
|
58
60
|
});
|
|
59
61
|
return;
|
|
60
62
|
}
|
|
61
|
-
let u =
|
|
63
|
+
let u = s.credentialsLevel ?? t.User, f = s.redirectUri ?? `${window.location.origin}${y.current}`;
|
|
62
64
|
try {
|
|
63
65
|
let e = await v.current({
|
|
64
|
-
code:
|
|
65
|
-
redirectUri:
|
|
66
|
+
code: r,
|
|
67
|
+
redirectUri: f,
|
|
66
68
|
credentialsLevel: u,
|
|
67
|
-
redirectState:
|
|
69
|
+
redirectState: s
|
|
68
70
|
});
|
|
69
71
|
if (e != null) {
|
|
70
|
-
|
|
72
|
+
l(c, {
|
|
71
73
|
type: a.Failure,
|
|
72
74
|
reason: e
|
|
73
75
|
});
|
|
74
76
|
return;
|
|
75
77
|
}
|
|
76
|
-
|
|
78
|
+
l(c, {
|
|
77
79
|
type: a.Success,
|
|
78
|
-
toolsetId:
|
|
80
|
+
toolsetId: s.toolsetId,
|
|
79
81
|
credentialsLevel: u
|
|
80
82
|
});
|
|
81
83
|
} catch {
|
|
82
|
-
|
|
84
|
+
l(c, {
|
|
83
85
|
type: a.Failure,
|
|
84
86
|
reason: i.LoginRequestFailed
|
|
85
87
|
});
|
|
86
88
|
}
|
|
87
|
-
})();
|
|
89
|
+
})());
|
|
88
90
|
}, [n]), {
|
|
89
|
-
isInProgress:
|
|
90
|
-
failureReason:
|
|
91
|
+
isInProgress: s,
|
|
92
|
+
failureReason: f
|
|
91
93
|
};
|
|
92
94
|
};
|
|
93
95
|
//#endregion
|
|
94
|
-
export {
|
|
96
|
+
export { g as useOAuthCallbackCompletion };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { GetOfflineCredentialsResponseDto, OfflineCredentialsConnectDto } from '@epam/ai-dial-chat-api-client';
|
|
2
|
+
import { OfflineCredentialsConnectSettings, OfflineCredentialsStatusResult } from './useOfflineCredentialsGate/useOfflineCredentialsGate';
|
|
3
|
+
/**
|
|
4
|
+
* Normalizes the response's `connect` object into login-usable OAuth client
|
|
5
|
+
* settings — present only when its `clientId` and `authorizationEndpoint`
|
|
6
|
+
* are both set; `scopes` defaults to an empty list.
|
|
7
|
+
*/
|
|
8
|
+
export declare const normalizeOfflineCredentialsConnectSettings: (connect?: OfflineCredentialsConnectDto) => OfflineCredentialsConnectSettings | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Normalizes a `getOfflineCredentials` response into the shared
|
|
11
|
+
* `OfflineCredentialsStatusResult`: the `available`/`connected` flags
|
|
12
|
+
* null-coalesced to `false`, and OAuth client settings present only when a
|
|
13
|
+
* login is possible — the service is available and disconnected, and the
|
|
14
|
+
* response's `connect` object is complete enough to drive one.
|
|
15
|
+
*/
|
|
16
|
+
export declare const mapOfflineCredentialsResponse: (response: GetOfflineCredentialsResponseDto) => OfflineCredentialsStatusResult;
|
|
17
|
+
//# sourceMappingURL=map-offline-credentials-response.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map-offline-credentials-response.d.ts","sourceRoot":"","sources":["../../src/offline-credentials/map-offline-credentials-response.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gCAAgC,EAChC,4BAA4B,EAC7B,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EACV,iCAAiC,EACjC,8BAA8B,EAC/B,MAAM,uDAAuD,CAAC;AAE/D;;;;GAIG;AACH,eAAO,MAAM,0CAA0C,GACrD,UAAU,4BAA4B,KACrC,iCAAiC,GAAG,SAOxB,CAAC;AAEhB;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B,GACxC,UAAU,gCAAgC,KACzC,8BAYF,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/offline-credentials/map-offline-credentials-response.ts
|
|
2
|
+
var e = (e) => e?.clientId != null && e?.authorizationEndpoint != null ? {
|
|
3
|
+
clientId: e.clientId,
|
|
4
|
+
authorizationEndpoint: e.authorizationEndpoint,
|
|
5
|
+
scopes: e.scopes ?? []
|
|
6
|
+
} : void 0, t = (t) => {
|
|
7
|
+
let n = t.available ?? !1, r = t.connected ?? !1;
|
|
8
|
+
return {
|
|
9
|
+
available: n,
|
|
10
|
+
connected: r,
|
|
11
|
+
connect: n && !r ? e(t.connect) : void 0
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
//#endregion
|
|
15
|
+
export { t as mapOfflineCredentialsResponse, e as normalizeOfflineCredentialsConnectSettings };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { OfflineCredentialsApi } from '@epam/ai-dial-chat-api-client';
|
|
2
|
+
import { OfflineCredentialsConnectSettings, OfflineCredentialsStatusResult } from '../useOfflineCredentialsGate/useOfflineCredentialsGate';
|
|
3
|
+
import { OfflineCredentialsLoginOutcomeType } from '../useOfflineCredentialsLogin/useOfflineCredentialsLogin';
|
|
4
|
+
/** Terminal outcome kinds `logOut` can resolve. */
|
|
5
|
+
export declare enum OfflineCredentialsLogoutOutcomeType {
|
|
6
|
+
/** The sign-out request succeeded and a fresh status refetch confirmed `connected: false`. */
|
|
7
|
+
Disconnected = "disconnected",
|
|
8
|
+
/** The sign-out request succeeded but the fresh refetch still reported a connection (or failed to resolve). */
|
|
9
|
+
NotDisconnected = "not-disconnected",
|
|
10
|
+
/** The sign-out request itself failed. */
|
|
11
|
+
Failed = "failed"
|
|
12
|
+
}
|
|
13
|
+
/** The slice of `useOfflineCredentialsGate` the auth flow drives and observes. */
|
|
14
|
+
export interface OfflineCredentialsAuthGate {
|
|
15
|
+
/** OAuth client settings for a login — absent while no login is possible. */
|
|
16
|
+
connect: OfflineCredentialsConnectSettings | undefined;
|
|
17
|
+
/** Fresh authoritative status check from the gate. */
|
|
18
|
+
refetch: () => Promise<OfflineCredentialsStatusResult | null>;
|
|
19
|
+
}
|
|
20
|
+
/** Options for `useOfflineCredentialsAuth`. */
|
|
21
|
+
export interface UseOfflineCredentialsAuthOptions extends OfflineCredentialsAuthGate {
|
|
22
|
+
/** Host-configured offline-credentials API. */
|
|
23
|
+
offlineCredentialsClient: Pick<OfflineCredentialsApi, 'signOutOfflineCredentials'>;
|
|
24
|
+
/** Host route the OAuth popup posts its result back to, e.g. the app's toolset sign-in callback route. */
|
|
25
|
+
callbackPath: string;
|
|
26
|
+
}
|
|
27
|
+
export interface UseOfflineCredentialsAuthResult {
|
|
28
|
+
isLoggingIn: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Terminal outcome of the most recent login attempt — `undefined` before
|
|
31
|
+
* the first attempt and while one is in flight; reset at the start of every
|
|
32
|
+
* new attempt.
|
|
33
|
+
*/
|
|
34
|
+
loginOutcome: OfflineCredentialsLoginOutcomeType | undefined;
|
|
35
|
+
isLoggingOut: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Starts the OAuth popup login with the gate's `connect` settings; no-ops
|
|
38
|
+
* while no login is possible (gate reported no offline OAuth client).
|
|
39
|
+
*/
|
|
40
|
+
logIn: () => void;
|
|
41
|
+
/**
|
|
42
|
+
* Revokes the stored offline-credentials grant and resolves the logout
|
|
43
|
+
* outcome — the caller's confirmation dialog closes on `Disconnected` and
|
|
44
|
+
* maps every outcome to its own announcement text.
|
|
45
|
+
*/
|
|
46
|
+
logOut: () => Promise<OfflineCredentialsLogoutOutcomeType>;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Shared login/logout orchestration for the external scheduler service's
|
|
50
|
+
* offline credentials, consumed by every presentation of it (a login banner,
|
|
51
|
+
* a settings tab): tracks the in-flight flags and the terminal login outcome,
|
|
52
|
+
* and treats a fresh gate refetch as authoritative for the logout outcome.
|
|
53
|
+
* Presentation and announcement stay with the caller: callers map
|
|
54
|
+
* `loginOutcome` and `logOut`'s resolved outcome onto their own states and
|
|
55
|
+
* text.
|
|
56
|
+
*/
|
|
57
|
+
export declare const useOfflineCredentialsAuth: ({ connect, refetch, offlineCredentialsClient, callbackPath, }: UseOfflineCredentialsAuthOptions) => UseOfflineCredentialsAuthResult;
|
|
58
|
+
//# sourceMappingURL=useOfflineCredentialsAuth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useOfflineCredentialsAuth.d.ts","sourceRoot":"","sources":["../../../src/offline-credentials/useOfflineCredentialsAuth/useOfflineCredentialsAuth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAE3E,OAAO,KAAK,EACV,iCAAiC,EACjC,8BAA8B,EAC/B,MAAM,wDAAwD,CAAC;AAChE,OAAO,EACL,kCAAkC,EAEnC,MAAM,0DAA0D,CAAC;AAElE,mDAAmD;AACnD,oBAAY,mCAAmC;IAC7C,8FAA8F;IAC9F,YAAY,iBAAiB;IAC7B,+GAA+G;IAC/G,eAAe,qBAAqB;IACpC,0CAA0C;IAC1C,MAAM,WAAW;CAClB;AAED,kFAAkF;AAClF,MAAM,WAAW,0BAA0B;IACzC,6EAA6E;IAC7E,OAAO,EAAE,iCAAiC,GAAG,SAAS,CAAC;IACvD,sDAAsD;IACtD,OAAO,EAAE,MAAM,OAAO,CAAC,8BAA8B,GAAG,IAAI,CAAC,CAAC;CAC/D;AAED,+CAA+C;AAC/C,MAAM,WAAW,gCAAiC,SAAQ,0BAA0B;IAClF,+CAA+C;IAC/C,wBAAwB,EAAE,IAAI,CAC5B,qBAAqB,EACrB,2BAA2B,CAC5B,CAAC;IACF,0GAA0G;IAC1G,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,+BAA+B;IAC9C,WAAW,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,YAAY,EAAE,kCAAkC,GAAG,SAAS,CAAC;IAC7D,YAAY,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB;;;;OAIG;IACH,MAAM,EAAE,MAAM,OAAO,CAAC,mCAAmC,CAAC,CAAC;CAC5D;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,GAAI,+DAKvC,gCAAgC,KAAG,+BAkDrC,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { useOfflineCredentialsLogin as e } from "../useOfflineCredentialsLogin/useOfflineCredentialsLogin.js";
|
|
2
|
+
import { useCallback as t, useState as n } from "react";
|
|
3
|
+
//#region src/offline-credentials/useOfflineCredentialsAuth/useOfflineCredentialsAuth.ts
|
|
4
|
+
var r = /* @__PURE__ */ function(e) {
|
|
5
|
+
return e.Disconnected = "disconnected", e.NotDisconnected = "not-disconnected", e.Failed = "failed", e;
|
|
6
|
+
}({}), i = ({ connect: r, refetch: i, offlineCredentialsClient: a, callbackPath: o }) => {
|
|
7
|
+
let { login: s } = e({ callbackPath: o }), [c, l] = n(!1), [u, d] = n(void 0), [f, p] = n(!1);
|
|
8
|
+
return {
|
|
9
|
+
isLoggingIn: c,
|
|
10
|
+
loginOutcome: u,
|
|
11
|
+
isLoggingOut: f,
|
|
12
|
+
logIn: t(() => {
|
|
13
|
+
r != null && (l(!0), d(void 0), (async () => {
|
|
14
|
+
let e = await s(r, i);
|
|
15
|
+
l(!1), d(e.type);
|
|
16
|
+
})());
|
|
17
|
+
}, [
|
|
18
|
+
r,
|
|
19
|
+
s,
|
|
20
|
+
i
|
|
21
|
+
]),
|
|
22
|
+
logOut: t(async () => {
|
|
23
|
+
p(!0);
|
|
24
|
+
try {
|
|
25
|
+
await a.signOutOfflineCredentials();
|
|
26
|
+
let e = await i();
|
|
27
|
+
return e && !e.connected ? "disconnected" : "not-disconnected";
|
|
28
|
+
} catch {
|
|
29
|
+
return "failed";
|
|
30
|
+
} finally {
|
|
31
|
+
p(!1);
|
|
32
|
+
}
|
|
33
|
+
}, [a, i])
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
//#endregion
|
|
37
|
+
export { r as OfflineCredentialsLogoutOutcomeType, i as useOfflineCredentialsAuth };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { OfflineCredentialsApi } from '@epam/ai-dial-chat-api-client';
|
|
2
|
+
export declare enum OfflineCredentialsGateStatus {
|
|
3
|
+
/** The status check is in flight (including before the first check resolves). */
|
|
4
|
+
Checking = "checking",
|
|
5
|
+
/** A stored offline-credentials grant exists — no service-row login affordance is needed. */
|
|
6
|
+
Hidden = "hidden",
|
|
7
|
+
/** The deployment has an offline OAuth client configured and no stored grant — a login is possible. */
|
|
8
|
+
Available = "available",
|
|
9
|
+
/** The deployment has no offline OAuth client configured — no login is possible. */
|
|
10
|
+
Unavailable = "unavailable",
|
|
11
|
+
/** The status check failed — no connection state is asserted. */
|
|
12
|
+
Error = "error"
|
|
13
|
+
}
|
|
14
|
+
export interface OfflineCredentialsConnectSettings {
|
|
15
|
+
/** OAuth client id of the configured offline OAuth client. */
|
|
16
|
+
clientId: string;
|
|
17
|
+
/** Authorization endpoint of the configured offline OAuth client. */
|
|
18
|
+
authorizationEndpoint: string;
|
|
19
|
+
/** OAuth scopes requested for the offline grant. */
|
|
20
|
+
scopes: string[];
|
|
21
|
+
}
|
|
22
|
+
export interface OfflineCredentialsStatusResult {
|
|
23
|
+
/** Whether the deployment has an offline OAuth client configured. */
|
|
24
|
+
available: boolean;
|
|
25
|
+
/** Whether a stored offline-credentials grant exists. */
|
|
26
|
+
connected: boolean;
|
|
27
|
+
/** OAuth client settings usable for a login — present only while available and not connected. */
|
|
28
|
+
connect?: OfflineCredentialsConnectSettings;
|
|
29
|
+
}
|
|
30
|
+
export interface UseOfflineCredentialsGateResult {
|
|
31
|
+
status: OfflineCredentialsGateStatus;
|
|
32
|
+
/** OAuth client settings from the most recent check — set only while `status` is `Available`. */
|
|
33
|
+
connect: OfflineCredentialsConnectSettings | undefined;
|
|
34
|
+
/** Whether the most recent successful check reported a stored offline-credentials grant; a failed check keeps the last resolved value. `false` before the first check resolves. */
|
|
35
|
+
connected: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Re-runs the status check and returns its freshly resolved
|
|
38
|
+
* `{ available, connected }` result (or `null` on failure/abort), so a
|
|
39
|
+
* caller such as `useOfflineCredentialsLogin` can decide a login outcome
|
|
40
|
+
* from the same authoritative call that also updates `status`.
|
|
41
|
+
*/
|
|
42
|
+
refetch: () => Promise<OfflineCredentialsStatusResult | null>;
|
|
43
|
+
}
|
|
44
|
+
/** Options for `useOfflineCredentialsGate`. */
|
|
45
|
+
export interface UseOfflineCredentialsGateOptions {
|
|
46
|
+
/** Host-configured offline-credentials API. */
|
|
47
|
+
offlineCredentialsClient: Pick<OfflineCredentialsApi, 'getOfflineCredentials'>;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Offline-credentials status check behind a host's offline-credentials
|
|
51
|
+
* surfaces (a login banner, a settings tab): fires on mount, cancels the
|
|
52
|
+
* in-flight request on unmount, and never collapses a fetch failure into
|
|
53
|
+
* `connected: false` — a failed check must not incorrectly trigger a
|
|
54
|
+
* login-required surface. Re-fire the check at any time via `refetch`.
|
|
55
|
+
*/
|
|
56
|
+
export declare const useOfflineCredentialsGate: ({ offlineCredentialsClient, }: UseOfflineCredentialsGateOptions) => UseOfflineCredentialsGateResult;
|
|
57
|
+
//# sourceMappingURL=useOfflineCredentialsGate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useOfflineCredentialsGate.d.ts","sourceRoot":"","sources":["../../../src/offline-credentials/useOfflineCredentialsGate/useOfflineCredentialsGate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAI3E,oBAAY,4BAA4B;IACtC,iFAAiF;IACjF,QAAQ,aAAa;IACrB,6FAA6F;IAC7F,MAAM,WAAW;IACjB,uGAAuG;IACvG,SAAS,cAAc;IACvB,oFAAoF;IACpF,WAAW,gBAAgB;IAC3B,iEAAiE;IACjE,KAAK,UAAU;CAChB;AAED,MAAM,WAAW,iCAAiC;IAChD,8DAA8D;IAC9D,QAAQ,EAAE,MAAM,CAAC;IACjB,qEAAqE;IACrE,qBAAqB,EAAE,MAAM,CAAC;IAC9B,oDAAoD;IACpD,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,8BAA8B;IAC7C,qEAAqE;IACrE,SAAS,EAAE,OAAO,CAAC;IACnB,yDAAyD;IACzD,SAAS,EAAE,OAAO,CAAC;IACnB,iGAAiG;IACjG,OAAO,CAAC,EAAE,iCAAiC,CAAC;CAC7C;AAED,MAAM,WAAW,+BAA+B;IAC9C,MAAM,EAAE,4BAA4B,CAAC;IACrC,iGAAiG;IACjG,OAAO,EAAE,iCAAiC,GAAG,SAAS,CAAC;IACvD,mLAAmL;IACnL,SAAS,EAAE,OAAO,CAAC;IACnB;;;;;OAKG;IACH,OAAO,EAAE,MAAM,OAAO,CAAC,8BAA8B,GAAG,IAAI,CAAC,CAAC;CAC/D;AAED,+CAA+C;AAC/C,MAAM,WAAW,gCAAgC;IAC/C,+CAA+C;IAC/C,wBAAwB,EAAE,IAAI,CAC5B,qBAAqB,EACrB,uBAAuB,CACxB,CAAC;CACH;AAED;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,GAAI,+BAEvC,gCAAgC,KAAG,+BA6DrC,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { mapOfflineCredentialsResponse as e } from "../map-offline-credentials-response.js";
|
|
2
|
+
import { useCallback as t, useEffect as n, useRef as r, useState as i } from "react";
|
|
3
|
+
//#region src/offline-credentials/useOfflineCredentialsGate/useOfflineCredentialsGate.ts
|
|
4
|
+
var a = /* @__PURE__ */ function(e) {
|
|
5
|
+
return e.Checking = "checking", e.Hidden = "hidden", e.Available = "available", e.Unavailable = "unavailable", e.Error = "error", e;
|
|
6
|
+
}({}), o = ({ offlineCredentialsClient: a }) => {
|
|
7
|
+
let [o, s] = i("checking"), [c, l] = i(void 0), [u, d] = i(!1), f = r(null), p = t(async () => {
|
|
8
|
+
f.current?.abort();
|
|
9
|
+
let t = new AbortController();
|
|
10
|
+
f.current = t, s("checking");
|
|
11
|
+
try {
|
|
12
|
+
let n = await a.getOfflineCredentials({ signal: t.signal });
|
|
13
|
+
if (t.signal.aborted) return null;
|
|
14
|
+
let { available: r, connected: i, connect: o } = e(n);
|
|
15
|
+
return s(i ? "hidden" : r ? "available" : "unavailable"), l(o), d(i), {
|
|
16
|
+
available: r,
|
|
17
|
+
connected: i,
|
|
18
|
+
connect: o
|
|
19
|
+
};
|
|
20
|
+
} catch {
|
|
21
|
+
return t.signal.aborted ? null : (s("error"), l(void 0), null);
|
|
22
|
+
}
|
|
23
|
+
}, [a]);
|
|
24
|
+
return n(() => (p(), () => {
|
|
25
|
+
f.current?.abort();
|
|
26
|
+
}), [p]), {
|
|
27
|
+
status: o,
|
|
28
|
+
connect: c,
|
|
29
|
+
connected: u,
|
|
30
|
+
refetch: p
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
//#endregion
|
|
34
|
+
export { a as OfflineCredentialsGateStatus, o as useOfflineCredentialsGate };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { OfflineCredentialsConnectSettings, OfflineCredentialsStatusResult } from '../useOfflineCredentialsGate/useOfflineCredentialsGate';
|
|
2
|
+
export declare enum OfflineCredentialsLoginOutcomeType {
|
|
3
|
+
Success = "success",
|
|
4
|
+
Failure = "failure",
|
|
5
|
+
PopupBlocked = "popup-blocked",
|
|
6
|
+
Cancelled = "cancelled",
|
|
7
|
+
TimedOut = "timed-out"
|
|
8
|
+
}
|
|
9
|
+
export interface OfflineCredentialsLoginOutcome {
|
|
10
|
+
/** Which terminal branch the attempt resolved through. */
|
|
11
|
+
type: OfflineCredentialsLoginOutcomeType;
|
|
12
|
+
}
|
|
13
|
+
/** Options for `useOfflineCredentialsLogin`. */
|
|
14
|
+
export interface UseOfflineCredentialsLoginOptions {
|
|
15
|
+
/** Host route the OAuth popup posts its result back to, e.g. the app's toolset sign-in callback route. */
|
|
16
|
+
callbackPath: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Offline-credentials counterpart to `useToolsetLogin`/`useExternalServiceLogin`:
|
|
20
|
+
* reuses the exact same OAuth popup/`BroadcastChannel` handshake, but drives
|
|
21
|
+
* the `offline-credentials` BFF domain and treats a fresh
|
|
22
|
+
* status refetch as authoritative for reporting success. Callers that fetch
|
|
23
|
+
* settings after the click can pass a popup they already opened synchronously.
|
|
24
|
+
*/
|
|
25
|
+
export declare const useOfflineCredentialsLogin: ({ callbackPath, }: UseOfflineCredentialsLoginOptions) => {
|
|
26
|
+
login: (connect: OfflineCredentialsConnectSettings, refetch: () => Promise<OfflineCredentialsStatusResult | null>, preparedPopup?: Window) => Promise<OfflineCredentialsLoginOutcome>;
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=useOfflineCredentialsLogin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useOfflineCredentialsLogin.d.ts","sourceRoot":"","sources":["../../../src/offline-credentials/useOfflineCredentialsLogin/useOfflineCredentialsLogin.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EACV,iCAAiC,EACjC,8BAA8B,EAC/B,MAAM,wDAAwD,CAAC;AAsBhE,oBAAY,kCAAkC;IAC5C,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,YAAY,kBAAkB;IAC9B,SAAS,cAAc;IACvB,QAAQ,cAAc;CACvB;AAED,MAAM,WAAW,8BAA8B;IAC7C,0DAA0D;IAC1D,IAAI,EAAE,kCAAkC,CAAC;CAC1C;AAED,gDAAgD;AAChD,MAAM,WAAW,iCAAiC;IAChD,0GAA0G;IAC1G,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,GAAI,mBAExC,iCAAiC,KAAG;IACrC,KAAK,EAAE,CACL,OAAO,EAAE,iCAAiC,EAC1C,OAAO,EAAE,MAAM,OAAO,CAAC,8BAA8B,GAAG,IAAI,CAAC,EAC7D,aAAa,CAAC,EAAE,MAAM,KACnB,OAAO,CAAC,8BAA8B,CAAC,CAAC;CAoF9C,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { OAuthResourceKind as e, ToolsetAuthTypes as t, ToolsetCredentialsLevel as n, ToolsetOAuthInitiationResultType as r, ToolsetOAuthResultType as i, WithLogin as a } from "../../oauth/types.js";
|
|
2
|
+
import { waitForToolsetOAuthResult as o } from "../../oauth/handshake.js";
|
|
3
|
+
import { navigateToolsetOAuthPopup as s, openToolsetOAuthPopup as c } from "../../oauth/popup.js";
|
|
4
|
+
import { useCallback as l } from "react";
|
|
5
|
+
//#region src/offline-credentials/useOfflineCredentialsLogin/useOfflineCredentialsLogin.ts
|
|
6
|
+
var u = "offline-credentials", d = 300 * 1e3, f = 5 * 1e3, p = /* @__PURE__ */ function(e) {
|
|
7
|
+
return e.Success = "success", e.Failure = "failure", e.PopupBlocked = "popup-blocked", e.Cancelled = "cancelled", e.TimedOut = "timed-out", e;
|
|
8
|
+
}({}), m = ({ callbackPath: p }) => ({ login: l(async (l, m, h) => {
|
|
9
|
+
let g = {
|
|
10
|
+
authenticationType: t.OAuth,
|
|
11
|
+
withLogin: a.WithConfig,
|
|
12
|
+
isLoggedIn: !1,
|
|
13
|
+
clientId: l.clientId,
|
|
14
|
+
authorizationEndpoint: l.authorizationEndpoint,
|
|
15
|
+
scopes: l.scopes
|
|
16
|
+
}, _ = h ?? c();
|
|
17
|
+
if (!_) return { type: "popup-blocked" };
|
|
18
|
+
let v = s(_, g, u, p, n.User, e.OfflineCredentials);
|
|
19
|
+
if (v.type !== r.Started) return { type: "failure" };
|
|
20
|
+
let y = Date.now(), b = await o(v.popup, v.flowId, {
|
|
21
|
+
toolsetId: u,
|
|
22
|
+
credentialsLevel: n.User,
|
|
23
|
+
callbackPath: p,
|
|
24
|
+
timeoutMs: d
|
|
25
|
+
}), x = Date.now() - y;
|
|
26
|
+
return (await m())?.connected ? { type: "success" } : b.type === i.Failure || b.type === i.Success ? { type: "failure" } : x >= d - f ? { type: "timed-out" } : { type: "cancelled" };
|
|
27
|
+
}, [p]) });
|
|
28
|
+
//#endregion
|
|
29
|
+
export { p as OfflineCredentialsLoginOutcomeType, m as useOfflineCredentialsLogin };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { mapOfflineCredentialsResponse as e, normalizeOfflineCredentialsConnectSettings as t } from "./offline-credentials/map-offline-credentials-response.js";
|
|
2
|
+
import { OfflineCredentialsGateStatus as n, useOfflineCredentialsGate as r } from "./offline-credentials/useOfflineCredentialsGate/useOfflineCredentialsGate.js";
|
|
3
|
+
import { OfflineCredentialsLoginOutcomeType as i, useOfflineCredentialsLogin as a } from "./offline-credentials/useOfflineCredentialsLogin/useOfflineCredentialsLogin.js";
|
|
4
|
+
import { OfflineCredentialsLogoutOutcomeType as o, useOfflineCredentialsAuth as s } from "./offline-credentials/useOfflineCredentialsAuth/useOfflineCredentialsAuth.js";
|
|
5
|
+
export { n as OfflineCredentialsGateStatus, i as OfflineCredentialsLoginOutcomeType, o as OfflineCredentialsLogoutOutcomeType, e as mapOfflineCredentialsResponse, t as normalizeOfflineCredentialsConnectSettings, s as useOfflineCredentialsAuth, r as useOfflineCredentialsGate, a as useOfflineCredentialsLogin };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epam/ai-dial-chat-hooks",
|
|
3
3
|
"description": "Framework-level React hooks extracted from AI DIAL Chat for building custom chat interfaces",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.3.0-dev.102",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -79,6 +79,11 @@
|
|
|
79
79
|
"import": "./oauth.js",
|
|
80
80
|
"default": "./oauth.js"
|
|
81
81
|
},
|
|
82
|
+
"./offline-credentials": {
|
|
83
|
+
"types": "./offline-credentials.d.ts",
|
|
84
|
+
"import": "./offline-credentials.js",
|
|
85
|
+
"default": "./offline-credentials.js"
|
|
86
|
+
},
|
|
82
87
|
"./scheduled-tasks": {
|
|
83
88
|
"types": "./scheduled-tasks.d.ts",
|
|
84
89
|
"import": "./scheduled-tasks.js",
|
|
@@ -116,7 +121,7 @@
|
|
|
116
121
|
}
|
|
117
122
|
},
|
|
118
123
|
"dependencies": {
|
|
119
|
-
"@epam/ai-dial-chat-api-client": "1.
|
|
124
|
+
"@epam/ai-dial-chat-api-client": "1.3.0-dev.102",
|
|
120
125
|
"dompurify": "3.4.16",
|
|
121
126
|
"fflate": "^0.8.3",
|
|
122
127
|
"lru-cache": "^10.4.3",
|
|
@@ -125,22 +130,22 @@
|
|
|
125
130
|
},
|
|
126
131
|
"peerDependencies": {
|
|
127
132
|
"react": "^19.2.8",
|
|
128
|
-
"@epam/ai-dial-attachment-canvas": "1.
|
|
129
|
-
"@epam/ai-dial-attachment-input": "1.
|
|
130
|
-
"@epam/ai-dial-catalog": "1.
|
|
131
|
-
"@epam/ai-dial-chat-overlay": "1.
|
|
132
|
-
"@epam/ai-dial-chat-shared": "1.
|
|
133
|
-
"@epam/ai-dial-conversation-input": "1.
|
|
134
|
-
"@epam/ai-dial-mcp-apps": "1.
|
|
135
|
-
"@epam/ai-dial-publish-panel": "1.
|
|
136
|
-
"@epam/ai-dial-quotations": "1.
|
|
137
|
-
"@epam/ai-dial-react-file-manager": "^0.
|
|
138
|
-
"@epam/ai-dial-scheduled-tasks": "1.
|
|
139
|
-
"@epam/ai-dial-share": "1.
|
|
140
|
-
"@epam/ai-dial-skill-editor": "1.
|
|
141
|
-
"@epam/ai-dial-source-panel": "1.
|
|
142
|
-
"@epam/ai-dial-ui-kit": "^0.
|
|
143
|
-
"@epam/ai-dial-usage-dashboard": "1.
|
|
133
|
+
"@epam/ai-dial-attachment-canvas": "1.3.0-dev.102",
|
|
134
|
+
"@epam/ai-dial-attachment-input": "1.3.0-dev.102",
|
|
135
|
+
"@epam/ai-dial-catalog": "1.3.0-dev.102",
|
|
136
|
+
"@epam/ai-dial-chat-overlay": "1.3.0-dev.102",
|
|
137
|
+
"@epam/ai-dial-chat-shared": "1.3.0-dev.102",
|
|
138
|
+
"@epam/ai-dial-conversation-input": "1.3.0-dev.102",
|
|
139
|
+
"@epam/ai-dial-mcp-apps": "1.3.0-dev.102",
|
|
140
|
+
"@epam/ai-dial-publish-panel": "1.3.0-dev.102",
|
|
141
|
+
"@epam/ai-dial-quotations": "1.3.0-dev.102",
|
|
142
|
+
"@epam/ai-dial-react-file-manager": "^0.4.0-dev.9",
|
|
143
|
+
"@epam/ai-dial-scheduled-tasks": "1.3.0-dev.102",
|
|
144
|
+
"@epam/ai-dial-share": "1.3.0-dev.102",
|
|
145
|
+
"@epam/ai-dial-skill-editor": "1.3.0-dev.102",
|
|
146
|
+
"@epam/ai-dial-source-panel": "1.3.0-dev.102",
|
|
147
|
+
"@epam/ai-dial-ui-kit": "^0.16.0-dev.16",
|
|
148
|
+
"@epam/ai-dial-usage-dashboard": "1.3.0-dev.102",
|
|
144
149
|
"@modelcontextprotocol/sdk": "^1.32.1",
|
|
145
150
|
"@epam/pdf-highlighter-kit": "^0.0.19",
|
|
146
151
|
"@mcp-ui/client": "^7.1.1"
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { GetOfflineCredentialsResponseDto } from '@epam/ai-dial-chat-api-client';
|
|
2
|
+
import { OfflineCredentialsConnectSettings } from '../offline-credentials/useOfflineCredentialsGate/useOfflineCredentialsGate';
|
|
3
|
+
/** Result of the 403-triggered offline-credentials check on a failed scheduled-task submit. */
|
|
4
|
+
export interface ScheduledTaskAuthSessionCheckResult {
|
|
5
|
+
/** Whether the failure is attributed to the logged-out external Scheduler auth service. */
|
|
6
|
+
isAuthSessionError: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* OAuth client settings from the same single check, present only when they
|
|
9
|
+
* are complete enough to drive a login — returned regardless of the
|
|
10
|
+
* connection state, so the caller decides from one check; the auto-login
|
|
11
|
+
* consumes them without a second client-settings request.
|
|
12
|
+
*/
|
|
13
|
+
connect?: OfflineCredentialsConnectSettings;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Checks whether a failed scheduled-task submit should be attributed to the
|
|
17
|
+
* logged-out external Scheduler auth service, and returns the OAuth client
|
|
18
|
+
* settings from the same check when they can drive a login: exactly when the
|
|
19
|
+
* failure is a `403` and one fresh offline-credentials status check (the
|
|
20
|
+
* passed-in `getOfflineCredentials` operation) reports an available OAuth
|
|
21
|
+
* client with no stored grant. Every other outcome — a non-`403` failure, a
|
|
22
|
+
* still-connected user, an incomplete `connect` object, or a failed check —
|
|
23
|
+
* returns `isAuthSessionError: false` so the caller keeps its generic error
|
|
24
|
+
* handling. Issues at most one status request, and only on the `403` path.
|
|
25
|
+
*/
|
|
26
|
+
export declare const checkScheduledTaskAuthSessionError: (error: unknown, getOfflineCredentials: () => Promise<GetOfflineCredentialsResponseDto>) => Promise<ScheduledTaskAuthSessionCheckResult>;
|
|
27
|
+
//# sourceMappingURL=check-scheduled-task-auth-session-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-scheduled-task-auth-session-error.d.ts","sourceRoot":"","sources":["../../src/scheduled-task/check-scheduled-task-auth-session-error.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,+BAA+B,CAAC;AAMtF,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,4EAA4E,CAAC;AAEpI,+FAA+F;AAC/F,MAAM,WAAW,mCAAmC;IAClD,2FAA2F;IAC3F,kBAAkB,EAAE,OAAO,CAAC;IAC5B;;;;;OAKG;IACH,OAAO,CAAC,EAAE,iCAAiC,CAAC;CAC7C;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kCAAkC,GAC7C,OAAO,OAAO,EACd,uBAAuB,MAAM,OAAO,CAAC,gCAAgC,CAAC,KACrE,OAAO,CAAC,mCAAmC,CAgB7C,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { getApiErrorStatus as e } from "../api-error/api-error.js";
|
|
2
|
+
import { mapOfflineCredentialsResponse as t, normalizeOfflineCredentialsConnectSettings as n } from "../offline-credentials/map-offline-credentials-response.js";
|
|
3
|
+
//#region src/scheduled-task/check-scheduled-task-auth-session-error.ts
|
|
4
|
+
var r = async (r, i) => {
|
|
5
|
+
if (e(r) !== 403) return { isAuthSessionError: !1 };
|
|
6
|
+
try {
|
|
7
|
+
let e = await i(), { available: r, connected: a } = t(e);
|
|
8
|
+
return {
|
|
9
|
+
isAuthSessionError: r && !a,
|
|
10
|
+
connect: n(e.connect)
|
|
11
|
+
};
|
|
12
|
+
} catch {
|
|
13
|
+
return { isAuthSessionError: !1 };
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
export { r as checkScheduledTaskAuthSessionError };
|
package/scheduled-tasks.js
CHANGED
|
@@ -5,4 +5,5 @@ import { prepareScheduledTaskCreateBody as o, prepareScheduledTaskUpdateBody as
|
|
|
5
5
|
import { createScheduledTasksApiClient as c } from "./scheduled-task/scheduled-tasks-api-client.js";
|
|
6
6
|
import { useScheduledTasks as l } from "./scheduled-task/use-scheduled-tasks.js";
|
|
7
7
|
import { mergeRunsById as u, useScheduledTaskRuns as d } from "./scheduled-task/use-scheduled-task-runs.js";
|
|
8
|
-
|
|
8
|
+
import { checkScheduledTaskAuthSessionError as f } from "./scheduled-task/check-scheduled-task-auth-session-error.js";
|
|
9
|
+
export { t as ScheduledTaskTriggerDescriptionKind, e as UnsupportedTriggerReason, f as checkScheduledTaskAuthSessionError, c as createScheduledTasksApiClient, n as describeScheduledTaskTrigger, r as mapFormValuesToCreateBody, i as mapFormValuesToUpdateBody, a as mapScheduledTaskDtoToFormValues, u as mergeRunsById, o as prepareScheduledTaskCreateBody, s as prepareScheduledTaskUpdateBody, d as useScheduledTaskRuns, l as useScheduledTasks };
|
|
@@ -7,8 +7,6 @@ export interface QuickAppSchemaLike {
|
|
|
7
7
|
export declare const isCustomAppSchema: (schema?: QuickAppSchemaLike) => boolean;
|
|
8
8
|
/** True when `schema` is a Quick App 2.0 schema. */
|
|
9
9
|
export declare const isQuickAppSchema: (schema?: QuickAppSchemaLike) => boolean;
|
|
10
|
-
/** True when `schema` is the Mind Map schema (its id or display name contains "mind map", ignoring case and separators). */
|
|
11
|
-
export declare const isMindMapSchema: (schema?: QuickAppSchemaLike) => boolean;
|
|
12
10
|
/** An application schema with a resolved id, as returned by {@link getRunnerSchemas}. */
|
|
13
11
|
export type RunnerSchema<T extends QuickAppSchemaLike> = T & {
|
|
14
12
|
id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application-schema.d.ts","sourceRoot":"","sources":["../../src/shared/application-schema.ts"],"names":[],"mappings":"AAMA,gEAAgE;AAChE,MAAM,WAAW,kBAAkB;IACjC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,8DAA8D;AAC9D,eAAO,MAAM,iBAAiB,GAAI,SAAS,kBAAkB,KAAG,OAChB,CAAC;AAQjD,oDAAoD;AACpD,eAAO,MAAM,gBAAgB,GAAI,SAAS,kBAAkB,KAAG,OAGpB,CAAC;
|
|
1
|
+
{"version":3,"file":"application-schema.d.ts","sourceRoot":"","sources":["../../src/shared/application-schema.ts"],"names":[],"mappings":"AAMA,gEAAgE;AAChE,MAAM,WAAW,kBAAkB;IACjC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,8DAA8D;AAC9D,eAAO,MAAM,iBAAiB,GAAI,SAAS,kBAAkB,KAAG,OAChB,CAAC;AAQjD,oDAAoD;AACpD,eAAO,MAAM,gBAAgB,GAAI,SAAS,kBAAkB,KAAG,OAGpB,CAAC;AAE5C,yFAAyF;AACzF,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,kBAAkB,IAAI,CAAC,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC;AAE5E,yHAAyH;AACzH,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,kBAAkB,EAC3D,SAAS,CAAC,EAAE,KACX,YAAY,CAAC,CAAC,CAAC,EASjB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
//#region src/shared/application-schema.ts
|
|
2
|
-
var e = "custom_app", t = (t) => !!t && t.id === e, n = (e) => !!e && (!!e.id?.endsWith("quickapps2") || e.displayName === "Quick app 2.0"), r =
|
|
2
|
+
var e = "custom_app", t = (t) => !!t && t.id === e, n = (e) => !!e && (!!e.id?.endsWith("quickapps2") || e.displayName === "Quick app 2.0"), r = (e) => {
|
|
3
3
|
let n = /* @__PURE__ */ new Set();
|
|
4
4
|
return e.filter((e) => !e.id || t(e) || n.has(e.id) ? !1 : (n.add(e.id), !0));
|
|
5
5
|
};
|
|
6
6
|
//#endregion
|
|
7
|
-
export {
|
|
7
|
+
export { r as getRunnerSchemas, t as isCustomAppSchema, n as isQuickAppSchema };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useShareLink.d.ts","sourceRoot":"","sources":["../../src/useShareLink/useShareLink.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,QAAQ,EACd,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAYrE,+CAA+C;AAC/C,MAAM,WAAW,kBAAkB;IACjC,0EAA0E;IAC1E,IAAI,EAAE,aAAa,GAAG,SAAS,CAAC;IAChC,qDAAqD;IACrD,SAAS,EAAE,OAAO,CAAC;IACnB,oDAAoD;IACpD,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,6DAA6D;IAC7D,SAAS,EAAE,CAAC,MAAM,EAAE,eAAe,EAAE,KAAK,IAAI,CAAC;CAChD;AAcD;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,GACvB,UAAU,IAAI,CAAC,QAAQ,EAAE,iBAAiB,CAAC,EAC3C,QAAQ,MAAM,EACd,SAAQ,MAA+B,KACtC,
|
|
1
|
+
{"version":3,"file":"useShareLink.d.ts","sourceRoot":"","sources":["../../src/useShareLink/useShareLink.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,QAAQ,EACd,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAYrE,+CAA+C;AAC/C,MAAM,WAAW,kBAAkB;IACjC,0EAA0E;IAC1E,IAAI,EAAE,aAAa,GAAG,SAAS,CAAC;IAChC,qDAAqD;IACrD,SAAS,EAAE,OAAO,CAAC;IACnB,oDAAoD;IACpD,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,6DAA6D;IAC7D,SAAS,EAAE,CAAC,MAAM,EAAE,eAAe,EAAE,KAAK,IAAI,CAAC;CAChD;AAcD;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,GACvB,UAAU,IAAI,CAAC,QAAQ,EAAE,iBAAiB,CAAC,EAC3C,QAAQ,MAAM,EACd,SAAQ,MAA+B,KACtC,kBAyDF,CAAC"}
|