@oxyhq/core 1.11.0 → 1.11.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.
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OxyServicesTopicsMixin = OxyServicesTopicsMixin;
4
+ const mixinHelpers_1 = require("./mixinHelpers");
5
+ function OxyServicesTopicsMixin(Base) {
6
+ return class extends Base {
7
+ constructor(...args) {
8
+ super(...args);
9
+ }
10
+ /**
11
+ * Get top-level topic categories
12
+ * @param locale - Optional locale for translated results
13
+ * @returns List of category topics
14
+ */
15
+ async getTopicCategories(locale) {
16
+ try {
17
+ const params = {};
18
+ if (locale)
19
+ params.locale = locale;
20
+ return await this.makeRequest('GET', '/topics/categories', params, {
21
+ cache: true,
22
+ cacheTTL: mixinHelpers_1.CACHE_TIMES.EXTRA_LONG,
23
+ });
24
+ }
25
+ catch (error) {
26
+ throw this.handleError(error);
27
+ }
28
+ }
29
+ /**
30
+ * Search topics by query string
31
+ * @param query - Search query
32
+ * @param limit - Optional result limit
33
+ * @returns Matching topics
34
+ */
35
+ async searchTopics(query, limit) {
36
+ try {
37
+ const params = { q: query };
38
+ if (limit)
39
+ params.limit = limit;
40
+ return await this.makeRequest('GET', '/topics/search', params, {
41
+ cache: false,
42
+ });
43
+ }
44
+ catch (error) {
45
+ throw this.handleError(error);
46
+ }
47
+ }
48
+ /**
49
+ * List topics with optional filters
50
+ * @param options - Filter and pagination options
51
+ * @returns List of topics
52
+ */
53
+ async listTopics(options) {
54
+ try {
55
+ const params = {};
56
+ if (options?.type)
57
+ params.type = options.type;
58
+ if (options?.q)
59
+ params.q = options.q;
60
+ if (options?.limit)
61
+ params.limit = options.limit;
62
+ if (options?.offset)
63
+ params.offset = options.offset;
64
+ if (options?.locale)
65
+ params.locale = options.locale;
66
+ return await this.makeRequest('GET', '/topics', params, {
67
+ cache: true,
68
+ cacheTTL: mixinHelpers_1.CACHE_TIMES.SHORT,
69
+ });
70
+ }
71
+ catch (error) {
72
+ throw this.handleError(error);
73
+ }
74
+ }
75
+ /**
76
+ * Get a single topic by slug
77
+ * @param slug - Topic slug
78
+ * @returns Topic data
79
+ */
80
+ async getTopicBySlug(slug) {
81
+ try {
82
+ return await this.makeRequest('GET', `/topics/${slug}`, undefined, {
83
+ cache: true,
84
+ cacheTTL: mixinHelpers_1.CACHE_TIMES.LONG,
85
+ });
86
+ }
87
+ catch (error) {
88
+ throw this.handleError(error);
89
+ }
90
+ }
91
+ /**
92
+ * Resolve an array of topic names to existing or newly created topics
93
+ * @param names - Array of { name, type } objects to resolve
94
+ * @returns Resolved topic data
95
+ */
96
+ async resolveTopicNames(names) {
97
+ try {
98
+ return await this.makeRequest('POST', '/topics/resolve', { names }, {
99
+ cache: false,
100
+ });
101
+ }
102
+ catch (error) {
103
+ throw this.handleError(error);
104
+ }
105
+ }
106
+ /**
107
+ * Update metadata for a topic
108
+ * @param slug - Topic slug
109
+ * @param data - Metadata fields to update
110
+ * @returns Updated topic data
111
+ */
112
+ async updateTopicMetadata(slug, data) {
113
+ try {
114
+ return await this.makeRequest('PATCH', `/topics/${slug}`, data, {
115
+ cache: false,
116
+ });
117
+ }
118
+ catch (error) {
119
+ throw this.handleError(error);
120
+ }
121
+ }
122
+ };
123
+ }
@@ -89,11 +89,22 @@ function OxyServicesUserMixin(Base) {
89
89
  }
90
90
  }
91
91
  /**
92
- * Get profile recommendations
92
+ * Resolve (find or create) a non-local user. All user creation for
93
+ * external accounts (federated, agent, automated) goes through this
94
+ * method — calling services never write user data directly.
93
95
  */
94
- async getProfileRecommendations() {
96
+ async resolveExternalUser(data) {
97
+ return this.makeRequest('PUT', '/users/resolve', data);
98
+ }
99
+ /**
100
+ * Get profile recommendations, optionally filtering out specific user types.
101
+ */
102
+ async getProfileRecommendations(options) {
103
+ const params = options?.excludeTypes?.length
104
+ ? { excludeTypes: options.excludeTypes.join(',') }
105
+ : undefined;
95
106
  return this.withAuthRetry(async () => {
96
- return await this.makeRequest('GET', '/profiles/recommendations', undefined, { cache: true });
107
+ return await this.makeRequest('GET', '/profiles/recommendations', params, { cache: true });
97
108
  }, 'getProfileRecommendations');
98
109
  }
99
110
  /**
@@ -26,6 +26,7 @@ const OxyServices_devices_1 = require("./OxyServices.devices");
26
26
  const OxyServices_security_1 = require("./OxyServices.security");
27
27
  const OxyServices_utility_1 = require("./OxyServices.utility");
28
28
  const OxyServices_features_1 = require("./OxyServices.features");
29
+ const OxyServices_topics_1 = require("./OxyServices.topics");
29
30
  /**
30
31
  * Mixin pipeline - applied in order from first to last.
31
32
  *
@@ -62,6 +63,7 @@ const MIXIN_PIPELINE = [
62
63
  OxyServices_devices_1.OxyServicesDevicesMixin,
63
64
  OxyServices_security_1.OxyServicesSecurityMixin,
64
65
  OxyServices_features_1.OxyServicesFeaturesMixin,
66
+ OxyServices_topics_1.OxyServicesTopicsMixin,
65
67
  // Utility (last, can use all above)
66
68
  OxyServices_utility_1.OxyServicesUtilityMixin,
67
69
  ];
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TopicSource = exports.TopicType = void 0;
4
+ var TopicType;
5
+ (function (TopicType) {
6
+ TopicType["CATEGORY"] = "category";
7
+ TopicType["TOPIC"] = "topic";
8
+ TopicType["ENTITY"] = "entity";
9
+ })(TopicType || (exports.TopicType = TopicType = {}));
10
+ var TopicSource;
11
+ (function (TopicSource) {
12
+ TopicSource["SEED"] = "seed";
13
+ TopicSource["AI"] = "ai";
14
+ TopicSource["MANUAL"] = "manual";
15
+ TopicSource["SYSTEM"] = "system";
16
+ })(TopicSource || (exports.TopicSource = TopicSource = {}));