swiftbase-admin-sdk 1.0.3 → 1.0.5

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.cjs CHANGED
@@ -9,6 +9,7 @@ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
9
  var __getProtoOf = Object.getPrototypeOf;
10
10
  var __hasOwnProp = Object.prototype.hasOwnProperty;
11
11
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
+ var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
12
13
  var __typeError = (msg) => {
13
14
  throw TypeError(msg);
14
15
  };
@@ -88,6 +89,21 @@ var __async = (__this, __arguments, generator) => {
88
89
  step((generator = generator.apply(__this, __arguments)).next());
89
90
  });
90
91
  };
92
+ var __await = function(promise, isYieldStar) {
93
+ this[0] = promise;
94
+ this[1] = isYieldStar;
95
+ };
96
+ var __asyncGenerator = (__this, __arguments, generator) => {
97
+ var resume = (k, v, yes, no) => {
98
+ try {
99
+ var x = generator[k](v), isAwait = (v = x.value) instanceof __await, done = x.done;
100
+ Promise.resolve(isAwait ? v[0] : v).then((y) => isAwait ? resume(k === "return" ? k : "next", v[1] ? { done: y.done, value: y.value } : y, yes, no) : yes({ value: y, done })).catch((e) => resume("throw", e, yes, no));
101
+ } catch (e) {
102
+ no(e);
103
+ }
104
+ }, method = (k, call, wait, clear) => it[k] = (x) => (call = new Promise((yes, no, run) => (run = () => resume(k, x, yes, no), q ? q.then(run) : run())), clear = () => q === wait && (q = 0), q = wait = call.then(clear, clear), call), q, it = {};
105
+ return generator = generator.apply(__this, __arguments), it[__knownSymbol("asyncIterator")] = () => it, method("next"), method("throw"), method("return"), it;
106
+ };
91
107
 
92
108
  // src/common/token.ts
93
109
  var _token, _type, _expiration, Token;
@@ -4363,6 +4379,31 @@ var QueryBuilder = class {
4363
4379
  return yield makeRequest("post" /* POST */, "/api/db/query", void 0, this.payload);
4364
4380
  });
4365
4381
  }
4382
+ /**
4383
+ * Seamlessly stream query batches for large volume data operations
4384
+ */
4385
+ stream() {
4386
+ return __asyncGenerator(this, arguments, function* (options = {}) {
4387
+ const batchSize = options.batchSize || 1e3;
4388
+ let offset = this.payload.offset || 0;
4389
+ const maxLimit = this.payload.limit;
4390
+ while (true) {
4391
+ const currentBatchLimit = maxLimit ? Math.min(batchSize, maxLimit - offset) : batchSize;
4392
+ if (currentBatchLimit <= 0) break;
4393
+ const pagePayload = __spreadProps(__spreadValues({}, this.payload), {
4394
+ limit: currentBatchLimit,
4395
+ offset
4396
+ });
4397
+ const result = yield new __await(makeRequest("post" /* POST */, "/api/db/query", void 0, pagePayload));
4398
+ const rows = result.data || [];
4399
+ if (rows.length === 0) break;
4400
+ yield { data: rows, count: rows.length };
4401
+ offset += rows.length;
4402
+ if (rows.length < currentBatchLimit) break;
4403
+ if (maxLimit && offset >= maxLimit) break;
4404
+ }
4405
+ });
4406
+ }
4366
4407
  then(onfulfilled, onrejected) {
4367
4408
  return this.execute().then(onfulfilled, onrejected);
4368
4409
  }
@@ -4613,13 +4654,39 @@ function parseListBuckets(xml) {
4613
4654
  }
4614
4655
  return buckets;
4615
4656
  }
4616
- function parseListObjects(xml) {
4617
- const nameMatch = xml.match(/<Name>(.*?)<\/Name>/);
4618
- const prefixMatch = xml.match(/<Prefix>(.*?)<\/Prefix>/);
4619
- const maxKeysMatch = xml.match(/<MaxKeys>(.*?)<\/MaxKeys>/);
4620
- const isTruncatedMatch = xml.match(/<IsTruncated>(.*?)<\/IsTruncated>/);
4657
+ function parseListObjects(text) {
4658
+ const trimmed = text.trim();
4659
+ if (trimmed.startsWith("[") || trimmed.startsWith("{")) {
4660
+ try {
4661
+ const parsed = JSON.parse(trimmed);
4662
+ const items = Array.isArray(parsed) ? parsed : parsed.contents || [];
4663
+ const contents2 = items.map((item) => {
4664
+ const pathPrefix = item.path && item.path !== "/" ? item.path.replace(/\/$/, "") + "/" : "";
4665
+ const key = item.key || (item.name ? `${pathPrefix}${item.name}` : "");
4666
+ return {
4667
+ key,
4668
+ lastModified: item.modified || item.lastModified,
4669
+ etag: item.etag,
4670
+ size: item.size || 0
4671
+ };
4672
+ });
4673
+ return {
4674
+ name: "",
4675
+ prefix: "",
4676
+ maxKeys: contents2.length,
4677
+ isTruncated: false,
4678
+ contents: contents2,
4679
+ commonPrefixes: []
4680
+ };
4681
+ } catch (e) {
4682
+ }
4683
+ }
4684
+ const nameMatch = text.match(/<Name>(.*?)<\/Name>/);
4685
+ const prefixMatch = text.match(/<Prefix>(.*?)<\/Prefix>/);
4686
+ const maxKeysMatch = text.match(/<MaxKeys>(.*?)<\/MaxKeys>/);
4687
+ const isTruncatedMatch = text.match(/<IsTruncated>(.*?)<\/IsTruncated>/);
4621
4688
  const contents = [];
4622
- const contentMatches = xml.matchAll(/<Contents>([\s\S]*?)<\/Contents>/g);
4689
+ const contentMatches = text.matchAll(/<Contents>([\s\S]*?)<\/Contents>/g);
4623
4690
  for (const match of contentMatches) {
4624
4691
  const content = match[1];
4625
4692
  const keyMatch = content.match(/<Key>(.*?)<\/Key>/);
@@ -4636,11 +4703,11 @@ function parseListObjects(xml) {
4636
4703
  }
4637
4704
  }
4638
4705
  const commonPrefixes = [];
4639
- const cpMatches = xml.matchAll(/<CommonPrefixes>([\s\S]*?)<\/CommonPrefixes>/g);
4706
+ const cpMatches = text.matchAll(/<CommonPrefixes>([\s\S]*?)<\/CommonPrefixes>/g);
4640
4707
  for (const match of cpMatches) {
4641
- const prefixMatch2 = match[1].match(/<Prefix>(.*?)<\/Prefix>/);
4642
- if (prefixMatch2) {
4643
- commonPrefixes.push(prefixMatch2[1]);
4708
+ const pMatch = match[1].match(/<Prefix>(.*?)<\/Prefix>/);
4709
+ if (pMatch) {
4710
+ commonPrefixes.push(pMatch[1]);
4644
4711
  }
4645
4712
  }
4646
4713
  return {
@@ -4809,7 +4876,11 @@ var ai = {
4809
4876
  create: (options) => __async(null, null, function* () {
4810
4877
  return yield makeRequest("post" /* POST */, "/api/ai/chat/completions", void 0, {
4811
4878
  model: options.model || "gemini-3.5-flash",
4812
- messages: options.messages
4879
+ messages: options.messages,
4880
+ tools: options.tools,
4881
+ tool_choice: options.tool_choice,
4882
+ temperature: options.temperature,
4883
+ max_tokens: options.max_tokens
4813
4884
  });
4814
4885
  })
4815
4886
  }