@joai/sdk 14.0.0 → 14.0.1

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.mts CHANGED
@@ -821,6 +821,8 @@ declare class BillingResource {
821
821
  orders(team: TeamPrivate | null, page?: number, filters?: {
822
822
  contactId?: string;
823
823
  couponId?: string;
824
+ search?: string;
825
+ status?: OrderStatus$1[];
824
826
  }, perPage?: number): Promise<_$_joai_core0.IAppResponse<Order$1[]>>;
825
827
  orderStats(team: string): Promise<_$_joai_core0.IAppResponse<TeamOrderStats>>;
826
828
  payOrder(id: string, provider?: PaymentProvider, accessToken?: string): Promise<_$_joai_core0.IAppResponse<{
package/dist/index.mjs CHANGED
@@ -1163,6 +1163,8 @@ var BillingResource = class {
1163
1163
  let params = `orders?page=${page}&perPage=${perPage}`;
1164
1164
  if (filters.contactId) params += `&contactId=${encodeURIComponent(filters.contactId)}`;
1165
1165
  if (filters.couponId) params += `&couponId=${encodeURIComponent(filters.couponId)}`;
1166
+ if (filters.search) params += `&search=${encodeURIComponent(filters.search)}`;
1167
+ if (filters.status?.length) params += `&status=${encodeURIComponent(filters.status.join(","))}`;
1166
1168
  return this.http.get(params, team ? { headers: { "X-Team": team.slug } } : void 0);
1167
1169
  }
1168
1170
  orderStats(team) {
@@ -3719,14 +3721,15 @@ const RELATED_PREFIXES = {
3719
3721
  returns: ["orders"],
3720
3722
  orders: ["returns"]
3721
3723
  };
3724
+ const prefixVersions = /* @__PURE__ */ new Map();
3722
3725
  function getTtl(url, ttlMap, defaultTtl) {
3723
3726
  for (const [prefix, ttl] of Object.entries(ttlMap)) if (url.startsWith(prefix) || url.startsWith(`/${prefix}`)) return ttl;
3724
3727
  return defaultTtl;
3725
3728
  }
3726
3729
  function getUrlPrefix(url) {
3727
3730
  const clean = url.startsWith("/") ? url.slice(1) : url;
3728
- const slash = clean.indexOf("/");
3729
- return slash > 0 ? clean.slice(0, slash) : clean;
3731
+ const end = clean.search(/[/?]/);
3732
+ return end > 0 ? clean.slice(0, end) : clean;
3730
3733
  }
3731
3734
  var CachedHttpService = class {
3732
3735
  constructor(inner, overrides, defaultTtl) {
@@ -3776,11 +3779,13 @@ var CachedHttpService = class {
3776
3779
  this.cache.clear();
3777
3780
  }
3778
3781
  async get(url, options) {
3779
- const cached = this.cache.get(url);
3782
+ const key = `${url}#${prefixVersions.get(getUrlPrefix(url)) ?? 0}`;
3783
+ const cached = this.cache.get(key);
3780
3784
  if (cached !== void 0) return cached;
3785
+ this.cache.bust(`${url}#`);
3781
3786
  const cacheVersion = this.cacheVersion;
3782
3787
  const response = await this.inner.get(url, options);
3783
- if (response.ok && cacheVersion === this.cacheVersion) this.cache.set(url, response, getTtl(url, this.ttlMap, this.defaultTtl));
3788
+ if (response.ok && cacheVersion === this.cacheVersion) this.cache.set(key, response, getTtl(url, this.ttlMap, this.defaultTtl));
3784
3789
  return response;
3785
3790
  }
3786
3791
  async post(url, data, options) {
@@ -3809,7 +3814,11 @@ var CachedHttpService = class {
3809
3814
  bust(prefix) {
3810
3815
  this.cacheVersion++;
3811
3816
  this.cache.bust(prefix);
3812
- for (const relatedPrefix of RELATED_PREFIXES[prefix] ?? []) this.cache.bust(relatedPrefix);
3817
+ prefixVersions.set(prefix, (prefixVersions.get(prefix) ?? 0) + 1);
3818
+ for (const relatedPrefix of RELATED_PREFIXES[prefix] ?? []) {
3819
+ this.cache.bust(relatedPrefix);
3820
+ prefixVersions.set(relatedPrefix, (prefixVersions.get(relatedPrefix) ?? 0) + 1);
3821
+ }
3813
3822
  }
3814
3823
  };
3815
3824
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joai/sdk",
3
- "version": "14.0.0",
3
+ "version": "14.0.1",
4
4
  "description": "JoAi public API SDK — build with your AI agents",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -35,11 +35,11 @@
35
35
  "test": "jest --config jest.config.js"
36
36
  },
37
37
  "dependencies": {
38
- "@joai/core": "^5.4.6",
38
+ "@joai/core": "^5.4.7",
39
39
  "@joai/warps": "*"
40
40
  },
41
41
  "peerDependencies": {
42
- "@joai/core": "^5.4.6"
42
+ "@joai/core": "^5.4.7"
43
43
  },
44
44
  "devDependencies": {
45
45
  "tsdown": "^0.21.0",