@scryme/chat 0.0.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,3 @@
1
+ export * from './custom-instance';
2
+ export * from './generated/v3-client';
3
+ export * from './sdk';
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export * from './custom-instance';
2
+ export * from './generated/v3-client';
3
+ export * from './sdk';
package/dist/sdk.d.ts ADDED
@@ -0,0 +1,78 @@
1
+ import { AxiosRequestConfig } from 'axios';
2
+ import { getSkyrmeChatAPI } from './generated/v3-server';
3
+ import type { V3ProvisionWorkspaceDto, V3UpdateWorkspaceDto, V3AddMemberDto, V3UpdateMemberRoleDto, CreateWorkspaceChannelDto, UpdateWorkspaceChannelDto, ChannelsControllerGetMessagesParams, ChannelsControllerUpdateMessageBody, ChannelsControllerAddReactionBody, CreateDmDto, UsersControllerSearchUsersParams, V3WorkspacesControllerGetWorkspaces200, V3WorkspacesControllerGetWorkspaceBySlug200, V3WorkspacesControllerProvisionWorkspace201, V3WorkspacesControllerUpdateWorkspace200, V3WorkspacesControllerDeleteWorkspace200, DmsControllerGetMessagesParams } from './generated/v3-server';
4
+ export interface ScrymeSDKOptions {
5
+ baseURL?: string;
6
+ clientId?: string;
7
+ clientSecret?: string;
8
+ token?: string;
9
+ }
10
+ export declare class ScrymeSDK {
11
+ private token;
12
+ private tokenExpiresAt;
13
+ baseURL: string;
14
+ private clientId?;
15
+ private clientSecret?;
16
+ constructor(options?: ScrymeSDKOptions);
17
+ /**
18
+ * Automatically retrieves or refreshes the M2M OAuth2 Token using client_credentials
19
+ */
20
+ getOrFetchToken(): Promise<string | null>;
21
+ /**
22
+ * Gets the axios request config containing authorization and base url
23
+ */
24
+ private getRequestConfig;
25
+ /**
26
+ * Dynamic proxy that maps to the generated server API methods from Orval,
27
+ * injecting authentication token and baseURL automatically.
28
+ */
29
+ get raw(): ReturnType<typeof getSkyrmeChatAPI>;
30
+ get workspace(): {
31
+ list: (options?: AxiosRequestConfig) => Promise<V3WorkspacesControllerGetWorkspaces200>;
32
+ get: (slug: string, options?: AxiosRequestConfig) => Promise<V3WorkspacesControllerGetWorkspaceBySlug200>;
33
+ create: (data: V3ProvisionWorkspaceDto, options?: AxiosRequestConfig) => Promise<V3WorkspacesControllerProvisionWorkspace201>;
34
+ update: (slug: string, data: V3UpdateWorkspaceDto, options?: AxiosRequestConfig) => Promise<V3WorkspacesControllerUpdateWorkspace200>;
35
+ delete: (slug: string, options?: AxiosRequestConfig) => Promise<V3WorkspacesControllerDeleteWorkspace200>;
36
+ members: {
37
+ list: (slug: string, options?: AxiosRequestConfig) => Promise<any>;
38
+ add: (slug: string, data: V3AddMemberDto, options?: AxiosRequestConfig) => Promise<any>;
39
+ get: (slug: string, memberId: string, options?: AxiosRequestConfig) => Promise<any>;
40
+ update: (slug: string, memberId: string, data: V3UpdateMemberRoleDto, options?: AxiosRequestConfig) => Promise<any>;
41
+ delete: (slug: string, memberId: string, options?: AxiosRequestConfig) => Promise<any>;
42
+ };
43
+ channels: {
44
+ list: (slug: string, options?: AxiosRequestConfig) => Promise<any>;
45
+ create: (slug: string, data: CreateWorkspaceChannelDto, options?: AxiosRequestConfig) => Promise<any>;
46
+ };
47
+ };
48
+ get channel(): {
49
+ get: (slug: string, channelId: string, options?: AxiosRequestConfig) => Promise<any>;
50
+ update: (slug: string, channelId: string, data: UpdateWorkspaceChannelDto, options?: AxiosRequestConfig) => Promise<any>;
51
+ delete: (slug: string, channelId: string, options?: AxiosRequestConfig) => Promise<any>;
52
+ message: {
53
+ list: (channelId: string, params?: ChannelsControllerGetMessagesParams, options?: AxiosRequestConfig) => Promise<any>;
54
+ create: (channelId: string, options?: AxiosRequestConfig) => Promise<any>;
55
+ };
56
+ };
57
+ get message(): {
58
+ update: (channelId: string, messageId: string, data: ChannelsControllerUpdateMessageBody, options?: AxiosRequestConfig) => Promise<any>;
59
+ delete: (channelId: string, messageId: string, options?: AxiosRequestConfig) => Promise<any>;
60
+ addReaction: (channelId: string, messageId: string, data: ChannelsControllerAddReactionBody, options?: AxiosRequestConfig) => Promise<any>;
61
+ removeReaction: (channelId: string, messageId: string, emoji: string, options?: AxiosRequestConfig) => Promise<any>;
62
+ };
63
+ get dm(): {
64
+ list: (options?: AxiosRequestConfig) => Promise<any>;
65
+ create: (data: CreateDmDto, options?: AxiosRequestConfig) => Promise<any>;
66
+ get: (dmId: string, options?: AxiosRequestConfig) => Promise<any>;
67
+ delete: (dmId: string, options?: AxiosRequestConfig) => Promise<any>;
68
+ message: {
69
+ list: (dmId: string, params?: DmsControllerGetMessagesParams, options?: AxiosRequestConfig) => Promise<any>;
70
+ create: (dmId: string, options?: AxiosRequestConfig) => Promise<any>;
71
+ };
72
+ };
73
+ get user(): {
74
+ me: (options?: AxiosRequestConfig) => Promise<any>;
75
+ get: (userId: string, options?: AxiosRequestConfig) => Promise<any>;
76
+ search: (params: UsersControllerSearchUsersParams, options?: AxiosRequestConfig) => Promise<any>;
77
+ };
78
+ }
package/dist/sdk.js ADDED
@@ -0,0 +1,421 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __generator = (this && this.__generator) || function (thisArg, body) {
22
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
23
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
+ function verb(n) { return function (v) { return step([n, v]); }; }
25
+ function step(op) {
26
+ if (f) throw new TypeError("Generator is already executing.");
27
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
28
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
+ if (y = 0, t) op = [op[0] & 2, t.value];
30
+ switch (op[0]) {
31
+ case 0: case 1: t = op; break;
32
+ case 4: _.label++; return { value: op[1], done: false };
33
+ case 5: _.label++; y = op[1]; op = [0]; continue;
34
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
+ default:
36
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
+ if (t[2]) _.ops.pop();
41
+ _.trys.pop(); continue;
42
+ }
43
+ op = body.call(thisArg, _);
44
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
+ }
47
+ };
48
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
49
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
50
+ if (ar || !(i in from)) {
51
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
52
+ ar[i] = from[i];
53
+ }
54
+ }
55
+ return to.concat(ar || Array.prototype.slice.call(from));
56
+ };
57
+ import axios from 'axios';
58
+ import { getSkyrmeChatAPI } from './generated/v3-server';
59
+ var ScrymeSDK = /** @class */ (function () {
60
+ function ScrymeSDK(options) {
61
+ if (options === void 0) { options = {}; }
62
+ var _a;
63
+ this.token = null;
64
+ this.tokenExpiresAt = null;
65
+ this.clientId = options.clientId;
66
+ this.clientSecret = options.clientSecret;
67
+ this.token = options.token || null;
68
+ var url = options.baseURL || '';
69
+ if (!url && typeof window !== 'undefined') {
70
+ url = window.localStorage.getItem('CUSTOM_API_URL') || '';
71
+ }
72
+ if (!url) {
73
+ var g = globalThis;
74
+ var env = ((_a = g.process) === null || _a === void 0 ? void 0 : _a.env) || g.__env__ || {};
75
+ var isProd = env.NODE_ENV === 'production' ||
76
+ (typeof window !== 'undefined' && window.location.hostname !== 'localhost' && window.location.hostname !== '127.0.0.1');
77
+ url =
78
+ env.API_URL ||
79
+ env.NEXT_PUBLIC_API_URL ||
80
+ env.VITE_API_URL ||
81
+ (isProd ? 'https://api.chat.scryme.tech' : 'http://localhost:3000');
82
+ }
83
+ this.baseURL = url.replace(/\/$/, '');
84
+ }
85
+ /**
86
+ * Automatically retrieves or refreshes the M2M OAuth2 Token using client_credentials
87
+ */
88
+ ScrymeSDK.prototype.getOrFetchToken = function () {
89
+ return __awaiter(this, void 0, void 0, function () {
90
+ var response, error_1;
91
+ var _a, _b, _c, _d;
92
+ return __generator(this, function (_e) {
93
+ switch (_e.label) {
94
+ case 0:
95
+ // If we already have a token and it is not expired, return it
96
+ if (this.token && (!this.tokenExpiresAt || this.tokenExpiresAt > Date.now())) {
97
+ return [2 /*return*/, this.token];
98
+ }
99
+ if (!(this.clientId && this.clientSecret)) return [3 /*break*/, 4];
100
+ _e.label = 1;
101
+ case 1:
102
+ _e.trys.push([1, 3, , 4]);
103
+ return [4 /*yield*/, axios.post("".concat(this.baseURL, "/api/v3/oauth/token"), {
104
+ client_id: this.clientId,
105
+ client_secret: this.clientSecret,
106
+ grant_type: 'client_credentials',
107
+ }, {
108
+ headers: { 'Content-Type': 'application/json' },
109
+ })];
110
+ case 2:
111
+ response = _e.sent();
112
+ if (((_a = response.data) === null || _a === void 0 ? void 0 : _a.success) && ((_c = (_b = response.data) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.access_token)) {
113
+ this.token = response.data.data.access_token;
114
+ if (response.data.data.expires_in) {
115
+ // Expire 10 seconds early as a safety buffer
116
+ this.tokenExpiresAt = Date.now() + (response.data.data.expires_in - 10) * 1000;
117
+ }
118
+ else {
119
+ this.tokenExpiresAt = null;
120
+ }
121
+ return [2 /*return*/, this.token];
122
+ }
123
+ else if ((_d = response.data) === null || _d === void 0 ? void 0 : _d.access_token) {
124
+ // Fallback in case response is not wrapped
125
+ this.token = response.data.access_token;
126
+ if (response.data.expires_in) {
127
+ this.tokenExpiresAt = Date.now() + (response.data.expires_in - 10) * 1000;
128
+ }
129
+ else {
130
+ this.tokenExpiresAt = null;
131
+ }
132
+ return [2 /*return*/, this.token];
133
+ }
134
+ return [3 /*break*/, 4];
135
+ case 3:
136
+ error_1 = _e.sent();
137
+ console.error('ScrymeSDK failed to authenticate via client_credentials:', error_1);
138
+ throw error_1;
139
+ case 4: return [2 /*return*/, this.token];
140
+ }
141
+ });
142
+ });
143
+ };
144
+ /**
145
+ * Gets the axios request config containing authorization and base url
146
+ */
147
+ ScrymeSDK.prototype.getRequestConfig = function () {
148
+ return __awaiter(this, void 0, void 0, function () {
149
+ var token;
150
+ return __generator(this, function (_a) {
151
+ switch (_a.label) {
152
+ case 0: return [4 /*yield*/, this.getOrFetchToken()];
153
+ case 1:
154
+ token = _a.sent();
155
+ return [2 /*return*/, {
156
+ baseURL: "".concat(this.baseURL, "/api"),
157
+ headers: __assign({}, (token ? { Authorization: "Bearer ".concat(token) } : {})),
158
+ }];
159
+ }
160
+ });
161
+ });
162
+ };
163
+ Object.defineProperty(ScrymeSDK.prototype, "raw", {
164
+ /**
165
+ * Dynamic proxy that maps to the generated server API methods from Orval,
166
+ * injecting authentication token and baseURL automatically.
167
+ */
168
+ get: function () {
169
+ var _this = this;
170
+ var rawMethods = getSkyrmeChatAPI();
171
+ return new Proxy(rawMethods, {
172
+ get: function (target, prop) {
173
+ var originalMethod = Reflect.get(target, prop);
174
+ if (typeof originalMethod === 'function') {
175
+ return function () {
176
+ var args = [];
177
+ for (var _i = 0; _i < arguments.length; _i++) {
178
+ args[_i] = arguments[_i];
179
+ }
180
+ return __awaiter(_this, void 0, void 0, function () {
181
+ var config, arity, newArgs, userOptions;
182
+ return __generator(this, function (_a) {
183
+ switch (_a.label) {
184
+ case 0: return [4 /*yield*/, this.getRequestConfig()];
185
+ case 1:
186
+ config = _a.sent();
187
+ arity = originalMethod.length;
188
+ newArgs = __spreadArray([], args, true);
189
+ // Orval generated functions accept `options` as their last parameter.
190
+ // If the user provided options, we merge them with our default request config.
191
+ if (args.length >= arity && typeof args[args.length - 1] === 'object') {
192
+ userOptions = args[args.length - 1];
193
+ newArgs[args.length - 1] = __assign(__assign({}, userOptions), { baseURL: config.baseURL, headers: __assign(__assign({}, config.headers), userOptions.headers) });
194
+ }
195
+ else {
196
+ // Otherwise, we pad missing parameters with undefined and append our config as the options object.
197
+ while (newArgs.length < arity - 1) {
198
+ newArgs.push(undefined);
199
+ }
200
+ newArgs.push(config);
201
+ }
202
+ return [2 /*return*/, originalMethod.apply(void 0, newArgs)];
203
+ }
204
+ });
205
+ });
206
+ };
207
+ }
208
+ return originalMethod;
209
+ },
210
+ });
211
+ },
212
+ enumerable: false,
213
+ configurable: true
214
+ });
215
+ Object.defineProperty(ScrymeSDK.prototype, "workspace", {
216
+ // --- High-level nested namespace chains for excellent DX ---
217
+ get: function () {
218
+ var _this = this;
219
+ return {
220
+ list: function (options) { return __awaiter(_this, void 0, void 0, function () {
221
+ return __generator(this, function (_a) {
222
+ return [2 /*return*/, this.raw.v3WorkspacesControllerGetWorkspaces(options)];
223
+ });
224
+ }); },
225
+ get: function (slug, options) { return __awaiter(_this, void 0, void 0, function () {
226
+ return __generator(this, function (_a) {
227
+ return [2 /*return*/, this.raw.v3WorkspacesControllerGetWorkspaceBySlug(slug, options)];
228
+ });
229
+ }); },
230
+ create: function (data, options) { return __awaiter(_this, void 0, void 0, function () {
231
+ return __generator(this, function (_a) {
232
+ return [2 /*return*/, this.raw.v3WorkspacesControllerProvisionWorkspace(data, options)];
233
+ });
234
+ }); },
235
+ update: function (slug, data, options) { return __awaiter(_this, void 0, void 0, function () {
236
+ return __generator(this, function (_a) {
237
+ return [2 /*return*/, this.raw.v3WorkspacesControllerUpdateWorkspace(slug, data, options)];
238
+ });
239
+ }); },
240
+ delete: function (slug, options) { return __awaiter(_this, void 0, void 0, function () {
241
+ return __generator(this, function (_a) {
242
+ return [2 /*return*/, this.raw.v3WorkspacesControllerDeleteWorkspace(slug, options)];
243
+ });
244
+ }); },
245
+ members: {
246
+ list: function (slug, options) { return __awaiter(_this, void 0, void 0, function () {
247
+ return __generator(this, function (_a) {
248
+ return [2 /*return*/, this.raw.v3WorkspacesControllerGetWorkspaceMembers(slug, options)];
249
+ });
250
+ }); },
251
+ add: function (slug, data, options) { return __awaiter(_this, void 0, void 0, function () {
252
+ return __generator(this, function (_a) {
253
+ return [2 /*return*/, this.raw.v3WorkspacesControllerAddWorkspaceMember(slug, data, options)];
254
+ });
255
+ }); },
256
+ get: function (slug, memberId, options) { return __awaiter(_this, void 0, void 0, function () {
257
+ return __generator(this, function (_a) {
258
+ return [2 /*return*/, this.raw.v3WorkspacesControllerGetWorkspaceMember(slug, memberId, options)];
259
+ });
260
+ }); },
261
+ update: function (slug, memberId, data, options) { return __awaiter(_this, void 0, void 0, function () {
262
+ return __generator(this, function (_a) {
263
+ return [2 /*return*/, this.raw.v3WorkspacesControllerUpdateWorkspaceMember(slug, memberId, data, options)];
264
+ });
265
+ }); },
266
+ delete: function (slug, memberId, options) { return __awaiter(_this, void 0, void 0, function () {
267
+ return __generator(this, function (_a) {
268
+ return [2 /*return*/, this.raw.v3WorkspacesControllerDeleteWorkspaceMember(slug, memberId, options)];
269
+ });
270
+ }); },
271
+ },
272
+ channels: {
273
+ list: function (slug, options) { return __awaiter(_this, void 0, void 0, function () {
274
+ return __generator(this, function (_a) {
275
+ return [2 /*return*/, this.raw.channelsControllerGetWorkspaceChannels(slug, options)];
276
+ });
277
+ }); },
278
+ create: function (slug, data, options) { return __awaiter(_this, void 0, void 0, function () {
279
+ return __generator(this, function (_a) {
280
+ return [2 /*return*/, this.raw.channelsControllerCreateChannel(slug, data, options)];
281
+ });
282
+ }); },
283
+ },
284
+ };
285
+ },
286
+ enumerable: false,
287
+ configurable: true
288
+ });
289
+ Object.defineProperty(ScrymeSDK.prototype, "channel", {
290
+ get: function () {
291
+ var _this = this;
292
+ return {
293
+ get: function (slug, channelId, options) { return __awaiter(_this, void 0, void 0, function () {
294
+ return __generator(this, function (_a) {
295
+ return [2 /*return*/, this.raw.channelsControllerGetChannel(slug, channelId, options)];
296
+ });
297
+ }); },
298
+ update: function (slug, channelId, data, options) { return __awaiter(_this, void 0, void 0, function () {
299
+ return __generator(this, function (_a) {
300
+ return [2 /*return*/, this.raw.channelsControllerUpdateChannel(slug, channelId, data, options)];
301
+ });
302
+ }); },
303
+ delete: function (slug, channelId, options) { return __awaiter(_this, void 0, void 0, function () {
304
+ return __generator(this, function (_a) {
305
+ return [2 /*return*/, this.raw.channelsControllerDeleteChannel(slug, channelId, options)];
306
+ });
307
+ }); },
308
+ message: {
309
+ list: function (channelId, params, options) { return __awaiter(_this, void 0, void 0, function () {
310
+ return __generator(this, function (_a) {
311
+ return [2 /*return*/, this.raw.channelsControllerGetMessages(channelId, params, options)];
312
+ });
313
+ }); },
314
+ create: function (channelId, options) { return __awaiter(_this, void 0, void 0, function () {
315
+ return __generator(this, function (_a) {
316
+ return [2 /*return*/, this.raw.channelsControllerCreateMessage(channelId, options)];
317
+ });
318
+ }); },
319
+ },
320
+ };
321
+ },
322
+ enumerable: false,
323
+ configurable: true
324
+ });
325
+ Object.defineProperty(ScrymeSDK.prototype, "message", {
326
+ get: function () {
327
+ var _this = this;
328
+ return {
329
+ update: function (channelId, messageId, data, options) { return __awaiter(_this, void 0, void 0, function () {
330
+ return __generator(this, function (_a) {
331
+ return [2 /*return*/, this.raw.channelsControllerUpdateMessage(channelId, messageId, data, options)];
332
+ });
333
+ }); },
334
+ delete: function (channelId, messageId, options) { return __awaiter(_this, void 0, void 0, function () {
335
+ return __generator(this, function (_a) {
336
+ return [2 /*return*/, this.raw.channelsControllerDeleteMessage(channelId, messageId, options)];
337
+ });
338
+ }); },
339
+ addReaction: function (channelId, messageId, data, options) { return __awaiter(_this, void 0, void 0, function () {
340
+ return __generator(this, function (_a) {
341
+ return [2 /*return*/, this.raw.channelsControllerAddReaction(channelId, messageId, data, options)];
342
+ });
343
+ }); },
344
+ removeReaction: function (channelId, messageId, emoji, options) { return __awaiter(_this, void 0, void 0, function () {
345
+ return __generator(this, function (_a) {
346
+ return [2 /*return*/, this.raw.channelsControllerRemoveReaction(channelId, messageId, emoji, options)];
347
+ });
348
+ }); },
349
+ };
350
+ },
351
+ enumerable: false,
352
+ configurable: true
353
+ });
354
+ Object.defineProperty(ScrymeSDK.prototype, "dm", {
355
+ get: function () {
356
+ var _this = this;
357
+ return {
358
+ list: function (options) { return __awaiter(_this, void 0, void 0, function () {
359
+ return __generator(this, function (_a) {
360
+ return [2 /*return*/, this.raw.dmsControllerGetDms(options)];
361
+ });
362
+ }); },
363
+ create: function (data, options) { return __awaiter(_this, void 0, void 0, function () {
364
+ return __generator(this, function (_a) {
365
+ return [2 /*return*/, this.raw.dmsControllerCreateDm(data, options)];
366
+ });
367
+ }); },
368
+ get: function (dmId, options) { return __awaiter(_this, void 0, void 0, function () {
369
+ return __generator(this, function (_a) {
370
+ return [2 /*return*/, this.raw.dmsControllerGetDm(dmId, options)];
371
+ });
372
+ }); },
373
+ delete: function (dmId, options) { return __awaiter(_this, void 0, void 0, function () {
374
+ return __generator(this, function (_a) {
375
+ return [2 /*return*/, this.raw.dmsControllerDeleteDm(dmId, options)];
376
+ });
377
+ }); },
378
+ message: {
379
+ list: function (dmId, params, options) { return __awaiter(_this, void 0, void 0, function () {
380
+ return __generator(this, function (_a) {
381
+ return [2 /*return*/, this.raw.dmsControllerGetMessages(dmId, params, options)];
382
+ });
383
+ }); },
384
+ create: function (dmId, options) { return __awaiter(_this, void 0, void 0, function () {
385
+ return __generator(this, function (_a) {
386
+ return [2 /*return*/, this.raw.dmsControllerCreateMessage(dmId, options)];
387
+ });
388
+ }); },
389
+ },
390
+ };
391
+ },
392
+ enumerable: false,
393
+ configurable: true
394
+ });
395
+ Object.defineProperty(ScrymeSDK.prototype, "user", {
396
+ get: function () {
397
+ var _this = this;
398
+ return {
399
+ me: function (options) { return __awaiter(_this, void 0, void 0, function () {
400
+ return __generator(this, function (_a) {
401
+ return [2 /*return*/, this.raw.usersControllerGetMe(options)];
402
+ });
403
+ }); },
404
+ get: function (userId, options) { return __awaiter(_this, void 0, void 0, function () {
405
+ return __generator(this, function (_a) {
406
+ return [2 /*return*/, this.raw.usersControllerGetUser(userId, options)];
407
+ });
408
+ }); },
409
+ search: function (params, options) { return __awaiter(_this, void 0, void 0, function () {
410
+ return __generator(this, function (_a) {
411
+ return [2 /*return*/, this.raw.usersControllerSearchUsers(params, options)];
412
+ });
413
+ }); },
414
+ };
415
+ },
416
+ enumerable: false,
417
+ configurable: true
418
+ });
419
+ return ScrymeSDK;
420
+ }());
421
+ export { ScrymeSDK };
@@ -0,0 +1,3 @@
1
+ export * from './custom-instance';
2
+ export * from './generated/v3-server';
3
+ export * from './sdk';
package/dist/server.js ADDED
@@ -0,0 +1,3 @@
1
+ export * from './custom-instance';
2
+ export * from './generated/v3-server';
3
+ export * from './sdk';
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@scryme/chat",
3
+ "version": "0.0.1",
4
+ "private": false,
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "main": "./dist/index.js",
9
+ "module": "./dist/index.js",
10
+ "types": "./dist/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/index.d.ts",
14
+ "default": "./dist/index.js"
15
+ },
16
+ "./client": {
17
+ "types": "./dist/client.d.ts",
18
+ "default": "./dist/client.js"
19
+ },
20
+ "./server": {
21
+ "types": "./dist/server.d.ts",
22
+ "default": "./dist/server.js"
23
+ }
24
+ },
25
+ "files": [
26
+ "dist",
27
+ "src"
28
+ ],
29
+ "dependencies": {
30
+ "@tanstack/react-query": "5.96.2",
31
+ "axios": "^1.7.9"
32
+ },
33
+ "peerDependencies": {
34
+ "react": "^18.0.0 || ^19.0.0"
35
+ },
36
+ "devDependencies": {
37
+ "@types/node": "^22.10.7",
38
+ "@types/react": "^19.2.14",
39
+ "orval": "^6.31.0",
40
+ "typescript": "^5.7.3",
41
+ "vitest": "^4.1.10",
42
+ "@repo/typescript-config": "0.1.0-dev.31"
43
+ },
44
+ "scripts": {
45
+ "generate": "orval",
46
+ "build": "tsc",
47
+ "type-check": "tsc --noEmit",
48
+ "test": "vitest run"
49
+ }
50
+ }