@ctil/gql 1.0.20 → 1.0.21

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.js CHANGED
@@ -1,3 +1,7 @@
1
+ import {
2
+ __export
3
+ } from "./chunk-PZ5AY32C.js";
4
+
1
5
  // src/core/core.ts
2
6
  import { GraphQLClient } from "graphql-request";
3
7
 
@@ -847,7 +851,7 @@ function setDeviceIdToIndexedDB(id) {
847
851
  async function getBrowserDeviceInfo() {
848
852
  let deviceId;
849
853
  try {
850
- const { load } = await import("./fp.esm-VY6KF7TP.js");
854
+ const { load } = await import("./fp.esm-QIG5OYFT.js");
851
855
  const fp = await load();
852
856
  const result = await fp.get();
853
857
  deviceId = result.visitorId;
@@ -897,6 +901,40 @@ async function execute(payload) {
897
901
  return client2.request(payload.query, payload.variables);
898
902
  }
899
903
 
904
+ // src/builders/index.ts
905
+ var builders_exports = {};
906
+ __export(builders_exports, {
907
+ buildCommonResultSelection: () => buildCommonResultSelection,
908
+ buildDataValue: () => buildDataValue,
909
+ buildFields: () => buildFields,
910
+ buildGraphQLGetFilePreview: () => buildGraphQLGetFilePreview,
911
+ buildGraphQLMutationBatchInsert: () => buildGraphQLMutationBatchInsert,
912
+ buildGraphQLMutationBatchUpdate: () => buildGraphQLMutationBatchUpdate,
913
+ buildGraphQLMutationDelete: () => buildGraphQLMutationDelete,
914
+ buildGraphQLMutationDeleteById: () => buildGraphQLMutationDeleteById,
915
+ buildGraphQLMutationInsertOne: () => buildGraphQLMutationInsertOne,
916
+ buildGraphQLMutationLogin: () => buildGraphQLMutationLogin,
917
+ buildGraphQLMutationLogout: () => buildGraphQLMutationLogout,
918
+ buildGraphQLMutationLogoutAllDevices: () => buildGraphQLMutationLogoutAllDevices,
919
+ buildGraphQLMutationLogoutDevice: () => buildGraphQLMutationLogoutDevice,
920
+ buildGraphQLMutationRefreshToken: () => buildGraphQLMutationRefreshToken,
921
+ buildGraphQLMutationRegisterUser: () => buildGraphQLMutationRegisterUser,
922
+ buildGraphQLMutationSendCode: () => buildGraphQLMutationSendCode,
923
+ buildGraphQLMutationUpdate: () => buildGraphQLMutationUpdate,
924
+ buildGraphQLMutationUpdateByPk: () => buildGraphQLMutationUpdateByPk,
925
+ buildGraphQLMutationVerifyCode: () => buildGraphQLMutationVerifyCode,
926
+ buildGraphQLQueryAggregate: () => buildGraphQLQueryAggregate,
927
+ buildGraphQLQueryByIdFixed: () => buildGraphQLQueryByIdFixed,
928
+ buildGraphQLQueryList: () => buildGraphQLQueryList,
929
+ buildGraphQLQueryPageList: () => buildGraphQLQueryPageList,
930
+ buildGraphQLUploadPresignedUrl: () => buildGraphQLUploadPresignedUrl,
931
+ buildMutationFields: () => buildMutationFields,
932
+ buildWhere: () => buildWhere,
933
+ formatGraphQLValue: () => formatGraphQLValue,
934
+ generateOperationName: () => generateOperationName,
935
+ toPascalCase: () => toPascalCase
936
+ });
937
+
900
938
  // src/builders/baseType.ts
901
939
  function buildWhere(where) {
902
940
  if (!where) return "";
@@ -906,18 +944,27 @@ function buildWhere(where) {
906
944
  if (key === "_and" || key === "_or") {
907
945
  const sub = value.map((w) => `{ ${buildWhere(w)} }`).filter(Boolean).join(", ");
908
946
  if (sub) parts.push(`${key}: [${sub}]`);
909
- } else if (key === "_not") {
947
+ continue;
948
+ }
949
+ if (key === "_not") {
910
950
  const sub = buildWhere(value);
911
951
  if (sub) parts.push(`${key}: { ${sub} }`);
912
- } else if (typeof value === "object" && value !== null) {
952
+ continue;
953
+ }
954
+ if (Array.isArray(value)) {
955
+ const list = value.map((v) => JSON.stringify(v)).join(", ");
956
+ parts.push(`${key}: [${list}]`);
957
+ continue;
958
+ }
959
+ if (typeof value === "object" && value !== null) {
913
960
  const sub = buildWhere(value);
914
- parts.push(`${key}: { ${sub} }`);
961
+ if (sub) parts.push(`${key}: { ${sub} }`);
962
+ continue;
963
+ }
964
+ if (typeof value === "string" && value.startsWith("$")) {
965
+ parts.push(`${key}: ${value}`);
915
966
  } else {
916
- if (typeof value === "string" && value.startsWith("$")) {
917
- parts.push(`${key}: ${value}`);
918
- } else {
919
- parts.push(`${key}: ${JSON.stringify(value)}`);
920
- }
967
+ parts.push(`${key}: ${JSON.stringify(value)}`);
921
968
  }
922
969
  }
923
970
  return parts.join(", ");
@@ -983,6 +1030,24 @@ function formatGraphQLValue(value) {
983
1030
  }
984
1031
  return JSON.stringify(value);
985
1032
  }
1033
+ function generateOperationName(entityName, original) {
1034
+ const lower = original.toLowerCase();
1035
+ const e = entityName.toLowerCase();
1036
+ if (original.startsWith("gql_")) {
1037
+ if (lower.endsWith("pagelist")) return `get${entityName}PageList`;
1038
+ if (lower.endsWith("querylist")) return `${e.toLowerCase()}s`;
1039
+ if (lower.endsWith("getbyid")) return `${e.toLowerCase()}_by_pk`;
1040
+ if (lower.endsWith("aggregate")) return `${e.toLowerCase()}_aggregateount`;
1041
+ if (lower.endsWith("insertone")) return `insert_${e.toLowerCase()}_one`;
1042
+ if (lower.endsWith("batchinsert")) return `insert_${e.toLowerCase()}s`;
1043
+ if (lower.endsWith("batchupdate")) return `update_${e.toLowerCase()}_many`;
1044
+ if (lower.endsWith("updatebypk")) return `update_${e.toLowerCase()}_by_pk`;
1045
+ if (lower.endsWith("update")) return `update_${e.toLowerCase()}`;
1046
+ if (lower.endsWith("deletebyid")) return `delete_${e.toLowerCase()}_by_pk`;
1047
+ if (lower.endsWith("delete")) return `delete_${e.toLowerCase()}`;
1048
+ }
1049
+ return original;
1050
+ }
986
1051
  function toPascalCase(str) {
987
1052
  const camel = str.replace(/[-_ ]+(\w)/g, (_, c) => c ? c.toUpperCase() : "").replace(/^\w/, (c) => c.toLowerCase());
988
1053
  return camel.charAt(0).toUpperCase() + camel.slice(1);
@@ -1594,6 +1659,9 @@ var CCRequest = class {
1594
1659
  this.headers.Authorization = `Bearer ${token}`;
1595
1660
  this.buildClient();
1596
1661
  }
1662
+ getToken() {
1663
+ return this.config.Authorization || this.headers.Authorization;
1664
+ }
1597
1665
  removeToken() {
1598
1666
  this.config.Authorization = void 0;
1599
1667
  delete this.headers.Authorization;
@@ -1668,12 +1736,21 @@ var CCRequest = class {
1668
1736
  this.config.endpoint = endpoint;
1669
1737
  this.buildClient();
1670
1738
  }
1739
+ getEndpoint() {
1740
+ return this.config.endpoint;
1741
+ }
1671
1742
  setHeader(key, value) {
1672
1743
  this.headers[key] = value;
1673
1744
  }
1745
+ getHeader(key) {
1746
+ return this.headers[key];
1747
+ }
1674
1748
  setHeaders(headers) {
1675
1749
  Object.assign(this.headers, headers);
1676
1750
  }
1751
+ getHeaders() {
1752
+ return this.headers;
1753
+ }
1677
1754
  removeHeader(key) {
1678
1755
  delete this.headers[key];
1679
1756
  }
@@ -1781,18 +1858,26 @@ function getClient() {
1781
1858
  var useInterceptor = (interceptor) => getClient().use(interceptor);
1782
1859
  var setToken = (token) => getClient().setToken(token);
1783
1860
  var removeToken = () => getClient().removeToken();
1861
+ var getToken = () => getClient().getToken();
1784
1862
  var setLoginInfo = (loginInfo, remember = false) => getClient().setLoginInfo(loginInfo, remember);
1785
1863
  var removeLoginInfo = () => getClient().removeLoginInfo();
1786
1864
  var getLoginInfo = () => getClient().getLoginInfo();
1865
+ var getLoginRoles = () => getClient().getLoginInfo()?.roles;
1787
1866
  var setEndpoint = (endpoint) => getClient().setEndpoint(endpoint);
1867
+ var getEndpoint = () => getClient().getEndpoint();
1788
1868
  var setHeader = (key, value) => getClient().setHeader(key, value);
1789
1869
  var setHeaders = (headers) => getClient().setHeaders(headers);
1870
+ var getHeaders = () => getClient().getHeaders();
1871
+ var getHeader = (key) => getClient().getHeader(key);
1790
1872
  var removeHeader = (key) => getClient().removeHeader(key);
1791
1873
  var clearHeaders = () => getClient().clearHeaders();
1792
1874
 
1793
1875
  // src/core/api/query.ts
1794
1876
  var query = {
1795
- async list(input, useCache = true, ttl) {
1877
+ // NOTE:
1878
+ // GraphQL batch queries should be implemented via alias + fragment builders.
1879
+ // Deferred until v2 API redesign.
1880
+ async list(input, useCache = false, ttl) {
1796
1881
  return rateLimit("list", "query", async () => {
1797
1882
  input.operationName = input.operationName + "s";
1798
1883
  const { query: q, variables } = buildGraphQLQueryList(input);
@@ -1806,7 +1891,7 @@ var query = {
1806
1891
  return result;
1807
1892
  });
1808
1893
  },
1809
- async byId(input, useCache = true, ttl) {
1894
+ async byId(input, useCache = false, ttl) {
1810
1895
  return rateLimit("byId", "query", async () => {
1811
1896
  const { query: q, variables } = buildGraphQLQueryByIdFixed(input);
1812
1897
  const key = getCacheKey(q, variables);
@@ -1819,7 +1904,7 @@ var query = {
1819
1904
  return result;
1820
1905
  });
1821
1906
  },
1822
- async page(input, useCache = true, ttl) {
1907
+ async page(input, useCache = false, ttl) {
1823
1908
  return rateLimit("page", "query", async () => {
1824
1909
  const { query: q, variables } = buildGraphQLQueryPageList(input);
1825
1910
  const key = getCacheKey(q, variables);
@@ -1832,7 +1917,7 @@ var query = {
1832
1917
  return result;
1833
1918
  });
1834
1919
  },
1835
- async aggregate(input, useCache = true, ttl) {
1920
+ async aggregate(input, useCache = false, ttl) {
1836
1921
  return rateLimit("aggregate", "query", async () => {
1837
1922
  const { query: q, variables } = buildGraphQLQueryAggregate(input);
1838
1923
  const key = getCacheKey(q, variables);
@@ -2085,26 +2170,416 @@ var oss = {
2085
2170
  });
2086
2171
  }
2087
2172
  };
2173
+
2174
+ // src/common/date.ts
2175
+ function formatDate(date, format = "YYYY-MM-DD HH:mm:ss") {
2176
+ const d = typeof date === "string" ? new Date(date) : date;
2177
+ const pad = (n) => n.toString().padStart(2, "0");
2178
+ return format.replace("YYYY", d.getFullYear().toString()).replace("MM", pad(d.getMonth() + 1)).replace("DD", pad(d.getDate())).replace("HH", pad(d.getHours())).replace("mm", pad(d.getMinutes())).replace("ss", pad(d.getSeconds()));
2179
+ }
2180
+ function getStartOfDay(date = /* @__PURE__ */ new Date()) {
2181
+ const d = new Date(date);
2182
+ d.setHours(0, 0, 0, 0);
2183
+ return d;
2184
+ }
2185
+ function getEndOfDay(date = /* @__PURE__ */ new Date()) {
2186
+ const d = new Date(date);
2187
+ d.setHours(23, 59, 59, 999);
2188
+ return d;
2189
+ }
2190
+ function getStartOfWeek(date = /* @__PURE__ */ new Date()) {
2191
+ const d = new Date(date);
2192
+ d.setHours(0, 0, 0, 0);
2193
+ d.setDate(d.getDate() - d.getDay() + 1);
2194
+ return d;
2195
+ }
2196
+ function getEndOfWeek(date = /* @__PURE__ */ new Date()) {
2197
+ const d = new Date(date);
2198
+ d.setHours(23, 59, 59, 999);
2199
+ d.setDate(d.getDate() - d.getDay() + 7);
2200
+ return d;
2201
+ }
2202
+ function getStartOfMonth(date = /* @__PURE__ */ new Date()) {
2203
+ const d = new Date(date);
2204
+ d.setDate(1);
2205
+ d.setHours(0, 0, 0, 0);
2206
+ return d;
2207
+ }
2208
+ function getEndOfMonth(date = /* @__PURE__ */ new Date()) {
2209
+ const d = new Date(date);
2210
+ d.setMonth(d.getMonth() + 1, 0);
2211
+ d.setHours(23, 59, 59, 999);
2212
+ return d;
2213
+ }
2214
+ function isLeapYear(year) {
2215
+ return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
2216
+ }
2217
+ function diffDays(date1, date2) {
2218
+ return Math.floor(Math.abs((date2.getTime() - date1.getTime()) / (1e3 * 3600 * 24)));
2219
+ }
2220
+ function addDays(date, n) {
2221
+ const d = new Date(date);
2222
+ d.setDate(d.getDate() + n);
2223
+ return d;
2224
+ }
2225
+ function secondsToTime(sec) {
2226
+ const h = Math.floor(sec / 3600).toString().padStart(2, "0");
2227
+ const m = Math.floor(sec % 3600 / 60).toString().padStart(2, "0");
2228
+ const s = (sec % 60).toString().padStart(2, "0");
2229
+ return `${h}:${m}:${s}`;
2230
+ }
2231
+ function fromNow(date) {
2232
+ const d = new Date(date);
2233
+ const now = /* @__PURE__ */ new Date();
2234
+ const diff = (now.getTime() - d.getTime()) / 1e3;
2235
+ if (diff < 60) return `${Math.floor(diff)}\u79D2\u524D`;
2236
+ if (diff < 3600) return `${Math.floor(diff / 60)}\u5206\u949F\u524D`;
2237
+ if (diff < 86400) return `${Math.floor(diff / 3600)}\u5C0F\u65F6\u524D`;
2238
+ if (diff < 2592e3) return `${Math.floor(diff / 86400)}\u5929\u524D`;
2239
+ return formatDate(d, "YYYY-MM-DD");
2240
+ }
2241
+
2242
+ // src/common/object.ts
2243
+ function deepClone(obj) {
2244
+ return JSON.parse(JSON.stringify(obj));
2245
+ }
2246
+ function merge(obj1, obj2) {
2247
+ return Object.assign({}, obj1, obj2);
2248
+ }
2249
+ function isEmptyObject(obj) {
2250
+ return Object.keys(obj).length === 0;
2251
+ }
2252
+ function pick(obj, keys) {
2253
+ const result = {};
2254
+ keys.forEach((k) => k in obj && (result[k] = obj[k]));
2255
+ return result;
2256
+ }
2257
+ function omit(obj, keys) {
2258
+ const result = { ...obj };
2259
+ keys.forEach((k) => delete result[k]);
2260
+ return result;
2261
+ }
2262
+ function get(obj, path3, def) {
2263
+ return String(path3).split(".").reduce((o, k) => o ? o[k] : def, obj) ?? def;
2264
+ }
2265
+ function set(obj, path3, value) {
2266
+ const keys = String(path3).split(".");
2267
+ let o = obj;
2268
+ keys.slice(0, -1).forEach((k) => {
2269
+ if (!(k in o)) o[k] = {};
2270
+ o = o[k];
2271
+ });
2272
+ o[keys[keys.length - 1]] = value;
2273
+ return obj;
2274
+ }
2275
+ function isEqual(a, b) {
2276
+ return JSON.stringify(a) === JSON.stringify(b);
2277
+ }
2278
+ function flatten(obj, prefix = "", res = {}) {
2279
+ for (const key in obj) {
2280
+ if (typeof obj[key] === "object" && obj[key] !== null) {
2281
+ flatten(obj[key], prefix + key + ".", res);
2282
+ } else {
2283
+ res[prefix + key] = obj[key];
2284
+ }
2285
+ }
2286
+ return res;
2287
+ }
2288
+ function unflatten(obj) {
2289
+ const res = {};
2290
+ for (const k in obj) {
2291
+ set(res, k, obj[k]);
2292
+ }
2293
+ return res;
2294
+ }
2295
+
2296
+ // src/common/arr.ts
2297
+ function unique(arr) {
2298
+ return Array.from(new Set(arr));
2299
+ }
2300
+ function intersection(arr1, arr2) {
2301
+ return arr1.filter((item) => arr2.includes(item));
2302
+ }
2303
+ function union(arr1, arr2) {
2304
+ return Array.from(/* @__PURE__ */ new Set([...arr1, ...arr2]));
2305
+ }
2306
+ function groupBy(arr, key) {
2307
+ return arr.reduce((acc, cur) => {
2308
+ const groupKey = String(cur[key]);
2309
+ (acc[groupKey] = acc[groupKey] || []).push(cur);
2310
+ return acc;
2311
+ }, {});
2312
+ }
2313
+ function difference(arr1, arr2) {
2314
+ return arr1.filter((item) => !arr2.includes(item));
2315
+ }
2316
+
2317
+ // src/common/number.ts
2318
+ function formatMoney(num) {
2319
+ return Number(num).toLocaleString("en-US", { maximumFractionDigits: 2 });
2320
+ }
2321
+ function add(a, b) {
2322
+ return Math.round((a + b) * 1e10) / 1e10;
2323
+ }
2324
+ function subtract(a, b) {
2325
+ return Math.round((a - b) * 1e10) / 1e10;
2326
+ }
2327
+ function multiply(a, b) {
2328
+ return Math.round(a * b * 1e10) / 1e10;
2329
+ }
2330
+ function divide(a, b) {
2331
+ if (b === 0) return NaN;
2332
+ return Math.round(a / b * 1e10) / 1e10;
2333
+ }
2334
+ function roundWithPrecision(num, precision = 2) {
2335
+ return Math.round(num * Math.pow(10, precision)) / Math.pow(10, precision);
2336
+ }
2337
+ function randomInt(min, max) {
2338
+ return Math.floor(Math.random() * (max - min + 1)) + min;
2339
+ }
2340
+ function toFixed(num, precision = 2) {
2341
+ return num.toFixed(precision);
2342
+ }
2343
+ function toPercent(num, total, precision = 2) {
2344
+ if (total === 0) return "0%";
2345
+ return (num / total * 100).toFixed(precision) + "%";
2346
+ }
2347
+ function toNonExponential(num) {
2348
+ let m = num.toExponential().match(/^\d(?:\.\d+)?/);
2349
+ return m ? Number(m[0]).toString() : num.toString();
2350
+ }
2351
+ function inRange(num, min, max) {
2352
+ return num >= min && num <= max;
2353
+ }
2354
+ function toNumber(val) {
2355
+ let n = Number(val);
2356
+ return isNaN(n) ? 0 : n;
2357
+ }
2358
+ function ceil(num) {
2359
+ return Math.ceil(num);
2360
+ }
2361
+ function floor(num) {
2362
+ return Math.floor(num);
2363
+ }
2364
+ function round(num) {
2365
+ return Math.round(num);
2366
+ }
2367
+
2368
+ // src/common/string.ts
2369
+ function toSnakeCase(str) {
2370
+ return str.replace(/[A-Z]/g, (letter) => `_${letter.toLowerCase()}`);
2371
+ }
2372
+ function capitalize(str) {
2373
+ return str.charAt(0).toUpperCase() + str.slice(1);
2374
+ }
2375
+ function truncate(str, length, suffix = "...") {
2376
+ if (str.length <= length) return str;
2377
+ return str.slice(0, length) + suffix;
2378
+ }
2379
+ function removeAllSpace(str) {
2380
+ return str.replace(/\s+/g, "");
2381
+ }
2382
+ function trim(str) {
2383
+ return str.trim();
2384
+ }
2385
+ function toCamelCase(str) {
2386
+ return str.replace(/_([a-z])/g, (_, v) => v.toUpperCase());
2387
+ }
2388
+ function kebabToCamel(str) {
2389
+ return str.replace(/-([a-z])/g, (_, v) => v.toUpperCase());
2390
+ }
2391
+ function uncapitalize(str) {
2392
+ return str.charAt(0).toLowerCase() + str.slice(1);
2393
+ }
2394
+ function reverse(str) {
2395
+ return str.split("").reverse().join("");
2396
+ }
2397
+ function isNumeric(str) {
2398
+ return /^-?\d+(\.\d+)?$/.test(str);
2399
+ }
2400
+ function isEmail(str) {
2401
+ return /^[\w-\.]+@[\w-]+(\.[\w-]+)+$/.test(str);
2402
+ }
2403
+ function countSubstr(str, sub) {
2404
+ return str.split(sub).length - 1;
2405
+ }
2406
+ function randomString(len = 8) {
2407
+ const chars = "ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678";
2408
+ let str = "";
2409
+ for (let i = 0; i < len; i++) {
2410
+ str += chars.charAt(Math.floor(Math.random() * chars.length));
2411
+ }
2412
+ return str;
2413
+ }
2414
+
2415
+ // src/common/crypto.ts
2416
+ function base64Encode(input) {
2417
+ if (typeof window !== "undefined" && window.btoa) {
2418
+ return window.btoa(unescape(encodeURIComponent(input)));
2419
+ }
2420
+ return Buffer.from(input, "utf-8").toString("base64");
2421
+ }
2422
+ function base64Decode(input) {
2423
+ if (typeof window !== "undefined" && window.atob) {
2424
+ return decodeURIComponent(escape(window.atob(input)));
2425
+ }
2426
+ return Buffer.from(input, "base64").toString("utf-8");
2427
+ }
2428
+ function hashCode(str) {
2429
+ let hash = 0;
2430
+ for (let i = 0; i < str.length; i++) {
2431
+ hash = (hash << 5) - hash + str.charCodeAt(i);
2432
+ hash |= 0;
2433
+ }
2434
+ return hash;
2435
+ }
2436
+ function md5(str) {
2437
+ let hc = "0123456789abcdef";
2438
+ let hash = 0;
2439
+ for (let i = 0; i < str.length; i++) {
2440
+ hash = (hash << 5) - hash + str.charCodeAt(i);
2441
+ hash &= hash;
2442
+ }
2443
+ let v = hash >>> 0;
2444
+ let out = "";
2445
+ for (let i = 0; i < 8; i++) {
2446
+ out = hc.charAt(v & 15) + out;
2447
+ v >>>= 4;
2448
+ }
2449
+ return out.padStart(8, "0");
2450
+ }
2451
+ function simpleSHA1(str) {
2452
+ let hash = 0;
2453
+ for (let i = 0; i < str.length; i++) {
2454
+ hash = (hash << 5) - hash + str.charCodeAt(i);
2455
+ hash |= 0;
2456
+ }
2457
+ return Math.abs(hash).toString(16);
2458
+ }
2459
+
2460
+ // src/common/file.ts
2461
+ function getExtName(filename) {
2462
+ const idx = filename.lastIndexOf(".");
2463
+ return idx > -1 ? filename.slice(idx + 1) : "";
2464
+ }
2465
+ function formatSize(bytes) {
2466
+ if (bytes < 1024) return bytes + "B";
2467
+ let k = 1024;
2468
+ let sizes = ["B", "KB", "MB", "GB", "TB"];
2469
+ let i = Math.floor(Math.log(bytes) / Math.log(k));
2470
+ return (bytes / Math.pow(k, i)).toFixed(2) + sizes[i];
2471
+ }
2472
+ function fileToBase64(file) {
2473
+ return new Promise((resolve, reject) => {
2474
+ const reader = new FileReader();
2475
+ reader.onload = () => resolve(reader.result);
2476
+ reader.onerror = (error) => reject(error);
2477
+ reader.readAsDataURL(file);
2478
+ });
2479
+ }
2480
+ function base64ToFile(dataurl, filename, mimeType) {
2481
+ const arr = dataurl.split(",");
2482
+ const match = arr[0].match(/:(.*?);/);
2483
+ const mime = mimeType || (match ? match[1] : "");
2484
+ const bstr = atob(arr[1]);
2485
+ let n = bstr.length;
2486
+ const u8arr = new Uint8Array(n);
2487
+ while (n--) {
2488
+ u8arr[n] = bstr.charCodeAt(n);
2489
+ }
2490
+ return new File([u8arr], filename, { type: mime });
2491
+ }
2088
2492
  export {
2493
+ add,
2494
+ addDays,
2089
2495
  auth,
2496
+ base64Decode,
2497
+ base64Encode,
2498
+ base64ToFile,
2499
+ capitalize,
2500
+ ceil,
2090
2501
  clearHeaders,
2502
+ countSubstr,
2503
+ deepClone,
2504
+ diffDays,
2505
+ difference,
2506
+ divide,
2507
+ fileToBase64,
2508
+ flatten,
2509
+ floor,
2510
+ formatDate,
2511
+ formatMoney,
2512
+ formatSize,
2513
+ fromNow,
2514
+ get,
2091
2515
  getBrowserDeviceInfo,
2092
2516
  getClient,
2093
2517
  getDeviceInfo,
2518
+ getEndOfDay,
2519
+ getEndOfMonth,
2520
+ getEndOfWeek,
2521
+ getEndpoint,
2522
+ getExtName,
2523
+ getHeader,
2524
+ getHeaders,
2525
+ getLoginInfo,
2526
+ getLoginRoles,
2094
2527
  getRateLimitConfig,
2528
+ getStartOfDay,
2529
+ getStartOfMonth,
2530
+ getStartOfWeek,
2531
+ getToken,
2095
2532
  gql,
2533
+ builders_exports as gqlBuilder,
2534
+ groupBy,
2535
+ hashCode,
2536
+ inRange,
2096
2537
  initGraphQLClient,
2538
+ intersection,
2539
+ isEmail,
2540
+ isEmptyObject,
2541
+ isEqual,
2542
+ isLeapYear,
2543
+ isNumeric,
2544
+ kebabToCamel,
2545
+ md5,
2546
+ merge,
2547
+ multiply,
2097
2548
  mutation,
2549
+ omit,
2098
2550
  oss,
2551
+ pick,
2099
2552
  query,
2553
+ randomInt,
2554
+ randomString,
2555
+ removeAllSpace,
2100
2556
  removeHeader,
2101
2557
  removeToken,
2558
+ reverse,
2559
+ round,
2560
+ roundWithPrecision,
2561
+ secondsToTime,
2562
+ set,
2102
2563
  setEndpoint,
2103
2564
  setHeader,
2104
2565
  setHeaders,
2105
2566
  setRateLimitConfig,
2106
2567
  setToken,
2568
+ simpleSHA1,
2107
2569
  sms,
2570
+ subtract,
2571
+ toCamelCase,
2572
+ toFixed,
2573
+ toNonExponential,
2574
+ toNumber,
2575
+ toPercent,
2576
+ toSnakeCase,
2577
+ trim,
2578
+ truncate,
2579
+ uncapitalize,
2580
+ unflatten,
2581
+ union,
2582
+ unique,
2108
2583
  useInterceptor
2109
2584
  };
2110
2585
  //# sourceMappingURL=index.js.map