@blinkdotnew/sdk 0.2.0 → 0.2.2

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.mjs CHANGED
@@ -38,6 +38,12 @@ var BlinkAIError = class extends BlinkError {
38
38
  this.name = "BlinkAIError";
39
39
  }
40
40
  };
41
+ var BlinkDataError = class extends BlinkError {
42
+ constructor(message, status, details) {
43
+ super(message, "DATA_ERROR", status, details);
44
+ this.name = "BlinkDataError";
45
+ }
46
+ };
41
47
 
42
48
  // ../core/src/query-builder.ts
43
49
  function buildFilterQuery(condition) {
@@ -527,6 +533,15 @@ var HttpClient = class {
527
533
  signal
528
534
  });
529
535
  }
536
+ /**
537
+ * Data-specific requests
538
+ */
539
+ async dataExtractFromUrl(url, filename) {
540
+ return this.request(`/api/data/${this.projectId}/extract-from-url`, {
541
+ method: "POST",
542
+ body: { url, filename }
543
+ });
544
+ }
530
545
  /**
531
546
  * Private helper methods
532
547
  */
@@ -2277,12 +2292,41 @@ var BlinkAIImpl = class {
2277
2292
  }
2278
2293
  };
2279
2294
 
2295
+ // src/data.ts
2296
+ var BlinkDataImpl = class {
2297
+ constructor(httpClient) {
2298
+ this.httpClient = httpClient;
2299
+ }
2300
+ async extractFromUrl(url, filename) {
2301
+ try {
2302
+ const response = await this.httpClient.dataExtractFromUrl(url, filename);
2303
+ if (response.data?.chunks) {
2304
+ return {
2305
+ chunks: response.data.chunks
2306
+ };
2307
+ } else {
2308
+ throw new BlinkDataError("Invalid response format: missing chunks");
2309
+ }
2310
+ } catch (error) {
2311
+ if (error instanceof BlinkDataError) {
2312
+ throw error;
2313
+ }
2314
+ throw new BlinkDataError(
2315
+ `Data extraction failed: ${error instanceof Error ? error.message : "Unknown error"}`,
2316
+ void 0,
2317
+ { originalError: error }
2318
+ );
2319
+ }
2320
+ }
2321
+ };
2322
+
2280
2323
  // src/client.ts
2281
2324
  var BlinkClientImpl = class {
2282
2325
  auth;
2283
2326
  db;
2284
2327
  storage;
2285
2328
  ai;
2329
+ data;
2286
2330
  httpClient;
2287
2331
  constructor(config) {
2288
2332
  this.auth = new BlinkAuth(config);
@@ -2294,6 +2338,7 @@ var BlinkClientImpl = class {
2294
2338
  this.db = new BlinkDatabase(this.httpClient);
2295
2339
  this.storage = new BlinkStorageImpl(this.httpClient);
2296
2340
  this.ai = new BlinkAIImpl(this.httpClient);
2341
+ this.data = new BlinkDataImpl(this.httpClient);
2297
2342
  }
2298
2343
  };
2299
2344
  function createClient(config) {
@@ -2307,6 +2352,6 @@ function createClient(config) {
2307
2352
  return new BlinkClientImpl(clientConfig);
2308
2353
  }
2309
2354
 
2310
- export { BlinkAIImpl, BlinkDatabase, BlinkStorageImpl, BlinkTable, createClient };
2355
+ export { BlinkAIImpl, BlinkDataImpl, BlinkDatabase, BlinkStorageImpl, BlinkTable, createClient };
2311
2356
  //# sourceMappingURL=index.mjs.map
2312
2357
  //# sourceMappingURL=index.mjs.map