@bitbitpress/client 0.1.8 → 0.1.10
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 +132 -117
- package/dist/examples/basic-usage.d.ts.map +1 -1
- package/dist/examples/basic-usage.js +41 -47
- package/dist/examples/basic-usage.js.map +1 -1
- package/dist/generated/openapi.d.ts +28 -40
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/user/index.d.ts +33 -32
- package/dist/user/index.d.ts.map +1 -1
- package/dist/user/index.js +46 -22
- package/dist/user/index.js.map +1 -1
- package/dist/user/profile.d.ts +2 -2
- package/dist/user/profile.d.ts.map +1 -1
- package/dist/user/profile.js +2 -2
- package/dist/user/profile.js.map +1 -1
- package/dist/user/recommendations.d.ts +5 -12
- package/dist/user/recommendations.d.ts.map +1 -1
- package/dist/user/recommendations.js +3 -3
- package/dist/user/recommendations.js.map +1 -1
- package/dist/user/report.d.ts +3 -3
- package/dist/user/report.d.ts.map +1 -1
- package/dist/user/report.js +3 -3
- package/dist/user/report.js.map +1 -1
- package/dist/user/signal-batch-manager.d.ts +5 -7
- package/dist/user/signal-batch-manager.d.ts.map +1 -1
- package/dist/user/signal-batch-manager.js +7 -7
- package/dist/user/signal-batch-manager.js.map +1 -1
- package/dist/user/signal.d.ts +3 -3
- package/dist/user/signal.d.ts.map +1 -1
- package/dist/user/signal.js +3 -3
- package/dist/user/signal.js.map +1 -1
- package/dist/user/synthesize-batch-manager.d.ts +23 -0
- package/dist/user/synthesize-batch-manager.d.ts.map +1 -0
- package/dist/user/{batch-manager.js → synthesize-batch-manager.js} +28 -32
- package/dist/user/synthesize-batch-manager.js.map +1 -0
- package/dist/user/synthesize.d.ts +29 -13
- package/dist/user/synthesize.d.ts.map +1 -1
- package/dist/user/synthesize.js +43 -6
- package/dist/user/synthesize.js.map +1 -1
- package/dist/user/token.d.ts +3 -3
- package/dist/user/token.d.ts.map +1 -1
- package/dist/user/token.js +3 -3
- package/dist/user/token.js.map +1 -1
- package/dist/user/typeDefs.d.ts +18 -0
- package/dist/user/typeDefs.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/user/batch-manager.d.ts +0 -20
- package/dist/user/batch-manager.d.ts.map +0 -1
- package/dist/user/batch-manager.js.map +0 -1
package/dist/user/index.d.ts
CHANGED
|
@@ -1,81 +1,82 @@
|
|
|
1
1
|
import type { RequestConfig } from '../request.js';
|
|
2
|
+
import { type SynthesizeOnStreamingData } from './synthesize-batch-manager.js';
|
|
2
3
|
import { type RecommendationsRequest, type RecommendationsResponse } from './recommendations.js';
|
|
3
4
|
import { type ProfileResponse } from './profile.js';
|
|
4
5
|
import { type ReportRequest, type ReportResponse } from './report.js';
|
|
5
6
|
import { type Signal, type SignalRequest, type SignalResponse } from './signal.js';
|
|
6
|
-
import { type SynthesizeEvent } from './synthesize.js';
|
|
7
|
+
import { type SynthesizeEvent, type SynthesizeItemResponse } from './synthesize.js';
|
|
7
8
|
import { type TokenRequest, type TokenResponse } from './token.js';
|
|
8
|
-
import type {
|
|
9
|
+
import type { SynthesizeItem, SynthesizeItems } from './typeDefs.js';
|
|
9
10
|
/**
|
|
10
|
-
* User-related API methods interface
|
|
11
|
-
* Provides type-safe access to all user API endpoints
|
|
11
|
+
* User-related API methods interface (aligned with OpenAPI spec paths).
|
|
12
12
|
*/
|
|
13
13
|
export interface UserMethods {
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
* Exchanges SSO token for authentication token and sets it for all user methods
|
|
15
|
+
* Exchange SSO token for a BitBitPress token and store it for subsequent calls.
|
|
17
16
|
*
|
|
18
|
-
* @param ssoToken -
|
|
17
|
+
* @param ssoToken - Token from your authentication provider (OIDC)
|
|
19
18
|
* @returns Promise that resolves when authentication is complete
|
|
20
19
|
*/
|
|
21
20
|
authenticate(ssoToken: string): Promise<void>;
|
|
22
21
|
/**
|
|
23
|
-
* Exchange SSO token for
|
|
22
|
+
* Exchange SSO token for a BitBitPress token (returns token without storing it).
|
|
24
23
|
*
|
|
25
|
-
* @param ssoToken -
|
|
26
|
-
* @returns Promise that resolves with
|
|
24
|
+
* @param ssoToken - Token from your authentication provider (OIDC)
|
|
25
|
+
* @returns Promise that resolves with token data (idToken, accessToken, refreshToken, expiresIn)
|
|
27
26
|
*/
|
|
28
27
|
token(ssoToken: TokenRequest['ssoToken']): Promise<TokenResponse>;
|
|
29
28
|
/**
|
|
30
|
-
* Get user profile
|
|
29
|
+
* Get user profile (e.g. suggested interest topics).
|
|
31
30
|
*
|
|
32
|
-
* @returns Promise that resolves with
|
|
31
|
+
* @returns Promise that resolves with profile data (e.g. suggestedInterestTopics)
|
|
33
32
|
*/
|
|
34
33
|
profile(): Promise<NonNullable<ProfileResponse>>;
|
|
35
34
|
/**
|
|
36
|
-
*
|
|
35
|
+
* Retrieve recommended articles for the authenticated user based on their interests.
|
|
37
36
|
*
|
|
38
|
-
* @param options - Optional
|
|
39
|
-
* @returns Promise that resolves with
|
|
37
|
+
* @param options - Optional: limit, cursor, fields (dot/bracket notation for asset fields)
|
|
38
|
+
* @returns Promise that resolves with items (assetId, score, fields) and optional cursor
|
|
40
39
|
*/
|
|
41
40
|
recommendations(options?: RecommendationsRequest): Promise<NonNullable<RecommendationsResponse>>;
|
|
42
41
|
/**
|
|
43
|
-
*
|
|
42
|
+
* Create a user-provided bit to be ingested (e.g. news or content the user wants to share).
|
|
44
43
|
*
|
|
45
|
-
* @param options -
|
|
46
|
-
* @returns Promise that resolves
|
|
44
|
+
* @param options - title (optional) and content (required)
|
|
45
|
+
* @returns Promise that resolves when the report is accepted
|
|
47
46
|
*/
|
|
48
47
|
report(options: ReportRequest): Promise<NonNullable<ReportResponse>>;
|
|
49
48
|
/**
|
|
50
|
-
* Record user signals (e.g. clicked topic, read article) to inform profile
|
|
49
|
+
* Record user signals (e.g. clicked topic, read article) to inform profile and recommendations.
|
|
51
50
|
*
|
|
52
|
-
* @param options -
|
|
53
|
-
* @returns Promise that resolves with
|
|
51
|
+
* @param options - signals array and optional isSynchronous
|
|
52
|
+
* @returns Promise that resolves with response data (recorded: boolean)
|
|
54
53
|
*/
|
|
55
54
|
signal(options: SignalRequest): Promise<NonNullable<SignalResponse>>;
|
|
56
55
|
/**
|
|
57
|
-
* Record a single signal (batched)
|
|
58
|
-
* Signals are batched and sent together after the configured timeout
|
|
56
|
+
* Record a single signal (batched). Signals are sent together after the configured timeout.
|
|
59
57
|
*
|
|
60
58
|
* @param signal - Single signal to record
|
|
61
|
-
* @returns Promise that resolves with
|
|
59
|
+
* @returns Promise that resolves with response data (recorded: boolean)
|
|
62
60
|
*/
|
|
63
61
|
signalItem(signal: Signal): Promise<NonNullable<SignalResponse>>;
|
|
64
62
|
/**
|
|
65
|
-
* Synthesize user
|
|
63
|
+
* Synthesize content items personalized to the user (streaming SSE).
|
|
66
64
|
*
|
|
67
|
-
* @param items - Array of items
|
|
68
|
-
* @
|
|
65
|
+
* @param items - Array of items: optional inputs (type: externalId | text | excludeExternalIds, value), output (schema, optional staleAfter), optional configurationKeyName
|
|
66
|
+
* @param options - Optional: onStreamingData(index, data) called for each streaming data update per item index
|
|
67
|
+
* @returns AsyncIterable yielding connection events (connected, complete) and data events (index, data?, complete, error?)
|
|
69
68
|
*/
|
|
70
|
-
synthesize(items:
|
|
69
|
+
synthesize(items: SynthesizeItems, options?: {
|
|
70
|
+
onStreamingData?: (index: number, data: unknown) => void;
|
|
71
|
+
}): Promise<AsyncIterable<SynthesizeEvent>>;
|
|
71
72
|
/**
|
|
72
|
-
* Synthesize a single item (batched)
|
|
73
|
-
* Items are batched and sent together after the configured timeout
|
|
73
|
+
* Synthesize a single item (batched). Items are sent together after the configured timeout.
|
|
74
74
|
*
|
|
75
75
|
* @param item - Single item to synthesize
|
|
76
|
-
* @
|
|
76
|
+
* @param onStreamingData - Optional: called with streaming data when a stream event has complete: false for this item
|
|
77
|
+
* @returns Promise that resolves with the synthesized data for that item's index
|
|
77
78
|
*/
|
|
78
|
-
synthesizeItem(item:
|
|
79
|
+
synthesizeItem(item: SynthesizeItem, onStreamingData?: SynthesizeOnStreamingData): Promise<SynthesizeItemResponse>;
|
|
79
80
|
}
|
|
80
81
|
/**
|
|
81
82
|
* User-related API methods
|
package/dist/user/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/user/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/user/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAA0B,KAAK,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AACvG,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC7B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAa,KAAK,aAAa,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AACjF,OAAO,EAAgB,KAAK,MAAM,EAAE,KAAK,aAAa,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAEjG,OAAO,EAAc,KAAK,eAAe,EAAE,KAAK,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAChG,OAAO,EAAiB,KAAK,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAClF,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErE;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;;;;OAKG;IACH,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9C;;;;;OAKG;IACH,KAAK,CAAC,QAAQ,EAAE,YAAY,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IAElE;;;;OAIG;IACH,OAAO,IAAI,OAAO,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC,CAAC;IAEjD;;;;;OAKG;IACH,eAAe,CAAC,OAAO,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,WAAW,CAAC,uBAAuB,CAAC,CAAC,CAAC;IAEjG;;;;;OAKG;IACH,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,CAAC;IAErE;;;;;OAKG;IACH,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,CAAC;IAErE;;;;;OAKG;IACH,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,CAAC;IAEjE;;;;;;OAMG;IACH,UAAU,CACR,KAAK,EAAE,eAAe,EACtB,OAAO,CAAC,EAAE;QAAE,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;KAAE,GACrE,OAAO,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC,CAAC;IAE3C;;;;;;OAMG;IACH,cAAc,CACZ,IAAI,EAAE,cAAc,EACpB,eAAe,CAAC,EAAE,yBAAyB,GAC1C,OAAO,CAAC,sBAAsB,CAAC,CAAC;CACpC;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,aAAa,EACrB,sBAAsB,GAAE,MAAY,EACpC,kBAAkB,GAAE,MAAY,GAC/B,WAAW,CAqFb"}
|
package/dist/user/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createUserMethods = createUserMethods;
|
|
4
|
-
const
|
|
4
|
+
const synthesize_batch_manager_js_1 = require("./synthesize-batch-manager.js");
|
|
5
5
|
const recommendations_js_1 = require("./recommendations.js");
|
|
6
6
|
const profile_js_1 = require("./profile.js");
|
|
7
7
|
const report_js_1 = require("./report.js");
|
|
@@ -13,37 +13,61 @@ const token_js_1 = require("./token.js");
|
|
|
13
13
|
* User-related API methods
|
|
14
14
|
*/
|
|
15
15
|
function createUserMethods(config, synthesizeBatchTimeout = 250, signalBatchTimeout = 250) {
|
|
16
|
-
// Store token in closure -
|
|
16
|
+
// Store token and last SSO token in closure - set by authenticate
|
|
17
17
|
let userToken;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const synthesizeBatchManager = new batch_manager_js_1.SynthesizeBatchManager(getConfigWithToken(), synthesizeBatchTimeout);
|
|
24
|
-
const signalBatchManager = new signal_batch_manager_js_1.SignalBatchManager(getConfigWithToken(), signalBatchTimeout);
|
|
25
|
-
return {
|
|
26
|
-
async authenticate(ssoToken) {
|
|
18
|
+
let lastSsoToken;
|
|
19
|
+
let tokenExpiresAt; // ms timestamp
|
|
20
|
+
/** Exchange SSO token and store access token + expiry. Returns true if a token was stored. */
|
|
21
|
+
const exchangeAndStoreToken = async (ssoToken) => {
|
|
22
|
+
try {
|
|
27
23
|
const tokenResponse = await (0, token_js_1.exchangeToken)(config, ssoToken);
|
|
28
|
-
const accessToken = tokenResponse?.idToken
|
|
24
|
+
const accessToken = tokenResponse?.idToken ?? tokenResponse?.accessToken;
|
|
29
25
|
if (accessToken) {
|
|
30
26
|
userToken = accessToken;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
const expiresIn = tokenResponse?.expiresIn;
|
|
28
|
+
tokenExpiresAt =
|
|
29
|
+
typeof expiresIn === 'number'
|
|
30
|
+
? Date.now() + expiresIn * 1000
|
|
31
|
+
: undefined;
|
|
32
|
+
return true;
|
|
34
33
|
}
|
|
35
|
-
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
// Exchange failed
|
|
37
|
+
}
|
|
38
|
+
return false;
|
|
39
|
+
};
|
|
40
|
+
/** Returns config with current token. If token is missing or expired, attempts to re-authenticate with lastSsoToken. */
|
|
41
|
+
const getConfigWithToken = async () => {
|
|
42
|
+
const now = Date.now();
|
|
43
|
+
const missingOrExpired = userToken === undefined ||
|
|
44
|
+
(tokenExpiresAt !== undefined && now >= tokenExpiresAt);
|
|
45
|
+
if (missingOrExpired && lastSsoToken !== undefined) {
|
|
46
|
+
await exchangeAndStoreToken(lastSsoToken);
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
...config,
|
|
50
|
+
token: userToken,
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
const synthesizeBatchManager = new synthesize_batch_manager_js_1.SynthesizeBatchManager(getConfigWithToken, synthesizeBatchTimeout);
|
|
54
|
+
const signalBatchManager = new signal_batch_manager_js_1.SignalBatchManager(getConfigWithToken, signalBatchTimeout);
|
|
55
|
+
return {
|
|
56
|
+
async authenticate(ssoToken) {
|
|
57
|
+
lastSsoToken = ssoToken;
|
|
58
|
+
const stored = await exchangeAndStoreToken(ssoToken);
|
|
59
|
+
if (!stored) {
|
|
36
60
|
throw new Error('Token exchange failed: no access token in response');
|
|
37
61
|
}
|
|
38
62
|
},
|
|
39
63
|
token: (ssoToken) => (0, token_js_1.exchangeToken)(config, ssoToken),
|
|
40
|
-
profile: () => (
|
|
41
|
-
recommendations: (options) => (0, recommendations_js_1.getRecommendations)(
|
|
42
|
-
report: (options) => (0, report_js_1.reportBit)(
|
|
43
|
-
signal: (options) => (0, signal_js_1.recordSignal)(
|
|
64
|
+
profile: () => getConfigWithToken().then(profile_js_1.getProfile),
|
|
65
|
+
recommendations: (options) => getConfigWithToken().then((cfg) => (0, recommendations_js_1.getRecommendations)(cfg, options)),
|
|
66
|
+
report: (options) => getConfigWithToken().then((cfg) => (0, report_js_1.reportBit)(cfg, options)),
|
|
67
|
+
signal: (options) => getConfigWithToken().then((cfg) => (0, signal_js_1.recordSignal)(cfg, options)),
|
|
44
68
|
signalItem: (signal) => signalBatchManager.addSignal(signal),
|
|
45
|
-
synthesize: (items) => (0, synthesize_js_1.synthesize)(
|
|
46
|
-
synthesizeItem: (item) => synthesizeBatchManager.addItem(item),
|
|
69
|
+
synthesize: (items, options) => getConfigWithToken().then((cfg) => (0, synthesize_js_1.synthesize)(cfg, items, options)),
|
|
70
|
+
synthesizeItem: (item, onStreamingData) => synthesizeBatchManager.addItem(item, onStreamingData),
|
|
47
71
|
};
|
|
48
72
|
}
|
|
49
73
|
//# sourceMappingURL=index.js.map
|
package/dist/user/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/user/index.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/user/index.ts"],"names":[],"mappings":";;AAsGA,8CAyFC;AA9LD,+EAAuG;AACvG,6DAI8B;AAC9B,6CAAgE;AAChE,2CAAiF;AACjF,2CAAiG;AACjG,uEAA+D;AAC/D,mDAAgG;AAChG,yCAAkF;AAuFlF;;GAEG;AACH,SAAgB,iBAAiB,CAC/B,MAAqB,EACrB,yBAAiC,GAAG,EACpC,qBAA6B,GAAG;IAEhC,kEAAkE;IAClE,IAAI,SAA6B,CAAC;IAClC,IAAI,YAAgC,CAAC;IACrC,IAAI,cAAkC,CAAC,CAAC,eAAe;IAEvD,8FAA8F;IAC9F,MAAM,qBAAqB,GAAG,KAAK,EAAE,QAAgB,EAAoB,EAAE;QACzE,IAAI,CAAC;YACH,MAAM,aAAa,GAAG,MAAM,IAAA,wBAAa,EAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YAC5D,MAAM,WAAW,GAAG,aAAa,EAAE,OAAO,IAAI,aAAa,EAAE,WAAW,CAAC;YACzE,IAAI,WAAW,EAAE,CAAC;gBAChB,SAAS,GAAG,WAAW,CAAC;gBACxB,MAAM,SAAS,GAAG,aAAa,EAAE,SAAS,C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E,GAAG,EAAE,CAAC,kBAAkB,EAAE,CAAC,IAAI,CAAC,uBAAU,CAAC;QAEpD,eAAe,EAAE,CAAC,OAAgC,EAAE,EAAE,CACpD,kBAAkB,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,uCAAkB,EAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAEtE,MAAM,EAAE,CAAC,OAAsB,EAAE,EAAE,CACjC,kBAAkB,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,qBAAS,EAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAE7D,MAAM,EAAE,CAAC,OAAsB,EAAE,EAAE,CACjC,kBAAkB,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,wBAAY,EAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAEhE,UAAU,EAAE,CAAC,MAAc,EAAwC,EAAE,CACnE,kBAAkB,CAAC,SAAS,CAAC,MAAM,CAAC;QAEtC,UAAU,EAAE,CAAC,KAAsB,EAAE,OAAsE,EAAE,EAAE,CAC7G,kBAAkB,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,0BAAU,EAAC,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QAErE,cAAc,EAAE,CACd,IAAoB,EACpB,eAA2C,EACV,EAAE,CAAC,sBAAsB,CAAC,OAAO,CAAC,IAAI,EAAE,eAAe,CAAC;KAC5F,CAAC;AACJ,CAAC"}
|
package/dist/user/profile.d.ts
CHANGED
|
@@ -2,10 +2,10 @@ import type { paths } from '../generated/openapi.js';
|
|
|
2
2
|
import type { RequestConfig } from '../request.js';
|
|
3
3
|
export type ProfileResponse = paths['/v1/user/profile']['get']['responses'][200]['content']['application/json']['data'];
|
|
4
4
|
/**
|
|
5
|
-
* Get user profile information
|
|
5
|
+
* Get user profile information (e.g. suggested interest topics).
|
|
6
6
|
*
|
|
7
7
|
* @param config - Request configuration with base URL, timeout, fetch, and optional token
|
|
8
|
-
* @returns Promise that resolves with
|
|
8
|
+
* @returns Promise that resolves with profile data (`suggestedInterestTopics` per OpenAPI)
|
|
9
9
|
*/
|
|
10
10
|
export declare function getProfile(config: RequestConfig): Promise<NonNullable<ProfileResponse>>;
|
|
11
11
|
//# sourceMappingURL=profile.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../src/user/profile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAInD,MAAM,MAAM,eAAe,GACzB,KAAK,CAAC,kBAAkB,CAAC,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5F;;;;;GAKG;AACH,wBAAsB,UAAU,CAC9B,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../src/user/profile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAInD,MAAM,MAAM,eAAe,GACzB,KAAK,CAAC,kBAAkB,CAAC,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5F;;;;;GAKG;AACH,wBAAsB,UAAU,CAC9B,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC,CAWvC"}
|
package/dist/user/profile.js
CHANGED
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getProfile = getProfile;
|
|
4
4
|
const request_js_1 = require("../request.js");
|
|
5
5
|
/**
|
|
6
|
-
* Get user profile information
|
|
6
|
+
* Get user profile information (e.g. suggested interest topics).
|
|
7
7
|
*
|
|
8
8
|
* @param config - Request configuration with base URL, timeout, fetch, and optional token
|
|
9
|
-
* @returns Promise that resolves with
|
|
9
|
+
* @returns Promise that resolves with profile data (`suggestedInterestTopics` per OpenAPI)
|
|
10
10
|
*/
|
|
11
11
|
async function getProfile(config) {
|
|
12
12
|
const response = await (0, request_js_1.makeRequest)(config, {
|
package/dist/user/profile.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile.js","sourceRoot":"","sources":["../../src/user/profile.ts"],"names":[],"mappings":";;AAcA,
|
|
1
|
+
{"version":3,"file":"profile.js","sourceRoot":"","sources":["../../src/user/profile.ts"],"names":[],"mappings":";;AAcA,gCAaC;AAzBD,8CAA4C;AAM5C;;;;;GAKG;AACI,KAAK,UAAU,UAAU,CAC9B,MAAqB;IAErB,MAAM,QAAQ,GAAG,MAAM,IAAA,wBAAW,EAAkB,MAAM,EAAE;QAC1D,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,kBAAkB;KACzB,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAChE,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -1,21 +1,14 @@
|
|
|
1
1
|
import type { paths } from '../generated/openapi.js';
|
|
2
2
|
import type { RequestConfig } from '../request.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
'application/json': infer U;
|
|
6
|
-
};
|
|
7
|
-
} ? U : RB extends {
|
|
8
|
-
content?: {
|
|
9
|
-
'application/json': infer U;
|
|
10
|
-
};
|
|
11
|
-
} ? U : never : never;
|
|
3
|
+
import type { RecommendationsRequestBody } from './typeDefs.js';
|
|
4
|
+
export type RecommendationsRequest = RecommendationsRequestBody;
|
|
12
5
|
export type RecommendationsResponse = paths['/v1/user/recommendations']['post']['responses'][200]['content']['application/json']['data'];
|
|
13
6
|
/**
|
|
14
|
-
*
|
|
7
|
+
* Retrieve recommended articles for the authenticated user based on their interests.
|
|
15
8
|
*
|
|
16
9
|
* @param config - Request configuration with base URL, timeout, fetch, and optional token
|
|
17
|
-
* @param options - Optional
|
|
18
|
-
* @returns Promise that resolves with
|
|
10
|
+
* @param options - Optional: limit, cursor, and fields (dot/bracket notation for asset fields)
|
|
11
|
+
* @returns Promise that resolves with items (assetId, score, fields) and optional cursor
|
|
19
12
|
*/
|
|
20
13
|
export declare function getRecommendations(config: RequestConfig, options?: RecommendationsRequest): Promise<NonNullable<RecommendationsResponse>>;
|
|
21
14
|
//# sourceMappingURL=recommendations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recommendations.d.ts","sourceRoot":"","sources":["../../src/user/recommendations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"recommendations.d.ts","sourceRoot":"","sources":["../../src/user/recommendations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAEhE,MAAM,MAAM,sBAAsB,GAAG,0BAA0B,CAAC;AAChE,MAAM,MAAM,uBAAuB,GACjC,KAAK,CAAC,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAErG;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,aAAa,EACrB,OAAO,CAAC,EAAE,sBAAsB,GAC/B,OAAO,CAAC,WAAW,CAAC,uBAAuB,CAAC,CAAC,CAY/C"}
|
|
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getRecommendations = getRecommendations;
|
|
4
4
|
const request_js_1 = require("../request.js");
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Retrieve recommended articles for the authenticated user based on their interests.
|
|
7
7
|
*
|
|
8
8
|
* @param config - Request configuration with base URL, timeout, fetch, and optional token
|
|
9
|
-
* @param options - Optional
|
|
10
|
-
* @returns Promise that resolves with
|
|
9
|
+
* @param options - Optional: limit, cursor, and fields (dot/bracket notation for asset fields)
|
|
10
|
+
* @returns Promise that resolves with items (assetId, score, fields) and optional cursor
|
|
11
11
|
*/
|
|
12
12
|
async function getRecommendations(config, options) {
|
|
13
13
|
const response = await (0, request_js_1.makeRequest)(config, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recommendations.js","sourceRoot":"","sources":["../../src/user/recommendations.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"recommendations.js","sourceRoot":"","sources":["../../src/user/recommendations.ts"],"names":[],"mappings":";;AAgBA,gDAeC;AA7BD,8CAA4C;AAO5C;;;;;;GAMG;AACI,KAAK,UAAU,kBAAkB,CACtC,MAAqB,EACrB,OAAgC;IAEhC,MAAM,QAAQ,GAAG,MAAM,IAAA,wBAAW,EAA0B,MAAM,EAAE;QAClE,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,0BAA0B;QAChC,IAAI,EAAE,OAAO;KACd,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;IACxE,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
package/dist/user/report.d.ts
CHANGED
|
@@ -3,11 +3,11 @@ import type { RequestConfig } from '../request.js';
|
|
|
3
3
|
export type ReportRequest = paths['/v1/user/report']['post']['requestBody']['content']['application/json'];
|
|
4
4
|
export type ReportResponse = paths['/v1/user/report']['post']['responses'][200]['content']['application/json']['data'];
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Create a user-provided bit to be ingested (e.g. news or other content the user wants to share).
|
|
7
7
|
*
|
|
8
8
|
* @param config - Request configuration with base URL, timeout, fetch, and optional token
|
|
9
|
-
* @param options -
|
|
10
|
-
* @returns Promise that resolves
|
|
9
|
+
* @param options - title (optional) and content (required)
|
|
10
|
+
* @returns Promise that resolves when the report is accepted
|
|
11
11
|
*/
|
|
12
12
|
export declare function reportBit(config: RequestConfig, options: ReportRequest): Promise<NonNullable<ReportResponse>>;
|
|
13
13
|
//# sourceMappingURL=report.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../src/user/report.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAInD,MAAM,MAAM,aAAa,GACvB,KAAK,CAAC,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC;AACjF,MAAM,MAAM,cAAc,GACxB,KAAK,CAAC,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5F;;;;;;GAMG;AACH,wBAAsB,SAAS,CAC7B,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../src/user/report.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAInD,MAAM,MAAM,aAAa,GACvB,KAAK,CAAC,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC;AACjF,MAAM,MAAM,cAAc,GACxB,KAAK,CAAC,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5F;;;;;;GAMG;AACH,wBAAsB,SAAS,CAC7B,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,CAYtC"}
|
package/dist/user/report.js
CHANGED
|
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.reportBit = reportBit;
|
|
4
4
|
const request_js_1 = require("../request.js");
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Create a user-provided bit to be ingested (e.g. news or other content the user wants to share).
|
|
7
7
|
*
|
|
8
8
|
* @param config - Request configuration with base URL, timeout, fetch, and optional token
|
|
9
|
-
* @param options -
|
|
10
|
-
* @returns Promise that resolves
|
|
9
|
+
* @param options - title (optional) and content (required)
|
|
10
|
+
* @returns Promise that resolves when the report is accepted
|
|
11
11
|
*/
|
|
12
12
|
async function reportBit(config, options) {
|
|
13
13
|
const response = await (0, request_js_1.makeRequest)(config, {
|
package/dist/user/report.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"report.js","sourceRoot":"","sources":["../../src/user/report.ts"],"names":[],"mappings":";;AAiBA,
|
|
1
|
+
{"version":3,"file":"report.js","sourceRoot":"","sources":["../../src/user/report.ts"],"names":[],"mappings":";;AAiBA,8BAeC;AA9BD,8CAA4C;AAQ5C;;;;;;GAMG;AACI,KAAK,UAAU,SAAS,CAC7B,MAAqB,EACrB,OAAsB;IAEtB,MAAM,QAAQ,GAAG,MAAM,IAAA,wBAAW,EAAiB,MAAM,EAAE;QACzD,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,iBAAiB;QACvB,IAAI,EAAE,OAAO;KACd,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;IAC/D,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RequestConfig } from '../request.js';
|
|
2
|
-
import { type Signal } from './signal.js';
|
|
2
|
+
import { type Signal, type SignalResponse } from './signal.js';
|
|
3
3
|
/**
|
|
4
4
|
* Batch manager for signalItem
|
|
5
5
|
* Batches individual signals and sends them together after the timeout
|
|
@@ -7,16 +7,14 @@ import { type Signal } from './signal.js';
|
|
|
7
7
|
export declare class SignalBatchManager {
|
|
8
8
|
private queue;
|
|
9
9
|
private timer;
|
|
10
|
-
private
|
|
10
|
+
private getConfig;
|
|
11
11
|
private batchTimeout;
|
|
12
|
-
constructor(
|
|
12
|
+
constructor(getConfig: () => Promise<RequestConfig>, batchTimeout: number);
|
|
13
13
|
/**
|
|
14
|
-
* Update the
|
|
14
|
+
* Update the config getter (e.g., when token refresh logic changes)
|
|
15
15
|
*/
|
|
16
16
|
updateConfig(config: RequestConfig): void;
|
|
17
|
-
addSignal(signal: Signal): Promise<
|
|
18
|
-
recorded?: boolean;
|
|
19
|
-
}>;
|
|
17
|
+
addSignal(signal: Signal): Promise<NonNullable<SignalResponse>>;
|
|
20
18
|
private flush;
|
|
21
19
|
}
|
|
22
20
|
//# sourceMappingURL=signal-batch-manager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signal-batch-manager.d.ts","sourceRoot":"","sources":["../../src/user/signal-batch-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"signal-batch-manager.d.ts","sourceRoot":"","sources":["../../src/user/signal-batch-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAgB,KAAK,MAAM,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAkB7E;;;GAGG;AACH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,KAAK,CAIL;IACR,OAAO,CAAC,KAAK,CAAsB;IACnC,OAAO,CAAC,SAAS,CAA+B;IAChD,OAAO,CAAC,YAAY,CAAS;gBAEjB,SAAS,EAAE,MAAM,OAAO,CAAC,aAAa,CAAC,EAAE,YAAY,EAAE,MAAM;IAKzE;;OAEG;IACH,YAAY,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI;IAIzC,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;YAejD,KAAK;CA6BpB"}
|
|
@@ -18,17 +18,17 @@ const clearTimer = getClearTimeout();
|
|
|
18
18
|
class SignalBatchManager {
|
|
19
19
|
queue = [];
|
|
20
20
|
timer = null;
|
|
21
|
-
|
|
21
|
+
getConfig;
|
|
22
22
|
batchTimeout;
|
|
23
|
-
constructor(
|
|
24
|
-
this.
|
|
23
|
+
constructor(getConfig, batchTimeout) {
|
|
24
|
+
this.getConfig = getConfig;
|
|
25
25
|
this.batchTimeout = batchTimeout;
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
|
-
* Update the
|
|
28
|
+
* Update the config getter (e.g., when token refresh logic changes)
|
|
29
29
|
*/
|
|
30
30
|
updateConfig(config) {
|
|
31
|
-
this.
|
|
31
|
+
this.getConfig = () => Promise.resolve(config);
|
|
32
32
|
}
|
|
33
33
|
addSignal(signal) {
|
|
34
34
|
return new Promise((resolve, reject) => {
|
|
@@ -51,9 +51,9 @@ class SignalBatchManager {
|
|
|
51
51
|
this.queue = [];
|
|
52
52
|
this.timer = null;
|
|
53
53
|
try {
|
|
54
|
-
|
|
54
|
+
const config = await this.getConfig();
|
|
55
55
|
const signals = batch.map((b) => b.signal);
|
|
56
|
-
const response = await (0, signal_js_1.recordSignal)(
|
|
56
|
+
const response = await (0, signal_js_1.recordSignal)(config, { signals });
|
|
57
57
|
// Resolve all promises with the same response
|
|
58
58
|
// The API returns a single response for the batch
|
|
59
59
|
for (const { resolve } of batch) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signal-batch-manager.js","sourceRoot":"","sources":["../../src/user/signal-batch-manager.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"signal-batch-manager.js","sourceRoot":"","sources":["../../src/user/signal-batch-manager.ts"],"names":[],"mappings":";;;AACA,2CAA6E;AAE7E,mDAAmD;AACnD,SAAS,aAAa;IACpB,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,SAAS,eAAe;IACtB,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,MAAM,QAAQ,GAAG,aAAa,EAAE,CAAC;AACjC,MAAM,UAAU,GAAG,eAAe,EAAE,CAAC;AAMrC;;;GAGG;AACH,MAAa,kBAAkB;IACrB,KAAK,GAIR,EAAE,CAAC;IACA,KAAK,GAAiB,IAAI,CAAC;IAC3B,SAAS,CAA+B;IACxC,YAAY,CAAS;IAE7B,YAAY,SAAuC,EAAE,YAAoB;QACvE,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC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,EAAE,OAAO,EAAE,IAAI,KAAK,EAAE,CAAC;gBAChC,OAAO,CAAC,QAAQ,CAAC,CAAC;YACpB,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,8BAA8B;YAC9B,MAAM,GAAG,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YACtE,KAAK,MAAM,EAAE,MAAM,EAAE,IAAI,KAAK,EAAE,CAAC;gBAC/B,MAAM,CAAC,GAAG,CAAC,CAAC;YACd,CAAC;QACH,CAAC;IACH,CAAC;CACF;AAlED,gDAkEC"}
|
package/dist/user/signal.d.ts
CHANGED
|
@@ -4,11 +4,11 @@ export type SignalRequest = paths['/v1/user/signal']['post']['requestBody']['con
|
|
|
4
4
|
export type SignalResponse = paths['/v1/user/signal']['post']['responses'][200]['content']['application/json']['data'];
|
|
5
5
|
export type Signal = SignalRequest['signals'][number];
|
|
6
6
|
/**
|
|
7
|
-
* Record user signals (e.g. clicked topic, read article) to inform profile interests
|
|
7
|
+
* Record user signals (e.g. clicked topic, read article) to inform profile interests. Powers recommendations.
|
|
8
8
|
*
|
|
9
9
|
* @param config - Request configuration with base URL, timeout, fetch, and optional token
|
|
10
|
-
* @param options -
|
|
11
|
-
* @returns Promise that resolves with
|
|
10
|
+
* @param options - signals array (signal text, type: active|passive, optional negative, contentContext) and optional isSynchronous
|
|
11
|
+
* @returns Promise that resolves with response data (recorded: boolean)
|
|
12
12
|
*/
|
|
13
13
|
export declare function recordSignal(config: RequestConfig, options: SignalRequest): Promise<NonNullable<SignalResponse>>;
|
|
14
14
|
//# sourceMappingURL=signal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signal.d.ts","sourceRoot":"","sources":["../../src/user/signal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,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,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,CAYtC"}
|
package/dist/user/signal.js
CHANGED
|
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.recordSignal = recordSignal;
|
|
4
4
|
const request_js_1 = require("../request.js");
|
|
5
5
|
/**
|
|
6
|
-
* Record user signals (e.g. clicked topic, read article) to inform profile interests
|
|
6
|
+
* Record user signals (e.g. clicked topic, read article) to inform profile interests. Powers recommendations.
|
|
7
7
|
*
|
|
8
8
|
* @param config - Request configuration with base URL, timeout, fetch, and optional token
|
|
9
|
-
* @param options -
|
|
10
|
-
* @returns Promise that resolves with
|
|
9
|
+
* @param options - signals array (signal text, type: active|passive, optional negative, contentContext) and optional isSynchronous
|
|
10
|
+
* @returns Promise that resolves with response data (recorded: boolean)
|
|
11
11
|
*/
|
|
12
12
|
async function recordSignal(config, options) {
|
|
13
13
|
const response = await (0, request_js_1.makeRequest)(config, {
|
package/dist/user/signal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signal.js","sourceRoot":"","sources":["../../src/user/signal.ts"],"names":[],"mappings":";;AAoBA,
|
|
1
|
+
{"version":3,"file":"signal.js","sourceRoot":"","sources":["../../src/user/signal.ts"],"names":[],"mappings":";;AAoBA,oCAeC;AAjCD,8CAA4C;AAW5C;;;;;;GAMG;AACI,KAAK,UAAU,YAAY,CAChC,MAAqB,EACrB,OAAsB;IAEtB,MAAM,QAAQ,GAAG,MAAM,IAAA,wBAAW,EAAiB,MAAM,EAAE;QACzD,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,iBAAiB;QACvB,IAAI,EAAE,OAAO;KACd,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;IAClE,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { RequestConfig } from '../request.js';
|
|
2
|
+
import { SynthesizeItemResponse } from './synthesize.js';
|
|
3
|
+
import type { SynthesizeItem } from './typeDefs.js';
|
|
4
|
+
/** Callback invoked with streaming data for an item when a stream event has complete: false. */
|
|
5
|
+
export type SynthesizeOnStreamingData = (data: unknown) => void;
|
|
6
|
+
/**
|
|
7
|
+
* Batch manager for synthesizeItem
|
|
8
|
+
* Resolves each item individually based on its index in the response
|
|
9
|
+
*/
|
|
10
|
+
export declare class SynthesizeBatchManager {
|
|
11
|
+
private queue;
|
|
12
|
+
private timer;
|
|
13
|
+
private getConfig;
|
|
14
|
+
private batchTimeout;
|
|
15
|
+
constructor(getConfig: () => Promise<RequestConfig>, batchTimeout: number);
|
|
16
|
+
/**
|
|
17
|
+
* Update the config getter (e.g., when token refresh logic changes)
|
|
18
|
+
*/
|
|
19
|
+
updateConfig(config: RequestConfig): void;
|
|
20
|
+
addItem(item: SynthesizeItem, onStreamingData?: SynthesizeOnStreamingData): Promise<SynthesizeItemResponse>;
|
|
21
|
+
private flush;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=synthesize-batch-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"synthesize-batch-manager.d.ts","sourceRoot":"","sources":["../../src/user/synthesize-batch-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAwB,sBAAsB,EAAc,MAAM,iBAAiB,CAAC;AAC3F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAkBpD,gGAAgG;AAChG,MAAM,MAAM,yBAAyB,GAAG,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;AAEhE;;;GAGG;AACH,qBAAa,sBAAsB;IACjC,OAAO,CAAC,KAAK,CAKL;IACR,OAAO,CAAC,KAAK,CAAsB;IACnC,OAAO,CAAC,SAAS,CAA+B;IAChD,OAAO,CAAC,YAAY,CAAS;gBAEjB,SAAS,EAAE,MAAM,OAAO,CAAC,aAAa,CAAC,EAAE,YAAY,EAAE,MAAM;IAKzE;;OAEG;IACH,YAAY,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI;IAIzC,OAAO,CAAC,IAAI,EAAE,cAAc,EAAE,eAAe,CAAC,EAAE,yBAAyB,GAAG,OAAO,CAAC,sBAAsB,CAAC;YAe7F,KAAK;CAyBpB"}
|