@attrove/sdk 0.1.4 → 0.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.
Files changed (143) hide show
  1. package/cjs/{src/__mocks__ → __mocks__}/version.js +1 -2
  2. package/cjs/{src/admin-client.js → admin-client.js} +23 -22
  3. package/cjs/{src/client.js → client.js} +40 -39
  4. package/cjs/{src/constants.js → constants.js} +18 -19
  5. package/cjs/{src/errors → errors}/index.js +26 -27
  6. package/cjs/{src/index.js → index.js} +35 -36
  7. package/cjs/package.json +1 -56
  8. package/cjs/{src/resources → resources}/conversations.js +1 -2
  9. package/cjs/{src/resources → resources}/index.js +10 -11
  10. package/cjs/{src/resources → resources}/integrations.js +0 -1
  11. package/cjs/{src/resources → resources}/messages.js +3 -4
  12. package/cjs/{src/resources → resources}/query.js +2 -3
  13. package/cjs/{src/resources → resources}/users.js +0 -1
  14. package/cjs/{src/types → types}/index.js +88 -61
  15. package/cjs/{src/utils → utils}/fetch.js +67 -55
  16. package/cjs/{src/utils → utils}/index.js +5 -6
  17. package/cjs/{src/utils → utils}/streaming.js +59 -45
  18. package/cjs/{src/version.js → version.js} +2 -3
  19. package/esm/__mocks__/version.d.ts.map +1 -0
  20. package/esm/{src/__mocks__ → __mocks__}/version.js +1 -1
  21. package/esm/__mocks__/version.js.map +1 -0
  22. package/{types/src → esm}/admin-client.d.ts +2 -2
  23. package/esm/admin-client.d.ts.map +1 -0
  24. package/esm/{src/admin-client.js → admin-client.js} +18 -16
  25. package/esm/admin-client.js.map +1 -0
  26. package/{types/src → esm}/client.d.ts +6 -6
  27. package/esm/client.d.ts.map +1 -0
  28. package/esm/{src/client.js → client.js} +28 -26
  29. package/esm/client.js.map +1 -0
  30. package/esm/constants.d.ts.map +1 -0
  31. package/esm/{src/constants.js → constants.js} +18 -18
  32. package/esm/constants.js.map +1 -0
  33. package/{types/src → esm}/errors/index.d.ts +1 -1
  34. package/{types/src → esm}/errors/index.d.ts.map +1 -1
  35. package/esm/{src/errors → errors}/index.js +13 -13
  36. package/esm/errors/index.js.map +1 -0
  37. package/{types/src → esm}/index.d.ts +14 -14
  38. package/esm/index.d.ts.map +1 -0
  39. package/esm/{src/index.js → index.js} +8 -8
  40. package/esm/index.js.map +1 -0
  41. package/esm/package.json +1 -56
  42. package/{types/src → esm}/resources/conversations.d.ts +2 -2
  43. package/esm/resources/conversations.d.ts.map +1 -0
  44. package/esm/{src/resources → resources}/conversations.js +1 -1
  45. package/esm/resources/conversations.js.map +1 -0
  46. package/esm/resources/index.d.ts +12 -0
  47. package/esm/resources/index.d.ts.map +1 -0
  48. package/esm/resources/index.js +9 -0
  49. package/esm/resources/index.js.map +1 -0
  50. package/{types/src → esm}/resources/integrations.d.ts +2 -2
  51. package/esm/resources/integrations.d.ts.map +1 -0
  52. package/esm/resources/integrations.js.map +1 -0
  53. package/{types/src → esm}/resources/messages.d.ts +2 -2
  54. package/esm/resources/messages.d.ts.map +1 -0
  55. package/esm/{src/resources → resources}/messages.js +3 -3
  56. package/{cjs/src → esm}/resources/messages.js.map +1 -1
  57. package/{types/src → esm}/resources/query.d.ts +2 -2
  58. package/esm/resources/query.d.ts.map +1 -0
  59. package/esm/{src/resources → resources}/query.js +2 -2
  60. package/esm/resources/query.js.map +1 -0
  61. package/{types/src → esm}/resources/users.d.ts +2 -2
  62. package/esm/resources/users.d.ts.map +1 -0
  63. package/esm/resources/users.js.map +1 -0
  64. package/{types/src → esm}/types/index.d.ts +28 -28
  65. package/esm/types/index.d.ts.map +1 -0
  66. package/esm/{src/types → types}/index.js +88 -60
  67. package/esm/types/index.js.map +1 -0
  68. package/{types/src → esm}/utils/fetch.d.ts +10 -10
  69. package/esm/utils/fetch.d.ts.map +1 -0
  70. package/esm/{src/utils → utils}/fetch.js +57 -44
  71. package/esm/utils/fetch.js.map +1 -0
  72. package/esm/utils/index.d.ts +8 -0
  73. package/esm/utils/index.d.ts.map +1 -0
  74. package/esm/utils/index.js +6 -0
  75. package/esm/utils/index.js.map +1 -0
  76. package/{types/src → esm}/utils/streaming.d.ts +5 -5
  77. package/esm/utils/streaming.d.ts.map +1 -0
  78. package/esm/{src/utils → utils}/streaming.js +47 -32
  79. package/esm/utils/streaming.js.map +1 -0
  80. package/esm/version.d.ts.map +1 -0
  81. package/esm/{src/version.js → version.js} +1 -1
  82. package/esm/version.js.map +1 -0
  83. package/package.json +9 -6
  84. package/cjs/README.md +0 -247
  85. package/cjs/src/__mocks__/version.js.map +0 -1
  86. package/cjs/src/admin-client.js.map +0 -1
  87. package/cjs/src/client.js.map +0 -1
  88. package/cjs/src/constants.js.map +0 -1
  89. package/cjs/src/errors/index.js.map +0 -1
  90. package/cjs/src/index.js.map +0 -1
  91. package/cjs/src/resources/conversations.js.map +0 -1
  92. package/cjs/src/resources/index.js.map +0 -1
  93. package/cjs/src/resources/integrations.js.map +0 -1
  94. package/cjs/src/resources/query.js.map +0 -1
  95. package/cjs/src/resources/users.js.map +0 -1
  96. package/cjs/src/types/index.js.map +0 -1
  97. package/cjs/src/utils/fetch.js.map +0 -1
  98. package/cjs/src/utils/index.js.map +0 -1
  99. package/cjs/src/utils/streaming.js.map +0 -1
  100. package/cjs/src/version.js.map +0 -1
  101. package/esm/README.md +0 -247
  102. package/esm/src/__mocks__/version.js.map +0 -1
  103. package/esm/src/admin-client.js.map +0 -1
  104. package/esm/src/client.js.map +0 -1
  105. package/esm/src/constants.js.map +0 -1
  106. package/esm/src/errors/index.js.map +0 -1
  107. package/esm/src/index.js.map +0 -1
  108. package/esm/src/resources/conversations.js.map +0 -1
  109. package/esm/src/resources/index.js +0 -9
  110. package/esm/src/resources/index.js.map +0 -1
  111. package/esm/src/resources/integrations.js.map +0 -1
  112. package/esm/src/resources/messages.js.map +0 -1
  113. package/esm/src/resources/query.js.map +0 -1
  114. package/esm/src/resources/users.js.map +0 -1
  115. package/esm/src/types/index.js.map +0 -1
  116. package/esm/src/utils/fetch.js.map +0 -1
  117. package/esm/src/utils/index.js +0 -6
  118. package/esm/src/utils/index.js.map +0 -1
  119. package/esm/src/utils/streaming.js.map +0 -1
  120. package/esm/src/version.js.map +0 -1
  121. package/types/src/__mocks__/version.d.ts.map +0 -1
  122. package/types/src/admin-client.d.ts.map +0 -1
  123. package/types/src/client.d.ts.map +0 -1
  124. package/types/src/constants.d.ts.map +0 -1
  125. package/types/src/index.d.ts.map +0 -1
  126. package/types/src/resources/conversations.d.ts.map +0 -1
  127. package/types/src/resources/index.d.ts +0 -12
  128. package/types/src/resources/index.d.ts.map +0 -1
  129. package/types/src/resources/integrations.d.ts.map +0 -1
  130. package/types/src/resources/messages.d.ts.map +0 -1
  131. package/types/src/resources/query.d.ts.map +0 -1
  132. package/types/src/resources/users.d.ts.map +0 -1
  133. package/types/src/types/index.d.ts.map +0 -1
  134. package/types/src/utils/fetch.d.ts.map +0 -1
  135. package/types/src/utils/index.d.ts +0 -8
  136. package/types/src/utils/index.d.ts.map +0 -1
  137. package/types/src/utils/streaming.d.ts.map +0 -1
  138. package/types/src/version.d.ts.map +0 -1
  139. /package/{types/src → esm}/__mocks__/version.d.ts +0 -0
  140. /package/{types/src → esm}/constants.d.ts +0 -0
  141. /package/esm/{src/resources → resources}/integrations.js +0 -0
  142. /package/esm/{src/resources → resources}/users.js +0 -0
  143. /package/{types/src → esm}/version.d.ts +0 -0
@@ -7,11 +7,10 @@
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.resetVersionCache = exports.getVersion = void 0;
9
9
  function getVersion() {
10
- return '1.0.0-test';
10
+ return "1.0.0-test";
11
11
  }
12
12
  exports.getVersion = getVersion;
13
13
  function resetVersionCache() {
14
14
  // No-op in mock
15
15
  }
16
16
  exports.resetVersionCache = resetVersionCache;
17
- //# sourceMappingURL=version.js.map
@@ -7,11 +7,11 @@
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.AttroveAdmin = exports.AdminUsersResource = void 0;
10
- const fetch_1 = require("./utils/fetch");
11
- const errors_1 = require("./errors");
12
- const types_1 = require("./types");
13
- const types_2 = require("./types");
14
- const constants_1 = require("./constants");
10
+ const fetch_js_1 = require("./utils/fetch.js");
11
+ const index_js_1 = require("./errors/index.js");
12
+ const index_js_2 = require("./types/index.js");
13
+ const index_js_3 = require("./types/index.js");
14
+ const constants_js_1 = require("./constants.js");
15
15
  /**
16
16
  * Validate the admin client configuration.
17
17
  *
@@ -19,19 +19,21 @@ const constants_1 = require("./constants");
19
19
  */
20
20
  function validateAdminConfig(config) {
21
21
  // Validate clientId
22
- if (!config.clientId || typeof config.clientId !== 'string') {
23
- throw new errors_1.ValidationError('clientId is required and must be a non-empty string', types_1.ErrorCodes.VALIDATION_REQUIRED_FIELD, { field: 'clientId' });
22
+ if (!config.clientId || typeof config.clientId !== "string") {
23
+ throw new index_js_1.ValidationError("clientId is required and must be a non-empty string", index_js_2.ErrorCodes.VALIDATION_REQUIRED_FIELD, { field: "clientId" });
24
24
  }
25
25
  // Validate clientSecret
26
- if (!config.clientSecret || typeof config.clientSecret !== 'string') {
27
- throw new errors_1.ValidationError('clientSecret is required and must be a non-empty string', types_1.ErrorCodes.VALIDATION_REQUIRED_FIELD, { field: 'clientSecret' });
26
+ if (!config.clientSecret || typeof config.clientSecret !== "string") {
27
+ throw new index_js_1.ValidationError("clientSecret is required and must be a non-empty string", index_js_2.ErrorCodes.VALIDATION_REQUIRED_FIELD, { field: "clientSecret" });
28
28
  }
29
29
  // Validate optional fields
30
- if (config.timeout !== undefined && (typeof config.timeout !== 'number' || config.timeout <= 0)) {
31
- throw new errors_1.ValidationError('timeout must be a positive number in milliseconds', types_1.ErrorCodes.VALIDATION_OUT_OF_RANGE, { field: 'timeout', value: config.timeout });
30
+ if (config.timeout !== undefined &&
31
+ (typeof config.timeout !== "number" || config.timeout <= 0)) {
32
+ throw new index_js_1.ValidationError("timeout must be a positive number in milliseconds", index_js_2.ErrorCodes.VALIDATION_OUT_OF_RANGE, { field: "timeout", value: config.timeout });
32
33
  }
33
- if (config.maxRetries !== undefined && (typeof config.maxRetries !== 'number' || config.maxRetries < 0)) {
34
- throw new errors_1.ValidationError('maxRetries must be a non-negative number', types_1.ErrorCodes.VALIDATION_OUT_OF_RANGE, { field: 'maxRetries', value: config.maxRetries });
34
+ if (config.maxRetries !== undefined &&
35
+ (typeof config.maxRetries !== "number" || config.maxRetries < 0)) {
36
+ throw new index_js_1.ValidationError("maxRetries must be a non-negative number", index_js_2.ErrorCodes.VALIDATION_OUT_OF_RANGE, { field: "maxRetries", value: config.maxRetries });
35
37
  }
36
38
  }
37
39
  /**
@@ -86,7 +88,7 @@ class AdminUsersResource {
86
88
  body.role = options.role;
87
89
  // API returns { id, token } but we rename to { id, apiKey } for clarity
88
90
  // Route: POST /v1/users with X-Auth-Type: partner header
89
- const response = await this.http.post('/v1/users', body);
91
+ const response = await this.http.post("/v1/users", body);
90
92
  return {
91
93
  id: response.id,
92
94
  apiKey: response.token,
@@ -119,8 +121,8 @@ class AdminUsersResource {
119
121
  */
120
122
  async createConnectToken(userId) {
121
123
  // Validate userId format
122
- if (!(0, types_2.isValidUUID)(userId)) {
123
- throw new errors_1.ValidationError('userId must be a valid UUID format', types_1.ErrorCodes.VALIDATION_INVALID_FORMAT, { field: 'userId', expected: 'UUID format' });
124
+ if (!(0, index_js_3.isValidUUID)(userId)) {
125
+ throw new index_js_1.ValidationError("userId must be a valid UUID format", index_js_2.ErrorCodes.VALIDATION_INVALID_FORMAT, { field: "userId", expected: "UUID format" });
124
126
  }
125
127
  const body = {
126
128
  client_id: this.clientId,
@@ -148,7 +150,7 @@ class AdminUsersResource {
148
150
  */
149
151
  async delete(userId) {
150
152
  // TODO: Implement user deletion endpoint
151
- throw new Error('User deletion not yet implemented. This feature is coming soon.');
153
+ throw new Error("User deletion not yet implemented. This feature is coming soon.");
152
154
  }
153
155
  }
154
156
  exports.AdminUsersResource = AdminUsersResource;
@@ -200,12 +202,12 @@ class AttroveAdmin {
200
202
  this.config = {
201
203
  clientId: config.clientId,
202
204
  clientSecret: config.clientSecret,
203
- baseUrl: config.baseUrl ?? constants_1.DEFAULT_BASE_URL,
204
- timeout: config.timeout ?? constants_1.DEFAULT_TIMEOUT,
205
- maxRetries: config.maxRetries ?? constants_1.DEFAULT_MAX_RETRIES,
205
+ baseUrl: config.baseUrl ?? constants_js_1.DEFAULT_BASE_URL,
206
+ timeout: config.timeout ?? constants_js_1.DEFAULT_TIMEOUT,
207
+ maxRetries: config.maxRetries ?? constants_js_1.DEFAULT_MAX_RETRIES,
206
208
  onRetry: config.onRetry,
207
209
  };
208
- this.http = new fetch_1.HttpClient({
210
+ this.http = new fetch_js_1.HttpClient({
209
211
  baseUrl: this.config.baseUrl,
210
212
  clientId: this.config.clientId,
211
213
  clientSecret: this.config.clientSecret,
@@ -218,4 +220,3 @@ class AttroveAdmin {
218
220
  }
219
221
  }
220
222
  exports.AttroveAdmin = AttroveAdmin;
221
- //# sourceMappingURL=admin-client.js.map
@@ -7,17 +7,17 @@
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.Attrove = void 0;
10
- const fetch_1 = require("./utils/fetch");
11
- const streaming_1 = require("./utils/streaming");
12
- const users_1 = require("./resources/users");
13
- const messages_1 = require("./resources/messages");
14
- const conversations_1 = require("./resources/conversations");
15
- const integrations_1 = require("./resources/integrations");
16
- const query_1 = require("./resources/query");
17
- const errors_1 = require("./errors");
18
- const types_1 = require("./types");
19
- const types_2 = require("./types");
20
- const constants_1 = require("./constants");
10
+ const fetch_js_1 = require("./utils/fetch.js");
11
+ const streaming_js_1 = require("./utils/streaming.js");
12
+ const users_js_1 = require("./resources/users.js");
13
+ const messages_js_1 = require("./resources/messages.js");
14
+ const conversations_js_1 = require("./resources/conversations.js");
15
+ const integrations_js_1 = require("./resources/integrations.js");
16
+ const query_js_1 = require("./resources/query.js");
17
+ const index_js_1 = require("./errors/index.js");
18
+ const index_js_2 = require("./types/index.js");
19
+ const index_js_3 = require("./types/index.js");
20
+ const constants_js_1 = require("./constants.js");
21
21
  /**
22
22
  * Validate the Attrove client configuration.
23
23
  *
@@ -25,25 +25,27 @@ const constants_1 = require("./constants");
25
25
  */
26
26
  function validateConfig(config) {
27
27
  // Validate apiKey
28
- if (!config.apiKey || typeof config.apiKey !== 'string') {
29
- throw new errors_1.ValidationError('apiKey is required and must be a non-empty string', types_1.ErrorCodes.VALIDATION_REQUIRED_FIELD, { field: 'apiKey' });
28
+ if (!config.apiKey || typeof config.apiKey !== "string") {
29
+ throw new index_js_1.ValidationError("apiKey is required and must be a non-empty string", index_js_2.ErrorCodes.VALIDATION_REQUIRED_FIELD, { field: "apiKey" });
30
30
  }
31
- if (!config.apiKey.startsWith('sk_')) {
32
- throw new errors_1.ValidationError('apiKey must start with "sk_" prefix. Make sure you are using a valid API key.', types_1.ErrorCodes.VALIDATION_INVALID_FORMAT, { field: 'apiKey', expected: 'sk_...' });
31
+ if (!config.apiKey.startsWith("sk_")) {
32
+ throw new index_js_1.ValidationError('apiKey must start with "sk_" prefix. Make sure you are using a valid API key.', index_js_2.ErrorCodes.VALIDATION_INVALID_FORMAT, { field: "apiKey", expected: "sk_..." });
33
33
  }
34
34
  // Validate userId
35
- if (!config.userId || typeof config.userId !== 'string') {
36
- throw new errors_1.ValidationError('userId is required and must be a non-empty string', types_1.ErrorCodes.VALIDATION_REQUIRED_FIELD, { field: 'userId' });
35
+ if (!config.userId || typeof config.userId !== "string") {
36
+ throw new index_js_1.ValidationError("userId is required and must be a non-empty string", index_js_2.ErrorCodes.VALIDATION_REQUIRED_FIELD, { field: "userId" });
37
37
  }
38
- if (!(0, types_2.isValidUUID)(config.userId)) {
39
- throw new errors_1.ValidationError('userId must be a valid UUID format (e.g., "123e4567-e89b-12d3-a456-426614174000")', types_1.ErrorCodes.VALIDATION_INVALID_FORMAT, { field: 'userId', expected: 'UUID format' });
38
+ if (!(0, index_js_3.isValidUUID)(config.userId)) {
39
+ throw new index_js_1.ValidationError('userId must be a valid UUID format (e.g., "123e4567-e89b-12d3-a456-426614174000")', index_js_2.ErrorCodes.VALIDATION_INVALID_FORMAT, { field: "userId", expected: "UUID format" });
40
40
  }
41
41
  // Validate optional fields
42
- if (config.timeout !== undefined && (typeof config.timeout !== 'number' || config.timeout <= 0)) {
43
- throw new errors_1.ValidationError('timeout must be a positive number in milliseconds', types_1.ErrorCodes.VALIDATION_OUT_OF_RANGE, { field: 'timeout', value: config.timeout });
42
+ if (config.timeout !== undefined &&
43
+ (typeof config.timeout !== "number" || config.timeout <= 0)) {
44
+ throw new index_js_1.ValidationError("timeout must be a positive number in milliseconds", index_js_2.ErrorCodes.VALIDATION_OUT_OF_RANGE, { field: "timeout", value: config.timeout });
44
45
  }
45
- if (config.maxRetries !== undefined && (typeof config.maxRetries !== 'number' || config.maxRetries < 0)) {
46
- throw new errors_1.ValidationError('maxRetries must be a non-negative number', types_1.ErrorCodes.VALIDATION_OUT_OF_RANGE, { field: 'maxRetries', value: config.maxRetries });
46
+ if (config.maxRetries !== undefined &&
47
+ (typeof config.maxRetries !== "number" || config.maxRetries < 0)) {
48
+ throw new index_js_1.ValidationError("maxRetries must be a non-negative number", index_js_2.ErrorCodes.VALIDATION_OUT_OF_RANGE, { field: "maxRetries", value: config.maxRetries });
47
49
  }
48
50
  }
49
51
  /**
@@ -94,12 +96,12 @@ class Attrove {
94
96
  this.config = {
95
97
  apiKey: config.apiKey,
96
98
  userId: config.userId,
97
- baseUrl: config.baseUrl ?? constants_1.DEFAULT_BASE_URL,
98
- timeout: config.timeout ?? constants_1.DEFAULT_TIMEOUT,
99
- maxRetries: config.maxRetries ?? constants_1.DEFAULT_MAX_RETRIES,
99
+ baseUrl: config.baseUrl ?? constants_js_1.DEFAULT_BASE_URL,
100
+ timeout: config.timeout ?? constants_js_1.DEFAULT_TIMEOUT,
101
+ maxRetries: config.maxRetries ?? constants_js_1.DEFAULT_MAX_RETRIES,
100
102
  onRetry: config.onRetry,
101
103
  };
102
- this.http = new fetch_1.HttpClient({
104
+ this.http = new fetch_js_1.HttpClient({
103
105
  baseUrl: this.config.baseUrl,
104
106
  apiKey: this.config.apiKey,
105
107
  userId: this.config.userId,
@@ -108,11 +110,11 @@ class Attrove {
108
110
  onRetry: this.config.onRetry,
109
111
  });
110
112
  // Initialize resources
111
- this.users = new users_1.UsersResource(this.http, this.config.userId);
112
- this.messages = new messages_1.MessagesResource(this.http, this.config.userId);
113
- this.conversations = new conversations_1.ConversationsResource(this.http, this.config.userId);
114
- this.integrations = new integrations_1.IntegrationsResource(this.http, this.config.userId);
115
- this.queryResource = new query_1.QueryResource(this.http, this.config.userId);
113
+ this.users = new users_js_1.UsersResource(this.http, this.config.userId);
114
+ this.messages = new messages_js_1.MessagesResource(this.http, this.config.userId);
115
+ this.conversations = new conversations_js_1.ConversationsResource(this.http, this.config.userId);
116
+ this.integrations = new integrations_js_1.IntegrationsResource(this.http, this.config.userId);
117
+ this.queryResource = new query_js_1.QueryResource(this.http, this.config.userId);
116
118
  }
117
119
  /**
118
120
  * Query the user's unified context with AI.
@@ -214,7 +216,7 @@ class Attrove {
214
216
  // Add the user's prompt to history
215
217
  const fullHistory = [
216
218
  ...history,
217
- { role: 'user', content: prompt },
219
+ { role: "user", content: prompt },
218
220
  ];
219
221
  // Extract query options (separate from stream options)
220
222
  const queryOptions = {
@@ -224,9 +226,9 @@ class Attrove {
224
226
  allowBotMessages,
225
227
  includeSources,
226
228
  };
227
- const streaming = new streaming_1.StreamingClient(this.config.baseUrl, this.config.apiKey);
229
+ const streaming = new streaming_js_1.StreamingClient(this.config.baseUrl, this.config.apiKey);
228
230
  try {
229
- const messageId = (0, streaming_1.generateMessageId)();
231
+ const messageId = (0, streaming_js_1.generateMessageId)();
230
232
  return await streaming.stream(prompt, messageId, fullHistory, queryOptions, streamOptions);
231
233
  }
232
234
  finally {
@@ -256,7 +258,7 @@ class Attrove {
256
258
  */
257
259
  async brief(meetingId) {
258
260
  // TODO: Implement meeting brief endpoint
259
- throw new Error('Meeting brief not yet implemented. This feature is coming soon.');
261
+ throw new Error("Meeting brief not yet implemented. This feature is coming soon.");
260
262
  }
261
263
  /**
262
264
  * Get information about an entity (person, company, etc.).
@@ -280,7 +282,7 @@ class Attrove {
280
282
  */
281
283
  async entity(entityId) {
282
284
  // TODO: Implement entity endpoint
283
- throw new Error('Entity lookup not yet implemented. This feature is coming soon.');
285
+ throw new Error("Entity lookup not yet implemented. This feature is coming soon.");
284
286
  }
285
287
  /**
286
288
  * Get a conversation thread.
@@ -305,8 +307,7 @@ class Attrove {
305
307
  */
306
308
  async thread(conversationId) {
307
309
  // TODO: Implement thread endpoint
308
- throw new Error('Thread retrieval not yet implemented. This feature is coming soon.');
310
+ throw new Error("Thread retrieval not yet implemented. This feature is coming soon.");
309
311
  }
310
312
  }
311
313
  exports.Attrove = Attrove;
312
- //# sourceMappingURL=client.js.map
@@ -14,11 +14,11 @@ exports.getWsCloseReason = exports.WS_CLOSE_CODES = exports.RETRYABLE_STATUS_SET
14
14
  * the version in package.json. For programmatic access, use `getVersion()`
15
15
  * from './version'.
16
16
  */
17
- exports.SDK_VERSION = '0.1.3';
17
+ exports.SDK_VERSION = "0.1.3";
18
18
  /**
19
19
  * Default API base URL for Attrove services.
20
20
  */
21
- exports.DEFAULT_BASE_URL = 'https://api.attrove.com';
21
+ exports.DEFAULT_BASE_URL = "https://api.attrove.com";
22
22
  /**
23
23
  * Default request timeout in milliseconds.
24
24
  */
@@ -43,27 +43,26 @@ exports.RETRYABLE_STATUS_SET = new Set(exports.RETRY_STATUS_CODES);
43
43
  * WebSocket close code descriptions for better error messages.
44
44
  */
45
45
  exports.WS_CLOSE_CODES = {
46
- 1000: 'Normal closure',
47
- 1001: 'Server going away',
48
- 1002: 'Protocol error',
49
- 1003: 'Unsupported data type',
50
- 1005: 'No status code received',
51
- 1006: 'Connection lost abnormally (no close frame)',
52
- 1007: 'Invalid frame payload data',
53
- 1008: 'Policy violation',
54
- 1009: 'Message too large',
55
- 1010: 'Missing expected extension',
56
- 1011: 'Internal server error',
57
- 1012: 'Service restart',
58
- 1013: 'Try again later',
59
- 1014: 'Bad gateway',
60
- 1015: 'TLS handshake failure',
46
+ 1000: "Normal closure",
47
+ 1001: "Server going away",
48
+ 1002: "Protocol error",
49
+ 1003: "Unsupported data type",
50
+ 1005: "No status code received",
51
+ 1006: "Connection lost abnormally (no close frame)",
52
+ 1007: "Invalid frame payload data",
53
+ 1008: "Policy violation",
54
+ 1009: "Message too large",
55
+ 1010: "Missing expected extension",
56
+ 1011: "Internal server error",
57
+ 1012: "Service restart",
58
+ 1013: "Try again later",
59
+ 1014: "Bad gateway",
60
+ 1015: "TLS handshake failure",
61
61
  };
62
62
  /**
63
63
  * Get a human-readable description for a WebSocket close code.
64
64
  */
65
65
  function getWsCloseReason(code) {
66
- return exports.WS_CLOSE_CODES[code] || 'Unknown close reason';
66
+ return exports.WS_CLOSE_CODES[code] || "Unknown close reason";
67
67
  }
68
68
  exports.getWsCloseReason = getWsCloseReason;
69
- //# sourceMappingURL=constants.js.map
@@ -7,7 +7,7 @@
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.isServerError = exports.isTimeoutError = exports.isNetworkError = exports.isRateLimitError = exports.isValidationError = exports.isNotFoundError = exports.isAuthorizationError = exports.isAuthenticationError = exports.isAttroveError = exports.createErrorFromStatus = exports.ServerError = exports.TimeoutError = exports.NetworkError = exports.RateLimitError = exports.ValidationError = exports.NotFoundError = exports.AuthorizationError = exports.AuthenticationError = exports.AttroveError = void 0;
10
- const types_1 = require("../types");
10
+ const index_js_1 = require("../types/index.js");
11
11
  /**
12
12
  * Base error class for all Attrove SDK errors.
13
13
  *
@@ -29,7 +29,7 @@ const types_1 = require("../types");
29
29
  class AttroveError extends Error {
30
30
  constructor(message, code, status, details) {
31
31
  super(message);
32
- this.name = 'AttroveError';
32
+ this.name = "AttroveError";
33
33
  this.code = code;
34
34
  this.status = status;
35
35
  this.details = details;
@@ -47,8 +47,8 @@ class AttroveError extends Error {
47
47
  * @returns An AttroveError instance
48
48
  */
49
49
  static fromApiError(error, status) {
50
- if (typeof error === 'string') {
51
- return new AttroveError(error, types_1.ErrorCodes.INTERNAL_ERROR, status);
50
+ if (typeof error === "string") {
51
+ return new AttroveError(error, index_js_1.ErrorCodes.INTERNAL_ERROR, status);
52
52
  }
53
53
  return new AttroveError(error.message, error.code, status, error.details);
54
54
  }
@@ -61,7 +61,7 @@ class AttroveError extends Error {
61
61
  parts.push(`Code: ${this.code}`);
62
62
  if (this.status)
63
63
  parts.push(`Status: ${this.status}`);
64
- return parts.join(' | ');
64
+ return parts.join(" | ");
65
65
  }
66
66
  /**
67
67
  * Returns a JSON-serializable representation of the error.
@@ -88,9 +88,9 @@ exports.AttroveError = AttroveError;
88
88
  * @throws {AuthenticationError}
89
89
  */
90
90
  class AuthenticationError extends AttroveError {
91
- constructor(message, code = types_1.ErrorCodes.AUTH_INVALID_TOKEN, details) {
91
+ constructor(message, code = index_js_1.ErrorCodes.AUTH_INVALID_TOKEN, details) {
92
92
  super(message, code, 401, details);
93
- this.name = 'AuthenticationError';
93
+ this.name = "AuthenticationError";
94
94
  }
95
95
  }
96
96
  exports.AuthenticationError = AuthenticationError;
@@ -103,9 +103,9 @@ exports.AuthenticationError = AuthenticationError;
103
103
  * - Resource access denied
104
104
  */
105
105
  class AuthorizationError extends AttroveError {
106
- constructor(message, code = types_1.ErrorCodes.AUTH_INSUFFICIENT_PERMISSIONS, details) {
106
+ constructor(message, code = index_js_1.ErrorCodes.AUTH_INSUFFICIENT_PERMISSIONS, details) {
107
107
  super(message, code, 403, details);
108
- this.name = 'AuthorizationError';
108
+ this.name = "AuthorizationError";
109
109
  }
110
110
  }
111
111
  exports.AuthorizationError = AuthorizationError;
@@ -119,8 +119,8 @@ exports.AuthorizationError = AuthorizationError;
119
119
  */
120
120
  class NotFoundError extends AttroveError {
121
121
  constructor(message, details) {
122
- super(message, types_1.ErrorCodes.RESOURCE_NOT_FOUND, 404, details);
123
- this.name = 'NotFoundError';
122
+ super(message, index_js_1.ErrorCodes.RESOURCE_NOT_FOUND, 404, details);
123
+ this.name = "NotFoundError";
124
124
  }
125
125
  }
126
126
  exports.NotFoundError = NotFoundError;
@@ -133,9 +133,9 @@ exports.NotFoundError = NotFoundError;
133
133
  * - Invalid data format
134
134
  */
135
135
  class ValidationError extends AttroveError {
136
- constructor(message, code = types_1.ErrorCodes.VALIDATION_INVALID_FORMAT, details) {
136
+ constructor(message, code = index_js_1.ErrorCodes.VALIDATION_INVALID_FORMAT, details) {
137
137
  super(message, code, 400, details);
138
- this.name = 'ValidationError';
138
+ this.name = "ValidationError";
139
139
  }
140
140
  }
141
141
  exports.ValidationError = ValidationError;
@@ -147,8 +147,8 @@ exports.ValidationError = ValidationError;
147
147
  */
148
148
  class RateLimitError extends AttroveError {
149
149
  constructor(message, retryAfter, details) {
150
- super(message, types_1.ErrorCodes.RATE_LIMIT_EXCEEDED, 429, details);
151
- this.name = 'RateLimitError';
150
+ super(message, index_js_1.ErrorCodes.RATE_LIMIT_EXCEEDED, 429, details);
151
+ this.name = "RateLimitError";
152
152
  this.retryAfter = retryAfter;
153
153
  }
154
154
  }
@@ -164,8 +164,8 @@ exports.RateLimitError = RateLimitError;
164
164
  */
165
165
  class NetworkError extends AttroveError {
166
166
  constructor(message, details) {
167
- super(message, types_1.ErrorCodes.SERVICE_UNAVAILABLE, undefined, details);
168
- this.name = 'NetworkError';
167
+ super(message, index_js_1.ErrorCodes.SERVICE_UNAVAILABLE, undefined, details);
168
+ this.name = "NetworkError";
169
169
  }
170
170
  }
171
171
  exports.NetworkError = NetworkError;
@@ -176,9 +176,9 @@ exports.NetworkError = NetworkError;
176
176
  * Consider increasing the timeout or retrying the request.
177
177
  */
178
178
  class TimeoutError extends AttroveError {
179
- constructor(message = 'Request timed out', details) {
180
- super(message, types_1.ErrorCodes.SERVICE_UNAVAILABLE, 408, details);
181
- this.name = 'TimeoutError';
179
+ constructor(message = "Request timed out", details) {
180
+ super(message, index_js_1.ErrorCodes.SERVICE_UNAVAILABLE, 408, details);
181
+ this.name = "TimeoutError";
182
182
  }
183
183
  }
184
184
  exports.TimeoutError = TimeoutError;
@@ -191,8 +191,8 @@ exports.TimeoutError = TimeoutError;
191
191
  */
192
192
  class ServerError extends AttroveError {
193
193
  constructor(message, status = 500, details) {
194
- super(message, types_1.ErrorCodes.INTERNAL_ERROR, status, details);
195
- this.name = 'ServerError';
194
+ super(message, index_js_1.ErrorCodes.INTERNAL_ERROR, status, details);
195
+ this.name = "ServerError";
196
196
  }
197
197
  }
198
198
  exports.ServerError = ServerError;
@@ -208,11 +208,11 @@ exports.ServerError = ServerError;
208
208
  function createErrorFromStatus(message, status, code, details) {
209
209
  switch (status) {
210
210
  case 400:
211
- return new ValidationError(message, code || types_1.ErrorCodes.VALIDATION_INVALID_FORMAT, details);
211
+ return new ValidationError(message, code || index_js_1.ErrorCodes.VALIDATION_INVALID_FORMAT, details);
212
212
  case 401:
213
- return new AuthenticationError(message, code || types_1.ErrorCodes.AUTH_INVALID_TOKEN, details);
213
+ return new AuthenticationError(message, code || index_js_1.ErrorCodes.AUTH_INVALID_TOKEN, details);
214
214
  case 403:
215
- return new AuthorizationError(message, code || types_1.ErrorCodes.AUTH_INSUFFICIENT_PERMISSIONS, details);
215
+ return new AuthorizationError(message, code || index_js_1.ErrorCodes.AUTH_INSUFFICIENT_PERMISSIONS, details);
216
216
  case 404:
217
217
  return new NotFoundError(message, details);
218
218
  case 408:
@@ -223,7 +223,7 @@ function createErrorFromStatus(message, status, code, details) {
223
223
  if (status >= 500) {
224
224
  return new ServerError(message, status, details);
225
225
  }
226
- return new AttroveError(message, code || types_1.ErrorCodes.INTERNAL_ERROR, status, details);
226
+ return new AttroveError(message, code || index_js_1.ErrorCodes.INTERNAL_ERROR, status, details);
227
227
  }
228
228
  }
229
229
  exports.createErrorFromStatus = createErrorFromStatus;
@@ -304,4 +304,3 @@ function isServerError(error) {
304
304
  return error instanceof ServerError;
305
305
  }
306
306
  exports.isServerError = isServerError;
307
- //# sourceMappingURL=index.js.map
@@ -35,10 +35,10 @@
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.getVersion = exports.DEFAULT_MAX_RETRIES = exports.DEFAULT_TIMEOUT = exports.DEFAULT_BASE_URL = exports.SDK_VERSION = exports.generateMessageId = exports.isServerError = exports.isTimeoutError = exports.isNetworkError = exports.isRateLimitError = exports.isValidationError = exports.isNotFoundError = exports.isAuthorizationError = exports.isAuthenticationError = exports.isAttroveError = exports.ServerError = exports.TimeoutError = exports.NetworkError = exports.RateLimitError = exports.ValidationError = exports.NotFoundError = exports.AuthorizationError = exports.AuthenticationError = exports.AttroveError = exports.AttroveAdmin = exports.Attrove = void 0;
37
37
  const tslib_1 = require("tslib");
38
- const client_1 = require("./client");
39
- const admin_client_1 = require("./admin-client");
38
+ const client_js_1 = require("./client.js");
39
+ const admin_client_js_1 = require("./admin-client.js");
40
40
  // Re-export the client class with the static admin method
41
- class Attrove extends client_1.Attrove {
41
+ class Attrove extends client_js_1.Attrove {
42
42
  /**
43
43
  * Create an admin client for server-to-server operations.
44
44
  *
@@ -54,45 +54,44 @@ class Attrove extends client_1.Attrove {
54
54
  * ```
55
55
  */
56
56
  static admin(config) {
57
- return new admin_client_1.AttroveAdmin(config);
57
+ return new admin_client_js_1.AttroveAdmin(config);
58
58
  }
59
59
  }
60
60
  exports.Attrove = Attrove;
61
61
  // Export the admin client class
62
- var admin_client_2 = require("./admin-client");
63
- Object.defineProperty(exports, "AttroveAdmin", { enumerable: true, get: function () { return admin_client_2.AttroveAdmin; } });
62
+ var admin_client_js_2 = require("./admin-client.js");
63
+ Object.defineProperty(exports, "AttroveAdmin", { enumerable: true, get: function () { return admin_client_js_2.AttroveAdmin; } });
64
64
  // Export all types
65
- tslib_1.__exportStar(require("./types"), exports);
65
+ tslib_1.__exportStar(require("./types/index.js"), exports);
66
66
  // Export errors
67
- var errors_1 = require("./errors");
68
- Object.defineProperty(exports, "AttroveError", { enumerable: true, get: function () { return errors_1.AttroveError; } });
69
- Object.defineProperty(exports, "AuthenticationError", { enumerable: true, get: function () { return errors_1.AuthenticationError; } });
70
- Object.defineProperty(exports, "AuthorizationError", { enumerable: true, get: function () { return errors_1.AuthorizationError; } });
71
- Object.defineProperty(exports, "NotFoundError", { enumerable: true, get: function () { return errors_1.NotFoundError; } });
72
- Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return errors_1.ValidationError; } });
73
- Object.defineProperty(exports, "RateLimitError", { enumerable: true, get: function () { return errors_1.RateLimitError; } });
74
- Object.defineProperty(exports, "NetworkError", { enumerable: true, get: function () { return errors_1.NetworkError; } });
75
- Object.defineProperty(exports, "TimeoutError", { enumerable: true, get: function () { return errors_1.TimeoutError; } });
76
- Object.defineProperty(exports, "ServerError", { enumerable: true, get: function () { return errors_1.ServerError; } });
77
- Object.defineProperty(exports, "isAttroveError", { enumerable: true, get: function () { return errors_1.isAttroveError; } });
78
- Object.defineProperty(exports, "isAuthenticationError", { enumerable: true, get: function () { return errors_1.isAuthenticationError; } });
79
- Object.defineProperty(exports, "isAuthorizationError", { enumerable: true, get: function () { return errors_1.isAuthorizationError; } });
80
- Object.defineProperty(exports, "isNotFoundError", { enumerable: true, get: function () { return errors_1.isNotFoundError; } });
81
- Object.defineProperty(exports, "isValidationError", { enumerable: true, get: function () { return errors_1.isValidationError; } });
82
- Object.defineProperty(exports, "isRateLimitError", { enumerable: true, get: function () { return errors_1.isRateLimitError; } });
83
- Object.defineProperty(exports, "isNetworkError", { enumerable: true, get: function () { return errors_1.isNetworkError; } });
84
- Object.defineProperty(exports, "isTimeoutError", { enumerable: true, get: function () { return errors_1.isTimeoutError; } });
85
- Object.defineProperty(exports, "isServerError", { enumerable: true, get: function () { return errors_1.isServerError; } });
67
+ var index_js_1 = require("./errors/index.js");
68
+ Object.defineProperty(exports, "AttroveError", { enumerable: true, get: function () { return index_js_1.AttroveError; } });
69
+ Object.defineProperty(exports, "AuthenticationError", { enumerable: true, get: function () { return index_js_1.AuthenticationError; } });
70
+ Object.defineProperty(exports, "AuthorizationError", { enumerable: true, get: function () { return index_js_1.AuthorizationError; } });
71
+ Object.defineProperty(exports, "NotFoundError", { enumerable: true, get: function () { return index_js_1.NotFoundError; } });
72
+ Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return index_js_1.ValidationError; } });
73
+ Object.defineProperty(exports, "RateLimitError", { enumerable: true, get: function () { return index_js_1.RateLimitError; } });
74
+ Object.defineProperty(exports, "NetworkError", { enumerable: true, get: function () { return index_js_1.NetworkError; } });
75
+ Object.defineProperty(exports, "TimeoutError", { enumerable: true, get: function () { return index_js_1.TimeoutError; } });
76
+ Object.defineProperty(exports, "ServerError", { enumerable: true, get: function () { return index_js_1.ServerError; } });
77
+ Object.defineProperty(exports, "isAttroveError", { enumerable: true, get: function () { return index_js_1.isAttroveError; } });
78
+ Object.defineProperty(exports, "isAuthenticationError", { enumerable: true, get: function () { return index_js_1.isAuthenticationError; } });
79
+ Object.defineProperty(exports, "isAuthorizationError", { enumerable: true, get: function () { return index_js_1.isAuthorizationError; } });
80
+ Object.defineProperty(exports, "isNotFoundError", { enumerable: true, get: function () { return index_js_1.isNotFoundError; } });
81
+ Object.defineProperty(exports, "isValidationError", { enumerable: true, get: function () { return index_js_1.isValidationError; } });
82
+ Object.defineProperty(exports, "isRateLimitError", { enumerable: true, get: function () { return index_js_1.isRateLimitError; } });
83
+ Object.defineProperty(exports, "isNetworkError", { enumerable: true, get: function () { return index_js_1.isNetworkError; } });
84
+ Object.defineProperty(exports, "isTimeoutError", { enumerable: true, get: function () { return index_js_1.isTimeoutError; } });
85
+ Object.defineProperty(exports, "isServerError", { enumerable: true, get: function () { return index_js_1.isServerError; } });
86
86
  // Export streaming utilities
87
- var streaming_1 = require("./utils/streaming");
88
- Object.defineProperty(exports, "generateMessageId", { enumerable: true, get: function () { return streaming_1.generateMessageId; } });
87
+ var streaming_js_1 = require("./utils/streaming.js");
88
+ Object.defineProperty(exports, "generateMessageId", { enumerable: true, get: function () { return streaming_js_1.generateMessageId; } });
89
89
  // Export constants for advanced usage
90
- var constants_1 = require("./constants");
91
- Object.defineProperty(exports, "SDK_VERSION", { enumerable: true, get: function () { return constants_1.SDK_VERSION; } });
92
- Object.defineProperty(exports, "DEFAULT_BASE_URL", { enumerable: true, get: function () { return constants_1.DEFAULT_BASE_URL; } });
93
- Object.defineProperty(exports, "DEFAULT_TIMEOUT", { enumerable: true, get: function () { return constants_1.DEFAULT_TIMEOUT; } });
94
- Object.defineProperty(exports, "DEFAULT_MAX_RETRIES", { enumerable: true, get: function () { return constants_1.DEFAULT_MAX_RETRIES; } });
90
+ var constants_js_1 = require("./constants.js");
91
+ Object.defineProperty(exports, "SDK_VERSION", { enumerable: true, get: function () { return constants_js_1.SDK_VERSION; } });
92
+ Object.defineProperty(exports, "DEFAULT_BASE_URL", { enumerable: true, get: function () { return constants_js_1.DEFAULT_BASE_URL; } });
93
+ Object.defineProperty(exports, "DEFAULT_TIMEOUT", { enumerable: true, get: function () { return constants_js_1.DEFAULT_TIMEOUT; } });
94
+ Object.defineProperty(exports, "DEFAULT_MAX_RETRIES", { enumerable: true, get: function () { return constants_js_1.DEFAULT_MAX_RETRIES; } });
95
95
  // Export version utility for programmatic access
96
- var version_1 = require("./version");
97
- Object.defineProperty(exports, "getVersion", { enumerable: true, get: function () { return version_1.getVersion; } });
98
- //# sourceMappingURL=index.js.map
96
+ var version_js_1 = require("./version.js");
97
+ Object.defineProperty(exports, "getVersion", { enumerable: true, get: function () { return version_js_1.getVersion; } });
package/cjs/package.json CHANGED
@@ -1,56 +1 @@
1
- {
2
- "name": "@attrove/sdk",
3
- "version": "0.1.4",
4
- "description": "Official TypeScript SDK for the Attrove API - AI-powered context retrieval for your apps",
5
- "main": "./src/index.ts",
6
- "module": "./src/index.ts",
7
- "types": "./src/index.ts",
8
- "exports": {
9
- ".": {
10
- "types": "./src/index.ts",
11
- "import": "./src/index.ts",
12
- "require": "./src/index.ts"
13
- }
14
- },
15
- "files": [
16
- "dist",
17
- "README.md"
18
- ],
19
- "sideEffects": false,
20
- "keywords": [
21
- "attrove",
22
- "sdk",
23
- "api",
24
- "ai",
25
- "rag",
26
- "retrieval-augmented-generation",
27
- "context",
28
- "llm"
29
- ],
30
- "author": "Attrove <support@attrove.com>",
31
- "license": "MIT",
32
- "repository": {
33
- "type": "git",
34
- "url": "https://github.com/attrove/attrove-js.git",
35
- "directory": "packages/sdk"
36
- },
37
- "homepage": "https://docs.attrove.com",
38
- "bugs": {
39
- "url": "https://github.com/attrove/attrove-js/issues"
40
- },
41
- "engines": {
42
- "node": ">=18.0.0"
43
- },
44
- "scripts": {
45
- "build": "nx build sdk",
46
- "test": "nx test sdk"
47
- },
48
- "devDependencies": {
49
- "@types/node": "^20.0.0",
50
- "typescript": "~5.7.0"
51
- },
52
- "publishConfig": {
53
- "access": "public"
54
- },
55
- "type": "commonjs"
56
- }
1
+ {"type": "commonjs"}