1
- const Replicate = require ( "./lib/replicate" ) ;
1
+ const ReplicateClass = require ( "./lib/replicate" ) ;
2
2
const ApiError = require ( "./lib/error" ) ;
3
+ require ( "./lib/types" ) ;
3
4
4
5
/**
5
6
* Placeholder class used to warn of deprecated constructor.
6
7
* @deprecated use exported Replicate class instead
7
8
*/
8
- class DeprecatedReplicate extends Replicate {
9
+ class DeprecatedReplicate extends ReplicateClass {
9
10
/** @deprecated Use `import { Replicate } from "replicate";` instead */
10
11
// biome-ignore lint/complexity/noUselessConstructor: exists for the tsdoc comment
11
12
constructor ( ...args ) {
12
13
super ( ...args ) ;
13
14
}
14
15
}
15
16
16
- const named = { ApiError, Replicate } ;
17
- const singleton = new Replicate ( ) ;
17
+ const named = { ApiError, Replicate : ReplicateClass } ;
18
+ const singleton = new ReplicateClass ( ) ;
18
19
19
20
/**
20
21
* Default instance of the Replicate class that gets the access token
@@ -48,7 +49,7 @@ const singleton = new Replicate();
48
49
* const client = new Replicate({...});
49
50
* ```
50
51
*
51
- * @type { Replicate & typeof DeprecatedReplicate & {ApiError: ApiError, Replicate: Replicate } }
52
+ * @type { Replicate & typeof DeprecatedReplicate & {Replicate: typeof ReplicateClass } }
52
53
*/
53
54
const replicate = new Proxy ( DeprecatedReplicate , {
54
55
get ( target , prop , receiver ) {
@@ -70,3 +71,26 @@ const replicate = new Proxy(DeprecatedReplicate, {
70
71
} ) ;
71
72
72
73
module . exports = replicate ;
74
+
75
+ // - Type Definitions
76
+
77
+ /**
78
+ * @typedef {import("./lib/replicate") } Replicate
79
+ * @typedef {import("./lib/error") } ApiError
80
+ * @typedef {typeof import("./lib/types").Collection } Collection
81
+ * @typedef {typeof import("./lib/types").ModelVersion } ModelVersion
82
+ * @typedef {typeof import("./lib/types").Hardware } Hardware
83
+ * @typedef {typeof import("./lib/types").Model } Model
84
+ * @typedef {typeof import("./lib/types").Prediction } Prediction
85
+ * @typedef {typeof import("./lib/types").Training } Training
86
+ * @typedef {typeof import("./lib/types").ServerSentEvent } ServerSentEvent
87
+ * @typedef {typeof import("./lib/types").Status } Status
88
+ * @typedef {typeof import("./lib/types").Visibility } Visibility
89
+ * @typedef {typeof import("./lib/types").WebhookEventType } WebhookEventType
90
+ */
91
+
92
+ /**
93
+ * @template T
94
+ * @typedef {typeof import("./lib/types").Page } Page
95
+ */
96
+
0 commit comments