@superinterface/react 1.1.8 → 2.0.0
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-CGpJFXMu.d.ts +5 -0
- package/dist/index.cjs +3383 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1220 -0
- package/dist/index.d.ts +852 -211
- package/dist/index.js +3117 -1947
- package/dist/index.js.map +1 -1
- package/dist/mutationFns.cjs +517 -0
- package/dist/mutationFns.cjs.map +1 -0
- package/dist/mutationFns.d.cts +35 -0
- package/dist/mutationFns.d.ts +13 -13
- package/dist/mutationFns.js +434 -159
- package/dist/mutationFns.js.map +1 -1
- package/dist/queryFns.cjs +578 -0
- package/dist/queryFns.cjs.map +1 -0
- package/dist/queryFns.d.cts +18 -0
- package/dist/queryFns.d.ts +5 -5
- package/dist/queryFns.js +495 -200
- package/dist/queryFns.js.map +1 -1
- package/dist/types/index.cjs +45 -0
- package/dist/types/index.cjs.map +1 -0
- package/dist/types/index.d.cts +37 -0
- package/dist/types/index.d.ts +10 -6
- package/dist/types/index.js +0 -18
- package/dist/types/index.js.map +1 -1
- package/dist/utils.cjs +312 -0
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.d.cts +23 -0
- package/dist/utils.d.ts +3 -4
- package/dist/utils.js +246 -73
- package/dist/utils.js.map +1 -1
- package/package.json +29 -21
- /package/dist/{index-LPUEY9WE.d.ts → index-CGpJFXMu.d.cts} +0 -0
package/dist/utils.js
CHANGED
|
@@ -1,77 +1,250 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/utils.ts
|
|
21
|
-
var utils_exports = {};
|
|
22
|
-
__export(utils_exports, {
|
|
23
|
-
HydrationBoundary: () => import_react_query.HydrationBoundary,
|
|
24
|
-
QueryClient: () => import_react_query.QueryClient,
|
|
25
|
-
dehydrate: () => import_react_query.dehydrate,
|
|
26
|
-
extendMessage: () => extendMessage,
|
|
27
|
-
optimisticId: () => optimisticId
|
|
28
|
-
});
|
|
29
|
-
module.exports = __toCommonJS(utils_exports);
|
|
30
|
-
var import_react_query = require("@tanstack/react-query");
|
|
31
|
-
|
|
32
1
|
// src/lib/runSteps/getRunSteps/index.ts
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
2
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
3
|
+
try {
|
|
4
|
+
var info = gen[key](arg);
|
|
5
|
+
var value = info.value;
|
|
6
|
+
} catch (error) {
|
|
7
|
+
reject(error);
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
if (info.done) {
|
|
11
|
+
resolve(value);
|
|
12
|
+
} else {
|
|
13
|
+
Promise.resolve(value).then(_next, _throw);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function _async_to_generator(fn) {
|
|
17
|
+
return function() {
|
|
18
|
+
var self = this, args = arguments;
|
|
19
|
+
return new Promise(function(resolve, reject) {
|
|
20
|
+
var gen = fn.apply(self, args);
|
|
21
|
+
function _next(value) {
|
|
22
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
23
|
+
}
|
|
24
|
+
function _throw(err) {
|
|
25
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
26
|
+
}
|
|
27
|
+
_next(undefined);
|
|
28
|
+
});
|
|
54
29
|
};
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
|
|
30
|
+
}
|
|
31
|
+
function _define_property(obj, key, value) {
|
|
32
|
+
if (key in obj) {
|
|
33
|
+
Object.defineProperty(obj, key, {
|
|
34
|
+
value: value,
|
|
35
|
+
enumerable: true,
|
|
36
|
+
configurable: true,
|
|
37
|
+
writable: true
|
|
38
|
+
});
|
|
39
|
+
} else {
|
|
40
|
+
obj[key] = value;
|
|
41
|
+
}
|
|
42
|
+
return obj;
|
|
43
|
+
}
|
|
44
|
+
function _object_spread(target) {
|
|
45
|
+
for(var i = 1; i < arguments.length; i++){
|
|
46
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
47
|
+
var ownKeys = Object.keys(source);
|
|
48
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
49
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
50
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
ownKeys.forEach(function(key) {
|
|
54
|
+
_define_property(target, key, source[key]);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return target;
|
|
58
|
+
}
|
|
59
|
+
function ownKeys(object, enumerableOnly) {
|
|
60
|
+
var keys = Object.keys(object);
|
|
61
|
+
if (Object.getOwnPropertySymbols) {
|
|
62
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
63
|
+
if (enumerableOnly) {
|
|
64
|
+
symbols = symbols.filter(function(sym) {
|
|
65
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
keys.push.apply(keys, symbols);
|
|
69
|
+
}
|
|
70
|
+
return keys;
|
|
71
|
+
}
|
|
72
|
+
function _object_spread_props(target, source) {
|
|
73
|
+
source = source != null ? source : {};
|
|
74
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
75
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
76
|
+
} else {
|
|
77
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
78
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
return target;
|
|
82
|
+
}
|
|
83
|
+
function _ts_generator(thisArg, body) {
|
|
84
|
+
var f, y, t, g, _ = {
|
|
85
|
+
label: 0,
|
|
86
|
+
sent: function() {
|
|
87
|
+
if (t[0] & 1) throw t[1];
|
|
88
|
+
return t[1];
|
|
89
|
+
},
|
|
90
|
+
trys: [],
|
|
91
|
+
ops: []
|
|
92
|
+
};
|
|
93
|
+
return g = {
|
|
94
|
+
next: verb(0),
|
|
95
|
+
"throw": verb(1),
|
|
96
|
+
"return": verb(2)
|
|
97
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
98
|
+
return this;
|
|
99
|
+
}), g;
|
|
100
|
+
function verb(n) {
|
|
101
|
+
return function(v) {
|
|
102
|
+
return step([
|
|
103
|
+
n,
|
|
104
|
+
v
|
|
105
|
+
]);
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
function step(op) {
|
|
109
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
110
|
+
while(_)try {
|
|
111
|
+
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;
|
|
112
|
+
if (y = 0, t) op = [
|
|
113
|
+
op[0] & 2,
|
|
114
|
+
t.value
|
|
115
|
+
];
|
|
116
|
+
switch(op[0]){
|
|
117
|
+
case 0:
|
|
118
|
+
case 1:
|
|
119
|
+
t = op;
|
|
120
|
+
break;
|
|
121
|
+
case 4:
|
|
122
|
+
_.label++;
|
|
123
|
+
return {
|
|
124
|
+
value: op[1],
|
|
125
|
+
done: false
|
|
126
|
+
};
|
|
127
|
+
case 5:
|
|
128
|
+
_.label++;
|
|
129
|
+
y = op[1];
|
|
130
|
+
op = [
|
|
131
|
+
0
|
|
132
|
+
];
|
|
133
|
+
continue;
|
|
134
|
+
case 7:
|
|
135
|
+
op = _.ops.pop();
|
|
136
|
+
_.trys.pop();
|
|
137
|
+
continue;
|
|
138
|
+
default:
|
|
139
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
140
|
+
_ = 0;
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
144
|
+
_.label = op[1];
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
148
|
+
_.label = t[1];
|
|
149
|
+
t = op;
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
if (t && _.label < t[2]) {
|
|
153
|
+
_.label = t[2];
|
|
154
|
+
_.ops.push(op);
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
if (t[2]) _.ops.pop();
|
|
158
|
+
_.trys.pop();
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
op = body.call(thisArg, _);
|
|
162
|
+
} catch (e) {
|
|
163
|
+
op = [
|
|
164
|
+
6,
|
|
165
|
+
e
|
|
166
|
+
];
|
|
167
|
+
y = 0;
|
|
168
|
+
} finally{
|
|
169
|
+
f = t = 0;
|
|
170
|
+
}
|
|
171
|
+
if (op[0] & 5) throw op[1];
|
|
172
|
+
return {
|
|
173
|
+
value: op[0] ? op[1] : void 0,
|
|
174
|
+
done: true
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
var getRunSteps = function() {
|
|
179
|
+
var _ref = _async_to_generator(function(param) {
|
|
180
|
+
var threadId, runId, client, runStepsResponse;
|
|
181
|
+
return _ts_generator(this, function(_state) {
|
|
182
|
+
switch(_state.label){
|
|
183
|
+
case 0:
|
|
184
|
+
threadId = param.threadId, runId = param.runId, client = param.client;
|
|
185
|
+
return [
|
|
186
|
+
4,
|
|
187
|
+
client.beta.threads.runs.steps.list(threadId, runId)
|
|
188
|
+
];
|
|
189
|
+
case 1:
|
|
190
|
+
runStepsResponse = _state.sent();
|
|
191
|
+
return [
|
|
192
|
+
2,
|
|
193
|
+
runStepsResponse.data
|
|
194
|
+
];
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
return function getRunSteps(_) {
|
|
199
|
+
return _ref.apply(this, arguments);
|
|
200
|
+
};
|
|
201
|
+
}();
|
|
202
|
+
// src/lib/threadMessages/extendThreadMessage.ts
|
|
203
|
+
var extendThreadMessage = function() {
|
|
204
|
+
var _ref = _async_to_generator(function(param) {
|
|
205
|
+
var threadMessage, client, _tmp, _tmp1;
|
|
206
|
+
return _ts_generator(this, function(_state) {
|
|
207
|
+
switch(_state.label){
|
|
208
|
+
case 0:
|
|
209
|
+
threadMessage = param.threadMessage, client = param.client;
|
|
210
|
+
if (!threadMessage.run_id) {
|
|
211
|
+
return [
|
|
212
|
+
2,
|
|
213
|
+
_object_spread_props(_object_spread({}, threadMessage), {
|
|
214
|
+
runSteps: []
|
|
215
|
+
})
|
|
216
|
+
];
|
|
217
|
+
}
|
|
218
|
+
_tmp = [
|
|
219
|
+
_object_spread({}, threadMessage)
|
|
220
|
+
];
|
|
221
|
+
_tmp1 = {};
|
|
222
|
+
return [
|
|
223
|
+
4,
|
|
224
|
+
getRunSteps({
|
|
225
|
+
threadId: threadMessage.thread_id,
|
|
226
|
+
runId: threadMessage.run_id,
|
|
227
|
+
client: client
|
|
228
|
+
})
|
|
229
|
+
];
|
|
230
|
+
case 1:
|
|
231
|
+
return [
|
|
232
|
+
2,
|
|
233
|
+
_object_spread_props.apply(void 0, _tmp.concat([
|
|
234
|
+
(_tmp1.runSteps = _state.sent(), _tmp1)
|
|
235
|
+
]))
|
|
236
|
+
];
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
return function extendThreadMessage(_) {
|
|
241
|
+
return _ref.apply(this, arguments);
|
|
242
|
+
};
|
|
243
|
+
}();
|
|
66
244
|
// src/lib/optimistic/optimisticId.ts
|
|
67
|
-
|
|
68
|
-
var optimisticId = ()
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
QueryClient,
|
|
73
|
-
dehydrate,
|
|
74
|
-
extendMessage,
|
|
75
|
-
optimisticId
|
|
76
|
-
});
|
|
245
|
+
import { uid } from "radash";
|
|
246
|
+
var optimisticId = function() {
|
|
247
|
+
return "-".concat(uid(24));
|
|
248
|
+
};
|
|
249
|
+
export { extendThreadMessage, optimisticId };
|
|
77
250
|
//# sourceMappingURL=utils.js.map
|
package/dist/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/
|
|
1
|
+
{"version":3,"sources":["../src/lib/runSteps/getRunSteps/index.ts","../src/lib/threadMessages/extendThreadMessage.ts","../src/lib/optimistic/optimisticId.ts"],"names":[],"mappings":";AAQO,IAAM,cAAc,OAAO;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AACF,MAAY;AACV,QAAM,mBAAmB,MAAM,OAAO,KAAK,QAAQ,KAAK,MAAM;AAAA,IAC5D;AAAA,IACA;AAAA,EACF;AAEA,SAAO,iBAAiB;AAC1B;;;ACXO,IAAM,sBAAsB,OAAO;AAAA,EACxC;AAAA,EACA;AACF,MAAY;AACV,MAAI,CAAC,cAAc,QAAQ;AACzB,WAAO;AAAA,MACL,GAAG;AAAA,MACH,UAAU,CAAC;AAAA,IACb;AAAA,EACF;AAEA,SAAO;AAAA,IACL,GAAG;AAAA,IACH,UAAU,MAAM,YAAY;AAAA,MAC1B,UAAU,cAAc;AAAA,MACxB,OAAO,cAAc;AAAA,MACrB;AAAA,IACF,CAAC;AAAA,EACH;AACF;;;AC3BA,SAAS,WAAW;AAEb,IAAM,eAAe,MAC1B,IAAI,IAAI,EAAE,CAAC","sourcesContent":["import OpenAI from 'openai'\n\ntype Args = {\n threadId: string\n runId: string\n client: OpenAI\n}\n\nexport const getRunSteps = async ({\n threadId,\n runId,\n client,\n}: Args) => {\n const runStepsResponse = await client.beta.threads.runs.steps.list(\n threadId,\n runId,\n )\n\n return runStepsResponse.data\n}\n","import OpenAI from 'openai'\nimport { getRunSteps } from '@/lib/runSteps/getRunSteps'\n\ntype Args = {\n threadMessage: OpenAI.Beta.Threads.Messages.ThreadMessage\n client: OpenAI\n}\n\nexport const extendThreadMessage = async ({\n threadMessage,\n client,\n}: Args) => {\n if (!threadMessage.run_id) {\n return {\n ...threadMessage,\n runSteps: [],\n }\n }\n\n return {\n ...threadMessage,\n runSteps: await getRunSteps({\n threadId: threadMessage.thread_id,\n runId: threadMessage.run_id,\n client,\n }),\n }\n}\n","import { uid } from 'radash'\n\nexport const optimisticId = () => (\n `-${uid(24)}`\n)\n"]}
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superinterface/react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"main": "./dist/index.js",
|
|
5
|
-
"module": "./dist/index.
|
|
6
|
-
"types": "./dist/index.d.
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.cts",
|
|
7
8
|
"exports": {
|
|
8
9
|
".": "./dist/index.js",
|
|
9
10
|
"./*": "./dist/*.js",
|
|
@@ -15,36 +16,43 @@
|
|
|
15
16
|
"keywords": [],
|
|
16
17
|
"license": "ISC",
|
|
17
18
|
"scripts": {
|
|
18
|
-
"build": "tsup"
|
|
19
|
-
"resolve-tspaths": "resolve-tspaths",
|
|
20
|
-
"install-peers": "install-peers"
|
|
19
|
+
"build": "tsup"
|
|
21
20
|
},
|
|
22
21
|
"dependencies": {
|
|
23
|
-
"@hookform/resolvers": "^3.3.
|
|
22
|
+
"@hookform/resolvers": "^3.3.4",
|
|
24
23
|
"@radix-ui/react-icons": "^1.3.0",
|
|
25
24
|
"@radix-ui/themes": "^2.0.3",
|
|
25
|
+
"dayjs": "^1.11.10",
|
|
26
|
+
"detect-browser": "^5.3.0",
|
|
27
|
+
"howler": "^2.2.4",
|
|
26
28
|
"lodash": "^4.17.21",
|
|
27
|
-
"openai": "^4.
|
|
29
|
+
"openai": "^4.28.0",
|
|
28
30
|
"p-map": "^7.0.1",
|
|
29
|
-
"radash": "^
|
|
30
|
-
"react-hook-form": "^7.
|
|
31
|
-
"react-intersection-observer": "^9.
|
|
32
|
-
"react-
|
|
31
|
+
"radash": "^12.0.0",
|
|
32
|
+
"react-hook-form": "^7.50.1",
|
|
33
|
+
"react-intersection-observer": "^9.8.0",
|
|
34
|
+
"react-remark": "^2.1.0",
|
|
35
|
+
"react-speech-recognition": "^3.10.0",
|
|
33
36
|
"react-textarea-autosize": "^8.5.3",
|
|
34
|
-
"react-use": "^17.
|
|
37
|
+
"react-use": "^17.5.0",
|
|
38
|
+
"react-use-audio-player": "^2.2.0",
|
|
39
|
+
"regenerator-runtime": "^0.14.1",
|
|
40
|
+
"use-audio-capture": "^0.0.7",
|
|
35
41
|
"zod": "^3.22.4"
|
|
36
42
|
},
|
|
37
43
|
"peerDependencies": {
|
|
38
|
-
"@tanstack/
|
|
39
|
-
"react": "
|
|
44
|
+
"@tanstack/query-core": ">=5.0.0",
|
|
45
|
+
"@tanstack/react-query": ">=5.0.0",
|
|
46
|
+
"@types/react": "*",
|
|
47
|
+
"@types/react-dom": "*",
|
|
48
|
+
"react": ">=18.0.0"
|
|
40
49
|
},
|
|
41
50
|
"devDependencies": {
|
|
42
|
-
"@tanstack/react-query": "
|
|
51
|
+
"@tanstack/react-query": ">=5.0.0",
|
|
43
52
|
"@types/lodash": "^4.14.202",
|
|
44
|
-
"@types/react": "^18.2.
|
|
45
|
-
"
|
|
46
|
-
"react": "
|
|
47
|
-
"
|
|
48
|
-
"tsup": "^8.0.1"
|
|
53
|
+
"@types/react": "^18.2.57",
|
|
54
|
+
"@types/react-speech-recognition": "^3.9.5",
|
|
55
|
+
"react": ">=18.0.0",
|
|
56
|
+
"tsup": "^8.0.2"
|
|
49
57
|
}
|
|
50
58
|
}
|
|
File without changes
|