@lpextend/node-sdk 1.1.4 → 1.1.6
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/dist/index.d.mts +172 -1
- package/dist/index.d.ts +172 -1
- package/dist/index.js +89 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +89 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2147,6 +2147,57 @@ var KnowledgeBasesAPI = class {
|
|
|
2147
2147
|
});
|
|
2148
2148
|
return uniqueMetrics;
|
|
2149
2149
|
}
|
|
2150
|
+
/**
|
|
2151
|
+
* Get KB search events (real customer queries)
|
|
2152
|
+
*
|
|
2153
|
+
* Retrieves actual customer queries made to knowledge bases and their outcomes.
|
|
2154
|
+
* This API returns the raw questions customers asked, whether they were answered,
|
|
2155
|
+
* and which KB/articles were involved.
|
|
2156
|
+
*
|
|
2157
|
+
* @param request - Search events request parameters
|
|
2158
|
+
* @returns Promise resolving to search events with pagination
|
|
2159
|
+
*
|
|
2160
|
+
* @example
|
|
2161
|
+
* ```typescript
|
|
2162
|
+
* // Get unanswered questions from the last 7 days
|
|
2163
|
+
* const events = await sdk.conversationBuilder.knowledgeBases.getSearchEvents({
|
|
2164
|
+
* startTime: String(Date.now() - 7 * 24 * 60 * 60 * 1000),
|
|
2165
|
+
* endTime: String(Date.now()),
|
|
2166
|
+
* eventType: ['EVENT_KB_UN_ANSWERED'],
|
|
2167
|
+
* pageSize: 50,
|
|
2168
|
+
* });
|
|
2169
|
+
*
|
|
2170
|
+
* // Get all events for a specific KB
|
|
2171
|
+
* const kbEvents = await sdk.conversationBuilder.knowledgeBases.getSearchEvents({
|
|
2172
|
+
* startTime: String(Date.now() - 7 * 24 * 60 * 60 * 1000),
|
|
2173
|
+
* endTime: String(Date.now()),
|
|
2174
|
+
* kbId: 'kb-123',
|
|
2175
|
+
* eventType: ['EVENT_KB_ANSWERED', 'EVENT_KB_UN_ANSWERED'],
|
|
2176
|
+
* });
|
|
2177
|
+
* ```
|
|
2178
|
+
*/
|
|
2179
|
+
async getSearchEvents(request) {
|
|
2180
|
+
const body = {
|
|
2181
|
+
startTime: request.startTime,
|
|
2182
|
+
endTime: request.endTime
|
|
2183
|
+
};
|
|
2184
|
+
if (request.pageNumber !== void 0) {
|
|
2185
|
+
body.pageNumber = request.pageNumber;
|
|
2186
|
+
}
|
|
2187
|
+
if (request.pageSize !== void 0) {
|
|
2188
|
+
body.pageSize = request.pageSize;
|
|
2189
|
+
}
|
|
2190
|
+
if (request.eventType !== void 0) {
|
|
2191
|
+
body.eventType = request.eventType;
|
|
2192
|
+
}
|
|
2193
|
+
if (request.kbId !== void 0) {
|
|
2194
|
+
body.kbId = request.kbId;
|
|
2195
|
+
}
|
|
2196
|
+
return this.cb.request("cbKb", "/kb/searchEvents", {
|
|
2197
|
+
method: "POST",
|
|
2198
|
+
body
|
|
2199
|
+
});
|
|
2200
|
+
}
|
|
2150
2201
|
};
|
|
2151
2202
|
var BotAgentsAPI = class {
|
|
2152
2203
|
constructor(cb) {
|
|
@@ -2345,6 +2396,26 @@ async function createSDK(config) {
|
|
|
2345
2396
|
}
|
|
2346
2397
|
}
|
|
2347
2398
|
let accessToken = config.accessToken;
|
|
2399
|
+
if (config.mode === "local") {
|
|
2400
|
+
if (!accessToken) {
|
|
2401
|
+
throw new LPExtendSDKError(
|
|
2402
|
+
"Local mode requires accessToken to be provided directly. Use the LP Login Service API to obtain a bearer token.",
|
|
2403
|
+
ErrorCodes.INVALID_CONFIG
|
|
2404
|
+
);
|
|
2405
|
+
}
|
|
2406
|
+
if (debug) {
|
|
2407
|
+
console.log("[LP-Extend-SDK] Local mode \u2014 skipping shell verification");
|
|
2408
|
+
console.log("[LP-Extend-SDK] Granting scopes locally:", config.scopes || ["*"]);
|
|
2409
|
+
}
|
|
2410
|
+
const initResult = {
|
|
2411
|
+
appId: config.appId,
|
|
2412
|
+
accountId: config.accountId,
|
|
2413
|
+
grantedScopes: config.scopes || ["*"],
|
|
2414
|
+
appName: config.appId,
|
|
2415
|
+
version: "1.0.0"
|
|
2416
|
+
};
|
|
2417
|
+
return new LPExtendSDK({ ...config, accessToken }, initResult);
|
|
2418
|
+
}
|
|
2348
2419
|
if (!accessToken && config.apiKey && config.extendToken) {
|
|
2349
2420
|
const verifyUrl = `${shellBaseUrl}/api/v1/apps/verify`;
|
|
2350
2421
|
if (debug) {
|
|
@@ -2583,6 +2654,20 @@ async function createSDK(config) {
|
|
|
2583
2654
|
);
|
|
2584
2655
|
}
|
|
2585
2656
|
}
|
|
2657
|
+
if (config.skipRegistration) {
|
|
2658
|
+
if (debug) {
|
|
2659
|
+
console.log("[LP-Extend-SDK] skipRegistration=true \u2014 bypassing shell app verification");
|
|
2660
|
+
console.log("[LP-Extend-SDK] Granting scopes locally:", config.scopes || ["*"]);
|
|
2661
|
+
}
|
|
2662
|
+
const initResult = {
|
|
2663
|
+
appId: config.appId,
|
|
2664
|
+
accountId: config.accountId,
|
|
2665
|
+
grantedScopes: config.scopes || ["*"],
|
|
2666
|
+
appName: config.appId,
|
|
2667
|
+
version: "1.0.0"
|
|
2668
|
+
};
|
|
2669
|
+
return new LPExtendSDK({ ...config, accessToken }, initResult);
|
|
2670
|
+
}
|
|
2586
2671
|
if (debug) {
|
|
2587
2672
|
console.log("[LP-Extend-SDK] Verifying scopes with shell:", shellBaseUrl);
|
|
2588
2673
|
}
|
|
@@ -2705,6 +2790,9 @@ async function createSDKFromEnv(extendToken) {
|
|
|
2705
2790
|
debug
|
|
2706
2791
|
});
|
|
2707
2792
|
}
|
|
2793
|
+
async function createLocalSDK(config) {
|
|
2794
|
+
return createSDK({ ...config, mode: "local" });
|
|
2795
|
+
}
|
|
2708
2796
|
var VERSION = "1.0.0";
|
|
2709
2797
|
var Scopes = {
|
|
2710
2798
|
// Account Configuration
|
|
@@ -2820,6 +2908,6 @@ async function getShellToken(config) {
|
|
|
2820
2908
|
}
|
|
2821
2909
|
}
|
|
2822
2910
|
|
|
2823
|
-
export { AIStudioAPI, AIStudioUsersAPI, AgentActivityAPI, AgentGroupsAPI, AgentMetricsAPI, AutomaticMessagesAPI, BotAgentsAPI, BotGroupsAPI, BotsAPI, CampaignsAPI, CategoriesAPI, ConnectToMessagingAPI, ConversationBuilderAPI, ConversationsAPI, DialogsAPI, EngagementsAPI, ErrorCodes, EvaluatorsAPI, FlowsAPI, GeneratorsAPI, IntegrationsAPI, InteractionsAPI, KnowledgeBasesAPI, KnowledgebasesAPI, LOBsAPI, LPExtendSDK, LPExtendSDKError, LPPromptsAPI, MessagingAPI, MessagingHistoryAPI, MessagingOperationsAPI, NLUDomainsAPI, OutboundReportingAPI, PredefinedContentAPI, ProfilesAPI, PromptLibraryAPI, QueryAPI, Scopes, SentinelAPI, SimulationsAPI, SkillsAPI, SpecialOccasionsAPI, SummaryAPI, TranscriptAnalysisAPI, UsersAPI, VERSION, WorkingHoursAPI, createSDK, createSDKFromEnv, getShellToken, initializeSDK };
|
|
2911
|
+
export { AIStudioAPI, AIStudioUsersAPI, AgentActivityAPI, AgentGroupsAPI, AgentMetricsAPI, AutomaticMessagesAPI, BotAgentsAPI, BotGroupsAPI, BotsAPI, CampaignsAPI, CategoriesAPI, ConnectToMessagingAPI, ConversationBuilderAPI, ConversationsAPI, DialogsAPI, EngagementsAPI, ErrorCodes, EvaluatorsAPI, FlowsAPI, GeneratorsAPI, IntegrationsAPI, InteractionsAPI, KnowledgeBasesAPI, KnowledgebasesAPI, LOBsAPI, LPExtendSDK, LPExtendSDKError, LPPromptsAPI, MessagingAPI, MessagingHistoryAPI, MessagingOperationsAPI, NLUDomainsAPI, OutboundReportingAPI, PredefinedContentAPI, ProfilesAPI, PromptLibraryAPI, QueryAPI, Scopes, SentinelAPI, SimulationsAPI, SkillsAPI, SpecialOccasionsAPI, SummaryAPI, TranscriptAnalysisAPI, UsersAPI, VERSION, WorkingHoursAPI, createLocalSDK, createSDK, createSDKFromEnv, getShellToken, initializeSDK };
|
|
2824
2912
|
//# sourceMappingURL=index.mjs.map
|
|
2825
2913
|
//# sourceMappingURL=index.mjs.map
|