@blazeo.com/calendar-client 1.0.6 → 1.0.7

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.ts CHANGED
@@ -119,9 +119,15 @@ export const LeadModel: {
119
119
  opts?: {
120
120
  skip?: number;
121
121
  take?: number;
122
+ /** Maps to API query `sort`. */
123
+ sortBy?: string;
124
+ /** Maps to API query `sort_dir` (`asc` / `desc`). */
125
+ sortOrder?: 'ASC' | 'DESC' | 'asc' | 'desc' | string;
126
+ /** Same as `sortBy` (sent as `sort` on the wire). */
122
127
  sort?: string;
123
128
  sort_column?: string;
124
- sort_dir?: 'asc' | 'desc';
129
+ /** Same as `sortOrder` (sent as `sort_dir` on the wire). */
130
+ sort_dir?: 'asc' | 'desc' | string;
125
131
  page?: number;
126
132
  page_size?: number;
127
133
  }
package/dist/index.js CHANGED
@@ -719,7 +719,7 @@ var CalendarModel = import_mobx_state_tree7.types.model("Calendar", {
719
719
  };
720
720
  const res = await reqPost("/Calendar/Create", payload);
721
721
  if (res.status === "success" && res.data) {
722
- (0, import_mobx_state_tree7.applySnapshot)(self, { ...res.data, calendarId: res.data.calendarId || self.calendarId });
722
+ self, { ...res.data, calendarId: res.data.calendarId || self.calendarId };
723
723
  }
724
724
  return res;
725
725
  },
@@ -1824,13 +1824,20 @@ LeadModel.getByEmail = async (email, companyKey) => {
1824
1824
  LeadModel.getByCompany = async (companyKey, opts = {}) => {
1825
1825
  const { reqGet } = createRequestHelpersFromEnv(getConfig());
1826
1826
  const query = { company_key: companyKey };
1827
- if (opts.skip != null) query.skip = opts.skip;
1828
- if (opts.take != null) query.take = opts.take;
1829
- const sortCol = opts.sort ?? opts.sort_column;
1830
- if (sortCol != null && sortCol !== "") query.sort = sortCol;
1831
- if (opts.sort_dir != null) query.sort_dir = opts.sort_dir;
1832
- if (opts.page != null) query.page = opts.page;
1833
- if (opts.page_size != null) query.page_size = opts.page_size;
1827
+ const sortBy = opts.sortBy ?? opts.sort ?? opts.sort_column;
1828
+ if (sortBy != null && sortBy !== "") query.sort = sortBy;
1829
+ const sortOrderRaw = opts.sortOrder ?? opts.sort_dir;
1830
+ if (sortOrderRaw != null && String(sortOrderRaw).trim() !== "") {
1831
+ const u = String(sortOrderRaw).trim().toUpperCase();
1832
+ query.sort_dir = u.startsWith("DESC") ? "desc" : "asc";
1833
+ }
1834
+ if (opts.page != null) {
1835
+ query.page = opts.page;
1836
+ if (opts.page_size != null) query.page_size = opts.page_size;
1837
+ } else {
1838
+ if (opts.skip != null) query.skip = opts.skip;
1839
+ if (opts.take != null) query.take = opts.take;
1840
+ }
1834
1841
  const res = await reqGet("/lead/company/get", query);
1835
1842
  if (res.status === "success" && Array.isArray(res.data)) {
1836
1843
  return res.data.map((l) => LeadModel.create(mapLeadFromApi(l), { env: getConfig() }));
package/dist/index.mjs CHANGED
@@ -666,7 +666,7 @@ var CalendarModel = types7.model("Calendar", {
666
666
  };
667
667
  const res = await reqPost("/Calendar/Create", payload);
668
668
  if (res.status === "success" && res.data) {
669
- applySnapshot2(self, { ...res.data, calendarId: res.data.calendarId || self.calendarId });
669
+ self, { ...res.data, calendarId: res.data.calendarId || self.calendarId };
670
670
  }
671
671
  return res;
672
672
  },
@@ -1771,13 +1771,20 @@ LeadModel.getByEmail = async (email, companyKey) => {
1771
1771
  LeadModel.getByCompany = async (companyKey, opts = {}) => {
1772
1772
  const { reqGet } = createRequestHelpersFromEnv(getConfig());
1773
1773
  const query = { company_key: companyKey };
1774
- if (opts.skip != null) query.skip = opts.skip;
1775
- if (opts.take != null) query.take = opts.take;
1776
- const sortCol = opts.sort ?? opts.sort_column;
1777
- if (sortCol != null && sortCol !== "") query.sort = sortCol;
1778
- if (opts.sort_dir != null) query.sort_dir = opts.sort_dir;
1779
- if (opts.page != null) query.page = opts.page;
1780
- if (opts.page_size != null) query.page_size = opts.page_size;
1774
+ const sortBy = opts.sortBy ?? opts.sort ?? opts.sort_column;
1775
+ if (sortBy != null && sortBy !== "") query.sort = sortBy;
1776
+ const sortOrderRaw = opts.sortOrder ?? opts.sort_dir;
1777
+ if (sortOrderRaw != null && String(sortOrderRaw).trim() !== "") {
1778
+ const u = String(sortOrderRaw).trim().toUpperCase();
1779
+ query.sort_dir = u.startsWith("DESC") ? "desc" : "asc";
1780
+ }
1781
+ if (opts.page != null) {
1782
+ query.page = opts.page;
1783
+ if (opts.page_size != null) query.page_size = opts.page_size;
1784
+ } else {
1785
+ if (opts.skip != null) query.skip = opts.skip;
1786
+ if (opts.take != null) query.take = opts.take;
1787
+ }
1781
1788
  const res = await reqGet("/lead/company/get", query);
1782
1789
  if (res.status === "success" && Array.isArray(res.data)) {
1783
1790
  return res.data.map((l) => LeadModel.create(mapLeadFromApi(l), { env: getConfig() }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blazeo.com/calendar-client",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "Blazeo Calendar / Appointment API client with MobX State Tree models",
5
5
  "exports": {
6
6
  ".": {