@proofhound/api-client 0.1.6

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.
Files changed (82) hide show
  1. package/LICENSE +190 -0
  2. package/dist/annotation.d.ts +245 -0
  3. package/dist/annotation.d.ts.map +1 -0
  4. package/dist/annotation.js +19 -0
  5. package/dist/annotation.js.map +1 -0
  6. package/dist/api-token.d.ts +53 -0
  7. package/dist/api-token.d.ts.map +1 -0
  8. package/dist/api-token.js +12 -0
  9. package/dist/api-token.js.map +1 -0
  10. package/dist/auth-source.d.ts +29 -0
  11. package/dist/auth-source.d.ts.map +1 -0
  12. package/dist/auth-source.js +30 -0
  13. package/dist/auth-source.js.map +1 -0
  14. package/dist/canary-release.d.ts +635 -0
  15. package/dist/canary-release.d.ts.map +1 -0
  16. package/dist/canary-release.js +48 -0
  17. package/dist/canary-release.js.map +1 -0
  18. package/dist/configure.d.ts +20 -0
  19. package/dist/configure.d.ts.map +1 -0
  20. package/dist/configure.js +41 -0
  21. package/dist/configure.js.map +1 -0
  22. package/dist/connector.d.ts +446 -0
  23. package/dist/connector.d.ts.map +1 -0
  24. package/dist/connector.js +70 -0
  25. package/dist/connector.js.map +1 -0
  26. package/dist/dataset-import.d.ts +75 -0
  27. package/dist/dataset-import.d.ts.map +1 -0
  28. package/dist/dataset-import.js +25 -0
  29. package/dist/dataset-import.js.map +1 -0
  30. package/dist/dataset.d.ts +136 -0
  31. package/dist/dataset.d.ts.map +1 -0
  32. package/dist/dataset.js +67 -0
  33. package/dist/dataset.js.map +1 -0
  34. package/dist/experiment.d.ts +365 -0
  35. package/dist/experiment.d.ts.map +1 -0
  36. package/dist/experiment.js +65 -0
  37. package/dist/experiment.js.map +1 -0
  38. package/dist/http.d.ts +3 -0
  39. package/dist/http.d.ts.map +1 -0
  40. package/dist/http.js +13 -0
  41. package/dist/http.js.map +1 -0
  42. package/dist/index.d.ts +20 -0
  43. package/dist/index.d.ts.map +1 -0
  44. package/dist/index.js +39 -0
  45. package/dist/index.js.map +1 -0
  46. package/dist/model.d.ts +274 -0
  47. package/dist/model.d.ts.map +1 -0
  48. package/dist/model.js +73 -0
  49. package/dist/model.js.map +1 -0
  50. package/dist/monitoring.d.ts +200 -0
  51. package/dist/monitoring.d.ts.map +1 -0
  52. package/dist/monitoring.js +49 -0
  53. package/dist/monitoring.js.map +1 -0
  54. package/dist/optimization.d.ts +574 -0
  55. package/dist/optimization.d.ts.map +1 -0
  56. package/dist/optimization.js +22 -0
  57. package/dist/optimization.js.map +1 -0
  58. package/dist/production-release.d.ts +122 -0
  59. package/dist/production-release.d.ts.map +1 -0
  60. package/dist/production-release.js +22 -0
  61. package/dist/production-release.js.map +1 -0
  62. package/dist/prompt.d.ts +481 -0
  63. package/dist/prompt.d.ts.map +1 -0
  64. package/dist/prompt.js +22 -0
  65. package/dist/prompt.js.map +1 -0
  66. package/dist/public-env.d.ts +2 -0
  67. package/dist/public-env.d.ts.map +1 -0
  68. package/dist/public-env.js +50 -0
  69. package/dist/public-env.js.map +1 -0
  70. package/dist/quick-start.d.ts +71 -0
  71. package/dist/quick-start.d.ts.map +1 -0
  72. package/dist/quick-start.js +11 -0
  73. package/dist/quick-start.js.map +1 -0
  74. package/dist/release-line.d.ts +1052 -0
  75. package/dist/release-line.d.ts.map +1 -0
  76. package/dist/release-line.js +18 -0
  77. package/dist/release-line.js.map +1 -0
  78. package/dist/run-result.d.ts +120 -0
  79. package/dist/run-result.d.ts.map +1 -0
  80. package/dist/run-result.js +50 -0
  81. package/dist/run-result.js.map +1 -0
  82. package/package.json +45 -0
@@ -0,0 +1,20 @@
1
+ import type { AuthSource } from './auth-source';
2
+ export interface ApiClientConfig {
3
+ authSource: AuthSource;
4
+ /** Returns the current project ID to attach as X-Project-Id. */
5
+ getProjectId: () => string;
6
+ /** When provided, overrides httpClient.defaults.baseURL. */
7
+ baseUrl?: string;
8
+ }
9
+ /**
10
+ * configureApiClient — wire Authorization and X-Project-Id interceptors.
11
+ *
12
+ * Call once on app init (e.g. from ProofHoundWebProvider) with the resolved
13
+ * AuthSource and project accessor. Re-calling is safe: the previous
14
+ * interceptor is ejected before a new one is registered, so headers are
15
+ * never doubled.
16
+ *
17
+ * Spec: 08 §4.1 / §4.2
18
+ */
19
+ export declare function configureApiClient(config: ApiClientConfig): void;
20
+ //# sourceMappingURL=configure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configure.d.ts","sourceRoot":"","sources":["../src/configure.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,UAAU,CAAC;IACvB,gEAAgE;IAChE,YAAY,EAAE,MAAM,MAAM,CAAC;IAC3B,4DAA4D;IAC5D,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAQD;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,CAsBhE"}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.configureApiClient = configureApiClient;
4
+ const http_1 = require("./http");
5
+ /**
6
+ * Tracks the interceptor registered by the most recent configureApiClient call
7
+ * so that re-configuring ejects the previous interceptor first (idempotent).
8
+ */
9
+ let interceptorId = null;
10
+ /**
11
+ * configureApiClient — wire Authorization and X-Project-Id interceptors.
12
+ *
13
+ * Call once on app init (e.g. from ProofHoundWebProvider) with the resolved
14
+ * AuthSource and project accessor. Re-calling is safe: the previous
15
+ * interceptor is ejected before a new one is registered, so headers are
16
+ * never doubled.
17
+ *
18
+ * Spec: 08 §4.1 / §4.2
19
+ */
20
+ function configureApiClient(config) {
21
+ if (config.baseUrl) {
22
+ http_1.httpClient.defaults.baseURL = config.baseUrl;
23
+ }
24
+ // Eject the previously registered interceptor to avoid stacking on re-config.
25
+ if (interceptorId !== null) {
26
+ http_1.httpClient.interceptors.request.eject(interceptorId);
27
+ interceptorId = null;
28
+ }
29
+ interceptorId = http_1.httpClient.interceptors.request.use(async (req) => {
30
+ const token = await config.authSource.getToken();
31
+ if (token) {
32
+ req.headers.set('Authorization', `Bearer ${token}`);
33
+ }
34
+ const pid = config.getProjectId();
35
+ if (pid) {
36
+ req.headers.set('X-Project-Id', pid);
37
+ }
38
+ return req;
39
+ });
40
+ }
41
+ //# sourceMappingURL=configure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configure.js","sourceRoot":"","sources":["../src/configure.ts"],"names":[],"mappings":";;AA2BA,gDAsBC;AAjDD,iCAAoC;AAWpC;;;GAGG;AACH,IAAI,aAAa,GAAkB,IAAI,CAAC;AAExC;;;;;;;;;GASG;AACH,SAAgB,kBAAkB,CAAC,MAAuB;IACxD,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,iBAAU,CAAC,QAAQ,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;IAC/C,CAAC;IAED,8EAA8E;IAC9E,IAAI,aAAa,KAAK,IAAI,EAAE,CAAC;QAC3B,iBAAU,CAAC,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QACrD,aAAa,GAAG,IAAI,CAAC;IACvB,CAAC;IAED,aAAa,GAAG,iBAAU,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;QAChE,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;QACjD,IAAI,KAAK,EAAE,CAAC;YACV,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,UAAU,KAAK,EAAE,CAAC,CAAC;QACtD,CAAC;QACD,MAAM,GAAG,GAAG,MAAM,CAAC,YAAY,EAAE,CAAC;QAClC,IAAI,GAAG,EAAE,CAAC;YACR,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC;QACvC,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,446 @@
1
+ import type { BulkDeleteConnectorsRequestDto, ConnectorListItemDto, ConnectorListQueryDto, CreateConnectorDto, CreateWebhookTokenDto, PeekConnectorRequestDto, UpdateConnectorDto } from '@proofhound/shared';
2
+ export interface ConnectorDeleteOptions {
3
+ force?: boolean;
4
+ reason?: string;
5
+ }
6
+ export declare const connectorClient: {
7
+ list: (projectId: string, query?: ConnectorListQueryDto) => Promise<{
8
+ data: {
9
+ id: string;
10
+ projectId: string;
11
+ name: string;
12
+ description: string | null;
13
+ direction: "output" | "input";
14
+ type: "redis" | "kafka" | "webhook";
15
+ webhookPath: string | null;
16
+ hasToken: boolean;
17
+ ipWhitelistCount: number;
18
+ configSummary: string;
19
+ healthStatus: "unknown" | "healthy" | "degraded" | "unhealthy";
20
+ lastProbedAt: string | null;
21
+ lastProbeError: string | null;
22
+ references: {
23
+ canaryReleases: number;
24
+ productionReleases: number;
25
+ };
26
+ createdBy: string;
27
+ createdByDisplayName: string | null;
28
+ createdAt: string;
29
+ updatedAt: string;
30
+ }[];
31
+ total: number;
32
+ }>;
33
+ get: (projectId: string, connectorId: string) => Promise<{
34
+ id: string;
35
+ projectId: string;
36
+ name: string;
37
+ description: string | null;
38
+ direction: "output" | "input";
39
+ type: "redis" | "kafka" | "webhook";
40
+ webhookPath: string | null;
41
+ hasToken: boolean;
42
+ ipWhitelistCount: number;
43
+ configSummary: string;
44
+ healthStatus: "unknown" | "healthy" | "degraded" | "unhealthy";
45
+ lastProbedAt: string | null;
46
+ lastProbeError: string | null;
47
+ references: {
48
+ canaryReleases: number;
49
+ productionReleases: number;
50
+ };
51
+ createdBy: string;
52
+ createdByDisplayName: string | null;
53
+ createdAt: string;
54
+ updatedAt: string;
55
+ config: {
56
+ mode: "stream" | "list";
57
+ key: string;
58
+ lastPeekPayloadSchema?: Record<string, unknown> | null | undefined;
59
+ lastPeekMessage?: {
60
+ id: string;
61
+ receivedAt: string | null;
62
+ payload: unknown;
63
+ metadata?: Record<string, unknown> | undefined;
64
+ } | null | undefined;
65
+ lastPeekedAt?: string | undefined;
66
+ lastPeekMessageCount?: number | undefined;
67
+ connection?: {
68
+ source: "local_config";
69
+ host: string;
70
+ port: number;
71
+ username?: string | null | undefined;
72
+ defaultDbIndex?: number | null | undefined;
73
+ deploymentType?: "standalone" | "sentinel" | "cluster" | null | undefined;
74
+ } | undefined;
75
+ blockMs?: number | undefined;
76
+ batchSize?: number | undefined;
77
+ } | {
78
+ mode: "stream" | "list";
79
+ key: string;
80
+ connection?: {
81
+ source: "local_config";
82
+ host: string;
83
+ port: number;
84
+ username?: string | null | undefined;
85
+ defaultDbIndex?: number | null | undefined;
86
+ deploymentType?: "standalone" | "sentinel" | "cluster" | null | undefined;
87
+ } | undefined;
88
+ maxLen?: number | undefined;
89
+ } | {
90
+ topic: string;
91
+ consumerGroup: string;
92
+ lastPeekPayloadSchema?: Record<string, unknown> | null | undefined;
93
+ lastPeekMessage?: {
94
+ id: string;
95
+ receivedAt: string | null;
96
+ payload: unknown;
97
+ metadata?: Record<string, unknown> | undefined;
98
+ } | null | undefined;
99
+ lastPeekedAt?: string | undefined;
100
+ lastPeekMessageCount?: number | undefined;
101
+ connection?: {
102
+ source: "local_config";
103
+ bootstrapBrokers: string[];
104
+ securityProtocol: "PLAINTEXT" | "SASL_PLAINTEXT" | "SASL_SSL" | "SSL";
105
+ saslMechanism?: "PLAIN" | "SCRAM-SHA-256" | "SCRAM-SHA-512" | null | undefined;
106
+ saslUsername?: string | null | undefined;
107
+ } | undefined;
108
+ fromBeginning?: boolean | undefined;
109
+ batchSize?: number | undefined;
110
+ } | {
111
+ topic: string;
112
+ connection?: {
113
+ source: "local_config";
114
+ bootstrapBrokers: string[];
115
+ securityProtocol: "PLAINTEXT" | "SASL_PLAINTEXT" | "SASL_SSL" | "SSL";
116
+ saslMechanism?: "PLAIN" | "SCRAM-SHA-256" | "SCRAM-SHA-512" | null | undefined;
117
+ saslUsername?: string | null | undefined;
118
+ } | undefined;
119
+ partitionKey?: string | undefined;
120
+ } | {
121
+ webhookMode: "sync" | "async";
122
+ webhookSlug?: string | undefined;
123
+ pathName?: string | undefined;
124
+ timeoutSeconds?: number | undefined;
125
+ expectedPayloadSchema?: Record<string, unknown> | undefined;
126
+ } | {
127
+ targetUrl: string;
128
+ method: "POST" | "PUT";
129
+ headers?: Record<string, string> | undefined;
130
+ retryPolicy?: {
131
+ maxRetries: number;
132
+ backoffMs: number;
133
+ } | undefined;
134
+ };
135
+ webhookTokens: {
136
+ id: string;
137
+ name: string;
138
+ prefix: string;
139
+ expiresAt: string | null;
140
+ lastUsedAt: string | null;
141
+ createdAt: string;
142
+ }[];
143
+ ipWhitelist: string[] | null;
144
+ }>;
145
+ getReferences: (projectId: string, connectorId: string) => Promise<{
146
+ summary: {
147
+ canaryReleases: number;
148
+ productionReleases: number;
149
+ };
150
+ references: {
151
+ id: string;
152
+ kind: "canary_release" | "production_release";
153
+ name: string | null;
154
+ status: string;
155
+ }[];
156
+ }>;
157
+ create: (projectId: string, body: CreateConnectorDto) => Promise<{
158
+ id: string;
159
+ projectId: string;
160
+ name: string;
161
+ description: string | null;
162
+ direction: "output" | "input";
163
+ type: "redis" | "kafka" | "webhook";
164
+ webhookPath: string | null;
165
+ hasToken: boolean;
166
+ ipWhitelistCount: number;
167
+ configSummary: string;
168
+ healthStatus: "unknown" | "healthy" | "degraded" | "unhealthy";
169
+ lastProbedAt: string | null;
170
+ lastProbeError: string | null;
171
+ references: {
172
+ canaryReleases: number;
173
+ productionReleases: number;
174
+ };
175
+ createdBy: string;
176
+ createdByDisplayName: string | null;
177
+ createdAt: string;
178
+ updatedAt: string;
179
+ config: {
180
+ mode: "stream" | "list";
181
+ key: string;
182
+ lastPeekPayloadSchema?: Record<string, unknown> | null | undefined;
183
+ lastPeekMessage?: {
184
+ id: string;
185
+ receivedAt: string | null;
186
+ payload: unknown;
187
+ metadata?: Record<string, unknown> | undefined;
188
+ } | null | undefined;
189
+ lastPeekedAt?: string | undefined;
190
+ lastPeekMessageCount?: number | undefined;
191
+ connection?: {
192
+ source: "local_config";
193
+ host: string;
194
+ port: number;
195
+ username?: string | null | undefined;
196
+ defaultDbIndex?: number | null | undefined;
197
+ deploymentType?: "standalone" | "sentinel" | "cluster" | null | undefined;
198
+ } | undefined;
199
+ blockMs?: number | undefined;
200
+ batchSize?: number | undefined;
201
+ } | {
202
+ mode: "stream" | "list";
203
+ key: string;
204
+ connection?: {
205
+ source: "local_config";
206
+ host: string;
207
+ port: number;
208
+ username?: string | null | undefined;
209
+ defaultDbIndex?: number | null | undefined;
210
+ deploymentType?: "standalone" | "sentinel" | "cluster" | null | undefined;
211
+ } | undefined;
212
+ maxLen?: number | undefined;
213
+ } | {
214
+ topic: string;
215
+ consumerGroup: string;
216
+ lastPeekPayloadSchema?: Record<string, unknown> | null | undefined;
217
+ lastPeekMessage?: {
218
+ id: string;
219
+ receivedAt: string | null;
220
+ payload: unknown;
221
+ metadata?: Record<string, unknown> | undefined;
222
+ } | null | undefined;
223
+ lastPeekedAt?: string | undefined;
224
+ lastPeekMessageCount?: number | undefined;
225
+ connection?: {
226
+ source: "local_config";
227
+ bootstrapBrokers: string[];
228
+ securityProtocol: "PLAINTEXT" | "SASL_PLAINTEXT" | "SASL_SSL" | "SSL";
229
+ saslMechanism?: "PLAIN" | "SCRAM-SHA-256" | "SCRAM-SHA-512" | null | undefined;
230
+ saslUsername?: string | null | undefined;
231
+ } | undefined;
232
+ fromBeginning?: boolean | undefined;
233
+ batchSize?: number | undefined;
234
+ } | {
235
+ topic: string;
236
+ connection?: {
237
+ source: "local_config";
238
+ bootstrapBrokers: string[];
239
+ securityProtocol: "PLAINTEXT" | "SASL_PLAINTEXT" | "SASL_SSL" | "SSL";
240
+ saslMechanism?: "PLAIN" | "SCRAM-SHA-256" | "SCRAM-SHA-512" | null | undefined;
241
+ saslUsername?: string | null | undefined;
242
+ } | undefined;
243
+ partitionKey?: string | undefined;
244
+ } | {
245
+ webhookMode: "sync" | "async";
246
+ webhookSlug?: string | undefined;
247
+ pathName?: string | undefined;
248
+ timeoutSeconds?: number | undefined;
249
+ expectedPayloadSchema?: Record<string, unknown> | undefined;
250
+ } | {
251
+ targetUrl: string;
252
+ method: "POST" | "PUT";
253
+ headers?: Record<string, string> | undefined;
254
+ retryPolicy?: {
255
+ maxRetries: number;
256
+ backoffMs: number;
257
+ } | undefined;
258
+ };
259
+ webhookTokens: {
260
+ id: string;
261
+ name: string;
262
+ prefix: string;
263
+ expiresAt: string | null;
264
+ lastUsedAt: string | null;
265
+ createdAt: string;
266
+ }[];
267
+ ipWhitelist: string[] | null;
268
+ initialWebhookToken?: {
269
+ id: string;
270
+ name: string;
271
+ prefix: string;
272
+ plaintext: string;
273
+ expiresAt: string | null;
274
+ } | undefined;
275
+ }>;
276
+ update: (projectId: string, connectorId: string, body: UpdateConnectorDto) => Promise<{
277
+ id: string;
278
+ projectId: string;
279
+ name: string;
280
+ description: string | null;
281
+ direction: "output" | "input";
282
+ type: "redis" | "kafka" | "webhook";
283
+ webhookPath: string | null;
284
+ hasToken: boolean;
285
+ ipWhitelistCount: number;
286
+ configSummary: string;
287
+ healthStatus: "unknown" | "healthy" | "degraded" | "unhealthy";
288
+ lastProbedAt: string | null;
289
+ lastProbeError: string | null;
290
+ references: {
291
+ canaryReleases: number;
292
+ productionReleases: number;
293
+ };
294
+ createdBy: string;
295
+ createdByDisplayName: string | null;
296
+ createdAt: string;
297
+ updatedAt: string;
298
+ config: {
299
+ mode: "stream" | "list";
300
+ key: string;
301
+ lastPeekPayloadSchema?: Record<string, unknown> | null | undefined;
302
+ lastPeekMessage?: {
303
+ id: string;
304
+ receivedAt: string | null;
305
+ payload: unknown;
306
+ metadata?: Record<string, unknown> | undefined;
307
+ } | null | undefined;
308
+ lastPeekedAt?: string | undefined;
309
+ lastPeekMessageCount?: number | undefined;
310
+ connection?: {
311
+ source: "local_config";
312
+ host: string;
313
+ port: number;
314
+ username?: string | null | undefined;
315
+ defaultDbIndex?: number | null | undefined;
316
+ deploymentType?: "standalone" | "sentinel" | "cluster" | null | undefined;
317
+ } | undefined;
318
+ blockMs?: number | undefined;
319
+ batchSize?: number | undefined;
320
+ } | {
321
+ mode: "stream" | "list";
322
+ key: string;
323
+ connection?: {
324
+ source: "local_config";
325
+ host: string;
326
+ port: number;
327
+ username?: string | null | undefined;
328
+ defaultDbIndex?: number | null | undefined;
329
+ deploymentType?: "standalone" | "sentinel" | "cluster" | null | undefined;
330
+ } | undefined;
331
+ maxLen?: number | undefined;
332
+ } | {
333
+ topic: string;
334
+ consumerGroup: string;
335
+ lastPeekPayloadSchema?: Record<string, unknown> | null | undefined;
336
+ lastPeekMessage?: {
337
+ id: string;
338
+ receivedAt: string | null;
339
+ payload: unknown;
340
+ metadata?: Record<string, unknown> | undefined;
341
+ } | null | undefined;
342
+ lastPeekedAt?: string | undefined;
343
+ lastPeekMessageCount?: number | undefined;
344
+ connection?: {
345
+ source: "local_config";
346
+ bootstrapBrokers: string[];
347
+ securityProtocol: "PLAINTEXT" | "SASL_PLAINTEXT" | "SASL_SSL" | "SSL";
348
+ saslMechanism?: "PLAIN" | "SCRAM-SHA-256" | "SCRAM-SHA-512" | null | undefined;
349
+ saslUsername?: string | null | undefined;
350
+ } | undefined;
351
+ fromBeginning?: boolean | undefined;
352
+ batchSize?: number | undefined;
353
+ } | {
354
+ topic: string;
355
+ connection?: {
356
+ source: "local_config";
357
+ bootstrapBrokers: string[];
358
+ securityProtocol: "PLAINTEXT" | "SASL_PLAINTEXT" | "SASL_SSL" | "SSL";
359
+ saslMechanism?: "PLAIN" | "SCRAM-SHA-256" | "SCRAM-SHA-512" | null | undefined;
360
+ saslUsername?: string | null | undefined;
361
+ } | undefined;
362
+ partitionKey?: string | undefined;
363
+ } | {
364
+ webhookMode: "sync" | "async";
365
+ webhookSlug?: string | undefined;
366
+ pathName?: string | undefined;
367
+ timeoutSeconds?: number | undefined;
368
+ expectedPayloadSchema?: Record<string, unknown> | undefined;
369
+ } | {
370
+ targetUrl: string;
371
+ method: "POST" | "PUT";
372
+ headers?: Record<string, string> | undefined;
373
+ retryPolicy?: {
374
+ maxRetries: number;
375
+ backoffMs: number;
376
+ } | undefined;
377
+ };
378
+ webhookTokens: {
379
+ id: string;
380
+ name: string;
381
+ prefix: string;
382
+ expiresAt: string | null;
383
+ lastUsedAt: string | null;
384
+ createdAt: string;
385
+ }[];
386
+ ipWhitelist: string[] | null;
387
+ }>;
388
+ delete: (projectId: string, connectorId: string, options?: ConnectorDeleteOptions) => Promise<undefined>;
389
+ bulkDelete: (projectId: string, body: BulkDeleteConnectorsRequestDto) => Promise<{
390
+ deletedIds: string[];
391
+ rejected: {
392
+ id: string;
393
+ reason: string;
394
+ referencedBy?: {
395
+ canaryReleases: number;
396
+ productionReleases: number;
397
+ } | undefined;
398
+ }[];
399
+ }>;
400
+ probe: (projectId: string, connectorId: string) => Promise<{
401
+ connectorId: string;
402
+ status: "failed" | "success";
403
+ probedAt: string;
404
+ durationMs: number;
405
+ error: string | null;
406
+ }>;
407
+ peek: (projectId: string, connectorId: string, body: PeekConnectorRequestDto) => Promise<{
408
+ connectorId: string;
409
+ source: "driver" | "unavailable";
410
+ messages: {
411
+ id: string;
412
+ receivedAt: string | null;
413
+ payload: unknown;
414
+ metadata?: Record<string, unknown> | undefined;
415
+ }[];
416
+ payloadSchema: Record<string, unknown> | null;
417
+ fetchedAt: string;
418
+ error: string | null;
419
+ }>;
420
+ listWebhookTokens: (projectId: string, connectorId: string) => Promise<{
421
+ data: {
422
+ id: string;
423
+ name: string;
424
+ prefix: string;
425
+ expiresAt: string | null;
426
+ lastUsedAt: string | null;
427
+ createdAt: string;
428
+ }[];
429
+ total: number;
430
+ }>;
431
+ createWebhookToken: (projectId: string, connectorId: string, body: CreateWebhookTokenDto) => Promise<{
432
+ id: string;
433
+ name: string;
434
+ prefix: string;
435
+ plaintext: string;
436
+ expiresAt: string | null;
437
+ }>;
438
+ revokeWebhookToken: (projectId: string, connectorId: string, tokenId: string) => Promise<undefined>;
439
+ revealWebhookToken: (projectId: string, connectorId: string, tokenId: string) => Promise<{
440
+ tokenId: string;
441
+ plaintext: string | null;
442
+ available: boolean;
443
+ }>;
444
+ };
445
+ export type ConnectorListItem = ConnectorListItemDto;
446
+ //# sourceMappingURL=connector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connector.d.ts","sourceRoot":"","sources":["../src/connector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,8BAA8B,EAI9B,oBAAoB,EACpB,qBAAqB,EAIrB,kBAAkB,EAClB,qBAAqB,EAErB,uBAAuB,EAIvB,kBAAkB,EACnB,MAAM,oBAAoB,CAAC;AAG5B,MAAM,WAAW,sBAAsB;IACrC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAoBD,eAAO,MAAM,eAAe;sBACR,MAAM,UAAU,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;qBAKtC,MAAM,eAAe,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+BAKjB,MAAM,eAAe,MAAM;;;;;;;;;;;;wBAKlC,MAAM,QAAQ,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAGhC,MAAM,eAAe,MAAM,QAAQ,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAKrD,MAAM,eAAe,MAAM,YAAY,sBAAsB;4BAKzD,MAAM,QAAQ,8BAA8B;;;;;;;;;;;uBAKjD,MAAM,eAAe,MAAM;;;;;;;sBAK5B,MAAM,eAAe,MAAM,QAAQ,uBAAuB;;;;;;;;;;;;;mCAO7C,MAAM,eAAe,MAAM;;;;;;;;;;;oCAK1B,MAAM,eAAe,MAAM,QAAQ,qBAAqB;;;;;;;oCAKxD,MAAM,eAAe,MAAM,WAAW,MAAM;oCAK5C,MAAM,eAAe,MAAM,WAAW,MAAM;;;;;CAI7E,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,oBAAoB,CAAC"}
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.connectorClient = void 0;
4
+ const http_1 = require("./http");
5
+ function buildDeleteParams(options) {
6
+ if (!options)
7
+ return undefined;
8
+ const params = {};
9
+ if (options.force)
10
+ params.force = 'true';
11
+ if (options.reason)
12
+ params.reason = options.reason;
13
+ return Object.keys(params).length > 0 ? params : undefined;
14
+ }
15
+ function buildListParams(query) {
16
+ if (!query)
17
+ return undefined;
18
+ const params = {};
19
+ if (query.direction)
20
+ params.direction = query.direction;
21
+ if (query.type)
22
+ params.type = query.type;
23
+ if (query.healthStatus)
24
+ params.healthStatus = query.healthStatus;
25
+ if (query.search)
26
+ params.search = query.search;
27
+ return Object.keys(params).length > 0 ? params : undefined;
28
+ }
29
+ exports.connectorClient = {
30
+ list: (projectId, query) => http_1.httpClient
31
+ .get(`/connectors`, { params: buildListParams(query) })
32
+ .then((r) => r.data),
33
+ get: (projectId, connectorId) => http_1.httpClient
34
+ .get(`/connectors/${connectorId}`)
35
+ .then((r) => r.data),
36
+ getReferences: (projectId, connectorId) => http_1.httpClient
37
+ .get(`/connectors/${connectorId}/references`)
38
+ .then((r) => r.data),
39
+ create: (projectId, body) => http_1.httpClient.post(`/connectors`, body).then((r) => r.data),
40
+ update: (projectId, connectorId, body) => http_1.httpClient
41
+ .patch(`/connectors/${connectorId}`, body)
42
+ .then((r) => r.data),
43
+ delete: (projectId, connectorId, options) => http_1.httpClient
44
+ .delete(`/connectors/${connectorId}`, { params: buildDeleteParams(options) })
45
+ .then(() => undefined),
46
+ bulkDelete: (projectId, body) => http_1.httpClient
47
+ .post(`/connectors/bulk-delete`, body)
48
+ .then((r) => r.data),
49
+ probe: (projectId, connectorId) => http_1.httpClient
50
+ .post(`/connectors/${connectorId}/probe`)
51
+ .then((r) => r.data),
52
+ peek: (projectId, connectorId, body) => http_1.httpClient
53
+ .post(`/connectors/${connectorId}/peek`, body)
54
+ .then((r) => r.data),
55
+ // per-connector webhook tokens (scope='webhook', AND connector_id=...)
56
+ // See docs/specs/26-connectors.md / docs/specs/06-database-schema.md §3.2
57
+ listWebhookTokens: (projectId, connectorId) => http_1.httpClient
58
+ .get(`/connectors/${connectorId}/webhook-tokens`)
59
+ .then((r) => r.data),
60
+ createWebhookToken: (projectId, connectorId, body) => http_1.httpClient
61
+ .post(`/connectors/${connectorId}/webhook-tokens`, body)
62
+ .then((r) => r.data),
63
+ revokeWebhookToken: (projectId, connectorId, tokenId) => http_1.httpClient
64
+ .delete(`/connectors/${connectorId}/webhook-tokens/${tokenId}`)
65
+ .then(() => undefined),
66
+ revealWebhookToken: (projectId, connectorId, tokenId) => http_1.httpClient
67
+ .get(`/connectors/${connectorId}/webhook-tokens/${tokenId}/plaintext`)
68
+ .then((r) => r.data),
69
+ };
70
+ //# sourceMappingURL=connector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connector.js","sourceRoot":"","sources":["../src/connector.ts"],"names":[],"mappings":";;;AAmBA,iCAAoC;AAOpC,SAAS,iBAAiB,CAAC,OAAgC;IACzD,IAAI,CAAC,OAAO;QAAE,OAAO,SAAS,CAAC;IAC/B,MAAM,MAAM,GAA2B,EAAE,CAAC;IAC1C,IAAI,OAAO,CAAC,KAAK;QAAE,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC;IACzC,IAAI,OAAO,CAAC,MAAM;QAAE,MAAM,CAAC,M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C9E,iBAAU;SACP,IAAI,CAA2B,eAAe,WAAW,OAAO,EAAE,IAAI,CAAC;SACvE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IAExB,uEAAuE;IACvE,0EAA0E;IAC1E,iBAAiB,EAAE,CAAC,SAAiB,EAAE,WAAmB,EAAE,EAAE,CAC5D,iBAAU;SACP,GAAG,CAA+B,eAAe,WAAW,iBAAiB,CAAC;SAC9E,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IAExB,kBAAkB,EAAE,CAAC,SAAiB,EAAE,WAAmB,EAAE,IAA2B,EAAE,EAAE,CAC1F,iBAAU;SACP,IAAI,CAAgC,eAAe,WAAW,iBAAiB,EAAE,IAAI,CAAC;SACtF,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IAExB,kBAAkB,EAAE,CAAC,SAAiB,EAAE,WAAmB,EAAE,OAAe,EAAE,EAAE,CAC9E,iBAAU;SACP,MAAM,CAAO,eAAe,WAAW,mBAAmB,OAAO,EAAE,CAAC;SACpE,IAAI,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC;IAE1B,kBAAkB,EAAE,CAAC,SAAiB,EAAE,WAAmB,EAAE,OAAe,EAAE,EAAE,CAC9E,iBAAU;SACP,GAAG,CAAgC,eAAe,WAAW,mBAAmB,OAAO,YAAY,CAAC;SACpG,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;CACzB,CAAC"}
@@ -0,0 +1,75 @@
1
+ import type { CreateDatasetImportDto, DatasetImportBatchDto } from '@proofhound/shared';
2
+ export declare const datasetImportClient: {
3
+ getDatasetImport: (projectId: string, importId: string) => Promise<{
4
+ id: string;
5
+ projectId: string;
6
+ datasetId: string | null;
7
+ name: string;
8
+ description: string | null;
9
+ fileName: string;
10
+ fileSizeBytes: number;
11
+ sourceFormat: "csv" | "jsonl" | "tsv";
12
+ declaredTotalRows: number | null;
13
+ receivedRows: number;
14
+ status: "importing" | "ready";
15
+ createdAt: string;
16
+ updatedAt: string;
17
+ }>;
18
+ createDatasetImport: (projectId: string, body: CreateDatasetImportDto) => Promise<{
19
+ id: string;
20
+ projectId: string;
21
+ datasetId: string | null;
22
+ name: string;
23
+ description: string | null;
24
+ fileName: string;
25
+ fileSizeBytes: number;
26
+ sourceFormat: "csv" | "jsonl" | "tsv";
27
+ declaredTotalRows: number | null;
28
+ receivedRows: number;
29
+ status: "importing" | "ready";
30
+ createdAt: string;
31
+ updatedAt: string;
32
+ }>;
33
+ appendDatasetImportBatch: (projectId: string, importId: string, body: DatasetImportBatchDto) => Promise<{
34
+ importId: string;
35
+ receivedRows: number;
36
+ }>;
37
+ completeDatasetImport: (projectId: string, importId: string) => Promise<{
38
+ dataset: {
39
+ id: string;
40
+ projectId: string;
41
+ name: string;
42
+ description: string | null;
43
+ sampleCount: number;
44
+ fieldSchema: {
45
+ name: string;
46
+ role: "text" | "metadata" | "image" | "image_url" | "image_base64" | "expected_output";
47
+ type: "string" | "number" | "boolean" | "object" | "unknown" | "null" | "array";
48
+ }[];
49
+ categoryDistribution: {
50
+ field: string | null;
51
+ total: number;
52
+ categories: {
53
+ label: string;
54
+ count: number;
55
+ }[];
56
+ };
57
+ references: {
58
+ experiments: number;
59
+ optimizations: number;
60
+ };
61
+ hasImages: boolean;
62
+ storagePrefix: string | null;
63
+ createdBy: string;
64
+ createdByDisplayName: string | null;
65
+ createdAt: string;
66
+ updatedAt: string;
67
+ deletedAt: string | null;
68
+ };
69
+ sampleCount: number;
70
+ }>;
71
+ abortDatasetImport: (projectId: string, importId: string) => Promise<undefined>;
72
+ abortDatasetImportBeacon: (projectId: string, importId: string) => boolean;
73
+ };
74
+ export type DatasetImportClient = typeof datasetImportClient;
75
+ //# sourceMappingURL=dataset-import.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataset-import.d.ts","sourceRoot":"","sources":["../src/dataset-import.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,sBAAsB,EACtB,qBAAqB,EAGtB,MAAM,oBAAoB,CAAC;AAI5B,eAAO,MAAM,mBAAmB;kCACA,MAAM,YAAY,MAAM;;;;;;;;;;;;;;;qCAErB,MAAM,QAAQ,sBAAsB;;;;;;;;;;;;;;;0CAE/B,MAAM,YAAY,MAAM,QAAQ,qBAAqB;;;;uCAIxD,MAAM,YAAY,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCAI3B,MAAM,YAAY,MAAM;0CAKlB,MAAM,YAAY,MAAM,KAAG,OAAO;CAIzE,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,OAAO,mBAAmB,CAAC"}