opik 1.7.30 → 1.7.32
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/{Client-CB3-ejaS.d.cts → Client-Chm8zam3.d.cts} +140 -1
- package/dist/{Client-CB3-ejaS.d.ts → Client-Chm8zam3.d.ts} +140 -1
- package/dist/{Node18UniversalStreamWrapper-GZXI7BSF.js → Node18UniversalStreamWrapper-CXRGJAYU.js} +1 -1
- package/dist/{NodePre18StreamWrapper-TZYQXHQT.js → NodePre18StreamWrapper-FI2YUAZQ.js} +1 -1
- package/dist/{UndiciStreamWrapper-4QYH36IP.js → UndiciStreamWrapper-MS3CLU6Y.js} +1 -1
- package/dist/chunk-VL2AKASE.js +1 -0
- package/dist/chunk-ZT72TAHZ.js +9 -0
- package/dist/index.cjs +9 -4
- package/dist/index.d.cts +271 -3
- package/dist/index.d.ts +271 -3
- package/dist/index.js +1 -1
- package/dist/vercel/index.cjs +9 -4
- package/dist/vercel/index.d.cts +1 -1
- package/dist/vercel/index.d.ts +1 -1
- package/dist/vercel/index.js +1 -1
- package/package.json +14 -2
- package/dist/chunk-PEQD6RFM.js +0 -4
- package/dist/chunk-WOT6VMZA.js +0 -1
|
@@ -2367,6 +2367,16 @@ interface PageColumns {
|
|
|
2367
2367
|
columns?: Column[];
|
|
2368
2368
|
}
|
|
2369
2369
|
|
|
2370
|
+
/**
|
|
2371
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
2372
|
+
*/
|
|
2373
|
+
type ExperimentType = "regular" | "trial" | "mini-batch";
|
|
2374
|
+
declare const ExperimentType: {
|
|
2375
|
+
readonly Regular: "regular";
|
|
2376
|
+
readonly Trial: "trial";
|
|
2377
|
+
readonly MiniBatch: "mini-batch";
|
|
2378
|
+
};
|
|
2379
|
+
|
|
2370
2380
|
/**
|
|
2371
2381
|
* This file was auto-generated by Fern from our API Definition.
|
|
2372
2382
|
*/
|
|
@@ -2709,6 +2719,7 @@ interface ExperimentPublic {
|
|
|
2709
2719
|
createdAt?: Date;
|
|
2710
2720
|
duration?: PercentageValuesPublic;
|
|
2711
2721
|
totalEstimatedCost?: number;
|
|
2722
|
+
totalEstimatedCostAvg?: number;
|
|
2712
2723
|
usage?: Record<string, number>;
|
|
2713
2724
|
lastUpdatedAt?: Date;
|
|
2714
2725
|
createdBy?: string;
|
|
@@ -6682,6 +6693,81 @@ declare class Dataset<T extends DatasetItemData = DatasetItemData> {
|
|
|
6682
6693
|
syncHashes(): Promise<void>;
|
|
6683
6694
|
}
|
|
6684
6695
|
|
|
6696
|
+
/**
|
|
6697
|
+
* References to a dataset item and trace in an experiment.
|
|
6698
|
+
*/
|
|
6699
|
+
declare class ExperimentItemReferences {
|
|
6700
|
+
readonly datasetItemId: string;
|
|
6701
|
+
readonly traceId: string;
|
|
6702
|
+
constructor(params: {
|
|
6703
|
+
datasetItemId: string;
|
|
6704
|
+
traceId: string;
|
|
6705
|
+
});
|
|
6706
|
+
}
|
|
6707
|
+
/**
|
|
6708
|
+
* Content of an experiment item including evaluation data and feedback scores.
|
|
6709
|
+
*/
|
|
6710
|
+
declare class ExperimentItemContent {
|
|
6711
|
+
readonly id?: string;
|
|
6712
|
+
readonly datasetItemId: string;
|
|
6713
|
+
readonly traceId: string;
|
|
6714
|
+
readonly datasetItemData?: JsonListStringCompare;
|
|
6715
|
+
readonly evaluationTaskOutput?: JsonListStringCompare;
|
|
6716
|
+
readonly feedbackScores: FeedbackScore[];
|
|
6717
|
+
constructor(params: {
|
|
6718
|
+
id?: string;
|
|
6719
|
+
datasetItemId: string;
|
|
6720
|
+
traceId: string;
|
|
6721
|
+
datasetItemData?: JsonListStringCompare;
|
|
6722
|
+
evaluationTaskOutput?: JsonListStringCompare;
|
|
6723
|
+
feedbackScores: FeedbackScore[];
|
|
6724
|
+
});
|
|
6725
|
+
/**
|
|
6726
|
+
* Creates an ExperimentItemContent from a REST API ExperimentItemCompare object.
|
|
6727
|
+
*
|
|
6728
|
+
* @param value The REST API ExperimentItemCompare object
|
|
6729
|
+
* @returns A new ExperimentItemContent instance
|
|
6730
|
+
*/
|
|
6731
|
+
static fromRestExperimentItemCompare(value: ExperimentItemCompare): ExperimentItemContent;
|
|
6732
|
+
}
|
|
6733
|
+
|
|
6734
|
+
interface ExperimentData {
|
|
6735
|
+
id?: string;
|
|
6736
|
+
name?: string;
|
|
6737
|
+
datasetName: string;
|
|
6738
|
+
}
|
|
6739
|
+
/**
|
|
6740
|
+
* Represents an Experiment in Opik, linking traces and dataset items
|
|
6741
|
+
*/
|
|
6742
|
+
declare class Experiment {
|
|
6743
|
+
private opik;
|
|
6744
|
+
readonly id: string;
|
|
6745
|
+
readonly name?: string;
|
|
6746
|
+
readonly datasetName: string;
|
|
6747
|
+
/**
|
|
6748
|
+
* Creates a new Experiment instance.
|
|
6749
|
+
* This should not be created directly, use static factory methods instead.
|
|
6750
|
+
*/
|
|
6751
|
+
constructor({ id, name, datasetName }: ExperimentData, opik: OpikClient);
|
|
6752
|
+
/**
|
|
6753
|
+
* Creates new experiment items by linking existing traces and dataset items
|
|
6754
|
+
*
|
|
6755
|
+
* @param experimentItemReferences List of references linking traces with dataset items
|
|
6756
|
+
*/
|
|
6757
|
+
insert(experimentItemReferences: ExperimentItemReferences[]): Promise<void>;
|
|
6758
|
+
/**
|
|
6759
|
+
* Retrieves experiment items with options to limit results and truncate data
|
|
6760
|
+
*
|
|
6761
|
+
* @param options Options for retrieving items
|
|
6762
|
+
* @returns Promise resolving to a list of experiment items
|
|
6763
|
+
*/
|
|
6764
|
+
getItems(options?: {
|
|
6765
|
+
maxResults?: number;
|
|
6766
|
+
truncate?: boolean;
|
|
6767
|
+
}): Promise<ExperimentItemContent[]>;
|
|
6768
|
+
getUrl(): Promise<string>;
|
|
6769
|
+
}
|
|
6770
|
+
|
|
6685
6771
|
interface TraceData extends Omit<Trace$1, "startTime"> {
|
|
6686
6772
|
startTime?: Date;
|
|
6687
6773
|
}
|
|
@@ -6734,7 +6820,60 @@ declare class OpikClient {
|
|
|
6734
6820
|
* @param name The name of the dataset to delete
|
|
6735
6821
|
*/
|
|
6736
6822
|
deleteDataset: (name: string) => Promise<void>;
|
|
6823
|
+
/**
|
|
6824
|
+
* Creates a new experiment with the given dataset name and optional parameters
|
|
6825
|
+
*
|
|
6826
|
+
* @param datasetName The name of the dataset to associate with the experiment
|
|
6827
|
+
* @param name Optional name for the experiment (if not provided, a generated name will be used)
|
|
6828
|
+
* @param experimentConfig Optional experiment configuration parameters
|
|
6829
|
+
* @param type Optional experiment type (defaults to "regular")
|
|
6830
|
+
* @param optimizationId Optional ID of an optimization associated with the experiment
|
|
6831
|
+
* @returns The created Experiment object
|
|
6832
|
+
*/
|
|
6833
|
+
createExperiment: ({ datasetName, name, experimentConfig, type, optimizationId, }: {
|
|
6834
|
+
datasetName: string;
|
|
6835
|
+
name?: string;
|
|
6836
|
+
experimentConfig?: Record<string, unknown>;
|
|
6837
|
+
type?: ExperimentType;
|
|
6838
|
+
optimizationId?: string;
|
|
6839
|
+
}) => Promise<Experiment>;
|
|
6840
|
+
/**
|
|
6841
|
+
* Gets an experiment by its unique ID
|
|
6842
|
+
*
|
|
6843
|
+
* @param id The unique identifier of the experiment
|
|
6844
|
+
* @returns The Experiment object
|
|
6845
|
+
*/
|
|
6846
|
+
getExperimentById: (id: string) => Promise<Experiment>;
|
|
6847
|
+
/**
|
|
6848
|
+
* Gets experiments by name (can return multiple experiments with the same name)
|
|
6849
|
+
*
|
|
6850
|
+
* @param name The name of the experiments to retrieve
|
|
6851
|
+
* @returns A list of Experiment objects with the given name
|
|
6852
|
+
*/
|
|
6853
|
+
getExperimentsByName: (name: string) => Promise<Experiment[]>;
|
|
6854
|
+
/**
|
|
6855
|
+
* Gets a single experiment by name (returns the first match if multiple exist)
|
|
6856
|
+
*
|
|
6857
|
+
* @param name The name of the experiment to retrieve
|
|
6858
|
+
* @returns The Experiment object
|
|
6859
|
+
*/
|
|
6860
|
+
getExperiment: (name: string) => Promise<Experiment>;
|
|
6861
|
+
/**
|
|
6862
|
+
* Gets all experiments associated with a dataset
|
|
6863
|
+
*
|
|
6864
|
+
* @param datasetName The name of the dataset
|
|
6865
|
+
* @param maxResults Maximum number of experiments to return (default: 100)
|
|
6866
|
+
* @returns A list of Experiment objects associated with the dataset
|
|
6867
|
+
* @throws {DatasetNotFoundError} If the dataset doesn't exist
|
|
6868
|
+
*/
|
|
6869
|
+
getDatasetExperiments: (datasetName: string, maxResults?: number) => Promise<Experiment[]>;
|
|
6870
|
+
/**
|
|
6871
|
+
* Deletes an experiment by ID
|
|
6872
|
+
*
|
|
6873
|
+
* @param id The ID of the experiment to delete
|
|
6874
|
+
*/
|
|
6875
|
+
deleteExperiment: (id: string) => Promise<void>;
|
|
6737
6876
|
flush: () => Promise<void>;
|
|
6738
6877
|
}
|
|
6739
6878
|
|
|
6740
|
-
export {
|
|
6879
|
+
export { Dataset as D, OpikClient as O, Span as S, Trace as T, SpanType as a, type DatasetItemData as b, type OpikConfig as c, type DatasetPublic as d };
|
|
@@ -2367,6 +2367,16 @@ interface PageColumns {
|
|
|
2367
2367
|
columns?: Column[];
|
|
2368
2368
|
}
|
|
2369
2369
|
|
|
2370
|
+
/**
|
|
2371
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
2372
|
+
*/
|
|
2373
|
+
type ExperimentType = "regular" | "trial" | "mini-batch";
|
|
2374
|
+
declare const ExperimentType: {
|
|
2375
|
+
readonly Regular: "regular";
|
|
2376
|
+
readonly Trial: "trial";
|
|
2377
|
+
readonly MiniBatch: "mini-batch";
|
|
2378
|
+
};
|
|
2379
|
+
|
|
2370
2380
|
/**
|
|
2371
2381
|
* This file was auto-generated by Fern from our API Definition.
|
|
2372
2382
|
*/
|
|
@@ -2709,6 +2719,7 @@ interface ExperimentPublic {
|
|
|
2709
2719
|
createdAt?: Date;
|
|
2710
2720
|
duration?: PercentageValuesPublic;
|
|
2711
2721
|
totalEstimatedCost?: number;
|
|
2722
|
+
totalEstimatedCostAvg?: number;
|
|
2712
2723
|
usage?: Record<string, number>;
|
|
2713
2724
|
lastUpdatedAt?: Date;
|
|
2714
2725
|
createdBy?: string;
|
|
@@ -6682,6 +6693,81 @@ declare class Dataset<T extends DatasetItemData = DatasetItemData> {
|
|
|
6682
6693
|
syncHashes(): Promise<void>;
|
|
6683
6694
|
}
|
|
6684
6695
|
|
|
6696
|
+
/**
|
|
6697
|
+
* References to a dataset item and trace in an experiment.
|
|
6698
|
+
*/
|
|
6699
|
+
declare class ExperimentItemReferences {
|
|
6700
|
+
readonly datasetItemId: string;
|
|
6701
|
+
readonly traceId: string;
|
|
6702
|
+
constructor(params: {
|
|
6703
|
+
datasetItemId: string;
|
|
6704
|
+
traceId: string;
|
|
6705
|
+
});
|
|
6706
|
+
}
|
|
6707
|
+
/**
|
|
6708
|
+
* Content of an experiment item including evaluation data and feedback scores.
|
|
6709
|
+
*/
|
|
6710
|
+
declare class ExperimentItemContent {
|
|
6711
|
+
readonly id?: string;
|
|
6712
|
+
readonly datasetItemId: string;
|
|
6713
|
+
readonly traceId: string;
|
|
6714
|
+
readonly datasetItemData?: JsonListStringCompare;
|
|
6715
|
+
readonly evaluationTaskOutput?: JsonListStringCompare;
|
|
6716
|
+
readonly feedbackScores: FeedbackScore[];
|
|
6717
|
+
constructor(params: {
|
|
6718
|
+
id?: string;
|
|
6719
|
+
datasetItemId: string;
|
|
6720
|
+
traceId: string;
|
|
6721
|
+
datasetItemData?: JsonListStringCompare;
|
|
6722
|
+
evaluationTaskOutput?: JsonListStringCompare;
|
|
6723
|
+
feedbackScores: FeedbackScore[];
|
|
6724
|
+
});
|
|
6725
|
+
/**
|
|
6726
|
+
* Creates an ExperimentItemContent from a REST API ExperimentItemCompare object.
|
|
6727
|
+
*
|
|
6728
|
+
* @param value The REST API ExperimentItemCompare object
|
|
6729
|
+
* @returns A new ExperimentItemContent instance
|
|
6730
|
+
*/
|
|
6731
|
+
static fromRestExperimentItemCompare(value: ExperimentItemCompare): ExperimentItemContent;
|
|
6732
|
+
}
|
|
6733
|
+
|
|
6734
|
+
interface ExperimentData {
|
|
6735
|
+
id?: string;
|
|
6736
|
+
name?: string;
|
|
6737
|
+
datasetName: string;
|
|
6738
|
+
}
|
|
6739
|
+
/**
|
|
6740
|
+
* Represents an Experiment in Opik, linking traces and dataset items
|
|
6741
|
+
*/
|
|
6742
|
+
declare class Experiment {
|
|
6743
|
+
private opik;
|
|
6744
|
+
readonly id: string;
|
|
6745
|
+
readonly name?: string;
|
|
6746
|
+
readonly datasetName: string;
|
|
6747
|
+
/**
|
|
6748
|
+
* Creates a new Experiment instance.
|
|
6749
|
+
* This should not be created directly, use static factory methods instead.
|
|
6750
|
+
*/
|
|
6751
|
+
constructor({ id, name, datasetName }: ExperimentData, opik: OpikClient);
|
|
6752
|
+
/**
|
|
6753
|
+
* Creates new experiment items by linking existing traces and dataset items
|
|
6754
|
+
*
|
|
6755
|
+
* @param experimentItemReferences List of references linking traces with dataset items
|
|
6756
|
+
*/
|
|
6757
|
+
insert(experimentItemReferences: ExperimentItemReferences[]): Promise<void>;
|
|
6758
|
+
/**
|
|
6759
|
+
* Retrieves experiment items with options to limit results and truncate data
|
|
6760
|
+
*
|
|
6761
|
+
* @param options Options for retrieving items
|
|
6762
|
+
* @returns Promise resolving to a list of experiment items
|
|
6763
|
+
*/
|
|
6764
|
+
getItems(options?: {
|
|
6765
|
+
maxResults?: number;
|
|
6766
|
+
truncate?: boolean;
|
|
6767
|
+
}): Promise<ExperimentItemContent[]>;
|
|
6768
|
+
getUrl(): Promise<string>;
|
|
6769
|
+
}
|
|
6770
|
+
|
|
6685
6771
|
interface TraceData extends Omit<Trace$1, "startTime"> {
|
|
6686
6772
|
startTime?: Date;
|
|
6687
6773
|
}
|
|
@@ -6734,7 +6820,60 @@ declare class OpikClient {
|
|
|
6734
6820
|
* @param name The name of the dataset to delete
|
|
6735
6821
|
*/
|
|
6736
6822
|
deleteDataset: (name: string) => Promise<void>;
|
|
6823
|
+
/**
|
|
6824
|
+
* Creates a new experiment with the given dataset name and optional parameters
|
|
6825
|
+
*
|
|
6826
|
+
* @param datasetName The name of the dataset to associate with the experiment
|
|
6827
|
+
* @param name Optional name for the experiment (if not provided, a generated name will be used)
|
|
6828
|
+
* @param experimentConfig Optional experiment configuration parameters
|
|
6829
|
+
* @param type Optional experiment type (defaults to "regular")
|
|
6830
|
+
* @param optimizationId Optional ID of an optimization associated with the experiment
|
|
6831
|
+
* @returns The created Experiment object
|
|
6832
|
+
*/
|
|
6833
|
+
createExperiment: ({ datasetName, name, experimentConfig, type, optimizationId, }: {
|
|
6834
|
+
datasetName: string;
|
|
6835
|
+
name?: string;
|
|
6836
|
+
experimentConfig?: Record<string, unknown>;
|
|
6837
|
+
type?: ExperimentType;
|
|
6838
|
+
optimizationId?: string;
|
|
6839
|
+
}) => Promise<Experiment>;
|
|
6840
|
+
/**
|
|
6841
|
+
* Gets an experiment by its unique ID
|
|
6842
|
+
*
|
|
6843
|
+
* @param id The unique identifier of the experiment
|
|
6844
|
+
* @returns The Experiment object
|
|
6845
|
+
*/
|
|
6846
|
+
getExperimentById: (id: string) => Promise<Experiment>;
|
|
6847
|
+
/**
|
|
6848
|
+
* Gets experiments by name (can return multiple experiments with the same name)
|
|
6849
|
+
*
|
|
6850
|
+
* @param name The name of the experiments to retrieve
|
|
6851
|
+
* @returns A list of Experiment objects with the given name
|
|
6852
|
+
*/
|
|
6853
|
+
getExperimentsByName: (name: string) => Promise<Experiment[]>;
|
|
6854
|
+
/**
|
|
6855
|
+
* Gets a single experiment by name (returns the first match if multiple exist)
|
|
6856
|
+
*
|
|
6857
|
+
* @param name The name of the experiment to retrieve
|
|
6858
|
+
* @returns The Experiment object
|
|
6859
|
+
*/
|
|
6860
|
+
getExperiment: (name: string) => Promise<Experiment>;
|
|
6861
|
+
/**
|
|
6862
|
+
* Gets all experiments associated with a dataset
|
|
6863
|
+
*
|
|
6864
|
+
* @param datasetName The name of the dataset
|
|
6865
|
+
* @param maxResults Maximum number of experiments to return (default: 100)
|
|
6866
|
+
* @returns A list of Experiment objects associated with the dataset
|
|
6867
|
+
* @throws {DatasetNotFoundError} If the dataset doesn't exist
|
|
6868
|
+
*/
|
|
6869
|
+
getDatasetExperiments: (datasetName: string, maxResults?: number) => Promise<Experiment[]>;
|
|
6870
|
+
/**
|
|
6871
|
+
* Deletes an experiment by ID
|
|
6872
|
+
*
|
|
6873
|
+
* @param id The ID of the experiment to delete
|
|
6874
|
+
*/
|
|
6875
|
+
deleteExperiment: (id: string) => Promise<void>;
|
|
6737
6876
|
flush: () => Promise<void>;
|
|
6738
6877
|
}
|
|
6739
6878
|
|
|
6740
|
-
export {
|
|
6879
|
+
export { Dataset as D, OpikClient as O, Span as S, Trace as T, SpanType as a, type DatasetItemData as b, type OpikConfig as c, type DatasetPublic as d };
|
package/dist/{Node18UniversalStreamWrapper-GZXI7BSF.js → Node18UniversalStreamWrapper-CXRGJAYU.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import'./chunk-
|
|
1
|
+
import'./chunk-VL2AKASE.js';var s=class t{constructor(e){this.readableStream=e,this.reader=this.readableStream.getReader(),this.events={data:[],end:[],error:[],readable:[],close:[],pause:[],resume:[]},this.paused=false,this.resumeCallback=null,this.encoding=null;}on(e,r){var a;(a=this.events[e])==null||a.push(r);}off(e,r){var a;this.events[e]=(a=this.events[e])==null?void 0:a.filter(i=>i!==r);}pipe(e){return this.on("data",async r=>{if(e instanceof t)e._write(r);else if(e instanceof WritableStream){let a=e.getWriter();a.write(r).then(()=>a.releaseLock());}else e.write(r);}),this.on("end",async()=>{e instanceof t?e._end():e instanceof WritableStream?e.getWriter().close():e.end();}),this.on("error",async r=>{e instanceof t?e._error(r):e instanceof WritableStream?e.getWriter().abort(r):e.destroy(r);}),this._startReading(),e}pipeTo(e){return this.pipe(e)}unpipe(e){this.off("data",async r=>{if(e instanceof t)e._write(r);else if(e instanceof WritableStream){let a=e.getWriter();a.write(r).then(()=>a.releaseLock());}else e.write(r);}),this.off("end",async()=>{e instanceof t?e._end():e instanceof WritableStream?e.getWriter().close():e.end();}),this.off("error",async r=>{e instanceof t?e._error(r):e instanceof WritableStream?e.getWriter().abort(r):e.destroy(r);});}destroy(e){this.reader.cancel(e).then(()=>{this._emit("close");}).catch(r=>{this._emit("error",r);});}pause(){this.paused=true,this._emit("pause");}resume(){this.paused&&(this.paused=false,this._emit("resume"),this.resumeCallback&&(this.resumeCallback(),this.resumeCallback=null));}get isPaused(){return this.paused}async read(){this.paused&&await new Promise(a=>{this.resumeCallback=a;});let{done:e,value:r}=await this.reader.read();if(!e)return r}setEncoding(e){this.encoding=e;}async text(){let e=[];for(;;){let{done:a,value:i}=await this.reader.read();if(a)break;i&&e.push(i);}return new TextDecoder(this.encoding||"utf-8").decode(await new Blob(e).arrayBuffer())}async json(){let e=await this.text();return JSON.parse(e)}_write(e){this._emit("data",e);}_end(){this._emit("end");}_error(e){this._emit("error",e);}_emit(e,r){if(this.events[e])for(let a of this.events[e]||[])a(r);}async _startReading(){try{for(this._emit("readable");;){this.paused&&await new Promise(a=>{this.resumeCallback=a;});let{done:e,value:r}=await this.reader.read();if(e){this._emit("end"),this._emit("close");break}r&&this._emit("data",r);}}catch(e){this._emit("error",e);}}[Symbol.asyncIterator](){return {next:async()=>{this.paused&&await new Promise(a=>{this.resumeCallback=a;});let{done:e,value:r}=await this.reader.read();return e?{done:true,value:void 0}:{done:false,value:r}},[Symbol.asyncIterator](){return this}}}};export{s as Node18UniversalStreamWrapper};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import'./chunk-
|
|
1
|
+
import'./chunk-VL2AKASE.js';var i=class{constructor(e){this.readableStream=e;}on(e,r){this.readableStream.on(e,r);}off(e,r){this.readableStream.off(e,r);}pipe(e){return this.readableStream.pipe(e),e}pipeTo(e){return this.pipe(e)}unpipe(e){e?this.readableStream.unpipe(e):this.readableStream.unpipe();}destroy(e){this.readableStream.destroy(e);}pause(){this.readableStream.pause();}resume(){this.readableStream.resume();}get isPaused(){return this.readableStream.isPaused()}async read(){return new Promise((e,r)=>{let a=this.readableStream.read();a?e(a):(this.readableStream.once("readable",()=>{let t=this.readableStream.read();e(t);}),this.readableStream.once("error",r));})}setEncoding(e){this.readableStream.setEncoding(e),this.encoding=e;}async text(){let e=[],r=new TextEncoder;this.readableStream.setEncoding(this.encoding||"utf-8");for await(let t of this.readableStream)e.push(r.encode(t));return new TextDecoder(this.encoding||"utf-8").decode(Buffer.concat(e))}async json(){let e=await this.text();return JSON.parse(e)}[Symbol.asyncIterator](){let r=this.readableStream[Symbol.asyncIterator]();return {async next(){let{value:a,done:t}=await r.next();return {value:a,done:t}},[Symbol.asyncIterator](){return this}}}};export{i as NodePre18StreamWrapper};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import'./chunk-
|
|
1
|
+
import'./chunk-VL2AKASE.js';var s=class a{constructor(e){this.readableStream=e,this.reader=this.readableStream.getReader(),this.events={data:[],end:[],error:[],readable:[],close:[],pause:[],resume:[]},this.paused=false,this.resumeCallback=null,this.encoding=null;}on(e,r){var t;(t=this.events[e])==null||t.push(r);}off(e,r){var t;this.events[e]=(t=this.events[e])==null?void 0:t.filter(i=>i!==r);}pipe(e){return this.on("data",r=>{if(e instanceof a)e._write(r);else {let t=e.getWriter();t.write(r).then(()=>t.releaseLock());}}),this.on("end",()=>{e instanceof a?e._end():e.getWriter().close();}),this.on("error",r=>{e instanceof a?e._error(r):e.getWriter().abort(r);}),this._startReading(),e}pipeTo(e){return this.pipe(e)}unpipe(e){this.off("data",r=>{if(e instanceof a)e._write(r);else {let t=e.getWriter();t.write(r).then(()=>t.releaseLock());}}),this.off("end",()=>{e instanceof a?e._end():e.getWriter().close();}),this.off("error",r=>{e instanceof a?e._error(r):e.getWriter().abort(r);});}destroy(e){this.reader.cancel(e).then(()=>{this._emit("close");}).catch(r=>{this._emit("error",r);});}pause(){this.paused=true,this._emit("pause");}resume(){this.paused&&(this.paused=false,this._emit("resume"),this.resumeCallback&&(this.resumeCallback(),this.resumeCallback=null));}get isPaused(){return this.paused}async read(){this.paused&&await new Promise(t=>{this.resumeCallback=t;});let{done:e,value:r}=await this.reader.read();if(!e)return r}setEncoding(e){this.encoding=e;}async text(){let e=[];for(;;){let{done:t,value:i}=await this.reader.read();if(t)break;i&&e.push(i);}return new TextDecoder(this.encoding||"utf-8").decode(await new Blob(e).arrayBuffer())}async json(){let e=await this.text();return JSON.parse(e)}_write(e){this._emit("data",e);}_end(){this._emit("end");}_error(e){this._emit("error",e);}_emit(e,r){if(this.events[e])for(let t of this.events[e]||[])t(r);}async _startReading(){try{for(this._emit("readable");;){this.paused&&await new Promise(t=>{this.resumeCallback=t;});let{done:e,value:r}=await this.reader.read();if(e){this._emit("end"),this._emit("close");break}r&&this._emit("data",r);}}catch(e){this._emit("error",e);}}[Symbol.asyncIterator](){return {next:async()=>{this.paused&&await new Promise(t=>{this.resumeCallback=t;});let{done:e,value:r}=await this.reader.read();return e?{done:true,value:void 0}:{done:false,value:r}},[Symbol.asyncIterator](){return this}}}};export{s as UndiciStreamWrapper};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var F=Object.create;var p=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var C=(a,b)=>(b=Symbol[a])?b:Symbol.for("Symbol."+a),o=a=>{throw TypeError(a)};var H=(a,b,c)=>b in a?p(a,b,{enumerable:true,configurable:true,writable:true,value:c}):a[b]=c;var z=(a,b)=>p(a,"name",{value:b,configurable:true});var M=(a,b)=>{for(var c in b)p(a,c,{get:b[c],enumerable:true});};var N=a=>{var b;return [,,,F((b=a==null?void 0:a[C("metadata")])!=null?b:null)]},D=["class","method","getter","setter","accessor","field","value","get","set"],n=a=>a!==void 0&&typeof a!="function"?o("Function expected"):a,I=(a,b,c,i,e)=>({kind:D[a],name:b,metadata:i,addInitializer:f=>c._?o("Already initialized"):e.push(n(f||null))}),J=(a,b)=>H(b,C("metadata"),a[3]),O=(a,b,c,i)=>{for(var e=0,f=a[b>>1],l=f&&f.length;e<l;e++)b&1?f[e].call(c):i=f[e].call(c,i);return i},P=(a,b,c,i,e,f)=>{var l,h,w,m,q,d=b&7,r=!!(b&8),k=!!(b&16),s=d>3?a.length+1:d?r?1:2:0,x=D[d+5],y=d>3&&(a[s-1]=[]),E=a[s]||(a[s]=[]),j=d&&(!k&&!r&&(e=e.prototype),d<5&&(d>3||!k)&&G(d<4?e:{get[c](){return A(this,f)},set[c](g){return B(this,f,g)}},c));d?k&&d<4&&z(f,(d>2?"set ":d>1?"get ":"")+c):z(e,c);for(var t=i.length-1;t>=0;t--)m=I(d,c,w={},a[3],E),d&&(m.static=r,m.private=k,q=m.access={has:k?g=>K(e,g):g=>c in g},d^3&&(q.get=k?g=>(d^1?A:L)(g,e,d^4?f:j.get):g=>g[c]),d>2&&(q.set=k?(g,u)=>B(g,e,u,d^4?f:j.set):(g,u)=>g[c]=u)),h=(0, i[t])(d?d<4?k?f:j[x]:d>4?void 0:{get:j.get,set:j.set}:e,m),w._=1,d^4||h===void 0?n(h)&&(d>4?y.unshift(h):d?k?f=h:j[x]=h:e=h):typeof h!="object"||h===null?o("Object expected"):(n(l=h.get)&&(j.get=l),n(l=h.set)&&(j.set=l),n(l=h.init)&&y.unshift(l));return d||J(a,e),j&&p(e,c,j),k?d^4?f:j:e};var v=(a,b,c)=>b.has(a)||o("Cannot "+c),K=(a,b)=>Object(b)!==b?o('Cannot use the "in" operator on this value'):a.has(b),A=(a,b,c)=>(v(a,b,"read from private field"),c?c.call(a):b.get(a));var B=(a,b,c,i)=>(v(a,b,"write to private field"),i?i.call(a,c):b.set(a,c),c),L=(a,b,c)=>(v(a,b,"access private method"),c);export{M as a,N as b,J as c,O as d,P as e};
|