@hipnation-truth/sdk 0.24.0 → 0.25.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.
- package/dist/index.d.mts +15 -24
- package/dist/index.d.ts +15 -24
- package/dist/index.js +54 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +54 -18
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.ts +25 -24
- package/dist/react.js +79 -20
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
3
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
5
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
6
|
+
var __reflectGet = Reflect.get;
|
|
5
7
|
var __pow = Math.pow;
|
|
6
8
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
9
|
var __spreadValues = (a, b) => {
|
|
@@ -15,6 +17,7 @@ var __spreadValues = (a, b) => {
|
|
|
15
17
|
}
|
|
16
18
|
return a;
|
|
17
19
|
};
|
|
20
|
+
var __superGet = (cls, obj, key) => __reflectGet(__getProtoOf(cls), key, obj);
|
|
18
21
|
var __async = (__this, __arguments, generator) => {
|
|
19
22
|
return new Promise((resolve, reject) => {
|
|
20
23
|
var fulfilled = (value) => {
|
|
@@ -36,8 +39,53 @@ var __async = (__this, __arguments, generator) => {
|
|
|
36
39
|
});
|
|
37
40
|
};
|
|
38
41
|
|
|
39
|
-
// src/client.ts
|
|
42
|
+
// src/auth-convex-client.ts
|
|
40
43
|
import { ConvexHttpClient } from "convex/browser";
|
|
44
|
+
var AuthAwareConvexHttpClient = class _AuthAwareConvexHttpClient extends ConvexHttpClient {
|
|
45
|
+
constructor(address, getAuthToken) {
|
|
46
|
+
super(address);
|
|
47
|
+
this.getAuthToken = getAuthToken;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Pull a fresh token from the fetcher and apply it. A fetcher error
|
|
51
|
+
* keeps the previously-applied token rather than dropping auth
|
|
52
|
+
* mid-session.
|
|
53
|
+
*/
|
|
54
|
+
syncAuth() {
|
|
55
|
+
return __async(this, null, function* () {
|
|
56
|
+
if (!this.getAuthToken) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
try {
|
|
60
|
+
const token = yield this.getAuthToken();
|
|
61
|
+
if (token) {
|
|
62
|
+
this.setAuth(token);
|
|
63
|
+
} else {
|
|
64
|
+
this.clearAuth();
|
|
65
|
+
}
|
|
66
|
+
} catch (e) {
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
query(query, ...args) {
|
|
71
|
+
return __async(this, null, function* () {
|
|
72
|
+
yield this.syncAuth();
|
|
73
|
+
return __superGet(_AuthAwareConvexHttpClient.prototype, this, "query").call(this, query, ...args);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
mutation(mutation, ...args) {
|
|
77
|
+
return __async(this, null, function* () {
|
|
78
|
+
yield this.syncAuth();
|
|
79
|
+
return __superGet(_AuthAwareConvexHttpClient.prototype, this, "mutation").call(this, mutation, ...args);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
action(action, ...args) {
|
|
83
|
+
return __async(this, null, function* () {
|
|
84
|
+
yield this.syncAuth();
|
|
85
|
+
return __superGet(_AuthAwareConvexHttpClient.prototype, this, "action").call(this, action, ...args);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
};
|
|
41
89
|
|
|
42
90
|
// src/resources/appointments.ts
|
|
43
91
|
var AppointmentResource = class {
|
|
@@ -285,22 +333,10 @@ var ConversationTasksSubresource = class {
|
|
|
285
333
|
return __async(this, null, function* () {
|
|
286
334
|
return this.post(
|
|
287
335
|
`/conversations/tasks/${encodeURIComponent(input.taskId)}/status`,
|
|
288
|
-
__spreadValues(__spreadValues({
|
|
289
|
-
id: input.taskId,
|
|
290
|
-
status: input.status
|
|
291
|
-
}, input.resolvedBy ? { resolvedBy: input.resolvedBy } : {}), input.actor ? { actor: input.actor } : {})
|
|
292
|
-
);
|
|
293
|
-
});
|
|
294
|
-
}
|
|
295
|
-
/** Archive or un-archive a task (hides it from My Tasks without deleting). */
|
|
296
|
-
setArchived(input) {
|
|
297
|
-
return __async(this, null, function* () {
|
|
298
|
-
return this.post(
|
|
299
|
-
`/conversations/tasks/${encodeURIComponent(input.taskId)}/archive`,
|
|
300
336
|
__spreadValues({
|
|
301
337
|
id: input.taskId,
|
|
302
|
-
|
|
303
|
-
}, input.
|
|
338
|
+
status: input.status
|
|
339
|
+
}, input.resolvedBy ? { resolvedBy: input.resolvedBy } : {})
|
|
304
340
|
);
|
|
305
341
|
});
|
|
306
342
|
}
|
|
@@ -313,12 +349,12 @@ var ConversationTasksSubresource = class {
|
|
|
313
349
|
return __async(this, null, function* () {
|
|
314
350
|
return this.patch(
|
|
315
351
|
`/conversations/tasks/${encodeURIComponent(input.taskId)}`,
|
|
316
|
-
__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(
|
|
352
|
+
__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({
|
|
317
353
|
id: input.taskId,
|
|
318
354
|
conversationId: input.conversationId,
|
|
319
355
|
author: input.author,
|
|
320
356
|
description: input.description
|
|
321
|
-
}, input.title !== void 0 ? { title: input.title } : {}), input.priority ? { priority: input.priority } : {}), input.status ? { status: input.status } : {}), input.assignee !== void 0 ? { assignee: input.assignee } : {}), input.type !== void 0 ? { type: input.type } : {})
|
|
357
|
+
}, input.title !== void 0 ? { title: input.title } : {}), input.priority ? { priority: input.priority } : {}), input.status ? { status: input.status } : {}), input.assignee !== void 0 ? { assignee: input.assignee } : {}), input.type !== void 0 ? { type: input.type } : {})
|
|
322
358
|
);
|
|
323
359
|
});
|
|
324
360
|
}
|
|
@@ -1880,7 +1916,7 @@ var TruthClient = class {
|
|
|
1880
1916
|
this._webPushReady = null;
|
|
1881
1917
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1882
1918
|
const convexUrl = (_b = (_a = config.convexUrl) != null ? _a : CONVEX_URLS[config.environment]) != null ? _b : CONVEX_URLS.local;
|
|
1883
|
-
this.convex = new
|
|
1919
|
+
this.convex = new AuthAwareConvexHttpClient(convexUrl, config.getAuthToken);
|
|
1884
1920
|
this.tracker = new Tracker({
|
|
1885
1921
|
apiKey: config.apiKey,
|
|
1886
1922
|
environment: config.environment,
|