@xsai/shared 0.5.0-beta.5 → 0.5.0-beta.7

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.ts CHANGED
@@ -125,16 +125,6 @@ declare const objCamelToSnake: (obj: Record<string, unknown>) => {
125
125
  */
126
126
  declare const clean: <T extends Record<string, undefined | unknown>>(obj: T) => Record<keyof T, Exclude<T[keyof T], unknown>>;
127
127
 
128
- declare class DelayedPromise<T> {
129
- get promise(): Promise<T>;
130
- private _promise;
131
- private _reject;
132
- private _resolve;
133
- private status;
134
- reject(error: unknown): void;
135
- resolve(value: T): void;
136
- }
137
-
138
128
  declare const postJSON: (path: string, options: WithUnknown<CommonRequestOptions>) => Promise<Response>;
139
129
 
140
130
  declare const requestBody: (body: Record<string, unknown>) => string;
@@ -150,5 +140,5 @@ declare const responseJSON: <T>(res: Response) => Promise<T>;
150
140
  type TrampolineFn<T> = (() => Promise<TrampolineFn<T>> | TrampolineFn<T>) | Promise<T> | T;
151
141
  declare const trampoline: <T>(fn: () => Promise<TrampolineFn<T>> | TrampolineFn<T>) => Promise<T>;
152
142
 
153
- export { APICallError, DelayedPromise, InvalidResponseError, InvalidToolCallError, InvalidToolInputError, JSONParseError, RemoteAPIError, ToolExecutionError, XSAIError, clean, objCamelToSnake, postJSON, requestBody, requestHeaders, requestURL, responseCatch, responseJSON, strCamelToSnake, trampoline };
143
+ export { APICallError, InvalidResponseError, InvalidToolCallError, InvalidToolInputError, JSONParseError, RemoteAPIError, ToolExecutionError, XSAIError, clean, objCamelToSnake, postJSON, requestBody, requestHeaders, requestURL, responseCatch, responseJSON, strCamelToSnake, trampoline };
154
144
  export type { APICallErrorOptions, CommonRequestOptions, Fetch, InvalidResponseErrorOptions, InvalidResponseReason, InvalidToolCallErrorOptions, InvalidToolCallReason, InvalidToolInputErrorOptions, JSONParseErrorOptions, RemoteAPIErrorOptions, ToolExecutionErrorOptions, TrampolineFn, WithUnknown, XSAIErrorCode };
package/dist/index.js CHANGED
@@ -64,34 +64,6 @@ const clean = (obj) => Object.fromEntries(
64
64
  Object.entries(obj).filter(([, v]) => v !== void 0)
65
65
  );
66
66
 
67
- class DelayedPromise {
68
- get promise() {
69
- this._promise ??= new Promise((resolve, reject) => {
70
- if (this.status.type === "resolved") {
71
- resolve(this.status.value);
72
- } else if (this.status.type === "rejected") {
73
- reject(this.status.error);
74
- }
75
- this._resolve = resolve;
76
- this._reject = reject;
77
- });
78
- return this._promise;
79
- }
80
- status = { type: "pending" };
81
- reject(error) {
82
- this.status = { error, type: "rejected" };
83
- if (this._promise) {
84
- this._reject?.(error);
85
- }
86
- }
87
- resolve(value) {
88
- this.status = { type: "resolved", value };
89
- if (this._promise) {
90
- this._resolve?.(value);
91
- }
92
- }
93
- }
94
-
95
67
  const requestBody = (body) => JSON.stringify(objCamelToSnake(clean({
96
68
  ...body,
97
69
  abortSignal: void 0,
@@ -166,4 +138,4 @@ const trampoline = async (fn) => {
166
138
  return result;
167
139
  };
168
140
 
169
- export { APICallError, DelayedPromise, InvalidResponseError, InvalidToolCallError, InvalidToolInputError, JSONParseError, RemoteAPIError, ToolExecutionError, XSAIError, clean, objCamelToSnake, postJSON, requestBody, requestHeaders, requestURL, responseCatch, responseJSON, strCamelToSnake, trampoline };
141
+ export { APICallError, InvalidResponseError, InvalidToolCallError, InvalidToolInputError, JSONParseError, RemoteAPIError, ToolExecutionError, XSAIError, clean, objCamelToSnake, postJSON, requestBody, requestHeaders, requestURL, responseCatch, responseJSON, strCamelToSnake, trampoline };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@xsai/shared",
3
3
  "type": "module",
4
- "version": "0.5.0-beta.5",
4
+ "version": "0.5.0-beta.7",
5
5
  "description": "extra-small AI SDK.",
6
6
  "author": "Moeru AI",
7
7
  "license": "MIT",