@tensorlakeai/tensorlake 0.5.160 → 0.5.161

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.cts CHANGED
@@ -2091,6 +2091,14 @@ interface UsageClientOptions {
2091
2091
  interface UsageReadOptions {
2092
2092
  /** Read the last `1d`, `7d` or `30d` instead of the current billing period. */
2093
2093
  last?: UsageLookback;
2094
+ /**
2095
+ * Range start, as a `Date` or an RFC 3339 string. Can't be combined with
2096
+ * `last`. The server serves ranges that start inside the current billing
2097
+ * period or the last 30 days, whichever starts earlier.
2098
+ */
2099
+ fromDate?: Date | string;
2100
+ /** Range end. Requires `fromDate`; defaults to now. */
2101
+ toDate?: Date | string;
2094
2102
  }
2095
2103
  /** Metered usage, excluding subscription fees and tax. */
2096
2104
  interface UsageCharge {
@@ -2194,8 +2202,9 @@ interface SandboxUsageExport {
2194
2202
  /**
2195
2203
  * Read an organization's sandbox usage and cost.
2196
2204
  *
2197
- * Every read covers the current billing period, or the last `1d`, `7d` or
2198
- * `30d` when `last` is set. Requests, windows and response parsing are done
2205
+ * Every read covers the current billing period, unless you set either `last`
2206
+ * (`1d`, `7d` or `30d`) or a range with `fromDate` and an optional `toDate`.
2207
+ * Requests, windows and response parsing are done
2199
2208
  * by the Rust SDK, the same as for Python and the CLI.
2200
2209
  */
2201
2210
  declare class UsageClient {
package/dist/index.d.ts CHANGED
@@ -2091,6 +2091,14 @@ interface UsageClientOptions {
2091
2091
  interface UsageReadOptions {
2092
2092
  /** Read the last `1d`, `7d` or `30d` instead of the current billing period. */
2093
2093
  last?: UsageLookback;
2094
+ /**
2095
+ * Range start, as a `Date` or an RFC 3339 string. Can't be combined with
2096
+ * `last`. The server serves ranges that start inside the current billing
2097
+ * period or the last 30 days, whichever starts earlier.
2098
+ */
2099
+ fromDate?: Date | string;
2100
+ /** Range end. Requires `fromDate`; defaults to now. */
2101
+ toDate?: Date | string;
2094
2102
  }
2095
2103
  /** Metered usage, excluding subscription fees and tax. */
2096
2104
  interface UsageCharge {
@@ -2194,8 +2202,9 @@ interface SandboxUsageExport {
2194
2202
  /**
2195
2203
  * Read an organization's sandbox usage and cost.
2196
2204
  *
2197
- * Every read covers the current billing period, or the last `1d`, `7d` or
2198
- * `30d` when `last` is set. Requests, windows and response parsing are done
2205
+ * Every read covers the current billing period, unless you set either `last`
2206
+ * (`1d`, `7d` or `30d`) or a range with `fromDate` and an optional `toDate`.
2207
+ * Requests, windows and response parsing are done
2199
2208
  * by the Rust SDK, the same as for Python and the CLI.
2200
2209
  */
2201
2210
  declare class UsageClient {
package/dist/index.js CHANGED
@@ -46,7 +46,7 @@ var init_defaults = __esm({
46
46
  "src/defaults.ts"() {
47
47
  "use strict";
48
48
  init_esm_shims();
49
- SDK_VERSION = "0.5.160";
49
+ SDK_VERSION = "0.5.161";
50
50
  API_URL = process.env.TENSORLAKE_API_URL ?? "https://api.tensorlake.ai";
51
51
  API_KEY = process.env.TENSORLAKE_API_KEY ?? void 0;
52
52
  NAMESPACE = process.env.INDEXIFY_NAMESPACE ?? "default";
@@ -519,7 +519,7 @@ var init_native_worker_client = __esm({
519
519
  }
520
520
  };
521
521
  runtimeKey = /* @__PURE__ */ Symbol.for(
522
- `tensorlake.native.worker.${false ? "source" : "0.5.160"}.v1`
522
+ `tensorlake.native.worker.${false ? "source" : "0.5.161"}.v1`
523
523
  );
524
524
  runtimes = globalThis;
525
525
  }
@@ -8806,6 +8806,10 @@ init_defaults();
8806
8806
  init_errors();
8807
8807
  init_native_sandbox();
8808
8808
  init_native_worker_client();
8809
+ function nativeWindow(options) {
8810
+ const iso = (value) => value === void 0 ? null : value instanceof Date ? value.toISOString() : value;
8811
+ return [options?.last ?? null, iso(options?.fromDate), iso(options?.toDate)];
8812
+ }
8809
8813
  var UsageClient = class {
8810
8814
  native;
8811
8815
  constructor(options) {
@@ -8838,7 +8842,7 @@ var UsageClient = class {
8838
8842
  }
8839
8843
  /** Organization usage totals for the window. */
8840
8844
  async summary(options) {
8841
- const { json } = await callNative(() => this.native.summary(options?.last ?? null));
8845
+ const { json } = await callNative(() => this.native.summary(...nativeWindow(options)));
8842
8846
  return JSON.parse(json);
8843
8847
  }
8844
8848
  /**
@@ -8848,7 +8852,7 @@ var UsageClient = class {
8848
8852
  * response.
8849
8853
  */
8850
8854
  async sandboxes(options) {
8851
- const { json } = await callNative(() => this.native.sandboxes(options?.last ?? null));
8855
+ const { json } = await callNative(() => this.native.sandboxes(...nativeWindow(options)));
8852
8856
  return JSON.parse(json);
8853
8857
  }
8854
8858
  };